/*
 * Order Verification staff application: design system.
 * One stylesheet, design tokens on :root, semantic colours only (success, warning,
 * danger, info, neutral) plus the risk scale. No scripts anywhere (CSP script-src
 * 'none'): menus, drawers and disclosures are native <details>. No inline styles.
 * Customer pages use app.css and are not affected by this file.
 */

/* ------------------------------------------------------------ tokens */
:root {
  --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "Cascadia Mono", Consolas, monospace;

  --bg: #f4f5f8;
  --surface: #ffffff;
  --surface-2: #f9fafb;
  --surface-3: #f2f4f7;
  --border: #e4e7ec;
  --border-strong: #d0d5dd;
  --text: #101828;
  --text-2: #344054;
  --muted: #667085;
  --focus: #6172f3;

  /* Mahsons foundation: deep navy/charcoal, with an indigo product accent */
  --shell: #0e1726;
  --shell-2: #172235;
  --shell-border: #253248;
  --shell-text: #c3cad6;
  --shell-muted: #8592a6;
  --shell-active: rgba(255, 255, 255, .08);
  --brand-accent: #c9a96e;

  --primary: #444ce7;
  --primary-hover: #3538cd;
  --primary-soft: #eef4ff;
  --primary-text: #3538cd;

  /* semantic */
  --success: #067647; --success-bg: #ecfdf3; --success-border: #abefc6; --success-solid: #17b26a;
  --warning: #b54708; --warning-bg: #fffaeb; --warning-border: #fedf89; --warning-solid: #f79009;
  --danger: #b42318;  --danger-bg: #fef3f2;  --danger-border: #fecdca;  --danger-solid: #f04438;
  --info: #175cd3;    --info-bg: #eff8ff;    --info-border: #b2ddff;    --info-solid: #2e90fa;
  --neutral: #475467; --neutral-bg: #f2f4f7; --neutral-border: #e4e7ec; --neutral-solid: #98a2b3;

  /* risk scale: LOW green, MEDIUM amber, HIGH red, NONE yellow-neutral (never green), PENDING indigo */
  --risk-low: var(--success); --risk-low-bg: var(--success-bg); --risk-low-border: var(--success-border);
  --risk-medium: #b54708; --risk-medium-bg: #fff6ed; --risk-medium-border: #fddcab;
  --risk-high: var(--danger); --risk-high-bg: var(--danger-bg); --risk-high-border: var(--danger-border);
  --risk-none: #6f5f2a; --risk-none-bg: #f7f5ee; --risk-none-border: #e3dcc0;
  --risk-pending: #3538cd; --risk-pending-bg: #eef4ff; --risk-pending-border: #c7d7fe;

  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 14px;
  --shadow-xs: 0 1px 2px rgba(16, 24, 40, .05);
  --shadow-sm: 0 1px 3px rgba(16, 24, 40, .08), 0 1px 2px rgba(16, 24, 40, .04);
  --shadow-md: 0 8px 24px -6px rgba(16, 24, 40, .14), 0 2px 6px -2px rgba(16, 24, 40, .06);
  --sidebar-w: 252px;
  --topbar-h: 60px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b111b; --surface: #121a27; --surface-2: #162031; --surface-3: #1b2639;
    --border: #243147; --border-strong: #32425d; --text: #eef2f7; --text-2: #cfd6e2; --muted: #98a3b6; --focus: #8098f9;
    --shell: #080d16; --shell-2: #0f1724; --shell-border: #1d2738;
    --primary: #6172f3; --primary-hover: #8098f9; --primary-soft: #1d2552; --primary-text: #a4bcfd;
    --success: #47cd89; --success-bg: #0b2a1c; --success-border: #135e3b;
    --warning: #fdb022; --warning-bg: #2d1f07; --warning-border: #6a4310;
    --danger: #f97066; --danger-bg: #31110f; --danger-border: #7a271a;
    --info: #53b1fd; --info-bg: #0b2240; --info-border: #194185;
    --neutral: #c0c8d4; --neutral-bg: #1b2639; --neutral-border: #2c3a52;
    --risk-medium: #fdb022; --risk-medium-bg: #2d1f07; --risk-medium-border: #6a4310;
    --risk-none: #d8cfa6; --risk-none-bg: #26241a; --risk-none-border: #4a4630;
    --risk-pending: #a4bcfd; --risk-pending-bg: #1d2552; --risk-pending-border: #2d3a8c;
    --shadow-xs: 0 1px 2px rgba(0, 0, 0, .4); --shadow-sm: 0 1px 3px rgba(0, 0, 0, .5); --shadow-md: 0 10px 30px -8px rgba(0, 0, 0, .6);
    color-scheme: dark;
  }
}

/* ------------------------------------------------------------ base */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body.ui { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.5 var(--font); font-feature-settings: "cv11", "ss01"; -webkit-font-smoothing: antialiased; }
.ui a { color: var(--primary-text); text-decoration: none; }
.ui a:hover { text-decoration: underline; text-underline-offset: 2px; }
/* component links keep their own colours */
.ui a.nav-link { color: var(--shell-text); }
.ui a.nav-link[aria-current="page"] { color: #fff; }
.ui a.brandmark, .ui a.org-switch { color: inherit; }
.ui a.stat { color: var(--text); }
.ui a.att-item { color: var(--text); }
.ui a.view { color: var(--text-2); }
.ui a.choice { color: var(--text); text-decoration: none; }
.ui .dropdown-list a { color: var(--text); }
.cell-sub { display: block; color: var(--muted); font-size: 12px; font-weight: 450; margin-top: 1px; }
.ui :focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
.ui h1, .ui h2, .ui h3, .ui h4 { margin: 0; color: var(--text); letter-spacing: -.01em; }
.ui h1 { font-size: 24px; line-height: 1.25; font-weight: 700; }
.ui h2 { font-size: 16px; line-height: 1.35; font-weight: 650; }
.ui h3 { font-size: 14px; font-weight: 650; }
.ui p { margin: 0 0 10px; }
.ui code, .ui .mono { font-family: var(--mono); font-size: 12.5px; overflow-wrap: anywhere; }
.ui ul, .ui ol { margin: 0; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.nowrap { white-space: nowrap; }
.num { font-variant-numeric: tabular-nums; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.skip-link { position: absolute; left: 12px; top: -48px; z-index: 100; background: var(--surface); color: var(--text); padding: 8px 12px; border-radius: var(--radius-sm); box-shadow: var(--shadow-md); }
.skip-link:focus { top: 12px; }
.icon { width: 18px; height: 18px; flex: 0 0 auto; display: inline-block; vertical-align: middle; }
.icon-sm { width: 14px; height: 14px; }
.icon-lg { width: 22px; height: 22px; }

/* ------------------------------------------------------------ app shell */
.shell { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: 100vh; }
.sidebar { background: var(--shell); color: var(--shell-text); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto; border-right: 1px solid var(--shell-border); }
.brandmark { display: flex; align-items: center; gap: 10px; padding: 18px 18px 16px; color: #fff; border-bottom: 1px solid var(--shell-border); }
.brandmark:hover { text-decoration: none !important; }
.brandmark .logo { width: 34px; height: 34px; border-radius: 9px; background: linear-gradient(145deg, #1f2b40, #0b1220); border: 1px solid #2f3d57; display: grid; place-items: center; color: var(--brand-accent); font-weight: 800; font-size: 15px; letter-spacing: .5px; }
.brandmark .bm-name { font-weight: 800; letter-spacing: 2.4px; font-size: 13px; line-height: 1.2; color: #fff; }
.brandmark .bm-sub { font-size: 10.5px; letter-spacing: 1.1px; text-transform: uppercase; color: var(--shell-muted); }
.org-switch { margin: 12px 12px 4px; padding: 9px 11px; border-radius: var(--radius); background: var(--shell-2); border: 1px solid var(--shell-border); display: block; color: var(--shell-text); }
.org-switch:hover { text-decoration: none !important; border-color: #34445f; }
.org-switch .org-label { font-size: 10.5px; text-transform: uppercase; letter-spacing: 1px; color: var(--shell-muted); }
.org-switch .org-name { color: #fff; font-weight: 650; font-size: 13px; display: flex; justify-content: space-between; gap: 6px; }
.org-switch .org-store { font-size: 11.5px; color: var(--shell-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-group { padding: 10px 10px 2px; }
.nav-group-title { font-size: 10.5px; font-weight: 700; letter-spacing: 1.1px; text-transform: uppercase; color: var(--shell-muted); padding: 8px 10px 6px; }
.nav-link { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; color: var(--shell-text); font-weight: 520; font-size: 13.5px; position: relative; }
.ui .nav-link:hover { background: var(--shell-active); color: #fff; text-decoration: none; }
.nav-link .icon { color: var(--shell-muted); }
.nav-link[aria-current="page"] { background: var(--shell-active); color: #fff; }
.nav-link[aria-current="page"]::before { content: ""; position: absolute; left: -10px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--brand-accent); }
.nav-link[aria-current="page"] .icon { color: var(--brand-accent); }
.nav-count { margin-left: auto; min-width: 20px; padding: 0 6px; height: 19px; border-radius: 999px; background: var(--danger-solid); color: #fff; font-size: 11px; font-weight: 700; display: inline-grid; place-items: center; }
.nav-count.quiet { background: #2a3850; color: var(--shell-text); }
.sidebar-foot { margin-top: auto; padding: 14px 18px 18px; font-size: 11.5px; color: var(--shell-muted); border-top: 1px solid var(--shell-border); }
.sidebar-foot .mode-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--warning-solid); margin-right: 6px; }
.sidebar-foot .mode-dot.active { background: var(--success-solid); }

.main-col { min-width: 0; display: flex; flex-direction: column; }
.topbar { height: var(--topbar-h); background: var(--surface); border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 14px; padding: 0 24px; position: sticky; top: 0; z-index: 20; }
.topbar .context { display: flex; align-items: center; gap: 8px; min-width: 0; color: var(--text-2); font-weight: 600; }
.topbar .context .store { color: var(--muted); font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar .context .sep { color: var(--border-strong); }
.search { flex: 1 1 auto; max-width: 440px; margin-left: auto; position: relative; }
.ui .search input[type=search] { width: 100%; height: 38px; padding: 0 12px 0 36px; border-radius: 9px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text); font: inherit; }
.search input:focus { background: var(--surface); border-color: var(--focus); outline: 3px solid color-mix(in srgb, var(--focus) 22%, transparent); outline-offset: 0; }
.search .icon { position: absolute; left: 11px; top: 10px; color: var(--muted); }
.topbar-actions { display: flex; align-items: center; gap: 6px; }
.icon-btn { position: relative; width: 38px; height: 38px; border-radius: 9px; display: grid; place-items: center; color: var(--text-2); border: 1px solid transparent; background: none; cursor: pointer; list-style: none; }
.icon-btn::-webkit-details-marker { display: none; }
.icon-btn:hover { background: var(--surface-3); }
.dot-count { position: absolute; top: 3px; right: 2px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 999px; background: var(--danger-solid); color: #fff; font-size: 10.5px; font-weight: 700; display: grid; place-items: center; border: 2px solid var(--surface); }

/* dropdowns (native <details>) */
.dropdown { position: relative; }
.dropdown > summary { list-style: none; cursor: pointer; }
.dropdown > summary::-webkit-details-marker { display: none; }
.dropdown-panel { position: absolute; right: 0; top: calc(100% + 8px); width: 340px; max-width: calc(100vw - 24px); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-md); z-index: 40; overflow: hidden; }
.dropdown[open] > .dropdown-panel { animation: pop .12s ease-out; }
.dropdown-head { padding: 12px 14px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }
.dropdown-list { list-style: none; padding: 6px; margin: 0; max-height: 360px; overflow-y: auto; }
.dropdown-list li a, .dropdown-list li button { display: flex; gap: 10px; padding: 9px 10px; border-radius: 8px; color: var(--text); width: 100%; text-align: left; background: none; border: 0; font: inherit; cursor: pointer; align-items: flex-start; }
.dropdown-list li a:hover, .dropdown-list li button:hover { background: var(--surface-3); text-decoration: none; }
.dropdown-foot { padding: 10px 14px; border-top: 1px solid var(--border); font-size: 13px; }
.user-chip { display: flex; align-items: center; gap: 8px; padding: 4px 8px 4px 4px; border-radius: 999px; border: 1px solid var(--border); }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: linear-gradient(140deg, #1f2b40, #3b4b69); color: #fff; font-weight: 700; font-size: 12px; display: grid; place-items: center; letter-spacing: .5px; }
.user-chip .who { font-weight: 600; font-size: 13px; color: var(--text-2); }
.mobile-nav { display: none; }

.content { padding: 24px 28px 56px; width: 100%; max-width: 1640px; }
.mode-strip { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: var(--radius); border: 1px solid var(--warning-border); background: var(--warning-bg); color: var(--warning); margin-bottom: 18px; font-size: 13.5px; }
.mode-strip strong { letter-spacing: .3px; }
.mode-strip.active { border-color: var(--info-border); background: var(--info-bg); color: var(--info); }

/* page header */
.crumbs { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 13px; color: var(--muted); margin-bottom: 8px; }
.crumbs a { color: var(--muted); }
.crumbs .sep { color: var(--border-strong); }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head .lead { color: var(--muted); margin: 4px 0 0; max-width: 760px; }
.page-head .head-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.title-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

/* ------------------------------------------------------------ surfaces */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-xs); }
.card + .card, .card + .grid, .grid + .card, .grid + .grid, .stats + .card, .stats + .grid, .card + details, details + .card { margin-top: 16px; }
.grid > .card, .grid > section, .stack > .card, .stack > section, .stack > details { margin-top: 0 !important; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.card-head .sub { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.card-head-icon { display: flex; align-items: center; gap: 10px; }
.card-body { padding: 16px 18px; }
.card-body.tight { padding: 0; }
.card-foot { padding: 12px 18px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 var(--radius-lg) var(--radius-lg); font-size: 13px; }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-main { grid-template-columns: minmax(0, 1fr) 380px; align-items: start; }
.stack { display: grid; gap: 16px; align-content: start; }
.section-title { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 26px 0 10px; }
.section-title h2 { font-size: 15px; }

/* key/value */
.kv { display: grid; grid-template-columns: minmax(130px, 38%) 1fr; gap: 9px 14px; margin: 0; }
.kv dt { color: var(--muted); font-size: 13px; }
.kv dd { margin: 0; font-weight: 550; color: var(--text); min-width: 0; overflow-wrap: anywhere; }
.kv.stacked { grid-template-columns: 1fr; gap: 2px; }
.kv.stacked dd { margin-bottom: 10px; }

/* ------------------------------------------------------------ badges */
.badge { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 9px; border-radius: 999px; font-size: 12px; font-weight: 650; line-height: 1; border: 1px solid; white-space: nowrap; vertical-align: middle; }
.badge .bdot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.lg { height: 30px; padding: 0 12px; font-size: 13px; }
.badge.success { color: var(--success); background: var(--success-bg); border-color: var(--success-border); }
.badge.warning { color: var(--warning); background: var(--warning-bg); border-color: var(--warning-border); }
.badge.danger  { color: var(--danger);  background: var(--danger-bg);  border-color: var(--danger-border); }
.badge.info    { color: var(--info);    background: var(--info-bg);    border-color: var(--info-border); }
.badge.neutral { color: var(--neutral); background: var(--neutral-bg); border-color: var(--neutral-border); }
.badge.brand   { color: var(--primary-text); background: var(--primary-soft); border-color: transparent; }
.badge.solid-danger { color: #fff; background: var(--danger-solid); border-color: var(--danger-solid); }
/* risk: shape + word + colour (never colour alone) */
.risk { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 9px 0 7px; border-radius: 6px; font-size: 12px; font-weight: 700; letter-spacing: .2px; border: 1px solid; white-space: nowrap; vertical-align: middle; }
.risk.lg { height: 30px; font-size: 13px; padding: 0 11px 0 9px; }
.risk .rbars { display: inline-flex; gap: 2px; align-items: flex-end; height: 11px; }
.risk .rbars i { width: 3px; border-radius: 1px; background: currentColor; opacity: .25; }
.risk .rbars i:nth-child(1) { height: 5px; } .risk .rbars i:nth-child(2) { height: 8px; } .risk .rbars i:nth-child(3) { height: 11px; }
.risk-LOW { color: var(--risk-low); background: var(--risk-low-bg); border-color: var(--risk-low-border); }
.risk-LOW .rbars i:nth-child(1) { opacity: 1; }
.risk-MEDIUM { color: var(--risk-medium); background: var(--risk-medium-bg); border-color: var(--risk-medium-border); }
.risk-MEDIUM .rbars i:nth-child(-n+2) { opacity: 1; }
.risk-HIGH { color: var(--risk-high); background: var(--risk-high-bg); border-color: var(--risk-high-border); }
.risk-HIGH .rbars i { opacity: 1; }
.risk-NONE { color: var(--risk-none); background: var(--risk-none-bg); border-color: var(--risk-none-border); }
.risk-PENDING, .risk-UNKNOWN { color: var(--risk-pending); background: var(--risk-pending-bg); border-color: var(--risk-pending-border); }

/* ------------------------------------------------------------ stat cards */
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 12px; }
.stats.eight { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (min-width: 1680px) { .stats.eight { grid-template-columns: repeat(8, minmax(0, 1fr)); } }
.stat { position: relative; display: block; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 14px 16px 13px; box-shadow: var(--shadow-xs); color: var(--text); overflow: hidden; transition: border-color .15s, box-shadow .15s, transform .15s; }
.ui a.stat:hover { text-decoration: none; border-color: var(--border-strong); box-shadow: var(--shadow-sm); transform: translateY(-1px); }
.stat::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 4px; background: var(--neutral-solid); }
.stat.success::before { background: var(--success-solid); } .stat.warning::before { background: var(--warning-solid); }
.stat.danger::before { background: var(--danger-solid); } .stat.info::before { background: var(--info-solid); }
.stat.brand::before { background: var(--primary); } .stat.none::before { background: #c9b458; }
.stat .s-label { display: flex; align-items: center; gap: 7px; font-size: 12.5px; font-weight: 600; color: var(--muted); }
.stat .s-value { font-size: 28px; font-weight: 750; letter-spacing: -.02em; margin-top: 4px; font-variant-numeric: tabular-nums; line-height: 1.15; }
.stat .s-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.stat.is-zero .s-value { color: var(--muted); }

/* ------------------------------------------------------------ next action & attention */
.next { border-radius: var(--radius-lg); border: 1px solid; padding: 18px 20px; display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; align-items: start; }
.next .n-icon { width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center; grid-row: span 3; background: rgba(255, 255, 255, .6); }
.next .n-eyebrow { font-size: 11px; font-weight: 750; letter-spacing: 1.2px; text-transform: uppercase; opacity: .85; }
.next .n-title { font-size: 20px; font-weight: 750; letter-spacing: -.01em; line-height: 1.25; }
.next .n-detail { font-size: 14px; color: var(--text-2); }
.next.success { background: var(--success-bg); border-color: var(--success-border); color: var(--success); }
.next.warning { background: var(--warning-bg); border-color: var(--warning-border); color: var(--warning); }
.next.danger { background: var(--danger-bg); border-color: var(--danger-border); color: var(--danger); }
.next.info { background: var(--info-bg); border-color: var(--info-border); color: var(--info); }
.next.neutral { background: var(--neutral-bg); border-color: var(--neutral-border); color: var(--neutral); }
@media (prefers-color-scheme: dark) { .next .n-icon { background: rgba(0, 0, 0, .25); } }

.attention { list-style: none; margin: 0; padding: 0; }
.attention li + li { border-top: 1px solid var(--border); }
.att-item { display: grid; grid-template-columns: 6px minmax(96px, 130px) minmax(0, 1.7fr) minmax(140px, 1fr) 18px; gap: 14px; align-items: center; padding: 13px 18px 13px 0; color: var(--text); }
.ui a.att-item:hover { background: var(--surface-2); text-decoration: none; }
.att-item .bar { align-self: stretch; border-radius: 0 3px 3px 0; background: var(--neutral-solid); }
.att-item.danger .bar { background: var(--danger-solid); } .att-item.warning .bar { background: var(--warning-solid); } .att-item.info .bar { background: var(--info-solid); } .att-item.success .bar { background: var(--success-solid); }
.att-order { font-weight: 700; font-size: 15px; }
.att-order .num { display: block; color: var(--muted); font-weight: 550; font-size: 12.5px; }
.att-why { display: grid; gap: 4px; }
.att-why .w-title { font-weight: 700; color: var(--text); }
.att-why .w-badges { display: flex; flex-wrap: wrap; gap: 6px; }
.att-why .w-facts { color: var(--muted); font-size: 12.5px; }
.att-next { font-size: 12.5px; }
.att-next .label { display: block; font-size: 10.5px; font-weight: 750; letter-spacing: 1px; text-transform: uppercase; color: var(--muted); }
.att-next strong { color: var(--text); font-size: 13px; }
.att-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 2px; }
.chev { color: var(--muted); }

/* ------------------------------------------------------------ tables */
.tbl-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13.5px; }
.tbl thead th { position: sticky; top: 0; z-index: 2; background: var(--surface-2); color: var(--muted); font-size: 12px; font-weight: 650; text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.tbl thead th:first-child { border-top-left-radius: var(--radius-lg); } .tbl thead th:last-child { border-top-right-radius: var(--radius-lg); }
.tbl thead th a { color: var(--muted); display: inline-flex; align-items: center; gap: 4px; }
.tbl thead th a.sorted { color: var(--text); }
.tbl tbody td { padding: 11px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; white-space: nowrap; }
.tbl td.primary-cell { white-space: nowrap; }
.tbl td.next-cell { white-space: normal; min-width: 140px; }
.tbl td.wrap-cell { white-space: normal; }
.tbl td.wrap-cell .badge { white-space: nowrap; margin: 1px 0; }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl tbody tr:hover td { background: var(--surface-2); }
.tbl .cell-strong { font-weight: 650; color: var(--text); }
.tbl .cell-sub { display: block; color: var(--muted); font-size: 12px; font-weight: 450; }
.tbl td.wrap { white-space: normal; min-width: 220px; }
.tbl td.right, .tbl th.right { text-align: right; }
.row-flag { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; vertical-align: middle; background: transparent; }
.row-flag.danger { background: var(--danger-solid); } .row-flag.success { background: var(--success-solid); } .row-flag.neutral { background: var(--neutral-solid); } .row-flag.warning { background: var(--warning-solid); } .row-flag.info { background: var(--info-solid); }

/* quick views / tabs */
.views { display: flex; gap: 6px; flex-wrap: wrap; padding: 4px; background: var(--surface-3); border: 1px solid var(--border); border-radius: 11px; width: fit-content; max-width: 100%; }
.view { display: inline-flex; align-items: center; gap: 7px; padding: 6px 11px; border-radius: 8px; color: var(--text-2); font-weight: 600; font-size: 13px; }
.ui a.view:hover { background: var(--surface); text-decoration: none; }
.view[aria-current="page"] { background: var(--surface); box-shadow: var(--shadow-sm); color: var(--text); }
.view .vcount { font-size: 11.5px; color: var(--muted); background: var(--surface-3); border: 1px solid var(--border); border-radius: 999px; padding: 0 7px; line-height: 18px; }
.view[aria-current="page"] .vcount { background: var(--primary-soft); color: var(--primary-text); border-color: transparent; }

/* filters */
.filters { display: grid; grid-template-columns: repeat(auto-fill, minmax(165px, 1fr)); gap: 10px 12px; align-items: end; }
.filters .f-actions { display: flex; gap: 8px; align-items: center; }
details.filter-drawer { margin-top: 12px; }
details.filter-drawer > summary { cursor: pointer; display: inline-flex; align-items: center; gap: 7px; font-weight: 600; color: var(--text-2); list-style: none; padding: 7px 11px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface); }
details.filter-drawer > summary::-webkit-details-marker { display: none; }
details.filter-drawer[open] > summary { margin-bottom: 12px; }
.active-filters { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-left: 10px; font-size: 12.5px; color: var(--muted); }
.inline-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.ui .inline-form input[type=search] { width: 240px; }
.ui .inline-form select { width: auto; }
.toolbar { display: flex; justify-content: space-between; gap: 12px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }

/* ------------------------------------------------------------ forms */
.ui label, .ui .label { display: block; font-weight: 600; font-size: 13px; color: var(--text-2); margin: 0 0 6px; }
.field { margin-bottom: 14px; }
.ui input[type=text], .ui input[type=email], .ui input[type=password], .ui input[type=number], .ui input[type=time], .ui input[type=search], .ui input[type=date], .ui select, .ui textarea {
  width: 100%; min-height: 38px; padding: 8px 11px; border: 1px solid var(--border-strong); border-radius: 8px; background: var(--surface); color: var(--text); font: inherit; box-shadow: var(--shadow-xs); }
.ui textarea { min-height: 76px; resize: vertical; }
.ui input:focus, .ui select:focus, .ui textarea:focus { border-color: var(--focus); outline: 3px solid color-mix(in srgb, var(--focus) 22%, transparent); outline-offset: 0; }
.ui input.inline-num { width: 6.5em; display: inline-block; }
.ui input.inline-time { width: 8em; display: inline-block; }
.hint { color: var(--muted); font-size: 12.5px; margin-top: 4px; }
.check { display: flex !important; gap: 9px; align-items: flex-start; font-weight: 500 !important; color: var(--text) !important; margin: 8px 0 !important; cursor: pointer; }
.check input { margin-top: 3px; width: 16px; height: 16px; accent-color: var(--primary); flex: 0 0 auto; }
.choice { display: flex !important; gap: 10px; align-items: flex-start; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius); margin: 0 0 8px !important; font-weight: 500 !important; color: var(--text) !important; cursor: pointer; background: var(--surface); }
.choice:hover { border-color: var(--border-strong); }
.choice:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); box-shadow: 0 0 0 1px var(--primary) inset; }
.choice input { margin-top: 3px; accent-color: var(--primary); width: 16px; height: 16px; }
.choice .c-title { font-weight: 650; display: block; }
.choice .c-sub { color: var(--muted); font-size: 12.5px; display: block; margin-top: 1px; }
.choice-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 8px; }
.day-row { display: flex; flex-wrap: wrap; gap: 4px 18px; }
fieldset.group { border: 0; padding: 0; margin: 0 0 18px; min-width: 0; }
fieldset.group > legend { font-weight: 650; font-size: 14px; color: var(--text); padding: 0; margin-bottom: 8px; }
.rule-row { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; }
.settings-row { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 24px; padding: 20px 0; border-top: 1px solid var(--border); }
.settings-row:first-of-type { border-top: 0; padding-top: 4px; }
.settings-row .sr-title { font-weight: 650; }
.settings-row .sr-help { color: var(--muted); font-size: 12.5px; margin-top: 4px; }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 38px; padding: 0 14px; border-radius: 9px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text-2); font: inherit; font-weight: 650; font-size: 13.5px; cursor: pointer; box-shadow: var(--shadow-xs); white-space: nowrap; }
.ui a.btn:hover { text-decoration: none; }
.btn:hover { background: var(--surface-2); }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-danger { background: var(--danger-solid); border-color: var(--danger-solid); color: #fff; }
.btn-danger:hover { background: #d92d20; }
.btn-danger-outline { color: var(--danger); border-color: var(--danger-border); }
.btn-ghost { border-color: transparent; box-shadow: none; background: transparent; }
.btn-sm { min-height: 32px; padding: 0 11px; font-size: 12.5px; border-radius: 8px; }
.btn-block { width: 100%; }
.link-btn { background: none; border: 0; padding: 0; font: inherit; color: var(--primary-text); cursor: pointer; font-weight: 600; }

/* ------------------------------------------------------------ alerts, flash, empty, error */
.alert { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--radius); border: 1px solid; margin-bottom: 14px; font-size: 13.5px; }
.alert .icon { margin-top: 1px; }
.alert.success { color: var(--success); background: var(--success-bg); border-color: var(--success-border); }
.alert.warning { color: var(--warning); background: var(--warning-bg); border-color: var(--warning-border); }
.alert.danger { color: var(--danger); background: var(--danger-bg); border-color: var(--danger-border); }
.alert.info { color: var(--info); background: var(--info-bg); border-color: var(--info-border); }
.alert.neutral { color: var(--neutral); background: var(--neutral-bg); border-color: var(--neutral-border); }
.alert p { margin: 2px 0 0; color: var(--text-2); }
.toast { animation: toast-in .25s ease-out; box-shadow: var(--shadow-sm); }
.empty { text-align: center; padding: 34px 20px; }
.empty .e-icon { width: 46px; height: 46px; margin: 0 auto 10px; border-radius: 12px; display: grid; place-items: center; background: var(--success-bg); color: var(--success); }
.empty.neutral .e-icon { background: var(--neutral-bg); color: var(--neutral); }
.empty .e-title { font-weight: 650; font-size: 15px; }
.empty .e-text { color: var(--muted); margin-top: 3px; }
.error-state .e-icon { background: var(--danger-bg); color: var(--danger); }

/* ------------------------------------------------------------ disclosure */
details.disclosure { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-xs); }
details.disclosure > summary { cursor: pointer; padding: 13px 18px; display: flex; align-items: center; gap: 10px; font-weight: 650; list-style: none; }
details.disclosure > summary::-webkit-details-marker { display: none; }
details.disclosure > summary .chev-r { margin-left: auto; transition: transform .15s; color: var(--muted); }
details.disclosure[open] > summary .chev-r { transform: rotate(90deg); }
details.disclosure[open] > summary { border-bottom: 1px solid var(--border); }
details.disclosure > .d-body { padding: 16px 18px; }
details.inline-more > summary { cursor: pointer; color: var(--primary-text); font-weight: 600; list-style: none; display: inline-flex; gap: 6px; align-items: center; }
details.inline-more > summary::-webkit-details-marker { display: none; }
details.inline-more[open] > summary { margin-bottom: 10px; }

/* ------------------------------------------------------------ timeline */
.tl { list-style: none; margin: 0; padding: 0; position: relative; }
.tl::before { content: ""; position: absolute; left: 11px; top: 6px; bottom: 6px; width: 2px; background: var(--border); }
.tl li { position: relative; padding: 0 0 16px 34px; }
.tl li:last-child { padding-bottom: 0; }
.tl .tl-dot { position: absolute; left: 3px; top: 2px; width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; background: var(--surface); border: 2px solid var(--neutral-solid); }
.tl .tl-dot::after { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--neutral-solid); }
.tl .success .tl-dot { border-color: var(--success-solid); } .tl .success .tl-dot::after { background: var(--success-solid); }
.tl .warning .tl-dot { border-color: var(--warning-solid); } .tl .warning .tl-dot::after { background: var(--warning-solid); }
.tl .danger .tl-dot { border-color: var(--danger-solid); } .tl .danger .tl-dot::after { background: var(--danger-solid); }
.tl .info .tl-dot { border-color: var(--info-solid); } .tl .info .tl-dot::after { background: var(--info-solid); }
.tl .brand .tl-dot { border-color: var(--primary); } .tl .brand .tl-dot::after { background: var(--primary); }
.tl .pending .tl-dot { border-style: dashed; } .tl .pending .tl-dot::after { background: transparent; }
.tl .tl-title { font-weight: 650; }
.tl .tl-meta { color: var(--muted); font-size: 12.5px; }
.tl .tl-note { color: var(--text-2); font-size: 12.5px; margin-top: 2px; }

/* audit list */
.audit-row > summary { list-style: none; cursor: pointer; display: grid; grid-template-columns: 150px 120px minmax(160px, 1.2fr) minmax(0, 2fr) 110px 16px; gap: 12px; align-items: center; padding: 10px 18px; }
.audit-row > summary::-webkit-details-marker { display: none; }
.audit-row + .audit-row { border-top: 1px solid var(--border); }
.audit-row > summary:hover { background: var(--surface-2); }
.audit-row[open] > summary { background: var(--surface-2); }
.audit-detail { padding: 6px 18px 14px; }
.audit-detail pre { margin: 0; background: var(--surface-3); border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; font-family: var(--mono); font-size: 12px; white-space: pre-wrap; overflow-wrap: anywhere; }

/* ------------------------------------------------------------ charts (server-rendered SVG) */
.chart { width: 100%; height: auto; display: block; }
.chart text { font-family: var(--font); font-size: 12px; fill: var(--text-2); }
.chart .axis { stroke: var(--border); }
.chart .track { fill: var(--surface-3); }
.c-success { fill: var(--success-solid); } .c-warning { fill: var(--warning-solid); } .c-danger { fill: var(--danger-solid); }
.c-info { fill: var(--info-solid); } .c-neutral { fill: var(--neutral-solid); } .c-brand { fill: var(--primary); } .c-none { fill: #c9b458; } .c-pending { fill: #6172f3; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12.5px; color: var(--text-2); margin-top: 10px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.legend .l-success { background: var(--success-solid); } .legend .l-warning { background: var(--warning-solid); } .legend .l-danger { background: var(--danger-solid); }
.legend .l-info { background: var(--info-solid); } .legend .l-neutral { background: var(--neutral-solid); } .legend .l-none { background: #c9b458; } .legend .l-pending { background: #6172f3; }
.metric-big { font-size: 30px; font-weight: 750; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }

/* steps (onboarding) */
.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; counter-reset: step; }
.steps li { counter-increment: step; display: grid; grid-template-columns: 34px 1fr auto; gap: 12px; align-items: center; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.steps li::before { content: counter(step); width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 13px; background: var(--surface-3); color: var(--text-2); }
.steps li.done::before { content: "✓"; background: var(--success-bg); color: var(--success); }
.steps li.current { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary) inset; }
.steps li.current::before { background: var(--primary); color: #fff; }

/* misc */
.preview-frame { width: 100%; height: 760px; border: 1px solid var(--border); border-radius: var(--radius); background: #fff; }
.qr svg { width: 200px; height: 200px; background: #fff; padding: 8px; border-radius: 8px; border: 1px solid var(--border); }
.codes { font-family: var(--mono); font-size: 15px; columns: 2; list-style: none; padding: 0; margin: 12px 0; }
.codes li { padding: 4px 0; }
.signal-row { display: flex; flex-wrap: wrap; gap: 8px; }
.signal { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: 8px; font-size: 12.5px; border: 1px dashed var(--border-strong); color: var(--muted); }
.signal.on { border-style: solid; border-color: var(--info-border); background: var(--info-bg); color: var(--info); }
.signal.final { border-style: solid; }
.signal.final.success { border-color: var(--success-border); background: var(--success-bg); color: var(--success); }
.signal.final.danger { border-color: var(--danger-border); background: var(--danger-bg); color: var(--danger); }
.status-hero { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.big-money { font-size: 22px; font-weight: 750; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.spacer { height: 16px; }
.divider { height: 1px; background: var(--border); margin: 14px 0; border: 0; }
.action-form { padding: 16px 0; border-top: 1px solid var(--border); }
.action-form:first-child { border-top: 0; padding-top: 0; }
.action-form h3 { margin-bottom: 4px; }
.danger-zone { border-color: var(--danger-border); }
.danger-zone .card-head { background: var(--danger-bg); border-radius: var(--radius-lg) var(--radius-lg) 0 0; }
.would-zone { border: 1px dashed var(--warning-border); }
.would-zone .card-head { background: var(--warning-bg); border-radius: var(--radius-lg) var(--radius-lg) 0 0; }
.pill-list { display: flex; gap: 6px; flex-wrap: wrap; }
.lines { list-style: none; margin: 0; padding: 0; }
.lines li { display: flex; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--border); }
.lines li:last-child { border-bottom: 0; }
.lines .qty { min-width: 42px; text-align: center; font-weight: 700; font-size: 12px; background: var(--surface-3); border-radius: 6px; padding: 2px 6px; height: fit-content; }
.summary-text { white-space: pre-wrap; font-size: 12.5px; line-height: 1.55; font-family: var(--mono); background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; margin: 0; }
ul.plain { list-style: none; padding: 0; margin: 0; }
ul.plain li { padding: 6px 0; }
ul.bullets { padding-left: 18px; }
ul.bullets li { margin: 3px 0; }

/* ------------------------------------------------------------ auth pages (sign in, 2FA) */
body.ui.auth { background: var(--shell); min-height: 100vh; }
.auth-wrap { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 520px); }
.auth-side { background: radial-gradient(1200px 600px at 10% 10%, #1b2a44 0%, var(--shell) 60%); color: var(--shell-text); padding: 48px; display: flex; flex-direction: column; justify-content: space-between; }
.auth-side .a-brand { color: #fff; font-weight: 800; letter-spacing: 3px; font-size: 15px; }
.auth-side .a-co { font-size: 11px; letter-spacing: 1.4px; text-transform: uppercase; color: var(--shell-muted); margin-top: 4px; }
.auth-side .a-pitch { max-width: 460px; }
.auth-side .a-pitch h2 { color: #fff; font-size: 26px; line-height: 1.25; margin-bottom: 12px; letter-spacing: -.02em; }
.auth-side .a-pitch p { color: var(--shell-text); }
.auth-side .a-points { list-style: none; padding: 0; margin: 18px 0 0; display: grid; gap: 10px; }
.auth-side .a-points li { display: flex; gap: 10px; align-items: center; color: var(--shell-text); }
.auth-side .a-points .icon { color: var(--brand-accent); }
.auth-side .a-foot { font-size: 12px; color: var(--shell-muted); }
.auth-main { background: var(--surface); display: flex; align-items: center; justify-content: center; padding: 40px 28px; }
.auth-card { width: 100%; max-width: 380px; }
.auth-card h1 { font-size: 24px; margin-bottom: 6px; }
.auth-card .lead { color: var(--muted); margin-bottom: 22px; }
.auth-card .btn-primary { width: 100%; min-height: 42px; margin-top: 6px; }
.auth-card .code-input { font-size: 20px !important; letter-spacing: 6px; text-align: center; font-family: var(--mono) !important; }
.auth-steps { display: flex; gap: 6px; margin-bottom: 18px; }
.auth-steps span { flex: 1; height: 4px; border-radius: 4px; background: var(--border); }
.auth-steps span.on { background: var(--primary); }

/* ------------------------------------------------------------ motion */
@keyframes pop { from { opacity: 0; transform: translateY(-4px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes toast-in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* ------------------------------------------------------------ responsive */
/* compact sidebar (icons) on mid-size screens */
@media (max-width: 1279px) and (min-width: 1024px) {
  :root { --sidebar-w: 76px; }
  .sidebar .brandmark { justify-content: center; padding: 16px 0; }
  .sidebar .bm-text, .sidebar .org-switch, .sidebar .nav-group-title, .sidebar .nav-text, .sidebar .sidebar-foot .foot-text { display: none; }
  .sidebar .nav-group { padding: 6px 10px; }
  .sidebar .nav-link { justify-content: center; padding: 10px 0; }
  .sidebar .nav-count { position: absolute; top: 2px; right: 6px; height: 16px; min-width: 16px; font-size: 10px; }
  .sidebar .sidebar-foot { text-align: center; padding: 12px 0; }
  .grid-main { grid-template-columns: minmax(0, 1fr) 330px; }
  .att-item { grid-template-columns: 6px 110px minmax(0, 1fr) minmax(130px, .8fr) 18px; }
}
@media (max-width: 1023px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .mobile-nav { display: block; }
  .topbar { padding: 0 14px; gap: 8px; }
  .topbar .context .store, .topbar .context .sep { display: none; }
  .search { max-width: none; }
  .content { padding: 18px 16px 48px; }
  .grid-main, .grid-3 { grid-template-columns: 1fr; }
  .grid-2 { grid-template-columns: 1fr; }
  .settings-row { grid-template-columns: 1fr; gap: 10px; }
  .att-item { grid-template-columns: 6px minmax(0, 1fr) 18px; gap: 6px 12px; padding-top: 12px; padding-bottom: 12px; }
  .att-item .att-why, .att-item .att-next { grid-column: 2; }
  .att-item .chev { grid-column: 3; grid-row: 1; }
  .att-item .bar { grid-row: 1 / span 4; }
  .auth-wrap { grid-template-columns: 1fr; }
  .auth-side { display: none; }
  .audit-row > summary { grid-template-columns: 1fr auto; }
  .audit-row > summary .a-col-hide { display: none; }
  .user-chip .who { display: none; }
}
/* tables become stacked cards on phones */
@media (max-width: 767px) {
  .ui h1 { font-size: 21px; }
  .search { display: none; }
  .mobile-search { display: block !important; margin-bottom: 14px; }
  .stats, .stats.eight { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .stat .s-value { font-size: 24px; }
  table.tbl.cards thead { display: none; }
  table.tbl.cards, table.tbl.cards tbody, table.tbl.cards tr, table.tbl.cards td { display: block; width: 100%; }
  table.tbl.cards tr { padding: 12px 14px; border-bottom: 1px solid var(--border); }
  table.tbl.cards tbody tr:last-child { border-bottom: 0; }
  table.tbl.cards td { border: 0; padding: 3px 0; display: flex; justify-content: space-between; gap: 12px; text-align: right; }
  table.tbl.cards td::before { content: attr(data-label); color: var(--muted); font-size: 12px; font-weight: 600; text-align: left; flex: 0 0 auto; }
  table.tbl.cards td.primary-cell { display: block; text-align: left; font-size: 15px; padding-bottom: 6px; }
  table.tbl.cards td.primary-cell::before { content: none; }
  table.tbl.cards tbody tr:hover td { background: transparent; }
  .kv { grid-template-columns: 1fr; gap: 1px; }
  .kv dd { margin-bottom: 9px; }
  .next { grid-template-columns: 1fr; }
  .next .n-icon { grid-row: auto; }
  .views { width: 100%; }
  .page-head { align-items: flex-start; }
  .dropdown-panel { position: fixed; left: 12px; right: 12px; top: calc(var(--topbar-h) + 6px); width: auto; }
}
.mobile-search { display: none; }
.mobile-nav > summary { list-style: none; }
.mobile-nav > summary::-webkit-details-marker { display: none; }
.mobile-nav-panel { position: fixed; inset: var(--topbar-h) 0 0 0; background: var(--shell); z-index: 50; overflow-y: auto; padding: 8px 6px 40px; animation: pop .14s ease-out; }
.mobile-nav-panel .nav-link { font-size: 15px; padding: 11px 12px; }

@media print {
  .sidebar, .topbar, .mode-strip, .head-actions { display: none !important; }
  .shell { display: block; }
  .card { box-shadow: none; break-inside: avoid; }
}

/* ---------------------------------------------------------------- notification centre (v0.11.0) */
.dot-count { background: var(--primary); }
.dot-count.critical { background: var(--danger-solid); }
.inline-link { display: inline; margin: 0; }
.inline-link button { background: none; border: 0; padding: 0; font: inherit; color: var(--primary-text); cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
.inline-link button:hover { color: var(--primary-hover); }
.dropdown-foot .inline-link button { font-size: 13px; }
.notif-list { list-style: none; margin: 0; padding: 0; }
.notif { display: grid; grid-template-columns: 4px minmax(0, 1fr); gap: 14px; padding: 14px 18px 14px 0; border-top: 1px solid var(--border); }
.notif:first-child { border-top: 0; }
.notif .bar { border-radius: 0 3px 3px 0; background: var(--neutral-border); }
.notif.danger .bar { background: var(--danger-solid); }
.notif.warning .bar { background: var(--warning-solid); }
.notif.info .bar { background: var(--info-solid); }
.notif.unread { background: var(--surface-2); }
.notif-main { min-width: 0; }
.notif-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.spacer-inline { flex: 1 1 auto; }
.unread-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--primary); display: inline-block; }
.ui a.notif-title { display: block; margin: 6px 0 2px; font-weight: 650; font-size: 15.5px; color: var(--text); }
.ui a.notif-title:hover { color: var(--primary-text); }
.notif-summary { margin: 0 0 8px; color: var(--text-2); }
.notif-facts { display: flex; flex-wrap: wrap; gap: 6px 18px; margin: 0 0 8px; font-size: 13px; }
.notif-facts div { display: flex; gap: 6px; align-items: center; }
.notif-facts dt { color: var(--muted); }
.notif-facts dd { margin: 0; font-weight: 600; }
.notif-next { margin: 0 0 8px; display: flex; gap: 6px; align-items: center; font-size: 14px; }
.notif-foot { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; font-size: 13px; }
.notif-foot .btn { margin-left: auto; }
.notif-list.compact .notif-facts { display: none; }
.mini-notifs { list-style: none; margin: 0; padding: 0; }
.mini-notifs li { border-top: 1px solid var(--border); }
.mini-notifs li:first-child { border-top: 0; }
.ui .mini-notifs a { display: grid; grid-template-columns: 4px minmax(0, 1fr); gap: 10px; padding: 10px 16px 10px 0; color: var(--text); font-size: 13.5px; }
.mini-notifs li.unread a { background: var(--surface-2); }
.breakdown { display: flex; flex-wrap: wrap; gap: 8px; border-bottom: 1px solid var(--border); }
.ui a.chip { display: inline-flex; align-items: center; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--neutral-border); background: var(--neutral-bg); color: var(--neutral); font-size: 13px; }
.ui a.chip.danger { border-color: var(--danger-border); background: var(--danger-bg); color: var(--danger); }
.ui a.chip.warning { border-color: var(--warning-border); background: var(--warning-bg); color: var(--warning); }
.ui a.chip.info { border-color: var(--info-border); background: var(--info-bg); color: var(--info); }
.ui a.chip:hover { text-decoration: none; filter: brightness(.97); }
.check-list { list-style: none; margin: 6px 0 4px; padding: 0; display: grid; gap: 6px; font-size: 13.5px; }
.check-list li { display: grid; grid-template-columns: 18px minmax(0, 1fr); gap: 6px; align-items: start; }
.check-list li.ok .icon { color: var(--success); }
.check-list li.bad .icon { color: var(--danger); }
.type-list { display: grid; gap: 10px; }
.type-row { align-items: flex-start; }
.choice.is-disabled { opacity: .55; }
@media (max-width: 767px) {
  .notif { padding-right: 12px; }
  .notif-foot .btn { margin-left: 0; }
}

/* ------------------------------------------------------------ help & tutorial */
.help { max-width: 1180px; }
.help-hero { background: linear-gradient(135deg, var(--primary-soft), var(--surface)); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 28px 28px 22px; margin-bottom: 18px; }
.help-hero h1 { font-size: 28px; }
.help-hero .lead { color: var(--text-2); margin: 6px 0 16px; max-width: 720px; }
.help-search { display: flex; align-items: center; gap: 8px; background: var(--surface); border: 1px solid var(--border-strong); border-radius: 12px; padding: 6px 6px 6px 12px; max-width: 720px; box-shadow: var(--shadow-xs); margin: 0 0 14px; }
.help-search .icon { color: var(--muted); flex: none; }
.help-search input { flex: 1; min-width: 0; border: 0; background: transparent; font: inherit; font-size: 16px; color: var(--text); padding: 8px 4px; }
.help-search input:focus { outline: none; }
.help-search:focus-within { outline: 2px solid var(--focus); outline-offset: 2px; }
.help-chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 6px; }
.help-h2 { font-size: 18px; margin: 22px 0 12px !important; }
.help-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; margin-bottom: 16px; }
.ui a.help-card { display: grid; gap: 4px; padding: 16px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); color: var(--text); box-shadow: var(--shadow-xs); }
.ui a.help-card:hover { text-decoration: none; border-color: var(--primary); }
.help-card-icon { width: 22px; height: 22px; color: var(--primary-text); margin-bottom: 4px; }
.hc-title { font-weight: 700; font-size: 15px; }
.hc-desc { color: var(--text-2); font-size: 13.5px; }
.hc-count { color: var(--muted); font-size: 12px; }
.help-start { margin-bottom: 4px; align-items: start; }
.ui a.btn { color: var(--text-2); text-decoration: none; }
.ui a.btn-primary { color: #fff; }
.help-list, .help-results { display: grid; gap: 10px; padding: 0; margin: 0; list-style: none; }
.ui a.help-row, .ui .help-results a { display: grid; gap: 3px; padding: 14px 16px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); color: var(--text); }
.ui a.help-row:hover, .ui .help-results a:hover { text-decoration: none; border-color: var(--primary); }
.hr-title { font-weight: 700; color: var(--primary-text); }
.hr-meta { font-size: 12px; color: var(--muted); }
.hr-sum { color: var(--text-2); font-size: 13.5px; }
.help-article-grid { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 16px; align-items: start; }
.help-aside { display: grid; gap: 12px; position: sticky; top: calc(var(--topbar-h) + 12px); }
.help-aside .help-search { margin: 0; }
.prose { font-size: 15px; line-height: 1.65; max-width: 72ch; }
.prose p, .prose ul, .prose ol { margin: 0 0 12px; }
.prose h2 { font-size: 17px; margin: 22px 0 8px; scroll-margin-top: calc(var(--topbar-h) + 12px); }
.prose li { margin: 3px 0; }
.help-steps { padding-left: 22px; }
.help-steps li { padding-left: 4px; margin: 6px 0; }
.help-note { display: grid; grid-template-columns: 20px minmax(0, 1fr); gap: 10px; padding: 12px 14px; border-radius: var(--radius); border: 1px solid var(--info-border); background: var(--info-bg); color: var(--text); margin: 12px 0; }
.help-note .icon { color: var(--info); margin-top: 2px; }
.help-note.warning { border-color: var(--warning-border); background: var(--warning-bg); }
.help-note.warning .icon { color: var(--warning); }
.help-note.danger { border-color: var(--danger-border); background: var(--danger-bg); }
.help-note.danger .icon { color: var(--danger); }
.help-note.success { border-color: var(--success-border); background: var(--success-bg); }
.help-note.success .icon { color: var(--success); }
.help-example { border-left: 3px solid var(--brand-accent); background: var(--surface-2); padding: 10px 14px; border-radius: 0 var(--radius) var(--radius) 0; margin: 12px 0; }
.help-example-label { display: inline-block; font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin-bottom: 2px; }
.help-flow { list-style: none; padding: 0; margin: 16px 0; display: grid; gap: 26px; }
.flow-step { position: relative; display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; }
.flow-step:not(:last-child)::after { content: "\2193"; position: absolute; left: 22px; bottom: -24px; color: var(--muted); font-weight: 700; }
.flow-box { display: grid; gap: 2px; padding: 10px 14px; border: 1px solid var(--border); border-left: 4px solid var(--neutral-solid); border-radius: var(--radius); background: var(--surface); }
.flow-box strong { text-transform: uppercase; letter-spacing: .03em; font-size: 13px; }
.flow-box span { color: var(--text-2); font-size: 13.5px; }
.flow-step.info .flow-box { border-left-color: var(--info-solid); }
.flow-step.warning .flow-box { border-left-color: var(--warning-solid); }
.flow-step.success .flow-box { border-left-color: var(--success-solid); }
.flow-step.danger .flow-box { border-left-color: var(--danger-solid); }
.flow-branch { margin: 0 0 0 18px; padding: 0 0 0 14px; border-left: 2px dashed var(--border-strong); color: var(--text-2); font-size: 13.5px; }
.help-qa details { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); margin: 8px 0; scroll-margin-top: calc(var(--topbar-h) + 12px); }
.help-qa summary { cursor: pointer; padding: 11px 14px; font-weight: 650; list-style: none; display: flex; justify-content: space-between; gap: 10px; }
.help-qa summary::-webkit-details-marker { display: none; }
.help-qa summary::after { content: "+"; color: var(--muted); font-weight: 700; }
.help-qa details[open] summary::after { content: "\2013"; }
.help-qa .qa-a { padding: 0 14px 12px; color: var(--text-2); }
.help-qa details:target { border-color: var(--primary); }
.help-guide { display: grid; gap: 10px; margin: 6px 0 14px; }
.help-guide section { border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; background: var(--surface); }
.help-guide h3 { display: flex; align-items: center; gap: 8px; font-size: 14.5px; margin: 0 0 6px; }
.help-guide h3 .icon { width: 18px; height: 18px; color: var(--info); }
.help-guide section.do { border-color: var(--success-border); background: var(--success-bg); }
.help-guide section.do h3 .icon { color: var(--success); }
.help-guide section.dont { border-color: var(--warning-border); background: var(--warning-bg); }
.help-guide section.dont h3 .icon { color: var(--warning); }
.help-guide p, .help-guide ol, .help-guide ul { margin: 0; }
.help-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.help-table th, .help-table td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
.help-table thead th { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.help-table tbody th { font-weight: 650; white-space: nowrap; }
.risk-pill { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 700; border: 1px solid; }
.risk-pill.low { color: var(--risk-low); background: var(--risk-low-bg); border-color: var(--risk-low-border); }
.risk-pill.medium { color: var(--risk-medium); background: var(--risk-medium-bg); border-color: var(--risk-medium-border); }
.risk-pill.high { color: var(--risk-high); background: var(--risk-high-bg); border-color: var(--risk-high-border); }
.risk-pill.none { color: var(--risk-none); background: var(--risk-none-bg); border-color: var(--risk-none-border); }
.risk-pill.pending { color: var(--risk-pending); background: var(--risk-pending-bg); border-color: var(--risk-pending-border); }
.help-live { font-weight: 650; color: inherit; border-bottom: 1px dotted var(--primary); }
.help-live-note { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 12.5px; margin: 6px 0 12px; }
.help-meta { color: var(--muted); font-size: 12.5px; border-top: 1px solid var(--border); padding-top: 10px; margin-top: 18px; }
.help-related { padding-left: 18px; }
.help-related-h { font-size: 15px !important; }
.help-side-list { list-style: none; margin: 0; padding: 4px 14px 10px; display: grid; gap: 6px; }
.help-glossary { margin: 0; display: grid; gap: 4px; }
.help-glossary > div { padding: 10px 2px; border-bottom: 1px solid var(--border); scroll-margin-top: calc(var(--topbar-h) + 12px); }
.help-glossary > div:target { background: var(--primary-soft); border-radius: 8px; padding-left: 10px; }
.help-glossary dt { font-weight: 700; }
.help-glossary dd { margin: 2px 0 0; color: var(--text-2); }
.ui a.help-link { display: inline-flex; align-items: center; gap: 5px; font-size: 13px; font-weight: 600; color: var(--primary-text); }
.ui a.help-tip { display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; border: 1px solid var(--border-strong); color: var(--muted); font-size: 11.5px; font-weight: 700; vertical-align: middle; margin-left: 4px; line-height: 1; }
.ui a.help-tip:hover { text-decoration: none; color: var(--primary-text); border-color: var(--primary); }
.dash-help { display: flex; flex-wrap: wrap; gap: 6px 18px; margin: -4px 0 14px; }
.need-help { display: flex; align-items: center; gap: 6px; margin: 6px 0 0; font-size: 13px; }
.help-context { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 8px 0 0; }
.tour-panel { border: 2px solid var(--primary); background: var(--surface); border-radius: var(--radius-lg); padding: 16px 18px; margin: 0 0 18px; box-shadow: var(--shadow-md); }
.tour-panel h2 { font-size: 18px; margin: 2px 0 6px; }
.tour-panel p { margin: 0 0 10px; max-width: 70ch; }
.tour-count { color: var(--muted); font-size: 12.5px; font-weight: 600; margin: 0 !important; }
.tour-progress { display: flex; gap: 6px; margin-bottom: 10px; }
.tour-progress span { height: 5px; flex: 1; border-radius: 99px; background: var(--neutral-border); }
.tour-progress span.on { background: var(--primary); }
.tour-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.tour-skip { margin-left: auto; }
.tour-focus { outline: 3px solid var(--primary); outline-offset: 4px; border-radius: var(--radius-lg); }
@media (max-width: 900px) {
  .help-article-grid { grid-template-columns: 1fr; }
  .help-aside { position: static; }
  .help-hero { padding: 20px 16px 16px; }
  .help-hero h1 { font-size: 23px; }
  .help-start { grid-template-columns: 1fr; }
  .tour-skip { margin-left: 0; }
}
@media (max-width: 560px) {
  .help-search { flex-wrap: wrap; }
  .help-search .btn { width: 100%; }
  .help-table tbody th { white-space: normal; }
}
@media print { .help-aside, .help-search, .tour-panel { display: none; } }
