:root {
  --bg: #f6f3ee;
  --bg-2: #ece5dc;
  --surface: #ffffff;
  --surface-soft: #faf7f2;
  --surface-tint: #f1ebe2;
  --text: #17211f;
  --muted: #66716d;
  --muted-2: #8a938f;
  --border: #e5ded3;
  --border-strong: #d2c6b7;
  --stoyt: #126b61;
  --stoyt-dark: #0b3d38;
  --stoyt-soft: #e2f3ef;
  --tvoormegi: #b77716;
  --tvoormegi-dark: #7b4c0a;
  --tvoormegi-soft: #fff0cf;
  --focus: rgba(18, 107, 97, 0.2);
  --shadow-sm: 0 10px 30px rgba(23, 33, 31, 0.07);
  --shadow-md: 0 22px 70px rgba(23, 33, 31, 0.11);
  --radius-xl: 32px;
  --radius-lg: 24px;
  --radius-md: 16px;
  --radius-sm: 11px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 8% 4%, rgba(255, 217, 149, 0.42), transparent 31rem),
    radial-gradient(circle at 92% 8%, rgba(18, 107, 97, 0.15), transparent 30rem),
    linear-gradient(180deg, var(--bg), var(--bg-2));
  color: var(--text);
  line-height: 1.5;
}

button, input { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-decoration: none; }

.site-header {
  position: relative;
  overflow: hidden;
  color: #fff;
  background:
    linear-gradient(135deg, rgba(9, 42, 38, 0.98), rgba(16, 92, 84, 0.94) 58%, rgba(126, 75, 8, 0.88)),
    radial-gradient(circle at 86% 22%, rgba(255, 206, 111, 0.7), transparent 24rem);
}
.site-header::after {
  content: "";
  position: absolute;
  inset: auto -10% -34% auto;
  width: 48rem;
  height: 48rem;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255,255,255,0.12), transparent 62%);
  pointer-events: none;
}

.topbar {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  width: min(1180px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 1.15rem 0;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
}
.brand__mark {
  display: grid;
  place-items: center;
  width: 2.45rem;
  height: 2.45rem;
  border: 1px solid rgba(255,255,255,0.28);
  border-radius: 14px;
  background: rgba(255,255,255,0.13);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.18);
  font-weight: 900;
}
.brand strong { display: block; letter-spacing: -0.03em; line-height: 1.1; }
.brand small { display: block; color: rgba(255,255,255,0.68); font-size: 0.78rem; margin-top: 0.08rem; }
.topbar__actions { display: flex; gap: 0.65rem; flex-wrap: wrap; justify-content: flex-end; }

.hero {
  position: relative;
  z-index: 1;
  width: min(1180px, calc(100% - 2rem));
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: clamp(1.5rem, 5vw, 4.5rem);
  align-items: end;
  padding: clamp(3rem, 8vw, 6.2rem) 0 clamp(4rem, 8vw, 6.5rem);
}
.hero__content { max-width: 820px; }
.hero h1 {
  margin: 0.25rem 0 1.1rem;
  max-width: 780px;
  font-size: clamp(2.6rem, 8vw, 6.65rem);
  line-height: 0.9;
  letter-spacing: -0.075em;
}
.hero__lead {
  max-width: 740px;
  margin: 0;
  color: rgba(255, 255, 255, 0.82);
  font-size: clamp(1.03rem, 2vw, 1.25rem);
}
.hero__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin-top: 1.45rem;
}
.hero__meta span {
  border: 1px solid rgba(255,255,255,0.22);
  border-radius: 999px;
  padding: 0.46rem 0.72rem;
  background: rgba(255,255,255,0.1);
  color: rgba(255,255,255,0.78);
  font-size: 0.88rem;
  font-weight: 700;
}

.eyebrow {
  margin: 0 0 0.4rem;
  color: var(--stoyt);
  font-size: 0.73rem;
  font-weight: 850;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.eyebrow--light { color: #ffdf9d; }

.hero-card {
  border: 1px solid rgba(255,255,255,0.24);
  border-radius: var(--radius-xl);
  padding: 1.35rem;
  background: linear-gradient(180deg, rgba(255,255,255,0.16), rgba(255,255,255,0.09));
  backdrop-filter: blur(16px);
  box-shadow: 0 24px 80px rgba(0,0,0,0.2);
}
.hero-card__label, .hero-card small { display: block; color: rgba(255,255,255,0.72); }
.hero-card strong {
  display: block;
  margin: 0.4rem 0 0.1rem;
  font-size: clamp(2.05rem, 5vw, 3.25rem);
  line-height: 1;
  letter-spacing: -0.06em;
}

.page {
  width: min(1180px, calc(100% - 2rem));
  margin: -2.3rem auto 2rem;
  position: relative;
  z-index: 2;
}
.section-heading {
  margin: 1.55rem 0 0.85rem;
  display: grid;
  gap: 0.12rem;
}
.section-heading:first-of-type { margin-top: 0; }
.section-heading h2 {
  margin: 0;
  font-size: clamp(1.55rem, 3vw, 2.15rem);
  line-height: 1.1;
  letter-spacing: -0.055em;
}
.section-heading p:last-child { margin: 0; color: var(--muted); max-width: 720px; }
.section-heading--results { margin-top: 1.7rem; }

.layout {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.05rem;
  margin-top: 1.05rem;
}
.layout--input { margin-top: 0; align-items: start; }
.summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.panel, .kpi, .notice {
  border: 1px solid rgba(229, 222, 211, 0.94);
  border-radius: var(--radius-lg);
  background: rgba(255,255,255,0.94);
  box-shadow: var(--shadow-sm);
}
.panel {
  padding: clamp(1rem, 2vw, 1.35rem);
}
.panel--wide { margin-top: 1.05rem; }
.panel--table, .panel--terms { min-height: 100%; }
.panel__header {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
  margin-bottom: 1rem;
}
.panel__header--wrap { flex-wrap: wrap; }
.panel h3 {
  margin: 0;
  font-size: clamp(1.18rem, 2.2vw, 1.48rem);
  line-height: 1.15;
  letter-spacing: -0.04em;
}
.panel__description { margin: 0.38rem 0 0; color: var(--muted); max-width: 680px; }

.notice {
  margin-bottom: 1rem;
  padding: 0.9rem 1rem;
  background: #fff8e7;
  color: #67490d;
  box-shadow: none;
}

.button {
  border: 0;
  border-radius: 999px;
  padding: 0.68rem 0.95rem;
  cursor: pointer;
  font-weight: 800;
  transition: transform 0.16s ease, border-color 0.16s ease, background 0.16s ease, box-shadow 0.16s ease;
  white-space: nowrap;
}
.button:hover { transform: translateY(-1px); }
.button:focus-visible { outline: 3px solid rgba(255,255,255,0.26); outline-offset: 2px; }
.button--light {
  border: 1px solid rgba(255,255,255,0.24);
  background: rgba(255,255,255,0.12);
  color: #fff;
}
.button--light:hover { background: rgba(255,255,255,0.18); }
.button--secondary {
  border: 1px solid var(--border);
  background: var(--surface-soft);
  color: var(--text);
}
.button--secondary:hover { border-color: var(--border-strong); box-shadow: 0 8px 20px rgba(23,33,31,0.06); }

.table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
}
.data-table {
  width: 100%;
  min-width: 680px;
  border-collapse: separate;
  border-spacing: 0;
}
.data-table th,
.data-table td {
  padding: 0.83rem 0.9rem;
  border-bottom: 1px solid var(--border);
  text-align: right;
  vertical-align: middle;
  white-space: nowrap;
}
.data-table th:first-child,
.data-table td:first-child { text-align: left; }
.data-table thead th {
  position: sticky;
  top: 0;
  background: #143b36;
  color: #fff;
  font-size: 0.72rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  z-index: 1;
}
.data-table thead th:first-child { border-top-left-radius: calc(var(--radius-md) - 1px); }
.data-table thead th:last-child { border-top-right-radius: calc(var(--radius-md) - 1px); }
.data-table tbody tr { transition: background 0.15s ease; }
.data-table tbody tr:hover { background: #fbfaf7; }
.data-table tfoot th {
  background: #f4efe7;
  font-size: 1rem;
  font-weight: 900;
}
.data-table tr:last-child td { border-bottom: 0; }
.data-table input { text-align: right; }
.data-table strong { font-weight: 850; }

input[type="number"] {
  width: 100%;
  min-width: 86px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.62rem 0.7rem;
  background: #fff;
  color: var(--text);
  box-shadow: inset 0 1px 0 rgba(23,33,31,0.03);
}
input[type="number"]:focus { outline: 3px solid var(--focus); border-color: var(--stoyt); }

.form-grid { display: grid; gap: 0.75rem; }
.field {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 145px;
  gap: 0.8rem;
  align-items: center;
  padding: 0.82rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: linear-gradient(180deg, var(--surface-soft), #fff);
}
.field label { font-weight: 800; letter-spacing: -0.01em; }
.field small {
  display: block;
  margin-top: 0.22rem;
  color: var(--muted);
  font-weight: 450;
  line-height: 1.35;
}
.input-with-suffix { position: relative; display: flex; align-items: center; }
.input-with-suffix input { padding-right: 3rem; }
.input-with-suffix span {
  position: absolute;
  right: 0.75rem;
  color: var(--muted-2);
  pointer-events: none;
  font-size: 0.9rem;
  font-weight: 700;
}

.kpi {
  position: relative;
  overflow: hidden;
  padding: 1.05rem;
  min-height: 138px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.kpi::after {
  content: "";
  position: absolute;
  width: 8rem;
  height: 8rem;
  right: -4rem;
  bottom: -4rem;
  border-radius: 50%;
  background: rgba(23,33,31,0.04);
}
.kpi span, .kpi small { color: var(--muted); position: relative; z-index: 1; }
.kpi span { font-weight: 760; }
.kpi strong {
  position: relative;
  z-index: 1;
  margin: 0.42rem 0 0.15rem;
  font-size: clamp(1.42rem, 3.3vw, 2.32rem);
  line-height: 1;
  letter-spacing: -0.055em;
}
.kpi--stoyt { background: linear-gradient(145deg, var(--stoyt-soft), #fff 68%); }
.kpi--stoyt::after { background: rgba(18,107,97,0.11); }
.kpi--tvoormegi { background: linear-gradient(145deg, var(--tvoormegi-soft), #fff 68%); }
.kpi--tvoormegi::after { background: rgba(183,119,22,0.13); }

.split-card { margin-bottom: 1rem; }
.split-card__labels {
  display: flex;
  justify-content: space-between;
  margin-bottom: 0.45rem;
  color: var(--muted);
  font-weight: 850;
}
.split-bar {
  display: flex;
  overflow: hidden;
  height: 46px;
  border: 1px solid rgba(23,33,31,0.06);
  border-radius: 999px;
  background: #eee7dc;
  box-shadow: inset 0 1px 3px rgba(23,33,31,0.08);
}
.split-bar__part { display: grid; place-items: center; transition: width 0.2s ease; min-width: 0; }
.split-bar__percent { color: #fff; font-weight: 900; font-size: 0.88rem; line-height: 1; white-space: nowrap; text-shadow: 0 1px 2px rgba(0,0,0,0.22); }
.split-bar__part--stoyt { background: linear-gradient(90deg, var(--stoyt-dark), var(--stoyt)); }
.split-bar__part--tvoormegi { background: linear-gradient(90deg, var(--tvoormegi), #d89127); }
.hint { margin: 0.6rem 0 0; color: var(--muted); font-size: 0.92rem; }

.result-list {
  display: grid;
  gap: 0.62rem;
  margin: 0;
}
.result-list div {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.82rem 0.9rem;
  border: 1px solid rgba(229,222,211,0.78);
  border-radius: 15px;
  background: var(--surface-soft);
}
.result-list--compact { margin-top: 0.9rem; }
.result-list dt { color: var(--muted); }
.result-list dd { margin: 0; font-weight: 900; text-align: right; color: var(--text); }

.controls-row {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.38rem 0.42rem 0.38rem 0.8rem;
  background: var(--surface-soft);
}
.controls-row label, .controls-row span { font-weight: 760; }
.controls-row input { max-width: 95px; }

.toggle-line {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.75rem 0.92rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-soft);
  font-weight: 800;
  color: var(--text);
  cursor: pointer;
}
.toggle-line input {
  width: 1.05rem;
  height: 1.05rem;
  accent-color: var(--tvoormegi);
}
.summary-grid--compact {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 0;
}
.kombi-panel { border-color: rgba(183,119,22,0.24); }
.kombi-panel[hidden] { display: none; }

.formula-panel { background: rgba(255,255,255,0.86); }
.formula-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.8rem;
}
.formula-grid p {
  margin: 0;
  padding: 0.95rem;
  border: 1px solid rgba(229,222,211,0.78);
  border-radius: var(--radius-md);
  background: var(--surface-soft);
  color: var(--muted);
}
.formula-grid strong { color: var(--text); }
.formula-grid p:last-child { grid-column: 1 / -1; }

.footer {
  width: min(1180px, calc(100% - 2rem));
  margin: 1rem auto 2.5rem;
  color: var(--muted);
  text-align: center;
}

@media (max-width: 1040px) {
  .hero { grid-template-columns: 1fr; }
  .hero-card { max-width: 480px; }
  .layout { grid-template-columns: 1fr; }
  .summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .formula-grid { grid-template-columns: 1fr; }
  .formula-grid p:last-child { grid-column: auto; }
}

@media (max-width: 700px) {
  .topbar { align-items: flex-start; flex-direction: column; }
  .topbar__actions { width: 100%; justify-content: flex-start; }
  .button { padding: 0.62rem 0.82rem; }
  .hero { width: min(100% - 1rem, 1180px); padding-top: 2.6rem; padding-bottom: 3.6rem; }
  .hero__meta { gap: 0.45rem; }
  .hero__meta span { font-size: 0.82rem; }
  .page { width: min(100% - 0.75rem, 1180px); margin-top: -1.65rem; }
  .panel, .kpi, .notice { border-radius: 20px; }
  .panel__header { flex-direction: column; }
  .summary-grid, .summary-grid--compact { grid-template-columns: 1fr; }
  .field { grid-template-columns: 1fr; }
  .controls-row { width: 100%; flex-wrap: wrap; border-radius: 16px; }
  .toggle-line { width: 100%; justify-content: center; border-radius: 16px; }
  .data-table th, .data-table td { padding: 0.7rem; }
  .brand small { display: none; }
}

@media print {
  body { background: #fff; }
  .topbar__actions, .button, .notice { display: none !important; }
  .site-header { color: #000; background: #fff; }
  .site-header::after { display: none; }
  .topbar, .hero, .page, .footer { width: 100%; margin: 0; }
  .topbar { padding: 0 0 1rem; }
  .hero { padding: 0 0 1rem; }
  .brand small, .hero__lead, .hero__meta span, .hero-card__label, .hero-card small { color: #333; }
  .hero-card, .panel, .kpi { box-shadow: none; background: #fff; break-inside: avoid; }
  .section-heading { break-after: avoid; }
}

/* v5 layout refinements: smaller header, no visible comparison table, cleaner input table */
.utility-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  overflow: hidden !important;
  clip: rect(0 0 0 0) !important;
  clip-path: inset(50%) !important;
  white-space: nowrap !important;
}

.site-header {
  overflow: visible;
}
.site-header::after {
  width: 26rem;
  height: 26rem;
  bottom: -40%;
  opacity: 0.7;
}
.topbar {
  padding: 0.85rem 0;
}
.hero {
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: clamp(1rem, 3vw, 2rem);
  align-items: center;
  padding: clamp(1.35rem, 3.2vw, 2.4rem) 0 clamp(1.75rem, 4vw, 2.8rem);
}
.hero h1 {
  max-width: 650px;
  margin: 0.12rem 0 0.55rem;
  font-size: clamp(2rem, 4.8vw, 4rem);
  line-height: 0.95;
  letter-spacing: -0.065em;
}
.hero__lead {
  max-width: 650px;
  font-size: clamp(0.95rem, 1.5vw, 1.08rem);
}
.hero-card {
  border-radius: 22px;
  padding: 1rem;
}
.hero-card strong {
  font-size: clamp(1.65rem, 3vw, 2.25rem);
}
.hero-card__label,
.hero-card small {
  font-size: 0.86rem;
}
.page {
  margin-top: -1.15rem;
}
.section-heading {
  margin: 1rem 0 0.7rem;
}
.section-heading h2 {
  font-size: clamp(1.35rem, 2.4vw, 1.85rem);
}
.layout--input {
  grid-template-columns: minmax(0, 1.08fr) minmax(0, 0.92fr);
}

.membership-table {
  min-width: 0;
  table-layout: fixed;
}
.membership-table th,
.membership-table td {
  white-space: normal;
}
.membership-table th:nth-child(1),
.membership-table td:nth-child(1) { width: 38%; }
.membership-table th:nth-child(2),
.membership-table td:nth-child(2) { width: 31%; }
.membership-table th:nth-child(3),
.membership-table td:nth-child(3) { width: 31%; }
.membership-table th:nth-child(4),
.membership-table td:nth-child(4) {
  display: none;
}
.membership-table tfoot th[scope="row"] {
  text-align: left;
}
.membership-table input[type="number"] {
  min-width: 0;
  padding-inline: 0.55rem;
}
.panel--table .table-wrap {
  overflow-x: visible;
}

@media (max-width: 1040px) {
  .hero {
    grid-template-columns: 1fr;
    align-items: start;
  }
  .hero-card {
    max-width: 360px;
  }
  .layout--input {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 700px) {
  .site-header {
    border-bottom-left-radius: 24px;
    border-bottom-right-radius: 24px;
  }
  .topbar {
    gap: 0.75rem;
    padding: 0.75rem 0 0.45rem;
  }
  .topbar__actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.45rem;
  }
  .topbar__actions .button {
    width: 100%;
    padding: 0.58rem 0.55rem;
    font-size: 0.86rem;
  }
  .brand__mark {
    width: 2.15rem;
    height: 2.15rem;
    border-radius: 12px;
  }
  .hero {
    width: min(100% - 1rem, 1180px);
    padding-top: 0.9rem;
    padding-bottom: 1.55rem;
  }
  .hero h1 {
    font-size: clamp(2rem, 10vw, 3rem);
  }
  .hero-card {
    width: 100%;
    max-width: none;
  }
  .page {
    margin-top: 0.85rem;
  }
  .section-heading:first-of-type {
    margin-top: 0;
  }
  .membership-table th,
  .membership-table td {
    padding: 0.62rem 0.5rem;
    font-size: 0.92rem;
  }
  .membership-table thead th {
    font-size: 0.64rem;
    letter-spacing: 0.055em;
  }
  .membership-table th:nth-child(1),
  .membership-table td:nth-child(1) { width: 34%; }
  .membership-table th:nth-child(2),
  .membership-table td:nth-child(2) { width: 33%; }
  .membership-table th:nth-child(3),
  .membership-table td:nth-child(3) { width: 33%; }
}


/* v6 compatibility checks and final refinements */
.site-header {
  overflow: hidden;
}

.membership-table #totalIncomeCell,
.membership-table .calculation-only {
  display: none !important;
}

.membership-table {
  width: 100%;
}

.membership-table td,
.membership-table th {
  overflow-wrap: anywhere;
}

.membership-table input[type="number"] {
  max-width: 100%;
}

#linkNotice[hidden],
#kombiDetails[hidden] {
  display: none !important;
}

@media (max-width: 420px) {
  .membership-table th,
  .membership-table td {
    padding: 0.55rem 0.4rem;
    font-size: 0.86rem;
  }

  .membership-table input[type="number"] {
    padding: 0.55rem 0.45rem;
  }

  .panel__header .button {
    width: 100%;
  }
}

/* v8 refinements: brand removed, tighter header, reset buttons removed */
.site-header {
  overflow: hidden;
}
.hero {
  padding-top: clamp(1.05rem, 2.5vw, 1.85rem);
  padding-bottom: clamp(1.35rem, 3vw, 2.25rem);
}
.hero h1 {
  margin-top: 0;
}
.panel__header:has(.panel__description) {
  margin-bottom: 0.85rem;
}
@media (max-width: 700px) {
  .hero {
    padding-top: 0.95rem;
    padding-bottom: 1.35rem;
  }
}


/* v9 refinements: removed section headings and made input panels more compact */
.page {
  margin-top: -0.25rem;
}
.layout--input {
  margin-top: 0;
}
.panel--table,
.panel--terms {
  padding: clamp(0.78rem, 1.35vw, 1rem);
}
.panel--table .panel__header,
.panel--terms .panel__header {
  margin-bottom: 0.58rem;
}
.panel--table h3,
.panel--terms h3 {
  font-size: clamp(1.08rem, 1.8vw, 1.28rem);
}
.panel--table .panel__description,
.panel--terms .panel__description {
  margin-top: 0.18rem;
  font-size: 0.9rem;
  line-height: 1.32;
}
.membership-table th,
.membership-table td {
  padding-top: 0.62rem;
  padding-bottom: 0.62rem;
}
.membership-table input[type="number"] {
  padding-top: 0.48rem;
  padding-bottom: 0.48rem;
}
.panel--terms .form-grid {
  gap: 0.52rem;
}
.panel--terms .field {
  padding: 0.58rem 0.66rem;
  gap: 0.58rem;
  border-radius: 13px;
}
.panel--terms .field small {
  margin-top: 0.12rem;
  font-size: 0.82rem;
  line-height: 1.24;
}
.panel--terms input[type="number"] {
  padding-top: 0.5rem;
  padding-bottom: 0.5rem;
}
.summary-grid {
  margin-top: 1.05rem;
}
@media (max-width: 700px) {
  .page {
    margin-top: 0.7rem;
  }
  .panel--table,
  .panel--terms {
    padding: 0.72rem;
  }
  .panel--table .panel__header,
  .panel--terms .panel__header {
    margin-bottom: 0.5rem;
  }
  .panel--table .panel__description,
  .panel--terms .panel__description {
    font-size: 0.86rem;
  }
  .panel--terms .field {
    padding: 0.55rem;
  }
}

/* v11 tiny spacing adjustment: move first panels slightly further below the header */
.page {
  margin-top: 0.35rem;
}

@media (max-width: 700px) {
  .page {
    margin-top: 1.1rem;
  }
}

/* v14 fix: remove unused vertical space in Limahald and Treytir panels */
.layout,
.layout--input {
  align-items: start;
}

.panel--table,
.panel--terms {
  min-height: 0 !important;
  height: auto !important;
}

@media (max-width: 1040px) {
  .panel--table,
  .panel--terms {
    min-height: 0 !important;
    height: auto !important;
  }
}

/* v15 mobile result cards: keep the four main KPI containers in two columns on iPhone width */
@media (max-width: 700px) {
  .summary-grid:not(.summary-grid--compact) {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* v16 mobile Kombi result cards: keep the two Eyka yvirlit KPI containers side by side on iPhone width */
@media (max-width: 700px) {
  .summary-grid--compact {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* v17 Treytir settings modal: hide agreement terms until the cog is opened */
.layout--single {
  grid-template-columns: minmax(0, 1fr);
}

.panel__header--row {
  flex-direction: row;
  align-items: flex-start;
}

.settings-button {
  flex: 0 0 auto;
  width: 2.35rem;
  height: 2.35rem;
  display: grid;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--stoyt);
  cursor: pointer;
  font-size: 1.18rem;
  font-weight: 900;
  line-height: 1;
}
.settings-button:hover {
  border-color: var(--border-strong);
  box-shadow: 0 8px 20px rgba(23,33,31,0.06);
}
.settings-button:focus-visible,
.modal-close:focus-visible,
.button--primary:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.terms-modal[hidden] {
  display: none !important;
}
.terms-modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 1rem;
}
.terms-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(13, 24, 22, 0.46);
  backdrop-filter: blur(5px);
}
.terms-modal__panel {
  position: relative;
  z-index: 1;
  width: min(620px, 100%);
  max-height: min(88vh, 760px);
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: rgba(255,255,255,0.98);
  box-shadow: var(--shadow-md);
  padding: clamp(0.9rem, 2vw, 1.2rem);
}
.terms-modal__header {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
  margin-bottom: 0.85rem;
}
.modal-close {
  flex: 0 0 auto;
  width: 2.2rem;
  height: 2.2rem;
  display: grid;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--text);
  cursor: pointer;
  font-size: 1.4rem;
  line-height: 1;
}
.terms-modal__actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.65rem;
  margin-top: 1rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--border);
}
.button--primary {
  background: var(--stoyt);
  color: #fff;
}
.button--primary:hover {
  background: var(--stoyt-dark);
}
body.modal-open {
  overflow: hidden;
}

@media (max-width: 700px) {
  .settings-button {
    width: 2.15rem;
    height: 2.15rem;
  }
  .terms-modal {
    align-items: end;
    padding: 0.55rem;
  }
  .terms-modal__panel {
    width: 100%;
    max-height: 86vh;
    border-radius: 20px;
    padding: 0.82rem;
  }
  .terms-modal__header {
    margin-bottom: 0.65rem;
  }
  .terms-modal__panel .field {
    grid-template-columns: 1fr;
    padding: 0.58rem;
  }
  .terms-modal__panel .field small {
    display: none;
  }
  .terms-modal__actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }
}

/* v18 responsive Limahald width: keep the input panel compact on wide screens and fluid on smaller screens */
.layout--single {
  grid-template-columns: minmax(0, min(100%, 760px));
  justify-content: center;
}

@media (max-width: 820px) {
  .layout--single {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* v19: make Limahald max width match the full-width Eyka yvirlit panel */
.layout--single {
  grid-template-columns: minmax(0, 1fr);
  justify-content: stretch;
}

/* v20: Limahald rows styled like result cards instead of a traditional table */
.panel--table .table-wrap {
  border: 0;
  border-radius: 0;
  background: transparent;
  overflow: visible;
}

.membership-table {
  display: grid;
  gap: 0.58rem;
  min-width: 0;
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: transparent;
}

.membership-table thead,
.membership-table tbody,
.membership-table tfoot {
  display: grid;
  gap: 0.52rem;
}

.membership-table tr {
  display: grid;
  grid-template-columns: 1.12fr 0.94fr 0.94fr;
  gap: 0.62rem;
  align-items: center;
}

.membership-table th,
.membership-table td {
  width: auto !important;
  padding: 0;
  border: 0;
  text-align: left;
  white-space: normal;
  overflow-wrap: anywhere;
}

.membership-table thead tr {
  padding: 0 0.45rem;
}

.membership-table thead th {
  position: static;
  background: transparent;
  color: var(--muted);
  font-size: 0.68rem;
  line-height: 1.15;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 900;
  z-index: auto;
}

.membership-table thead th:first-child,
.membership-table thead th:last-child {
  border-radius: 0;
}

.membership-table tbody tr,
.membership-table tfoot tr {
  padding: 0.62rem 0.68rem;
  border: 1px solid rgba(229,222,211,0.78);
  border-radius: 15px;
  background: var(--surface-soft);
}

.membership-table tbody tr:hover {
  background: var(--surface-soft);
}

.membership-table tfoot tr {
  background: #f4efe7;
  font-weight: 900;
}

.membership-table tfoot th {
  background: transparent;
  font-size: 0.95rem;
  font-weight: 900;
}

.membership-table tfoot th[scope="row"] {
  grid-column: 1 / 3;
}

.membership-table td:nth-child(2),
.membership-table td:nth-child(3),
.membership-table th:nth-child(2),
.membership-table th:nth-child(3),
.membership-table tfoot th:nth-child(3) {
  text-align: right;
}

.membership-table input[type="number"] {
  min-width: 0;
  width: 100%;
  padding: 0.5rem 0.55rem;
  border-radius: 12px;
  text-align: right;
  background: #fff;
}

.membership-table th:nth-child(4),
.membership-table td:nth-child(4),
.membership-table #totalIncomeCell,
.membership-table .calculation-only {
  display: none !important;
}

@media (max-width: 700px) {
  .membership-table {
    gap: 0.45rem;
  }

  .membership-table thead,
  .membership-table tbody,
  .membership-table tfoot {
    gap: 0.45rem;
  }

  .membership-table tr {
    grid-template-columns: 1.04fr 0.98fr 0.98fr;
    gap: 0.42rem;
  }

  .membership-table thead tr {
    padding: 0 0.38rem;
  }

  .membership-table thead th {
    font-size: 0.58rem;
    letter-spacing: 0.045em;
  }

  .membership-table tbody tr,
  .membership-table tfoot tr {
    padding: 0.5rem;
    border-radius: 13px;
  }

  .membership-table th,
  .membership-table td {
    font-size: 0.86rem;
  }

  .membership-table input[type="number"] {
    padding: 0.45rem 0.42rem;
    font-size: 0.9rem;
  }
}


/* Password gate */
body.auth-locked {
  overflow: hidden;
}

body.auth-locked > :not(.password-screen) {
  display: none !important;
}

.password-screen {
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: 1rem;
  background:
    radial-gradient(circle at 12% 8%, rgba(255, 217, 149, 0.42), transparent 28rem),
    radial-gradient(circle at 90% 14%, rgba(18, 107, 97, 0.18), transparent 26rem),
    linear-gradient(135deg, rgba(9, 42, 38, 0.98), rgba(16, 92, 84, 0.94) 58%, rgba(126, 75, 8, 0.88));
  color: #fff;
}

.password-card {
  width: min(100%, 430px);
  border: 1px solid rgba(255,255,255,0.24);
  border-radius: 26px;
  padding: clamp(1.25rem, 5vw, 2rem);
  background: linear-gradient(180deg, rgba(255,255,255,0.17), rgba(255,255,255,0.1));
  box-shadow: 0 24px 80px rgba(0,0,0,0.22);
  backdrop-filter: blur(18px);
}

.password-card h1 {
  margin: 0.15rem 0 0.5rem;
  font-size: clamp(2rem, 9vw, 3.25rem);
  line-height: 0.95;
  letter-spacing: -0.065em;
}

.password-card__text {
  margin: 0 0 1rem;
  color: rgba(255,255,255,0.78);
}

.password-form {
  display: grid;
  gap: 0.65rem;
}

.password-form label {
  font-size: 0.78rem;
  font-weight: 850;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.78);
}

.password-form input[type="password"] {
  width: 100%;
  border: 1px solid rgba(255,255,255,0.24);
  border-radius: 14px;
  padding: 0.85rem 0.9rem;
  background: rgba(255,255,255,0.94);
  color: var(--text);
  font: inherit;
}

.password-form input[type="password"]:focus {
  outline: 3px solid rgba(255,255,255,0.22);
  border-color: rgba(255,255,255,0.65);
}

.password-form .button {
  width: 100%;
  justify-content: center;
}

.password-error {
  margin: 0.15rem 0 0;
  color: #ffe4e4;
  font-weight: 800;
}

/* v22 password fix: ensure hidden password screen actually disappears after correct password */
.password-screen[hidden] {
  display: none !important;
}


/* v23: show split percentages inside the bar */
@media (max-width: 420px) {
  .split-bar__percent {
    font-size: 0.78rem;
  }
}
