:root {
  --bg: #f3f5f9;
  --bg2: #eaedf3;
  --card: #ffffff;
  --line: #dbe0ea;
  --text: #141a24;
  --muted: #5f687c;
  --accent: #1683c9;
  --accent2: #ff9a3c;
  --ok: #17a364;
  --neg: #d9475c;
  --shadow: 0 8px 24px rgba(30,40,70,.09);
  --radius: 18px;
}
[data-theme="dark"] {
  --bg: #0e1117;
  --bg2: #161a23;
  --card: #1a1f2a;
  --line: #2a3141;
  --text: #edf1f7;
  --muted: #8d96aa;
  --accent: #3aa6ee;
  --ok: #34c983;
  --neg: #ff6b7f;
  --shadow: 0 10px 30px rgba(0,0,0,.35);
}
* { box-sizing: border-box; }
html, body { margin: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: radial-gradient(1200px 600px at 50% -220px, color-mix(in srgb, var(--accent) 14%, transparent), transparent 70%), var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-tap-highlight-color: transparent;
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent); }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }

/* ---------- header ---------- */
.top {
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px;
  max-width: 1180px; margin: 0 auto; padding: 14px 18px;
  padding-top: max(14px, env(safe-area-inset-top));
}
.brand { display: flex; align-items: center; gap: 10px; font-size: 1.25rem; letter-spacing: .2px; }
.brand b { color: var(--accent); }
.top-actions { display: flex; gap: 8px; justify-self: end; }
.maker-logo {
  justify-self: center; display: block; background: #fff; border-radius: 12px; padding: 5px 12px;
  box-shadow: 0 0 0 1px var(--line); transition: transform .12s, box-shadow .12s; line-height: 0;
}
[data-theme="dark"] .maker-logo { box-shadow: 0 2px 10px rgba(0,0,0,.18); }
.maker-logo:hover { transform: translateY(-1px); box-shadow: 0 4px 16px rgba(79,195,247,.35); }
.maker-logo img { height: 36px; width: auto; display: block; }
.icon-btn {
  width: 38px; height: 38px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--card); display: grid; place-items: center; font-weight: 700;
}
.icon-btn:hover, .chip:hover { border-color: var(--accent); }

main { max-width: 1180px; margin: 0 auto; padding: 0 18px 20px; }
.intro { text-align: center; margin: 4px 0 16px; }
.intro h1 { margin: 0; font-size: 1.9rem; letter-spacing: -.5px; }
.intro p { margin: 4px 0 0; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.panel { padding: 16px 18px 18px; }
.panel h2 { margin: 0 0 6px; font-size: 1.08rem; }
.ph { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.ph h2 { margin: 0; }
.ph p { margin: 0; }
.lbl { display: flex; justify-content: space-between; align-items: baseline; margin: 16px 0 7px; font-size: .86rem; color: var(--muted); font-weight: 600; }
.lbl:first-child { margin-top: 0; }
.lbl a { text-decoration: none; font-weight: 600; }
.pill { padding: 3px 11px; border-radius: 99px; background: var(--bg2); border: 1px solid var(--line); color: var(--muted); font-size: .8rem; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  border: 1px solid var(--line); background: var(--bg2); border-radius: 10px; padding: 8px 12px;
  font-size: .92rem; line-height: 1.1; font-weight: 600;
}
.chip.big { font-size: 1.1rem; padding: 10px 18px; }
.chip.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.custom {
  display: inline-flex; align-items: center; gap: 2px; border: 1px solid var(--line); background: var(--bg2);
  border-radius: 10px; padding: 0 4px 0 10px; color: var(--muted); font-weight: 600;
}
.custom.active { border-color: var(--accent); color: var(--accent); }
.custom input { width: 62px; border: 0; background: transparent; padding: 8px 4px; outline: none; font-weight: 600; }
.btn { border: 0; border-radius: 12px; padding: 9px 15px; background: var(--accent); color: #fff; font-weight: 600; }
.btn.ghost { background: var(--bg2); color: var(--text); border: 1px solid var(--line); }
.btn:active, .chip:active { transform: scale(.97); }
.btnrow { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }

/* ---------- hero ---------- */
.hero { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; align-items: start; }

.amount-box {
  position: relative; display: flex; align-items: center; border: 2px solid var(--line); border-radius: 14px;
  background: var(--bg2); transition: border-color .15s;
}
.amount-box:focus-within { border-color: var(--accent); }
#amount {
  flex: 1; min-width: 0; width: 100%; border: 0; background: transparent; outline: none; padding: 12px 8px 12px 16px;
  font-size: 2rem; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -.5px;
}
.cur { font-size: 1.5rem; color: var(--muted); font-weight: 700; padding-right: 6px; }
.clear { border: 0; background: transparent; color: var(--muted); font-size: 1.6rem; width: 42px; height: 42px; border-radius: 10px; margin-right: 4px; }
.clear:hover { color: var(--neg); }
.words { margin: 6px 2px 0; min-height: 1.2em; font-style: italic; }

.seg { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; }
.seg.seg3 { grid-template-columns: repeat(3, 1fr); }
.seg button {
  border: 1px solid var(--line); background: var(--bg2); border-radius: 12px; padding: 9px 6px;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
}
.seg button b { font-size: .98rem; }
.seg button small { color: var(--muted); font-size: .74rem; }
.seg button:hover { border-color: var(--accent); }
.seg button.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.seg button.active small { color: rgba(255,255,255,.85); }
.lbl .hint { font-weight: 500; }
.linkish { border: 0; background: none; padding: 0; color: var(--accent); font-weight: 600; font-size: .84rem; }
.linkish:hover { text-decoration: underline; }
.warn { margin: 6px 2px 0; min-height: 1.2em; }
.warn.on { color: var(--accent2); font-weight: 600; }
.check { display: flex; gap: 10px; align-items: flex-start; margin-top: 12px; cursor: pointer; line-height: 1.35; }
.check input { width: 18px; height: 18px; margin-top: 1px; accent-color: var(--accent); flex: none; }

.ot { margin-top: 18px; padding-top: 14px; border-top: 1px dashed var(--line); }
.ot h3 { margin: 0 0 10px; font-size: 1rem; }
.ot-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.stepper {
  display: flex; flex-direction: column; gap: 6px; border: 1px solid var(--line); background: var(--bg2);
  border-radius: 12px; padding: 9px 10px;
}
.stepper.on { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 7%, var(--bg2)); }
.st-l b { display: block; font-size: .9rem; }
.st-l small { color: var(--muted); font-size: .75rem; }
.st-c { display: flex; align-items: center; gap: 4px; }
.st-c button { width: 34px; height: 34px; border-radius: 10px; border: 1px solid var(--line); background: var(--card); font-size: 1.2rem; font-weight: 700; line-height: 1; flex: none; }
.st-c button:hover { border-color: var(--accent); }
.st-c input { flex: 1; min-width: 0; width: 100%; text-align: center; border: 1px solid var(--line); background: var(--card); border-radius: 10px; height: 34px; font-weight: 700; font-size: 1.05rem; outline: none; font-variant-numeric: tabular-nums; }
.st-c input:focus { border-color: var(--accent); }

.big2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.bigbox { border-radius: 14px; padding: 12px 14px; border: 1px solid var(--line); background: var(--bg2); display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.bigbox span { font-size: .82rem; color: var(--muted); font-weight: 600; }
.bigbox b { font-size: 1.65rem; letter-spacing: -.5px; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bigbox.net b { color: var(--ok); }
.bigbox.cost { background: color-mix(in srgb, var(--accent) 10%, var(--card)); border-color: color-mix(in srgb, var(--accent) 35%, var(--line)); }
.bigbox.cost b { color: var(--accent); }
.ratio { margin: 8px 2px 4px; }
.rtable tr.sec th { padding: 14px 4px 4px; font-size: .74rem; text-transform: uppercase; letter-spacing: .5px; color: var(--accent); font-weight: 700; border-bottom: 0; }
.rtable td.pos { color: var(--ok); }
.rtable tr.otrow.off, .rtable tr.dsrow.off { display: none; }
.rtable td { font-size: 1.02rem; }

.otbox { margin-top: 14px; border-radius: 14px; padding: 12px 14px; background: color-mix(in srgb, var(--accent2) 10%, var(--card)); border: 1px solid color-mix(in srgb, var(--accent2) 40%, var(--line)); }
.otbox.off { display: none; }
.otbox h3 { margin: 0 0 8px; font-size: .98rem; }
.otnums { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.otnums div { display: flex; flex-direction: column; gap: 2px; }
.otnums span { font-size: .74rem; color: var(--muted); }
.otnums b { font-size: 1.05rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.otbox p { margin: 8px 0 0; }

#yil { margin-top: 16px; }
.dtable tbody tr.on td { font-weight: 700; }
.dtable tfoot td { font-weight: 800; border-bottom: 0; padding-top: 12px; }
.dtable td.up { color: var(--accent2); }
.ptable { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; font-size: .92rem; }
.ptable th, .ptable td { padding: 8px 4px; border-bottom: 1px solid var(--line); }
.ptable th { text-align: left; font-weight: 500; color: var(--muted); }
.ptable td { text-align: right; font-weight: 700; white-space: nowrap; }
.ptable tr:last-child th, .ptable tr:last-child td { border-bottom: 0; }

.select {
  width: 100%; margin-top: 8px; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--bg2); font-size: .9rem;
}

/* ---------- result ---------- */
.result { position: sticky; top: 12px; }
.rtable { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.rtable th, .rtable td { padding: 10px 4px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.rtable th { text-align: left; font-weight: 500; color: var(--muted); }
.rtable th small { font-weight: 700; color: var(--accent); }
.rtable th em { display: block; font-style: normal; font-size: .74rem; opacity: .85; margin-top: 2px; }
.rtable td { text-align: right; font-weight: 700; font-size: 1.12rem; white-space: nowrap; }
.rtable tr.strong td { font-size: 1.2rem; }
.rtable tr.strong th { color: var(--text); font-weight: 600; }
.rtable td.neg { color: var(--neg); }
.rtable tr.tev.off { display: none; }
.rtable tr.total th, .rtable tr.total td { border-bottom: 0; padding-top: 14px; }
.rtable tr.total th { color: var(--text); font-weight: 800; font-size: 1.02rem; }
.rtable tr.total td { font-size: 1.7rem; color: var(--accent); letter-spacing: -.5px; }
.rtable tr.flash td { animation: flash .45s ease-out; }
@keyframes flash { from { background: color-mix(in srgb, var(--accent) 16%, transparent); } to { background: transparent; } }

.cta {
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px; margin-top: 16px;
  padding: 14px 14px; border-radius: 14px; text-decoration: none; color: var(--text);
  background: linear-gradient(135deg, color-mix(in srgb, var(--ok) 14%, var(--card)), color-mix(in srgb, var(--accent) 12%, var(--card)));
  border: 1px solid color-mix(in srgb, var(--ok) 40%, var(--line)); transition: transform .12s, box-shadow .12s;
}
.cta:hover { transform: translateY(-1px); box-shadow: 0 6px 18px color-mix(in srgb, var(--ok) 25%, transparent); }
.cta-ic { font-size: 1.8rem; }
.cta-tx b { display: block; font-size: .95rem; line-height: 1.3; }
.cta-tx span { display: block; font-size: .84rem; color: var(--muted); margin-top: 3px; }
.cta-go { background: var(--ok); color: #fff; font-weight: 700; border-radius: 10px; padding: 9px 12px; white-space: nowrap; font-size: .9rem; }

/* ---------- tables ---------- */
.cmp, #kodlar { margin-top: 16px; }
.tscroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.dtable { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; font-size: .93rem; }
.dtable th, .dtable td { padding: 9px 10px; border-bottom: 1px solid var(--line); text-align: right; white-space: nowrap; }
.dtable thead th { color: var(--muted); font-weight: 600; font-size: .8rem; background: var(--bg2); }
.dtable thead th:first-child { border-radius: 10px 0 0 10px; }
.dtable thead th:last-child { border-radius: 0 10px 10px 0; }
.dtable td:first-child, .dtable th:first-child { text-align: left; }
.dtable tbody tr { cursor: pointer; }
.dtable tbody tr:hover { background: color-mix(in srgb, var(--accent) 7%, transparent); }
.dtable tbody tr.on { background: color-mix(in srgb, var(--accent) 13%, transparent); }
.dtable tbody tr.on td:first-child { font-weight: 800; color: var(--accent); }
.dtable td.b { font-weight: 700; }
.codes td { white-space: normal; }
.codes td:nth-child(1) { width: 60px; font-weight: 700; color: var(--muted); }
.codes td:nth-child(2), .codes th:nth-child(2) { text-align: left; }
.codes td:nth-child(3) { width: 80px; font-weight: 700; }
.codes tr.grp td { background: var(--bg2); color: var(--accent); font-weight: 700; font-size: .78rem; text-transform: uppercase; letter-spacing: .5px; cursor: default; text-align: left; }
.codes tr.grp:hover td { background: var(--bg2); }
.codes tr.on td:nth-child(2) { font-weight: 700; color: var(--text); }
.search { padding: 8px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg2); min-width: 340px; }
.search:focus { outline: none; border-color: var(--accent); }

.panels { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; margin-top: 16px; align-items: start; }
.formula p { display: grid; gap: 3px; margin: 10px 0; }
.formula code { font-family: ui-monospace, Consolas, monospace; background: var(--bg2); border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; font-size: .9rem; }
.faq details { border-bottom: 1px solid var(--line); padding: 10px 0; }
.faq details:last-child { border-bottom: 0; }
.faq summary { cursor: pointer; font-weight: 600; }
.faq details p { margin: 8px 0 2px; color: var(--muted); line-height: 1.5; font-size: .93rem; }

.steps { margin: 8px 0 4px; padding-left: 20px; display: grid; gap: 7px; line-height: 1.45; }
.foot { text-align: center; padding: 10px 18px 30px; color: var(--muted); font-size: .9rem; }
.foot p { margin: 4px 0; }
.foot .dev { color: var(--text); }
.foot .dev a { color: var(--accent); font-weight: 600; text-decoration: none; }
.foot .dev a:hover { text-decoration: underline; }

#toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); opacity: 0;
  background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 12px; font-size: .92rem;
  transition: .2s; pointer-events: none; z-index: 60; max-width: 90vw; text-align: center;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }
dialog { border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); color: var(--text); max-width: 460px; width: calc(100% - 32px); box-shadow: var(--shadow); }
dialog::backdrop { background: rgba(0,0,0,.5); }
dialog h3 { margin-top: 0; }

/* telefonda alt toplam çubuğu (sonuç ekranda değilken) */
.bar {
  position: fixed; left: 10px; right: 10px; bottom: max(10px, env(safe-area-inset-bottom)); z-index: 50;
  display: none; justify-content: space-between; align-items: center; gap: 10px;
  border: 0; border-radius: 14px; padding: 12px 16px; background: var(--accent); color: #fff;
  box-shadow: 0 8px 24px rgba(0,0,0,.25); font-size: .92rem; text-align: left;
}
.bar b { font-size: 1.2rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
@media (max-width: 900px) { .bar.show { display: flex; } }

/* ---------- responsive ---------- */
@media (max-width: 900px) {
  .hero, .panels { grid-template-columns: minmax(0, 1fr); }
  .result { position: static; }
}
@media (max-width: 560px) {
  .top { grid-template-columns: 1fr auto; row-gap: 10px; }
  .maker-logo { grid-column: 1 / -1; grid-row: 1; }
  .maker-logo img { height: 30px; }
  .brand { font-size: 1.1rem; white-space: nowrap; gap: 8px; }
  .brand img { width: 30px; height: 30px; }
  main { padding: 0 10px 16px; }
  .intro h1 { font-size: 1.5rem; }
  .panel { padding: 14px 13px 16px; }
  #amount { font-size: 1.6rem; }
  .chip.big { padding: 9px 14px; }
  .rtable td { font-size: 1rem; }
  .rtable tr.total td { font-size: 1.4rem; }
  .bigbox b { font-size: 1.3rem; }
  .otnums { grid-template-columns: 1fr 1fr; }
  .ot-grid { grid-template-columns: 1fr; }
  .stepper { flex-direction: row; align-items: center; justify-content: space-between; }
  .st-c { width: 150px; flex: none; }
  .cta { grid-template-columns: auto 1fr; }
  .cta-go { grid-column: 1 / -1; text-align: center; }
  .search { min-width: 0; width: 100%; }
  .dtable { font-size: .85rem; }
  .dtable th, .dtable td { padding: 8px 6px; }
}

/* ---------- print ---------- */
@media print {
  body { background: #fff; color: #000; }
  .top-actions, .calc, .bar, .panels, .btnrow, .cta, #toast, .foot .dev { display: none !important; }
  #yil { margin-top: 12px; break-inside: avoid; }
  .hero { display: block; }
  .card { box-shadow: none; border: 1px solid #ccc; }
  .result { position: static; }
}
