/* Self-hosted latin subsets (from Google Fonts), both variable: Fraunces (opsz 9..144, wght 500..800) and IBM Plex Sans (wght 400..700) */
@font-face {
  font-family: "Fraunces";
  font-style: normal;
  font-weight: 500 800;
  font-display: swap;
  src: url("fonts/fraunces-500-800-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "IBM Plex Sans";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("fonts/ibm-plex-sans-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* Editorial Bold (shared with Priminfo Pro): warm paper page, black primary, Swiss red only as an accent */
:root {
  --bg-page: #f4efe6;
  --bg-surface: #fffdf9;
  --bg-subtle: #efe8db;
  --bg-hover: #f7f1e6;
  --text-primary: #1c1917;
  --text-secondary: #57534e;
  --text-muted: #6b645e;
  --border-hairline: #e3dccf;
  --border-card: #d6cdbd;
  --border-input: #c9bfae;
  --border-strong: #1c1917;
  --swiss-red: #c1121f;
  --swiss-red-soft: #fbeae7;
  --green-good: #2f6b3a;
  --green-bg: #e8f1e5;
  --green-cell: #dfe9d8;
  --green-cell-text: #1f4a28;
  --amber-warn: #9a5b0b;
  --amber-bg: #f8eedb;
  --red-bad: #9f1239;
  --red-bg: #f9e3e6;
  --radius-sm: 2px;
  --radius-md: 3px;
  --serif: "Fraunces", "Songti SC", "Noto Serif SC", Georgia, serif;
  --sans: "IBM Plex Sans", "PingFang SC", "Noto Sans SC", sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--sans);
  background-color: var(--bg-page);
  color: var(--text-primary);
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  min-block-size: 100vh;
  display: flex;
  flex-direction: column;
}

button,
input,
select {
  font-family: inherit;
}

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

.hidden {
  display: none !important;
}

.text-green { color: var(--green-good) !important; }
.text-accent { color: var(--swiss-red) !important; }

.swiss-header {
  background: var(--bg-page);
  border-bottom: 2px solid var(--border-strong);
  position: sticky;
  inset-block-start: 0;
  z-index: 40;
}

.header-top {
  max-inline-size: 1360px;
  margin-inline: auto;
  padding: 0.7rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  border-bottom: 1px solid var(--border-card);
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-inline-size: 0;
}

.swiss-cross {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  background: var(--swiss-red);
  color: #fff;
  font-size: 1rem;
  font-weight: 800;
}

.brand-titles {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  flex-wrap: wrap;
  min-inline-size: 0;
}

.brand h1 {
  font-family: var(--serif);
  font-size: 1.3rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.brand-meta {
  font-size: 0.75rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.status-pill {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.18rem 0.55rem;
  border-radius: 999px;
  border: 1px solid var(--green-good);
  background: transparent;
  color: var(--green-good);
  white-space: nowrap;
  flex-shrink: 0;
}

.status-pill.loading {
  border-color: var(--amber-warn);
  color: var(--amber-warn);
}

.status-pill.error {
  border-color: var(--red-bad);
  color: var(--red-bad);
}

.btn-about {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.18rem 0.6rem 0.18rem 0.3rem;
  font-size: 0.74rem;
  font-weight: 700;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: transparent;
  color: var(--text-primary);
  cursor: pointer;
  white-space: nowrap;
}

.btn-about:hover {
  background: var(--text-primary);
  color: var(--bg-surface);
}

.about-i {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--text-primary);
  color: var(--bg-surface);
  font-family: var(--serif);
  font-style: italic;
  font-size: 0.72rem;
  line-height: 1;
}

.btn-about:hover .about-i {
  background: var(--bg-surface);
  color: var(--text-primary);
}

.lang-switch {
  display: inline-flex;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  overflow: hidden;
  flex-shrink: 0;
}

.lang-btn {
  border: none;
  background: transparent;
  padding: 0.24rem 0.55rem;
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--text-secondary);
  cursor: pointer;
  white-space: nowrap;
}

.lang-btn.active {
  background: var(--swiss-red);
  color: #fff;
}

.profile-bar {
  max-inline-size: 1360px;
  margin-inline: auto;
  padding: 0.6rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  border-bottom: 1px solid var(--border-card);
}

.profile-bar.is-collapsed .tax-form {
  display: none;
}

.profile-chips-row {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.bar-label {
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-inline-end: 0.15rem;
}

.profile-chips {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.p-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.2rem 0.6rem;
  font-size: 0.76rem;
  font-weight: 600;
  border: 1px solid var(--border-input);
  border-radius: 999px;
  background: var(--bg-surface);
  color: var(--text-primary);
  cursor: pointer;
  transition: border-color 0.15s;
}

.p-chip.active {
  border-color: var(--text-primary);
  background: var(--text-primary);
  color: var(--bg-surface);
}

.p-chip-del {
  border: none;
  background: transparent;
  color: inherit;
  opacity: 0.7;
  font-size: 0.74rem;
  cursor: pointer;
  padding-inline: 2px;
}

.p-chip-del:hover {
  opacity: 1;
}

.btn-chip-action {
  padding: 0.2rem 0.65rem;
  font-size: 0.75rem;
  font-weight: 700;
  border: 1px dashed var(--text-primary);
  border-radius: 999px;
  background: transparent;
  color: var(--text-primary);
  cursor: pointer;
}

.btn-chip-action:hover {
  border-style: solid;
  background: var(--bg-subtle);
}

.btn-mobile-collapse {
  display: none;
  margin-inline-start: auto;
  padding: 0.2rem 0.55rem;
  font-size: 0.73rem;
  font-weight: 700;
  border: 1px solid var(--border-input);
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  color: var(--text-secondary);
  cursor: pointer;
}

@media (max-width: 768px) {
  .header-top {
    padding: 0.55rem 0.85rem;
  }
  .brand {
    gap: 0.5rem;
  }
  .swiss-cross {
    width: 24px;
    height: 24px;
    font-size: 0.9rem;
  }
  .brand h1 {
    font-size: 0.95rem;
  }
  .brand-meta {
    display: none;
  }
  .header-actions {
    gap: 0.4rem;
  }
  .status-pill {
    font-size: 0.68rem;
    padding: 0.15rem 0.45rem;
  }
  .btn-about {
    padding: 0.18rem;
  }
  .about-label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
  }
  .about-i {
    width: 18px;
    height: 18px;
  }
  .lang-btn {
    padding: 0.24rem 0.38rem;
  }
  .profile-bar {
    padding: 0.5rem 0.85rem;
  }
  .btn-mobile-collapse {
    display: inline-flex;
    align-items: center;
  }
}

/* Phones: open inputs fill most of the screen, so the header scrolls away with the page; once they are
   collapsed it sticks, with a shadow over the content scrolling beneath */
@media (max-width: 768px) {
  .swiss-header:has(.profile-bar:not(.is-collapsed)) {
    position: static;
  }
  .swiss-header:has(.profile-bar.is-collapsed) {
    box-shadow: 0 8px 20px rgba(28, 25, 23, 0.14);
  }
}

/* Phones: the status badge shrinks to a dot in its colour; the text stays in the DOM for screen readers.
   The title wraps rather than run under the buttons on the narrowest screens. */
@media (max-width: 640px) {
  .brand h1 {
    white-space: normal;
  }
  .status-pill {
    inline-size: 0.6rem;
    block-size: 0.6rem;
    padding: 0;
    border-radius: 50%;
    background: currentColor;
    overflow: hidden;
    text-indent: 100%;
  }
}

/* 360px phones: keep the title on one line */
@media (max-width: 380px) {
  .brand h1 {
    font-size: 0.88rem;
  }
}

.pf-field {
  display: flex;
  flex-direction: column;
  gap: 0.22rem;
}

.pf-field > label {
  font-size: 0.71rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

input[type="text"],
input[type="number"],
input[type="search"],
select {
  width: 100%;
  height: 32px;
  padding: 0 0.55rem;
  font-size: 0.83rem;
  border: 1px solid var(--border-input);
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  color: var(--text-primary);
}

input:focus,
select:focus {
  outline: none;
  border-color: var(--text-primary);
  box-shadow: 0 0 0 2px var(--border-hairline);
}

/* Validation styling following validate-input-after-interaction (:user-invalid) */
input:user-invalid,
input.is-invalid {
  border-color: var(--red-bad) !important;
  background-color: var(--red-bg) !important;
}

.field-error-msg {
  display: none;
  color: var(--red-bad);
  font-size: 0.72rem;
  font-weight: 600;
  margin-block-start: 0.15rem;
}

.pf-field:has(input:user-invalid) .field-error-msg,
.field-error-msg.visible {
  display: block;
}

.autocomplete-wrap {
  position: relative;
}

.dropdown-list {
  position: absolute;
  inset-block-start: calc(100% + 2px);
  inset-inline: 0;
  background: var(--bg-surface);
  border: 1px solid var(--text-primary);
  border-radius: var(--radius-sm);
  max-block-size: 250px;
  overflow-y: auto;
  z-index: 60;
  list-style: none;
  box-shadow: 0 8px 20px rgba(28, 25, 23, 0.14);
}

.dropdown-list li {
  padding: 0.45rem 0.65rem;
  font-size: 0.82rem;
  cursor: pointer;
  border-bottom: 1px solid var(--border-hairline);
}

.dropdown-list li:hover,
.dropdown-list li.kb-active {
  background: var(--bg-subtle);
  color: var(--text-primary);
  font-weight: 600;
}

.dropdown-list li.no-match,
.dropdown-list li.match-meta {
  color: var(--text-muted);
  font-size: 0.75rem;
  cursor: default;
  background: var(--bg-subtle);
}

.seg-mini {
  display: inline-flex;
  height: 32px;
  border: 1px solid var(--border-input);
  border-radius: var(--radius-sm);
  background: var(--bg-subtle);
  padding: 2px;
}

.seg-mini label {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.seg-mini input {
  display: none;
}

.seg-mini span {
  padding: 0 0.55rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
  border-radius: 2px;
  line-height: 26px;
  white-space: nowrap;
}

.seg-mini input:checked + span {
  background: var(--text-primary);
  color: var(--bg-surface);
}

.primary-nav {
  max-inline-size: 1360px;
  margin-inline: auto;
  padding-inline: 1.5rem;
}

.nav-tabs {
  display: flex;
  list-style: none;
  gap: 1.6rem;
  position: relative;
  overflow-x: auto;
  scrollbar-width: none;
}

.nav-tabs::-webkit-scrollbar {
  display: none;
}

.nav-tabs::before {
  content: '';
  position: absolute;
  position-anchor: --active-tab;
  inset-block-end: 0;
  inset-inline-start: anchor(left);
  inset-inline-end: anchor(right);
  block-size: 3px;
  background: var(--text-primary);
  @media (prefers-reduced-motion: no-preference) {
    transition: inset 0.2s ease;
  }
}

.nav-tabs li.active {
  anchor-name: --active-tab;
  @supports not (position-anchor: auto) {
    border-bottom: 3px solid var(--text-primary);
  }
}

.nav-tabs button {
  border: none;
  background: transparent;
  padding: 0.7rem 0.15rem;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  display: inline-flex;
  align-items: baseline;
  gap: 0.35rem;
  white-space: nowrap;
}

.nav-tabs li.active button {
  color: var(--text-primary);
}

.tab-num {
  font-family: var(--serif);
  font-style: italic;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--swiss-red);
  font-variant-numeric: tabular-nums;
}

@media (max-width: 640px) {
  .primary-nav {
    padding-inline: 0.65rem;
  }
  .nav-tabs {
    gap: 0.45rem;
    justify-content: space-between;
    padding-inline-end: 1.75rem;
    -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 1.75rem), transparent);
    mask-image: linear-gradient(to right, #000 calc(100% - 1.75rem), transparent);
  }
  .nav-tabs button {
    padding: 0.58rem 0.1rem;
    font-size: 0.78rem;
    gap: 0.18rem;
  }
  .tab-num {
    font-size: 0.64rem;
  }
}

.swiss-main {
  max-inline-size: 1360px;
  width: 100%;
  margin-inline: auto;
  padding: 1.25rem 1.5rem 3rem;
  flex: 1;
}

@media (max-width: 640px) {
  .swiss-main {
    padding: 0.85rem 0.75rem 2rem;
  }
}

.view-section {
  content-visibility: auto;
  contain-intrinsic-size: auto 1200px auto 680px;
}

@supports not (content-visibility: auto) {
  .view-section {
    contain: layout style paint;
  }
}

.saved-comparison-box {
  background: var(--bg-surface);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-md);
  padding: 0.95rem 1.15rem;
  margin-block-end: 1.1rem;
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-block-end: 0.65rem;
}

.section-head h2 {
  font-family: var(--serif);
  font-size: 1.2rem;
  font-weight: 700;
}

.section-note {
  font-size: 0.76rem;
  color: var(--text-muted);
}

.saved-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 0.65rem;
}

.saved-card {
  border: 1px solid var(--border-card);
  border-radius: var(--radius-sm);
  padding: 0.7rem 0.85rem;
  background: var(--bg-surface);
  display: flex;
  flex-direction: column;
  gap: 0.22rem;
  cursor: pointer;
  transition: border-color 0.15s;
}

/* 2px black frame drawn with an inset shadow so the card does not shift */
.saved-card.active {
  border-color: var(--text-primary);
  box-shadow: inset 0 0 0 1px var(--text-primary);
}

.saved-card-head {
  display: flex;
  justify-content: space-between;
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--text-secondary);
}

.saved-card-price {
  font-family: var(--serif);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
  font-variant-numeric: lining-nums tabular-nums;
}

.saved-card-sub {
  font-size: 0.74rem;
  color: var(--green-good);
  font-weight: 600;
}

/* KPI: editorial table — 3px rule above, 1px rule below, no card */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border-top: 3px solid var(--text-primary);
  border-bottom: 1px solid var(--text-primary);
  margin-block-end: 1.4rem;
}

.kpi-cell {
  padding: 1.1rem 1.25rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  border-right: 1px solid var(--border-card);
  min-inline-size: 0;
}

.kpi-cell:last-child {
  border-right: none;
}

.kpi-label {
  font-size: 0.66rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-muted);
}

.kpi-num {
  font-family: var(--serif);
  font-size: 2.6rem;
  font-weight: 700;
  letter-spacing: -0.035em;
  line-height: 1;
  font-variant-numeric: lining-nums tabular-nums;
  white-space: nowrap;
}

.kpi-meta {
  font-size: 0.74rem;
  color: var(--text-secondary);
}

@media (max-width: 860px) {
  .kpi-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .kpi-cell:nth-child(even) {
    border-right: none;
  }
  .kpi-cell:nth-child(-n+2) {
    border-bottom: 1px solid var(--border-card);
  }
}

@media (max-width: 640px) {
  .kpi-cell {
    padding: 0.9rem 0.75rem 1rem;
    border-right: none;
  }
  .kpi-num {
    font-size: 1.6rem;
    letter-spacing: -0.025em;
  }
}

.toolbar-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-block-end: 0.8rem;
}

.search-wrap {
  flex: 1;
  min-inline-size: 220px;
  max-inline-size: 380px;
}

.toolbar-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.toolbar-right select {
  width: auto;
}

.btn-export-csv {
  height: 32px;
  padding: 0 0.8rem;
  font-size: 0.75rem;
  font-weight: 700;
  border: 1px solid var(--border-input);
  border-radius: 999px;
  background: var(--bg-surface);
  color: var(--text-primary);
  cursor: pointer;
}

.btn-export-csv:hover {
  border-color: var(--text-primary);
}

.table-wrapper {
  overflow: auto;
  max-inline-size: 100%;
  max-block-size: min(680px, 78vh);
  container-type: inline-size;
  background: var(--bg-surface);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-md);
}

table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.83rem;
}

thead {
  position: sticky;
  inset-block-start: 0;
  z-index: 3;
  background: var(--bg-surface);
}

th,
td {
  padding: 0.58rem 0.8rem;
  text-align: left;
  border-bottom: 1px solid var(--border-hairline);
  white-space: nowrap;
}

thead th {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  background: var(--bg-surface);
  border-bottom: 2px solid var(--text-primary);
}

tbody th {
  position: sticky;
  inset-inline-start: 0;
  background: var(--bg-surface);
  z-index: 1;
  font-weight: 700;
  border-right: 1px solid var(--border-hairline);
}

tbody tr:hover td,
tbody tr:hover th {
  background-color: var(--bg-hover);
}

.num-col {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.highlight-col {
  background-color: var(--bg-subtle);
  font-weight: 700;
}

thead th.highlight-col {
  color: var(--text-primary);
}

.cat-tag {
  display: inline-block;
  font-size: 0.69rem;
  font-weight: 700;
  padding: 0.12rem 0.5rem;
  border-radius: 999px;
  cursor: pointer;
}

.load-more-bar {
  margin-block-start: 0.75rem;
  display: flex;
  justify-content: center;
}

.btn-load-more {
  padding: 0.5rem 1.35rem;
  font-size: 0.82rem;
  font-weight: 700;
  border: 1px solid var(--text-primary);
  border-radius: 999px;
  background: var(--bg-surface);
  color: var(--text-primary);
  cursor: pointer;
}

.btn-load-more:hover {
  background: var(--text-primary);
  color: var(--bg-surface);
}

@container (width < 640px) {
  table, thead, tbody, tr, th, td {
    display: block;
  }
  thead {
    display: none;
  }
  tr {
    margin-block-end: 0.65rem;
    border: 1px solid var(--border-card);
    border-radius: var(--radius-sm);
    overflow: hidden;
  }
  tbody th {
    position: sticky;
    inset-block-start: 0;
    z-index: 2;
    background: var(--bg-subtle);
    padding: 0.45rem 0.7rem;
    font-size: 0.86rem;
    border-right: none;
  }
  td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    text-align: right;
    padding: 0.35rem 0.7rem;
    font-size: 0.79rem;
  }
  td::before {
    content: attr(data-label);
    font-weight: 600;
    color: var(--text-secondary);
  }
}

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

.chart-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-md);
  padding: 1.15rem;
}

.history-chart-card {
  margin-block-end: 1rem;
}

.chart-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.85rem;
  flex-wrap: wrap;
  margin-block-end: 0.85rem;
}

.chart-header h2 {
  font-family: var(--serif);
  font-size: 1.2rem;
  font-weight: 700;
}

.chart-sub {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.chart-legend {
  display: flex;
  gap: 0.65rem;
  flex-wrap: wrap;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.74rem;
  font-weight: 700;
}

.legend-dot {
  width: 12px;
  height: 4px;
  border-radius: 2px;
}

.svg-chart-wrap {
  width: 100%;
  background: var(--bg-surface);
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-sm);
  padding: 0.45rem;
  margin-block-end: 0.9rem;
}

.guide-banner {
  background: var(--bg-surface);
  border: 1px solid var(--border-card);
  border-left: 4px solid var(--swiss-red);
  border-radius: var(--radius-md);
  padding: 1.2rem 1.4rem;
  margin-block-end: 1.15rem;
}

.guide-kicker {
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--swiss-red);
}

.guide-banner h2 {
  font-family: var(--serif);
  font-size: 1.3rem;
  font-weight: 700;
  margin-block: 0.25rem 0.45rem;
}

.guide-banner p {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.guide-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.95rem;
}

@media (max-width: 960px) {
  .guide-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

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

.guide-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-md);
  padding: 1.1rem 1.2rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.highlight-guide-card {
  background: var(--amber-bg);
  border-color: #e4cfa0;
}

.guide-card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.discount-tag {
  font-size: 0.73rem;
  font-weight: 800;
  color: var(--text-muted);
}

.guide-card h3 {
  font-family: var(--serif);
  font-size: 1.05rem;
  font-weight: 700;
}

.guide-card p,
.guide-list {
  font-size: 0.81rem;
  color: var(--text-secondary);
}

.guide-list {
  padding-inline-start: 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.24rem;
}

.swiss-footer {
  background: transparent;
  border-top: 2px solid var(--text-primary);
  padding: 1rem 1.5rem;
  margin-block-start: auto;
}

.footer-inner {
  max-inline-size: 1360px;
  margin-inline: auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  font-size: 0.76rem;
}

.footer-inner a {
  color: var(--swiss-red);
  font-weight: 700;
  text-decoration: none;
  margin-inline-start: 0.35rem;
}

.footer-muted {
  color: var(--text-muted);
  font-size: 0.72rem;
}

.about-dialog {
  margin: auto;
  border: 2px solid var(--text-primary);
  border-radius: var(--radius-md);
  padding: 0;
  inline-size: min(580px, calc(100vw - 2rem));
  max-block-size: calc(100dvh - 2rem);
  overflow: auto;
  background: var(--bg-surface);
  color: var(--text-primary);
}

.about-dialog::backdrop {
  background: rgba(28, 25, 23, 0.45);
}

.about-inner {
  padding: 1.3rem 1.5rem 1.4rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.about-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  padding-block-end: 0.7rem;
  border-bottom: 2px solid var(--text-primary);
}

.about-head h2 {
  font-family: var(--serif);
  font-size: 1.45rem;
  font-weight: 700;
  line-height: 1.2;
}

.about-close {
  border: none;
  background: transparent;
  font-size: 1.1rem;
  line-height: 1;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.1rem 0.2rem;
}

.about-close:hover {
  color: var(--text-primary);
}

.about-body {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.about-body h3 {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--swiss-red);
  margin-block-end: 0.2rem;
}

.about-body p {
  font-size: 0.85rem;
  line-height: 1.55;
  color: var(--text-secondary);
}

.about-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  padding-block-start: 0.85rem;
  border-top: 1px solid var(--border-card);
  font-size: 0.78rem;
}

.about-foot a {
  color: var(--swiss-red);
  font-weight: 700;
  text-decoration: none;
}

.toast-container {
  position: fixed;
  inset-block-end: 1.25rem;
  inset-inline-end: 1.25rem;
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  pointer-events: none;
}

.toast-item {
  background: var(--text-primary);
  color: var(--bg-surface);
  padding: 0.55rem 0.9rem;
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
  font-weight: 600;
  box-shadow: 0 6px 16px rgba(28, 25, 23, 0.22);
  border-left: 3px solid var(--swiss-red);
}

/* ---- Tax form: one household row, one row per person ---- */
.tax-form {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.form-row {
  display: grid;
  gap: 0.7rem;
  align-items: start;
}

.form-row-household {
  grid-template-columns: 1.6fr 0.7fr 1.1fr 0.9fr 1fr 1.3fr;
}

.form-row-person {
  grid-template-columns: 70px 1.3fr 1.2fr 0.8fr 1fr;
  padding: 0.45rem 0.6rem;
  border: 1px dashed var(--border-card);
  border-radius: var(--radius-md);
  background: rgba(255, 253, 249, 0.6);
}

.person-kicker {
  align-self: center;
  font-family: var(--serif);
  font-style: italic;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--swiss-red);
  white-space: nowrap;
}

.tax-form:not(.is-couple) .couple-only { display: none; }
.tax-form.mode-taxable .gross-only { display: none; }
.tax-form.mode-gross .taxable-only { display: none; }
.tax-form.mode-taxable .form-row-person { grid-template-columns: 70px 1.6fr 1fr 1fr; }

.input-chf {
  display: flex;
  align-items: center;
  height: 32px;
  border: 1px solid var(--border-input);
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
}

.input-chf:focus-within {
  border-color: var(--text-primary);
  box-shadow: 0 0 0 2px var(--border-hairline);
}

.input-chf .chf-prefix {
  padding: 0 0.45rem;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text-muted);
  border-right: 1px solid var(--border-hairline);
  line-height: 30px;
}

.input-chf input {
  border: none;
  height: 30px;
  background: transparent;
  min-inline-size: 0;
}

.input-chf input:focus {
  box-shadow: none;
}

@media (max-width: 1100px) {
  .form-row-household {
    grid-template-columns: repeat(3, 1fr);
  }
  .form-row-person,
  .tax-form.mode-taxable .form-row-person {
    grid-template-columns: repeat(2, 1fr);
  }
  .person-kicker {
    grid-column: 1 / -1;
    align-self: start;
  }
}

@media (max-width: 640px) {
  .form-row-household {
    grid-template-columns: repeat(2, 1fr);
  }
  .pf-loc,
  .pf-mode {
    grid-column: 1 / -1;
  }
}

/* ---- Overview ---- */
.overview-layout {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 1.2rem;
  align-items: start;
}

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

.breakdown-bar {
  display: flex;
  height: 26px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--border-card);
  margin-block-end: 0.55rem;
}

.breakdown-seg {
  min-inline-size: 0;
  transition: width 0.25s ease;
}

.breakdown-seg[data-share]:hover {
  opacity: 0.85;
}

.chart-legend {
  margin-block-end: 0.85rem;
}

.legend-swatch {
  width: 12px;
  height: 12px;
  border-radius: 2px;
}

/* Flat tables sit inside a card: no frame, and no card-per-row layout even in a narrow column */
.table-wrapper-flat {
  border: none;
  border-radius: 0;
  background: transparent;
  max-block-size: none;
  container-type: normal;
}

.table-wrapper-flat th,
.table-wrapper-flat td {
  padding: 0.5rem 0.55rem;
}

.table-wrapper-flat thead th {
  background: transparent;
}

.table-wrapper-flat tbody th {
  background: transparent;
  border-right: none;
  position: static;
}

tr.row-total th,
tr.row-total td {
  border-top: 2px solid var(--text-primary);
  border-bottom: none;
  font-weight: 800;
}

.wf-table tr.wf-sub td,
.wf-table tr.wf-sub th {
  color: var(--text-secondary);
  font-weight: 400;
  padding-inline-start: 1.4rem;
}

.wf-table tr.wf-key th,
.wf-table tr.wf-key td {
  font-weight: 800;
  background: var(--bg-subtle);
}

.wf-table tr.wf-final th,
.wf-table tr.wf-final td {
  font-family: var(--serif);
  font-size: 1rem;
  font-weight: 700;
  border-top: 2px solid var(--text-primary);
  border-bottom: none;
}

.text-neg {
  color: var(--red-bad);
}

.deductions-details {
  margin-block-start: 0.8rem;
  border-top: 1px solid var(--border-hairline);
  padding-block-start: 0.6rem;
}

.deductions-details summary {
  cursor: pointer;
  font-size: 0.76rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.deductions-details summary:hover {
  color: var(--text-primary);
}

.dd-group {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

/* ---- Compare ---- */
.compare-mode-row {
  display: flex;
  align-items: start;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-block-end: 1rem;
}

#compare-rankings {
  flex: 1;
  min-inline-size: 0;
}

#compare-rankings summary {
  padding: 0.5rem;
  font-size: 0.8rem;
  color: var(--text-secondary);
  cursor: pointer;
}

#compare-rankings .seg-mini { flex-wrap: wrap; height: auto; min-block-size: 32px; }

.compare-selected-controls {
  margin-block-end: 1rem;
  display: grid;
  gap: 0.65rem;
}

.compare-selected-controls > label {
  font-size: 0.8rem;
  font-weight: 700;
}

.compare-selected-controls .autocomplete-wrap { max-inline-size: 480px; }

.compare-place-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.compare-place-chip {
  display: inline-flex;
  align-items: center;
  max-inline-size: 100%;
  border: 1px solid var(--border-input);
  border-radius: 999px;
  background: var(--bg-surface);
  padding-inline: 0.75rem 0.3rem;
  min-block-size: 44px;
  font-size: 0.8rem;
  font-weight: 600;
}

.compare-place-chip > span:first-child { overflow-wrap: anywhere; }
.compare-place-chip.is-current { border-color: var(--swiss-red); padding-inline-end: 0.75rem; }
.compare-place-chip button {
  flex-shrink: 0;
  inline-size: 44px;
  block-size: 44px;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--text-secondary);
  font: inherit;
  font-size: 1.25rem;
  cursor: pointer;
}

.compare-place-chip button:hover { color: var(--swiss-red); }
.compare-request-status { font-size: 0.8rem; color: var(--text-secondary); }
.compare-request-status:empty { display: none; }
.selected-compare-table { max-block-size: none; }
#btn-compare-retry { justify-self: start; min-block-size: 44px; }
.lowest-badge {
  display: inline-block;
  margin-inline-start: 0.35rem;
  padding: 0.1rem 0.4rem;
  border-radius: 999px;
  font-size: 0.65rem;
  background: var(--green-bg);
  color: var(--green-cell-text);
}

@media (max-width: 640px) {
  .compare-mode-row { flex-direction: column; gap: 0.25rem; }
  #compare-rankings { inline-size: 100%; }
  #compare-location-search { min-block-size: 44px; }
  #compare-table tbody th { white-space: normal; }
}

.toolbar-left {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  flex: 1;
}

.toolbar-left select {
  width: auto;
}

.kpi-grid-compact .kpi-num {
  font-size: 1.75rem;
  line-height: 1.1;
  white-space: normal;
  overflow-wrap: anywhere;
}

.compare-chart-card,
.curve-chart-card {
  margin-block-end: 1rem;
}

/* Legend sample for a dashed line */
.legend-dash {
  background: repeating-linear-gradient(90deg, var(--text-primary) 0 4px, transparent 4px 6px);
}

tr.row-you th,
tr.row-you td {
  background: var(--swiss-red-soft) !important;
  font-weight: 700;
}

.you-badge,
.capital-badge {
  display: inline-block;
  margin-inline-start: 0.35rem;
  padding: 0.05rem 0.4rem;
  font-size: 0.62rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-radius: 999px;
  vertical-align: middle;
}

.you-badge {
  background: var(--swiss-red);
  color: #fff;
}

.capital-badge {
  border: 1px solid var(--border-input);
  color: var(--text-muted);
}

.btn-row-action {
  border: 1px solid var(--border-input);
  background: var(--bg-surface);
  padding: 0.18rem 0.6rem;
  font-size: 0.72rem;
  font-weight: 600;
  border-radius: 999px;
  color: var(--text-primary);
  cursor: pointer;
}

.btn-row-action:hover {
  border-color: var(--text-primary);
  background: var(--text-primary);
  color: var(--bg-surface);
}

.diff-pos { color: var(--red-bad); }
.diff-neg { color: var(--green-good); }

#compare-svg,
#curve-svg,
#history-svg {
  width: 100%;
  height: auto;
  display: block;
  user-select: none;
  -webkit-user-select: none;
}

/* ---- Guide badges ---- */
.cat-FED { background: var(--text-primary); color: var(--bg-surface); }
.cat-CANTON { background: var(--swiss-red-soft); color: var(--swiss-red); }
.cat-CITY { background: var(--amber-bg); color: var(--amber-warn); }
.cat-CHURCH { background: #ece3f3; color: #5b2a86; }
.cat-RULE { background: #ecd9a6; color: #6b3f07; }
.cat-RATE { background: var(--green-bg); color: var(--green-cell-text); }
.cat-MARRIED { background: #dbe4f5; color: #1e3a8a; }

/* Saved scenarios: chip labels and cards are buttons; a card's price is the total tax, its sub line the
   effective rate and the difference to the figures on screen */
.p-chip-label {
  border: none;
  background: transparent;
  color: inherit;
  font: inherit;
  padding: 0;
  cursor: pointer;
}

button.saved-card {
  font: inherit;
  color: inherit;
  text-align: start;
}

.saved-card-head {
  gap: 0.5rem;
}

.saved-card-head > span:last-child {
  white-space: nowrap;
}

.saved-card-price {
  font-size: 1.4rem;
}

.saved-card-price small {
  font-family: var(--sans);
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
}

.saved-card-sub {
  color: var(--text-muted);
}

.match-meta-inline {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-inline-start: 0.3rem;
}

/* Tax savings view */
.savings-inputs .toolbar-left {
  display: flex;
  align-items: flex-end;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.savings-field {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text-muted);
}

.savings-field input {
  inline-size: 11rem;
  max-inline-size: 100%;
}

.savings-rank-header {
  margin-block: 1.6rem 0.6rem;
}
