:root {
  color-scheme: light;
  --bg: #e9eaec;
  --panel: #ffffff;
  --text: #171a1c;
  --muted: #5c636b;
  --line: #d3d6da;
  --accent: #2b6cb0;
  --accent-2: #1f6feb;
  --ok: #1f7a3d;
  --warn: #a8620a;
  --crit: #b3261e;
  --radius: 6px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 6px 18px rgba(16, 24, 40, .05);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0b1219;
    --panel: #131e29;
    --text: #e6e9ec;
    --muted: #8a94a2;
    --line: #223039;
    --accent: #4a90d9;
    --accent-2: #4a90d9;
    --ok: #3fb950;
    --warn: #d29922;
    --crit: #f85149;
    --shadow: 0 1px 2px rgba(0, 0, 0, .35), 0 6px 18px rgba(0, 0, 0, .25);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0b1219;
  --panel: #131e29;
  --text: #e6e9ec;
  --muted: #8a94a2;
  --line: #223039;
  --accent: #4a90d9;
  --accent-2: #4a90d9;
  --ok: #3fb950;
  --warn: #d29922;
  --crit: #f85149;
  --shadow: 0 1px 2px rgba(0, 0, 0, .35), 0 6px 18px rgba(0, 0, 0, .25);
}
:root[data-theme="light"] {
  color-scheme: light;
}
[hidden] { display: none !important; }
* { box-sizing: border-box; }
body {
  margin: 0;
  font: 15px/1.5 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
}
a { color: var(--accent-2); text-decoration: none; }
a:hover { text-decoration: underline; }
.topbar {
  display: flex; align-items: center; gap: 24px;
  padding: 14px 28px; background: var(--panel);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 20;
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark {
  width: 36px; height: 36px; flex: 0 0 auto;
  display: grid; place-items: center;
  background: transparent;
}
.brand-mark img { display: block; width: 36px; height: 36px; }
.brand small { display: block; color: var(--muted); font-size: 11px; letter-spacing: .04em; text-transform: uppercase; }
nav { display: flex; gap: 18px; flex: 1; }
nav a {	color: var(--text); font-weight: 600; font-size: 14px; }
.userbox { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 13px; }
.userbox .userbox-link { color: var(--text); font-weight: 600; font-size: 14px; }
/* Telepítés az alkalmazásként (PWA): a felső sorban, permanensen elrejthető. */
.install-notice { position: relative; display: flex; align-items: center; gap: 2px; }
.install-app {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 10px; font-size: 13px; font-weight: 600;
  border: 1px solid var(--accent-2); border-radius: 999px;
  background: transparent; color: var(--accent-2); cursor: pointer;
}
.install-app:hover { background: rgba(31, 111, 235, .10); }
.install-dismiss {
  border: 0; background: transparent; color: var(--muted);
  font-size: 17px; line-height: 1; padding: 2px 4px; cursor: pointer;
}
.install-dismiss:hover { color: var(--text); }
.install-hint {
  position: absolute; top: calc(100% + 8px); right: 0; width: 250px;
  max-width: calc(100vw - 24px);
  padding: 10px 12px; font-size: 13px; color: var(--text);
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow); z-index: 30;
}
.theme-toggle {
  width: 30px; height: 30px; padding: 0; border-radius: 6px;
  display: inline-grid; place-items: center;
  border: 1px solid var(--line); background: var(--panel); color: var(--text);
  font-size: 15px; line-height: 1; cursor: pointer;
}
.theme-toggle:hover { border-color: var(--accent-2); }
.map-action { min-width: 30px; text-align: center; }
/* 3D is a desktop-only view; hide the button on touch/small screens. */
@media (max-width: 900px), (pointer: coarse) {
  .map-3d-toggle { display: none; }
}
main { max-width: 1280px; margin: 0 auto; padding: 28px; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
h1 { font-size: 26px; margin: 0 0 4px; }
h2 { font-size: 17px; margin: 0 0 12px; }
p { margin: 0 0 10px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.nowrap { white-space: nowrap; }
.grid { display: grid; gap: 18px; margin-bottom: 18px; }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
/* A két felső kártya (jármű + térkép) azonos magas: a rács nyújt. */
.dashboard-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; margin-bottom: 18px; align-items: stretch; }
@media (max-width: 1000px) { .dashboard-grid { grid-template-columns: minmax(0, 1fr); } }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.card-head h2 { margin-bottom: 0; }
/* A fejléc jobb oldali vége egy csoport: a művelet (pl. Megnyitás) és az
   állapotjelző együtt, közvetlenül egymás mellett — ne szóródjanak szét. */
.card-head .head-end { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.dashboard-visual-card { display: flex; flex-direction: column; min-height: 560px; }
.dashboard-full { grid-column: 1 / -1; }
.dashboard-map, .dashboard-chart { flex: 1 1 auto; min-height: 470px; height: 100%; margin-top: 12px; }
.dashboard-map { height: auto; }
.range-buttons { display: inline-flex; gap: 4px; flex-wrap: wrap; }
.range-btn {
  padding: 5px 10px; border-radius: 4px; border: 1px solid var(--line);
  color: var(--muted); font-size: 12px; font-weight: 600; background: var(--panel);
}
.range-btn:hover { border-color: var(--accent-2); text-decoration: none; }
.range-btn.active { background: var(--accent-2); border-color: var(--accent-2); color: #fff; }
.command-grid { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.command-grid form { display: inline; }
.command-grid button { padding: 6px 10px; font-size: 12px; }
.grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 900px) { .grid.two, .grid.three { grid-template-columns: minmax(0, 1fr); } .topbar { flex-wrap: wrap; } }
/* Biztonsági kártyák: jelszó | MFA (két belső hasáb) | fióktörlés. */
/* A jelszóváltás kártya a legszélesebb (a mezőknek hely kell), az MFA kártya
   keskenyebb; a fióktörlés marad a legkisebb. */
.grid.security { grid-template-columns: minmax(0, 1.5fr) minmax(0, 1.1fr) minmax(0, 1fr); }
@media (max-width: 1200px) { .grid.security { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 900px) { .grid.security { grid-template-columns: minmax(0, 1fr); } }
.mfa-split { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
@media (max-width: 700px) { .mfa-split { grid-template-columns: minmax(0, 1fr); } }
.recovery-codes { margin: 0; padding-left: 18px; }
.danger-zone h2 { color: var(--crit); }
.delete-account { display: flex; flex-direction: column; gap: 2px; margin: 0 0 8px; }
.delete-account strong { font-size: 15px; }
.card {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow);
  min-width: 0;
}
/* Bare card sections (outside a grid) need the same gap as grid rows. */
main > section.card { margin-bottom: 18px; }
.history-card { display: flex; flex-direction: column; }
.history-filters {
  display: flex; flex-wrap: wrap; align-items: end; gap: 10px;
  margin-bottom: 12px;
}
.history-filters label {
  display: flex; flex-direction: column; gap: 4px;
  color: var(--muted); font-size: 12px;
}
.history-filters .inline { display: inline-flex; align-items: center; gap: 6px; }
.history-filters input, .history-filters select {
  padding: 5px 8px; border-radius: 4px; border: 1px solid var(--line);
  background: var(--panel); color: var(--text); font: inherit; font-size: 12px;
}
.history-filters .range-btn { text-decoration: none; }
/* A natív dátummező a böngésző locale-ját követi (mm/dd/yyyy); a látható
   feliratot magyar sorrendben (éééé. hh. nn.) overlay mutatja, a natív
   naptárválasztó ikon érintetlen. */
.date-field { position: relative; display: inline-flex; }
.date-field input[type="date"] { color: transparent; }
.date-field input[type="date"]::-webkit-datetime-edit { color: transparent; }
.date-field input[type="date"]::-webkit-calendar-picker-indicator { opacity: 1; }
.date-display {
  position: absolute;
  top: 0; bottom: 0; left: 8px; right: 26px;
  display: flex; align-items: center;
  pointer-events: none;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  color: var(--text);
  white-space: nowrap;
}
.date-display.is-empty { color: var(--muted); }
.history-list {
  display: flex; flex-direction: column; gap: 10px;
  max-height: 60vh; overflow-y: auto; overscroll-behavior: contain;
  padding-right: 4px;
}
.history-row {
  display: grid; grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px 12px; align-items: center;
  border: 1px solid var(--line); border-radius: 6px; padding: 12px;
}
.history-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.history-metrics { color: var(--muted); font-size: 13px; }
.history-action { grid-column: 2; grid-row: 1 / span 2; color: var(--muted); }
.history-row.map-row { cursor: pointer; }
.history-row.map-row:hover { border-color: var(--accent-2); }
.history-row.map-row:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 2px; }
.card p, .card td, .card th { overflow-wrap: anywhere; }
.vehicle-card { display: flex; flex-direction: column; gap: 12px; }
.vehicle-picker {
  width: 100%; max-width: 100%; min-width: 0; padding: 4px 8px; border-radius: 4px;
  border: 1px solid var(--line); background: var(--panel); color: var(--fg);
  font-size: 18px; font-weight: 700;
}
.vehicle-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; flex-wrap: wrap; }
.vehicle-head > div { min-width: 0; flex: 1 1 220px; }
.car-link { display: block; border-radius: 6px; cursor: pointer; }
.car-link:hover { text-decoration: none; }
/* A jármű-áttekintő és a járműparancsok egyhasábos, teljes szélességű
   kártyák: a parancsok az áttekintő alatt helyezkednek el. */
.vehicle-top {
  display: grid; grid-template-columns: minmax(0, 1fr);
  gap: 18px; margin-bottom: 18px;
}
.vehicle-top > .card { margin-bottom: 0; }
.car-image-wrap { width: 100%; display: flex; justify-content: flex-start; align-items: center; min-height: 120px; overflow: hidden; }
.car-image {
  width: 100%; max-width: 100%; max-height: 300px; object-fit: contain;
  display: block; filter: drop-shadow(0 10px 18px rgba(0,0,0,.22));
}
@media (max-width: 700px) { .car-image { max-height: 210px; } }
.car-fallback { width: 100%; }
.car-visual { width: 100%; max-height: 150px; display: block; margin: 4px auto; }
.vehicle-visual-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.vehicle-visual-body {
  display: grid; grid-template-columns: minmax(280px, 380px) minmax(0, 1fr);
  gap: 18px; align-items: center;
}
.vehicle-spec-list { margin: 0; display: grid; gap: 8px; }
.vehicle-spec-list div {
  display: grid; grid-template-columns: 150px minmax(0, 1fr);
  gap: 10px; align-items: baseline;
}
.vehicle-spec-list dt {
  color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .05em;
  /* A hosszú címke (pl. „Elérhető nettó kapacitás”) törjön, ne csússzon a
     érték alá. */
  white-space: normal; overflow-wrap: anywhere;
}
@media (max-width: 700px) {
  .vehicle-spec-list div { grid-template-columns: minmax(0, 1fr); gap: 2px; }
}
.vehicle-spec-list dd { margin: 0; font-size: 14px; font-weight: 600; overflow-wrap: anywhere; }
.vehicle-visual-image { min-width: 0; }
@media (max-width: 700px) { .vehicle-visual-body { grid-template-columns: minmax(0, 1fr); } }
.metrics { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.metrics > div, .stat { min-width: 0; }
.metrics strong, .stat strong { font-size: 22px; display: block; overflow-wrap: anywhere; }
.metric-label { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .05em; }
.stat strong { margin-top: 4px; }
.pill {
  display: inline-block; padding: 3px 9px; border-radius: 6px;
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
  white-space: nowrap;
  background: rgba(127,127,127,.15); color: var(--muted);
}
.pill.online, .pill.charging { background: rgba(31,111,235,.15); color: var(--accent-2); }
.pill.charged { background: rgba(26,127,55,.16); color: var(--ok); }
.pill.asleep, .pill.offline { background: rgba(127,127,127,.15); }
.pill.info { background: rgba(31,111,235,.15); color: var(--accent-2); }
.pill.warning { background: rgba(178,106,0,.16); color: var(--warn); }
.pill.critical { background: rgba(180,35,24,.16); color: var(--crit); }
.button, button {
  display: inline-block; border: 1px solid var(--line); background: var(--panel); color: var(--text);
  padding: 6px 12px; border-radius: 4px; font: inherit; font-size: 13px; font-weight: 600; cursor: pointer;
}
.button:hover, button:hover { border-color: var(--accent-2); text-decoration: none; }
button.primary { background: var(--accent-2); border-color: var(--accent-2); color: #fff; }
button.ghost { background: transparent; }
button.danger { background: var(--crit); border-color: var(--crit); color: #fff; }
button.danger-ghost {
  background: transparent; border-color: var(--crit); color: var(--crit);
  padding: 5px 10px; font-size: 12px;
}
table.align-middle td, table.align-middle th { vertical-align: middle; }
button.link { border: 0; background: none; color: var(--accent-2); padding: 0; }
.stack { display: flex; flex-direction: column; gap: 12px; }
/* Egy sorban álló űrlap: a címkék a mezők felett, a mezők és a gomb alja
   egy vonalban (a .inline középre igazítása elcsúsztatta a gombot). */
.invite-create { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; }
.invite-create label { margin: 0; }
.invite-create input { margin: 0; }
.invite-create .note { flex: 1 1 220px; max-width: 320px; }
.invite-create .uses { flex: 0 0 110px; }
.invite-create .expiry { flex: 0 0 120px; }
/* A létrehozás gomb a kártya jobb szélén: a mezők után maradó helyet
   a gomb foglalja el (a sor balra igazított marad). */
.invite-create button { margin: 0 0 0 auto; }
@media (max-width: 600px) {
  .invite-create .note, .invite-create .uses, .invite-create .expiry { flex: 1 1 100%; max-width: none; }
}
.form-rows { display: flex; flex-direction: column; gap: 10px; }
.form-row {
  display: grid;
  grid-template-columns: 160px minmax(0, 1fr);
  align-items: center;
  gap: 8px 14px;
}
.form-row label { margin: 0; color: var(--muted); font-size: 13px; }
.form-row input { margin: 0; }
@media (max-width: 700px) {
  .form-row { grid-template-columns: 1fr; }
}
.card-head + .form-rows { margin-top: 14px; }
.settings-cards { display: flex; flex-direction: column; gap: 18px; }
.settings-cards .grid { margin-bottom: 0; }
.subcard { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }
.subcard h3 {
  font-size: 12px; margin: 0 0 10px; color: var(--muted);
  text-transform: uppercase; letter-spacing: .05em;
}
.vehicle-access-list { list-style: none; margin: 0; padding: 0; }
.vehicle-access-list li {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 12px; padding: 8px 0; border-top: 1px solid var(--line);
}
.vehicle-access-list li:first-child { border-top: 0; padding-top: 0; }
.vehicle-access-name { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 10px; min-width: 0; }
.vehicle-access-name strong { overflow-wrap: anywhere; }


label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; color: var(--muted); }
input, select, textarea {
  font: inherit; color: var(--text); background: var(--bg);
  border: 1px solid var(--line); border-radius: 6px; padding: 10px 12px;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent-2); outline-offset: 1px; }
.auth-card { max-width: 420px; margin: 8vh auto; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 28px; box-shadow: var(--shadow); }
.auth-card h1 { font-size: 22px; }
.alert { padding: 10px 12px; border-radius: 6px; margin-bottom: 12px; font-size: 13px; }
.alert.error { background: rgba(180,35,24,.12); color: var(--crit); }
.alert.success { background: rgba(26,127,55,.12); color: var(--ok); }
.alert.warning { background: rgba(178,106,0,.14); color: var(--warn); }
.alert.info { background: rgba(31,111,235,.12); color: var(--accent-2); }
.command-alert { display: flex; align-items: flex-start; gap: 10px; }
.command-alert > div { min-width: 0; }
.command-alert .alert-icon {
  flex: 0 0 auto; width: 22px; height: 22px; border-radius: 50%;
  display: grid; place-items: center; font-size: 13px; font-weight: 700;
}
.alert.success .alert-icon { background: rgba(31,122,61,.18); color: var(--ok); }
.alert.error .alert-icon { background: rgba(179,38,30,.18); color: var(--crit); }
.alert.warning .alert-icon { background: rgba(168,98,10,.18); color: var(--warn); }
.pairing {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
  margin: 14px 0;
}
.pairing-qr {
  width: 184px;
  flex: 0 0 auto;
  background: #fff;
  padding: 14px;
  border-radius: 6px;
  border: 1px solid var(--line);
  box-shadow: 0 1px 2px rgba(0, 0, 0, .08), 0 8px 24px rgba(0, 0, 0, .08);
}
.pairing-qr svg {
  width: 100%;
  height: auto;
  display: block;
  shape-rendering: crispEdges;
}
.pairing-info { min-width: 200px; flex: 1 1 240px; }
.pairing-info p { margin: 0 0 6px; }
.pairing-info p:first-child { font-weight: 600; }
.pairing-info a { word-break: break-all; }
/* Rendszerállapot: host-erőforrások a fejléc jobb végén, és a
   függőség-jelzők a szolgáltatás-kártya tetején. */
.host-stats { display: flex; gap: 26px; flex-wrap: wrap; align-items: flex-start; }
.host-stat { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.host-stat strong { font-size: 18px; line-height: 1.2; white-space: nowrap; }
/* A frissített érték rövid villanása: látszik, hogy az adat él. */
@keyframes metric-flash {
  from { background-color: rgba(31, 111, 235, .18); }
  to { background-color: transparent; }
}
.metric-flash { animation: metric-flash .9s ease-out; border-radius: 4px; }
.table-wrap { width: 100%; max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table-wrap table { min-width: 560px; }
.table-wrap th { white-space: nowrap; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 9px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .04em; }
tr:last-child td { border-bottom: 0; }
/* Numeric/status columns hug the right edge; action buttons always do. */
td.align-right, th.align-right { text-align: right; }
td.table-actions { text-align: right; white-space: nowrap; }
td.table-actions .inline { justify-content: flex-end; }
.table-filter { max-width: 320px; }
.table-filter input { width: 100%; }
.email-input { min-width: 210px; }
/* Felugró ablak (pl. MFA QR): középre, a lap rácsát nem bontja. */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 200; display: flex;
  align-items: center; justify-content: center; padding: 16px;
  background: rgba(0, 0, 0, .62); overflow-y: auto;
}
.modal-backdrop[hidden] { display: none; }
.modal-backdrop .modal-box { max-width: 460px; width: 100%; max-height: 92vh; overflow: auto; }
.mfa-qr { display: block; width: 200px; max-width: 100%; border-radius: 10px; background: #fff; padding: 8px; margin: 10px 0; }
.map { width: 100%; height: 300px; border-radius: 6px; overflow: hidden; border: 1px solid var(--line); background: var(--bg); }
.map-modal-panel { padding: 18px; }
.entity-chart {
  height: 150px;
  margin-top: 8px;
}

.map-modal-map { flex: 1 1 auto; width: 100%; min-height: 0; height: auto; }
#map-modal .card-modal-panel h2 { margin-right: 42px; }
.map-attribution { margin: 4px 2px 0; text-align: right; font-size: 10px; line-height: 1.3; color: var(--muted); }
.map-attribution a { color: inherit; text-decoration: underline; }
.chart { width: 100%; height: 300px; }
.consumption-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(150px, 100%), 1fr));
  gap: 10px;
  margin: 12px 0;
}
.consumption-metric {
  background: var(--bg); border: 1px solid var(--line); border-radius: 6px;
  padding: 10px 12px; min-width: 0;
}
.consumption-metric strong { display: block; font-size: 19px; overflow-wrap: anywhere; }
.consumption-metric small { font-size: 11px; color: var(--muted); font-weight: 600; }
.consumption-metric .metric-label {
  display: block; font-size: 11px; color: var(--muted);
  text-transform: uppercase; letter-spacing: .03em;
}
.consumption-panels {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px; margin-top: 12px;
}
.consumption-panels h3 { margin: 0 0 6px; font-size: 14px; color: var(--muted); }
.consumption-panels > div { min-width: 0; }
.consumption-panels .chart { height: 280px; }
@media (max-width: 900px) {
  .consumption-panels { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 700px) {
  .consumption-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .consumption-panels .chart { height: 250px; }
}
.status-strip {
  display: flex; gap: 1px; height: 8px; margin: 10px 0 6px;
  border-radius: 6px; overflow: hidden; background: var(--line);
}
.status-seg { flex: 1 1 0; min-width: 1px; background: var(--muted); opacity: .35; }
.status-seg.online { background: var(--ok); opacity: 1; }
.status-seg.charging { background: var(--accent-2); opacity: 1; }
.status-seg.offline { background: var(--muted); opacity: .35; }
.status-legend { display: flex; align-items: center; gap: 12px; margin-bottom: 6px; }
.status-dot {
  display: inline-block; width: 8px; height: 8px; border-radius: 50%;
  margin-right: 4px; background: var(--muted); opacity: .35;
}
.status-dot.online { background: var(--ok); opacity: 1; }
.status-dot.charging { background: var(--accent-2); opacity: 1; }
.status-dot.offline { background: var(--muted); opacity: .35; }
.wizard-step .card-head { margin-bottom: 14px; }
.wizard-step.compact { padding: 12px 18px; }
.wizard-step.compact h2 { font-size: 15px; color: var(--muted); }
.wizard-step.compact .card-head { margin-bottom: 0; }
.footer { max-width: 1280px; margin: 0 auto; padding: 18px 28px 32px; display: flex; justify-content: space-between; gap: 8px 18px; flex-wrap: wrap; color: var(--muted); font-size: 12px; }
.inline { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }
label.check { flex-direction: row; align-items: center; gap: 5px; font-weight: 400; }
select { padding: 6px 8px; }
.changelog h2 { font-size: 18px; margin-top: 22px; border-bottom: 1px solid var(--line); padding-bottom: 6px; }
.changelog h2:first-child { margin-top: 0; }
.changelog ul { padding-left: 22px; }
.changelog code { background: var(--bg); border: 1px solid var(--line); border-radius: 3px; padding: 1px 5px; font-size: 12px; }
details { margin-top: 12px; }
summary { cursor: pointer; color: var(--accent-2); font-size: 13px; font-weight: 600; }

/* Full-screen card modal (in-page, not window.open, so popup blockers do not apply). */
.card-modal {
  position: fixed; inset: 0; z-index: 1000;
  display: grid; place-items: center; padding: 2vh 2vw;
}
.card-modal[hidden] { display: none; }
.card-modal-backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, .62); }
.card-modal-panel {
  position: relative; z-index: 1;
  width: min(1500px, 96vw); height: 92vh; padding: 18px;
  display: flex; flex-direction: column;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
}
.card-modal-close {
  position: absolute; top: 8px; right: 10px; z-index: 2;
  width: 32px; height: 32px; padding: 0; border-radius: 6px;
  border: 1px solid var(--line); background: var(--panel); color: var(--text);
  font-size: 20px; line-height: 1; cursor: pointer;
}
#card-modal-slot {
  flex: 1 1 auto; min-height: 0;
  display: flex; flex-direction: column;
}
.card-modal-card {
  flex: 1 1 auto; min-height: 0; overflow: auto;
  display: flex; flex-direction: column;
}
.card-modal-card .map, .card-modal-card .chart {
  flex: 1 1 auto; height: auto; min-height: 0;
}
body.modal-open { overflow: hidden; }

/* Phone layout: keep every card and chart inside the viewport. */
.dashboard-visual-card, .dashboard-map, .dashboard-chart { min-width: 0; }
@media (max-width: 700px) {
  main { padding: 16px; }
  .card { padding: 14px; }
  .topbar { padding: 12px 16px; gap: 12px; }
  .userbox { flex-wrap: wrap; gap: 8px; }
  .page-head { align-items: flex-start; }
  .footer { padding: 14px 16px 24px; }
  .dashboard-visual-card { min-height: 0; }
  .dashboard-map { min-height: 320px; }
  .dashboard-chart { min-height: 360px; }
  .metrics strong, .stat strong { font-size: 20px; }
  .auth-card { padding: 20px; margin: 4vh auto; }
}
@media (max-width: 420px) {
  main { padding: 12px; }
  .card { padding: 12px; }
  .metrics { gap: 8px; }
  .metrics strong, .stat strong { font-size: 18px; }
  .topbar { gap: 8px; }
  .brand small { display: none; }
}

/* --- QR device approval -------------------------------------------------- */
.device-code { font-size: 24px; letter-spacing: 0.12em; }
.device-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.device-actions button { flex: 1 1 160px; min-height: 48px; }
.device-video { width: 100%; max-height: 320px; background: #000; border-radius: 6px; margin-bottom: 10px; }

/* Toggle switch (Tesla-stílus: szögletes, lapos) */
.switch { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; user-select: none; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch-track {
  position: relative; display: inline-block; width: 40px; height: 22px;
  border-radius: 4px; background: var(--line); transition: background .15s ease;
  flex: 0 0 auto;
}
.switch-thumb {
  position: absolute; top: 3px; left: 3px; width: 16px; height: 16px;
  border-radius: 3px; background: var(--panel); transition: transform .15s ease;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .35);
}
.switch input:checked + .switch-track { background: var(--accent); }
.switch input:checked + .switch-track .switch-thumb { transform: translateX(18px); }
.switch input:focus-visible + .switch-track { outline: 2px solid var(--accent-2); outline-offset: 2px; }
.switch input:disabled + .switch-track { opacity: .5; }

.nav-badge {
  display: inline-block; min-width: 18px; margin-left: 6px; padding: 0 5px;
  border-radius: 999px; background: var(--crit); color: #fff;
  font-size: 11px; font-weight: 700; line-height: 18px; text-align: center;
}
.feedback-message { white-space: pre-wrap; }
.feedback-thread { list-style: none; margin: 0 0 16px; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.feedback-message-block { padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); }
.feedback-message-block.admin { border-left: 3px solid var(--accent-2); }
.feedback-message-block.user { border-left: 3px solid var(--muted); }
.feedback-image { display: block; max-width: 100%; max-height: 360px; border: 1px solid var(--line); border-radius: 8px; }
.push-vehicle-row {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  padding: 8px 0; border-top: 1px solid var(--line);
}
.push-vehicle-row > span:first-child { min-width: 140px; font-weight: 600; }
.invite-create .invite-email { flex: 1 1 240px; max-width: 320px; }
@media (max-width: 600px) {
  .invite-create .invite-email { flex: 1 1 100%; max-width: none; }
}
/* --- Jármű-parancsok kártya ---------------------------------------------
   Nagy gombcsempék a műveletekhez, szegmentált kapcsoló a be/ki pároknak,
   és külön sor az érték-beállítóknak. A funkció változatlan: minden csempe
   és kapcsoló-fél ugyanazt a POST /vehicles/<id>/command útvonalat hívja. */
.cmd-section { margin-top: 20px; }
.cmd-group-title {
  margin: 0 0 8px; font-size: 11px; font-weight: 700; letter-spacing: .08em;
  text-transform: uppercase; color: var(--muted);
}
.cmd-grid {
  display: grid; gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(min(148px, 100%), 1fr));
}
/* A form ne vegyen részt a rácsban: a gomb legyen a rács-elem. */
.cmd-form { display: contents; }
.cmd-btn {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px;
  width: 100%; min-height: 86px; padding: 14px 16px; margin: 0;
  border: 1px solid var(--line); border-radius: 10px;
  background: var(--panel); color: var(--text); text-align: left;
  font-size: 13px; cursor: pointer;
  transition: border-color .15s, box-shadow .15s, transform .06s;
}
.cmd-btn:hover { border-color: var(--accent-2); box-shadow: var(--shadow); }
.cmd-btn:active { transform: translateY(1px); }
.cmd-btn:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 2px; }
.cmd-btn .cmd-ico { width: 24px; height: 24px; margin-bottom: 6px; color: var(--accent-2); }
.cmd-btn.warn .cmd-ico { color: var(--warn); }
.cmd-btn-label { font-size: 15px; font-weight: 700; overflow-wrap: anywhere; }
.cmd-btn-hint { font-size: 12px; font-weight: 400; color: var(--muted); line-height: 1.35; overflow-wrap: anywhere; }

.cmd-switches {
  display: grid; gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(min(230px, 100%), 1fr));
}
.cmd-switch {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 12px;
  min-height: 58px; padding: 10px 12px 10px 14px;
  border: 1px solid var(--line); border-radius: 10px; background: var(--panel);
}
.cmd-switch-name {
  display: inline-flex; align-items: center; gap: 9px;
  font-size: 14px; font-weight: 600;
}
.cmd-switch-name .cmd-ico { width: 19px; height: 19px; color: var(--muted); }
.seg {
  display: inline-flex; flex: 0 0 auto; gap: 2px; padding: 3px; border-radius: 9px;
  background: rgba(127, 127, 127, .16);
}
.seg button {
  min-width: 52px; min-height: 34px; padding: 0 14px; margin: 0;
  border: 0; border-radius: 7px; background: transparent; color: var(--muted);
  font-size: 13px; font-weight: 700; cursor: pointer;
  transition: background .15s, color .15s, box-shadow .15s;
}
.seg button:hover { color: var(--text); border: 0; }
/* Az aktív fél a tényleges állapotot mutatja (mért adat); ha nincs adat,
   egyik fél sem emelt — a kapcsoló ilyenkor nem hazudik. */
.seg button.is-active {
  background: var(--panel); color: var(--text);
  box-shadow: 0 1px 2px rgba(16, 24, 40, .22);
}
.seg button.seg-on.is-active { color: var(--ok); }

.cmd-values {
  display: grid; gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(min(280px, 100%), 1fr));
}
.cmd-value {
  display: flex; align-items: flex-end; gap: 12px; margin: 0;
  padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--panel);
}
.cmd-value label { flex: 1 1 auto; margin: 0; font-weight: 600; }
.cmd-value input { margin: 0; min-height: 40px; }
.cmd-value button { min-height: 40px; padding: 0 18px; font-size: 14px; }
@media (max-width: 480px) {
  .cmd-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cmd-btn { min-height: 78px; padding: 12px; }
  .cmd-value { flex-direction: column; align-items: stretch; }
}

/* --- Kezdőoldali járműparancsok: kompakt méret --------------------------
   A jármű részletes nézet nagy csempéi itt széthúzták a szomszédos
   grafikont; a kezdőoldalon kisebb csempék, kapcsolók és érték-sorok élnek. */
.dashboard-commands .cmd-section { margin-top: 14px; }
.dashboard-commands .cmd-group-title { margin-bottom: 6px; }
.dashboard-commands .cmd-grid {
  gap: 8px;
  /* auto-fill: az üres sávok megmaradnak, így minden csempe azonos
     szélességű, és a rövidebb sor is balra zár. */
  grid-template-columns: repeat(auto-fill, minmax(min(124px, 100%), 1fr));
}
.dashboard-commands .cmd-btn {
  min-height: 52px; padding: 8px 10px; border-radius: 8px; gap: 1px;
}
.dashboard-commands .cmd-btn .cmd-ico { width: 17px; height: 17px; margin-bottom: 2px; }
.dashboard-commands .cmd-btn-label { font-size: 12.5px; }
.dashboard-commands .cmd-btn-hint { font-size: 11px; }
.dashboard-commands .cmd-switches {
  gap: 8px;
  grid-template-columns: repeat(auto-fit, minmax(min(190px, 100%), 1fr));
}
.dashboard-commands .cmd-switch {
  min-height: 44px; padding: 6px 8px 6px 10px; border-radius: 8px;
}
.dashboard-commands .cmd-switch-name { font-size: 13px; gap: 7px; }
.dashboard-commands .cmd-switch-name .cmd-ico { width: 16px; height: 16px; }
.dashboard-commands .seg { padding: 2px; border-radius: 7px; }
.dashboard-commands .seg button {
  min-width: 38px; min-height: 28px; padding: 0 9px; font-size: 12px;
  border-radius: 6px;
}
.dashboard-commands .cmd-values {
  gap: 8px;
  grid-template-columns: repeat(auto-fit, minmax(min(200px, 100%), 1fr));
}
.dashboard-commands .cmd-value {
  padding: 8px 10px; gap: 8px; border-radius: 8px;
}
.dashboard-commands .cmd-value label { font-size: 12px; gap: 4px; }
.dashboard-commands .cmd-value select,
.dashboard-commands .cmd-value input { min-height: 32px; padding: 4px 8px; }
.dashboard-commands .cmd-value button {
  min-height: 32px; padding: 0 12px; font-size: 12px;
}

/* A kapcsolók és az értékek két hasábba rendezve (teljes szélességű kártyán);
   szűk kijelzőn egymás alá kerülnek. */
.dashboard-commands .cmd-two-col {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px;
}
/* Mindkét hasáb a maga teljes magasságát töltse ki: a kapcsolók alatt ne
   maradjon üres hely, ha az érték-oszlop magasabb (és fordítva). */
.dashboard-commands .cmd-two-col > div {
  display: flex; flex-direction: column; min-width: 0;
}
.dashboard-commands .cmd-two-col .cmd-switches,
.dashboard-commands .cmd-two-col .cmd-values {
  flex: 1 1 auto;
  align-content: stretch;
  grid-auto-rows: 1fr;
  grid-template-columns: minmax(0, 1fr);
}
@media (max-width: 900px) {
  .dashboard-commands .cmd-two-col { grid-template-columns: minmax(0, 1fr); }
}

/* --- Deploy-granularitás -------------------------------------------------
   Ez a stíluslap a UI-hoz tartozik: a megváltoztatása csak a `ui`
   szolgáltatást indítja újra (scripts/deploy_plan.py); a többi app-
   szolgáltatás a saját következő deploy-jáig változatlan image-en fut. */
