:root {
  --muted: #586870;
  --line: #dce2df;
  --shadow: 0 12px 36px rgba(16, 40, 63, .07);
  --radius: 12px;
}
html { scroll-padding-top: 24px; }
[id] { scroll-margin-top: 24px; }
:focus-visible { outline: 3px solid #16808a; outline-offset: 4px; }
.skip-link { position: absolute; left: 16px; top: -100px; z-index: 1000; background: var(--navy); color: #fff; padding: 12px 20px; border-radius: 8px; }
.skip-link:focus { top: 12px; }
.button { border-radius: 7px; font-weight: 700; gap: 10px; transition: background .15s, box-shadow .15s; }
.button:hover { transform: none; box-shadow: 0 4px 12px rgba(16,40,63,.1); }
.button-outline { border-color: #bac7c8; background: #fff; color: var(--navy); }
.button-outline:hover { background: #f0f5f3; color: var(--navy); }
.button:disabled { box-shadow: none; }
.text-link { text-underline-offset: 4px; }
.brand-mark { width: 32px; height: 32px; flex: none; }
.wordmark, .commerce-site-header .wordmark { align-items: center; flex-direction: row; gap: 10px; }
.wordmark .brand-copy { display: flex; flex-direction: column; gap: 0; line-height: 1.3; }
.wordmark .brand-copy > span { font-size: 1.2rem; }
.wordmark .brand-copy > small { font-size: .55rem; letter-spacing: .09em; }
.form-card, .auth-card { border-radius: var(--radius); }
.form-card input:not([type=checkbox]), .form-card select, .form-card textarea,
.filter-bar select, .filter-bar input { border-radius: 7px; }
.form-card input:not([type=checkbox]), .form-card select, .form-card textarea { border-color: #becbce; }
.form-card label { font-size: .8rem; }
.form-card .checkbox-line label { font-size: .8rem; font-weight: 400; margin: 0; }
.checkbox-line label { margin: 0; font-size: inherit; font-weight: inherit; }

/* The portal and company workspace share the same navigation and controls. */
.portal-shell { background: #f7f8f5; }
.portal-shell .app-header { background: #fff; border-bottom: 1px solid var(--line); }
.portal-shell .app-header-inner { max-width: 1640px; gap: 24px; padding: 16px 28px; }
.workspace-label { color: var(--muted); font-size: .8rem; border-left: 1px solid var(--line); padding-left: 24px; }
.portal-shell .user-menu { flex-wrap: wrap; font-size: .8rem; gap: 20px; }
.portal-shell .user-menu button { font-size: .8rem; min-height: 36px; border: 0; color: var(--muted); }
.portal-shell .user-menu a:hover, .portal-shell .user-menu button:hover { color: var(--teal); }
.workspace-switch { color: var(--teal); font-weight: 700; }
.workspace-layout { display: grid; grid-template-columns: 240px minmax(0,1fr); max-width: 1640px; min-height: calc(100svh - 78px); margin: auto; }
.workspace-navigation { margin: 20px 0 20px 16px; padding: 24px 12px; background: var(--navy); color: #e4eeee; border-radius: var(--radius); align-self: start; position: sticky; top: 20px; max-height: calc(100svh - 40px); overflow-y: auto; scrollbar-width: thin; scrollbar-color: #5d737f var(--navy); }
.workspace-navigation > summary { display: none; }
.workspace-nav-group { margin-bottom: 24px; }
.workspace-nav-group:last-child { margin-bottom: 0; }
.workspace-nav-group p { margin: 0 12px 8px; font-size: .6rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: #9ab0be; }
.workspace-nav-group a { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 12px; min-height: 42px; border-radius: 7px; font-size: .81rem; line-height: 1.45; margin-top: 2px; }
.workspace-nav-group a:hover { background: #203e51; color: #fff; }
.workspace-nav-group a[aria-current] { background: #e1eeea; color: #164e4a; font-weight: 700; }
.workspace-nav-group a:focus-visible { outline-color: #c9e7e4; outline-offset: 1px; }
.nav-count { background: #dbe9e5; color: var(--navy); border-radius: 12px; padding: 0 7px; font-size: .7rem; }
.workspace-nav-label { display: flex; align-items: center; gap: 12px; min-width: 0; flex: 1; }
.workspace-nav-label .app-icon { width: 18px; height: 18px; }
.portal-shell .app-main { width: 100%; max-width: 1280px; margin: 0 auto; padding: 38px 40px 60px; min-width: 0; }
.portal-shell .page-heading { margin-bottom: 30px; gap: 20px; align-items: flex-start; flex-wrap: wrap; }
.portal-shell .page-heading h1, .portal-shell .narrow-form h1 { font-size: clamp(2.2rem,3.2vw,3.2rem); line-height: 1.1; letter-spacing: -.035em; overflow-wrap: anywhere; }
.portal-shell .page-heading .eyebrow { margin-bottom: 12px; }
.portal-shell .page-heading .lede { max-width: 70ch; font-size: .9rem; margin-bottom: 0; line-height: 1.7; }
.portal-shell .heading-actions { gap: 12px; }
.portal-shell .breadcrumb { margin-bottom: 24px; flex-wrap: wrap; font-size: .78rem; }
.portal-shell .stat-grid { gap: 16px; border: 0; margin-bottom: 28px; }
.portal-shell .stat { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 22px 24px; }
.portal-shell .stat strong { font-family: Manrope, sans-serif; font-size: 2.3rem; line-height: 1.3; letter-spacing: -.04em; font-variant-numeric: tabular-nums; margin: 8px 0 4px; }
.portal-shell .stat-label { font-size: .65rem; letter-spacing: .07em; color: var(--muted); }
.portal-shell .content-section { margin-bottom: 40px; }
.portal-shell .section-heading { gap: 16px; flex-wrap: wrap; align-items: center; margin-bottom: 20px; }
.portal-shell .section-heading h2 { font-size: 1.9rem; line-height: 1.2; }
.portal-shell .section-heading .eyebrow { margin-bottom: 8px; }
.portal-shell .detail-grid { margin-bottom: 28px; align-items: start; }
.portal-shell .detail-card { padding: 24px; min-width: 0; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: none; }
.portal-shell .muted { font-size: .83rem; line-height: 1.65; }
.portal-shell .notice { border-radius: 8px; border-left: 3px solid #b29358; padding: 16px 18px; font-size: .79rem; line-height: 1.6; }
.portal-shell .tag { border-radius: 5px; padding: 5px 8px; font-size: .65rem; font-weight: 700; }
.portal-shell .empty-state { background: #edf2ef; border: 1px solid #dce6e0; border-radius: var(--radius); padding: 26px; }
.portal-shell .empty-state p { font-size: .84rem; line-height: 1.65; max-width: 80ch; }
.portal-shell .table-wrap { border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.portal-shell .table-wrap table { font-size: .82rem; }
.portal-shell .table-wrap th { background: #eef2ef; color: #54666b; font-size: .63rem; letter-spacing: .07em; }
.portal-shell .table-wrap td { line-height: 1.6; }
.portal-shell .table-wrap tbody tr:last-child td { border-bottom: 0; }
.portal-shell .table-wrap tbody tr:hover { background: #f8faf8; }
.portal-shell .table-link { text-decoration: none; border-bottom-color: transparent; font-weight: 600; }
.portal-shell .table-link:hover { text-decoration: underline; text-underline-offset: 4px; }
.portal-shell .filter-bar { border: 1px solid var(--line); background: #fff; padding: 16px; border-radius: 10px; gap: 12px; margin-bottom: 20px; }
.portal-shell .filter-bar label { font-size: .78rem; }
.portal-shell .filter-bar input, .portal-shell .filter-bar select { min-height: 44px; height: auto; padding: 10px 12px; line-height: 1.4; border-color: #becbce; }
.portal-shell .filter-bar .button { min-height: 44px; }
.portal-shell .action-form input:not([type=checkbox]):not([type=radio]):not([type=hidden]),
.portal-shell .action-form select, .portal-shell .action-form textarea { border-radius: 7px; border-color: #becbce; }
.portal-shell dialog { border-radius: 16px; box-shadow: 0 24px 80px rgba(16,40,63,.2); }
.workspace-footer { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 20px; border-top: 1px solid var(--line); margin-top: 44px; padding-top: 22px; color: var(--muted); font-size: .73rem; }
.workspace-footer a { text-decoration: underline; text-underline-offset: 3px; }
.workspace-footer-brand { font-weight: 600; color: var(--teal); }
.flash-stack { position: static; max-width: 1200px; width: auto; margin: 20px auto; padding: 0 18px; }
.app-main > .flash-stack { margin: 0 0 24px; padding: 0; max-width: none; }
.flash { margin-bottom: 8px; border-radius: 8px; }
.section-links { display: flex; flex-wrap: wrap; gap: 8px 20px; margin: 0 0 24px; font-size: .85rem; }
.section-links a { color: var(--teal); text-decoration: underline; text-underline-offset: 3px; padding-block: 6px; }
.form-disclosure > summary { cursor: pointer; font-weight: 700; padding: 16px 0; color: var(--teal); }
.workspace-directory { border-top: 1px solid var(--line); margin-top: 32px; }
.workspace-directory .operations-workspaces { margin-top: 16px; gap: 12px; }
.portal-shell .operations-workspaces { grid-template-columns: repeat(auto-fit,minmax(min(240px,100%),1fr)); }
.workspace-directory .operations-workspace { padding: 20px; gap: 8px; border-radius: var(--radius); border: 1px solid var(--line); }
.workspace-directory .operations-workspace h3 { font: 700 1rem/1.4 Manrope,sans-serif; margin: 0; color: var(--teal); }
.workspace-directory .operations-workspace h3::after { content: " →"; }
.workspace-directory .operations-workspace p { font-size: .82rem; line-height: 1.6; }
.app-main pre { max-width: 100%; overflow-x: auto; padding: 16px; background: var(--stone); font-size: .8rem; border-radius: 8px; }
.app-main code { overflow-wrap: anywhere; }
.app-icon { display: inline-block; width: 24px; height: 24px; flex: none; vertical-align: middle; }
.device-identity { display: flex; align-items: center; gap: 12px; min-width: 0; }
.device-identity-copy { min-width: 0; }
.device-icon { display: inline-flex; align-items: center; justify-content: center; flex: none; width: 40px; height: 40px; border-radius: 10px; background: #e8edeb; color: #375d60; }
.device-icon--leak { background: #e2eef1; color: #26677a; }
.device-icon--climate { background: #f2ebde; color: #82602f; }
.device-icon--valve { background: #dfece6; color: #245e50; }
.device-icon--meter { background: #e7eaf2; color: #495e87; }
.icon-title { display: flex; align-items: center; gap: 16px; }
.icon-title .device-icon { width: 48px; height: 48px; }
.icon-title .app-icon { width: 30px; height: 30px; }
.device-filter .button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.device-filter .button .app-icon { width: 18px; height: 18px; }
.reading-summary > div { display: contents; }
.reading-timestamps { margin-top: 18px; }

.portal-shell .alerts-card:not(.policy-editor) { border: 1px solid var(--line); border-radius: var(--radius); box-shadow: none; }
.portal-shell .alerts-banner { border-radius: 8px; border-left: 3px solid #b29358; }
.portal-shell .alerts-form input:not([type=checkbox]):not([type=hidden]), .portal-shell .alerts-form select { border-radius: 7px; }
.commerce-button { border-radius: 7px; }
.commerce-filter input, .commerce-filter select, .commerce-form input:not([type=checkbox]):not([type=radio]), .commerce-form select, .commerce-form textarea { border-radius: 7px; }
.catalog-card, .proposal-card, .commerce-empty, .operations-filter { border: 1px solid var(--line); border-radius: var(--radius); box-shadow: none; }
.catalog-card { overflow: hidden; }
.catalog-card:hover { border-color: #8badab; box-shadow: var(--shadow); }
.commerce-note, .commerce-alert { border-radius: 8px; }

/* Public navigation has an explicit mobile menu, including every destination. */
.commerce-site-header { position: relative; padding-block: 24px; gap: 24px; }
.public-navigation > summary { display: none; }
.public-navigation .site-nav { display: flex; align-items: center; gap: 28px; }
.public-navigation .site-nav a { font-size: .8rem; font-weight: 600; padding-block: 12px; }
.public-navigation .site-nav .nav-login { padding: 10px 18px; border: 1px solid #b8c8c7; border-radius: 7px; }
.site-nav a[aria-current] { text-decoration: underline; text-underline-offset: 5px; }
.public-navigation .site-nav a:hover { color: var(--teal); }
.commerce-filter .field-block { display: flex; flex-direction: column; gap: 6px; flex: 1; }
.commerce-filter label { font-size: .8rem; font-weight: 700; }
.commerce-filter { align-items: end; }
.site-footer { padding-block: 56px 28px; }
.site-footer .footer-inner { display: grid; grid-template-columns: 1fr 1fr; align-items: start; gap: 32px; }
.footer-brand p { margin: 20px 0 0; color: #bdcece; font-size: .9rem; max-width: 32ch; }
.site-footer .footer-links { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 32px; justify-self: end; }
.site-footer .footer-links a { font-size: .85rem; padding: 6px 0; }
.footer-bottom { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 12px; margin-top: 36px; padding-top: 20px; border-top: 1px solid #3f5666; color: #a9bec6; font-size: .72rem; }

@media (max-width: 1200px) {
  .workspace-layout { grid-template-columns: 220px minmax(0,1fr); }
  .portal-shell .app-main { padding-inline: 28px; }
  .public-navigation .site-nav { gap: 18px; }
}
@media (max-width: 1100px) {
  .portal-shell .detail-grid, .portal-shell .split-section { grid-template-columns: 1fr; gap: 24px; }
}
@media (max-width: 900px) {
  .portal-shell .app-header-inner { padding: 14px 20px; gap: 12px 16px; }
  .workspace-label { font-size: .7rem; padding-left: 16px; margin-left: auto; }
  .portal-shell .user-menu { width: 100%; margin: 0; font-size: .75rem; gap: 16px; }
  .portal-shell .user-menu form { margin-left: auto; }
  .workspace-layout { display: block; }
  .workspace-navigation { position: static; max-height: none; border: 0; border-radius: 0; padding: 0 20px; margin: 0; }
  .workspace-navigation > summary { display: list-item; cursor: pointer; padding: 14px 0; font-size: .85rem; font-weight: 600; }
  .workspace-navigation > summary span { float: right; max-width: 65%; color: #c0d2d9; font-size: .78rem; font-weight: 400; }
  .workspace-navigation nav { padding: 8px 0 20px; display: grid; grid-template-columns: repeat(auto-fit,minmax(160px,1fr)); gap: 12px; }
  .workspace-nav-group a { min-height: 44px; }
  .portal-shell .app-main { padding: 28px 20px 48px; }
  .portal-shell .stat-grid { gap: 10px; }
  .portal-shell .stat { padding: 16px 12px; }
  .portal-shell .stat strong { font-size: 1.9rem; }
  .portal-shell .stat-label { font-size: .59rem; letter-spacing: .03em; }
  .portal-shell .stat .muted { font-size: .7rem; }
  .portal-shell .detail-card { padding: 20px; }
  .portal-shell .page-heading { margin-bottom: 24px; }
  .portal-shell .team-layout { grid-template-columns: 1fr; gap: 24px; }
  .public-navigation > summary { display: flex; align-items: center; gap: 10px; cursor: pointer; padding: 10px 14px; border: 1px solid var(--line); border-radius: 7px; font-size: .8rem; font-weight: 600; }
  .public-navigation > summary::after { content: "+"; font-size: 1.3rem; line-height: 1; }
  .public-navigation[open] > summary::after { content: "−"; }
  .public-navigation .site-nav { position: absolute; z-index: 10; top: calc(100% - 8px); left: 0; right: 0; padding: 18px; background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); display: grid; grid-template-columns: 1fr 1fr; gap: 8px 18px; }
  .public-navigation .site-nav > a { display: block; padding: 12px; min-height: 44px; }
  .public-navigation .site-nav .nav-login { text-align: center; }
  .commerce-site-header { padding-block: 18px; }
}
@media (max-width: 800px) {
  .commerce-filter .field-block { flex-basis: 100%; }
  .commerce-filter .commerce-button { width: 100%; }
  .site-footer .footer-inner { grid-template-columns: 1fr; }
  .site-footer .footer-links { justify-self: start; }
  .portal-shell .filter-bar input, .portal-shell .filter-bar select { font-size: 1rem; }
}
@media (max-width: 400px) {
  .portal-shell .app-header-inner { padding-inline: 16px; }
  .portal-shell .app-header .brand-mark { width: 26px; height: 26px; }
  .portal-shell .app-header .wordmark .brand-copy > span { font-size: 1.05rem; }
  .workspace-label { font-size: .65rem; padding-left: 10px; }
  .portal-shell .app-main { padding-inline: 16px; }
  .portal-shell .stat { padding-inline: 9px; }
}

.tv-shell .workspace-layout { display: block; max-width: none; }
.tv-shell .workspace-navigation { position: static; max-height: none; margin: 0; border-radius: 0; padding: 0 24px; }
.tv-shell .workspace-navigation > summary { display: list-item; cursor: pointer; padding: 12px 0; font-size: .8rem; }
.tv-shell .workspace-navigation > summary span { margin-left: 16px; }
.tv-shell .workspace-navigation nav { display: grid; grid-template-columns: repeat(auto-fit,minmax(180px,1fr)); gap: 16px; padding: 16px 0; }
.portal-shell.tv-shell .app-main { max-width: none; padding: 24px 32px 16px; }
@media (max-width: 800px) { .portal-shell.tv-shell .app-main { padding: 18px 16px; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto!important; transition: none!important; animation: none!important; } }
@media print {
  .workspace-navigation, .workspace-footer, .skip-link { display: none!important; }
  .workspace-layout { display: block; }
  .portal-shell .app-main { max-width: none; padding: 0; }
  .portal-shell .table-wrap { overflow: visible; border-radius: 0; }
}
