:root{
  --bg:#eef3f7;--surface:#ffffff;--surface-2:#f7f9fb;--surface-3:#edf3f6;
  --text:#142938;--muted:#6c7f8d;--line:#dce5ea;--line-strong:#cad7de;
  --sidebar:#081923;--sidebar-2:#0c2633;--sidebar-text:#d5e1e7;--sidebar-muted:#8da3ae;
  --teal:#0b8f8a;--teal-dark:#08736f;--blue:#176fa8;--gold:#e7a31a;
  --green:#16855d;--red:#c44b54;--orange:#cd7922;--shadow:0 12px 32px rgba(24,49,65,.07);
  --radius:14px;--radius-sm:10px;
  color-scheme:light;
}
html[data-theme="dark"]{
  --bg:#08121a;--surface:#0f1d27;--surface-2:#13242f;--surface-3:#172b38;
  --text:#e7eff4;--muted:#91a5b2;--line:#263b47;--line-strong:#35505e;
  --sidebar:#061017;--sidebar-2:#0a1c25;--sidebar-text:#deeaef;--sidebar-muted:#89a0ac;
  --shadow:0 12px 34px rgba(0,0,0,.24);color-scheme:dark;
}
*{box-sizing:border-box}
html,body{margin:0;min-height:100%;font-family:Inter,ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;background:var(--bg);color:var(--text)}
body{font-size:14px}
a{text-decoration:none;color:var(--teal)}
button,input,select{font:inherit}
button{cursor:pointer}
.app-shell{display:flex;min-height:100vh}
.mobile-backdrop{display:none;position:fixed;inset:0;background:rgba(2,12,18,.56);z-index:1040}
.sidebar{position:fixed;inset:0 auto 0 0;width:276px;background:linear-gradient(180deg,var(--sidebar),var(--sidebar-2));color:var(--sidebar-text);z-index:1050;display:flex;flex-direction:column;border-right:1px solid rgba(255,255,255,.05)}
.sidebar-brand{height:86px;padding:14px 18px;display:flex;align-items:center;justify-content:space-between;border-bottom:1px solid rgba(255,255,255,.08)}
.brand-link{display:block;background:#fff;border-radius:10px;padding:6px 12px}
.brand-link img{width:180px;height:46px;object-fit:contain}
.sidebar-close{border:0;background:transparent;color:#fff;font-size:1.2rem}
.tenant-card{margin:16px 14px 8px;padding:14px;background:rgba(255,255,255,.055);border:1px solid rgba(255,255,255,.08);border-radius:12px}
.tenant-label,.tenant-meta{display:block;color:var(--sidebar-muted);font-size:.72rem}
.tenant-card strong{display:block;margin:4px 0 8px;font-size:.88rem}
.sidebar-nav{padding:12px 10px;display:flex;flex-direction:column;gap:3px;overflow:auto}
.nav-section-label{padding:8px 12px;color:#6f8b98;font-size:.65rem;text-transform:uppercase;letter-spacing:.13em;font-weight:700}
.nav-link-side{display:flex;align-items:center;gap:12px;color:var(--sidebar-muted);padding:10px 12px;border-radius:9px;transition:.18s}
.nav-link-side i{width:22px;font-size:1.05rem;text-align:center}
.nav-link-side:hover{background:rgba(255,255,255,.07);color:#fff}
.nav-link-side.active{background:linear-gradient(90deg,rgba(17,155,148,.25),rgba(17,155,148,.09));color:#fff;box-shadow:inset 3px 0 0 #20b5ae}
.nav-badge{margin-left:auto;background:#d85c62;color:#fff;border-radius:999px;padding:2px 7px;font-size:.68rem}
.sidebar-health{margin-top:auto;padding:12px 18px;border-top:1px solid rgba(255,255,255,.07)}
.health-row{display:flex;justify-content:space-between;gap:12px;font-size:.7rem;color:var(--sidebar-muted);padding:4px 0}
.health-row b{font-weight:600}.health-row .ok{color:#60c89b}
.sidebar-footer{display:flex;align-items:center;justify-content:space-between;padding:14px 18px;border-top:1px solid rgba(255,255,255,.08)}
.sidebar-user{display:flex;align-items:center;gap:10px;min-width:0}
.sidebar-user div:last-child{min-width:0}.sidebar-user strong,.sidebar-user span{display:block;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.sidebar-user strong{font-size:.78rem}.sidebar-user span{color:var(--sidebar-muted);font-size:.68rem;text-transform:capitalize}
.avatar{width:38px;height:38px;display:grid;place-items:center;border-radius:10px;background:linear-gradient(135deg,#0f9f9a,#176fa8);color:#fff;font-weight:800}
.logout-button{color:#9fb1ba;font-size:1.05rem;padding:8px}.logout-button:hover{color:#fff}
.main-area{margin-left:276px;width:calc(100% - 276px);min-height:100vh;display:flex;flex-direction:column}
.topbar{height:84px;padding:0 28px;display:flex;align-items:center;justify-content:space-between;background:color-mix(in srgb,var(--surface) 94%,transparent);backdrop-filter:blur(12px);border-bottom:1px solid var(--line);position:sticky;top:0;z-index:1020}
.topbar-left{display:flex;align-items:center;gap:12px}
.topbar h1{font-size:1.25rem;margin:3px 0 0;font-weight:700}
.breadcrumb-line{display:flex;align-items:center;gap:6px;color:var(--muted);font-size:.7rem}.breadcrumb-line i{font-size:.55rem}
.mobile-menu-button,.topbar-icon{border:1px solid var(--line);background:var(--surface-2);color:var(--text);border-radius:10px;width:40px;height:40px;display:grid;place-items:center}
.topbar-actions{display:flex;align-items:center;gap:10px}
.connection-state{display:flex;align-items:center;gap:9px;border-right:1px solid var(--line);padding-right:16px;margin-right:4px}
.connection-dot{width:9px;height:9px;border-radius:50%;background:#25a46f;box-shadow:0 0 0 5px rgba(37,164,111,.12)}
.connection-state strong,.connection-state small{display:block}.connection-state strong{font-size:.75rem}.connection-state small{font-size:.65rem;color:var(--muted)}
.notification-button{position:relative}.notification-button span{position:absolute;top:-5px;right:-5px;background:#d7555d;color:#fff;border:2px solid var(--surface);font-size:.62rem;min-width:19px;height:19px;border-radius:99px;display:grid;place-items:center}
.topbar-profile{display:flex;align-items:center;gap:9px;margin-left:4px}.topbar-profile strong,.topbar-profile small{display:block}.topbar-profile strong{font-size:.78rem}.topbar-profile small{font-size:.67rem;color:var(--muted);text-transform:capitalize}
.content-area{padding:26px;flex:1}
.operations-header{display:flex;align-items:center;justify-content:space-between;margin-bottom:18px}.operations-header h2{margin:3px 0;font-size:1.55rem}.operations-header p{margin:0;color:var(--muted)}
.section-kicker,.auth-overline{font-size:.65rem;font-weight:800;letter-spacing:.13em;text-transform:uppercase;color:var(--teal)}
.operations-actions{display:flex;gap:8px}
.button{display:inline-flex;align-items:center;gap:8px;border-radius:9px;padding:10px 14px;font-weight:700;border:1px solid var(--line)}
.button-primary{background:var(--teal);border-color:var(--teal);color:#fff}.button-primary:hover{background:var(--teal-dark);color:#fff}
.button-secondary{background:var(--surface);color:var(--text)}
.context-bar{display:grid;grid-template-columns:1fr 1fr 1fr 1.25fr;gap:10px;background:var(--surface);border:1px solid var(--line);border-radius:var(--radius);padding:12px;margin-bottom:16px;box-shadow:var(--shadow)}
.context-field label{display:block;font-size:.65rem;color:var(--muted);font-weight:700;text-transform:uppercase;letter-spacing:.06em;margin-bottom:4px}
.context-field select{width:100%;border:0;background:var(--surface-2);color:var(--text);padding:9px 10px;border-radius:8px;outline:0}
.device-identity{display:flex;align-items:center;gap:12px;border-left:1px solid var(--line);padding-left:16px}.device-identity strong,.device-identity small{display:block}.device-identity small{font-size:.68rem;color:var(--muted)}
.device-online{background:rgba(22,133,93,.11);color:var(--green);border-radius:999px;padding:7px 9px;font-size:.7rem;font-weight:800}.device-online i{display:inline-block;width:6px;height:6px;background:var(--green);border-radius:50%;margin-right:5px}
.kpi-grid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:14px;margin-bottom:14px}
.metric-card{background:var(--surface);border:1px solid var(--line);border-radius:var(--radius);padding:16px;box-shadow:var(--shadow);min-height:142px;display:flex;flex-direction:column;justify-content:space-between}
.metric-card.metric-primary{border-top:3px solid var(--teal)}.metric-card.metric-alert{border-top:3px solid var(--orange)}
.metric-top,.metric-value,.metric-footer{display:flex;align-items:center;justify-content:space-between;gap:8px}.metric-top{color:var(--muted);font-size:.73rem;font-weight:700}.metric-top i{font-size:1.08rem;color:var(--teal)}
.metric-value strong{font-size:1.65rem;letter-spacing:-.03em}.metric-value small{margin-right:auto;color:var(--muted);font-weight:700}.metric-footer{font-size:.68rem;color:var(--muted);border-top:1px solid var(--line);padding-top:10px}.metric-footer b{color:var(--text)}.positive{color:var(--green)!important}.warning-text{color:var(--orange)!important}
.state-pill{font-size:.62rem;padding:5px 7px;border-radius:999px}.state-pill.success{background:rgba(22,133,93,.12);color:var(--green)}
.level-track{height:6px;background:var(--surface-3);border-radius:999px;overflow:hidden}.level-track span{display:block;height:100%;background:linear-gradient(90deg,var(--blue),var(--teal))}
.dashboard-grid{display:grid;grid-template-columns:1.35fr .9fr .9fr;gap:14px}
.data-panel{background:var(--surface);border:1px solid var(--line);border-radius:var(--radius);padding:17px;box-shadow:var(--shadow);min-width:0}
.chart-panel-wide{grid-column:span 2}.alert-panel{grid-column:span 2}
.panel-heading{display:flex;align-items:center;justify-content:space-between;gap:10px;margin-bottom:14px}.panel-heading h3{font-size:.95rem;margin:3px 0 0}.panel-heading a{font-size:.72rem;font-weight:700}
.time-filter{display:flex;padding:3px;background:var(--surface-2);border-radius:8px}.time-filter button{border:0;background:transparent;color:var(--muted);font-size:.65rem;font-weight:800;padding:6px 8px;border-radius:6px}.time-filter button.active{background:var(--surface);color:var(--text);box-shadow:0 2px 8px rgba(0,0,0,.06)}
.chart-wrap{height:300px}.chart-wrap.small{height:225px}.chart-wrap canvas{width:100%!important;height:100%!important}
.panel-action{border:1px solid var(--line);background:var(--surface-2);color:var(--text);border-radius:8px;width:34px;height:34px}
.vertical-process{padding:4px 0}.process-step{display:grid;grid-template-columns:44px 1fr auto;align-items:center;gap:10px}.process-symbol{width:40px;height:40px;border-radius:11px;display:grid;place-items:center}.process-symbol.solar{background:rgba(231,163,26,.14);color:var(--gold)}.process-symbol.controller{background:rgba(23,111,168,.14);color:var(--blue)}.process-symbol.pump{background:rgba(11,143,138,.14);color:var(--teal)}.process-symbol.water{background:rgba(23,111,168,.14);color:var(--blue)}
.process-step span,.process-step strong{display:block}.process-step span{font-size:.68rem;color:var(--muted)}.process-step strong{font-size:.77rem;margin-top:2px}.process-step>b{font-size:.72rem}
.process-connector{height:25px;border-left:2px dashed var(--line-strong);margin-left:19px}.process-connector.active{border-color:var(--teal)}
.weather-grid{display:grid;grid-template-columns:1fr 1fr;gap:10px}.weather-grid div{background:var(--surface-2);border:1px solid var(--line);border-radius:10px;padding:12px}.weather-grid i{display:block;color:var(--teal);font-size:1.1rem}.weather-grid span,.weather-grid strong{display:block}.weather-grid span{font-size:.66rem;color:var(--muted);margin:6px 0 2px}
.event-list{display:flex;flex-direction:column;gap:9px}.event-row{display:grid;grid-template-columns:38px 1fr auto;align-items:center;gap:10px;padding:10px;background:var(--surface-2);border:1px solid var(--line);border-radius:10px}.event-icon{width:34px;height:34px;display:grid;place-items:center;border-radius:9px}.event-row.warning .event-icon{background:rgba(205,121,34,.14);color:var(--orange)}.event-row.info .event-icon{background:rgba(23,111,168,.13);color:var(--blue)}.event-row.resolved .event-icon{background:rgba(22,133,93,.13);color:var(--green)}
.event-row strong,.event-row span{display:block}.event-row strong{font-size:.76rem}.event-row span,.event-row time{font-size:.66rem;color:var(--muted)}
.app-footer{padding:14px 28px;border-top:1px solid var(--line);background:var(--surface);display:flex;justify-content:space-between;color:var(--muted);font-size:.68rem}.footer-status{display:flex;gap:16px}.footer-status i{font-size:.5rem;color:var(--green)}
/* Authentication */
.auth-page,.registration-page{background:var(--bg);min-height:100vh}
.auth-theme-switch{position:fixed;right:22px;top:20px;width:42px;height:42px;border-radius:10px;border:1px solid rgba(255,255,255,.2);background:rgba(7,24,34,.72);color:#fff;z-index:10;backdrop-filter:blur(10px)}
.auth-layout{min-height:100vh;display:grid;grid-template-columns:1.08fr .92fr}
.auth-brand-panel{background:radial-gradient(circle at 15% 20%,rgba(28,164,157,.22),transparent 30%),linear-gradient(145deg,#061721,#0b2d3a 62%,#123e49);color:#fff;padding:7vh 7vw;display:flex;flex-direction:column;justify-content:space-between}
.auth-brand-content{max-width:760px}.auth-brand-logo{width:260px;background:#fff;border-radius:10px;padding:7px 12px;margin-bottom:9vh}.auth-brand-panel h1{font-size:clamp(2.2rem,4.5vw,4.6rem);line-height:1.02;letter-spacing:-.045em;margin:18px 0}.auth-brand-panel p{font-size:1rem;line-height:1.7;color:#bed0d8;max-width:680px}
.auth-feature-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:12px;margin-top:34px}.auth-feature-grid div{padding:14px;border:1px solid rgba(255,255,255,.12);background:rgba(255,255,255,.045);border-radius:10px}.auth-feature-grid i,.auth-feature-grid strong,.auth-feature-grid span{display:block}.auth-feature-grid i{color:#5ed0ca;font-size:1.1rem}.auth-feature-grid strong{font-size:.74rem;margin:8px 0 3px}.auth-feature-grid span{font-size:.65rem;color:#9fb5bf}
.auth-brand-footer{display:flex;justify-content:space-between;color:#89a6b2;font-size:.68rem}
.auth-form-panel-pro{background:var(--surface);display:grid;place-items:center;padding:40px}.auth-form-pro{width:min(430px,100%)}.auth-heading h2,.registration-heading h2{font-size:2rem;letter-spacing:-.03em;margin:6px 0}.auth-heading p,.registration-heading p{color:var(--muted);margin:0 0 25px}.auth-overline.dark{color:var(--teal)}
.field-group{display:flex;flex-direction:column;gap:6px;margin-bottom:15px}.field-group label{font-size:.72rem;font-weight:800}.field-label-row{display:flex;justify-content:space-between}.field-label-row a{font-size:.7rem}
.input-shell{height:48px;display:flex;align-items:center;border:1px solid var(--line-strong);background:var(--surface-2);border-radius:10px;overflow:hidden}.input-shell>i{margin-left:13px;color:var(--muted)}.input-shell input{flex:1;height:100%;border:0;background:transparent;color:var(--text);padding:0 12px;outline:0}.input-shell:focus-within{border-color:var(--teal);box-shadow:0 0 0 3px rgba(11,143,138,.1)}.input-shell.plain input{padding-left:12px}
.password-toggle{border:0;background:transparent;color:var(--muted);height:100%;width:42px}
.form-options{display:flex;justify-content:space-between;align-items:center;color:var(--muted);font-size:.68rem;margin:4px 0 18px}.secure-note{color:var(--green)}
.auth-submit{width:100%;height:49px;border:0;border-radius:10px;background:linear-gradient(90deg,var(--teal),var(--blue));color:#fff;font-weight:800;display:flex;align-items:center;justify-content:center;gap:10px}.auth-submit:hover{filter:brightness(.96)}
.auth-divider{display:flex;align-items:center;gap:10px;color:var(--muted);font-size:.65rem;margin:20px 0}.auth-divider:before,.auth-divider:after{content:"";height:1px;background:var(--line);flex:1}.auth-secondary{display:block;text-align:center;border:1px solid var(--line-strong);border-radius:10px;padding:12px;color:var(--text);font-weight:700}.demo-credentials{margin-top:20px;background:var(--surface-2);border:1px solid var(--line);padding:11px;border-radius:9px;font-size:.67rem;color:var(--muted)}.demo-credentials strong,.demo-credentials span{display:block}.demo-credentials strong{color:var(--text);margin-bottom:3px}
.form-alert{display:flex;gap:9px;padding:11px;border-radius:9px;margin-bottom:16px;font-size:.72rem}.form-alert.error{background:rgba(196,75,84,.11);color:var(--red);border:1px solid rgba(196,75,84,.22)}.form-alert.success{background:rgba(22,133,93,.11);color:var(--green);border:1px solid rgba(22,133,93,.22)}
/* Registration */
.registration-layout{min-height:100vh;display:grid;grid-template-columns:410px 1fr}.registration-aside{background:linear-gradient(155deg,#061721,#0d3440);color:#fff;padding:48px 42px;display:flex;flex-direction:column}.registration-aside img{width:230px;background:#fff;padding:6px 10px;border-radius:9px;margin-bottom:55px}.registration-aside h1{font-size:2rem;line-height:1.12;margin:15px 0}.registration-aside p{color:#aec2cb;line-height:1.65}.onboarding-steps{list-style:none;padding:0;margin:30px 0}.onboarding-steps li{display:flex;gap:12px;margin:18px 0}.onboarding-steps b{width:30px;height:30px;display:grid;place-items:center;border-radius:50%;background:rgba(32,181,174,.17);color:#72ddd8}.onboarding-steps strong,.onboarding-steps span{display:block}.onboarding-steps strong{font-size:.75rem}.onboarding-steps span{font-size:.66rem;color:#8faab5;margin-top:3px}.back-login{margin-top:auto;color:#c7d8df;font-size:.72rem}
.registration-form-wrap{display:grid;place-items:center;padding:45px}.registration-form{width:min(780px,100%);background:var(--surface);border:1px solid var(--line);border-radius:16px;padding:32px;box-shadow:var(--shadow)}.form-section-title{display:flex;align-items:center;gap:8px;border-bottom:1px solid var(--line);padding-bottom:9px;margin:24px 0 15px;font-size:.75rem;font-weight:800}.form-section-title i{color:var(--teal)}
.form-grid{display:grid;grid-template-columns:1fr 1fr;gap:0 14px}.field-group.span-2{grid-column:span 2}.field-group>input,.field-group>select{height:46px;border:1px solid var(--line-strong);background:var(--surface-2);color:var(--text);border-radius:9px;padding:0 12px;outline:0}.field-group>input:focus,.field-group>select:focus{border-color:var(--teal);box-shadow:0 0 0 3px rgba(11,143,138,.1)}.field-group small{color:var(--muted);font-size:.63rem}.field-error{font-size:.64rem;color:var(--red)}
.terms-row{display:flex;gap:9px;align-items:flex-start;font-size:.7rem;color:var(--muted);margin:10px 0 16px}.registration-note{font-size:.65rem;color:var(--muted);margin:14px 0 0;text-align:center}
@media(max-width:1200px){.kpi-grid{grid-template-columns:repeat(2,1fr)}.dashboard-grid{grid-template-columns:1fr 1fr}.chart-panel-wide,.alert-panel{grid-column:span 2}.registration-layout{grid-template-columns:330px 1fr}}
@media(max-width:991px){.sidebar{transform:translateX(-100%);transition:.22s}.sidebar.open{transform:translateX(0)}.mobile-backdrop.open{display:block}.main-area{margin-left:0;width:100%}.connection-state,.topbar-profile>div:last-child{display:none}.auth-layout{grid-template-columns:1fr}.auth-brand-panel{display:none}.registration-layout{grid-template-columns:1fr}.registration-aside{display:none}}
@media(max-width:720px){.content-area{padding:16px}.topbar{padding:0 16px}.operations-header{align-items:flex-start;flex-direction:column;gap:12px}.context-bar{grid-template-columns:1fr}.device-identity{border-left:0;border-top:1px solid var(--line);padding:12px 0 0}.kpi-grid,.dashboard-grid{grid-template-columns:1fr}.chart-panel-wide,.alert-panel{grid-column:span 1}.chart-wrap{height:240px}.auth-form-panel-pro,.registration-form-wrap{padding:20px}.registration-form{padding:22px}.form-grid{grid-template-columns:1fr}.field-group.span-2{grid-column:span 1}.app-footer{flex-direction:column;gap:7px}.footer-status{flex-wrap:wrap}.topbar-actions{gap:6px}}


/* ==========================================================
   AquaSolis deterministic theme layer — Version 3
   ========================================================== */

html.theme-light {
  color-scheme: light;
}

html.theme-dark {
  color-scheme: dark;
}

/* Smooth only after initial render; avoids first-load flash. */
html.theme-light body,
html.theme-dark body {
  transition: background-color .18s ease, color .18s ease;
}

.theme-control {
  display: inline-flex;
  align-items: center;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-2);
}

.theme-option {
  min-height: 32px;
  padding: 0 9px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: .68rem;
  font-weight: 800;
}

.theme-option.active {
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 2px 8px rgba(12, 32, 43, .10);
}

html.theme-dark .theme-option.active {
  box-shadow: 0 2px 9px rgba(0, 0, 0, .28);
}

/* Explicit dark surfaces. */
html.theme-dark body,
html.theme-dark .content-area {
  background: #08121a;
  color: #e7eff4;
}

html.theme-dark .topbar,
html.theme-dark .app-footer,
html.theme-dark .context-bar,
html.theme-dark .metric-card,
html.theme-dark .data-panel,
html.theme-dark .registration-form,
html.theme-dark .auth-form-panel-pro,
html.theme-dark .card,
html.theme-dark .modal-content,
html.theme-dark .dropdown-menu {
  background: #0f1d27;
  color: #e7eff4;
  border-color: #263b47;
}

html.theme-dark .context-field select,
html.theme-dark .field-group > input,
html.theme-dark .field-group > select,
html.theme-dark .input-shell,
html.theme-dark .event-row,
html.theme-dark .weather-grid > div,
html.theme-dark .time-filter,
html.theme-dark .demo-credentials {
  background: #13242f;
  color: #e7eff4;
  border-color: #2b414e;
}

html.theme-dark input,
html.theme-dark select,
html.theme-dark textarea {
  color: #e7eff4;
}

html.theme-dark input::placeholder,
html.theme-dark textarea::placeholder {
  color: #718794;
}

html.theme-dark select option {
  background: #13242f;
  color: #e7eff4;
}

html.theme-dark .button-secondary,
html.theme-dark .topbar-icon,
html.theme-dark .mobile-menu-button,
html.theme-dark .panel-action {
  background: #13242f;
  color: #e7eff4;
  border-color: #2b414e;
}

html.theme-dark .table {
  --bs-table-bg: transparent;
  --bs-table-color: #e7eff4;
  --bs-table-border-color: #263b47;
  color: #e7eff4;
}

html.theme-dark .table > :not(caption) > * > * {
  background: transparent;
  color: #e7eff4;
  border-color: #263b47;
}

html.theme-dark .text-secondary {
  color: #91a5b2 !important;
}

html.theme-dark .sidebar {
  background: linear-gradient(180deg, #050d13, #081923);
}

html.theme-dark .brand-link,
html.theme-dark .sidebar-brand .brand-link {
  background: #ffffff;
}

/* Explicit light surfaces, preventing stale Bootstrap dark variables. */
html.theme-light body,
html.theme-light .content-area {
  background: #eef3f7;
  color: #142938;
}

html.theme-light .topbar,
html.theme-light .app-footer,
html.theme-light .context-bar,
html.theme-light .metric-card,
html.theme-light .data-panel,
html.theme-light .registration-form,
html.theme-light .auth-form-panel-pro {
  background: #ffffff;
  color: #142938;
  border-color: #dce5ea;
}

html.theme-light .context-field select,
html.theme-light .field-group > input,
html.theme-light .field-group > select,
html.theme-light .input-shell,
html.theme-light .event-row,
html.theme-light .weather-grid > div,
html.theme-light .time-filter,
html.theme-light .demo-credentials {
  background: #f7f9fb;
  color: #142938;
  border-color: #cad7de;
}

@media (max-width: 720px) {
  .theme-option span {
    display: none;
  }

  .theme-option {
    width: 34px;
    justify-content: center;
    padding: 0;
  }
}

.auth-theme-control{
  position:fixed;
  top:20px;
  right:20px;
  z-index:2000;
  backdrop-filter:blur(10px);
}


/* Registration approval administration */
.approval-summary-grid {
  display: grid;
  grid-template-columns: minmax(250px, 320px);
  margin-bottom: 14px;
}

.approval-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.approval-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-2);
}

.approval-card-main {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  flex: 1;
  min-width: 0;
}

.approval-avatar {
  width: 48px;
  height: 48px;
  flex: 0 0 48px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--teal), var(--blue));
  color: #fff;
  font-size: 1.1rem;
  font-weight: 800;
}

.approval-details {
  flex: 1;
  min-width: 0;
}

.approval-heading-row {
  display: flex;
  justify-content: space-between;
  gap: 14px;
}

.approval-heading-row h3 {
  margin: 0 0 7px;
  font-size: 1rem;
}

.approval-heading-row time {
  color: var(--muted);
  font-size: .68rem;
  white-space: nowrap;
}

.state-pill.pending {
  background: rgba(205, 121, 34, .13);
  color: var(--orange);
}

.approval-meta-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.approval-meta-grid span,
.approval-meta-grid strong {
  display: block;
}

.approval-meta-grid span {
  color: var(--muted);
  font-size: .65rem;
  margin-bottom: 3px;
}

.approval-meta-grid strong {
  font-size: .75rem;
  overflow-wrap: anywhere;
}

.approval-actions {
  display: flex;
  gap: 8px;
  flex: 0 0 auto;
}

.button-danger {
  background: var(--red);
  border-color: var(--red);
  color: #fff;
}

.button-danger:hover {
  background: #a93c45;
  color: #fff;
}

.approval-empty-state {
  padding: 48px 20px;
  text-align: center;
  color: var(--muted);
}

.approval-empty-state i {
  display: block;
  margin-bottom: 12px;
  color: var(--green);
  font-size: 2.2rem;
}

.approval-empty-state h3 {
  color: var(--text);
}

.field-group textarea {
  width: 100%;
  border: 1px solid var(--line-strong);
  background: var(--surface-2);
  color: var(--text);
  border-radius: 9px;
  padding: 12px;
  outline: 0;
  resize: vertical;
}

.field-group textarea:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(11, 143, 138, .1);
}

@media (max-width: 900px) {
  .approval-card {
    align-items: stretch;
    flex-direction: column;
  }

  .approval-meta-grid {
    grid-template-columns: 1fr 1fr;
  }

  .approval-actions {
    justify-content: flex-end;
  }
}

@media (max-width: 560px) {
  .approval-heading-row {
    flex-direction: column;
  }

  .approval-meta-grid {
    grid-template-columns: 1fr;
  }

  .approval-actions {
    flex-direction: column;
  }

  .approval-actions form,
  .approval-actions .button {
    width: 100%;
  }
}


/* Super-admin registered-user management */
.user-stat-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.compact-stat-card {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 90px;
  padding: 15px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
}

.compact-stat-card > i {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: rgba(11, 143, 138, .12);
  color: var(--teal);
  font-size: 1.1rem;
}

.compact-stat-card span,
.compact-stat-card strong {
  display: block;
}

.compact-stat-card span {
  color: var(--muted);
  font-size: .66rem;
}

.compact-stat-card strong {
  margin-top: 2px;
  font-size: 1.35rem;
}

.user-filter-panel {
  margin-bottom: 14px;
}

.user-filter-form {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr auto;
  gap: 12px;
  align-items: end;
}

.user-filter-form .field-group {
  margin: 0;
}

.user-filter-form select {
  min-height: 48px;
  border: 1px solid var(--line-strong);
  background: var(--surface-2);
  color: var(--text);
  border-radius: 10px;
  padding: 0 12px;
}

.user-filter-submit {
  min-height: 48px;
}

.user-management-table {
  min-width: 1120px;
}

.user-management-table th {
  color: var(--muted);
  font-size: .65rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  white-space: nowrap;
}

.user-cell {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-cell strong,
.user-cell span,
.user-cell small {
  display: block;
}

.user-cell span,
.user-cell small,
.table-subtext {
  color: var(--muted);
  font-size: .67rem;
}

.user-mini-avatar {
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--teal), var(--blue));
  color: #fff;
  font-weight: 800;
}

.role-badge,
.account-status,
.verification-state {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border-radius: 999px;
  padding: 5px 8px;
  font-size: .65rem;
  font-weight: 800;
  white-space: nowrap;
}

.role-badge {
  background: var(--surface-3);
  color: var(--text);
}

.account-status.active,
.verification-state.verified {
  background: rgba(22, 133, 93, .12);
  color: var(--green);
}

.account-status.pending {
  background: rgba(205, 121, 34, .13);
  color: var(--orange);
}

.account-status.locked {
  background: rgba(196, 75, 84, .13);
  color: var(--red);
}

.account-status.disabled {
  background: var(--surface-3);
  color: var(--muted);
}

.verification-state.unverified {
  background: rgba(205, 121, 34, .11);
  color: var(--orange);
}

.row-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.inline-delete-form {
  display: inline;
}

.icon-action {
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--text);
  display: inline-grid;
  place-items: center;
}

.icon-action.edit:hover {
  color: var(--teal);
  border-color: var(--teal);
}

.icon-action.delete:hover {
  color: #fff;
  background: var(--red);
  border-color: var(--red);
}

.user-verified-checkbox {
  margin-top: 6px;
}

html.theme-dark .compact-stat-card,
html.theme-dark .user-filter-panel {
  background: #0f1d27;
  border-color: #263b47;
}

@media (max-width: 1180px) {
  .user-stat-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .user-filter-form {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 680px) {
  .user-stat-grid {
    grid-template-columns: 1fr 1fr;
  }

  .user-filter-form {
    grid-template-columns: 1fr;
  }
}


.inline-role-form{margin:0}
.role-select{
  min-width:160px;height:36px;border:1px solid var(--line-strong);
  border-radius:8px;background:var(--surface-2);color:var(--text);
  padding:0 32px 0 10px;font-size:.68rem;font-weight:800;outline:none;
}
.role-select:hover,.role-select:focus{border-color:var(--teal)}
.role-select:focus{box-shadow:0 0 0 3px rgba(11,143,138,.1)}
.role-select:disabled{opacity:.65;cursor:wait}
html.theme-dark .role-select{background:#13242f;color:#e7eff4;border-color:#2b414e}

/* Temperature and humidity device module */
.th-context-bar { grid-template-columns: repeat(3, minmax(150px, 1fr)) minmax(260px, 1.35fr); }
.th-kpi-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.th-dashboard-grid { align-items: stretch; }
.th-trend-placeholder { position: relative; min-height: 300px; padding: 20px 18px 10px 52px; color: var(--orange); }
.th-trend-placeholder svg { width: 100%; height: 230px; overflow: visible; }
.th-trend-placeholder .chart-grid-line { fill: none; stroke: var(--line); stroke-width: 1; stroke-dasharray: 5 7; }
.th-trend-placeholder .temp-area { fill: url(#tempFill); color: var(--orange); }
.th-trend-placeholder .temp-line { fill: none; stroke: var(--orange); stroke-width: 3; stroke-linecap: round; }
.th-trend-placeholder .humidity-line { fill: none; stroke: var(--teal); stroke-width: 3; stroke-linecap: round; stroke-dasharray: 8 5; }
.trend-scale { position: absolute; left: 5px; top: 27px; bottom: 52px; display: flex; flex-direction: column; justify-content: space-between; color: var(--muted); font-size: .65rem; }
.trend-legend { display: flex; gap: 20px; justify-content: center; color: var(--muted); font-size: .72rem; }
.trend-legend span { display: inline-flex; align-items: center; gap: 7px; }
.trend-legend i { width: 22px; height: 3px; border-radius: 3px; display: inline-block; }
.legend-temp { background: var(--orange); }
.legend-humidity { background: var(--teal); }
.th-diagnostic-list, .th-threshold-list { display: flex; flex-direction: column; gap: 10px; }
.th-diagnostic-list > div, .th-threshold-list > div { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 13px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); }
.th-diagnostic-list span { color: var(--muted); font-size: .78rem; }
.th-diagnostic-list i { color: var(--teal); margin-right: 8px; }
.th-diagnostic-list strong { font-size: .78rem; }
.th-threshold-list span { flex: 1; color: var(--muted); font-size: .76rem; }
.th-threshold-list strong { font-size: .78rem; }
.th-threshold-list em { min-width: 62px; text-align: center; padding: 4px 7px; border-radius: 999px; background: rgba(205,121,34,.12); color: var(--orange); font-size: .62rem; font-style: normal; font-weight: 700; }
@media (max-width: 1100px) { .th-kpi-grid { grid-template-columns: repeat(2, minmax(0,1fr)); } .th-context-bar { grid-template-columns: repeat(2, minmax(0,1fr)); } }
@media (max-width: 720px) { .th-kpi-grid, .th-context-bar { grid-template-columns: 1fr; } .th-trend-placeholder { min-height: 250px; padding-left: 42px; } }

/* Device registration */
.device-create-layout{display:grid;grid-template-columns:minmax(0,1fr) 330px;gap:20px;align-items:start}
.device-create-main{padding:24px}.device-create-main .panel-header{margin-bottom:20px}
.device-type-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px}
.device-type-option{cursor:pointer}.device-type-option input{position:absolute;opacity:0;pointer-events:none}
.device-type-card{height:100%;min-height:128px;display:flex;flex-direction:column;gap:6px;padding:18px;border:1px solid var(--line-strong);border-radius:12px;background:var(--surface-2);transition:.18s}
.device-type-card>i{font-size:1.45rem;color:var(--teal)}.device-type-card strong{font-size:.82rem}.device-type-card small{color:var(--muted);line-height:1.45}
.device-type-option:hover .device-type-card{border-color:var(--teal);transform:translateY(-1px)}
.device-type-option input:checked+.device-type-card{border-color:var(--teal);background:rgba(11,143,138,.08);box-shadow:0 0 0 3px rgba(11,143,138,.10)}
.device-form-actions{display:flex;justify-content:flex-end;gap:10px;padding-top:22px;border-top:1px solid var(--line);margin-top:10px}
.device-create-aside{display:flex;flex-direction:column;gap:18px}.onboarding-info-card,.device-api-hint{padding:22px}
.onboarding-info-card h4{font-size:1rem;margin:5px 0 18px}.provision-step{display:flex;gap:12px;padding:13px 0;border-top:1px solid var(--line)}
.provision-step b{flex:0 0 31px;height:31px;border-radius:9px;display:grid;place-items:center;background:rgba(11,143,138,.11);color:var(--teal);font-size:.68rem}
.provision-step strong,.provision-step span{display:block}.provision-step strong{font-size:.74rem}.provision-step span{font-size:.66rem;color:var(--muted);line-height:1.45;margin-top:3px}
.device-api-hint>i{width:42px;height:42px;display:grid;place-items:center;border-radius:10px;background:rgba(23,111,168,.11);color:var(--blue);font-size:1.1rem}.device-api-hint h5{font-size:.84rem;margin:13px 0 6px}.device-api-hint p{font-size:.68rem;color:var(--muted);line-height:1.55;margin:0}
.credential-success{display:flex;gap:15px;padding:18px;margin-bottom:22px;border:1px solid rgba(22,133,93,.28);background:rgba(22,133,93,.08);border-radius:12px}
.credential-success-icon{width:46px;height:46px;display:grid;place-items:center;border-radius:11px;background:var(--green);color:#fff;font-size:1.25rem}.credential-success h4{font-size:1rem;margin:4px 0}.credential-success p{font-size:.7rem;color:var(--muted);margin-bottom:10px}
.credential-box{display:flex;align-items:center;gap:10px;padding:9px 10px;border:1px dashed rgba(22,133,93,.42);border-radius:9px;background:var(--surface);margin-bottom:8px}.credential-box code{overflow-wrap:anywhere;flex:1;color:var(--text);font-size:.71rem}
@media(max-width:1100px){.device-create-layout{grid-template-columns:1fr}.device-create-aside{display:grid;grid-template-columns:1fr 1fr}}
@media(max-width:720px){.device-type-grid,.device-create-aside{grid-template-columns:1fr}.device-create-main{padding:18px}.device-form-actions{flex-direction:column-reverse}.device-form-actions .btn{width:100%}}
