:root {
  color-scheme: dark;
  --ink: #101214;
  --ink-raised: #171b1e;
  --slate: #414a52;
  --slate-light: #68737d;
  --line: rgba(245, 246, 247, 0.11);
  --line-strong: rgba(245, 246, 247, 0.18);
  --white: #f5f6f7;
  --muted: #aeb6bd;
  --warm: #f2b84b;
  --warm-soft: rgba(242, 184, 75, 0.14);
  --healthy: #54b9ac;
  --healthy-soft: rgba(84, 185, 172, 0.14);
  --danger: #d9534f;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.25);
  --radius-xl: 30px;
  --radius-lg: 22px;
  --radius-md: 16px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html { min-width: 320px; background: var(--ink); scroll-behavior: smooth; }

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background:
    radial-gradient(circle at 78% -10%, rgba(104, 115, 125, 0.2), transparent 30rem),
    var(--ink);
  color: var(--white);
}

button, input, select { font: inherit; }
button { color: inherit; }
svg { width: 1.4rem; height: 1.4rem; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

button:focus-visible, a:focus-visible, select:focus-visible {
  outline: 3px solid rgba(242, 184, 75, 0.72);
  outline-offset: 3px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

.auth-screen {
  min-height: 100vh;
  padding: clamp(24px, 5vw, 70px) 18px;
  background:
    radial-gradient(circle at 50% -15%, rgba(104, 115, 125, 0.23), transparent 35rem),
    var(--ink);
}

.auth-shell { width: min(980px, 100%); margin: 0 auto; }
.auth-brand { display: flex; align-items: center; justify-content: center; gap: 13px; margin-bottom: 30px; }
.auth-brand > span:last-child { display: grid; line-height: 1.05; }
.auth-brand strong { font-size: 1.05rem; }
.auth-brand small { margin-top: 5px; color: var(--muted); font-size: 0.68rem; letter-spacing: 0.1em; text-transform: uppercase; }

.auth-card {
  width: min(460px, 100%);
  margin: 0 auto;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-xl);
  background: rgba(23, 27, 30, 0.96);
  padding: clamp(28px, 5vw, 46px);
  box-shadow: var(--shadow);
}
.auth-card.setup-card { width: 100%; }
.auth-card h1 { margin: 9px 0 12px; font-size: clamp(2rem, 6vw, 3.6rem); letter-spacing: -0.055em; line-height: 1; }
.auth-card > p:not(.eyebrow) { max-width: 660px; margin: 0 0 26px; color: var(--muted); line-height: 1.65; }
.auth-spinner { display: block; width: 34px; height: 34px; margin-bottom: 24px; border: 3px solid var(--line-strong); border-top-color: var(--healthy); border-radius: 50%; animation: spin 850ms linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.setup-code-help { display: grid; gap: 10px; margin: 25px 0; border: 1px solid var(--line); border-radius: var(--radius-md); background: rgba(84, 185, 172, 0.06); padding: 19px; }
.setup-code-help strong { font-size: 0.84rem; }
.setup-code-help code { overflow-x: auto; border-radius: 9px; background: var(--ink); padding: 12px 14px; color: var(--healthy); font: 0.76rem/1.45 ui-monospace, SFMono-Regular, Consolas, monospace; white-space: nowrap; }
.setup-code-help small { color: var(--muted); font-size: 0.7rem; }

.auth-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.auth-form.single-column { grid-template-columns: 1fr; }
.auth-form fieldset { display: grid; min-width: 0; gap: 14px; margin: 0; border: 1px solid var(--line); border-radius: var(--radius-md); padding: 19px; }
.auth-form legend { padding: 0 8px; color: var(--warm); font-size: 0.75rem; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; }
.full-width { grid-column: 1 / -1; }
.form-field { display: grid; gap: 7px; }
.form-field > span { color: var(--muted); font-size: 0.69rem; font-weight: 750; letter-spacing: 0.03em; }
.form-field input, .form-field select {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  outline: 0;
  background: var(--ink);
  color: var(--white);
  padding: 0 13px;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}
.form-field select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 18px) 19px, calc(100% - 13px) 19px; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 35px; }
.form-field input:focus, .form-field select:focus { border-color: var(--warm); box-shadow: 0 0 0 3px var(--warm-soft); }
.form-field input[type="checkbox"], .form-field input[type="radio"] { width: 20px; height: 20px; min-height: 20px; padding: 0; margin: 0; flex: 0 0 20px; accent-color: var(--warm); }
.form-field.toggle-field { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 40px; cursor: pointer; }
.speech-rate-control { display: flex; align-items: center; gap: 12px; max-width: 360px; }
.speech-rate-control input[type="range"] { width: 100%; min-width: 0; min-height: 32px; border: 0; padding: 0; background: transparent; accent-color: var(--warm); }
.speech-rate-control output { min-width: 3.5em; color: var(--warm); font-size: 0.85rem; font-variant-numeric: tabular-nums; }
.form-message { min-height: 1.25rem; margin: 0; color: var(--muted); font-size: 0.72rem; line-height: 1.45; }
.form-message.is-error { color: #f18c88; }
.form-message.is-success { color: var(--healthy); }
.form-message.is-working { color: var(--white); }

.primary-button, .secondary-button {
  width: fit-content;
  max-width: 100%;
  justify-self: start;
  align-self: start;
  flex: 0 1 auto;
  min-height: 43px;
  border: 0;
  border-radius: 12px;
  padding: 0 17px;
  cursor: pointer;
  font-weight: 800;
  transition: transform 150ms ease, opacity 150ms ease, background 150ms ease;
}
.primary-button { background: var(--white); color: var(--ink); }
.secondary-button { border: 1px solid var(--line-strong); background: rgba(255,255,255,0.04); color: var(--white); }
.primary-button.is-busy { display: inline-flex; align-items: center; justify-content: center; gap: 10px; }
.primary-button.is-busy::before { width: 15px; height: 15px; flex: 0 0 auto; border: 2px solid rgba(17,20,22,0.25); border-top-color: var(--ink); border-radius: 50%; animation: spin 700ms linear infinite; content: ""; }
.primary-button:hover, .secondary-button:hover { transform: translateY(-1px); }
.primary-button:disabled, .secondary-button:disabled { cursor: wait; opacity: 0.58; transform: none; }
.compact-button { min-height: 35px; margin-top: 18px; font-size: 0.72rem; }
.refresh-button { justify-self: start; margin-top: -2px; }

.owner-list { display: grid; gap: 9px; }
.owner-row { display: flex; align-items: center; gap: 11px; border-top: 1px solid var(--line); padding-top: 10px; }
.owner-initial { display: grid; width: 34px; height: 34px; flex: 0 0 auto; place-items: center; border-radius: 50%; background: var(--slate); font-size: 0.72rem; font-weight: 800; }
.owner-row > span:last-child { display: grid; gap: 2px; }
.owner-row strong { font-size: 0.78rem; }
.owner-row small { color: var(--muted); font-size: 0.65rem; }
.security-form { display: grid; gap: 12px; }

.app-shell { min-height: 100vh; }

.side-rail {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 20;
  display: flex;
  width: 254px;
  flex-direction: column;
  border-right: 1px solid var(--line);
  background: rgba(17, 20, 22, 0.94);
  padding: 30px 20px 24px;
  backdrop-filter: blur(24px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 13px;
  color: var(--white);
  text-decoration: none;
  padding: 0 8px 34px;
}

.brand-mark {
  display: grid;
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 15px;
  background: var(--white);
  color: var(--ink);
}

.brand-mark svg { width: 26px; height: 26px; stroke-width: 2.1; }
.brand-copy { display: grid; line-height: 1.05; }
.brand-copy strong { font-size: 1.05rem; letter-spacing: 0.01em; }
.brand-copy small { margin-top: 5px; color: var(--muted); font-size: 0.72rem; letter-spacing: 0.08em; text-transform: uppercase; }

.rail-nav { display: grid; gap: 7px; min-height: 0; overflow-y: auto; flex: 1; align-content: start; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 50px;
  border: 0;
  border-radius: 15px;
  background: transparent;
  color: var(--muted);
  padding: 0 15px;
  cursor: pointer;
  transition: background 160ms ease, color 160ms ease, transform 160ms ease;
}
.nav-item:hover { color: var(--white); background: rgba(255, 255, 255, 0.055); }
.nav-item:active { transform: scale(0.98); }
.nav-item.is-active { background: var(--white); color: var(--ink); box-shadow: 0 10px 25px rgba(0, 0, 0, 0.16); }
.nav-item span { font-size: 0.91rem; font-weight: 700; }
.nav-item svg { flex: 0 0 auto; }

.rail-foot {
  display: flex;
  align-items: center;
  gap: 11px;
  margin-top: auto;
  border-top: 1px solid var(--line);
  padding: 22px 8px 0;
}
.rail-foot > span:last-child { display: grid; min-width: 0; }
.rail-foot strong { font-size: 0.78rem; font-weight: 700; }
.rail-foot small { margin-top: 3px; overflow: hidden; color: var(--muted); font-size: 0.68rem; text-overflow: ellipsis; white-space: nowrap; }

.status-dot { width: 8px; height: 8px; flex: 0 0 auto; border-radius: 50%; background: var(--warm); box-shadow: 0 0 0 5px var(--warm-soft); }
.status-dot.is-healthy { background: var(--healthy); box-shadow: 0 0 0 5px var(--healthy-soft); }
.status-dot.is-unavailable { background: var(--danger); box-shadow: 0 0 0 5px rgba(217, 83, 79, 0.14); }

.main-content { min-height: 100vh; margin-left: 254px; padding: 32px clamp(28px, 4vw, 64px) 42px; }
.top-bar { display: flex; align-items: center; justify-content: space-between; gap: 24px; max-width: 1500px; margin: 0 auto 31px; }
.top-bar h1 { margin: 3px 0 0; font-size: 1.62rem; letter-spacing: -0.025em; }
.eyebrow { margin: 0; color: var(--muted); font-size: 0.7rem; font-weight: 800; letter-spacing: 0.14em; text-transform: uppercase; }
.eyebrow.warm { color: var(--warm); }
.top-actions { display: flex; align-items: center; gap: 12px; }
.controller-pill { display: flex; align-items: center; gap: 10px; min-height: 42px; border: 1px solid var(--line); border-radius: 999px; background: rgba(255, 255, 255, 0.025); padding: 0 17px; color: var(--muted); font-size: 0.78rem; font-weight: 700; }
.avatar-placeholder { width: 42px; height: 42px; border: 1px solid var(--line-strong); border-radius: 50%; background: var(--slate); color: var(--white); cursor: pointer; font-weight: 800; }

.view { display: none; max-width: 1500px; margin: 0 auto; animation: view-in 260ms ease both; }
.view.is-active { display: block; }
@keyframes view-in { from { opacity: 0; transform: translateY(7px); } to { opacity: 1; transform: translateY(0); } }

.summary-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-top: 18px; }
.summary-grid.home-summary { margin-top: 0; }
.summary-card { display: grid; min-height: 125px; grid-template-columns: auto 1fr; align-items: center; gap: 14px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--ink-raised); padding: 21px; }
.summary-icon, .settings-icon { display: grid; width: 45px; height: 45px; place-items: center; border-radius: 15px; background: rgba(104,115,125,0.16); color: #bfc6cc; }
.summary-icon.healthy, .settings-icon.healthy { background: var(--healthy-soft); color: var(--healthy); }
.summary-icon.warm, .settings-icon.warm { background: var(--warm-soft); color: var(--warm); }
.summary-card > div { display: grid; gap: 3px; }
.summary-card strong { font-size: 1.16rem; }
.summary-card div span { color: var(--muted); font-size: 0.76rem; }
.badge { grid-column: 1 / -1; width: max-content; border-radius: 999px; background: rgba(104,115,125,0.12); padding: 5px 9px; color: var(--muted); font-size: 0.64rem; font-weight: 750; letter-spacing: 0.02em; }
.badge.healthy { background: var(--healthy-soft); color: var(--healthy); }
.badge.warm { background: var(--warm-soft); color: var(--warm); }

.content-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; margin-top: 18px; }
.panel { border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--ink-raised); }
.content-grid .panel { padding: 26px; }
.panel-heading { display: flex; align-items: start; justify-content: space-between; gap: 20px; }
.panel-heading h3, .foundation-strip h3 { margin: 6px 0 0; font-size: 1.25rem; letter-spacing: -0.025em; }
.text-button { border: 0; background: transparent; color: var(--warm); padding: 5px; cursor: pointer; font-size: 0.77rem; font-weight: 750; }
.empty-state.compact { display: flex; min-height: 118px; align-items: center; gap: 18px; margin-top: 18px; border: 1px dashed var(--line-strong); border-radius: var(--radius-md); padding: 22px; }
.empty-icon { display: grid; width: 44px; height: 44px; flex: 0 0 auto; place-items: center; border-radius: 50%; background: rgba(104,115,125,0.12); color: var(--slate-light); }
.empty-icon.large { width: 68px; height: 68px; margin-bottom: 18px; }
.empty-icon.large svg { width: 30px; height: 30px; }
.empty-state h4 { margin: 0 0 7px; font-size: 0.92rem; }
.empty-state p { margin: 0; color: var(--muted); font-size: 0.78rem; line-height: 1.55; }
.home-room-grid { display: flex; min-height: 118px; flex-wrap: wrap; align-content: center; gap: 9px; margin-top: 18px; }
.room-chip { display: inline-flex; min-height: 36px; align-items: center; border: 1px solid var(--line); border-radius: 999px; background: rgba(255,255,255,0.025); padding: 0 13px; color: var(--muted); cursor: pointer; font-size: 0.7rem; font-weight: 700; }
.room-chip:hover { border-color: var(--line-strong); color: var(--white); }
.home-favorite-grid { display: grid; gap: 10px; margin-top: 18px; }
.home-favorite-grid .device-tile { min-height: 94px; }

.device-groups { display: grid; gap: 18px; }
.device-group { padding: clamp(20px, 3vw, 28px); }
.device-group-heading { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 18px; }
.device-group-heading h3, .device-group-heading button { margin: 0; border: 0; background: transparent; color: var(--white); padding: 0; font-size: 1.22rem; font-weight: 800; letter-spacing: -0.025em; }
.device-group-heading button { cursor: pointer; }
.device-group-heading > button { display: flex; width: 100%; min-height: 44px; align-items: center; justify-content: space-between; gap: 18px; text-align: left; touch-action: pan-y; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.device-group-heading > button:focus-visible { outline: 2px solid var(--warm); outline-offset: 3px; }
.device-group-heading button:hover { color: var(--warm); }
.device-group-heading span { color: var(--muted); font-size: 0.7rem; }
.device-tile-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; }
.device-tile { position: relative; display: grid; min-width: 0; min-height: 106px; border: 1px solid var(--line); border-radius: 26px; background: var(--ink-raised); color: var(--white); transition: background 160ms ease, border-color 160ms ease; }
.device-tile.is-on { background: var(--slate); border-color: var(--slate-light); }
.device-tile.is-offline { color: var(--muted); }
.device-tile-toggle { display: grid; width: 100%; min-height: inherit; grid-template-columns: 32px minmax(0, 1fr) auto; align-items: center; gap: 14px; border: 0; border-radius: inherit; background: transparent; padding: 22px 56px 22px 20px; color: inherit; text-align: left; cursor: pointer; }
.device-tile-toggle:hover:not(:disabled) { background: rgba(245,246,247,0.035); }
.device-tile-toggle:disabled { cursor: default; }
.device-tile.is-pending .device-tile-toggle { cursor: wait; }
.device-tile-icon { display: grid; width: 32px; height: 36px; place-items: center; color: var(--muted); }
.device-tile-icon svg { width: 27px; height: 27px; }
.device-tile.is-on .device-tile-icon { color: var(--white); }
.device-tile.is-offline .device-tile-icon { opacity: 0.55; }
.device-tile-title { display: grid; min-width: 0; gap: 4px; }
.device-tile-title strong { font-size: 0.85rem; line-height: 1.3; overflow-wrap: anywhere; }
.device-tile-title small { color: var(--muted); font-size: 0.76rem; line-height: 1.25; }
.device-tile.is-on .device-tile-title small { color: var(--white); }
.device-tile > .favorite-button { position: absolute; top: 62px; right: 13px; }
.device-tile-toggle { touch-action: pan-y; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.device-info-button { display: grid; width: 34px; height: 34px; flex: 0 0 auto; place-items: center; border: 1px solid var(--line); border-radius: 50%; background: transparent; color: var(--muted); cursor: pointer; font-size: 1.2rem; }
.device-info-button:hover { color: var(--white); border-color: var(--line-strong); }
.device-info-button:focus-visible, .device-tile-toggle:focus-visible { outline: 2px solid var(--warm); outline-offset: 3px; }
.device-tile > .device-info-button { position: absolute; top: 16px; right: 13px; }
.device-tile > .room-lights-open { top: 50%; transform: translateY(-50%); }
.control-dialog { width: min(880px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); margin: auto; border: 1px solid var(--line-strong); border-radius: var(--radius-lg); padding: 24px; background: var(--ink); color: var(--white); overflow-y: auto; overscroll-behavior: contain; }
.control-dialog::backdrop { background: rgba(0,0,0,0.68); }
.control-dialog-heading { display: flex; align-items: center; gap: 16px; margin-bottom: 20px; }
.control-dialog-heading h2 { flex: 1; min-width: 0; margin: 0; font-size: 1.3rem; overflow-wrap: anywhere; }
.control-dialog-heading > [hidden] { display: none; }
.control-dialog .registry-item { margin: 0; }
.camera-view { display: grid; gap: 12px; }
.camera-stage { position: relative; width: 100%; aspect-ratio: 16 / 9; overflow: hidden; border-radius: 18px; background: #000; }
.camera-stage canvas { display: block; width: 100%; height: 100%; object-fit: contain; }
.camera-view p { margin: 0; color: var(--muted); font-size: 0.75rem; }
.camera-view-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.camera-quality-selector { display: flex; gap: 6px; padding: 4px; border: 1px solid var(--line); border-radius: 14px; background: var(--ink-raised); }
.camera-quality-selector button { min-height: 38px; border: 1px solid transparent; border-radius: 10px; padding: 7px 13px; background: transparent; color: var(--muted); cursor: pointer; font: inherit; font-size: 0.72rem; font-weight: 700; }
.camera-quality-selector button[aria-pressed="true"] { border-color: var(--line-strong); background: var(--slate); color: var(--white); }
.camera-overlay-actions { position: absolute; z-index: 2; top: 14px; right: 14px; display: flex; gap: 8px; }
.camera-overlay-button { display: grid; width: 44px; height: 44px; place-items: center; border: 1px solid rgba(255,255,255,0.32); border-radius: 50%; padding: 0; background: rgba(10,12,14,0.68); color: var(--white); cursor: pointer; backdrop-filter: blur(5px); }
.camera-overlay-button svg { width: 23px; height: 23px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.camera-overlay-button:hover { background: rgba(10,12,14,0.9); }
.camera-audio-button { position: absolute; z-index: 2; bottom: 14px; left: 14px; }
.camera-audio-button[hidden] { display: none; }
.camera-audio-button[aria-pressed="true"] { border-color: var(--warm); color: var(--warm); }
.camera-ptz-pad { position: absolute; z-index: 2; left: 50%; bottom: 14px; width: 142px; height: 142px; transform: translateX(-50%); }
.camera-ptz-pad[hidden], .camera-patrol-actions[hidden], .camera-step-selector[hidden], .camera-zone-editor[hidden] { display: none; }
.camera-ptz-button { position: absolute; display: grid; width: 42px; height: 42px; place-items: center; border: 1px solid rgba(255,255,255,0.32); border-radius: 50%; padding: 0; background: rgba(10,12,14,0.68); color: var(--white); cursor: pointer; font: inherit; font-size: 1.25rem; line-height: 1; backdrop-filter: blur(5px); }
.camera-ptz-button:hover { background: rgba(10,12,14,0.9); }
.camera-ptz-button:disabled { opacity: 0.45; cursor: wait; }
.camera-ptz-up { top: 0; left: 50px; }
.camera-ptz-left { top: 50px; left: 0; }
.camera-ptz-home { top: 50px; left: 50px; }
.camera-ptz-right { top: 50px; right: 0; }
.camera-ptz-down { bottom: 0; left: 50px; }
.camera-control-panel { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: 16px; padding: 8px; background: rgba(255,255,255,0.018); }
.camera-control-panel[hidden], .camera-control-panel > [hidden] { display: none; }
.camera-audio-controls, .camera-privacy-controls, .camera-night-vision-controls, .camera-patrol-actions, .camera-position-actions, .camera-detection-controls { display: flex; min-height: 46px; align-items: center; gap: 6px; border: 1px solid var(--line); border-radius: 12px; padding: 4px; background: var(--ink-raised); }
.camera-audio-controls { flex: 1 1 250px; }
.camera-audio-controls label { display: flex; min-width: 110px; flex: 1; align-items: center; }
.camera-audio-controls input[type="range"] { width: 100%; min-width: 100px; accent-color: var(--warm); }
.camera-audio-controls span { max-width: 92px; overflow: hidden; color: var(--muted); font-size: 0.66rem; text-overflow: ellipsis; white-space: nowrap; }
.camera-night-vision-controls { gap: 3px; }
.camera-position-actions { flex: 1 1 280px; }
.camera-position-actions select { min-height: 38px; min-width: 120px; flex: 1; border: 0; border-radius: 9px; padding: 7px 30px 7px 10px; background: rgba(255,255,255,0.035); color: var(--white); font: inherit; font-size: 0.72rem; }
.camera-detection-panel { display: grid; width: 100%; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 7px; border-top: 1px solid var(--line); padding-top: 8px; }
.camera-detection-row { display: grid; min-height: 48px; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 7px; border: 1px solid var(--line); border-radius: 11px; background: var(--ink-raised); padding: 5px 7px; }
.camera-detection-row[hidden] { display: none; }
.camera-detection-label { display: flex; min-width: 0; align-items: center; gap: 8px; color: var(--muted); }
.camera-detection-label svg { width: 20px; height: 20px; flex: 0 0 auto; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.camera-detection-label strong { overflow: hidden; color: var(--white); font-size: 0.69rem; text-overflow: ellipsis; white-space: nowrap; }
.camera-detection-row select, .camera-detection-toggle, .camera-detection-edit, .camera-zone-actions button { min-height: 34px; border: 1px solid var(--line-strong); border-radius: 8px; background: rgba(255,255,255,0.025); padding: 5px 9px; color: var(--muted); cursor: pointer; font: inherit; font-size: 0.65rem; font-weight: 700; }
.camera-detection-row select { padding-right: 26px; }
.camera-detection-toggle[aria-pressed="true"] { border-color: color-mix(in srgb, var(--warm) 65%, var(--line)); background: var(--warm-soft); color: var(--warm); }
.camera-detection-row select:disabled, .camera-detection-toggle:disabled, .camera-detection-edit:disabled, .camera-zone-actions button:disabled { cursor: wait; opacity: 0.45; }
.camera-detection-edit { grid-column: 3; }
.camera-zone-editor { position: absolute; z-index: 5; inset: 0; background: rgba(0,0,0,0.12); }
.camera-zone-surface { position: absolute; inset: 0; cursor: crosshair; touch-action: none; }
.camera-zone-rectangle { position: absolute; box-sizing: border-box; border: 2px solid var(--warm); border-radius: 5px; background: color-mix(in srgb, var(--warm) 14%, transparent); box-shadow: 0 0 0 1px rgba(0,0,0,0.5); }
.camera-zone-rectangle.is-draft { pointer-events: none; }
.camera-zone-rectangle button { position: absolute; top: -12px; right: -12px; display: grid; width: 26px; height: 26px; place-items: center; border: 1px solid rgba(255,255,255,0.45); border-radius: 50%; padding: 0; background: rgba(10,12,14,0.9); color: var(--white); cursor: pointer; font: inherit; font-size: 1rem; line-height: 1; }
.camera-zone-actions { position: absolute; z-index: 2; right: 8px; bottom: 8px; left: 8px; display: flex; align-items: center; justify-content: flex-end; gap: 7px; border: 1px solid rgba(255,255,255,0.25); border-radius: 10px; background: rgba(10,12,14,0.9); padding: 7px 10px; backdrop-filter: blur(6px); }
.camera-zone-actions span { min-width: 0; flex: 1; color: var(--muted); font-size: 0.64rem; }
.camera-zone-actions button:last-child { border-color: color-mix(in srgb, var(--warm) 65%, var(--line)); background: var(--warm-soft); color: var(--warm); }
.camera-icon-button { position: relative; display: grid; width: 38px; height: 38px; flex: 0 0 auto; place-items: center; border: 1px solid transparent; border-radius: 10px; padding: 0; background: transparent; color: var(--muted); cursor: pointer; }
.camera-icon-button svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.camera-icon-button:hover { border-color: var(--line-strong); background: rgba(255,255,255,0.045); color: var(--white); }
.camera-icon-button[aria-pressed="true"] { border-color: color-mix(in srgb, var(--warm) 65%, var(--line)); background: var(--warm-soft); color: var(--warm); }
.camera-icon-button:disabled { cursor: wait; opacity: 0.45; }
.camera-danger-button:hover { border-color: rgba(241,140,136,0.55); color: #f18c88; }
.camera-icon-button::after { position: absolute; z-index: 8; bottom: calc(100% + 8px); left: 50%; width: max-content; max-width: 190px; transform: translate(-50%, 3px); border: 1px solid var(--line-strong); border-radius: 8px; padding: 6px 8px; background: #171b1e; box-shadow: 0 8px 22px rgba(0,0,0,0.36); color: var(--white); content: attr(data-tooltip); font-size: 0.63rem; font-weight: 650; line-height: 1.25; opacity: 0; pointer-events: none; transition: opacity 120ms ease, transform 120ms ease; white-space: normal; }
.camera-icon-button:hover::after, .camera-icon-button:focus-visible::after { transform: translate(-50%, 0); opacity: 1; }
.camera-icon-button:focus-visible, .camera-position-actions select:focus-visible { outline: 2px solid var(--warm); outline-offset: 2px; }
.camera-snapshot-button.is-captured { border-color: var(--healthy); background: color-mix(in srgb, var(--healthy) 45%, rgba(10,12,14,0.85)); }
.camera-quality-selector button:focus-visible, .camera-overlay-button:focus-visible, .camera-ptz-button:focus-visible { outline: 2px solid var(--warm); outline-offset: 2px; }
.camera-stage:fullscreen { width: 100vw; height: 100vh; aspect-ratio: auto; border-radius: 0; background: #000; }
.camera-stage:fullscreen canvas { width: 100vw; height: 100vh; }
.camera-view-button { margin: 18px 0; }
.camera-device-actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 18px 0; }
.room-light-summary { margin: 0 0 16px; color: var(--muted); font-size: 0.8rem; overflow-wrap: anywhere; }
.room-light-actions { display: flex; gap: 12px; margin-bottom: 22px; }
.room-light-grid { align-items: start; }
@media (max-width: 600px) { .control-dialog { width: calc(100vw - 16px); max-height: calc(100dvh - 16px); padding: 16px; } .control-dialog-heading { flex-wrap: wrap; } .control-dialog-heading h2 { font-size: 1.1rem; } }
@media (max-width: 600px) {
  .camera-view-toolbar { align-items: stretch; }
  .camera-quality-selector { gap: 2px; padding: 3px; }
  .camera-quality-selector button { min-height: 34px; padding: 6px 9px; font-size: 0.66rem; }
  .camera-control-panel { gap: 6px; padding: 6px; }
  .camera-audio-controls { flex-basis: 100%; }
  .camera-audio-controls span { display: none; }
  .camera-privacy-controls, .camera-night-vision-controls, .camera-patrol-actions, .camera-detection-controls { flex: 1 1 auto; justify-content: center; }
  .camera-position-actions { flex-basis: 100%; }
  .camera-detection-panel { grid-template-columns: 1fr; }
  .camera-zone-actions span { display: none; }
  .camera-icon-button::after { display: none; }
}
.light-controls { margin: 0 18px 16px; border-top: 1px solid var(--line); padding-top: 10px; }
.light-controls summary { cursor: pointer; color: var(--muted); font-size: 0.75rem; padding: 5px 0; }
.light-control-field { display: grid; grid-template-columns: 1fr auto; gap: 8px; margin-top: 16px; font-size: 0.73rem; }
.light-control-field output { color: var(--muted); font-size: 0.68rem; }
.light-control-field input { grid-column: 1 / -1; width: 100%; accent-color: var(--healthy); cursor: pointer; }
.light-control-field input:disabled { cursor: wait; opacity: 0.55; }
.light-control-field input:focus-visible { outline: 2px solid var(--warm); outline-offset: 4px; }
.light-mode-buttons, .light-white-presets { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.light-mode-buttons button, .light-white-presets button { flex: 0 1 auto; min-height: 38px; padding: 7px 12px; border: 1px solid var(--line-strong); border-radius: 12px; background: var(--ink-raised); color: var(--muted); cursor: pointer; font-size: 0.72rem; }
.light-mode-buttons button[aria-pressed="true"] { background: var(--slate); color: var(--white); }
.light-mode-buttons button:disabled, .light-white-presets button:disabled { opacity: 0.55; cursor: wait; }
.light-color-picker { grid-column: 1 / -1; display: grid; gap: 12px; }
.light-color-wheel { position: relative; width: min(100%, 210px); aspect-ratio: 1; border-radius: 50%; margin: 8px auto; touch-action: none; cursor: crosshair; background: radial-gradient(closest-side, white, transparent), conic-gradient(from 90deg, red, yellow, lime, cyan, blue, magenta, red); }
.light-color-thumb { position: absolute; width: 18px; height: 18px; border: 2px solid white; border-radius: 50%; transform: translate(-50%, -50%); box-shadow: 0 0 0 1px #101214, 0 2px 5px #101214; pointer-events: none; }
.light-color-axis { display: grid; grid-template-columns: 75px 1fr; align-items: center; gap: 8px; color: var(--muted); font-size: 0.68rem; }
.light-color-axis input { grid-column: 2; min-width: 0; }
.light-color-picker.is-busy .light-color-wheel { opacity: 0.55; cursor: wait; }
.light-control-field input[data-light-input="white"] { appearance: none; height: 20px; padding: 0; border: 0; border-radius: 12px; background: linear-gradient(90deg, #ffb969, #ffe0bc 35%, #fff7ed 65%, #d2e6ff); }
.light-control-field input[data-light-input="white"]::-webkit-slider-thumb { appearance: none; width: 26px; height: 26px; border: 3px solid var(--white); border-radius: 50%; background: var(--slate); box-shadow: 0 1px 4px #101214; }
.light-control-field input[data-light-input="white"]::-moz-range-thumb { width: 20px; height: 20px; border: 3px solid var(--white); border-radius: 50%; background: var(--slate); box-shadow: 0 1px 4px #101214; }
.light-mode-label { display: block; margin-top: 14px; color: var(--muted); font-size: 0.68rem; overflow-wrap: anywhere; }
.automation-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 18px; }
.automation-card { padding: 24px; }
.automation-card h3 { margin: 0 0 12px; }
.automation-card p, .automation-card small { color: var(--muted); }
.automation-card small { display: block; min-height: 2.5em; overflow-wrap: anywhere; }
.device-tile-spinner { display: none; width: 13px; height: 13px; border: 2px solid var(--line-strong); border-top-color: currentColor; border-radius: 50%; animation: device-state-spin 850ms linear infinite; }
.device-tile.is-pending .device-tile-spinner, .device-tile.is-loading .device-tile-spinner { display: block; }
@keyframes device-state-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .device-tile { transition: none; } .device-tile-spinner { animation: none; } }
.favorite-button { display: grid; width: 34px; height: 34px; place-items: center; border: 1px solid var(--line); border-radius: 50%; background: rgba(255,255,255,0.025); color: var(--muted); cursor: pointer; font-size: 1.15rem; line-height: 1; }
.favorite-button:hover, .favorite-button.is-favorite { border-color: rgba(242,184,75,0.45); background: var(--warm-soft); color: var(--warm); }
.favorite-button:disabled { cursor: wait; opacity: 0.55; }
.tile-controls { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 7px; }
.tile-control-button { min-height: 36px; padding: 0 8px; font-size: 0.67rem; }
.tile-control-status { grid-column: 1 / -1; min-height: 1rem; margin: 2px 0 0; overflow: hidden; color: var(--muted); font-size: 0.64rem; text-overflow: ellipsis; white-space: nowrap; }
.tile-control-status.is-success { color: var(--healthy); }
.tile-control-status.is-error { color: #f18c88; }
.management-disclosure { margin-top: 24px; }
.management-disclosure > summary { width: max-content; margin: 0 0 16px auto; border: 1px solid var(--line); border-radius: 999px; background: rgba(255,255,255,0.025); padding: 10px 15px; color: var(--muted); cursor: pointer; font-size: 0.72rem; font-weight: 750; list-style-position: inside; }
.management-disclosure[open] > summary { color: var(--white); }
.back-button { display: inline-flex; width: 48px; height: 48px; flex: 0 0 auto; align-items: center; justify-content: center; border: 0; border-radius: 50%; background: transparent; color: var(--muted); padding: 12px; cursor: pointer; }
.back-button:hover { color: var(--white); }
.back-button svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.back-button:dir(rtl) svg { transform: scaleX(-1); }
.back-button:focus-visible { outline: 2px solid var(--warm); outline-offset: 2px; }
.room-detail-intro { margin-top: 24px; }

.foundation-strip { display: grid; grid-template-columns: minmax(240px, 0.7fr) minmax(500px, 1.5fr); align-items: center; gap: 35px; margin-top: 18px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: linear-gradient(110deg, rgba(65,74,82,0.36), rgba(23,27,30,0.92)); padding: 29px; }
.progress-steps { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin: 0; padding: 0; list-style: none; }
.progress-steps li { position: relative; display: grid; justify-items: start; gap: 4px; color: var(--muted); }
.progress-steps li:not(:last-child)::after { position: absolute; top: 15px; left: 33px; right: 9px; height: 1px; background: var(--line-strong); content: ""; }
.progress-steps li > span { position: relative; z-index: 1; display: grid; width: 31px; height: 31px; place-items: center; border: 1px solid var(--line-strong); border-radius: 50%; background: var(--ink-raised); font-size: 0.7rem; font-weight: 800; }
.progress-steps li.is-complete > span { border-color: var(--healthy); background: var(--healthy); color: var(--ink); }
.progress-steps strong { margin-top: 5px; color: var(--white); font-size: 0.72rem; }
.progress-steps small { font-size: 0.64rem; }

.page-intro { margin: 18px 0 28px; }
.page-intro h2 { margin: 9px 0 8px; font-size: clamp(2.2rem, 5vw, 4.4rem); letter-spacing: -0.055em; line-height: 1; }
.page-intro > p:last-child { max-width: 650px; margin: 0; color: var(--muted); }
.management-grid { display: grid; grid-template-columns: minmax(350px, 0.72fr) minmax(420px, 1.28fr); align-items: start; gap: 18px; }
.management-grid.rooms-management { grid-template-columns: minmax(300px, 0.58fr) minmax(420px, 1.42fr); }
.management-form, .registry-panel { padding: clamp(22px, 3vw, 30px); }
.management-form { display: grid; gap: 18px; }
.form-heading h3 { margin: 6px 0 8px; font-size: 1.3rem; }
.form-heading > p:last-child { margin: 0; color: var(--muted); font-size: 0.78rem; line-height: 1.55; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 15px; }
.verification-box { display: grid; gap: 11px; border: 1px solid var(--line); border-radius: var(--radius-md); background: rgba(84,185,172,0.055); padding: 16px; }
.verification-box label { display: flex; align-items: flex-start; gap: 10px; color: var(--muted); font-size: 0.72rem; line-height: 1.45; cursor: pointer; }
.verification-box input { width: 17px; height: 17px; flex: 0 0 auto; margin: 1px 0 0; accent-color: var(--healthy); }
.registry-note { margin: 0; color: var(--muted); font-size: 0.7rem; line-height: 1.55; }
.candidate-preview { display: grid; gap: 9px; margin: 0; border: 1px solid var(--line); border-radius: var(--radius-md); background: rgba(84,185,172,0.055); padding: 16px; }
.candidate-preview[hidden] { display: none; }
.candidate-preview div { display: flex; justify-content: space-between; gap: 15px; font-size: 0.7rem; }
.candidate-preview dt { color: var(--muted); }
.candidate-preview dd { max-width: 64%; margin: 0; overflow-wrap: anywhere; text-align: right; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; }
.count-pill { display: grid; min-width: 34px; height: 34px; place-items: center; border: 1px solid var(--line); border-radius: 999px; background: rgba(255,255,255,0.03); color: var(--muted); font-size: 0.7rem; font-weight: 800; }
.registry-list { display: grid; gap: 11px; margin-top: 20px; }
.registry-item { display: grid; gap: 13px; border: 1px solid var(--line); border-radius: var(--radius-md); background: rgba(255,255,255,0.018); padding: 17px; }
.registry-item-head { display: flex; align-items: center; gap: 13px; }
.registry-item-icon { display: grid; width: 39px; height: 39px; flex: 0 0 auto; place-items: center; border-radius: 13px; background: rgba(104,115,125,0.15); color: var(--muted); }
.registry-item-icon svg { width: 20px; height: 20px; }
.registry-item-title { display: grid; min-width: 0; flex: 1; gap: 3px; }
.registry-item-name-row { display: flex; min-width: 0; align-items: center; gap: 10px; }
.registry-item-title strong { overflow: hidden; font-size: 0.84rem; text-overflow: ellipsis; white-space: nowrap; }
.registry-item-title small { color: var(--muted); font-size: 0.66rem; }
.rename-device-button { margin-left: auto; }
.rename-device-form { display: flex; width: 100%; align-items: center; gap: 7px; }
.rename-device-form input { min-width: 0; flex: 1; border: 1px solid var(--line-strong); border-radius: 8px; outline: 0; background: var(--ink); padding: 7px 9px; color: var(--white); font: inherit; }
.rename-device-form input:focus { border-color: var(--warm); box-shadow: 0 0 0 2px var(--warm-soft); }
.rename-device-cancel { color: var(--muted); }
.rename-device-message:empty { display: none; }
.rename-device-message.is-error { color: #f18c88; }
.device-facts { display: grid; gap: 7px; margin: 0; border-top: 1px solid var(--line); padding-top: 12px; }
.device-facts div { display: flex; justify-content: space-between; gap: 15px; font-size: 0.68rem; }
.device-facts dt { color: var(--muted); }
.device-facts dd { max-width: 66%; margin: 0; overflow-wrap: anywhere; text-align: right; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; }
.device-controls { display: grid; grid-template-columns: repeat(3, minmax(0, auto)); justify-content: start; align-items: center; gap: 8px; border-top: 1px solid var(--line); padding-top: 12px; }
.device-controls.is-unavailable { grid-template-columns: 1fr; }
.device-control-button { min-height: 36px; padding: 0 13px; font-size: 0.68rem; }
.device-control-status { grid-column: 1 / -1; min-height: 1rem; margin: 2px 0 0; color: var(--muted); font-size: 0.64rem; }
.device-control-status.is-success { color: var(--healthy); }
.device-control-status.is-error { color: #f18c88; }
.room-assignment { display: grid; grid-template-columns: 1fr auto; align-items: end; gap: 10px; }
.room-assignment .form-field > span { font-size: 0.64rem; }
.room-assignment select { min-height: 40px; }
.assignment-status { min-height: 1rem; margin: 0; color: var(--muted); font-size: 0.64rem; }
.assignment-status.is-error { color: #f18c88; }
.assignment-status.is-success { color: var(--healthy); }
.room-empty { min-height: 380px; border: 0; background: transparent; }
.room-list .room-card { grid-template-columns: minmax(0, 1fr) auto; align-items: center; padding: 0; color: var(--white); }
.room-card-open { display: grid; width: 100%; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 13px; border: 0; background: transparent; padding: 17px; color: var(--white); cursor: pointer; text-align: left; }
.room-card-open:hover { background: rgba(255,255,255,0.045); }
.rename-room-button { margin-right: 17px; }
.rename-room-form { grid-column: 1 / -1; margin: 17px; }
.rename-room-message { flex-basis: 100%; }
.large-empty { display: grid; min-height: 480px; place-items: center; align-content: center; text-align: center; padding: 50px 24px; }
.large-empty h3 { margin: 0 0 10px; font-size: 1.45rem; }
.large-empty p { max-width: 510px; margin: 0 0 24px; color: var(--muted); line-height: 1.65; }
.planned-action { display: inline-flex; min-height: 35px; align-items: center; border: 1px solid var(--line); border-radius: 999px; background: rgba(255,255,255,0.025); padding: 0 13px; color: var(--muted); font-size: 0.68rem; font-weight: 750; }
.room-illustration { position: relative; display: block; width: 130px; height: 105px; margin-bottom: 38px; border: 2px solid var(--slate-light); border-top: 0; }
.room-illustration::before { position: absolute; top: -53px; left: 12px; width: 90px; height: 90px; border-top: 2px solid var(--slate-light); border-left: 2px solid var(--slate-light); transform: rotate(45deg); content: ""; }
.room-illustration i { position: absolute; right: 19px; bottom: 0; width: 36px; height: 58px; border: 2px solid var(--warm); border-bottom: 0; }
.room-illustration b { position: absolute; top: 32px; left: 20px; width: 31px; height: 28px; border: 2px solid var(--slate-light); }

.settings-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.settings-card { display: grid; min-height: 235px; grid-template-columns: auto 1fr; align-items: start; gap: 19px; padding: 27px; }
.settings-card h3 { margin: 7px 0 10px; font-size: 1.2rem; }
.settings-card p:not(.eyebrow) { margin: 0 0 20px; color: var(--muted); font-size: 0.82rem; line-height: 1.6; }
.settings-card dl { margin: 21px 0 0; }
.settings-card dl div { display: flex; justify-content: space-between; gap: 15px; border-top: 1px solid var(--line); padding: 11px 0; font-size: 0.74rem; }
.settings-card dt { color: var(--muted); }
.settings-card dd { margin: 0; font-weight: 750; }
.google-home-card { grid-column: 1 / -1; }
.google-setup-form { display: flex; align-items: end; gap: 12px; }
.google-setup-form .form-field { flex: 1; }
.google-secret { margin: 16px 0; border: 1px solid rgba(230,174,60,0.38); border-radius: var(--radius-md); background: rgba(230,174,60,0.08); padding: 16px; }
.google-secret > strong { color: var(--warm); font-size: 0.78rem; }
.google-secret p { margin: 5px 0 12px !important; }
.google-secret input, .google-endpoints dd { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; overflow-wrap: anywhere; }
.google-endpoints div { align-items: start; }
.google-endpoints dd { max-width: 70%; text-align: right; }
.google-device-heading { display: flex; justify-content: space-between; gap: 12px; margin-top: 23px; border-top: 1px solid var(--line); padding-top: 18px; }
.google-device-heading strong { font-size: 0.78rem; }
.google-device-heading small { color: var(--muted); font-size: 0.66rem; }
.google-device-list { display: grid; gap: 8px; margin-top: 12px; }
.google-device-row { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 16px; border: 1px solid var(--line); border-radius: 13px; padding: 12px 14px; }
.google-device-row > span { display: grid; gap: 3px; }
.google-device-row strong { font-size: 0.76rem; }
.google-device-row small { color: var(--muted); font-size: 0.64rem; }
.google-device-toggle { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 0.68rem; }
.google-device-toggle input { width: 19px; height: 19px; accent-color: var(--healthy); }
.oauth-body { min-height: 100vh; background: var(--ink); }
.oauth-shell { display: grid; width: min(520px, calc(100% - 32px)); min-height: 100vh; margin: auto; align-content: center; gap: 24px; padding: 32px 0; }
.oauth-card { width: 100%; }
.oauth-owner { display: grid; gap: 4px; border: 1px solid var(--line); border-radius: var(--radius-md); background: rgba(255,255,255,0.025); padding: 15px; }
.oauth-owner small { color: var(--muted); }
.oauth-actions { display: flex; flex-wrap: wrap; gap: 10px; }

.site-footer { display: flex; justify-content: space-between; gap: 20px; max-width: 1500px; margin: 35px auto 0; border-top: 1px solid var(--line); padding: 24px 3px 0; color: var(--muted); font-size: 0.66rem; }
.mobile-nav { display: none; }

@media (max-width: 1180px) {
  .side-rail { width: 94px; align-items: center; padding-inline: 14px; }
  .brand { padding-inline: 0; }
  .brand-copy, .rail-foot > span:last-child, .rail-nav .nav-item span { display: none; }
  .rail-nav .nav-item { width: 55px; justify-content: center; padding: 0; }
  .rail-foot { padding-inline: 14px; }
  .main-content { margin-left: 94px; }
  .summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .foundation-strip { grid-template-columns: 1fr; }
}

@media (max-width: 840px) {
  body { background: var(--ink); }
  .side-rail { display: none; }
  .main-content { margin-left: 0; padding: 22px 18px 110px; }
  .top-bar { margin-bottom: 22px; }
  .top-bar h1 { font-size: 1.38rem; }
  .controller-pill { width: 42px; justify-content: center; padding: 0; }
  .controller-pill > span:last-child { display: none; }
  .avatar-placeholder { width: 40px; height: 40px; }
  .summary-grid, .content-grid, .settings-grid { grid-template-columns: 1fr; }
  .management-grid, .management-grid.rooms-management { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .summary-card { min-height: 115px; }
  .foundation-strip { display: block; }
  .progress-steps { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px 12px; margin-top: 26px; }
  .progress-steps li:nth-child(2)::after { display: none; }
  .settings-card { min-height: 0; }
  .google-setup-form { align-items: stretch; flex-direction: column; }
  .mobile-nav { position: fixed; inset: auto 10px 10px; z-index: 30; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(70px, 1fr); overflow-x: auto; border: 1px solid var(--line-strong); border-radius: 21px; background: rgba(23,27,30,0.94); padding: 7px; box-shadow: 0 20px 50px rgba(0,0,0,0.55); backdrop-filter: blur(22px); }
  .mobile-nav .nav-item { display: grid; min-height: 57px; justify-items: center; align-content: center; gap: 4px; border-radius: 15px; padding: 0 2px; }
  .mobile-nav .nav-item svg { width: 1.18rem; height: 1.18rem; }
  .mobile-nav .nav-item span { font-size: 0.56rem; }
  .site-footer { display: grid; }
  .auth-form { grid-template-columns: 1fr; }
  .full-width { grid-column: auto; }
  .auth-screen { padding-top: 25px; }
  .auth-brand { justify-content: flex-start; width: min(460px, 100%); margin-inline: auto; }
  .setup-code-help code { white-space: normal; overflow-wrap: anywhere; }
}

@media (max-width: 600px) {
  .main-content { padding-inline: 12px; }
  .device-group { padding: 12px; }
  .device-group-heading { gap: 10px; margin-bottom: 12px; }
  .device-group-heading > button { font-size: 1.1rem; }
  .device-group-heading span { flex-shrink: 0; }
  .device-tile-grid, .home-favorite-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .device-tile { min-height: 140px; border-radius: 20px; }
  .device-tile-toggle { position: relative; grid-template-columns: minmax(0, 1fr); grid-template-rows: 30px auto; align-content: start; align-items: start; gap: 12px; min-height: 140px; padding: 12px 12px 18px; }
  .device-tile-icon { width: 28px; height: 28px; }
  .device-tile-title strong { font-size: 0.82rem; }
  .device-tile-title small { font-size: 0.72rem; overflow-wrap: anywhere; }
  .device-tile > .device-info-button { top: 8px; right: 8px; width: 30px; height: 30px; }
  .device-tile > .favorite-button { top: 8px; right: 44px; width: 30px; height: 30px; }
  .device-tile > .room-lights-open { transform: none; }
  .device-tile-spinner { position: absolute; left: 44px; top: 17px; }
  .light-controls { margin-inline: 12px; }
  .device-tile-grid > .device-tile:has(> .light-controls[open]),
  .home-favorite-grid > .device-tile:has(> .light-controls[open]) { grid-column: 1 / -1; }
}

@media (max-width: 470px) {
  .content-grid .panel, .settings-card { padding: 22px; }
  .settings-card { grid-template-columns: 1fr; }
  .empty-state.compact { align-items: flex-start; }
  .mobile-nav .nav-item span { font-size: 0.5rem; }
}

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

.notification-stack {
  position: fixed;
  right: 1.25rem;
  bottom: 1.25rem;
  z-index: 80;
  display: grid;
  gap: .65rem;
  width: min(22rem, calc(100vw - 2.5rem));
}

.camera-notification {
  display: grid;
  gap: .2rem;
  padding: 1rem 1.15rem;
  color: var(--white);
  text-align: left;
  background: var(--ink-raised);
  border: 1px solid var(--line-strong);
  border-radius: 1rem;
  box-shadow: var(--shadow);
}

.camera-notification span,
.activity-event div span,
.activity-event time { color: var(--muted); }

.activity-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1rem; }

.activity-event {
  display: grid;
  overflow: hidden;
  gap: 0;
  border: 1px solid var(--line);
  padding: 0;
  color: var(--white);
  text-align: left;
  cursor: pointer;
  font: inherit;
}

.activity-event:hover { border-color: var(--line-strong); transform: translateY(-1px); }
.activity-event-preview { display: grid; width: 100%; aspect-ratio: 16 / 9; place-items: center; overflow: hidden; background: #080a0b; }
.activity-event-preview img { width: 100%; height: 100%; object-fit: cover; }
.activity-event-preview svg { width: 38px; height: 38px; fill: none; stroke: var(--muted); stroke-width: 1.6; }
.activity-event > div { display: grid; gap: .2rem; padding: 1rem 1.1rem 1.1rem; }
.activity-event time { font-size: .68rem; }
.activity-event-clip-state { margin-top: .25rem; font-size: .66rem; }

.camera-event-player { display: grid; gap: 12px; }
.camera-event-player > img { display: block; width: 100%; aspect-ratio: 16 / 9; border-radius: 18px; background: #000; object-fit: contain; }
.camera-event-player-details { display: grid; gap: 3px; }
.camera-event-player-details time,
.camera-event-player-details span { color: var(--muted); font-size: .72rem; }
.camera-event-player-controls { display: flex; align-items: center; gap: 14px; }
.camera-event-player-controls progress { width: 100%; height: 8px; flex: 1; accent-color: var(--warm); }

.thermostat-controls { padding: 0 1rem 1rem; display: grid; gap: .75rem; }
.thermostat-controls[hidden] { display: none; }
.thermostat-controls p { margin: 0; font-size: .85rem; color: var(--muted); }
.thermostat-setpoints { display: grid; gap: .75rem; }

/* Shared compact catalog and independently scrolling device controls. */
.compact-device-catalog { grid-template-columns: repeat(auto-fill, minmax(min(250px, 100%), 1fr)); align-items: start; gap: 14px; }
.compact-device-view .page-intro { margin-bottom: 20px; }
.compact-device-view .page-intro h2 { font-size: clamp(2rem, 3.5vw, 3rem); }
.device-card-room { color: var(--muted); font-size: .65rem; line-height: 1.3; }
.device-control-launcher { display: flex; align-items: center; min-height: 40px; margin: 0 16px 6px; padding: 7px 0; border: 0; border-top: 1px solid var(--line); background: transparent; color: var(--muted); text-align: left; cursor: pointer; font-size: .75rem; }
.device-control-launcher:hover { color: var(--white); }
.device-detail-panel { position: fixed; z-index: 100; inset: 16px 16px 16px auto; width: 420px; height: calc(100dvh - 32px); max-height: calc(100dvh - 32px); margin: 0; padding: 0; display: none; grid-template-rows: auto minmax(0, 1fr); overflow: hidden; box-shadow: var(--shadow); }
.device-detail-panel[open] { display: grid; }
.device-detail-panel::backdrop { background: transparent; }
.device-detail-heading { display: flex; align-items: center; gap: 12px; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.device-detail-heading > div { flex: 1; min-width: 0; }
.device-detail-heading h2 { margin: 3px 0 0; font-size: 1.1rem; overflow-wrap: anywhere; }
.device-detail-heading small { color: var(--muted); font-size: .7rem; }
[data-device-controls-content] { min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 14px; }
.device-detail-panel .device-tile { min-height: 0; border: 0; border-radius: 0; background: transparent; }
.device-detail-panel .device-tile-toggle { min-height: 58px; grid-template-columns: 28px minmax(0, 1fr) auto; grid-template-rows: auto; align-content: center; align-items: center; gap: 12px; padding: 12px 46px 12px 0; }
.device-detail-panel .device-tile-title strong { display: none; }
.device-detail-panel .device-tile > .device-info-button { top: 12px; right: 0; }
.device-detail-panel .thermostat-controls, .device-detail-panel .blind-controls { padding: 12px 0 0; }
.device-detail-panel .compact-button { width: auto; min-height: 38px; margin: 0; padding: 8px 12px; justify-self: start; }
.control-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.device-detail-panel .thermostat-setpoints { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: end; gap: 12px; }
.device-detail-panel .thermostat-setpoints > button, .device-detail-panel .thermostat-setpoints > .full-width { grid-column: 1 / -1; }
.device-detail-panel .form-field { min-width: 0; }
.device-detail-panel .form-field input:not([type="checkbox"]):not([type="radio"]), .device-detail-panel .form-field select { min-height: 38px; padding: 6px 10px; border-radius: 9px; }
.device-detail-panel .thermostat-controls > .form-field { max-width: 200px; }
.device-detail-panel .thermostat-controls > details { margin-top: 4px; padding-top: 12px; border-top: 1px solid var(--line); }
.device-detail-panel .thermostat-controls > details > summary { cursor: pointer; font-weight: 700; font-size: .85rem; margin-bottom: 10px; }
.device-detail-panel .humidifier-settings { margin-top: 12px; }
.device-detail-panel .light-controls { margin: 0; padding-top: 12px; }
.device-detail-panel .light-controls > summary { display: none; }
.device-detail-panel .blind-actions .compact-button { flex: 0 1 auto; }
.device-detail-panel .light-mode-buttons, .device-detail-panel .light-white-presets { flex-wrap: wrap; }
.device-detail-panel .light-white-presets button { flex: 0 1 auto; padding: 8px 12px; }
@media (min-width: 1200px) {
  body.has-device-controls .main-content { padding-right: 456px; }
  body.has-device-controls .compact-device-catalog { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  body.has-device-controls [data-control-dialog][open] { width: min(880px, calc(100vw - 480px)); margin-right: 456px; }
}
@media (max-width: 1199px) {
  .device-detail-panel { inset: auto 8px 8px; width: calc(100vw - 16px); height: min(600px, 60dvh); max-height: 60dvh; border-radius: 22px 22px 16px 16px; }
}
@media (max-width: 600px) {
  .compact-device-catalog { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .compact-device-catalog .device-tile { min-height: 124px; }
  .compact-device-catalog .device-tile-toggle { min-height: 124px; grid-template-columns: 24px minmax(0, 1fr) auto; grid-template-rows: auto; align-content: center; align-items: center; gap: 8px; padding: 12px 40px 12px 10px; }
  .compact-device-catalog .device-tile-icon { width: 24px; }
  .compact-device-catalog .device-tile-title strong { font-size: .78rem; }
  .compact-device-catalog .device-tile-title small { font-size: .7rem; }
  .compact-device-catalog .device-tile > .device-info-button, .compact-device-catalog .device-tile > .favorite-button { right: 7px; }
  .compact-device-catalog .device-tile > .favorite-button { top: 48px; }
  .device-detail-heading { padding: 10px 14px; }
  [data-device-controls-content] { padding: 10px 14px; }
}
[data-nest-redirect], [data-nest-devices] { overflow-wrap: anywhere; }
/* Android opens the shared camera/climate controls without a second dashboard. */
.embedded-device [data-app-shell] { visibility: hidden; }
.embedded-device .control-dialog { width: 100%; max-width: 100%; height: 100%; max-height: 100%; margin: 0; border: 0; border-radius: 0; }
.embedded-device [data-dialog-close], .embedded-device [data-dialog-back] { display: none; }
.embedded-device .device-detail-panel { inset: 0; width: 100%; height: 100dvh; max-height: 100dvh; }
.embedded-device [data-controls-close] { display: none; }
.camera-stage video { display: block; width: 100%; height: 100%; object-fit: contain; background: #000; }
.liam-card { padding: 24px; margin: 16px 0; }
.liam-card h3 { margin-top: 0; }
.liam-card input, .liam-card select, .liam-card textarea { width: 100%; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--ink-raised); color: var(--white); font: inherit; }
.liam-card .form-field { margin: 12px 0; }
.liam-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 12px 0; }
.liam-row input, .liam-row span { flex: 1; min-width: 150px; }
.liam-item { padding: 16px 0; border-bottom: 1px solid var(--line); }
.liam-item p { color: var(--muted); }
.embedded-household .side-rail, .embedded-household .mobile-nav, .embedded-household .top-bar, .embedded-household .site-footer { display: none; }
.embedded-household .app-shell { display: block; min-height: 0; }
.embedded-household .main-content { margin: 0; padding: 16px; }

/* Shared Android camera list. Streams stay active while this screen is open. */
.embedded-cameras [data-app-shell] { display: none; }
.camera-preview-list { padding: 16px 4px 24px; }
.camera-preview-list > h2 { margin: 0 0 18px; font-size: 1.8rem; }
.camera-preview-room { margin-bottom: 24px; }
.camera-preview-room > h3 { margin: 0 0 12px; font-size: 1.15rem; }
.camera-preview-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(240px, 100%), 1fr)); gap: 16px; }
.camera-preview-card { position: relative; overflow: hidden; border: 1px solid var(--line); border-radius: 20px; background: var(--ink-raised); }
.camera-preview-open { display: block; color: var(--white); text-decoration: none; }
.camera-preview-open:focus-visible { outline: 2px solid var(--warm); outline-offset: -2px; }
.camera-preview-open h4 { margin: 0; padding: 14px 58px 14px 14px; font-size: 1rem; }
.camera-preview-card > .favorite-button { position: absolute; right: 8px; bottom: 5px; }
.camera-preview-stage { position: relative; aspect-ratio: 16 / 9; background: #000; }
.camera-preview-stage video, .camera-preview-stage canvas { display: block; width: 100%; height: 100%; object-fit: cover; }
.camera-preview-stage [hidden] { display: none; }
.camera-preview-status { position: absolute; bottom: 10px; left: 10px; padding: 5px 9px; border-radius: 12px; color: var(--white); background: rgba(0, 0, 0, .7); font-size: .75rem; }
[data-preview-state="live"] .camera-preview-status::before { content: ""; display: inline-block; width: 6px; height: 6px; margin-right: 6px; border-radius: 50%; background: var(--healthy); }
[data-preview-state="unavailable"] .camera-preview-stage video, [data-preview-state="unavailable"] .camera-preview-stage canvas { opacity: .35; }

.blind-controls { padding: 12px; display: grid; gap: 12px; }
.device-tile.has-expanded-blind-controls { grid-column: 1 / -1; }
.blind-controls[hidden] { display: none; }
.blind-controls input[type="range"] { width: 100%; accent-color: var(--warm); }
.blind-controls output, .blind-controls p { font-size: .82rem; overflow-wrap: anywhere; }
.blind-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.blind-preset-row { display: grid; grid-template-columns: minmax(0, 1fr) 80px auto; gap: 6px; margin: 8px 0; }
.blind-preset-row input { min-width: 0; width: 100%; box-sizing: border-box; padding: 10px; border: 1px solid var(--line-strong); border-radius: 12px; background: var(--ink); color: var(--white); font: inherit; }
.blind-customization summary { cursor: pointer; }
.blind-customization .security-form { margin-top: 12px; }
.blind-controls > p { margin: 0; }
/* Expanded grid media stays in the same WebView and uses its native safe area. */
.embedded-cameras .control-dialog {
  box-sizing: border-box;
  width: 100%; max-width: 100%; height: 100%; max-height: 100dvh;
  margin: 0; border: 0; border-radius: 0; padding: 12px;
}
/* Shared Liam activity card; motion is decorative and never a completion percentage. */
.liam-job-progress {
  position: fixed; z-index: 10020; right: max(20px, env(safe-area-inset-right));
  bottom: max(20px, env(safe-area-inset-bottom)); width: max-content;
  box-sizing: border-box; max-width: min(440px, calc(100vw - 40px));
  display: flex; align-items: center; gap: 14px; padding: 16px;
  color: var(--white); background: linear-gradient(145deg, rgba(31,36,40,.92), rgba(23,27,30,.88));
  border: 1px solid var(--line); border-radius: 24px;
  box-shadow: 0 8px 28px rgba(0,0,0,.22); backdrop-filter: blur(18px);
  animation: liam-progress-enter 180ms ease-out both;
}
.liam-progress-copy { min-width: 0; display: flex; flex-direction: column; gap: 4px; overflow-wrap: anywhere; }
.liam-progress-title { font-size: 15px; font-weight: 600; line-height: 1.4; }
.liam-progress-detail { color: var(--muted); font-size: 13px; line-height: 1.45; }
.liam-activity-wave { flex: 0 0 64px; width: 64px; height: 28px; overflow: hidden; }
.liam-activity-wave svg { display: block; width: 64px; height: 28px; stroke: url(#liam-wave-amber); stroke-width: 2.5; fill: none; }
.liam-activity-wave g { animation: liam-wave-flow 1.8s linear infinite; }
.liam-job-progress[hidden], .liam-progress-detail[hidden] { display: none; }
@keyframes liam-wave-flow { to { transform: translateX(-24px); } }
@keyframes liam-progress-enter { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .liam-job-progress, .liam-activity-wave g { animation: none; } }
@media (prefers-reduced-transparency: reduce) { .liam-job-progress { background: #171b1e; backdrop-filter: none; } }

/* Shared digital camera viewport. Controls remain outside the transformed image. */
.camera-zoom-viewport { position:absolute; inset:0; overflow:hidden; touch-action:none; user-select:none; -webkit-user-select:none; }
.camera-zoom-viewport > canvas, .camera-zoom-viewport > video { transform-origin:center center; will-change:transform; width:100%; height:100%; }
.camera-zoom-reset { position:absolute; top:12px; right:12px; width:auto; min-width:44px; height:44px; padding:0 10px; font-size:14px; z-index:3; }
.camera-zoom-reset[aria-disabled="true"] { opacity:.65; }

/* Shared app/web camera navigation keeps a visible Back action. Video owns the entire viewport;
   compact controls float above it without reserving rows or side gutters. */
body .control-dialog.camera-dialog[open] { position:fixed;inset:0;box-sizing:border-box;width:100%;max-width:none;height:100dvh;max-height:none;margin:0;padding:0;border:0;border-radius:0;overflow:hidden;background:#000; }
.camera-dialog > .control-dialog-heading { display:none; }
.camera-dialog > [data-dialog-content], .camera-dialog .camera-view, .camera-dialog .camera-stage { position:relative;width:100%;height:100%;margin:0;padding:0;border:0;border-radius:0;aspect-ratio:auto; }
.camera-floating-title, .camera-floating-status { position:absolute;z-index:3;pointer-events:none;max-width:calc(100% - 120px);margin:0;padding:10px 16px;background:rgba(16,18,20,.78);color:var(--white);border:1px solid var(--line);border-radius:20px;backdrop-filter:blur(14px); }
.camera-floating-title { top:max(12px,env(safe-area-inset-top));left:max(12px,env(safe-area-inset-left));font-weight:600;font-size:16px; }
.camera-floating-status { bottom:max(16px,env(safe-area-inset-bottom));left:50%;transform:translateX(-50%);font-size:13px;text-align:center; }
.camera-settings-toggle { position:absolute;top:max(12px,env(safe-area-inset-top));right:72px;z-index:4; }
.camera-floating-settings { position:absolute;z-index:5;bottom:80px;left:16px;right:16px;max-height:45%;overflow:auto;overscroll-behavior:contain;background:rgba(23,27,30,.94);border:1px solid var(--line);border-radius:20px;padding:12px;backdrop-filter:blur(14px); }
.camera-floating-settings[hidden] { display:none; }
@media (prefers-reduced-transparency:reduce) { .camera-floating-title,.camera-floating-status,.camera-floating-settings { background:#171b1e;backdrop-filter:none; } }

.camera-native-presentation .camera-fullscreen-button { display:none; }

.camera-dialog .camera-overlay-actions { top:auto;bottom:max(14px,env(safe-area-inset-bottom)); }

.camera-back-button { position:absolute;z-index:4;left:max(12px,env(safe-area-inset-left));top:max(12px,env(safe-area-inset-top)); }
.camera-back-button[hidden] { display:none; }
.camera-floating-title.has-camera-back { left:max(68px,calc(env(safe-area-inset-left) + 56px));max-width:calc(100% - 190px); }

/* Shared household photo library: compact controls and responsive pictures. */
.photo-library { max-width: 1200px; }
.photo-library-toolbar { display:flex; flex-wrap:wrap; align-items:center; gap:12px; margin:16px 0; }
.photo-library input[type=text], .photo-library select { color:#f5f6f7; background:#171b1e; border:1px solid #454c52; border-radius:10px; padding:10px 12px; max-width:100%; }
.photo-library-toolbar input[type=text] { width:210px; }
.photo-library-toolbar select { min-width:180px; }
.photo-message { min-height:24px; margin:8px 0; overflow-wrap:anywhere; }
.photo-message.is-error { color:#ef9b98; }
.photo-album-choices { display:flex; flex-wrap:wrap; gap:12px 20px; align-items:center; margin:20px 0; }
.photo-check { display:inline-flex; align-items:center; gap:9px; min-height:44px; }
.photo-check input { accent-color:#f2b84b; width:19px; height:19px; flex-shrink:0; }
.photo-frame-settings { margin:16px 0 24px; padding:12px 16px; border:1px solid #353b40; border-radius:14px; background:rgba(23,27,30,.6); }
.photo-frame-settings summary { cursor:pointer; min-height:32px; }
.photo-frame-settings .photo-check { display:flex; }
.photo-frame-settings select { margin-left:10px; }
.photo-library progress { width:min(100%,440px); accent-color:#f2b84b; }
.photo-grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(260px,1fr)); gap:20px; margin:20px 0; }
.photo-tile { min-width:0; background:#171b1e; border:1px solid #353b40; border-radius:16px; overflow:hidden; }
.photo-tile img { width:100%; height:225px; object-fit:contain; background:#101214; }
.photo-name { padding:12px 14px 4px; font-size:14px; overflow:hidden; white-space:nowrap; text-overflow:ellipsis; }
.photo-actions { display:flex; flex-wrap:wrap; align-items:center; gap:8px; padding:10px 12px 14px; }
.photo-actions :is(button,a) { width:auto; min-height:44px; padding:8px 12px; font-size:13px; text-decoration:none; }
.photo-actions button[aria-pressed=true] { color:#f2b84b; }
.photo-hidden { display:block; padding:0 14px 12px; color:#aeb6bd; font-size:13px; }
.photo-empty { padding:24px; border:1px dashed #454c52; border-radius:14px; color:#aeb6bd; }
@media(max-width:600px) { .photo-grid {grid-template-columns:1fr;} .photo-library-toolbar {gap:10px;} .photo-library-toolbar input[type=text] {flex:1;min-width:140px;} }

/* Shared app/web camera navigation keeps a visible Back action. Video owns the entire viewport;
   compact controls float above it without reserving rows or side gutters. */
body .control-dialog.camera-dialog[open] { position:fixed;inset:0;box-sizing:border-box;width:100%;max-width:none;height:100dvh;max-height:none;margin:0;padding:0;border:0;border-radius:0;overflow:hidden;background:#000; }
.camera-dialog > .control-dialog-heading { display:none; }
.camera-dialog > [data-dialog-content], .camera-dialog .camera-view, .camera-dialog .camera-stage { position:relative;width:100%;height:100%;margin:0;padding:0;border:0;border-radius:0;aspect-ratio:auto; }
.camera-floating-title, .camera-floating-status { position:absolute;z-index:3;pointer-events:none;max-width:calc(100% - 120px);margin:0;padding:10px 16px;background:rgba(16,18,20,.78);color:var(--white);border:1px solid var(--line);border-radius:20px;backdrop-filter:blur(14px); }
.camera-floating-title { top:max(12px,env(safe-area-inset-top));left:max(12px,env(safe-area-inset-left));font-weight:600;font-size:16px; }
.camera-floating-status { bottom:max(16px,env(safe-area-inset-bottom));left:50%;transform:translateX(-50%);font-size:13px;text-align:center; }
.camera-settings-toggle { position:absolute;top:max(12px,env(safe-area-inset-top));right:72px;z-index:4; }
.camera-floating-settings { position:absolute;z-index:5;bottom:80px;left:16px;right:16px;max-height:45%;overflow:auto;overscroll-behavior:contain;background:rgba(23,27,30,.94);border:1px solid var(--line);border-radius:20px;padding:12px;backdrop-filter:blur(14px); }
.camera-floating-settings[hidden] { display:none; }
@media (prefers-reduced-transparency:reduce) { .camera-floating-title,.camera-floating-status,.camera-floating-settings { background:#171b1e;backdrop-filter:none; } }

.camera-native-presentation .camera-fullscreen-button { display:none; }

.camera-dialog .camera-overlay-actions { top:auto;bottom:max(14px,env(safe-area-inset-bottom)); }
.photo-library .primary-button { background:#f2b84b; color:#101214; }
.photo-library :is(.primary-button,.secondary-button) { font-weight:600; font-size:14px; min-height:44px; padding:10px 14px; }

.camera-back-button { position:absolute;z-index:4;left:max(12px,env(safe-area-inset-left));top:max(12px,env(safe-area-inset-top)); }
.camera-back-button[hidden] { display:none; }
.camera-floating-title.has-camera-back { left:max(68px,calc(env(safe-area-inset-left) + 56px));max-width:calc(100% - 190px); }

/* Compact photo library organization controls. */
.photo-upload-target { margin:8px 0; overflow-wrap:anywhere; }
.photo-organize { margin:14px 0; }
.photo-organize summary { cursor:pointer; min-height:32px; }

/* Personal-photo motion previews. */
.photo-motion-help { font-size:13px; line-height:1.5; max-width:78ch; }
.photo-motion-preview { padding:0 12px 12px; }
.photo-motion-preview summary { cursor:pointer; min-height:44px; display:flex; align-items:center; color:#f2b84b; font-size:13px; }
.photo-motion-preview video { display:block; width:100%; max-height:300px; background:#101214; object-fit:contain; border-radius:8px; }
.photo-motion-preview a { display:inline-flex; margin-top:8px; font-size:13px; }

/* Compact photo-library browsing guidance. */
.photo-motion-help { margin:8px 0; }
.photo-motion-help summary { cursor:pointer; min-height:44px; line-height:44px; }
.photo-motion-help p { margin:0 0 12px; }
.photo-scope-summary { overflow-wrap:anywhere; }

/* Shared Hub presentation: charcoal surfaces, amber actions, teal voice feedback. */
body.portable-hub-mode { margin:0; overflow:hidden; background:#000; }
html.hub-native-motion, .hub-native-motion body.portable-hub-mode, .hub-native-motion .portable-hub { background:transparent!important; }
body.portable-hub-mode > :not(.portable-hub) { visibility:hidden!important; pointer-events:none!important; }
body.portable-hub-mode > [data-control-dialog][open] { visibility:visible!important; pointer-events:auto!important; }
.camera-grid-dialog [data-dialog-content] { width:100%;height:100%; }
.camera-mosaic { position:relative;width:100%;height:100%;overflow:hidden;background:#000;touch-action:none;color:#f5f6f7; }
.camera-mosaic-pane { position:absolute;box-sizing:border-box;overflow:hidden;border:1px solid #000;background:#000; }
.camera-mosaic-pane video,.camera-mosaic-pane canvas { width:100%;height:100%;object-fit:contain;display:block; }
.camera-mosaic-pane [hidden] { display:none!important; }
.camera-mosaic-name,.camera-mosaic-status { position:absolute;left:8px;max-width:calc(100% - 24px);padding:4px 8px;border-radius:10px;background:#101214ad;color:#f5f6f7;font:13px/1.3 Roboto,Arial,sans-serif;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;pointer-events:none; }
.camera-mosaic-name { top:8px; }
.camera-mosaic-status { bottom:8px; }
.camera-mosaic-pane[data-preview-state=live] .camera-mosaic-status { display:none; }
.camera-mosaic-close { position:absolute;right:12px;top:12px;width:44px;height:44px;padding:0;border:1px solid #f5f6f733;border-radius:50%;background:#101214b8;color:#fff;font:26px/1 Roboto,Arial,sans-serif;cursor:pointer;z-index:2; }

.portable-hub { --hub-ink:#101214; --hub-raised:#171b1e; --hub-white:#f5f6f7; --hub-muted:#aeb6bd; --hub-amber:#f2b84b; --hub-teal:#54b9ac; position:fixed; inset:0; z-index:10000; overflow:hidden; background:#000; color:var(--hub-white); font-family:Roboto,Arial,sans-serif; touch-action:none; user-select:none; -webkit-user-select:none; }
.portable-hub [hidden] { display:none!important; }
.hub-frame { display:block; width:100%; height:100%; }
.hub-weather-icon { position:absolute; pointer-events:none; object-fit:contain; }
.hub-panel { position:absolute; inset:0; padding:max(22px,env(safe-area-inset-top)) max(24px,env(safe-area-inset-right)) max(24px,env(safe-area-inset-bottom)) max(24px,env(safe-area-inset-left)); overflow:auto; overscroll-behavior:contain; background:rgba(16,18,20,.97); touch-action:pan-y; }
.hub-panel h1 { font-size:clamp(25px,3.7vw,40px); font-weight:500; margin:18px 0 9px; line-height:1.2; }
.hub-panel p { max-width:48em; line-height:1.45; }
.hub-detail { font-size:14px; color:var(--hub-muted); }
.hub-row { display:flex; align-items:center; flex-wrap:wrap; gap:8px; margin:12px 0; }
.portable-hub .hub-button { flex:0 1 auto; width:auto; min-width:44px; min-height:48px; margin:0; padding:9px 17px; border:1px solid rgba(245,246,247,.14); border-radius:22px; background:linear-gradient(155deg,rgba(45,52,58,.97),rgba(23,27,30,.96)); color:var(--hub-white); font:500 15px/1.25 Roboto,Arial,sans-serif; white-space:normal; text-transform:none; box-shadow:0 4px 14px #0002; transition:background .16s,transform .16s; touch-action:manipulation; cursor:pointer; }
.portable-hub .hub-button:active { transform:scale(.98); }
.portable-hub .hub-button:focus-visible { outline:2px solid var(--hub-amber); outline-offset:3px; }
.portable-hub .hub-button.is-selected,.portable-hub .hub-button.is-primary { border-color:#f2b84b77; background:#f2b84b28; }
.portable-hub input,.portable-hub select { max-width:100%; min-height:44px; color:var(--hub-white); font:inherit; background:#1f2428; border:1px solid #f5f6f733; border-radius:12px; padding:10px; }
.portable-hub input[type=range] { width:min(430px,100%); accent-color:var(--hub-amber); padding:0; border:0; background:transparent; }
.portable-hub input[type=checkbox] { width:22px; height:22px; min-height:22px; accent-color:var(--hub-amber); }
.portable-hub fieldset { border:1px solid #f5f6f722; border-radius:16px; padding:12px; margin:12px 0; max-width:620px; }
.hub-check { display:flex; gap:10px; align-items:center; min-height:46px; padding:2px 4px; }
/* Settings: quiet navigation rows, compact controls and comfortable touch areas. */
.portable-hub[data-page=settings] .hub-panel { padding-top:max(24px,env(safe-area-inset-top)); }
.portable-hub[data-page=settings] .hub-panel>h1,.portable-hub[data-page=settings] .hub-panel>.hub-settings-context,.hub-settings-content { width:min(640px,100%); margin-left:auto; margin-right:auto; box-sizing:border-box; }
.portable-hub[data-page=settings] .hub-panel>h1 { font-size:28px; margin-top:0; margin-bottom:8px; }
.hub-settings-context { font-size:12px; color:var(--hub-muted); margin-top:0; margin-bottom:12px; }
.hub-setting-row,.portable-hub .hub-setting-link { display:flex; align-items:center; justify-content:space-between; gap:20px; min-height:56px; box-sizing:border-box; padding:8px 0; border:0; border-bottom:1px solid #f5f6f715; }
.hub-setting-copy { display:flex; flex-direction:column; gap:4px; min-width:0; font-size:16px; line-height:1.35; text-align:left; overflow-wrap:anywhere; }
.hub-setting-copy small { font-size:13px; color:var(--hub-muted); font-weight:400; }
.portable-hub .hub-setting-link { width:100%; margin:0; border-radius:0; background:transparent; box-shadow:none; min-height:68px; font-weight:400; }
.portable-hub .hub-setting-link:active { background:#f5f6f708; transform:none; }
.hub-setting-chevron { font-size:28px; color:var(--hub-muted); padding:0 6px; }
.portable-hub .hub-switch { display:flex; flex:0 0 52px; align-items:center; justify-content:center; min-width:52px; min-height:48px; padding:0; border:0; border-radius:12px; background:transparent; box-shadow:none; }
.hub-switch-track { display:block; position:relative; width:38px; height:22px; border-radius:12px; border:1px solid #f5f6f733; background:#aeb6bd33; transition:background .18s; }
.hub-switch-track::after { content:''; position:absolute; top:3px; left:3px; width:16px; height:16px; border-radius:50%; background:var(--hub-white); transition:transform .18s; }
.hub-switch[aria-checked=true] .hub-switch-track { background:#54b9ac99; border-color:var(--hub-teal); }
.hub-switch[aria-checked=true] .hub-switch-track::after { transform:translateX(16px); }
.hub-settings-brightness { padding:12px 0 16px; }
.hub-settings-brightness label { display:flex; flex-wrap:wrap; justify-content:space-between; align-items:center; gap:4px 16px; font-size:16px; }
.hub-settings-brightness output { color:var(--hub-muted); font-size:14px; font-variant-numeric:tabular-nums; }
.portable-hub .hub-settings-brightness input[type=range] { flex:1 0 100%; width:100%; }
.hub-setting-row>.hub-button,.hub-setting-row>select { flex:0 0 auto; min-height:44px; font-size:14px; }
.hub-settings-voice .liam-row { display:flex; flex-wrap:wrap; gap:8px; align-items:center; }
.hub-settings-voice label { font-size:14px; color:var(--hub-muted); }
.hub-tabs { display:flex; flex-wrap:wrap; gap:6px; margin:0 0 20px; }
.portable-hub .hub-tabs .hub-button { padding:8px 12px; font-size:14px; }
.hub-photo-tools { position:absolute; right:max(14px,env(safe-area-inset-right)); bottom:max(18px,env(safe-area-inset-bottom)); display:flex; gap:8px; }
.portable-hub .hub-photo-tools .hub-button { width:54px; height:48px; padding:0; font-size:25px; backdrop-filter:blur(12px); }
.hub-activity { position:absolute; left:50%; top:max(18px,env(safe-area-inset-top)); transform:translateX(-50%); display:flex; gap:12px; align-items:center; max-width:calc(100% - 32px); padding:13px 18px; border:1px solid #f5f6f724; border-radius:24px; background:linear-gradient(150deg,#1f2428f2,#171b1ef0); box-shadow:0 8px 24px #0005; backdrop-filter:blur(14px); pointer-events:none; }
.hub-wave { display:flex; width:62px; height:28px; justify-content:center; align-items:center; gap:5px; flex:0 0 auto; }
.hub-wave i { width:4px; height:9px; border-radius:3px; background:var(--hub-amber); animation:hub-wave 1.4s ease-in-out infinite; }
.hub-wave i:nth-child(2),.hub-wave i:nth-child(4) { animation-delay:-.2s; }
.hub-wave i:nth-child(3) { animation-delay:-.4s; }
.is-listening .hub-wave i { background:var(--hub-teal); }
.hub-progress-copy { display:flex; flex-direction:column; gap:3px; min-width:0; }
.hub-progress-copy strong { font-size:16px; font-weight:600; line-height:1.3; }
.hub-progress-copy small { font-size:13px; color:var(--hub-muted); }
.hub-transcript { position:absolute; top:max(88px,calc(env(safe-area-inset-top) + 72px)); left:50%; transform:translateX(-50%); width:max-content; max-width:min(760px,calc(100% - 40px)); max-height:28%; overflow:auto; box-sizing:border-box; padding:16px 22px; border:1px solid #f5f6f724; border-radius:24px; background:#171b1edb; backdrop-filter:blur(14px); box-shadow:0 8px 24px #0004; font-size:clamp(19px,2.4vw,27px); line-height:1.4; overflow-wrap:anywhere; white-space:pre-wrap; pointer-events:none; z-index:5; }
.hub-transcript.is-provisional { color:var(--hub-teal); }
.hub-transcript.is-provisional::after { content:'\2026'; opacity:.7; }
.hub-answer { position:absolute; bottom:max(24px,env(safe-area-inset-bottom)); left:50%; transform:translateX(-50%); width:min(620px,calc(100% - 32px)); max-height:42%; overflow:auto; padding:19px 22px; box-sizing:border-box; border:1px solid #f5f6f724; border-radius:22px; background:#171b1eef; backdrop-filter:blur(14px); box-shadow:0 8px 30px #0006; user-select:text; -webkit-user-select:text; touch-action:pan-y; }
.portable-hub .hub-answer>.hub-button { position:sticky; float:right; top:0; min-width:40px; min-height:40px; padding:0; margin-left:10px; font-size:23px; }
.hub-answer-question { margin:0 0 10px; color:var(--hub-muted); font-size:13px; }
.hub-answer-text { font-size:17px; line-height:1.55; }
.hub-answer .is-speaking { color:var(--hub-white); background:#f2b84b25; border-radius:4px; }
.hub-toast { position:absolute; bottom:max(22px,env(safe-area-inset-bottom)); left:50%; transform:translateX(-50%); max-width:calc(100% - 32px); padding:10px 16px; border-radius:18px; background:#171b1ef2; border:1px solid #f5f6f724; font-size:14px; line-height:1.4; pointer-events:none; }
.hub-dialog { position:absolute; inset:0; display:flex; align-items:center; justify-content:center; padding:20px; background:#0009; touch-action:auto; }
.hub-dialog-card { width:min(470px,100%); max-height:85%; overflow:auto; box-sizing:border-box; padding:22px; border:1px solid #f5f6f724; border-radius:22px; background:#171b1ef5; backdrop-filter:blur(16px); box-shadow:0 16px 50px #0008; }
.hub-dialog-card h2 { margin:0 0 12px; font-size:22px; }
.hub-dialog-card p { line-height:1.45; color:var(--hub-muted); }
.hub-dialog-card>.hub-row { justify-content:flex-end; margin-bottom:0; }
.hub-dialog-card>input,.hub-dialog-card>select { display:block; width:100%; box-sizing:border-box; margin:12px 0; }
.hub-weather-today { display:flex; flex-wrap:wrap; align-items:center; gap:12px; margin:25px 0; }
.hub-weather-today img { width:96px; height:96px; }
.hub-weather-today strong { font-size:48px; font-weight:400; }
.hub-aqi-badge { display:inline-flex; align-items:center; gap:8px; padding:6px 12px; border:1px solid rgba(245,246,247,.14); border-radius:999px; color:#f5f6f7; background:rgba(23,27,30,.86); font:500 17px/1.2 Roboto,Arial,sans-serif; }
.hub-aqi-badge::before { content:''; width:7px; height:7px; border-radius:50%; background:var(--aqi-category); }
.hub-motion-source { position:absolute; width:1px; height:1px; opacity:.001; pointer-events:none; left:0; top:0; }
.hub-timers { position:absolute; right:max(16px,env(safe-area-inset-right)); bottom:max(18px,env(safe-area-inset-bottom)); width:min(390px,calc(100% - 32px)); max-height:48%; box-sizing:border-box; display:flex; flex-direction:column; gap:10px; padding:16px; border:1px solid #f5f6f72b; border-radius:24px; background:#171b1ef2; backdrop-filter:blur(14px); box-shadow:0 8px 30px #0005; touch-action:pan-y; }
.hub-timers>header { display:flex; align-items:baseline; gap:12px; flex-wrap:wrap; }
.hub-timers>header strong { font-size:16px; font-weight:500; }
.hub-timers>header small { color:var(--hub-muted); font-size:12px; }
.hub-timer-list { min-height:0; overflow:auto; display:flex; flex-direction:column; gap:12px; }
.hub-timer-card { display:flex; align-items:center; justify-content:space-between; gap:14px; padding-top:12px; border-top:1px solid #f5f6f71c; }
.hub-timer-copy { min-width:0; display:flex; flex-direction:column; gap:4px; }
.hub-timer-copy>strong { font-size:15px; font-weight:500; overflow-wrap:anywhere; }
.hub-timer-time { font-size:34px; font-variant-numeric:tabular-nums; line-height:1.08; letter-spacing:-.5px; }
.hub-timer-status { color:var(--hub-muted); font-size:12px; }
.hub-timer-card.is-ringing .hub-timer-time { color:var(--hub-amber); font-size:40px; }
.hub-timers.is-ringing { border-color:#f2b84b88; max-height:62%; }
.has-timers .hub-answer { left:16px; transform:none; width:calc(100% - 450px); max-width:620px; }
.portable-hub .hub-button:disabled { opacity:.5; cursor:default; }
@media (max-width:760px) { .hub-timers { max-height:38%; padding:14px; } .hub-timers.is-ringing { max-height:52%; } .has-timers .hub-answer { left:16px; bottom:auto; top:90px; width:calc(100% - 32px); max-height:28%; } .hub-timer-time { font-size:30px; } }
@keyframes hub-wave { 0%,100% { transform:scaleY(.65); } 50% { transform:scaleY(2.4); } }
@media (max-width:500px) { .hub-panel { padding:20px 18px max(24px,env(safe-area-inset-bottom)); } .hub-row { gap:7px; } .portable-hub .hub-button { font-size:14px; padding:9px 13px; } .hub-tabs { gap:4px; } .portable-hub .hub-tabs .hub-button { font-size:12px; padding:7px 10px; } .hub-answer { max-height:48%; padding:15px; } .hub-answer-text { font-size:16px; } .hub-progress-copy strong { font-size:14px; } }
@media (prefers-reduced-motion:reduce) { .portable-hub * { animation:none!important; transition:none!important; scroll-behavior:auto!important; } }
@media (prefers-reduced-transparency:reduce) { .portable-hub .hub-button,.hub-answer,.hub-activity,.hub-dialog-card,.hub-transcript { background:#171b1e; backdrop-filter:none; } }
