:root {
  --bg-void: #03060c;
  --bg-deep: #060b14;
  --surface-1: rgba(10, 17, 30, 0.88);
  --surface-2: rgba(15, 25, 44, 0.76);
  --surface-hover: rgba(20, 34, 58, 0.92);
  --border-hud: rgba(0, 230, 118, 0.16);
  --border-subtle: rgba(148, 163, 184, 0.12);
  --border-strong: rgba(148, 163, 184, 0.25);

  --text: #f1f5f9;
  --text-bright: #ffffff;
  --text-muted: #8b9bb4;
  --text-dim: #586984;

  --emerald: #00e676;
  --emerald-dim: #10b981;
  --emerald-bg: rgba(0, 230, 118, 0.11);
  --emerald-glow: rgba(0, 230, 118, 0.28);

  --cyan: #00e5ff;
  --cyan-bg: rgba(0, 229, 255, 0.11);
  --blue: #38bdf8;
  --blue-bg: rgba(56, 189, 248, 0.12);

  --amber: #ffb300;
  --amber-bg: rgba(255, 179, 0, 0.12);

  --rose: #ff2e54;
  --rose-bg: rgba(255, 46, 84, 0.13);

  --violet: #b388ff;
  --violet-bg: rgba(179, 136, 255, 0.12);

  --radius-lg: 16px;
  --radius-md: 12px;
  --radius-sm: 8px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  background-color: var(--bg-void);
  color: var(--text);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  line-height: 1.45;
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
  -webkit-font-smoothing: antialiased;
}

/* TACTICAL CYBER GRID OVERLAY */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(to right, rgba(0, 230, 118, 0.025) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(0, 229, 255, 0.025) 1px, transparent 1px);
  background-size: 36px 36px;
  pointer-events: none;
  z-index: 0;
}

.bg-glow {
  position: fixed;
  width: 560px;
  height: 560px;
  border-radius: 50%;
  filter: blur(150px);
  pointer-events: none;
  z-index: 0;
  opacity: 0.16;
}
.bg-glow-1 { top: -220px; left: -160px; background: var(--emerald); }
.bg-glow-2 { top: 15%; right: -220px; background: var(--cyan); }

.shell {
  position: relative;
  z-index: 1;
  max-width: 1440px;
  margin: 0 auto;
  padding: 20px 22px 90px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

/* ============================================================================
   TOPBAR (COMMAND CENTER HUD HEADER)
   ============================================================================ */
.topbar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  background: linear-gradient(180deg, rgba(12, 21, 38, 0.95) 0%, rgba(8, 14, 26, 0.92) 100%);
  border: 1px solid var(--border-hud);
  box-shadow: 0 10px 35px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  backdrop-filter: blur(18px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-logo {
  width: 46px;
  height: 46px;
  border-radius: 12px;
  background: radial-gradient(circle at 30% 30%, rgba(0, 230, 118, 0.28), rgba(0, 229, 255, 0.08));
  border: 1px solid rgba(0, 230, 118, 0.55);
  box-shadow: 0 0 18px rgba(0, 230, 118, 0.22);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--emerald);
  flex-shrink: 0;
}
.brand-logo svg { width: 24px; height: 24px; }

.brand-badge-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 3px;
}

.kicker {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--cyan);
  text-transform: uppercase;
}

.live-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--emerald);
  background: var(--emerald-bg);
  border: 1px solid rgba(0, 230, 118, 0.38);
  padding: 2px 9px;
  border-radius: 999px;
}

.pulse-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--emerald);
  box-shadow: 0 0 10px var(--emerald);
  animation: pulse 1.6s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.35; transform: scale(1.3); }
}

.topbar h1 {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text-bright);
}

.top-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

.account-tabs {
  display: flex;
  background: rgba(3, 6, 12, 0.85);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  padding: 3px;
  gap: 3px;
}

.acc-tab {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  padding: 7px 12px;
  border-radius: 7px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: inherit;
  transition: all 0.18s ease;
}
.acc-tab small {
  font-size: 10.5px;
  font-weight: 500;
  opacity: 0.7;
}
.acc-tab:hover { color: var(--text-bright); }
.acc-tab.active {
  background: rgba(16, 28, 48, 0.95);
  color: var(--text-bright);
  border-color: rgba(0, 230, 118, 0.4);
  box-shadow: 0 0 14px rgba(0, 230, 118, 0.14);
}

.acc-dot { width: 7px; height: 7px; border-radius: 50%; }
.acc-a { background: var(--emerald); box-shadow: 0 0 6px var(--emerald); }
.acc-b { background: var(--cyan); }
.acc-all { background: var(--violet); }

.sync-group {
  display: flex;
  align-items: center;
  gap: 10px;
}
.sync-meta {
  font-size: 11px;
  color: var(--text-muted);
  font-family: 'JetBrains Mono', monospace;
}

.btn-sync {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: linear-gradient(135deg, var(--emerald) 0%, #059669 100%);
  color: #021a0f;
  font-weight: 800;
  font-size: 12px;
  letter-spacing: 0.02em;
  border: none;
  padding: 8px 14px;
  border-radius: 9px;
  cursor: pointer;
  font-family: inherit;
  box-shadow: 0 4px 14px rgba(0, 230, 118, 0.25);
  transition: all 0.18s ease;
}
.btn-sync:hover { filter: brightness(1.08); transform: translateY(-1px); }
.btn-sync:disabled { opacity: 0.55; cursor: wait; }

/* ============================================================================
   CHA-CHING MOBILE ALERT BAR & TOAST
   ============================================================================ */
.chaching-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  background: linear-gradient(90deg, rgba(0, 230, 118, 0.12) 0%, rgba(10, 18, 32, 0.92) 55%, rgba(255, 179, 0, 0.1) 100%);
  border: 1px solid rgba(0, 230, 118, 0.35);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.4);
}
.chaching-info-title {
  font-size: 13px;
  font-weight: 800;
  color: #ecfdf5;
  display: flex;
  align-items: center;
  gap: 6px;
}
.chaching-info-sub {
  font-size: 11.5px;
  color: #94a3b8;
  margin-top: 2px;
}
.chaching-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.chaching-btn {
  padding: 8px 14px;
  border-radius: 9px;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  border: 1px solid var(--emerald);
  background: var(--emerald);
  color: #021c10;
  font-family: inherit;
  box-shadow: 0 0 16px rgba(0, 230, 118, 0.25);
  transition: all 0.18s;
}
.chaching-btn.active-alert {
  background: rgba(0, 230, 118, 0.16);
  color: var(--emerald);
  border-color: var(--emerald);
}
.chaching-test-btn {
  padding: 8px 12px;
  border-radius: 9px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  border: 1px solid rgba(255, 179, 0, 0.5);
  background: rgba(255, 179, 0, 0.14);
  color: #ffe082;
  font-family: inherit;
}

#sale-toast-container {
  position: fixed;
  top: 14px;
  right: 14px;
  left: 14px;
  max-width: 420px;
  margin: 0 auto;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}
.sale-toast {
  pointer-events: auto;
  background: linear-gradient(135deg, #042f24 0%, #070d19 100%);
  border: 1.5px solid var(--emerald);
  box-shadow: 0 16px 40px rgba(0, 230, 118, 0.35);
  border-radius: 14px;
  padding: 14px 16px;
  color: #ecfdf5;
  animation: popInSale 0.32s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes popInSale {
  from { transform: translateY(-20px) scale(0.94); opacity: 0; }
  to { transform: translateY(0) scale(1); opacity: 1; }
}

/* ============================================================================
   DESKTOP NAVIGATION TABS & KILL-SWITCH
   ============================================================================ */
.view-nav-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  background: var(--surface-1);
  border: 1px solid var(--border-subtle);
  padding: 8px 12px;
  border-radius: var(--radius-md);
  backdrop-filter: blur(16px);
}

.view-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.view-tab-btn {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid transparent;
  color: var(--text-muted);
  padding: 9px 14px;
  border-radius: 9px;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.18s;
  display: inline-flex;
  align-items: center;
  gap: 7px;
}
.view-tab-btn:hover {
  color: var(--text-bright);
  background: rgba(255, 255, 255, 0.06);
}
.view-tab-btn.active {
  background: linear-gradient(135deg, rgba(0, 230, 118, 0.22), rgba(0, 229, 255, 0.12));
  color: var(--emerald);
  border-color: rgba(0, 230, 118, 0.55);
  box-shadow: 0 0 18px rgba(0, 230, 118, 0.18);
}

.view-pane { display: none; }
.view-pane.active {
  display: flex;
  flex-direction: column;
  gap: 18px;
  animation: fadeIn 0.2s ease;
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

.ks-pill-wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: rgba(0, 230, 118, 0.07);
  border: 1px solid rgba(0, 230, 118, 0.28);
  padding: 7px 12px;
  border-radius: 10px;
}
.ks-pill-wrap.paused {
  background: rgba(255, 46, 84, 0.08);
  border-color: rgba(255, 46, 84, 0.3);
}
.ks-toggle-btn {
  cursor: pointer;
  border: none;
  border-radius: 7px;
  padding: 6px 12px;
  font-weight: 800;
  font-size: 11px;
  font-family: 'JetBrains Mono', monospace;
  transition: all 0.18s;
  flex-shrink: 0;
}
.ks-toggle-btn.on {
  background: var(--emerald);
  color: #021c10;
  box-shadow: 0 0 12px rgba(0, 230, 118, 0.3);
}
.ks-toggle-btn.off {
  background: rgba(148, 163, 184, 0.2);
  color: #e2e8f0;
}

/* ============================================================================
   SEMANTIC TACTICAL KPI GRIDS & CARDS
   ============================================================================ */
.kpi-grid-6 {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 12px;
}

.kpi-grid-5 {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
}

.winners-grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

.bucket-cards-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}

.bucket-card {
  background: linear-gradient(180deg, rgba(13, 22, 40, 0.92) 0%, rgba(8, 14, 26, 0.92) 100%);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 15px 16px;
  position: relative;
  overflow: hidden;
  transition: all 0.18s ease;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
}
.bucket-card[data-filter] { cursor: pointer; }
.bucket-card[data-filter]:hover, .bucket-card.active-filter {
  background: var(--surface-hover);
  transform: translateY(-2px);
  border-color: var(--cyan);
  box-shadow: 0 8px 25px rgba(0, 229, 255, 0.15);
}

.bucket-card.b-green  { border-top: 3px solid var(--emerald); }
.bucket-card.b-amber  { border-top: 3px solid var(--amber); }
.bucket-card.b-red    { border-top: 3px solid var(--rose); }
.bucket-card.b-blue   { border-top: 3px solid var(--cyan); }
.bucket-card.b-purple { border-top: 3px solid var(--violet); }

.bucket-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.bucket-val {
  font-size: 25px;
  font-weight: 800;
  font-family: 'JetBrains Mono', monospace;
  color: var(--text-bright);
  line-height: 1.15;
  margin-bottom: 5px;
  letter-spacing: -0.02em;
}

.bucket-desc {
  font-size: 11.5px;
  color: var(--text-muted);
  line-height: 1.35;
}

/* WINNER CARDS */
.winner-card {
  background: linear-gradient(135deg, rgba(13, 23, 42, 0.95) 0%, rgba(7, 12, 22, 0.95) 100%);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 15px 18px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}
.winner-card.w-emerald { border-left: 4px solid var(--emerald); }
.winner-card.w-cyan    { border-left: 4px solid var(--cyan); }
.winner-card.w-amber   { border-left: 4px solid var(--amber); }

.winner-tag {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 8px;
  display: block;
}

/* ============================================================================
   CLEAN TABLE CARDS & DESKTOP TABLES
   ============================================================================ */
.clean-table-card, .card, .canvas-card {
  background: var(--surface-1);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 20px;
  backdrop-filter: blur(16px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
}

.section-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px;
  margin-bottom: 16px;
}

.section-tag {
  display: block;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.09em;
  color: var(--emerald);
  text-transform: uppercase;
  margin-bottom: 3px;
}

.section-title {
  font-size: 16.5px;
  font-weight: 800;
  color: var(--text-bright);
  margin: 0;
}

.filter-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.filter-pill-btn {
  background: rgba(6, 11, 20, 0.9);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  padding: 7px 12px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.16s;
}
.filter-pill-btn:hover {
  color: var(--text-bright);
  border-color: var(--border-strong);
}
.filter-pill-btn.active {
  background: var(--emerald);
  color: #021c10;
  border-color: var(--emerald);
  box-shadow: 0 0 14px rgba(0, 230, 118, 0.28);
}

.table-responsive {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.tx-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}

.tx-table th {
  text-align: left;
  padding: 11px 12px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-strong);
  background: rgba(3, 6, 12, 0.65);
  white-space: nowrap;
}

.tx-table td {
  padding: 12px;
  border-bottom: 1px solid var(--border-subtle);
  vertical-align: middle;
}

.tx-table tbody tr:hover td {
  background: rgba(0, 229, 255, 0.03);
}

.mono-cell {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 10.5px;
  font-weight: 700;
  font-family: 'JetBrains Mono', monospace;
  white-space: nowrap;
}
.badge-succeeded { background: var(--emerald-bg); color: var(--emerald); border: 1px solid rgba(0, 230, 118, 0.35); }
.badge-failed    { background: var(--rose-bg); color: #ff8a9f; border: 1px solid rgba(255, 46, 84, 0.35); }
.badge-refunded  { background: var(--amber-bg); color: #ffd54f; border: 1px solid rgba(255, 179, 0, 0.35); }
.badge-acc-a     { background: rgba(0, 230, 118, 0.14); color: var(--emerald); border: 1px solid rgba(0, 230, 118, 0.28); }
.badge-acc-b     { background: var(--cyan-bg); color: var(--cyan); border: 1px solid rgba(0, 229, 255, 0.28); }

/* ============================================================================
   FUNNEL CANVAS & RISK METERS
   ============================================================================ */
.canvas-wrap {
  width: 100%;
  background: #040811;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  overflow-x: auto;
  margin-top: 12px;
}
#funnel-canvas {
  display: block;
  width: 100%;
  min-width: 780px;
  height: 320px;
}

.risk-meter-wrap { width: 130px; }
.risk-bar-bg {
  width: 100%;
  height: 7px;
  background: rgba(148, 163, 184, 0.15);
  border-radius: 99px;
  overflow: hidden;
  margin-top: 5px;
}
.risk-bar-fill { height: 100%; border-radius: 99px; }

.trail-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  max-width: 340px;
}
.trail-chip {
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 6px;
  background: rgba(148, 163, 184, 0.12);
  color: #e2e8f0;
}
.trail-chip.chip-rage {
  background: var(--rose-bg);
  color: #ff8a9f;
  border: 1px solid rgba(255, 46, 84, 0.35);
}
.trail-chip.chip-warn {
  background: var(--amber-bg);
  color: #ffe082;
}
.trail-chip.chip-ok {
  background: var(--emerald-bg);
  color: var(--emerald);
}

.lead-act-btn {
  cursor: pointer;
  border: 1px solid rgba(0, 229, 255, 0.3);
  background: rgba(6, 14, 26, 0.92);
  color: var(--text-bright);
  font-size: 11.5px;
  font-weight: 700;
  padding: 6px 10px;
  border-radius: 7px;
  margin: 2px 0;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: inherit;
  transition: all 0.15s;
}
.lead-act-btn:hover {
  border-color: var(--cyan);
  background: var(--cyan-bg);
  color: var(--cyan);
}
.lead-act-btn.btn-danger-kill {
  border-color: rgba(255, 46, 84, 0.45);
  background: var(--rose-bg);
  color: #ff8a9f;
}

/* ============================================================================
   TEMPLATES 90D & STRIPE HEALTH GRIDS
   ============================================================================ */
.templates-grid {
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 18px;
  align-items: start;
}
.wave-selector-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.wave-select-item {
  background: var(--surface-1);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  padding: 12px 14px;
  cursor: pointer;
  transition: all 0.16s;
  text-align: left;
}
.wave-select-item:hover { background: var(--surface-hover); }
.wave-select-item.active {
  border-color: var(--emerald);
  background: rgba(0, 230, 118, 0.08);
}
.email-preview-card {
  background: var(--surface-1);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 18px;
  position: sticky;
  top: 16px;
}
.email-meta-bar {
  background: var(--bg-deep);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 14px;
  font-size: 12.5px;
}
.email-iframe-wrap {
  width: 100%;
  height: 540px;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--border-subtle);
  background: #07090b;
}
#email-preview-iframe { width: 100%; height: 100%; border: none; }

/* STRIPE SCORE & BALANCES */
.hero-grid {
  display: grid;
  grid-template-columns: 1fr 1.35fr;
  gap: 16px;
}
.score-card {
  display: flex;
  align-items: center;
  gap: 20px;
}
.score-ring-wrap {
  position: relative;
  width: 112px;
  height: 112px;
  flex-shrink: 0;
}
.score-svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.score-track { fill: none; stroke: rgba(148, 163, 184, 0.12); stroke-width: 10; }
.score-progress {
  fill: none;
  stroke: var(--emerald);
  stroke-width: 10;
  stroke-linecap: round;
  transition: stroke-dashoffset 0.6s ease, stroke 0.3s ease;
}
.score-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.score-center span {
  font-size: 30px;
  font-weight: 800;
  font-family: 'JetBrains Mono', monospace;
  line-height: 1;
}
.score-center small { font-size: 10.5px; color: var(--text-muted); margin-top: 2px; }
.score-info h2 { font-size: 18px; font-weight: 800; margin: 6px 0 4px; }
.mono-meta { font-family: 'JetBrains Mono', monospace; font-size: 11.5px; color: var(--text-muted); margin-bottom: 10px; }

.status-tag {
  display: inline-block;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  padding: 3px 9px;
  border-radius: 999px;
}
.status-ok     { background: var(--emerald-bg); color: var(--emerald); border: 1px solid rgba(0, 230, 118, 0.35); }
.status-warn   { background: var(--amber-bg); color: var(--amber); border: 1px solid rgba(255, 179, 0, 0.35); }
.status-danger { background: var(--rose-bg); color: var(--rose); border: 1px solid rgba(255, 46, 84, 0.35); }

.account-flags { display: flex; flex-wrap: wrap; gap: 6px; }
.flag-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 4px 9px;
  border-radius: 7px;
  background: var(--surface-2);
  border: 1px solid var(--border-subtle);
}

.card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 14px;
}
.card-head h3 { font-size: 16px; font-weight: 800; }
.currency-pill {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  font-weight: 700;
  padding: 4px 9px;
  border-radius: 7px;
  background: var(--surface-2);
  border: 1px solid var(--border-subtle);
  color: var(--cyan);
}

.balance-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}
.bal-box {
  background: rgba(3, 6, 12, 0.65);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.bal-label { font-size: 11px; color: var(--text-muted); font-weight: 600; }
.bal-val { font-size: 18px; font-weight: 800; font-family: 'JetBrains Mono', monospace; }
.bal-sub { font-size: 10.5px; color: var(--text-dim); }
.accent-green { color: var(--emerald); }
.accent-blue  { color: var(--cyan); }

.section-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}
.section-header h2 { font-size: 17px; font-weight: 800; }
.shield-summary-pill {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  font-weight: 700;
  padding: 5px 11px;
  border-radius: 999px;
  background: var(--emerald-bg);
  color: var(--emerald);
  border: 1px solid rgba(0, 230, 118, 0.35);
}

.shields-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}
.shield-card {
  background: var(--surface-1);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 15px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.shield-card.shield-active { border-color: rgba(0, 230, 118, 0.32); }
.shield-top { display: flex; justify-content: space-between; align-items: center; gap: 6px; }
.shield-title { font-size: 13px; font-weight: 800; }
.shield-desc { font-size: 12px; color: var(--text-muted); line-height: 1.4; }

.window-selector {
  display: flex;
  background: rgba(3, 6, 12, 0.8);
  border: 1px solid var(--border-subtle);
  border-radius: 9px;
  padding: 3px;
  gap: 3px;
}
.win-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 11.5px;
  font-weight: 700;
  padding: 6px 10px;
  border-radius: 6px;
  cursor: pointer;
  font-family: inherit;
}
.win-btn.active {
  background: var(--surface-2);
  color: var(--emerald);
  border: 1px solid rgba(0, 230, 118, 0.35);
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 12px;
}
.kpi-box {
  background: var(--surface-1);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.kpi-title { font-size: 11px; color: var(--text-muted); font-weight: 600; }
.kpi-value { font-size: 21px; font-weight: 800; font-family: 'JetBrains Mono', monospace; }
.kpi-foot  { font-size: 11px; color: var(--text-dim); }

.guardrails-bars {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}
.guard-item {
  background: rgba(3, 6, 12, 0.6);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  padding: 14px;
}
.guard-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; font-size: 12.5px; }
.guard-head span { font-family: 'JetBrains Mono', monospace; font-weight: 700; }
.guard-track { height: 7px; background: rgba(148, 163, 184, 0.14); border-radius: 999px; overflow: hidden; }
.guard-fill { height: 100%; border-radius: 999px; transition: width 0.5s ease; }

.charts-grid, .bottom-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 16px;
}
.chart-container {
  height: 200px;
  display: flex;
  align-items: flex-end;
  gap: 6px;
  padding-top: 16px;
}
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; height: 100%; justify-content: flex-end; gap: 4px; }
.bar-stack { width: 100%; max-width: 24px; display: flex; flex-direction: column-reverse; gap: 2px; height: 155px; justify-content: flex-start; }
.bar-seg-ok { background: linear-gradient(180deg, var(--emerald), #059669); border-radius: 3px; width: 100%; min-height: 2px; }
.bar-seg-fail { background: rgba(255, 46, 84, 0.6); border-radius: 3px; width: 100%; }
.bar-label, .bar-val-top { font-size: 9.5px; font-family: 'JetBrains Mono', monospace; color: var(--text-muted); }

.declines-list, .webhooks-list { display: flex; flex-direction: column; gap: 8px; }
.decline-row, .wh-item {
  background: rgba(3, 6, 12, 0.6);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  padding: 10px 12px;
}
.decline-top { display: flex; justify-content: space-between; font-size: 12px; font-weight: 600; margin-bottom: 6px; }
.decline-code { font-family: 'JetBrains Mono', monospace; color: #ff8a9f; }
.wh-url { font-family: 'JetBrains Mono', monospace; font-size: 11.5px; word-break: break-all; }
.wh-events { display: flex; flex-wrap: wrap; gap: 5px; }
.wh-ev { font-family: 'JetBrains Mono', monospace; font-size: 10px; padding: 2px 6px; border-radius: 5px; background: var(--surface-2); color: var(--text-muted); }
.empty-cell { text-align: center; color: var(--text-muted); padding: 22px !important; }

/* ============================================================================
   STICKY MOBILE BOTTOM NAVIGATION BAR (HIDDEN ON DESKTOP)
   ============================================================================ */
.mobile-bottom-nav {
  display: none;
}

/* ============================================================================
   TABLET & MOBILE BREAKPOINTS (TRUE MOBILE-FIRST EXPERIENCE)
   ============================================================================ */
@media (max-width: 1150px) {
  .kpi-grid-6, .kpi-grid { grid-template-columns: repeat(3, 1fr); }
  .kpi-grid-5 { grid-template-columns: repeat(3, 1fr); }
  .winners-grid-3 { grid-template-columns: 1fr; }
  .bucket-cards-grid, .shields-grid, .balance-grid { grid-template-columns: repeat(2, 1fr); }
  .hero-grid, .charts-grid, .bottom-grid, .guardrails-bars, .templates-grid { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .shell {
    padding: 12px 12px 96px;
    gap: 12px;
  }

  /* Compact Tactical Topbar on Mobile */
  .topbar {
    padding: 12px 14px;
    gap: 12px;
  }
  .brand-logo {
    width: 38px;
    height: 38px;
  }
  .topbar h1 {
    font-size: 16.5px;
    line-height: 1.2;
  }
  .top-controls {
    width: 100%;
    justify-content: space-between;
    gap: 8px;
  }
  .account-tabs {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
  }
  .acc-tab {
    justify-content: center;
    padding: 7px 6px;
    font-size: 11px;
  }
  .acc-tab small { display: none; }
  .sync-group {
    width: 100%;
    justify-content: space-between;
  }
  .btn-sync {
    padding: 7px 12px;
    font-size: 11.5px;
  }

  /* Compact Cha-Ching Bar on Mobile */
  .chaching-bar {
    padding: 11px 13px;
    gap: 10px;
  }
  .chaching-actions {
    width: 100%;
    display: grid;
    grid-template-columns: 1.4fr 1fr;
    gap: 8px;
  }
  .chaching-btn, .chaching-test-btn {
    width: 100%;
    text-align: center;
    justify-content: center;
    padding: 9px 10px;
    font-size: 11.5px;
  }

  /* Hide bulky desktop tab row; keep only compact Killswitch bar on top & use Sticky Bottom Nav */
  .view-nav-bar {
    padding: 8px 12px;
  }
  .view-tabs {
    display: none;
  }
  .ks-pill-wrap {
    width: 100%;
  }

  /* 2-Column Tactical HUD Grid on Mobile! */
  .kpi-grid-6, .kpi-grid, .balance-grid, .bucket-cards-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 9px;
  }
  .kpi-grid-5 {
    grid-template-columns: repeat(2, 1fr);
    gap: 9px;
  }
  .kpi-grid-5 > .bucket-card:last-child {
    grid-column: span 2;
  }
  .shields-grid {
    grid-template-columns: 1fr;
    gap: 9px;
  }

  .bucket-card, .kpi-box, .bal-box {
    padding: 12px;
    border-radius: 11px;
  }
  .bucket-head {
    font-size: 10.5px;
    margin-bottom: 5px;
  }
  .bucket-val, .kpi-value {
    font-size: 20px !important;
  }
  .bucket-desc, .kpi-foot {
    font-size: 10.5px;
  }

  .winner-card {
    padding: 13px 14px;
  }

  .clean-table-card, .card, .canvas-card {
    padding: 14px 12px;
    border-radius: 14px;
  }

  .section-title {
    font-size: 14.5px;
  }

  .filter-pills {
    width: 100%;
    overflow-x: auto;
    flex-wrap: nowrap;
    padding-bottom: 4px;
  }
  .filter-pill-btn {
    white-space: nowrap;
    flex-shrink: 0;
    padding: 6px 11px;
    font-size: 11.5px;
  }

  .score-card {
    flex-direction: column;
    text-align: center;
    gap: 12px;
  }
  .account-flags {
    justify-content: center;
  }

  /* ==========================================================================
     MOBILE TABLE -> NATIVE TACTICAL CARDS TRANSFORMATION
     Every <tr> becomes a sleek HUD card with left label (`data-label`) + right value
     ========================================================================== */
  .tx-table thead {
    display: none;
  }
  .tx-table, .tx-table tbody {
    display: block;
    width: 100%;
  }
  .tx-table tbody tr {
    display: block;
    background: rgba(6, 11, 22, 0.9);
    border: 1px solid rgba(0, 230, 118, 0.18);
    border-radius: 12px;
    margin-bottom: 10px;
    padding: 10px 12px;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
  }
  .tx-table tbody td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    padding: 7px 0;
    border-bottom: 1px solid rgba(148, 163, 184, 0.08);
    text-align: right;
    font-size: 12px;
  }
  .tx-table tbody td:last-child {
    border-bottom: none;
    padding-bottom: 2px;
  }
  .tx-table tbody td::before {
    content: attr(data-label);
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    text-align: left;
    flex-shrink: 0;
  }
  .tx-table tbody td.empty-cell {
    display: block;
    text-align: center;
  }
  .tx-table tbody td.empty-cell::before {
    display: none;
  }
  .trail-badges {
    justify-content: flex-end;
    max-width: 220px;
  }

  /* STICKY GLASSMORPHIC MOBILE BOTTOM NAVIGATION BAR */
  .mobile-bottom-nav {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 9000;
    background: rgba(4, 8, 16, 0.94);
    border-top: 1px solid rgba(0, 230, 118, 0.3);
    box-shadow: 0 -8px 28px rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(20px);
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom, 0px));
  }
  .mobile-nav-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    padding: 5px 2px;
    border-radius: 8px;
    font-family: inherit;
    font-size: 10px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.15s;
  }
  .mobile-nav-btn .m-ico {
    font-size: 15px;
    line-height: 1;
  }
  .mobile-nav-btn.active {
    color: var(--emerald);
    background: rgba(0, 230, 118, 0.12);
    box-shadow: inset 0 0 0 1px rgba(0, 230, 118, 0.3);
  }
}
