/* Expanded field, look "Sonnensturm" (spec 6.4): a large plain window with a header line in the middle, the sun
   steps back behind it, the other fields move to the edge. Switches, chips and the DHCP bar in gold (accent).
   No backdrop-filter: blurring over the animated canvas every frame is too costly; the window is opaque enough. */

.xpanel [hidden], .xpanel[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* ---------- Stage while a field is open ---------- */
.reactor { transition: opacity .4s ease, transform .4s ease; }
.stage.open .reactor { opacity: .3; transform: scale(.94); }
.stage.open .reactor-text { visibility: hidden; }
.stage.ring .field-btn { transition: border-color .2s, box-shadow .2s, left .35s ease, top .35s ease; }

.xpanel {
  display: flex; flex-direction: column; min-width: 0; z-index: 2;
  -webkit-backdrop-filter: none; backdrop-filter: none;
  background: color-mix(in srgb, color-mix(in srgb, var(--accent) 7%, #0a0504) 90%, transparent);
  border-color: color-mix(in srgb, var(--accent) 38%, transparent);
  box-shadow: 0 0 40px color-mix(in srgb, var(--bg) 70%, transparent), 0 0 24px color-mix(in srgb, var(--accent) 10%, transparent);
}
html[data-backdrop='weiss'] .xpanel { background: rgb(255 255 255 / .94); box-shadow: 0 8px 40px rgb(0 0 0 / .12); }
/* As high as the content, at most the room between the edges (then the body scrolls); centred on the sun's height */
.stage.ring .xpanel {
  position: absolute; left: var(--px); top: calc(var(--py) + var(--ph) / 2); width: var(--pw); max-height: var(--ph);
  transform: translateY(-50%);
}
.stage.stacked .xpanel { grid-column: 1 / -1; }

.xpanel-hd { min-height: 46px; padding: 6px 8px 6px 18px; }
.xpanel-titles { flex: 1; min-width: 0; display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 14px; }
.xpanel-hd .title { font-size: 12px; letter-spacing: .36em; outline: none; }
.xpanel-module { font: 500 12px/1.2 Rajdhani, sans-serif; color: var(--detail); }
.busy {
  flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--accent);
  box-shadow: 0 0 10px var(--accent); animation: busy-pulse 1s ease-in-out infinite;
}
@keyframes busy-pulse { 50% { opacity: .25; } }

.xpanel-bd { flex: 1 1 auto; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 14px; padding: 18px 22px; }
.xpanel-content { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; gap: 2px; }
.xpanel-error::before { content: '⚠ '; }
.xpanel-ft { flex: none; padding: 12px 22px 16px; border-top: 1px solid var(--win-line-hd); }
.xpanel-ft:has(> .xpanel-link[hidden]) { display: none; }
.xpanel-link { display: inline-flex; align-items: center; text-decoration: none; }
.btn:disabled, .chip:disabled, .switch:disabled { opacity: .45; cursor: default; }

/* ---------- Rows ---------- */
.prow-group { display: flex; flex-direction: column; }
.prow {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 46px;
  border-bottom: 1px dashed color-mix(in srgb, var(--accent) 20%, transparent);
}
.prow-title { min-width: 0; font: 500 17px/1.3 Rajdhani, system-ui, sans-serif; color: var(--fg); }
.prow-end { display: flex; align-items: center; gap: 10px; flex: none; }
.prow-value {
  min-width: 0; text-align: right; overflow-wrap: anywhere;
  font: 600 18px/1.2 Rajdhani, sans-serif; color: var(--value); text-shadow: 0 0 16px var(--value-glow);
}
.state-lbl { font: 600 11px/1 Rajdhani, sans-serif; letter-spacing: .24em; color: var(--detail); }
.state-lbl.on { color: var(--value); }
.dot { display: inline-block; flex: none; width: 7px; height: 7px; border-radius: 50%; background: color-mix(in srgb, var(--detail) 55%, transparent); }
.dot.on { background: var(--accent); box-shadow: 0 0 6px var(--accent); }
html[data-backdrop='weiss'] .dot.on { box-shadow: none; background: var(--value); }

/* Switch: frame in gold, square knob left (off) or right and glowing (on) */
.switch {
  position: relative; flex: none; width: 54px; height: 28px; cursor: pointer; padding: 0;
  background: transparent; border: 1px solid var(--accent); border-radius: 0;
  transition: background-color .2s;
}
.switch::after { content: ''; position: absolute; inset: -9px -4px; } /* 44 px touch target */
.switch-knob {
  position: absolute; top: 4px; left: 4px; width: 18px; height: 18px;
  background: color-mix(in srgb, var(--detail) 80%, transparent); transition: left .2s, background-color .2s, box-shadow .2s;
}
.switch.on { background: color-mix(in srgb, var(--accent) 20%, transparent); }
.switch.on .switch-knob { left: 30px; background: var(--accent); box-shadow: 0 0 10px var(--accent); }
html[data-backdrop='weiss'] .switch { border-color: var(--value); }
html[data-backdrop='weiss'] .switch.on .switch-knob { background: var(--value); box-shadow: none; }

/* Duration chips (at least 12 px text) */
.chip-block { display: flex; flex-direction: column; gap: 6px; padding: 10px 0 8px; }
.chips { display: grid; grid-template-columns: repeat(auto-fit, minmax(54px, 1fr)); gap: 6px; }
.chip {
  min-height: 44px; padding: 0 6px; cursor: pointer; border-radius: 0;
  font: 600 14px/1 Rajdhani, sans-serif; letter-spacing: .06em; color: var(--detail);
  background: transparent; border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
}
.chip:not(:disabled):hover { border-color: color-mix(in srgb, var(--accent) 70%, transparent); color: var(--value); }
.chip.on { color: var(--value); border-color: var(--accent); background: color-mix(in srgb, var(--accent) 14%, transparent); box-shadow: 0 0 12px var(--value-glow); }

/* Generic action form */
.action-form { display: flex; flex-direction: column; gap: 10px; padding: 12px 0 4px; }
.action-fields { display: flex; flex-direction: column; gap: 10px; }

/* ---------- Host list ---------- */
.host-list { flex: 1 1 auto; min-height: 240px; display: flex; flex-direction: column; gap: 8px; padding-top: 10px; }
.host-head { display: flex; justify-content: space-between; gap: 12px; }
.host-search { flex: none; }
.host-scroll { flex: 1 1 auto; min-height: 0; overflow: auto; border: 1px solid var(--win-line-hd); overscroll-behavior: contain; }
.stage.stacked .host-scroll { max-height: 60vh; }
.host-table { width: 100%; border-collapse: collapse; font: 500 15px/1.3 Rajdhani, system-ui, sans-serif; }
.host-table th {
  position: sticky; top: 0; z-index: 1; text-align: left; padding: 8px 10px;
  font: 600 10px/1.2 Rajdhani, sans-serif; letter-spacing: .26em; color: var(--head);
  background: color-mix(in srgb, var(--accent) 6%, #0d0705); border-bottom: 1px solid var(--win-line-hd);
}
html[data-backdrop='weiss'] .host-table th { background: #fbf8f4; }
.host-table td { padding: 6px 10px; border-bottom: 1px solid color-mix(in srgb, var(--accent) 9%, transparent); color: var(--fg); white-space: nowrap; }
.host-table .num { text-align: right; font-variant-numeric: tabular-nums; color: var(--value); }
.host-table th.num { text-align: right; }
.host-table .col-dot { width: 22px; padding-right: 0; }
.host-table .col-name { white-space: normal; overflow-wrap: anywhere; }
.host-table td.col-if { font: 600 10px/1 Rajdhani, sans-serif; letter-spacing: .14em; color: var(--detail); }
.host-table tr.off td { color: var(--detail); }
.host-table tbody tr:hover td { background: color-mix(in srgb, var(--accent) 5%, transparent); }
.host-empty { padding: 10px; }

/* ---------- DHCP editor ---------- */
.dhcp { display: flex; flex-direction: column; gap: 14px; }
.dhcp-bar { display: flex; flex-direction: column; gap: 12px; }
.range-bar {
  position: relative; height: 26px; margin: 14px 22px 6px; cursor: pointer; touch-action: none; user-select: none; -webkit-user-select: none;
  border: 1px solid color-mix(in srgb, var(--accent) 40%, transparent);
  background: repeating-linear-gradient(90deg, transparent 0 9px, color-mix(in srgb, var(--accent) 12%, transparent) 9px 10px);
}
.range-bar.disabled { cursor: default; opacity: .55; }
.bar-fill {
  position: absolute; top: 0; bottom: 0; left: var(--a, 0%); width: calc(var(--b, 100%) - var(--a, 0%));
  background: linear-gradient(90deg, color-mix(in srgb, var(--accent) 22%, transparent), color-mix(in srgb, var(--accent) 52%, transparent));
}
.bar-marker {
  position: absolute; top: -5px; bottom: -5px; left: var(--at, 0%); width: 2px; margin-left: -1px;
  background: var(--state); box-shadow: 0 0 6px var(--state);
}
.bar-handle {
  position: absolute; top: 50%; left: var(--at, 0%); width: 44px; height: 44px; transform: translate(-50%, -50%);
  touch-action: none; cursor: grab; outline: none;
}
.bar-handle::before {
  content: ''; position: absolute; left: 50%; top: 50%; width: 12px; height: 38px; transform: translate(-50%, -50%);
  background: var(--bg); border: 1.5px solid var(--accent); box-shadow: 0 0 10px color-mix(in srgb, var(--accent) 70%, transparent);
}
.bar-handle::after { content: ''; position: absolute; left: 50%; top: 9px; bottom: 9px; width: 2px; margin-left: -1px; background: var(--accent); }
.bar-handle:focus-visible::before { outline: 2px solid var(--focus); outline-offset: 3px; }
.range-bar:not(.disabled) .bar-handle:active { cursor: grabbing; }
html[data-backdrop='weiss'] .bar-handle::before { border-color: var(--value); box-shadow: none; background: #fff; }
.bar-readout { display: flex; align-items: baseline; gap: 8px; font: 600 14px/1.2 Rajdhani, sans-serif; }
.bar-readout .ro-v { color: var(--value); }
.bar-readout .ro-end { margin-left: auto; }
.octet-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.octet-field, .quad-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.octet-box {
  display: flex; align-items: center; padding: 0 10px; border: 1px solid color-mix(in srgb, var(--accent) 45%, transparent);
  font: 600 16px/1 Rajdhani, sans-serif;
}
.octet-box:focus-within { border-color: var(--accent); }
.octet-prefix { color: var(--detail); white-space: nowrap; }
.octet-box .octet { border: 0; padding: 10px 0; width: 100%; min-width: 3ch; color: var(--value); font: inherit; }
.octet-box .octet:focus-visible { outline: none; }
.dhcp-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 12px; }
.quad { display: flex; align-items: center; gap: 3px; }
.quad .octet { width: 3.8em; min-width: 0; flex: 1 1 0; text-align: center; padding: 10px 2px; color: var(--value); font-weight: 600; }
.quad-dot { color: var(--detail); }
.dhcp-msg::before { content: '⚠ '; }
.dhcp-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.dhcp-info { display: flex; flex-wrap: wrap; gap: 8px 22px; }
.info { display: inline-flex; align-items: baseline; gap: 8px; }
.info-value { font: 500 15px/1.2 Rajdhani, system-ui, sans-serif; color: var(--fg); }

/* ---------- Confirmation inside the panel ---------- */
.confirm-layer {
  position: absolute; inset: 0; z-index: 5; display: grid; place-items: center; padding: 16px;
  background: color-mix(in srgb, var(--bg) 80%, transparent);
}
.confirm-box {
  width: 100%; max-width: 440px; display: flex; flex-direction: column; gap: 14px; padding: 20px;
  background: color-mix(in srgb, var(--accent) 8%, var(--bg)); border: 1px solid color-mix(in srgb, var(--accent) 60%, transparent);
  box-shadow: 0 0 30px color-mix(in srgb, var(--accent) 18%, transparent);
}
.confirm-title { font: 600 12px/1.2 Rajdhani, sans-serif; letter-spacing: .34em; color: var(--value); }
.confirm-text { font: 500 18px/1.35 Rajdhani, system-ui, sans-serif; color: var(--fg); }
.confirm-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.xpanel:has(.confirm-layer) { min-height: 280px; }

@media (max-width: 480px) {
  .xpanel-hd { padding-left: 14px; }
  .xpanel-bd, .xpanel-ft { padding-left: 14px; padding-right: 14px; }
  .host-table .col-if { display: none; }
  .range-bar { margin-left: 16px; margin-right: 16px; }
}
