/* booking (Electrofleet) driver app — screen layout and app-only components on top of /static/shared/tokens.css.
   Geometry and colors reproduce the approved artboards (docs/research/design-spec.md §2, §3.6–3.9)
   at 390×844; the shell is fluid up to 430px so the PWA works on any phone. */

html, body { height: 100%; }
body { background: var(--app-bg); overscroll-behavior-y: none; }

.app-shell { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; max-width: 430px; margin: 0 auto; }
#view { flex: 1 1 auto; display: flex; flex-direction: column; }

.screen {
  flex: 1 1 auto; display: flex; flex-direction: column; gap: 16px;
  padding: 56px 20px 12px;
  padding-top: max(56px, env(safe-area-inset-top, 0px));
  padding-bottom: calc(var(--tabbar-h) + 16px + env(safe-area-inset-bottom, 0px));
}
.screen--gap14 { gap: 14px; }
.screen--auth { justify-content: center; padding-bottom: 56px; }
.spacer { flex: 1 1 auto; }

.app-title { font-family: var(--font-display); font-size: var(--fs-app-title); font-weight: 700; color: var(--app-text); }
.screen-date { font-size: var(--fs-small-2); color: var(--app-muted); margin-top: 3px; }

/* ------------------------------------------------------------------ hero (Heute) */
.hero {
  display: block; width: 100%; text-align: left;
  background: var(--app-card); border: 1px solid var(--app-card-border);
  border-radius: 16px; padding: 18px; color: inherit;
}
.hero__location { font-size: 14.5px; font-weight: 600; color: var(--app-text); margin-top: 8px; }
.hero__row { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 10px; }
.hero__time { font-family: var(--font-display); font-weight: 700; font-size: var(--fs-app-hero); color: var(--lime); }
.hero__line { font-size: var(--fs-small); color: var(--app-text-2); margin-top: 6px; }
.hero__eta {
  border-top: 1px solid var(--app-card-border); margin-top: 14px; padding-top: 12px;
  display: flex; align-items: center; gap: 7px; font-size: var(--fs-body); font-weight: 600;
}
.eta-dot { width: 8px; height: 8px; border-radius: 4px; flex: 0 0 auto; background: currentColor; }
.eta--on_time { color: var(--app-success); }
.eta--late { color: var(--warn-border); }
.eta--late .eta-dot { background: var(--warn-dot); }
.eta--unknown { color: var(--app-muted); }
.eta--rescheduled { color: var(--app-chip-text); }
.hero__delay {
  margin-top: 10px; font-size: var(--fs-small-2); font-weight: 600; color: var(--app-muted);
  background: none; padding: 0; text-align: left;
}
.hero__delay:hover { color: var(--app-text-2); }

/* ------------------------------------------------------------------ row cards */
.rowcard { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.rowcard--tappable { width: 100%; text-align: left; color: inherit; }
.rowcard__left { display: flex; align-items: center; gap: 11px; min-width: 0; }
.rowcard__title { font-size: var(--fs-body); font-weight: 600; color: var(--app-text); }
.rowcard__title .tooltip-anchor { margin-left: 7px; vertical-align: -3px; }
.rowcard__sub { font-size: var(--fs-micro); color: var(--app-muted); margin-top: 2px; }
.rowcard__icon { flex: 0 0 auto; color: var(--app-muted); }

.section-title { margin-bottom: 8px; color: var(--app-muted); }
.section { display: flex; flex-direction: column; gap: 8px; }

.empty-card { text-align: center; padding: 26px 18px; }
.empty-card__title { font-size: var(--fs-body); font-weight: 600; color: var(--app-text); }
.empty-card__sub { font-size: var(--fs-small-2); color: var(--app-muted); margin-top: 4px; }

/* ------------------------------------------------------------------ tab bar */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 8;
  margin: 0 auto; max-width: 430px; min-height: var(--tabbar-h);
  background: var(--app-bg); border-top: 1px solid var(--app-tabbar-border);
  display: flex; align-items: stretch;
  padding: 6px 8px calc(18px + env(safe-area-inset-bottom, 0px)) 8px;
}
.tabbar__item {
  flex: 1 1 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 4px; color: var(--app-muted); font-size: var(--fs-micro-2); font-weight: 500; position: relative;
}
.tabbar__item:hover { color: var(--app-text-2); }
.tabbar__item.is-active { color: var(--lime); font-weight: 600; }
.tabbar__item.is-active:hover { color: var(--lime); }
.tabbar__badge {
  position: absolute; top: 5px; left: calc(50% + 6px);
  min-width: 15px; height: 15px; padding: 0 4px; border-radius: 8px;
  background: var(--lime); color: var(--app-bg);
  font-size: 9px; font-weight: 700; display: flex; align-items: center; justify-content: center;
}

/* ------------------------------------------------------------------ route */
.route-io { display: flex; flex-direction: column; }
.route-io__row { display: flex; align-items: center; gap: 10px; }
.route-io__dot { width: 9px; height: 9px; border-radius: 5px; background: var(--app-chip-text); flex: 0 0 auto; }
.route-io__square { width: 9px; height: 9px; background: var(--lime); flex: 0 0 auto; }
.route-io__divider { width: 1px; height: 14px; background: var(--app-card-border); margin-left: 4px; }
.route-io__input {
  border: none; outline: none; background: transparent; color: var(--app-text);
  font-size: var(--fs-input-time); font-weight: 500; width: 100%; padding: 4px 0;
}
.route-io__input::placeholder { color: var(--app-muted); }
.route-io__input:focus-visible { outline: none; }

.chip-row { display: flex; gap: 7px; flex-wrap: wrap; }
.chip--soc { cursor: pointer; }

.route-card {
  display: block; width: 100%; text-align: left; color: inherit;
  background: var(--app-card); border: 1px solid var(--app-card-border);
  border-radius: 14px; padding: 14px;
}
.route-card.is-selected { border: 1.5px solid var(--lime); padding: 13.5px; }
.route-card__head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.route-card__title { font-size: 14px; font-weight: 600; color: var(--app-text); }
.route-card.is-selected .route-card__title { font-weight: 700; }
.route-card__line { font-size: var(--fs-small-2); color: var(--app-text-2); margin-top: 5px; }

.stopbox {
  display: flex; align-items: flex-start; gap: 9px;
  background: var(--app-card-inner); border-radius: 10px; padding: 11px 12px; margin-top: 11px;
}
.stopbox__pin { flex: 0 0 auto; margin-top: 1px; color: var(--lime); }
.stopbox__title { font-size: var(--fs-small); font-weight: 600; color: var(--app-text); }
.stopbox__sub { font-size: var(--fs-micro); color: var(--app-muted); margin-top: 2px; }

/* ------------------------------------------------------------------ arrival */
.arrival-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.back-btn {
  width: 34px; height: 34px; flex: 0 0 auto;
  border: 1px solid var(--app-card-border); border-radius: 9px;
  display: flex; align-items: center; justify-content: center; color: var(--app-text-2);
}
.back-btn:hover { color: var(--app-text); }
.arrival-title { font-family: var(--font-display); font-weight: 700; font-size: var(--fs-app-arrival); color: var(--app-text); }
.arrival-sub { font-size: var(--fs-small); color: var(--app-muted); margin-top: 4px; }
.sketch { display: block; width: 100%; max-width: 350px; margin: 0 auto; height: auto; }
.lock-note { display: flex; align-items: flex-start; gap: 8px; }
.lock-note__icon { flex: 0 0 auto; margin-top: 1px; color: var(--app-muted); }
.lock-note__text { font-size: var(--fs-small-3); color: var(--app-muted); flex: 1 1 auto; }

/* ------------------------------------------------------------------ book a slot */
.btn-outline {
  display: flex; align-items: center; justify-content: center; gap: 9px; width: 100%; box-sizing: border-box;
  height: 48px; border: 1px solid var(--app-outline); border-radius: 13px;
  font-size: 14px; font-weight: 600; color: var(--app-text); text-decoration: none;
}
.btn-outline:hover { border-color: var(--app-text-2); color: var(--app-text); }
.btn-ghost { display: block; text-align: center; text-decoration: none; box-sizing: border-box; }
.book-body { display: flex; flex-direction: column; gap: 16px; }
.book-body .chip-row { align-items: stretch; }
/* one tappable choice in a row of choices (day, arrival, how much to charge) */
.pick {
  display: inline-flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
  min-height: 42px; padding: 6px 13px; box-sizing: border-box;
  border: 1px solid var(--app-outline); border-radius: 11px; background: transparent;
  font-size: var(--fs-small); font-weight: 600; color: var(--app-text-2); font-family: inherit;
}
.pick.is-active { border-color: var(--lime); background: var(--lime); color: var(--app-bg); }
.pick__sub { font-size: var(--fs-micro-2); font-weight: 500; opacity: 0.8; }
.pick--input { color-scheme: dark; flex-direction: row; }
.pick--input.is-active { color-scheme: light; }
.pick--wide { width: 100%; align-items: stretch; }
.stepper { display: inline-flex; align-items: center; border: 1px solid var(--app-outline); border-radius: 11px; }
.stepper__btn { width: 40px; height: 38px; font-size: 18px; font-weight: 600; color: var(--app-text); }
.stepper__value { min-width: 50px; text-align: center; font-size: 15px; font-weight: 700; color: var(--app-text); }
.place-chip {
  display: inline-flex; align-items: center; gap: 4px; flex: 0 0 auto;
  border: 1px dashed var(--app-chip-text); border-radius: 6px; padding: 2px 7px;
  font-size: var(--fs-micro); font-weight: 600; color: var(--app-chip-text); white-space: nowrap;
}
.place-chip--fixed { border-style: solid; }
.place-chip svg { width: 11px; height: 11px; }
.route-card__line--split { display: flex; align-items: center; justify-content: space-between; gap: 8px; }

.btn-ghost {
  width: 100%; padding: 12px; border-radius: 12px; background: transparent;
  font-size: var(--fs-body); font-weight: 600; color: var(--app-text-2);
}
.btn-ghost:hover:not(:disabled) { color: var(--app-text); }
.btn-ghost--danger { color: #F0A8A0; }

.app-error {
  background: rgba(179, 54, 42, 0.14); border: 1px solid rgba(179, 54, 42, 0.6);
  border-radius: 12px; padding: 12px 16px;
  font-size: var(--fs-small); font-weight: 600; color: #F0A8A0;
}
.app-note {
  background: var(--app-card-inner); border: 1px solid var(--app-outline);
  border-radius: 12px; padding: 12px 16px;
  font-size: var(--fs-small); color: var(--app-text-2);
}

.busy { display: inline-flex; align-items: center; gap: 9px; justify-content: center; }
.spinner {
  width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid currentColor; border-top-color: transparent;
  animation: ef-spin 700ms linear infinite; flex: 0 0 auto;
}
@keyframes ef-spin { to { transform: rotate(360deg); } }

/* charging view */
.charging { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 8px 0 4px; }
.soc-ring { position: relative; width: 150px; height: 150px; }
.soc-ring svg { width: 150px; height: 150px; }
.soc-ring__value {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
  font-family: var(--font-display); font-size: 26px; font-weight: 700; color: var(--app-text);
}
.soc-ring__unit { font-family: var(--font-body); font-size: var(--fs-micro-2); font-weight: 600; color: var(--app-muted); }
.charging__power { font-family: var(--font-display); font-size: 21px; font-weight: 700; color: var(--lime); }
.charging__line { font-size: var(--fs-small); color: var(--app-text-2); }

/* ------------------------------------------------------------------ wallet */
.wallet-card { display: flex; flex-direction: column; justify-content: space-between; }
.wallet-card__head { display: flex; align-items: center; justify-content: space-between; }
.wallet-brand { font-family: var(--font-display); font-size: var(--fs-wallet-brand); font-weight: 700; color: var(--app-text); }
.wallet-dot { width: 10px; height: 10px; border-radius: 5px; background: var(--lime); }
.wallet-eyebrow {
  font-size: var(--fs-eyebrow); font-weight: 600; text-transform: uppercase;
  letter-spacing: var(--ls-eyebrow); color: var(--app-muted);
}
.wallet-id { font-size: var(--fs-card-id); font-weight: 600; letter-spacing: var(--ls-card-id); color: var(--app-text); margin-top: 4px; }
.wallet-chips { display: flex; gap: 7px; flex-wrap: wrap; align-items: center; }

/* ------------------------------------------------------------------ profile / auth */
.profile-head__name { font-family: var(--font-display); font-size: var(--fs-app-title); font-weight: 700; color: var(--app-text); }
.profile-head__company { font-size: var(--fs-small-2); color: var(--app-muted); margin-top: 3px; }

/* language switch (DE | EN): profile row and top-right corner of the auth screens */
.lang-switch {
  display: inline-flex; gap: 2px; padding: 2px; flex: 0 0 auto;
  border: 1px solid var(--app-outline); border-radius: 9px; background: var(--app-card-inner);
}
.lang-switch__item {
  border-radius: 7px; padding: 4px 10px; background: transparent;
  font-size: var(--fs-micro); font-weight: 600; color: var(--app-muted);
}
.lang-switch__item:hover { color: var(--app-text-2); }
.lang-switch__item.is-active { background: var(--lime); color: var(--app-bg); }
.screen--auth { position: relative; }
.lang-switch--auth { position: absolute; top: max(16px, env(safe-area-inset-top, 0px)); right: 20px; }

.auth-brand { text-align: center; }
.auth-brand__logo { height: 30px; width: auto; display: block; margin: 0 auto 12px; }
.auth-brand__title { font-family: var(--font-display); font-size: 24px; font-weight: 700; color: var(--app-text); }
.auth-brand__sub { font-size: var(--fs-small-2); color: var(--app-muted); margin-top: 4px; }
.auth-card { display: flex; flex-direction: column; gap: 14px; }
.form-error { font-size: var(--fs-small-2); font-weight: 600; color: #F0A8A0; }
.field--app .field__label { color: var(--app-text-2); }
.remember-row { display: flex; align-items: center; justify-content: space-between; }
.remember-row__label { font-size: var(--fs-body); font-weight: 600; color: var(--app-text); }
.auth-link { display: block; text-align: center; font-size: var(--fs-small-2); font-weight: 600; }

/* ------------------------------------------------------------------ sheets, toasts, banners */
.sheet-backdrop {
  position: fixed; inset: 0; z-index: 20; background: rgba(0, 0, 0, 0.55);
  display: flex; align-items: flex-end; justify-content: center;
}
.sheet {
  width: 100%; max-width: 430px;
  background: var(--app-card); border: 1px solid var(--app-card-border); border-bottom: none;
  border-radius: 18px 18px 0 0;
  padding: 12px 20px calc(20px + env(safe-area-inset-bottom, 0px));
  display: flex; flex-direction: column; gap: 14px;
  animation: ef-sheet-up 160ms ease-out;
}
@keyframes ef-sheet-up { from { transform: translateY(24px); opacity: 0.6; } to { transform: none; opacity: 1; } }
.sheet__grabber { width: 36px; height: 4px; border-radius: 2px; background: var(--app-outline); margin: 0 auto; }
.sheet__title { font-family: var(--font-display); font-size: 17px; font-weight: 700; color: var(--app-text); }
.option-btn {
  width: 100%; text-align: left;
  background: var(--app-card-inner); border: 1px solid var(--app-outline); border-radius: 12px;
  padding: 14px; font-size: var(--fs-body); font-weight: 600; color: var(--app-text);
}
.option-btn:hover { border-color: var(--app-chip-text); }
.option-btn__sub { font-size: var(--fs-micro); font-weight: 400; color: var(--app-muted); margin-top: 2px; }

.toasts {
  position: fixed; top: calc(12px + env(safe-area-inset-top, 0px)); left: 50%; transform: translateX(-50%);
  z-index: 30; display: flex; flex-direction: column; gap: 8px;
  width: calc(100% - 40px); max-width: 390px; pointer-events: none;
}
.toast {
  pointer-events: auto; text-align: left; width: 100%;
  background: var(--app-card); border: 1px solid var(--app-outline); border-left: 3px solid var(--lime);
  border-radius: 12px; padding: 12px 14px; color: var(--app-text);
  font-size: var(--fs-small); font-weight: 600; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  animation: ef-sheet-up 160ms ease-out;
}
.toast--error { border-left-color: #B3362A; }
.toast__sub { font-size: var(--fs-micro); font-weight: 400; color: var(--app-muted); margin-top: 2px; }

.offline-banner {
  position: fixed; top: 0; left: 0; right: 0; z-index: 25;
  background: #241C0B; color: var(--warn-border); border-bottom: 1px solid #3A2F14;
  text-align: center; font-size: var(--fs-small-3); font-weight: 600;
  padding: calc(6px + env(safe-area-inset-top, 0px)) 12px 6px;
}

/* ------------------------------------------------------------------ dev panel (?dev=1) */
.dev-fab {
  position: fixed; right: 12px; bottom: calc(var(--tabbar-h) + 12px + env(safe-area-inset-bottom, 0px)); z-index: 15;
  background: var(--app-card); border: 1px dashed var(--app-outline); border-radius: 8px;
  color: var(--app-muted); font-size: var(--fs-micro-2); font-weight: 700; padding: 6px 10px;
}
.dev-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.dev-pre {
  background: var(--app-bg); border: 1px solid var(--app-outline); border-radius: 8px; padding: 8px;
  font-size: 10px; line-height: 1.5; color: var(--app-text-2);
  max-height: 160px; overflow: auto; white-space: pre-wrap; word-break: break-all; margin: 0;
}

/* small helpers */
.mt2 { margin-top: 2px; }
.hidden { display: none !important; }
