:root {
  color-scheme: dark;
  --bg: #06101d;
  --bg-2: #091827;
  --panel: rgba(13, 29, 47, .86);
  --panel-solid: #0d1d2f;
  --panel-hover: #12263b;
  --line: rgba(148, 176, 204, .14);
  --line-strong: rgba(148, 176, 204, .26);
  --text: #f4f8fc;
  --muted: #8da2b8;
  --muted-2: #62778d;
  --cyan: #55dce7;
  --cyan-soft: rgba(85, 220, 231, .14);
  --green: #5de0a1;
  --green-soft: rgba(93, 224, 161, .14);
  --amber: #ffbf5b;
  --amber-soft: rgba(255, 191, 91, .14);
  --red: #ff6b7a;
  --red-soft: rgba(255, 107, 122, .14);
  --violet: #9f8cff;
  --violet-soft: rgba(159, 140, 255, .14);
  --shadow: 0 24px 70px rgba(0, 0, 0, .28);
  --radius-xl: 24px;
  --radius-lg: 18px;
  --radius-md: 14px;
  --sidebar: 242px;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--bg); scroll-behavior: smooth; }
body { min-width: 320px; min-height: 100vh; margin: 0; color: var(--text); background: var(--bg); overflow-x: hidden; }
button, input { font: inherit; }
button { color: inherit; }
a { color: inherit; }
svg { display: block; width: 100%; height: 100%; }
::selection { color: #06101d; background: var(--cyan); }

.app-shell { position: relative; min-height: 100vh; display: grid; grid-template-columns: var(--sidebar) minmax(0, 1fr); isolation: isolate; }
.app-shell::before { content: ""; position: fixed; inset: 0; z-index: -4; pointer-events: none; background-image: linear-gradient(rgba(148,176,204,.025) 1px, transparent 1px), linear-gradient(90deg, rgba(148,176,204,.025) 1px, transparent 1px); background-size: 40px 40px; mask-image: radial-gradient(circle at center, #000, transparent 82%); }
.ambient { position: fixed; z-index: -3; border-radius: 999px; filter: blur(90px); opacity: .2; pointer-events: none; animation: ambientFloat 18s ease-in-out infinite; }
.ambient-a { width: 420px; height: 420px; left: -130px; top: -150px; background: #329dbd; }
.ambient-b { width: 480px; height: 480px; right: -160px; top: -180px; background: #6646c6; animation-delay: -6s; }
.ambient-c { width: 380px; height: 380px; left: 45%; bottom: -210px; background: #3cbfba; animation-delay: -12s; }
@keyframes ambientFloat { 0%,100% { transform: translate3d(0,0,0) scale(1); } 50% { transform: translate3d(28px,20px,0) scale(1.08); } }

.sidebar { position: sticky; top: 0; z-index: 20; height: 100vh; padding: 28px 18px 20px; border-right: 1px solid var(--line); background: rgba(6, 16, 29, .79); backdrop-filter: blur(22px); display: flex; flex-direction: column; }
.brand { display: flex; align-items: center; gap: 12px; padding: 0 8px 26px; }
.brand-mark { width: 42px; height: 42px; flex: 0 0 auto; padding: 6px; color: var(--cyan); border: 1px solid rgba(223, 110, 75, .34); border-radius: 14px; background: rgba(244,240,231,.055) url("/static/brand/logo-icon-reversed.svg") center / 30px 30px no-repeat; box-shadow: inset 0 0 24px rgba(244,240,231,.04), 0 10px 30px rgba(223,110,75,.08); }
.brand-mark svg { opacity: 0; }
.brand strong { display: block; font-size: 18px; letter-spacing: -.02em; }
.brand span { display: block; margin-top: 3px; color: var(--muted-2); font-size: 9px; letter-spacing: .18em; }
.nav-list { display: grid; gap: 7px; }
.nav-item { position: relative; width: 100%; min-height: 46px; border: 0; border-radius: 13px; background: transparent; display: flex; align-items: center; gap: 13px; padding: 0 14px; color: var(--muted); text-decoration: none; cursor: pointer; transition: color .2s ease, background .2s ease; overflow: hidden; }
.nav-item > span:first-child { width: 20px; height: 20px; flex: 0 0 auto; }
.nav-item:hover { color: var(--text); background: rgba(255,255,255,.035); }
.nav-item.active { color: var(--cyan); background: var(--cyan-soft); }
.nav-active-rail { position: absolute; left: 0; top: 9px; bottom: 9px; width: 3px; border-radius: 0 4px 4px 0; background: var(--cyan); box-shadow: 0 0 18px rgba(85,220,231,.6); }
.side-card { margin-top: auto; padding: 16px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: linear-gradient(145deg, rgba(85,220,231,.09), rgba(255,255,255,.02)); display: flex; gap: 12px; box-shadow: 0 14px 35px rgba(0,0,0,.12); }
.side-card__icon { width: 28px; height: 28px; flex: 0 0 auto; color: var(--green); }
.side-card strong { display: block; font-size: 13px; }
.side-card p { margin: 5px 0 0; color: var(--muted); font-size: 11px; line-height: 1.45; }
.sidebar-foot { display: grid; grid-template-columns: 36px minmax(0, 1fr) 34px; gap: 10px; align-items: center; margin-top: 16px; padding: 15px 7px 0; border-top: 1px solid var(--line); }
.sidebar-foot.report-user { grid-template-columns: 36px minmax(0,1fr); }
.avatar { width: 36px; height: 36px; border-radius: 12px; display: grid; place-items: center; background: linear-gradient(135deg, #705fca, #4e9abb); font-size: 12px; font-weight: 700; box-shadow: 0 8px 22px rgba(94,83,186,.2); }
.sidebar-foot strong { display: block; font-size: 12px; }
.sidebar-foot span { display: block; margin-top: 3px; color: var(--muted-2); font-size: 9px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.main-content { min-width: 0; padding: 30px clamp(22px, 3.2vw, 52px) 26px; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 24px; margin-bottom: 24px; }
.eyebrow { margin: 0 0 7px; color: var(--muted-2); font-size: 10px; font-weight: 700; letter-spacing: .15em; }
h1, h2, h3, p { text-wrap: balance; }
h1 { margin: 0; font-size: clamp(25px, 2.2vw, 36px); letter-spacing: -.04em; }
h2 { margin: 0; font-size: 20px; letter-spacing: -.025em; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.connection-pill { height: 40px; padding: 0 14px; border: 1px solid rgba(93,224,161,.18); border-radius: 12px; display: flex; align-items: center; gap: 9px; color: var(--green); background: var(--green-soft); font-size: 12px; font-weight: 600; }
.connection-pill.offline { color: var(--red); border-color: rgba(255,107,122,.2); background: var(--red-soft); }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.clock-card { height: 40px; min-width: 128px; padding: 0 12px; border: 1px solid var(--line); border-radius: 12px; display: flex; align-items: center; gap: 9px; background: rgba(255,255,255,.022); }
.clock-card > span { width: 18px; height: 18px; color: var(--cyan); }
.clock-card strong { display: block; font-size: 13px; font-variant-numeric: tabular-nums; }
.clock-card div span { display: block; margin-top: 2px; color: var(--muted-2); font-size: 8px; text-transform: uppercase; letter-spacing: .08em; }
.icon-button { position: relative; width: 38px; height: 38px; padding: 10px; border: 1px solid var(--line); border-radius: 12px; background: rgba(255,255,255,.025); color: var(--muted); cursor: pointer; transition: color .2s ease, border-color .2s ease, background .2s ease; }
.icon-button:hover { color: var(--text); border-color: var(--line-strong); background: rgba(255,255,255,.05); }
.notification-dot { position: absolute; top: 6px; right: 6px; width: 8px; height: 8px; border: 2px solid var(--bg); border-radius: 50%; background: var(--red); }

.alert-banner { margin-bottom: 18px; padding: 15px 17px; border: 1px solid rgba(255,107,122,.3); border-radius: var(--radius-lg); background: linear-gradient(90deg, rgba(255,107,122,.16), rgba(255,107,122,.05)); display: grid; grid-template-columns: 38px minmax(0,1fr) auto; gap: 13px; align-items: center; box-shadow: 0 10px 40px rgba(255,107,122,.05); overflow: hidden; }
.alert-banner__icon { width: 38px; height: 38px; padding: 9px; border-radius: 12px; color: var(--red); background: var(--red-soft); }
.alert-banner strong { font-size: 13px; }
.alert-banner p { margin: 4px 0 0; color: #f4b1b8; font-size: 12px; }
.alert-action, .primary-button { border: 0; border-radius: 11px; padding: 10px 14px; background: var(--text); color: #08111c; font-size: 11px; font-weight: 700; cursor: pointer; }

.hero-panel { position: relative; overflow: hidden; min-height: 210px; margin-bottom: 16px; padding: clamp(24px, 3vw, 40px); border: 1px solid rgba(85,220,231,.18); border-radius: var(--radius-xl); background: linear-gradient(100deg, rgba(18,56,75,.88), rgba(13,29,47,.8) 52%, rgba(40,30,75,.62)), radial-gradient(circle at 80% 40%, rgba(85,220,231,.22), transparent 18rem); box-shadow: var(--shadow); display: flex; align-items: center; justify-content: space-between; gap: 28px; }
.hero-panel.hero-alert { border-color: rgba(255,107,122,.28); background: linear-gradient(100deg, rgba(88,35,48,.74), rgba(13,29,47,.83) 55%, rgba(63,30,68,.6)); }
.hero-panel::before { content: ""; position: absolute; inset: 0; pointer-events: none; background-image: linear-gradient(rgba(255,255,255,.025) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.025) 1px, transparent 1px); background-size: 28px 28px; mask-image: linear-gradient(90deg, transparent, #000 45%, #000); }
.hero-aura { position: absolute; width: 300px; height: 300px; right: 40px; top: -80px; border-radius: 50%; background: radial-gradient(circle, rgba(85,220,231,.18), transparent 64%); filter: blur(2px); pointer-events: none; }
.hero-copy, .safety-orbit { position: relative; z-index: 1; }
.hero-state { width: fit-content; display: flex; align-items: center; gap: 9px; padding: 7px 11px; border: 1px solid rgba(93,224,161,.2); border-radius: 999px; color: var(--green); background: var(--green-soft); font-size: 10px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; }
.hero-state.attention { color: var(--red); border-color: rgba(255,107,122,.25); background: var(--red-soft); }
.pulse-dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.hero-copy h2 { margin-top: 15px; font-size: clamp(28px,3vw,42px); letter-spacing: -.05em; }
.hero-copy > p { max-width: 610px; margin: 10px 0 0; color: #a8bdce; font-size: 14px; line-height: 1.6; }
.hero-meta { display: flex; flex-wrap: wrap; gap: 18px; margin-top: 21px; }
.hero-meta > span { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 11px; }
.hero-meta svg { width: 16px; height: 16px; color: var(--cyan); }
.hero-meta b { color: #b7c8d8; font-weight: 500; }
.safety-orbit { width: 144px; height: 144px; flex: 0 0 auto; display: grid; place-items: center; }
.safety-orbit svg { position: relative; z-index: 1; width: 140px; height: 140px; transform: rotate(-90deg); }
.orbit-track, .orbit-value { fill: none; stroke-width: 9; }
.orbit-track { stroke: rgba(148,176,204,.13); }
.orbit-value { stroke-linecap: round; stroke-dasharray: 351.86; }
.orbit-halo { position: absolute; inset: 2px; border-radius: 50%; background: conic-gradient(from 0deg, transparent, rgba(85,220,231,.3), transparent 35%, transparent); filter: blur(8px); opacity: .55; }
.orbit-label { position: absolute; z-index: 2; inset: 0; display: grid; place-content: center; text-align: center; }
.orbit-label strong { font-size: 17px; letter-spacing: -.02em; }
.orbit-label span { margin-top: 4px; color: var(--muted-2); font-size: 9px; line-height: 1.25; }

.metric-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 13px; margin-bottom: 16px; }
.metric-card { position: relative; overflow: hidden; min-height: 94px; padding: 17px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--panel); display: flex; align-items: center; gap: 13px; box-shadow: 0 16px 44px rgba(0,0,0,.12); }
.metric-card::after { content: ""; position: absolute; inset: 0; opacity: 0; background: linear-gradient(115deg, transparent 25%, rgba(255,255,255,.05), transparent 65%); transform: translateX(-35%); transition: opacity .25s ease, transform .5s ease; pointer-events: none; }
.metric-card:hover::after { opacity: 1; transform: translateX(35%); }
.metric-icon { position: relative; width: 42px; height: 42px; flex: 0 0 auto; padding: 10px; border-radius: 13px; }
.metric-icon.cyan { color: var(--cyan); background: var(--cyan-soft); }
.metric-icon.violet { color: var(--violet); background: var(--violet-soft); }
.metric-icon.amber { color: var(--amber); background: var(--amber-soft); }
.metric-icon.green { color: var(--green); background: var(--green-soft); }
.metric-pulse { position: absolute; inset: 0; border: 1px solid currentColor; border-radius: inherit; pointer-events: none; }
.metric-card > div:nth-child(2) { position: relative; z-index: 2; min-width: 0; }
.metric-card span { display: block; color: var(--muted); font-size: 10px; }
.metric-card strong { display: flex; align-items: baseline; flex-wrap: wrap; gap: 5px; margin-top: 3px; font-size: 22px; line-height: 1.08; font-weight: 800; letter-spacing: -.03em; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.metric-card small { display: block; margin-top: 4px; color: var(--muted-2); font-size: 9px; line-height: 1.3; white-space: normal; overflow-wrap: anywhere; }
.metric-glow { position: absolute; width: 90px; height: 90px; right: -36px; bottom: -50px; border-radius: 50%; background: currentColor; opacity: .04; filter: blur(4px); }

.content-grid { display: grid; grid-template-columns: minmax(0,1fr) 350px; gap: 16px; align-items: start; }
.panel { position: relative; border: 1px solid var(--line); border-radius: var(--radius-xl); background: var(--panel); box-shadow: 0 18px 50px rgba(0,0,0,.14); }
.rooms-panel { padding: 21px 22px 22px; scroll-margin-top: 22px; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 16px; }
.section-head.compact { margin-bottom: 14px; }
.segmented { position: relative; padding: 3px; border: 1px solid var(--line); border-radius: 12px; background: rgba(255,255,255,.02); display: flex; }
.segmented button { position: relative; z-index: 1; min-width: 75px; height: 32px; border: 0; border-radius: 9px; background: transparent; color: var(--muted); font-size: 10px; cursor: pointer; }
.segmented button.active { color: var(--text); }
.segmented button i { position: absolute; z-index: -1; inset: 0; border-radius: 9px; background: rgba(255,255,255,.07); box-shadow: inset 0 0 0 1px rgba(255,255,255,.04); }
.rooms-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px,1fr)); gap: 12px; perspective: 900px; }
.room-card { position: relative; min-width: 0; overflow: hidden; padding: 16px; border: 1px solid var(--line); border-radius: 17px; background: linear-gradient(145deg, rgba(17,37,58,.9), rgba(11,25,42,.78)); cursor: pointer; outline: none; transform-style: preserve-3d; }
.room-card:focus-visible { box-shadow: 0 0 0 2px var(--cyan); }
.room-card::before { content: ""; position: absolute; inset: 0; border-radius: inherit; background: radial-gradient(circle at 0 0, var(--accent-soft), transparent 58%); pointer-events: none; }
.room-card.attention { border-color: rgba(255,191,91,.3); }
.room-card-sheen { position: absolute; inset: 0; background: linear-gradient(115deg, transparent 30%, rgba(255,255,255,.045), transparent 62%); transform: translateX(-120%); transition: transform .7s ease; }
.room-card:hover .room-card-sheen { transform: translateX(120%); }
.room-head, .room-primary, .room-details { position: relative; z-index: 1; }
.room-head { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.room-title { min-width: 0; display: flex; align-items: center; gap: 10px; }
.room-icon { width: 38px; height: 38px; flex: 0 0 auto; padding: 9px; border-radius: 12px; color: var(--accent); background: var(--accent-soft); }
.room-title strong { display: block; font-size: 13px; }
.room-title span { display: block; margin-top: 4px; color: var(--muted-2); font-size: 9px; }
.online-chip { display: flex; align-items: center; gap: 5px; padding: 4px 7px; border-radius: 999px; color: var(--green); background: var(--green-soft); font-size: 8px; text-transform: uppercase; }
.online-chip i { width: 5px; height: 5px; border-radius: 50%; background: currentColor; box-shadow: 0 0 8px currentColor; }
.room-primary { display: grid; grid-template-columns: minmax(70px, auto) 1fr; gap: 10px; align-items: end; margin-top: 17px; }
.primary-value { display: flex; align-items: baseline; gap: 4px; }
.primary-value strong { font-size: 28px; line-height: 1; letter-spacing: -.05em; font-variant-numeric: tabular-nums; }
.primary-value span { color: var(--muted); font-size: 12px; }
.sparkline { width: 100%; height: 34px; color: var(--spark-accent); }
.sparkline .fill { fill: color-mix(in srgb, var(--spark-accent) 18%, transparent); }
.sparkline .line { fill: none; stroke: var(--spark-accent); stroke-width: 1.5; vector-effect: non-scaling-stroke; }
.presence-pill { grid-column: 1 / -1; width: fit-content; margin-top: 2px; padding: 5px 9px; border-radius: 999px; color: var(--green); background: var(--green-soft); font-size: 9px; font-weight: 600; }
.presence-pill.quiet { color: var(--muted); background: rgba(148,176,204,.08); }
.room-details { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 8px; margin-top: 13px; }
.detail-cell { min-width: 0; min-height: 58px; padding: 10px 11px; border: 1px solid rgba(148,176,204,.09); border-radius: 11px; background: rgba(255,255,255,.018); display: flex; flex-direction: column; justify-content: center; }
.room-details > .detail-cell:last-child:nth-child(odd) { grid-column: 1 / -1; }
.detail-cell span { display: block; color: var(--muted-2); font-size: 9px; line-height: 1.2; white-space: normal; overflow-wrap: anywhere; }
.detail-cell strong { display: block; margin-top: 5px; color: #c7d4df; font-size: 11px; line-height: 1.22; white-space: normal; overflow-wrap: anywhere; text-wrap: balance; }
.empty-state { grid-column: 1 / -1; min-height: 120px; padding: 28px; display: grid; place-items: center; color: var(--muted); font-size: 12px; text-align: center; }

.right-rail { display: grid; gap: 16px; align-content: start; }
.vitals-panel, .timeline-panel { padding: 20px 21px; }
.live-chip { display: flex; align-items: center; gap: 5px; color: var(--red); font-size: 9px; font-weight: 700; }
.live-chip i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.vitals-location { min-height: 34px; padding: 0 10px; border: 1px solid var(--line); border-radius: 11px; background: rgba(255,255,255,.02); display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 10px; }
.vitals-location svg { width: 15px; height: 15px; color: var(--cyan); }
.vitals-wave { height: 52px; margin-top: 10px; color: var(--green); opacity: .8; overflow: hidden; mask-image: linear-gradient(90deg, transparent, #000 10%, #000 90%, transparent); }
.vitals-values { display: grid; grid-template-columns: 1fr 1px 1fr; gap: 13px; align-items: center; margin-top: 2px; }
.vital-main { display: flex; align-items: center; gap: 10px; }
.heart-animation, .breath-animation { width: 39px; height: 39px; flex: 0 0 auto; padding: 8px; border-radius: 13px; }
.heart-animation { color: var(--red); background: var(--red-soft); }
.breath-animation { color: var(--cyan); background: var(--cyan-soft); }
.vital-main strong { display: block; font-size: 36px; line-height: 1; letter-spacing: -.04em; font-variant-numeric: tabular-nums; }
.vital-main span { display: block; margin-top: 4px; color: var(--muted-2); font-size: 11px; }
.vital-divider { width: 1px; height: 48px; background: var(--line); }
.confidence-row { margin-top: 15px; padding-top: 13px; border-top: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 10px; color: var(--muted); font-size: 9px; }
.confidence-bars { display: flex; gap: 3px; align-items: flex-end; }
.confidence-bars i { width: 4px; border-radius: 2px; background: rgba(148,176,204,.16); }
.confidence-bars i:nth-child(1) { height: 5px; } .confidence-bars i:nth-child(2) { height: 8px; } .confidence-bars i:nth-child(3) { height: 11px; } .confidence-bars i:nth-child(4) { height: 14px; }
.confidence-bars.stable i { background: var(--green); } .confidence-bars.measuring i:nth-child(-n+2) { background: var(--amber); } .confidence-bars.multi i:nth-child(1) { background: var(--red); }
.coverage-list { display: grid; gap: 7px; margin-top: 12px; }
.coverage-item { display: grid; grid-template-columns: 6px 1fr auto; gap: 8px; align-items: center; min-height: 33px; padding: 0 10px; border: 1px solid var(--line); border-radius: 10px; color: var(--muted); font-size: 10px; }
.coverage-item > i { width: 6px; height: 6px; border-radius: 50%; background: var(--muted-2); }
.coverage-item b { color: var(--muted-2); font-size: 8px; font-weight: 500; }
.coverage-item.active { color: var(--text); border-color: rgba(93,224,161,.18); background: rgba(93,224,161,.045); }
.coverage-item.active > i { background: var(--green); box-shadow: 0 0 9px var(--green); }
.coverage-item.active b { color: var(--green); }

.timeline-panel { scroll-margin-top: 22px; }
.text-button { border: 0; background: none; color: var(--cyan); font-size: 9px; cursor: pointer; }
.timeline { display: grid; }
.timeline-item { position: relative; min-width: 0; display: grid; grid-template-columns: 32px minmax(0,1fr) auto; gap: 10px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.timeline-item:last-child { border-bottom: 0; }
.event-icon { width: 32px; height: 32px; padding: 8px; border-radius: 10px; color: var(--cyan); background: var(--cyan-soft); }
.timeline-item.sound .event-icon { color: var(--amber); background: var(--amber-soft); }
.timeline-item.alert .event-icon { color: var(--red); background: var(--red-soft); }
.timeline-item.info .event-icon { color: var(--violet); background: var(--violet-soft); }
.timeline-item strong { display: block; min-width: 0; font-size: 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.timeline-item span { display: block; margin-top: 3px; color: var(--muted-2); font-size: 8px; }
.timeline-time { color: var(--muted); font-size: 9px; font-variant-numeric: tabular-nums; }
.footer-row { display: flex; justify-content: space-between; gap: 18px; margin-top: 20px; color: var(--muted-2); font-size: 10px; }

.modal-backdrop { position: fixed; inset: 0; z-index: 80; padding: 24px; background: rgba(2,8,15,.78); backdrop-filter: blur(12px); display: grid; place-items: center; }
.dialog-card { width: min(980px, 100%); max-height: calc(100vh - 48px); overflow: auto; padding: 22px; border: 1px solid var(--line-strong); border-radius: 24px; background: linear-gradient(145deg, rgba(15,34,54,.98), rgba(8,20,35,.98)); box-shadow: 0 30px 100px rgba(0,0,0,.48); }
.dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.dialog-stats { display: grid; grid-template-columns: repeat(4,1fr); gap: 10px; margin-top: 18px; }
.dialog-stat { padding: 13px; border: 1px solid var(--line); border-radius: 13px; background: rgba(255,255,255,.02); }
.dialog-stat span { display: block; color: var(--muted-2); font-size: 9px; }
.dialog-stat strong { display: block; margin-top: 5px; font-size: 16px; }
.history-chart { position: relative; width: 100%; margin-top: 16px; border: 1px solid var(--line); border-radius: 16px; background: rgba(4,13,24,.36); overflow: hidden; }
.history-chart > svg { width: 100%; height: 300px; }
.chart-grid-line { stroke: rgba(148,176,204,.12); stroke-width: 1; vector-effect: non-scaling-stroke; }
.chart-axis-label { fill: var(--muted-2); font-size: 9px; }
.chart-hover-line { stroke: rgba(255,255,255,.2); stroke-width: 1; stroke-dasharray: 4 4; vector-effect: non-scaling-stroke; }
.chart-hover-dot { fill: #fff; stroke: var(--cyan); stroke-width: 3; vector-effect: non-scaling-stroke; }
.chart-tooltip { position: absolute; transform: translate(-50%,-100%); z-index: 3; padding: 7px 9px; border: 1px solid var(--line-strong); border-radius: 9px; color: var(--text); background: rgba(5,15,26,.94); font-size: 9px; white-space: nowrap; pointer-events: none; }
.chart-empty, .history-loading { min-height: 300px; display: grid; place-items: center; color: var(--muted); }
.history-loading { align-content: center; gap: 12px; }
.history-loading span { width: 28px; height: 28px; border: 2px solid var(--line-strong); border-top-color: var(--cyan); border-radius: 50%; animation: spin 1s linear infinite; }
.history-loading p { margin: 0; font-size: 12px; }
.dialog-foot { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 15px; color: var(--muted); font-size: 10px; }
.primary-button { display: flex; align-items: center; gap: 7px; }
.primary-button svg { width: 14px; height: 14px; }
.toast { position: fixed; z-index: 100; left: 50%; bottom: 24px; transform: translateX(-50%); max-width: min(480px, calc(100vw - 30px)); padding: 11px 15px; border: 1px solid var(--line-strong); border-radius: 12px; color: var(--text); background: rgba(10,25,41,.96); box-shadow: 0 18px 50px rgba(0,0,0,.35); font-size: 11px; text-align: center; }

.loading-shell { position: fixed; inset: 0; display: grid; place-content: center; justify-items: center; gap: 18px; background: radial-gradient(circle at center, rgba(28,68,91,.35), transparent 32rem), var(--bg); }
.loading-brand { display: flex; align-items: center; gap: 11px; font-size: 15px; font-weight: 700; }
.loading-brand .brand-mark { width: 38px; height: 38px; }
.loading-orbit { width: 44px; height: 44px; border: 2px solid var(--line-strong); border-top-color: var(--cyan); border-radius: 50%; box-shadow: 0 0 28px rgba(85,220,231,.16); }
.loading-shell p { margin: 0; color: var(--muted); font-size: 11px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Daily report */
.report-topbar { align-items: flex-end; }
.datenav { height: 42px; padding: 0 7px; border: 1px solid var(--line); border-radius: 13px; background: rgba(255,255,255,.025); display: grid; grid-template-columns: 30px minmax(170px,auto) 30px; align-items: center; gap: 5px; }
.datenav button { width: 30px; height: 30px; padding: 7px; border: 0; border-radius: 9px; background: transparent; color: var(--muted); cursor: pointer; }
.datenav button:hover { color: var(--text); background: rgba(255,255,255,.05); }
.datenav > span { text-align: center; font-size: 12px; font-weight: 600; text-transform: capitalize; }
.report-banner { position: relative; overflow: hidden; min-height: 78px; margin-bottom: 16px; padding: 17px 20px; border: 1px solid var(--line); border-radius: var(--radius-lg); display: flex; align-items: center; gap: 14px; }
.report-banner.ok { color: var(--green); border-color: rgba(93,224,161,.28); background: linear-gradient(90deg, var(--green-soft), rgba(93,224,161,.04)); }
.report-banner.warn { color: var(--amber); border-color: rgba(255,191,91,.3); background: linear-gradient(90deg, var(--amber-soft), rgba(255,191,91,.04)); }
.report-banner.info { color: var(--cyan); background: linear-gradient(90deg, var(--cyan-soft), rgba(85,220,231,.03)); }
.report-banner-orb { width: 16px; height: 16px; flex: 0 0 auto; border: 4px solid currentColor; border-radius: 50%; box-shadow: 0 0 22px currentColor; }
.report-banner strong { display: block; font-size: 14px; }
.report-banner .rb-sub { display: block; margin-top: 5px; color: var(--text); font-size: 11px; }
.report-metric-grid { grid-template-columns: repeat(4,minmax(0,1fr)); }
.report-metric strong { font-size: 20px; }
.vs { display: inline-flex !important; align-items: center; margin-left: 4px; padding: 3px 7px; border-radius: 999px; font-size: 8px !important; font-weight: 700; vertical-align: middle; }
.vs.normal { color: var(--green); background: var(--green-soft); }
.vs.high, .vs.low { color: var(--amber); background: var(--amber-soft); }
.report-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 16px; }
.report-panel { min-height: 190px; padding: 20px 22px; }
.report-panel.wide-panel { grid-column: 1 / -1; }
.report-panel-title { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; color: var(--muted-2); font-size: 10px; font-weight: 700; letter-spacing: .13em; text-transform: uppercase; }
.report-panel-title i { height: 1px; flex: 1; background: linear-gradient(90deg,var(--line),transparent); }
.cmp-row { display: flex; align-items: center; gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.cmp-row:last-child { border-bottom: 0; }
.cmp-ic { width: 40px; height: 40px; flex: 0 0 auto; padding: 9px; border-radius: 12px; }
.cmp-ic.heart { color: var(--red); background: var(--red-soft); }
.cmp-ic.breath { color: var(--cyan); background: var(--cyan-soft); }
.cmp-body { min-width: 0; flex: 1; }
.cmp-now { display: flex; align-items: center; gap: 5px; font-size: 24px; letter-spacing: -.04em; line-height: 1; }
.cmp-now b { color: var(--muted); font-size: 12px; font-weight: 500; }
.cmp-norm, .rp-sub { margin-top: 5px; color: var(--muted-2); font-size: 11px; }
.rp-big { font-size: 31px; letter-spacing: -.04em; }
.rp-big b { color: var(--muted); font-size: 13px; font-weight: 500; }
.night-vitals { min-height: 120px; display: flex; align-items: center; gap: 18px; }
.night-heart { position: relative; width: 70px; height: 70px; flex: 0 0 auto; padding: 16px; border-radius: 24px; color: var(--red); background: var(--red-soft); }
.night-heart i { position: absolute; inset: -8px; border: 1px solid rgba(255,107,122,.28); border-radius: 28px; }
.bar-row { display: grid; grid-template-columns: 125px minmax(0,1fr) 64px; gap: 11px; align-items: center; margin: 12px 0; }
.bar-label { color: var(--muted); font-size: 11px; }
.bar-track { height: 16px; border-radius: 8px; background: rgba(255,255,255,.05); overflow: hidden; }
.bar-fill { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg,var(--cyan),var(--violet)); box-shadow: 0 0 18px rgba(85,220,231,.18); }
.bar-val { color: var(--text); font-size: 11px; font-weight: 600; text-align: right; }
.transition-row { min-height: 42px; padding: 0 4px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 12px; color: var(--muted); font-size: 11px; }
.transition-row:last-of-type { border-bottom: 0; }
.transition-row b { color: var(--cyan); }
.transition-row strong { color: var(--text); font-size: 13px; }
.report-loading { min-height: 330px; display: grid; place-content: center; justify-items: center; gap: 13px; color: var(--muted); }
.report-loading span { width: 34px; height: 34px; border: 2px solid var(--line-strong); border-top-color: var(--cyan); border-radius: 50%; }
.report-loading p { margin: 0; font-size: 12px; }
.report-error { min-height: 220px; padding: 28px; border: 1px solid rgba(255,107,122,.25); border-radius: var(--radius-lg); background: var(--red-soft); color: #ffc1c7; display: grid; place-items: center; text-align: center; }

@media (max-width: 1200px) {
  .metric-grid { grid-template-columns: repeat(3,minmax(0,1fr)); }
  .content-grid { grid-template-columns: minmax(0,1fr) 330px; }
}
@media (max-width: 980px) {
  :root { --sidebar: 88px; }
  .sidebar { padding-inline: 14px; }
  .brand { justify-content: center; padding-inline: 0; }
  .brand > div:last-child, .nav-item > span:last-of-type, .side-card > div:last-child, .sidebar-foot > div:not(.avatar), .sidebar-foot .icon-button { display: none; }
  .nav-item { justify-content: center; padding: 0; }
  .side-card { justify-content: center; padding: 13px; }
  .sidebar-foot { display: flex; justify-content: center; padding-inline: 0; }
  .content-grid { grid-template-columns: 1fr; }
  .right-rail { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .report-grid { grid-template-columns: 1fr; }
  .report-panel.wide-panel { grid-column: auto; }
}
@media (max-width: 760px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 12px; right: 12px; bottom: 12px; top: auto; width: auto; height: 66px; padding: 8px; border: 1px solid var(--line-strong); border-radius: 18px; background: rgba(6,16,29,.92); box-shadow: 0 18px 50px rgba(0,0,0,.36); }
  .brand, .side-card, .sidebar-foot { display: none; }
  .nav-list { height: 100%; grid-template-columns: repeat(7,1fr); gap: 4px; }
  .nav-item { min-height: 48px; border-radius: 12px; }
  .nav-item > span:first-child { width: 21px; height: 21px; }
  .nav-active-rail { left: 25%; right: 25%; top: auto; bottom: 2px; width: auto; height: 2px; border-radius: 3px; }
  .main-content { padding: 22px 16px 104px; }
  .topbar { display: grid; grid-template-columns: minmax(0,1fr); align-items: start; gap: 16px; }
  .topbar-actions { width: 100%; display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 8px; align-items: center; }
  .connection-pill { grid-column: 1 / 3; grid-row: 1; width: 100%; min-width: 0; justify-content: center; white-space: nowrap; }
  .topbar-actions #soundToggle { grid-column: 3; grid-row: 1; justify-self: end; }
  .topbar-actions .notification-button { grid-column: 4; grid-row: 1; justify-self: start; }
  .clock-card { display: none; }
  .hero-panel { min-height: 0; padding: 22px; display: grid; grid-template-columns: minmax(0,1fr); }
  .safety-orbit { width: 150px; height: 150px; justify-self: center; }
  .safety-orbit svg { width: 146px; height: 146px; }
  .orbit-label { inset: 12px; }
  .orbit-label strong { max-width: 112px; font-size: 15px; line-height: 1.08; overflow-wrap: anywhere; }
  .hero-meta { display: grid; gap: 8px; }
  .metric-grid, .right-rail, .report-metric-grid { grid-template-columns: 1fr; }
  .rooms-grid { grid-template-columns: 1fr; }
  .section-head { align-items: flex-start; flex-direction: column; }
  .segmented { width: 100%; }
  .segmented button { flex: 1; min-width: 0; }
  .dialog-stats { grid-template-columns: repeat(2,1fr); }
  .history-chart > svg { height: 260px; }
  .report-topbar { align-items: flex-start; flex-direction: column; }
  .datenav { width: 100%; grid-template-columns: 34px 1fr 34px; }
  .bar-row { grid-template-columns: 92px minmax(0,1fr) 52px; }
}
@media (max-width: 520px) {
  .topbar { gap: 14px; }
  .topbar-actions { gap: 7px; }
  .metric-card { min-height: 86px; }
  .alert-banner { grid-template-columns: 38px minmax(0,1fr); }
  .alert-action { grid-column: 1 / -1; }
  .room-details { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .vitals-values { grid-template-columns: 1fr; }
  .vital-divider { width: 100%; height: 1px; }
  .footer-row { flex-direction: column; gap: 7px; }
  .modal-backdrop { padding: 10px; }
  .dialog-card { max-height: calc(100vh - 20px); padding: 16px; border-radius: 18px; }
  .dialog-foot { align-items: stretch; flex-direction: column; }
  .primary-button { justify-content: center; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  .ambient { display: none; }
}


.demo-disclosure {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 100;
  padding: 8px 11px;
  border: 1px solid rgba(85, 220, 231, .28);
  border-radius: 10px;
  color: var(--cyan);
  background: rgba(6, 16, 29, .92);
  box-shadow: 0 12px 30px rgba(0, 0, 0, .24);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .12em;
  pointer-events: none;
}

.demo-language-switcher {
  position: fixed;
  top: 14px;
  right: 16px;
  z-index: 120;
  display: flex;
  gap: 3px;
  padding: 4px;
  border: 1px solid rgba(85, 220, 231, .22);
  border-radius: 12px;
  background: rgba(6, 16, 29, .9);
  box-shadow: 0 12px 30px rgba(0, 0, 0, .24);
  backdrop-filter: blur(12px);
}

.demo-language-switcher a {
  min-width: 34px;
  padding: 6px 7px;
  border-radius: 8px;
  color: var(--muted);
  font-family: "JetBrains Mono", monospace;
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
  text-align: center;
  text-decoration: none;
}

.demo-language-switcher a:hover,
.demo-language-switcher a:focus-visible {
  color: var(--text);
  background: rgba(85, 220, 231, .1);
  outline: none;
}

.demo-language-switcher a[aria-current="page"] {
  color: #06121d;
  background: var(--cyan);
}

@media (max-width: 760px) {
  .demo-language-switcher { top: 10px; right: 10px; }
}
