:root {
  --navy-950: #031b35;
  --navy-900: #052a52;
  --blue-800: #073b72;
  --blue-700: #0b4f96;
  --blue-600: #1268b7;
  --blue-100: #e9f3fc;
  --green-700: #08753a;
  --green-600: #0b8f47;
  --green-100: #e8f7ef;
  --orange-700: #b84b00;
  --orange-500: #f28b18;
  --orange-100: #fff2df;
  --red-700: #af1f2d;
  --red-600: #d42f3d;
  --red-100: #fdebed;
  --ink: #14263a;
  --muted: #64748b;
  --line: #dbe5ee;
  --surface: #ffffff;
  --canvas: #f4f8fb;
  --shadow-sm: 0 1px 2px rgba(10, 35, 62, .06), 0 5px 18px rgba(10, 35, 62, .05);
  --shadow-lg: 0 20px 50px rgba(3, 27, 53, .16);
  --radius-sm: 10px;
  --radius: 16px;
  --radius-lg: 24px;
  --sidebar-width: 260px;
}

* { box-sizing: border-box; }
html { color-scheme: light; font-size: 16px; }
body { margin: 0; color: var(--ink); background: var(--canvas); font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; line-height: 1.55; }
img { display: block; max-width: 100%; }
a { color: var(--blue-700); text-decoration: none; }
a:hover { color: var(--navy-900); }
button, input, textarea, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible { outline: 3px solid rgba(18, 104, 183, .28); outline-offset: 2px; }
h1, h2, h3, h4, p { margin-top: 0; }
h1, h2, h3, h4 { color: var(--navy-950); line-height: 1.18; letter-spacing: -.025em; }
.muted { color: var(--muted); }
.sr-only { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: -1px !important; overflow: hidden !important; clip: rect(0, 0, 0, 0) !important; white-space: nowrap !important; border: 0 !important; }
.is-hidden { display: none !important; }
.eyebrow { margin: 0 0 5px; color: var(--blue-700); font-size: .76rem; font-weight: 800; letter-spacing: .13em; text-transform: uppercase; }
.eyebrow.light { color: #9ed0ff; }

.button { display: inline-flex; min-height: 44px; align-items: center; justify-content: center; gap: 8px; padding: 10px 18px; border: 1px solid transparent; border-radius: 11px; cursor: pointer; font-weight: 750; text-align: center; transition: transform .15s ease, box-shadow .15s ease, background .15s ease, border-color .15s ease; }
.button:hover { transform: translateY(-1px); }
.button:disabled { cursor: not-allowed; opacity: .55; transform: none; }
.button-primary { color: white; background: linear-gradient(135deg, var(--blue-700), var(--blue-600)); box-shadow: 0 8px 18px rgba(11, 79, 150, .2); }
.button-primary:hover { color: white; background: linear-gradient(135deg, var(--blue-800), var(--blue-700)); }
.button-secondary { color: var(--blue-800); border-color: #c8d9e9; background: white; }
.button-secondary:hover { color: var(--navy-900); border-color: #9ebbd4; background: #f8fbfe; }
.button-light { color: var(--navy-900); background: white; box-shadow: 0 8px 20px rgba(2, 19, 37, .14); }
.button-light:hover { color: var(--navy-900); background: #eff7ff; }
.button-ghost-light { color: white; border-color: rgba(255,255,255,.4); background: rgba(255,255,255,.08); }
.button-ghost-light:hover { color: white; background: rgba(255,255,255,.16); }
.button-quiet { min-height: 38px; padding: 8px 12px; color: var(--muted); border-color: var(--line); background: white; }
.button-warning { color: #492400; border-color: #ffc875; background: #ffdb9b; }
.button-warning:hover { color: #321900; background: #ffcf7b; }
.button-danger-soft { color: var(--red-700); border-color: #f3bac0; background: var(--red-100); }
.button-wide { width: 100%; }

.notice { margin: 0 0 18px; padding: 13px 15px; border: 1px solid; border-radius: var(--radius-sm); font-size: .93rem; }
.notice ul { margin: 8px 0 0; padding-left: 20px; }
.notice-success { color: #075b2e; border-color: #a9dec1; background: var(--green-100); }
.notice-error { color: #8c1723; border-color: #f0b5bc; background: var(--red-100); }
.notice-warning { color: #7b3a00; border-color: #f6d098; background: var(--orange-100); }

label { display: grid; gap: 7px; color: #31465b; font-size: .9rem; font-weight: 700; }
input, textarea, select { width: 100%; min-height: 45px; padding: 10px 12px; color: var(--ink); border: 1px solid #cddae6; border-radius: 10px; background: white; transition: border-color .15s, box-shadow .15s; }
textarea { resize: vertical; }
input:hover, textarea:hover, select:hover { border-color: #a5bacd; }
input:focus, textarea:focus, select:focus { border-color: var(--blue-600); box-shadow: 0 0 0 3px rgba(18, 104, 183, .12); outline: none; }
.hint, .optional { color: var(--muted); font-size: .76rem; font-weight: 500; }
.stack-form { display: grid; gap: 17px; }
.password-input { position: relative; display: flex; }
.password-input input { padding-right: 62px; }
.password-input button { position: absolute; top: 5px; right: 5px; height: 35px; padding: 0 9px; color: var(--blue-700); border: 0; border-radius: 7px; background: #eef5fb; cursor: pointer; font-size: .78rem; font-weight: 800; }
.checkbox-row { display: flex; grid-template-columns: none; align-items: flex-start; gap: 9px; font-weight: 600; }
.checkbox-row input { width: 18px; min-height: 18px; margin-top: 2px; accent-color: var(--blue-700); }
.form-grid { display: grid; gap: 17px; }
.form-grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-grid .full { grid-column: 1 / -1; }

/* Authentication */
.auth-body { min-height: 100vh; background: #eef5fa; }
.auth-layout { display: grid; min-height: 100vh; grid-template-columns: minmax(420px, 1.08fr) minmax(420px, .92fr); }
.auth-story { position: relative; display: flex; min-height: 100vh; flex-direction: column; justify-content: space-between; overflow: hidden; padding: clamp(32px, 5vw, 72px); color: white; background: radial-gradient(circle at 78% 25%, rgba(41, 147, 220, .5), transparent 29%), linear-gradient(145deg, #031d3d 0%, #06457f 54%, #08703b 115%); }
.auth-story::after { position: absolute; right: -15%; bottom: -25%; width: 75%; aspect-ratio: 1; border: 2px solid rgba(255,255,255,.09); border-radius: 50%; box-shadow: 0 0 0 45px rgba(255,255,255,.025), 0 0 0 95px rgba(255,255,255,.018); content: ""; }
.auth-brand, .brand, .mobile-brand { display: flex; align-items: center; gap: 12px; }
.auth-brand { position: relative; z-index: 1; }
.auth-brand img { width: 70px; height: 70px; border: 3px solid rgba(255,255,255,.85); border-radius: 50%; object-fit: cover; box-shadow: 0 10px 26px rgba(0,0,0,.22); }
.auth-brand span, .brand span { display: grid; }
.auth-brand strong { color: white; font-size: 1.25rem; letter-spacing: .01em; }
.auth-brand small { color: #c4e3fa; font-size: .78rem; letter-spacing: .08em; text-transform: uppercase; }
.auth-message { position: relative; z-index: 1; max-width: 670px; margin: 80px 0 60px; }
.auth-message h1 { margin-bottom: 22px; color: white; font-size: clamp(2.7rem, 5vw, 5.2rem); font-weight: 800; letter-spacing: -.055em; }
.auth-message > p:last-child { max-width: 580px; color: #d5eafb; font-size: clamp(1rem, 1.5vw, 1.18rem); }
.level-legend { position: relative; z-index: 1; display: grid; max-width: 690px; grid-template-columns: repeat(3, 1fr); border: 1px solid rgba(255,255,255,.2); border-radius: 16px; background: rgba(3, 23, 45, .35); backdrop-filter: blur(10px); }
.level-legend > div { display: grid; min-width: 0; grid-template-columns: 14px 1fr; gap: 0 9px; padding: 15px 18px; }
.level-legend > div + div { border-left: 1px solid rgba(255,255,255,.18); }
.level-legend b { color: white; font-size: .92rem; }
.level-legend small { grid-column: 2; color: #bfd8eb; font-size: .74rem; }
.legend-dot { width: 10px; height: 10px; margin-top: 5px; border-radius: 50%; box-shadow: 0 0 0 4px rgba(255,255,255,.08); }
.legend-dot.normal { background: #3bd17e; }.legend-dot.orange { background: #ffa936; }.legend-dot.red { background: #ff5969; }
.auth-panel { display: flex; min-height: 100vh; align-items: center; justify-content: center; padding: 42px; }
.auth-card { width: min(100%, 430px); padding: 38px; border: 1px solid rgba(202, 218, 232, .8); border-radius: var(--radius-lg); background: white; box-shadow: var(--shadow-lg); }
.auth-card h2 { margin-bottom: 7px; font-size: 1.75rem; }
.auth-card > .muted { margin-bottom: 25px; font-size: .92rem; }
.auth-switch { margin: 24px 0 0; color: var(--muted); text-align: center; font-size: .9rem; }
.auth-switch a { font-weight: 800; }
.auth-footnote { position: absolute; bottom: 15px; max-width: 450px; color: #73859a; font-size: .75rem; text-align: center; }

.register-page { padding: 36px 20px 60px; background: radial-gradient(circle at top left, #dceefb, transparent 34%), var(--canvas); }
.register-shell { width: min(100%, 980px); margin: 0 auto; }
.back-link { display: inline-block; margin-bottom: 18px; font-weight: 750; }
.register-card { padding: clamp(25px, 4vw, 46px); border: 1px solid var(--line); border-radius: var(--radius-lg); background: white; box-shadow: var(--shadow-lg); }
.register-heading { display: flex; align-items: center; gap: 20px; margin-bottom: 28px; }
.register-heading img { width: 92px; height: 92px; flex: 0 0 auto; border: 4px solid #e3edf5; border-radius: 50%; object-fit: cover; }
.register-heading h1 { margin: 0 0 6px; font-size: 2rem; }
.register-heading p:last-child { margin: 0; color: var(--muted); }
.registration-form { display: grid; gap: 24px; }
.role-choice { display: grid; margin: 0; padding: 0; grid-template-columns: repeat(2, 1fr); gap: 12px; border: 0; }
.role-choice legend { margin-bottom: 8px; color: #31465b; font-size: .9rem; font-weight: 800; }
.role-choice label { position: relative; display: block; }
.role-choice input { position: absolute; opacity: 0; }
.role-choice span { display: grid; gap: 2px; min-height: 80px; padding: 15px 16px; border: 1px solid #cbd9e5; border-radius: 12px; background: #f9fbfd; cursor: pointer; }
.role-choice small { color: var(--muted); font-weight: 500; }
.role-choice input:checked + span { border-color: var(--blue-600); background: var(--blue-100); box-shadow: 0 0 0 2px rgba(18, 104, 183, .1); }
.role-choice input:focus-visible + span { outline: 3px solid rgba(18, 104, 183, .25); }

/* Application frame */
.app-body { min-height: 100vh; }
.app-shell { display: grid; min-height: 100vh; grid-template-columns: var(--sidebar-width) minmax(0, 1fr); }
.sidebar { position: fixed; z-index: 40; inset: 0 auto 0 0; display: flex; width: var(--sidebar-width); flex-direction: column; padding: 24px 16px 16px; color: white; background: linear-gradient(180deg, var(--navy-950), #052d56 62%, #064067); box-shadow: 8px 0 30px rgba(3, 27, 53, .12); }
.brand { margin: 0 7px 25px; color: white; }
.brand:hover { color: white; }
.brand img { width: 56px; height: 56px; flex: 0 0 auto; border: 2px solid rgba(255,255,255,.8); border-radius: 50%; object-fit: cover; }
.brand strong { color: white; font-size: 1.05rem; }
.brand small { color: #a9cae4; font-size: .65rem; letter-spacing: .08em; text-transform: uppercase; }
.sidebar-nav { display: grid; gap: 4px; }
.nav-link { display: flex; min-height: 44px; align-items: center; gap: 11px; padding: 10px 12px; color: #c8dbeb; border-radius: 10px; font-size: .91rem; font-weight: 650; }
.nav-link:hover { color: white; background: rgba(255,255,255,.08); }
.nav-link.is-active { color: white; background: linear-gradient(90deg, rgba(24, 125, 202, .52), rgba(12, 142, 73, .28)); box-shadow: inset 3px 0 #4ed58b; }
.nav-icon { display: grid; width: 25px; height: 25px; place-items: center; color: #9eccec; font-size: 1rem; }
.nav-section { margin: 20px 12px 7px; color: #7196b6; font-size: .65rem; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; }
.sidebar-account { display: grid; align-items: center; margin-top: auto; padding: 13px 9px 2px; grid-template-columns: 36px 1fr 28px; gap: 9px; border-top: 1px solid rgba(255,255,255,.11); }
.avatar, .mini-avatar, .large-avatar { display: grid; place-items: center; border-radius: 50%; color: white; background: linear-gradient(135deg, var(--blue-600), var(--green-600)); font-weight: 850; }
.avatar { width: 36px; height: 36px; font-size: .75rem; }
.account-copy { display: grid; min-width: 0; }
.account-copy strong { overflow: hidden; color: white; font-size: .78rem; text-overflow: ellipsis; white-space: nowrap; }
.account-copy span { color: #91b4d0; font-size: .68rem; }
.account-link { display: grid; width: 28px; height: 28px; place-items: center; color: #9dbbd3; border-radius: 7px; }
.account-link:hover { color: white; background: rgba(255,255,255,.1); }
.main-area { display: flex; min-width: 0; min-height: 100vh; flex-direction: column; grid-column: 2; }
.topbar { display: flex; min-height: 95px; align-items: center; justify-content: space-between; gap: 20px; padding: 22px clamp(24px, 4vw, 54px); border-bottom: 1px solid var(--line); background: rgba(255,255,255,.88); backdrop-filter: blur(12px); }
.topbar h1 { margin: 0; font-size: clamp(1.45rem, 2vw, 1.9rem); }
.topbar-actions { display: flex; align-items: center; gap: 11px; }
.connection-pill { display: flex; min-height: 38px; align-items: center; gap: 8px; padding: 7px 11px; color: #24613f; border: 1px solid #b8dfc8; border-radius: 999px; background: #effaf4; font-size: .76rem; }
.connection-pill span { width: 8px; height: 8px; border-radius: 50%; background: #24a55d; box-shadow: 0 0 0 4px rgba(36,165,93,.11); }
.connection-pill.is-offline { color: #8c2630; border-color: #ecc3c7; background: #fff3f4; }
.connection-pill.is-offline span { background: var(--red-600); box-shadow: 0 0 0 4px rgba(212,47,61,.1); }
.page-content { width: min(100%, 1500px); flex: 1; margin: 0 auto; padding: clamp(22px, 3vw, 42px) clamp(20px, 4vw, 54px); }
.mobile-bar { display: none; }
.sidebar-backdrop { display: none; }

/* Dashboard status */
.status-hero { --level-accent: #ffe16b; position: relative; display: grid; min-height: 330px; overflow: hidden; padding: clamp(26px, 4vw, 48px); grid-template-columns: minmax(0, 1.25fr) minmax(260px, .75fr); color: white; border-radius: var(--radius-lg); background: radial-gradient(circle at 80% 0%, rgba(255,255,255,.18), transparent 35%), linear-gradient(135deg, #765600, #b78300 58%, #735000); box-shadow: var(--shadow-lg); }
.status-hero.level-orange { --level-accent: #ffab3e; background: radial-gradient(circle at 80% 0%, rgba(255,255,255,.18), transparent 35%), linear-gradient(135deg, #9f4000, #e77a0e 58%, #a74700); }
.status-hero.level-red { --level-accent: #ff6673; background: radial-gradient(circle at 80% 0%, rgba(255,255,255,.2), transparent 35%), linear-gradient(135deg, #861521, #cf2938 58%, #84121e); }
.status-hero.is-offline { --level-accent: #a7b6c3; background: radial-gradient(circle at 80% 0%, rgba(255,255,255,.12), transparent 35%), linear-gradient(135deg, #34485b, #607486 58%, #334554); }
.status-copy { position: relative; z-index: 2; align-self: center; }
.status-kicker { display: inline-flex; align-items: center; gap: 8px; margin-bottom: 28px; padding: 7px 11px; border: 1px solid rgba(255,255,255,.22); border-radius: 999px; background: rgba(3,27,53,.18); font-size: .76rem; font-weight: 750; }
.status-pulse { width: 8px; height: 8px; border-radius: 50%; background: var(--level-accent); box-shadow: 0 0 0 5px rgba(255,255,255,.1); animation: pulse 2s infinite; }
.status-overline { margin-bottom: -2px; color: rgba(255,255,255,.76); font-size: .82rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.status-copy h2 { margin: 0 0 8px; color: white; font-size: clamp(3.2rem, 7vw, 6.8rem); font-weight: 850; letter-spacing: -.075em; }
.status-guidance { max-width: 650px; margin-bottom: 8px; color: white; font-size: clamp(1rem, 1.8vw, 1.25rem); font-weight: 650; }
.status-time { color: rgba(255,255,255,.77); font-size: .82rem; }
.status-time strong { color: white; }
.status-actions { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 26px; }
.status-actions .button-light { color: var(--navy-900) !important; }
.water-visual { position: relative; display: grid; min-height: 260px; place-items: center; }
.gauge-ring { position: relative; z-index: 3; display: grid; width: min(230px, 76%); aspect-ratio: 1; place-items: center; border: 2px solid rgba(255,255,255,.52); border-radius: 50%; background: rgba(3,27,53,.2); box-shadow: inset 0 0 0 15px rgba(255,255,255,.06), 0 18px 42px rgba(0,0,0,.16); backdrop-filter: blur(8px); }
.gauge-ring::before, .gauge-ring::after { position: absolute; border: 1px solid rgba(255,255,255,.18); border-radius: 50%; content: ""; }
.gauge-ring::before { inset: 28px; }.gauge-ring::after { inset: -17px; }
.gauge-center { display: grid; text-align: center; }
.gauge-center span { color: white; font-size: clamp(1.7rem, 3.5vw, 2.8rem); font-weight: 900; letter-spacing: .06em; }
.gauge-center small { color: rgba(255,255,255,.68); font-size: .62rem; font-weight: 800; letter-spacing: .17em; }
.wave { position: absolute; z-index: 1; right: -28%; bottom: -80px; width: 150%; height: 160px; border-radius: 48% 52% 0 0 / 28% 32% 0 0; background: rgba(255,255,255,.1); transform: rotate(-4deg); }
.wave-two { right: -12%; bottom: -105px; background: rgba(3,27,53,.15); transform: rotate(5deg); }
.sensor-strip { display: grid; margin-top: 15px; padding: 14px 18px; grid-template-columns: repeat(4, 1fr); gap: 5px; border: 1px solid var(--line); border-radius: 14px; background: white; box-shadow: var(--shadow-sm); }
.sensor-item { display: flex; align-items: center; gap: 10px; min-width: 0; padding: 7px 12px; }
.sensor-item + .sensor-item { border-left: 1px solid var(--line); }
.sensor-item > div { display: grid; min-width: 0; }
.sensor-item b { font-size: .79rem; }
.sensor-item small { overflow: hidden; color: var(--muted); font-size: .72rem; text-overflow: ellipsis; white-space: nowrap; }
.sensor-light { width: 12px; height: 12px; flex: 0 0 auto; border: 2px solid #b8c6d1; border-radius: 50%; background: #e7edf2; }
.sensor-light.normal.is-wet { border-color: #9be1ba; background: #24ad62; box-shadow: 0 0 0 5px #e5f7ed; }
.sensor-light.orange.is-wet { border-color: #f5c276; background: var(--orange-500); box-shadow: 0 0 0 5px var(--orange-100); }
.sensor-light.red.is-wet { border-color: #ef9ca5; background: var(--red-600); box-shadow: 0 0 0 5px var(--red-100); }
.sensor-icon { display: grid; width: 26px; height: 26px; flex: 0 0 auto; place-items: center; color: var(--blue-700); border-radius: 50%; background: var(--blue-100); }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .45; } }

.metric-grid { display: grid; margin-top: 22px; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.metric-card { display: flex; align-items: flex-start; gap: 13px; min-height: 132px; padding: 20px; border: 1px solid var(--line); border-radius: var(--radius); background: white; box-shadow: var(--shadow-sm); }
.metric-card > div { display: grid; }
.metric-card small { color: var(--muted); font-size: .76rem; font-weight: 700; }
.metric-card strong { margin: 2px 0; color: var(--navy-950); font-size: 1.9rem; line-height: 1.1; }
.metric-card .metric-word { font-size: 1.25rem; }
.metric-card a, .metric-card span { color: var(--blue-700); font-size: .75rem; font-weight: 700; }
.metric-card span { color: var(--muted); font-weight: 500; }
.metric-icon { display: grid; width: 40px; height: 40px; flex: 0 0 auto; place-items: center; border-radius: 11px; font-weight: 900; }
.metric-icon.blue { color: var(--blue-700); background: var(--blue-100); }.metric-icon.green { color: var(--green-700); background: var(--green-100); }.metric-icon.amber { color: var(--orange-700); background: var(--orange-100); }.metric-icon.violet { color: #6d3eb0; background: #f1eafb; }
.resident-readiness { margin-top: 22px; }
.readiness-card { display: grid; align-items: center; padding: 22px; grid-template-columns: 52px 1fr auto; gap: 16px; border: 1px solid #b8ddc8; border-radius: var(--radius); background: linear-gradient(110deg, #f0faf4, white); box-shadow: var(--shadow-sm); }
.readiness-icon { display: grid; width: 52px; height: 52px; place-items: center; color: white; border-radius: 15px; background: linear-gradient(135deg, var(--green-600), var(--blue-600)); font-size: 1.4rem; }
.readiness-card h3 { margin: 0 0 3px; }.readiness-card p { margin: 0; color: var(--muted); font-size: .88rem; }

.section-block { margin-top: 34px; }
.section-heading, .panel-heading, .page-intro { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; }
.section-heading { margin-bottom: 14px; }
.section-heading h2, .page-intro h2 { margin: 0; font-size: 1.55rem; }
.section-heading > a, .panel-heading > a { font-size: .84rem; font-weight: 800; }
.announcement-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.announcement-card { position: relative; min-height: 180px; padding: 21px; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: white; box-shadow: var(--shadow-sm); }
.announcement-card::before { position: absolute; inset: 0 auto 0 0; width: 4px; background: var(--blue-600); content: ""; }
.announcement-card.severity-orange::before, .feed-card.severity-orange .feed-marker, .manage-item.severity-orange::before { background: var(--orange-500); }
.announcement-card.severity-red::before, .feed-card.severity-red .feed-marker, .manage-item.severity-red::before { background: var(--red-600); }
.announcement-card h3 { margin: 12px 0 7px; }.announcement-card p { color: #53677a; font-size: .88rem; }.announcement-card > small { color: var(--muted); font-size: .72rem; }
.announcement-meta { display: flex; align-items: center; justify-content: space-between; gap: 10px; color: var(--muted); font-size: .69rem; }
.announcement-meta span { color: var(--blue-700); font-weight: 850; letter-spacing: .06em; text-transform: uppercase; }
.empty-state { display: grid; padding: 45px 20px; place-items: center; color: var(--muted); text-align: center; }
.empty-state > span { display: grid; width: 48px; height: 48px; margin-bottom: 10px; place-items: center; color: var(--blue-700); border-radius: 50%; background: var(--blue-100); font-size: 1.2rem; }
.empty-state h3 { margin-bottom: 4px; }.empty-state p { margin: 0; font-size: .86rem; }.empty-state.compact { padding: 25px 12px; }.empty-state.panel { border: 1px solid var(--line); border-radius: var(--radius); background: white; }

/* Shared pages and panels */
.page-intro { margin-bottom: 24px; }
.page-intro > div:first-child { max-width: 760px; }
.page-intro p:last-child { margin: 7px 0 0; color: var(--muted); }
.limit-badge { flex: 0 0 auto; padding: 8px 12px; color: var(--blue-700); border: 1px solid #bfd3e5; border-radius: 999px; background: var(--blue-100); font-size: .78rem; font-weight: 850; }
.panel { padding: 23px; border: 1px solid var(--line); border-radius: var(--radius); background: white; box-shadow: var(--shadow-sm); }
.panel-heading { align-items: flex-start; margin-bottom: 20px; }
.panel-heading h3 { margin: 0 0 4px; font-size: 1.15rem; }.panel-heading p { margin: 0; color: var(--muted); font-size: .83rem; }
.split-layout { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(310px, .65fr); gap: 18px; align-items: start; }
.feed-list { display: grid; gap: 15px; }
.feed-card { display: grid; overflow: hidden; grid-template-columns: 7px 1fr; border: 1px solid var(--line); border-radius: var(--radius); background: white; box-shadow: var(--shadow-sm); }
.feed-marker { background: var(--blue-600); }.feed-content { padding: clamp(22px, 3vw, 34px); }.feed-content h2 { margin: 14px 0 12px; font-size: 1.4rem; }.prose { color: #40566b; white-space: normal; }.byline { margin: 19px 0 0; color: var(--muted); font-size: .78rem; font-weight: 650; }

.phone-list { display: grid; gap: 10px; }
.phone-row { display: grid; align-items: center; padding: 14px; grid-template-columns: 42px minmax(160px, 1fr) auto; gap: 12px; border: 1px solid var(--line); border-radius: 12px; background: #fbfdff; }
.phone-symbol { display: grid; width: 42px; height: 42px; place-items: center; color: var(--blue-700); border-radius: 11px; background: var(--blue-100); }
.phone-copy { display: grid; }.phone-copy > div { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; }.phone-copy > span { color: var(--muted); font-size: .82rem; }
.row-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 8px; }
.row-actions form { margin: 0; }
.text-button { padding: 3px 4px; color: var(--blue-700); border: 0; background: none; cursor: pointer; font-size: .78rem; font-weight: 800; }
.text-button:hover { color: var(--navy-900); text-decoration: underline; }.text-button.danger { color: var(--red-700); }
.privacy-note, .safety-lock-note { margin-top: 20px; padding: 14px; color: #38556e; border: 1px solid #cfe0ee; border-radius: 11px; background: #f3f8fc; font-size: .8rem; }.privacy-note p { margin: 3px 0 0; }.safety-lock-note ul { margin: 7px 0 0; padding-left: 19px; }

.badge { display: inline-flex; width: fit-content; align-items: center; padding: 4px 8px; color: #4a5d70; border: 1px solid #d4dee7; border-radius: 999px; background: #f4f7f9; font-size: .68rem; font-weight: 800; line-height: 1.2; }
.badge-blue { color: var(--blue-700); border-color: #bdd4e7; background: var(--blue-100); }.badge-green { color: #087039; border-color: #afddc2; background: var(--green-100); }.badge-normal { color: #725300; border-color: #ead385; background: #fff6cf; }.badge-amber, .badge-orange { color: #914100; border-color: #f1cd98; background: var(--orange-100); }.badge-red { color: var(--red-700); border-color: #efb7bd; background: var(--red-100); }

.table-panel { padding: 0; overflow: hidden; }
.table-panel > .panel-heading, .table-panel > .filter-bar { padding: 20px 22px; margin: 0; border-bottom: 1px solid var(--line); }
.responsive-table { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { padding: 11px 17px; color: #5f7386; background: #f6f9fb; font-size: .7rem; letter-spacing: .06em; text-align: left; text-transform: uppercase; }
td { padding: 15px 17px; border-top: 1px solid #e8eef3; color: #334b60; font-size: .82rem; vertical-align: middle; }
tbody tr:hover { background: #fbfdff; }
.person-cell { display: flex; align-items: center; gap: 10px; min-width: 200px; }.mini-avatar { width: 36px; height: 36px; flex: 0 0 auto; font-size: .7rem; }.person-cell > div { display: grid; }.person-cell small, .table-subtext { display: block; margin-top: 2px; color: var(--muted); font-size: .7rem; font-weight: 500; }
.actions-cell { text-align: right; }.actions-cell form { display: inline; }
.filter-bar { display: flex; align-items: center; gap: 10px; }.search-field { position: relative; display: block; width: min(100%, 420px); }.search-field span { position: absolute; top: 10px; left: 12px; color: var(--muted); }.search-field input { padding-left: 34px; }.filter-bar select { min-width: 170px; }
code { padding: 3px 6px; color: #334866; border-radius: 6px; background: #eef3f7; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: .73rem; }.json-detail { display: block; max-width: 320px; overflow: hidden; color: var(--muted); font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: .67rem; text-overflow: ellipsis; white-space: nowrap; }

.approval-list { display: grid; gap: 15px; }.approval-card { display: flex; align-items: center; justify-content: space-between; gap: 25px; }.approval-person { display: flex; align-items: flex-start; gap: 15px; }.large-avatar { width: 82px; height: 82px; font-size: 1.35rem; }.large-avatar.small { width: 58px; height: 58px; flex: 0 0 auto; font-size: .95rem; }.approval-person h3 { margin: 8px 0 2px; }.approval-person p { margin: 0; color: var(--muted); font-size: .83rem; }.decline-note { margin-top: 9px !important; padding: 8px 10px; color: #7f3038 !important; border-radius: 8px; background: var(--red-100); }.approval-actions { display: grid; justify-items: end; gap: 9px; }.decline-form { display: flex; gap: 7px; }.decline-form input { width: 210px; min-height: 42px; }
.announcement-admin-layout { grid-template-columns: minmax(330px, .78fr) minmax(420px, 1.22fr); }.composer-panel { position: sticky; top: 20px; }.manage-list { display: grid; gap: 10px; }.manage-item { position: relative; display: grid; padding: 14px 14px 14px 18px; overflow: hidden; grid-template-columns: 1fr auto; gap: 10px; border: 1px solid var(--line); border-radius: 11px; }.manage-item::before { position: absolute; inset: 0 auto 0 0; width: 4px; background: var(--blue-600); content: ""; }.manage-item h4 { margin: 6px 0 3px; }.manage-item p { margin: 0; color: var(--muted); font-size: .76rem; }.manage-item small { color: var(--muted); font-size: .67rem; }

/* Control center */
.safety-banner { display: flex; align-items: flex-start; gap: 15px; margin-bottom: 18px; padding: 17px 19px; color: #713200; border: 1px solid #efc074; border-radius: var(--radius); background: linear-gradient(110deg, #fff1d8, #fffaf1); }
.safety-banner > span { display: grid; width: 34px; height: 34px; flex: 0 0 auto; place-items: center; color: white; border-radius: 50%; background: var(--orange-500); font-weight: 900; }.safety-banner h2 { margin: 0 0 3px; color: #6c3000; font-size: 1.05rem; }.safety-banner p { margin: 0; font-size: .84rem; }
.control-layout { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(300px, .8fr); gap: 18px; align-items: start; }.control-panel > label { margin-bottom: 18px; }.control-group { padding: 17px 0; border-top: 1px solid var(--line); }.control-group-heading { display: flex; align-items: center; justify-content: space-between; gap: 15px; margin-bottom: 13px; }.control-group-heading > div { display: flex; align-items: center; gap: 12px; }.control-group-heading h4 { margin: 0 0 2px; }.control-group-heading p { margin: 0; color: var(--muted); font-size: .76rem; }.control-group-heading > strong { color: var(--navy-950); font-size: 1.15rem; }.control-icon { display: grid; width: 42px; height: 42px; flex: 0 0 auto; place-items: center; border-radius: 11px; }.control-icon.light { color: #b44c00; background: var(--orange-100); }.button-pair { display: grid; grid-template-columns: repeat(2, 1fr); gap: 9px; }.command-result { min-height: 0; margin-top: 12px; padding: 0; border-radius: 9px; font-size: .82rem; }.command-result:not(:empty) { min-height: 42px; padding: 10px 12px; }.command-result.is-pending { color: #604100; background: #fff5d9; }.command-result.is-success { color: #096137; background: var(--green-100); }.command-result.is-error { color: #8b1f2b; background: var(--red-100); }
.station-stats { display: grid; margin: 0; }.station-stats > div { display: flex; align-items: center; justify-content: space-between; gap: 15px; padding: 12px 0; border-top: 1px solid var(--line); }.station-stats > div:first-child { border-top: 0; }.station-stats dt { color: var(--muted); font-size: .8rem; }.station-stats dd { margin: 0; color: var(--navy-950); font-size: .82rem; font-weight: 750; text-align: right; }

.profile-layout { grid-template-columns: minmax(280px, .45fr) minmax(420px, .55fr); }.profile-summary { display: grid; justify-items: center; text-align: center; }.profile-summary h2 { margin: 15px 0 2px; }.profile-summary > p { margin: 0 0 10px; color: var(--muted); }.profile-details { width: 100%; margin: 25px 0 0; text-align: left; }.profile-details > div { display: grid; padding: 10px 0; grid-template-columns: 100px 1fr; border-top: 1px solid var(--line); }.profile-details dt { color: var(--muted); font-size: .75rem; }.profile-details dd { margin: 0; font-size: .8rem; font-weight: 650; }.narrow-form { max-width: 500px; }
.app-footer { display: flex; justify-content: space-between; gap: 20px; padding: 18px clamp(20px, 4vw, 54px); color: #78899a; border-top: 1px solid var(--line); font-size: .68rem; }

@media (max-width: 1120px) {
  .metric-grid { grid-template-columns: repeat(2, 1fr); }
  .sensor-strip { grid-template-columns: repeat(2, 1fr); }.sensor-item:nth-child(3) { border-left: 0; }.sensor-item:nth-child(n+3) { border-top: 1px solid var(--line); }
  .split-layout, .control-layout, .announcement-admin-layout { grid-template-columns: 1fr; }
  .composer-panel { position: static; }
}

@media (max-width: 860px) {
  .auth-layout { grid-template-columns: 1fr; }.auth-story { min-height: auto; padding: 28px; }.auth-message { margin: 60px 0 35px; }.auth-message h1 { font-size: 3rem; }.auth-panel { min-height: auto; flex-direction: column; padding: 36px 20px 65px; }.auth-footnote { position: static; margin-top: 22px; }
  .app-shell { display: block; }.main-area { min-height: calc(100vh - 64px); }.sidebar { transform: translateX(-105%); transition: transform .2s ease; }.sidebar-open .sidebar { transform: translateX(0); }.sidebar-backdrop { position: fixed; z-index: 35; inset: 0; display: block; pointer-events: none; background: rgba(3, 18, 33, .48); opacity: 0; transition: opacity .2s; }.sidebar-open .sidebar-backdrop { pointer-events: auto; opacity: 1; }.mobile-bar { position: sticky; z-index: 30; top: 0; display: flex; height: 64px; align-items: center; justify-content: space-between; padding: 8px 16px; color: white; background: var(--navy-950); }.icon-button { display: grid; width: 42px; height: 42px; place-items: center; color: white; border: 1px solid rgba(255,255,255,.25); border-radius: 10px; background: rgba(255,255,255,.08); cursor: pointer; font-size: 1.25rem; }.mobile-brand { color: white; font-weight: 800; }.mobile-brand:hover { color: white; }.mobile-brand img { width: 40px; height: 40px; border: 2px solid white; border-radius: 50%; object-fit: cover; }
  .topbar { min-height: 84px; padding: 18px 20px; }.topbar .eyebrow { display: none; }.topbar-actions .connection-pill { display: none; }.page-content { padding: 22px 18px; }
  .status-hero { grid-template-columns: 1fr; }.water-visual { position: absolute; right: -40px; bottom: -70px; width: 310px; opacity: .34; }.status-copy { max-width: 620px; }.status-copy h2 { font-size: 4.6rem; }
  .announcement-grid { grid-template-columns: 1fr; }.approval-card { align-items: stretch; flex-direction: column; }.approval-actions { justify-items: stretch; }.approval-actions .button { width: 100%; }.decline-form { flex-direction: column; }.decline-form input { width: 100%; }.app-footer { flex-direction: column; gap: 4px; }
}

@media (max-width: 600px) {
  .auth-story { padding: 22px; }.auth-brand img { width: 56px; height: 56px; }.auth-message { margin: 44px 0 28px; }.auth-message h1 { font-size: 2.35rem; }.level-legend { grid-template-columns: 1fr; }.level-legend > div + div { border-top: 1px solid rgba(255,255,255,.18); border-left: 0; }.level-legend > div { padding: 10px 14px; }.auth-card { padding: 27px 22px; }.register-page { padding: 20px 12px 45px; }.register-card { padding: 22px 17px; }.register-heading { align-items: flex-start; }.register-heading img { width: 66px; height: 66px; }.register-heading h1 { font-size: 1.55rem; }.role-choice, .form-grid.two { grid-template-columns: 1fr; }
  .topbar { align-items: flex-start; }.topbar-actions { flex-direction: column-reverse; align-items: flex-end; }.topbar h1 { font-size: 1.35rem; }.page-intro, .section-heading { align-items: flex-start; flex-direction: column; gap: 10px; }.status-hero { min-height: 390px; padding: 24px 20px; }.status-copy h2 { font-size: 3.8rem; }.status-actions { align-items: stretch; flex-direction: column; }.water-visual { opacity: .2; }.sensor-strip { grid-template-columns: 1fr; }.sensor-item + .sensor-item, .sensor-item:nth-child(3) { border-top: 1px solid var(--line); border-left: 0; }.metric-grid { grid-template-columns: 1fr; }.readiness-card { grid-template-columns: 46px 1fr; }.readiness-card .button { grid-column: 1 / -1; }.panel { padding: 18px; }.phone-row { align-items: flex-start; grid-template-columns: 38px 1fr; }.phone-row .row-actions { grid-column: 1 / -1; justify-content: flex-start; padding-left: 50px; }.filter-bar { align-items: stretch; flex-direction: column; }.search-field { width: 100%; }.filter-bar select { min-width: 0; }.approval-person { flex-direction: column; }.manage-item { grid-template-columns: 1fr; }.manage-item .row-actions { justify-content: flex-start; }.button-pair { grid-template-columns: 1fr; }.control-group-heading { align-items: flex-start; }.station-stats > div { align-items: flex-start; flex-direction: column; gap: 4px; }.station-stats dd { text-align: left; }.profile-layout { grid-template-columns: 1fr; }.app-footer { padding: 16px 20px; }
}

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