/* ---------- Tema tokenləri ---------- */

:root {
  --bg: #f6f5f1;
  --surface: #ffffff;
  --raised: #fbfaf8;
  --text: #141416;
  --muted: #7d7d85;
  --faint: #a9a9b0;
  --line: #e7e5df;
  --soft: #f0efea;
  --brand: #0a66c2;
  --brand-soft: #e8f0fa;
  --interest: #d9772f;
  --fee: #9b5fc9;
  --good: #23935f;
  --good-soft: #e3f4eb;
  --warn: #c7811a;
  --warn-soft: #fbf0dc;
  --balance: #9a9aa2;
  --bad: #d14343;
  --bad-soft: #fbe5e5;
  --shadow: 0 1px 2px rgb(20 20 22 / 0.04), 0 4px 16px rgb(20 20 22 / 0.04);
  --thumb-ring: #ffffff;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0d0e11;
    --surface: #15161a;
    --raised: #1a1b20;
    --text: #ededf0;
    --muted: #8b8c94;
    --faint: #5c5d65;
    --line: #25272d;
    --soft: #1e2025;
    --brand: #4d97e6;
    --brand-soft: #172434;
    --interest: #ec9550;
    --fee: #b788e0;
    --good: #4cc38a;
    --good-soft: #15291f;
    --warn: #e3a33f;
    --warn-soft: #2d2415;
    --balance: #6f7078;
    --bad: #e26060;
  --bad-soft: #301a1b;
    --shadow: none;
    --thumb-ring: #15161a;
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #0d0e11;
  --surface: #15161a;
  --raised: #1a1b20;
  --text: #ededf0;
  --muted: #8b8c94;
  --faint: #5c5d65;
  --line: #25272d;
  --soft: #1e2025;
  --brand: #4d97e6;
  --brand-soft: #172434;
  --interest: #ec9550;
    --fee: #b788e0;
    --good: #4cc38a;
    --good-soft: #15291f;
    --warn: #e3a33f;
    --warn-soft: #2d2415;
  --balance: #6f7078;
  --bad: #e26060;
  --bad-soft: #301a1b;
  --shadow: none;
  --thumb-ring: #15161a;
  color-scheme: dark;
}

/* ---------- Əsas ---------- */

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.2s, color 0.2s;
}

main {
  max-width: 1040px;
  margin: 0 auto;
  padding: 20px 16px 56px;
}

button { font: inherit; color: inherit; }

svg { flex: none; }

/* ---------- Yuxarı panel ---------- */

.bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 44px;
}

.back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  text-decoration: none;
  transition: color 0.15s;
}
.back svg { width: 14px; height: 14px; }
.back:hover { color: var(--text); }

.crumbs { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 0.75rem; }
.crumbs > .back + span + .back svg { display: none; }
/* Dar ekranda yalnız "‹ Tətbiqlər" qalır */
@media (max-width: 520px) {
  .crumbs > .back:first-child, .crumbs > span { display: none; }
  .crumbs > .back + span + .back svg { display: block; }
}

.theme {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}
.theme:hover { color: var(--text); border-color: var(--faint); }
.theme svg {
  grid-area: 1 / 1;
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: opacity 0.2s, transform 0.3s;
}
/* İşıqlı temada ay, tünd temada günəş göstərilir */
.theme .sun { opacity: 0; transform: rotate(-45deg) scale(0.6); }
:root[data-theme="dark"] .theme .sun { opacity: 1; transform: none; }
:root[data-theme="dark"] .theme .moon { opacity: 0; transform: rotate(45deg) scale(0.6); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme .sun { opacity: 1; transform: none; }
  :root:not([data-theme="light"]) .theme .moon { opacity: 0; transform: rotate(45deg) scale(0.6); }
}

/* ---------- Başlıq ---------- */

.top { margin: 28px 0 32px; }

h1 {
  margin: 0 0 10px;
  font-family: "Playfair Display", Georgia, serif;
  font-size: clamp(2.6rem, 8vw, 4rem);
  font-weight: 400;
  line-height: 1;
  letter-spacing: -0.02em;
}

.lead {
  margin: 0;
  max-width: 560px;
  color: var(--muted);
}

h2, h3 {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: -0.005em;
}

/* ---------- Kartlar ---------- */

.grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 16px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 24px;
  box-shadow: var(--shadow);
}

.card-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 20px;
}

.chart-card, .table-card { margin-top: 16px; }

/* ---------- Forma ---------- */

.form { display: grid; gap: 24px; align-content: start; }

.field { display: grid; gap: 10px; }

label, .label {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 500;
}
label { display: flex; align-items: center; justify-content: space-between; gap: 8px; }

/* Hədəf ödəniş və hesablanan sahə */
.target { padding-bottom: 24px; border-bottom: 1px dashed var(--line); }
.target[hidden] { display: none; }

.badge {
  display: none;
  padding: 2px 8px;
  border-radius: 99px;
  background: var(--brand-soft);
  color: var(--brand);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.solved .badge { display: inline-block; }
.solved .input-wrap,
.solved .input-wrap:hover {
  border-color: transparent;
  background: var(--brand-soft);
  box-shadow: none;
}
.solved .input-wrap input { color: var(--brand); font-weight: 600; cursor: default; }
.solved .seg.small { opacity: 0.6; }
.solved .range { opacity: 0.35; pointer-events: none; }

body.invalid .tiles,
body.invalid .split,
body.invalid .compare,
body.invalid .chart-card,
body.invalid .table-card { opacity: 0.3; pointer-events: none; transition: opacity 0.2s; }
body.invalid .hero { background: color-mix(in srgb, var(--bad) 12%, transparent); }
body.invalid .hero .label,
body.invalid .hero strong { color: var(--bad); }

.input-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 50px;
  padding: 0 6px 0 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--raised);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.input-wrap:hover { border-color: var(--faint); }
.input-wrap:focus-within {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-soft);
}
.input-wrap.bad { border-color: var(--bad); box-shadow: none; }

.input-wrap input {
  flex: 1;
  min-width: 0;
  height: 100%;
  padding: 0;
  border: 0;
  background: none;
  color: var(--text);
  font: inherit;
  font-size: 1.05rem;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  outline: none;
}
.input-wrap input::-webkit-calendar-picker-indicator { opacity: 0.55; cursor: pointer; }

.unit {
  padding-right: 10px;
  color: var(--muted);
  font-weight: 500;
}

/* Sürüşkən: nazik xətt, dolğu --p dəyişəni ilə */
.range {
  --p: 0%;
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 18px;
  margin: 0;
  background: transparent;
  cursor: pointer;
}
.range:focus { outline: none; }
.range::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: 99px;
  background: linear-gradient(to right, var(--brand) var(--p), var(--soft) var(--p));
}
.range::-moz-range-track {
  height: 4px;
  border-radius: 99px;
  background: var(--soft);
}
.range::-moz-range-progress {
  height: 4px;
  border-radius: 99px;
  background: var(--brand);
}
.range::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  margin-top: -7px;
  border: 3px solid var(--thumb-ring);
  border-radius: 50%;
  background: var(--brand);
  box-shadow: 0 0 0 1px var(--line), 0 1px 3px rgb(0 0 0 / 0.2);
  transition: transform 0.15s;
}
.range::-moz-range-thumb {
  width: 12px;
  height: 12px;
  border: 3px solid var(--thumb-ring);
  border-radius: 50%;
  background: var(--brand);
  box-shadow: 0 0 0 1px var(--line), 0 1px 3px rgb(0 0 0 / 0.2);
}
.range:hover::-webkit-slider-thumb,
.range:focus-visible::-webkit-slider-thumb { transform: scale(1.15); }

.hint {
  margin: 0;
  color: var(--muted);
  font-size: 0.8rem;
}
.hint.warn { color: var(--warn); }
#maxLoanHint:empty { display: none; }

/* Seçim düymələri */
.seg {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: 4px;
  padding: 4px;
  border-radius: 12px;
  background: var(--soft);
}

.seg button {
  height: 40px;
  padding: 0 14px;
  border: 0;
  border-radius: 9px;
  background: none;
  color: var(--muted);
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.15s, color 0.15s;
}
.seg button:hover { color: var(--text); }
.seg button.on {
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 1px 2px rgb(0 0 0 / 0.08), 0 0 0 1px var(--line);
}

.seg.small { padding: 3px; border-radius: 9px; }
.seg.small button { height: 32px; padding: 0 12px; border-radius: 7px; font-size: 0.85rem; }

/* ---------- Nəticə ---------- */

.result { display: flex; flex-direction: column; gap: 20px; }

.hero {
  display: grid;
  gap: 4px;
  padding: 20px;
  border-radius: 14px;
  background: var(--brand-soft);
}
.hero .label { color: var(--brand); }

.hero strong {
  font-family: "Playfair Display", Georgia, serif;
  font-size: clamp(2.6rem, 7vw, 3.4rem);
  font-weight: 400;
  line-height: 1.05;
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
}

.sub { color: var(--muted); font-size: 0.85rem; }

.tiles {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  margin: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--line);
}

.tiles div {
  display: grid;
  gap: 2px;
  padding: 14px 16px;
  background: var(--surface);
}

.tiles dt { color: var(--muted); font-size: 0.78rem; }
.tiles dd {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.tiles dd.accent { color: var(--interest); }
.tiles .wide { grid-column: 1 / -1; display: flex; align-items: baseline; justify-content: space-between; }
.tiles dd small { display: block; margin-top: 1px; color: var(--muted); font-size: 0.78rem; font-weight: 500; }

.split-bar {
  display: flex;
  gap: 3px;
  height: 8px;
}
.split-bar span { border-radius: 99px; transition: width 0.3s; }
#barPrincipal { background: var(--brand); }
#barInterest { background: var(--interest); }
#barFee { background: var(--fee); }
.split-bar span[style*="width: 0%"] { display: none; }
.split-legend [hidden] { display: none; }
.tiles dd.fee { color: var(--fee); }
.dot.f { background: var(--fee); }

.split-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 0.8rem;
}
.split-legend b { color: var(--text); font-weight: 500; font-variant-numeric: tabular-nums; }
.split-legend em { font-style: normal; color: var(--faint); }

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  color: var(--muted);
  font-size: 0.8rem;
}

.dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 6px;
  border-radius: 50%;
  vertical-align: 1px;
}
.dot.p { background: var(--brand); }
.dot.i { background: var(--interest); }
.dot.b { width: 12px; height: 0; border-top: 2px dashed var(--balance); border-radius: 0; vertical-align: 3px; }

.compare {
  margin: auto 0 0;
  padding: 12px 14px;
  border: 1px dashed var(--line);
  border-radius: 12px;
  color: var(--muted);
  font-size: 0.85rem;
}
.compare b { color: var(--text); font-weight: 600; }

/* ---------- Qrafik ---------- */

.chart { position: relative; width: 100%; }
.chart svg { display: block; width: 100%; height: 260px; overflow: visible; }
.chart .axis { fill: var(--faint); font-size: 11px; font-family: inherit; }
.chart .grid-line { stroke: var(--line); stroke-width: 1; stroke-dasharray: 2 4; }
.chart .grid-line.base { stroke-dasharray: none; }
.chart .bp { fill: var(--brand); }
.chart .bi { fill: var(--interest); }
.chart .bal { fill: none; stroke: var(--balance); stroke-width: 1.5; stroke-dasharray: 4 4; }
.chart .hit { fill: transparent; cursor: crosshair; }
.chart .hl { fill: var(--text); opacity: 0.05; }

.chart-card { position: relative; }

.tip {
  position: absolute;
  z-index: 2;
  min-width: 180px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: 0 8px 24px rgb(0 0 0 / 0.14);
  font-size: 0.8rem;
  pointer-events: none;
}
.tip b { display: block; margin-bottom: 6px; font-weight: 600; }
.tip small { color: var(--muted); font-weight: 400; }
.tip div { display: flex; justify-content: space-between; gap: 16px; color: var(--muted); line-height: 1.7; }
.tip span:last-child { color: var(--text); font-variant-numeric: tabular-nums; }

/* ---------- Cədvəl ---------- */

.actions { display: flex; gap: 8px; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--raised);
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 0.15s;
}
.btn:hover { border-color: var(--faint); }
.btn svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.table-wrap {
  max-height: 520px;
  overflow: auto;
  margin: 0 -24px -24px;
  border-top: 1px solid var(--line);
  border-radius: 0 0 18px 18px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.86rem;
  font-variant-numeric: tabular-nums;
}

th, td {
  padding: 11px 16px;
  text-align: right;
  white-space: nowrap;
}
th:first-child, td:first-child { padding-left: 24px; text-align: left; color: var(--faint); }
th:nth-child(2), td:nth-child(2) { text-align: left; }
th:last-child, td:last-child { padding-right: 24px; }

thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

tbody tr:nth-child(even) td { background: var(--raised); }
tbody tr:hover td { background: var(--soft); }
tbody td:nth-child(3) { font-weight: 500; }
tbody td:nth-child(5) { color: var(--interest); }
tbody td:nth-child(6) { color: var(--muted); }

tfoot td {
  position: sticky;
  bottom: 0;
  background: var(--surface);
  border-top: 1px solid var(--line);
  font-weight: 600;
}
tfoot td:first-child { color: var(--text); }

/* ---------- Məlumat ---------- */

.info {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 16px;
}
.info p { margin: 8px 0 0; color: var(--muted); font-size: 0.88rem; }

.foot {
  margin-top: 32px;
  color: var(--faint);
  font-size: 0.8rem;
  text-align: center;
}

/* ---------- Yuxarı panel: paylaş ---------- */

.bar-actions { display: flex; align-items: center; gap: 8px; }
.bar-actions .btn { height: 38px; border-radius: 10px; background: var(--surface); }

/* ---------- İlkin ödəniş ---------- */

.switch {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  color: var(--text);
  font-size: 0.9rem;
  cursor: pointer;
  user-select: none;
}
.switch .muted { color: var(--muted); }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch .track {
  position: relative;
  flex: none;
  width: 36px;
  height: 22px;
  border-radius: 99px;
  background: var(--soft);
  box-shadow: inset 0 0 0 1px var(--line);
  transition: background-color 0.2s;
}
.switch .track::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--surface);
  box-shadow: 0 1px 3px rgb(0 0 0 / 0.25);
  transition: transform 0.2s;
}
.switch input:checked + .track { background: var(--brand); box-shadow: none; }
.switch input:checked + .track::after { transform: translateX(14px); }
.switch input:focus-visible + .track { outline: 2px solid var(--brand); outline-offset: 2px; }

.dp {
  display: grid;
  gap: 24px;
  margin-top: -8px;
  padding: 18px;
  border-radius: 14px;
  background: var(--raised);
  border: 1px solid var(--line);
}
.dp[hidden] { display: none; }
.dp .input-wrap { background: var(--surface); }

/* ---------- Qənaət zolağı ---------- */

.saving {
  margin-top: -8px;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--good-soft);
  color: var(--good);
  font-size: 0.85rem;
}
.saving[hidden] { display: none; }
.saving b { font-weight: 600; }

/* ---------- Əlavə kartlar ---------- */

.grid.extras { margin-top: 16px; }
.prepay, .afford { display: flex; flex-direction: column; gap: 16px; }
.prepay .card-head, .afford .card-head, .offers .card-head { margin-bottom: 4px; }

.input-wrap.sm { height: 40px; padding-left: 12px; border-radius: 10px; }
.input-wrap.sm input { font-size: 0.95rem; }
.input-wrap.sm .unit { padding-right: 8px; font-size: 0.85rem; }

.prepay-list { display: grid; gap: 10px; }
.prepay-list:empty { display: none; }

.prepay-row {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.2fr) auto auto;
  align-items: center;
  gap: 8px;
  padding-bottom: 10px;
  border-bottom: 1px dashed var(--line);
}
.prepay-row .seg.small { padding: 3px; }
.prepay-row .seg.small button { height: 32px; padding: 0 8px; font-size: 0.78rem; white-space: nowrap; }
.prepay-date { grid-column: 1 / -1; margin-top: -2px; color: var(--muted); font-size: 0.75rem; }

.icon-btn {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: none;
  color: var(--faint);
  cursor: pointer;
}
.icon-btn:hover { background: var(--soft); color: var(--bad); }
.icon-btn svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; }

.btn.add { align-self: flex-start; }
.btn.sm { height: 30px; padding: 0 10px; font-size: 0.78rem; }

.pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.pair .field { min-width: 0; grid-template-columns: minmax(0, 1fr); }
.pair .input-wrap { min-width: 0; }
.pair label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }

/* Ödəmə qabiliyyəti */
.afford-out { display: grid; gap: 10px; }
.afford-out[hidden] { display: none; }

.dti-head { display: flex; align-items: baseline; gap: 10px; color: var(--muted); font-size: 0.85rem; }
.dti-head strong {
  color: var(--text);
  font-family: "Playfair Display", Georgia, serif;
  font-size: 2.2rem;
  font-weight: 400;
  line-height: 1;
}

.max-amount {
  display: grid;
  gap: 2px;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--soft);
  color: var(--muted);
  font-size: 0.85rem;
}
.max-amount[hidden] { display: none; }
.max-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 6px 0 4px; }
.max-grid > div { display: grid; gap: 2px; min-width: 0; }
.max-grid em { font-style: normal; font-size: 0.75rem; }
.max-grid small { font-size: 0.75rem; color: var(--faint); }
.max-amount strong {
  color: var(--text);
  font-family: "Playfair Display", Georgia, serif;
  font-size: 1.6rem;
  font-weight: 400;
  line-height: 1.2;
  overflow-wrap: anywhere;
}
.max-amount .hint { margin: 0; }

.chip {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 99px;
  font-size: 0.72rem;
  font-weight: 600;
  white-space: nowrap;
}
.chip.good { background: var(--good-soft); color: var(--good); }
.chip.warn { background: var(--warn-soft); color: var(--warn); }
.chip.bad { background: var(--bad-soft); color: var(--bad); }

.meter {
  position: relative;
  height: 8px;
  border-radius: 99px;
  background: var(--soft);
}
.meter span { position: absolute; inset: 0 auto 0 0; border-radius: 99px; transition: width 0.3s, background-color 0.3s; }
.meter span.good { background: var(--good); }
.meter span.warn { background: var(--warn); }
.meter span.bad { background: var(--bad); }
.meter i { position: absolute; top: -3px; bottom: -3px; width: 2px; margin-left: -1px; border-radius: 2px; background: var(--text); opacity: 0.5; }

.meter-scale { position: relative; height: 14px; color: var(--faint); font-size: 0.7rem; }
.meter-scale span { position: absolute; top: 0; }
.meter-scale span:first-child { left: 0; }
.meter-scale span.mid { transform: translateX(-50%); }
.meter-scale span:last-child { right: 0; }

.afford-text { margin: 0; color: var(--muted); font-size: 0.85rem; }
.afford-text b { color: var(--text); font-weight: 600; }
#useMax { justify-self: start; }
#useMax[hidden] { display: none; }

/* ---------- Qrafik: əlavələr ---------- */

.chart .ex { fill: var(--good); stroke: var(--surface); stroke-width: 1.5; }
.chart .cross-line { stroke: var(--text); stroke-width: 1; stroke-dasharray: 2 3; opacity: 0.45; }
.dot.e { background: var(--good); }
.dot.x { width: 0; height: 10px; border-left: 1.5px dashed var(--muted); border-radius: 0; vertical-align: -1px; }

.cross { margin: 14px 0 0; color: var(--muted); font-size: 0.82rem; }
.cross[hidden] { display: none; }
.cross b { color: var(--text); font-weight: 600; }

/* ---------- Cədvəl: əlavə ödəniş sütunu ---------- */

table.no-extra .c-extra { display: none; }
tbody td.c-extra { color: var(--good); font-weight: 500; }
tbody tr.has-extra td:first-child { box-shadow: inset 3px 0 0 var(--good); }

/* ---------- Təkliflər ---------- */

.offers .card-head { align-items: flex-start; }
.offers .card-head .hint { margin-top: 4px; }
.offers .empty {
  margin: 0;
  padding: 18px;
  border: 1px dashed var(--line);
  border-radius: 12px;
  color: var(--muted);
  font-size: 0.85rem;
  text-align: center;
}
.offers .empty[hidden], .offers-wrap[hidden] { display: none; }

.offers-wrap { overflow-x: auto; margin: 0 -24px -24px; border-top: 1px solid var(--line); }
.offers-table td { vertical-align: middle; }
.offers-table td:first-child { color: var(--text); }
.offers-table .name {
  width: 100%;
  min-width: 120px;
  padding: 4px 6px;
  margin-left: -6px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: none;
  color: var(--text);
  font: inherit;
  font-weight: 600;
}
.offers-table .name:hover { border-color: var(--line); }
.offers-table .name:focus { outline: none; border-color: var(--brand); background: var(--raised); }
.offers-table .chip { margin-top: 4px; }
.offers-table .terms { color: var(--muted); font-size: 0.8rem; line-height: 1.45; text-align: left; }
.offers-table .accent { color: var(--interest); }
.offers-table tr.best td { background: color-mix(in srgb, var(--good-soft) 60%, transparent); }
.offers-table tbody tr:nth-child(even) td { background: none; }
.offers-table tbody tr.best td { background: color-mix(in srgb, var(--good-soft) 60%, transparent); }
.row-actions { display: flex; justify-content: flex-end; align-items: center; gap: 4px; }
.offers-table th:nth-child(2) { text-align: left; }

/* ---------- Bildiriş ---------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 10;
  padding: 10px 16px;
  border-radius: 10px;
  background: var(--text);
  color: var(--bg);
  font-size: 0.85rem;
  font-weight: 500;
  box-shadow: 0 8px 24px rgb(0 0 0 / 0.2);
  opacity: 0;
  transform: translate(-50%, 8px);
  transition: opacity 0.2s, transform 0.2s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* Yalnız çapda görünənlər */
.print-meta, .print-summary { display: none; }

/* ---------- Mobil ---------- */

@media (max-width: 760px) {
  .top { margin: 20px 0 24px; }
  .grid, .info { grid-template-columns: 1fr; }
  .card { padding: 18px; border-radius: 16px; }
  .hero { padding: 16px; }
  .table-wrap, .offers-wrap { margin: 0 -18px -18px; border-radius: 0 0 16px 16px; }
  th, td { padding-left: 10px; padding-right: 10px; }
  th:first-child, td:first-child { padding-left: 18px; }
  th:last-child, td:last-child { padding-right: 18px; }
  .chart svg { height: 200px; }
  .bar-actions .btn { padding: 0 10px; }
  .prepay-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr) auto; }
  .prepay-row .seg.small { grid-column: 1 / -1; grid-row: 2; }
  .prepay-row .icon-btn { grid-column: 3; grid-row: 1; }
  .prepay-date { grid-column: 1 / -1; grid-row: 3; }
  .pair { grid-template-columns: 1fr; }
}

@media (max-width: 420px) {
  .bar-actions .btn { font-size: 0; gap: 0; width: 38px; justify-content: center; padding: 0; }
  .bar-actions .btn svg { width: 16px; height: 16px; }
}

/* ---------- Çap / PDF ---------- */

@media print {
  @page { size: A4; margin: 14mm 12mm; }

  :root, :root:not([data-theme="light"]), :root[data-theme] {
    --bg: #fff; --surface: #fff; --raised: #fff; --soft: #f1f1f1;
    --text: #111; --muted: #555; --faint: #888; --line: #d9d9d9;
    --brand: #0a66c2; --brand-soft: #eef4fb; --interest: #c96a22; --fee: #8a4fbf;
    --good: #1f8454; --good-soft: #e6f4ec; --balance: #888; --shadow: none;
    color-scheme: light;
  }

  body { background: #fff; font-size: 11px; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  main { max-width: none; padding: 0; }

  .bar, #form, .extras, .offers, .info, .actions, .tip, .toast, .compare { display: none !important; }

  .top { margin: 0 0 12px; padding-bottom: 10px; border-bottom: 2px solid var(--text); }
  h1 { font-size: 26pt; margin-bottom: 4px; }
  .lead { display: none; }
  .print-meta { display: block; margin: 0; color: var(--muted); font-size: 9pt; }

  .print-summary {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px 16px;
    margin: 0 0 12px;
  }
  .print-summary div { display: grid; padding: 6px 0; border-bottom: 1px solid var(--line); }
  .print-summary dt { color: var(--muted); font-size: 8pt; }
  .print-summary dd { margin: 0; font-weight: 600; }

  .grid { display: block; }
  .card { padding: 12px 14px; border-radius: 8px; break-inside: avoid; }
  .result { gap: 10px; }
  .hero { padding: 10px 12px; }
  .hero strong { font-size: 24pt; }
  .tiles { grid-template-columns: repeat(3, 1fr); }
  .tiles div { padding: 8px 10px; }

  .chart-card { margin-top: 10px; }
  .chart svg { height: 190px; }

  .table-card { margin-top: 10px; break-inside: auto; }
  .table-card .card-head { margin-bottom: 8px; }
  .table-wrap { max-height: none; overflow: visible; margin: 0; border-radius: 0; }
  table { font-size: 9pt; }
  th, td { padding: 4px 8px; }
  th:first-child, td:first-child { padding-left: 4px; }
  th:last-child, td:last-child { padding-right: 4px; }
  thead { display: table-header-group; }
  thead th, tfoot td { position: static; }
  tr { break-inside: avoid; }
  tbody tr:nth-child(even) td { background: #f7f7f7; }

  .foot { margin-top: 12px; text-align: left; }
}

.prepay-row.late .prepay-date { color: var(--warn); }
.prepay-row.late .input-wrap { opacity: 0.6; }

/* Təkliflər cədvəli: ödəniş cədvəlinin sütun rənglərini sıfırla */
.offers-table tbody td:nth-child(n) { color: var(--text); font-weight: 400; }
.offers-table tbody td.accent { color: var(--interest); }
.offers-table tbody td.terms { color: var(--muted); }
.offers-table td:first-child { min-width: 150px; white-space: normal; }
.offers-table .name { display: block; }
.offers-table td.terms { min-width: 190px; white-space: normal; }
.offers-table td b { font-weight: 600; }
.offers-table td.row-actions { display: table-cell; text-align: right; white-space: nowrap; }
.offers-table td.row-actions > * { vertical-align: middle; }
.offers-table td.row-actions .icon-btn { display: inline-grid; margin-left: 2px; }

/* ---------- Kalkulyatorlar arası keçid ---------- */

.apps-switch {
  display: inline-flex;
  gap: 4px;
  margin-bottom: 18px;
  padding: 4px;
  border-radius: 12px;
  background: var(--soft);
}
.apps-switch a {
  padding: 7px 16px;
  border-radius: 9px;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 500;
  text-decoration: none;
  transition: color 0.15s, background-color 0.15s;
}
.apps-switch a:hover { color: var(--text); }
.apps-switch a.on {
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 1px 2px rgb(0 0 0 / 0.08), 0 0 0 1px var(--line);
}

/* ---------- Depozit ---------- */

.seg.grid2 { grid-auto-flow: row; grid-template-columns: 1fr 1fr; }
.seg.grid2 button { height: 38px; font-size: 0.85rem; }

.hero.deposit { background: var(--good-soft); }
.hero.deposit .label { color: var(--good); }
body.invalid .hero.deposit { background: color-mix(in srgb, var(--bad) 12%, transparent); }

.tiles dd.good { color: var(--good); }
.tiles dd.bad { color: var(--bad); }
#barNet { background: var(--good); }
#barTax { background: var(--bad); }
.dot.g { background: var(--good); }
.dot.t { background: var(--bad); }
.chart .bg { fill: var(--good); }

table.no-tax .c-tax,
table.no-paid .c-paid,
table.no-add .c-add { display: none; }
tbody td.c-net { color: var(--good); }
tbody td.c-tax { color: var(--bad); }

@media print {
  .apps-switch { display: none; }
}

.tiles [hidden] { display: none; }
.form-note { margin-top: -12px; }

/* Depozit cədvəli: kredit cədvəlinin sütun rənglərini sıfırla */
.dep-table tbody td:nth-child(n) { color: var(--text); font-weight: 400; }
.dep-table tbody td:first-child { color: var(--faint); }
.dep-table tbody td.c-net { color: var(--good); }
.dep-table tbody td.c-tax { color: var(--bad); }
.dep-table tbody td:last-child { font-weight: 500; }
.offers-table tbody td.good { color: var(--good); }

/* Beş seçimli düymələr (kapitallaşma, faizin ödənilməsi) */
.seg.five { grid-auto-flow: row; grid-template-columns: repeat(5, minmax(0, 1fr)); }
.seg.five button { padding: 0 4px; font-size: 0.85rem; }
.seg.off { opacity: 0.45; pointer-events: none; }
table.no-cap .c-cap { display: none; }
.dep-table tbody td.c-cap { color: var(--good); }
@media (max-width: 420px) {
  .seg.five button { font-size: 0.76rem; }
}

/* ---------- Dil seçimi ---------- */

.lang-switch {
  display: flex;
  gap: 2px;
  height: 38px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
}
.lang-switch button {
  min-width: 32px;
  padding: 0 6px;
  border: 0;
  border-radius: 7px;
  background: none;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  cursor: pointer;
}
.lang-switch button:hover { color: var(--text); }
.lang-switch button.on { background: var(--soft); color: var(--text); }

@media (max-width: 420px) {
  .lang-switch button { min-width: 28px; padding: 0 4px; }
}
@media print {
  .lang-switch { display: none; }
}

/* Uzun tərcümələr (ru, en) seçim düymələrini və kartları genişləndirməsin */
.seg { grid-auto-columns: minmax(0, 1fr); }
.seg button { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 760px) {
  .grid, .info { grid-template-columns: minmax(0, 1fr); }
  .seg:not(.small) button { padding: 0 6px; }
}
.form, .field, .dp { grid-template-columns: minmax(0, 1fr); }
.seg.small { grid-auto-columns: auto; }
.seg.small button { overflow: visible; }
@media (max-width: 420px) {
  .seg:not(.small) button {
    height: auto;
    min-height: 40px;
    padding: 4px;
    line-height: 1.15;
    white-space: normal;
    text-overflow: clip;
    overflow-wrap: anywhere;
  }
  .seg.five { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* ---------- Altlıq: LinkedIn ---------- */

.foot { display: flex; flex-direction: column; align-items: center; gap: 14px; }

.foot-in {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--muted);
  transition: color 0.15s, border-color 0.15s, background-color 0.15s;
}
.foot-in svg { width: 16px; height: 16px; fill: currentColor; }
.foot-in:hover { border-color: var(--brand); background: var(--brand); color: #fff; }
.foot-in:focus-visible { outline: 2px solid var(--brand); outline-offset: 3px; }

@media print {
  .foot-in { display: none; }
}

/* ---------- İnflyasiya ---------- */

.years {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: end;
  gap: 8px;
}
.years .swap { width: 40px; height: 50px; border-radius: 12px; color: var(--muted); }
.years .swap:hover { background: var(--soft); color: var(--text); }
.years .swap svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }

.select-wrap { position: relative; padding-right: 36px; }
.select-wrap::after {
  content: "";
  position: absolute;
  right: 16px;
  top: 50%;
  width: 7px;
  height: 7px;
  margin-top: -5px;
  border-right: 1.6px solid var(--muted);
  border-bottom: 1.6px solid var(--muted);
  transform: rotate(45deg);
  pointer-events: none;
}
.select-wrap select {
  flex: 1;
  min-width: 0;
  height: 100%;
  padding: 0;
  border: 0;
  background: none;
  color: var(--text);
  font: inherit;
  font-size: 1.05rem;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
  outline: none;
}
.select-wrap select option { color: #141416; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips .btn.on { border-color: var(--brand); background: var(--brand-soft); color: var(--brand); }

.forecast { margin-top: 16px; display: flex; flex-direction: column; gap: 16px; }
.forecast .card-head { margin-bottom: 0; }
.forecast .card-head .hint { margin-top: 4px; }
.forecast-text {
  margin: 0;
  padding: 14px 16px;
  border-radius: 12px;
  background: var(--soft);
  color: var(--muted);
  font-size: 0.9rem;
}
.forecast-text b { color: var(--text); font-weight: 600; }
.forecast-text .muted { display: block; margin-top: 6px; font-size: 0.8rem; color: var(--faint); }

.chart .bn { fill: var(--line); }
.dot.n { background: var(--line); }

.inf-table tbody td:nth-child(n) { color: var(--text); font-weight: 400; }
.inf-table th:nth-child(2), .inf-table td:nth-child(2) { text-align: right; }
.inf-table tbody td:first-child { color: var(--muted); }
.inf-table tbody td:nth-child(2) { color: var(--interest); }
.inf-table tbody td:last-child { font-weight: 500; }
.inf-table tbody tr.target td { background: var(--brand-soft); }

@media print {
  .forecast, .chips, .years .swap { display: none; }
}

/* ---------- Maaş ---------- */

#barHeld { background: var(--bad); }
#barEmployer { background: var(--fee); }
#yearField[hidden] { display: none; }

.sal-table tbody td:nth-child(n) { color: var(--text); font-weight: 500; vertical-align: top; }
.sal-table tbody td:first-child { color: var(--text); font-weight: 400; }
.sal-table td small { display: block; margin-top: 2px; color: var(--faint); font-size: 0.72rem; font-weight: 400; }

/* ---------- Məbləğ sözlə ---------- */

.seg.six { grid-template-columns: repeat(6, minmax(0, 1fr)); grid-auto-flow: row; }
.seg.six button { padding: 0 4px; }
@media (max-width: 420px) {
  .seg.six { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

.hero.words { gap: 12px; }
.words-main {
  margin: 0;
  font-family: "Playfair Display", Georgia, serif;
  font-size: clamp(1.4rem, 3.6vw, 1.85rem);
  line-height: 1.25;
  overflow-wrap: anywhere;
}
.hero.words .btn { justify-self: start; background: var(--surface); }

.variants { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.variants li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 8px;
  padding: 12px 8px 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
}
.variants p { margin: 4px 0 0; overflow-wrap: anywhere; }
.variants .icon-btn:hover { color: var(--brand); }

/* ---------- Valyuta ---------- */

.input-wrap.search { width: 220px; max-width: 100%; }
.input-wrap.search input { font-size: 0.88rem; font-weight: 400; }
.select-wrap select optgroup { color: #141416; }

.fx-table tbody td:nth-child(n) { color: var(--text); font-weight: 400; }
.fx-table tbody td:first-child { font-weight: 600; }
.fx-table td:nth-child(2) { white-space: normal; min-width: 160px; }
.fx-table td small { margin-left: 6px; color: var(--faint); font-size: 0.72rem; font-weight: 400; }
.fx-table tbody td.up { color: var(--good); }
.fx-table tbody td.down { color: var(--bad); }
.fx-table tbody td:last-child { font-weight: 500; }
.fx-table tbody tr { cursor: pointer; }
.fx-table tbody tr:focus-visible { outline: 2px solid var(--brand); outline-offset: -2px; }
.fx-table tbody tr.sel td { background: var(--brand-soft); }
.fx-table td.empty-row { padding: 24px; color: var(--muted); text-align: center; }
.compare[hidden] { display: none; }

@media (max-width: 760px) {
  .input-wrap.search { width: 100%; }
  .fx-table th:nth-child(2), .fx-table td:nth-child(2) { display: none; }
}

/* ---------- Kart yoxlayıcı ---------- */

.hero.ok { background: var(--good-soft); }
.hero.ok .label { color: var(--good); }
.hero.bad { background: var(--bad-soft); }
.hero.bad .label, .hero.bad strong { color: var(--bad); }

.bank-card {
  --c1: #3a3d46;
  --c2: #17181c;
  position: relative;
  display: grid;
  grid-template-rows: auto 1fr auto;
  aspect-ratio: 1.586;
  width: 100%;
  max-width: 360px;
  padding: 22px 24px;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--c1), var(--c2));
  color: #fff;
  box-shadow: 0 10px 30px rgb(0 0 0 / 0.18);
  transition: background 0.3s;
}
.bank-card[data-net="visa"] { --c1: #1a3d8f; --c2: #0b1a45; }
.bank-card[data-net="mastercard"] { --c1: #d4481f; --c2: #6b1d0c; }
.bank-card[data-net="amex"] { --c1: #2c78b8; --c2: #12395c; }
.bank-card[data-net="maestro"] { --c1: #0f6cb6; --c2: #a8213b; }
.bank-card[data-net="unionpay"] { --c1: #c8102e; --c2: #00537a; }
.bank-card[data-net="mir"] { --c1: #1f8f5a; --c2: #0d4d84; }
.bank-card[data-net="jcb"] { --c1: #0b6b3a; --c2: #0e3f75; }
.bank-card[data-net="discover"] { --c1: #f08a24; --c2: #5c2e05; }
.bank-card[data-net="diners"] { --c1: #3d6f8f; --c2: #14283a; }
.bank-card[data-net="troy"] { --c1: #13a3a3; --c2: #0b3c4a; }
.chip-icon {
  width: 40px;
  height: 30px;
  border-radius: 6px;
  background: linear-gradient(135deg, #e9d48a, #b89a45);
}
.card-net {
  position: absolute;
  top: 22px;
  right: 24px;
  font-family: "Playfair Display", Georgia, serif;
  font-size: 1.2rem;
  font-style: italic;
}
.card-num {
  align-self: end;
  font-size: clamp(1.05rem, 4.6vw, 1.35rem);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.08em;
  white-space: nowrap;
}
.card-iin { min-height: 1.2em; margin-top: 6px; color: rgb(255 255 255 / 0.6); font-size: 0.75rem; letter-spacing: 0.1em; }

.mono { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-variant-numeric: tabular-nums; }

.bulk, .gen { margin-top: 16px; display: flex; flex-direction: column; gap: 14px; }
.bulk .card-head, .gen .card-head { margin-bottom: 0; align-items: flex-start; }
.bulk .card-head .hint, .gen .card-head .hint { margin-top: 4px; max-width: 560px; }
.bulk-input {
  width: 100%;
  min-height: 120px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--raised);
  color: var(--text);
  font: 0.95rem/1.6 ui-monospace, "SF Mono", Menlo, monospace;
  resize: vertical;
  outline: none;
}
.bulk-input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.bulk .table-wrap[hidden] { display: none; }
.btn:disabled { opacity: 0.5; cursor: default; }

.card-table tbody td:nth-child(n) { color: var(--text); font-weight: 400; }
.card-table tbody td:first-child { color: var(--faint); }
.card-table tbody td.good { color: var(--good); font-weight: 500; }
.card-table tbody td.bad { color: var(--bad); font-weight: 500; }

.gen-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 8px; margin: 0; padding: 0; list-style: none; }
.gen-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 8px 8px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--raised);
}
.gen-list .icon-btn:hover { color: var(--brand); }

.legal-note {
  display: inline-flex;
  align-items: flex-start;
  gap: 8px;
  max-width: 560px;
  margin: 16px 0 0;
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.4;
}
.legal-note svg { width: 16px; height: 16px; margin-top: 1px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
@media print {
  .legal-note { margin-top: 6px; padding: 0; border: 0; background: none; font-size: 8pt; }
}

/* ---------- IBAN yoxlayıcı ---------- */

.actions.wrap { flex-wrap: wrap; }
.field > label .btn.sm { color: var(--muted); }
.field > label .btn.sm:hover { color: var(--text); }

.iban-parts { display: flex; flex-wrap: wrap; gap: 6px; }
.part {
  --c: var(--text);
  display: grid;
  gap: 2px;
  min-width: 0;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--soft);
}
.part b {
  color: var(--c);
  font-size: 1rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  white-space: nowrap;
}
.part span { color: var(--muted); font-size: 0.72rem; white-space: nowrap; }
.part.cc { --c: var(--brand); background: var(--brand-soft); }
.part.ck { --c: var(--interest); background: color-mix(in srgb, var(--interest) 12%, transparent); }
.part.bank { --c: var(--good); background: var(--good-soft); }
.part.acc { flex: 1 1 100%; }
.part.acc b { overflow-wrap: anywhere; white-space: normal; }

.iban-table td.mono { letter-spacing: 0.02em; }
.iban-table tbody td:nth-child(3), .iban-table tbody td:nth-child(4) { white-space: normal; }
