:root {
  --bg: #0e1116;
  --surface: #161b22;
  --surface-2: #1f2630;
  --line: #2a323d;
  --text: #e8edf3;
  --muted: #8b97a6;
  --accent: #2fd4a7;
  --accent-ink: #04261c;
  --warn: #f5b041;
  --danger: #f05d5d;
  --car: #2a3340;
  --car-line: #4a5666;
  --radius: 16px;
  color-scheme: dark;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #f3f5f8;
    --surface: #ffffff;
    --surface-2: #eef1f5;
    --line: #dde2e9;
    --text: #141a22;
    --muted: #5f6b7a;
    --accent: #0fa883;
    --accent-ink: #ffffff;
    --warn: #c47f06;
    --danger: #d23c3c;
    --car: #e3e8ee;
    --car-line: #a9b3bf;
    color-scheme: light;
  }
}
:root[data-theme="light"] {
  --bg: #f3f5f8; --surface: #ffffff; --surface-2: #eef1f5; --line: #dde2e9; --text: #141a22; --muted: #5f6b7a;
  --accent: #0fa883; --accent-ink: #ffffff; --warn: #c47f06; --danger: #d23c3c; --car: #e3e8ee; --car-line: #a9b3bf;
  color-scheme: light;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-tap-highlight-color: transparent;
}
#app { max-width: 560px; margin: 0 auto; min-height: 100dvh; padding-bottom: calc(76px + env(safe-area-inset-bottom)); }
main { padding: 0 16px 16px; outline: none; }
h1, h2, h3 { margin: 0; font-weight: 650; letter-spacing: -0.01em; }
h2 { font-size: 13px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin: 22px 2px 8px; }
button, input, select { font: inherit; color: inherit; }
a { color: var(--accent); }
.muted { color: var(--muted); }
.num { font-variant-numeric: tabular-nums; }

/* üst çubuk */
.top { display: flex; align-items: center; justify-content: space-between; padding: calc(12px + env(safe-area-inset-top)) 16px 8px; }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 18px; }
.bolt { width: 26px; height: 26px; border-radius: 8px; background: var(--accent); display: grid; place-items: center; }
.bolt svg { width: 16px; height: 16px; fill: var(--accent-ink); }
.top-car { font-size: 13px; color: var(--muted); text-align: right; }

/* alt sekmeler */
.tabs { position: fixed; left: 0; right: 0; bottom: 0; display: flex; justify-content: center; gap: 4px;
  background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(12px);
  border-top: 1px solid var(--line); padding: 6px 8px calc(6px + env(safe-area-inset-bottom)); z-index: 10; }
.tabs a { flex: 1; max-width: 130px; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 0;
  font-size: 12px; color: var(--muted); text-decoration: none; border-radius: 12px; }
.tabs svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tabs a.on { color: var(--accent); }

/* kartlar */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.card + .card { margin-top: 12px; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.chip { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; padding: 3px 10px; border-radius: 99px; background: var(--surface-2); color: var(--muted); }
.chip::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.chip.online { color: var(--accent); }
.chip.asleep { color: var(--warn); }

/* batarya */
.hero { padding: 18px 16px 16px; }
.soc { font-size: 56px; font-weight: 700; line-height: 1; letter-spacing: -0.03em; }
.soc small { font-size: 22px; color: var(--muted); font-weight: 600; margin-left: 2px; }
.range { font-size: 20px; font-weight: 600; text-align: right; }
.range small { display: block; font-size: 12px; color: var(--muted); font-weight: 500; }
.bar { position: relative; height: 10px; border-radius: 99px; background: var(--surface-2); margin: 16px 0 6px; overflow: visible; }
.bar > i { position: absolute; inset: 0 auto 0 0; border-radius: 99px; background: var(--accent); transition: width .6s; }
.bar > i.charging { background: repeating-linear-gradient(-45deg, var(--accent) 0 8px, color-mix(in srgb, var(--accent) 70%, white) 8px 16px); background-size: 22px 22px; animation: flow 1s linear infinite; }
@keyframes flow { to { background-position: 22px 0; } }
.bar > b { position: absolute; top: -4px; bottom: -4px; width: 2px; background: var(--text); opacity: .55; border-radius: 2px; }
.bar-legend { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); }
.charge-info { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 14px; }
.charge-info div { background: var(--surface-2); border-radius: 12px; padding: 8px 10px; }
.charge-info b { display: block; font-size: 17px; }
.charge-info span { font-size: 11px; color: var(--muted); }

/* araç çizimi */
.car-wrap { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px; }
.car-wrap svg.car { width: 150px; height: auto; display: block; }
.car .body { fill: var(--car); stroke: var(--car-line); stroke-width: 2; }
.car .glass { fill: color-mix(in srgb, var(--car-line) 45%, transparent); }
.car .part { fill: transparent; stroke: transparent; }
.car .part.open { fill: color-mix(in srgb, var(--warn) 35%, transparent); stroke: var(--warn); stroke-width: 2; }
.car .tire { fill: var(--muted); }
.car .tire.low { fill: var(--danger); }
.tp { font-size: 13px; line-height: 1.2; }
.tp.left { text-align: right; }
.tp div { margin: 46px 0; }
.tp b { font-size: 16px; display: block; }
.tp .low { color: var(--danger); }
.status-list { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; justify-content: center; }
.status-list .chip.warn { color: var(--warn); }

/* hızlı işlemler */
.actions { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.act { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; min-height: 78px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 10px 4px; font-size: 12px; cursor: pointer; text-align: center; }
.act svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.act.on { background: color-mix(in srgb, var(--accent) 16%, var(--surface)); border-color: color-mix(in srgb, var(--accent) 60%, var(--line)); color: var(--accent); }
.act:active { transform: scale(.97); }
.act[disabled] { opacity: .45; cursor: default; }
.act.busy { opacity: .6; pointer-events: none; }

/* klima ve şarj sınırı */
.temps { display: flex; gap: 20px; }
.temps b { font-size: 22px; display: block; }
.stepper { display: flex; align-items: center; gap: 4px; }
.stepper button { width: 40px; height: 40px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface-2); font-size: 20px; cursor: pointer; }
.stepper output { min-width: 64px; text-align: center; font-size: 22px; font-weight: 650; }
input[type=range] { width: 100%; accent-color: var(--accent); height: 28px; }

/* düğmeler */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 0 18px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--surface-2); cursor: pointer; text-decoration: none; color: var(--text); font-weight: 600; }
.btn svg { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.btn.block { width: 100%; }
.btn.small { min-height: 34px; padding: 0 12px; font-size: 13px; }
.icon-btn { width: 38px; height: 38px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; display: grid; place-items: center; }
.icon-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn.spin svg { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.banner { display: flex; align-items: center; gap: 12px; justify-content: space-between; background: color-mix(in srgb, var(--warn) 14%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--warn) 45%, var(--line)); border-radius: var(--radius); padding: 12px 14px; margin-bottom: 12px; font-size: 14px; }

/* istatistik */
.month { display: flex; align-items: center; justify-content: space-between; margin: 6px 0 12px; }
.month h1 { font-size: 20px; }
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; }
.tile b { display: block; font-size: 22px; letter-spacing: -0.02em; }
.tile span { font-size: 12px; color: var(--muted); }
.chart { margin-top: 12px; }
.chart svg { width: 100%; height: 90px; display: block; }
.chart rect { fill: var(--accent); }
.chart rect.zero { fill: var(--surface-2); }
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; padding: 12px 2px; border-bottom: 1px solid var(--line); }
.list li:last-child { border-bottom: 0; }
.list .main { font-weight: 600; }
.list .sub { font-size: 13px; color: var(--muted); }
.list .right { text-align: right; }
.day { font-size: 13px; color: var(--muted); margin: 18px 2px 4px; font-weight: 600; }
.badge { font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 6px; background: var(--surface-2); color: var(--muted); margin-right: 6px; }
.badge.dc { background: color-mix(in srgb, var(--warn) 22%, transparent); color: var(--warn); }
.badge.ac { background: color-mix(in srgb, var(--accent) 18%, transparent); color: var(--accent); }
.empty { text-align: center; color: var(--muted); padding: 32px 12px; }

/* form */
label.field { display: block; margin-bottom: 14px; }
label.field span { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.input { width: 100%; min-height: 46px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface-2); padding: 0 14px; }
.input-unit { position: relative; }
.input-unit em { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); font-style: normal; color: var(--muted); font-size: 14px; }

/* giriş */
.login { min-height: 100dvh; display: flex; flex-direction: column; justify-content: center; gap: 28px; padding: 32px 8px; }
.login .logo { width: 64px; height: 64px; border-radius: 20px; background: var(--accent); display: grid; place-items: center; }
.login .logo svg { width: 36px; height: 36px; fill: var(--accent-ink); }
.login h1 { font-size: 34px; margin-top: 16px; }
.login p { color: var(--muted); margin: 8px 0 0; font-size: 16px; }
.login ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 10px; }
.login li { display: flex; gap: 10px; align-items: flex-start; }
.login li::before { content: ""; flex: none; width: 8px; height: 8px; margin-top: 7px; border-radius: 50%; background: var(--accent); }
.login .buttons { display: grid; gap: 10px; }
.error { color: var(--danger); font-size: 14px; }
.note { font-size: 12px; color: var(--muted); }

.toast { position: fixed; left: 50%; bottom: calc(88px + env(safe-area-inset-bottom)); transform: translate(-50%, 20px); opacity: 0;
  background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 12px; font-size: 14px; transition: .25s; pointer-events: none; max-width: calc(100% - 32px); z-index: 20; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.err { background: var(--danger); color: #fff; }

.skeleton { height: 180px; border-radius: var(--radius); background: linear-gradient(90deg, var(--surface) 0, var(--surface-2) 50%, var(--surface) 100%); background-size: 200% 100%; animation: sk 1.2s infinite; }
@keyframes sk { to { background-position: -200% 0; } }

@media (max-width: 360px) {
  .actions { grid-template-columns: repeat(3, 1fr); }
  .soc { font-size: 48px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---- sürücü göstergesi (eski telefon) ---------------------------------------------------- */
body.dash-mode { background: #000; overflow: hidden; }
body.dash-mode #app { max-width: none; padding: 0; min-height: 100dvh; }
body.dash-mode main { padding: 0; }
.dash {
  --d-text: #f4f7fa; --d-muted: #7d8794; --d-accent: #2fd4a7; --d-amber: #f5b041; --d-red: #ff5a5a;
  position: fixed; inset: 0; background: #000; color: var(--d-text); user-select: none; cursor: default;
  display: grid; grid-template-columns: 1.15fr 1fr; gap: 3vw; align-items: center;
  padding: max(3vh, env(safe-area-inset-top)) max(4vw, env(safe-area-inset-right)) max(3vh, env(safe-area-inset-bottom)) max(4vw, env(safe-area-inset-left));
}
.dash.mirror { transform: scaleX(-1); }
.d-main { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.d-limit { position: absolute; top: 0; left: 0; width: min(15vh, 10vw); height: min(15vh, 10vw); border-radius: 50%;
  background: #fff; color: #111; border: min(1.6vh, 1.1vw) solid #e53935; display: grid; place-items: center;
  font-size: min(6vh, 4vw); font-weight: 800; }
.d-speed span.amber { color: var(--d-amber); }
.d-speed span.red { color: var(--d-red); }
.d-warn span.cam { background: var(--d-red); color: #fff; font-size: min(5.4vh, 3.6vw); }
.d-speed { display: flex; flex-direction: column; align-items: center; line-height: .9; }
.d-speed span { font-size: min(34vh, 24vw); font-weight: 700; letter-spacing: -0.04em; }
.d-speed small { font-size: min(5vh, 3.4vw); color: var(--d-muted); margin-top: 1vh; }
.d-gears { display: flex; gap: min(4vh, 3vw); margin-top: 4vh; font-size: min(7vh, 4.6vw); font-weight: 700; color: #333a44; }
.d-gears .on { color: var(--d-text); }
.d-side { display: flex; flex-direction: column; gap: 4vh; }
.d-soc-top { display: flex; align-items: baseline; gap: .4vw; }
.d-soc-top b { font-size: min(16vh, 10vw); font-weight: 700; letter-spacing: -0.03em; line-height: 1; }
.d-soc-top span { font-size: min(6vh, 4vw); color: var(--d-muted); font-weight: 600; }
.d-soc-top em { margin-left: auto; font-style: normal; font-size: min(7vh, 4.4vw); font-weight: 600; }
.d-bar { position: relative; height: min(3vh, 2vw); border-radius: 99px; background: #1b2028; margin-top: 2vh; }
.d-bar i { position: absolute; inset: 0 auto 0 0; border-radius: 99px; background: var(--d-accent); transition: width .6s; }
.d-bar i.mid { background: var(--d-amber); }
.d-bar i.low { background: var(--d-red); }
.d-bar b { position: absolute; top: -.8vh; bottom: -.8vh; width: 3px; margin-left: -1px; background: #fff; opacity: .5; border-radius: 2px; }
.d-ctx { min-height: 14vh; }
.d-dest { font-size: min(4.6vh, 3vw); font-weight: 650; margin-bottom: 1vh; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.d-dest.muted { color: var(--d-muted); font-weight: 500; }
.d-dest i { font-style: normal; margin-left: 1vw; }
.d-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2vw; }
.d-grid b { display: block; font-size: min(7.5vh, 4.8vw); font-weight: 650; white-space: nowrap; }
.d-grid span { font-size: min(3.6vh, 2.4vw); color: var(--d-muted); }
.dash .red { color: var(--d-red); }
.dash .amber { color: var(--d-amber); }
/* Gece: her görünümde aynı şekilde kısılır */
.dash.night { filter: brightness(.72); }
.d-warn { display: flex; flex-wrap: wrap; gap: 1.2vh; min-height: 6vh; }
.d-warn span { font-size: min(4.2vh, 2.8vw); font-weight: 650; padding: .6vh 1.4vw; border-radius: 1.2vh; }
.d-warn .red { background: color-mix(in srgb, var(--d-red) 22%, #000); color: var(--d-red); }
.d-warn .amber { background: color-mix(in srgb, var(--d-amber) 22%, #000); color: var(--d-amber); }
.d-tools { position: absolute; top: max(2vh, env(safe-area-inset-top)); right: max(2vw, env(safe-area-inset-right)); display: flex; gap: 8px;
  opacity: 0; pointer-events: none; transition: opacity .3s; }
.dash.mirror .d-tools { transform: scaleX(-1); }
.dash.tools-on .d-tools { opacity: 1; pointer-events: auto; }
.d-tools button { background: #1b2028; color: var(--d-text); border: 1px solid #2c333d; border-radius: 10px; min-height: 40px; padding: 0 14px; font-size: 14px; cursor: pointer; }
.d-status { position: absolute; left: 50%; bottom: max(1.5vh, env(safe-area-inset-bottom)); transform: translateX(-50%); font-size: 12px; color: var(--d-muted); white-space: nowrap; }
