/* ============================================================
   Jabra Plus Art of Possible — shared.css
   Design system: inverted-tile + aurora gradient mesh + warm
   masculine accent (lime → amber → burnt orange).
   Tokens, components, and base reset live here. Every page
   inherits the look automatically through CSS custom props.
   ============================================================ */

@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;500;600;700&family=Instrument+Serif:ital@0;1&display=swap");

/* ============================================================
   TOKENS — DARK MODE (default)
   Deep aubergine page; tiles RAISED into pale lavender.
   The contrast is reversed from typical "everything dark" UIs —
   content cards feel like lit panels floating over a night sky.
   ============================================================ */
:root {
  --bg:        oklch(0.16 0.045 295);
  --bg-2:      oklch(0.13 0.055 280);
  --bg-3:      oklch(0.19 0.040 320);

  --surface:   oklch(0.86 0.025 280);
  --surface2:  oklch(0.92 0.018 280);
  --surface3:  oklch(0.78 0.030 280);
  --panel:     var(--surface);

  --aurora-1:  oklch(0.78 0.20 80);
  --aurora-2:  oklch(0.74 0.16 195);
  --aurora-3:  oklch(0.70 0.20 145);
  --aurora-4:  oklch(0.84 0.20 110);
  --aurora-5:  oklch(0.72 0.22 45);

  --border:    oklch(0 0 0 / 0.06);
  --border2:   oklch(0 0 0 / 0.10);
  --border-on-bg: oklch(1 0 0 / 0.10);

  --text:      oklch(0.18 0.030 280);
  --text2:     oklch(0.42 0.025 280);
  --text3:     oklch(0.60 0.020 280);
  --muted:     var(--text2);

  --text-on-bg:  oklch(0.96 0.015 280);
  --text-on-bg2: oklch(0.78 0.020 280);
  --text-on-bg3: oklch(0.62 0.022 280);

  --accent:     oklch(0.74 0.18 75);
  --accent-2:   oklch(0.70 0.20 145);
  --accent-3:   oklch(0.72 0.22 45);
  --accent-fg:  oklch(0.20 0.05 75);
  --accent-d:   oklch(0.74 0.18 75 / 0.14);
  --accent-dim: oklch(0.74 0.18 75 / 0.24);
  --accent-grad: linear-gradient(135deg,
                  oklch(0.78 0.18 110),
                  oklch(0.74 0.20 75) 50%,
                  oklch(0.70 0.22 40));

  --green:     oklch(0.72 0.20 152);
  --red:       oklch(0.66 0.24 22);
  --amber:     oklch(0.80 0.18 75);
  --blue:      oklch(0.70 0.18 240);
  --purple:    oklch(0.68 0.22 300);
  --pink:      oklch(0.74 0.22 340);
  --teal:      oklch(0.74 0.16 195);

  --green-dim: oklch(0.72 0.20 152 / 0.16);
  --red-dim:   oklch(0.66 0.24 22  / 0.16);
  --amber-dim: oklch(0.80 0.18 75  / 0.18);
  --blue-dim:  oklch(0.70 0.18 240 / 0.16);
  --purple-dim:oklch(0.68 0.22 300 / 0.16);
  --pink-dim:  oklch(0.74 0.22 340 / 0.16);

  --green-ink: oklch(0.42 0.20 152);
  --red-ink:   oklch(0.46 0.24 22);
  --amber-ink: oklch(0.50 0.18 75);
  --blue-ink:  oklch(0.42 0.18 240);
  --purple-ink:oklch(0.42 0.22 300);
  --pink-ink:  oklch(0.46 0.22 340);

  --radius:    16px;
  --radius-sm: 10px;
  --radius-xs: 8px;
  --radius-lg: 24px;
  --radius-xl: 32px;

  --shadow:    0 1px 0 oklch(1 0 0 / 0.6) inset,
               0 0 0 1px oklch(0 0 0 / 0.04),
               0 1px 2px oklch(0 0 0 / 0.20),
               0 12px 32px -16px oklch(0 0 0 / 0.55),
               0 2px 6px oklch(from var(--accent) l c h / 0.04);
  --shadow-lg: 0 1px 0 oklch(1 0 0 / 0.7) inset,
               0 24px 60px -20px oklch(0 0 0 / 0.6),
               0 8px 24px -8px oklch(from var(--accent) l c h / 0.08);
  --shadow-pop: 0 8px 28px -6px oklch(0 0 0 / 0.5),
                0 0 40px -8px oklch(from var(--accent) l c h / 0.35);
  --shadow-glow: 0 0 0 1px oklch(from var(--accent) l c h / 0.4),
                 0 0 32px -4px oklch(from var(--accent) l c h / 0.5);

  --font-sans:    "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-display: "Instrument Serif", "Inter", ui-sans-serif;
  --font-mono:    "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;

  --ease:      cubic-bezier(0.2, 0.8, 0.2, 1);
  --ease-out:  cubic-bezier(0.16, 1, 0.3, 1);
  --dur-fast:  120ms;
  --dur:       240ms;
  --dur-slow:  420ms;
}

/* ============================================================
   LIGHT MODE — warm cream sky, DEEP MOODY tiles
   ============================================================ */
body.light {
  --bg:        oklch(0.97 0.020 90);
  --bg-2:      oklch(0.94 0.035 65);
  --bg-3:      oklch(0.96 0.028 130);

  --surface:   oklch(0.26 0.040 235);
  --surface2:  oklch(0.32 0.038 235);
  --surface3:  oklch(0.38 0.035 235);
  --panel:     var(--surface);

  --aurora-1:  oklch(0.70 0.22 80);
  --aurora-2:  oklch(0.66 0.18 195);
  --aurora-3:  oklch(0.62 0.22 145);
  --aurora-4:  oklch(0.78 0.20 110);
  --aurora-5:  oklch(0.66 0.24 45);

  --border:    oklch(1 0 0 / 0.08);
  --border2:   oklch(1 0 0 / 0.14);
  --border-on-bg: oklch(0 0 0 / 0.08);

  --text:      oklch(0.96 0.020 280);
  --text2:     oklch(0.80 0.020 280);
  --text3:     oklch(0.73 0.020 280);

  --text-on-bg:  oklch(0.22 0.030 295);
  --text-on-bg2: oklch(0.42 0.025 295);
  --text-on-bg3: oklch(0.58 0.022 295);

  --accent:    oklch(0.62 0.20 70);
  --accent-2:  oklch(0.58 0.18 145);
  --accent-3:  oklch(0.62 0.22 40);
  --accent-fg: oklch(0.99 0 0);
  --accent-d:  oklch(0.62 0.20 70 / 0.14);
  --accent-dim:oklch(0.62 0.20 70 / 0.24);
  --accent-grad: linear-gradient(135deg,
                  oklch(0.66 0.20 110),
                  oklch(0.62 0.22 70) 50%,
                  oklch(0.58 0.24 40));

  --green-ink: oklch(0.84 0.18 152);
  --red-ink:   oklch(0.78 0.22 22);
  --amber-ink: oklch(0.86 0.18 75);
  --blue-ink:  oklch(0.78 0.18 240);
  --purple-ink:oklch(0.78 0.22 300);
  --pink-ink:  oklch(0.82 0.22 340);

  --shadow:    0 1px 0 oklch(1 0 0 / 0.10) inset,
               0 0 0 1px oklch(1 0 0 / 0.06),
               0 1px 2px oklch(0 0 0 / 0.10),
               0 14px 36px -16px oklch(from var(--surface) l c h / 0.5),
               0 2px 8px oklch(from var(--accent) l c h / 0.10);
  --shadow-lg: 0 1px 0 oklch(1 0 0 / 0.10) inset,
               0 28px 70px -20px oklch(from var(--surface) l c h / 0.55),
               0 12px 30px -8px oklch(from var(--accent) l c h / 0.18);
  --shadow-pop: 0 12px 36px -6px oklch(from var(--surface) l c h / 0.4),
                0 0 50px -8px oklch(from var(--accent) l c h / 0.35);
  --shadow-glow: 0 0 0 1.5px oklch(from var(--accent) l c h / 0.5),
                 0 0 40px -4px oklch(from var(--accent) l c h / 0.45);
}

/* ============================================================
   COLORBLIND MODE — deuteranopia-safe blue/orange
   Keeps dark sky / light tile vibe; swaps green/red and accent.
   ============================================================ */
body.colorblind {
  --accent:    oklch(0.62 0.22 245);
  --accent-2:  oklch(0.78 0.18 195);
  --accent-3:  oklch(0.74 0.20 60);
  --accent-d:  oklch(0.62 0.22 245 / 0.14);
  --accent-dim:oklch(0.62 0.22 245 / 0.22);
  --accent-grad: linear-gradient(135deg,
                  oklch(0.62 0.22 245),
                  oklch(0.70 0.20 200) 60%,
                  oklch(0.78 0.18 80));

  --green:     oklch(0.74 0.16 230);
  --red:       oklch(0.74 0.18 60);
  --green-dim: oklch(0.74 0.16 230 / 0.16);
  --red-dim:   oklch(0.74 0.18 60  / 0.16);
  --green-ink: oklch(0.42 0.16 230);
  --red-ink:   oklch(0.50 0.18 60);

  --aurora-1:  oklch(0.66 0.22 245);
  --aurora-3:  oklch(0.74 0.20 60);
}

/* ============================================================
   BASE RESET
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  background: var(--bg);
  color: var(--text-on-bg);
  background-image:
    radial-gradient(1100px 800px at 88% -8%,  oklch(from var(--aurora-1) l c h / 0.55), transparent 55%),
    radial-gradient(900px 700px  at -10% 18%, oklch(from var(--aurora-2) l c h / 0.40), transparent 50%),
    radial-gradient(800px 700px  at 50% 110%, oklch(from var(--aurora-3) l c h / 0.45), transparent 55%),
    radial-gradient(700px 600px  at 110% 80%, oklch(from var(--aurora-5) l c h / 0.30), transparent 60%),
    radial-gradient(600px 500px  at 20% 90%,  oklch(from var(--aurora-4) l c h / 0.22), transparent 60%);
  background-attachment: fixed;
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-feature-settings: "ss01", "cv11";
  min-height: 100vh;
}

body.light {
  background-image:
    radial-gradient(1100px 800px at 88% -8%,  oklch(from var(--aurora-3) l c h / 0.45), transparent 55%),
    radial-gradient(900px 700px  at -10% 18%, oklch(from var(--aurora-4) l c h / 0.55), transparent 50%),
    radial-gradient(800px 700px  at 50% 110%, oklch(from var(--aurora-5) l c h / 0.45), transparent 55%),
    radial-gradient(700px 600px  at 110% 80%, oklch(from var(--aurora-1) l c h / 0.30), transparent 60%);
}

/* ============================================================
   TYPE
   ============================================================ */
.h-display { font-size: 32px; font-weight: 700; letter-spacing: -0.025em; line-height: 1.1; }
.h-display.serif { font-family: var(--font-display); font-style: italic; font-weight: 400; font-size: 38px; letter-spacing: -0.02em; }
.h-title   { font-size: 20px; font-weight: 600; letter-spacing: -0.018em; line-height: 1.2; }
.h-section { font-size: 14px; font-weight: 600; letter-spacing: -0.005em; }
.t-body    { font-size: 14px; }
.t-sec     { font-size: 13px; opacity: 0.78; }
.t-meta    { font-family: var(--font-mono); font-size: 11px; opacity: 0.62; }
.t-label   { font-family: var(--font-mono); font-size: 10px; font-weight: 600; opacity: 0.6; text-transform: uppercase; letter-spacing: 0.1em; }

/* ============================================================
   HEADER (sticky two-row, sits on --bg)
   ============================================================ */
.header {
  position: sticky; top: 0; z-index: 100;
  background: oklch(from var(--bg) l c h / 0.7);
  backdrop-filter: saturate(140%) blur(20px);
  -webkit-backdrop-filter: saturate(140%) blur(20px);
  border-bottom: 1px solid var(--border-on-bg);
  color: var(--text-on-bg);
  display: flex; flex-direction: column;
}
.header-row1 {
  display: flex; align-items: center; gap: 14px;
  padding: 0 24px; height: 60px;
}
.header-row2 {
  display: flex; align-items: center; justify-content: flex-end;
  gap: 8px; padding: 10px 24px;
  border-top: 1px solid var(--border-on-bg);
}
.header-logo {
  font-family: var(--font-mono); font-size: 10px; font-weight: 700;
  background: var(--accent-grad);
  color: oklch(0.99 0 0);
  padding: 5px 10px; border-radius: 8px;
  letter-spacing: 0.08em;
  box-shadow:
    0 1px 0 oklch(1 0 0 / 0.3) inset,
    0 4px 14px -4px oklch(from var(--accent) l c h / 0.6);
}
.header-title {
  font-size: 16px; font-weight: 600; letter-spacing: -0.012em;
  color: var(--text-on-bg);
}
.header-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }

/* ============================================================
   CARDS / PANELS
   ============================================================ */
.card {
  position: relative;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  transition: transform var(--dur) var(--ease-out),
              box-shadow var(--dur) var(--ease-out);
}
.card::before {
  content: ""; position: absolute; inset: 0;
  border-radius: inherit; pointer-events: none;
  background: linear-gradient(180deg, oklch(1 0 0 / 0.5), transparent 30%);
  mix-blend-mode: overlay;
  opacity: 0.6;
}
.card.interactive { cursor: pointer; }
.card.interactive:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-pop);
}
.card.interactive:active { transform: translateY(-1px); }
.card.glow {
  background: var(--accent-grad);
  color: oklch(0.99 0 0);
}
.card.glow .t-body, .card.glow .t-sec, .card.glow .t-meta, .card.glow .t-label {
  color: oklch(0.99 0 0);
}

.panel {
  position: relative;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.panel::before {
  content: ""; position: absolute; inset: 0;
  border-radius: inherit; pointer-events: none;
  background: linear-gradient(180deg, oklch(1 0 0 / 0.4), transparent 25%);
  mix-blend-mode: overlay; opacity: 0.5;
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 7px; white-space: nowrap;
  font-family: var(--font-sans); font-size: 13px; font-weight: 500;
  border-radius: var(--radius-sm); padding: 9px 15px;
  cursor: pointer; user-select: none; text-decoration: none;
  border: 1px solid transparent; background: transparent;
  color: inherit;
  transition: background var(--dur-fast) var(--ease),
              color var(--dur-fast) var(--ease),
              border-color var(--dur-fast) var(--ease),
              transform var(--dur-fast) var(--ease),
              box-shadow var(--dur-fast) var(--ease);
}
.btn:active { transform: scale(0.97); }

.btn-primary {
  background: var(--accent-grad);
  color: oklch(0.99 0 0);
  font-weight: 600;
  box-shadow:
    0 1px 0 oklch(1 0 0 / 0.35) inset,
    0 -1px 0 oklch(0 0 0 / 0.25) inset,
    0 6px 18px -4px oklch(from var(--accent) l c h / 0.55),
    0 0 0 1px oklch(from var(--accent) l c h / 0.5);
}
.btn-primary:hover {
  filter: brightness(1.1) saturate(1.1);
  transform: translateY(-1px);
  box-shadow:
    0 1px 0 oklch(1 0 0 / 0.4) inset,
    0 10px 28px -4px oklch(from var(--accent) l c h / 0.75),
    0 0 0 1px oklch(from var(--accent) l c h / 0.6);
}

.btn-secondary {
  background: oklch(from var(--surface) calc(l - 0.05) c h);
  border-color: var(--border);
  color: var(--text);
}
body.light .btn-secondary {
  background: oklch(from var(--surface) calc(l + 0.06) c h);
}
.btn-secondary:hover {
  background: oklch(from var(--surface) calc(l - 0.10) c h);
}
body.light .btn-secondary:hover {
  background: oklch(from var(--surface) calc(l + 0.10) c h);
}

/* nav button — sits on --bg (used in headers) */
.btn-nav {
  background: oklch(from var(--bg) calc(l + 0.08) c h / 0.4);
  border: 1px solid var(--border-on-bg);
  color: var(--text-on-bg2);
  font-family: var(--font-sans); font-size: 12px; font-weight: 500;
  padding: 7px 13px;
  border-radius: var(--radius-sm);
  backdrop-filter: blur(8px);
  cursor: pointer; text-decoration: none; white-space: nowrap;
  display: inline-flex; align-items: center; gap: 6px;
  transition: all var(--dur-fast) var(--ease);
}
body.light .btn-nav {
  background: oklch(from var(--bg) calc(l - 0.06) c h / 0.5);
}
.btn-nav:hover {
  color: var(--text-on-bg);
  border-color: oklch(from var(--accent) l c h / 0.4);
  background: oklch(from var(--accent) l c h / 0.10);
}
.btn-nav.active {
  color: oklch(0.99 0 0);
  background: var(--accent-grad);
  border-color: transparent;
  box-shadow:
    0 1px 0 oklch(1 0 0 / 0.3) inset,
    0 4px 14px -4px oklch(from var(--accent) l c h / 0.5);
}

.btn-sm {
  background: transparent;
  border: 1px solid var(--border-on-bg);
  color: var(--text-on-bg2);
  font-family: var(--font-mono); font-size: 11px;
  padding: 5px 10px; border-radius: var(--radius-xs);
  cursor: pointer; white-space: nowrap;
  transition: all var(--dur-fast) var(--ease);
}
.btn-sm:hover {
  color: var(--text-on-bg);
  border-color: oklch(from var(--accent) l c h / 0.4);
  background: oklch(from var(--accent) l c h / 0.10);
}

.btn-icon {
  width: 34px; height: 34px; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  background: oklch(from var(--bg) calc(l + 0.08) c h / 0.4);
  border: 1px solid var(--border-on-bg);
  border-radius: var(--radius-sm);
  color: var(--text-on-bg2); cursor: pointer;
  backdrop-filter: blur(8px);
  transition: all var(--dur-fast) var(--ease);
}
body.light .btn-icon {
  background: oklch(from var(--bg) calc(l - 0.06) c h / 0.5);
}
.btn-icon:hover {
  color: var(--text-on-bg);
  border-color: oklch(from var(--accent) l c h / 0.4);
  background: oklch(from var(--accent) l c h / 0.12);
}

/* ============================================================
   INPUTS — designed to live inside light tiles
   ============================================================ */
.input, input[type="text"], input[type="email"], input[type="url"],
input[type="password"], input[type="search"], input[type="number"],
textarea, select {
  width: 100%;
  background: oklch(from var(--surface) calc(l - 0.06) c h);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 13px;
  color: var(--text);
  font-family: var(--font-sans); font-size: 13px;
  outline: none;
  transition: border-color var(--dur-fast) var(--ease),
              background var(--dur-fast) var(--ease),
              box-shadow var(--dur-fast) var(--ease);
}
body.light .input,
body.light input[type="text"], body.light input[type="email"],
body.light input[type="url"], body.light input[type="password"],
body.light input[type="search"], body.light input[type="number"],
body.light textarea, body.light select {
  background: oklch(from var(--surface) calc(l + 0.08) c h);
}
.input:focus, input:focus, textarea:focus, select:focus {
  border-color: oklch(from var(--accent) l c h / 0.5);
  box-shadow: 0 0 0 3px var(--accent-d);
}
.input::placeholder, input::placeholder, textarea::placeholder { color: var(--text3); }

/* ============================================================
   PILLS / TAGS
   ============================================================ */
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--font-mono); font-size: 11px; font-weight: 600;
  padding: 4px 10px; border-radius: 999px;
  background: oklch(from var(--text) l c h / 0.06);
  color: var(--text);
  border: 1px solid oklch(from var(--text) l c h / 0.10);
}
.pill.green  { background: var(--green-dim);  color: var(--green-ink);  border-color: oklch(from var(--green-ink) l c h / 0.25); }
.pill.red    { background: var(--red-dim);    color: var(--red-ink);    border-color: oklch(from var(--red-ink) l c h / 0.25); }
.pill.amber  { background: var(--amber-dim);  color: var(--amber-ink);  border-color: oklch(from var(--amber-ink) l c h / 0.25); }
.pill.blue   { background: var(--blue-dim);   color: var(--blue-ink);   border-color: oklch(from var(--blue-ink) l c h / 0.25); }
.pill.purple { background: var(--purple-dim); color: var(--purple-ink); border-color: oklch(from var(--purple-ink) l c h / 0.25); }
.pill.pink   { background: var(--pink-dim);   color: var(--pink-ink);   border-color: oklch(from var(--pink-ink) l c h / 0.25); }
.pill .dot {
  width: 6px; height: 6px; border-radius: 50%; background: currentColor;
  box-shadow: 0 0 0 3px oklch(from currentColor l c h / 0.18),
              0 0 8px oklch(from currentColor l c h / 0.6);
}

/* ============================================================
   STATUS BAR + SPINNER + LIVE DOT
   ============================================================ */
.status-bar {
  display: flex; align-items: center; gap: 10px;
  font-family: var(--font-mono); font-size: 11px;
  color: var(--text-on-bg2);
  padding: 0 4px;
  margin-bottom: 16px;
  min-height: 18px;
}

@keyframes spin { to { transform: rotate(360deg); } }
.spinner {
  width: 12px; height: 12px;
  border: 2px solid oklch(from var(--accent) l c h / 0.2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  flex-shrink: 0;
}

@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 oklch(from currentColor l c h / 0.6); }
  70%  { box-shadow: 0 0 0 8px oklch(from currentColor l c h / 0); }
  100% { box-shadow: 0 0 0 0 oklch(from currentColor l c h / 0); }
}
.live-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: currentColor;
  animation: pulse 2s var(--ease) infinite;
}

/* ============================================================
   SCROLLBARS
   ============================================================ */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb {
  background: oklch(from var(--accent) l c h / 0.25);
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover {
  background: oklch(from var(--accent) l c h / 0.5);
  background-clip: padding-box;
  border: 2px solid transparent;
}
::-webkit-scrollbar-track { background: transparent; }

/* ============================================================
   LAYOUT HELPERS
   ============================================================ */
.hstack { display: flex; flex-direction: row; align-items: center; }
.vstack { display: flex; flex-direction: column; }
.gap-2  { gap: 8px; }
.gap-3  { gap: 12px; }
.gap-4  { gap: 16px; }
.gap-5  { gap: 20px; }
.gap-6  { gap: 24px; }

.show-more { text-align: center; padding: 16px 0; }

::selection {
  background: oklch(from var(--accent) l c h / 0.35);
  color: var(--text-on-bg);
}

/* ============================================================
   APP SHELL — left rail + topbar + content
   Pages opt in by setting <body data-shell="app"> and
   loading shell.js, which injects .app > (.rail + .app-main).
   ============================================================ */
.app {
  display: grid;
  grid-template-columns: 248px 1fr;
  min-height: 100vh;
  background: transparent;
}
.app-main { min-width: 0; display: flex; flex-direction: column; }

/* ── Left rail ── */
.rail {
  background: oklch(from var(--bg) calc(l + 0.04) c h / 0.5);
  backdrop-filter: blur(28px) saturate(160%);
  -webkit-backdrop-filter: blur(28px) saturate(160%);
  border-right: 1px solid var(--border-on-bg);
  display: flex; flex-direction: column;
  padding: 18px 14px;
  position: sticky; top: 0; height: 100vh;
  color: var(--text-on-bg);
}
body.light .rail {
  background: oklch(from var(--bg) calc(l - 0.05) c h / 0.5);
}

.rail-brand {
  display: flex; align-items: center; gap: 12px;
  padding: 8px 8px 22px;
  text-decoration: none;
  color: inherit;
}
.rail-mark {
  width: 36px; height: 36px;
  border-radius: 11px;
  background: var(--accent-grad);
  display: flex; align-items: center; justify-content: center;
  color: oklch(0.99 0 0);
  font-family: var(--font-display); font-style: italic; font-weight: 400; font-size: 18px;
  flex-shrink: 0;
  box-shadow:
    0 1px 0 oklch(1 0 0 / 0.35) inset,
    0 6px 20px -4px oklch(from var(--accent) l c h / 0.7),
    0 0 0 1px oklch(from var(--accent) l c h / 0.4);
}
.rail-name { font-family: var(--font-display); font-style: italic; font-weight: 400; font-size: 18px; letter-spacing: -0.01em; color: var(--text-on-bg); line-height: 1.1; }
.rail-sub { font-family: var(--font-mono); font-size: 10px; color: var(--text-on-bg3); letter-spacing: 0; }

/* Scrollable middle of the rail. flex:1 + min-height:0 is the canonical
   trick for "let me overflow inside a flex column" — without min-height:0
   the flex item refuses to shrink below its content and overflow-y:auto
   never engages. */
.rail-scroll {
  flex: 1; min-height: 0;
  overflow-y: auto; overflow-x: hidden;
  /* Subtle scrollbar so the rail doesn't grow a chunky native gutter. */
  scrollbar-width: thin;
  scrollbar-color: var(--border-on-bg) transparent;
}
.rail-scroll::-webkit-scrollbar { width: 6px; }
.rail-scroll::-webkit-scrollbar-track { background: transparent; }
.rail-scroll::-webkit-scrollbar-thumb {
  background: var(--border-on-bg); border-radius: 3px;
}
.rail-scroll::-webkit-scrollbar-thumb:hover {
  background: oklch(from var(--text-on-bg3) l c h / 0.6);
}

.rail-section { padding: 14px 8px 6px; }
.rail-section .t-label { color: var(--text-on-bg3); display: block; padding-bottom: 6px; }

.rail-link {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 11px; border-radius: var(--radius-sm);
  color: var(--text-on-bg2); cursor: pointer;
  font-family: var(--font-sans); font-size: 13px; font-weight: 500;
  text-decoration: none;
  transition: all var(--dur-fast) var(--ease);
  user-select: none;
  position: relative;
}
.rail-link:hover {
  background: oklch(from var(--bg) calc(l + 0.10) c h / 0.5);
  color: var(--text-on-bg);
}
body.light .rail-link:hover {
  background: oklch(from var(--bg) calc(l - 0.08) c h / 0.5);
}
.rail-link.active {
  background: var(--accent-grad);
  color: oklch(0.99 0 0);
  box-shadow:
    0 1px 0 oklch(1 0 0 / 0.3) inset,
    0 6px 18px -4px oklch(from var(--accent) l c h / 0.55);
}
.rail-link.active .rail-icon, .rail-link.active span { color: oklch(0.99 0 0); }
.rail-icon { width: 16px; height: 16px; flex-shrink: 0; display: inline-flex; }
.rail-link .count {
  margin-left: auto;
  font-family: var(--font-mono); font-size: 10px;
  background: oklch(from var(--bg) calc(l + 0.12) c h / 0.6);
  color: var(--text-on-bg3);
  border-radius: 999px; padding: 2px 7px;
}
body.light .rail-link .count {
  background: oklch(from var(--bg) calc(l - 0.10) c h / 0.6);
}
.rail-link.active .count {
  background: oklch(1 0 0 / 0.25);
  color: oklch(0.99 0 0);
}

.rail-foot {
  margin-top: auto; padding: 10px 8px 0;
  border-top: 1px solid var(--border-on-bg);
}
.rail-user {
  display: flex; align-items: center; gap: 11px;
  padding: 8px 4px;
}
.rail-avatar {
  width: 32px; height: 32px; border-radius: 9px;
  background: var(--accent-grad);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-mono); font-size: 12px; font-weight: 700;
  color: oklch(0.99 0 0);
  flex-shrink: 0;
  box-shadow: 0 4px 10px -2px oklch(from var(--accent) l c h / 0.5);
}
.rail-user-info { min-width: 0; flex: 1; }
.rail-user-name { font-size: 13px; font-weight: 600; color: var(--text-on-bg); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rail-user-email { font-family: var(--font-mono); font-size: 10px; color: var(--text-on-bg3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rail-signout {
  width: 30px; height: 30px;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--border-on-bg);
  background: transparent;
  color: var(--text-on-bg3);
  border-radius: var(--radius-xs);
  cursor: pointer;
  flex-shrink: 0;
  transition: all var(--dur-fast) var(--ease);
}
.rail-signout:hover { color: var(--red); border-color: oklch(from var(--red) l c h / 0.5); }

/* ── Topbar ── */
.topbar {
  display: flex; align-items: center; gap: 14px;
  padding: 16px 30px;
  border-bottom: 1px solid var(--border-on-bg);
  background: oklch(from var(--bg) l c h / 0.55);
  backdrop-filter: blur(24px) saturate(160%);
  -webkit-backdrop-filter: blur(24px) saturate(160%);
  position: sticky; top: 0; z-index: 50;
  color: var(--text-on-bg);
  min-height: 72px;
}
.topbar-titles { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.topbar-title { font-family: var(--font-display); font-style: italic; font-weight: 400; font-size: 26px; letter-spacing: -0.015em; line-height: 1.1; color: var(--text-on-bg); }
.topbar-crumb { font-family: var(--font-mono); font-size: 11px; color: var(--text-on-bg3); }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.topbar-version {
  font-family: var(--font-mono); font-size: 10px; font-weight: 600;
  color: var(--text-on-bg3); letter-spacing: 0.04em;
  padding: 3px 8px; border-radius: 999px;
  border: 1px solid var(--border-on-bg);
  background: oklch(from var(--bg) calc(l + 0.06) c h / 0.4);
  white-space: nowrap; user-select: all;
}
.topbar-live { display: inline-flex; align-items: center; gap: 8px; font-family: var(--font-mono); font-size: 11px; color: var(--text-on-bg2); }
.topbar-live a { color: var(--amber, var(--accent)); text-decoration: none; border-bottom: 1px dashed currentColor; }
.topbar-live a:hover { color: var(--accent); }
.topbar-live .live-dot { color: var(--green); }

/* ── Screen padding wrapper ── */
.screen-pad { padding: 28px 32px 96px; max-width: 1440px; margin: 0 auto; color: var(--text-on-bg); }

/* ============================================================
   DASHBOARD COMPONENTS
   ============================================================ */

/* ── Stat row ── */
.stat-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-top: 24px;
}
.stat-card {
  position: relative;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 22px;
  box-shadow: var(--shadow);
  overflow: hidden;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  transition: transform var(--dur) var(--ease-out), box-shadow var(--dur) var(--ease-out);
}
.stat-card::before {
  content: ""; position: absolute; inset: 0;
  border-radius: inherit; pointer-events: none;
  background: linear-gradient(180deg, oklch(1 0 0 / 0.5), transparent 30%);
  mix-blend-mode: overlay; opacity: 0.5;
}
.stat-card::after {
  content: ""; position: absolute; right: -50px; top: -50px;
  width: 140px; height: 140px; border-radius: 50%;
  background: radial-gradient(circle, oklch(from var(--accent) l c h / 0.40), transparent 70%);
  pointer-events: none;
}
.stat-card.active {
  box-shadow: var(--shadow), 0 0 0 1.5px oklch(from var(--accent) l c h / 0.55),
              0 0 40px -6px oklch(from var(--accent) l c h / 0.4);
}
.stat-card.active::after {
  background: radial-gradient(circle, oklch(from var(--accent) l c h / 0.65), transparent 65%);
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-pop); }
.stat-card-top {
  display: flex; align-items: center; justify-content: space-between;
  position: relative; z-index: 1;
  font-family: var(--font-mono); font-size: 11px; font-weight: 600;
  letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--text2);
}
.stat-value {
  font-family: var(--font-display); font-style: italic;
  font-size: 44px; font-weight: 400; letter-spacing: -0.02em;
  margin: 12px 0 4px;
  font-variant-numeric: tabular-nums;
  line-height: 1.05;
  position: relative; z-index: 1;
  color: var(--text);
}
.stat-trend {
  font-family: var(--font-mono); font-size: 11px;
  color: var(--text2);
  position: relative; z-index: 1;
}

.stat-card.hue-teal::after  { background: radial-gradient(circle, oklch(from var(--aurora-2) l c h / 0.45), transparent 70%); }
.stat-card.hue-green::after { background: radial-gradient(circle, oklch(from var(--aurora-3) l c h / 0.45), transparent 70%); }
.stat-card.hue-lime::after  { background: radial-gradient(circle, oklch(from var(--aurora-4) l c h / 0.45), transparent 70%); }
.stat-card.hue-amber::after { background: radial-gradient(circle, oklch(from var(--aurora-1) l c h / 0.45), transparent 70%); }
.stat-card.hue-coral::after { background: radial-gradient(circle, oklch(from var(--aurora-5) l c h / 0.45), transparent 70%); }

/* ── Search row ── */
.search-row {
  display: flex; align-items: center; gap: 10px;
  margin-top: 24px; flex-wrap: wrap;
}
.search-input-wrap {
  flex: 1; max-width: 480px;
  display: flex; align-items: center; gap: 8px;
  padding: 0 13px;
  background: oklch(from var(--bg) calc(l + 0.06) c h / 0.5);
  border: 1px solid var(--border-on-bg);
  border-radius: var(--radius-sm);
  color: var(--text-on-bg3);
  backdrop-filter: blur(12px);
  transition: all var(--dur-fast) var(--ease);
}
body.light .search-input-wrap {
  background: oklch(from var(--bg) calc(l - 0.06) c h / 0.5);
}
.search-input-wrap:focus-within {
  border-color: oklch(from var(--accent) l c h / 0.5);
  box-shadow: 0 0 0 3px var(--accent-d);
}
.search-input-wrap input.search-input {
  flex: 1; background: transparent !important; border: none !important; outline: none;
  padding: 11px 0; color: var(--text-on-bg);
  font-family: var(--font-sans); font-size: 13px;
  width: 100%;
  box-shadow: none !important;
}
.search-input::placeholder { color: var(--text-on-bg3); }

/* ── View switch ── */
.view-switch {
  display: inline-flex; gap: 2px;
  padding: 3px;
  background: oklch(from var(--bg) calc(l + 0.08) c h / 0.5);
  border: 1px solid var(--border-on-bg);
  border-radius: var(--radius-sm);
  backdrop-filter: blur(12px);
}
body.light .view-switch {
  background: oklch(from var(--bg) calc(l - 0.06) c h / 0.5);
}
.view-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 13px;
  font-family: var(--font-sans); font-size: 12px; font-weight: 500;
  color: var(--text-on-bg3);
  background: transparent; border: none; border-radius: 7px;
  cursor: pointer;
  transition: all var(--dur-fast) var(--ease);
}
.view-btn:hover { color: var(--text-on-bg); }
.view-btn.active {
  background: var(--accent-grad);
  color: oklch(0.99 0 0);
  box-shadow:
    0 1px 0 oklch(1 0 0 / 0.25) inset,
    0 4px 12px -4px oklch(from var(--accent) l c h / 0.55);
}

/* ── Rooms grid ── */
.rooms-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
  margin-top: 22px;
}
.rooms-grid.compact {
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
}
.room-card {
  position: relative;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 22px;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform var(--dur) var(--ease-out), box-shadow var(--dur) var(--ease-out);
}
.room-card::before {
  content: ""; position: absolute; inset: 0;
  border-radius: inherit; pointer-events: none;
  background: linear-gradient(180deg, oklch(1 0 0 / 0.5), transparent 30%);
  mix-blend-mode: overlay; opacity: 0.5;
}
.room-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-pop); }
.rooms-grid.compact .room-card { padding: 14px 16px; }

.room-card-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 10px;
  position: relative; z-index: 1;
}
.room-name {
  font-size: 16px; font-weight: 600; letter-spacing: -0.012em;
  color: var(--text);
}
.rooms-grid.compact .room-name { font-size: 13px; }
.room-loc { font-family: var(--font-mono); font-size: 11px; color: var(--text2); margin-top: 4px; }
.room-card-body { margin-top: 14px; position: relative; z-index: 1; }
.rooms-grid.compact .room-card-body { margin-top: 10px; }

.booking-strip {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 11px;
  background: oklch(from var(--surface) calc(l - 0.05) c h);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  margin-bottom: 10px;
  font-size: 12px;
  color: var(--text);
}
body.light .booking-strip {
  background: oklch(from var(--surface) calc(l + 0.06) c h);
}
.booking-strip .t-meta { color: var(--text2); }
.dev-list { display: flex; flex-direction: column; gap: 4px; }
.dev-row {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 4px;
  font-family: var(--font-mono); font-size: 11px;
  color: var(--text2);
}
.dev-row > span:nth-child(2) { flex: 1; }
.dev-state { margin-left: auto; }

/* ── Drawer (right-side panel) ── */
.drawer-backdrop {
  position: fixed; inset: 0; z-index: 200;
  background: oklch(0 0 0 / 0.55);
  backdrop-filter: blur(6px);
  display: flex; justify-content: flex-end;
  animation: fadeIn var(--dur) var(--ease);
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideIn { from { transform: translateX(20px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
.drawer {
  width: 500px; max-width: 100vw;
  background: var(--surface);
  color: var(--text);
  border-left: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  height: 100%;
  overflow-y: auto;
  padding: 28px;
  animation: slideIn var(--dur) var(--ease);
  position: relative;
}
.drawer::before {
  content: ""; position: absolute; inset: 0;
  border-radius: inherit; pointer-events: none;
  background: linear-gradient(180deg, oklch(1 0 0 / 0.4), transparent 25%);
  mix-blend-mode: overlay; opacity: 0.4;
}
.drawer-head { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 22px; position: relative; z-index: 1; }
.drawer-section { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; position: relative; z-index: 1; }
.drawer-photo {
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, oklch(from var(--aurora-1) l c h / 0.5), oklch(from var(--aurora-3) l c h / 0.5)),
    repeating-linear-gradient(135deg, oklch(0 0 0 / 0.05) 0 12px, oklch(1 0 0 / 0.05) 12px 24px);
  height: 180px;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 22px;
  font-family: var(--font-mono); font-size: 11px;
  color: oklch(0.99 0 0);
  letter-spacing: 0.1em;
  position: relative; z-index: 1;
}
.drawer-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 14px 18px;
  padding: 18px 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  position: relative; z-index: 1;
}
.field-row { display: flex; flex-direction: column; gap: 4px; }
.drawer-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 18px; position: relative; z-index: 1; }
.drawer-close {
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--border);
  background: oklch(from var(--surface) calc(l - 0.04) c h);
  color: var(--text2);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--dur-fast) var(--ease);
}
.drawer-close:hover { color: var(--text); border-color: oklch(from var(--accent) l c h / 0.4); }

/* ── Hero pill (badge above big titles) ── */
.hero-pill {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 12px; border-radius: 999px;
  background: oklch(from var(--accent) l c h / 0.18);
  border: 1px solid oklch(from var(--accent) l c h / 0.35);
  color: var(--text-on-bg);
  font-family: var(--font-mono); font-size: 11px; font-weight: 600;
  letter-spacing: 0.08em; text-transform: uppercase;
  margin-bottom: 12px;
}
.hero-pill .dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 10px oklch(from var(--accent) l c h / 0.8);
}

/* ── Section divider with vibe ── */
.section-rule {
  height: 1px;
  background: linear-gradient(90deg,
    transparent,
    oklch(from var(--accent) l c h / 0.5) 30%,
    oklch(from var(--aurora-3) l c h / 0.5) 70%,
    transparent);
  margin: 32px 0;
  opacity: 0.7;
  border: none;
}

/* ── Toggle (used in notifications/settings) ── */
.toggle {
  width: 42px; height: 24px;
  border-radius: 999px;
  background: oklch(from var(--surface) calc(l - 0.10) c h);
  border: 1px solid var(--border);
  position: relative; cursor: pointer;
  transition: background var(--dur) var(--ease);
}
body.light .toggle { background: oklch(from var(--surface) calc(l + 0.10) c h); }
.toggle.on {
  background: var(--accent-grad);
  border-color: transparent;
  box-shadow: 0 0 0 1px oklch(from var(--accent) l c h / 0.5),
              0 0 14px -2px oklch(from var(--accent) l c h / 0.6);
}
.toggle-thumb {
  position: absolute; top: 2px; left: 2px;
  width: 18px; height: 18px; border-radius: 50%;
  background: oklch(0.99 0 0);
  transition: transform var(--dur) var(--ease);
  box-shadow: 0 1px 3px oklch(0 0 0 / 0.3);
}
.toggle.on .toggle-thumb { transform: translateX(18px); }

/* ── Responsive: collapse rail on narrow viewports ── */
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .rail {
    position: relative; top: auto; height: auto;
    flex-direction: row; align-items: center;
    padding: 12px 16px;
    overflow-x: auto;
  }
  .rail-section { display: none; }
  /* On narrow viewports the rail collapses to a horizontal strip — make
     .rail-scroll layout-transparent so its contents (now hidden anyway)
     don't claim the flex:1 horizontal space that would push .rail-foot
     off-screen. */
  .rail-scroll { display: contents; }
  .rail-foot { margin-top: 0; padding: 0 0 0 12px; border-top: none; border-left: 1px solid var(--border-on-bg); margin-left: auto; }
  .rail-user-info { display: none; }
  .stat-row { grid-template-columns: repeat(2, 1fr); }
  .topbar { padding: 14px 18px; }
  .screen-pad { padding: 22px 18px 80px; }
}
@media (max-width: 600px) {
  .stat-row { grid-template-columns: 1fr; }
}

/* ── Shared layout primitives ────────────────────────────────────────────────
   Used by room-dashboard.html (header logo) and mapping.html (page top
   bar). Promoted from per-page <style> blocks during the standalone-pages
   refactor — there's no reason for two copies of the same square-with-emoji.
*/
.logo-mark {
  width: 36px; height: 36px; background: var(--accent);
  border-radius: 9px; display: flex; align-items: center;
  justify-content: center; font-size: 17px;
}
.top-bar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 32px; border-bottom: 1px solid var(--border);
  background: var(--surface); position: sticky; top: 0; z-index: 10;
}
.top-bar-left { display: flex; align-items: center; gap: 12px; }

