/* SigmaQMS v3 UI kit. Identity: palette 3 (SQ-BRD-001 v2.0 / SQ-BRD-002 v2.0).
   Charcoal frame, Burgundy the one signal, Alice Blue panels, Light Gray page, Black text.
   Colour on the canvas only for a verdict, a data series, or the primary action. */

@font-face { font-family: "IBM Plex Sans"; font-weight: 400; font-display: swap;
  src: local("IBM Plex Sans"), local("IBMPlexSans"), url("/static/common/fonts/IBMPlexSans-Regular.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-weight: 600; font-display: swap;
  src: local("IBM Plex Sans SemiBold"), local("IBMPlexSans-SemiBold"), url("/static/common/fonts/IBMPlexSans-SemiBold.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-weight: 700; font-display: swap;
  src: local("IBM Plex Sans Bold"), local("IBMPlexSans-Bold"), url("/static/common/fonts/IBMPlexSans-Bold.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Mono"; font-weight: 400; font-display: swap;
  src: local("IBM Plex Mono"), local("IBMPlexMono"), url("/static/common/fonts/IBMPlexMono-Regular.woff2") format("woff2"); }

:root {
  --page: #F0F2F5; --panel: #ECF4F7; --panel-edge: #CFD9E1; --surface: #FFFFFF;
  --ink: #0B0B0B; --ink-2: #4A4F57; --muted: #62666E; --grid: #DEE1E6; --baseline: #C2C7CF;
  --signal: #910029; --signal-pressed: #6E001F; --signal-on-dark: #E2708F; --charcoal: #393F4B; --charcoal-2: #2E333D;
  --pass: #0ca30c; --warn: #fab219; --fail: #d03b3b; --na: #8A8F98; --action: #ec835a; --info: #2a78d6;
  --s1: #2A6FB0; --s2: #E3872D; --s3: #2E9E8F; --s4: #8A5CC2; --s5: #5A6B7D; --s6: #6B8E23; --s7: #D4A017; --s8: #3FA7D6;
  --radius: 8px; --radius-sm: 5px;
  --shadow: 0 1px 2px rgba(11,11,11,.06), 0 1px 1px rgba(11,11,11,.04);
  --shadow-lift: 0 8px 24px rgba(11,11,11,.16);
  --font: "IBM Plex Sans", -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --side: 252px;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--page); color: var(--ink); font: 15px/1.5 var(--font);
  -webkit-font-smoothing: antialiased; font-variant-numeric: tabular-nums; }
a { color: var(--signal); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--signal); outline-offset: 2px; }
.mono, .sq-id { font-family: var(--mono); font-size: .92em; letter-spacing: -.01em; }
.muted { color: var(--muted); }
.ink2 { color: var(--ink-2); }
.hidden { display: none !important; }
.ms { font-family: "Material Symbols Rounded"; font-weight: normal; font-style: normal; font-size: 20px; line-height: 1;
  display: inline-block; vertical-align: -4px; font-feature-settings: "liga"; -webkit-font-feature-settings: "liga"; }

/* ---------- frame ---------- */
.frame { display: grid; grid-template-columns: var(--side) 1fr; min-height: 100vh; }
.side { background: var(--charcoal); color: #E8EAEE; position: sticky; top: 0; height: 100vh; overflow-y: auto;
  display: flex; flex-direction: column; padding: 16px 12px; gap: 14px; scrollbar-width: thin; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 10px; border-bottom: 1px solid rgba(255,255,255,.1); }
.brand img { height: 30px; }
.brand .word { font-weight: 700; font-size: 19px; letter-spacing: .2px; color: #fff; }
.brand .word b { color: var(--signal-on-dark); font-weight: 700; }
.brand .sys { font-size: 11px; color: #B9BFC9; text-transform: uppercase; letter-spacing: .12em; display: block; margin-top: -2px; }
.who { padding: 0 8px; font-size: 13px; color: #CBD0D8; }
.who b { color: #fff; font-weight: 600; display: block; font-size: 14px; }
.side select { width: 100%; background: var(--charcoal-2); color: #fff; border: 1px solid rgba(255,255,255,.14);
  border-radius: var(--radius-sm); padding: 8px 10px; font: inherit; font-size: 14px; }
.side .grp { font-size: 11px; text-transform: uppercase; letter-spacing: .12em; color: #9AA1AD; padding: 8px 10px 2px; }
.side nav a { display: flex; align-items: center; gap: 10px; color: #DDE1E7; padding: 7px 10px; border-radius: var(--radius-sm);
  font-size: 14px; text-decoration: none; }
.side nav a:hover { background: rgba(255,255,255,.07); }
.side nav a.on { background: var(--signal); color: #fff; }
.side .wshead { padding: 10px 10px 4px; border-top: 1px solid rgba(255,255,255,.1); }
.side .wshead b { display: block; color: #fff; font-size: 15px; font-weight: 600; }
.side .wshead span { display: block; color: #B9BFC9; font-size: 12px; line-height: 1.4; margin-top: 2px; }
.side nav + nav { margin-top: 2px; }
.side .grp.step { display: flex; align-items: center; gap: 8px; color: #E8EAEE; }
.side .stepno { display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: 50%;
  border: 1px solid var(--signal-on-dark); color: var(--signal-on-dark); font-size: 10px; letter-spacing: 0; font-weight: 700; }
.side .chips { display: flex; flex-wrap: wrap; gap: 4px; padding: 4px 10px 4px; }
.side .chips a { font-size: 12px; padding: 2px 9px; border-radius: 999px; border: 1px solid rgba(255,255,255,.18); color: #DDE1E7; }
.side .chips a.on { background: #fff; color: var(--charcoal); border-color: #fff; }
.side .chips a:hover { text-decoration: none; background: rgba(255,255,255,.1); }
.side .chips a.on:hover { background: #fff; }
.col { min-width: 0; display: flex; flex-direction: column; }
.wsbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: stretch; gap: 2px; background: var(--surface);
  border-bottom: 1px solid var(--grid); padding: 0 16px; overflow-x: auto; scrollbar-width: none; }
.wsbar a { display: flex; align-items: center; gap: 8px; padding: 12px 14px 10px; color: var(--ink-2); font-size: 14px; white-space: nowrap;
  border-bottom: 3px solid transparent; }
.wsbar a:hover { text-decoration: none; color: var(--ink); background: var(--page); }
.wsbar a.on { color: var(--ink); font-weight: 600; border-bottom-color: var(--signal); }
.wsbar a.on svg { color: var(--signal); }
.wsright { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.wsbar a.wsscan { border: 1px solid var(--signal); color: var(--signal); border-radius: var(--radius-sm); padding: 6px 12px; margin: 6px 0; font-weight: 600; }
.wsbar a.wsscan:hover { background: var(--signal); color: #fff; }
.wstrace { display: flex; align-items: center; gap: 6px; padding: 6px 0; color: var(--muted); }
.wstrace input { border: 1px solid var(--grid); border-radius: var(--radius-sm); padding: 6px 10px; font: inherit; font-size: 13px; width: 210px; background: var(--page); }
.wstrace input:focus { background: #fff; }
.side .foot { margin-top: auto; border-top: 1px solid rgba(255,255,255,.1); padding-top: 10px; }
.devbar { background: var(--charcoal); color: #fff; font-size: 12px; padding: 4px 16px; border-bottom: 2px solid var(--signal-on-dark); }
main.canvas:focus { outline: none; }
main.canvas { padding: 26px 34px 60px; max-width: 1480px; width: 100%; min-width: 0; }
.loadbar { position: fixed; top: 0; left: var(--side); right: 0; height: 2px; background: var(--signal); transform-origin: left;
  transform: scaleX(0); transition: transform .3s ease; z-index: 50; }
.loadbar.on { transform: scaleX(.7); }

/* ---------- page anatomy ---------- */
.kicker { color: var(--signal); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .14em; }
h1.title { font-size: 28px; font-weight: 700; margin: 2px 0 2px; letter-spacing: -.01em; }
.subtitle { color: var(--ink-2); margin: 0 0 14px; }
.hair { border: 0; border-top: 1px solid var(--grid); margin: 14px 0 18px; }
.section { margin: 26px 0 10px; }
.section h2 { font-size: 20px; font-weight: 600; margin: 0; }
.section .cap { color: var(--muted); font-size: 13px; margin-top: 2px; }
.row { display: flex; gap: 16px; flex-wrap: wrap; align-items: flex-start; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-side { grid-template-columns: minmax(0, 1fr) 380px; }
.g-side-l { grid-template-columns: 340px minmax(0, 1fr); }
@media (max-width: 1100px) { .g3, .g4 { grid-template-columns: repeat(2, minmax(0,1fr)); } .g-side, .g-side-l { grid-template-columns: 1fr; } }
@media (max-width: 760px) { .frame { grid-template-columns: 1fr; } .wsbar { position: relative; padding: 0 8px; } .wstrace { display: none; } .wsright { margin-left: 0; } .side { position: relative; height: auto; } .g2,.g3,.g4 { grid-template-columns: 1fr; }
  main.canvas:focus { outline: none; }
main.canvas { padding: 18px 16px; } .loadbar { left: 0; } }

/* ---------- surfaces ---------- */
.panel { background: var(--panel); border: 1px solid var(--panel-edge); border-radius: var(--radius); padding: 16px; }
.card { background: var(--surface); border: 1px solid var(--grid); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); min-width: 0; }
.card h3, .panel h3 { font-size: 15px; font-weight: 600; margin: 0 0 8px; }
.chart-card { background: var(--surface); border: 1px solid var(--grid); border-radius: var(--radius); padding: 12px 14px 8px; box-shadow: var(--shadow); min-width: 0; }
.chart-card .ct { font-weight: 600; font-size: 14px; }
.chart-card .cs { color: var(--muted); font-size: 12px; margin-bottom: 4px; }

/* tiles: neutral; a verdict adds a status top rule + pill */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; margin-bottom: 4px; }
.tile { background: var(--surface); border: 1px solid var(--grid); border-top: 3px solid var(--grid); border-radius: var(--radius);
  padding: 12px 14px; box-shadow: var(--shadow); min-width: 0; }
.tile .l { font-size: 12.5px; color: var(--ink-2); }
.tile .v { font-size: 26px; font-weight: 600; margin: 2px 0 0; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile .s { font-size: 12px; color: var(--muted); }
.tile .bar { height: 4px; background: var(--grid); border-radius: 2px; margin-top: 8px; overflow: hidden; }
.tile .bar i { display: block; height: 100%; background: var(--s1); }
.tile.st-PASS, .tile.st-GOOD { border-top-color: var(--pass); }
.tile.st-WARN, .tile.st-WATCH { border-top-color: var(--warn); }
.tile.st-FAIL, .tile.st-CRITICAL { border-top-color: var(--fail); }
.tile.st-ACTION { border-top-color: var(--action); }
.tile.st-INFO { border-top-color: var(--info); }
.tile.click { cursor: pointer; } .tile.click:hover { box-shadow: var(--shadow-lift); }

.pill { display: inline-flex; align-items: center; gap: 4px; border-radius: 999px; padding: 1px 9px 1px 7px; font-size: 12.5px;
  font-weight: 600; border: 1px solid; white-space: nowrap; background: #fff; }
.pill.PASS, .pill.GOOD { color: #0a6f0a; border-color: #9fd59f; background: #f1fbf1; }
.pill.WARN, .pill.WATCH { color: #7a5200; border-color: #f2d08a; background: #fff9ea; }
.pill.FAIL, .pill.CRITICAL { color: #a02323; border-color: #eba8a8; background: #fdf1f1; }
.pill.ACTION { color: #9a4a26; border-color: #f2bfa8; background: #fff4ef; }
.pill.NA { color: #555a62; border-color: #d0d3d8; background: #f6f7f8; }
.pill.INFO { color: #1d5aa3; border-color: #a9c8ee; background: #f0f6fd; }
.tag { display: inline-block; font-size: 12px; padding: 1px 8px; border-radius: 4px; background: var(--panel); border: 1px solid var(--panel-edge); color: var(--ink-2); }

/* scorecard */
.scorecard { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1.35fr); gap: 16px; }
.hero { display: flex; gap: 18px; align-items: center; }
.hero .n { font-size: 64px; font-weight: 700; line-height: 1; letter-spacing: -.03em; }
.hero .of { color: var(--muted); font-size: 14px; }
@media (max-width: 1100px) { .scorecard { grid-template-columns: 1fr; } }

/* ---------- controls ---------- */
button, .btn { font: inherit; font-size: 14px; border: 1px solid var(--baseline); background: #fff; color: var(--ink);
  padding: 7px 14px; border-radius: var(--radius-sm); cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
button:hover { background: #f7f8fa; }
button.primary { background: var(--signal); border-color: var(--signal); color: #fff; font-weight: 600; }
button.primary:hover { background: var(--signal-pressed); }
button.ghost { border-color: transparent; background: transparent; color: var(--signal); }
button.sm { padding: 3px 9px; font-size: 13px; }
button:disabled { opacity: .5; cursor: default; }
label.f { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--ink-2); min-width: 0; }
label.f .hint { font-size: 12px; color: var(--muted); }
label.f .req { color: var(--signal); }
input, select, textarea { font: inherit; font-size: 14px; color: var(--ink); background: #fff; border: 1px solid var(--baseline);
  border-radius: var(--radius-sm); padding: 7px 9px; min-width: 0; width: 100%; }
input[type=checkbox], input[type=radio] { width: auto; }
textarea { min-height: 70px; resize: vertical; }
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 10px; }
.filters label.f { width: 190px; }
.fgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px 14px; }
.check { display: flex; gap: 8px; align-items: center; font-size: 14px; color: var(--ink); }
fieldset { border: 1px solid var(--panel-edge); border-radius: var(--radius); background: var(--panel); padding: 12px 16px 16px; margin: 0 0 14px; }
legend { font-weight: 600; padding: 0 6px; font-size: 15px; }

.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--grid); margin: 6px 0 14px; overflow-x: auto; }
.tabs button { border: 0; border-bottom: 2px solid transparent; border-radius: 0; background: transparent; padding: 8px 14px; color: var(--ink-2); }
.tabs button.on { color: var(--ink); border-bottom-color: var(--signal); font-weight: 600; }

/* ---------- tables ---------- */
.tbl-wrap { background: var(--surface); border: 1px solid var(--grid); border-radius: var(--radius); overflow: auto; box-shadow: var(--shadow); }
table.t { border-collapse: separate; border-spacing: 0; width: 100%; font-size: 13.5px; }
table.t th { position: sticky; top: 0; background: var(--panel); text-align: left; font-weight: 600; color: var(--ink-2);
  padding: 8px 10px; border-bottom: 1px solid var(--panel-edge); white-space: nowrap; cursor: pointer; user-select: none; z-index: 1; }
table.t th.num, table.t td.num { text-align: right; }
table.t td { padding: 7px 10px; border-bottom: 1px solid #EEF0F3; vertical-align: top; }
table.t tr:hover td { background: #FAFBFC; }
table.t tr.sel td { background: #F4ECEF; }
table.t tr.click { cursor: pointer; }
.tbl-foot { display: flex; justify-content: space-between; align-items: center; padding: 6px 10px; font-size: 12.5px; color: var(--muted); }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 4px 16px; font-size: 14px; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.empty { padding: 22px; text-align: center; color: var(--muted); border: 1px dashed var(--baseline); border-radius: var(--radius); background: #fff; }

/* ---------- notices ---------- */
.note { border-left: 3px solid var(--info); background: #fff; padding: 9px 12px; border-radius: 0 var(--radius-sm) var(--radius-sm) 0; font-size: 14px; margin: 8px 0; }
.note.err { border-left-color: var(--fail); } .note.ok { border-left-color: var(--pass); } .note.warn { border-left-color: var(--warn); }
.toasts { position: fixed; right: 18px; bottom: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 100; }
.toast { background: var(--charcoal); color: #fff; padding: 10px 14px; border-radius: var(--radius-sm); box-shadow: var(--shadow-lift);
  font-size: 14px; max-width: 420px; animation: tin .18s ease-out; border-left: 4px solid var(--pass); }
.toast.err { border-left-color: var(--fail); }
@keyframes tin { from { transform: translateY(8px); opacity: 0 } to { transform: none; opacity: 1 } }
.modal-bg { position: fixed; inset: 0; background: rgba(20,22,27,.45); display: grid; place-items: center; z-index: 90; }
.modal { background: #fff; border-radius: 10px; padding: 20px 22px; width: min(520px, 92vw); box-shadow: var(--shadow-lift); max-height: 90vh; overflow: auto; }
.modal h3 { margin: 0 0 6px; font-size: 18px; }
.modal .actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }

/* ---------- charts (SVG) ---------- */
svg.ch { display: block; width: 100%; height: auto; overflow: visible; font-family: var(--font); }
svg.ch text { fill: var(--muted); font-size: 11px; }
svg.ch .gl { stroke: var(--grid); stroke-width: 1; }
svg.ch .ax { stroke: var(--baseline); stroke-width: 1; }
svg.ch .lbl { fill: var(--ink-2); font-size: 11.5px; }
.legend { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 12px; color: var(--ink-2); margin: 2px 0 4px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; vertical-align: -1px; }
.tip { position: fixed; pointer-events: none; background: var(--charcoal); color: #fff; font-size: 12px; padding: 6px 9px;
  border-radius: 5px; z-index: 120; box-shadow: var(--shadow-lift); white-space: nowrap; }

/* ---------- drag and drop ---------- */
.chip { display: inline-flex; align-items: center; gap: 6px; background: #fff; border: 1px solid var(--baseline); border-radius: 6px;
  padding: 4px 8px; font-size: 12.5px; cursor: grab; user-select: none; box-shadow: var(--shadow); touch-action: none; max-width: 100%; }
.chip:active { cursor: grabbing; }
.chip .mono { font-size: 12px; }
.chip.sel { border-color: var(--signal); box-shadow: 0 0 0 2px rgba(145,0,41,.18); }
.chip.stat { background: #fff6f6; }
.chip .pri { font-size: 10px; font-weight: 700; color: #fff; background: var(--fail); border-radius: 3px; padding: 0 4px; }
.chip.ctl { background: #F3F5F8; border-style: dashed; }
.dragging { opacity: .45; }
.ghost-drag { position: fixed; pointer-events: none; z-index: 200; background: var(--charcoal); color: #fff; border-radius: 6px;
  padding: 5px 10px; font-size: 12.5px; box-shadow: var(--shadow-lift); }
.drop { transition: background .12s, box-shadow .12s; }
.drop.over { background: #F7EEF1 !important; box-shadow: inset 0 0 0 2px var(--signal); }
.drop.deny { box-shadow: inset 0 0 0 2px var(--fail); }
.queue { display: flex; flex-direction: column; gap: 6px; max-height: 640px; overflow: auto; padding: 8px; background: var(--panel);
  border: 1px solid var(--panel-edge); border-radius: var(--radius); min-height: 120px; }

/* plate map */
.plate { display: grid; gap: 4px; background: #fff; border: 1px solid var(--grid); border-radius: 10px; padding: 12px; box-shadow: var(--shadow); overflow-x: auto; }
.plate .hd { font-size: 11px; color: var(--muted); text-align: center; align-self: center; font-family: var(--mono); }
.well { aspect-ratio: 1/1; min-width: 34px; border-radius: 50%; border: 1.5px solid var(--baseline); background: #FAFBFC;
  display: grid; place-items: center; font-size: 9.5px; font-family: var(--mono); color: var(--ink-2); cursor: default; position: relative; overflow: hidden; }
.well.f { background: #E7EEF6; border-color: var(--s1); color: var(--ink); cursor: grab; }
.well.f.ctl-NTC, .well.f.ctl-NEG { background: #EEF0F3; border-color: var(--s5); border-style: dashed; }
.well.f.ctl-POS { background: #FCEFE3; border-color: var(--s2); }
.well.f.ctl-STD { background: #EAF6F4; border-color: var(--s3); }
.well.f.ctl-REF { background: #F1ECF8; border-color: var(--s4); }
.well.sel { box-shadow: 0 0 0 2px var(--signal); }
.well.over { background: #F7EEF1; border-color: var(--signal); }
.plate.p384 .well { min-width: 18px; font-size: 0; border-width: 1px; }
.plate.lanes { grid-template-columns: repeat(4, 1fr) !important; }
.lane { min-height: 140px; border-radius: 8px; border: 1.5px dashed var(--baseline); padding: 8px; display: flex; flex-direction: column; gap: 4px; background: #FAFBFC; }
.lane h4 { margin: 0 0 4px; font-size: 12px; color: var(--ink-2); }

/* batches and people boards */
.board { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; }
.bcard { background: #fff; border: 1px solid var(--grid); border-radius: var(--radius); padding: 10px 12px; box-shadow: var(--shadow); min-height: 110px; display: flex; flex-direction: column; gap: 6px; }
.bcard .hd { display: flex; justify-content: space-between; align-items: center; gap: 6px; }
.bcard .hd b { font-family: var(--mono); font-size: 13px; }
.bcard .body { display: flex; flex-wrap: wrap; gap: 4px; max-height: 150px; overflow: auto; }
.bcard .cap { height: 5px; background: var(--grid); border-radius: 3px; overflow: hidden; }
.bcard .cap i { display: block; height: 100%; background: var(--s1); }
.bcard[draggable=true], .bcard.dragsrc { cursor: grab; }
.person { display: flex; align-items: center; gap: 10px; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--charcoal); color: #fff; display: grid; place-items: center;
  font-size: 12px; font-weight: 600; flex: none; }
.avatar.grp { background: var(--s5); border-radius: 8px; }
.load { font-size: 12px; color: var(--muted); }

/* timeline (stories) */
.tl { position: relative; padding-left: 22px; }
.tl:before { content: ""; position: absolute; left: 7px; top: 4px; bottom: 4px; width: 2px; background: var(--grid); }
.tl .ev { position: relative; margin-bottom: 12px; }
.tl .ev:before { content: ""; position: absolute; left: -19px; top: 5px; width: 10px; height: 10px; border-radius: 50%; background: var(--s1); border: 2px solid #fff; box-shadow: 0 0 0 1px var(--baseline); }
.tl .ev.FAIL:before { background: var(--fail); } .tl .ev.WARN:before { background: var(--warn); } .tl .ev.PASS:before { background: var(--pass); }
.tl .ev .at { font-size: 12px; color: var(--muted); font-family: var(--mono); }

/* canvas (custom view) */
.canvas-grid { display: grid; grid-template-columns: repeat(12, minmax(0,1fr)); gap: 12px; grid-auto-rows: minmax(90px, auto); }
.ctile { background: #fff; border: 1px solid var(--grid); border-radius: var(--radius); padding: 10px 12px; box-shadow: var(--shadow); position: relative; min-width: 0; }
.ctile .tb { position: absolute; right: 6px; top: 6px; display: none; gap: 2px; }
.editing .ctile .tb { display: flex; }
.editing .ctile { outline: 1px dashed var(--baseline); cursor: grab; }
.lib { display: flex; flex-wrap: wrap; gap: 6px; }

/* login */
.login-bg { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.login-art { background: var(--charcoal); color: #fff; padding: 56px; display: flex; flex-direction: column; justify-content: space-between; }
.login-art h1 { font-size: 40px; line-height: 1.1; margin: 0; letter-spacing: -.02em; }
.login-art .band { height: 4px; width: 72px; background: var(--signal-on-dark); margin: 22px 0; }
.login-form { display: grid; place-items: center; padding: 32px; }
.login-form form { width: min(380px, 100%); display: flex; flex-direction: column; gap: 14px; }
@media (max-width: 900px) { .login-bg { grid-template-columns: 1fr; } .login-art { padding: 28px; } }

.step { display: grid; grid-template-columns: 34px 1fr; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--grid); }
.step .num { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-weight: 600; font-size: 13px; background: var(--grid); }
.step.DONE .num { background: var(--pass); color: #fff; } .step.DEVIATION .num { background: var(--warn); }
.step.CURRENT .num { background: var(--signal); color: #fff; } .step.LOCKED { opacity: .55; }
.chat { display: flex; flex-direction: column; gap: 10px; }
.msg { max-width: 820px; padding: 10px 14px; border-radius: 10px; background: #fff; border: 1px solid var(--grid); white-space: pre-wrap; }
.msg.me { align-self: flex-end; background: var(--panel); border-color: var(--panel-edge); }
table.t td .sq-id, .tag, .pill { white-space: nowrap; }

/* ---------- sample journey ---------- */
.flow { display: flex; align-items: stretch; gap: 6px; overflow-x: auto; padding: 4px 2px 10px; }
.fl-step { flex: 1 1 0; min-width: 150px; text-align: left; font: inherit; color: inherit; cursor: pointer;
  background: var(--surface); border: 1px solid var(--grid); border-top: 3px solid var(--charcoal); border-radius: var(--radius);
  padding: 10px 12px; display: flex; flex-direction: column; gap: 4px; box-shadow: var(--shadow); }
.fl-step:hover { border-color: var(--baseline); }
.fl-step.on { border-color: var(--signal); border-top-color: var(--signal); box-shadow: 0 0 0 1px var(--signal); }
.fl-step.zero { opacity: .62; }
.fl-top { display: flex; align-items: center; gap: 7px; font-size: 13px; font-weight: 600; line-height: 1.25; }
.fl-no { display: inline-grid; place-items: center; min-width: 20px; height: 20px; border-radius: 50%; background: var(--charcoal);
  color: #fff; font-size: 11px; flex: none; }
.fl-step.on .fl-no { background: var(--signal); }
.fl-n { font-size: 28px; font-weight: 600; letter-spacing: -.01em; line-height: 1.1; }
.fl-meta { display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: 12px; color: var(--muted); min-height: 16px; }
.fl-late { color: var(--fail); font-weight: 600; }
.fl-who { display: flex; align-items: center; gap: 5px; font-size: 12px; color: var(--ink-2); margin-top: auto; padding-top: 4px; border-top: 1px dashed var(--grid); }
.fl-arrow { align-self: center; color: var(--baseline); font-size: 18px; flex: none; }
.fl-edge { flex: 0 0 104px; display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 6px; text-align: center;
  font-size: 12px; color: var(--ink-2); background: var(--panel); border: 1px dashed var(--panel-edge); border-radius: var(--radius); padding: 8px; }
.fl-edge:hover { text-decoration: none; color: var(--signal); border-color: var(--signal); }
.stepper { list-style: none; margin: 4px 0 0; padding: 0; }
.stepper li { display: grid; grid-template-columns: 26px 1fr; gap: 10px; position: relative; padding-bottom: 14px; }
.stepper li::before { content: ""; position: absolute; left: 11px; top: 22px; bottom: 0; width: 2px; background: var(--grid); }
.stepper li:last-child::before { display: none; }
.stepper li.done::before { background: var(--charcoal); }
.stepper .dot { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-size: 13px; font-weight: 700;
  border: 2px solid var(--baseline); background: var(--surface); color: #fff; position: relative; z-index: 1; }
.stepper li.done .dot { background: var(--charcoal); border-color: var(--charcoal); }
.stepper li.current .dot { border-color: var(--signal); box-shadow: 0 0 0 4px rgba(145,0,41,.14); }
.stepper .st-title { font-weight: 600; font-size: 14px; display: flex; gap: 8px; align-items: center; }
.stepper li.todo .st-title { color: var(--muted); font-weight: 400; }
.stepper .st-now { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--signal); border: 1px solid var(--signal);
  border-radius: 999px; padding: 0 7px; }
.stepper .st-sub { font-size: 12.5px; color: var(--muted); }
.jtests { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }

.fl-top svg { flex: none; color: var(--ink-2); }
.stepper .st-title svg { color: var(--ink-2); }
.side .grp.step svg { color: var(--signal-on-dark); }

/* ---------- scanning and labels ---------- */
.scanpad { display: grid; grid-template-columns: minmax(280px, 420px) 1fr; gap: 18px; align-items: start; }
.scanbox { background: var(--surface); border: 1px solid var(--grid); border-radius: var(--radius); padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.scanbox .big { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 18px; font-size: 17px; font-weight: 600;
  background: var(--signal); color: #fff; border: 0; border-radius: var(--radius); cursor: pointer; font-family: inherit; }
.scanbox .big.ghost { background: var(--surface); color: var(--signal); border: 1px solid var(--signal); }
.scanbox video { width: 100%; border-radius: var(--radius-sm); background: #000; aspect-ratio: 4/3; object-fit: cover; }
.scanbox input[type=text] { font-family: var(--mono); font-size: 15px; padding: 10px; }
.scanres { background: var(--surface); border: 1px solid var(--grid); border-top: 4px solid var(--charcoal); border-radius: var(--radius); padding: 18px; }
.scanres.st-PASS { border-top-color: var(--pass); } .scanres.st-WARN { border-top-color: var(--warn); } .scanres.st-FAIL { border-top-color: var(--fail); }
.scanres .hd { display: flex; gap: 14px; align-items: center; }
.scanres .hd .ic { width: 52px; height: 52px; border-radius: 12px; background: var(--panel); display: grid; place-items: center; color: var(--charcoal); flex: none; }
.scanres .hd h2 { margin: 0; font-size: 22px; } .scanres .kind { font-size: 12px; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); }
.scanres .cue { display: inline-flex; align-items: center; gap: 8px; margin: 12px 0 4px; padding: 6px 12px 6px 6px; border-radius: 999px; background: var(--charcoal); color: #fff; font-weight: 600; }
.scanres .cue .n { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--signal); font-size: 12px; }
.minij { display: flex; gap: 4px; flex-wrap: wrap; margin: 10px 0; }
.minij span { font-size: 12px; padding: 3px 8px; border-radius: 999px; border: 1px solid var(--grid); color: var(--muted); }
.minij span.done { background: var(--panel); color: var(--ink-2); } .minij span.on { background: var(--signal); border-color: var(--signal); color: #fff; font-weight: 600; }
.scanres .acts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.scanres .acts a { padding: 10px 14px; border-radius: var(--radius-sm); border: 1px solid var(--grid); font-weight: 600; font-size: 14px; }
.scanres .acts a.primary { background: var(--signal); color: #fff; border-color: var(--signal); }
.scanres .acts a:hover { text-decoration: none; filter: brightness(.96); }
.labels { display: flex; flex-wrap: wrap; gap: 8px; }
.lbl { background: #fff; border: 1px dashed var(--baseline); border-radius: 4px; display: grid; grid-template-columns: auto 1fr; gap: 8px; align-items: center;
  padding: 6px 8px; break-inside: avoid; page-break-inside: avoid; color: #000; }
.lbl.tag { width: 90mm; height: 38mm; } .lbl.tube { width: 50mm; height: 22mm; gap: 5px; padding: 3px 5px; }
.lbl .q svg { display: block; shape-rendering: crispEdges; width: 32mm; height: 32mm; } .lbl.tube .q svg { width: 19mm; height: 19mm; }
.lbl .t { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.lbl .id { font-family: var(--mono); font-weight: 700; font-size: 15px; letter-spacing: -.02em; white-space: nowrap; }
.lbl.tube .id { font-size: 10.5px; } .lbl .l1 { font-size: 12px; font-weight: 600; line-height: 1.2; } .lbl .l2 { font-size: 10.5px; color: #333; line-height: 1.2; }
.lbl.tube .l1 { font-size: 8.5px; } .lbl.tube .l2 { display: none; } .lbl.tube .l2.show { display: block; font-size: 8px; }
.lbl .k { display: flex; align-items: center; gap: 4px; font-size: 9px; text-transform: uppercase; letter-spacing: .08em; color: #333; }
.lbl.tube .k { font-size: 7px; } .lbl .k svg { width: 11px; height: 11px; }
@media print {
  .side, .wsbar, header, .filters, .noprint, .loadbar { display: none !important; }
  .frame { display: block; } main.canvas { padding: 0; max-width: none; } body { background: #fff; }
  .lbl { border: 0.2mm solid #999; }
  @page { margin: 8mm; }
}
@media (max-width: 900px) { .scanpad { grid-template-columns: 1fr; } }

/* a value proposed by Sigma (AI): outlined until a person changes or confirms it (gate A3) */
input.ai, select.ai { outline: 2px solid var(--warn); outline-offset: 1px; background: #FFF9EA; }
.aires { border-top-color: var(--info) !important; }
.aibadge { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 600; color: var(--info);
  border: 1px solid var(--info); border-radius: 999px; padding: 1px 9px; text-transform: uppercase; letter-spacing: .06em; }
/* the metric shown below the cards (metrics and trends page) */
.tile.sel { outline: 2px solid var(--signal, #910029); outline-offset: -1px; box-shadow: 0 2px 10px rgba(145, 0, 41, .12); }
.tile .s > div + div { margin-top: 1px; }

/* ---------------- home page: the four areas of work, and the person's KPIs */
.homeboxes { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
@media (max-width: 1250px) { .homeboxes { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 700px) { .homeboxes { grid-template-columns: 1fr; } }
.homebox { background: var(--surface); border: 1px solid var(--grid); border-top: 4px solid var(--signal); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 16px 16px 14px; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.homebox.locked { border-top-color: var(--grid); opacity: .72; }
.hb-head { display: flex; align-items: center; gap: 10px; }
.hb-head h3 { margin: 0; font-size: 17px; font-weight: 600; }
.hb-n { width: 26px; height: 26px; border-radius: 50%; background: var(--charcoal); color: #fff; display: inline-flex; align-items: center;
  justify-content: center; font-size: 13px; font-weight: 600; flex: none; }
.hb-ic { color: var(--signal); display: inline-flex; }
.homebox.locked .hb-ic { color: var(--muted); }
.hb-blurb { margin: 0; font-size: 13px; color: var(--ink-2); line-height: 1.45; min-height: 3.2em; }
.hb-stats { display: grid; gap: 6px; }
.hb-stat { display: flex; align-items: baseline; gap: 8px; font-size: 13px; color: var(--ink-2); }
.hb-stat b { font-size: 20px; font-weight: 600; color: var(--ink); min-width: 2.2em; text-align: right; }
.hb-stat.warn b { color: var(--fail); }
.hb-levels { display: grid; gap: 6px; }
.hb-level { display: grid; grid-template-columns: minmax(0, 1fr) auto 14px; box-sizing: border-box; align-items: center; gap: 8px; text-align: left; width: 100%;
  background: var(--panel, #ECF4F7); border: 1px solid var(--grid); border-radius: 8px; padding: 8px 10px; font: inherit; color: inherit; cursor: pointer; }
.hb-level:hover { border-color: var(--signal); }
.hb-level .lw { display: flex; flex-direction: column; min-width: 0; }
.hb-level .lv { font-weight: 600; font-size: 13.5px; }
.hb-level .wh { font-size: 12px; color: var(--muted); }
.hb-level .ct { display: flex; flex-direction: column; align-items: flex-end; font-size: 11.5px; color: var(--muted); line-height: 1.2; }
.hb-level .ct b { font-size: 18px; color: var(--ink); font-weight: 600; }
.hb-level .ct.warn b { color: var(--fail); }
.hb-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: auto; padding-top: 4px; }
.hb-lock { margin-top: auto; font-size: 12.5px; color: var(--muted); display: flex; align-items: center; gap: 4px; }
.kpi-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.kpi { background: var(--surface); border: 1px solid var(--grid); border-left: 4px solid var(--grid); border-radius: var(--radius); padding: 12px 14px; box-shadow: var(--shadow); }
.kpi.up { border-left-color: var(--pass); } .kpi.down { border-left-color: var(--fail); }
.kpi .l { font-size: 12.5px; color: var(--ink-2); }
.kpi .v { font-size: 26px; font-weight: 600; margin: 2px 0; } .kpi .v small { font-size: 12px; font-weight: 400; color: var(--muted); }
.kpi .s { font-size: 12.5px; color: var(--muted); } .kpi.up .s { color: #0a7d0a; } .kpi.down .s { color: var(--fail); }
.kpi .s .tg { color: var(--muted); }
