:root {
  --bg: #f6f5f2;
  --surface: #ffffff;
  --surface-2: #f0eee9;
  --text: #1d1c1a;
  --muted: #6b6862;
  --border: #e2dfd8;
  --accent: #c2410c;
  --accent-soft: #fbe6da;
  --pos: #15803d;
  --neg: #b91c1c;
  --c-usd: #15803d;
  --c-eur: #2563eb;
  --c-gold: #b7791f;
  --c-deposit: #7c3aed;
  --c-bist: #0e7490;
  --c-mali: #be123c; --c-sinai: #475569; --c-tek: #0d9488; --c-tlref: #65a30d;
  --c-hizmet: #a21caf; --c-tum: #1d4ed8; --c-silver: #71717a;
  --c-f1: #db2777; --c-f2: #4d7c0f; --c-f3: #9333ea; --c-f4: #0369a1; --c-f5: #a16207;
  --c-port: var(--accent);
  --grid: #ebe8e1;
  --banner-bg: #fff4d6;
  --banner-border: #f0d78a;
  --radius: 12px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #151412;
    --surface: #1e1d1a;
    --surface-2: #272522;
    --text: #ece9e3;
    --muted: #a19d95;
    --border: #34312c;
    --accent: #fb923c;
    --accent-soft: #3a2518;
    --pos: #4ade80;
    --neg: #f87171;
    --c-usd: #4ade80;
    --c-eur: #60a5fa;
    --c-gold: #fbbf24;
    --c-deposit: #a78bfa;
    --c-bist: #22d3ee;
    --c-mali: #fb7185; --c-sinai: #94a3b8; --c-tek: #2dd4bf; --c-tlref: #a3e635;
    --c-hizmet: #e879f9; --c-tum: #93c5fd; --c-silver: #d4d4d8;
    --c-f1: #f472b6; --c-f2: #a3e635; --c-f3: #c084fc; --c-f4: #38bdf8; --c-f5: #facc15;
    --grid: #2b2925;
    --banner-bg: #33290f;
    --banner-border: #5c4a17;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #151412; --surface: #1e1d1a; --surface-2: #272522; --text: #ece9e3; --muted: #a19d95;
  --border: #34312c; --accent: #fb923c; --accent-soft: #3a2518; --pos: #4ade80; --neg: #f87171;
  --c-usd: #4ade80; --c-eur: #60a5fa; --c-gold: #fbbf24; --c-deposit: #a78bfa; --c-bist: #22d3ee; --grid: #2b2925;
  --c-mali: #fb7185; --c-sinai: #94a3b8; --c-tek: #2dd4bf; --c-tlref: #a3e635;
  --c-hizmet: #e879f9; --c-tum: #93c5fd; --c-silver: #d4d4d8;
  --c-f1: #f472b6; --c-f2: #a3e635; --c-f3: #c084fc; --c-f4: #38bdf8; --c-f5: #facc15;
  --banner-bg: #33290f; --banner-border: #5c4a17; color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-variant-numeric: tabular-nums;
}
h2 { font-size: 15px; margin: 0 0 10px; font-weight: 650; }
code { font-size: 13px; background: var(--surface-2); padding: 1px 5px; border-radius: 5px; }
.wrap { max-width: 1200px; margin: 0 auto; padding: 0 16px; }
.muted { color: var(--muted); }
.small { font-size: 13px; font-weight: 400; }
.hint { color: var(--muted); font-size: 13px; margin: 6px 0 0; }

.top { border-bottom: 1px solid var(--border); background: var(--surface); }
.top-inner { display: flex; align-items: baseline; gap: 16px; flex-wrap: wrap; padding-top: 14px; padding-bottom: 14px; }
.brand { font-weight: 750; font-size: 20px; letter-spacing: -0.02em; }
.logo { color: var(--accent); }
.tag { margin: 0; color: var(--muted); font-size: 14px; }

.banner {
  margin-top: 16px;
  background: var(--banner-bg);
  border: 1px solid var(--banner-border);
  border-radius: var(--radius);
  padding: 10px 14px;
  font-size: 14px;
  max-width: calc(1200px - 32px);
}
@media (max-width: 1232px) { .banner { margin-left: 16px; margin-right: 16px; } }

.layout { display: grid; grid-template-columns: 320px 1fr; gap: 20px; padding-top: 20px; padding-bottom: 20px; align-items: start; }
@media (max-width: 900px) { .layout { grid-template-columns: 1fr; } }

.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; min-width: 0; }
.controls { position: sticky; top: 16px; display: flex; flex-direction: column; gap: 20px; }
@media (max-width: 900px) { .controls { position: static; } }
.results { display: flex; flex-direction: column; gap: 16px; min-width: 0; }

.wrow { display: grid; grid-template-columns: 12px 1fr 52px; gap: 8px; align-items: center; margin-bottom: 8px; }
.wrow .dot { width: 10px; height: 10px; border-radius: 50%; }
.wrow label { font-size: 14px; display: flex; flex-direction: column; gap: 2px; }
.wrow input[type=range] { width: 100%; accent-color: var(--accent); }
.wrow .pct { text-align: right; font-weight: 600; font-size: 14px; }
.sum-row { display: flex; justify-content: space-between; align-items: center; font-size: 14px; margin-top: 4px; }
.sum-row.bad strong { color: var(--neg); }
.presets { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 12px; }

button { font: inherit; color: inherit; cursor: pointer; }
.btn-ghost { background: none; border: 1px solid var(--border); border-radius: 8px; padding: 4px 10px; font-size: 13px; }
.btn-ghost:hover { background: var(--surface-2); }
.chip { background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px; padding: 3px 10px; font-size: 13px; }
.chip:hover { border-color: var(--accent); }

.field { font-size: 13px; color: var(--muted); display: flex; flex-direction: column; gap: 4px; margin-bottom: 8px; }
input[type=text] { font: inherit; color: var(--text); background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 6px 8px; width: 100%; }
.file-btn { display: inline-block; border: 1px dashed var(--border); border-radius: 8px; padding: 6px 12px; font-size: 13px; cursor: pointer; }
.file-btn:hover { border-color: var(--accent); }
.file-btn input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.file-btn:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
#fund-msg.bad { color: var(--neg); }
.wrow .rm { background: none; border: 0; color: var(--muted); font-size: 12px; padding: 0 0 0 6px; text-decoration: underline; }
.wrow .rm:hover { color: var(--neg); }
.sharebar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.dca-controls { display: flex; gap: 16px; align-items: flex-end; flex-wrap: wrap; margin: 12px 0; }
.dca-controls .field { margin: 0; width: 180px; }
.dca-controls .toggle { max-width: 420px; }
input[type=number] { font: inherit; color: var(--text); background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 6px 8px; width: 100%; }
.pinbox { margin-top: 14px; padding-top: 12px; border-top: 1px dashed var(--border); }
.pinbox .hint button { font-size: 12.5px; }
.lump-date { width: 220px; }
.headline { font-size: 16px; line-height: 1.5; margin: 4px 0 12px; }
.headline strong { font-weight: 700; }
td.delta { font-weight: 600; }
#dca-tiles .v { font-size: 20px; white-space: nowrap; }
h3.sub { font-size: 13.5px; font-weight: 600; margin: 18px 0 6px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.row2 label { font-size: 13px; color: var(--muted); display: flex; flex-direction: column; gap: 4px; }
select { font: inherit; color: var(--text); background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 6px 8px; width: 100%; }

.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 3px; gap: 3px; }
.seg button { background: none; border: 0; border-radius: 7px; padding: 6px 4px; font-size: 13px; }
.seg button[aria-pressed="true"] { background: var(--surface); box-shadow: 0 1px 2px rgba(0,0,0,.12); font-weight: 600; }

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
.tile { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; }
.tile .k { font-size: 12.5px; color: var(--muted); }
.tile .v { font-size: 24px; font-weight: 700; letter-spacing: -0.02em; margin-top: 2px; }
.tile .s { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.pos { color: var(--pos); }
.neg { color: var(--neg); }

.callout { background: var(--accent-soft); border-radius: var(--radius); padding: 12px 16px; font-size: 14.5px; }
.callout:empty { display: none; }

.card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.toggle { font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 13px; margin: 2px 0 8px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { display: inline-block; width: 14px; height: 3px; border-radius: 2px; }
.chart { width: 100%; height: 300px; position: relative; }
.chart.short { height: 160px; }
.chart svg { display: block; width: 100%; height: 100%; overflow: visible; }
.chart text { fill: var(--muted); font-size: 11px; }
.chart .gridline { stroke: var(--grid); stroke-width: 1; }
.chart .zero { stroke: var(--muted); stroke-width: 1; opacity: .5; }
.chart .cursor { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 3 3; }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 1100px) { .grid2 { grid-template-columns: 1fr; } }

.tbl-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 13.5px; }
th, td { padding: 6px 8px; text-align: right; white-space: nowrap; }
th:first-child, td:first-child { text-align: left; }
thead th { color: var(--muted); font-weight: 500; border-bottom: 1px solid var(--border); }
tbody tr + tr td { border-top: 1px solid var(--grid); }
td.port, th.port { font-weight: 650; }
.corr td.cell { text-align: center; font-weight: 600; border-radius: 6px; }
.corr { border-collapse: separate; border-spacing: 3px; }

.error { background: var(--surface); border: 1px solid var(--neg); color: var(--neg); border-radius: var(--radius); padding: 12px 16px; }

.tooltip {
  position: fixed; z-index: 10; pointer-events: none;
  background: var(--surface); border: 1px solid var(--border); border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0,0,0,.15); padding: 8px 10px; font-size: 12.5px; min-width: 150px;
}
.tooltip .t { font-weight: 650; margin-bottom: 4px; }
.tooltip .r { display: flex; justify-content: space-between; gap: 12px; }
.tooltip i { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; }

.foot { color: var(--muted); font-size: 13px; padding-bottom: 32px; }
.foot p { margin: 6px 0; max-width: 900px; }

/* Maliyet ayarları */
.costs { display: grid; gap: 8px; margin-top: 10px; }
.costs label { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 13.5px; }
.costs label span { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); }
.costs input[type=number] { width: 76px; text-align: right; }

/* Ek varlıklar */
details.extra { margin: 6px 0 4px; }
details.extra summary { cursor: pointer; font-size: 13.5px; color: var(--muted); margin-bottom: 8px; }
details.extra[open] summary { color: var(--text); }

/* Açıklama düğmesi ve kutusu */
button.info {
  display: inline-flex; align-items: center; justify-content: center;
  width: 17px; height: 17px; border-radius: 50%; padding: 0; margin-left: 4px; vertical-align: 1px;
  border: 1px solid var(--border); background: var(--surface-2); color: var(--muted);
  font: italic 600 11px/1 Georgia, serif;
}
button.info:hover, button.info[aria-expanded="true"] { border-color: var(--accent); color: var(--accent); }
.infopop {
  position: absolute; z-index: 20; max-width: min(340px, calc(100vw - 32px));
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  box-shadow: 0 6px 24px rgba(0,0,0,.18); padding: 12px 14px; font-size: 13.5px; line-height: 1.5;
}
.infopop strong { display: block; margin-bottom: 4px; }

/* Histogram ve listeler */
.chart .bar-pos { fill: var(--pos); opacity: .75; }
.chart .bar-neg { fill: var(--neg); opacity: .75; }
.grid2.tight { gap: 12px; margin-top: 10px; }
.mini h3 { margin-top: 0; }

/* Yıllara göre ısı tablosu */
table.years td.cell { text-align: right; border-radius: 4px; }
table.years td.lead { font-weight: 750; outline: 2px solid var(--text); outline-offset: -2px; }
table.years { border-collapse: separate; border-spacing: 2px; }

/* ---- Görünüm seçimi ---- */
.view-toggle { margin-left: auto; min-width: 190px; }
body[data-view="simple"] #detailed, body[data-view="simple"] #demo-banner-detail { display: none; }
body[data-view="detailed"] #simple { display: none; }
.intro { margin: 0; color: var(--muted); font-size: 14px; }
.info-inline { display: inline-flex; width: 16px; height: 16px; border-radius: 50%; border: 1px solid var(--border); align-items: center; justify-content: center; font: italic 600 10px/1 Georgia, serif; }

/* Mobilde ayarlar katlanır */
.more-btn { display: none; }
@media (max-width: 900px) {
  .more-btn { display: block; width: 100%; margin-top: 12px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; font-size: 13.5px; text-align: left; }
  .controls:not(.expanded) > section:not(:first-of-type) { display: none; }
  .controls { gap: 14px; }
}

/* ---- Basit görünüm ---- */
.simple { padding-top: 24px; padding-bottom: 8px; max-width: 880px; }
.hero h1 { font-size: clamp(24px, 4.2vw, 34px); line-height: 1.2; letter-spacing: -0.02em; margin: 0 0 8px; }
.hero p { margin: 0 0 20px; color: var(--muted); font-size: 16px; }
.qcards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 16px; }
@media (max-width: 760px) { .qcards { grid-template-columns: 1fr 1fr; } }
.qcard { text-align: left; background: var(--surface); border: 1.5px solid var(--border); border-radius: var(--radius); padding: 12px 14px; display: flex; flex-direction: column; gap: 4px; min-height: 76px; }
.qcard strong { font-size: 15px; line-height: 1.3; }
.qcard span { font-size: 12.5px; color: var(--muted); }
.qcard:hover { border-color: var(--accent); }
.qcard[aria-selected="true"] { border-color: var(--accent); background: var(--accent-soft); }
.qpanel { padding: 18px; }
.s-controls { display: flex; flex-wrap: wrap; gap: 14px 22px; align-items: flex-end; padding-bottom: 16px; border-bottom: 1px solid var(--border); margin-bottom: 16px; }
.s-field { display: flex; flex-direction: column; gap: 6px; font-size: 13.5px; color: var(--muted); }
.s-field small { font-weight: 400; }
.money { display: inline-flex; align-items: center; gap: 6px; color: var(--text); font-weight: 600; }
.money input { width: 140px; font-size: 18px; font-weight: 650; padding: 8px 10px; }
.s-field .row2 { width: 220px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips .chip { padding: 6px 12px; font-size: 14px; }
.chips .chip[aria-checked="true"] { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.answer { font-size: clamp(19px, 2.6vw, 23px); line-height: 1.4; margin: 0 0 8px; }
.answer-sub { font-size: 15.5px; line-height: 1.55; color: var(--text); margin: 0 0 6px; }
.hbars { display: flex; flex-direction: column; gap: 10px; margin: 6px 0 18px; }
.hbar { display: grid; grid-template-columns: minmax(110px, 1.1fr) 2fr minmax(96px, auto); gap: 12px; align-items: center; font-size: 14px; }
.hbar.chosen .hb-label { font-weight: 700; }
.hbar.chosen .hb-track { outline: 2px solid var(--accent); outline-offset: 2px; }
.hb-label small { display: block; color: var(--muted); font-size: 11.5px; font-weight: 400; }
.hb-track { position: relative; height: 14px; background: var(--surface-2); border-radius: 7px; }
.hb-zero { position: absolute; top: -3px; bottom: -3px; width: 1.5px; background: var(--muted); }
.hb-fill { position: absolute; top: 0; bottom: 0; border-radius: 7px; }
.hb-fill.pos { background: var(--pos); }
.hb-fill.neg { background: var(--neg); }
.hb-fill.zero { background: var(--muted); }
.hb-val { text-align: right; display: flex; flex-direction: column; line-height: 1.25; }
.hb-val small { color: var(--muted); font-size: 12px; }
@media (max-width: 560px) {
  .hbar { grid-template-columns: 1fr auto; }
  .hb-track { grid-column: 1 / -1; grid-row: 2; }
}
.btn-primary { background: var(--accent); color: #fff; border: 0; border-radius: 10px; padding: 10px 16px; font-weight: 600; font-size: 14.5px; margin-top: 4px; }
.btn-primary:hover { filter: brightness(1.08); }
.linkbtn { background: none; border: 0; padding: 0; color: var(--accent); text-decoration: underline; font-size: inherit; }
.s-foot { color: var(--muted); font-size: 13px; margin: 14px 0 0; }
@media (max-width: 560px) {
  .tag { display: none; }
  .top-inner { flex-wrap: nowrap; align-items: center; }
  .view-toggle { min-width: 160px; }
}

/* Veri yüklenemezse */
body[data-view="error"] #simple, body[data-view="error"] #detailed, body[data-view="error"] .view-toggle { display: none; }
.fatal { padding: 48px 16px; }
.fatal h1 { font-size: 24px; margin: 0 0 8px; }
.fatal p { color: var(--muted); margin: 0; }

/* ---- Bilgi sayfaları ---- */
a { color: var(--accent); }
a.brand { color: var(--text); text-decoration: none; }
.footlinks a { color: inherit; }
.doc { max-width: 760px; padding-top: 28px; padding-bottom: 24px; line-height: 1.65; }
.doc h1 { font-size: clamp(24px, 4vw, 32px); letter-spacing: -0.02em; margin: 0 0 10px; line-height: 1.2; }
.doc h2 { font-size: 18px; margin: 28px 0 8px; }
.doc .lead { font-size: 17px; margin: 0 0 10px; }
.doc ul { padding-left: 20px; }
.doc li { margin-bottom: 6px; }
.doc table td { white-space: normal; text-align: left; vertical-align: top; }
.doc table th { text-align: left; }
.draft { background: var(--banner-bg); border: 1px solid var(--banner-border); border-radius: var(--radius); padding: 10px 14px; font-size: 14px; }
.doc .btn-primary { display: inline-block; text-decoration: none; }
