:root {
  --bg: #f4f6fa;
  --panel: #ffffff;
  --text: #0f172a;
  --text-2: #334155;
  --muted: #64748b;
  --border: #e3e8ef;
  --border-2: #eef1f6;
  --primary: #1d4ed8;
  --topbar: #0a1322;
  --available: #16a34a;
  --occupied: #d97706;
  --offline: #dc2626;
  --unknown: #8b98ab;
  --live: #10b981;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font: 14px/1.5 Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--text); background: var(--bg); display: flex; flex-direction: column; -webkit-font-smoothing: antialiased;
}
svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
/* Leaflet'in vektör katmanı (rota çizgisi vb.) genel ikon kuralından etkilenmesin */
.leaflet-pane > svg { width: auto; height: auto; fill: initial; stroke: initial; stroke-width: initial; }

.topbar { display: flex; align-items: center; gap: 18px; padding: 10px 18px; background: var(--topbar); color: #fff; z-index: 1000; border-bottom: 1px solid #1a2740; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 16px; white-space: nowrap; line-height: 1.15; }
.brand small { display: block; font-weight: 400; font-size: 11.5px; color: #8b9bb3; }
.mark { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; background: linear-gradient(135deg, #10b981, #1d4ed8); }
.mark svg { fill: #fff; stroke: none; width: 18px; height: 18px; }
.search { position: relative; flex: 1; max-width: 480px; }
.search svg { position: absolute; left: 11px; top: 9px; color: #8b9bb3; }
#search { width: 100%; height: 36px; padding: 0 12px 0 36px; border-radius: 8px; border: 1px solid #22324d; font: inherit; background: #111d31; color: #fff; }
#search:focus { outline: none; border-color: #3b82f6; }
#search::placeholder { color: #7f8ea5; }
.live { margin-left: auto; display: flex; align-items: center; gap: 7px; font-size: 12.5px; color: #c3cfdf; white-space: nowrap; padding: 5px 11px; border: 1px solid #22324d; border-radius: 99px; }
.live .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--unknown); }
.live.on .dot { background: var(--live); box-shadow: 0 0 0 3px rgba(16, 185, 129, .25); }
.live.off .dot { background: var(--offline); }
.icon-btn { display: none; background: none; border: 0; color: #fff; cursor: pointer; padding: 4px; }

.layout { flex: 1; display: flex; min-height: 0; }
.sidebar { width: 372px; flex-shrink: 0; background: var(--panel); border-right: 1px solid var(--border); display: flex; flex-direction: column; overflow: hidden; }
#map { flex: 1; }

.panel { padding: 16px 18px; border-bottom: 1px solid var(--border); display: grid; gap: 12px; }
.panel-title { font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 7px; padding: 5px 11px; border-radius: 99px; border: 1px solid var(--border); background: #fff; cursor: pointer; font: 500 12.5px Inter, sans-serif; color: var(--text-2); user-select: none; }
.chip .sw { width: 9px; height: 9px; border-radius: 50%; background: var(--c); }
.chip[aria-pressed="true"] { border-color: color-mix(in srgb, var(--c) 45%, #fff); background: color-mix(in srgb, var(--c) 8%, #fff); }
.chip[aria-pressed="false"] { opacity: .5; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
label { display: grid; gap: 5px; font-size: 12px; font-weight: 500; color: var(--muted); }
label.check { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-2); }
label.check input { width: 15px; height: 15px; accent-color: var(--primary); }
select { font: 13px Inter, sans-serif; height: 34px; padding: 0 8px; border: 1px solid var(--border); border-radius: 8px; background: #fff; color: var(--text); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 36px; padding: 0 12px; border-radius: 8px; border: 1px solid var(--border); background: #fff; font: 500 13px Inter, sans-serif; color: var(--text-2); cursor: pointer; }
.btn:hover { background: #f8fafc; }

.summary { display: grid; grid-template-columns: repeat(4, 1fr); border-bottom: 1px solid var(--border); }
.summary div { padding: 12px 4px; text-align: center; border-right: 1px solid var(--border-2); }
.summary div:last-child { border-right: 0; }
.summary b { display: block; font-size: 19px; font-weight: 700; font-variant-numeric: tabular-nums; }
.summary span { font-size: 11px; color: var(--muted); }
.notice { margin: 12px 18px 0; padding: 10px 12px; border-radius: 8px; background: #f1f5f9; color: var(--text-2); font-size: 12.5px; line-height: 1.45; }
.notice:empty { display: none; }
.notice b { color: var(--text); }

.list-head { padding: 14px 18px 6px; font-size: 11.5px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .07em; }
.list { list-style: none; margin: 0; padding: 0 10px 12px; overflow-y: auto; flex: 1; }
.list li { display: grid; grid-template-columns: 10px 1fr auto; gap: 12px; align-items: center; padding: 10px 8px; border-radius: 8px; cursor: pointer; border-bottom: 1px solid var(--border-2); }
.list li:hover { background: #f8fafc; }
.list .sw { width: 10px; height: 10px; border-radius: 50%; background: var(--c); }
.list .name { font-weight: 600; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list .sub { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list .meta { text-align: right; font-size: 12px; color: var(--muted); white-space: nowrap; }
.list .meta b { color: var(--text); font-size: 13px; }
.list .live-tag { font-size: 10.5px; font-weight: 600; color: #047857; background: #ecfdf5; border-radius: 4px; padding: 0 5px; margin-left: 4px; }
.list .empty { color: var(--muted); cursor: default; display: block; text-align: center; padding: 24px; border: 0; }
.flash { animation: flash 1.2s; }
@keyframes flash { from { background: #fef9c3; } to { background: transparent; } }
.sb-foot { padding: 10px 18px; font-size: 11px; color: var(--muted); border-top: 1px solid var(--border); }
.sb-foot a { color: var(--muted); }

/* Harita işaretçileri */
.pin-wrap { background: none; border: 0; }
.pin { width: 26px; height: 26px; border-radius: 50% 50% 50% 0; transform: rotate(-45deg); background: var(--c); border: 2px solid #fff; box-shadow: 0 1px 4px rgba(0, 0, 0, .35); display: grid; place-items: center; }
.pin svg { transform: rotate(45deg); width: 12px; height: 12px; fill: #fff; stroke: none; }
.pin.live { box-shadow: 0 0 0 3px rgba(16, 185, 129, .35), 0 1px 4px rgba(0, 0, 0, .35); }
.pin.pulse { animation: pulse 1s ease-out 2; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 var(--c); } 100% { box-shadow: 0 0 0 14px transparent; } }
.cluster { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: conic-gradient(var(--available) calc(var(--p) * 1%), var(--occupied) 0 calc(var(--q) * 1%), var(--offline) 0 calc(var(--r) * 1%), #5b6b82 0); box-shadow: 0 1px 5px rgba(0, 0, 0, .3); }
.cluster b { width: 30px; height: 30px; border-radius: 50%; background: #fff; display: grid; place-items: center; font: 600 12px Inter, sans-serif; color: var(--text); }
.me-dot { width: 16px; height: 16px; border-radius: 50%; background: #2563eb; border: 3px solid #fff; box-shadow: 0 0 0 6px rgba(37, 99, 235, .25); }

/* Popup */
.leaflet-popup-content-wrapper { border-radius: 12px; }
.leaflet-popup-content { margin: 14px 16px; min-width: 270px; font: 13px/1.45 Inter, system-ui, sans-serif; }
.pp h3 { margin: 0 0 2px; font-size: 15px; letter-spacing: -.01em; }
.pp .op { color: var(--muted); margin-bottom: 10px; }
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 99px; font-size: 12px; font-weight: 500; background: color-mix(in srgb, var(--c) 12%, #fff); color: color-mix(in srgb, var(--c) 80%, #000); border: 1px solid color-mix(in srgb, var(--c) 25%, #fff); }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--c); }
.badge.soft { --c: #94a3b8; }
.badge.soft::before { display: none; }
.pp table { width: 100%; border-collapse: collapse; margin: 10px 0; }
.pp td { padding: 5px 0; border-top: 1px solid var(--border-2); }
.pp td:last-child { text-align: right; }
.pp .src { background: #f8fafc; border: 1px solid var(--border-2); border-radius: 8px; padding: 8px 10px; font-size: 12px; color: var(--text-2); display: grid; gap: 2px; }
.pp .src span { color: var(--muted); }
.pp .foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 10px; font-size: 12px; }
.pp a { color: var(--primary); font-weight: 600; text-decoration: none; }

/* Kenar paneli sekmeleri */
.sb-tabs { display: grid; grid-template-columns: 1fr 1fr; border-bottom: 1px solid var(--border); flex-shrink: 0; }
.sb-tabs button { display: flex; align-items: center; justify-content: center; gap: 8px; height: 46px; border: 0; background: #fff; font: 600 13px Inter, sans-serif; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; }
.sb-tabs button.on { color: var(--primary); border-bottom-color: var(--primary); }
.mode { display: flex; flex-direction: column; min-height: 0; flex: 1; overflow: hidden; }
.mode[hidden] { display: none; }
.mode[data-mode-pane="route"] { overflow-y: auto; }

/* Rota formu */
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { background: #1e40af; }
.btn.sm { height: 30px; font-size: 12.5px; }
.btn:disabled { opacity: .6; cursor: wait; }
.route-form input { font: 13px Inter, sans-serif; height: 34px; padding: 0 9px; border: 1px solid var(--border); border-radius: 8px; width: 100%; min-width: 0; color: var(--text); background: #fff; }
.route-form input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(29, 78, 216, .12); }
.rf-points { display: grid; gap: 8px; }
.ac { position: relative; display: flex; align-items: center; gap: 6px; }
.ac input { flex: 1; }
.pt { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: 11px; font-weight: 700; color: #fff; flex-shrink: 0; }
.pt.a { background: #0f766e; }
.pt.b { background: #b91c1c; }
.mini { width: 30px; height: 30px; border-radius: 7px; border: 1px solid var(--border); background: #fff; display: grid; place-items: center; cursor: pointer; color: var(--muted); flex-shrink: 0; }
.mini:hover, .mini.on { color: var(--primary); border-color: var(--primary); }
.mini svg { width: 15px; height: 15px; }
.ac-list { position: absolute; z-index: 1200; top: 38px; left: 28px; right: 72px; margin: 0; padding: 4px; list-style: none; background: #fff; border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 10px 30px rgba(15, 23, 42, .15); max-height: 260px; overflow-y: auto; }
.ac-list li { padding: 7px 9px; border-radius: 6px; cursor: pointer; font-size: 13px; }
.ac-list li:hover, .ac-list li.hl { background: #f1f5f9; }
.ac-list small { display: block; color: var(--muted); font-size: 11.5px; }
.row3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.chip-check { display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border-radius: 99px; border: 1px solid var(--border); font-size: 12.5px; font-weight: 500; color: var(--text-2); cursor: pointer; }
.chip-check:has(input:checked) { border-color: var(--primary); background: #eff4ff; color: var(--primary); }
.chip-check input { width: 13px; height: 13px; accent-color: var(--primary); margin: 0; }
.form-msg { font-size: 12.5px; color: var(--offline); }
.form-msg:empty { display: none; }

/* Rota sonucu */
.route-result { padding: 0 18px 18px; display: grid; gap: 12px; }
.route-result:empty { display: none; }
.rsum { display: grid; grid-template-columns: repeat(3, 1fr); border: 1px solid var(--border); border-radius: 10px; overflow: hidden; margin-top: 14px; }
.rsum div { padding: 10px 6px; text-align: center; border-right: 1px solid var(--border-2); }
.rsum div:last-child { border-right: 0; }
.rsum b { display: block; font-size: 16px; }
.rsum span { font-size: 11px; color: var(--muted); }
.warn { font-size: 12.5px; background: #fffbeb; border: 1px solid #fde68a; color: #78350f; border-radius: 8px; padding: 8px 10px; }
.rhead { display: flex; justify-content: space-between; align-items: center; font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); margin-top: 4px; }
.stop { display: grid; grid-template-columns: 28px 1fr; gap: 10px; padding: 11px; border: 1px solid var(--border); border-radius: 10px; cursor: pointer; background: #fff; }
.stop:hover { border-color: var(--primary); }
.stop .n { width: 26px; height: 26px; border-radius: 50%; background: var(--primary); color: #fff; font-weight: 700; font-size: 12px; display: grid; place-items: center; }
.stop .t { font-weight: 600; font-size: 13.5px; }
.stop .s { font-size: 12px; color: var(--muted); margin-top: 1px; }
.stop .kv { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 7px; }
.pill { font-size: 11.5px; padding: 1px 8px; border-radius: 99px; background: #f1f5f9; color: var(--text-2); white-space: nowrap; }
.pill.live { background: #ecfdf5; color: #047857; }
.pill.warnp { background: #fffbeb; color: #92400e; }
.along { list-style: none; margin: 0; padding: 0; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.along li { display: grid; grid-template-columns: 56px 1fr auto; gap: 8px; align-items: center; padding: 8px 10px; border-bottom: 1px solid var(--border-2); font-size: 12.5px; cursor: pointer; }
.along li:last-child { border-bottom: 0; }
.along li:hover { background: #f8fafc; }
.along .km { font-weight: 600; color: var(--primary); font-variant-numeric: tabular-nums; }
.along .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.along .pw { color: var(--muted); white-space: nowrap; }
.ractions { display: flex; gap: 8px; }
.ractions .btn { flex: 1; text-decoration: none; }
.num-pin { width: 30px; height: 30px; border-radius: 50%; background: var(--primary); color: #fff; font: 700 13px Inter, sans-serif; display: grid; place-items: center; border: 3px solid #fff; box-shadow: 0 2px 8px rgba(0, 0, 0, .35); }
.end-pin { width: 26px; height: 26px; border-radius: 50%; color: #fff; font: 700 12px Inter, sans-serif; display: grid; place-items: center; border: 3px solid #fff; box-shadow: 0 2px 6px rgba(0, 0, 0, .35); }
.dot-pin { width: 12px; height: 12px; border-radius: 50%; background: var(--c); border: 2px solid #fff; box-shadow: 0 0 0 1px rgba(15, 23, 42, .25); }
.picking #map { cursor: crosshair; }

@media (max-width: 820px) {
  .icon-btn { display: block; }
  .brand small, .live #live-text { display: none; }
  .topbar { gap: 10px; padding: 10px 12px; }
  .sidebar { position: absolute; top: 57px; bottom: 0; left: 0; z-index: 900; width: min(372px, 92vw); transform: translateX(-100%); transition: transform .2s; box-shadow: 2px 0 12px rgba(0, 0, 0, .15); }
  .sidebar.open { transform: none; }
}

/* Alternatif duraklar */
.alts { margin-top: 8px; }
.alts summary { cursor: pointer; font-size: 12px; color: var(--primary); font-weight: 600; }
.alts .along { margin-top: 6px; }
.alts .along li { grid-template-columns: 52px 1fr auto; font-size: 12px; }
#vehicle-note { line-height: 1.4; }
