@font-face { font-family: Geist; src: url(/fonts/Geist-latin.woff2) format("woff2"); font-weight: 100 900; font-display: swap; }
@font-face { font-family: GeistMono; src: url(/fonts/GeistMono-latin.woff2) format("woff2"); font-weight: 100 900; font-display: swap; }
:root {
  --paper: #f4f3ef; --card: #fff; --ink: #17191e; --ink-2: #3a3d44; --muted: #6a6e76; --rule: #e2e0d8; --rule-2: #cfccc2;
  --blue: #1d4e9e; --blue-2: #163d7c; --blue-w: #e9eef8; --red: #c8102e; --red-w: #fbeaec; --amber: #9a6210; --amber-w: #fbf1df;
  --green: #2e7d4f; --green-w: #e6f2ea; --r: 8px; --mono: GeistMono, ui-monospace, Menlo, monospace;
  --shadow: 0 1px 0 rgba(23,25,30,.04), 0 1px 3px rgba(23,25,30,.06);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 15px/1.45 Geist, system-ui, sans-serif; font-feature-settings: "tnum" 1; }
a { color: var(--blue); text-decoration: none; } a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; letter-spacing: -.01em; } h1 { font-size: 22px; font-weight: 650; } h2 { font-size: 17px; font-weight: 620; } h3 { font-size: 14px; font-weight: 620; }
.mono { font-family: var(--mono); font-size: .92em; letter-spacing: -.01em; }
.muted { color: var(--muted); } .small { font-size: 13px; } .tiny { font-size: 12px; } .right { text-align: right; } .nowrap { white-space: nowrap; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; } .grow { flex: 1; } .stack > * + * { margin-top: 14px; }
.hidden { display: none !important; }

/* shell */
.shell { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
.side { background: var(--ink); color: #d9dbe0; padding: 18px 12px; position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 2px; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 18px; color: #fff; }
.brand-mark { width: 30px; height: 30px; border-radius: 50%; border: 2px solid #6f95d8; display: grid; place-items: center; font: 700 14px Geist; color: #ff5a6e; }
.brand b { display: block; font-size: 14px; letter-spacing: .04em; } .brand span { font-size: 11px; color: #9aa0ab; letter-spacing: .06em; text-transform: uppercase; }
.side a { color: #c9ccd3; padding: 9px 10px; border-radius: 6px; display: flex; align-items: center; gap: 10px; font-size: 14px; }
.side a:hover { background: #24272e; text-decoration: none; color: #fff; } .side a.on { background: #2b2f37; color: #fff; box-shadow: inset 3px 0 0 #6f95d8; }
.side .sep { height: 1px; background: #2b2f37; margin: 10px 4px; } .side .who { margin-top: auto; padding: 10px; font-size: 13px; color: #9aa0ab; }
.side .who b { color: #fff; display: block; font-weight: 600; }
.count { margin-left: auto; background: #ff5a6e; color: #fff; font-size: 11px; font-weight: 700; border-radius: 10px; padding: 1px 7px; }
main { padding: 26px 32px 80px; max-width: 1240px; width: 100%; min-width: 0; }
/* Grid and flex children may shrink below their content; wide tables scroll inside .tbl-wrap instead of widening the page. */
.grid > *, .split > *, .stack > * { min-width: 0; }
select { max-width: 100%; text-overflow: ellipsis; }
.top { display: flex; align-items: flex-end; justify-content: space-between; gap: 14px; margin-bottom: 20px; flex-wrap: wrap; }
.top .crumb { font-size: 13px; color: var(--muted); margin-bottom: 4px; }
.tabs-m { display: none; }

/* cards, tables */
.card { background: var(--card); border: 1px solid var(--rule); border-radius: var(--r); box-shadow: var(--shadow); }
.card > .hd { padding: 14px 16px; border-bottom: 1px solid var(--rule); display: flex; align-items: center; gap: 10px; justify-content: space-between; flex-wrap: wrap; }
.card > .bd { padding: 16px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-weight: 560; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .05em; padding: 9px 12px; border-bottom: 1px solid var(--rule); background: #fbfaf7; }
td { padding: 11px 12px; border-bottom: 1px solid var(--rule); vertical-align: top; }
tr:last-child td { border-bottom: 0; } tbody tr.click { cursor: pointer; } tbody tr.click:hover td { background: #fafaf7; }
td.num, th.num { text-align: right; white-space: nowrap; }
.tbl-wrap { overflow-x: auto; }

/* KPI strip */
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; margin-bottom: 22px; }
.kpi { background: var(--card); border: 1px solid var(--rule); border-radius: var(--r); padding: 12px 14px; display: block; color: inherit; }
a.kpi:hover { text-decoration: none; border-color: var(--rule-2); }
.kpi .v { font: 600 26px/1.1 Geist; letter-spacing: -.02em; } .kpi .l { font-size: 12.5px; color: var(--muted); margin-top: 4px; }
.kpi.warn .v { color: var(--amber); } .kpi.bad .v { color: var(--red); }

/* chips */
.chip { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 560; padding: 3px 9px; border-radius: 20px; background: #efeee9; color: var(--ink-2); white-space: nowrap; }
.chip::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .7; }
.chip.blue { background: var(--blue-w); color: var(--blue); } .chip.amber { background: var(--amber-w); color: var(--amber); }
.chip.red { background: var(--red-w); color: var(--red); } .chip.green { background: var(--green-w); color: var(--green); }
.chip.plain::before { display: none; }

/* stage rail: the signature element */
.rail { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; min-width: 150px; }
.rail i { height: 6px; border-radius: 2px; background: #e6e4dd; position: relative; overflow: hidden; }
.rail i b { position: absolute; inset: 0 auto 0 0; background: var(--blue); }
.rail i.full b { background: var(--green); }
.rail-big { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.rail-big .st { padding-top: 10px; position: relative; font-size: 12px; color: var(--muted); }
.rail-big .st::before { content: ""; position: absolute; top: 0; left: 0; right: 0; height: 6px; border-radius: 3px; background: #e6e4dd; }
.rail-big .st .f { position: absolute; top: 0; left: 0; height: 6px; border-radius: 3px; background: var(--blue); }
.rail-big .st.full .f { background: var(--green); }
.rail-big .st b { display: block; color: var(--ink); font-size: 13px; font-weight: 600; margin-top: 2px; }

/* step track (vendor PO, shipment) */
.track { display: flex; gap: 0; counter-reset: s; overflow-x: auto; padding-bottom: 2px; }
.track .s { flex: 1; min-width: 92px; padding: 8px 10px 8px 0; position: relative; font-size: 12.5px; color: var(--muted); }
.track .s::before { counter-increment: s; content: counter(s); width: 22px; height: 22px; border-radius: 50%; border: 1.5px solid var(--rule-2); display: grid; place-items: center; font-size: 11px; font-weight: 600; background: #fff; margin-bottom: 6px; position: relative; z-index: 1; }
.track .s::after { content: ""; position: absolute; top: 19px; left: 22px; right: 0; height: 1.5px; background: var(--rule-2); }
.track .s:last-child::after { display: none; }
.track .s.done { color: var(--ink); } .track .s.done::before { content: "✓"; background: var(--green); border-color: var(--green); color: #fff; }
.track .s.done::after { background: var(--green); }
.track .s.now { color: var(--ink); font-weight: 600; } .track .s.now::before { border-color: var(--blue); color: var(--blue); box-shadow: 0 0 0 4px var(--blue-w); }

/* buttons & forms */
.btn { appearance: none; border: 1px solid var(--rule-2); background: #fff; color: var(--ink); font: 560 14px Geist; padding: 9px 14px; border-radius: 7px; cursor: pointer; display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; min-height: 40px; }
.btn:hover { border-color: #b9b6ab; text-decoration: none; } .btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--blue); border-color: var(--blue); color: #fff; } .btn.primary:hover { background: var(--blue-2); }
.btn.good { background: var(--green); border-color: var(--green); color: #fff; } .btn.danger { color: var(--red); }
.btn.sm { padding: 5px 10px; min-height: 32px; font-size: 13px; } .btn.ghost { border-color: transparent; background: transparent; color: var(--blue); }
label.f { display: block; font-size: 12.5px; color: var(--muted); font-weight: 520; }
label.f > span { display: block; margin-bottom: 4px; }
input, select, textarea { font: 15px Geist; color: var(--ink); background: #fff; border: 1px solid var(--rule-2); border-radius: 7px; padding: 9px 10px; width: 100%; min-height: 40px; }
input:focus, select:focus, textarea:focus, .btn:focus-visible { outline: 2px solid var(--blue); outline-offset: 1px; border-color: var(--blue); }
input.in-t { min-height: 34px; padding: 6px 8px; font-size: 14px; } input.qty { width: 84px; text-align: right; }
.grid { display: grid; gap: 12px; } .g2 { grid-template-columns: repeat(2, 1fr); } .g3 { grid-template-columns: repeat(3, 1fr); } .g4 { grid-template-columns: repeat(4, 1fr); }
.lines td { padding: 6px 6px; } .lines input { min-width: 70px; }
.actions-bar { display: flex; gap: 10px; justify-content: flex-end; padding: 14px 16px; border-top: 1px solid var(--rule); background: #fbfaf7; border-radius: 0 0 var(--r) var(--r); flex-wrap: wrap; }

/* uploader */
.drop { border: 1.5px dashed var(--rule-2); border-radius: var(--r); padding: 18px; text-align: center; background: #fbfaf7; }
.drop.over { border-color: var(--blue); background: var(--blue-w); }
.drop .row { justify-content: center; } .thumbs { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; justify-content: center; }
.thumb { width: 74px; height: 74px; border-radius: 6px; border: 1px solid var(--rule); background: #fff center/cover no-repeat; position: relative; display: grid; place-items: center; font-size: 11px; color: var(--muted); }
.thumb .x { position: absolute; top: -7px; right: -7px; width: 22px; height: 22px; border-radius: 50%; border: 0; background: var(--ink); color: #fff; cursor: pointer; font-size: 12px; }
.docs { display: flex; gap: 8px; flex-wrap: wrap; }
.doc { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--rule); border-radius: 6px; padding: 5px 9px; font-size: 13px; background: #fff; color: var(--ink); }
.doc img { width: 34px; height: 34px; object-fit: cover; border-radius: 4px; }
.split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.preview { position: sticky; top: 16px; } .preview iframe, .preview img { width: 100%; height: 78vh; border: 1px solid var(--rule); border-radius: var(--r); background: #fff; object-fit: contain; }
.preview .pages { display: flex; gap: 6px; margin-bottom: 8px; flex-wrap: wrap; }

/* notices */
.note { padding: 10px 12px; border-radius: 7px; font-size: 13.5px; background: var(--blue-w); color: #183b73; }
.note.warn { background: var(--amber-w); color: #6d4609; } .note.bad { background: var(--red-w); color: #8f0b21; } .note.good { background: var(--green-w); color: #1f5a38; }
.note ul { margin: 4px 0 0; padding-left: 18px; }
.spin { width: 16px; height: 16px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: sp .7s linear infinite; display: inline-block; vertical-align: -3px; }
@keyframes sp { to { transform: rotate(360deg); } }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 11px 16px; border-radius: 8px; font-size: 14px; z-index: 50; box-shadow: 0 8px 24px rgba(0,0,0,.2); max-width: 92vw; }
.toast.err { background: var(--red); }

/* feed */
.feed { list-style: none; margin: 0; padding: 0; }
.feed li { padding: 12px 16px; border-bottom: 1px solid var(--rule); display: flex; gap: 12px; align-items: flex-start; }
.feed li:last-child { border-bottom: 0; }
.feed .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--rule-2); margin-top: 7px; flex: none; }
.feed li.unread .dot { background: var(--blue); } .feed li.t-good .dot { background: var(--green); } .feed li.t-warn .dot { background: var(--amber); } .feed li.t-bad .dot { background: var(--red); }
.feed .t { font-weight: 560; } .feed .b { font-size: 13.5px; color: var(--ink-2); } .feed .w { font-size: 12px; color: var(--muted); white-space: nowrap; margin-left: auto; }
.act { display: flex; gap: 12px; align-items: center; padding: 13px 16px; border-bottom: 1px solid var(--rule); color: inherit; }
.act:last-child { border-bottom: 0; } .act:hover { background: #fafaf7; text-decoration: none; }
.act .ico { width: 30px; height: 30px; border-radius: 7px; background: var(--blue-w); color: var(--blue); display: grid; place-items: center; flex: none; font-weight: 700; font-size: 12px; }
.act .ico.r-sales { background: #f1e9fb; color: #6b3fa0; } .act .ico.r-accounts { background: var(--green-w); color: var(--green); } .act .ico.r-dispatch { background: var(--amber-w); color: var(--amber); }
.act .go { margin-left: auto; color: var(--blue); font-size: 13px; font-weight: 600; white-space: nowrap; }
.empty { padding: 28px 16px; text-align: center; color: var(--muted); font-size: 14px; }
.timeline { list-style: none; margin: 0; padding: 0; font-size: 13.5px; }
.timeline li { padding: 8px 0 8px 18px; border-left: 1.5px solid var(--rule); position: relative; }
.timeline li::before { content: ""; position: absolute; left: -5px; top: 13px; width: 8px; height: 8px; border-radius: 50%; background: var(--blue); }
.alloc { font-size: 12.5px; color: var(--muted); margin-top: 3px; } .alloc a { color: var(--ink-2); }
.grp { border-top: 1px solid var(--rule); } .grp:first-child { border-top: 0; }
.grp-h { padding: 12px 16px; display: flex; gap: 10px; align-items: center; background: #fbfaf7; flex-wrap: wrap; }
.seg { display: inline-flex; border: 1px solid var(--rule-2); border-radius: 7px; overflow-x: auto; max-width: 100%; scrollbar-width: none; }
.top > .row { max-width: 100%; min-width: 0; }
.seg a { white-space: nowrap; }
.seg a { padding: 7px 12px; font-size: 13px; color: var(--ink-2); border-right: 1px solid var(--rule-2); background: #fff; }
.seg a:last-child { border-right: 0; } .seg a.on { background: var(--ink); color: #fff; } .seg a:hover { text-decoration: none; }

/* login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: var(--ink); }
.login .card { width: 100%; max-width: 380px; padding: 26px; }
.login .brand { color: var(--ink); padding: 0 0 20px; } .login .brand span { color: var(--muted); }

/* mobile */
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .side { display: none; }
  main { padding: 16px 14px 96px; }
  .tabs-m { display: grid; position: fixed; bottom: 0; left: 0; right: 0; background: #fff; border-top: 1px solid var(--rule); grid-auto-flow: column; grid-auto-columns: 1fr; z-index: 20; padding-bottom: env(safe-area-inset-bottom); }
  .tabs-m a { padding: 9px 2px 8px; text-align: center; font-size: 11px; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 3px; position: relative; }
  .tabs-m a svg { width: 22px; height: 22px; } .tabs-m a.on { color: var(--blue); } .tabs-m a:hover { text-decoration: none; }
  .tabs-m .count { position: absolute; top: 4px; left: 54%; margin: 0; }
  .g2, .g3, .g4 { grid-template-columns: 1fr 1fr; } .grid.up2 { grid-template-columns: 1fr; } .split { grid-template-columns: 1fr; } .preview { position: static; } .preview iframe, .preview img { height: 50vh; }
  h1 { font-size: 20px; }
  .hide-m { display: none; }
  table.cards thead { display: none; } table.cards tr { display: block; padding: 10px 12px; border-bottom: 1px solid var(--rule); }
  table.cards td { display: block; border: 0; padding: 2px 0; } table.cards td.num { text-align: left; }
  .rail-big { grid-template-columns: repeat(4, 1fr); row-gap: 12px; }
}
