:root {
  --bg: #f5f3ef;
  --surface: #ffffff;
  --surface-2: #faf8f5;
  --sunk: #efece6;
  --ink: #1b1a17;
  --ink-2: #4d4a44;
  --muted: #86827a;
  --line: #e4e0d8;
  --line-2: #d4cfc5;
  --accent: #a34a17;
  --accent-ink: #ffffff;
  --accent-wash: #f6e8de;
  --accent-line: #e7c6ae;
  --red: #c0342b;   --red-wash: #fbe6e3;
  --amber: #b57204; --amber-wash: #fbefd6;
  --green: #2f7d32; --green-wash: #e3f1e2;
  --blue: #2c5fb3;  --blue-wash: #e4ecf8;
  --shadow: 0 1px 2px rgba(40, 30, 20, .05), 0 4px 16px rgba(40, 30, 20, .04);
  --radius: 12px;
  --font: "Onest", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #141311; --surface: #1c1b18; --surface-2: #211f1c; --sunk: #191815; --ink: #f1eee8; --ink-2: #c4bfb5; --muted: #8d887e;
    --line: #2e2b27; --line-2: #3d3a34; --accent: #e08a4f; --accent-ink: #1b0d03; --accent-wash: #3a2416; --accent-line: #6b3f22;
    --red: #f07a70; --red-wash: #3d1d1a; --amber: #e5a93a; --amber-wash: #3a2c12; --green: #6cc070; --green-wash: #1b3019; --blue: #7aa5ec; --blue-wash: #1b2638;
    --shadow: none; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #141311; --surface: #1c1b18; --surface-2: #211f1c; --sunk: #191815; --ink: #f1eee8; --ink-2: #c4bfb5; --muted: #8d887e;
  --line: #2e2b27; --line-2: #3d3a34; --accent: #e08a4f; --accent-ink: #1b0d03; --accent-wash: #3a2416; --accent-line: #6b3f22;
  --red: #f07a70; --red-wash: #3d1d1a; --amber: #e5a93a; --amber-wash: #3a2c12; --green: #6cc070; --green-wash: #1b3019; --blue: #7aa5ec; --blue-wash: #1b2638;
  --shadow: none; color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 14px/1.45 var(--font); font-feature-settings: "tnum" 1; }
[hidden] { display: none !important; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
svg { fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.muted { color: var(--muted); }
h1 { font-size: 24px; font-weight: 650; letter-spacing: -.01em; margin: 0 0 4px; }

/* ---------- верхняя панель ---------- */
.top { position: sticky; top: 0; z-index: 30; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.top-in { max-width: 1600px; margin: 0 auto; padding: 10px 20px; display: flex; align-items: center; gap: 12px 28px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); }
.logo { width: 32px; height: 32px; border-radius: 9px; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; font-weight: 700; font-size: 17px; }
.brand-txt { display: flex; flex-direction: column; line-height: 1.15; }
.brand-txt b { font-size: 15px; letter-spacing: .04em; }
.brand-txt span { font-size: 12px; color: var(--muted); }
.nav { display: flex; gap: 2px; }
.nav a { text-decoration: none; color: var(--ink-2); padding: 7px 14px; border-radius: 8px; font-weight: 500; }
.nav a:hover { background: var(--sunk); color: var(--ink); }
.nav a[aria-current="page"] { background: var(--ink); color: var(--bg); }
.top-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.supplier { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); }
.supplier select { border: 1px solid var(--line-2); background: var(--surface); border-radius: 8px; padding: 5px 8px; font-weight: 600; color: var(--ink); font-size: 13px; }
.usermenu { position: relative; }
#user-btn { display: flex; align-items: center; gap: 8px; border: 1px solid var(--line-2); background: var(--surface); border-radius: 9px; padding: 4px 10px 4px 8px; text-align: left; }
#user-btn:hover { border-color: var(--ink-2); }
#user-btn svg { width: 18px; height: 18px; color: var(--muted); flex: none; }
#user-btn span { display: flex; flex-direction: column; line-height: 1.15; }
#user-btn b { font-size: 13px; font-weight: 600; max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#user-btn small { font-size: 11px; color: var(--muted); }
.menu { position: absolute; right: 0; top: calc(100% + 6px); background: var(--surface); border: 1px solid var(--line-2); border-radius: 10px; box-shadow: 0 8px 30px rgba(0,0,0,.12); padding: 4px; min-width: 170px; display: flex; flex-direction: column; z-index: 40; }
.menu button { border: 0; background: none; text-align: left; padding: 8px 10px; border-radius: 7px; }
.menu button:hover { background: var(--sunk); }
@media (max-width: 760px) {
  .top-in { padding: 8px 16px; gap: 8px 12px; }
  .nav { order: 3; width: 100%; }
  .nav a { flex: 1; text-align: center; }
  .brand-txt span { display: none; }
  #user-btn small { display: none; }
  #user-btn b { max-width: 110px; }
}

.wrap { max-width: 1600px; margin: 0 auto; padding: 16px 20px 64px; }
@media (max-width: 760px) { .wrap { padding: 12px 16px 48px; } }

/* ---------- общие элементы ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--surface); padding: 9px 16px; font-weight: 600; white-space: nowrap; }
a.btn { text-decoration: none; color: var(--ink); }
a.btn.primary { color: var(--accent-ink); }
.btn svg { width: 18px; height: 18px; }
.btn:hover { border-color: var(--ink-2); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.07); }
.btn.primary:disabled { opacity: .45; cursor: not-allowed; filter: none; }
.btn.ghost { background: transparent; }
.btn.sm { padding: 5px 10px; font-size: 13px; border-radius: 8px; font-weight: 500; }
.link { border: 0; background: none; padding: 0; color: var(--accent); font-weight: 500; text-decoration: underline; text-underline-offset: 3px; }

.seg { display: inline-grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 2px; background: var(--sunk); border: 1px solid var(--line); border-radius: 10px; padding: 3px; }
.seg-2, .seg-3 { display: grid; width: 100%; }
.seg-auto { grid-auto-columns: auto; }
.seg button { border: 0; background: transparent; padding: 6px 10px; border-radius: 7px; color: var(--ink-2); font-weight: 500; font-size: 13px; white-space: nowrap; }
.seg button:hover { color: var(--ink); }
.seg button[aria-checked="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.08), 0 0 0 1px var(--line); font-weight: 600; }
.seg button .cnt { color: var(--muted); font-weight: 500; margin-left: 4px; }

.field { display: flex; flex-direction: column; gap: 5px; font-size: 12px; color: var(--ink-2); font-weight: 500; }
.field input, .field select { border: 1px solid var(--line-2); background: var(--surface); border-radius: 9px; padding: 8px 10px; font-size: 14px; color: var(--ink); width: 100%; min-width: 0; }
.field input:focus, .field select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-wash); }
.inp-unit { position: relative; display: block; }
.inp-unit input { padding-right: 46px; }
.inp-unit i { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); font-style: normal; color: var(--muted); font-size: 12px; pointer-events: none; }
.field.sm input, .field.sm select { padding: 6px 9px; font-size: 13px; }

/* ---------- филиалы ---------- */
.branchbar { display: flex; align-items: center; gap: 12px 20px; flex-wrap: wrap; margin-bottom: 14px; }
.branches { display: flex; gap: 6px; flex-wrap: wrap; }
.branches button { border: 1px solid var(--line-2); background: var(--surface); border-radius: 999px; padding: 7px 16px 7px 12px; font-weight: 600; display: inline-flex; align-items: center; gap: 8px; color: var(--ink-2); }
.branches button:hover { border-color: var(--ink-2); color: var(--ink); }
.branches button[aria-selected="true"] { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--line-2); flex: none; }
.dot.ok { background: var(--green); } .dot.old { background: var(--amber); } .dot.no { background: var(--red); }
.filemeta { font-size: 12px; color: var(--muted); display: flex; gap: 6px 16px; flex-wrap: wrap; }
.filemeta b { color: var(--ink-2); font-weight: 500; }
.filemeta .warn { color: var(--amber); font-weight: 500; }

.empty { background: var(--surface); border: 1px dashed var(--line-2); border-radius: var(--radius); padding: 40px 24px; text-align: center; color: var(--ink-2); }
.empty h2 { font-size: 18px; margin: 0 0 6px; color: var(--ink); }
.empty .btn { margin-top: 14px; }

/* ---------- раскладка заявки ---------- */
.order { display: grid; grid-template-columns: 270px minmax(0, 1fr); gap: 16px; align-items: start; }
@media (max-width: 1080px) { .order { grid-template-columns: minmax(0, 1fr); } }
.panel { position: sticky; top: 70px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); max-height: calc(100vh - 86px); overflow: auto; }
@media (max-width: 1080px) { .panel { position: static; max-height: none; } }
.panel-in { padding: 16px; display: flex; flex-direction: column; gap: 16px; }
.pgroup { display: flex; flex-direction: column; gap: 8px; }
.pgroup.two, .pgroup .two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.glabel { font-size: 12px; color: var(--ink-2); font-weight: 500; }
.hint { margin: 0; font-size: 12px; color: var(--muted); line-height: 1.4; }
.quick { display: flex; flex-wrap: wrap; gap: 4px; }
.quick button { border: 1px solid var(--line); background: var(--surface-2); border-radius: 7px; padding: 3px 9px; font-size: 12px; color: var(--ink-2); }
.quick button:hover { border-color: var(--line-2); color: var(--ink); }
.quick button.on { background: var(--accent-wash); border-color: var(--accent-line); color: var(--accent); font-weight: 600; }
.toggles { display: flex; gap: 8px; }
.tg { display: flex; border: 1px solid var(--line-2); border-radius: 9px; overflow: hidden; flex: 1; }
.tg button { flex: 1; border: 0; border-right: 1px solid var(--line); background: var(--surface); padding: 6px 0; font-weight: 600; font-size: 13px; color: var(--muted); }
.tg button:last-child { border-right: 0; }
.tg button[aria-pressed="true"] { background: var(--accent-wash); color: var(--accent); }
.cats summary { cursor: pointer; list-style: none; display: flex; justify-content: space-between; align-items: baseline; }
.cats summary::-webkit-details-marker { display: none; }
.cats summary::after { content: "▾"; color: var(--muted); font-size: 12px; margin-left: 6px; }
.cats[open] summary::after { content: "▴"; }
.cats summary .muted { font-size: 12px; margin-left: auto; }
.catlist { display: flex; flex-wrap: wrap; gap: 4px; padding-top: 8px; }
.catlist button { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 3px 10px; font-size: 12px; color: var(--muted); }
.catlist button[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.formula { margin: 0; font-size: 11.5px; color: var(--muted); line-height: 1.5; border-top: 1px solid var(--line); padding-top: 12px; }

.main { min-width: 0; display: flex; flex-direction: column; gap: 12px; }

/* ---------- показатели ---------- */
.kpis { display: grid; grid-template-columns: 1.6fr repeat(3, 1fr); gap: 10px; }
@media (max-width: 760px) { .kpis { grid-template-columns: 1fr 1fr; } .kpi.big { grid-column: 1 / -1; } }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; box-shadow: var(--shadow); min-width: 0; }
.kpi .k { font-size: 12px; color: var(--muted); }
.kpi .v { font-size: 22px; font-weight: 650; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi.big .v { font-size: 28px; }
.kpi .s { font-size: 12px; color: var(--ink-2); margin-top: 2px; }
.meter { height: 6px; border-radius: 3px; background: var(--sunk); margin-top: 8px; overflow: hidden; }
.meter i { display: block; height: 100%; background: var(--accent); border-radius: 3px; }
.meter.over i { background: var(--red); }

.notes { display: flex; flex-direction: column; gap: 6px; }
.notes:empty { display: none; }
.note { border-radius: 10px; padding: 8px 12px; font-size: 13px; background: var(--amber-wash); color: var(--ink); border: 1px solid color-mix(in srgb, var(--amber) 30%, transparent); }
.note.info { background: var(--blue-wash); border-color: color-mix(in srgb, var(--blue) 25%, transparent); }
.note summary { cursor: pointer; }
.note ul { margin: 8px 0 0; padding-left: 18px; columns: 2; font-size: 12px; color: var(--ink-2); }
@media (max-width: 760px) { .note ul { columns: 1; } }

/* ---------- панель над таблицей ---------- */
.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.search { flex: 1 1 260px; display: flex; align-items: center; gap: 8px; background: var(--surface); border: 1px solid var(--line-2); border-radius: 10px; padding: 0 10px; }
.search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-wash); }
.search svg { width: 17px; height: 17px; color: var(--muted); flex: none; }
.search input { border: 0; background: transparent; outline: none; padding: 8px 0; width: 100%; }
@media (max-width: 760px) { .toolbar .seg { width: 100%; overflow-x: auto; } }

/* ---------- таблица ---------- */
.tablewrap { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow-x: auto; }
.grid { width: 100%; border-collapse: collapse; font-size: 13px; }
.grid th { position: sticky; top: 0; background: var(--surface-2); text-align: right; font-weight: 500; font-size: 12px; color: var(--muted); padding: 9px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; user-select: none; }
.grid th[data-sort] { cursor: pointer; }
.grid th[data-sort]:hover { color: var(--ink); }
.grid th.sorted { color: var(--ink); }
.grid th.sorted::after { content: " ↓"; }
.grid th.sorted.asc::after { content: " ↑"; }
.grid th.l, .grid td.l { text-align: left; }
.grid th.c, .grid td.c { text-align: center; }
.grid td { padding: 7px 8px; border-bottom: 1px solid var(--line); text-align: right; vertical-align: middle; white-space: nowrap; }
.grid tbody tr:last-child td { border-bottom: 0; }
.grid tbody tr:hover td { background: var(--surface-2); }
.grid tr.dim td { color: var(--muted); }
.grid tr.dim .pname { color: var(--ink-2); }
.grid td.prod { white-space: normal; min-width: 220px; text-align: left; }
.pname { font-weight: 500; color: var(--ink); line-height: 1.3; }
.pcode { font-size: 11.5px; color: var(--muted); margin-top: 2px; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.pcode select { border: 1px solid var(--line-2); border-radius: 6px; background: var(--surface); font-size: 11.5px; padding: 1px 4px; max-width: 230px; color: var(--ink-2); }
.badge { display: inline-block; font-size: 11px; font-weight: 600; padding: 1px 6px; border-radius: 5px; background: var(--sunk); color: var(--ink-2); }
.badge.A { background: var(--green-wash); color: var(--green); }
.badge.B { background: var(--blue-wash); color: var(--blue); }
.badge.C { background: var(--sunk); color: var(--muted); }
.xyz { font-size: 11px; color: var(--muted); margin-left: 2px; }
.st { font-size: 11px; font-weight: 500; padding: 1px 6px; border-radius: 5px; }
.st.manual { background: var(--blue-wash); color: var(--blue); }
.st.extra { background: var(--green-wash); color: var(--green); }
.st.hub { background: var(--red-wash); color: var(--red); }
.hubst { font-size: 11.5px; color: var(--muted); margin-top: 2px; white-space: nowrap; }
.hubst.low { color: var(--red); font-weight: 600; }
.check { display: flex; align-items: flex-start; gap: 8px; font-size: 13px; color: var(--ink-2); cursor: pointer; }
.check input { margin-top: 2px; accent-color: var(--accent); }
.st.partial, .st.cut { background: var(--amber-wash); color: var(--amber); }
.st.noprice, .st.nosku { background: var(--red-wash); color: var(--red); }

/* полоса запаса: сейчас → после поставки, засечка — цель */
.cov { min-width: 140px; }
.covbox { display: flex; align-items: center; gap: 8px; justify-content: flex-end; }
.covbar { position: relative; width: 64px; height: 8px; border-radius: 4px; background: var(--sunk); flex: none; }
.covbar .after { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 4px; background: var(--accent-line); }
.covbar .now { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 4px; }
.covbar .tgt { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--ink-2); border-radius: 1px; }
.now.r { background: var(--red); } .now.a { background: var(--amber); } .now.g { background: var(--green); }
.covtxt { min-width: 58px; text-align: right; }
.covtxt b { font-weight: 600; }
.covtxt b.r { color: var(--red); } .covtxt b.a { color: var(--amber); }
.covtxt span { color: var(--muted); }

.q { min-width: 140px; }
.qbox { display: inline-flex; align-items: center; gap: 6px; }
.qin { display: inline-flex; align-items: center; border: 1px solid var(--line-2); border-radius: 8px; background: var(--surface); overflow: hidden; }
.qin button { border: 0; background: transparent; width: 26px; height: 28px; color: var(--ink-2); font-size: 15px; line-height: 1; }
.qin button:hover { background: var(--sunk); color: var(--ink); }
.qin input { width: 44px; border: 0; border-left: 1px solid var(--line); border-right: 1px solid var(--line); text-align: center; padding: 4px 2px; background: transparent; font-weight: 600; -moz-appearance: textfield; }
.qin input::-webkit-inner-spin-button { -webkit-appearance: none; }
.qin input:focus { outline: none; background: var(--accent-wash); }
.qin.has { border-color: var(--accent-line); }
.qin.manual { border-color: var(--blue); }
.qsub { font-size: 11.5px; color: var(--muted); min-width: 44px; text-align: left; }
.qreset { border: 0; background: none; color: var(--blue); font-size: 13px; padding: 0 2px; }
.emptyrow { text-align: center; color: var(--muted); padding: 28px; margin: 0; }

/* ---------- отправка ---------- */
.submit { position: sticky; bottom: 12px; z-index: 5; background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--radius); box-shadow: 0 8px 30px rgba(40, 30, 20, .12); padding: 12px 14px; display: flex; gap: 12px 20px; align-items: flex-end; flex-wrap: wrap; }
.submit-fields { display: flex; gap: 10px; flex-wrap: wrap; flex: 1 1 520px; }
.submit-fields .field { width: 140px; }
.submit-fields .field.grow { flex: 1 1 160px; }
.submit-go { display: flex; align-items: center; gap: 14px; margin-left: auto; }
.submit-sum { text-align: right; font-size: 12px; color: var(--muted); }
.submit-sum b { display: block; font-size: 17px; color: var(--ink); font-weight: 650; }
@media (max-width: 760px) { .submit { position: static; } .submit-fields .field { width: calc(50% - 5px); } .submit-go { width: 100%; justify-content: space-between; } }

/* ---------- файлы ---------- */
.pagehead { margin: 6px 0 16px; max-width: 760px; }
.pagehead p { margin: 0; }
.drop { display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center; padding: 28px 16px; border: 2px dashed var(--line-2); border-radius: var(--radius); background: var(--surface); cursor: pointer; color: var(--ink-2); transition: border-color .15s, background .15s; }
.drop svg { width: 40px; height: 40px; color: var(--accent); stroke-width: 2; margin-bottom: 4px; }
.drop b { color: var(--ink); font-weight: 600; }
.drop span { font-size: 13px; color: var(--muted); }
.drop:hover, .drop.over { border-color: var(--accent); background: var(--accent-wash); }
.results { display: flex; flex-direction: column; gap: 4px; margin: 12px 0; }
.results:empty { margin: 0; }
.res { font-size: 13px; padding: 7px 12px; border-radius: 9px; display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.res.ok { background: var(--green-wash); } .res.same { background: var(--sunk); } .res.error { background: var(--red-wash); }
.res b { font-weight: 600; }
.filegrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 12px; margin-top: 16px; }
.fcard { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.fcard h3 { margin: 0; font-size: 16px; font-weight: 650; display: flex; align-items: center; gap: 8px; }
.fslot { border-top: 1px solid var(--line); padding-top: 10px; display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; align-items: center; }
.fslot .t { font-size: 12px; color: var(--muted); }
.fslot .n { font-weight: 500; overflow-wrap: anywhere; font-size: 13px; }
.fslot .d { font-size: 12px; color: var(--muted); }
.fslot .d.old { color: var(--amber); }
.fslot .d.none { color: var(--red); }
.fslot .acts { grid-row: 1 / span 3; grid-column: 2; display: flex; flex-direction: column; gap: 4px; align-items: stretch; }

/* ---------- история ---------- */
.hist td .btn { margin-left: 4px; }
.hist tr.open td { background: var(--surface-2); }
.hist .lines td { padding: 0; }
.hist .lines table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.hist .lines table td { padding: 5px 10px 5px 24px; border-bottom: 1px dashed var(--line); }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 10px 18px; border-radius: 10px; font-weight: 500; box-shadow: 0 8px 30px rgba(0,0,0,.2); z-index: 50; max-width: calc(100vw - 32px); }
.toast.err { background: var(--red); color: #fff; }

/* ---------- загрузка в карточку города ---------- */
.fcard.drop-target { position: relative; transition: border-color .15s, background .15s; }
.fcard.drop-target.over { border-color: var(--accent); background: var(--accent-wash); }
.fcard .dz { border: 1.5px dashed var(--line-2); border-radius: 10px; padding: 10px; text-align: center; font-size: 12.5px; color: var(--muted); cursor: pointer; background: var(--surface-2); }
.fcard .dz:hover { border-color: var(--accent); color: var(--ink-2); }
.fcard .dz b { color: var(--accent); font-weight: 600; }
.fcard .busy { opacity: .6; pointer-events: none; }

/* ---------- фильтры, админка ---------- */
.filters { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.filters .field { width: 200px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; }
.card h3 { margin: 0 0 12px; font-size: 16px; font-weight: 650; }
.newuser { margin-bottom: 14px; display: flex; flex-direction: column; gap: 12px; }
.nu-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
@media (max-width: 900px) { .nu-grid { grid-template-columns: 1fr 1fr; } }
.nu-branches { display: flex; flex-direction: column; gap: 6px; }
.checks { display: flex; flex-wrap: wrap; gap: 6px; }
.checks label { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line-2); border-radius: 8px; padding: 5px 10px; font-size: 13px; cursor: pointer; background: var(--surface); }
.checks label:has(input:checked) { background: var(--accent-wash); border-color: var(--accent-line); color: var(--accent); font-weight: 600; }
.checks input { accent-color: var(--accent); margin: 0; }
.users td, .audit td { white-space: normal; }
.users td.acts { white-space: nowrap; text-align: right; }
.users td.acts .btn { margin-left: 4px; }
.users tr.off td { color: var(--muted); }
.users .checks label { padding: 3px 8px; font-size: 12px; }
.role-pill { font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 6px; background: var(--sunk); }
.role-pill.admin { background: var(--accent-wash); color: var(--accent); }
.audit td { font-size: 12.5px; vertical-align: top; }
.audit td.when { white-space: nowrap; color: var(--ink-2); }
.audit .ev { font-size: 11.5px; font-weight: 600; padding: 1px 7px; border-radius: 5px; background: var(--sunk); white-space: nowrap; }
.ev.login, .ev.logout { background: var(--blue-wash); color: var(--blue); }
.ev.login_failed, .ev.upload_rejected { background: var(--red-wash); color: var(--red); }
.ev.order_create { background: var(--green-wash); color: var(--green); }
.ev.upload { background: var(--amber-wash); color: var(--amber); }
.ev.user_create, .ev.user_update, .ev.user_password, .ev.password { background: var(--accent-wash); color: var(--accent); }

.sys dl { display: grid; grid-template-columns: max-content 1fr; gap: 8px 20px; margin: 0 0 14px; font-size: 13.5px; }
.sys dt { color: var(--muted); }
.sys dd { margin: 0; overflow-wrap: anywhere; }
.dlg { border: 1px solid var(--line-2); border-radius: 14px; padding: 20px; background: var(--surface); color: var(--ink); width: min(380px, calc(100vw - 32px)); box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.dlg::backdrop { background: rgba(20, 15, 10, .35); }
.dlg form { display: flex; flex-direction: column; gap: 12px; }
.dlg h3 { margin: 0; font-size: 17px; }
.dlg-acts { display: flex; justify-content: flex-end; gap: 8px; }
.err { background: var(--red-wash); color: var(--red); border-radius: 9px; padding: 8px 12px; font-size: 13px; margin: 0; }

.disc { display: flex; align-items: center; justify-content: space-between; gap: 10px; border-top: 1px solid var(--line); padding-top: 10px; font-size: 13px; color: var(--ink-2); }
.disc .inp-unit { width: 92px; }
.disc input { border: 1px solid var(--line-2); background: var(--surface); border-radius: 8px; padding: 5px 30px 5px 8px; width: 100%; font-size: 13px; color: var(--ink); }
.fslot .d.none + .acts:empty { display: none; }
.note summary b { color: var(--accent); font-weight: 600; white-space: nowrap; }
.note[open] summary b { display: none; }
