:root {
  --bg: #f4f5f7; --panel: #ffffff; --text: #16191d; --muted: #6b7280; --line: #e3e5e8;
  --accent: #e8590c; --accent-dark: #c2410c; --ok: #2f9e44; --warn: #f08c00; --bad: #e03131; --info: #1971c2;
  --shadow: 0 8px 28px rgba(15, 23, 42, .16); --radius: 16px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #0f1216; --panel: #1a1e24; --text: #eef0f3; --muted: #9aa3ad; --line: #2b3139; --shadow: 0 8px 28px rgba(0,0,0,.5); }
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); -webkit-tap-highlight-color: transparent; }
body { display: flex; flex-direction: column; overflow: hidden; }
button { font: inherit; cursor: pointer; border: 0; border-radius: 12px; }
input, select, textarea { font: inherit; color: var(--text); background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 12px; width: 100%; }
label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 4px; }

.topbar { display: flex; align-items: center; gap: 10px; padding: 10px 16px; padding-top: max(10px, env(safe-area-inset-top));
  background: var(--panel); border-bottom: 1px solid var(--line); z-index: 500; }
.topbar h1 { font-size: 17px; margin: 0; flex: 1; }
.topbar .logo { width: 30px; height: 30px; border-radius: 8px; background: var(--accent); display: grid; place-items: center; color: #fff; font-weight: 800; font-size: 15px; }
.topbar a { color: var(--muted); font-size: 13px; text-decoration: none; }
.conn { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.conn::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--bad); }
.conn.on::before { background: var(--ok); }

.layout { flex: 1; display: flex; min-height: 0; position: relative; }
#map { flex: 1; min-height: 0; z-index: 1; }

.sheet { position: absolute; left: 0; right: 0; bottom: 0; z-index: 600; background: var(--panel);
  border-radius: var(--radius) var(--radius) 0 0; box-shadow: var(--shadow); padding: 16px;
  padding-bottom: max(16px, env(safe-area-inset-bottom)); max-height: 62vh; overflow: auto; }
@media (min-width: 900px) {
  .sheet { position: static; width: 380px; max-height: none; border-radius: 0; box-shadow: none; border-left: 1px solid var(--line); }
  .layout { flex-direction: row-reverse; }
  .sheet { border-left: 0; border-right: 1px solid var(--line); }
}
.sheet h2 { font-size: 14px; margin: 0 0 10px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }

.big-btn { width: 100%; padding: 18px; font-size: 18px; font-weight: 700; background: var(--accent); color: #fff; box-shadow: 0 4px 14px rgba(232, 89, 12, .35); }
.big-btn:active { background: var(--accent-dark); transform: scale(.99); }
.big-btn:disabled { opacity: .5; box-shadow: none; }
.btn { padding: 12px 16px; font-weight: 600; background: var(--bg); color: var(--text); border: 1px solid var(--line); }
.btn.ok { background: var(--ok); color: #fff; border-color: var(--ok); }
.btn.bad { background: var(--bad); color: #fff; border-color: var(--bad); }
.btn.info { background: var(--info); color: #fff; border-color: var(--info); }
.btn.sm { padding: 6px 10px; font-size: 13px; border-radius: 8px; }
.row { display: flex; gap: 10px; }
.row > * { flex: 1; }
.stack > * + * { margin-top: 12px; }
.muted { color: var(--muted); font-size: 14px; }
.small { font-size: 13px; }

.nearest { display: flex; align-items: center; gap: 12px; padding: 12px; background: var(--bg); border-radius: 12px; }
.nearest b { display: block; }
.dot { width: 14px; height: 14px; border-radius: 50%; flex: none; }
.status-card { padding: 16px; border-radius: 14px; background: var(--bg); text-align: center; }
.status-card .title { font-size: 20px; font-weight: 800; margin: 4px 0; }
.status-card .eta { font-size: 34px; font-weight: 800; color: var(--accent); }
.spinner { width: 28px; height: 28px; border: 3px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin 1s linear infinite; margin: 6px auto; }
@keyframes spin { to { transform: rotate(360deg); } }

.pill { display: inline-block; padding: 3px 9px; border-radius: 999px; font-size: 12px; font-weight: 700; color: #fff; white-space: nowrap; }
.pill.bos { background: var(--ok); } .pill.cagrida { background: var(--warn); } .pill.yolcuda { background: var(--info); }
.pill.mola { background: #868e96; } .pill.pasif { background: #495057; } .pill.dolu { background: var(--bad); } .pill.offline { background: #adb5bd; }

.vmark { position: relative; }
.vmark .b { width: 34px; height: 34px; border-radius: 50%; border: 3px solid #fff; box-shadow: 0 2px 8px rgba(0,0,0,.35); display: grid; place-items: center; color: #fff; font-weight: 800; font-size: 13px; }
.vmark .l { position: absolute; top: 36px; left: 50%; transform: translateX(-50%); white-space: nowrap; background: rgba(0,0,0,.72); color: #fff; font-size: 11px; padding: 2px 6px; border-radius: 6px; }
.vmark.offline .b { filter: grayscale(1); opacity: .55; }
.me-mark { width: 18px; height: 18px; border-radius: 50%; background: #1c7ed6; border: 3px solid #fff; box-shadow: 0 0 0 6px rgba(28,126,214,.25); }
.pax-mark { font-size: 30px; line-height: 1; filter: drop-shadow(0 2px 3px rgba(0,0,0,.4)); }
.stop-mark { width: 12px; height: 12px; border-radius: 3px; background: #fff; border: 3px solid #495057; }

.overlay { position: fixed; inset: 0; z-index: 2000; background: rgba(0,0,0,.6); display: grid; place-items: center; padding: 16px; }
.overlay .card { background: var(--panel); border-radius: 20px; padding: 22px; width: 100%; max-width: 420px; box-shadow: var(--shadow); text-align: center; }
.overlay h3 { margin: 0 0 6px; font-size: 24px; }
.countdown { height: 8px; background: var(--line); border-radius: 99px; overflow: hidden; margin: 14px 0; }
.countdown > div { height: 100%; background: var(--accent); transition: width 1s linear; }
.hidden { display: none !important; }

.list { list-style: none; margin: 0; padding: 0; }
.list li { padding: 10px 4px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 10px; }
.list li .grow { flex: 1; min-width: 0; }
.center-page { flex: 1; display: grid; place-items: center; padding: 20px; overflow: auto; }
.login { width: 100%; max-width: 380px; background: var(--panel); border-radius: 18px; padding: 24px; box-shadow: var(--shadow); }
.login h2 { margin-top: 0; }
.tbl-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 7px 5px; border-bottom: 1px solid var(--line); }
.toast { position: fixed; left: 50%; top: 70px; transform: translateX(-50%); background: #222; color: #fff; padding: 10px 16px; border-radius: 10px; z-index: 3000; font-size: 14px; box-shadow: var(--shadow); max-width: 90vw; }
.leaflet-container { background: #dfe3e8; font: inherit; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stats div { background: var(--bg); border-radius: 10px; padding: 10px; text-align: center; }
.stats b { display: block; font-size: 22px; }

/* araçtaki yolcular */
.load { display: flex; align-items: baseline; gap: 8px; }
.load b { font-size: 30px; font-weight: 800; font-variant-numeric: tabular-nums; }
.load .bar { flex: 1; height: 8px; background: var(--line); border-radius: 9px; overflow: hidden; align-self: center; }
.load .bar i { display: block; height: 100%; background: var(--info); }
.jobs h4 { margin: 10px 0 4px; font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.job { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.job .no { min-width: 44px; text-align: center; font-weight: 800; font-size: 17px; background: var(--bg); border-radius: 8px; padding: 5px 4px; font-variant-numeric: tabular-nums; }
.job.wait .no { background: #fff4e6; color: #d9480f; }
.job .grow { flex: 1; min-width: 0; }
.job .grow small { display: block; color: var(--muted); }
.code { font-size: 44px; font-weight: 800; letter-spacing: .04em; color: var(--text); line-height: 1; }
.pax-list { margin: 4px 0 0 24px; padding: 0; list-style: none; font-size: 13px; color: var(--muted); }
.pax-list li { border: 0; padding: 2px 0; }

/* acil durum */
.sos-btn { background: #e03131; color: #fff; font-weight: 800; padding: 7px 12px; border-radius: 9px; letter-spacing: .04em; flex: none; box-shadow: 0 2px 8px rgba(224,49,49,.35); }
.sos-banner { background: #e03131; color: #fff; padding: 9px 16px; font-weight: 600; font-size: 14px; cursor: pointer; z-index: 500; display: flex; gap: 8px; align-items: center; }
.sos-banner.ok { background: #2f9e44; }
.team-btn { width: 100%; display: flex; align-items: center; gap: 14px; padding: 16px; border-radius: 14px; color: #fff; font-size: 20px; font-weight: 800; text-align: left; }
.team-btn .ico { font-size: 30px; }
.team-btn small { display: block; font-size: 12px; font-weight: 500; opacity: .9; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { padding: 8px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--bg); font-size: 14px; }
.chip.on { background: var(--text); color: var(--panel); border-color: var(--text); }
.warn-box { background: #fff4e6; color: #a8450a; border-radius: 10px; padding: 10px 12px; font-size: 14px; text-align: left; }
@media (prefers-color-scheme: dark) { .warn-box { background: #3a2519; color: #ffc08a; } }
.resp { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--line); text-align: left; }
.resp .grow { flex: 1; }
.sos-mark { font-size: 26px; line-height: 1; width: 40px; height: 40px; display: grid; place-items: center; border-radius: 50%; border: 3px solid #fff; box-shadow: 0 0 0 6px rgba(224,49,49,.3), 0 2px 8px rgba(0,0,0,.4); animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 14px rgba(224,49,49,0), 0 2px 8px rgba(0,0,0,.4); } }
@media (prefers-reduced-motion: reduce) { .sos-mark { animation: none; } }
.staff-mark { width: 30px; height: 30px; border-radius: 50%; border: 3px solid #fff; display: grid; place-items: center; font-size: 15px; box-shadow: 0 2px 6px rgba(0,0,0,.4); }
.ecard { border: 1px solid var(--line); border-left: 6px solid var(--bad); border-radius: 12px; padding: 12px; }
.ecard.unans { background: #fff5f5; }
@media (prefers-color-scheme: dark) { .ecard.unans { background: #2c1a1a; } }
.ecard h4 { margin: 0 0 2px; font-size: 18px; }
.ecard .meta { font-size: 13px; color: var(--muted); }
.alarm { position: fixed; inset: 0; z-index: 4000; background: #c92a2a; color: #fff; display: grid; place-items: center; padding: 20px; text-align: center; }
.alarm .big { font-size: 28px; font-weight: 900; margin: 6px 0; }
.alarm .btn { font-size: 18px; padding: 16px; }
.team-pill { display: inline-block; padding: 3px 9px; border-radius: 999px; color: #fff; font-size: 12px; font-weight: 700; }

.brand-logo { display: block; width: 150px; max-width: 55%; margin: 0 auto 6px; }

/* bugünkü hareketlerim */
.mylog { border: 1px solid var(--line); border-radius: 12px; padding: 8px 12px; }
.mylog summary { cursor: pointer; padding: 4px 0; list-style-position: inside; }
.mylog-sum { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin: 8px 0; }
.mylog-sum div { background: var(--bg); border-radius: 10px; padding: 6px 8px; text-align: center; }
.mylog-sum b { display: block; font-size: 18px; }
.mylog-sum span { font-size: 11px; color: var(--muted); }
.mylog-list { list-style: none; margin: 0; padding: 0; max-height: 320px; overflow: auto; }
.mylog-list li { display: flex; gap: 8px; align-items: flex-start; padding: 7px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.mylog-list time { font-variant-numeric: tabular-nums; color: var(--muted); font-size: 13px; min-width: 40px; padding-top: 1px; }
.mylog-list .ico { width: 20px; text-align: center; }

/* konum uyarıları */
.gps-uyari { color: var(--warn); font-weight: 600; }
.uyari { color: var(--warn); font-weight: 600; }

/* yolcu türü seçimi (yönetim → yolcular) */
.tur-sec { width: auto; flex: none; padding: 6px 8px; font-size: 13px; }
.tur-sec.eksik { border-color: var(--warn); color: var(--warn); font-weight: 600; }

/* vardiya sekmesi */
.vd-simdi { border: 2px solid #008000; border-radius: 14px; padding: 12px; display: grid; gap: 8px; }
.vd-toplam { display: flex; align-items: baseline; gap: 8px; }
.vd-toplam b { font-size: 44px; line-height: 1; font-variant-numeric: tabular-nums; }
.vd-turler { display: grid; grid-template-columns: repeat(auto-fit, minmax(90px, 1fr)); gap: 6px; }
.vd-turler div { border-radius: 10px; padding: 8px; background: var(--bg); border-left: 4px solid var(--line); }
.vd-turler b { display: block; font-size: 24px; font-variant-numeric: tabular-nums; }
.vd-turler span { font-size: 12px; color: var(--muted); }
.vd-turler .vd-personel { border-left-color: var(--info); }
.vd-turler .vd-normal { border-left-color: var(--ok); }
.vd-turler .vd-taseron { border-left-color: var(--warn); }
.vd-turler .vd-belirsiz { border-left-color: #868e96; }
.vd-tablo td, .vd-tablo th { text-align: right; font-variant-numeric: tabular-nums; }
.vd-tablo td:first-child, .vd-tablo th:first-child { text-align: left; }
.vd-tablo tr.vd-aktif td { background: rgba(0, 128, 0, .08); }
.vd-tablo tr.vd-top td { font-weight: 700; border-top: 2px solid var(--line); }

/* bağlantı / sürüm şeridi (tüm ekranlar) */
.serit { position: fixed; left: 50%; transform: translateX(-50%); top: 8px; z-index: 5000; max-width: min(640px, calc(100% - 16px));
  display: flex; gap: 10px; align-items: center; padding: 10px 14px; border-radius: 12px; font-size: 14px; font-weight: 600;
  box-shadow: 0 6px 24px rgba(0,0,0,.25); color: #fff; background: #495057; }
.serit[hidden] { display: none; }
.serit.uyari { background: #c92a2a; }
.serit.iyi { background: #2b8a3e; }
.serit.bilgi { background: #1971c2; }
.serit button { flex: none; background: #fff; color: #16191d; border-radius: 8px; padding: 6px 10px; font-weight: 700; }

/* harita ayarları (yönetim) */
.hm-merkez .row { flex-wrap: wrap; }
.hm-bilgi { display: flex; flex-direction: column; gap: 4px; padding: 10px 12px; border-radius: 12px; background: var(--bg); }
.hm-yeni { padding: 10px 12px; border: 2px solid var(--ok, #2f9e44); border-radius: 12px; display: flex; flex-direction: column; gap: 6px; }
.hm-yeni label { font-weight: 600; }
.hm-durak input { flex: 1; min-width: 0; }
.hm-sira { display: inline-flex; min-width: 22px; height: 22px; align-items: center; justify-content: center; border-radius: 11px; background: #1971c2; color: #fff; font-size: 12px; font-weight: 700; flex: none; }
.stop-mark.duzenle { width: 18px; height: 18px; margin: -3px; cursor: grab; box-shadow: 0 0 0 3px rgba(25,113,194,.35); }
.hm-yeni-mark { width: 18px; height: 18px; border-radius: 50%; background: #2f9e44; border: 3px solid #fff; box-shadow: 0 0 0 3px rgba(47,158,68,.45); margin: -3px; }
.hm-etiket { font-weight: 600; }

/* üst çubukta "Ana sayfa" (giriş seçimine dön) düğmesi */
.topbar a.ana-sayfa { flex: none; display: inline-flex; align-items: center; gap: 4px; padding: 6px 10px; border-radius: 9px; background: var(--bg); color: var(--text); font-weight: 700; font-size: 13px; border: 1px solid var(--line, rgba(0,0,0,.12)); }
.topbar a.ana-sayfa span { font-size: 20px; line-height: 14px; margin-top: -2px; }
.topbar a.ana-sayfa:active { transform: scale(.97); }
@media (max-width: 420px) { .topbar .logo, .topbar .brand-mini { display: none; } .topbar h1 { font-size: 16px; } }
.topbar h1 { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 420px) {
  .topbar { gap: 6px; padding-left: 10px; padding-right: 10px; }
  .topbar #meBtn { max-width: 30vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .topbar .conn { font-size: 0; }            /* telefonda yalnızca renkli nokta */
  .topbar .conn { gap: 0; }
  /* yolcu ekranı: ad düğmesi ve ACİL görünürken başlık yer kaplamasın */
  .topbar h1:has(~ #meBtn:not(.hidden)) { flex: 1 1 0; font-size: 0; }
  .topbar #meBtn { max-width: 38vw; }
}

/* hizmet alanı uyarıları */
.alan-uyari { display: flex; gap: 8px; align-items: flex-start; background: #fff4e6; color: #a8450a; border-radius: 10px; padding: 10px 12px; font-size: 14px; width: 100%; }
.alan-uyari b, .alan-uyari span { display: block; }
@media (prefers-color-scheme: dark) { .alan-uyari { background: #3a2519; color: #ffc08a; } }
.alan-serit { background: #f08c00; color: #fff; padding: 9px 16px; font-weight: 700; font-size: 14px; z-index: 500; }
.alan-kutu { border: 2px solid #f08c00; border-radius: 12px; padding: 10px; }
.alan-kutu h2 { color: #d9480f !important; }
.hm-alan-btns { display: flex; flex-wrap: wrap; gap: 6px; }

/* güzergah (yönetim) */
.gz-vardiyalar { display: flex; flex-wrap: wrap; gap: 6px; }
.gz-vardiyalar button { flex: none; }
.gz-vardiyalar button[aria-pressed="true"] { background: var(--info, #1971c2); color: #fff; border-color: transparent; }
.gz-ozet { display: grid; grid-template-columns: repeat(auto-fit, minmax(90px, 1fr)); gap: 6px; }
.gz-ozet div { background: var(--bg); border-radius: 10px; padding: 8px; text-align: center; }
.gz-ozet b { display: block; font-size: 18px; }
.gz-ozet span { font-size: 11px; color: var(--muted); }
.gz-oynat { display: flex; gap: 8px; align-items: center; }
.gz-oynat input[type=range] { flex: 1; padding: 0; }
.gz-olaylar li { cursor: pointer; }
.gz-olaylar time { font-variant-numeric: tabular-nums; font-weight: 700; min-width: 44px; }
.gz-mark { width: 26px; height: 26px; border-radius: 50%; background: #fff; border: 2px solid #1971c2; display: grid; place-items: center; font-size: 13px; box-shadow: 0 1px 4px rgba(0,0,0,.35); }
.gz-uc { width: 16px; height: 16px; border-radius: 50%; border: 3px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,.4); }
.gz-arac { width: 22px; height: 22px; border-radius: 50%; background: #1971c2; border: 3px solid #fff; box-shadow: 0 0 0 3px rgba(25,113,194,.35); }
