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

:root {
  --bg: #0a0a0b;
  --surface: #111113;
  --surface-2: #18181c;
  --surface-3: #1e1e24;
  --border: #27272f;
  --border-2: #34343e;
  --text: #f0f0f2;
  --text-muted: #8b8b99;
  --text-dim: #555562;
  --primary: #6d7cff;
  --primary-hover: #7f8dff;
  --primary-dim: rgba(109, 124, 255, 0.12);
  --success: #22c55e;
  --success-dim: rgba(34, 197, 94, 0.1);
  --warning: #f59e0b;
  --warning-dim: rgba(245, 158, 11, 0.1);
  --danger: #ef4444;
  --danger-dim: rgba(239, 68, 68, 0.1);
  --radius: 8px;
  --radius-lg: 12px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --font-mono: "SF Mono", "Fira Code", "Cascadia Code", Menlo, monospace;
  --transition: 150ms ease;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  /* Firefox scrollbar */
  scrollbar-width: thin;
  scrollbar-color: var(--border-2) transparent;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* Anchor targets clear the sticky nav (56px) */
[id] { scroll-margin-top: 76px; }

/* Text selection */
::selection {
  background: rgba(109, 124, 255, 0.32);
  color: var(--text);
}

/* Custom scrollbar (WebKit) */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--border-2);
  border: 2px solid var(--bg);
  border-radius: 999px;
}
::-webkit-scrollbar-thumb:hover { background: var(--text-dim); }

/* Global keyboard focus ring fallback for links/buttons that lack a custom one */
a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  border-radius: var(--radius-sm, 6px);
}

/* Subtle content entrance */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

main { animation: fadeUp 0.18s ease both; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  main { animation: none; }
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
}

/* ─── Layout ─── */
.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ─── Navigation ─── */
nav {
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(10, 10, 11, 0.85);
  backdrop-filter: blur(12px);
}

.nav-inner {
  display: flex;
  align-items: center;
  gap: 32px;
  height: 56px;
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 15px;
  color: var(--text);
  text-decoration: none;
  letter-spacing: -0.02em;
  flex-shrink: 0;
}

.nav-logo-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--primary);
  flex-shrink: 0;
}

.nav-links {
  display: flex;
  gap: 4px;
  list-style: none;
  flex: 1;
}

.nav-links a {
  font-size: 14px;
  color: var(--text-muted);
  text-decoration: none;
  padding: 6px 10px;
  border-radius: var(--radius);
  transition: color var(--transition), background var(--transition);
}

.nav-links a:hover {
  color: var(--text);
  background: var(--surface-2);
}

.nav-links a.active {
  color: var(--text);
  background: var(--surface-3);
}

.nav-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--primary-dim);
  color: var(--primary);
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

/* ─── Page header ─── */
.page-header {
  padding: 48px 0 32px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 40px;
}

.page-header .eyebrow {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--primary);
  margin-bottom: 12px;
}

.page-header h1 {
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.2;
  margin-bottom: 12px;
  max-width: 640px;
}

.page-header p {
  font-size: 15px;
  color: var(--text-muted);
  max-width: 560px;
  line-height: 1.7;
}

/* ─── Hero (index) ─── */
.hero {
  padding: 80px 0 64px;
  text-align: center;
}

.hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--primary);
  background: var(--primary-dim);
  border: 1px solid rgba(109, 124, 255, 0.2);
  border-radius: 999px;
  padding: 4px 12px;
  margin-bottom: 24px;
}

.hero h1 {
  font-size: clamp(28px, 5vw, 52px);
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1.1;
  margin-bottom: 20px;
  max-width: 700px;
  margin-left: auto;
  margin-right: auto;
}

.hero h1 .accent {
  background: linear-gradient(135deg, #6d7cff 0%, #a78bfa 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero p {
  font-size: 17px;
  color: var(--text-muted);
  max-width: 520px;
  margin: 0 auto 36px;
  line-height: 1.7;
}

.hero-actions {
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}

/* ─── Buttons ─── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  border: none;
  transition: background var(--transition), color var(--transition), box-shadow var(--transition), transform var(--transition);
  white-space: nowrap;
  outline: none;
}

.btn:focus-visible {
  box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--primary);
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}

.btn-primary:hover {
  background: var(--primary-hover);
  box-shadow: 0 4px 16px rgba(109, 124, 255, 0.35);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--surface-3);
  color: var(--text);
  border: 1px solid var(--border-2);
}

.btn-secondary:hover {
  background: var(--surface-2);
  border-color: var(--text-dim);
}

/* ─── Stats row ─── */
.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 16px;
  margin-bottom: 48px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  transition: border-color var(--transition);
}

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

.stat-value {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.04em;
  color: var(--text);
  line-height: 1;
  margin-bottom: 4px;
}

.stat-label {
  font-size: 13px;
  color: var(--text-muted);
}

/* ─── Home: covered-markets header ─── */
.home-markets-header {
  padding-top: 0;
  margin-bottom: 24px;
}

.section-title--sm {
  font-size: 22px;
  margin-bottom: 8px;
}

.page-header .section-intro-text {
  font-size: 14px;
}

/* ─── "How it works" steps ─── */
.home-how {
  padding: 64px 0;
}

.section-intro {
  max-width: 600px;
}

.section-eyebrow {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--primary);
  margin-bottom: 16px;
}

.section-title {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.2;
  margin-bottom: 32px;
}

.steps {
  display: grid;
  gap: 24px;
}

.step {
  display: grid;
  grid-template-columns: 32px 1fr;
  gap: 16px;
  align-items: start;
}

.step-num {
  width: 32px;
  height: 32px;
  border-radius: var(--radius);
  background: var(--primary-dim);
  border: 1px solid rgba(109, 124, 255, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  color: var(--primary);
}

.step-title {
  font-weight: 600;
  margin-bottom: 4px;
}

.step-desc {
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.6;
}

/* ─── Market cards grid ─── */
.markets-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
  margin-bottom: 48px;
}

.market-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  text-decoration: none;
  color: inherit;
  display: block;
  transition: border-color var(--transition), background var(--transition), transform var(--transition), box-shadow var(--transition);
  position: relative;
  overflow: hidden;
}

.market-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--primary) 0%, transparent 100%);
  opacity: 0;
  transition: opacity var(--transition);
}

.market-card:hover {
  border-color: var(--border-2);
  background: var(--surface-2);
  transform: translateY(-2px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.market-card:hover::before { opacity: 1; }
.market-card:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.market-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.market-card-title {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
}

.state-badge {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  padding: 3px 8px;
  border-radius: var(--radius);
  background: var(--surface-3);
  color: var(--text-muted);
  border: 1px solid var(--border);
  flex-shrink: 0;
  font-family: var(--font-mono);
}

.market-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 16px;
}

.market-stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.market-stat-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.market-stat-value {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.market-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.verified-badge {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: var(--success);
}

.verified-badge::before {
  content: "✓";
  font-weight: 700;
}

.card-arrow {
  color: var(--text-dim);
  font-size: 16px;
  transition: transform var(--transition), color var(--transition);
}

.market-card:hover .card-arrow {
  transform: translateX(4px);
  color: var(--primary);
}

/* ─── Market detail page ─── */
.detail-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 24px;
  align-items: start;
}

@media (max-width: 768px) {
  .detail-grid { grid-template-columns: 1fr; }
}

.detail-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 24px;
}

.detail-card-header {
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
}

.detail-card-title {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.detail-card-body {
  padding: 24px;
}

.rule-text {
  font-size: 15px;
  color: var(--text-muted);
  line-height: 1.75;
}

.rule-text strong { color: var(--text); }

/* ─── Rule fields table ─── */
.rule-table {
  width: 100%;
  border-collapse: collapse;
}

.rule-table tr {
  border-bottom: 1px solid var(--border);
}

.rule-table tr:last-child { border-bottom: none; }

.rule-table td {
  padding: 14px 0;
  font-size: 14px;
  vertical-align: top;
}

.rule-table td:first-child {
  color: var(--text-dim);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  width: 40%;
  padding-right: 16px;
  padding-top: 16px;
}

.rule-table td:last-child {
  color: var(--text);
  font-weight: 500;
}

.field-note {
  display: block;
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 400;
  margin-top: 3px;
}

/* ─── Fine badge ─── */
.fine-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  font-weight: 600;
  color: var(--danger);
  background: var(--danger-dim);
  border: 1px solid rgba(239, 68, 68, 0.2);
  padding: 3px 10px;
  border-radius: 999px;
}

/* ─── Changes timeline ─── */
.changes-list {
  list-style: none;
}

.change-item {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px;
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
  position: relative;
}

.change-item:last-child { border-bottom: none; }

.change-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--primary);
  margin-top: 6px;
  flex-shrink: 0;
}

.change-date {
  font-size: 12px;
  font-family: var(--font-mono);
  color: var(--text-dim);
  margin-bottom: 4px;
}

.change-desc {
  font-size: 14px;
  color: var(--text);
}

.change-delta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-family: var(--font-mono);
  margin-top: 4px;
}

.delta-old { color: var(--danger); text-decoration: line-through; }
.delta-new { color: var(--success); }
.delta-arrow { color: var(--text-dim); }

/* ─── Empty state ─── */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-muted);
}

.empty-state-icon {
  font-size: 32px;
  margin-bottom: 12px;
  opacity: 0.5;
}

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

.empty-state p {
  font-size: 14px;
  color: var(--text-muted);
  max-width: 320px;
  margin: 0 auto;
}

/* ─── Source citation ─── */
.source-link {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--primary);
  text-decoration: none;
  padding: 10px 14px;
  border: 1px solid rgba(109, 124, 255, 0.2);
  border-radius: var(--radius);
  background: var(--primary-dim);
  transition: background var(--transition), border-color var(--transition);
  overflow: hidden;
  white-space: nowrap;
}

.source-link:hover {
  background: rgba(109, 124, 255, 0.18);
  border-color: rgba(109, 124, 255, 0.35);
}

.source-link-icon { flex-shrink: 0; }

.source-link-text {
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 500;
}

/* ─── Breadcrumb ─── */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 24px;
  font-size: 13px;
}

.breadcrumb a {
  color: var(--text-muted);
  text-decoration: none;
  transition: color var(--transition);
}

.breadcrumb a:hover { color: var(--text); }

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

.breadcrumb-current { color: var(--text); font-weight: 500; }

/* ─── Night cap pill ─── */
.cap-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 999px;
}

.cap-pill.capped {
  background: var(--warning-dim);
  border: 1px solid rgba(245, 158, 11, 0.2);
  color: var(--warning);
}

.cap-pill.uncapped {
  background: var(--success-dim);
  border: 1px solid rgba(34, 197, 94, 0.2);
  color: var(--success);
}

/* ─── Markets list (table layout on wide screens) ─── */
.markets-list-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.markets-list-table thead tr {
  border-bottom: 2px solid var(--border-2);
}

.markets-list-table th {
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-dim);
  padding: 10px 16px;
}

.markets-list-table tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background var(--transition);
  cursor: pointer;
}

.markets-list-table tbody tr:last-child { border-bottom: none; }

.markets-list-table tbody tr:hover { background: var(--surface-2); }

.markets-list-table td {
  padding: 14px 16px;
  vertical-align: middle;
}

.markets-list-table td.name-cell {
  font-weight: 600;
  color: var(--text);
}

.markets-list-table td.name-cell a {
  color: inherit;
  text-decoration: none;
}

.markets-list-table td.name-cell a:hover { color: var(--primary); }

/* ─── Footer ─── */
footer {
  border-top: 1px solid var(--border);
  padding: 32px 0;
  margin-top: 80px;
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.footer-brand {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: -0.01em;
}

.footer-note {
  font-size: 12px;
  color: var(--text-dim);
}

/* ─── 404 ─── */
.page-404 {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
  text-align: center;
  gap: 12px;
}

.page-404 .code {
  font-size: 80px;
  font-weight: 800;
  letter-spacing: -0.06em;
  color: var(--text-dim);
  line-height: 1;
}

.page-404 h2 {
  font-size: 20px;
  font-weight: 600;
  color: var(--text);
}

.page-404 p {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 20px;
}

/* ─── Nav auth controls ─── */
.nav-auth {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  flex-shrink: 0;
}

.nav-user-email {
  font-size: 13px;
  color: var(--text-muted);
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-logout-form { display: inline; }

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid transparent;
}

.btn-ghost:hover {
  background: var(--surface-2);
  color: var(--text);
  border-color: var(--border);
}

.btn-sm {
  padding: 5px 12px;
  font-size: 13px;
}

/* ─── Flash / alert banner ─── */
.flash-container {
  padding: 12px 0;
}

.alert {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 8px;
}

.alert:last-child { margin-bottom: 0; }

.alert-error {
  background: var(--danger-dim);
  border: 1px solid rgba(239, 68, 68, 0.25);
  color: #fca5a5;
}

.alert-success {
  background: var(--success-dim);
  border: 1px solid rgba(34, 197, 94, 0.25);
  color: #86efac;
}

.alert-icon {
  font-size: 13px;
  font-weight: 700;
  flex-shrink: 0;
}

/* ─── Page header row ─── */
.page-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.page-header-row h1 { margin-bottom: 0; }

/* ─── Auth page ─── */
.auth-page {
  display: flex;
  justify-content: center;
  padding: 64px 0 80px;
}

.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 36px 32px 32px;
}

.auth-back {
  display: inline-block;
  font-size: 13px;
  color: var(--text-muted);
  text-decoration: none;
  margin-bottom: 24px;
  transition: color var(--transition);
}

.auth-back:hover { color: var(--text); }

.auth-header h1 {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 6px;
}

.auth-header p {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 28px;
}

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

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

.auth-switch a {
  color: var(--primary);
  text-decoration: none;
  font-weight: 500;
}

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

/* ─── Form elements ─── */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.01em;
}

.required-mark {
  color: var(--danger);
  font-weight: 700;
}

.form-input,
.form-select {
  width: 100%;
  padding: 9px 12px;
  background: var(--surface-2);
  border: 1px solid var(--border-2);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 14px;
  font-family: var(--font);
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
  appearance: none;
}

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

.form-input:focus,
.form-select:focus,
.form-input:focus-visible,
.form-select:focus-visible {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(109, 124, 255, 0.15);
}

.form-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%238b8b99' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
  cursor: pointer;
}

.form-input.mono { font-family: var(--font-mono); font-size: 13px; }

.btn-full { width: 100%; justify-content: center; padding: 11px 18px; }

/* ─── Form card (listing add/edit) ─── */
.form-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  max-width: 760px;
  margin-bottom: 48px;
}

.form-section {
  padding: 28px 32px;
  border-bottom: 1px solid var(--border);
}

.form-section:last-child { border-bottom: none; }

.form-section-title {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 20px;
}

.form-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}

.form-grid-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 16px;
}

.form-actions {
  padding: 20px 32px;
  background: var(--surface-2);
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* ─── Listings portfolio grid ─── */
.listings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
  margin-bottom: 48px;
}

.listing-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.listing-card:hover {
  border-color: var(--border-2);
  box-shadow: 0 4px 20px rgba(0,0,0,0.25);
}

.listing-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.listing-nickname {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
  line-height: 1.3;
}

.listing-address {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.listing-meta {
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
}

.listing-meta-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.listing-meta-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-dim);
  flex-shrink: 0;
}

.listing-meta-value {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  text-align: right;
}

.listing-meta-value.muted { color: var(--text-dim); }
.listing-meta-value.mono { font-family: var(--font-mono); font-size: 12px; }

.listing-meta-link {
  font-size: 13px;
  font-weight: 500;
  color: var(--primary);
  text-decoration: none;
}

.listing-meta-link:hover { text-decoration: underline; }

.listing-card-actions {
  display: flex;
  gap: 8px;
  padding-top: 4px;
  border-top: 1px solid var(--border);
}

.btn-danger-ghost {
  background: transparent;
  color: var(--danger);
  border: 1px solid transparent;
}

.btn-danger-ghost:hover {
  background: var(--danger-dim);
  border-color: rgba(239, 68, 68, 0.25);
}

/* ─── Urgency badge (listing card) ─── */
.listing-card-badges {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.urgency-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 999px;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.urgency-badge--overdue {
  background: var(--danger-dim);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: var(--danger);
}

.urgency-badge--due-soon {
  background: var(--warning-dim);
  border: 1px solid rgba(245, 158, 11, 0.3);
  color: var(--warning);
}

.urgency-badge--ok {
  background: var(--success-dim);
  border: 1px solid rgba(34, 197, 94, 0.2);
  color: var(--success);
}

/* Listing card urgency accent */
.listing-card--overdue {
  border-color: rgba(239, 68, 68, 0.35);
}

.listing-card--due-soon {
  border-color: rgba(245, 158, 11, 0.3);
}

/* ─── Listing detail header ─── */
.detail-listing-header {
  padding: 32px 0 24px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 40px;
}

.detail-listing-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.detail-listing-title-row h1 {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--text);
  margin-bottom: 4px;
}

.listing-address-detail {
  font-size: 14px;
  color: var(--text-muted);
  margin-top: 4px;
}

.eyebrow-link {
  color: var(--primary);
  text-decoration: none;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.eyebrow-link:hover { text-decoration: underline; }

.detail-listing-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
  flex-wrap: wrap;
}

/* Status summary badge (detail page hero) */
.status-summary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 700;
  padding: 6px 14px;
  border-radius: 999px;
  letter-spacing: 0.02em;
}

.status-summary--overdue {
  background: var(--danger-dim);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: var(--danger);
}

.status-summary--due-soon {
  background: var(--warning-dim);
  border: 1px solid rgba(245, 158, 11, 0.3);
  color: var(--warning);
}

.status-summary--ok {
  background: var(--success-dim);
  border: 1px solid rgba(34, 197, 94, 0.2);
  color: var(--success);
}

/* Quick facts strip */
.listing-facts-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.listing-fact {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 14px 20px;
  border-right: 1px solid var(--border);
  min-width: 120px;
}

.listing-fact:last-child { border-right: none; }

.listing-fact-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.listing-fact-value {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.listing-fact-value.mono { font-family: var(--font-mono); font-size: 13px; }
.listing-fact-value--danger { color: var(--danger); }

/* ─── Tasks section ─── */
.tasks-section {
  margin-bottom: 48px;
}

.tasks-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}

.tasks-header h2 {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.tasks-count {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--surface-3);
  border: 1px solid var(--border);
  padding: 2px 8px;
  border-radius: 999px;
}

/* Task list */
.task-list {
  display: flex;
  flex-direction: column;
  gap: 1px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.task-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  transition: background var(--transition);
}

.task-item:last-child { border-bottom: none; }

.task-item:hover { background: var(--surface-2); }

.task-item--overdue { border-left: 3px solid var(--danger); }
.task-item--due-soon { border-left: 3px solid var(--warning); }
.task-item--ok { border-left: 3px solid transparent; }

.task-left {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  flex: 1;
  min-width: 0;
}

.task-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-top: 6px;
  flex-shrink: 0;
}

.task-status-dot--overdue { background: var(--danger); box-shadow: 0 0 6px rgba(239,68,68,0.5); }
.task-status-dot--due-soon { background: var(--warning); box-shadow: 0 0 6px rgba(245,158,11,0.4); }
.task-status-dot--ok { background: var(--success); }

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

.task-label-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
  flex-wrap: wrap;
}

.task-label {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
}

.task-badge {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 999px;
  flex-shrink: 0;
}

.task-badge--overdue {
  background: var(--danger-dim);
  color: var(--danger);
  border: 1px solid rgba(239,68,68,0.25);
}

.task-badge--due-soon {
  background: var(--warning-dim);
  color: var(--warning);
  border: 1px solid rgba(245,158,11,0.25);
}

.task-badge--ok {
  background: var(--success-dim);
  color: var(--success);
  border: 1px solid rgba(34,197,94,0.2);
}

.task-desc {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.65;
  max-width: 600px;
}

.task-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  flex-shrink: 0;
  text-align: right;
  min-width: 110px;
}

.task-due-label {
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.task-due-label--overdue { color: var(--danger); }
.task-due-label--due-soon { color: var(--warning); }
.task-due-label--ok { color: var(--text-muted); }

.task-due-date {
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--text-dim);
}

/* ─── Source section (detail page) ─── */
.source-section {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 60px;
  flex-wrap: wrap;
}

.source-label {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-dim);
  flex-shrink: 0;
}

/* ─── Dashboard ─── */

/* Stat value colour variants */
.stat-value--danger  { color: var(--danger); }
.stat-value--warning { color: var(--warning); }
.stat-value--success { color: var(--success); }
.stat-value--primary { color: var(--primary); }
.stat-value--dim     { color: var(--text-dim); }

/* Stats row with up to 5 cards */
.db-stats-row {
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  margin-bottom: 40px;
}

/* All-clear banner */
.db-all-clear {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 20px;
  background: var(--success-dim);
  border: 1px solid rgba(34, 197, 94, 0.2);
  border-radius: var(--radius-lg);
  margin-bottom: 32px;
}

.db-all-clear-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
  flex-shrink: 0;
}

.db-all-clear-text {
  font-size: 14px;
  font-weight: 500;
  color: var(--success);
}

/* Section wrapper */
.db-section {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 24px;
}

.db-section--critical {
  border-color: rgba(239, 68, 68, 0.3);
  background: rgba(239, 68, 68, 0.02);
  margin-bottom: 40px;
}

/* Section header */
.db-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}

.db-section--critical .db-section-header {
  background: rgba(239, 68, 68, 0.06);
  border-bottom-color: rgba(239, 68, 68, 0.2);
}

.db-section-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
}

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

.db-section-count {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
}

/* Section indicator dot */
.db-indicator {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

.db-indicator--danger {
  background: var(--danger);
  box-shadow: 0 0 6px rgba(239, 68, 68, 0.55);
}

.db-indicator--market { background: var(--primary); }

/* Dashboard table */
.db-table-head {
  display: grid;
  grid-template-columns: 28px minmax(0,2fr) minmax(0,1.5fr) 130px 90px;
  gap: 16px;
  padding: 8px 20px;
  border-bottom: 1px solid var(--border);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-dim);
  background: var(--surface-2);
}

.db-table--critical .db-table-head {
  grid-template-columns: 28px minmax(0,1.8fr) minmax(0,1fr) minmax(0,1.5fr) 130px 90px;
}

.db-row {
  display: grid;
  grid-template-columns: 28px minmax(0,2fr) minmax(0,1.5fr) 130px 90px;
  gap: 16px;
  align-items: center;
  padding: 14px 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  transition: background var(--transition);
}

.db-table--critical .db-row {
  grid-template-columns: 28px minmax(0,1.8fr) minmax(0,1fr) minmax(0,1.5fr) 130px 90px;
}

.db-row:last-child { border-bottom: none; }
.db-row:hover { background: var(--surface-2); }

.db-row--overdue { border-left: 3px solid var(--danger); }
.db-row--due-soon { border-left: 3px solid var(--warning); }
.db-row--ok { border-left: 3px solid transparent; }

.db-col-status {
  display: flex;
  align-items: center;
  justify-content: center;
}

.db-listing-name {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
  letter-spacing: -0.01em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.db-listing-name:hover { color: var(--primary); }

.db-listing-addr {
  display: block;
  font-size: 12px;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-top: 2px;
}

.db-market-link {
  font-size: 13px;
  color: var(--text-muted);
  text-decoration: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: block;
}

.db-market-link:hover { color: var(--primary); }

.db-task-label {
  font-size: 13px;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: block;
}

.db-due-label {
  font-size: 12px;
  font-weight: 700;
  display: block;
  white-space: nowrap;
}

.db-due-label--overdue  { color: var(--danger); }
.db-due-label--due-soon { color: var(--warning); }
.db-due-label--ok       { color: var(--text-muted); }

.db-due-date {
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--text-dim);
  display: block;
  margin-top: 2px;
}

.db-col-actions { display: flex; justify-content: flex-end; }

/* Market filter tabs */
.market-filter-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 24px;
}

.market-tab {
  padding: 6px 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: background var(--transition), color var(--transition), border-color var(--transition);
}

.market-tab:hover {
  background: var(--surface-3);
  color: var(--text);
}

.market-tab.active {
  background: var(--primary-dim);
  border-color: rgba(109, 124, 255, 0.35);
  color: var(--primary);
}

.market-tab:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* Responsive: collapse market column below 768px */
@media (max-width: 768px) {
  .db-table-head,
  .db-table--critical .db-table-head {
    grid-template-columns: 28px 1fr 110px 80px;
    display: none;  /* hide header labels on mobile, rely on visual layout */
  }

  .db-row,
  .db-table--critical .db-row {
    grid-template-columns: 28px 1fr 110px 80px;
    grid-template-rows: auto auto;
  }

  .db-col-status  { grid-row: 1; grid-column: 1; }
  .db-col-name    { grid-row: 1 / span 2; grid-column: 2; }
  .db-col-market  { display: none; }
  .db-col-task    { grid-row: 2; grid-column: 2; padding-top: 2px; }
  .db-col-due     { grid-row: 1; grid-column: 3; }
  .db-col-actions { grid-row: 2; grid-column: 3 / span 2; justify-content: flex-start; }
}

@media (max-width: 480px) {
  .db-row,
  .db-table--critical .db-row {
    grid-template-columns: 28px 1fr;
    grid-template-rows: auto auto auto;
    padding: 12px 16px;
  }

  .db-col-status  { grid-row: 1; grid-column: 1; align-self: start; margin-top: 4px; }
  .db-col-name    { grid-row: 1; grid-column: 2; }
  .db-col-task    { grid-row: 2; grid-column: 2; }
  .db-col-due     { grid-row: 3; grid-column: 2; }
  .db-col-actions { grid-row: 4; grid-column: 2; }
  .db-col-market  { display: none; }
}

/* ─── Empty state tall variant ─── */
.empty-state-tall {
  min-height: 360px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

/* ─── Nav alert dot ─── */
.nav-alerts-link {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.nav-alert-dot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--danger);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0;
  line-height: 1;
}

/* ─── Alerts unread badge (page header) ─── */
.alerts-unread-badge {
  display: inline-flex;
  align-items: center;
  padding: 6px 14px;
  border-radius: 20px;
  background: rgba(239, 68, 68, 0.12);
  color: var(--danger);
  font-size: 13px;
  font-weight: 700;
  border: 1px solid rgba(239, 68, 68, 0.25);
}

/* ─── Alert feed ─── */
.alerts-feed {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 48px;
}

.alert-card {
  display: flex;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-surface);
  overflow: hidden;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.alert-card:hover {
  border-color: var(--primary);
  box-shadow: 0 2px 12px rgba(109, 124, 255, 0.08);
}

.alert-card--unread {
  background: rgba(109, 124, 255, 0.03);
  border-color: rgba(109, 124, 255, 0.2);
}

.alert-card-accent {
  width: 4px;
  flex-shrink: 0;
}

.alert-card--danger  .alert-card-accent { background: var(--danger); }
.alert-card--warning .alert-card-accent { background: var(--warning); }
.alert-card--success .alert-card-accent { background: var(--success); }

.alert-card-body {
  flex: 1;
  padding: 16px 20px;
  min-width: 0;
}

.alert-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.alert-card-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  min-width: 0;
}

.alert-market-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
}

.alert-listing-name {
  font-size: 13px;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.alert-sep {
  color: var(--text-dim);
  font-size: 13px;
}

.alert-card-date {
  font-size: 12px;
  font-family: var(--font-mono);
  color: var(--text-dim);
  white-space: nowrap;
  flex-shrink: 0;
}

.alert-card-change {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.alert-field-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  white-space: nowrap;
  min-width: 90px;
}

.alert-delta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.alert-delta .delta-old {
  font-size: 14px;
  color: var(--text-muted);
  text-decoration: line-through;
  text-decoration-color: var(--text-dim);
}

.alert-delta .delta-arrow {
  font-size: 14px;
  color: var(--text-dim);
}

.alert-delta .delta-new {
  font-size: 15px;
  font-weight: 700;
}

.delta-new--danger  { color: var(--danger); }
.delta-new--warning { color: var(--warning); }
.delta-new--success { color: var(--success); }

.alert-notes {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 12px;
  line-height: 1.5;
}

.alert-card-footer {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.alert-market-link {
  font-size: 12px;
  color: var(--text-dim);
  text-decoration: none;
}

.alert-market-link:hover {
  color: var(--primary);
  text-decoration: underline;
}

/* ─── Admin market table ─── */
.admin-markets-table th,
.admin-markets-table td {
  padding: 12px 16px;
}

.admin-markets-table td:first-child {
  padding-left: 24px;
}

.admin-markets-table th:first-child {
  padding-left: 24px;
}

/* ─── Responsive ─── */
@media (max-width: 640px) {
  .page-header { padding: 32px 0 24px; }
  .page-header h1 { font-size: 24px; }
  .hero { padding: 48px 0 40px; }
  .markets-grid { grid-template-columns: 1fr; }
  .nav-badge { display: none; }
  .nav-user-email { display: none; }

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

  .markets-list-table thead { display: none; }
  .markets-list-table tbody tr { display: block; padding: 12px 0; }
  .markets-list-table td { display: block; padding: 4px 0; border: none; }
  .markets-list-table td.name-cell { font-size: 15px; padding-bottom: 8px; }

  .auth-card { padding: 28px 20px 24px; }
  .auth-page { padding: 40px 0 60px; }

  .form-card { border-radius: 0; border-left: none; border-right: none; }
  .form-section { padding: 20px 16px; }
  .form-grid-2 { grid-template-columns: 1fr; }
  .form-grid-3 { grid-template-columns: 1fr; }
  .form-actions { padding: 16px; flex-direction: column-reverse; }
  .form-actions .btn { justify-content: center; }

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

  .listing-facts-strip { flex-direction: column; }
  .listing-fact { border-right: none; border-bottom: 1px solid var(--border); }
  .listing-fact:last-child { border-bottom: none; }

  .task-item { flex-direction: column; gap: 12px; }
  .task-right { align-items: flex-start; text-align: left; flex-direction: row; gap: 10px; }

  .detail-listing-title-row { flex-direction: column; gap: 16px; }
  .detail-listing-actions { width: 100%; justify-content: flex-start; }
}

/* ─── Settings page ─── */
.settings-container {
  max-width: 680px;
  padding-top: 48px;
  padding-bottom: 64px;
}

.channel-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
  margin-bottom: 16px;
  transition: border-color var(--transition);
}

.channel-card--active {
  border-color: rgba(109, 124, 255, 0.35);
  background: linear-gradient(135deg, var(--surface) 0%, rgba(109, 124, 255, 0.04) 100%);
}

.channel-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 12px;
}

.channel-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.channel-icon--email {
  background: rgba(109, 124, 255, 0.12);
  color: var(--primary);
}

.channel-icon--webhook {
  background: rgba(34, 197, 94, 0.1);
  color: var(--success);
}

.channel-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.channel-name {
  font-size: 16px;
  font-weight: 650;
  letter-spacing: -0.01em;
  color: var(--text);
}

.channel-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 20px;
  width: fit-content;
}

.channel-badge--on {
  background: var(--success-dim);
  color: var(--success);
  border: 1px solid rgba(34, 197, 94, 0.2);
}

.channel-badge--off {
  background: var(--surface-3);
  color: var(--text-dim);
  border: 1px solid var(--border);
}

.channel-desc {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 20px;
}

.settings-actions {
  margin-top: 8px;
  display: flex;
  justify-content: flex-end;
}

/* ─── Info box ─── */
.info-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px 28px;
}

.info-box-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 12px;
  letter-spacing: -0.01em;
}

.info-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.info-list li {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.55;
  padding-left: 16px;
  position: relative;
}

.info-list li::before {
  content: "·";
  position: absolute;
  left: 0;
  color: var(--primary);
  font-weight: 700;
}

.info-list code {
  font-family: var(--font-mono);
  font-size: 12px;
  background: var(--surface-3);
  padding: 1px 5px;
  border-radius: 4px;
  color: var(--text);
}

.form-hint {
  font-size: 12px;
  color: var(--text-dim);
  line-height: 1.5;
}

.form-hint strong {
  color: var(--text-muted);
  font-weight: 600;
}

/* ─── alert-info flash variant ─── */
.alert-info {
  background: rgba(109, 124, 255, 0.08);
  border: 1px solid rgba(109, 124, 255, 0.2);
  color: #a5b4fc;
}

.alert-warning {
  background: var(--warning-dim);
  border: 1px solid rgba(245, 158, 11, 0.25);
  color: #fcd34d;
}

/* ═══════════════════════════════════════════════════════════════
   City SEO pages  (/city/<slug>)
   ═══════════════════════════════════════════════════════════════ */

/* ─── Page wrapper ─── */
.city-page {
  padding-bottom: 64px;
}

/* ─── Hero ─── */
.city-hero {
  background: linear-gradient(180deg, var(--surface) 0%, var(--bg) 100%);
  border-bottom: 1px solid var(--border);
  padding: 40px 0 48px;
}

.city-breadcrumb {
  margin-bottom: 24px;
}

.city-hero-body {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 40px;
  align-items: start;
}

.city-hero-eyebrow {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.city-eyebrow-badge {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--primary);
  background: var(--primary-dim);
  border: 1px solid rgba(109, 124, 255, 0.25);
  padding: 3px 9px;
  border-radius: 999px;
}

.city-verified-tag {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-muted);
}

.city-verified-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--success);
  flex-shrink: 0;
}

.city-hero-title {
  font-size: 36px;
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1.1;
  color: var(--text);
  margin-bottom: 14px;
}

.city-hero-subtitle {
  color: var(--text-muted);
  font-weight: 600;
}

.city-hero-desc {
  font-size: 15px;
  color: var(--text-muted);
  line-height: 1.7;
  max-width: 520px;
  margin-bottom: 24px;
}

.city-hero-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

/* Stats panel (right column of hero) */
.city-stats-panel {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.city-stat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  gap: 8px;
}

.city-stat-row:first-child { padding-top: 0; }

.city-stat-row--danger { border-color: rgba(239, 68, 68, 0.15); }

.city-stat-label {
  font-size: 13px;
  color: var(--text-muted);
  flex-shrink: 0;
}

.city-stat-value {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  text-align: right;
}

.city-stat-value--danger { color: var(--danger); }

.city-stat-unit {
  font-size: 12px;
  font-weight: 400;
  color: var(--text-muted);
  margin-left: 2px;
}

.city-stat-na { color: var(--text-dim); font-weight: 400; }

.city-stat-cta {
  padding-top: 16px;
  margin-top: 4px;
}

.city-stat-cta-note {
  text-align: center;
  font-size: 11px;
  color: var(--text-dim);
  margin-top: 8px;
}

/* ─── Body layout ─── */
.city-body {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 32px;
  padding-top: 40px;
  align-items: start;
}

.city-main-col {
  min-width: 0;
}

/* ─── Sections ─── */
.city-section {
  margin-bottom: 40px;
}

.city-section-header {
  margin-bottom: 20px;
}

.city-section-heading-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}

.city-section-title {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
}

.city-section-desc {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.65;
}

.city-change-count-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--primary-dim);
  color: var(--primary);
  letter-spacing: 0.04em;
  flex-shrink: 0;
}

/* ─── Change feed ─── */
.city-changes-feed {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.city-change-card {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  border-left: 4px solid transparent;
  transition: background var(--transition);
}

.city-change-card:last-child { border-bottom: none; }

.city-change-card:hover { background: var(--surface); }

.city-change-card--danger  { border-left-color: var(--danger); }
.city-change-card--success { border-left-color: var(--success); }
.city-change-card--warning { border-left-color: var(--warning); }
.city-change-card--info    { border-left-color: var(--primary); }

.city-change-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.city-change-date {
  font-size: 12px;
  font-family: var(--font-mono);
  color: var(--text-dim);
}

.city-change-field-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--surface-3);
  color: var(--text-muted);
  letter-spacing: 0.02em;
}

.city-change-body {}

.city-change-delta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  font-weight: 600;
  font-family: var(--font-mono);
}

.city-delta-old   { color: var(--danger); text-decoration: line-through; }
.city-delta-new   { color: var(--success); }
.city-delta-arrow { color: var(--text-dim); }

.city-change-notes {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 6px;
  line-height: 1.6;
}

/* feed footer */
.city-feed-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-top: 16px;
  padding: 16px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.city-feed-footer-text {
  font-size: 13px;
  color: var(--text-muted);
  flex: 1;
  min-width: 200px;
}

/* empty state */
.city-changes-empty {
  text-align: center;
  padding: 48px 32px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
}

.city-changes-empty-icon {
  font-size: 32px;
  opacity: 0.4;
  margin-bottom: 12px;
}

.city-changes-empty h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 8px;
}

.city-changes-empty p {
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.7;
  max-width: 400px;
  margin: 0 auto;
}

/* ─── Current rules grid ─── */
.city-rules-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 20px;
}

.city-rule-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 16px 20px;
  background: var(--surface);
}

.city-rule-item--danger { background: rgba(239, 68, 68, 0.04); }

.city-rule-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.city-rule-value {
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
}

.city-rule-value--danger { color: var(--danger); }

.city-rule-note {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.55;
}

/* ─── Registration block ─── */
.city-reg-block {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
}

.city-reg-label {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 10px;
}

.city-reg-text {
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.75;
  margin-bottom: 14px;
}

.city-source-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--primary);
  text-decoration: none;
  transition: color var(--transition);
}

.city-source-link:hover { color: var(--primary-hover); }

.city-inline-link {
  color: var(--primary);
  text-decoration: none;
}
.city-inline-link:hover { color: var(--primary-hover); text-decoration: underline; }

/* ─── Sidebar ─── */
.city-sidebar {
  position: sticky;
  top: 72px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.city-sidebar-cta {
  background: var(--surface-2);
  border: 1px solid rgba(109, 124, 255, 0.3);
  border-radius: var(--radius-lg);
  padding: 20px;
  text-align: center;
}

.city-sidebar-cta-icon {
  font-size: 24px;
  margin-bottom: 10px;
}

.city-sidebar-cta-title {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
  margin-bottom: 8px;
}

.city-sidebar-cta-desc {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.65;
  margin-bottom: 16px;
}

.city-sidebar-cta-fine {
  font-size: 11px;
  color: var(--text-dim);
  margin-top: 8px;
}

.city-sidebar-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.city-sidebar-card-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 4px;
}

.city-sidebar-verified {
  font-size: 11px;
  color: var(--text-dim);
  font-family: var(--font-mono);
}

.city-sidebar-market-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.city-sidebar-market-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  color: var(--text-muted);
  text-decoration: none;
  transition: color var(--transition);
}

.city-sidebar-market-list li:last-child .city-sidebar-market-link {
  border-bottom: none;
}

.city-sidebar-market-link:hover { color: var(--primary); }

.city-sidebar-market-state {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-dim);
  background: var(--surface-3);
  border: 1px solid var(--border);
  padding: 2px 6px;
  border-radius: 4px;
  flex-shrink: 0;
}

/* ─── Bottom CTA banner ─── */
.city-bottom-cta {
  background: var(--surface);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 40px 0;
  margin: 40px 0;
}

.city-bottom-cta-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 32px;
  flex-wrap: wrap;
}

.city-bottom-cta-title {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--text);
  margin-bottom: 6px;
}

.city-bottom-cta-desc {
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.6;
  max-width: 480px;
}

.city-bottom-cta-actions {
  display: flex;
  gap: 10px;
  flex-shrink: 0;
  flex-wrap: wrap;
}

/* ─── Other markets footer grid ─── */
.city-other-markets-section {
  padding: 0 0 64px;
}

.city-other-markets-title {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.city-other-markets-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}

.city-market-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  text-decoration: none;
  transition: border-color var(--transition), background var(--transition);
}

.city-market-card:hover {
  border-color: var(--primary);
  background: var(--surface-2);
}

.city-market-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.city-market-card-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.city-market-card-stats {
  font-size: 12px;
  color: var(--text-muted);
}

.city-market-card-sep { margin: 0 4px; }

.city-market-card-cta {
  font-size: 12px;
  color: var(--primary);
  font-weight: 500;
  margin-top: 4px;
}

/* ─── Responsive ─── */
@media (max-width: 900px) {
  .city-hero-body {
    grid-template-columns: 1fr;
  }
  .city-stats-panel {
    order: -1;
  }
  .city-body {
    grid-template-columns: 1fr;
  }
  .city-sidebar {
    position: static;
  }
}

@media (max-width: 600px) {
  .city-hero { padding: 24px 0 32px; }
  .city-hero-title { font-size: 26px; }
  .city-rules-grid { grid-template-columns: 1fr; }
  .city-bottom-cta-inner { flex-direction: column; align-items: flex-start; }
  .city-bottom-cta-actions { flex-direction: column; width: 100%; }
  .city-bottom-cta-actions .btn { width: 100%; justify-content: center; text-align: center; }
}

/* ═══════════════════════════════════════════════════════════════
   Nav plan badge
   ═══════════════════════════════════════════════════════════════ */

.nav-billing-link {
  display: inline-flex;
  align-items: center;
}

.nav-plan-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.nav-plan-badge--pro {
  background: linear-gradient(135deg, rgba(109,124,255,0.2) 0%, rgba(109,124,255,0.1) 100%);
  border: 1px solid rgba(109, 124, 255, 0.4);
  color: var(--primary);
}

.nav-plan-badge--free {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-muted);
}

/* ═══════════════════════════════════════════════════════════════
   Pricing page  (/pricing)
   ═══════════════════════════════════════════════════════════════ */

.pricing-container {
  max-width: 900px;
  padding-top: 64px;
  padding-bottom: 80px;
}

.pricing-hero {
  text-align: center;
  margin-bottom: 48px;
}

.pricing-eyebrow {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--primary);
  margin-bottom: 14px;
}

.pricing-headline {
  font-size: 42px;
  font-weight: 800;
  letter-spacing: -0.04em;
  color: var(--text);
  margin-bottom: 14px;
}

.pricing-subhead {
  font-size: 17px;
  color: var(--text-muted);
  line-height: 1.6;
  max-width: 480px;
  margin: 0 auto;
}

/* Grid */
.pricing-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 48px;
}

.pricing-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px;
  display: flex;
  flex-direction: column;
  gap: 0;
  position: relative;
}

.pricing-card--featured {
  border-color: rgba(109, 124, 255, 0.4);
  background: linear-gradient(180deg, rgba(109, 124, 255, 0.06) 0%, var(--surface) 40%);
}

.pricing-card-badge {
  position: absolute;
  top: -12px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--primary);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 3px 12px;
  border-radius: 999px;
  white-space: nowrap;
}

.pricing-card-header {
  margin-bottom: 24px;
}

.pricing-plan-name {
  display: block;
  font-size: 15px;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.02em;
  text-transform: uppercase;
  margin-bottom: 10px;
}

.pricing-price-row {
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.pricing-amount {
  font-size: 44px;
  font-weight: 800;
  letter-spacing: -0.04em;
  color: var(--text);
  line-height: 1;
}

.pricing-period {
  font-size: 15px;
  color: var(--text-muted);
  font-weight: 500;
}

.pricing-price-note {
  font-size: 13px;
  color: var(--text-dim);
  margin-top: 6px;
}

/* Feature list */
.pricing-features {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 28px;
  flex: 1;
}

.pricing-feature {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.5;
}

.pricing-feature svg {
  flex-shrink: 0;
  margin-top: 2px;
}

.pricing-feature--ok svg { color: var(--success); }

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

.pricing-feature--no svg { color: var(--text-dim); }

.pricing-card-cta .btn {
  width: 100%;
  justify-content: center;
  text-align: center;
}

/* Example calc */
.pricing-calc {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px 32px;
  margin-bottom: 48px;
}

.pricing-calc-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
  margin-bottom: 16px;
}

.pricing-calc-rows {
  display: flex;
  flex-direction: column;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 12px;
}

.pricing-calc-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}

.pricing-calc-row:last-child { border-bottom: none; }

.pricing-calc-row--note { background: var(--surface-2); }

.pricing-calc-row--compare {
  background: var(--surface-2);
  border-top: 2px solid var(--border-2);
}

.pricing-calc-label {
  font-size: 14px;
  color: var(--text-muted);
}

.pricing-calc-value {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
}

.pricing-calc-value--muted {
  color: var(--text-dim);
  font-weight: 500;
}

.pricing-calc-note {
  font-size: 13px;
  color: var(--text-dim);
  line-height: 1.65;
}

/* FAQ */
.pricing-faq { margin-bottom: 16px; }

.pricing-faq-title {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
  margin-bottom: 20px;
}

.pricing-faq-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.pricing-faq-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
}

.pricing-faq-item h4 {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 8px;
  letter-spacing: -0.01em;
}

.pricing-faq-item p {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.65;
}

@media (max-width: 700px) {
  .pricing-grid { grid-template-columns: 1fr; }
  .pricing-headline { font-size: 30px; }
  .pricing-amount { font-size: 36px; }
  .pricing-faq-grid { grid-template-columns: 1fr; }
}

/* ═══════════════════════════════════════════════════════════════
   Billing page  (/billing)
   ═══════════════════════════════════════════════════════════════ */

.billing-container {
  max-width: 720px;
  padding-top: 48px;
  padding-bottom: 72px;
}

/* Plan status banner */
.billing-status {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px 22px;
  border-radius: var(--radius-lg);
  margin-bottom: 32px;
  border: 1px solid var(--border);
}

.billing-status--pro {
  background: linear-gradient(135deg, rgba(109,124,255,0.08) 0%, var(--surface) 60%);
  border-color: rgba(109, 124, 255, 0.3);
}

.billing-status--free {
  background: var(--surface);
}

.billing-status-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  flex-shrink: 0;
}

.billing-status--pro .billing-status-icon {
  background: rgba(109, 124, 255, 0.12);
  color: var(--primary);
}

.billing-status--free .billing-status-icon {
  background: var(--surface-2);
  color: var(--text-muted);
}

.billing-status-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
}

.billing-status-label {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
}

.billing-status-detail {
  font-size: 13px;
  color: var(--text-muted);
}

.billing-status-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  flex-shrink: 0;
}

.billing-status-badge--pro {
  background: rgba(109, 124, 255, 0.15);
  color: var(--primary);
  border: 1px solid rgba(109, 124, 255, 0.3);
}

.billing-status-badge--free {
  background: var(--surface-3);
  color: var(--text-dim);
  border: 1px solid var(--border);
}

/* Section */
.billing-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
  margin-bottom: 20px;
}

.billing-section--danger {
  border-color: rgba(239, 68, 68, 0.2);
  background: rgba(239, 68, 68, 0.02);
}

.billing-section-title {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
  margin-bottom: 20px;
}

/* Usage stat grid */
.billing-usage-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 16px;
}

.billing-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 16px 12px;
  background: var(--bg);
  text-align: center;
}

.billing-stat--highlight {
  background: rgba(109, 124, 255, 0.05);
}

.billing-stat-value {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.04em;
  color: var(--text);
  line-height: 1;
}

.billing-stat-label {
  font-size: 12px;
  color: var(--text-dim);
  font-weight: 500;
}

/* Usage bar */
.billing-usage-bar-wrap {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.billing-usage-bar {
  height: 6px;
  background: var(--surface-3);
  border-radius: 999px;
  overflow: hidden;
}

.billing-usage-fill {
  height: 100%;
  background: var(--primary);
  border-radius: 999px;
  transition: width 0.4s ease;
}

.billing-usage-fill--full {
  background: var(--danger);
}

.billing-usage-bar-label {
  font-size: 13px;
  color: var(--text-muted);
}

/* Breakdown table */
.billing-breakdown {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.billing-breakdown-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}

.billing-breakdown-row:last-child { border-bottom: none; }

.billing-breakdown-row--note { background: var(--surface-2); }

.billing-breakdown-row--total {
  background: var(--surface-2);
  border-top: 2px solid var(--border-2);
}

.billing-breakdown-label {
  font-size: 14px;
  color: var(--text-muted);
}

.billing-breakdown-value {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
}

.billing-breakdown-value--muted {
  color: var(--text-dim);
  font-weight: 500;
  font-size: 14px;
}

/* Upgrade card */
.billing-upgrade-card {
  display: grid;
  grid-template-columns: 1fr 220px;
  gap: 32px;
  align-items: start;
}

.billing-upgrade-headline {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
  margin-bottom: 8px;
}

.billing-upgrade-sub {
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.65;
  margin-bottom: 16px;
}

.billing-upgrade-benefits {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.billing-upgrade-benefits li {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-muted);
}

.billing-upgrade-action {
  background: var(--surface-2);
  border: 1px solid rgba(109, 124, 255, 0.25);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  text-align: center;
  align-self: start;
}

.billing-upgrade-price {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.billing-upgrade-amount {
  font-size: 36px;
  font-weight: 800;
  letter-spacing: -0.04em;
  color: var(--text);
  line-height: 1;
}

.billing-upgrade-unit {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 4px;
}

.billing-upgrade-btn {
  width: 100%;
  justify-content: center;
  text-align: center;
}

.billing-upgrade-caveat {
  font-size: 11px;
  color: var(--text-dim);
  line-height: 1.5;
}

.billing-upgrade-compare {
  font-size: 12px;
  color: var(--text-dim);
  text-decoration: none;
  transition: color var(--transition);
}

.billing-upgrade-compare:hover {
  color: var(--primary);
}

/* Cancel section */
.billing-cancel-desc {
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 16px;
}

.billing-cancel-btn {
  color: var(--danger);
  border-color: rgba(239, 68, 68, 0.3);
}

.billing-cancel-btn:hover {
  background: var(--danger-dim);
  border-color: rgba(239, 68, 68, 0.5);
}

@media (max-width: 640px) {
  .billing-usage-grid { grid-template-columns: repeat(2, 1fr); }
  .billing-upgrade-card { grid-template-columns: 1fr; }
  .billing-stat-value { font-size: 22px; }
}

@media (max-width: 375px) {
  .billing-usage-grid { grid-template-columns: 1fr 1fr; }
}
