/* Stark TMS design system — tokens and shared base components (stark-mod-ui-design).
   Loaded by both the workspace (index.html) and the client portal (portal.html), before each page's
   own stylesheet. Contract: docs/agents/contracts/ui-design.md. Only :root tokens and .st-* classes. */
/* ══ Stark design system (stark-mod-ui-design) — tokens and shared base components ═══════════════
   Contract: docs/agents/contracts/ui-design.md. Everything here is ADDITIVE: new --st-* custom
   properties and .st-* classes that no page uses yet, so nothing on screen changes until a page is
   restyled (one page per release, Orders first, after the owner approves the direction). Use px,
   not rem: the workspace sets html{font-size:17px}. Phone = max-width 760px, tablet = 761–1100px. */
:root{
--st-navy-900:#17263c;--st-navy-800:#22344e;--st-navy-700:#2f4563;--st-navy-text:#bec9d8;
--st-blue-600:#1769e0;--st-blue-700:#105fcf;--st-blue-100:#d6e6ff;--st-blue-50:#eaf2ff;
--st-ink:#172033;--st-ink-2:#344056;--st-muted:#5f6b80;--st-faint:#8a94a6;
--st-line:#dce2ea;--st-line-strong:#c9d0db;--st-bg:#f4f6f9;--st-surface:#fff;--st-surface-2:#f7f8fa;--st-hover:#f1f5fa;
--st-success:#16825d;--st-success-soft:#e6f4ee;--st-warning:#9a6200;--st-warning-soft:#fff4dc;
--st-danger:#c23d4b;--st-danger-700:#a52f3c;--st-danger-soft:#fdebed;--st-info:#1769e0;--st-info-soft:#eaf2ff;
--st-neutral:#465268;--st-neutral-soft:#edf0f4;--st-purple:#6a4bc0;--st-purple-soft:#f1edfb;
--st-font:Inter,-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,sans-serif;
--st-font-mono:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;
--st-text-xs:12px;--st-text-sm:13px;--st-text-md:15px;--st-text-lg:17px;--st-text-xl:20px;--st-text-2xl:26px;--st-text-scan:20px;
--st-weight-regular:400;--st-weight-medium:500;--st-weight-semibold:600;--st-weight-bold:700;
--st-leading-tight:1.25;--st-leading:1.45;
--st-space-1:4px;--st-space-2:8px;--st-space-3:12px;--st-space-4:16px;--st-space-5:20px;--st-space-6:24px;--st-space-8:32px;--st-space-10:40px;
--st-radius-sm:4px;--st-radius-md:6px;--st-radius-lg:8px;--st-radius-xl:12px;--st-radius-pill:999px;
--st-shadow-sm:0 1px 2px rgba(23,38,60,.06);--st-shadow-md:0 4px 14px rgba(23,38,60,.10);--st-shadow-lg:0 12px 32px rgba(23,38,60,.18);
--st-focus:0 0 0 3px rgba(23,105,224,.28);
--st-control-sm:32px;--st-control-md:36px;--st-control-lg:44px;--st-control-scan:52px;
--st-z-menu:40;--st-z-sheet:50;--st-z-dialog:60;--st-z-toast:100
}
/* Buttons: one shape, four kinds, three sizes. Size never drops below 36px on a phone. */
.st-btn{display:inline-flex;align-items:center;justify-content:center;gap:var(--st-space-2);height:var(--st-control-md);padding:0 var(--st-space-4);border:1px solid var(--st-line-strong);border-radius:var(--st-radius-md);background:var(--st-surface);color:var(--st-ink-2);font:var(--st-weight-semibold) var(--st-text-sm)/1 var(--st-font);white-space:nowrap;text-decoration:none;cursor:pointer;transition:background .12s,border-color .12s,color .12s}
.st-btn:hover{background:var(--st-hover)}
.st-btn:focus-visible,.st-icon-btn:focus-visible,.st-tab:focus-visible,.st-seg button:focus-visible{outline:0;box-shadow:var(--st-focus)}
.st-btn--primary{background:var(--st-blue-600);border-color:var(--st-blue-600);color:#fff}
.st-btn--primary:hover{background:var(--st-blue-700);border-color:var(--st-blue-700)}
.st-btn--danger{background:var(--st-danger);border-color:var(--st-danger);color:#fff}
.st-btn--danger:hover{background:var(--st-danger-700);border-color:var(--st-danger-700)}
.st-btn--danger-quiet{color:var(--st-danger)}
.st-btn--danger-quiet:hover{background:var(--st-danger-soft);border-color:var(--st-danger)}
.st-btn--ghost{background:transparent;border-color:transparent;color:var(--st-blue-600)}
.st-btn--ghost:hover{background:var(--st-blue-50)}
.st-btn--sm{height:var(--st-control-sm);padding:0 var(--st-space-3)}
.st-btn--lg{height:var(--st-control-lg);padding:0 var(--st-space-5);font-size:var(--st-text-md)}
.st-btn--block{display:flex;width:100%}
.st-btn:disabled,.st-btn[aria-disabled=true]{opacity:.5;cursor:not-allowed;pointer-events:none}
.st-icon-btn{display:inline-grid;place-items:center;width:var(--st-control-md);height:var(--st-control-md);border:0;border-radius:var(--st-radius-md);background:transparent;color:var(--st-muted);cursor:pointer}
.st-icon-btn:hover{background:var(--st-hover);color:var(--st-ink)}
.st-btn-group{display:flex;flex-wrap:wrap;gap:var(--st-space-2);align-items:center}
/* Fields: label above, control, then help or error. */
.st-field{display:flex;flex-direction:column;gap:var(--st-space-1);min-width:0}
.st-label{font-size:var(--st-text-xs);font-weight:var(--st-weight-semibold);color:var(--st-ink-2);letter-spacing:.02em}
.st-input,.st-select,.st-textarea{width:100%;min-width:0;height:var(--st-control-md);padding:0 var(--st-space-3);border:1px solid var(--st-line-strong);border-radius:var(--st-radius-md);background:var(--st-surface);color:var(--st-ink);font:var(--st-weight-regular) var(--st-text-md)/1.3 var(--st-font)}
.st-textarea{height:auto;min-height:88px;padding:var(--st-space-2) var(--st-space-3);resize:vertical}
.st-input::placeholder,.st-textarea::placeholder{color:var(--st-faint)}
.st-input:focus,.st-select:focus,.st-textarea:focus{outline:0;border-color:var(--st-blue-600);box-shadow:var(--st-focus)}
.st-input[aria-invalid=true],.st-select[aria-invalid=true],.st-textarea[aria-invalid=true]{border-color:var(--st-danger)}
.st-input:disabled,.st-select:disabled,.st-textarea:disabled{background:var(--st-surface-2);color:var(--st-muted)}
.st-help{font-size:var(--st-text-xs);color:var(--st-muted);line-height:var(--st-leading)}
.st-error-text{font-size:var(--st-text-xs);color:var(--st-danger);font-weight:var(--st-weight-semibold)}
.st-check{display:inline-flex;align-items:center;gap:var(--st-space-2);min-height:var(--st-control-md);font-size:var(--st-text-sm);color:var(--st-ink-2)}
.st-check input{width:18px;height:18px;margin:0;accent-color:var(--st-blue-600)}
.st-form-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(min(200px,100%),1fr));gap:var(--st-space-4)}
/* Cards, page header, toolbar, bulk bar. */
.st-card{background:var(--st-surface);border:1px solid var(--st-line);border-radius:var(--st-radius-lg);box-shadow:var(--st-shadow-sm);min-width:0}
.st-card__head{display:flex;align-items:center;justify-content:space-between;gap:var(--st-space-3);padding:var(--st-space-3) var(--st-space-4);border-bottom:1px solid var(--st-line)}
.st-card__title{margin:0;font-size:var(--st-text-md);font-weight:var(--st-weight-bold);color:var(--st-ink)}
.st-card__body{padding:var(--st-space-4)}
.st-page-header{display:flex;align-items:flex-start;justify-content:space-between;gap:var(--st-space-4);margin-bottom:var(--st-space-5)}
.st-page-title{margin:0;font-size:var(--st-text-2xl);line-height:var(--st-leading-tight);font-weight:var(--st-weight-bold);color:var(--st-ink)}
.st-page-subtitle{margin:var(--st-space-1) 0 0;font-size:var(--st-text-md);color:var(--st-muted)}
.st-toolbar{display:flex;flex-wrap:wrap;align-items:center;gap:var(--st-space-2);padding:var(--st-space-3) var(--st-space-4);border-bottom:1px solid var(--st-line)}
.st-toolbar__search{flex:1 1 260px;max-width:420px}
.st-toolbar__end{margin-left:auto;display:flex;flex-wrap:wrap;gap:var(--st-space-2);align-items:center}
.st-bulkbar{display:flex;flex-wrap:wrap;align-items:center;gap:var(--st-space-2);padding:var(--st-space-2) var(--st-space-4);background:var(--st-blue-50);border-bottom:1px solid var(--st-blue-100);font-size:var(--st-text-sm);color:var(--st-ink)}
.st-bulkbar strong{margin-right:var(--st-space-2)}
/* Status tabs (a list's queues) and the segmented switch (2–5 views of one thing). */
.st-tabs{display:flex;gap:var(--st-space-1);overflow-x:auto;border-bottom:1px solid var(--st-line);scrollbar-width:none}
.st-tab{display:inline-flex;align-items:center;gap:var(--st-space-2);height:var(--st-control-lg);padding:0 var(--st-space-3);border:0;border-bottom:2px solid transparent;background:transparent;color:var(--st-muted);font:var(--st-weight-semibold) var(--st-text-md)/1 var(--st-font);white-space:nowrap;cursor:pointer}
.st-tab:hover{color:var(--st-ink)}
.st-tab.is-active,.st-tab[aria-selected=true]{color:var(--st-blue-600);border-bottom-color:var(--st-blue-600)}
.st-count{display:inline-flex;align-items:center;justify-content:center;min-width:22px;height:20px;padding:0 6px;border-radius:var(--st-radius-pill);background:var(--st-neutral-soft);color:var(--st-neutral);font-size:var(--st-text-xs);font-weight:var(--st-weight-bold)}
.st-tab.is-active .st-count,.st-tab[aria-selected=true] .st-count{background:var(--st-blue-50);color:var(--st-blue-600)}
.st-seg{display:inline-flex;gap:2px;padding:3px;border-radius:var(--st-radius-md);background:var(--st-neutral-soft)}
.st-seg button{height:30px;padding:0 var(--st-space-3);border:0;border-radius:var(--st-radius-sm);background:transparent;color:var(--st-muted);font:var(--st-weight-semibold) var(--st-text-sm)/1 var(--st-font);cursor:pointer}
.st-seg button.is-active,.st-seg button[aria-pressed=true],.st-seg button[aria-selected=true]{background:var(--st-surface);color:var(--st-ink);box-shadow:var(--st-shadow-sm)}
/* Tables: the wrapper scrolls sideways, never the page. */
.st-table-wrap{width:100%;overflow-x:auto;-webkit-overflow-scrolling:touch}
.st-table{width:100%;border-collapse:collapse;font-size:var(--st-text-md);line-height:1.35;color:var(--st-ink)}
.st-table th{height:40px;padding:0 var(--st-space-3);background:var(--st-surface-2);border-bottom:1px solid var(--st-line);color:var(--st-muted);font-size:var(--st-text-xs);font-weight:var(--st-weight-bold);letter-spacing:.04em;text-transform:uppercase;text-align:left;white-space:nowrap}
.st-table td{height:52px;padding:6px var(--st-space-3);border-bottom:1px solid var(--st-line);vertical-align:middle}
.st-table tbody tr:hover{background:var(--st-hover)}
.st-table tr.is-selected,.st-table tr[aria-selected=true]{background:var(--st-blue-50)}
.st-table .st-num{text-align:right;font-variant-numeric:tabular-nums}
.st-table .st-sub{display:block;margin-top:2px;font-size:var(--st-text-xs);color:var(--st-muted)}
.st-table--dense td{height:40px}
.st-link{color:var(--st-blue-600);font-weight:var(--st-weight-semibold);text-decoration:none;cursor:pointer}
.st-link:hover{text-decoration:underline}
.st-pager{display:flex;align-items:center;justify-content:space-between;gap:var(--st-space-3);padding:var(--st-space-3) var(--st-space-4);font-size:var(--st-text-sm);color:var(--st-muted)}
/* Status chips: one shape; colour says the meaning, the word says the status. */
.st-chip{display:inline-flex;align-items:center;gap:var(--st-space-1);height:24px;padding:0 var(--st-space-2);border-radius:var(--st-radius-pill);background:var(--st-neutral-soft);color:var(--st-neutral);font-size:var(--st-text-sm);font-weight:var(--st-weight-semibold);line-height:1;white-space:nowrap}
.st-chip--info{background:var(--st-info-soft);color:var(--st-info)}
.st-chip--success{background:var(--st-success-soft);color:var(--st-success)}
.st-chip--warning{background:var(--st-warning-soft);color:var(--st-warning)}
.st-chip--danger{background:var(--st-danger-soft);color:var(--st-danger)}
.st-chip--purple{background:var(--st-purple-soft);color:var(--st-purple)}
.st-chip--dot::before{content:"";width:6px;height:6px;border-radius:50%;background:currentColor}
/* Dialogs (centred, for a decision) and sheets (from the right, for a form or a record). */
.st-backdrop{position:fixed;inset:0;z-index:var(--st-z-dialog);display:grid;place-items:center;padding:var(--st-space-4);background:rgba(15,24,38,.45)}
.st-dialog{display:flex;flex-direction:column;width:min(520px,100%);max-height:calc(100vh - 32px);background:var(--st-surface);border-radius:var(--st-radius-xl);box-shadow:var(--st-shadow-lg);overflow:hidden}
.st-dialog--wide{width:min(840px,100%)}
.st-dialog__head{display:flex;align-items:flex-start;justify-content:space-between;gap:var(--st-space-3);padding:var(--st-space-4) var(--st-space-5);border-bottom:1px solid var(--st-line)}
.st-dialog__title{margin:0;font-size:var(--st-text-xl);font-weight:var(--st-weight-bold);color:var(--st-ink)}
.st-dialog__body{padding:var(--st-space-5);overflow:auto}
.st-dialog__foot{display:flex;flex-wrap:wrap;justify-content:flex-end;gap:var(--st-space-2);padding:var(--st-space-3) var(--st-space-5);border-top:1px solid var(--st-line);background:var(--st-surface-2)}
.st-sheet{position:fixed;top:0;right:0;bottom:0;z-index:var(--st-z-sheet);display:flex;flex-direction:column;width:min(520px,100vw);background:var(--st-surface);box-shadow:var(--st-shadow-lg)}
/* Toasts: bottom right on a computer, full width above the bottom bar on a phone. */
.st-toast{position:fixed;right:var(--st-space-5);bottom:var(--st-space-5);z-index:var(--st-z-toast);display:flex;align-items:center;gap:var(--st-space-3);max-width:min(420px,calc(100vw - 32px));padding:var(--st-space-3) var(--st-space-4);border-radius:var(--st-radius-lg);background:var(--st-navy-900);color:#fff;box-shadow:var(--st-shadow-lg);font-size:var(--st-text-sm);line-height:var(--st-leading)}
.st-toast--success{border-left:4px solid #3fbf8a}
.st-toast--danger{border-left:4px solid #ff7a86}
/* Empty and loading states: say what is missing and what to do about it. */
.st-empty{display:flex;flex-direction:column;align-items:center;gap:var(--st-space-2);padding:var(--st-space-10) var(--st-space-5);text-align:center;color:var(--st-muted);font-size:var(--st-text-sm)}
.st-empty__title{margin:0;font-size:var(--st-text-md);font-weight:var(--st-weight-bold);color:var(--st-ink)}
.st-empty p{margin:0;max-width:420px;line-height:var(--st-leading)}
/* Detail pages: key–value grid and dashboard stat tiles. */
.st-kv{display:grid;grid-template-columns:repeat(auto-fill,minmax(min(180px,100%),1fr));gap:var(--st-space-4) var(--st-space-5);margin:0}
.st-kv dt{font-size:var(--st-text-xs);font-weight:var(--st-weight-semibold);color:var(--st-muted);letter-spacing:.02em}
.st-kv dd{margin:2px 0 0;font-size:var(--st-text-md);color:var(--st-ink);overflow-wrap:anywhere}
.st-stat{padding:var(--st-space-4);background:var(--st-surface);border:1px solid var(--st-line);border-radius:var(--st-radius-lg)}
.st-stat__label{font-size:var(--st-text-xs);font-weight:var(--st-weight-semibold);color:var(--st-muted)}
.st-stat__value{margin-top:var(--st-space-1);font-size:var(--st-text-2xl);font-weight:var(--st-weight-bold);color:var(--st-ink);font-variant-numeric:tabular-nums}
/* Scan screens: one big field that keeps focus, one loud answer, the next step under the thumb. */
.st-scan{display:flex;flex-direction:column;gap:var(--st-space-4);max-width:640px}
.st-scan__input{width:100%;height:var(--st-control-scan);padding:0 var(--st-space-4);border:2px solid var(--st-blue-600);border-radius:var(--st-radius-lg);background:var(--st-surface);color:var(--st-ink);font:var(--st-weight-semibold) var(--st-text-scan)/1 var(--st-font-mono)}
.st-scan__input:focus{outline:0;box-shadow:var(--st-focus)}
.st-scan__feedback{padding:var(--st-space-4);border-radius:var(--st-radius-lg);background:var(--st-neutral-soft);color:var(--st-ink);font-size:var(--st-text-lg);font-weight:var(--st-weight-bold);line-height:var(--st-leading-tight)}
.st-scan__feedback--ok{background:var(--st-success-soft);color:var(--st-success)}
.st-scan__feedback--error{background:var(--st-danger-soft);color:var(--st-danger)}
.st-scan__feedback--warning{background:var(--st-warning-soft);color:var(--st-warning)}
.st-scan__progress{font-size:var(--st-text-sm);color:var(--st-muted);font-variant-numeric:tabular-nums}
/* Phones: 16px fields (iPhone never zooms), 36px+ targets, stacked headers, dialogs as bottom sheets. */
@media(max-width:760px){
.st-btn{min-height:var(--st-control-md)}.st-btn--sm{height:var(--st-control-md)}.st-btn--lg{height:var(--st-control-lg)}
.st-input,.st-select,.st-textarea{font-size:16px}.st-input,.st-select{height:var(--st-control-lg)}
.st-seg button{height:var(--st-control-md)}
.st-page-header{flex-direction:column;align-items:stretch;gap:var(--st-space-3);margin-bottom:var(--st-space-4)}
.st-page-title{font-size:var(--st-text-xl)}
.st-toolbar,.st-card__head,.st-card__body{padding-left:var(--st-space-3);padding-right:var(--st-space-3)}
.st-toolbar__search{flex-basis:100%;max-width:none}.st-toolbar__end{margin-left:0}
.st-backdrop{place-items:end stretch;padding:0}
.st-dialog,.st-dialog--wide{width:100%;max-height:92vh;border-radius:var(--st-radius-xl) var(--st-radius-xl) 0 0}
.st-dialog__foot .st-btn{flex:1 1 auto}
.st-sheet{width:100vw}
.st-toast{left:var(--st-space-3);right:var(--st-space-3);bottom:calc(76px + env(safe-area-inset-bottom,0px));max-width:none}
.st-scan__input{font-size:var(--st-text-scan)}
}
/* ══ end Stark design system ══ */
