:root {
    color-scheme: light;
    --surface-elevated: #ffffff;
    --input: #f0f3ef;
    --input-focus: #ffffff;
    --header-surface: rgba(247,248,244,.9);
    --primary: #102f27;
    --primary-hover: #174b3d;
    --primary-ink: #ffffff;
    --quiet: #e8ede9;
    --quiet-hover: #dde5df;
    --badge-ink: #102f27;
    --control-hover: #f9fbf9;
    --open-text: #ad3d34;
    --closed-text: #16704f;
    --closed-soft: #e4f5ec;
    --unknown-text: #6c756f;
    --unknown-soft: #eef1ef;
    --danger-ink: #ffffff;
    --switch-track: #d2d8d4;
    --overlay: rgba(8,27,22,.58);
    --hero-base: #102f27;
    --hero-start: #0b2820;
    --hero-end: #1b5948;
    --invite-glow: #eaf3df;
    --skeleton-low: #e8ece9;
    --skeleton-high: #f4f6f4;
    --toast-background: #102f27;
    --toast-ink: #ffffff;
    --ink: #14231e;
    --ink-secondary: #45534e;
    --ink-tertiary: #6f7a75;
    --ink-muted: #98a19d;
    --plaster: #f7f8f4;
    --plaster-deep: #eef1ec;
    --surface: #ffffff;
    --surface-inset: #f0f3ef;
    --painted-door: #102f27;
    --painted-door-hover: #174b3d;
    --leaf: #1c8c62;
    --threshold-mint: #c9f36a;
    --threshold-soft: #edfad0;
    --open-coral: #ed715f;
    --open-soft: #ffebe7;
    --danger: #b9453b;
    --warning: #8a5617;
    --warning-soft: #fff4dc;
    --frame-line: rgba(20, 35, 30, .11);
    --frame-line-soft: rgba(20, 35, 30, .07);
    --focus-ring: rgba(28, 140, 98, .18);
    --lift-low: 0 0 0 1px rgba(20,35,30,.06), 0 1px 2px rgba(20,35,30,.04), 0 8px 24px rgba(20,35,30,.04);
    --lift-high: 0 0 0 1px rgba(20,35,30,.06), 0 18px 55px rgba(16,47,39,.13);
    --radius-control: 10px;
    --radius-card: 18px;
    --radius-modal: 24px;
    --page-width: 1180px;
}

/* Shared with the Android app's dark palette. */
:root[data-theme="dark"] {
    color-scheme: dark;
    --ink: #f3f7f4;
    --ink-secondary: #a2b1aa;
    --ink-tertiary: #a2b1aa;
    --ink-muted: #8c9e94;
    --plaster: #091712;
    --plaster-deep: #10231d;
    --surface: #10231d;
    --surface-inset: #142b23;
    --surface-elevated: #173027;
    --input: #132920;
    --input-focus: #173027;
    --header-surface: rgba(9,23,18,.92);
    --primary: #c9f36a;
    --primary-hover: #d9ff83;
    --primary-ink: #102f27;
    --quiet: #203b2b;
    --quiet-hover: #294c37;
    --badge-ink: #76ddb1;
    --control-hover: #173027;
    --leaf: #61d2a2;
    --threshold-soft: #203b2b;
    --open-coral: #ff8b79;
    --open-soft: #3b201e;
    --open-text: #ff9b8c;
    --closed-text: #76ddb1;
    --closed-soft: #17372b;
    --unknown-text: #b0bbb6;
    --unknown-soft: #24332d;
    --danger: #ff8b79;
    --danger-ink: #102f27;
    --warning: #f2bd69;
    --warning-soft: #392d19;
    --switch-track: #29443a;
    --frame-line: #29443a;
    --frame-line-soft: rgba(162,177,170,.12);
    --focus-ring: rgba(97,210,162,.25);
    --overlay: rgba(0,8,5,.78);
    --hero-base: #091712;
    --hero-start: #091712;
    --hero-end: #10231d;
    --invite-glow: #17372b;
    --skeleton-low: #10231d;
    --skeleton-high: #173027;
    --toast-background: #173027;
    --toast-ink: #f3f7f4;
    --lift-low: 0 0 0 1px #29443a, 0 4px 16px rgba(0,0,0,.12);
    --lift-high: 0 0 0 1px #365848, 0 12px 32px rgba(0,0,0,.28);
}

* { box-sizing: border-box; }
html { min-width: 320px; scroll-behavior: smooth; background: var(--plaster); }
body { margin: 0; min-height: 100vh; color: var(--ink); font-family: "Avenir Next", "Segoe UI Variable", "Segoe UI", ui-sans-serif, system-ui, sans-serif; background: var(--plaster); -webkit-font-smoothing: antialiased; }
button, input { font: inherit; }
button { color: inherit; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, p { text-wrap: pretty; }
h1, h2, h3 { text-wrap: balance; }
.hidden { display: none !important; }
.page-width { width: min(var(--page-width), calc(100% - 48px)); margin-inline: auto; }
.svg-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
svg { width: 1.25rem; height: 1.25rem; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
:focus-visible { outline: 3px solid var(--focus-ring); outline-offset: 3px; }
.brand { display: inline-flex; align-items: center; gap: 10px; font-size: 1.12rem; font-weight: 800; letter-spacing: -.035em; }
.brand svg { width: 30px; height: 30px; color: var(--leaf); stroke-width: 2; }
.brand--light { color: #fff; }
.brand--light svg { color: var(--threshold-mint); }
.eyebrow { margin: 0 0 10px; color: var(--leaf); font-size: .7rem; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; }
.eyebrow--mint { color: var(--threshold-mint); }

.button { min-height: 44px; display: inline-flex; align-items: center; justify-content: center; gap: 9px; padding: 11px 17px; border: 0; border-radius: var(--radius-control); font-size: .88rem; font-weight: 760; cursor: pointer; transition: transform 140ms cubic-bezier(.23,1,.32,1), background-color 160ms cubic-bezier(.23,1,.32,1), color 160ms cubic-bezier(.23,1,.32,1), opacity 160ms; }
.button:hover:not(:disabled) { transform: translateY(-1px); }
.button:active:not(:disabled) { transform: scale(.97); }
.button:disabled { opacity: .5; cursor: wait; }
.button svg { width: 17px; height: 17px; }
.button--small { min-height: 38px; padding: 8px 13px; font-size: .8rem; }
.button--full { width: 100%; }
.button--forest { color: var(--primary-ink); background: var(--primary); box-shadow: 0 6px 18px rgba(16,47,39,.16); }
.button--forest:hover:not(:disabled) { background: var(--primary-hover); }
.button--mint { color: var(--painted-door); background: var(--threshold-mint); box-shadow: 0 8px 24px rgba(131,171,49,.18); }
.button--mint:hover:not(:disabled) { background: #d5fa82; }
.button--quiet { color: var(--ink); background: var(--quiet); }
.button--quiet:hover:not(:disabled) { background: var(--quiet-hover); }
.button--danger { color: var(--danger-ink); background: var(--danger); }
.button--ghost-light { color: #fff; background: rgba(255,255,255,.08); box-shadow: inset 0 0 0 1px rgba(255,255,255,.18); }
.button--ghost-light:hover:not(:disabled) { background: rgba(255,255,255,.13); }
.link-button { min-height: 40px; padding: 8px 0; border: 0; background: none; color: var(--leaf); font-size: .82rem; font-weight: 720; cursor: pointer; }

/* Public homepage */
.marketing-page { background: var(--hero-base); }
.hero-shell { min-height: 100vh; min-height: 100svh; display: grid; grid-template-rows: 82px 1fr; color: #fff; background: radial-gradient(circle at 76% 30%, rgba(201,243,106,.14), transparent 27%), linear-gradient(145deg, var(--hero-start), var(--hero-base) 56%, var(--hero-end)); overflow: hidden; }
.site-header { height: 82px; display: flex; align-items: center; justify-content: space-between; }
.site-nav { display: flex; align-items: center; gap: 26px; color: rgba(255,255,255,.72); font-size: .84rem; font-weight: 680; }
.site-nav > a:not(.button):hover { color: #fff; }
.site-nav__logout { padding: 8px 0; border: 0; background: none; color: inherit; font: inherit; cursor: pointer; }
.site-nav__logout:hover { color: #fff; }
.hero { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(420px, .95fr); align-items: center; gap: clamp(48px, 7vw, 96px); padding-block: 56px 82px; }
.hero-copy { max-width: 650px; }
.hero-copy h1 { max-width: 10ch; margin: 0; font-size: clamp(3.5rem, 6.8vw, 6.8rem); font-weight: 740; line-height: .92; letter-spacing: -.068em; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 32px; }
.live-demo { --demo-accent: rgba(255,255,255,.76); padding: 24px; border-radius: 26px; background: rgba(5,30,23,.42); box-shadow: inset 0 0 0 1px rgba(255,255,255,.15), 0 30px 80px rgba(0,0,0,.22); backdrop-filter: blur(18px); transition: background-color 220ms, box-shadow 220ms; }
.live-demo.is-open { --demo-accent: #ff8b79; background: rgba(72,29,24,.42); box-shadow: inset 0 0 0 1px rgba(255,139,121,.36), 0 30px 80px rgba(0,0,0,.22); }
.live-demo.is-closed { --demo-accent: var(--threshold-mint); box-shadow: inset 0 0 0 1px rgba(201,243,106,.3), 0 30px 80px rgba(0,0,0,.22); }
.live-demo.is-offline { --demo-accent: #f2bd69; background: rgba(66,43,17,.48); box-shadow: inset 0 0 0 1px rgba(242,189,105,.3), 0 30px 80px rgba(0,0,0,.22); }
.live-demo__top { display: flex; align-items: center; justify-content: space-between; gap: 16px; color: rgba(255,255,255,.56); font-size: .66rem; font-weight: 740; letter-spacing: .09em; text-transform: uppercase; }
.live-demo__top > span:first-child { color: #fff; }
.live-demo__signal { display: inline-flex; align-items: center; gap: 8px; }
.live-demo__signal i { width: 8px; height: 8px; border-radius: 50%; background: var(--demo-accent); box-shadow: 0 0 0 6px color-mix(in srgb, var(--demo-accent) 15%, transparent); }
.live-demo.is-loading .live-demo__signal i { animation: demo-pulse 1.2s infinite; }
.live-demo__body { display: flex; align-items: center; gap: 24px; padding: 34px 0 30px; }
.live-demo__door { width: 104px; height: 104px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 30px; color: var(--painted-door); background: var(--demo-accent); box-shadow: 0 18px 38px rgba(0,0,0,.2); transition: transform 220ms cubic-bezier(.23,1,.32,1), background-color 220ms; }
.live-demo.is-open .live-demo__door { transform: perspective(220px) rotateY(-12deg) translateX(-2px); }
.live-demo__door svg { width: 58px; height: 58px; stroke-width: 1.7; }
.live-demo__copy { min-width: 0; }
.live-demo__copy p { margin: 0 0 5px; color: rgba(255,255,255,.67); font-size: .88rem; font-weight: 700; }
.live-demo__copy strong { display: block; color: #fff; font-size: clamp(2.6rem, 4.8vw, 4.1rem); line-height: .95; letter-spacing: -.06em; }
.live-demo__copy > span { display: block; margin-top: 10px; color: var(--demo-accent); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .78rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.live-demo__copy .state-timing { justify-items: start; gap: 4px; font-family: inherit; white-space: normal; }
.live-demo__copy .state-duration { color: rgba(255,255,255,.84); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .78rem; }
.live-demo__copy .state-started-at { color: rgba(255,255,255,.62); font-size: .7rem; text-align: left; }
@keyframes demo-pulse { 50% { opacity: .35; transform: scale(.8); } }

/* Authentication */
.auth-layout { min-height: 100vh; display: grid; grid-template-columns: minmax(420px, .9fr) minmax(520px, 1.1fr); }
.auth-context { min-height: 100vh; display: flex; flex-direction: column; justify-content: space-between; padding: clamp(32px, 5vw, 68px); color: #fff; background: radial-gradient(circle at 78% 24%, rgba(201,243,106,.13), transparent 30%), var(--hero-base); }
.auth-context__copy { max-width: 570px; margin-block: 72px; }
.auth-context__copy h1 { max-width: 10ch; margin: 0; font-size: clamp(3rem, 6vw, 5.7rem); line-height: .94; letter-spacing: -.065em; }
.auth-signal { display: flex; align-items: center; gap: 17px; width: min(100%, 420px); margin-top: 40px; padding: 17px; border-radius: 19px; background: rgba(255,255,255,.06); box-shadow: inset 0 0 0 1px rgba(255,255,255,.1); }
.auth-signal__door { width: 58px; height: 58px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 16px; color: var(--painted-door); background: var(--threshold-mint); }
.auth-signal__door svg { width: 33px; height: 33px; }
.auth-signal span { display: block; color: rgba(255,255,255,.55); font-size: .7rem; }
.auth-signal strong { display: block; margin: 2px 0; font-size: 1.15rem; }
.auth-context__note { display: flex; align-items: center; gap: 10px; margin: 0; color: rgba(255,255,255,.65); font-size: .82rem; }
.auth-context__note span { width: 8px; height: 8px; border-radius: 50%; background: var(--threshold-mint); box-shadow: 0 0 0 6px rgba(201,243,106,.11); }
.auth-workspace { position: relative; display: grid; place-items: center; padding: 68px 32px; }
.back-link { position: absolute; left: 36px; top: 30px; color: var(--ink-tertiary); font-size: .8rem; font-weight: 680; }
.back-link:hover { color: var(--ink); }
.auth-card { width: min(100%, 420px); }
.auth-card h2 { margin: 0; font-size: clamp(2rem, 3.4vw, 3rem); line-height: 1.05; letter-spacing: -.05em; }
.auth-card__intro { margin: 12px 0 32px; color: var(--ink-secondary); }
.stack-form { display: grid; gap: 17px; }
label { display: grid; gap: 8px; color: var(--ink-secondary); font-size: .82rem; font-weight: 740; }
input { width: 100%; min-height: 48px; padding: 12px 14px; border: 1px solid var(--frame-line); border-radius: var(--radius-control); outline: none; color: var(--ink); background: var(--input); transition: border-color 160ms, box-shadow 160ms, background-color 160ms; }
input:focus { border-color: var(--leaf); background: var(--input-focus); box-shadow: 0 0 0 4px var(--focus-ring); }
input::placeholder { color: var(--ink-muted); }
.form-support { display: flex; justify-content: flex-end; margin-top: -9px; }
.divider { display: flex; align-items: center; gap: 12px; margin: 25px 0 18px; color: var(--ink-muted); font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; }
.divider::before, .divider::after { content: ""; height: 1px; flex: 1; background: var(--frame-line); }
.google-button { min-height: 44px; display: grid; place-items: center; }
.form-error { min-height: 1.25em; margin: 12px 0 0; color: var(--danger); font-size: .82rem; line-height: 1.45; }
.auth-switch { margin: 23px 0 0; color: var(--ink-tertiary); font-size: .82rem; text-align: center; }
.auth-switch a { color: var(--leaf); font-weight: 740; }

/* Authenticated application */
.app-header { height: 72px; position: sticky; top: 0; z-index: 10; border-bottom: 1px solid var(--frame-line-soft); background: var(--header-surface); backdrop-filter: blur(18px); }
.app-header__inner { height: 100%; display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 42px; }
.app-nav { align-self: stretch; display: flex; align-items: center; }
.app-nav a { height: 100%; display: inline-flex; align-items: center; position: relative; color: var(--ink-tertiary); font-size: .83rem; font-weight: 720; }
.app-nav a.active { color: var(--ink); }
.app-nav a.active::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; border-radius: 2px 2px 0 0; background: var(--leaf); }
.topbar-user { justify-self: end; display: flex; align-items: center; gap: 14px; color: var(--ink-tertiary); font-size: .8rem; }
.account-menu { position: relative; }
.account-menu > summary { list-style: none; }
.account-menu > summary::-webkit-details-marker { display: none; }
.account-menu__trigger { min-height: 42px; display: flex; align-items: center; gap: 9px; padding: 4px 9px 4px 5px; border: 1px solid transparent; border-radius: 13px; color: var(--ink-secondary); cursor: pointer; transition: background-color 150ms, border-color 150ms; }
.account-menu__trigger:hover, .account-menu[open] .account-menu__trigger { border-color: var(--frame-line); background: var(--surface); }
.account-menu__avatar { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 11px; color: var(--badge-ink); background: var(--threshold-soft); font-size: .8rem; font-weight: 800; }
.account-menu__name { max-width: 190px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .78rem; font-weight: 700; }
.account-menu__chevron { width: 15px; height: 15px; color: var(--ink-muted); transition: transform 150ms; }
.account-menu[open] .account-menu__chevron { transform: rotate(180deg); }
.account-menu__panel { position: absolute; top: calc(100% + 8px); right: 0; z-index: 30; width: 214px; padding: 7px; border: 1px solid var(--frame-line); border-radius: 15px; background: var(--surface-elevated); box-shadow: var(--lift-high); animation: menu-in 140ms cubic-bezier(.23,1,.32,1); }
.account-menu__item { width: 100%; min-height: 40px; display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 0; border-radius: 9px; color: var(--ink-secondary); background: transparent; text-align: left; font-size: .8rem; font-weight: 680; cursor: pointer; }
.account-menu__item:hover { color: var(--ink); background: var(--surface-inset); }
.account-menu__item--danger { color: var(--danger); }
.account-menu__item--danger:hover { color: var(--danger); background: var(--open-soft); }
.account-menu__item svg { width: 16px; height: 16px; }
.account-menu__divider { height: 1px; margin: 5px 3px; background: var(--frame-line-soft); }
@keyframes menu-in { from { opacity: 0; transform: translateY(-3px); } }
.dashboard-main { padding-block: 62px 96px; }
.dashboard-heading { display: flex; align-items: end; justify-content: space-between; gap: 24px; }
.dashboard-heading h1 { margin: 0; font-size: clamp(2.8rem, 5vw, 4.7rem); line-height: .96; letter-spacing: -.065em; }
.dashboard-heading > div > p:last-child { margin: 14px 0 0; color: var(--ink-secondary); font-size: .98rem; }
.icon-button { width: 44px; height: 44px; display: inline-grid; place-items: center; flex: 0 0 auto; padding: 0; border: 0; border-radius: var(--radius-control); color: var(--ink-secondary); background: var(--surface); box-shadow: 0 0 0 1px var(--frame-line), 0 2px 8px rgba(20,35,30,.04); cursor: pointer; transition: transform 140ms cubic-bezier(.23,1,.32,1), background-color 150ms, color 150ms; }
.icon-button:hover { transform: translateY(-1px); color: var(--ink); background: var(--control-hover); }
.icon-button:active { transform: scale(.97); }
.icon-button--add { width: 56px; height: 56px; border-radius: 16px; color: var(--painted-door); background: var(--threshold-mint); box-shadow: 0 10px 26px rgba(87,119,34,.18); }
.icon-button--add:hover { background: #d5fa82; }
.icon-button--add svg { width: 24px; height: 24px; stroke-width: 2.2; }
.icon-button--danger { color: var(--danger); }
.door-overview { display: grid; grid-template-columns: minmax(180px, .55fr) minmax(0, 1.45fr); align-items: stretch; gap: 1px; margin: 38px 0 22px; border-radius: var(--radius-card); background: var(--frame-line); box-shadow: var(--lift-low); overflow: hidden; }
.door-overview__total, .door-overview__states { background: var(--surface); }
.door-overview__total { display: flex; flex-direction: column; justify-content: space-between; gap: 16px; padding: 20px 22px; }
.door-overview__total span { color: var(--ink-tertiary); font-size: .72rem; font-weight: 720; text-transform: uppercase; letter-spacing: .08em; }
.door-overview__total strong { font-size: 2.35rem; line-height: 1; letter-spacing: -.055em; font-variant-numeric: tabular-nums; }
.door-overview__states { display: grid; grid-template-columns: repeat(3, 1fr); }
.door-overview__states--waiting { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.door-overview__states > div { display: grid; grid-template-columns: 10px auto 1fr; align-items: center; gap: 10px; padding: 20px 24px; }
.door-overview__states > div:not(:last-child) { box-shadow: inset -1px 0 var(--frame-line-soft); }
.door-overview__states strong { font-size: 1.35rem; letter-spacing: -.04em; font-variant-numeric: tabular-nums; }
.door-overview__states span { color: var(--ink-tertiary); font-size: .76rem; font-weight: 650; }
.state-dot { width: 8px; height: 8px; border-radius: 50%; }
.state-dot--open { background: var(--open-coral); box-shadow: 0 0 0 5px rgba(237,113,95,.1); }
.state-dot--closed { background: var(--leaf); box-shadow: 0 0 0 5px rgba(28,140,98,.1); }
.state-dot--offline { background: #d58a2f; box-shadow: 0 0 0 5px rgba(213,138,47,.12); }
.state-dot--waiting { background: #98a19d; box-shadow: 0 0 0 5px rgba(152,161,157,.12); }
.load-error { margin: 18px 0; padding: 14px 16px; border-radius: 12px; color: var(--open-text); background: var(--open-soft); font-size: .84rem; }
.load-error .link-button { margin-left: 5px; color: var(--danger); }
.door-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.skeleton { min-height: 230px; border-radius: var(--radius-card); background: linear-gradient(100deg, var(--skeleton-low) 30%, var(--skeleton-high) 50%, var(--skeleton-low) 70%); background-size: 400% 100%; animation: shimmer 1.5s infinite; }
@keyframes shimmer { to { background-position: -100% 0; } }
.door-card { position: relative; min-height: 230px; border-radius: var(--radius-card); background: var(--surface); box-shadow: var(--lift-low); overflow: hidden; transition: transform 180ms cubic-bezier(.23,1,.32,1), box-shadow 180ms; }
.door-card:hover { transform: translateY(-3px); box-shadow: var(--lift-high); }
.door-card__main { width: 100%; height: 100%; min-height: 230px; padding: 24px; border: 0; background: transparent; text-align: left; cursor: pointer; }
.door-card__top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.door-card__top-meta { min-width: 0; display: inline-flex; align-items: center; justify-content: flex-end; gap: 9px; }
.door-pin { display: inline-flex; align-items: center; gap: 4px; margin-left: 8px; color: var(--leaf); font-size: .66rem; font-weight: 760; vertical-align: 1px; }
.door-pin svg { width: 14px; height: 14px; }
.state-timing { min-width: 0; display: inline-grid; justify-items: end; gap: 3px; }
.state-duration { color: var(--ink-tertiary); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .7rem; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.state-started-at { color: var(--ink-muted); font-size: .65rem; font-weight: 620; line-height: 1.3; text-align: right; }
.status-pill { display: inline-flex; align-items: center; gap: 7px; padding: 7px 10px; border-radius: 999px; font-size: .68rem; font-weight: 820; text-transform: uppercase; letter-spacing: .075em; }
.status-pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.status--opened { color: var(--open-text); background: var(--open-soft); }
.status--closed { color: var(--closed-text); background: var(--closed-soft); }
.status--unknown { color: var(--unknown-text); background: var(--unknown-soft); }
.status--offline { color: var(--warning); background: var(--warning-soft); }
.door-card h2 { margin: 28px 0 6px; padding-right: 42px; font-size: 1.4rem; letter-spacing: -.035em; }
.door-location { min-height: 1.3em; margin: 0; color: var(--ink-tertiary); font-size: .86rem; }
.door-location svg { width: 15px; height: 15px; margin-right: 5px; vertical-align: -2px; }
.door-shared-badge { display: inline-flex; align-items: center; gap: 4px; margin-left: 8px; padding: 3px 7px; border-radius: 999px; color: var(--badge-ink); background: var(--threshold-soft); font-size: .67rem; font-weight: 700; vertical-align: 1px; }
.door-shared-badge svg { width: 12px; height: 12px; margin: 0; vertical-align: 0; }
.door-seen { display: flex; align-items: center; gap: 7px; margin: 28px 0 0; color: var(--ink-muted); font-size: .74rem; }
.door-seen svg { width: 15px; height: 15px; }
.door-card__actions { position: absolute; right: 15px; top: 64px; display: grid; gap: 7px; }
.door-card__actions .icon-button { width: 36px; height: 36px; }
.door-arrow { position: absolute; right: 21px; bottom: 21px; color: var(--ink-muted); }
.empty-state { max-width: 580px; margin: 54px auto 0; padding: 60px 30px; border-radius: var(--radius-card); text-align: center; background: var(--surface); box-shadow: inset 0 0 0 1px var(--frame-line); }
.empty-state h2 { margin: 18px 0 8px; font-size: 1.6rem; }
.empty-state p { max-width: 42ch; margin: 0 auto 24px; color: var(--ink-secondary); }
.empty-icon { width: 66px; height: 66px; display: grid; place-items: center; margin: auto; border-radius: 19px; color: var(--leaf); background: var(--threshold-soft); }
.empty-icon svg { width: 35px; height: 35px; }
.invite-inbox { margin: 28px 0 8px; }
.invite-inbox__heading { display: flex; align-items: end; justify-content: space-between; margin-bottom: 12px; }
.invite-inbox__heading .eyebrow { margin-bottom: 4px; }
.invite-inbox__heading h2 { margin: 0; font-size: 1.25rem; letter-spacing: -.035em; }
.invite-inbox__list { display: grid; gap: 9px; }
.invite-inbox__item { display: flex; align-items: center; gap: 14px; padding: 14px; border: 1px solid var(--frame-line-soft); border-radius: 15px; background: var(--surface); box-shadow: var(--lift-low); }
.invite-inbox__icon { width: 40px; height: 40px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 13px; color: var(--leaf); background: var(--threshold-soft); }
.invite-inbox__copy { min-width: 0; flex: 1; }
.invite-inbox__copy strong, .invite-inbox__copy span { display: block; }
.invite-inbox__copy strong { font-size: .88rem; }
.invite-inbox__copy span { margin-top: 3px; color: var(--ink-tertiary); font-size: .76rem; }
.invite-inbox__actions { display: flex; align-items: center; gap: 8px; }
.invite-inbox__actions .icon-button { width: 38px; height: 38px; }

/* Dialogs and shared feedback */
.modal { color: var(--ink); width: min(620px, calc(100% - 28px)); max-height: calc(100vh - 36px); padding: 0; border: 0; border-radius: var(--radius-modal); background: transparent; overflow: visible; }
.modal::backdrop { background: var(--overlay); backdrop-filter: blur(5px); }
.modal[open] { animation: modal-in 220ms cubic-bezier(.23,1,.32,1); }
@keyframes modal-in { from { opacity: 0; transform: scale(.97) translateY(6px); } }
.modal--narrow { width: min(500px, calc(100% - 28px)); }
.modal--wide { width: min(780px, calc(100% - 28px)); }
.modal-card { max-height: calc(100vh - 36px); overflow: auto; padding: clamp(24px, 5vw, 38px); border-radius: var(--radius-modal); background: var(--surface-elevated); box-shadow: 0 30px 100px rgba(0,0,0,.25); }
.modal-card h2 { margin: 0; font-size: clamp(1.7rem, 4vw, 2.35rem); letter-spacing: -.045em; }
.modal-card > p:not(.eyebrow):not(.form-error) { color: var(--ink-secondary); line-height: 1.6; }
.modal-card label { margin-top: 20px; }
.modal-head { display: flex; align-items: start; justify-content: space-between; gap: 20px; margin-bottom: 24px; }
.modal-actions { display: flex; gap: 8px; }
.optional { color: var(--ink-muted); font-weight: 550; }
.button-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 28px; }
.success-mark { width: 62px; height: 62px; display: grid; place-items: center; margin-bottom: 24px; border-radius: 18px; color: var(--painted-door-hover); background: var(--threshold-mint); }
.success-mark svg { width: 30px; height: 30px; }
.token-box { display: grid; grid-template-columns: 1fr 44px; align-items: center; gap: 10px; margin: 24px 0 14px; padding: 16px; border-radius: 14px; background: var(--closed-soft); box-shadow: inset 0 0 0 1px rgba(28,140,98,.24); }
.token-box code { overflow-wrap: anywhere; color: var(--closed-text); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .86rem; line-height: 1.65; }
.warning-note { margin: 0 0 24px; padding: 13px 15px; border-radius: 12px; color: var(--warning); background: var(--warning-soft); font-size: .82rem; line-height: 1.5; }
.sharing-form { display: grid; gap: 12px; margin-bottom: 26px; }
.sharing-section { margin-top: 21px; }
.sharing-section h3 { margin: 0 0 10px; font-size: .95rem; }
.sharing-list { display: grid; gap: 7px; }
.sharing-person { min-width: 0; display: flex; align-items: center; gap: 11px; padding: 9px 0; }
.sharing-person > div { min-width: 0; flex: 1; }
.sharing-person > div > strong, .sharing-person > div > span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sharing-person > div > strong { font-size: .83rem; }
.sharing-person > div > span { margin-top: 3px; color: var(--ink-tertiary); font-size: .72rem; }
.sharing-avatar { width: 38px; height: 38px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 13px; color: var(--badge-ink); background: var(--threshold-soft); font-size: .76rem; font-weight: 800; }
.sharing-avatar--pending { color: var(--ink-tertiary); background: var(--surface-inset); }
.sharing-avatar--pending svg { width: 17px; height: 17px; }
.sharing-empty { margin: 0; padding: 13px; border-radius: 11px; color: var(--ink-tertiary); background: var(--surface-inset); font-size: .78rem; }
.invite-link-fallback { margin: -6px 0 22px; padding: 13px; border-radius: 13px; background: var(--surface-inset); }
.invite-link-fallback p { margin: 0 0 9px; color: var(--ink-secondary); font-size: .76rem; line-height: 1.5; }
.invite-link-row { display: grid; grid-template-columns: 1fr 42px; gap: 8px; }
.invite-link-value { min-width: 0; height: 42px; overflow: hidden; padding: 8px 10px; border: 1px solid var(--frame-line); border-radius: 10px; color: var(--ink-secondary); background: var(--surface); font-size: .72rem; line-height: 24px; white-space: nowrap; text-overflow: ellipsis; }
.invite-link-row .icon-button { width: 42px; height: 42px; }
.detail-location { margin: 6px 0 0; color: var(--ink-tertiary); }
.your-preferences { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 22px; margin: -12px 0 28px; padding: 18px; border: 1px solid var(--frame-line-soft); border-radius: 16px; background: var(--surface); }
.your-preferences > div { grid-column: 1 / -1; }
.your-preferences h3 { margin: 0; font-size: .95rem; }
.your-preferences > div p { margin: 4px 0 0; color: var(--ink-tertiary); font-size: .74rem; }
.web-preference { min-height: 49px; display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0; }
.web-preference span { display: grid; gap: 3px; }
.web-preference strong { color: var(--ink); font-size: .78rem; }
.web-preference small { color: var(--ink-tertiary); font-size: .68rem; font-weight: 500; }
.web-preference input { appearance: none; position: relative; width: 42px; min-height: 24px; height: 24px; flex: 0 0 auto; padding: 0; border: 0; border-radius: 999px; background: var(--switch-track); cursor: pointer; transition: background 150ms; }
.web-preference input::before { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.17); transition: transform 150ms; }
.web-preference input:checked { background: var(--leaf); }
.web-preference input:checked::before { transform: translateX(18px); }
.detail-status { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin: 8px 0 34px; padding: 20px; border-radius: 16px; background: var(--surface-inset); }
.detail-status .state-timing { display: inline-grid; margin-left: 11px; justify-items: start; vertical-align: middle; }
.detail-status .state-duration { color: var(--ink); }
.detail-status .state-started-at { color: var(--ink-tertiary); text-align: left; }
.detail-status p { margin: 5px 0 0; color: var(--ink-tertiary); font-size: .8rem; }
.sensor-offline-alert { display: flex; align-items: center; gap: 12px; margin: -22px 0 18px; padding: 14px 16px; border-radius: 14px; color: var(--warning); background: var(--warning-soft); }
.sensor-offline-alert > svg { width: 22px; height: 22px; flex: 0 0 auto; }
.sensor-offline-alert strong, .sensor-offline-alert span { display: block; }
.sensor-offline-alert strong { font-size: .84rem; }
.sensor-offline-alert span { margin-top: 2px; color: var(--ink-secondary); font-size: .76rem; }
.firmware-panel { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 28px; padding: 16px; border-radius: 16px; background: var(--surface-inset); }
.firmware-panel__identity { min-width: 0; display: flex; align-items: center; gap: 12px; }
.firmware-panel__icon { width: 42px; height: 42px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 13px; color: var(--leaf); background: var(--threshold-soft); }
.firmware-panel__identity strong { display: block; font-size: .86rem; }
.firmware-panel__identity p { margin: 3px 0 0; color: var(--ink-tertiary); font-size: .75rem; }
.firmware-queue { display: inline-flex; align-items: center; margin-top: 7px; padding: 4px 8px; border-radius: 999px; color: var(--closed-text); background: var(--closed-soft); font-size: .68rem; font-weight: 760; }
.history-head { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding-top: 28px; border-top: 1px solid var(--frame-line); }
.history-head h3 { margin: 0; }
.history-head p { margin: 5px 0 0; color: var(--ink-tertiary); font-size: .8rem; }
.history-list { margin: 22px 0; }
.history-item { position: relative; display: grid; grid-template-columns: 14px 1fr auto; gap: 14px; align-items: center; padding: 12px 0; }
.history-item:not(:last-child)::after { content: ""; position: absolute; left: 6px; top: 29px; bottom: -12px; width: 1px; background: var(--frame-line); }
.history-dot { width: 13px; height: 13px; border: 3px solid var(--surface-elevated); border-radius: 50%; box-shadow: 0 0 0 1px currentColor; background: currentColor; }
.history-item strong { font-size: .86rem; }
.history-item time { color: var(--ink-tertiary); font-size: .74rem; text-align: right; }
.history-empty { padding: 28px; border-radius: 14px; text-align: center; color: var(--ink-tertiary); background: var(--surface-inset); }
.toast { position: fixed; left: 50%; bottom: 24px; z-index: 100; max-width: calc(100% - 32px); padding: 12px 18px; border-radius: 11px; color: var(--toast-ink); background: var(--toast-background); box-shadow: var(--lift-high); opacity: 0; transform: translate(-50%, 16px); pointer-events: none; transition: opacity 220ms, transform 220ms cubic-bezier(.23,1,.32,1); }
.toast.visible { opacity: 1; transform: translate(-50%, 0); }

/* Utility pages */
.simple-header { height: 80px; display: flex; align-items: center; }
.reset-main, .not-found-page { min-height: calc(100vh - 80px); display: grid; place-items: center; padding: 40px 24px 80px; }
.reset-card, .not-found-card { width: min(100%, 480px); padding: 38px; border-radius: var(--radius-modal); background: var(--surface); box-shadow: var(--lift-high); }
.reset-card h1, .not-found-card h1 { margin: 0; font-size: clamp(2rem, 5vw, 3rem); line-height: 1.02; letter-spacing: -.05em; }
.reset-card > p:not(.eyebrow):not(.form-error), .not-found-card > p:not(.eyebrow) { color: var(--ink-secondary); line-height: 1.65; }
.reset-card label { margin: 25px 0 16px; }
.not-found-page { min-height: 100vh; }
.not-found-card { text-align: center; }
.not-found-card .empty-icon { margin-bottom: 24px; }
.not-found-card .button { margin-top: 12px; }
.invite-page { min-height: 100vh; background: radial-gradient(circle at 50% 0%, var(--invite-glow), transparent 38%), var(--plaster); }
.invite-shell { width: min(100% - 32px, 520px); min-height: 100vh; display: flex; flex-direction: column; justify-content: center; margin: auto; padding-block: 30px; }
.invite-brand { align-self: center; margin-bottom: 22px; }
.invite-card { padding: clamp(26px, 6vw, 42px); border: 1px solid var(--frame-line-soft); border-radius: var(--radius-modal); background: var(--surface); box-shadow: var(--lift-high); text-align: center; }
.invite-icon { width: 62px; height: 62px; display: grid; place-items: center; margin: 0 auto 22px; border-radius: 19px; color: var(--painted-door); background: var(--threshold-mint); }
.invite-icon svg { width: 34px; height: 34px; }
.invite-card h1 { margin: 0; font-size: clamp(2rem, 8vw, 2.7rem); letter-spacing: -.055em; }
.invite-copy { min-height: 2.8em; margin: 13px auto 0; color: var(--ink-secondary); line-height: 1.6; }
.invite-email { margin: 15px 0 0; padding: 11px 13px; border-radius: 11px; color: var(--ink-secondary); background: var(--surface-inset); font-size: .82rem; overflow-wrap: anywhere; }
.invite-actions { display: grid; gap: 10px; margin-top: 22px; }
.invite-actions .button { text-align: center; }
.invite-switch { justify-self: center; }
.invite-home { display: inline-block; margin-top: 21px; color: var(--ink-tertiary); font-size: .78rem; font-weight: 680; }
.invite-home:hover { color: var(--ink); }

@media (max-width: 980px) {
    .hero { grid-template-columns: 1fr; gap: 54px; }
    .hero-copy h1 { font-size: clamp(3.4rem, 10vw, 6rem); }
    .live-demo { width: min(100%, 650px); }
    .auth-layout { grid-template-columns: 1fr; }
    .auth-context { min-height: 540px; }
    .auth-workspace { min-height: 700px; }
    .door-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 680px) {
    .page-width { width: min(var(--page-width), calc(100% - 30px)); }
    .site-header { height: 70px; }
    .site-nav { gap: 12px; }
    .hero-shell { grid-template-rows: 70px 1fr; }
    .hero { min-height: 0; padding-block: 56px 72px; }
    .hero-copy h1 { font-size: clamp(3.15rem, 16vw, 4.8rem); }
    .live-demo { padding: 18px; border-radius: 21px; }
    .live-demo__body { gap: 16px; padding-block: 25px; }
    .live-demo__door { width: 76px; height: 76px; border-radius: 22px; }
    .live-demo__door svg { width: 43px; height: 43px; }
    .live-demo__copy strong { font-size: 2.45rem; }
    .auth-context { min-height: 500px; padding: 30px; }
    .auth-context__copy { margin-block: 60px 34px; }
    .auth-context__copy h1 { font-size: clamp(3rem, 15vw, 4.8rem); }
    .auth-context__note { display: none; }
    .auth-workspace { min-height: 680px; padding: 80px 24px 56px; }
    .back-link { left: 24px; top: 24px; }
    .app-header { height: 66px; }
    .app-header__inner { grid-template-columns: auto 1fr auto; gap: 18px; }
    .app-nav { display: none; }
    .account-menu__name { display: none; }
    .account-menu__trigger { padding: 4px; }
    .dashboard-main { padding-block: 44px 76px; }
    .dashboard-heading { align-items: center; }
    .dashboard-heading > div > p:last-child { max-width: 28ch; }
    .door-overview { grid-template-columns: 1fr; }
    .door-overview__total { flex-direction: row; align-items: end; }
    .door-overview__states > div { grid-template-columns: 8px 1fr; gap: 7px; padding: 15px 12px; }
    .door-overview__states--waiting { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .door-overview__states span { grid-column: 1 / -1; }
    .door-grid { grid-template-columns: 1fr; }
    .door-card__top { align-items: flex-start; flex-direction: column; gap: 9px; }
    .door-card__top-meta { justify-content: flex-start; flex-wrap: wrap; }
    .door-card__top-meta .state-timing { justify-items: start; }
    .door-card__top-meta .state-started-at { text-align: left; }
    .door-card h2 { margin-top: 19px; }
    .your-preferences { grid-template-columns: 1fr; gap: 7px; }
    .your-preferences > div { grid-column: auto; }
    .modal-card { border-radius: 20px; }
    .modal-head { gap: 12px; }
    .modal-actions { gap: 5px; }
    .history-item { grid-template-columns: 14px 1fr; }
    .history-item time { grid-column: 2; text-align: left; }
    .detail-status { align-items: start; flex-direction: column; }
    .detail-status .state-timing { display: grid; margin: 9px 0 0; }
    .firmware-panel { align-items: stretch; flex-direction: column; }
    .firmware-panel .button { width: 100%; }
    .reset-card, .not-found-card { padding: 30px 24px; }
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

.invite-link-share { width: 100%; margin-top: 10px; border: 1px solid var(--frame-line); background: var(--surface); color: var(--badge-ink); }

/* Privacy policy and installable web app */
.site-footer { min-height: 72px; display: flex; align-items: center; justify-content: space-between; gap: 20px; padding-block: 18px; color: var(--ink-tertiary); font-size: .78rem; }
.site-footer nav { display: flex; align-items: center; gap: 18px; }
.site-footer a:hover { color: var(--leaf); }
.marketing-page .site-footer { color: rgba(255,255,255,.68); }
.marketing-page .site-footer a:hover { color: #fff; }
.marketing-page .site-footer .button--quiet { color: #fff; background: rgba(255,255,255,.12); }
.privacy-page { min-height: 100vh; background: var(--plaster); }
.privacy-header { justify-content: space-between; }
.privacy-main { width: min(800px, calc(100% - 40px)); margin: 22px auto 50px; }
.privacy-main h1 { margin: 0; color: var(--badge-ink); font-size: clamp(2.5rem, 7vw, 4.2rem); line-height: 1; letter-spacing: -.06em; }
.privacy-updated { margin: 14px 0 0; color: var(--ink-tertiary); font-size: .82rem; }
.privacy-lede { margin: 25px 0 40px; color: var(--ink-secondary); font-size: 1.15rem; line-height: 1.7; }
.privacy-main section { padding: 25px 0; border-top: 1px solid var(--frame-line); }
.privacy-main h2 { margin: 0 0 12px; color: var(--badge-ink); font-size: 1.25rem; letter-spacing: -.025em; }
.privacy-main p, .privacy-main li { color: var(--ink-secondary); font-size: .94rem; line-height: 1.75; }
.privacy-main p { margin: 0; }
.privacy-main ul { display: grid; gap: 12px; margin: 0; padding-left: 22px; }
.privacy-main a { color: var(--leaf); text-decoration: underline; text-underline-offset: 3px; }
.pwa-install-button[hidden] { display: none !important; }
.pwa-install-dialog { width: min(480px, calc(100% - 28px)); padding: 0; border: 0; border-radius: var(--radius-modal); color: var(--ink); background: transparent; box-shadow: var(--lift-high); }
.pwa-install-dialog::backdrop { background: var(--overlay); backdrop-filter: blur(5px); }
.pwa-install-dialog .modal-card { padding: 28px; border-radius: var(--radius-modal); background: var(--surface-elevated); }
.pwa-install-dialog .modal-head { align-items: flex-start; }
.pwa-install-dialog h2 { margin: 0; color: var(--badge-ink); font-size: 1.45rem; }
.pwa-install-dialog p, .pwa-install-dialog li { color: var(--ink-secondary); font-size: .9rem; line-height: 1.6; }
.pwa-install-dialog ol { display: grid; gap: 8px; margin: 18px 0 24px; padding-left: 22px; }
@media (max-width: 620px) {
    .site-footer { align-items: flex-start; flex-direction: column; gap: 8px; }
    .site-footer nav { flex-wrap: wrap; gap: 8px 16px; }
    .privacy-main { margin-top: 10px; }
}

@media (max-width: 420px) {
    .site-nav #home-login-link { display: none; }
    .site-nav { gap: 8px; }
    .site-nav .pwa-install-button, .site-nav .button { padding-inline: 10px; font-size: .72rem; }
    .app-header .pwa-install-button { padding-inline: 9px; font-size: .7rem; }
}

/* Theme preference lives in the authenticated account menu. */
.theme-picker { display: inline-flex; align-items: center; gap: 8px; margin: 0; color: inherit; font-size: .78rem; font-weight: 600; }
.theme-picker select { min-height: 40px; max-width: 120px; padding: 6px 10px; border: 1px solid var(--frame-line); border-radius: 10px; font: inherit; color: var(--ink); background: var(--surface); cursor: pointer; }
.account-menu__panel .theme-picker { display: flex; justify-content: space-between; padding: 6px 10px; color: var(--ink-secondary); }
.marketing-page .theme-picker select { color: #f3f7f4; background: var(--hero-base); border-color: rgba(255,255,255,.2); color-scheme: dark; }

/* Activity date ranges. */
.history-filters select, .history-filters input { min-height: 42px; min-width: 0; border: 1px solid var(--frame-line); border-radius: 10px; padding: 8px 10px; color: var(--ink); background: var(--surface); font: inherit; }
.history-filters { display: grid; gap: 12px; margin-bottom: 18px; }
.history-filters label { display: grid; gap: 6px; margin: 0; color: var(--ink-tertiary); font-size: .76rem; }
.history-filters > label { max-width: 210px; }
.history-custom-range { display: flex; flex-wrap: wrap; align-items: end; gap: 10px; }
.history-custom-range label { flex: 1 1 130px; }
.history-custom-range input { width: 100%; }
.history-custom-range button { min-height: 42px; }
