/* Meridian back office — tokens first; light & dark are each selected, not auto-flipped. */
:root {
  color-scheme: light;
  --bg: #f4f4f1;
  --surface-1: #fcfcfb;
  --surface-2: #f0efec;
  --border: #e3e2dd;
  --grid: #e8e7e3;
  --text-primary: #0b0b0b;
  --text-secondary: #52514e;
  --text-muted: #7b7a75;
  --accent: #2a78d6;
  --accent-soft: #e6f0fc;
  --series-1: #2a78d6; --series-2: #eb6834; --series-3: #1baf7a; --series-4: #eda100;
  --series-5: #e87ba4; --series-6: #008300; --series-7: #6250d6; --series-8: #e34948;
  --seq-100: #cde2fb; --seq-200: #9ec5f4; --seq-300: #6da7ec; --seq-400: #3987e5; --seq-500: #256abf; --seq-600: #184f95; --seq-700: #0d366b;
  --good: #0ca30c; --good-text: #006300; --warning: #fab219; --serious: #ec835a; --critical: #d03b3b; --critical-text: #b42323;
  --shadow: 0 1px 2px rgb(0 0 0 / 0.04), 0 1px 1px rgb(0 0 0 / 0.03);
  --radius: 10px;
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #121211; --surface-1: #1a1a19; --surface-2: #232321; --border: #2e2e2b; --grid: #2a2a28;
    --text-primary: #f0efec; --text-secondary: #c3c2b7; --text-muted: #8f8e86;
    --accent: #3987e5; --accent-soft: #1b2a3d;
    --series-1: #3987e5; --series-2: #d95926; --series-3: #199e70; --series-4: #c98500;
    --series-5: #d55181; --series-6: #008300; --series-7: #9085e9; --series-8: #e66767;
    --seq-100: #1f2d3f; --seq-200: #184f95; --seq-300: #1c5cab; --seq-400: #256abf; --seq-500: #3987e5; --seq-600: #6da7ec; --seq-700: #b7d3f6;
    --good-text: #4ccf4c; --critical-text: #f08080;
    --shadow: none;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #121211; --surface-1: #1a1a19; --surface-2: #232321; --border: #2e2e2b; --grid: #2a2a28;
  --text-primary: #f0efec; --text-secondary: #c3c2b7; --text-muted: #8f8e86;
  --accent: #3987e5; --accent-soft: #1b2a3d;
  --series-1: #3987e5; --series-2: #d95926; --series-3: #199e70; --series-4: #c98500;
  --series-5: #d55181; --series-6: #008300; --series-7: #9085e9; --series-8: #e66767;
  --seq-100: #1f2d3f; --seq-200: #184f95; --seq-300: #1c5cab; --seq-400: #256abf; --seq-500: #3987e5; --seq-600: #6da7ec; --seq-700: #b7d3f6;
  --good-text: #4ccf4c; --critical-text: #f08080;
  --shadow: none;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text-primary); font: 14px/1.45 var(--font); -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); text-decoration: none; }
.num { font-variant-numeric: tabular-nums; }
.mono { font-family: var(--mono); font-size: 12px; }
.muted { color: var(--text-muted); }
.secondary { color: var(--text-secondary); }

/* layout */
.app { display: grid; grid-template-columns: 220px 1fr; min-height: 100vh; }
.side { background: var(--surface-1); border-right: 1px solid var(--border); padding: 18px 12px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 650; font-size: 15px; padding: 4px 8px 18px; }
.brand-mark { width: 26px; height: 26px; border-radius: 7px; background: var(--accent); display: grid; place-items: center; color: #fff; font-size: 13px; font-weight: 700; }
.nav-group { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted); padding: 14px 10px 6px; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 7px; color: var(--text-secondary); }
.nav a:hover { background: var(--surface-2); color: var(--text-primary); }
.nav a.active { background: var(--accent-soft); color: var(--accent); font-weight: 560; }
.nav svg { width: 16px; height: 16px; flex: none; }
.side-foot { margin-top: 24px; padding: 10px; border-top: 1px solid var(--border); font-size: 12px; color: var(--text-muted); }
.main { padding: 22px 28px 60px; min-width: 0; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 14px; flex-wrap: wrap; }
.page-head h1 { font-size: 22px; font-weight: 650; margin: 0; letter-spacing: -.01em; }
.page-head p { margin: 2px 0 0; color: var(--text-secondary); }

/* filter bar — one row, above everything */
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; background: var(--surface-1); border: 1px solid var(--border); border-radius: var(--radius); padding: 8px; margin-bottom: 16px; position: sticky; top: 8px; z-index: 5; box-shadow: var(--shadow); }
.seg { display: inline-flex; background: var(--surface-2); border-radius: 8px; padding: 2px; }
.seg button { border: 0; background: transparent; padding: 5px 10px; border-radius: 6px; cursor: pointer; color: var(--text-secondary); font-size: 13px; }
.seg.wrap { flex-wrap: wrap; row-gap: 2px; }   /* many tabs (Reports): wrap onto a second line, never hidden off-screen */
.seg button.on { background: var(--surface-1); color: var(--text-primary); box-shadow: var(--shadow); font-weight: 560; }
.ctl { height: 32px; border: 1px solid var(--border); background: var(--surface-1); border-radius: 8px; padding: 0 10px; font-size: 13px; min-width: 0; }
.ctl:focus-visible, .btn:focus-visible, .seg button:focus-visible, .nav a:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.btn { height: 32px; border: 1px solid var(--border); background: var(--surface-1); border-radius: 8px; padding: 0 12px; cursor: pointer; font-size: 13px; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.small { height: 26px; padding: 0 9px; font-size: 12px; }
.btn.danger { color: var(--critical-text); }
.btn:disabled, .btn:disabled:hover { opacity: .45; cursor: not-allowed; background: var(--surface-2); border-color: var(--border); color: var(--text-muted); }
.spacer { flex: 1; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 4px 3px 9px; border-radius: 99px; background: var(--accent-soft); color: var(--accent); font-size: 12px; }
.chip button { border: 0; background: none; cursor: pointer; color: inherit; padding: 0 4px; }

/* cards & grid */
.grid { display: grid; gap: 14px; }
.g-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g-21 { grid-template-columns: 2fr 1fr; }
.span-2 { grid-column: span 2; }
@media (max-width: 1200px) { .g-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g-21, .g-3 { grid-template-columns: 1fr; } }
@media (max-width: 760px) { .app { grid-template-columns: 1fr; } .side { position: static; height: auto; } .g-4, .g-2 { grid-template-columns: 1fr; } .span-2 { grid-column: auto; } .main { padding: 16px; } }
.card { background: var(--surface-1); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); min-width: 0; }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; padding: 14px 16px 4px; }
.card-head h3 { margin: 0; font-size: 14px; font-weight: 600; }
.card-head .sub { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.card-body { padding: 8px 16px 14px; }
.card-tools { display: flex; gap: 4px; }

/* stat tiles */
.stat { padding: 14px 16px; }
.stat-label { color: var(--text-secondary); font-size: 12.5px; display: flex; align-items: center; gap: 6px; }
.stat-value { font-size: 26px; font-weight: 640; letter-spacing: -.02em; margin-top: 4px; }
.stat-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 6px; font-size: 12px; }
.delta { display: inline-flex; align-items: center; gap: 3px; font-weight: 560; }
.delta.good { color: var(--good-text); }
.delta.bad { color: var(--critical-text); }
.delta.flat { color: var(--text-muted); }

/* tables */
.tbl-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th { text-align: left; font-weight: 560; color: var(--text-muted); font-size: 12px; padding: 8px 10px; border-bottom: 1px solid var(--border); white-space: nowrap; position: sticky; top: 0; background: var(--surface-1); }
.tbl th.r, .tbl td.r { text-align: right; }
.tbl th button { all: unset; cursor: pointer; }
.tbl td { padding: 8px 10px; border-bottom: 1px solid var(--grid); white-space: nowrap; }
.tbl tr.click { cursor: pointer; }
.tbl tr.click:hover td { background: var(--surface-2); }
.tbl tfoot td { font-weight: 600; border-top: 1px solid var(--border); border-bottom: 0; }
.key { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 8px; vertical-align: -1px; }
.inline-bar { height: 6px; border-radius: 3px; background: var(--accent); min-width: 2px; }

/* status pills (status colors ship with icon + label) */
.pill { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; padding: 2px 8px; border-radius: 99px; background: var(--surface-2); color: var(--text-secondary); }
.pill .dot { width: 7px; height: 7px; border-radius: 50%; }
.pill.good .dot { background: var(--good); } .pill.warning .dot { background: var(--warning); } .pill.serious .dot { background: var(--serious); } .pill.critical .dot { background: var(--critical); } .pill.info .dot { background: var(--accent); } .pill.neutral .dot { background: var(--text-muted); }

/* charts */
.chart { position: relative; }
.chart svg { display: block; width: 100%; overflow: visible; }
.chart .axis text { fill: var(--text-muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.chart .gridline { stroke: var(--grid); stroke-width: 1; }
.chart .baseline { stroke: var(--border); stroke-width: 1; }
.chart .hit { fill: transparent; cursor: pointer; }
.chart .hover-col { fill: var(--text-primary); opacity: .045; }
.chart .crosshair { stroke: var(--text-muted); stroke-width: 1; }
.chart .label { fill: var(--text-secondary); font-size: 11px; font-variant-numeric: tabular-nums; }
.tooltip { position: absolute; pointer-events: none; background: var(--surface-1); border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; box-shadow: 0 6px 20px rgb(0 0 0 / .12); font-size: 12px; min-width: 150px; z-index: 10; }
.tooltip .tt-title { color: var(--text-muted); margin-bottom: 4px; }
.tooltip .tt-row { display: flex; align-items: center; gap: 8px; margin-top: 2px; }
.tooltip .tt-row .v { font-weight: 640; font-variant-numeric: tabular-nums; }
.tooltip .tt-row .n { color: var(--text-secondary); }
.tooltip .tt-key { width: 12px; height: 2px; border-radius: 1px; flex: none; }
.tooltip .tt-hint { color: var(--text-muted); margin-top: 6px; font-size: 11px; }
.legend { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 12px; color: var(--text-secondary); padding: 2px 0 6px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend .lk-line { width: 14px; height: 2px; border-radius: 1px; }
.legend .lk-rect { width: 10px; height: 10px; border-radius: 3px; }

/* drawer */
.drawer-bg { position: fixed; inset: 0; background: rgb(0 0 0 / .25); z-index: 30; }
.drawer { position: fixed; right: 0; top: 0; bottom: 0; width: min(720px, 100vw); background: var(--surface-1); z-index: 31; box-shadow: -10px 0 30px rgb(0 0 0 / .15); display: flex; flex-direction: column; }
.drawer-head { padding: 16px 20px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }
.drawer-body { padding: 16px 20px; overflow-y: auto; }
.kv { display: grid; grid-template-columns: 150px 1fr; gap: 6px 12px; font-size: 13px; margin-bottom: 16px; }
.kv dt { color: var(--text-muted); }
.kv dd { margin: 0; overflow-wrap: anywhere; }
pre.json { background: var(--surface-2); border-radius: 8px; padding: 10px; font: 11.5px/1.5 var(--mono); overflow-x: auto; margin: 6px 0 0; white-space: pre-wrap; word-break: break-all; }
details summary { cursor: pointer; color: var(--text-secondary); font-size: 12.5px; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: grid; grid-template-columns: 18px 1fr; gap: 10px; padding-bottom: 14px; position: relative; }
.timeline li::before { content: ''; position: absolute; left: 8px; top: 18px; bottom: 0; width: 1px; background: var(--border); }
.timeline li:last-child::before { display: none; }
.tl-dot { width: 12px; height: 12px; border-radius: 50%; margin: 4px 0 0 2px; border: 2px solid var(--surface-1); box-shadow: 0 0 0 1px var(--border); }

/* login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login form { width: 100%; max-width: 360px; background: var(--surface-1); border: 1px solid var(--border); border-radius: 14px; padding: 28px; box-shadow: var(--shadow); display: grid; gap: 12px; }
.login h1 { font-size: 20px; margin: 0 0 4px; }
.login label { display: grid; gap: 5px; font-size: 12.5px; color: var(--text-secondary); }
.login .ctl { height: 38px; }
.error { color: var(--critical-text); font-size: 13px; }
.empty { padding: 30px; text-align: center; color: var(--text-muted); }
.banner { display: flex; gap: 10px; align-items: center; padding: 10px 14px; border-radius: 8px; background: var(--surface-2); margin-bottom: 14px; font-size: 13px; }
.skeleton { background: linear-gradient(90deg, var(--surface-2), var(--grid), var(--surface-2)); background-size: 200% 100%; animation: sk 1.2s infinite; border-radius: 6px; }
@keyframes sk { to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { .skeleton { animation: none; } }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---- upgrade 8: white-label branding, two-step login, mobile navigation ---- */
.brand-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.brand-row .brand { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu-btn { display: none; }
.powered { margin-top: 6px; font-size: 11px; color: var(--text-muted); letter-spacing: .02em; }
.banner.warn { border-left: 3px solid var(--warning); background: var(--surface-1); border: 1px solid var(--border); border-left-width: 3px; border-left-color: var(--warning); }
.banner.good { border: 1px solid var(--border); border-left: 3px solid var(--good); background: var(--surface-1); }
.ctl.otp { font: 600 22px/1 var(--mono); letter-spacing: .4em; text-align: center; height: 48px; }
.mfa-setup { display: grid; grid-template-columns: auto 1fr; gap: 18px; align-items: start; }
.qr { background: #fff; border-radius: 10px; padding: 8px; border: 1px solid var(--border); width: 184px; height: 184px; }
.qr svg { width: 100%; height: 100%; display: block; }
.secret-key { font: 600 14px/1.6 var(--mono); letter-spacing: .08em; background: var(--surface-2); border-radius: 8px; padding: 8px 10px; overflow-wrap: anywhere; user-select: all; }
.steps { margin: 0; padding-left: 18px; color: var(--text-secondary); font-size: 13px; display: grid; gap: 4px; }
.swatch { display: inline-block; width: 14px; height: 14px; border-radius: 4px; vertical-align: -2px; margin-right: 8px; border: 1px solid rgb(0 0 0 / .1); }
.toggle-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 10px 0; border-top: 1px solid var(--grid); }
.toggle-row:first-child { border-top: 0; }
.toggle-row .t { font-weight: 560; }
.toggle-row .d { font-size: 12.5px; color: var(--text-muted); }
.switch { position: relative; display: inline-block; vertical-align: middle; width: 38px; height: 22px; flex: none; }
.switch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; z-index: 1; }
.switch span { position: absolute; inset: 0; border-radius: 99px; background: var(--border); transition: background .15s; }
.switch span::after { content: ''; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgb(0 0 0 / .25); transition: transform .15s; }
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::after { transform: translateX(16px); }
.switch input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.switch input:disabled { cursor: not-allowed; } .switch input:disabled + span { opacity: .5; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 8px; align-items: end; margin-top: 12px; }
.form-grid label { display: grid; gap: 4px; font-size: 12px; color: var(--text-muted); }
.form-grid input[type="color"] { padding: 2px; width: 100%; }
@media (prefers-reduced-motion: reduce) { .switch span, .switch span::after { transition: none; } }
@media (max-width: 760px) {
  .side { padding: 10px 12px; border-right: 0; border-bottom: 1px solid var(--border); z-index: 20; }
  .brand-row .brand { padding: 4px 4px; }
  .menu-btn { display: inline-flex; }
  .side .nav, .side .side-foot { display: none; }
  .side.open .nav, .side.open .side-foot { display: block; }
  .mfa-setup { grid-template-columns: 1fr; justify-items: start; }
  .page-head h1 { font-size: 19px; }
}

/* white-label accent: applied last so it wins in both themes; lifted in dark mode to keep text contrast */
:root[data-branded] { --accent: var(--brand); --accent-soft: color-mix(in srgb, var(--brand) 13%, #fff); }
@media (prefers-color-scheme: dark) {
  :root[data-branded]:not([data-theme="light"]) { --accent: color-mix(in srgb, var(--brand) 72%, #fff); --accent-soft: color-mix(in srgb, var(--brand) 26%, #1a1a19); }
}
:root[data-branded][data-theme="dark"] { --accent: color-mix(in srgb, var(--brand) 72%, #fff); --accent-soft: color-mix(in srgb, var(--brand) 26%, #1a1a19); }
@media (max-width: 760px) {
  .seg { max-width: 100%; overflow-x: auto; scrollbar-width: none; }
  .seg.wrap { overflow-x: visible; }
  .seg button { flex: none; }
  .banner { flex-wrap: wrap; }
  .card-head { flex-wrap: wrap; }
  .filters { position: static; }
}
.timeline li > * { min-width: 0; overflow-wrap: anywhere; }

/* ---- rules builder ---- */
.templates { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; margin-bottom: 14px; }
.template { display: flex; gap: 10px; align-items: flex-start; text-align: left; padding: 12px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface-1); cursor: pointer; box-shadow: var(--shadow); }
.template:hover { border-color: var(--accent); }
.template:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.template strong { display: block; font-size: 13px; }
.template .muted { display: block; font-size: 12px; margin-top: 2px; }
.template-icon { flex: none; width: 32px; height: 32px; border-radius: 8px; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; }
.rule-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.rule { display: flex; gap: 12px; align-items: center; padding: 12px 14px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-1); }
.rule.off { opacity: .6; }
.rule-main { flex: 1; min-width: 0; }
.rule-sentence { font-size: 14px; line-height: 1.45; }
.rule-sentence.big { font-size: 16px; font-weight: 560; margin: 4px 0; }
.rule-meta { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 6px; font-size: 12px; }
.rule-actions { display: flex; gap: 8px; align-items: center; flex: none; }
.rule-preview { padding: 12px 14px; border-radius: 10px; background: var(--accent-soft); border: 1px solid var(--border); }
.fs { border: 1px solid var(--border); border-radius: 10px; padding: 10px 14px 14px; margin: 0; min-width: 0; }
.fs legend { font-weight: 600; font-size: 13px; padding: 0 4px; }
.cond-row { display: grid; grid-template-columns: 150px 1fr; gap: 10px; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--grid); }
.cond-row:last-child { border-bottom: 0; }
.cond-label { font-size: 13px; display: grid; }
.cond-label .muted { font-size: 11px; }
.mpick { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; min-height: 32px; padding: 3px 6px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface-1); min-width: 0; }
.mpick:focus-within { outline: 2px solid var(--accent); outline-offset: 1px; }
.mpick-all { font-size: 12.5px; color: var(--text-muted); padding-left: 4px; }
.mpick-input { flex: 1; min-width: 110px; border: 0; outline: 0; background: transparent; font-size: 13px; height: 24px; }
.field { display: grid; gap: 4px; font-size: 12.5px; color: var(--text-secondary); }
.field.inline { grid-template-columns: 1fr auto; align-items: center; }
.with-unit { display: inline-flex; align-items: center; gap: 6px; }
.with-unit .ctl { width: 110px; text-align: right; }
.with-unit span { color: var(--text-muted); font-size: 12.5px; min-width: 28px; }
.tier { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; font-size: 13px; }
.sim { display: grid; gap: 8px; margin-top: 6px; }
.sim-row { padding: 10px 12px; border-radius: 10px; background: var(--surface-2); }
.sim-title { font-size: 12px; color: var(--text-muted); }
.sim-value { font-size: 15px; font-weight: 600; margin: 2px 0; }
@media (max-width: 760px) { .cond-row { grid-template-columns: 1fr; gap: 4px; } .rule { flex-direction: column; align-items: stretch; } .field.inline { grid-template-columns: 1fr; } }

/* ---- game library ---- */
.game-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }
.game-card { display: flex; flex-direction: column; text-align: left; padding: 0; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-1); overflow: hidden; cursor: pointer; box-shadow: var(--shadow); color: inherit; }
.game-card:hover { border-color: var(--accent); }
.game-card:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.game-card.hidden .game-img { filter: grayscale(1); opacity: .5; }
.game-img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; background: var(--surface-2); }
.game-img.big { aspect-ratio: 16 / 10; border-radius: 10px; }
.game-img.placeholder { display: grid; place-items: center; color: rgb(255 255 255 / .92); font: 700 28px/1 var(--font); letter-spacing: .04em; }
.game-img.big.placeholder { font-size: 44px; }
.game-body { padding: 10px 12px 12px; display: grid; gap: 3px; }
.game-name { font-weight: 600; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.game-sub { font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.game-badges { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; min-height: 20px; }
.drop { display: grid; gap: 10px; padding: 10px; border: 1px dashed var(--border); border-radius: 12px; }
.drop.over { border-color: var(--accent); background: var(--accent-soft); }
.drop-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
@media (max-width: 760px) { .game-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; } }

/* ---- studios ---- */
.section-title { font-size: 13px; font-weight: 600; color: var(--text-secondary); margin: 6px 0 10px; text-transform: uppercase; letter-spacing: .04em; }
.studio-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.studio-card { display: grid; gap: 10px; text-align: left; padding: 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-1); cursor: pointer; box-shadow: var(--shadow); color: inherit; }
.studio-card:hover { border-color: var(--accent); }
.studio-card:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.studio-top { display: flex; gap: 10px; align-items: center; }
.studio-mark { flex: none; width: 36px; height: 36px; border-radius: 9px; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; font-weight: 700; }
.studio-name { font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.studio-stats { display: flex; gap: 14px; font-size: 12.5px; color: var(--text-secondary); flex-wrap: wrap; }
.studio-stats strong { color: var(--text-primary); }

/* ---- foundation: smart tables, notifications, dashboards, roles ---- */
.dt-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 10px; }
.dt-search { width: 220px; max-width: 100%; height: 30px; }
.dt-chip { height: 30px; width: auto; max-width: 200px; font-size: 12.5px; }
.dt-chip.on { border-color: var(--accent); background: var(--accent-soft); color: var(--text-primary); }
.dt-spacer { flex: 1 1 auto; }
.dt-menu-wrap { position: relative; display: inline-block; }
.dt-menu { position: absolute; right: 0; top: calc(100% + 4px); z-index: 40; min-width: 210px; max-height: 340px; overflow-y: auto; background: var(--surface-1); border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 8px 24px rgb(0 0 0 / .14); padding: 5px; display: grid; gap: 1px; }
.answer-actions .dt-menu { left: 0; right: auto; }
.dt-menu-item { all: unset; box-sizing: border-box; display: block; width: 100%; padding: 7px 10px; border-radius: 6px; cursor: pointer; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dt-menu-item:hover, .dt-menu-item:focus-visible { background: var(--surface-2); }
.dt-menu-item.strong { font-weight: 600; }
.dt-menu-item.danger { color: var(--critical-text); }
.dt-menu-row { display: flex; align-items: center; gap: 2px; }
.dt-menu-row .dt-menu-item { flex: 1; min-width: 0; }
.dt-x { all: unset; cursor: pointer; width: 24px; height: 24px; flex: none; display: inline-grid; place-items: center; border-radius: 6px; color: var(--text-muted); font-size: 16px; }
.dt-x:hover, .dt-x:focus-visible { background: var(--surface-2); color: var(--text-primary); }
.dt-menu-check { display: flex; align-items: center; gap: 8px; padding: 6px 10px; border-radius: 6px; cursor: pointer; font-size: 13px; }
.dt-menu-check:hover { background: var(--surface-2); }
.dt-menu-note { padding: 6px 10px; font-size: 12px; }
.dt-menu-save { display: flex; gap: 6px; padding: 6px 6px 2px; border-top: 1px solid var(--grid); margin-top: 4px; }
.dt-menu-save .ctl { height: 28px; flex: 1; min-width: 0; }
.dt-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding-top: 10px; font-size: 12.5px; }
.dt .tbl th[aria-sort] { color: var(--text-primary); }

/* bell + toasts */
.bell { position: relative; flex: none; margin-bottom: 14px; }
.brand-row .brand { flex: 1; }
.bell-btn { all: unset; box-sizing: border-box; position: relative; width: 32px; height: 32px; display: grid; place-items: center; border-radius: 8px; cursor: pointer; color: var(--text-secondary); }
.bell-btn:hover { background: var(--surface-2); color: var(--text-primary); }
.bell-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.bell-btn svg { width: 19px; height: 19px; }
.bell-count { position: absolute; top: 2px; right: 1px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 99px; background: var(--critical); color: #fff; font: 600 10px/16px var(--font); text-align: center; box-shadow: 0 0 0 2px var(--surface-1); }
.bell-panel { position: fixed; left: 228px; top: 12px; z-index: 60; width: 360px; max-width: calc(100vw - 24px); background: var(--surface-1); border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 12px 32px rgb(0 0 0 / .18); overflow: hidden; }
.bell-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--border); }
.bell-list { max-height: 420px; overflow-y: auto; }
.bell-item { all: unset; box-sizing: border-box; display: flex; gap: 10px; align-items: flex-start; width: 100%; padding: 10px 12px; border-bottom: 1px solid var(--grid); cursor: pointer; }
.bell-item:hover, .bell-item:focus-visible { background: var(--surface-2); }
.bell-item.unread { background: var(--accent-soft); }
.bell-item.unread:hover { background: color-mix(in srgb, var(--accent-soft) 70%, var(--surface-2)); }
.bell-text { display: grid; gap: 2px; min-width: 0; }
.bell-title { font-size: 13px; font-weight: 560; overflow-wrap: anywhere; }
.bell-body { font-size: 12.5px; color: var(--text-secondary); overflow-wrap: anywhere; }
.bell-time { font-size: 11.5px; color: var(--text-muted); }
.toasts { position: fixed; right: 16px; bottom: 16px; z-index: 80; display: grid; gap: 8px; width: 340px; max-width: calc(100vw - 32px); pointer-events: none; }
.toast { pointer-events: auto; display: flex; align-items: flex-start; gap: 6px; background: var(--surface-1); border: 1px solid var(--border); border-left: 4px solid var(--accent); border-radius: 10px; box-shadow: 0 10px 28px rgb(0 0 0 / .18); padding: 10px 8px 10px 12px; animation: toast-in .18s ease-out; }
.toast.critical { border-left-color: var(--critical); } .toast.serious { border-left-color: var(--serious); } .toast.warning { border-left-color: var(--warning); }
.toast-body { all: unset; cursor: pointer; flex: 1; display: grid; gap: 2px; font-size: 13px; min-width: 0; overflow-wrap: anywhere; }
.toast-body span { color: var(--text-secondary); font-size: 12.5px; }
@keyframes toast-in { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .toast { animation: none; } }

/* dashboards */
.dash-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 2px 0 10px; }
.dash-head h2 { font-size: 15px; margin: 0; font-weight: 620; }
.tiles { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 14px; }
.tile { min-width: 0; }
.tile-s { grid-column: span 2; } .tile-m { grid-column: span 3; } .tile-l { grid-column: span 6; }
.tile .card-head { align-items: flex-start; }
@media (max-width: 1200px) { .tile-s { grid-column: span 3; } .tile-m { grid-column: span 6; } }
@media (max-width: 760px) { .tiles { grid-template-columns: 1fr; } .tile-s, .tile-m, .tile-l { grid-column: auto; } }
.answer-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--grid); }

/* roles matrix */
.perm-matrix th.c, .perm-matrix td.c { text-align: center; }
.perm-matrix td:first-child { white-space: normal; min-width: 240px; }
.perm-matrix th { vertical-align: bottom; }
.perm-matrix .perm-group td { background: var(--surface-2); font-weight: 600; font-size: 12px; color: var(--text-secondary); text-transform: uppercase; letter-spacing: .04em; padding: 6px 10px; }
.perm-matrix input[type="checkbox"], .tbl td.c input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--accent); cursor: pointer; }
.perm-matrix input:disabled { cursor: not-allowed; }
.tbl th.c, .tbl td.c { text-align: center; }

@media (max-width: 760px) {
  .dt-search { width: 100%; }
  .dt-spacer { display: none; }
  .bell { margin-bottom: 0; }
  .bell-panel { left: 12px; right: 12px; top: 56px; width: auto; }
}

/* PDF downloads: print only the generated sheet */
.print-sheet { display: none; }
body.printing > *:not(.print-sheet) { display: none !important; }
body.printing .print-sheet { display: block; padding: 24px; color: #000; background: #fff; font: 11px/1.4 var(--font); }
.print-sheet h1 { font-size: 18px; margin: 0 0 4px; }
.print-sheet .print-sub { margin: 0 0 4px; color: #555; }
.print-sheet table { width: 100%; border-collapse: collapse; margin-top: 12px; }
.print-sheet th { text-align: left; border-bottom: 1.5px solid #000; padding: 4px 6px; font-weight: 600; }
.print-sheet td { border-bottom: 1px solid #ddd; padding: 3px 6px; }
.print-sheet td.r { text-align: right; font-variant-numeric: tabular-nums; }
.print-sheet tr { break-inside: avoid; }
@media print { body.printing { background: #fff; } @page { margin: 12mm; } }
.side { z-index: 30; }

/* ---- audit log ---- */
.audit-seal { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.audit-seal.good { border: 1px solid var(--border); border-left: 3px solid var(--good); background: var(--surface-1); }
.audit-seal.bad { border: 1px solid var(--critical); border-left: 3px solid var(--critical); background: color-mix(in srgb, var(--critical) 8%, var(--surface-1)); }
.seal-icon { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; color: #fff; background: var(--good); flex: none; }
.audit-seal.bad .seal-icon { background: var(--critical); }
.audit-filters { margin-bottom: 14px; }
.audit-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.audit-search { flex: 1 1 220px; min-width: 180px; height: 32px; }
.audit-imp { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; cursor: pointer; white-space: nowrap; }
.audit-cats { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.audit-cat { all: unset; box-sizing: border-box; display: inline-flex; align-items: center; gap: 7px; height: 30px; padding: 0 11px; border: 1px solid var(--border); border-radius: 99px; font-size: 12.5px; cursor: pointer; background: var(--surface-1); color: var(--text-secondary); }
.audit-cat i { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.audit-cat .n { color: var(--text-muted); font-variant-numeric: tabular-nums; }
.audit-cat:hover { background: var(--surface-2); }
.audit-cat.on { border-color: var(--accent); background: var(--accent-soft); color: var(--text-primary); }
.audit-cat:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.audit-cat:disabled { opacity: .45; cursor: default; }
.audit-active { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 10px; }
.audit-active .pill .dt-x { width: 18px; height: 18px; font-size: 14px; margin-left: 2px; }
.audit-feed { transition: opacity .15s; }
.audit-feed.busy { opacity: .6; }
.audit-day-head { margin: 0; padding: 8px 16px; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted); background: var(--surface-2); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 2; }
.audit-list { list-style: none; margin: 0; padding: 0; }
.audit-item { border-bottom: 1px solid var(--grid); }
.audit-item:last-child { border-bottom: 0; }
.audit-item.imp { box-shadow: inset 3px 0 0 var(--serious); }
.audit-line { all: unset; box-sizing: border-box; display: grid; grid-template-columns: 66px 10px 1fr 16px; gap: 12px; align-items: start; width: 100%; padding: 11px 16px; cursor: pointer; }
.audit-line:hover { background: var(--surface-2); }
.audit-line:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.audit-time { color: var(--text-muted); font-size: 12.5px; padding-top: 1px; white-space: nowrap; }
.audit-dot { width: 9px; height: 9px; border-radius: 50%; margin-top: 6px; }
.audit-text { display: grid; gap: 4px; min-width: 0; font-size: 13.5px; overflow-wrap: anywhere; }
.audit-actor { font-weight: 600; }
.audit-actor.sys { color: var(--text-secondary); }
.audit-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 12px; }
.audit-meta .pill { font-size: 11px; padding: 1px 7px; }
.audit-tag { font-size: 11.5px; padding: 1px 7px; border-radius: 6px; background: var(--surface-2); color: var(--text-secondary); }
.audit-chev { color: var(--text-muted); font-size: 12px; padding-top: 2px; }
.audit-detail { padding: 2px 16px 14px 104px; display: grid; gap: 12px; }
.audit-changes { max-width: 760px; }
.audit-changes td { white-space: normal; overflow-wrap: anywhere; vertical-align: top; }
.audit-changes td.was { color: var(--critical-text); text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--critical) 50%, transparent); }
.audit-changes td.now { color: var(--good-text); }
.audit-facts { display: flex; flex-wrap: wrap; gap: 6px 24px; margin: 0; font-size: 12.5px; }
.audit-facts div { display: flex; gap: 6px; }
.audit-facts dt { color: var(--text-muted); }
.audit-facts dd { margin: 0; }
.audit-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.audit-raw summary { cursor: pointer; font-size: 12.5px; color: var(--text-muted); }
.audit-raw pre { margin: 6px 0 0; padding: 10px; background: var(--surface-2); border-radius: 8px; font: 11.5px/1.5 var(--mono); overflow-x: auto; max-height: 320px; }
.audit-more { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 16px; border-top: 1px solid var(--border); }
@media (max-width: 760px) {
  .audit-line { grid-template-columns: 58px 8px 1fr; gap: 8px; padding: 11px 12px; }
  .audit-cats { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin-left: -4px; padding: 0 4px 2px; }
  .audit-cat { flex: none; }
  .audit-row .dt-chip { flex: 1 1 140px; max-width: none; }
  .audit-seal .btn { width: 100%; justify-content: center; }
  .audit-seal .secondary { display: block; font-size: 12.5px; margin-top: 2px; }
  .audit-chev { display: none; }
  .audit-detail { padding: 2px 12px 14px 12px; }
  .audit-row .seg { width: 100%; }
  .audit-search { flex-basis: 100%; }
}
.dt .tbl th.dt-check, .dt .tbl td.dt-check { width: 34px; padding-right: 0; }
.dt .tbl td.dt-check input, .dt .tbl th.dt-check input { width: 16px; height: 16px; accent-color: var(--accent); cursor: pointer; }
.dt .tbl tr.sel td { background: var(--accent-soft); }

/* ---- risk & fraud ---- */
.risk-alarm { display: flex; align-items: center; gap: 10px; border: 1px solid var(--critical); border-left: 4px solid var(--critical); background: color-mix(in srgb, var(--critical) 9%, var(--surface-1)); margin-bottom: 14px; }
.risk-alarm-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--critical); box-shadow: 0 0 0 0 color-mix(in srgb, var(--critical) 60%, transparent); animation: risk-pulse 1.6s infinite; flex: none; }
@keyframes risk-pulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--critical) 55%, transparent); } 70% { box-shadow: 0 0 0 9px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }
@media (prefers-reduced-motion: reduce) { .risk-alarm-dot { animation: none; } }
.risk-tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 14px; }
.risk-tile { text-align: left; cursor: pointer; font: inherit; color: inherit; }
.risk-tile:hover { border-color: color-mix(in srgb, var(--accent) 40%, var(--border)); }
.risk-tile.on { outline: 2px solid var(--accent); outline-offset: -1px; }
@media (max-width: 1000px) { .risk-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.risk-title { display: grid; gap: 2px; white-space: normal; min-width: 220px; }
.risk-title b { font-weight: 560; }
.risk-title .muted { font-size: 12px; }
.dt .tbl tr.risk-crit td:first-child { box-shadow: inset 3px 0 0 var(--critical); }
.bulk-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 8px 10px; margin-bottom: 10px; background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--border)); border-radius: 10px; position: sticky; top: 8px; z-index: 5; }
.bulk-form { display: flex; flex-wrap: wrap; gap: 6px; flex-basis: 100%; }
.bulk-form .ctl { height: 30px; flex: 1 1 260px; }
.drawer-h { margin: 18px 0 6px; font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted); font-weight: 600; }
.risk-related { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; font-size: 13px; }
.risk-timeline { list-style: none; margin: 0 0 12px; padding: 0 0 0 14px; border-left: 2px solid var(--grid); display: grid; gap: 10px; font-size: 13px; }
.risk-timeline li { position: relative; }
.risk-timeline li::before { content: ''; position: absolute; left: -20px; top: 6px; width: 10px; height: 10px; border-radius: 50%; background: var(--surface-1); border: 2px solid var(--border); }
.risk-timeline blockquote { margin: 4px 0 0; padding: 6px 10px; background: var(--surface-2); border-radius: 8px; color: var(--text-secondary); white-space: pre-wrap; }
.risk-compose { display: grid; gap: 8px; position: sticky; bottom: -20px; background: var(--surface-1); padding: 10px 0 4px; border-top: 1px solid var(--border); }
.risk-compose textarea { width: 100%; min-height: 70px; padding: 9px 10px; resize: vertical; }
.risk-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.risk-rules .rules-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.rule-list { display: grid; gap: 10px; }
.rule-card { display: flex; gap: 14px; justify-content: space-between; align-items: center; padding: 12px 14px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-1); flex-wrap: wrap; }
.rule-card.off { opacity: .65; }
.rule-main { display: grid; gap: 4px; min-width: 0; flex: 1 1 320px; }
.rule-name { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.rule-sentence { font-size: 15px; }
.rule-actions { display: flex; gap: 8px; align-items: center; }
.rule-builder { border: 1px solid color-mix(in srgb, var(--accent) 40%, var(--border)); background: color-mix(in srgb, var(--accent-soft) 45%, var(--surface-1)); border-radius: 12px; padding: 16px; margin-bottom: 16px; display: grid; gap: 12px; }
.sentence-builder { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 16px; line-height: 2; }
.sentence-builder .ctl { height: 36px; font-size: 15px; width: auto; max-width: 100%; }
.money-in { display: inline-flex; align-items: center; gap: 6px; }
.money-in .ctl { width: 120px; }
.rule-name-in { display: grid; gap: 4px; font-size: 12px; color: var(--text-muted); max-width: 360px; }
.rule-test { border-top: 1px solid var(--border); padding-top: 12px; display: grid; gap: 10px; }
.rule-test-head { display: flex; align-items: center; gap: 14px; }
.rule-test-n { font-size: 34px; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--accent); min-width: 56px; text-align: center; }
.rule-test-n.zero { color: var(--text-muted); }
.rule-test-n.many { color: var(--serious); }
.rule-test-days { display: flex; align-items: flex-end; gap: 4px; height: 44px; max-width: 280px; }
.rule-test-days span { flex: 1; background: var(--seq-400); border-radius: 3px 3px 0 0; min-height: 4px; }
.bar-list { display: grid; gap: 10px; }
.bar-row .bar-head { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 4px; }
.bar-track { height: 6px; border-radius: 3px; background: var(--grid); overflow: hidden; }
.bar-track .inline-bar { height: 100%; display: block; }
@media (max-width: 760px) {
  .sentence-builder { font-size: 15px; }
  .sentence-builder .ctl { flex: 1 1 100%; }
  .money-in { flex: 1 1 100%; } .money-in .ctl { flex: 1; width: auto; }
}

/* ---- Ask Meridian: figures, comparison, follow-ups ---- */
.figures { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-bottom: 14px; }
.figures.compact { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-bottom: 0; }
.figure { border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; min-width: 0; background: var(--surface-1); }
.figure.main { border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); background: color-mix(in srgb, var(--accent-soft) 50%, var(--surface-1)); }
.figure-label { font-size: 12px; color: var(--text-muted); }
.figure-value { font-size: 22px; font-weight: 650; margin: 2px 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.figures.compact .figure-value { font-size: 20px; }
.figure-foot { font-size: 12px; }
.delta { font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.delta.up { color: var(--good-text); } .delta.down { color: var(--critical-text); } .delta.flat { color: var(--text-muted); }
.chart-kind { margin-bottom: 8px; }
.follow-ups { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 12px; font-size: 12.5px; }
.follow-chip { border: 1px solid var(--border); cursor: pointer; padding: 5px 11px; background: var(--surface-1); }
.follow-chip:hover { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 40%, var(--border)); }
.print-chart svg { width: 100%; max-height: 260px; margin: 8px 0 4px; }
@media (max-width: 900px) { .figures { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.stat-btn { text-align: left; font: inherit; color: inherit; cursor: pointer; }
.stat-btn:hover { border-color: color-mix(in srgb, var(--accent) 40%, var(--border)); }
.stat-btn[aria-pressed="true"] { outline: 2px solid var(--accent); outline-offset: -1px; }
@media (max-width: 760px) {
  .grid.g-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .grid.g-4 .stat-value { font-size: 22px; }
  .grid.g-4 .stat { padding: 12px; }
}

/* Sandbox / Live: a permanent indicator on every screen (Environment.tsx) */
.env-bar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 8px 14px; margin-bottom: 14px; border-radius: 8px; font-size: 13px; border: 1px solid var(--border); border-left-width: 4px; background: var(--surface-1); }
.env-bar.sandbox { border-left-color: var(--warning); }
.env-bar.live { border-left-color: var(--critical); }
.env-name { font-weight: 700; letter-spacing: .08em; }
.env-bar.live .env-name { color: var(--critical-text); }
.env-state { color: var(--text-secondary); }
.env-switch { margin-left: auto; display: inline-flex; border: 1px solid var(--border); border-radius: 6px; overflow: hidden; }
.env-opt { padding: 3px 12px; text-decoration: none; color: inherit; }
.env-opt.current { background: var(--surface-2); font-weight: 600; }
.env-opt.off { color: var(--text-muted); cursor: not-allowed; }
a.env-opt:hover { background: var(--surface-2); }
.login .env-bar { position: absolute; top: 16px; left: 16px; right: 16px; }

/* Global search (Phase 2, A2) */
.search-btn { width: 100%; justify-content: flex-start; margin: 4px 0 10px; color: var(--text-secondary); }
.search-btn span { flex: 1; text-align: left; }
.search-btn kbd { font: 11px/1 var(--mono, ui-monospace, monospace); border: 1px solid var(--border); border-radius: 4px; padding: 2px 4px; color: var(--text-muted); }
.side-tools { display: flex; gap: 6px; align-items: center; margin: 4px 0 10px; }
.side-tools .search-btn { margin: 0; flex: 1; min-width: 0; }
.side-tools .inbox-link { flex: none; white-space: nowrap; }
.side-tools .search-btn kbd { display: none; }
.palette-bg { display: flex; justify-content: center; align-items: flex-start; padding-top: 12vh; }
.palette { width: min(640px, calc(100vw - 32px)); background: var(--surface-1); border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 20px 50px rgb(0 0 0 / .25); overflow: hidden; }
.palette-input { width: 100%; height: 48px; border: 0; border-bottom: 1px solid var(--border); border-radius: 0; font-size: 15px; padding: 0 16px; }
.palette-input:focus { outline: none; }
.palette-list { list-style: none; margin: 0; padding: 4px; max-height: 50vh; overflow-y: auto; }
.palette-list li { display: grid; grid-template-columns: 110px 1fr; grid-template-rows: auto auto; column-gap: 10px; padding: 8px 10px; border-radius: 8px; cursor: pointer; }
.palette-list li.on { background: var(--surface-2); }
.palette-type { grid-row: span 2; align-self: center; justify-self: start; font-size: 11px; }
.palette-title { font-weight: 560; overflow-wrap: anywhere; }
.palette-detail { font-size: 12px; }
.palette-foot { padding: 8px 14px; border-top: 1px solid var(--border); font-size: 12px; }
@media (max-width: 760px) { .search-btn kbd { display: none; } .palette-bg { padding-top: 8px; } }
/* Menu grouped by job, foldable (Phase 2, A4) */
.nav-section { display: contents; }
button.nav-group { display: flex; width: 100%; justify-content: space-between; align-items: center; background: none; border: 0; cursor: pointer; text-align: left; font: inherit; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted); padding: 14px 10px 6px; }
button.nav-group:hover { color: var(--text-secondary); }
.nav-caret { font-size: 10px; }
.crumbs { font-size: 12px; color: var(--text-muted); margin: 0 0 6px; }

/* Round trace (Phase 2, B1) */
.trace-list { list-style: none; margin: 0 0 4px; padding: 0; border-left: 2px solid var(--border); }
.trace-list li { display: grid; grid-template-columns: 22px 150px 1fr; column-gap: 8px; padding: 5px 0 5px 8px; font-size: 13px; }
.trace-icon { text-align: center; color: var(--text-muted); }
.trace-time { font-size: 12px; }
.trace-detail { grid-column: 3; font-size: 12px; }
.trace-reconciler_rollback .trace-title, .trace-wallet_pending .trace-title, .trace-refund_pending .trace-title { color: var(--warning, #b45309); font-weight: 560; }
.trace-plain { margin: 0; padding-left: 18px; font-size: 13px; }
@media (max-width: 760px) { .trace-list li { grid-template-columns: 22px 1fr; } .trace-time { grid-column: 2; } .trace-title, .trace-detail { grid-column: 2; } }
.case-control { display: inline-flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.case-edit { display: inline-flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.case-edit input { min-width: 180px; }

/* Phase 2 C1: a figure that opens the rows behind it */
.linklike { background: none; border: 0; padding: 0; font: inherit; color: var(--accent); cursor: pointer; text-decoration: underline dotted; text-underline-offset: 3px; }
.linklike:hover { text-decoration: underline; }
