/* Mishaka: a calm home utility, mobile first. A flat gray page, navy for what's active, colour only where a device is
   doing something. The tokens, corner scale and states are in docs/design-records/look-redesign.md. */

/* Inter for English, Noto Sans Hebrew for what the family types in Hebrew (both SIL Open Font License, fonts/OFL.txt):
   one variable face per script, loaded only for the characters in use. */
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("../fonts/inter-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("../fonts/inter-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Noto Sans Hebrew";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("../fonts/noto-sans-hebrew.woff2") format("woff2");
  unicode-range: U+0307-0308, U+0590-05FF, U+200C-2010, U+20AA, U+25CC, U+FB1D-FB4F;
}

:root {
  --bg: #eef1f5;
  --surface: #ffffff;
  --surface-2: #f8f9fb;
  --raised: #ffffff;
  --track: #d7dbe2;
  --text: #111a2e;
  --muted: #5b6473;
  --faint: #a3abb5;
  --line: rgb(17 26 46 / 7%);
  --brand: #13294b;
  --brand-strong: #0f2140;
  --brand-soft: #e3e8f1;
  --on-brand: #ffffff;
  /* The one orange in the app: the goldfish of the icon, as the unread dot. */
  --signal: #f0883e;
  --bad: #dc2626;
  --bad-soft: #fde8e8;
  --warn: #b45309;
  --warn-soft: #fdf1dc;
  --info: #2563eb;
  --info-soft: #e3ecfb;
  --glass: rgb(255 255 255 / 90%);
  --toast-bg: #111a2e;
  --toast-text: #eef1f5;
  --toast-action: #8fd3c7;
  /* A card at rest has a hairline, not a shadow; one that is on, or needs you, lifts off the page. A lit device tile
     is white with dark words in both themes: that is what says "on" at a glance. */
  --surface-lit: #ffffff;
  --text-lit: #111a2e;
  --muted-lit: #5b6473;
  --kicon-off: rgb(17 26 46 / 8%);
  --shadow: 0 0 0 1px var(--line);
  --shadow-on: 0 8px 24px rgb(30 41 59 / 10%);
  --shadow-lg: 0 18px 50px rgb(14 26 31 / 18%);
  /* The corner scale: tiles and cards, then buttons and chips, then the camera tiles and sheets. Never more than a
     seventh of the element's height; circles stay circles (see docs/design-records/look-redesign.md). */
  --radius: 10px;
  --radius-sm: 8px;
  --radius-lg: 12px;
  --tab-h: 58px;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  /* The type scale: every text size is one of these (emoji and icons size to their boxes instead). */
  --fs-xs: 11px;
  --fs-sm: 13px;
  --fs-md: 15px;
  --fs-base: 16px;
  --fs-lg: 17px;
  --fs-xl: 20px;
  --fs-2xl: 28px;
  --fs-3xl: 32px;
  --on-bad: #ffffff;
  /* The Home tab: what a device is doing, as a colour. Each state has the colour of its icon circle and a darker one
     for its words. Heat is redder than --warn, so a heating air conditioner never reads as one that needs a look. */
  --cool: #2563eb;
  --cool-text: #1d4ed8;
  --cool-soft: #e3ecfb;
  --heat: #ea580c;
  --heat-text: #c2410c;
  --heat-soft: #fbe7dd;
  --run: #0d9488;
  --run-text: #0f766e;
  --warn-circle: #d97706;
  /* The sky on the weather icons. */
  --sun: #f59e0b;
  --storm: #6d28d9;
  /* Words over a photo or a camera on black, the same in both themes. */
  --viewer-ink: #f4f6f7;
  color-scheme: light;
}

/* The page always carries data-theme: index.html sets it before the first paint from the saved choice or the phone's
   scheme, and mishaka.js keeps it in step. One dark palette, not one per way of asking for it. */
:root[data-theme="dark"] {
  /* Navy-black, to match the icon. */
  --bg: #0e1420;
  --surface: #161c29;
  --surface-2: #1c2331;
  --raised: #242c3b;
  --track: #2a3344;
  --text: #eef1f6;
  --muted: #a3abb8;
  --faint: #566070;
  --line: rgb(255 255 255 / 10%);
  /* The brand turns light on dark: navy on navy-black would vanish. Buttons go light with dark words, as the tab does. */
  --brand: #dfe6f3;
  --brand-strong: #ffffff;
  --brand-soft: rgb(255 255 255 / 12%);
  --on-brand: #0e1420;
  --bad: #ff7b6b;
  --bad-soft: #3a1a16;
  --warn: #f2b544;
  --warn-soft: #3a2a0e;
  --info: #8ab4ff;
  --info-soft: #172554;
  --glass: rgb(14 20 32 / 90%);
  --toast-bg: #eef1f6;
  --toast-text: #111a2e;
  --toast-action: #0f3d3e;
  --surface-lit: #f3f5fa;
  --kicon-off: rgb(255 255 255 / 14%);
  --shadow: 0 0 0 1px var(--line);
  --shadow-on: 0 10px 28px rgb(0 0 0 / 35%);
  --on-bad: #2a0c08;
  --shadow-lg: 0 18px 50px rgb(0 0 0 / 55%);
  --cool: #86b4ff;
  --cool-text: #a9c7ff;
  --cool-soft: #14284a;
  --heat: #ff9b5c;
  --heat-text: #ffb088;
  --heat-soft: #3e2210;
  --run: #5fd3c0;
  --run-text: #8fe0d2;
  --warn-circle: #f2b544;
  --sun: #fbbf24;
  --storm: #a78bfa;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--text); }
body {
  font-family: Inter, "Noto Sans Hebrew", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  font-size: var(--fs-base);
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--brand); }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
/* Blazor focuses each new page's heading for screen readers; that focus needs no ring. */
[tabindex="-1"]:focus { outline: none; }
::selection { background: var(--brand-soft); }

.icon {
  width: 22px;
  height: 22px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ---------- shell ---------- */
.app { min-height: 100dvh; }
.content {
  max-width: 640px;
  margin: 0 auto;
  padding: calc(env(safe-area-inset-top) + 8px) 14px 32px;
  animation: page-in 0.3s var(--ease);
}
.content.with-nav { padding-block-end: calc(var(--tab-h) + env(safe-area-inset-bottom) + 16px); }
@keyframes page-in { from { opacity: 0; transform: translateY(6px); } }

/* Header: a large title on the four main screens, a back row with a smaller title everywhere else. */
.topbar { display: flex; align-items: center; gap: 4px; min-height: 52px; padding: 4px 0 8px 6px; }
.topbar .titles { flex: 1; min-width: 0; }
.topbar h1 { margin: 0; font-size: var(--fs-xl); line-height: 1.2; font-weight: 600; letter-spacing: -0.01em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar.root { align-items: flex-start; padding-block: 10px 12px; }
.topbar.root h1 { font-size: var(--fs-3xl); line-height: 1.1; letter-spacing: -0.025em; white-space: normal; }
.topbar .sub { margin-top: 3px; font-size: var(--fs-md); color: var(--muted); }
.topbar.has-back { padding-inline-start: 0; }
.topbar .icon-btn { margin-top: 0; }
.topbar.root .icon-btn { margin-top: 2px; }

/* A flat bar across the bottom, the page scrolling under it. The + that used to float beside it is in the top bar. */
.tabbar {
  position: fixed;
  inset-inline: 0;
  inset-block-end: 0;
  padding-block-end: env(safe-area-inset-bottom);
  background: var(--glass);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  box-shadow: inset 0 1px 0 var(--line);
  z-index: 20;
}
.bottom-nav {
  max-width: 612px;
  margin-inline: auto;
  height: var(--tab-h);
  display: grid;
  grid-template-columns: repeat(var(--tabs, 4), 1fr);
  align-items: center;
}
.bottom-nav a {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding-block: 6px;
  color: var(--muted);
  text-decoration: none;
  font-size: var(--fs-xs);
  white-space: nowrap;
  font-weight: 500;
  transition: color 0.15s;
}
.bottom-nav a.active { color: var(--brand); font-weight: 600; }
.bottom-nav a .icon { width: 24px; height: 24px; }
.nav-dot { position: absolute; inset-block-start: 6px; inset-inline-start: calc(50% + 9px); width: 7px; height: 7px; border-radius: 50%; background: var(--signal); }

/* ---------- surfaces ---------- */
.section-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  min-height: 20px;
  margin: 22px 8px 8px;
  font-size: var(--fs-sm);
  font-weight: 500;
  color: var(--muted);
}
.section-title .btn.ghost { min-height: 40px; margin-block: -8px; padding: 0 8px; font-size: var(--fs-sm); }
.card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  margin-block-end: 12px;
}
.card.flat { box-shadow: none; border: 1px solid var(--line); }
.card.tap { cursor: pointer; }
.card.tap:active { background: var(--surface-2); }
.card.highlight { box-shadow: 0 0 0 2px var(--brand), var(--shadow); }
.group {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-block-end: 12px;
  overflow: hidden;
}
.group > .item-row:first-child { border-start-start-radius: var(--radius); border-start-end-radius: var(--radius); }

/* A row in a group: leading control or avatar, the text, something at the end. Hairlines start at the text. */
.item-row {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 56px;
  padding: 10px 14px;
  color: inherit;
  text-decoration: none;
  -webkit-user-select: none;
  user-select: none;
}
.item-row + .item-row::before {
  content: "";
  position: absolute;
  inset-block-start: 0;
  inset-inline: var(--inset, 50px) 0;
  height: 1px;
  background: var(--line);
}
.group.flush { --inset: 14px; }
.group.people { --inset: 62px; }
.group.rings { --inset: 78px; }
button.item-row { width: 100%; border: 0; background: none; font: inherit; color: inherit; text-align: start; }
/* A row's words as the button that opens it, beside the row's own controls: looking just like the words. */
button.grow { margin: 0; padding: 0; border: 0; background: none; font: inherit; color: inherit; text-align: start; }
a.item-row, button.item-row, .item-row.tap { cursor: pointer; transition: background 0.12s; }
.item-row.danger { color: var(--bad); }
.item-row.danger .lead-icon { color: var(--bad); }
.item-row.accent { color: var(--brand); font-weight: 500; }
.item-row.accent .lead-icon { color: var(--brand); }
a.item-row:active, button.item-row:active, .item-row.tap:active { background: var(--surface-2); }
.unread-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--brand); }
.lead-time { width: 44px; flex: none; color: var(--muted); font-size: var(--fs-md); font-variant-numeric: tabular-nums; }
.checklist { --inset: 0px; }
.checklist .item-row { padding-inline: 0; }
.checklist .grow { cursor: default; }
.item-row.top { align-items: flex-start; }
.item-row .grow { cursor: pointer; }
.item-row .chevron { color: var(--faint); width: 18px; height: 18px; }
.item-row .lead-icon { width: 24px; display: grid; place-items: center; color: var(--muted); flex: none; }
.name { overflow-wrap: anywhere; }
.meta { display: flex; align-items: center; flex-wrap: wrap; gap: 3px 6px; margin-top: 2px; font-size: var(--fs-sm); color: var(--muted); }
.meta .icon { width: 14px; height: 14px; }
.meta .late { color: var(--bad); }

/* The circle that finishes a task or puts an item in the cart. The hit area is larger than the circle. */
.check {
  position: relative;
  width: 24px;
  height: 24px;
  padding: 0;
  border-radius: 50%;
  border: 1.8px solid var(--muted);
  background: transparent;
  color: var(--on-brand);
  display: grid;
  place-items: center;
  flex: none;
  transition: background 0.18s, border-color 0.18s;
}
.check::after { content: ""; position: absolute; inset: -10px; }
.check .icon { width: 14px; height: 14px; stroke-width: 3; opacity: 0; transform: scale(0.4); transition: opacity 0.18s, transform 0.18s; }
.check.on { background: var(--brand); border-color: var(--brand); animation: pop 0.34s cubic-bezier(0.3, 1.6, 0.5, 1); }
.check.on .icon { opacity: 1; transform: none; }
.check:disabled { opacity: 0.5; }
.item-row.checked .name, .item-row.checked .title-line { color: var(--faint); }
.item-row.checked .name { text-decoration: line-through; }
.item-row.checked .meta { color: var(--faint); }
@keyframes pop { 0% { transform: scale(0.72); } 60% { transform: scale(1.14); } 100% { transform: scale(1); } }

.row { display: flex; align-items: center; gap: 12px; }
.row.between { justify-content: space-between; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.grow { flex: 1; min-width: 0; }
.muted { color: var(--muted); }
.small { font-size: var(--fs-sm); }
.big { font-size: var(--fs-lg); font-weight: 600; letter-spacing: -0.01em; }
.title-line { font-weight: 500; overflow-wrap: anywhere; }
.center { text-align: center; }
.mt { margin-block-start: 12px; }
.mb { margin-block-end: 12px; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ltr { direction: ltr; unicode-bidi: isolate; }
.tabular { font-variant-numeric: tabular-nums; }
/* ---------- buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  padding: 0 18px;
  border: 0;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--text);
  font-size: var(--fs-md);
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
  transition: transform 0.12s var(--ease), background 0.15s, opacity 0.15s;
}
.btn:active:not(:disabled) { transform: scale(0.97); }
.btn:disabled { opacity: 0.45; cursor: default; }
.btn .icon { width: 19px; height: 19px; }
.btn.primary { background: var(--brand); color: var(--on-brand); }
.btn.soft { background: var(--brand-soft); color: var(--brand-strong); }
.btn.danger { background: var(--bad-soft); color: var(--bad); }
.btn.ghost { background: transparent; color: var(--brand); padding: 0 10px; }
.btn.ghost.danger { color: var(--bad); }
.btn.block { display: flex; width: 100%; }
.btn.lg { min-height: 54px; border-radius: var(--radius); font-size: var(--fs-lg); font-weight: 600; }
.btn.sm { min-height: 38px; padding: 0 14px; border-radius: var(--radius-sm); font-size: var(--fs-md); }
.card .btn:not(.primary):not(.soft):not(.danger):not(.ghost), .sheet .btn:not(.primary):not(.soft):not(.danger):not(.ghost) { background: var(--surface-2); }
.icon-btn {
  position: relative;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--text);
  display: grid;
  place-items: center;
  flex: none;
  text-decoration: none;
  transition: background 0.12s;
}
.icon-btn:active { background: var(--surface-2); }
/* Tap feedback where there's no other: the page turns off the browser's own flash. */
.chip:active, .segmented button:active, .pick:active, .bottom-nav a:active, .toggle:active, .row-main:active, .suggest button:active { opacity: 0.7; }
.icon-btn.tinted { width: 40px; height: 40px; border-radius: var(--radius); background: var(--surface-2); color: var(--muted); }
.icon-btn.tinted .icon { width: 18px; height: 18px; }
.dot {
  position: absolute;
  inset-block-start: 3px;
  inset-inline-end: 1px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--bad);
  color: var(--on-bad);
  font-size: var(--fs-xs);
  font-weight: 600;
  display: grid;
  place-items: center;
  box-shadow: 0 0 0 2px var(--bg);
}
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-block-start: 12px; }
.actions .btn { flex: 1 1 auto; }
.actions.pills { gap: 6px; margin-block-start: 10px; }
.actions.pills .btn { flex: none; min-height: 40px; padding: 0 16px; border-radius: var(--radius-sm); font-size: var(--fs-sm); }

/* ---------- chips ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips.scroll { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin-inline: -14px; padding-inline: 14px; }
.chips.scroll::-webkit-scrollbar { display: none; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font-size: var(--fs-md);
  white-space: nowrap;
  -webkit-user-select: none;
  user-select: none;
  transition: background 0.15s, border-color 0.15s;
}
.chip.on { background: var(--brand-soft); border-color: transparent; color: var(--brand-strong); font-weight: 500; }
.chip:disabled { opacity: 0.4; }
.chip.add::before { content: "+"; color: var(--brand); font-weight: 600; }
.chip.swatch { width: 34px; padding: 0; border: 0; background: var(--swatch); }
.chip.swatch.on { background: var(--swatch); box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--swatch); }

/* Status is a coloured dot and a word, not a badge on every row. */
.status { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-sm); color: var(--muted); white-space: nowrap; }
.status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex: none; }
.status.good { color: var(--brand); }
.status.bad { color: var(--bad); }
.status.info { color: var(--info); }
.status.warn { color: var(--warn); }

/* ---------- segmented ---------- */
.segmented { display: flex; gap: 2px; padding: 3px; border-radius: var(--radius-sm); background: var(--surface-2); }
.segmented button {
  flex: 1;
  min-height: 38px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: var(--fs-md);
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
}
.segmented button.on { background: var(--raised); color: var(--text); box-shadow: 0 1px 3px rgb(0 0 0 / 12%); }
.segmented button:disabled { opacity: 0.4; }

/* ---------- avatars ---------- */
/* A member's initial, white on their colour. */
.avatar { position: relative; width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; flex: none; font-size: var(--fs-md); font-weight: 700; line-height: 1; color: #fff; }
.avatar.sm { width: 26px; height: 26px; font-size: 12px; }
.avatar.xs { width: 20px; height: 20px; font-size: 10px; }
.avatar.lg { width: 48px; height: 48px; font-size: var(--fs-xl); }
.avatar[style*="--tint"] { background: var(--tint); }
.picker { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; margin-inline: -6px; }
.pick { display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 64px; padding: 6px; border: 0; background: none; color: var(--muted); font-size: var(--fs-sm); }
.pick .avatar { width: 46px; height: 46px; font-size: 24px; transition: box-shadow 0.15s; }
.pick.on { color: var(--text); font-weight: 500; }
.pick.on .avatar { box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--brand); }
.card .pick.on .avatar, .sheet .pick.on .avatar { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--brand); }
.pick:disabled { opacity: 0.35; }

/* Progress ring around a family member's avatar: how much of today is done. */
.ring { position: relative; width: 52px; height: 52px; display: grid; place-items: center; flex: none; }
.ring > svg { position: absolute; inset: 0; width: 52px; height: 52px; transform: rotate(-90deg); fill: none; stroke-width: 3; stroke-linecap: round; }
.ring .track { stroke: var(--line); }
.ring .fill { stroke: var(--brand); transition: stroke-dasharray 0.6s var(--ease); }
.ring .avatar { width: 42px; height: 42px; font-size: 22px; }

/* ---------- forms ---------- */
.field { display: flex; flex-direction: column; gap: 6px; margin-block-end: 14px; }
.field label, .label { font-size: var(--fs-sm); font-weight: 500; color: var(--muted); }
.input, select.input, textarea.input {
  width: 100%;
  min-height: 48px;
  padding: 11px 14px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--text);
  font-size: var(--fs-base);
  transition: border-color 0.15s, background 0.15s;
}
.input::placeholder { color: var(--muted); }
.input:focus { outline: none; border-color: var(--brand); background-color: var(--surface); }
select.input {
  appearance: none;
  -webkit-appearance: none;
  padding-inline-end: 38px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238fa1a7' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 18px;
}
textarea.input { min-height: 88px; resize: vertical; }
.input.code { font-size: 1.7rem; letter-spacing: 0.3em; text-align: center; text-transform: uppercase; font-weight: 600; }
.input.code::placeholder { font-size: 1.05rem; letter-spacing: normal; text-transform: none; font-weight: 400; }
.inline { display: flex; align-items: center; gap: 8px; }
.inline .input { flex: 1; }
.num { width: 72px !important; flex: none !important; text-align: center; }

/* A setting as one row of a group: the label on the start side, the control on the end side. */
.field.kv { flex-direction: row; align-items: center; justify-content: space-between; gap: 12px; min-height: 52px; margin: 0; padding: 6px 14px; position: relative; }
.field.kv + .field.kv::before, .field.kv + .switch::before, .switch + .field.kv::before, .group > .switch + .switch::before {
  content: "";
  position: absolute;
  inset-block-start: 0;
  inset-inline: 14px 0;
  height: 1px;
  background: var(--line);
}
.field.kv label { color: var(--text); font-size: var(--fs-base); font-weight: 400; }
/* 16px, not smaller: an iPhone zooms the whole page into a field whose text is under 16px when it's tapped. */
.field.kv .input { width: auto; min-width: 0; min-height: 36px; padding: 6px 10px; border-radius: var(--radius-sm); font-size: var(--fs-base); background-color: var(--surface-2); text-align: end; }
.field.kv select.input { padding-inline-end: 32px; background-position: right 8px center; background-size: 16px; }
.field.kv .input:focus { background-color: var(--surface-2); }
.group > .switch { padding-inline: 14px; position: relative; }

.switch { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 52px; cursor: pointer; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch .track { position: relative; flex: none; width: 51px; height: 31px; border-radius: 16px; background: var(--track); transition: background 0.2s; }
.switch .track::after {
  content: "";
  position: absolute;
  inset-block-start: 2px;
  inset-inline-start: 2px;
  width: 27px;
  height: 27px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 4px rgb(0 0 0 / 18%);
  transition: transform 0.2s var(--ease);
}
.switch input:checked + .track { background: var(--brand); }
.switch input:checked + .track::after { transform: translateX(20px); }
.switch input:focus-visible + .track { outline: 2px solid var(--brand); outline-offset: 2px; }
.switch input:disabled + .track { opacity: 0.4; }

/* ---------- lists ---------- */
.list-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: -2px 8px 12px; }
.cat-title { display: flex; align-items: center; gap: 8px; margin: 20px 8px 8px; font-size: var(--fs-sm); font-weight: 500; color: var(--muted); }
.add-bar { position: sticky; inset-block-start: 0; z-index: 5; margin-inline: -14px; padding: 8px 14px; background: var(--bg); }
.add-field {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 52px;
  padding: 4px 4px 4px 6px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  transition: border-color 0.15s;
}
.add-field:focus-within { border-color: var(--brand); }
.add-field .input { background: transparent; border: 0; min-height: 44px; padding-inline: 10px; }
.add-field .input:focus { background-color: transparent; }
.add-field .btn { min-height: 42px; width: 42px; padding: 0; border-radius: var(--radius-sm); }
.add-note {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-block-start: 8px;
  padding: 6px 6px 6px 12px;
  border-radius: var(--radius);
  background: var(--brand-soft);
  color: var(--brand-strong);
  font-size: var(--fs-md);
  animation: fade 0.2s var(--ease);
}
.add-note .icon { width: 17px; height: 17px; flex: none; }
.add-note .grow { flex: 1; min-width: 0; padding-block: 5px; }
.add-note bdi { font-weight: 600; }
.add-note button { flex: none; min-height: 34px; padding: 0 12px; border: 0; border-radius: var(--radius-sm); background: transparent; color: inherit; font: inherit; font-weight: 600; text-decoration: underline; cursor: pointer; }
.item-row.flash { border-radius: var(--radius); animation: flash 1.8s var(--ease); }
@keyframes flash { 0%, 35% { background-color: var(--brand-soft); } 100% { background-color: transparent; } }
.choices { display: flex; flex-direction: column; gap: 8px; margin-block-start: 14px; }
.choices .btn { width: 100%; white-space: normal; }
.suggest { margin-block-start: 6px; overflow: hidden; border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-lg); }
.suggest button { display: block; width: 100%; padding: 13px 16px; border: 0; border-block-end: 1px solid var(--line); background: none; text-align: start; }
.suggest button:last-child { border-block-end: none; }
.qty { color: var(--muted); font-size: var(--fs-md); font-variant-numeric: tabular-nums; }
/* Fill cart: each list line as the store's product, its picture on a white tile as the stores shoot them. */
.store-line { --inset: 74px; }
.store-line.skipped .thumb { opacity: 0.4; }
/* "2 removed · Put back", under the lines. */
.list-head.cart-removed { margin-block-start: 14px; }
.order-again { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: -6px 8px 12px; }
.thumb { width: 48px; height: 48px; flex: none; display: grid; place-items: center; border-radius: var(--radius-sm); background: var(--surface-2); color: var(--faint); object-fit: contain; }
img.thumb { background: #fff; }
.thumb.sm { width: 36px; height: 36px; border-radius: 6px; }
.store-controls { display: flex; align-items: center; gap: 2px; margin-block-start: 6px; margin-inline-start: -8px; }
.store-controls .btn.ghost { min-height: 36px; font-size: var(--fs-sm); }
.qty-now { min-width: 52px; text-align: center; font-weight: 600; }
.store-choices { display: grid; gap: 4px; margin-block-start: 6px; }
.store-search { display: flex; align-items: center; gap: 6px; margin-block-start: 6px; }
.store-search .input { min-height: 40px; }
.store-search .btn { flex: none; min-width: 76px; }
/* A choice is one row: its picture (a closer look, in Fill cart) and the rest, which picks it. */
.store-choice { display: flex; align-items: stretch; width: 100%; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.store-choice > button { display: flex; align-items: center; gap: 10px; padding: 8px; border: 0; background: none; color: inherit; font: inherit; text-align: start; cursor: pointer; }
.store-choice > .pick { flex: 1; min-width: 0; }
.store-choice > .look + .pick { padding-inline-start: 2px; }
/* Fill cart's "this one as well": apart from the rest of the row, which picks it instead. */
.store-choice > .add-too { flex: none; width: 48px; display: grid; place-items: center; border: 0; border-inline-start: 1px solid var(--line); background: none; color: var(--brand); cursor: pointer; }
.choices-hint { margin: 6px 0 0; }
/* Fill cart's own add field, under the lines. */
.add-field.fill-add { margin-block-start: 12px; }
.store-choice .name { display: block; }
/* A product's picture and name open a closer look at it: buttons that look like what they hold. */
.look { flex: none; display: block; padding: 0; border: 0; background: none; color: inherit; font: inherit; text-align: start; cursor: pointer; }
.look.name { flex: initial; }
.look.grow { flex: 1; min-width: 0; }
/* The closer look: the store's pictures side by side to swipe through, on white as the stores shoot them, then what
   the store says of the product, each part under its label. */
.shots { display: flex; gap: 8px; margin-block-end: 12px; overflow-x: auto; scroll-snap-type: x mandatory; border-radius: var(--radius-lg); }
.shots img { flex: none; width: 100%; height: min(44dvh, 340px); border: 1px solid var(--line); border-radius: var(--radius-lg); background: #fff; object-fit: contain; scroll-snap-align: center; }
.shots img:not(:only-child) { width: 88%; }
.sheet .said { margin: 0 4px 12px; }
.sheet .words { white-space: pre-line; overflow-wrap: anywhere; }
/* The nutrition table: names at the start, an amount column for each measure at the end, hairlines between rows. */
.nutrition { width: 100%; margin-block-start: 4px; border-collapse: collapse; }
.nutrition th, .nutrition td { padding: 7px 0; border-block-start: 1px solid var(--line); font-weight: 400; text-align: start; vertical-align: top; }
.nutrition thead th, .nutrition thead td { border: 0; padding-block-start: 0; color: var(--muted); font-size: var(--fs-sm); }
.nutrition td, .nutrition thead th { padding-inline-start: 14px; text-align: end; white-space: nowrap; }
/* The forecast models' scoreboard: the same table, the model names free to wrap, the card's own model marked. */
.models th[scope=row] { padding-inline-end: 6px; }
.models .current th { color: var(--brand-strong); }
.models td .meta { font-size: var(--fs-sm); }
.models-note { margin: 0 4px 12px; }
/* What gets used: a column per person, under their initial, at the end of its cell like the numbers below it. */
.usage thead .avatar { margin-inline-start: auto; }
.sheet > .meta { margin: 0 4px 12px; }
/* Where a list line stands at a store: in its cart (quiet), or not there / missing (amber). */
.store-badge { display: inline-flex; align-items: center; min-height: 20px; padding: 0 8px; border-radius: 6px; background: var(--brand-soft); color: var(--brand-strong); font-size: var(--fs-sm); }
.store-badge.warn { background: var(--warn-soft); color: var(--warn); }
/* An offer on the product: blue, apart from the orange of what needs a look. The normal price crossed out, the offer's
   price for one in the text's own colour, and the saving in blue. */
.store-badge.sale { background: var(--info-soft); color: var(--info); font-weight: 600; }
.meta.offer s { color: var(--faint); }
.meta.offer .offer-price { color: var(--text); font-weight: 600; }
.meta.offer .saving { color: var(--info); font-weight: 600; }
/* A store's online cart on the list: one card, its name and count over what it holds, Checkout and a menu at the top. */
.store-cart { margin-block: 22px 12px; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; --inset: 14px; }
.store-cart-head { display: flex; align-items: center; gap: 8px; padding: 12px 6px 12px 14px; border-block-end: 1px solid var(--line); }
.store-cart-head .grow { flex: 1; min-width: 0; display: grid; gap: 1px; }
.store-cart-head .btn.sm { flex: none; }
.store-cart-hint { margin: 0; padding: 10px 14px 0; }
/* Taking a product out: a spinner while it comes out, a dot while it waits its turn (Fill cart). On the list it's off
   the card at once, and to buy again, lit up for a few seconds. */
.icon-btn.take-out { color: var(--muted); }
.spinner.xs { width: 11px; height: 11px; border-width: 2px; display: inline-block; vertical-align: -1px; margin-inline-end: 5px; }
.store-badge .spinner.xs { border-color: color-mix(in srgb, var(--brand-strong) 25%, transparent); border-block-start-color: var(--brand-strong); }
.item-row.back { border-radius: var(--radius); background-color: var(--brand-soft); animation: fade 0.3s var(--ease); }
.item-row.back .store-badge { background: var(--surface); }
.icon-btn.take-out .icon { width: 22px; height: 22px; }
.queued { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); }

/* An item opened in place: the row becomes three short lines, the name with −/+ beside it, the note, where it goes. */
.item-row.editing { align-items: flex-start; background: var(--surface-2); }
.item-row.editing .check { margin-block-start: 9px; }
.item-edit { flex: 1; min-width: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; }
.edit-line { display: flex; align-items: center; gap: 6px; min-width: 0; }
.edit-line > .input { flex: 1 1 0; width: 0; }
/* On the editor's own shade, the fields take the card's, or they'd vanish into it. */
.item-edit .input { min-height: 42px; padding-block: 8px; background-color: var(--surface); min-width: 0; }
.stepper { flex: none; display: flex; align-items: center; border-radius: var(--radius); background: var(--surface); }
.stepper .icon-btn { width: 36px; height: 42px; border-radius: var(--radius); }
.stepper .icon-btn:disabled { opacity: 0.3; }
.stepper input { width: 52px; min-height: 42px; border: 0; background: none; color: inherit; font: inherit; text-align: center; outline: none; }
.stepper.words input { width: 92px; }
.stepper:focus-within { box-shadow: 0 0 0 1px var(--brand); }
.icon-btn.danger { color: var(--bad); }
.icon-btn.done { border-radius: var(--radius); background: var(--brand); color: var(--on-brand); }

/* An order on its way: one line in the On the way group, opening in place to its lines and what can be done. */
.order-card + .order-card { border-block-start: 1px solid var(--line); }
.order-row .grow { flex: 1; min-width: 0; display: grid; gap: 2px; }
.order-row .chevron { transition: transform 0.18s; }
.order-row[aria-expanded="true"] .chevron { transform: rotate(90deg); }
.order-body { display: grid; gap: 10px; padding: 0 14px 12px; }
.order-lines { display: grid; gap: 8px; }
.order-line { display: grid; gap: 2px; }
.text-actions { display: flex; flex-wrap: wrap; gap: 4px; margin-inline-start: -10px; }
.text-actions .btn.ghost { min-height: 36px; font-size: var(--fs-sm); }
.btn.ghost.danger-text { color: var(--bad); }
.check-row input[type=checkbox] { width: 22px; height: 22px; flex: none; accent-color: var(--brand); }
/* Compare prices: each store's sum over the lines every store has, then each line with every store's product under it,
   what the line costs there at the row's end; the lowest is marked. */
.compare-totals { display: grid; gap: 12px; }
.compare-total { display: flex; align-items: center; gap: 10px; }
.compare-total .grow { display: grid; }
.compare-total .amount, .compare-cost { flex: none; font-weight: 600; }
.compare-totals .best, .compare-cell .best { color: var(--brand-strong); }
.compare-line { --inset: 14px; }
.compare-line .grow { cursor: default; }
.compare-head { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 8px; }
.compare-cell { display: flex; align-items: flex-start; gap: 10px; margin-block-start: 10px; }
.cart-bar { position: sticky; inset-block-end: 0; z-index: 5; margin-inline: -14px; padding: 10px 14px calc(env(safe-area-inset-bottom) + 10px); background: var(--bg); }
.live { display: inline-flex; align-items: center; gap: 6px; color: var(--brand-strong); font-size: var(--fs-sm); font-weight: 500; }
.live::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--brand); animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.35; transform: scale(0.8); } }
/* ---------- calendar events ---------- */
.cal-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--muted); flex: none; }
.cal-dot.inline { margin-inline-end: 7px; vertical-align: middle; }
.meta .linked { display: inline-flex; align-items: center; gap: 4px; }
/* Whose a row is: their colour down its leading edge, flush with the card, so a run of one person's rows reads as one
   bar. Lighter on dark, where the deeper member colours sink into the card. */
.who-bar { position: absolute; inset-block: 0; inset-inline-start: 0; width: 4px; pointer-events: none; }
:root[data-theme="dark"] .who-bar { filter: brightness(1.4); }
.item-row.checked .who-bar { opacity: 0.4; }
.group > .sub-switch > .switch { padding-inline: 48px 14px; position: relative; }
.event-notes { white-space: pre-wrap; }

/* ---------- word of the day ---------- */
.word-card { display: block; color: inherit; text-decoration: none; }
.word-card .chevron { color: var(--faint); width: 18px; height: 18px; }
.word { font-size: var(--fs-2xl); font-weight: 600; letter-spacing: -0.02em; line-height: 1.15; overflow-wrap: anywhere; }
.word-card .word { font-size: var(--fs-xl); }
/* English and Hebrew side by side on the card; the Hebrew reads right to left inside its own span. */
.word-line { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.word-he { font-size: var(--fs-xl); font-weight: 600; unicode-bidi: isolate; overflow-wrap: anywhere; }
.word-card .word-he { font-size: var(--fs-lg); color: var(--muted); font-weight: 500; }
.word-hebrew { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); text-align: start; }
.word-hebrew .word-meaning { margin-bottom: 0; }
.word-meaning { margin: 10px 0 0; }
.word-nav { display: flex; justify-content: space-between; }
/* ---------- detail and editor ---------- */
.hero { display: flex; align-items: center; gap: 14px; }
.hero-emoji { width: 56px; height: 56px; border-radius: var(--radius); background: var(--surface-2); display: grid; place-items: center; flex: none; font-size: var(--fs-2xl); }
.hero .big { font-size: var(--fs-xl); }
.facts { display: grid; gap: 10px; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); font-size: var(--fs-md); }
.facts .fact { display: flex; gap: 10px; }
.facts .fact > span:first-child { width: 88px; flex: none; color: var(--muted); }
.title-card { display: flex; align-items: center; gap: 10px; padding: 10px; }
.title-card .title-input { min-height: 52px; background: transparent; font-size: var(--fs-xl); font-weight: 500; padding-inline: 6px; }
.title-card .title-input:focus { border-color: transparent; background-color: transparent; }
.summary { display: flex; align-items: center; justify-content: center; gap: 8px; margin: 18px 12px; text-align: center; font-size: var(--fs-md); color: var(--muted); }
.summary .icon { width: 17px; height: 17px; color: var(--brand); }
.more-toggle { width: 100%; justify-content: space-between; min-height: 52px; padding: 0 14px; border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); color: var(--brand); font-weight: 500; margin-block-end: 12px; }
.more-toggle .icon { width: 18px; height: 18px; transition: transform 0.2s var(--ease); }
.more-toggle.open .icon { transform: rotate(180deg); }
.group .field:not(.kv) { padding: 12px 14px 0; margin: 0; }
.group .field:not(.kv):last-child { padding-bottom: 14px; }
.group > .chips { padding: 0 14px 12px; }
.group > .inline { padding: 0 14px 12px; }
.group .field:not(.kv) .chips { padding: 0; }

/* The create menu behind the tab bar's +. */
.menu-row { display: flex; align-items: center; gap: 14px; width: 100%; padding: 12px; border: 0; border-radius: var(--radius); background: none; text-align: start; transition: background 0.12s; }
.menu-row:active { background: var(--surface-2); }
.menu-icon { width: 46px; height: 46px; border-radius: var(--radius-sm); background: var(--brand-soft); color: var(--brand-strong); display: grid; place-items: center; flex: none; }
.menu-row .grow > span { display: block; }
.menu-row .title-line { font-size: var(--fs-lg); }

/* ---------- banners, toasts, sheets ---------- */
.banner {
  display: block;
  width: 100%;
  margin-block-end: 12px;
  padding: 13px 16px;
  border: 0;
  border-radius: var(--radius);
  font-size: var(--fs-md);
  font-weight: 500;
  text-align: start;
}
.banner .small { font-weight: 400; margin-top: 2px; }
.banner.brand { background: var(--brand); color: var(--on-brand); }
.banner.warn { background: var(--warn-soft); color: var(--warn); }
.banner.info { background: var(--info-soft); color: var(--info); }
/* A phone setting that is off: the text opens the fix, the cross hides it for a day. */
.phone-banner { display: flex; align-items: center; padding: 0; }
.phone-banner-main { flex: 1; min-width: 0; padding: 13px 16px; border: 0; background: none; color: inherit; font-weight: 500; text-align: start; }
.phone-banner .icon-btn { color: inherit; margin-inline-end: 4px; }
.update-banner, .offline-banner {
  position: sticky;
  inset-block-start: 0;
  z-index: 30;
  width: 100%;
  padding: calc(env(safe-area-inset-top) + 10px) 16px 10px;
  border: 0;
  font-size: var(--fs-md);
  font-weight: 500;
  text-align: center;
  /* One line of a known height, so the list's add bar can stick just below it instead of under it. */
  line-height: 20px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.update-banner { background: var(--brand); color: var(--on-brand); }
.offline-banner { background: var(--warn-soft); color: var(--warn); }
.app.has-banner .add-bar { inset-block-start: calc(env(safe-area-inset-top) + 40px); }
/* Changes still unsent after a moment: a pill over the content, so the list never moves. */
.sync-pill {
  position: fixed;
  inset-block-start: calc(env(safe-area-inset-top) + 10px);
  inset-inline: 0;
  z-index: 40;
  width: max-content;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  background: var(--info-soft);
  color: var(--info);
  font-size: var(--fs-sm);
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  animation: toast-in 0.25s var(--ease);
  pointer-events: none; /* it may sit over the list's add field: taps go through */
}
.sync-pill .icon { width: 15px; height: 15px; animation: spin 1.4s linear infinite; }

.toasts {
  position: fixed;
  inset-inline: 0;
  inset-block-end: calc(var(--tab-h) + env(safe-area-inset-bottom) + 24px);
  z-index: 60;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 0 16px;
  pointer-events: none;
}
.toast {
  max-width: 520px;
  padding: 12px 18px;
  border-radius: var(--radius);
  background: var(--toast-bg);
  color: var(--toast-text);
  font-size: var(--fs-md);
  box-shadow: var(--shadow-lg);
  animation: toast-in 0.3s var(--ease);
}
.toast.bad { background: var(--bad); color: var(--on-bad); }
.toast.has-action { display: flex; align-items: center; gap: 16px; }
.toast-action { margin: -12px -14px -12px auto; min-height: 44px; padding: 0 14px; border: 0; background: none; color: var(--toast-action); font-weight: 600; pointer-events: auto; }
.toast.bad .toast-action { color: var(--on-bad); text-decoration: underline; }
@keyframes toast-in { from { opacity: 0; transform: translateY(12px) scale(0.98); } }

.backdrop { position: fixed; inset: 0; z-index: 50; background: rgb(6 14 17 / 40%); -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px); animation: fade 0.2s; touch-action: none; }
/* While a sheet is open the page behind it doesn't scroll (mishaka.sheetOpen toggles the class). */
html.sheet-open, html.sheet-open body { overflow: hidden; }
.sheet {
  position: fixed;
  inset-inline: 0;
  inset-block-end: 0;
  z-index: 51;
  max-width: 640px;
  max-height: 90dvh;
  margin: 0 auto;
  overflow-y: auto;
  /* A swipe inside the sheet scrolls the sheet, never the page behind it (html.sheet-open holds that still). */
  overscroll-behavior: contain;
  touch-action: pan-y;
  padding: 8px 16px calc(20px + env(safe-area-inset-bottom));
  border-start-start-radius: var(--radius-lg);
  border-start-end-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  animation: sheet-in 0.34s var(--ease);
}
.sheet .grab { width: 36px; height: 5px; margin: 4px auto 14px; border-radius: 3px; background: var(--line); }
.sheet h2 { margin: 0 4px 14px; font-size: var(--fs-xl); font-weight: 600; letter-spacing: -0.01em; }
.sheet > p { margin: 0 4px 14px; }
.sheet .group { box-shadow: none; background: var(--surface-2); }
@keyframes sheet-in { from { transform: translateY(100%); } }
@keyframes fade { from { opacity: 0; } }

/* ---------- empty states ---------- */
.empty { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 44px 24px; text-align: center; color: var(--muted); }
.empty-icon { width: 64px; height: 64px; margin-bottom: 8px; border-radius: var(--radius); background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; }
.empty-icon .icon { width: 30px; height: 30px; stroke-width: 1.6; }
.empty h3 { margin: 0; font-size: var(--fs-lg); font-weight: 600; color: var(--text); }
.empty p { margin: 0; max-width: 30ch; }

/* ---------- misc ---------- */
.code-box {
  padding: 18px;
  border-radius: var(--radius);
  background: var(--brand-soft);
  color: var(--brand-strong);
  font-size: 2.4rem;
  font-weight: 600;
  letter-spacing: 0.25em;
  text-align: center;
  direction: ltr;
  font-variant-numeric: tabular-nums;
}
/* Cameras need dark modules on a light ground, whatever the theme. */
.qr { display: block; width: 168px; height: 168px; margin: 10px auto 4px; padding: 8px; border-radius: var(--radius-lg); background: #fff; }
.steps { margin: 0; padding-inline-start: 22px; display: grid; gap: 10px; }
.steps li::marker { color: var(--brand); font-weight: 600; }
.key-box { direction: ltr; padding: 12px; border-radius: var(--radius); background: var(--surface-2); font-family: ui-monospace, Menlo, Consolas, monospace; font-size: var(--fs-md); word-break: break-all; }
.boot { min-height: 100dvh; display: grid; place-items: center; align-content: center; gap: 14px; padding-inline: 24px; text-align: center; }
.spinner { width: 32px; height: 32px; border-radius: 50%; border: 3px solid var(--brand-soft); border-block-start-color: var(--brand); animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.skeleton-bar { height: 14px; margin: 10px 0; border-radius: 4px; background: var(--surface-2); }
.welcome-hero { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 36px 16px 22px; text-align: center; }
.welcome-hero h1 { margin: 6px 0 0; font-size: var(--fs-2xl); font-weight: 600; letter-spacing: -0.02em; }
.welcome-hero p { margin: 0; max-width: 32ch; color: var(--muted); }
/* The app icon itself (its corners are already rounded), lifted off the page. */
.brand-mark { width: 84px; height: 84px; border-radius: 19px; box-shadow: var(--shadow-lg); }

/* ---------- home ---------- */
/* A device's sheet, its head: the icon in its colour, the name, how it stands in that colour, and who did what last;
   the switch, for what turns on and off, at the end. */
.sheet-head { display: flex; align-items: center; gap: 14px; margin-block-end: 18px; }
/* Over .sheet h2's margins: the name sits on the line of what's under it. */
.sheet-head .sheet-title { margin: 0; font-size: var(--fs-xl); font-weight: 600; line-height: 1.25; }
.sheet-state { margin-block-start: 2px; font-size: var(--fs-md); font-weight: 500; white-space: normal; }
.sheet-state::before { display: none; }
.sheet-head:is(.warn, .bad) .sheet-state::before { display: block; }
.sheet-head:is(.on, .cool, .heat, .moving, .sun) .sheet-state { color: var(--accent-text, var(--accent)); }
.sheet-last { margin-block-start: 2px; font-size: var(--fs-sm); color: var(--muted); }
.sheet-head > .toggle { align-self: center; }
/* Big numbers in a sheet: a temperature, how far open, how long is left. */
.hero-number { font-size: var(--fs-2xl); font-weight: 600; letter-spacing: -0.02em; line-height: 1.1; }

/* An air conditioner's dial: three quarters of a circle open at the bottom, filled to its target in the mode's colour,
   a dot where the room is, the target big in the middle. − and + either side. */
.ac-hero { --accent: var(--muted); display: flex; align-items: center; justify-content: center; gap: 10px; margin-block: 0 4px; }
.ac-hero.on { --accent: var(--brand); }
.ac-hero.cool { --accent: var(--cool); }
.ac-hero.heat { --accent: var(--heat); }
.dial { position: relative; width: 184px; height: 184px; flex: none; }
.dial svg { width: 100%; height: 100%; fill: none; stroke-linecap: round; }
.dial-track { stroke: var(--track); stroke-width: 12; stroke-dasharray: 75 100; }
.dial-fill { stroke: var(--accent); stroke-width: 12; transition: stroke-dasharray 0.4s var(--ease); }
.dial-room { fill: var(--surface); stroke: var(--muted); stroke-width: 3; }
.dial-centre { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 2px; text-align: center; }
.dial-centre .target { font-size: var(--fs-3xl); font-weight: 600; letter-spacing: -0.02em; line-height: 1.1; }
.dial-off { font-size: var(--fs-xl); font-weight: 600; color: var(--muted); }
/* Its modes, each its drawing in a circle and its word: the one it runs in filled with its colour. */
.mode-picks { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 6px; margin-block-start: 12px; }
.mode-pick {
  --accent: var(--muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-width: 58px;
  padding: 2px 4px;
  border: 0;
  background: none;
  color: var(--muted);
  font: inherit;
  font-size: var(--fs-sm);
}
.mode-pick .kicon { --kicon-fill: var(--surface-2); width: 46px; height: 46px; }
/* "picked", not "on": on is the brand colour of dry, fan and auto. */
.mode-pick.picked { color: var(--text); font-weight: 500; }
.mode-pick.picked.on { --accent: var(--brand); }
.mode-pick.picked.cool { --accent: var(--cool); }
.mode-pick.picked.heat { --accent: var(--heat); }
.mode-pick.picked .kicon { --kicon-fill: var(--accent); color: var(--surface); }
.mode-pick:active { opacity: 0.7; }
.mode-pick:disabled { opacity: 0.45; }

/* A lock: one big round button, green while locked, plain while open in the day and amber while open at night, and
   what a tap does under it. */
.lock-hero { display: grid; justify-items: center; gap: 10px; margin-block: 4px 16px; }
.lock-btn {
  width: 120px;
  height: 120px;
  border: 0;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--brand-soft);
  color: var(--brand-strong);
  box-shadow: 0 0 0 7px color-mix(in srgb, var(--brand) 10%, transparent);
  transition: transform 0.12s var(--ease), background-color 0.25s, color 0.25s, box-shadow 0.25s;
}
.lock-btn.open { background: var(--surface-2); color: var(--text); box-shadow: 0 0 0 7px color-mix(in srgb, var(--muted) 12%, transparent); }
.lock-btn.open.warn { background: var(--warn-soft); color: var(--warn); box-shadow: 0 0 0 7px color-mix(in srgb, var(--warn) 12%, transparent); }
.lock-btn .icon { width: 48px; height: 48px; stroke-width: 1.6; }
.lock-btn .spinner { width: 36px; height: 36px; }
.lock-btn:active:not(:disabled) { transform: scale(0.95); }
.lock-btn:disabled { opacity: 0.55; }
.lock-caption { min-height: 1.4em; font-size: var(--fs-sm); color: var(--muted); }

/* A ring that fills or empties: how far through its program a machine is, how much of a heat is left. */
.count-ring { --accent: var(--brand); position: relative; width: 132px; height: 132px; margin: 4px auto 14px; }
.count-ring.heat { --accent: var(--heat); }
.count-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); fill: none; stroke-width: 9; stroke-linecap: round; }
.ring-track { stroke: var(--track); }
.ring-fill { stroke: var(--accent); transition: stroke-dasharray 0.4s var(--ease); }
.ring-centre { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 2px; text-align: center; }
.ring-centre .hero-number { font-size: var(--fs-xl); }

/* Readings side by side, each a value over its word: a charger's power, this session's energy, the car. */
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 8px; margin-block-start: 12px; }
.stat { display: grid; gap: 2px; padding: 10px 12px; border-radius: var(--radius); background: var(--surface-2); }
.stat-value { font-size: var(--fs-xl); font-weight: 600; letter-spacing: -0.01em; }
.stat-label { font-size: var(--fs-sm); color: var(--muted); }

.icon-btn.round { width: 48px; height: 48px; background: var(--surface-2); color: var(--text); }
.icon-btn.round:disabled { opacity: 0.4; cursor: default; }
.chips.modes { justify-content: center; margin-block-start: 12px; }
/* Its fan: auto, then the speeds as rising bars filled up to the one it runs at (by name when they have no order). */
.fan-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px 10px; margin-block-start: 12px; }
.fan-label { display: grid; place-items: center; color: var(--muted); }
.fan-levels { display: flex; align-items: flex-end; gap: 4px; }
.fan-level { display: flex; align-items: flex-end; justify-content: center; width: 34px; height: 40px; padding: 0 0 4px; border: 0; border-radius: 6px; background: none; }
.fan-level span { width: 12px; height: var(--h); border-radius: 4px; background: var(--track); transition: background 0.15s; }
.fan-level.on span { background: var(--brand); }
.fan-level:disabled { opacity: 0.4; cursor: default; }
/* A row whose name and line open something, beside a control that acts on the spot: a set time, a recording found. */
.row-main {
  display: flex;
  flex: 1;
  min-width: 0;
  align-items: center;
  gap: 12px;
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  color: inherit;
  text-align: start;
  cursor: pointer;
}
.row-main .title-line, .row-main .meta { display: block; }
/* The alarm's sheet: its state, big, in the state's colour, with a pulse while the panel is counting down. */
.alarm-state { display: grid; justify-items: center; gap: 4px; padding: 18px 14px; margin-block-end: 14px; border-radius: var(--radius); background: var(--surface-2); text-align: center; }
.alarm-state .big { font-size: var(--fs-2xl); font-weight: 600; letter-spacing: -0.02em; }
.alarm-state .meta { color: inherit; opacity: 0.8; }
.alarm-state.good { background: var(--brand-soft); color: var(--brand-strong); }
.alarm-state.info { background: var(--info-soft); color: var(--info); }
.alarm-state.warn { background: var(--warn-soft); color: var(--warn); }
.alarm-state.bad { background: var(--bad-soft); color: var(--bad); }
.alarm-state .dot { width: 10px; height: 10px; border-radius: 50%; background: currentColor; animation: pulse 1.2s ease-in-out infinite; }
/* A machine waiting for someone: the one thing on this tab that asks something of you. */
.waiting-box { padding: 14px; margin-block-end: 14px; border-radius: var(--radius); background: var(--warn-soft); }
.waiting-box .actions { margin-block-start: 12px; }
.meta .warn, .meta.warn { color: var(--warn); }
/* A printer's cartridges, and a sensor's battery: how much is left, in the cartridge's own ink where its name says
   which, amber once it's worth buying another. */
.ink { flex: 0 0 76px; height: 8px; border-radius: 4px; background: var(--track); overflow: hidden; }
.ink .fill { display: block; height: 100%; border-radius: 4px; background: var(--brand); transition: width 0.4s var(--ease); }
.ink .fill.black { background: var(--text); }
.ink .fill.cyan { background: #14a7d4; }
.ink .fill.magenta { background: #d4338a; }
.ink .fill.yellow { background: #e2b400; }
.ink .fill.low { background: var(--warn); }
/* Under a low cartridge: whether a spare is in the house. Tucked under its row, quieter than it. */
.ink-spare { padding: 0 14px 6px; }
.ink-spare .switch { min-height: 40px; font-size: var(--fs-sm); color: var(--muted); }
/* A television's volume, big between its two round buttons. */
.tv-controls { display: grid; gap: 12px; margin-block-start: 4px; }
.tv-controls .btn.round { width: 48px; min-height: 48px; padding: 0; border-radius: 50%; font-size: var(--fs-xl); }
.tv-controls .volume { min-width: 72px; text-align: center; font-size: var(--fs-2xl); font-weight: 600; letter-spacing: -0.02em; }
/* A shutter: the window drawn with its blind down over the part that's closed, beside how far open it is; then open,
   stop and close side by side like the switch on the wall, and how far open under them. */
.shutter-hero { display: flex; align-items: center; justify-content: center; gap: 22px; margin-block: 2px 16px; }
.shutter-pic {
  position: relative;
  width: 84px;
  height: 104px;
  flex: none;
  border: 3px solid color-mix(in srgb, var(--text) 22%, transparent);
  border-radius: var(--radius);
  background: linear-gradient(var(--cool-soft), var(--surface));
  overflow: hidden;
}
.shutter-pic .blind {
  position: absolute;
  inset: 0 0 auto;
  height: var(--closed);
  border-block-end: 3px solid color-mix(in srgb, var(--text) 40%, transparent);
  background: repeating-linear-gradient(to bottom, color-mix(in srgb, var(--text) 24%, var(--surface)) 0 6px, color-mix(in srgb, var(--text) 12%, var(--surface)) 6px 8px);
  transition: height 0.4s var(--ease);
}
.shutter-buttons { display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); gap: 8px; margin-block-start: 4px; }
.shutter-buttons .btn { padding-inline: 8px; }
.shutter-position { display: grid; gap: 10px; margin-block-start: 18px; }
.shutter-slider { display: flex; align-items: center; gap: 10px; }
.shutter-slider .range { flex: 1 1 auto; min-width: 0; accent-color: var(--brand); }
.shutter-slider .icon-btn.round { width: 40px; height: 40px; flex: none; }
.shutter-presets { justify-content: center; }
.tell-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-block-start: 14px; }
.tell-row .chip { gap: 6px; padding-inline: 10px; }
/* A water heater's last day: a strip from 24 hours ago to now, filled where it was on, and each stretch under it. */
.day-strip { position: relative; height: 12px; margin-block-start: 8px; border-radius: 6px; background: var(--track); overflow: hidden; }
.day-strip > span { position: absolute; inset-block: 0; min-width: 3px; border-radius: 6px; background: var(--heat); }
.day-scale { display: flex; justify-content: space-between; margin-block-start: 4px; }
.day-periods { display: grid; gap: 4px; margin-block-start: 10px; }
.home-notice { display: flex; align-items: flex-start; gap: 12px; padding: 14px 16px; margin-block-end: 12px; border-radius: var(--radius); background: var(--warn-soft); }
.home-notice > .icon { color: var(--warn); margin-top: 1px; }
.page-hint { margin: -2px 8px 4px; }
.spinner.sm { width: 20px; height: 20px; border-width: 2.5px; display: inline-block; vertical-align: middle; }
.btn.primary .spinner.sm { border-color: color-mix(in srgb, var(--on-brand) 35%, transparent); border-block-start-color: var(--on-brand); }
/* An on/off switch drawn from state (a button): it shows what the device is, not what was last tapped. */
.toggle { flex: none; padding: 0; border: 0; background: none; border-radius: 16px; }
.toggle .track { position: relative; display: block; width: 51px; height: 31px; border-radius: 16px; background: var(--track); transition: background 0.2s; }
/* The knob's place is `translate`, not `transform`: the busy pulse animates `transform`, and shared, it pulled an on
   knob back to off at every beat. */
.toggle .track::after { content: ""; position: absolute; inset-block-start: 2px; inset-inline-start: 2px; width: 27px; height: 27px; border-radius: 50%; background: #fff; box-shadow: 0 2px 4px rgb(0 0 0 / 18%); transition: translate 0.2s var(--ease); }
.toggle.on .track { background: var(--brand); }
.toggle.on .track::after { translate: 20px 0; }
.toggle:disabled { cursor: default; }
.toggle:disabled .track { opacity: 0.45; }
.toggle.busy .track::after { animation: pulse 1.2s ease-in-out infinite; }

/* ---------- home: tiles ---------- */
/* What a device is doing, as a colour. One state class sets --accent, and the tile's tint, its ring, its icon's circle
   and the words of its state all come from it. On, cool and heat: what it's doing. Warn and bad: it needs a look.
   Moving: between states. Off-grid: nobody can reach it. None: at rest. */
.device, .sheet-head { --accent: var(--muted); --kicon-fill: var(--kicon-off); --kicon-ink: var(--muted); }
:is(.device, .sheet-head).on { --accent: var(--run); --accent-text: var(--run-text); }
:is(.device, .sheet-head).cool { --accent: var(--cool); --accent-text: var(--cool-text); }
:is(.device, .sheet-head).heat { --accent: var(--heat); --accent-text: var(--heat-text); }
:is(.device, .sheet-head).warn { --accent: var(--warn-circle); --accent-text: var(--warn); }
:is(.device, .sheet-head).bad { --accent: var(--bad); }
:is(.device, .sheet-head).moving { --accent: var(--info); }
:is(.device, .sheet-head).off-grid { --accent: var(--faint); }
/* The sun on a solar system's panels: amber, in words darkened (or, on dark, lightened) towards the text to stay legible. */
:is(.device, .sheet-head).sun { --accent: var(--sun); --accent-text: color-mix(in srgb, var(--sun) 62%, var(--text)); }
:is(.device, .sheet-head):is(.on, .cool, .heat, .warn, .bad, .moving, .sun) { --kicon-fill: initial; --kicon-ink: #fff; }

/* A device's icon in its circle: grey at rest, white on the state's colour when it's doing something. On a tile it's
   the one control (a button); in a sheet's head it's a mark. */
.kicon {
  width: 40px;
  height: 40px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  display: grid;
  place-items: center;
  flex: none;
  background: var(--kicon-fill, linear-gradient(145deg, color-mix(in srgb, var(--accent, var(--brand)) 72%, #fff), var(--accent, var(--brand))));
  color: var(--kicon-ink, #fff);
  transition: background-color 0.25s, color 0.25s;
}
.kicon.act { cursor: pointer; }
.kicon.act:active { transform: scale(0.92); }
.kicon.act:disabled { cursor: default; }
.kicon.busy { animation: pulse 1.2s ease-in-out infinite; }
.device > .kicon { position: absolute; inset-block-start: 12px; inset-inline-start: 12px; z-index: 1; }
.kicon .icon { width: 22px; height: 22px; }
.kicon.sm { width: 36px; height: 36px; }
.kicon.sm .icon { width: 20px; height: 20px; }
.kicon.lg { width: 56px; height: 56px; }
.kicon.lg .icon { width: 28px; height: 28px; }
/* Switched on: the circle pops once. Moving: it breathes until it stops. Running stays still, or six air conditioners
   would pulse at once. */
:is(.device, .sheet-head):is(.on, .cool, .heat) .kicon { animation: pop 0.34s cubic-bezier(0.3, 1.6, 0.5, 1); }
:is(.device, .sheet-head).moving .kicon { animation: breathe 1.4s ease-in-out infinite; }
@keyframes breathe { 50% { opacity: 0.55; } }

/* Devices as tiles, two to a row on a phone. */
.devices { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-block-end: 12px; }
.device {
  position: relative;
  min-height: 104px;
  border-radius: var(--radius);
  background: var(--surface-2);
  box-shadow: var(--shadow);
  transition: background-color 0.25s, box-shadow 0.25s;
  animation: page-in 0.3s var(--ease) both;
  animation-delay: calc(min(var(--i, 0), 11) * 25ms);
}
/* Doing something, or needing a look: the tile lifts off the page, white with dark words in either theme. On dark,
   the theme's light state colours would wash out on it, so a lit tile carries the light theme's shades. */
.device:is(.on, .cool, .heat, .warn, .bad, .moving) {
  --warn: #b45309;
  --warn-circle: #d97706;
  --bad: #dc2626;
  --info: #2563eb;
  --cool: #2563eb;
  --cool-text: #1d4ed8;
  --heat: #ea580c;
  --heat-text: #c2410c;
  --run: #0d9488;
  --run-text: #0f766e;
  --faint: #a3abb5;
  background: var(--surface-lit);
  color: var(--text-lit);
  box-shadow: var(--shadow-on);
}
.device:is(.on, .cool, .heat, .warn, .bad, .moving) .device-detail { color: var(--muted-lit); }
/* The whole tile opens the device's sheet; the icon circle over its top corner is its control (.device > .kicon). */
.device-main {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  width: 100%;
  height: 100%;
  min-height: inherit;
  padding: 58px 12px 13px;
  border: 0;
  border-radius: inherit;
  background: none;
  color: inherit;
  font: inherit;
  text-align: start;
  transition: transform 0.12s var(--ease);
}
.device-main:active { transform: scale(0.97); }
.device-name {
  max-width: 100%;
  margin-block-start: auto;
  padding-block-start: 12px;
  font-size: var(--fs-md);
  font-weight: 600;
  line-height: 1.25;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  overflow-wrap: anywhere;
}
.device.off-grid .device-name { color: var(--muted); }
.device-status { max-width: 100%; margin-block-start: 2px; font-weight: 500; }
.device-status > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.device:is(.on, .cool, .heat, .moving) .device-status { color: var(--accent-text, var(--accent)); }
/* A dot only where the colour alone shouldn't carry it: something that needs a look. Not a heating air conditioner,
   whose words are amber too. */
.device-status::before { display: none; }
.device:is(.warn, .bad) .device-status::before { display: block; }
.device-detail { max-width: 100%; font-size: var(--fs-sm); color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.device-detail.warn { color: var(--warn); }
.toggle.on.cool .track { background: var(--cool); }
.toggle.on.heat .track { background: var(--heat); }

/* A camera: its last picture, its name on it, and a chip only when there's news (motion, or unreachable). */
.cam-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-block-end: 12px; }
.cam-tile {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  padding: 0;
  border: 0;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--surface-2);
  box-shadow: var(--shadow);
  color: var(--viewer-ink);
  font: inherit;
  text-align: start;
  transition: transform 0.12s var(--ease);
}
.cam-tile:active { transform: scale(0.97); }
.cam-tile .cam-thumb { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.cam-tile::after { content: ""; position: absolute; inset: auto 0 0; height: 48px; background: linear-gradient(transparent, rgb(0 0 0 / 55%)); pointer-events: none; }
.cam-tile.off::after { display: none; }
.cam-tile :is(.cam-name, .cam-chip) { position: absolute; z-index: 1; }
.cam-tile .cam-name { inset-inline-start: 9px; inset-block-end: 7px; max-width: calc(100% - 18px); font-size: var(--fs-sm); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cam-tile.off .cam-name { color: var(--muted); }
/* The chip: a dot and a few words over the picture's top corner. Red for motion, grey for a camera out of reach. */
.cam-chip { inset-block-start: 8px; inset-inline-start: 8px; display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 9px; border-radius: 6px; background: rgb(0 0 0 / 45%); color: #fff; font-size: var(--fs-xs); font-weight: 600; font-variant-numeric: tabular-nums; }
.cam-chip::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--bad); }
.cam-chip.now::before { animation: pulse 1.4s ease-in-out infinite; }
.cam-chip.off { background: var(--bad-soft); color: var(--bad); }
.cam-chip.off::before { display: none; }
/* No picture yet, or none to be had: a camera drawn in its place. */
.cam-placeholder { display: grid; place-items: center; color: var(--faint); }
.cam-tile .cam-placeholder { position: absolute; inset: 0; }
.cam-tile .cam-placeholder .icon { width: 28px; height: 28px; }
@media (min-width: 600px) { .devices, .cam-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
/* The cameras on the tab: a strip that scrolls sideways, running to the screen's edges so the next one peeks in. */
.cam-strip {
  display: flex;
  gap: 10px;
  margin: 0 -14px 12px;
  padding: 2px 14px 6px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-padding-inline: 14px;
  scrollbar-width: none;
}
.cam-strip::-webkit-scrollbar { display: none; }
.cam-strip .cam-tile { flex: none; width: 160px; scroll-snap-align: start; }

/* ---------- home: the tab ---------- */
/* Its top: one line under the title. What needs a look first, in its colour, then what's on, then the temperature
   inside. Each named device opens its sheet. */
.glance-line { margin: 4px 4px 6px; font-size: var(--fs-md); font-weight: 500; line-height: 1.5; color: var(--muted); }
.glance-sep { margin-inline: 6px; color: var(--faint); }
.glance-item { display: inline; padding: 0; border: 0; background: none; color: var(--muted); font: inherit; font-weight: 500; text-decoration: none; cursor: pointer; }
.glance-item:active { opacity: 0.6; }
.glance-item.warn { color: var(--warn); font-weight: 600; }
.glance-item.bad { color: var(--bad); font-weight: 600; }
.glance-item.on { color: var(--run-text); }
.glance-item.cool { color: var(--cool-text); }
.glance-item.heat { color: var(--heat-text); }
.glance-item.moving { color: var(--info); }

/* ---------- home: solar ---------- */
/* The solar system under the glance line: the sun, the house, the battery and the grid, two to a row, then today. A
   power cut rings it in amber, the battery carrying the whole house. Each reading has its own colour, the same on the
   card, its sheet and the day's curve: the sun amber, the house the brand, the battery the running teal. */
.solar-card {
  display: block;
  width: 100%;
  margin-block: 6px 4px;
  padding: 14px 14px 13px;
  border: 0;
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  color: inherit;
  font: inherit;
  text-align: start;
  transition: transform 0.12s var(--ease), box-shadow 0.25s;
  animation: page-in 0.3s var(--ease) both;
}
.solar-card:active { transform: scale(0.99); }
.solar-card.warn { box-shadow: 0 0 0 2px var(--warn-circle), var(--shadow-on); }
.solar-head { display: flex; align-items: center; gap: 10px; }
.solar-head .chevron { width: 18px; height: 18px; color: var(--faint); }
.kicon.solar-mark { background: linear-gradient(145deg, color-mix(in srgb, var(--sun) 72%, #fff), var(--sun)); color: #fff; }
.solar-card.warn .kicon.solar-mark { background: linear-gradient(145deg, color-mix(in srgb, var(--warn-circle) 72%, #fff), var(--warn-circle)); }
.solar-titles { display: flex; flex-direction: column; }
.solar-title { font-size: var(--fs-lg); font-weight: 600; line-height: 1.25; }
.solar-sub { font-size: var(--fs-sm); color: var(--muted); }
.solar-cells { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-block-start: 12px; }
.solar-cell { display: flex; flex-direction: column; gap: 1px; padding: 10px 12px; border-radius: var(--radius); background: var(--surface-2); }
.solar-label { display: flex; align-items: center; gap: 6px; font-size: var(--fs-sm); color: var(--muted); }
.solar-label .icon { width: 16px; height: 16px; stroke-width: 2; }
.solar-label .icon.sun { color: var(--sun); }
.solar-label .icon.house { color: var(--brand); }
.solar-label .icon.battery { color: var(--run); }
.solar-value { font-size: var(--fs-xl); font-weight: 600; letter-spacing: -0.01em; }
.solar-word { font-size: var(--fs-sm); font-weight: 500; color: var(--muted); }
.solar-word.sun { color: color-mix(in srgb, var(--sun) 62%, var(--text)); }
.solar-word.battery { color: var(--run-text); }
.solar-word.sell { color: var(--info); }
.solar-word.warn { color: var(--warn); }
.solar-today { display: block; margin-block-start: 10px; padding-inline: 2px; font-size: var(--fs-sm); color: var(--muted); }
/* Its sheet: how long the battery lasts in a power cut, the share of the house it covered, the money, the curve. */
.solar-lasts { margin-block: 0 10px; color: var(--warn); font-weight: 500; }
.solar-bar { height: 8px; margin-block-start: 6px; border-radius: 4px; background: var(--track); overflow: hidden; }
.solar-bar > span { display: block; height: 100%; border-radius: 4px; background: var(--run); }
.solar-money { font-size: var(--fs-xl); font-weight: 600; }
.solar-curve { display: block; width: 100%; height: 112px; margin-block-start: 8px; overflow: visible; }
.solar-curve path { fill: none; vector-effect: non-scaling-stroke; stroke-linecap: round; stroke-linejoin: round; }
.solar-curve .solar-curve-rule { stroke: var(--line); stroke-width: 1; }
.solar-curve .solar-curve-sun { fill: color-mix(in srgb, var(--sun) 28%, transparent); stroke: none; }
.solar-curve .solar-curve-sun-line { stroke: var(--sun); stroke-width: 2; }
.solar-curve .solar-curve-house { stroke: var(--brand); stroke-width: 2; }
.solar-curve .solar-curve-battery { stroke: var(--run); stroke-width: 2; stroke-dasharray: 4 3; }
.solar-legend { gap: 6px 14px; margin-block-start: 6px; }
.solar-legend i { display: inline-block; width: 12px; height: 3px; margin-inline-end: 6px; border-radius: 2px; vertical-align: middle; }
.solar-legend i.sun { background: var(--sun); }
.solar-legend i.house { background: var(--brand); }
.solar-legend i.battery { background: var(--run); }

/* What's pinned, then each part of the house under its name, which opens the part's own screen. */
.pinned { margin-block-end: 4px; }
.area { margin-block-start: 10px; }
.area-head {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 44px;
  margin-inline: 4px;
  color: var(--text);
  font-size: var(--fs-lg);
  font-weight: 600;
  letter-spacing: -0.01em;
  text-decoration: none;
}
.area-head .chevron { width: 18px; height: 18px; color: var(--faint); }
.area-head:active { opacity: 0.7; }
/* Arrange at the end of a tab without Quick access, whose heading holds it otherwise. */
.arrange-open { margin-block-start: 14px; color: var(--muted); }
.arrange-open .icon { width: 18px; height: 18px; }

/* ---------- home: arranging the tab ---------- */
/* Each card at rest, with its star (in Quick access), its eye (on the tab, or kept off it) and the dots that say it can
   be picked up. A held card lifts over the rest and the others slide out of its way (arrange.js). A part of the house
   moves with the arrows by its name. */
.arrange-hint { margin: 0 6px 4px; font-size: var(--fs-sm); line-height: 1.45; color: var(--muted); }
.arrange-empty { margin: 0 0 12px; padding: 18px 14px; border: 1.5px dashed var(--line); border-radius: var(--radius); font-size: var(--fs-sm); color: var(--muted); text-align: center; }
.arrange-head { display: flex; align-items: center; gap: 2px; min-height: 44px; margin: 10px 0 0 4px; font-size: var(--fs-lg); font-weight: 600; letter-spacing: -0.01em; }
.arrange-head .icon-btn:disabled { opacity: 0.3; cursor: default; }
.arrange-tile { animation: none; cursor: grab; touch-action: manipulation; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.arrange-tile .device-main { cursor: inherit; }
.arrange-tile .device-main:active { transform: none; }
.arrange-tile .device-name { padding-inline-end: 22px; }
.arrange-tile.kept-off { box-shadow: none; outline: 1.5px dashed var(--line); outline-offset: -1.5px; }
.arrange-tile.kept-off :is(.kicon, .device-name) { opacity: 0.5; }
.arrange-tools { position: absolute; inset-block-start: 8px; inset-inline-end: 6px; z-index: 1; display: flex; }
.arrange-btn { width: 38px; height: 38px; padding: 0; border: 0; border-radius: 50%; display: grid; place-items: center; background: transparent; color: var(--faint); }
.arrange-btn .icon { width: 20px; height: 20px; }
.arrange-btn:active { background: var(--surface); }
.arrange-btn.star.on { color: var(--sun); }
.arrange-btn.star.on .icon { fill: currentColor; }
.arrange-btn.eye.on { color: var(--muted); }
.arrange-grip { position: absolute; inset-block-end: 12px; inset-inline-end: 12px; display: grid; color: var(--faint); pointer-events: none; }
.arrange-grip .icon { width: 18px; height: 18px; stroke-width: 3; }
.arrange-grid.sorting > .arrange-tile:not(.lifted) { transition: transform 0.18s var(--ease); }
.arrange-tile.lifted { z-index: 5; cursor: grabbing; box-shadow: 0 14px 30px rgb(0 0 0 / 22%); }
.arrange-reset { margin-block-start: 18px; }

/* ---------- chat ---------- */
/* Family tab rows: the name with the newest time on its right, the newest message under it. */
.row-title { display: flex; align-items: center; gap: 8px; min-width: 0; }
.row-title .when { flex: none; font-size: var(--fs-sm); color: var(--muted); font-variant-numeric: tabular-nums; }
.meta .preview { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item-row.unread .title-line { font-weight: 600; }
.item-row.unread .row-title .when { color: var(--brand); font-weight: 500; }
.item-row.unread .meta .preview { color: var(--text); }
.avatar.all { background: var(--brand-soft); color: var(--brand-strong); }
.avatar.all .icon { width: 22px; height: 22px; }

/* A chat fills the screen: the header sticks at the top, the writing bar at the bottom, the page scrolls between. */
.content.chat-page { padding-block: 0; }
.chat { display: flex; flex-direction: column; min-height: 100dvh; }
.chat-head {
  position: sticky;
  inset-block-start: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 6px;
  margin-inline: -14px;
  padding: calc(env(safe-area-inset-top) + 6px) 14px 8px 8px;
  background: var(--bg);
  border-block-end: 1px solid var(--line);
}
.app.has-banner .chat-head { inset-block-start: calc(env(safe-area-inset-top) + 40px); padding-block-start: 6px; }
.chat-head .who { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; padding: 4px 6px; border: 0; border-radius: var(--radius-sm); background: none; text-align: start; }
button.who:active { background: var(--surface-2); }
.chat-head .who-more { flex: none; width: 16px; height: 16px; color: var(--muted); margin-inline-start: -4px; }
.chat-head .titles { display: flex; flex-direction: column; min-width: 0; }
.chat-head .name { font-size: var(--fs-lg); font-weight: 600; line-height: 1.2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-head .sub { font-size: var(--fs-sm); color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-head .btn.sm { flex: none; gap: 5px; padding-inline: 11px 13px; }
.chat-head .btn.sm .icon { width: 16px; height: 16px; }

/* Few messages sit at the bottom, by the writing bar, as in any chat. */
.thread { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; padding-block: 10px 14px; }
.sysline { align-self: center; display: inline-flex; align-items: center; gap: 6px; margin-block: 4px 2px; padding: 5px 11px 5px 9px; border-radius: var(--radius-sm); background: var(--surface-2); color: var(--muted); font-size: var(--fs-sm); }
.sysline .icon { width: 14px; height: 14px; }
.chat-empty { align-self: center; max-width: 30ch; margin: 18px 0 0; color: var(--muted); font-size: var(--fs-md); text-align: center; }
.thread .day { align-self: center; margin-block: 14px 4px; font-size: var(--fs-sm); font-weight: 500; color: var(--muted); }

.msg { display: flex; flex-direction: column; align-items: flex-start; max-width: 80%; margin-block-start: 2px; }
.msg.gap { margin-block-start: 10px; }
.msg.mine { align-self: flex-end; align-items: flex-end; }
.msg .from { margin: 0 12px 2px; font-size: var(--fs-sm); font-weight: 500; color: var(--muted); }
.bwrap { position: relative; max-width: 100%; }
.msg.has-react .bwrap { margin-block-end: 13px; }
.bubble {
  display: block;
  max-width: 100%;
  margin: 0;
  padding: 8px 13px 9px;
  border: 0;
  border-radius: var(--radius-lg);
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow);
  font-size: var(--fs-md);
  line-height: 1.35;
  text-align: start;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  transition: transform 0.12s var(--ease), filter 0.12s;
}
.bubble:active:not(:disabled) { transform: scale(0.97); }
.bubble.held { filter: brightness(0.94); }
.bubble:disabled { cursor: default; }
.msg.mine .bubble { background: var(--brand-soft); box-shadow: none; }
.msg.sending .bubble { opacity: 0.6; }
/* A run of messages from one person reads as one block: the corners that face each other tighten. */
.msg:not(.mine).g-first .bubble { border-end-start-radius: 6px; }
.msg:not(.mine).g-mid .bubble { border-start-start-radius: 6px; border-end-start-radius: 6px; }
.msg:not(.mine).g-last .bubble { border-start-start-radius: 6px; }
.msg.mine.g-first .bubble { border-end-end-radius: 6px; }
.msg.mine.g-mid .bubble { border-start-end-radius: 6px; border-end-end-radius: 6px; }
.msg.mine.g-last .bubble { border-start-end-radius: 6px; }
.msg .when { margin: 3px 6px 0; font-size: var(--fs-xs); color: var(--muted); font-variant-numeric: tabular-nums; }
.react {
  position: absolute;
  inset-block-end: -13px;
  inset-inline-start: 10px;
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  background: var(--raised);
  box-shadow: 0 0 0 2px var(--bg), 0 2px 8px rgb(14 26 31 / 14%);
  font-size: var(--fs-md);
  line-height: 1;
  letter-spacing: 1px;
  animation: pop 0.34s cubic-bezier(0.3, 1.6, 0.5, 1);
}
.msg.mine .react { inset-inline-start: auto; inset-inline-end: 10px; }

/* The reactions bar: above the message, below it near the top; anywhere else on the screen closes it. */
.rbar-backdrop { position: fixed; inset: 0; z-index: 30; }
.rbar {
  position: absolute;
  inset-block-end: calc(100% + 6px);
  inset-inline-start: 0;
  z-index: 31;
  display: flex;
  align-items: center;
  gap: 1px;
  padding: 4px;
  border-radius: var(--radius-lg);
  background: var(--raised);
  box-shadow: var(--shadow-lg), 0 0 0 1px var(--line);
  animation: rbar-in 0.18s var(--ease);
}
.rbar.below { inset-block-end: auto; inset-block-start: calc(100% + 6px); }
.msg.mine .rbar { inset-inline-start: auto; inset-inline-end: 0; }
.rbar button { width: 36px; height: 36px; padding: 0; border: 0; border-radius: 50%; background: transparent; color: var(--muted); font-size: 21px; line-height: 1; display: grid; place-items: center; transition: transform 0.12s var(--ease), background 0.12s; }
.rbar button:hover, .rbar button:focus-visible { transform: scale(1.12); }
.rbar button.on { background: var(--brand-soft); }
.rbar button.danger { color: var(--bad); }
.rbar button .icon { width: 19px; height: 19px; }
.rbar-sep { width: 1px; height: 22px; margin-inline: 3px; background: var(--line); }
@keyframes rbar-in { from { opacity: 0; transform: translateY(6px) scale(0.94); } }

.composer {
  position: sticky;
  inset-block-end: 0;
  z-index: 10;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-inline: -14px;
  padding: 8px 14px calc(env(safe-area-inset-bottom) + 10px);
  background: var(--bg);
  border-block-start: 1px solid var(--line);
}
.composer-row { display: flex; align-items: center; gap: 8px; }
.composer .input { flex: 1; min-width: 0; min-height: 42px; padding: 9px 16px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
/* The photo button is a label around the file input: the tap itself opens the picker. */
.composer .attach { position: relative; flex: none; width: 42px; height: 42px; margin-inline-end: -4px; border-radius: 50%; color: var(--muted); display: grid; place-items: center; cursor: pointer; }
.composer .attach:active { background: var(--surface-2); }
.composer .attach input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.composer .attach:focus-within { outline: 2px solid var(--brand); outline-offset: 2px; }
.draft { position: relative; align-self: flex-start; display: flex; align-items: center; gap: 4px; padding: 4px; border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.draft img { display: block; width: 64px; height: 64px; border-radius: var(--radius-sm); object-fit: cover; }
.draft .spinner { position: absolute; inset-block-start: 26px; inset-inline-start: 26px; }
.draft .icon-btn { width: 34px; height: 34px; color: var(--muted); }
.draft .icon-btn .icon { width: 18px; height: 18px; }

/* A photo in the thread: its own shape, cropped only when it's taller than the chat has room for. */
.bubble.photo { padding: 3px; overflow: hidden; }
.bubble.photo img { display: block; width: 240px; max-width: 100%; height: auto; max-height: 320px; border-radius: var(--radius-lg); object-fit: cover; background: var(--surface-2); }
.msg.mine .bubble.photo { background: var(--brand-soft); }
.bubble.photo .caption { display: block; padding: 6px 10px 5px; }
.msg:not(.mine).g-first .bubble.photo img, .msg:not(.mine).g-mid .bubble.photo img { border-end-start-radius: 4px; }
.msg:not(.mine).g-mid .bubble.photo img, .msg:not(.mine).g-last .bubble.photo img { border-start-start-radius: 4px; }
.msg.mine.g-first .bubble.photo img, .msg.mine.g-mid .bubble.photo img { border-end-end-radius: 4px; }
.msg.mine.g-mid .bubble.photo img, .msg.mine.g-last .bubble.photo img { border-start-end-radius: 4px; }

/* A photo full screen, on black whatever the theme: the photo's own colours are what matter here. */
.viewer {
  position: fixed;
  inset: 0;
  z-index: 45;
  display: flex;
  flex-direction: column;
  padding: calc(env(safe-area-inset-top) + 8px) 0 calc(env(safe-area-inset-bottom) + 12px);
  background: #000;
  color: var(--viewer-ink);
  animation: fade 0.18s;
}
.viewer > img { flex: 1; min-height: 0; width: 100%; object-fit: contain; }
.viewer-close { align-self: flex-start; margin-inline-start: 8px; color: var(--viewer-ink); }
.viewer-close:active { background: rgb(255 255 255 / 12%); }
.viewer-foot { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 12px 16px 0; }
.viewer-caption { max-width: 60ch; margin: 0; font-size: var(--fs-md); text-align: center; overflow-wrap: anywhere; }
.viewer-meta, .viewer-reactions { font-size: var(--fs-sm); color: rgb(244 246 247 / 65%); }
.viewer-actions { display: flex; align-items: center; gap: 2px; padding: 4px; border-radius: var(--radius-lg); background: rgb(255 255 255 / 10%); }
.viewer-actions button { width: 40px; height: 40px; padding: 0; border: 0; border-radius: 50%; background: transparent; color: var(--viewer-ink); font-size: 22px; line-height: 1; display: grid; place-items: center; }
.viewer-actions button.on { background: rgb(255 255 255 / 22%); }
.viewer-actions button.danger { color: #ff8a7a; }
.viewer-actions button .icon { width: 20px; height: 20px; }
/* ---------- cameras ---------- */
/* A camera live: black like a photo, the picture across the width at its own shape, the other cameras under it. */
.viewer.cam-live { justify-content: flex-start; }
.viewer-bar { display: flex; align-items: center; gap: 8px; min-height: 48px; padding-inline: 8px 16px; }
.viewer-bar .viewer-close { align-self: center; margin: 0; }
.viewer-bar .title-line { font-weight: 600; }
.live-badge { padding: 2px 8px; border-radius: 10px; font-size: var(--fs-xs); font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; background: rgb(255 255 255 / 14%); color: rgb(244 246 247 / 65%); }
.live-badge.on { background: var(--bad); color: #fff; }
.live-badge.on::before { content: ""; display: inline-block; width: 6px; height: 6px; margin-inline-end: 6px; border-radius: 50%; background: #fff; animation: pulse 1.4s ease-in-out infinite; }
/* The picture fills its area exactly and letterboxes inside it, whichever way the phone is held: sized by the area,
   never by its own shape, so nothing is cut off. Touch is the page's own (pinch, drag, double-tap; mishaka.live). */
.live-stage { position: relative; flex: 1; min-height: 0; overflow: hidden; touch-action: none; }
.live-stage video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #000; transform-origin: center; }
.live-note { position: absolute; inset-block-start: 50%; inset-inline-start: 50%; z-index: 1; transform: translate(-50%, -50%); display: grid; justify-items: center; gap: 10px; padding: 12px 16px; border-radius: 14px; background: rgb(0 0 0 / 55%); color: var(--viewer-ink); text-align: center; }
/* Rewind, pause or play, back to live: over the bottom of the picture, fading with the rest after a few seconds. */
.live-controls { position: absolute; inset-inline: 0; inset-block-end: 0; z-index: 2; display: flex; align-items: center; justify-content: center; gap: 22px; padding: 30px 16px calc(14px + env(safe-area-inset-bottom)); background: linear-gradient(transparent, rgb(0 0 0 / 55%)); transition: opacity 0.2s; }
.live-ctl { display: inline-flex; align-items: center; justify-content: center; gap: 4px; min-width: 44px; height: 44px; padding: 0 12px; border: 0; border-radius: 22px; background: rgb(255 255 255 / 14%); color: var(--viewer-ink); font: inherit; font-size: var(--fs-sm); font-weight: 600; cursor: pointer; }
.live-ctl:active { background: rgb(255 255 255 / 26%); }
.live-ctl .icon { width: 20px; height: 20px; }
.live-ctl.main { width: 54px; height: 54px; padding: 0; border-radius: 50%; background: rgb(255 255 255 / 22%); }
.live-ctl.main .icon { width: 24px; height: 24px; }
.live-jump .dot { width: 7px; height: 7px; border-radius: 50%; background: rgb(244 246 247 / 45%); }
.live-jump.on .dot { background: var(--bad); }
.viewer.cam-live[data-chrome="hidden"] .live-controls { opacity: 0; pointer-events: none; }
/* When the picture is from, while it's paused or behind live: just above the controls, or at the bottom once they fade. */
.live-time { position: absolute; inset-inline-start: 50%; inset-block-end: calc(env(safe-area-inset-bottom) + 100px); z-index: 2; transform: translateX(-50%); padding: 4px 10px; border-radius: 12px; background: rgb(0 0 0 / 60%); color: var(--viewer-ink); font-size: var(--fs-sm); font-variant-numeric: tabular-nums; white-space: nowrap; pointer-events: none; transition: inset-block-end 0.2s; }
.live-time:empty { display: none; }
.viewer.cam-live[data-chrome="hidden"] .live-time { inset-block-end: calc(env(safe-area-inset-bottom) + 14px); }
/* A recording plays: its badge, in the recording's own quiet colour rather than live's red. */
.live-badge.rec { background: rgb(255 255 255 / 22%); color: var(--viewer-ink); }
/* The recordings under the picture: one button while closed; open, the day's chips, its track of what was recorded
   (tap to play from there), the jumps, and a line on what's playing. On the viewer's black, in its light text. */
.rec-open { display: flex; align-items: center; justify-content: center; gap: 8px; margin: 12px 16px 0; min-height: 44px; border: 0; border-radius: var(--radius); background: rgb(255 255 255 / 12%); color: var(--viewer-ink); font: inherit; font-weight: 600; cursor: pointer; }
.rec-open .icon { width: 20px; height: 20px; }
.rec-panel { display: grid; gap: 10px; padding: 12px 16px 0; color: var(--viewer-ink); }
.rec-days { display: flex; align-items: center; gap: 8px; }
.rec-panel .chip { background: rgb(255 255 255 / 12%); border-color: transparent; color: var(--viewer-ink); }
.rec-panel .chip.on { background: var(--brand); color: #fff; }
.rec-panel .chip:disabled { opacity: 0.4; }
.rec-panel .chip .icon { width: 16px; height: 16px; }
.rec-date { flex: 1; min-width: 0; height: 36px; padding: 0 10px; border: 0; border-radius: var(--radius-sm); background: rgb(255 255 255 / 12%); color: var(--viewer-ink); font: inherit; font-size: var(--fs-sm); color-scheme: dark; }
.rec-close { flex: none; color: var(--viewer-ink); }
/* The track and its labels take the finger whole (mishaka.recTrack): no scrolling, zooming or selecting under it.
   While a finger is down, a line and a bubble over it say the time it points at. */
.rec-scrub { position: relative; display: grid; gap: 2px; touch-action: none; user-select: none; -webkit-user-select: none; cursor: pointer; }
.rec-track { position: relative; height: 40px; border-radius: 6px; background: rgb(255 255 255 / 10%); overflow: hidden; }
.rec-span { position: absolute; inset-block: 6px; background: rgb(255 196 92 / 85%); border-radius: 1px; pointer-events: none; }
.rec-needle { position: absolute; inset-block: 0; width: 2px; margin-inline-start: -1px; background: #fff; box-shadow: 0 0 0 1px rgb(0 0 0 / 40%); pointer-events: none; }
.rec-ghost { display: none; position: absolute; inset-block: 0; width: 2px; margin-inline-start: -1px; background: var(--brand); pointer-events: none; }
.rec-bubble { display: none; position: absolute; inset-block-end: calc(100% + 6px); z-index: 2; transform: translateX(-50%); padding: 5px 10px; border-radius: 12px; background: #fff; color: #111; font-size: var(--fs-sm); font-weight: 600; white-space: nowrap; font-variant-numeric: tabular-nums; box-shadow: 0 2px 10px rgb(0 0 0 / 45%); pointer-events: none; }
.rec-scrub.scrubbing .rec-ghost, .rec-scrub.scrubbing .rec-bubble { display: block; }
/* The recordings, which two fingers stretch and slide (a transform, until the page draws the new stretch). */
.rec-strip { position: absolute; inset: 0; transform-origin: 0 0; pointer-events: none; }
.rec-scrub.pinching .rec-ghost, .rec-scrub.pinching .rec-needle { display: none; }
.rec-scrub.pinching .rec-scale { opacity: 0.3; }
.rec-scale { position: relative; height: 16px; font-size: var(--fs-xs); color: rgb(244 246 247 / 55%); font-variant-numeric: tabular-nums; }
.rec-scale span { position: absolute; transform: translateX(-50%); white-space: nowrap; }
.rec-scale span.first { transform: none; }
.rec-scale span.last { transform: translateX(-100%); }
.rec-zoom { display: flex; align-items: center; justify-content: center; gap: 14px; margin-block-start: -4px; font-size: var(--fs-sm); color: rgb(244 246 247 / 80%); }
.rec-zoom span { min-width: 7em; text-align: center; }
.rec-zoom .icon-btn { width: 34px; height: 34px; color: var(--viewer-ink); background: rgb(255 255 255 / 12%); }
.rec-zoom .icon-btn .icon { width: 18px; height: 18px; }
.rec-zoom .icon-btn:disabled { opacity: 0.35; cursor: default; }
/* One row whatever the phone: the two steps as narrow arrows, the four jumps sharing what's left. */
.rec-jumps { display: grid; grid-template-columns: 40px repeat(4, minmax(0, 1fr)) 40px; gap: 6px; }
.rec-jumps .chip { min-width: 0; justify-content: center; padding-inline: 4px; font-size: var(--fs-sm); white-space: nowrap; font-variant-numeric: tabular-nums; }
.rec-jumps .chip.step { padding-inline: 0; }
.rec-info { display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 24px; font-size: var(--fs-sm); color: rgb(244 246 247 / 80%); text-align: center; }
/* Sideways, the camera is the whole screen: the name bar floats over the top and fades with the controls, and the
   other cameras and the recordings step aside. */
@media (orientation: landscape) and (max-height: 600px) {
  .viewer.cam-live { padding: 0; }
  .viewer.cam-live .viewer-bar { position: absolute; inset-block-start: 0; inset-inline: 0; z-index: 3; padding: calc(env(safe-area-inset-top) + 6px) calc(env(safe-area-inset-right) + 16px) 18px calc(env(safe-area-inset-left) + 8px); background: linear-gradient(rgb(0 0 0 / 60%), transparent); transition: opacity 0.2s; }
  .viewer.cam-live[data-chrome="hidden"] .viewer-bar { opacity: 0; pointer-events: none; }
  .viewer.cam-live .live-others { display: none; }
  .viewer.cam-live .rec-open, .viewer.cam-live .rec-panel { display: none; }
}
/* The search's results: what moved, newest first, each a tap from playing. */
.empty-line { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 24px 8px; text-align: center; }
.search-count { margin: 4px 8px 0; }
.search-pick .input { width: auto; min-width: 9.5em; }
.search-result .chevron { color: var(--brand); }
/* The recorder's cropped picture of a person, car or bike, in place of the camera's emoji. */
.search-thumb { width: 38px; height: 38px; border-radius: var(--radius-sm); object-fit: cover; flex: none; background: var(--surface-2); }
.live-others { display: flex; gap: 10px; padding: 12px 16px 0; overflow-x: auto; scrollbar-width: none; }
.live-others::-webkit-scrollbar { display: none; }
.live-thumb { flex: none; width: 96px; padding: 0; border: 2px solid transparent; border-radius: var(--radius-sm); background: none; color: rgb(244 246 247 / 75%); font: inherit; font-size: var(--fs-xs); display: grid; gap: 4px; justify-items: center; cursor: pointer; }
.live-thumb img { width: 100%; aspect-ratio: 16 / 10; object-fit: cover; border-radius: 6px; background: #111; }
.live-thumb .cam-placeholder { width: 100%; aspect-ratio: 16 / 10; border-radius: 6px; background: #111; }
.sheet .live-thumb .cam-placeholder { background: var(--surface-2); }
.live-thumb.on { border-color: var(--brand); color: var(--viewer-ink); }
/* The same strip inside the alarm's sheet, on the sheet's own colours. */
.sheet .live-others { padding-inline: 0; }
.sheet .live-thumb { color: var(--muted); }
.sheet .live-thumb img { background: var(--surface-2); }
/* ---------- chat, continued: the send button ---------- */
.composer .send { flex: none; width: 42px; height: 42px; padding: 0; border: 0; border-radius: 50%; background: var(--brand); color: var(--on-brand); display: grid; place-items: center; transition: opacity 0.15s, transform 0.12s var(--ease); }
.composer .send .icon { width: 19px; height: 19px; }
.composer .send:disabled { opacity: 0.35; cursor: default; }
.composer .send:active:not(:disabled) { transform: scale(0.92); }
.chat-left { margin: 0 0 calc(env(safe-area-inset-bottom) + 18px); color: var(--muted); font-size: var(--fs-md); text-align: center; }

#blazor-error-ui {
  display: none;
  position: fixed;
  inset-inline: 0;
  inset-block-end: 0;
  z-index: 100;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  background: var(--bad);
  color: var(--on-bad);
}
#blazor-error-ui a { margin-inline-start: 12px; color: var(--on-bad); font-weight: 600; }

/* ---------- weather ---------- */
/* The forecast under Today's date: one line that opens the weather sheet. */
.weather-line { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 0 16px; min-height: 40px; margin: -6px 0 10px 2px; padding: 0 8px 0 0; overflow: hidden; border: 0; background: none; color: var(--text); font: inherit; font-size: var(--fs-md); font-weight: 500; text-align: start; cursor: pointer; }
/* A narrow phone breaks the line between its parts, never inside one. The dot between parts sits in the gap before
   each, so a part that starts the second line has its dot past the edge, where the line clips it. */
.weather-line > span { position: relative; white-space: nowrap; }
.weather-line > span + span::before { content: "·"; position: absolute; inset-inline-start: -10px; color: var(--muted); }
.weather-line .icon { width: 22px; height: 22px; margin-inline-end: -8px; }
.weather-line .weather-temp { font-weight: 600; }
.weather-line :is(.weather-range, .weather-kind) { color: var(--muted); }
.weather-line .weather-rain { color: var(--cool-text); }
/* The sky in colour: the sun amber, rain blue, a storm violet, cloud and fog the grey of the words. */
.icon.sky-sun { color: var(--sun); }
.icon.sky-rain { color: var(--cool); }
.icon.sky-storm { color: var(--storm); }
.icon.sky-cloud { color: var(--muted); }
.weather-now { display: flex; align-items: center; gap: 14px; margin-block-end: 6px; }
.weather-big { font-size: 44px; line-height: 1; font-weight: 600; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.weather-where { font-size: var(--fs-md); font-weight: 500; letter-spacing: 0; color: var(--muted); }
.weather-source { margin-block-start: 4px; font-size: var(--fs-xs); color: var(--faint); }
.weather-facts { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-block-start: 4px; font-size: var(--fs-sm); color: var(--muted); }
/* The forecaster's sentence under "now". */
.weather-summary { margin: 4px 0 2px; font-size: var(--fs-md); line-height: 1.4; }
.weather-hours { display: flex; gap: 6px; margin: 0 -16px 4px; padding: 0 16px 2px; overflow-x: auto; scrollbar-width: none; }
.weather-hours::-webkit-scrollbar { display: none; }
.weather-hour { flex: none; width: 60px; display: grid; justify-items: center; gap: 4px; padding: 10px 0; border-radius: var(--radius); background: var(--surface-2); font-size: var(--fs-sm); font-variant-numeric: tabular-nums; }
.weather-hour .icon { width: 20px; height: 20px; }
/* The hour's wind: an arrow pointing where it blows, then the speed in km/h. */
.weather-hour .wind { display: inline-flex; align-items: center; gap: 3px; font-size: var(--fs-xs); color: var(--muted); white-space: nowrap; }
.weather-hour .wind svg { width: 10px; height: 10px; }
.weather-hour .rain, .weather-day .rain { color: var(--cool-text); font-size: var(--fs-xs); }
/* A day is a button: it opens to its details below the row. */
.weather-day { display: grid; grid-template-columns: 1fr 24px 44px auto; align-items: center; gap: 10px; width: 100%; min-height: 44px; padding: 0; border: 0; background: none; color: inherit; font: inherit; text-align: start; cursor: pointer; font-variant-numeric: tabular-nums; }
:is(.weather-day, .weather-detail) + .weather-day { border-top: 1px solid var(--line); }
.weather-day .icon { width: 20px; height: 20px; }
.weather-day .lo { color: var(--muted); }
.weather-detail { display: grid; gap: 4px; padding: 0 0 12px; font-size: var(--fs-sm); color: var(--muted); }
.weather-asof { margin-block-start: 12px; font-size: var(--fs-xs); color: var(--faint); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}
