/*
 * Kalkulatoru lapas (2026-10-18). Tokeni un galva/kājene nāk no landing.css;
 * šeit tikai tas, kas kalkulatoram savs. Visas klases ar "cx-", lai
 * nekad nesadurtos ar landinga klasēm.
 */
:root { --debt: #a855f7; }

.calc-page .lp-top {
  position: sticky; top: 0;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-bottom-color: var(--line);
}

.cx-shell { max-width: calc(var(--shell) + 2 * var(--gutter)); margin: 0 auto; padding: 0 var(--gutter); }

.cx-crumbs { font-size: 13px; color: var(--text-3); margin: 28px 0 10px; }
.cx-crumbs a { color: var(--text-2); }
.cx-crumbs a:hover { color: var(--text); }
.calc-page h1 { font-size: clamp(28px, 4.2vw, 44px); line-height: 1.12; margin: 0 0 12px; text-wrap: balance; }
.cx-lead { color: var(--text-2); font-size: 18px; max-width: 62ch; margin: 0 0 28px; }

/* ---------------- Kalkulators ---------------- */
.cx-calc { display: grid; grid-template-columns: 360px minmax(0, 1fr); gap: 20px; align-items: start; }
.cx-card { background: var(--surface-1); border: 1px solid var(--line); border-radius: var(--r-lg);
  box-shadow: var(--shadow-2); padding: 22px; min-width: 0; }
.cx-field { display: grid; gap: 6px; margin-bottom: 16px; }
.cx-field:last-child { margin-bottom: 0; }
.cx-field > label, .cx-field > .cx-lbl { font-size: 13px; color: var(--text-2); font-weight: 600; letter-spacing: .02em; }
.cx-inp { display: flex; align-items: center; background: var(--bg); border: 1px solid var(--line-strong); border-radius: var(--r-md); }
.cx-inp input { flex: 1; min-width: 0; background: transparent; border: 0; color: var(--text);
  font: 600 18px/1 inherit; font-family: inherit; padding: 12px 14px; font-variant-numeric: tabular-nums; }
.cx-inp input:focus { outline: none; }
.cx-inp:focus-within { border-color: var(--accent); }
.cx-inp:has(input[aria-invalid="true"]) { border-color: #f4636a; }
.cx-inp span { color: var(--text-3); padding-right: 14px; font-size: 14px; white-space: nowrap; }
.cx-range { width: 100%; accent-color: var(--accent); margin: 4px 0 0; min-height: 24px; }
.cx-seg { display: grid; grid-template-columns: 1fr 1fr; background: var(--bg); border: 1px solid var(--line-strong);
  border-radius: var(--r-full); padding: 3px; }
.cx-seg button { background: transparent; border: 0; color: var(--text-2); font: 600 13px/1.2 inherit; font-family: inherit;
  padding: 10px 8px; border-radius: var(--r-full); cursor: pointer; min-height: 40px; }
.cx-seg button[aria-pressed="true"] { background: var(--surface-3); color: var(--text); }
.cx-seg button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

.cx-kpis { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 12px; }
.cx-kpi { background: var(--surface-2); border-radius: var(--r-md); padding: 14px 16px; min-width: 0; }
.cx-kpi small { display: block; font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--text-3); font-weight: 700; }
.cx-kpi b { display: block; font-size: 22px; margin-top: 6px; font-variant-numeric: tabular-nums; letter-spacing: -.01em; white-space: nowrap; }
.cx-kpi.big b { font-size: clamp(24px, 3vw, 32px); color: var(--accent); }
.cx-kpi .cx-sub { font-size: 12px; color: var(--text-3); }

.cx-chart { margin-top: 18px; }
.cx-chart svg { width: 100%; height: 220px; display: block; overflow: visible; }
.cx-grid { stroke: var(--line); stroke-width: 1; }
.cx-ax { fill: var(--text-3); font-size: 11px; font-family: inherit; }
.cx-area { fill: color-mix(in srgb, var(--debt) 14%, transparent); }
.cx-la { fill: none; stroke: var(--debt); stroke-width: 2.5; stroke-linejoin: round; }
.cx-lb { fill: none; stroke: var(--state-good); stroke-width: 2.5; stroke-dasharray: 6 4; stroke-linejoin: round; }
.cx-legend { display: flex; gap: 16px; font-size: 12px; color: var(--text-2); margin-top: 6px; flex-wrap: wrap; }
.cx-legend i { display: inline-block; width: 16px; height: 0; border-top: 3px solid var(--debt); margin-right: 6px; vertical-align: 3px; }
.cx-legend i.b { border-top: 3px dashed var(--state-good); }
.cx-legend [hidden] { display: none; }

.cx-win { margin-top: 16px; border: 1px solid color-mix(in srgb, var(--state-good) 40%, transparent);
  background: color-mix(in srgb, var(--state-good) 10%, transparent); border-radius: var(--r-md); padding: 14px 16px; font-size: 15px; }
.cx-win b { color: var(--state-good); }
.cx-win[hidden] { display: none; }

.cx-tbl { margin-top: 16px; }
.cx-tbl summary { cursor: pointer; color: var(--text-2); font-size: 14px; font-weight: 600; padding: 6px 0; }
.cx-tbl summary:hover { color: var(--text); }
.cx-scroll { overflow-x: auto; margin-top: 10px; -webkit-overflow-scrolling: touch; }
.calc-page table { width: 100%; border-collapse: collapse; font-size: 14px; font-variant-numeric: tabular-nums; }
.calc-page th, .calc-page td { text-align: right; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.calc-page th:first-child, .calc-page td:first-child { text-align: left; }
.calc-page th { color: var(--text-3); font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.cx-tbl td, .cx-tbl th { white-space: nowrap; }

/* ---------------- Aicinājums ---------------- */
.cx-cta { margin: 28px 0 8px; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 20px; align-items: center;
  background: linear-gradient(135deg, var(--surface-2), var(--surface-1)); border-color: var(--accent-line); }
.cx-cta-h { margin: 0 0 6px; font-size: 20px; font-weight: 700; color: var(--text); line-height: 1.3; }
.cx-cta p:last-child { margin: 0; color: var(--text-2); }

/* ---------------- Raksts ---------------- */
.cx-art { max-width: 72ch; margin: 56px 0 0; }
.cx-art h2 { font-size: 26px; line-height: 1.25; margin: 44px 0 12px; letter-spacing: -.01em; text-wrap: balance; }
.cx-art h2:first-child { margin-top: 0; }
.cx-art p, .cx-art li { color: var(--text-2); }
.cx-art ul, .cx-art ol { padding-left: 22px; margin: 0 0 16px; }
.cx-art li { margin-bottom: 8px; }
.cx-art strong { color: var(--text); font-variant-numeric: tabular-nums; }
.cx-art .cx-scroll { margin: 4px 0 18px; }
.cx-art td { color: var(--text-2); }
.cx-art td:first-child { color: var(--text); }
.cx-formula { background: var(--surface-1); border: 1px solid var(--line); border-radius: var(--r-md); padding: 16px 18px; margin: 0 0 16px;
  font: 600 17px/1.5 ui-monospace, "SF Mono", Menlo, monospace; color: var(--text); overflow-x: auto; white-space: nowrap; }
.cx-faq details { border-bottom: 1px solid var(--line); padding: 14px 0; }
.cx-faq summary { cursor: pointer; font-weight: 600; color: var(--text); }
.cx-faq details p { margin: 10px 0 0; }
.cx-note { color: var(--text-3); font-size: 13px; margin: 48px 0 32px; }
.cx-art tbody th { text-transform: none; letter-spacing: 0; font-size: 14px; font-weight: 600; color: var(--text); text-align: left; }
.cx-art h3 { font-size: 19px; margin: 28px 0 10px; }

/* ---------------- Parādu nomaksa (Sniega bumba / Lavīna) ---------------- */
.cx-vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; padding: 0; border: 0; }
.cx-debts { display: grid; gap: 12px; }
.cx-debt { border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface-2); padding: 12px; margin: 0; min-width: 0; }
.cx-debt-h { display: flex; gap: 8px; align-items: center; margin-bottom: 10px; }
.cx-name { flex: 1; min-width: 0; background: transparent; border: 0; border-bottom: 1px solid var(--line-strong); color: var(--text);
  font: 600 16px/1.3 inherit; font-family: inherit; padding: 6px 2px; }
.cx-name:focus { outline: none; border-bottom-color: var(--accent); }
.cx-name::placeholder { color: var(--text-3); }
.cx-x { flex: none; width: 32px; height: 32px; border-radius: var(--r-full); border: 1px solid var(--line-strong); background: transparent;
  color: var(--text-2); font-size: 18px; line-height: 1; cursor: pointer; }
.cx-x:hover { color: var(--text); border-color: var(--text-3); }
.cx-x:focus-visible, .cx-add:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.cx-x[hidden], .cx-add[hidden] { display: none; }
/* Likmes kolonna nekad šaurāka par savu vārdu ("Oprocentowanie" nelūzt). */
.cx-debt-g { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(min-content, .85fr) minmax(0, 1fr); gap: 8px; }
.cx-mini { display: grid; gap: 4px; align-content: end; }
/* width: 0 — lauks pats neprasa platumu (flex to izstiepj), tāpēc kolonnas platumu nosaka vārds virs tā. */
.cx-mini .cx-inp input { width: 0; }
.cx-mini .cx-lbl { font-size: 11.5px; line-height: 1.25; color: var(--text-3); font-weight: 600; letter-spacing: .02em; }
.cx-mini .cx-inp input { font-size: 16px; padding: 10px 8px; }
.cx-mini .cx-inp > span { padding-right: 8px; font-size: 13px; }
.cx-add { margin: 12px 0 16px; width: 100%; background: transparent; border: 1px dashed var(--line-strong); color: var(--text-2);
  border-radius: var(--r-md); padding: 10px; font: 600 14px/1.2 inherit; font-family: inherit; cursor: pointer; min-height: 40px; }
.cx-add:hover { color: var(--text); border-color: var(--accent-line); }
.cx-field-x { margin-bottom: 0; }

.cx-calc-d { grid-template-columns: 400px minmax(0, 1fr); }
.cx-calc-d .cx-seg { margin-bottom: 14px; }
.cx-kpis-d .cx-kpi.big b { font-size: clamp(22px, 2.6vw, 28px); white-space: normal; }
.cx-msg { margin-top: 16px; border: 1px solid var(--line-strong); background: var(--surface-2); border-radius: var(--r-md); padding: 14px 16px; font-size: 15px; }
.cx-msg b { color: var(--accent); }
.cx-msg[hidden], #cx-res[hidden] { display: none; }
.calc-page .cx-h { font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: var(--text-3); font-weight: 700; margin: 22px 0 6px; line-height: 1.3; }
.cx-order { list-style: none; counter-reset: o; padding: 0; margin: 0; }
.cx-order li { counter-increment: o; display: flex; align-items: baseline; gap: 4px 10px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 14px; flex-wrap: wrap; }
.cx-order li::before { content: counter(o) "."; color: var(--text-3); font-variant-numeric: tabular-nums; min-width: 1.4em; }
.cx-order li i { width: 10px; height: 10px; border-radius: 3px; flex: none; align-self: center; }
.cx-order li b { color: var(--text); font-weight: 600; }
.cx-order li span { color: var(--text-2); margin-left: auto; font-variant-numeric: tabular-nums; }
.cx-cmp { margin-top: 4px; }
.cx-cmp th.on { color: var(--accent); }
.cx-cmp tbody th { text-transform: none; letter-spacing: 0; font-size: 13px; font-weight: 600; color: var(--text-2); }
.cx-cmp td { color: var(--text); white-space: nowrap; }
.cx-notes p { margin: 10px 0 0; font-size: 14px; color: var(--text-2); }
.cx-notes b { color: var(--text); }

/* Parādu krāsas: katram parādam sava, grafikā un sarakstā viena un tā pati. */
.cx-c0 { --c: #a855f7; } .cx-c1 { --c: #38bdf8; } .cx-c2 { --c: #f472b6; }
.cx-c3 { --c: #fb923c; } .cx-c4 { --c: #2dd4bf; } .cx-c5 { --c: #facc15; }
path.cx-st { fill: color-mix(in srgb, var(--c) 45%, transparent); stroke: var(--c); stroke-width: 1.5; stroke-linejoin: round; }
.cx-order li i, #cx-legend i[class^="cx-c"] { background: var(--c); }
#cx-legend i[class^="cx-c"] { width: 10px; height: 10px; border: 0; border-radius: 3px; vertical-align: -1px; }

@media (max-width: 640px) {
  .cx-debt { padding: 10px; }
  .cx-debt-g { gap: 6px; }
  .cx-mini .cx-inp input { padding: 10px 6px; }
  .cx-mini .cx-inp > span { padding-right: 6px; }
  .cx-cmp th, .cx-cmp td { padding: 8px 4px; font-size: 12.5px; }
  .cx-cmp tbody th { font-size: 12px; }
  .cx-cmp td { white-space: normal; }
}

@media (max-width: 900px) {
  .cx-calc { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 640px) {
  .cx-kpis { grid-template-columns: 1fr 1fr; }
  .cx-kpis .big { grid-column: 1 / -1; }
  .cx-kpi b { font-size: 19px; }
  .cx-card { padding: 18px 16px; }
  .cx-cta { grid-template-columns: minmax(0, 1fr); }
  .cx-cta .btn { width: 100%; }
  .cx-art h2 { font-size: 22px; }
  .cx-lead { font-size: 17px; }
  .cx-formula { font-size: 15px; }
  .cx-tbl th, .cx-tbl td { padding: 8px 5px; font-size: 13px; }
  .cx-tbl th { font-size: 10.5px; letter-spacing: .03em; }
  .cx-art .cx-scroll th, .cx-art .cx-scroll td { padding: 8px 6px; }
  .cx-art .cx-scroll td { white-space: normal; }
}
@media (max-width: 560px) {
  .cx-shell { padding: 0 16px; }
}
@media (prefers-reduced-motion: reduce) {
  .cx-calc * { transition: none !important; animation: none !important; }
}
