:root {
  color-scheme: light;
  font-family: "Segoe UI", system-ui, sans-serif;
  color: #10243a;
  background: #eef2f7;
  --ink: #10243a;
  --muted: #475970;
  --line: #ccd7e3;
  --surface: #fff;
  --teal: #16655c;
  --amber: #f8cb78;
}

* { box-sizing: border-box; }
body { margin: 0; }
[hidden] { display: none !important; }
a { color: inherit; }
h1, h2, h3, p, dl, dd { margin: 0; }
button, input, select { font: inherit; }
button, select { cursor: pointer; }
button:disabled, select:disabled { cursor: default; opacity: .65; }
:focus-visible { outline: 3px solid #ac650c; outline-offset: 3px; }
.skip { position: fixed; z-index: 2; left: 1rem; top: -5rem; padding: .7rem; background: white; }
.skip:focus { top: 1rem; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

.masthead { background: var(--ink); color: white; }
.masthead-inner, main { width: min(100%, 85rem); margin-inline: auto; padding-inline: clamp(1rem, 4vw, 3.25rem); }
.masthead-inner { display: flex; gap: .7rem 2rem; flex-wrap: wrap; justify-content: space-between; align-items: center; min-height: 4.25rem; }
.brand { display: flex; align-items: center; gap: .7rem; text-decoration: none; }
.brand strong, .brand small { display: block; }
.brand strong { font-size: 1.1rem; }
.brand small { color: #bed2d8; font-size: .875rem; }
.brand-mark { display: grid; place-items: center; border: 1px solid #587882; border-radius: .45rem; color: var(--amber); width: 2.25rem; height: 2.25rem; font-size: 1.65rem; line-height: 1; }
.navigation { display: flex; flex-wrap: wrap; align-items: stretch; gap: 0 .45rem; }
.navigation a { display: block; padding: .9rem .7rem; text-decoration: none; color: #dbe8eb; border-bottom: 2px solid transparent; font-weight: 600; }
.navigation a:hover { background: #24414e; }
.navigation a[aria-current="page"] { border-color: var(--amber); color: white; }

main { padding-block: clamp(1.4rem, 3vw, 2.7rem) 3rem; }
.page-head { display: flex; flex-wrap: wrap; gap: 1.1rem 2rem; align-items: end; justify-content: space-between; margin-bottom: 1.4rem; }
h1 { font-size: clamp(2.1rem, 4.5vw, 3.6rem); letter-spacing: -.055em; line-height: 1.06; }
.page-head p, .access p { color: var(--muted); line-height: 1.5; margin-top: .55rem; }
.monitor-controls, .inline-form { display: flex; flex-wrap: wrap; align-items: center; gap: .55rem; }
.monitor-controls label { color: var(--muted); font-weight: 600; }
input, select, button { min-height: 2.65rem; border-radius: .35rem; padding: .5rem .8rem; border: 1px solid #95aeb7; max-width: 100%; }
input, select { background: #fff; color: var(--ink); min-width: 0; }
button { background: var(--ink); border-color: var(--ink); color: white; font-weight: 650; }
button:hover:not(:disabled) { background: #254857; }
.secondary { background: #fff; color: var(--ink); border-color: #95aeb7; }
.secondary:hover:not(:disabled) { background: #eaf5f6; }
.text-button { background: none; color: var(--teal); border: 0; text-decoration: underline; align-self: center; }
.text-button:hover:not(:disabled) { background: #dce9eb; }

.access { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1rem 1.75rem; padding: 1rem 1.15rem; border: 1px solid var(--line); border-left: 4px solid #ae750e; border-radius: .45rem; background: #fffaf0; margin-bottom: 1rem; }
.access h2 { font-size: 1.1rem; }
.access p { margin-top: .28rem; }
.notice { padding: .7rem 1rem; margin-block: 1rem; border: 1px solid var(--line); background: white; }
.sample-status { margin-block: 0 1.1rem; border: 1px solid var(--line); border-radius: .55rem; background: var(--surface); }
.sample-summary { display: flex; justify-content: space-between; align-items: center; gap: .65rem 1rem; padding: .8rem 1rem; }
.sample-state { border-left: 3px solid currentColor; padding-left: .65rem; }
.sample-state strong { display: block; }
.sample-state p { max-width: 52ch; margin-top: .3rem; color: var(--muted); line-height: 1.45; }
.sample-meta { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .65rem 1.25rem; padding: .85rem 1rem; border-top: 1px solid var(--line); background: #f7f9fc; border-radius: 0 0 .55rem .55rem; }
.sample-meta dt { color: var(--muted); font-size: .875rem; }
.sample-meta dd { margin-top: .2rem; font-size: .95rem; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
[data-tone="neutral"] { color: var(--muted); }
[data-tone="good"] { color: #125c48; }
[data-tone="warn"] { color: #844800; }
[data-tone="error"] { color: #982235; }

.system-map {
  --connector: #63849d;
  background-color: var(--ink);
  background-image: linear-gradient(#ffffff08 1px, transparent 1px), linear-gradient(90deg, #ffffff08 1px, transparent 1px);
  background-size: 1.5rem 1.5rem;
  color: #f0f6ff;
  border-radius: .7rem;
  padding: 1.2rem clamp(1rem, 2.4vw, 2rem) 1.45rem;
  margin-bottom: 1.15rem;
}
.map-head { display: flex; flex-wrap: wrap; align-items: center; gap: .45rem 1rem; justify-content: space-between; margin-bottom: .95rem; }
.map-head h2 { font-size: 1.25rem; }
#sample-coverage { font-size: .9rem; color: #c3d7ed; }
.map-grid {
  --map-gap: clamp(1rem, 5vw, 4rem);
  display: grid;
  grid-template-columns: minmax(11rem, 1.15fr) minmax(8rem, 1fr) minmax(8rem, 1fr);
  grid-template-areas: "solar inverter output" "battery inverter output";
  gap: .7rem var(--map-gap);
  align-items: center;
}
.map-node { min-width: 0; padding: .85rem .95rem; border: 1px solid #48647d; border-radius: .55rem; background: #192f49; position: relative; font-variant-numeric: tabular-nums; }
.map-node h3 { margin-bottom: .45rem; font-size: 1rem; }
.map-node dl div { display: flex; gap: .6rem; justify-content: space-between; align-items: baseline; }
.map-node dl div + div { margin-top: .15rem; }
.map-node dt, .map-node small, .inverter-node p { color: #bfd2e5; font-size: .9rem; }
.map-node dd { font-weight: 650; }
.map-node strong { font-size: clamp(1.3rem, 2.5vw, 2.1rem); letter-spacing: -.02em; }
.solar-node { grid-area: solar; color: var(--amber); }
.battery-node { grid-area: battery; color: #9deadc; }
.output-node { grid-area: output; color: #b9d6ff; }
.output-node strong { font-size: clamp(1.65rem, 3.4vw, 2.7rem); }
.inverter-node { grid-area: inverter; text-align: center; min-height: 8.2rem; display: grid; justify-items: center; align-content: center; border-color: #7293b5; }
.inverter-node h3 { margin-bottom: .25rem; }
.inverter-node p { overflow-wrap: anywhere; }
.inverter-mark { display: grid; place-items: center; width: 2.2rem; height: 2.2rem; margin-bottom: .45rem; color: #10243a; background: #b7d6f4; border-radius: .45rem; font-size: 1.7rem; line-height: 1; }
.solar-node::after, .battery-node::after, .inverter-node::after {
  content: "";
  position: absolute;
  left: 100%;
  top: 50%;
  width: var(--map-gap);
  border-top: 2px dashed var(--connector);
  pointer-events: none;
}
.solar-node::after { transform-origin: left; transform: skewY(24deg); }
.battery-node::after { transform-origin: left; transform: skewY(-24deg); }
#battery-level { display: block; width: 100%; height: .6rem; margin-top: .45rem; appearance: none; }
#battery-level::-webkit-meter-bar { background: #324966; border: 0; border-radius: .2rem; }
#battery-level::-webkit-meter-optimum-value { background: #9deadc; border-radius: .2rem; }
#battery-level::-moz-meter-bar { background: #9deadc; border-radius: .2rem; }

.panel { border: 1px solid var(--line); border-radius: .55rem; background: var(--surface); overflow: hidden; }
.panel-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .65rem; align-items: center; padding: 1rem 1.2rem; border-bottom: 1px solid var(--line); }
.panel-head h2 { font-size: 1.25rem; letter-spacing: -.025em; }
.screen-label { border: 1px solid #a8bfc6; border-radius: .25rem; padding: .22rem .47rem; color: #365963; font-size: .875rem; font-weight: 700; }
.measure-board { display: grid; grid-template-columns: 1.18fr 1fr .65fr; }
.pulse-board { display: grid; grid-template-columns: 1fr 1fr 1fr; }
.measure-group { padding: 1.2rem; border-top: 3px solid var(--group-color); min-width: 0; }
.measure-group + .measure-group { border-left: 1px solid var(--line); }
.measure-group h3 { font-size: 1.1rem; margin-bottom: .8rem; }
.group-pv { --group-color: #ae750e; }
.group-battery { --group-color: #347b6e; }
.group-output { --group-color: #526c85; }
.measure-board .group-output { background: #f1f6f8; }
.pv-table { border-collapse: collapse; width: 100%; table-layout: fixed; }
.pv-table th, .pv-table td { text-align: right; padding-block: .6rem; font-variant-numeric: tabular-nums; }
.pv-table th:first-child, .pv-table td:first-child { width: 18%; text-align: left; }
.pv-table thead th { font-size: .9rem; color: var(--muted); }
.pv-table tbody tr { border-top: 1px solid var(--line); }
.pv-table td { font-weight: 650; }
.metric-list div { display: flex; justify-content: space-between; gap: .45rem 1rem; align-items: baseline; padding-block: .65rem; }
.metric-list div + div { border-top: 1px solid var(--line); }
.metric-list dt, .output-reading dt { color: var(--muted); }
.metric-list dd { font-weight: 650; font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.output-reading dt { margin-top: .2rem; }
.output-reading dd { margin-top: .3rem; font-variant-numeric: tabular-nums; font-size: clamp(1.8rem, 3.5vw, 3rem); letter-spacing: -.04em; font-weight: 650; overflow-wrap: anywhere; }
.output-reading small { color: var(--muted); font-size: 1rem; letter-spacing: 0; }
.panel-note { color: var(--muted); margin: .75rem .05rem 0; font-size: .9rem; }
.diagnosis-board { display: grid; grid-template-columns: .9fr 1fr; gap: 1.25rem 2rem; padding: 1.25rem; align-items: start; }
.diagnosis { padding: 1rem; border-left: 3px solid currentColor; background: #f0f6f7; border-radius: .3rem; }
.diagnosis[data-tone="good"] { background: #e8f5ef; }
.diagnosis[data-tone="warn"] { background: #fff4dd; }
.diagnosis[data-tone="error"] { background: #fff0f1; }
.diagnosis p { margin-top: .4rem; line-height: 1.5; }
#diagnosis-age { color: #784700; font-weight: 650; }

@media (max-width: 850px) {
  .pulse-board { grid-template-columns: 1fr 1fr; }
  .pulse-board .measure-group:last-child { grid-column: 1 / -1; border-left: 0; }
}
@media (max-width: 690px) {
  .masthead-inner { align-items: flex-start; flex-direction: column; gap: 0; padding-top: .75rem; }
  .navigation { gap: 0 .1rem; }
  .navigation a { padding: .72rem .46rem; font-size: .9rem; }
  .measure-board, .pulse-board, .diagnosis-board { grid-template-columns: minmax(0, 1fr); }
  .measure-group + .measure-group { border-left: 0; }
  .sample-meta { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sample-status .text-button { padding-inline: 0; min-height: 2.25rem; }
  .pv-table th, .pv-table td { text-align: left; }
  .pv-table th:first-child, .pv-table td:first-child { width: 23%; }
}
@media (max-width: 620px) {
  .map-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-areas: "solar battery" "inverter output"; gap: .55rem; align-items: stretch; }
  .map-node::after { display: none; }
  .map-node { padding: .72rem; }
  .inverter-node { min-height: auto; }
  .sample-summary { flex-wrap: wrap; }
}
@media (max-width: 355px) {
  .inline-form input { width: 100%; }
  .navigation a { padding-inline: .35rem; }
}
