:root {
  color-scheme: light;
  --page: #f4f6fa;
  --surface: rgba(255, 255, 255, 0.88);
  --surface-strong: rgba(255, 255, 255, 0.96);
  --surface-soft: rgba(247, 249, 253, 0.88);
  --ink: #14171f;
  --muted: #7f8795;
  --subtle: #a4abb7;
  --line: rgba(50, 55, 67, 0.1);
  --blue: #0a84ff;
  --green: #22c55e;
  --orange: #ff9f0a;
  --red: #ff375f;
  --purple: #a855f7;
  --shadow: 0 20px 52px rgba(24, 31, 44, 0.1);
  --soft-shadow: 0 10px 24px rgba(24, 31, 44, 0.06);
  --hairline: inset 0 0 0 1px rgba(255, 255, 255, 0.7), inset 0 0 0 1.5px var(--line);
}

body[data-theme="dark"] {
  color-scheme: dark;
  --page: #0b0d12;
  --surface: rgba(29, 32, 39, 0.82);
  --surface-strong: rgba(38, 42, 52, 0.94);
  --surface-soft: rgba(255, 255, 255, 0.055);
  --ink: #f6f7fb;
  --muted: #a2a9b6;
  --subtle: #717988;
  --line: rgba(255, 255, 255, 0.1);
  --blue: #5eb1ff;
  --green: #4ade80;
  --orange: #ffb340;
  --red: #ff5f7f;
  --purple: #c084fc;
  --shadow: 0 22px 54px rgba(0, 0, 0, 0.34);
  --soft-shadow: 0 10px 24px rgba(0, 0, 0, 0.22);
  --hairline: inset 0 0 0 1px rgba(255, 255, 255, 0.06), inset 0 0 0 1.5px var(--line);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  color: var(--ink);
  background:
    radial-gradient(circle at 18% -10%, rgba(10, 132, 255, 0.14), transparent 30%),
    radial-gradient(circle at 90% 8%, rgba(34, 197, 94, 0.1), transparent 28%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.7), transparent 310px),
    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[data-theme="dark"] {
  background:
    radial-gradient(circle at 18% -10%, rgba(94, 177, 255, 0.18), transparent 30%),
    radial-gradient(circle at 90% 8%, rgba(74, 222, 128, 0.12), transparent 26%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.035), transparent 330px),
    var(--page);
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.phone-shell {
  width: min(100%, 480px);
  min-height: 100vh;
  margin: 0 auto;
  padding: max(8px, env(safe-area-inset-top)) 10px max(18px, 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;
}

.eyebrow {
  margin: 0 0 3px;
  color: var(--blue);
  font-size: 10px;
  font-weight: 600;
}

.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(--surface);
  box-shadow: var(--hairline), var(--soft-shadow);
  backdrop-filter: blur(22px) saturate(1.15);
}

.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: 8px;
}

.status-strip,
.hero-card,
.voltage-card,
.mos-card,
.data-card,
.temperature-card,
.cells-card,
.setting-group {
  background: var(--surface);
  box-shadow: var(--hairline), var(--shadow);
  backdrop-filter: blur(24px) saturate(1.18);
}

.status-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  overflow: hidden;
  border-radius: 16px;
}

.status-strip div {
  min-width: 0;
  padding: 8px 9px;
  background: linear-gradient(180deg, var(--surface-strong), var(--surface-soft));
}

.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 strong {
  display: block;
  margin-top: 3px;
  min-width: 0;
  color: var(--ink);
  font-size: 11px;
  line-height: 1.2;
  font-weight: 620;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.status-strip small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hero-card {
  min-height: 184px;
  padding: 0;
  border-radius: 16px;
  display: grid;
  grid-template-columns: 116px 1fr;
  gap: 0;
  align-items: center;
  overflow: hidden;
}

.pack-summary {
  height: 100%;
  padding: 12px 9px;
  display: grid;
  align-content: center;
  justify-items: center;
  border-right: 1px solid var(--line);
}

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

.soc-ring {
  --size: 86px;
  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:
    0 10px 20px color-mix(in srgb, var(--blue) 14%, transparent),
    inset 0 0 0 1px rgba(255, 255, 255, 0.36);
}

.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: 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(3, 1fr);
  gap: 0;
}

.hero-values div {
  min-width: 0;
  display: grid;
  align-content: center;
  justify-items: center;
  min-height: 62px;
  padding: 8px 5px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.hero-values div:nth-child(3n) {
  border-right: 0;
}

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

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

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

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

.hidden-metrics {
  display: none;
}

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

.section-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  padding: 11px 11px 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: 6px;
  padding: 9px 9px 0;
}

.voltage-strip div {
  min-width: 0;
  border-radius: 12px;
  background: var(--surface-soft);
  padding: 8px 6px;
  box-shadow: inset 0 0 0 1px var(--line);
}

.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: 16px;
  padding: 10px 11px;
}

.mos-icon {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  color: var(--orange);
  background: color-mix(in srgb, var(--orange) 14%, transparent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--orange) 20%, 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;
}

.balance-button,
.ios-button {
  border: 0;
  color: #fff;
  background: var(--blue);
  border-radius: 999px;
  font-weight: 600;
  box-shadow: 0 10px 22px color-mix(in srgb, var(--blue) 22%, transparent);
}

.balance-button {
  min-width: 82px;
  height: 40px;
  padding: 0 14px;
}

.quick-controls {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.quick-controls button {
  border: 0;
  height: 38px;
  border-radius: 999px;
  color: var(--blue);
  background: color-mix(in srgb, var(--blue) 11%, transparent);
  font-size: 13px;
  font-weight: 600;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--blue) 14%, transparent);
}

.control-list {
  margin-top: 12px;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.control-list button {
  border: 0;
  min-height: 40px;
  border-radius: 999px;
  color: var(--blue);
  background: color-mix(in srgb, var(--blue) 11%, transparent);
  font-size: 13px;
  font-weight: 600;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--blue) 14%, transparent);
}

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

.temperature-list div {
  min-width: 0;
  border-radius: 12px;
  background: var(--surface-soft);
  padding: 7px 4px;
  text-align: center;
  box-shadow: inset 0 0 0 1px var(--line);
}

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

.flag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 9px 9px 0;
}

.flag-chip {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 5px 8px;
  background: var(--surface-soft);
  color: var(--ink);
  box-shadow: inset 0 0 0 1px var(--line);
  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));
}

.data-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  padding: 9px 9px 0;
}

.data-grid div {
  min-width: 0;
  border-radius: 10px;
  background: var(--surface-soft);
  box-shadow: inset 0 0 0 1px var(--line);
  padding: 7px 8px;
}

.data-grid span {
  display: block;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.2;
}

.data-grid strong {
  display: block;
  margin-top: 3px;
  color: var(--ink);
  font-size: 11px;
  line-height: 1.2;
  font-weight: 590;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

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

.cells-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 13px 6px;
  padding: 15px 8px 0;
}

.empty-cells {
  margin: 12px 10px 0;
  padding: 11px;
  border-radius: 12px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 11px;
  line-height: 1.55;
  text-align: center;
}

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

.cell {
  min-width: 0;
  padding: 0;
  text-align: center;
  background: transparent;
}

.battery-icon {
  --level: 0;
  --cell-color: var(--blue);
  width: 28px;
  height: 39px;
  margin: 0 auto 5px;
  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),
    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));
}

.battery-icon span {
  position: relative;
  z-index: 1;
  min-width: 17px;
  height: 17px;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  color: #111827;
  background: rgba(255, 255, 255, 0.9);
  box-shadow:
    0 1px 4px rgba(17, 24, 39, 0.14),
    inset 0 0 0 1px rgba(255, 255, 255, 0.75);
  font-size: 10px;
  line-height: 1;
}

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

.cell small {
  display: none;
}

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

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

.cell.high .battery-icon {
  --cell-color: var(--purple);
}

.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 .battery-icon span {
  color: #3f4858;
  background: rgba(255, 255, 255, 0.94);
}

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

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

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

.cell.max.high strong {
  color: var(--purple);
}

.settings-sheet {
  position: fixed;
  inset: 0;
  z-index: 8;
  display: none;
  align-items: flex-end;
  background: rgba(8, 10, 14, 0.34);
}

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

.sheet-panel {
  width: min(100%, 480px);
  max-height: calc(100vh - max(18px, env(safe-area-inset-top)));
  margin: 0 auto;
  overflow: auto;
  background: color-mix(in srgb, var(--page) 88%, transparent);
  backdrop-filter: blur(26px) saturate(1.2);
  border-radius: 22px 22px 0 0;
  padding: 8px 10px max(18px, env(safe-area-inset-bottom));
  box-shadow: 0 -22px 54px rgba(0, 0, 0, 0.22);
}

.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;
}

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

.setting-group {
  border-radius: 16px;
  padding: 11px;
  margin-top: 8px;
}

.setting-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  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;
}

.ios-button.secondary {
  background: var(--surface-soft);
  color: var(--blue);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--blue) 26%, transparent);
}

.ios-button.danger {
  background: color-mix(in srgb, var(--red) 12%, var(--surface-soft));
  color: var(--red);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--red) 26%, transparent);
}

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

.network-list {
  margin-top: 8px;
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
}

.network-item {
  border: 0;
  width: 100%;
  min-height: 42px;
  border-radius: 12px;
  background: 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: inset 0 0 0 1px var(--line);
}

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

.network-item.connected {
  background: 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-item strong {
  display: block;
  font-size: 13px;
  font-weight: 610;
}

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

.password-row {
  margin-top: 10px;
}

.password-row input,
.ota-url {
  width: 100%;
  border: 0;
  outline: 0;
  border-radius: 12px;
  background: var(--surface-soft);
  box-shadow: inset 0 0 0 1px var(--line);
  padding: 10px 12px;
  color: var(--ink);
}

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

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

.log-item {
  border-radius: 15px;
  background: var(--surface-soft);
  box-shadow: inset 0 0 0 1px var(--line);
  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-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(--surface-strong);
  border-radius: 999px;
  padding: 11px 16px;
  box-shadow: var(--hairline), 0 16px 38px rgba(0, 0, 0, 0.18);
  backdrop-filter: blur(22px) saturate(1.2);
  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;
    padding: 0;
  }

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

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

  .hero-values {
    gap: 0;
  }

  .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;
  }

  .balance-button {
    grid-column: 1 / -1;
    width: 100%;
  }
}

@media (min-width: 720px) {
  .phone-shell {
    width: min(100%, 620px);
  }

  .cells-grid {
    grid-template-columns: repeat(6, 1fr);
  }
}

/* Compact product layout: dense, phone-first BMS dashboard. */
html,
body {
  background: var(--page);
  font-size: 14px;
}

.phone-shell {
  width: min(100%, 430px);
  padding: max(6px, env(safe-area-inset-top)) 8px max(16px, env(safe-area-inset-bottom));
}

.app-header {
  min-height: 46px;
  padding: 2px 0 6px;
}

.eyebrow {
  display: none;
}

.app-header h1 {
  max-width: calc(100vw - 96px);
  font-size: 16px;
  line-height: 1.15;
  font-weight: 680;
}

.icon-button {
  width: 30px;
  height: 30px;
  box-shadow: var(--hairline);
}

.icon-button svg,
.small-icon svg {
  width: 16px;
  height: 16px;
}

.content {
  gap: 7px;
}

.status-strip,
.hero-card,
.voltage-card,
.mos-card,
.data-card,
.temperature-card,
.cells-card,
.setting-group {
  border-radius: 12px;
  box-shadow: var(--hairline), 0 4px 14px rgba(24, 31, 44, 0.045);
  backdrop-filter: blur(16px) saturate(1.08);
}

.status-strip div {
  padding: 7px 8px;
}

.status-strip span,
.hero-values span,
.voltage-strip span,
.mos-card span,
.temperature-list span,
.section-title span {
  font-size: 9px;
  line-height: 1.2;
}

.status-strip strong {
  margin-top: 2px;
  font-size: 10px;
  line-height: 1.15;
}

.hero-card {
  min-height: 0;
  display: block;
  overflow: hidden;
}

.pack-summary {
  height: auto;
  min-height: 72px;
  padding: 9px 10px;
  display: grid;
  grid-template-columns: 86px 1fr;
  grid-template-rows: auto auto;
  column-gap: 10px;
  align-content: center;
  justify-items: start;
  border-right: 0;
  border-bottom: 1px solid var(--line);
}

.summary-title {
  grid-column: 2;
  grid-row: 1;
  margin: 0;
  font-size: 12px;
}

.soc-ring {
  grid-column: 1;
  grid-row: 1 / 3;
  --size: 68px;
}

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

.soc-inner small {
  font-size: 10px;
}

.connect-time {
  grid-column: 2;
  grid-row: 2;
  margin: 4px 0 0;
  text-align: left;
  font-size: 10px;
  color: var(--muted);
}

.hero-values {
  display: grid;
  height: auto;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  padding: 7px;
}

.hero-values div {
  position: relative;
  min-height: 48px;
  padding: 7px 4px;
  border: 1px solid color-mix(in srgb, var(--blue) 14%, var(--line));
  border-radius: 10px;
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--blue) 5%, transparent), transparent 72%),
    var(--surface-soft);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.46),
    0 5px 14px rgba(16, 24, 40, 0.035);
  overflow: hidden;
}

.hero-values div::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 2px;
  background: var(--blue);
  opacity: 0.76;
}

.hero-values div:nth-child(2n)::before {
  background: var(--green);
}

.hero-values div:nth-child(3n)::before {
  background: var(--orange);
}

.hero-values div:nth-child(4n)::before {
  background: var(--purple);
}

.hero-values strong {
  margin-top: 3px;
  font-size: 10px;
}

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

.hidden-metrics {
  display: none;
}

.voltage-card,
.data-card,
.temperature-card,
.cells-card {
  padding-bottom: 8px;
}

.section-title {
  padding: 9px 9px 0;
}

.section-title strong {
  font-size: 12px;
}

.section-title span {
  max-width: 54%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

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

.voltage-strip div {
  border-radius: 9px;
  padding: 6px 4px;
}

.voltage-strip strong {
  margin-top: 3px;
  font-size: 10px;
}

.voltage-strip small {
  min-width: 15px;
  height: 13px;
  border-radius: 4px;
  font-size: 9px;
}

.mos-card {
  padding: 8px 9px;
  gap: 8px;
}

.mos-icon {
  width: 30px;
  height: 30px;
  border-radius: 9px;
}

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

.mos-state {
  gap: 2px;
}

.mos-card strong {
  font-size: 12px;
}

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

.temperature-list div {
  border-radius: 9px;
  padding: 6px 3px;
}

.temperature-list strong {
  margin-top: 2px;
  font-size: 10px;
}

.data-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 5px;
  padding: 7px 7px 0;
}

.data-grid div {
  min-width: 0;
  min-height: 45px;
  display: grid;
  align-content: center;
  justify-items: center;
  border-radius: 9px;
  padding: 6px 4px;
  border: 1px solid color-mix(in srgb, var(--blue) 14%, var(--line));
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--blue) 5%, transparent), transparent 68%),
    var(--surface-soft);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.42),
    0 4px 12px rgba(16, 24, 40, 0.03);
}

.data-grid div:nth-child(3n + 2) {
  border-color: color-mix(in srgb, var(--green) 18%, var(--line));
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--green) 5%, transparent), transparent 68%),
    var(--surface-soft);
}

.data-grid div:nth-child(3n) {
  border-color: color-mix(in srgb, var(--orange) 18%, var(--line));
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--orange) 6%, transparent), transparent 68%),
    var(--surface-soft);
}

.data-grid span {
  max-width: 100%;
  color: var(--muted);
  font-size: 9px;
  line-height: 1.2;
  font-weight: 540;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.data-grid strong {
  max-width: 100%;
  margin-top: 3px;
  color: var(--ink);
  font-size: 10px;
  line-height: 1.16;
  font-weight: 610;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

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

.cells-grid {
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px 4px;
  padding: 12px 5px 0;
}

.battery-icon {
  width: 24px;
  height: 34px;
  margin-bottom: 4px;
  border-width: 1.8px;
  border-radius: 6px;
  box-shadow: 0 3px 8px color-mix(in srgb, var(--cell-color) 12%, transparent);
}

.battery-icon::before {
  width: 10px;
  height: 3px;
  top: -5px;
}

.battery-icon span {
  min-width: 15px;
  height: 15px;
  font-size: 9px;
}

.cell strong {
  font-size: 10px;
  font-weight: 560;
}

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

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

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

.cell.low strong,
.cell.high strong,
.cell.critical strong {
  color: var(--ink);
}

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

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

.empty-cells {
  margin: 9px 8px 0;
  padding: 9px;
  font-size: 10px;
}

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

  .hero-card {
    grid-template-columns: none;
  }

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

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

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

  .cells-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 10px 3px;
    padding-left: 4px;
    padding-right: 4px;
  }
}
