:root {
  font-family: "Segoe UI", system-ui, sans-serif;
  color: #192331;
  background: #f4f5f7;
  font-synthesis: none;
  --line: #dce1e8;
  --muted: #526172;
}
* { box-sizing: border-box; }
body { margin: 0; }
.layout { display: grid; grid-template-columns: 282px minmax(0, 1fr); min-height: 100vh; }
.station {
  background: #151f2e;
  color: #f3f6fa;
  padding: 30px 20px;
  border-inline-end: 1px solid #26364b;
}
.station .identity { padding: 0 7px 22px; border-bottom: 0; }
.identity { display: flex; align-items: center; gap: 12px; padding-bottom: 29px; border-bottom: 1px solid #354252; }
.mark {
  flex: 0 0 29px;
  aspect-ratio: 1;
  background: #80b9ff;
  clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%, 50% 0, 50% 24%, 24% 50%, 50% 76%, 76% 50%, 50% 24%);
}
.brand { margin: 0; font-size: .98rem; letter-spacing: .14em; font-weight: 750; }
.description { margin: 4px 0 0; color: #bdc9d7; font-size: .81rem; }
.status-panel { padding: 16px 14px; border: 1px solid #34465e; border-radius: 10px; background: #1d2a3d; }
.station-caption { margin-bottom: 9px; color: #b4c3d6; font-size: .74rem; font-weight: 600; }
.station-settings { margin-top: 12px; padding-inline: 13px; border: 1px solid #34465e; border-radius: 8px; background: #192638; font-size: .86rem; }
.station-settings[open] { padding-bottom: 13px; }
.station-settings > summary { display: flex; align-items: center; justify-content: space-between; min-height: 44px; cursor: pointer; list-style: none; font-weight: 650; }
.station-settings > summary::-webkit-details-marker { display: none; }
.station-settings > summary::after { content: ''; width: 6px; height: 6px; border-right: 1.5px solid #9bb2ce; border-bottom: 1.5px solid #9bb2ce; transform: rotate(45deg); margin: -3px 3px 0 8px; }
.station-settings[open] > summary { border-bottom: 1px solid #34465e; }
.station-settings[open] > summary::after { transform: rotate(225deg); margin-top: 3px; }
.station-settings :is(summary, select, button, input):focus-visible { outline: 2px solid #91c3ff; outline-offset: 3px; }
.station-settings label { display: block; margin: 12px 0 6px; font-weight: 600; }
.station-settings select { width: 100%; min-height: 38px; padding: 7px; color-scheme: dark; color: #f3f6fa; background: #243347; border: 1px solid #51647d; border-radius: 6px; font: inherit; }
.station-settings small { display: block; margin-top: 7px; color: #bdc9d7; line-height: 1.45; }
.account-form input { width: 100%; color: #f3f6fa; background: #243347; border: 1px solid #51647d; padding: 7px; border-radius: 6px; font: inherit; }
.account-form button, .account-logout { margin-top: 10px; }
.account-status { color: #d2dbe6; font-size: .8rem; }
.account-status:empty { display: none; }
.notification-rules { margin-top: 10px; border-top: 1px solid #34465e; }
.threshold-settings > summary {
  min-height: 42px;
  padding-block: 12px;
  cursor: pointer;
  font-weight: 600;
}
.threshold-settings > summary::marker { color: #9bb2ce; }
#notification-rule-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; margin-bottom: 8px; }
.notification-rules fieldset { min-width: 0; margin: 0; padding: 3px 6px 6px; border: 1px solid #34465e; border-radius: 6px; }
.notification-rules legend { padding-inline: 3px; font-weight: 650; }
.notification-rules label { margin: 4px 0; font-weight: 400; }
.notification-rules input[type=checkbox] { margin: 0 3px 0 0; vertical-align: middle; accent-color: #80b9ff; }
.notification-rules input[type=number] {
  width: 100%;
  min-height: 32px;
  margin-top: 3px;
  color: #fff;
  color-scheme: dark;
  background: #243347;
  border: 1px solid #51647d;
  border-radius: 4px;
  padding-inline: 5px;
  font: inherit;
}
#notification-rule-status { margin: 6px 0 0; color: #d2dbe6; }
#notification-rule-status:empty { display: none; }
.notification-inbox:not([hidden]) { margin-bottom: 18px; padding: 13px 16px; }
.notification-inbox summary { cursor: pointer; font-weight: 650; }
.notification-inbox ol { padding: 0; margin: 12px 0 0; list-style: none; }
.notification-inbox li { border-top: 1px solid var(--line); padding: 10px 0; }
.notification-inbox time { display: block; color: var(--muted); margin: 3px 0; font-size: .8rem; }
.notification-inbox p { margin: 5px 0; font-size: .87rem; }
.notification-inbox p:empty, .notification-inbox ol:empty { display: none; }
.layout[hidden] { display: none; }
.sign-in-page { min-height: 100svh; display: grid; place-items: center; padding: 20px; background: #f4f5f7; }
.sign-in { width: min(100%, 420px); background: #171f2b; color: #f3f6fa; padding: clamp(22px, 5vw, 34px); border-radius: 12px; }
.sign-in h1 { font-size: 1.65rem; margin: 24px 0 16px; }
.sign-in label { display: block; margin: 12px 0 6px; }
.sign-in button { width: 100%; margin-top: 16px; font-weight: 650; }
#push-controls { margin-top: 8px; border-top: 1px solid #34465e; padding-top: 8px; }
#push-controls h3 { color: #f3f6fa; margin-bottom: 8px; }
.station .history-refresh { width: 100%; min-height: 38px; color: #f3f6fa; background: #243347; border-color: #51647d; }
.station .history-refresh:hover { background: #31455e; }
#push-test { margin-top: 7px; }
#push-status { margin: 8px 0 0; color: #bdc9d7; font-size: .8rem; line-height: 1.5; }
#push-status:empty { display: none; }
.status-label { display: inline-flex; align-items: center; gap: 9px; font-size: .89rem; font-weight: 650; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; flex: none; background: #9cabbc; }
[data-state="live"] .status-dot { background: #75d5ab; }
[data-state="stale"] .status-dot, [data-state="error"] .status-dot { background: #ffbe72; }
#status { margin: 6px 0 0 16px; color: #bdc9d7; font-size: .8rem; line-height: 1.5; }
.workspace { padding: clamp(32px, 5vw, 72px) clamp(22px, 6vw, 92px); }
.content { max-width: 980px; margin-inline: auto; }
h1 { margin: 0 0 30px; font-size: clamp(1.75rem, 3.5vw, 2.65rem); letter-spacing: -.045em; line-height: 1.15; font-weight: 690; }
.group { border: 1px solid var(--line); border-radius: 9px; background: #fff; }
.group + .group { margin-top: 18px; }
.group-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 8px 16px; flex-wrap: wrap; padding: 14px clamp(16px, 2.4vw, 26px); border-bottom: 1px solid var(--line); }
h2 { margin: 0; font-size: 1rem; font-weight: 680; }
small { color: var(--muted); font-size: .77rem; }
.metrics { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.metric { padding: 22px clamp(16px, 2.4vw, 26px) 22px; min-width: 0; transition: background-color .2s ease; }
.metric + .metric { border-left: 1px solid var(--line); }
h3 { margin: 0; color: #192331; font-size: .88rem; font-weight: 650; line-height: 1.4; }
.metric-description { min-height: 2.7em; margin: 3px 0 9px; color: var(--muted); font-size: .75rem; line-height: 1.35; }
.reading { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: baseline; gap: 6px; white-space: nowrap; }
output { font-size: clamp(1.72rem, 4.5vw, 3.05rem); line-height: 1; font-variant-numeric: tabular-nums; font-weight: 650; letter-spacing: -.045em; }
.unit { font-size: .83rem; color: #315b88; font-weight: 650; }
.delta { display: block; min-height: 1.4em; margin-top: 8px; font-size: .8rem; font-weight: 650; font-variant-numeric: tabular-nums; }
[data-change="up"] { color: #155e45; background-color: #eaf7ef; }
[data-change="down"] { color: #275a95; background-color: #edf4fd; }
@media (max-width: 760px) {
  .layout { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto 1fr; }
  .station { padding: 18px 16px; border-inline-end: 0; border-bottom: 1px solid #26364b; }
  .station .identity { padding: 0 0 13px; }
  .status-panel { padding: 12px 14px; }
  .workspace { padding: 26px 16px 36px; }
  h1 { margin-bottom: 19px; }
  .metric { padding: 17px clamp(10px, 3.5vw, 20px) 14px; }
  .metric-description { min-height: 2.7em; }
  output { font-size: clamp(1.42rem, 6vw, 2.65rem); }
  .unit { font-size: .72rem; }
}
@media (prefers-reduced-motion: reduce) { .metric { transition: none; } }

.history { margin-top: 24px; padding: clamp(16px, 2.4vw, 26px); }
.history-heading { display: flex; justify-content: space-between; align-items: center; gap: 8px 16px; flex-wrap: wrap; }
.history-controls { display: flex; flex-wrap: wrap; gap: 10px 14px; margin: 18px 0 14px; }
.history-controls label { display: grid; gap: 5px; font-size: .78rem; color: var(--muted); }
.history-controls select, .history-refresh { color: #192331; background: #fff; border: 1px solid #b4c1ce; border-radius: 6px; padding: 7px 10px; font: inherit; }
.history-refresh { font-size: .8rem; cursor: pointer; }
.history-refresh:hover { background: #f1f6fb; }
.history-plot { position: relative; border: 1px solid var(--line); border-radius: 6px; background: #fafbfd; }
.history-plot canvas { display: block; width: 100%; height: clamp(200px, 29vw, 290px); touch-action: pan-y; }
.history-tooltip { position: absolute; z-index: 1; pointer-events: none; max-width: calc(100% - 16px); padding: 7px 10px; border-radius: 6px; background: #171f2b; color: #fff; font-size: .74rem; line-height: 1.35; font-variant-numeric: tabular-nums; }
.history-tooltip span { display: block; color: #d2dbe6; }
.history-tooltip strong { display: block; margin-top: 2px; font-size: .9rem; }
#history-message { position: absolute; inset: 50% 12px auto; transform: translateY(-50%); text-align: center; margin: 0; color: var(--muted); font-size: .88rem; pointer-events: none; }
.history-foot { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 16px; margin-top: 12px; color: var(--muted); font-size: .77rem; min-height: 1.2em; }
#history-point { color: #274e79; font: inherit; font-weight: 600; letter-spacing: normal; }
.history-legend { display: flex; align-items: center; gap: 7px; margin: 8px 0 0; color: var(--muted); font-size: .75rem; }
.history-legend span { flex: 0 0 22px; height: 10px; border: 1px solid #c58b45; background: #fff0d7; }
@media (max-width: 460px) {
  .history-controls label { flex: 1 1 135px; }
  .history-controls select { min-width: 0; min-height: 36px; }
}
