/* Homeboard shared styles. Family page = calm and big; engineering page = dense and dark. */
:root {
  --bg: #f3f4f6; --card: #ffffff; --ink: #111827; --muted: #6b7280; --line: #e5e7eb; --accent: #2563eb;
  --ok: #16a34a; --warn: #d97706; --bad: #dc2626; --chip: #eef2ff; --shadow: 0 1px 2px rgba(0,0,0,.06), 0 8px 24px rgba(0,0,0,.05);
  --radius: 18px; --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", Inter, sans-serif;
  --mono: "SF Mono", Menlo, Consolas, monospace;
}
html.dark {
  --bg: #0b0f17; --card: #141a24; --ink: #e5e7eb; --muted: #9aa3b2; --line: #232b38; --accent: #60a5fa;
  --ok: #34d399; --warn: #fbbf24; --bad: #f87171; --chip: #1c2433; --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.35);
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--ink); font-family: var(--font); -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-decoration: none; }
button { font: inherit; color: inherit; }
.mono { font-family: var(--mono); }
.muted { color: var(--muted); }
.ok { color: var(--ok); } .warn { color: var(--warn); } .bad { color: var(--bad); }
.hidden { display: none !important; }

/* ---------- family ---------- */
body.family { min-height: 100vh; padding: max(14px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(14px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left)); overflow-x: hidden; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.fam-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; padding: 6px 10px 18px; }
.fam-clock { font-size: clamp(48px, 8vw, 96px); font-weight: 700; letter-spacing: -0.03em; line-height: 0.95; font-variant-numeric: tabular-nums; }
.fam-date { font-size: clamp(16px, 2.2vw, 24px); color: var(--muted); margin-top: 6px; }
.fam-title { font-size: clamp(16px, 2vw, 22px); font-weight: 600; color: var(--muted); text-align: center; }
.fam-wx { text-align: right; display: flex; align-items: center; gap: 14px; }
.fam-wx .emoji { font-size: clamp(40px, 6vw, 72px); line-height: 1; }
.fam-wx .temp { font-size: clamp(36px, 5.5vw, 64px); font-weight: 600; letter-spacing: -0.02em; line-height: 1; }
.fam-wx .sub { color: var(--muted); font-size: clamp(14px, 1.6vw, 18px); margin-top: 4px; }
.fam-right { display: flex; align-items: center; gap: 16px; align-self: stretch; }
.fam-tools { display: grid; grid-template-columns: repeat(3, 40px); gap: 6px; justify-items: center; align-self: flex-start; align-content: start; }
.fam-tools .tool.door { grid-column: 1 / -1; justify-self: end; width: auto; height: 32px; border-radius: 999px; padding: 0 12px 0 9px; font-size: 13px; font-weight: 600; gap: 5px; color: var(--ink); white-space: nowrap; }
.fam-tools .tool.door .i { font-size: 15px; line-height: 1; }
.fam-tools .tool.door.locked { color: var(--ok); }
.fam-tools .tool.door.unlocked { color: var(--warn); }
.fam-tools .tool.door.jammed { color: var(--bad); }
.fam-tools .tool.door.busy { opacity: .6; }
.fam-tools .tool { position: relative; width: 40px; height: 40px; border-radius: 50%; border: 0; background: var(--card); box-shadow: var(--shadow); font-size: 18px; cursor: pointer; display: flex; align-items: center; justify-content: center; color: var(--muted); }
.fam-tools .tool:active { transform: scale(.94); }
#btn-ask { color: var(--accent); font-size: 20px; }
.badge-n { position: absolute; top: -4px; right: -4px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: var(--bad); color: white; font-size: 11px; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.fam-pages { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; -webkit-overflow-scrolling: touch; scrollbar-width: none; margin: 0 -4px; }
.fam-pages::-webkit-scrollbar { display: none; }
.fam-pages.single { overflow-x: hidden; }
.page { flex: 0 0 100%; scroll-snap-align: start; padding: 0 4px; min-width: 0; }
.page-dots { position: fixed; left: 50%; bottom: max(8px, env(safe-area-inset-bottom)); transform: translateX(-50%); display: flex; gap: 8px; z-index: 9; padding: 6px 10px; border-radius: 999px; background: color-mix(in srgb, var(--card) 70%, transparent); }
.page-dots span { width: 9px; height: 9px; border-radius: 50%; background: var(--muted); opacity: .4; cursor: pointer; }
.page-dots span.on { opacity: 1; background: var(--accent); }
.fam-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); grid-auto-rows: 8px; grid-auto-flow: dense; gap: 16px; align-items: stretch; min-height: 120px; }
.tile { position: relative; isolation: isolate; background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 20px; min-height: 150px; display: flex; flex-direction: column; overflow: hidden; container-type: inline-size; }
.tile > .tin { display: flex; flex-direction: column; flex: 0 0 auto; }   /* never squeezed: its height is the truth the packer reads */
.tile .hide-btn { display: none; position: absolute; top: 8px; right: 8px; width: 30px; height: 30px; border-radius: 50%; border: 0; background: var(--bad); color: white; font-size: 18px; line-height: 1; z-index: 3; cursor: pointer; }
body.arranging .tile .hide-btn { display: flex; align-items: center; justify-content: center; }
/* photo background + frosted tiles */
.bg { position: fixed; inset: 0; z-index: -1; background: var(--bg); pointer-events: none; }
.bg .layer { position: absolute; inset: 0; background: center / cover no-repeat; opacity: 0; transition: opacity 1.8s ease; }
.bg .layer.show { opacity: 1; }
body.photo { background: transparent; }
body.photo .bg::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(0,0,0,.28), rgba(0,0,0,.10) 30%, rgba(0,0,0,.30)); }
body.photo .fam-clock, body.photo .fam-date, body.photo .fam-title, body.photo .fam-wx .temp, body.photo .fam-wx .sub, body.photo .fam-wx .emoji { color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,.45), 0 6px 24px rgba(0,0,0,.35); }
body.photo .fam-footer, body.photo .fam-footer a { color: rgba(255,255,255,.75); text-shadow: 0 1px 2px rgba(0,0,0,.5); }
body.photo .tile { background: rgba(255,255,255,.80); box-shadow: 0 10px 30px rgba(0,0,0,.18); }
/* "liquid glass" on the photo background: deep blur with lifted colour, a lit top edge, a specular sheen
   falling from the top-left, and a soft lens glow just inside the rim */
body.photo.frost .tile {
  background: linear-gradient(160deg, rgba(255,255,255,.58) 0%, rgba(255,255,255,.40) 55%, rgba(255,255,255,.48) 100%);
  -webkit-backdrop-filter: blur(28px) saturate(1.8) brightness(1.04); backdrop-filter: blur(28px) saturate(1.8) brightness(1.04);
  border: 1px solid rgba(255,255,255,.42);
  box-shadow: 0 14px 44px rgba(0,0,0,.18), 0 1px 2px rgba(0,0,0,.06),
              inset 0 1px 0 rgba(255,255,255,.85), inset 1px 0 0 rgba(255,255,255,.4), inset -1px 0 0 rgba(255,255,255,.18), inset 0 -1px 0 rgba(255,255,255,.2);
}
body.photo.frost .tile::before {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; z-index: -1;
  background: radial-gradient(140% 70% at 18% -20%, rgba(255,255,255,.55), rgba(255,255,255,0) 60%),
              radial-gradient(80% 50% at 100% 110%, rgba(255,255,255,.22), rgba(255,255,255,0) 60%);
}
body.photo.frost .tile::after { content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; z-index: -1; box-shadow: inset 0 0 18px rgba(255,255,255,.28); }
html.dark body.photo .tile { background: rgba(20,26,36,.78); }
html.dark body.photo.frost .tile {
  background: linear-gradient(160deg, rgba(34,42,58,.62) 0%, rgba(20,26,36,.48) 55%, rgba(26,33,46,.56) 100%);
  border-color: rgba(255,255,255,.16);
  box-shadow: 0 14px 44px rgba(0,0,0,.42), 0 1px 2px rgba(0,0,0,.3),
              inset 0 1px 0 rgba(255,255,255,.22), inset 1px 0 0 rgba(255,255,255,.10), inset -1px 0 0 rgba(255,255,255,.05), inset 0 -1px 0 rgba(255,255,255,.06);
}
html.dark body.photo.frost .tile::before { background: radial-gradient(140% 70% at 18% -20%, rgba(255,255,255,.16), rgba(255,255,255,0) 60%), radial-gradient(80% 50% at 100% 110%, rgba(255,255,255,.07), rgba(255,255,255,0) 60%); }
html.dark body.photo.frost .tile::after { box-shadow: inset 0 0 18px rgba(255,255,255,.07); }
body.photo .tile.ghost { background: var(--card); }
body.photo .fam-tools .tool { background: rgba(255,255,255,.7); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); }
html.dark body.photo .fam-tools .tool { background: rgba(20,26,36,.6); }
body.photo.frost .fam-tools .tool { background: linear-gradient(160deg, rgba(255,255,255,.66), rgba(255,255,255,.44)); border: 1px solid rgba(255,255,255,.5); box-shadow: 0 6px 18px rgba(0,0,0,.16), inset 0 1px 0 rgba(255,255,255,.85); -webkit-backdrop-filter: blur(18px) saturate(1.8); backdrop-filter: blur(18px) saturate(1.8); }
html.dark body.photo.frost .fam-tools .tool { background: linear-gradient(160deg, rgba(34,42,58,.64), rgba(20,26,36,.5)); border-color: rgba(255,255,255,.16); box-shadow: 0 6px 18px rgba(0,0,0,.35), inset 0 1px 0 rgba(255,255,255,.22); }
body.photo .page-dots { background: rgba(0,0,0,.28); } body.photo .page-dots span { background: #fff; }
body.photo.frost .page-dots { background: rgba(255,255,255,.28); border: 1px solid rgba(255,255,255,.35); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); }
@media (prefers-reduced-motion: reduce) { .bg .layer { transition: none; } }
/* width in columns (w1-w3, from Settings) and height (size-s/m/l), scaled by the screen's row-height choice */
body { --rowscale: 1; }
body.rows-compact { --rowscale: .78; }
body.rows-tall { --rowscale: 1.35; }
.tile { min-height: calc(150px * var(--rowscale)); }
.tile.size-s { min-height: calc(110px * var(--rowscale)); }
.tile.size-l { min-height: calc(230px * var(--rowscale)); }
.tile.w2 { grid-column: span 2; }
.tile.w3 { grid-column: span 3; }
@media (max-width: 1000px) { .tile.w3 { grid-column: span 2; } }
@media (max-width: 700px) { .tile.w2, .tile.w3 { grid-column: span 1; } }
.tile h3 { margin: 0 0 10px; font-size: 13px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); display: flex; justify-content: space-between; align-items: center; }
.tile h3 .right { font-weight: 500; letter-spacing: 0; text-transform: none; }
.tile .big { font-size: clamp(34px, 4.5vw, 56px); font-weight: 700; letter-spacing: -0.02em; line-height: 1; }
.tile .sub { color: var(--muted); font-size: 15px; margin-top: 6px; }
.tile.not-ready { opacity: .7; }
.tile .waiting { color: var(--muted); font-size: 15px; line-height: 1.5; margin: auto 0; }
.tile .waiting small { display: block; font-family: var(--mono); font-size: 11px; opacity: .8; margin-top: 6px; word-break: break-all; }
.row { display: flex; align-items: center; gap: 12px; }
.grow { flex: 1; }
.badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--chip); color: var(--ink); white-space: nowrap; }
.badge.ok { background: color-mix(in srgb, var(--ok) 18%, transparent); color: var(--ok); }
.badge.warn { background: color-mix(in srgb, var(--warn) 20%, transparent); color: var(--warn); }
.badge.bad { background: color-mix(in srgb, var(--bad) 18%, transparent); color: var(--bad); }
.badge.accent { background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--accent); }
/* weather tile */
.wx-now { display: flex; align-items: center; gap: 18px; }
.wx-now .emoji { font-size: 64px; line-height: 1; }
.wx-hours { display: flex; gap: 6px; overflow: hidden; margin-top: 14px; }
.wx-hour { flex: 1 0 0; min-width: 0; text-align: center; font-size: 13px; color: var(--muted); }
.wx-hour .e { font-size: 20px; }
.wx-hour .t { color: var(--ink); font-weight: 600; font-size: 14px; }
.wx-hour .p { color: var(--accent); font-size: 11px; height: 14px; }
.wx-days { display: flex; gap: 6px; margin-top: 12px; border-top: 1px solid var(--line); padding-top: 12px; }
.wx-day { flex: 1 0 0; text-align: center; font-size: 13px; color: var(--muted); }
.wx-day .e { font-size: 22px; }
.wx-day .hl { color: var(--ink); font-weight: 600; font-size: 14px; }
.wx-day .hl span { color: var(--muted); font-weight: 400; }
/* calendar */
.cal-day { margin-bottom: 10px; }
.cal-day h4 { margin: 0 0 4px; font-size: 13px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.cal-day h4.today { color: var(--accent); }
.cal-ev { display: flex; align-items: baseline; gap: 10px; padding: 4px 0; font-size: 17px; line-height: 1.3; }
.cal-ev .dot { width: 10px; height: 10px; border-radius: 50%; flex: none; position: relative; top: 1px; }
.cal-ev .when { color: var(--muted); font-variant-numeric: tabular-nums; min-width: 84px; font-size: 15px; }
.cal-ev .what { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-ev .where { color: var(--muted); font-size: 13px; }
.cal-ev.past { opacity: .45; }
.cal-empty { color: var(--muted); font-size: 16px; padding: 6px 0; }
/* people */
.people { display: flex; flex-wrap: wrap; gap: 12px; }
.person { display: flex; align-items: center; gap: 10px; padding: 10px 14px 10px 10px; border-radius: 14px; background: var(--chip); min-width: 150px; }
.person .avatar { width: 44px; height: 44px; border-radius: 50%; background: var(--accent); color: white; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 18px; background-size: cover; background-position: center; }
.person.away .avatar { background-color: var(--muted); }
.person .name { font-weight: 600; font-size: 16px; }
.person .where { font-size: 13px; color: var(--muted); }
/* climate */
.climate { display: flex; align-items: center; gap: 22px; }
.climate .target { font-size: 15px; color: var(--muted); }
.climate .sensors { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px 14px; margin-top: 12px; }
.climate .sensor { font-size: 14px; color: var(--muted); }
.climate .sensor b { color: var(--ink); font-weight: 600; font-size: 16px; }
.climate .sensor .occ { color: var(--accent); font-weight: 700; margin-left: 2px; }
/* generic key/value lists */
.kv { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px 16px; }
.kv .item .v { font-size: 26px; font-weight: 700; letter-spacing: -0.01em; }
.kv .item .v.accent { color: var(--accent); }
.kv .item .v small { font-size: 14px; font-weight: 500; color: var(--muted); margin-left: 3px; }
.kv .item .l { font-size: 13px; color: var(--muted); }
/* machines / lists */
.list { display: flex; flex-direction: column; gap: 8px; }
.list .li { display: flex; align-items: center; gap: 12px; font-size: 17px; }
.list .li .l { flex: 1; }
.list .li .r { color: var(--muted); font-size: 14px; }
/* car */
.car .bar { height: 12px; border-radius: 999px; background: var(--line); overflow: hidden; margin: 10px 0 6px; }
.car .bar > div { height: 100%; background: var(--ok); border-radius: 999px; transition: width .6s; }
.car .bar.low > div { background: var(--warn); }
.car .bar.crit > div { background: var(--bad); }
/* alerts */
.alert-ok { display: flex; align-items: center; gap: 12px; font-size: 22px; font-weight: 600; color: var(--ok); margin: auto 0; }
.alert-ok small { display: block; font-size: 13px; color: var(--muted); font-weight: 400; }
.alert { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px; margin-bottom: 8px; font-size: 17px; font-weight: 600; }
.alert.critical { background: color-mix(in srgb, var(--bad) 16%, transparent); color: var(--bad); }
.alert.warning { background: color-mix(in srgb, var(--warn) 18%, transparent); color: var(--warn); }
.alert.info { background: var(--chip); color: var(--ink); font-weight: 500; }
.alert .t { margin-left: auto; font-size: 13px; font-weight: 400; color: var(--muted); }
/* actions */
.actions { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.action { border: 0; border-radius: 14px; background: var(--chip); padding: 14px 10px; font-size: 15px; font-weight: 600; display: flex; flex-direction: column; align-items: center; gap: 6px; cursor: pointer; transition: transform .08s, background .2s; min-height: 78px; }
.action .i { font-size: 26px; line-height: 1; }
.action:active { transform: scale(.96); }
.action.on { background: color-mix(in srgb, var(--accent) 22%, transparent); }
.action .st { font-size: 11px; font-weight: 500; opacity: .7; margin-top: -2px; }
.action.light.on { background: color-mix(in srgb, var(--lt, var(--accent)) 26%, transparent); }
.action.light .i { filter: saturate(1.2); }
.lightlist { display: flex; flex-direction: column; gap: 14px; }
.lightrow { background: var(--chip); border-radius: 14px; padding: 12px 14px; }
.lightrow .lpct { font-variant-numeric: tabular-nums; color: var(--muted); min-width: 4ch; text-align: right; }
.lightrow.on .lpct { color: var(--ink); font-weight: 600; }
.lsw { width: 46px; height: 28px; border-radius: 999px; border: 0; background: var(--line); position: relative; cursor: pointer; flex: none; padding: 0; }
.lsw span { position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.3); transition: transform .15s; }
.lsw.on { background: var(--ok); } .lsw.on span { transform: translateX(18px); }
.lslide { width: 100%; margin: 12px 0 2px; accent-color: var(--accent); height: 34px; }
.shades { display: flex; flex-direction: column; gap: 10px; }
.shrow { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.shrow.picks { display: grid; grid-template-columns: repeat(auto-fit, minmax(44px, 1fr)); gap: 8px; }
.shp { height: 42px; padding: 0 6px; border: 1.5px solid var(--line); border-radius: 12px; background: var(--card); color: var(--ink); font-weight: 700; font-size: 17px; cursor: pointer; transition: background .15s, border-color .15s; }
.shp.on { background: color-mix(in srgb, var(--accent) 22%, transparent); border-color: var(--accent); color: var(--accent); }
.shhow { flex: 1; min-width: 120px; text-align: right; }
.shcmds { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
.shc { border: 0; border-radius: 14px; background: var(--chip); color: var(--ink); padding: 14px 8px; font-size: 16px; font-weight: 600; cursor: pointer; min-height: 58px; transition: transform .08s, background .2s; }
.shc.stop { background: color-mix(in srgb, var(--bad) 16%, transparent); }
.shc:active { transform: scale(.96); }
.shc.busy { opacity: .5; pointer-events: none; }
.shc.done { background: color-mix(in srgb, var(--ok) 25%, transparent); }
.shc.fail { background: color-mix(in srgb, var(--bad) 35%, transparent); }
.shmsg { min-height: 16px; }
.action.dead { opacity: .45; }
.action.busy { opacity: .5; pointer-events: none; }
.action.done { background: color-mix(in srgb, var(--ok) 25%, transparent); }
.action.fail { background: color-mix(in srgb, var(--bad) 25%, transparent); }
/* media */
.media { display: flex; gap: 14px; align-items: center; }
.media .art { width: 84px; height: 84px; border-radius: 12px; background: var(--chip) center/cover; flex: none; }
.media .t { font-size: 20px; font-weight: 600; }
/* footer */
.fam-footer { display: flex; justify-content: space-between; align-items: center; margin-top: 14px; padding: 6px 10px; color: var(--muted); font-size: 12px; }
.fam-footer a { color: var(--muted); }
.setup { background: color-mix(in srgb, var(--warn) 14%, var(--card)); border-radius: 12px; padding: 10px 14px; font-size: 13px; color: var(--ink); margin-top: 14px; }
.setup b { color: var(--warn); }
.offline { position: fixed; top: 10px; left: 50%; transform: translateX(-50%); background: var(--bad); color: white; padding: 6px 14px; border-radius: 999px; font-size: 13px; font-weight: 600; z-index: 10; }

/* ---------- login ---------- */
.login { max-width: 380px; margin: 14vh auto; background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 28px; }
.login h1 { margin: 0 0 6px; font-size: 22px; }
.login p { color: var(--muted); margin: 0 0 18px; }
.login input { width: 100%; font-size: 18px; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg); color: var(--ink); }
.login button { width: 100%; margin-top: 12px; padding: 12px; border-radius: 12px; border: 0; background: var(--accent); color: white; font-size: 16px; font-weight: 600; }
.login .err { color: var(--bad); margin-top: 10px; }

/* ---------- engineering ---------- */
body.eng { --bg: #0b0f17; --card: #121826; --ink: #e5e7eb; --muted: #8b95a7; --line: #1f2937; --accent: #60a5fa; --chip: #1a2233; --ok: #34d399; --warn: #fbbf24; --bad: #f87171;
  font-size: 13px; height: 100vh; display: flex; flex-direction: column; overflow: hidden; }
.eng-top { display: flex; align-items: center; gap: 14px; padding: 8px 14px; border-bottom: 1px solid var(--line); background: var(--card); flex: none; }
.eng-top h1 { font-size: 15px; margin: 0; font-weight: 700; letter-spacing: .04em; }
.eng-top .status { display: flex; gap: 8px; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px; border-radius: 999px; background: var(--chip); font-size: 12px; }
.pill::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.pill.ok::before { background: var(--ok); } .pill.bad::before { background: var(--bad); } .pill.warn::before { background: var(--warn); }
.eng-top .spacer { flex: 1; }
.eng-top a, .eng-top button.link { color: var(--muted); background: none; border: 0; cursor: pointer; font-size: 12px; padding: 4px 6px; }
.eng-top a:hover, .eng-top button.link:hover { color: var(--ink); }
.eng-main { display: flex; flex: 1; min-height: 0; }
.eng-side { width: 360px; flex: none; border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; background: var(--card); }
.eng-side .tools { padding: 8px; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 6px; }
.eng-side input[type=search] { width: 100%; padding: 6px 8px; border-radius: 8px; border: 1px solid var(--line); background: var(--bg); color: var(--ink); font-size: 13px; }
.chips { display: flex; flex-wrap: wrap; gap: 4px; }
.chip { padding: 2px 8px; border-radius: 999px; background: var(--chip); border: 1px solid transparent; font-size: 11px; cursor: pointer; color: var(--muted); }
.chip.on { color: var(--ink); border-color: var(--accent); }
.series-list { flex: 1; overflow-y: auto; }
.srow { display: grid; grid-template-columns: 18px 1fr 84px 70px; gap: 6px; align-items: center; padding: 4px 8px; border-bottom: 1px solid var(--line); cursor: pointer; }
.srow:hover { background: var(--chip); }
.srow.sel { background: color-mix(in srgb, var(--accent) 14%, transparent); }
.srow .k { font-family: var(--mono); font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.srow .n { font-size: 11px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.srow .v { text-align: right; font-family: var(--mono); font-size: 12px; }
.srow .v small { color: var(--muted); font-size: 10px; }
.srow .age { font-size: 10px; color: var(--muted); text-align: right; }
.srow canvas { width: 70px; height: 22px; }
.srow .sw { width: 10px; height: 10px; border-radius: 2px; border: 1px solid var(--line); }
.eng-content { flex: 1; display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.tabs { display: flex; gap: 2px; padding: 6px 10px 0; border-bottom: 1px solid var(--line); background: var(--card); flex: none; }
.tab { padding: 7px 12px; border-radius: 8px 8px 0 0; cursor: pointer; color: var(--muted); border: 1px solid transparent; border-bottom: 0; }
.tab.on { color: var(--ink); background: var(--bg); border-color: var(--line); }
.panel { display: none; flex: 1; min-height: 0; overflow: auto; padding: 10px 12px; }
.panel.on { display: flex; flex-direction: column; }
.toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.toolbar .sep { width: 1px; height: 18px; background: var(--line); }
.btn { padding: 4px 10px; border-radius: 6px; border: 1px solid var(--line); background: var(--card); color: var(--ink); cursor: pointer; font-size: 12px; }
.btn.on, .btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); color: #0b0f17; border-color: var(--accent); font-weight: 600; }
.btn.danger { border-color: var(--bad); color: var(--bad); }
.eng input[type=text], .eng input[type=number], .eng select, .eng textarea { padding: 5px 8px; border-radius: 6px; border: 1px solid var(--line); background: var(--bg); color: var(--ink); font-size: 12px; font-family: var(--mono); }
.eng textarea { width: 100%; min-height: 70px; }
#chart { flex: 1; min-height: 260px; }
.legend { display: flex; flex-wrap: wrap; gap: 10px; font-size: 12px; margin-top: 6px; }
.legend .li { display: flex; align-items: center; gap: 6px; }
.legend .sw { width: 12px; height: 4px; border-radius: 2px; }
table.grid { width: 100%; border-collapse: collapse; font-size: 12px; }
table.grid th { text-align: left; color: var(--muted); font-weight: 600; padding: 4px 8px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--bg); }
table.grid td { padding: 4px 8px; border-bottom: 1px solid var(--line); vertical-align: top; font-family: var(--mono); font-size: 11.5px; }
table.grid tr:hover td { background: var(--chip); }
table.grid td.wrap { white-space: pre-wrap; word-break: break-all; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; margin-bottom: 12px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.card .l { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.card .v { font-size: 22px; font-weight: 700; font-family: var(--mono); margin-top: 2px; }
.card .v small { font-size: 12px; color: var(--muted); font-weight: 400; }
.card .s { font-size: 11px; color: var(--muted); margin-top: 2px; }
.eng h2 { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 14px 0 6px; }
pre.doc { background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 10px; font-size: 11.5px; overflow: auto; white-space: pre; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 900px) { .eng-side { width: 260px; } .two { grid-template-columns: 1fr; } }
#json { white-space: pre; font-family: var(--mono); font-size: 11.5px; background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 10px; overflow: auto; max-height: 300px; }
.toast { position: fixed; bottom: 16px; right: 16px; background: var(--card); border: 1px solid var(--line); border-left: 4px solid var(--accent); padding: 10px 14px; border-radius: 8px; font-size: 13px; box-shadow: var(--shadow); z-index: 20; }
.toast.bad { border-left-color: var(--bad); } .toast.ok { border-left-color: var(--ok); }

/* ---------- lists (reminders) ---------- */
.lists { display: flex; flex-direction: column; gap: 12px; flex: 1; min-height: 0; }
.rlist h4 { margin: 0 0 4px; font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); display: flex; align-items: center; gap: 8px; }
.rlist h4 .dot { width: 10px; height: 10px; border-radius: 50%; }
.rlist h4 .n { margin-left: auto; font-weight: 500; }
.ritem { display: flex; align-items: center; gap: 12px; padding: 7px 4px; font-size: 18px; border-bottom: 1px solid var(--line); cursor: pointer; -webkit-tap-highlight-color: transparent; }
.ritem:last-of-type { border-bottom: 0; }
.ritem .box { width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--muted); flex: none; display: flex; align-items: center; justify-content: center; font-size: 15px; color: white; transition: background .15s; }
.ritem.done .box { background: var(--ok); border-color: var(--ok); }
.ritem.done .t { text-decoration: line-through; color: var(--muted); }
.ritem .due { margin-left: auto; font-size: 13px; color: var(--muted); }
.ritem.busy { opacity: .5; pointer-events: none; }
.radd { display: flex; gap: 8px; margin-top: 8px; }
.radd input { flex: 1; font-size: 16px; padding: 9px 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg); color: var(--ink); }
.radd button { border: 0; border-radius: 12px; padding: 0 16px; background: var(--accent); color: white; font-size: 18px; font-weight: 700; }
.list-empty { color: var(--muted); font-size: 15px; padding: 6px 4px; }
/* notes */
.note { font-size: 17px; line-height: 1.5; overflow: auto; max-height: 360px; }
.note h1 { font-size: 22px; margin: 0 0 8px; } .note h2 { font-size: 19px; margin: 8px 0 4px; } .note h3 { font-size: 17px; margin: 6px 0 2px; }
.note ul, .note ol { margin: 4px 0 4px 22px; padding: 0; }
.note div:empty { height: 8px; }
.note-tabs { display: flex; gap: 6px; margin-bottom: 8px; flex-wrap: wrap; }
.note-tabs button { border: 0; border-radius: 999px; padding: 5px 12px; background: var(--chip); color: var(--ink); font-size: 13px; }
.note-tabs button.on { background: var(--accent); color: white; }
/* quick add */
.qadd { display: flex; gap: 8px; margin-top: auto; padding-top: 10px; align-items: center; }
.qadd input { flex: 1; font-size: 16px; padding: 9px 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg); color: var(--ink); }
.qadd .hint { font-size: 12px; color: var(--muted); white-space: nowrap; }
.qadd .ok { color: var(--ok); font-size: 13px; }
/* recipes tile */
.rtile .plan { font-size: 16px; padding: 3px 0; }
.rtile .plan .when { color: var(--muted); font-size: 14px; margin-right: 8px; }
.rtile a.big { display: block; margin-top: auto; text-align: center; background: var(--accent); color: white; border-radius: 12px; padding: 12px; font-size: 17px; font-weight: 600; }

/* ---------- recipes pages ---------- */
body.recipes { padding: 16px max(16px, env(safe-area-inset-right)) 24px max(16px, env(safe-area-inset-left)); }
.rc-top { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; flex-wrap: wrap; }
.rc-top h1 { font-size: 30px; margin: 0; font-weight: 700; letter-spacing: -0.02em; }
.rc-top .back { font-size: 17px; }
.rc-top input[type=search] { flex: 1; min-width: 200px; font-size: 17px; padding: 10px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--card); color: var(--ink); }
.rc-top .btn { font-size: 15px; padding: 10px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--card); color: var(--ink); cursor: pointer; }
.rc-top .btn.primary { background: var(--accent); color: white; border-color: var(--accent); }
.rc-tags { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.rc-tags .chip { font-size: 14px; padding: 5px 12px; border-radius: 999px; background: var(--card); box-shadow: var(--shadow); cursor: pointer; }
.rc-tags .chip.on { background: var(--accent); color: white; }
.rc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.rc-card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; cursor: pointer; display: flex; flex-direction: column; min-height: 150px; }
.rc-card .img { height: 130px; background: var(--chip) center/cover; }
.rc-card .body { padding: 12px 14px; }
.rc-card .t { font-size: 18px; font-weight: 600; line-height: 1.2; }
.rc-card .m { color: var(--muted); font-size: 13px; margin-top: 4px; }
.rc-detail { display: grid; grid-template-columns: 1fr 1.4fr; gap: 20px; align-items: start; }
@media (max-width: 800px) { .rc-detail { grid-template-columns: 1fr; } }
.rc-detail .panel-card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 20px; }
.rc-detail .hero { height: 220px; border-radius: 14px; background: var(--chip) center/cover; margin-bottom: 14px; }
.rc-detail h2 { font-size: 15px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 0 0 10px; display: flex; align-items: center; gap: 10px; }
.rc-detail h2 .sp { margin-left: auto; display: flex; align-items: center; gap: 6px; text-transform: none; letter-spacing: 0; font-size: 15px; }
.rc-detail h2 .sp button { border: 1px solid var(--line); background: var(--bg); color: var(--ink); border-radius: 8px; width: 32px; height: 32px; font-size: 18px; }
.ing { display: flex; align-items: flex-start; gap: 12px; padding: 8px 2px; font-size: 18px; border-bottom: 1px solid var(--line); cursor: pointer; }
.ing .box { width: 24px; height: 24px; border-radius: 6px; border: 2px solid var(--muted); flex: none; margin-top: 2px; display: flex; align-items: center; justify-content: center; color: white; font-size: 14px; }
.ing.done .box { background: var(--ok); border-color: var(--ok); } .ing.done span.t { text-decoration: line-through; color: var(--muted); }
.step { display: flex; gap: 14px; padding: 10px 0; font-size: 19px; line-height: 1.45; border-bottom: 1px solid var(--line); cursor: pointer; }
.step .n { flex: none; width: 34px; height: 34px; border-radius: 50%; background: var(--chip); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 16px; }
.step.done { opacity: .4; }
.rc-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.rc-actions button, .rc-actions label { border: 1px solid var(--line); background: var(--bg); color: var(--ink); border-radius: 12px; padding: 10px 14px; font-size: 15px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.rc-actions button.primary { background: var(--accent); color: white; border-color: var(--accent); }
.rc-actions input[type=date] { font: inherit; border: 0; background: transparent; color: var(--ink); }
.rc-form { display: grid; gap: 10px; max-width: 760px; }
.rc-form input, .rc-form textarea { width: 100%; font: inherit; font-size: 16px; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--card); color: var(--ink); }
.rc-form textarea { min-height: 120px; }
.rc-form label { font-size: 13px; color: var(--muted); }
.rc-msg { margin-top: 10px; color: var(--muted); font-size: 14px; }

/* ---------- detail sheets ---------- */
.sheet { position: fixed; inset: 0; background: rgba(0,0,0,.45); display: flex; align-items: center; justify-content: center; z-index: 50; padding: 20px; -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
.sheet-card { background: var(--card); color: var(--ink); border-radius: 22px; width: min(980px, 100%); max-height: 92vh; display: flex; flex-direction: column; box-shadow: 0 30px 80px rgba(0,0,0,.45); }
body.photo.frost .sheet { background: rgba(0,0,0,.28); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
body.photo.frost .sheet-card { position: relative; isolation: isolate; background: linear-gradient(160deg, rgba(255,255,255,.72) 0%, rgba(255,255,255,.58) 55%, rgba(255,255,255,.66) 100%); -webkit-backdrop-filter: blur(34px) saturate(1.8) brightness(1.03); backdrop-filter: blur(34px) saturate(1.8) brightness(1.03); border: 1px solid rgba(255,255,255,.5); box-shadow: 0 30px 80px rgba(0,0,0,.4), inset 0 1px 0 rgba(255,255,255,.9), inset 1px 0 0 rgba(255,255,255,.45), inset 0 -1px 0 rgba(255,255,255,.2); }
body.photo.frost .sheet-card::before { content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; z-index: -1; background: radial-gradient(120% 50% at 15% -15%, rgba(255,255,255,.5), rgba(255,255,255,0) 60%); }
html.dark body.photo.frost .sheet-card { background: linear-gradient(160deg, rgba(34,42,58,.76) 0%, rgba(20,26,36,.64) 55%, rgba(26,33,46,.7) 100%); border-color: rgba(255,255,255,.16); box-shadow: 0 30px 80px rgba(0,0,0,.6), inset 0 1px 0 rgba(255,255,255,.22), inset 1px 0 0 rgba(255,255,255,.1), inset 0 -1px 0 rgba(255,255,255,.06); }
html.dark body.photo.frost .sheet-card::before { background: radial-gradient(120% 50% at 15% -15%, rgba(255,255,255,.14), rgba(255,255,255,0) 60%); }
.sheet-head { display: flex; align-items: center; gap: 12px; padding: 18px 22px 8px; }
.sheet-head h2 { margin: 0; font-size: 24px; font-weight: 700; flex: 1; letter-spacing: -0.01em; }
.sheet-head .close { border: 0; background: var(--chip); color: var(--ink); width: 42px; height: 42px; border-radius: 50%; font-size: 26px; line-height: 1; cursor: pointer; }
.sheet-body { overflow: auto; padding: 6px 22px 24px; font-size: 17px; -webkit-overflow-scrolling: touch; }
.sheet .chart { min-height: 240px; height: auto; margin: 4px 0 10px; }
.sheet .u-legend { font-size: 12px; color: var(--muted); }
.sheet h4 { font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 18px 0 8px; }
.sheet table.dt { width: 100%; border-collapse: collapse; font-size: 16px; }
.sheet table.dt td, .sheet table.dt th { padding: 8px 6px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.sheet table.dt th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; }
.ctl { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.ctl button { border: 0; background: var(--chip); color: var(--ink); border-radius: 12px; padding: 12px 18px; font-size: 18px; font-weight: 600; min-width: 56px; cursor: pointer; }
.ctl button.on { background: var(--accent); color: white; }
.ctl input[type=range] { flex: 1; min-width: 160px; }
.ritem .del { margin-left: 6px; border: 0; background: transparent; color: var(--muted); font-size: 20px; padding: 0 6px; cursor: pointer; }
.tile h3 .chev { color: var(--muted); font-size: 20px; font-weight: 400; line-height: 1; }
.tile.has-detail { cursor: pointer; }
.tile.has-detail:active { transform: scale(.995); }
body.sheet-open { overflow: hidden; }

/* cars */
.cars { display: flex; flex-direction: column; gap: 10px; }
.carrow { display: flex; gap: 12px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); }
.carrow .row { flex-wrap: wrap; row-gap: 4px; }
.carrow .carname { white-space: nowrap; }
.carrow:last-child { border-bottom: 0; }
.carpic { width: 96px; height: 42px; object-fit: contain; background: transparent; flex: none; }
.carpic.ph { background: var(--chip); border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: 26px; }
.carname { font-weight: 600; font-size: 17px; }
.carsoc { font-size: 24px; font-weight: 700; min-width: 64px; letter-spacing: -0.01em; }
.carrange { color: var(--muted); font-size: 14px; min-width: 64px; text-align: right; }
.carrow .bar { height: 10px; border-radius: 999px; background: var(--line); overflow: hidden; }
.carrow .bar > div { height: 100%; background: var(--ok); border-radius: 999px; }
.carrow .bar.low > div { background: var(--warn); } .carrow .bar.crit > div { background: var(--bad); }
.ctabs { display: flex; gap: 6px; flex-wrap: wrap; margin: 4px 0 14px; }
.ctab { border: 0; border-radius: 999px; padding: 8px 16px; background: var(--chip); color: var(--ink); font-size: 15px; font-weight: 600; cursor: pointer; }
.ctab.on { background: var(--accent); color: white; }
.cmds .action { min-height: 70px; }
.leaflet-container { background: var(--chip); font-family: var(--font); }
.leaflet-tooltip { font-size: 13px; font-weight: 600; }

/* media players */
.players { display: flex; flex-direction: column; gap: 6px; }
.player { display: flex; gap: 12px; align-items: center; padding: 7px 0; border-bottom: 1px solid var(--line); }
.player:last-child { border-bottom: 0; }
.player.off { opacity: .55; }
.player .art { width: 44px; height: 44px; border-radius: 10px; background: var(--chip) center/cover; flex: none; display: flex; align-items: center; justify-content: center; font-size: 20px; }
.player .pname { font-weight: 600; font-size: 16px; }
.player .pwhat { color: var(--muted); font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 260px; }
.pcard { padding: 12px 0; border-bottom: 1px solid var(--line); }
.pcard:last-of-type { border-bottom: 0; }
.pcard.off { opacity: .7; }

/* rearranging */
.tile { touch-action: pan-x pan-y; }
body.arranging .tile { outline: 2px dashed var(--line); outline-offset: -2px; cursor: grab; }
body.arranging .tile.dragging { opacity: .35; outline: 2px dashed var(--accent); }
.tile.ghost { box-shadow: 0 24px 60px rgba(0,0,0,.35); transform: scale(1.03); opacity: .95; }
#arrange-bar { position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%); background: var(--ink); color: var(--card); padding: 10px 12px 10px 18px; border-radius: 999px; display: flex; align-items: center; gap: 14px; font-size: 15px; z-index: 70; box-shadow: var(--shadow); }
#arrange-bar button { border: 0; border-radius: 999px; padding: 8px 16px; background: var(--accent); color: white; font-size: 15px; font-weight: 600; }

/* climate sparkline */
.mini { margin: 10px 0 2px; }
.mini canvas.mini-climate { display: block; width: 100%; height: 64px; }
.mini-key { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 12px; color: var(--muted); margin-top: 4px; }
.mini-key i, .bandkey i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; vertical-align: -1px; margin-right: 5px; }
.bandkey { display: flex; flex-wrap: wrap; gap: 4px 18px; font-size: 13px; color: var(--muted); margin-top: 6px; }
.bandkey b { color: var(--ink); font-weight: 600; }
/* cars: art + mini map */
.cars-wrap { display: flex; gap: 16px; align-items: stretch; flex: 1; min-height: 0; }
.cars-wrap .cars { flex: 1 1 300px; min-width: 0; }
.carpic.art { width: 96px; height: 42px; background: transparent; display: flex; align-items: center; justify-content: center; }
.carpic.art svg { width: 96px; height: auto; max-height: 42px; }
.minimap { position: relative; isolation: isolate; z-index: 0; flex: 0 0 34%; min-width: 150px; max-width: 300px; border-radius: 14px; overflow: hidden; background: var(--chip); cursor: pointer; }
.minimap .mm { position: absolute; inset: 0; }
.minimap .mm-hint { position: absolute; left: 8px; bottom: 6px; z-index: 500; font-size: 11px; font-weight: 600; background: rgba(255,255,255,.85); color: #111; padding: 3px 8px; border-radius: 999px; pointer-events: none; }
.mm-tip { font-size: 11px; font-weight: 600; padding: 1px 5px; }
@container (max-width: 560px) { .cars-wrap { flex-direction: column; } .minimap { flex: 0 0 150px; max-width: none; } }
.leaflet-container .leaflet-tile-pane { filter: saturate(.85); }
html.dark .leaflet-container .leaflet-tile-pane { filter: brightness(.8) contrast(1.05) saturate(.8); }
/* notifications */
.nlist { display: flex; flex-direction: column; }
.nrow { display: flex; gap: 12px; align-items: flex-start; padding: 9px 4px; border-bottom: 1px solid var(--line); font-size: 16px; }
.nrow:last-child { border-bottom: 0; }
.nrow .ni { width: 22px; text-align: center; flex: none; font-size: 15px; color: var(--muted); padding-top: 2px; }
.nrow.unread .nt { font-weight: 700; }
.nrow.unread .ni { color: var(--accent); }
.nrow.warning .ni { color: var(--warn); } .nrow.critical .ni { color: var(--bad); }
.nrow .nb { color: var(--muted); font-size: 14px; margin-top: 2px; }
.nrow .ns { color: var(--muted); font-size: 12px; margin-top: 2px; }
.nrow .na { color: var(--muted); font-size: 12px; white-space: nowrap; padding-top: 3px; }
.nrow .nx { border: 0; background: transparent; color: var(--muted); font-size: 20px; cursor: pointer; padding: 0 4px; }
.toasts { position: fixed; top: max(10px, env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); z-index: 80; display: flex; flex-direction: column; gap: 8px; width: min(520px, 92vw); pointer-events: none; }
.ntoast { pointer-events: auto; display: flex; gap: 12px; align-items: flex-start; background: var(--card); color: var(--ink); border-radius: 16px; padding: 12px 14px; box-shadow: 0 12px 40px rgba(0,0,0,.28); border-left: 5px solid var(--accent); font-size: 16px; animation: toast-in .35s ease; cursor: pointer; }
.ntoast.warning { border-left-color: var(--warn); } .ntoast.critical { border-left-color: var(--bad); }
.ntoast .nt { font-weight: 700; } .ntoast .nb { color: var(--muted); font-size: 14px; margin-top: 2px; }
.ntoast .nx { color: var(--muted); font-size: 20px; line-height: 1; padding: 0 2px; }
.ntoast.out { opacity: 0; transform: translateY(-8px); transition: all .4s; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-14px); } to { opacity: 1; transform: none; } }
.pill-btn { border: 1px solid var(--line); background: var(--chip); color: var(--ink); border-radius: 999px; padding: 6px 12px; font-size: 13px; font-weight: 600; cursor: pointer; margin-left: 6px; }
.pill-btn:active { transform: scale(.97); }
/* settings */
.links { display: flex; flex-wrap: wrap; gap: 10px; }
.lbtn { display: inline-flex; align-items: center; gap: 8px; background: var(--chip); color: var(--ink); border-radius: 14px; padding: 12px 16px; font-size: 16px; font-weight: 600; }
.srow { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 16px; }
.srow > span:first-child { min-width: 120px; color: var(--muted); }
.seg { display: inline-flex; background: var(--chip); border-radius: 12px; padding: 3px; gap: 2px; align-items: center; }
.seg button { border: 0; background: transparent; color: var(--ink); border-radius: 9px; padding: 7px 12px; font-size: 14px; font-weight: 600; cursor: pointer; }
.seg button.on { background: var(--card); box-shadow: var(--shadow); color: var(--accent); }
.sheet h4 .sp { float: right; text-transform: none; letter-spacing: 0; }
.tlist { display: flex; flex-direction: column; }
.trow { display: flex; align-items: center; gap: 10px; padding: 7px 2px; border-bottom: 1px solid var(--line); font-size: 16px; }
.trow.off .tn { opacity: .5; }
.trow .tn { flex: 1; } .trow .tn small { display: block; color: var(--muted); font-size: 12px; }
.trow select { font: inherit; font-size: 14px; border-radius: 8px; border: 1px solid var(--line); background: var(--bg); color: var(--ink); padding: 4px 6px; }
.trow .seg.tsz { padding: 2px; gap: 1px; } .trow .seg.tsz button { padding: 4px 8px; font-size: 12px; min-width: 26px; }
.trow .tog { border: 0; border-radius: 999px; padding: 6px 14px; background: var(--chip); color: var(--ink); font-size: 13px; font-weight: 600; min-width: 64px; cursor: pointer; }
.trow .tog.on { background: color-mix(in srgb, var(--ok) 20%, transparent); color: var(--ok); }
.trow .tdel { border: 0; background: transparent; font-size: 16px; cursor: pointer; }
.addtile input { width: 100%; font: inherit; font-size: 16px; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg); color: var(--ink); }
.sres { max-height: 260px; overflow: auto; margin-top: 6px; }
.sr { display: flex; align-items: center; justify-content: space-between; padding: 8px 6px; border-bottom: 1px solid var(--line); cursor: pointer; font-size: 15px; }
.sr small { display: block; color: var(--muted); font-size: 12px; font-family: var(--mono); }
.sr b { color: var(--accent); font-size: 20px; }
.sub code { font-family: var(--mono); font-size: 12px; background: var(--chip); padding: 1px 5px; border-radius: 5px; }
/* assistant */
.chat { display: flex; flex-direction: column; gap: 10px; min-height: 220px; max-height: 52vh; overflow: auto; padding: 4px 2px; }
.msg { max-width: 88%; padding: 10px 14px; border-radius: 16px; font-size: 17px; line-height: 1.45; }
.msg.user { align-self: flex-end; background: var(--accent); color: white; border-bottom-right-radius: 4px; }
.msg.assistant { align-self: flex-start; background: var(--chip); border-bottom-left-radius: 4px; }
.msg .li { padding-left: 4px; }
.msg .used { color: var(--muted); font-size: 11px; margin-top: 6px; }
.msg .thinking { display: inline-block; animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: .3; } }
.sugg { display: flex; flex-wrap: wrap; gap: 8px; }
.sugg button { border: 1px solid var(--line); background: var(--card); color: var(--ink); border-radius: 999px; padding: 8px 14px; font-size: 15px; cursor: pointer; }
.chatform { display: flex; gap: 8px; margin-top: 12px; }
.chatform input { flex: 1; font: inherit; font-size: 17px; padding: 12px 14px; border-radius: 14px; border: 1px solid var(--line); background: var(--bg); color: var(--ink); }
.chatform button { border: 0; border-radius: 14px; padding: 0 18px; background: var(--accent); color: white; font-size: 16px; font-weight: 700; }

/* cameras */
.cams { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.cam { cursor: pointer; }
.cam .camimg { position: relative; aspect-ratio: 16 / 9; border-radius: 12px; background: var(--chip) center / cover no-repeat; display: flex; align-items: center; justify-content: center; font-size: 30px; overflow: hidden; }
.cam.recent .camimg { outline: 3px solid var(--accent); outline-offset: -3px; }
.cam .live { position: absolute; right: 8px; top: 8px; font-size: 10px; font-weight: 800; letter-spacing: .08em; background: rgba(220,38,38,.9); color: white; padding: 2px 7px; border-radius: 999px; }
.cam .camname { font-weight: 600; font-size: 15px; margin-top: 6px; }
.cam .row { margin-top: 6px; }
.camview { position: relative; background: #000; border-radius: 14px; overflow: hidden; }
.camview video, .camview img { display: block; width: 100%; max-height: 62vh; object-fit: contain; background: #000; }
.camctl { display: flex; gap: 8px; align-items: center; padding: 10px 12px; background: var(--chip); flex-wrap: wrap; }
.camctl button { border: 0; border-radius: 10px; padding: 9px 14px; background: var(--card); color: var(--ink); font-size: 15px; font-weight: 600; cursor: pointer; }
.camctl button#cam-live { background: var(--accent); color: white; }
.camctl button:disabled { opacity: .5; }
.cam .age { position: absolute; left: 8px; bottom: 6px; font-size: 10px; font-weight: 600; background: rgba(0,0,0,.55); color: #fff; padding: 2px 7px; border-radius: 999px; }
.wx-hour .w { color: var(--muted); font-size: 11px; white-space: nowrap; margin-top: 2px; }
.radar { height: 300px; border-radius: 12px; overflow: hidden; background: var(--chip); }
.radar.collapsed { height: auto; background: none; }
.sheet h4 .sp button { border: 0; background: var(--chip); color: var(--ink); border-radius: 8px; height: 26px; cursor: pointer; }

/* rules */
.rulelist { display: flex; flex-direction: column; }
.rulerow { display: flex; gap: 12px; align-items: flex-start; padding: 9px 2px; border-bottom: 1px solid var(--line); }
.rulerow:last-child { border-bottom: 0; }
.rulerow.off { opacity: .55; }
.rulerow .rdot { width: 9px; height: 9px; border-radius: 50%; background: var(--muted); flex: none; margin-top: 7px; }
.rulerow .rdot.on { background: var(--ok); }
.rulerow .rn { font-weight: 600; font-size: 16px; }
.rulerow .rd { color: var(--muted); font-size: 14px; margin-top: 1px; }
.rulerow .rs { color: var(--muted); font-size: 12px; margin-top: 2px; }
.rulerow .rw { color: var(--muted); font-size: 13px; white-space: nowrap; padding-top: 2px; }
.rulelist.big .rn { font-size: 18px; }
.ract { display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
.rtog { width: 42px; height: 25px; border-radius: 999px; border: 0; background: var(--line); position: relative; cursor: pointer; flex: none; margin-top: 3px; transition: background .2s; }
.rtog::after { content: ""; position: absolute; top: 3px; left: 3px; width: 19px; height: 19px; border-radius: 50%; background: #fff; transition: transform .2s; box-shadow: 0 1px 3px rgba(0,0,0,.3); }
.rtog.on { background: var(--ok); } .rtog.on::after { transform: translateX(17px); }
.rform { display: grid; gap: 12px; margin-top: 8px; background: var(--chip); padding: 14px; border-radius: 14px; }
.rform label { display: block; font-size: 13px; color: var(--muted); }
.rform input, .rform select { width: 100%; font: inherit; font-size: 16px; padding: 9px 11px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); color: var(--ink); margin-top: 4px; }
.rform .row input, .rform .row select { margin-top: 0; }
.rform label.rcheck { display: flex; align-items: center; gap: 8px; font-size: 15px; color: var(--ink); }
.rform label.rcheck input { width: auto; }
.dayrow { display: flex; gap: 5px; flex-wrap: wrap; margin-top: 4px; }
.dayrow button { border: 1px solid var(--line); background: var(--bg); color: var(--muted); border-radius: 9px; padding: 7px 11px; font-size: 13px; font-weight: 600; cursor: pointer; }
.dayrow button.on { background: var(--accent); color: #fff; border-color: var(--accent); }

/* the beestat-shaped detail chart */
.rc-range { display: flex; gap: 6px; margin: 2px 0 12px; flex-wrap: wrap; }
.rc-range button { border: 1px solid var(--line); background: var(--bg); color: var(--muted); border-radius: 999px; padding: 7px 15px; font-size: 14px; font-weight: 600; cursor: pointer; }
.rc-range button.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.rc-strips { position: relative; margin-bottom: 6px; }
.rc-strips canvas { display: block; width: 100%; }
.rc-striplabels { display: flex; gap: 14px; font-size: 11px; color: var(--muted); margin-top: 3px; text-transform: uppercase; letter-spacing: .06em; }
.rc-plot { min-height: 120px; }
.rc-legend { display: flex; flex-wrap: wrap; gap: 7px 16px; margin-top: 10px; font-size: 13px; color: var(--muted); }
.rc-key { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.rc-key i { width: 11px; height: 11px; border-radius: 3px; flex: none; }
.rc-sep { flex-basis: 100%; height: 1px; background: var(--line); margin: 4px 0 2px; }
.rc-readout { margin-top: 12px; background: var(--chip); border-radius: 12px; padding: 12px 14px; }
.rc-when { font-size: 13px; color: var(--muted); font-weight: 600; margin-bottom: 6px; }
.rc-values { display: grid; grid-template-columns: repeat(auto-fit, minmax(155px, 1fr)); gap: 2px 18px; }
.rc-row { display: flex; justify-content: space-between; gap: 10px; font-size: 15px; padding: 2px 0; }
.rc-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rc-val { font-variant-numeric: tabular-nums; font-weight: 600; }
.rc-row.rc-state { grid-column: 1 / -1; color: var(--muted); font-size: 13px; border-top: 1px solid var(--line); margin-top: 5px; padding-top: 5px; display: block; }
@media (max-width: 480px) {
  .rc-range button { padding: 6px 12px; font-size: 13px; }
  .rc-values { grid-template-columns: 1fr 1fr; gap: 1px 12px; }
  .rc-row { font-size: 14px; }
  .sheet-body { padding: 6px 14px 20px; }
  .sheet-card { border-radius: 18px; }
  .sheet { padding: 8px; }
}

/* the thermostat's target control must not break apart on a phone */
.climate { flex-wrap: wrap; }
.climate .ctl { flex-wrap: nowrap; }
@media (max-width: 480px) {
  .climate { gap: 12px; }
  .climate .ctl { margin-left: auto; }
  .climate .ctl button { min-width: 48px; padding: 10px 14px; }
  .sheet h4 { margin: 14px 0 6px; }
  .ctl button { padding: 10px 14px; font-size: 16px; }
}

/* the car sheet, rebuilt */
.carhero { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; margin-bottom: 4px; }
.carart-wrap { flex: 0 0 270px; max-width: 46%; display: flex; align-items: center; }
.carart-wrap img, .carart-wrap svg { width: 100%; height: auto; border-radius: 10px; }
.carart-wrap img { filter: drop-shadow(0 5px 6px rgba(0,0,0,.22)); }
.carart-wrap.chargerart { font-size: 54px; justify-content: center; flex: 0 0 120px; }
.carnow { flex: 1 1 210px; min-width: 180px; }
.carbig { font-size: clamp(34px, 6vw, 46px); font-weight: 700; letter-spacing: -0.02em; line-height: 1; }
.carnow .bar { height: 12px; border-radius: 999px; background: var(--line); overflow: hidden; margin: 10px 0 6px; }
.carnow .bar > div { height: 100%; background: var(--ok); border-radius: 999px; transition: width .6s; }
.carnow .bar.low > div { background: var(--warn); } .carnow .bar.crit > div { background: var(--bad); }
.cstats { display: grid; grid-template-columns: repeat(auto-fit, minmax(118px, 1fr)); gap: 12px 16px; margin: 16px 0 4px; }
.cstats.small { grid-template-columns: repeat(auto-fit, minmax(104px, 1fr)); }
.cstat .cv { font-size: 21px; font-weight: 700; letter-spacing: -0.01em; }
.cstats.small .cstat .cv { font-size: 18px; }
.cstat .cv small { font-size: 13px; font-weight: 500; color: var(--muted); margin-left: 2px; }
.cstat .cl { font-size: 12.5px; color: var(--muted); margin-top: 1px; }
.ctabs.sub-tabs { margin: 4px 0 10px; }
.ctabs.sub-tabs .gtab { border: 1px solid var(--line); border-radius: 999px; padding: 7px 14px; background: var(--bg); color: var(--muted); font-size: 14px; font-weight: 600; cursor: pointer; }
.ctabs.sub-tabs .gtab.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.cmdgroup.hidden { display: none; }
.carnote { margin-top: 10px; font-size: 14px; color: var(--muted); background: var(--chip); padding: 10px 12px; border-radius: 10px; }
.carmap { height: 420px; border-radius: 12px; overflow: hidden; }
@media (max-width: 560px) {
  .carart-wrap { flex: 1 1 100%; max-width: 100%; }
  .carnow { flex: 1 1 100%; }
  .cstats { grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); gap: 10px 12px; }
  .cstat .cv { font-size: 18px; }
  .carmap { height: 300px; }
  .cmds .action { min-height: 62px; font-size: 13px; }
  .actions { grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 8px; }
}

/* naming devices that arrived with a serial number for a name */
.namelist { display: flex; flex-direction: column; gap: 10px; margin: 8px 0 16px; }
.namerow { background: var(--chip); border-radius: 12px; padding: 12px 14px; }
.namerow.todo { box-shadow: inset 3px 0 0 var(--accent); }
.namerow input { background: var(--bg); border: 1px solid var(--line); border-radius: 8px;
                 padding: 7px 10px; color: inherit; font: inherit; min-width: 0; }
.namerow .nmsg { font-size: 12px; opacity: .65; }

/* Detail-sheet tables. Wide ones scroll inside their own box; on a phone the header row is dropped and
   each record stacks as a card, with every cell labelled by the column it came from. */
.dtw { overflow-x: auto; -webkit-overflow-scrolling: touch; }
@media (max-width: 560px) {
  .dtw { overflow-x: visible; }
  .dt, .dt thead, .dt tbody, .dt tr, .dt td { display: block; width: auto; }
  .dt thead { display: none; }
  .dt tr { background: var(--chip); border-radius: 10px; padding: 9px 12px; margin: 0 0 8px; }
  .dt td { display: flex; gap: 12px; align-items: baseline; justify-content: space-between;
           border: 0; padding: 2px 0; text-align: right; }
  .dt td::before { content: attr(data-l); color: var(--muted); font-size: 12px; flex: none; text-align: left; }
  .dt td:first-child { font-weight: 600; font-size: 15px; text-align: left; margin-bottom: 3px;
                       justify-content: flex-start; gap: 8px; }
  .dt td:first-child::before { display: none; }
  .dt td:empty { display: none; }
}

/* Weather: the next 24 hours as a swipeable strip rather than a six-column table */
.wxstrip { display: flex; gap: 2px; overflow-x: auto; -webkit-overflow-scrolling: touch;
           padding-bottom: 6px; margin-top: 4px; }
.wxh { flex: 0 0 58px; text-align: center; padding: 8px 2px; border-radius: 10px; }
.wxh:nth-child(even) { background: var(--chip); }
.wxh .t { font-size: 11px; color: var(--muted); white-space: nowrap; }
.wxh .e { font-size: 20px; line-height: 1.4; }
.wxh .d { font-size: 17px; font-weight: 600; font-variant-numeric: tabular-nums; }
.wxh .p { font-size: 11px; color: var(--muted); min-height: 14px; }
.wxh .p.wet { color: var(--accent); font-weight: 600; }
.wxh .w { font-size: 11px; color: var(--muted); white-space: nowrap; }

/* teaching a remote */
.rm-msg { margin: 10px 0 4px; min-height: 20px; font-size: 15px; }
.rm-msg.live { color: var(--accent); font-weight: 600; }
.rm-msg.ok { color: #16a34a; font-weight: 600; }
.rm-msg.bad { color: #dc2626; }
.rbtns { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.rcmd { display: inline-flex; align-items: center; gap: 2px; }
.rforget { border: 0; background: transparent; color: var(--muted); cursor: pointer; font-size: 13px; padding: 4px; }
.rforget:hover { color: #dc2626; }
#rm-dev, #rm-cmd { background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; color: inherit; font: inherit; }

/* phones: the header keeps the clock and the tools (the door pill matters most away from home); the house
   name and the weather glance step aside, since the tab says whose house and the weather tile is right below */
@media (max-width: 560px) {
  .fam-header { padding: 2px 2px 12px; gap: 10px; align-items: flex-start; }
  .fam-header > div:first-child { min-width: 0; }
  .fam-title, .fam-wx { display: none; }
  .fam-clock { font-size: 40px; white-space: nowrap; }
  .fam-date { font-size: 14px; margin-top: 4px; }
  .fam-tools { grid-template-columns: repeat(3, 36px); gap: 5px; }
  .fam-tools .tool { width: 36px; height: 36px; font-size: 16px; }
  .fam-tools .tool.door { height: 30px; font-size: 12px; padding: 0 10px 0 8px; }
}

/* who answered in the chat: one chip per reply */
.tier { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 700; letter-spacing: .02em; margin-right: 4px; vertical-align: middle; }
.tier.t-logic { background: color-mix(in srgb, var(--ok) 18%, transparent); color: var(--ok); }
.tier.t-local { background: color-mix(in srgb, var(--accent) 18%, transparent); color: var(--accent); }
.tier.t-cloud { background: color-mix(in srgb, var(--warn) 20%, transparent); color: var(--warn); }
.tier.t-big { background: color-mix(in srgb, #a855f7 20%, transparent); color: #a855f7; }
.tier.t-none { background: color-mix(in srgb, var(--muted) 18%, transparent); color: var(--muted); }

/* the car sheet: overheat guard and programs */
.care { display: flex; flex-direction: column; gap: 10px; background: var(--chip); border-radius: 14px; padding: 12px 14px; }
.carerow { display: flex; align-items: center; gap: 12px; font-size: 15px; line-height: 1.35; }
.carerow .seg { margin-left: auto; }
.pnum { width: 58px; font: inherit; font-size: 15px; padding: 4px 6px; border-radius: 8px; border: 1px solid var(--line); background: var(--bg); color: var(--ink); }
.progs { display: flex; flex-direction: column; gap: 10px; }
.prog { background: var(--chip); border-radius: 14px; padding: 10px 12px; }
.prog.off { opacity: .6; }
.prog .pf { font: inherit; font-size: 15px; padding: 5px 7px; border-radius: 8px; border: 1px solid var(--line); background: var(--bg); color: var(--ink); }
.prog .pl { display: inline-flex; align-items: center; gap: 5px; font-size: 13px; color: var(--muted); }
.prog .pdel { border: 0; background: transparent; font-size: 16px; cursor: pointer; }
.prog .pdays { margin-top: 8px; }
.prog .pdesc { margin-top: 6px; }

/* the guard's colour: blue while cooling, green while venting, yellow while armed and waiting, plain when off */
.care.watching { background: color-mix(in srgb, var(--warn) 16%, var(--chip)); box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--warn) 55%, transparent); }
.care.venting { background: color-mix(in srgb, var(--ok) 18%, var(--chip)); box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--ok) 60%, transparent); }
.care.cooling { background: color-mix(in srgb, var(--accent) 20%, var(--chip)); box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--accent) 60%, transparent); }
.cbadge.watching { background: color-mix(in srgb, var(--warn) 22%, transparent); color: var(--warn); }
.cbadge.venting { background: color-mix(in srgb, var(--ok) 22%, transparent); color: var(--ok); }
.cbadge.cooling { background: color-mix(in srgb, var(--accent) 22%, transparent); color: var(--accent); }
.cmds .action.on { background: color-mix(in srgb, var(--accent) 26%, transparent); box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--accent) 60%, transparent); }
.cmds .action .st { font-size: 11px; font-weight: 500; opacity: .75; }

/* the car link switch, schedule cards and the schedule editor */
.carlink { display: flex; gap: 12px; align-items: center; background: color-mix(in srgb, var(--ok) 12%, var(--chip)); border-radius: 14px; padding: 12px 14px; margin: 4px 0 14px; }
.carlink.silent { background: color-mix(in srgb, var(--muted) 18%, var(--chip)); }
.carlink .sub { margin-top: 2px; font-size: 13px; }
.scheds { display: flex; flex-direction: column; gap: 10px; }
.sched { display: flex; align-items: center; gap: 14px; background: var(--chip); border-radius: 16px; padding: 12px 14px; cursor: pointer; transition: transform .08s; }
.sched:active { transform: scale(.99); }
.sched.off .stime, .sched.off .sbody { opacity: .5; }
.sched .stime { font-size: 24px; font-weight: 700; letter-spacing: -0.02em; min-width: 92px; font-variant-numeric: tabular-nums; }
.sched .sbody { flex: 1; min-width: 0; }
.sched .sname { font-weight: 600; font-size: 16px; }
.sched .ssum { color: var(--muted); font-size: 13px; margin-top: 1px; }
.sched .sdays { display: inline-flex; gap: 4px; margin-top: 6px; }
.sched .sdays i { font-style: normal; width: 22px; height: 22px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; background: var(--line); color: var(--muted); }
.sched .sdays i.on { background: color-mix(in srgb, var(--accent) 24%, transparent); color: var(--accent); }
.sched .sdate { display: inline-block; margin-top: 6px; font-size: 12px; font-weight: 600; color: var(--accent); }
.sform { display: flex; flex-direction: column; gap: 16px; }
.sfield > span:first-child { display: block; font-size: 13px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; margin-bottom: 8px; }
.sfield input[type=text], .sfield input:not([type]), .sfield input[type=time], .sfield input[type=date], .sfield select { font: inherit; font-size: 17px; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg); color: var(--ink); }
.sfield input:not([type]) { width: 100%; }
.srowc { display: flex; align-items: center; gap: 10px; margin-top: 8px; }
.seg.wide { display: flex; width: 100%; } .seg.wide button { flex: 1; padding: 10px 12px; font-size: 15px; }
.dayrow.big { margin-top: 10px; gap: 8px; } .dayrow.big button { width: 42px; height: 42px; border-radius: 50%; padding: 0; font-size: 14px; }
.seatgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 10px; }
.seatbtn { border: 1.5px solid var(--line); background: var(--chip); color: var(--ink); border-radius: 14px; padding: 8px 6px 10px; display: flex; flex-direction: column; align-items: center; gap: 4px; cursor: pointer; }
.seatbtn small { font-size: 11px; font-weight: 700; color: var(--muted); align-self: flex-start; margin-left: 4px; }
.seatbtn .si { font-size: 24px; line-height: 1; }
.seatbtn .bars { display: flex; gap: 3px; align-items: flex-end; height: 14px; }
.seatbtn .bars i { width: 7px; background: var(--line); border-radius: 2px; }
.seatbtn .bars i:nth-child(1) { height: 6px; } .seatbtn .bars i:nth-child(2) { height: 10px; } .seatbtn .bars i:nth-child(3) { height: 14px; }
.seatbtn .bars.two i { height: 10px; }
.seatbtn .bars i.on { background: var(--warn); }
.seatbtn.on { border-color: var(--warn); background: color-mix(in srgb, var(--warn) 16%, var(--chip)); }
.pill-btn.primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.badge.warn { background: color-mix(in srgb, var(--warn) 20%, transparent); color: var(--warn); }

/* the chat with Jeffrey: glass bubbles on the glass sheet, one clean column, a pill to type in */
.chat { gap: 12px; padding: 6px 2px 10px; scroll-behavior: smooth; }
.msg { max-width: 84%; padding: 11px 15px; border-radius: 18px; font-size: 17px; line-height: 1.42; letter-spacing: -0.005em; box-shadow: 0 1px 2px rgba(0,0,0,.05); }
.msg.user { background: linear-gradient(160deg, color-mix(in srgb, var(--accent) 92%, #fff), var(--accent)); color: #fff; border-bottom-right-radius: 6px; box-shadow: 0 4px 14px color-mix(in srgb, var(--accent) 30%, transparent); }
.msg.assistant { background: color-mix(in srgb, var(--card) 72%, transparent); border: 1px solid color-mix(in srgb, var(--ink) 8%, transparent); border-bottom-left-radius: 6px; -webkit-backdrop-filter: blur(16px) saturate(1.5); backdrop-filter: blur(16px) saturate(1.5); }
body.photo.frost .msg.assistant { background: rgba(255,255,255,.42); border-color: rgba(255,255,255,.55); box-shadow: 0 2px 10px rgba(0,0,0,.06), inset 0 1px 0 rgba(255,255,255,.7); }
html.dark body.photo.frost .msg.assistant { background: rgba(30,38,52,.5); border-color: rgba(255,255,255,.12); box-shadow: 0 2px 10px rgba(0,0,0,.25), inset 0 1px 0 rgba(255,255,255,.12); }
.msg .used { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; margin-top: 8px; padding-top: 7px; border-top: 1px solid color-mix(in srgb, var(--ink) 8%, transparent); font-size: 11.5px; }
.msg .used a { color: var(--accent); text-decoration: none; font-weight: 600; }
.msg .thinking { display: inline-block; width: 42px; letter-spacing: 4px; font-weight: 700; color: var(--muted); animation: pulse 1s infinite; }
.sugg { gap: 8px; margin-top: 4px; }
.sugg button { border: 1px solid color-mix(in srgb, var(--ink) 10%, transparent); background: color-mix(in srgb, var(--card) 60%, transparent); border-radius: 999px; padding: 8px 14px; font-size: 14px; font-weight: 500; -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); }
.sugg button:active { transform: scale(.97); }
.chatform { gap: 8px; margin-top: 14px; align-items: center; background: color-mix(in srgb, var(--card) 70%, transparent); border: 1px solid color-mix(in srgb, var(--ink) 10%, transparent); border-radius: 999px; padding: 5px 5px 5px 6px; -webkit-backdrop-filter: blur(16px) saturate(1.5); backdrop-filter: blur(16px) saturate(1.5); box-shadow: 0 6px 20px rgba(0,0,0,.08), inset 0 1px 0 rgba(255,255,255,.5); }
body.photo.frost .chatform { background: rgba(255,255,255,.45); border-color: rgba(255,255,255,.6); }
html.dark body.photo.frost .chatform { background: rgba(30,38,52,.55); border-color: rgba(255,255,255,.14); box-shadow: 0 6px 20px rgba(0,0,0,.3), inset 0 1px 0 rgba(255,255,255,.1); }
.chatform input { border: 0; background: transparent; padding: 10px 12px; font-size: 17px; }
.chatform input:focus { outline: none; }
.chatform button { width: 44px; height: 44px; padding: 0; border-radius: 50%; font-size: 0; position: relative; flex: none; box-shadow: 0 3px 10px color-mix(in srgb, var(--accent) 35%, transparent); }
.chatform button::after { content: "↑"; font-size: 22px; font-weight: 800; line-height: 44px; }
.chatform button:active { transform: scale(.94); }

/* tiles reformat to their own width: a one-column tile stacks, a three-column tile spreads out */
@container (max-width: 330px) {
  .actions { grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 8px; }
  .action { min-height: 66px; padding: 10px 6px; font-size: 13px; } .action .i { font-size: 22px; }
  .tile .big { font-size: 34px; }
  .wx-days { gap: 3px; }
  .shcmds { gap: 6px; } .shc { padding: 12px 6px; font-size: 15px; }
  .person { min-width: 0; }
}
@container (min-width: 640px) {
  .actions { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
  .lightlist { display: grid; grid-template-columns: 1fr 1fr; }
  .tile .big { font-size: 60px; }
}
@container (min-width: 960px) {
  .actions { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
}

/* motion clips in the camera sheet */
/* motion clips: media cards, the picture (with the detector's boxes) on top, the story underneath. The heading's
   buttons float right and on a phone hang below the heading; anything that follows must clear them or it is
   squeezed into the space beside them */
.cliplist, .clipcfg, #cam-clips, #cam-cfg, #cam-log { clear: both; }
.cliplist { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 12px; align-items: start; }
.clip { display: flex; flex-direction: column; background: var(--chip); border-radius: 16px; overflow: hidden; cursor: pointer; }
.clip.imp { box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--warn) 55%, transparent); }
.clip .cposter { position: relative; width: 100%; aspect-ratio: 16 / 9; background: #000; display: flex; align-items: center; justify-content: center; font-size: 28px; }
.clip .cposter img { width: 100%; height: 100%; object-fit: cover; display: block; }
.clip .cposter .cdur { position: absolute; right: 8px; bottom: 8px; font-size: 11px; font-weight: 600; letter-spacing: .02em; color: #fff; background: rgba(0,0,0,.55); padding: 2px 7px; border-radius: 999px; backdrop-filter: blur(6px); }
.clip .cbody { display: flex; flex-direction: column; gap: 6px; padding: 10px 12px 12px; min-width: 0; }
.clip .ctime { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.clip .cwhen { font-size: 13px; font-weight: 600; color: var(--muted); margin-right: auto; }
.clip .cwhat { font-size: 15px; line-height: 1.35; }
.clip .cwhat.was { color: var(--muted); }
.clip .csaid { font-size: 14px; line-height: 1.35; padding: 6px 10px; border-left: 3px solid var(--ok); background: color-mix(in srgb, var(--ok) 8%, transparent); border-radius: 0 10px 10px 0; }
.clip .csaid .lbl { display: block; font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--ok); margin-bottom: 2px; }
/* the detector's boxes: SVG in the frame's pixel space stretched over the picture, strokes in screen pixels */
svg.bx { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; }
svg.bx rect.b { fill: none; stroke-width: 2.5px; vector-effect: non-scaling-stroke; }
svg.bx text { font: 700 34px -apple-system, system-ui, sans-serif; paint-order: stroke; stroke: rgba(0,0,0,.75); stroke-width: 6px; fill: #fff; display: none; }
svg.bx rect.bx-person { stroke: #ffc400; } svg.bx rect.bx-vehicle { stroke: #48a0ff; } svg.bx rect.bx-animal { stroke: #56e080; }
svg.bx rect.weak { stroke-dasharray: 8 6; opacity: .75; }
svg.bx rect.doubt, svg.bx rect.wrong { stroke-dasharray: 3 7; opacity: .5; }
svg.bx text.wrong, svg.bx text.doubt { opacity: .6; }
.bframe.big svg.bx text, .bx-labels svg.bx text { display: block; }
.seen { display: flex; gap: 5px; flex-wrap: wrap; margin-top: 2px; }
.seen span { font-size: 12px; padding: 2px 9px; border-radius: 999px; background: var(--line); color: var(--muted); border-left: 3px solid transparent; }
.seen .s-person { border-color: #ffc400; } .seen .s-vehicle { border-color: #48a0ff; } .seen .s-animal { border-color: #56e080; }
.bstrip { display: flex; gap: 8px; overflow-x: auto; margin-top: 8px; padding-bottom: 4px; flex-wrap: wrap; }
.bframe { flex: none; width: 236px; margin: 0; cursor: pointer; }
.bframe .bimg { position: relative; border-radius: 10px; overflow: hidden; background: #000; }
.bframe img { display: block; width: 100%; }
.bframe figcaption { font-size: 12px; color: var(--muted); margin-top: 3px; line-height: 1.3; }
.bframe.big { width: 100%; }
.fixrow { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-top: 8px; }
.fixrow .fix.on { background: var(--accent); color: #fff; border-color: var(--accent); }
@media (max-width: 560px) { .bframe { width: calc(50% - 4px); } .cliplist { grid-template-columns: 1fr; gap: 10px; } }
.clip .cposter .play { position: absolute; left: 50%; top: 50%; width: 44px; height: 44px; margin: -22px 0 0 -22px; display: flex; align-items: center; justify-content: center; color: #fff; font-style: normal; font-size: 18px; padding-left: 3px; border-radius: 50%; background: rgba(0,0,0,.45); backdrop-filter: blur(6px); border: 1px solid rgba(255,255,255,.35); }
.clipplayer { grid-column: 1 / -1; }
.clipplayer video { width: 100%; max-height: 420px; border-radius: 14px; background: #000; }
.clipcfg { margin-bottom: 12px; }
.clipcfg .carerow > span:first-child { min-width: 128px; color: var(--muted); font-size: 14px; }
.clipcfg .seg.careseg { margin-left: auto; flex-wrap: wrap; }
.clipcfg .dayrow { margin-left: auto; }
.catbtn.on { background: var(--accent); color: #fff; border-color: var(--accent); }
/* the clip settings on a phone: label above its control, controls in a row that wraps */
@media (max-width: 560px) {
  .clipcfg .carerow { flex-direction: column; align-items: stretch; gap: 6px; }
  .clipcfg .carerow > span:first-child { min-width: 0; }
  .clipcfg .seg.careseg, .clipcfg .dayrow { margin-left: 0; display: flex; flex-wrap: wrap; }
  .clipcfg .seg.careseg button { padding: 7px 10px; font-size: 13px; white-space: nowrap; }
  .clipcfg label.carerow { flex-direction: row; align-items: center; }
  .clipcfg .carerow .sub { margin-top: 2px; }
}

/* a picture the assistant drew for the chat */
.msg .pic { display: block; margin: 8px 0 4px; border-radius: 12px; overflow: hidden; background: #fff; box-shadow: 0 2px 10px rgba(0,0,0,.12); }
.msg .pic img { display: block; width: 100%; height: auto; }

/* the road camera tile and sheet */
.road { display: flex; flex-direction: column; gap: 6px; }
.road .roadimg { position: relative; aspect-ratio: 16 / 9; border-radius: 12px; background: #000 center / cover no-repeat; overflow: hidden; }
.road .roadstate { position: absolute; left: 10px; top: 10px; display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 15px; color: #fff; background: rgba(0,0,0,.55); padding: 4px 10px 4px 8px; border-radius: 999px; backdrop-filter: blur(6px); }
.road.off .roadstate { position: static; color: var(--muted); background: var(--chip); }
.road .rdot { width: 10px; height: 10px; border-radius: 50%; background: #9ca3af; flex: none; }
.road.clear .rdot { background: #22c55e; box-shadow: 0 0 10px #22c55e; }
.road.coming .rdot { background: #ef4444; box-shadow: 0 0 10px #ef4444; animation: roadpulse 1s infinite; }
.road.passing .rdot { background: #f59e0b; }
.road.paused .rdot { background: #6b7280; }
@keyframes roadpulse { 50% { opacity: .35; } }
.road .roadmeta { font-size: 14px; }
.roadlive { border-radius: 14px; overflow: hidden; background: #000; margin-bottom: 12px; }
.roadlive img { display: block; width: 100%; height: auto; }

/* road traffic: cars by hour of day */
.tchart { display: flex; align-items: flex-end; gap: 3px; height: 120px; padding: 6px 0 16px; border-bottom: 1px solid var(--line); position: relative; }
.tbar { flex: 1; display: flex; flex-direction: column-reverse; align-items: stretch; height: 100%; position: relative; }
.tbar span { display: block; width: 100%; border-radius: 2px 2px 0 0; min-height: 0; }
.tbar i { position: absolute; bottom: -16px; left: 0; right: 0; text-align: center; font-size: 10px; color: var(--muted); font-style: normal; }
.tlegend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--muted); margin-top: 8px; align-items: center; }
.tlegend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; vertical-align: -1px; }
.tlabel { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 14px 0 2px; }
.tbar b { position: absolute; top: -14px; left: 0; right: 0; text-align: center; font-size: 10px; color: var(--muted); font-weight: 600; }
.tchart.tdays { height: 130px; padding-top: 18px; }

/* speakers: the remote panel */
.spkpanel { display: flex; flex-direction: column; gap: 8px; }
.spkhead { font-size: 14px; color: var(--muted); }
.spkhead .rdot { width: 9px; height: 9px; border-radius: 50%; background: var(--line); display: inline-block; margin-right: 6px; }
.spkhead .rdot.on { background: var(--good, #22c55e); }
.spkrow { display: flex; flex-wrap: wrap; gap: 6px; }
.spk { flex: 1 1 auto; min-width: 64px; min-height: 44px; border: 0; border-radius: 12px; background: var(--chip); color: var(--ink); font-size: 15px; font-weight: 600; cursor: pointer; padding: 8px 10px; transition: transform .08s, background .2s; }
.spk.force { background: color-mix(in srgb, var(--accent) 24%, transparent); color: var(--accent); }
.spk.off { background: color-mix(in srgb, var(--bad) 14%, transparent); }
.spk.small { flex: 0 0 auto; min-height: 34px; padding: 4px 10px; font-size: 14px; }
.spk:active { transform: scale(.96); }
.spk.busy { opacity: .5; pointer-events: none; }
.spk.done { outline: 2px solid var(--good, #22c55e); }
.spk.fail { outline: 2px solid var(--bad); }
#spk-sheet .li { align-items: center; gap: 8px; }
#spk-sheet .li code { font-size: 13px; }
#spk-sheet h4 .sp { float: none; font-weight: 400; margin-left: 8px; }

/* media: drawn device icons and the Apple TV remote */
.player .art.drawn, .pcard .art.drawn { background: transparent; }
.pcard .art { width: 72px; height: 72px; border-radius: 14px; background: var(--chip) center/cover; flex: none; display: flex; align-items: center; justify-content: center; }
.pcard.rc { padding: 4px 0 14px; border-bottom: 1px solid var(--line); margin-bottom: 10px; }
.pcard.rc:last-of-type { border-bottom: 0; }
.rcprog { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); margin-top: 6px; font-variant-numeric: tabular-nums; }
.rcprog .bar { flex: 1; height: 4px; border-radius: 2px; background: var(--line); overflow: hidden; }
.rcprog .bar i { display: block; height: 100%; background: var(--accent); }
.rcpad { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; max-width: 420px; }
.rcrow { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
.rcrow.top { grid-template-columns: 1.1fr 1fr 1fr; }
.rcrow.vol { grid-template-columns: 1fr 1fr 1fr; align-items: center; }
.rcb { border: 0; border-radius: 14px; background: var(--chip); color: var(--ink); padding: 14px 8px; font-size: 17px; font-weight: 600; cursor: pointer; min-height: 54px; transition: transform .08s, background .2s; }
.rcb:active { transform: scale(.96); }
.rcb.power { background: color-mix(in srgb, var(--bad) 14%, transparent); }
.rcb.play { background: color-mix(in srgb, var(--accent) 24%, transparent); color: var(--accent); font-size: 22px; }
.rcb.done { outline: 2px solid var(--good, #22c55e); }
.rcb.fail { outline: 2px solid var(--bad); }
.rcdpad { display: grid; grid-template-columns: 1fr 1fr 1fr; grid-template-rows: 64px 64px 64px; gap: 6px; background: var(--chip); border-radius: 22px; padding: 8px; }
.rcdpad .rcb { background: transparent; border-radius: 16px; font-size: 20px; min-height: 0; padding: 0; }
.rcdpad .rcb.dir:hover { background: color-mix(in srgb, var(--ink) 8%, transparent); }
.rcdpad .rcb.sel { background: var(--card); box-shadow: 0 1px 4px #0003; border-radius: 50%; width: 60px; height: 60px; margin: auto; font-size: 15px; letter-spacing: .04em; }
.rcapps { margin-top: 12px; }
.appgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); gap: 8px; margin-top: 6px; }
.appgrid.hidden { display: none; }
.appchip { border: 0; background: transparent; padding: 0; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 4px; color: var(--ink); }
.appchip .ai { width: 58px; height: 58px; border-radius: 14px; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 20px; letter-spacing: -.02em; box-shadow: 0 1px 3px #0004; transition: transform .08s; }
.appchip:active .ai { transform: scale(.94); }
.appchip.on .ai { outline: 3px solid var(--accent); outline-offset: 2px; }
.appchip .an { font-size: 11.5px; color: var(--muted); max-width: 76px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.appchip.busy { opacity: .5; }
.appchip .ai { position: relative; overflow: hidden; }
.appchip .ai img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; border-radius: 14px; }
