:root,
[data-theme="dark"] {
  --bg: #0b1220;
  --surface: #111827;
  --surface-2: #0f172a;
  --bg-elevated: var(--surface);
  --bg-panel: rgba(17, 24, 39, 0.92);
  --bg-soft: rgba(148, 163, 184, 0.06);
  --bg-mute: rgba(148, 163, 184, 0.1);
  --border: rgba(148, 163, 184, 0.14);
  --border-strong: rgba(148, 163, 184, 0.24);
  --text: #e5e7eb;
  --muted: #94a3b8;
  --text-muted: var(--muted);
  --text-dim: #64748b;
  --heading: #f8fafc;
  --accent: #14b8a6;
  --accent-2: #0d9488;
  --accent-soft: rgba(20, 184, 166, 0.14);
  --up: #22c55e;
  --down: #ef4444;
  --success: var(--up);
  --success-soft: rgba(34, 197, 94, 0.14);
  --danger: var(--down);
  --danger-soft: rgba(239, 68, 68, 0.14);
  --warning: #f59e0b;
  --radius: 10px;
  --radius-sm: 8px;
  --radius-md: var(--radius);
  --radius-lg: 12px;
  --radius-xl: 16px;
  --shadow: 0 12px 40px -20px rgba(0, 0, 0, 0.55);
  --nav-bg: rgba(11, 18, 32, 0.88);
  --bottom-nav-bg: rgba(15, 23, 42, 0.94);
  --input-bg: rgba(2, 6, 23, 0.45);
  --table-hover: rgba(20, 184, 166, 0.06);
  --overlay: rgba(2, 6, 23, 0.6);
  --font: 'Inter', system-ui, sans-serif;
  --font-display: 'Instrument Sans', 'Inter', system-ui, sans-serif;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --bottom-nav-h: 64px;
  --top-nav-h: 60px;
  --space: 8px;
  color-scheme: dark;
}

[data-theme="light"] {
  --bg: #f1f5f9;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --bg-elevated: var(--surface);
  --bg-panel: rgba(255, 255, 255, 0.94);
  --bg-soft: rgba(15, 23, 42, 0.04);
  --bg-mute: rgba(15, 23, 42, 0.07);
  --border: rgba(15, 23, 42, 0.1);
  --border-strong: rgba(15, 23, 42, 0.16);
  --text: #334155;
  --muted: #64748b;
  --text-muted: var(--muted);
  --text-dim: #94a3b8;
  --heading: #0f172a;
  --accent: #0f766e;
  --accent-2: #0d9488;
  --accent-soft: rgba(15, 118, 110, 0.1);
  --up: #16a34a;
  --down: #dc2626;
  --success: var(--up);
  --success-soft: rgba(22, 163, 74, 0.12);
  --danger: var(--down);
  --danger-soft: rgba(220, 38, 38, 0.1);
  --warning: #d97706;
  --shadow: 0 14px 36px -22px rgba(15, 23, 42, 0.28);
  --nav-bg: rgba(255, 255, 255, 0.9);
  --bottom-nav-bg: rgba(255, 255, 255, 0.96);
  --input-bg: rgba(15, 23, 42, 0.04);
  --table-hover: rgba(15, 118, 110, 0.05);
  --overlay: rgba(15, 23, 42, 0.4);
  color-scheme: light;
}

*,
*::before,
*::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

body.app-shell {
  padding-bottom: calc(var(--bottom-nav-h) + var(--safe-bottom));
}

body.app-shell.no-bottom-nav,
body.no-bottom-nav {
  padding-bottom: 0;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; }

button,
[role="button"],
a.btn,
.chip,
.tab,
.fav-btn,
.more-item,
.icon-btn,
.bottom-nav a,
.bottom-nav button,
.nav-links a,
.table tbody tr[data-href],
.ob-row {
  cursor: pointer;
}

button:disabled,
.btn:disabled,
[aria-disabled="true"] {
  cursor: not-allowed;
  opacity: 0.5;
  pointer-events: none;
}

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

::selection {
  background: rgba(20, 184, 166, 0.28);
  color: #ecfeff;
}

.is-up, .text-up { color: var(--up) !important; }
.is-down, .text-down { color: var(--down) !important; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
