/* TessPilot design system: "Die Nachtkarte"
   Strides-AI grammar (flat, framed sheets with a head strip, Outfit + Inter) on a petrol night ground.
   All classes are prefixed tp- so they never collide with the Tailwind utilities of the older sub pages. */

@font-face { font-family: "Outfit"; src: url("/static/fonts/outfit-latin.woff2") format("woff2"); font-weight: 500 700; font-style: normal; font-display: swap; }
@font-face { font-family: "Inter";  src: url("/static/fonts/inter-latin.woff2")  format("woff2"); font-weight: 400 700; font-style: normal; font-display: swap; }

:root {
  /* Ground and sheets */
  --tp-bg: #0B1416;
  --tp-sheet: #101C1F;
  --tp-sheet-2: #15272B;
  --tp-line: #223539;
  --tp-frame: #2F5961;
  /* Text */
  --tp-ink: #E8F2F3;
  --tp-ink-2: #B7CDD0;
  --tp-muted: #8BA7AB;
  /* One petrol ramp for data and the primary action */
  --tp-p100: #CBEBEA;
  --tp-p300: #52B3B6;
  --tp-p500: #2A8A90;
  --tp-p700: #17484E;
  --tp-p900: #0F2F33;
  /* Signals that carry meaning */
  --tp-amber: #F2A93B;     /* charging, waking, attention */
  --tp-amber-ink: #2B1A00;
  --tp-red: #F58B85;       /* error, open doors, low battery */
  --tp-red-bg: #3A1816;
  --tp-amber-wash: #231A08;   /* notice ground (attention) */
  --tp-amber-text: #FFE2B0;   /* notice text on amber wash */
  --tp-red-text: #FFD6D3;     /* error text on red ground */

  --tp-display: "Outfit", "Avenir Next", system-ui, sans-serif;
  --tp-text: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;

  --tp-gutter: 16px;
  --tp-gap: 16px;
  --tp-ease: cubic-bezier(.16, 1, .3, 1);
}
@media (min-width: 720px) { :root { --tp-gutter: 24px; --tp-gap: 20px; } }
@media (min-width: 960px) { :root { --tp-gutter: 32px; --tp-gap: 24px; } }

/* ---------- Base ---------- */
.tp-body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--tp-bg);
  color: var(--tp-ink);
  font-family: var(--tp-text);
  font-size: 1rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  color-scheme: dark;
  scrollbar-color: var(--tp-frame) var(--tp-bg);
}
.tp-body *, .tp-body *::before, .tp-body *::after { box-sizing: border-box; }
.tp-body ::selection { background: var(--tp-p500); color: #fff; }
.tp-body input, .tp-body select, .tp-body textarea { caret-color: var(--tp-p300); }
.tp-body :focus-visible { outline: 3px solid #8FD6D4; outline-offset: 3px; }
/* :where() keeps link colour at zero specificity so .tp-btn / .tp-tab etc. always win */
.tp-body :where(a) { color: var(--tp-p300); text-underline-offset: 3px; }
.tp-body :where(a:not(.tp-btn)):hover { color: var(--tp-p100); }
.tp-num { font-variant-numeric: tabular-nums; }
.tp-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.tp-hidden, [hidden] { display: none !important; }
@media (max-width: 559px) { .tp-hide-xs { display: none !important; } }

.tp-wrap { width: 100%; max-width: 1240px; margin: 0 auto; padding-inline: max(var(--tp-gutter), env(safe-area-inset-left), env(safe-area-inset-right)); }
.tp-main { flex: 1; padding-block: 20px 48px; }

.tp-skip { position: absolute; left: 12px; top: -60px; z-index: 100; background: var(--tp-p300); color: #05181A; padding: 10px 14px; border-radius: 8px; font-weight: 600; text-decoration: none; }
.tp-skip:focus { top: 12px; }
.tp-skip:hover { color: #05181A; }

/* ---------- Type ---------- */
.tp-h1 { font-family: var(--tp-display); font-weight: 700; font-size: clamp(1.75rem, 1.2rem + 2vw, 2.5rem); line-height: 1.1; letter-spacing: -0.02em; margin: 0; text-wrap: balance; }
.tp-lede { color: var(--tp-ink-2); margin: 6px 0 0; max-width: 60ch; }
.tp-label { font-size: .75rem; font-weight: 600; line-height: 1.3; color: var(--tp-muted); }

/* ---------- Header ---------- */
.tp-header { position: sticky; top: 0; z-index: 50; background: var(--tp-bg); border-bottom: 1px solid var(--tp-line); padding-top: env(safe-area-inset-top); }
.tp-header__row > * { min-width: 0; }
.tp-header__row { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 56px; }
.tp-brand { display: inline-flex; align-items: center; gap: 10px; min-height: 44px; color: var(--tp-ink) !important; text-decoration: none; font-family: var(--tp-display); font-weight: 700; font-size: 1.25rem; letter-spacing: -0.01em; }
.tp-brand i { color: var(--tp-p300); font-size: 1.05rem; }
.tp-tools { display: flex; align-items: center; gap: 8px; }

.tp-chip { display: inline-flex; align-items: center; gap: 6px; font-size: .75rem; font-weight: 600; line-height: 1; padding: 6px 9px; border: 1px solid var(--tp-frame); border-radius: 999px; color: var(--tp-ink-2); white-space: nowrap; font-family: var(--tp-text); }
.tp-chip--beta { border-radius: 4px; color: var(--tp-p300); border-color: var(--tp-p700); }
.tp-chip--premium { border-radius: 4px; color: var(--tp-ink-2); border-color: var(--tp-frame); }
.tp-chip--on { color: var(--tp-p100); background: var(--tp-p700); border-color: var(--tp-p500); }
.tp-chip--warn { color: var(--tp-amber); border-color: #6b4a14; }

/* Menu (details/summary, no JS needed) */
.tp-menu { position: relative; }
.tp-menu > summary { list-style: none; cursor: pointer; display: inline-flex; align-items: center; gap: 8px; min-height: 44px; min-width: 44px; justify-content: center; padding: 0 12px; border: 1.5px solid var(--tp-frame); border-radius: 12px; color: var(--tp-ink); font-weight: 600; font-size: .875rem; }
.tp-menu > summary::-webkit-details-marker { display: none; }
.tp-menu > summary:hover { background: var(--tp-sheet-2); }
.tp-menu[open] > summary { background: var(--tp-sheet-2); border-color: var(--tp-p300); }
.tp-menu__list { position: absolute; right: 0; top: calc(100% + 8px); min-width: 220px; background: var(--tp-sheet); border: 1.5px solid var(--tp-frame); padding: 6px; z-index: 60; }
.tp-menu__list a { display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 0 12px; color: var(--tp-ink) !important; text-decoration: none; border-radius: 6px; font-size: .9375rem; }
.tp-menu__list a:hover { background: var(--tp-sheet-2); }
.tp-menu__list a i { width: 18px; text-align: center; color: var(--tp-muted); }
.tp-menu__sep { height: 1px; background: var(--tp-line); margin: 6px 0; }
.tp-menu__lang { display: flex; gap: 6px; padding: 6px 6px 4px; }
.tp-menu__lang a { flex: 1; justify-content: center; border: 1.5px solid var(--tp-frame); min-height: 44px; }
.tp-menu__lang a[aria-current="true"] { background: var(--tp-p700); border-color: var(--tp-p300); color: var(--tp-p100) !important; }

/* Tabs */
.tp-tabs { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; margin-bottom: -1px; }
.tp-tabs::-webkit-scrollbar { display: none; }
.tp-tab { display: inline-flex; align-items: center; min-height: 44px; padding: 0 14px; color: var(--tp-ink-2) !important; text-decoration: none; font-weight: 500; font-size: .9375rem; border-bottom: 2px solid transparent; white-space: nowrap; }
.tp-tab:hover { color: var(--tp-ink) !important; border-bottom-color: var(--tp-frame); }
.tp-tab[aria-current="page"] { color: var(--tp-ink) !important; border-bottom-color: var(--tp-p300); font-weight: 600; }

/* ---------- Sheet (signature component) ---------- */
.tp-sheet { background: var(--tp-sheet); border: 1.5px solid var(--tp-frame); border-radius: 0; min-width: 0; }
.tp-sheet__hd { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 14px; border-bottom: 1px solid var(--tp-line); min-height: 46px; }
.tp-sheet__title { font-family: var(--tp-display); font-weight: 700; font-size: .8125rem; letter-spacing: .01em; margin: 0; color: var(--tp-ink); }
.tp-sheet__note { font-size: .75rem; font-weight: 500; color: var(--tp-muted); display: inline-flex; align-items: center; gap: 8px; }
.tp-sheet__bd { padding: 16px; }
@media (min-width: 720px) { .tp-sheet__bd { padding: 18px 20px; } .tp-sheet__hd { padding: 10px 20px; } }

/* ---------- Buttons and controls ---------- */
.tp-btn { display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 48px; padding: 0 20px; border: 1.5px solid var(--tp-p300); border-radius: 12px; background: var(--tp-p300); color: #05181A; font-family: var(--tp-text); font-weight: 600; font-size: 1rem; line-height: 1; text-decoration: none; cursor: pointer; transition: background-color .18s var(--tp-ease), border-color .18s var(--tp-ease), transform .12s var(--tp-ease); }
.tp-btn:hover { background: #6BC4C7; border-color: #6BC4C7; color: #05181A; }
.tp-btn:active { transform: translateY(1px); }
.tp-btn[disabled], .tp-btn[aria-busy="true"] { opacity: .55; cursor: progress; }
.tp-btn--ghost { background: transparent; color: var(--tp-ink); border-color: var(--tp-frame); }
.tp-btn--ghost:hover { background: var(--tp-sheet-2); border-color: var(--tp-p300); color: var(--tp-ink); }
.tp-btn--amber { background: var(--tp-amber); border-color: var(--tp-amber); color: var(--tp-amber-ink); }
.tp-btn--amber:hover { background: #F6BC62; border-color: #F6BC62; color: var(--tp-amber-ink); }
.tp-btn--sm { min-height: 44px; padding: 0 14px; font-size: .875rem; border-radius: 10px; }
.tp-btn--block { width: 100%; }
.tp-btn--icon { width: 48px; padding: 0; flex: none; }

.tp-select { width: 100%; min-height: 48px; padding: 0 14px; background: var(--tp-sheet); color: var(--tp-ink); border: 1.5px solid var(--tp-frame); border-radius: 8px; font: inherit; font-size: 1rem; appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%238BA7AB' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; padding-right: 38px; }
.tp-select:focus-visible { border-color: var(--tp-p300); outline-offset: 2px; }

/* Status chip (value of #status-val) */
.tp-status { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; font-size: .875rem; color: var(--tp-ink-2); }
.tp-status::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: var(--tp-muted); }
.tp-status--online { color: var(--tp-p100); }
.tp-status--online::before { background: var(--tp-p300); }
.tp-status--wake { color: var(--tp-amber); }
.tp-status--wake::before { background: var(--tp-amber); }

/* ---------- Dashboard layout ---------- */
.tp-dash { display: grid; gap: var(--tp-gap); grid-template-columns: minmax(0, 1fr); }
/* Phone: one column in task order (columns dissolve, `order` sorts). Desktop: two independent columns. */
.tp-col { display: contents; }
.tp-a-veh { order: 1; } .tp-a-energy { order: 2; } .tp-a-actions { order: 3; }
.tp-a-data { order: 4; } .tp-a-smart { order: 5; } .tp-a-loc { order: 6; } .tp-a-log { order: 7; }
@media (min-width: 960px) {
  .tp-dash { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); align-items: start; }
  .tp-col { display: flex; flex-direction: column; gap: var(--tp-gap); min-width: 0; }
  .tp-col > * { order: 0; }
}

.tp-vehicle { display: flex; gap: 10px; align-items: stretch; }
.tp-vehicle .tp-select { flex: 1; }

/* Energy */
.tp-energy__top { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; }
.tp-pct { font-family: var(--tp-display); font-weight: 700; font-size: clamp(4rem, 3rem + 8vw, 5.5rem); line-height: .9; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.tp-pct small { font-size: .38em; color: var(--tp-muted); font-weight: 600; margin-left: 4px; letter-spacing: 0; }
.tp-range { text-align: right; padding-bottom: 6px; }
.tp-range strong { display: block; font-family: var(--tp-display); font-size: 1.5rem; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; }

/* Signature: 20-segment charge scale (5 % per segment) */
.tp-scale { display: grid; grid-template-columns: repeat(20, 1fr); gap: 3px; margin: 18px 0 14px; height: 30px; }
.tp-scale i { background: var(--tp-p900); border: 1px solid var(--tp-line); border-radius: 1px; transition: background-color .5s var(--tp-ease); }
.tp-scale i.is-on { background: var(--tp-p300); border-color: var(--tp-p300); }
.tp-scale[data-level="low"] i.is-on { background: var(--tp-red); border-color: var(--tp-red); }
.tp-scale i.is-next { border-color: var(--tp-amber); background: rgba(242, 169, 59, .25); animation: tp-pulse 2.4s var(--tp-ease) infinite; }
@keyframes tp-pulse { 0%, 100% { background: rgba(242, 169, 59, .12); } 50% { background: rgba(242, 169, 59, .6); } }
.tp-chargeline { margin: 0 0 14px; font-size: .9375rem; color: var(--tp-amber); font-weight: 600; font-variant-numeric: tabular-nums; }

.tp-state-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.tp-actions-inline { display: flex; gap: 8px; flex-wrap: wrap; }

.tp-dl { margin: 18px 0 0; padding-top: 6px; border-top: 1px solid var(--tp-line); display: grid; }
.tp-dl > div { display: flex; justify-content: space-between; gap: 16px; padding: 10px 0; border-bottom: 1px solid var(--tp-line); font-size: .9375rem; }
.tp-dl > div:last-child { border-bottom: 0; padding-bottom: 0; }
.tp-dl dt { color: var(--tp-muted); }
.tp-dl dd { margin: 0; color: var(--tp-ink); font-variant-numeric: tabular-nums; text-align: right; }
.tp-dl dd.is-bad { color: var(--tp-red); font-weight: 600; }

/* Quick actions: paired switches that show their state */
.tp-switch { display: grid; grid-template-columns: 1fr; gap: 8px; padding: 14px 0; border-bottom: 1px solid var(--tp-line); }
.tp-switch:first-child { padding-top: 0; }
.tp-switch__name { font-family: var(--tp-display); font-weight: 600; font-size: .875rem; color: var(--tp-ink-2); }
.tp-switch__pair { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.tp-seg { display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 52px; padding: 0 12px; background: transparent; color: var(--tp-ink); border: 1.5px solid var(--tp-frame); border-radius: 12px; font: inherit; font-weight: 600; font-size: .9375rem; cursor: pointer; transition: background-color .18s var(--tp-ease), border-color .18s var(--tp-ease); }
.tp-seg:hover { background: var(--tp-sheet-2); border-color: var(--tp-p300); }
.tp-seg:active { transform: translateY(1px); }
.tp-seg i { color: var(--tp-muted); width: 18px; text-align: center; }
.tp-seg.is-on { background: var(--tp-p700); border-color: var(--tp-p300); color: var(--tp-p100); }
.tp-seg.is-on i { color: var(--tp-p100); }
.tp-seg.is-on::after { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--tp-p300); margin-left: 2px; }
.tp-seg--charge.is-on { background: #3a2a0a; border-color: var(--tp-amber); color: #FFD590; }
.tp-seg--charge.is-on i { color: var(--tp-amber); }
.tp-seg--charge.is-on::after { background: var(--tp-amber); }
.tp-seg[disabled] { opacity: .55; cursor: progress; }

.tp-more { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding-top: 16px; }
.tp-more .tp-btn { justify-content: flex-start; text-align: left; line-height: 1.25; padding-block: 6px; }
.tp-more .tp-btn i { width: 18px; text-align: center; }
.tp-more__title { grid-column: 1 / -1; margin: 0 0 2px; }

/* Smart links */
.tp-links { display: grid; }
.tp-link-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 64px; padding: 12px 16px; color: var(--tp-ink) !important; text-decoration: none; border-bottom: 1px solid var(--tp-line); }
.tp-link-row:last-child { border-bottom: 0; }
.tp-link-row:hover { background: var(--tp-sheet-2); }
.tp-link-row strong { font-family: var(--tp-display); font-weight: 600; font-size: 1.0625rem; display: block; }
.tp-link-row .tp-label { display: block; }
.tp-link-row__end { display: flex; align-items: center; gap: 10px; color: var(--tp-muted); }

/* Map and notices */
.tp-map { height: 260px; background: var(--tp-p900); border: 1px solid var(--tp-line); position: relative; overflow: hidden; z-index: 0; }
@media (min-width: 960px) { .tp-map { height: 300px; } }
.tp-map__msg { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; gap: 10px; color: var(--tp-muted); font-size: .875rem; text-align: center; padding: 16px; }
.tp-map .leaflet-tile-pane { filter: invert(1) hue-rotate(180deg) brightness(.85) contrast(.9) saturate(.6); }
.tp-map.leaflet-container .leaflet-control-attribution { background: rgba(11, 20, 22, .9); color: var(--tp-ink-2); font-size: 12px; }
.tp-map.leaflet-container .leaflet-control-attribution a { color: var(--tp-p300); }
.tp-notice { display: flex; gap: 12px; align-items: flex-start; margin-bottom: 14px; padding: 12px 14px; border: 1.5px solid #6b4a14; background: var(--tp-amber-wash); color: var(--tp-amber-text); font-size: .9375rem; }
.tp-notice i { color: var(--tp-amber); margin-top: 3px; }
.tp-notice a { color: #FFD590 !important; font-weight: 600; }
.tp-notice p { margin: 0 0 8px; }
.tp-notice p:last-child { margin: 0; }

.tp-log summary { cursor: pointer; list-style: none; display: flex; align-items: center; justify-content: space-between; padding: 10px 14px; min-height: 46px; font-family: var(--tp-display); font-weight: 700; font-size: .8125rem; }
.tp-log summary::-webkit-details-marker { display: none; }
.tp-log summary i { color: var(--tp-muted); transition: transform .2s var(--tp-ease); }
.tp-log[open] summary i { transform: rotate(180deg); }
.tp-log #console-log { border-top: 1px solid var(--tp-line); padding: 12px 14px; height: 140px; overflow: auto; font-size: .8125rem; line-height: 1.5; font-variant-numeric: tabular-nums; color: var(--tp-ink-2); }

/* ---------- Welcome (signed out) ---------- */
.tp-welcome { max-width: 560px; margin: 24px auto 0; }
.tp-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; counter-reset: step; }
.tp-steps li { counter-increment: step; display: grid; grid-template-columns: 36px 1fr; gap: 14px; padding: 18px 0; border-bottom: 1px solid var(--tp-line); }
.tp-steps li:last-child { border-bottom: 0; }
.tp-steps li::before { content: counter(step); width: 28px; height: 28px; border-radius: 50%; border: 1.5px solid var(--tp-p300); color: var(--tp-p300); display: flex; align-items: center; justify-content: center; font-family: var(--tp-display); font-weight: 700; font-size: .875rem; }
.tp-steps h2 { font-family: var(--tp-display); font-size: 1.0625rem; font-weight: 700; margin: 2px 0 4px; letter-spacing: -0.01em; }
.tp-steps p { margin: 0 0 12px; color: var(--tp-ink-2); font-size: .9375rem; }
.tp-fine { font-size: .75rem; color: var(--tp-muted); line-height: 1.5; margin: 16px 0 0; }

/* ---------- Charging page ---------- */
.tp-pagehead { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; margin-bottom: 20px; }
.tp-pagehead__txt { flex: 1 1 280px; }
.tp-charge-grid { display: grid; gap: var(--tp-gap); grid-template-columns: minmax(0, 1fr); }
@media (min-width: 960px) { .tp-charge-grid { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); align-items: start; } .tp-charge-grid .tp-span { grid-column: 1 / -1; } }
.tp-figures { display: grid; gap: 0; margin: 0; }
.tp-figures > div { padding: 16px 0; border-bottom: 1px solid var(--tp-line); }
.tp-figures > div:first-child { padding-top: 0; }
.tp-figures > div:last-child { border-bottom: 0; padding-bottom: 0; }
.tp-figures dt { font-size: .875rem; color: var(--tp-muted); font-weight: 500; }
.tp-figures dd { margin: 4px 0 0; font-family: var(--tp-display); font-weight: 700; font-size: 2rem; line-height: 1.1; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.tp-figures dd small { font-family: var(--tp-text); font-size: .875rem; font-weight: 500; color: var(--tp-muted); letter-spacing: 0; margin-left: 4px; }
.tp-figures .tp-hint { margin: 6px 0 0; font-size: .8125rem; color: var(--tp-muted); line-height: 1.5; max-width: 52ch; }
.tp-chart { position: relative; height: 260px; }

.tp-table-wrap { overflow-x: auto; }
.tp-table { width: 100%; border-collapse: collapse; font-size: .9375rem; }
.tp-table th { text-align: left; font-size: .75rem; font-weight: 600; color: var(--tp-muted); padding: 12px 16px; border-bottom: 1px solid var(--tp-frame); white-space: nowrap; }
.tp-table td { padding: 14px 16px; border-bottom: 1px solid var(--tp-line); vertical-align: middle; font-variant-numeric: tabular-nums; }
.tp-table tr:last-child td { border-bottom: 0; }
.tp-table tbody tr:hover { background: var(--tp-sheet-2); }
.tp-table .tp-r { text-align: right; }
.tp-table.tp-no-place th:nth-child(2), .tp-table.tp-no-place td:nth-child(2) { display: none; }
.tp-table.tp-no-veh th:nth-child(8), .tp-table.tp-no-veh td:nth-child(8) { display: none; }
.tp-table td.is-muted { color: var(--tp-muted); }
.tp-table .tp-empty { text-align: center; color: var(--tp-muted); padding: 40px 16px; }
.tp-range-bar { display: inline-block; position: relative; width: 72px; height: 6px; background: var(--tp-p900); border: 1px solid var(--tp-line); vertical-align: middle; margin-left: 10px; }
.tp-range-bar i { position: absolute; top: -1px; bottom: -1px; background: var(--tp-p300); }
.tp-state { font-size: .8125rem; font-weight: 600; color: var(--tp-ink-2); display: inline-flex; align-items: center; gap: 8px; }
.tp-state::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--tp-muted); }
.tp-state--active { color: var(--tp-amber); } .tp-state--active::before { background: var(--tp-amber); }
.tp-state--complete { color: var(--tp-p100); } .tp-state--complete::before { background: var(--tp-p300); }

@media (max-width: 719px) {
  .tp-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .tp-table, .tp-table tbody { display: block; }
  .tp-table tr { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 12px; padding: 14px 16px; border-bottom: 1px solid var(--tp-line); }
  .tp-table tr:last-child { border-bottom: 0; }
  .tp-table td { display: flex; flex-direction: column; padding: 0; border: 0; font-size: .9375rem; }
  .tp-table td::before { content: attr(data-label); font-size: .75rem; font-weight: 600; color: var(--tp-muted); }
  .tp-table td.tp-r { text-align: left; }
  .tp-table td.tp-nodl { display: none; }
  /* Card: date headline, place only when known, then pairs */
  .tp-table--history td:nth-child(1) { grid-column: 1 / -1; font-family: var(--tp-display); font-weight: 600; font-size: 1.0625rem; }
  .tp-table--history td:nth-child(1)::before { content: none; }
  .tp-table--history td:nth-child(2) { grid-column: 1 / -1; }
  .tp-table--history td:nth-child(2).is-muted { display: none; }
  .tp-table--history td:nth-child(7) { grid-column: 1 / -1; }
  .tp-table--history td:nth-child(1) { order: -2; }
  .tp-table--history td:nth-child(8) { order: -1; grid-column: 1 / -1; }
  .tp-table td.tp-empty { grid-column: 1 / -1; display: block; }
  .tp-table td.tp-empty::before { content: none; }
}

/* ---------- Forms: switch + time field + schedule ---------- */
.tp-toggle { display: inline-flex; align-items: center; gap: 12px; min-height: 44px; cursor: pointer; font-weight: 600; font-size: .9375rem; }
.tp-sw { -webkit-appearance: none; appearance: none; flex: none; position: relative; width: 48px; height: 28px; margin: 0; cursor: pointer; border: 1.5px solid var(--tp-frame); border-radius: 999px; background: var(--tp-p900); transition: background-color .2s var(--tp-ease), border-color .2s var(--tp-ease); }
.tp-sw::after { content: ""; position: absolute; top: 3px; left: 3px; width: 19px; height: 19px; border-radius: 50%; background: var(--tp-muted); transition: transform .2s var(--tp-ease), background-color .2s var(--tp-ease); }
.tp-sw:checked { background: var(--tp-p700); border-color: var(--tp-p300); }
.tp-sw:checked::after { transform: translateX(20px); background: var(--tp-p100); }

.tp-input { width: 100%; min-height: 48px; padding: 0 12px; background: var(--tp-sheet); color: var(--tp-ink); border: 1.5px solid var(--tp-frame); border-radius: 8px; font: inherit; font-size: 1rem; font-variant-numeric: tabular-nums; }
.tp-input:focus-visible { border-color: var(--tp-p300); outline-offset: 2px; }
.tp-field label { display: block; font-size: .75rem; font-weight: 600; color: var(--tp-muted); margin-bottom: 6px; }

.tp-day { display: grid; gap: 12px 12px; grid-template-columns: 1fr 1fr; padding: 16px; border-bottom: 1px solid var(--tp-line); }
.tp-day:last-child { border-bottom: 0; }
.tp-day__name { grid-column: 1; grid-row: 1; display: flex; align-items: center; gap: 12px; }
.tp-day__name .tp-toggle { font-family: var(--tp-display); font-size: 1.0625rem; }
.tp-day.is-off .tp-field, .tp-day.is-off .tp-window { opacity: .55; }
.tp-window { position: relative; grid-column: 1 / -1; height: 10px; background: var(--tp-p900); border: 1px solid var(--tp-line); }
.tp-window i { position: absolute; top: -1px; bottom: -1px; background: var(--tp-p300); }
.tp-window b { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--tp-line); }
.tp-window__ax { grid-column: 1 / -1; display: flex; justify-content: space-between; margin-top: -6px; font-size: .75rem; color: var(--tp-muted); font-variant-numeric: tabular-nums; }
.tp-day__copy { grid-column: 2; grid-row: 1; justify-self: end; align-self: center; }
.tp-sch-actions { display: flex; flex-wrap: wrap; gap: 12px; justify-content: flex-end; align-items: center; padding: 16px; border-top: 1px solid var(--tp-line); }
.tp-sch-actions .tp-sheet__note { margin-right: auto; }
@media (max-width: 559px) { .tp-sch-actions .tp-btn { flex: 1 1 100%; } }
.tp-sch-head { display: none; }
@media (min-width: 960px) {
  .tp-sch-head, .tp-day { display: grid; grid-template-columns: 220px 150px 150px minmax(0, 1fr) 100px; gap: 16px; align-items: end; padding-inline: 20px; }
  .tp-sch-head { padding-block: 10px; border-bottom: 1px solid var(--tp-frame); font-size: .75rem; font-weight: 600; color: var(--tp-muted); }
  .tp-day { padding-block: 14px; }
  .tp-day__name, .tp-window, .tp-day__copy { grid-column: auto; grid-row: auto; justify-self: auto; }
  .tp-day__copy { justify-self: center; }
  .tp-day__name { align-self: center; }
  .tp-window { align-self: center; margin-bottom: 19px; }
  .tp-window__ax { display: none; }
  .tp-day__copy { align-self: end; }
  .tp-copy-txt { display: none; }
  .copy-down { width: 48px; min-height: 48px; padding: 0; }
  .tp-sch-head > :last-child { text-align: center; white-space: nowrap; }
  /* column heads already name the fields on desktop; labels stay for screen readers */
  .tp-day .tp-field label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; margin: 0; }
  .tp-window { margin-bottom: 0; }
  .tp-day { align-items: center; }
  .tp-sch-head .tp-sch-axis { display: flex; justify-content: space-between; }
}

/* ---------- Plans, payment, notices, invoices ---------- */
.tp-btn--danger { background: transparent; color: var(--tp-red); border-color: #6b2d29; }
.tp-btn--danger:hover { background: var(--tp-red-bg); border-color: var(--tp-red); color: var(--tp-red); }
.tp-notice--ok { border-color: var(--tp-p500); background: var(--tp-p900); color: var(--tp-p100); }
.tp-notice--ok i { color: var(--tp-p300); }
.tp-notice--err { border-color: #6b2d29; background: var(--tp-red-bg); color: var(--tp-red-text); }
.tp-notice--err i { color: var(--tp-red); }

.tp-narrow { max-width: 600px; margin-inline: auto; width: 100%; }
.tp-plans { display: grid; gap: var(--tp-gap); }
@media (min-width: 960px) { .tp-plans { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.tp-plan { display: flex; flex-direction: column; }
.tp-plan .tp-sheet__bd { display: flex; flex-direction: column; flex: 1; }
.tp-plan__name { font-family: var(--tp-display); font-weight: 700; font-size: 1.25rem; margin: 0 0 12px; letter-spacing: -0.01em; }
.tp-price { font-family: var(--tp-display); font-weight: 700; font-size: 2.5rem; line-height: 1; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.tp-price small { font-family: var(--tp-text); font-size: .875rem; font-weight: 500; color: var(--tp-muted); letter-spacing: 0; margin-left: 4px; }
.tp-plan__desc { color: var(--tp-ink-2); margin: 14px 0 0; }
@media (min-width: 960px) { .tp-plan__desc { min-height: 3.2em; } }
.tp-feat { list-style: none; margin: 20px 0 24px; padding: 20px 0 0; border-top: 1px solid var(--tp-line); display: grid; gap: 12px; font-size: .9375rem; }
.tp-feat li { display: grid; grid-template-columns: 20px 1fr; gap: 10px; align-items: start; }
.tp-feat i { color: var(--tp-p300); margin-top: 4px; text-align: center; }
.tp-plan__cta { margin-top: auto; }

.tp-methods { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 20px; }
.tp-methods .tp-seg { min-height: 48px; padding-inline: 8px; }
.tp-methods .tp-seg.is-on::after { display: none; }
@media (max-width: 359px) { .tp-methods { grid-template-columns: 1fr; } }
.tp-form { display: grid; gap: 16px; }
.tp-form__row { display: grid; gap: 12px; grid-template-columns: 1fr 1fr; }
.tp-form__row--zip { grid-template-columns: 1fr 2fr; }
.tp-affix { position: relative; }
.tp-affix > span { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--tp-muted); pointer-events: none; }
.tp-affix .tp-input { padding-left: 32px; }
.tp-setrow { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding-bottom: 20px; margin-bottom: 20px; border-bottom: 1px solid var(--tp-line); }
.tp-setrow h3 { font-family: var(--tp-display); font-size: 1.0625rem; font-weight: 600; margin: 0 0 4px; }
.tp-setrow p { margin: 0; color: var(--tp-ink-2); font-size: .9375rem; }
.tp-lock { color: var(--tp-ink-2); font-size: .875rem; margin: 10px 0 0; }
.tp-lock i { color: var(--tp-muted); margin-right: 6px; }
.tp-planname { font-family: var(--tp-display); font-weight: 700; font-size: 2.5rem; line-height: 1.05; letter-spacing: -0.02em; margin: 0 0 12px; }
.tp-stack { display: grid; gap: var(--tp-gap); }
.tp-table td a.tp-btn { min-height: 44px; }
.tp-sheet--wide .tp-table-wrap { border-top: 0; }

/* ---------- Read pages (imprint, changelog) and features ---------- */
.tp-prose { max-width: 68ch; }
.tp-prose h2 { font-family: var(--tp-display); font-weight: 700; font-size: 1.25rem; letter-spacing: -0.01em; margin: 32px 0 8px; }
.tp-prose h2:first-child { margin-top: 0; }
.tp-prose p, .tp-prose li { color: var(--tp-ink-2); }
.tp-prose p { margin: 0 0 14px; }
.tp-prose address { font-style: normal; color: var(--tp-ink); line-height: 1.7; margin: 0 0 14px; }
.tp-prose strong { color: var(--tp-ink); }

.tp-releases { display: grid; gap: var(--tp-gap); }
.tp-release__hd { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.tp-release h3 { font-family: var(--tp-display); font-weight: 700; font-size: 1.125rem; letter-spacing: -0.01em; margin: 0 0 14px; }
.tp-release ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.tp-release li { color: var(--tp-ink-2); font-size: .9375rem; }
.tp-release li strong { display: block; color: var(--tp-ink); font-weight: 600; margin-bottom: 2px; }

.tp-hero { display: grid; gap: 32px; padding-block: 8px 40px; }
.tp-hero__fig { display: none; }
.tp-jobs { margin-top: 28px; }
.tp-jobs ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.tp-jobs a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 14px; border: 1.5px solid var(--tp-frame); border-radius: 999px; color: var(--tp-ink) !important; text-decoration: none; font-weight: 500; font-size: .9375rem; }
.tp-jobs a:hover { background: var(--tp-sheet-2); border-color: var(--tp-p300); }
.tp-feature { scroll-margin-top: 120px; }
.tp-feature-title { font-family: var(--tp-display); font-weight: 700; font-size: clamp(1.5rem, 1.1rem + 1.4vw, 2.125rem); line-height: 1.12; letter-spacing: -0.02em; margin: 0 0 12px; text-wrap: balance; }
@media (min-width: 960px) {
  .tp-hero { grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); align-items: center; gap: 56px; }
  .tp-hero__fig { display: block; }
  .tp-hero__fig .tp-fig--phone { margin-inline: auto; }
}
.tp-hero__cta { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 24px; }
.tp-feature { display: grid; gap: 24px; padding-block: 40px; border-top: 1px solid var(--tp-line); }
.tp-feature h2 { font-family: var(--tp-display); font-weight: 700; font-size: clamp(1.5rem, 1.1rem + 1.4vw, 2.125rem); line-height: 1.12; letter-spacing: -0.02em; margin: 0 0 12px; text-wrap: balance; }
.tp-feature p { color: var(--tp-ink-2); margin: 0; max-width: 56ch; }
.tp-feature__chip { margin-bottom: 14px; display: inline-flex; }
.tp-feat--plain { border-top: 0; padding-top: 0; margin: 20px 0 0; }
.tp-fig { margin: 0; min-width: 0; }
.tp-fig img { display: block; width: 100%; height: auto; background: var(--tp-p900); }
.tp-fig__cap { display: flex; justify-content: space-between; gap: 12px; margin-top: 10px; font-size: .8125rem; color: var(--tp-ink-2); }
.tp-fig__tag { color: var(--tp-muted); white-space: nowrap; }
.tp-fig--phone { max-width: 340px; }
.tp-fig--phone img { border: 1.5px solid var(--tp-frame); }
@media (min-width: 960px) {
  .tp-feature { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 56px; align-items: center; padding-block: 56px; }
  .tp-feature--rev { grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); }
  .tp-feature--rev .tp-feature__text { order: 2; }
  .tp-feature--phone { grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); }
  .tp-feature--wide { grid-template-columns: minmax(0, 1fr); gap: 32px; align-items: start; }
  .tp-feature--wide .tp-feature__text { max-width: 62ch; }
  .tp-feature--wide .tp-fig { max-width: 1116px; }
  .tp-feature--phone .tp-fig { justify-self: center; }
}
.tp-closing { border-top: 1px solid var(--tp-line); padding-block: 48px 8px; }

/* ---------- Fleet overview ---------- */
.tp-fleet-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; margin-bottom: 16px; }
.tp-fleet-bar__sum { color: var(--tp-ink-2); font-size: .9375rem; flex: 1 1 260px; margin: 0; }
.tp-fleet-bar__time { color: var(--tp-muted); font-size: .8125rem; }
.tp-cell-sub { display: block; color: var(--tp-muted); font-size: .8125rem; }
.tp-cs--charging { color: var(--tp-amber); font-weight: 600; }
.tp-bad { color: var(--tp-red); font-weight: 600; }
.tp-fleet-name { font-family: var(--tp-display); font-weight: 600; font-size: 1.0625rem; }

/* ---------- Footer ---------- */
.tp-footer { border-top: 1px solid var(--tp-line); padding-block: 28px calc(28px + env(safe-area-inset-bottom)); color: var(--tp-muted); font-size: .875rem; }
.tp-footer__row { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px 24px; }
.tp-footer nav { display: flex; flex-wrap: wrap; gap: 4px 20px; }
.tp-footer a { color: var(--tp-ink-2) !important; text-decoration: none; display: inline-flex; align-items: center; min-height: 44px; }
.tp-footer a:hover { color: var(--tp-ink) !important; text-decoration: underline; }

/* iOS install hint */
.tp-ios { position: fixed; left: 12px; right: 12px; bottom: 12px; z-index: 80; background: var(--tp-sheet); border: 1.5px solid var(--tp-p300); padding: 14px 16px; display: flex; gap: 12px; align-items: flex-start; justify-content: space-between; }
.tp-ios p { margin: 0; font-size: .875rem; color: var(--tp-ink-2); }
.tp-ios strong { color: var(--tp-ink); display: block; margin-bottom: 2px; }
.tp-ios button { background: none; border: 0; color: var(--tp-muted); min-width: 44px; min-height: 44px; margin: -10px -12px 0 0; cursor: pointer; }

@media (prefers-reduced-motion: reduce) {
  .tp-scale i.is-next { animation: none; background: rgba(242, 169, 59, .4); }
  .tp-body *, .tp-body *::before, .tp-body *::after { transition-duration: .01ms !important; }
}

/* ---------- Fleet overview: cards on phones ---------- */
.tp-range-bar--low i { background: var(--tp-red); }
.tp-range-bar--fleet { width: 96px; margin-left: 0; margin-right: 10px; }
@media (max-width: 719px) {
  .tp-table--fleet td:nth-child(1) { grid-column: 1; }
  .tp-table--fleet td:nth-child(1)::before { content: none; }
  .tp-table--fleet td:nth-child(2) { grid-column: 2; align-items: flex-end; justify-content: flex-start; padding-top: 3px; }
  .tp-table--fleet td:nth-child(2)::before { content: none; }
  .tp-table--fleet td:nth-child(3), .tp-table--fleet td:nth-child(7) { grid-column: 1 / -1; }
  .tp-table--fleet td:nth-child(7)::before { content: none; }
}
.tp-fleet-foot { margin: 14px 0 0; color: var(--tp-muted); font-size: .8125rem; line-height: 1.5; max-width: 70ch; }
.tp-map .leaflet-tooltip { background: var(--tp-sheet); color: var(--tp-ink); border: 1.5px solid var(--tp-frame); border-radius: 0; box-shadow: none; font-family: var(--tp-text); font-size: .8125rem; font-weight: 600; padding: 4px 8px; }
.tp-map .leaflet-tooltip-top:before { border-top-color: var(--tp-frame); }
