@import url("./fonts.css");

:root {
  --ink: #082f36;
  --muted: #668087;
  --surface: #ffffff;
  --canvas: #f2f7f6;
  --line: #dce9e7;
  --teal: #159987;
  --teal-bright: #24baa6;
  --teal-dark: #062e35;
  --orange: #f28a62;
  --red: #d95f5f;
  --shadow: 0 18px 50px rgba(6, 46, 53, .09);
  --radius-lg: 26px;
  --radius-md: 18px;
}

* { box-sizing: border-box; }
html { min-height: 100%; color-scheme: light; }
body { margin: 0; min-height: 100vh; font-family: "DM Sans", sans-serif; color: var(--ink); background: var(--canvas); }
button, input, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.eyebrow { margin: 0 0 9px; color: var(--teal); font-size: .73rem; font-weight: 800; letter-spacing: .13em; text-transform: uppercase; }

.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); font: 600 1.03rem "Manrope", sans-serif; text-decoration: none; }
.brand strong { font-weight: 800; }
.brand-light { color: #f5fffd; }
.brand-mark { display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; color: white; background: var(--teal-bright); font: 800 1.45rem "Manrope", sans-serif; box-shadow: 0 7px 20px rgba(36,186,166,.28); }
.topbar .brand { gap: 13px; }
.brand-logo-frame { position: relative; display: block; flex: 0 0 auto; width: 58px; height: 58px; overflow: hidden; }
.brand-logo { position: absolute; width: 116px; height: 116px; max-width: none; transform: translate(-29px, -21px); object-fit: contain; }
.brand-name { color: #0b4050; font: 700 1.33rem/1 "Fraunces", Georgia, serif; letter-spacing: -.025em; }
.brand-name strong { color: #1f7185; font-weight: 700; }

.button { display: inline-flex; align-items: center; justify-content: center; gap: 14px; min-height: 44px; padding: 0 18px; border: 0; border-radius: 12px; font-weight: 700; text-decoration: none; cursor: pointer; transition: transform .18s ease, opacity .18s ease, background .18s ease; }
.button:hover:not(:disabled) { transform: translateY(-1px); }
.button:focus-visible, input:focus-visible, select:focus-visible, .range-button:focus-visible, a:focus-visible { outline: 3px solid rgba(35,183,164,.28); outline-offset: 2px; }
.button:disabled { opacity: .55; cursor: wait; }
.button-primary { color: white; background: var(--teal); box-shadow: 0 10px 24px rgba(21,153,135,.2); }
.button-primary:hover:not(:disabled) { background: #108a79; }
.button-ghost { color: var(--ink); background: #eaf3f1; }
.button-wide { width: 100%; justify-content: space-between; min-height: 52px; padding-inline: 21px; }

.alert { margin: 18px 0; padding: 13px 16px; border: 1px solid; border-radius: 13px; font-size: .9rem; line-height: 1.5; }
.alert-warning { color: #7e5914; border-color: #f2dba8; background: #fff8e8; }
.alert-error { color: #8f3434; border-color: #f0c8c8; background: #fff0f0; }
.alert code { font-size: .84em; }
.connection-notice { position: fixed; z-index: 1000; top: 18px; left: 50%; display: flex; align-items: center; gap: 11px; width: max-content; max-width: calc(100% - 28px); padding: 13px 18px; border: 2px solid #ffd2d7; border-radius: 12px; color: #fff; background: #a8172c; box-shadow: 0 16px 40px rgba(87,8,21,.34); font-size: .86rem; font-weight: 800; letter-spacing: .005em; transform: translateX(-50%); }
.connection-notice-icon { display: inline-grid; width: 24px; height: 24px; flex: 0 0 auto; place-items: center; border: 2px solid rgba(255,255,255,.88); border-radius: 50%; font: 900 .78rem/1 "Manrope", sans-serif; }

/* Login */
.login-page { background: var(--teal-dark); }
.login-layout { display: grid; grid-template-columns: minmax(390px, 1.05fr) minmax(440px, .95fr); min-height: 100vh; }
.login-intro { position: relative; display: flex; flex-direction: column; justify-content: space-between; min-height: 100vh; padding: clamp(34px, 5vw, 72px); overflow: hidden; color: white; background: radial-gradient(circle at 80% 15%, rgba(43,204,182,.18), transparent 32%), linear-gradient(145deg, #07343b, #041f25); }
.login-intro::after { content: ""; position: absolute; width: 540px; height: 540px; right: -310px; top: calc(50% - 270px); border: 1px solid rgba(255,255,255,.08); border-radius: 50%; box-shadow: 0 0 0 80px rgba(255,255,255,.018), 0 0 0 160px rgba(255,255,255,.014); }
.login-branding { position: relative; z-index: 1; }
.login-official-brand { display: inline-flex; align-items: center; gap: 18px; color: white; text-decoration: none; }
.login-government-logo-frame { display: grid; place-items: center; flex: 0 0 auto; width: 92px; height: 92px; padding: 9px; overflow: hidden; border: 3px solid rgba(255,255,255,.85); border-radius: 50%; background: white; box-shadow: 0 12px 30px rgba(0,0,0,.16); }
.login-government-logo { display: block; width: 100%; height: 100%; object-fit: contain; }
.login-official-name { font: 700 clamp(1.45rem, 2.5vw, 2rem)/1.05 "Fraunces", Georgia, serif; letter-spacing: -.025em; }
.login-official-name strong { color: #85ddcf; font-weight: 600; }
.login-subtitle { max-width: 700px; margin: clamp(38px, 7vh, 70px) 0 0; color: white; font: 800 clamp(2.7rem, 5.3vw, 5.7rem)/.98 "Manrope", sans-serif; letter-spacing: -.055em; }
.login-copy { position: relative; z-index: 1; max-width: 630px; padding-block: 80px; }
.login-copy .eyebrow { color: #74dfd0; }
.login-copy h1 { margin: 0 0 25px; max-width: 700px; font: 800 clamp(2.7rem, 5.3vw, 5.7rem)/.98 "Manrope", sans-serif; letter-spacing: -.055em; }
.login-copy > p:last-child { max-width: 570px; margin: 0; color: #b8d0d3; font-size: clamp(1rem, 1.5vw, 1.2rem); line-height: 1.7; }
.login-copy-compact { padding-block: 50px; }
.water-lines { position: relative; z-index: 1; display: grid; gap: 7px; width: 110px; margin-bottom: 10px; }
.water-lines i { display: block; height: 2px; border-radius: 3px; background: #42cbb9; }
.water-lines i:nth-child(2) { width: 72%; opacity: .65; }
.water-lines i:nth-child(3) { width: 45%; opacity: .35; }
.login-panel { display: grid; place-items: center; padding: 40px; background: #f5f9f8; }
.login-card { display: grid; gap: 23px; width: min(100%, 430px); padding: clamp(28px, 5vw, 48px); border: 1px solid rgba(8,47,54,.07); border-radius: var(--radius-lg); background: white; box-shadow: var(--shadow); }
.login-card h2 { margin: 0 0 8px; font: 800 2rem "Manrope", sans-serif; letter-spacing: -.035em; }
.login-card p { margin: 0; line-height: 1.55; }
.field { display: grid; gap: 8px; color: #244a50; font-size: .86rem; font-weight: 700; }
.field input, .custom-range input { width: 100%; min-height: 50px; padding: 0 14px; border: 1px solid #cfdfdc; border-radius: 11px; color: var(--ink); background: #fbfdfd; transition: border-color .18s, box-shadow .18s; }
.field input:focus, .custom-range input:focus { border-color: var(--teal); box-shadow: 0 0 0 4px rgba(35,183,164,.09); outline: 0; }
.login-help { text-align: center; color: var(--muted); font-size: .8rem; }

/* Shared protected application */
.app-page { background: radial-gradient(circle at 84% 2%, rgba(58,198,177,.11), transparent 26%), var(--canvas); }
.app-shell { display: grid; grid-template-columns: 220px minmax(0, 1fr); grid-template-rows: auto 1fr; min-height: 100vh; }
.screen-loader { display: grid; place-content: center; justify-items: center; gap: 14px; min-height: 100vh; color: var(--muted); }
.screen-loader p { margin: 0; }
.spinner { width: 32px; height: 32px; border: 3px solid #c9dedb; border-top-color: var(--teal); border-radius: 50%; animation: spin .75s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.topbar { position: sticky; z-index: 10; top: 0; grid-column: 1 / -1; grid-row: 1; display: flex; align-items: center; justify-content: space-between; gap: 20px; min-height: 78px; padding: 0 clamp(20px, 5vw, 72px); border-bottom: 1px solid rgba(8,47,54,.07); background: rgba(255,255,255,.9); backdrop-filter: blur(16px); }
.sidebar { position: sticky; top: 78px; grid-column: 1; grid-row: 2; align-self: start; height: calc(100vh - 78px); padding: 32px 17px; border-right: 1px solid #183b43; background: linear-gradient(180deg, #12353d, #0a2930); box-shadow: 8px 0 28px rgba(5,31,36,.08); }
.alarm-sidebar { display: block; visibility: visible; opacity: 1; }
.sidebar-label { margin: 0 12px 15px; color: #86a1a7; font-size: .66rem; font-weight: 800; letter-spacing: .13em; text-transform: uppercase; }
.side-navigation { display: grid; gap: 7px; }
.side-nav-link { position: relative; display: flex; align-items: center; min-height: 47px; padding: 0 15px 0 38px; border: 1px solid transparent; border-radius: 4px; color: #c1d1d4; font-size: .85rem; font-weight: 800; text-decoration: none; transition: color .18s, background .18s, border-color .18s; }
.side-nav-link::before { content: ""; position: absolute; left: 17px; width: 7px; height: 7px; border: 1px solid #739097; border-radius: 1px; }
.side-nav-link:hover { color: white; border-color: rgba(255,255,255,.09); background: rgba(255,255,255,.055); }
.side-nav-link.active { color: white; border-color: #3e6670; background: #28515b; box-shadow: inset 3px 0 0 #5fc7d2; }
.side-nav-link.active::before { border-color: #7bd3dc; background: #7bd3dc; }
.side-nav-alert-count { display: inline-grid; min-width: 23px; height: 23px; margin-left: auto; padding: 0 6px; place-items: center; border: 2px solid rgba(255,255,255,.82); border-radius: 999px; color: #fff; background: #d3263f; box-shadow: 0 3px 12px rgba(211,38,63,.42); font-size: .68rem; font-weight: 900; line-height: 1; }
.session { display: flex; align-items: center; gap: 16px; }
.session-role { padding: 6px 10px; border-radius: 999px; color: #0b6f62; background: #e1f5f1; font-size: .69rem; font-weight: 800; letter-spacing: .045em; text-transform: uppercase; }
.session-email { max-width: 250px; overflow: hidden; color: var(--muted); font-size: .84rem; text-overflow: ellipsis; white-space: nowrap; }
.dashboard { grid-column: 2; grid-row: 2; width: min(1420px, calc(100% - 40px)); margin: 0 auto; padding: clamp(40px, 6vw, 78px) 0 70px; }
.hero { display: flex; align-items: flex-end; justify-content: space-between; gap: 35px; margin-bottom: 48px; }
.hero h1, .detail-hero h1 { margin: 0 0 10px; font: 800 clamp(2.25rem, 5vw, 4.1rem)/1.04 "Manrope", sans-serif; letter-spacing: -.055em; }
.hero p:last-child, .detail-hero p:last-child { margin: 0; color: var(--muted); font-size: 1.02rem; }
.summary { display: grid; grid-template-columns: repeat(3, minmax(90px, 1fr)); min-width: 350px; border: 1px solid var(--line); border-radius: 18px; background: rgba(255,255,255,.76); box-shadow: 0 8px 28px rgba(6,46,53,.04); }
.summary > div { display: grid; grid-template-columns: 8px auto; grid-template-rows: auto auto; column-gap: 10px; padding: 17px 20px; }
.summary > div + div { border-left: 1px solid var(--line); }
.summary-dot { grid-row: 1 / 3; align-self: center; width: 8px; height: 8px; border-radius: 50%; }
.online-dot { background: var(--teal-bright); box-shadow: 0 0 0 5px rgba(36,186,166,.12); }
.offline-dot { background: var(--orange); box-shadow: 0 0 0 5px rgba(242,138,98,.1); }
.total-dot { background: #7b9aa0; }
.summary strong { font: 800 1.35rem "Manrope", sans-serif; line-height: 1; }
.summary small { color: var(--muted); font-size: .71rem; text-transform: uppercase; }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 25px; margin-bottom: 20px; }
.section-heading h2 { margin: 0 0 5px; font: 800 1.3rem "Manrope", sans-serif; }
.section-heading p, .last-sync { margin: 0; color: var(--muted); font-size: .84rem; }
.nodes-grid { display: grid; grid-template-columns: repeat(3, minmax(260px, 1fr)); gap: 20px; }
.node-card { position: relative; display: flex; flex-direction: column; min-height: 330px; padding: 27px; border: 1px solid rgba(8,47,54,.08); border-radius: var(--radius-lg); overflow: hidden; background: var(--surface); box-shadow: 0 14px 40px rgba(6,46,53,.055); transition: transform .2s ease, box-shadow .2s ease; }
.node-card::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 4px; background: #b2c3c5; }
.node-card.is-online::before { background: var(--teal-bright); }
.node-card.is-offline::before { background: var(--orange); }
.node-card.has-alarm-low { border: 3px solid #0874c9; background: linear-gradient(145deg, #d9efff 0%, #acd8fa 54%, #89c5f0 100%); box-shadow: 0 0 0 4px rgba(8,116,201,.15), 0 22px 52px rgba(15,91,151,.28); }
.node-card.has-alarm-low::before { width: 9px; background: #075ea7; }
.node-card.has-alarm-high { border: 3px solid #c9253c; background: linear-gradient(145deg, #ffe1e3 0%, #ffb4ba 54%, #f78f99 100%); box-shadow: 0 0 0 4px rgba(201,37,60,.15), 0 22px 52px rgba(157,25,43,.28); }
.node-card.has-alarm-high::before { width: 9px; background: #a8172c; }
.node-card.has-alarm-low .temperature strong, .node-card.has-alarm-low .temperature span { color: #064f8d; }
.node-card.has-alarm-high .temperature strong, .node-card.has-alarm-high .temperature span { color: #8f1023; }
.node-card.has-alarm-low .temperature::before, .node-card.has-alarm-high .temperature::before { align-self: center; margin: -2px 3px 0 0; font: 900 clamp(2.4rem, 4vw, 3.7rem)/1 "Manrope", sans-serif; }
.node-card.has-alarm-low .temperature::before { content: "↓"; color: #075fa8; }
.node-card.has-alarm-high .temperature::before { content: "↑"; color: #a8172c; }
.node-card.has-alarm-low .mini-chart, .node-card.has-alarm-high .mini-chart { border-color: rgba(255,255,255,.7); background: rgba(255,255,255,.78); box-shadow: inset 0 0 0 1px rgba(255,255,255,.3); }
.node-card.has-alarm-low .last-update, .node-card.has-alarm-low .mini-chart-heading { color: #245d82; }
.node-card.has-alarm-high .last-update, .node-card.has-alarm-high .mini-chart-heading { color: #742b35; }
.node-card.has-alarm-low .detail-link { border-color: rgba(6,79,141,.22); color: #064f8d; }
.node-card.has-alarm-high .detail-link { border-color: rgba(143,16,35,.22); color: #8f1023; }
.node-card.has-alarm-low:hover { box-shadow: 0 0 0 4px rgba(8,116,201,.18), 0 26px 58px rgba(15,91,151,.34); }
.node-card.has-alarm-high:hover { box-shadow: 0 0 0 4px rgba(201,37,60,.18), 0 26px 58px rgba(157,25,43,.34); }
.node-card.has-sensor-error { border: 3px solid #d08213; background: linear-gradient(145deg, #fff7db 0%, #ffe9a8 58%, #ffd978 100%); box-shadow: 0 0 0 4px rgba(208,130,19,.14), 0 22px 52px rgba(137,82,7,.23); }
.node-card.has-sensor-error::before { width: 9px; background: #a96408; }
.node-card.has-sensor-error .temperature strong, .node-card.has-sensor-error .temperature span { color: #865006; }
.node-card.has-sensor-error .node-alarm-banner { background: #b66f0c; }
.node-card.has-sensor-error .node-alarm-banner i { background: rgba(0,0,0,.12); }
.node-card.has-sensor-error .mini-chart { border-color: rgba(255,255,255,.75); background: rgba(255,255,255,.78); }
.node-card.has-sensor-error .last-update, .node-card.has-sensor-error .mini-chart-heading { color: #78551f; }
.node-card.has-sensor-error .detail-link { border-color: rgba(134,80,6,.22); color: #865006; }
.node-card:hover { transform: translateY(-3px); box-shadow: 0 20px 50px rgba(6,46,53,.09); }
.node-card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.node-name { margin: 0; font: 800 1.28rem "Manrope", sans-serif; letter-spacing: -.025em; overflow-wrap: anywhere; }
.node-alarm-banner { display: flex; align-items: center; gap: 11px; margin: 19px -27px -21px; padding: 12px 27px; border-radius: 0; color: #fff; font-size: .8rem; font-weight: 900; letter-spacing: .075em; text-transform: uppercase; box-shadow: 0 7px 18px rgba(18,41,48,.15); }
.node-alarm-banner i { display: grid; width: 22px; height: 22px; flex: 0 0 auto; place-items: center; border: 2px solid rgba(255,255,255,.9); border-radius: 50%; }
.node-alarm-banner i::before { content: "!"; color: #fff; font: 900 .72rem/1 "Manrope", sans-serif; }
.has-alarm-low .node-alarm-banner { background: #0874c9; }
.has-alarm-high .node-alarm-banner { background: #c9253c; }
.has-alarm-low .node-alarm-banner i, .has-alarm-high .node-alarm-banner i { background: rgba(0,0,0,.12); }
.status-badge { display: inline-flex; align-items: center; gap: 7px; flex-shrink: 0; padding: 7px 10px; border-radius: 999px; color: #71898e; background: #edf3f2; font-size: .69rem; font-weight: 800; letter-spacing: .055em; text-transform: uppercase; }
.status-badge i { width: 7px; height: 7px; border-radius: 50%; background: #94a9ad; }
.is-online .status-badge, .status-badge.is-online { color: #087967; background: #e2f7f2; }
.is-online .status-badge i, .status-badge.is-online i { background: #18af98; box-shadow: 0 0 0 4px rgba(24,175,152,.12); }
.is-offline .status-badge, .status-badge.is-offline { color: #a65739; background: #fff0e9; }
.is-offline .status-badge i, .status-badge.is-offline i { background: var(--orange); }
.has-sensor-error .status-badge, .status-badge.is-sensor-error { color: #80520c; background: #fff1c7; }
.has-sensor-error .status-badge i, .status-badge.is-sensor-error i { background: #d08213; box-shadow: 0 0 0 4px rgba(208,130,19,.13); }
.status-badge.large { padding: 10px 14px; font-size: .76rem; }
.temperature { display: flex; align-items: flex-start; gap: 7px; margin: 45px 0 4px; }
.temperature strong { font: 700 clamp(3.5rem, 6vw, 5.1rem)/.88 "Manrope", sans-serif; letter-spacing: -.075em; }
.temperature span { margin-top: 5px; color: var(--teal); font: 700 1.35rem "Manrope", sans-serif; }
.last-update { margin: 9px 0 28px; color: var(--muted); font-size: .84rem; }
.mini-chart { margin: 0 0 20px; padding: 12px 13px 8px; border: 1px solid rgba(8,47,54,.065); border-radius: 13px; background: #f8fbfa; }
.mini-chart-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 4px; color: #779095; font-size: .67rem; font-weight: 700; letter-spacing: .045em; text-transform: uppercase; }
.mini-chart-range { color: #3e7770; letter-spacing: 0; text-transform: none; }
.mini-chart-frame { position: relative; height: 68px; }
.mini-chart-canvas { display: block; width: 100%; height: 100%; }
.mini-chart-empty { position: absolute; inset: 0; display: grid; place-items: center; color: #91a5a8; font-size: .72rem; }
.detail-link { display: flex; align-items: center; justify-content: space-between; margin-top: auto; padding-top: 17px; border-top: 1px solid var(--line); color: var(--teal); font-size: .86rem; font-weight: 800; text-decoration: none; }
.detail-link span { transition: transform .18s; }
.detail-link:hover span { transform: translateX(4px); }
.empty-state { padding: 70px 25px; border: 1px dashed #bfd1ce; border-radius: var(--radius-lg); text-align: center; background: rgba(255,255,255,.55); }
.empty-symbol { display: block; color: var(--teal); font-size: 3rem; }
.empty-state h2 { margin: 8px 0; font: 800 1.3rem "Manrope", sans-serif; }
.empty-state p { max-width: 520px; margin: 0 auto; color: var(--muted); }

/* Alarm settings */
.alarm-page-hero { display: flex; align-items: flex-end; justify-content: space-between; gap: 30px; margin-bottom: clamp(38px, 5vw, 58px); }
.alarm-page-hero h1 { margin: 0 0 9px; font: 800 clamp(2.25rem, 5vw, 4.1rem)/1.04 "Manrope", sans-serif; letter-spacing: -.055em; }
.alarm-page-hero p:last-child { margin: 0; color: var(--muted); font-size: 1.02rem; }
.alarm-section { margin-top: clamp(48px, 7vw, 82px); padding-top: clamp(36px, 5vw, 58px); border-top: 1px solid var(--line); }
.alarm-section-page { margin-top: 0; padding-top: 0; border-top: 0; }
.alarm-section-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 30px; margin-bottom: 22px; }
.alarm-section-heading h2 { margin: 0 0 7px; font: 800 clamp(1.55rem, 3vw, 2.2rem) "Manrope", sans-serif; letter-spacing: -.04em; }
.alarm-section-heading p:last-child { margin: 0; color: var(--muted); }
.alarm-summary { display: inline-flex; align-items: center; gap: 9px; flex: 0 0 auto; padding: 10px 14px; border-radius: 999px; color: #557178; background: #e7f1ef; font-size: .78rem; font-weight: 800; }
.alarm-summary i { width: 8px; height: 8px; border-radius: 50%; background: #7f9b9f; }
.alarm-summary.has-active-alarm { color: #a33e3e; background: #ffebeb; }
.alarm-summary.has-active-alarm i { background: #d94f4f; box-shadow: 0 0 0 5px rgba(217,79,79,.12); }
.alarm-grid { display: grid; grid-template-columns: repeat(3, minmax(260px, 1fr)); gap: 20px; }
.alarm-card { position: relative; padding: 24px; border: 1px solid var(--line); border-radius: var(--radius-md); background: white; box-shadow: 0 10px 35px rgba(6,46,53,.045); overflow: hidden; }
.alarm-card::before { content: ""; position: absolute; inset: 0 0 auto; height: 3px; background: #a9bec0; }
.alarm-card.is-normal::before { background: var(--teal-bright); }
.alarm-card.is-low::before, .alarm-card.is-high::before { background: #dc5555; }
.alarm-card.is-offline::before { background: var(--orange); }
.alarm-card.is-sensor-error::before { height: 5px; background: #d08213; }
.alarm-card-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.alarm-card-header h3 { margin: 0; font: 800 1.08rem "Manrope", sans-serif; letter-spacing: -.025em; }
.alarm-status { display: inline-flex; align-items: center; gap: 6px; flex: 0 0 auto; padding: 6px 9px; border-radius: 999px; color: #657e83; background: #eef4f3; font-size: .63rem; font-weight: 800; letter-spacing: .035em; text-transform: uppercase; }
.alarm-status i { width: 6px; height: 6px; border-radius: 50%; background: #879da1; }
.is-normal .alarm-status { color: #087967; background: #e2f7f2; }
.is-normal .alarm-status i { background: #18af98; }
.is-low .alarm-status, .is-high .alarm-status { color: #a33e3e; background: #ffebeb; }
.is-low .alarm-status i, .is-high .alarm-status i { background: #d94f4f; box-shadow: 0 0 0 4px rgba(217,79,79,.11); }
.is-offline .alarm-status { color: #a65739; background: #fff0e9; }
.is-offline .alarm-status i { background: var(--orange); }
.is-sensor-error .alarm-status { color: #80520c; background: #fff1c7; }
.is-sensor-error .alarm-status i { background: #d08213; box-shadow: 0 0 0 4px rgba(208,130,19,.12); }
.alarm-current { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 22px 0; padding: 14px 0; border-block: 1px solid #edf3f2; color: var(--muted); font-size: .77rem; }
.alarm-current strong { color: var(--ink); font: 700 1.18rem "Manrope", sans-serif; }
.alarm-current b { font: inherit; }
.alarm-form { display: grid; gap: 17px; }
.alarm-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 11px; }
.alarm-fields label { display: grid; gap: 7px; color: #45636a; font-size: .76rem; font-weight: 700; }
.alarm-input-wrap { position: relative; display: block; }
.alarm-input-wrap input { width: 100%; min-height: 45px; padding: 0 39px 0 12px; border: 1px solid #cfdfdc; border-radius: 10px; color: var(--ink); background: #fbfdfd; }
.alarm-input-wrap input:focus { border-color: var(--teal); box-shadow: 0 0 0 4px rgba(35,183,164,.09); outline: 0; }
.alarm-input-wrap small { position: absolute; top: 50%; right: 12px; color: #7f969a; transform: translateY(-50%); }
.alarm-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.alarm-toggle { display: inline-flex; align-items: center; gap: 8px; color: #526f75; font-size: .75rem; font-weight: 700; cursor: pointer; }
.alarm-toggle input { width: 17px; height: 17px; accent-color: var(--teal); }
.alarm-save { min-height: 40px; padding-inline: 14px; font-size: .76rem; }
.alarm-feedback { min-height: 18px; margin: -4px 0 0; color: var(--muted); font-size: .73rem; }
.alarm-feedback.is-error { color: #b34444; }
.alarm-feedback.is-success { color: #087967; }
.alarm-note { margin: 16px 2px 0; color: var(--muted); font-size: .76rem; }

/* History index */
.history-index-hero { margin-bottom: clamp(40px, 6vw, 66px); }
.history-index-hero h1 { margin: 0 0 10px; font: 800 clamp(2.25rem, 5vw, 4.1rem)/1.04 "Manrope", sans-serif; letter-spacing: -.055em; }
.history-index-hero p:last-child { max-width: 650px; margin: 0; color: var(--muted); font-size: 1.02rem; }
.history-node-list { display: grid; gap: 13px; }
.history-node-option { display: grid; grid-template-columns: minmax(210px, 1.25fr) minmax(150px, .7fr) minmax(190px, .9fr) 35px; align-items: center; gap: 24px; min-height: 118px; padding: 22px 25px; border: 1px solid var(--line); border-radius: var(--radius-md); color: inherit; background: white; box-shadow: 0 9px 30px rgba(6,46,53,.045); text-decoration: none; transition: transform .18s, border-color .18s, box-shadow .18s; }
.history-node-option:hover { transform: translateY(-2px); border-color: #b7d2ce; box-shadow: 0 15px 38px rgba(6,46,53,.08); }
.history-node-kicker, .history-node-reading > span { display: block; margin-bottom: 5px; color: var(--muted); font-size: .68rem; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; }
.history-node-name { margin: 0; font: 800 1.22rem "Manrope", sans-serif; letter-spacing: -.025em; }
.history-node-reading strong { color: var(--teal); font: 700 1.45rem "Manrope", sans-serif; }
.history-node-reading b { font: inherit; }
.history-node-state { display: grid; justify-items: start; gap: 9px; }
.history-last-update { color: var(--muted); font-size: .72rem; }
.history-node-arrow { color: var(--teal); font-size: 1.35rem; transition: transform .18s; }
.history-node-option:hover .history-node-arrow { transform: translateX(4px); }

/* User administration */
.user-admin-feedback { min-height: 24px; margin: -24px 0 20px; color: var(--muted); font-size: .86rem; }
.user-admin-feedback.is-error { color: #a33434; }
.user-admin-feedback.is-success { color: #087967; }
.user-create-card, .managed-users-section { padding: clamp(22px, 4vw, 32px); border: 1px solid var(--line); border-radius: var(--radius-lg); background: white; box-shadow: 0 10px 35px rgba(6,46,53,.045); }
.user-create-card h2, .managed-users-heading h2 { margin: 0 0 7px; font: 800 1.3rem "Manrope", sans-serif; }
.user-create-form { display: grid; grid-template-columns: 1.2fr 1fr 1fr .8fr auto; align-items: end; gap: 13px; margin-top: 21px; }
.user-create-form label { display: grid; gap: 7px; color: #45636a; font-size: .76rem; font-weight: 700; }
.user-create-form input, .user-create-form select, .managed-user-role-select { width: 100%; min-height: 45px; padding: 0 12px; border: 1px solid #cfdfdc; border-radius: 10px; color: var(--ink); background: #fbfdfd; }
.managed-users-section { margin-top: 22px; }
.managed-users-heading { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 22px; }
.managed-users-heading p { margin: 0; color: var(--muted); font-size: .84rem; }
.button-ghost-light { color: var(--teal); background: #e8f4f2; }
.button-secondary { min-height: 36px; padding-inline: 12px; color: #31575e; background: #eaf2f1; font-size: .73rem; }
.button-danger { min-height: 36px; padding-inline: 12px; color: #9a2e3d; background: #ffeaed; font-size: .73rem; }
.managed-users-labels, .managed-user-row { display: grid; grid-template-columns: minmax(210px, 1.4fr) minmax(140px, .65fr) minmax(105px, .5fr) minmax(205px, .85fr); align-items: center; gap: 17px; }
.managed-users-labels { padding: 0 17px 9px; color: #789095; font-size: .67rem; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; }
.managed-users-list { display: grid; gap: 9px; }
.managed-user-row { min-height: 80px; padding: 15px 17px; border: 1px solid #e2ecea; border-radius: 13px; background: #fbfdfd; }
.managed-user-row > div:first-child { display: grid; gap: 3px; min-width: 0; }
.managed-user-name { font: 800 .92rem "Manrope", sans-serif; }
.managed-user-email { overflow: hidden; color: var(--muted); font-size: .75rem; text-overflow: ellipsis; white-space: nowrap; }
.managed-user-role-text, .managed-user-status { color: #48666c; font-size: .78rem; font-weight: 700; }
.managed-user-status::before { content: ""; display: inline-block; width: 7px; height: 7px; margin-right: 7px; border-radius: 50%; background: var(--teal-bright); }
.managed-user-status.is-disabled { color: #a65739; }
.managed-user-status.is-disabled::before { background: var(--orange); }
.managed-user-actions { display: flex; flex-wrap: wrap; gap: 7px; }

/* Detail and charts */
.detail-page { padding-top: 35px; }
.back-link { display: inline-block; margin-bottom: 36px; color: var(--teal); font-size: .86rem; font-weight: 800; text-decoration: none; }
.detail-hero { display: flex; align-items: center; justify-content: space-between; gap: 25px; margin-bottom: 35px; }
.detail-stats { display: grid; grid-template-columns: 1.25fr 1fr 1fr; gap: 18px; margin-bottom: 22px; }
.current-card, .info-card { min-height: 190px; padding: 25px 27px; border: 1px solid var(--line); border-radius: var(--radius-md); background: white; box-shadow: 0 10px 35px rgba(6,46,53,.045); }
.current-card > p, .info-card > p { margin: 0; color: var(--muted); font-size: .8rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; }
.temperature-large { margin: 38px 0 0; }
.info-card { display: flex; flex-direction: column; }
.info-card strong { margin: 38px 0 8px; font: 800 1.18rem "Manrope", sans-serif; }
.info-card time, .info-card > span { color: var(--muted); font-size: .83rem; }
.history-panel { padding: clamp(22px, 4vw, 35px); border: 1px solid var(--line); border-radius: var(--radius-lg); background: white; box-shadow: var(--shadow); }
.history-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 25px; }
.history-heading h2 { margin: 0; font: 800 clamp(1.3rem, 3vw, 1.75rem) "Manrope", sans-serif; letter-spacing: -.03em; }
.range-buttons { display: flex; flex-wrap: wrap; gap: 5px; padding: 5px; border-radius: 12px; background: #edf4f2; }
.range-button { min-height: 37px; padding: 0 13px; border: 0; border-radius: 9px; color: #557178; background: transparent; font-size: .79rem; font-weight: 800; cursor: pointer; }
.range-button.active { color: white; background: var(--teal); box-shadow: 0 5px 15px rgba(21,153,135,.2); }
.custom-range { display: grid; grid-template-columns: 1fr 1fr auto; align-items: end; gap: 12px; margin-top: 22px; padding: 17px; border: 1px solid var(--line); border-radius: 14px; background: #f7faf9; }
.custom-range label { display: grid; gap: 6px; color: #45636a; font-size: .78rem; font-weight: 700; }
.custom-range input { min-height: 44px; background: white; }
.chart-meta { display: flex; justify-content: space-between; margin: 27px 3px 10px; color: var(--muted); font-size: .8rem; }
.chart-wrap { position: relative; height: clamp(310px, 42vw, 480px); }
.chart-message { position: absolute; inset: 0; display: grid; place-content: center; color: var(--muted); text-align: center; background: rgba(255,255,255,.86); }

.error-page { display: grid; min-height: 100vh; place-items: center; padding: 25px; text-align: center; }
.error-page main { max-width: 500px; }
.error-page h1 { margin: 15px 0 10px; font: 800 2.5rem "Manrope", sans-serif; letter-spacing: -.05em; }
.error-page p:not(.eyebrow) { margin-bottom: 28px; color: var(--muted); }

@media (max-width: 1050px) {
  .app-shell { grid-template-columns: 195px minmax(0, 1fr); }
  .nodes-grid, .alarm-grid { grid-template-columns: repeat(2, minmax(250px, 1fr)); }
  .detail-stats { grid-template-columns: 1fr 1fr; }
  .current-card { grid-row: span 2; }
  .login-layout { grid-template-columns: .9fr 1.1fr; }
  .user-create-form { grid-template-columns: 1fr 1fr; }
  .user-create-form .button { width: 100%; }
  .managed-users-labels, .managed-user-row { grid-template-columns: minmax(190px, 1.2fr) minmax(130px, .6fr) minmax(100px, .5fr); }
  .managed-users-labels span:last-child { display: none; }
  .managed-user-actions { grid-column: 1 / -1; }
}

@media (max-width: 760px) {
  .app-shell { display: block; }
  .login-layout { display: block; }
  .connection-notice { top: 10px; justify-content: center; width: calc(100% - 20px); padding: 11px 13px; font-size: .77rem; text-align: center; }
  .login-intro { min-height: 330px; padding: 28px 24px; }
  .login-official-brand { gap: 13px; }
  .login-government-logo-frame { width: 72px; height: 72px; padding: 7px; }
  .login-official-name { font-size: clamp(1.1rem, 5vw, 1.35rem); }
  .login-subtitle { margin-top: 32px; font-size: clamp(2.45rem, 12vw, 3.8rem); }
  .login-copy { padding: 50px 0 20px; }
  .login-copy-compact { padding: 38px 0 20px; }
  .login-copy h1 { font-size: clamp(2.45rem, 12vw, 3.8rem); }
  .login-copy > p:last-child, .water-lines { display: none; }
  .login-panel { padding: 22px 16px 45px; }
  .login-card { margin-top: -32px; padding: 27px 22px; }
  .topbar { min-height: 70px; gap: 12px; padding: 9px 14px; }
  .sidebar { position: sticky; z-index: 9; top: 70px; height: auto; padding: 8px 14px; border-right: 0; border-bottom: 1px solid #183b43; background: #0d2d34; box-shadow: 0 8px 22px rgba(5,31,36,.12); }
  .sidebar-label { display: none; }
  .side-navigation { display: flex; gap: 5px; }
  .side-nav-link { flex: 1; justify-content: center; min-height: 39px; padding: 0 9px; font-size: .76rem; }
  .side-nav-link::before { display: none; }
  .side-nav-link:hover { transform: none; }
  .session-email { display: none; }
  .session-role { display: none; }
  .topbar .brand { gap: 7px; }
  .brand-logo-frame { width: 48px; height: 52px; }
  .brand-logo { width: 100px; height: 100px; transform: translate(-26px, -18px); }
  .brand-name { font-size: 1.03rem; }
  .brand-mark { width: 35px; height: 35px; }
  .dashboard { width: min(100% - 28px, 1420px); padding-top: 40px; }
  .hero, .detail-hero, .history-heading, .alarm-page-hero { align-items: flex-start; flex-direction: column; }
  .hero { margin-bottom: 35px; }
  .summary { width: 100%; min-width: 0; }
  .summary > div { padding: 14px 11px; }
  .section-heading { align-items: flex-start; flex-direction: column; gap: 7px; }
  .nodes-grid, .alarm-grid { grid-template-columns: 1fr; }
  .alarm-section-heading { align-items: flex-start; flex-direction: column; gap: 16px; }
  .alarm-actions { align-items: stretch; flex-direction: column; }
  .alarm-save { width: 100%; }
  .node-card { min-height: 305px; }
  .temperature { margin-top: 37px; }
  .detail-stats { grid-template-columns: 1fr; }
  .current-card { grid-row: auto; }
  .current-card, .info-card { min-height: 160px; }
  .info-card strong { margin-top: 29px; }
  .history-heading { gap: 20px; }
  .range-buttons { width: 100%; }
  .range-button { flex: 1 1 70px; padding-inline: 8px; }
  .custom-range { grid-template-columns: 1fr; }
  .custom-range .button { width: 100%; }
  .chart-wrap { height: 350px; }
  .history-node-option { grid-template-columns: 1fr auto; gap: 17px; padding: 20px; }
  .history-node-reading, .history-node-state { grid-column: 1; }
  .history-node-arrow { grid-column: 2; grid-row: 1 / 4; align-self: center; }
  .user-create-form { grid-template-columns: 1fr; }
  .managed-users-labels { display: none; }
  .managed-user-row { grid-template-columns: 1fr 1fr; gap: 13px; }
  .managed-user-row > div:first-child { grid-column: 1 / -1; }
  .managed-user-actions { grid-column: 1 / -1; }
}

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