.page--home {
  padding-top: 20px;
  padding-bottom: 100px;
}

/* Compact home hero */
.hero-banner--compact .hero-banner__inner {
  padding: 20px 28px 22px;
}

.hero-banner--compact .page-hero__eyebrow {
  margin-bottom: 6px;
  font-size: 11px;
}

.hero-banner--compact h1 {
  margin-bottom: 8px;
  font-size: clamp(1.375rem, 2.5vw, 1.75rem);
  max-width: none;
}

.hero-banner--compact p {
  font-size: 14px;
  line-height: 1.5;
  max-width: 60ch;
}

.hero-banner--compact .hero-banner__meta {
  margin-top: 14px;
  gap: 8px;
}

.hero-banner--compact .hero-stat {
  padding: 5px 11px;
  font-size: 12px;
}

@media (min-width: 900px) {
  .hero-banner--compact .hero-banner__inner {
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-rows: auto auto auto;
    column-gap: 32px;
    align-items: center;
    padding: 18px 28px 20px;
  }

  .hero-banner--compact .page-hero__eyebrow {
    grid-column: 1;
    grid-row: 1;
  }

  .hero-banner--compact h1 {
    grid-column: 1;
    grid-row: 2;
  }

  .hero-banner--compact p {
    grid-column: 1;
    grid-row: 3;
  }

  .hero-banner--compact .hero-banner__meta {
    grid-column: 2;
    grid-row: 1 / -1;
    margin-top: 0;
    flex-direction: column;
    align-items: flex-end;
  }
}

.app-shell {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 28px;
  align-items: start;
}

.lhn {
  position: sticky;
  top: calc(var(--header-h) + 16px);
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - var(--header-h) - 32px);
  padding: 0;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.lhn__body {
  flex: 1;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 16px 16px 28px;
  scrollbar-width: thin;
  scrollbar-color: var(--slate-300) transparent;
}

.lhn__body::-webkit-scrollbar {
  width: 6px;
}

.lhn__body::-webkit-scrollbar-thumb {
  background: var(--slate-300);
  border-radius: var(--radius-full);
}

.lhn__body::-webkit-scrollbar-thumb:hover {
  background: var(--slate-400);
}

.content {
  min-width: 0;
}

.lhn-head {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  z-index: 1;
}

.lhn-head h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--fg);
}

#clear-filters {
  border: none;
  background: transparent;
  color: var(--fg-muted);
  font-family: var(--font);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  transition: all var(--transition);
}

#clear-filters:hover {
  color: var(--rose-600);
  background: var(--rose-50);
}

.goal-groups {
  margin: 0 0 24px;
  padding: 0;
  border: none;
}

.goal-groups legend {
  padding: 0;
  margin-bottom: 12px;
  font-size: 11px;
  font-weight: 700;
  color: var(--fg-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.goal-chip {
  display: flex;
  align-items: center;
  width: 100%;
  margin-bottom: 8px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-subtle);
  color: var(--fg-subtle);
  font-family: var(--font);
  font-size: 14px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: all var(--transition);
}

.goal-chip:hover {
  border-color: var(--border-strong);
  background: var(--bg);
  transform: translateX(2px);
}

.goal-chip.is-active {
  border-color: var(--primary);
  background: var(--primary-muted);
  color: var(--primary-hover);
  font-weight: 600;
  box-shadow: inset 0 0 0 1px rgba(79, 70, 229, 0.15);
}

.advanced-filters summary {
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: var(--fg);
  list-style: none;
  margin-bottom: 8px;
  padding: 8px 0;
}

.advanced-filters summary::-webkit-details-marker {
  display: none;
}

.advanced-filters[open] {
  padding-bottom: 8px;
}

.lhn label {
  display: block;
  margin: 16px 0 7px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--fg-muted);
}

.lhn select {
  width: 100%;
  height: 42px;
  padding: 0 36px 0 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font);
  font-size: 14px;
  font-weight: 500;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%2394a3b8'%3E%3Cpath d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.lhn select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--ring);
}

.content-toolbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 20px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}

.content-head {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  min-width: 0;
}

.sort-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.sort-bar__label {
  font-size: 12px;
  font-weight: 600;
  color: var(--fg-muted);
  white-space: nowrap;
}

.sort-bar__select {
  min-width: 168px;
  height: 40px;
  padding: 0 36px 0 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font);
  font-size: 13px;
  font-weight: 600;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%2394a3b8'%3E%3Cpath d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  cursor: pointer;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.sort-bar__select:hover {
  border-color: var(--border-strong);
}

.sort-bar__select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--ring);
}

.content-head h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--fg);
}

.result-badge,
#result-count {
  margin: 0;
  padding: 7px 14px;
  font-size: 13px;
  font-weight: 600;
  color: var(--fg-muted);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
}

.card-grid,
#card-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.card-grid-item {
  position: relative;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  overflow: hidden;
  transition: all var(--transition-slow);
}

.card-grid-item:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.card-grid-item.is-selected {
  border-color: var(--primary);
  box-shadow: 0 0 0 1px var(--primary), var(--shadow-md);
}

.card-grid-item.is-disabled {
  opacity: 0.4;
  pointer-events: none;
  filter: grayscale(0.3);
}

.card-body-link {
  display: block;
  padding: 18px;
  text-decoration: none;
  color: inherit;
}

.card-body-link .card-visual {
  margin-bottom: 16px;
}

.card-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}

.card-title {
  margin: 0 0 6px;
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.35;
  color: var(--fg);
}

.card-meta {
  margin: 0;
  font-size: 13px;
  color: var(--fg-muted);
}

.card-net-value {
  margin: 10px 0 0;
  padding-top: 10px;
  border-top: 1px dashed var(--border);
  font-size: 13px;
  font-weight: 700;
  color: var(--emerald-600);
}

.card-net-value.is-negative {
  color: var(--danger);
  cursor: help;
}

.card-grid-actions {
  display: flex;
  justify-content: flex-end;
  padding: 0 18px 14px;
}

.select-toggle {
  position: absolute;
  top: 26px;
  right: 26px;
  z-index: 5;
  width: 34px;
  height: 34px;
  border: none;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.95);
  color: var(--fg-muted);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  box-shadow: var(--shadow);
  backdrop-filter: blur(8px);
  display: grid;
  place-items: center;
  transition: all var(--transition);
}

.select-toggle:hover {
  transform: scale(1.08);
  color: var(--primary);
}

.card-grid-item.is-selected .select-toggle {
  background: var(--gradient-brand);
  color: #fff;
}

.select-toggle:disabled {
  cursor: not-allowed;
  opacity: 0.4;
}

/* Compare tray */
.compare-tray {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 90;
  padding: 20px 24px 24px;
  pointer-events: none;
  background: linear-gradient(to top, rgba(248, 250, 252, 0.95) 60%, transparent);
}

.compare-tray__inner {
  max-width: 760px;
  margin: 0 auto;
  padding: 14px 14px 14px 18px;
  background: var(--slate-900);
  color: #fff;
  border-radius: var(--radius-2xl);
  box-shadow: var(--shadow-lg), 0 0 0 1px rgba(255, 255, 255, 0.06);
  display: flex;
  align-items: center;
  gap: 16px;
  pointer-events: auto;
}

.tray-slots {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  min-width: 0;
}

.tray-slot {
  min-height: 56px;
  padding: 10px;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.06);
  border: 1px dashed rgba(255, 255, 255, 0.15);
  display: flex;
  align-items: center;
  gap: 10px;
}

.tray-slot.is-filled {
  background: rgba(255, 255, 255, 0.1);
  border-style: solid;
  border-color: rgba(255, 255, 255, 0.12);
}

.tray-mini-wrap {
  width: 52px;
  flex-shrink: 0;
}

.tray-mini-wrap .card-visual {
  border-radius: 6px;
  min-height: 0;
  box-shadow: none;
}

.tray-name {
  margin: 0;
  flex: 1;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.35;
  color: rgba(255, 255, 255, 0.92);
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.tray-remove {
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  border: none;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.7);
  font-size: 16px;
  cursor: pointer;
  line-height: 1;
  transition: all var(--transition);
}

.tray-remove:hover {
  background: var(--rose-600);
  color: #fff;
}

.compare-tray__cta,
.compare-cta {
  flex-shrink: 0;
  text-decoration: none;
  padding: 13px 22px;
  border-radius: var(--radius-full);
  background: #fff;
  color: var(--slate-900);
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
  transition: all var(--transition);
}

.compare-tray__cta:hover:not(.is-disabled),
.compare-cta:hover:not(.is-disabled) {
  transform: scale(1.02);
  box-shadow: var(--shadow-md);
}

.compare-tray__cta.is-disabled,
.compare-cta.is-disabled {
  opacity: 0.35;
  pointer-events: none;
}

@media (max-width: 960px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .lhn {
    position: static;
    max-height: none;
  }

  .lhn__body {
    max-height: 240px;
  }

  .content-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .sort-bar {
    justify-content: space-between;
  }

  .sort-bar__select {
    flex: 1;
    max-width: 240px;
  }

  .card-grid,
  #card-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .hero-banner--compact .hero-banner__inner {
    padding: 16px 20px 18px;
  }

  .card-grid,
  #card-list {
    grid-template-columns: 1fr;
  }

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

  .tray-slots {
    grid-template-columns: 1fr;
  }
}

.search-field,
.eligibility-filter {
  display: grid;
  gap: 6px;
  padding: 0 0 16px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.search-field label,
.eligibility-filter > label:first-child {
  font-size: 12px;
  font-weight: 600;
  color: var(--fg-muted);
}

.search-field input,
.eligibility-filter input[type="number"] {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font: inherit;
  background: var(--bg);
  color: var(--fg);
}

.toggle-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--fg);
}

.load-more-wrap {
  display: flex;
  justify-content: center;
  padding: 24px 0 8px;
}
