/* 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: 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 .compact-profile-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;
}

.compact-profile-form {
  display: grid;
  grid-template-columns: 1.45fr 0.95fr 0.8fr 0.75fr 1.9fr;
  gap: 0.7rem;
  align-items: start;
}

@media (max-width: 1024px) {
  .compact-profile-form {
    grid-template-columns: repeat(2, 1fr);
  }
  .pf-models {
    grid-column: 1 / -1;
  }
}

@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;
    white-space: normal;
    line-height: 1.1;
  }
  .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;
  }
}

@media (max-width: 359px) {
  .header-top {
    flex-wrap: wrap;
  }
  .header-actions {
    margin-inline-start: auto;
  }
}

.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;
}

.input-inline {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.age-tag {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.24rem 0.55rem;
  background: var(--text-primary);
  color: var(--bg-surface);
  border-radius: 999px;
  white-space: nowrap;
}

.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);
}

.model-toggles {
  display: flex;
  gap: 0.3rem;
  flex-wrap: wrap;
}

.m-chip {
  cursor: pointer;
  user-select: none;
}

.m-chip input {
  display: none;
}

.m-chip span {
  display: inline-block;
  height: 32px;
  line-height: 30px;
  padding: 0 0.7rem;
  font-size: 0.75rem;
  font-weight: 700;
  border: 1px solid var(--text-primary);
  border-radius: 999px;
  background: transparent;
  color: var(--text-primary);
}

.m-chip.active 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;
}

.family-bundle-box {
  margin-block-start: 0.85rem;
  padding-block-start: 0.75rem;
  border-top: 1px dashed var(--border-card);
}

.family-bundle-title {
  font-family: var(--serif);
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-block-end: 0.45rem;
}

.family-bundle-chips {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.fb-pill {
  font-size: 0.75rem;
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-card);
}

.fb-pill.best {
  background: var(--bg-surface);
  border-color: var(--text-primary);
  color: var(--text-primary);
  font-weight: 700;
}

/* 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-cell:nth-child(3) .kpi-num {
  font-size: 1.75rem;
  line-height: 1.1;
  white-space: normal;
  overflow-wrap: anywhere;
}

.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;
  }
  .kpi-cell:nth-child(3) .kpi-num {
    font-size: 1.25rem;
  }
}

.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;
}

.inline-cost-lbl {
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.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);
}

.th-info-tip {
  display: inline-block;
  font-size: 0.72rem;
  color: var(--text-muted);
  cursor: help;
  margin-inline-start: 2px;
}

.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);
}

.btn-curve-jump {
  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-curve-jump:hover {
  border-color: var(--text-primary);
  background: var(--text-primary);
  color: var(--bg-surface);
}

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

.cat-BASE { background: var(--bg-subtle); color: var(--text-primary); }
.cat-TEL_DIG { background: #dbe4f5; color: #1e3a8a; }
.cat-PRAXIS { background: var(--green-bg); color: var(--green-cell-text); }
.cat-FLEX { background: #ece3f3; color: #5b2a86; }
.cat-PHARM { background: #f7e3d3; color: #8a3a12; }
.cat-RULE { background: #ecd9a6; color: #6b3f07; }

.trend-badge {
  display: inline-block;
  padding: 0.12rem 0.5rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
}

.trend-low { background: var(--green-bg); color: var(--green-good); }
.trend-mid { background: var(--amber-bg); color: var(--amber-warn); }
.trend-high { background: var(--red-bg); color: var(--red-bad); }

.cell-best-franchise {
  background-color: var(--green-cell) !important;
  color: var(--green-cell-text);
  font-weight: 800;
}

.cell-best-franchise::after {
  content: " ★";
  color: var(--green-good);
}

.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);
  }
}

.curves-layout {
  display: grid;
  grid-template-columns: 350px 1fr;
  gap: 1.2rem;
  align-items: start;
}

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

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

.field-box {
  display: flex;
  flex-direction: column;
  gap: 0.38rem;
}

.field-box label {
  font-size: 0.79rem;
  font-weight: 700;
  color: var(--text-secondary);
}

#curve-plan-select {
  text-overflow: ellipsis;
}

input[type="range"] {
  width: 100%;
  accent-color: var(--swiss-red);
  cursor: pointer;
}

.preset-pills {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
}

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

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

.verdict-box {
  background: var(--bg-surface);
  border: 1px solid var(--border-card);
  border-left: 4px solid var(--swiss-red);
  padding: 0.85rem;
  border-radius: var(--radius-sm);
}

.verdict-label {
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--swiss-red);
  margin-block-end: 0.2rem;
}

.verdict-box h3 {
  font-family: var(--serif);
  font-size: 1.3rem;
  font-weight: 700;
  line-height: 1.25;
  color: var(--text-primary);
  margin-block-end: 0.35rem;
}

.verdict-box p {
  font-size: 0.78rem;
  color: var(--green-good);
}

.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;
}

#breakeven-svg,
#history-svg {
  width: 100%;
  height: auto;
  display: block;
  cursor: crosshair;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.cursor-breakdown {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(115px, 1fr));
  gap: 0.45rem;
}

.cb-item {
  border: 1px solid var(--border-card);
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.6rem;
  background: var(--bg-surface);
}

.cb-item.best {
  border-color: var(--text-primary);
  box-shadow: inset 0 0 0 1px var(--text-primary);
}

.cb-head {
  font-size: 0.71rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.cb-total {
  font-family: var(--serif);
  font-size: 1.25rem;
  font-weight: 700;
  margin-block: 0.12rem;
  font-variant-numeric: lining-nums tabular-nums;
}

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

.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);
}
