/* SweAgro Kontrollrum / Leverantörsportal (issue #125) — Nordic minimal, HIG-inspired light scheme.
 *
 * Owner-approved final visual revision (PR #141): "Stockholmsvit" canvas #fcfcfa, every main card pure
 * #fff with a hairline #eef2ee edge and a soft 0 6px 20px shadow, #f7f8f5 only for small secondary
 * surfaces, ink #18231e / muted #5f6b64, squarer corners (cards 12 px, nested 10 px, buttons and inputs
 * 10 px; status pills stay round). Deep brilliant accents with a restrained top highlight: green #16a34a
 * (gloss #21c463 -> #178a46), light green #bcefc0, orange #ffb020 (#ffc14d -> #f59e0b), red #ff5a5f
 * (#ff7a7f -> #e25555), blue #4a90ff (#6db7ff -> #3b82f6) on icon discs, flow connectors and the donut.
 * No warm beige / dirty grey surfaces. Vivid accents are decorative fills next to text; text that sits
 * ON a colour (buttons, pips, tinted chips) uses the darker AA tones below. State colour is used
 * ONLY for the three operational tones: GREEN (flyter), ORANGE (väntar / bevaka) and
 * RED (åtgärda, real problems only). Every tone is also carried by an icon + text, never
 * colour alone. All text/background token pairs are WCAG AA (>= 4.5:1, checked in
 * tests/test_order_portal_ui_design.py). Breakpoints: phone < 600 px (four-tab bottom bar, single
 * column dashboard, 2 x 2 KPI cards, vertical order flow), tablet 600-999 px (bottom bar, two-column
 * dashboard, horizontal flow; four KPI cards from 768 px), desktop >= 1000 px (persistent left
 * sidebar), wide >= 1280 px (three-column dashboard). Touch targets >= 44 px; iPhone safe areas
 * respected; reduced motion honoured. Delivery chart slices use a separate categorical identity set
 * (--c-*), never the state tones, and always carry a legend label + count. */
:root{
  color-scheme:light;
  --bg:#fcfcfa;--bg2:#f7f8f5;--card:#fff;--fill:#f7f8f5;--sep:#eef2ee;--line:#dfe6df;--track:#e9efe9;
  --ink:#18231e;--ink2:#46524c;--ink3:#5f6b64;
  /* text-bearing green (white text >= 4.5:1); the vivid #16a34a is a decorative accent below */
  --brand:#15803d;--brand-2:#147a3d;--brand-ink:#fff;--sage:#e9f9ec;--sage-ink:#0f6a39;
  --g:#11713d;--g-bg:#e9f9ec;--g-fill:#16a34a;
  --o:#8a4b00;--o-bg:#fff4dc;--o-fill:#b85a00;
  --r:#b8323a;--r-bg:#ffeced;--r-fill:#d63f45;
  /* vivid owner accents: decorative fills only (discs, connectors, donut), always next to text */
  --a-green:#16a34a;--a-lime:#bcefc0;--a-blue:#4a90ff;--a-orange:#ffb020;--a-red:#ff5a5f;
  --radius:12px;--radius-s:10px;--radius-c:10px;--tap:44px;
  --shadow:0 0 0 1px #eef2ee,0 6px 20px #1018140d;
  --shadow-hi:0 0 0 1px #e4ebe4,0 10px 26px #10181414;
  --gloss:linear-gradient(180deg,#ffffff3d 0,#ffffff0f 48%,#ffffff00 52%);
  --side:252px;
  --c-packing:#ffb020;--c-booking:#4a90ff;--c-labels:#a855f7;--c-pickup:#0891b2;--c-transit:#4ade80;--c-delivered:#16a34a;
  --c-cancelled:#c3ccc6;
  font-family:-apple-system,BlinkMacSystemFont,"SF Pro Text","Segoe UI",Roboto,Helvetica,Arial,sans-serif;
  color:var(--ink);background:var(--bg);-webkit-text-size-adjust:100%;-webkit-font-smoothing:antialiased;
  line-height:1.4;
}
*{box-sizing:border-box}
/* The hidden attribute always wins over component display rules (e.g. .field{display:block} used to
 * show the login one-time-code step before the password step). */
[hidden]{display:none!important}
html,body{margin:0;min-height:100%;background:var(--bg)}
body{overscroll-behavior-y:none}
button,input,select,textarea{font:inherit;color:inherit}
button{-webkit-tap-highlight-color:transparent}
svg.i{width:22px;height:22px;flex:none;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}
svg.i.sm{width:17px;height:17px}svg.i.lg{width:30px;height:30px}

/* --- frame -------------------------------------------------------------------------------- */
.app{min-height:100vh;padding-bottom:calc(84px + env(safe-area-inset-bottom));
  padding-left:env(safe-area-inset-left);padding-right:env(safe-area-inset-right)}
.envbar{display:flex;gap:7px;align-items:center;justify-content:center;background:var(--o-bg);color:var(--o);
  font-size:12px;font-weight:650;letter-spacing:.1px;padding:5px 14px;padding-top:calc(5px + env(safe-area-inset-top));
  text-align:center;line-height:1.3}
.envbar svg.i{width:14px;height:14px}
.navbar{position:sticky;top:0;z-index:4;display:grid;grid-template-columns:minmax(64px,1fr) auto minmax(64px,1fr);
  align-items:center;min-height:44px;padding:0 8px;background:#fcfcfae0;backdrop-filter:saturate(1.4) blur(18px);
  -webkit-backdrop-filter:saturate(1.4) blur(18px);border-bottom:1px solid transparent;transition:border-color .15s}
.app>.navbar:first-child{padding-top:calc(2px + env(safe-area-inset-top))}
.navbar.scrolled{border-bottom-color:var(--sep)}
/* Top-level pages: brand top bar (phone / tablet) with the side-only destination ("Mer"); hidden next to
 * the desktop sidebar, which already carries the brand and every destination. */
.topbar{position:sticky;top:0;z-index:4;display:flex;align-items:center;justify-content:space-between;gap:8px;min-height:52px;
  padding:4px 6px 4px 16px;background:#fcfcfae0;backdrop-filter:saturate(1.4) blur(18px);-webkit-backdrop-filter:saturate(1.4) blur(18px);
  border-bottom:1px solid transparent;transition:border-color .15s}
.app>.topbar:first-child{padding-top:calc(4px + env(safe-area-inset-top))}
.topbar.scrolled{border-bottom-color:var(--sep)}
.topbar .wordmark img.logo{height:30px}
.topbar .wordmark b{font-size:16px}
.topbar .more{color:var(--ink2);padding:0}
.topbar .more.on{color:var(--brand);background:var(--sage)}
.topbar+.page{padding-top:6px}
.navbar .ttl{font-weight:650;font-size:16px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:56vw;
  opacity:0;transition:opacity .15s}
.navbar.scrolled .ttl{opacity:1}
.navbar .l{justify-self:start}.navbar .r{justify-self:end;display:flex;gap:2px}
.iconbtn{display:inline-flex;align-items:center;justify-content:center;gap:2px;min-width:var(--tap);min-height:var(--tap);
  border:0;background:none;color:var(--brand-2);border-radius:var(--radius-c);cursor:pointer;padding:0 8px 0 4px;font-weight:600;font-size:16px}
.iconbtn:hover{background:var(--bg2)}
.iconbtn:active{background:var(--line)}
.page{max-width:720px;margin:0 auto;padding:0 16px 28px;animation:pagein .2s ease-out}
@keyframes pagein{from{opacity:.5;transform:translateY(6px)}to{opacity:1;transform:none}}
.large{font-size:32px;line-height:1.1;font-weight:720;letter-spacing:-.7px;margin:6px 2px 6px;overflow-wrap:anywhere}
.kicker{font-size:13px;font-weight:600;color:var(--ink3);margin:2px 2px 0}
.kicker::first-letter{text-transform:uppercase}
.lead{color:var(--ink2);font-size:15px;margin:2px 2px 16px;max-width:60ch}
h2.sec{font-size:17px;font-weight:650;color:var(--ink);letter-spacing:-.2px;margin:28px 4px 10px}
.sec-hd{display:flex;align-items:center;justify-content:space-between;gap:8px;margin:28px 0 8px}
.sec-hd h2.sec{margin:0 4px}
.link{display:inline-flex;align-items:center;gap:2px;min-height:var(--tap);padding:0 6px 0 10px;border:0;background:none;
  color:var(--brand-2);font-weight:600;font-size:15px;cursor:pointer;border-radius:var(--radius-c);text-decoration:none}
.link:hover{background:var(--bg2)}
.quiet{color:var(--ink3);font-size:13px}
.quiet svg.i{vertical-align:-3px}
.mono{font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;font-size:12px;word-break:break-all}
.num{font-variant-numeric:tabular-nums}

/* --- brand -------------------------------------------------------------------------------- */
/* The official corporate logo is shown exactly as vendored (app/order_shipping/brand.py: verified file +
 * provenance), never recoloured, cropped or redrawn; only its height is set. Without a verified file
 * the brand is plain text. */
.wordmark{display:flex;align-items:center;gap:10px;min-width:0}
img.logo{display:block;width:auto;height:36px;max-width:100%;flex:none;object-fit:contain}
.wordmark .logo+span b{position:absolute!important;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}
.wordmark b{display:block;font-size:17px;font-weight:720;letter-spacing:-.3px;line-height:1.1;color:var(--ink)}
.wordmark small{display:block;font-size:12px;font-weight:600;color:var(--ink3);line-height:1.2}

/* --- tab bar (phone / tablet) / sidebar (desktop) ------------------------------------------ */
.tabbar{position:fixed;left:0;right:0;bottom:0;z-index:5;display:grid;grid-auto-flow:column;grid-auto-columns:1fr;
  padding:4px max(6px,env(safe-area-inset-right)) calc(4px + env(safe-area-inset-bottom)) max(6px,env(safe-area-inset-left));
  background:#ffffffeb;backdrop-filter:saturate(1.4) blur(18px);-webkit-backdrop-filter:saturate(1.4) blur(18px);
  border-top:1px solid var(--sep)}
.tabbar button{position:relative;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:3px;
  min-height:52px;border:0;background:none;color:var(--ink3);font-size:11px;font-weight:600;cursor:pointer;padding:4px 0 2px;
  border-radius:var(--radius-c)}
.tabbar button.on{color:var(--brand)}
.tabbar button.on svg.i{stroke-width:2.2}
.tabbar .pip{position:absolute;top:2px;left:calc(50% + 6px);min-width:18px;height:18px;border-radius:9px;padding:0 5px;
  font-size:11px;line-height:18px;color:#fff;font-weight:700;text-align:center}
.pip.RED{background:var(--r-fill)}.pip.ORANGE{background:var(--o-fill)}
.side-brand,.side-foot{display:none}
.tabbar .side-only{display:none}

/* --- cards and grouped lists ------------------------------------------------------------- */
.group{background:var(--card);border-radius:var(--radius);overflow:hidden;box-shadow:var(--shadow)}
.group+.group{margin-top:12px}
.row{display:flex;align-items:center;gap:12px;width:100%;min-height:56px;padding:12px 16px;border:0;background:none;
  text-align:left;cursor:default;position:relative;font-size:15px}
.group>.row:not(:last-child)::after{content:"";position:absolute;left:60px;right:0;bottom:0;height:1px;background:var(--sep)}
.group>.row.noicon:not(:last-child)::after{left:16px}
button.row,a.row{cursor:pointer;color:inherit;text-decoration:none}
button.row:hover,a.row:hover{background:#f7f8f5}
button.row:active,a.row:active{background:var(--fill)}
.row .ic{width:32px;height:32px;border-radius:10px;display:flex;align-items:center;justify-content:center;flex:none;
  background:var(--fill);color:var(--ink2)}
.row .ic.GREEN,.row .ic.ORANGE,.row .ic.RED,.tile.GREEN .ic,.tile.ORANGE .ic,.tile.RED .ic{color:#fff;
  background:var(--gloss),linear-gradient(180deg,var(--d1),var(--d2));box-shadow:inset 0 1px 0 #ffffff66,0 4px 10px -6px var(--dg)}
.row .ic.GREEN,.tile.GREEN .ic,.hero.GREEN .big{--d1:#21c463;--d2:#178a46;--dg:#16a34a99}
.row .ic.ORANGE,.tile.ORANGE .ic,.hero.ORANGE .big{--d1:#ffc14d;--d2:#f59e0b;--dg:#ffb02099}
.row .ic.RED,.tile.RED .ic,.hero.RED .big{--d1:#ff7a7f;--d2:#e25555;--dg:#ff5a5f99}
.row .bd{flex:1;min-width:0}
.row .t{font-size:15px;font-weight:600;line-height:1.3;overflow:hidden;text-overflow:ellipsis}
.row .s{font-size:13px;color:var(--ink2);margin-top:2px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.row .v{font-size:14px;color:var(--ink2);text-align:right;white-space:nowrap}
.row .v b{display:block;color:var(--ink);font-weight:650}
.row .v .count{display:inline-block;min-width:28px;padding:2px 9px;border-radius:999px;background:var(--fill);color:var(--ink);
  font-weight:700;text-align:center}
.row .ic.RED~.v .count{background:var(--r-bg);color:var(--r)}
.row .ic.ORANGE~.v .count{background:var(--o-bg);color:var(--o)}
.row .chev{color:#b4bdb7;display:flex}
.empty{padding:30px 18px;text-align:center;color:var(--ink3);font-size:15px}
.empty svg{display:block;margin:0 auto 10px;color:var(--g)}
.card{background:var(--card);border-radius:var(--radius);padding:18px;box-shadow:var(--shadow)}
.card+.card{margin-top:12px}
.card>h2{font-size:19px;margin:0 0 8px;letter-spacing:-.3px}

/* --- tone primitives ---------------------------------------------------------------------- */
.pill{display:inline-flex;align-items:center;gap:5px;border-radius:999px;padding:4px 11px 4px 8px;font-size:13px;font-weight:650;
  white-space:nowrap;line-height:18px;background:var(--fill);color:var(--ink2)}
.pill svg.i{width:14px;height:14px;stroke-width:2.3}
.pill.GREEN{background:var(--g-bg);color:var(--g);box-shadow:inset 0 0 0 1px var(--a-lime)}
.pill.ORANGE{background:var(--o-bg);color:var(--o);box-shadow:inset 0 0 0 1px #ffdf9e}
.pill.RED{background:var(--r-bg);color:var(--r);box-shadow:inset 0 0 0 1px #ffc6c8}
.dot{width:10px;height:10px;border-radius:50%;flex:none}
.dot.GREEN{background:var(--g-fill);box-shadow:0 0 0 3px #16a34a26}.dot.ORANGE{background:var(--a-orange);box-shadow:0 0 0 3px #ffb02033}
.dot.RED{background:var(--a-red);box-shadow:0 0 0 3px #ff5a5f2e}

/* --- glossy accent discs ------------------------------------------------------------------ */
/* Icon discs on KPI cards and flow stages: vivid owner accent as a top -> bottom gloss gradient with a soft
 * top highlight, a hairline inner edge and a restrained coloured glow. Always next to a text label; .soft is
 * the quiet zero state (never an alarm colour at 0). */
.disc{display:flex;align-items:center;justify-content:center;flex:none;border-radius:50%;color:#fff;
  background:var(--gloss),linear-gradient(180deg,var(--d1),var(--d2));
  box-shadow:inset 0 1px 0 #ffffff73,inset 0 -1px 1px #0000001a,0 5px 12px -6px var(--dg)}
.disc svg.i{stroke-width:2.1}
.disc.a-green{--d1:#21c463;--d2:#178a46;--dg:#16a34aa6}
.disc.a-lime{--d1:#d6f7d8;--d2:#bcefc0;--dg:#bcefc0cc;color:var(--sage-ink)}
.disc.a-blue{--d1:#6db7ff;--d2:#3b82f6;--dg:#4a90ffa6}
.disc.a-orange{--d1:#ffc14d;--d2:#f59e0b;--dg:#ffb020a6}
.disc.a-red{--d1:#ff7a7f;--d2:#e25555;--dg:#ff5a5fa6}
.disc.soft{background:var(--fill);color:var(--ink3);box-shadow:inset 0 0 0 1px var(--sep)}

/* --- hero status card --------------------------------------------------------------------- */
.hero{display:flex;align-items:center;gap:16px;background:var(--card);border-radius:var(--radius);padding:20px;box-shadow:var(--shadow);
  border:0;width:100%;text-align:left;color:inherit;font-size:15px}
button.hero{cursor:pointer}
button.hero:hover{box-shadow:var(--shadow-hi)}
.hero .big{width:56px;height:56px;border-radius:50%;display:flex;align-items:center;justify-content:center;flex:none}
.hero .big svg.i{width:28px;height:28px;stroke-width:2}
.hero.GREEN .big,.hero.ORANGE .big,.hero.RED .big{color:#fff;background:var(--gloss),linear-gradient(180deg,var(--d1),var(--d2));
  box-shadow:inset 0 1px 0 #ffffff73,0 8px 18px -8px var(--dg)}
.hero{flex-wrap:wrap}
.hero .bd{flex:1 1 170px;min-width:0}
.hero .t{font-size:20px;font-weight:700;letter-spacing:-.4px;line-height:1.2}
.hero .s{font-size:14px;color:var(--ink2);margin-top:3px;white-space:normal}
.hero .go{display:inline-flex;align-items:center;gap:4px;min-height:var(--tap);padding:0 14px 0 16px;border-radius:var(--radius-c);
  background:var(--brand);color:var(--brand-ink);font-weight:650;font-size:15px;white-space:nowrap;flex:none}
.hero .go svg.i{width:16px;height:16px}
.hero.row::after{display:none}

/* --- metric tiles ------------------------------------------------------------------------- */
.tiles{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}
.tile{display:flex;flex-direction:column;gap:8px;align-items:flex-start;background:var(--card);border-radius:var(--radius);
  padding:16px;border:0;text-align:left;cursor:pointer;min-height:104px;position:relative;color:inherit;box-shadow:var(--shadow)}
div.tile{cursor:default}
.tile:active{transform:scale(.985)}
.tile .ic{width:34px;height:34px;border-radius:var(--radius-s);display:flex;align-items:center;justify-content:center;background:var(--fill);color:var(--ink2)}
.tile .n{font-size:28px;font-weight:700;letter-spacing:-.6px;line-height:1}
.tile .c{font-size:13px;color:var(--ink2);font-weight:600;line-height:1.25}
.tile.RED .n{color:var(--r)}
.tile.zero .ic{background:var(--fill);color:var(--ink3);box-shadow:inset 0 0 0 1px var(--sep)}.tile.zero .n{color:var(--ink3)}

.money{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));background:var(--card);border-radius:var(--radius);overflow:hidden;
  box-shadow:var(--shadow)}
.money>div{padding:16px;min-width:0}
.money>div+div{box-shadow:inset 1px 0 0 var(--sep)}
.money .c{font-size:13px;color:var(--ink3);font-weight:600}
.money .n{font-size:19px;font-weight:700;letter-spacing:-.3px;margin-top:4px;overflow-wrap:anywhere}
.money .n small{display:block;font-size:13px;color:var(--ink2);font-weight:600;margin-top:2px}

/* --- controls ----------------------------------------------------------------------------- */
.seg{display:flex;background:var(--bg2);border-radius:var(--radius-c);padding:3px;margin:4px 0 14px;gap:2px;overflow-x:auto;scrollbar-width:none}
.seg::-webkit-scrollbar{display:none}
.seg button{flex:1;min-height:var(--tap);border:0;background:none;border-radius:8px;font-size:14px;font-weight:600;color:var(--ink2);
  cursor:pointer;white-space:nowrap;padding:0 12px;display:flex;align-items:center;justify-content:center;gap:6px}
.seg button.on{background:#fff;color:var(--ink);box-shadow:0 1px 3px #1018141f}
.searchbox{display:flex;align-items:center;gap:8px;background:var(--card);border-radius:var(--radius-c);box-shadow:inset 0 0 0 1px var(--line);padding:0 12px;min-height:44px;
  margin:6px 0 10px;color:var(--ink3)}
.searchbox input{border:0;background:none;outline:none;min-height:44px;flex:1;padding:0;color:var(--ink);font-size:16px;min-width:0}
.searchbox:focus-within{box-shadow:0 0 0 3px #4a90ff55}
.btn{display:inline-flex;align-items:center;justify-content:center;gap:7px;min-height:var(--tap);border:0;border-radius:var(--radius-c);
  padding:0 18px;font-weight:600;font-size:15px;cursor:pointer;background:var(--card);color:var(--ink);box-shadow:inset 0 0 0 1px var(--line);text-decoration:none;
  transition:background .12s}
.btn:hover{background:var(--bg2)}
/* Primary: the owner's glossy green, kept deep enough that white text stays >= 4.5:1 over the whole button
 * (the brighter #21c463 -> #178a46 gloss is reserved for icon discs, which carry no text). */
.btn.primary{background:linear-gradient(180deg,#178643,#147a3d);color:var(--brand-ink);
  box-shadow:inset 0 1px 0 #ffffff4d,0 1px 2px #16a34a33,0 8px 18px -10px #16a34ab3}
.btn.primary:hover{background:linear-gradient(180deg,#15803d,#126f37)}
.btn.warn{background:var(--o-bg);color:var(--o);box-shadow:inset 0 0 0 1px #ffdf9e}
.btn.danger{background:var(--r-bg);color:var(--r);box-shadow:inset 0 0 0 1px #ffc6c8}
.btn.block{width:100%;min-height:50px;font-size:16px}
.btn:disabled{opacity:.5;cursor:not-allowed}
.actions{display:flex;flex-wrap:wrap;gap:8px;margin:14px 0}
.actions .btn{flex:1 1 160px}
.actions>.pill{flex:none}
.field{display:block;margin:12px 0}
.field>span{display:block;font-size:13px;font-weight:600;color:var(--ink2);margin:0 2px 6px}
input,select,textarea{width:100%;min-height:var(--tap);border:1px solid var(--line);border-radius:var(--radius-c);padding:10px 12px;
  background:#fff;font-size:16px}
input:focus,select:focus,textarea:focus{border-color:var(--brand-2);outline:none;box-shadow:0 0 0 3px #4a90ff38}
textarea{min-height:76px}
input[type=checkbox]{width:24px;min-height:24px;height:24px;accent-color:var(--brand);flex:none}
.check{display:flex;gap:10px;align-items:center;font-size:15px;margin:10px 0;min-height:var(--tap)}
.inline3{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px}
.callout{display:flex;gap:10px;align-items:flex-start;border-radius:var(--radius-s);padding:12px 14px;font-size:14px;line-height:1.4;
  margin:10px 0}
.callout svg.i{margin-top:1px}
.callout.ORANGE{background:var(--o-bg);color:var(--o)}.callout.RED{background:var(--r-bg);color:var(--r)}
.callout.GREEN{background:var(--g-bg);color:var(--g)}
.kv{display:grid;grid-template-columns:auto 1fr;gap:9px 16px;font-size:14px;margin:0}
.kv dt{color:var(--ink3)}.kv dd{margin:0;text-align:right;font-weight:600;overflow-wrap:anywhere}
.tbl{width:100%;border-collapse:collapse;font-size:14px}
.tbl th,.tbl td{text-align:left;padding:11px 12px;border-bottom:1px solid var(--sep);vertical-align:top}
.tbl th{font-size:12px;color:var(--ink3);font-weight:650;white-space:nowrap}
.tbl tr:last-child td{border-bottom:0}
.scroll{overflow-x:auto;-webkit-overflow-scrolling:touch}
pre.raw{white-space:pre-wrap;margin:0;max-height:60vh;overflow:auto}
.tl{position:relative;padding:6px 0 4px 26px}
.tl::before{content:"";position:absolute;left:10px;top:12px;bottom:8px;width:2px;background:var(--sep)}
.tl .ev{position:relative;padding:4px 0 14px}
.tl .ev::before{content:"";position:absolute;left:-20px;top:8px;width:10px;height:10px;border-radius:50%;background:var(--brand-2);
  box-shadow:0 0 0 3px var(--card)}
.tl .ev .t{font-weight:650;font-size:14px}.tl .ev .s{font-size:12.5px;color:var(--ink3);margin-top:2px}
.pkg{border:1px solid var(--sep);border-radius:var(--radius-s);padding:12px;margin:10px 0}
.hd{display:flex;align-items:center;justify-content:space-between;gap:8px;margin-bottom:8px}
div.steps{display:flex;gap:6px;margin:10px 0;flex-wrap:wrap}
div.steps .st{display:inline-flex;align-items:center;gap:4px;font-size:12.5px;font-weight:600;color:var(--ink3);padding:5px 10px;
  border-radius:999px;background:var(--fill)}
div.steps .st.done{background:var(--g-bg);color:var(--g)}
ol.steps{padding-left:20px}ol.steps li{margin:3px 0}

/* --- loading / disclosure / blocked reasons -------------------------------------------------- */
/* Placeholder bars only: a loading screen never shows a number that could be read as data. */
.skel-wrap{display:grid;gap:12px;margin:18px 0}
.skel{height:60px;border-radius:var(--radius);background:linear-gradient(90deg,#eef2ee 0,#f7f8f5 40%,#eef2ee 80%);
  background-size:300% 100%;animation:skel 1.3s ease-in-out infinite}
@keyframes skel{from{background-position:100% 0}to{background-position:0 0}}
details.disclose{margin:14px 0 0}
details.disclose>summary{display:flex;align-items:center;justify-content:space-between;gap:8px;list-style:none;cursor:pointer;
  min-height:52px;padding:0 16px;background:var(--card);border-radius:var(--radius);font-weight:600;font-size:15px;box-shadow:var(--shadow)}
details.disclose>summary::-webkit-details-marker{display:none}
details.disclose>summary svg.i{color:#a4aea8;transition:transform .15s}
details.disclose[open]>summary{margin-bottom:10px}
details.disclose[open]>summary svg.i{transform:rotate(90deg)}
ul.why{list-style:none;margin:-4px 0 12px;padding:0;display:grid;gap:5px}
ul.why li{display:flex;gap:7px;align-items:flex-start;font-size:13px;color:var(--ink2);line-height:1.4}
ul.why li svg.i{color:var(--ink3);margin-top:1px}
.tiles.three{grid-template-columns:repeat(3,minmax(0,1fr));margin-bottom:12px}
.tiles.three .tile{min-height:92px;cursor:default}
.late{color:var(--r);font-weight:650}
.money .n.neg{color:var(--r)}

/* --- owner dashboard ---------------------------------------------------------------------- */
/* One grid of modules. Phone: a single column in priority order. Tablet / small desktop: two columns.
 * Wide: three columns (recent orders 2/3 next to the attention list; deliveries, economy, gates). */
.status-slot{margin:6px 0 18px;min-height:44px}
.status-skel{height:44px;width:280px;max-width:100%;border-radius:999px}
.status{display:inline-flex;align-items:center;gap:8px;max-width:100%;min-height:44px;padding:0 5px 0 14px;border:0;border-radius:999px;
  font-size:14px;font-weight:650;cursor:pointer;text-align:left}
.status .t{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.status .go{display:inline-flex;align-items:center;gap:2px;min-height:34px;padding:0 8px 0 12px;border-radius:999px;background:var(--card);
  color:var(--brand-2);font-size:13px;flex:none}
.status.GREEN{background:var(--g-bg);color:var(--g);box-shadow:inset 0 0 0 1px var(--a-lime)}
.status.ORANGE{background:var(--o-bg);color:var(--o);box-shadow:inset 0 0 0 1px #ffdf9e}
.status.RED{background:var(--r-bg);color:var(--r);box-shadow:inset 0 0 0 1px #ffc6c8}
.dash{display:grid;grid-template-columns:minmax(0,1fr);gap:14px;align-items:start}
.mod{min-width:0;background:var(--card);border-radius:var(--radius);box-shadow:var(--shadow);padding:10px 16px 16px}
.mod.m-kpi{background:none;box-shadow:none;padding:0;border-radius:0}
.mod-hd{display:flex;align-items:center;justify-content:space-between;gap:8px;min-height:44px;margin:0 -8px 6px 0}
.mod-hd h2.sec{margin:0;font-size:16px}
.mod .skel-wrap{margin:4px 0}.mod .skel{height:44px;border-radius:var(--radius-s)}
.mod .group.flat{box-shadow:none;background:none;border-radius:0;margin:0 -16px -8px}
.mod .callout:first-child{margin-top:0}
.mod .money{box-shadow:inset 0 0 0 1px var(--sep);background:var(--card);border-radius:var(--radius-s)}
.mod .money>div+div{box-shadow:inset 1px 0 0 var(--sep)}
.mod details.disclose>summary{box-shadow:inset 0 0 0 1px var(--sep);background:var(--card);min-height:48px;border-radius:var(--radius-s)}
.mod details.disclose .card{box-shadow:inset 0 0 0 1px var(--sep);background:var(--card);border-radius:var(--radius-s)}
.zero-note{display:flex;align-items:center;gap:10px;padding:12px 14px;border-radius:var(--radius-s);background:var(--fill);
  color:var(--ink2);font-size:14px;line-height:1.35}
.zero-note svg.i{color:var(--g)}

/* KPI cards */
.kpis{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}
.kpi{display:flex;flex-direction:column;align-items:flex-start;gap:6px;min-width:0;min-height:112px;padding:14px;border:0;
  border-radius:var(--radius);background:var(--card);box-shadow:var(--shadow);text-align:left;color:inherit;cursor:pointer}
div.kpi{cursor:default}
button.kpi{transition:box-shadow .15s,transform .15s}
button.kpi:hover{box-shadow:var(--shadow-hi);transform:translateY(-1px)}
.kpi-hd{display:flex;align-items:center;gap:8px;min-width:0;font-size:13px;font-weight:600;color:var(--ink2)}
.kpi-hd .c{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.kpi .ic{width:34px;height:34px}
.kpi .n{margin-top:auto;font-size:24px;font-weight:720;letter-spacing:-.6px;line-height:1.05;overflow-wrap:anywhere}
.kpi .s{font-size:12.5px;font-weight:550;color:var(--ink3);line-height:1.25}
.kpi.RED .n{color:var(--r)}
.kpi.zero .n{color:var(--ink3)}
.kpi.skel-card{cursor:default;padding:0;overflow:hidden}
.kpi.skel-card .skel{width:100%;height:112px;border-radius:var(--radius)}

/* Six-stage order flow: vertical on phones, horizontal with connectors from 600 px */
.flow6{list-style:none;margin:0;padding:0;display:grid}
.step{position:relative;min-width:0}
.step button{display:grid;grid-template-columns:36px minmax(0,1fr) auto;align-items:center;gap:12px;width:100%;min-height:48px;
  padding:6px 6px 6px 2px;border:0;background:none;color:inherit;text-align:left;cursor:pointer;border-radius:var(--radius-c);position:relative}
.step button:hover{background:#f7f8f5}
.step:not(:last-child) button::after{content:"";position:absolute;left:18.5px;top:calc(50% + 20px);height:calc(100% - 40px);width:3px;
  border-radius:2px;background:linear-gradient(180deg,var(--a-blue),var(--a-green));box-shadow:0 0 6px #4a90ff40}
.step .dotic{position:relative;z-index:1;width:36px;height:36px}
.step .lbl{min-width:0}
.step .lbl .c{display:block;font-size:15px;font-weight:600;line-height:1.25}
.step .lbl .s{display:block;font-size:12px;color:var(--ink3);font-weight:550}
.step .n{font-size:18px;font-weight:700;min-width:32px;text-align:right;letter-spacing:-.3px}
.step.zero .n{color:var(--ink3)}
.step.RED .n{color:var(--r)}

/* Recent orders: a real table; on phones each row folds into a two-line card */
.rtbl td{vertical-align:middle;padding:6px 12px}
.rtbl th:first-child,.rtbl td:first-child{padding-left:0}
.rtbl th:last-child,.rtbl td:last-child{padding-right:0}
.rtbl .c3,.rtbl .c4{text-align:right;white-space:nowrap}
.rtbl .c1{color:var(--ink2);overflow-wrap:anywhere}
.olink{display:inline-flex;align-items:center;min-height:var(--tap);padding:0 6px;margin-left:-6px;border:0;background:none;border-radius:var(--radius-c);
  color:var(--brand-2);font-weight:650;font-size:14px;cursor:pointer;white-space:nowrap}
.olink:hover{background:var(--bg2)}

/* Delivery donut (shipment stages from /owner/shipments) */
.viz{display:flex;align-items:center;gap:18px;min-width:0}
.donut-box{flex:none;width:128px;text-align:center}
.donut{display:block;width:128px;height:128px}
.donut .track{fill:none;stroke:var(--track);stroke-width:15}
.donut .seg{fill:none;stroke-width:15}
.donut .dn{font-size:24px;font-weight:720;fill:var(--ink);letter-spacing:-.5px}
.donut .dl{font-size:8.5px;font-weight:600;fill:var(--ink3)}
.viz.is-empty .donut .dn{fill:var(--ink3)}
.donut-box .quiet{margin:6px 0 0;font-size:12px}
.legend{list-style:none;margin:0;padding:0;display:grid;gap:3px;flex:1;min-width:0}
.legend li{display:grid;grid-template-columns:10px minmax(0,1fr) auto;align-items:center;gap:8px;min-height:22px;font-size:13px;color:var(--ink2)}
.legend .lv{font-weight:650;color:var(--ink)}
.legend li.zero{color:var(--ink3)}.legend li.zero .lv{color:var(--ink3);font-weight:500}.legend li.zero .sw{opacity:.35}
.sw{width:10px;height:10px;border-radius:50%;box-shadow:inset 0 1px 0 #ffffff66}
.seg.s-packing{stroke:var(--c-packing)}.sw.s-packing{background:var(--c-packing)}
.seg.s-booking{stroke:var(--c-booking)}.sw.s-booking{background:var(--c-booking)}
.seg.s-labels{stroke:var(--c-labels)}.sw.s-labels{background:var(--c-labels)}
.seg.s-pickup{stroke:var(--c-pickup)}.sw.s-pickup{background:var(--c-pickup)}
.seg.s-transit{stroke:var(--c-transit)}.sw.s-transit{background:var(--c-transit)}
.seg.s-delivered{stroke:var(--c-delivered)}.sw.s-delivered{background:var(--c-delivered)}
.seg.s-cancelled{stroke:var(--c-cancelled)}.sw.s-cancelled{background:var(--c-cancelled)}

/* --- auth --------------------------------------------------------------------------------- */
.auth{max-width:420px;margin:0 auto;padding:max(7vh,calc(24px + env(safe-area-inset-top))) 18px 40px}
.brand{display:flex;align-items:center;gap:12px;font-size:22px;font-weight:720;letter-spacing:-.5px;margin:0 4px 22px}
.brand img.logo{height:52px}
.brand .logo+div{font-size:0}.brand .logo+div small{font-size:14px;margin-top:4px}
.brand small{display:block;font-size:14px;font-weight:600;color:var(--ink3);letter-spacing:0}
.auth .card{padding:22px}
.auth .large{font-size:28px;margin:0 0 12px}
/* MFA QR: always black on white with its own quiet zone so every camera/app can read it. */
.qr-wrap{margin:10px 0 14px;text-align:center}
.qr{display:block;width:min(240px,72vw);height:auto;margin:0 auto 6px;background:#fff;border:1px solid var(--sep);border-radius:var(--radius-c)}
.mfa-key{display:block;font-size:16px;letter-spacing:.06em;text-align:center;background:var(--fill);user-select:all;
  word-break:normal;overflow-wrap:normal;box-shadow:none}
.auth .acts{display:flex;flex-wrap:wrap;gap:8px;margin:10px 0}.auth .acts .btn{flex:1 1 auto}
/* Passkey first: large tap target, then the password + code fallback. */
.auth .card + .card{margin-top:12px}
.auth #passkey-login{min-height:54px;font-size:17px}
.auth .card>.btn.block+.btn.block{margin-top:10px}
.center{text-align:center}
.row .btn{flex:0 0 auto;margin-left:6px}

/* --- modal + toast ------------------------------------------------------------------------ */
.modal-wrap{position:fixed;inset:0;z-index:9;background:#1018144d;display:flex;align-items:flex-end;justify-content:center}
.modal-wrap[hidden]{display:none}
.modal{background:#fff;width:100%;max-width:540px;border-radius:var(--radius) var(--radius) 0 0;padding:22px 20px calc(20px + env(safe-area-inset-bottom));
  max-height:92vh;overflow:auto;animation:sheetup .22s ease-out;box-shadow:0 -8px 40px #10181426}
@keyframes sheetup{from{transform:translateY(40px);opacity:.5}to{transform:none;opacity:1}}
.modal h2{font-size:20px;margin:2px 0 8px;letter-spacing:-.3px}
.modal .acts{display:flex;gap:8px;margin-top:16px}.modal .acts .btn{flex:1;min-height:50px}
.toast{position:fixed;left:50%;transform:translateX(-50%);bottom:calc(94px + env(safe-area-inset-bottom));z-index:10;background:#18231e;
  color:#fff;padding:12px 18px;border-radius:var(--radius-c);max-width:92vw;font-size:14px;font-weight:600;box-shadow:0 10px 30px #10181440}
.toast.err{background:var(--r-fill)}
:focus-visible{outline:3px solid var(--brand-2);outline-offset:2px}
.sr{position:absolute!important;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}

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

/* --- phone: recent-order rows fold into two-line cards ------------------------------------ */
@media (max-width:599px){
  .rtbl,.rtbl tbody{display:block}
  .rtbl thead{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0)}
  .rtbl tr{display:grid;grid-template-columns:minmax(0,1fr) auto;grid-template-areas:"o a" "k s";column-gap:10px;row-gap:2px;
    padding:4px 0 10px;border-bottom:1px solid var(--sep)}
  .rtbl tr:last-child{border-bottom:0;padding-bottom:0}
  .rtbl td{padding:0;border:0}
  .rtbl .c0{grid-area:o}.rtbl .c3{grid-area:a;align-self:center;font-weight:650}
  .rtbl .c1{grid-area:k;align-self:center;font-size:13px}.rtbl .c2{grid-area:s;justify-self:end}.rtbl .c4{display:none}
}

/* --- phone: compact money row ----------------------------------------------------------- */
@media (max-width:420px){
  .money .n{font-size:16px}
  .money>div{padding:14px 12px}
  .hero .go{margin-left:72px}
  .row .v{max-width:42%;white-space:normal;font-size:13px}
}

/* --- tablet ------------------------------------------------------------------------------- */
@media (min-width:600px){
  .page{padding:0 28px 36px;max-width:820px}
  .tiles{grid-template-columns:repeat(4,minmax(0,1fr))}
  .tiles.three{grid-template-columns:repeat(3,minmax(0,1fr))}
  .large{font-size:36px}
  .tabbar{padding-left:max(10%,env(safe-area-inset-left));padding-right:max(10%,env(safe-area-inset-right))}
  .tabbar button{flex-direction:row;gap:8px;font-size:13px}
  .tabbar .pip{position:static;margin-left:2px}
  .modal-wrap{align-items:center;padding:20px}.modal{border-radius:var(--radius);padding-bottom:22px}
  .two{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:16px;align-items:start}
  /* two-column dashboard: KPI row, flow, attention | deliveries, recent orders, economy | gates */
  .dash{grid-template-columns:repeat(2,minmax(0,1fr));gap:16px;
    grid-template-areas:"kpi kpi" "flow flow" "attn deliv" "recent recent" "econ gates"}
  .m-kpi{grid-area:kpi}.m-flow{grid-area:flow}.m-attn{grid-area:attn}.m-deliv{grid-area:deliv}.m-recent{grid-area:recent}
  .m-econ{grid-area:econ}.m-gates{grid-area:gates}
  .mod{padding:12px 20px 20px}
  .mod .group.flat{margin:0 -20px -12px}
  .flow6{grid-template-columns:repeat(6,minmax(0,1fr))}
  .step button{display:flex;flex-direction:column;align-items:center;gap:6px;min-height:124px;padding:6px 2px 8px;text-align:center}
  .step:not(:last-child) button::after{left:calc(50% + 30px);right:calc(-50% + 30px);top:26.5px;width:auto;height:3px;
    background:linear-gradient(90deg,var(--a-blue),var(--a-green));box-shadow:0 0 6px #4a90ff40}
  .step .dotic{width:44px;height:44px}
  .step .n{order:1;min-width:0;text-align:center;font-size:24px}
  .step .lbl{order:2}
  .step .lbl .c{font-size:13px}
  .viz{flex-direction:row}
}

/* --- tablet (portrait iPad and up): four KPI cards in one row, wider canvas -------------------- */
@media (min-width:768px){
  .page{max-width:960px}
  .kpis{grid-template-columns:repeat(4,minmax(0,1fr));gap:12px}
  .kpi{min-height:124px;padding:16px}
  .kpi .n{font-size:26px}
}

/* --- desktop: sidebar --------------------------------------------------------------------- */
@media (min-width:1000px){
  .app{padding-bottom:0;padding-left:var(--side)}
  .tabbar{top:0;right:auto;bottom:0;width:var(--side);grid-auto-flow:row;grid-auto-rows:min-content;grid-auto-columns:auto;
    align-content:start;gap:2px;padding:22px 14px;border-top:0;border-right:1px solid var(--sep);background:#fff}
  .tabbar .side-brand{display:flex;padding:2px 8px 26px}
  .tabbar .side-brand.has-logo{flex-direction:column;align-items:flex-start;gap:8px}
  .tabbar .side-brand img.logo{height:auto;max-height:56px;max-width:196px}
  .tabbar button{flex-direction:row;gap:12px;min-height:44px;padding:0 12px;font-size:15px;justify-content:flex-start;color:var(--ink2)}
  .tabbar button:hover{background:var(--bg2)}
  .tabbar button.on{background:var(--sage);color:var(--sage-ink);box-shadow:inset 0 0 0 1px var(--a-lime)}
  .tabbar .pip{margin-left:auto}
  .page{padding:4px 40px 48px;max-width:1040px}
  .navbar{padding:6px 24px;min-height:52px}
  .topbar{display:none}
  .app>.topbar:first-child+.page,.envbar+.topbar+.page{padding-top:28px}
  .tabbar .side-only{display:flex}
  .toast{bottom:28px;left:calc(50% + var(--side) / 2)}
}

/* --- wide: three-column dashboard --------------------------------------------------------- */
@media (min-width:1280px){
  .page{max-width:1240px}
  .dash{grid-template-columns:repeat(3,minmax(0,1fr));gap:18px;
    grid-template-areas:"kpi kpi kpi" "flow flow flow" "recent recent attn" "deliv econ gates"}
  .kpi{min-height:132px;padding:18px}
  .kpi .n{font-size:30px}
}
