/* ═══════════════════════════════════════════════════════════════════════
   Sonora — design tokens, reset and shared components
   ═══════════════════════════════════════════════════════════════════════ */

:root {
  /* Surfaces, darkest to lightest */
  --bg-void: #05070f;
  --bg-deep: #0a0e1d;
  --bg-panel: rgba(19, 25, 48, 0.72);
  --bg-panel-solid: #131930;
  --bg-raised: rgba(31, 40, 74, 0.66);
  --bg-input: rgba(8, 12, 26, 0.72);
  --bg-hover: rgba(139, 92, 246, 0.1);

  /* Lines */
  --line: rgba(148, 163, 208, 0.14);
  --line-strong: rgba(148, 163, 208, 0.26);
  --line-glow: rgba(139, 92, 246, 0.45);

  /* Text */
  --text: #e8ecf8;
  --text-dim: #a5b0cf;
  --text-faint: #6b7699;

  /* Brand */
  --cyan: #22d3ee;
  --cyan-soft: #67e8f9;
  --violet: #8b5cf6;
  --violet-soft: #c084fc;
  --amber: #fbbf24;
  --rose: #fb7185;
  --emerald: #34d399;

  --grad-brand: linear-gradient(135deg, var(--cyan) 0%, var(--violet) 100%);
  --grad-brand-soft: linear-gradient(135deg, rgba(34, 211, 238, 0.18), rgba(139, 92, 246, 0.18));
  --grad-text: linear-gradient(120deg, #a5f3fc 0%, #c4b5fd 55%, #f0abfc 100%);

  /* Depth */
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.32);
  --shadow-md: 0 12px 34px rgba(0, 0, 0, 0.42);
  --shadow-lg: 0 28px 70px rgba(0, 0, 0, 0.56);
  --glow-cyan: 0 0 28px rgba(34, 211, 238, 0.34);
  --glow-violet: 0 0 30px rgba(139, 92, 246, 0.4);

  /* Geometry */
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 18px;
  --r-xl: 26px;
  --r-pill: 999px;

  /* Motion */
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
  --fast: 140ms;
  --mid: 260ms;
  --slow: 480ms;

  --font: 'Inter', 'Segoe UI Variable Display', 'Segoe UI', system-ui, -apple-system, sans-serif;
  --mono: 'JetBrains Mono', 'Cascadia Code', ui-monospace, 'SF Mono', Consolas, monospace;

  --topbar-h: 66px;
}

/* ── Reset ────────────────────────────────────────────────────────── */

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

* { margin: 0; padding: 0; }

html, body { height: 100%; }

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg-void);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

img, svg, canvas, audio, video { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
button { background: none; border: none; cursor: pointer; }
a { color: var(--cyan-soft); text-decoration: none; transition: color var(--fast) var(--ease); }
a:hover { color: #fff; }
ul, ol { list-style: none; }

:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 2px;
  border-radius: 4px;
}

::selection { background: rgba(139, 92, 246, 0.42); color: #fff; }

::-webkit-scrollbar { width: 11px; height: 11px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, rgba(139, 92, 246, 0.5), rgba(34, 211, 238, 0.4));
  border: 3px solid transparent;
  border-radius: var(--r-pill);
  background-clip: content-box;
}
::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, rgba(139, 92, 246, 0.8), rgba(34, 211, 238, 0.7));
  background-clip: content-box;
}
* { scrollbar-width: thin; scrollbar-color: rgba(139, 92, 246, 0.55) transparent; }

/* ── Animated backdrop ────────────────────────────────────────────── */

.aurora {
  position: fixed;
  inset: 0;
  z-index: -2;
  overflow: hidden;
  background:
    radial-gradient(1200px 800px at 12% -10%, rgba(34, 211, 238, 0.14), transparent 60%),
    radial-gradient(1000px 700px at 92% 8%, rgba(139, 92, 246, 0.18), transparent 62%),
    radial-gradient(900px 900px at 50% 120%, rgba(236, 72, 153, 0.1), transparent 60%),
    var(--bg-void);
}

.aurora::after {
  /* Fine grain keeps the large gradients from banding on wide monitors. */
  content: '';
  position: absolute;
  inset: -50%;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)' opacity='0.5'/%3E%3C/svg%3E");
  opacity: 0.035;
  pointer-events: none;
}

.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.5;
  will-change: transform;
}
.orb-1 { width: 46vw; height: 46vw; left: -10vw; top: -12vw; background: radial-gradient(circle, rgba(34, 211, 238, 0.5), transparent 68%); animation: drift-a 26s var(--ease-in-out) infinite; }
.orb-2 { width: 40vw; height: 40vw; right: -8vw; top: 4vh; background: radial-gradient(circle, rgba(139, 92, 246, 0.55), transparent 68%); animation: drift-b 32s var(--ease-in-out) infinite; }
.orb-3 { width: 34vw; height: 34vw; left: 32vw; bottom: -16vw; background: radial-gradient(circle, rgba(236, 72, 153, 0.34), transparent 70%); animation: drift-c 38s var(--ease-in-out) infinite; }

@keyframes drift-a {
  0%, 100% { transform: translate3d(0, 0, 0) scale(1); }
  50% { transform: translate3d(8vw, 6vh, 0) scale(1.12); }
}
@keyframes drift-b {
  0%, 100% { transform: translate3d(0, 0, 0) scale(1.05); }
  50% { transform: translate3d(-7vw, 9vh, 0) scale(0.92); }
}
@keyframes drift-c {
  0%, 100% { transform: translate3d(0, 0, 0) scale(0.95); }
  50% { transform: translate3d(-6vw, -8vh, 0) scale(1.15); }
}

/* ── Typography ───────────────────────────────────────────────────── */

h1, h2, h3, h4 { font-weight: 650; line-height: 1.2; letter-spacing: -0.018em; }
h1 { font-size: clamp(1.9rem, 4.2vw, 2.9rem); }
h2 { font-size: 1.32rem; }
h3 { font-size: 1.06rem; }

.gradient-text {
  background: var(--grad-text);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.muted { color: var(--text-dim); }
.faint { color: var(--text-faint); }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.tabular { font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; }

.eyebrow {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-faint);
}

.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }

/* ── Brand mark ───────────────────────────────────────────────────── */

.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }

.brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  flex: none;
  box-shadow: var(--shadow-sm), 0 0 0 1px rgba(139, 92, 246, 0.3), var(--glow-violet);
  transition: transform var(--mid) var(--ease), box-shadow var(--mid) var(--ease);
}
.brand:hover .brand-mark { transform: rotate(-6deg) scale(1.06); box-shadow: var(--shadow-md), var(--glow-cyan); }

.brand-name {
  font-size: 1.16rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  background: var(--grad-text);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.brand-tag { font-size: 0.68rem; color: var(--text-faint); letter-spacing: 0.1em; text-transform: uppercase; }

/* ── Surfaces ─────────────────────────────────────────────────────── */

.panel {
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  box-shadow: var(--shadow-md);
}

.panel-pad { padding: 18px; }

.card {
  background: var(--bg-raised);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  transition: border-color var(--fast) var(--ease), transform var(--fast) var(--ease),
    box-shadow var(--fast) var(--ease), background var(--fast) var(--ease);
}

.divider { height: 1px; background: var(--line); border: none; margin: 14px 0; }

/* ── Buttons ──────────────────────────────────────────────────────── */

.btn {
  --btn-bg: var(--bg-raised);
  --btn-fg: var(--text);
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 16px;
  border-radius: var(--r-md);
  border: 1px solid var(--line-strong);
  background: var(--btn-bg);
  color: var(--btn-fg);
  font-size: 0.88rem;
  font-weight: 600;
  letter-spacing: -0.005em;
  white-space: nowrap;
  cursor: pointer;
  overflow: hidden;
  transition: transform var(--fast) var(--ease), box-shadow var(--fast) var(--ease),
    border-color var(--fast) var(--ease), background var(--fast) var(--ease), opacity var(--fast);
}

.btn:hover:not(:disabled) { transform: translateY(-1px); border-color: var(--line-glow); box-shadow: var(--shadow-sm); }
.btn:active:not(:disabled) { transform: translateY(0) scale(0.985); }
.btn:disabled { opacity: 0.42; cursor: not-allowed; }

/* A light sweep on hover — subtle, and only on the emphasised buttons. */
.btn-primary::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(110deg, transparent 20%, rgba(255, 255, 255, 0.35) 50%, transparent 80%);
  transform: translateX(-130%);
  transition: transform var(--slow) var(--ease);
}
.btn-primary:hover:not(:disabled)::after { transform: translateX(130%); }

.btn-primary {
  background: var(--grad-brand);
  border-color: transparent;
  color: #06101c;
  font-weight: 700;
  box-shadow: 0 6px 20px rgba(34, 211, 238, 0.24);
}
.btn-primary:hover:not(:disabled) { box-shadow: 0 10px 32px rgba(139, 92, 246, 0.42); }

.btn-ghost { background: transparent; border-color: transparent; color: var(--text-dim); }
.btn-ghost:hover:not(:disabled) { background: var(--bg-hover); color: var(--text); border-color: var(--line); }

.btn-outline { background: rgba(139, 92, 246, 0.08); border-color: var(--line-glow); color: var(--violet-soft); }
.btn-outline:hover:not(:disabled) { background: rgba(139, 92, 246, 0.16); color: #fff; }

.btn-danger { background: rgba(251, 113, 133, 0.12); border-color: rgba(251, 113, 133, 0.38); color: #fda4af; }
.btn-danger:hover:not(:disabled) { background: rgba(251, 113, 133, 0.22); color: #fff; }

.btn-sm { padding: 6px 11px; font-size: 0.8rem; border-radius: var(--r-sm); gap: 6px; }
.btn-lg { padding: 13px 26px; font-size: 0.98rem; border-radius: var(--r-lg); }
.btn-block { width: 100%; }

.btn-icon {
  width: 34px;
  height: 34px;
  padding: 0;
  flex: none;
  border-radius: var(--r-sm);
}
.btn-icon svg { width: 17px; height: 17px; }
.btn svg { flex: none; }

.btn.is-busy { pointer-events: none; color: transparent !important; }
.btn.is-busy::before {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.28);
  border-top-color: #fff;
  animation: spin 0.7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ── Segmented control ────────────────────────────────────────────── */

.segmented {
  display: inline-flex;
  padding: 3px;
  gap: 2px;
  background: var(--bg-input);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
}
.segmented button {
  padding: 6px 13px;
  border-radius: var(--r-sm);
  font-size: 0.81rem;
  font-weight: 600;
  color: var(--text-faint);
  transition: all var(--fast) var(--ease);
}
.segmented button:hover { color: var(--text); }
.segmented button[aria-pressed='true'] {
  background: var(--grad-brand-soft);
  color: #fff;
  box-shadow: inset 0 0 0 1px rgba(139, 92, 246, 0.42);
}

/* ── Forms ────────────────────────────────────────────────────────── */

.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }

.label {
  font-size: 0.74rem;
  font-weight: 650;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--text-faint);
}

.input,
.select,
textarea.input {
  width: 100%;
  padding: 10px 13px;
  background: var(--bg-input);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  color: var(--text);
  font-size: 0.9rem;
  transition: border-color var(--fast) var(--ease), box-shadow var(--fast) var(--ease), background var(--fast);
}
.input::placeholder { color: var(--text-faint); }
.input:hover, .select:hover { border-color: var(--line-strong); }
.input:focus, .select:focus {
  outline: none;
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.16);
  background: rgba(8, 12, 26, 0.9);
}

.select {
  appearance: none;
  padding-right: 34px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23a5b0cf' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 11px center;
  background-size: 15px;
  cursor: pointer;
}
.select option { background: var(--bg-panel-solid); color: var(--text); }

.input-icon { position: relative; }
.input-icon .input { padding-left: 38px; }
.input-icon svg {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--text-faint);
  pointer-events: none;
}

/* Range slider */
input[type='range'] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 22px;
  background: transparent;
  cursor: pointer;
}
input[type='range']::-webkit-slider-runnable-track {
  height: 5px;
  border-radius: var(--r-pill);
  background: linear-gradient(90deg, var(--cyan) 0%, var(--violet) var(--fill, 50%), rgba(148, 163, 208, 0.16) var(--fill, 50%));
}
input[type='range']::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 15px;
  height: 15px;
  margin-top: -5px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid var(--violet);
  box-shadow: 0 0 0 0 rgba(139, 92, 246, 0.35);
  transition: box-shadow var(--fast) var(--ease), transform var(--fast) var(--ease);
}
input[type='range']:hover::-webkit-slider-thumb { transform: scale(1.15); box-shadow: 0 0 0 6px rgba(139, 92, 246, 0.2); }
input[type='range']::-moz-range-track { height: 5px; border-radius: var(--r-pill); background: rgba(148, 163, 208, 0.16); }
input[type='range']::-moz-range-progress { height: 5px; border-radius: var(--r-pill); background: linear-gradient(90deg, var(--cyan), var(--violet)); }
input[type='range']::-moz-range-thumb {
  width: 13px; height: 13px; border-radius: 50%;
  background: #fff; border: 2px solid var(--violet); cursor: pointer;
}

/* Switch */
.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch .track {
  position: relative;
  width: 40px;
  height: 22px;
  flex: none;
  border-radius: var(--r-pill);
  background: rgba(148, 163, 208, 0.2);
  border: 1px solid var(--line);
  transition: background var(--mid) var(--ease), box-shadow var(--mid) var(--ease);
}
.switch .track::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #cbd5f5;
  transition: transform var(--mid) var(--ease), background var(--mid) var(--ease);
}
.switch input:checked + .track { background: var(--grad-brand); box-shadow: var(--glow-cyan); border-color: transparent; }
.switch input:checked + .track::after { transform: translateX(18px); background: #fff; }
.switch input:focus-visible + .track { outline: 2px solid var(--cyan); outline-offset: 2px; }
.switch .switch-label { font-size: 0.86rem; color: var(--text-dim); }
.switch:hover .switch-label { color: var(--text); }

/* Checkbox */
.check { display: inline-flex; align-items: center; gap: 9px; cursor: pointer; user-select: none; font-size: 0.86rem; }
.check input { position: absolute; opacity: 0; }
.check .box {
  width: 18px;
  height: 18px;
  flex: none;
  border-radius: 5px;
  border: 1.5px solid var(--line-strong);
  background: var(--bg-input);
  display: grid;
  place-items: center;
  transition: all var(--fast) var(--ease);
}
.check .box::after {
  content: '';
  width: 9px;
  height: 5px;
  border-left: 2px solid #06101c;
  border-bottom: 2px solid #06101c;
  transform: rotate(-45deg) scale(0);
  transition: transform var(--fast) var(--ease);
}
.check input:checked + .box { background: var(--grad-brand); border-color: transparent; }
.check input:checked + .box::after { transform: rotate(-45deg) scale(1); }
.check input:focus-visible + .box { outline: 2px solid var(--cyan); outline-offset: 2px; }

/* ── Badges and pills ─────────────────────────────────────────────── */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: var(--r-pill);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border: 1px solid transparent;
}
.badge-ready { background: rgba(52, 211, 153, 0.14); color: #6ee7b7; border-color: rgba(52, 211, 153, 0.3); }
.badge-working { background: rgba(34, 211, 238, 0.14); color: var(--cyan-soft); border-color: rgba(34, 211, 238, 0.3); }
.badge-failed { background: rgba(251, 113, 133, 0.14); color: #fda4af; border-color: rgba(251, 113, 133, 0.32); }
.badge-queued { background: rgba(148, 163, 208, 0.12); color: var(--text-dim); border-color: var(--line); }
.badge-video { background: rgba(139, 92, 246, 0.14); color: var(--violet-soft); border-color: rgba(139, 92, 246, 0.3); }
.badge-audio { background: rgba(251, 191, 36, 0.13); color: #fcd34d; border-color: rgba(251, 191, 36, 0.3); }

.dot { width: 7px; height: 7px; border-radius: 50%; flex: none; }
.dot-live { background: var(--emerald); box-shadow: 0 0 0 0 rgba(52, 211, 153, 0.6); animation: pulse 2s infinite; }
.dot-off { background: var(--text-faint); }

@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(52, 211, 153, 0.55); }
  70% { box-shadow: 0 0 0 8px rgba(52, 211, 153, 0); }
  100% { box-shadow: 0 0 0 0 rgba(52, 211, 153, 0); }
}

/* ── Progress ─────────────────────────────────────────────────────── */

.progress {
  position: relative;
  height: 6px;
  border-radius: var(--r-pill);
  background: rgba(148, 163, 208, 0.14);
  overflow: hidden;
}
.progress-bar {
  height: 100%;
  width: 0;
  border-radius: var(--r-pill);
  background: var(--grad-brand);
  transition: width var(--mid) var(--ease);
  position: relative;
  overflow: hidden;
}
.progress-bar::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.45), transparent);
  animation: shimmer 1.6s linear infinite;
}
.progress.is-done .progress-bar { background: linear-gradient(135deg, var(--emerald), #10b981); }
.progress.is-done .progress-bar::after { display: none; }
.progress.is-failed .progress-bar { background: linear-gradient(135deg, var(--rose), #e11d48); }
.progress.is-failed .progress-bar::after { display: none; }

@keyframes shimmer {
  from { transform: translateX(-100%); }
  to { transform: translateX(100%); }
}

/* ── Toasts ───────────────────────────────────────────────────────── */

.toasts {
  position: fixed;
  bottom: 22px;
  right: 22px;
  z-index: 900;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: min(400px, calc(100vw - 32px));
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  padding: 13px 15px;
  border-radius: var(--r-md);
  background: rgba(19, 25, 48, 0.94);
  border: 1px solid var(--line-strong);
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  pointer-events: auto;
  animation: toast-in var(--mid) var(--ease) both;
}
.toast.leaving { animation: toast-out 200ms var(--ease) forwards; }
.toast-icon { width: 19px; height: 19px; flex: none; margin-top: 1px; }
.toast-body { flex: 1; min-width: 0; font-size: 0.87rem; line-height: 1.45; }
.toast-title { font-weight: 650; margin-bottom: 2px; }
.toast-text { color: var(--text-dim); font-size: 0.83rem; overflow-wrap: anywhere; }
.toast-close { color: var(--text-faint); padding: 2px; border-radius: 5px; }
.toast-close:hover { color: var(--text); background: var(--bg-hover); }
.toast-success { border-left: 3px solid var(--emerald); }
.toast-success .toast-icon { color: var(--emerald); }
.toast-error { border-left: 3px solid var(--rose); }
.toast-error .toast-icon { color: var(--rose); }
.toast-info { border-left: 3px solid var(--cyan); }
.toast-info .toast-icon { color: var(--cyan); }
.toast-warn { border-left: 3px solid var(--amber); }
.toast-warn .toast-icon { color: var(--amber); }

@keyframes toast-in {
  from { opacity: 0; transform: translateX(30px) scale(0.96); }
  to { opacity: 1; transform: translateX(0) scale(1); }
}
@keyframes toast-out {
  to { opacity: 0; transform: translateX(30px) scale(0.96); }
}

/* ── Modal ────────────────────────────────────────────────────────── */

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 800;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(3, 5, 12, 0.72);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  animation: fade-in var(--fast) var(--ease);
}
.modal {
  width: min(520px, 100%);
  max-height: min(84vh, 760px);
  overflow: auto;
  padding: 24px;
  border-radius: var(--r-xl);
  background: var(--bg-panel-solid);
  border: 1px solid var(--line-strong);
  box-shadow: var(--shadow-lg), 0 0 0 1px rgba(139, 92, 246, 0.14);
  animation: modal-in var(--mid) var(--ease) both;
}
.modal-title { font-size: 1.16rem; font-weight: 680; margin-bottom: 6px; }
.modal-text { color: var(--text-dim); font-size: 0.9rem; margin-bottom: 20px; overflow-wrap: anywhere; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }

@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes modal-in {
  from { opacity: 0; transform: translateY(16px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* ── Empty state ──────────────────────────────────────────────────── */

.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 44px 22px;
  text-align: center;
  color: var(--text-faint);
}
.empty svg { width: 46px; height: 46px; opacity: 0.5; }
.empty h3 { color: var(--text-dim); font-weight: 600; }
.empty p { font-size: 0.87rem; max-width: 34ch; }

/* ── Sign-in page ─────────────────────────────────────────────────── */

.auth-page {
  min-height: 100dvh;
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  align-items: stretch;
}

.auth-hero {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 28px;
  padding: 6vh 5vw;
  overflow: hidden;
}
.auth-hero h1 { max-width: 15ch; }
.auth-hero .lede { font-size: 1.05rem; color: var(--text-dim); max-width: 46ch; }

.hero-points { display: flex; flex-direction: column; gap: 14px; margin-top: 6px; }
.hero-point { display: flex; gap: 13px; align-items: flex-start; animation: rise var(--slow) var(--ease) both; }
.hero-point:nth-child(1) { animation-delay: 0.1s; }
.hero-point:nth-child(2) { animation-delay: 0.2s; }
.hero-point:nth-child(3) { animation-delay: 0.3s; }
.hero-point:nth-child(4) { animation-delay: 0.4s; }
.hero-point .ico {
  width: 36px; height: 36px; flex: none;
  border-radius: 11px;
  display: grid; place-items: center;
  background: var(--grad-brand-soft);
  border: 1px solid var(--line-glow);
  color: var(--cyan-soft);
}
.hero-point .ico svg { width: 18px; height: 18px; }
.hero-point strong { display: block; font-weight: 620; font-size: 0.94rem; }
.hero-point span { font-size: 0.85rem; color: var(--text-faint); }

/* A slow, looping waveform behind the hero copy. */
.hero-wave { position: absolute; inset: auto 0 0 0; height: 34vh; opacity: 0.4; pointer-events: none; }
.hero-wave .bar {
  fill: url(#heroGrad);
  transform-origin: center;
  animation: bounce 1.8s var(--ease-in-out) infinite;
}

@keyframes bounce {
  0%, 100% { transform: scaleY(0.35); }
  50% { transform: scaleY(1); }
}
@keyframes rise {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}

.auth-panel-wrap {
  display: grid;
  place-items: center;
  padding: 5vh 4vw;
}
.auth-card {
  width: min(420px, 100%);
  padding: 34px;
  border-radius: var(--r-xl);
  background: rgba(15, 20, 40, 0.78);
  border: 1px solid var(--line-strong);
  backdrop-filter: blur(22px) saturate(150%);
  -webkit-backdrop-filter: blur(22px) saturate(150%);
  box-shadow: var(--shadow-lg), 0 0 0 1px rgba(139, 92, 246, 0.12);
  animation: rise var(--slow) var(--ease) both;
}
.auth-card .brand { justify-content: center; margin-bottom: 22px; }
.auth-card h2 { text-align: center; margin-bottom: 4px; }
.auth-card .sub { text-align: center; color: var(--text-faint); font-size: 0.87rem; margin-bottom: 24px; }
.auth-form { display: flex; flex-direction: column; gap: 15px; }

.auth-error {
  display: none;
  align-items: center;
  gap: 9px;
  padding: 10px 13px;
  border-radius: var(--r-md);
  background: rgba(251, 113, 133, 0.12);
  border: 1px solid rgba(251, 113, 133, 0.34);
  color: #fda4af;
  font-size: 0.86rem;
  animation: shake 0.4s var(--ease);
}
.auth-error.show { display: flex; }
.auth-error svg { width: 17px; height: 17px; flex: none; }

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-7px); }
  40% { transform: translateX(6px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(2px); }
}

.auth-foot { margin-top: 20px; text-align: center; font-size: 0.78rem; color: var(--text-faint); }

.pw-wrap { position: relative; }
.pw-toggle {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: var(--r-sm);
  color: var(--text-faint);
}
.pw-toggle:hover { color: var(--text); background: var(--bg-hover); }
.pw-toggle svg { width: 17px; height: 17px; }
.pw-wrap .input { padding-right: 42px; }

@media (max-width: 900px) {
  .auth-page { grid-template-columns: 1fr; }
  .auth-hero { display: none; }
  .auth-panel-wrap { min-height: 100dvh; }
}

/* ── 404 ──────────────────────────────────────────────────────────── */

.center-page {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px;
  text-align: center;
}
.center-page .code {
  font-size: clamp(4rem, 16vw, 9rem);
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.05em;
  background: var(--grad-text);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* ── Utilities ────────────────────────────────────────────────────── */

.row { display: flex; align-items: center; gap: 10px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.col { display: flex; flex-direction: column; gap: 10px; }
.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.hidden { display: none !important; }
.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

.skeleton {
  background: linear-gradient(90deg, rgba(148, 163, 208, 0.07) 25%, rgba(148, 163, 208, 0.16) 37%, rgba(148, 163, 208, 0.07) 63%);
  background-size: 400% 100%;
  animation: skeleton 1.4s ease infinite;
  border-radius: var(--r-sm);
}
@keyframes skeleton {
  from { background-position: 100% 50%; }
  to { background-position: 0 50%; }
}

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