/* Global HTML hidden must win over card display rules. */
[hidden] { display: none !important; }
.mos-card[aria-hidden="true"] { display: none !important; }

:root {
  color-scheme: light;
  --page: #eef3f8;
  --surface: rgba(255, 255, 255, 0.58);
  --surface-strong: rgba(255, 255, 255, 0.78);
  --surface-soft: rgba(255, 255, 255, 0.36);
  --ink: #111827;
  --muted: #697386;
  --subtle: #9aa4b5;
  --line: rgba(59, 74, 99, 0.14);
  --blue: #0a84ff;
  --green: #22c55e;
  --orange: #ff9f0a;
  --red: #ff375f;
  --purple: #8f62ff;
  --glass-highlight: rgba(255, 255, 255, 0.74);
  --glass-lowlight: rgba(255, 255, 255, 0.18);
  --glass-gradient: linear-gradient(145deg, rgba(255, 255, 255, 0.72), rgba(255, 255, 255, 0.32) 58%, rgba(255, 255, 255, 0.2));
  --glass-inner: linear-gradient(180deg, rgba(255, 255, 255, 0.4), rgba(255, 255, 255, 0.12));
  --tile: rgba(255, 255, 255, 0.46);
  --tile-gradient: linear-gradient(145deg, rgba(255, 255, 255, 0.62), rgba(255, 255, 255, 0.22) 58%, rgba(255, 255, 255, 0.12));
  --tile-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.72), inset 0 0 0 1px rgba(255, 255, 255, 0.34), 0 9px 22px rgba(31, 41, 55, 0.08);
  --accent-glow: 0 16px 36px rgba(10, 132, 255, 0.14);
  --shadow: 0 24px 60px rgba(31, 41, 55, 0.15), 0 2px 10px rgba(31, 41, 55, 0.06);
  --soft-shadow: 0 12px 30px rgba(31, 41, 55, 0.1);
  --hairline: inset 0 1px 0 var(--glass-highlight), inset 0 -1px 0 rgba(255, 255, 255, 0.18), inset 0 0 0 1px var(--line);
  --blur: blur(28px) saturate(1.45);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  color: var(--ink);
  background:
    radial-gradient(circle at 16% 6%, rgba(255, 255, 255, 0.92), transparent 24%),
    radial-gradient(circle at 86% 14%, rgba(10, 132, 255, 0.26), transparent 32%),
    radial-gradient(circle at 12% 78%, rgba(34, 197, 94, 0.14), transparent 30%),
    linear-gradient(145deg, rgba(143, 98, 255, 0.1), transparent 38%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.76), transparent 390px),
    var(--page);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Arial, "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: geometricPrecision;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    linear-gradient(115deg, transparent 0 28%, rgba(255, 255, 255, 0.34) 44%, transparent 62%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.22), transparent 42%),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.1) 0 1px, transparent 1px 18px);
  opacity: 0.5;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.phone-shell {
  width: min(100%, 480px);
  min-height: 100vh;
  margin: 0 auto;
  padding: max(10px, env(safe-area-inset-top)) 12px max(20px, env(safe-area-inset-bottom));
}

.app-header {
  min-height: 64px;
  padding: 6px 2px 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.app-header > div:first-child {
  min-width: 0;
}

.eyebrow {
  margin: 0 0 3px;
  color: var(--blue);
  font-size: 10px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: min(420px, calc(100vw - 104px));
  white-space: nowrap;
  overflow: hidden;
}

.eyebrow span {
  flex: 0 0 auto;
}

.eyebrow #bleTrafficText {
  color: var(--muted);
  font-weight: 620;
  font-variant-numeric: tabular-nums;
}

.realtime-inline {
  min-width: 0;
  flex: 1 1 auto;
  color: color-mix(in srgb, var(--muted) 82%, var(--ink));
  font-weight: 580;
  font-variant-numeric: tabular-nums;
  overflow: hidden;
  text-overflow: ellipsis;
}

.app-header h1 {
  margin: 0;
  max-width: min(290px, calc(100vw - 108px));
  font-size: 18px;
  line-height: 1.06;
  font-weight: 650;
  letter-spacing: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 7px;
}

.icon-button,
.small-icon {
  border: 0;
  display: grid;
  place-items: center;
  color: var(--ink);
  background: var(--glass-gradient);
  box-shadow: var(--hairline), var(--soft-shadow), var(--accent-glow);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
}

.icon-button {
  width: 34px;
  height: 34px;
  border-radius: 50%;
}

.icon-button svg,
.small-icon svg {
  width: 17px;
  height: 17px;
  stroke-width: 2.2;
}

.content {
  display: grid;
  gap: 10px;
}

.status-strip,
.hero-card,
.voltage-card,
.mos-card,
.data-card,
.temperature-card,
.cells-card,
.setting-group {
  background: var(--glass-gradient);
  box-shadow: var(--hairline), var(--shadow), 0 1px 0 rgba(255, 255, 255, 0.18);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
}

.status-strip {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(48px, 0.72fr) minmax(48px, 0.72fr);
  gap: 5px;
  border-radius: 14px;
  padding: 3px;
  align-items: center;
}

.compact-status-strip {
  margin-top: -2px;
}

.server-clock-tile {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 4px 7px;
  min-height: 26px;
  border-radius: 11px;
  background:
    var(--glass-inner),
    var(--tile);
  box-shadow: var(--tile-shadow);
  overflow: hidden;
}

.server-clock-grid {
  display: contents;
}

.server-clock-pair {
  min-width: 0;
  display: inline-flex;
  align-items: baseline;
  gap: 3px;
  white-space: nowrap;
}

.server-clock-pair em {
  color: var(--muted);
  font-style: normal;
  font-size: 9px;
  line-height: 1;
  font-weight: 680;
  letter-spacing: 0.03em;
}

.server-clock-pair strong {
  min-width: 0;
  color: var(--ink);
  font-size: 10px;
  line-height: 1;
  font-weight: 680;
  overflow: hidden;
  text-overflow: ellipsis;
}

.server-clock-separator {
  display: inline-block;
  color: var(--muted);
  font-size: 10px;
  line-height: 1;
  opacity: 0.55;
}

.server-clock-item {
  min-width: 0;
}

.server-clock-tile > small {
  display: none;
}

.status-strip > div {
  min-width: 0;
  padding: 4px 6px;
  min-height: 26px;
  border-radius: 11px;
  background:
    var(--glass-inner),
    var(--tile);
  box-shadow: var(--tile-shadow);
  overflow: hidden;
}

.compact-device-state {
  display: flex;
  align-items: center;
  gap: 4px;
}

.status-strip span,
.hero-values span,
.voltage-strip span,
.mos-card span,
.temperature-list span,
.section-title span {
  display: block;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.25;
  font-weight: 520;
}

.status-strip > .compact-device-state > span {
  display: inline-block;
  flex: 0 0 auto;
  font-size: 9px;
  line-height: 1;
  font-weight: 680;
  letter-spacing: 0.03em;
}

#balanceSummary {
  max-width: 68%;
  word-break: break-word;
}

.status-strip strong {
  display: inline-block;
  margin-top: 0;
  min-width: 0;
  color: var(--ink);
  font-size: 10px;
  line-height: 1;
  font-weight: 680;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.status-strip > div:last-child strong {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.status-strip small {
  display: none;
}


@media (max-width: 420px) {
  .status-strip {
    grid-template-columns: minmax(0, 1fr) minmax(43px, 0.48fr) minmax(43px, 0.48fr);
    gap: 4px;
    padding: 2px;
  }

  .server-clock-tile {
    gap: 4px;
    padding-inline: 6px;
  }

  .server-clock-pair em,
  .status-strip > .compact-device-state > span {
    font-size: 8px;
  }

  .server-clock-pair strong,
  .status-strip strong {
    font-size: 9px;
  }
}

.hero-card {
  min-height: 204px;
  padding: 9px;
  border-radius: 24px;
  display: grid;
  grid-template-columns: 116px 1fr;
  gap: 9px;
  align-items: center;
  overflow: visible;
}

.pack-summary {
  height: 100%;
  padding: 13px 9px 11px;
  display: grid;
  align-content: center;
  justify-items: center;
  border-radius: 20px;
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--blue) 7%, transparent), transparent 58%),
    var(--tile-gradient),
    var(--tile);
  box-shadow: var(--tile-shadow);
}

.summary-title {
  width: 100%;
  margin-bottom: 9px;
  font-size: 14px;
  font-weight: 650;
  text-align: left;
}

.soc-ring {
  --size: 84px;
  width: var(--size);
  height: var(--size);
  border-radius: 50%;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at center, var(--surface-strong) 57%, transparent 58%),
    conic-gradient(var(--blue) calc(var(--soc) * 1turn), rgba(127, 135, 149, 0.18) 0);
  box-shadow:
    inset 0 1px 0 var(--glass-highlight),
    inset 0 0 0 1px color-mix(in srgb, var(--blue) 12%, var(--line));
}

.soc-inner {
  color: var(--blue);
  display: flex;
  align-items: baseline;
  gap: 2px;
}

.soc-inner span {
  font-size: 25px;
  line-height: 1;
  font-weight: 560;
}

.soc-inner small {
  font-size: 12px;
  font-weight: 540;
}

.hero-info {
  height: 100%;
  min-width: 0;
}

.chemistry {
  font-size: 18px;
  line-height: 1.2;
  font-weight: 650;
}

.connection-pill {
  width: fit-content;
  max-width: 100%;
  margin: 8px 0 13px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--blue);
  background:
    linear-gradient(180deg, color-mix(in srgb, white 22%, transparent), transparent),
    color-mix(in srgb, var(--blue) 12%, transparent);
  border-radius: 999px;
  padding: 7px 10px;
  font-size: 12px;
  line-height: 1;
  font-weight: 590;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--blue) 18%, transparent);
}

.connection-pill svg {
  width: 15px;
  height: 15px;
}

.hero-values {
  display: grid;
  height: 100%;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.hero-values div {
  min-width: 0;
  display: grid;
  align-content: center;
  justify-items: center;
  min-height: 43px;
  padding: 6px 8px;
  border-radius: 16px;
  background:
    linear-gradient(145deg, color-mix(in srgb, var(--surface-strong) 72%, transparent), color-mix(in srgb, var(--surface-soft) 62%, transparent)),
    linear-gradient(135deg, color-mix(in srgb, var(--blue) 3%, transparent), transparent 72%),
    var(--tile);
  box-shadow:
    inset 0 1px 0 color-mix(in srgb, var(--glass-highlight) 72%, transparent),
    inset 0 0 0 1px color-mix(in srgb, var(--line) 82%, transparent),
    0 7px 18px color-mix(in srgb, var(--ink) 5%, transparent);
}

.hero-values strong {
  display: block;
  margin-top: 2px;
  color: var(--ink);
  font-size: 13px;
  line-height: 1.15;
  font-weight: 650;
  white-space: nowrap;
  text-align: center;
}

.hero-values b {
  font-size: 15px;
  font-weight: 680;
}

.connect-time {
  display: block;
  margin-top: 0;
  color: var(--ink);
  font-size: 12px;
  line-height: 1.35;
  font-weight: 650;
  text-align: center;
}

.connect-time b {
  font-weight: 620;
}

.version-line {
  display: block;
  width: 100%;
  margin-top: 0;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.2;
  font-weight: 560;
  text-align: center;
}

.version-line b {
  display: block;
  margin-top: 1px;
  color: var(--subtle);
  font-weight: 560;
  line-height: 1.18;
  white-space: pre-line;
  word-break: keep-all;
}

#batteryStatus {
  font-variant-numeric: tabular-nums;
  font-weight: 660;
}

#batteryStatus[data-state="charge"],
#batteryStatus[data-state="charging"] {
  color: var(--green);
}

#batteryStatus[data-state="discharge"] {
  color: var(--orange);
}

#batteryStatus[data-state="standby"],
#batteryStatus[data-state="idle"] {
  color: var(--blue);
}

#batteryStatus[data-state="error"] {
  color: var(--red);
}

#batteryStatus[data-state="offline"],
#batteryStatus[data-state="unknown"] {
  color: var(--muted);
}

#batteryStatus[data-state="gps-moving"] {
  color: var(--green);
}

#batteryStatus[data-state="gps-stationary"],
#batteryStatus[data-state="gps-stale"] {
  color: var(--blue);
}

#permissionState {
  font-variant-numeric: tabular-nums;
  font-weight: 660;
}

#permissionState[data-state="unlocked"] {
  color: var(--green);
}

#permissionState[data-state="locked"] {
  color: var(--orange);
}

#permissionState[data-state="unset"],
#permissionState[data-state="waiting"],
#permissionState[data-state="offline"] {
  color: var(--muted);
}

.hidden-metrics {
  display: none;
}

.voltage-card,
.temperature-card,
.data-card,
.cells-card {
  border-radius: 22px;
  padding-bottom: 12px;
}

.location-map-mount {
  margin: 14px 0 4px;
}

.location-map-section,
.location-waiting {
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--card);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.location-waiting {
  min-height: 74px;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.location-waiting span {
  color: var(--muted);
  font-size: 12px;
  flex: 1;
}

.location-map-frame {
  position: relative;
  height: clamp(280px, 48vw, 430px);
  min-height: 280px;
  overflow: hidden;
  touch-action: none;
  overscroll-behavior: contain;
  background: color-mix(in srgb, var(--card) 86%, #cbd5e1);
}

.location-map-canvas {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  pointer-events: auto;
  overscroll-behavior: contain;
}

.location-map-canvas > div { width: 100%; height: 100%; }
.location-map-canvas,
.location-map-canvas * { touch-action: none; }

.location-map-status,
.location-map-provider {
  position: absolute;
  z-index: 6;
  top: 10px;
  padding: 5px 9px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--card) 88%, transparent);
  color: var(--text);
  box-shadow: 0 3px 14px rgba(15, 23, 42, .16);
  backdrop-filter: blur(8px);
  font-size: 11px;
  line-height: 1.2;
  pointer-events: none;
}

.location-map-status { left: 10px; }
.location-map-provider {
  right: 10px;
  padding: 4px 7px;
  color: var(--muted);
  font-size: 10px;
}
.location-map-canvas img[src*="/web/jsapi/logo/"],
.admin-location-map-canvas img[src*="/web/jsapi/logo/"] {
  width: auto !important;
  max-width: 91px !important;
  max-height: 13px !important;
}
.location-map-status[data-state="fresh"] { color: var(--green); }
.location-map-status[data-state="stationary"] { color: #2563eb; }
.location-map-status[data-state="delayed"],
.location-map-status[data-state="offline"],
.location-map-status[data-state="paused"] { color: var(--orange); }

.bms4g-vehicle-marker {
  position: relative;
  width: var(--bms4g-vehicle-marker-width, 32px);
  height: var(--bms4g-vehicle-marker-height, 41px);
  pointer-events: none;
  filter:
    drop-shadow(0 0 1px rgba(255, 255, 255, .92))
    drop-shadow(0 3px 7px rgba(71, 85, 105, .28));
}

.bms4g-vehicle-marker-pin {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
  user-select: none;
}

.bms4g-vehicle-marker-glyph {
  position: absolute;
  top: 7%;
  left: 9%;
  display: block;
  width: 82%;
  height: auto;
  aspect-ratio: 1;
  object-fit: contain;
  pointer-events: none;
  user-select: none;
}

.location-map-controls {
  position: absolute;
  z-index: 6;
  right: 10px;
  bottom: 14px;
  display: grid;
  gap: 6px;
  pointer-events: none;
}

.location-map-controls button {
  width: 34px;
  min-width: 34px;
  height: 34px;
  min-height: 34px;
  padding: 0;
  border-radius: 10px;
  border: 1px solid rgba(15, 23, 42, .24);
  background: #ffffff;
  color: #111827;
  box-shadow: 0 4px 16px rgba(15, 23, 42, .28);
  font-size: 20px;
  font-weight: 800;
  line-height: 1;
  text-shadow: none;
  opacity: 1;
  pointer-events: auto;
  touch-action: manipulation;
}

.location-map-controls button:hover,
.location-map-controls button:focus-visible {
  border-color: #2563eb;
  background: #eff6ff;
  color: #1d4ed8;
}

.location-map-controls button:active { background: #dbeafe; }

.location-map-controls .location-recenter {
  width: auto;
  padding: 0 10px;
  font-size: 12px;
  white-space: nowrap;
}

.location-map-error {
  padding: 8px 12px;
  background: color-mix(in srgb, #f59e0b 12%, var(--card));
  color: var(--orange);
  font-size: 12px;
}

.location-map-footer {
  min-height: 44px;
  padding: 8px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 12px;
}

.location-map-footer > span { flex: 1; }
.location-map-footer details { position: relative; }
.location-map-footer summary { cursor: pointer; color: var(--text); }
.location-address-detail { margin: 8px 0 4px; color: var(--text); line-height: 1.5; max-width: min(72vw, 560px); }
.location-coordinate-detail { margin: 7px 0; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; }
.compact-location-toggle,
.compact-location-refresh,
.location-map-footer button { min-height: 30px; padding: 5px 9px; font-size: 12px; }

@media (max-width: 680px) {
  .location-map-frame { height: 310px; min-height: 270px; }
  .location-map-footer { align-items: flex-start; flex-wrap: wrap; }
  .location-map-footer > span { flex-basis: 100%; }
  .location-waiting { align-items: flex-start; flex-wrap: wrap; }
  .vehicle-summary-grid strong { font-size: 14px; }
  .vehicle-summary-grid > div { padding: 10px 9px; }
}

.section-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  padding: 12px 14px 0;
}

.section-title strong {
  font-size: 13px;
  font-weight: 650;
}

.section-title span {
  text-align: right;
}

.voltage-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  padding: 10px 12px 0;
}

.voltage-strip div {
  min-width: 0;
  border-radius: 15px;
  background:
    var(--tile-gradient),
    linear-gradient(135deg, color-mix(in srgb, var(--blue) 5%, transparent), transparent);
  padding: 8px 6px;
  box-shadow: var(--tile-shadow);
}

.voltage-strip strong {
  display: block;
  margin-top: 4px;
  font-size: 12px;
  line-height: 1.1;
  font-weight: 570;
  white-space: nowrap;
}

.voltage-strip small {
  display: inline-grid;
  place-items: center;
  min-width: 18px;
  height: 15px;
  border: 1.5px solid currentColor;
  border-radius: 6px;
  font-size: 10px;
  line-height: 1;
}

.green {
  color: var(--green);
}

.orange {
  color: var(--orange);
}

.red {
  color: var(--red);
}

.purple {
  color: var(--purple);
}

.mos-card {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 9px;
  align-items: center;
  border-radius: 22px;
  padding: 12px 14px;
}

.mos-card[data-tone="warn"] .mos-icon {
  color: var(--orange);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.28), transparent),
    color-mix(in srgb, var(--orange) 14%, transparent);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.32),
    inset 0 0 0 1px color-mix(in srgb, var(--orange) 20%, transparent),
    0 8px 18px color-mix(in srgb, var(--orange) 12%, transparent);
}

.mos-card[data-tone="alarm"] .mos-icon {
  color: var(--red);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.28), transparent),
    color-mix(in srgb, var(--red) 14%, transparent);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.32),
    inset 0 0 0 1px color-mix(in srgb, var(--red) 20%, transparent),
    0 8px 18px color-mix(in srgb, var(--red) 12%, transparent);
}

.mos-card[data-tone="runtime"] .mos-icon {
  color: var(--blue);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.28), transparent),
    color-mix(in srgb, var(--blue) 12%, transparent);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.32),
    inset 0 0 0 1px color-mix(in srgb, var(--blue) 18%, transparent),
    0 8px 18px color-mix(in srgb, var(--blue) 10%, transparent);
}

.runtime-chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 0;
}

.mos-icon {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 15px;
  color: var(--orange);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.28), transparent),
    color-mix(in srgb, var(--orange) 14%, transparent);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.32),
    inset 0 0 0 1px color-mix(in srgb, var(--orange) 20%, transparent),
    0 8px 18px color-mix(in srgb, var(--orange) 12%, transparent);
}

.mos-icon svg {
  width: 18px;
  height: 18px;
}

.mos-state {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.mos-card strong {
  display: block;
  color: var(--ink);
  font-size: 13px;
  line-height: 1.2;
  font-weight: 580;
}

.mos-card b {
  font-weight: 620;
}

.ios-button {
  border: 0;
  color: #fff;
  background:
    linear-gradient(180deg, color-mix(in srgb, white 22%, transparent), transparent),
    linear-gradient(135deg, color-mix(in srgb, var(--blue) 86%, var(--purple)), var(--blue));
  border-radius: 999px;
  font-weight: 600;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.28),
    0 10px 22px color-mix(in srgb, var(--blue) 22%, transparent);
}

.temperature-list {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
  padding: 10px 12px 0;
}

.temperature-list div {
  min-width: 0;
  border-radius: 15px;
  background:
    var(--tile-gradient),
    var(--tile);
  padding: 7px 4px;
  text-align: center;
  box-shadow: var(--tile-shadow);
}

.temperature-list strong {
  display: block;
  margin-top: 3px;
  font-size: 12px;
  line-height: 1.15;
  font-weight: 560;
  white-space: nowrap;
}

.brand-details-section {
  margin: 2px 12px 0;
  padding: 4px 0 14px;
  border-top: 1px solid color-mix(in srgb, var(--ink) 10%, transparent);
}

.brand-details-section .section-title {
  padding-left: 2px;
  padding-right: 2px;
}

.brand-details-facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: 18px;
  padding-top: 7px;
}

.brand-details-facts > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-width: 0;
  min-height: 34px;
  gap: 8px;
  border-bottom: 1px solid color-mix(in srgb, var(--ink) 7%, transparent);
}

.brand-details-facts span,
.brand-resistance-grid span {
  color: var(--muted);
  font-size: 11px;
}

.brand-details-facts strong,
.brand-resistance-grid strong {
  min-width: 0;
  color: var(--ink);
  font-size: 12px;
  font-weight: 600;
  text-align: right;
}

.brand-details-subtitle {
  padding: 14px 0 5px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
}

.brand-resistance-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 5px 12px;
}

.brand-resistance-grid > div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  min-width: 0;
  gap: 5px;
  padding: 4px 0;
}

.flag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  padding: 10px 12px 0;
}

.flag-chip {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 5px 8px;
  background:
    var(--tile-gradient),
    var(--tile);
  color: var(--ink);
  box-shadow: var(--tile-shadow);
  font-size: 11px;
  line-height: 1.15;
  font-weight: 570;
}

.flag-chip.protect {
  color: var(--red);
  background: color-mix(in srgb, var(--red) 9%, var(--surface-soft));
}

.flag-chip.warn {
  color: var(--orange);
  background: color-mix(in srgb, var(--orange) 10%, var(--surface-soft));
}

.flag-chip.ok {
  color: var(--green);
  background: color-mix(in srgb, var(--green) 10%, var(--surface-soft));
}

.flag-chip.runtime {
  color: var(--blue);
  background: color-mix(in srgb, var(--blue) 9%, var(--surface-soft));
}

.cells-card {
  padding-bottom: 14px;
}

.cells-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 13px 5px;
  padding: 14px 7px 2px;
}

.empty-cells {
  margin: 13px 12px 0;
  padding: 13px;
  border-radius: 16px;
  background:
    var(--tile-gradient),
    var(--tile);
  color: var(--muted);
  font-size: 11px;
  line-height: 1.55;
  text-align: center;
  box-shadow: var(--tile-shadow);
}

.cells-grid:not(:empty) + .empty-cells {
  display: none;
}

.cell {
  min-width: 0;
  min-height: 68px;
  padding: 8px 3px 7px;
  text-align: center;
  background: transparent;
  border-radius: 0;
  box-shadow: none;
}

.battery-icon {
  --level: 0;
  --cell-color: var(--blue);
  width: 28px;
  height: 39px;
  margin: 0 auto 6px;
  border: 2px solid color-mix(in srgb, var(--cell-color) 72%, white);
  border-radius: 7px;
  position: relative;
  display: grid;
  place-items: center;
  overflow: visible;
  color: #fff;
  font-size: 10px;
  font-weight: 560;
  background: color-mix(in srgb, var(--cell-color) 9%, transparent);
  box-shadow:
    0 8px 16px color-mix(in srgb, var(--cell-color) 16%, transparent),
    0 0 0 5px color-mix(in srgb, var(--cell-color) 5%, transparent),
    inset 0 0 0 1px rgba(255, 255, 255, 0.16);
}

.battery-icon::before {
  content: "";
  width: 12px;
  height: 4px;
  border-radius: 4px 4px 0 0;
  background: color-mix(in srgb, var(--cell-color) 72%, white);
  position: absolute;
  top: -6px;
}

.battery-icon::after {
  content: "";
  position: absolute;
  left: 2px;
  right: 2px;
  bottom: 2px;
  height: calc(var(--level) * 1%);
  min-height: 5px;
  border-radius: 4px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--cell-color) 68%, white), var(--cell-color));
  transition: height .36s cubic-bezier(.22, 1, .36, 1), background-color .18s cubic-bezier(.22, 1, .36, 1);
}

.battery-icon span {
  position: relative;
  z-index: 1;
  min-width: 0;
  height: auto;
  display: inline-grid;
  place-items: center;
  color: rgba(255, 255, 255, 0.94);
  text-shadow: 0 1px 3px rgba(17, 24, 39, 0.34);
  font-size: 11px;
  line-height: 1;
}

.cell strong {
  display: block;
  color: var(--ink);
  font-size: 12px;
  line-height: 1.15;
  font-weight: 540;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.cell.normal .battery-icon {
  --cell-color: var(--blue);
}

.cell.low .battery-icon,
.cell.min .battery-icon {
  --cell-color: var(--orange);
}

.cell.max .battery-icon {
  --cell-color: var(--red);
}

.cell.critical .battery-icon,
.cell.max.critical .battery-icon {
  --cell-color: var(--red);
}

.cell.waiting .battery-icon {
  --cell-color: #6f7c91;
  opacity: 0.48;
}

.cell.waiting strong {
  color: var(--subtle);
}

.cell.min strong,
.cell.low strong {
  color: var(--orange);
}

.cell.max strong,
.cell.critical strong {
  color: var(--red);
}

.balance-marker {
  display: flex;
  justify-content: center;
  padding: 8px 12px 2px;
}

.balance-marker[hidden] {
  display: none;
}

.balance-marker-icon {
  --level: 100;
  --cell-color: var(--green);
  width: 42px;
  height: 24px;
  margin: 0;
  color: #fff;
  font-size: 11px;
  font-weight: 720;
  border-radius: 7px;
  background: color-mix(in srgb, var(--cell-color) 12%, transparent);
  box-shadow:
    0 10px 20px color-mix(in srgb, var(--green) 28%, transparent),
    0 0 0 4px color-mix(in srgb, var(--green) 8%, transparent),
    inset 0 0 0 1px rgba(255, 255, 255, 0.18);
}

.balance-marker-icon::before {
  width: 5px;
  height: 10px;
  right: -7px;
  left: auto;
  top: 50%;
  transform: translateY(-50%);
  border-radius: 0 4px 4px 0;
  background: color-mix(in srgb, var(--cell-color) 72%, white);
}

.balance-marker-icon::after {
  left: 2px;
  right: auto;
  top: 2px;
  bottom: 2px;
  width: calc(var(--level) * 1%);
  height: auto;
  min-height: 0;
  max-width: calc(100% - 4px);
  border-radius: 5px;
  background: linear-gradient(90deg, color-mix(in srgb, var(--cell-color) 68%, white), var(--cell-color));
}

.balance-marker-icon span {
  color: rgba(255, 255, 255, 0.96);
  text-shadow: 0 1px 3px rgba(17, 24, 39, 0.36);
}

.settings-sheet {
  position: fixed;
  inset: 0;
  z-index: 8;
  display: none;
  align-items: flex-end;
  background:
    radial-gradient(circle at 50% 100%, rgba(10, 132, 255, 0.16), transparent 34%),
    rgba(8, 10, 14, 0.32);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.service-access-gate {
  position: fixed;
  inset: 0;
  z-index: 7;
  display: grid;
  place-items: center;
  padding: 22px;
  background: var(--page, #f4f6f8);
}

.service-access-gate[hidden] { display: none !important; }

.service-access-card {
  width: min(100%, 390px);
  display: grid;
  gap: 12px;
  justify-items: center;
  padding: 26px 22px;
  border: 1px solid var(--line, #dfe4ea);
  border-radius: 22px;
  background: var(--surface-strong, #fff);
  color: var(--text, #111827);
  box-shadow: 0 18px 54px rgba(15, 23, 42, .14);
  text-align: center;
}

.service-access-icon {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #fff4d6;
  color: #a15c00;
  font-size: 22px;
  font-weight: 900;
}

.service-access-card > strong { font-size: 20px; }
.service-access-card > p { margin: 0; color: var(--muted, #667085); line-height: 1.65; }
.service-access-card > small { color: var(--muted, #667085); line-height: 1.55; }
.service-access-card > .ios-button { width: min(100%, 220px); }
.service-renewal-row {
  width: min(100%, 300px);
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}
.service-renewal-row[hidden] { display: none !important; }
.service-renewal-row input {
  min-width: 0;
  height: 42px;
  padding: 0 12px;
  border: 1px solid var(--line, #dfe4ea);
  border-radius: 12px;
  background: var(--surface, #fff);
  color: var(--text, #111827);
  font: inherit;
}
.service-renewal-row .ios-button {
  width: auto;
  min-width: 76px;
  height: 42px;
}

body.service-access-blocked .bms-bind-guide { display: none !important; }

.settings-sheet.open {
  display: flex;
}

.sheet-panel {
  width: min(100%, 560px);
  max-height: calc(100vh - max(16px, env(safe-area-inset-top)));
  margin: 0 auto;
  overflow: auto;
  background:
    linear-gradient(145deg, var(--surface-strong), var(--surface) 56%, var(--surface-soft)),
    color-mix(in srgb, var(--page) 58%, transparent);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  border-radius: 26px 26px 0 0;
  padding: 8px 11px max(18px, env(safe-area-inset-bottom));
  box-shadow: var(--hairline), 0 -22px 54px rgba(0, 0, 0, 0.2);
}

.sheet-handle {
  width: 36px;
  height: 4px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--muted) 35%, transparent);
  margin: 0 auto 10px;
}

.sheet-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.sheet-title strong {
  font-size: 18px;
  font-weight: 650;
}

.collapsible-setting[hidden] {
  display: none;
}

.wifi-config-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
  gap: 8px;
  align-items: stretch;
}

.network-wifi-toggle {
  margin-top: 12px;
}

.network-wifi-config {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line, rgba(127, 127, 127, .18));
}

.network-wifi-config[hidden] {
  display: none !important;
}

.wifi-config-grid input {
  min-width: 0;
  border: 0;
  outline: 0;
  border-radius: 17px;
  background:
    var(--tile-gradient),
    var(--tile);
  box-shadow: var(--tile-shadow);
  padding: 10px 12px;
  color: var(--ink);
  font-size: 12px;
}

.wifi-config-grid input::placeholder {
  color: var(--subtle);
}

.setting-subhead {
  display: grid;
  gap: 3px;
  margin-top: 14px;
  padding: 0 2px;
}

.setting-subhead strong {
  color: var(--ink);
  font-size: 13px;
  font-weight: 650;
}

.setting-subhead span {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}

.cloud-config-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 8px;
  align-items: stretch;
}

.cloud-config-grid input {
  min-width: 0;
  border: 0;
  outline: 0;
  border-radius: 17px;
  background: var(--tile-gradient), var(--tile);
  box-shadow: var(--tile-shadow);
  padding: 10px 12px;
  color: var(--ink);
  font-size: 12px;
}

.cloud-config-grid input::placeholder {
  color: var(--subtle);
}

.cloud-config-grid .ios-button {
  grid-column: 1 / -1;
}

.setting-hint {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
  padding: 0 2px;
}

.wifi-network-list .network-item strong {
  font-size: 12px;
}

.small-icon {
  width: 30px;
  height: 30px;
  border-radius: 50%;
}

.setting-group {
  border-radius: 22px;
  padding: 12px;
  margin-top: 10px;
  display: grid;
  gap: 10px;
}

.setting-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.setting-head strong {
  display: block;
  font-size: 13px;
  font-weight: 620;
}

.setting-head span {
  display: block;
  color: var(--muted);
  font-size: 10px;
  margin-top: 3px;
}

.ios-button {
  padding: 7px 12px;
  font-size: 12px;
}

.control-permission-line,
.control-operation-line,
.control-switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.control-permission-line {
  padding: 2px 2px 10px;
}

.control-permission-line > div,
.control-switch-row > div {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.control-permission-line span,
.control-operation-line span,
.control-switch-row span,
.control-password-field > label {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}

.control-permission-line strong,
.control-switch-row strong,
.control-operation-line strong {
  color: var(--ink);
  font-size: 14px;
  font-weight: 650;
}

.control-permission-line em {
  max-width: 68%;
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  text-align: right;
}

.control-permission-line em[data-state="unlocked"],
.control-permission-line strong[data-state="unlocked"] {
  color: var(--blue);
}

.control-permission-line em[data-state="locked"] {
  color: var(--orange);
}

.control-password-field {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  margin-top: 2px;
}

.control-password-action {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.control-password-action .ios-button {
  min-height: 38px;
  padding: 8px 11px;
  white-space: nowrap;
}

.control-password-field input,
.control-password-field select {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  border-radius: 17px;
  background:
    var(--tile-gradient),
    var(--tile);
  box-shadow: var(--tile-shadow);
  padding: 10px 12px;
  color: var(--ink);
}

.control-password-field select {
  cursor: pointer;
  text-align: center;
  text-align-last: center;
}

.control-password-field input::placeholder {
  color: var(--subtle);
}

.control-password-field input:focus-visible,
.control-password-field select:focus-visible {
  box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--blue) 62%, transparent);
}

.control-operation-line {
  margin-top: 10px;
  padding: 9px 2px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.control-operation-line strong[data-state="ok"] { color: var(--green); }
.control-operation-line strong[data-state="busy"] { color: var(--orange); }
.control-operation-line strong[data-state="warn"] { color: var(--red); }

.control-switch-list {
  margin-top: 2px;
}

.control-switch-row {
  min-height: 54px;
  padding: 10px 2px;
  border-bottom: 1px solid var(--line);
}

.control-switch-row:last-child {
  border-bottom: 0;
}

.settings-actions {
  margin-top: 10px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.maintenance-actions {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.runtime-group .setting-head span {
  max-width: 270px;
}

.network-list {
  display: grid;
  gap: 9px;
  color: var(--muted);
  font-size: 12px;
  max-height: 260px;
  overflow: auto;
  padding-right: 2px;
}

.network-item {
  border: 0;
  width: 100%;
  min-height: 42px;
  border-radius: 17px;
  background:
    var(--tile-gradient),
    linear-gradient(135deg, color-mix(in srgb, var(--blue) 5%, transparent), var(--surface-soft));
  color: var(--ink);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  text-align: left;
  box-shadow: var(--tile-shadow);
}

.network-note {
  border-radius: 17px;
  background:
    var(--tile-gradient),
    var(--tile);
  color: var(--muted);
  padding: 8px 10px;
  box-shadow: var(--tile-shadow);
}

.saved-target {
  margin-top: 10px;
  padding: 9px 10px;
  border-radius: 17px;
  background:
    var(--tile-gradient),
    var(--tile);
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
  word-break: break-word;
  box-shadow: var(--tile-shadow);
}

.saved-target[hidden] {
  display: none;
}

.saved-target strong {
  display: block;
  color: var(--ink);
  font-size: 12px;
  margin-bottom: 3px;
}

.saved-target-info {
  display: grid;
  gap: 3px;
}

.saved-target-info span {
  display: block;
}

.saved-target-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 9px;
}

.saved-target-actions .ios-button:only-child {
  grid-column: 1 / -1;
}

.manual-ble-bind {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  margin-top: 10px;
}

.manual-ble-bind input {
  min-width: 0;
  border: 0;
  outline: 0;
  border-radius: 17px;
  background: var(--tile-gradient), var(--tile);
  box-shadow: var(--tile-shadow);
  padding: 10px 12px;
  color: var(--ink);
  font: 600 12px/1.2 ui-monospace, SFMono-Regular, Consolas, monospace;
  text-transform: uppercase;
}

.manual-ble-bind[hidden] {
  display: none;
}

.ble-relay-panel {
  margin-top: 10px;
  padding: 10px;
  border-radius: 17px;
  background: var(--tile-gradient), var(--tile);
  box-shadow: var(--tile-shadow);
}

.product-switch {
  position: relative;
  flex: 0 0 46px;
  width: 46px;
  height: 27px;
  min-width: 46px;
  min-height: 27px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-soft);
  box-shadow: inset 0 1px 2px rgba(15, 23, 42, .08);
  transition: background .18s ease, border-color .18s ease, opacity .18s ease;
}

.product-switch > span {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 21px;
  height: 21px;
  margin: 0;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 6px rgba(15, 23, 42, .24);
  transition: transform .18s ease;
}

.ble-relay-name-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  margin-top: 9px;
}

.ble-relay-name-row input {
  min-width: 0;
  border: 0;
  outline: 0;
  border-radius: 14px;
  background: var(--surface-strong);
  box-shadow: inset 0 0 0 1px var(--line);
  padding: 8px 10px;
  color: var(--ink);
}

@media (max-width: 520px) {
  .manual-ble-bind {
    grid-template-columns: minmax(0, 1fr);
  }
  .ble-relay-name-row { grid-template-columns: minmax(0, 1fr); }
}

.network-item.pending {
  opacity: 0.72;
  pointer-events: none;
}

.network-item.connected {
  background:
    var(--glass-inner),
    color-mix(in srgb, var(--green) 12%, var(--surface-soft));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--green) 34%, transparent);
}

.network-item.connected > span {
  color: var(--green);
  font-weight: 680;
}

.network-action {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  white-space: nowrap;
}

.network-action b {
  font-size: 12px;
  font-weight: 680;
}

.ble-signal {
  display: inline-flex !important;
  flex-direction: row !important;
  align-items: center !important;
  gap: 2px;
  height: 8px;
  vertical-align: middle;
}

.ble-signal i {
  display: block;
  width: 8px;
  height: 5px;
  min-width: 8px;
  max-width: 8px;
  min-height: 5px;
  max-height: 5px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--muted) 28%, transparent);
}

.ble-signal i.on {
  background: var(--blue);
}

.network-item strong {
  display: block;
  font-size: 13px;
  font-weight: 610;
}

.network-item span,
.ota-url {
  color: var(--muted);
  font-size: 12px;
}

.ota-url {
  width: 100%;
  border: 0;
  outline: 0;
  border-radius: 17px;
  background:
    var(--tile-gradient),
    var(--tile);
  box-shadow: var(--tile-shadow);
  padding: 10px 12px;
  color: var(--ink);
}

.ota-url {
  margin-top: 12px;
  word-break: break-all;
}

.protocol-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.protocol-item {
  min-width: 0;
  padding: 10px 10px 9px;
  border-radius: 18px;
  background:
    var(--tile-gradient),
    var(--tile);
  box-shadow: var(--tile-shadow);
}

.protocol-item span {
  display: block;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.25;
}

.protocol-item strong {
  display: block;
  margin-top: 4px;
  color: var(--ink);
  font-size: 11px;
  line-height: 1.35;
  word-break: break-word;
}

.protocol-frame {
  min-height: 72px;
  border-radius: 18px;
  background:
    linear-gradient(145deg, color-mix(in srgb, var(--blue) 4%, transparent), transparent 60%),
    var(--tile);
  box-shadow: var(--tile-shadow);
  padding: 10px 12px;
  font-size: 11px;
  line-height: 1.45;
  word-break: break-all;
  max-height: 150px;
  overflow: auto;
}

.protocol-meta {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.log-list {
  display: grid;
  gap: 8px;
  max-height: 300px;
  overflow: auto;
  padding-right: 2px;
}

.log-item {
  border-radius: 17px;
  background:
    var(--tile-gradient),
    var(--tile);
  box-shadow: var(--tile-shadow);
  padding: 10px 12px;
}

.log-item strong {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 620;
}

.log-item strong span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 520;
}

.log-item p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
  word-break: break-word;
}

.log-raw {
  display: block;
  margin-top: 4px;
  color: var(--subtle);
  font-size: 10px;
  line-height: 1.35;
  word-break: break-word;
}

@media (max-width: 380px) {
  .eyebrow {
    gap: 6px;
    font-size: 9.5px;
  }

  .realtime-inline {
    max-width: 150px;
  }
}

.soc-meta {
  min-height: 16px;
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
  font-size: 10px;
  line-height: 1.25;
  font-weight: 650;
}
.soc-meta[data-state="online"] { color: var(--green); }
.soc-meta[data-state="pending"] { color: var(--orange); }
.soc-meta[data-state="offline"] { color: var(--red); }
.soc-meta[data-state="unknown"] { color: var(--muted); }
body[data-data-freshness="pending"] .hero-values strong,
body[data-data-freshness="pending"] .voltage-strip strong,
body[data-data-freshness="pending"] .temperature-list strong,
body[data-data-freshness="pending"] .cell strong { opacity: .74; }
body[data-data-freshness="offline"] .hero-values strong,
body[data-data-freshness="offline"] .voltage-strip strong,
body[data-data-freshness="offline"] .temperature-list strong,
body[data-data-freshness="offline"] .cell strong { opacity: .52; }
.settings-sheet .sheet-panel {
  width: min(760px, calc(100vw - 24px));
  padding: 14px 16px 24px;
}
.settings-sheet .setting-group {
  margin: 0 0 10px;
  padding: 15px;
  border-radius: 18px;
}
@media (max-width: 520px) {
  .settings-sheet .sheet-panel { width: 100%; padding: 12px 12px 22px; }
}

/* 保持现有简约视觉，只增强长期运行可读性、桌面利用率和移动端操作。 */
.account-modal-close {
  display: grid !important;
  place-items: center;
  opacity: 1 !important;
  visibility: visible !important;
}

.health-summary-item strong[data-state="online"] { color: var(--green); }
.health-summary-item strong[data-state="pending"] { color: var(--orange); }

.toast { max-width: min(420px, calc(100vw - 24px)); }

@media (min-width: 700px) {
  .phone-shell {
    max-width: 680px;
  }
  .sheet-panel {
    max-width: 680px;
  }
}

@media (max-width: 520px) {
  .health-summary-item { grid-column: 1 / -1; }
}

@media (max-width: 440px) {
  .protocol-grid,
  .settings-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .maintenance-actions {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .control-permission-line em { max-width: 62%; }
}

.log-item[data-level="warn"] strong {
  color: var(--orange);
}

.log-item[data-level="error"] strong {
  color: var(--red);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: max(14px, env(safe-area-inset-bottom));
  z-index: 20;
  max-width: min(430px, calc(100vw - 28px));
  transform: translate(-50%, 18px);
  opacity: 0;
  pointer-events: none;
  color: var(--ink);
  background:
    var(--glass-inner),
    var(--surface-strong);
  border-radius: 999px;
  padding: 11px 16px;
  box-shadow: var(--hairline), 0 16px 38px rgba(0, 0, 0, 0.18);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  font-size: 13px;
  font-weight: 590;
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

.toast[data-tone="success"] {
  color: var(--green);
}

.toast[data-tone="error"] {
  color: var(--red);
}

@media (max-width: 430px) {
  .phone-shell {
    padding-left: 8px;
    padding-right: 8px;
  }

  .hero-card {
    grid-template-columns: 104px 1fr;
    gap: 7px;
    padding: 7px;
    min-height: 196px;
  }

  .pack-summary {
    padding-left: 7px;
    padding-right: 7px;
  }

  .soc-ring {
    --size: 76px;
  }

  .soc-inner span {
    font-size: 22px;
  }

  .hero-values {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px;
  }

  .hero-values div {
    min-height: 42px;
    padding: 6px 5px;
  }

  .hero-values strong {
    font-size: 12px;
  }

  .hero-values b {
    font-size: 14px;
  }

  .voltage-strip {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .temperature-list {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }

  .cells-grid {
    grid-template-columns: repeat(5, 1fr);
    gap: 13px 5px;
    padding-left: 7px;
    padding-right: 7px;
  }

  .mos-card { grid-template-columns: auto 1fr; }
}

@media (max-width: 520px) {

  .wifi-config-grid {
    grid-template-columns: 1fr;
  }
}

/* V13 SOC 主仪表环 + 设置页折叠卡片优化 */
.soc-gauge-wrap {
  width: 100%;
  display: grid;
  justify-items: center;
  gap: 7px;
}

.soc-footer-stack {
  width: 100%;
  display: grid;
  justify-items: center;
  gap: 3px;
}

.soc-ring {
  --size: 92px;
  --soc-color: var(--blue);
  position: relative;
  isolation: isolate;
  width: var(--size);
  height: var(--size);
  border-radius: 50%;
  display: grid;
  place-items: center;
  background:
    conic-gradient(var(--soc-color) calc(var(--soc) * 1turn), rgba(127, 135, 149, 0.18) 0);
  box-shadow:
    inset 0 1px 0 var(--glass-highlight),
    inset 0 0 0 1px color-mix(in srgb, var(--soc-color) 18%, var(--line));
}

.soc-ring::before {
  content: "";
  position: absolute;
  inset: 8px;
  z-index: 0;
  border-radius: 50%;
  background: var(--surface-strong);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--soc-color) 10%, var(--line));
}

.soc-ring::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 1px solid color-mix(in srgb, var(--soc-color) 14%, transparent);
  pointer-events: none;
}

.soc-ring[data-mode="charging"] { --soc-color: var(--green); }
.soc-ring[data-mode="standby"] { --soc-color: var(--blue); }
.soc-ring[data-mode="low"] { --soc-color: var(--orange); }
.soc-ring[data-mode="critical"],
.soc-ring[data-mode="alert"] { --soc-color: var(--red); }

/* SOC 圆环保持清爽，不使用雾状外发光，避免与状态卡重复抢视觉。 */

.soc-inner {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: auto auto;
  align-items: baseline;
  justify-content: center;
  column-gap: 2px;
  row-gap: 2px;
  color: var(--soc-color);
  text-align: center;
}

.soc-inner span {
  font-size: 28px;
  line-height: 0.95;
  font-weight: 720;
  letter-spacing: -0.04em;
}

.soc-inner small {
  font-size: 12px;
  font-weight: 640;
  opacity: 0.88;
}

.soc-inner em {
  grid-column: 1 / -1;
  max-width: 70px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.15;
  font-style: normal;
  font-weight: 650;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.soc-meta {
  max-width: 100%;
  color: var(--muted);
  font-size: 10.5px;
  line-height: 1.2;
  font-weight: 590;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.setting-hint[data-ok="1"] {
  color: var(--green);
}

.setting-hint[data-ok="0"] {
  color: var(--orange);
}

.embedded-runtime-group {
  display: grid;
  gap: 8px;
  margin-top: 2px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.compact-head {
  align-items: center;
}

@media (max-width: 440px) {
}

@media (max-width: 430px) {
  .soc-ring {
    --size: 82px;
  }

  .soc-inner span {
    font-size: 25px;
  }

  .soc-inner em {
    max-width: 62px;
    font-size: 10px;
  }
}


/* 顶部横向均衡小电芯只补充方向，不重复电芯编号。 */
.balance-marker {
  align-items: center;
  gap: 8px;
}

.balance-marker-direction {
  color: var(--green);
  font-size: 12px;
  line-height: 1;
  font-weight: 760;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.balance-marker-icon[data-direction="arrow-down"] + .balance-marker-direction {
  color: var(--red);
}


/* SOC 圆环内只保留百分比，去掉内层雾状和多余 SOC 字样。 */
.soc-ring {
  background: conic-gradient(var(--soc-color) calc(var(--soc) * 1turn), rgba(127, 135, 149, 0.18) 0);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--soc-color) 16%, var(--line));
}

.soc-ring::before {
  background: var(--surface-strong);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--soc-color) 8%, var(--line));
}

.soc-ring::after {
  box-shadow: none;
}

.soc-inner {
  grid-template-columns: auto auto;
  row-gap: 0;
}

.soc-inner em {
  display: none;
}

.soc-inner span {
  font-size: 30px;
  font-weight: 760;
}

.soc-meta {
  min-height: 13px;
  font-size: 10.8px;
  letter-spacing: 0.01em;
}


/* 没有经协议确认的目标电芯时，均衡只显示在运行状态中。 */
.balance-marker { display: none !important; }


/* 设置页滚动流畅修正：降低 iOS/移动端滚动时的重绘压力 */
body.settings-open {
  overflow: hidden;
}

.settings-sheet {
  overscroll-behavior: contain;
  touch-action: none;
  background: rgba(8, 10, 14, 0.28);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.settings-sheet .sheet-panel {
  touch-action: pan-y;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  contain: layout paint style;
  transform: translateZ(0);
  will-change: scroll-position;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  background:
    linear-gradient(145deg, color-mix(in srgb, var(--surface-strong) 94%, var(--page)), color-mix(in srgb, var(--surface) 96%, var(--page)) 58%, color-mix(in srgb, var(--surface-soft) 92%, var(--page))),
    var(--page);
}

.settings-sheet .setting-group {
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  background:
    var(--tile-gradient),
    color-mix(in srgb, var(--surface-strong) 68%, var(--page));
  box-shadow: var(--hairline), 0 8px 20px rgba(31, 41, 55, 0.07);
}

.settings-sheet .network-item,
.settings-sheet .network-note,
.settings-sheet .saved-target,
.settings-sheet .ota-url,
.settings-sheet .protocol-item,
.settings-sheet .protocol-frame,
.settings-sheet .log-item,
.settings-sheet .wifi-config-grid input,
.settings-sheet .cloud-config-grid input,
.settings-sheet .control-password-field input,
.settings-sheet .control-password-field select {
  box-shadow: var(--hairline), 0 5px 14px rgba(31, 41, 55, 0.055);
}

.sheet-panel,
.network-list,
.log-list,
.protocol-frame {
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

.settings-sheet .setting-group,
.settings-sheet .network-list,
.settings-sheet .log-list,
.settings-sheet .protocol-frame {
  content-visibility: auto;
  contain-intrinsic-size: 1px 160px;
}

@media (prefers-reduced-transparency: reduce) {
  .settings-sheet,
  .settings-sheet .sheet-panel,
  .settings-sheet .setting-group {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }
}

/* 纯白满屏浅色 UI + SOC 简约进度环
   目标：不改变现有模块布局，只替换底色、外层满屏策略和视觉质感。 */
:root {
  color-scheme: light;
  --page: #ffffff;
  --surface: #ffffff;
  --surface-strong: #ffffff;
  --surface-soft: #f5f7fa;
  --tile: #ffffff;
  --tile-gradient: #ffffff;
  --glass-gradient: #ffffff;
  --glass-inner: #ffffff;
  --glass-highlight: rgba(255, 255, 255, 0.96);
  --glass-lowlight: rgba(255, 255, 255, 0);
  --line: rgba(15, 23, 42, 0.075);
  --ink: #171a21;
  --muted: #667085;
  --subtle: #98a2b3;
  --blue: #1478f2;
  --green: #16a34a;
  --orange: #f59e0b;
  --red: #ef4444;
  --purple: #7c3aed;
  --shadow: 0 12px 30px rgba(15, 23, 42, 0.055);
  --soft-shadow: 0 5px 16px rgba(15, 23, 42, 0.045);
  --tile-shadow: inset 0 0 0 1px var(--line), 0 3px 10px rgba(15, 23, 42, 0.025);
  --hairline: inset 0 0 0 1px var(--line);
  --accent-glow: none;
  --blur: none;
}

html,
body {
  min-height: 100%;
  background: #ffffff !important;
}

body::before {
  display: none !important;
}

.phone-shell {
  width: 100%;
  max-width: none;
  min-height: 100dvh;
  margin: 0;
  padding: calc(8px + env(safe-area-inset-top)) 8px calc(16px + env(safe-area-inset-bottom));
  background: #ffffff;
}

.app-header {
  padding-top: 2px;
  border-bottom: 0;
  background: #ffffff;
}

.icon-button,
.small-icon,
.status-strip,
.hero-card,
.voltage-card,
.mos-card,
.data-card,
.temperature-card,
.cells-card,
.setting-group,
.pack-summary,
.status-strip > div,
.server-clock-item,
.hero-values div,
.voltage-strip,
.voltage-strip div,
.temperature-list div,
.flag-item,
.network-item,
.network-note,
.saved-target,
.ota-url,
.protocol-item,
.protocol-frame,
.log-item,
.wifi-config-grid input,
.control-password-field input,
.control-password-field select {
  background: #ffffff !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  box-shadow: var(--hairline), var(--soft-shadow) !important;
}

.status-strip,
.hero-card,
.voltage-card,
.mos-card,
.data-card,
.temperature-card,
.cells-card,
.setting-group {
  border-radius: 18px;
}

.pack-summary {
  background: #ffffff !important;
}

.hero-values div,
.status-strip > div,
.server-clock-item,
.voltage-strip div,
.temperature-list div {
  border-radius: 14px;
}

/* SOC 简约进度环：去掉磨砂、内雾、外发光，只保留纯白底 + 灰色轨道 + 绿色进度。 */
.soc-ring {
  --soc-color: var(--green);
  --soc-track: #eef0f3;
  background: conic-gradient(var(--soc-color) calc(var(--soc) * 1turn), var(--soc-track) 0) !important;
  box-shadow: none !important;
}

.soc-ring::before {
  content: "";
  position: absolute;
  inset: 8px;
  z-index: 0;
  border-radius: 50%;
  background: #ffffff !important;
  box-shadow: none !important;
}

.soc-ring::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 0 !important;
  box-shadow: none !important;
  pointer-events: none;
}

.soc-ring[data-mode="charging"],
.soc-ring[data-mode="standby"],
.soc-ring[data-mode="low"],
.soc-ring[data-mode="critical"],
.soc-ring[data-mode="alert"] {
  --soc-color: var(--green);
}

.soc-inner {
  color: #111827 !important;
}

.soc-inner span {
  color: #111827 !important;
  font-weight: 760;
}

.soc-inner small {
  color: #111827 !important;
  font-weight: 700;
}

.soc-inner em {
  display: none !important;
}

.soc-meta {
  color: var(--muted);
}

.settings-sheet {
  background: #ffffff !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

.sheet-panel {
  width: 100%;
  max-width: none;
  height: 100dvh;
  max-height: none;
  margin: 0;
  border-radius: 0;
  padding: calc(8px + env(safe-area-inset-top)) 10px calc(18px + env(safe-area-inset-bottom));
  background: #ffffff !important;
  box-shadow: none !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

.sheet-handle {
  display: none;
}

.toast {
  background: #ffffff !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  box-shadow: var(--hairline), 0 10px 28px rgba(15, 23, 42, 0.10) !important;
}

@media (min-width: 700px) {
  .phone-shell {
    max-width: 480px;
    margin: 0 auto;
    padding-left: 10px;
    padding-right: 10px;
  }

  .sheet-panel {
    max-width: 560px;
    margin: 0 auto;
  }
}


/* UI 细节修正
   - 首页电压概览区去掉外层横线，只保留内部小块边界。
   - SOC 环缩小数字、减细进度条，并恢复深色模式适配；深色 SOC 使用电芯图标同系蓝色。
   - 设置页保持当前满屏风格，但浅/深色下都更贴合 iOS 平扁简约质感。 */
.voltage-strip {
  background: transparent !important;
  box-shadow: none !important;
  border: 0 !important;
  outline: 0 !important;
}

.voltage-card .section-title {
  padding-bottom: 0;
  border-bottom: 0 !important;
}

.voltage-strip div {
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--line) 86%, transparent) !important;
}

.soc-ring {
  --soc-color: var(--green);
  --soc-track: #edf0f3;
  --soc-ring-cutout: 7px;
  background: conic-gradient(var(--soc-color) calc(var(--soc) * 1turn), var(--soc-track) 0) !important;
  box-shadow: none !important;
}

.soc-ring::before {
  inset: var(--soc-ring-cutout) !important;
  background: var(--page) !important;
  box-shadow: none !important;
}

.soc-ring::after {
  display: none !important;
}

.soc-inner span {
  font-size: clamp(24px, 7.2vw, 28px) !important;
  font-weight: 720 !important;
  letter-spacing: -0.045em;
}

.soc-inner small {
  font-size: 11px !important;
  font-weight: 680 !important;
  margin-left: 1px;
}

@media (min-width: 700px) {
  .soc-inner span {
    font-size: 28px !important;
  }
}

body[data-theme="dark"] {
  color-scheme: dark;
  --page: #090b0f;
  --surface: #10141a;
  --surface-strong: #151a22;
  --surface-soft: #0e1218;
  --tile: #151a22;
  --tile-gradient: #151a22;
  --glass-gradient: #10141a;
  --glass-inner: #151a22;
  --glass-highlight: rgba(255, 255, 255, 0.06);
  --glass-lowlight: rgba(0, 0, 0, 0.28);
  --line: rgba(255, 255, 255, 0.085);
  --ink: #f3f6fa;
  --muted: #a3adbc;
  --subtle: #727e90;
  --blue: #3b8cff;
  --green: #35d07f;
  --orange: #ffb020;
  --red: #ff5a6f;
  --purple: #a78bfa;
  --shadow: 0 16px 38px rgba(0, 0, 0, 0.32);
  --soft-shadow: 0 7px 20px rgba(0, 0, 0, 0.24);
  --tile-shadow: inset 0 0 0 1px var(--line), 0 4px 14px rgba(0, 0, 0, 0.17);
  --hairline: inset 0 0 0 1px var(--line);
  background: var(--page) !important;
}

body[data-theme="dark"] .phone-shell,
body[data-theme="dark"] .app-header,
body[data-theme="dark"] .settings-sheet,
body[data-theme="dark"] .sheet-panel {
  background: var(--page) !important;
}

body[data-theme="dark"] .icon-button,
body[data-theme="dark"] .small-icon,
body[data-theme="dark"] .status-strip,
body[data-theme="dark"] .hero-card,
body[data-theme="dark"] .voltage-card,
body[data-theme="dark"] .mos-card,
body[data-theme="dark"] .data-card,
body[data-theme="dark"] .temperature-card,
body[data-theme="dark"] .cells-card,
body[data-theme="dark"] .setting-group,
body[data-theme="dark"] .pack-summary,
body[data-theme="dark"] .status-strip > div,
body[data-theme="dark"] .server-clock-item,
body[data-theme="dark"] .hero-values div,
body[data-theme="dark"] .voltage-strip div,
body[data-theme="dark"] .temperature-list div,
body[data-theme="dark"] .flag-item,
body[data-theme="dark"] .network-item,
body[data-theme="dark"] .network-note,
body[data-theme="dark"] .saved-target,
body[data-theme="dark"] .ota-url,
body[data-theme="dark"] .protocol-item,
body[data-theme="dark"] .protocol-frame,
body[data-theme="dark"] .log-item,
body[data-theme="dark"] .wifi-config-grid input,
body[data-theme="dark"] .cloud-config-grid input,
body[data-theme="dark"] .control-password-field input,
body[data-theme="dark"] .control-password-field select,
body[data-theme="dark"] .toast {
  background: var(--surface-strong) !important;
  color: var(--ink);
  box-shadow: var(--hairline), var(--soft-shadow) !important;
}

body[data-theme="dark"] .voltage-strip {
  background: transparent !important;
  box-shadow: none !important;
}

body[data-theme="dark"] .soc-meta,
body[data-theme="dark"] .section-title span,
body[data-theme="dark"] .status-strip small,
body[data-theme="dark"] .hero-values span,
body[data-theme="dark"] .voltage-strip span,
body[data-theme="dark"] .settings-nav-copy small,
body[data-theme="dark"] .settings-nav-meta em {
  color: var(--muted) !important;
}

body[data-theme="dark"] .sheet-title,
body[data-theme="dark"] .setting-head,
body[data-theme="dark"] .network-list,
body[data-theme="dark"] .log-list {
  border-color: var(--line) !important;
}

/* SOC 轻量化修正
   - 浅色页使用柔和电芯蓝，避免高饱和蓝/绿色抢视觉。
   - 环线收细、轨道改中性浅灰，中心数字回归 iOS 风格主文字。
   - 压住 data-mode 旧状态色，SOC 环只表达电量进度，不重复表达告警/充放电。 */
body:not([data-theme="dark"]) .soc-ring,
body:not([data-theme="dark"]) .soc-ring[data-mode],
body:not([data-theme="dark"]) .soc-ring[data-mode="charging"],
body:not([data-theme="dark"]) .soc-ring[data-mode="standby"],
body:not([data-theme="dark"]) .soc-ring[data-mode="low"],
body:not([data-theme="dark"]) .soc-ring[data-mode="critical"],
body:not([data-theme="dark"]) .soc-ring[data-mode="alert"] {
  --size: 86px;
  --soc-color: #3478f6 !important;
  --soc-track: #eef1f5 !important;
  --soc-ring-cutout: 4px;
  background: conic-gradient(var(--soc-color) calc(var(--soc) * 1turn), var(--soc-track) 0) !important;
  box-shadow: none !important;
}

body:not([data-theme="dark"]) .soc-ring::before {
  inset: var(--soc-ring-cutout) !important;
  background: #ffffff !important;
  box-shadow: none !important;
}

body:not([data-theme="dark"]) .soc-ring::after {
  display: none !important;
}

body:not([data-theme="dark"]) .soc-inner,
body:not([data-theme="dark"]) .soc-inner span,
body:not([data-theme="dark"]) .soc-inner small {
  color: #1d1d1f !important;
}

body:not([data-theme="dark"]) .soc-inner span {
  font-size: clamp(22px, 6.5vw, 26px) !important;
  font-weight: 680 !important;
  letter-spacing: -0.04em;
}

body:not([data-theme="dark"]) .soc-inner small {
  font-size: 10px !important;
  font-weight: 650 !important;
  margin-left: 1px;
  opacity: 0.84;
}

body[data-theme="dark"] .soc-ring,
body[data-theme="dark"] .soc-ring[data-mode],
body[data-theme="dark"] .soc-ring[data-mode="charging"],
body[data-theme="dark"] .soc-ring[data-mode="standby"],
body[data-theme="dark"] .soc-ring[data-mode="low"],
body[data-theme="dark"] .soc-ring[data-mode="critical"],
body[data-theme="dark"] .soc-ring[data-mode="alert"] {
  --size: 86px;
  --soc-color: #73bbff !important;
  --soc-track: rgba(115, 187, 255, 0.18) !important;
  --soc-ring-cutout: 5px;
  background: conic-gradient(var(--soc-color) calc(var(--soc) * 1turn), var(--soc-track) 0) !important;
  box-shadow: none !important;
}

body[data-theme="dark"] .soc-ring::before {
  inset: var(--soc-ring-cutout) !important;
  background: var(--page) !important;
  box-shadow: none !important;
}

body[data-theme="dark"] .soc-ring::after {
  display: none !important;
}

body[data-theme="dark"] .soc-inner,
body[data-theme="dark"] .soc-inner span,
body[data-theme="dark"] .soc-inner small {
  color: var(--ink) !important;
}

body[data-theme="dark"] .soc-inner span {
  font-size: clamp(22px, 6.5vw, 26px) !important;
  font-weight: 680 !important;
}

body[data-theme="dark"] .soc-inner small {
  font-size: 10px !important;
  font-weight: 650 !important;
  opacity: 0.86;
}

/* account binding gate: login-first, no refresh flicker.
   The gate stays hidden during token restore and only opens when login or binding is actually required. */
.account-gate {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: max(18px, env(safe-area-inset-top)) 18px max(18px, env(safe-area-inset-bottom));
  background: rgba(255,255,255,.92);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  overflow-y: auto;
  overscroll-behavior: contain;
}
.account-gate[hidden] { display: none !important; }
.account-card {
  width: min(100%, 430px);
  max-height: calc(100dvh - 32px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: 26px;
  background: #fff;
  box-shadow: 0 18px 60px rgba(15, 23, 42, .14), inset 0 0 0 1px rgba(226,232,240,.9);
  padding: 20px;
  color: #111827;
}
.account-brand strong { display: block; font-size: 22px; letter-spacing: -.02em; }
.account-brand span { display: block; margin-top: 6px; color: #64748b; font-size: 13px; line-height: 1.45; }
.text-button {
  border: 0;
  border-radius: 14px;
  padding: 10px 12px;
  background: #f1f5f9;
  color: #475569;
  font-weight: 750;
}
.account-form { display: grid; gap: 10px; }
.account-form input {
  width: 100%;
  box-sizing: border-box;
  border: 0;
  border-radius: 15px;
  background: #fff;
  box-shadow: inset 0 0 0 1px #e2e8f0;
  padding: 13px 14px;
  font: inherit;
}
.account-line { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.account-line b { font-size: 15px; }
.device-list { display: grid; gap: 8px; margin-top: 2px; color: #64748b; font-size: 13px; }
.device-row-wrap { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: stretch; }
.device-remove { border: 0; border-radius: 14px; padding: 0 12px; background: #fff1f2; color: #e11d48; font-weight: 800; }
.device-row {
  border: 0;
  width: 100%;
  text-align: left;
  border-radius: 16px;
  background: #f8fafc;
  box-shadow: inset 0 0 0 1px #e2e8f0;
  padding: 11px 12px;
  color: #0f172a;
}
.device-row strong { display: block; font-size: 14px; }
.device-row span { display: block; color: #64748b; margin-top: 3px; font-size: 12px; }
.account-hint { margin: 12px 0 0; color: #64748b; font-size: 12px; line-height: 1.45; }

@media (max-width: 520px) {
  .account-gate {
    place-items: start center;
    padding: calc(12px + env(safe-area-inset-top)) 12px calc(16px + env(safe-area-inset-bottom));
  }
  .account-card {
    width: 100%;
    max-height: none;
    border-radius: 22px;
    padding: 16px;
  }
  .account-brand strong { font-size: 20px; }
  .account-brand span,
  .account-hint { font-size: 12px; }
  .account-form input,
  .account-form .ios-button,
  .text-button {
    min-height: 44px;
  }
  .account-form input {
    font-size: 16px;
  }
}

/* simple login-bind account gate: no device binding means no remote BMS page. */
body[data-auth-stage="checking"] .phone-shell,
body[data-auth-stage="login"] .phone-shell,
body[data-auth-stage="bind"] .phone-shell {
  display: none !important;
}
body[data-auth-stage="dashboard"] .account-gate {
  display: none !important;
}
.account-status-box {
  min-height: 76px;
  display: grid;
  place-items: center;
  border-radius: 16px;
  background: rgba(52, 120, 246, .08);
  color: #1f4fbf;
  font-weight: 800;
}
.account-return {
  justify-self: center;
  margin-top: 2px;
}
/* 强制拆分登录页与绑定页。
   修复 .account-form { display:grid } 覆盖 HTML hidden，导致登录和绑定同屏显示的问题。 */
#accountCheckPanel[hidden],
#loginPanel[hidden],
#claimPanel[hidden],
.account-form[hidden] {
  display: none !important;
}
body[data-auth-stage="checking"] #loginPanel,
body[data-auth-stage="checking"] #claimPanel,
body[data-auth-stage="login"] #accountCheckPanel,
body[data-auth-stage="login"] #claimPanel,
body[data-auth-stage="bind"] #accountCheckPanel,
body[data-auth-stage="bind"] #loginPanel,
body[data-auth-stage="dashboard"] #accountGate {
  display: none !important;
}
body[data-auth-stage="login"] #loginPanel,
body[data-auth-stage="bind"] #claimPanel,
body[data-auth-stage="checking"] #accountCheckPanel {
  display: grid !important;
}
body[data-auth-stage="login"] #accountDeviceList,
body[data-auth-stage="login"] #claimDeviceId,
body[data-auth-stage="login"] #claimNickname,
body[data-auth-stage="login"] #claimButton,
body[data-auth-stage="login"] #returnDashboardButton {
  display: none !important;
}


/* BMS UI account pages + dashboard account modal.
   Login and bind remain full-page gates. On dashboard, account opens as a compact floating window so BMS data stays visible. */
.account-gate {
  background:
    radial-gradient(circle at 18% 8%, rgba(10,132,255,.22), transparent 28%),
    radial-gradient(circle at 86% 16%, rgba(34,197,94,.16), transparent 30%),
    rgba(238,243,248,.82);
}
.account-card {
  position: relative;
  border-radius: 30px;
  background: var(--glass-gradient);
  box-shadow: var(--shadow), var(--hairline);
  border: 1px solid rgba(255,255,255,.34);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  color: var(--ink);
}
.account-brand {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
}
.account-brand strong {
  font-size: clamp(21px, 5.4vw, 26px);
  line-height: 1.08;
  letter-spacing: -.03em;
}
.account-brand span {
  color: var(--muted);
}
.account-form input {
  min-height: 48px;
  border-radius: 18px;
  background: var(--tile-gradient);
  box-shadow: var(--tile-shadow);
  color: var(--ink);
  outline: none;
}
.account-form input:focus {
  box-shadow: inset 0 0 0 2px rgba(10,132,255,.42), 0 10px 24px rgba(10,132,255,.10);
}
.account-form .ios-button {
  min-height: 50px;
  border-radius: 18px;
  box-shadow: 0 14px 30px rgba(10,132,255,.18);
}
.account-hint {
  color: var(--muted);
}
.account-hint {
  padding: 10px 12px;
  border-radius: 16px;
  background: var(--surface-soft);
  box-shadow: inset 0 0 0 1px var(--line);
}
.account-hint[data-tone="success"] { color: var(--green); background: rgba(34,197,94,.10); }
.account-hint[data-tone="error"] { color: var(--red); background: rgba(255,55,95,.10); }
.account-status-box,
.device-row,
.text-button {
  background: var(--tile-gradient);
  box-shadow: var(--tile-shadow);
  color: var(--ink);
}
.device-remove {
  border-radius: 16px;
}
.account-modal-close {
  display: none;
  position: absolute;
  top: 8px;
  right: 8px;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--ink);
  font-size: 23px;
  line-height: 1;
  font-weight: 650;
  box-shadow: var(--tile-shadow);
  z-index: 2;
}
body.account-modal-open .phone-shell {
  display: block !important;
}
body[data-auth-stage="dashboard"].account-modal-open #accountGate {
  display: grid !important;
  place-items: start center;
  padding: calc(12px + env(safe-area-inset-top)) 12px calc(12px + env(safe-area-inset-bottom));
  background: rgba(4, 9, 18, .22);
  backdrop-filter: blur(5px) saturate(1.08);
  -webkit-backdrop-filter: blur(5px) saturate(1.08);
}
body[data-auth-stage="dashboard"].account-modal-open #claimPanel {
  display: grid !important;
}
body[data-auth-stage="dashboard"].account-modal-open #accountCheckPanel,
body[data-auth-stage="dashboard"].account-modal-open #loginPanel {
  display: none !important;
}
body.account-modal-open .account-card {
  width: min(calc(100vw - 28px), 360px);
  max-height: min(78dvh, 620px);
  margin-top: 10px;
  padding: 15px;
  border-radius: 24px;
  box-shadow: 0 18px 52px rgba(0,0,0,.22), var(--hairline);
}
body.account-modal-open .account-modal-close {
  display: grid;
  place-items: center;
}
body.account-modal-open .account-brand {
  padding-right: 52px;
  margin-bottom: 10px;
  gap: 6px;
}
body.account-modal-open .account-brand strong {
  font-size: 19px;
}
body.account-modal-open .account-brand span,
body.account-modal-open .account-hint {
  font-size: 12px;
}
body.account-modal-open .account-form {
  gap: 8px;
}
body.account-modal-open .account-form input {
  min-height: 42px;
  border-radius: 15px;
  padding: 10px 12px;
}
body.account-modal-open .account-form .ios-button,
body.account-modal-open .text-button {
  min-height: 42px;
  border-radius: 15px;
  padding: 9px 11px;
}
body.account-modal-open .device-list {
  max-height: 172px;
  overflow-y: auto;
  padding-right: 2px;
}
body.account-modal-open .device-row {
  padding: 9px 10px;
  border-radius: 15px;
}
body.account-modal-open .device-row strong { font-size: 13px; }
body.account-modal-open .device-row span { font-size: 11px; }
body.account-modal-open .account-hint {
  margin-top: 10px;
  padding: 9px 10px;
}
body[data-theme="dark"] .account-gate {
  background:
    radial-gradient(circle at 18% 8%, rgba(115,187,255,.18), transparent 30%),
    radial-gradient(circle at 84% 18%, rgba(74,222,128,.10), transparent 28%),
    rgba(5,9,16,.82);
}
body[data-theme="dark"] .account-card {
  background: var(--glass-gradient);
  color: var(--ink);
  border-color: rgba(255,255,255,.10);
  box-shadow: var(--shadow), var(--hairline);
}
body[data-theme="dark"] .account-brand span,
body[data-theme="dark"] .account-hint,
body[data-theme="dark"] .device-list,
body[data-theme="dark"] .device-row span {
  color: var(--muted);
}
body[data-theme="dark"] .account-form input,
body[data-theme="dark"] .device-row,
body[data-theme="dark"] .text-button,
body[data-theme="dark"] .account-status-box {
  background: var(--tile-gradient);
  color: var(--ink);
  box-shadow: var(--tile-shadow);
}
body[data-theme="dark"] .device-remove {
  background: rgba(225,29,72,.14);
  color: #fb7185;
}
body[data-theme="dark"].account-modal-open #accountGate {
  background: rgba(0,0,0,.28);
}
@media (max-width: 520px) {
  .account-card {
    border-radius: 26px;
  }
  body.account-modal-open .account-card {
    width: min(calc(100vw - 24px), 350px);
    max-height: 74dvh;
    margin-top: 8px;
  }
}


/* 登录/绑定页继续贴近 BMS 主看板；已绑定账户窗口极简缩小。 */
.account-hint[hidden] { display: none !important; }

body[data-auth-stage="checking"] .account-gate,
body[data-auth-stage="login"] .account-gate,
body[data-auth-stage="bind"] .account-gate {
  align-items: center;
  background: #fff;
}

body[data-auth-stage="login"] .account-card,
body[data-auth-stage="bind"] .account-card,
body[data-auth-stage="checking"] .account-card {
  width: min(calc(100vw - 32px), 390px);
  padding: 18px;
  border-radius: 30px;
  border: 1px solid rgba(59, 74, 99, .10);
  background: #fff;
  box-shadow: 0 18px 44px rgba(31, 41, 55, .09), 0 2px 8px rgba(31, 41, 55, .035);
}

body[data-theme="dark"][data-auth-stage="checking"] .account-gate,
body[data-theme="dark"][data-auth-stage="login"] .account-gate,
body[data-theme="dark"][data-auth-stage="bind"] .account-gate {
  background:
    radial-gradient(circle at 18% 8%, rgba(115,187,255,.18), transparent 30%),
    radial-gradient(circle at 84% 18%, rgba(74,222,128,.10), transparent 28%),
    rgba(5,9,16,.82);
}

body[data-theme="dark"][data-auth-stage="checking"] .account-card,
body[data-theme="dark"][data-auth-stage="login"] .account-card,
body[data-theme="dark"][data-auth-stage="bind"] .account-card {
  border-color: rgba(255,255,255,.10);
  background: var(--glass-gradient);
  box-shadow: var(--shadow), var(--hairline);
}

body[data-auth-stage="login"] .account-brand,
body[data-auth-stage="bind"] .account-brand {
  padding: 6px 6px 2px;
}

body[data-auth-stage="login"] .account-brand strong,
body[data-auth-stage="bind"] .account-brand strong {
  font-size: clamp(24px, 6vw, 30px);
  letter-spacing: -.04em;
}

body[data-auth-stage="login"] .account-brand span,
body[data-auth-stage="bind"] .account-brand span {
  font-size: 12px;
  line-height: 1.55;
}

body[data-auth-stage="login"] .account-form,
body[data-auth-stage="bind"] .account-form {
  gap: 11px;
}

body[data-auth-stage="login"] .account-form input,
body[data-auth-stage="bind"] .account-form input {
  min-height: 50px;
  border-radius: 18px;
  padding: 13px 14px;
  background: var(--tile-gradient);
}

body[data-auth-stage="login"] .account-form .ios-button,
body[data-auth-stage="bind"] .account-form .ios-button {
  min-height: 52px;
  border-radius: 18px;
  font-weight: 850;
}

.first-flash-entry {
  justify-self: center;
  width: fit-content;
  margin: -1px 0 0;
  padding: 4px 8px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.4;
  text-decoration: none;
}
.first-flash-entry:hover { color: var(--blue); }
.first-flash-entry:focus-visible { outline: 2px solid rgba(10,132,255,.42); outline-offset: 2px; border-radius: 8px; }
.first-flash-dialog {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: grid;
  align-content: center;
  justify-items: stretch;
  width: min(100%, 430px);
  height: fit-content;
  margin: auto;
  padding: 18px;
  border-radius: 24px;
  background: color-mix(in srgb, var(--surface-strong) 96%, white);
  border: 1px solid var(--line);
  box-shadow: 0 0 0 100vmax rgba(15,23,42,.24), 0 26px 80px rgba(15,23,42,.24), var(--hairline);
  backdrop-filter: blur(30px) saturate(1.35);
  -webkit-backdrop-filter: blur(30px) saturate(1.35);
}
.first-flash-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.first-flash-head div { display: grid; gap: 3px; }
.first-flash-head small { color: var(--muted); font-size: 11px; }
.first-flash-head strong { font-size: 20px; letter-spacing: -.025em; }
.first-flash-head button {
  width: 30px; height: 30px; border: 0; border-radius: 999px; background: var(--surface-soft); color: var(--ink); font-size: 20px; line-height: 1;
}
.first-flash-dialog > p { margin: 14px 0 12px; color: var(--muted); font-size: 12px; line-height: 1.65; }
.first-flash-dialog > input {
  width: 100%; min-height: 52px; border: 1px solid var(--line); border-radius: 16px; outline: none; background: var(--tile-gradient); color: var(--ink); text-align: center; font-size: 24px; font-weight: 700; letter-spacing: .34em; font-variant-numeric: tabular-nums;
}
.first-flash-dialog > input::placeholder {
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0;
}
.first-flash-dialog > input:focus { border-color: rgba(10,132,255,.5); box-shadow: 0 0 0 3px rgba(10,132,255,.10); }
.first-flash-dialog > .ios-button { min-height: 48px; margin-top: 10px; border-radius: 16px; }
.first-flash-dialog > .ios-button:disabled { cursor: default; opacity: .42; }
.first-flash-hint { min-height: 17px; margin-top: 8px; color: var(--muted); font-size: 11px; text-align: center; }
.first-flash-hint[data-tone="success"] { color: var(--green); }
.first-flash-hint[data-tone="error"] { color: var(--red); }
@media (max-width: 480px) { .first-flash-dialog { width: calc(100% - 28px); border-radius: 22px; } }

body.account-modal-open.account-bound-modal #accountGate {
  place-items: start center;
  padding: calc(10px + env(safe-area-inset-top)) 10px calc(10px + env(safe-area-inset-bottom));
  background: rgba(4, 9, 18, .18);
  backdrop-filter: blur(4px) saturate(1.05);
  -webkit-backdrop-filter: blur(4px) saturate(1.05);
}

body.account-modal-open.account-bound-modal .account-card {
  width: min(calc(100vw - 34px), 318px);
  max-height: min(62dvh, 430px);
  margin-top: 8px;
  padding: 12px;
  border-radius: 20px;
  overflow-y: auto;
  box-shadow: 0 14px 42px rgba(0,0,0,.20), var(--hairline);
}

body.account-modal-open.account-bound-modal .account-modal-close {
  top: 10px;
  right: 10px;
  width: 30px;
  height: 30px;
  font-size: 20px;
}

body.account-modal-open.account-bound-modal .account-brand {
  margin-bottom: 8px;
  padding-right: 34px;
  gap: 2px;
}

body.account-modal-open.account-bound-modal .account-brand strong {
  font-size: 17px;
  line-height: 1.15;
}

body.account-modal-open.account-bound-modal .account-brand span {
  display: none;
}

body.account-modal-open.account-bound-modal #claimDeviceId,
body.account-modal-open.account-bound-modal #claimNickname,
body.account-modal-open.account-bound-modal #claimButton,
body.account-modal-open.account-bound-modal #returnDashboardButton,
body.account-modal-open.account-bound-modal .account-hint {
  display: none !important;
}

body.account-modal-open.account-bound-modal .account-form {
  gap: 7px;
}

body.account-modal-open.account-bound-modal .account-line {
  padding: 8px 9px;
  border-radius: 15px;
  background: var(--surface-soft);
  box-shadow: inset 0 0 0 1px var(--line);
}

body.account-modal-open.account-bound-modal .account-line b {
  min-width: 0;
  font-size: 12px;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

body.account-modal-open.account-bound-modal .account-line .text-button {
  min-height: 32px;
  padding: 6px 9px;
  border-radius: 12px;
  font-size: 12px;
}

body.account-modal-open.account-bound-modal .device-list {
  max-height: 150px;
  margin-top: 0;
  gap: 6px;
  overflow-y: auto;
  padding-right: 1px;
  font-size: 12px;
}

body.account-modal-open.account-bound-modal .device-row-wrap {
  gap: 6px;
  grid-template-columns: minmax(0, 1fr) auto;
}

body.account-modal-open.account-bound-modal .device-row {
  padding: 8px 9px;
  border-radius: 14px;
}

body.account-modal-open.account-bound-modal .device-row strong {
  font-size: 12px;
}

body.account-modal-open.account-bound-modal .device-row span {
  margin-top: 2px;
  font-size: 10px;
  line-height: 1.25;
}

body.account-modal-open.account-bound-modal .device-remove {
  min-height: 34px;
  padding: 0 9px;
  border-radius: 13px;
  font-size: 12px;
}

@media (max-width: 520px) {
  body[data-auth-stage="login"] .account-card,
  body[data-auth-stage="bind"] .account-card,
  body[data-auth-stage="checking"] .account-card {
    width: min(calc(100vw - 24px), 382px);
    padding: 16px;
    border-radius: 26px;
  }
  body.account-modal-open.account-bound-modal .account-card {
    width: min(calc(100vw - 28px), 308px);
    max-height: 58dvh;
    padding: 11px;
  }
}


/* 已绑定账号的小账户窗口只显示账号与已绑定 ESP ID。
   不再显示 ESP ID 输入栏、设备备注栏、绑定按钮、返回按钮和底部提示语，并进一步缩小浮窗。 */
body.account-bound-modal #claimDeviceId,
body.account-bound-modal #claimNickname,
body.account-bound-modal #claimButton,
body.account-bound-modal #returnDashboardButton,
body.account-bound-modal #accountHint,
body.account-bound-modal .account-hint {
  display: none !important;
}
body[data-auth-stage="dashboard"].account-modal-open.account-bound-modal #accountGate {
  place-items: start center;
  padding: calc(10px + env(safe-area-inset-top)) 10px calc(10px + env(safe-area-inset-bottom));
  background: rgba(4, 9, 18, .18);
  backdrop-filter: blur(4px) saturate(1.04);
  -webkit-backdrop-filter: blur(4px) saturate(1.04);
}
body.account-bound-modal .account-card {
  width: min(calc(100vw - 42px), 310px);
  max-height: min(58dvh, 390px);
  margin-top: 8px;
  padding: 12px;
  border-radius: 20px;
  overflow-y: auto;
}
body.account-bound-modal .account-modal-close {
  top: 9px;
  right: 9px;
  width: 30px;
  height: 30px;
  font-size: 20px;
}
body.account-bound-modal .account-brand {
  padding-right: 36px;
  margin-bottom: 8px;
  gap: 4px;
}
body.account-bound-modal .account-brand strong {
  font-size: 17px;
  line-height: 1.05;
}
body.account-bound-modal .account-brand span {
  font-size: 11px;
  line-height: 1.25;
  margin-top: 0;
}
body.account-bound-modal .account-form {
  gap: 7px;
}
body.account-bound-modal .account-line {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 7px 8px;
  border-radius: 14px;
  background: var(--tile-gradient);
  box-shadow: var(--tile-shadow);
}
body.account-bound-modal .account-line b {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
}
body.account-bound-modal .text-button,
body.account-bound-modal .device-remove {
  min-height: 32px;
  border-radius: 12px;
  padding: 6px 8px;
  font-size: 12px;
}
body.account-bound-modal .device-list {
  max-height: 90px;
  overflow-y: auto;
  gap: 6px;
  margin-top: 0;
  padding-right: 1px;
}
body.account-bound-modal .device-row-wrap {
  grid-template-columns: 1fr auto;
  gap: 6px;
}
body.account-bound-modal .device-row {
  padding: 7px 8px;
  border-radius: 13px;
}
body.account-bound-modal .device-row strong {
  font-size: 12px;
}
body.account-bound-modal .device-row span {
  margin-top: 2px;
  font-size: 11px;
  line-height: 1.2;
  word-break: break-all;
}
@media (max-width: 520px) {
  body.account-bound-modal .account-card {
    width: min(calc(100vw - 32px), 310px);
    max-height: min(54dvh, 380px);
    padding: 11px;
    border-radius: 19px;
  }
}


/* 删除左上角品牌后，让收发 / 策略从左侧开始，占满标题区可用宽度。 */
.eyebrow {
  max-width: min(438px, calc(100vw - 92px));
  gap: 7px;
}
.eyebrow #bleTrafficText {
  flex: 0 0 auto;
}
.eyebrow .realtime-inline {
  flex: 1 1 auto;
  min-width: 0;
  max-width: none;
}

@media (max-width: 380px) {
  .eyebrow {
    max-width: calc(100vw - 92px);
    gap: 5px;
  }
}

/* final responsive overrides: placed last to win historical patches. */
.account-modal-close {
  display: grid !important;
  place-items: center;
  opacity: 1 !important;
  visibility: visible !important;
}
@media (min-width: 700px) {
  .phone-shell { max-width: 680px !important; }
  .sheet-panel { max-width: 680px !important; }
}

/* Settings page concise UX closure. */
.wifi-config-grid[hidden] {
  display: none !important;
}
/* Settings BLE/Wi-Fi operation closure. */
#bleList[hidden] { display: none !important; }

.engineering-kv-grid strong[data-state="ok"] { color:#12805c; }
.engineering-kv-grid strong[data-state="busy"] { color:#a15c00; }
.engineering-kv-grid strong[data-state="warn"] { color:#b42318; }
.engineering-kv-grid strong { word-break:break-all; }

.user-ota-panel[hidden] {
  display: none !important;
}


/* engineer account can switch all device IDs without changing user binding. */
.engineer-device-select{margin-top:6px;max-width:min(520px,86vw);border:1px solid rgba(52,120,246,.25);border-radius:999px;padding:6px 12px;background:#f8fbff;color:#172033;font-size:12px;font-weight:700;outline:none}
body[data-theme="dark"] .engineer-device-select{background:rgba(148,163,184,.12);color:#dbeafe;border-color:rgba(148,163,184,.22)}



/* V19.6.52 首次 OTA 后 BMS 绑定提示：沿用首页“用户”按钮的紧凑浮窗样式与关闭逻辑。 */
.bms-bind-guide[hidden] { display: none !important; }
.bms-bind-guide {
  position: fixed;
  inset: 0;
  z-index: 76;
  display: grid;
  place-items: start center;
  padding: calc(10px + env(safe-area-inset-top)) 10px calc(10px + env(safe-area-inset-bottom));
  background: rgba(4, 9, 18, .18);
  backdrop-filter: blur(4px) saturate(1.04);
  -webkit-backdrop-filter: blur(4px) saturate(1.04);
}
.bms-bind-guide-card {
  position: relative;
  width: min(calc(100vw - 42px), 310px);
  max-height: min(58dvh, 390px);
  margin-top: 8px;
  padding: 12px;
  border-radius: 20px;
  overflow-y: auto;
  box-shadow: 0 14px 42px rgba(0,0,0,.20), var(--hairline);
}
.bms-bind-guide-card .account-modal-close {
  display: block;
  top: 9px;
  right: 9px;
  width: 30px;
  height: 30px;
  font-size: 20px;
}
.bms-bind-guide-card .account-brand {
  padding-right: 36px;
  margin-bottom: 10px;
  gap: 5px;
}
.bms-bind-guide-card .account-brand strong {
  font-size: 17px;
  line-height: 1.15;
}
.bms-bind-guide-card .account-brand span {
  display: block;
  font-size: 12px;
  line-height: 1.55;
}
.bms-bind-guide-actions {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  margin-top: 10px;
}
.bms-bind-guide-actions .ios-button,
.bms-bind-guide-actions .text-button {
  min-height: 38px;
  border-radius: 14px;
}
body[data-theme="dark"] .bms-bind-guide { background: rgba(2, 6, 23, .32); }
@media (max-width: 520px) {
  .bms-bind-guide-card { width: min(calc(100vw - 28px), 308px); }
}

/* V19.12.37 vehicle center. Light and dark themes share every layout rule;
   theme-specific selectors below change only color, transparency and shadow. */
.app-header {
  min-height: 66px;
  padding: 4px 4px 10px;
}

.app-header > div:first-child {
  min-width: 0;
  flex: 1 1 auto;
}

.app-header h1 {
  width: 100%;
  max-width: none;
  color: var(--ink);
  font-size: 13px;
  font-weight: 540;
  line-height: 1.38;
  min-block-size: 2.84em;
  display: -webkit-box;
  white-space: normal;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.eyebrow {
  margin-bottom: 3px;
}

.eyebrow .realtime-inline {
  color: var(--blue);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .01em;
}

.header-actions {
  flex: 0 0 auto;
  gap: 6px;
}

.header-actions .icon-button {
  width: 40px;
  height: 40px;
  border-radius: 14px;
}

.vehicle-map-hub {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}

.vehicle-map-hub[data-single="true"] {
  grid-template-columns: minmax(0, 1fr);
}

.vehicle-map-card {
  position: relative;
  min-width: 0;
  height: clamp(154px, 42vw, 202px);
  min-height: 0;
  padding: 0;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--line) 76%, transparent);
  border-radius: 20px;
  background: var(--surface-strong);
  color: var(--ink);
  box-shadow: 0 10px 28px rgba(15, 23, 42, .07);
  text-align: left;
  isolation: isolate;
  cursor: pointer;
}

.vehicle-map-card > .vehicle-mini-map {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  overflow: hidden;
  background: #eef3f8;
  touch-action: pan-y pinch-zoom;
}

.vehicle-mini-map > div,
.bms4g-map-provider-stage {
  width: 100%;
  height: 100%;
}

.vehicle-mini-map,
.vehicle-mini-map * {
  touch-action: pan-y pinch-zoom !important;
}

.vehicle-map-placeholder {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: grid;
  place-items: center;
  padding: 12px;
  color: var(--muted);
  background: var(--surface-soft);
  font-size: 12px;
  text-align: center;
}

.vehicle-ride-card {
  padding: 18px 17px 16px;
  display: grid;
  grid-template-rows: auto 1fr auto;
  align-items: start;
  background: #fff;
}

.vehicle-ride-card-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 680;
  line-height: 1.2;
}

.vehicle-ride-card > strong {
  min-width: 0;
  align-self: center;
  overflow: hidden;
  color: var(--ink);
  font-size: clamp(22px, 6.7vw, 30px);
  font-weight: 740;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.035em;
  line-height: 1.05;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.vehicle-ride-card[data-empty="true"] > strong {
  font-size: clamp(14px, 4.2vw, 18px);
  letter-spacing: -.01em;
  line-height: 1.3;
  white-space: normal;
}

.vehicle-ride-card > small {
  min-width: 0;
  padding-right: 20px;
  overflow: hidden;
  color: var(--muted);
  font-size: 10.5px;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  white-space: normal;
}

.vehicle-ride-card-chevron {
  position: absolute;
  right: 13px;
  bottom: 12px;
  display: grid;
  place-items: center;
  color: color-mix(in srgb, var(--muted) 72%, transparent);
}

.vehicle-ride-card-chevron svg {
  width: 17px;
  height: 17px;
  stroke-width: 2;
}

/* The home data area is one continuous surface: structure comes from spacing
   and hairlines, not nested cards. */
body.user-view .hero-card,
body.user-view .voltage-card,
body.user-view .data-card,
body.user-view .temperature-card,
body.user-view .brand-details-section,
body.user-view .cells-card {
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

body.user-view .hero-card {
  min-height: 0;
  margin: 0;
  padding: 18px 0 8px;
  grid-template-columns: 108px minmax(0, 1fr);
  gap: 12px;
  align-items: stretch;
  border-top: 1px solid color-mix(in srgb, var(--line) 58%, transparent);
}

body.user-view .pack-summary {
  height: auto;
  padding: 4px 11px 2px 2px;
  align-content: start;
  border-right: 1px solid color-mix(in srgb, var(--line) 56%, transparent);
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}

body.user-view .hero-values {
  gap: 0;
  border-top: 0;
}

body.user-view .hero-values > div {
  min-height: 55px;
  padding: 8px 7px;
  border-radius: 0 !important;
  border-bottom: 1px solid color-mix(in srgb, var(--line) 52%, transparent);
  background: transparent !important;
  box-shadow: none !important;
}

body.user-view .voltage-strip,
body.user-view .voltage-strip > div,
body.user-view .temperature-list > div {
  background: transparent !important;
  box-shadow: none !important;
}

body.user-view .summary-title {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 680;
  line-height: 1.35;
  text-align: center;
  white-space: normal;
}

body.user-view .soc-gauge-wrap { gap: 8px; }
body.user-view .soc-meta {
  min-height: 28px !important;
  display: -webkit-box;
  overflow: hidden !important;
  color: var(--muted);
  font-size: 9.5px;
  line-height: 1.4;
  text-align: center;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}
body.user-view .soc-footer-stack { gap: 4px; }
body.user-view .connect-time { font-size: 10.5px; }
body.user-view .version-line { font-size: 9px; line-height: 1.3; }
body.user-view .hero-values span { font-size: 10px; }
body.user-view .hero-values strong { margin-top: 4px; font-size: 13px; font-weight: 690; }
body.user-view .hero-values b { font-size: 15px; font-weight: 720; }

body.user-view :is(.voltage-card, .data-card, .temperature-card, .brand-details-section, .cells-card) {
  margin: 0;
  padding: 20px 0 6px;
  border-top: 1px solid color-mix(in srgb, var(--line) 58%, transparent);
}

body.user-view .section-title {
  min-height: 28px;
  margin: 0 2px 8px;
  padding: 0;
  align-items: baseline;
}
body.user-view .section-title > strong {
  font-size: 15px;
  font-weight: 720;
  letter-spacing: -.015em;
}
body.user-view .section-title > span { font-size: 10.5px; }

body.user-view .voltage-strip {
  gap: 0;
  border-top: 1px solid color-mix(in srgb, var(--line) 48%, transparent);
}
body.user-view .voltage-strip > div {
  min-height: 58px;
  padding: 10px 5px;
}
body.user-view .temperature-list {
  gap: 0;
  border-top: 1px solid color-mix(in srgb, var(--line) 48%, transparent);
}
body.user-view .temperature-list > div {
  min-height: 54px;
  padding: 9px 5px;
}

body.user-view .cells-card { padding-bottom: 14px; }

body[data-auth-stage="dashboard"] .content > section {
  animation: product-section-enter .34s cubic-bezier(.22, 1, .36, 1) both;
}
body[data-auth-stage="dashboard"] .content > section:nth-child(2) { animation-delay: 25ms; }
body[data-auth-stage="dashboard"] .content > section:nth-child(3) { animation-delay: 50ms; }
@keyframes product-section-enter {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
@media (prefers-reduced-motion: reduce) {
  body[data-auth-stage="dashboard"] .content > section { animation: none; }
  .battery-icon::after { transition: none; }
}

body.user-view .voltage-strip > div,
body.user-view .temperature-list > div {
  border-radius: 0 !important;
  border-bottom: 1px solid color-mix(in srgb, var(--line) 52%, transparent);
}

.vehicle-overlay[hidden] {
  display: none !important;
}

body.vehicle-overlay-open {
  overflow: hidden;
}

.vehicle-overlay {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  justify-items: center;
  background: var(--page);
  color: var(--ink);
}

html.map-browser-fullscreen,
body.map-browser-fullscreen {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #eef3f8;
}

#fullscreenMapOverlay:fullscreen,
#fullscreenMapOverlay:-webkit-full-screen,
#fullscreenMapOverlay[data-browser-fullscreen="active"],
#fullscreenMapOverlay[data-browser-fullscreen="standalone"] {
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  max-width: none;
  max-height: none;
  margin: 0;
  border: 0;
  background: #eef3f8;
}

#fullscreenMapOverlay {
  position: fixed;
  inset: 0;
  display: block;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  min-height: 100dvh;
  padding: 0;
  overflow: hidden;
  background: #eef3f8;
  overscroll-behavior: none;
}

.vehicle-overlay-panel {
  position: relative;
  width: min(100%, 760px);
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--page);
}

.vehicle-overlay-header {
  min-height: calc(54px + env(safe-area-inset-top));
  padding: env(safe-area-inset-top) 12px 0;
  display: grid;
  grid-template-columns: 44px 1fr 44px;
  align-items: center;
  background: var(--page);
}

.vehicle-overlay-header > strong {
  text-align: center;
  font-size: 17px;
}

.vehicle-overlay-header > button {
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 14px;
  background: transparent;
  color: var(--ink);
  font-size: 34px;
  line-height: 1;
}

.vehicle-full-map-panel {
  position: fixed;
  inset: 0;
  width: 100%;
  max-width: none;
  height: 100vh;
  height: 100dvh;
  min-height: 100dvh;
  max-height: none;
  border-radius: 0;
  background: var(--surface-soft);
}

.vehicle-full-map-panel .vehicle-overlay-header {
  position: absolute;
  z-index: 30;
  top: 0;
  left: 0;
  right: 0;
  grid-template-columns: 44px 1fr auto;
  min-height: calc(56px + env(safe-area-inset-top));
  padding: calc(8px + env(safe-area-inset-top)) 12px 0;
  background: transparent;
  pointer-events: none;
}

.vehicle-full-map-panel .vehicle-overlay-header > button {
  pointer-events: auto;
  border: 1px solid rgba(255, 255, 255, .42);
  background: rgba(255, 255, 255, .74);
  box-shadow: 0 5px 18px rgba(15, 23, 42, .14);
  backdrop-filter: blur(14px) saturate(1.12);
  -webkit-backdrop-filter: blur(14px) saturate(1.12);
  color: #172033;
}

.vehicle-full-map-panel .vehicle-overlay-header > button {
  border-radius: 50%;
}

.vehicle-full-map-panel .vehicle-overlay-header > .vehicle-map-rides-button {
  width: auto;
  min-width: 88px;
  padding: 0 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 680;
  line-height: 1;
  touch-action: manipulation;
}

.vehicle-full-map {
  position: relative;
  flex: 1 1 auto;
  min-height: 360px;
  overflow: hidden;
  touch-action: none;
  background: #eef3f8;
}

.vehicle-full-map-panel .vehicle-full-map {
  position: fixed;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  min-height: 100dvh;
  isolation: isolate;
}

.vehicle-full-map > div {
  width: 100%;
  height: 100%;
}

.vehicle-map-sheet,
.ride-replay-controls {
  z-index: 4;
  padding: 16px 16px calc(16px + env(safe-area-inset-bottom));
  display: grid;
  gap: 9px;
  border-top: 1px solid var(--line);
  background: var(--surface-strong);
}

.vehicle-full-map-panel .vehicle-map-sheet {
  position: absolute;
  z-index: 30;
  left: 12px;
  right: 12px;
  bottom: calc(12px + env(safe-area-inset-bottom));
  padding: 15px;
  border: 1px solid rgba(255, 255, 255, .42);
  border-radius: 22px;
  background: rgba(255, 255, 255, .66);
  box-shadow: 0 14px 36px rgba(15, 23, 42, .17);
  backdrop-filter: blur(22px) saturate(1.18);
  -webkit-backdrop-filter: blur(22px) saturate(1.18);
  color: #172033;
  pointer-events: auto;
  touch-action: pan-y;
  overscroll-behavior: contain;
}

.vehicle-map-sheet > strong {
  font-size: 16px;
  font-weight: 680;
  line-height: 1.35;
}

.vehicle-map-sheet > span,
.ride-replay-controls > p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.vehicle-full-map-panel .vehicle-map-sheet > span {
  color: #64748b;
}

.vehicle-map-sheet-actions,
.ride-replay-toolbar {
  display: flex;
  align-items: center;
  gap: 9px;
}

.vehicle-map-sheet-actions button,
.ride-replay-toolbar > button,
.ride-speed-segments button {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-soft);
  color: var(--ink);
  font-weight: 650;
}

.vehicle-map-sheet-actions button {
  position: relative;
  z-index: 1;
  flex: 1;
  touch-action: manipulation;
}

.vehicle-map-sheet-actions button:first-child,
.ride-replay-toolbar > button {
  border-color: transparent;
  background: var(--blue);
  color: #fff;
}

.vehicle-full-map-panel .vehicle-map-sheet-actions button:last-child {
  border-color: rgba(100, 116, 139, .22);
  background: rgba(255, 255, 255, .58);
  color: #172033;
}

.vehicle-map-sheet-actions button:disabled,
.ride-replay-toolbar > button:disabled {
  cursor: not-allowed;
  opacity: .46;
}

.vehicle-data-panel {
  width: min(100%, 840px);
  height: 100dvh;
  min-height: 100dvh;
  background: var(--page);
}

.vehicle-data-header {
  flex: 0 0 auto;
  border-bottom: 1px solid color-mix(in srgb, var(--line) 68%, transparent);
}

.vehicle-data-tabs {
  flex: 0 0 auto;
  width: min(280px, calc(100% - 32px));
  margin: 8px auto 4px;
  padding: 3px;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  border-radius: 14px;
  background: var(--surface-soft);
}

.vehicle-data-tabs button,
.vehicle-data-segments button,
.battery-metric-tabs button,
.ride-speed-segments button {
  min-height: 38px;
  padding: 0 12px;
  border: 0;
  border-radius: 11px;
  background: transparent;
  box-shadow: none;
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
}

.vehicle-data-tabs button[aria-selected="true"],
.vehicle-data-segments button[aria-pressed="true"],
.battery-metric-tabs button[aria-pressed="true"],
.ride-speed-segments button[aria-pressed="true"] {
  background: var(--surface-strong);
  box-shadow: 0 2px 8px rgba(15, 23, 42, .08);
  color: var(--blue);
}

.vehicle-data-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

.vehicle-data-pane {
  width: min(100%, 760px);
  margin: 0 auto;
  padding: 8px 16px calc(30px + env(safe-area-inset-bottom));
}

.vehicle-data-pane[hidden],
.vehicle-data-replay[hidden] {
  display: none !important;
}

.vehicle-data-section {
  padding: 24px 0;
  border-bottom: 1px solid color-mix(in srgb, var(--line) 64%, transparent);
}

.vehicle-data-section:last-child { border-bottom: 0; }

.vehicle-data-section > header,
.ride-date-group > header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.vehicle-data-section > header > span {
  color: var(--blue);
  font-size: 11px;
  font-weight: 720;
  letter-spacing: .08em;
}

.vehicle-data-section > header > strong {
  flex: 1;
  font-size: 18px;
  letter-spacing: -.02em;
}

.vehicle-data-section > header > em,
.ride-date-group > header > span {
  color: var(--muted);
  font-size: 11px;
  font-style: normal;
}

.vehicle-metric-strip {
  margin-top: 18px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0;
}

.vehicle-metric-strip > div {
  min-width: 0;
  padding: 13px 12px 13px 0;
  border-bottom: 1px solid color-mix(in srgb, var(--line) 48%, transparent);
}

.vehicle-metric-strip > div:nth-child(3n + 2) { padding-left: 12px; }
.vehicle-metric-strip > div:nth-child(3n) { padding-left: 12px; padding-right: 0; }
.vehicle-metric-strip strong,
.vehicle-metric-strip span { display: block; }
.vehicle-metric-strip strong { font-size: clamp(17px, 4vw, 23px); font-variant-numeric: tabular-nums; letter-spacing: -.025em; }
.vehicle-metric-strip span { margin-top: 5px; color: var(--muted); font-size: 10px; }

.ride-trend-tabs {
  width: fit-content;
  margin-top: 14px;
  display: flex;
  align-items: center;
  gap: 3px;
}

.ride-trend-tabs button,
.ride-replay-chart-tabs button {
  min-height: 34px;
  padding: 0 13px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  box-shadow: none;
  color: var(--muted);
  font-size: 11px;
  transition: color 180ms cubic-bezier(.2,.8,.2,1), background-color 180ms cubic-bezier(.2,.8,.2,1), transform 180ms cubic-bezier(.2,.8,.2,1);
}

.ride-trend-tabs button[aria-pressed="true"],
.ride-replay-chart-tabs button[aria-pressed="true"] {
  background: color-mix(in srgb, var(--blue) 12%, transparent);
  color: var(--blue);
  font-weight: 700;
}

.ride-trend-tabs button:active,
.ride-replay-chart-tabs button:active { transform: scale(.96); }
.rides-trend { min-height: 180px; margin-top: 8px; }

.rides-list { margin-top: 16px; display: grid; gap: 24px; }
.rides-empty { min-height: 140px; display: grid; place-items: center; color: var(--muted); font-size: 13px; }
.ride-date-group { display: grid; gap: 10px; }
.ride-date-group > header strong { font-size: 14px; }

.ride-record { overflow: hidden; border-radius: 20px; background: var(--surface-strong); box-shadow: 0 8px 24px rgba(15, 23, 42, .07); }
.ride-record-open { width: 100%; min-height: 152px; padding: 0; display: grid; grid-template-columns: minmax(126px, 38%) minmax(0, 1fr); border: 0; border-radius: inherit; background: transparent; box-shadow: none; color: var(--ink); text-align: left; }
.ride-preview-shell { position: relative; min-height: 152px; overflow: hidden; background: var(--surface-soft); }
.ride-preview-map { position: absolute; inset: 0; }
.ride-preview-map > div { width: 100%; height: 100%; }
.ride-preview-shell > em { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); font-size: 11px; font-style: normal; }
.ride-preview-shell > i { position: absolute; left: 9px; bottom: 9px; padding: 5px 8px; border-radius: 999px; background: rgba(255, 255, 255, .82); color: #334155; font-size: 10px; font-style: normal; backdrop-filter: blur(10px); }
.ride-preview-shell > i[data-state="active"] { background: rgba(22, 119, 255, .88); color: #fff; }
.ride-preview-shell > i[data-state="warning"] { background: rgba(245, 158, 11, .90); color: #fff; }

.ride-record-copy { min-width: 0; padding: 14px; display: grid; align-content: center; gap: 7px; }
.ride-record-copy em { font-style: normal; }
.ride-record-heading,
.ride-record-primary { min-width: 0; display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.ride-record-heading strong { font-size: 13px; }
.ride-record-heading em,
.ride-record-primary em,
.ride-record-metrics { color: var(--muted); font-size: 10px; }
.ride-record-primary b { color: var(--blue); font-size: 20px; font-weight: 740; font-variant-numeric: tabular-nums; }
.ride-record-metrics { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ride-address { min-width: 0; display: grid; grid-template-columns: 18px minmax(0, 1fr); align-items: center; gap: 6px; color: var(--muted); font-size: 10px; }
.ride-address i { width: 17px; height: 17px; display: grid; place-items: center; border-radius: 50%; background: var(--surface-soft); color: var(--blue); font-style: normal; font-size: 9px; }
.ride-address em { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.vehicle-data-segments,
.battery-metric-tabs { margin-top: 15px; padding: 3px; display: grid; gap: 3px; border-radius: 14px; background: var(--surface-soft); }
.vehicle-data-segments { grid-template-columns: repeat(3, 1fr); }
.battery-metric-tabs { grid-template-columns: repeat(6, 1fr); }
.battery-metric-tabs button { min-width: 0; padding: 0 5px; font-size: 11px; }
.battery-cell-picker { margin: 14px 0 0 auto; width: fit-content; display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 11px; }
.battery-cell-picker select { width: auto; min-width: 92px; min-height: 36px; padding: 0 30px 0 10px; }

.battery-history-chart { min-height: 272px; margin-top: 14px; }
.battery-chart-empty { height: 100%; display: grid; place-items: center; padding: 20px; color: var(--muted); font-size: 12px; text-align: center; }
.battery-history-facts { margin-top: 16px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 24px; }
.battery-history-facts > div { min-width: 0; padding: 11px 0; display: flex; align-items: baseline; justify-content: space-between; gap: 10px; border-bottom: 1px solid color-mix(in srgb, var(--line) 48%, transparent); }
.battery-history-facts span { color: var(--muted); font-size: 11px; }
.battery-history-facts strong { overflow: hidden; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }

.active-charging-session { margin-top: 16px; padding: 14px 0; display: grid; grid-template-columns: auto 1fr auto; align-items: baseline; gap: 12px; border-bottom: 1px solid color-mix(in srgb, var(--line) 52%, transparent); }
.active-charging-session > span { color: var(--blue); font-size: 11px; font-weight: 700; }
.active-charging-session > strong { font-size: 15px; }
.active-charging-session > em { color: var(--muted); font-size: 11px; font-style: normal; }
.charging-records { margin-top: 12px; display: grid; gap: 18px; }
.charging-records > section > header { display: flex; align-items: baseline; justify-content: space-between; }
.charging-records > section > header strong { font-size: 13px; }
.charging-records > section > header span { color: var(--muted); font-size: 10px; }
.charging-records button { width: 100%; min-height: 64px; padding: 10px 0; display: flex; justify-content: space-between; gap: 14px; border: 0; border-bottom: 1px solid color-mix(in srgb, var(--line) 48%, transparent); border-radius: 0; background: transparent; box-shadow: none; color: var(--ink); text-align: left; }
.charging-records button > span { min-width: 0; display: grid; gap: 4px; }
.charging-records button > span:last-child { text-align: right; }
.charging-records strong { font-size: 12px; }
.charging-records em { overflow: hidden; color: var(--muted); font-size: 10px; font-style: normal; text-overflow: ellipsis; white-space: nowrap; }

.charging-detail { margin-top: 18px; padding: 18px 0; border-top: 1px solid color-mix(in srgb, var(--line) 52%, transparent); border-bottom: 1px solid color-mix(in srgb, var(--line) 52%, transparent); }
.charging-detail > header { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.charging-detail > header strong { font-size: 13px; }
.charging-detail > header button { width: 36px; height: 36px; padding: 0; border: 0; border-radius: 50%; background: color-mix(in srgb, var(--surface-soft) 78%, transparent); box-shadow: none; color: var(--ink); font-size: 20px; }
.charging-detail-summary { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 8px 16px; color: var(--muted); font-size: 11px; }
.charging-track-stack { margin-top: 18px; display: grid; gap: 18px; }
.charging-track-group { min-width: 0; padding-top: 14px; border-top: 1px solid color-mix(in srgb, var(--line) 42%, transparent); }
.charging-track-group:first-child { padding-top: 0; border-top: 0; }
.charging-track-group > header { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.charging-track-group > header strong { font-size: 12px; }
.charging-track-group > header span { color: var(--muted); font-size: 9px; }
.charging-track-group > div { margin-top: 5px; }
.charging-detail dl { margin: 12px 0 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 22px; }
.charging-detail dl > div { padding: 9px 0; display: flex; justify-content: space-between; gap: 10px; border-bottom: 1px solid color-mix(in srgb, var(--line) 50%, transparent); }
.charging-detail dt { color: var(--muted); font-size: 10px; }
.charging-detail dd { margin: 0; font-size: 11px; text-align: right; }

.vehicle-data-replay { position: absolute; inset: 0; z-index: 10; display: flex; flex-direction: column; overflow: hidden; background: var(--surface-soft); }
.vehicle-data-replay .vehicle-replay-header { position: absolute; z-index: 30; top: 0; left: 0; right: 0; padding-top: calc(8px + env(safe-area-inset-top)); background: transparent; pointer-events: none; }
.vehicle-data-replay .vehicle-replay-header > button { pointer-events: auto; border: 1px solid rgba(255, 255, 255, .46); border-radius: 50%; background: rgba(255, 255, 255, .76); box-shadow: 0 5px 18px rgba(15, 23, 42, .15); backdrop-filter: blur(15px); color: #172033; }
.vehicle-data-replay .vehicle-replay-header > strong { color: #172033; text-shadow: 0 1px 5px rgba(255, 255, 255, .9); }
.vehicle-data-replay > .vehicle-full-map { position: absolute; inset: 0; width: 100%; height: 100%; }
.ride-replay-controls { position: absolute; z-index: 30; left: 12px; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom)); padding: 15px; border: 1px solid rgba(255, 255, 255, .44); border-radius: 22px; background: rgba(255, 255, 255, .70); box-shadow: 0 16px 42px rgba(15, 23, 42, .18); backdrop-filter: blur(22px) saturate(1.18); -webkit-backdrop-filter: blur(22px) saturate(1.18); color: #172033; pointer-events: auto; touch-action: pan-y; }
.ride-replay-metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.ride-replay-metrics > div { min-width: 0; }
.ride-replay-metrics span,
.ride-replay-metrics strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ride-replay-metrics span { color: #64748b; font-size: 9px; }
.ride-replay-metrics strong { margin-top: 3px; font-size: 12px; font-variant-numeric: tabular-nums; }
.ride-replay-chart { margin: 8px 0 2px; }
.ride-replay-chart-tabs { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 2px; }
.ride-replay-chart-tabs button { min-width: 0; min-height: 30px; padding: 0 4px; color: #64748b; font-size: 9px; }
.ride-replay-controls input[type="range"] { width: 100%; accent-color: var(--blue); touch-action: manipulation; }
.ride-replay-toolbar { display: grid; grid-template-columns: auto minmax(130px, 1fr) auto; }
.ride-replay-toolbar > button { min-width: 84px; padding: 0 14px; touch-action: manipulation; }
.ride-speed-segments { display: grid; grid-template-columns: repeat(3, 1fr); padding: 3px; border-radius: 14px; background: rgba(241, 245, 249, .78); }
.ride-replay-events { max-height: 74px; overflow: auto; display: flex; gap: 7px; }
.ride-replay-events button { min-width: max-content; padding: 7px 10px; display: flex; align-items: center; gap: 6px; border: 0; border-radius: 999px; background: rgba(241, 245, 249, .84); box-shadow: none; color: #172033; font-size: 10px; }
.ride-replay-events span { color: #64748b; }

body[data-theme="dark"] .vehicle-map-card,
body[data-theme="dark"] .ride-record {
  border-color: rgba(148, 163, 184, .13);
  background-color: var(--surface-strong);
  box-shadow: 0 7px 22px rgba(0, 0, 0, .18);
}

body[data-theme="dark"] .vehicle-ride-card {
  background:
    radial-gradient(circle at 90% 8%, rgba(10, 132, 255, .10), transparent 44%),
    var(--surface-strong);
}


body[data-theme="dark"] .vehicle-full-map-panel .vehicle-overlay-header > button {
  border-color: rgba(255, 255, 255, .09);
  background: rgba(16, 23, 35, .73);
  box-shadow: 0 6px 20px rgba(0, 0, 0, .23);
  color: #edf3fb;
}

body[data-theme="dark"] .vehicle-full-map-panel .vehicle-map-sheet {
  border-color: rgba(255, 255, 255, .08);
  background: rgba(16, 23, 35, .68);
  box-shadow: 0 16px 40px rgba(0, 0, 0, .28);
  color: #edf3fb;
}

body[data-theme="dark"] .vehicle-full-map-panel .vehicle-map-sheet > span {
  color: #9aa9bd;
}

body[data-theme="dark"] .vehicle-full-map-panel .vehicle-map-sheet-actions button:last-child {
  border-color: rgba(255, 255, 255, .09);
  background: rgba(255, 255, 255, .07);
  color: #edf3fb;
}

body[data-theme="dark"] .ride-preview-shell > i {
  background: rgba(16, 23, 35, .78);
  color: #d9e3f0;
}

body[data-theme="dark"] .vehicle-data-replay .vehicle-replay-header > button {
  border-color: rgba(255, 255, 255, .09);
  background: rgba(16, 23, 35, .73);
  color: #edf3fb;
}

body[data-theme="dark"] .vehicle-data-replay .vehicle-replay-header > strong {
  color: #edf3fb;
  text-shadow: 0 2px 8px rgba(0, 0, 0, .65);
}

body[data-theme="dark"] .ride-replay-controls {
  border-color: rgba(255, 255, 255, .08);
  background: rgba(16, 23, 35, .72);
  color: #edf3fb;
}

body[data-theme="dark"] .ride-replay-metrics span { color: #9aa9bd; }
body[data-theme="dark"] .ride-replay-chart-tabs button { color: #9aa9bd; }
body[data-theme="dark"] .ride-replay-chart-tabs button[aria-pressed="true"] { color: #72adff; }
body[data-theme="dark"] .ride-speed-segments,
body[data-theme="dark"] .ride-replay-events button { background: rgba(255, 255, 255, .07); }
body[data-theme="dark"] .ride-replay-events button { color: #edf3fb; }
body[data-theme="dark"] .ride-replay-events span { color: #9aa9bd; }

@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .vehicle-full-map-panel .vehicle-overlay-header > button,
  .vehicle-full-map-panel .vehicle-map-sheet,
  .vehicle-data-replay .vehicle-replay-header > button,
  .ride-replay-controls {
    background: rgba(248, 250, 252, .94);
  }
  body[data-theme="dark"] .vehicle-full-map-panel .vehicle-overlay-header > button,
  body[data-theme="dark"] .vehicle-full-map-panel .vehicle-map-sheet,
  body[data-theme="dark"] .vehicle-data-replay .vehicle-replay-header > button,
  body[data-theme="dark"] .ride-replay-controls {
    background: rgba(15, 23, 36, .94);
  }
}

@media (max-width: 480px) {
  .vehicle-data-pane { padding-inline: 12px; }
  .ride-record-open { grid-template-columns: 1fr; }
  .ride-preview-shell { min-height: 148px; }
  .battery-history-facts,
  .charging-detail dl { grid-template-columns: 1fr; }
  .ride-replay-controls { left: 8px; right: 8px; bottom: calc(8px + env(safe-area-inset-bottom)); padding: 12px; }
}

@media (max-width: 380px) {
  .vehicle-ride-card {
    padding: 14px 12px 12px;
  }
  .vehicle-ride-card > small {
    padding-right: 15px;
    font-size: 10px;
  }
  .vehicle-ride-card-chevron {
    right: 10px;
    bottom: 10px;
  }
  .vehicle-metric-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .vehicle-metric-strip > div:nth-child(n) { padding-left: 0; padding-right: 10px; }
  .vehicle-metric-strip > div:nth-child(2n) { padding-left: 10px; padding-right: 0; }
  .battery-metric-tabs { grid-template-columns: repeat(3, 1fr); }
  .active-charging-session { grid-template-columns: 1fr; gap: 4px; }
  .ride-replay-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ride-replay-toolbar { grid-template-columns: 1fr 1.6fr; }
  .ride-replay-toolbar > button:last-child { grid-column: 1 / -1; }
}

@media (min-width: 761px) {
  .vehicle-overlay:not(#fullscreenMapOverlay) {
    padding: 20px;
    background: rgba(5, 7, 10, .78);
    backdrop-filter: blur(10px);
  }
  .vehicle-overlay:not(#fullscreenMapOverlay) .vehicle-overlay-panel {
    min-height: calc(100dvh - 40px);
    max-height: calc(100dvh - 40px);
    border-radius: 24px;
    box-shadow: 0 24px 80px rgba(0, 0, 0, .42);
  }
}
