/* Quote Hub's colour scheme (quote-builder app/globals.css): its brand blue for actions, its top-bar blue for the
   menu, white cards on a light grey page, the same text, line and status colours. Light only, as Quote Hub is.
   Chart series keep the validated categorical palette (Sydney / Melbourne / Brisbane). */
:root {
  color-scheme: light;
  --brand: #0a4d9c; --brand-dark: #073a75; --brand-tint: #e6eef8; --brand-ring: rgba(10, 77, 156, .18);
  --topbar: #1474bb;
  --surface-0: #f3f4f6;            /* the page */
  --surface-1: #ffffff;            /* cards, fields */
  --surface-2: #f3f4f6;            /* quiet fills: chips, hover rows */
  --th: #f8f9fa;                   /* table headers */
  --border: #e3e6ea; --border-strong: #d0d5db;
  --grid: #e9ecef;
  --text-primary: #1c1f23; --text-secondary: #3d434b; --text-muted: #5f6773;
  --accent: #0a4d9c;
  --series-8: #2a78d6;   /* Sydney   - categorical slot 1 */
  --series-3: #eb6834;   /* Melbourne - slot 2 */
  --series-4: #1baf7a;   /* Brisbane - slot 3 */
  --ref: #8a929c;
  --good: #1b6e43; --good-bg: #e6f4ec;
  --warn: #8a5300; --warn-bg: #fff4e0;
  --crit: #b42318; --crit-bg: #fdecec;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05); --shadow-md: 0 4px 12px rgba(16, 24, 40, .08); --shadow-lg: 0 16px 36px rgba(16, 24, 40, .18);
  --radius: 6px; --radius-lg: 10px; --ease: cubic-bezier(.2, .8, .2, 1);
  --ctl: 34px; --ctl-sm: 28px;
  --rail: 64px; --rail-open: 256px; --topbar-h: 48px;
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--surface-0); color: var(--text-primary); font-size: 14px; line-height: 1.45; -webkit-font-smoothing: antialiased; }
button, input, select { font: inherit; color: inherit; }
a { color: var(--accent); }

.chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px;
  background: var(--surface-2); color: var(--text-muted); font-size: 12px; font-weight: 600; white-space: nowrap; }
.chip.warn { background: var(--warn-bg); color: var(--warn); }
.chip.crit { background: var(--crit-bg); color: var(--crit); }
.chip.good { background: var(--good-bg); color: var(--good); }

/* ---------------------------------------------------------------- the menu (as Quote Hub's) */
.side { position: fixed; inset: 0 auto 0 0; z-index: 50; display: flex; flex-direction: column; background: var(--topbar); color: #fff; }
.side-top { height: 64px; flex-shrink: 0; display: flex; align-items: center; padding: 0 17px; }
.side-logo { display: flex; align-items: center; gap: 12px; height: 34px; color: #fff; text-decoration: none; white-space: nowrap; border-radius: var(--radius); }
.side-logo img { display: block; flex: none; border-radius: 7px; }
.side-name { font-weight: 700; font-size: 15px; letter-spacing: .1px; }
.side-name b { font-weight: 700; opacity: .75; margin-left: 2px; }
.side-nav { display: grid; align-content: start; gap: 2px; padding: 4px 10px; overflow-y: auto; scrollbar-width: none; }
.side-nav::-webkit-scrollbar { display: none; }
.side-foot { margin-top: auto; display: grid; gap: 2px; padding: 10px; border-top: 1px solid rgba(255, 255, 255, .2); }
.side-row { display: flex; align-items: center; gap: 2px; }
.side-row > a { flex: 1; min-width: 0; }
.side a.side-link { position: relative; display: flex; align-items: center; gap: 14px; height: 40px; padding: 0 12px; border-radius: 8px; color: rgba(255, 255, 255, .84);
  font-size: 14px; font-weight: 600; text-decoration: none; white-space: nowrap; transition: background-color .15s, color .15s; }
.side a.side-link .ic { width: 20px; height: 20px; flex-shrink: 0; vertical-align: 0; }
.side a.side-link:hover { background: rgba(255, 255, 255, .14); color: #fff; }
.side a.side-link[aria-current] { background: rgba(255, 255, 255, .22); color: #fff; }
.side a.side-link[aria-current]::before { content: ""; position: absolute; left: -10px; top: 9px; bottom: 9px; width: 3px; border-radius: 0 3px 3px 0; background: #fff; }
.side a:focus-visible { outline: 2px solid #fff; outline-offset: -2px; border-radius: 8px; }
.side .side-caret { margin-left: auto; display: grid; opacity: 0; transition: opacity .1s, transform .15s var(--ease); }
.side .side-caret .ic { width: 14px; height: 14px; }
.side .side-group.open .side-caret { transform: rotate(180deg); }
.side-group { display: grid; }
.side-sub { display: none; }
.side-sub a { display: flex; align-items: center; min-height: 30px; padding: 4px 10px; border-radius: 6px; color: rgba(255, 255, 255, .8); font-size: 13px; font-weight: 500;
  text-decoration: none; white-space: nowrap; line-height: 1.25; }
.side-sub a:hover { background: rgba(255, 255, 255, .12); color: #fff; }
.side-sub a[aria-current="page"] { background: rgba(255, 255, 255, .2); color: #fff; font-weight: 650; }
.mm-caret { display: none; }
.side-me { display: flex; align-items: center; gap: 12px; height: 48px; padding: 0 8px; color: #fff; white-space: nowrap; }
.me-mark { flex: none; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: rgba(255, 255, 255, .18); font-size: 12px; font-weight: 700; }
.side-me .who-text { display: grid; line-height: 1.2; }
.side-me .who-name { font-size: 13px; font-weight: 600; }
.side-me .who-role { font-size: 11.5px; color: rgba(255, 255, 255, .78); }
#userBox { display: grid; gap: 2px; }
#userBox[hidden] { display: none; }
.topbar { display: none; }
.mm-backdrop { position: fixed; inset: var(--topbar-h) 0 0; z-index: 45; background: rgba(16, 24, 40, .35); animation: fadein .15s var(--ease); }
.mm-backdrop[hidden] { display: none; }
@keyframes fadein { from { opacity: 0; } }

/* Desktop with a mouse: the rail, opening over the page after a moment's pointing (so passing over it on the way
   to the page's edge doesn't flick it open). */
@media (min-width: 901px) and (hover: hover) {
  .shell { padding-left: var(--rail); }
  .side { width: var(--rail); overflow: hidden; box-shadow: 1px 0 0 rgba(0, 0, 0, .08); transition: width .2s var(--ease) .08s, box-shadow .2s var(--ease) .08s; }
  .side:hover, .side:has(:focus-visible) { width: var(--rail-open); box-shadow: 10px 0 30px rgba(16, 24, 40, .22); transition-delay: .15s; }
  .side .nav-label, .side .who-text { opacity: 0; transition: opacity .1s; }
  .side:hover .nav-label, .side:has(:focus-visible) .nav-label, .side:hover .who-text, .side:has(:focus-visible) .who-text { opacity: 1; transition: opacity .16s .22s; }
  .side:hover .side-caret, .side:has(:focus-visible) .side-caret { opacity: .75; transition: opacity .16s .22s, transform .15s var(--ease); }
  .side:hover .side-group.open .side-sub, .side:has(:focus-visible) .side-group.open .side-sub {
    display: grid; gap: 1px; margin: 2px 0 6px 34px; padding-left: 10px; border-left: 1px solid rgba(255, 255, 255, .22); animation: subin .16s var(--ease); }
  .side-sub .nav-label { opacity: 1 !important; }
  .mm-backdrop { display: none; }
}
@keyframes subin { from { opacity: 0; transform: translateY(-3px); } }

/* Tablets, phones, narrow windows: the top bar, and the menu sliding in from the left under it. */
@media not all and (min-width: 901px) and (hover: hover) {
  .topbar { display: flex; align-items: center; gap: 8px; position: sticky; top: 0; z-index: 55; height: var(--topbar-h); padding: 0 16px 0 8px;
    background: var(--topbar); color: #fff; box-shadow: 0 1px 0 rgba(0, 0, 0, .08), 0 2px 6px rgba(16, 24, 40, .08); }
  .mm-btn { display: grid; place-items: center; width: 40px; height: 40px; padding: 0; border: 0; border-radius: var(--radius); background: transparent; color: #fff; cursor: pointer; }
  .mm-btn:hover, .mm-btn[aria-expanded="true"] { background: rgba(255, 255, 255, .16); }
  .mm-btn:focus-visible { outline: 2px solid #fff; outline-offset: 1px; }
  .mm-btn .ic { width: 22px; height: 22px; }
  .topbar-logo { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; font-weight: 700; font-size: 15px; }
  .topbar-logo b { opacity: .75; }
  .topbar-logo img { border-radius: 6px; }
  .side { top: var(--topbar-h); width: min(300px, 86vw); background: #fff; color: var(--text-primary); padding: 8px 8px calc(8px + env(safe-area-inset-bottom, 0px));
    box-shadow: 12px 0 28px rgba(16, 24, 40, .18); overflow-y: auto; overscroll-behavior: contain;
    transform: translateX(-105%); visibility: hidden; transition: transform .2s var(--ease), visibility 0s .2s; }
  .side.open { transform: none; visibility: visible; transition: transform .2s var(--ease); }
  .side-top { display: none; }
  .side-nav { padding: 0; overflow: visible; }
  .side-foot { padding: 8px 0 0; border-top-color: var(--border); }
  .side a.side-link { height: auto; min-height: 46px; color: var(--text-primary); font-size: 15.5px; }
  .side a.side-link .ic { color: var(--text-muted); }
  .side a.side-link:hover { background: var(--surface-2); color: var(--text-primary); }
  .side a.side-link[aria-current] { background: var(--brand-tint); color: var(--brand); }
  .side a.side-link[aria-current] .ic { color: var(--brand); }
  .side a.side-link[aria-current]::before { display: none; }
  .side a:focus-visible { outline-color: var(--brand); }
  .side .side-caret { display: none; }
  .mm-caret { display: grid; place-items: center; flex: none; width: 44px; height: 44px; padding: 0; border: 0; border-radius: var(--radius); background: transparent; color: var(--text-muted); cursor: pointer; }
  .mm-caret:hover { background: var(--surface-2); color: var(--text-primary); }
  .mm-caret .ic { transition: transform .15s var(--ease); }
  .side-group.open .mm-caret .ic { transform: rotate(180deg); }
  .side-group.open .side-sub { display: grid; gap: 1px; margin: 0 0 6px 44px; padding-left: 10px; border-left: 2px solid var(--border); }
  .side-sub a { min-height: 40px; font-size: 14.5px; color: var(--text-muted); }
  .side-sub a:hover { background: var(--surface-2); color: var(--text-primary); }
  .side-sub a[aria-current="page"] { color: var(--brand); background: var(--brand-tint); }
  .side-me { color: var(--text-primary); height: auto; min-height: 48px; }
  .me-mark { background: var(--brand-tint); color: var(--brand); }
  .side-me .who-role { color: var(--text-muted); }
  body.mm-open { overflow: hidden; }
}
@media (prefers-reduced-motion: reduce) { .side, .side *, .side *::before, .mm-backdrop { transition: none !important; animation: none !important; } }

/* The page bar: where you are, the data it is built on, and the plan it shows. */
.pagebar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 12px 16px; flex-wrap: wrap; padding: 10px 24px;
  background: var(--surface-1); border-bottom: 1px solid var(--border); box-shadow: var(--shadow); }
.pb-title { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.pb-title h1 { margin: 0; font-size: 18px; font-weight: 700; letter-spacing: -.01em; white-space: nowrap; }
.pb-crumb { font-size: 13px; font-weight: 600; color: var(--text-muted); white-space: nowrap; }
.pb-crumb::after { content: "›"; margin-left: 8px; }
.pb-crumb[hidden] { display: none; }
.pb-plan { margin-left: auto; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.pb-plan select { max-width: 240px; }
@media not all and (min-width: 901px) and (hover: hover) { .pagebar { top: var(--topbar-h); padding: 10px 16px; } }
@media (max-width: 760px) {
  .pagebar { position: static; }          /* on a phone only the blue bar stays put: the page gets the screen */
  .pagebar .bl { display: none; }
  .pb-plan label { display: none; }
  .pb-plan { margin-left: 0; width: 100%; }
  .pb-plan select { flex: 1; max-width: none; }
  #dataChip { order: 5; }
}

main { padding: 20px 24px 60px; max-width: 1560px; margin: 0 auto; }
section.tab { display: none; }
section.tab.active { display: block; }

.card { background: var(--surface-1); border: 1px solid var(--border); border-radius: var(--radius-lg);
  box-shadow: var(--shadow); padding: 18px 20px; }
.card h2 { font-size: 16px; margin: 0 0 4px; font-weight: 700; }
.card h3 { font-size: 11.5px; margin: 16px 0 6px; font-weight: 700; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: .06em; }
.sub { color: var(--text-muted); font-size: 12.8px; margin: 0 0 12px; line-height: 1.5; }
.muted { color: var(--text-muted); }
.grid { display: grid; gap: 16px; }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.plan-layout { display: grid; grid-template-columns: 380px minmax(0, 1fr); gap: 14px; align-items: start; }
@media (max-width: 1100px) { .g3 { grid-template-columns: 1fr; } .plan-layout { grid-template-columns: 1fr; } .g2 { grid-template-columns: 1fr; } }

/* site cards */
.site-card .name { display: flex; align-items: center; gap: 8px; font-weight: 650; font-size: 15px; }
.swatch { width: 10px; height: 10px; border-radius: 3px; display: inline-block; flex: none; }
.kpis { display: flex; gap: 22px; margin: 10px 0 2px; flex-wrap: wrap; }
.kpi .v { font-size: 26px; font-weight: 650; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.kpi .l { font-size: 12px; color: var(--text-secondary); }
.status { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.status.good { background: var(--good-bg); color: var(--good); }
.status.warn { background: var(--warn-bg); color: var(--warn); }
.status.crit { background: var(--crit-bg); color: var(--crit); }

/* charts */
.chart { width: 100%; position: relative; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart .axis text, .chart .lbl { fill: var(--text-secondary); font-size: 11px; }
.chart .gridline { stroke: var(--grid); stroke-width: 1; }
.chart .ref { stroke: var(--ref); stroke-width: 1.2; stroke-dasharray: 2 3; }
.chart .reflbl { fill: var(--text-muted); font-size: 10.5px; }
.chart .hover-line { stroke: var(--text-muted); stroke-width: 1; }
.legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 12px; color: var(--text-secondary); margin-top: 6px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend svg { overflow: visible; }
#tooltip { position: fixed; pointer-events: none; z-index: 50; background: var(--surface-1); color: var(--text-primary);
  border: 1px solid var(--border); border-radius: 6px; padding: 8px 10px; font-size: 12px; box-shadow: 0 4px 16px rgba(0,0,0,.14);
  display: none; min-width: 150px; }
#tooltip .t { font-weight: 650; margin-bottom: 4px; }
#tooltip .row { display: flex; justify-content: space-between; gap: 14px; font-variant-numeric: tabular-nums; }

/* tables */
.tablewrap { overflow: auto; max-height: 620px; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface-1); }
table { border-collapse: collapse; width: 100%; font-size: 12.8px; font-variant-numeric: tabular-nums; }
th, td { padding: 7px 10px; border-bottom: 1px solid var(--border); text-align: left; white-space: nowrap; }
th { background: var(--th); color: var(--text-muted); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em;
  position: sticky; top: 0; z-index: 1; }
td.num, th.num { text-align: right; }
tr.click { cursor: pointer; }
tr.click:hover td { background: #f7f9fc; }
td.over { color: var(--crit); font-weight: 650; }
td.tight { color: var(--warn); font-weight: 600; }
.desc { max-width: 320px; overflow: hidden; text-overflow: ellipsis; }

/* forms */
.field { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: center; margin: 7px 0; }
.field label { color: var(--text-secondary); font-size: 13px; }
.sitegrid { display: grid; grid-template-columns: 90px repeat(3, 1fr); gap: 6px 8px; align-items: center; font-size: 13px; }
.sitegrid .h { font-size: 12px; color: var(--text-secondary); font-weight: 600; }
input[type=number], input[type=text], input[type=password], input[type=date], input[type=time], select, textarea {
  background: var(--surface-1); color: var(--text-primary); border: 1px solid var(--border-strong); border-radius: var(--radius);
  padding: 5px 9px; min-width: 0; min-height: var(--ctl); transition: border-color .15s, box-shadow .15s; }
input:hover:not(:disabled):not(:focus), select:hover:not(:disabled):not(:focus), textarea:hover:not(:disabled):not(:focus) { border-color: #b9c0c9; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-ring); }
input:disabled, select:disabled, textarea:disabled { background: var(--surface-2); color: var(--text-muted); }
input[type=checkbox], input[type=radio] { accent-color: var(--brand); min-height: 0; }
select { appearance: none; padding-right: 28px; background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%235f6773' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 9px center; }
input[type=number]::-webkit-inner-spin-button, input[type=number]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
input[type=number] { -moz-appearance: textfield; }
input[type=number] { width: 78px; text-align: right; }
.sitegrid input[type=number] { width: 100%; }
button.link { background: none; border: 0; color: var(--accent); cursor: pointer; padding: 0; }
.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 10px; }
.toolbar input[type=text] { width: 240px; }
.drop { border: 2px dashed var(--border); border-radius: var(--radius); padding: 22px; text-align: center; color: var(--text-secondary); }
.drop.over { border-color: var(--accent); color: var(--accent); }
.progress { height: 6px; background: var(--surface-2); border-radius: 3px; overflow: hidden; margin: 8px 0; }
.progress > div { height: 100%; background: var(--brand); width: 0; transition: width .3s; }
.note { background: var(--brand-tint); border-radius: var(--radius); padding: 10px 12px; color: var(--text-secondary); font-size: 12.8px; line-height: 1.5; }
.note.warn { background: var(--warn-bg); color: var(--warn); }
.note.crit { background: var(--crit-bg); color: var(--crit); }
.banner { margin-bottom: 14px; }
.flex { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.right { margin-left: auto; }
.small { font-size: 12px; }
kbd { background: var(--surface-2); border: 1px solid var(--border); border-radius: 4px; padding: 0 5px; font-size: 11.5px; }
.detail { margin-top: 14px; }
.po-over select { width: 110px; }
.overlay { position: fixed; inset: 0; background: rgba(16, 24, 40, .35); z-index: 60; display: none; align-items: flex-start; justify-content: center; padding-top: 6vh; }
.overlay.show { display: flex; }
.overlay .card { width: min(1100px, 94vw); max-height: 86vh; overflow: auto; box-shadow: var(--shadow-lg); }
.suggest { position: absolute; z-index: 30; background: var(--surface-1); border: 1px solid var(--border); border-radius: 6px;
  box-shadow: 0 6px 18px rgba(0,0,0,.14); max-height: 260px; overflow: auto; min-width: 320px; }
.suggest div { padding: 6px 10px; cursor: pointer; font-size: 12.8px; }
.suggest div:hover { background: var(--surface-2); }

/* suggested POs */
.sg-settings { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 4px 18px; margin-top: 10px; }
.sg-settings .field { margin: 3px 0; }
details > summary { cursor: pointer; }
.flagchip { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 600; margin: 1px 3px 1px 0; background: var(--surface-2); color: var(--text-muted); white-space: nowrap; }
.flagchip.crit { background: var(--crit-bg); color: var(--crit); }
.flagchip.warn { background: var(--warn-bg); color: var(--warn); }
.flagchip.good { background: var(--good-bg); color: var(--good); }
tr.detail-row > td { background: var(--surface-0); padding: 10px 14px; white-space: normal; }
tr.detail-row table { background: var(--surface-1); }
.fillbar { display: inline-block; width: 54px; height: 7px; border-radius: 4px; background: var(--surface-2); vertical-align: middle; margin-right: 6px; overflow: hidden; }
.fillbar > span { display: block; height: 100%; background: var(--brand); }

.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 1350px) { .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 760px) { .g4 { grid-template-columns: 1fr; } }
.site-card.total { border-color: var(--text-muted); }
.chart .ptitle { fill: var(--text-secondary); font-size: 11px; font-weight: 600; }
tr.unticked td:not(:first-child) { opacity: .5; }
/* SKU forecast: totals with their split by location */
.bysite { display: flex; justify-content: flex-end; gap: 8px; font-size: 11px; color: var(--text-secondary); margin-top: 1px; }
.bysite span { display: inline-flex; align-items: center; gap: 3px; }
.dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; flex: none; }
td.trend { cursor: crosshair; }
#tooltip .minis { display: flex; gap: 12px; }
#tooltip .mini { width: 168px; font-size: 11.5px; line-height: 1.35; font-variant-numeric: tabular-nums; }
#tooltip .mini svg { display: block; margin: 2px 0; }
/* column sort and filter */
th.sortable { cursor: pointer; user-select: none; }
th.sortable:hover { color: var(--text-primary); }
th .arrow { margin-left: 4px; font-size: 10px; color: var(--accent); }
tr.filters th { top: var(--th1, 30px); padding: 3px 5px; }
tr.filters th { text-transform: none; letter-spacing: 0; background: var(--surface-1); }
tr.filters input { width: 100%; min-width: 54px; min-height: 26px; font-size: 11.5px; padding: 2px 6px; font-weight: 400; text-align: left; }
.tfoot { position: sticky; bottom: 0; left: 0; background: var(--surface-1); padding: 5px 10px; border-top: 1px solid var(--border); }
/* drill-down */
.kchips { display: flex; gap: 8px; flex-wrap: wrap; margin: 0 0 10px; }
.kchip { display: inline-flex; flex-direction: column; align-items: flex-start; gap: 1px; padding: 8px 12px; border: 1px solid var(--border);
  border-radius: 8px; background: var(--surface-1); cursor: pointer; font-size: 12px; color: var(--text-muted); text-align: left; box-shadow: var(--shadow); }
.kchip b { font-size: 17px; font-weight: 700; color: var(--text-primary); font-variant-numeric: tabular-nums; }
.kchip:hover { border-color: var(--brand); }
/* sign-in and account */
.brand-icon { display: block; border-radius: 5px; }
.login-page main.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 16px; max-width: none; }
.login-card { width: min(380px, 100%); display: grid; gap: 8px; padding: 22px; }
.login-card label { font-size: 13px; color: var(--text-secondary); margin-top: 4px; }
.login-card input { width: 100%; padding: 8px 10px; }
.login-card .btn { margin-top: 8px; padding: 8px 12px; }
.login-brand { display: flex; gap: 12px; align-items: center; margin-bottom: 8px; }
.login-brand h1 { font-size: 18px; margin: 0; }
.login-brand p { margin: 2px 0 0; }
.login-error { background: var(--crit-bg); color: var(--crit); border-radius: 6px; padding: 8px 10px; font-size: 12.8px; margin: 4px 0 0; }
.overlay .card.narrow { width: min(440px, 94vw); }
.pw-form { display: grid; gap: 10px; }
.pw-form label { display: grid; gap: 4px; font-size: 13px; color: var(--text-secondary); }
.pw-form input { width: 100%; padding: 7px 9px; }
code.temp { background: var(--surface-2); border: 1px solid var(--border); border-radius: 4px; padding: 1px 6px; font-size: 13px; user-select: all; }
.note.good { background: var(--good-bg); color: var(--good); }
/* sold items and seasonality */
.kchip.k-crit { border-color: var(--crit); }
.kchip.k-crit b { color: var(--crit); }
.kchip.k-warn { border-color: var(--warn); }
.kchip.k-good b { color: var(--good); }
td.strong { font-weight: 650; }

/* storage and CNY tabs */
img.thumb { width: 44px; height: 44px; object-fit: contain; border-radius: 4px; background: #fff; display: block; border: 1px solid var(--border); }
#tab-cny .sg-settings input[type=date] { width: 150px; }
#cnyImpactTable td[rowspan] { vertical-align: top; white-space: nowrap; }
#stTable td.wrap, #stTable td.desc { max-width: 240px; min-width: 170px; white-space: normal; }
#stTable td.wrap .small { line-height: 1.35; }
input.setval { border-color: var(--accent); }
#flAreas input { width: 100%; }
.sgrid { display: grid; grid-template-columns: auto auto 1fr; gap: 5px 14px; align-items: baseline; margin: 10px 0 8px; }
.sgrid .h { font-size: 11px; color: var(--text-muted); }
.sgrid .l { font-size: 12px; color: var(--text-secondary); }
.sgrid .v1 { font-size: 24px; font-weight: 650; letter-spacing: -.02em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.sgrid .v { font-size: 16px; font-weight: 650; font-variant-numeric: tabular-nums; white-space: nowrap; }
.sgrid small { font-size: 11px; color: var(--text-muted); font-weight: 400; letter-spacing: 0; }
.sgrid .crit-t { color: var(--crit); }
.crit-t { color: var(--crit); }

/* ================================================================ UI kit */
.ic { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; vertical-align: -3px; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 4px; }

/* buttons, as Quote Hub's: .btn outlined (white, brand text) · .primary solid brand · .danger red · .danger.solid · .icon
   (square, icon only) · .ghost (no chrome) · .sm */
button.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; line-height: 1.2; white-space: nowrap; font-weight: 600;
  min-height: var(--ctl); background: var(--surface-1); color: var(--brand); border: 1px solid var(--border-strong); border-radius: var(--radius);
  padding: 6px 13px; cursor: pointer; box-shadow: var(--shadow); transition: background-color .15s, border-color .15s, color .15s, box-shadow .15s, transform .12s var(--ease); }
button.btn:hover:not(:disabled) { background: var(--brand-tint); border-color: var(--brand); }
button.btn:active:not(:disabled) { transform: translateY(1px) scale(.98); box-shadow: none; }
button.btn:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--brand-ring); }
button.btn.primary { background: var(--brand); color: #fff; border-color: var(--brand); }
button.btn.primary:hover:not(:disabled) { background: var(--brand-dark); border-color: var(--brand-dark); box-shadow: var(--shadow-md); }
button.btn.danger { color: var(--crit); }
button.btn.danger:hover:not(:disabled) { background: var(--crit-bg); border-color: var(--crit); }
button.btn.danger.solid { background: var(--crit); border-color: var(--crit); color: #fff; }
button.btn.danger.solid:hover:not(:disabled) { background: #9b1c14; border-color: #9b1c14; }
button.btn.icon { padding: 6px; min-width: var(--ctl); }
button.btn.ghost { background: none; border-color: transparent; box-shadow: none; color: var(--text-muted); }
button.btn.ghost:hover:not(:disabled) { background: var(--surface-2); border-color: transparent; color: var(--text-primary); }
button.btn.sm { padding: 3px 9px; font-size: 12.5px; min-height: var(--ctl-sm); }
button.btn.icon.sm { padding: 3px; min-width: var(--ctl-sm); }
button.btn:disabled { opacity: .45; cursor: not-allowed; box-shadow: none; }
button.link { display: inline-flex; align-items: center; gap: 3px; font-weight: 600; }
button.link .ic { width: 13px; height: 13px; }

/* headings carry their explanation behind an info button */
.card h2, .card h3 { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
button.info { background: none; border: 0; padding: 2px; margin: 0; color: var(--text-muted); cursor: help; display: inline-flex; border-radius: 50%; }
button.info .ic { width: 15px; height: 15px; }
button.info:hover, button.info[aria-expanded="true"] { color: var(--accent); }
.tipsrc { margin: 0; }
#infopop { position: fixed; z-index: 70; display: none; max-width: 300px; padding: 7px 10px; border-radius: 7px; font-size: 12.5px; line-height: 1.45;
  background: #1c1f23; color: #fff; box-shadow: var(--shadow-lg); pointer-events: none; }
#infopop.wide { max-width: min(460px, calc(100vw - 16px)); background: var(--surface-1); color: var(--text-primary); border: 1px solid var(--border);
  padding: 12px 14px; pointer-events: auto; font-size: 12.8px; }
#infopop.wide .sub, #infopop.wide p { margin: 0 0 6px; color: var(--text-secondary); font-size: 12.8px; }
#infopop.wide p:last-child { margin-bottom: 0; }
th.hastip { text-decoration: underline dotted var(--text-muted); text-underline-offset: 3px; cursor: help; }
[data-tip]:not(button):not(th):not(.kchip):not(.pill) { cursor: help; }
.lede { margin: 0 0 10px; font-size: 12.5px; color: var(--text-secondary); }
.hint { margin: 8px 0 0; font-size: 12px; color: var(--text-muted); display: flex; align-items: center; gap: 6px; }

/* filter chips: funnel shows on hover, .on while applied */
.kchip { position: relative; }
.kchip .ic.f { position: absolute; top: 6px; right: 7px; width: 12px; height: 12px; opacity: 0; transition: opacity .12s; }
.kchip:hover .ic.f, .kchip.on .ic.f { opacity: .75; }
.kchip.on { border-color: var(--brand); box-shadow: inset 0 0 0 1px var(--brand); background: var(--brand-tint); }
.kchip.static { cursor: default; }
.kchip.static:hover { border-color: var(--border); }
.kchip span { padding-right: 12px; }

/* date pills (CNY) */
.pill { display: inline-flex; align-items: baseline; gap: 6px; padding: 4px 10px; border-radius: 999px; background: var(--surface-2); font-size: 12px; color: var(--text-secondary); }
.pill b { color: var(--text-primary); font-weight: 650; }
.pill.warn { background: var(--warn-bg); color: var(--warn); }
.pill.warn b { color: var(--warn); }
.pill .ic { width: 13px; height: 13px; align-self: center; }

/* switch */
label.switch { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 13px; }
label.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
label.switch > span { width: 32px; height: 18px; border-radius: 9px; background: var(--border); position: relative; transition: background .15s; flex: none; }
label.switch > span::after { content: ''; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 2px rgba(0,0,0,.3); }
label.switch input:checked + span { background: var(--accent); }
label.switch input:checked + span::after { transform: translateX(14px); }
label.switch input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }

/* busy: a thin moving bar along the top of the card */
.card { position: relative; }
.card.is-busy::before { content: ''; position: absolute; left: 0; right: 0; top: 0; height: 2px; border-radius: var(--radius) var(--radius) 0 0;
  background: linear-gradient(90deg, transparent, var(--accent), transparent); background-size: 40% 100%; background-repeat: no-repeat; animation: busy 1.1s linear infinite; }
@keyframes busy { from { background-position: -40% 0; } to { background-position: 140% 0; } }
@media (prefers-reduced-motion: reduce) { .card.is-busy::before { animation: none; background: var(--accent); opacity: .5; } }

/* notices and dialogs */
#toasts { position: fixed; right: 16px; bottom: 16px; z-index: 80; display: grid; gap: 8px; max-width: min(420px, calc(100vw - 32px)); }
.toast { display: flex; align-items: flex-start; gap: 8px; padding: 9px 8px 9px 12px; border-radius: 8px; background: var(--surface-1); border: 1px solid var(--border);
  box-shadow: var(--shadow-lg); font-size: 13px; line-height: 1.4; animation: tin .18s ease-out; }
.toast > .ic { margin-top: 2px; color: var(--accent); }
.toast.good > .ic { color: var(--good); } .toast.crit { border-color: var(--crit); } .toast.crit > .ic { color: var(--crit); }
.toast span { flex: 1; }
.toast .btn.icon { padding: 2px; margin: -2px 0; }
@keyframes tin { from { transform: translateY(6px); opacity: 0; } }
dialog.ask { border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface-1); color: var(--text-primary); padding: 20px 22px; width: min(420px, 92vw); box-shadow: var(--shadow-lg); }
dialog.ask::backdrop { background: rgba(16, 24, 40, .35); }
dialog.ask h2 { font-size: 15px; margin: 0 0 8px; display: flex; align-items: center; gap: 8px; }
dialog.ask input[type=text] { width: 100%; margin-top: 8px; }
dialog.ask .small { color: var(--text-secondary); line-height: 1.45; margin-top: 4px; }

.drop { display: flex; align-items: center; justify-content: center; gap: 8px; flex-wrap: wrap; }
.status .ic { width: 13px; height: 13px; }
@media (max-width: 760px) { main { padding: 12px !important; } .card { padding: 14px; } }
@media (max-width: 640px) {
  .kchips { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kchip b { font-size: 15.5px; }
}

tr.sel td { background: var(--surface-2); }
#tlMsg { width: 100%; font: 12.5px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace; padding: 10px; border: 1px solid var(--border); border-radius: 6px; background: var(--surface-0); color: var(--text-primary); resize: vertical; }
#tlChart svg { display: block; width: 100%; height: auto; }

/* Ask: AI chat about the data */
.askcard { display: flex; flex-direction: column; min-height: calc(100vh - 170px); }
.chatlog { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 16px; padding: 14px 2px; min-height: 260px;
  max-height: calc(100vh - 300px); }
.msg { display: flex; gap: 10px; align-items: flex-start; }
.msg.user { justify-content: flex-end; }
.msg.user .bubble { background: var(--surface-2); border-radius: 12px 12px 3px 12px; padding: 9px 13px; max-width: min(720px, 85%);
  line-height: 1.45; overflow-wrap: anywhere; }
.msg.bot .avatar { flex: none; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center;
  background: var(--surface-2); color: var(--accent); }
.msg.bot .bubble { flex: 1; min-width: 0; max-width: 1000px; line-height: 1.5; padding-top: 3px; overflow-wrap: anywhere; }
.steps { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 8px; }
.step { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; padding: 2px 9px 2px 7px; border-radius: 999px;
  background: var(--surface-2); color: var(--text-secondary); }
.step .ic { width: 13px; height: 13px; }
.step.ok .ic { color: var(--good); }
.step.run .ic { animation: askspin 1s linear infinite; }
.step.bad { background: var(--warn-bg); color: var(--warn); }
@keyframes askspin { to { transform: rotate(360deg); } }
.md > :last-child { margin-bottom: 0; }
.md p { margin: 0 0 8px; }
.md ul, .md ol { margin: 0 0 8px; padding-left: 22px; }
.md li { margin: 2px 0; }
.md h4 { font-size: 14px; margin: 12px 0 6px; }
.md code, .chatempty code, #askSettings code { background: var(--surface-2); border-radius: 4px; padding: 1px 5px; font-size: 12.5px; }
.md pre { background: var(--surface-2); border-radius: 6px; padding: 10px 12px; overflow: auto; white-space: pre-wrap; }
.md pre code { padding: 0; background: none; }
.mdtable { overflow-x: auto; margin: 4px 0 10px; border: 1px solid var(--border); border-radius: 6px; max-width: 100%; }
.mdtable table { width: max-content; min-width: 40%; }
.mdtable th { position: static; }
.mdtable th, .mdtable td { overflow-wrap: normal; word-break: normal; }
.mdtable td { white-space: normal; min-width: 72px; max-width: 340px; }
.mdtable td:first-child, .mdtable td.num { white-space: nowrap; }
.mdtable tr:last-child td { border-bottom: 0; }
.typing::after { content: '…'; }
.msg .foot { display: flex; align-items: center; gap: 8px; margin-top: 6px; flex-wrap: wrap; }
.chatbox { display: flex; gap: 8px; align-items: flex-end; border-top: 1px solid var(--border); padding-top: 12px; }
.chatbox[hidden], .chatbox [hidden] { display: none; }
.chatbox textarea { flex: 1; resize: vertical; min-height: 46px; max-height: 220px; background: var(--surface-1); color: inherit;
  border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; font: inherit; line-height: 1.4; }
.chatbox textarea:focus-visible { outline: 2px solid var(--accent); outline-offset: -1px; }
.chatbox .btn { height: 38px; }
.ideas { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 10px; }
.ideas[hidden] { display: none; }
.ideas button { background: var(--surface-1); border: 1px solid var(--border); border-radius: 999px; padding: 6px 12px; cursor: pointer;
  font-size: 12.8px; color: var(--text-secondary); text-align: left; }
.ideas button:hover, .ideas button:focus-visible { border-color: var(--accent); color: var(--text-primary); }
.chatempty { margin: auto; text-align: center; color: var(--text-secondary); max-width: 560px; padding: 10px; }
.chatempty > .ic { width: 30px; height: 30px; color: var(--accent); }
.card .chatempty h3 { display: block; margin: 6px 0; font-size: 16px; color: var(--text-primary); text-transform: none; letter-spacing: 0; }
.chatempty.setup ol { padding-left: 20px; line-height: 1.5; }
.chatempty.setup code.temp { font-size: 12px; overflow-wrap: anywhere; }
#askWho[hidden] { display: none; }
#askWho .ic { width: 13px; height: 13px; color: var(--accent); }
@media (max-width: 640px) {
  .msg.bot .avatar { display: none; }
  .msg.user .bubble { max-width: 92%; }
  .askcard { min-height: calc(100vh - 150px); }
  .chatlog { max-height: none; }
}
@media (prefers-reduced-motion: reduce) { .step.run .ic { animation: none; } }
dialog.devsign { max-width: min(520px, calc(100vw - 32px)); }
dialog.devsign ol { padding-left: 20px; line-height: 1.6; }
dialog.devsign a .ic { width: 13px; height: 13px; vertical-align: -2px; }
code.devcode { font-size: 22px; letter-spacing: .08em; padding: 6px 12px; background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 6px; user-select: all; }
.ic.spin { animation: askspin 1.2s linear infinite; width: 13px; height: 13px; vertical-align: -2px; }
@media (prefers-reduced-motion: reduce) { .ic.spin { animation: none; } }

/* Shipments (Navia) */
.big { font-size: 22px; font-weight: 650; font-variant-numeric: tabular-nums; line-height: 1.1; }
.shfacts { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px 18px; margin: 8px 0 4px; }
.milestones { list-style: none; padding: 0; margin: 4px 0 8px; display: flex; flex-wrap: wrap; gap: 6px 18px; }
.milestones li { display: inline-flex; align-items: center; gap: 6px; color: var(--text-secondary); }
.milestones li .ic { width: 14px; height: 14px; }
.milestones li.done { color: var(--text-primary); }
.milestones li.done .ic { color: var(--good); }
tr.click.sel td { background: var(--surface-2); }
.shsites { display: flex; flex-wrap: wrap; gap: 10px; }
.shsites > .card { flex: 1 1 230px; padding: 10px 14px; }
.seg { display: inline-flex; border: 1px solid var(--border-strong); border-radius: var(--radius); overflow: hidden; background: var(--surface-1); }
.seg button { background: var(--surface-1); border: 0; padding: 0 12px; min-height: var(--ctl-sm); cursor: pointer; font-size: 12.5px; font-weight: 600; color: var(--text-muted); }
.seg button + button { border-left: 1px solid var(--border-strong); }
.seg button:hover { color: var(--text-primary); background: var(--surface-2); }
.seg button[aria-pressed="true"] { background: var(--brand-tint); color: var(--brand); }
.shcol { cursor: default; outline: none; }
.shclick .shcol { cursor: pointer; }
.shcol:hover path, .shcol:hover rect:not(.hit), .shcol:focus-visible path, .shcol:focus-visible rect:not(.hit) { filter: brightness(1.15); }
.shcol:focus-visible .hit { stroke: var(--accent); stroke-width: 1.5; }

/* inventory pages (inventory.js) */
.kchip.static { cursor: default; }
.kchip.static:hover { border-color: var(--border); }
.warn-t { color: var(--warn); }
.good-t { color: var(--good); }
[id^="tab-inv-"] td.wrap, .overlay td.wrap { white-space: normal; min-width: 200px; max-width: 320px; }
.overlay .card.wide { width: min(1240px, 96vw); }
dialog.ask.wide { width: min(860px, 94vw); }
.ovgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px 12px; margin: 8px 0; }
.ovgrid label { display: grid; gap: 3px; font-size: 12px; color: var(--text-secondary); }
.ovgrid label.flex { display: flex; align-items: center; }
.ovgrid input, .ovgrid select { width: 100%; }
table.kv td { padding: 4px 8px 4px 0; border: 0; }
table.matrix { border-collapse: separate; border-spacing: 3px; }
table.matrix th { background: none; position: static; text-align: left; font-size: 12.5px; text-transform: none; letter-spacing: 0; color: var(--text-primary); }
table.matrix th .small { font-weight: 500; }
table.kv td { font-size: 13px; }
table.matrix td { min-width: 96px; border-radius: 6px; padding: 7px 9px; vertical-align: top; border: 1px solid var(--border); }
td.cellbtn { cursor: pointer; background: color-mix(in srgb, var(--accent) calc(var(--heat) * 34%), var(--surface-1)); }
td.cellbtn:hover { outline: 2px solid var(--accent); outline-offset: -1px; }
.fcgrid td, .fcgrid th { white-space: nowrap; }
.fcgrid tr.adjrow td { background: var(--surface-2); }
.fcgrid input.adjin { width: 62px; padding: 3px 5px; text-align: right; }
.fcgrid td:first-child, .fcgrid th:first-child { position: sticky; left: 0; background: var(--surface-1); z-index: 2; }
.fcgrid tr.adjrow td:first-child { background: var(--surface-2); }
.ordlayout { grid-template-columns: minmax(320px, 420px) minmax(0, 1fr); align-items: start; }
@media (max-width: 1100px) { .ordlayout { grid-template-columns: 1fr; } }
ul.notes { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
ul.notes li { background: var(--surface-2); border-radius: 6px; padding: 7px 10px; font-size: 12.8px; }
ul.notes .link { margin-left: 8px; font-size: 11.5px; }
ul.hist { list-style: none; padding: 0; margin: 0; display: grid; gap: 3px; max-height: 220px; overflow: auto; }
.colpick { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 2px 10px; max-height: 260px; overflow: auto; padding: 4px; border: 1px solid var(--border); border-radius: 6px; }
.fitbars { display: flex; gap: 18px; flex-wrap: wrap; margin: 2px 0 6px; }
.fitbars > div { display: flex; gap: 8px; align-items: center; }
.top5 ol { padding-left: 18px; margin: 4px 0 0; display: grid; gap: 4px; }
.top5 li b.right { float: right; }
.top5 li .desc { max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top5 h3 { margin-top: 4px; }
@media (max-width: 640px) {
  .fcgrid input.adjin { width: 52px; }
  table.matrix td { min-width: 64px; padding: 5px; }
}
.card h3 .small, .card h3 .muted { text-transform: none; letter-spacing: 0; font-weight: 500; }

/* sign-in page: Quote Hub's blue behind the card */
.login-page { background: linear-gradient(160deg, var(--topbar) 0%, var(--brand) 100%); }
.login-page .login-card { box-shadow: var(--shadow-lg); border: 0; }
.login-page .login-brand img { border-radius: 8px; }
.login-card .btn.primary { min-height: 40px; }

/* pop-ups never wider than the screen; on a phone they fill it and scroll inside */
.overlay .card { min-width: 0; max-width: 96vw; }
@media (max-width: 640px) {
  .overlay { padding-top: 0; align-items: stretch; }
  .overlay .card, .overlay .card.wide, .overlay .card.narrow { width: 100vw; max-width: 100vw; max-height: 100dvh; border-radius: 0; border: 0; }
  .overlay .card > .flex:first-child h2 { flex: 1 1 100%; font-size: 15px; }
  dialog.ask, dialog.ask.wide { width: calc(100vw - 16px); max-width: calc(100vw - 16px); padding: 16px; }
}

/* grid columns may shrink below their content, so a wide table scrolls instead of widening the page */
.grid > * { min-width: 0; }
@media (max-width: 760px) {
  .card table:not(.matrix) { display: block; overflow-x: auto; }
  .tablewrap table, .mdtable table, .fcgrid table { display: table; }
  table.matrix { display: block; overflow-x: auto; }
}
.plan-layout > * { min-width: 0; }
.seg { max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.seg button { flex: none; }
@media (max-width: 760px) {
  .sitegrid { grid-template-columns: 76px repeat(3, minmax(0, 1fr)); }
  .field { grid-template-columns: minmax(0, 1fr) auto; }
  .field select { max-width: 190px; }
}

/* ================================================================ Material 3 layer (NetStox)
   Quote Hub's colours on Material 3's structure: tonal surfaces instead of lines, large rounded cards on
   a tinted page, filled KPI cards, sentence-case titles, pill buttons and segmented controls. */
:root {
  --md-surface: #f4f6fa;                /* the page */
  --md-container-lowest: #ffffff;       /* cards */
  --md-container-low: #f3f6fa;          /* filled cards, panels */
  --md-container: #edf1f7;
  --md-container-high: #e6ebf3;
  --md-primary-container: #dbe7f7; --md-on-primary-container: #0a2f5e;
  --md-error-container: #fce8e7; --md-on-error-container: #8c1d18;
  --md-warn-container: #fff1d6; --md-on-warn-container: #6b4100;
  --md-good-container: #e2f3e8; --md-on-good-container: #0f5132;
  --md-outline-variant: #dde3eb;
  --md-elev-1: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px 1px rgba(16, 24, 40, .04);
  --md-elev-2: 0 1px 2px rgba(16, 24, 40, .08), 0 2px 6px 2px rgba(16, 24, 40, .06);
  --surface-0: var(--md-surface);
  --surface-2: var(--md-container-low);
  --border: var(--md-outline-variant);
  --radius-lg: 16px;
}
body { background: var(--md-surface); }
main { padding: 24px 28px 64px; }
.grid { gap: 20px; }

/* cards: elevated, no hard edge */
.card { border: 0; border-radius: 16px; box-shadow: var(--md-elev-1); padding: 20px 24px; }
.card h2 { font-size: 17px; font-weight: 650; letter-spacing: -.005em; }
.card h3 { font-size: 13.5px; font-weight: 650; text-transform: none; letter-spacing: 0; color: var(--text-secondary); margin: 18px 0 8px; }
.card > h3:first-child, .card > div > h3:first-child { margin-top: 2px; }
.sub { font-size: 13px; }
.card + .card, section.tab > .card + .card { margin-top: 20px; }
.overlay .card { border-radius: 20px; box-shadow: var(--shadow-lg); }

/* KPI tiles: Material "filled cards", equal widths in a grid */
.kchips { display: grid; grid-template-columns: repeat(auto-fill, minmax(188px, 1fr)); gap: 12px; margin: 4px 0 16px; }
.kchip { border: 0; border-radius: 14px; background: var(--md-container-low); box-shadow: none; padding: 12px 16px 13px; gap: 3px; min-height: 84px;
  justify-content: flex-start; font-size: 12.5px; color: var(--text-muted); position: relative; overflow: hidden; }
.kchip > span:first-child, .kchip > .kl { font-weight: 600; color: var(--text-secondary); font-size: 12.5px; }
.kchip b { font-size: 22px; font-weight: 650; letter-spacing: -.01em; line-height: 1.15; margin: 1px 0; }
.kchip:not(.static):hover { background: var(--md-container); border: 0; }
.kchip:not(.static)::after { content: ""; position: absolute; inset: 0; border-radius: inherit; background: var(--brand); opacity: 0; transition: opacity .15s; pointer-events: none; }
.kchip:not(.static):hover::after { opacity: .05; }
.kchip.on { background: var(--md-primary-container); box-shadow: inset 0 0 0 2px var(--brand); }
.kchip.on b { color: var(--md-on-primary-container); }
.kchip.k-crit { background: var(--md-error-container); border: 0; }
.kchip.k-crit b, .kchip.k-crit > span:first-child { color: var(--md-on-error-container); }
.kchip.k-warn { background: var(--md-warn-container); border: 0; }
.kchip.k-warn b, .kchip.k-warn > span:first-child { color: var(--md-on-warn-container); }
.kchip.k-good { background: var(--md-good-container); }
.kchip.k-good b, .kchip.k-good > span:first-child { color: var(--md-on-good-container); }
.kchip .kic { position: absolute; top: 12px; right: 12px; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center;
  background: rgba(10, 77, 156, .09); color: var(--brand); }
.kchip .kic .ic { width: 16px; height: 16px; }
.kchip.k-crit .kic { background: rgba(179, 38, 30, .1); color: var(--md-on-error-container); }
.kchip.k-warn .kic { background: rgba(138, 83, 0, .1); color: var(--md-on-warn-container); }
.kchip.k-good .kic { background: rgba(27, 110, 67, .1); color: var(--md-on-good-container); }
.kchip:has(.kic) > span:first-child { padding-right: 34px; }
.kchip.static:hover { border: 0; }
.kchip .ic.f { top: 10px; right: 10px; }
/* a row of tiles straight on the page, above the cards */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; margin: 0 0 20px; }
.tiles .kchip { background: var(--md-container-lowest); box-shadow: var(--md-elev-1); min-height: 96px; padding: 14px 18px; }
.tiles .kchip.k-crit { background: var(--md-error-container); } .tiles .kchip.k-warn { background: var(--md-warn-container); } .tiles .kchip.k-good { background: var(--md-good-container); }

/* panels inside a card: tonal areas that group related facts */
.panel { background: var(--md-container-low); border-radius: 14px; padding: 14px 16px; }
.panel > h3:first-child { margin-top: 0; }
.panels { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }

/* card header: title (with its ⓘ), and actions on the right */
.card-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.card-head h2 { margin: 0; }
.card-head .right { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.card-icon { width: 36px; height: 36px; border-radius: 12px; display: grid; place-items: center; background: var(--md-primary-container); color: var(--brand); flex: none; }
.card-icon .ic { width: 18px; height: 18px; }

/* tables: calmer headers, rounded frame, no hard grid */
.tablewrap { border: 1px solid var(--md-outline-variant); border-radius: 12px; }
th { text-transform: none; letter-spacing: 0; font-size: 12px; font-weight: 650; color: var(--text-muted); background: var(--md-container-low); }
th, td { border-bottom-color: #edf0f4; }
td { padding: 8px 10px; }
tr.filters th { background: var(--md-container-lowest); }

/* buttons and switches: Material's pill shapes, Quote Hub's colours */
button.btn { border-radius: 999px; padding: 6px 16px; }
button.btn.icon { border-radius: 50%; padding: 6px; }
button.btn.sm { padding: 3px 12px; }
button.btn:not(.primary):not(.danger):not(.ghost) { background: var(--md-container-lowest); }
button.btn.tonal { background: var(--md-primary-container); color: var(--md-on-primary-container); border-color: transparent; box-shadow: none; }
button.btn.tonal:hover:not(:disabled) { background: #cddcf2; border-color: transparent; }
.seg { border-radius: 999px; border-color: var(--border-strong); }
.seg button { padding: 0 14px; min-height: 32px; }
.seg button[aria-pressed="true"] { background: var(--md-primary-container); color: var(--md-on-primary-container); }
.seg button[aria-pressed="true"]::before { content: "✓"; margin-right: 5px; font-weight: 700; }
input[type=number], input[type=text], input[type=password], input[type=date], input[type=time], select, textarea { border-radius: 8px; }
.chip, .status, .flagchip { border-radius: 8px; }
.note { border-radius: 12px; background: var(--md-primary-container); color: var(--md-on-primary-container); }
.note.warn { background: var(--md-warn-container); color: var(--md-on-warn-container); }
.note.crit { background: var(--md-error-container); color: var(--md-on-error-container); }
.note.good { background: var(--md-good-container); color: var(--md-on-good-container); }
.pagebar { box-shadow: none; border-bottom: 1px solid var(--md-outline-variant); }
.pb-title h1 { font-size: 20px; font-weight: 650; }
details.card-settings { margin-top: 12px; }
details.card-settings > summary { font-weight: 600; color: var(--brand); list-style: none; display: inline-flex; align-items: center; gap: 6px; }
details.card-settings > summary::-webkit-details-marker { display: none; }
@media (max-width: 760px) { main { padding: 14px 12px 48px !important; } .card { padding: 16px; border-radius: 14px; } .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; } .tiles .kchip { min-height: 84px; padding: 12px 14px; } }
.grid.top5 { grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); }
.grid.top5 .card { padding: 18px 20px; }
.top5 ol { list-style: none; padding: 0; margin: 0; display: grid; gap: 0; counter-reset: t; }
.top5 li { counter-increment: t; display: grid; grid-template-columns: 22px 1fr auto; align-items: baseline; column-gap: 8px; padding: 8px 0; border-top: 1px solid #edf0f4; }
.top5 li:first-child { border-top: 0; }
.top5 li::before { content: counter(t); grid-row: span 2; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: 11px; font-weight: 700;
  background: var(--md-container); color: var(--text-secondary); align-self: start; }
.top5 li b.right { float: none; justify-self: end; font-variant-numeric: tabular-nums; }
.top5 li .desc { grid-column: 2 / 4; }
.top5 .card-head { margin-bottom: 6px; }
.top5 .card-icon { width: 30px; height: 30px; border-radius: 10px; }
.pagetools { margin: -4px 0 16px; }
.grid > .card + .card, .grid > .card { margin-top: 0; }
.panel .chart { background: var(--md-container-lowest); border-radius: 10px; padding: 6px 4px 2px; }
.panel table.kv td { padding: 5px 8px 5px 0; }
.panel ul.notes li { background: var(--md-container-lowest); }
.panel .tablewrap, .panel table.small { background: var(--md-container-lowest); border-radius: 10px; }

/* NetStox: the wordmark, its X the Verdex X (brand colours on white; white on the blue bars) */
.wordmark { display: inline-flex; align-items: baseline; font-weight: 750; letter-spacing: -.01em; white-space: nowrap; }
.wm-x { width: .84em; height: .84em; margin-left: .03em; align-self: baseline; overflow: visible; }
.wm-x .xg { fill: #505251; } .wm-x .xb { fill: #1274BA; }
.side .wordmark, .topbar .wordmark { color: #fff; }
.side .wm-x .xg, .topbar .wm-x .xg { fill: rgba(255, 255, 255, .72); }
.side .wm-x .xb, .topbar .wm-x .xb { fill: #fff; }
.side-name { font-size: 18px; }
.side-logo img { border-radius: 8px; box-shadow: 0 1px 3px rgba(0, 0, 0, .15); }
.topbar-logo .wordmark { font-size: 17px; }
@media not all and (min-width: 901px) and (hover: hover) { .side .wordmark { color: var(--text-primary); } .side .wm-x .xg { fill: #505251; } .side .wm-x .xb { fill: #1274BA; } }
.login-brand h1 { font-size: 24px; }
#ordStatus button { padding: 0 9px; font-size: 12px; }
#ordStatus button[aria-pressed="true"]::before { content: none; }
@media (min-width: 1101px) { .ordlayout { grid-template-columns: minmax(340px, 440px) minmax(0, 1fr); } }
