:root {
  --bg: #f4f5f7;
  --surface: #ffffff;
  --ink: #1d2433;
  --muted: #6b7385;
  --line: #e2e5ec;
  --accent: #c8102e;
  --accent-ink: #ffffff;
  --accent-soft: #fdecef;
  --ok: #0f7b4c;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 4px 14px rgba(16, 24, 40, .05);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12151c; --surface: #1b1f29; --ink: #e8eaf0; --muted: #9aa2b4; --line: #2c3240;
    --accent: #ff4d67; --accent-soft: #3a1d24; --shadow: none;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--ink);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
a { color: inherit; }
.wrap { max-width: 1180px; margin: 0 auto; padding: 0 16px; }

.topbar { background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.topbar-in { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 60px; flex-wrap: wrap; }
.brand { font-weight: 700; font-size: 18px; text-decoration: none; display: flex; align-items: center; gap: 10px; }
.brand-mark { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 8px; background: var(--accent); color: var(--accent-ink); }
.crumbs { color: var(--muted); font-size: 14px; }
.crumbs a { text-decoration: none; }
.crumbs a:hover { color: var(--accent); }

h1 { font-size: 26px; margin: 28px 0 6px; }
.lead { color: var(--muted); margin: 0 0 22px; }

/* ---------- product grid ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; margin-bottom: 32px; }
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 18px; display: flex; flex-direction: column; gap: 6px; text-decoration: none; position: relative;
  transition: border-color .15s, transform .15s;
}
.card:hover { border-color: var(--accent); transform: translateY(-2px); }
.card .icon { font-size: 30px; line-height: 1; margin-bottom: 6px; }
.card .name { font-weight: 650; font-size: 16px; }
.card .meta { color: var(--muted); font-size: 13px; }
.card .go { margin-top: auto; padding-top: 10px; color: var(--accent); font-weight: 600; font-size: 14px; }
.badge { position: absolute; top: 12px; right: 12px; font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 99px; background: var(--accent-soft); color: var(--accent); }
.badge.eco { background: #e6f4ee; color: var(--ok); }
.card.pending { opacity: .6; }

/* ---------- calculator ---------- */
.calc { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 20px; align-items: start; margin-bottom: 32px; }
@media (max-width: 860px) { .calc { grid-template-columns: 1fr; } }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; }
.panel h2 { font-size: 16px; margin: 0 0 14px; }
.row { display: grid; grid-template-columns: 170px minmax(0, 1fr); gap: 12px; align-items: center; padding: 7px 0; border-bottom: 1px dashed var(--line); }
.row:last-child { border-bottom: 0; }
.row > label { color: var(--muted); font-size: 14px; }
@media (max-width: 520px) { .row { grid-template-columns: 1fr; gap: 4px; } }
.row.product { background: var(--accent-soft); margin: -6px -10px 8px; padding: 10px; border-radius: 8px; border: 0; }
.row.product > label { color: var(--ink); font-weight: 600; }
select, input[type=text], input[type=number] {
  width: 100%; min-height: 38px; padding: 7px 10px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--surface); color: var(--ink); font: inherit;
}
select:focus, input:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: transparent; }
select:disabled, input:disabled { opacity: .55; }
.pair { display: flex; gap: 8px; align-items: center; }
.pair input { flex: 1; }
.hint { font-size: 12px; color: var(--muted); }
.extras { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.extras summary { cursor: pointer; font-weight: 600; font-size: 14px; color: var(--muted); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; width: 100%; min-height: 46px; margin-top: 16px;
  background: var(--accent); color: var(--accent-ink); border: 0; border-radius: 8px; font: 600 16px/1 inherit; cursor: pointer;
}
.btn:hover { filter: brightness(1.07); }

.result .empty { color: var(--muted); text-align: center; padding: 30px 10px; }
.kur { text-align: center; font-size: 13px; color: var(--muted); margin-bottom: 10px; }
.lines { width: 100%; border-collapse: collapse; }
.lines td { padding: 8px 0; border-bottom: 1px solid var(--line); }
.lines td.amt { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.totals { margin-top: 14px; border: 1px solid var(--ink); border-radius: 8px; overflow: hidden; }
.totals > div { display: flex; justify-content: space-between; gap: 10px; padding: 10px 12px; font-variant-numeric: tabular-nums; }
.totals .cash { color: var(--accent); font-size: 18px; font-weight: 700; border-bottom: 1px solid var(--ink); }
.totals .card-t { font-weight: 600; }
.totals small { font-size: 11px; color: var(--muted); font-weight: 400; }
.unit { margin-top: 10px; font-size: 13px; color: var(--muted); text-align: right; }
.error { background: var(--accent-soft); color: var(--accent); border-radius: 8px; padding: 12px; font-weight: 600; }
.notice { background: var(--accent-soft); border-radius: 8px; padding: 12px; font-size: 14px; }

.foot { color: var(--muted); font-size: 13px; padding: 20px 16px 40px; }

/* ---------- Değişkenler panel ---------- */
.params { margin-top: 22px; }
.params:empty { display: none; }
.pbar { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap;
  position: sticky; top: 61px; z-index: 3; background: var(--surface); padding: 6px 0 10px; border-bottom: 1px solid var(--line); }
.pbar h2 { margin: 0 0 2px; font-size: 18px; }
.pstatus { font-size: 13px; color: var(--muted); }
.pstatus.dirty { color: var(--accent); font-weight: 600; }
.pbtns { display: flex; gap: 8px; flex-wrap: wrap; }
.pbtns .btn { width: auto; min-height: 38px; margin: 0; padding: 0 16px; font-size: 14px; }
.btn.ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); }
.btn.ghost:hover { border-color: var(--accent); color: var(--accent); filter: none; }
.btn:disabled { opacity: .45; cursor: default; filter: none; }
.phint { font-size: 12.5px; color: var(--muted); margin: 6px 0 0; }
.phint.warn { color: var(--accent); margin: 4px 0 10px; }
.pmuted { color: var(--muted); font-weight: 400; }
.pgroup { border-bottom: 1px solid var(--line); padding: 10px 0; }
.pgroup > summary { cursor: pointer; font-weight: 700; font-size: 15px; padding: 4px 0; }
.pgroup.adv > summary { color: var(--muted); }
.prow { display: grid; grid-template-columns: minmax(0, 300px) minmax(0, 1fr); gap: 14px; padding: 10px 6px; border-top: 1px dashed var(--line); align-items: start; }
.prow.changed { background: var(--accent-soft); border-radius: 8px; }
.pdef { font-size: 12.5px; margin-top: 4px; color: var(--accent); }
.pdef code { font-size: 12px; word-break: break-all; }
.pedit { min-width: 0; }
.pedit input, .pjson { font: inherit; font-size: 14px; color: var(--ink); background: var(--bg);
  border: 1px solid var(--line); border-radius: 6px; padding: 6px 8px; }
.pedit input.pnum { width: 130px; text-align: right; font-variant-numeric: tabular-nums; }
.pedit input.pjson-cell { width: 220px; font-family: ui-monospace, Consolas, monospace; font-size: 12.5px; }
.pedit input:focus, .pjson:focus { outline: 2px solid var(--accent); outline-offset: 0; }
.pedit .bad { border-color: var(--accent); background: var(--accent-soft); }
.pjson { width: 100%; font-family: ui-monospace, Consolas, monospace; font-size: 12.5px; resize: vertical; }
.ptable { border-collapse: collapse; font-size: 14px; }
.ptable th { text-align: left; font-weight: 600; font-size: 12.5px; color: var(--muted); padding: 2px 8px 4px 0; white-space: nowrap; }
.ptable td { padding: 2px 8px 2px 0; }
.ptable tbody th { color: var(--ink); font-size: 13px; }
.pmatrix input.pnum { width: 86px; }
.pscroll { overflow-x: auto; max-width: 100%; }
.plist { display: flex; flex-wrap: wrap; gap: 8px 14px; }
.plist label { display: flex; flex-direction: column; font-size: 12.5px; color: var(--muted); }
.plink { background: none; border: 0; color: var(--accent); cursor: pointer; font: inherit; font-size: 13px; padding: 2px 4px; }
.plink:hover { text-decoration: underline; }
.logout { background: none; border: 1px solid var(--line); color: var(--muted); border-radius: 8px; padding: 5px 12px; font: inherit; font-size: 13px; cursor: pointer; }
.logout:hover { color: var(--accent); border-color: var(--accent); }
@media (max-width: 720px) {
  .prow { grid-template-columns: 1fr; gap: 6px; }
  .pbar { position: static; }
  .pbtns .btn { flex: 1 1 auto; }
}
