:root {
  --bg: #f8fafc;
  --surface: #ffffff;
  --surface-alt: #f1f5f9;
  --ink: #0f172a;
  --ink-muted: #475569;
  --ink-subtle: #64748b;
  --border: #e2e8f0;
  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --primary-soft: #eef2ff;
  --emerald: #047857;
  --emerald-soft: #ecfdf5;
  --amber: #b45309;
  --amber-soft: #fffbeb;
  --rose: #be123c;
  --rose-soft: #fff1f2;
  --radius: 12px;
  --radius-lg: 16px;
}
*, *::before, *::after { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
a:hover { color: var(--primary); }
.tabular-nums { font-variant-numeric: tabular-nums; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; }
.container { max-width: 1152px; margin: 0 auto; padding: 0 20px; }

/* Sticky Site Header */
.site-header {
  background: rgba(255, 255, 255, 0.97);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
  position: sticky;
  top: 0;
  z-index: 40;
}
.header-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  min-height: 64px;
  padding: 10px 0;
  gap: 12px 24px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 18px;
  color: var(--ink);
  letter-spacing: -0.02em;
  flex-shrink: 0;
}
.brand-badge {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--primary);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
}
.brand span em { font-style: normal; color: var(--primary); }
.main-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}
.main-nav a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-muted);
  transition: background 0.15s ease, color 0.15s ease;
}
.main-nav a:hover {
  background: var(--surface-alt);
  color: var(--primary);
}
.live-pill {
  padding: 2px 6px;
  font-size: 10px;
  font-weight: 700;
  background: #d1fae5;
  color: #065f46;
  border-radius: 4px;
}

/* Subtle FTC Disclosure Note (only on commercial review/comparison pages) */
.ftc-note {
  font-size: 12px;
  color: var(--ink-subtle);
  margin: 0 0 18px;
}
.ftc-note a {
  text-decoration: underline;
  color: var(--ink-muted);
}

/* Breadcrumb */
.breadcrumb { padding-top: 16px; font-size: 12px; color: var(--ink-subtle); display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.breadcrumb strong { color: var(--ink); font-weight: 600; }

/* Layout & Cards */
main { padding: 24px 0 48px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; box-shadow: 0 1px 2px rgba(15,23,42,0.03); }
.card-lg { border-radius: var(--radius-lg); padding: 32px; }
.mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }
.mb-8 { margin-bottom: 32px; }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }

/* Typography */
h1 { font-size: clamp(1.65rem, 3vw, 2.25rem); font-weight: 800; line-height: 1.2; letter-spacing: -0.025em; margin: 0 0 12px; }
h2 { font-size: 1.25rem; font-weight: 750; line-height: 1.3; margin: 0 0 12px; }
h3 { font-size: 1.05rem; font-weight: 700; margin: 0 0 8px; }
.lead { color: var(--ink-muted); font-size: 1rem; max-width: 760px; margin: 0 0 20px; }
.muted { color: var(--ink-muted); font-size: 14px; }
.small { font-size: 12px; color: var(--ink-subtle); }

/* Badges & Buttons */
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.badge-indigo { background: var(--primary-soft); color: var(--primary); }
.badge-emerald { background: var(--emerald-soft); color: var(--emerald); border: 1px solid #a7f3d0; }
.badge-amber { background: var(--amber-soft); color: var(--amber); border: 1px solid #fde68a; }
.badge-rose { background: var(--rose-soft); color: var(--rose); border: 1px solid #fecdd3; }
.badge-dark { background: #0f172a; color: #fff; border-radius: 6px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 10px 18px; border-radius: 10px; font-size: 13px; font-weight: 600; border: 1px solid transparent; cursor: pointer; transition: background 0.15s ease; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); color: #fff; }
.btn-dark { background: #0f172a; color: #fff; }
.btn-dark:hover { background: #1e293b; color: #fff; }
.btn-outline { background: var(--surface); border-color: #cbd5e1; color: var(--ink); }
.btn-outline:hover { background: var(--surface-alt); }
.btn-block { width: 100%; }

/* Grids */
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 24px; }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 20px; }
.detail-layout { display: grid; grid-template-columns: 2fr 1fr; gap: 28px; align-items: start; }
@media (max-width: 860px) { .detail-layout { grid-template-columns: 1fr; } }

/* Tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; text-align: left; font-size: 14px; }
th { background: #0f172a; color: #fff; font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; padding: 12px 14px; }
td { padding: 13px 14px; border-bottom: 1px solid var(--border); vertical-align: top; }
tr:hover td { background: #f8fafc; }

/* Spec Boxes & Progress */
.spec-box { background: var(--surface-alt); border: 1px solid var(--border); border-radius: 8px; padding: 12px; font-size: 12px; }
.spec-row { display: flex; justify-content: space-between; padding: 3px 0; }
.bar-track { width: 100%; height: 6px; background: var(--surface-alt); border-radius: 999px; overflow: hidden; margin-top: 4px; }
.bar-fill { height: 100%; background: var(--primary); border-radius: 999px; }

/* Form Inputs */
select, input[type="range"] { width: 100%; padding: 8px 10px; border-radius: 8px; border: 1px solid #cbd5e1; font-size: 14px; background: #fff; }
.tco-banner { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; background: #0f172a; color: #fff; border-radius: 12px; padding: 20px; }
.tco-val { font-size: 24px; font-weight: 800; margin-top: 4px; }

/* E-E-A-T Author Box & Footer */
.author-box { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; background: var(--surface-alt); border: 1px solid var(--border); border-radius: 10px; padding: 14px 18px; font-size: 12px; color: var(--ink-muted); }
.site-footer { background: var(--surface); border-top: 1px solid var(--border); padding: 40px 0; margin-top: 48px; font-size: 13px; color: var(--ink-muted); }
.footer-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 28px; }
.footer-list { list-style: none; padding: 0; margin: 8px 0 0; }
.footer-list li { margin-bottom: 6px; font-size: 12px; }

/* Responsive Table & Long Text Cell Handling */
.cell-summary {
  font-size: 12px;
  color: var(--ink-subtle);
  margin: 4px 0 0;
  max-width: 340px;
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.cell-limits {
  max-width: 280px;
  line-height: 1.45;
}
.compare-table {
  min-width: 600px;
}

@media (max-width: 768px) {
  .responsive-table-wrap {
    background: transparent;
    border: none;
    box-shadow: none;
    padding: 0;
    overflow: visible;
  }
  .responsive-table,
  .responsive-table tbody,
  .responsive-table tr,
  .responsive-table td {
    display: block;
    width: 100%;
  }
  .responsive-table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
  }
  .responsive-table tr {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 14px;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
  }
  .responsive-table td {
    padding: 8px 0;
    border-bottom: 1px dashed var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    text-align: right;
  }
  .responsive-table td:last-child {
    border-bottom: none;
  }
  .responsive-table td[data-label]::before {
    content: attr(data-label);
    font-size: 12px;
    font-weight: 600;
    color: var(--ink-subtle);
    text-align: left;
    flex-shrink: 0;
  }
  .responsive-table td.cell-primary {
    display: block;
    text-align: left;
    padding: 0 0 12px;
    margin-bottom: 4px;
    border-bottom: 1px solid var(--border);
  }
  .responsive-table td.cell-primary::before {
    display: none;
  }
  .responsive-table .cell-summary {
    max-width: 100%;
    -webkit-line-clamp: unset;
    overflow: visible;
    margin-top: 6px;
  }
  .responsive-table .cell-limits {
    max-width: 100%;
    text-align: right;
  }
  .responsive-table td.cell-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    padding-top: 12px;
    margin-top: 4px;
    border-bottom: none;
  }
  .responsive-table td.cell-actions::before {
    display: none;
  }
  .responsive-table td.cell-actions .btn {
    width: 100%;
    padding: 9px 12px;
  }
}

/* ==========================================================================
   Portal Homepage Design (Distinct from Subpages)
   ========================================================================== */
.portal-hero {
  background: linear-gradient(135deg, #0f172a 0%, #1e1b4b 58%, #0f172a 100%);
  color: #f8fafc;
  border-radius: 20px;
  padding: 36px 36px 24px;
  box-shadow: 0 18px 40px -15px rgba(15, 23, 42, 0.35);
  border: 1px solid #1e293b;
}
@media (max-width: 640px) {
  .portal-hero { padding: 24px 18px 18px; border-radius: 16px; }
}
.portal-hero-grid {
  display: grid;
  grid-template-columns: 1.35fr 1fr;
  gap: 32px;
  align-items: center;
}
@media (max-width: 920px) {
  .portal-hero-grid { grid-template-columns: 1fr; gap: 24px; }
}
.portal-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 12px;
  border-radius: 999px;
  background: rgba(99, 102, 241, 0.18);
  border: 1px solid rgba(129, 140, 248, 0.35);
  color: #c7d2fe;
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 16px;
}
.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #34d399;
  box-shadow: 0 0 0 4px rgba(52, 211, 153, 0.2);
}
.portal-title {
  color: #ffffff;
  font-size: clamp(1.85rem, 3.4vw, 2.65rem);
  line-height: 1.15;
  margin: 0 0 14px;
}
.portal-title span {
  color: #a5b4fc;
}
.portal-subtitle {
  color: #cbd5e1;
  font-size: 15px;
  line-height: 1.6;
  max-width: 580px;
  margin: 0 0 22px;
}

/* Hero Instant Search */
.hero-search-wrap {
  position: relative;
  max-width: 580px;
  margin-bottom: 16px;
}
.hero-search-box {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #ffffff;
  color: var(--ink);
  border-radius: 12px;
  padding: 4px 14px;
  box-shadow: 0 10px 25px rgba(2, 6, 23, 0.35);
}
.hero-search-box svg {
  color: #64748b;
  flex-shrink: 0;
}
.hero-search-box input {
  border: none;
  outline: none;
  width: 100%;
  padding: 11px 4px;
  font-size: 14px;
  color: var(--ink);
  background: transparent;
}
.hero-search-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: #ffffff;
  color: var(--ink);
  border-radius: 12px;
  border: 1px solid var(--border);
  box-shadow: 0 16px 32px rgba(15, 23, 42, 0.22);
  z-index: 50;
  overflow: hidden;
}
.search-hit {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.search-hit:last-child { border-bottom: none; }
.search-hit:hover { background: var(--primary-soft); }
.search-hit-tag {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 5px;
  background: var(--surface-alt);
  color: var(--primary);
  flex-shrink: 0;
}
.search-hit-title { font-weight: 600; color: var(--ink); }
.search-empty { padding: 14px; font-size: 13px; color: var(--ink-subtle); }

.hero-pills {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  font-size: 12px;
}
.hero-pills-label { color: #94a3b8; font-weight: 600; }
.hero-pills a {
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: #e2e8f0;
  font-weight: 500;
  transition: background 0.15s ease;
}
.hero-pills a:hover {
  background: rgba(99, 102, 241, 0.35);
  color: #ffffff;
}

/* Right Hero Panel: Quick 5-Seat TCO Duel */
.portal-hero-panel {
  background: rgba(15, 23, 42, 0.72);
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 16px;
  padding: 20px;
  backdrop-filter: blur(8px);
}
.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
}
.badge-live-dark {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 6px;
  background: rgba(16, 185, 129, 0.18);
  color: #6ee7b7;
  border: 1px solid rgba(16, 185, 129, 0.35);
}
.duel-controls {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 8px;
  align-items: end;
  margin-bottom: 14px;
}
.duel-label {
  display: block;
  font-size: 11px;
  color: #94a3b8;
  margin-bottom: 4px;
}
.duel-select {
  background: #1e293b;
  color: #f8fafc;
  border: 1px solid #334155;
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 13px;
  font-weight: 600;
}
.duel-vs {
  font-size: 11px;
  font-weight: 800;
  color: #818cf8;
  padding-bottom: 10px;
}
.duel-results {
  display: grid;
  grid-template-columns: 1fr 1px 1fr;
  gap: 12px;
  background: rgba(30, 41, 59, 0.65);
  border: 1px solid #334155;
  border-radius: 10px;
  padding: 14px;
  margin-bottom: 10px;
}
.duel-divider { background: #334155; }
.duel-prod-name { font-size: 12px; font-weight: 700; color: #cbd5e1; }
.duel-prod-cost { font-size: 20px; font-weight: 800; color: #34d399; margin: 2px 0; }
.duel-prod-meta { font-size: 11px; color: #94a3b8; }
.duel-diff-note {
  font-size: 12px;
  color: #c7d2fe;
  margin-bottom: 12px;
  min-height: 18px;
}
.duel-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.btn-panel-outline, .btn-panel-primary {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
}
.btn-panel-outline {
  border: 1px solid #475569;
  color: #e2e8f0;
}
.btn-panel-outline:hover { background: #1e293b; color: #fff; }
.btn-panel-primary {
  background: var(--primary);
  color: #fff;
}
.btn-panel-primary:hover { background: var(--primary-hover); color: #fff; }

/* Portal Stats Bar */
.portal-stats-bar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-top: 26px;
  padding-top: 18px;
  border-top: 1px solid rgba(148, 163, 184, 0.2);
}
.stat-item strong {
  display: block;
  font-size: 14px;
  color: #ffffff;
}
.stat-item span {
  font-size: 12px;
  color: #94a3b8;
}

/* Section Headers & Decision Hub Grid */
.section-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-end;
  gap: 12px;
  margin-bottom: 16px;
}
.section-head h2 { margin: 0; }
.section-head p { margin: 4px 0 0; }

.hub-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(245px, 1fr));
  gap: 16px;
}
.hub-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}
.hub-card:hover {
  transform: translateY(-2px);
  border-color: var(--primary);
  box-shadow: 0 8px 20px -8px rgba(79, 70, 229, 0.22);
}
.hub-tag {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.05em;
  color: var(--primary);
  background: var(--primary-soft);
  padding: 3px 8px;
  border-radius: 5px;
  align-self: flex-start;
  margin-bottom: 10px;
}
.hub-card h3 { margin: 0 0 6px; font-size: 16px; color: var(--ink); }
.hub-card p { font-size: 13px; color: var(--ink-muted); margin: 0 0 14px; line-height: 1.45; }
.hub-cta { font-size: 12px; font-weight: 700; color: var(--primary); }

/* Leaderboard Filter Tabs */
.leaderboard-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.filter-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.tab-btn {
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface-alt);
  color: var(--ink-muted);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.tab-btn.active {
  background: #0f172a;
  color: #ffffff;
  border-color: #0f172a;
}
.rank-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 3px 9px;
  border-radius: 6px;
  background: #0f172a;
  color: #ffffff;
  font-size: 12px;
  font-weight: 700;
}

/* Bottom Portal Grid (Battlecards + Audit Feed) */
.portal-bottom-grid {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 24px;
  align-items: start;
}
@media (max-width: 860px) {
  .portal-bottom-grid { grid-template-columns: 1fr; }
}
.battlecard-stack {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.battlecard {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  display: block;
  transition: border-color 0.15s ease;
}
.battlecard:hover { border-color: var(--primary); }
.battlecard-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.battlecard h3 { margin: 0; font-size: 16px; color: var(--ink); }

.audit-item {
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.audit-item:first-child { padding-top: 0; }
.audit-item:last-child { border-bottom: none; padding-bottom: 0; }
.audit-item-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
}
.audit-delta {
  display: inline-block;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 5px;
  background: var(--surface-alt);
  color: var(--primary);
  font-weight: 600;
}
