.gauge::after {
  transform: rotate(calc(-180deg + var(--angle)));
}

.overview-actions {
  display: flex;
  align-items: center;
  gap: 18px;
}

.overview-actions .link-button {
  margin: 0;
  white-space: nowrap;
}

.pair-code-panel {
  max-width: 720px;
  padding: 26px;
  border: 1px solid #2874a6;
  border-radius: 8px;
  background: #0d2033;
  text-align: center;
}

.pair-code-panel strong {
  display: block;
  margin: 12px 0;
  color: #f4f8fb;
  font-size: 42px;
  letter-spacing: .12em;
}

.pair-code-panel p:last-child,
.pair-intro p,
.muted-note {
  color: #9db0c1;
}

.pair-steps,
.pair-intro {
  max-width: 720px;
}

.pair-steps ol {
  padding-left: 22px;
  line-height: 1.8;
}

.system-banner.attention {
  border-color: #a66d16;
  color: #ffd980;
  background: #2a1d08;
}

.phase-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 12px;
}

.phase-panel {
  min-width: 0;
  padding: 15px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  text-align: center;
}

.phase-panel.total { border-color: #3285bd; }
.phase-panel h2 { margin: 0; font-size: 17px; }
.phase-panel strong { display: block; margin-top: 3px; font-size: 24px; }
.phase-panel small { display: block; min-height: 34px; color: var(--muted); font-size: 12px; line-height: 1.4; }
.phase-state { display: block; margin-top: 7px; font-size: 11px; font-style: normal; font-weight: 800; }
.phase-state.ok { color: var(--green); }
.phase-state.bad { color: var(--red); }

.compact-gauge {
  position: relative;
  width: 112px;
  height: 56px;
  overflow: hidden;
  margin: 11px auto 2px;
}

.compact-gauge::before {
  content: "";
  position: absolute;
  inset: 0;
  border: 12px solid #183249;
  border-bottom: 0;
  border-radius: 112px 112px 0 0;
}

.compact-gauge::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -2px;
  width: 43px;
  height: 3px;
  border-radius: 4px;
  background: white;
  transform-origin: 0 50%;
  transform: rotate(calc(-180deg + (var(--value) * 1.8deg)));
}

.compact-gauge span {
  position: absolute;
  left: calc(50% - 7px);
  bottom: -3px;
  z-index: 2;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #34495b;
}

.wifi-strip { display: flex; justify-content: center; margin-top: 12px; }
.wifi-strip .wifi-panel { width: min(100%, 360px); min-height: 205px; }
.wifi-strip .wifi-bars { height: 80px; }
.reading-grid article span { display: block; margin-top: 5px; color: var(--muted); font-size: 12px; }
.live-details .section-heading > span { color: var(--muted); font-size: 12px; }
.detail-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; overflow: hidden; border: 1px solid #1c354d; }
.detail-grid > div { padding: 13px; background: #0a1726; }
.detail-grid small, .detail-grid b { display: block; }
.detail-grid small { color: var(--muted); margin-bottom: 5px; font-size: 12px; }
.security-note { display: flex; gap: 16px; margin: 0 0 14px; padding: 14px 16px; border-left: 3px solid var(--blue); background: #0d1b2b; }
.security-note span { color: var(--muted); }

@media (max-width: 720px) {
  .overview-actions {
    width: 100%;
    justify-content: space-between;
  }

  .pair-code-panel strong {
    font-size: 30px;
  }

  .phase-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 5px; }
  .phase-panel { padding: 10px 2px; }
  .phase-panel h2 { font-size: 13px; }
  .phase-panel strong { font-size: 15px; }
  .phase-panel small { min-height: 42px; font-size: 9px; }
  .compact-gauge { width: 68px; height: 34px; }
  .compact-gauge::before { border-width: 8px; border-radius: 68px 68px 0 0; }
  .compact-gauge::after { width: 27px; }
  .detail-grid { grid-template-columns: 1fr 1fr; }
  .security-note { display: block; }
  .security-note b { display: block; margin-bottom: 5px; }
}

/* Het meterbeeld volgt bewust dezelfde vaste 520px-opbouw als het lokale dashboard. */
.meter-servicebar {
  max-width: 820px;
  margin: 0 auto 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.meter-servicebar > div { display: flex; align-items: center; gap: 9px; }
.meter-servicebar .back-link { margin: 0; }
.meter-pending { max-width: 820px; margin-left: auto; margin-right: auto; }

.heja-dashboard {
  --h-bg: #020811;
  --h-card: #07182a;
  --h-card2: #0b2743;
  --h-line: #07508f;
  --h-blue: #6ec6ff;
  --h-muted: #9fb0c3;
  --h-green: #17c768;
  --h-yellow: #ffd000;
  --h-orange: #ff9800;
  --h-red: #ff3030;
  width: min(100%, 520px);
  margin: 0 auto;
  padding: 7px;
  color: #fff;
  background: var(--h-bg);
  border: 1px solid #0b3559;
  border-radius: 18px;
  box-shadow: 0 14px 45px rgba(0,0,0,.34);
}

.heja-dashboard section,
.heja-dashboard article { box-sizing: border-box; }

.heja-top {
  display: grid;
  grid-template-columns: 1fr 1.25fr 82px;
  gap: 7px;
  align-items: center;
  min-height: 112px;
  padding: 13px 12px;
  border: 2px solid var(--h-line);
  border-radius: 15px;
  background: radial-gradient(circle at 50% 10%, #103456, var(--h-card) 70%);
  box-shadow: inset 0 0 17px rgba(0,112,210,.23);
}

.heja-device b,.heja-device strong,.heja-device small,.heja-device span,
.heja-active b,.heja-active span,.heja-logo b { display: block; }
.heja-device b { color: var(--h-blue); font-size: 18px; }
.heja-device strong { margin: 2px 0 10px; font-size: 19px; }
.heja-device small { color: #d6e1eb; font-weight: 700; }
.heja-device span { margin-top: 3px; color: var(--h-muted); }
.heja-active { text-align: center; }
.heja-active b { font-size: 29px; line-height: 1.05; overflow-wrap: anywhere; }
.heja-active span { margin-top: 9px; color: #d7e2ec; font-size: 16px; font-weight: 700; }
.heja-logo { text-align: center; color: #c8d5df; }
.heja-logo span { display: grid; width: 49px; height: 49px; margin: 0 auto 6px; place-items: center; border: 2px solid #93a9ba; border-radius: 50%; color: var(--h-blue); font-size: 25px; font-weight: 900; }
.heja-logo b { font-size: 10px; letter-spacing: .16em; }

.heja-system {
  min-height: 58px;
  margin-top: 16px;
  display: grid;
  place-items: center;
  padding: 8px;
  border: 2px solid;
  border-radius: 16px;
  font-size: 20px;
  font-weight: 900;
  text-align: center;
}
.heja-system.good { border-color: var(--h-green); color: #28df78; background: #08251a; }
.heja-system.attention { border-color: var(--h-orange); color: #ffd080; background: #291b08; }

.heja-measurement-badge { margin: 13px 0 7px; color: var(--h-blue); font-size: 13px; font-weight: 800; text-align: center; text-transform: uppercase; }
.heja-phase-grid { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 5px; }
.heja-phase-card,
.heja-gauge-card,
.heja-reading-grid article,
.heja-price-panel {
  border: 2px solid var(--h-line);
  background: radial-gradient(circle at 50% 12%, var(--h-card2), var(--h-card) 72%);
  box-shadow: inset 0 0 15px rgba(0,112,210,.18);
}
.heja-phase-card { min-width: 0; min-height: 157px; padding: 8px 2px 7px; border-radius: 13px; text-align: center; }
.heja-phase-card.total { border-color: #1481c8; }
.heja-phase-card h2 { margin: 0; color: #d9e9f6; font-size: 13px; }
.heja-phase-card strong,.heja-phase-card small,.heja-phase-card span,.heja-phase-card em { display: block; }
.heja-phase-card strong { margin-top: 4px; font-size: 16px; }
.heja-phase-card small,.heja-phase-card span { color: var(--h-muted); font-size: 9px; line-height: 1.35; }
.heja-phase-card em { margin-top: 4px; font-size: 9px; font-style: normal; font-weight: 900; }
.heja-phase-card em.ok { color: var(--h-green); }
.heja-phase-card em.bad { color: var(--h-red); }

.heja-mini-gauge,.heja-large-gauge { position: relative; overflow: hidden; margin-left: auto; margin-right: auto; }
.heja-mini-gauge { width: 72px; height: 38px; margin-top: 8px; }
.heja-mini-gauge::before,.heja-large-gauge::before {
  content: "";
  position: absolute;
  inset: 0;
  border-bottom: 0 !important;
  background: conic-gradient(from 270deg at 50% 100%, var(--h-green) 0 25%, var(--h-yellow) 25% 56%, var(--h-orange) 56% 78%, var(--h-red) 78% 100%);
  mask: radial-gradient(at 50% 100%, transparent 0 52%, #000 53% 68%, transparent 69%);
  -webkit-mask: radial-gradient(at 50% 100%, transparent 0 52%, #000 53% 68%, transparent 69%);
}
.heja-mini-gauge::after,.heja-large-gauge::after { content:""; position:absolute; left:50%; bottom:1px; border-radius:5px; background:#fff; transform-origin:0 50%; transform:rotate(calc(-180deg + (var(--value) * 1.8deg))); }
.heja-mini-gauge::after { width:29px; height:3px; }
.heja-mini-gauge i,.heja-large-gauge i { position:absolute; z-index:2; border-radius:50%; background:#333c46; }
.heja-mini-gauge i { left:calc(50% - 6px); bottom:-1px; width:12px; height:12px; }

.heja-main-gauges { display:grid; grid-template-columns:1fr 1fr; gap:7px; margin-top:8px; }
.heja-main-gauges.wifi-only { grid-template-columns:minmax(210px, 58%); justify-content:center; }
.heja-gauge-card { min-height:212px; padding:14px 8px; border-radius:16px; text-align:center; }
.heja-gauge-card h2 { margin:0; font-size:18px; }
.heja-gauge-card strong,.heja-gauge-card small { display:block; }
.heja-gauge-card strong { font-size:31px; }
.heja-gauge-card small { color:var(--h-muted); font-size:13px; }
.heja-large-gauge { width:184px; height:94px; margin-top:12px; }
.heja-large-gauge::after { width:73px; height:5px; }
.heja-large-gauge i { left:calc(50% - 11px); bottom:-4px; width:22px; height:22px; }
.heja-large-gauge.wifi-gauge::before { background:conic-gradient(from 270deg at 50% 100%, var(--h-red) 0 30%, var(--h-orange) 30% 55%, var(--h-yellow) 55% 75%, var(--h-green) 75% 100%); }

.heja-reading-grid { display:grid; grid-template-columns:1fr 1fr; gap:7px; margin-top:8px; }
.heja-reading-grid article { min-height:91px; display:grid; place-content:center; padding:9px 7px; border-radius:14px; text-align:center; }
.heja-reading-grid small,.heja-reading-grid b,.heja-reading-grid span { display:block; }
.heja-reading-grid small { color:var(--h-muted); font-size:15px; }
.heja-reading-grid b { margin-top:6px; font-size:20px; }
.heja-reading-grid span { margin-top:3px; color:var(--h-muted); font-size:11px; }

.heja-mode-grid { display:grid; grid-template-columns:1fr 1fr; gap:8px; margin-top:9px; }
.heja-mode-grid form { margin:0; }
.heja-mode-grid button { width:100%; min-height:63px; border:2px solid rgba(255,255,255,.22); border-radius:15px; color:#fff; font-size:20px; font-weight:900; cursor:pointer; box-shadow:inset 0 0 14px rgba(0,0,0,.22); }
.heja-mode-grid button.green { background:#087d45; }
.heja-mode-grid button.orange { background:#ae6200; }
.heja-mode-grid button.blue { background:#165b91; }
.heja-mode-grid button.red { background:#961017; }
.heja-mode-grid form.autumn-mode { grid-column:1/-1; }
.heja-mode-grid button.autumn { background:#7a4a13; }
.heja-mode-grid button small { display:block; margin-top:3px; font-size:11px; color:#f4dfbd; }
.heja-mode-grid button.active { border-color:#fff; box-shadow:0 0 0 2px var(--h-blue), inset 0 0 14px rgba(0,0,0,.25); }

.heja-price-panel { margin-top:9px; padding:14px 16px; border-radius:15px; }
.heja-price-panel h2 { margin:0 0 10px; color:var(--h-blue); font-size:19px; text-align:center; }
.heja-price-panel div { display:flex; justify-content:space-between; gap:14px; padding:7px 0; border-bottom:1px solid #174269; }
.heja-price-panel div span { color:var(--h-muted); }
.heja-price-panel p { margin:11px 0 0; text-align:center; font-weight:800; }
.heja-price-panel p.online { color:var(--h-green); }
.heja-price-panel p.offline { color:var(--h-orange); }

.service-details { max-width:820px; margin-left:auto; margin-right:auto; }

@media (max-width: 720px) {
  .meter-servicebar { padding:0 3px; }
  .meter-servicebar .connection-pill { display:none; }
  .heja-dashboard { width:100%; padding:5px; }
  .heja-top { grid-template-columns:1fr 1.2fr 62px; min-height:105px; padding:10px 8px; }
  .heja-device b { font-size:15px; }
  .heja-device strong { font-size:17px; }
  .heja-active b { font-size:25px; }
  .heja-logo span { width:42px; height:42px; }
  .heja-logo b { font-size:8px; }
  .heja-phase-card { min-height:148px; }
  .heja-mini-gauge { width:65px; height:34px; }
  .heja-gauge-card { min-height:190px; }
  .heja-large-gauge { width:155px; height:79px; }
  .heja-large-gauge::after { width:61px; }
}

@media (max-width: 390px) {
  .heja-phase-grid { gap:3px; }
  .heja-phase-card strong { font-size:14px; }
  .heja-phase-card small,.heja-phase-card span,.heja-phase-card em { font-size:8px; }
  .heja-mini-gauge { width:58px; height:31px; }
  .heja-main-gauges.wifi-only { grid-template-columns:minmax(190px, 65%); }
}

.user-create { max-width:980px; }
.user-submit { display:flex; align-items:flex-end; }
.user-list { display:grid; gap:10px; }
.user-row { display:grid; grid-template-columns:minmax(130px,.8fr) repeat(4,minmax(135px,1fr)) auto; gap:12px; align-items:end; padding:14px; border:1px solid #1c354d; border-radius:6px; background:#0b1827; }
.user-row label { font-size:13px; font-weight:750; }
.user-row input,.user-row select { display:block; width:100%; margin-top:6px; padding:9px 10px; border:1px solid #36536c; border-radius:5px; background:#081422; color:white; }
.user-identity b,.user-identity small { display:block; }
.user-identity small { margin-top:5px; color:var(--muted); font-size:12px; }
.role-help strong { color:white; }
.password-field { position:relative; display:block; }
.password-field input { padding-right:74px !important; }
.password-field button { position:absolute; right:5px; top:50%; min-width:36px; height:32px; padding:0 8px; transform:translateY(-50%); border:0; border-radius:4px; background:#173149; color:#dceaf5; cursor:pointer; font-size:14px; }
.password-field button:hover,.password-field button:focus-visible { background:#245071; outline:2px solid var(--blue); }

@media (max-width:980px) {
  .user-row { grid-template-columns:1fr 1fr; }
  .user-identity,.user-row button { grid-column:1/-1; }
}

@media (max-width:720px) {
  .user-row { grid-template-columns:1fr; }
  .user-identity,.user-row button { grid-column:auto; }
}

.location-capture { width:min(100%,620px); padding:28px; border:1px solid #294c68; border-radius:8px; background:#0c1a2a; box-shadow:0 24px 70px rgba(0,0,0,.35); }
.location-capture h1 { margin:8px 0 12px; font-size:28px; }
.location-capture > p { color:var(--muted); line-height:1.55; }
.location-consent { display:grid; gap:5px; margin:20px 0; padding:14px; border-left:4px solid #6ec6ff; background:#10243a; }
.location-consent span { color:#c8d6e4; line-height:1.45; }
.location-readout,.location-summary { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:10px; margin:18px 0; }
.location-readout div,.location-summary div { padding:12px; border:1px solid #27455e; border-radius:6px; background:#081523; }
.location-readout small,.location-readout b,.location-summary small,.location-summary b { display:block; }
.location-readout small,.location-summary small { color:var(--muted); }
.location-readout b,.location-summary b { margin-top:5px; overflow-wrap:anywhere; }
.location-summary span { display:block; margin-top:5px; color:#7feaae; font-weight:800; }
.location-status { min-height:24px; color:#d5e4f1 !important; font-weight:750; }
.location-status.success { color:#7feaae !important; }
.location-status.warning { color:#ffe37a !important; }
.location-status.error { color:#ffb3b3 !important; }
.location-actions { display:flex; gap:10px; margin-top:17px; }
.location-actions button { min-height:44px; }
.location-actions button:disabled { opacity:.5; cursor:not-allowed; }
.location-detail { grid-column:span 2; }
.location-detail span,.location-detail a { display:block; margin-top:5px; }
.location-detail span { color:var(--muted); font-size:12px; }
.location-summary .secondary-button { align-self:center; justify-self:start; }
.field-grid textarea { display:block; width:100%; margin-top:7px; padding:11px 12px; resize:vertical; border:1px solid #36536c; border-radius:5px; background:#081422; color:white; outline:none; }
.field-grid textarea:focus { border-color:var(--blue); box-shadow:0 0 0 3px rgba(110,198,255,.12); }
.wide-field,.customer-wide { grid-column:1/-1; }
.customer-details p { margin:5px 0 0; color:#d4e1ec; line-height:1.5; white-space:pre-wrap; }
.meter-search { margin:0 0 16px; padding:14px; border:1px solid var(--border); border-radius:8px; background:var(--surface); }
.meter-search > label { display:block; margin-bottom:8px; font-weight:800; }
.meter-search > div { display:grid; grid-template-columns:minmax(180px,1fr) auto auto; gap:9px; }
.meter-search input { width:100%; min-height:42px; padding:10px 12px; border:1px solid #36536c; border-radius:6px; background:#081422; color:white; outline:none; }
.meter-search input:focus { border-color:var(--blue); box-shadow:0 0 0 3px rgba(110,198,255,.12); }
.meter-search small { display:block; margin-top:8px; color:var(--muted); }
.empty-search { display:grid; gap:5px; padding:28px; border:1px dashed #36536c; border-radius:8px; color:var(--muted); text-align:center; }
.empty-search b { color:white; }
@media(max-width:620px){.meter-search > div{grid-template-columns:1fr 1fr}.meter-search input{grid-column:1/-1}.meter-search button,.meter-search a{justify-content:center}}
.location-map-panel { overflow:hidden; }
.location-map { display:block; width:100%; height:260px; border:1px solid #27455e; border-radius:6px; background:#dce7ed; }
.map-attribution { margin:9px 0 0; color:var(--muted); font-size:12px; }
@media(max-width:620px){.location-capture{padding:20px 16px}.location-readout,.location-summary{grid-template-columns:1fr}.location-actions{display:grid}.location-detail{grid-column:auto}}
.readonly-grid input[readonly],.readonly-grid textarea[readonly] { color:#b8c8d5; background:#0b1827; }
.diagnostic-log { max-height:440px; overflow:auto; white-space:pre-wrap; word-break:break-word; padding:14px; border:1px solid #29465d; border-radius:6px; background:#050b13; color:#dce9f3; font:12px/1.5 Consolas,monospace; }
.diagnostic-actions { display:flex; gap:10px; align-items:center; flex-wrap:wrap; margin:14px 0; }
.diagnostic-actions form { margin:0; }
.secondary-button.danger { color:#ffadad; border-color:#7d4141; }
.metric .last-seen { font-size:11px; line-height:1.25; color:#7f96aa; }
.ota-confirm-form{display:grid;gap:14px;margin-top:16px}.consent-line{display:flex;align-items:flex-start;gap:11px;color:var(--text);line-height:1.45}.consent-line input{width:20px;height:20px;flex:0 0 auto;margin:1px 0 0;accent-color:#1687d1}.ota-confirm-form .primary{justify-self:start}.ota-confirm-form .primary:disabled{opacity:.55;cursor:not-allowed}
