:root {
  color-scheme: dark;
  font: 15px/1.5 system-ui, sans-serif;
  background: #0d1420;
  color: #f3f5f9;
  --muted: #b4c3d7;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
main { max-width: 1600px; margin: auto; padding: clamp(1rem, 4vw, 3rem); }
header { display: flex; align-items: start; justify-content: space-between; gap: .75rem; }
h1, h2, p { margin: 0; }
h1 { font-size: clamp(1.8rem, 5vw, 3rem); line-height: 1.1; }
h2 { font-size: 1rem; overflow-wrap: anywhere; }
.source { color: #f0c775; font-size: .77rem; font-weight: 700; letter-spacing: .12em; margin-bottom: .6rem; }
#feedback { color: var(--muted); margin: 1rem 0 1.5rem; }
form { padding: 1.1rem; border: 1px solid #796438; border-radius: .9rem; background: #191f28; }
#energy-note { color: var(--muted); font-size: .85rem; margin-bottom: .75rem; }
.report-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: .5rem; }
#device-selection { position: relative; align-self: start; }
#device-selection summary { cursor: pointer; border: 1px solid #617086; border-radius: .45rem; padding: .55rem .85rem; }
#selection-form { position: absolute; z-index: 3; inset-inline-end: 0; top: calc(100% + .35rem); width: min(20rem, 86vw); }
#device-options { max-height: min(48vh, 22rem); overflow: auto; }
.device-option { display: flex; gap: .55rem; align-items: center; padding: .2rem 0; }
@media (max-width: 540px) { #selection-form { inset-inline-start: 0; inset-inline-end: auto; } }
#refresh { background: #242f3f; color: #f3f5f9; }
.table-scroll { border: 1px solid #334257; border-radius: .7rem; }
@media (max-width: 1000px) {
  .table-scroll { overflow-x: auto; }
}
@media (max-width: 540px) {
  header { flex-direction: column; }
  .report-actions { justify-content: flex-start; }
}
table { border-collapse: separate; border-spacing: 0; width: 100%; min-width: 900px; background: #191f28; }
thead th { position: sticky; top: 0; z-index: 1; background: #242f3f; white-space: nowrap; }
th, td { padding: .7rem .85rem; text-align: left; border-bottom: 1px solid #334257; }
tbody th { min-width: 180px; box-shadow: inset 4px 0 transparent; }
tbody tr:nth-child(even) { background: #1d2530; }
tbody tr.offline-row { background: #39242c; }
.offline-row th { box-shadow: inset 4px 0 #f98c91; }
.offline { color: #ffe1e2; background: #782e3b; font-weight: 700; }
.number { font-variant-numeric: tabular-nums; white-space: nowrap; }
.badge { display: inline-block; padding: .2rem .52rem; border-radius: .35rem; background: #353d49; color: #e1e6ef; font-size: .75rem; white-space: nowrap; }
.online { background: #143a30; color: #93ebc3; }
.badge.offline { color: #ffe1e2; background: #782e3b; }
.detail { color: var(--muted); font-size: .78rem; font-weight: 400; }
.warning { color: #f0c775; white-space: normal; overflow-wrap: anywhere; }
.relays .badge { margin: .1rem .25rem .1rem 0; }
form { max-width: 490px; display: grid; gap: .85rem; }
form p { color: var(--muted); }
label { display: grid; gap: .25rem; }
button, input { font: inherit; padding: .55rem .85rem; border: 1px solid #617086; border-radius: .45rem; }
button { background: #f0c775; color: #161512; font-weight: 700; cursor: pointer; }
button:disabled { opacity: .65; cursor: wait; }
input { background: #101723; color: #f3f5f9; min-width: 0; }
