/* ═══════════════════════════════════════════════════════════════
   ARVO DESIGN SYSTEM — "Obsidian Aurora"
   Deep obsidian foundation with electric cyan intelligence accent.
   Futuristic, confident, precision-engineered.
═══════════════════════════════════════════════════════════════ */
:root {
  /* Core surfaces — deep violet-obsidian */
  --void: #06060e;
  --s0: #0a0b16;
  --s1: #0f1120;
  --s2: #161929;
  --s3: #1c2035;
  --s4: #242842;

  /* Primary accent — luminous violet */
  --accent: #a78bfa;
  --accent-dim: rgba(167,139,250,.08);
  --accent-glow: rgba(167,139,250,.22);
  --accent-border: rgba(167,139,250,.18);
  --accent-solid: #8b6cf7;

  /* Secondary — electric cyan */
  --blue: #38bdf8;
  --blue-dim: rgba(56,189,248,.07);
  --blue-glow: rgba(56,189,248,.18);

  /* Tertiary — warm amber for data highlights */
  --amber: #f0a030;
  --amber-dim: rgba(240,160,48,.08);

  /* Semantic */
  --green: #34d399;
  --green-dim: rgba(52,211,153,.08);
  --green-border: rgba(52,211,153,.18);
  --red: #f87171;
  --red-dim: rgba(248,113,113,.08);
  --red-border: rgba(248,113,113,.18);
  --gold: #fbbf24;
  --gold-dim: rgba(251,191,36,.08);
  --gold-border: rgba(251,191,36,.18);

  /* Text hierarchy */
  --t1: #f0f0f8;
  --t2: #9094b0;
  --t3: #555878;
  --t4: #303354;

  /* Borders */
  --border: rgba(167,139,250,.06);
  --border-2: rgba(167,139,250,.03);

  /* Glass effect */
  --glass: rgba(15,17,32,.72);
  --glass-border: rgba(167,139,250,.08);
  --glass-blur: 20px;

  /* Layout */
  --sidebar-w: 260px;
  --topbar-h: 56px;
  --r: 12px;
  --r-lg: 16px;
  --r-sm: 8px;
  --r-xs: 6px;

  /* Type — distinctive pairing */
  --font: 'DM Sans', system-ui, sans-serif;
  --font-display: 'Outfit', sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

  /* Depth */
  --shadow: 0 4px 24px rgba(0,0,0,.5);
  --shadow-lg: 0 16px 64px rgba(6,6,14,.8);
  --shadow-glow: 0 0 40px rgba(167,139,250,.1);
  --shadow-card: 0 2px 16px rgba(6,6,14,.5), 0 0 0 1px var(--border);

  /* Gradients */
  --grad-accent: linear-gradient(135deg, #8b6cf7, #38bdf8);
  --grad-surface: linear-gradient(180deg, var(--s1), var(--s0));
  --grad-glow: radial-gradient(ellipse at 50% 0%, rgba(167,139,250,.06) 0%, transparent 70%);
  --grad-card: linear-gradient(135deg, rgba(167,139,250,.04) 0%, rgba(56,189,248,.02) 100%);
  --grad-warm: linear-gradient(135deg, rgba(248,113,113,.05), rgba(251,191,36,.04));
  --grad-cool: linear-gradient(135deg, rgba(52,211,153,.05), rgba(56,189,248,.04));
}

/* ── RESET ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; overflow: hidden; background: var(--void); }
body {
  font-family: var(--font);
  color: var(--t1);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

/* Scrollbar — sleek */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--s4); border-radius: 2px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent-border); }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
input, textarea, select, button { font-family: inherit; font-size: inherit; }

/* ── UTILITY ── */
.g { color: var(--green) !important; }
.r { color: var(--red) !important; }
.a { color: var(--gold) !important; }
.mono { font-family: var(--font-mono); }
.dim { color: var(--t3); }
.text-xs { font-size: 11px; }
.text-2xs { font-size: 10px; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.hidden { display: none !important; }

/* ── AI TAG ── */
.ai-tag {
  display: inline-block;
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--accent-dim);
  border: 1px solid var(--accent-border);
  padding: 2px 8px;
  border-radius: 4px;
  vertical-align: middle;
  font-family: var(--font-mono);
  box-shadow: 0 0 12px rgba(167,139,250,.08);
}

/* ── BUTTONS ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  border-radius: var(--r-sm);
  border: 1px solid var(--border);
  background: var(--s2);
  color: var(--t1);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all .2s ease;
  white-space: nowrap;
  position: relative;
  overflow: hidden;
}
.btn:hover { background: var(--s3); border-color: var(--accent-border); }
.btn-primary {
  background: var(--grad-accent);
  color: #fff;
  border-color: transparent;
  font-weight: 700;
  box-shadow: 0 2px 12px rgba(139,108,247,.2);
}
.btn-primary:hover { opacity: .92; box-shadow: 0 4px 24px rgba(139,108,247,.3), var(--shadow-glow); }
.btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--t2);
}
.btn-ghost:hover { background: var(--s2); color: var(--t1); }
.btn-danger {
  background: var(--red-dim);
  color: var(--red);
  border-color: var(--red-border);
}

/* ── CARDS — glass morphism ── */
.card {
  background: var(--glass);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--glass-border);
  border-radius: var(--r-lg);
  padding: 20px;
  position: relative;
  box-shadow: var(--shadow-card);
}
.card::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(135deg, rgba(167,139,250,.05) 0%, rgba(56,189,248,.03) 50%, transparent 100%);
  pointer-events: none;
  opacity: 0;
  transition: opacity .35s;
}
.card:hover::before { opacity: 1; }
.card:hover {
  border-color: var(--accent-border);
  box-shadow: var(--shadow-card), var(--shadow-glow);
}

/* ── INPUTS ── */
.input, input[type="text"], input[type="number"], input[type="email"],
input[type="password"], textarea, select {
  width: 100%;
  padding: 10px 14px;
  background: rgba(6,6,14,.5);
  border: 1px solid rgba(167,139,250,.08);
  border-radius: var(--r-sm);
  color: var(--t1);
  font-size: 13px;
  outline: none;
  transition: border-color .2s, box-shadow .2s, background .2s;
}
input:focus, textarea:focus, select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(167,139,250,.08), 0 0 16px rgba(139,108,247,.06);
  background: rgba(6,6,14,.7);
}
input::placeholder, textarea::placeholder {
  color: var(--t3);
  opacity: .6;
}
input:disabled {
  opacity: .5;
  cursor: not-allowed;
}

/* ── SPINNER ── */
.spin {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid var(--t4);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── TOAST ── */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  border-radius: var(--r);
  padding: 14px 22px;
  font-size: 13px;
  color: var(--t1);
  z-index: 9999;
  animation: toastIn .35s cubic-bezier(.34,1.56,.64,1);
  box-shadow: var(--shadow-lg);
}
.toast.success { border-color: var(--green-border); }
.toast.error { border-color: var(--red-border); }
@keyframes toastIn {
  from { opacity: 0; transform: translateY(16px) scale(.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* ── Ambient noise texture ── */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  background: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.015'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 10000;
  opacity: .3;
}

/* ── Focus ring ── */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
