:root {
  --bg:      #0d1117;
  --bg2:     #161b22;
  --bg3:     #21262d;
  --accent:  #39d353;
  --accent2: #58a6ff;
  --warn:    #f0883e;
  --danger:  #f85149;
  --text:    #e6edf3;
  --muted:   #8b949e;
  --border:  rgba(255,255,255,0.08);
  --radius:  14px;
  --mono:    'Space Mono', monospace;
  --sans:    'DM Sans', sans-serif;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  min-height: 100vh;
  -webkit-tap-highlight-color: transparent;
}

/* ── SHELL ─────────────────────────────────────────────────────────────── */
.shell {
  max-width: 430px;
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── TOPBAR ────────────────────────────────────────────────────────────── */
.topbar {
  position: sticky; top: 0; z-index: 100;
  background: rgba(13,17,23,0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 16px 20px 12px;
  display: flex; align-items: center; gap: 12px;
}
.topbar-icon  { font-size: 22px; }
.topbar-title { font-family: var(--mono); font-size: 14px; font-weight: 700;
                color: var(--accent); letter-spacing: .08em; text-transform: uppercase; flex: 1; }
.topbar-right { display: flex; align-items: center; gap: 10px; }
.topbar-time  { font-family: var(--mono); font-size: 11px; color: #8b949e; }
.topbar-reset-btn {
  background: none; border: none; cursor: pointer;
  font-size: 22px; padding: 2px 4px; line-height: 1;
  color: #39d353; opacity: .75; transition: opacity .2s, color .2s, transform .3s;
}
.topbar-reset-btn:hover { opacity: 1; color: #f85149; transform: rotate(-180deg); }

/* ── MODAL ──────────────────────────────────────────────────────────────── */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 999;
  background: rgba(0,0,0,.65); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.modal-box {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 24px; width: 100%; max-width: 340px;
}
.modal-title {
  font-family: var(--mono); font-size: 15px; font-weight: 700;
  color: var(--text); margin-bottom: 10px;
}
.modal-body {
  font-size: 13px; color: var(--muted); margin-bottom: 20px; line-height: 1.5;
}
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; }
.btn-outline {
  background: none; border: 1px solid var(--border); color: var(--muted);
  border-radius: 8px; padding: 8px 16px; font-size: 13px; cursor: pointer;
  transition: border-color .2s, color .2s;
}
.btn-outline:hover { border-color: var(--muted); color: var(--text); }
.btn-danger {
  background: var(--danger); border: none; color: #fff;
  border-radius: 8px; padding: 8px 16px; font-size: 13px; cursor: pointer;
  font-weight: 600; transition: opacity .2s;
}
.btn-danger:hover { opacity: .85; }

/* ── CONTENT ───────────────────────────────────────────────────────────── */
.content { flex: 1; padding: 20px 16px 120px; }

/* ── SECTION LABEL ─────────────────────────────────────────────────────── */
.section-label {
  font-family: var(--mono); font-size: 10px; font-weight: 700;
  color: var(--muted); letter-spacing: .12em; text-transform: uppercase;
  margin: 24px 0 10px;
}
.section-label:first-child { margin-top: 0; }

/* ── BATTERY CARD ──────────────────────────────────────────────────────── */
.battery-card {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px; margin-bottom: 16px;
}
.battery-ring-wrap { display: flex; align-items: center; gap: 20px; margin-bottom: 20px; }
.battery-ring      { position: relative; width: 130px; height: 130px; flex-shrink: 0; }
.ring-center {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.ring-pct  { font-family: var(--mono); font-size: 24px; font-weight: 700; line-height: 1; }
.ring-unit { font-size: 10px; color: var(--muted); margin-top: 2px; }
.battery-stats   { flex: 1; display: flex; flex-direction: column; gap: 10px; }
.stat-row        { display: flex; flex-direction: column; gap: 2px; }
.stat-label      { font-size: 11px; color: var(--muted); }
.stat-val        { font-family: var(--mono); font-size: 16px; font-weight: 700; }
.stat-val.accent { color: var(--accent); }
.stat-val.col    { display: flex; flex-direction: column; gap: 2px; }
.stat-charge-range { font-size: 12px; color: var(--muted); font-weight: 400; min-height: 1.4em; }

/* ── CHARGE INFO ───────────────────────────────────────────────────────── */
.charge-info {
  background: var(--bg3); border-radius: 10px; padding: 14px 16px;
  display: flex; align-items: center; gap: 12px;
}
.charge-icon     { font-size: 20px; }
.charge-text     { flex: 1; }
.charge-split {
  background: var(--bg3); border-radius: 10px; padding: 14px 16px;
  display: flex; align-items: flex-start; gap: 0;
}
.charge-col      { flex: 1; }
.charge-divider  { width: 1px; background: var(--border); margin: 0 14px; align-self: stretch; }
.charge-duration { font-family: var(--mono); font-size: 18px; font-weight: 700; color: var(--accent2); }
.charge-sub      { font-size: 11px; color: var(--muted); margin-top: 2px; }
.charge-until    { font-family: var(--mono); font-size: 12px; color: var(--accent); margin-top: 4px; }

/* ── FORM CARD ─────────────────────────────────────────────────────────── */
.form-card {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px; margin-bottom: 16px;
}
.input-row         { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.input-row:last-child { margin-bottom: 0; }
.input-label       { font-size: 12px; color: var(--muted); font-weight: 500; letter-spacing: .03em; }
.input-wrap        { position: relative; }
.input-suffix {
  position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
  font-size: 12px; color: var(--muted); pointer-events: none;
}
.input-wrap-split  { display: flex; align-items: center; gap: 8px; }
.input-wrap-split input { flex: 1; padding: 10px 14px; }
.input-suffix-small { font-size: 12px; color: var(--muted); white-space: nowrap; }

input[type="number"],
input[type="text"],
input[type="date"],
input[type="time"] {
  width: 100%;
  background: var(--bg3); border: 1px solid var(--border);
  border-radius: 8px; color: var(--text);
  font-family: var(--mono); font-size: 16px;
  padding: 10px 40px 10px 14px;
  outline: none; transition: border-color .2s;
  -webkit-appearance: none; appearance: none;
  color-scheme: dark;
}
input:focus      { border-color: var(--accent2); }
input.error      { border-color: var(--danger) !important; animation: shake .3s; }

/* slider */
.slider-wrap { display: flex; flex-direction: column; gap: 8px; }
input[type="range"] {
  width: 100%; height: 36px; background: transparent;
  cursor: pointer; -webkit-appearance: none; appearance: none;
}
input[type="range"]::-webkit-slider-runnable-track {
  height: 4px; border-radius: 2px;
  background: linear-gradient(to right, var(--accent) var(--pct, 50%), var(--bg3) var(--pct, 50%));
}
input[type="range"]::-moz-range-track {
  height: 4px; border-radius: 2px; background: var(--bg3);
}
input[type="range"]::-moz-range-progress {
  height: 4px; border-radius: 2px; background: var(--accent);
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 20px; height: 20px;
  background: var(--accent); border-radius: 50%; margin-top: -8px; cursor: grab;
}
.slider-labels { display: flex; justify-content: space-between;
  font-family: var(--mono); font-size: 10px; color: var(--muted); }
.slider-val    { font-family: var(--mono); font-size: 22px; font-weight: 700;
  color: var(--text); text-align: center; }

/* error */
.error-msg { background: rgba(248,81,73,.12); border: 1px solid rgba(248,81,73,.3);
  border-radius: 8px; padding: 8px 12px; font-size: 13px; color: var(--danger); }
.error-msg.visible { display: block; }

/* ── BUTTONS ───────────────────────────────────────────────────────────── */
.btn {
  width: 100%; padding: 13px;
  background: var(--accent); color: #0d1117;
  border: none; border-radius: 10px;
  font-family: var(--sans); font-size: 15px; font-weight: 600;
  cursor: pointer; transition: opacity .15s, transform .1s;
  letter-spacing: .02em;
}
.btn:active    { opacity: .85; transform: scale(.98); }
.btn.secondary { background: var(--bg3); color: var(--text); border: 1px solid var(--border); }
.btn-row       { display: flex; gap: 10px; }
.btn-row .btn  { flex: 1; }

/* ── QUICK TAGS ─────────────────────────────────────────────────────────── */
.quick-tags    { display: flex; flex-wrap: wrap; gap: 8px; }
.quick-tag {
  padding: 5px 12px;
  background: var(--bg3); color: var(--text);
  border: 1px solid var(--border); border-radius: 20px;
  font-family: var(--sans); font-size: 13px;
  cursor: pointer; transition: background .15s, border-color .15s;
}
.quick-tag:active { opacity: .75; }
.quick-tag.active { background: var(--accent); color: #0d1117; border-color: var(--accent); }
.tag-edit-btn { opacity: .5; }
.tag-editor { display: flex; flex-direction: column; gap: 6px; }
.tag-editor-row { display: flex; gap: 6px; align-items: center; }
.tag-editor-row input { flex: 1; }
.tag-remove { background: none; border: none; color: var(--muted); cursor: pointer; font-size: 14px; padding: 4px 8px; }
.tag-remove:hover { color: var(--danger); }
@media (hover: hover) {
  .quick-tag:hover { background: var(--accent); color: #0d1117; border-color: var(--accent); }
}

/* ── KM PAGE ───────────────────────────────────────────────────────────── */
.km-card       { background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px; margin-bottom: 14px; }
.km-total      { font-family: var(--mono); font-size: 42px; font-weight: 700;
  color: var(--accent); line-height: 1; }
.km-sub        { font-size: 13px; color: var(--muted); margin-top: 4px; }
.km-grid       { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 16px; }
.km-mini       { background: var(--bg3); border-radius: 10px; padding: 12px; display: flex; flex-direction: column; gap: 4px; }
.km-mini-label { font-size: 11px; color: var(--muted); }
.km-mini-val   { font-family: var(--mono); font-size: 18px; font-weight: 700; }

.trip-item {
  background: var(--bg3); border-radius: 10px;
  padding: 12px 14px; margin-bottom: 8px;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
.trip-left  { display: flex; flex-direction: column; gap: 3px; flex: 1; }
.trip-date  { font-size: 11px; color: var(--muted); }
.trip-name  { font-size: 14px; font-weight: 500; }
.trip-right { text-align: right; }
.trip-km    { font-family: var(--mono); font-size: 16px; font-weight: 700; color: var(--accent2); }
.trip-used  { font-size: 11px; color: var(--muted); }
.trip-del   { background: none; border: none; color: var(--muted); cursor: pointer; font-size: 14px; padding: 4px 6px; }
.trip-del:hover { color: var(--danger); }
.trip-edit  { background: none; border: none; color: var(--muted); cursor: pointer; font-size: 14px; padding: 4px 6px; }
.trip-edit:hover { color: var(--accent); }
.trip-editing { flex-direction: column; align-items: stretch; gap: 0; }
.trip-edit-form { width: 100%; }
.no-trips   { text-align: center; padding: 30px; color: var(--muted); font-size: 14px; }
.confirm-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.6);
  display: flex; align-items: center; justify-content: center; z-index: 100;
}
.confirm-box {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: 14px; padding: 24px 20px; width: min(320px, 90vw);
  display: flex; flex-direction: column; gap: 16px;
}
.confirm-text { font-size: 16px; font-weight: 500; text-align: center; }
.btn.btn-danger { background: var(--danger); color: #fff; }

/* ── WARTUNG PAGE ──────────────────────────────────────────────────────── */
.wartung-card { background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px; margin-bottom: 14px; }
.wartung-row  { display: flex; align-items: center; justify-content: space-between;
  padding: 10px 0; border-bottom: 1px solid var(--border); }
.wartung-row:last-child { border-bottom: none; padding-bottom: 0; }
.wartung-label { font-size: 14px; }
.wartung-val   { font-family: var(--mono); font-size: 13px; color: var(--accent2); }
.status-badge  { font-size: 11px; font-weight: 600; padding: 3px 8px;
  border-radius: 6px; font-family: var(--mono); }
.badge-ok      { background: rgba(57,211,83,.15);  color: var(--accent); }
.badge-soon    { background: rgba(240,136,62,.15);  color: var(--warn); }
.badge-due     { background: rgba(248,81,73,.15);   color: var(--danger); }

/* ── BOTTOM NAV ────────────────────────────────────────────────────────── */
.bottom-nav {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 430px;
  background: rgba(13,17,23,.95); backdrop-filter: blur(16px);
  border-top: 1px solid var(--border);
  display: flex; padding: 8px 0 20px;
}
.nav-item {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; gap: 4px; padding: 8px 4px;
  cursor: pointer; border: none; background: none;
  color: var(--muted); transition: color .2s;
  text-decoration: none;
}
.nav-item.active, .nav-item:focus { color: var(--accent); outline: none; }
.nav-icon  { font-size: 22px; line-height: 1; filter: grayscale(1) opacity(.45); transition: filter .2s; }
.nav-item.active .nav-icon, .nav-item:focus .nav-icon { filter: none; }
.nav-label { font-size: 10px; font-weight: 500; letter-spacing: .05em;
  text-transform: uppercase; font-family: var(--mono); }

/* ── TOAST ─────────────────────────────────────────────────────────────── */
.toast {
  position: fixed; top: 80px; left: 50%; transform: translateX(-50%) translateY(-20px);
  background: var(--accent); color: #0d1117;
  font-family: var(--mono); font-size: 13px; font-weight: 700;
  padding: 10px 20px; border-radius: 30px;
  opacity: 0; transition: all .3s; pointer-events: none; z-index: 200;
  white-space: nowrap;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ── ANIMATIONS ────────────────────────────────────────────────────────── */
@keyframes shake {
  0%,100% { transform: translateX(0); }
  25%     { transform: translateX(-6px); }
  75%     { transform: translateX(6px); }
}

/* ── BLAZOR ERROR ──────────────────────────────────────────────────────── */
#blazor-error-ui {
  background: var(--danger); color: white;
  display: none; position: fixed; bottom: 0; left: 0; right: 0;
  padding: 12px 20px; font-size: 14px; z-index: 1000;
}
#blazor-error-ui .reload { color: white; font-weight: 700; }

/* ── ONBOARDING ─────────────────────────────────────────────────────────── */
.onboarding-backdrop {
  position: fixed; inset: 0; z-index: 500;
  background: rgba(13,17,23,.80);
  backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  animation: ob-fade-in .25s ease;
}
@keyframes ob-fade-in { from { opacity:0 } to { opacity:1 } }

.onboarding-box {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 24px;
  width: 100%; max-width: 380px;
  padding: 32px 28px 28px;
  display: flex; flex-direction: column; gap: 24px;
  animation: ob-pop-in .3s cubic-bezier(.34,1.4,.64,1);
}
@keyframes ob-pop-in { from { transform: scale(.88); opacity:0 } to { transform: scale(1); opacity:1 } }

.onboarding-dots {
  display: flex; gap: 6px; justify-content: center;
}
.onboarding-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--bg3); border: 1px solid var(--border);
  cursor: pointer; transition: all .2s;
}
.onboarding-dot.active { background: var(--accent); width: 22px; border-radius: 4px; border-color: var(--accent); }

.onboarding-slide { text-align: center; padding: 4px 0; }
.onboarding-emoji { font-size: 52px; line-height: 1; margin-bottom: 16px; }
.onboarding-title {
  font-family: var(--mono); font-size: 17px; font-weight: 700;
  color: var(--text); margin-bottom: 12px; line-height: 1.3;
}
.onboarding-body {
  font-size: 15px; color: var(--muted); line-height: 1.6;
}

.onboarding-actions {
  display: flex; gap: 10px; align-items: center;
}
.onboarding-skip {
  flex: 1; padding: 12px; background: transparent;
  border: 1px solid var(--border); border-radius: var(--radius);
  color: var(--muted); font-size: 14px; cursor: pointer;
  font-family: var(--sans); transition: border-color .2s;
}
.onboarding-skip:hover { border-color: var(--muted); }
.onboarding-next {
  flex: 2; padding: 12px; background: var(--accent);
  border: none; border-radius: var(--radius);
  color: #0d1117; font-size: 15px; font-weight: 700;
  cursor: pointer; font-family: var(--sans); transition: opacity .2s;
}
.onboarding-next.full { flex: 1; }
.onboarding-next:hover { opacity: .88; }
