/* =============================================================================
   DARKVOL PRO — Elite institutional-grade theme
   Foundation stylesheet for the v2 app shell, Sightline, and Pulse.
   ============================================================================= */

/* ---------- Tokens ---------- */
:root {
  /* Surfaces — deep institutional black with subtle warm tilt */
  --bg-base:        #07090d;
  --bg-canvas:      #0a0d13;
  --bg-panel:       #0e131c;
  --bg-panel-2:     #131925;
  --bg-elevated:    #182032;
  --bg-hover:       #1c2536;
  --bg-active:      #232f47;

  /* Borders / dividers */
  --border-subtle:  rgba(255,255,255,0.04);
  --border-soft:    rgba(255,255,255,0.07);
  --border-strong:  rgba(255,255,255,0.12);
  --border-accent:  rgba(255,167,88,0.35);

  /* Text */
  --text-primary:   #e7ecf3;
  --text-secondary: #9aa6b8;
  --text-tertiary:  #5d6a82;
  --text-disabled:  #3a4356;
  --text-on-accent: #0a0d13;

  /* Brand accents */
  --accent:         #ffa758;
  --accent-bright:  #ffba75;
  --accent-soft:    rgba(255,167,88,0.12);
  --accent-glow:    rgba(255,167,88,0.45);

  /* Data semantics */
  --pos:            #4ade80;
  --pos-soft:       rgba(74,222,128,0.13);
  --neg:            #f87171;
  --neg-soft:       rgba(248,113,113,0.13);
  --info:           #60a5fa;
  --info-soft:      rgba(96,165,250,0.13);
  --warn:           #fbbf24;
  --warn-soft:      rgba(251,191,36,0.13);

  /* Gamma palette (for walls + heatmaps) */
  --gamma-call:     #34d399;
  --gamma-call-2:   #10b981;
  --gamma-put:      #f472b6;
  --gamma-put-2:    #ec4899;
  --gamma-net-pos:  #4ade80;
  --gamma-net-neg:  #ef4444;
  --gamma-zero:     #94a3b8;

  /* Shadows / glows */
  --shadow-sm:  0 1px 2px rgba(0,0,0,0.4);
  --shadow-md:  0 4px 12px rgba(0,0,0,0.5);
  --shadow-lg:  0 12px 32px rgba(0,0,0,0.55);
  --shadow-xl:  0 24px 64px rgba(0,0,0,0.6);
  --glow-accent: 0 0 12px rgba(255,167,88,0.35), 0 0 32px rgba(255,167,88,0.15);
  --glow-pos:    0 0 10px rgba(74,222,128,0.35);
  --glow-neg:    0 0 10px rgba(248,113,113,0.35);

  /* Geometry */
  --r-sm: 4px;
  --r-md: 6px;
  --r-lg: 10px;
  --r-xl: 14px;
  --r-pill: 999px;

  /* Spacing scale */
  --s-1: 4px;
  --s-2: 8px;
  --s-3: 12px;
  --s-4: 16px;
  --s-5: 20px;
  --s-6: 24px;
  --s-8: 32px;
  --s-10: 40px;
  --s-12: 48px;

  /* Type scale */
  --fs-xs:   11px;
  --fs-sm:   12px;
  --fs-base: 13px;
  --fs-md:   14px;
  --fs-lg:   16px;
  --fs-xl:   20px;
  --fs-2xl:  28px;
  --fs-3xl:  40px;

  /* Layout */
  --sidebar-w: 232px;
  --sidebar-w-collapsed: 64px;
  --header-h: 52px;
  --statusbar-h: 28px;

  /* Motion */
  --ease-out: cubic-bezier(0.2, 0.8, 0.2, 1);
  --ease-in-out: cubic-bezier(0.65, 0.05, 0.36, 1);
  --dur-fast: 120ms;
  --dur-base: 200ms;
  --dur-slow: 360ms;
}

/* ---------- Reset & base ---------- */
*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg-base);
  color: var(--text-primary);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  font-size: var(--fs-base);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: 'cv11', 'ss01', 'ss03';
  letter-spacing: -0.005em;
  overflow: hidden;
}

body {
  /* subtle radial vignette to give the app some depth */
  background:
    radial-gradient(ellipse at top, rgba(255,167,88,0.03), transparent 50%),
    radial-gradient(ellipse at bottom, rgba(96,165,250,0.025), transparent 60%),
    var(--bg-base);
}

a { color: var(--accent); text-decoration: none; transition: color var(--dur-fast) var(--ease-out); }
a:hover { color: var(--accent-bright); }

button {
  font-family: inherit;
  font-size: inherit;
  cursor: pointer;
  background: none;
  border: none;
  color: inherit;
}

input, select, textarea {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

::selection { background: var(--accent-soft); color: var(--accent-bright); }

/* numeric — ALL numbers in the app should use tabular-nums */
.num, .mono, .tabular {
  font-family: 'JetBrains Mono', 'SF Mono', 'Menlo', 'Monaco', monospace;
  font-variant-numeric: tabular-nums;
  font-feature-settings: 'tnum' 1, 'zero' 1;
  letter-spacing: -0.01em;
}

/* ---------- Scrollbars ---------- */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.06);
  border-radius: var(--r-pill);
  border: 2px solid transparent;
  background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.12); background-clip: padding-box; border: 2px solid transparent; }
* { scrollbar-color: rgba(255,255,255,0.08) transparent; scrollbar-width: thin; }

/* =============================================================================
   APP SHELL
   ============================================================================= */
.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  grid-template-rows: var(--header-h) 1fr var(--statusbar-h);
  grid-template-areas:
    "sidebar header"
    "sidebar main"
    "sidebar status";
  height: 100vh;
  width: 100vw;
}

/* ---------- Sidebar ---------- */
.sidebar {
  grid-area: sidebar;
  background: linear-gradient(180deg, #0a0d13 0%, #07090d 100%);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

.sidebar::after {
  content: '';
  position: absolute;
  top: 0; right: 0; bottom: 0;
  width: 1px;
  background: linear-gradient(180deg, transparent, rgba(255,167,88,0.12) 30%, rgba(255,167,88,0.12) 70%, transparent);
  pointer-events: none;
}

.brand {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-5) var(--s-5) var(--s-4);
  border-bottom: 1px solid var(--border-subtle);
}

.brand-mark {
  width: 32px;
  height: 32px;
  border-radius: var(--r-md);
  background: linear-gradient(135deg, var(--accent) 0%, #ff7a38 100%);
  display: grid;
  place-items: center;
  color: var(--text-on-accent);
  font-weight: 800;
  font-size: 16px;
  letter-spacing: -0.04em;
  box-shadow: var(--glow-accent);
}

.brand-name {
  font-weight: 700;
  font-size: var(--fs-md);
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.brand-name .accent { color: var(--accent); }

.nav { flex: 1; overflow-y: auto; padding: var(--s-3) var(--s-2); }

.nav-section {
  margin-top: var(--s-4);
}

.nav-section-label {
  padding: var(--s-2) var(--s-3) var(--s-1);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-tertiary);
  font-weight: 600;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-2) var(--s-3);
  border-radius: var(--r-md);
  color: var(--text-secondary);
  font-weight: 500;
  font-size: var(--fs-base);
  cursor: pointer;
  position: relative;
  transition: background var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out);
  user-select: none;
}

.nav-item:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.nav-item.active {
  background: linear-gradient(90deg, var(--accent-soft), transparent 80%);
  color: var(--accent-bright);
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0; top: 8px; bottom: 8px;
  width: 2px;
  background: var(--accent);
  border-radius: var(--r-pill);
  box-shadow: 0 0 8px var(--accent-glow);
}

.nav-icon {
  width: 18px; height: 18px;
  flex-shrink: 0;
  opacity: 0.85;
}

.nav-badge {
  margin-left: auto;
  background: var(--bg-elevated);
  color: var(--text-secondary);
  font-size: var(--fs-xs);
  padding: 2px 6px;
  border-radius: var(--r-pill);
  font-weight: 600;
}

.nav-badge.live {
  background: var(--pos-soft);
  color: var(--pos);
  display: flex;
  align-items: center;
  gap: 4px;
}

.nav-badge.live::before {
  content: '';
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--pos);
  box-shadow: 0 0 6px var(--pos);
  animation: pulse 1.6s infinite;
}

.sidebar-footer {
  padding: var(--s-3) var(--s-4);
  border-top: 1px solid var(--border-subtle);
  font-size: var(--fs-xs);
  color: var(--text-tertiary);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* ---------- Header ---------- */
.header {
  grid-area: header;
  background: linear-gradient(180deg, rgba(14,19,28,0.85), rgba(10,13,19,0.85));
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  padding: 0 var(--s-5);
  gap: var(--s-5);
  position: relative;
  z-index: 10;
}

.page-title {
  font-size: var(--fs-md);
  font-weight: 600;
  letter-spacing: 0.01em;
  display: flex;
  align-items: center;
  gap: var(--s-2);
  color: var(--text-primary);
}

.page-title .breadcrumb {
  color: var(--text-tertiary);
  font-weight: 400;
}

.header-spacer { flex: 1; }

.header-meta {
  display: flex;
  align-items: center;
  gap: var(--s-5);
  font-size: var(--fs-sm);
  color: var(--text-secondary);
}

.meta-item {
  display: flex;
  align-items: center;
  gap: var(--s-2);
}

.meta-label {
  color: var(--text-tertiary);
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.meta-value {
  font-family: 'JetBrains Mono', monospace;
  font-variant-numeric: tabular-nums;
  color: var(--text-primary);
  font-weight: 500;
}

/* connection LED */
.led {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--text-disabled);
  position: relative;
  flex-shrink: 0;
}

.led.live    { background: var(--pos); box-shadow: 0 0 8px var(--pos); animation: pulse 1.6s infinite; }
.led.warn    { background: var(--warn); box-shadow: 0 0 8px var(--warn); }
.led.error   { background: var(--neg); box-shadow: 0 0 8px var(--neg); }

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.45; }
}

/* ---------- Main / Status ---------- */
.main {
  grid-area: main;
  overflow: hidden;
  position: relative;
}

.statusbar {
  grid-area: status;
  background: var(--bg-canvas);
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  padding: 0 var(--s-4);
  font-size: var(--fs-xs);
  color: var(--text-tertiary);
  gap: var(--s-4);
  font-family: 'JetBrains Mono', monospace;
  letter-spacing: 0.02em;
}

.statusbar .stat {
  display: flex;
  align-items: center;
  gap: 6px;
}

.statusbar .stat strong { color: var(--text-secondary); font-weight: 500; }
.statusbar .sep { color: var(--text-disabled); }

/* =============================================================================
   PRIMITIVES
   ============================================================================= */

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-2);
  padding: 7px var(--s-3);
  border-radius: var(--r-md);
  font-size: var(--fs-sm);
  font-weight: 500;
  border: 1px solid var(--border-soft);
  background: var(--bg-panel-2);
  color: var(--text-primary);
  transition: all var(--dur-fast) var(--ease-out);
  white-space: nowrap;
  user-select: none;
}

.btn:hover { background: var(--bg-hover); border-color: var(--border-strong); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }

.btn-primary {
  background: linear-gradient(180deg, var(--accent), #ff8a3c);
  color: var(--text-on-accent);
  border-color: transparent;
  font-weight: 600;
}
.btn-primary:hover {
  background: linear-gradient(180deg, var(--accent-bright), var(--accent));
  box-shadow: var(--glow-accent);
}

.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { background: var(--bg-hover); }

.btn-icon {
  padding: 7px;
  width: 32px;
  height: 32px;
}

.btn-sm { padding: 4px 10px; font-size: var(--fs-xs); }

/* ---------- Inputs ---------- */
.input, select.input {
  background: var(--bg-canvas);
  border: 1px solid var(--border-soft);
  border-radius: var(--r-md);
  padding: 7px var(--s-3);
  color: var(--text-primary);
  font-size: var(--fs-sm);
  transition: border-color var(--dur-fast) var(--ease-out), background var(--dur-fast) var(--ease-out);
  outline: none;
}

.input:focus { border-color: var(--accent); background: var(--bg-panel); box-shadow: 0 0 0 3px var(--accent-soft); }

select.input {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath fill='%239aa6b8' d='M0 0l5 6 5-6z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 28px;
  cursor: pointer;
}

/* ---------- Cards / panels ---------- */
.card {
  background: var(--bg-panel);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.card-header {
  padding: var(--s-3) var(--s-4);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  gap: var(--s-3);
  background: linear-gradient(180deg, rgba(255,255,255,0.015), transparent);
}

.card-title {
  font-size: var(--fs-sm);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-secondary);
}

.card-body { padding: var(--s-4); flex: 1; overflow: auto; }
.card-body.no-pad { padding: 0; }

/* ---------- Pills / chips ---------- */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: var(--r-pill);
  font-size: var(--fs-xs);
  font-weight: 600;
  background: var(--bg-elevated);
  color: var(--text-secondary);
  letter-spacing: 0.02em;
}

.pill.pos { background: var(--pos-soft); color: var(--pos); }
.pill.neg { background: var(--neg-soft); color: var(--neg); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.info { background: var(--info-soft); color: var(--info); }
.pill.accent { background: var(--accent-soft); color: var(--accent); }

/* ---------- Tag groups (segmented control) ---------- */
.seg {
  display: inline-flex;
  background: var(--bg-canvas);
  border: 1px solid var(--border-soft);
  border-radius: var(--r-md);
  padding: 2px;
  gap: 2px;
}

.seg-item {
  padding: 4px 12px;
  border-radius: var(--r-sm);
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--dur-fast) var(--ease-out);
  letter-spacing: 0.02em;
  user-select: none;
}

.seg-item:hover { color: var(--text-primary); }
.seg-item.active { background: var(--bg-elevated); color: var(--accent); box-shadow: var(--shadow-sm); }

/* ---------- Tables ---------- */
.tbl {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: var(--fs-sm);
  font-variant-numeric: tabular-nums;
}

.tbl thead th {
  text-align: left;
  padding: var(--s-2) var(--s-3);
  font-size: var(--fs-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-tertiary);
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg-canvas);
  position: sticky;
  top: 0;
  z-index: 1;
}

.tbl tbody td {
  padding: 7px var(--s-3);
  border-bottom: 1px solid var(--border-subtle);
}

.tbl tbody tr { transition: background var(--dur-fast) var(--ease-out); }
.tbl tbody tr:hover { background: rgba(255,255,255,0.02); }

.tbl .num { font-family: 'JetBrains Mono', monospace; }
.tbl .right { text-align: right; }
.tbl .center { text-align: center; }
.tbl .pos { color: var(--pos); }
.tbl .neg { color: var(--neg); }

/* ---------- Modal / overlays ---------- */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(7,9,13,0.78);
  backdrop-filter: blur(6px);
  display: grid;
  place-items: center;
  z-index: 1000;
  animation: fadeIn var(--dur-base) var(--ease-out);
}

.modal {
  background: var(--bg-panel);
  border: 1px solid var(--border-soft);
  border-radius: var(--r-xl);
  padding: var(--s-8);
  min-width: 400px;
  max-width: 600px;
  box-shadow: var(--shadow-xl);
  animation: scaleIn var(--dur-base) var(--ease-out);
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes scaleIn { from { opacity: 0; transform: scale(0.96); } to { opacity: 1; transform: scale(1); } }

/* =============================================================================
   ATLAS / HEATSEEKER specific
   ============================================================================= */

.workspace {
  height: 100%;
  display: flex;
  flex-direction: column;
}

.toolbar {
  min-height: 44px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;            /* allow wrap when many segments are present */
  row-gap: var(--s-2);
  column-gap: var(--s-3);
  padding: var(--s-2) var(--s-4);
  background: var(--bg-canvas);
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
}

.toolbar .divider {
  width: 1px;
  height: 22px;
  background: var(--border-soft);
  margin: 0 var(--s-1);
}

.workspace-body {
  flex: 1;
  display: grid;
  overflow: hidden;
  position: relative;
}

.sightline-layout { grid-template-columns: 1fr; }
/* Split view — two independent Sightline panes side by side. Toggled
   via #splitToggle in the toolbar. Right pane is an iframe loading
   /sightline?embed=1 so it's fully self-contained. */
.sightline-layout.split-active {
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  background: var(--border-subtle);
}
.chart-pane-iframe { background: var(--bg-base); overflow: hidden; }

/* Embed mode — when /sightline is loaded inside the split-view iframe,
   ?embed=1 hides the parent app chrome (sidebar, header, statusbar)
   so the iframe is just chart + toolbar + chart-pane, full bleed. */
body.embed-mode .sidebar,
body.embed-mode .header,
body.embed-mode .statusbar { display: none !important; }
body.embed-mode .app {
  grid-template-columns: 1fr;
  grid-template-rows: 1fr;
  grid-template-areas: "main";
}
/* Pulse uses FLEX (not grid) because LWC chart resists shrinking
   below its current rendered size, which squeezes a grid sibling. */
.pulse-layout {
  display: flex !important;
  flex-direction: row;
}
/* Pulse no longer renders a candlestick chart — strike-stack panel takes
   the FULL width. In trinity mode, three pulse-panels split equally. */
.pulse-layout > .chart-pane {
  display: none;     /* legacy chart-pane no longer used; kept selector
                        for cleanliness in case any old DOM survives a rebuild */
}
.pulse-layout > .pulse-panel {
  flex: 1 1 auto;
  min-width: 0;
}
.trinity-layout   { grid-template-columns: 1fr 1fr 1fr; gap: 1px; background: var(--border-subtle); }

.chart-pane {
  position: relative;
  background: var(--bg-base);
  overflow: hidden;
}

.chart-pane .chart-host {
  position: absolute;
  inset: 0;
}

/* ticker pill (inside toolbar) — looks like Bloomberg */
.ticker-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px 4px 6px;
  border-radius: var(--r-md);
  background: var(--bg-elevated);
  border: 1px solid var(--border-soft);
  font-weight: 700;
  font-size: var(--fs-base);
  letter-spacing: 0.04em;
}

.ticker-pill .symbol { color: var(--accent); }
.ticker-pill .price  { font-family: 'JetBrains Mono', monospace; font-variant-numeric: tabular-nums; color: var(--text-primary); }
.ticker-pill .delta  { font-family: 'JetBrains Mono', monospace; font-size: var(--fs-xs); padding: 1px 6px; border-radius: var(--r-pill); }
.ticker-pill .delta.pos { background: var(--pos-soft); color: var(--pos); }
.ticker-pill .delta.neg { background: var(--neg-soft); color: var(--neg); }

/* legend chip (for gamma overlays) */
.legend {
  position: absolute;
  top: var(--s-3);
  right: var(--s-3);
  background: rgba(7,9,13,0.85);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border-soft);
  border-radius: var(--r-md);
  padding: var(--s-3);
  font-size: var(--fs-xs);
  color: var(--text-secondary);
  z-index: 5;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 180px;
}

.legend .row { display: flex; align-items: center; gap: 8px; justify-content: space-between; }
.legend .swatch {
  display: inline-block;
  width: 18px; height: 3px;
  border-radius: var(--r-pill);
}

.legend .swatch.call-1 { background: var(--gamma-call-2); box-shadow: var(--glow-pos); height: 2px; }
.legend .swatch.call-2 { background: var(--gamma-call); height: 3px; }
.legend .swatch.call-3 { background: var(--gamma-call); height: 4px; box-shadow: 0 0 6px var(--gamma-call); }
.legend .swatch.put-1  { background: var(--gamma-put-2); height: 2px; }
.legend .swatch.put-2  { background: var(--gamma-put); height: 3px; }

/* pulse side panel canvas host. Must fill its flex parent in BOTH single
   and trinity layouts — without explicit flex sizing, the canvas's CSS
   width:100% references a 0-width parent → invisible bars. */
.pulse-panel {
  background: var(--bg-canvas);
  border-left: 1px solid var(--border-subtle);
  position: relative;
  overflow: hidden;
  flex: 1 1 auto;
  min-width: 0;
  width: 100%;
}

.pulse-panel .panel-head {
  padding: var(--s-2) var(--s-3);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-tertiary);
  font-weight: 600;
}

.pulse-canvas {
  position: absolute;
  top: 36px; left: 0; right: 0; bottom: 0;
  display: block;          /* canvas defaults to inline → intrinsic-size leaks into layout */
  width: 100%;             /* lock CSS size to parent, never to bitmap */
  height: calc(100% - 36px);
}

/* loading shimmer */
.shimmer {
  background: linear-gradient(90deg, var(--bg-panel) 0%, var(--bg-elevated) 50%, var(--bg-panel) 100%);
  background-size: 200% 100%;
  animation: shimmer 1.6s linear infinite;
}
@keyframes shimmer { 0% { background-position: -200% 0; } 100% { background-position: 200% 0; } }

/* utility */
.hidden { display: none !important; }
.flex { display: flex; }
.flex-col { display: flex; flex-direction: column; }
.gap-1 { gap: var(--s-1); }
.gap-2 { gap: var(--s-2); }
.gap-3 { gap: var(--s-3); }
.gap-4 { gap: var(--s-4); }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.flex-1 { flex: 1; }
.full { width: 100%; height: 100%; }

/* =============================================================================
   DASHBOARD (landing page) tiles
   ============================================================================= */

.dash-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--s-4);
  padding: var(--s-5);
  height: 100%;
  overflow-y: auto;
  align-content: start;
}

.tile {
  background: linear-gradient(180deg, var(--bg-panel) 0%, var(--bg-canvas) 100%);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-lg);
  padding: var(--s-4);
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
  transition: border-color var(--dur-base) var(--ease-out), transform var(--dur-base) var(--ease-out);
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.tile:hover { border-color: var(--border-accent); transform: translateY(-2px); }

.tile::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background: radial-gradient(circle at top right, var(--accent-soft), transparent 50%);
  opacity: 0;
  transition: opacity var(--dur-base) var(--ease-out);
}
.tile:hover::after { opacity: 1; }

.tile-label {
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-tertiary);
  font-weight: 600;
}

.tile-value {
  font-family: 'JetBrains Mono', monospace;
  font-variant-numeric: tabular-nums;
  font-size: var(--fs-2xl);
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

.tile-meta { display: flex; align-items: center; gap: var(--s-2); font-size: var(--fs-xs); color: var(--text-secondary); }

.tile-spark { height: 40px; margin: -4px 0 -4px; }

/* =============================================================================
   LOGIN OVERLAY (the 8-digit code) — premium feel
   ============================================================================= */

.login-overlay {
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse at top, rgba(255,167,88,0.08), transparent 50%),
    radial-gradient(ellipse at bottom, rgba(96,165,250,0.05), transparent 60%),
    var(--bg-base);
  display: grid;
  place-items: center;
  z-index: 100;
}

.login-card {
  background: var(--bg-panel);
  border: 1px solid var(--border-soft);
  border-radius: var(--r-xl);
  padding: var(--s-10) var(--s-8);
  min-width: 380px;
  text-align: center;
  box-shadow: var(--shadow-xl);
}

.login-mark {
  width: 56px;
  height: 56px;
  border-radius: var(--r-lg);
  background: linear-gradient(135deg, var(--accent) 0%, #ff7a38 100%);
  display: grid;
  place-items: center;
  color: var(--text-on-accent);
  font-weight: 800;
  font-size: 28px;
  letter-spacing: -0.04em;
  box-shadow: var(--glow-accent);
  margin: 0 auto var(--s-5);
}

.login-title { font-size: var(--fs-xl); font-weight: 700; margin-bottom: 6px; letter-spacing: -0.01em; }
.login-sub { font-size: var(--fs-sm); color: var(--text-secondary); margin-bottom: var(--s-6); }

.login-input {
  width: 100%;
  background: var(--bg-canvas);
  border: 1px solid var(--border-soft);
  border-radius: var(--r-md);
  padding: var(--s-4);
  color: var(--text-primary);
  font-family: 'JetBrains Mono', monospace;
  font-size: 22px;
  text-align: center;
  letter-spacing: 0.4em;
  font-variant-numeric: tabular-nums;
  outline: none;
  margin-bottom: var(--s-4);
  transition: border-color var(--dur-fast) var(--ease-out);
}

.login-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

.login-error {
  font-size: var(--fs-sm);
  color: var(--neg);
  min-height: 18px;
  margin-bottom: var(--s-3);
}

/* =============================================================================
   RESPONSIVE
   ============================================================================= */

@media (max-width: 960px) {
  :root { --sidebar-w: 64px; }
  .nav-item span:not(.nav-badge) { display: none; }
  .brand-name { display: none; }
  .nav-section-label { display: none; }
}
