/* Mine Stores — styles.css
   Concrete ground, slate ink, safety-yellow actions, red serial stamps.
   Barlow Condensed for signage headings, IBM Plex Sans for the interface,
   IBM Plex Mono for codes and document numbers. */

:root {
  --bg: #ECEEEA;
  --surface: #FFFFFF;
  --surface-2: #F5F6F3;
  --surface-3: #E7EAE5;
  --ink: #19201D;
  --ink-2: #424B48;
  --muted: #66706C;
  --line: #D7DBD5;
  --line-2: #BCC3BC;
  --accent: #F2B705;
  --accent-hover: #E0A800;
  --on-accent: #1A1705;
  --accent-soft: #FCF0C6;
  --link: #1B5AA0;
  --focus: #1B5AA0;
  --stamp: #BD2C24;
  --bar: #A87A12;
  --ok: #2A7A4A;
  --ok-bg: #E1F0E6;
  --warn: #A35F00;
  --warn-bg: #FBEACF;
  --bad: #BD2C24;
  --bad-bg: #F8DFDC;
  --info: #34589D;
  --info-bg: #E1E8F5;
  --stripe-dark: #1C1A10;
  --shadow: 0 1px 2px rgba(20, 28, 25, .06), 0 10px 28px rgba(20, 28, 25, .10);
  --f-display: "Barlow Condensed", "Arial Narrow", "Roboto Condensed", sans-serif;
  --f-body: "IBM Plex Sans", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  --f-mono: "IBM Plex Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0F1311; --surface: #171C1A; --surface-2: #1D2320; --surface-3: #252C29;
    --ink: #E5EAE7; --ink-2: #BAC3BF; --muted: #8C9793; --line: #2B3331; --line-2: #3B4542;
    --accent: #F2B705; --accent-hover: #FFC928; --on-accent: #1A1705; --accent-soft: #3A3112;
    --link: #86B4F0; --focus: #86B4F0; --stamp: #F06A5F; --bar: #D9A53A;
    --ok: #5CC08A; --ok-bg: #16301F; --warn: #F0A33A; --warn-bg: #33260E; --bad: #F06A5F; --bad-bg: #3A1A17;
    --info: #8EAEF0; --info-bg: #1A2640; --stripe-dark: #0B0C08;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 10px 30px rgba(0, 0, 0, .45);
    color-scheme: dark;
  }
}

/* ---------- base ---------- */
[hidden] { display: none !important; }
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 14px/1.5 var(--f-body); -webkit-font-smoothing: antialiased; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; text-wrap: balance; }
p { margin: 0; }
a { color: var(--link); }
button { font: inherit; color: inherit; }
input, select, textarea {
  font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--line-2);
  border-radius: 5px; padding: 7px 9px; min-width: 0; width: 100%;
}
input[type="checkbox"], input[type="radio"] { width: 17px; height: 17px; accent-color: var(--ink); padding: 0; flex: none; }
textarea { resize: vertical; }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: .8; }
input:disabled, select:disabled, textarea:disabled { background: var(--surface-2); color: var(--ink-2); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline-offset: 0; border-color: var(--focus); }
.ic { width: 18px; height: 18px; flex: none; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.nowrap { white-space: nowrap; }
.code { font: 500 12.5px/1.35 var(--f-mono); letter-spacing: .01em; white-space: nowrap; }
.bin { font: 400 12px/1.35 var(--f-mono); color: var(--ink-2); white-space: nowrap; }
.vno { font: 600 13px/1.2 var(--f-mono); color: var(--stamp); letter-spacing: .03em; white-space: nowrap; }
.num, .tnum { font-variant-numeric: tabular-nums; }
.pos { color: var(--ok); }
.neg { color: var(--bad); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- shell ---------- */
.app { display: flex; min-height: 100%; }
.hazard { height: 6px; flex: none; background: repeating-linear-gradient(-45deg, var(--accent) 0 9px, var(--stripe-dark) 9px 18px); }
.rail {
  width: 244px; flex: none; background: var(--surface); border-right: 1px solid var(--line);
  position: sticky; top: 0; height: 100vh; height: 100dvh; overflow-y: auto; display: flex; flex-direction: column;
}
.brand { display: flex; gap: 10px; align-items: center; padding: 16px 16px 10px; }
.brand-mark { width: 36px; height: 36px; border-radius: 7px; flex: none; background: var(--accent); color: var(--on-accent); display: grid; place-items: center; }
.brand-mark svg { width: 28px; height: 28px; }
.brand-text { min-width: 0; }
.brand-name { font: 700 22px/1 var(--f-display); letter-spacing: .03em; text-transform: uppercase; }
.brand-sub { font-size: 12px; color: var(--muted); margin-top: 3px; overflow-wrap: anywhere; }
.nav-group { padding: 6px 10px 2px; }
.nav-label { font: 600 11px/1 var(--f-body); letter-spacing: .09em; text-transform: uppercase; color: var(--muted); padding: 8px 10px 6px; }
.nav-item {
  display: flex; align-items: center; gap: 10px; width: 100%; border: 0; background: none; padding: 7px 10px;
  border-radius: 6px; cursor: pointer; color: var(--ink-2); text-align: left; font-weight: 500; text-decoration: none;
}
.nav-item:hover { background: var(--surface-2); color: var(--ink); }
.nav-item[aria-current="page"] { background: var(--accent-soft); color: var(--ink); font-weight: 600; }
.nav-badge { margin-left: auto; font: 600 11px/1 var(--f-body); padding: 3px 7px; border-radius: 10px; background: var(--warn-bg); color: var(--warn); }
.nav-badge.bad { background: var(--bad-bg); color: var(--bad); }
.rail-foot { margin-top: auto; padding: 12px 16px 16px; font-size: 12.5px; color: var(--muted); border-top: 1px solid var(--line); display: grid; gap: 6px; }
.rail-foot .who { color: var(--ink); font-weight: 600; }
.shell { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; gap: 10px; min-height: 52px; padding: 0 clamp(16px, 3vw, 36px);
  background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20;
}
.topbar .grow { flex: 1; min-width: 0; }
.topbar-title { font: 700 19px/1 var(--f-display); text-transform: uppercase; letter-spacing: .03em; display: none; }
.menu-btn { display: none; }
.demo-chip { display: inline-flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--ink-2); }
.demo-chip select { width: auto; padding: 4px 6px; font-size: 12.5px; }
.demo-tag { font: 700 11px/1 var(--f-body); letter-spacing: .08em; text-transform: uppercase; background: var(--accent); color: var(--on-accent); padding: 4px 7px; border-radius: 4px; }
.main { padding-inline: clamp(16px, 3vw, 36px); padding-block: 22px 72px; width: 100%; max-width: 1360px; }
.scrim { position: fixed; inset: 0; background: rgba(10, 14, 12, .45); z-index: 35; }
.icon-btn {
  border: 0; background: none; width: 38px; height: 38px; border-radius: 6px; display: inline-grid; place-items: center;
  cursor: pointer; color: var(--ink-2); flex: none;
}
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }
@media (max-width: 900px) {
  .rail { position: fixed; left: 0; top: 0; bottom: 0; z-index: 40; height: auto; transform: translateX(-102%); transition: transform .18s ease; box-shadow: var(--shadow); }
  .rail.open { transform: none; }
  .menu-btn { display: inline-grid; }
  .topbar-title { display: block; }
  .main { padding-block: 16px 72px; }
}

/* ---------- page furniture ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px 20px; flex-wrap: wrap; margin-bottom: 18px; }
.page-title { font: 700 clamp(26px, 3.2vw, 34px)/1 var(--f-display); letter-spacing: .015em; text-transform: uppercase; }
.page-sub { color: var(--muted); margin-top: 6px; }
.back { display: inline-flex; align-items: center; gap: 4px; border: 0; background: none; color: var(--link); cursor: pointer; padding: 0; font-weight: 500; margin-bottom: 8px; text-decoration: none; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.link { border: 0; background: none; padding: 0; color: var(--link); cursor: pointer; font-weight: 500; text-decoration: underline; text-underline-offset: 2px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 7px 14px; border-radius: 6px;
  border: 1px solid var(--line-2); background: var(--surface); color: var(--ink); font-weight: 500; cursor: pointer;
  text-decoration: none; white-space: nowrap; min-height: 36px;
}
.btn:hover { background: var(--surface-2); }
.btn .ic { width: 17px; height: 17px; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: 600; }
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.dark { background: var(--ink); border-color: var(--ink); color: var(--surface); }
.btn.danger { color: var(--bad); }
.btn.danger-fill { background: var(--bad); border-color: var(--bad); color: #fff; font-weight: 600; }
.btn.ghost { border-color: transparent; background: none; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.sm { min-height: 30px; padding: 3px 10px; font-size: 13px; }
.btn.lg { min-height: 46px; padding: 10px 22px; font-size: 15px; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; min-width: 0; }
.panel-h { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.panel-t { font: 600 12.5px/1.2 var(--f-body); letter-spacing: .07em; text-transform: uppercase; color: var(--ink-2); }
.panel-b { padding: 14px 16px; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.cols-2 { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.cols-2 .span2 { grid-column: 1 / -1; }
@media (max-width: 1080px) { .cols-2 { grid-template-columns: minmax(0, 1fr); } }
.banner { display: flex; gap: 10px 16px; align-items: center; justify-content: space-between; flex-wrap: wrap; padding: 11px 14px; border-radius: 8px; background: var(--info-bg); color: var(--ink); margin-bottom: 16px; font-size: 13.5px; }
.banner.warn { background: var(--warn-bg); }
.banner.bad { background: var(--bad-bg); }
.banner.ok { background: var(--ok-bg); }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px; border-radius: 999px; font: 600 11.5px/1.6 var(--f-body); white-space: nowrap; background: var(--surface-3); color: var(--ink-2); }
.chip.ok { background: var(--ok-bg); color: var(--ok); }
.chip.warn { background: var(--warn-bg); color: var(--warn); }
.chip.bad { background: var(--bad-bg); color: var(--bad); }
.chip.info { background: var(--info-bg); color: var(--info); }
.chip.tag { background: none; border: 1px solid var(--line-2); color: var(--ink-2); font-weight: 500; line-height: 1.5; }
.chip.ctl { background: var(--accent-soft); color: var(--ink); }
.hz { display: inline-block; width: 10px; height: 10px; border-radius: 2px; flex: none; background: repeating-linear-gradient(-45deg, var(--accent) 0 2.5px, var(--stripe-dark) 2.5px 5px); }
.chips { display: inline-flex; gap: 5px; flex-wrap: wrap; vertical-align: middle; }
.boot { min-height: 60vh; display: grid; place-items: center; align-content: center; gap: 12px; color: var(--muted); text-align: center; padding: 20px; }
.spinner { width: 26px; height: 26px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--accent); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.empty { padding: 34px 20px; text-align: center; color: var(--muted); display: grid; gap: 8px; justify-items: center; }
.empty h3 { font: 700 21px/1.15 var(--f-display); text-transform: uppercase; color: var(--ink); letter-spacing: .02em; }
.empty p { max-width: 480px; }
.empty.small { padding: 20px 16px; }

/* ---------- tabs & segmented ---------- */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; }
.tabs button, .tabs a { border: 0; background: none; padding: 9px 14px; cursor: pointer; font-weight: 500; color: var(--ink-2); border-bottom: 3px solid transparent; white-space: nowrap; text-decoration: none; }
.tabs [aria-current="page"], .tabs [aria-selected="true"] { color: var(--ink); border-bottom-color: var(--accent); font-weight: 600; }
.seg { display: inline-flex; flex-wrap: wrap; border: 1px solid var(--line-2); border-radius: 7px; overflow: hidden; background: var(--surface); }
.seg button { border: 0; background: none; padding: 6px 12px; cursor: pointer; font-weight: 500; color: var(--ink-2); border-right: 1px solid var(--line); }
.seg button:last-child { border-right: 0; }
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--surface); }

/* ---------- KPIs, alerts, bars ---------- */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
@media (max-width: 1080px) { .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 14px 16px 13px; display: flex; flex-direction: column; gap: 3px; text-align: left; cursor: pointer; min-width: 0; color: var(--ink); text-decoration: none; }
.kpi:hover { border-color: var(--line-2); background: var(--surface-2); }
.kpi-l { font-size: 13px; color: var(--muted); font-weight: 500; }
.kpi-v { font: 600 27px/1.15 var(--f-body); letter-spacing: -.01em; overflow-wrap: anywhere; }
.kpi-s { font-size: 12.5px; color: var(--ink-2); display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.alerts { display: flex; flex-direction: column; }
.alert { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 4px 12px; align-items: start; padding: 11px 16px; border-top: 1px solid var(--line); }
.alert:first-child { border-top: 0; }
.sev { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font: 700 12px/1 var(--f-body); margin-top: 1px; }
.sev.bad { background: var(--bad-bg); color: var(--bad); } .sev.warn { background: var(--warn-bg); color: var(--warn); }
.sev.info { background: var(--info-bg); color: var(--info); } .sev.ok { background: var(--ok-bg); color: var(--ok); }
.alert-t { font-weight: 500; } .alert-d { color: var(--muted); font-size: 13px; }
.alert .btn { align-self: center; }
@media (max-width: 560px) { .alert { grid-template-columns: auto minmax(0, 1fr); } .alert .btn { grid-column: 2; justify-self: start; } }
.bars { display: flex; flex-direction: column; gap: 9px; }
.bar-row { display: grid; grid-template-columns: minmax(96px, 36%) minmax(0, 1fr); gap: 12px; align-items: center; }
.bar-l { font-size: 13px; color: var(--ink-2); line-height: 1.25; }
.bar-t { display: flex; align-items: center; gap: 8px; min-width: 0; }
.bar-f { height: 14px; background: var(--bar); border-radius: 0 4px 4px 0; flex: none; min-width: 2px; }
.bar-v { font-size: 12.5px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.chart-note { font-size: 12px; color: var(--muted); margin-top: 12px; }
.minibars { display: flex; align-items: flex-end; gap: 4px; height: 90px; padding-top: 6px; }
.minibars div { flex: 1; background: var(--bar); border-radius: 3px 3px 0 0; min-height: 2px; position: relative; }
.minilabels { display: flex; gap: 4px; font-size: 11px; color: var(--muted); }
.minilabels span { flex: 1; text-align: center; }

/* ---------- tables ---------- */
.tbl-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tbl th { font: 600 11.5px/1.25 var(--f-body); letter-spacing: .05em; text-transform: uppercase; color: var(--muted); text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line-2); background: var(--surface-2); white-space: nowrap; }
.tbl td { padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tbl tbody tr.click { cursor: pointer; }
.tbl tbody tr.click:hover, .tbl tbody tr.click:focus-visible { background: var(--surface-2); }
.tbl tbody tr.dim td { color: var(--muted); }
.tbl tfoot td { font-weight: 600; border-top: 2px solid var(--line-2); border-bottom: 0; background: var(--surface-2); }
.tbl tr.grp td { background: var(--surface-3); font-weight: 600; padding-top: 7px; padding-bottom: 7px; }
.tbl tr.sub td { font-weight: 600; background: var(--surface-2); }
.tbl .desc { min-width: 200px; }
.tbl .d2 { color: var(--muted); font-size: 12.5px; }
.tbl td.chk, .tbl th.chk { width: 32px; }
.tbl input, .tbl select { padding: 5px 7px; }
.tbl input.qty { max-width: 110px; text-align: right; }
.tbl input.money { max-width: 120px; text-align: right; }
.tbl-foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 12px; color: var(--muted); font-size: 13px; }
.panel > .tbl-wrap .tbl th:first-child, .panel > .tbl-wrap .tbl td:first-child { padding-left: 16px; }
.panel > .tbl-wrap .tbl th:last-child, .panel > .tbl-wrap .tbl td:last-child { padding-right: 16px; }
@media (max-width: 760px) { .hide-sm { display: none; } }

/* ---------- forms ---------- */
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; margin-bottom: 14px; }
.filters .field { min-width: 140px; flex: 0 1 auto; }
.filters .field.grow { flex: 1 1 240px; }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field > span { font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.field > span .opt { font-weight: 400; color: var(--muted); }
.field.req > span:first-child::after { content: " *"; color: var(--bad); }
.field.wide { grid-column: 1 / -1; }
.field.check { flex-direction: row; align-items: center; gap: 9px; }
.field.check > span { font-weight: 500; color: var(--ink); }
.hint { font-size: 12.5px; color: var(--muted); }
.fgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px 14px; }
.form-msg { color: var(--bad); font-weight: 500; }
.form-msg:empty { display: none; }
.form-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-top: 16px; }
.totals { display: grid; grid-template-columns: auto auto; gap: 4px 18px; justify-content: end; font-variant-numeric: tabular-nums; }
.totals b { text-align: right; }
.addline { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: end; padding: 12px 16px; border-bottom: 1px solid var(--line); background: var(--surface-2); }
.combo { position: relative; }
.combo-list { position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 25; background: var(--surface); border: 1px solid var(--line-2); border-radius: 8px; box-shadow: var(--shadow); max-height: 360px; overflow: auto; margin: 0; padding: 4px; list-style: none; }
.combo-list li { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 1px 10px; align-items: baseline; padding: 7px 9px; border-radius: 6px; cursor: pointer; }
.combo-list li[aria-selected="true"] { background: var(--accent-soft); }
.combo-list li .d { overflow-wrap: anywhere; }
.combo-list li .q { font-variant-numeric: tabular-nums; font-size: 12.5px; color: var(--ink-2); white-space: nowrap; }
.combo-list li .q.zero { color: var(--bad); }
.combo-list li .b { grid-column: 2 / 4; font-size: 11.5px; color: var(--muted); }
.combo-list li.none { display: block; color: var(--muted); cursor: default; }
.rm { border: 0; background: none; color: var(--muted); cursor: pointer; width: 30px; height: 30px; border-radius: 5px; display: grid; place-items: center; }
.rm:hover { background: var(--bad-bg); color: var(--bad); }
.lotbox { display: grid; gap: 6px; margin-top: 6px; }
.lotrow { display: grid; grid-template-columns: minmax(110px, 1fr) 110px 150px auto; gap: 6px; align-items: center; }
.lotrow input { padding: 5px 7px; }
.flag-bad { color: var(--bad); font-weight: 600; }
.flag-warn { color: var(--warn); font-weight: 600; }
.lines-empty { padding: 22px 16px; color: var(--muted); text-align: center; }

/* ---------- item card ---------- */
.item-head { display: flex; justify-content: space-between; gap: 14px 24px; flex-wrap: wrap; align-items: flex-start; margin-bottom: 16px; }
.item-code { font: 600 15px/1.2 var(--f-mono); color: var(--ink-2); }
.item-desc { font: 700 clamp(26px, 3vw, 34px)/1.05 var(--f-display); text-transform: uppercase; letter-spacing: .01em; margin: 4px 0 8px; }
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; margin-bottom: 16px; }
.stat { background: var(--surface); padding: 10px 14px; min-width: 0; }
.stat-l { font-size: 12px; color: var(--muted); }
.stat-v { font-weight: 600; font-size: 16px; overflow-wrap: anywhere; }
.stat-v small { font-weight: 400; color: var(--muted); font-size: 12.5px; }
.bincard .tbl th { background: var(--accent-soft); color: var(--ink-2); }
.bincard td.bal { font-weight: 600; }
.kv { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 6px 16px; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; overflow-wrap: anywhere; }

/* ---------- documents ---------- */
.doc { position: relative; background: var(--surface); color: var(--ink); border: 1px solid var(--line-2); border-radius: 4px; padding: 22px 24px 18px; font: 13px/1.45 var(--f-body); overflow: hidden; }
.doc-head { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; border-bottom: 2px solid var(--ink); padding-bottom: 10px; margin-bottom: 14px; }
.doc-mine { font: 700 21px/1.05 var(--f-display); text-transform: uppercase; letter-spacing: .03em; }
.doc-store { color: var(--ink-2); font-size: 12.5px; margin-top: 3px; }
.doc-no { text-align: right; flex: none; }
.doc-title { font: 700 18px/1.05 var(--f-display); letter-spacing: .07em; text-transform: uppercase; }
.doc-no .vno { display: block; font-size: 19px; margin-top: 4px; }
.doc-fields { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 9px 18px; margin: 0 0 16px; }
.doc-fields > div { border-bottom: 1px dotted var(--line-2); padding-bottom: 3px; min-width: 0; }
.doc-fields dt { font-size: 10.5px; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); }
.doc-fields dd { margin: 1px 0 0; font-weight: 500; min-height: 1.35em; overflow-wrap: anywhere; }
.doc-note { margin: -6px 0 14px; font-size: 12.5px; color: var(--ink-2); }
.doc table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.doc th { font: 600 10.5px/1.25 var(--f-body); letter-spacing: .06em; text-transform: uppercase; text-align: left; padding: 6px 7px; border-top: 1.5px solid var(--ink); border-bottom: 1px solid var(--ink); color: var(--ink); white-space: nowrap; }
.doc td { padding: 6px 7px; border-bottom: 1px solid var(--line); vertical-align: top; }
.doc .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.doc tfoot td { border-top: 1px solid var(--ink); border-bottom: 2px solid var(--ink); font-weight: 600; }
.doc .d2 { color: var(--muted); font-size: 11.5px; }
.doc-sign { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 22px 18px; margin-top: 36px; }
.sig { border-top: 1px solid var(--ink); padding-top: 5px; font-size: 11px; color: var(--ink-2); min-width: 0; }
.sig b { display: block; font-size: 12.5px; color: var(--ink); font-weight: 600; min-height: 1.3em; overflow-wrap: anywhere; }
.sig-img { display: block; max-height: 42px; max-width: 100%; object-fit: contain; object-position: left bottom; margin-bottom: 2px; mix-blend-mode: multiply; }
@media (prefers-color-scheme: dark) { .sig-img { mix-blend-mode: normal; filter: invert(1) hue-rotate(180deg); } }
.sig-pad { border: 1px dashed var(--line-2); border-radius: 6px; background: var(--surface); touch-action: none; width: 100%; height: 140px; display: block; cursor: crosshair; }
.sig-now { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.sig-now img { max-height: 56px; border: 1px solid var(--line); border-radius: 6px; padding: 4px; background: #fff; }
.doc-foot { margin-top: 20px; font-size: 11px; color: var(--muted); display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.stamp { position: absolute; top: 34%; left: 50%; transform: translate(-50%, -50%) rotate(-16deg); font: 700 84px/1 var(--f-display); letter-spacing: .14em; color: var(--stamp); border: 7px solid var(--stamp); padding: 2px 22px 0; border-radius: 10px; opacity: .24; pointer-events: none; white-space: nowrap; }
@media (max-width: 700px) { .doc { padding: 16px; } .doc-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); } .doc-head { flex-direction: column; } .doc-no { text-align: left; } }
.timeline { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.timeline li { display: grid; grid-template-columns: 12px minmax(0, 1fr); gap: 10px; align-items: start; }
.timeline li::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--line-2); margin-top: 5px; }
.timeline li.done::before { background: var(--ok); }
.timeline li.stop::before { background: var(--bad); }
.timeline .t-a { font-weight: 500; } .timeline .t-b { color: var(--muted); font-size: 12.5px; }
.doc-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 16px; align-items: start; }
@media (max-width: 1100px) { .doc-layout { grid-template-columns: minmax(0, 1fr); } }

/* ---------- reports & setup ---------- */
.rep-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.rep-card { text-align: left; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 14px 16px; cursor: pointer; display: flex; flex-direction: column; gap: 4px; color: var(--ink); text-decoration: none; }
.rep-card:hover { border-color: var(--line-2); background: var(--surface-2); }
.rep-card b { font: 700 18px/1.15 var(--f-display); text-transform: uppercase; letter-spacing: .02em; }
.rep-card span { color: var(--muted); font-size: 13px; }
.rep-sum { display: flex; flex-wrap: wrap; gap: 8px 24px; margin-bottom: 12px; color: var(--ink-2); }
.rep-sum b { color: var(--ink); font-weight: 600; }
.matrix th.rot { writing-mode: vertical-rl; transform: rotate(180deg); white-space: nowrap; font-size: 11px; padding: 8px 4px; }
.matrix td { text-align: center; }
.matrix td:first-child { text-align: left; }
.progress { height: 8px; background: var(--surface-3); border-radius: 4px; overflow: hidden; }
.progress i { display: block; height: 100%; background: var(--accent); width: 0; transition: width .2s; }

/* ---------- modal, toast, tooltip ---------- */
dialog.modal { border: 0; padding: 0; border-radius: 10px; background: var(--surface); color: var(--ink); box-shadow: 0 24px 70px rgba(0, 0, 0, .35); width: min(720px, calc(100vw - 24px)); max-height: calc(100dvh - 32px); }
dialog.modal.wide { width: min(1040px, calc(100vw - 24px)); }
dialog.modal.narrow { width: min(460px, calc(100vw - 24px)); }
dialog::backdrop { background: rgba(10, 14, 12, .5); }
.m-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 16px 12px 20px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--surface); z-index: 3; }
.m-title { font: 700 21px/1.1 var(--f-display); text-transform: uppercase; letter-spacing: .02em; }
.m-body { padding: 18px 20px; }
.m-foot { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; padding: 12px 20px; border-top: 1px solid var(--line); position: sticky; bottom: 0; background: var(--surface); z-index: 3; }
.m-foot .spacer { margin-right: auto; }
.toasts { position: fixed; right: 16px; bottom: 16px; z-index: 80; display: flex; flex-direction: column; gap: 8px; align-items: flex-end; pointer-events: none; }
@media (max-width: 900px) { .toasts { left: 16px; right: 16px; align-items: stretch; } }
.toast { pointer-events: auto; background: var(--ink); color: var(--surface); padding: 10px 14px; border-radius: 8px; box-shadow: var(--shadow); display: flex; gap: 14px; align-items: center; max-width: 480px; font-size: 13.5px; }
.toast span { flex: 1; }
.toast button { background: none; border: 0; color: var(--accent); font-weight: 600; cursor: pointer; padding: 0; }
.toast.bad { background: var(--bad); color: #fff; }
.toast.bad button { color: #fff; text-decoration: underline; }

/* ---------- sign-in ---------- */
.authwrap { min-height: 100%; display: grid; place-items: center; padding: 24px 16px; }
.authcard { width: min(420px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; box-shadow: var(--shadow); }
.authcard .inner { padding: 22px 24px 24px; display: grid; gap: 14px; }
.authhead { display: flex; align-items: center; gap: 12px; }
.authhead h1 { font: 700 26px/1 var(--f-display); text-transform: uppercase; letter-spacing: .03em; }

/* ---------- labels ---------- */
.labels { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4mm; }
.label { border: 1px dashed var(--line-2); border-radius: 3px; padding: 3mm; display: grid; gap: 1mm; break-inside: avoid; background: #fff; color: #000; }
.label .l-code { font: 700 14px/1 var(--f-mono); }
.label .l-desc { font-size: 11px; line-height: 1.2; }
.label .l-bin { font: 600 12px/1 var(--f-mono); }
.label svg { width: 100%; height: 14mm; }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; } }

/* ---------- print ---------- */
#print-root { display: none; }
@media print {
  :root { --ink: #000; --ink-2: #222; --muted: #555; --line: #bbb; --line-2: #888; --surface: #fff; --surface-2: #f3f3f3; --surface-3: #e8e8e8; --bg: #fff; --stamp: #c00; --accent-soft: #fff6d6; }
  body { background: #fff; }
  .app, .toasts, dialog { display: none !important; }
  #print-root { display: block; }
  .doc { border: 0; padding: 0; border-radius: 0; }
  .doc tr { break-inside: avoid; }
  .label { border-color: #ccc; }
  @page { size: A4; margin: 12mm; }
}
