/* ==========================================================================
   BrandWest FoodOS — application shell & components
   ========================================================================== */

*,
*::before,
*::after { box-sizing: border-box; }

* { margin: 0; }

html { -webkit-text-size-adjust: 100%; }

body {
  background: var(--canvas);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5 {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: -0.025em;
  line-height: 1.12;
  text-wrap: balance;
}

p { text-wrap: pretty; }

a { color: var(--electric-bright); text-decoration-thickness: 1px; text-underline-offset: 2px; }

:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 2px;
  border-radius: 3px;
}

::selection { background: var(--electric); color: var(--on-electric); }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #232838; border-radius: 6px; border: 2px solid var(--canvas); }
::-webkit-scrollbar-thumb:hover { background: #2f3549; }

.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 200;
  background: var(--signal); color: var(--on-signal);
  padding: 0.6rem 1rem; border-radius: 0 0 var(--r-sm) 0; font-weight: 600;
}
.skip-link:focus { left: 0; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* --- shell ---------------------------------------------------------------- */

.shell { display: flex; min-height: 100vh; }

.sidebar {
  width: 250px; flex: 0 0 250px;
  background: var(--surface);
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  padding: 1.25rem 0.85rem 1rem;
  z-index: 40;
}

.brand { display: flex; align-items: center; gap: 0.65rem; padding: 0 0.4rem 1.1rem; }
.brand-mark { color: var(--electric); display: grid; place-items: center; }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-name { font-family: var(--font-display); font-weight: 700; font-size: 1.15rem; letter-spacing: -0.03em; }
.brand-sub { font-size: 0.7rem; color: var(--ink-faint); letter-spacing: 0.06em; text-transform: uppercase; }

.vendor-switch { padding: 0 0.4rem 1rem; border-bottom: 1px solid var(--line); }

.nav { display: flex; flex-direction: column; gap: 1rem; padding: 1rem 0; flex: 1; }
.nav-group { display: flex; flex-direction: column; gap: 1px; }
.nav-group-title {
  font-size: 0.66rem; letter-spacing: 0.11em; text-transform: uppercase;
  color: var(--ink-faint); padding: 0 0.65rem 0.35rem; font-weight: 600;
}
.nav a {
  display: flex; align-items: center; gap: 0.6rem;
  padding: 0.5rem 0.65rem; border-radius: var(--r-sm);
  color: var(--ink-muted); text-decoration: none; font-size: 0.875rem; font-weight: 500;
  transition: background 0.16s var(--ease-quart), color 0.16s var(--ease-quart);
}
.nav a:hover { background: var(--elevated); color: var(--ink); }
.nav a.is-active { background: color-mix(in srgb, var(--electric) 16%, transparent); color: var(--ink); }
.nav a.is-active .nav-ico { color: var(--electric-bright); }
.nav-ico { width: 1.05rem; text-align: center; color: var(--ink-faint); font-size: 0.9rem; }

.sidebar-foot { border-top: 1px solid var(--line); padding-top: 0.8rem; display: flex; flex-direction: column; gap: 0.5rem; }
.demo-note { font-size: 0.72rem; color: var(--ink-faint); display: flex; gap: 0.45rem; align-items: flex-start; line-height: 1.45; padding: 0 0.4rem; }
.dot { width: 7px; height: 7px; border-radius: 50%; flex: 0 0 7px; margin-top: 0.42rem; }
.dot-signal { background: var(--signal); }

.main-col { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 1rem;
  padding: 0.9rem 1.6rem;
  background: color-mix(in srgb, var(--canvas) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.topbar-title { flex: 1; min-width: 0; }
.topbar-title h1 { font-size: 1.4rem; }
.eyebrow { font-size: 0.68rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-faint); font-weight: 600; }
.topbar-actions { display: flex; align-items: center; gap: 0.6rem; }
.menu-toggle { display: none; }

.content { padding: 1.6rem; max-width: 1560px; width: 100%; }

/* --- typography helpers --------------------------------------------------- */

.lede { color: var(--ink-muted); max-width: 76ch; font-size: 0.95rem; }
.muted { color: var(--ink-muted); }
.faint { color: var(--ink-faint); }
.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.small { font-size: 0.8rem; }
.tiny { font-size: 0.72rem; }
.strong { font-weight: 600; }
.nowrap { white-space: nowrap; }

.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; margin: 2rem 0 0.9rem; flex-wrap: wrap; }
.section-head:first-child { margin-top: 0; }
.section-head h2 { font-size: 1.05rem; letter-spacing: -0.02em; }
.section-head p { font-size: 0.82rem; color: var(--ink-faint); }

/* --- layout primitives ---------------------------------------------------- */

.grid { display: grid; gap: 1rem; }
.g-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.g-2-1 { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.g-1-2 { grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); }
.g-3-2 { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); }
.stack { display: flex; flex-direction: column; gap: 1rem; }
.stack-sm { display: flex; flex-direction: column; gap: 0.5rem; }
.row { display: flex; gap: 0.6rem; align-items: center; flex-wrap: wrap; }
.row-between { display: flex; gap: 0.75rem; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.spacer { flex: 1; }

@media (max-width: 1180px) {
  .g-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g-6 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .g-3, .g-2-1, .g-1-2, .g-3-2 { grid-template-columns: minmax(0, 1fr); }
}
/* On a phone the title and the range filter fight over one row and the title
   loses, wrapping mid-word. Give the actions their own line instead. */
@media (max-width: 640px) {
  .topbar { flex-wrap: wrap; row-gap: 0.55rem; }
  .topbar-title { flex: 1 1 auto; min-width: 0; }
  .topbar-title h1 { font-size: 1.15rem; }
  .topbar-actions { width: 100%; justify-content: space-between; }
}

@media (max-width: 900px) {
  .sidebar {
    position: fixed; inset: 0 auto 0 0; transform: translateX(-100%);
    transition: transform 0.24s var(--ease-expo); box-shadow: var(--shadow-card);
  }
  .sidebar.is-open { transform: translateX(0); }
  .menu-toggle { display: inline-grid; }
  .content { padding: 1rem; }
  .topbar { padding: 0.75rem 1rem; }
  .g-2, .g-4, .g-6 { grid-template-columns: minmax(0, 1fr); }
}

/* --- card ----------------------------------------------------------------- */

.card {
  background: var(--elevated);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 1.05rem 1.15rem;
  box-shadow: var(--shadow-card);
  min-width: 0;
}
.card.flush { padding: 0; overflow: hidden; }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 0.85rem; margin-bottom: 0.9rem; }
.card-head h3 { font-size: 0.95rem; }
.card-head p { font-size: 0.78rem; color: var(--ink-faint); margin-top: 0.15rem; }
.card-pad { padding: 1.05rem 1.15rem; }

/* --- stat tile ------------------------------------------------------------ */

.tile {
  background: var(--elevated); border: 1px solid var(--line); border-radius: var(--r-lg);
  padding: 0.95rem 1.05rem; display: flex; flex-direction: column; gap: 0.3rem; min-width: 0;
}
.tile-label { font-size: 0.74rem; color: var(--ink-faint); letter-spacing: 0.04em; text-transform: uppercase; font-weight: 600; display: flex; align-items: center; gap: 0.4rem; }
.tile-value { font-family: var(--font-sans); font-size: 1.75rem; font-weight: 600; letter-spacing: -0.035em; line-height: 1.05; }
.tile-value.sm { font-size: 1.3rem; }
.tile-foot { font-size: 0.76rem; color: var(--ink-muted); display: flex; align-items: center; gap: 0.4rem; }
.tile-spark { margin-top: 0.25rem; }

.hero-figure { font-size: 3rem; font-weight: 600; letter-spacing: -0.04em; line-height: 1; }

.delta { display: inline-flex; align-items: center; gap: 0.22rem; font-weight: 600; font-size: 0.78rem; }
.delta-up { color: var(--good-ink); }
.delta-down { color: var(--critical-ink); }
.delta-flat { color: var(--ink-faint); }

/* --- badges & pills ------------------------------------------------------- */

.badge {
  display: inline-flex; align-items: center; gap: 0.35rem;
  font-size: 0.72rem; font-weight: 600; letter-spacing: 0.01em;
  padding: 0.16rem 0.5rem; border-radius: 100px;
  border: 1px solid var(--line-strong); color: var(--ink-muted); background: var(--raised);
  white-space: nowrap;
}
.badge-good { color: var(--good-ink); border-color: color-mix(in srgb, var(--good) 45%, transparent); background: color-mix(in srgb, var(--good) 12%, transparent); }
.badge-warning { color: var(--warning-ink); border-color: color-mix(in srgb, var(--warning) 45%, transparent); background: color-mix(in srgb, var(--warning) 12%, transparent); }
.badge-serious { color: var(--serious-ink); border-color: color-mix(in srgb, var(--serious) 45%, transparent); background: color-mix(in srgb, var(--serious) 12%, transparent); }
.badge-critical { color: var(--critical-ink); border-color: color-mix(in srgb, var(--critical) 45%, transparent); background: color-mix(in srgb, var(--critical) 12%, transparent); }
.badge-brand { color: var(--electric-bright); border-color: color-mix(in srgb, var(--electric) 45%, transparent); background: color-mix(in srgb, var(--electric) 12%, transparent); }

.swatch { width: 10px; height: 10px; border-radius: 3px; flex: 0 0 10px; display: inline-block; }
.line-key { width: 14px; height: 3px; border-radius: 2px; flex: 0 0 14px; display: inline-block; }

/* --- buttons -------------------------------------------------------------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.45rem;
  font-family: var(--font-sans); font-size: 0.85rem; font-weight: 600;
  padding: 0.5rem 0.9rem; border-radius: var(--r-sm);
  border: 1px solid var(--line-strong); background: var(--raised); color: var(--ink);
  cursor: pointer; transition: background 0.15s var(--ease-quart), border-color 0.15s var(--ease-quart), transform 0.1s var(--ease-quart);
  white-space: nowrap;
}
.btn:hover { background: var(--overlay); border-color: rgba(255,255,255,0.24); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-primary { background: var(--signal); color: var(--on-signal); border-color: var(--signal); }
.btn-primary:hover { background: #ffc04d; border-color: #ffc04d; }
.btn-electric { background: var(--electric); color: var(--on-electric); border-color: var(--electric); }
.btn-electric:hover { background: var(--electric-bright); border-color: var(--electric-bright); }
.btn-ghost { background: transparent; border-color: var(--line-strong); color: var(--ink-muted); }
.btn-ghost:hover { color: var(--ink); background: var(--elevated); }
.btn-sm { padding: 0.34rem 0.65rem; font-size: 0.78rem; }
.btn-lg { padding: 0.7rem 1.3rem; font-size: 0.95rem; }
.btn-icon { padding: 0.4rem 0.55rem; }
.btn-block { width: 100%; }

.seg { display: inline-flex; background: var(--elevated); border: 1px solid var(--line-strong); border-radius: var(--r-sm); padding: 2px; gap: 2px; }
.seg-btn {
  font-family: var(--font-sans); font-size: 0.78rem; font-weight: 600; color: var(--ink-faint);
  background: transparent; border: 0; padding: 0.28rem 0.6rem; border-radius: 4px; cursor: pointer;
}
.seg-btn:hover { color: var(--ink); }
.seg-btn.is-active { background: var(--raised); color: var(--ink); }

/* --- forms ---------------------------------------------------------------- */

.field { display: flex; flex-direction: column; gap: 0.3rem; min-width: 0; }
.field-label { font-size: 0.74rem; font-weight: 600; color: var(--ink-muted); letter-spacing: 0.02em; }
.field-hint { font-size: 0.72rem; color: var(--ink-faint); }

.input, select.input, textarea.input {
  font-family: var(--font-sans); font-size: 0.87rem; color: var(--ink);
  background: var(--surface); border: 1px solid var(--line-strong);
  border-radius: var(--r-sm); padding: 0.46rem 0.6rem; width: 100%;
  transition: border-color 0.15s var(--ease-quart);
}
.input:hover { border-color: rgba(255,255,255,0.24); }
.input:focus { border-color: var(--electric); outline-offset: 1px; }
.input.num { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
textarea.input { line-height: 1.55; resize: vertical; min-height: 5rem; }
select.input { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--ink-faint) 50%), linear-gradient(135deg, var(--ink-faint) 50%, transparent 50%); background-position: calc(100% - 15px) 50%, calc(100% - 10px) 50%; background-size: 5px 5px, 5px 5px; background-repeat: no-repeat; padding-right: 1.7rem; }

.form-grid { display: grid; gap: 0.8rem; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }

input[type="range"] { width: 100%; accent-color: var(--electric); }
input[type="checkbox"], input[type="radio"] { accent-color: var(--electric); width: 15px; height: 15px; }

.check { display: flex; align-items: flex-start; gap: 0.5rem; font-size: 0.84rem; cursor: pointer; padding: 0.3rem 0; }
.check input { margin-top: 0.2rem; flex: 0 0 auto; }

.dropzone {
  border: 1px dashed var(--line-strong); border-radius: var(--r-md); padding: 1.6rem 1rem;
  text-align: center; color: var(--ink-muted); background: var(--surface); cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.dropzone:hover, .dropzone.is-over { border-color: var(--electric); background: color-mix(in srgb, var(--electric) 7%, var(--surface)); color: var(--ink); }

/* --- tables --------------------------------------------------------------- */

.table-wrap { overflow-x: auto; border-radius: var(--r-md); }
table.data { width: 100%; border-collapse: collapse; font-size: 0.84rem; }
table.data th, table.data td { padding: 0.5rem 0.7rem; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.data thead th {
  font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.07em; color: var(--ink-faint);
  font-weight: 600; border-bottom: 1px solid var(--line-strong); white-space: nowrap; position: sticky; top: 0; background: var(--elevated); z-index: 1;
}
table.data tbody tr:hover { background: rgba(255,255,255,0.025); }
table.data tbody tr:last-child td { border-bottom: 0; }
table.data td.num, table.data th.num { text-align: right; font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
table.data th.num { font-family: var(--font-sans); }
table.data tfoot td { font-weight: 600; border-top: 1px solid var(--line-strong); }
table.data tr.is-total td { font-weight: 600; background: rgba(255,255,255,0.03); }
table.data.compact th, table.data.compact td { padding: 0.36rem 0.55rem; font-size: 0.8rem; }

/* --- chart card ----------------------------------------------------------- */

.viz {
  background: var(--elevated); border: 1px solid var(--line); border-radius: var(--r-lg);
  padding: 1.05rem 1.15rem 0.9rem; box-shadow: var(--shadow-card); min-width: 0;
  display: flex; flex-direction: column;
}
.viz-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 0.8rem; margin-bottom: 0.15rem; }
.viz-title { font-size: 0.95rem; font-family: var(--font-display); font-weight: 600; letter-spacing: -0.02em; }
.viz-sub { font-size: 0.78rem; color: var(--ink-faint); margin-top: 0.1rem; }
.viz-legend { display: flex; flex-wrap: wrap; gap: 0.75rem; margin: 0.55rem 0 0.4rem; }
.viz-legend-item { display: inline-flex; align-items: center; gap: 0.35rem; font-size: 0.76rem; color: var(--ink-muted); }
.viz-body { position: relative; margin-top: 0.35rem; }
.viz-body svg { display: block; width: 100%; height: auto; overflow: visible; }
.viz-toggle { background: transparent; border: 0; color: var(--ink-faint); font-size: 0.73rem; font-weight: 600; cursor: pointer; padding: 0.2rem 0.35rem; border-radius: 4px; font-family: var(--font-sans); }
.viz-toggle:hover { color: var(--ink); background: var(--raised); }
.viz-table { display: none; margin-top: 0.6rem; max-height: 320px; overflow: auto; }
.viz.show-table .viz-body { display: none; }
.viz.show-table .viz-table { display: block; }
.viz-note { font-size: 0.73rem; color: var(--ink-faint); margin-top: 0.5rem; }

.tooltip {
  position: absolute; pointer-events: none; z-index: 20;
  background: var(--overlay); border: 1px solid var(--line-strong); border-radius: var(--r-sm);
  padding: 0.45rem 0.6rem; font-size: 0.78rem; box-shadow: 0 8px 24px -12px rgba(0,0,0,0.95);
  min-width: 100px; opacity: 0; transition: opacity 0.1s linear; white-space: nowrap;
}
.tooltip.is-visible { opacity: 1; }
.tooltip-title { font-weight: 600; font-size: 0.76rem; margin-bottom: 0.2rem; }
.tooltip-row { display: flex; align-items: center; gap: 0.4rem; justify-content: space-between; color: var(--ink-muted); }
.tooltip-row strong { color: var(--ink); font-family: var(--font-mono); font-variant-numeric: tabular-nums; font-weight: 500; }

.axis-text { font-size: 10.5px; fill: var(--ink-faint); font-family: var(--font-sans); }
.axis-text.num { font-family: var(--font-mono); }
.label-text { font-size: 11px; fill: var(--ink-muted); font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.label-text.strong { fill: var(--ink); font-weight: 500; }

/* --- misc components ------------------------------------------------------ */

.list { display: flex; flex-direction: column; }
.list-item { display: flex; gap: 0.75rem; align-items: flex-start; padding: 0.7rem 0; border-bottom: 1px solid var(--line); }
.list-item:last-child { border-bottom: 0; }
.list-item h4 { font-size: 0.87rem; font-family: var(--font-sans); font-weight: 600; }
.list-item p { font-size: 0.8rem; color: var(--ink-muted); }

.rank { font-family: var(--font-mono); font-size: 0.78rem; color: var(--ink-faint); width: 1.4rem; flex: 0 0 1.4rem; padding-top: 0.12rem; }

.insight {
  border-left: 2px solid var(--electric); background: color-mix(in srgb, var(--electric) 7%, transparent);
  padding: 0.65rem 0.85rem; border-radius: 0 var(--r-sm) var(--r-sm) 0; font-size: 0.86rem;
}
.insight strong { color: var(--ink); }
.insight.is-warning { border-left-color: var(--warning); background: color-mix(in srgb, var(--warning) 8%, transparent); }
.insight.is-critical { border-left-color: var(--critical); background: color-mix(in srgb, var(--critical) 8%, transparent); }
.insight.is-good { border-left-color: var(--good); background: color-mix(in srgb, var(--good) 8%, transparent); }

.meter { height: 6px; border-radius: 100px; background: var(--raised); overflow: hidden; }
.meter-fill { height: 100%; border-radius: 100px; background: var(--electric); }

.kv { display: grid; grid-template-columns: auto 1fr; gap: 0.3rem 1rem; font-size: 0.84rem; }
.kv dt { color: var(--ink-faint); }
.kv dd { text-align: right; font-family: var(--font-mono); font-variant-numeric: tabular-nums; }

.tabs { display: flex; gap: 0.2rem; border-bottom: 1px solid var(--line); margin-bottom: 1rem; overflow-x: auto; }
.tab {
  font-family: var(--font-sans); font-size: 0.85rem; font-weight: 600; color: var(--ink-faint);
  background: transparent; border: 0; border-bottom: 2px solid transparent; padding: 0.5rem 0.75rem; cursor: pointer; white-space: nowrap;
}
.tab:hover { color: var(--ink); }
.tab.is-active { color: var(--ink); border-bottom-color: var(--electric); }

.chips { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.chip {
  font-size: 0.76rem; padding: 0.25rem 0.6rem; border-radius: 100px;
  border: 1px solid var(--line-strong); background: var(--raised); color: var(--ink-muted);
  cursor: pointer; font-family: var(--font-sans);
}
.chip:hover { color: var(--ink); border-color: rgba(255,255,255,0.28); }
.chip.is-on { background: color-mix(in srgb, var(--electric) 18%, transparent); border-color: color-mix(in srgb, var(--electric) 50%, transparent); color: var(--ink); }
.chip-static { cursor: default; }

.copybox { position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); padding: 0.8rem 0.9rem; }
.copybox pre { white-space: pre-wrap; word-break: break-word; font-family: var(--font-mono); font-size: 0.78rem; line-height: 1.6; color: var(--ink); }
.copybox .copy-btn { position: absolute; top: 0.5rem; right: 0.5rem; }
.copybox h5 { font-size: 0.74rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink-faint); margin-bottom: 0.45rem; font-family: var(--font-sans); }

.empty { text-align: center; padding: 2.5rem 1rem; color: var(--ink-faint); }
.empty h3 { font-size: 1rem; color: var(--ink-muted); margin-bottom: 0.35rem; }

/* --- toasts & modal ------------------------------------------------------- */

.toast-stack { position: fixed; bottom: 1rem; right: 1rem; z-index: 100; display: flex; flex-direction: column; gap: 0.5rem; }
.toast {
  background: var(--overlay); border: 1px solid var(--line-strong); border-radius: var(--r-md);
  padding: 0.6rem 0.9rem; font-size: 0.84rem; box-shadow: var(--shadow-card);
  animation: toast-in 0.28s var(--ease-expo); max-width: 340px;
}
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

/* An author-level `display` beats the UA's `[hidden] { display: none }`, so a
   bare `display: grid` here left this full-viewport scrim — 72% black with a
   3px backdrop blur — permanently over the whole app, blurring every page and
   swallowing every click. Keep the hidden state as the default and only lay it
   out when the attribute is actually gone. */
.modal-root { position: fixed; inset: 0; z-index: 90; display: none; place-items: center; padding: 1.5rem; background: rgba(2,3,6,0.72); backdrop-filter: blur(3px); }
.modal-root:not([hidden]) { display: grid; }
.modal {
  background: var(--elevated); border: 1px solid var(--line-strong); border-radius: var(--r-xl);
  width: min(880px, 100%); max-height: 88vh; overflow: auto; box-shadow: 0 30px 80px -30px rgba(0,0,0,1);
}
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; padding: 1.1rem 1.3rem; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--elevated); z-index: 2; }
.modal-body { padding: 1.3rem; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* --- print ---------------------------------------------------------------- */

@media print {
  .sidebar, .topbar, .toast-stack, .no-print, .viz-toggle, .modal-root { display: none !important; }
  .shell { display: block; }
  .content { padding: 0; max-width: none; }
  .card, .viz, .tile { break-inside: avoid; box-shadow: none; border-color: rgba(0,0,0,0.15); }
  .print-only { display: block !important; }
  a { color: inherit; text-decoration: none; }
  .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)); }
}
.print-only { display: none; }
