:root {
    --navy-950: #071b28;
    --navy-900: #0b2637;
    --navy-800: #12364a;
    --navy-700: #1b4a61;
    --gold-500: #b99354;
    --gold-400: #cfad70;
    --gold-200: #ead9b8;
    --ivory-50: #fbf8f1;
    --ivory-100: #f3eee3;
    --ivory-200: #e7dfd1;
    --ink: #172731;
    --muted: #68757b;
    --success: #31725b;
    --warning: #a06a27;
    --danger: #a44943;
    --white: #ffffff;
    --shadow: 0 18px 50px rgba(7, 27, 40, 0.10);
    --radius-lg: 22px;
    --radius-md: 14px;
    --radius-sm: 9px;
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    min-width: 320px;
    color: var(--ink);
    background: var(--ivory-50);
    font-family: Inter, "Helvetica Neue", Arial, sans-serif;
    line-height: 1.5;
}

button,
select,
input {
    font: inherit;
}

button,
select {
    min-height: 42px;
}

button {
    cursor: pointer;
}

button:focus-visible,
select:focus-visible,
input:focus-visible,
a:focus-visible {
    outline: 3px solid var(--gold-400);
    outline-offset: 3px;
}

button:disabled,
input:disabled {
    cursor: not-allowed;
    opacity: 0.45;
}

h1,
h2,
h3,
p {
    margin-top: 0;
}

h1,
h2,
.brand strong {
    font-family: Georgia, "Times New Roman", serif;
    font-weight: 500;
}

h1 {
    margin-bottom: 8px;
    color: var(--navy-950);
    font-size: clamp(2rem, 4vw, 3.25rem);
    line-height: 1.05;
}

h2 {
    margin-bottom: 8px;
    color: var(--navy-950);
    font-size: 1.35rem;
}

.skip-link {
    position: fixed;
    z-index: 100;
    top: 8px;
    left: 8px;
    padding: 10px 16px;
    color: var(--white);
    background: var(--navy-950);
    transform: translateY(-140%);
}

.skip-link:focus {
    transform: translateY(0);
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    min-height: 88px;
    padding: 14px clamp(20px, 4vw, 64px);
    color: var(--white);
    background: var(--navy-950);
    border-bottom: 1px solid rgba(234, 217, 184, 0.18);
}

.brand,
.mobile-brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand-mark {
    display: grid;
    flex: 0 0 auto;
    width: 48px;
    height: 48px;
    place-items: center;
    color: var(--gold-200);
    border: 1px solid var(--gold-500);
    border-radius: 50%;
    font-family: Georgia, serif;
    letter-spacing: 0.08em;
}

.brand-mark.small {
    width: 38px;
    height: 38px;
    font-size: 0.78rem;
}

.brand strong {
    display: block;
    color: var(--white);
    font-size: 1.25rem;
    letter-spacing: 0.02em;
}

.brand small,
.mobile-brand small {
    display: block;
    color: var(--gold-200);
    font-size: 0.7rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 20px;
}

.clock {
    min-width: 92px;
    text-align: right;
}

.clock strong {
    display: block;
    color: var(--gold-200);
    font-size: 1.3rem;
    font-variant-numeric: tabular-nums;
}

.eyebrow {
    display: block;
    margin-bottom: 6px;
    color: var(--gold-500);
    font-size: 0.66rem;
    font-weight: 800;
    letter-spacing: 0.16em;
    text-transform: uppercase;
}

.role-control {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--ivory-200);
    font-size: 0.78rem;
}

.role-control select,
.room-picker select {
    padding: 0 36px 0 12px;
    color: var(--white);
    background: var(--navy-800);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: var(--radius-sm);
}

.main-nav {
    display: flex;
    gap: 4px;
    padding: 0 clamp(20px, 4vw, 64px);
    overflow-x: auto;
    color: var(--white);
    background: var(--navy-900);
}

.nav-item {
    position: relative;
    min-width: max-content;
    padding: 16px 20px;
    color: #b9c6cc;
    background: transparent;
    border: 0;
}

.nav-item::after {
    position: absolute;
    right: 20px;
    bottom: 0;
    left: 20px;
    height: 2px;
    content: "";
    background: transparent;
}

.nav-item:hover,
.nav-item.active {
    color: var(--white);
}

.nav-item.active::after {
    background: var(--gold-400);
}

.status-strip {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 38px;
    padding: 7px clamp(20px, 4vw, 64px);
    color: #d8e1e5;
    background: var(--navy-800);
    font-size: 0.78rem;
}

.status-dot {
    width: 7px;
    height: 7px;
    background: #70c6a4;
    border-radius: 50%;
    box-shadow: 0 0 0 4px rgba(112, 198, 164, 0.12);
}

.privacy-chip {
    margin-left: auto;
    padding: 3px 9px;
    color: var(--gold-200);
    border: 1px solid rgba(234, 217, 184, 0.24);
    border-radius: 999px;
}

main {
    width: min(1500px, 100%);
    margin: 0 auto;
    padding: 38px clamp(20px, 4vw, 64px) 72px;
}

.view {
    animation: reveal 260ms ease-out;
}

.view[hidden] {
    display: none;
}

@keyframes reveal {
    from { opacity: 0; transform: translateY(7px); }
    to { opacity: 1; transform: translateY(0); }
}

.view-heading {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 28px;
}

.view-heading p {
    max-width: 680px;
    margin-bottom: 0;
    color: var(--muted);
}

.segmented {
    display: inline-flex;
    padding: 4px;
    background: var(--ivory-100);
    border: 1px solid var(--ivory-200);
    border-radius: 999px;
}

.segmented button {
    min-height: 34px;
    padding: 6px 16px;
    color: var(--muted);
    background: transparent;
    border: 0;
    border-radius: 999px;
}

.segmented button.active {
    color: var(--white);
    background: var(--navy-800);
}

.segmented.full {
    display: flex;
    width: 100%;
    border-radius: var(--radius-sm);
}

.segmented.full button {
    flex: 1;
    padding: 6px 8px;
    border-radius: 6px;
}

.metric-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(150px, 1fr));
    gap: 14px;
    margin-bottom: 18px;
}

.metric-card,
.panel,
.control-card {
    background: var(--white);
    border: 1px solid var(--ivory-200);
    box-shadow: var(--shadow);
}

.metric-card {
    padding: 20px;
    border-radius: var(--radius-md);
}

.metric-card span {
    display: block;
    margin-bottom: 16px;
    color: var(--muted);
    font-size: 0.76rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.metric-card strong {
    display: block;
    color: var(--navy-950);
    font-family: Georgia, serif;
    font-size: clamp(1.65rem, 3vw, 2.4rem);
    font-weight: 500;
    line-height: 1;
}

.metric-card small {
    display: block;
    margin-top: 10px;
    color: var(--success);
}

.metric-card small.warn {
    color: var(--warning);
}

.dashboard-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.6fr) minmax(280px, 0.8fr);
    gap: 18px;
    margin-top: 18px;
}

.lower-grid {
    grid-template-columns: minmax(0, 1.15fr) minmax(320px, 0.85fr);
}

.panel,
.control-card {
    padding: 24px;
    border-radius: var(--radius-lg);
}

.panel-heading,
.control-heading,
.detail-hero,
.mobile-room-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}

.panel-heading {
    margin-bottom: 22px;
}

.panel-heading h2,
.control-heading h2 {
    margin-bottom: 0;
}

.legend {
    color: var(--muted);
    font-size: 0.72rem;
    white-space: nowrap;
}

.legend i {
    display: inline-block;
    width: 8px;
    height: 8px;
    margin: 0 5px 0 10px;
    border-radius: 50%;
}

.legend-gold { background: var(--gold-500); }
.legend-blue { background: var(--navy-700); }

.chart {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    align-items: end;
    gap: clamp(8px, 2vw, 24px);
    min-height: 230px;
    padding: 20px 8px 0;
    border-bottom: 1px solid var(--ivory-200);
    background: repeating-linear-gradient(to bottom, transparent 0, transparent 52px, var(--ivory-100) 53px);
}

.chart-day {
    display: flex;
    align-items: center;
    flex-direction: column;
    justify-content: flex-end;
    height: 210px;
}

.chart-bars {
    display: flex;
    align-items: flex-end;
    gap: 4px;
    height: 176px;
}

.chart-bar {
    width: clamp(8px, 1.6vw, 17px);
    min-height: 8px;
    border-radius: 5px 5px 0 0;
}

.chart-bar.occupancy { background: var(--gold-500); }
.chart-bar.energy { background: var(--navy-700); }
.chart-day small { margin-top: 8px; color: var(--muted); }

.signal-list {
    margin: 0;
}

.signal-list > div {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    padding: 13px 0;
    border-bottom: 1px solid var(--ivory-100);
}

.signal-list dt { color: var(--muted); }
.signal-list dd { margin: 0; color: var(--navy-900); font-weight: 700; }

.sustainability-note {
    display: flex;
    gap: 12px;
    margin-top: 20px;
    padding: 14px;
    color: var(--success);
    background: #edf5f0;
    border-radius: var(--radius-sm);
}

.sustainability-note span {
    display: grid;
    width: 30px;
    height: 30px;
    place-items: center;
    border: 1px solid #b6d3c4;
    border-radius: 50%;
}

.sustainability-note p { margin: 0; }

.count-badge,
.audit-state,
.scene-status,
.connected-badge {
    padding: 5px 10px;
    color: var(--navy-700);
    background: var(--ivory-100);
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 700;
}

.alert-list {
    display: grid;
    gap: 10px;
}

.alert-item {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 14px;
    padding: 13px 0;
    border-top: 1px solid var(--ivory-100);
}

.alert-severity {
    width: 8px;
    height: 42px;
    background: var(--warning);
    border-radius: 99px;
}

.alert-item.high .alert-severity { background: var(--danger); }
.alert-item.resolved { opacity: 0.55; }
.alert-item strong { display: block; color: var(--navy-900); }
.alert-item small { color: var(--muted); }

.text-button {
    padding: 6px 10px;
    color: var(--navy-700);
    background: transparent;
    border: 1px solid var(--ivory-200);
    border-radius: 8px;
    font-size: 0.75rem;
}

.audit-list {
    display: grid;
    gap: 12px;
    max-height: 260px;
    margin: 0;
    padding: 0;
    overflow-y: auto;
    list-style: none;
}

.audit-list li {
    display: grid;
    grid-template-columns: 44px 1fr;
    gap: 12px;
    color: var(--muted);
    font-size: 0.82rem;
}

.audit-list time {
    color: var(--gold-500);
    font-variant-numeric: tabular-nums;
    font-weight: 700;
}

.audit-list strong { color: var(--ink); }

.privacy-note {
    margin: 20px 0 0;
    padding-top: 16px;
    color: var(--muted);
    border-top: 1px solid var(--ivory-100);
    font-size: 0.75rem;
}

.room-summary {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.summary-pill {
    padding: 7px 11px;
    color: var(--muted);
    background: var(--white);
    border: 1px solid var(--ivory-200);
    border-radius: 999px;
    font-size: 0.74rem;
}

.summary-pill strong { color: var(--navy-900); }

.room-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(340px, 0.6fr);
    gap: 22px;
    align-items: start;
}

.filter-row {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    overflow-x: auto;
}

.filter-button {
    min-width: max-content;
    padding: 7px 15px;
    color: var(--muted);
    background: transparent;
    border: 1px solid var(--ivory-200);
    border-radius: 999px;
}

.filter-button.active {
    color: var(--white);
    background: var(--navy-800);
    border-color: var(--navy-800);
}

.room-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(220px, 1fr));
    gap: 14px;
}

.room-card {
    position: relative;
    padding: 19px;
    text-align: left;
    background: var(--white);
    border: 1px solid var(--ivory-200);
    border-radius: var(--radius-md);
    box-shadow: 0 10px 30px rgba(7, 27, 40, 0.06);
}

.room-card:hover { border-color: var(--gold-400); }
.room-card.selected { border-color: var(--gold-500); box-shadow: 0 0 0 2px var(--gold-200); }
.room-card-top { display: flex; justify-content: space-between; gap: 12px; }
.room-number { color: var(--navy-950); font-family: Georgia, serif; font-size: 1.8rem; }
.room-card p { margin: 2px 0 16px; color: var(--muted); font-size: 0.78rem; }
.room-card-devices { display: flex; gap: 5px; flex-wrap: wrap; }
.room-card-devices span { padding: 3px 7px; color: var(--navy-700); background: var(--ivory-100); border-radius: 5px; font-size: 0.66rem; }
.room-card-devices span.offline { color: var(--danger); background: #f8eceb; }

.room-status,
.status-label {
    display: inline-flex;
    align-items: center;
    align-self: flex-start;
    padding: 5px 9px;
    color: var(--navy-700);
    background: #e9f1f4;
    border-radius: 999px;
    font-size: 0.68rem;
    font-weight: 800;
}

.status-occupied { color: var(--success); background: #e5f2eb; }
.status-arrival { color: var(--warning); background: #f8efdf; }
.status-cleaning { color: #76568b; background: #f1eaf5; }
.status-maintenance { color: var(--danger); background: #f8e9e8; }
.status-dnd { color: #79545e; background: #f6e9ed; }

.room-detail {
    position: sticky;
    top: 18px;
}

.detail-hero {
    padding-bottom: 18px;
    border-bottom: 1px solid var(--ivory-100);
}

.detail-hero h2 { margin-bottom: 2px; font-size: 1.8rem; }
.detail-hero p { margin: 0; color: var(--muted); }

.stay-card,
.grant-card {
    margin-top: 16px;
    padding: 14px;
    background: var(--ivory-50);
    border: 1px solid var(--ivory-200);
    border-radius: var(--radius-sm);
}

.stay-card dl,
.grant-card dl,
.mobile-grant { margin: 0; }
.stay-card div,
.grant-card div,
.mobile-grant div { display: flex; justify-content: space-between; gap: 12px; padding: 4px 0; }
.stay-card dt,
.grant-card dt,
.mobile-grant dt { color: var(--muted); font-size: 0.74rem; }
.stay-card dd,
.grant-card dd,
.mobile-grant dd { margin: 0; text-align: right; font-size: 0.74rem; font-weight: 700; }

.device-list { margin: 17px 0; }
.device-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--ivory-100); }
.device-row span { color: var(--muted); font-size: 0.78rem; }
.device-row strong { color: var(--navy-800); font-size: 0.78rem; }
.device-online::before,
.device-offline::before { display: inline-block; width: 6px; height: 6px; margin-right: 6px; content: ""; border-radius: 50%; background: var(--success); }
.device-offline::before { background: var(--danger); }

.action-stack { display: grid; gap: 9px; margin-top: 18px; }
.split-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.action-help { margin: 10px 0 0; color: var(--muted); font-size: 0.72rem; }

.button {
    padding: 10px 16px;
    border-radius: var(--radius-sm);
    font-weight: 700;
    transition: transform 150ms ease, background 150ms ease;
}

.button:hover:not(:disabled) { transform: translateY(-1px); }
.button-primary { color: var(--white); background: var(--gold-500); border: 1px solid var(--gold-500); }
.button-primary:hover:not(:disabled) { background: #a98448; }
.button-secondary { color: var(--navy-800); background: var(--white); border: 1px solid var(--ivory-200); }
.button-dark { color: var(--white); background: var(--navy-800); border: 1px solid var(--navy-800); }
.button-ghost { color: var(--gold-200); background: transparent; border: 1px solid rgba(234, 217, 184, 0.35); }
.button.compact { min-height: 36px; padding: 6px 11px; font-size: 0.74rem; }
.full-width { width: 100%; }

.room-picker { display: grid; gap: 4px; color: var(--muted); font-size: 0.7rem; }
.room-picker select { min-width: 200px; color: var(--navy-900); background: var(--white); border-color: var(--ivory-200); }

.smart-hero {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    color: var(--white);
    background: linear-gradient(135deg, var(--navy-950), var(--navy-800));
    border-color: var(--navy-800);
}

.smart-hero h2 { color: var(--white); font-size: 1.8rem; }
.smart-hero p { margin: 0; color: #bdcbd1; }

.environment-readings {
    display: flex;
    gap: clamp(18px, 4vw, 50px);
}

.environment-readings div { display: grid; text-align: center; }
.environment-readings strong { color: var(--gold-200); font-family: Georgia, serif; font-size: 1.65rem; }
.environment-readings span { color: #b8c7ce; font-size: 0.68rem; }

.control-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin: 18px 0;
}

.control-card { box-shadow: 0 12px 36px rgba(7, 27, 40, 0.07); }
.control-heading { align-items: center; }
.control-heading p { margin: 0; color: var(--muted); font-size: 0.75rem; }
.control-symbol { display: grid; width: 40px; height: 40px; place-items: center; color: var(--gold-500); border: 1px solid var(--gold-200); border-radius: 50%; font-family: Georgia, serif; }

.toggle {
    position: relative;
    width: 48px;
    min-height: 28px;
    padding: 2px;
    overflow: hidden;
    background: #c8d0d3;
    border: 0;
    border-radius: 999px;
}

.toggle span { display: block; width: 24px; height: 24px; background: var(--white); border-radius: 50%; transition: transform 160ms ease; }
.toggle[aria-checked="true"] { background: var(--success); }
.toggle[aria-checked="true"] span { transform: translateX(20px); }
.toggle b { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

.range-label { display: flex; justify-content: space-between; margin-top: 24px; color: var(--muted); font-size: 0.75rem; }
.range-label output { color: var(--navy-800); font-weight: 800; }
input[type="range"] { width: 100%; accent-color: var(--gold-500); }

.temperature-control { display: flex; align-items: center; justify-content: center; gap: 22px; margin-top: 24px; }
.temperature-control button,
.mobile-temperature button { display: grid; width: 36px; min-height: 36px; place-items: center; color: var(--navy-800); background: var(--ivory-100); border: 1px solid var(--ivory-200); border-radius: 50%; font-size: 1.15rem; }
.temperature-control strong { min-width: 92px; text-align: center; color: var(--navy-950); font-family: Georgia, serif; font-size: 1.65rem; }

.scenes-panel { margin-bottom: 18px; }
.scene-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.scene-grid button { padding: 16px; text-align: left; color: var(--ink); background: var(--ivory-50); border: 1px solid var(--ivory-200); border-radius: var(--radius-sm); }
.scene-grid button:hover,
.scene-grid button.active { color: var(--navy-950); border-color: var(--gold-500); background: #fcf7ec; }
.scene-grid strong,
.scene-grid span { display: block; }
.scene-grid strong { margin-bottom: 5px; }
.scene-grid span { color: var(--muted); font-size: 0.7rem; }

.health-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.health-item { padding: 13px; background: var(--ivory-50); border-radius: var(--radius-sm); }
.health-item span,
.health-item strong { display: block; }
.health-item span { color: var(--muted); font-size: 0.68rem; }
.health-item strong { margin: 5px 0; color: var(--navy-900); font-size: 0.82rem; }
.health-item small { color: var(--success); }
.health-item small.offline { color: var(--danger); }

.guest-heading { align-items: center; }
.trust-row { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.trust-row span { padding: 6px 10px; color: var(--success); background: #edf5f0; border: 1px solid #d7e9df; border-radius: 999px; font-size: 0.7rem; }

.guest-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(330px, 0.75fr);
    gap: clamp(40px, 8vw, 120px);
    align-items: center;
    min-height: 650px;
    padding: clamp(30px, 6vw, 80px);
    color: var(--white);
    background: var(--navy-950);
    border-radius: 30px;
    box-shadow: var(--shadow);
}

.guest-story h2 { max-width: 600px; color: var(--white); font-size: clamp(1.8rem, 4vw, 3rem); line-height: 1.12; }
.journey-list { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin: 30px 0; padding: 0; list-style: none; }
.journey-list li { display: flex; gap: 12px; padding: 14px; color: #afbec5; border: 1px solid rgba(255, 255, 255, 0.12); border-radius: var(--radius-sm); }
.journey-list li > span { display: grid; flex: 0 0 auto; width: 28px; height: 28px; place-items: center; color: var(--gold-200); border: 1px solid var(--gold-500); border-radius: 50%; }
.journey-list li strong { color: var(--white); }
.journey-list li p { margin: 3px 0 0; font-size: 0.75rem; }
.journey-list li.complete { background: rgba(49, 114, 91, 0.24); border-color: #4c8971; }
.privacy-card { padding: 17px; color: #cad5da; background: rgba(255, 255, 255, 0.06); border-left: 3px solid var(--gold-500); }
.privacy-card strong { color: var(--gold-200); }
.privacy-card p { margin: 5px 0 0; font-size: 0.78rem; }

.phone-shell {
    width: min(100%, 372px);
    margin: 0 auto;
    padding: 12px;
    color: var(--ink);
    background: #e9e3d8;
    border: 1px solid #ccbfa9;
    border-radius: 42px;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.35);
}

.phone-top { display: flex; justify-content: space-between; padding: 8px 15px 10px; color: var(--navy-800); font-size: 0.58rem; font-weight: 700; }
.phone-screen { min-height: 590px; padding: 22px; overflow: hidden; background: var(--ivory-50); border-radius: 30px; }
.phone-home { width: 96px; height: 4px; margin: 9px auto 3px; background: #8d8a83; border-radius: 99px; }
.mobile-brand { padding-bottom: 17px; border-bottom: 1px solid var(--ivory-200); }
.mobile-brand strong { display: block; color: var(--navy-950); font-family: Georgia, serif; }
.mobile-brand small { color: var(--gold-500); }

.phone-state { padding-top: 26px; text-align: center; }
.phone-state h2 { font-size: 1.6rem; }
.phone-state > p { color: var(--muted); font-size: 0.82rem; }
.phone-state > small { display: block; margin-top: 12px; color: var(--muted); }

.qr-simulation {
    position: relative;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 28px;
    width: 138px;
    height: 138px;
    margin: 12px auto 24px;
    padding: 12px;
    background: repeating-linear-gradient(45deg, var(--navy-900) 0 5px, transparent 5px 10px), var(--white);
    border: 8px solid var(--white);
    box-shadow: 0 6px 20px rgba(7, 27, 40, 0.12);
}

.qr-simulation span { width: 31px; height: 31px; background: var(--white); border: 7px solid var(--navy-950); }
.qr-simulation span:nth-child(3) { align-self: end; }
.qr-simulation b { position: absolute; right: 8px; bottom: 8px; padding: 3px; color: var(--white); background: var(--navy-950); font-size: 0.55rem; }

.mobile-room-heading { text-align: left; }
.mobile-room-heading h2 { margin: 0; font-size: 2.2rem; }
.mobile-room-heading p { margin: 0; color: var(--muted); font-size: 0.72rem; }
.connected-badge { color: var(--success); background: #e5f2eb; }
.mobile-grant { margin: 18px 0; padding: 10px; background: var(--white); border: 1px solid var(--ivory-200); border-radius: var(--radius-sm); }
.mobile-controls { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.mobile-controls > button,
.mobile-temperature { min-height: 88px; padding: 12px; text-align: left; color: var(--ink); background: var(--white); border: 1px solid var(--ivory-200); border-radius: var(--radius-sm); }
.mobile-controls > button span,
.mobile-controls > button strong,
.mobile-temperature > span { display: block; }
.mobile-controls > button span,
.mobile-temperature > span { color: var(--muted); font-size: 0.65rem; }
.mobile-controls > button strong { margin-top: 15px; color: var(--navy-900); }
.mobile-controls > button.active { border-color: var(--gold-500); background: #fcf7ec; }
.mobile-temperature > div { display: flex; align-items: center; justify-content: space-between; margin-top: 9px; }
.mobile-temperature button { width: 27px; min-height: 27px; font-size: 0.9rem; }
.mobile-temperature strong { font-size: 0.9rem; }
.session-note { margin: 16px 0 0; color: var(--success); font-size: 0.62rem; }

.revoked-state { padding-top: 90px; }
.revoked-mark { display: grid; width: 62px; height: 62px; margin: 0 auto 22px; place-items: center; color: var(--danger); background: #f8e9e8; border-radius: 50%; font-size: 2rem; }

.toast {
    position: fixed;
    z-index: 50;
    right: 24px;
    bottom: 24px;
    max-width: min(420px, calc(100vw - 48px));
    padding: 13px 18px;
    color: var(--white);
    background: var(--navy-800);
    border-left: 3px solid var(--gold-400);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow);
    opacity: 0;
    pointer-events: none;
    transform: translateY(15px);
    transition: opacity 180ms ease, transform 180ms ease;
}

.toast.show { opacity: 1; transform: translateY(0); }

@media (max-width: 1100px) {
    .metric-grid { grid-template-columns: repeat(3, 1fr); }
    .dashboard-grid,
    .lower-grid { grid-template-columns: 1fr; }
    .room-layout { grid-template-columns: minmax(0, 1fr) minmax(320px, 0.7fr); }
    .control-grid { grid-template-columns: 1fr 1fr; }
    .control-card:last-child { grid-column: span 2; }
    .health-grid { grid-template-columns: repeat(3, 1fr); }
    .scene-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 820px) {
    .topbar { align-items: flex-start; flex-direction: column; }
    .header-actions { width: 100%; flex-wrap: wrap; }
    .clock { text-align: left; }
    .header-actions .button { margin-left: auto; }
    .view-heading { align-items: flex-start; flex-direction: column; }
    .room-summary { justify-content: flex-start; }
    .room-layout { grid-template-columns: 1fr; }
    .room-detail { position: static; }
    .smart-hero { align-items: flex-start; flex-direction: column; }
    .environment-readings { width: 100%; justify-content: space-between; }
    .guest-layout { grid-template-columns: 1fr; padding: 34px 22px; }
    .guest-story { order: 2; }
    .phone-shell { order: 1; }
}

@media (max-width: 620px) {
    main { padding-top: 26px; }
    .status-strip { align-items: flex-start; flex-wrap: wrap; }
    .privacy-chip { margin-left: 17px; }
    .metric-grid { grid-template-columns: repeat(2, 1fr); }
    .metric-card:last-child { grid-column: span 2; }
    .room-grid,
    .control-grid { grid-template-columns: 1fr; }
    .control-card:last-child { grid-column: auto; }
    .health-grid { grid-template-columns: repeat(2, 1fr); }
    .scene-grid,
    .journey-list { grid-template-columns: 1fr; }
    .panel,
    .control-card { padding: 18px; border-radius: var(--radius-md); }
    .alert-item { grid-template-columns: auto 1fr; }
    .alert-item button { grid-column: 2; justify-self: start; }
    .chart { gap: 5px; }
    .environment-readings { gap: 10px; }
    .environment-readings strong { font-size: 1.25rem; }
}

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