:root {
  --ink: #1c2430;
  --muted: #5d6b7a;
  --paper: #f3f0e8;
  --card: #fffdf8;
  --line: #e4dccb;
  --sidebar: #1a2330;
  --sidebar-text: #d5dbe3;
  --amber: #b86e00;
  --amber-deep: #8a4e00;
  --ok: #1f7a4d;
  --danger: #9b2c2c;
  --shadow: 0 10px 30px rgba(28, 36, 48, 0.06);
  --mail-dash: #b7ab96;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: "Segoe UI", "Liberation Sans", "Noto Sans", sans-serif;
  font-size: 15px;
}

a { color: var(--amber-deep); text-decoration: none; }
a:hover { text-decoration: underline; }

.nav-toggle { position: absolute; opacity: 0; pointer-events: none; }

.app-shell { display: flex; min-height: 100vh; }

.sidebar {
  width: 248px;
  flex: none;
  background: var(--sidebar);
  color: var(--sidebar-text);
  padding: 22px 16px;
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  color: white;
  margin-bottom: 18px;
  background: #fff;
  border-radius: 12px;
  padding: 6px 8px;
  width: fit-content;
  max-width: 100%;
}
.brand:hover { text-decoration: none; }
.brand-logo { height: 40px; width: auto; display: block; }
.brand-logo-dark { display: none; }
.topbar-logo { display: none; align-items: center; }
.topbar-logo .brand-logo { height: 32px; }
.brand strong { display: block; font-size: 18px; letter-spacing: 0.04em; }
.brand small { color: #9eabba; }

.brand-mark {
  width: 36px;
  height: 36px;
  border: 2px solid #e0a100;
  border-radius: 50%;
  position: relative;
  flex: none;
}
.brand-mark::before,
.brand-mark::after {
  content: "";
  position: absolute;
  background: #e0a100;
}
.brand-mark::before { width: 2px; height: 100%; left: 50%; transform: translateX(-50%); }
.brand-mark::after { height: 2px; width: 100%; top: 50%; transform: translateY(-50%); }
.brand-mark.light { border-color: #f2c14e; }

.sidebar nav { display: flex; flex-direction: column; gap: 4px; }
.sidebar a {
  color: var(--sidebar-text);
  padding: 8px 10px;
  border-radius: 8px;
}
.sidebar a:hover { background: rgba(255, 255, 255, 0.05); text-decoration: none; }
.sidebar a.active { background: rgba(224, 161, 0, 0.18); color: #f6d48a; }
.nav-label {
  margin: 18px 10px 6px;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #7f8b99;
}
.nav-sub { padding-left: 18px; font-size: 14px; }
.nav-badge {
  display: inline-block;
  min-width: 1.2em;
  padding: 0 6px;
  border-radius: 999px;
  background: #b86e00;
  color: white;
  font-size: 12px;
  text-align: center;
}
.mail-layout { display: grid; grid-template-columns: 220px 1fr; gap: 16px; align-items: start; }
.mail-thread { grid-template-columns: 1fr 280px; }
.mail-rows { list-style: none; padding: 0; margin: 12px 0 0; }
.mail-rows li {
  padding: 16px 4px;
  border-bottom: 1px dashed var(--mail-dash);
}
.mail-rows li.empty { border-bottom: none; }
.mail-rows a { display: flex; gap: 10px; flex-wrap: wrap; align-items: baseline; }
.mail-rows .mail-from,
.mail-rows .mail-subject { font-weight: 400; }
.mail-rows .is-unread .mail-from,
.mail-rows .is-unread .mail-subject { font-weight: 700; }
.mail-cards { display: flex; flex-direction: column; gap: 12px; margin-top: 16px; }
.mail-card {
  background: var(--card);
  border: 1px dashed var(--mail-dash);
  border-radius: 12px;
  padding: 14px 16px;
}
.mail-card.is-current { box-shadow: inset 3px 0 0 var(--amber); }
.mail-card-head {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  align-items: baseline;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px dashed var(--mail-dash);
}
.mail-card-head strong { font-weight: 700; }
.mail-quote { margin-top: 10px; }
.mail-quote summary {
  cursor: pointer;
  color: var(--muted);
  list-style: none;
}
.mail-quote summary::-webkit-details-marker { display: none; }
.mail-quote summary:hover { color: var(--ink); }
.mail-body { overflow: auto; max-width: 100%; }
.mail-body img { max-width: 100%; height: auto; }
.mail-editor, .mail-compose input[type="text"], .mail-compose input:not([type="file"]):not([type="hidden"]) {
  width: min(640px, 100%);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  background: white;
  color: var(--ink);
}
.mail-editor { min-height: 180px; background: white; }
.mail-suggest { display: flex; flex-direction: column; gap: 4px; margin-bottom: 8px; }
.mail-suggest button { text-align: left; }
@media (max-width: 900px) {
  .mail-layout, .mail-thread { grid-template-columns: 1fr; }
}

.app-main { flex: 1; min-width: 0; }
.topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 28px;
  background: rgba(255, 253, 248, 0.9);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 5;
}
.topbar-title { font-weight: 650; }
.topbar-user { margin-left: auto; display: flex; align-items: center; gap: 10px; color: var(--muted); }
.topbar-user em { font-style: normal; color: var(--amber-deep); font-size: 12px; }
.btn-logout { color: var(--ink); padding: 0; text-decoration: none; }
.nav-burger { display: none; }

.content { padding: 28px; max-width: 1180px; }
.content-wide { max-width: 1440px; }
.wh-nav, .wh-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 14px; }
.wh-nav a { padding: 6px 10px; border-radius: 999px; border: 1px solid var(--line); background: var(--card); }
.wh-nav a.active { background: var(--amber); color: white; border-color: var(--amber); }
.stock-photo { width: 40px; height: 40px; object-fit: contain; background: #f7f4ee; border-radius: 6px; display: block; }
.stock-photo-empty { background: #f7f4ee; }
.facts input, .facts select, .tg-bar input, .wh-nav + .panel input[type="text"] {
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--ink);
}

h1 { font-size: 28px; margin: 0 0 8px; letter-spacing: -0.02em; }
h2 { font-size: 18px; margin: 0 0 12px; }
.lead, .muted, .note-text { color: var(--muted); }
.kicker { text-transform: uppercase; letter-spacing: 0.08em; font-size: 12px; color: var(--amber-deep); margin-bottom: 6px; }

.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 20px;
  box-shadow: var(--shadow);
  margin-bottom: 16px;
}
.note { border-left: 4px solid var(--amber); }

.stat-grid, .split { display: grid; gap: 12px; }
.stat-grid { grid-template-columns: repeat(3, 1fr); margin: 18px 0; }
.split { grid-template-columns: 1fr 1fr; }
.stat {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px 18px;
  color: inherit;
  box-shadow: var(--shadow);
}
.stat:hover { text-decoration: none; border-color: #d7b56a; }
.stat span, .stat small { display: block; color: var(--muted); }
.stat strong { display: block; font-size: 32px; line-height: 1.1; margin-top: 4px; }

.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.filters .form-control, .filters .form-select { max-width: 280px; }
.archive-filters .form-control, .archive-filters .form-select { max-width: 180px; }
.check { display: flex; align-items: center; gap: 6px; color: var(--muted); }

.btn-accent {
  background: var(--amber);
  border: 0;
  color: white;
  border-radius: 8px;
  padding: 8px 14px;
}
.btn-accent:hover { background: var(--amber-deep); color: white; }

.table-wrap { overflow-x: auto; }
.table-meta { color: var(--muted); font-size: 13px; margin-bottom: 6px; }
.sheet-wrap { overflow-x: auto; }
.sheet { width: 100%; border-collapse: collapse; background: var(--card); }
.sheet th, .sheet td { border-bottom: 1px solid var(--line); padding: 9px 10px; vertical-align: top; }
.sheet th { font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); font-weight: 650; }
.sheet tr:hover td { background: #fff8ea; }
.sheet a { text-decoration: underline; text-underline-offset: 2px; font-weight: 650; }
.line-input { width: 110px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px; }
.deficit td { background: #fff1ec; }
.tag.warn { color: #8a4b08; border-color: #efd3a8; background: #fff6ea; }
.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.mono { font-family: "Liberation Mono", ui-monospace, monospace; font-size: 13px; }
.nowrap { white-space: nowrap; }
.comment { max-width: 280px; color: var(--muted); }
.empty { color: var(--muted); padding: 18px 10px; }
.actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.actions form { margin: 0; }
.tg-bar .tg-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 10px; }
.tg-bar input[type="text"] {
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  min-width: min(280px, 100%);
  max-width: 320px;
}
.tg-bar .form-label { margin: 0; }
.derive-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.derive-form select {
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.tag {
  display: inline-block;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 8px;
  font-size: 12px;
  color: var(--muted);
}
.tag.ok { color: var(--ok); border-color: #b7dfc8; background: #f1faf4; }

.facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 18px; margin: 16px 0; }
.facts dt { color: var(--muted); font-size: 12px; }
.facts dd { margin: 0; }
.description { white-space: pre-wrap; }
.link-list { list-style: none; padding: 0; margin: 0; }
.link-list li { padding: 6px 0; border-bottom: 1px solid var(--line); }
.subplan { color: var(--muted); font-size: 12px; margin-top: 2px; }
.swatch { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; }
.plain { margin: 0; padding-left: 18px; }
.pager { display: flex; gap: 12px; align-items: center; margin-top: 12px; }
.json-view {
  max-height: 360px;
  overflow: auto;
  background: #1a2330;
  color: #f4efe4;
  padding: 12px;
  border-radius: 10px;
  font-size: 12px;
}
.form-card input[type="text"],
.form-card input[type="password"],
.form-card input[type="email"],
.form-card input[type="date"],
.form-card input[type="number"],
.form-card select {
  display: block;
  width: min(420px, 100%);
  margin-bottom: 12px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}
.form-card input[type="checkbox"] { margin: 0 8px 12px 0; }
.form-card textarea {
  display: block;
  width: min(720px, 100%);
  min-height: 8rem;
  margin-bottom: 12px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--ink);
  font: inherit;
}
.mail-compose select { display: block; margin: 0 0 12px; }
.mail-sign { margin-top: 8px; }
.mail-rules { padding-left: 1.2rem; }
.mail-rules ul { margin: 4px 0 12px; }
.token-once {
  background: #fff4d8;
  border: 1px dashed var(--amber);
  padding: 10px 12px;
  border-radius: 8px;
  word-break: break-all;
}
.change { display: inline-block; margin-right: 8px; }
.alert { border-radius: 10px; }

.login-body { background: var(--sidebar); }
.login-layout { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 0.9fr; }
.login-aside { color: white; padding: 64px; display: flex; flex-direction: column; justify-content: flex-end; gap: 12px; }
.login-aside h1 { font-size: 48px; }
.login-aside p { max-width: 420px; color: #c5d0dc; }
.login-card { background: var(--paper); margin: 24px; border-radius: 18px; padding: 36px; align-self: center; }
.login-card .form-control { margin-bottom: 12px; }
.login-card .btn { margin-top: 8px; }
.login-card form + form { margin-top: 18px; }
.login-hint, .login-links { margin-top: 14px; }
.print-select { max-width: 360px; display: inline-block; width: auto; }
.print-frame { width: 100%; height: 78vh; border: 1px solid var(--line); border-radius: 10px; background: white; margin-top: 12px; }
.print-chooser { align-items: end; }
.col-photo { width: 48px; }
.item-thumb { width: 40px; height: 40px; object-fit: cover; border-radius: 6px; background: #efe8d8; display: block; }
.photo-main { max-width: min(480px, 100%); height: auto; border-radius: 12px; background: #efe8d8; }
.photo-row { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 12px; }
.photo-card { width: 140px; }
.photo-card img { width: 120px; height: 120px; object-fit: cover; border-radius: 8px; background: #efe8d8; }
.photo-card form { display: inline; }
.photo-upload { margin-top: 16px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.photo-upload input[type="file"] { max-width: 100%; }

.chat-launcher {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 30;
  border: 0;
  border-radius: 999px;
  padding: 12px 16px;
  background: var(--amber-deep);
  color: white;
  box-shadow: var(--shadow);
}
.chat-panel {
  position: fixed;
  top: 12px;
  right: 12px;
  z-index: 40;
  width: min(420px, calc(100vw - 24px));
  height: calc(100vh - 24px);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
  display: none;
  flex-direction: column;
  overflow: hidden;
}
.chat-panel.is-open { display: flex; }
.chat-panel-bar {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}
.chat-panel-bar a { margin-left: auto; }
.chat-app { display: grid; grid-template-columns: 220px 1fr; gap: 12px; min-height: 70vh; }
.chat-app-panel { grid-template-columns: 1fr; min-height: 0; height: 100%; }
.chat-app-panel .chat-dialogs { max-height: 120px; }
.chat-dialogs, .chat-main {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px;
}
.chat-panel .chat-dialogs, .chat-panel .chat-main { border: 0; border-radius: 0; box-shadow: none; }
.chat-panel .chat-main { display: flex; flex-direction: column; min-height: 0; flex: 1; }
.chat-dialogs-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 8px; }
.chat-dialogs ul { list-style: none; margin: 0; padding: 0; overflow: auto; max-height: 62vh; }
.chat-dialogs li button {
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  padding: 8px;
  border-radius: 8px;
}
.chat-dialogs li.is-active button, .chat-dialogs li button:hover { background: #f6efe0; }
.chat-log { overflow: auto; min-height: 240px; max-height: 58vh; display: flex; flex-direction: column; gap: 10px; }
.chat-panel .chat-log { max-height: none; flex: 1; min-height: 0; }
.chat-msg { border-radius: 12px; padding: 10px 12px; background: #f7f3ea; }
.chat-msg-user { background: #fff7e4; margin-left: 18px; }
.chat-msg-assistant { margin-right: 18px; }
.chat-msg pre { white-space: pre-wrap; background: #1a2330; color: #f4efe4; padding: 8px; border-radius: 8px; }
.chat-msg code { font-family: ui-monospace, monospace; }
.chat-msg-files { color: var(--muted); font-size: 13px; }
.chat-wizard { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.chat-wizard h3 { font-size: 13px; margin: 0; }
.chat-wizard-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.chat-wizard button[disabled], .chat-wizard.is-disabled button { opacity: .55; }
.chat-wizard-avito, .chat-wizard-missing, .chat-wizard-detail { font-size: 12px; }
.chat-wizard-missing, .chat-wizard-detail { color: var(--muted); }
.chat-form textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 10px;
  margin: 8px 0;
}
.chat-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.chat-actions label { margin: 0; cursor: pointer; }
.chat-previews { display: flex; flex-wrap: wrap; gap: 8px; }
.chat-file {
  display: flex;
  gap: 6px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 4px 6px;
  max-width: 100%;
}
.chat-file img { width: 42px; height: 42px; object-fit: cover; border-radius: 6px; }
.chat-file span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 160px; }
.chat-banner, .chat-typing { color: var(--amber-deep); margin: 0 0 8px; }
.chat-main.is-dropping { outline: 2px dashed var(--amber); }
.chat-hint { margin: 8px 0 0; font-size: 12px; }
.chat-empty { color: var(--muted); }

@media (max-width: 900px) {
  .chat-app { grid-template-columns: 1fr; min-height: 0; }
  .chat-dialogs ul { max-height: 160px; }
  .chat-log { max-height: 48vh; }
  .chat-panel { inset: 0; width: auto; height: auto; border-radius: 0; }
  .chat-launcher { right: 12px; bottom: 12px; }
}

@media (max-width: 900px) {
  .sidebar { position: fixed; inset: 0 auto 0 0; z-index: 20; transform: translateX(-105%); transition: transform 0.2s ease; }
  .nav-toggle:checked ~ .app-shell .sidebar { transform: none; }
  .nav-burger { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; padding: 4px 8px; }
  .content { padding: 16px; }
  .stat-grid, .split, .login-layout, .facts { grid-template-columns: 1fr; }
  .login-aside { padding: 28px; min-height: 180px; }
  .login-card { margin: 0 16px 16px; }
  .topbar-user span, .topbar-user em { display: none; }
  .topbar-logo { display: inline-flex; }
  .brand-logo, .topbar-logo .brand-logo { height: 32px; }
}
@media (max-width: 520px) {
  .topbar-logo { max-width: 46px; overflow: hidden; }
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.picker-page .app-shell { height: 100vh; overflow: hidden; }
.picker-page .app-main { display: flex; flex-direction: column; height: 100vh; min-height: 0; }
.picker-page .content-picker {
  max-width: none;
  padding: 0;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.picker-page .chat-launcher { bottom: calc(var(--picker-dock, 280px) + 12px); }
@media (max-width: 1280px) {
  .pick-row { grid-template-columns: repeat(5, minmax(0, 1fr)); }
}
.picker { flex: 1; min-height: 0; display: flex; flex-direction: column; background: var(--paper); }
.picker-top { flex: 1; min-height: 0; overflow: auto; padding: 16px 22px 18px; }
.picker-tools { display: flex; gap: 8px; align-items: center; flex-wrap: nowrap; }
.picker-stock {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 36px;
  padding: 0 2px;
  font-weight: 650;
  font-size: 12px;
  white-space: nowrap;
  flex: 0 0 auto;
}
.picker-stock input { width: 18px; height: 18px; margin: 0; }
.picker-info {
  border: 0;
  background: transparent;
  color: #1d4e89;
  width: 24px;
  height: 24px;
  padding: 0;
  cursor: pointer;
  font-size: 14px;
}
.picker-search { flex: 1; min-width: 0; }
.picker-search input { height: 40px; }
.picker-search { flex: 1; }
.picker-search input, .picker-fields input, .picker-fields select, .picker-line input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  background: white;
}
.picker-tabs, .picker-filters, .picker-brands {
  display: flex;
  flex-wrap: nowrap;
  gap: 6px;
  margin-top: 8px;
  overflow-x: auto;
  scrollbar-width: thin;
}
.picker-tabs button, .picker-filters button, .picker-brands button, .picker-sheet button.brand-option {
  border: 1px solid var(--line);
  background: var(--card);
  border-radius: 999px;
  padding: 0 12px;
  height: 34px;
  color: var(--ink);
  white-space: nowrap;
  flex: 0 0 auto;
}
.picker-filters button { height: 30px; font-size: 13px; }
.picker-tabs button.is-active, .picker-filters button.is-active, .picker-brands button.is-active {
  background: var(--amber);
  color: #1c1408;
  border-color: var(--amber);
}
.picker-sheet {
  margin: auto auto 0;
  width: min(520px, 100%);
  max-height: 70vh;
  border: 0;
  border-radius: 16px 16px 0 0;
  padding: 0;
  background: var(--card);
}
.picker-sheet-body { padding: 16px; display: flex; flex-direction: column; gap: 8px; overflow: auto; }
.picker-sheet button.brand-option { align-self: flex-start; }
.pick-stock { display: flex; flex-direction: column; gap: 2px; margin-top: 4px; }
.pick-stock .pick-onhand { font-weight: 650; }
.picker-legend, .picker-brands { display: none; }
.picker-note { min-height: 1.2em; margin: 8px 0; }
.picker-catalog { display: flex; flex-direction: column; gap: 16px; }
.pick-shelf h3, .picker-catalog h2 { margin: 0 0 8px; font-size: 16px; }
.pick-row { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; }
.pick-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 4px;
  text-align: left;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 8px 8px 6px;
  cursor: pointer;
  min-width: 0;
}
.pick-card:hover, .pick-card.is-in { border-color: #d7b56a; background: #fff8ea; }
.pick-photo {
  width: 100%;
  height: 84px;
  border-radius: 8px;
  background: #f6f1e6;
  overflow: hidden;
  display: grid;
  place-items: center;
}
.pick-photo img { width: 100%; height: 84px; object-fit: contain; display: block; }
.pick-photo-empty { color: #b3a790; font-size: 11px; }
.pick-brand {
  align-self: flex-start;
  font-size: 10px;
  line-height: 1.4;
  padding: 0 6px;
  border-radius: 999px;
  background: #f3eee4;
  color: var(--muted);
}
.pick-model {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 2.4em;
  font-size: 13px;
  line-height: 1.2;
  font-weight: 650;
}
.pick-card strong { display: block; font-size: 13px; line-height: 1.3; }
.pick-code, .pick-price, .pick-wait, .pick-in { display: block; color: var(--muted); font-size: 12px; }
.pick-price { color: var(--ink); font-variant-numeric: tabular-nums; }
.pick-badge { margin-top: 4px; }
.pick-badge-ok { color: var(--ok); border-color: #b7dfc8; background: #f1faf4; }
.pick-badge-wait { color: #1d4e89; border-color: #b7cbe4; background: #e7f0fa; }
.pick-foot { display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: baseline; margin-top: 6px; font-variant-numeric: tabular-nums; }
.pick-onhand { font-weight: 700; }
.pick-foot span { font-size: 12px; color: var(--muted); }
.pick-foot .pick-transit { color: #1d4e89; font-weight: 700; font-size: 14px; }
.picker-legend { display: flex; align-items: center; gap: 6px; margin: 8px 0 0; color: #1d4e89; font-size: 13px; }
.pick-legend-swatch { width: 9px; height: 9px; border-radius: 50%; background: #1d4e89; display: inline-block; }
.pick-plus {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 50%;
  background: var(--amber);
  color: white;
  display: grid;
  place-items: center;
  font-weight: 700;
  cursor: pointer;
}
.picker-detail {
  width: min(520px, calc(100vw - 32px));
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 0;
  background: var(--card);
}
.picker-detail::backdrop { background: rgba(26, 35, 48, 0.45); }
.picker-detail-body { padding: 16px; display: flex; flex-direction: column; gap: 8px; }
.picker-detail img { width: 100%; max-height: 240px; object-fit: contain; background: #f6f1e6; border-radius: 10px; }
.picker-detail h2 { font-size: 18px; margin: 0; }
.picker-detail-actions { display: flex; gap: 8px; justify-content: flex-end; }
.picker-dock {
  flex: none;
  height: var(--picker-dock, 280px);
  background: var(--card);
  border-top: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  min-height: 0;
  box-shadow: 0 -8px 24px rgba(28, 36, 48, 0.05);
}
.picker-dock.is-collapsed { height: 48px !important; }
.picker-dock.is-collapsed .picker-dock-body, .picker-dock.is-collapsed .picker-dock-handle { display: none; }
.picker-dock-handle { height: 8px; cursor: ns-resize; background: linear-gradient(#e4dccb, #e4dccb) center / 42px 3px no-repeat; }
.picker-dock-bar { display: flex; gap: 12px; align-items: center; padding: 0 16px 8px; }
.picker-dock-bar .btn { margin-left: auto; }
.picker-sum { font-variant-numeric: tabular-nums; font-weight: 650; }
.picker-dock-body { overflow: auto; padding: 0 16px 14px; }
.picker-dock-hint { margin-top: 0; }
.picker-line { display: grid; grid-template-columns: minmax(140px, 1.4fr) 90px 120px 110px auto; gap: 8px; align-items: center; margin-bottom: 8px; }
.picker-line-name strong, .picker-line-name span { display: block; }
.picker-line-name span, .picker-line-sum { color: var(--muted); font-size: 12px; }
.picker-fields { display: grid; grid-template-columns: 1.2fr 0.8fr 1fr auto; gap: 8px; align-items: end; margin-top: 8px; }
.picker-fields label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
.picker-party-list { grid-column: 1 / -1; display: flex; flex-direction: column; gap: 4px; margin: 0; }
.picker-party-list button { text-align: left; border: 1px solid var(--line); background: white; border-radius: 8px; padding: 6px 8px; }
.picker-result { min-height: 1.2em; margin: 8px 0 0; }

@media (max-width: 900px) {
  .picker-page .content-picker { padding: 0; }
  .picker-top { padding: 12px; }
  .pick-row { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .picker-line, .picker-fields { grid-template-columns: 1fr; }
  .picker-page .chat-launcher { display: none; }
}
@media (max-width: 520px) {
  .pick-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.tax-secondary { margin: 6px 0 0; color: var(--muted); font-size: 12px; line-height: 1.35; }
.tax-scenarios { margin-top: 16px; }
.tax-scenarios summary { cursor: pointer; font-weight: 650; }
.tax-explanation {
  white-space: pre-wrap;
  background: #fff6ea;
  border-left: 4px solid var(--amber);
  padding: 12px 14px;
  border-radius: 10px;
  margin: 0 0 16px;
  font-size: 15px;
}
.diff-due { color: var(--danger); }
.diff-ok { color: var(--ok); }
.tax-bar { display: grid; grid-template-columns: 140px 1fr 120px; gap: 10px; align-items: center; margin: 6px 0; }
.tax-bar-track { height: 10px; background: #efe8d8; border-radius: 999px; overflow: hidden; }
.tax-bar-track div { height: 100%; background: #b86e00; }
.filters select { padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px; background: white; }

.lookup-bar {
  position: sticky;
  top: 0;
  z-index: 4;
  margin-bottom: 12px;
  padding: 8px 0;
  background: var(--paper, #fff);
}
.lookup-stock, .pick-transit { display: block; }
.platform-links { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.platform-chip { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.platform-chip img { width: 20px; height: 20px; }
.platform-group-head { display: flex; align-items: center; gap: 8px; }
.platform-group-head img { width: 20px; height: 20px; }
.platform-group-rows { list-style: none; margin: 4px 0 0 28px; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.platform-url { overflow-wrap: anywhere; }
.platform-check .platform-group-head strong { color: #b26a00; }
.copy-link { font-size: 12px; padding: 2px 8px; cursor: pointer; }
.copy-link { border: 0; background: transparent; color: var(--amber-deep); cursor: pointer; }
.lookup-panel { min-height: 50vh; max-height: 72vh; overflow: auto; }
.lookup-hits { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.lookup-hits button { width: 100%; text-align: left; background: white; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.lookup-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 8px 14px; margin: 12px 0; }
.lookup-facts dt { color: var(--muted); font-size: 12px; }
.lookup-photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.lookup-photo { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
.lookup-photo img { width: 100%; height: 120px; object-fit: contain; background: #f7f4ee; border-radius: 8px; }
.lookup-files { list-style: none; padding: 0; }
.lookup-files li { display: flex; gap: 10px; align-items: center; margin: 6px 0; }
.lookup-upload, .lookup-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 8px 0; }
.lookup-upload input, .lookup-upload select, #lookup-description { border: 1px solid var(--line); border-radius: 8px; padding: 8px; }
#lookup-description { width: 100%; }
.lookup-links { padding-left: 18px; }
.lookup-modal { position: fixed; inset: 0; background: rgba(20, 32, 48, 0.45); z-index: 80; display: flex; align-items: flex-end; justify-content: center; }
.lookup-modal[hidden] { display: none; }
.lookup-dialog { background: white; width: min(640px, 100%); max-height: 85vh; overflow: auto; border-radius: 16px 16px 0 0; padding: 16px; }
.lookup-choice, .lookup-chat { display: block; width: 100%; text-align: left; margin: 6px 0; }
.lookup-chat span, .lookup-chat em { display: block; color: var(--muted); font-size: 12px; font-style: normal; }
.lookup-preview { white-space: pre-wrap; background: #f7f4ee; border-radius: 8px; padding: 10px; }
@media (max-width: 720px) {
  .lookup-panel { min-height: 62vh; max-height: none; }
  .lookup-dialog { border-radius: 16px 16px 0 0; }
}
@media (min-width: 800px) {
  .lookup-modal { align-items: center; }
  .lookup-dialog { border-radius: 16px; }
}

.doc-pick { position: relative; min-width: 260px; }
.doc-pick.is-open { z-index: 5; }
.doc-pick-q { width: 100%; }
.doc-line-role { margin-bottom: 6px; }
.doc-pick-menu {
  position: fixed;
  z-index: 80;
  background: white;
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 10px 28px rgba(20, 32, 48, 0.14);
  max-height: 320px;
  overflow: auto;
}
.doc-pick-option, .doc-pick-empty {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: white;
  padding: 8px 10px;
  cursor: pointer;
}
.doc-pick-option.is-active, .doc-pick-option:hover { background: #fff6ea; }
.doc-pick-code, .doc-pick-meta { display: block; color: var(--muted); font-size: 12px; }
.doc-pick-name { display: block; font-weight: 650; }
.doc-pick-option mark { background: #ffe2a8; color: inherit; padding: 0 1px; }
.doc-pick-empty { color: var(--muted); cursor: default; }
.doc-pick-wrap { display: flex; gap: 6px; align-items: stretch; }
.doc-pick-wrap .doc-pick-q { flex: 1; min-width: 0; }
.doc-pick-book { flex: none; padding: 4px 10px; font-size: 13px; white-space: nowrap; border: 1px solid var(--line); background: var(--card); color: var(--ink); border-radius: 8px; }
.doc-pick-book:hover { border-color: var(--amber); }
.doc-pick-book-txt { margin-left: 6px; }
[data-doc-book] { margin-left: 6px; }

/* Окно «Справочник» в документах */
.book-modal { position: fixed; inset: 0; z-index: 90; background: rgba(20, 32, 48, 0.5); display: flex; align-items: center; justify-content: center; padding: 16px; }
.book-modal[hidden] { display: none; }
.book-dialog { display: flex; flex-direction: column; width: min(1120px, 100%); height: min(760px, 100%); background: var(--card); color: var(--ink); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); overflow: hidden; }
.book-head { display: flex; gap: 12px; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.book-title { font-size: 17px; white-space: nowrap; }
.book-q { flex: 1; min-width: 0; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--paper); color: var(--ink); }
.book-q:focus { outline: 2px solid var(--amber); outline-offset: 0; }
.book-sub { display: flex; gap: 6px; align-items: center; white-space: nowrap; font-size: 13px; color: var(--muted); margin: 0; }
.book-x { border: 0; background: transparent; color: var(--ink); font-size: 28px; line-height: 1; padding: 0 6px; cursor: pointer; }
.book-body { flex: 1; min-height: 0; display: flex; }
.book-tree { width: 290px; flex: none; overflow: auto; border-right: 1px solid var(--line); padding: 8px 6px; background: var(--paper); }
.book-tree ul { list-style: none; margin: 0; padding: 0 0 0 14px; }
.book-tree .book-root { padding-left: 0; }
.book-node { display: flex; align-items: center; border-radius: 6px; }
.book-node.is-on { background: var(--amber); }
.book-node.is-on .book-name, .book-node.is-on .book-name em, .book-node.is-on .book-caret { color: #fff; }
.book-caret { flex: none; width: 22px; height: 26px; border: 0; background: transparent; color: var(--muted); cursor: pointer; padding: 0; }
.book-name { flex: 1; min-width: 0; display: flex; justify-content: space-between; gap: 8px; text-align: left; border: 0; background: transparent; color: var(--ink); padding: 4px 6px; cursor: pointer; font-size: 14px; }
.book-name span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.book-name em { flex: none; font-style: normal; color: var(--muted); font-size: 12px; }
.book-node:not(.is-on):hover { background: rgba(184, 110, 0, 0.12); }
.book-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.book-crumb { display: flex; gap: 10px; align-items: center; padding: 8px 12px; border-bottom: 1px solid var(--line); font-size: 13px; color: var(--muted); }
.book-tree-toggle { display: none; padding: 4px 10px; }
.book-path { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink); font-weight: 650; }
.book-found { white-space: nowrap; }
.book-scroll { flex: 1; min-height: 0; overflow: auto; }
.book-table { width: 100%; border-collapse: collapse; }
.book-table th { position: sticky; top: 0; z-index: 1; background: var(--card); font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); font-weight: 650; padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: left; }
.book-table th.num { text-align: right; }
.book-table td { padding: 7px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.book-table tbody tr { cursor: pointer; }
.book-table tbody tr:hover td { background: rgba(184, 110, 0, 0.08); }
.book-table tbody tr.is-on td { background: rgba(184, 110, 0, 0.18); }
.book-c { width: 34px; text-align: center; }
.book-nm { font-weight: 600; }
.book-cd { color: var(--muted); font-size: 12px; word-break: break-word; }
.book-qty { width: 70px; text-align: right; padding: 4px 6px; border: 1px solid var(--line); border-radius: 6px; background: var(--paper); color: var(--ink); }
.book-more { text-align: center; padding: 12px; }
.book-empty { color: var(--muted); padding: 8px; display: inline-block; }
.book-foot { display: flex; gap: 10px; align-items: center; padding: 10px 14px; border-top: 1px solid var(--line); }
.book-spacer { flex: 1; }
.book-count { font-size: 14px; }
.book-foot .btn:disabled { opacity: 0.5; }
@media (max-width: 720px) {
  .doc-pick-book-txt { display: none; }
  .book-modal { padding: 0; align-items: stretch; }
  .book-dialog { height: 100%; border-radius: 0; border: 0; }
  .book-head { flex-wrap: wrap; gap: 8px; }
  .book-title { order: 1; flex: 1; }
  .book-x { order: 2; }
  .book-q { order: 3; flex: 1 0 100%; }
  .book-sub { order: 4; }
  .book-body { position: relative; }
  .book-tree { display: none; position: absolute; inset: 0; z-index: 3; width: auto; border-right: 0; }
  .book-modal.tree-open .book-tree { display: block; }
  .book-tree-toggle { display: inline-block; }
  .book-table th:nth-child(3), .book-table td:nth-child(3) { display: none; }
  .book-table { font-size: 13px; }
  .book-table th { padding: 6px 4px; font-size: 11px; letter-spacing: 0; }
  .book-table td { padding: 6px 4px; }
  .book-c { width: 28px; }
  .book-qty { width: 50px; padding: 4px; }
  .book-foot { flex-wrap: wrap; }
  .book-spacer { display: none; }
  .book-foot .btn { flex: 1; }
}
.doc-total { margin: 12px 0; font-size: 16px; }
.doc-line-delete { padding: 6px 10px; }
@media (max-width: 720px) {
  .doc-pick { min-width: 0; }
  .line-input { width: 88px; }
}

/* Поиск контрагента в документах */
.cp-field { margin-bottom: 12px; max-width: 520px; }
.cp-box { position: relative; display: flex; align-items: center; }
.cp-input {
  flex: 1;
  width: 100%;
  padding: 8px 34px 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card);
  color: var(--ink);
}
.cp-input:focus { outline: 2px solid var(--amber); outline-offset: 0; }
.cp-clear {
  position: absolute;
  right: 6px;
  width: 24px;
  height: 24px;
  line-height: 20px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 18px;
  cursor: pointer;
}
.cp-clear:hover { color: var(--ink); background: var(--line); }
.cp-list {
  position: absolute;
  z-index: 30;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  max-height: 320px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card);
  box-shadow: var(--shadow);
}
.cp-item { display: flex; flex-direction: column; gap: 2px; padding: 8px 10px; cursor: pointer; border-bottom: 1px solid var(--line); }
.cp-item:last-child { border-bottom: 0; }
.cp-item.is-active { background: var(--line); }
.cp-name { color: var(--ink); }
.cp-extra { color: var(--muted); font-size: 12px; }
.cp-empty { padding: 10px; color: var(--muted); }
.cp-hint { min-height: 18px; font-size: 12px; margin-top: 4px; }

/* «← Назад к списку» над карточкой и формой документа */
.back-bar { margin: 0 0 14px; }
.back-link, .back-link:visited { font-weight: 600; padding: 8px 16px; border-radius: 8px; text-decoration: none; background: var(--card); border: 1px solid var(--amber); color: var(--ink); }
.back-link:hover { background: var(--amber); color: #fff; }
@media (max-width: 640px) {
  .back-bar { position: sticky; top: 0; z-index: 5; margin: -8px -4px 12px; padding: 8px 4px; background: var(--paper); }
  .back-link { display: block; text-align: center; padding: 12px 16px; }
}

/* Блок «Видео» в карточке товара */
.video-count { font-size: 14px; font-weight: 400; }
.video-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.video-tile { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--card); }
.video-preview { position: relative; display: block; aspect-ratio: 16 / 9; background: #222b38; overflow: hidden; }
.video-preview img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: 1; }
.video-fallback { position: absolute; inset: 0; display: flex; align-items: flex-end; justify-content: flex-start; padding: 10px; background: linear-gradient(135deg, #2b3547, #1a2330); }
.video-badge { color: #d5dbe3; font-weight: 600; letter-spacing: .04em; border: 1px solid #55627a; border-radius: 6px; padding: 4px 10px; font-size: 13px; }
.video-play { position: absolute; z-index: 2; left: 50%; top: 50%; transform: translate(-50%, -50%); width: 52px; height: 52px; border-radius: 50%; background: rgba(0, 0, 0, .62); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 20px; padding-left: 3px; }
.video-preview:hover .video-play { background: var(--amber); }
.video-info { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.video-title { font-weight: 600; color: var(--ink); text-decoration: none; line-height: 1.3; overflow-wrap: anywhere; }
.video-title:hover { text-decoration: underline; }
.video-source { font-size: 12px; }
.video-actions .btn { border: 1px solid var(--line); border-radius: 8px; }
.video-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: auto; padding-top: 8px; }
.video-copy.is-done { border-color: var(--ok); color: var(--ok); }
@media (max-width: 640px) { .video-grid { grid-template-columns: 1fr; } .video-actions .btn { flex: 1; text-align: center; } }

/* Фильтр документов */
.doc-filter-toggle { position: relative; }
.doc-filter-toggle.is-open { background: var(--amber); border-color: var(--amber-deep); color: #fff; }
.doc-filter-toggle.has-filter:not(.is-open) { border-color: var(--amber); }
.filter-badge { display: inline-block; min-width: 18px; margin-left: 6px; padding: 0 5px; border-radius: 9px; background: var(--amber-deep); color: #fff; font-size: 12px; line-height: 18px; text-align: center; }
.doc-filter-toggle.is-open .filter-badge { background: #fff; color: var(--amber-deep); }
.doc-filter-panel { flex: 1 0 100%; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; box-shadow: var(--shadow); }
.doc-filter-panel[hidden], .doc-filter-panel .ff[hidden], .doc-filter-panel .doc-field-opt[hidden] { display: none !important; }
.doc-filter-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; }
.doc-filter-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px 16px; }
.doc-filter-panel .ff { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.doc-filter-panel .ff-label { font-size: 12px; color: var(--muted); margin: 0; }
.doc-filter-panel .ff .form-control, .doc-filter-panel .ff .form-select { max-width: none; width: 100%; }
.doc-filter-panel .ff-row { display: flex; align-items: center; gap: 6px; }
.doc-filter-panel .ff-row .form-control { min-width: 0; }
.doc-filter-panel .ff-quick { display: flex; gap: 4px; }
.doc-filter-panel .btn-mini { padding: 1px 9px; font-size: 12px; }
.doc-filter-panel .ff-hint { font-size: 11px; color: var(--muted); }
.doc-filter-panel .ff-item .form-select { margin-top: 2px; }
.doc-pop { position: relative; }
.doc-pop > summary { list-style: none; cursor: pointer; }
.doc-pop > summary::-webkit-details-marker { display: none; }
.doc-pop-body { position: absolute; z-index: 30; top: calc(100% + 6px); left: 0; width: 280px; max-height: 360px; overflow: auto; background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 10px; box-shadow: var(--shadow); }
.doc-preset { display: flex; align-items: center; justify-content: space-between; gap: 6px; padding: 3px 0; }
.doc-x { border: 0; background: transparent; color: var(--muted); font-size: 18px; line-height: 1; cursor: pointer; padding: 0 4px; }
.doc-x:hover { color: var(--danger); }
.doc-preset-new { display: flex; gap: 6px; margin-top: 4px; }
.doc-field-opt { display: flex; gap: 6px; align-items: center; margin: 0; padding: 2px 0; font-size: 14px; }
.doc-create { margin-bottom: 14px; }
@media (max-width: 720px) {
  .doc-filters .form-control, .doc-filters .form-select { max-width: none; flex: 1 1 100%; }
  .doc-filter-grid { grid-template-columns: 1fr; }
  .doc-pop-body { position: fixed; left: 12px; right: 12px; top: auto; bottom: 12px; width: auto; max-height: 55vh; }
  .doc-filter-bar .btn { flex: 1 1 auto; }
}

/* Документы: вкладки групп, чипы типов, кружки оплаты и отгрузки */
:root { --ind-full: #1f7a4d; --ind-part: #d98a00; --ind-none: #aab3bf; --ind-bad: #c0392b; }
html[data-theme="dark"] { --ind-full: #4cc58a; --ind-part: #e8b15a; --ind-none: #6b7790; --ind-bad: #ef7a6e; }
@media (prefers-color-scheme: dark) { html[data-theme="system"] { --ind-full: #4cc58a; --ind-part: #e8b15a; --ind-none: #6b7790; --ind-bad: #ef7a6e; } }
.doc-groups { display: flex; flex-wrap: wrap; gap: 4px; border-bottom: 2px solid var(--line); margin-bottom: 10px; }
.doc-group { padding: 8px 14px; border-radius: 10px 10px 0 0; color: var(--muted); font-weight: 600; text-decoration: none; }
.doc-group:hover { color: var(--ink); }
.doc-group.on { background: var(--card); color: var(--ink); box-shadow: inset 0 3px 0 var(--amber); border: 1px solid var(--line); border-bottom: 2px solid var(--card); margin-bottom: -2px; }
.doc-group .cnt, .doc-chip b { color: var(--muted); font-size: 12px; font-weight: 500; font-variant-numeric: tabular-nums; }
.doc-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.doc-chip { display: inline-flex; gap: 7px; align-items: center; border: 1px solid var(--line); background: var(--card); border-radius: 999px; padding: 5px 12px; color: var(--ink); text-decoration: none; }
.doc-chip:hover { border-color: var(--amber); }
.doc-chip.on { background: var(--amber); border-color: var(--amber-deep); color: #fff; }
.doc-chip.on b { color: #fff; opacity: .85; }
.doc-chip.zero:not(.on) { opacity: .55; }
.doc-filters .doc-create-pop { margin-left: auto; }
.btn-plus { background: var(--amber); border-color: var(--amber-deep); color: #fff; font-weight: 600; }
.doc-create-menu { position: absolute; z-index: 30; right: 0; top: calc(100% + 6px); width: 760px; max-width: 92vw; display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 6px 14px; background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 12px; box-shadow: var(--shadow); }
.doc-create-h { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--amber-deep); margin-bottom: 4px; }
.doc-create-col a { display: block; padding: 4px 6px; border-radius: 6px; color: var(--ink); text-decoration: none; font-size: 14px; }
.doc-create-col a:hover { background: rgba(224, 161, 0, .18); }
.doc-filters { margin-bottom: 12px; }
.doc-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; color: var(--muted); font-size: 12px; margin: 0 0 8px; }
.doc-legend > span { display: inline-flex; align-items: center; gap: 5px; }
.doc-legend-t { font-weight: 600; }
.doc-debt-key { display: inline-block; width: 3px; height: 14px; background: var(--ind-bad); border-radius: 2px; }
.ind { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; border-radius: 50%; position: relative; flex: none; font-size: 13px; font-weight: 700; line-height: 1; vertical-align: middle; box-sizing: border-box; }
.ind svg { width: 62%; height: 62%; display: block; }
.ind-glyph { display: inline-flex; align-items: center; justify-content: center; width: 100%; height: 100%; position: relative; z-index: 1; }
.ind-glyph svg { width: 60%; height: 60%; }
.ind.none { border: 2px solid var(--ind-none); color: var(--ind-none); background: transparent; }
.ind.partial { border: 2px solid var(--ind-part); color: var(--ind-part); background: conic-gradient(var(--ind-part) calc(var(--p) * 1%), transparent 0); }
.ind.partial::after { content: ""; position: absolute; inset: 3px; border-radius: 50%; background: var(--card); }
.ind.full { background: var(--ind-full); color: #fff; }
html[data-theme="dark"] .ind.full { color: #0f1a14; }
@media (prefers-color-scheme: dark) { html[data-theme="system"] .ind.full { color: #0f1a14; } }
.ind-s { width: 18px; height: 18px; font-size: 10px; }
.ind-s.none, .ind-s.partial { border-width: 1.5px; }
.ind-s.partial::after { inset: 2px; }
.doc-sheet td.c, .doc-sheet th.c { text-align: center; }
.doc-sheet td { vertical-align: middle; }
.doc-sheet td.cm { color: var(--muted); max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc-sheet tr.debt td:first-child { box-shadow: inset 3px 0 0 var(--ind-bad); }
.doc-sheet tr.row-cancel td { opacity: .55; }
.doc-sheet tr.row-cancel td.num { text-decoration: line-through; }
.doc-filter-panel .seg { display: flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.doc-filter-panel .seg-o { flex: 1; margin: 0; cursor: pointer; border-right: 1px solid var(--line); position: relative; }
.doc-filter-panel .seg-o:last-child { border-right: 0; }
.doc-filter-panel .seg-o input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.doc-filter-panel .seg-o span { display: flex; align-items: center; justify-content: center; gap: 5px; padding: 6px 4px; font-size: 13px; white-space: nowrap; }
.doc-filter-panel .seg-o input:checked + span { background: var(--amber); color: #fff; }
.doc-filter-panel .seg-o input:checked + span .ind.partial::after { background: var(--amber); }
.doc-filter-panel .seg-o input:focus-visible + span { outline: 2px solid var(--amber-deep); outline-offset: -2px; }
@media (max-width: 720px) {
  .doc-filters .doc-create-pop { margin-left: 0; }
  .doc-create-menu { position: fixed; left: 12px; right: 12px; top: auto; bottom: 12px; width: auto; max-height: 70vh; overflow: auto; }
  .doc-sheet td.cm { max-width: 140px; }
}

body.is-embed .nav-toggle,
body.is-embed .sidebar,
body.is-embed .topbar,
body.is-embed .back-bar,
body.is-embed .chat-launcher,
body.is-embed .chat-panel,
body.is-embed .nav-burger { display: none !important; }
body.is-embed .app-shell { display: block; min-height: 0; }
body.is-embed .app-main { display: block; }
body.is-embed .content { padding: 16px 20px 28px; max-width: none; }
body.is-embed { background: var(--paper); }

.doc-item-card {
  flex: none;
  padding: 4px 10px;
  font-size: 13px;
  white-space: nowrap;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
  border-radius: 8px;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}
.doc-item-card[hidden] { display: none !important; }
.doc-item-card:hover { border-color: var(--amber); text-decoration: none; color: var(--ink); }

.item-modal {
  position: fixed;
  inset: 0;
  z-index: 110;
  background: rgba(20, 32, 48, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.item-modal[hidden] { display: none; }
.item-dialog {
  position: relative;
  display: flex;
  flex-direction: column;
  width: min(1100px, 100%);
  height: min(860px, 100%);
  background: var(--paper);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.item-modal-x {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 2;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 999px;
  background: var(--card);
  color: var(--ink);
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
  box-shadow: var(--shadow);
}
.item-modal-x:hover { background: var(--amber-deep); color: #fff; }
.item-modal-frame { flex: 1; width: 100%; height: 100%; border: 0; background: var(--paper); }
@media (max-width: 720px) {
  .item-modal { padding: 0; }
  .item-dialog { width: 100%; height: 100%; border-radius: 0; }
}

