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

:root {
  /* ── Brand ── */
  --red: #8b1a1a;
  --red-dark: #6f1414;
  --red-deeper: #530f0f;
  --red-subtle: rgba(139, 26, 26, 0.08);

  /* ── Neutrals (standardized on slate scale) ── */
  --gray-950: #0f172a;
  --gray-900: #1e293b;
  --gray-700: #475569;
  --gray-500: #64748b;
  --gray-400: #94a3b8;
  --gray-300: #cbd5e1;
  --gray-200: #e2e8f0;
  --gray-100: #f1f5f9;
  --gray-50: #f8fafc;

  /* ── Semantic colors ── */
  --bg: #f8fafc;
  --card-bg: #ffffff;
  --text: #1e293b;
  --text-muted: #64748b;
  --border: #e2e8f0;

  /* ── Status ── */
  --green: #16a34a;
  --green-bg: #dcfce7;
  --yellow: #f59e0b;
  --yellow-bg: #fef9c3;
  --blue: #2563eb;
  --blue-bg: #dbeafe;
  --error-bg: #fef2f2;

  /* ── Spacing scale ── */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-6: 24px;
  --space-8: 32px;
  --space-12: 48px;

  /* ── Radius scale ── */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-full: 9999px;
  --radius: 16px; /* keep for backward compat */

  /* ── Shadows ── */
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.04), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.06), 0 1px 3px rgba(0,0,0,0.04);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.08), 0 2px 8px rgba(0,0,0,0.04);
  --shadow: 0 1px 3px rgba(0,0,0,0.04), 0 1px 2px rgba(0,0,0,0.06); /* backward compat */

  /* ── Typography ── */
  --font-xs: 12px;
  --font-sm: 13px;
  --font-base: 14px;
  --font-md: 15px;
  --font-lg: 16px;
  --font-xl: 18px;

  /* ── Transitions ── */
  --transition-fast: 150ms ease;
  --transition-med: 250ms ease;
}

/* ── Dark Mode ── */
[data-theme="dark"] {
  --bg: #111827;
  --card-bg: #1e293b;
  --text: #e2e8f0;
  --text-muted: #a7b4c6;
  /* Lightened maroon so brand reads as text/icons on the dark canvas (deep maroon fails contrast) */
  --red: #d36a6a;
  --red-dark: #b94a4a;
  --red-deeper: #9c3a3a;
  --red-subtle: rgba(211, 106, 106, 0.12);
  --border: #334155;
  --gray-50: #1e293b;
  --gray-100: #334155;
  --gray-200: #475569;
  --gray-300: #64748b;
  --gray-400: #94a3b8;
  --gray-500: #cbd5e1;
  --gray-700: #e2e8f0;
  --gray-900: #f1f5f9;
  --gray-950: #f8fafc;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.2), 0 1px 2px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.25), 0 1px 3px rgba(0,0,0,0.2);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.3), 0 2px 8px rgba(0,0,0,0.2);
  --shadow: var(--shadow-sm);
  --green-bg: #064e3b;
  --error-bg: #450a0a;
  --yellow-bg: #451a03;
  --blue-bg: #172554;
  color-scheme: dark;
}

[data-theme="dark"] .navbar {
  background: rgba(17, 24, 39, 0.85);
}

[data-theme="dark"] .search-bar {
  background: var(--card-bg);
  color: var(--text);
  box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}

[data-theme="dark"] .search-bar input[type="text"] {
  color: var(--text);
}

[data-theme="dark"] .term-pill {
  background: var(--card-bg);
  color: var(--text);
  box-shadow: -1px 0 0 0 var(--border);
}

[data-theme="dark"] .term-dropdown {
  background: var(--card-bg);
  box-shadow: 0 8px 30px rgba(0,0,0,0.3), 0 2px 8px rgba(0,0,0,0.2);
}

[data-theme="dark"] .term-dropdown li {
  color: var(--text);
}

[data-theme="dark"] .autocomplete-list {
  background: var(--card-bg);
}

[data-theme="dark"] .modal-content {
  background: var(--card-bg);
}

[data-theme="dark"] .custom-select-toggle {
  background: var(--card-bg);
  color: var(--text);
}

[data-theme="dark"] .custom-select-dropdown {
  background: var(--card-bg);
}

[data-theme="dark"] .search-submit {
  border-radius: 0 14px 14px 0;
}

[data-theme="dark"] kbd {
  background: var(--gray-100);
  border-color: var(--border);
  box-shadow: 0 1px 0 var(--gray-200);
  color: var(--text);
}

/* Dark mode toggle button */
.dark-mode-toggle {
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
  border-radius: var(--radius-sm);
  color: rgba(255,255,255,0.5);
  transition: color var(--transition-fast), background var(--transition-fast);
  display: flex;
  align-items: center;
}
.dark-mode-toggle:hover {
  color: rgba(255,255,255,0.9);
  background: rgba(255,255,255,0.08);
}
/* Light mode: show moon icon (click to go dark) */
[data-theme="light"] .icon-sun,
:root:not([data-theme="dark"]) .icon-sun { display: none; }
[data-theme="light"] .icon-moon,
:root:not([data-theme="dark"]) .icon-moon { display: inline; }
/* Dark mode: show sun icon (click to go light) */
[data-theme="dark"] .icon-sun { display: inline; }
[data-theme="dark"] .icon-moon { display: none; }

/* Smooth scroll for anchor links only */
html { scroll-behavior: smooth; }

body {
  font-family: "DM Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.container { max-width: 960px; margin: 0 auto; padding: 0 24px; width: 100%; }

/* Focus visible styles */
:focus-visible {
  outline: 2px solid var(--red);
  outline-offset: 2px;
}

/* ── Hero ── */
.hero {
  position: relative;
  background: linear-gradient(180deg, #111827 0%, #1a2332 100%);
  color: white;
  padding: 32px 0 24px;
  overflow: visible;
}

.hero-bg {
  display: none;
}

.hero::after {
  content: "";
  position: absolute;
  bottom: -1px;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.06), transparent);
}

.hero-content {
  position: relative;
  z-index: 1;
  text-align: center;
}

.brand {
  font-size: 24px;
  font-weight: 600;
  letter-spacing: -0.5px;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.brand-icon {
  flex-shrink: 0;
  opacity: 0.9;
  width: 24px;
  height: 24px;
}

.tagline {
  font-size: 14px;
  opacity: 0.6;
  font-weight: 400;
  margin-bottom: 24px;
}

.trust-line {
  font-size: 12px;
  opacity: 0.6;
  margin-top: 16px;
  letter-spacing: 0.3px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
}

.trust-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.trust-item svg {
  opacity: 0.85;
}

.trust-sep { opacity: 0.5; }

/* ── Hero Search Bar ── */
.hero-search {
  max-width: 640px;
  margin: 0 auto;
}

.search-bar {
  position: relative;
  display: flex;
  align-items: center;
  background: rgba(255,255,255,0.95);
  border-radius: 12px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.1);
  border: 1px solid rgba(255,255,255,0.2);
  overflow: visible;
  transition: box-shadow var(--transition-med), border-color var(--transition-med);
}

.search-bar:focus-within {
  box-shadow: 0 4px 24px rgba(139, 26, 26, 0.15), 0 0 0 1px rgba(139, 26, 26, 0.2);
}

.search-icon {
  position: absolute;
  left: 16px;
  width: 20px;
  height: 20px;
  color: var(--text-muted);
  pointer-events: none;
  z-index: 2;
}

.search-bar input[type="text"] {
  flex: 1;
  border: none;
  padding: 16px 16px 16px 48px;
  font-size: 16px;
  background: transparent;
  color: var(--text);
  outline: none;
  border-radius: 14px 0 0 14px;
  min-width: 0;
}

.search-bar input[type="text"]::placeholder {
  color: var(--gray-400);
}

.search-bar input[type="text"]:focus {
  outline: none;
  box-shadow: none;
  border: none;
}

.search-bar *:focus {
  outline: none;
}

/* Term picker (custom dropdown) */
.term-picker {
  position: relative;
}

.term-pill {
  border: none;
  background: white;
  box-shadow: -1px 0 0 0 #e0e0e0;
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  border-radius: 0;
  cursor: pointer;
  outline: none;
  display: flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
  transition: background var(--transition-fast);
}

.term-pill:hover {
  background: var(--gray-50);
}

.term-chevron {
  width: 14px;
  height: 14px;
  color: var(--text-muted);
  transition: transform 0.2s;
}

.term-picker.open .term-chevron {
  transform: rotate(180deg);
}

.term-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: white;
  border-radius: 12px;
  box-shadow: 0 8px 30px rgba(0,0,0,0.12), 0 2px 8px rgba(0,0,0,0.06);
  list-style: none;
  padding: 6px;
  margin: 0;
  min-width: max-content;
  z-index: 200;
  animation: dropdown-in 0.15s ease-out;
}

@keyframes dropdown-in {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.term-dropdown li {
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.1s;
}

.term-dropdown li:hover {
  background: var(--gray-50);
}

.term-dropdown li.selected {
  background: var(--red);
  color: white;
}

.term-dropdown li.selected:hover {
  background: var(--red-dark);
}

.search-submit {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  background: var(--red);
  border: none;
  border-radius: 0 14px 14px 0;
  cursor: pointer;
  color: white;
  transition: background 0.2s, transform 0.1s;
  flex-shrink: 0;
}
.search-submit:hover { background: var(--red-dark); }
.search-submit:active { transform: scale(0.95); }
.search-submit svg { width: 20px; height: 20px; }

/* ── Autocomplete ── */
.autocomplete-list {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  max-height: 300px;
  overflow-y: auto;
  z-index: 50;
  list-style: none;
  box-shadow: var(--shadow-lg);
  animation: slideDown 0.15s ease-out;
  overscroll-behavior: contain;
}
.autocomplete-list li {
  padding: 12px 16px;
  cursor: pointer;
  font-size: 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--gray-100);
  transition: background 0.1s;
}
.autocomplete-list li:last-child { border-bottom: none; }
.autocomplete-list li:hover,
.autocomplete-list li.active { background: var(--gray-50); }
.autocomplete-list .ac-code { font-weight: 600; margin-right: 12px; color: var(--text); }
.autocomplete-list .ac-title {
  color: var(--text-muted);
  font-size: 13px;
  text-align: right;
  flex-shrink: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Navbar ── */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(17, 24, 39, 0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(255,255,255,0.08);
  height: 52px;
  color: white;
}

.navbar-inner {
  display: flex;
  align-items: center;
  height: 100%;
  gap: 8px;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
}

.navbar-brand {
  display: flex;
  align-items: center;
  /* Navbar is always dark, so the logo uses the lightened maroon to stay legible */
  color: #e0696a;
  text-decoration: none;
  margin-right: 16px;
  flex-shrink: 0;
}

.navbar-logo { display: block; }

.navbar-links {
  display: flex;
  gap: 4px;
  flex: 1;
}

.navbar-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 18px;
  font-size: 14px;
  font-weight: 500;
  color: rgba(255,255,255,0.6);
  text-decoration: none;
  border-radius: 8px;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.navbar-link:hover {
  color: rgba(255,255,255,0.9);
  background: rgba(255,255,255,0.06);
}

.navbar-link.active {
  color: white;
  background: rgba(139, 26, 26, 0.2);
  font-weight: 600;
}

.navbar-link svg {
  flex-shrink: 0;
  opacity: 0.7;
}

.navbar-link.active svg {
  opacity: 1;
}

.navbar-badge-wrap {
  position: relative;
  flex-shrink: 0;
}

.navbar-alert-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  font-size: 11px;
  font-weight: 700;
  background: var(--red);
  color: white;
}

/* ── Page routing ── */
.page {
  display: none;
}
.page.active {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  animation: pageFadeIn 250ms ease-out;
}
.page.active > main {
  flex: 1;
}

@keyframes pageFadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ── Alerts section spacing ── */
.alerts-section {
  margin-top: 32px;
  padding-top: 32px;
  border-top: 1px solid var(--border);
}

/* ── ScheduleSniper hero variant ── */
.hero-schedule {
  background: linear-gradient(180deg, #111827 0%, #1a2332 100%);
}

/* ── Cards ── */
.card {
  background: var(--card-bg);
  border-radius: var(--radius-md);
  padding: 24px 32px;
  margin-bottom: 16px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  transition: all 0.2s ease;
}
.card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.card h2 { font-size: 20px; font-weight: 700; margin-bottom: 16px; }

/* Results card specifics */
#results .summary-badge { margin-bottom: 16px; }

/* ── Empty States ── */
.empty-state-card {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
  animation: fadeIn 0.4s ease-out;
}

.hidden-for-new-users {
  display: none !important;
}

.empty-state-compact {
  text-align: center;
  padding: 32px 20px;
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1.7;
  opacity: 0.7;
  animation: fadeIn 0.4s ease-out;
}

.empty-state-icon {
  margin-bottom: 16px;
  opacity: 0.3;
}

.empty-state-card h3 {
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 8px;
}

.empty-state-card p {
  font-size: 14px;
  max-width: 360px;
  margin: 0 auto;
  line-height: 1.6;
}

/* ── Animations ── */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes slideUp {
  from { opacity: 0; transform: translateY(40px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes slideDown {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}
@keyframes spin { to { transform: rotate(360deg); } }

.animate-in { animation: fadeInUp 0.35s ease-out both; }

/* ── Forms ── */
.form-row { display: flex; gap: 16px; margin-bottom: 16px; }
.form-group { display: flex; flex-direction: column; gap: 8px; }
.form-group label { font-size: 13px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; }

.form-hint {
  font-size: 14px;
  color: var(--text-muted);
  margin: -8px 0 16px;
}

.form-help {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: -2px;
}

.label-optional {
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  color: var(--text-muted);
  opacity: 0.7;
}

input, select, textarea {
  padding: 12px 14px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-size: 15px;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
::placeholder {
  color: var(--gray-400);
  opacity: 0.7;
}
input:focus, select:focus {
  border-color: var(--red);
  box-shadow: 0 0 0 3px var(--red-subtle);
}

/* ── Custom Select Dropdown ── */
.custom-select {
  position: relative;
}

.custom-select-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  padding: 10px 14px;
  border: 2px solid var(--border);
  border-radius: 8px;
  background: white;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--gray-900);
  cursor: pointer;
  transition: border-color 0.2s;
}

.custom-select-toggle:hover {
  border-color: var(--gray-300);
}

.custom-select-toggle:focus {
  outline: none;
  border-color: var(--red);
  box-shadow: 0 0 0 3px var(--red-subtle);
}

.custom-select-toggle svg {
  color: var(--gray-400);
  flex-shrink: 0;
  transition: transform 0.2s;
}

.custom-select.open .custom-select-toggle svg {
  transform: rotate(180deg);
}

.custom-select-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: white;
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.1);
  list-style: none;
  padding: 4px;
  z-index: 50;
  max-height: 240px;
  overflow-y: auto;
}

.custom-select-dropdown li {
  padding: 10px 14px;
  font-size: 0.9rem;
  color: var(--gray-700);
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.1s;
}

.custom-select-dropdown li:hover {
  background: var(--gray-100);
}

.custom-select-dropdown li.selected {
  font-weight: 600;
  color: var(--gray-900);
  background: var(--gray-50);
}

.btn {
  padding: 12px 24px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  background: var(--card-bg);
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.btn:hover { background: var(--bg); }
.btn:active { transform: scale(0.98); }
.btn-primary {
  background: var(--red);
  color: white;
  border-color: var(--red);
}
.btn-primary:hover { background: var(--red-dark); border-color: var(--red-dark); transform: translateY(-1px); }
.btn-primary:active { transform: translateY(0) scale(0.98); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.btn-watching { background: var(--green) !important; border-color: var(--green) !important; color: white !important; cursor: default; opacity: 0.9; }
.btn-watching:hover { background: var(--green) !important; transform: none; }
.btn-lg { padding: 14px 32px; font-size: 16px; }
.btn-ghost { background: transparent; border-color: var(--border); }
.btn-ghost:hover { background: var(--bg); }

.btn-sm { padding: 8px 16px; font-size: 13px; border-radius: 8px; }
.btn-danger { color: var(--red); border-color: var(--red); }
.btn-danger:hover { background: var(--error-bg); }

/* ── Results Table ── */
.section-table { width: 100%; border-collapse: collapse; margin-top: 12px; }
.section-table th, .section-table td {
  text-align: left;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}
.section-table th {
  font-weight: 700;
  font-size: 11px;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.5px;
  padding-bottom: 12px;
}
.section-table tr {
  transition: background var(--transition-fast);
}
.section-table tbody tr:hover { background: var(--gray-50); }
.section-table tbody tr {
  animation: fadeIn 0.3s ease-out both;
}
.section-table tbody tr:nth-child(1) { animation-delay: 0s; }
.section-table tbody tr:nth-child(2) { animation-delay: 0.03s; }
.section-table tbody tr:nth-child(3) { animation-delay: 0.06s; }
.section-table tbody tr:nth-child(4) { animation-delay: 0.09s; }
.section-table tbody tr:nth-child(5) { animation-delay: 0.12s; }
.section-table tbody tr:nth-child(6) { animation-delay: 0.15s; }
.section-table tbody tr:nth-child(7) { animation-delay: 0.18s; }
.section-table tbody tr:nth-child(8) { animation-delay: 0.21s; }

.seat-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 100px;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}
.seat-badge::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.seat-open { background: var(--green-bg); color: var(--green); }
.seat-open::before { background: var(--green); }
.seat-full { background: var(--error-bg); color: var(--red); }
.seat-full::before { background: var(--red); }

.seat-badge-sm {
  font-size: 11px;
  padding: 2px 8px;
}
.seat-badge-summary {
  font-size: 12px;
}
.text-muted-inline {
  color: var(--text-muted);
}
.text-no-times {
  color: var(--gray-400);
  font-style: italic;
}
.sub-card-skeleton {
  border-left-color: var(--border) !important;
}
.mb-2 { margin-bottom: 8px; }
.mt-3 { margin-top: 12px; }

.activity-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 100px;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}
.activity-active { background: var(--blue-bg); color: var(--blue); animation: pulse 2s ease-in-out infinite; }
.activity-none { background: var(--gray-100); color: var(--gray-400); }

.alert-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

/* ── Subscriptions List ── */
.sub-card {
  background: var(--card-bg);
  border-radius: var(--radius-md);
  padding: 18px 24px;
  margin-bottom: 12px;
  box-shadow: var(--shadow);
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-left: 4px solid var(--green);
  transition: box-shadow 0.2s, transform 0.2s;
  animation: fadeInUp 0.3s ease-out both;
}
.sub-card:nth-child(1) { animation-delay: 0s; }
.sub-card:nth-child(2) { animation-delay: 0.05s; }
.sub-card:nth-child(3) { animation-delay: 0.1s; }
.sub-card:nth-child(4) { animation-delay: 0.15s; }
.sub-card:nth-child(5) { animation-delay: 0.2s; }
.sub-card:hover { box-shadow: var(--shadow-lg); transform: translateY(-1px); }
.sub-card.unverified { border-left-color: var(--yellow); }
.sub-info { font-size: 14px; }
.sub-info strong { font-size: 16px; }
.sub-meta { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

/* ── Modal ── */
.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
}
.modal.hidden { display: none; }
.modal:not(.hidden) .modal-backdrop { animation: fadeIn 0.2s ease-out both; }
.modal:not(.hidden) .modal-content { animation: slideUp 0.3s ease-out both; }
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.modal-content {
  position: relative;
  width: 440px;
  max-width: 90vw;
  padding: 32px;
}
.modal-content h2 { font-size: 22px; }
.modal-subtitle { color: var(--text-muted); font-size: 15px; margin: -8px 0 20px; }
.modal-content .form-group { margin-bottom: 16px; }
.modal-actions { display: flex; gap: 12px; justify-content: flex-end; margin-top: 24px; }

.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  padding: 4px;
  border-radius: 8px;
  transition: all var(--transition-fast);
  display: flex;
  align-items: center;
  justify-content: center;
}
.modal-close:hover {
  background: var(--bg);
  color: var(--text);
}

/* ── Toast Notifications ── */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
  max-width: 400px;
}

.toast {
  pointer-events: auto;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 16px;
  border-radius: 12px;
  background: var(--card-bg);
  box-shadow: 0 8px 30px rgba(0,0,0,0.15), 0 2px 8px rgba(0,0,0,0.06);
  font-size: 14px;
  font-weight: 500;
  animation: toastIn 0.35s ease-out;
  transition: all 0.3s ease;
  border-left: 4px solid var(--text-muted);
  max-width: 100%;
}

.toast.toast-removing {
  animation: toastOut 0.3s ease-in forwards;
}

.toast-success { border-left-color: var(--green); }
.toast-error { border-left-color: var(--red); }
.toast-info { border-left-color: var(--yellow); }

.toast-icon {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  margin-top: 1px;
}

.toast-success .toast-icon { color: var(--green); }
.toast-error .toast-icon { color: var(--red); }
.toast-info .toast-icon { color: var(--yellow); }

.toast-body {
  flex: 1;
  min-width: 0;
}

.toast-title {
  font-weight: 600;
  margin-bottom: 2px;
}

.toast-message {
  font-weight: 400;
  color: var(--text-muted);
  font-size: 13px;
}

.toast-close {
  flex-shrink: 0;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  padding: 2px;
  border-radius: 4px;
  transition: color var(--transition-fast);
}
.toast-close:hover { color: var(--text); }

@keyframes toastIn {
  from { opacity: 0; transform: translateX(40px) scale(0.95); }
  to { opacity: 1; transform: translateX(0) scale(1); }
}
@keyframes toastOut {
  from { opacity: 1; transform: translateX(0) scale(1); max-height: 100px; margin-bottom: 0; }
  to { opacity: 0; transform: translateX(40px) scale(0.95); max-height: 0; margin-bottom: -8px; padding: 0 16px; }
}

/* ── Status Messages ── */
.status {
  padding: 14px 20px;
  border-radius: 12px;
  margin-bottom: 16px;
  font-size: 14px;
  font-weight: 500;
  animation: fadeInUp 0.3s ease-out both;
}
.status-success { background: var(--green-bg); color: var(--green); }
.status-error { background: var(--error-bg); color: var(--red); }
.status-info { background: var(--yellow-bg); color: #92400e; }

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

.empty-icon {
  font-size: 48px;
  margin-bottom: 12px;
}

.hidden { display: none !important; }

/* ── Loading Skeleton ── */
.skeleton {
  background: linear-gradient(90deg, var(--gray-100) 25%, var(--gray-200) 50%, var(--gray-100) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s ease-in-out infinite;
  border-radius: 8px;
}

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

.skeleton-row {
  display: flex;
  gap: 16px;
  padding: 14px 0;
  border-bottom: 1px solid var(--gray-100);
}

.skeleton-cell {
  height: 16px;
}

.skeleton-cell-sm { width: 60px; }
.skeleton-cell-md { width: 120px; }
.skeleton-cell-lg { flex: 1; }

/* ── Spinner ── */
.spinner {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2.5px solid rgba(255,255,255,0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  margin-right: 8px;
  vertical-align: middle;
}

/* ── Footer ── */
footer {
  margin-top: 48px;
  padding: 32px 24px;
  text-align: center;
  border-top: 1px solid var(--border);
}
.footer-content p {
  font-size: 13px;
  color: var(--text-muted);
}
.footer-note {
  font-size: 12px;
  margin-top: 4px;
}
.footer-note a {
  color: var(--red);
  text-decoration: none;
  font-weight: 500;
}
.footer-note a:hover { text-decoration: underline; }

.footer-kbd {
  margin-top: 12px;
  font-size: 12px;
  opacity: 0.5;
}

kbd {
  display: inline-block;
  padding: 2px 6px;
  font-size: 11px;
  font-family: inherit;
  background: var(--gray-100);
  border: 1px solid #ddd;
  border-radius: 4px;
  box-shadow: 0 1px 0 #ccc;
}

/* ── Responsive ── */
@media (max-width: 640px) {
  .hero { padding: 40px 0 36px; }
  .brand { font-size: 32px; }
  .brand-icon { width: 28px; height: 28px; }
  .tagline { font-size: 16px; margin-bottom: 24px; }

  .search-bar { flex-wrap: wrap; border-radius: 14px; }
  .search-bar input[type="text"] {
    width: 100%;
    border-radius: 14px 14px 0 0;
    padding: 14px 14px 14px 44px;
  }
  .term-picker {
    flex: 1;
    margin-right: 0;
  }
  .term-pill {
    width: 100%;
    border-radius: 0 0 0 14px;
    padding: 12px;
    justify-content: center;
  }
  .search-submit {
    border-radius: 0 0 14px 0;
    height: 46px;
  }

  .trust-line { flex-direction: column; gap: 4px; }
  .trust-sep { display: none; }

  .form-row { flex-direction: column; }
  .navbar-inner { padding: 0 12px; }
  .navbar-link { padding: 5px 8px; font-size: 12px; gap: 0; }
  .navbar-link svg { display: none; }
  .navbar-brand { margin-right: 4px; }
  .dark-mode-toggle { padding: 4px; }
  .card { padding: 20px 16px; }

  .section-table th, .section-table td { padding: 10px 8px; font-size: 13px; }
  /* Hide less important columns on mobile */
  .section-table .col-type,
  .section-table .col-activity { display: none; }

  .modal-content { padding: 24px; }

  .toast-container {
    top: auto;
    bottom: 20px;
    right: 12px;
    left: 12px;
    max-width: none;
  }

  .empty-state-card { padding: 40px 16px; }
}

/* Scrollbar styling for autocomplete */
.autocomplete-list::-webkit-scrollbar { width: 6px; }
.autocomplete-list::-webkit-scrollbar-track { background: transparent; }
.autocomplete-list::-webkit-scrollbar-thumb { background: #ddd; border-radius: 3px; }
.autocomplete-list::-webkit-scrollbar-thumb:hover { background: #ccc; }

/* ── Page Scrollbar ── */
::-webkit-scrollbar {
  width: 8px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--gray-300);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--gray-400);
}
[data-theme="dark"] ::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.15);
}
[data-theme="dark"] ::-webkit-scrollbar-thumb:hover {
  background: rgba(255,255,255,0.25);
}

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

/* Auto dark mode: follow system preference unless user explicitly chose light */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #111827;
    --card-bg: #1e293b;
    --text: #e2e8f0;
    --text-muted: #94a3b8;
    --border: #334155;
    --gray-50: #1e293b;
    --gray-100: #334155;
    --gray-200: #475569;
    --gray-300: #64748b;
    --gray-400: #94a3b8;
    --gray-500: #cbd5e1;
    --gray-700: #e2e8f0;
    --gray-900: #f1f5f9;
    --gray-950: #f8fafc;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.2), 0 1px 2px rgba(0,0,0,0.3);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.25), 0 1px 3px rgba(0,0,0,0.2);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.3), 0 2px 8px rgba(0,0,0,0.2);
    --shadow: var(--shadow-sm);
    --green-bg: #064e3b;
    --error-bg: #450a0a;
    --yellow-bg: #451a03;
    --blue-bg: #172554;
    color-scheme: dark;
  }
  :root:not([data-theme="light"]) .navbar {
    background: rgba(17, 24, 39, 0.85);
  }
  :root:not([data-theme="light"]) .search-bar {
    background: var(--card-bg);
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
  }
  :root:not([data-theme="light"]) .search-bar input[type="text"] {
    color: var(--text);
  }
  :root:not([data-theme="light"]) .term-pill {
    background: var(--card-bg);
    color: var(--text);
    box-shadow: -1px 0 0 0 var(--border);
  }
  :root:not([data-theme="light"]) .term-dropdown {
    background: var(--card-bg);
    box-shadow: 0 8px 30px rgba(0,0,0,0.3), 0 2px 8px rgba(0,0,0,0.2);
  }
  :root:not([data-theme="light"]) .term-dropdown li {
    color: var(--text);
  }
  :root:not([data-theme="light"]) .autocomplete-list {
    background: var(--card-bg);
  }
  :root:not([data-theme="light"]) .modal-content {
    background: var(--card-bg);
  }
  :root:not([data-theme="light"]) .custom-select-toggle {
    background: var(--card-bg);
    color: var(--text);
  }
  :root:not([data-theme="light"]) .custom-select-dropdown {
    background: var(--card-bg);
  }
  :root:not([data-theme="light"]) kbd {
    background: var(--gray-100);
    border-color: var(--border);
    box-shadow: 0 1px 0 var(--gray-200);
    color: var(--text);
  }
  :root:not([data-theme="light"]) .icon-sun { display: inline; }
  :root:not([data-theme="light"]) .icon-moon { display: none; }
}

/* ── Watcher Badge ── */
.watcher-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 500;
  background: var(--yellow-bg);
  color: #92400e;
  white-space: nowrap;
  margin-right: 6px;
}
[data-theme="dark"] .watcher-badge {
  background: var(--yellow-bg);
  color: #fbbf24;
}

/* ── Compact Hero (return users) ── */
.hero.hero-compact {
  padding: 16px 0 20px;
}
.hero.hero-compact {
  padding: 20px 0;
}
.hero.hero-compact .brand-icon,
.hero.hero-compact .brand,
.hero.hero-compact .tagline,
.hero.hero-compact .trust-line {
  display: none;
}

/* ── ntfy notification-setup modal ─────────────────────────────────── */
.ntfy-modal { max-width: 460px; }
.modal-actions-center { justify-content: center; }

.ntfy-steps {
  list-style: none;
  margin: 4px 0 8px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.ntfy-steps > li { margin: 0; }

.ntfy-step-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 15px;
  margin-bottom: 10px;
}
.ntfy-step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: var(--radius-full);
  background: var(--red);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  flex: none;
}

.store-badges { display: flex; gap: 10px; flex-wrap: wrap; }
.store-badges a {
  flex: 1 1 0;
  min-width: 130px;
  text-align: center;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
  transition: border-color .15s, background .15s;
}
.store-badges a:hover { border-color: var(--red); background: var(--red-subtle); }

.ntfy-open-btn { width: 100%; justify-content: center; }
.ntfy-or {
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
  margin: 12px 0 8px;
}
.ntfy-topic-row {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 8px 8px 8px 12px;
}
.ntfy-topic-row code {
  flex: 1;
  font-size: 13px;
  overflow-wrap: anywhere;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

.ntfy-qr-wrap {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 14px;
}
.ntfy-qr {
  flex: none;
  width: 104px;
  height: 104px;
  padding: 8px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}
.ntfy-qr svg { width: 100%; height: 100%; display: block; }
.ntfy-qr.hidden { display: none; }
.ntfy-qr-hint { font-size: 12.5px; color: var(--text-muted); margin: 0; }

.ntfy-email-backup {
  margin-top: 18px;
  border-top: 1px solid var(--border);
  padding-top: 14px;
}
.ntfy-email-backup summary {
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-muted);
  list-style: revert;
}
.ntfy-email-backup summary:hover { color: var(--text); }
.ntfy-email-backup input[type="email"] {
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--card-bg);
  color: var(--text);
  font-size: 14px;
}

@media (max-width: 520px) {
  .ntfy-qr-wrap { flex-direction: column; align-items: flex-start; }
  .store-badges a { min-width: 0; }
}

/* ════════════════════════════════════════════════════════════════════
   2026 polish layer — motion tokens, premium subscribe modal, atmosphere
   Calm/functional motion (feedback, not theatrics); GPU-friendly transforms.
   ════════════════════════════════════════════════════════════════════ */
:root {
  --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-spring:   cubic-bezier(0.34, 1.4, 0.5, 1);
  --dur-fast: 140ms;
  --dur:      240ms;
  --dur-slow: 440ms;
}

/* — Hero atmosphere: a slow, faint glow behind the wordmark (subtle, not loud) — */
.hero::before {
  content: "";
  position: absolute;
  inset: -20% -10% auto -10%;
  height: 130%;
  background:
    radial-gradient(60% 70% at 50% 0%, rgba(139, 26, 26,0.10), transparent 70%),
    radial-gradient(40% 50% at 85% 10%, rgba(139, 26, 26,0.06), transparent 70%);
  pointer-events: none;
  z-index: 0;
  animation: heroDrift 18s var(--ease-out-expo) infinite alternate;
}
@keyframes heroDrift {
  from { transform: translate3d(-1.5%, 0, 0) scale(1); opacity: 0.9; }
  to   { transform: translate3d(1.5%, 1%, 0) scale(1.06); opacity: 1; }
}

/* — Button micro-interactions: spring press + arrow nudge — */
.btn { transition: transform var(--dur-fast) var(--ease-spring), box-shadow var(--dur) var(--ease-out-expo), background var(--dur), border-color var(--dur); }
.btn:active { transform: translateY(1px) scale(0.985); }
.btn-block { width: 100%; justify-content: center; }
.btn-arrow { transition: transform var(--dur) var(--ease-out-expo); }
.btn:hover .btn-arrow { transform: translateX(4px); }

/* — Button loading state (centered spinner, label hidden) — */
.btn.is-loading { color: transparent !important; pointer-events: none; position: relative; }
.btn.is-loading > * { opacity: 0; }
.btn.is-loading::after {
  content: ""; position: absolute; inset: 0; margin: auto;
  width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.45); border-top-color: #fff;
  animation: spin 0.6s linear infinite;
}

/* — Modal: progress stepper — */
.modal-steps { display: flex; gap: 7px; margin: 2px 0 20px; }
.modal-step {
  height: 4px; flex: 1; border-radius: 99px; background: var(--border);
  transition: background var(--dur) var(--ease-out-expo);
}
.modal-step.is-active { background: linear-gradient(90deg, var(--red), var(--red-dark)); }

/* — Modal: step panels morph in — */
.step-panel { animation: stepIn var(--dur-slow) var(--ease-out-expo) both; }
.step-panel[hidden] { display: none; }
@keyframes stepIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: none; }
}

/* — Modal title reticle (sniper scope mark) — */
.scope-mark {
  display: inline-block; width: 18px; height: 18px; margin-right: 7px;
  vertical-align: -3px; border-radius: 50%;
  border: 2px solid var(--red); position: relative;
}
.scope-mark::before, .scope-mark::after {
  content: ""; position: absolute; background: var(--red);
}
.scope-mark::before { inset: 50% 2px auto 2px; height: 2px; transform: translateY(-50%); }
.scope-mark::after  { inset: 2px 50% 2px auto; width: 2px; transform: translateX(50%); }

/* — Floating-label field — */
.field { position: relative; margin: 4px 0 8px; }
.field-input {
  width: 100%; padding: 20px 14px 8px; font-size: 16px; font-family: inherit;
  color: var(--text); background: var(--bg);
  border: 1px solid var(--border); border-radius: var(--radius-md);
  transition: border-color var(--dur), box-shadow var(--dur), background var(--dur);
}
.field-input:focus { outline: none; border-color: var(--red); box-shadow: 0 0 0 4px var(--red-subtle); }
.field-label {
  position: absolute; left: 15px; top: 16px; font-size: 16px; color: var(--text-muted);
  pointer-events: none; transition: all var(--dur) var(--ease-out-expo);
}
.field-input:focus + .field-label,
.field-input:not(:placeholder-shown) + .field-label {
  top: 7px; font-size: 11px; font-weight: 700; letter-spacing: 0.03em;
  text-transform: uppercase; color: var(--red);
}
.field-line {
  position: absolute; left: 0; right: 0; bottom: 0; height: 2px; border-radius: 2px;
  background: linear-gradient(90deg, var(--red), var(--red-dark));
  transform: scaleX(0); transform-origin: left; opacity: 0;
  transition: transform var(--dur) var(--ease-out-expo), opacity var(--dur);
}
.field-input:focus ~ .field-line { transform: scaleX(1); opacity: 1; }
.field.has-error .field-input { border-color: #e0152b; box-shadow: 0 0 0 4px rgba(224,21,43,0.12); }
.field-help { display: block; font-size: 12.5px; color: var(--text-muted); margin: 0 2px 16px; line-height: 1.45; }
.field-help.is-error { color: #e0152b; }

/* — "Check your inbox" banner — */
.verify-banner {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 13px 15px; margin-bottom: 18px; border-radius: var(--radius-md);
  background: var(--red-subtle); border: 1px solid rgba(139, 26, 26,0.22);
}
.verify-banner strong { display: block; font-size: 14.5px; }
.verify-banner span { font-size: 13px; color: var(--text-muted); }
.verify-banner em { color: var(--text); font-style: normal; font-weight: 600; }
.verify-pulse {
  flex: none; width: 10px; height: 10px; margin-top: 5px; border-radius: 50%;
  background: var(--red); position: relative;
}
.verify-pulse::after {
  content: ""; position: absolute; inset: 0; border-radius: 50%;
  background: var(--red); animation: pulseRing 1.8s var(--ease-out-expo) infinite;
}
@keyframes pulseRing {
  0%   { transform: scale(1); opacity: 0.6; }
  100% { transform: scale(3); opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .hero::before, .verify-pulse::after, .step-panel { animation: none; }
  .btn, .btn-arrow, .field-input, .field-label, .field-line { transition: none; }
}

/* — Auto-welcome note (in the push-setup step) — */
.auto-test-note {
  margin: 16px 0 4px;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  background: var(--red-subtle);
  border: 1px solid rgba(139, 26, 26,0.18);
  font-size: 13px;
  line-height: 1.5;
  color: var(--text);
}
