/* ─────────────────────────────────────────
   TOKENS
───────────────────────────────────────── */
:root {
  --green:   #2D6A4F;
  --green-dim: rgba(45,106,79,0.08);
  --amber:   #A67C37;
  --coral:   #9B4444;
  --teal:    #2A9D8F;
  --emerald: #4a7a5e;

  --ease: cubic-bezier(0.25,0.46,0.45,0.94);
  --ease-spring: cubic-bezier(0.34,1.4,0.64,1);
  --font-body: 'DM Sans', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

/* ─── VARIANT A: Light Editorial ─── */
[data-variant="a"] {
  --bg:         #f9f7f4;
  --surface:    #fefcf9;
  --surface-2:  #f2ede8;
  --border:     rgba(0,0,0,0.08);
  --border-med: rgba(0,0,0,0.12);
  --text:       #1a1814;
  --text-2:     #3a3630;
  --text-3:     #6a6560;
  --header-bg:  rgba(254,252,249,0.88);
  --ticker-bg:  #1a1814;
  --ticker-fg:  #f9f7f4;
  --ticker-label-bg: #2D6A4F;
}

/* ─── VARIANT B: Dark ─── */
[data-variant="b"] {
  --bg:         #0d0c0b;
  --surface:    #161412;
  --surface-2:  #1e1b18;
  --border:     rgba(255,255,255,0.07);
  --border-med: rgba(255,255,255,0.12);
  --text:       #e8e2d9;
  --text-2:     #857f77;
  --text-3:     #6a6560;
  --header-bg:  rgba(13,12,11,0.90);
  --ticker-bg:  #1a3d2b;
  --ticker-fg:  rgba(255,255,255,0.92);
  --ticker-label-bg: rgba(255,255,255,0.12);
}

/* ─── VARIANT C: Sidebar ─── */
[data-variant="c"] {
  --bg:         #f9f7f4;
  --surface:    #fefcf9;
  --surface-2:  #f2ede8;
  --border:     rgba(0,0,0,0.08);
  --border-med: rgba(0,0,0,0.12);
  --text:       #1a1814;
  --text-2:     #3a3630;
  --text-3:     #6a6560;
  --header-bg:  rgba(254,252,249,0.95);
  --ticker-bg:  #1a1814;
  --ticker-fg:  #f9f7f4;
  --ticker-label-bg: #2D6A4F;
}

/* ─── DARK MODE ─── */
body[data-variant="c"][data-theme="dark"],
body[data-variant="d"][data-theme="dark"] {
  --bg:         #0d0c0b;
  --surface:    #161412;
  --surface-2:  #1e1b18;
  --border:     rgba(255,255,255,0.07);
  --border-med: rgba(255,255,255,0.13);
  --text:       #e8e2d9;
  --text-2:     #857f77;
  --text-3:     #6a6560;
  --header-bg:  rgba(13,12,11,0.92);
  --ticker-bg:  #1a3d2b;
  --ticker-fg:  rgba(255,255,255,0.92);
  --ticker-label-bg: rgba(255,255,255,0.12);
  --green-dim:  rgba(45,106,79,0.15);
}

*,*::before,*::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  min-height: 100dvh;
  overflow-x: hidden;
  transition: background 300ms var(--ease), color 300ms var(--ease);
}
button { cursor: pointer; background: none; border: none; font: inherit; color: inherit; }
img,svg { display: block; }

/* ─────────────────────────────────────────
   VARIANT SWITCHER (floating pill)
───────────────────────────────────────── */
.switcher {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 9999;
  display: flex;
  align-items: center;
  gap: 2px;
  background: var(--surface);
  border: 1px solid var(--border-med);
  border-radius: 40px;
  padding: 5px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.15);
}
.sw-label {
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--text-3);
  padding: 0 10px 0 8px;
  white-space: nowrap;
}
.sw-btn {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.5px;
  padding: 7px 14px;
  border-radius: 32px;
  color: var(--text-3);
  transition: all 180ms var(--ease);
  white-space: nowrap;
}
.sw-btn:hover { color: var(--text); }
.sw-btn.active {
  background: linear-gradient(135deg, #4a7a5e, #2D6A4F);
  color: #fff;
}

/* ─────────────────────────────────────────
   TICKER
───────────────────────────────────────── */
.ticker {
  height: 30px;
  background: var(--ticker-bg);
  color: var(--ticker-fg);
  display: flex;
  align-items: center;
  overflow: hidden;
  position: relative;
  transition: background 300ms var(--ease);
}
.ticker-label {
  background: linear-gradient(135deg, #4a7a5e, #2D6A4F);
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  padding: 0 14px;
  height: 100%;
  display: flex;
  align-items: center;
  flex-shrink: 0;
  white-space: nowrap;
  z-index: 2;
}
.ticker-mask {
  overflow: hidden;
  flex: 1;
  -webkit-mask-image: linear-gradient(90deg, transparent 0%, black 4%, black 96%, transparent 100%);
  mask-image: linear-gradient(90deg, transparent 0%, black 4%, black 96%, transparent 100%);
}
.ticker-track {
  display: flex;
  white-space: nowrap;
  animation: tick 20s linear infinite;
}
.ticker-track:hover { animation-play-state: paused; }
.ticker-item {
  display: inline-flex;
  align-items: center;
  padding: 0 28px;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.2px;
  opacity: 0.8;
  transition: opacity 150ms;
}
.ticker-item { cursor: pointer; }
.ticker-item:hover { opacity: 1; text-decoration: underline; }
.ticker-source {
  font-weight: 700;
  margin-right: 10px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  font-size: 8px;
  padding: 2px 7px;
  border-radius: 3px;
  flex-shrink: 0;
  background: rgba(255,255,255,0.08);
  opacity: 0.9;
}
/* Source colours — all white */
.ticker-source { color: rgba(255,255,255,0.9); }

@keyframes tick { 0% { transform: translateX(0); } 100% { transform: translateX(-50%); } }

/* ─────────────────────────────────────────
   APP SHELL VARIANTS
───────────────────────────────────────── */

/* ── VARIANT A + B: Standard top-nav layout ── */
[data-variant="a"] .shell,
[data-variant="b"] .shell {
  display: flex;
  flex-direction: column;
  min-height: calc(100dvh - 30px);
}

[data-variant="a"] .app-header,
[data-variant="b"] .app-header {
  height: 58px;
  background: var(--header-bg);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  position: sticky;
  top: 0;
  z-index: 50;
}

/* ── Castle-vibe: subtle + grid + mint wash ── */
.main {
  background-image:
    radial-gradient(ellipse 80% 40% at 50% 0%, oklch(93% 0.025 155 / 0.55) 0%, transparent 70%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='32'%3E%3Ctext x='13' y='20' font-size='10' fill='%232D6A4F' opacity='0.07' font-family='sans-serif'%3E%2B%3C/text%3E%3C/svg%3E");
  background-repeat: no-repeat, repeat;
  background-size: 100% 480px, 32px 32px;
}
[data-theme="dark"] .main {
  background-image:
    radial-gradient(ellipse 80% 40% at 50% 0%, oklch(30% 0.04 155 / 0.25) 0%, transparent 70%);
  background-repeat: no-repeat;
  background-size: 100% 480px;
}

[data-variant="a"] .main,
[data-variant="b"] .main {
  flex: 1;
  padding: 0 32px 60px;
  max-width: 960px;
  margin: 0 auto;
  width: 100%;
}

/* ── VARIANT C: Sidebar layout ── */
[data-variant="c"] .shell {
  display: flex;
  flex-direction: row;
  height: calc(100dvh - 30px);
  overflow: hidden;
}
[data-variant="c"] .app-header { display: none; }

[data-variant="c"] .sidebar {
  width: 220px;
  flex-shrink: 0;
  border-right: 1px solid var(--border-med);
  background: var(--surface);
  display: flex;
  flex-direction: column;
  padding: 28px 0;
  position: sticky;
  top: 0;
  height: calc(100dvh - 30px);
  overflow-y: auto;
}
[data-variant="c"] .main {
  flex: 1;
  padding: 0 40px 60px;
  overflow-y: auto;
  min-width: 0;
}

/* ─────────────────────────────────────────
   LOGO
───────────────────────────────────────── */
.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}
.logo-mark {
  width: 30px;
  height: 30px;
  background: linear-gradient(135deg, #4a7a5e 0%, #2D6A4F 100%);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 2px 12px rgba(45,106,79,0.35);
}
.logo-mark svg { width: 15px; height: 15px; }
.logo-word {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--text);
}
.logo-word em {
  font-style: normal;
  color: var(--green);
}

/* ─────────────────────────────────────────
   NAV TABS (top)
───────────────────────────────────────── */
.nav-tabs {
  display: flex;
  align-items: center;
  gap: 0;
}
[data-variant="a"] .nav-tabs,
[data-variant="b"] .nav-tabs {
  /* Centered pill group */
}
.nav-tab {
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 600;
  color: var(--text-2);
  padding: 8px 20px;
  border-radius: 8px;
  transition: color 150ms var(--ease), background 150ms var(--ease), box-shadow 150ms var(--ease);
  letter-spacing: -0.01em;
  position: relative;
}
.nav-tab:hover { color: var(--text); background: var(--green-dim); }
.nav-tab.active {
  color: var(--green);
  font-weight: 700;
  background: var(--green-dim);
  box-shadow: inset 0 0 0 1.5px rgba(45,106,79,0.25);
}
.nav-tab.active::after { display: none; }
[data-variant="b"] .nav-tab.active::after { display: none; }

/* ── Quick-action toolbar (top-right) ── */
.qa-toolbar {
  position: fixed;
  top: 30px;
  right: 0;
  z-index: 8000;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  background: var(--surface, #fefcf9);
  border: 1px solid var(--border-med, rgba(0,0,0,0.12));
  border-top: none;
  border-right: none;
  border-radius: 0 0 0 8px;
  padding: 2px;
  box-shadow: -2px 2px 8px rgba(0,0,0,0.08);
  opacity: 0.35;
  transition: opacity 200ms ease;
}
.qa-toolbar:hover { opacity: 1; }
[data-theme="dark"] .qa-toolbar {
  background: #1e1b18;
  border-color: rgba(255,255,255,0.1);
  box-shadow: -2px 2px 12px rgba(0,0,0,0.4);
}
.qa-btn {
  width: 24px;
  height: 24px;
  border-radius: 5px;
  border: none;
  background: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-3, #9a9590);
  transition: all 150ms var(--ease);
  position: relative;
  flex-shrink: 0;
}
.qa-btn:hover { background: var(--green-dim, rgba(45,106,79,0.07)); color: var(--text, #1a1814); }
.qa-btn.active { background: var(--green-dim, rgba(45,106,79,0.07)); color: var(--green, #2D6A4F); }
.qa-btn svg { width: 12px; height: 12px; }
.qa-divider { width: 1px; height: 14px; background: var(--border, rgba(0,0,0,0.08)); margin: 0 1px; flex-shrink: 0; }
.qa-tooltip {
  position: absolute;
  top: 50%;
  right: calc(100% + 8px);
  left: auto;
  bottom: auto;
  transform: translateY(-50%);
  background: var(--text, #1a1814);
  color: #fff;
  font-size: 10px;
  font-weight: 600;
  font-family: var(--font-body);
  white-space: nowrap;
  padding: 4px 8px;
  border-radius: 5px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 120ms ease;
  letter-spacing: 0.01em;
}
.qa-btn:hover .qa-tooltip { opacity: 1; }
[data-theme="dark"] .qa-tooltip {
  background: #1a1814;
  color: #f9f7f4;
  border: 1px solid rgba(255,255,255,0.1);
  box-shadow: 0 4px 12px rgba(0,0,0,0.4);
}
@media print { .qa-toolbar { display: none !important; } }

/* Snapshot print styles */
@media print {
  body.printing-snapshot > *:not(#snapshotPrintDoc) { display: none !important; }
  #snapshotPrintDoc { display: block !important; position: static !important; background: #fff !important; }
  #snapshotPrintDoc button { display: none !important; }
  @page { size: A4 portrait; margin: 1cm; }
}

/* ─────────────────────────────────────────
   HEADER META
───────────────────────────────────────── */
.header-meta {
  display: flex;
  align-items: center;
  gap: 16px;
}
.live-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: linear-gradient(135deg, #4a7a5e, #2D6A4F);
  animation: blink 2.5s ease-in-out infinite;
  box-shadow: 0 0 6px rgba(45,106,79,0.5);
}
@keyframes blink { 0%,100%{opacity:1} 50%{opacity:0.3} }
.header-time {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-3);
  letter-spacing: 0.5px;
}
.user-btn {
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-2);
  padding: 5px 12px;
  border: 1px solid var(--border);
  border-radius: 20px;
  transition: border-color 150ms var(--ease), color 150ms var(--ease);
}
.user-btn:hover { border-color: var(--border-med); color: var(--text); }

