:root {
  --bg: #04161d;
  --card: rgba(255, 255, 255, 0.06);
  --card-border: rgba(255, 255, 255, 0.1);
  --text: #eaf6fb;
  --muted: #9dbcc8;
  --accent: #38bdf8;
  --warm: #f59e0b;
  --gold: #fbbf24;
  --hot: #f43f5e;
  --ok: #34d399;
  --radius: 22px;
  color-scheme: dark;
}

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

body {
  margin: 0;
  min-height: 100vh;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", system-ui, sans-serif;
  font-size: 17px;
  line-height: 1.4;
  color: var(--text);
  background:
    radial-gradient(1200px 600px at 50% -10%, #0e4a5e 0%, transparent 60%),
    radial-gradient(800px 500px at 100% 100%, #0b2f3d 0%, transparent 60%),
    var(--bg);
  -webkit-font-smoothing: antialiased;
}

button { font: inherit; color: inherit; cursor: pointer; -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
button:disabled { cursor: default; opacity: .5; }
button:focus-visible, .time:focus-within { outline: 3px solid var(--accent); outline-offset: 2px; }
.busy { opacity: .6; pointer-events: none; }

.app {
  max-width: 520px;
  margin: 0 auto;
  padding: calc(env(safe-area-inset-top) + 18px) 16px calc(env(safe-area-inset-bottom) + 40px);
  display: grid;
  gap: 14px;
}

.top { display: flex; align-items: center; justify-content: space-between; padding: 4px 4px 0; }
.eyebrow { margin: 0; color: var(--muted); font-size: 13px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; }
h1 { margin: 2px 0 0; font-size: 32px; letter-spacing: -.02em; }
h2 { margin: 0 0 12px; font-size: 14px; font-weight: 700; color: var(--muted); letter-spacing: .08em; text-transform: uppercase; }

.pill { font-size: 14px; font-weight: 600; padding: 8px 14px; border-radius: 999px; border: 1px solid var(--card-border); background: var(--card); white-space: nowrap; }
.pill::before { content: ""; display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 8px; vertical-align: 1px; background: var(--muted); }
.pill-live::before { background: var(--ok); box-shadow: 0 0 10px var(--ok); }
.pill-off { border-color: rgba(244, 63, 94, .5); }
.pill-off::before { background: var(--hot); }
.pill-wait::before { animation: blink 1.2s ease-in-out infinite; }
@keyframes blink { 50% { opacity: .3; } }

.card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 18px;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

/* Offline / loading */
.banner {
  border-radius: var(--radius); padding: 16px 18px;
  background: rgba(244, 63, 94, .14); border: 1px solid rgba(244, 63, 94, .45);
}
.banner strong { display: block; font-size: 17px; }
.banner p { margin: 4px 0 0; font-size: 15px; color: #fbd5dc; }
.offline #view-spa .hero, .offline #view-spa .card:not(.feedback) { opacity: .6; }
.loading .temp, .loading #target { color: transparent; background: rgba(255,255,255,.08); border-radius: 12px; animation: blink 1.4s ease-in-out infinite; }

/* Dial */
.hero { display: grid; gap: 4px; }
.dial { position: relative; width: min(280px, 74vw); margin: 0 auto; aspect-ratio: 1; }
.dial svg { width: 100%; height: 100%; }
.track, .arc { fill: none; stroke-width: 14; stroke-linecap: round; }
.track { stroke: rgba(255, 255, 255, .08); }
.arc { stroke: url(#heat); transition: stroke-dashoffset .8s ease; }
.target-dot { fill: #fff; stroke: var(--bg); stroke-width: 3; transition: cx .6s, cy .6s; }
.dial-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.dial-label { font-size: 14px; color: var(--muted); }
.temp { font-size: 68px; font-weight: 300; letter-spacing: -.04em; line-height: 1.05; font-variant-numeric: tabular-nums; }

.status-chip {
  justify-self: center; margin: -18px 0 8px; padding: 9px 16px; border-radius: 999px;
  font-size: 16px; font-weight: 600; text-align: center;
  background: rgba(255,255,255,.07); color: var(--muted); border: 1px solid var(--card-border);
}
.status-chip.ok { color: var(--ok); background: rgba(52, 211, 153, .12); border-color: rgba(52, 211, 153, .4); }
.status-chip.ok::before { content: "✓ "; }
.status-chip.heat { color: var(--gold); background: rgba(245, 158, 11, .14); border-color: rgba(245, 158, 11, .45); }
.status-chip.heat::before { content: "🔥 "; }
.status-chip.off { color: #fda4b4; background: rgba(244, 63, 94, .12); border-color: rgba(244, 63, 94, .4); }

.target { display: flex; align-items: center; justify-content: center; gap: 28px; margin-top: 2px; }
.target-value { display: flex; flex-direction: column; align-items: center; min-width: 100px; }
#target { font-size: 34px; font-weight: 600; font-variant-numeric: tabular-nums; }
#target.pending { color: var(--gold); }
.round {
  width: 64px; height: 64px; border-radius: 50%;
  border: 1px solid var(--card-border); background: rgba(255,255,255,.1);
  font-size: 32px; line-height: 1;
  transition: transform .1s, background .2s;
}
.round:active { transform: scale(.92); background: rgba(255,255,255,.2); }

.presets, .chips { display: flex; gap: 8px; justify-content: center; }
.presets { margin-top: 16px; }
.presets button {
  flex: 1; min-height: 50px; border: 1px solid var(--card-border); background: rgba(255,255,255,.04); border-radius: 999px;
  font-size: 18px; font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums;
}
.chips button {
  min-height: 40px; border: 1px solid var(--card-border); background: transparent; border-radius: 999px;
  padding: 6px 12px; font-size: 14px; color: var(--muted);
}
.presets button.active, .chips button.active { background: var(--text); color: var(--bg); border-color: var(--text); }
.presets button:active, .chips button:active { transform: scale(.96); }

/* Wohlfühl-Temperatur */
.comfort { display: grid; gap: 12px; }
.comfort h2 { margin: 0; }
.question { margin: 0; font-weight: 600; }
.times { position: relative; display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; margin: 0 -18px; padding: 2px 18px 4px; scroll-padding: 18px; }
.times::-webkit-scrollbar { display: none; }
.time {
  position: relative; flex: 0 0 auto; min-width: 74px; min-height: 58px; padding: 8px 12px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
  border: 1px solid var(--card-border); background: rgba(255,255,255,.04); border-radius: 16px; cursor: pointer;
}
.time .t { font-weight: 700; font-variant-numeric: tabular-nums; }
.time .r { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.time.active { background: var(--text); color: var(--bg); border-color: var(--text); }
.time.active .r { color: #2b4752; }
.time.other input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; font-size: 16px; }

#comfort-body { display: grid; gap: 12px; }
.weather { display: flex; gap: 12px; align-items: center; padding: 12px 14px; border-radius: 16px; background: rgba(0,0,0,.18); }
.weather small { color: var(--muted); font-size: 14px; }
.wicon { font-size: 32px; line-height: 1; }
.rec { display: flex; gap: 14px; align-items: center; }
.rec > div { display: flex; flex-direction: column; }
.rec-value { font-size: 44px; font-weight: 600; letter-spacing: -.02em; line-height: 1.05; color: var(--gold); font-variant-numeric: tabular-nums; }
.reasons { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.reasons li { white-space: nowrap; font-size: 14px; padding: 5px 10px; border-radius: 999px; background: rgba(255,255,255,.07); border: 1px solid var(--card-border); }
.reasons b { margin-left: 6px; color: var(--gold); font-weight: 600; font-variant-numeric: tabular-nums; }
.plan { margin: 0; font-size: 15px; color: var(--text); }
.plan small { color: var(--muted); }
.plan.late { color: #fdba74; }
.plan.ok { color: var(--ok); }
.primary {
  width: 100%; min-height: 56px; border: 0; border-radius: 16px; font-size: 18px; font-weight: 700;
  background: linear-gradient(135deg, var(--gold), var(--warm)); color: #1c1203;
  box-shadow: 0 8px 24px rgba(245, 158, 11, .25);
}
.primary:active { transform: scale(.98); }
.applied { text-align: center; font-weight: 700; color: var(--ok); padding: 14px; border-radius: 16px; background: rgba(52, 211, 153, .1); border: 1px solid rgba(52, 211, 153, .35); }
.learned { margin: 0; font-size: 13px; color: var(--muted); text-align: center; }

/* Feedback question */
.feedback { border-color: rgba(251, 191, 36, .45); background: linear-gradient(135deg, rgba(251,191,36,.12), rgba(255,255,255,.04)); }
.feedback h2 { color: var(--text); text-transform: none; letter-spacing: 0; font-size: 19px; margin-bottom: 4px; }
.feedback .muted { margin-bottom: 12px; }
.votes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.votes button {
  min-height: 84px; border-radius: 16px; border: 1px solid var(--card-border); background: rgba(255,255,255,.08);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; font-weight: 600; font-size: 15px;
}
.votes button span { font-size: 28px; }
.votes button:active { transform: scale(.96); }
.link { display: block; margin: 10px auto 0; border: 0; background: none; color: var(--muted); font-size: 15px; min-height: 44px; padding: 0 12px; text-decoration: underline; }

/* Mode */
.segmented { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; background: rgba(0,0,0,.2); padding: 5px; border-radius: 16px; }
.segmented button { border: 0; background: transparent; border-radius: 12px; padding: 12px 6px; min-height: 64px; font-weight: 700; display: flex; flex-direction: column; gap: 2px; align-items: center; justify-content: center; }
.segmented small { font-weight: 400; font-size: 13px; color: var(--muted); }
.segmented button.active { background: rgba(255,255,255,.14); box-shadow: 0 2px 10px rgba(0,0,0,.25); }

/* Tiles */
.tiles { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.tile {
  text-align: left; border: 1px solid var(--card-border); background: rgba(255,255,255,.04);
  border-radius: 18px; padding: 14px; display: grid; gap: 8px; min-height: 112px; align-content: start;
  transition: background .25s, border-color .25s, transform .1s;
}
.tile:active { transform: scale(.97); }
.tile .icon { font-size: 22px; width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; background: rgba(255,255,255,.07); }
.tile .name { display: block; font-weight: 700; }
.tile .state { display: block; font-size: 15px; color: var(--muted); }
.tile .hint { display: block; font-size: 12px; color: var(--muted); opacity: .8; }
.tile.on .state { color: var(--text); font-weight: 600; }
.tile.on { background: linear-gradient(135deg, rgba(56,189,248,.28), rgba(56,189,248,.08)); border-color: rgba(56,189,248,.5); }
.tile.on .icon { background: var(--accent); }
.tile.light.on { background: linear-gradient(135deg, rgba(245,158,11,.3), rgba(245,158,11,.08)); border-color: rgba(245,158,11,.5); }
.tile.light.on .icon { background: var(--warm); }
.tile.static { cursor: default; opacity: .8; }
.tile:disabled { opacity: .8; }
.tiles .muted { grid-column: 1 / -1; }

/* Chart */
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.row-between h2 { margin: 0; }
.chart { margin-top: 12px; min-height: 150px; display: grid; place-items: center; }
.chart svg { width: 100%; height: 170px; overflow: visible; }
.chart .line { fill: none; stroke: var(--accent); stroke-width: 2.5; stroke-linejoin: round; }
.chart .area { fill: url(#area); }
.chart .goal { fill: none; stroke: var(--warm); stroke-width: 1.5; stroke-dasharray: 4 4; opacity: .8; }
.chart .heatbar { fill: var(--warm); opacity: .18; }
.chart text { fill: var(--muted); font-size: 10px; }
.chart .grid { stroke: rgba(255,255,255,.06); }
.legend { margin: 8px 0 0; font-size: 13px; color: var(--muted); display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.key { display: inline-block; width: 16px; height: 4px; border-radius: 2px; margin-left: 8px; }
.key.water { background: var(--accent); margin-left: 0; }
.key.goal { background: repeating-linear-gradient(90deg, var(--warm) 0 4px, transparent 4px 7px); }
.key.heat { background: rgba(245,158,11,.4); height: 10px; }

/* Details & log */
.details { display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; margin: 0 0 14px; font-size: 15px; }
.details dt { color: var(--muted); }
.details dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }
.ghost { width: 100%; min-height: 50px; border: 1px solid var(--card-border); background: transparent; border-radius: 14px; padding: 11px; }
.log { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; font-size: 15px; }
.log time { color: var(--muted); margin-right: 10px; font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); font-size: 15px; margin: 0; }

.toast {
  position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom) + 20px); transform: translateX(-50%);
  background: #f8fafc; color: #0f172a; padding: 14px 20px; border-radius: 16px; font-size: 16px; font-weight: 600;
  box-shadow: 0 10px 30px rgba(0,0,0,.4); max-width: calc(100vw - 32px); width: max-content; text-align: center; z-index: 10;
}
.toast.error { background: var(--hot); color: #fff; }

/* ---- Two areas: Whirlpool and Alarmanlage ------------------------------------ */
.view { display: grid; gap: 14px; min-width: 0; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.has-tabs .app { padding-bottom: calc(env(safe-area-inset-bottom) + 104px); }
.has-tabs .toast { bottom: calc(env(safe-area-inset-bottom) + 92px); }
.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 8;
  display: grid; grid-template-columns: 1fr 1fr; gap: 6px;
  padding: 8px max(12px, calc((100vw - 520px) / 2 + 12px)) calc(env(safe-area-inset-bottom) + 8px);
  background: rgba(4, 22, 29, .82); border-top: 1px solid var(--card-border);
  backdrop-filter: blur(22px); -webkit-backdrop-filter: blur(22px);
}
.tabs button {
  position: relative; min-height: 60px; border: 0; border-radius: 16px; background: transparent; color: var(--muted);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font-size: 14px; font-weight: 600;
}
.tabs svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tabs button[aria-current] { color: var(--text); background: rgba(255, 255, 255, .1); }
.tabs button:active { transform: scale(.97); }
.tab-badge { position: absolute; top: 8px; left: calc(50% + 10px); width: 13px; height: 13px; border-radius: 50%; background: var(--hot); border: 2px solid var(--bg); animation: blink 1s ease-in-out infinite; }

/* Alarm running while the whirlpool page is open */
.alarm-alert {
  width: 100%; border: 0; border-radius: var(--radius); padding: 16px 18px; text-align: left;
  background: var(--hot); color: #fff; display: grid; gap: 2px; animation: alarm-pulse 1.2s ease-in-out infinite;
}
.alarm-alert strong { font-size: 20px; letter-spacing: .02em; }
.alarm-alert span { font-size: 15px; }

/* State card: one colour per state */
.alarm-hero { --k: var(--muted); display: grid; justify-items: center; gap: 6px; text-align: center; padding: 26px 18px 22px;
  background: linear-gradient(165deg, color-mix(in srgb, var(--k) 24%, transparent), rgba(255, 255, 255, .04) 75%);
  border-color: color-mix(in srgb, var(--k) 55%, transparent); transition: background .4s, border-color .4s; }
.k-disarmed { --k: var(--ok); }
.k-armed { --k: var(--hot); }
.k-part, .k-exit, .k-warn { --k: var(--warm); }
.k-entry, .k-alarm { --k: var(--hot); }
.k-wait { --k: var(--accent); }
.shield { width: 112px; height: 112px; }
.shield svg { width: 100%; height: 100%; overflow: visible; filter: drop-shadow(0 8px 16px color-mix(in srgb, var(--k) 40%, transparent)); fill: none; stroke: #fff; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.shield-body { fill: color-mix(in srgb, var(--k) 78%, #04161d); stroke: color-mix(in srgb, var(--k) 60%, #fff); stroke-width: 1.4; }
.shield .dot { fill: #fff; stroke: none; }
.k-wait .shield .dot { animation: blink 1.2s ease-in-out infinite; }
.k-wait .shield .dot:nth-child(2) { animation-delay: .2s; }
.k-wait .shield .dot:nth-child(3) { animation-delay: .4s; }
.k-off .shield { opacity: .7; }
.alarm-title { margin: 6px 0 0; font-size: 36px; font-weight: 800; letter-spacing: -.02em; line-height: 1.1; }
.k-off .alarm-title, .k-wait .alarm-title, .k-warn .alarm-title, .k-entry .alarm-title { font-size: 26px; }
.alarm-sub { margin: 0; font-size: 17px; color: #d5e8ef; max-width: 30ch; }
.alarm-note { margin: 6px 0 0; font-size: 14px; color: var(--muted); max-width: 34ch; overflow-wrap: anywhere; }
.alarm-note.open { font-size: 16px; font-weight: 600; color: var(--gold); padding: 8px 14px; border-radius: 999px; background: rgba(245, 158, 11, .14); border: 1px solid rgba(245, 158, 11, .4); }
.k-exit .shield, .k-entry .shield { animation: blink 1.6s ease-in-out infinite; }
.k-alarm { background: var(--hot); border-color: #fff; animation: alarm-pulse 1.1s ease-in-out infinite; }
.k-alarm .alarm-title { font-size: 56px; letter-spacing: .04em; }
.k-alarm .alarm-sub { color: #fff; font-weight: 600; }
.k-alarm .alarm-note.open { color: #fff; background: rgba(0, 0, 0, .22); border-color: rgba(255, 255, 255, .5); }
.k-alarm .shield-body { fill: #fff; stroke: #fff; }
.k-alarm .shield svg { stroke: var(--hot); }
.k-alarm .shield .dot { fill: var(--hot); }
@keyframes alarm-pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(244, 63, 94, .75); } 50% { box-shadow: 0 0 0 14px rgba(244, 63, 94, 0); filter: brightness(1.12); } }
body.alarm-on { background: radial-gradient(1000px 600px at 50% -10%, #7f1d2e 0%, transparent 65%), #1c070c; }

.delay { width: 100%; max-width: 320px; margin-top: 10px; display: grid; gap: 6px; }
.delay-bar { height: 12px; border-radius: 999px; background: rgba(0, 0, 0, .3); overflow: hidden; }
.delay-bar span { display: block; height: 100%; width: 100%; border-radius: 999px; background: var(--k); transition: width .5s linear; }
.delay-bar.unknown span { width: 40%; animation: slide 1.4s ease-in-out infinite alternate; }
@keyframes slide { from { transform: translateX(-20%); } to { transform: translateX(170%); } }
.delay p { margin: 0; font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; }

/* The three big actions */
.alarm-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.act {
  --c: var(--muted); min-height: 124px; padding: 14px 10px; border-radius: var(--radius);
  border: 1.5px solid color-mix(in srgb, var(--c) 55%, transparent); background: color-mix(in srgb, var(--c) 13%, transparent);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; text-align: center;
  transition: transform .1s, background .25s, opacity .25s;
}
.act svg { width: 34px; height: 34px; margin-bottom: 4px; fill: none; stroke: var(--c); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.act-label { font-size: 22px; font-weight: 800; letter-spacing: -.01em; }
.act small { font-size: 14px; color: #c4dbe4; }
.act-arm { --c: var(--hot); }
.act-part { --c: var(--warm); }
.act-disarm { --c: var(--ok); grid-column: 1 / -1; min-height: 96px; }
.act:active { transform: scale(.97); }
.act.active { background: var(--c); border-color: var(--c); color: #06141a; }
.act.active svg { stroke: #06141a; }
.act.active small { color: #06141a; font-weight: 700; }
.act.active small::before { content: "✓ "; }
.act:disabled { opacity: .38; }
.act.active:disabled { opacity: .8; }
.act.running { opacity: 1; animation: blink 1s ease-in-out infinite; }
.alarm-actions.urgent .act-disarm { order: -1; min-height: 132px; --c: #fff; background: #fff; color: #7f1d2e; border-color: #fff; box-shadow: 0 10px 34px rgba(244, 63, 94, .5); }
.alarm-actions.urgent .act-disarm svg { stroke: #be123c; width: 40px; height: 40px; }
.alarm-actions.urgent .act-disarm small { color: #7f1d2e; }
.alarm-actions.urgent .act-disarm .act-label { font-size: 28px; }
.alarm-actions.urgent .act-arm, .alarm-actions.urgent .act-part { min-height: 84px; }
.lock-note { margin: 0; padding: 12px 16px; border-radius: 16px; font-size: 15px; background: rgba(245, 158, 11, .14); border: 1px solid rgba(245, 158, 11, .45); color: #fde2b3; }

/* Things to look after */
.problems { border-color: rgba(245, 158, 11, .45); }
.problem-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; font-size: 15px; }
.problem-list li { display: flex; gap: 12px; align-items: flex-start; }
.problem-list .icon { font-size: 22px; line-height: 1.2; }
.problem-list li.bad b { color: #fda4b4; }

/* Sensors and events */
h3.group { margin: 14px 0 6px; font-size: 15px; font-weight: 700; color: var(--text); }
h3.group:first-child { margin-top: 0; }
h3.group.open { color: var(--gold); }
.sensors, .events { list-style: none; margin: 0; padding: 0; display: grid; }
.sensor { display: grid; grid-template-columns: 40px 1fr auto; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid rgba(255, 255, 255, .07); }
.sensors .sensor:first-child, .events .event:first-child { border-top: 0; }
.sensor .icon { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; font-size: 20px; background: rgba(255, 255, 255, .07); }
.sensor .who { display: grid; min-width: 0; }
.sensor .name { font-weight: 700; overflow-wrap: anywhere; }
.sensor .kind { font-size: 13px; color: var(--muted); }
.sensor .flag { font-size: 13px; font-weight: 600; color: var(--gold); }
.chip { font-size: 14px; font-weight: 600; padding: 6px 11px; border-radius: 999px; border: 1px solid var(--card-border); background: rgba(255, 255, 255, .05); color: var(--muted); text-align: center; max-width: 42vw; }
.chip.closed { color: var(--ok); border-color: rgba(52, 211, 153, .35); background: rgba(52, 211, 153, .08); }
.chip.open { color: #1c1203; background: var(--gold); border-color: var(--gold); }
.chip.bad { color: #fff; background: var(--hot); border-color: var(--hot); }
.sensor.open .icon { background: rgba(245, 158, 11, .3); }
.sensor.bad .icon { background: rgba(244, 63, 94, .3); }
.event { display: grid; grid-template-columns: 52px 1fr; gap: 10px; padding: 9px 0 9px 12px; font-size: 15px; border-top: 1px solid rgba(255, 255, 255, .07); border-left: 3px solid transparent; }
.event time { color: var(--muted); font-variant-numeric: tabular-nums; }
.event small { color: var(--muted); }
.event.alarm { border-left-color: var(--hot); }
.event.alarm b { color: #fda4b4; }
.event.warning { border-left-color: var(--warm); }
.event .tag { display: inline-block; margin-left: 8px; font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: rgba(244, 63, 94, .2); color: #fecdd3; }
#alarm-events + .ghost, #alarm-events .ghost { margin-top: 12px; }

.tech summary { cursor: pointer; font-size: 14px; font-weight: 700; color: var(--muted); letter-spacing: .08em; text-transform: uppercase; min-height: 28px; display: flex; align-items: center; justify-content: space-between; list-style: none; }
.tech summary::-webkit-details-marker { display: none; }
.tech summary::after { content: "＋"; font-size: 18px; }
.tech[open] summary::after { content: "－"; }
.tech[open] summary { margin-bottom: 14px; }
.tech summary:focus-visible { outline: 3px solid var(--accent); outline-offset: 4px; border-radius: 8px; }

/* Bottom sheet for confirmations */
.sheet {
  width: 100%; max-width: 520px; margin: auto auto 0; padding: 22px 18px calc(env(safe-area-inset-bottom) + 18px);
  border: 1px solid var(--card-border); border-bottom: 0; border-radius: 26px 26px 0 0;
  background: #0b2a36; color: var(--text); box-shadow: 0 -20px 60px rgba(0, 0, 0, .5);
}
.sheet::backdrop { background: rgba(2, 10, 14, .7); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); }
.sheet[open] { animation: sheet-in .25s ease-out; }
@keyframes sheet-in { from { transform: translateY(40px); opacity: 0; } }
.sheet h2 { margin: 0 0 8px; font-size: 24px; font-weight: 800; color: var(--text); letter-spacing: -.01em; text-transform: none; }
.sheet.warn h2 { color: var(--gold); }
.sheet.alarm h2 { color: #fda4b4; }
.sheet.ok h2 { color: var(--ok); }
.sheet p { margin: 0 0 14px; font-size: 16px; color: #d5e8ef; }
.open-list { list-style: none; margin: 4px 0 14px; padding: 0; display: grid; gap: 8px; }
.open-list li { display: flex; gap: 12px; align-items: center; padding: 12px 14px; border-radius: 16px; font-size: 18px; background: rgba(245, 158, 11, .14); border: 1px solid rgba(245, 158, 11, .45); }
.open-list small { font-size: 14px; color: var(--muted); }
.sheet-buttons { display: grid; gap: 10px; }
.sheet-btn { min-height: 58px; border-radius: 16px; border: 1px solid var(--card-border); background: rgba(255, 255, 255, .06); font-size: 18px; font-weight: 700; padding: 10px 14px; }
.sheet-btn.primary-btn { border: 0; background: var(--text); color: #04161d; }
.sheet-btn.danger-btn { border-color: rgba(244, 63, 94, .6); color: #fda4b4; background: rgba(244, 63, 94, .1); }
.sheet-btn.danger-btn.solid { border: 0; background: var(--hot); color: #fff; }
.sheet-btn:active { transform: scale(.98); }

@media (prefers-reduced-motion: reduce) {
  *, *::before { animation: none !important; transition: none !important; }
}

/* Login */
.login { min-height: 100vh; align-content: center; }
.login form { display: grid; gap: 14px; justify-items: center; text-align: center; padding: 28px 22px; }
.login img { border-radius: 18px; }
.login h1 { margin: 0; }
.login input {
  width: 100%; font: inherit; font-size: 18px; color: var(--text); background: rgba(0,0,0,.25);
  border: 1px solid var(--card-border); border-radius: 14px; padding: 14px 16px;
}
.login button[type=submit] {
  width: 100%; border: 0; border-radius: 14px; padding: 14px; font-size: 18px; font-weight: 600;
  background: var(--accent); color: #04161d;
}
.error { color: var(--hot); margin: 0; }
