/* ==========================================================================
   SYNTRA Design System — Contrast Editorial SaaS Aesthetic
   ==========================================================================
   Inspired by clean high-contrast monochrome workspaces:
   - Pitch-black sidebar (#0B0C0E) with editorial serif brand wordmark
   - Crisp alabaster/white workspace (#FFFFFF) with soft gray notice surfaces
   - High-contrast black & outlined topbar balance pills
   - Full dark-mode workspace toggle supported via [data-theme="dark"]
   ========================================================================== */

:root {
  /* ---- Workspace Surfaces (Light Workspace + Dark Sidebar Default) ---- */
  --bg: #FFFFFF;
  --bg-2: #F4F5F7;
  --surface: #FFFFFF;
  --surface-2: #F8F9FB;
  --surface-3: #EDEEF2;
  --surface-hover: #F6F7F9;
  --topbar-bg: rgba(255, 255, 255, 0.92);

  /* ---- Sidebar (Always Deep Obsidian) ---- */
  --side-bg: #0B0C0E;
  --side-active: #232529;
  --side-hover: #17191C;
  --side-text: #F9FAFB;
  --side-muted: #9CA3AF;
  --side-dim: #5E6472;
  --side-border: #1C1E24;

  /* ---- Borders & Dividers ---- */
  --border: #E2E5EC;
  --border-soft: #EBECEF;
  --border-strong: #C8CDD8;

  /* ---- Typography Colors ---- */
  --text: #0F1115;
  --text-muted: #5A6270;
  --text-dim: #858E9E;

  /* ---- Brand & Semantic Accents ---- */
  --ink-btn: #111317;
  --ink-btn-hover: #272B33;
  --ink-btn-text: #FFFFFF;

  --primary: #5B3DF5;
  --primary-2: #2563EB;
  --primary-soft: rgba(91, 61, 245, 0.08);
  --primary-border: rgba(91, 61, 245, 0.24);

  --accent: #059669;
  --accent-bright: #10B981;
  --accent-soft: #ECFDF5;
  --accent-border: #A7F3D0;

  --warning: #92400E;
  --warning-bg: #FEF9EC;
  --warning-soft: #FEF3C7;
  --warning-border: #FBE6A2;

  --danger: #DC2626;
  --danger-soft: #FEF2F2;
  --danger-border: #FECACA;

  --grad: linear-gradient(135deg, #111317 0%, #262A34 100%);
  --chart-grad-a: #111317;
  --chart-grad-b: #4B5563;

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

  --text-xs: 12px;
  --text-sm: 13px;
  --text-base: 14px;
  --text-md: 15.5px;
  --text-lg: 18px;
  --text-xl: 24px;
  --text-2xl: 30px;

  /* ---- Spacing & Radius Scale ---- */
  --radius-xs: 6px;
  --radius-sm: 10px;
  --radius: 16px;
  --radius-lg: 20px;
  --radius-pill: 999px;

  /* ---- Shadows & Motion ---- */
  --shadow-sm: 0 1px 2px rgba(15, 17, 21, 0.04);
  --shadow-card: 0 1px 3px rgba(15, 17, 21, 0.03);
  --shadow: 0 18px 48px rgba(15, 17, 21, 0.14);
  --focus-ring: 0 0 0 3px rgba(91, 61, 245, 0.20);

  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --dur-fast: 120ms;
  --dur-med: 220ms;

  --code-bg: #0D0F14;
  --code-text: #E5E7EB;
  --skeleton-a: #F1F3F6;
  --skeleton-b: #E5E8EE;
}

/* ==========================================================================
   Dark Workspace Theme Override
   ========================================================================== */
[data-theme="dark"] {
  --bg: #0B0D12;
  --bg-2: #131720;
  --surface: #12151E;
  --surface-2: #181C28;
  --surface-3: #222838;
  --surface-hover: #171B26;
  --topbar-bg: rgba(11, 13, 18, 0.88);

  --border: #252B3B;
  --border-soft: #1D2230;
  --border-strong: #363F54;

  --text: #F3F4F6;
  --text-muted: #9CA3AF;
  --text-dim: #6B7280;

  --ink-btn: #F9FAFB;
  --ink-btn-hover: #E5E7EB;
  --ink-btn-text: #0B0C0E;

  --primary: #8B5CF6;
  --primary-2: #60A5FA;
  --primary-soft: rgba(139, 92, 246, 0.15);
  --primary-border: rgba(139, 92, 246, 0.35);

  --accent: #10B981;
  --accent-bright: #34D399;
  --accent-soft: rgba(16, 185, 129, 0.14);
  --accent-border: rgba(16, 185, 129, 0.30);

  --warning: #FBBF24;
  --warning-bg: rgba(245, 158, 11, 0.10);
  --warning-soft: rgba(245, 158, 11, 0.14);
  --warning-border: rgba(245, 158, 11, 0.28);

  --danger: #F87171;
  --danger-soft: rgba(239, 68, 68, 0.14);
  --danger-border: rgba(239, 68, 68, 0.30);

  --chart-grad-a: #8B5CF6;
  --chart-grad-b: #3B82F6;

  --shadow-sm: 0 2px 6px rgba(0, 0, 0, 0.3);
  --shadow-card: 0 4px 16px rgba(0, 0, 0, 0.25);
  --shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
  --focus-ring: 0 0 0 3px rgba(139, 92, 246, 0.32);

  --skeleton-a: rgba(255, 255, 255, 0.04);
  --skeleton-b: rgba(255, 255, 255, 0.09);
}

/* ==========================================================================
   Base & Reset
   ========================================================================== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: var(--text-base);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
}

input, select, textarea {
  font-family: inherit;
  font-size: var(--text-base);
}

:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

/* ==========================================================================
   Brand Wordmark (Editorial Serif in Sidebar, Adaptive in Auth)
   ========================================================================== */
.brand-wordmark {
  display: inline-flex;
  align-items: flex-start;
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 23px;
  letter-spacing: -0.4px;
  line-height: 1;
  color: inherit;
  user-select: none;
}

.brand-wordmark sup {
  font-family: var(--font);
  font-size: 9px;
  font-weight: 700;
  opacity: 0.7;
  margin-left: 2px;
  margin-top: 2px;
}

/* ==========================================================================
   App Shell (Pitch-Black Sidebar + Airy Light Main Area)
   ========================================================================== */
.shell {
  display: grid;
  grid-template-columns: 236px 1fr;
  min-height: 100vh;
}

.sidebar {
  background: var(--side-bg);
  color: var(--side-text);
  display: flex;
  flex-direction: column;
  padding: 24px 14px 18px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  z-index: 40;
  border-right: 1px solid var(--side-border);
}

.side-logo {
  padding: 2px 12px 24px;
  color: #FFFFFF;
}

.nav-group {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.9px;
  color: var(--side-dim);
  margin: 22px 12px 8px;
  font-weight: 700;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  color: var(--side-muted);
  font-weight: 500;
  font-size: 14px;
  margin-bottom: 3px;
  transition: background var(--dur-fast), color var(--dur-fast);
}

.nav-item:hover {
  background: var(--side-hover);
  color: #FFFFFF;
}

.nav-item.active {
  background: var(--side-active);
  color: #FFFFFF;
  font-weight: 600;
}

.nav-item svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  opacity: 0.88;
}

.nav-item.active svg {
  opacity: 1;
}

.nav-badge {
  margin-left: auto;
  font-size: 10.5px;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  font-weight: 700;
  line-height: 1.3;
}

.nav-badge.new {
  background: #C6F6D5;
  color: #064E3B;
}

.nav-badge.soon {
  background: #8D775F;
  color: #1A1612;
}

.nav-badge.beta {
  background: #FDE68A;
  color: #78350F;
}

.sidebar-footer {
  margin-top: auto;
  padding: 12px 12px 4px;
  border-top: 1px solid var(--side-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--side-muted);
  font-size: 12px;
}

.sidebar-footer b {
  color: #FFFFFF;
  display: block;
  font-size: 12.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 150px;
}

/* ==========================================================================
   Topbar (Company Name Left + High-Contrast Balance Pills Right)
   ========================================================================== */
.main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--bg);
}

.topbar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 36px;
  border-bottom: 1px solid var(--border-soft);
  position: sticky;
  top: 0;
  background: var(--topbar-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 30;
}

.topbar-brand {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.2px;
}

/* Hidden visually in topbar when shown as the big page header, or kept synced */
.topbar-page-title {
  display: none;
}

.balance-pills {
  margin-left: auto;
  display: flex;
  gap: 10px;
  align-items: center;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border-radius: var(--radius-pill);
  padding: 7px 15px;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.2;
  transition: transform 90ms, opacity var(--dur-fast);
}

.pill:hover {
  opacity: 0.92;
}

.pill-sms {
  background: var(--ink-btn);
  color: var(--ink-btn-text);
  border: 1px solid var(--ink-btn);
}

.pill-sms .lbl, .pill-sms .val {
  color: var(--ink-btn-text);
}

.pill-main {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
}

.pill-main .lbl, .pill-main .val {
  color: var(--text);
}

.btn-buy-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--ink-btn);
  color: var(--ink-btn-text);
  border-radius: var(--radius-pill);
  padding: 7px 16px;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.2;
  transition: background var(--dur-fast), transform 90ms;
}

.btn-buy-pill:hover {
  background: var(--ink-btn-hover);
}

.menu-toggle {
  display: none;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 7px 9px;
  color: var(--text);
}

.menu-toggle svg {
  width: 18px;
  height: 18px;
}

/* ==========================================================================
   Main Content Container & Editorial Page Header
   ========================================================================== */
.content {
  padding: 28px 36px 56px;
  max-width: 1180px;
  width: 100%;
}

.page-hero {
  margin: 18px 0 22px;
}

.page-hero h1 {
  font-size: 30px;
  font-weight: 800;
  letter-spacing: -0.7px;
  color: var(--text);
  line-height: 1.15;
}

.page-hero .page-sub {
  color: var(--text-muted);
  font-size: 14.5px;
  margin-top: 4px;
}

/* ==========================================================================
   Notice Cards & Calm Alert Callouts (Exact Reference Feel)
   ========================================================================== */
.notice-card {
  background: var(--bg-2);
  border-radius: 12px;
  padding: 16px 20px;
  margin-bottom: 18px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.notice-card-title {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
}

.notice-card-body {
  font-size: 13.5px;
  color: var(--text-muted);
  line-height: 1.55;
}

.notice-actions {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-shrink: 0;
  align-self: center;
}

.notice-link {
  color: var(--primary);
  font-weight: 600;
  font-size: 13px;
  text-decoration: underline;
  white-space: nowrap;
}

.notice-close {
  color: var(--text-muted);
  font-size: 16px;
  line-height: 1;
  padding: 4px;
  opacity: 0.7;
  cursor: pointer;
}

.notice-close:hover {
  opacity: 1;
  color: var(--text);
}

.banner {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 13px 18px;
  border-radius: 10px;
  margin-bottom: 16px;
  font-size: 13.5px;
}

.banner-text {
  flex: 1;
}

.banner.warn {
  background: var(--warning-bg);
  border: 1px solid var(--warning-border);
  color: var(--warning);
}

.banner.warn a {
  color: var(--primary);
  font-weight: 700;
  text-decoration: underline;
}

.banner.info {
  background: var(--bg-2);
  border: 1px solid var(--border-soft);
  color: var(--text);
}

.banner .x {
  margin-left: auto;
  cursor: pointer;
  color: inherit;
  opacity: 0.65;
  padding: 2px 6px;
}

.banner .x:hover {
  opacity: 1;
}

/* ==========================================================================
   Cards, 4-Column Stat Grid & Sections
   ========================================================================== */
.grid {
  display: grid;
  gap: 16px;
}

.cols-4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.cols-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.cols-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.cols-asym {
  grid-template-columns: 1.35fr 0.85fr;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 22px 24px;
  box-shadow: var(--shadow-card);
  transition: border-color var(--dur-fast);
}

.card:hover {
  border-color: var(--border);
}

.card h3 {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 4px;
  letter-spacing: -0.2px;
  color: var(--text);
}

.card .card-sub {
  color: var(--text-muted);
  font-size: 13px;
  margin-bottom: 16px;
}

.stat-card {
  padding: 22px 22px;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  min-height: 136px;
}

.stat-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.stat-label {
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 7px;
}

.stat-value {
  font-size: 30px;
  font-weight: 800;
  letter-spacing: -0.8px;
  margin-top: 8px;
  color: var(--text);
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
}

.stat-value small {
  font-size: 24px;
  font-weight: 800;
  color: var(--text);
}

.stat-foot {
  color: var(--text-muted);
  font-size: 12.5px;
  margin-top: 8px;
  line-height: 1.4;
}

.stat-trend {
  display: inline-flex;
  align-items: center;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  background: var(--bg-2);
  color: var(--text-muted);
}

.stat-trend.up {
  background: var(--accent-soft);
  color: var(--accent);
}

.stat-trend.warn {
  background: var(--warning-soft);
  color: var(--warning);
}

.stat-icon {
  display: none;
}

.section-head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin: 4px 0 14px;
}

.section-head h3 {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.3px;
}

.section-head .actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.mt {
  margin-top: 20px;
}

.mt-sm {
  margin-top: 12px;
}

/* ==========================================================================
   Form Controls & Buttons
   ========================================================================== */
.field {
  margin-bottom: 15px;
}

.field label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}

.field-hint {
  font-size: 12px;
  font-weight: 400;
  color: var(--text-muted);
  margin-top: 5px;
}

.input, .select, .textarea {
  width: 100%;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 13px;
  transition: border-color var(--dur-fast), box-shadow var(--dur-fast);
}

.input:hover:not(:disabled), .select:hover:not(:disabled), .textarea:hover:not(:disabled) {
  border-color: var(--border-strong);
}

.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--text);
  box-shadow: var(--focus-ring);
}

.input:disabled, .select:disabled, .textarea:disabled {
  background: var(--bg-2);
  opacity: 0.65;
  cursor: not-allowed;
}

.input.invalid, .textarea.invalid {
  border-color: var(--danger);
}

.textarea {
  resize: vertical;
  min-height: 96px;
  line-height: 1.5;
}

.hint {
  font-size: var(--text-xs);
  color: var(--text-muted);
  margin-top: 6px;
}

.checkbox-label {
  display: inline-flex;
  gap: 9px;
  align-items: center;
  font-size: 13px;
  color: var(--text-muted);
  cursor: pointer;
  user-select: none;
  padding: 7px 11px;
  border-radius: 8px;
  background: var(--bg-2);
  border: 1px solid var(--border-soft);
}

.checkbox-label input[type="checkbox"] {
  width: 15px;
  height: 15px;
  accent-color: var(--ink-btn);
  cursor: pointer;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 9px 16px;
  font-weight: 600;
  font-size: 13.5px;
  line-height: 1.25;
  white-space: nowrap;
  box-shadow: var(--shadow-sm);
  transition: transform 80ms, background var(--dur-fast), border-color var(--dur-fast), opacity var(--dur-fast);
}

.btn svg {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
}

.btn:hover:not(:disabled) {
  background: var(--surface-2);
  border-color: var(--border-strong);
}

.btn:active:not(:disabled) {
  transform: translateY(1px);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--ink-btn);
  border-color: var(--ink-btn);
  color: var(--ink-btn-text);
}

.btn-primary:hover:not(:disabled) {
  background: var(--ink-btn-hover);
  border-color: var(--ink-btn-hover);
}

.btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--text-muted);
  box-shadow: none;
}

.btn-ghost:hover:not(:disabled) {
  background: var(--bg-2);
  color: var(--text);
}

.btn-danger {
  color: var(--danger);
  border-color: var(--danger-border);
  background: var(--danger-soft);
  box-shadow: none;
}

.btn-danger:hover:not(:disabled) {
  border-color: var(--danger);
}

.btn-block {
  width: 100%;
}

.btn-sm {
  padding: 7px 13px;
  font-size: 12.5px;
  border-radius: 8px;
}

.btn-xs {
  padding: 4px 9px;
  font-size: 11.5px;
  border-radius: 6px;
  box-shadow: none;
}

.icon-btn {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-pill);
  display: inline-grid;
  place-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-muted);
  transition: background var(--dur-fast), color var(--dur-fast);
}

.icon-btn:hover {
  background: var(--bg-2);
  color: var(--text);
}

.icon-btn svg {
  width: 15px;
  height: 15px;
}

/* ==========================================================================
   What Each Balance Pays For & Rate Grid
   ========================================================================== */
.balance-explainer-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 12px;
}

.balance-explainer-item {
  background: var(--bg-2);
  border-radius: 12px;
  padding: 15px 16px;
}

.balance-explainer-item b {
  display: block;
  font-size: 13.5px;
  color: var(--text);
  margin-bottom: 4px;
}

.balance-explainer-item p {
  font-size: 12.5px;
  color: var(--text-muted);
  line-height: 1.5;
}

.rate-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.rate-item {
  background: var(--bg-2);
  border-radius: 10px;
  padding: 12px 14px;
}

.rate-item .r-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 3px;
}

.rate-item .r-primary {
  font-size: 15px;
  font-weight: 800;
  color: var(--text);
}

.rate-item .r-sub {
  font-size: 11.5px;
  color: var(--text-dim);
  margin-top: 2px;
}

/* ==========================================================================
   14-Day SVG Spend Chart
   ========================================================================== */
.chart-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.chart-legend {
  display: flex;
  gap: 12px;
  font-size: 12px;
  color: var(--text-muted);
}

.chart-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.legend-swatch {
  width: 9px;
  height: 9px;
  border-radius: 3px;
  background: var(--chart-grad-a);
}

.legend-swatch.cash {
  background: var(--accent-bright);
}

.chart-svg-wrap {
  width: 100%;
  overflow: hidden;
  padding-top: 4px;
}

.chart-svg {
  width: 100%;
  height: 170px;
  display: block;
}

.chart-bar {
  transition: opacity var(--dur-fast);
  cursor: pointer;
}

.chart-bar:hover {
  opacity: 1 !important;
}

/* ==========================================================================
   Composer Meta, Keyword Warning & Cost Pill
   ========================================================================== */
.composer-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 7px;
  font-size: 12px;
  color: var(--text-muted);
}

.cost-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  font-weight: 600;
  font-size: 11.5px;
  background: var(--bg-2);
  color: var(--text);
  border: 1px solid var(--border);
}

.cost-pill.sandbox {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: var(--accent-border);
}

.cost-pill.warn {
  background: var(--warning-soft);
  color: var(--warning);
  border-color: var(--warning-border);
}

.keyword-warn {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--warning-bg);
  border: 1px solid var(--warning-border);
  color: var(--warning);
  font-size: 12.5px;
  line-height: 1.45;
}

.result-summary {
  margin-top: 16px;
  padding: 14px 16px;
  border-radius: 10px;
  background: var(--accent-soft);
  border: 1px solid var(--accent-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

/* ==========================================================================
   Tables, Filters, Status Badges & Status Legend
   ========================================================================== */
.filter-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 14px;
}

.filter-bar .input, .filter-bar .select {
  width: auto;
  min-width: 150px;
  padding: 8px 12px;
  font-size: 13px;
}

.filter-bar .input-search {
  min-width: 220px;
  flex: 1;
  max-width: 340px;
}

.legend-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px;
  padding: 11px 16px;
  background: var(--bg-2);
  border-radius: 10px;
  margin-bottom: 14px;
  font-size: 12px;
  color: var(--text-muted);
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.table-wrap {
  overflow-x: auto;
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
}

table {
  width: 100%;
  border-collapse: collapse;
}

th {
  text-align: left;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  font-weight: 700;
  padding: 13px 18px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border-soft);
  white-space: nowrap;
}

td {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-soft);
  font-size: 13.5px;
  vertical-align: middle;
}

tr:last-child td {
  border-bottom: none;
}

tbody tr {
  transition: background var(--dur-fast);
}

tbody tr:hover {
  background: var(--surface-hover);
}

tbody tr.clickable-row {
  cursor: pointer;
}

.msg-preview {
  max-width: 400px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.45;
  color: var(--text);
  word-break: break-word;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  font-size: 11.5px;
  font-weight: 700;
  line-height: 1.3;
  white-space: nowrap;
}

.badge::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.badge.delivered, .badge.approved, .badge.credit {
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid var(--accent-border);
}

.badge.sent, .badge.queued, .badge.submitted {
  background: rgba(37, 99, 235, 0.09);
  color: var(--primary-2);
  border: 1px solid rgba(37, 99, 235, 0.22);
}

.badge.failed, .badge.expired, .badge.rejected, .badge.debit {
  background: var(--danger-soft);
  color: var(--danger);
  border: 1px solid var(--danger-border);
}

.badge.pending {
  background: var(--warning-soft);
  color: var(--warning);
  border: 1px solid var(--warning-border);
}

.badge.sandbox {
  background: var(--bg-2);
  color: var(--text-muted);
  border: 1px solid var(--border);
}

.pagination-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 16px;
  padding: 11px 16px;
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: 12px;
  font-size: 13px;
}

/* ==========================================================================
   Slide-Over Detail Drawer
   ========================================================================== */
.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(11, 12, 14, 0.45);
  backdrop-filter: blur(2px);
  z-index: 450;
  display: flex;
  justify-content: flex-end;
  animation: fade var(--dur-fast) var(--ease);
}

.drawer {
  width: 100%;
  max-width: 460px;
  height: 100%;
  background: var(--surface);
  border-left: 1px solid var(--border);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  animation: slideLeft var(--dur-med) var(--ease);
}

@keyframes slideLeft {
  from { transform: translateX(100%); }
  to { transform: translateX(0); }
}

.drawer-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-soft);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.drawer-body {
  padding: 22px 24px;
  overflow-y: auto;
  flex: 1;
}

.drawer-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border-soft);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 18px;
}

.detail-box {
  background: var(--bg-2);
  border-radius: 10px;
  padding: 11px 13px;
}

.detail-box .d-lbl {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-dim);
  font-weight: 700;
  margin-bottom: 4px;
}

.detail-box .d-val {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text);
  word-break: break-all;
}

.msg-full-box {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--text);
  margin-top: 6px;
}

/* ==========================================================================
   Developers: Code Tabs & Cap Meter
   ========================================================================== */
.code-tabs {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  background: #161922;
  border-radius: 12px 12px 0 0;
  padding: 9px 12px;
  color: #9CA3AF;
}

.tab-group {
  display: inline-flex;
  gap: 4px;
}

.code-tab {
  padding: 5px 11px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  color: #9CA3AF;
  transition: background var(--dur-fast), color var(--dur-fast);
}

.code-tab:hover {
  color: #FFFFFF;
  background: rgba(255, 255, 255, 0.08);
}

.code-tab.active {
  background: #262B38;
  color: #FFFFFF;
}

.code-block {
  background: var(--code-bg);
  border-radius: 0 0 12px 12px;
  padding: 18px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  overflow-x: auto;
  color: var(--code-text);
  white-space: pre;
  line-height: 1.65;
}

.cap-meter {
  min-width: 110px;
}

.cap-bar {
  height: 5px;
  background: var(--bg-2);
  border-radius: 4px;
  overflow: hidden;
  margin-top: 4px;
}

.cap-fill {
  height: 100%;
  background: var(--ink-btn);
  border-radius: 4px;
}

.chip-group {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chip {
  padding: 5px 12px;
  border-radius: var(--radius-pill);
  font-size: 12px;
  font-weight: 600;
  background: var(--bg-2);
  border: 1px solid var(--border-soft);
  color: var(--text-muted);
  cursor: pointer;
}

.chip:hover, .chip.active {
  background: var(--ink-btn);
  color: var(--ink-btn-text);
  border-color: var(--ink-btn);
}

/* ==========================================================================
   Auth Screen (Contrast Split: Obsidian Left + Clean White Right)
   ========================================================================== */
.auth-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: var(--bg-2);
}

.auth-split {
  width: 100%;
  max-width: 960px;
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 22px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.auth-hero {
  padding: 44px 40px;
  background: #0B0C0E;
  color: #FFFFFF;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 24px;
}

.auth-hero-title {
  font-size: 27px;
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -0.6px;
  margin-top: 24px;
  margin-bottom: 10px;
}

.auth-hero-sub {
  color: #9CA3AF;
  font-size: 14px;
  line-height: 1.6;
}

.auth-feature-list {
  display: grid;
  gap: 14px;
  margin: 20px 0;
}

.auth-feature {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  font-size: 13px;
  color: #9CA3AF;
}

.auth-feature-icon {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: #232529;
  color: #FFFFFF;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.auth-feature-icon svg {
  width: 14px;
  height: 14px;
}

.auth-feature b {
  color: #FFFFFF;
  font-weight: 600;
  display: block;
  margin-bottom: 2px;
}

.auth-trust-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding-top: 16px;
  border-top: 1px solid #1F2229;
}

.trust-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  font-weight: 600;
  color: #D1D5DB;
  background: #17191E;
  padding: 5px 11px;
  border-radius: var(--radius-pill);
}

.trust-pill::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #10B981;
}

.auth-card {
  width: 100%;
  padding: 42px 38px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.auth-top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.auth-card h1 {
  font-size: 24px;
  font-weight: 800;
  margin-bottom: 6px;
  letter-spacing: -0.5px;
}

.auth-card .sub {
  color: var(--text-muted);
  margin-bottom: 24px;
  font-size: 14px;
}

.auth-switch {
  margin-top: 20px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13.5px;
}

.auth-switch a {
  color: var(--text);
  font-weight: 700;
  text-decoration: underline;
  cursor: pointer;
  margin-left: 4px;
}

/* ==========================================================================
   Modals, Toasts, Empty States & Skeletons
   ========================================================================== */
#toasts {
  position: fixed;
  bottom: 22px;
  right: 22px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 1000;
  max-width: 360px;
}

.toast {
  background: #111317;
  color: #FFFFFF;
  border-left: 4px solid #FFFFFF;
  border-radius: 10px;
  padding: 12px 16px;
  min-width: 250px;
  box-shadow: var(--shadow);
  animation: slideIn var(--dur-med) var(--ease);
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.toast.ok {
  border-left-color: #10B981;
}

.toast.warn {
  border-left-color: #F59E0B;
}

.toast.err {
  border-left-color: #EF4444;
}

@keyframes slideIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(11, 12, 14, 0.55);
  backdrop-filter: blur(3px);
  display: grid;
  place-items: center;
  z-index: 500;
  padding: 20px;
  animation: fade var(--dur-fast) var(--ease);
}

@keyframes fade {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  width: 100%;
  max-width: 480px;
  padding: 28px;
  box-shadow: var(--shadow);
}

.modal h3 {
  font-size: 18px;
  font-weight: 800;
  margin-bottom: 6px;
}

.modal .modal-sub {
  color: var(--text-muted);
  font-size: 13.5px;
  margin-bottom: 20px;
}

.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 22px;
}

.key-reveal {
  background: #0D0F14;
  border: 1px dashed #10B981;
  border-radius: 10px;
  padding: 14px;
  font-family: var(--font-mono);
  font-size: 13px;
  word-break: break-all;
  color: #34D399;
  margin: 14px 0;
  user-select: all;
}

.empty {
  text-align: center;
  padding: 44px 20px;
  color: var(--text-muted);
}

.empty-icon {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  background: var(--bg-2);
  color: var(--text);
  display: inline-grid;
  place-items: center;
  margin-bottom: 12px;
}

.empty-icon svg {
  width: 20px;
  height: 20px;
}

.empty-title {
  font-size: 14.5px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
}

.empty-desc {
  font-size: 13px;
  color: var(--text-muted);
  max-width: 340px;
  margin: 0 auto 14px;
}

.skeleton {
  background: linear-gradient(90deg, var(--skeleton-a) 25%, var(--skeleton-b) 50%, var(--skeleton-a) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: 8px;
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.skeleton-line {
  height: 14px;
  margin-bottom: 10px;
}

.skeleton-stat {
  height: 32px;
  width: 55%;
  margin: 12px 0 8px;
}

/* ==========================================================================
   Utilities & Responsive Breakpoints
   ========================================================================== */
.row-flex {
  display: flex;
  gap: 12px;
  align-items: center;
}

.muted {
  color: var(--text-muted);
}

.dim {
  color: var(--text-dim);
}

.mono {
  font-family: var(--font-mono);
  font-size: 12.5px;
}

.truncate {
  max-width: 280px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.right {
  text-align: right;
}

.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--text);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

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

.center-load {
  display: grid;
  place-items: center;
  padding: 60px;
}

@media (max-width: 980px) {
  .shell {
    grid-template-columns: 1fr;
  }
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: 250px;
    z-index: 200;
    transform: translateX(-100%);
    transition: transform var(--dur-med) var(--ease);
    box-shadow: var(--shadow);
  }
  .sidebar.open {
    transform: none;
  }
  .menu-toggle {
    display: inline-flex;
  }
  .cols-4 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .cols-3, .cols-2, .cols-asym, .balance-explainer-grid {
    grid-template-columns: 1fr;
  }
  .topbar {
    padding: 12px 18px;
  }
  .content {
    padding: 20px 18px 40px;
  }
  .auth-split {
    grid-template-columns: 1fr;
    max-width: 440px;
  }
  .auth-hero {
    display: none;
  }
  .auth-card {
    padding: 32px 24px;
  }
  .scrim {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 150;
  }
}

@media (max-width: 560px) {
  .cols-4 {
    grid-template-columns: 1fr;
  }
  .topbar {
    padding: 10px 12px;
    flex-wrap: wrap;
    gap: 8px;
  }
  .topbar-right {
    gap: 6px;
    flex-wrap: wrap;
    max-width: 100%;
  }
  .pill {
    padding: 3px 7px;
    font-size: 11px;
  }
  .content {
    padding: 14px 12px 36px;
    max-width: 100%;
    overflow-x: hidden;
  }
  .page-hero h1 {
    font-size: 20px;
  }
  .page-sub {
    font-size: 12.5px;
  }
  .table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    max-width: 100%;
  }
  .filter-bar {
    flex-direction: column;
    align-items: stretch;
  }
  .filter-bar .input, .filter-bar .select {
    width: 100%;
    max-width: 100%;
  }
  .bundle-grid {
    grid-template-columns: 1fr !important;
  }
  .modal {
    width: 95vw !important;
    max-width: 95vw !important;
    padding: 16px !important;
    margin: 10px auto;
  }
  .stat-card {
    padding: 14px 16px;
  }
  .notice-card {
    flex-direction: column;
    gap: 12px;
  }
  .tab-link {
    font-size: 13px;
    padding: 8px 2px;
  }
}

.bundle-card {
  transition: transform var(--dur-fast), border-color var(--dur-fast);
}
.bundle-card:hover {
  transform: translateY(-2px);
  border-color: var(--primary) !important;
}
.bundle-card.popular {
  border-color: var(--primary) !important;
  background: var(--bg-hover);
}
.tab-link:hover {
  color: var(--text) !important;
}

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

/* ---------- Send Bulk SMS ---------- */
.bulk-card { max-width: 860px; }
.sender-box { display: flex; flex-wrap: wrap; gap: 8px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); }
.sender-opt { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 8px; border: 1px solid var(--border-soft); background: var(--surface); cursor: pointer; font-weight: 600; font-size: 13.5px; }
.sender-opt:has(input:checked) { border-color: var(--primary-border); background: var(--primary-soft); }
.cost-summary { border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; margin: 6px 0 16px; background: var(--surface-2); }
.cs-title { font-weight: 700; font-size: 13px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted); margin-bottom: 8px; }
.cs-row { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; border-bottom: 1px dashed var(--border-soft); font-size: 14px; }
.cs-row:last-of-type { border-bottom: 0; }
.cs-row span { color: var(--text-muted); }
.cs-row.cs-dim b { color: var(--text-muted); font-weight: 600; }
.btn-block { width: 100%; justify-content: center; }
@media (max-width: 640px) {
  .camp-table table, .camp-table tbody, .camp-table tr, .camp-table td { display: block; width: 100%; }
  .camp-table thead { display: none; }
  .camp-table tr { border: 1px solid var(--border); border-radius: 10px; padding: 8px 12px; margin-bottom: 10px; background: var(--surface); }
  .camp-table td { border: 0 !important; padding: 4px 0 !important; text-align: left !important; }
  .camp-table td::before { content: attr(data-l); display: block; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-dim); }
}

/* ---------- Admin console (separate shell) ---------- */
.admin-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 18px; }
.vynfy-card { border: 1px solid var(--border); border-radius: 14px; padding: 20px; background: var(--surface); }
.vynfy-big { font-size: 34px; font-weight: 800; letter-spacing: -.02em; line-height: 1.1; }
.vynfy-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-top: 16px; }
.vynfy-grid .rate-item { margin: 0; }
.meter { height: 10px; border-radius: 999px; background: var(--surface-3); overflow: hidden; margin-top: 12px; }
.meter > div { height: 100%; background: var(--accent-bright); border-radius: 999px; }
.meter.warn > div { background: #F59E0B; }
.meter.bad > div { background: var(--danger); }
.field .checkbox-label { display: inline-flex; justify-content: flex-start; width: auto; margin-bottom: 0; }
.side-help { margin-top: auto; padding: 14px 0 6px; display: flex; flex-direction: column; gap: 2px; }
.side-help .nav-item { gap: 10px; padding: 12px 12px; margin: 0; font-size: 15px; font-weight: 500; color: #D4D4D8; background: transparent; }
.side-help .nav-item svg { width: 20px; height: 20px; opacity: 1; color: #D4D4D8; }
.side-help .nav-item:hover { color: #FFFFFF; background: var(--side-hover); }
.side-help .nav-item:hover svg { color: #FFFFFF; }
.side-help + .sidebar-footer { margin-top: 6px; }
.support-link { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 12px; color: var(--text); text-decoration: none; }
.support-link:hover { border-color: var(--primary-border); background: var(--primary-soft); }
.support-link svg { width: 20px; height: 20px; color: var(--text-muted); }
.audit-row { font-size: 12.5px; padding: 6px 0; border-bottom: 1px dashed var(--border-soft); }
.check-row { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border-soft); align-items: flex-start; }
.check-dot { width: 22px; height: 22px; border-radius: 50%; flex-shrink: 0; display: grid; place-items: center; color: #fff; font-size: 13px; font-weight: 800; }
.check-dot.ok { background: var(--accent-bright); }
.check-dot.bad { background: var(--danger); }

/* ---------- Own sign in / sign up (Clerk behind the scenes) ---------- */
.btn-google { background: var(--surface); color: var(--text); border: 1px solid var(--border); font-weight: 600; gap: 10px; min-height: 44px; }
.btn-google:hover { background: var(--surface-hover); border-color: var(--border-strong); }
.auth-or { display: flex; align-items: center; gap: 12px; color: var(--text-dim); font-size: 12.5px; margin: 16px 0; }
.auth-or::before, .auth-or::after { content: ''; flex: 1; height: 1px; background: var(--border); }
.pw-wrap { position: relative; }
.pw-wrap .input { padding-right: 64px; }
.pw-eye { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); background: none; border: 0; color: var(--text-muted); font-size: 12.5px; font-weight: 600; cursor: pointer; padding: 6px 8px; }
.auth-link { font-weight: 500; font-size: 12.5px; color: var(--text-muted); cursor: pointer; text-decoration: underline; }
.auth-msg { font-size: 13px; padding: 10px 12px; border-radius: 10px; margin: 2px 0 12px; }
.auth-msg.err { background: var(--danger-soft); color: var(--danger); border: 1px solid var(--danger-border); }
.auth-msg.ok { background: var(--accent-soft); color: var(--accent); border: 1px solid var(--accent-border); }
.code-input { font-family: var(--font-mono); font-size: 22px; letter-spacing: .4em; text-align: center; }
#clerk-captcha:empty { display: none; }
