:root {
  --bg: #f5f7fb; --card: #ffffff; --line: #e5e9f2; --text: #0f172a; --muted: #64748b;
  --blue: #1d4ed8; --blue-2: #2563eb; --blue-soft: #eaf1ff;
  --green: #16a34a; --orange: #f59e0b; --park: #3b82f6; --gray: #94a3b8; --red: #dc2626;
  --radius: 12px; --shadow: 0 1px 2px rgba(15,23,42,.05), 0 4px 16px rgba(15,23,42,.05);
  --side: 232px; --top: 56px; --bottom: 0px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font: 14px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif; color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; }
a { color: var(--blue-2); text-decoration: none; }
button, input, select { font: inherit; }
h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -.01em; }
h1 { font-size: 20px; } h2 { font-size: 16px; } h3 { font-size: 14px; }
.muted { color: var(--muted); } .small { font-size: 12px; }

/* Düzen */
.layout { display: grid; grid-template-columns: var(--side) 1fr; grid-template-rows: var(--top) 1fr; height: 100vh; }
.sidebar { grid-row: 1 / 3; background: #fff; border-right: 1px solid var(--line); display: flex; flex-direction: column; }
.brand { height: var(--top); display: flex; align-items: center; gap: 10px; padding: 0 18px; font-weight: 700; color: var(--blue); border-bottom: 1px solid var(--line); }
.brand .logo { width: 28px; height: 28px; border-radius: 8px; background: linear-gradient(135deg, var(--blue), #60a5fa); display: grid; place-items: center; color: #fff; font-size: 14px; }
.nav { padding: 10px; overflow: auto; flex: 1; }
.nav .sec { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 14px 10px 6px; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 8px; color: #334155; }
.nav a:hover { background: var(--bg); }
.nav a.active { background: var(--blue-soft); color: var(--blue); font-weight: 600; }
.topbar { display: flex; align-items: center; justify-content: space-between; padding: 0 20px; background: #fff; border-bottom: 1px solid var(--line); }
.topbar .user { display: flex; align-items: center; gap: 12px; }
.main { overflow: auto; padding: 20px; }
.main.full { padding: 0; overflow: hidden; }
.bottomnav { display: none; }

/* Bileşenler */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card .hd { padding: 14px 16px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.card .bd { padding: 16px; }
.grid { display: grid; gap: 14px; }
.stats { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.stat { padding: 14px 16px; }
.stat .v { font-size: 24px; font-weight: 600; margin-top: 4px; }
.stat .l { color: var(--muted); font-size: 12px; display: flex; align-items: center; gap: 6px; }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; flex: none; }
.s-moving { background: var(--green); } .s-idle { background: var(--orange); } .s-parked { background: var(--park); } .s-offline { background: var(--gray); }
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 2px 8px; border-radius: 999px; font-size: 12px; background: var(--bg); color: #334155; border: 1px solid var(--line); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 8px 14px; border-radius: 8px; border: 1px solid var(--line); background: #fff; color: var(--text); cursor: pointer; }
.btn:hover { border-color: #cbd5e1; }
.btn.primary { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn.primary:hover { background: #1e40af; }
.btn.sm { padding: 5px 10px; font-size: 13px; }
.input, select.input { width: 100%; padding: 9px 11px; border: 1px solid var(--line); border-radius: 8px; background: #fff; outline: none; }
.input:focus { border-color: var(--blue-2); box-shadow: 0 0 0 3px rgba(37,99,235,.12); }
label.f { display: block; margin-bottom: 12px; } label.f span { display: block; font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
table.t { width: 100%; border-collapse: collapse; }
table.t th { text-align: left; font-weight: 500; color: var(--muted); font-size: 12px; padding: 10px 12px; border-bottom: 1px solid var(--line); background: #fafbfd; white-space: nowrap; }
table.t td { padding: 10px 12px; border-bottom: 1px solid var(--line); }
table.t tr:hover td { background: #fafcff; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.tabs a { padding: 10px 14px; color: var(--muted); border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs a.active { color: var(--blue); border-color: var(--blue); font-weight: 600; }
.kv { display: grid; grid-template-columns: 1fr auto; gap: 8px 16px; }
.kv div:nth-child(odd) { color: var(--muted); }
.kv div:nth-child(even) { text-align: right; font-weight: 500; }
.notice { padding: 10px 12px; border-radius: 8px; background: var(--blue-soft); color: #1e3a8a; font-size: 13px; }
.warn { background: #fff7ed; color: #9a3412; }
.empty { padding: 30px; text-align: center; color: var(--muted); }
.toast { position: fixed; right: 16px; bottom: 16px; background: #0f172a; color: #fff; padding: 10px 14px; border-radius: 8px; z-index: 1000; box-shadow: var(--shadow); }
.modal-bg { position: fixed; inset: 0; background: rgba(15,23,42,.35); display: grid; place-items: center; z-index: 900; padding: 16px; }
.modal { width: min(560px, 100%); max-height: 90vh; overflow: auto; }

/* Giriş */
.login { min-height: 100vh; display: grid; place-items: center; background: linear-gradient(160deg, #eff6ff, #fff 60%); padding: 16px; }
.login .card { width: min(400px, 100%); }
.login .bd { padding: 28px; }

/* Canlı takip */
.live { display: grid; grid-template-columns: 300px 1fr 340px; grid-template-rows: auto 1fr; height: calc(100vh - var(--top)); }
.live .summary { grid-column: 1 / 4; display: flex; gap: 8px; padding: 10px 14px; background: #fff; border-bottom: 1px solid var(--line); overflow-x: auto; }
.chip { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border: 1px solid var(--line); border-radius: 999px; background: #fff; cursor: pointer; white-space: nowrap; }
.chip.on { border-color: var(--blue-2); background: var(--blue-soft); }
.chip b { font-weight: 600; }
.vlist { background: #fff; border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.vlist .search { padding: 10px; border-bottom: 1px solid var(--line); }
.vlist .items { overflow: auto; flex: 1; }
.vitem { display: flex; gap: 10px; padding: 11px 14px; border-bottom: 1px solid #f1f4f9; cursor: pointer; }
.vitem:hover { background: #fafcff; } .vitem.sel { background: var(--blue-soft); }
.vitem .p { font-weight: 600; } .vitem .m { color: var(--muted); font-size: 12px; }
.mapwrap { position: relative; min-height: 0; }
#map, .map { position: absolute; inset: 0; }
.detail { background: #fff; border-left: 1px solid var(--line); overflow: auto; }
.detail .hd { padding: 14px 16px; border-bottom: 1px solid var(--line); }
.detail .bd { padding: 14px 16px; }
.speed { font-size: 28px; font-weight: 600; }
.map-ctrl { position: absolute; top: 10px; left: 10px; z-index: 5; }

/* Geçmiş güzergâh */
.hist { display: grid; grid-template-columns: 320px 1fr; gap: 0; height: 560px; border-top: 1px solid var(--line); }
.hist .side { overflow: auto; border-right: 1px solid var(--line); padding: 14px; }
.player { position: absolute; left: 10px; right: 10px; bottom: 10px; background: #fff; border-radius: 10px; box-shadow: var(--shadow); padding: 8px 12px; display: flex; gap: 10px; align-items: center; z-index: 5; }
.player input[type=range] { flex: 1; }

/* Mobil */
@media (max-width: 900px) {
  :root { --bottom: 62px; }
  .layout { grid-template-columns: 1fr; grid-template-rows: var(--top) 1fr var(--bottom); }
  .sidebar { display: none; }
  .main { padding: 14px; padding-bottom: 20px; }
  .bottomnav { display: flex; background: #fff; border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
  .bottomnav a { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: 11px; color: var(--muted); gap: 2px; }
  .bottomnav a .i { font-size: 18px; } .bottomnav a.active { color: var(--blue); font-weight: 600; }
  .live { grid-template-columns: 1fr; grid-template-rows: auto 1fr; height: calc(100vh - var(--top) - var(--bottom)); }
  .live .summary { grid-column: 1; }
  .vlist { display: none; }
  .detail { position: absolute; left: 0; right: 0; bottom: 0; max-height: 55%; border-radius: 16px 16px 0 0; border: 1px solid var(--line); box-shadow: 0 -8px 24px rgba(15,23,42,.12); z-index: 10; }
  .detail.hidden { display: none; }
  .hist { grid-template-columns: 1fr; height: auto; } .hist .side { border-right: 0; } .hist .mapbox { height: 420px; position: relative; }
  .hide-m { display: none; }
}
