/* Shared visual layer. Device protocols, units and API contracts stay unchanged. */
:root {
  --ink: #182e32;
  --muted: #627579;
  --line: #dce5e5;
  --soft-line: #eaf0f0;
  --canvas: #f3f7f8;
  --sidebar: #ffffff;
  --sidebar-soft: #e9f3ef;
  --blue: #205d4f;
  --teal: #148b79;
  --green: #25916b;
  --amber: #d0a037;
  --red: #c64d5c;
  --radius: 6px;
  --shadow: none;
}
body { font-family: "Segoe UI", Arial, sans-serif; font-weight: 400; }
button, a, input, select { -webkit-tap-highlight-color: transparent; }
button, input, select { transition: border-color .15s, background-color .15s, box-shadow .15s; }
:focus-visible { outline: 3px solid #397fb1; outline-offset: 3px; }
input:focus, select:focus { border-color: #4d8e7e; box-shadow: 0 0 0 3px #dceee8; }
button:disabled { cursor: wait; opacity: .65; }
label, th, td, .eyebrow, .mini-button, .panel-chip, .user-pill, .sync-pill,
.primary-button, .detail-grid span, .stat-card span, .stat-card small { font-weight: 600; }
.brand-mark { background: #205d4f; border-radius: 6px; flex-shrink: 0; }
.eyebrow { font-size: 10px; color: var(--muted); }
.primary-button:hover:not(:disabled) { background: #17493e; }
.primary-button.secondary-action:hover:not(:disabled) { background: #dcece7; }
.secondary-action, .icon-button.soft { background: #eaf3ef; color: #205d4f; }

/* Authentication: a visual identity panel and an unframed working form. */
.login-screen { grid-template-columns: minmax(0, .95fr) minmax(0, 1.05fr); align-items: stretch; padding: 0; background: #fafcfc; }
.login-visual { width: 100%; min-width: 0; background: #173b3d; color: #f6faf9; display: flex; flex-direction: column; padding: 42px 48px 26px; }
.auth-wordmark { display: flex; align-items: center; gap: 12px; font-size: 15px; }
.auth-wordmark .brand-mark { background: #dce9b8; color: #163f35; width: 34px; height: 34px; }
.auth-intro { padding: 58px 0 30px; }
.auth-intro .eyebrow { color: #b5d5c8; font-size: 12px; margin-bottom: 16px; text-transform: none; }
.auth-intro h1 { font-size: 42px; font-weight: 600; line-height: 1.15; overflow-wrap: anywhere; }
.auth-intro > p:last-child { color: #d1e3de; font-size: 19px; margin: 12px 0 0; }
.auth-photo { margin: 0; flex: 1; min-height: 230px; position: relative; overflow: hidden; }
.auth-photo img { width: 100%; height: 100%; position: absolute; inset: 0; object-fit: cover; object-position: center 60%; }
.auth-photo figcaption { position: absolute; bottom: 0; left: 0; padding: 10px 16px; color: #173b3d; background: #edf4e2; font-size: 12px; }
.auth-visual-footer { display: flex; align-items: center; justify-content: space-between; border-top: 1px solid #426061; color: #b8cfca; padding-top: 18px; margin-top: 24px; font-size: 12px; }
.auth-visual-footer svg { width: 18px; height: 18px; color: #dce9b8; }
.login-form-area { min-height: 100svh; width: 100%; min-width: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 60px 48px 24px; }
.login-card { width: min(100%, 424px); background: transparent; padding: 0; border: 0; border-radius: 0; box-shadow: none; margin: auto 0; }
.login-brand { display: none; }
.login-copy { margin-bottom: 34px; }
.login-copy .eyebrow { display: flex; align-items: center; gap: 7px; color: #62756b; text-transform: none; font-size: 12px; margin-bottom: 24px; }
.login-copy .eyebrow svg { width: 15px; height: 15px; }
.login-copy h2 { font-size: 34px; line-height: 1.2; font-weight: 600; margin: 0 0 12px; }
.login-copy p:not(.eyebrow) { font-size: 14px; line-height: 1.6; }
.login-card label { color: #354e52; font-size: 13px; margin-bottom: 20px; gap: 9px; }
.auth-input { display: flex; align-items: center; position: relative; }
.auth-input > svg { position: absolute; left: 16px; height: 17px; width: 17px; color: #82918e; pointer-events: none; }
.auth-input input { min-height: 54px; padding: 0 46px 0 45px; font-size: 14px; font-weight: 400; background: #fff; }
.auth-input input::placeholder { color: #7b8c8f; opacity: 1; }
.password-toggle { position: absolute; right: 5px; width: 40px; height: 40px; padding: 0; display: grid; place-items: center; border: 0; border-radius: 4px; color: #627974; background: transparent; }
.password-toggle:hover { background: #edf4f0; }
.password-toggle svg { width: 18px; height: 18px; }
.login-error { font-size: 13px; font-weight: 500; line-height: 1.5; overflow-wrap: anywhere; margin-bottom: 15px; }
.login-error:empty { min-height: 0; margin-bottom: 10px; }
.login-button { min-height: 52px; font-size: 14px; gap: 14px; }
.login-card .text-button { min-height: 42px; font-weight: 600; font-size: 13px; margin-top: 10px; }
.login-card .text-button:hover { text-decoration: underline; }
.login-help { margin-top: 18px; text-align: center; font-size: 12px; color: #617570; }
.login-help summary { cursor: pointer; text-decoration: underline; text-underline-offset: 4px; list-style: none; padding: 8px; }
.login-help summary::-webkit-details-marker { display: none; }
.login-help p { text-align: left; margin: 10px 0 0; padding: 12px 0; line-height: 1.65; }
.auth-access-note { display: flex; justify-content: center; align-items: center; gap: 7px; border-top: 1px solid var(--line); padding-top: 22px; margin: 30px 0 0; color: var(--muted); font-size: 11px; }
.auth-access-note svg { width: 14px; height: 14px; flex-shrink: 0; }
.auth-footer { font-size: 11px; color: #7a8988; padding-top: 44px; text-align: center; }
.auth-footer span { padding: 0 8px; }

/* Work surfaces use restrained separators, not floating section cards. */
.app-shell { grid-template-columns: 226px minmax(0, 1fr); }
.sidebar { border-right: 1px solid var(--line); padding: 28px 16px; color: var(--ink); gap: 36px; }
.brand { gap: 10px; }
.brand strong { font-size: 15px; font-weight: 650; }
.brand span { font-size: 11px; color: var(--muted); margin-top: 3px; }
.nav-list { gap: 6px; }
.nav-item { min-height: 44px; color: #647575; font-weight: 500; border-left: 3px solid transparent; }
.nav-item:hover { background: #f0f5f3; color: #205d4f; }
.nav-item.active { border-left-color: #2b7f69; background: #eaf3ef; color: #205d4f; font-weight: 600; }
.side-status { border: 0; border-top: 1px solid var(--line); border-radius: 0; background: transparent; padding: 22px 5px 0; gap: 14px; }
.side-status span { color: var(--muted); overflow-wrap: anywhere; }
.side-status strong { font-size: 12px; font-weight: 600; }
.status-dot { box-shadow: none; width: 7px; height: 7px; }
.status-dot.online, .status-dot.offline { box-shadow: none; }
.workspace { padding: 26px 32px; min-width: 0; background: #f4f7f8; }
.topbar { padding: 0 0 22px; margin-bottom: 22px; border-bottom: 1px solid var(--line); gap: 20px; }
.topbar h1 { font-size: 26px; line-height: 1.25; font-weight: 600; overflow-wrap: anywhere; }
.topbar .eyebrow { margin-bottom: 6px; }
.user-pill { background: #fff; color: #35524b; font-weight: 600; }
.sync-pill { border: 0; background: transparent; font-weight: 400; max-width: 100%; overflow-wrap: anywhere; }
.top-actions { gap: 8px; }
.icon-button { background: #fff; border: 1px solid var(--line); color: #496460; flex-shrink: 0; }
.icon-button:hover { background: #eaf3ef; border-color: #8eafa3; }
.view-stack { gap: 24px; }
.summary-band { padding: 0 0 18px; background: transparent; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; min-height: 70px; }
.summary-band h2 { font-size: 19px; font-weight: 600; margin-bottom: 7px; }
.summary-band p:not(.eyebrow) { font-size: 13px; }
.panel { background: transparent; border: 0; border-radius: 0; box-shadow: none; padding: 4px 0 24px; border-bottom: 1px solid var(--line); }
.panel-heading { padding-bottom: 14px; border-bottom: 1px solid var(--soft-line); margin-bottom: 18px; }
.panel-heading h2 { font-size: 17px; font-weight: 600; line-height: 1.4; overflow-wrap: anywhere; }
.panel-heading p:not(.eyebrow) { color: var(--muted); font-size: 12px; margin: 6px 0 0; overflow-wrap: anywhere; }
.panel-actions { min-width: 0; max-width: 100%; }
.panel-actions select { max-width: 100%; }
.panel-chip { background: #e7f3ec; color: #227456; font-weight: 600; white-space: normal; text-align: center; padding: 4px 10px; }
.panel-chip[data-tone="unknown"] { background: #faf1da; color: #80601f; }
.panel-chip[data-tone="offline"] { background: #e8ecef; color: #57656b; }
.panel-chip[data-tone="danger"] { background: #fdebee; color: #9c3442; }
.stat-grid { gap: 14px; }
.stat-card { min-height: 112px; border: 0; border-left: 1px solid var(--line); border-radius: 0; background: transparent; box-shadow: none; gap: 8px; padding: 16px; }
.stat-card > span { display: flex; align-items: center; gap: 8px; font-size: 12px; }
.stat-card > span svg { width: 16px; height: 16px; flex-shrink: 0; color: var(--muted); }
.stat-card strong { font-weight: 600; font-size: 28px; }
.stat-card small { font-size: 11px; font-weight: 400; }
.stat-card:first-child { border-top: 2px solid #4089b1; }
.stat-card.good { border-top: 2px solid #25916b; }
.stat-card.warn { border-top: 2px solid #d0a037; }
.stat-card.danger { border-top: 2px solid #c64d5c; }
.live-site-panel { border-left: 0; }
.live-status-item, .detail-grid > div, .parameter-row { background: transparent; border: 0; border-bottom: 1px solid var(--soft-line); border-radius: 0; padding: 12px 8px; }
.live-status-item { border-left: 2px solid #b7c6c7; }
.live-status-item span, .parameter-label, .detail-grid span { font-weight: 500; font-size: 12px; }
.live-status-item strong, .detail-grid strong { font-weight: 600; }
th { background: #f7f9f9; color: #6a7e80; font-weight: 600; font-size: 11px; }
td { font-weight: 400; padding: 14px 10px; }
td strong { font-weight: 600; }
td span { font-weight: 400; }
tbody tr:hover { background: #f5f9f7; }
.selected-row { background: #edf5f2; }
.row-status { font-weight: 600; font-size: 11px; }
.customer-overview { background: #edf5fa; padding: 24px; border: 0; }
.customer-overview .panel-heading { border-bottom-color: #dce7ec; }
.customer-overview .active-alert-strip { padding: 10px 12px; border-left: 3px solid #c69a39; background: #fcf8ed; color: #795e29; font-size: 12px; margin: 0 0 20px; }
.customer-overview .active-alert-strip[data-tone="good"] { background: #e6f2ec; border-left-color: #369275; color: #28614d; }
.customer-overview .active-alert-strip[data-tone="danger"] { background: #fff0f0; border-left-color: #c64d5c; color: #9c3442; }
.power-flow { margin: 24px auto 32px; max-width: 840px; gap: 24px 40px; grid-template-columns: minmax(0, 1fr) minmax(0, .9fr) minmax(0, 1fr); grid-template-rows: repeat(2, 140px); grid-template-areas: "solar inverter grid" "battery inverter load"; }
.power-flow:empty { display: none; }
.flow-tile { min-height: 140px; padding: 20px; gap: 18px; border-color: #d5e3e9; color: #62777e; position: relative; justify-content: center; align-items: flex-start; text-align: left; }
.flow-label { display: flex; align-items: center; gap: 10px; min-width: 0; }
.flow-tile svg { color: #517b89; width: 26px; height: 26px; }
.flow-tile strong { font-size: 23px; font-weight: 600; color: #203d48; line-height: 1.25; }
.flow-tile span { font-size: 12px; }
.flow-tile.solar svg { color: #b28927; }
.flow-tile.battery svg { color: #21896e; }
.flow-tile.load svg { color: #4786ad; }
.flow-tile.inverter { background: #205d4f; border-color: #205d4f; color: #c8e3db; align-self: center; align-items: center; text-align: center; min-height: 172px; }
.flow-tile.inverter .flow-label { flex-direction: column; }
.flow-tile.inverter svg { width: 36px; height: 36px; }
.flow-tile.inverter strong, .flow-tile.inverter svg { color: #fff; }
.flow-active { border-color: #6da993; box-shadow: inset 0 2px #4a9a7b; }
.customer-tabs { margin-top: 20px; gap: 24px; border-top: 1px solid #dce7ec; justify-content: center; }
.customer-tabs button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; border-radius: 0; background: transparent; border-bottom: 2px solid transparent; padding: 10px 4px; color: #657b80; min-height: 44px; }
.customer-tabs svg { width: 16px; height: 16px; }
.customer-tabs button[aria-current="page"] { color: #205d4f; border-bottom-color: #205d4f; font-weight: 600; }
.empty-state { color: var(--muted); padding: 36px 16px; line-height: 1.6; }
.power-summary-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 32px; margin: 20px 0; }
.power-source { min-width: 0; }
.power-source h3 { margin: 0 0 10px; padding-bottom: 12px; border-bottom: 2px solid #75a2b8; font-size: 15px; font-weight: 600; }
.power-source:nth-child(2) h3 { border-bottom-color: #c9a44f; }
.power-metrics { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 20px; }
.power-metric { display: flex; flex-direction: column; gap: 8px; padding: 16px 0; border-bottom: 1px solid var(--line); min-width: 0; }
.power-metric > span { font-size: 12px; color: var(--muted); }
.power-metric strong { font-size: 17px; font-weight: 600; line-height: 1.4; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.power-metric small, .power-quality { font-size: 11px; color: #637981; line-height: 1.6; }
.power-quality { margin: 10px 0 18px; }
.power-source-heading { position: relative; }
.power-source-heading h3 { padding-right: 36px; }
.power-info { position: absolute; right: 0; top: -7px; z-index: 2; }
.power-info summary { display: flex; align-items: center; justify-content: center; width: 32px; height: 32px; cursor: pointer; color: var(--muted); list-style: none; border-radius: 4px; }
.power-info summary::-webkit-details-marker { display: none; }
.power-info summary:hover, .power-info summary:focus-visible { color: #164d5b; background: #e6f0f4; }
.power-info summary:focus-visible { outline: 2px solid #42778d; outline-offset: 2px; }
.power-info summary svg { width: 17px; height: 17px; }
.power-info-tip { position: absolute; right: 0; top: 36px; width: min(280px,calc(100vw - 72px)); box-sizing: border-box; padding: 12px 14px; border: 1px solid var(--line); border-radius: 6px; background: #fff; box-shadow: 0 6px 20px #12343c1a; color: #455e67; font-size: 12px; font-weight: 400; line-height: 1.6; }
.power-info-tip p { margin: 0; }
.power-info-tip p + p { margin-top: 10px; }
#powerSessions table { min-width: 0; }
#powerSessions td { white-space: normal; overflow-wrap: anywhere; }
#powerSessions th { white-space: normal; }
#powerSessions td small { display: block; font-size: 11px; color: var(--muted); margin-top: 6px; }
.runtime-heading { position: relative; margin: 20px 0 8px; padding-right: 40px; }
.runtime-heading h3 { margin: 0 0 6px; font-size: 16px; }
.runtime-heading h3 span, .runtime-coverage { color: var(--muted); font-size: 12px; font-weight: 400; }
.runtime-metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0 24px; }
.runtime-battery_only strong { color: #227354; }
.runtime-solar_charging strong, .runtime-solar_not_charging strong { color: #896914; }
.history-controls .history-date { width: 160px; min-width: 0; }
@media (max-width: 1100px) {
  .runtime-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 420px) {
  #powerSessions table tbody td[data-label] { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
}
.section-toolbar { display: flex; justify-content: space-between; gap: 16px; align-items: center; }
.section-toolbar h3 { font-size: 13px; font-weight: 600; margin: 0; color: #526e7a; }
#customerDeviceMeta { display: flex; flex-wrap: wrap; gap: 6px 16px; }
#customerDeviceMeta span { font-variant-numeric: tabular-nums; }
.mini-button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; font-size: 12px; min-height: 36px; border-radius: 5px; }
.mini-button svg { width: 15px; height: 15px; flex-shrink: 0; }
.live-status-grid { gap: 20px 24px; }
.live-status-item { padding: 8px 14px; min-height: 70px; }
.live-status-item strong { font-size: 20px; font-variant-numeric: tabular-nums; }
.table-wrap { background: #fff; border: 1px solid var(--line); border-radius: 6px; }
th { padding: 13px 12px; border-bottom: 1px solid var(--line); }
td { padding: 16px 12px; font-size: 13px; font-variant-numeric: tabular-nums; }
tbody tr:last-child td { border-bottom: 0; }
.selected-row { box-shadow: inset 3px 0 #4a8c78; }
.row-status { border-radius: 4px; line-height: 1.5; }
.detail-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0 24px; }
.detail-grid > div { padding: 16px 0; }
.detail-grid > .detail-wide { padding: 28px 0 0; border: 0; }
.detail-grid strong { font-size: 14px; }
.parameter-board { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px 36px; }
.parameter-heading { grid-column: 1 / -1; padding: 0 0 14px; margin: 0; flex-wrap: wrap; }
.parameter-heading > span { color: var(--ink); font-size: 15px; font-weight: 600; }
.parameter-heading > strong { font-size: 12px; font-weight: 500; color: var(--muted); }
.parameter-section { align-content: start; gap: 6px; }
.parameter-section h3 { font-size: 13px; font-weight: 600; color: #255d72; padding-bottom: 6px; }
.parameter-list { grid-template-columns: minmax(0, 1fr); gap: 0; }
.parameter-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 42px; padding: 10px 0; }
.parameter-row strong { font-size: 13px; text-align: right; font-variant-numeric: tabular-nums; }
.device-add-form { grid-template-columns: minmax(200px, 1.4fr) minmax(140px, 1fr) minmax(120px, .8fr) auto; gap: 18px; }
.device-id-field { display: flex; gap: 8px; align-items: flex-end; min-width: 0; }
.device-id-field label { min-width: 0; flex: 1; }
.device-id-field .icon-button { width: 42px; height: 42px; }
#deviceQrVideo { grid-column: 1 / -1; max-width: 100%; width: 320px; }
.workspace label { font-size: 12px; gap: 8px; }
.workspace input, .workspace select { font-size: 13px; font-weight: 400; min-height: 42px; }
.workspace .primary-button { min-height: 42px; font-size: 12px; }
.setup-steps { border: 0; border-top: 1px solid var(--line); border-radius: 0; background: transparent; padding: 24px 0 0; margin-top: 24px; }
.setup-steps h3 { display: flex; align-items: center; gap: 9px; margin: 0; font-size: 15px; font-weight: 600; }
.setup-steps h3 svg { width: 20px; height: 20px; color: #2c7f73; }
.setup-steps p { font-size: 13px; line-height: 1.6; color: var(--muted); }
#wifiSetupForm { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; margin: 20px 0 16px; }
#wifiSetupStatus { display: inline-block; margin: 12px 0; font-size: 13px; }
#reconfigureWifi { margin-top: 24px; }
.settings-grid { max-width: 900px; grid-template-columns: minmax(0, 1fr) 180px auto; gap: 20px; }
.settings-note { border: 0; border-left: 3px solid #80a9b8; border-radius: 0; background: #eaf2f7; color: #416270; font-size: 13px; padding: 14px 18px; margin-top: 24px; }
.history-controls { gap: 10px; }
.history-summary { grid-template-columns: repeat(3, minmax(0, 1fr)); border: 0; background: transparent; gap: 0 24px; margin: 8px 0 28px; }
.history-summary > div { background: transparent; border-bottom: 1px solid var(--line); padding: 16px 0; }
.history-summary span { font-size: 12px; font-weight: 500; color: var(--muted); }
.history-summary strong { font-size: 23px; font-weight: 600; font-variant-numeric: tabular-nums; }
.history-summary .history-loading { grid-column: 1 / -1; }
.chart-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 28px; }
.chart-section { min-width: 0; background: transparent; border-top: 1px solid var(--line); padding-top: 18px; }
.chart-section h3 { display: flex; gap: 8px; align-items: center; font-size: 13px; font-weight: 600; margin: 0 0 14px; }
.chart-section h3 svg { width: 17px; height: 17px; color: #467c8a; }
.chart-section h3 span { margin-left: auto; font-size: 11px; font-weight: 500; color: var(--muted); }
.chart-box { border: 0; border-radius: 0; background: transparent; min-height: 300px; min-width: 0; width: 100%; overflow: hidden; }
.fault-item { border: 0; border-left: 3px solid #c59530; border-radius: 0; padding: 16px; background: #fff8e8; gap: 8px; }
.fault-item.danger, .fault-item.critical { border-left-color: #c64d5c; background: #fff0f0; }
.fault-item strong { font-size: 14px; font-weight: 600; }
.fault-item span { font-weight: 400; line-height: 1.5; }
.edit-dialog { border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 20px 80px #122d3030; }
.edit-dialog::backdrop { background: #112d3766; }
.edit-card { padding: 24px; }
.edit-card label { font-size: 12px; font-weight: 500; }
.edit-card input, .edit-card select { font-weight: 400; }
.login-screen, .workspace { overflow-wrap: break-word; }
@media (min-width: 761px) {
  .sidebar { position: sticky; top: 0; height: 100vh; overflow-y: auto; }
  .sidebar .brand > div:not(.brand-mark), .sidebar .side-status > div { display: block; }
  .sidebar .nav-item span { display: inline; }
  .sidebar .brand, .sidebar .nav-item, .sidebar .side-status { justify-content: flex-start; }
}
@media (max-width: 1100px) {
  .power-summary-grid { grid-template-columns: minmax(0, 1fr); gap: 24px; }
  .login-visual { padding: 32px 30px 24px; }
  .auth-intro h1 { font-size: 35px; }
  .auth-intro { padding-top: 48px; }
  .login-form-area { padding: 42px 30px 24px; }
  .workspace { padding: 22px 20px; }
  .app-shell { grid-template-columns: 194px minmax(0, 1fr); }
  .topbar { align-items: flex-start; flex-wrap: wrap; }
  .top-actions { justify-content: flex-start; }
  .stat-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .device-add-form, .oem-form, #wifiSetupForm { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .device-add-form > button, .oem-form > button { justify-self: start; }
  .chart-grid { grid-template-columns: minmax(0, 1fr); }
  .detail-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .power-flow { gap: 20px; }
  .flow-tile { padding: 14px; }
  .flow-tile strong { font-size: 20px; }
  .flow-label { flex-wrap: wrap; }
  .table-wrap { overflow: visible; border: 0; border-radius: 0; background: transparent; }
  table { min-width: 0; }
  table thead { display: none; }
  table tbody, table tr, table td { display: block; width: 100%; }
  table tbody tr { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 20px; padding: 14px; border: 1px solid var(--line); border-radius: 6px; background: #fff; margin-bottom: 12px; }
  table tbody td[data-label] { min-width: 0; display: grid; grid-template-columns: 80px minmax(0, 1fr); align-items: start; gap: 10px; padding: 8px 0; border: 0; white-space: normal; }
  table tbody td[data-label]::before { content: attr(data-label); color: var(--muted); font-size: 11px; font-weight: 500; }
  table tbody td[colspan] { grid-column: 1 / -1; border: 0; white-space: normal; }
  table td strong, table td span { min-width: 0; overflow-wrap: anywhere; }
  .table-select { width: 100%; min-width: 0; }
  .row-actions .action-buttons { min-width: 0; justify-content: flex-start; }
}
@media (max-width: 760px) {
  .power-metrics { gap: 0 16px; }
  .power-metric strong { font-size: 15px; }
  #powerSessions td:nth-child(2), #powerSessions td:nth-child(3) { min-width: 0; }
  .login-screen { display: block; }
  .login-visual { padding: 24px; min-height: 194px; position: relative; background: #173b3d; }
  .auth-wordmark { position: relative; z-index: 1; }
  .auth-intro { padding: 24px 0 0; position: relative; z-index: 1; max-width: 72%; }
  .auth-intro h1 { font-size: 25px; }
  .auth-intro .eyebrow, .auth-visual-footer, .auth-photo figcaption { display: none; }
  .auth-intro > p:last-child { font-size: 12px; }
  .auth-photo { position: absolute; right: 0; top: 0; bottom: 0; width: 25%; min-height: 0; }
  .login-form-area { min-height: 0; padding: 32px 24px 24px; }
  .login-card { margin: 0; }
  .login-copy { margin-bottom: 24px; }
  .login-copy .eyebrow { margin-bottom: 16px; }
  .login-copy h2 { font-size: 28px; }
  .auth-footer { padding-top: 32px; }
  .app-shell { display: block; }
  .sidebar { position: sticky; padding: 6px 8px; border-right: 0; border-bottom: 1px solid var(--line); gap: 0; background: #fff; }
  .nav-list { width: 100%; display: flex; justify-content: space-between; gap: 0; }
  .nav-item { min-width: 0; flex: 1 1 0; width: auto; min-height: 53px; padding: 6px 1px; border-left: 0; border-radius: 0; gap: 5px; }
  .nav-item.active { border-left: 0; border-bottom-color: #2b7f69; }
  .nav-item span { font-size: 10px; line-height: 1.2; }
  .workspace { padding: 20px 14px; }
  .topbar { gap: 14px; padding-bottom: 16px; margin-bottom: 16px; }
  .topbar h1 { font-size: 24px; }
  .top-actions { width: 100%; gap: 6px; }
  .sync-pill { order: 5; width: 100%; padding: 4px 0 0; min-height: 24px; font-size: 11px; }
  .user-pill { margin-right: auto; max-width: calc(100% - 140px); font-size: 11px; overflow-wrap: anywhere; }
  .panel { padding: 0 0 20px; }
  .customer-overview { padding: 18px 12px; }
  .panel-heading { gap: 12px; }
  .panel-actions { width: 100%; justify-content: flex-start; }
  .panel-actions select { flex: 1 1 160px; min-width: 0; }
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .stat-card { padding: 13px; min-height: 102px; }
  .flow-tile { padding: 14px; min-height: 120px; }
  .flow-tile strong { font-size: 20px; }
  .power-flow { gap: 14px; grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-rows: auto; grid-template-areas: "solar grid" "inverter inverter" "battery load"; }
  .flow-tile { align-items: flex-start; }
  .flow-tile.inverter { flex-direction: row; align-items: center; gap: 12px; min-height: 82px; }
  .flow-tile.inverter .flow-label { flex-direction: row; }
  .flow-tile.inverter svg { width: 26px; height: 26px; }
  .flow-tile.inverter strong { margin-left: auto; text-align: right; }
  .customer-tabs { gap: 14px; }
  .customer-tabs button { font-size: 12px; gap: 6px; }
  .view-stack { gap: 18px; }
  .summary-band { gap: 14px; }
  .history-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; }
  .history-summary strong { font-size: 20px; }
  .device-add-form, .oem-form, #wifiSetupForm, .settings-grid { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .parameter-board { grid-template-columns: minmax(0, 1fr); }
  .parameter-heading { align-items: flex-start; flex-direction: column; }
  .detail-grid { gap: 0 16px; }
  .detail-grid strong { font-size: 13px; }
  .table-wrap { border: 0; border-radius: 0; background: transparent; }
  table tbody tr { grid-template-columns: minmax(0, 1fr); padding: 14px 12px; border: 1px solid var(--line); border-radius: 6px; background: #fff; margin-bottom: 12px; }
  table tbody td[data-label]::before { font-weight: 500; }
  .live-status-grid { gap: 14px; }
  .section-toolbar { gap: 8px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}
/* Margsoft parameter monitoring uses the existing server-scoped device history. */
.parameter-indicators { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; padding: 20px 0; }
.parameter-indicator { display: flex; align-items: center; gap: 14px; min-height: 90px; width: 100%; padding: 16px; text-align: left; color: #19373d; background: #fff; border: 1px solid #cedee6; border-radius: 8px; cursor: pointer; font: inherit; }
.parameter-indicator:hover, .parameter-indicator:focus-visible { border-color: #247a69; outline: 2px solid #a4d7cd; outline-offset: 2px; }
.parameter-indicator > span:last-child { min-width: 0; overflow-wrap: anywhere; }
.parameter-indicator small { display: block; color: #536d76; margin-top: 6px; font-size: 12px; }
.parameter-led { display: block; flex: 0 0 20px; width: 20px; height: 20px; border-radius: 50%; background: #3a4b51; border: 2px solid #263a40; }
.parameter-led[data-state="on"] { background: #20d76a; border-color: #169446; box-shadow: 0 0 10px #20d76a80; }
.parameter-led[data-state="alarm"] { background: #ed4545; border-color: #a32525; box-shadow: 0 0 10px #ed454580; }
.parameter-led[data-state="unknown"] { background: #c9d1d7; border-color: #87959b; }
.parameter-report { border-bottom: 1px solid #cedee6; padding-bottom: 24px; margin-bottom: 24px; min-width: 0; }
.parameter-report h3 { font-size: 16px; margin: 18px 0; }
.parameter-totals { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin: 20px 0; }
.parameter-totals span { display: block; color: #536d76; font-size: 12px; }
.parameter-totals strong { display: block; font-size: 18px; margin-top: 8px; }
.parameter-report .chart-box { height: 300px; width: 100%; min-width: 0; }
.parameter-report .table-select { max-width: 100%; min-width: 0; }
@media (max-width: 900px) { .parameter-indicators, .parameter-totals { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 420px) { .parameter-indicator { padding: 12px; gap: 9px; font-size: 13px; min-height: 110px; } .parameter-led { flex-basis: 16px; width: 16px; height: 16px; } .parameter-totals strong { font-size: 15px; } }

/* Motion reflects received telemetry or a real request, never inferred power flow. */
.customer-overview { border-top: 3px solid #4489a1; background: #eef6fb; }
.power-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.power-toolbar h3 { margin-right: auto; }
.telemetry-clock { display: inline-flex; align-items: center; gap: 8px; color: #6c7d86; font-size: 12px; min-height: 24px; font-variant-numeric: tabular-nums; }
.telemetry-dot { flex: 0 0 7px; height: 7px; border-radius: 50%; background: #929fa6; }
.telemetry-clock[data-fresh="true"] { color: #237459; }
.telemetry-clock[data-fresh="true"] .telemetry-dot { background: #26a878; animation: telemetry-pulse 2.4s ease-in-out infinite; }
.power-flow { grid-template-rows: repeat(2, 164px); gap: 24px 36px; max-width: 920px; }
.flow-tile { --signal: #367eab; min-height: 164px; gap: 10px; border-radius: 8px; border-top: 3px solid #d6e1e7; background: #fff; transition: transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease; }
.flow-tile.solar { --signal: #b58621; }
.flow-tile.battery { --signal: #26856d; }
.flow-tile.load { --signal: #4478b5; }
.flow-tile:hover { transform: translateY(-2px); box-shadow: 0 7px 18px #264b6012; }
.flow-label { width: 100%; gap: 8px; }
.flow-label > svg { flex-shrink: 0; }
.flow-label > span:not(.flow-presence) { overflow-wrap: anywhere; }
.flow-presence { width: 6px; height: 6px; flex: 0 0 6px; border-radius: 50%; background: #c8d4da; margin-left: auto; }
.flow-tile strong { font-size: 26px; font-variant-numeric: tabular-nums; border-radius: 4px; }
.flow-detail { color: #657b86; font-size: 11px; line-height: 1.4; min-height: 16px; font-variant-numeric: tabular-nums; }
.flow-active { border-top-color: var(--signal); box-shadow: none; }
.flow-active .flow-presence { background: var(--signal); animation: telemetry-pulse 2.4s ease-in-out infinite; }
.flow-tile.inverter { min-height: 196px; background: #214d53; border-color: #214d53; box-shadow: 0 8px 18px #214d531a; }
.flow-tile.inverter .flow-presence { display: none; }
.flow-tile.inverter .flow-label { width: auto; }
.customer-overview[data-fresh="false"] .flow-tile { border-top-color: #c5d0d6; }
.customer-overview[data-fresh="false"] .flow-tile.inverter { background: #52656e; border-color: #52656e; }
.parameter-indicator { border-top: 3px solid #d6e1e7; transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease; }
.parameter-indicator:hover { transform: translateY(-2px); box-shadow: 0 5px 16px #264b6012; }
.parameter-indicator[data-tone="on"] { border-top-color: #2b9a70; background: #f8fdfa; }
.parameter-indicator[data-tone="alarm"] { border-top-color: #d44b4b; background: #fff8f8; }
.parameter-led[data-state="on"], .parameter-led[data-state="alarm"] { animation: telemetry-pulse 2.4s ease-in-out infinite; }
.reading-updated { animation: reading-highlight 1.4s ease-out; }
#refreshButton[aria-busy="true"] svg { animation: request-spin 1s linear infinite; }
.view-panel:not([hidden]) { animation: view-arrive 200ms ease-out; }
.customer-tabs button { transition: color 160ms ease, background-color 160ms ease; }
.customer-tabs button:hover { background: #dcecebaa; }
@keyframes telemetry-pulse { 0%, 100% { opacity: 1; } 50% { opacity: .5; } }
@keyframes reading-highlight { from { background-color: #bee8d6; } to { background-color: transparent; } }
@keyframes request-spin { to { transform: rotate(360deg); } }
@keyframes view-arrive { from { opacity: .65; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }
@media (max-width: 600px) {
  .power-flow { grid-template-rows: auto; gap: 14px; }
  .flow-tile { min-height: 148px; padding: 12px; }
  .flow-tile strong { font-size: 22px; }
  .flow-tile.inverter { min-height: 92px; }
  .flow-presence { display: none; }
  .telemetry-clock { font-size: 11px; }
}
