/* Colours follow the approved demo v0.5. */
:root {
  --bg: #f4f5f7; --card: #fff; --ink: #1c2433; --mute: #667085; --line: #e2e5ea;
  --nav: #14213d; --acc: #0f766e; --red: #b42318; --redbg: #fdecea; --amb: #a15c07; --ambbg: #fff4e0;
}
* { box-sizing: border-box; }
body { margin: 0; font: 14px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; color: var(--ink); background: var(--bg); }
[hidden] { display: none !important; }
.bar { display: flex; align-items: center; gap: 12px; padding: 10px 20px; background: var(--nav); color: #fff; }
.brand { font-weight: 600; letter-spacing: .2px; }
.env { font-size: 11px; font-weight: 700; text-transform: uppercase; padding: 2px 8px; border-radius: 10px; background: var(--ambbg); color: var(--amb); }
.spacer { flex: 1; }
.who { opacity: .85; font-size: 13px; }
main.center { max-width: 640px; margin: 48px auto; padding: 0 16px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 24px 28px; }
.card h1 { margin: 0 0 8px; font-size: 22px; }
.card.error { border-color: var(--red); background: var(--redbg); }
.mute { color: var(--mute); }
button { font: inherit; cursor: pointer; }
.primary { background: var(--acc); color: #fff; border: 0; border-radius: 6px; padding: 8px 16px; }
.link { background: none; border: 0; color: #fff; text-decoration: underline; padding: 0; }

/* Daily sandbox refresh banner (staging): green ok, amber warn, red stop. */
.syncbanner { padding: 8px 20px; font-size: 13px; border-bottom: 1px solid var(--line); }
.syncbanner.ok { background: #e6f5ec; color: #067647; }
.syncbanner.warn { background: var(--ambbg); color: var(--amb); }
.syncbanner.stop { background: var(--redbg); color: var(--red); font-weight: 600; }
.syncbanner details { margin-top: 4px; font-weight: 400; }
.syncbanner ul { margin: 4px 0 0; padding-left: 18px; }

/* Shell: side navigation + content (layout follows demo v0.5) */
.layout { display: flex; min-height: calc(100vh - 44px); }
.sidenav { width: 220px; flex: none; background: var(--card); border-right: 1px solid var(--line); padding: 12px 0; }
.sidenav a { display: block; padding: 8px 20px; color: var(--ink); text-decoration: none; font-size: 13.5px; }
.sidenav a:hover { background: var(--bg); }
.sidenav a.active { background: var(--bg); color: var(--acc); font-weight: 600; border-left: 3px solid var(--acc); padding-left: 17px; }
.content { flex: 1; padding: 24px; max-width: 1100px; }
.content .card { margin-bottom: 16px; }
@media (max-width: 720px) {
  .layout { flex-direction: column; }
  .sidenav { width: auto; display: flex; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--line); padding: 0; }
  .sidenav a { white-space: nowrap; padding: 10px 14px; }
  .sidenav a.active { border-left: 0; border-bottom: 3px solid var(--acc); padding-left: 14px; }
  .content { padding: 16px; }
}

/* Supply-chain screens (Stage 2, PR 4), following demo v0.5 */
:root { --acc2: #e3f3f1; --grn: #067647; --grnbg: #e6f5ec; --blu: #175cd3; --blubg: #eaf2ff; }
.content.wide { max-width: none; }
.head h1 { margin: 0 0 4px; font-size: 22px; }
.head p { margin: 0 0 10px; }
h2 { font-size: 16px; margin: 0 0 10px; }
.small { font-size: 12px; }
.red { color: var(--red); }
.flt { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 14px; }
.flt input[type=search], .flt select { font: inherit; padding: 6px 10px; border: 1px solid var(--line); border-radius: 6px; background: #fff; min-width: 220px; }
.flt button, .back { font: inherit; padding: 6px 12px; border: 1px solid var(--line); border-radius: 6px; background: #fff; }
.back { margin-bottom: 12px; }
.chip { display: inline-block; border-radius: 10px; padding: 0 7px; font-size: 11.5px; font-weight: 600; white-space: nowrap; vertical-align: middle; }
.chip.info { background: var(--blubg); color: var(--blu); }
.chip.block { background: var(--redbg); color: var(--red); }
.chip.wait { background: var(--ambbg); color: var(--amb); }
.kanban { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 8px; align-items: flex-start; }
.col { min-width: 190px; width: 190px; background: #eceef2; border-radius: 8px; padding: 6px; }
.col h3 { font-size: 12px; margin: 2px 4px 6px; color: #3b4555; display: flex; justify-content: space-between; }
.oc { display: block; width: 100%; text-align: left; background: #fff; border: 1px solid var(--line); border-radius: 7px; padding: 7px 8px; margin-bottom: 6px; font-size: 12.5px; color: var(--ink); }
.oc:hover { border-color: var(--acc); }
.oc.blk { border-left: 3px solid var(--red); }
.oc .t { font-weight: 600; }
.oc .m { color: var(--mute); font-size: 11.5px; }
.oc .m.red { color: var(--red); }
.clock { height: 6px; background: #e6e8ec; border-radius: 3px; position: relative; margin: 4px 0 2px; }
.clock i { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 3px; background: var(--acc); }
.clock i.late { background: var(--red); }
.facts { display: grid; grid-template-columns: 160px 1fr; gap: 4px 12px; margin: 12px 0; }
.facts dt { color: var(--mute); }
.facts dd { margin: 0; }
.tablewrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 13px; }
th, td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { font-size: 12px; color: var(--mute); font-weight: 600; }
td.n, th.n { text-align: right; font-variant-numeric: tabular-nums; }
.trail { margin: 0; padding-left: 18px; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; margin-bottom: 16px; }
.content .kpis .card { margin: 0; padding: 14px 16px; }
.kpi .l { font-size: 12px; color: var(--mute); }
.kpi .v { font-size: 26px; font-weight: 700; margin: 2px 0; }
.hb { display: flex; align-items: center; gap: 8px; margin: 4px 0; }
.hb .lab { width: 230px; font-size: 12.5px; }
.hb .tr { flex: 1; background: #eef0f3; border-radius: 3px; height: 14px; position: relative; }
.hb .tr i { position: absolute; left: 0; top: 0; bottom: 0; background: var(--acc); border-radius: 3px; }
.hb .val { width: 140px; font-size: 12px; text-align: right; color: var(--mute); }
@media (max-width: 720px) { .hb .lab { width: 130px; } .hb .val { width: 90px; } .facts { grid-template-columns: 1fr; } }
.tabs { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 10px; }
.tabs button { font: inherit; font-size: 13px; padding: 6px 12px; border: 1px solid var(--line); border-radius: 6px; background: #fff; }
.tabs button.on { background: var(--acc); color: #fff; border-color: var(--acc); }
table.matrix td, table.matrix th { padding: 3px 5px; font-size: 11.5px; text-align: center; }
table.matrix td:first-child, table.matrix th:first-child { text-align: left; position: sticky; left: 0; background: #fff; }
table.matrix td.yes { color: var(--grn); }
table.matrix td.no { background: var(--redbg); color: var(--red); }
/* Stage 3: actions on orders */
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 12px; }
.actions input[type=text] { flex: 1 1 220px; font: inherit; padding: 6px 10px; border: 1px solid var(--line); border-radius: 6px; }
.actions button, .btns button { font: inherit; font-size: 13px; padding: 6px 12px; border: 1px solid var(--acc); border-radius: 6px; background: var(--acc); color: #fff; }
.btns { display: inline-flex; gap: 6px; }
button.ghost { background: #fff !important; color: var(--acc) !important; }
button.danger { color: var(--red) !important; border-color: var(--red) !important; }
button:disabled { opacity: .5; cursor: not-allowed; }
.chip.ok { background: #e7f6ee; color: #146c43; }
.chip.bad { background: var(--redbg); color: var(--red); }
.chip.warn { background: var(--ambbg); color: var(--amb); margin-left: 6px; }
tr.click { cursor: pointer; }
tr.click:hover td { background: #f6f8fb; }
.card h3 { font-size: 14px; margin: 16px 0 6px; }
button.linkbtn { border: 0; background: none; padding: 0; color: var(--acc); text-decoration: underline; font: inherit; }
.field { display: grid; gap: 4px; margin: 10px 0; }
.field input, .field textarea { font: inherit; font-size: 13px; padding: 6px 10px; border: 1px solid var(--line); border-radius: 6px; width: 100%; box-sizing: border-box; }
.field textarea { font-family: ui-monospace, monospace; font-size: 12px; }
.field.row2 { grid-template-columns: minmax(140px, 220px) 1fr 1fr; align-items: center; }
@media (max-width: 640px) { .field.row2 { grid-template-columns: 1fr; } }
input.cell { font: inherit; font-size: 12px; padding: 3px 6px; border: 1px solid var(--line); border-radius: 4px; width: 100%; min-width: 60px; box-sizing: border-box; }
ul.checklist { list-style: none; padding-left: 0; }
ul.checklist li { margin: 4px 0; }
.actions select { font: inherit; padding: 6px; border: 1px solid var(--line); border-radius: 6px; }
