@media (max-width: 1320px) {
  .tabs,
  .tabs--wide {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 1080px) {
  .hero-layout {
    grid-template-columns: 1fr;
  }

  .tab-groups {
    display: grid;
  }

  .tab-group {
    display: block;
    min-width: 0;
  }

  .tab-group--article {
    margin-left: 0;
  }

  .tab-group--article::before {
    display: none;
  }

  .tab-panel {
    min-height: auto;
  }

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

  .overview-board {
    margin-inline: -16px;
    padding: 18px 16px;
  }

  .overview-board__header {
    align-items: stretch;
    flex-direction: column;
  }
}

@media (max-width: 760px) {
  .shell {
    width: auto;
    max-width: 1180px;
    margin: 0 10px;
    padding: 18px 0 28px;
  }

  .hero-topline {
    flex-direction: column;
    align-items: flex-start;
  }

  .hero-actions {
    width: 100%;
    flex-wrap: wrap;
    justify-content: space-between;
  }

  .hero-actions > * {
    flex: 1 1 180px;
  }

  #page-title {
    white-space: normal;
    line-height: 1.02;
  }

  .tab-groups {
    gap: 10px;
  }

  .tab-group {
    width: 100%;
    flex: none;
    display: block;
    z-index: 1;
  }

  .tab-group--article {
    min-width: 0;
  }

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

  .tabs--wide {
    grid-template-columns: 1fr;
  }

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

  .field-row--birth {
    grid-template-columns: 1fr;
  }

  .tab-group__trigger {
    height: auto;
    min-height: auto;
  }

  .tab-group__trigger span {
    font-size: 0.82rem;
    line-height: 1.35;
  }

  .tab-group__menu {
    position: static;
    margin-top: 0;
    padding: 0 10px;
    border-color: transparent;
    box-shadow: none;
    opacity: 0;
    visibility: hidden;
    max-height: 0;
    overflow: hidden;
    transform: none;
    pointer-events: none;
  }

  .tab-group__menu--compact {
    left: auto;
    right: auto;
    width: 100%;
  }

  .tab-group.is-open .tab-group__menu,
  .tab-group:focus-within .tab-group__menu {
    margin-top: 8px;
    padding: 10px;
    border-color: var(--line);
    opacity: 1;
    visibility: visible;
    max-height: 520px;
    pointer-events: auto;
  }

  .tab-group.is-locked-closed .tab-group__menu,
  .tab-group.is-locked-closed:focus-within .tab-group__menu {
    margin-top: 0;
    padding-top: 0;
    padding-bottom: 0;
    border-color: transparent;
    opacity: 0;
    visibility: hidden;
    max-height: 0;
    pointer-events: none;
  }

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

  .metric-card strong {
    font-size: 1.14rem;
  }

  .comparison-grid__head {
    display: none;
  }

  .comparison-grid__row {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .comparison-grid__cell {
    padding-top: 2px;
  }

  .comparison-grid__mobile-head {
    display: block;
  }

  .card-head {
    display: block;
  }

  .card-head h3 {
    margin-bottom: 4px;
  }

  .card-head span,
  .card-head__value-group small {
    display: block;
    line-height: 1.35;
    overflow-wrap: anywhere;
  }

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

  .results > .card,
  .results > .hero-card {
    grid-column: auto;
  }

  .card--pie {
    grid-template-columns: 1fr;
  }

  .card--pie .legend {
    margin-top: 12px;
  }

  .legend {
    display: grid;
    gap: 8px;
  }

  .legend span {
    font-size: 0.86rem;
  }

  .line-chart__text,
  .bar-chart__text {
    font-size: 11px;
  }

  .chart-readout {
    font-size: 0.88rem;
    gap: 6px;
  }

  .chart-readout strong {
    line-height: 1.35;
  }

  .calculator,
  .card,
  .hero-card {
    padding: 18px;
  }

  .doc-button {
    position: static;
    margin-bottom: 12px;
    justify-self: start;
    color: var(--text);
    border-color: rgba(23, 33, 32, 0.12);
    background: var(--surface);
    backdrop-filter: none;
  }

  .doc-overlay__panel {
    width: calc(100vw - 16px);
    height: calc(100dvh - 16px);
    margin: 8px auto;
  }

  .doc-overlay__header {
    min-height: 56px;
    padding: 10px 170px 10px 16px;
  }

  .history-table--inflation th,
  .history-table--inflation td {
    width: auto;
  }

  .history-table--inflation thead {
    display: none;
  }

  .history-table--inflation tbody {
    display: grid;
    gap: 10px;
  }

  .history-table--inflation tr {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0;
    border: 1px solid var(--line);
    border-radius: 14px;
    overflow: hidden;
    background: var(--surface-strong);
  }

  .history-table--inflation td {
    border-bottom: 1px solid var(--line);
  }

  .history-table--inflation tr td:nth-last-child(-n + 2) {
    border-bottom: 0;
  }
}

@media (max-width: 560px) {
  .overview-board {
    margin-inline: -10px;
    padding-inline: 10px;
  }

  .overview-group {
    padding: 10px 10px 12px;
  }

  .overview-card {
    min-height: 84px;
    padding: 11px 12px;
  }

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

@media (max-width: 430px) {
  .shell {
    margin: 0 8px;
    padding: 16px 0 24px;
  }

  .hero {
    margin-bottom: 16px;
  }

  .hero-actions {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  .hero-actions > * {
    flex: none;
    width: 100%;
  }

  #page-title {
    font-size: clamp(2rem, 11vw, 2.55rem);
    line-height: 0.98;
    margin-bottom: 10px;
  }

  .hero-topline .eyebrow,
  .overview-board .eyebrow {
    font-size: 0.76rem;
    letter-spacing: 0.1em;
  }

  .lead,
  .lead--secondary,
  .hero-warning p,
  .overview-board__header p:last-child {
    font-size: 0.95rem;
    line-height: 1.45;
  }

  .hero-warning {
    padding: 16px;
    border-radius: 16px;
  }

  .site-footer__copy,
  .site-footer__nav a {
    font-size: 0.88rem;
  }

  .overview-board__header {
    margin-bottom: 14px;
  }

  .overview-filter {
    gap: 6px;
    font-size: 0.8rem;
  }

  .overview-filter input {
    min-height: 42px;
    padding-inline: 12px;
  }

  .overview-groups {
    gap: 14px;
  }

  .overview-group {
    gap: 8px;
  }

  .overview-group__head strong {
    font-size: 1.04rem;
  }

  .overview-card {
    min-height: 96px;
    padding: 14px 16px;
    border-radius: 16px;
  }

  .overview-card strong {
    font-size: 0.92rem;
    line-height: 1.28;
  }

  .overview-card span {
    font-size: 0.82rem;
    line-height: 1.38;
  }
}

@media (max-width: 560px) {
  .history-table {
    font-size: 0.82rem;
    min-width: 560px;
  }

  .history-table th,
  .history-table td {
    padding: 6px 8px;
  }

  .doc-overlay__header {
    gap: 10px;
  }

  .doc-overlay__actions {
    right: 16px;
    gap: 8px;
  }

  .doc-overlay__open-link,
  .doc-overlay__close {
    min-height: 40px;
    padding: 0 12px;
  }

}
