:root {
  --ink: #15231f;
  --ink-2: #3b4b44;
  --muted: #7a8680;
  --line: #e4e9e5;
  --line-2: #eef2ef;
  --canvas: #f4f6f4;
  --paper: #fff;
  --forest: #173c31;
  --forest-2: #245946;
  --side: #12201c;
  --green: #3d8a58; --green-bg: #e9f5ed;
  --amber: #a8742a; --amber-bg: #fdf4e3;
  --red: #b4483a; --red-bg: #fcebe8;
  --blue: #3b6fa8; --blue-bg: #e8f0fa;
  --violet: #6c55a8; --violet-bg: #f0ecfa;
  --teal: #2b7f82; --teal-bg: #e4f4f3;
  --orange: #d67646;
  --sans: 'DM Sans', 'Segoe UI', system-ui, sans-serif;
  --mono: 'IBM Plex Mono', Consolas, monospace;
  --radius: 8px;
  --shadow: 0 1px 2px rgba(20, 40, 30, .04), 0 6px 20px rgba(20, 40, 30, .04);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--canvas); color: var(--ink); font: 13px/1.45 var(--sans); -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -.01em; }
.mono { font-family: var(--mono); }
.strong { font-weight: 600; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.tiny { font-size: 11px; }
.r { text-align: right !important; }
.nowrap { white-space: nowrap; }
.ok { color: var(--green); }
.warn-text { color: var(--amber); }
.bad-text { color: var(--red); }
.chill { color: var(--teal); font-weight: 500; }
.link { color: var(--forest-2); font-weight: 600; cursor: pointer; background: none; border: 0; padding: 0; }
.link:hover { text-decoration: underline; }

/* ---------- Shell ---------- */
.shell { display: grid; grid-template-columns: 236px minmax(0, 1fr); height: 100vh; }
.sidebar { display: flex; flex-direction: column; gap: 18px; padding: 20px 14px 14px; background: var(--side); color: #e9f1ec; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 11px; padding: 0 8px; }
.brand-mark { display: grid; place-items: center; width: 34px; height: 34px; border: 1px solid #5f7d71; border-radius: 9px; color: #d8ece0; }
.brand-mark svg { width: 24px; height: 24px; }
.brand-copy strong { display: block; font-size: 14px; letter-spacing: 2.4px; }
.brand-copy small { display: block; color: #8fa69b; font: 500 9px var(--mono); letter-spacing: 1px; }
.workspace { display: flex; align-items: center; gap: 10px; padding: 10px; border: 1px solid #2c3e37; border-radius: var(--radius); background: #182a24; }
.ws-icon { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 6px; background: #26443a; color: #bfe0cb; font-size: 17px; }
.workspace strong { display: block; font-size: 12px; }
.workspace small { display: block; color: #93a79d; font-size: 10.5px; }
.nav { display: grid; gap: 14px; }
.nav-label { padding: 0 10px 6px; color: #7f978c; font: 500 9.5px var(--mono); letter-spacing: 1.1px; }
.nav-link { position: relative; display: flex; align-items: center; gap: 11px; height: 36px; padding: 0 10px; border-radius: 6px; color: #b8c7bf; font-size: 13px; transition: background .15s, color .15s; }
.nav-link:hover { background: #1e332c; color: #fff; }
.nav-link.active { background: #27443a; color: #fff; font-weight: 500; }
.nav-link.active::before { content: ''; position: absolute; left: -14px; width: 3px; height: 20px; border-radius: 0 3px 3px 0; background: #86c69c; }
.nav-icon { width: 16px; text-align: center; color: #9bb4a8; }
.nav-link.active .nav-icon { color: #bfe3cb; }
.nav-count { margin-left: auto; min-width: 20px; padding: 1px 6px; border-radius: 10px; background: #33544a; color: #e1efe6; font: 500 10px var(--mono); text-align: center; }
.sidebar-foot { display: grid; gap: 12px; margin-top: auto; }
.walkthrough { padding: 9px 10px; border: 1px dashed #3f574d; border-radius: 6px; color: #c8dccf; font-size: 12px; }
.walkthrough:hover { border-color: #86c69c; color: #fff; }
.sync { display: flex; gap: 9px; padding: 11px 8px 2px; border-top: 1px solid #2c3e37; }
.sync-dot { width: 7px; height: 7px; margin-top: 5px; border-radius: 50%; background: #74bd88; box-shadow: 0 0 0 3px rgba(116, 189, 136, .15); }
.sync strong { display: block; font-size: 11px; font-weight: 500; }
.sync small { display: block; color: #8fa39a; font-size: 10.5px; }

.main { display: flex; flex-direction: column; min-width: 0; height: 100vh; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; height: 58px; padding: 0 28px; border-bottom: 1px solid var(--line); background: var(--paper); }
.global-search { display: flex; align-items: center; gap: 8px; width: min(420px, 45vw); height: 36px; padding: 0 12px; border: 1px solid var(--line); border-radius: 7px; background: #f8faf8; color: var(--muted); }
.global-search input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--ink); }
.global-search:focus-within { border-color: #8db79b; box-shadow: 0 0 0 3px #e7f2ea; }
.top-right { display: flex; align-items: center; gap: 14px; }
.demo-tag { display: inline-flex; align-items: center; gap: 6px; padding: 4px 8px; border: 1px solid #f0d4c2; border-radius: 4px; background: #fff7f1; color: #9a5936; font: 500 10px var(--mono); letter-spacing: .6px; }
.demo-tag span { width: 6px; height: 6px; border-radius: 50%; background: var(--orange); }
.role-switch { position: relative; display: flex; align-items: center; gap: 9px; padding: 4px 28px 4px 5px; border: 1px solid var(--line); border-radius: 22px; cursor: pointer; }
.role-switch:hover { border-color: #b7cbbd; }
.role-switch select { position: absolute; inset: 0; width: 100%; opacity: 0; cursor: pointer; }
.avatar { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: #d7a278; color: #3a291d; font-size: 11px; font-weight: 700; }
.role-copy strong { display: block; font-size: 12px; line-height: 1.2; }
.role-copy small { display: block; color: var(--muted); font-size: 10.5px; }
.chev { position: absolute; right: 11px; color: var(--muted); }
.page { flex: 1; overflow-y: auto; padding: 26px 28px 40px; }
.page > * + * { margin-top: 18px; }

/* ---------- Page elements ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; }
.kicker { color: var(--muted); font: 500 10px var(--mono); letter-spacing: .9px; }
.page-head h1 { margin: 6px 0 4px; font-size: 25px; }
.page-head p { max-width: 720px; margin: 0; color: var(--muted); }
.head-actions { display: flex; gap: 8px; }
.kpis { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); box-shadow: var(--shadow); }
.kpis.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.kpi { display: grid; gap: 5px; min-width: 0; padding: 15px 17px; border-right: 1px solid var(--line); }
.kpi:last-child { border-right: 0; }
.kpi-label { color: var(--muted); font: 500 9.5px var(--mono); letter-spacing: .8px; }
.kpi strong { overflow: hidden; font-size: 21px; font-weight: 600; letter-spacing: -.01em; text-overflow: ellipsis; white-space: nowrap; }
.kpi-foot { overflow: hidden; color: var(--muted); font-size: 11.5px; text-overflow: ellipsis; white-space: nowrap; }
.kpi.is-alert strong { color: var(--red); }
.kpi.is-warn strong { color: var(--amber); }
.card { padding: 18px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); box-shadow: var(--shadow); }
.card.flush { padding: 0; overflow: hidden; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.card-head h2, .toolbar h2 { font-size: 15px; }
.count-pill { min-width: 24px; padding: 2px 8px; border-radius: 12px; background: var(--line-2); color: var(--ink-2); font: 500 11px var(--mono); text-align: center; }
.grid-2 { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 18px; }
.grid-2.tight, .grid-3.tight { gap: 10px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-2.tight { grid-template-columns: 1fr 1fr; }
.stack { display: grid; gap: 18px; align-content: start; }
.grid-2 > *, .stack > *, .lanes > *, .split > * { min-width: 0; }
.empty { padding: 22px; color: var(--muted); text-align: center; }
.section-title { margin: 18px 0 8px; color: var(--ink-2); font: 600 10.5px var(--mono); letter-spacing: .7px; text-transform: uppercase; }

/* ---------- Buttons & inputs ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 34px; padding: 0 13px; border: 1px solid transparent; border-radius: 6px; font-size: 12.5px; font-weight: 600; white-space: nowrap; cursor: pointer; transition: background .15s, border-color .15s, transform .1s; }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn.primary { background: var(--forest); color: #fff; }
.btn.primary:hover:not(:disabled) { background: var(--forest-2); }
.btn.secondary { border-color: var(--line); background: #fff; color: var(--ink-2); }
.btn.secondary:hover:not(:disabled) { border-color: #b3c7b9; background: #f7faf7; }
.btn.ghost { background: transparent; color: var(--ink-2); }
.btn.ghost:hover:not(:disabled) { background: var(--line-2); }
.btn.danger { border-color: #efcdc7; background: #fff; color: var(--red); }
.btn.danger:hover:not(:disabled) { background: var(--red-bg); }
.btn.small { height: 30px; padding: 0 10px; font-size: 12px; }
.btn.block { width: 100%; height: 40px; margin-top: 12px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.plus { font-weight: 400; }
.icon-btn { display: grid; place-items: center; width: 32px; height: 32px; border: 1px solid var(--line); border-radius: 6px; background: #fff; color: var(--muted); cursor: pointer; }
.icon-btn:hover { color: var(--ink); }
.input { width: 100%; height: 34px; padding: 0 10px; border: 1px solid var(--line); border-radius: 6px; outline: 0; background: #fff; }
textarea.input { height: auto; padding: 8px 10px; resize: vertical; }
.input:focus, .qty:focus { border-color: #7fae8f; box-shadow: 0 0 0 3px #e7f2ea; }
.input.search { width: 240px; }
.field { display: grid; gap: 5px; margin-top: 10px; }
.field > span { color: var(--ink-2); font-size: 11.5px; font-weight: 600; }
.qty { width: 66px; height: 30px; padding: 0 7px; border: 1px solid var(--line); border-radius: 5px; outline: 0; font-family: var(--mono); text-align: right; }
.small-qty { width: 54px; }
.check { display: flex; align-items: center; gap: 8px; margin-top: 12px; font-size: 12.5px; }

/* ---------- Badges ---------- */
.badge { display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 10px; font-size: 11px; font-weight: 600; white-space: nowrap; }
.badge.green { background: var(--green-bg); color: var(--green); }
.badge.amber { background: var(--amber-bg); color: var(--amber); }
.badge.red { background: var(--red-bg); color: var(--red); }
.badge.blue { background: var(--blue-bg); color: var(--blue); }
.badge.violet { background: var(--violet-bg); color: var(--violet); }
.badge.teal { background: var(--teal-bg); color: var(--teal); }
.badge.gray { background: var(--line-2); color: var(--ink-2); }
em.badge { font-style: normal; font-size: 10px; padding: 1px 5px; }

/* ---------- Tables ---------- */
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.tool-right { display: flex; gap: 8px; }
.tool-right select { width: 140px; }
.tabs { display: flex; flex-wrap: wrap; gap: 4px; }
.tab { padding: 6px 11px; border-radius: 6px; color: var(--muted); font-size: 12.5px; font-weight: 500; }
.tab span { margin-left: 3px; color: #a3ada7; font: 11px var(--mono); }
.tab:hover { background: var(--line-2); color: var(--ink); }
.tab.active { background: #e8f2eb; color: var(--forest); }
.pill-tabs { margin-bottom: 4px; }
.table { width: 100%; border-collapse: collapse; }
.table th { padding: 10px 14px; border-bottom: 1px solid var(--line); background: #fafbfa; color: var(--muted); font: 500 10px var(--mono); letter-spacing: .5px; text-align: left; text-transform: uppercase; white-space: nowrap; }
.table td { padding: 11px 14px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tfoot td { border-top: 1px solid var(--line); background: #fafbfa; font-weight: 600; }
.table.clickable tbody tr { cursor: pointer; }
.table.clickable tbody tr:hover td { background: #f7faf7; }
.table.compact th { padding: 7px 9px; }
.table.compact td { padding: 8px 9px; }
.table tr.selected td { background: #f2f9f4; }
.table tr.open td { background: #f5f9f6; }
.table tr.sub > td { padding: 0 14px 14px; background: #f5f9f6; }
.table tr.sub .table { border: 1px solid var(--line); border-radius: 6px; background: #fff; }
.doi { font: 500 12px var(--mono); }
.doi.low { padding: 1px 6px; border-radius: 4px; background: var(--amber-bg); color: var(--amber); }
.meter { width: 140px; height: 5px; margin-bottom: 4px; overflow: hidden; border-radius: 4px; background: var(--line-2); }
.meter span { display: block; height: 100%; border-radius: inherit; background: #69a97d; }
.meter span.hot { background: #d4893d; }
.action-code { padding: 2px 6px; border-radius: 4px; background: var(--line-2); color: var(--ink-2); }

/* ---------- Dashboard ---------- */
.pipeline { display: flex; align-items: center; gap: 8px; }
.pipe-step { display: grid; flex: 1; grid-template-columns: auto 1fr; align-items: center; gap: 2px 10px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 7px; transition: border-color .15s, background .15s; }
.pipe-step:hover { border-color: #b7cdbd; background: #f7faf7; }
.pipe-index { grid-row: span 2; display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--line-2); color: var(--muted); font: 500 10px var(--mono); }
.pipe-label { color: var(--muted); font-size: 11.5px; }
.pipe-step strong { font-size: 20px; line-height: 1.1; }
.pipe-arrow { color: #c3ccc6; font-size: 18px; }
.attention { display: grid; }
.attention-row { display: flex; align-items: center; gap: 12px; padding: 11px 4px; border-bottom: 1px solid var(--line-2); }
.attention-row:last-child { border-bottom: 0; }
.attention-row:hover .att-cta { color: var(--forest); }
.dot { flex: 0 0 auto; width: 8px; height: 8px; border-radius: 50%; }
.dot.red { background: var(--red); } .dot.amber { background: #d69b3f; } .dot.blue { background: var(--blue); } .dot.green { background: var(--green); } .dot.violet { background: var(--violet); } .dot.teal { background: var(--teal); }
.att-copy { flex: 1; min-width: 0; }
.att-copy strong { display: block; font-size: 13px; font-weight: 600; }
.att-copy small { display: block; overflow: hidden; color: var(--muted); font-size: 11.5px; text-overflow: ellipsis; white-space: nowrap; }
.att-cta { color: var(--muted); font-size: 12px; font-weight: 600; white-space: nowrap; }
.fleet-row { display: grid; grid-template-columns: minmax(0, 1fr) 90px 34px 90px; align-items: center; gap: 12px; padding: 9px 2px; border-bottom: 1px solid var(--line-2); }
.fleet-row:last-child { border-bottom: 0; }
.fleet-row .badge { justify-self: end; }
.fleet-id strong { display: block; font: 600 12.5px var(--mono); }
.fleet-id small { display: block; overflow: hidden; color: var(--muted); font-size: 11.5px; text-overflow: ellipsis; white-space: nowrap; }
.progress { height: 5px; overflow: hidden; border-radius: 4px; background: var(--line-2); }
.progress span { display: block; height: 100%; background: var(--teal); }
.act-row { display: grid; grid-template-columns: 42px 1fr; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line-2); font-size: 12.5px; }
.act-row:last-child { border-bottom: 0; }
.act-row small { display: block; color: var(--muted); font-size: 11.5px; }

/* ---------- Warehouse ---------- */
.lanes { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.lane { display: flex; flex-direction: column; min-height: 280px; border: 1px solid var(--line); border-radius: var(--radius); background: #f9fbf9; }
.lane-head { display: flex; align-items: center; justify-content: space-between; padding: 13px 14px; border-bottom: 1px solid var(--line); }
.lane-head strong { display: block; font-size: 13px; }
.lane-head small { display: block; color: var(--muted); font-size: 11.5px; }
.lane-body { display: grid; gap: 10px; align-content: start; padding: 12px; }
.wo { display: grid; gap: 7px; padding: 12px; border: 1px solid var(--line); border-radius: 7px; background: #fff; box-shadow: var(--shadow); }
.wo-head { display: flex; align-items: center; justify-content: space-between; }
.wo-cust { font-weight: 600; }
.wo-lines { display: grid; gap: 2px; color: var(--ink-2); font-size: 12px; }
.pick-list { display: grid; gap: 3px; padding: 7px; border-radius: 5px; background: #f6f9f7; font-size: 11.5px; }
.pick-list div { display: grid; grid-template-columns: 110px 1fr 30px; gap: 6px; }
.pick-list div span:last-child { text-align: right; font-family: var(--mono); }
.assign-row { display: flex; gap: 6px; }
.wo .btn { justify-self: start; }

/* ---------- Deliveries ---------- */
.split { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 18px; align-items: start; }
.trip-list { display: grid; gap: 8px; }
.trip-item { display: grid; gap: 3px; padding: 12px; border: 1px solid var(--line); border-radius: 7px; background: #fff; }
.trip-item:hover { border-color: #b7cdbd; }
.trip-item.active { border-color: #7fae8f; box-shadow: 0 0 0 3px #e7f2ea; }
.trip-top { display: flex; align-items: center; justify-content: space-between; }
.trip-top strong { font: 600 12.5px var(--mono); }
.trip-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.trip-header h2 { margin: 4px 0 2px; font-size: 18px; }
.trip-stats { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); margin: 16px 0 12px; border: 1px solid var(--line); border-radius: 7px; }
.trip-stats div { padding: 10px 12px; border-right: 1px solid var(--line); }
.trip-stats div:last-child { border: 0; }
.trip-stats span, .kv span { display: block; color: var(--muted); font-size: 11px; }
.trip-stats b, .kv b { display: block; margin-top: 3px; font: 500 13px var(--mono); }
.stops { display: grid; margin-top: 12px; }
.stop { display: flex; align-items: center; gap: 12px; padding: 12px 4px; border-bottom: 1px solid var(--line-2); }
.stop:last-child { border-bottom: 0; }
.stop-no { display: grid; flex: 0 0 auto; place-items: center; width: 28px; height: 28px; border: 1px solid var(--line); border-radius: 50%; color: var(--muted); font: 500 11px var(--mono); }
.stop.done .stop-no { border-color: #a9d2b5; background: var(--green-bg); color: var(--green); }
.stop-main { flex: 1; min-width: 0; }
.stop-main strong, .stop-main small { display: block; }
.stop-main small { color: var(--muted); font-size: 11.5px; }
.stop-main small.ok { color: var(--green); }

/* ---------- Alerts / kv / totals ---------- */
.alert { margin-top: 12px; padding: 10px 12px; border: 1px solid; border-radius: 6px; font-size: 12.5px; }
.alert.green { border-color: #cfe6d6; background: #f3faf5; color: #2f6f45; }
.alert.amber { border-color: #f1ddb5; background: #fffaf0; color: #8a5f22; }
.alert.red { border-color: #f1cdc6; background: #fdf3f1; color: #9a3b2f; }
.alert.blue { border-color: #cddcf0; background: #f3f7fd; color: #325e8f; }
.kv { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1px; overflow: hidden; border: 1px solid var(--line); border-radius: 7px; background: var(--line); }
.kv.three { grid-template-columns: repeat(3, minmax(0, 1fr)); margin-top: 12px; }
.kv > div { padding: 10px 12px; background: #fff; }
.kv b { font-family: var(--sans); font-weight: 600; font-size: 12.5px; }
.totals { display: grid; gap: 6px; margin-top: 12px; }
.totals div { display: flex; justify-content: space-between; color: var(--muted); font-size: 12.5px; }
.totals b { color: var(--ink-2); font: 500 12.5px var(--mono); }
.totals .grand { padding-top: 8px; border-top: 1px solid var(--line); color: var(--ink); font-weight: 600; }
.totals .grand b { color: var(--forest); font-size: 15px; font-weight: 600; }
.totals .neg b { color: var(--red); }
.note-list { margin-top: 8px; padding: 9px 11px; border-radius: 6px; background: #fbf8f1; color: #86632a; font-size: 11.5px; }

/* ---------- Drawer & modal ---------- */
#overlay.overlay { position: fixed; z-index: 40; inset: 0; background: rgba(15, 28, 23, .38); animation: fade .15s ease; }
#overlay.is-modal { display: grid; place-items: center; padding: 24px; overflow-y: auto; }
@keyframes fade { from { opacity: 0; } }
@keyframes slide { from { transform: translateX(24px); opacity: 0; } }
@keyframes pop { from { transform: translateY(8px) scale(.99); opacity: 0; } }
.drawer { position: absolute; top: 0; right: 0; bottom: 0; display: flex; flex-direction: column; width: min(560px, 100vw); background: #fff; box-shadow: -10px 0 40px rgba(15, 28, 23, .18); animation: slide .2s ease; }
.drawer-head, .modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 20px 22px 16px; border-bottom: 1px solid var(--line); }
.drawer-head h2, .modal-head h2 { margin: 5px 0 2px; font-size: 20px; }
.drawer-head p { margin: 0; color: var(--muted); }
.drawer-head-right { display: flex; align-items: center; gap: 10px; }
.drawer-body { flex: 1; overflow-y: auto; padding: 18px 22px 30px; }
.action-bar { display: flex; align-items: center; gap: 8px; margin: 14px 0 4px; padding: 12px; border: 1px solid #d9e8dd; border-radius: 7px; background: #f5faf6; }
.action-bar select { flex: 1; }
.timeline { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.tl-step { display: grid; justify-items: center; gap: 4px; text-align: center; }
.tl-dot { display: grid; place-items: center; width: 26px; height: 26px; border: 1px solid var(--line); border-radius: 50%; color: var(--muted); font: 500 11px var(--mono); }
.tl-step.done .tl-dot { border-color: var(--forest-2); background: var(--forest-2); color: #fff; }
.tl-name { font-size: 11.5px; font-weight: 600; }
.tl-time { color: var(--muted); font: 10.5px var(--mono); }
.modal { display: flex; flex-direction: column; width: min(640px, 100%); max-height: calc(100vh - 48px); border-radius: 10px; background: #fff; box-shadow: 0 20px 60px rgba(15, 28, 23, .25); animation: pop .18s ease; }
.modal.wide { width: min(1120px, 100%); }
.modal-body { overflow-y: auto; padding: 16px 22px 20px; }
.modal-foot { display: flex; align-items: center; justify-content: flex-end; gap: 8px; padding: 14px 22px; border-top: 1px solid var(--line); }
.modal-foot .muted { margin-right: auto; }
.order-builder { display: grid; grid-template-columns: minmax(0, 1fr) 360px; min-height: 0; overflow: hidden; }
.builder-left { display: flex; flex-direction: column; min-height: 0; padding: 4px 22px 20px; overflow: hidden; }
.builder-right { padding: 16px 20px 20px; border-left: 1px solid var(--line); background: #fafbfa; overflow-y: auto; }
.catalog-tools { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 14px 0 10px; }
.catalog-tools .input.search { width: 180px; }
.chips { display: flex; flex-wrap: wrap; gap: 5px; }
.chip { padding: 5px 10px; border: 1px solid var(--line); border-radius: 14px; background: #fff; color: var(--ink-2); font-size: 11.5px; cursor: pointer; }
.chip.active { border-color: var(--forest); background: var(--forest); color: #fff; }
.catalog { flex: 1; min-height: 240px; max-height: calc(100vh - 290px); overflow-y: auto; border: 1px solid var(--line); border-radius: 7px; }
.catalog-table th { position: sticky; top: 0; z-index: 1; }
.cust-card { padding: 13px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.cust-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.cust-top strong { display: block; }
.cust-top small { display: block; color: var(--muted); font-size: 11.5px; }
.credit-bar { position: relative; height: 7px; overflow: hidden; border-radius: 4px; background: var(--line-2); }
.credit-bar .used { position: absolute; left: 0; height: 100%; background: #6aa77e; }
.credit-bar .proj { position: absolute; height: 100%; background: repeating-linear-gradient(45deg, #d99a45, #d99a45 4px, #e9b672 4px, #e9b672 8px); }
.credit-legend { display: flex; justify-content: space-between; margin: 6px 0 4px; font: 11px var(--mono); }
.sum-lines { display: grid; gap: 6px; max-height: 190px; margin-top: 14px; overflow-y: auto; }
.sum-line { display: flex; justify-content: space-between; gap: 8px; font-size: 12px; }
.sum-line b { font: 500 12px var(--mono); white-space: nowrap; }
.override-box { margin-top: 12px; padding: 12px; border: 1px dashed #e3c8a1; border-radius: 7px; background: #fffbf4; }
.override-box .section-title { margin-top: 0; }
.override-box .btn { margin: 8px 0 6px; }
.grn-head, .grn-row { display: grid; grid-template-columns: 2fr 1.1fr 1.1fr .7fr; gap: 8px; }
.grn-head { color: var(--muted); font: 500 10px var(--mono); text-transform: uppercase; }
.grn-row { margin-top: 7px; }
.epod-grid { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 22px; }
.geo { display: flex; align-items: center; gap: 12px; padding: 10px; border: 1px solid #d5e7da; border-radius: 7px; background: #f5faf6; }
.geo strong, .geo small { display: block; }
.geo small { color: var(--muted); font-size: 11.5px; }
.geo-map { position: relative; display: grid; flex: 0 0 auto; place-items: center; width: 64px; height: 44px; border: 1px solid #d5e2d8; border-radius: 5px; background: #eaf0eb linear-gradient(30deg, transparent 46%, #d3ddd5 47%, #d3ddd5 50%, transparent 51%) 0 0 / 20px 18px; }
.geo-map::after { content: ''; width: 9px; height: 9px; border: 2px solid #fff; border-radius: 50% 50% 50% 0; background: var(--orange); transform: rotate(-45deg); }
.sig-wrap { margin-top: 12px; padding: 9px; border: 1px solid var(--line); border-radius: 7px; }
.sig-head { display: flex; justify-content: space-between; font-size: 11.5px; font-weight: 600; }
.sig-pad { display: block; width: 100%; height: 92px; margin: 6px 0 2px; border: 1px dashed #c9d5cc; border-radius: 5px; background: #fcfdfc; cursor: crosshair; touch-action: none; }
.sig-pad.signed { border-style: solid; border-color: #9cc4a8; }
.pay-due { display: grid; gap: 2px; padding: 14px; border: 1px solid #d6e7da; border-radius: 8px; background: #f4faf6; }
.pay-due span, .pay-due small { color: var(--muted); font-size: 11.5px; }
.pay-due strong { color: var(--forest); font: 600 22px var(--mono); }

/* ---------- Credit control ---------- */
.watch-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 11px 4px; border-bottom: 1px solid var(--line-2); cursor: pointer; }
.watch-row:hover { background: #f8faf8; }
.watch-row strong, .watch-row small { display: block; }
.watch-row small { color: var(--muted); font-size: 11.5px; }
.rule-strip { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 14px; padding: 10px; border-radius: 6px; background: #fafbfa; color: var(--muted); font-size: 11px; }
.aging { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; height: 200px; }
.age-col { display: grid; grid-template-rows: 1fr auto auto; gap: 4px; text-align: center; }
.age-bar-wrap { display: flex; align-items: flex-end; justify-content: center; }
.age-bar { width: 70%; border-radius: 4px 4px 0 0; }
.age-bar.t0 { background: #8fc4a0; } .age-bar.t1 { background: #e1bb6d; } .age-bar.t2 { background: #df9a5a; } .age-bar.t3 { background: #d27550; } .age-bar.t4 { background: #b4483a; }
.age-col strong { font-size: 11.5px; }
.age-col span { color: var(--muted); font-size: 11px; }
.override { display: grid; grid-template-columns: minmax(0, 1.6fr) 1fr 1fr auto; gap: 12px; align-items: stretch; padding: 14px 0; border-top: 1px solid var(--line-2); }
.override:first-of-type { border-top: 0; }
.ovr-main strong, .ovr-main small { display: block; }
.ovr-main small { color: var(--muted); font-size: 11.5px; }
.ovr-top { display: flex; gap: 8px; align-items: center; margin-bottom: 4px; }
.override blockquote { margin: 7px 0; padding: 6px 10px; border-left: 3px solid #d7e4db; color: var(--ink-2); font-size: 12px; }
.key { display: grid; align-content: center; gap: 4px; padding: 12px; border: 1px dashed var(--line); border-radius: 7px; }
.key-title { color: var(--muted); font: 500 9.5px var(--mono); letter-spacing: .5px; }
.key.signed { border: 1px solid #cfe6d6; background: #f3faf5; color: var(--green); }
.key.rejected { border: 1px solid #f1cdc6; background: #fdf3f1; color: var(--red); }
.key.waiting { border-color: #e7cf9f; background: #fffaf0; }
.key small { color: var(--muted); font-size: 11px; }
.key-actions { display: flex; gap: 6px; }
.ovr-release { display: grid; align-content: center; }

/* ---------- Settlement ---------- */
.equation { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 18px; border: 1px solid var(--line); border-radius: 8px; background: #fafbfa; }
.equation div { flex: 1; text-align: center; }
.equation span { display: block; color: var(--muted); font-size: 11.5px; }
.equation strong { display: block; margin-top: 4px; font: 500 26px var(--mono); }
.equation em { color: #a7b1ab; font: normal 20px var(--mono); }
.eq-result { padding: 8px; border-radius: 7px; background: #e9f4ec; }
.eq-result strong { color: var(--forest); }
.settle-form { margin-top: 14px; }
.form-actions { display: flex; justify-content: flex-end; margin-top: 14px; }
.settle-result { margin-top: 16px; padding: 22px; border: 1px solid; border-radius: 8px; text-align: center; }
.settle-result.ok { border-color: #cfe6d6; background: #f4faf6; }
.settle-result.bad { border-color: #f1cdc6; background: #fdf5f3; }
.settle-result h3 { font-size: 17px; }
.settle-result p { margin: 4px 0 0; color: var(--muted); }
.big-check { display: grid; place-items: center; width: 42px; height: 42px; margin: 0 auto 10px; border-radius: 50%; background: #d9eee0; color: var(--green); font-size: 20px; font-weight: 700; }
.settle-result.bad .big-check { background: #f6d9d4; color: var(--red); }

/* ---------- Reports ---------- */
.waterfall { display: block; width: 100%; height: auto; max-height: 330px; }
.wf.total { fill: #2f6a52; } .wf.sub { fill: #5d9c78; } .wf.neg { fill: #dd9a78; } .wf.result { fill: #173c31; }
.wf-val { fill: var(--ink-2); font: 500 10.5px var(--mono); text-anchor: middle; }
.wf-lbl { fill: var(--muted); font: 11px var(--sans); text-anchor: middle; }
.mini-bar { display: inline-block; width: 60px; height: 5px; margin-right: 8px; overflow: hidden; border-radius: 4px; background: var(--line-2); vertical-align: middle; }
.mini-bar span { display: block; height: 100%; background: #5d9c78; }

/* ---------- Shipments ---------- */
.ship-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.ship-head h2 { margin: 4px 0 2px; font-size: 18px; }
.ship-head p { margin: 0; }
.ship-right { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.route { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); margin: 16px 0; }
.leg { position: relative; display: grid; justify-items: center; gap: 4px; padding: 0 4px; text-align: center; }
.leg:not(:last-child)::after { content: ''; position: absolute; top: 13px; left: calc(50% + 16px); right: calc(-50% + 16px); height: 2px; background: var(--line); }
.leg.done:not(:last-child)::after { background: #8cc3a0; }
.leg-dot { display: grid; place-items: center; width: 26px; height: 26px; border: 1px solid var(--line); border-radius: 50%; background: #fff; color: var(--muted); font: 500 11px var(--mono); }
.leg.done .leg-dot { border-color: var(--forest-2); background: var(--forest-2); color: #fff; }
.leg.next .leg-dot { border-color: #d6a44f; color: var(--amber); box-shadow: 0 0 0 3px var(--amber-bg); }
.leg-name { font-size: 11.5px; font-weight: 600; line-height: 1.25; }
.leg-date { color: var(--muted); font: 10.5px var(--mono); }
.ship-grid { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr) minmax(0, .9fr); gap: 16px; align-items: start; }
.landed { padding: 12px; border: 1px solid var(--line); border-radius: 7px; background: #fafbfa; }
.landed .totals { margin-top: 0; }

/* ---------- Toasts ---------- */
.toasts { position: fixed; z-index: 60; right: 20px; bottom: 20px; display: grid; gap: 8px; width: min(380px, calc(100vw - 32px)); }
.toast { padding: 12px 14px; border: 1px solid #cde3d3; border-left: 4px solid var(--green); border-radius: 7px; background: #fff; box-shadow: 0 10px 30px rgba(15, 28, 23, .16); font-size: 12.5px; animation: pop .18s ease; transition: opacity .35s, transform .35s; }
.toast.error { border-color: #f0cfc8; border-left-color: var(--red); color: #8f372b; }
.toast.out { opacity: 0; transform: translateY(6px); }

/* ---------- Responsive ---------- */
@media (max-width: 1180px) {
  .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .kpis .kpi:nth-child(n+4) { border-top: 1px solid var(--line); }
  .grid-2, .lanes { grid-template-columns: minmax(0, 1fr); }
  .order-builder { grid-template-columns: minmax(0, 1fr); overflow-y: auto; }
  .builder-right { border-top: 1px solid var(--line); border-left: 0; }
  .override { grid-template-columns: 1fr 1fr; }
  .ship-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .landed { grid-column: 1 / -1; }
  .ovr-main { grid-column: 1 / -1; }
  .trip-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .trip-stats div:nth-child(3) { border-right: 0; }
  .trip-stats div:nth-child(-n+3) { border-bottom: 1px solid var(--line); }
}
@media (max-width: 860px) {
  .shell { grid-template-columns: 64px minmax(0, 1fr); }
  .sidebar { padding: 16px 8px; }
  .brand-copy, .workspace span:not(.ws-icon), .nav-label, .walkthrough, .sync span:not(.sync-dot) { display: none; }
  .brand, .workspace { justify-content: center; padding: 0; border: 0; background: none; }
  .nav-link { justify-content: center; padding: 0; font-size: 0; }
  .nav-icon { font-size: 15px; }
  .nav-count { position: absolute; top: 2px; right: 2px; min-width: 16px; padding: 0 4px; font-size: 9px; }
  .nav-link.active::before { left: -8px; }
  .topbar { padding: 0 14px; }
  .role-copy, .demo-tag { display: none; }
  .page { padding: 18px 14px 30px; }
  .kpis, .kpis.four { grid-template-columns: 1fr 1fr; }
  .kpi { border-top: 1px solid var(--line); }
  .pipeline { flex-wrap: wrap; }
  .pipe-arrow { display: none; }
  .pipe-step { flex: 1 1 140px; }
  .split, .epod-grid { grid-template-columns: minmax(0, 1fr); }
  .card.flush, .card { overflow-x: auto; }
  .toolbar { flex-wrap: wrap; }
  .input.search { width: 100%; }
  .equation { flex-wrap: wrap; }
  .grid-3, .kv.three { grid-template-columns: 1fr; }
  .att-cta { display: none; }
  .ship-grid, .route { grid-template-columns: minmax(0, 1fr); }
  .route { gap: 8px; }
  .leg { grid-template-columns: 26px 1fr auto; justify-items: start; text-align: left; }
  .leg::after { display: none; }
  .ship-head { flex-wrap: wrap; }
  .ship-right { align-items: flex-start; }
  .fleet-row { grid-template-columns: minmax(0, 1fr) 34px auto; }
  .fleet-row .progress { display: none; }
  .page-head { flex-wrap: wrap; }
}
