:root {
  --bg: #0A0E14; --surface: #121821; --high: #1A2230; --line: #263041;
  --text: #E6EDF3; --dim: #8B98A9; --accent: #22D3EE;
  --good: #34D399; --fair: #A3E635; --warn: #FBBF24; --poor: #FB923C; --bad: #F87171;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  padding-bottom: calc(72px + env(safe-area-inset-bottom));
}
.top {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 16px; padding-top: calc(14px + env(safe-area-inset-top));
  max-width: 560px; margin: 0 auto;
}
.brand { font-weight: 600; letter-spacing: .2px; }
main { max-width: 560px; margin: 0 auto; padding: 0 16px; }
h1 { font-size: 24px; line-height: 1.25; margin: 8px 0 6px; font-weight: 650; }
h2 { font-size: 16px; margin: 0 0 8px; font-weight: 600; }
h2.section { margin: 20px 4px 8px; color: var(--dim); font-size: 13px; text-transform: uppercase; letter-spacing: .6px; }
p { margin: 0 0 10px; }
.lead { color: var(--dim); margin-bottom: 16px; }
.hint { color: var(--dim); font-size: 13px; margin: 10px 0 0; }
main > .hint { margin: 12px 4px; }
.error { color: var(--bad); font-size: 14px; margin: 10px 0 0; }

.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px;
  padding: 16px; margin: 12px 0;
}
.card.note { background: transparent; }
.card.note p { color: var(--dim); font-size: 14px; }
.card p:last-child { margin-bottom: 0; }

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 48px; padding: 0 18px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--high); color: var(--text);
  font: inherit; font-weight: 600; text-decoration: none; cursor: pointer;
}
.btn.primary { background: var(--accent); border-color: var(--accent); color: #04222A; width: 100%; }
.btn.file input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.btn.file { position: relative; }
.link { background: none; border: 0; color: var(--dim); font: inherit; font-size: 14px; padding: 10px 0 0; text-decoration: underline; cursor: pointer; }

.row-link {
  display: block; padding: 12px 0; border-top: 1px solid var(--line);
  color: var(--text); text-decoration: none;
}
.row-link:first-of-type { border-top: 0; padding-top: 4px; }
.row-link:last-child { padding-bottom: 0; }
.row-link b { display: block; font-weight: 600; color: var(--accent); }
.row-link span { color: var(--dim); font-size: 14px; }

label { display: block; color: var(--dim); font-size: 13px; margin: 14px 0 6px; }
.card > label:first-child, .addrow label { margin-top: 0; }
input[type=number], select {
  width: 100%; min-height: 48px; padding: 0 12px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--bg); color: var(--text);
  font: inherit; font-size: 18px; font-variant-numeric: tabular-nums;
}
input:focus-visible, select:focus-visible, button:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.stepper { display: grid; grid-template-columns: 56px 1fr 56px; gap: 8px; }
.stepper input { text-align: center; font-size: 22px; font-weight: 600; }
.stepper button {
  min-height: 48px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--high); color: var(--text); font-size: 24px; cursor: pointer;
}
input[type=range] { width: 100%; margin: 16px 0 2px; accent-color: var(--accent); height: 28px; }

.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: 4px; }
.seg button { min-height: 40px; border: 0; border-radius: 9px; background: none; color: var(--dim); font: inherit; font-weight: 600; cursor: pointer; }
.seg button.on { background: var(--high); color: var(--text); }

.result .big { font-size: 44px; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; }
.result .big small { font-size: 18px; font-weight: 600; color: var(--dim); }
.sub { color: var(--dim); font-size: 14px; margin-top: 6px; }
.sub b { color: var(--text); font-weight: 600; }
.qual { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); font-size: 14px; color: var(--dim); }
.qual b { color: var(--text); }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; background: var(--dim); }
.good { background: var(--good); } .fair { background: var(--fair); } .warn { background: var(--warn); }
.poor { background: var(--poor); } .bad { background: var(--bad); }

.addrow { display: grid; grid-template-columns: 1fr 1fr auto; gap: 8px; align-items: end; margin-top: 14px; }
.list { list-style: none; margin: 12px 0 0; padding: 0; }
.list li {
  display: flex; align-items: center; gap: 10px; padding: 10px 0;
  border-top: 1px solid var(--line); font-variant-numeric: tabular-nums;
}
.list li .grow { flex: 1; min-width: 0; }
.list li .dim { color: var(--dim); font-size: 13px; }
.list .del { width: 40px; height: 40px; border-radius: 10px; border: 0; background: none; color: var(--dim); font-size: 20px; cursor: pointer; }

.bars { margin-top: 12px; }
.bar { display: grid; grid-template-columns: 64px 1fr 86px; gap: 8px; align-items: center; padding: 5px 0; font-size: 14px; font-variant-numeric: tabular-nums; }
.bar .track { height: 10px; border-radius: 5px; background: var(--bg); overflow: hidden; }
.bar .fill { height: 100%; border-radius: 5px; background: var(--dim); }
.bar.rec b { color: var(--good); } .bar.rec .fill { background: var(--good); }
.bar .val { color: var(--dim); text-align: right; font-size: 13px; }

.aps { margin: 0; }
.aps li {
  display: block; background: var(--surface); border: 1px solid var(--line); border-radius: 14px;
  padding: 12px 14px; margin: 8px 0; cursor: pointer;
}
.aps li.sel { border-color: var(--accent); }
.aps .name { display: flex; justify-content: space-between; gap: 10px; font-weight: 600; }
.aps .name span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.aps .meta { color: var(--dim); font-size: 13px; margin-top: 2px; }
#r-chart svg { width: 100%; height: auto; display: block; }

.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 5;
  display: grid; grid-template-columns: repeat(4, 1fr);
  background: rgba(10, 14, 20, .96); border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.tabs a {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 9px 0 8px; color: var(--dim); font-size: 12px; text-decoration: none;
}
.tabs a.on { color: var(--accent); }
.tabs svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

[hidden] { display: none !important; }

/* ---------- Masaüstü ve dizüstü ---------- */
.ph { display: none; }
@media (min-width: 900px) {
  body { padding: 0 0 48px 232px; font-size: 16px; }
  .top {
    position: fixed; left: 0; top: 0; width: 232px; margin: 0;
    padding: 24px 22px 18px; z-index: 6;
  }
  .brand { font-size: 18px; }
  .tabs {
    top: 76px; right: auto; bottom: 0; width: 232px;
    display: flex; flex-direction: column; gap: 4px; padding: 8px 12px;
    background: var(--surface); border-top: 0; border-right: 1px solid var(--line);
  }
  .top { background: var(--surface); border-right: 1px solid var(--line); }
  .tabs a {
    flex-direction: row; gap: 12px; padding: 11px 12px; border-radius: 10px;
    font-size: 15px; font-weight: 500;
  }
  .tabs a:hover { background: var(--high); color: var(--text); }
  .tabs a.on { background: var(--high); }

  main { max-width: 1080px; padding: 28px 40px 0; }
  h1 { font-size: 30px; margin: 4px 0 8px; }
  .lead { font-size: 17px; margin-bottom: 20px; }
  .card { padding: 22px; margin: 0; }
  .grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; align-items: start; margin-top: 20px; }
  .grid > .wide { grid-column: 1 / -1; }
  .grid > .side { grid-column: 2; grid-row: 1 / span 4; position: sticky; top: 24px; display: grid; gap: 14px; }
  .grid > .side .hint { margin: 0 4px; }
  #view-report .grid { grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); }
  #view-report > .card { max-width: 520px; }
  #view-report h2.section { margin-top: 0; }
  .btn.primary { width: auto; min-width: 220px; }
  .result .big { font-size: 56px; }
  .ph { display: block; color: var(--dim); font-size: 14px; }
  #r-chart-card:not([hidden]) + .ph { display: none; }
  .aps li:hover, .row-link:hover b { border-color: var(--accent); }
  .row-link:hover b { text-decoration: underline; }
  .stepper button:hover, .btn:hover, .seg button:hover { filter: brightness(1.15); }
}
