/* Meridian Science Centre admissions platform
   Design tokens, layout and components. Light and dark themes. */

:root {
  color-scheme: light;

  /* Neutrals and surfaces (warm paper canvas) */
  --bg: #f4f2ea;
  --surface: #ffffff;
  --surface-2: #faf8f2;
  --surface-sunken: #efece2;
  --ink: #1a1c20;
  --ink-2: #575852;
  --muted: #6f6e64;
  --line: #e7e2d5;
  --line-strong: #d8d2c3;

  /* Brand */
  --brand: #215ee0;
  --brand-strong: #1a4bba;
  --brand-soft: #e8eefb;
  --brand-ink: #101d3d;
  --brand-ink-2: #17275a;
  --on-brand: #ffffff;
  --accent: #c47f1a;
  --accent-soft: #f7ecd7;
  --accent-ink: #7a4f10;

  /* Status */
  --good: #0ca30c;
  --good-ink: #036803;
  --good-soft: #e4f6e4;
  --warn: #b8791c;
  --warn-soft: #fbefd8;
  --warn-ink: #8a5510;
  --danger: #d03b3b;
  --danger-ink: #a52020;
  --danger-soft: #fbe6e6;

  /* Chart series (light) */
  --s1: #2a78d6;
  --s2: #1baf7a;
  --s3: #eda100;
  --s4: #4a3aa7;
  --s5: #e34948;
  --chart-grid: #e6e5df;
  --chart-axis: #c3c2b7;
  --chart-ink: #15161a;
  --chart-muted: #6f6e64;
  --seq-lo: #dce9fb;
  --seq-hi: #164a9e;

  /* Shape and depth */
  --r-xs: 7px;
  --r-sm: 10px;
  --r-md: 14px;
  --r-lg: 20px;
  --r-xl: 28px;
  --r-pill: 999px;
  --shadow-sm: 0 1px 2px rgba(16, 18, 30, 0.05), 0 1px 3px rgba(16, 18, 30, 0.04);
  --shadow: 0 2px 6px rgba(16, 18, 30, 0.06), 0 8px 24px rgba(16, 18, 30, 0.07);
  --shadow-lg: 0 12px 32px rgba(16, 18, 30, 0.12), 0 4px 10px rgba(16, 18, 30, 0.06);
  --ring: 0 0 0 3px rgba(42, 95, 214, 0.28);

  /* Rhythm */
  --wrap: 1120px;
  --gap: 20px;
  --header-h: 64px;

  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, "Apple Color Emoji", sans-serif;
  --mono: ui-monospace, "SF Mono", "SFMono-Regular", Menlo, Consolas, "Liberation Mono", monospace;
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0b0c0f;
  --surface: #16171b;
  --surface-2: #1b1c20;
  --surface-sunken: #121317;
  --ink: #f4f4f1;
  --ink-2: #c3c2b7;
  --muted: #8f8e86;
  --line: #2a2b30;
  --line-strong: #3a3b41;

  --brand: #5a8cf0;
  --brand-strong: #7ba4f4;
  --brand-soft: rgba(90, 140, 240, 0.14);
  --brand-ink: #0a1024;
  --brand-ink-2: #131f47;
  --on-brand: #ffffff;
  --accent: #e5a331;
  --accent-soft: rgba(229, 163, 49, 0.14);
  --accent-ink: #e7b455;

  --good: #29b529;
  --good-ink: #7ce07c;
  --good-soft: rgba(12, 163, 12, 0.15);
  --warn: #e0a94a;
  --warn-soft: rgba(224, 169, 74, 0.14);
  --warn-ink: #e6b866;
  --danger: #e66767;
  --danger-ink: #f0a0a0;
  --danger-soft: rgba(230, 103, 103, 0.15);

  --s1: #3987e5;
  --s2: #199e70;
  --s3: #c98500;
  --s4: #9085e9;
  --s5: #e66767;
  --chart-grid: #2c2c2a;
  --chart-axis: #3a3b41;
  --chart-ink: #f4f4f1;
  --chart-muted: #8f8e86;
  --seq-lo: #16263f;
  --seq-hi: #7fb2f4;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow: 0 2px 8px rgba(0, 0, 0, 0.4), 0 12px 30px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.55);
  --ring: 0 0 0 3px rgba(90, 140, 240, 0.4);
}

/* Base */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}
body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.55;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
h1, h2, h3, h4 { margin: 0 0 0.5em; line-height: 1.14; letter-spacing: -0.02em; font-weight: 700; }
h1 { font-size: clamp(2.05rem, 4.6vw, 3.3rem); letter-spacing: -0.032em; }
h2 { font-size: clamp(1.55rem, 2.7vw, 2.1rem); letter-spacing: -0.028em; }
h3 { font-size: 1.2rem; }
p { margin: 0 0 1rem; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
img, svg { max-width: 100%; }
button { font-family: inherit; }
:focus-visible { outline: none; box-shadow: var(--ring); border-radius: var(--r-xs); }
.wrap { width: 100%; max-width: var(--wrap); margin: 0 auto; padding: 0 22px; }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.mono { font-family: var(--mono); }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.tnum { font-variant-numeric: tabular-nums; }

.skip-link {
  position: absolute; left: -999px; top: 0; z-index: 100;
  background: var(--brand); color: #fff; padding: 10px 16px; border-radius: 0 0 var(--r-sm) 0;
}
.skip-link:focus { left: 0; }

/* Header */
.site-header {
  position: sticky; top: 0; z-index: 40;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid var(--line);
}
.header-inner { display: flex; align-items: center; gap: 18px; height: var(--header-h); }
.brand { display: inline-flex; align-items: center; gap: 11px; color: var(--ink); text-decoration: none; }
.brand:hover { text-decoration: none; }
.brand-mark svg { display: block; }
.mark-core { fill: var(--brand); }
.mark-orbit { fill: none; stroke: var(--accent); stroke-width: 1.6; opacity: 0.9; }
[data-theme="dark"] .mark-orbit { stroke: var(--accent); }
.brand-text { display: flex; flex-direction: column; line-height: 1.05; }
.brand-name { font-weight: 720; letter-spacing: -0.02em; font-size: 1.06rem; }
.brand-name.small { font-size: 0.98rem; }
.brand-sub { font-size: 0.66rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); font-weight: 600; }

.main-nav { display: flex; gap: 4px; margin-left: 8px; }
.main-nav a {
  color: var(--ink-2); font-weight: 550; font-size: 0.95rem;
  padding: 8px 13px; border-radius: var(--r-pill); text-decoration: none; white-space: nowrap;
}
.main-nav a:hover { color: var(--ink); background: var(--surface-sunken); }
.main-nav a.active { color: var(--brand); background: var(--brand-soft); }
[data-theme="dark"] .main-nav a.active { color: var(--brand-strong); }

.header-tools { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.icon-btn {
  display: inline-grid; place-items: center; width: 40px; height: 40px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink-2);
  border-radius: var(--r-pill); cursor: pointer; transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.icon-btn:hover { color: var(--ink); border-color: var(--line-strong); background: var(--surface-2); }
.icon-btn svg { stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
#themeToggle .i-sun { display: none; }
#themeToggle .i-moon { display: block; }
[data-theme="dark"] #themeToggle .i-sun { display: block; }
[data-theme="dark"] #themeToggle .i-moon { display: none; }
.nav-toggle { display: none; }

.demo-ribbon {
  background: var(--brand-ink); color: #c9d5f2; font-size: 0.78rem;
}
.demo-ribbon .wrap { padding-top: 6px; padding-bottom: 6px; }
[data-theme="dark"] .demo-ribbon { background: #0c142f; color: #9fb2e0; }

/* Footer */
/* Deep navy footer bookend, dark in both themes to close the page */
.site-footer { background: var(--brand-ink); color: #c4d1ea; margin-top: 82px; }
.footer-inner { display: flex; flex-wrap: wrap; gap: 28px; justify-content: space-between; padding: 46px 22px; }
.footer-col { max-width: 460px; }
.footer-col .brand-name { color: #fff; }
.footer-col p { margin: 8px 0 0; font-size: 0.9rem; color: #93a2c6; }
.footer-links { display: flex; gap: 22px; align-items: center; flex-wrap: wrap; }
.footer-links a { color: #c4d1ea; font-size: 0.92rem; }
.footer-links a:hover { color: #fff; }

/* View shell */
#view { display: block; min-height: 60vh; outline: none; }
.section { padding: 40px 0; }
.section-tight { padding: 26px 0; }
.stack > * + * { margin-top: var(--gap); }
.lede { font-size: 1.12rem; color: var(--ink-2); max-width: 60ch; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-weight: 600; font-size: 0.96rem; line-height: 1;
  padding: 12px 18px; border-radius: var(--r-pill); border: 1px solid transparent;
  cursor: pointer; text-decoration: none; transition: transform 0.06s, background 0.15s, box-shadow 0.15s, border-color 0.15s;
  white-space: nowrap;
}
.btn:hover { text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--brand); color: var(--on-brand); box-shadow: var(--shadow-sm); }
.btn-primary:hover { background: var(--brand-strong); }
.btn-ghost { background: var(--surface); color: var(--ink); border-color: var(--line-strong); }
.btn-ghost:hover { background: var(--surface-2); border-color: var(--muted); }
.btn-subtle { background: var(--surface-sunken); color: var(--ink); }
.btn-subtle:hover { background: var(--brand-soft); color: var(--brand); }
.btn-lg { padding: 15px 24px; font-size: 1.02rem; }
.btn-sm { padding: 10px 15px; font-size: 0.88rem; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }
.btn svg { width: 18px; height: 18px; }
.btn-row { display: flex; flex-wrap: wrap; gap: 12px; }

/* Cards and panels */
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md);
  box-shadow: var(--shadow-sm);
}
.card-pad { padding: 22px; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-sm); padding: 22px; }
.panel-head { display: flex; align-items: baseline; justify-content: space-between; gap: 14px; margin-bottom: 16px; flex-wrap: wrap; }
.panel-head h3 { margin: 0; }
.panel-sub { color: var(--muted); font-size: 0.88rem; margin: 2px 0 0; }

.badge {
  display: inline-flex; align-items: center; gap: 6px; font-size: 0.74rem; font-weight: 650;
  letter-spacing: 0.02em; padding: 4px 10px; border-radius: var(--r-pill);
  background: var(--surface-sunken); color: var(--ink-2); border: 1px solid var(--line);
}
.badge-brand { background: var(--brand-soft); color: var(--brand); border-color: transparent; }
.badge-accent { background: var(--accent-soft); color: var(--accent-ink); border-color: transparent; }
.badge-good { background: var(--good-soft); color: var(--good-ink); border-color: transparent; }
.badge-dot::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.eyebrow { font-size: 0.76rem; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: var(--brand); }
[data-theme="dark"] .eyebrow { color: var(--brand-strong); }

/* Grid helpers */
.grid { display: grid; gap: var(--gap); }
.cols-2 { grid-template-columns: repeat(2, 1fr); }
.cols-3 { grid-template-columns: repeat(3, 1fr); }
.cols-4 { grid-template-columns: repeat(4, 1fr); }
.grid-wide { grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); }
.grid-lead { grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); }
@media (max-width: 900px) { .cols-3, .cols-4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 860px) { .grid-wide, .grid-lead { grid-template-columns: 1fr; } }
@media (max-width: 620px) { .cols-2, .cols-3, .cols-4 { grid-template-columns: 1fr; } }
.table-scroll { overflow-x: auto; }

/* Hero */
.hero {
  position: relative; overflow: hidden; color: #eef2fb;
  background: radial-gradient(120% 120% at 82% -10%, #22357a 0%, rgba(34,53,122,0) 46%),
              radial-gradient(90% 90% at 8% 8%, #1f6fb0 0%, rgba(31,111,176,0) 40%),
              linear-gradient(160deg, #0d1b3e 0%, #111f47 52%, #0b1330 100%);
  border-bottom: 1px solid var(--line);
}
.hero::after {
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: 0.5;
  background-image: radial-gradient(circle at 20% 30%, rgba(255,255,255,0.5) 0 1px, transparent 1.4px),
                    radial-gradient(circle at 70% 60%, rgba(255,255,255,0.4) 0 1px, transparent 1.4px),
                    radial-gradient(circle at 44% 82%, rgba(255,255,255,0.35) 0 1px, transparent 1.4px),
                    radial-gradient(circle at 88% 24%, rgba(255,255,255,0.4) 0 1px, transparent 1.4px);
  background-size: 240px 240px, 300px 300px, 200px 200px, 260px 260px;
}
.hero-inner { position: relative; z-index: 1; display: grid; grid-template-columns: 1.15fr 0.85fr; gap: 40px; align-items: center; padding: 62px 0 66px; }
.hero h1 { color: #fff; }
.hero .lede { color: #c7d2ee; }
.hero-eyebrow { color: #8fb4ff; }
.hero-badges { display: flex; gap: 10px; flex-wrap: wrap; margin: 22px 0 26px; }
.hero-badges .badge { background: rgba(255,255,255,0.09); color: #dbe6ff; border-color: rgba(255,255,255,0.16); }
.hero .btn-ghost { background: rgba(255,255,255,0.08); color: #fff; border-color: rgba(255,255,255,0.28); }
.hero .btn-ghost:hover { background: rgba(255,255,255,0.16); }
@media (max-width: 860px) { .hero-inner { grid-template-columns: 1fr; gap: 30px; padding: 44px 0 48px; } }

/* Hero device: a phone ticket mock */
.hero-device {
  justify-self: center; width: 260px; background: #fff; border-radius: 28px; padding: 16px;
  box-shadow: 0 30px 60px rgba(0,0,0,0.4), 0 0 0 1px rgba(255,255,255,0.08); color: #15161a;
}
.hero-device .hd-top { display: flex; align-items: center; justify-content: space-between; font-size: 0.72rem; color: #86857d; margin-bottom: 12px; }
.hero-device .hd-title { font-weight: 700; font-size: 1.02rem; }
.hero-device .hd-qr { background: #f6f6f2; border-radius: 14px; padding: 14px; display: grid; place-items: center; }
.hero-device .hd-qr svg { width: 150px; height: 150px; }
.hero-device .hd-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 12px; margin-top: 14px; font-size: 0.78rem; }
.hero-device .hd-meta .k { color: #6f6e64; }
.hero-device .hd-meta .v { font-weight: 650; }

/* Stat tiles */
.stat {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md);
  padding: 18px 18px 16px; box-shadow: var(--shadow-sm); position: relative;
}
.stat .stat-label { color: var(--muted); font-size: 0.82rem; font-weight: 600; display: flex; align-items: center; gap: 7px; }
.stat .stat-value { font-size: 1.9rem; font-weight: 700; letter-spacing: -0.02em; margin-top: 6px; line-height: 1.05; }
.stat .stat-value .unit { font-size: 0.9rem; color: var(--muted); font-weight: 600; margin-left: 3px; }
.stat .stat-foot { margin-top: 8px; font-size: 0.82rem; color: var(--ink-2); display: flex; align-items: center; gap: 6px; }
.delta { display: inline-flex; align-items: center; gap: 3px; font-weight: 650; }
.delta.up { color: var(--good-ink); }
.delta.down { color: var(--danger-ink); }
.stat-ico { color: var(--brand); display: inline-grid; place-items: center; }
[data-theme="dark"] .stat-ico { color: var(--brand-strong); }

/* Feature cards */
.feature { padding: 24px; border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-sm); }
.feature .fx { width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); margin-bottom: 14px; }
[data-theme="dark"] .feature .fx { color: var(--brand-strong); }
.feature h3 { margin-bottom: 6px; }
.feature p { margin: 0; color: var(--ink-2); font-size: 0.95rem; }
.feature .fx svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }

/* Forms */
.field { display: block; margin-bottom: 16px; }
.field > label { display: block; font-weight: 600; font-size: 0.9rem; margin-bottom: 7px; }
.field .hint { color: var(--muted); font-size: 0.82rem; font-weight: 400; }
.input, .select, textarea.input {
  width: 100%; padding: 11px 13px; font-size: 0.98rem; font-family: inherit; color: var(--ink);
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--r-sm);
  transition: border-color 0.15s, box-shadow 0.15s; appearance: none;
}
.input:focus, .select:focus, textarea.input:focus { border-color: var(--brand); box-shadow: var(--ring); outline: none; }
.select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%2386857d' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 11px center; padding-right: 38px;
}
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 560px) { .form-row { grid-template-columns: 1fr; } }
.seg { display: inline-flex; background: var(--surface-sunken); border: 1px solid var(--line); border-radius: var(--r-pill); padding: 4px; gap: 4px; }
.seg button {
  border: none; background: transparent; color: var(--ink-2); font-weight: 600; font-size: 0.9rem;
  padding: 8px 16px; border-radius: var(--r-pill); cursor: pointer;
}
.seg button.on { background: var(--surface); color: var(--brand); box-shadow: var(--shadow-sm); }
[data-theme="dark"] .seg button.on { background: var(--brand-soft); }

/* Quantity stepper */
.stepper { display: inline-flex; align-items: center; border: 1px solid var(--line-strong); border-radius: var(--r-pill); overflow: hidden; }
.stepper button {
  width: 42px; height: 42px; border: none; background: var(--surface); color: var(--ink); font-size: 1.2rem; cursor: pointer;
  display: grid; place-items: center;
}
.stepper button:hover { background: var(--brand-soft); color: var(--brand); }
.stepper button[disabled] { color: var(--muted); cursor: not-allowed; background: var(--surface); }
.stepper .qty { min-width: 40px; text-align: center; font-weight: 650; font-variant-numeric: tabular-nums; }

/* Ticket type rows */
.tt-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 15px 0; border-bottom: 1px solid var(--line); }
.tt-row:last-child { border-bottom: none; }
.tt-info .name { font-weight: 620; }
.tt-info .desc { color: var(--muted); font-size: 0.85rem; }
.tt-price { font-weight: 650; margin-right: 4px; white-space: nowrap; }

/* Session / slot picker */
.slot-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: 10px; }
.slot {
  text-align: left; border: 1px solid var(--line-strong); background: var(--surface); border-radius: var(--r-sm);
  padding: 11px 13px; cursor: pointer; transition: border-color 0.12s, background 0.12s;
}
.slot:hover { border-color: var(--brand); }
.slot.on { border-color: var(--brand); background: var(--brand-soft); box-shadow: inset 0 0 0 1px var(--brand); }
.slot .t { font-weight: 680; font-variant-numeric: tabular-nums; }
.slot .s { font-size: 0.78rem; color: var(--muted); }
.slot.full { opacity: 0.55; cursor: not-allowed; }
.slot .s.low { color: var(--warn-ink); font-weight: 600; }

/* Summary rail */
.summary { position: sticky; top: calc(var(--header-h) + 18px); }
.summary .line { display: flex; justify-content: space-between; gap: 10px; padding: 7px 0; font-size: 0.94rem; }
.summary .line .qtc { color: var(--ink-2); }
.summary .total { display: flex; justify-content: space-between; align-items: baseline; border-top: 1px solid var(--line); margin-top: 8px; padding-top: 12px; font-weight: 720; font-size: 1.2rem; }
.summary .empty { color: var(--muted); font-size: 0.92rem; padding: 8px 0 14px; }

/* Layout: two column booking */
.split { display: grid; grid-template-columns: 1.55fr 0.95fr; gap: 26px; align-items: start; }
@media (max-width: 900px) { .split { grid-template-columns: 1fr; } }

/* Ticket / confirmation */
.ticket {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden;
  box-shadow: var(--shadow); position: relative;
}
.ticket .t-head { background: var(--brand-ink); color: #eaf0fe; padding: 18px 22px; display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.ticket .t-head .t-venue { font-weight: 700; letter-spacing: -0.01em; }
.ticket .t-head .t-kind { font-size: 0.76rem; text-transform: uppercase; letter-spacing: 0.1em; color: #9fb2e0; }
.ticket .t-body { display: grid; grid-template-columns: 176px 1fr; gap: 22px; padding: 22px; align-items: center; }
@media (max-width: 520px) { .ticket .t-body { grid-template-columns: 1fr; justify-items: center; text-align: center; } }
.qr-box { background: #fff; border-radius: var(--r-md); padding: 12px; border: 1px solid var(--line); }
.qr-box svg { display: block; width: 152px; height: 152px; }
.qr-box.lg svg { width: 210px; height: 210px; }
.ticket .t-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 20px; }
.ticket .t-meta .k { color: var(--muted); font-size: 0.78rem; }
.ticket .t-meta .v { font-weight: 650; }
.ticket .t-perf { border-top: 1px dashed var(--line-strong); padding: 12px 22px; display: flex; justify-content: space-between; font-size: 0.82rem; color: var(--ink-2); }
.ticket-code { font-family: var(--mono); letter-spacing: 0.06em; font-weight: 600; }
.notch { position: absolute; width: 22px; height: 22px; border-radius: 50%; background: var(--bg); border: 1px solid var(--line); }

/* Scanner */
.scan-stage {
  position: relative; aspect-ratio: 4 / 3; width: 100%; background: #05070d; border-radius: var(--r-lg);
  overflow: hidden; display: grid; place-items: center; border: 1px solid var(--line);
}
.scan-stage video { width: 100%; height: 100%; object-fit: cover; }
.scan-stage canvas { display: none; }
.scan-reticle { position: absolute; inset: 0; pointer-events: none; display: grid; place-items: center; }
.scan-reticle .frame { width: 62%; max-width: 280px; aspect-ratio: 1; border-radius: 22px; box-shadow: 0 0 0 3px rgba(255,255,255,0.9), 0 0 0 2000px rgba(3,5,12,0.45); }
.scan-reticle .laser { position: absolute; left: 19%; right: 19%; height: 2px; background: linear-gradient(90deg, transparent, var(--brand), transparent); animation: laser 2.4s ease-in-out infinite; }
@keyframes laser { 0%,100% { top: 22%; } 50% { top: 78%; } }
.scan-idle { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 12px; color: #c7cede; text-align: center; padding: 24px; }
.scan-idle svg { width: 46px; height: 46px; stroke: #7f8bb0; fill: none; stroke-width: 1.6; }
.scan-result { border-radius: var(--r-lg); padding: 18px 20px; border: 1px solid var(--line); background: var(--surface); display: flex; gap: 14px; align-items: flex-start; }
.scan-result .rico { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; flex: none; }
.scan-result .rico svg { width: 26px; height: 26px; stroke: #fff; fill: none; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.scan-result.ok { border-color: var(--good); background: var(--good-soft); }
.scan-result.ok .rico { background: var(--good); }
.scan-result.warn { border-color: var(--warn); background: var(--warn-soft); }
.scan-result.warn .rico { background: var(--warn); }
.scan-result.bad { border-color: var(--danger); background: var(--danger-soft); }
.scan-result.bad .rico { background: var(--danger); }
.scan-result .rtitle { font-weight: 720; font-size: 1.05rem; }
.scan-result .rmeta { font-size: 0.9rem; color: var(--ink-2); margin-top: 3px; }
.scan-placeholder { color: var(--muted); padding: 22px; text-align: center; border: 1px dashed var(--line-strong); border-radius: var(--r-lg); }

.feed { list-style: none; margin: 0; padding: 0; }
.feed li { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.feed li:last-child { border-bottom: none; }
.feed .fdot { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.feed .fmain { flex: 1; min-width: 0; }
.feed .fname { font-weight: 600; }
.feed .fsub { font-size: 0.82rem; color: var(--muted); }
.feed .ftime { font-variant-numeric: tabular-nums; color: var(--ink-2); font-size: 0.86rem; white-space: nowrap; }

/* Tables */
.table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
.table th, .table td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.table th { color: var(--muted); font-weight: 600; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.04em; }
.table td.num, .table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.table tbody tr:hover { background: var(--surface-sunken); }
.bar-cell { position: relative; }
.bar-cell .bar { height: 8px; border-radius: 4px; background: var(--s1); }
.bar-cell .track { background: var(--surface-sunken); border-radius: 4px; overflow: hidden; }

/* Charts */
.chart { width: 100%; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart .grid-line { stroke: var(--chart-grid); stroke-width: 1; }
.chart .axis-line { stroke: var(--chart-axis); stroke-width: 1; }
.chart .tick { fill: var(--chart-muted); font-size: 11px; }
.chart .axis-title { fill: var(--chart-muted); font-size: 11px; font-weight: 600; }
.chart .val-label { fill: var(--chart-ink); font-size: 11px; font-weight: 600; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 8px; }
.legend .lg { display: inline-flex; align-items: center; gap: 6px; font-size: 0.82rem; color: var(--ink-2); }
.legend .sw { width: 11px; height: 11px; border-radius: 3px; flex: none; }
.range-tabs { display: inline-flex; gap: 2px; background: var(--surface-sunken); border: 1px solid var(--line); border-radius: var(--r-pill); padding: 3px; }
.range-tabs button { border: none; background: transparent; color: var(--ink-2); font-weight: 600; font-size: 0.84rem; padding: 9px 15px; border-radius: var(--r-pill); cursor: pointer; }
.range-tabs button.on { background: var(--surface); color: var(--brand); box-shadow: var(--shadow-sm); }

.chart-tip {
  position: fixed; z-index: 60; pointer-events: none; background: var(--ink); color: var(--surface);
  padding: 8px 11px; border-radius: var(--r-sm); font-size: 0.82rem; box-shadow: var(--shadow-lg);
  transform: translate(-50%, calc(-100% - 12px)); white-space: nowrap; opacity: 0; transition: opacity 0.1s;
}
.chart-tip.show { opacity: 1; }
.chart-tip .tk { opacity: 0.7; }
.chart-tip .tv { font-weight: 700; font-variant-numeric: tabular-nums; }
[data-theme="dark"] .chart-tip { background: #2c2c2a; color: #fff; }

.hm-cell { stroke: var(--surface); stroke-width: 2; rx: 3; cursor: pointer; }
.heat-scale { display: inline-flex; align-items: center; gap: 8px; font-size: 0.8rem; color: var(--muted); }
.heat-scale .ramp { width: 120px; height: 10px; border-radius: 5px; }

/* Progress meter */
.meter { height: 9px; background: var(--surface-sunken); border-radius: 5px; overflow: hidden; border: 1px solid var(--line); }
.meter > span { display: block; height: 100%; background: var(--s1); border-radius: 5px; }
.meter.warn > span { background: var(--accent); }

/* Toasts */
.toaster { position: fixed; right: 18px; bottom: 18px; z-index: 80; display: flex; flex-direction: column; gap: 10px; max-width: min(92vw, 360px); }
.toast {
  background: var(--surface); border: 1px solid var(--line); border-left: 3px solid var(--brand);
  border-radius: var(--r-sm); box-shadow: var(--shadow-lg); padding: 12px 14px; display: flex; gap: 10px; align-items: flex-start;
  animation: toast-in 0.2s ease;
}
.toast.good { border-left-color: var(--good); }
.toast.bad { border-left-color: var(--danger); }
.toast .tmsg { font-size: 0.9rem; }
.toast .tmsg strong { display: block; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* Callout */
.callout { display: flex; gap: 12px; padding: 14px 16px; border-radius: var(--r-md); background: var(--brand-soft); border: 1px solid transparent; font-size: 0.92rem; }
.callout svg { flex: none; width: 20px; height: 20px; stroke: var(--brand); fill: none; stroke-width: 2; margin-top: 1px; }
.callout.accent { background: var(--accent-soft); }
.callout.accent svg { stroke: var(--accent); }

/* Misc */
.divider { height: 1px; background: var(--line); border: none; margin: 26px 0; }
.kicker-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.dl-inline { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; font-size: 0.92rem; }
.dl-inline dt { color: var(--muted); }
.dl-inline dd { margin: 0; font-weight: 600; }
.empty-state { text-align: center; padding: 48px 20px; color: var(--muted); }
.empty-state svg { width: 40px; height: 40px; stroke: var(--muted); fill: none; stroke-width: 1.6; margin-bottom: 10px; }

/* Mobile nav */
@media (max-width: 780px) {
  .nav-toggle { display: inline-grid; }
  .main-nav {
    position: absolute; top: var(--header-h); left: 0; right: 0; flex-direction: column; gap: 2px;
    background: var(--surface); border-bottom: 1px solid var(--line); padding: 10px 14px 16px; margin: 0;
    box-shadow: var(--shadow); display: none;
  }
  .main-nav.open { display: flex; }
  .main-nav a { padding: 12px 14px; border-radius: var(--r-sm); }
  .header-inner { position: relative; }
}

/* Print: keep the tickets, drop the chrome */
@media print {
  .site-header, .site-footer, .demo-ribbon, .toaster, .skip-link, .btn-row, .callout { display: none !important; }
  body { background: #fff; color: #000; }
  .section { padding: 0; }
  .panel, .card { box-shadow: none; }
  .ticket { box-shadow: none; break-inside: avoid; page-break-inside: avoid; }
  .grid.cols-2 { grid-template-columns: 1fr 1fr; }
}
