/* ============================================================
   VoiceCast Panel v2 — Glossy Purple Theme
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

:root {
  /* ── Purple Palette ── */
  --purple-50:  #faf5ff;
  --purple-100: #f3e8ff;
  --purple-200: #e9d5ff;
  --purple-300: #d8b4fe;
  --purple-400: #c084fc;
  --purple-500: #a855f7;
  --purple-600: #9333ea;
  --purple-700: #7e22ce;
  --purple-800: #6b21a8;
  --purple-900: #581c87;
  --purple-950: #3b0764;

  /* ── Primary ── */
  --primary:        #9333ea;
  --primary-dark:   #7e22ce;
  --primary-darker: #6b21a8;
  --primary-light:  #faf5ff;
  --primary-glow:   rgba(147,51,234,.2);

  /* ── Sidebar / Topbar (deep purple-black, no navy) ── */
  --navy:       #12062a;
  --navy-light: #1c0d3a;
  --navy-border:#2d1560;

  /* ── Surfaces ── */
  --bg:         #f5f0ff;
  --surface:    #ffffff;
  --surface-2:  #faf5ff;
  --surface-3:  #f3e8ff;
  --border:     #e9d5ff;
  --border-2:   #d8b4fe;
  --divider:    #ede9f8;

  /* ── Text ── */
  --text:       #1e1030;
  --text-muted: #6b5e8a;
  --text-faint: #a897c8;
  --text-inv:   #ffffff;

  /* ── Status ── */
  --success:    #059669;
  --success-bg: #ecfdf5;
  --error:      #dc2626;
  --error-bg:   #fef2f2;
  --warning:    #d97706;
  --warning-bg: #fffbeb;
  --gold:       #b45309;
  --gold-bg:    #fef3c7;
  --blue:       #2563eb;
  --blue-bg:    #eff6ff;
  --cyan:       #0891b2;
  --cyan-bg:    #ecfeff;

  /* ── Gradients ── */
  --grad-primary:  linear-gradient(135deg, #9333ea 0%, #7e22ce 100%);
  --grad-blue:     linear-gradient(135deg, #a855f7 0%, #9333ea 50%, #7e22ce 100%);
  --grad-navy:     linear-gradient(180deg, #12062a 0%, #1c0d3a 60%, #230f45 100%);
  --grad-topbar:   linear-gradient(90deg,  #12062a 0%, #2d1260 100%);
  --grad-card-kpi: linear-gradient(135deg, #9333ea 0%, #c026d3 100%);
  --grad-success:  linear-gradient(135deg, #059669 0%, #10b981 100%);
  --grad-page:     linear-gradient(180deg, #ede9f8 0%, #f5f0ff 100%);
  --grad-glass:    linear-gradient(135deg, rgba(255,255,255,.18) 0%, rgba(255,255,255,.05) 100%);

  /* ── Shadows ── */
  --shadow-xs:  0 1px 2px rgba(0,0,0,.05);
  --shadow-sm:  0 1px 3px rgba(147,51,234,.08), 0 1px 2px rgba(0,0,0,.04);
  --shadow-md:  0 4px 16px rgba(147,51,234,.14), 0 2px 4px rgba(0,0,0,.05);
  --shadow-lg:  0 12px 32px rgba(147,51,234,.18), 0 4px 8px rgba(0,0,0,.06);
  --shadow-xl:  0 24px 64px rgba(147,51,234,.22),  0 8px 16px rgba(0,0,0,.08);
  --shadow-glow:0 0 0 3px rgba(147,51,234,.28);
  --shadow-card:0 2px 8px rgba(147,51,234,.07), 0 1px 3px rgba(0,0,0,.06);

  /* ── Radius ── */
  --r-sm:   .375rem;
  --r-md:   .625rem;
  --r-lg:   1rem;
  --r-xl:   1.25rem;
  --r-2xl:  1.5rem;
  --r-full: 9999px;

  /* Legacy aliases */
  --radius-sm:   var(--r-sm);
  --radius-md:   var(--r-md);
  --radius-lg:   var(--r-lg);
  --radius-xl:   var(--r-xl);
  --radius-full: var(--r-full);

  /* ── Spacing ── */
  --sp-1:.25rem; --sp-2:.5rem;  --sp-3:.75rem; --sp-4:1rem;
  --sp-5:1.25rem;--sp-6:1.5rem; --sp-8:2rem;   --sp-10:2.5rem;
  --sp-12:3rem;  --sp-16:4rem;

  /* ── Typography ── */
  --font: 'Inter', 'Satoshi', system-ui, sans-serif;
  --text-xs:   .78rem;
  --text-sm:   .9375rem;
  --text-base: 1.0625rem;
  --text-lg:   1.1875rem;
  --text-xl:   1.4rem;
  --text-2xl:  1.8rem;
  --text-3xl:  2.3rem;

  /* Legacy */
  --color-primary:           var(--primary);
  --color-primary-hover:     var(--primary-dark);
  --color-primary-active:    var(--primary-darker);
  --color-primary-highlight: var(--primary-light);
  --color-success:           var(--success);
  --color-success-highlight: var(--success-bg);
  --color-error:             var(--error);
  --color-error-highlight:   var(--error-bg);
  --color-warning:           var(--warning);
  --color-warning-highlight: var(--warning-bg);
  --color-gold:              var(--gold);
  --color-gold-highlight:    var(--gold-bg);
  --color-blue:              var(--blue);
  --color-blue-highlight:    var(--blue-bg);
  --color-text:              var(--text);
  --color-text-muted:        var(--text-muted);
  --color-text-faint:        var(--text-faint);
  --color-text-inverse:      var(--text-inv);
  --color-surface:           var(--surface);
  --color-surface-offset:    var(--surface-3);
  --color-bg:                var(--bg);
  --color-border:            var(--border);
  --color-divider:           var(--divider);
  --transition:              180ms cubic-bezier(.16,1,.3,1);
  --transition-interactive:  200ms cubic-bezier(.4,0,.2,1);
  --sidebar-w: 256px;

  /* ── Convenience aliases ── */
  --card-bg:      var(--surface);
  --border-color: var(--border);
  --text-color:   var(--text);
}

/* ── RESET ────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; scroll-behavior: smooth; }
body { font-family: var(--font); font-size: var(--text-sm); color: var(--text); background: var(--bg); min-height: 100dvh; line-height: 1.5; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: none; }
img { display: block; max-width: 100%; }
table { border-collapse: collapse; width: 100%; }
ul { list-style: none; }

/* ── TOPBAR ───────────────────────────────────────────────── */
.topbar {
  height: 60px;
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: 0 var(--sp-5);
  background: var(--grad-topbar);
  position: sticky;
  top: 0;
  z-index: 200;
  box-shadow: 0 2px 20px rgba(18,6,42,.5);
}
.topbar-logo {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  font-weight: 800;
  font-size: var(--text-sm);
  color: #fff;
  min-width: var(--sidebar-w);
  letter-spacing: -.01em;
}
.topbar-logo .logo-icon {
  width: 34px; height: 34px;
  background: var(--grad-blue);
  border-radius: var(--r-md);
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 2px 10px rgba(147,51,234,.55), inset 0 1px 0 rgba(255,255,255,.25);
  flex-shrink: 0;
}
.topbar-spacer { flex: 1; }
.user-badge {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-3);
  background: rgba(255,255,255,.12);
  border: 1px solid rgba(255,255,255,.18);
  border-radius: var(--r-full);
  font-size: var(--text-xs);
  font-weight: 600;
  color: rgba(255,255,255,.9);
  backdrop-filter: blur(8px);
}
.icon-btn {
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--r-md);
  color: rgba(255,255,255,.7);
  transition: all 180ms;
  cursor: pointer;
}
.icon-btn:hover { background: rgba(255,255,255,.12); color: #fff; }

/* ── LAYOUT ───────────────────────────────────────────────── */
.app-body { display: flex; height: calc(100dvh - 60px); overflow: hidden; }

/* ── SIDEBAR ─────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--grad-navy);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  flex-shrink: 0;
  transition: left 280ms cubic-bezier(.4,0,.2,1);
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,.1) transparent;
}
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,.1); border-radius: 2px; }
.sidebar-nav { padding: var(--sp-4) var(--sp-3); flex: 1; }
.nav-section-label {
  font-size: .65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: rgba(255,255,255,.3);
  padding: var(--sp-4) var(--sp-3) var(--sp-2);
}
.nav-item {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: 10px var(--sp-3);
  border-radius: var(--r-md);
  font-size: var(--text-sm);
  font-weight: 500;
  color: rgba(255,255,255,.55);
  transition: all 180ms;
  width: 100%;
  margin-bottom: 2px;
  position: relative;
}
.nav-item:hover { background: rgba(255,255,255,.09); color: rgba(255,255,255,.9); }
.nav-item.active {
  background: linear-gradient(135deg, #9333ea 0%, #a855f7 50%, #7e22ce 100%);
  color: #fff;
  font-weight: 600;
  box-shadow: 0 2px 14px rgba(147,51,234,.55);
}
.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0; top: 50%; transform: translateY(-50%);
  width: 3px; height: 60%;
  background: #e9d5ff;
  border-radius: 0 2px 2px 0;
}
.nav-item i { width: 18px; text-align: center; font-size: .9em; flex-shrink: 0; opacity: .8; }
.nav-item.active i { opacity: 1; }
.nav-divider { height: 1px; background: rgba(255,255,255,.07); margin: var(--sp-2) var(--sp-3); }
.sidebar-footer {
  padding: var(--sp-4);
  border-top: 1px solid rgba(255,255,255,.07);
  font-size: var(--text-xs);
  color: rgba(255,255,255,.22);
  font-weight: 500;
}

/* ── MAIN CONTENT ────────────────────────────────────────── */
.main-content { flex: 1; overflow-y: auto; background: var(--bg); }
.page { padding: var(--sp-6) var(--sp-8); max-width: 1120px; }
.page-header { margin-bottom: var(--sp-6); }
.page-title {
  font-size: var(--text-2xl);
  font-weight: 800;
  margin-bottom: var(--sp-1);
  color: var(--text);
  letter-spacing: -.02em;
}
.page-desc { color: var(--text-muted); font-size: var(--text-sm); }

/* ── CARDS ───────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--sp-5) var(--sp-6);
  box-shadow: var(--shadow-card);
  margin-bottom: var(--sp-4);
}
.card-title {
  font-size: var(--text-base);
  font-weight: 700;
  margin-bottom: var(--sp-4);
  color: var(--text);
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}
.card-title-icon {
  width: 28px; height: 28px;
  border-radius: var(--r-sm);
  background: var(--primary-light);
  color: var(--primary);
  display: flex; align-items: center; justify-content: center;
  font-size: .85rem;
}
.card-sm { padding: var(--sp-4); }
.card-glass {
  background: rgba(255,255,255,.65);
  backdrop-filter: blur(14px);
  border: 1px solid rgba(233,213,255,.7);
}

/* ── GLOSSY KPI CARDS ────────────────────────────────────── */
.kpi {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--sp-5);
  box-shadow: var(--shadow-card);
  position: relative;
  overflow: hidden;
  transition: transform 180ms, box-shadow 180ms;
}
.kpi::after {
  content: '';
  position: absolute;
  top: 0; right: 0;
  width: 120px; height: 120px;
  background: radial-gradient(circle, rgba(147,51,234,.07) 0%, transparent 70%);
  pointer-events: none;
}
.kpi:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.kpi-icon {
  width: 40px; height: 40px;
  border-radius: var(--r-md);
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem; margin-bottom: var(--sp-3);
  background: var(--primary-light);
  color: var(--primary);
}
.kpi-icon.blue   { background: var(--blue-bg);      color: var(--blue); }
.kpi-icon.green  { background: var(--success-bg);   color: var(--success); }
.kpi-icon.gold   { background: var(--gold-bg);      color: var(--gold); }
.kpi-icon.purple { background: var(--primary-light);color: var(--primary); }
.kpi-icon.red    { background: var(--error-bg);     color: var(--error); }
.kpi-icon.cyan   { background: var(--cyan-bg);      color: var(--cyan); }
.kpi-label { font-size: var(--text-xs); font-weight: 600; text-transform: uppercase; letter-spacing: .07em; color: var(--text-muted); margin-bottom: 4px; }
.kpi-value { font-size: var(--text-xl); font-weight: 800; color: var(--text); line-height: 1.2; letter-spacing: -.02em; }
.kpi-sub   { font-size: var(--text-xs); color: var(--text-faint); margin-top: 4px; }

/* ── GRIDS ───────────────────────────────────────────────── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-5); }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: var(--sp-4); }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--sp-4); }

/* ── CREDIT BALANCE CARD ─────────────────────────────────── */
.balance-hero {
  background: linear-gradient(135deg, #9333ea 0%, #a855f7 50%, #7e22ce 100%);
  border-radius: var(--r-xl);
  padding: var(--sp-6) var(--sp-8);
  color: #fff;
  position: relative;
  overflow: hidden;
  box-shadow: 0 8px 36px rgba(147,51,234,.4);
  margin-bottom: var(--sp-5);
}
.balance-hero::before {
  content: '';
  position: absolute;
  top: -40px; right: -40px;
  width: 200px; height: 200px;
  background: rgba(255,255,255,.1);
  border-radius: 50%;
}
.balance-hero::after {
  content: '';
  position: absolute;
  bottom: -60px; right: 60px;
  width: 160px; height: 160px;
  background: rgba(255,255,255,.06);
  border-radius: 50%;
}
.balance-amount {
  font-size: 2.8rem;
  font-weight: 800;
  letter-spacing: -.04em;
  line-height: 1;
  margin: var(--sp-2) 0;
}
.balance-label { font-size: var(--text-sm); opacity: .8; font-weight: 500; }
.balance-sub   { font-size: var(--text-xs); opacity: .65; margin-top: 4px; }

/* ── API CREDIT GRID ─────────────────────────────────────── */
.api-credit-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: var(--sp-3);
}
.api-credit-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--sp-4);
  text-align: center;
  box-shadow: var(--shadow-xs);
  transition: transform 150ms, box-shadow 150ms;
}
.api-credit-card:hover { transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.api-credit-icon { font-size: 1.4rem; margin-bottom: var(--sp-2); }
.api-credit-value { font-size: var(--text-lg); font-weight: 800; color: var(--text); letter-spacing: -.02em; }
.api-credit-label { font-size: var(--text-xs); color: var(--text-muted); margin-top: 4px; font-weight: 500; }

/* ── USER CARDS ──────────────────────────────────────────── */
.user-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--sp-4) var(--sp-5);
  box-shadow: var(--shadow-card);
  margin-bottom: var(--sp-3);
  transition: box-shadow 180ms;
}
.user-card:hover { box-shadow: var(--shadow-md); }
.user-card-header {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  margin-bottom: var(--sp-3);
}
.user-avatar {
  width: 44px; height: 44px;
  border-radius: var(--r-md);
  background: linear-gradient(135deg, #9333ea 0%, #a855f7 100%);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem;
  font-weight: 700;
  flex-shrink: 0;
  box-shadow: 0 2px 10px rgba(147,51,234,.35);
  text-transform: uppercase;
}
.user-card-name { font-weight: 700; font-size: var(--text-base); color: var(--text); }
.user-card-meta { font-size: var(--text-xs); color: var(--text-muted); margin-top: 1px; }
.user-info-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--sp-2) 0;
  border-bottom: 1px solid var(--divider);
  font-size: var(--text-sm);
}
.user-info-row:last-of-type { border-bottom: none; }
.user-info-key { color: var(--text-muted); font-weight: 500; }
.user-info-val { font-weight: 600; color: var(--text); }
.user-card-actions {
  display: flex;
  gap: var(--sp-2);
  flex-wrap: wrap;
  margin-top: var(--sp-3);
  padding-top: var(--sp-3);
  border-top: 1px solid var(--divider);
}

/* ── INLINE PANELS ───────────────────────────────────────── */
.inline-panel {
  margin-top: var(--sp-3);
  background: var(--surface-3);
  border: 1px solid var(--purple-200);
  border-radius: var(--r-lg);
  padding: var(--sp-4) var(--sp-5);
  animation: slideDown .2s ease-out;
}
@keyframes slideDown { from { opacity:0; transform:translateY(-8px); } to { opacity:1; transform:translateY(0); } }
.inline-panel-title {
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--text);
  margin-bottom: var(--sp-3);
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}

/* ── TABLE ───────────────────────────────────────────────── */
.table-wrap {
  overflow-x: auto;
  border-radius: var(--r-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-xs);
}
th {
  background: linear-gradient(180deg, #faf5ff 0%, #f3e8ff 100%);
  padding: var(--sp-3) var(--sp-4);
  text-align: left;
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-muted);
  white-space: nowrap;
  border-bottom: 1px solid var(--border);
}
td {
  padding: var(--sp-3) var(--sp-4);
  border-bottom: 1px solid var(--divider);
  color: var(--text);
  vertical-align: middle;
  font-size: var(--text-sm);
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--purple-50); }
.table-empty {
  text-align: center; padding: var(--sp-12) var(--sp-4);
  color: var(--text-muted); font-size: var(--text-sm);
}
.table-empty i { font-size: 2rem; display: block; margin-bottom: var(--sp-3); color: var(--text-faint); }

/* ── FORMS ───────────────────────────────────────────────── */
.form-group { margin-bottom: var(--sp-4); }
.form-label {
  display: block;
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-bottom: var(--sp-2);
}
.form-input {
  width: 100%;
  padding: 10px var(--sp-4);
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--r-md);
  font-size: var(--text-sm);
  color: var(--text);
  transition: border-color 180ms, box-shadow 180ms;
}
.form-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(147,51,234,.15);
  background: var(--surface);
}
.form-input[readonly] {
  background: var(--surface-3);
  color: var(--text-muted);
  cursor: default;
  border-style: dashed;
}
textarea.form-input { min-height: 110px; resize: vertical; }
select.form-input { cursor: pointer; }
.help-text { font-size: var(--text-xs); color: var(--text-faint); margin-top: 5px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-4); }
.form-actions { display: flex; gap: var(--sp-3); margin-top: var(--sp-5); flex-wrap: wrap; }

/* ── BUTTONS ─────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: var(--sp-2);
  padding: 10px var(--sp-5);
  border-radius: var(--r-md);
  font-size: var(--text-sm);
  font-weight: 600;
  transition: all 180ms;
  white-space: nowrap;
  cursor: pointer;
  border: none;
  text-decoration: none;
  line-height: 1.2;
}
.btn-primary {
  background: var(--grad-primary);
  color: #fff;
  box-shadow: 0 2px 10px rgba(147,51,234,.4);
}
.btn-primary:hover {
  background: var(--primary-dark);
  box-shadow: 0 4px 18px rgba(147,51,234,.5);
  transform: translateY(-1px);
}
.btn-primary:active { transform: translateY(0); box-shadow: var(--shadow-xs); }
.btn-primary:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn-ghost {
  color: var(--text-muted);
  border: 1.5px solid var(--border);
  background: var(--surface);
}
.btn-ghost:hover { background: var(--surface-3); color: var(--text); border-color: var(--primary); }
.btn-success { background: var(--grad-success); color: #fff; box-shadow: 0 2px 8px rgba(5,150,105,.3); }
.btn-success:hover { filter: brightness(1.05); transform: translateY(-1px); }
.btn-danger { background: var(--error); color: #fff; box-shadow: 0 2px 8px rgba(220,38,38,.3); }
.btn-danger:hover { filter: brightness(1.05); transform: translateY(-1px); }
.btn-warning { background: var(--warning); color: #fff; }
.btn-warning:hover { filter: brightness(1.05); }
.btn-sm { padding: 6px 12px; font-size: var(--text-xs); border-radius: var(--r-sm); }
.btn-xs { padding: 4px 8px; font-size: .7rem; border-radius: var(--r-sm); }
.btn-full { width: 100%; justify-content: center; }
.btn-icon {
  width: 36px; height: 36px; padding: 0;
  justify-content: center;
  border-radius: var(--r-md);
}

/* ── BADGES ──────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 9px;
  border-radius: var(--r-full);
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  white-space: nowrap;
}
.badge-primary  { background: var(--primary-light); color: var(--primary); }
.badge-admin    { background: var(--gold-bg);        color: var(--gold); }
.badge-success  { background: var(--success-bg);     color: var(--success); }
.badge-error    { background: var(--error-bg);       color: var(--error); }
.badge-warning  { background: var(--warning-bg);     color: var(--warning); }
.badge-blue     { background: var(--blue-bg);        color: var(--blue); }
.badge-purple   { background: var(--primary-light);  color: var(--primary); }

/* ── ALERTS ──────────────────────────────────────────────── */
.alert {
  padding: var(--sp-4);
  border-radius: var(--r-md);
  font-size: var(--text-sm);
  display: flex;
  align-items: flex-start;
  gap: var(--sp-3);
  margin-bottom: var(--sp-4);
  line-height: 1.5;
  border-left: 4px solid;
}
.alert i { margin-top: 1px; flex-shrink: 0; }
.alert-success { background: var(--success-bg); color: var(--success); border-color: var(--success); }
.alert-error   { background: var(--error-bg);   color: var(--error);   border-color: var(--error); }
.alert-info    { background: var(--primary-light); color: var(--primary); border-color: var(--primary); }
.alert-warning { background: var(--warning-bg); color: var(--warning); border-color: var(--warning); }

/* ── INFO BANNER ─────────────────────────────────────────── */
.info-banner {
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  padding: var(--sp-4) var(--sp-5);
  background: linear-gradient(135deg, var(--primary-light) 0%, #ede9f8 100%);
  border: 1px solid var(--purple-200);
  border-radius: var(--r-lg);
  margin-bottom: var(--sp-5);
}
.info-banner-icon {
  width: 40px; height: 40px;
  background: var(--grad-blue);
  border-radius: var(--r-md);
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  font-size: 1rem;
  flex-shrink: 0;
  box-shadow: 0 2px 10px rgba(147,51,234,.35);
}

/* ── RAW BOX ─────────────────────────────────────────────── */
.raw-box {
  font-family: 'Courier New', monospace;
  font-size: var(--text-xs);
  background: var(--surface-3);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: var(--sp-4);
  min-height: 60px;
  white-space: pre-wrap;
  word-break: break-all;
  color: var(--text-muted);
  line-height: 1.6;
  max-height: 200px;
  overflow-y: auto;
}

/* ── STAT BAR ────────────────────────────────────────────── */
.stat-bar { display: flex; align-items: center; gap: var(--sp-3); padding: var(--sp-3) 0; border-bottom: 1px solid var(--divider); }
.stat-bar:last-child { border-bottom: none; }
.stat-bar-label { flex: 1; font-size: var(--text-sm); color: var(--text-muted); font-weight: 500; }
.stat-bar-val { font-size: var(--text-sm); font-weight: 700; }

/* ── BROADCAST RESULT ROW ────────────────────────────────── */
.result-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px var(--sp-3);
  background: var(--surface-3);
  border-radius: var(--r-sm);
  margin-bottom: 6px;
  font-size: var(--text-sm);
  gap: var(--sp-2);
  border: 1px solid var(--border);
}

/* ── CREDIT GRID (legacy) ────────────────────────────────── */
.credit-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: var(--sp-3); }
.credit-item { background: var(--surface-3); border-radius: var(--r-md); padding: var(--sp-4); text-align: center; border: 1px solid var(--border); }
.credit-type { font-size: var(--text-xs); color: var(--text-muted); font-weight: 700; text-transform: uppercase; letter-spacing: .04em; margin-bottom: var(--sp-2); }
.credit-val  { font-size: var(--text-lg); font-weight: 800; color: var(--text); }

/* ── AUTH PAGE ───────────────────────────────────────────── */
.auth-wrap {
  display: flex; align-items: center; justify-content: center;
  min-height: 100dvh;
  background: linear-gradient(135deg, #12062a 0%, #3b0764 50%, #12062a 100%);
  position: relative;
  overflow: hidden;
}
.auth-wrap::before {
  content: '';
  position: absolute;
  width: 600px; height: 600px;
  background: radial-gradient(circle, rgba(147,51,234,.35) 0%, transparent 70%);
  top: -200px; left: -100px;
  pointer-events: none;
}
.auth-wrap::after {
  content: '';
  position: absolute;
  width: 400px; height: 400px;
  background: radial-gradient(circle, rgba(192,132,252,.2) 0%, transparent 70%);
  bottom: -100px; right: -50px;
  pointer-events: none;
}
.auth-card {
  background: rgba(255,255,255,.97);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255,255,255,.8);
  border-radius: var(--r-2xl);
  padding: var(--sp-10) var(--sp-10);
  width: 100%; max-width: 440px;
  box-shadow: 0 32px 80px rgba(0,0,0,.35), 0 0 0 1px rgba(255,255,255,.12);
  position: relative;
  z-index: 10;
}
.auth-logo { display: flex; align-items: center; gap: var(--sp-3); margin-bottom: var(--sp-8); }
.auth-logo-text { font-size: var(--text-xl); font-weight: 800; color: var(--text); letter-spacing: -.02em; }
.auth-title { font-size: var(--text-xl); font-weight: 800; margin-bottom: var(--sp-1); color: var(--text); letter-spacing: -.02em; }
.auth-sub { color: var(--text-muted); font-size: var(--text-sm); margin-bottom: var(--sp-6); }

/* ── EMPTY STATE ─────────────────────────────────────────── */
.empty-state { text-align: center; padding: var(--sp-12) var(--sp-4); color: var(--text-muted); }
.empty-state i { font-size: 2.5rem; display: block; margin-bottom: var(--sp-4); color: var(--text-faint); }
.empty-state p { max-width: 36ch; margin: 0 auto; font-size: var(--text-sm); }

/* ── UTILITIES ───────────────────────────────────────────── */
.flex            { display: flex; }
.items-center    { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2  { gap: var(--sp-2); }
.gap-3  { gap: var(--sp-3); }
.gap-4  { gap: var(--sp-4); }
.mb-2   { margin-bottom: var(--sp-2); }
.mb-4   { margin-bottom: var(--sp-4); }
.mb-5   { margin-bottom: var(--sp-5); }
.mb-6   { margin-bottom: var(--sp-6); }
.mt-4   { margin-top: var(--sp-4); }
.mt-6   { margin-top: var(--sp-6); }
.text-muted   { color: var(--text-muted); }
.text-faint   { color: var(--text-faint); }
.text-success { color: var(--success); }
.text-error   { color: var(--error); }
.text-primary { color: var(--primary); }
.text-xs    { font-size: var(--text-xs); }
.text-sm    { font-size: var(--text-sm); }
.font-mono  { font-family: 'Courier New', monospace; font-size: .9em; }
.font-bold  { font-weight: 700; }
.font-800   { font-weight: 800; }
.text-center { text-align: center; }
.divider    { height: 1px; background: var(--divider); margin: var(--sp-5) 0; }
.w-full     { width: 100%; }
.rounded-full { border-radius: var(--r-full); }

/* ── TOGGLE BUTTON ───────────────────────────────────────── */
.toggle-btn {
  display: flex; align-items: center; gap: 6px;
  padding: 8px 16px;
  border: 1.5px solid var(--border);
  border-radius: var(--r-full);
  cursor: pointer; font-size: var(--text-sm); font-weight: 500;
  color: var(--text-muted); background: var(--surface);
  transition: all 180ms; user-select: none;
}
.toggle-btn input[type="radio"] { display: none; }
.toggle-btn:has(input:checked) {
  border-color: var(--primary);
  background: var(--primary-light);
  color: var(--primary); font-weight: 600;
}

/* ── MOBILE HAMBURGER ────────────────────────────────────── */
#mob-menu { display: none; }

/* ── SCROLLBAR ───────────────────────────────────────────── */
.main-content::-webkit-scrollbar { width: 6px; }
.main-content::-webkit-scrollbar-track { background: transparent; }
.main-content::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 3px; }
.main-content::-webkit-scrollbar-thumb:hover { background: var(--primary); }

/* ── PULSE INFO BANNER ───────────────────────────────────── */
.pulse-banner {
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  padding: var(--sp-4) var(--sp-5);
  background: linear-gradient(135deg, #faf5ff 0%, #f3e8ff 100%);
  border: 1px solid var(--purple-200);
  border-radius: var(--r-lg);
  margin-bottom: var(--sp-5);
}

/* ── RESPONSIVE ──────────────────────────────────────────── */
@media (max-width: 900px) {
  .grid-4 { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 768px) {
  #mob-menu { display: flex; }
  .sidebar {
    position: fixed;
    left: -100%; top: 60px;
    height: calc(100dvh - 60px);
    z-index: 300;
    box-shadow: var(--shadow-xl);
    width: 280px;
  }
  .sidebar.open { left: 0; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .page { padding: var(--sp-4); }
  .topbar-logo span { display: none; }
  .auth-card { padding: var(--sp-8) var(--sp-6); margin: var(--sp-4); }
  .balance-amount { font-size: 2rem; }
  .api-credit-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 480px) {
  .btn { padding: 8px var(--sp-4); }
  .card { padding: var(--sp-4); }
  .page-title { font-size: var(--text-xl); }
  .kpi-value { font-size: var(--text-lg); }
  .topbar { padding: 0 var(--sp-3); gap: var(--sp-2); }
}