/* SCANORY ADMIN design system. Tokens first; components below use only tokens.
   Light and dark themes are two token sets (data-theme on <html>); nothing else changes between them. */
:root {
  --font: ui-sans-serif, -apple-system, BlinkMacSystemFont, 'Segoe UI', Inter, Roboto, 'Helvetica Neue', Arial, sans-serif;
  --mono: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  --bg: #f4f5f8; --surface: #ffffff; --surface-2: #f8f9fb; --sunken: #eef0f4;
  --line: #e2e5ec; --line-strong: #cdd2dc;
  --text: #161b26; --text-2: #465061; --text-3: #5d6778;
  --primary: #2c4a86; --primary-hover: #223b6c; --primary-soft: #e8edf8; --on-primary: #ffffff;
  --brand: #a88759;
  --ok: #17693f; --ok-bg: #e4f4ea; --warn: #8a5300; --warn-bg: #fff3d1; --danger: #b3261e; --danger-bg: #fdeceb;
  --info: #1d4ed8; --info-bg: #e7eeff; --pending: #6d28d9; --pending-bg: #f0e8ff; --neutral: #4b5567; --neutral-bg: #eceff4;
  --focus: #2563eb;
  --radius: 8px; --radius-lg: 12px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
  --shadow-lg: 0 12px 32px rgba(16, 24, 40, .18);
  --sidebar: 248px; --sidebar-collapsed: 68px; --topbar: 56px;
  color-scheme: light;
}
:root[data-theme='dark'] {
  --bg: #0f131b; --surface: #171c27; --surface-2: #1b212e; --sunken: #121722;
  --line: #2a3243; --line-strong: #3a4458;
  --text: #e8ecf4; --text-2: #b4bccb; --text-3: #8d97aa;
  --primary: #7b9cf0; --primary-hover: #94b0f5; --primary-soft: #1e2a47; --on-primary: #0d1424;
  --ok: #5fd08f; --ok-bg: #12301f; --warn: #f2c15b; --warn-bg: #33270c; --danger: #ff8a80; --danger-bg: #3a1714;
  --info: #8fb0ff; --info-bg: #17254a; --pending: #c4a4ff; --pending-bg: #2a1c4d; --neutral: #b4bccb; --neutral-bg: #232a39;
  --focus: #8fb0ff; --shadow: 0 1px 2px rgba(0, 0, 0, .4); --shadow-lg: 0 12px 32px rgba(0, 0, 0, .55);
  color-scheme: dark;
}
*, *::before, *::after { box-sizing: border-box; }
html { font-size: 15px; -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 400 1rem/1.5 var(--font); color: var(--text); background: var(--bg); }
h1, h2, h3, h4 { margin: 0; font-weight: 650; letter-spacing: -.01em; line-height: 1.25; }
h1 { font-size: 1.5rem; } h2 { font-size: 1.125rem; } h3 { font-size: 1rem; } h4 { font-size: .8125rem; text-transform: uppercase; letter-spacing: .06em; color: var(--text-3); }
p { margin: 0; } a { color: var(--primary); text-underline-offset: 2px; } code, .mono { font-family: var(--mono); font-size: .875em; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--primary); color: var(--on-primary); padding: .5rem .8rem; border-radius: var(--radius); z-index: 100; }
.skip:focus { left: 8px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--text-3); } .small { font-size: .8125rem; } .right { text-align: right; } .nowrap { white-space: nowrap; }
svg.icon { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }

/* ---- shell ---- */
.shell { display: grid; grid-template-columns: var(--sidebar) minmax(0, 1fr); min-height: 100vh; }
.shell[data-collapsed='true'] { grid-template-columns: var(--sidebar-collapsed) minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; background: var(--surface); border-right: 1px solid var(--line); padding: .75rem .6rem; gap: .25rem; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: .6rem; padding: .4rem .5rem .9rem; min-height: 52px; }
.brand-mark { width: 32px; height: 32px; border-radius: 9px; background: var(--primary); color: var(--on-primary); display: grid; place-items: center; font-weight: 700; letter-spacing: .02em; flex: none; box-shadow: inset 0 -3px 0 var(--brand); }
.brand-text { display: grid; line-height: 1.1; } .brand-name { font-weight: 700; letter-spacing: .12em; font-size: .8125rem; } .brand-sub { font-size: .6875rem; color: var(--text-3); letter-spacing: .08em; text-transform: uppercase; }
.nav { display: grid; gap: 2px; margin: 0; padding: 0; list-style: none; }
.nav a { display: flex; align-items: center; gap: .7rem; padding: .55rem .65rem; border-radius: var(--radius); color: var(--text-2); text-decoration: none; font-weight: 500; font-size: .9375rem; position: relative; }
.nav a:hover { background: var(--sunken); color: var(--text); }
.nav a[aria-current='page'] { background: var(--primary-soft); color: var(--primary); }
.nav .count { margin-left: auto; font-size: .75rem; font-weight: 600; background: var(--danger-bg); color: var(--danger); border-radius: 999px; padding: 0 .45rem; min-width: 1.4rem; text-align: center; }
.nav-label { font-size: .72rem; font-weight: 650; text-transform: uppercase; letter-spacing: .08em; color: var(--text-3); padding: .85rem .65rem .25rem; margin: 0; }
.sidebar-foot { margin-top: auto; display: grid; gap: .25rem; border-top: 1px solid var(--line); padding-top: .6rem; }
.shell[data-collapsed='true'] .brand-text, .shell[data-collapsed='true'] .nav a span.label, .shell[data-collapsed='true'] .nav .count, .shell[data-collapsed='true'] .nav-label, .shell[data-collapsed='true'] .foot-text { display: none; }
.shell[data-collapsed='true'] .nav a { justify-content: center; }
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 20; height: var(--topbar); display: flex; align-items: center; gap: .75rem; padding: 0 1.25rem; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.topbar .grow { flex: 1; }
.search { position: relative; max-width: 420px; flex: 1; }
.search input[type='search'] { width: 100%; padding: .5rem .75rem .5rem 2.2rem; border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--surface); color: var(--text); font: inherit; }
.search .icon { position: absolute; left: .7rem; top: 50%; transform: translateY(-50%); color: var(--text-3); pointer-events: none; }
.search kbd { position: absolute; right: .6rem; top: 50%; transform: translateY(-50%); font: .6875rem var(--mono); color: var(--text-3); border: 1px solid var(--line); border-radius: 4px; padding: 0 .35rem; }
.page { padding: 1.5rem 1.75rem 3rem; max-width: 1360px; width: 100%; margin: 0 auto; display: grid; gap: 1.25rem; align-content: start; }
.page-head { display: flex; flex-wrap: wrap; gap: .75rem 1rem; align-items: flex-start; justify-content: space-between; }
.page-head .lede { color: var(--text-2); margin-top: .25rem; max-width: 62ch; }
.crumbs { display: flex; gap: .4rem; align-items: center; font-size: .8125rem; color: var(--text-3); margin-bottom: .35rem; }
.crumbs a { color: var(--text-2); text-decoration: none; } .crumbs a:hover { text-decoration: underline; }
.actions { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }

/* ---- components ---- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: .75rem; padding: .9rem 1.1rem; border-bottom: 1px solid var(--line); }
.card-body { padding: 1.1rem; display: grid; gap: .9rem; }
.card-body.flush { padding: 0; }
.grid { display: grid; gap: 1.25rem; align-content: start; align-items: start; } .grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.split { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 1rem; }
.tile { display: grid; gap: .25rem; padding: 1rem 1.1rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); text-decoration: none; color: inherit; box-shadow: var(--shadow); border-left-width: 4px; }
a.tile:hover { border-color: var(--line-strong); background: var(--surface-2); }
.tile .num { font-size: 1.9rem; font-weight: 680; letter-spacing: -.02em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.tile .lbl { color: var(--text-2); font-size: .875rem; font-weight: 500; } .tile .hint { color: var(--text-3); font-size: .75rem; }
.tile[data-kind='danger'] { border-left-color: var(--danger); } .tile[data-kind='warn'] { border-left-color: var(--warn); } .tile[data-kind='ok'] { border-left-color: var(--ok); } .tile[data-kind='info'] { border-left-color: var(--info); } .tile[data-kind='neutral'] { border-left-color: var(--line-strong); } .tile[data-kind='pending'] { border-left-color: var(--pending); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .45rem; padding: .5rem .9rem; border-radius: var(--radius); border: 1px solid var(--line-strong); background: var(--surface); color: var(--text); font: 550 .9rem/1.2 var(--font); cursor: pointer; text-decoration: none; min-height: 36px; }
.btn:hover:not([disabled]) { background: var(--sunken); }
.btn[data-kind='primary'] { background: var(--primary); border-color: var(--primary); color: var(--on-primary); } .btn[data-kind='primary']:hover:not([disabled]) { background: var(--primary-hover); }
.btn[data-kind='danger'] { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 45%, var(--line)); } .btn[data-kind='danger']:hover:not([disabled]) { background: var(--danger-bg); }
.btn[data-kind='ghost'] { border-color: transparent; background: transparent; color: var(--text-2); } .btn[data-kind='ghost']:hover:not([disabled]) { background: var(--sunken); color: var(--text); }
.btn[disabled] { opacity: .55; cursor: not-allowed; } .btn.icon-only { padding: .5rem; width: 36px; }
.badge { display: inline-flex; align-items: center; gap: .35rem; padding: .1rem .55rem; border-radius: 999px; font-size: .75rem; font-weight: 600; white-space: nowrap; background: var(--neutral-bg); color: var(--neutral); }
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge[data-kind='ok'] { background: var(--ok-bg); color: var(--ok); } .badge[data-kind='warn'] { background: var(--warn-bg); color: var(--warn); } .badge[data-kind='danger'] { background: var(--danger-bg); color: var(--danger); }
.badge[data-kind='info'] { background: var(--info-bg); color: var(--info); } .badge[data-kind='pending'] { background: var(--pending-bg); color: var(--pending); }
label.field { display: grid; gap: .3rem; font-size: .8125rem; font-weight: 600; color: var(--text-2); }
input[type='text'], input[type='email'], input[type='password'], input[type='search'], select, textarea, input[type='file'] { width: 100%; padding: .5rem .7rem; border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--surface); color: var(--text); font: inherit; min-height: 36px; }
textarea { min-height: 96px; resize: vertical; }
.toolbar { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; padding: .8rem 1.1rem; border-bottom: 1px solid var(--line); }
.toolbar .search { max-width: 320px; } .toolbar select { width: auto; }
.chips { display: flex; flex-wrap: wrap; gap: .35rem; }
.chip { border: 1px solid var(--line); background: var(--surface); color: var(--text-2); border-radius: 999px; padding: .25rem .75rem; font: 550 .8125rem var(--font); cursor: pointer; }
.chip[aria-pressed='true'] { background: var(--primary-soft); color: var(--primary); border-color: color-mix(in srgb, var(--primary) 40%, var(--line)); }
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th { text-align: left; font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; color: var(--text-3); font-weight: 650; padding: .6rem 1rem; background: var(--surface-2); border-bottom: 1px solid var(--line); white-space: nowrap; }
.table th button { all: unset; cursor: pointer; display: inline-flex; gap: .25rem; align-items: center; } .table th button:focus-visible { outline: 2px solid var(--focus); }
.table td { padding: .7rem 1rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table th.right, .table td.right { text-align: right; }
h1[tabindex='-1']:focus { outline: none; }
.table tbody tr[data-link] { cursor: pointer; } .table tbody tr[data-link]:hover { background: var(--surface-2); }
.table td .sub { display: block; color: var(--text-3); font-size: .78rem; }
.pager { display: flex; align-items: center; justify-content: space-between; gap: .75rem; padding: .7rem 1.1rem; border-top: 1px solid var(--line); font-size: .8125rem; color: var(--text-3); }
.list { display: grid; margin: 0; padding: 0; list-style: none; }
.list li { display: flex; gap: .75rem; align-items: center; justify-content: space-between; padding: .7rem 1.1rem; border-bottom: 1px solid var(--line); }
.list li:last-child { border-bottom: 0; } .list a.row { display: grid; gap: .1rem; color: inherit; text-decoration: none; flex: 1; min-width: 0; } .list a.row:hover strong { text-decoration: underline; }
.kv { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: .5rem 1.25rem; margin: 0; font-size: .9rem; } .kv dt { color: var(--text-3); } .kv dd { margin: 0; overflow-wrap: anywhere; }
.tabs { display: flex; gap: .25rem; border-bottom: 1px solid var(--line); overflow-x: auto; }
.tabs button { all: unset; cursor: pointer; padding: .65rem 1rem; font-weight: 600; color: var(--text-2); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs button:hover { color: var(--text); } .tabs button[aria-selected='true'] { color: var(--primary); border-bottom-color: var(--primary); } .tabs button:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }
.stepper { display: flex; flex-wrap: wrap; gap: .25rem; list-style: none; margin: 0; padding: 0; counter-reset: s; }
.stepper li { display: flex; align-items: center; gap: .5rem; padding: .35rem .7rem; border-radius: 999px; background: var(--sunken); color: var(--text-3); font-size: .8125rem; font-weight: 600; }
.stepper li[data-done='true'] { background: var(--ok-bg); color: var(--ok); } .stepper li[aria-current='step'] { background: var(--primary); color: var(--on-primary); }
.callout { display: flex; gap: .75rem; padding: .8rem 1rem; border-radius: var(--radius); background: var(--info-bg); color: var(--text); border: 1px solid color-mix(in srgb, var(--info) 30%, var(--line)); font-size: .9rem; }
.callout[data-kind='warn'] { background: var(--warn-bg); border-color: color-mix(in srgb, var(--warn) 35%, var(--line)); } .callout[data-kind='danger'] { background: var(--danger-bg); border-color: color-mix(in srgb, var(--danger) 35%, var(--line)); } .callout[data-kind='ok'] { background: var(--ok-bg); border-color: color-mix(in srgb, var(--ok) 35%, var(--line)); }
.callout .icon { margin-top: 2px; } .callout > div { display: grid; gap: .25rem; }
.empty { display: grid; gap: .5rem; justify-items: center; text-align: center; padding: 2.5rem 1rem; color: var(--text-2); } .empty .icon { width: 32px; height: 32px; color: var(--text-3); } .empty h3 { color: var(--text); }
.skeleton { background: linear-gradient(90deg, var(--sunken), var(--surface-2), var(--sunken)); background-size: 200% 100%; animation: sk 1.2s infinite linear; border-radius: 6px; height: 1rem; } .skeleton.tall { height: 5rem; }
@keyframes sk { to { background-position: -200% 0; } }
.timeline { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; } .timeline li { display: grid; grid-template-columns: 9rem minmax(0, 1fr); gap: .75rem; padding: .55rem 0; border-bottom: 1px dashed var(--line); font-size: .875rem; } .timeline li:last-child { border-bottom: 0; } .timeline time { color: var(--text-3); font-variant-numeric: tabular-nums; }
.checks { list-style: none; margin: 0; padding: 0; display: grid; gap: .45rem; } .checks li { display: flex; gap: .6rem; align-items: flex-start; font-size: .9rem; } .checks .icon { margin-top: 2px; }
.checks li[data-ok='true'] .icon { color: var(--ok); } .checks li[data-ok='false'] .icon { color: var(--danger); } .checks li[data-ok='pending'] .icon { color: var(--warn); }
.preview-frame { width: 100%; height: 72vh; min-height: 420px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: #0f0806; }
.thumb { max-width: 100%; max-height: 340px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }
.story-block { display: grid; gap: .2rem; padding: .7rem 0; border-bottom: 1px solid var(--line); } .story-block:last-child { border-bottom: 0; } .story-block p { white-space: pre-wrap; overflow-wrap: anywhere; }
dialog.dlg { border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 0; width: min(520px, calc(100vw - 2rem)); background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg); }
dialog.dlg::backdrop { background: rgba(10, 14, 22, .55); }
dialog.dlg form { display: grid; gap: 1rem; padding: 1.25rem; } dialog.dlg .dlg-actions { display: flex; justify-content: flex-end; gap: .5rem; }
.toasts { position: fixed; right: 1rem; bottom: 1rem; display: grid; gap: .5rem; z-index: 200; max-width: min(420px, calc(100vw - 2rem)); }
.toast { padding: .7rem 1rem; border-radius: var(--radius); background: var(--text); color: var(--bg); box-shadow: var(--shadow-lg); font-size: .9rem; } .toast[data-kind='danger'] { background: var(--danger); color: #fff; } .toast[data-kind='ok'] { background: var(--ok); color: #fff; }
:root[data-theme='dark'] .toast[data-kind='ok'], :root[data-theme='dark'] .toast[data-kind='danger'] { color: #0d1424; }
.login { min-height: 100vh; display: grid; place-items: center; padding: 1rem; }
.login .card { width: min(400px, 100%); } .login form { display: grid; gap: .9rem; padding: 1.5rem; }
.bar { height: 8px; border-radius: 999px; background: var(--sunken); overflow: hidden; display: flex; } .bar span { display: block; height: 100%; }
.menu-btn { display: none; }
@media (max-width: 1100px) { .grid.cols-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .grid.split { grid-template-columns: 1fr; } }
@media (max-width: 860px) {
  .shell, .shell[data-collapsed='true'] { grid-template-columns: 1fr; }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: min(280px, 86vw); z-index: 60; transform: translateX(-102%); transition: transform .18s ease; box-shadow: var(--shadow-lg); }
  .shell[data-drawer='true'] .sidebar { transform: none; }
  .shell[data-collapsed='true'] .brand-text, .shell[data-collapsed='true'] .nav a span.label, .shell[data-collapsed='true'] .nav .count, .shell[data-collapsed='true'] .nav-label, .shell[data-collapsed='true'] .foot-text { display: revert; }
  .shell[data-collapsed='true'] .nav a { justify-content: flex-start; }
  .scrim { position: fixed; inset: 0; background: rgba(10, 14, 22, .5); z-index: 50; }
  .menu-btn { display: inline-flex; } .collapse-btn { display: none; }
  .page { padding: 1rem 1rem 2.5rem; } .grid.cols-2, .grid.cols-3 { grid-template-columns: 1fr; } .topbar { padding: 0 .75rem; } .search kbd { display: none; }
  .timeline li { grid-template-columns: 1fr; gap: 0; }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .6rem; } .tile { padding: .75rem .85rem; } .tile .num { font-size: 1.5rem; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* ---- dashboard (dense, hierarchy: attention > status strip > pipeline/activity) ---- */
.page-dashboard { gap: 1rem; padding-top: 1.25rem; }
.page-head.compact { align-items: center; flex-wrap: nowrap; } .page-head.compact .lede { font-size: .8125rem; margin-top: .1rem; color: var(--text-3); }
.dot { width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--neutral); display: inline-block; }
.dot[data-kind='danger'] { background: var(--danger); } .dot[data-kind='warn'] { background: var(--warn); } .dot[data-kind='info'] { background: var(--info); } .dot[data-kind='pending'] { background: var(--pending); } .dot[data-kind='ok'] { background: var(--ok); } .dot[data-kind='neutral'] { background: var(--line-strong); }
.statbar { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden; }
.stat { display: grid; gap: .1rem; padding: .7rem 1rem; text-decoration: none; color: inherit; border-left: 1px solid var(--line); position: relative; transition: background-color .12s ease; }
.stat:first-child { border-left: 0; } .stat:hover { background: var(--surface-2); }
.stat-num { font-size: 1.375rem; font-weight: 650; letter-spacing: -.02em; line-height: 1.15; font-variant-numeric: tabular-nums; color: var(--text); }
.stat-label { font-size: .75rem; color: var(--text-3); font-weight: 550; display: flex; align-items: center; gap: .35rem; }
.stat-label::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--line-strong); }
.stat[data-kind='danger'] .stat-label::before { background: var(--danger); } .stat[data-kind='warn'] .stat-label::before { background: var(--warn); } .stat[data-kind='info'] .stat-label::before { background: var(--info); } .stat[data-kind='pending'] .stat-label::before { background: var(--pending); } .stat[data-kind='ok'] .stat-label::before { background: var(--ok); }
.stat.is-critical[data-kind='danger'] .stat-num { color: var(--danger); } .stat.is-critical[data-kind='warn'] .stat-num { color: var(--warn); }
.stat.is-critical::after { content: ''; position: absolute; left: 0; right: 0; top: 0; height: 2px; background: currentColor; }
.stat.is-critical[data-kind='danger']::after { background: var(--danger); } .stat.is-critical[data-kind='warn']::after { background: var(--warn); }
.dash-grid { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(280px, 1fr); gap: 1rem; align-items: start; }
.dash-side { display: grid; gap: 1rem; align-content: start; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: .75rem; padding: .7rem 1rem; border-bottom: 1px solid var(--line); }
.panel-head h2 { font-size: .9375rem; font-weight: 650; }
.panel-body { padding: .85rem 1rem; display: grid; gap: .7rem; }
.panel-count { font-size: .75rem; font-weight: 650; padding: .1rem .55rem; border-radius: 999px; background: var(--neutral-bg); color: var(--neutral); }
.panel-count[data-kind='danger'] { background: var(--danger-bg); color: var(--danger); } .panel-count[data-kind='warn'] { background: var(--warn-bg); color: var(--warn); } .panel-count[data-kind='ok'] { background: var(--ok-bg); color: var(--ok); }
.attention { border-color: var(--line-strong); }
.att-group + .att-group { border-top: 1px solid var(--line); }
.att-label { display: flex; align-items: center; gap: .5rem; padding: .6rem 1rem .25rem; font-size: .75rem; font-weight: 650; text-transform: uppercase; letter-spacing: .05em; color: var(--text-2); }
.att-count { color: var(--text-3); font-weight: 600; }
.att-list { list-style: none; margin: 0; padding: 0 0 .35rem; }
.att-row { display: grid; grid-template-columns: 7.5rem minmax(0, 1fr) auto auto; align-items: center; gap: .75rem; padding: .5rem 1rem; color: inherit; text-decoration: none; border-radius: 0; transition: background-color .12s ease; }
.att-row:hover { background: var(--surface-2); } .att-row:focus-visible { outline-offset: -2px; }
.att-id { font-weight: 650; font-size: .875rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.att-main { display: grid; min-width: 0; } .att-next { font-size: .875rem; font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.att-meta { font-size: .75rem; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.att-age { font-size: .75rem; color: var(--text-3); white-space: nowrap; font-variant-numeric: tabular-nums; }
.att-cta { display: inline-flex; align-items: center; gap: .15rem; font-size: .75rem; font-weight: 650; color: var(--primary); white-space: nowrap; }
.att-cta .icon { width: 14px; height: 14px; transition: transform .12s ease; } .att-row:hover .att-cta .icon { transform: translateX(2px); }
.att-cta[data-kind='danger'] { color: var(--danger); }
.att-more { display: block; padding: .25rem 1rem .6rem 2.25rem; font-size: .8125rem; font-weight: 600; text-decoration: none; }
.all-clear { display: flex; align-items: center; gap: .6rem; padding: 1rem; color: var(--text-2); font-size: .875rem; } .all-clear .icon { color: var(--ok); }
.bar span[data-kind='danger'] { background: var(--danger); } .bar span[data-kind='warn'] { background: var(--warn); } .bar span[data-kind='info'] { background: var(--info); } .bar span[data-kind='pending'] { background: var(--pending); } .bar span[data-kind='ok'] { background: var(--ok); } .bar span[data-kind='neutral'] { background: var(--line-strong); }
.bar { gap: 2px; background: transparent; } .bar span { border-radius: 2px; }
.legend { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .3rem 1rem; font-size: .8125rem; }
.legend li { display: flex; align-items: center; gap: .45rem; } .legend-num { margin-left: auto; font-weight: 650; font-variant-numeric: tabular-nums; }
.pkg-line { font-size: .8125rem; border-top: 1px solid var(--line); padding-top: .6rem; }
.activity { list-style: none; margin: 0; padding: .3rem 0; }
.activity li { display: flex; justify-content: space-between; gap: .75rem; padding: .35rem 1rem; font-size: .8125rem; }
.activity .act-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .activity a { font-weight: 600; text-decoration: none; } .activity a:hover { text-decoration: underline; }
.activity time { color: var(--text-3); white-space: nowrap; font-variant-numeric: tabular-nums; }
/* sidebar refinement: quieter counts, a clear active marker, responsive hover */
.nav a { transition: background-color .12s ease, color .12s ease; }
.nav a[aria-current='page']::before { content: ''; position: absolute; left: -.6rem; top: .45rem; bottom: .45rem; width: 3px; border-radius: 0 3px 3px 0; background: var(--primary); }
.nav a[aria-current='page'] { font-weight: 600; }
.nav .count { background: var(--sunken); color: var(--text-2); }
.nav .count[data-kind='danger'] { background: var(--danger-bg); color: var(--danger); }
.nav a:active { transform: translateY(1px); }
@media (max-width: 1100px) { .statbar { grid-template-columns: repeat(3, minmax(0, 1fr)); } .stat:nth-child(4) { border-left: 0; } .stat:nth-child(n+4) { border-top: 1px solid var(--line); } .dash-grid { grid-template-columns: 1fr; } .dash-side { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 860px) {
  .statbar { grid-template-columns: repeat(2, minmax(0, 1fr)); } .stat { border-left: 1px solid var(--line); border-top: 1px solid var(--line); } .stat:nth-child(odd) { border-left: 0; } .stat:nth-child(-n+2) { border-top: 0; }
  .dash-side { grid-template-columns: 1fr; }
  .att-row { grid-template-columns: minmax(0, 1fr) auto; gap: .15rem .75rem; } .att-id { grid-column: 1; } .att-age { grid-column: 2; grid-row: 1; text-align: right; } .att-main { grid-column: 1 / -1; } .att-cta { display: none; }
  .nav a[aria-current='page']::before { display: none; }
}

/* ---- production workspace ---- */
.statbar.cols-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.stat[aria-current='true'] { background: var(--primary-soft); }
.next-link { display: inline-flex; align-items: center; gap: .2rem; font-size: .8125rem; font-weight: 600; text-decoration: none; } .next-link .icon { width: 14px; height: 14px; } .next-link:hover { text-decoration: underline; }
.warn-text { color: var(--warn); }
.toolbar select { min-width: 9rem; }
.prod { display: grid; gap: 1rem; }
.prod-grid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(320px, 1fr); gap: 1rem; align-items: start; }
.prod-main, .prod-side { display: grid; gap: 1rem; align-content: start; }
.blockers { border-color: color-mix(in srgb, var(--danger) 45%, var(--line)); }
.blocker-list { list-style: none; margin: 0; padding: 0; } .blocker-list li { display: flex; gap: 1rem; align-items: center; justify-content: space-between; padding: .7rem 1rem; border-top: 1px solid var(--line); } .blocker-list li:first-child { border-top: 0; } .blocker-list p { margin-top: .1rem; }
.preview-stage { display: grid; place-items: center; background: var(--sunken); padding: 1.25rem; min-height: 320px; }
.preview-img { max-width: 100%; max-height: 64vh; box-shadow: var(--shadow-lg); background: #fff; }
.preview-empty { display: grid; justify-items: center; gap: .6rem; text-align: center; color: var(--text-2); max-width: 36ch; } .preview-empty .icon { width: 28px; height: 28px; color: var(--text-3); }
.preview-meta { padding: .55rem 1rem; font-size: .8125rem; color: var(--text-2); border-top: 1px solid var(--line); }
.sub-head { border-top: 1px solid var(--line); }
.file-list { list-style: none; margin: 0; padding: 0; } .file-list li { display: flex; align-items: center; gap: .75rem; padding: .5rem 1rem; border-top: 1px solid var(--line); } .file-list li:first-child { border-top: 0; }
.file-name { display: grid; flex: 1; min-width: 0; } .file-name strong { font-size: .875rem; } .file-name span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-links { display: flex; flex-wrap: wrap; gap: .6rem; font-size: .8125rem; font-weight: 600; } .file-links a { text-decoration: none; } .file-links a:hover { text-decoration: underline; }
.ready-body { padding: .2rem 0 .5rem; } .ready-group .checks { padding: 0 1rem .4rem; gap: .3rem; } .ready-group .checks li { font-size: .8125rem; }
.ready-group[data-status='fail'] .att-label { color: var(--danger); } .ready-group[data-status='pending'] .att-label { color: var(--warn); } .ready-group[data-status='pass'] .att-label { color: var(--ok); }
.approval { list-style: none; margin: 0; padding: .4rem 0; }
.approval-step { display: grid; grid-template-columns: 1.75rem minmax(0, 1fr); gap: .75rem; padding: .65rem 1rem; }
.approval-step + .approval-step { border-top: 1px solid var(--line); }
.step-num { width: 1.6rem; height: 1.6rem; border-radius: 50%; display: grid; place-items: center; font-size: .75rem; font-weight: 700; background: var(--sunken); color: var(--text-2); border: 1px solid var(--line-strong); }
.approval-step[data-state='done'] .step-num { background: var(--ok-bg); color: var(--ok); border-color: transparent; } .step-num .icon { width: 14px; height: 14px; }
.step-body { display: grid; gap: .45rem; justify-items: start; } .step-body h3 { font-size: .875rem; font-weight: 650; }
.step-row { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; width: 100%; } .step-row input[type='file'] { flex: 1; min-width: 12rem; }
.review-box { border: 0; margin: 0; padding: 0; display: grid; gap: .3rem; justify-items: start; } .check-row { display: flex; gap: .5rem; align-items: flex-start; font-size: .8125rem; } .check-row input { margin-top: .2rem; }
details.tech > summary { cursor: pointer; list-style: none; } details.tech > summary::-webkit-details-marker { display: none; } details.tech > summary h2::after { content: ' ▸'; color: var(--text-3); } details.tech[open] > summary h2::after { content: ' ▾'; }
details.tech:not([open]) > summary { border-bottom: 0; }
@media (max-width: 1100px) { .prod-grid { grid-template-columns: 1fr; } .statbar.cols-5 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 860px) { .statbar.cols-5 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .blocker-list li { flex-direction: column; align-items: flex-start; } .preview-stage { min-height: 200px; padding: .75rem; } .file-list li { flex-wrap: wrap; } }

.checks .sub { display: block; }
.toolbar .search { flex: 1 1 220px; min-width: 200px; }

.page > * { min-width: 0; } .panel { min-width: 0; }
@media (max-width: 860px) { .hide-sm { display: none; } .table th, .table td { padding: .6rem .7rem; } }

/* ==== Admin 3.0: shared refinements ==== */
.badge, .stat-label, .att-meta, .att-age, .att-cta, .panel-count, .table th, .legend, .activity li { font-size: max(.75rem, 12px); }
.nav-label:first-of-type { padding-top: .2rem; }
.shell[data-collapsed='true'] .nav-label { display: none; }
.strong-link { font-weight: 650; color: var(--text); text-decoration: none; } .strong-link:hover { color: var(--primary); text-decoration: underline; }
.sort-mark { color: var(--text-3); font-size: .8em; margin-left: .15rem; } th[aria-sort='ascending'] .sort-mark, th[aria-sort='descending'] .sort-mark { color: var(--primary); }
.reason { display: flex; gap: .4rem; align-items: flex-start; font-size: .8125rem; color: var(--text-2); margin: 0; } .reason .icon { width: 15px; height: 15px; margin-top: 2px; color: var(--info); }
.reason.danger { color: var(--danger); } .reason.danger .icon { color: var(--danger); }
.field-error { color: var(--danger); font-size: .8125rem; font-weight: 600; min-height: 0; margin: 0; } .field-error:empty { display: none; }
.field-help { font-weight: 400; color: var(--text-3); font-size: .8rem; }
[aria-invalid='true'] { border-color: var(--danger) !important; }
details.hint { font-size: .8125rem; color: var(--text-2); }
details.hint > summary { cursor: pointer; display: inline-flex; gap: .35rem; align-items: center; font-weight: 600; color: var(--primary); list-style: none; } details.hint > summary::-webkit-details-marker { display: none; }
details.hint > summary .icon { width: 15px; height: 15px; } details.hint > div { margin-top: .4rem; padding: .6rem .75rem; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius); }
.toast { display: flex; align-items: flex-start; gap: .6rem; } .toast > span { flex: 1; }
.toast-x { all: unset; cursor: pointer; opacity: .8; display: grid; place-items: center; width: 22px; height: 22px; border-radius: 4px; } .toast-x:hover { opacity: 1; } .toast-x:focus-visible { outline: 2px solid currentColor; } .toast-x .icon { width: 15px; height: 15px; }
.lock-note { display: flex; gap: .4rem; align-items: center; font-size: .8125rem; font-weight: 600; color: var(--text-2); margin: 0; padding: .4rem .6rem; background: var(--sunken); border-radius: var(--radius); } .lock-note .icon { width: 15px; height: 15px; }
.approval-step[data-state='next'] .step-num { background: var(--primary); color: var(--on-primary); border-color: transparent; }
.stage-help { display: block; font-size: .8125rem; color: var(--text-3); margin-top: .35rem; }
.page-head .lede .badge { vertical-align: 1px; }
.btn[aria-busy='true'] { cursor: progress; }
.btn { min-height: 38px; } .chip { min-height: 32px; }
.chips.scroll { flex-wrap: wrap; }
details.fold > summary { cursor: pointer; list-style: none; } details.fold > summary::-webkit-details-marker { display: none; } details.fold > summary h2::after { content: ' ▸'; color: var(--text-3); } details.fold[open] > summary h2::after { content: ' ▾'; }
details.fold:not([open]) > summary { border-bottom: 0; }
.danger-zone > summary h2 { color: var(--danger); font-size: 1rem; }
details.raw { display: inline-block; margin-left: .4rem; font-size: .75rem; } details.raw > summary { cursor: pointer; color: var(--text-3); } details.raw code { display: block; white-space: pre-wrap; overflow-wrap: anywhere; color: var(--text-2); margin-top: .25rem; }
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: .5rem; } .photo-grid a { display: block; } .photo-grid .thumb { width: 100%; height: 120px; object-fit: cover; max-height: none; }
.piece-list { list-style: none; margin: 0; padding: 0; } .piece-list li + li { border-top: 1px solid var(--line); }
.piece-row { display: grid; grid-template-columns: 7rem minmax(0, 1fr) auto; gap: .75rem; align-items: center; padding: .75rem 1rem; color: inherit; text-decoration: none; } .piece-row:hover { background: var(--surface-2); } .piece-row:hover .att-next { color: var(--primary); text-decoration: underline; }
.piece-row:focus-visible { outline-offset: -2px; }

/* global search results */
.search.global { position: relative; }
.search-results { position: absolute; left: 0; right: 0; top: calc(100% + 6px); z-index: 40; list-style: none; margin: 0; padding: .3rem; background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); max-height: min(70vh, 460px); overflow-y: auto; min-width: min(420px, calc(100vw - 1.5rem)); }
.search-results li { display: grid; grid-template-columns: 4.6rem minmax(0, 1fr) auto; gap: .6rem; align-items: center; padding: .5rem .6rem; border-radius: var(--radius); cursor: pointer; }
.search-results li[aria-selected='true'] { background: var(--primary-soft); }
.search-results .sr-kind { font-size: .72rem; font-weight: 650; text-transform: uppercase; letter-spacing: .05em; color: var(--text-3); }
.search-results .sr-main { display: grid; min-width: 0; } .search-results .sr-main > * { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.search-results .sr-none { display: block; cursor: default; color: var(--text-2); font-size: .875rem; }

/* help page */
.help-flow { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; } .help-flow li { display: grid; grid-template-columns: 1.75rem minmax(0, 1fr); gap: .75rem; padding: .7rem 0; } .help-flow li + li { border-top: 1px solid var(--line); }
.help-flow h3 { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; font-size: .9375rem; } .help-flow p { margin: .15rem 0 .3rem; font-size: .875rem; }
.who { font-size: .72rem; font-weight: 650; padding: .05rem .5rem; border-radius: 999px; background: var(--sunken); color: var(--text-2); }
.help-status, .help-gloss, .help-keys { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: .55rem 1rem; margin: 0; font-size: .875rem; } .help-status dd, .help-gloss dd, .help-keys dd { margin: 0; color: var(--text-2); }
.help-gloss dt { font-weight: 650; } kbd { font: .75rem var(--mono); border: 1px solid var(--line-strong); border-bottom-width: 2px; border-radius: 4px; padding: .05rem .4rem; background: var(--surface-2); white-space: nowrap; }

/* piece page: actions stay in reach while reading a long story */
.page-head.sticky { position: sticky; top: var(--topbar); z-index: 15; background: var(--bg); margin: -.5rem -1.75rem 0; padding: .5rem 1.75rem .75rem; border-bottom: 1px solid transparent; }
.page-item .tabs { margin-top: -.5rem; }

/* tablet and phone */
@media (max-width: 1100px) { .page-head.sticky { margin-inline: -1.75rem; } }
@media (max-width: 860px) {
  .topbar .search.global { max-width: none; }
  .search-results { position: fixed; left: .5rem; right: .5rem; top: calc(var(--topbar) + 4px); min-width: 0; }
  .btn, .chip, .nav a, .tabs button, input, select { min-height: 44px; } .chip { padding: .35rem .85rem; } .btn.icon-only { width: 44px; }
  .chips.scroll { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin-inline: -1.1rem; padding-inline: 1.1rem; mask-image: linear-gradient(90deg, #000 90%, transparent); } .chips.scroll::-webkit-scrollbar { display: none; } .chips.scroll .chip { flex: none; }
  .toolbar { padding: .75rem 1.1rem; } .toolbar .search { flex-basis: 100%; } .toolbar select { flex: 1 1 40%; min-width: 0; }
  .tabs { scrollbar-width: none; mask-image: linear-gradient(90deg, #000 85%, transparent); } .tabs::-webkit-scrollbar { display: none; }
  .page-head.sticky { position: static; margin: 0; padding: 0; }
  /* workspace actions become a bottom bar within thumb reach */
  .page-head.has-actions .actions { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; padding: .6rem .75rem calc(.6rem + env(safe-area-inset-bottom)); background: color-mix(in srgb, var(--surface) 96%, transparent); backdrop-filter: blur(8px); border-top: 1px solid var(--line); box-shadow: 0 -6px 18px rgba(16, 24, 40, .08); flex-wrap: nowrap; }
  .page-head.has-actions .actions .btn { flex: 1; } .page-item { padding-bottom: 6rem; }
  .toasts { bottom: calc(5.5rem + env(safe-area-inset-bottom)); left: .75rem; right: .75rem; max-width: none; }
  .prod-side { order: -1; } .prod-grid { display: flex; flex-direction: column; } .prod-main, .prod-side { width: 100%; }
  .piece-row { grid-template-columns: minmax(0, 1fr) auto; } .piece-row .att-main { grid-column: 1 / -1; grid-row: 2; }
  .file-links a { padding: .5rem .2rem; }
  .help-status, .help-gloss { grid-template-columns: 1fr; gap: .2rem; } .help-status dd, .help-gloss dd { margin-bottom: .6rem; }
}
/* tables become item cards on phones: every cell keeps its column name */
@media (max-width: 640px) {
  table.cards thead { display: none; }
  table.cards, table.cards tbody, table.cards tr, table.cards td { display: block; width: 100%; }
  table.cards tr { padding: .75rem 1rem; border-bottom: 1px solid var(--line); }
  table.cards tbody tr:last-child { border-bottom: 0; }
  table.cards td { border: 0; padding: .15rem 0; display: grid; grid-template-columns: 7.5rem minmax(0, 1fr); gap: .5rem; text-align: left !important; font-size: .875rem; }
  table.cards td::before { content: attr(data-label); color: var(--text-3); font-size: .78rem; font-weight: 600; }
  table.cards td.m-title { display: block; font-size: 1rem; padding-bottom: .3rem; } table.cards td.m-title::before { display: none; }
  table.cards td.m-hide { display: none; }
  .hide-sm { display: none !important; }
  .page { padding-inline: .75rem; }
}
.toasts > div { display: grid; gap: .5rem; }
@media (max-width: 860px) { .hide-mobile { display: none !important; } .att-next { white-space: normal; } .topbar { gap: .4rem; } }
.card-body > *, .panel-body > *, .dt, .toolbar > * { min-width: 0; }
@media (max-width: 860px) {
  .chips.scroll { flex: 1 1 100%; max-width: calc(100% + 2.2rem); }
  input[type], select, textarea { min-height: 44px; }
}
.stat.is-critical[data-kind='info']::after { background: var(--info); } .stat.is-critical[data-kind='info'] .stat-num { color: var(--info); }
@media (max-width: 860px) { table.cards td.m-hide, table.cards th.m-hide { display: none; } }

/* Production queue at tablet widths: a two-column grid of piece cards; status top right, next action as a full-width button */
@media (min-width: 641px) and (max-width: 1100px) {
  table.cards.tablet thead { display: none; }
  table.cards.tablet, table.cards.tablet tbody { display: block; }
  table.cards.tablet tbody { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem; padding: .85rem; }
  table.cards.tablet tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-content: start; gap: .45rem .75rem; padding: .85rem 1rem; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); }
  table.cards.tablet tr:hover { background: var(--surface-2); }
  table.cards.tablet td, table.cards.tablet td.m-hide { display: block; padding: 0; border: 0; text-align: left; }
  table.cards.tablet td[data-col='order'] { font-size: 1rem; }
  table.cards.tablet td[data-col='priority'] { grid-column: 2; grid-row: 1; justify-self: end; }
  table.cards.tablet td[data-col='product'], table.cards.tablet td[data-col='package'] { grid-column: 1 / -1; font-size: .875rem; }
  table.cards.tablet td[data-col='package']::before { content: 'Print file: '; color: var(--text-3); font-size: .8rem; }
  table.cards.tablet td[data-col='next'] { grid-column: 1 / -1; }
  table.cards.tablet td[data-col='next'] .next-link { display: flex; justify-content: space-between; width: 100%; min-height: 44px; padding: .55rem .8rem; border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--surface-2); line-height: 1.3; }
  table.cards.tablet td[data-col='updated'] { grid-column: 1 / -1; font-size: .78rem; }
}

/* full-screen story preview */
dialog.dlg.preview-dlg { width: calc(100vw - 2rem); max-width: 1200px; height: calc(100dvh - 2rem); max-height: none; display: grid; grid-template-rows: auto minmax(0, 1fr); }
dialog.preview-dlg:not([open]) { display: none; }
.preview-dlg-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; padding: .85rem 1rem; border-bottom: 1px solid var(--line); }
.preview-dlg-head p { margin-top: .15rem; }
.preview-frame.full { width: 100%; height: 100%; min-height: 0; border: 0; border-radius: 0 0 var(--radius-lg) var(--radius-lg); }
@media (max-width: 640px) { dialog.dlg.preview-dlg { width: 100vw; height: 100dvh; max-width: none; border-radius: 0; margin: 0; } .preview-dlg-head .btn { flex: none; } }

/* ==== guided story workflow ==== */
.progress { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: .7rem .9rem; }
.progress ol { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: .25rem; counter-reset: p; }
.progress li { display: flex; gap: .5rem; align-items: center; min-width: 0; position: relative; padding-right: .25rem; }
.progress li + li::before { content: ''; position: absolute; left: -.6rem; width: .5rem; top: 50%; border-top: 2px solid var(--line-strong); }
.p-dot { width: 1.6rem; height: 1.6rem; flex: none; border-radius: 50%; display: grid; place-items: center; font-size: .75rem; font-weight: 700; background: var(--sunken); color: var(--text-2); border: 1px solid var(--line-strong); }
.p-dot .icon { width: 14px; height: 14px; }
.p-text { display: grid; min-width: 0; line-height: 1.2; } .p-label { font-size: .8125rem; font-weight: 650; color: var(--text-2); } .p-who { font-size: .72rem; color: var(--text-3); }
.progress li[data-state='done'] .p-dot { background: var(--ok-bg); color: var(--ok); border-color: transparent; }
.progress li[data-state='current'] .p-dot { background: var(--primary); color: var(--on-primary); border-color: transparent; box-shadow: 0 0 0 3px var(--primary-soft); }
.progress li[data-state='current'] .p-label { color: var(--text); }
.p-mobile { display: none; margin: 0; font-weight: 650; font-size: .875rem; }
.guide { display: grid; grid-template-columns: minmax(0, 1fr) minmax(240px, auto); gap: 1rem 1.5rem; padding: 1.1rem 1.25rem; background: var(--surface); border: 1px solid var(--line-strong); border-left: 4px solid var(--neutral); border-radius: var(--radius-lg); box-shadow: var(--shadow); }
.guide[data-who='owner'] { border-left-color: var(--primary); } .guide[data-who='customer'] { border-left-color: var(--warn); } .guide[data-who='nobody'] { border-left-color: var(--line-strong); }
.guide-main { display: grid; gap: .45rem; align-content: start; } .guide-kicker { margin: 0; font-size: .75rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--text-3); }
.guide h2 { font-size: 1.3rem; } .guide-text { margin: 0; max-width: 70ch; color: var(--text); } .guide-who { margin: 0; font-size: .875rem; color: var(--text-2); }
.who-chip { display: inline-block; font-size: .75rem; font-weight: 700; padding: .1rem .55rem; border-radius: 999px; background: var(--neutral-bg); color: var(--neutral); margin-right: .35rem; }
.who-chip[data-who='owner'] { background: var(--primary); color: var(--on-primary); } .who-chip[data-who='customer'] { background: var(--warn-bg); color: var(--warn); }
.guide-side { display: grid; gap: .6rem; align-content: start; justify-items: stretch; }
.guide-actions { display: grid; gap: .5rem; } .guide-actions .btn { width: 100%; } .guide-actions .btn[data-kind='primary'] { min-height: 46px; font-size: 1rem; }
.guide-no { font-size: .8125rem; color: var(--text-2); } .guide-no summary { cursor: pointer; font-weight: 600; color: var(--text-2); } .guide-no ul { margin: .4rem 0 0; padding-left: 1.1rem; display: grid; gap: .3rem; }
.g-note { margin: 0; padding: .6rem .8rem; background: var(--surface-2); border-left: 3px solid var(--warn); border-radius: var(--radius); } .g-note p { white-space: pre-wrap; }
.g-list { margin: .3rem 0 0; padding-left: 1.1rem; font-size: .875rem; display: grid; gap: .15rem; } .g-extra { display: grid; gap: .5rem; }
#to-decision { justify-self: start; }
@media (max-width: 1100px) { .progress ol { grid-template-columns: repeat(4, minmax(0, 1fr)); row-gap: .6rem; } .progress li:nth-child(5)::before { display: none; } }
@media (max-width: 860px) {
  .guide { grid-template-columns: 1fr; padding: 1rem; }
  .guide.has-primary .guide-actions { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; padding: .6rem .75rem calc(.6rem + env(safe-area-inset-bottom)); background: color-mix(in srgb, var(--surface) 96%, transparent); backdrop-filter: blur(8px); border-top: 1px solid var(--line); box-shadow: 0 -6px 18px rgba(16, 24, 40, .08); grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); }
  .progress ol { display: none; } .p-mobile { display: block; }
}
/* phone bottom bar: the primary action and one secondary; preview and live-story links stay on the page (Piece and Publication cards) */
@media (max-width: 860px) { .guide.has-primary .guide-actions .btn[data-kind='ghost'] { display: none; } }

/* production: route (automatic or by hand), QR beside the file, step meanings */
.route { display: grid; gap: .5rem; padding: 1rem 1.25rem; background: var(--surface); border: 1px solid var(--line-strong); border-left: 4px solid var(--ok); border-radius: var(--radius-lg); }
.route[data-route='manual'] { border-left-color: var(--warn); } .route h2 { font-size: 1.1rem; } .route p { margin: 0; max-width: 80ch; }
.qr-with-file { display: flex; gap: .85rem; align-items: center; padding: .6rem 1rem; border-top: 1px solid var(--line); }
.qr-with-file > div { display: grid; min-width: 0; } .qr-with-file a { overflow-wrap: anywhere; }
.qr-thumb { width: 72px; height: 72px; flex: none; background: #fff; border: 1px solid var(--line); border-radius: 6px; padding: 4px; }
.means { margin: 0; font-size: .8125rem; color: var(--text-2); border-left: 2px solid var(--line-strong); padding-left: .6rem; }
@media (max-width: 860px) { .qr-with-file a { display: inline-block; min-height: 44px; padding: .65rem 0; } }

/* Piece page: Control tab */
.control-tab { display: grid; gap: 1rem; }
.control-tab .callout .right { margin-left: auto; }
.gates { display: grid; gap: .75rem; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.gate h3 { margin: 0 0 .4rem; font-size: .95rem; }
.steps3 { display: grid; gap: .75rem; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.btn-row { display: flex; flex-wrap: wrap; gap: .5rem; }
@media (max-width: 1100px) { .gates { grid-template-columns: repeat(2, minmax(0, 1fr)); } .steps3 { grid-template-columns: 1fr; } }
@media (max-width: 560px) { .gates { grid-template-columns: 1fr; } }

/* Piece page, first implementation cycle (2026-10-29): no horizontal overflow on phones, identity line, QR preview, audit */
.control-tab .callout { flex-wrap: wrap; align-items: center; }
.control-tab .callout .right { margin-left: auto; }
.control-tab .callout > .sub { flex: 1 1 14rem; min-width: 0; }
.control-tab .kv dd { min-width: 0; overflow-wrap: anywhere; }
.tabs { scrollbar-width: thin; -webkit-mask-image: linear-gradient(90deg, #000 85%, transparent); mask-image: linear-gradient(90deg, #000 85%, transparent); }
@media (min-width: 768px) { .tabs { -webkit-mask-image: none; mask-image: none; } }
.identity-line { display: flex; flex-wrap: wrap; gap: .35rem .6rem; align-items: center; }
.qr-preview { display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; }
.qr-preview img { width: 112px; height: 112px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; image-rendering: pixelated; }
.audit { list-style: none; margin: 0; padding: 0; display: grid; gap: .45rem; }
.audit li { display: flex; flex-wrap: wrap; gap: .25rem .6rem; font-size: .9rem; }
.audit time { color: var(--text-3); font-size: .85rem; }
.stale-banner { position: sticky; top: 0; z-index: 5; }
.gates .checks .check, .steps3 .checks .check { display: block; }
.qr-preview > div { flex: 1 1 12rem; min-width: 0; }
.qr-preview a { overflow-wrap: anywhere; }
.stale-banner[hidden] { display: none; }
/* Pieces: view tabs (links) */
.view-tabs a { padding: .65rem 1rem; font-weight: 600; color: var(--text-2); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; text-decoration: none; }
.view-tabs a:hover { color: var(--text); }
.view-tabs a[aria-selected='true'] { color: var(--primary); border-bottom-color: var(--primary); }
.view-tabs a:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }
.page-pieces .cc-result .next-link { display: inline-flex; align-items: center; gap: .25rem; }

/* Pieces: the incident callout and the view tabs must never be wider than the screen (found on staging at 320 px, 2026-10-29) */
.page-pieces { min-width: 0; }
.page-pieces > * { min-width: 0; max-width: 100%; }
.page-pieces .callout > div { min-width: 0; overflow-wrap: anywhere; }
.page-pieces .callout { overflow-wrap: anywhere; }
.page-pieces .view-tabs { max-width: 100%; }

/* Correction request on the piece page */
.card.correction { border-color: color-mix(in srgb, var(--warn) 45%, var(--line)); background: var(--warn-bg); }
.card.correction .pre { white-space: pre-wrap; overflow-wrap: anywhere; }
