/* ===== Просчёт — стили ===== */
:root {
  --bg: #f4f3ef;
  --surface: #ffffff;
  --surface-2: #faf9f6;
  --ink: #16181d;
  --ink-2: #4a4f5a;
  --muted: #7d828c;
  --line: #e4e2dc;
  --line-2: #d3d0c8;
  --accent: #e8551b;
  --accent-ink: #ffffff;
  --accent-soft: #fde9df;
  --ok: #1f8a4c;
  --ok-soft: #e1f3e8;
  --warn: #a36a00;
  --warn-soft: #fbf0d6;
  --info: #2c5fb8;
  --info-soft: #e3ecfa;
  --danger: #c23030;
  --danger-soft: #fbe5e5;
  --side: #16181d;
  --side-ink: #c9ccd3;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(20, 20, 30, .06), 0 4px 16px rgba(20, 20, 30, .06);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1013; --surface: #17191e; --surface-2: #1c1f25; --ink: #eceef2; --ink-2: #b8bcc6; --muted: #868b96;
    --line: #2a2d35; --line-2: #3a3e48; --accent: #ff6a2e; --accent-soft: #3a2015; --ok: #4cc27f; --ok-soft: #15301f;
    --warn: #e0a83a; --warn-soft: #33280f; --info: #6f9df0; --info-soft: #172640; --danger: #f06a6a; --danger-soft: #3a1818;
    --side: #0b0c0f; --shadow: 0 1px 2px rgba(0,0,0,.4), 0 4px 16px rgba(0,0,0,.3);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0f1013; --surface: #17191e; --surface-2: #1c1f25; --ink: #eceef2; --ink-2: #b8bcc6; --muted: #868b96;
  --line: #2a2d35; --line-2: #3a3e48; --accent: #ff6a2e; --accent-soft: #3a2015; --ok: #4cc27f; --ok-soft: #15301f;
  --warn: #e0a83a; --warn-soft: #33280f; --info: #6f9df0; --info-soft: #172640; --danger: #f06a6a; --danger-soft: #3a1818;
  --side: #0b0c0f; --shadow: 0 1px 2px rgba(0,0,0,.4), 0 4px 16px rgba(0,0,0,.3);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html {
  -webkit-text-size-adjust: 100%;
  /* при фокусе/прокрутке к элементу не прятать его под шапкой и нижней панелью */
  scroll-padding-top: 76px; scroll-padding-bottom: 24px;
  scrollbar-width: thin; scrollbar-color: var(--line-2) transparent;
}
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 10px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background-color: var(--muted); }
::-webkit-scrollbar-track { background: transparent; }
body.noscroll { position: fixed; left: 0; right: 0; overflow: hidden; }
* { -webkit-tap-highlight-color: transparent; }
body {
  overscroll-behavior-y: none;
  margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.45 var(--font);
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; }
h1, h2, h3 { margin: 0; line-height: 1.2; }
.num, .money { font-variant-numeric: tabular-nums; white-space: nowrap; }
.muted { color: var(--muted); }
.hidden { display: none !important; }

/* ---------- layout ---------- */
.shell { min-height: 100vh; }

/* Горизонтальное меню — ПК и планшет */
.topnav { position: sticky; top: 0; z-index: 40; background: var(--side); color: var(--side-ink); padding-top: env(safe-area-inset-top); }
.topnav-in { margin: 0; height: 60px; padding: 0 32px; display: flex; align-items: center; gap: 28px; }
.brand { display: flex; align-items: center; gap: 10px; color: #fff; font-weight: 700; font-size: 18px; letter-spacing: -.01em; text-decoration: none; flex: none; }
.brand-mark {
  width: 30px; height: 30px; border-radius: 8px; background: var(--accent); display: grid; place-items: center;
  color: #fff; font-size: 16px; font-weight: 800;
}
.hnav { display: flex; align-items: stretch; gap: 4px; height: 100%; margin-right: auto; min-width: 0; }
.nav-link {
  display: flex; align-items: center; gap: 8px; padding: 0 14px; text-decoration: none; color: var(--side-ink);
  font-weight: 600; font-size: 15px; border-bottom: 3px solid transparent; border-top: 3px solid transparent; white-space: nowrap;
}
.nav-link svg { width: 19px; height: 19px; flex: none; }
.nav-link:hover { color: #fff; background: rgba(255,255,255,.04); }
.nav-link.active { color: #fff; border-bottom-color: var(--accent); }
.nav-link.active svg { color: var(--accent); }
.who { display: flex; align-items: center; gap: 10px; flex: none; font-size: 14px; color: #d9dce2; }
.who .avatar { width: 30px; height: 30px; font-size: 13px; }
.who .btn.ghost { color: var(--side-ink); }
.who .btn.ghost:hover { color: #fff; background: rgba(255,255,255,.08); border-color: transparent; }

.main { min-width: 0; padding: 28px 32px 48px; }
.page { width: 100%; }
.page-head { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head h1 { font-size: 26px; letter-spacing: -.02em; margin-right: auto; }
.mhead, .vnav-backdrop, .mb-details { display: none; }
.chips { scroll-snap-type: x proximity; scroll-padding-inline: 16px; }
.chip { scroll-snap-align: start; }
.sheet-body { overscroll-behavior: contain; -webkit-overflow-scrolling: touch; scroll-padding: 12px; }

/* ---------- controls ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px; padding: 0 16px;
  border-radius: 8px; border: 1px solid var(--line-2); background: var(--surface); cursor: pointer; font-weight: 600;
  text-decoration: none; white-space: nowrap; transition: background .12s, border-color .12s;
}
.btn:hover { border-color: var(--ink-2); }
.btn svg { width: 18px; height: 18px; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.06); }
.btn.dark { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--surface-2); border-color: var(--line); }
.btn.danger { color: var(--danger); }
.btn.sm { height: 32px; padding: 0 10px; font-size: 13px; }
.btn.icon { width: 40px; padding: 0; }
.btn.sm.icon { width: 32px; }
.btn:disabled { opacity: .5; cursor: default; }
.btn:focus-visible, .input:focus-visible, .nav-link:focus-visible, .vnav-link:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.input, select.input, textarea.input {
  width: 100%; height: 40px; padding: 0 12px; border: 1px solid var(--line-2); border-radius: 8px;
  background: var(--surface); outline: none; transition: border-color .12s, box-shadow .12s;
}
textarea.input { height: auto; min-height: 72px; padding: 10px 12px; resize: vertical; }
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.input.num { text-align: right; }
label.field { display: grid; gap: 6px; font-size: 13px; font-weight: 600; color: var(--ink-2); }
.grid-form { align-items: end; display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-pad { padding: 18px 20px; }
.card h2 { font-size: 16px; }
.section-head { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.section-head h2 { margin-right: auto; display: flex; align-items: baseline; gap: 10px; }
.section-head .section-sum { font-weight: 700; }

.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  height: 32px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--surface);
  cursor: pointer; font-size: 13px; font-weight: 600; color: var(--ink-2);
}
.chip.active { background: var(--ink); color: var(--bg); border-color: var(--ink); }

.status { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.st-draft { background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); }
.st-sent { background: var(--info-soft); color: var(--info); }
.st-approved { background: var(--accent-soft); color: var(--accent); }
.st-in_work { background: var(--warn-soft); color: var(--warn); }
.st-done { background: var(--ok-soft); color: var(--ok); }
.st-cancelled { background: var(--danger-soft); color: var(--danger); }

/* ---------- orders list ---------- */
.toolbar { display: flex; gap: 12px; align-items: center; margin-bottom: 16px; flex-wrap: wrap; }
.search { position: relative; flex: 1 1 320px; max-width: 560px; }
.search svg { position: absolute; left: 12px; top: 11px; width: 18px; height: 18px; color: var(--muted); }
.search .input { padding-left: 38px; }

.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.table td { padding: 14px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr { cursor: pointer; }
.table tbody tr:hover td { background: var(--surface-2); }
.table .r { text-align: right; }
.o-title { font-weight: 600; }
.o-sub { font-size: 13px; color: var(--muted); }
.o-no { color: var(--muted); font-variant-numeric: tabular-nums; }
.empty { padding: 48px 20px; text-align: center; color: var(--muted); }
.empty b { display: block; color: var(--ink); font-size: 16px; margin-bottom: 6px; }
.order-cards { display: none; }

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 18px; }
.stat { padding: 16px 18px; }
.stat .k { font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.stat .v { font-size: 22px; font-weight: 700; margin-top: 4px; letter-spacing: -.01em; }

/* ---------- order editor ---------- */
.editor { display: grid; grid-template-columns: minmax(0, 1fr) clamp(340px, 26vw, 440px); gap: 20px; align-items: start; }
.editor-main { display: grid; gap: 16px; min-width: 0; }
.back { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); text-decoration: none; font-weight: 600; font-size: 14px; }
.back:hover { color: var(--ink); }
.dirty-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); margin-left: 8px; vertical-align: middle; }

.items-head, .item-row {
  display: grid; grid-template-columns: minmax(0, 1fr) 84px 92px 112px 124px 36px; gap: 8px; align-items: center; padding: 0 18px;
}
.items-head { font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; padding-top: 10px; padding-bottom: 6px; }
.items-head .r { text-align: right; }
.item-row { padding-top: 6px; padding-bottom: 6px; border-top: 1px solid transparent; }
.item-row:hover { background: var(--surface-2); }
.item-row .input { height: 36px; }
.item-row .input.name { font-weight: 500; }
.item-row .sum { text-align: right; font-weight: 600; }
.item-row .x { color: var(--muted); }
.item-row .x:hover { color: var(--danger); }
.item-row .cell { display: block; min-width: 0; }
.item-row .cl { display: none; }
.items-empty { padding: 18px; color: var(--muted); font-size: 14px; }
.items-foot { padding: 10px 18px 14px; display: flex; gap: 8px; flex-wrap: wrap; }

.summary { position: sticky; top: 80px; }
.summary .card-pad { padding: 18px 20px; }
.sum-row { display: flex; align-items: center; gap: 10px; padding: 7px 0; font-size: 14px; }
.sum-row .lbl { margin-right: auto; color: var(--ink-2); display: flex; align-items: center; gap: 6px; }
.sum-row.sub { font-weight: 700; border-top: 1px solid var(--line); margin-top: 4px; padding-top: 11px; }
.sum-row.sub .lbl { color: var(--ink); }
.pct { display: inline-flex; align-items: center; gap: 2px; }
.pct input { width: 48px; height: 26px; padding: 0 6px; text-align: right; border: 1px solid var(--line-2); border-radius: 6px; background: var(--surface-2); font-size: 13px; }
.pct input:focus { outline: none; border-color: var(--accent); }
.grand { margin-top: 12px; padding: 16px 18px; border-radius: 10px; background: var(--ink); color: var(--bg); }
.grand .k { font-size: 12px; opacity: .7; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
.grand .v { font-size: 30px; font-weight: 800; letter-spacing: -.02em; margin-top: 2px; }
.grand .v small { font-size: 18px; font-weight: 700; opacity: .8; }
.grand .s { font-size: 13px; opacity: .7; margin-top: 4px; }
.summary-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 14px; }
.summary-actions .btn.primary { grid-column: 1 / -1; height: 46px; font-size: 16px; }
.mobile-bar { display: none; }

/* menu */
.menu-wrap { position: relative; }
.menu {
  position: absolute; right: 0; top: calc(100% + 6px); min-width: 230px; z-index: 30; padding: 6px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 10px 30px rgba(0,0,0,.18);
}
.menu button { display: flex; width: 100%; gap: 10px; align-items: center; padding: 10px 12px; border: 0; background: none; border-radius: 6px; cursor: pointer; text-align: left; font-weight: 500; }
.menu button:hover { background: var(--surface-2); }
.menu button svg { width: 18px; height: 18px; color: var(--muted); }
.menu .sep { height: 1px; background: var(--line); margin: 6px 0; }
.menu .danger, .menu .danger svg { color: var(--danger); }

/* ---------- sheet / modal ---------- */
.overlay { position: fixed; inset: 0; background: rgba(10, 10, 15, .45); z-index: 50; display: grid; place-items: center; padding: 20px; animation: fade .12s ease-out; }
.sheet {
  width: min(680px, 100%); max-height: min(86vh, 860px); display: flex; flex-direction: column;
  background: var(--surface); border-radius: 14px; box-shadow: 0 20px 60px rgba(0,0,0,.3); overflow: hidden;
}
.sheet-head { display: flex; align-items: center; gap: 10px; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.sheet-head h2 { margin-right: auto; font-size: 18px; }
.sheet-search { padding: 12px 18px; border-bottom: 1px solid var(--line); }
.sheet-body { overflow: auto; flex: 1; }
.sheet-foot { display: flex; gap: 10px; padding: 14px 18px; border-top: 1px solid var(--line); align-items: center; }
.sheet-foot .grow { margin-right: auto; color: var(--muted); font-size: 14px; }
.pick-row { display: grid; grid-template-columns: minmax(0, 1fr) auto 128px; gap: 12px; align-items: center; padding: 10px 18px; border-bottom: 1px solid var(--line); }
.pick-row.on { background: var(--accent-soft); }
.pick-row .pn { font-weight: 500; }
.pick-row .pp { font-size: 13px; color: var(--muted); }
.stepper { display: grid; grid-template-columns: 34px 1fr 34px; border: 1px solid var(--line-2); border-radius: 8px; overflow: hidden; height: 36px; background: var(--surface); }
.stepper button { border: 0; background: var(--surface-2); cursor: pointer; font-size: 18px; color: var(--ink-2); }
.stepper input { border: 0; width: 100%; text-align: center; background: transparent; outline: none; min-width: 0; }
@keyframes fade { from { opacity: 0; } }
@keyframes drop { from { transform: translateY(-8px); opacity: 0; } }
@keyframes up { from { transform: translateY(24px); opacity: .6; } }

/* ---------- catalog ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; }
.tab { padding: 10px 14px; border: 0; background: none; cursor: pointer; font-weight: 600; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tab.active { color: var(--ink); border-bottom-color: var(--accent); }
.tab .cnt { font-size: 12px; color: var(--muted); font-weight: 600; margin-left: 4px; }
.cat-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(110px, 12%) minmax(140px, 14%) 80px; gap: 8px; align-items: center; padding: 8px 16px; border-bottom: 1px solid var(--line); }
.cat-row:last-child { border-bottom: 0; }
.cat-row .input { height: 36px; }
.cat-row.archived { opacity: .55; }
.cat-row.new { background: var(--surface-2); }
.cat-row .acts { display: flex; justify-content: flex-end; gap: 4px; }
.cat-head { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; font-weight: 600; padding-top: 12px; padding-bottom: 8px; }
.saved-flash { animation: flash 1s ease-out; }
@keyframes flash { 0% { box-shadow: 0 0 0 3px var(--ok-soft); border-color: var(--ok); } }

/* ---------- settings ---------- */
.settings-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(380px, 1fr)); gap: 16px; align-items: stretch; }
.settings-grid .card h2 { margin-bottom: 4px; }
.settings-grid .card p.muted { margin: 0 0 16px; font-size: 14px; }
.user-row { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.user-row:last-child { border-bottom: 0; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; font-weight: 700; flex: none; }
.form-actions { display: flex; gap: 10px; margin-top: 16px; flex-wrap: wrap; }

/* ---------- login ---------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 20px; background:
  radial-gradient(1200px 500px at 10% -10%, var(--accent-soft), transparent 60%), var(--bg); }
.login .card { width: min(400px, 100%); padding: 32px 28px; }
.login .brand { color: var(--ink); padding: 0 0 20px; font-size: 22px; }
.login h1 { font-size: 22px; margin-bottom: 6px; }
.login p { color: var(--muted); margin: 0 0 22px; }
.login form { display: grid; gap: 14px; }
.login .btn { height: 46px; }
.err { color: var(--danger); font-size: 14px; min-height: 20px; }

/* ---------- toasts ---------- */
#toasts { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 100; display: grid; gap: 8px; pointer-events: none; }
.toast { background: var(--ink); color: var(--bg); padding: 12px 18px; border-radius: 10px; box-shadow: var(--shadow); font-weight: 600; animation: up .18s ease-out; max-width: 90vw; }
.toast.error { background: var(--danger); color: #fff; }

.loading { padding: 60px; text-align: center; color: var(--muted); }
.spin { width: 22px; height: 22px; border: 3px solid var(--line); border-top-color: var(--accent); border-radius: 50%; display: inline-block; animation: rot .8s linear infinite; }
@keyframes rot { to { transform: rotate(360deg); } }
.offline { background: var(--warn-soft); color: var(--warn); padding: 8px 14px; border-radius: 8px; font-size: 14px; font-weight: 600; margin-bottom: 14px; }

/* ===================== MOBILE ===================== */
@media (max-width: 960px) {
  .topnav-in { padding: 0 20px; gap: 16px; }
  .main { padding: 22px 20px 40px; }
  .who-name { display: none; }
  .nav-link { padding: 0 10px; }
  .editor { grid-template-columns: 1fr; }
  .summary { position: static; }
  .summary-actions { display: none; }
}

@media (max-width: 760px) {
  body { font-size: 16px; }
  .topnav { display: none; }
  html { scroll-padding-top: 72px; scroll-padding-bottom: 110px; }


  .chips {
    -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 16px, #000 calc(100% - 28px), transparent);
            mask-image: linear-gradient(90deg, transparent 0, #000 16px, #000 calc(100% - 28px), transparent);
  }
  .chips::-webkit-scrollbar { display: none; }
  .vnav { max-height: calc(100vh - 60px); overflow: auto; overscroll-behavior: contain; }
  .main { padding: 14px 16px calc(24px + env(safe-area-inset-bottom)); }
  .mhead { display: block; position: sticky; top: 0; z-index: 40; }
  .topbar {
    display: flex; align-items: center; gap: 4px; padding: calc(8px + env(safe-area-inset-top)) 8px 8px 16px;
    background: var(--side); color: #fff; min-height: 56px;
  }
  .topbar .t { font-weight: 700; font-size: 18px; margin-right: auto; display: flex; align-items: center; gap: 10px; min-width: 0; }
  .topbar .t span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .topbar .btn.ghost { color: #fff; }
  .topbar .btn.ghost:hover { background: rgba(255,255,255,.08); border-color: transparent; }
  .topbar .btn.primary { margin-right: 4px; }
  .topbar .brand-mark { width: 28px; height: 28px; font-size: 15px; }
  .topbar > a.btn:first-child { margin-left: -8px; }

  /* Вертикальное меню — телефон */
  .vnav {
    position: absolute; left: 0; right: 0; top: 100%; background: var(--surface); border-bottom: 1px solid var(--line);
    box-shadow: 0 16px 40px rgba(0,0,0,.25); padding: 8px; display: flex; flex-direction: column; gap: 2px;
    animation: drop .16s ease-out;
  }
  .vnav[hidden], .vnav-backdrop[hidden] { display: none; }
  .vnav-link {
    display: flex; align-items: center; gap: 14px; padding: 14px 14px; border-radius: 10px; text-decoration: none;
    font-weight: 600; font-size: 17px; color: var(--ink);
  }
  .vnav-link svg { width: 22px; height: 22px; color: var(--muted); }
  .vnav-link.active { background: var(--accent-soft); color: var(--accent); }
  .vnav-link.active svg { color: var(--accent); }
  .vnav-foot { display: flex; align-items: center; gap: 12px; margin-top: 6px; padding: 14px 6px 6px; border-top: 1px solid var(--line); font-size: 14px; }
  .vnav-foot .grow { margin-right: auto; min-width: 0; }
  .vnav-backdrop { display: block; position: fixed; inset: 0; z-index: 35; background: rgba(10,10,15,.4); animation: fade .12s ease-out; }
  .page-head { display: none; }

  .stats { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stats .stat:first-child { grid-column: 1 / -1; }
  .stat { padding: 12px 14px; }
  .stat .v { font-size: 19px; }
  .toolbar { gap: 10px; }
  .search { max-width: none; flex-basis: 100%; }
  .chips { flex-wrap: nowrap; overflow-x: auto; margin: 0 -16px; padding: 0 16px; scrollbar-width: none; }
  .chip { flex: none; }
  .orders-table { display: none; }
  .order-cards { display: grid; gap: 10px; }
  .o-card { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; padding: 14px 16px; text-decoration: none; }
  .o-card .o-title { font-size: 16px; }
  .o-card .money { font-weight: 700; font-size: 16px; text-align: right; }
  .o-card .meta { grid-column: 1 / -1; display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 6px; font-size: 13px; color: var(--muted); }

  .card { border-radius: 12px; }
  .section-head { padding: 12px 14px; }
  .items-head { display: none; }
  .item-row {
    grid-template-columns: minmax(0, 1fr) 72px minmax(0, 1fr) 40px;
    grid-template-areas: "name name name x" "qty unit price price" "sum sum sum sum";
    gap: 8px; padding: 12px 14px; border-top: 1px solid var(--line);
  }
  .item-row:first-child { border-top: 0; }
  .item-row .c-name { grid-area: name; }
  .item-row .c-unit { grid-area: unit; }
  .item-row .c-qty { grid-area: qty; }
  .item-row .c-price { grid-area: price; }
  .item-row .sum { grid-area: sum; font-size: 16px; }
  .item-row .sum::before { content: "Сумма: "; color: var(--muted); font-weight: 500; font-size: 14px; }
  .item-row .x { grid-area: x; justify-self: end; }
  .item-row .input { height: 42px; }
  .item-row .c-name .cl { display: none; }
  .item-row .cl { display: block; font-size: 11px; color: var(--muted); font-weight: 600; margin: 0 0 3px 2px; text-transform: uppercase; letter-spacing: .04em; }
  .item-row .input.num { text-align: left; }
  .items-foot { padding: 10px 14px 14px; }
  .items-foot .btn { flex: 1; }

  .mobile-bar {
    display: block; position: fixed; left: 0; right: 0; bottom: 0; z-index: 36;
    background: var(--ink); color: var(--bg); padding-bottom: env(safe-area-inset-bottom);
    box-shadow: 0 -6px 20px rgba(0,0,0,.18); border-radius: 0;
    transition: border-radius .2s ease;
  }
  .mobile-bar.open { border-radius: 16px 16px 0 0; }
  .mb-main { display: flex; align-items: center; gap: 12px; padding: 10px 16px; }
  .mb-toggle { all: unset; cursor: pointer; display: grid; margin-right: auto; min-width: 0; padding: 2px 0; }
  .mb-toggle .k { font-size: 11px; opacity: .7; text-transform: uppercase; letter-spacing: .05em; font-weight: 600; display: flex; align-items: center; gap: 4px; }
  .mb-toggle .v { font-size: 20px; font-weight: 800; }
  .mb-toggle .chev svg { width: 14px; height: 14px; transform: rotate(90deg); transition: transform .2s ease; display: block; }
  .mobile-bar.open .chev svg { transform: rotate(-90deg); }
  .mobile-bar .btn { height: 44px; }
  .mb-details { display: block; padding: 14px 16px 2px; border-bottom: 1px solid rgba(255,255,255,.12); animation: up .18s ease-out; max-height: 60vh; overflow: auto; overscroll-behavior: contain; }
  .mb-details[hidden] { display: none; }
  .mb-details .sum-row { padding: 5px 0; font-size: 15px; }
  .mb-details .sum-row .lbl { color: inherit; opacity: .75; }
  .mb-details .sum-row.sub { border-top-color: rgba(255,255,255,.14); }
  .mb-details .sum-row.sub .lbl { opacity: 1; }
  .mb-goto { color: var(--accent) !important; padding: 0 !important; margin: 4px 0 8px; }
  #mb-bg { z-index: 35; }
  .main.has-bar { padding-bottom: calc(96px + env(safe-area-inset-bottom)); }

  .overlay { padding: 0; place-items: end stretch; }
  .sheet { width: 100%; max-height: 92vh; border-radius: 16px 16px 0 0; animation: up .2s ease-out; padding-bottom: env(safe-area-inset-bottom); }
  .pick-row { grid-template-columns: minmax(0, 1fr) 124px; padding: 12px 16px; }
  .pick-row .pp-col { display: none; }
  .menu { position: fixed; left: 8px; right: 8px; top: auto; bottom: calc(8px + env(safe-area-inset-bottom)); border-radius: 14px; padding: 8px; }
  .menu button { padding: 14px 12px; font-size: 16px; }

  .cat-row { grid-template-columns: 1fr 1fr 44px; grid-template-areas: "name name acts" "unit price price"; padding: 12px 14px; }
  .cat-row > :nth-child(1) { grid-area: name; }
  .cat-row > :nth-child(2) { grid-area: unit; }
  .cat-row > :nth-child(3) { grid-area: price; }
  .cat-row > :nth-child(4) { grid-area: acts; }
  .cat-row.new { grid-template-areas: "name name name" "unit price acts"; }
  .cat-head { display: none; }
  .cat-row .input { height: 42px; }
  .settings-grid { grid-template-columns: 1fr; }
  #toasts { bottom: calc(90px + env(safe-area-inset-bottom)); }
}

/* ===================== PRINT ===================== */
#print { display: none; }
@media print {
  @page { size: A4; margin: 14mm 14mm 16mm; }
  body { background: #fff; color: #000; font-size: 11pt; }
  #app, #toasts { display: none !important; }
  #print { display: block; }
  .p-head { display: flex; justify-content: space-between; gap: 20px; border-bottom: 2px solid #000; padding-bottom: 10px; margin-bottom: 16px; }
  .p-company { font-size: 14pt; font-weight: 700; }
  .p-details { font-size: 9pt; color: #444; white-space: pre-line; text-align: right; }
  .p-title { font-size: 16pt; font-weight: 700; margin: 6px 0 4px; }
  .p-meta { color: #333; margin-bottom: 14px; }
  .p-meta div { margin: 2px 0; }
  table.p { width: 100%; border-collapse: collapse; margin-bottom: 12px; font-size: 10pt; }
  table.p th, table.p td { border: 1px solid #999; padding: 4px 6px; }
  table.p th { background: #eee; text-align: left; }
  table.p td.r, table.p th.r { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
  table.p tr.grp td { background: #f4f4f4; font-weight: 700; }
  table.p tr.b td { font-weight: 700; }
  table.p tr.total td { font-weight: 800; font-size: 12pt; background: #eee; }
  .p-sign { margin-top: 36px; display: flex; justify-content: space-between; gap: 40px; }
  .p-sign div { flex: 1; border-top: 1px solid #000; padding-top: 4px; font-size: 9pt; color: #444; }
  .p-note { margin-top: 10px; font-size: 10pt; white-space: pre-line; }
}

/* ---------- импорт из Excel ---------- */
.check { display: flex; gap: 8px; align-items: center; font-size: 14px; color: var(--ink-2); cursor: pointer; }
.import-btn { margin-left: auto; }
.sheet-wide { width: min(1040px, 100%); }
.imp-step1 { padding: 18px; display: grid; gap: 16px; }
.drop {
  display: grid; justify-items: center; gap: 6px; padding: 34px 20px; text-align: center; cursor: pointer;
  border: 2px dashed var(--line-2); border-radius: 12px; background: var(--surface-2); transition: border-color .15s, background .15s;
}
.drop:hover, .drop.over { border-color: var(--accent); background: var(--accent-soft); }
.drop-ico svg { width: 40px; height: 40px; color: var(--accent); }
.drop b { font-size: 17px; }
.imp-help { font-size: 14px; color: var(--ink-2); background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; }
.imp-help p { margin: 6px 0 0; }
.imp-top { padding: 16px 18px; display: grid; gap: 14px; border-bottom: 1px solid var(--line); background: var(--surface-2); }
.imp-file { display: flex; align-items: center; gap: 12px; }
.imp-file > svg { width: 30px; height: 30px; color: var(--ok); flex: none; }
.imp-file > div { margin-right: auto; min-width: 0; }
.imp-file .muted { font-size: 13px; }
.imp-map { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.imp-mode { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.radio { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--line-2); border-radius: 10px; background: var(--surface); cursor: pointer; }
.radio:has(input:checked) { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.radio input { margin-top: 3px; accent-color: var(--accent); }
.radio small { display: block; color: var(--muted); font-size: 13px; margin-top: 2px; }
.imp-row { display: grid; grid-template-columns: 36px minmax(0, 1fr) 90px 130px 130px; gap: 10px; align-items: center; padding: 9px 18px; border-bottom: 1px solid var(--line); cursor: pointer; }
.imp-row:hover { background: var(--surface-2); }
.imp-row.off { opacity: .45; }
.imp-row input { width: 18px; height: 18px; accent-color: var(--accent); }
.imp-head { position: sticky; top: 0; z-index: 1; background: var(--surface); font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; font-weight: 600; cursor: default; }
.imp-head:hover { background: var(--surface); }
.imp-row .r { text-align: right; }
.imp-name { font-weight: 500; min-width: 0; }
.imp-name small { display: block; font-size: 12px; font-weight: 500; }
.warn-note { color: var(--warn); }
.pill { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.pill-new { background: var(--ok-soft); color: var(--ok); }
.pill-upd { background: var(--info-soft); color: var(--info); }
.pill-same { background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); }
.danger-t { color: var(--danger); }

@media (max-width: 760px) {
  .import-btn { margin-left: 0; flex: 1 1 100%; }
  .imp-map { grid-template-columns: 1fr 1fr; }
  .imp-map label:first-child { grid-column: 1 / -1; }
  .imp-mode { grid-template-columns: 1fr; }
  .imp-row { grid-template-columns: 30px minmax(0, 1fr) auto; grid-template-areas: "c n s" "c u p"; padding: 10px 14px; gap: 2px 10px; }
  .imp-row > :nth-child(1) { grid-area: c; }
  .imp-row > :nth-child(2) { grid-area: n; }
  .imp-row > :nth-child(3) { grid-area: u; font-size: 13px; color: var(--muted); }
  .imp-row > :nth-child(4) { grid-area: p; font-size: 14px; }
  .imp-row > :nth-child(5) { grid-area: s; justify-self: end; }
  .imp-head { display: none; }
  .sheet-foot { flex-wrap: wrap; }
  .sheet-foot .grow { flex: 1 1 100%; }
  .sheet-foot .btn { flex: 1; }
}

/* ---------- архив ---------- */
.arch-intro { margin: -8px 0 16px; font-size: 14px; }
.arch-clear { margin-left: auto; }
.arch-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 360px), 1fr)); gap: 14px; }
.arch-card { display: flex; flex-direction: column; gap: 12px; padding: 16px 18px; transition: opacity .18s, transform .18s; }
.arch-main { min-width: 0; }
.arch-title { display: flex; justify-content: space-between; gap: 12px; font-weight: 600; font-size: 16px; }
.arch-title .money { font-weight: 700; }
.arch-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 13px; color: var(--muted); margin-top: 6px; }
.arch-acts { display: flex; gap: 8px; flex-wrap: wrap; }
.arch-card .arch-acts { border-top: 1px solid var(--line); padding-top: 12px; }
.arch-group { padding: 12px 18px 8px; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; font-weight: 600; color: var(--muted); background: var(--surface-2); border-bottom: 1px solid var(--line); }
.arch-row { display: flex; align-items: center; gap: 12px; padding: 12px 18px; border-bottom: 1px solid var(--line); transition: opacity .18s, transform .18s; }
.arch-row:last-child { border-bottom: 0; }
.arch-name { margin-right: auto; min-width: 0; display: grid; gap: 2px; }
.arch-name .muted { font-size: 13px; }
.arch-gone { opacity: 0; transform: translateX(16px); }
.btn.danger:hover { border-color: var(--danger); }

@media (max-width: 960px) {
}
@media (max-width: 760px) {
  .arch-grid { grid-template-columns: 1fr; }
  .arch-clear { margin-left: 0; flex: 1 1 100%; }
  .arch-card .arch-acts .btn { flex: 1; }
  .arch-row { flex-wrap: wrap; padding: 12px 14px; }
  .arch-row .arch-name { flex: 1 1 100%; }
  .arch-row .arch-acts { width: 100%; }
  .arch-row .arch-acts .btn { flex: 1; }
}

/* ---------- фиксированная кнопка «Новый просчёт» (все экраны) ---------- */
.fab {
  display: inline-flex; align-items: center; gap: 10px; position: fixed; z-index: 30;
  right: 32px; bottom: calc(32px + env(safe-area-inset-bottom));
  height: 60px; padding: 0 26px 0 20px; border-radius: 30px; text-decoration: none;
  background: var(--accent); color: #fff; font-weight: 700; font-size: 16px;
  box-shadow: 0 8px 24px rgba(232, 85, 27, .36), 0 2px 6px rgba(0,0,0,.16);
  transition: padding .2s ease, gap .2s ease, transform .12s ease, box-shadow .15s ease;
}
.fab svg { width: 24px; height: 24px; flex: none; }
.fab span { white-space: nowrap; overflow: hidden; max-width: 170px; transition: max-width .2s ease, opacity .2s ease; }
.fab:hover { transform: translateY(-2px); box-shadow: 0 12px 28px rgba(232, 85, 27, .42), 0 3px 8px rgba(0,0,0,.18); }
.fab:active { transform: scale(.96); }
.fab:focus-visible { outline: 3px solid var(--ink); outline-offset: 3px; }
.fab.compact { padding: 0 18px; gap: 0; }
.fab.compact span { max-width: 0; opacity: 0; }
.main.has-fab { padding-bottom: calc(112px + env(safe-area-inset-bottom)); }
@media (max-width: 760px) {
  .fab { right: 16px; bottom: calc(18px + env(safe-area-inset-bottom)); height: 56px; padding: 0 22px 0 18px; }
  .fab.compact { padding: 0 16px; }
  .main.has-fab { padding-bottom: calc(96px + env(safe-area-inset-bottom)); }
}
@media print { .fab { display: none !important; } }

/* ---------- выгрузка в Excel ---------- */
.xls-group { display: flex; gap: 8px; margin-left: auto; }
.xls-btn { color: #1d6f42; border-color: #b7d7c4; background: #f2f9f5; }
.xls-btn:hover { border-color: #1d6f42; }
.xls-btn.disabled { opacity: .5; pointer-events: none; }
:root[data-theme="dark"] .xls-btn { color: #6fd39a; border-color: #2c5a40; background: #15261c; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .xls-btn { color: #6fd39a; border-color: #2c5a40; background: #15261c; } }
@media (max-width: 760px) { .xls-group { margin-left: 0; flex: 1 1 100%; } .xls-group .btn { flex: 1 1 0; min-width: 0; padding: 0 10px; } .xl-word { display: none; } }

/* ---------- загрузка заказов ---------- */
.oi-opts { display: flex; gap: 10px 24px; flex-wrap: wrap; }
.oi-list { padding: 14px 18px; display: grid; gap: 12px; background: var(--bg); }
.oi-card { padding: 14px 16px; display: grid; gap: 10px; box-shadow: none; }
.oi-card.off { opacity: .5; }
.oi-head { display: grid; grid-template-columns: auto auto minmax(0, 1fr) minmax(0, 1.4fr) auto; gap: 10px; align-items: center; }
.oi-head input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--accent); }
.oi-head .input { height: 38px; }
.oi-total { font-size: 17px; white-space: nowrap; }
.oi-meta { display: flex; flex-wrap: wrap; gap: 6px 16px; align-items: center; font-size: 13px; color: var(--ink-2); }
.oi-meta .oi-toggle { margin-left: auto; }
.oi-items { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.oi-row { display: grid; grid-template-columns: 150px minmax(0, 1fr) 80px 80px 120px 130px; gap: 10px; align-items: center; padding: 6px 12px; border-bottom: 1px solid var(--line); font-size: 14px; }
.oi-row:last-child { border-bottom: 0; }
.oi-row .r { text-align: right; }
.oi-row .oi-kind { height: 32px; padding: 0 8px; font-size: 13px; }
.oi-row-head { background: var(--surface-2); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; }
@media (max-width: 760px) {
  .oi-list { padding: 12px; }
  .oi-head { grid-template-columns: auto minmax(0, 1fr) auto; }
  .oi-head .pill { grid-column: 2; justify-self: start; }
  .oi-head .oi-total { grid-column: 3; grid-row: 1; }
  .oi-head .oi-client, .oi-head .oi-title { grid-column: 1 / -1; }
  .oi-meta .oi-toggle { margin-left: 0; width: 100%; }
  .oi-row { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "n n" "k s" "q q"; gap: 4px 10px; padding: 10px 12px; }
  .oi-row-head { display: none; }
  .oi-row > :nth-child(1) { grid-area: k; }
  .oi-row > :nth-child(2) { grid-area: n; font-weight: 500; }
  .oi-row > :nth-child(3), .oi-row > :nth-child(4), .oi-row > :nth-child(5) { display: none; }
  .oi-row > :nth-child(6) { grid-area: s; }
}

/* ---------- безопасность: пользователи, журнал, смена пароля ---------- */
.small { font-size: 13px; }
.ro-note { margin: 14px 0 0; font-size: 13px; color: var(--muted); padding: 8px 12px; background: var(--surface-2); border-radius: 8px; }
.who-name { display: grid; line-height: 1.2; }
.who-name small { font-size: 11px; color: #8a8f99; }
.users-card { grid-column: span 2; }
.audit-card { grid-column: 1 / -1; }
.user-row { display: grid; grid-template-columns: auto minmax(0, 1fr) 180px auto; gap: 12px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line); }
.user-main { min-width: 0; }
.user-badges { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 4px; }
.user-badges:empty { display: none; }
.user-role { height: 36px; }
.user-acts { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }
.pill-bad { background: var(--danger-soft); color: var(--danger); }
.user-form { margin-top: 16px; display: grid; gap: 10px; padding: 14px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; }
.user-form p { margin: 0; }
.pw-gen { display: flex; gap: 6px; }
.pw-gen .input { min-width: 0; }
.audit-list { display: grid; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; max-height: 520px; overflow-y: auto; overscroll-behavior: contain; }
.audit-row { display: grid; grid-template-columns: 150px 140px minmax(0, 1fr) 130px; gap: 12px; padding: 8px 12px; border-bottom: 1px solid var(--line); font-size: 13px; align-items: baseline; }
.audit-row:last-child { border-bottom: 0; }
.audit-row.bad { background: var(--danger-soft); }
.audit-at { color: var(--muted); font-variant-numeric: tabular-nums; }
.audit-who { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.audit-ip { text-align: right; font-variant-numeric: tabular-nums; }
.audit-more { margin-top: 10px; }
.secret-sheet { width: min(480px, 100%); }
.secret-body { padding: 16px 18px; }
.secret-body p { margin: 0 0 12px; }
.secret { display: flex; gap: 10px; align-items: center; padding: 12px; background: var(--surface-2); border: 1px dashed var(--line-2); border-radius: 10px; margin-bottom: 12px; }
.secret code { font-size: 20px; font-weight: 700; letter-spacing: .04em; margin-right: auto; user-select: all; word-break: break-all; }
.login form .btn.ghost { height: 40px; }
@media (max-width: 1100px) { .users-card { grid-column: 1 / -1; } }
@media (max-width: 760px) {
  .user-row { grid-template-columns: auto minmax(0, 1fr); }
  .user-role, .user-acts { grid-column: 1 / -1; }
  .user-acts { justify-content: flex-start; }
  .audit-row { grid-template-columns: 1fr auto; gap: 2px 10px; }
  .audit-act { grid-column: 1 / -1; }
  .audit-ip { display: none; }
}

/* справочник для менеджера — только просмотр */
.cat-ro { display: grid; grid-template-columns: minmax(0, 1fr) 120px 150px; gap: 10px; padding: 11px 16px; border-bottom: 1px solid var(--line); align-items: center; }
.cat-ro:last-child { border-bottom: 0; }
.cat-ro .r { text-align: right; }
.cat-ro-head { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; font-weight: 600; }
.pct input:disabled { opacity: .7; cursor: not-allowed; background: transparent; border-style: dashed; }
@media (max-width: 760px) { .cat-ro { grid-template-columns: minmax(0, 1fr) auto; } .cat-ro > :nth-child(2) { display: none; } }
.item-row .input:disabled { background: var(--surface-2); color: var(--ink-2); cursor: not-allowed; border-style: dashed; }

/* ---------- активные сеансы ---------- */
.sessions-card { grid-column: 1 / -1; }
.card-title-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 4px; }
.card-title-row h2 { margin: 0 !important; }
.card-title-row .btn { margin-left: auto; }
.online-count { font-size: 13px; color: var(--ink-2); display: inline-flex; align-items: center; gap: 6px; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--line-2); flex: none; }
.dot.on { background: var(--ok); box-shadow: 0 0 0 3px var(--ok-soft); }
.sess-list { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.sess-row { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1.2fr) 140px 140px 130px 110px; gap: 12px; align-items: center; padding: 10px 14px; border-bottom: 1px solid var(--line); font-size: 14px; }
.sess-row:last-child { border-bottom: 0; }
.sess-row.me { background: var(--accent-soft); }
.sess-head { background: var(--surface-2); font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; font-weight: 600; }
.sess-user { display: grid; min-width: 0; }
.sess-user b, .sess-user small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sess-user .you { color: var(--accent); }
.sess-dev { display: flex; align-items: center; gap: 8px; min-width: 0; }
.sess-dev svg { width: 18px; height: 18px; color: var(--muted); flex: none; }
.sess-dev span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sess-ip { font-variant-numeric: tabular-nums; }
.sess-in { font-size: 13px; }
.sess-act { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.sess-btn { text-align: right; }
@media (max-width: 1100px) and (min-width: 761px) { .sess-row { grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr) 120px 120px 100px; } .sess-row > :nth-child(4) { display: none; } }
@media (max-width: 760px) {
  .sess-head { display: none; }
  .sess-row { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "u b" "d d" "a a"; gap: 4px 10px; }
  .sess-user { grid-area: u; } .sess-btn { grid-area: b; } .sess-dev { grid-area: d; font-size: 13px; }
  .sess-act { grid-area: a; } .sess-ip { display: inline; grid-area: a; justify-self: end; font-size: 13px; color: var(--muted); }
  .card-title-row .btn { margin-left: 0; }
}
.app-ver { font-size: 12px; margin-top: 18px; text-align: center; }

/* ---------- удобное заполнение справочника ---------- */
.fab { border: 0; cursor: pointer; font: inherit; font-weight: 700; }
.cat-sticky { position: sticky; top: 60px; z-index: 12; background: var(--bg); padding-top: 4px; margin-top: -4px; }
.cat-sticky .toolbar { margin-bottom: 12px; padding-bottom: 4px; }
.cat-head { position: sticky; top: var(--cat-top, 172px); z-index: 11; background: var(--surface); border-radius: var(--radius) var(--radius) 0 0; }
.cat-row.no-price { background: linear-gradient(90deg, var(--warn-soft), transparent 40%); }
.cat-row.no-price [data-k=price] { border-color: var(--warn); }
.cat-row .input.num { font-variant-numeric: tabular-nums; }
.chip.warn { border-color: var(--warn); color: var(--warn); background: var(--warn-soft); }
.cat-hint { font-size: 13px; margin-top: 12px; }
.add-sheet { width: min(560px, 100%); }
.add-form { padding: 16px 18px 6px; display: grid; gap: 12px; }
.add-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.add-form .input { height: 46px; font-size: 16px; }
.seg { display: grid; grid-template-columns: repeat(3, 1fr); background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 3px; gap: 3px; }
.seg button { border: 0; background: none; padding: 8px 6px; border-radius: 7px; font-weight: 600; color: var(--ink-2); cursor: pointer; }
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.unit-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.unit-chips .chip { height: 30px; }
.dup { font-size: 13px; padding: 8px 12px; border-radius: 8px; background: var(--warn-soft); color: var(--warn); }
.add-done { margin: 0 18px 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); font-size: 14px; display: grid; gap: 4px; max-height: 190px; overflow: auto; }
.add-item { display: grid; grid-template-columns: 18px minmax(0, 1fr) auto auto; gap: 8px; align-items: center; }
.add-item svg { width: 16px; height: 16px; color: var(--ok); }
.add-item span:nth-child(2) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 760px) {
  .cat-sticky { top: 56px; }
  .cat-head { position: static; }
  .add-sheet .sheet-foot .grow { flex: 1 1 100%; }
}
