:root {
  color-scheme: light;
  --font-sans: "Segoe UI Variable Text", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --font-mono: "Cascadia Mono", "SFMono-Regular", Consolas, monospace;
  --bg: #eef3f4;
  --bg-2: #e4ecee;
  --surface: #ffffff;
  --surface-2: #f7fafb;
  --surface-3: #eef4f5;
  --ink: #0c2024;
  --ink-soft: #26434a;
  --muted: #5f767c;
  --muted-2: #80959a;
  --line: #d9e4e7;
  --line-strong: #c4d4d8;
  --brand: #0c7c70;
  --brand-strong: #075c54;
  --brand-soft: #d9f2ee;
  --brand-ink: #05453f;
  --brand-2: #0e7490;
  --brand-2-soft: #dcf1f8;
  --accent: #e56b3f;
  --accent-soft: #fde9e1;
  --ok: #128a5c;
  --ok-soft: #d9f3e7;
  --warn: #c37d09;
  --warn-soft: #fdf0d5;
  --crit: #c84343;
  --crit-soft: #fbe3e3;
  --info: #2b6f9e;
  --info-soft: #e0eef8;
  --shadow-sm: 0 1px 2px rgba(12, 32, 36, 0.06);
  --shadow: 0 12px 32px -18px rgba(12, 32, 36, 0.35), 0 2px 6px rgba(12, 32, 36, 0.04);
  --shadow-lg: 0 30px 70px -30px rgba(7, 30, 34, 0.4), 0 8px 20px rgba(7, 30, 34, 0.06);
  --radius-sm: 8px;
  --radius: 14px;
  --radius-lg: 22px;
  --sidebar-w: 264px;
  --chart-temp: #e0673f;
  --chart-humidity: #2b8cc4;
  --chart-air: #6b8c46;
  --chart-rain: #4b72b8;
  --hero-ink: #eaf7f5;
  --hero-bg: #072c31;
  --hero-line: rgba(122, 213, 200, 0.16);
}

html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #061519;
  --bg-2: #041014;
  --surface: #0c2127;
  --surface-2: #102b32;
  --surface-3: #14343c;
  --ink: #e8f3f1;
  --ink-soft: #c3d9d6;
  --muted: #91abae;
  --muted-2: #769195;
  --line: #1d3a41;
  --line-strong: #2a4d54;
  --brand: #35cdb8;
  --brand-strong: #7ce7d7;
  --brand-soft: #123b38;
  --brand-ink: #bdf6ec;
  --brand-2: #4bb6d8;
  --brand-2-soft: #123340;
  --accent: #f29168;
  --accent-soft: #40241a;
  --ok: #3fc98e;
  --ok-soft: #113a2b;
  --warn: #e6ae3c;
  --warn-soft: #3b2d12;
  --crit: #ef7777;
  --crit-soft: #3f1d1f;
  --info: #6cb8e8;
  --info-soft: #153247;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.35);
  --shadow: 0 18px 40px -24px rgba(0, 0, 0, 0.8), 0 2px 8px rgba(0, 0, 0, 0.25);
  --shadow-lg: 0 40px 80px -30px rgba(0, 0, 0, 0.85), 0 10px 24px rgba(0, 0, 0, 0.35);
  --chart-temp: #f08b64;
  --chart-humidity: #62b9e6;
  --chart-air: #9dc06b;
  --chart-rain: #7f9fe0;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(1100px 520px at 8% -8%, rgba(12, 124, 112, 0.09), transparent 60%),
    radial-gradient(900px 480px at 100% 0%, rgba(14, 116, 144, 0.08), transparent 55%),
    var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

html[data-theme="dark"] body {
  background:
    radial-gradient(1100px 520px at 8% -8%, rgba(53, 205, 184, 0.11), transparent 60%),
    radial-gradient(900px 480px at 100% 0%, rgba(75, 182, 216, 0.09), transparent 55%),
    var(--bg);
}

h1, h2, h3, h4, h5, h6, p, figure, ul, ol {
  margin: 0;
}

h1, h2, h3, h4 {
  color: var(--ink);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.15;
}

h1 { font-size: clamp(1.9rem, 3vw, 2.7rem); }
h2 { font-size: clamp(1.45rem, 2.2vw, 1.9rem); }
h3 { font-size: 1.08rem; }
h4 { font-size: 1rem; }

p { color: var(--ink-soft); }

a {
  color: var(--brand);
  text-decoration: none;
  transition: color 0.15s ease, opacity 0.15s ease;
}

a:hover { color: var(--brand-strong); }

ul, ol { padding-left: 1.15rem; }

button, input, select, textarea {
  font: inherit;
  color: inherit;
}

button { cursor: pointer; }

img, svg { display: block; max-width: 100%; }

::selection {
  background: var(--brand);
  color: #ffffff;
}

:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

.icon {
  width: 1.15em;
  height: 1.15em;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  vertical-align: -0.16em;
}

.icon-sm { width: 1em; height: 1em; }
.icon-lg { width: 1.5em; height: 1.5em; }

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--brand);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.muted { color: var(--muted); }
.small { font-size: 0.8rem; }
.num { text-align: right; font-variant-numeric: tabular-nums; }

.hide-sm { display: inline-flex; }

.btn {
  --btn-bg: var(--surface);
  --btn-ink: var(--ink);
  --btn-line: var(--line);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.55rem 0.95rem;
  border: 1px solid var(--btn-line);
  border-radius: 10px;
  background: var(--btn-bg);
  color: var(--btn-ink);
  font-size: 0.88rem;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
  transition: transform 0.12s ease, box-shadow 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
  color: var(--btn-ink);
}

.btn:active { transform: translateY(0); }
.btn[disabled] { opacity: 0.55; cursor: not-allowed; transform: none; }

.btn-primary {
  --btn-bg: linear-gradient(135deg, var(--brand), var(--brand-2));
  --btn-ink: #ffffff;
  --btn-line: transparent;
  box-shadow: 0 10px 24px -14px rgba(9, 100, 90, 0.9);
}

.btn-primary:hover {
  box-shadow: 0 16px 30px -16px rgba(9, 100, 90, 0.95);
  color: #ffffff;
}

.btn-ghost {
  --btn-bg: color-mix(in srgb, var(--surface) 60%, transparent);
  --btn-ink: var(--ink-soft);
  --btn-line: var(--line);
}

.btn-ghost:hover {
  --btn-bg: var(--surface);
  --btn-ink: var(--brand);
  border-color: var(--brand);
}

.btn-danger {
  --btn-bg: var(--crit-soft);
  --btn-ink: var(--crit);
  --btn-line: color-mix(in srgb, var(--crit) 28%, transparent);
}

.btn-danger:hover {
  --btn-bg: var(--crit);
  --btn-ink: #ffffff;
}

.btn-sm { padding: 0.38rem 0.7rem; font-size: 0.78rem; border-radius: 8px; }
.btn-lg { padding: 0.75rem 1.25rem; font-size: 0.95rem; border-radius: 12px; }
.btn-block { width: 100%; }

.is-busy { pointer-events: none; }

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.icon-btn:hover {
  background: var(--surface-3);
  color: var(--brand);
  border-color: var(--line);
}

.icon-btn .icon { width: 18px; height: 18px; }
.icon-btn.is-spinning .icon { animation: spin 0.8s linear infinite; }
.danger-hover:hover { color: var(--crit); background: var(--crit-soft); }

.tag {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.16rem 0.55rem;
  border-radius: 999px;
  background: var(--surface-3);
  color: var(--muted);
  border: 1px solid var(--line);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.tag-brand { background: var(--brand-soft); border-color: color-mix(in srgb, var(--brand) 25%, transparent); color: var(--brand-ink); }
.tag-neutral { background: var(--surface-3); color: var(--muted); }
.tag-demo { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 25%, transparent); color: var(--accent); }
.tag-crit { background: var(--crit-soft); border-color: color-mix(in srgb, var(--crit) 25%, transparent); color: var(--crit); }
.tag-warn { background: var(--warn-soft); border-color: color-mix(in srgb, var(--warn) 28%, transparent); color: var(--warn); }
.tag-ok { background: var(--ok-soft); border-color: color-mix(in srgb, var(--ok) 25%, transparent); color: var(--ok); }

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.22rem 0.6rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  border: 1px solid transparent;
  white-space: nowrap;
}

.status-pill::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.status-pill.online { color: var(--ok); background: var(--ok-soft); border-color: color-mix(in srgb, var(--ok) 22%, transparent); }
.status-pill.maintenance { color: var(--warn); background: var(--warn-soft); border-color: color-mix(in srgb, var(--warn) 22%, transparent); }
.status-pill.offline { color: var(--crit); background: var(--crit-soft); border-color: color-mix(in srgb, var(--crit) 22%, transparent); }

.status-dot-label {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--ink-soft);
}

.mini-status-dot,
.station-status-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--muted-2);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--muted) 12%, transparent);
  flex: none;
}

.mini-status-dot.online,
.station-status-dot.online { background: var(--ok); box-shadow: 0 0 0 4px color-mix(in srgb, var(--ok) 14%, transparent); }
.mini-status-dot.maintenance,
.station-status-dot.maintenance { background: var(--warn); box-shadow: 0 0 0 4px color-mix(in srgb, var(--warn) 14%, transparent); }
.mini-status-dot.offline,
.station-status-dot.offline { background: var(--crit); box-shadow: 0 0 0 4px color-mix(in srgb, var(--crit) 14%, transparent); }

.form { display: grid; gap: 1rem; }
.field { display: grid; gap: 0.35rem; min-width: 0; }
.field > span { font-size: 0.8rem; font-weight: 700; color: var(--ink-soft); }
.field small, .form-hint { color: var(--muted); font-size: 0.74rem; line-height: 1.4; }
.field-hint { display: block; min-height: 0.9rem; color: var(--muted); }
.field-full { grid-column: 1 / -1; }
.field-sm > span { font-size: 0.72rem; }

input[type="text"],
input[type="password"],
input[type="number"],
input[type="date"],
input[type="datetime-local"],
input[type="email"],
select,
textarea {
  width: 100%;
  min-height: 42px;
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink);
  font-size: 0.9rem;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

textarea { resize: vertical; min-height: 64px; }

input::placeholder,
textarea::placeholder { color: var(--muted-2); }

input:hover,
select:hover,
textarea:hover { border-color: var(--brand-2); }

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 16%, transparent);
}

input:disabled,
select:disabled,
textarea:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  background: var(--surface-3);
}

select {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 17px) 50%, calc(100% - 12px) 50%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 2rem;
}

input[type="checkbox"] {
  accent-color: var(--brand);
  width: 16px;
  height: 16px;
  min-height: 0;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.9rem 1rem;
}

.form-section { display: grid; gap: 0.75rem; }

.form-section-title {
  color: var(--brand);
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.unit-inline { color: var(--muted); font-weight: 500; }

.check-line {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  color: var(--ink-soft);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
}

.check-line input { margin-top: 0.18rem; }
.check-line-inline { align-items: center; min-height: 42px; }

.check-card {
  display: flex;
  gap: 0.7rem;
  padding: 0.85rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-2);
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.check-card:hover { border-color: var(--brand); }
.check-card input { margin-top: 0.25rem; }
.check-card-body { display: grid; gap: 0.15rem; }
.check-card-body strong { font-size: 0.86rem; }
.check-card-body span { color: var(--muted); font-size: 0.78rem; }

.input-icon { position: relative; }
.input-icon > .icon { position: absolute; left: 0.8rem; top: 50%; transform: translateY(-50%); color: var(--muted); width: 17px; height: 17px; }
.input-icon input { padding-left: 2.4rem; }
.input-action {
  position: absolute;
  right: 0.45rem;
  top: 50%;
  transform: translateY(-50%);
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
}
.input-action:hover, .input-action.is-active { color: var(--brand); background: var(--brand-soft); }

.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.panel + .panel { margin-top: 1rem; }

.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.1rem 1.25rem;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, color-mix(in srgb, var(--surface-2) 70%, transparent), transparent);
}

.panel-head-wrap { flex-wrap: wrap; }
.panel-head h3 { display: flex; align-items: center; gap: 0.45rem; }
.panel-head h3 .icon { color: var(--brand); }
.panel-head p { margin-top: 0.2rem; color: var(--muted); font-size: 0.82rem; }
.panel-actions { display: flex; gap: 0.45rem; align-items: center; flex-wrap: wrap; }
.panel-note { padding: 0.9rem 1.25rem; color: var(--muted); font-size: 0.78rem; border-top: 1px solid var(--line); }

.page-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.15rem;
  flex-wrap: wrap;
}

.page-heading h2 { margin: 0.15rem 0 0.25rem; }
.page-heading p { color: var(--muted); font-size: 0.9rem; max-width: 68ch; }
.heading-actions { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }

.notice,
.alert {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--ink-soft);
  font-size: 0.86rem;
}

.notice .icon,
.alert .icon { margin-top: 0.15rem; flex: none; }
.notice > div, .alert > div { display: grid; gap: 0.1rem; }
.notice strong, .alert strong { color: var(--ink); font-size: 0.88rem; }
.notice span, .alert span { color: var(--muted); }
.notice .btn { margin-left: auto; align-self: center; }
.notice-info, .alert-info { background: var(--info-soft); border-color: color-mix(in srgb, var(--info) 22%, transparent); }
.notice-info .icon, .alert-info .icon { color: var(--info); }
.notice-warning, .alert-warning { background: var(--warn-soft); border-color: color-mix(in srgb, var(--warn) 26%, transparent); }
.notice-warning .icon, .alert-warning .icon { color: var(--warn); }
.notice-danger, .alert-error { background: var(--crit-soft); border-color: color-mix(in srgb, var(--crit) 26%, transparent); }
.notice-danger .icon, .alert-error .icon { color: var(--crit); }
.alert-success { background: var(--ok-soft); border-color: color-mix(in srgb, var(--ok) 24%, transparent); }
.alert-success .icon { color: var(--ok); }

.empty-state {
  display: grid;
  justify-items: center;
  gap: 0.35rem;
  padding: 2.4rem 1.25rem;
  text-align: center;
}

.empty-state.is-success { background: color-mix(in srgb, var(--ok-soft) 55%, transparent); }
.empty-icon {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  margin-bottom: 0.35rem;
  border-radius: 16px;
  background: var(--brand-soft);
  color: var(--brand);
}
.empty-icon .icon { width: 24px; height: 24px; }
.empty-state.is-success .empty-icon { background: var(--ok-soft); color: var(--ok); }
.empty-state h3, .empty-state h4 { margin: 0; }
.empty-state p { max-width: 46ch; color: var(--muted); font-size: 0.85rem; }
.empty-state .btn { margin-top: 0.5rem; }

.filtered-empty {
  grid-column: 1 / -1;
  display: grid;
  justify-items: center;
  gap: 0.35rem;
  padding: 3rem 1rem;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  color: var(--muted);
  text-align: center;
}
.filtered-empty strong { color: var(--ink); }
.filtered-empty p { font-size: 0.85rem; }

.table-wrap { width: 100%; overflow-x: auto; }

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.84rem;
}

.data-table th {
  padding: 0.62rem 0.85rem;
  background: var(--surface-2);
  color: var(--muted);
  border-bottom: 1px solid var(--line);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.09em;
  text-align: left;
  text-transform: uppercase;
  white-space: nowrap;
}

.data-table td {
  padding: 0.72rem 0.85rem;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

.data-table tbody tr { transition: background 0.12s ease; }
.data-table tbody tr:hover { background: color-mix(in srgb, var(--brand-soft) 32%, transparent); }
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table tr.is-inactive { opacity: 0.6; }
.data-table tr.is-inactive:hover { opacity: 1; }
.data-table strong { font-weight: 650; color: var(--ink); }
.cell-sub { display: block; margin-top: 0.1rem; color: var(--muted); font-size: 0.72rem; }
.actions-col { width: 1%; text-align: right; }
.row-actions { display: flex; justify-content: flex-end; gap: 0.15rem; }
.table-note { padding: 0.7rem 1.25rem; color: var(--muted); font-size: 0.75rem; }
.table-loading { display: flex; align-items: center; justify-content: center; gap: 0.6rem; padding: 2.5rem 1rem; color: var(--muted); font-size: 0.85rem; }

.station-cell, .user-cell { display: flex; align-items: center; gap: 0.65rem; }
.station-avatar {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 11px;
  background: var(--brand-soft);
  color: var(--brand);
  flex: none;
}
.station-avatar .icon { width: 18px; height: 18px; }
.avatar {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  color: #ffffff;
  font-size: 0.9rem;
  font-weight: 800;
  flex: none;
}
.avatar-sm { width: 30px; height: 30px; font-size: 0.75rem; }

.spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  flex: none;
}
.spinner-lg { width: 26px; height: 26px; border-width: 3px; }

@keyframes spin { to { transform: rotate(360deg); } }

.toast-stack {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 200;
  display: grid;
  gap: 0.55rem;
  width: min(380px, calc(100vw - 2rem));
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  padding: 0.8rem 0.85rem;
  border: 1px solid var(--line);
  border-left: 4px solid var(--brand);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  opacity: 0;
  transform: translateY(12px) scale(0.98);
  transition: opacity 0.2s ease, transform 0.2s ease;
  pointer-events: auto;
}
.toast.is-visible { opacity: 1; transform: translateY(0) scale(1); }
.toast-icon { color: var(--brand); margin-top: 0.1rem; }
.toast-icon .icon { width: 18px; height: 18px; }
.toast-body { display: grid; gap: 0.1rem; flex: 1; min-width: 0; }
.toast-body strong { font-size: 0.82rem; }
.toast-body span { color: var(--ink-soft); font-size: 0.82rem; }
.toast-close { display: grid; place-items: center; width: 24px; height: 24px; padding: 0; border: 0; border-radius: 6px; background: transparent; color: var(--muted); }
.toast-close:hover { background: var(--surface-3); color: var(--ink); }
.toast-close .icon { width: 14px; height: 14px; }
.toast-success { border-left-color: var(--ok); }
.toast-success .toast-icon { color: var(--ok); }
.toast-warning { border-left-color: var(--warn); }
.toast-warning .toast-icon { color: var(--warn); }
.toast-error { border-left-color: var(--crit); }
.toast-error .toast-icon { color: var(--crit); }
.toast-info { border-left-color: var(--info); }
.toast-info .toast-icon { color: var(--info); }

.modal {
  width: min(620px, calc(100vw - 2rem));
  max-height: calc(100vh - 2rem);
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-lg);
  overflow: auto;
}
.modal::backdrop { background: rgba(3, 18, 21, 0.55); backdrop-filter: blur(4px); }
.modal-wide { width: min(1040px, calc(100vw - 2rem)); }
.modal-sm { width: min(460px, calc(100vw - 2rem)); }

.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.15rem 1.25rem 0.9rem;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  background: var(--surface);
  z-index: 2;
}
.modal-head h2 { margin-top: 0.1rem; }
.modal-head p { color: var(--muted); font-size: 0.82rem; margin-top: 0.15rem; }
.modal > .form,
.modal > form { padding: 1.15rem 1.25rem 1.25rem; }
.modal-lead { color: var(--muted); font-size: 0.85rem; }

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  padding-top: 0.9rem;
  margin-top: 0.25rem;
  border-top: 1px solid var(--line);
}

body.modal-open { overflow: hidden; }

.admin-shell { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: 100vh; }

.sidebar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  height: 100vh;
  padding: 1.1rem 0.9rem 0.9rem;
  background:
    radial-gradient(420px 260px at 20% 0%, rgba(53, 205, 184, 0.13), transparent 70%),
    linear-gradient(180deg, #07272c, #061c20 60%, #05171a);
  color: #dcefec;
  border-right: 1px solid rgba(120, 200, 190, 0.14);
  overflow-y: auto;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.3rem 0.45rem 0.9rem;
  border-bottom: 1px solid rgba(120, 200, 190, 0.14);
  color: #f0fbf9;
}
.sidebar-brand:hover { color: #ffffff; }

.brand { display: inline-flex; align-items: center; gap: 0.7rem; color: inherit; }
.brand:hover { color: inherit; }

.brand-mark {
  display: inline-flex;
  align-items: flex-end;
  gap: 3px;
  width: 34px;
  height: 34px;
  padding: 7px;
  border-radius: 11px;
  background: linear-gradient(145deg, var(--brand), var(--brand-2));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.28), 0 6px 14px -6px rgba(8, 88, 80, 0.7);
  flex: none;
}
.brand-mark span { flex: 1; border-radius: 2px; background: rgba(255, 255, 255, 0.92); }
.brand-mark span:nth-child(1) { height: 38%; }
.brand-mark span:nth-child(2) { height: 70%; }
.brand-mark span:nth-child(3) { height: 100%; background: rgba(255, 255, 255, 0.66); }
.brand-mark-sm { width: 30px; height: 30px; padding: 6px; border-radius: 9px; }

.brand-text { display: grid; gap: 0.02rem; line-height: 1.2; }
.brand-text strong { font-size: 0.92rem; font-weight: 700; letter-spacing: -0.01em; }
.brand-text small { color: rgba(214, 239, 235, 0.62); font-size: 0.66rem; letter-spacing: 0.04em; }

.side-nav { display: grid; gap: 0.2rem; align-content: start; flex: 1; }
.nav-section {
  padding: 0.9rem 0.65rem 0.3rem;
  color: rgba(190, 226, 220, 0.42);
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}
.side-link {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.55rem 0.65rem;
  border: 1px solid transparent;
  border-radius: 10px;
  color: rgba(212, 238, 234, 0.74);
  font-size: 0.84rem;
  font-weight: 550;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.side-link .icon { width: 18px; height: 18px; opacity: 0.8; }
.side-link:hover { background: rgba(255, 255, 255, 0.06); color: #ffffff; }
.side-link.is-active {
  background: linear-gradient(90deg, rgba(53, 205, 184, 0.19), rgba(53, 205, 184, 0.05));
  border-color: rgba(53, 205, 184, 0.28);
  color: #ffffff;
  box-shadow: inset 2px 0 0 #35cdb8;
}
.side-link.is-active .icon { color: #55e0cc; opacity: 1; }
.nav-badge {
  margin-left: auto;
  min-width: 20px;
  padding: 0.05rem 0.4rem;
  border-radius: 999px;
  background: var(--crit);
  color: #ffffff;
  font-size: 0.66rem;
  font-weight: 800;
  text-align: center;
}

.sidebar-footer { display: grid; gap: 0.7rem; padding-top: 0.8rem; border-top: 1px solid rgba(120, 200, 190, 0.14); }
.demo-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.4rem 0.55rem;
  border-radius: 8px;
  background: rgba(229, 107, 63, 0.16);
  border: 1px solid rgba(229, 107, 63, 0.28);
  color: #ffb593;
  font-size: 0.7rem;
  font-weight: 700;
}
.demo-badge .icon { width: 13px; height: 13px; }
.sidebar-user { display: flex; align-items: center; gap: 0.55rem; }
.sidebar-user-text { display: grid; min-width: 0; flex: 1; line-height: 1.25; }
.sidebar-user-text strong { font-size: 0.8rem; color: #eefaf8; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-user-text small { color: rgba(190, 226, 220, 0.55); font-size: 0.68rem; }
.sidebar-user .avatar { background: linear-gradient(135deg, #35cdb8, #4bb6d8); }
.sidebar-user .icon-btn { color: rgba(220, 240, 236, 0.65); }
.sidebar-user .icon-btn:hover { background: rgba(255, 255, 255, 0.08); color: #ffffff; }

.sidebar-overlay { display: none; }

.admin-main { min-width: 0; display: flex; flex-direction: column; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 0.9rem;
  padding: 0.7rem 1.4rem;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
}
.sidebar-toggle { display: none; }
.topbar-title { min-width: 0; flex: 1; line-height: 1.2; }
.topbar-title h1 { font-size: 1.05rem; font-weight: 700; }
.topbar-title p { color: var(--muted); font-size: 0.75rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar-actions { display: flex; align-items: center; gap: 0.5rem; }
.user-chip {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.2rem 0.5rem 0.2rem 0.2rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  font-size: 0.78rem;
  font-weight: 650;
}

.theme-toggle { position: relative; }
.theme-toggle .icon { width: 18px; height: 18px; }
.icon-sun { display: none; }
html[data-theme="dark"] .icon-sun { display: block; }
html[data-theme="dark"] .icon-moon { display: none; }

.page { width: 100%; max-width: 1480px; margin: 0 auto; padding: 1.4rem 1.5rem 3rem; }

.admin-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0.8rem; margin-bottom: 1rem; }
.admin-kpi {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.9rem 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}
.admin-kpi > div { display: grid; min-width: 0; line-height: 1.25; }
.admin-kpi > div > span { color: var(--muted); font-size: 0.72rem; font-weight: 650; letter-spacing: 0.02em; }
.admin-kpi strong { font-size: 1.5rem; font-weight: 750; letter-spacing: -0.03em; }
.admin-kpi strong.is-time { font-variant-numeric: tabular-nums; }
.admin-kpi small { color: var(--muted); font-size: 0.7rem; }
.admin-kpi-icon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: var(--brand-soft);
  color: var(--brand);
  flex: none;
}
.admin-kpi-icon .icon { width: 20px; height: 20px; }
.tone-brand { background: var(--brand-soft); color: var(--brand); }
.tone-brand2 { background: var(--brand-2-soft); color: var(--brand-2); }
.tone-warn { background: var(--warn-soft); color: var(--warn); }
.tone-crit { background: var(--crit-soft); color: var(--crit); }
.tone-ok { background: var(--ok-soft); color: var(--ok); }
.tone-muted { background: var(--surface-3); color: var(--muted); }

.admin-columns { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr); gap: 1rem; margin-bottom: 1rem; align-items: start; }
.admin-columns > .panel + .panel { margin-top: 0; }

.mini-list { display: grid; }
.mini-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1.25rem;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  transition: background 0.12s ease;
}
.mini-row:last-child { border-bottom: 0; }
.mini-row:hover { background: var(--surface-2); color: var(--ink); }
.mini-main { display: grid; gap: 0.05rem; min-width: 0; flex: 1; line-height: 1.3; }
.mini-main strong { font-size: 0.85rem; }
.mini-main small { color: var(--muted); font-size: 0.73rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini-meta { display: flex; align-items: center; gap: 0.5rem; color: var(--muted); font-size: 0.74rem; flex-wrap: wrap; justify-content: flex-end; }
.mini-row > .icon { color: var(--muted-2); width: 16px; height: 16px; }

.alert-feed { display: grid; }
.alert-feed-item {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  padding: 0.75rem 1.25rem;
  border-bottom: 1px solid var(--line);
  border-left: 3px solid var(--warn);
}
.alert-feed-item:last-child { border-bottom: 0; }
.alert-feed-item.sev-crit { border-left-color: var(--crit); background: color-mix(in srgb, var(--crit-soft) 35%, transparent); }
.alert-feed-icon {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: var(--warn-soft);
  color: var(--warn);
  flex: none;
}
.sev-crit .alert-feed-icon { background: var(--crit-soft); color: var(--crit); }
.alert-feed-icon .icon { width: 15px; height: 15px; }
.alert-feed-body { display: grid; gap: 0.08rem; min-width: 0; flex: 1; line-height: 1.35; }
.alert-feed-body strong { font-size: 0.84rem; }
.alert-feed-body span { color: var(--ink-soft); font-size: 0.8rem; }
.alert-feed-body small { color: var(--muted); font-size: 0.7rem; }

.alert-list { display: grid; }
.alert-row {
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--line);
  border-left: 3px solid var(--warn);
}
.alert-row:last-child { border-bottom: 0; }
.alert-row.sev-crit { border-left-color: var(--crit); }
.alert-row-icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 11px;
  background: var(--warn-soft);
  color: var(--warn);
  flex: none;
}
.alert-row.sev-crit .alert-row-icon { background: var(--crit-soft); color: var(--crit); }
.alert-row-icon .icon { width: 18px; height: 18px; }
.alert-row-main { display: grid; gap: 0.3rem; flex: 1; min-width: 0; }
.alert-row-title { display: flex; align-items: center; gap: 0.4rem; flex-wrap: wrap; }
.alert-row-title strong { font-size: 0.9rem; }
.alert-row-main p { color: var(--ink-soft); font-size: 0.84rem; }
.alert-row-meta { display: flex; flex-wrap: wrap; gap: 0.4rem 0.9rem; color: var(--muted); font-size: 0.72rem; }
.alert-row-meta span { display: inline-flex; align-items: center; gap: 0.3rem; }
.alert-row-meta .icon { width: 12px; height: 12px; }
.alert-row-actions { display: flex; align-items: center; align-self: center; }
.alert-row-actions .btn { white-space: nowrap; }

.timeline { display: grid; gap: 0.9rem; padding: 1.1rem 1.25rem; }
.timeline-item { display: flex; gap: 0.7rem; }
.timeline-dot {
  width: 9px;
  height: 9px;
  margin-top: 0.38rem;
  border-radius: 50%;
  background: var(--brand);
  box-shadow: 0 0 0 4px var(--brand-soft);
  flex: none;
}
.timeline-item > div { display: grid; gap: 0.05rem; line-height: 1.4; }
.timeline-item strong { font-size: 0.84rem; }
.timeline-item p { color: var(--ink-soft); font-size: 0.8rem; }
.timeline-item small { color: var(--muted); font-size: 0.7rem; }

.info-list { display: grid; padding: 0.35rem 1.25rem 0.9rem; }
.info-list > div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.55rem 0;
  border-bottom: 1px dashed var(--line);
  font-size: 0.83rem;
}
.info-list > div:last-child { border-bottom: 0; }
.info-list span { color: var(--muted); }
.info-list strong { text-align: right; font-weight: 650; font-size: 0.83rem; }

.danger-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin: 1.1rem 1.25rem 1.25rem;
  padding: 0.9rem 1rem;
  border: 1px dashed color-mix(in srgb, var(--crit) 38%, transparent);
  border-radius: 12px;
  background: color-mix(in srgb, var(--crit-soft) 48%, transparent);
  flex-wrap: wrap;
}
.danger-box strong { color: var(--crit); font-size: 0.88rem; }
.danger-box p { color: var(--muted); font-size: 0.78rem; margin-top: 0.1rem; }

.sticky-actions {
  position: sticky;
  bottom: 0.75rem;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin: 1rem 0;
  padding: 0.7rem 0.75rem 0.7rem 1rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
  flex-wrap: wrap;
}
.sticky-actions-text { color: var(--muted); font-size: 0.78rem; }

.tabs { display: inline-flex; align-items: center; gap: 0.2rem; padding: 0.2rem; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); flex-wrap: wrap; }
.tabs button, .tab-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.38rem 0.65rem;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 650;
  transition: background 0.15s ease, color 0.15s ease;
  white-space: nowrap;
}
.tabs button .icon { width: 14px; height: 14px; }
.tabs button:hover, .tab-link:hover { background: var(--surface); color: var(--ink); }
.tabs button.is-active, .tab-link.is-active { background: var(--surface); color: var(--brand); box-shadow: var(--shadow-sm); }
.tabs-sm { padding: 0.15rem; }
.tabs-sm .tab-link { padding: 0.3rem 0.5rem; font-size: 0.72rem; }
.tab-count { min-width: 18px; padding: 0 0.28rem; border-radius: 999px; background: var(--surface-3); color: var(--muted); font-size: 0.65rem; text-align: center; }
.tab-link.is-active .tab-count { background: var(--brand-soft); color: var(--brand); }

.filters-bar {
  display: flex;
  align-items: flex-end;
  gap: 0.55rem;
  padding: 0.8rem 1.25rem;
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
  flex-wrap: wrap;
}
.filters-bar .field { flex: 1 1 130px; }
.filters-bar .btn { margin-bottom: 1px; }

.readings-layout { display: grid; grid-template-columns: minmax(320px, 0.8fr) minmax(0, 1.2fr); gap: 1rem; align-items: start; }
.panel-form .form { padding: 1.1rem 1.25rem 1.25rem; }
.panel-form .panel-head + .form { padding-top: 1rem; }
.reading-inputs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.7rem; }

.reading-preview {
  padding: 0.75rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-2);
  transition: border-color 0.15s ease, background 0.15s ease;
}
.reading-preview.has-alerts { border-color: color-mix(in srgb, var(--warn) 35%, transparent); background: color-mix(in srgb, var(--warn-soft) 30%, var(--surface-2)); }
.reading-preview-head { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; margin-bottom: 0.55rem; }
.reading-preview-head > span:first-child { display: inline-flex; align-items: center; gap: 0.35rem; color: var(--ink-soft); font-size: 0.76rem; font-weight: 700; }
.reading-preview-head .icon { width: 14px; height: 14px; color: var(--brand); }
.preview-summary { font-size: 0.72rem; font-weight: 700; color: var(--muted); }
.preview-summary.is-ok { color: var(--ok); }
.preview-summary.is-pre { color: var(--warn); }
.preview-summary.is-alert { color: var(--crit); }
.reading-preview-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.45rem; }
.preview-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 0.5rem;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface);
}
.preview-item.is-ok { border-color: color-mix(in srgb, var(--ok) 20%, var(--line)); }
.preview-item.is-pre { border-color: color-mix(in srgb, var(--warn) 32%, var(--line)); }
.preview-item.is-warn { border-color: color-mix(in srgb, var(--warn) 52%, var(--line)); background: color-mix(in srgb, var(--warn-soft) 35%, var(--surface)); }
.preview-item.is-crit { border-color: color-mix(in srgb, var(--crit) 50%, var(--line)); background: color-mix(in srgb, var(--crit-soft) 35%, var(--surface)); }
.preview-icon { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 7px; background: var(--surface-3); color: var(--muted); flex: none; }
.preview-item.is-ok .preview-icon { background: var(--ok-soft); color: var(--ok); }
.preview-item.is-pre .preview-icon { background: var(--warn-soft); color: var(--warn); }
.preview-item.is-warn .preview-icon { background: var(--warn-soft); color: var(--warn); }
.preview-item.is-crit .preview-icon { background: var(--crit-soft); color: var(--crit); }
.preview-icon .icon { width: 13px; height: 13px; }
.preview-copy { display: grid; min-width: 0; flex: 1; line-height: 1.15; }
.preview-copy > span { color: var(--muted); font-size: 0.66rem; }
.preview-copy strong { font-size: 0.85rem; font-variant-numeric: tabular-nums; }
.preview-copy small { color: var(--muted); font-size: 0.65rem; font-weight: 500; }
.preview-state { font-size: 0.62rem; font-weight: 700; color: var(--muted); text-align: right; }
.preview-item.is-ok .preview-state { color: var(--ok); }
.preview-item.is-pre .preview-state { color: var(--warn); }
.preview-item.is-warn .preview-state { color: var(--warn); }
.preview-item.is-crit .preview-state { color: var(--crit); }

.reading-result {
  display: grid;
  gap: 0.15rem;
  padding: 0.7rem 0.8rem;
  border-radius: 10px;
  font-size: 0.8rem;
  border: 1px solid transparent;
}
.reading-result strong { display: flex; align-items: center; gap: 0.35rem; font-size: 0.82rem; }
.reading-result .icon { width: 14px; height: 14px; }
.reading-result.is-ok { background: var(--ok-soft); color: var(--ok); border-color: color-mix(in srgb, var(--ok) 25%, transparent); }
.reading-result.is-alert { background: var(--warn-soft); color: var(--warn); border-color: color-mix(in srgb, var(--warn) 30%, transparent); }

.threshold-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.75rem; padding: 1.1rem 1.25rem 1.25rem; }
.threshold-grid-sm { padding: 0; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.threshold-card { display: grid; gap: 0.55rem; padding: 0.75rem; border: 1px solid var(--line); border-radius: 11px; background: var(--surface-2); }
.threshold-card-head { display: flex; align-items: center; gap: 0.55rem; }
.threshold-card-head > div { display: grid; line-height: 1.3; }
.threshold-card-head strong { font-size: 0.82rem; }
.threshold-card-head small { color: var(--muted); font-size: 0.68rem; }
.threshold-icon { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 9px; background: var(--brand-soft); color: var(--brand); flex: none; }
.threshold-icon .icon { width: 16px; height: 16px; }
.threshold-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 0.45rem; }

.override-list { display: grid; gap: 0.55rem; padding: 1.1rem 1.25rem 1.25rem; }
.override-card { border: 1px solid var(--line); border-radius: 11px; background: var(--surface); overflow: hidden; }
.override-card[open] { border-color: color-mix(in srgb, var(--brand) 32%, var(--line)); }
.override-card summary {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.7rem 0.85rem;
  cursor: pointer;
  list-style: none;
  background: var(--surface-2);
  transition: background 0.15s ease;
}
.override-card summary::-webkit-details-marker { display: none; }
.override-card summary:hover { background: var(--surface-3); }
.override-title { display: grid; flex: 1; min-width: 0; line-height: 1.3; }
.override-title strong { font-size: 0.84rem; }
.override-title small { color: var(--muted); font-size: 0.71rem; }
.override-chevron { transition: transform 0.18s ease; color: var(--muted); }
.override-card[open] .override-chevron { transform: rotate(180deg); }
.override-body { display: grid; gap: 0.75rem; padding: 0.85rem; border-top: 1px solid var(--line); }

.margin-visual { padding: 0 1.25rem 1rem; }
.margin-bar { display: flex; height: 30px; border-radius: 8px; overflow: hidden; border: 1px solid var(--line); font-size: 0.58rem; font-weight: 700; text-align: center; }
.margin-zone { display: flex; align-items: center; justify-content: center; padding: 0 0.2rem; }
.zone-crit-low, .zone-crit-high { background: var(--crit-soft); color: var(--crit); flex: 1; }
.zone-warn-low, .zone-warn-high { background: var(--warn-soft); color: var(--warn); flex: 1.2; }
.zone-ok { background: var(--ok-soft); color: var(--ok); flex: 2.5; }
.margin-visual p { margin-top: 0.35rem; color: var(--muted); font-size: 0.7rem; }

.stations-table .station-cell { min-width: 180px; }
.users-table .user-cell { min-width: 170px; }

.auth-page { background: var(--bg-2); }
.auth-page #toastStack { z-index: 300; }

.auth-shell {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  min-height: 100vh;
  max-width: 1320px;
  margin: 0 auto;
  padding: 1.25rem;
  gap: 1.25rem;
  align-items: stretch;
}
.auth-shell-single { grid-template-columns: minmax(0, 560px); justify-content: center; align-content: center; }

.auth-visual {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 2rem;
  padding: clamp(1.4rem, 3vw, 2.6rem);
  border-radius: var(--radius-lg);
  background:
    radial-gradient(600px 360px at 18% 8%, rgba(53, 205, 184, 0.24), transparent 65%),
    radial-gradient(520px 380px at 100% 100%, rgba(75, 182, 216, 0.18), transparent 60%),
    linear-gradient(160deg, #082a30, #05181c 65%, #041215);
  color: var(--hero-ink);
  overflow: hidden;
}
.auth-visual-glow {
  position: absolute;
  width: 420px;
  height: 420px;
  right: -140px;
  top: 18%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(53, 205, 184, 0.18), transparent 68%);
  pointer-events: none;
}
.brand-light { color: #f0fbf9; position: relative; z-index: 1; }
.brand-light:hover { color: #ffffff; }
.brand-light .brand-text small { color: rgba(214, 239, 235, 0.6); }
.auth-visual-copy { position: relative; z-index: 1; max-width: 560px; }
.auth-visual-copy .eyebrow { color: #55e0cc; }
.auth-visual-copy h1 { margin: 0.5rem 0 0.7rem; color: #f2fbf9; font-size: clamp(2rem, 3.6vw, 3rem); letter-spacing: -0.035em; }
.auth-visual-copy p { color: rgba(218, 240, 237, 0.72); font-size: 0.95rem; max-width: 46ch; }
.auth-features { display: grid; gap: 0.55rem; margin-top: 1.4rem; padding: 0; list-style: none; }
.auth-features li {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  color: rgba(226, 245, 242, 0.86);
  font-size: 0.85rem;
}
.auth-features li .icon { width: 17px; height: 17px; color: #55e0cc; flex: none; }
.auth-visual-foot { position: relative; z-index: 1; color: rgba(190, 226, 220, 0.48); font-size: 0.72rem; letter-spacing: 0.02em; }

.auth-card {
  align-self: center;
  width: 100%;
  padding: clamp(1.3rem, 3vw, 2.2rem);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow);
}
.auth-shell-login .auth-card { max-width: 470px; justify-self: center; }
.auth-card-center { text-align: center; display: grid; justify-items: center; gap: 0.6rem; max-width: 560px; }
.auth-card-head { display: flex; gap: 0.75rem; align-items: flex-start; margin-bottom: 1.1rem; }
.auth-card-head p { color: var(--muted); font-size: 0.82rem; margin-top: 0.12rem; }
.auth-logo {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 13px;
  background: var(--brand-soft);
  color: var(--brand);
  flex: none;
}
.auth-logo .icon { width: 21px; height: 21px; }
.auth-card .form { margin-top: 0.2rem; }
.auth-card .alert { margin-bottom: 0.8rem; }
.auth-links { margin-top: 1rem; padding-top: 0.9rem; border-top: 1px solid var(--line); display: flex; justify-content: center; }
.auth-links a { display: inline-flex; align-items: center; gap: 0.3rem; font-size: 0.8rem; font-weight: 600; }
.auth-links .icon { width: 14px; height: 14px; rotate: 180deg; }
.auth-lead { color: var(--muted); max-width: 44ch; }
.auth-actions { display: grid; gap: 0.55rem; width: 100%; margin-top: 0.8rem; }
.auth-card-center h1 { margin-top: 0.35rem; }

.public-page { padding-bottom: 0; }
.public-topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0.7rem 1.4rem;
}
.public-topbar::before {
  content: "";
  position: fixed;
  inset: 0 0 auto;
  height: 66px;
  z-index: -1;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
}
.public-actions { display: flex; align-items: center; gap: 0.55rem; flex-wrap: wrap; justify-content: flex-end; }
.live-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.28rem 0.55rem;
  border-radius: 999px;
  background: var(--ok-soft);
  color: var(--ok);
  border: 1px solid color-mix(in srgb, var(--ok) 22%, transparent);
  font-size: 0.68rem;
  font-weight: 700;
}
.live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 0 0 color-mix(in srgb, var(--ok) 50%, transparent);
  animation: pulse-dot 2s ease-out infinite;
}
@keyframes pulse-dot {
  0% { box-shadow: 0 0 0 0 color-mix(in srgb, currentColor 45%, transparent); }
  70% { box-shadow: 0 0 0 7px transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}
.last-update { color: var(--muted); font-size: 0.72rem; white-space: nowrap; }
.public-subbar {
  max-width: 1240px;
  margin: 0.5rem auto 0;
  padding: 0 1.4rem;
}
.public-subbar p { color: var(--muted); font-size: 0.86rem; }

.public-main { width: 100%; max-width: 1240px; margin: 0 auto; padding: 1.4rem 1.4rem 2rem; }

.public-hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
  gap: 1.5rem;
  align-items: center;
  padding: clamp(1.4rem, 3vw, 2.6rem);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background:
    radial-gradient(700px 320px at 0% 0%, color-mix(in srgb, var(--brand-soft) 70%, transparent), transparent 70%),
    linear-gradient(160deg, var(--surface), var(--surface-2));
  box-shadow: var(--shadow);
  overflow: hidden;
}
.hero-copy .eyebrow { margin-bottom: 0.35rem; }
.hero-copy h1 { margin: 0.15rem 0 0.7rem; font-size: clamp(2rem, 3.4vw, 3rem); letter-spacing: -0.035em; max-width: 18ch; }
.hero-copy > p { color: var(--muted); font-size: 0.95rem; max-width: 52ch; }
.hero-actions { display: flex; gap: 0.55rem; flex-wrap: wrap; margin-top: 1.15rem; }
.hero-facts { display: flex; gap: 1.5rem; margin: 1.35rem 0 0; padding: 1rem 0 0; border-top: 1px solid var(--line); list-style: none; flex-wrap: wrap; }
.hero-facts li { display: grid; line-height: 1.15; }
.hero-facts strong { font-size: 1.35rem; letter-spacing: -0.03em; }
.hero-facts span { color: var(--muted); font-size: 0.72rem; }

.hero-visual {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 260px;
  border-radius: 20px;
  background:
    radial-gradient(420px 300px at 50% 45%, rgba(53, 205, 184, 0.17), transparent 70%),
    linear-gradient(160deg, #072a30, #04171b);
  border: 1px solid rgba(100, 210, 195, 0.16);
  overflow: hidden;
}
.radar { position: relative; width: min(240px, 70%); aspect-ratio: 1; display: grid; place-items: center; }
.radar-ring {
  position: absolute;
  inset: 0;
  border: 1px solid rgba(110, 224, 207, 0.16);
  border-radius: 50%;
}
.radar-ring-1 { inset: 12%; }
.radar-ring-2 { inset: 27%; }
.radar-ring-3 { inset: 42%; }
.radar-sweep {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: conic-gradient(from 0deg, transparent 0deg, rgba(85, 224, 204, 0.28) 28deg, transparent 70deg);
  animation: sweep 7s linear infinite;
  mask-image: radial-gradient(circle, transparent 0%, #000 8%, #000 100%);
}
@keyframes sweep { to { transform: rotate(360deg); } }
.radar-core {
  position: relative;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: linear-gradient(145deg, #35cdb8, #228a9d);
  color: #042024;
  box-shadow: 0 0 0 10px rgba(53, 205, 184, 0.11), 0 0 40px rgba(53, 205, 184, 0.35);
}
.radar-core .icon { width: 30px; height: 30px; }
.radar-node {
  position: absolute;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #55e0cc;
  box-shadow: 0 0 0 4px rgba(85, 224, 204, 0.16), 0 0 14px rgba(85, 224, 204, 0.8);
}
.radar-node-1 { top: 16%; left: 24%; }
.radar-node-2 { top: 30%; right: 14%; animation: blink 3s 0.4s infinite; }
.radar-node-3 { bottom: 18%; left: 32%; animation: blink 3s 1.1s infinite; }
.radar-node-4 { bottom: 27%; right: 27%; animation: blink 4s 1.8s infinite; }
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }
.hero-visual-label {
  position: absolute;
  left: 1rem;
  bottom: 0.9rem;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.3rem 0.6rem;
  border-radius: 999px;
  background: rgba(5, 26, 29, 0.7);
  border: 1px solid rgba(100, 210, 195, 0.22);
  color: #a9eee2;
  font-size: 0.68rem;
  font-weight: 700;
  backdrop-filter: blur(6px);
}

.kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0.8rem; margin: 1rem 0; }
.kpi-card {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.95rem 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.kpi-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.kpi-icon { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; background: var(--surface-3); color: var(--muted); flex: none; }
.kpi-icon .icon { width: 19px; height: 19px; }
.kpi-card.tone-brand .kpi-icon { background: var(--brand-soft); color: var(--brand); }
.kpi-card.tone-brand2 .kpi-icon { background: var(--brand-2-soft); color: var(--brand-2); }
.kpi-card.tone-warn .kpi-icon { background: var(--warn-soft); color: var(--warn); }
.kpi-card.tone-crit .kpi-icon { background: var(--crit-soft); color: var(--crit); }
.kpi-card.tone-ok .kpi-icon { background: var(--ok-soft); color: var(--ok); }
.kpi-card.tone-muted .kpi-icon { background: var(--surface-3); color: var(--muted); }
.kpi-copy { display: grid; min-width: 0; line-height: 1.2; }
.kpi-label { color: var(--muted); font-size: 0.72rem; font-weight: 650; }
.kpi-value { font-size: 1.5rem; font-weight: 750; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.kpi-sub { color: var(--muted); font-size: 0.7rem; }

.alert-strip {
  display: grid;
  gap: 0.65rem;
  padding: 0.9rem 1rem;
  margin-bottom: 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}
.alert-strip.is-ok { display: flex; align-items: center; gap: 0.7rem; border-color: color-mix(in srgb, var(--ok) 26%, var(--line)); background: color-mix(in srgb, var(--ok-soft) 45%, var(--surface)); }
.alert-strip.is-active { border-color: color-mix(in srgb, var(--warn) 34%, var(--line)); background: color-mix(in srgb, var(--warn-soft) 28%, var(--surface)); }
.alert-strip-icon { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: var(--ok-soft); color: var(--ok); flex: none; }
.alert-strip-copy { display: grid; gap: 0.08rem; flex: 1; line-height: 1.3; }
.alert-strip-copy strong { display: inline-flex; align-items: center; gap: 0.35rem; font-size: 0.86rem; }
.alert-strip-copy p { color: var(--muted); font-size: 0.78rem; }
.alert-strip-time { display: inline-flex; align-items: center; gap: 0.3rem; color: var(--muted); font-size: 0.7rem; white-space: nowrap; }
.alert-strip-head { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; flex-wrap: wrap; }
.alert-strip-list { display: grid; gap: 0.35rem; }
.alert-chip {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.45rem 0.6rem;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface);
  font-size: 0.78rem;
}
.alert-chip-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.alert-chip-body { display: flex; gap: 0.35rem; min-width: 0; flex: 1; flex-wrap: wrap; }
.alert-chip-body strong { font-size: 0.78rem; }
.alert-chip-body span { color: var(--muted); font-size: 0.76rem; }
.alert-chip-time { color: var(--muted-2); font-size: 0.68rem; white-space: nowrap; }

.section-head { display: flex; align-items: flex-end; gap: 1rem; margin: 1.35rem 0 0.8rem; flex-wrap: wrap; }
.section-title { flex: 1; min-width: 180px; }
.section-title h2 { font-size: 1.35rem; margin-top: 0.1rem; }
.station-filters { display: inline-flex; gap: 0.2rem; padding: 0.2rem; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); }
.filter-btn { padding: 0.32rem 0.6rem; border: 0; border-radius: 6px; background: transparent; color: var(--muted); font-size: 0.74rem; font-weight: 650; }
.filter-btn:hover { background: var(--surface-3); color: var(--ink); }
.filter-btn.is-active { background: var(--brand-soft); color: var(--brand); }
.section-meta { display: flex; align-items: center; gap: 0.35rem; color: var(--muted); font-size: 0.72rem; }
.section-meta .icon-btn { width: 30px; height: 30px; }

.stations-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.85rem; }
.station-card {
  position: relative;
  padding: 0.95rem 1rem 0.8rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease;
}
.station-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: var(--ok);
  opacity: 0.65;
}
.station-card.is-warn::before { background: var(--warn); }
.station-card.is-crit::before { background: var(--crit); }
.station-card.is-pre::before { background: var(--warn); opacity: 0.5; }
.station-card.is-nodata::before { background: var(--muted-2); }
.station-card.is-offline { opacity: 0.78; }
.station-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--line-strong); }
.station-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 0.6rem; margin-bottom: 0.7rem; }
.station-identity { display: flex; gap: 0.55rem; align-items: flex-start; min-width: 0; }
.station-identity .station-status-dot { margin-top: 0.35rem; }
.station-identity h3 { font-size: 0.98rem; }
.station-identity p { display: flex; align-items: center; gap: 0.25rem; margin-top: 0.12rem; color: var(--muted); font-size: 0.72rem; flex-wrap: wrap; }
.station-identity p .icon { width: 11px; height: 11px; }
.dot-sep { opacity: 0.5; }
.station-vars { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.45rem; }
.var-tile { padding: 0.45rem 0.5rem; border: 1px solid var(--line); border-radius: 9px; background: var(--surface-2); overflow: hidden; }
.var-tile.is-warn { border-color: color-mix(in srgb, var(--warn) 40%, var(--line)); background: color-mix(in srgb, var(--warn-soft) 30%, var(--surface-2)); }
.var-tile.is-crit { border-color: color-mix(in srgb, var(--crit) 42%, var(--line)); background: color-mix(in srgb, var(--crit-soft) 32%, var(--surface-2)); }
.var-tile.is-pre { border-color: color-mix(in srgb, var(--warn) 24%, var(--line)); }
.var-top { display: flex; align-items: center; gap: 0.3rem; color: var(--muted); font-size: 0.66rem; }
.var-icon .icon { width: 12px; height: 12px; }
.var-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.var-trend { display: inline-flex; align-items: center; gap: 0.1rem; margin-left: auto; color: var(--muted); font-size: 0.62rem; font-variant-numeric: tabular-nums; }
.var-trend .icon { width: 10px; height: 10px; }
.var-trend.is-up { color: var(--crit); }
.var-trend.is-down { color: var(--ok); }
.var-value { display: flex; align-items: baseline; gap: 0.15rem; margin-top: 0.1rem; line-height: 1.15; }
.var-value strong { font-size: 1.08rem; font-weight: 750; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.var-unit { color: var(--muted); font-size: 0.62rem; }
.var-empty { color: var(--muted-2); font-size: 1.1rem; }
.sparkline { height: 30px; margin-top: 0.1rem; }
.sparkline svg { width: 100%; height: 30px; overflow: visible; }
.station-card-foot { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; margin-top: 0.65rem; padding-top: 0.6rem; border-top: 1px solid var(--line); flex-wrap: wrap; }
.station-time { display: inline-flex; align-items: center; gap: 0.3rem; color: var(--muted); font-size: 0.68rem; }
.station-time .icon { width: 11px; height: 11px; }
.station-foot-actions { display: flex; align-items: center; gap: 0.4rem; }
.alert-count { display: inline-flex; align-items: center; gap: 0.2rem; padding: 0.2rem 0.45rem; border-radius: 999px; background: var(--crit-soft); color: var(--crit); font-size: 0.65rem; font-weight: 700; }
.alert-count .icon { width: 11px; height: 11px; }
.station-card-foot .btn { font-size: 0.72rem; padding: 0.32rem 0.55rem; }

.public-empty {
  display: grid;
  justify-items: center;
  gap: 0.35rem;
  padding: 3rem 1rem;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  text-align: center;
}
.public-empty h3 { margin-top: 0.2rem; }
.public-empty p { color: var(--muted); font-size: 0.85rem; max-width: 46ch; }
.public-note {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  margin-top: 1.2rem;
  padding: 0.8rem 1rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-2);
}
.public-note > span { color: var(--brand); }
.public-note p { color: var(--muted); font-size: 0.78rem; }

.public-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  max-width: 1240px;
  margin: 0 auto;
  padding: 1.2rem 1.4rem 1.6rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.75rem;
  flex-wrap: wrap;
}
.public-footer strong { color: var(--ink-soft); }
.footer-meta { display: flex; gap: 1rem; flex-wrap: wrap; }
.footer-meta span { display: inline-flex; align-items: center; gap: 0.3rem; }
.footer-meta .icon { width: 12px; height: 12px; }

.station-dialog-head { align-items: flex-start; }
.detail-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; padding: 0.8rem 1.25rem; flex-wrap: wrap; }
.range-group { display: inline-flex; gap: 0.15rem; padding: 0.18rem; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-2); }
.range-group button { padding: 0.3rem 0.55rem; border: 0; border-radius: 6px; background: transparent; color: var(--muted); font-size: 0.72rem; font-weight: 650; }
.range-group button:hover { color: var(--ink); }
.range-group button.is-active { background: var(--surface); color: var(--brand); box-shadow: var(--shadow-sm); }
.chart-meta { display: flex; align-items: center; gap: 0.75rem; padding: 0 1.25rem 0.55rem; flex-wrap: wrap; color: var(--muted); font-size: 0.72rem; }
.chart-meta-title { display: inline-flex; align-items: center; gap: 0.3rem; color: var(--ink); font-weight: 700; font-size: 0.8rem; }
.chart-meta-title .icon { width: 14px; height: 14px; color: var(--brand); }
.chart-meta-item::before { content: "·"; margin-right: 0.55rem; opacity: 0.4; }
.chart-wrap { position: relative; min-height: 240px; padding: 0 1.25rem 0.5rem; }
.chart-wrap-lg { min-height: 340px; }
.chart-wrap svg { width: 100%; height: auto; min-height: 260px; }
.chart-grid-line { stroke: var(--line); stroke-width: 1; opacity: 0.7; }
.chart-axis-text { fill: var(--muted); font-family: var(--font-sans); font-size: 11px; }
.chart-axis-tick { stroke: var(--line-strong); stroke-width: 1; }
.chart-range-band { fill: color-mix(in srgb, var(--brand-soft) 55%, transparent); }
.chart-threshold-line { stroke: var(--warn); stroke-width: 1.2; stroke-dasharray: 5 5; opacity: 0.75; }
.chart-threshold-line.chart-threshold-max { stroke: var(--crit); }
.chart-threshold-text { fill: var(--muted); font-family: var(--font-sans); font-size: 10px; font-weight: 600; }
.chart-hover-line { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 3 3; }
.chart-hover-dot { filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.25)); }
.chart-tooltip {
  position: absolute;
  transform: translate(-50%, -120%);
  display: grid;
  gap: 0.05rem;
  padding: 0.35rem 0.5rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
  font-size: 0.7rem;
  pointer-events: none;
  white-space: nowrap;
  z-index: 3;
}
.chart-tooltip.is-left { transform: translate(-100%, -120%); }
.chart-tooltip strong { font-size: 0.76rem; }
.chart-tooltip span { color: var(--muted); font-size: 0.65rem; }
.chart-loading { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.6rem; min-height: 260px; color: var(--muted); font-size: 0.8rem; }
.chart-empty { display: grid; justify-items: center; gap: 0.25rem; padding: 3rem 1rem; text-align: center; color: var(--muted); }
.chart-empty-icon { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; background: var(--surface-3); color: var(--muted); margin-bottom: 0.2rem; }
.chart-empty strong { color: var(--ink); }
.chart-empty p { font-size: 0.8rem; }
.detail-vars { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0.5rem; padding: 0.8rem 1.25rem 1.25rem; border-top: 1px solid var(--line); }
.detail-var { display: grid; gap: 0.1rem; padding: 0.5rem 0.6rem; border: 1px solid var(--line); border-radius: 9px; background: var(--surface-2); }
.detail-var-label { display: inline-flex; align-items: center; gap: 0.28rem; color: var(--muted); font-size: 0.68rem; }
.detail-var-label .icon { width: 12px; height: 12px; }
.detail-var strong { font-size: 0.92rem; font-variant-numeric: tabular-nums; }
.detail-var small { color: var(--muted); font-size: 0.65rem; font-weight: 500; }
.detail-var-state { font-size: 0.62rem; font-weight: 700; color: var(--muted); }
.detail-var.is-ok { border-color: color-mix(in srgb, var(--ok) 20%, var(--line)); }
.detail-var.is-ok .detail-var-state { color: var(--ok); }
.detail-var.is-pre .detail-var-state { color: var(--warn); }
.detail-var.is-warn, .detail-var.is-crit { border-color: color-mix(in srgb, var(--crit) 35%, var(--line)); }
.detail-var.is-warn .detail-var-state { color: var(--warn); }
.detail-var.is-crit .detail-var-state { color: var(--crit); }

.noscript {
  position: fixed;
  inset: auto 1rem 1rem;
  padding: 0.8rem 1rem;
  border-radius: 10px;
  background: var(--warn-soft);
  border: 1px solid var(--warn);
  color: var(--warn);
  font-size: 0.85rem;
  z-index: 400;
}

.demo-mode .public-note { border-style: dashed; }

@media (max-width: 1180px) {
  .admin-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .admin-columns { grid-template-columns: 1fr; }
  .admin-columns > .panel + .panel { margin-top: 1rem; }
  .readings-layout { grid-template-columns: 1fr; }
  .stations-grid { grid-template-columns: 1fr; }
}

@media (max-width: 1024px) {
  .admin-shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: min(300px, 84vw);
    transform: translateX(-104%);
    transition: transform 0.22s ease;
    z-index: 80;
  }
  .sidebar-open .sidebar { transform: translateX(0); }
  .sidebar-overlay {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 70;
    background: rgba(3, 18, 21, 0.5);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    backdrop-filter: blur(2px);
  }
  .sidebar-open .sidebar-overlay { opacity: 1; pointer-events: auto; }
  .sidebar-toggle { display: inline-flex; }
  .page { padding: 1.1rem 1rem 2.5rem; }
  .topbar { padding: 0.6rem 1rem; }
  .public-hero { grid-template-columns: 1fr; }
  .hero-visual { min-height: 220px; }
  .auth-shell { grid-template-columns: 1fr; max-width: 640px; }
  .auth-visual { min-height: 280px; }
  .auth-visual-copy h1 { font-size: 2rem; }
  .auth-shell-single { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 760px) {
  body { font-size: 14px; }
  .hide-sm { display: none; }
  .form-grid { grid-template-columns: 1fr; }
  .reading-inputs { grid-template-columns: 1fr; }
  .reading-preview-grid { grid-template-columns: 1fr; }
  .threshold-grid, .threshold-grid-sm { grid-template-columns: 1fr; }
  .detail-vars { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi-grid { grid-template-columns: 1fr; }
  .admin-kpis { grid-template-columns: 1fr; }
  .public-topbar { padding: 0.55rem 1rem; }
  .public-main { padding: 1rem 1rem 1.6rem; }
  .public-subbar { padding: 0 1rem; }
  .last-update { display: none; }
  .hero-copy h1 { max-width: none; }
  .hero-facts { gap: 1rem; }
  .public-footer { padding: 1rem; }
  .alert-strip.is-ok { align-items: flex-start; }
  .alert-strip-time { display: none; }
  .alert-chip-body { flex-direction: column; gap: 0.05rem; }
  .alert-chip-time { display: none; }
  .alert-row { flex-wrap: wrap; }
  .alert-row-actions { width: 100%; justify-content: flex-end; }
  .detail-toolbar { align-items: flex-start; }
  .range-group { width: 100%; }
  .range-group button { flex: 1; }
  .tabs { width: 100%; }
  .tabs button { flex: 1; justify-content: center; }
  .chart-wrap { padding: 0 0.75rem 0.5rem; }
  .chart-meta { padding: 0 0.75rem 0.55rem; }
  .detail-vars { padding: 0.75rem; }
  .modal-head { padding: 1rem; }
  .modal > .form, .modal > form { padding: 1rem; }
  .toast-stack { right: 0.75rem; bottom: 0.75rem; width: calc(100vw - 1.5rem); }
  .sticky-actions { position: static; }
  .filters-bar { padding: 0.75rem; }
  .filters-bar .field { flex: 1 1 100%; }
  .filters-bar .btn { flex: 1; }
  .auth-shell { padding: 0.75rem; }
  .auth-visual { display: none; }
  .auth-card { border-radius: 18px; }
  .public-footer { flex-direction: column; align-items: flex-start; }
}

@media (max-width: 480px) {
  .page { padding: 1rem 0.75rem 2rem; }
  .topbar { padding: 0.55rem 0.75rem; }
  .topbar-title p { display: none; }
  .kpi-card { padding: 0.8rem; }
  .station-vars { grid-template-columns: 1fr 1fr; }
  .station-card { padding: 0.85rem; }
  .hero-actions .btn { width: 100%; }
  .station-filters { width: 100%; }
  .filter-btn { flex: 1; }
  .section-meta { width: 100%; justify-content: space-between; }
  .detail-vars { grid-template-columns: 1fr; }
  .margin-bar { font-size: 0.5rem; }
  .info-list > div { flex-direction: column; align-items: flex-start; gap: 0.05rem; }
  .info-list strong { text-align: left; }
}

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