/* ============================================================
   ASG Virtual Truck — Broadcast Control Surface
   ============================================================ */

:root {
  /* Brand */
  --brand-blue: #0284C7;
  --brand-blue-bright: #38BDF8;
  --brand-blue-deep: #0369A1;

  /* Dark surface tokens (default) */
  --bg-0: #07090E;          /* deepest, page bg */
  --bg-1: #0C0F16;          /* panel bg */
  --bg-2: #11151E;          /* raised panel / row */
  --bg-3: #181D28;          /* hover, input bg */
  --bg-4: #232A38;          /* strong hover, selected */
  --border-1: #1B2230;      /* default border */
  --border-2: #283142;      /* strong border */
  --border-3: #364158;      /* focus border */

  --fg-0: #F1F5FB;          /* primary text */
  --fg-1: #C3CCDA;          /* secondary text */
  --fg-2: #8995A8;          /* muted */
  --fg-3: #5B6678;          /* very muted, labels */

  /* Status LEDs */
  --led-green: #22C55E;
  --led-green-glow: rgba(34, 197, 94, 0.45);
  --led-amber: #F59E0B;
  --led-amber-glow: rgba(245, 158, 11, 0.45);
  --led-red: #EF4444;
  --led-red-glow: rgba(239, 68, 68, 0.45);
  --led-blue: #38BDF8;
  --led-blue-glow: rgba(56, 189, 248, 0.45);
  --led-gray: #5B6678;

  --accent: var(--brand-blue);
  --accent-fg: #FFFFFF;

  /* Type */
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", "SF Mono", Menlo, Consolas, monospace;

  /* Geometry */
  --r-sm: 4px;
  --r-md: 6px;
  --r-lg: 10px;

  --shadow-1: 0 1px 0 rgba(255,255,255,0.03) inset, 0 1px 2px rgba(0,0,0,0.4);
  --shadow-2: 0 8px 24px rgba(0,0,0,0.5), 0 0 0 1px var(--border-1);
}

/* Light theme */
[data-theme="light"] {
  --bg-0: #F4F6FA;
  --bg-1: #FFFFFF;
  --bg-2: #FAFBFD;
  --bg-3: #EEF1F6;
  --bg-4: #E2E7EF;
  --border-1: #E2E7EF;
  --border-2: #CDD4E0;
  --border-3: #ADB6C7;

  --fg-0: #0B1220;
  --fg-1: #2C3647;
  --fg-2: #5B6678;
  --fg-3: #8995A8;

  --led-green: #15803D;
  --led-amber: #B45309;
  --led-red: #B91C1C;
  --led-gray: #64748B;

  --shadow-1: 0 1px 0 rgba(255,255,255,0.7) inset, 0 1px 2px rgba(11,18,32,0.08);
  --shadow-2: 0 8px 24px rgba(11,18,32,0.10), 0 0 0 1px var(--border-1);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg-0); color: var(--fg-0); }
body {
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "cv11", "ss01";
  min-height: 100vh;
  overflow-x: hidden;
}

/* ============================================================
   App shell
   ============================================================ */
.app {
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto auto 1fr;
  background:
    radial-gradient(ellipse 1200px 600px at 50% -200px, rgba(2, 132, 199, 0.12), transparent 60%),
    var(--bg-0);
}
[data-theme="light"] .app {
  background:
    radial-gradient(ellipse 1200px 600px at 50% -200px, rgba(2, 132, 199, 0.08), transparent 60%),
    var(--bg-0);
}

/* ============================================================
   Top header
   ============================================================ */
.header {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 14px 24px;
  border-bottom: 1px solid var(--border-1);
  background: linear-gradient(180deg, rgba(255,255,255,0.02), transparent), var(--bg-1);
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(8px);
}
.header-logo {
  display: flex;
  align-items: center;
  gap: 12px;
}
.header-logo img {
  height: 28px;
  display: block;
}
[data-theme="light"] .header-logo img {
  filter: invert(1);
}
.header-logo-sep {
  width: 1px;
  height: 22px;
  background: var(--border-2);
}
.header-logo-text {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}
.header-logo-text strong {
  font-size: 13px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.header-logo-text span {
  font-size: 11px;
  color: var(--fg-2);
  font-family: var(--font-mono);
  letter-spacing: 0.06em;
}
.header-nav {
  display: flex;
  gap: 2px;
  margin-left: 24px;
}
.header-nav a {
  color: var(--fg-1);
  text-decoration: none;
  padding: 8px 12px;
  border-radius: var(--r-md);
  font-size: 13px;
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
}
.header-nav a:hover { background: var(--bg-3); color: var(--fg-0); }
.header-nav a.active {
  color: var(--brand-blue-bright);
  background: rgba(56, 189, 248, 0.08);
}
[data-theme="light"] .header-nav a.active {
  color: var(--brand-blue-deep);
  background: rgba(2, 132, 199, 0.10);
}

.header-spacer { flex: 1; }
.header-right { display: flex; align-items: center; gap: 10px; }

/* Theme toggle */
.theme-toggle {
  position: relative;
  width: 56px;
  height: 28px;
  background: var(--bg-3);
  border: 1px solid var(--border-1);
  border-radius: 999px;
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
  transition: background 0.2s;
}
.theme-toggle-knob {
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--brand-blue);
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.5), 0 1px 2px rgba(0,0,0,0.5);
  transform: translateX(2px);
  transition: transform 0.2s, background 0.2s;
  display: grid;
  place-items: center;
}
[data-theme="light"] .theme-toggle-knob {
  transform: translateX(30px);
  background: #FBBF24;
  box-shadow: 0 0 12px rgba(251, 191, 36, 0.6), 0 1px 2px rgba(11,18,32,0.2);
}
.theme-toggle-knob svg { width: 12px; height: 12px; color: white; }

/* ============================================================
   Status banner
   ============================================================ */
.status-banner {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 20px;
  padding: 14px 24px;
  border-bottom: 1px solid var(--border-1);
  background:
    linear-gradient(90deg, rgba(34, 197, 94, 0.06), transparent 60%),
    var(--bg-1);
  position: relative;
}
.status-banner::before {
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--led-green);
  box-shadow: 0 0 16px var(--led-green-glow);
}
.status-banner[data-state="building"] { background: linear-gradient(90deg, rgba(245,158,11,0.06), transparent 60%), var(--bg-1); }
.status-banner[data-state="building"]::before { background: var(--led-amber); box-shadow: 0 0 16px var(--led-amber-glow); }
.status-banner[data-state="failed"] { background: linear-gradient(90deg, rgba(239,68,68,0.08), transparent 60%), var(--bg-1); }
.status-banner[data-state="failed"]::before { background: var(--led-red); box-shadow: 0 0 16px var(--led-red-glow); }
.status-banner[data-state="stopped"] { background: var(--bg-1); }
.status-banner[data-state="stopped"]::before { background: var(--led-gray); box-shadow: none; }

.status-left {
  display: flex;
  align-items: center;
  gap: 14px;
}
.status-led {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--led-green);
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.18), 0 0 16px var(--led-green-glow);
  position: relative;
}
.status-led.amber { background: var(--led-amber); box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.18), 0 0 16px var(--led-amber-glow); }
.status-led.red { background: var(--led-red); box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.18), 0 0 16px var(--led-red-glow); }
.status-led.gray { background: var(--led-gray); box-shadow: none; }
.status-led.pulse::after {
  content: "";
  position: absolute; inset: 0;
  border-radius: 50%;
  background: inherit;
  animation: ledPulse 1.6s ease-out infinite;
}
@keyframes ledPulse {
  0%   { transform: scale(1); opacity: 0.6; }
  100% { transform: scale(3.5); opacity: 0; }
}

.status-title { display: flex; flex-direction: column; gap: 2px; }
.status-title-name {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.status-title-meta {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--fg-2);
  letter-spacing: 0.04em;
}

.status-mid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0;
  border-left: 1px solid var(--border-1);
  border-right: 1px solid var(--border-1);
}
.status-stat {
  padding: 4px 16px;
  border-right: 1px solid var(--border-1);
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.status-stat:last-child { border-right: none; }
.status-stat-label {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--fg-3);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.status-stat-value {
  font-family: var(--font-mono);
  font-size: 14px;
  color: var(--fg-0);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.status-stat-value .unit {
  color: var(--fg-2);
  font-size: 11px;
  margin-left: 2px;
}

.status-right { display: flex; gap: 8px; }

/* ============================================================
   Main layout: tabs / sidebar / scroll
   ============================================================ */
.main {
  max-width: 1480px;
  width: 100%;
  margin: 0 auto;
  padding: 0 24px 64px;
}

.tabs {
  display: flex;
  align-items: center;
  gap: 2px;
  border-bottom: 1px solid var(--border-1);
  padding-top: 16px;
  position: sticky;
  top: 60px;
  background: linear-gradient(180deg, var(--bg-0) 70%, transparent);
  z-index: 20;
}
.tab {
  background: none;
  border: none;
  color: var(--fg-1);
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.01em;
  padding: 10px 16px 12px;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: color 0.15s;
  position: relative;
  margin-bottom: -1px;
}
.tab:hover { color: var(--fg-0); }
.tab.active {
  color: var(--brand-blue-bright);
  border-bottom-color: var(--brand-blue-bright);
}
[data-theme="light"] .tab.active {
  color: var(--brand-blue-deep);
  border-bottom-color: var(--brand-blue-deep);
}
.tab-count {
  font-family: var(--font-mono);
  font-size: 11px;
  background: var(--bg-3);
  color: var(--fg-2);
  padding: 2px 6px;
  border-radius: var(--r-sm);
  font-weight: 500;
}
.tab.active .tab-count {
  background: rgba(56, 189, 248, 0.12);
  color: var(--brand-blue-bright);
}
[data-theme="light"] .tab.active .tab-count {
  background: rgba(2, 132, 199, 0.12);
  color: var(--brand-blue-deep);
}

.tab-content {
  padding-top: 24px;
}

/* ============================================================
   Sidebar layout variant (event page only)
   ============================================================ */
.page-event.layout-sidebar .main {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 24px;
  max-width: 1600px;
}
.page-event.layout-sidebar .tabs { display: none; }
.page-event.layout-sidebar .sidebar { display: block; }
.sidebar { display: none; }
.page-event.layout-sidebar .sidebar {
  padding-top: 24px;
  border-right: 1px solid var(--border-1);
  padding-right: 12px;
  position: sticky;
  top: 60px;
  align-self: start;
  max-height: calc(100vh - 60px);
  overflow-y: auto;
}
.sidebar-section { margin-bottom: 24px; }
.sidebar-label {
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  color: var(--fg-3);
  letter-spacing: 0.1em;
  padding: 0 10px 8px;
}
.sidebar-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--r-md);
  color: var(--fg-1);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  transition: background 0.15s, color 0.15s;
}
.sidebar-item:hover { background: var(--bg-3); color: var(--fg-0); }
.sidebar-item.active {
  background: rgba(56, 189, 248, 0.10);
  color: var(--brand-blue-bright);
}
[data-theme="light"] .sidebar-item.active {
  background: rgba(2, 132, 199, 0.10);
  color: var(--brand-blue-deep);
}
.sidebar-item .sidebar-count {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--fg-2);
  font-weight: 500;
}

/* Single scroll layout — event page */
.page-event.layout-scroll .tabs { display: none; }
.page-event.layout-scroll .tab-content > section { margin-bottom: 32px; }

/* ============================================================
   Panels, cards
   ============================================================ */
.panel {
  background: var(--bg-1);
  border: 1px solid var(--border-1);
  border-radius: var(--r-lg);
  overflow: hidden;
}
.panel-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-1);
  background: linear-gradient(180deg, rgba(255,255,255,0.02), transparent);
}
[data-theme="light"] .panel-header {
  background: linear-gradient(180deg, rgba(11,18,32,0.02), transparent);
}
.panel-title {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.panel-title h2 {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  font-family: var(--font-mono);
  display: flex;
  align-items: center;
  gap: 8px;
}
.panel-title h2 .accent { color: var(--brand-blue-bright); }
[data-theme="light"] .panel-title h2 .accent { color: var(--brand-blue-deep); }
.panel-title p {
  margin: 0;
  font-size: 12px;
  color: var(--fg-2);
}
.panel-header-actions { margin-left: auto; display: flex; gap: 8px; align-items: center; }

.panel-body { padding: 18px; }
.panel-body.flush { padding: 0; }

/* Section spacer */
.row { display: flex; gap: 16px; flex-wrap: wrap; }
.row > * { flex: 1; min-width: 0; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.stack-sm { display: flex; flex-direction: column; gap: 8px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
@media (max-width: 1100px) {
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
}

/* ============================================================
   Buttons
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 12px;
  border-radius: var(--r-md);
  border: 1px solid var(--border-2);
  background: var(--bg-2);
  color: var(--fg-0);
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s, transform 0.12s;
  white-space: nowrap;
}
.btn:hover { background: var(--bg-3); border-color: var(--border-3); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }

.btn-primary {
  background: var(--brand-blue);
  color: var(--accent-fg);
  border-color: var(--brand-blue);
  box-shadow: 0 0 0 1px rgba(56, 189, 248, 0.3) inset, 0 1px 2px rgba(0,0,0,0.3);
}
.btn-primary:hover { background: var(--brand-blue-bright); border-color: var(--brand-blue-bright); }
[data-theme="light"] .btn-primary:hover { background: var(--brand-blue-deep); border-color: var(--brand-blue-deep); }

.btn-ghost {
  background: transparent;
  border-color: var(--border-1);
}
.btn-ghost:hover { background: var(--bg-3); }

.btn-danger {
  background: transparent;
  border-color: var(--border-2);
  color: var(--led-red);
}
.btn-danger:hover { background: rgba(239, 68, 68, 0.1); border-color: var(--led-red); }

.btn-icon {
  padding: 6px;
  width: 28px; height: 28px;
}

.btn-sm { padding: 5px 9px; font-size: 11px; }

/* Segmented toggle */
.seg {
  display: inline-flex;
  background: var(--bg-3);
  border: 1px solid var(--border-1);
  border-radius: var(--r-md);
  padding: 2px;
  gap: 2px;
}
.seg button {
  background: none;
  border: none;
  color: var(--fg-1);
  font-size: 11px;
  font-weight: 500;
  padding: 5px 10px;
  border-radius: 4px;
  cursor: pointer;
  font-family: var(--font-sans);
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.seg button.active {
  background: var(--bg-1);
  color: var(--brand-blue-bright);
  box-shadow: 0 1px 2px rgba(0,0,0,0.3);
}
[data-theme="light"] .seg button.active {
  background: var(--bg-1);
  color: var(--brand-blue-deep);
}

/* ============================================================
   Pills / Tags
   ============================================================ */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 500;
  font-family: var(--font-mono);
  letter-spacing: 0.04em;
  background: var(--bg-3);
  color: var(--fg-1);
  border: 1px solid var(--border-1);
  text-transform: uppercase;
}
.pill-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: currentColor;
}
.pill-running { color: var(--led-green); background: rgba(34, 197, 94, 0.08); border-color: rgba(34, 197, 94, 0.25); }
.pill-building { color: var(--led-amber); background: rgba(245, 158, 11, 0.08); border-color: rgba(245, 158, 11, 0.25); }
.pill-failed   { color: var(--led-red);   background: rgba(239, 68, 68, 0.08); border-color: rgba(239, 68, 68, 0.25); }
.pill-stopped  { color: var(--led-gray);  background: rgba(91, 102, 120, 0.08); border-color: rgba(91, 102, 120, 0.3); }
.pill-info     { color: var(--brand-blue-bright); background: rgba(56, 189, 248, 0.08); border-color: rgba(56, 189, 248, 0.25); }
[data-theme="light"] .pill-info { color: var(--brand-blue-deep); background: rgba(2,132,199,0.08); border-color: rgba(2,132,199,0.25); }

.pill-running .pill-dot { box-shadow: 0 0 8px var(--led-green-glow); animation: dotPulse 2s ease-in-out infinite; }
.pill-building .pill-dot { animation: dotBlink 1s steps(2) infinite; }
@keyframes dotPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}
@keyframes dotBlink {
  0%, 49% { opacity: 1; }
  50%, 100% { opacity: 0.3; }
}

/* ============================================================
   Inputs
   ============================================================ */
.input {
  background: var(--bg-2);
  border: 1px solid var(--border-1);
  border-radius: var(--r-md);
  padding: 8px 10px;
  font-family: var(--font-sans);
  font-size: 13px;
  color: var(--fg-0);
  width: 100%;
  transition: border-color 0.12s, background 0.12s;
}
.input:focus {
  outline: none;
  border-color: var(--brand-blue);
  background: var(--bg-3);
  box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.18);
}
.input::placeholder { color: var(--fg-3); }

.label {
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  color: var(--fg-3);
  letter-spacing: 0.1em;
  margin-bottom: 6px;
  display: block;
}

/* ============================================================
   Details tab — info cards
   ============================================================ */
.info-card {
  background: var(--bg-2);
  border: 1px solid var(--border-1);
  border-radius: var(--r-md);
  padding: 14px;
  position: relative;
}
.info-card-label {
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  color: var(--fg-3);
  letter-spacing: 0.1em;
  margin-bottom: 6px;
}
.info-card-value {
  font-size: 15px;
  font-weight: 600;
  color: var(--fg-0);
  letter-spacing: -0.01em;
}
.info-card-meta {
  font-size: 12px;
  color: var(--fg-2);
  margin-top: 4px;
}
.info-card.mono .info-card-value { font-family: var(--font-mono); font-weight: 500; font-size: 14px; }

/* Product chips */
.product-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: var(--bg-3);
  border: 1px solid var(--border-1);
  border-radius: 999px;
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--fg-1);
  letter-spacing: 0.02em;
}

/* ============================================================
   Products
   ============================================================ */
.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}
.product-card {
  background: var(--bg-2);
  border: 1px solid var(--border-1);
  border-radius: var(--r-md);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  position: relative;
  transition: border-color 0.15s, background 0.15s;
}
.product-card:hover { border-color: var(--border-2); background: var(--bg-3); }
.product-card::before {
  content: "";
  position: absolute; left: 0; top: 12px; bottom: 12px;
  width: 2px;
  background: var(--led-green);
  border-radius: 0 2px 2px 0;
  box-shadow: 0 0 8px var(--led-green-glow);
}
.product-card[data-state="building"]::before { background: var(--led-amber); box-shadow: 0 0 8px var(--led-amber-glow); }
.product-card[data-state="failed"]::before { background: var(--led-red); box-shadow: 0 0 8px var(--led-red-glow); }
.product-card[data-state="stopped"]::before { background: var(--led-gray); box-shadow: none; }

.product-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}
.product-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--fg-0);
  letter-spacing: -0.01em;
  margin: 0;
}
.product-id {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--fg-3);
  letter-spacing: 0.04em;
  margin-top: 2px;
}
.product-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.product-actions {
  display: flex;
  gap: 6px;
  margin-top: auto;
}
.product-actions .btn { flex: 1; }

/* compact variant */
.product-grid.compact {
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 8px;
}
.product-grid.compact .product-card { padding: 10px 12px; gap: 8px; }
.product-grid.compact .product-name { font-size: 12px; }
.product-grid.compact .btn { padding: 5px 8px; font-size: 11px; }

/* List view */
.product-list {
  background: var(--bg-1);
  border: 1px solid var(--border-1);
  border-radius: var(--r-md);
  overflow: hidden;
}
.product-list-row {
  display: grid;
  grid-template-columns: 16px 1fr 110px 110px auto;
  gap: 14px;
  align-items: center;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-1);
  transition: background 0.12s;
}
.product-list-row:last-child { border-bottom: none; }
.product-list-row:hover { background: var(--bg-2); }
.product-list-row.head {
  background: var(--bg-2);
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  color: var(--fg-3);
  letter-spacing: 0.1em;
}

/* ============================================================
   Assets — upload zone
   ============================================================ */
.upload-zone {
  border: 1.5px dashed var(--border-2);
  border-radius: var(--r-md);
  padding: 20px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: center;
  gap: 20px;
  background:
    repeating-linear-gradient(45deg, transparent, transparent 8px, rgba(255,255,255,0.01) 8px, rgba(255,255,255,0.01) 16px),
    var(--bg-2);
  transition: border-color 0.15s, background 0.15s;
}
.upload-zone.drag {
  border-color: var(--brand-blue);
  background: rgba(2, 132, 199, 0.08);
}
.upload-zone-info { display: flex; gap: 14px; align-items: flex-start; }
.upload-zone-icon {
  width: 40px; height: 40px;
  background: rgba(56, 189, 248, 0.1);
  color: var(--brand-blue-bright);
  border-radius: var(--r-md);
  display: grid; place-items: center;
  border: 1px solid rgba(56, 189, 248, 0.25);
  flex: none;
}
[data-theme="light"] .upload-zone-icon { color: var(--brand-blue-deep); }
.upload-zone-text strong {
  display: block;
  font-size: 13px;
  color: var(--fg-0);
  margin-bottom: 2px;
}
.upload-zone-text p {
  margin: 0;
  font-size: 12px;
  color: var(--fg-2);
}

/* Search */
.search {
  position: relative;
  display: flex;
  align-items: center;
}
.search svg { position: absolute; left: 10px; width: 14px; height: 14px; color: var(--fg-3); pointer-events: none; }
.search input { padding-left: 32px; }

/* ============================================================
   Asset table
   ============================================================ */
.asset-table {
  background: var(--bg-1);
  border: 1px solid var(--border-1);
  border-radius: var(--r-md);
  overflow: hidden;
}
.asset-row {
  display: grid;
  grid-template-columns: 28px minmax(180px, 2fr) 90px 90px 160px auto;
  gap: 12px;
  align-items: center;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-1);
  transition: background 0.12s;
}
.asset-row:last-child { border-bottom: none; }
.asset-row.head {
  background: var(--bg-2);
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  color: var(--fg-3);
  letter-spacing: 0.1em;
}
.asset-row:not(.head):hover { background: var(--bg-2); }
.asset-row .name {
  font-size: 13px;
  color: var(--fg-0);
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.asset-row .name span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.asset-row .size, .asset-row .when {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--fg-1);
  font-variant-numeric: tabular-nums;
}
.asset-row .actions {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
}

.file-thumb {
  width: 28px; height: 28px;
  border-radius: var(--r-sm);
  display: grid; place-items: center;
  background: var(--bg-3);
  border: 1px solid var(--border-1);
  color: var(--fg-2);
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  flex: none;
}
.file-thumb.video { background: rgba(168, 85, 247, 0.08); color: #C084FC; border-color: rgba(168, 85, 247, 0.25); }
.file-thumb.image { background: rgba(34, 197, 94, 0.08); color: var(--led-green); border-color: rgba(34, 197, 94, 0.25); }
.file-thumb.audio { background: rgba(251, 191, 36, 0.08); color: #FBBF24; border-color: rgba(251, 191, 36, 0.25); }
.file-thumb.doc   { background: rgba(56, 189, 248, 0.08); color: var(--brand-blue-bright); border-color: rgba(56, 189, 248, 0.25); }

/* Asset grid view */
.asset-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
}
.asset-tile {
  background: var(--bg-2);
  border: 1px solid var(--border-1);
  border-radius: var(--r-md);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: border-color 0.15s, transform 0.15s;
  cursor: pointer;
}
.asset-tile:hover { border-color: var(--border-3); transform: translateY(-2px); }
.asset-tile-preview {
  aspect-ratio: 16 / 10;
  background: repeating-linear-gradient(45deg, var(--bg-3) 0 8px, var(--bg-2) 8px 16px);
  display: grid; place-items: center;
  position: relative;
  border-bottom: 1px solid var(--border-1);
}
.asset-tile-preview .type-badge {
  position: absolute;
  top: 6px; left: 6px;
  font-family: var(--font-mono);
  font-size: 9px;
  background: rgba(0,0,0,0.6);
  color: var(--fg-0);
  padding: 2px 6px;
  border-radius: var(--r-sm);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.asset-tile-preview .play {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: rgba(0,0,0,0.5);
  color: white;
  display: grid; place-items: center;
}
.asset-tile-body {
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.asset-tile-name {
  font-size: 11px;
  color: var(--fg-0);
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.asset-tile-meta {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--fg-3);
}
.asset-tile-actions {
  display: flex;
  gap: 4px;
  padding: 6px 8px;
  border-top: 1px solid var(--border-1);
  background: var(--bg-1);
}
.asset-tile-actions .btn { flex: 1; padding: 4px 4px; font-size: 10px; }

/* ============================================================
   Toast
   ============================================================ */
.toast-wrap {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 100;
  pointer-events: none;
}
.toast {
  background: var(--bg-2);
  border: 1px solid var(--border-2);
  border-left: 3px solid var(--brand-blue);
  border-radius: var(--r-md);
  padding: 10px 14px;
  font-size: 13px;
  color: var(--fg-0);
  box-shadow: var(--shadow-2);
  display: flex;
  align-items: center;
  gap: 10px;
  animation: toastIn 0.2s ease-out;
  pointer-events: auto;
  min-width: 240px;
}
.toast.success { border-left-color: var(--led-green); }
.toast.error { border-left-color: var(--led-red); }
@keyframes toastIn {
  from { opacity: 0; transform: translateX(20px); }
  to { opacity: 1; transform: translateX(0); }
}

/* ============================================================
   Misc / Utility
   ============================================================ */
.divider {
  height: 1px;
  background: var(--border-1);
  margin: 12px 0;
}
.mono { font-family: var(--font-mono); }
.muted { color: var(--fg-2); }
.dim { color: var(--fg-3); }
.spacer { flex: 1; }

.kbd {
  font-family: var(--font-mono);
  font-size: 10px;
  padding: 1px 5px;
  border-radius: 3px;
  background: var(--bg-3);
  border: 1px solid var(--border-2);
  color: var(--fg-1);
}

/* Quick insights mini grid */
.insights-strip {
  display: flex;
  gap: 0;
  border: 1px solid var(--border-1);
  border-radius: var(--r-md);
  overflow: hidden;
  background: var(--bg-2);
}
.insights-strip .insight {
  flex: 1;
  padding: 12px 16px;
  border-right: 1px solid var(--border-1);
}
.insights-strip .insight:last-child { border-right: none; }

/* Drag handle */
.drag-handle {
  cursor: grab;
  color: var(--fg-3);
  display: inline-flex;
  align-items: center;
}
.drag-handle:active { cursor: grabbing; }

/* Animations */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}
.tab-content > * { animation: fadeIn 0.2s ease-out; }

/* Selected row */
.row-selected { background: rgba(56, 189, 248, 0.06) !important; box-shadow: inset 2px 0 0 var(--brand-blue-bright); }

/* Scrollbar */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--bg-0); }
::-webkit-scrollbar-thumb { background: var(--bg-3); border-radius: 5px; border: 2px solid var(--bg-0); }
::-webkit-scrollbar-thumb:hover { background: var(--bg-4); }

/* ============================================================
   Dashboard (events list)
   ============================================================ */
.page-dashboard .main {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 24px;
  padding-top: 24px;
}
@media (max-width: 1100px) {
  .page-dashboard .main { grid-template-columns: 1fr; }
}

.events-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.event-row {
  background: var(--bg-2);
  border: 1px solid var(--border-1);
  border-radius: var(--r-md);
  overflow: hidden;
  transition: border-color 0.15s, background 0.15s;
}
.event-row:hover { border-color: var(--border-2); }
.event-row.expanded { border-color: var(--brand-blue-bright); box-shadow: 0 0 0 1px rgba(56,189,248,0.2); }

.event-row-head {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  gap: 14px;
  align-items: center;
  padding: 12px 16px;
  cursor: pointer;
}
.event-row-head .name {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--fg-0);
}
.event-row-head .meta {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 4px;
  font-size: 11px;
  color: var(--fg-2);
  font-family: var(--font-mono);
  letter-spacing: 0.04em;
}
.event-row-head .meta strong {
  color: var(--fg-0);
  font-weight: 500;
  margin-left: 4px;
}
.event-row-head .caret {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid var(--border-1);
  background: rgba(255,255,255,0.04);
  color: var(--brand-blue-bright);
  transition: transform 0.2s, background 0.15s, border-color 0.15s, color 0.15s;
  flex-shrink: 0;
}
.event-row-head:hover .caret {
  background: rgba(56,189,248,0.12);
  border-color: var(--brand-blue-bright);
  color: var(--brand-blue-bright);
}
.event-row.expanded .caret {
  transform: rotate(180deg);
  background: var(--brand-blue);
  border-color: var(--brand-blue);
  color: #fff;
}

.event-row-body {
  border-top: 1px solid var(--border-1);
  padding: 16px;
  background: linear-gradient(180deg, rgba(56,189,248,0.03), transparent 80%);
  display: grid;
  grid-template-columns: 1fr 1fr 1fr auto;
  gap: 16px;
}
.event-row-body .event-mini-stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.event-row-body .event-mini-stat .label {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--fg-3);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}
.event-row-body .event-mini-stat .value {
  font-size: 13px;
  font-weight: 500;
  color: var(--fg-0);
}
.event-row-body .actions {
  display: flex;
  gap: 6px;
  align-self: center;
}

/* Quick Insights rail */
.insights-rail {
  background: var(--bg-1);
  border: 1px solid var(--border-1);
  border-radius: var(--r-md);
  padding: 16px;
  position: sticky;
  top: 80px;
  align-self: start;
}
.insights-rail h3 {
  margin: 0 0 4px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-family: var(--font-mono);
}
.insights-rail .insights-sub {
  font-size: 11px;
  color: var(--fg-2);
  margin-bottom: 14px;
}
.insights-rail .insight-card {
  border: 1px solid var(--border-1);
  border-radius: var(--r-md);
  padding: 12px;
  margin-bottom: 8px;
  background: var(--bg-2);
}
.insights-rail .insight-card .label {
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  color: var(--fg-3);
  letter-spacing: 0.1em;
}
.insights-rail .insight-card .value {
  font-size: 22px;
  font-weight: 600;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  margin-top: 4px;
}
.insights-rail .insight-card .delta {
  font-size: 11px;
  color: var(--led-green);
  font-family: var(--font-mono);
  margin-top: 2px;
}
.insights-rail .insight-card .delta.down { color: var(--led-red); }

/* Spark line */
.spark { height: 28px; margin-top: 6px; width: 100%; }

/* ============================================================
   Create wizard
   ============================================================ */
.page-create .main { padding-top: 24px; }
.wizard {
  max-width: 1200px;
  margin: 0 auto;
}
.wizard-title {
  margin-bottom: 24px;
}
.wizard-title h1 {
  margin: 0 0 4px;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.wizard-title h1 .accent { color: var(--brand-blue-bright); }
[data-theme="light"] .wizard-title h1 .accent { color: var(--brand-blue-deep); }
.wizard-title p { margin: 0; color: var(--fg-2); font-size: 13px; }

.wizard-progress {
  margin-bottom: 24px;
}
.wizard-progress-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--fg-2);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 8px;
}
.wizard-progress-top strong {
  color: var(--brand-blue-bright);
  font-weight: 600;
}
.wizard-progress-bar {
  height: 3px;
  background: var(--bg-3);
  border-radius: 2px;
  overflow: hidden;
}
.wizard-progress-bar .fill {
  height: 100%;
  background: linear-gradient(90deg, var(--brand-blue), var(--brand-blue-bright));
  transition: width 0.3s ease;
  box-shadow: 0 0 12px var(--brand-blue-bright);
}

.wizard-steps {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
  margin-top: 12px;
}
.wizard-step {
  padding: 12px 16px;
  border: 1px solid var(--border-1);
  border-radius: var(--r-md);
  background: var(--bg-2);
  display: flex;
  align-items: center;
  gap: 12px;
  position: relative;
  transition: border-color 0.15s, background 0.15s;
}
.wizard-step .num {
  width: 24px; height: 24px;
  border-radius: 4px;
  display: grid; place-items: center;
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 12px;
  background: var(--bg-3);
  color: var(--fg-2);
  border: 1px solid var(--border-1);
  flex: none;
}
.wizard-step .title {
  font-weight: 600;
  font-size: 13px;
  letter-spacing: -0.01em;
  color: var(--fg-0);
}
.wizard-step .sub {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--fg-3);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.wizard-step .pill { margin-left: auto; }
.wizard-step.current {
  border-color: var(--brand-blue-bright);
  box-shadow: 0 0 0 1px rgba(56,189,248,0.25);
  background: var(--bg-2);
}
.wizard-step.current .num {
  background: var(--brand-blue);
  border-color: var(--brand-blue);
  color: white;
}
.wizard-step.done .num {
  background: rgba(34, 197, 94, 0.12);
  border-color: rgba(34, 197, 94, 0.3);
  color: var(--led-green);
}
.wizard-step.locked { opacity: 0.55; }

.wizard-panel {
  background: var(--bg-1);
  border: 1px solid var(--border-1);
  border-radius: var(--r-lg);
  padding: 24px;
  margin-top: 20px;
}
.wizard-panel h2 {
  margin: 0 0 4px;
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.wizard-panel h2 .accent { color: var(--brand-blue-bright); }
[data-theme="light"] .wizard-panel h2 .accent { color: var(--brand-blue-deep); }
.wizard-panel > p { color: var(--fg-2); font-size: 13px; margin: 0 0 18px; }

.wizard-footer {
  margin-top: 20px;
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

/* Template card */
.template-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
}
.template-card {
  background: var(--bg-2);
  border: 1.5px solid var(--border-1);
  border-radius: var(--r-md);
  overflow: hidden;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  transition: border-color 0.15s, transform 0.15s;
  position: relative;
}
.template-card:hover { border-color: var(--border-3); transform: translateY(-2px); }
.template-card.selected {
  border-color: var(--brand-blue-bright);
  box-shadow: 0 0 0 1px rgba(56,189,248,0.25), 0 8px 24px rgba(2,132,199,0.15);
}
.template-card .truck-art {
  aspect-ratio: 16 / 9;
  background:
    radial-gradient(circle at 30% 70%, rgba(56,189,248,0.12), transparent 50%),
    repeating-linear-gradient(135deg, var(--bg-3) 0 2px, transparent 2px 14px),
    var(--bg-2);
  border-bottom: 1px solid var(--border-1);
  display: grid;
  place-items: center;
  position: relative;
  color: var(--fg-2);
}
.template-card .truck-art .badge {
  position: absolute;
  top: 10px; left: 10px;
  font-family: var(--font-mono);
  font-size: 10px;
  background: rgba(0,0,0,0.5);
  color: var(--fg-0);
  padding: 3px 8px;
  border-radius: var(--r-sm);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border: 1px solid var(--border-1);
}
.template-card .truck-art .price {
  position: absolute;
  top: 10px; right: 10px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--brand-blue-bright);
  background: rgba(56,189,248,0.1);
  padding: 3px 8px;
  border-radius: var(--r-sm);
  letter-spacing: 0.04em;
  border: 1px solid rgba(56,189,248,0.25);
}
.template-card .body { padding: 14px; flex: 1; }
.template-card .body h3 {
  margin: 0 0 4px;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.template-card .body .desc { color: var(--fg-2); font-size: 12px; margin: 0 0 12px; }
.template-card .features {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--fg-1);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px 12px;
  margin-bottom: 12px;
}
.template-card .features li {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 6px;
}
.template-card .features li::before {
  content: "›";
  color: var(--brand-blue-bright);
  font-weight: 600;
}
.template-card .specs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.template-card .specs > div {
  background: var(--bg-1);
  border: 1px solid var(--border-1);
  border-radius: var(--r-sm);
  padding: 8px 10px;
}
.template-card .specs .label {
  font-family: var(--font-mono);
  font-size: 9px;
  text-transform: uppercase;
  color: var(--fg-3);
  letter-spacing: 0.1em;
}
.template-card .specs .value {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--fg-0);
  font-weight: 500;
}
.template-card .select-tag {
  padding: 10px 14px;
  border-top: 1px solid var(--border-1);
  background: var(--bg-1);
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--fg-3);
  display: flex;
  align-items: center;
  gap: 6px;
}
.template-card.selected .select-tag {
  color: var(--brand-blue-bright);
  background: rgba(56,189,248,0.08);
}

/* Form fields */
.field { display: flex; flex-direction: column; margin-bottom: 16px; }
.field .help { font-size: 11px; color: var(--fg-3); margin-top: 4px; font-family: var(--font-mono); letter-spacing: 0.02em; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.date-field {
  background: var(--bg-2);
  border: 1px solid var(--border-1);
  border-radius: var(--r-md);
  padding: 8px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.date-field label {
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--fg-3);
}
.date-field input {
  background: transparent;
  border: none;
  color: var(--fg-0);
  font-family: var(--font-mono);
  font-size: 13px;
  padding: 0;
  outline: none;
}
.date-field input:focus { color: var(--brand-blue-bright); }
.textarea {
  background: var(--bg-2);
  border: 1px solid var(--border-1);
  border-radius: var(--r-md);
  padding: 10px 12px;
  font-family: var(--font-sans);
  font-size: 13px;
  color: var(--fg-0);
  width: 100%;
  min-height: 110px;
  resize: vertical;
}
.textarea:focus { outline: none; border-color: var(--brand-blue); box-shadow: 0 0 0 3px rgba(2,132,199,0.18); }

/* Product selector (step 2 add-on) */
.product-selector {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 8px;
  max-height: 320px;
  overflow-y: auto;
  padding: 8px;
  border: 1px solid var(--border-1);
  border-radius: var(--r-md);
  background: var(--bg-2);
}
.product-pick {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid var(--border-1);
  border-radius: var(--r-sm);
  background: var(--bg-1);
  cursor: pointer;
  transition: border-color 0.12s, background 0.12s;
  font-size: 12px;
}
.product-pick:hover { border-color: var(--border-3); }
.product-pick.checked {
  border-color: var(--brand-blue-bright);
  background: rgba(56,189,248,0.06);
}
.product-pick .check {
  width: 16px; height: 16px;
  border: 1px solid var(--border-2);
  border-radius: 3px;
  display: grid; place-items: center;
  background: var(--bg-2);
  color: white;
  flex: none;
}
.product-pick.checked .check {
  background: var(--brand-blue);
  border-color: var(--brand-blue);
}

/* Review */
.review-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.review-card {
  background: var(--bg-2);
  border: 1px solid var(--border-1);
  border-radius: var(--r-md);
  padding: 14px 16px;
}
.review-card .label {
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--fg-3);
  margin-bottom: 6px;
}
.review-card .value {
  font-size: 14px;
  font-weight: 500;
  color: var(--fg-0);
}
.review-card .value.mono {
  font-family: var(--font-mono);
  font-size: 13px;
}

/* Tweaks panel adjustments to match design */
[data-theme="light"] body { background: var(--bg-0); }

/* ============================================================
   Usage Metrics page
   ============================================================ */
.usage-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.pager {
  display: flex;
  gap: 4px;
  align-items: center;
}
.pager .btn {
  min-width: 32px;
  padding: 6px 10px;
}
.usage-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.usage-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-1, rgba(255,255,255,0.02));
  transition: border-color .15s;
}
.usage-card.expanded {
  border-color: var(--brand-blue);
}
.usage-card-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  flex-wrap: wrap;
}
.usage-card-id .usage-card-name {
  font-weight: 600;
  font-size: 14px;
  font-family: var(--font-mono, ui-monospace, monospace);
}
.usage-card-id .usage-card-meta {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}
.usage-card-stats {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.usage-card-detail {
  border-top: 1px solid var(--border);
  padding: 12px 16px 16px;
}
.usage-detail-head {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 12px;
  font-size: 11px;
  letter-spacing: .08em;
  color: var(--muted);
  padding-bottom: 8px;
}
.usage-detail-row {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 12px;
  align-items: center;
}
.usage-detail-products {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

/* ============================================================
   Settings page
   ============================================================ */
.settings-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 16px;
  align-items: start;
}
.settings-nav {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.settings-nav-item {
  text-align: left;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
  cursor: pointer;
  color: inherit;
  transition: border-color .15s, background .15s;
}
.settings-nav-item:hover { border-color: var(--brand-blue-bright); }
.settings-nav-item.active {
  border-color: var(--brand-blue);
  background: rgba(2, 132, 199, 0.08);
}
.settings-nav-title { font-weight: 600; font-size: 14px; }
.settings-nav-meta { font-size: 12px; color: var(--muted); margin-top: 4px; }
.settings-content { min-width: 0; }
.req-item { display: flex; align-items: center; gap: 6px; padding: 4px 0; }
@media (max-width: 900px) {
  .settings-layout { grid-template-columns: 1fr; }
}

.template-grid.single {
  display: flex;
  justify-content: center;
}
.template-grid.single .template-card {
  max-width: 460px;
  width: 100%;
}

.template-card.coming-soon {
  cursor: not-allowed !important;
  pointer-events: auto;
  position: relative;
  overflow: hidden;
}
.template-card.coming-soon > *:not(.coming-soon-badge) {
  opacity: 0.18;
  filter: grayscale(1);
}
.template-card.coming-soon:hover { border-color: var(--border) !important; transform: none !important; }
.template-card.coming-soon .select-tag {
  background: rgba(120,120,120,0.18);
  color: var(--muted);
  border-color: rgba(120,120,120,0.35);
}
.coming-soon-badge {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 5;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0.32em;
  color: #8b1f1f;
  background: none;
  border: none;
  text-shadow: 0 1px 2px rgba(0,0,0,0.6);
  pointer-events: none;
  white-space: nowrap;
}

/* ============================================================
<<<<<<< HEAD
   Auth Pages
   ============================================================ */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 16px;
  background:
    radial-gradient(ellipse 1200px 600px at 50% -200px, rgba(2, 132, 199, 0.12), transparent 60%),
    var(--bg-0);
}

.auth-container {
  width: 100%;
  max-width: 460px;
}

.auth-card {
  background: var(--bg-1);
  border: 1px solid var(--border-1);
  border-radius: 16px;
  padding: 40px 32px;
  box-shadow: var(--shadow-2);
}

.auth-header {
  text-align: center;
  margin-bottom: 32px;
}

.auth-logo {
  display: flex;
  justify-content: center;
  margin-bottom: 16px;
}

.auth-logo img {
  height: 32px;
  width: auto;
}

.auth-title {
  font-size: 24px;
  font-weight: 700;
  color: var(--fg-0);
  margin: 0 0 8px 0;
}

.auth-subtitle {
  font-size: 14px;
  color: var(--fg-2);
  margin: 0;
  line-height: 1.5;
}

.auth-alert {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-radius: var(--r-lg);
  font-size: 13px;
  margin-bottom: 20px;
  line-height: 1.5;
}

.auth-alert-error {
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #FCA5A5;
}

.auth-alert-success {
  background: rgba(34, 197, 94, 0.12);
  border: 1px solid rgba(34, 197, 94, 0.3);
  color: #86EFAC;
}

.auth-alert-warning {
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.3);
  color: #FCD34D;
}

.auth-alert a {
  color: var(--brand-blue-bright);
  text-decoration: underline;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--fg-1);
}

.form-error {
  font-size: 12px;
  color: #FCA5A5;
  margin-top: 4px;
}

.form-hint {
  font-size: 12px;
  color: var(--fg-3);
  margin: 4px 0 0 0;
  line-height: 1.4;
}

.input-with-addon {
  position: relative;
  display: flex;
  align-items: center;
}

.input-with-addon .input {
  flex: 1;
  padding-right: 80px;
}

.input-addon-btn {
  position: absolute;
  right: 8px;
  padding: 6px 12px;
  background: var(--bg-3);
  border: 1px solid var(--border-1);
  border-radius: var(--r-sm);
  font-size: 12px;
  font-weight: 500;
  color: var(--fg-2);
  cursor: pointer;
  transition: all 0.15s;
}

.input-addon-btn:hover {
  background: var(--bg-4);
  color: var(--fg-1);
}

.input-error {
  border-color: rgba(239, 68, 68, 0.5) !important;
  background: rgba(239, 68, 68, 0.08) !important;
}

.input-code {
  text-align: center;
  font-size: 18px;
  letter-spacing: 0.25em;
  font-family: var(--font-mono);
  font-weight: 600;
}

.btn-block {
  width: 100%;
  justify-content: center;
}

.auth-footer {
  text-align: center;
  font-size: 13px;
  color: var(--fg-2);
  margin: 8px 0 0 0;
}

.auth-footer a {
  color: var(--brand-blue-bright);
  font-weight: 600;
  text-decoration: none;
}

.auth-footer a:hover {
  text-decoration: underline;
}

.auth-info-box {
  background: var(--bg-2);
  border: 1px solid var(--border-1);
  border-radius: var(--r-lg);
  padding: 16px;
  margin-bottom: 20px;
}

.auth-info-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--fg-0);
  margin-bottom: 6px;
}

.auth-info-text {
  font-size: 13px;
  color: var(--fg-2);
  line-height: 1.5;
}

.auth-info-timer {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
  font-size: 12px;
  color: var(--fg-3);
}

.auth-actions {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.auth-actions .btn {
  flex: 1;
=======
   Mobile responsive (forward-looking, fluid)
   ============================================================ */

/* Tablet */
@media (max-width: 900px) {
  .main { padding: 0 16px 48px; }
  .header { padding: 12px 16px; gap: 12px; flex-wrap: wrap; }
  .header-nav { margin-left: 0; flex-wrap: wrap; gap: 0; }
  .header-nav a { padding: 6px 10px; font-size: 12px; }
  .header-logo-sep { display: none; }

  .status-banner {
    grid-template-columns: 1fr;
    gap: 12px;
    padding: 12px 16px;
  }
  .status-mid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    border-left: none;
    border-right: none;
    border-top: 1px solid var(--border-1);
    border-bottom: 1px solid var(--border-1);
    padding: 8px 0;
  }
  .status-stat { padding: 6px 12px; }
  .status-stat:nth-child(2) { border-right: none; }
  .status-right { justify-content: flex-start; flex-wrap: wrap; }

  .grid-2 { grid-template-columns: 1fr; }

  .tabs { overflow-x: visible; flex-wrap: wrap; gap: 4px; padding-bottom: 4px; }
  .tab { flex: 1 1 auto; justify-content: center; }

  .page-event.layout-sidebar .main {
    grid-template-columns: 1fr;
  }
  .page-event.layout-sidebar .sidebar {
    border-right: none;
    border-bottom: 1px solid var(--border-1);
    padding-top: 12px;
  }
  .page-event.layout-sidebar .tabs { display: flex; }

  .events-toolbar { gap: 8px; }
  .events-toolbar > * { flex: 1 1 auto; min-width: 0; }
}

/* Phone */
@media (max-width: 600px) {
  :root { font-size: 14px; }
  .main { padding: 0 12px 40px; }
  .header { padding: 10px 12px; gap: 8px; }
  .header-logo-text span { display: none; }
  .header-logo img { height: 24px; }
  .header-nav { width: 100%; overflow-x: auto; flex-wrap: nowrap; -webkit-overflow-scrolling: touch; }
  .header-nav a { white-space: nowrap; }
  .header-spacer { display: none; }
  .header-right { width: 100%; justify-content: space-between; }

  .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .status-mid { grid-template-columns: 1fr 1fr; }

  .panel-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }
  .panel-header-actions { width: 100%; flex-wrap: wrap; }
  .panel-header-actions .btn { flex: 1 1 auto; }

  .btn { padding: 9px 12px; font-size: 13px; min-height: 40px; }
  .btn-sm { min-height: 32px; }

  /* Touch-friendly tap targets */
  .tab { padding: 12px 14px; min-height: 44px; }
  .header-nav a { min-height: 40px; display: inline-flex; align-items: center; }

  .tweaks-panel { width: 100% !important; max-width: 100% !important; right: 0 !important; }

  .modal-backdrop .panel { max-width: 95% !important; }

  .coming-soon-badge { font-size: 16px; letter-spacing: 0.2em; }

  table { font-size: 12px; }
}

/* Assets tab mobile */
@media (max-width: 700px) {
  .upload-zone {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }
  .upload-zone .search { min-width: 0 !important; width: 100%; }

  .asset-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
  }
  .asset-row.head { display: none; }
  .asset-row .name {
    flex: 1 1 100%;
    min-width: 0;
    order: 1;
  }
  .asset-row .name span { white-space: normal; word-break: break-word; }
  .asset-row > :nth-child(3) { order: 2; }
  .asset-row .size { order: 3; }
  .asset-row .when { order: 4; flex: 1 1 100%; }
  .asset-row .actions {
    order: 5;
    width: 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 6px;
    padding-top: 6px;
    border-top: 1px dashed var(--border-1);
    margin-top: 4px;
  }
  .asset-row .actions .btn { flex: 1 1 auto; min-width: 0; }

  .asset-grid {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 8px;
  }
}

/* Tiny phones */
@media (max-width: 380px) {
  .header-logo-text strong { font-size: 12px; }
  .status-mid { grid-template-columns: 1fr; }
}

/* Prevent horizontal scroll & long content overflow */
html, body { overflow-x: hidden; max-width: 100%; }
img, video, canvas, svg { max-width: 100%; height: auto; }
.panel { min-width: 0; }
input, select, textarea { max-width: 100%; }

/* Respect user motion preferences */
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* Spinner animation for loading states */
@keyframes spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}
>>>>>>> 958caa3d670b11bda2c54124a855cbb12467cb45
}
