/* ==========================================================================
   Visual refresh — loaded after every other stylesheet so it can override.
   Goals: value-first cards, a confident hero, readable text, comfortable
   touch targets, a compact mobile layout and a bottom-sheet filter drawer.
   ========================================================================== */

:root {
  --fg-muted: #4b5a70; /* darker than slate-500 for AA contrast on tinted surfaces */
  --good: #047857;
  --good-bg: #ecfdf5;
  --good-border: #a7f3d0;
  --warn: #b45309;
  --warn-bg: #fffbeb;
  --warn-border: #fde68a;
  --bad: #be123c;
  --bad-bg: #fff1f2;
  --bad-border: #fecdd3;
  --hero-from: #1e1b4b;
  --hero-to: #4338ca;
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
summary:focus-visible {
  outline: 3px solid var(--indigo-500);
  outline-offset: 2px;
}

body.no-scroll {
  overflow: hidden;
}

/* ——— Header ——— */
.nav-bar {
  background: rgba(255, 255, 255, 0.88);
}

.shell-nav a {
  color: var(--slate-700);
  font-weight: 600;
}

.shell-nav a[aria-current="page"] {
  color: var(--primary);
}

.compare-pill {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
}

/* ——— Hero ——— */
.hero-v2 {
  position: relative;
  overflow: hidden;
  color: #fff;
  background:
    radial-gradient(900px 400px at 85% -10%, rgba(139, 92, 246, 0.55), transparent 60%),
    radial-gradient(700px 380px at 0% 110%, rgba(16, 185, 129, 0.28), transparent 60%),
    linear-gradient(135deg, var(--hero-from), var(--hero-to));
}

.hero-v2::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(255, 255, 255, 0.18) 1px, transparent 1px);
  background-size: 26px 26px;
  mask-image: linear-gradient(to bottom, black, transparent 85%);
  pointer-events: none;
}

.hero-v2__inner {
  position: relative;
  z-index: 1;
  max-width: var(--content-w);
  margin: 0 auto;
  padding: 56px 28px 60px;
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
  gap: 48px;
  align-items: center;
}

.hero-v2__eyebrow {
  margin: 0 0 14px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #c7d2fe;
}

.hero-v2 h1 {
  margin: 0 0 16px;
  font-family: var(--font-display);
  font-size: clamp(2rem, 5vw, 3.25rem);
  font-weight: 800;
  letter-spacing: -0.045em;
  line-height: 1.06;
  color: #fff;
  max-width: 16ch;
}

.hero-v2 h1 span {
  background: linear-gradient(90deg, #a7f3d0, #67e8f9);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero-v2__sub {
  margin: 0 0 28px;
  max-width: 46ch;
  font-size: 17px;
  line-height: 1.6;
  color: #e0e7ff;
}

.hero-v2__cta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.btn-hero {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 24px;
  border-radius: var(--radius-full);
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
  text-decoration: none;
  transition: transform var(--transition), box-shadow var(--transition), background var(--transition);
}

.btn-hero:active {
  transform: scale(0.98);
}

.btn-hero--primary {
  color: #1e1b4b;
  background: #fff;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.3);
}

.btn-hero--primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 34px rgba(15, 23, 42, 0.38);
}

.btn-hero--ghost {
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.35);
}

.btn-hero--ghost:hover {
  background: rgba(255, 255, 255, 0.18);
}

.hero-v2__steps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 12px;
}

.hero-v2__steps li {
  display: flex;
  gap: 14px;
  align-items: center;
  padding: 14px 16px;
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.18);
  backdrop-filter: blur(8px);
}

.hero-v2__step-num {
  flex: none;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #fff;
  color: var(--hero-to);
  font-family: var(--font-display);
  font-weight: 800;
}

.hero-v2__steps strong {
  display: block;
  font-family: var(--font-display);
  font-size: 15px;
  color: #fff;
}

.hero-v2__steps span:not(.hero-v2__step-num) {
  font-size: 13px;
  color: #c7d2fe;
}

.page--home {
  padding-top: 32px;
}

/* ——— Toolbar / filter trigger ——— */
.filter-trigger {
  display: none;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 18px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-full);
  background: var(--bg);
  color: var(--fg);
  font: 600 14px var(--font);
  cursor: pointer;
}

.filter-trigger__count {
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  display: inline-grid;
  place-items: center;
  border-radius: var(--radius-full);
  background: var(--primary);
  color: #fff;
  font-size: 12px;
}

.filter-trigger__count[hidden] {
  display: none;
}

.lhn-head__actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.lhn-close,
.lhn-foot,
.filters-backdrop[hidden] {
  display: none;
}

#clear-filters {
  min-height: 36px;
  padding: 0 10px;
  color: var(--primary);
  font-weight: 600;
  cursor: pointer;
}

/* ——— Cards ——— */
.card-grid-item {
  display: flex;
  flex-direction: column;
  border-radius: var(--radius-2xl);
  border-color: var(--slate-200);
  box-shadow: var(--shadow-xs);
}

.card-grid-item .card-body-link {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.card-grid-item .card-visual {
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.18);
}

.card-title {
  font-size: 16px;
}

.card-value {
  margin-top: auto;
  padding: 12px 14px;
  border-radius: var(--radius-lg);
  display: grid;
  gap: 2px;
  border: 1px solid transparent;
}

.card-body-link .card-meta {
  margin-bottom: 14px;
}

.card-value__amount {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.1;
}

.card-value__amount small {
  margin-left: 2px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0;
  opacity: 0.75;
}

.card-value__label {
  font-size: 12px;
  font-weight: 600;
}

.card-value--good {
  color: var(--good);
  background: var(--good-bg);
  border-color: var(--good-border);
}

.card-value--low {
  color: var(--warn);
  background: var(--warn-bg);
  border-color: var(--warn-border);
}

.card-value--locked {
  color: var(--bad);
  background: var(--bad-bg);
  border-color: var(--bad-border);
}

.card-value--low .card-value__amount,
.card-value--locked .card-value__amount {
  font-size: 20px;
}

.card-rank {
  position: absolute;
  top: 26px;
  left: 26px;
  z-index: 5;
  padding: 5px 12px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, #059669, #10b981);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.03em;
  box-shadow: 0 6px 16px rgba(5, 150, 105, 0.35);
}

.card-grid-item.has-rank {
  border-color: var(--good-border);
}

/* Apply: readable, tappable */
.card-grid-actions {
  padding: 0 18px 12px;
}

.card-grid-actions .btn-apply--text,
.card-grid-actions a.btn-apply--text {
  min-height: 44px;
  padding: 0 4px;
  font-size: 14px;
  font-weight: 600;
  color: var(--primary);
}

.eligibility-badge {
  font-size: 11px;
}

.eligibility-badge--unknown,
.eligibility-badge--ineligible {
  color: var(--bad);
}

.eligibility-badge--unknown {
  color: var(--slate-700);
}

.select-toggle {
  top: 24px;
  right: 24px;
  width: 40px;
  height: 40px;
  color: var(--slate-700);
  font-size: 20px;
}

.select-toggle::after {
  content: "";
  position: absolute;
  inset: -4px;
}

.filter-fieldset input[type="checkbox"],
.toggle-row input[type="checkbox"] {
  width: 20px;
  height: 20px;
  accent-color: var(--primary);
}

/* Skeletons */
.card-skeleton {
  min-height: 340px;
  border-radius: var(--radius-2xl);
  border: 1px solid var(--border);
  background: linear-gradient(100deg, var(--slate-100) 30%, var(--bg) 50%, var(--slate-100) 70%);
  background-size: 300% 100%;
  animation: skeleton-shimmer 1.4s ease-in-out infinite;
}

@keyframes skeleton-shimmer {
  from {
    background-position: 100% 0;
  }
  to {
    background-position: 0 0;
  }
}

/* ——— Compare verdict ——— */
.compare-verdict {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  margin-bottom: 20px;
  padding: 16px 20px;
  border-radius: var(--radius-xl);
  background: var(--good-bg);
  border: 1px solid var(--good-border);
  color: var(--slate-900);
}

.compare-verdict[hidden] {
  display: none;
}

.compare-verdict__badge {
  flex: none;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  background: var(--good);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.compare-verdict strong {
  font-family: var(--font-display);
  font-size: 16px;
}

.compare-verdict p {
  margin: 4px 0 0;
  font-size: 14px;
  color: var(--slate-700);
}

/* ——— Tablet and below: filters become a bottom sheet ——— */
@media (max-width: 960px) {
  .hero-v2__inner {
    grid-template-columns: minmax(0, 1fr);
    gap: 28px;
    padding: 40px 20px 44px;
  }

  .hero-v2__copy,
  .hero-v2__sub {
    min-width: 0;
    max-width: 100%;
  }

  .hero-v2__steps {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .hero-v2__steps li {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .filter-trigger {
    display: inline-flex;
  }

  .content-toolbar {
    flex-direction: row;
    align-items: center;
    flex-wrap: wrap;
  }

  .content-toolbar .sort-bar {
    margin-left: auto;
  }

  .lhn {
    position: fixed;
    inset: auto 0 0 0;
    z-index: 300;
    max-height: 86vh;
    border-radius: 24px 24px 0 0;
    border-bottom: none;
    box-shadow: 0 -20px 60px rgba(15, 23, 42, 0.3);
    transform: translateY(105%);
    transition: transform var(--transition-slow);
    visibility: hidden;
  }

  .lhn.is-open {
    transform: translateY(0);
    visibility: visible;
  }

  .lhn .lhn__body {
    flex: 1;
    max-height: none;
    overflow-y: auto;
  }

  .lhn-close {
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 50%;
    background: var(--bg-muted);
    color: var(--fg);
    font-size: 24px;
    cursor: pointer;
  }

  .lhn-foot {
    display: block;
    padding: 12px 20px calc(12px + env(safe-area-inset-bottom));
    border-top: 1px solid var(--border);
    background: var(--bg);
  }

  .lhn-foot .btn-primary {
    width: 100%;
    min-height: 48px;
  }

  .filters-backdrop {
    position: fixed;
    inset: 0;
    z-index: 250;
    background: rgba(15, 23, 42, 0.5);
  }
}

/* ——— Phone: compact horizontal cards ——— */
@media (max-width: 640px) {
  .hero-v2__inner {
    padding: 28px 16px 32px;
  }

  .hero-v2 h1 {
    font-size: 1.9rem;
  }

  .hero-v2__sub {
    font-size: 15px;
    margin-bottom: 20px;
  }

  .btn-hero {
    flex: 1 1 140px;
  }

  .hero-v2__steps {
    display: none;
  }

  .shell-content {
    padding: 20px 16px 72px;
  }

  .card-grid,
  #card-list {
    gap: 12px;
  }

  .card-grid-item .card-body-link {
    display: grid;
    grid-template-columns: 112px minmax(0, 1fr);
    column-gap: 14px;
    row-gap: 2px;
    align-content: start;
    padding: 14px;
  }

  .card-grid-item .card-visual {
    grid-column: 1;
    grid-row: 1 / span 3;
    width: 112px;
    margin: 0;
    align-self: start;
    border-radius: 10px;
  }

  .card-grid-item .card-chips {
    grid-column: 2;
    margin: 0 0 4px;
    padding-right: 36px;
  }

  .card-grid-item .card-title {
    grid-column: 2;
    margin: 0;
    font-size: 15px;
  }

  .card-grid-item .card-body-link .card-meta {
    grid-column: 2;
    margin: 0;
    font-size: 12px;
  }

  .card-grid-item .card-value {
    grid-column: 1 / -1;
    margin-top: 12px;
    padding: 10px 12px;
  }

  .card-value__amount {
    font-size: 20px;
  }

  .card-rank {
    top: 10px;
    left: auto;
    right: 58px;
    font-size: 10px;
    padding: 4px 9px;
  }

  .select-toggle {
    top: 10px;
    right: 10px;
  }

  .card-grid-actions {
    padding: 0 14px 6px;
  }

  .nav-bar__inner {
    padding: 8px 16px 10px;
    gap: 8px;
  }

  .logo__text {
    font-size: 16px;
  }

  .content-head h2 {
    font-size: 1.1rem;
  }

  .compare-verdict {
    flex-direction: column;
    gap: 8px;
  }
}

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

/* ——— Fixes found while reviewing ——— */
.btn-hero {
  gap: 0.3em;
  white-space: nowrap;
}

@media (max-width: 640px) {
  .hero-v2__cta {
    display: grid;
    grid-template-columns: 1fr;
  }

  .btn-hero {
    width: 100%;
    white-space: normal;
    text-align: center;
  }
}

.hero-v2 h1 {
  letter-spacing: -0.035em;
  word-spacing: 0.05em;
}

@media (max-width: 900px) {
  .nav-bar {
    height: auto;
    min-height: var(--header-h);
  }

  .nav-bar__inner {
    padding: 10px 20px 10px;
  }

  .shell-nav {
    padding-bottom: 0;
  }
}

/* Locked (income too low): informative, not alarming */
.card-value--locked {
  color: var(--slate-700);
  background: var(--slate-50);
  border-color: var(--slate-200);
}

.card-value--locked .card-value__amount {
  color: var(--slate-500);
}

.card-grid-item:has(.card-value--locked) .card-visual {
  filter: saturate(0.7);
}

.eligibility-filter .toggle-row {
  text-transform: none;
  letter-spacing: 0;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.4;
  cursor: pointer;
}

/* ——— Top picks strip ——— */
.top-picks {
  margin-bottom: 28px;
  padding: 20px;
  border-radius: var(--radius-2xl);
  background: linear-gradient(135deg, var(--emerald-50), var(--indigo-50));
  border: 1px solid var(--good-border);
}

.top-picks[hidden] {
  display: none;
}

.top-picks__head h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.15rem;
  letter-spacing: -0.02em;
}

.top-picks__head p {
  margin: 2px 0 14px;
  font-size: 13px;
  color: var(--fg-muted);
}

.top-picks__row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.top-pick {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: var(--radius-lg);
  background: var(--bg);
  border: 1px solid var(--slate-200);
  text-decoration: none;
  color: inherit;
  transition: transform var(--transition), box-shadow var(--transition);
}

.top-pick:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.top-pick__art {
  flex: none;
  width: 84px;
}

.top-pick__text {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.top-pick__text strong {
  font-family: var(--font-display);
  font-size: 14px;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.top-pick__rank {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--good);
}

.top-pick__value {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 800;
  color: var(--good);
}

.top-pick__value small {
  font-size: 12px;
  font-weight: 600;
  opacity: 0.75;
}

@media (max-width: 900px) {
  .top-picks__row {
    grid-template-columns: none;
    grid-auto-flow: column;
    grid-auto-columns: minmax(240px, 80%);
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    padding-bottom: 6px;
  }

  .top-pick {
    scroll-snap-align: start;
  }
}

@media (max-width: 640px) {
  .top-picks {
    padding: 16px 14px;
    border-radius: var(--radius-xl);
  }
}

#load-more[hidden] {
  display: none;
}

#load-more {
  min-height: 48px;
  padding: 0 28px;
  border-radius: var(--radius-full);
}

/* ==========================================================================
   Flow improvements: profile chip/dialog/bar, toasts, picker, back links,
   card actions, similar cards, quiz navigation, answer chips.
   ========================================================================== */

/* Header: profile chip */
.nav-actions {
  justify-self: end;
  display: flex;
  align-items: center;
  gap: 8px;
}

.profile-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-full);
  background: var(--bg);
  color: var(--slate-800);
  font: 600 12px var(--font);
  cursor: pointer;
  white-space: nowrap;
  transition: border-color var(--transition), background var(--transition);
}

.profile-chip:hover {
  border-color: var(--primary);
  background: var(--primary-muted);
}

.profile-chip.is-default {
  border-style: dashed;
  color: var(--warn);
  background: var(--warn-bg);
  border-color: var(--warn-border);
}

@media (max-width: 560px) {
  .profile-chip__text {
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
  }
}

/* Profile dialog + card picker */
.profile-dialog,
.card-picker {
  width: min(520px, calc(100vw - 24px));
  max-height: calc(100vh - 40px);
  padding: 0;
  border: none;
  border-radius: var(--radius-2xl);
  box-shadow: var(--shadow-lg), 0 0 0 1px var(--border);
  color: var(--fg);
  overflow: auto;
}

.profile-dialog::backdrop,
.card-picker::backdrop {
  background: rgba(15, 23, 42, 0.55);
}

.profile-dialog__form {
  padding: 24px;
  display: grid;
  gap: 18px;
}

.profile-dialog__head,
.card-picker__head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.profile-dialog__head h2,
.card-picker__head h2 {
  margin: 0 0 4px;
  font-family: var(--font-display);
  font-size: 1.3rem;
  letter-spacing: -0.02em;
}

.profile-dialog__head p {
  margin: 0;
  font-size: 13px;
  color: var(--fg-muted);
}

.profile-dialog__close {
  flex: none;
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 50%;
  background: var(--bg-muted);
  color: var(--fg);
  font-size: 22px;
  cursor: pointer;
}

.preset-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.preset-btn {
  display: grid;
  gap: 2px;
  padding: 14px 8px;
  border: 1.5px solid var(--border-strong);
  border-radius: var(--radius-lg);
  background: var(--bg);
  color: var(--fg);
  font: inherit;
  text-align: center;
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition);
}

.preset-btn span {
  font-size: 12px;
  color: var(--fg-muted);
}

.preset-btn:hover,
.preset-btn.is-active {
  border-color: var(--primary);
  background: var(--primary-muted);
}

.profile-dialog__income {
  display: grid;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
}

.profile-dialog__details summary {
  cursor: pointer;
  min-height: 36px;
  display: flex;
  align-items: center;
  font-size: 13px;
  font-weight: 600;
  color: var(--primary);
}

.profile-dialog__grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px 12px;
  margin-top: 8px;
}

.profile-dialog__grid label {
  display: grid;
  gap: 4px;
  font-size: 12px;
  color: var(--fg-muted);
}

.profile-dialog__total {
  margin: 0;
  font-size: 14px;
}

.profile-dialog__actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.profile-dialog__actions button {
  min-height: 44px;
}

/* Profile bar (compact, in-page) */
.profile-bar {
  margin-bottom: 20px;
}

.profile-bar__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px 10px 18px;
  border-radius: var(--radius-full);
  background: var(--primary-muted);
  border: 1px solid var(--indigo-100);
  font-size: 13px;
  color: var(--slate-800);
}

.profile-bar__label em {
  color: var(--warn);
  font-style: normal;
  font-weight: 600;
}

.profile-bar__edit {
  flex: none;
  min-height: 36px;
  padding: 0 16px;
  border: none;
  border-radius: var(--radius-full);
  background: var(--primary);
  color: #fff;
  font: 600 13px var(--font);
  cursor: pointer;
}

.profile-bar__body {
  margin-top: 12px;
}

.profile-bar__body[hidden] {
  display: none;
}

@media (max-width: 560px) {
  .profile-bar__row {
    border-radius: var(--radius-xl);
    align-items: flex-start;
    flex-direction: column;
  }
}

/* First-visit banner */
.profile-banner {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 20px;
  padding: 14px 16px 14px 20px;
  border-radius: var(--radius-xl);
  background: var(--warn-bg);
  border: 1px solid var(--warn-border);
}

.profile-banner__text {
  flex: 1;
  display: grid;
  font-size: 14px;
  color: var(--slate-800);
}

.profile-banner__text strong {
  font-family: var(--font-display);
}

.profile-banner__cta {
  min-height: 44px;
  padding: 0 20px;
  border-radius: var(--radius-full);
}

.profile-banner__close {
  width: 40px;
  height: 40px;
  border: none;
  background: transparent;
  color: var(--slate-600);
  font-size: 22px;
  cursor: pointer;
}

@media (max-width: 640px) {
  .profile-banner {
    flex-wrap: wrap;
  }

  .profile-banner__text {
    flex-basis: 100%;
  }
}

/* Toasts */
.toast-host {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 500;
  transform: translateX(-50%);
  display: grid;
  gap: 8px;
  width: min(440px, calc(100vw - 24px));
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 16px;
  border-radius: var(--radius-lg);
  background: #0f172a;
  color: #fff;
  font-size: 14px;
  box-shadow: var(--shadow-lg);
  border: 1px solid #1e293b;
  animation: toast-in 0.25s var(--ease);
}

.toast.is-leaving {
  opacity: 0;
  transform: translateY(8px);
  transition: all 0.2s ease;
}

.toast__action {
  flex: none;
  min-height: 32px;
  padding: 0 4px;
  border: none;
  background: none;
  color: #a5b4fc;
  font: 700 14px var(--font);
  text-decoration: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
}

/* Card picker */
.card-picker {
  padding: 20px;
}

.card-picker__search {
  width: 100%;
  margin: 14px 0 10px;
  padding: 12px 14px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  font: 500 15px var(--font);
}

.card-picker__list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 50vh;
  overflow-y: auto;
}

.card-picker__list button {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2px 12px;
  padding: 12px 10px;
  border: none;
  border-bottom: 1px solid var(--border);
  background: none;
  text-align: left;
  font: inherit;
  cursor: pointer;
}

.card-picker__list button:hover {
  background: var(--primary-muted);
}

.card-picker__name {
  font-weight: 600;
}

.card-picker__meta {
  grid-column: 1;
  font-size: 12px;
  color: var(--fg-muted);
}

.card-picker__value {
  grid-column: 2;
  grid-row: 1 / span 2;
  align-self: center;
  font-family: var(--font-display);
  font-weight: 800;
  color: var(--good);
}

.card-picker__value.is-negative {
  color: var(--slate-600);
}

.card-picker__empty {
  padding: 18px 8px;
  color: var(--fg-muted);
}

/* Compare: remove / add */
.column-head {
  position: relative;
}

.column-remove {
  position: absolute;
  top: 4px;
  right: 4px;
  z-index: 3;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 50%;
  background: rgba(15, 23, 42, 0.75);
  color: #fff;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}

.column-remove:hover {
  background: var(--bad);
}

button.empty-add {
  font: inherit;
  cursor: pointer;
}

.compare-empty__actions .btn-primary,
.compare-empty__actions .btn-secondary {
  min-height: 44px;
}

/* Card page */
.page-back {
  margin: -8px 0 16px;
}

.page-back a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: var(--primary);
  font-weight: 600;
  text-decoration: none;
}

.page-back a:hover {
  text-decoration: underline;
}

.card-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 16px;
}

.card-actions .btn-primary,
.card-actions .btn-secondary {
  min-height: 44px;
  padding: 0 20px;
}

.card-actions .is-on {
  background: var(--good-bg);
  border-color: var(--good-border);
  color: var(--good);
}

.card-actions .btn-apply--large,
.card-actions a.btn-apply--large {
  margin-top: 0;
  min-height: 44px;
  padding: 0 18px;
  border-radius: var(--radius);
  border: 1px solid var(--primary);
  background: var(--primary-muted);
  color: var(--primary);
  font-size: 14px;
  font-weight: 700;
}

.card-actions .btn-apply--large:hover,
.card-actions a.btn-apply--large:hover {
  background: var(--primary);
  color: #fff;
  text-decoration: none;
}

.similar-cards {
  margin-top: 32px;
}

.similar-cards h2 {
  margin: 0 0 14px;
  font-family: var(--font-display);
  font-size: 1.2rem;
}

.similar-cards__row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.similar-card {
  display: grid;
  gap: 10px;
  padding: 14px;
  border-radius: var(--radius-xl);
  background: var(--bg);
  border: 1px solid var(--border);
}

.similar-card__link {
  display: flex;
  align-items: center;
  gap: 12px;
  color: inherit;
  text-decoration: none;
}

.similar-card__meta {
  font-size: 12px;
  color: var(--fg-muted);
}

.similar-card__compare {
  min-height: 40px;
}

.top-pick__value.is-negative {
  color: var(--slate-600);
}

@media (max-width: 800px) {
  .similar-cards__row {
    grid-template-columns: none;
    grid-auto-flow: column;
    grid-auto-columns: minmax(250px, 82%);
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    padding-bottom: 6px;
  }

  .similar-card {
    scroll-snap-align: start;
  }
}

/* My Purse: quiz navigation and answers */
.stack-back {
  align-self: flex-start;
  min-height: 36px;
  margin: 0 0 4px -6px;
  padding: 0 10px;
  border: none;
  border-radius: var(--radius-full);
  background: none;
  color: var(--fg-muted);
  font: 600 13px var(--font);
  cursor: pointer;
}

.stack-back:hover {
  color: var(--primary);
  background: var(--primary-muted);
}

.stack-back[hidden] {
  display: none;
}

.stack-option.is-selected {
  border-color: var(--primary);
  background: var(--primary-muted);
  color: var(--primary-hover);
  box-shadow: 0 0 0 1px var(--primary);
}

.stack-option {
  min-height: 48px;
}

.stack-answers {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 16px;
}

.stack-answers[hidden] {
  display: none;
}

.stack-answers__label {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--fg-muted);
}

.answer-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 40px;
  max-width: 100%;
  padding: 0 14px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-full);
  background: var(--bg);
  font: 500 13px var(--font);
  color: var(--fg-muted);
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition);
}

.answer-chip strong {
  color: var(--fg);
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.answer-chip::after {
  content: "\270E";
  font-size: 12px;
  color: var(--primary);
}

.answer-chip:hover {
  border-color: var(--primary);
  background: var(--primary-muted);
}

.is-refining {
  opacity: 0.4;
  transition: opacity var(--transition-slow);
  pointer-events: none;
}

.pack-actions[hidden] {
  display: none;
}

.pack-actions {
  align-items: center;
}

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

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

.pack-actions button {
  min-height: 44px;
}

.pack-actions .text-btn {
  margin-left: auto;
  border: none;
  background: none;
  color: var(--fg-muted);
  text-decoration: underline;
}

.pack-actions .text-btn:hover {
  background: none;
  color: var(--bad);
  border: none;
}

@media (max-width: 640px) {
  .pack-actions .btn-primary {
    flex: 1 1 100%;
  }

  .pack-actions .text-btn {
    margin-left: 0;
  }
}

/* Compact header on phones: keep logo, profile chip and compare pill on one row */
@media (max-width: 560px) {
  .profile-chip__income,
  .profile-chip svg {
    display: none;
  }

  .nav-bar__inner {
    gap: 8px;
  }

  .nav-bar__inner .logo {
    gap: 8px;
  }

  .profile-chip {
    padding: 0 10px;
  }

  .compare-pill {
    padding-left: 12px;
    padding-right: 12px;
    white-space: nowrap;
  }

  .nav-bar__inner .logo {
    min-width: 0;
    flex: 1 1 auto;
  }

  .nav-actions {
    flex: none;
  }
}

/* ==========================================================================
   Items 6-10: nav badge, personas, how-we-calculated, apply sheet, profile
   share/export/import.
   ========================================================================== */

/* Nav badge on My Purse */
.nav-badge {
  display: inline-grid;
  place-items: center;
  min-width: 18px;
  height: 18px;
  margin-left: 6px;
  padding: 0 5px;
  border-radius: var(--radius-full);
  background: var(--primary);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
}

/* Quick-start personas */
.personas {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
}

.personas:empty {
  display: none;
}

.personas__label {
  margin-right: 4px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--fg-muted);
}

.persona-chip {
  min-height: 40px;
  padding: 0 16px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-full);
  background: var(--bg);
  color: var(--slate-800);
  font: 600 13px var(--font);
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition), transform var(--transition);
}

.persona-chip:hover {
  border-color: var(--primary);
  background: var(--primary-muted);
}

.persona-chip:active {
  transform: scale(0.97);
}

.persona-chip.is-active {
  border-color: var(--primary);
  background: var(--primary);
  color: #fff;
}

@media (max-width: 640px) {
  .personas {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 4px;
    margin-right: -16px;
    padding-right: 28px;
    scroll-snap-type: x proximity;
    -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 36px), transparent);
    mask-image: linear-gradient(to right, #000 calc(100% - 36px), transparent);
  }

  .personas__label,
  .persona-chip {
    flex: none;
    scroll-snap-align: start;
  }
}

/* How we calculated this */
.value-why {
  margin-top: 16px;
  border: 1px solid var(--indigo-100);
  border-radius: var(--radius-lg);
  background: var(--bg);
  overflow: hidden;
}

.value-why summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 44px;
  padding: 0 16px;
  font-weight: 700;
  font-size: 14px;
  color: var(--primary);
  background: var(--primary-muted);
  cursor: pointer;
  list-style: none;
}

.value-why summary::-webkit-details-marker {
  display: none;
}

.value-why summary::after {
  content: "";
  flex: none;
  width: 8px;
  height: 8px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg) translateY(-2px);
}

.value-why[open] summary::after {
  transform: rotate(225deg) translateY(-2px);
}

.value-why[open] summary {
  border-bottom: 1px solid var(--border);
}

.value-why__scroll {
  overflow-x: auto;
  padding: 4px 16px 0;
}

.value-why table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.value-why th,
.value-why td {
  padding: 8px 6px;
  text-align: right;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.value-why th:first-child,
.value-why thead th {
  color: var(--fg-muted);
  font-weight: 600;
}

.value-why th:first-child {
  text-align: left;
}

.value-why tbody th {
  color: var(--fg);
  font-weight: 500;
}

.value-why tfoot th {
  text-align: left;
  font-weight: 600;
  color: var(--fg);
}

.value-why .is-total th,
.value-why .is-total td {
  border-bottom: none;
  font-weight: 800;
  color: var(--good);
}

.value-why__notes {
  margin: 0;
  padding: 12px 16px 16px 34px;
  display: grid;
  gap: 4px;
  font-size: 12px;
  color: var(--fg-muted);
}

/* Apply sheet */
.apply-dialog__body {
  padding: 24px;
  display: grid;
  gap: 16px;
}

.apply-dialog__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 10px;
}

.apply-dialog__list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.apply-dialog__list div {
  display: grid;
  min-width: 0;
}

.apply-dialog__list strong {
  font-family: var(--font-display);
  font-size: 14px;
}

.apply-dialog__list span {
  font-size: 12px;
  color: var(--fg-muted);
}

.apply-dialog__go {
  flex: none;
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 18px;
  border-radius: var(--radius-full);
  text-decoration: none;
  white-space: nowrap;
}

.apply-dialog__go.is-done {
  background: var(--good-bg);
  color: var(--good);
  border: 1px solid var(--good-border);
}

.apply-dialog__none {
  flex: none;
}

/* Profile dialog: share / export / import */
.profile-dialog__share {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  padding-top: 4px;
  border-top: 1px solid var(--border);
}

.link-btn {
  min-height: 40px;
  padding: 0;
  border: none;
  background: none;
  color: var(--primary);
  font: 600 13px var(--font);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}

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


/* ==========================================================================
   Dark mode: follows the system setting, or the footer toggle (data-theme).
   The slate scale is inverted so components that use it adapt automatically.
   ========================================================================== */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --slate-50: #0b1220;
    --slate-100: #162033;
    --slate-200: #243049;
    --slate-300: #34425e;
    --slate-400: #64748b;
    --slate-500: #94a3b8;
    --slate-600: #a9b6ca;
    --slate-700: #cbd5e1;
    --slate-800: #e2e8f0;
    --slate-900: #f1f5f9;
    --slate-950: #ffffff;
    --indigo-50: #1b1f4a;
    --indigo-100: #272c66;
    --indigo-500: #818cf8;
    --indigo-600: #6366f1;
    --indigo-700: #818cf8;
    --emerald-50: #06281f;
    --emerald-500: #10b981;
    --emerald-600: #34d399;
    --rose-50: #3a0f1a;
    --rose-500: #f43f5e;
    --rose-600: #fb7185;
    --amber-50: #33240a;
    --amber-500: #fbbf24;
    --bg: #111a2d;
    --bg-elevated: #111a2d;
    --fg: #e8edf5;
    --fg-muted: #9fb0c7;
    --success-border: #0f5c45;
    --gradient-hero: linear-gradient(180deg, #111a2d 0%, #0b1220 100%);
    --good: #34d399;
    --good-bg: #06281f;
    --good-border: #0f5c45;
    --warn: #fbbf24;
    --warn-bg: #33240a;
    --warn-border: #6b4a10;
    --bad: #fb7185;
    --bad-bg: #3a0f1a;
    --bad-border: #7a2236;
    --hero-from: #0a0922;
    --hero-to: #2a2a86;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.5);
    --shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.55);
    --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.6);
  }

  :root:not([data-theme="light"]) .nav-bar { background: rgba(11, 18, 32, 0.85); border-bottom-color: var(--border); }
  :root:not([data-theme="light"]) .select-toggle { background: rgba(17, 26, 45, 0.95); color: var(--fg); }
  :root:not([data-theme="light"]) .card-visual { background: #1e293b; }
  :root:not([data-theme="light"]) .compare-tray__inner { background: #0b1220; border: 1px solid var(--border); }
  :root:not([data-theme="light"]) .compare-cta { color: #0f172a; }
  :root:not([data-theme="light"]) .data-cell.is-best { background: var(--emerald-50) !important; color: var(--emerald-600) !important; }
  :root:not([data-theme="light"]) .compare-net-row .data-cell.is-best { background: linear-gradient(180deg, var(--emerald-50) 0%, #0b3b2d 100%) !important; }
  :root:not([data-theme="light"]) .toast__action { color: #a5b4fc; }
  :root:not([data-theme="light"]) .top-pick:hover { box-shadow: 0 8px 24px rgba(0, 0, 0, 0.55); }
  :root:not([data-theme="light"]) .column-remove { background: rgba(2, 6, 23, 0.85); }
  :root:not([data-theme="light"]) .btn-hero--primary { color: #1e1b4b; }
  :root:not([data-theme="light"]) .card-skeleton { background: linear-gradient(100deg, #162033 30%, #1d2a42 50%, #162033 70%); background-size: 300% 100%; }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --slate-50: #0b1220;
  --slate-100: #162033;
  --slate-200: #243049;
  --slate-300: #34425e;
  --slate-400: #64748b;
  --slate-500: #94a3b8;
  --slate-600: #a9b6ca;
  --slate-700: #cbd5e1;
  --slate-800: #e2e8f0;
  --slate-900: #f1f5f9;
  --slate-950: #ffffff;
  --indigo-50: #1b1f4a;
  --indigo-100: #272c66;
  --indigo-500: #818cf8;
  --indigo-600: #6366f1;
  --indigo-700: #818cf8;
  --emerald-50: #06281f;
  --emerald-500: #10b981;
  --emerald-600: #34d399;
  --rose-50: #3a0f1a;
  --rose-500: #f43f5e;
  --rose-600: #fb7185;
  --amber-50: #33240a;
  --amber-500: #fbbf24;
  --bg: #111a2d;
  --bg-elevated: #111a2d;
  --fg: #e8edf5;
  --fg-muted: #9fb0c7;
  --success-border: #0f5c45;
  --gradient-hero: linear-gradient(180deg, #111a2d 0%, #0b1220 100%);
  --good: #34d399;
  --good-bg: #06281f;
  --good-border: #0f5c45;
  --warn: #fbbf24;
  --warn-bg: #33240a;
  --warn-border: #6b4a10;
  --bad: #fb7185;
  --bad-bg: #3a0f1a;
  --bad-border: #7a2236;
  --hero-from: #0a0922;
  --hero-to: #2a2a86;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.5);
  --shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.55);
  --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.6);
}

:root[data-theme="dark"] .nav-bar { background: rgba(11, 18, 32, 0.85); border-bottom-color: var(--border); }
:root[data-theme="dark"] .select-toggle { background: rgba(17, 26, 45, 0.95); color: var(--fg); }
:root[data-theme="dark"] .card-visual { background: #1e293b; }
:root[data-theme="dark"] .compare-tray__inner { background: #0b1220; border: 1px solid var(--border); }
:root[data-theme="dark"] .compare-cta { color: #0f172a; }
:root[data-theme="dark"] .data-cell.is-best { background: var(--emerald-50) !important; color: var(--emerald-600) !important; }
:root[data-theme="dark"] .compare-net-row .data-cell.is-best { background: linear-gradient(180deg, var(--emerald-50) 0%, #0b3b2d 100%) !important; }
:root[data-theme="dark"] .toast__action { color: #a5b4fc; }
:root[data-theme="dark"] .top-pick:hover { box-shadow: 0 8px 24px rgba(0, 0, 0, 0.55); }
:root[data-theme="dark"] .column-remove { background: rgba(2, 6, 23, 0.85); }
:root[data-theme="dark"] .btn-hero--primary { color: #1e1b4b; }
:root[data-theme="dark"] .card-skeleton { background: linear-gradient(100deg, #162033 30%, #1d2a42 50%, #162033 70%); background-size: 300% 100%; }

/* Theme toggle (footer) */
.theme-toggle {
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-full);
  background: var(--bg);
  color: var(--fg);
  font: 600 13px var(--font);
  cursor: pointer;
}

.theme-toggle:hover {
  border-color: var(--primary);
}

/* Skip link and state actions */
.skip-link {
  position: absolute;
  left: 12px;
  top: -60px;
  z-index: 1000;
  padding: 12px 18px;
  border-radius: var(--radius-full);
  background: var(--primary);
  color: #fff;
  font-weight: 700;
  text-decoration: none;
  transition: top 0.15s ease;
}

.skip-link:focus {
  top: 12px;
}

.state-action {
  margin-left: 12px;
  min-height: 40px;
  padding: 0 18px;
  border: 1px solid var(--primary);
  border-radius: var(--radius-full);
  background: var(--bg);
  color: var(--primary);
  font: 600 13px var(--font);
  cursor: pointer;
}

.state-action:hover {
  background: var(--primary-muted);
}

.data-pending {
  margin: 0 0 16px;
  padding: 12px 16px;
  border-radius: var(--radius-lg);
  background: var(--warn-bg);
  border: 1px solid var(--warn-border);
  color: var(--fg);
  font-size: 14px;
}

.card-value--pending {
  color: var(--slate-700);
  background: var(--slate-50);
  border-color: var(--slate-200);
}

.card-value--pending .card-value__amount {
  font-size: 16px;
}

.trust-panel__stale {
  margin: 0 0 12px;
  padding: 10px 14px;
  border-radius: var(--radius);
  background: var(--warn-bg);
  border: 1px solid var(--warn-border);
  color: var(--fg);
  font-size: 13px;
}

/* ==========================================================================
   Tidy pass: less text, fewer boxes, consistent alignment.
   ========================================================================== */

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Header: calmer compare pill */
.compare-pill:not(.is-empty) {
  box-shadow: none;
}

/* Inner-page headers are compact: a title and one short line */
.page-hero--compact .page-hero__inner {
  padding: 22px 28px 18px;
}

.page-hero--compact h1 {
  margin-bottom: 4px;
  font-size: clamp(1.5rem, 3vw, 1.9rem);
}

.page-hero--compact p {
  font-size: 15px;
}

/* ——— Home hero ——— */
.hero-v2__inner {
  padding: 44px 28px 48px;
  align-items: center;
}

.hero-v2__sub {
  margin-bottom: 24px;
  max-width: 40ch;
}

.hero-v2__steps {
  gap: 10px;
}

.hero-v2__steps li {
  padding: 12px 16px;
  gap: 12px;
}

.hero-v2__steps strong {
  font-size: 15px;
  font-weight: 700;
}

/* First-visit banner: one line */
.profile-banner {
  padding: 10px 12px 10px 18px;
  margin-bottom: 16px;
}

.profile-banner__text {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 10px;
}

.profile-banner__cta {
  min-height: 40px;
}

/* ——— Top picks ——— */
.top-picks {
  padding: 16px 18px 18px;
}

.top-picks__head {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 4px 12px;
  margin-bottom: 12px;
}

.top-picks__head h2 {
  margin: 0;
}

.top-picks__head span {
  font-size: 13px;
  color: var(--fg-muted);
}

/* ——— Cards: quieter, evenly aligned ——— */
.card-grid-item .card-body-link {
  padding: 16px 16px 16px;
  gap: 0;
}

.card-grid-item .card-visual {
  margin-bottom: 14px;
}

.card-chips {
  margin-bottom: 8px;
}

.card-title {
  margin: 0 0 2px;
}

.card-body-link .card-meta {
  margin: 0 0 14px;
  font-size: 13px;
}

.card-value {
  padding: 10px 14px;
}

.card-value__label--solo {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.4;
}

.card-value__amount {
  font-size: 22px;
}

.card-value--pending {
  padding: 10px 14px;
}

/* ——— Filters panel ——— */
.search-field,
.eligibility-filter {
  gap: 10px;
  padding-bottom: 14px;
  margin-bottom: 14px;
}

.eligibility-filter .link-btn {
  justify-self: start;
  min-height: 32px;
}

.goal-groups {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.goal-groups legend {
  width: 100%;
  margin-bottom: 8px;
}

.goal-chip {
  width: auto;
  padding: 8px 14px;
  border-radius: var(--radius-full);
}

/* ——— Compare ——— */
.compare-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px 14px;
  align-items: start;
  margin-bottom: 18px;
}

.compare-toolbar .profile-bar {
  margin-bottom: 0;
}

.compare-toolbar .compare-share-bar {
  display: flex;
  gap: 8px;
  margin: 0;
  padding: 0;
  background: none;
  border: none;
  box-shadow: none;
}

.compare-toolbar .compare-share-bar[hidden] {
  display: none;
}

.compare-toolbar .compare-share-bar button {
  min-height: 44px;
  padding: 0 16px;
  white-space: nowrap;
}

.compare-verdict {
  margin-bottom: 14px;
}

.column-head .card-visual {
  max-width: 128px;
  margin: 0 auto;
}

.column-head {
  text-align: center;
  padding: 16px 8px 14px;
}

.column-head h2 {
  margin: 12px 0 2px;
  font-size: 0.95rem;
}

.column-head .head-meta {
  margin: 0;
}

.column-head .head-badge {
  display: none;
}

.action-cell {
  padding: 14px 12px !important;
}

.action-cell .btn-primary,
.action-cell .btn-secondary {
  width: 100%;
  min-height: 40px;
  font-size: 13px;
  margin-bottom: 8px;
}

.compare-table-grid .label-col {
  font-size: 12px;
}

@media (min-width: 1000px) {
  /* Let the page scroll (not a nested scroll box) so the card header can stick */
  .compare-shell {
    overflow: visible;
  }

  .compare-scroll {
    overflow: visible;
    max-height: none;
  }

  .compare-table-grid thead th {
    top: var(--header-h);
  }
}

@media (max-width: 999px) {
  .compare-scroll {
    max-height: none;
  }
}

@media (max-width: 640px) {
  .compare-toolbar {
    grid-template-columns: 1fr;
  }
}

/* ——— Card page: two columns instead of a narrow centred stack ——— */
.page--card {
  max-width: var(--content-w);
  padding-top: 8px;
}

#card-details.glass-panel {
  background: none;
  border: none;
  box-shadow: none;
  overflow: visible;
  display: grid;
  grid-template-columns: minmax(300px, 380px) minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}

.card-detail-hero {
  position: sticky;
  top: calc(var(--header-h) + 16px);
  padding: 22px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-2xl);
  box-shadow: var(--shadow-sm);
}

.card-detail-hero .card-visual {
  max-width: none;
  margin-bottom: 18px;
}

.card-detail-hero h2 {
  font-size: 1.45rem;
  margin-bottom: 4px;
}

.card-detail-badges {
  margin-top: 12px;
}

.card-actions {
  flex-direction: column;
  align-items: stretch;
}

.card-actions .btn-primary,
.card-actions .btn-secondary,
.card-actions .btn-apply--large {
  width: 100%;
  justify-content: center;
  text-align: center;
}

.card-detail-body {
  padding: 0;
  background: none;
  display: grid;
  gap: 16px;
}

.card-detail-body > * {
  min-width: 0;
}

.card-detail-body .value-summary {
  margin: 0;
  padding: 20px;
}

.value-summary__head h3 {
  margin-bottom: 12px;
}

.card-detail-body .detail-grid {
  margin: 0;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
}

.detail-item {
  padding: 14px 16px;
}

.card-detail-body .detail-section,
.card-detail-body .trust-panel,
.card-detail-body .apply-block {
  margin: 0;
  padding: 18px 20px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
}

.card-detail-body .detail-section:last-of-type {
  padding-bottom: 18px;
}

@media (max-width: 900px) {
  #card-details.glass-panel {
    grid-template-columns: 1fr;
  }

  .card-detail-hero {
    position: static;
  }

  .card-actions {
    flex-direction: row;
    flex-wrap: wrap;
  }

  .card-actions .btn-primary,
  .card-actions .btn-secondary,
  .card-actions .btn-apply--large {
    width: auto;
    flex: 1 1 140px;
  }
}

/* ——— My Purse ——— */
.smart-stack {
  padding: 24px 28px;
  margin-bottom: 20px;
}

.stack-tool {
  margin-top: 0;
  padding: 0;
  border: none;
  background: none;
}

.stack-question {
  font-size: 1.3rem;
  margin-bottom: 18px;
}

.stack-progress:empty {
  display: none;
}

.stack-progress {
  margin-top: 18px;
  padding-top: 14px;
}

.purse-summary {
  padding: 16px 20px;
  margin-bottom: 14px;
}

.purse-summary[hidden],
#pack-list:empty {
  display: none !important;
}

.purse-summary strong {
  font-size: 18px;
}

@media (max-width: 640px) {
  .smart-stack {
    padding: 18px 16px;
  }

  .page-hero--compact .page-hero__inner {
    padding: 18px 16px 14px;
  }
}

.eligibility-filter .toggle-row {
  margin: 0;
  align-items: center;
  line-height: 1.3;
}

.eligibility-filter .toggle-row input {
  margin: 0;
  flex: none;
}

.action-cell .btn-apply--text,
.action-cell a.btn-apply--text {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  font-size: 13px;
  font-weight: 600;
  color: var(--primary);
}

.trust-panel__columns--single {
  grid-template-columns: 1fr;
}

.page--pack,
.page--compare {
  padding-top: 18px;
}

/* ——— Compare tray: slim on phones (thumbnails in a row, one button) ——— */
@media (max-width: 640px) {
  .compare-tray {
    padding: 8px 10px 10px;
  }

  .compare-tray__inner {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    padding: 10px;
    border-radius: var(--radius-xl);
  }

  .tray-slots {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
  }

  .tray-slot {
    position: relative;
    min-height: 0;
    aspect-ratio: 1.586 / 1;
    padding: 0;
    justify-content: center;
    overflow: visible;
  }

  .tray-slot.is-filled {
    background: none;
    border: none;
  }

  .tray-mini-wrap {
    width: 100%;
  }

  .tray-name {
    display: none;
  }

  .tray-remove {
    position: absolute;
    top: -8px;
    right: -8px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #fff;
    color: #0f172a;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
    font-size: 16px;
  }

  .compare-cta {
    min-height: 44px;
    justify-content: center;
  }
}

/* Tray fade follows the theme */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .compare-tray {
    background: linear-gradient(to top, rgba(11, 18, 32, 0.95) 60%, transparent);
  }
}

:root[data-theme="dark"] .compare-tray {
  background: linear-gradient(to top, rgba(11, 18, 32, 0.95) 60%, transparent);
}

@media (max-width: 640px) {
  .profile-banner {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "text close"
      "cta cta";
    align-items: center;
    gap: 8px 6px;
    padding: 10px 8px 10px 14px;
  }

  .profile-banner__text {
    grid-area: text;
    min-width: 0;
    font-size: 13px;
  }

  .profile-banner__text strong {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .profile-banner__text span {
    display: none;
  }

  .profile-banner__close {
    grid-area: close;
  }

  .profile-banner__cta {
    grid-area: cta;
    width: 100%;
    min-height: 40px;
    padding: 0 16px;
    font-size: 13px;
  }
}

/* Horizontal chip/card rows scroll without a heavy scrollbar */
.personas,
.top-picks__row,
.similar-cards__row {
  scrollbar-width: none;
}

.personas::-webkit-scrollbar,
.top-picks__row::-webkit-scrollbar,
.similar-cards__row::-webkit-scrollbar {
  display: none;
}

/* Compare table on phones: slim label column so the cards are visible at once */
@media (max-width: 640px) {
  .compare-table-grid {
    min-width: 520px;
  }

  .compare-table-grid .sticky-corner,
  .compare-table-grid .label-col {
    min-width: 76px !important;
    max-width: 76px;
    padding: 10px 8px !important;
    font-size: 11px;
    line-height: 1.3;
  }

  .compare-table-grid td,
  .compare-table-grid thead th {
    padding-left: 6px;
    padding-right: 6px;
  }

  .compare-table-grid .data-cell {
    font-size: 13px;
  }

  .column-head .card-visual {
    max-width: 96px;
  }

  .column-head h2 {
    font-size: 0.82rem;
  }

  .column-remove {
    width: 32px;
    height: 32px;
  }

  .action-cell {
    padding: 12px 6px !important;
  }

  .action-cell .btn-primary,
  .action-cell .btn-secondary {
    font-size: 12px;
    padding: 0 6px;
  }
}

@media (max-width: 640px) {
  .purse-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px 16px;
  }

  .purse-summary strong {
    font-size: 17px;
  }
}
