/* La Régie — La Malle's "premium minimal with a playful spark", at the mixing desk.
   Near-monochrome surfaces, hairlines, one tangerine accent (same tokens as La Salle and La Cave). */

@font-face {
  font-family: "Geist";
  src: url("/static/geist.woff2") format("woff2");
  font-weight: 300 800;
  font-style: normal;
  font-display: swap;
  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;
}

/* ---- tokens -------------------------------------------------------------------- */
:root {
  --bg: #fafaf9;
  --surface: #ffffff;
  --surface-2: #f4f4f3;
  --surface-3: #ececea;
  --line: rgb(24 24 27 / .08);
  --line-2: rgb(24 24 27 / .14);
  --text: #18181b;
  --text-2: #52525b;
  --text-3: #6b6b72;
  --ink: #18181b;
  --ink-text: #fafaf9;
  --ink-text-2: #a1a1aa;
  --accent: #ff6a2b;
  --accent-strong: #f0561a;
  --accent-ink: #1c0a02;
  --accent-text: #c2410c;
  --accent-soft: rgb(255 106 43 / .10);
  --accent-softer: rgb(255 106 43 / .05);
  --hover: rgb(24 24 27 / .035);
  --danger: #b42318;
  --danger-soft: #fef1ef;
  --warn: #b45309;
  --warn-soft: rgb(245 158 11 / .12);
  --ok: #15803d;
  --ok-soft: rgb(22 163 74 / .10);
  --glow: rgb(255 106 43 / .10);
  --glow-edge: rgb(255 106 43 / .45);
  --shadow-sm: 0 1px 2px rgb(24 24 27 / .05);
  --shadow: 0 1px 2px rgb(24 24 27 / .04), 0 6px 20px -6px rgb(24 24 27 / .08);
  --shadow-lg: 0 2px 4px rgb(24 24 27 / .06), 0 24px 48px -12px rgb(24 24 27 / .22);
  --dots: rgb(24 24 27 / .09);
  --thumb: #ffffff;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #09090b; --surface: #111113; --surface-2: #19191c; --surface-3: #232327;
    --line: rgb(255 255 255 / .07); --line-2: rgb(255 255 255 / .13);
    --text: #ededef; --text-2: #a8a8b0; --text-3: #8c8c95;
    --ink: #f4f4f5; --ink-text: #111113; --ink-text-2: #5c5c66;
    --accent: #ff7a3d; --accent-strong: #ff8a52; --accent-ink: #1c0a02; --accent-text: #ff9a66;
    --accent-soft: rgb(255 122 61 / .14); --accent-softer: rgb(255 122 61 / .06);
    --hover: rgb(255 255 255 / .035);
    --danger: #ff8a80; --danger-soft: rgb(255 90 80 / .12);
    --warn: #fbbf24; --warn-soft: rgb(251 191 36 / .12);
    --ok: #4ade80; --ok-soft: rgb(74 222 128 / .12);
    --glow: rgb(255 122 61 / .10); --glow-edge: rgb(255 122 61 / .55);
    --shadow-sm: 0 1px 2px rgb(0 0 0 / .4);
    --shadow: 0 1px 2px rgb(0 0 0 / .4), 0 8px 24px -8px rgb(0 0 0 / .6);
    --shadow-lg: 0 2px 4px rgb(0 0 0 / .4), 0 24px 56px -12px rgb(0 0 0 / .8);
    --dots: rgb(255 255 255 / .07); --thumb: #2a2a2f;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #09090b; --surface: #111113; --surface-2: #19191c; --surface-3: #232327;
  --line: rgb(255 255 255 / .07); --line-2: rgb(255 255 255 / .13);
  --text: #ededef; --text-2: #a8a8b0; --text-3: #8c8c95;
  --ink: #f4f4f5; --ink-text: #111113; --ink-text-2: #5c5c66;
  --accent: #ff7a3d; --accent-strong: #ff8a52; --accent-ink: #1c0a02; --accent-text: #ff9a66;
  --accent-soft: rgb(255 122 61 / .14); --accent-softer: rgb(255 122 61 / .06);
  --hover: rgb(255 255 255 / .035);
  --danger: #ff8a80; --danger-soft: rgb(255 90 80 / .12);
  --warn: #fbbf24; --warn-soft: rgb(251 191 36 / .12);
  --ok: #4ade80; --ok-soft: rgb(74 222 128 / .12);
  --glow: rgb(255 122 61 / .10); --glow-edge: rgb(255 122 61 / .55);
  --shadow-sm: 0 1px 2px rgb(0 0 0 / .4);
  --shadow: 0 1px 2px rgb(0 0 0 / .4), 0 8px 24px -8px rgb(0 0 0 / .6);
  --shadow-lg: 0 2px 4px rgb(0 0 0 / .4), 0 24px 56px -12px rgb(0 0 0 / .8);
  --dots: rgb(255 255 255 / .07); --thumb: #2a2a2f;
  color-scheme: dark;
}

/* ---- base ---------------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scrollbar-gutter: stable; }
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font: 400 15px/1.5 "Geist", ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
  font-feature-settings: "ss01";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-tap-highlight-color: transparent;
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3, p, dl, dd { margin: 0; }
::selection { background: var(--accent-soft); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 8px; }
.muted { color: var(--text-3); }
.small { font-size: 13px; }
.link { font-size: 13.5px; font-weight: 550; color: var(--accent-text); cursor: pointer; }
.link:hover { text-decoration: underline; text-underline-offset: 3px; }
.ico { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.stack { display: grid; gap: 4px; min-width: 0; }
[hidden] { display: none !important; }

/* ---- buttons ------------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 16px;
  border: 1px solid transparent; border-radius: 10px;
  font-size: 14px; font-weight: 550; letter-spacing: -.005em; white-space: nowrap;
  transition: transform .15s ease, background-color .15s ease, box-shadow .15s ease, opacity .15s ease;
}
.btn:active { transform: scale(.98); }
.btn[disabled] { opacity: .45; pointer-events: none; }
.btn .ico { width: 18px; height: 18px; }
.btn-primary { background: var(--ink); color: var(--ink-text); box-shadow: var(--shadow-sm), inset 0 1px 0 rgb(255 255 255 / .12); }
.btn-primary:hover { box-shadow: var(--shadow), inset 0 1px 0 rgb(255 255 255 / .12); }
.btn-accent { background: var(--accent); color: var(--accent-ink); box-shadow: 0 1px 2px rgb(0 0 0 / .1), 0 6px 18px -6px var(--glow-edge), inset 0 1px 0 rgb(255 255 255 / .25); }
.btn-accent:hover { background: var(--accent-strong); }
.btn-ghost { border-color: var(--line-2); background: var(--surface); color: var(--text); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-danger { border-color: color-mix(in srgb, var(--danger) 35%, transparent); background: var(--surface); color: var(--danger); }
.btn-danger:hover { background: var(--danger-soft); }
.btn-block { width: 100%; height: 44px; }
.btn-lg { height: 48px; padding: 0 20px; font-size: 15px; border-radius: 12px; }
.btn-sm { height: 32px; padding: 0 11px; font-size: 13px; border-radius: 8px; }
.icon-btn {
  display: inline-grid; place-items: center;
  width: 36px; height: 36px; padding: 0;
  border: 0; border-radius: 10px; background: transparent; color: var(--text-2);
  transition: background-color .15s ease, color .15s ease;
}
.icon-btn:hover { background: var(--hover); color: var(--text); }
.icon-btn .ico { width: 18px; height: 18px; }
.row-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }

/* ---- logo: three faders, one in the accent ------------------------------------- */
.logo { width: 28px; height: 28px; flex: none; overflow: visible; }
.logo-bg { fill: var(--ink); }
.logo-track { fill: none; stroke: var(--ink-text); stroke-width: 1.6; stroke-linecap: round; opacity: .32; }
.logo-fg { fill: var(--ink-text); }
.logo-accent { fill: var(--accent); }
.logo-cap { transform-box: fill-box; transition: transform .5s cubic-bezier(.3,1.6,.5,1); }
.logo-led { fill: var(--accent); opacity: 0; }
/* someone pushes the faders – the mix changes, the LED blinks */
.brand:hover .logo-cap-1 { transform: translateY(-6px); }
.brand:hover .logo-cap-2 { transform: translateY(5px); transition-delay: 40ms; }
.brand:hover .logo-cap-3 { transform: translateY(-3px); transition-delay: 80ms; }
.brand:hover .logo-led { animation: led 1s .2s ease-out; }

/* ---- theme toggle -------------------------------------------------------------- */
.theme-toggle { --seg: 32px; position: relative; display: inline-flex; padding: 2px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface-2); }
.theme-toggle button { position: relative; z-index: 1; display: grid; place-items: center; width: var(--seg); height: calc(var(--seg) - 4px); padding: 0; border: 0; border-radius: 999px; background: transparent; color: var(--text-3); transition: color .2s ease; }
.theme-toggle button:hover, .theme-toggle button[aria-pressed="true"] { color: var(--text); }
.theme-toggle .ico { width: 16px; height: 16px; }
.theme-thumb { position: absolute; top: 2px; left: 2px; width: var(--seg); height: calc(var(--seg) - 4px); border-radius: 999px; background: var(--thumb); box-shadow: 0 0 0 1px var(--line), var(--shadow-sm); transition: transform .32s cubic-bezier(.3,1.3,.5,1); }
:root[data-theme-pref="light"] .theme-thumb { transform: translateX(var(--seg)); }
:root[data-theme-pref="dark"] .theme-thumb { transform: translateX(calc(var(--seg) * 2)); }
.theme-toggle button[data-set-theme="light"][aria-pressed="true"] .ico { animation: spin-in .45s cubic-bezier(.3,1.4,.5,1); }
.theme-toggle button[data-set-theme="dark"][aria-pressed="true"] .ico { animation: tilt-in .45s cubic-bezier(.3,1.4,.5,1); }
html.theme-vt::view-transition-old(root), html.theme-vt::view-transition-new(root) { animation: none; mix-blend-mode: normal; }
html.theme-vt::view-transition-old(root) { z-index: 1; }
html.theme-vt::view-transition-new(root) { z-index: 2; }

/* ---- top bar ------------------------------------------------------------------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  -webkit-backdrop-filter: saturate(1.6) blur(14px); backdrop-filter: saturate(1.6) blur(14px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner {
  max-width: 1120px; margin: 0 auto;
  display: flex; align-items: center; gap: 12px;
  height: 60px; padding: 0 24px;
  padding-left: max(24px, env(safe-area-inset-left)); padding-right: max(24px, env(safe-area-inset-right));
}
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 650; font-size: 15px; letter-spacing: -.015em; min-height: 40px; white-space: nowrap; }
.nav { display: flex; align-items: center; gap: 2px; margin-left: 18px; }
.nav a { position: relative; padding: 7px 11px; border-radius: 9px; font-size: 14px; font-weight: 520; color: var(--text-2); transition: color .15s ease, background-color .15s ease; }
.nav a:hover { color: var(--text); background: var(--hover); }
.nav a[aria-current="page"] { color: var(--text); }
.nav a[aria-current="page"]::after { content: ""; position: absolute; left: 11px; right: 11px; bottom: -11px; height: 2px; border-radius: 2px; background: var(--accent); }
.topbar-end { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.userbox { display: flex; align-items: center; gap: 4px; padding-left: 10px; border-left: 1px solid var(--line); }
.avatar { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; color: var(--text-2); transition: background-color .15s ease, color .15s ease; }
.avatar:hover { background: var(--hover); color: var(--text); }
.avatar:hover .ico { transform: rotate(60deg); transition: transform .5s cubic-bezier(.3,1.4,.5,1); }
.avatar .ico { width: 19px; height: 19px; }

/* ---- bottom tab bar (phones) -------------------------------------------------------- */
.tabbar { display: none; }
@media (max-width: 899px) {
  .nav { display: none; }
  .tabbar {
    position: fixed; z-index: 25; left: 0; right: 0; bottom: 0;
    display: grid; grid-template-columns: repeat(2, minmax(0, 160px)); justify-content: center; gap: 24px;
    padding: 6px max(8px, env(safe-area-inset-right)) calc(6px + env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left));
    background: color-mix(in srgb, var(--bg) 82%, transparent);
    -webkit-backdrop-filter: saturate(1.6) blur(16px); backdrop-filter: saturate(1.6) blur(16px);
    border-top: 1px solid var(--line);
  }
  .tabbar a { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 0 2px; border-radius: 12px; font-size: 11px; font-weight: 550; color: var(--text-3); transition: color .15s ease; }
  .tabbar a .ico { width: 22px; height: 22px; }
  .tabbar a[aria-current="page"] { color: var(--text); }
  .tabbar a[aria-current="page"] .ico { color: var(--accent-text); stroke-width: 2; }
  body.has-tabbar .page { padding-bottom: calc(96px + env(safe-area-inset-bottom)); }
  .userbox .avatar { display: none; }
}

/* ---- page / hero --------------------------------------------------------------- */
.page {
  max-width: 1120px; margin: 0 auto;
  padding: 40px 24px 120px;
  padding-left: max(24px, env(safe-area-inset-left)); padding-right: max(24px, env(safe-area-inset-right));
}
.hero { margin-bottom: 24px; animation: rise .4s cubic-bezier(.2,.8,.2,1) both; }
.eyebrow { display: flex; align-items: center; flex-wrap: wrap; font-size: 13px; font-weight: 550; color: var(--text-3); letter-spacing: .01em; margin-bottom: 8px; }
.dot { margin: 0 7px; opacity: .55; }
.greeting { font-size: clamp(28px, 4.2vw, 38px); line-height: 1.12; font-weight: 650; letter-spacing: -.032em; text-wrap: balance; overflow-wrap: anywhere; }
.wave { display: inline-block; transform-origin: 70% 75%; animation: wave 1.4s .35s ease-in-out both; }
.greeting .who { text-transform: capitalize; }
.hero-sub { margin-top: 10px; color: var(--text-3); font-size: 14.5px; font-variant-numeric: tabular-nums; }
.hero-sub::first-letter { text-transform: uppercase; }

/* ---- cards ------------------------------------------------------------------------ */
.card {
  position: relative; isolation: isolate;
  background: var(--surface);
  border: 1px solid var(--line); border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 20px;
}
a.card { display: block; transition: transform .25s cubic-bezier(.3,1.4,.5,1), box-shadow .2s ease, border-color .2s ease; }
a.card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); border-color: var(--line-2); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.card-head h2, .card-head h3 { font-size: 15.5px; font-weight: 650; letter-spacing: -.015em; }
.card-head .ico { color: var(--text-3); }
.card-eyebrow { display: flex; align-items: center; gap: 7px; font-size: 12.5px; font-weight: 600; letter-spacing: .02em; text-transform: uppercase; color: var(--text-3); margin-bottom: 6px; }
.card-eyebrow .ico { width: 15px; height: 15px; color: var(--accent-text); }
.pill { display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 9px; border-radius: 999px; background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line); font-size: 12.5px; font-weight: 600; color: var(--text-2); font-variant-numeric: tabular-nums; white-space: nowrap; }
.pill .ico { width: 14px; height: 14px; }
.pill-accent { background: var(--accent-soft); color: var(--accent-text); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 30%, transparent); }
.pill-ok { background: var(--ok-soft); color: var(--ok); box-shadow: none; }
.pill-off { color: var(--text-3); }
.pill-warn { background: var(--warn-soft); color: var(--warn); box-shadow: none; }
.pdot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill-ok .pdot { animation: breathe 2.4s ease-in-out infinite; }
.tile { display: grid; place-items: center; width: 38px; height: 38px; flex: none; border-radius: 11px; color: var(--text-2); background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line); }
.tile .ico { width: 19px; height: 19px; }
.tile-lg { width: 52px; height: 52px; border-radius: 15px; }
.tile-lg .ico { width: 26px; height: 26px; }

.section { margin-top: 28px; animation: rise .45s .05s cubic-bezier(.2,.8,.2,1) both; }
.section:first-child { margin-top: 0; }
.section > header { display: flex; align-items: center; justify-content: space-between; gap: 4px 12px; flex-wrap: wrap; margin: 0 4px 10px; }
.section h2 { font-size: 17px; font-weight: 680; letter-spacing: -.02em; }
a.card.cta-card { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 14px; align-items: center; background: linear-gradient(135deg, var(--accent-soft), transparent 60%), var(--surface); }
.cta-card .tile { color: var(--accent-text); background: var(--surface); }
.cta-card h3 { font-size: 16px; font-weight: 650; letter-spacing: -.015em; }
.cta-card > .ico { color: var(--text-3); }
.note-card p { font-size: 14px; }

/* live / reconnecting tag next to "Appliances" */
.live-tag { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; color: var(--text-3); }
.live-tag i { width: 8px; height: 8px; border-radius: 50%; background: var(--text-3); }
.live-tag.phase-live { color: var(--ok); }
.live-tag.phase-live i { background: var(--ok); animation: ping 2s ease-out infinite; }
.live-tag.phase-fetching i { background: var(--accent); animation: breathe 1s ease-in-out infinite; }
.live-tag.phase-waiting, .live-tag.phase-ratelimited { color: var(--warn); }
.live-tag.phase-waiting i, .live-tag.phase-ratelimited i { background: var(--warn); }
.live-tag.phase-refused { color: var(--danger); }
.live-tag.phase-refused i { background: var(--danger); }

/* ---- the appliance card ------------------------------------------------------------- */
.appliance + .appliance { margin-top: 12px; }
.appliance.tone-accent { background: radial-gradient(90% 120% at 0% 0%, var(--accent-soft), transparent 62%), var(--surface); }
.appliance.is-offline { opacity: .8; }
.ap-head { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 14px; align-items: center; }
.ap-tile { color: var(--text-2); background: var(--surface); }
.tone-accent .ap-tile { color: var(--accent-text); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 30%, transparent), 0 6px 18px -8px var(--glow-edge); }
.tone-accent .ap-tile .ico { animation: hum 3.2s ease-in-out infinite; }
.ap-id h3 { font-size: 18px; font-weight: 680; letter-spacing: -.022em; line-height: 1.2; overflow-wrap: anywhere; }
.ap-id p { margin-top: 2px; }
.ap-state { margin-top: 20px; }
.ap-op { font-size: 30px; line-height: 1.1; font-weight: 700; letter-spacing: -.035em; }
.tone-accent .ap-op { color: var(--accent-text); }
.tone-ok .ap-op { color: var(--ok); }
.tone-warn .ap-op { color: var(--danger); }
.ap-prog { margin-top: 6px; font-size: 16px; font-weight: 560; color: var(--text-2); }
.ap-times { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-top: 18px; }
.ap-time { display: grid; gap: 2px; padding: 12px 14px; border-radius: 14px; background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line); }
.ap-time .k { display: flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; color: var(--text-3); }
.ap-time .k .ico { width: 15px; height: 15px; }
.ap-time b { font-size: 28px; line-height: 1.15; font-weight: 720; letter-spacing: -.035em; font-variant-numeric: tabular-nums; }
.ap-progress { display: flex; align-items: center; gap: 12px; margin-top: 14px; font-variant-numeric: tabular-nums; font-weight: 600; }
.bar { position: relative; flex: 1; height: 8px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.bar i { position: absolute; inset: 0 auto 0 0; width: var(--p, 0%); min-width: 8px; border-radius: inherit; background: linear-gradient(90deg, #ffb547, var(--accent)); box-shadow: 0 0 12px var(--glow-edge); animation: grow 1s .2s cubic-bezier(.2,.8,.2,1) both; }
.bar i::after { content: ""; position: absolute; inset: 0; border-radius: inherit; background: linear-gradient(90deg, transparent, rgb(255 255 255 / .45), transparent); background-size: 50% 100%; background-repeat: no-repeat; animation: sheen 2.6s 1.2s ease-in-out infinite; }
.facts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1px; margin-top: 18px; border-radius: 14px; overflow: hidden; background: var(--line); box-shadow: inset 0 0 0 1px var(--line); }
.fact { display: grid; gap: 3px; padding: 11px 13px; background: var(--surface); }
.fact dt { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; color: var(--text-3); }
.fact dt .ico { width: 14px; height: 14px; }
.fact dd { font-size: 14.5px; font-weight: 620; letter-spacing: -.01em; }
.fact.ok dd { color: var(--ok); }
.fact.warn dd { color: var(--danger); }
.ap-opts, .ap-alerts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.ap-foot { margin-top: 14px; }

/* ---- heating -------------------------------------------------------------------------- */
.bridge-wait { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 20px; align-items: center; border-style: dashed; border-color: var(--line-2); background: radial-gradient(70% 120% at 0% 50%, var(--accent-softer), transparent 70%), var(--surface); box-shadow: none; }
.bridge-wait h3 { font-size: 18px; font-weight: 680; letter-spacing: -.022em; }
.bridge-wait p.muted { font-size: 14px; }
.bridge-art { width: 150px; height: 100px; overflow: visible; }
.ba-board { fill: var(--ink); }
.ba-screen { fill: var(--accent); opacity: .85; }
.ba-led { fill: var(--accent); animation: blink-led 2.4s ease-in-out infinite; }
.ba-pins { stroke: var(--ink-text); stroke-width: 2; stroke-dasharray: 2 4; opacity: .5; fill: none; }
.ba-antenna { stroke: var(--ink); stroke-width: 3; stroke-linecap: round; fill: none; }
.ba-tip { fill: var(--accent); }
.ba-wave { fill: none; stroke: var(--accent); stroke-width: 3; stroke-linecap: round; opacity: 0; animation: radio 2.4s ease-out infinite; }
.ba-wave-2 { animation-delay: .3s; } .ba-wave-3 { animation-delay: .6s; }
.bridge-strip { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 12px; padding: 14px 16px; }
.bridge-strip .bs-main { font-size: 14.5px; }
.bridge-strip .bs-facts { display: flex; flex-wrap: wrap; gap: 6px; margin-left: auto; }
.bridge-strip .bs-note { flex-basis: 100%; }
.bridge-strip.is-stale { border-color: color-mix(in srgb, var(--warn) 40%, transparent); }
.signal-good { color: var(--ok); } .signal-fair { color: var(--text-2); } .signal-weak { color: var(--warn); }
.rooms { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; margin-top: 12px; }
.room {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; grid-template-areas: "zone name temp" "zone meta meta";
  gap: 2px 12px; align-items: center; padding: 13px 14px;
  border-radius: 16px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-sm);
  transition: border-color .3s ease, background-color .3s ease;
}
.room-zone { grid-area: zone; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 11px; background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line); font-size: 14px; font-weight: 700; color: var(--text-2); font-variant-numeric: tabular-nums; }
.room-name { grid-area: name; font-size: 14.5px; font-weight: 620; letter-spacing: -.01em; line-height: 1.3; overflow-wrap: anywhere; }
.room-meta { grid-area: meta; display: flex; align-items: center; justify-content: space-between; gap: 4px 10px; flex-wrap: wrap; }
.room-temp { grid-area: temp; font-size: 20px; font-weight: 720; letter-spacing: -.03em; font-variant-numeric: tabular-nums; justify-self: end; }
.room-state { display: inline-flex; align-items: center; gap: 4px; font-size: 12.5px; font-weight: 600; color: var(--text-3); }
.room-state .ico { width: 14px; height: 14px; }
.room-heard { font-size: 12px; color: var(--text-3); white-space: nowrap; }
.room.is-on { border-color: color-mix(in srgb, var(--accent) 40%, transparent); background: linear-gradient(135deg, var(--accent-soft), transparent 70%), var(--surface); }
.room.is-on .room-zone { background: var(--accent); color: var(--accent-ink); box-shadow: 0 4px 12px -4px var(--glow-edge); }
.room.is-on .room-state { color: var(--accent-text); }
.room.is-on .room-state .ico { animation: flicker 1.6s ease-in-out infinite; transform-origin: 50% 90%; }
.room.is-stale .room-heard { color: var(--warn); }
.room-temp.none { color: var(--text-3); font-weight: 500; }
.rooms-waiting .room { border-style: dashed; box-shadow: none; background: transparent; }
.rooms-waiting .room-name { color: var(--text-2); }

/* ---- settings ----------------------------------------------------------------------------- */
.settings { display: grid; gap: 16px; max-width: 760px; }
.settings .card { scroll-margin-top: 80px; }
.status-row { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.status-row:last-of-type { border-bottom: 0; }
.status-row .k { color: var(--text-3); width: 150px; flex: none; }
.status-calls { align-items: flex-start; }
.calls { display: grid; gap: 8px; flex: 1; min-width: 0; font-variant-numeric: tabular-nums; }
.status-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--text-3); flex: none; }
.status-dot.ok { background: var(--ok); box-shadow: 0 0 0 4px var(--ok-soft); }
.status-dot.bad { background: var(--danger); box-shadow: 0 0 0 4px var(--danger-soft); }
.status-dot.warn { background: #f59e0b; box-shadow: 0 0 0 4px var(--warn-soft); }
.form-grid { display: grid; gap: 12px; margin-top: 14px; }
.form-grid .btn { justify-self: start; }
.field { display: grid; gap: 6px; }
.field span { font-size: 13px; font-weight: 550; color: var(--text-2); }
.field .hint { font-size: 12px; color: var(--text-3); font-weight: 450; }
.field input {
  height: 44px; padding: 0 13px; width: 100%; min-width: 0;
  border: 1px solid var(--line-2); border-radius: 11px; background: var(--bg);
  font-size: 15px; outline: none;
  transition: border-color .15s ease, box-shadow .15s ease, background-color .15s ease;
}
.field input:focus { border-color: var(--accent); background: var(--surface); box-shadow: 0 0 0 4px var(--accent-soft); }
details > summary { list-style: none; }
details > summary::-webkit-details-marker { display: none; }
code { font: 500 12.5px/1.5 ui-monospace, "SF Mono", Menlo, monospace; background: var(--surface-2); padding: 2px 6px; border-radius: 6px; overflow-wrap: anywhere; }
.copy-line { display: flex; align-items: center; gap: 8px; padding: 6px 6px 6px 10px; border-radius: 10px; background: var(--surface-2); margin-top: 8px; }
.copy-line code { flex: 1; background: transparent; padding: 0; }
.ok-msg { display: flex; align-items: center; gap: 8px; margin-top: 12px; padding: 10px 12px; border-radius: 10px; background: var(--ok-soft); color: var(--ok); font-size: 14px; font-weight: 550; }
.alert { margin-top: 14px; padding: 10px 12px; border-radius: 10px; background: var(--danger-soft); color: var(--danger); font-size: 14px; font-weight: 500; animation: shake .4s cubic-bezier(.36,.07,.19,.97) both; }
.progress-line { display: block; height: 4px; border-radius: 2px; background: var(--surface-3); overflow: hidden; }
.progress-line i { display: block; height: 100%; width: var(--p, 0%); background: var(--accent); transition: width .4s ease; }
.device-flow { display: grid; gap: 12px; justify-items: start; margin-top: 16px; padding: 18px; border-radius: 16px; border: 1px dashed color-mix(in srgb, var(--accent) 45%, transparent); background: var(--accent-softer); animation: rise .35s cubic-bezier(.2,.8,.2,1) both; }
.device-flow p { font-size: 14px; color: var(--text-2); }
.device-flow .card-eyebrow { margin: 0; color: var(--accent-text); }
.df-code { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 10px; }
.df-code .k { font-size: 13px; color: var(--text-3); }
.code-big { font-size: 22px; font-weight: 650; letter-spacing: .14em; padding: 4px 12px; background: var(--surface); box-shadow: inset 0 0 0 1px var(--line-2); border-radius: 10px; }
.df-wait { display: flex; align-items: center; gap: 8px; }
.spinner { width: 14px; height: 14px; flex: none; border-radius: 50%; border: 2px solid var(--accent-soft); border-top-color: var(--accent); animation: spin .8s linear infinite; }

/* ---- toast ---------------------------------------------------------------------------------- */
.toast { position: fixed; z-index: 90; left: 50%; top: calc(76px + env(safe-area-inset-top)); translate: -50% 0; display: flex; align-items: center; gap: 10px; padding: 10px 16px; border-radius: 14px; background: var(--ink); color: var(--ink-text); box-shadow: var(--shadow-lg); font-size: 14px; font-weight: 600; animation: toast-in .4s cubic-bezier(.3,1.4,.5,1) both; max-width: calc(100% - 32px); }
.toast .ico { color: var(--accent); }

/* ---- empty / login ----------------------------------------------------------------------- */
.empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 10px; padding: 56px 24px 64px; border: 1px dashed var(--line-2); border-radius: 20px; background: radial-gradient(ellipse 55% 65% at 50% 0%, var(--accent-softer), transparent); animation: rise .4s cubic-bezier(.2,.8,.2,1) both; }
.empty h1, .empty h2 { font-size: 20px; font-weight: 650; letter-spacing: -.02em; margin-top: 6px; }
.empty p { color: var(--text-3); max-width: 360px; font-size: 14.5px; }
.empty .btn { margin-top: 14px; }
.empty-art { width: 168px; height: 126px; overflow: visible; }
.ea-shadow { fill: var(--text); opacity: .07; transform-origin: 80px 108px; animation: shadow 3.2s ease-in-out infinite; }
.ea-float { animation: bob 3.2s ease-in-out infinite; }
.ea-desk { fill: var(--ink); }
.ea-track { fill: none; stroke: var(--ink-text); stroke-width: 3; stroke-linecap: round; opacity: .3; }
.ea-cap { fill: var(--ink-text); transform-box: fill-box; }
.ea-hot { fill: var(--accent); }
.ea-cap-1 { animation: fader-a 4s ease-in-out infinite; }
.ea-cap-2 { animation: fader-b 4s ease-in-out infinite; }
.ea-cap-3 { animation: fader-c 4s ease-in-out infinite; }
.ea-face { fill: none; stroke: var(--ink-text); stroke-width: 2.6; stroke-linecap: round; }
.ea-spark { fill: var(--accent); transform-box: fill-box; transform-origin: center; animation: twinkle 2.4s ease-in-out infinite; }
.ea-spark-2 { animation-delay: .8s; } .ea-spark-3 { animation-delay: 1.5s; }

.login-page { display: grid; place-items: center; align-content: center; gap: 20px; padding: 80px 16px 40px; position: relative; overflow-x: hidden; }
.login-page::before { content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none; background-image: radial-gradient(var(--dots) 1px, transparent 1.2px); background-size: 22px 22px; -webkit-mask: radial-gradient(ellipse 60% 55% at 50% 45%, #000 30%, transparent 75%); mask: radial-gradient(ellipse 60% 55% at 50% 45%, #000 30%, transparent 75%); }
.login-page::after { content: ""; position: fixed; z-index: -1; pointer-events: none; width: 520px; height: 520px; left: 50%; top: 42%; translate: -50% -50%; border-radius: 50%; background: radial-gradient(circle, var(--glow), transparent 65%); filter: blur(10px); }
.login-corner { position: fixed; top: max(16px, env(safe-area-inset-top)); right: 16px; }
.login-card { width: 100%; max-width: 380px; padding: 36px 32px 32px; background: var(--surface); border: 1px solid var(--line); border-radius: 22px; box-shadow: var(--shadow-lg); animation: rise .45s cubic-bezier(.2,.8,.2,1) both; }
.login-mark { margin-bottom: 22px; }
.login-mark .logo { width: 44px; height: 44px; }
.login-mark .logo-cap-1 { animation: fader-a 1.4s .35s cubic-bezier(.3,1.4,.5,1) both; }
.login-mark .logo-cap-2 { animation: fader-b 1.4s .4s cubic-bezier(.3,1.4,.5,1) both; }
.login-mark .logo-cap-3 { animation: fader-c 1.4s .45s cubic-bezier(.3,1.4,.5,1) both; }
.login-card h1 { font-size: 26px; font-weight: 650; letter-spacing: -.03em; line-height: 1.15; }
.login-lede { margin-top: 6px; color: var(--text-3); font-size: 14.5px; }
.login-form { display: grid; gap: 14px; margin-top: 26px; }
.login-form .btn-block { margin-top: 8px; }
.login-foot { font-size: 12.5px; color: var(--text-3); }

/* ---- small screens --------------------------------------------------------------------- */
@media (max-width: 719px) {
  .topbar-inner { height: 56px; gap: 8px; padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(12px, env(safe-area-inset-right)); }
  .topbar-end { gap: 4px; }
  .userbox { padding-left: 6px; gap: 0; }
  .icon-btn { width: 40px; height: 40px; }
  .theme-toggle { display: none; }
  .settings .theme-toggle { display: inline-flex; }
  .page { padding: 24px 16px 120px; padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(16px, env(safe-area-inset-right)); }
  .hero { margin-bottom: 18px; }
  .card { padding: 16px; border-radius: 16px; }
  .login-card { padding: 30px 22px 24px; border-radius: 20px; }
  .ap-op { font-size: 26px; }
  .ap-time b { font-size: 24px; }
  .facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .bridge-wait { grid-template-columns: 1fr; justify-items: center; text-align: center; gap: 10px; }
  .bridge-wait .card-eyebrow { justify-content: center; }
  .status-row { flex-wrap: wrap; row-gap: 4px; }
  .status-row .k { width: 100%; }
  .bridge-strip .bs-facts { margin-left: 0; }
}
@media (max-width: 380px) { .ap-times { grid-template-columns: 1fr 1fr; } .ap-time { padding: 10px 11px; } .ap-time b { font-size: 21px; } }
@media (pointer: coarse) { .theme-toggle { --seg: 40px; } }

/* ---- keyframes ----------------------------------------------------------------------------- */
@keyframes rise { from { opacity: 0; transform: translateY(6px); } }
@keyframes wave {
  0%, 100% { transform: rotate(0); }
  15% { transform: rotate(14deg); } 30% { transform: rotate(-8deg); }
  45% { transform: rotate(14deg); } 60% { transform: rotate(-4deg); } 75% { transform: rotate(10deg); }
}
@keyframes grow { from { width: 0; min-width: 0; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes spin-in { from { transform: rotate(-90deg) scale(.6); } }
@keyframes tilt-in { from { transform: rotate(40deg) scale(.6); } }
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-4px); } }
@keyframes shadow { 0%, 100% { transform: scaleX(1); opacity: .08; } 50% { transform: scaleX(.86); opacity: .05; } }
@keyframes twinkle { 0%, 100% { transform: scale(1) rotate(0); opacity: 1; } 50% { transform: scale(.5) rotate(45deg); opacity: .4; } }
@keyframes shake { 20%, 80% { transform: translateX(-2px); } 40%, 60% { transform: translateX(3px); } }
@keyframes toast-in { from { opacity: 0; transform: translateY(-14px) scale(.95); } }
@keyframes breathe { 0%, 100% { opacity: 1; } 50% { opacity: .45; } }
@keyframes ping { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--ok) 45%, transparent); } 80%, 100% { box-shadow: 0 0 0 7px transparent; } }
@keyframes led { 0%, 100% { opacity: 0; } 20%, 60% { opacity: 1; } 40% { opacity: .2; } }
@keyframes blink-led { 0%, 100% { opacity: 1; } 50% { opacity: .25; } }
@keyframes radio { 0% { opacity: 0; } 20% { opacity: .9; } 70%, 100% { opacity: 0; } }
@keyframes hum { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-1.5px); } }
@keyframes sheen { 0% { background-position: -100% 0; } 60%, 100% { background-position: 200% 0; } }
@keyframes flicker { 0%, 100% { transform: scale(1) rotate(-3deg); } 33% { transform: scale(1.1, .94) rotate(3deg); } 66% { transform: scale(.94, 1.08) rotate(-1deg); } }
@keyframes fader-a { 0%, 100% { transform: translateY(0); } 40% { transform: translateY(-9px); } 70% { transform: translateY(-4px); } }
@keyframes fader-b { 0%, 100% { transform: translateY(0); } 35% { transform: translateY(10px); } 65% { transform: translateY(4px); } }
@keyframes fader-c { 0%, 100% { transform: translateY(0); } 45% { transform: translateY(-5px); } 75% { transform: translateY(3px); } }

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

/* ---- utilities (inline styles are blocked by the CSP) --------------------------------------- */
.mt-12 { margin-top: 12px; } .mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; }
