@import url('/fonts/fonts.css');

:root {
  /* Swiss Private Quant — Light Mode (Day 06h–18h) */
  --bg-page: #F6F5F1;
  --bg-surface: #FFFFFF;
  --bg-elevated: #FFFFFF;
  --bg-subtle: #EEEDE8;
  --bg-topbar: rgba(255, 255, 255, 0.92);
  --bg-bottom-nav: rgba(255, 255, 255, 0.96);
  --bg-obsidian: #0B1220;
  --bg-obsidian-2: #111B2E;
  --bg-obsidian-card: #162238;

  --ink-primary: #0B1220;
  --ink-secondary: #3E4C63;
  --ink-muted: #5A677D;
  --ink-on-dark: #F8FAFC;
  --ink-on-dark-muted: #9FB0C9;

  --border-light: #E4E1DA;
  --border-strong: #CEC9BE;
  --border-dark: rgba(255, 255, 255, 0.12);

  /* Semantic Status Colors */
  --brand-emerald: #0B6E4F;
  --brand-emerald-bright: #10B981;
  --brand-emerald-bg: #E7F6F0;
  --brand-gold: #9A7228;
  --brand-gold-bright: #D4AF37;
  --brand-gold-bg: #FAF3E0;
  --brand-rose: #B91C1C;
  --brand-rose-bright: #EF4444;
  --brand-rose-bg: #FDECEC;
  --brand-amber: #B45309;
  --brand-amber-bg: #FEF3C7;
  --brand-blue: #1D4ED8;
  --brand-blue-bg: #EFF6FF;

  /* Chart Surface Tokens */
  --chart-bg: #FFFFFF;
  --chart-grid: rgba(15, 23, 42, 0.06);
  --chart-text: #475569;
  --chart-border: #E2E8F0;

  /* Typography */
  --font-serif: 'Newsreader', Georgia, 'Times New Roman', serif;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;

  /* Radii & Elevation */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 22px;
  --radius-pill: 999px;
  --shadow-xs: 0 1px 2px rgba(11, 18, 32, 0.05);
  --shadow-sm: 0 4px 12px rgba(11, 18, 32, 0.06);
  --shadow-md: 0 12px 32px rgba(11, 18, 32, 0.10);
  --shadow-lg: 0 24px 60px rgba(11, 18, 32, 0.18);
}

/* Institutional Dark Mode (Auto Night 18h–06h or User Choice) */
html[data-theme="dark"] {
  color-scheme: dark;
  --bg-page: #070B12;
  --bg-surface: #0F1624;
  --bg-elevated: #151F32;
  --bg-subtle: #182336;
  --bg-topbar: rgba(10, 15, 24, 0.90);
  --bg-bottom-nav: rgba(10, 15, 24, 0.95);
  --bg-obsidian: #0E1729;
  --bg-obsidian-2: #131F36;
  --bg-obsidian-card: #18253E;

  --ink-primary: #F1F5F9;
  --ink-secondary: #CBD5E1;
  --ink-muted: #8FA1BA;
  --ink-on-dark: #F8FAFC;
  --ink-on-dark-muted: #94A3B8;

  --border-light: rgba(148, 163, 184, 0.14);
  --border-strong: rgba(148, 163, 184, 0.26);
  --border-dark: rgba(255, 255, 255, 0.12);

  --brand-emerald: #10B981;
  --brand-emerald-bright: #34D399;
  --brand-emerald-bg: rgba(16, 185, 129, 0.15);
  --brand-gold: #F5C451;
  --brand-gold-bright: #FBBF24;
  --brand-gold-bg: rgba(245, 196, 81, 0.14);
  --brand-rose: #F87171;
  --brand-rose-bright: #EF4444;
  --brand-rose-bg: rgba(239, 68, 68, 0.15);
  --brand-amber: #FBBF24;
  --brand-amber-bg: rgba(245, 158, 11, 0.15);
  --brand-blue: #60A5FA;
  --brand-blue-bg: rgba(59, 130, 246, 0.16);

  --chart-bg: #0A0F1A;
  --chart-grid: rgba(148, 163, 184, 0.08);
  --chart-text: #94A3B8;
  --chart-border: rgba(148, 163, 184, 0.16);

  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.35);
  --shadow-sm: 0 4px 16px rgba(0, 0, 0, 0.42);
  --shadow-md: 0 12px 34px rgba(0, 0, 0, 0.55);
  --shadow-lg: 0 24px 64px rgba(0, 0, 0, 0.7);
}

*, *::before, *::after { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; scroll-behavior: smooth; background: var(--bg-page); }
body {
  margin: 0;
  font-family: var(--font-sans);
  background: var(--bg-page);
  color: var(--ink-primary);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
[dir="rtl"] body { direction: rtl; text-align: right; }

.num, .tabular {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1, "lnum" 1;
}
.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.serif { font-family: var(--font-serif); }

a { color: var(--brand-emerald); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font-family: inherit; cursor: pointer; }
img, svg { max-width: 100%; display: block; }
img { height: auto; }

:focus-visible {
  outline: 2px solid var(--brand-emerald);
  outline-offset: 2px;
}

/* Badges */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: var(--radius-pill);
  font-size: 11.5px; font-weight: 700; letter-spacing: 0.01em;
  white-space: nowrap;
}
.badge--green { background: var(--brand-emerald-bg); color: var(--brand-emerald); }
.badge--amber { background: var(--brand-amber-bg); color: var(--brand-amber); }
.badge--red { background: var(--brand-rose-bg); color: var(--brand-rose); }
.badge--blue { background: var(--brand-blue-bg); color: var(--brand-blue); }
.badge--gold { background: var(--brand-gold-bg); color: var(--brand-gold); }
.badge--neutral { background: var(--bg-subtle); color: var(--ink-secondary); }
.badge--dark { background: rgba(255,255,255,0.1); color: #E2E8F0; border: 1px solid rgba(255,255,255,0.14); }

/* Live Pulse Dot */
.dot-pulse {
  width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex-shrink: 0;
  background: var(--brand-emerald-bright);
  box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.55);
  animation: cipdPulse 2s infinite;
}
.dot-pulse--amber { background: #F59E0B; box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.5); }
.dot-pulse--red { background: #EF4444; box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.5); }
@keyframes cipdPulse {
  0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.55); }
  70% { box-shadow: 0 0 0 7px rgba(16, 185, 129, 0); }
  100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 18px; border-radius: var(--radius-md);
  font-size: 14px; font-weight: 600; border: 1px solid transparent;
  transition: transform 0.12s ease, background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
  text-decoration: none !important;
  min-height: 44px;
}
.btn:active { transform: scale(0.975); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }
.btn--primary { background: var(--bg-obsidian); color: #FFFFFF; }
html[data-theme="dark"] .btn--primary { background: #10B981; color: #051610; }
.btn--primary:hover:not(:disabled) { filter: brightness(1.08); }
.btn--emerald { background: #0B6E4F; color: #FFFFFF; }
html[data-theme="dark"] .btn--emerald { background: #10B981; color: #051610; }
.btn--emerald:hover:not(:disabled) { filter: brightness(1.08); }
.btn--outline { background: var(--bg-surface); color: var(--ink-primary); border-color: var(--border-strong); }
.btn--outline:hover:not(:disabled) { background: var(--bg-subtle); border-color: var(--ink-secondary); }
.btn--ghost { background: transparent; color: var(--ink-secondary); }
.btn--ghost:hover:not(:disabled) { background: var(--bg-subtle); color: var(--ink-primary); }
.btn--danger { background: var(--brand-rose-bg); color: var(--brand-rose); border-color: rgba(239, 68, 68, 0.35); }
.btn--danger:hover:not(:disabled) { filter: brightness(0.96); }
.btn--danger-solid { background: #DC2626; color: #FFFFFF; }
.btn--danger-solid:hover:not(:disabled) { background: #B91C1C; }
.btn--sm { min-height: 34px; padding: 6px 12px; font-size: 12.5px; border-radius: var(--radius-sm); }
.btn--lg { min-height: 50px; padding: 14px 24px; font-size: 15px; }
.btn--block { width: 100%; }

/* Form Inputs */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label { font-size: 13px; font-weight: 600; color: var(--ink-secondary); }
.input, .select, .textarea {
  width: 100%; min-height: 44px; padding: 10px 13px;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--bg-surface); color: var(--ink-primary);
  font-family: inherit; font-size: 15px; transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.input:focus, .select:focus, .textarea:focus {
  outline: none; border-color: var(--brand-emerald);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.18);
}
.textarea { min-height: 92px; resize: vertical; }

/* Cards */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 18px;
  box-shadow: var(--shadow-xs);
}
.card--dark {
  background: var(--bg-obsidian);
  border-color: var(--border-dark);
  color: var(--ink-on-dark);
}
.card--subtle {
  background: var(--bg-subtle);
  border-color: var(--border-light);
  box-shadow: none;
}

/* Price Tick Flash */
@keyframes tickFlashGreen { 0% { color: #10B981; } 100% { color: inherit; } }
@keyframes tickFlashRed { 0% { color: #EF4444; } 100% { color: inherit; } }
.tick-up { animation: tickFlashGreen 0.7s ease-out; }
.tick-down { animation: tickFlashRed 0.7s ease-out; }
