@font-face {
  font-family: "Plex Arabic";
  src: url("/fonts/plex-arabic-Regular.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Plex Arabic";
  src: url("/fonts/plex-arabic-SemiBold.woff2") format("woff2");
  font-weight: 600;
  font-display: swap;
}

/* ---------- themes: --plastic is the page (the strip's plastic, in shade), --body the strip itself,
   --live the color of current flowing. One block per theme, light then dark. ---------- */
:root {
  --plastic: #E9EEEC;
  --body: #FBFCFB;
  --well: #F0F3F2;
  --ink: #17262A;
  --muted: #56676A;
  --line: #CCD6D3;
  --live: #00A37A;
  --aura: #36B9E8;
  --live-soft: #D3F0E5;
  --warn: #B3303D;
  --edge: 0 2px 0 var(--line);
  --shine: inset 0 1px 0 rgba(255, 255, 255, .8);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --plastic: #0E1618;
    --body: #172225;
    --well: #1E2B2F;
    --ink: #E3ECEA;
    --muted: #97A8AA;
    --line: #2B3B3F;
    --live: #2FD6A6;
    --aura: #2BB8F0;
    --live-soft: #123C32;
    --warn: #FF8591;
    --edge: 0 2px 0 #070C0D;
    --shine: inset 0 1px 0 rgba(255, 255, 255, .05);
  }
}
:root[data-theme="dark"] {
  --plastic: #0E1618;
  --body: #172225;
  --well: #1E2B2F;
  --ink: #E3ECEA;
  --muted: #97A8AA;
  --line: #2B3B3F;
  --live: #2FD6A6;
  --aura: #2BB8F0;
  --live-soft: #123C32;
  --warn: #FF8591;
  --edge: 0 2px 0 #070C0D;
  --shine: inset 0 1px 0 rgba(255, 255, 255, .05);
}
:root[data-accent="ion"] {
  --plastic: #E8ECF2;
  --body: #FBFCFE;
  --well: #EEF2F8;
  --ink: #151F2E;
  --muted: #556274;
  --line: #CAD3E0;
  --live: #1A66D9;
  --aura: #7A5CF0;
  --live-soft: #D9E6FA;
  --warn: #B3303D;
  --edge: 0 2px 0 var(--line);
  --shine: inset 0 1px 0 rgba(255, 255, 255, .8);
}
@media (prefers-color-scheme: dark) {
  :root[data-accent="ion"]:not([data-theme="light"]) {
    --plastic: #0B111C;
    --body: #141C29;
    --well: #1B2535;
    --ink: #E2E9F3;
    --muted: #93A0B4;
    --line: #273348;
    --live: #5AA9FF;
    --aura: #9C7BFF;
    --live-soft: #14294A;
    --warn: #FF8591;
    --edge: 0 2px 0 #05080E;
    --shine: inset 0 1px 0 rgba(255, 255, 255, .05);
  }
}
:root[data-accent="ion"][data-theme="dark"] {
  --plastic: #0B111C;
  --body: #141C29;
  --well: #1B2535;
  --ink: #E2E9F3;
  --muted: #93A0B4;
  --line: #273348;
  --live: #5AA9FF;
  --aura: #9C7BFF;
  --live-soft: #14294A;
  --warn: #FF8591;
  --edge: 0 2px 0 #05080E;
  --shine: inset 0 1px 0 rgba(255, 255, 255, .05);
}
:root[data-accent="arc"] {
  --plastic: #ECEAF2;
  --body: #FCFBFE;
  --well: #F2F0F8;
  --ink: #1E1A2E;
  --muted: #625C74;
  --line: #D4CFE2;
  --live: #6A45DB;
  --aura: #E0459E;
  --live-soft: #E5DEFB;
  --warn: #B3303D;
  --edge: 0 2px 0 var(--line);
  --shine: inset 0 1px 0 rgba(255, 255, 255, .8);
}
@media (prefers-color-scheme: dark) {
  :root[data-accent="arc"]:not([data-theme="light"]) {
    --plastic: #100D1A;
    --body: #1A1627;
    --well: #221D33;
    --ink: #EAE6F5;
    --muted: #A49CB8;
    --line: #302944;
    --live: #A88BFF;
    --aura: #FF6BC2;
    --live-soft: #2A2150;
    --warn: #FF8591;
    --edge: 0 2px 0 #07050D;
    --shine: inset 0 1px 0 rgba(255, 255, 255, .05);
  }
}
:root[data-accent="arc"][data-theme="dark"] {
  --plastic: #100D1A;
  --body: #1A1627;
  --well: #221D33;
  --ink: #EAE6F5;
  --muted: #A49CB8;
  --line: #302944;
  --live: #A88BFF;
  --aura: #FF6BC2;
  --live-soft: #2A2150;
  --warn: #FF8591;
  --edge: 0 2px 0 #07050D;
  --shine: inset 0 1px 0 rgba(255, 255, 255, .05);
}
:root[data-accent="amber"] {
  --plastic: #ECEBE7;
  --body: #FCFCFA;
  --well: #F3F2EE;
  --ink: #24201A;
  --muted: #67615A;
  --line: #D7D3CA;
  --live: #B26A00;
  --aura: #E2552D;
  --live-soft: #F6E6C6;
  --warn: #B3303D;
  --edge: 0 2px 0 var(--line);
  --shine: inset 0 1px 0 rgba(255, 255, 255, .8);
}
@media (prefers-color-scheme: dark) {
  :root[data-accent="amber"]:not([data-theme="light"]) {
    --plastic: #12100C;
    --body: #1C1914;
    --well: #25211B;
    --ink: #F0EBE2;
    --muted: #ABA396;
    --line: #36302A;
    --live: #FFB938;
    --aura: #FF7A45;
    --live-soft: #3A2C10;
    --warn: #FF8591;
    --edge: 0 2px 0 #080604;
    --shine: inset 0 1px 0 rgba(255, 255, 255, .05);
  }
}
:root[data-accent="amber"][data-theme="dark"] {
  --plastic: #12100C;
  --body: #1C1914;
  --well: #25211B;
  --ink: #F0EBE2;
  --muted: #ABA396;
  --line: #36302A;
  --live: #FFB938;
  --aura: #FF7A45;
  --live-soft: #3A2C10;
  --warn: #FF8591;
  --edge: 0 2px 0 #080604;
  --shine: inset 0 1px 0 rgba(255, 255, 255, .05);
}
:root[data-accent="plasma"] {
  --plastic: #EEE9EE;
  --body: #FDFBFD;
  --well: #F5EFF4;
  --ink: #2A1726;
  --muted: #6E5A69;
  --line: #DCCDD8;
  --live: #C2187A;
  --aura: #7C4DFF;
  --live-soft: #F8DCEC;
  --warn: #B3303D;
  --edge: 0 2px 0 var(--line);
  --shine: inset 0 1px 0 rgba(255, 255, 255, .8);
}
@media (prefers-color-scheme: dark) {
  :root[data-accent="plasma"]:not([data-theme="light"]) {
    --plastic: #140C13;
    --body: #1F141E;
    --well: #291B28;
    --ink: #F3E6F0;
    --muted: #B39DAE;
    --line: #3B2738;
    --live: #FF5CB8;
    --aura: #A57CFF;
    --live-soft: #401731;
    --warn: #FF8591;
    --edge: 0 2px 0 #090408;
    --shine: inset 0 1px 0 rgba(255, 255, 255, .05);
  }
}
:root[data-accent="plasma"][data-theme="dark"] {
  --plastic: #140C13;
  --body: #1F141E;
  --well: #291B28;
  --ink: #F3E6F0;
  --muted: #B39DAE;
  --line: #3B2738;
  --live: #FF5CB8;
  --aura: #A57CFF;
  --live-soft: #401731;
  --warn: #FF8591;
  --edge: 0 2px 0 #090408;
  --shine: inset 0 1px 0 rgba(255, 255, 255, .05);
}
:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"] { color-scheme: dark; }

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; touch-action: pan-x pan-y; }   /* scrolls, never zooms (pinch or double tap) */
body {
  margin: 0;
  background: var(--plastic);
  color: var(--ink);
  font-family: "Plex Arabic", "Noto Sans Arabic", "Segoe UI", Tahoma, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  -webkit-tap-highlight-color: transparent;
  transition: background-color .35s ease, color .35s ease;
}
button { font: inherit; color: inherit; }
input, select { font: inherit; color: var(--ink); }
bdi, .ip { unicode-bidi: isolate; }

.shell {
  position: relative;
  z-index: 1;
  max-width: 34rem;
  margin: 0 auto;
  padding: calc(18px + env(safe-area-inset-top, 0px)) 18px calc(40px + env(safe-area-inset-bottom, 0px));
}

/* ---------- header ---------- */
.top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 6px; }
h1 { margin: 0; font-size: 1.5rem; line-height: 1.3; font-weight: 600; }
.beta-tag { display: inline-block; margin-inline-start: 8px; padding: 1px 8px; border-radius: 999px; vertical-align: 3px;
  background: var(--live-soft); color: var(--ink); font-size: .75rem; font-weight: 600; line-height: 1.6; }
.beta-tag[hidden] { display: none; }
.summary { margin: 2px 0 0; color: var(--muted); font-size: .95rem; font-variant-numeric: tabular-nums; min-height: 1.6em; }
.summary b { color: var(--ink); font-weight: 600; }
.link { margin: 4px 0 12px; font-size: .88rem; color: var(--warn); }
/* the strips as last seen, until the server's live state arrives (or while it can't be reached) */
.strip .bar, .strip-foot { transition: opacity .3s; }
body.stale .strip .bar, body.stale .strip-foot { opacity: .6; }

/* the last minute of power, drawn live */
.spark { display: block; inline-size: 100%; block-size: 38px; margin: 4px 0 16px; overflow: visible; }
.spark path { vector-effect: non-scaling-stroke; }
.spark-line { fill: none; stroke: var(--live); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; transition: stroke .35s; }
.spark-fill { fill: var(--live-soft); opacity: .45; transition: fill .35s; }

.top-actions { display: flex; align-items: center; margin-inline-end: -10px; }
.icon-btn {
  flex: none; inline-size: 44px; block-size: 44px;
  display: grid; place-items: center;
  border: 0; border-radius: 50%; background: transparent; cursor: pointer;
  transition: background-color .15s, transform .12s;
}
.icon-btn svg { inline-size: 22px; block-size: 22px; fill: currentColor; }
.icon-btn .line { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.icon-btn:active { background: var(--line); transform: scale(.94); }

/* ---------- rooms ---------- */
.rooms {
  display: flex; gap: 22px; overflow-x: auto; scrollbar-width: none;
  margin: 0 -18px 20px; padding: 0 18px; border-bottom: 1px solid var(--line);
}
.rooms::-webkit-scrollbar { display: none; }
.rooms button {
  flex: none; border: 0; background: none; cursor: pointer;
  padding: 8px 0 10px; margin-bottom: -1px;
  font-size: .95rem; color: var(--muted); border-bottom: 2px solid transparent;
  transition: color .2s, border-color .2s;
}
.rooms button[aria-current="true"] { color: var(--ink); font-weight: 600; border-bottom-color: var(--live); }

/* ---------- a strip ---------- */
.list { display: grid; gap: 28px; }
.strip-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.strip-name { margin: 0; min-width: 0; font-size: 1.06rem; font-weight: 600; line-height: 1.35; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.room-tag { flex: none; font-size: .82rem; color: var(--muted); }
.strip-head .icon-btn { margin-inline-start: auto; margin-inline-end: -10px; }
.strip.enter { animation: rise .55s cubic-bezier(.2, .8, .2, 1) both; animation-delay: calc(var(--i, 0) * 70ms); }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } }

.bar {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px;
  padding: 14px 8px 10px;
  background: var(--body);
  border: 1px solid var(--line);
  border-radius: 26px;
  box-shadow: var(--shine), var(--edge);
  transition: background-color .35s, border-color .35s, opacity .3s;
}
.strip.offline .bar { opacity: .5; }

.socket {
  position: relative;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  min-width: 0; padding: 2px 2px 4px;
  user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; touch-action: manipulation;
  border: 0; border-radius: 18px; background: none; cursor: pointer;
}
.socket:disabled { cursor: default; }
.face { inline-size: 100%; max-inline-size: 58px; block-size: auto; aspect-ratio: 1; overflow: visible; margin-bottom: 4px; transition: transform .14s cubic-bezier(.3, .7, .2, 1); }
.face .rim { fill: var(--body); stroke: var(--line); stroke-width: 2; transform-box: fill-box; transform-origin: center; transition: stroke .3s, fill .35s; }
.face .charge {
  fill: none; stroke: var(--live); stroke-width: 3.2; stroke-linecap: round;
  stroke-dasharray: 100; stroke-dashoffset: 100; opacity: 0;
  transition: stroke-dashoffset .55s cubic-bezier(.3, .7, .2, 1), opacity .25s, stroke .35s;
}
.face .well { fill: var(--well); transition: fill .4s ease; }
.face .pin { fill: var(--muted); opacity: .5; transition: fill .3s, opacity .3s; }
.face .clip { fill: var(--line); transition: fill .3s, opacity .3s; }
.socket.on .charge { stroke-dashoffset: 0; opacity: 1; filter: drop-shadow(0 0 3px var(--live)); }
.socket.on .well { fill: var(--live-soft); }
.socket.on .pin { fill: var(--live); opacity: 1; }
.socket.on .clip { fill: var(--live); opacity: .45; }
.socket:not(:disabled):active .face { transform: scale(.92); }
.socket.pending .rim { stroke: var(--muted); stroke-dasharray: 5 5; animation: turn 1.1s linear infinite; }
.socket.pending .charge { opacity: .35; }
@keyframes turn { to { transform: rotate(360deg); } }

.o-name { max-width: 100%; font-size: .8rem; line-height: 1.35; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.o-watts { font-size: .78rem; line-height: 1.35; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; transition: color .3s; }
.socket.on .o-watts { color: var(--ink); font-weight: 600; }

.strip-foot { display: flex; align-items: center; gap: 14px; margin-top: 8px; padding-inline: 4px; font-size: .82rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.conn { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.strip.offline .conn { white-space: normal; align-items: flex-start; min-inline-size: 0; flex: 1 1 auto; }   /* why it is offline: the whole sentence */
.strip.offline .conn::before { flex: none; margin-block-start: .45em; }
.conn::before { content: ""; inline-size: 7px; block-size: 7px; border-radius: 50%; background: var(--muted); opacity: .6; transition: background-color .3s; }
.strip:not(.offline) .conn::before { background: var(--live); opacity: 1; box-shadow: 0 0 6px var(--live); }
.strip-foot .btn.text { margin-inline-start: auto; }
.strip-foot { flex-wrap: wrap; row-gap: 4px; }
/* the strip's total, under its name (2.4.9) */
.strip-total { margin: -2px 0 10px; padding-inline: 4px; font-size: .95rem; font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; }
.strip-total[hidden] { display: none; }
/* All on (left, green) and All off (right, red) under each strip (2.4.9) */
.all-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; direction: ltr; }
.all-row[hidden] { display: none; }
.all-btn {
  display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 10px 12px;
  border-radius: 14px; border: 1.5px solid var(--b); background: var(--bg); color: var(--c);
  font: inherit; font-size: .95rem; font-weight: 600; cursor: pointer; transition: transform .1s, opacity .2s;
}
.all-btn span { direction: auto; unicode-bidi: plaintext; }
.all-btn svg { flex: none; inline-size: 20px; block-size: 20px; }
.all-btn svg .line { fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; }
.all-btn:not(:disabled):active { transform: scale(.97); }
.all-btn:disabled { opacity: .4; cursor: default; }
.all-btn.on { --c: #1f9d55; --b: rgba(34, 170, 90, .55); --bg: rgba(34, 170, 90, .12); }
.all-btn.off { --c: #c0392b; --b: rgba(220, 60, 50, .55); --bg: rgba(220, 60, 50, .10); }
[data-theme="dark"] .all-btn.on { --c: #4ade80; --b: rgba(74, 222, 128, .5); --bg: rgba(74, 222, 128, .12); }
[data-theme="dark"] .all-btn.off { --c: #ff7b72; --b: rgba(255, 123, 114, .5); --bg: rgba(255, 123, 114, .10); }

/* ---------- buttons and fields ---------- */
.btn {
  min-height: 44px; padding: 9px 16px; cursor: pointer;
  font-size: .95rem; font-weight: 600;
  border: 1px solid var(--line); border-radius: 12px; background: transparent;
  transition: background-color .2s, color .2s, border-color .2s, transform .12s;
}
.btn:active { transform: scale(.97); }
.btn.primary { background: var(--ink); color: var(--body); border-color: var(--ink); }
.btn.text { min-height: 40px; padding: 6px 4px; border: 0; font-size: .88rem; color: var(--ink); }
.btn.danger { border: 0; padding-inline: 0; color: var(--warn); justify-self: start; }
input, select {
  width: 100%; min-height: 46px; padding: 10px 12px;
  font-size: 16px; background: var(--body);
  border: 1px solid var(--line); border-radius: 12px;
  transition: border-color .2s, background-color .35s;
}
input:focus, select:focus { border-color: var(--live); }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.socket:focus-visible { outline-offset: 0; }

/* ---------- sign in ---------- */
.login { display: grid; gap: 10px; margin-top: 8vh; }
.login label { font-weight: 600; }
.login .mark { inline-size: 64px; block-size: 64px; margin-bottom: 6px; border-radius: 16px; -webkit-touch-callout: none; user-select: none; }
.login .hint { margin-top: -2px; }
.lang-switch { justify-self: end; margin-bottom: -6px; font-weight: 400; }
.err { min-height: 1.6em; margin: 0; font-size: .9rem; color: var(--warn); }

/* ---------- empty state ---------- */
.empty { padding: 18px 18px 20px; background: var(--body); border: 1px solid var(--line); border-radius: 26px; box-shadow: var(--shine), var(--edge); }
.empty h2 { margin: 0 0 2px; font-size: 1.1rem; }
.empty p { margin: 0; color: var(--muted); }
.empty ol { margin: 12px 0 0; padding-inline-start: 1.3em; display: grid; gap: 8px; }
.empty li::marker { font-weight: 600; }
.none { margin: 8px 0; color: var(--muted); }

/* ---------- sheets: slide up from the bottom ---------- */
.sheet {
  width: 100%; max-width: 34rem; max-height: 90vh; margin: auto auto 0; padding: 0;
  border: 0; border-radius: 22px 22px 0 0;
  background: var(--body); color: var(--ink);
  transform: translateY(100%);
  transition: transform .34s cubic-bezier(.2, .8, .2, 1), overlay .34s allow-discrete, display .34s allow-discrete;
}
.sheet[open] { transform: translateY(0); }
@starting-style { .sheet[open] { transform: translateY(100%); } }
.sheet::backdrop {
  background: rgba(10, 18, 20, 0);
  transition: background-color .34s, overlay .34s allow-discrete, display .34s allow-discrete;
}
.sheet[open]::backdrop { background: rgba(10, 18, 20, .45); }
@starting-style { .sheet[open]::backdrop { background: rgba(10, 18, 20, 0); } }
.sheet-in { display: grid; gap: 8px; padding: 20px 18px calc(22px + env(safe-area-inset-bottom, 0px)); }
.sheet h2 { margin: 0 0 4px; font-size: 1.15rem; }
.sheet h2:focus { outline: none; }
.sheet h3 { margin: 16px 0 4px; font-size: .95rem; }
.sheet label { font-size: .9rem; font-weight: 600; margin-top: 4px; }
.pair-app { display: grid; gap: 8px; }
fieldset { margin: 8px 0 0; padding: 0; border: 0; }
legend { padding: 0; margin-bottom: 6px; font-size: .9rem; font-weight: 600; }
.outlet-names { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.outlet-names label { display: grid; gap: 4px; margin: 0; font-size: .8rem; font-weight: 400; color: var(--muted); }
.facts { display: grid; grid-template-columns: auto 1fr; gap: 2px 16px; margin: 10px 0 0; font-size: .82rem; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; direction: ltr; text-align: left; font-variant-numeric: tabular-nums; }
[dir="rtl"] .facts dd { text-align: right; }
.facts .group { grid-column: 1 / -1; margin-top: 8px; color: var(--ink); font-weight: 600; }
.actions { display: flex; gap: 10px; margin-top: 12px; }
.actions .btn { flex: 1; }
.room-list { list-style: none; margin: 0; padding: 0; }
.room-list li { display: flex; align-items: center; justify-content: space-between; min-height: 44px; border-bottom: 1px solid var(--line); }
.room-list .muted { color: var(--muted); border: 0; }
.inline { display: flex; gap: 8px; margin-top: 8px; }
.inline input { flex: 1; }
.inline .btn { flex: none; }
.hint { margin: 0; font-size: .88rem; color: var(--muted); }
.ip { margin: 0; direction: ltr; text-align: left; font-size: 1.3rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.empty .ip { display: inline-block; font-size: 1.05rem; }
[dir="rtl"] .ip { text-align: right; }

/* color themes */
.swatches { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.swatch {
  display: grid; justify-items: center; gap: 6px; padding: 10px 0 8px;
  border: 1px solid transparent; border-radius: 14px; background: none; cursor: pointer;
  font-size: .78rem; color: var(--muted);
  transition: background-color .2s, border-color .2s, color .2s;
}
.swatch i { display: block; inline-size: 30px; block-size: 30px; border-radius: 50%; box-shadow: inset 0 0 0 3px var(--body), 0 0 0 1px var(--line); transition: box-shadow .2s, transform .2s; }
.swatch[aria-pressed="true"] { color: var(--ink); font-weight: 600; background: var(--well); border-color: var(--line); }
.swatch[aria-pressed="true"] i { box-shadow: inset 0 0 0 3px var(--body), 0 0 0 2px var(--live); transform: scale(1.06); }
.swatch[data-accent="jade"] i { background: #00A37A; }
[data-theme="dark"] .swatch[data-accent="jade"] i { background: #2FD6A6; }
.swatch[data-accent="ion"] i { background: #1A66D9; }
[data-theme="dark"] .swatch[data-accent="ion"] i { background: #5AA9FF; }
.swatch[data-accent="arc"] i { background: #6A45DB; }
[data-theme="dark"] .swatch[data-accent="arc"] i { background: #A88BFF; }
.swatch[data-accent="amber"] i { background: #B26A00; }
[data-theme="dark"] .swatch[data-accent="amber"] i { background: #FFB938; }
.swatch[data-accent="plasma"] i { background: #C2187A; }
[data-theme="dark"] .swatch[data-accent="plasma"] i { background: #FF5CB8; }

/* light / dark / follow the phone */
.seg { display: flex; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; margin-top: 8px; }
.seg button { flex: 1; min-height: 42px; border: 0; background: transparent; cursor: pointer; font-size: .9rem; transition: background-color .2s, color .2s; }
.seg button + button { border-inline-start: 1px solid var(--line); }
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--body); font-weight: 600; }

/* about */
.about { display: grid; gap: 2px; margin-top: 4px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 18px; background: var(--well); }
.about-name { display: flex; align-items: baseline; gap: 10px; margin: 0; font-size: 1.05rem; font-weight: 600; }
.about-name span { color: var(--muted); font-weight: 400; }
.about p { margin: 0; color: var(--muted); font-size: .88rem; }
.about .by, .about .about-name { color: var(--ink); }
.about .about-name span { color: var(--muted); }

/* ---------- toast ---------- */
.toast {
  position: fixed; inset-inline: 16px; bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  max-width: 32rem; margin: 0 auto; padding: 12px 16px;
  background: var(--ink); color: var(--body); border-radius: 12px; font-size: .92rem;
  opacity: 0; transform: translateY(10px); transition: opacity .22s, transform .22s cubic-bezier(.2, .8, .2, 1); pointer-events: none;
}
.toast.show { opacity: 1; transform: none; }

/* ---------- language ---------- */
.langs { display: flex; gap: 8px; }
.langs .btn { flex: 1; font-weight: 400; }
.langs .btn[aria-pressed="true"] { background: var(--ink); color: var(--body); border-color: var(--ink); font-weight: 600; }

/* ---------- waiting for a newly added strip; the dot blinks like the strip's own Wi-Fi light ---------- */
.pairing {
  display: grid; gap: 6px; margin-bottom: 20px; padding: 16px 18px;
  background: var(--body); border: 1px solid var(--line); border-radius: 26px; box-shadow: var(--shine), var(--edge);
}
.pairing h2 { display: flex; align-items: center; gap: 10px; margin: 0; font-size: 1.02rem; }
.pairing p { margin: 0; color: var(--muted); font-size: .92rem; }
.pairing .actions { margin-top: 6px; }
.pulse { flex: none; inline-size: 10px; block-size: 10px; border-radius: 50%; background: var(--live); box-shadow: 0 0 8px var(--live); animation: blink .9s ease-in-out infinite; }
@keyframes blink { 50% { opacity: .2; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after, .sheet, .sheet::backdrop { transition-duration: 0s !important; animation: none !important; }
  .socket:not(:disabled):active .face, .btn:active, .icon-btn:active { transform: none; }
}

/* ---------- moving backgrounds (behind everything; the strips stay solid so they read clearly) ---------- */
.bg { position: fixed; inset: 0; z-index: 0; overflow: hidden; pointer-events: none; }
.bg canvas { position: absolute; inset: 0; inline-size: 100%; block-size: 100%; }
.bg i { display: none; position: absolute; border-radius: 50%; will-change: transform; opacity: .5; }
[data-theme="light"] .bg i { opacity: .32; }
[data-bg="aurora"] .bg i { display: block; }
.bg i:nth-child(1) { inline-size: 80vmax; block-size: 80vmax; left: -30vmax; top: -35vmax; background: radial-gradient(circle, var(--live) 0%, transparent 62%); animation: drift-a 24s ease-in-out infinite alternate; }
.bg i:nth-child(2) { inline-size: 70vmax; block-size: 70vmax; right: -32vmax; top: 18vh; background: radial-gradient(circle, var(--aura) 0%, transparent 62%); animation: drift-b 31s ease-in-out infinite alternate; }
.bg i:nth-child(3) { inline-size: 75vmax; block-size: 75vmax; left: -10vmax; bottom: -45vmax; background: radial-gradient(circle, var(--live) 0%, transparent 60%); opacity: .35; animation: drift-c 37s ease-in-out infinite alternate; }
@keyframes drift-a { to { transform: translate(22vw, 26vh) scale(1.18); } }
@keyframes drift-b { to { transform: translate(-26vw, -14vh) scale(.86); } }
@keyframes drift-c { to { transform: translate(30vw, -18vh) scale(1.1); } }

/* ---------- current flowing around a switched-on socket, faster with more load ---------- */
.face .flow { fill: none; stroke: var(--body); stroke-width: 2.4; stroke-linecap: round; stroke-dasharray: 1 7; opacity: 0; }
.socket.on .flow { opacity: .85; animation: flow var(--flow, 3s) linear infinite; }
@keyframes flow { to { stroke-dashoffset: -100; } }
.badge {
  position: absolute; inset-block-start: 0; inset-inline-end: 2px;
  padding: 1px 6px; border-radius: 999px; background: var(--ink); color: var(--body);
  font-size: .68rem; font-weight: 600; line-height: 1.5; font-variant-numeric: tabular-nums; pointer-events: none;
  box-shadow: 0 0 0 2px var(--body);
}
.badge[hidden] { display: none; }
.tip { display: flex; align-items: center; gap: 10px; margin: -6px 0 18px; padding: 10px 14px; border-radius: 14px; background: var(--well); color: var(--muted); font-size: .88rem; }
.tip .btn.text { margin-inline-start: auto; flex: none; }

/* ---------- outlet sheet: timer, schedules, idle ---------- */
.o-head { display: flex; align-items: center; gap: 12px; }
.o-head h2 { flex: 1; min-width: 0; margin: 0; }
.power-btn {
  flex: none; inline-size: 52px; block-size: 52px; border-radius: 50%; cursor: pointer;
  border: 2px solid var(--line); background: var(--well); color: var(--muted);
  display: grid; place-items: center; transition: background-color .25s, border-color .25s, color .25s, box-shadow .25s;
}
.power-btn svg { inline-size: 24px; block-size: 24px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; }
.power-btn[aria-pressed="true"] { border-color: var(--live); background: var(--live-soft); color: var(--live); box-shadow: 0 0 14px var(--live); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  min-height: 40px; padding: 6px 14px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--line); background: transparent; font-size: .9rem;
  transition: background-color .2s, border-color .2s, color .2s;
}
.chip[aria-pressed="true"] { background: var(--ink); color: var(--body); border-color: var(--ink); font-weight: 600; }
.day { min-width: 40px; padding: 6px 0; text-align: center; }
.running { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 14px; background: var(--live-soft); }
.running b { font-variant-numeric: tabular-nums; }
.running .btn { margin-inline-start: auto; }
.rules { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.rules li { display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 6px 4px 6px 12px; border: 1px solid var(--line); border-radius: 14px; }
.rules li.off { opacity: .55; }
.rules .when { font-weight: 600; font-variant-numeric: tabular-nums; }
.rules .what { color: var(--muted); font-size: .85rem; min-width: 0; flex: 1; }
.switch { position: relative; flex: none; inline-size: 46px; block-size: 28px; border-radius: 999px; border: 0; cursor: pointer; background: var(--line); transition: background-color .2s; }
.switch::after { content: ""; position: absolute; inset-block-start: 3px; inset-inline-start: 3px; inline-size: 22px; block-size: 22px; border-radius: 50%; background: var(--body); transition: transform .2s cubic-bezier(.3, .7, .2, 1); }
.switch[aria-checked="true"] { background: var(--live); }
.switch[aria-checked="true"]::after { transform: translateX(18px); }
[dir="rtl"] .switch[aria-checked="true"]::after { transform: translateX(-18px); }
.add-rule { display: grid; gap: 10px; padding: 12px; border: 1px dashed var(--line); border-radius: 14px; }
.add-rule .row { display: grid; gap: 8px; }
.add-rule .row .seg { margin-top: 0; }
.idle-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; color: var(--muted); font-size: .9rem; }
.idle-row input { inline-size: 64px; min-height: 40px; padding: 6px 8px; text-align: center; }
.mini-x { flex: none; inline-size: 40px; block-size: 40px; border: 0; border-radius: 50%; background: none; color: var(--muted); cursor: pointer; font-size: 1.2rem; }

/* edit sheet: per-outlet voice type and timer shortcut */
.outlet-row { display: grid; gap: 6px; }
.outlet-row .row { display: flex; gap: 6px; }
.outlet-row select { flex: 1; min-height: 40px; padding: 6px 10px; font-size: .85rem; }
.outlet-row .btn { flex: none; min-height: 40px; padding: 6px 10px; font-size: .82rem; }
.outlet-row .row .btn[data-timers] { flex: 1; }   /* (2.4.9) the only button in its row: the full width */

/* settings: backgrounds, notifications, voice, activity */
.bgs { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.bg-choice { display: grid; justify-items: center; gap: 6px; padding: 8px 0 6px; border: 1px solid transparent; border-radius: 14px; background: none; cursor: pointer; font-size: .76rem; color: var(--muted); }
.bg-choice span:first-child { display: block; inline-size: 46px; block-size: 46px; border-radius: 12px; border: 1px solid var(--line); background: var(--plastic); overflow: hidden; }
.bg-choice[aria-pressed="true"] { border-color: var(--live); color: var(--ink); font-weight: 600; background: var(--well); }
.bg-choice[data-bg="aurora"] span:first-child { background: radial-gradient(circle at 25% 30%, var(--live), transparent 60%), radial-gradient(circle at 80% 75%, var(--aura), transparent 55%), var(--plastic); }
.bg-choice[data-bg="current"] span:first-child { background: repeating-linear-gradient(170deg, transparent 0 9px, var(--live) 9px 10px, transparent 10px 18px), var(--plastic); opacity: .9; }
.bg-choice[data-bg="sparks"] span:first-child { background: radial-gradient(circle at 30% 70%, var(--live) 0 2px, transparent 3px), radial-gradient(circle at 70% 30%, var(--aura) 0 2px, transparent 3px), radial-gradient(circle at 55% 60%, var(--live) 0 1.5px, transparent 2.5px), radial-gradient(circle at 20% 25%, var(--aura) 0 1.5px, transparent 2.5px), var(--plastic); }
.bg-choice[data-bg="circuit"] span:first-child { background: linear-gradient(var(--live), var(--live)) 30% 0 / 1px 60% no-repeat, linear-gradient(var(--live), var(--live)) 30% 60% / 50% 1px no-repeat, linear-gradient(var(--aura), var(--aura)) 80% 60% / 1px 40% no-repeat, var(--plastic); }
.toggles { display: grid; gap: 2px; }
.toggle-row { display: flex; align-items: center; gap: 12px; min-height: 48px; }
.toggle-row span { flex: 1; font-size: .92rem; }
/* Notifications: quiet hours, and how they arrive (through Google, or the app's own connection) */
.quiet-times { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 10px; margin: 4px 0 6px; }
.quiet-f { display: grid; gap: 4px; min-width: 0; font-size: .8rem; font-weight: 600; color: var(--muted); }
.quiet-f input { min-height: 42px; padding: 8px 10px; min-width: 0; }
.quiet-times .hint { grid-column: 1 / -1; margin: 0; }
.status.n-way { display: flex; align-items: flex-start; margin: 10px 0 4px; line-height: 1.4; }
.status.n-way::before { flex: none; margin-top: .45em; }
.copy-row { display: grid; grid-template-columns: 1fr auto; gap: 4px 8px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); }
.copy-row dt { grid-column: 1 / -1; color: var(--muted); font-size: .78rem; }
.copy-row dd { margin: 0; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; direction: ltr; font-size: .85rem; font-variant-numeric: tabular-nums; }
[dir="rtl"] .copy-row dd { text-align: right; }
.status { display: inline-flex; align-items: center; gap: 6px; font-size: .88rem; color: var(--muted); }
.status::before { content: ""; inline-size: 8px; block-size: 8px; border-radius: 50%; background: var(--muted); }
.status.ok::before { background: var(--live); box-shadow: 0 0 6px var(--live); }
.steps-mini { margin: 4px 0 0; padding-inline-start: 1.2em; color: var(--muted); font-size: .86rem; display: grid; gap: 4px; }
details.more summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; font-weight: 600; font-size: .95rem; }
.activity { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.activity li { display: flex; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--line); font-size: .86rem; }
.activity time { flex: none; color: var(--muted); font-variant-numeric: tabular-nums; }

@media (prefers-reduced-motion: reduce) {
  .bg i, .socket.on .flow { animation: none !important; }
}

/* firmware overview */
.fw-list { list-style: none; margin: 0 0 8px; padding: 0; }
.fw-list li { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: .88rem; }
.fw-list li span:last-child { color: var(--muted); font-variant-numeric: tabular-nums; text-align: end; }
.fw-list .fw-old { color: var(--ink); font-weight: 600; }
#fwPhone { margin-top: 8px; }

/* many strips: search, room counts, bulk off, compact rows */
.tools { display: flex; align-items: center; gap: 8px; margin: -8px 0 14px; }
.tools:not(:has(:not([hidden]))) { display: none; }
.find { flex: 1; min-width: 0; }
.find input { min-height: 42px; padding: 8px 14px; border-radius: 999px; font-size: 15px; }
#allOff { flex: none; margin-inline-start: auto; min-height: 42px; color: var(--warn); font-weight: 600; }
.rooms button .n { margin-inline-start: 6px; padding: 0 6px; border-radius: 999px; background: var(--well); color: var(--muted); font-size: .72rem; font-variant-numeric: tabular-nums; }
.rooms button[aria-current="true"] .n { background: var(--live-soft); color: var(--ink); }

.list.dense { gap: 10px; }
.strip .mini { display: none; }
.strip.compact .bar, .strip.compact .strip-foot, .strip.compact .all-row, .strip.compact .strip-total { display: none; }
.strip.compact .strip-head {
  margin-bottom: 0; min-height: 60px; padding: 4px 6px 4px 16px; cursor: pointer;
  background: var(--body); border: 1px solid var(--line); border-radius: 20px;
  box-shadow: var(--shine), var(--edge);
  transition: background-color .35s, border-color .35s, opacity .3s, transform .12s;
}
[dir="rtl"] .strip.compact .strip-head { padding: 4px 16px 4px 6px; }
.strip.compact .strip-head:active { transform: scale(.985); }
.strip.compact .strip-head:focus-visible { outline-offset: 0; }
.strip.compact.offline .strip-head { opacity: .55; }
.strip.compact .strip-head {
  display: grid; grid-template-columns: minmax(0, 1fr) auto auto; column-gap: 12px; row-gap: 0; align-items: center;
  grid-template-areas: "name mini edit" "tag mini edit";
}
.strip.compact .strip-name { grid-area: name; align-self: end; }
.strip.compact .room-tag { grid-area: tag; align-self: start; margin-top: -4px; font-size: .74rem; }
.strip.compact .mini { grid-area: mini; display: inline-flex; align-items: center; gap: 12px; }
.strip.compact .strip-head .icon-btn { grid-area: edit; }
.strip.compact .strip-head .icon-btn { margin-inline-start: 0; margin-inline-end: 0; }
.dots { display: inline-flex; gap: 5px; }
.dots i { inline-size: 10px; block-size: 10px; border-radius: 50%; background: var(--line); transition: background-color .25s, box-shadow .25s; }
.dots i.on { background: var(--live); box-shadow: 0 0 7px var(--live); }
.mini-w { min-inline-size: 3.6em; text-align: end; font-size: .84rem; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.strip:not(.offline) .mini-w { color: var(--ink); }
/* a row that is open in the list layout */
.list.dense .strip:not(.compact) .strip-head { margin-bottom: 8px; }

.summary .fleet { display: block; font-size: .84rem; }

/* readings: size is one setting for the whole app (Settings, Readings) */
:root { --r-watts: .78rem; --r-sub: .68rem; --r-foot: .82rem; }
:root[data-size="s"] { --r-watts: .7rem; --r-sub: .62rem; --r-foot: .74rem; }
:root[data-size="l"] { --r-watts: 1.02rem; --r-sub: .8rem; --r-foot: 1rem; }
:root[data-size="xl"] { --r-watts: 1.36rem; --r-sub: .98rem; --r-foot: 1.28rem; }
.o-watts { font-size: var(--r-watts); line-height: 1.25; }
.o-amps { font-size: var(--r-sub); line-height: 1.2; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.strip-foot { font-size: var(--r-foot); flex-wrap: wrap; row-gap: 2px; }
.strip-foot .volts { white-space: nowrap; font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; }
.strip-foot .volts.muted { color: var(--muted); font-weight: 400; }
.mini-w { font-size: var(--r-foot); }
.size-preview { display: flex; align-items: baseline; justify-content: center; gap: 16px; margin: 10px 0 4px; padding: 14px; border-radius: 16px; background: var(--well); font-variant-numeric: tabular-nums; }
.size-preview .pv-w { font-size: var(--r-watts); }
.size-preview .pv-a, .size-preview .pv-v { font-size: var(--r-sub); color: var(--muted); }
:root[data-size="l"] .size-preview .pv-a, :root[data-size="l"] .size-preview .pv-v,
:root[data-size="xl"] .size-preview .pv-a, :root[data-size="xl"] .size-preview .pv-v { font-size: var(--r-foot); }

/* protection and limits */
#oHardBox[hidden] { display: none; }
.rule { display: grid; gap: 8px; margin-top: 10px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 16px; }
.rule-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.rule-body { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; color: var(--muted); font-size: .9rem; }
.rule-body input { inline-size: 76px; min-height: 42px; padding: 6px 8px; text-align: center; }
.unit-seg { margin-top: 0; flex: none; }
.unit-seg button { min-height: 42px; padding: 0 14px; }
.rule .hint { margin: 0; }
.rule .r-hint { color: var(--ink); font-variant-numeric: tabular-nums; }

/* removed strips and the connection log */
.fw-list small { color: var(--muted); margin-inline-start: 6px; }
.diag-list { list-style: none; margin: 0 0 8px; padding: 0; }
.diag-list li { display: grid; gap: 2px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: .86rem; }
.diag-list small { color: var(--muted); }
.diag-list .btn.text { justify-self: start; min-height: 36px; padding-inline: 0; }
.hint.warn { color: var(--warn); font-weight: 600; }
.r-pair { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }

/* notices (old server, changed address) and the waiting-for-a-strip details */
.notice { margin: 0 0 14px; padding: 12px 14px; border-radius: 14px; background: var(--warn); color: var(--body); font-size: .9rem; line-height: 1.5; font-weight: 600; }
.pair-status { white-space: pre-line; font-size: .88rem; color: var(--ink); }
.pair-status:empty { display: none; }
.pair-checks-title { margin: 6px 0 0 !important; font-weight: 600; color: var(--ink) !important; }
.pair-checks { margin: 0; padding-inline-start: 1.2em; display: grid; gap: 4px; color: var(--muted); font-size: .86rem; }

/* start fresh */
.btn.danger-line { width: 100%; margin-top: 4px; border-color: var(--warn); color: var(--warn); }

/* adding a strip: flashed (MQTT) or on LG's firmware */
.add-body { display: grid; gap: 10px; margin-top: 12px; }
.add-body > .hint { margin: 0; }
.add-steps { margin: 0; padding-inline-start: 1.3em; display: grid; gap: 8px; font-size: .9rem; line-height: 1.5; }
.add-steps li::marker { font-weight: 600; }
.broker { margin: 0; }
.broker .copy-row dd { font-size: 1.15rem; font-weight: 600; }
.fw-head { margin: 12px 0 2px; font-weight: 600; font-size: .86rem; }
.add-steps bdi { white-space: nowrap; }
.facts a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }

/* ---------- strips and outlets in their own colors, with what's plugged in drawn in the socket ---------- */
.tint { display: none; flex: none; inline-size: 10px; block-size: 10px; border-radius: 50%; background: var(--live); box-shadow: 0 0 6px var(--live); }
.strip.colored .tint { display: block; }
.strip.colored .bar { border-color: color-mix(in srgb, var(--live) 28%, var(--line)); }
.face .dev { fill: none; stroke: var(--muted); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; opacity: .75; transition: stroke .3s, opacity .3s; }
.socket.on .face .dev { stroke: var(--live); opacity: 1; }
.socket.has-icon .pin { display: none; }
/* an outlet set to keep on (a router): a small lock where the bottom clip is */
.face .keep { display: none; }
.socket.keep .face .keep { display: inline; }
.socket.keep .face .clip.low { display: none; }
.face .keep rect { fill: var(--muted); transition: fill .3s; }
.face .keep path { fill: none; stroke: var(--muted); stroke-width: 1.4; stroke-linecap: round; transition: stroke .3s; }
.socket.on .face .keep rect { fill: var(--live); }
.socket.on .face .keep path { stroke: var(--live); }

/* a row of colors to pick from */
.field-label { margin: 4px 0 0; font-size: .9rem; font-weight: 600; }
.colors { display: flex; flex-wrap: wrap; gap: 7px; }
.dot {
  inline-size: 32px; block-size: 32px; border-radius: 50%; border: 0; padding: 0; cursor: pointer;
  background: var(--dot, var(--live)); box-shadow: inset 0 0 0 3px var(--body), 0 0 0 1px var(--line);
  transition: box-shadow .2s, transform .2s;
}
.dot.inherit { background: conic-gradient(from 45deg, var(--dot, var(--live)) 0 50%, var(--well) 0 100%); }
.dot[aria-pressed="true"] { box-shadow: inset 0 0 0 3px var(--body), 0 0 0 2.5px var(--ink); transform: scale(1.08); }

/* the edit sheet: a button per outlet for its icon and color, beside its name */
.name-row { display: flex; gap: 6px; }
.name-row input { flex: 1; min-width: 0; }
.outlet-row > label { display: block; margin: 0; font-size: .8rem; font-weight: 400; color: var(--muted); }
.look-btn {
  flex: none; display: grid; place-items: center; inline-size: 46px; block-size: 46px; padding: 0; cursor: pointer;
  border: 1px solid color-mix(in srgb, var(--live) 45%, var(--line)); border-radius: 14px;
  background: var(--live-soft); color: var(--live);
}
.look-btn svg { inline-size: 24px; block-size: 24px; }
.look-btn:active { transform: scale(.95); }
.o-head .look-btn { inline-size: 52px; block-size: 52px; border-radius: 50%; }

/* the icon picker */
.look-head { display: flex; align-items: center; gap: 14px; }
.look-head h2 { margin: 0; }
.look-preview {
  flex: none; display: grid; place-items: center; inline-size: 60px; block-size: 60px; border-radius: 50%;
  background: var(--live-soft); color: var(--live); box-shadow: 0 0 0 3px var(--live), 0 0 16px color-mix(in srgb, var(--live) 45%, transparent);
}
.look-preview svg { inline-size: 32px; block-size: 32px; }
.dev-group { margin: 14px 0 6px; font-size: .82rem; font-weight: 600; color: var(--muted); }
.dev-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); gap: 6px; }
.dev-choice {
  display: grid; justify-items: center; align-content: start; gap: 5px; min-height: 76px; padding: 10px 4px 8px; cursor: pointer;
  border: 1px solid transparent; border-radius: 14px; background: none; color: var(--ink);
  font-size: .72rem; line-height: 1.25; text-align: center;
  transition: background-color .2s, border-color .2s;
}
.dev-choice svg { inline-size: 26px; block-size: 26px; }
.dev-choice[aria-pressed="true"] { border-color: var(--live); background: var(--live-soft); color: var(--live); font-weight: 600; }
.look-done { position: sticky; bottom: calc(-22px - env(safe-area-inset-bottom, 0px)); margin: 8px -18px calc(-22px - env(safe-area-inset-bottom, 0px)); padding: 10px 18px calc(14px + env(safe-area-inset-bottom, 0px)); background: var(--body); border-top: 1px solid var(--line); }

/* away from home (Tailscale) */
.away-pill {
  display: inline-flex; align-items: center; gap: 6px; margin: 6px 0 0; padding: 3px 10px 3px 8px;
  border-radius: 999px; background: var(--live-soft); color: var(--live); font-size: .8rem; font-weight: 600;
}
.away-pill[hidden] { display: none; }
.away-pill svg { inline-size: 15px; block-size: 15px; flex: none; }
.away-pill .line { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
#awayBox .hint + dl { margin-top: 6px; }
#awayBox dl { margin: 0; }
#aSteps { margin: 10px 0 12px; }
#aSteps li.done { color: var(--live); }
#aTailscale { margin: 0 0 12px; }
#awayBox label { display: block; margin-top: 4px; }
#aSteps bdi { white-space: nowrap; }

/* sign in, create an account (cloud) */
.login-title { margin: 0 0 2px; font-size: 1.3rem; }
.login-rows { display: grid; gap: 10px; }
#loginSwitch { justify-self: center; }
.expired .hint { margin: 0; line-height: 1.5; }
.welcome .hint { margin: 0 0 14px; font-size: 1rem; }
.welcome .btn { min-height: 48px; }
/* Denjin's own question ("Turn off 6 outlets?"), instead of the browser's: the same on the phone, in a browser, in Arabic */
.ask-text { margin: 4px 0 10px; font-size: 1.02rem; line-height: 1.5; }
.ask-actions { display: flex; gap: 8px; }
.ask-actions .btn { flex: 1 1 0; min-height: 46px; }
#askYes.warn { background: var(--warn); border-color: var(--warn); color: #fff; }
/* Add a strip, on the phone: Denjin finds the strip and sets it up by itself */
.auto-body { display: grid; gap: 10px; }
.auto-body h3 { margin: 4px 0 0; font-size: 1.05rem; }
.auto-look { display: flex; align-items: center; gap: 10px; margin: 10px 0; font-size: 1.02rem; }
.auto-strip { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px;
  border: 1px solid var(--line); border-radius: 14px; }
.auto-strip span { display: grid; min-width: 0; }
.auto-strip small { color: var(--muted); }
.auto-body .check { display: flex; align-items: center; gap: 8px; font-weight: 400; }
.auto-body .check input { inline-size: auto; }
.auto-body > .btn.text { justify-self: start; }
.account-sub { margin: 0; font-size: .9rem; color: var(--muted); }
.account-sub.ok { color: var(--ink); }
.account-sub.soon { color: var(--warn); }
#expiredOut { justify-self: center; }

/* the account, at the top of the settings */
.account { display: grid; gap: 12px; padding: 14px; margin: 4px 0 8px; border: 1px solid var(--line); border-radius: 16px; background: var(--body); }
.account-who { display: flex; align-items: center; gap: 12px; min-width: 0; }
.account-who > div { min-width: 0; }
.avatar { flex: none; inline-size: 44px; block-size: 44px; border-radius: 50%; display: grid; place-items: center; background: var(--live-soft); color: var(--live); font-weight: 700; font-size: 1.15rem; }
.account-name { margin: 0; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account .hint { margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.account-actions .btn { flex: 1 1 auto; text-align: center; text-decoration: none; }
.btn.danger-fill { background: var(--warn); border-color: var(--warn); color: var(--body); }
.account-actions a.btn { display: inline-flex; align-items: center; justify-content: center; color: var(--ink); }

/* the owner's admin panel (/admin) */
.admin-page .shell { max-width: 46rem; }
.admin-tag { display: inline-block; margin-inline-start: 4px; padding: 0 10px; border-radius: 999px; background: var(--ink); color: var(--body); font-size: .8rem; vertical-align: middle; }
.admin-back { text-decoration: none; display: inline-flex; align-items: center; }
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 12px 0 6px; }
.stat { display: grid; gap: 0; padding: 12px; border: 1px solid var(--line); border-radius: 14px; background: var(--body); }
.stat b { font-size: 1.35rem; font-variant-numeric: tabular-nums; line-height: 1.3; }
.stat span { font-size: .78rem; color: var(--muted); line-height: 1.35; }
.stat.alert { border-color: var(--warn); }
.stat.alert b { color: var(--warn); }
button.stat { font: inherit; color: inherit; text-align: start; cursor: pointer; transition: transform .1s; }
button.stat:active { transform: scale(.98); }
.admin-show { margin: 8px 0 10px; }
/* one account's subscription, with the owner's buttons */
.sub-box { display: grid; gap: 8px; margin: 12px 0 4px; padding: 14px; border: 1px solid var(--line); border-radius: 16px; }
.sub-box[data-state="expired"], .sub-box[data-state="none"] { border-color: var(--warn); }
.sub-status { margin: 0; font-weight: 600; }
.sub-box[data-state="expired"] .sub-status, .sub-box[data-state="none"] .sub-status { color: var(--warn); }
.sub-box .hint { margin: 0; }
.sub-box .chips { margin: 0; }
.sub-date { display: flex; gap: 8px; }
.sub-date input { flex: 1 1 auto; min-width: 0; }
.sub-box .danger-line { margin-top: 0; }
.audit li.warn span { color: var(--warn); }
.admin-strip .btn.text { justify-self: start; padding-inline: 0; min-height: 36px; }
.admin-tabs button[aria-selected="true"] { background: var(--ink); color: var(--body); font-weight: 600; }
.admin-tabs { margin: 14px 0 10px; }
.admin-filter { margin: 0 0 10px; }
#aFind { margin-bottom: 10px; }
.admin-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.admin-list > li.muted { color: var(--muted); padding: 8px 2px; }
.admin-row { width: 100%; display: flex; align-items: flex-start; gap: 12px; padding: 12px; text-align: start; cursor: pointer;
  border: 1px solid var(--line); border-radius: 14px; background: var(--body); color: var(--ink); font: inherit; }
.admin-row:active { transform: scale(.99); }
.admin-main { display: grid; gap: 1px; min-width: 0; }
.admin-main b { font-weight: 600; }
.admin-main small { color: var(--muted); font-size: .8rem; overflow-wrap: anywhere; }
.avatar.small { inline-size: 38px; block-size: 38px; font-size: 1rem; }
.a-badge { display: inline-block; padding: 0 8px; border-radius: 999px; font-size: .7rem; font-weight: 600; background: var(--line); color: var(--ink); vertical-align: 1px; }
.a-badge.warn { background: var(--warn); color: var(--body); }
.a-badge.live { background: var(--live-soft); color: var(--live); }
.admin-strip { display: flex; gap: 10px; align-items: flex-start; padding: 12px; border: 1px solid var(--line); border-radius: 14px; background: var(--body); }
.admin-list.compact .admin-strip { padding: 10px; }
.a-dot { flex: none; inline-size: 10px; block-size: 10px; margin-top: 8px; border-radius: 50%; background: var(--muted); }
.a-dot.on { background: var(--live); box-shadow: 0 0 6px var(--live); }
.give { display: grid; gap: 4px; margin-top: 6px; font-size: .82rem; color: var(--muted); }
.give select { min-height: 40px; }
.pw-once { margin: 0; padding: 12px; border-radius: 12px; background: var(--live-soft); color: var(--ink); font-weight: 600; overflow-wrap: anywhere; }
.admin-facts { margin: 4px 0 6px; }
@media (max-width: 420px) { .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.admin-title { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; }
.admin-title .a-badge { flex: none; }

/* watches added in Settings */
.watch-list { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 4px; }
.watch-list li { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 44px; }
.watch-list li > span { display: grid; gap: 2px; min-width: 0; }
.watch-list bdi { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.watch-list small { color: var(--muted); font-size: .82rem; }
.watch-list .btn { color: var(--warn); flex: none; }
#watchCode { inline-size: 7.5em; letter-spacing: .3em; text-align: center; font-variant-numeric: tabular-nums; }

/* ---------- energy (Denjin 3.0): what was used, from the server's history ---------- */
.spark { cursor: pointer; }
.sheet.energy { max-height: 94vh; min-height: 72vh; }
.en-head { display: flex; align-items: center; gap: 6px; margin-inline-end: -10px; }
.en-head #enBack { margin-inline-start: -10px; }
.en-titles { flex: 1; min-width: 0; }
.en-titles h2, .en-titles .hint { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.en-titles h2 { margin: 0; }
.en-icon { flex: none; inline-size: 40px; block-size: 40px; display: grid; place-items: center; border-radius: 50%; background: var(--well); color: var(--c, var(--live)); }
.en-icon svg { inline-size: 22px; block-size: 22px; }
.flip { transform-box: fill-box; transform-origin: center; }
[dir="rtl"] .flip { transform: scaleX(-1); }
.en-range { margin-top: 6px; }
.en-nav { display: flex; align-items: center; gap: 4px; margin: 2px -10px 0; }
.en-nav .icon-btn:disabled { opacity: .28; cursor: default; }
.en-when { flex: 1; margin: 0; text-align: center; font-weight: 600; font-size: .95rem; }
.en-body { min-height: 320px; }
.en-main { display: grid; gap: 16px; transition: opacity .2s; }
.en-main.busy { opacity: .45; }
.en-hero { display: grid; }
.en-tl { margin: 0; font-size: .8rem; color: var(--muted); }
.en-big { display: flex; align-items: baseline; gap: 8px; margin: 2px 0 0; line-height: 1.05; }
.en-big b { font-size: 3rem; font-weight: 600; letter-spacing: -.01em; }
.en-big span { font-size: 1rem; color: var(--muted); }
.en-delta { display: flex; align-items: center; gap: 6px; margin: 8px 0 0; font-size: .88rem; color: var(--muted); }
.en-delta svg { flex: none; inline-size: 16px; block-size: 16px; fill: none; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.en-delta.up svg { stroke: var(--warn); }
.en-delta.down svg { stroke: var(--live); }
.en-tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.en-tile { min-width: 0; padding: 10px 12px; border-radius: 14px; background: var(--well); }
.en-tv { margin: 2px 0 0; font-size: 1.02rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.en-tv small { margin-inline-start: 4px; font-size: .74rem; font-weight: 400; color: var(--muted); }
.en-add { display: block; margin: 2px 0 0; padding: 0; border: 0; background: none; cursor: pointer; font-size: .95rem; font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
.en-trio { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.en-trio div { display: grid; padding: 0 4px; }
.en-trio small { color: var(--muted); font-size: .78rem; }
.en-trio b { font-size: .95rem; font-weight: 600; }
.en-chart { margin: 0; }
/* messages from the service (2.4.9) */
.nc-users { display: grid; gap: 4px; max-height: 220px; overflow: auto; padding: 8px; border-radius: 12px; background: var(--well); }
.nc-users[hidden], #ncVersion[hidden], #ncAt[hidden], .nc-preview[hidden] { display: none; }
.nc-preview { display: grid; gap: 8px; margin: 10px 0; }
.ann { display: grid; gap: 4px; margin: 10px 0 0; padding: 12px 14px; border-radius: 14px; background: var(--well); border-inline-start: 4px solid var(--live); }
.ann[hidden] { display: none; }
.ann[data-cat="emergency"], .ann[data-cat="interruption"], .ann[data-cat="important"] { border-inline-start-color: var(--warn); }
.ann-cat { margin: 0; font-size: .76rem; color: var(--muted); }
.ann-title { font-size: .98rem; }
.ann-msg { margin: 0; font-size: .88rem; white-space: pre-line; }
.ann-actions { display: flex; justify-content: flex-end; gap: 6px; margin-top: 4px; }
.ann-list { list-style: none; margin: 0; padding: 0; }
.ann-item { display: grid; gap: 4px; padding: 12px 2px; border-bottom: 1px solid var(--line); }
/* Automatic Voltage Protection (2.4.9) */
.vp-limits { margin: 6px 0; }
.vp-limits dt.vp-off::before, .vp-limits dt.vp-warn::before, .vp-limits dt.vp-ok::before {
  content: ""; display: inline-block; inline-size: 8px; block-size: 8px; margin-inline-end: 6px; border-radius: 50%; vertical-align: 1px;
}
.vp-limits dt.vp-off::before { background: var(--warn); }
.vp-limits dt.vp-warn::before { background: #e0a000; }
.vp-limits dt.vp-ok::before { background: var(--live); }
/* a voltage warning: calm, the person decides */
.vw-card { display: grid; gap: 6px; margin-top: 10px; padding: 12px 14px; border-radius: 14px; background: var(--well);
  border-inline-start: 4px solid #e0a000; }
.vw-card[hidden], .why-list[hidden] { display: none; }
.vw-card b { font-size: .95rem; }
.vw-card p { margin: 0; font-size: .86rem; }
.vw-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 4px; }
/* why something is off */
.why-list { display: grid; gap: 2px; margin: 8px 0 0; padding-inline: 4px; font-size: .8rem; color: var(--muted); }
.why-list .btn.text, .ov-btns .btn.text { min-height: 0; padding: 0 4px; font-size: .8rem; text-decoration: underline; }
.ov-btns { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.why-text { margin: 10px 0 0; font-size: .9rem; }
/* Automatic Overheat Protection (2.4.9) */
.oh-row { display: grid; grid-template-columns: 1fr auto auto; gap: 10px; align-items: center; margin-top: 6px; }
.oh-row input[type="range"] { min-width: 0; accent-color: var(--live); }
.oh-num { display: inline-flex; align-items: center; gap: 4px; }
.oh-num input { inline-size: 4.6em; text-align: center; }
.oh-row :disabled { opacity: .45; }
#ohSection > label { display: block; margin-top: 8px; font-size: .88rem; }
.temp[data-level="elevated"] { color: #d98a00; font-weight: 600; }
.temp[data-level="critical"] { color: var(--warn); font-weight: 700; }
[data-theme="dark"] .temp[data-level="elevated"] { color: #ffb547; }
/* Automatic Overload Protection (2.4.9) */
.ov-banner { display: grid; gap: 8px; margin-top: 10px; padding: 12px 14px; border-radius: 14px; border: 1px solid var(--warn); background: var(--well); }
.ov-banner[hidden] { display: none; }
.ov-text { margin: 0; font-size: .88rem; color: var(--warn); font-weight: 600; }
.ov-banner .btn { justify-self: start; }
.ov-set { display: grid; gap: 8px; }
.ov-set .hint { margin: 0; }
/* voltage history (2.4.9) */
.v-pick { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.v-pick label { display: grid; gap: 4px; font-size: .8rem; color: var(--muted); }
.v-pick select { min-width: 0; }
.v-custom { display: grid; grid-template-columns: 1fr 1fr auto; gap: 8px; align-items: end; margin-top: 8px; }
.v-custom label { display: grid; gap: 4px; font-size: .8rem; color: var(--muted); }
.v-custom input { min-width: 0; }
.v-custom[hidden] { display: none; }
.v-note { margin: 0; font-size: .85rem; color: var(--muted); }
.v-at { margin-top: 2px; font-size: .72rem; }
.en-tile .en-tv small { direction: ltr; }
.v-band { fill: var(--live); fill-opacity: .18; stroke: none; }
.v-line { fill: none; stroke: var(--live); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.v-dot { fill: var(--live); }
.v-gap { fill: var(--muted); fill-opacity: .10; }
.v-limit { stroke: var(--warn); stroke-width: 1; stroke-dasharray: 4 4; stroke-opacity: .7; }
.v-cursor { stroke: var(--ink); stroke-width: 1; stroke-opacity: .5; }
.v-odd { list-style: none; margin: 6px 0 0; padding: 0; }
.v-odd li { display: flex; gap: 12px; padding: 8px 2px; border-bottom: 1px solid var(--line); font-size: .86rem; }
.v-odd time { flex: none; color: var(--muted); font-variant-numeric: tabular-nums; }
.v-odd li.low span, .v-odd li.high span { color: var(--warn); }
@media (max-width: 420px) { .v-custom { grid-template-columns: 1fr 1fr; } .v-custom .btn { grid-column: 1 / -1; } }
.en-cap { margin-bottom: 6px; font-size: .8rem; color: var(--muted); }
.en-plot { position: relative; min-height: 176px; }
.en-svg { display: block; inline-size: 100%; overflow: visible; touch-action: pan-y; direction: ltr; }   /* x and text-anchor as drawn, in both languages */
.en-svg:focus { outline: none; }
.en-svg:focus-visible { outline: 2px solid var(--ink); outline-offset: 4px; border-radius: 6px; }
.en-grid { stroke: var(--line); stroke-width: 1; }
.en-grid.base { stroke: var(--muted); stroke-opacity: .55; }
.en-ytick, .en-xtick { fill: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.en-peak { fill: var(--ink); font-size: 11.5px; font-weight: 600; font-variant-numeric: tabular-nums; }
.en-bar { fill: var(--live); cursor: pointer; transition: opacity .15s, fill .35s; }
.en-bar.dim { opacity: .35; }
.en-tip {
  position: absolute; z-index: 2; display: grid; padding: 6px 10px; border-radius: 10px;
  background: var(--ink); color: var(--body); font-size: .8rem; line-height: 1.35; white-space: nowrap;
  pointer-events: none; box-shadow: 0 4px 14px rgba(0, 0, 0, .18);
}
.en-tip b { font-size: .95rem; }
.en-none { margin: 0; padding: 56px 12px; text-align: center; color: var(--muted); font-size: .9rem; }
.en-table summary { display: flex; align-items: center; min-height: 40px; cursor: pointer; font-size: .86rem; color: var(--muted); }
.en-table table { inline-size: 100%; border-collapse: collapse; font-size: .85rem; font-variant-numeric: tabular-nums; }
.en-table th { padding: 4px 0; border-bottom: 1px solid var(--line); text-align: start; font-size: .78rem; font-weight: 600; color: var(--muted); }
.en-table td { padding: 5px 0; border-bottom: 1px solid var(--line); }
.en-table th:not(:first-child), .en-table td:not(:first-child) { text-align: end; }
.en-list h3 { margin: 4px 0 4px; font-size: .95rem; }
.en-rows { list-style: none; margin: 0; padding: 0; }
.en-row {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; grid-template-areas: "ico who amt" "ico bar bar";
  align-items: center; gap: 4px 12px; inline-size: 100%; padding: 10px 4px;
  border: 0; border-bottom: 1px solid var(--line); background: none; cursor: pointer; text-align: start;
  transition: background-color .15s;
}
.en-row:active { background: var(--well); }
.en-ico { grid-area: ico; inline-size: 38px; block-size: 38px; display: grid; place-items: center; border-radius: 50%; background: var(--well); color: var(--c, var(--live)); }
.en-ico svg { inline-size: 20px; block-size: 20px; }
.en-who { grid-area: who; display: grid; min-width: 0; }
.en-who b, .en-who small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.en-who b, .en-amt b { font-size: .93rem; font-weight: 600; }
.en-who small, .en-amt small { color: var(--muted); font-size: .78rem; }
.en-amt { grid-area: amt; display: grid; text-align: end; font-variant-numeric: tabular-nums; }
.en-share { grid-area: bar; block-size: 4px; border-radius: 2px; background: var(--live-soft); overflow: hidden; }
.en-share i { display: block; block-size: 100%; border-radius: 2px; background: var(--live); }
.en-goal { display: grid; gap: 14px; }
.en-meter { display: grid; gap: 6px; }
.en-ml { display: flex; justify-content: space-between; gap: 10px; margin: 0; font-size: .88rem; }
.en-ml span { color: var(--muted); font-variant-numeric: tabular-nums; }
.en-track { position: relative; block-size: 8px; border-radius: 4px; background: var(--live-soft); }
.en-track .fill { position: absolute; inset-block: 0; inset-inline-start: 0; border-radius: 4px; background: var(--live); }
.en-track .proj { position: absolute; inset-block: -4px; inline-size: 2px; margin-inline-start: -1px; border-radius: 1px; background: var(--ink); }
.en-meter.over .proj { background: var(--warn); }
.en-warn { inline-size: 15px; block-size: 15px; margin-inline-end: 4px; vertical-align: -2px; fill: none; stroke: var(--warn); stroke-width: 2.2; stroke-linejoin: round; stroke-linecap: round; }
.en-link {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; inline-size: 100%; min-height: 44px;
  padding: 8px 12px; border: 1px solid var(--line); border-radius: 12px; background: transparent; cursor: pointer;
  font-size: .9rem; text-align: start;
}
.en-link .go { flex: none; font-weight: 600; }
.en-link .go::after { content: " ›"; }
[dir="rtl"] .en-link .go::after { content: " ‹"; }
#oEnergy { margin-top: 4px; }
.en-msg { display: grid; justify-items: center; gap: 12px; margin: 48px 0; text-align: center; }
.en-msg p { margin: 0; color: var(--muted); }
.en-price input:first-child { flex: 1; }
.en-cur { flex: none !important; inline-size: 5.5em; text-align: center; text-transform: uppercase; }

/* ---------- activity (Denjin 3.0): what happened, day by day, from the server's history ---------- */
.act-open {
  display: flex; align-items: center; justify-content: space-between; inline-size: 100%; min-height: 44px;
  padding: 0; border: 0; background: transparent; cursor: pointer; color: var(--ink);
  font: inherit; font-weight: 600; font-size: .95rem; text-align: start;
}
.act-open::after { content: "›"; color: var(--muted); font-weight: 400; font-size: 1.3rem; line-height: 1; }
[dir="rtl"] .act-open::after { content: "‹"; }
#oActivity { margin-top: 2px; }
.sheet.act { max-height: 94vh; min-height: 72vh; }
.act-filters { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 10px; }
.sheet .act-f { display: grid; gap: 4px; margin: 0; min-width: 0; font-size: .8rem; font-weight: 600; color: var(--muted); }
.act-f select, .act-f input { min-height: 42px; padding: 8px 10px; font-size: .92rem; min-width: 0; }
/* a strip or outlet name too long for its half of the row ends with "…" instead of being cut */
.act-f select { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.act-clear { justify-self: start; }
.act-body { min-height: 30vh; }
.sheet .act-day h3 {
  position: sticky; top: 0; z-index: 1; margin: 10px 0 0; padding: 8px 0 6px;
  background: var(--body); color: var(--muted); font-size: .82rem; font-weight: 600;
}
.act-list { list-style: none; margin: 0; padding: 0; }
.act-row {
  display: grid; grid-template-columns: auto 18px 1fr; align-items: start; gap: 10px;
  padding: 9px 0; border-bottom: 1px solid var(--line); font-size: .9rem; line-height: 1.4;
}
.act-row time { color: var(--muted); font-variant-numeric: tabular-nums; }
.act-ico { inline-size: 18px; block-size: 18px; margin-top: 1px; color: var(--muted); }
.act-ico .line { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.act-row[data-cat="on"] .act-ico, .act-row[data-cat="conn"] .act-ico { color: var(--live); }
.act-row[data-cat="warn"] .act-ico { color: var(--warn); }
.act-none { margin: 48px 0; text-align: center; color: var(--muted); }
.act-note { margin: 4px 0 0; padding: 8px 12px; border-radius: 12px; background: var(--well); font-size: .85rem; }
.act-more { display: flex; justify-content: center; margin: 16px 0 6px; }

/* 2.4.0: the subscription about to end (a banner, not a popup), contact lines, the account's email */
.sub-warn { margin: 0 0 14px; padding: 12px 14px; border-radius: 14px; border: 1px solid var(--warn); background: var(--body);
            color: var(--ink); display: grid; gap: 6px; }
.sub-warn[hidden] { display: none; }
.sub-warn p { margin: 0; font-size: .92rem; line-height: 1.5; }
#subWarnText { font-weight: 600; color: var(--warn); }
.sub-warn .btn.text { justify-self: end; min-height: 32px; padding-inline: 4px; }
.contact { margin: 0; font-size: .88rem; line-height: 1.5; color: var(--muted); }
.contact[hidden] { display: none; }
.contact a { color: var(--live); font-weight: 600; text-decoration: none; word-break: break-all; }
.contact a:hover { text-decoration: underline; }
.welcome .contact, .expired .contact { text-align: center; margin-top: 6px; }
.account-mail { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.account-mail[hidden] { display: none; }
.account-mail .hint { margin: 0; flex-basis: 100%; }
.account-mail .hint.ok { color: var(--live); font-weight: 600; }
.account-mail .hint.warn { color: var(--warn); font-weight: 600; }

/* admin panel > Email (2.4.0) */
.mail-pane { display: grid; gap: 12px; }
.mail-pane[hidden] { display: none; }
#mState[data-state="expired"] { color: var(--warn); }
#mState[data-state="active"] { color: var(--live); }
.mail-form { display: grid; gap: 6px; padding: 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--body); }
.mail-form label { font-weight: 600; font-size: .9rem; margin-top: 4px; }
.mail-form .hint { margin: 0; }
.mail-more summary { cursor: pointer; color: var(--muted); font-size: .9rem; margin-top: 6px; }
.mail-more[open] { display: grid; gap: 6px; }

/* ---------- phone app updates (2.4.3) ---------- */
.upd-notes { margin: 0; padding-inline-start: 1.2em; display: grid; gap: 4px; color: var(--ink); }
.upd-progress { display: grid; gap: 6px; }
.upd-bar { block-size: 8px; border-radius: 999px; background: var(--well); box-shadow: inset 0 0 0 1px var(--line); overflow: hidden; }
.upd-bar i { display: block; block-size: 100%; inline-size: 0; border-radius: inherit; background: var(--live); transition: width .25s ease; }
.upd-progress.busy .upd-bar i { inline-size: 100%; opacity: .55; animation: upd-pulse 1.2s ease-in-out infinite; }
@keyframes upd-pulse { 50% { opacity: .2; } }
.upd-chip { padding-inline: 0; color: var(--live); font-weight: 600; }
.upd-dot { display: inline-block; inline-size: 9px; block-size: 9px; border-radius: 50%; background: var(--live);
  box-shadow: 0 0 0 2px var(--body, transparent); vertical-align: middle; }
.upd-dot[hidden] { display: none; }
#menuBtn { position: relative; }
.upd-dot.on-icon { position: absolute; inset-block-start: 8px; inset-inline-end: 8px; }
.about-upd { display: grid; gap: 8px; margin-block: 6px; }
.upd-state { margin: 0; font-weight: 600; }
.upd-state:empty { display: none; }
.upd-btns { display: flex; flex-wrap: wrap; gap: 8px; }
.upd-link { display: flex; gap: 8px; }
.upd-link input { flex: 1; min-inline-size: 0; }
#updInfo:empty { display: none; }
.mail-form label.check { display: flex; align-items: center; gap: 10px; font-weight: 500; }
.mail-form label.check input { inline-size: 20px; block-size: 20px; min-height: 0; margin: 0; padding: 0; accent-color: var(--live); flex: none; }

/* ======================================================================================================================
   Denjin 2.0 design system (redesign, phase 2). Everything new is here, after the 2.4.9 styles, so it is easy to read
   and to take back out. The themes above stay the source of each person's choice: accent (Jade, Ion, Arc, Amber,
   Plasma), Auto / Light / Dark, background, layout and reading size all keep working as chosen.
   ====================================================================================================================== */
:root {
  /* shape and space */
  --r-card: 18px; --r-ctl: 12px; --r-pill: 999px;
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px;
  /* type */
  --fs-xs: .75rem; --fs-sm: .86rem; --fs-md: 1rem; --fs-lg: 1.18rem; --fs-xl: 1.5rem; --fs-hero: 2.15rem;
  /* states: warning (amber) and danger (red), next to each theme's --live (normal) and --warn (danger) */
  --caution: #B7791F; --caution-soft: #FBEFD5; --danger: var(--warn); --danger-soft: #F9DCDF;
  --card: var(--body);
  --card-shadow: 0 1px 2px rgba(16, 28, 32, .05), 0 6px 18px rgba(16, 28, 32, .06);
  --glow: 0 0 0 transparent;
  --tabbar-h: 64px;
}
/* Dark: the navy surfaces of the 2.0 design, for every accent (each accent keeps its own --live, --aura, --live-soft) */
:root[data-theme="dark"], :root[data-theme="dark"][data-accent] {
  --plastic: #0D161D;
  --body: #17262E;
  --well: #1D2F38;
  --ink: #E6F0EE;
  --muted: #93A8AD;
  --line: #263B45;
  --edge: 0 2px 0 #071015;
  --shine: inset 0 1px 0 rgba(255, 255, 255, .04);
  --caution: #FBBF24; --caution-soft: #3A2E10; --danger-soft: #3C1D21;
  --warn: #F87171;
  --card-shadow: 0 1px 0 rgba(255, 255, 255, .03) inset, 0 8px 24px rgba(0, 0, 0, .28);
  --glow: 0 0 18px color-mix(in srgb, var(--live) 30%, transparent);
}
:root[data-theme="dark"][data-accent="jade"] { --live: #49DDB4; --live-soft: #113A31; }

/* ---------- building blocks (used by the redesigned screens) ---------- */
.c-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-card); box-shadow: var(--card-shadow);
  padding: var(--s4); transition: background-color .35s, border-color .35s; }
.c-title { margin: var(--s5) 0 var(--s2); font-size: var(--fs-sm); font-weight: 600; color: var(--muted); letter-spacing: .01em; }
.c-rows { display: grid; background: var(--card); border: 1px solid var(--line); border-radius: var(--r-card); overflow: hidden;
  box-shadow: var(--card-shadow); }
.c-row { display: flex; align-items: center; gap: var(--s3); min-height: 56px; padding: 10px var(--s4); width: 100%;
  border: 0; background: transparent; text-align: start; cursor: pointer; color: var(--ink); }
.c-row + .c-row { border-top: 1px solid var(--line); }
.c-row:active { background: var(--well); }
.c-row .c-ico { flex: none; display: grid; place-items: center; inline-size: 36px; block-size: 36px; border-radius: 50%;
  background: var(--well); color: var(--live); }
.c-row .c-ico svg { inline-size: 20px; block-size: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.c-row .c-txt { flex: 1; min-width: 0; display: grid; }
.c-row .c-txt b { font-weight: 600; font-size: var(--fs-md); line-height: 1.35; }
.c-row .c-txt small { color: var(--muted); font-size: var(--fs-xs); line-height: 1.4; }
.c-row .c-go { flex: none; color: var(--muted); }
.c-row .c-go svg { inline-size: 18px; block-size: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
:root[dir="rtl"] .c-row .c-go svg { transform: scaleX(-1); }
.c-row.danger, .c-row.danger .c-ico { color: var(--danger); }
.c-pills { display: flex; gap: var(--s2); overflow-x: auto; scrollbar-width: none; }
.c-pills::-webkit-scrollbar { display: none; }
.c-pill { flex: none; min-height: 40px; padding: 6px 14px; border: 1px solid var(--line); border-radius: var(--r-ctl);
  background: var(--card); color: var(--muted); font-size: var(--fs-sm); cursor: pointer; line-height: 1.25; }
.c-pill[aria-current="true"], .c-pill[aria-pressed="true"] { border-color: var(--live); color: var(--ink); font-weight: 600;
  background: color-mix(in srgb, var(--live) 16%, var(--card)); box-shadow: var(--glow); }
.c-tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s3); }
.c-tile { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-card); padding: var(--s3) var(--s4); min-width: 0; }
.c-tile small { display: block; color: var(--muted); font-size: var(--fs-xs); }
.c-tile b { display: block; font-size: var(--fs-lg); font-variant-numeric: tabular-nums; }
.c-tile .ok { color: var(--live); } .c-tile .warn-t { color: var(--caution); } .c-tile .bad { color: var(--danger); }
.c-tile .na { color: var(--muted); }

/* the existing controls, in the 2.0 style (same elements, same behaviour) */
.btn { border-radius: var(--r-ctl); }
.btn.primary { background: var(--live); border-color: var(--live); color: var(--plastic); font-weight: 600; }
.seg { border-radius: var(--r-ctl); background: var(--card); }
.seg button[aria-pressed="true"] { background: var(--live); color: var(--plastic); }
.btn.danger-line { border-radius: var(--r-ctl); background: color-mix(in srgb, var(--danger) 8%, transparent); }

/* ---------- the bottom bar: Home · Energy · Safety · Settings ---------- */
.tabbar {
  position: fixed; z-index: 20; inset-inline: 0; inset-block-end: 0;
  display: grid; grid-template-columns: repeat(4, 1fr);
  padding: 6px max(8px, env(safe-area-inset-left, 0px)) calc(6px + env(safe-area-inset-bottom, 0px)) max(8px, env(safe-area-inset-right, 0px));
  background: color-mix(in srgb, var(--body) 92%, transparent);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  border-top: 1px solid var(--line);
}
.tabbar button {
  display: grid; justify-items: center; gap: 2px; min-height: 52px; padding: 6px 2px 4px;
  border: 0; background: none; cursor: pointer; color: var(--muted); font-size: var(--fs-xs); line-height: 1.2;
  position: relative; border-radius: var(--r-ctl);
}
.tabbar svg { inline-size: 24px; block-size: 24px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.tabbar button[aria-current="page"] { color: var(--live); font-weight: 600; }
.tabbar button[aria-current="page"] svg { filter: drop-shadow(0 0 6px color-mix(in srgb, var(--live) 45%, transparent)); }
.tabbar button:active { background: var(--well); }
.tabbar .upd-dot { position: absolute; inset-block-start: 6px; inset-inline-end: calc(50% - 18px); }
body.tabs .shell { padding-bottom: calc(var(--tabbar-h) + 24px + env(safe-area-inset-bottom, 0px)); }
body.tabs #energyBtn, body.tabs #menuBtn { display: none; }   /* their places are in the bottom bar now */

/* ---------- pages: a sheet shown as a full screen under the bottom bar (Energy, Safety, Settings) ---------- */
dialog.page[open] {
  position: fixed; z-index: 10; inset: 0 0 calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px)) 0;
  inline-size: 100%; max-inline-size: none; block-size: auto; max-block-size: none; min-block-size: 0;
  margin: 0; border-radius: 0; overflow-y: auto; overscroll-behavior: contain;
  background: var(--plastic); transform: none; transition: none;
}
dialog.page > .sheet-in, dialog.page > form.sheet-in { max-inline-size: 34rem; margin: 0 auto;
  padding-top: calc(18px + env(safe-area-inset-top, 0px)); padding-bottom: 28px; }
dialog.page h2 { font-size: var(--fs-xl); }
body:not(.tabs) dialog.page[open] { inset-block-end: 0; }

/* ---------- 2.0 Home (phase 3) ---------- */
.top { align-items: center; margin-bottom: var(--s4); }
h1 { display: flex; align-items: center; gap: 6px; font-size: var(--fs-xl); letter-spacing: -.01em; }
.brand-bolt { flex: none; inline-size: 26px; block-size: 26px; fill: var(--live); filter: drop-shadow(0 0 6px color-mix(in srgb, var(--live) 50%, transparent)); }
.home-status { display: flex; align-items: center; gap: 6px; margin: 2px 0 0; color: var(--muted); font-size: var(--fs-sm); }
.home-status .dot { inline-size: 8px; block-size: 8px; border-radius: 50%; background: var(--muted); }
.home-status[data-state="ok"] .dot { background: var(--live); box-shadow: 0 0 6px var(--live); }
.home-status[data-state="some"] .dot { background: var(--caution); }
#bellBtn { position: relative; }
.bell-dot { position: absolute; inset-block-start: 9px; inset-inline-end: 10px; inline-size: 9px; block-size: 9px; border-radius: 50%;
  background: var(--danger); box-shadow: 0 0 0 2px var(--plastic); }

/* the Live power card: total, the last minute, outlets on, strips online (a tap: Energy) */
.live { padding: 0; margin-bottom: var(--s3); overflow: hidden; }
.live-in { display: grid; gap: 2px; inline-size: 100%; padding: var(--s4); border: 0; background: none; text-align: start; cursor: pointer; color: var(--ink); }
.live-in:active { background: var(--well); }
.live-label { font-size: var(--fs-sm); color: var(--muted); }
.live-row { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: end; gap: var(--s4); }
.live-w { font-size: var(--fs-hero); font-weight: 600; line-height: 1.1; color: var(--live); font-variant-numeric: tabular-nums; white-space: nowrap;
  text-shadow: 0 0 18px color-mix(in srgb, var(--live) 35%, transparent); }
.live .spark { margin: 0; block-size: 44px; }
.live .summary { margin: 4px 0 0; min-height: 0; font-size: var(--fs-sm); color: var(--caution); }
.live .summary.quiet { display: none; }
.live .summary .fleet { display: none; }
.live-stats { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s3); margin-top: var(--s3); padding-top: var(--s3); border-top: 1px solid var(--line); }
.live-stat { font-size: var(--fs-sm); color: var(--muted); font-variant-numeric: tabular-nums; }

/* the safety line (a tap: Safety) */
.safety-line { display: flex; align-items: center; gap: var(--s3); inline-size: 100%; margin-bottom: var(--s4); padding: 12px var(--s4);
  cursor: pointer; text-align: start; color: var(--ink); font-size: var(--fs-sm); font-weight: 600; }
.safety-line .sl-ico svg { inline-size: 24px; block-size: 24px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; display: block; }
.safety-line .sl-text { flex: 1; min-width: 0; }
.safety-line .c-go svg { inline-size: 18px; block-size: 18px; fill: none; stroke: var(--muted); stroke-width: 2; stroke-linecap: round; display: block; }
:root[dir="rtl"] .safety-line .c-go svg { transform: scaleX(-1); }
.safety-line[data-level="ok"] { border-color: color-mix(in srgb, var(--live) 45%, var(--line)); background: color-mix(in srgb, var(--live) 9%, var(--card)); }
.safety-line[data-level="ok"] .sl-ico { color: var(--live); }
.safety-line[data-level="warn"] { border-color: color-mix(in srgb, var(--caution) 55%, var(--line)); background: color-mix(in srgb, var(--caution) 10%, var(--card)); }
.safety-line[data-level="warn"] .sl-ico { color: var(--caution); }
.safety-line[data-level="warn"] .sl-tick, .safety-line[data-level="bad"] .sl-tick { display: none; }
.safety-line[data-level="bad"] { border-color: var(--danger); background: color-mix(in srgb, var(--danger) 12%, var(--card)); }
.safety-line[data-level="bad"] .sl-ico { color: var(--danger); }

/* banners: the same messages, as cards */
.notice, .ann, .sub-warn { border-radius: var(--r-card); }

/* rooms: pills with their count */
.rooms { gap: var(--s2); margin: 0 0 var(--s3); padding: 0; border-bottom: 0; }
.rooms button { min-height: 40px; padding: 6px 14px; margin: 0; border: 1px solid var(--line); border-radius: var(--r-ctl);
  background: var(--card); color: var(--muted); font-size: var(--fs-sm); line-height: 1.25; }
.rooms button[aria-current="true"] { border-color: var(--live); color: var(--ink);
  background: color-mix(in srgb, var(--live) 16%, var(--card)); box-shadow: var(--glow); }
.tools { margin-bottom: var(--s2); }
.tip { border-radius: var(--r-card); }

/* a strip: one card (the list layout keeps its compact rows) */
.list { gap: var(--s4); }
.strip:not(.compact) { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-card); box-shadow: var(--card-shadow);
  padding: 14px 14px 12px; transition: background-color .35s, border-color .35s; }
.list.dense .strip:not(.compact) { padding: 10px; }
.strip:not(.compact) .strip-head { margin-bottom: 2px; }
.strip-name { font-size: var(--fs-lg); }
.strip:not(.compact) .strip-total { margin: 0 0 var(--s3); padding: 0; color: var(--live); font-size: var(--fs-md); }
.strip:not(.compact) .bar { background: color-mix(in srgb, var(--plastic) 55%, var(--card)); border: 1px solid var(--line); border-radius: 16px;
  box-shadow: none; padding: 12px 6px 8px; }
.strip-foot { gap: var(--s2); margin-top: var(--s3); padding: 0; }
.strip-foot > span:not(:empty) { padding: 3px 10px; border-radius: var(--r-pill); background: var(--well); }
.all-btn { border-radius: var(--r-ctl); min-height: 46px; }
.strip.compact .strip-head { border-radius: var(--r-card); background: var(--card); box-shadow: var(--card-shadow); }

/* ---------- 2.0 Strip management and Outlet details (phase 4) ---------- */
dialog.page.sub[open] { z-index: 11; }
.pg-head { display: flex; align-items: center; gap: var(--s2); margin: 0 0 var(--s2); min-height: 44px; }
.pg-head h2 { margin: 0; font-size: var(--fs-xl); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pg-back { margin-inline-start: -10px; }
.pg-back svg { inline-size: 24px; block-size: 24px; }
:root[dir="rtl"] .pg-back svg { transform: scaleX(-1); }
.pg-sub { margin: 0; color: var(--muted); font-size: var(--fs-sm); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.st-sum { display: grid; gap: var(--s3); margin-bottom: var(--s4); }
.st-who { display: flex; align-items: center; gap: var(--s3); min-width: 0; }
.st-ico { flex: none; inline-size: 44px; block-size: 44px; border-radius: 50%;
  background: color-mix(in srgb, var(--live) 18%, var(--well)); border: 2px solid var(--live); box-shadow: var(--glow); }
.st-names { display: grid; min-width: 0; }
.st-names b { font-size: var(--fs-lg); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.st-names small { color: var(--muted); font-size: var(--fs-sm); }
.st-tiles, .o-tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s2); }
.st-tiles .c-tile, .o-tiles .c-tile { padding: var(--s2) var(--s3); background: color-mix(in srgb, var(--plastic) 45%, var(--card)); }
.st-tiles .c-tile b, .o-tiles .c-tile b { font-size: var(--fs-md); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.st-tiles .c-tile b:not(.na), .o-tiles .c-tile b:not(.na) { color: var(--live); }
.st-danger { margin-top: var(--s4); border-color: color-mix(in srgb, var(--danger) 45%, var(--line)); }

/* the Edit strip sheet: one section of Strip management at a time (data-mode); a new strip: all of it */
#editForm:not([data-mode="all"]) .em { display: none; }
#editForm[data-mode="general"] .em-general, #editForm[data-mode="outlets"] .em-outlets,
#editForm[data-mode="timers"] .em-timers, #editForm[data-mode="protect"] .em-protect,
#editForm[data-mode="energy"] .em-energy, #editForm[data-mode="tech"] .em-tech { display: grid; }
#editForm[data-mode="general"] .em-save, #editForm[data-mode="outlets"] .em-save { display: flex; }
#editForm[data-mode="timers"] .em-done, #editForm[data-mode="protect"] .em-done,
#editForm[data-mode="energy"] .em-done, #editForm[data-mode="tech"] .em-done { display: flex; }
#editForm[data-mode="all"] .em-done, #editForm[data-mode="all"] .o-power, #editForm[data-mode="all"] .o-cur { display: none; }
#editForm .em-general { gap: 8px; }
#editForm[data-mode="energy"] #eVolts { display: block; }
/* Manage outlets: name, icon and color, and the outlet's switch; Timers: the outlet and its button */
#editForm[data-mode="outlets"] .outlet-row .row, #editForm[data-mode="outlets"] .o-cur { display: none; }
#editForm[data-mode="timers"] .outlet-row .name-row, #editForm[data-mode="timers"] .o-power { display: none; }
#editForm[data-mode="timers"] .outlet-row > label { display: none; }
.outlet-row { position: relative; }
.o-cur { margin: 0; font-weight: 600; }
.o-power { position: absolute; inset-block-start: 0; inset-inline-end: 0; }
.o-power.pending { opacity: .6; }
#editForm[data-mode="timers"] .outlet-row { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); }
#editForm[data-mode="timers"] .outlet-row .row { margin: 0; }
#editForm[data-mode]:not([data-mode="all"]) legend { display: none; }

/* Outlet details */
#outlet .o-head { margin-top: 0; }
.o-tiles { margin: var(--s2) 0; }
.o-tabs { margin-top: var(--s3); }
.o-sec { display: grid; gap: 8px; }
.o-sec[hidden] { display: none; }

/* ---------- 2.0 Settings (phase 5): a list of categories; each one shows its own settings ---------- */
.cat-list { display: grid; gap: 2px; }
.cat-list .c-title { margin-top: var(--s4); }
.cat-list .c-rows + .c-title { margin-top: var(--s5); }
.cat-list .upd-dot { margin-inline-end: 4px; }
section.cat { display: grid; gap: 8px; }
section.cat[hidden] { display: none; }
section.cat .pg-head { margin-bottom: var(--s1); }
section.cat .pg-head h2 { font-size: var(--fs-xl); }
section.cat > h3:first-of-type { margin-top: var(--s2); }
/* the page's own bottom buttons: Sign out stays under the list; Done is the bottom bar's Home now */
body.tabs #menu > .sheet-in > .actions .btn[data-close] { display: none; }
#menu[data-cat] > .sheet-in > .actions { display: none; }
#menu > .sheet-in > .actions { margin-top: var(--s5); }
#logout { inline-size: 100%; color: var(--danger); border-color: color-mix(in srgb, var(--danger) 45%, var(--line)); }

/* ---------- 2.0 Safety Center (phase 6): live state above the safety history ---------- */
.sc-hero { display: flex; align-items: center; gap: var(--s4); padding: var(--s4) var(--s5); margin-bottom: var(--s3); }
.sc-ico svg { display: block; inline-size: 48px; block-size: 48px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.sc-words { display: grid; min-width: 0; }
.sc-words b { font-size: var(--fs-xl); line-height: 1.2; }
.sc-words small { color: var(--muted); font-size: var(--fs-sm); }
.sc-hero .sc-bang { display: none; }
.sc-hero[data-level="ok"] { color: var(--live); border-color: color-mix(in srgb, var(--live) 55%, var(--line));
  background: linear-gradient(135deg, color-mix(in srgb, var(--live) 20%, var(--card)), var(--card)); box-shadow: var(--glow), var(--card-shadow); }
.sc-hero[data-level="ok"] .sc-words b { color: var(--live); }
.sc-hero[data-level="warn"] { color: var(--caution); border-color: color-mix(in srgb, var(--caution) 55%, var(--line));
  background: color-mix(in srgb, var(--caution) 10%, var(--card)); }
.sc-hero[data-level="bad"] { color: var(--danger); border-color: var(--danger); background: color-mix(in srgb, var(--danger) 12%, var(--card)); }
.sc-hero[data-level="warn"] .sc-tick, .sc-hero[data-level="bad"] .sc-tick, .sc-hero[data-level="na"] .sc-tick { display: none; }
.sc-hero[data-level="warn"] .sc-bang, .sc-hero[data-level="bad"] .sc-bang { display: inline; }
.sc-hero[data-level="na"] { color: var(--muted); }
.sc-hero .sc-words b { color: var(--ink); }
.sc-hero[data-level="ok"] .sc-words b { color: var(--live); }
.sc-tiles { margin-bottom: var(--s2); }
.sc-tiles .c-tile b { font-size: var(--fs-lg); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sc-note { display: block; font-size: var(--fs-xs); font-weight: 600; }
.sc-tiles [data-level="ok"] .sc-note { color: var(--live); }
.sc-tiles [data-level="warn"] .sc-note { color: var(--caution); }
.sc-tiles [data-level="bad"] .sc-note, .sc-tiles [data-level="bad"] b { color: var(--danger); }
.sc-tiles [data-level="na"] .sc-note, .sc-tiles [data-level="na"] b { color: var(--muted); }
.sc-alerts { display: grid; gap: var(--s2); }
.sc-alert { padding: var(--s3) var(--s4); border-radius: var(--r-card); border: 1px solid var(--line); background: var(--card); }
.sc-alert[data-level="bad"] { border-color: var(--danger); background: color-mix(in srgb, var(--danger) 10%, var(--card)); }
.sc-alert[data-level="warn"] { border-color: color-mix(in srgb, var(--caution) 55%, var(--line)); background: color-mix(in srgb, var(--caution) 8%, var(--card)); }
.sc-alert p { margin: 2px 0 0; font-size: var(--fs-sm); }
.sc-btns { display: flex; gap: var(--s2); justify-content: flex-end; margin-top: var(--s2); }
.sc-more { margin-top: var(--s3); }
#sfSheet .ann-list { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-card); padding: 0 var(--s4); }
body.tabs #sfClose, body.tabs #enClose { display: none; }      /* the bottom bar's Home closes them */

/* ---------- 2.0 Energy (phase 6): the same parts, as cards ---------- */
#energy .en-range { margin-top: var(--s2); }
#energy .en-main, #energy .en-chart, #energy .en-list, #energy .en-goal, #voltage .en-chart, #voltage .en-list {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r-card); box-shadow: var(--card-shadow); padding: var(--s4); }
#energy .en-main { display: grid; gap: var(--s3); }
#energy .en-main .en-chart, #energy .en-main .en-list, #energy .en-main .en-goal { box-shadow: none; }
#energy .en-big b { color: var(--live); text-shadow: 0 0 18px color-mix(in srgb, var(--live) 30%, transparent); }
#energy .en-tile { background: color-mix(in srgb, var(--plastic) 45%, var(--card)); border-radius: var(--r-ctl); }
.sc-hero, .sc-alert, .safety-line { transition: none; }   /* a state color shows at once (a color-mix transition can stall) */
/* a strip name in the other script (dir="auto") still lines up with the page's side */
:root[dir="rtl"] .strip-name { text-align: right; }
:root[dir="ltr"] .strip-name { text-align: left; }
/* a long strip name never makes the card wider than the screen (it is cut with "…" instead) */
.list { grid-template-columns: minmax(0, 1fr); }
.strip { min-width: 0; }
