:root {
  --bg-main: #090d16;
  --bg-panel: #111827;
  --bg-card: #161f33;
  --bg-card-hover: #1e2942;
  --border-subtle: #24324d;
  --border-accent: #10b981;
  --text-primary: #f8fafc;
  --text-secondary: #cbd5e1;
  --text-muted: #94a3b8;
  --emerald: #10b981;
  --emerald-soft: rgba(16, 185, 129, 0.14);
  --blue: #3b82f6;
  --blue-soft: rgba(59, 130, 246, 0.15);
  --purple: #8b5cf6;
  --amber: #f59e0b;
  --amber-soft: rgba(245, 158, 11, 0.15);
  --crimson: #ef4444;
  --crimson-soft: rgba(239, 68, 68, 0.15);
  --radius-md: 10px;
  --radius-lg: 14px;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', 'SFMono-Regular', Consolas, monospace;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background: var(--bg-main);
  color: var(--text-primary);
  font-family: var(--font-sans);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Top Utility Bar */
.top-header {
  background: rgba(17, 24, 39, 0.95);
  border-bottom: 1px solid var(--border-subtle);
  padding: 12px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 40;
  backdrop-filter: blur(10px);
}

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

.brand-logo {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: linear-gradient(135deg, #10b981 0%, #059669 50%, #2563eb 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 17px;
  color: #fff;
  box-shadow: 0 0 18px rgba(16, 185, 129, 0.35);
}

.brand-title {
  font-size: 17px;
  font-weight: 800;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 8px;
}

.badge-zero-fee {
  background: var(--emerald-soft);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.4);
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  font-family: var(--font-mono);
}

.brand-subtitle {
  font-size: 12px;
  color: var(--text-muted);
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.btn {
  border: 1px solid var(--border-subtle);
  background: var(--bg-card);
  color: var(--text-primary);
  padding: 8px 13px;
  border-radius: 8px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
}

.btn:hover {
  background: var(--bg-card-hover);
  border-color: #3b4f76;
}

.btn-emerald {
  background: linear-gradient(135deg, #10b981, #059669);
  border-color: #10b981;
  color: #04130d;
  font-weight: 700;
}

.btn-emerald:hover {
  filter: brightness(1.08);
  color: #04130d;
}

.btn-crimson {
  background: var(--crimson-soft);
  border-color: rgba(239, 68, 68, 0.45);
  color: #fca5a5;
}

.btn-crimson:hover {
  background: rgba(239, 68, 68, 0.25);
}

.btn-blue {
  background: var(--blue-soft);
  border-color: rgba(59, 130, 246, 0.45);
  color: #93c5fd;
}

/* Main Workspace Layout */
.workspace-shell {
  display: grid;
  grid-template-columns: 270px 1fr;
  flex: 1;
  min-height: calc(100vh - 65px);
}

.sidebar {
  background: var(--bg-panel);
  border-right: 1px solid var(--border-subtle);
  padding: 18px 14px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 20px;
}

.nav-section-label {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  font-weight: 700;
  padding: 0 10px;
  margin-bottom: 8px;
}

.nav-list {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.nav-btn {
  width: 100%;
  text-align: left;
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-secondary);
  padding: 10px 12px;
  border-radius: 9px;
  cursor: pointer;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  transition: all 0.15s ease;
}

.nav-btn:hover {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-primary);
}

.nav-btn.active {
  background: var(--emerald-soft);
  border-color: rgba(16, 185, 129, 0.45);
  color: #fff;
}

.nav-icon {
  font-size: 16px;
  line-height: 1.2;
}

.nav-text-title {
  font-size: 13px;
  font-weight: 700;
  display: block;
}

.nav-text-sub {
  font-size: 11px;
  color: var(--text-muted);
  display: block;
  margin-top: 2px;
}

.covenant-box {
  background: rgba(16, 185, 129, 0.07);
  border: 1px solid rgba(16, 185, 129, 0.3);
  border-radius: var(--radius-md);
  padding: 12px;
  font-size: 11.5px;
}

.covenant-box h4 {
  color: #34d399;
  font-size: 12px;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.covenant-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 5px;
  color: var(--text-secondary);
}

/* Main Content Area */
.main-content {
  padding: 22px 28px 48px;
  overflow-y: auto;
  max-width: 1440px;
}

.view-section {
  display: none;
}

.view-section.active {
  display: block;
}

.view-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

.view-title {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.view-subtitle {
  font-size: 13.5px;
  color: var(--text-secondary);
  margin-top: 4px;
  max-width: 860px;
}

/* KPI Strip */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.kpi-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 14px 16px;
}

.kpi-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  font-weight: 700;
}

.kpi-value {
  font-size: 23px;
  font-weight: 800;
  font-family: var(--font-mono);
  margin-top: 4px;
}

.kpi-sub {
  font-size: 11.5px;
  color: var(--text-secondary);
  margin-top: 4px;
}

/* Grid Layouts */
.two-col-grid {
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  gap: 18px;
  align-items: start;
}

.panel-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  margin-bottom: 18px;
}

.panel-title {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

/* Event Selector Pills */
.event-selector-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.event-pill {
  background: var(--bg-panel);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  padding: 11px 13px;
  cursor: pointer;
  text-align: left;
  transition: all 0.15s ease;
  color: var(--text-primary);
}

.event-pill:hover {
  border-color: #3b82f6;
}

.event-pill.active {
  background: rgba(16, 185, 129, 0.11);
  border-color: var(--emerald);
  box-shadow: 0 0 0 1px var(--emerald);
}

.event-pill-cat {
  font-size: 10.5px;
  font-weight: 700;
  color: #34d399;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.event-pill-title {
  font-size: 13px;
  font-weight: 700;
  margin-top: 3px;
}

.event-pill-meta {
  font-size: 11.5px;
  color: var(--text-muted);
  margin-top: 4px;
  display: flex;
  justify-content: space-between;
}

/* SVG Venue Seat Map */
.seatmap-wrapper {
  background: #0b111e;
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 14px;
  text-align: center;
}

.seatmap-svg {
  width: 100%;
  max-height: 290px;
  display: block;
  margin: 0 auto;
}

.seat-node {
  cursor: pointer;
  transition: transform 0.12s ease, opacity 0.12s ease;
}

.seat-node:hover {
  opacity: 0.9;
}

/* Side-by-Side Receipt Comparison */
.receipt-comparison-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.receipt-box {
  border-radius: 12px;
  padding: 15px;
  font-size: 12.5px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.receipt-tm {
  background: rgba(239, 68, 68, 0.07);
  border: 1px solid rgba(239, 68, 68, 0.35);
}

.receipt-ot {
  background: rgba(16, 185, 129, 0.09);
  border: 2px solid var(--emerald);
}

.receipt-header {
  font-weight: 800;
  font-size: 13.5px;
  padding-bottom: 8px;
  border-bottom: 1px dashed var(--border-subtle);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.receipt-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.receipt-total {
  border-top: 1px solid var(--border-subtle);
  padding-top: 8px;
  margin-top: 4px;
  font-size: 15px;
  font-weight: 800;
  font-family: var(--font-mono);
  display: flex;
  justify-content: space-between;
}

.commons-tip-card {
  background: rgba(59, 130, 246, 0.1);
  border: 1px solid rgba(59, 130, 246, 0.38);
  border-radius: 10px;
  padding: 12px 14px;
  margin-top: 12px;
}

.tip-pills {
  display: flex;
  gap: 6px;
  margin-top: 8px;
  flex-wrap: wrap;
}

.tip-pill {
  background: var(--bg-panel);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  padding: 5px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  font-family: var(--font-mono);
}

.tip-pill.active {
  background: var(--emerald);
  color: #04130d;
  border-color: var(--emerald);
}

/* View 2: Rotating TOTP Wallet Pass */
.wallet-pass-card {
  background: linear-gradient(160deg, #131d31 0%, #0b1322 100%);
  border: 2px solid #10b981;
  border-radius: 18px;
  padding: 20px;
  box-shadow: 0 12px 35px rgba(0, 0, 0, 0.45);
}

.qr-frame {
  background: #ffffff;
  padding: 14px;
  border-radius: 12px;
  width: 220px;
  height: 220px;
  margin: 14px auto;
  display: flex;
  align-items: center;
  justify-content: center;
}

.totp-progress-track {
  width: 100%;
  height: 8px;
  background: #1e293b;
  border-radius: 999px;
  overflow: hidden;
  margin: 8px 0;
}

.totp-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #10b981, #3b82f6);
  transition: width 0.4s linear;
}

/* Form Controls */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-bottom: 10px;
}

.form-group label {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text-secondary);
}

.form-control {
  background: var(--bg-panel);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  padding: 9px 11px;
  border-radius: 8px;
  font-size: 13px;
  font-family: var(--font-sans);
}

/* Tables & GL Journal */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}

.data-table th,
.data-table td {
  padding: 9px 10px;
  border-bottom: 1px solid var(--border-subtle);
  text-align: left;
}

.data-table th {
  color: var(--text-muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

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

/* Drawers / Modals */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(4, 8, 16, 0.78);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
}

.modal-backdrop.open {
  display: flex;
}

.modal-card {
  background: var(--bg-panel);
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  max-width: 760px;
  width: 100%;
  max-height: 88vh;
  overflow-y: auto;
  padding: 24px;
}

.status-banner {
  padding: 12px 14px;
  border-radius: 10px;
  font-size: 12.5px;
  margin-top: 12px;
}

.status-banner.ok {
  background: var(--emerald-soft);
  border: 1px solid rgba(16, 185, 129, 0.45);
  color: #6ee7b7;
}

.status-banner.blocked {
  background: var(--crimson-soft);
  border: 1px solid rgba(239, 68, 68, 0.5);
  color: #fca5a5;
}

@media (max-width: 1024px) {
  .workspace-shell {
    grid-template-columns: 1fr;
  }
  .two-col-grid,
  .receipt-comparison-grid {
    grid-template-columns: 1fr;
  }
}
