:root {
  --bg: #f6f5f2;
  --surface: #ffffff;
  --surface-2: #f0eee9;
  --ink: #1f2328;
  --ink-2: #5b6168;
  --ink-3: #8b9097;
  --line: #e2dfd8;
  --line-2: #d3cfc6;
  --accent: #ab2328;
  --accent-2: #fbeaea;
  --side: #2b3640;
  --side-ink: #c9cdd2;
  --in: #2b8a3e;
  --in-bg: #ebf7ee;
  --out: #c92a2a;
  --out-bg: #fdeeee;
  --tr: #1c6fb8;
  --tr-bg: #e8f1fb;
  --warn: #b35c00;
  --warn-bg: #fff4e0;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(31, 35, 40, .06), 0 2px 8px rgba(31, 35, 40, .05);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #15171a; --surface: #1d2024; --surface-2: #24282d; --ink: #e9eaec; --ink-2: #a7adb4; --ink-3: #7c838b;
    --line: #2e3238; --line-2: #3a3f46; --accent: #e2585d; --accent-2: #3a1d1f; --side: #151b21; --side-ink: #a7adb4;
    --in: #51cf66; --in-bg: #1b2e20; --out: #ff6b6b; --out-bg: #331d1d; --tr: #4dabf7; --tr-bg: #17293a; --warn: #ffa94d; --warn-bg: #33270f;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
    --bg: #15171a; --surface: #1d2024; --surface-2: #24282d; --ink: #e9eaec; --ink-2: #a7adb4; --ink-3: #7c838b;
    --line: #2e3238; --line-2: #3a3f46; --accent: #e2585d; --accent-2: #3a1d1f; --side: #151b21; --side-ink: #a7adb4;
    --in: #51cf66; --in-bg: #1b2e20; --out: #ff6b6b; --out-bg: #331d1d; --tr: #4dabf7; --tr-bg: #17293a; --warn: #ffa94d; --warn-bg: #33270f;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3); color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font: 15px/1.45 var(--font); -webkit-font-smoothing: antialiased; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
.num, .money, td.r, th.r { font-variant-numeric: tabular-nums; }
.boot { display: grid; place-items: center; min-height: 100vh; color: var(--ink-3); }

/* ---------- каркас ---------- */
.shell { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
.shell > div { min-width: 0; }
.side { background: var(--side); color: var(--side-ink); padding: 18px 12px; position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 4px; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 18px; color: #fff; font-weight: 700; font-size: 16px; letter-spacing: -.01em; }
.brand img { width: 30px; height: 30px; }
.brand small { display: block; font-weight: 400; color: var(--side-ink); font-size: 12px; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 9px; text-decoration: none; color: var(--side-ink); font-weight: 500; }
.nav a:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.nav a.on { background: rgba(255, 255, 255, .1); color: #fff; box-shadow: inset 3px 0 0 var(--accent); }
.nav svg { width: 18px; height: 18px; flex: none; }
.side .me { margin-top: auto; padding: 10px 12px; border-top: 1px solid rgba(255, 255, 255, .08); font-size: 13px; }
.side .me a { color: #fff; text-decoration: none; font-weight: 600; }
.theme-btn { display: inline-flex; align-items: center; gap: 8px; border: 1px solid rgba(255, 255, 255, .14); background: rgba(255, 255, 255, .06); color: var(--side-ink); border-radius: 9px; padding: 6px 10px; cursor: pointer; font-size: 13px; }
.theme-btn:hover { background: rgba(255, 255, 255, .12); color: #fff; }
.theme-btn svg { width: 16px; height: 16px; }
.side .theme-btn { width: 100%; margin-bottom: 10px; justify-content: center; }
.topbar .theme-btn { padding: 6px; border: 0; }
.main { min-width: 0; padding: 22px 28px 60px; max-width: 1280px; }
.topbar { display: none; }
.bottomnav { display: none; }

.head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; margin-bottom: 18px; }
.head h1 { font-size: 24px; line-height: 1.2; margin: 0; letter-spacing: -.02em; }
.head .sub { color: var(--ink-2); font-size: 14px; }
.head .actions { margin-left: auto; display: flex; flex-wrap: wrap; gap: 8px; }
.back { display: inline-flex; align-items: center; gap: 4px; color: var(--ink-2); text-decoration: none; font-size: 14px; margin-bottom: 6px; }
.back:hover { color: var(--ink); }

/* ---------- элементы ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 38px; padding: 0 14px; border-radius: 10px; border: 1.5px solid var(--line-2); background: var(--surface); cursor: pointer; font-weight: 600; white-space: nowrap; text-decoration: none; }
.btn:hover { border-color: var(--ink-3); }
.btn.primary { background: var(--ink); border-color: var(--ink); color: var(--surface); }
.btn.accent { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.in { color: var(--in); border-color: color-mix(in srgb, var(--in) 40%, var(--line-2)); }
.btn.out { color: var(--out); border-color: color-mix(in srgb, var(--out) 40%, var(--line-2)); }
.btn.tr { color: var(--tr); border-color: color-mix(in srgb, var(--tr) 40%, var(--line-2)); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.danger { color: var(--out); }
.btn.small { height: 32px; padding: 0 10px; font-size: 14px; border-radius: 8px; }
.btn:disabled { opacity: .55; cursor: default; }
.link { background: none; border: 0; padding: 0; color: var(--accent); cursor: pointer; font-weight: 600; text-decoration: none; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card.pad { padding: 16px 18px; }
.card h2 { font-size: 16px; margin: 0 0 12px; letter-spacing: -.01em; }
.card h2 small { font-weight: 400; color: var(--ink-3); font-size: 13px; margin-left: 6px; }
.muted { color: var(--ink-2); }
.faint { color: var(--ink-3); }
.small { font-size: 13px; }
.hint { color: var(--ink-2); font-size: 13px; margin: 6px 0 0; }
.empty { padding: 34px 16px; text-align: center; color: var(--ink-3); }
.empty b { display: block; color: var(--ink-2); font-size: 15px; margin-bottom: 4px; }
.grid { display: grid; gap: 14px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g21 { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.spacer { flex: 1; }
.pos { color: var(--in); }
.neg { color: var(--out); }
.tag { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--surface-2); color: var(--ink-2); white-space: nowrap; }
.tag.in { background: var(--in-bg); color: var(--in); }
.tag.out { background: var(--out-bg); color: var(--out); }
.tag.transfer, .tag.move { background: var(--tr-bg); color: var(--tr); }
.tag.warn, .tag.adjust { background: var(--warn-bg); color: var(--warn); }
.tag.work { background: var(--in-bg); color: var(--in); }
.tag.plan { background: var(--tr-bg); color: var(--tr); }
.tag.paused { background: var(--warn-bg); color: var(--warn); }
.tag.claude { background: var(--accent-2); color: var(--accent); }

/* ---------- KPI ---------- */
.kpi { padding: 14px 16px; }
.kpi .label { color: var(--ink-2); font-size: 13px; font-weight: 500; }
.kpi .value { font-size: 24px; font-weight: 700; letter-spacing: -.02em; margin-top: 2px; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi .note { color: var(--ink-3); font-size: 12px; margin-top: 2px; }
.kpi.hl { background: var(--ink); border-color: var(--ink); color: var(--surface); }
.kpi.hl .label, .kpi.hl .note { color: color-mix(in srgb, var(--surface) 70%, transparent); }

/* ---------- таблицы ---------- */
.tablewrap { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; }
.t th { text-align: left; font-size: 12px; font-weight: 600; color: var(--ink-3); text-transform: uppercase; letter-spacing: .03em; padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; background: var(--surface); position: sticky; top: 0; }
.t td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.t tr:last-child td { border-bottom: 0; }
.t tbody tr.click { cursor: pointer; }
.t tbody tr.click:hover td { background: var(--surface-2); }
.t .r { text-align: right; white-space: nowrap; }
.t .nowrap { white-space: nowrap; }
.t td .sub { display: block; color: var(--ink-3); font-size: 13px; margin-top: 1px; }
.t tfoot td { font-weight: 700; border-top: 1px solid var(--line-2); border-bottom: 0; }
.only-m { display: none !important; }
.t tr.low td:first-child { box-shadow: inset 3px 0 0 var(--warn); }

/* ---------- фильтры ---------- */
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 12px; border-bottom: 1px solid var(--line); }
.filters select, .filters input { height: 36px; border: 1.5px solid var(--line); border-radius: 9px; background: var(--surface); padding: 0 10px; min-width: 0; max-width: 220px; }
.filters input[type=search] { min-width: 180px; }
.filters input[type=date] { max-width: 160px; }
.seg { display: inline-flex; background: var(--surface-2); border-radius: 10px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg button { border: 0; background: transparent; padding: 6px 11px; border-radius: 8px; cursor: pointer; font-weight: 600; font-size: 14px; color: var(--ink-2); white-space: nowrap; }
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.totals { display: flex; flex-wrap: wrap; gap: 6px 20px; padding: 10px 14px; border-bottom: 1px solid var(--line); font-size: 14px; color: var(--ink-2); }
.totals b { color: var(--ink); font-variant-numeric: tabular-nums; }

.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; }
.tabs a { padding: 10px 14px; text-decoration: none; color: var(--ink-2); font-weight: 600; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs a.on { color: var(--ink); border-color: var(--accent); }

/* ---------- графики ---------- */
.bars { display: grid; grid-template-columns: repeat(12, 1fr); gap: 6px; align-items: end; height: 170px; padding-top: 8px; }
.bars .m { display: flex; flex-direction: column; align-items: center; gap: 4px; height: 100%; justify-content: flex-end; min-width: 0; }
.bars .pair { display: flex; gap: 2px; align-items: flex-end; height: 100%; width: 100%; justify-content: center; }
.bars .b { width: 42%; max-width: 16px; border-radius: 4px 4px 0 0; min-height: 2px; }
.bars .b.i { background: var(--in); }
.bars .b.o { background: var(--out); opacity: .85; }
.bars .lbl { font-size: 11px; color: var(--ink-3); }
.legend { display: flex; gap: 14px; font-size: 13px; color: var(--ink-2); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
.hbar { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 12px; align-items: center; margin-bottom: 10px; font-size: 14px; }
.hbar .track { grid-column: 1 / -1; height: 6px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.hbar .fill { height: 100%; background: var(--accent); border-radius: 99px; }
.hbar .fill.i { background: var(--in); }
.progress { height: 8px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.progress > div { height: 100%; background: var(--in); border-radius: 99px; }
.progress > div.over { background: var(--out); }
.progress > div.mid { background: var(--warn); }

/* ---------- счета ---------- */
.acc { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.acc:last-child { border-bottom: 0; }
.acc .ic { width: 32px; height: 32px; border-radius: 9px; background: var(--surface-2); display: grid; place-items: center; flex: none; }
.acc .ic svg { width: 17px; height: 17px; color: var(--ink-2); }
.acc .nm { flex: 1; min-width: 0; }
.acc .nm .sub { color: var(--ink-3); font-size: 12px; }
.acc .bal { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ---------- объекты ---------- */
.objs { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.obj { padding: 16px; text-decoration: none; display: flex; flex-direction: column; gap: 10px; transition: border-color .15s; }
.obj:hover { border-color: var(--ink-3); }
.obj .t1 { display: flex; gap: 8px; align-items: flex-start; }
.obj .t1 b { font-size: 16px; flex: 1; line-height: 1.3; }
.obj .addr { color: var(--ink-3); font-size: 13px; margin-top: -6px; }
.obj .nums { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 14px; font-size: 13px; }
.obj .nums span { color: var(--ink-2); }
.obj .nums b { display: block; font-size: 15px; font-variant-numeric: tabular-nums; }
.obj .pl { display: flex; justify-content: space-between; font-size: 12px; color: var(--ink-3); margin-bottom: 4px; }

/* ---------- формы ---------- */
.form { display: grid; gap: 12px; }
.form .two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form .three { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
.field { display: grid; gap: 4px; min-width: 0; }
.field > span { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.field input, .field select, .field textarea { width: 100%; height: 40px; border: 1.5px solid var(--line-2); border-radius: 10px; background: var(--surface); padding: 0 11px; min-width: 0; }
.field textarea { height: auto; min-height: 70px; padding: 9px 11px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus, .filters input:focus, .filters select:focus, .lines input:focus { outline: 2px solid color-mix(in srgb, var(--accent) 45%, transparent); outline-offset: 0; border-color: var(--accent); }
.field input.amount { font-size: 22px; font-weight: 700; height: 50px; font-variant-numeric: tabular-nums; }
.check { display: flex; align-items: center; gap: 8px; font-weight: 500; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }
.err { background: var(--out-bg); color: var(--out); padding: 10px 12px; border-radius: 10px; font-size: 14px; font-weight: 500; }
.okbox { background: var(--in-bg); color: var(--in); padding: 10px 12px; border-radius: 10px; font-size: 14px; }
.kindseg { display: grid; grid-template-columns: repeat(3, 1fr); background: var(--surface-2); border-radius: 11px; padding: 3px; gap: 3px; }
.kindseg button { border: 0; background: transparent; padding: 8px 6px; border-radius: 9px; font-weight: 700; cursor: pointer; color: var(--ink-2); }
.kindseg button.on.in { background: var(--surface); color: var(--in); box-shadow: var(--shadow); }
.kindseg button.on.out { background: var(--surface); color: var(--out); box-shadow: var(--shadow); }
.kindseg button.on.transfer { background: var(--surface); color: var(--tr); box-shadow: var(--shadow); }

/* строки документа ТМЦ */
.lines { display: grid; gap: 6px; }
.lines .ln { display: grid; grid-template-columns: minmax(0, 1fr) 70px 96px 110px 34px; gap: 6px; align-items: center; }
.lines.noprice .ln { grid-template-columns: minmax(0, 1fr) 70px 110px 34px; }
.lines .ln.hd { font-size: 12px; color: var(--ink-3); font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
.lines input { height: 38px; border: 1.5px solid var(--line-2); border-radius: 9px; background: var(--surface); padding: 0 9px; width: 100%; min-width: 0; }
.lines .unit { font-size: 13px; color: var(--ink-3); text-align: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lines .sum { text-align: right; font-variant-numeric: tabular-nums; font-size: 14px; }
.lines .have { font-size: 12px; color: var(--ink-3); grid-column: 1 / -1; margin-top: -4px; }
.lines .x { width: 34px; height: 34px; border: 0; background: transparent; border-radius: 8px; cursor: pointer; color: var(--ink-3); font-size: 18px; }
.lines .x:hover { background: var(--out-bg); color: var(--out); }

/* ---------- окно ---------- */
.overlay { position: fixed; inset: 0; background: rgba(15, 17, 19, .45); display: flex; align-items: flex-start; justify-content: center; padding: 6vh 16px 16px; z-index: 50; overflow-y: auto; animation: fade .12s ease; }
.modal { background: var(--surface); border-radius: 16px; width: 100%; max-width: 560px; box-shadow: 0 20px 60px rgba(0, 0, 0, .25); animation: pop .14s ease; }
.modal.wide { max-width: 820px; }
.modal header { display: flex; align-items: center; gap: 10px; padding: 16px 18px 0; }
.modal header h3 { margin: 0; font-size: 18px; letter-spacing: -.01em; flex: 1; }
.modal .body { padding: 16px 18px; }
.modal footer { display: flex; gap: 8px; padding: 0 18px 18px; flex-wrap: wrap; }
.modal footer .left { margin-right: auto; }
.xbtn { width: 34px; height: 34px; border-radius: 9px; border: 0; background: transparent; cursor: pointer; font-size: 22px; color: var(--ink-3); line-height: 1; }
.xbtn:hover { background: var(--surface-2); }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { transform: translateY(8px) scale(.99); opacity: 0; } }

#toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(20px); background: var(--ink); color: var(--surface); padding: 10px 16px; border-radius: 10px; font-weight: 600; opacity: 0; pointer-events: none; transition: .2s; z-index: 60; max-width: calc(100vw - 32px); }
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast.bad { background: var(--out); color: #fff; }

/* ---------- вход ---------- */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: radial-gradient(1200px 500px at 10% -10%, var(--accent-2), transparent), var(--bg); }
.auth .card { width: 100%; max-width: 400px; padding: 28px; }
.auth .logo { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; }
.auth .logo img { width: 44px; height: 44px; }
.auth h1 { font-size: 22px; margin: 0; }
.auth p { color: var(--ink-2); margin: 2px 0 0; font-size: 14px; }

.code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; background: var(--surface-2); padding: 10px 12px; border-radius: 9px; word-break: break-all; user-select: all; }
.list-plain { list-style: none; margin: 0; padding: 0; }
.list-plain li { padding: 9px 0; border-bottom: 1px solid var(--line); display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.list-plain li:last-child { border-bottom: 0; }

/* ---------- телефон ---------- */
@media (max-width: 1000px) {
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g3, .g21 { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .shell { grid-template-columns: 1fr; }
  .side { display: none; }
  .main { padding: 14px 16px 92px; }
  .topbar { display: flex; align-items: center; gap: 10px; padding: 10px 16px; background: var(--side); color: #fff; position: sticky; top: 0; z-index: 20; }
  .topbar img { width: 26px; height: 26px; }
  .topbar b { flex: 1; font-size: 15px; }
  .topbar a { color: var(--side-ink); text-decoration: none; font-size: 14px; }
  .bottomnav { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; background: var(--surface); border-top: 1px solid var(--line); padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); z-index: 20; }
  .bottomnav a { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 11px; font-weight: 600; color: var(--ink-3); text-decoration: none; padding: 4px 0; }
  .bottomnav a.on { color: var(--accent); }
  .bottomnav svg { width: 22px; height: 22px; }
  .g2 { grid-template-columns: 1fr; }
  .head h1 { font-size: 21px; }
  .head .actions { margin-left: 0; width: 100%; }
  .kpi .value { font-size: 20px; }
  .form .two, .form .three { grid-template-columns: 1fr; }
  .filters select, .filters input, .filters input[type=search] { max-width: none; flex: 1 1 140px; }
  .overlay { padding: 0; align-items: flex-end; }
  .modal { border-radius: 16px 16px 0 0; max-height: 94vh; overflow-y: auto; }
  .lines .ln, .lines.noprice .ln { grid-template-columns: 1fr 1fr 34px; }
  .lines .ln > :first-child { grid-column: 1 / -1; }
  .lines .ln .unit { display: none; }
  .lines .ln.hd { display: none; }
  .only-m { display: block !important; }
  .btn.only-m { display: inline-flex !important; }
  .hide-mobile { display: none !important; }
  .mfold { display: none; }
  .mfold.open { display: flex; }
  .seg { flex-wrap: nowrap; overflow-x: auto; max-width: 100%; flex: 1 1 100%; min-width: 0; }
  .seg button { flex: none; }
  .filters input[type=date] { flex: 1 1 120px; }
  .t.stack thead { display: none; }
  .t.stack tr { display: grid; grid-template-columns: 1fr auto; padding: 10px 12px; border-bottom: 1px solid var(--line); gap: 2px 10px; }
  .t.stack td { padding: 0; border: 0; }
  .t.stack td.hide-m { display: none; }
  .t.stack td.r { grid-column: 2; grid-row: 1 / span 2; align-self: center; }
  .t.stack tfoot tr { border-bottom: 0; }
  .bars .lbl { font-size: 9px; }
}
@media print {
  .side, .bottomnav, .topbar, .head .actions, .filters, .btn { display: none !important; }
  .shell { display: block; }
  .main { padding: 0; }
  .card { box-shadow: none; }
}

/* ---------- новые разделы ---------- */
.nav { overflow-y: auto; flex: 1; }
.nav a span { flex: 1; }
.nbadge { background: var(--out); color: #fff; font-size: 11px; font-weight: 700; border-radius: 99px; padding: 1px 6px; min-width: 18px; text-align: center; }
.bottomnav a { position: relative; }
.bottomnav .nbadge { position: absolute; top: 0; right: calc(50% - 20px); }
.bottomnav { grid-template-columns: repeat(5, 1fr) !important; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; vertical-align: 0; flex: none; }
.dot.ok { background: var(--in); box-shadow: 0 0 0 3px var(--in-bg); }
.dot.missing { background: var(--out); box-shadow: 0 0 0 3px var(--out-bg); }
.dot.not_needed { background: var(--ink-3); opacity: .5; }
.alerts { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.alert { display: inline-flex; align-items: center; gap: 8px; padding: 9px 12px; border-radius: 10px; background: var(--surface); border: 1px solid var(--line); text-decoration: none; font-size: 14px; }
.alert svg { width: 17px; height: 17px; color: var(--ink-2); }
.alert.bad { background: var(--out-bg); border-color: transparent; color: var(--out); }
.alert.bad svg { color: var(--out); }
.alert.warn { background: var(--warn-bg); border-color: transparent; color: var(--warn); }
.alert.warn svg { color: var(--warn); }
select.mini, input.mini { height: 32px; border: 1.5px solid var(--line); border-radius: 8px; background: var(--surface); padding: 0 6px; max-width: 180px; font-size: 13px; }
input.num-in { width: 84px; text-align: right; }
.tel { white-space: nowrap; font-weight: 600; text-decoration: none; color: var(--tr); }
code { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 13px; background: var(--surface-2); padding: 1px 5px; border-radius: 5px; }

/* файлы */
.files { border: 1.5px dashed var(--line-2); border-radius: 12px; padding: 12px; }
.files-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.thumbs { display: flex; flex-wrap: wrap; gap: 8px; }
.thumb { position: relative; width: 92px; height: 92px; border-radius: 10px; overflow: hidden; background: var(--surface-2); border: 1px solid var(--line); }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb .fileic { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; width: 100%; height: 100%; text-decoration: none; padding: 6px; text-align: center; font-size: 11px; color: var(--ink-2); word-break: break-all; }
.thumb .fileic svg { width: 28px; height: 28px; }
.thumb .fileic span { overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.thumb .tx { position: absolute; top: 4px; right: 4px; width: 24px; height: 24px; border-radius: 50%; border: 0; background: rgba(0,0,0,.55); color: #fff; cursor: pointer; font-size: 15px; line-height: 1; }
.thumb .pg { position: absolute; left: 4px; bottom: 4px; background: rgba(0,0,0,.6); color: #fff; font-size: 11px; font-weight: 700; padding: 1px 6px; border-radius: 6px; }
.newdoc .check { gap: 10px; }
.scanbox { display: grid; gap: 10px; padding: 12px; border-radius: 12px; background: var(--surface-2); }
.scanbox .thumb { width: 84px; height: 110px; }

/* задачи */
.tgroup { margin-bottom: 16px; }
.tgh { font-weight: 700; font-size: 14px; margin: 0 0 6px 4px; color: var(--ink-2); }
.tasks { overflow: hidden; }
.task { display: flex; gap: 12px; padding: 11px 14px; border-bottom: 1px solid var(--line); cursor: pointer; align-items: flex-start; }
.task:last-child { border-bottom: 0; }
.task:hover { background: var(--surface-2); }
.tcheck { width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--line-2); background: var(--surface); flex: none; cursor: pointer; color: #fff; font-weight: 800; font-size: 13px; line-height: 1; margin-top: 1px; }
.tcheck:hover { border-color: var(--in); }
.task.done .tcheck { background: var(--in); border-color: var(--in); }
.task.done .ttitle { text-decoration: line-through; color: var(--ink-3); }
.task.overdue .tcheck { border-color: var(--out); }
.tbody { flex: 1; min-width: 0; }
.ttitle { font-weight: 600; }
.tmeta { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 13px; color: var(--ink-3); margin-top: 3px; }
.tmeta span { display: inline-flex; align-items: center; gap: 4px; }
.tmeta svg { width: 14px; height: 14px; }
.quickadd { display: flex; gap: 8px; padding: 8px; margin-bottom: 12px; }
.quickadd input { flex: 1; border: 0; background: transparent; padding: 0 8px; height: 36px; outline: none; }
.clitem { display: flex; align-items: center; gap: 8px; padding: 4px 0; }
.clitem input { width: 18px; height: 18px; accent-color: var(--in); }
.clitem span { flex: 1; outline: none; }
.clitem .x { width: 28px; height: 28px; border: 0; background: transparent; color: var(--ink-3); cursor: pointer; border-radius: 6px; }
.comments { display: grid; gap: 8px; margin: 6px 0 8px; }
.cm { background: var(--surface-2); border-radius: 10px; padding: 8px 10px; font-size: 14px; }

/* контакты и документы */
.contacts { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.contact { padding: 14px 16px; display: grid; gap: 6px; }
.contact.click { cursor: pointer; }
.contact .cn { display: flex; gap: 8px; align-items: flex-start; justify-content: space-between; }
.contact .cn b { font-size: 15px; }
.contact .cn span.faint { display: block; }
.contact .cp { display: flex; flex-wrap: wrap; gap: 4px 14px; }
.contact .cnote { color: var(--ink-2); white-space: pre-wrap; border-top: 1px solid var(--line); padding-top: 6px; }
.docs-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.docc { display: flex; flex-direction: column; overflow: hidden; text-decoration: none; }
.docc .cover { height: 150px; background: var(--surface-2); display: grid; place-items: center; overflow: hidden; }
.docc .cover img { width: 100%; height: 100%; object-fit: cover; object-position: top; }
.docc .cover svg { width: 40px; height: 40px; color: var(--ink-3); }
.docc .dinfo { padding: 10px 12px; display: grid; gap: 3px; }
.docc .dinfo .tag { justify-self: start; }
.menu-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.menu-item { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; padding: 16px; text-decoration: none; font-weight: 600; }
.menu-item svg { width: 26px; height: 26px; color: var(--accent); }
.dl { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; margin: 0 0 12px; font-size: 14px; }
.dl dt { color: var(--ink-3); }
.dl dd { margin: 0; }

/* отчёты и права */
.t.pnl td, .t.pnl th { white-space: nowrap; font-size: 13px; padding: 8px 10px; }
.t.pnl td:first-child { position: sticky; left: 0; background: var(--surface); min-width: 200px; white-space: normal; }
.t.pnl tr.grp td { font-weight: 700; background: var(--surface-2); text-transform: uppercase; font-size: 12px; letter-spacing: .03em; color: var(--ink-2); }
.t.pnl tr.sum td { font-weight: 700; border-top: 1px solid var(--line-2); }
.t.pnl tr.big td { font-size: 15px; background: var(--surface-2); }
.t.perm-edit td, .t.perm-edit th { padding: 6px 10px; }
.t .c { text-align: center; }
.perm-edit input { width: 18px; height: 18px; accent-color: var(--accent); }
.t.bank td { font-size: 13px; }
.lines.withsize .ln { grid-template-columns: minmax(0, 1fr) 64px 60px 70px 90px 34px; }
.lines.ww .ln { grid-template-columns: minmax(0, 1fr) 120px 120px 34px; }
.lines.ww .unit { display: none; }
.lines.tl .ln { grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr) minmax(0, 1fr) 90px 34px; }
.lines .tt { display: grid; gap: 6px; min-width: 0; }
.ac-box { position: fixed; z-index: 1000; background: var(--surface); color: var(--ink); border: 1px solid var(--line-2); border-radius: 10px; box-shadow: 0 8px 24px rgba(0, 0, 0, .18); overflow-y: auto; padding: 4px; }
.ac-it { padding: 8px 10px; border-radius: 7px; cursor: pointer; font-size: 14px; }
.ac-it small { display: block; color: var(--ink-3); font-size: 12px; }
.ac-it:hover, .ac-it.on { background: var(--accent-2); }
.lines select { height: 38px; border: 1.5px solid var(--line-2); border-radius: 9px; background: var(--surface); padding: 0 6px; width: 100%; min-width: 0; }
.kpi[href] { text-decoration: none; }
.side .brand { display: block; width: 50%; background: #fff; border-radius: 8px; padding: 5px 7px; margin: 0 auto 14px; }
.side .brand img { width: 100%; height: auto; display: block; }
.topbar img.tb-ico { width: 30px; height: 30px; border-radius: 7px; background: #fff; }
.auth .logo { display: block; text-align: center; }
.auth .logo img { width: 230px; height: auto; display: block; margin: 0 auto 8px; }
.auth .logo p { text-align: center; }
.helpq { width: 38px; padding: 0; font-size: 17px; font-weight: 800; color: var(--ink-2); border-color: var(--line-2) !important; }
.head > .helpq { margin-left: auto; }
.help { margin-bottom: 12px; }
.help h2 { display: flex; align-items: center; gap: 10px; }
.help h2 svg { width: 22px; height: 22px; color: var(--accent); }
.help ol { margin: 0; padding-left: 22px; display: grid; gap: 10px; line-height: 1.55; }
.help li b { color: var(--ink); }

@media (max-width: 760px) {
  .lines.withsize .ln { grid-template-columns: 1fr 1fr 34px; }
  .lines.withsize .ln input[data-k=size] { grid-column: 1 / -1; }
  .lines.noprice:not(.ww) .ln { grid-template-columns: 70px 1fr 34px; }
  .lines.noprice:not(.ww) .ln .unit { display: block; }
  .lines.ww .ln, .lines.tl .ln { grid-template-columns: 1fr 1fr 34px; }
  .lines.tl .ln > .tt { grid-column: 1 / -1; }
  .lines.tl .ln > [data-k=qty] { grid-column: 1 / 3; }
  .lines.ww .ln > [data-k=wwtype] { grid-column: 1 / -1; }
  .lines.ww .ln input[data-k=size] { grid-column: auto; }
  .contacts, .docs-grid { grid-template-columns: 1fr; }
  .docs-grid { grid-template-columns: repeat(2, 1fr); }
  .docc .cover { height: 120px; }
  .thumb { width: 78px; height: 78px; }
  .alert { width: 100%; }
}
a.acc, a.hbar, a.alert { text-decoration: none; color: inherit; }
.nav a .nbadge { flex: none; }
.g21 { align-items: start; }
.list-plain a, .contact a, .addr a { text-decoration: none; color: var(--tr); }
