:root {
  --bg: #f5f6f8; --surface: #ffffff; --surface2: #eef0f4; --line: #dfe3ea; --text: #161a22; --muted: #5d6675;
  --accent: #1f5fd0; --accent-ink: #ffffff; --good: #0f7b4f; --warn: #b25e00; --bad: #c0362c;
  --travel: #1f5fd0; --service: #e08a00; --radius: 10px; --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #0f1218; --surface: #171b24; --surface2: #1f2430; --line: #2b3140; --text: #e8ebf1; --muted: #98a2b3;
  --accent: #6ea0ff; --accent-ink: #0b1020; --good: #4cc38a; --warn: #f0a649; --bad: #f1746a;
  --travel: #6ea0ff; --service: #f0a649; --shadow: 0 1px 2px rgba(0, 0, 0, .4);
  color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body { margin: 0; font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; background: var(--bg); color: var(--text); }
h1 { font-size: 26px; line-height: 1.2; margin: 0 0 12px; text-wrap: balance; }
h3 { font-size: 13px; margin: 0 0 10px; font-weight: 650; letter-spacing: .01em; }
code { font: 12px ui-monospace, SFMono-Regular, Menlo, monospace; background: var(--surface2); padding: 1px 4px; border-radius: 4px; }
.muted { color: var(--muted); font-weight: 400; } .small { font-size: 12px; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; border: 1px solid var(--line); background: var(--surface); border-radius: 8px; padding: 6px 10px; }
button:hover { background: var(--surface2); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.top { height: 52px; display: flex; align-items: center; gap: 14px; padding: 0 16px; background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.brand { display: flex; align-items: center; gap: 8px; color: var(--accent); } .brand strong { color: var(--text); font-size: 15px; }
.chips { display: flex; gap: 6px; flex: 1; flex-wrap: wrap; overflow: hidden; max-height: 28px; }
.chip { background: var(--surface2); border-radius: 999px; padding: 3px 10px; font-size: 12px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.icon-btn { width: 34px; height: 34px; padding: 0; font-size: 16px; }

.layout { display: grid; grid-template-columns: 340px minmax(0, 1fr); height: calc(100% - 52px); }
.layout.collapsed { grid-template-columns: 0 minmax(0, 1fr); } .layout.collapsed .panel { display: none; }
.panel { background: var(--surface); border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
#form { overflow: auto; padding: 8px 14px; flex: 1; }
details { border-bottom: 1px solid var(--line); padding: 8px 0 12px; }
summary { cursor: pointer; font-weight: 650; padding: 6px 0; list-style: none; display: flex; justify-content: space-between; }
summary::after { content: "+"; color: var(--muted); } details[open] > summary::after { content: "–"; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 8px; }
.grid2 .wide { grid-column: 1 / -1; }
label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
label output { color: var(--text); font-weight: 650; float: right; font-variant-numeric: tabular-nums; }
label:has(output) { display: block; } label:has(output) input { width: 100%; margin-top: 4px; }
.unit { opacity: .7; }
input[type=number], select, input[type=file] { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; color: var(--text); width: 100%; min-width: 0; }
input[type=range] { accent-color: var(--accent); }
.hint { font-size: 11.5px; color: var(--muted); margin: 0; }
.formula { font: 12.5px ui-monospace, monospace; background: var(--surface2); border-radius: 8px; padding: 6px 8px; margin: 6px 0 0; }

.seg { display: inline-flex; background: var(--surface2); border-radius: 9px; padding: 3px; gap: 2px; }
.seg label, .seg button { border: 0; background: transparent; border-radius: 7px; padding: 5px 10px; color: var(--muted); cursor: pointer; flex-direction: row; font-size: 13px; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg label:has(input:checked), .seg button[aria-checked=true] { background: var(--surface); color: var(--text); box-shadow: var(--shadow); font-weight: 600; }
.seg label:has(input:focus-visible) { outline: 2px solid var(--accent); }
.seg.small button { padding: 3px 8px; font-size: 12px; }

.run-box { padding: 12px 14px; border-top: 1px solid var(--line); background: var(--surface); }
.primary { width: 100%; background: var(--accent); color: var(--accent-ink); border-color: transparent; font-weight: 650; padding: 10px; font-size: 15px; }
.primary:hover { background: var(--accent); filter: brightness(1.08); } .primary.cancel { background: var(--surface2); color: var(--text); border-color: var(--line); }
.progress { margin-top: 10px; }
.phases { display: flex; gap: 6px; margin-bottom: 6px; } .phases span { flex: 1; text-align: center; font-size: 11px; padding: 2px; border-radius: 6px; background: var(--surface2); color: var(--muted); }
.phases span.on { background: var(--accent); color: var(--accent-ink); } .phases span.done { color: var(--good); }
.bar { height: 6px; background: var(--surface2); border-radius: 99px; overflow: hidden; } .bar i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .15s; }

#main { overflow: auto; padding: 18px 20px 40px; min-width: 0; }
.empty { max-width: 680px; margin: 6vh auto; } .empty p { font-size: 15px; }
.steps { list-style: none; padding: 0; margin: 20px 0; display: grid; gap: 10px; }
.steps li { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; display: grid; gap: 2px; }
.steps span { color: var(--muted); }

.kpis { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow); cursor: pointer; text-align: left; display: block; width: 100%; }
.kpi[aria-pressed=true] { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.kpi .head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.kpi .name { font-weight: 650; } .kpi .big { font-size: 28px; font-weight: 700; margin: 6px 0 2px; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.kpi .big small { font-size: 13px; font-weight: 500; color: var(--muted); }
.kpi .delta { font-size: 12.5px; min-height: 18px; color: var(--muted); } .kpi .delta.good { color: var(--good); font-weight: 600; }
.kpi dl { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px 10px; margin: 10px 0 0; }
.kpi dt { font-size: 11px; color: var(--muted); } .kpi dd { margin: 0; font-variant-numeric: tabular-nums; font-weight: 600; }
.badge { font-size: 11px; padding: 2px 8px; border-radius: 99px; white-space: nowrap; font-weight: 600; }
.badge.ok { background: color-mix(in srgb, var(--good) 15%, transparent); color: var(--good); }
.badge.bad { background: color-mix(in srgb, var(--bad) 15%, transparent); color: var(--bad); }

.toolbar { display: flex; align-items: center; gap: 16px; margin: 16px 0 12px; flex-wrap: wrap; border-bottom: 1px solid var(--line); }
.tabs { display: flex; gap: 2px; } .tabs button { border: 0; background: none; border-bottom: 2px solid transparent; border-radius: 0; padding: 9px 12px; color: var(--muted); }
.tabs button[aria-selected=true] { color: var(--text); border-bottom-color: var(--accent); font-weight: 650; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow); margin-bottom: 12px; min-width: 0; }
.cards2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; } .card-head h3 { margin: 0; }
.btns { display: flex; gap: 6px; flex-wrap: wrap; } .btns button { font-size: 12px; padding: 4px 9px; }

.table-wrap { overflow: auto; max-height: 520px; }
table { border-collapse: collapse; width: 100%; font-variant-numeric: tabular-nums; }
th, td { padding: 6px 10px; text-align: right; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { position: sticky; top: 0; background: var(--surface); font-size: 11.5px; color: var(--muted); font-weight: 600; z-index: 1; }
th:first-child, td:first-child, td.l, th.l { text-align: left; }
tr.sep td { border-top: 2px solid var(--line); } td .dot { display: inline-block; width: 9px; height: 9px; border-radius: 3px; margin-right: 6px; }
td.warn { color: var(--warn); font-weight: 650; }

svg text { fill: var(--text); font: 12px system-ui, sans-serif; } svg .axis { fill: var(--muted); font-size: 11px; } svg .grid { stroke: var(--line); }
.chart-legend { display: flex; gap: 14px; font-size: 12px; color: var(--muted); margin-top: 6px; } .chart-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; }

.map-wrap { position: relative; height: min(68vh, 720px); border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); }
#map { position: absolute; inset: 0; }
.legend { position: absolute; left: 10px; top: 10px; background: color-mix(in srgb, var(--surface) 92%, transparent); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; font-size: 12px; display: grid; gap: 4px; z-index: 2; }
.legend i { display: inline-block; width: 14px; height: 4px; border-radius: 2px; margin-right: 6px; vertical-align: middle; }
.mk { width: 24px; height: 24px; border-radius: 50%; color: #fff; font: 600 11px system-ui; display: grid; place-items: center; border: 2px solid #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .4); cursor: pointer; }
.mk.depot { border-radius: 5px; background: #111; width: 22px; height: 22px; }
.maplibregl-popup-content { color: #161a22; font: 12.5px system-ui; padding: 10px 12px; border-radius: 8px; }

.load-layout { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 12px; align-items: start; }
.view3d-wrap { position: relative; height: min(68vh, 700px); border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); background: var(--surface); }
#view3d { position: absolute; inset: 0; } #view3d canvas { display: block; }
.view-tools { position: absolute; left: 10px; top: 10px; display: flex; gap: 8px; flex-wrap: wrap; right: 10px; pointer-events: none; } .view-tools > * { pointer-events: auto; }
.scale { position: absolute; left: 10px; bottom: 10px; display: flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--muted); background: color-mix(in srgb, var(--surface) 88%, transparent); padding: 4px 8px; border-radius: 6px; }
.scale i { width: 110px; height: 8px; border-radius: 4px; background: linear-gradient(90deg, #fde725, #5ec962, #21918c, #3b528b, #440154); }
.tooltip { position: absolute; pointer-events: none; background: var(--text); color: var(--bg); padding: 6px 9px; border-radius: 6px; font-size: 12px; z-index: 5; white-space: nowrap; }
.step-ctl { display: flex; gap: 6px; align-items: center; margin-bottom: 10px; } .step-ctl input { flex: 1; } .step-ctl button { width: 32px; height: 32px; padding: 0; }
#step-info h4 { margin: 0 0 4px; font-size: 15px; } #step-info .sum { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }
.breakdown { display: grid; grid-template-columns: 1fr auto; gap: 3px 10px; margin: 8px 0; font-variant-numeric: tabular-nums; } .breakdown span:nth-child(odd) { color: var(--muted); }
.pk-list { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; } .pk { font-size: 11.5px; padding: 2px 7px; border-radius: 6px; background: var(--surface2); }
.pk.block { background: color-mix(in srgb, var(--bad) 16%, transparent); color: var(--bad); font-weight: 600; }

#toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 10px; opacity: 0; pointer-events: none; transition: opacity .2s; max-width: 80vw; z-index: 100; }
#toast.show { opacity: 1; } #toast.error { background: var(--bad); color: #fff; }

@media (max-width: 1100px) { .load-layout, .cards2 { grid-template-columns: 1fr; } .kpi dl { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 820px) {
  .layout { grid-template-columns: 1fr; height: auto; } .panel { border-right: 0; border-bottom: 1px solid var(--line); }
  #form { max-height: 46vh; } .kpis { grid-template-columns: 1fr; } .chips { display: none; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* lisans rozeti ve penceresi */
.lic-badge { border: 1px solid var(--line); background: var(--surface2); color: var(--text); border-radius: 999px; padding: 4px 12px; font-size: 12px; cursor: pointer; white-space: nowrap; max-width: 260px; overflow: hidden; text-overflow: ellipsis; }
.lic-badge[data-state="ok"] { border-color: var(--good); color: var(--good); }
.lic-badge[data-state="warn"] { border-color: var(--warn); color: var(--warn); }
.lic-badge[data-state="demo"] { border-color: var(--warn); color: var(--warn); }
.lic-dialog { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--text); width: min(520px, calc(100vw - 32px)); padding: 18px; }
.lic-dialog::backdrop { background: rgba(0, 0, 0, .45); }
.lic-dialog h3 { margin: 0 0 6px; }
.lic-dialog textarea { width: 100%; font: 12px ui-monospace, monospace; background: var(--bg); color: var(--text); border: 1px solid var(--line); border-radius: 8px; padding: 8px; resize: vertical; }
.lic-msg { color: var(--bad); min-height: 1.2em; margin: 8px 0; font-size: 13px; }
.lic-actions { display: flex; justify-content: flex-end; gap: 8px; }
