:root {
  --bg-deep: #000028;
  --bg-elevated: #1b1534;
  --bg-card: #23233c;
  --bg-card-hover: #2e3050;
  --bg-tertiary: #196269;
  --accent: #9b26b6;
  --accent-teal: #009999;
  --accent-cyan: #00cccc;
  --warm: #ff9f0a;
  --danger: #e63946;
  --text: #ffffff;
  --text-muted: #b8b8c8;
  --border: rgba(155, 38, 182, 0.35);
  --border-subtle: rgba(0, 204, 204, 0.2);
  --radius: 14px;
  --font: "DM Sans", system-ui, sans-serif;
  --display: "Outfit", "DM Sans", system-ui, sans-serif;
  --shadow: 0 12px 40px rgba(0, 0, 40, 0.45);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg-deep);
}

body {
  position: relative;
  overflow-x: hidden;
}

.ambient {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(ellipse 50% 40% at 12% 18%, rgba(155, 38, 182, 0.28), transparent 60%),
    radial-gradient(ellipse 45% 35% at 88% 12%, rgba(0, 204, 204, 0.2), transparent 55%),
    radial-gradient(ellipse 60% 50% at 50% 100%, rgba(25, 98, 105, 0.35), transparent 65%),
    linear-gradient(165deg, #000028 0%, #0a0a32 45%, #120e2a 100%);
}

.auth-gate {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 1.5rem;
  background:
    radial-gradient(ellipse 50% 40% at 20% 20%, rgba(155, 38, 182, 0.35), transparent 60%),
    rgba(0, 0, 40, 0.92);
  backdrop-filter: blur(10px);
}

.auth-gate[hidden] {
  display: none !important;
}

.auth-card {
  width: min(420px, 100%);
  padding: 1.5rem 1.4rem 1.35rem;
  border-radius: 16px;
  border: 1px solid var(--border-subtle);
  background: rgba(35, 35, 60, 0.95);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.auth-card h1 {
  margin: 0.35rem 0 0;
  font-family: var(--display);
  font-size: 1.4rem;
}

.auth-error {
  margin: 0;
  color: #ff8a93;
  font-size: 0.9rem;
}

.auth-lockout {
  margin: 0;
  padding: 0.55rem 0.7rem;
  border-radius: 8px;
  border: 1px solid rgba(255, 138, 147, 0.35);
  background: rgba(255, 80, 90, 0.12);
  color: #ffb4ba;
  font-size: 0.9rem;
  font-weight: 600;
}

.auth-card .btn-primary {
  margin-top: 0.25rem;
  width: 100%;
}

.auth-card .hint {
  margin-bottom: 0.35rem;
  line-height: 1.4;
}

.auth-card .inline-check {
  margin-top: 0.15rem;
}

.auth-card.is-locked-out input,
.auth-card.is-locked-out button[type="submit"] {
  opacity: 0.55;
  pointer-events: none;
}

.topbar-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.topbar,
.shell {
  position: relative;
  z-index: 1;
}

body.locked .topbar,
body.locked .shell {
  visibility: hidden;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding: 1rem 1.75rem;
  border-bottom: 1px solid var(--border-subtle);
  background: rgba(27, 21, 52, 0.72);
  backdrop-filter: blur(16px);
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  min-width: 10rem;
}

.brand-mark {
  width: 2.4rem;
  height: 2.4rem;
  border-radius: 12px;
  object-fit: contain;
  display: block;
  flex-shrink: 0;
}

.brand-name {
  margin: 0;
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: 0.02em;
  background: linear-gradient(90deg, #c45ad4, #00cccc);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.brand-sub {
  margin: 0;
  font-size: 0.75rem;
  color: var(--text-muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.nav {
  display: flex;
  gap: 0.35rem;
  flex: 1;
  flex-wrap: wrap;
}

.nav-btn {
  appearance: none;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  font-weight: 500;
  padding: 0.55rem 0.95rem;
  border-radius: 999px;
  cursor: pointer;
  transition: color 0.2s, background 0.2s, border-color 0.2s;
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}

.nav-btn:hover {
  color: var(--text);
  background: rgba(46, 48, 80, 0.6);
}

.nav-btn:focus-visible {
  outline: 2px solid rgba(0, 204, 204, 0.65);
  outline-offset: 2px;
  color: var(--text);
}

.nav-btn.active {
  color: var(--text);
  background: rgba(155, 38, 182, 0.25);
  border-color: var(--border);
}

.pill {
  display: inline-flex;
  align-items: center;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
}

button.pill {
  font: inherit;
  font-family: inherit;
  line-height: inherit;
  appearance: none;
  -webkit-appearance: none;
  cursor: default;
}

button.pill.pill-account:not(:disabled) {
  cursor: pointer;
  transition: border-color 0.15s ease, filter 0.15s ease;
}

button.pill.pill-account:not(:disabled):hover {
  filter: brightness(1.12);
  border-color: rgba(0, 204, 204, 0.55);
}

button.pill.pill-account:not(:disabled):focus-visible {
  outline: 2px solid rgba(0, 204, 204, 0.7);
  outline-offset: 2px;
}

.pill-muted {
  background: rgba(35, 35, 60, 0.9);
  color: var(--text-muted);
  border: 1px solid var(--border-subtle);
}

.pill-ok {
  background: rgba(0, 153, 153, 0.25);
  color: #7dffef;
  border: 1px solid rgba(0, 204, 204, 0.35);
}

.pill-bad {
  background: rgba(230, 57, 70, 0.2);
  color: #ff8a93;
  border: 1px solid rgba(230, 57, 70, 0.4);
}

.shell {
  max-width: 1280px;
  margin: 0 auto;
  padding: 1.75rem 1.5rem 3rem;
}

@media (max-width: 720px) {
  .shell {
    padding: 1.15rem 1rem 2.5rem;
  }

  .topbar {
    padding: 0.85rem 1rem;
    gap: 0.85rem;
  }

  .nav {
    width: 100%;
    order: 3;
    gap: 0.3rem;
    overflow-x: auto;
    flex-wrap: nowrap;
    padding-bottom: 0.15rem;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
  }

  .nav-btn {
    flex: 0 0 auto;
    padding: 0.45rem 0.8rem;
    font-size: 0.9rem;
  }

  .brand {
    min-width: 0;
  }

  .topbar-meta {
    margin-left: auto;
  }
}

.view {
  display: none;
  animation: fadeIn 0.35s ease;
}

.view.active {
  display: block;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.view-head .header-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

table tr.is-selected td {
  background: rgba(0, 204, 204, 0.08);
}

.view-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.35rem;
  flex-wrap: wrap;
}

.view-head h1 {
  margin: 0 0 0.25rem;
  font-family: var(--display);
  font-size: 1.85rem;
  font-weight: 650;
}

.view-head p {
  margin: 0;
  color: var(--text-muted);
}

.view-head code,
.hint code {
  font-size: 0.85em;
  color: var(--accent-cyan);
}

.stat-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.85rem;
  margin-bottom: 1.25rem;
}

.stat {
  background: linear-gradient(160deg, rgba(35, 35, 60, 0.95), rgba(27, 21, 52, 0.9));
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  box-shadow: var(--shadow);
}

.stat .label {
  display: block;
  color: var(--text-muted);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.35rem;
}

.stat .value {
  font-family: var(--display);
  font-size: 1.75rem;
  font-weight: 700;
}

.stat.online .value {
  color: var(--accent-cyan);
}

.stat.offline .value {
  color: var(--warm);
}

/* Dashboard */
.dash-hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.35rem;
  flex-wrap: wrap;
}

.dash-kicker {
  margin: 0 0 0.35rem;
  color: var(--accent-cyan);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.dash-hero h1 {
  margin: 0 0 0.35rem;
  font-family: var(--display);
  font-size: clamp(1.8rem, 3vw, 2.35rem);
  font-weight: 700;
}

.dash-subtitle {
  margin: 0;
  color: var(--text-muted);
  max-width: 36rem;
}

.dash-kpis {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.75rem;
  margin-bottom: 1.15rem;
}

@media (max-width: 1100px) {
  .dash-kpis {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .dash-kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.kpi {
  appearance: none;
  text-align: left;
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  padding: 1rem 1.05rem;
  background: linear-gradient(165deg, rgba(35, 35, 60, 0.95), rgba(18, 20, 40, 0.92));
  color: var(--text);
  box-shadow: var(--shadow);
}

.kpi-static {
  cursor: default;
}

.kpi .label {
  display: block;
  color: var(--text-muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.4rem;
}

.kpi .value {
  font-family: var(--display);
  font-size: 1.85rem;
  font-weight: 700;
  line-height: 1;
}

.kpi .value-sm {
  font-size: 1.35rem;
}

.kpi-online .value {
  color: var(--accent-cyan);
}

.kpi-offline .value {
  color: var(--warm);
}

.kpi-pending .value {
  color: #e8b84a;
}

.dash-columns {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 1rem;
}

@media (max-width: 900px) {
  .dash-columns {
    grid-template-columns: 1fr;
  }
}

.dash-panel {
  min-height: 220px;
}

.dash-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.chip {
  appearance: none;
  border: 1px solid var(--border-subtle);
  background: rgba(0, 0, 40, 0.35);
  color: var(--text-muted);
  border-radius: 999px;
  padding: 0.35rem 0.75rem;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.chip:hover {
  color: var(--text);
  border-color: rgba(0, 204, 204, 0.45);
}

.chip:focus-visible {
  outline: 2px solid rgba(0, 204, 204, 0.65);
  outline-offset: 2px;
  color: var(--text);
}

.chip.active {
  color: var(--text);
  background: rgba(0, 153, 153, 0.28);
  border-color: rgba(0, 204, 204, 0.55);
}

.dash-card-list {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.dash-empty {
  margin: 0;
  padding: 1.25rem 0.25rem;
  color: var(--text-muted);
  text-align: center;
}

td.dash-empty,
tr.empty-row td {
  padding: 1.35rem 0.75rem;
  color: var(--text-muted);
  text-align: center;
  border-bottom: 0;
  font-size: 0.92rem;
  line-height: 1.45;
}

.pc-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.85rem;
  padding: 0.85rem 0.95rem;
  border-radius: 12px;
  border: 1px solid var(--border-subtle);
  background: rgba(0, 0, 40, 0.35);
  transition: border-color 0.15s, transform 0.15s;
}

.pc-card:hover {
  border-color: rgba(0, 204, 204, 0.35);
}

.pc-card-offline {
  border-left: 3px solid var(--warm);
}

.pc-card-pending {
  border-left: 3px solid #e8b84a;
}

.pc-card-online {
  border-left: 3px solid var(--accent-cyan);
}

.pc-card-main {
  min-width: 0;
  flex: 1;
}

.pc-card-top {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-wrap: wrap;
  margin-bottom: 0.25rem;
}

.pc-card-host {
  font-size: 1rem;
}

.pc-card-meta,
.pc-card-seen {
  margin: 0.1rem 0 0;
  color: var(--text-muted);
  font-size: 0.82rem;
}

.pc-card-started {
  color: rgba(180, 220, 220, 0.92);
}

.pc-card-actions {
  flex-shrink: 0;
}

.panel {
  background: rgba(35, 35, 60, 0.78);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  padding: 1.1rem 1.2rem;
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.85rem;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.pc-search {
  flex: 1 1 16rem;
  min-width: 12rem;
  max-width: 28rem;
  margin: 0;
}

.pc-search input {
  width: 100%;
  padding: 0.5rem 0.75rem;
}

#pc-search-meta.is-error {
  color: var(--danger, #e85d5d);
}

.pc-token-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 0.5rem 0.65rem;
}

.pc-token-row code {
  display: block;
  min-width: 0;
  word-break: break-all;
  font-size: 0.78rem;
  line-height: 1.35;
  padding: 0.5rem 0.6rem;
  border-radius: 8px;
  border: 1px solid var(--border-subtle);
  background: rgba(0, 0, 40, 0.4);
}

.pc-token-row code.token-secret.is-masked {
  letter-spacing: 0.12em;
  user-select: none;
  color: var(--text-muted);
}

@media (max-width: 560px) {
  .pc-token-row {
    grid-template-columns: 1fr;
  }
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.panel-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.inline-check {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--text-muted);
  font-size: 0.85rem;
  flex-direction: row;
}

#location-tree {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.group-block {
  margin: 0;
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  overflow: hidden;
  background: rgba(0, 0, 40, 0.28);
}

.group-plant {
  padding: 0.8rem 1rem 0.8rem 0.75rem;
  background: linear-gradient(90deg, rgba(155, 38, 182, 0.28), rgba(0, 153, 153, 0.12));
  font-family: var(--display);
  font-weight: 650;
  font-size: 1.05rem;
  letter-spacing: 0.01em;
  color: var(--text);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.group-building {
  padding: 0.55rem 0.9rem 0.55rem 0.65rem;
  background: rgba(25, 98, 105, 0.28);
  color: var(--text-muted);
  font-family: var(--font);
  font-weight: 600;
  font-size: 0.88rem;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  border-left: 3px solid rgba(0, 204, 204, 0.35);
}

.group-building-block + .group-building-block .group-building {
  border-top-color: rgba(255, 255, 255, 0.06);
}

button.group-toggle {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  width: 100%;
  margin: 0;
  border: 0;
  border-radius: 0;
  text-align: left;
  color: inherit;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  transition: background-color 0.15s ease, filter 0.15s ease;
}

button.group-plant.group-toggle:hover {
  filter: brightness(1.06);
  background: linear-gradient(90deg, rgba(155, 38, 182, 0.36), rgba(0, 153, 153, 0.16));
}

button.group-building.group-toggle:hover {
  background: rgba(25, 98, 105, 0.42);
  color: var(--text);
}

button.group-toggle:focus-visible {
  outline: 2px solid rgba(0, 200, 200, 0.55);
  outline-offset: -2px;
  z-index: 1;
}

button.group-toggle:active {
  filter: brightness(0.97);
}

.group-toggle-chevron {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 8px;
  background: rgba(0, 0, 40, 0.28);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--accent-cyan);
}

button.group-building .group-toggle-chevron {
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 7px;
  color: rgba(125, 255, 239, 0.85);
}

button.group-toggle:hover .group-toggle-chevron {
  background: rgba(0, 204, 204, 0.12);
  border-color: rgba(0, 204, 204, 0.28);
}

.group-toggle-label {
  min-width: 0;
  flex: 1 1 auto;
  line-height: 1.25;
}

.group-toggle-icon {
  display: block;
  width: 0.42rem;
  height: 0.42rem;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
  opacity: 0.9;
  transition: transform 0.2s ease;
  margin-top: -0.1rem;
}

.group-block.is-collapsed > .group-toggle .group-toggle-icon,
.group-building-block.is-collapsed > .group-toggle .group-toggle-icon {
  transform: rotate(-45deg);
  margin-top: 0;
}

.group-plant-body,
.group-building-body {
  display: grid;
  grid-template-rows: 1fr;
  transition: grid-template-rows 0.22s ease;
}

.group-plant-body > .group-collapse-inner,
.group-building-body > .group-collapse-inner {
  min-height: 0;
  overflow: hidden;
}

.group-block.is-collapsed > .group-plant-body,
.group-building-block.is-collapsed > .group-building-body {
  grid-template-rows: 0fr;
}

.group-plant-body > .group-collapse-inner {
  background: rgba(0, 0, 40, 0.18);
}

.group-building-body .table-wrap {
  border-top: 1px solid rgba(255, 255, 255, 0.04);
}

.group-building-body table {
  margin: 0;
  font-size: 0.9rem;
}

.group-building-body th {
  padding-top: 0.55rem;
  padding-bottom: 0.45rem;
  background: rgba(0, 0, 40, 0.22);
}

.group-building-body td {
  padding-top: 0.55rem;
  padding-bottom: 0.55rem;
}

.group-block table {
  margin: 0;
}

.group-meta {
  color: var(--text-muted);
  font-weight: 500;
  font-size: 0.85rem;
  margin-left: 0.5rem;
}

.group-toggle .group-meta {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-left: auto;
  padding-left: 0.5rem;
  font-family: var(--font);
  font-size: 0.8rem;
  letter-spacing: 0.01em;
  white-space: nowrap;
}

.group-plant .group-meta {
  font-size: 0.82rem;
}

.group-meta-count {
  color: var(--text-muted);
}

.group-meta-online {
  color: #7dffef;
  font-weight: 600;
}

.group-meta-offline {
  color: var(--warm);
  font-weight: 600;
}

.group-meta-sep {
  opacity: 0.45;
}

.panel-head h2 {
  margin: 0;
  font-family: var(--display);
  font-size: 1.1rem;
}

.split {
  display: grid;
  grid-template-columns: minmax(220px, 280px) 1fr;
  gap: 1rem;
}

.locations-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  align-items: stretch;
}

.locations-panel {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 18rem;
}

.locations-table-wrap {
  flex: 1 1 auto;
  min-height: 0;
  max-height: min(42vh, 28rem);
  overflow: auto;
  margin: 0 -0.15rem;
  padding: 0 0.15rem;
  border-radius: 10px;
}

.locations-table {
  table-layout: fixed;
  width: 100%;
  border-collapse: collapse;
}

.locations-table th,
.locations-table td {
  vertical-align: middle;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.locations-table th:nth-child(1),
.locations-table td:nth-child(1) {
  width: auto;
}

.locations-table th:nth-child(2),
.locations-table td:nth-child(2),
.locations-table th:nth-child(3),
.locations-table td:nth-child(3) {
  width: 5.5rem;
  text-align: center;
}

.locations-table th:nth-child(4),
.locations-table td:nth-child(4) {
  width: 2.75rem;
  text-align: center;
  padding-left: 0.25rem;
  padding-right: 0.25rem;
}

.locations-table tr[data-plant-id] {
  cursor: pointer;
}

.locations-table tr.is-selected td {
  background: rgba(0, 204, 204, 0.1);
}

.locations-table .meta-line {
  margin-top: 0.2rem;
  font-size: 0.78rem;
  opacity: 0.85;
}

.locations-table .table-actions {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  gap: 0;
}

.locations-pcs-panel {
  margin-top: 1rem;
}

@media (max-width: 860px) {
  .split {
    grid-template-columns: 1fr;
  }

  .locations-split {
    grid-template-columns: 1fr;
  }

  .locations-panel {
    min-height: 14rem;
  }

  .locations-table-wrap {
    max-height: min(36vh, 22rem);
  }

  .topbar {
    flex-wrap: wrap;
  }
}

.list-panel {
  padding: 0.5rem;
  max-height: 70vh;
  overflow: auto;
}

.entity-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.entity-list li button {
  width: 100%;
  text-align: left;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text);
  font: inherit;
  padding: 0.75rem 0.85rem;
  border-radius: 10px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.entity-list li button:hover {
  background: var(--bg-card-hover);
}

.entity-list li button.active {
  background: rgba(0, 204, 204, 0.16);
  border-color: rgba(0, 204, 204, 0.35);
}

.entity-list .btn-remove-member {
  margin: 0.25rem 0.5rem 0.75rem;
}

.entity-list li {
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.entity-list li:last-child {
  border-bottom: 0;
}

.meta-line {
  color: var(--text-muted);
  font-size: 0.78rem;
  margin-top: 0.15rem;
}

.meta-line code {
  font-size: 0.85em;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.85rem 1rem;
}

.form-grid .span-2 {
  grid-column: 1 / -1;
}

@media (max-width: 640px) {
  .form-grid {
    grid-template-columns: 1fr;
  }

  .form-grid .span-2 {
    grid-column: auto;
  }
}

label,
fieldset {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

fieldset {
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  padding: 0.75rem 0.9rem 1rem;
  margin: 0;
}

fieldset.type-section {
  margin-top: 1rem;
}

fieldset.type-section[hidden] {
  display: none !important;
}

legend {
  padding: 0 0.35rem;
  color: var(--text-muted);
}

input,
select,
textarea {
  font: inherit;
  color: var(--text);
  background: rgba(0, 0, 40, 0.45);
  border: 1px solid rgba(0, 204, 204, 0.22);
  border-radius: 10px;
  padding: 0.6rem 0.75rem;
}

textarea {
  resize: vertical;
  min-height: 5rem;
  line-height: 1.4;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.88rem;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent-teal);
  box-shadow: 0 0 0 3px rgba(0, 153, 153, 0.2);
}

.form-actions,
.inline-form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  align-items: flex-end;
  margin-top: 1.1rem;
}

.inline-form {
  margin: 0 0 1.1rem;
}

.inline-form label {
  min-width: 160px;
}

.btn {
  appearance: none;
  border: 1px solid transparent;
  border-radius: 10px;
  font: inherit;
  font-weight: 600;
  padding: 0.6rem 1rem;
  cursor: pointer;
  transition: transform 0.15s, background 0.2s, border-color 0.2s, box-shadow 0.15s;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn:focus-visible {
  outline: 2px solid rgba(0, 204, 204, 0.7);
  outline-offset: 2px;
}

.btn:active {
  transform: none;
}

.table-actions .btn:hover,
.table-wrap .btn-icon:hover,
.locations-table .btn-icon:hover {
  transform: none;
}

.btn-primary {
  background: linear-gradient(90deg, var(--accent), var(--accent-teal));
  color: white;
}

.btn-ghost {
  background: rgba(46, 48, 80, 0.7);
  color: var(--text);
  border-color: var(--border-subtle);
}

.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  min-width: 2rem;
  padding: 0;
  border-radius: 8px;
  line-height: 0;
}

.btn-icon .icon-pencil {
  width: 1rem;
  height: 1rem;
  display: block;
  flex-shrink: 0;
}

.btn-icon:hover {
  color: var(--accent-cyan, #7ef0e8);
  border-color: rgba(0, 204, 204, 0.35);
  background: rgba(0, 204, 204, 0.12);
}

/* Compact pencil in plant/building tables — no heavy box */
.locations-table .btn-icon,
.locations-table .btn-icon.btn-ghost {
  width: 1.75rem;
  height: 1.75rem;
  min-width: 1.75rem;
  background: transparent;
  border: 0;
  color: var(--text-muted);
  box-shadow: none;
  transform: none;
}

.locations-table .btn-icon:hover,
.locations-table .btn-icon.btn-ghost:hover {
  color: var(--accent-teal);
  background: rgba(0, 204, 204, 0.14);
  border: 0;
  transform: none;
}

.locations-table .btn-icon .icon-pencil {
  width: 0.95rem;
  height: 0.95rem;
}

.btn-danger {
  background: rgba(230, 57, 70, 0.18);
  color: #ff9aa2;
  border-color: rgba(230, 57, 70, 0.4);
}

.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.table-wrap-scroll {
  max-height: 280px;
  overflow: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}

th,
td {
  text-align: left;
  padding: 0.7rem 0.55rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

th {
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.table-wrap-scroll th,
.locations-table-wrap th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: rgba(28, 28, 48, 0.96);
  backdrop-filter: blur(6px);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.06);
}

.status-dot {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.status-dot::before {
  content: "";
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  background: var(--warm);
}

.status-dot.on::before {
  background: var(--accent-cyan);
  box-shadow: 0 0 8px rgba(0, 204, 204, 0.7);
}

.status-dot.pending::before {
  background: #e8b84a;
  box-shadow: 0 0 8px rgba(232, 184, 74, 0.55);
}

.status-dot.muted {
  color: var(--text-muted);
}

.status-dot.muted::before {
  background: rgba(255, 255, 255, 0.28);
  box-shadow: none;
}

.pc-status-stack {
  display: inline-flex;
  flex-direction: column;
  gap: 0.18rem;
  align-items: flex-start;
  vertical-align: middle;
}

.pc-card-top .pc-status-stack {
  align-items: flex-end;
  text-align: right;
}

.check-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.45rem;
}

.check-grid label {
  flex-direction: row;
  align-items: center;
  gap: 0.5rem;
  color: var(--text);
  font-size: 0.9rem;
}

.hint {
  color: var(--text-muted);
  margin: 0 0 1rem;
}

.toast {
  position: fixed;
  right: 1.25rem;
  bottom: 1.25rem;
  z-index: 50;
  margin: 0;
  padding: 0.85rem 1.1rem;
  border-radius: 12px;
  background: rgba(27, 21, 52, 0.95);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  max-width: min(360px, calc(100vw - 2rem));
  animation: fadeIn 0.25s ease;
  line-height: 1.4;
}

.toast.error {
  border-color: rgba(230, 57, 70, 0.55);
  background: rgba(48, 18, 28, 0.96);
  color: #ffc4c8;
}

.code-block,
.code-editor {
  width: 100%;
  margin: 0;
  padding: 1rem;
  border-radius: 12px;
  border: 1px solid var(--border-subtle);
  background: rgba(0, 0, 40, 0.55);
  color: #d7fff8;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.82rem;
  line-height: 1.45;
  overflow: auto;
  max-height: 420px;
  white-space: pre-wrap;
  word-break: break-word;
}

.code-editor {
  resize: vertical;
  min-height: 280px;
  color: var(--text);
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 1.25rem;
}

.modal.modal-confirm {
  z-index: 110;
}

.modal-card-confirm {
  width: min(420px, 100%);
  max-height: min(80vh, 520px);
  overflow: auto;
}

.modal-head-confirm {
  margin-bottom: 0.35rem;
  padding-bottom: 0;
  border-bottom: 0;
}

.modal-head-confirm h2 {
  margin: 0;
  font-size: 1.15rem;
  line-height: 1.35;
}

.app-confirm-message {
  margin: 0.35rem 0 0;
  color: var(--text-muted);
  font-size: 0.95rem;
  line-height: 1.5;
  white-space: pre-line;
}

.modal-actions-confirm {
  margin-top: 1.25rem;
  padding-top: 1rem;
  justify-content: flex-end;
}

.modal-actions-confirm .btn-danger {
  background: linear-gradient(90deg, #c6283a, #e03946);
  color: #fff;
  border-color: transparent;
}

.modal-actions-confirm .btn-danger:hover {
  filter: brightness(1.06);
}

.modal[hidden] {
  display: none;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(6, 8, 20, 0.72);
  backdrop-filter: blur(4px);
}

.modal-card {
  position: relative;
  z-index: 1;
  width: min(520px, 100%);
  max-height: min(88vh, 720px);
  overflow: auto;
  padding: 1.15rem 1.25rem 1.25rem;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: linear-gradient(165deg, rgba(28, 30, 58, 0.98), rgba(18, 20, 40, 0.98));
  box-shadow: var(--shadow);
  animation: fadeIn 0.2s ease;
}

.modal-card-wide {
  width: min(820px, 100%);
  max-height: min(92vh, 920px);
}

.modal-card-wide.modal-card-floorplan {
  width: min(980px, 100%);
  max-height: min(94vh, 980px);
}

.modal-card-wide.modal-card-pc {
  width: min(880px, 100%);
  max-height: min(90vh, 860px);
}

.modal-card-pc {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding-bottom: 0;
}

.modal-card-pc .modal-head {
  flex: 0 0 auto;
  margin-bottom: 0;
  padding-bottom: 0.65rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

.modal-head-pc {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem 1rem;
  flex-wrap: wrap;
}

.modal-head-pc h2 {
  flex: 1 1 auto;
  min-width: 0;
}

.modal-head-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.35rem 0.45rem;
  flex: 0 1 auto;
  margin-left: auto;
}

.pc-head-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.35rem 0.55rem;
}

.pc-head-toolbar-danger {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.3rem;
  padding-right: 0.55rem;
  margin-right: 0.15rem;
  border-right: 1px solid rgba(255, 255, 255, 0.1);
}

.pc-head-toolbar-primary {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
}

.pc-detail-mode-hint {
  font-size: 0.72rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.modal-card-pc.pc-detail-view .pc-edit-only {
  display: none !important;
}

.modal-card-pc.pc-detail-edit .pc-view-only {
  display: none !important;
}

.pc-readonly-fields {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: 0.15rem;
}

.pc-readonly-fields p {
  margin: 0;
  font-size: 0.88rem;
}

.pc-readonly-label {
  display: inline-block;
  min-width: 5.5rem;
  color: var(--text-muted);
  font-size: 0.78rem;
}

.pc-card-host.pc-name-link {
  font-size: inherit;
}

.modal-card-pc.pc-detail-view #pc-detail-rotate-token {
  display: none;
}

.modal-card-pc .modal-head .btn,
.modal-card-pc .modal-head-toolbar .btn {
  min-height: 2rem;
  padding: 0.32rem 0.7rem;
  font-size: 0.8rem;
}

.modal-card-pc .modal-head .btn-primary,
.modal-card-pc .modal-head-toolbar .btn-primary {
  min-height: 2.15rem;
  padding: 0.36rem 0.85rem;
  font-weight: 600;
}

.modal-card-pc .modal-head .btn-icon-only,
.modal-card-pc .modal-head-toolbar .btn-icon-only {
  min-width: 2.15rem;
  min-height: 2.15rem;
  padding: 0.4rem;
}

.modal-card-pc .modal-head .icon-action,
.modal-card-pc .modal-head-toolbar .icon-action {
  width: 1.1rem;
  height: 1.1rem;
  display: block;
}

.btn-with-icon .icon-action {
  width: 1.05rem;
  height: 1.05rem;
  flex-shrink: 0;
}

.modal-card-pc .modal-head h2 {
  font-size: 1.15rem;
  letter-spacing: 0.01em;
}

.modal-body-scroll {
  flex: 1 1 auto;
  overflow: auto;
  min-height: 0;
  padding-right: 0.15rem;
}

.modal-card-pc .modal-body-scroll {
  padding-top: 0.75rem;
  max-height: calc(90vh - 5.5rem);
}

.modal-footer-secondary {
  padding: 0.55rem 1.25rem 0.75rem;
  margin-top: 0;
}

.modal-footer-sticky {
  flex: 0 0 auto;
  margin: 0 -1.25rem 0;
  padding: 0.7rem 1.25rem 0.95rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  background: linear-gradient(180deg, rgba(18, 20, 40, 0.55), rgba(14, 16, 32, 0.96));
}

.modal-footer-sticky .modal-actions {
  margin: 0;
  padding: 0;
  border: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.45rem 0.65rem;
}

.modal-card-pc .modal-footer-sticky .btn {
  min-height: 2.1rem;
  padding: 0.38rem 0.8rem;
  font-size: 0.82rem;
}

.modal-card-pc .modal-footer-sticky .btn-primary {
  min-height: 2.3rem;
  padding: 0.42rem 1rem;
  font-weight: 600;
}

.modal-card-pc .modal-footer-sticky .btn-sm {
  min-height: 2rem;
  padding: 0.32rem 0.65rem;
  font-size: 0.78rem;
}

.pc-actions-cluster--start {
  order: 1;
}

.pc-actions-cluster--end {
  order: 2;
  margin-left: auto;
  justify-content: flex-end;
  gap: 0.4rem;
}

.modal-footer-sticky .pc-config-actions {
  margin: 0;
  margin-left: auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.4rem 0.5rem;
}

.modal-footer-sticky .modal-actions[hidden],
.modal-footer-sticky .pc-config-actions[hidden] {
  display: none !important;
}

.pc-overview-loading {
  padding: 1.5rem 0.25rem;
}

.pc-overview {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}

.pc-status-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.28rem 0.65rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  border: 1px solid var(--border-subtle);
  background: rgba(0, 0, 40, 0.35);
  color: var(--text-muted);
}

.status-pill.on {
  color: #9af0d8;
  border-color: rgba(0, 204, 170, 0.35);
  background: rgba(0, 180, 150, 0.14);
}

.status-pill.pending {
  color: #ffd28a;
  border-color: rgba(255, 180, 60, 0.35);
  background: rgba(255, 170, 40, 0.12);
}

.status-pill.off,
.status-pill.muted {
  color: var(--text-muted);
}

.pc-overview-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.7rem;
  align-items: stretch;
}

.pc-section {
  margin: 0;
  padding: 0.5rem 0.65rem 0.65rem;
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  background: rgba(0, 0, 40, 0.22);
  min-width: 0;
  display: flex;
  flex-direction: column;
  height: 100%;
}

.pc-section-wide {
  grid-column: 1 / -1;
}

/* Support/Viewer: Autologon + API-token are hidden — Remote should not leave a half-empty row. */
body.role-support .pc-overview-grid > .pc-ops-remote,
body.role-viewer .pc-overview-grid > .pc-ops-remote {
  grid-column: 1 / -1;
}

.pc-section h3,
.pc-fold-title {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0;
  font-family: var(--display), Outfit, sans-serif;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--accent-teal);
  letter-spacing: 0.02em;
  line-height: 1.25;
  transition: color 0.15s ease;
}

.pc-fold-title .pc-cmd-icon {
  width: 0.9rem;
  height: 0.9rem;
  opacity: 0.9;
  flex-shrink: 0;
}

.pc-fold-toggle {
  appearance: none;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: calc(100% + 0.4rem);
  margin: -0.2rem -0.2rem 0;
  padding: 0.35rem 0.35rem;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  text-align: left;
  border-radius: 8px;
  transition: background 0.15s ease;
}

.pc-fold-toggle:focus-visible {
  outline: 2px solid rgba(0, 204, 204, 0.55);
  outline-offset: 2px;
}

.pc-fold-toggle:hover {
  background: rgba(0, 204, 204, 0.06);
}

.pc-fold-toggle:hover .pc-fold-title,
.pc-fold-toggle:hover .pc-actions-remote-label {
  color: var(--accent-cyan);
}

.pc-fold-chevron {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 1.35rem;
  height: 1.35rem;
  border-radius: 7px;
  background: rgba(0, 0, 40, 0.28);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--accent-cyan);
  transition: background 0.15s ease, border-color 0.15s ease;
}

.pc-fold-toggle:hover .pc-fold-chevron {
  background: rgba(0, 204, 204, 0.12);
  border-color: rgba(0, 204, 204, 0.28);
}

.pc-fold-icon {
  display: block;
  width: 0.36rem;
  height: 0.36rem;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
  opacity: 0.9;
  transition: transform 0.2s ease;
  margin-top: -0.08rem;
}

.pc-section.is-collapsed .pc-fold-icon,
.pc-actions-remote.is-collapsed .pc-fold-icon {
  transform: rotate(-45deg);
  margin-top: 0;
}

.pc-fold-body {
  margin-top: 0.5rem;
  flex: 1 1 auto;
  min-height: 0;
}

.pc-fold-body > .field-hint:first-child {
  margin-top: 0;
}

.pc-actions-remote > .pc-fold-body {
  margin-top: 0;
}

.pc-section.is-collapsed {
  padding-bottom: 0.5rem;
  height: auto;
}

.pc-section.is-collapsed > .pc-fold-body,
.pc-fold-body[hidden] {
  display: none !important;
}

.pc-fold-body .field-hint {
  margin: 0.35rem 0 0;
  font-size: 0.74rem;
  line-height: 1.35;
  color: var(--text-muted);
  opacity: 0.88;
}

.pc-fold-body .field-hint:empty {
  display: none;
}

.pc-fold-body .field-hint code {
  font-size: 0.92em;
}

.pc-field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.55rem 0.65rem;
}

.pc-field-grid .pc-field {
  margin: 0;
}

.pc-field-grid .pc-field.span-2 {
  grid-column: 1 / -1;
}

@media (max-width: 560px) {
  .pc-field-grid {
    grid-template-columns: 1fr;
  }

  .pc-field-grid .pc-field.span-2 {
    grid-column: auto;
  }
}

.pc-config-section {
  margin-bottom: 0.75rem;
}

.pc-config-form .pc-config-section {
  margin-bottom: 0;
}

.pc-ops-sub + .pc-ops-sub {
  margin-top: 1rem;
  padding-top: 0.95rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

body.role-support .pc-ops-remote {
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
}

.pc-ops-subhead {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0 0 0.65rem;
  font-family: var(--display), Outfit, sans-serif;
  font-size: 0.8rem;
  font-weight: 650;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--accent-cyan);
}

.pc-ops-subhead .pc-cmd-icon {
  width: 0.9rem;
  height: 0.9rem;
  opacity: 0.9;
  flex-shrink: 0;
}

.pc-actions-remote-inline {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem 0.45rem;
  width: 100%;
}

.pc-actions-remote-inline .pc-actions-remote-group {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
}

.pc-actions-remote-inline .pc-actions-remote-sep {
  width: 1px;
  align-self: stretch;
  min-height: 1.65rem;
  margin: 0 0.15rem;
  background: rgba(255, 255, 255, 0.1);
}

.pc-actions-remote-inline .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  min-height: 2rem;
  padding: 0.32rem 0.6rem;
  font-size: 0.76rem;
  border-radius: 8px;
}

.pc-actions-remote-inline .btn .pc-cmd-icon {
  width: 0.9rem;
  height: 0.9rem;
  flex-shrink: 0;
  opacity: 0.92;
}

.pc-actions-remote-inline .btn .btn-label {
  line-height: 1.2;
}

.pc-actions-remote-inline .btn.is-pending .pc-cmd-icon {
  animation: pc-cmd-pulse 1.1s ease-in-out infinite;
}

/* Half-column Remote: stack Apphub / System groups for a tidy ops box. */
.pc-overview-grid > .pc-ops-remote:not(.pc-section-wide) .pc-actions-remote-inline {
  flex-direction: column;
  align-items: stretch;
  gap: 0.5rem;
}

.pc-overview-grid > .pc-ops-remote:not(.pc-section-wide) .pc-actions-remote-sep {
  display: none;
}

.pc-overview-grid > .pc-ops-remote:not(.pc-section-wide) .pc-actions-remote-group {
  width: 100%;
}

.pc-overview-grid > .pc-ops-remote:not(.pc-section-wide) .pc-actions-remote-group .btn {
  flex: 1 1 calc(50% - 0.2rem);
  justify-content: center;
}

/* Half-column Autologon: single-column fields read cleaner beside Remote. */
.pc-overview-grid > .pc-section:not(.pc-section-wide) .pc-autologon-fields {
  grid-template-columns: 1fr;
}

.pc-overview-grid > .pc-section:not(.pc-section-wide) .pc-autologon-fields .span-2 {
  grid-column: auto;
}

/* Half-column Location / Profile: stack fields so headers align cleanly. */
.pc-overview-grid > .pc-section:not(.pc-section-wide) .pc-field-grid {
  grid-template-columns: 1fr;
}

@media (max-width: 720px) {
  .pc-actions-remote-inline .pc-actions-remote-sep {
    display: none;
  }

  .pc-actions-remote-inline .pc-actions-remote-group {
    width: 100%;
  }

  .pc-actions-remote-inline .btn {
    flex: 1 1 calc(50% - 0.2rem);
    justify-content: center;
  }
}

.pc-field {
  display: flex;
  flex-direction: column;
  gap: 0.28rem;
  margin: 0 0 0.55rem;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--text-muted);
}

.pc-field:last-child {
  margin-bottom: 0;
}

.pc-kv {
  display: grid;
  gap: 0.35rem 0.65rem;
  margin: 0.65rem 0 0;
  padding-top: 0.6rem;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.pc-section-wide .pc-kv {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: 1.1rem;
}

.pc-kv > div {
  display: grid;
  grid-template-columns: 5.75rem 1fr;
  gap: 0.45rem;
  align-items: baseline;
}

.pc-kv dt {
  margin: 0;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.pc-kv dd {
  margin: 0;
  color: var(--text);
  font-size: 0.84rem;
  word-break: break-word;
}

.pc-token-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.3rem;
}

.pc-token-actions .btn {
  min-height: 1.9rem;
  padding: 0.28rem 0.55rem;
  font-size: 0.76rem;
  font-weight: 600;
}

.pc-token-actions .btn-ghost {
  background: rgba(46, 48, 80, 0.45);
}

.pc-token-empty {
  margin: 0;
}

.pc-net-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.45rem;
  margin-top: 0.65rem;
}

.pc-net-card {
  padding: 0.5rem 0.55rem;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(0, 0, 40, 0.22);
}

.pc-net-card h4 {
  margin: 0 0 0.35rem;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--accent-teal);
}

.pc-net-card p {
  display: grid;
  grid-template-columns: 2.2rem 1fr;
  gap: 0.35rem;
  align-items: baseline;
  margin: 0.2rem 0 0;
  font-size: 0.82rem;
}

.pc-net-card span {
  color: var(--text-muted);
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
}

.pc-net-card code,
.pc-net-card strong {
  font-weight: 600;
  word-break: break-all;
}

.pc-machine {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.pc-machine-edit {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.5rem 0.65rem;
  padding: 0.55rem 0.6rem;
  border-radius: 10px;
  background: rgba(0, 0, 40, 0.26);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.pc-machine-edit .pc-field {
  margin: 0;
}

.pc-machine-windows {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.pc-machine-subhead {
  margin: 0.15rem 0 0;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.pc-machine-runtime {
  margin-top: 0.15rem;
}

.pc-machine-specs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.4rem;
}

.pc-spec {
  display: flex;
  flex-direction: column;
  gap: 0.18rem;
  min-width: 0;
  padding: 0.42rem 0.5rem;
  border-radius: 8px;
  background: rgba(0, 0, 40, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.04);
}

.pc-spec-wide {
  grid-column: span 2;
}

.pc-spec-label {
  font-size: 0.64rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.pc-spec-value {
  font-size: 0.83rem;
  font-weight: 500;
  color: var(--text);
  line-height: 1.35;
  word-break: break-word;
}

.pc-spec-value.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.pc-spec-meta {
  display: inline-block;
  margin-left: 0.35rem;
  font-size: 0.76rem;
  font-weight: 500;
  color: var(--text-muted);
}

.pc-spec-meta::before {
  content: "·";
  margin-right: 0.35rem;
  opacity: 0.65;
}

.pc-machine-net {
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 10px;
  overflow: hidden;
  background: rgba(0, 0, 40, 0.14);
}

.pc-machine-net table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

.pc-machine-net th,
.pc-machine-net td {
  padding: 0.48rem 0.65rem;
  text-align: left;
  vertical-align: middle;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.pc-machine-net thead th {
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--accent-teal);
  background: rgba(0, 0, 40, 0.32);
}

.pc-machine-net thead th:first-child {
  width: 3.25rem;
}

.pc-machine-net tbody th {
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
  background: rgba(0, 0, 40, 0.12);
  white-space: nowrap;
}

.pc-machine-net tbody td {
  color: var(--text);
  font-weight: 500;
  word-break: break-all;
}

.pc-machine-net tbody tr:last-child th,
.pc-machine-net tbody tr:last-child td {
  border-bottom: 0;
}

.pc-machine-net code {
  font-size: 0.88em;
  font-weight: 600;
}

.pc-autologon {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.pc-autologon > .field-hint {
  margin: 0;
}

.pc-autologon-fields {
  margin: 0;
}

.pc-autologon-fields label {
  gap: 0.28rem;
  font-size: 0.78rem;
  font-weight: 600;
}

.pc-autologon .inline-check {
  margin: 0;
}

.pc-autologon-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.55rem 0.85rem;
  margin-top: 0.15rem;
  padding-top: 0.65rem;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.pc-autologon-footer .field-hint {
  flex: 1 1 12rem;
  margin: 0;
  margin-right: auto;
}

.pc-autologon-footer .field-hint:empty {
  display: none;
}

.pc-autologon-footer .btn {
  flex: 0 0 auto;
  margin: 0;
  min-height: 2.15rem;
  padding: 0.38rem 0.85rem;
  font-size: 0.82rem;
}

.pc-section-danger {
  border-color: rgba(220, 70, 90, 0.28);
  background: rgba(120, 30, 45, 0.12);
}

.pc-section-danger .pc-fold-title {
  color: #f0a0ad;
}

.pc-danger-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.pc-danger-actions .btn {
  min-height: 2.05rem;
}

.pc-profile-active {
  margin: 0.15rem 0 0.15rem;
  font-size: 0.74rem;
  color: var(--text-muted);
}

.pc-profile-active strong {
  color: var(--text);
  font-weight: 600;
}

.pc-profile-config-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.55rem 0.75rem;
  margin-top: 0.45rem;
}

.pc-profile-config-preset {
  flex: 1 1 11rem;
  min-width: 0;
  margin: 0;
}

.pc-profile-config-actions {
  flex: 0 0 auto;
  display: flex;
  align-items: flex-end;
}

.pc-profile-config-actions .btn {
  min-height: 2.15rem;
  white-space: nowrap;
}

.pc-config-override-badge {
  display: inline-flex;
  align-items: center;
  margin-left: 0.35rem;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: #9ad4ff;
  border: 1px solid rgba(0, 180, 255, 0.35);
  background: rgba(0, 140, 220, 0.12);
}

.pc-config-override-badge[hidden] {
  display: none !important;
}

@media (max-width: 720px) {
  .pc-net-grid {
    grid-template-columns: 1fr;
  }

  .pc-machine-specs {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .pc-spec-wide {
    grid-column: span 2;
  }
}

@media (max-width: 520px) {
  .pc-machine-edit {
    grid-template-columns: 1fr;
  }

  .pc-machine-specs {
    grid-template-columns: 1fr;
  }

  .pc-spec-wide {
    grid-column: auto;
  }
}

.pc-config-lead {
  margin: 0;
}

.pc-config-preset-field {
  display: block;
  margin: 0 0 0.75rem;
  max-width: 28rem;
}

@media (max-width: 720px) {
  .pc-overview-grid {
    grid-template-columns: 1fr;
  }

  .pc-section {
    height: auto;
  }

  .pc-section-wide .pc-kv {
    grid-template-columns: 1fr;
  }

  .pc-kv > div {
    grid-template-columns: 5.5rem 1fr;
  }

  .modal-card-pc .modal-body-scroll {
    max-height: calc(90vh - 6.5rem);
  }

  .modal-head-pc {
    align-items: flex-start;
  }

  .modal-head-toolbar,
  .pc-head-toolbar {
    width: 100%;
    margin-left: 0;
    justify-content: flex-end;
  }

  .pc-head-toolbar-danger {
    border-right: 0;
    padding-right: 0;
    margin-right: 0;
    padding-bottom: 0.35rem;
    margin-bottom: 0.15rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    width: 100%;
    justify-content: flex-start;
  }

  .modal-footer-sticky .modal-actions,
  .modal-footer-sticky .pc-config-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .modal-footer-sticky .pc-actions-cluster,
  .modal-footer-sticky .pc-actions-cluster--start,
  .modal-footer-sticky .pc-actions-cluster--end {
    width: 100%;
    margin-left: 0;
    justify-content: stretch;
  }

  .modal-footer-sticky .pc-actions-cluster--end {
    order: 1;
  }

  .modal-footer-sticky .pc-actions-cluster--start {
    order: 2;
  }

  .modal-footer-sticky .pc-actions-cluster .btn {
    flex: 1 1 auto;
    width: auto;
  }

  .modal-footer-sticky .pc-actions-spacer {
    display: none;
  }

  .modal-footer-sticky .pc-actions-remote {
    flex-direction: column;
    align-items: stretch;
    gap: 0.35rem;
  }

  .modal-footer-sticky .pc-actions-remote-head {
    width: 100%;
    border-right: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding: 0.05rem 0.15rem 0.35rem;
    margin: 0;
    justify-content: flex-start;
  }

  .modal-footer-sticky .pc-actions-remote.is-collapsed .pc-actions-remote-head {
    border-bottom: 0;
    padding-bottom: 0;
  }

  .modal-footer-sticky .pc-actions-remote-body {
    width: 100%;
    gap: 0.35rem;
  }

  .modal-footer-sticky .pc-actions-remote-group {
    flex: 1 1 auto;
  }

  .modal-footer-sticky .pc-actions-remote-sep {
    display: none;
  }

  .modal-footer-sticky .pc-actions-remote .btn {
    flex: 1 1 calc(50% - 0.2rem);
  }

  .modal-footer-sticky .btn {
    flex: 1 1 auto;
  }
}

.pc-config-panel {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}

.pcs-view-head {
  margin-bottom: 1rem;
  align-items: flex-end;
}

.pcs-view-head .header-actions {
  gap: 0.55rem;
}

.pcs-section-tabs,
.apps-section-tabs,
.setup-section-tabs,
.maps-section-tabs,
.security-section-tabs {
  margin: 0 0 1.1rem;
}

.pcs-section-tabs {
  max-width: 28rem;
}

.apps-section-tabs {
  max-width: 22rem;
}

.setup-section-tabs {
  max-width: 20rem;
}

.maps-section-tabs {
  max-width: 16rem;
}

.security-section-tabs {
  max-width: 16rem;
}

#setup-panel-config {
  display: flex;
  flex-direction: column;
  gap: 1.15rem;
}

#setup-panel-config[hidden] {
  display: none;
}

.setup-view-head {
  margin-bottom: 1rem;
  align-items: flex-end;
}

.setup-view-head .header-actions {
  gap: 0.55rem;
}

.setup-steps {
  list-style: none;
  margin: 0 0 1.35rem;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.setup-steps > li {
  display: grid;
  grid-template-columns: 2rem 1fr;
  gap: 0.75rem;
  align-items: start;
}

.setup-step-num {
  display: grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  border-radius: 10px;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text);
  background: rgba(0, 153, 153, 0.22);
  border: 1px solid var(--border-subtle);
}

.setup-steps strong {
  display: block;
  margin: 0.1rem 0 0.2rem;
  font-size: 0.95rem;
}

.setup-steps p {
  margin: 0;
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.45;
}

.setup-steps a {
  color: var(--accent-cyan);
}

.setup-section {
  margin: 0 0 1.25rem;
  padding: 1.1rem 1.2rem;
  background: rgba(35, 35, 60, 0.78);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}

.setup-kv {
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.setup-kv > div {
  display: grid;
  grid-template-columns: minmax(7.5rem, 11rem) 1fr;
  gap: 0.55rem 1rem;
  align-items: start;
}

.setup-kv dt {
  margin: 0.35rem 0 0;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.setup-kv dd {
  margin: 0;
  min-width: 0;
}

.setup-kv dd > code {
  display: inline-block;
  word-break: break-all;
  font-size: 0.82rem;
  padding: 0.45rem 0.6rem;
  border-radius: 10px;
  border: 1px solid var(--border-subtle);
  background: rgba(0, 0, 40, 0.35);
}

.setup-copy-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.setup-copy-row code {
  flex: 1 1 12rem;
  min-width: 0;
}

.setup-advanced {
  margin: 0 0 0.5rem;
  padding: 0.75rem 0.9rem;
  border-radius: var(--radius);
  border: 1px solid var(--border-subtle);
  background: rgba(0, 0, 40, 0.22);
}

.setup-advanced > summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--text);
  list-style: none;
}

.setup-advanced > summary::-webkit-details-marker {
  display: none;
}

.setup-advanced > summary::before {
  content: "▸";
  display: inline-block;
  margin-right: 0.45rem;
  color: var(--accent-teal);
  transition: transform 0.15s ease;
}

.setup-advanced[open] > summary::before {
  transform: rotate(90deg);
}

.setup-advanced .inline-form {
  margin-top: 0.85rem;
}

.setup-advanced .code-block {
  margin-top: 0.65rem;
  max-height: 320px;
}

#config-preset-table tr.setup-preset-row {
  cursor: pointer;
}

#config-preset-table tr.setup-preset-row:hover td {
  background: rgba(0, 153, 153, 0.08);
}

#config-preset-table tr.setup-defaults-row td:first-child strong {
  color: var(--accent-teal);
}

@media (max-width: 720px) {
  .setup-kv > div {
    grid-template-columns: 1fr;
    gap: 0.3rem;
  }

  .setup-section-tabs {
    max-width: none;
  }

  .setup-view-head {
    align-items: stretch;
  }
}

.apps-view-head .header-actions {
  gap: 0.55rem;
}

.apps-profile-filter-label {
  display: inline-flex;
  flex-direction: column;
  gap: 0.2rem;
  margin: 0;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.apps-profile-filter-label .inline-select {
  min-width: 12rem;
  text-transform: none;
  letter-spacing: normal;
  font-weight: 500;
}

.pc-tabs {
  display: flex;
  gap: 0.35rem;
  margin: 0 0 1rem;
  padding: 0.2rem;
  border-radius: 12px;
  background: rgba(0, 0, 40, 0.35);
  border: 1px solid var(--border-subtle);
}

.pc-tab {
  flex: 1;
  font: inherit;
  font-weight: 600;
  padding: 0.55rem 0.75rem;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: color 0.15s, background 0.15s;
}

.pc-tab:hover {
  color: var(--text);
}

.pc-tab:focus-visible {
  outline: 2px solid rgba(0, 204, 204, 0.65);
  outline-offset: 1px;
  color: var(--text);
}

.pc-tab.is-active {
  background: rgba(0, 204, 204, 0.16);
  color: var(--text);
}

.pc-tab-panel[hidden] {
  display: none !important;
}

.pc-config-form {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  margin: 0.75rem 0 1rem;
}

.pc-config-form fieldset {
  margin: 0;
  padding: 0.75rem 0.85rem 0.9rem;
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  background: rgba(0, 0, 40, 0.22);
}

.pc-config-form legend {
  padding: 0 0.35rem;
  color: var(--accent-teal);
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.pc-config-form label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.pc-config-form .field-hint {
  font-size: 0.75rem;
  line-height: 1.35;
  color: var(--text-muted);
  opacity: 0.85;
}

.pc-config-advanced {
  margin: 0 0 0.85rem;
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 0.35rem 0.75rem 0.75rem;
  background: rgba(0, 0, 40, 0.18);
}

.pc-config-advanced summary {
  cursor: pointer;
  font-weight: 600;
  padding: 0.45rem 0;
  color: var(--text-muted);
}

.pc-config-advanced[open] summary {
  color: var(--text);
}

.pc-config-panel h3 {
  margin: 0;
  font-size: 1rem;
  font-family: var(--display);
}

.pc-config-panel .code-editor {
  width: 100%;
  min-height: 8rem;
  margin: 0.5rem 0 0;
}

.pc-config-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

#pc-config-merged {
  max-height: 220px;
  overflow: auto;
  margin: 0;
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.modal-head h2 {
  margin: 0;
  font-family: Outfit, sans-serif;
  font-size: 1.25rem;
}

.detail-grid {
  display: grid;
  grid-template-columns: minmax(7rem, 34%) 1fr;
  gap: 0.55rem 0.85rem;
  margin: 0;
}

.detail-grid dt {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  align-self: center;
}

.detail-grid dd {
  margin: 0;
  color: var(--text);
  word-break: break-word;
}

.detail-grid dd code {
  font-size: 0.88em;
}

.inline-select,
.detail-grid select,
.inline-input {
  width: 100%;
  max-width: 100%;
  appearance: none;
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  background: rgba(0, 0, 40, 0.45);
  color: var(--text);
  font: inherit;
  padding: 0.45rem 0.65rem;
}

.inline-input::placeholder {
  color: var(--text-muted);
  opacity: 0.75;
}

.cell-muted {
  color: var(--text-muted);
  font-size: 0.9em;
}

.modal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  align-items: center;
  justify-content: flex-end;
  margin-top: 1.15rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.pc-actions-cluster {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
}

.pc-actions-spacer {
  flex: 1 1 0.75rem;
  min-width: 0.5rem;
}

.pc-actions-remote {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: stretch;
  gap: 0.4rem 0.5rem;
  padding: 0.3rem 0.4rem;
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  background:
    linear-gradient(180deg, rgba(0, 204, 204, 0.06), transparent 55%),
    rgba(0, 0, 40, 0.38);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
  transition: padding 0.15s ease, background 0.15s ease;
}

.pc-actions-remote.is-collapsed {
  padding: 0.22rem 0.4rem;
  background: rgba(0, 0, 40, 0.28);
  box-shadow: none;
}

.pc-actions-remote-head {
  display: inline-flex;
  align-items: center;
  align-self: stretch;
  gap: 0.35rem;
  width: auto;
  padding: 0 0.35rem 0 0.15rem;
  margin-right: 0;
  border-right: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  color: var(--accent-cyan);
  white-space: nowrap;
}

.pc-actions-remote.is-collapsed .pc-actions-remote-head {
  border-right: 0;
  padding-right: 0.1rem;
  width: 100%;
}

.pc-actions-remote-head .pc-cmd-icon {
  width: 0.9rem;
  height: 0.9rem;
  opacity: 0.9;
  flex-shrink: 0;
}

.pc-actions-remote-head .pc-fold-chevron {
  width: 1.25rem;
  height: 1.25rem;
  margin-left: 0.15rem;
}

.pc-actions-remote-label {
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--accent-cyan);
  opacity: 0.9;
  line-height: 1.2;
  margin-right: auto;
}

.pc-actions-remote-body {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
}

.pc-actions-remote-body[hidden] {
  display: none !important;
}

.pc-actions-remote-group {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.3rem;
}

.pc-actions-remote-sep {
  width: 1px;
  align-self: stretch;
  min-height: 1.5rem;
  margin: 0 0.1rem;
  background: rgba(255, 255, 255, 0.12);
}

.pc-actions-remote .btn {
  min-height: 2.1rem;
  padding: 0.35rem 0.65rem;
  font-size: 0.84rem;
}

.pc-actions-remote .btn .pc-cmd-icon {
  width: 0.95rem;
  height: 0.95rem;
  flex-shrink: 0;
  opacity: 0.92;
}

.pc-actions-remote .btn .btn-label {
  line-height: 1.2;
}

.pc-actions-remote .btn.is-pending .pc-cmd-icon {
  animation: pc-cmd-pulse 1.1s ease-in-out infinite;
}

.pc-actions-danger {
  margin-left: 0;
}

.btn.is-pending {
  border-color: rgba(255, 180, 60, 0.5);
  color: #ffd28a;
  background: rgba(255, 170, 40, 0.12);
  box-shadow: inset 0 0 0 1px rgba(255, 180, 60, 0.12);
}

.btn.is-busy {
  opacity: 0.78;
  cursor: wait;
}

.btn.is-busy.btn-with-icon::after {
  content: "";
  width: 0.7rem;
  height: 0.7rem;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: pc-cmd-spin 0.7s linear infinite;
  flex-shrink: 0;
}

@keyframes pc-cmd-pulse {
  0%,
  100% {
    opacity: 0.55;
  }
  50% {
    opacity: 1;
  }
}

@keyframes pc-cmd-spin {
  to {
    transform: rotate(360deg);
  }
}

.btn:disabled,
.btn[disabled] {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn.is-pending:disabled,
.btn.is-pending[disabled] {
  opacity: 0.85;
}

.btn:disabled:hover,
.btn[disabled]:hover {
  transform: none;
}

.modal-actions:empty {
  display: none;
}

.table-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  justify-content: flex-end;
}

.pc-name-link {
  display: inline;
  padding: 0;
  border: none;
  background: none;
  color: var(--accent-teal);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
}

.pc-name-link:hover {
  text-decoration: underline;
}

.pc-name-link:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--accent-teal) 70%, white);
  outline-offset: 2px;
  border-radius: 4px;
}

.users-split {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(240px, 0.8fr);
  gap: 1rem;
  align-items: start;
}

@media (max-width: 900px) {
  .users-split {
    grid-template-columns: 1fr;
  }
}

/* --- Users page --- */
.users-view-head {
  margin-bottom: 0.85rem;
}

.users-view-head .header-actions {
  gap: 0.55rem;
}

.role-legend {
  list-style: none;
  margin: 0 0 1.15rem;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem 1rem;
}

.role-legend li {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}

.role-legend-desc {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.role-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.22rem 0.55rem;
  border-radius: 8px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  border: 1px solid var(--border-subtle);
  background: rgba(0, 0, 40, 0.35);
  color: var(--text-muted);
  white-space: nowrap;
}

.role-badge.role-superadmin {
  color: #e8b4f5;
  border-color: rgba(196, 90, 212, 0.45);
  background: rgba(155, 38, 182, 0.2);
}

.role-badge.role-admin {
  color: #7dffef;
  border-color: rgba(0, 204, 204, 0.4);
  background: rgba(0, 153, 153, 0.18);
}

.role-badge.role-support {
  color: #ffd28a;
  border-color: rgba(255, 180, 60, 0.4);
  background: rgba(255, 170, 40, 0.12);
}

.role-badge.role-viewer {
  color: var(--text-muted);
  border-color: rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.05);
}

.users-panel .panel-head {
  margin-bottom: 0.65rem;
}

.users-table-wrap {
  margin: 0;
}

.user-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.user-block {
  margin: 0;
  padding: 0.2rem 0.3rem 0.2rem 0.2rem;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(8, 10, 28, 0.55);
  transition: border-color 0.15s ease, background 0.15s ease;
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.user-block:hover {
  border-color: rgba(0, 204, 204, 0.35);
  background: rgba(0, 153, 153, 0.1);
}

.user-block.is-selected,
.user-block-self.is-selected {
  border-color: rgba(0, 204, 204, 0.5);
  background: rgba(0, 153, 153, 0.16);
  box-shadow: none;
}

.user-block-self {
  border-color: rgba(0, 204, 204, 0.22);
  background: rgba(8, 10, 28, 0.55);
}

.user-block-main {
  appearance: none;
  -webkit-appearance: none;
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 0.7rem;
  margin: 0;
  padding: 0.65rem 0.7rem;
  border: 0;
  border-radius: 10px;
  background: transparent !important;
  color: var(--text) !important;
  font: inherit;
  text-align: left;
  cursor: pointer;
  box-shadow: none !important;
}

.user-block-main:hover {
  background: rgba(255, 255, 255, 0.04) !important;
}

.user-block-main:focus-visible {
  outline: 2px solid rgba(0, 204, 204, 0.65);
  outline-offset: 1px;
}

.user-block-summary {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  margin-left: auto;
}

.user-block-open-label {
  flex: 0 0 auto;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--accent-cyan);
  opacity: 0.7;
}

.user-block-main:hover .user-block-open-label {
  opacity: 1;
}

.user-block-chevron {
  display: none;
}

.user-block .btn-user-delete {
  flex: 0 0 auto;
  color: var(--text-muted);
  border-color: transparent;
  background: transparent;
}

.user-block .btn-user-delete:hover:not(:disabled) {
  color: #ff9aa2;
  border-color: rgba(230, 57, 70, 0.35);
  background: rgba(230, 57, 70, 0.12);
  transform: none;
}

.users-list-hint {
  margin: 0.75rem 0 0;
  font-size: 0.82rem;
}

.user-block-top {
  display: none;
}

.user-block-details {
  display: none;
}

.user-detail-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem 0.65rem;
  min-width: 0;
}

.user-detail-label {
  flex: 0 0 4.75rem;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.user-mfa-cell {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
}

.user-cell {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  min-width: 0;
}

.user-avatar {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  border-radius: 10px;
  font-family: var(--display);
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--accent-cyan);
  background: rgba(0, 153, 153, 0.16);
  border: 1px solid rgba(0, 204, 204, 0.28);
}

.user-cell-text {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.35rem 0.55rem;
  min-width: 0;
}

.user-name {
  font-size: 0.98rem;
}

.user-you {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--accent-cyan);
  opacity: 0.9;
}

.user-role-cell {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem 0.55rem;
  min-width: 0;
}

.user-role-cell .user-role-select {
  width: auto;
  min-width: 8.5rem;
  max-width: 11rem;
  padding: 0.35rem 0.55rem;
  font-size: 0.85rem;
}

.btn-sm {
  padding: 0.4rem 0.7rem;
  font-size: 0.82rem;
  border-radius: 8px;
}

.users-empty {
  padding: 0.5rem 0 0.25rem;
}

.users-empty .hint {
  text-align: center;
  margin: -0.35rem 0 0.75rem;
}

.users-secondary {
  display: flex;
  flex-direction: column;
  gap: 0;
}

@media (max-width: 720px) {
  .user-block-details {
    padding-left: 0;
  }

  .user-detail-label {
    flex-basis: 100%;
    margin-bottom: -0.15rem;
  }

  .user-role-cell .user-role-select {
    max-width: none;
    width: 100%;
  }

  .user-block-top {
    align-items: flex-start;
  }
}

.panel-head-title {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 0;
}

.panel-head-hint {
  margin: 0;
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.35;
  font-weight: 500;
}

/* --- Backup & audit page --- */
.security-view-head {
  margin-bottom: 1rem;
}

.security-view-head .header-actions {
  gap: 0.55rem;
}

.security-layout {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

#security-panel-backup[hidden],
#security-panel-audit[hidden] {
  display: none;
}

.security-panel .panel-head {
  align-items: flex-start;
  margin-bottom: 0.75rem;
}

.security-table {
  width: 100%;
  border-collapse: collapse;
}

.security-table th.col-actions {
  width: 1%;
}

.security-table .backup-file {
  font-size: 0.82rem;
  word-break: break-all;
}

.security-table .audit-when {
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.security-table .audit-detail {
  max-width: 22rem;
  word-break: break-word;
}

.security-audit-scroll {
  max-height: min(52vh, 420px);
}

.security-table tbody tr:hover td {
  background: rgba(0, 204, 204, 0.04);
}

.backup-actions {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  justify-content: flex-end;
}

.backup-when {
  white-space: nowrap;
  font-size: 0.88rem;
  color: var(--text-muted);
}

.audit-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem 0.85rem;
  margin: 0 0 0.75rem;
}

.audit-search {
  flex: 1 1 14rem;
  min-width: 12rem;
  max-width: 28rem;
  margin: 0;
}

.audit-search input {
  width: 100%;
  padding: 0.5rem 0.75rem;
}

.audit-filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.audit-table {
  font-size: 0.88rem;
}

.audit-table th,
.audit-table td {
  padding: 0.55rem 0.5rem;
  vertical-align: top;
}

.audit-table tbody tr:nth-child(even) td {
  background: rgba(255, 255, 255, 0.02);
}

.audit-table tbody tr.audit-row-fail td {
  background: rgba(230, 57, 70, 0.06);
}

.audit-table .col-when {
  width: 7.5rem;
}

.audit-table .col-ok {
  width: 4.5rem;
}

.audit-table .col-ip {
  width: 7.5rem;
}

.audit-when {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.audit-when time {
  font-weight: 600;
  color: var(--text);
  font-size: 0.88rem;
}

.audit-when-abs {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.audit-action-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  max-width: 100%;
}

.audit-action-cat {
  flex: 0 0 auto;
  padding: 0.12rem 0.4rem;
  border-radius: 6px;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  background: rgba(0, 0, 40, 0.35);
}

.audit-cat-auth .audit-action-cat {
  color: #7dffef;
  border-color: rgba(0, 204, 204, 0.35);
  background: rgba(0, 153, 153, 0.14);
}

.audit-cat-mfa .audit-action-cat {
  color: #e8b4f5;
  border-color: rgba(196, 90, 212, 0.4);
  background: rgba(155, 38, 182, 0.16);
}

.audit-cat-users .audit-action-cat {
  color: #ffd28a;
  border-color: rgba(255, 180, 60, 0.35);
  background: rgba(255, 170, 40, 0.1);
}

.audit-cat-backup .audit-action-cat {
  color: #9ecbff;
  border-color: rgba(100, 160, 255, 0.35);
  background: rgba(70, 130, 220, 0.12);
}

.audit-cat-computers .audit-action-cat {
  color: #8ef0a8;
  border-color: rgba(60, 180, 100, 0.35);
  background: rgba(40, 140, 70, 0.12);
}

.audit-cat-apps .audit-action-cat {
  color: #ffb38a;
  border-color: rgba(255, 140, 80, 0.35);
  background: rgba(220, 100, 40, 0.12);
}

.audit-cat-locations .audit-action-cat {
  color: #c2b4ff;
  border-color: rgba(140, 120, 255, 0.35);
  background: rgba(100, 80, 200, 0.12);
}

.audit-cat-config .audit-action-cat {
  color: #b8d4e8;
  border-color: rgba(120, 160, 190, 0.35);
  background: rgba(80, 120, 150, 0.12);
}

.audit-action-badge code {
  font-size: 0.8rem;
  word-break: break-all;
}

.audit-ip code {
  font-size: 0.78rem;
}

.audit-detail {
  max-width: 18rem;
  word-break: break-word;
  color: var(--text-muted);
  font-size: 0.84rem;
}

.user-edit-head {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
}

.user-edit-head h2 {
  margin: 0;
}

.user-edit-sub {
  margin: 0.15rem 0 0;
}

.user-edit-field {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.user-edit-footer {
  margin-top: 1.1rem;
  justify-content: flex-end;
}

@media (max-width: 720px) {
  .security-view-head .header-actions {
    width: 100%;
  }

  .security-view-head .header-actions .btn {
    flex: 1 1 auto;
  }

  .backup-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .user-block {
    flex-wrap: wrap;
  }

  .user-block-summary {
    margin-left: 0;
    width: 100%;
    padding-left: calc(2rem + 0.7rem);
  }

  .user-block .btn-user-delete {
    width: 100%;
  }
}

.mfa-setup-box {
  margin-top: 0.85rem;
  padding: 0.95rem 1rem;
  border-radius: 12px;
  border: 1px solid var(--border-subtle);
  background: rgba(0, 0, 40, 0.28);
}

.mfa-setup-lead {
  margin-bottom: 0.75rem;
}

.mfa-secret-dl {
  margin: 0.75rem 0;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.mfa-secret-dl > div {
  display: grid;
  grid-template-columns: 4.5rem 1fr;
  gap: 0.4rem 0.75rem;
  align-items: start;
}

.mfa-secret-dl dt {
  margin: 0.2rem 0 0;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.mfa-secret-dl dd {
  margin: 0;
  min-width: 0;
}

.mfa-secret-dl code {
  font-size: 0.82rem;
  word-break: break-all;
}

.mfa-uri-details {
  margin: 0 0 0.75rem;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.mfa-uri-details summary {
  cursor: pointer;
  user-select: none;
}

.mfa-uri-details code {
  display: block;
  margin-top: 0.45rem;
  font-size: 0.78rem;
  word-break: break-all;
}

.mfa-code-field {
  max-width: 12rem;
}

.mfa-code-field input {
  letter-spacing: 0.12em;
  font-variant-numeric: tabular-nums;
}

.mfa-setup-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 0.75rem;
}

.modal-card-user {
  width: min(480px, 100%);
  max-height: min(92vh, 900px);
  display: flex;
  flex-direction: column;
}

.modal-card-user .user-edit-body {
  overflow: auto;
  flex: 1 1 auto;
  padding-right: 0.15rem;
}

.user-modal-lead {
  margin: 0 0 0.25rem;
}

.user-password-grid {
  margin: 0;
}

.pw-generate-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.55rem 0.85rem;
  margin: 0.55rem 0 0;
}

.pw-generate-hint {
  margin: 0;
}

.pw-generated {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.55rem;
  margin: 0.65rem 0 0;
  padding: 0.65rem 0.75rem;
  border-radius: 10px;
  border: 1px solid rgba(0, 204, 204, 0.28);
  background: rgba(0, 153, 153, 0.1);
}

.pw-generated[hidden] {
  display: none;
}

.pw-generated-value {
  flex: 1 1 12rem;
  min-width: 0;
  font-size: 0.92rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  word-break: break-all;
  color: var(--text);
  user-select: all;
}

.user-edit-body {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.user-edit-section {
  padding: 0.85rem 0 0;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.user-edit-section:first-child {
  padding-top: 0;
  border-top: 0;
}

.user-edit-section-title {
  margin: 0 0 0.55rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.user-edit-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
  margin-bottom: 0.45rem;
}

.user-edit-section-head .user-edit-section-title {
  margin: 0;
}

.stack-form .form-actions {
  margin-top: 0.85rem;
  justify-content: flex-end;
}

@media (max-width: 720px) {
  .users-table .table-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .users-table .table-actions .btn {
    width: 100%;
  }

  .user-role-cell .user-role-select {
    max-width: none;
    width: 100%;
  }

  .role-legend {
    gap: 0.45rem 0.75rem;
  }

  .mfa-secret-dl > div {
    grid-template-columns: 1fr;
    gap: 0.2rem;
  }
}

.stack-form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.stack-form label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

body.role-viewer .admin-only,
body.role-support .admin-only {
  display: none !important;
}

body.role-viewer .support-ops {
  display: none !important;
}

body.role-viewer .superadmin-only,
body.role-support .superadmin-only,
body.role-admin:not(.role-superadmin) .superadmin-only {
  display: none !important;
}

body.role-viewer .pc-config-form input,
body.role-viewer .pc-config-form select,
body.role-viewer .pc-config-form textarea,
body.role-viewer #config-preset-json,
body.role-viewer #pc-config-json,
body.role-viewer #app-form input,
body.role-viewer #app-form select,
body.role-viewer #app-form textarea,
body.role-viewer #profile-form input,
body.role-viewer #profile-form select,
body.role-viewer #plant-form input,
body.role-viewer #building-form input,
body.role-viewer #building-form select,
body.role-viewer #pc-detail-body input,
body.role-viewer #pc-detail-body select,
body.role-support .pc-config-form input,
body.role-support .pc-config-form select,
body.role-support .pc-config-form textarea,
body.role-support #config-preset-json,
body.role-support #pc-config-json,
body.role-support #app-form input,
body.role-support #app-form select,
body.role-support #app-form textarea,
body.role-support #profile-form input,
body.role-support #profile-form select,
body.role-support #plant-form input,
body.role-support #building-form input,
body.role-support #building-form select,
body.role-support #pc-detail-body input,
body.role-support #pc-detail-body select {
  pointer-events: none;
  opacity: 0.75;
}

.icon-user-plus {
  width: 1.1rem;
  height: 1.1rem;
  display: inline-block;
  flex-shrink: 0;
  vertical-align: -0.15em;
}

.panel-head-with-icon {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}

.btn-with-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
}

.btn-with-icon .icon-user-plus,
.btn-with-icon .icon-refresh {
  width: 1.05rem;
  height: 1.05rem;
  flex-shrink: 0;
}

.btn-icon-only {
  padding: 0.45rem;
  min-width: 2.25rem;
  justify-content: center;
}

.btn-icon-only.btn-with-icon {
  gap: 0;
}

.nav-btn .nav-icon {
  width: 1rem;
  height: 1rem;
  margin-right: 0.35rem;
  flex-shrink: 0;
}

/* --- Building floor plan --- */
.building-floorplan {
  margin-top: 1.25rem;
  padding-top: 1.15rem;
  border-top: 1px solid var(--border);
}

.building-floorplan.is-expanded {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  min-height: 0;
  flex: 1;
}

.building-floorplan-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1rem;
  margin-bottom: 0.55rem;
  flex-wrap: wrap;
}

.building-floorplan.is-expanded .building-floorplan-head {
  margin-bottom: 0;
}

.floorplan-head-title {
  min-width: 0;
  flex: 1 1 12rem;
}

.building-floorplan-head h3 {
  margin: 0 0 0.15rem;
  font-family: var(--display);
  font-size: 1.05rem;
}

.building-floorplan-head .hint {
  margin: 0;
  font-size: 0.78rem;
}

.floorplan-head-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.45rem;
  flex-shrink: 0;
}

.floorplan-mode-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.15rem;
  padding: 0.15rem;
  border-radius: 999px;
  border: 1px solid var(--border-subtle);
  background: rgba(0, 0, 40, 0.4);
  flex-shrink: 0;
}

.floorplan-mode-toggle .chip {
  border: none;
  background: transparent;
  padding: 0.3rem 0.7rem;
  line-height: 1.2;
}

.floorplan-mode-toggle .chip:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.05);
}

.floorplan-mode-toggle .chip.active {
  color: var(--text);
  background: rgba(0, 153, 153, 0.32);
  box-shadow: inset 0 0 0 1px rgba(0, 204, 204, 0.35);
}

.building-floorplan-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem 0.5rem;
  margin-bottom: 0.6rem;
  padding: 0.4rem 0.55rem;
  border-radius: 10px;
  border: 1px solid color-mix(in srgb, var(--border-subtle) 80%, transparent);
  background: rgba(255, 255, 255, 0.03);
}

.building-floorplan.is-expanded .building-floorplan-toolbar {
  margin-bottom: 0;
}

.building-floorplan-toolbar[hidden] {
  display: none !important;
}

.building-floorplan-toolbar .hint {
  margin: 0;
  font-size: 0.75rem;
}

.floorplan-upload-btn {
  cursor: pointer;
}

.building-floorplan-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(156px, 200px);
  gap: 0.75rem;
  align-items: stretch;
}

.building-floorplan.is-expanded .building-floorplan-body {
  flex: 1;
  min-height: 0;
  grid-template-columns: minmax(0, 1fr) minmax(180px, 220px);
}

.floorplan-map-wrap {
  position: relative;
  min-height: 360px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background:
    radial-gradient(ellipse 55% 45% at 50% 42%, rgba(0, 153, 153, 0.07), transparent 68%),
    rgba(8, 10, 28, 0.55);
  overflow: hidden;
  touch-action: none;
}

.floorplan-map-wrap.has-image {
  height: min(64vh, 620px);
}

.building-floorplan.is-expanded .floorplan-map-wrap.has-image {
  height: min(72vh, 780px);
}

.floorplan-map-wrap.is-panning,
.floorplan-map-wrap.is-panning .floorplan-stage {
  cursor: grabbing;
}

.floorplan-map-wrap.has-image:not(.is-panning) .floorplan-stage {
  cursor: default;
}

.floorplan-map-wrap.has-image.is-zoomed:not(.is-panning) .floorplan-stage {
  cursor: grab;
}

.floorplan-map-wrap.is-edit.has-image:not(.is-zoomed) .floorplan-stage {
  cursor: crosshair;
}

.floorplan-zoom {
  position: absolute;
  left: 0.55rem;
  bottom: 0.55rem;
  top: auto;
  z-index: 6;
  display: none;
  align-items: center;
  gap: 0.1rem;
  padding: 0.2rem;
  border-radius: 10px;
  border: 1px solid color-mix(in srgb, var(--border) 85%, transparent);
  background: rgba(14, 16, 34, 0.9);
  backdrop-filter: blur(8px);
  box-shadow: 0 6px 20px rgba(0, 0, 24, 0.4);
}

.floorplan-map-wrap.has-image .floorplan-zoom {
  display: inline-flex;
}

.floorplan-zoom .btn-icon {
  width: 1.75rem;
  height: 1.75rem;
  padding: 0;
  font-size: 0.95rem;
  line-height: 1;
  border-radius: 8px;
}

.floorplan-zoom-label {
  min-width: 2.5rem;
  padding: 0 0.3rem;
  font-size: 0.7rem;
  color: var(--text-muted);
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.building-floorplan.is-expanded .floorplan-map-wrap {
  min-height: min(72vh, 780px);
}

.floorplan-map-wrap.is-edit {
  outline: 1px solid color-mix(in srgb, var(--accent-teal) 45%, transparent);
}

.floorplan-map-wrap.has-image .floorplan-empty,
.floorplan-empty[hidden],
.floorplan-stage[hidden],
.floorplan-info[hidden] {
  display: none !important;
}

.floorplan-empty {
  display: grid;
  place-items: center;
  min-height: 360px;
  height: 100%;
  padding: 1.5rem 1.75rem;
  color: var(--text-muted);
  text-align: center;
  font-size: 0.92rem;
  line-height: 1.45;
}

.building-floorplan.is-expanded .floorplan-empty {
  min-height: min(72vh, 780px);
}

.floorplan-stage {
  position: relative;
  width: 100%;
  height: 100%;
  line-height: 0;
  user-select: none;
  transform-origin: 0 0;
  will-change: transform;
}

.floorplan-stage img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  background: #0a0c1c;
  image-rendering: auto;
}

.building-floorplan.is-expanded .floorplan-stage img {
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
}

.floorplan-markers {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.floorplan-marker {
  position: absolute;
  transform: translate(-50%, -50%);
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.05rem;
  height: 1.05rem;
  padding: 0;
  border-radius: 50%;
  border: 1.5px solid #fff;
  box-shadow: 0 2px 7px rgba(0, 0, 0, 0.45);
  cursor: pointer;
  z-index: 2;
  color: #fff;
  transition: outline-color 0.12s, scale 0.12s;
}

.floorplan-marker-icon {
  width: 0.62rem;
  height: 0.62rem;
  display: block;
  flex-shrink: 0;
  pointer-events: none;
}

.floorplan-marker.is-online {
  background: #2ecf8a;
}

.floorplan-marker.is-offline {
  background: #8a90a8;
}

.floorplan-marker.is-pending {
  background: #e0a23a;
}

.floorplan-marker.is-selected {
  outline: 2px solid var(--accent-cyan);
  outline-offset: 2px;
  z-index: 3;
}

.floorplan-marker.is-dragging {
  cursor: grabbing;
  z-index: 4;
  scale: 1.12;
}

.floorplan-map-wrap.is-edit .floorplan-marker {
  cursor: grab;
}

.floorplan-marker-label {
  position: absolute;
  left: 50%;
  top: calc(100% + 3px);
  transform: translateX(-50%);
  white-space: nowrap;
  font-size: 0.62rem;
  font-weight: 600;
  color: #fff;
  background: rgba(10, 12, 28, 0.84);
  padding: 0.08rem 0.28rem;
  border-radius: 4px;
  pointer-events: none;
  max-width: 8.5rem;
  overflow: hidden;
  text-overflow: ellipsis;
}

.floorplan-info {
  position: absolute;
  right: 0.55rem;
  bottom: 0.55rem;
  z-index: 5;
  width: min(240px, calc(100% - 1.1rem));
  padding: 0.65rem 0.75rem;
  border-radius: 11px;
  border: 1px solid var(--border);
  background: linear-gradient(165deg, rgba(30, 32, 58, 0.94), rgba(16, 18, 36, 0.97));
  backdrop-filter: blur(10px);
  box-shadow: var(--shadow);
}

.floorplan-info-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem;
  margin-bottom: 0.35rem;
}

.floorplan-info-head strong {
  font-size: 0.9rem;
  word-break: break-all;
  line-height: 1.25;
}

.floorplan-info-dl {
  margin: 0;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.15rem 0.55rem;
  font-size: 0.76rem;
}

.floorplan-info-dl dt {
  color: var(--text-muted);
}

.floorplan-info-dl dd {
  margin: 0;
  word-break: break-word;
}

.floorplan-info-actions {
  margin-top: 0.55rem;
}

.floorplan-info-actions .btn {
  width: 100%;
}

.floorplan-pc-list {
  min-width: 0;
  display: flex;
  flex-direction: column;
  min-height: 0;
  gap: 0.35rem;
}

.floorplan-pc-list-head {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 0;
}

.floorplan-pc-list h4 {
  margin: 0;
  font-size: 0.82rem;
  font-weight: 650;
  letter-spacing: 0.01em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.floorplan-pc-list .hint,
.floorplan-pc-list-head .hint {
  margin: 0;
  font-size: 0.72rem;
  line-height: 1.3;
}

.floorplan-pc-list ul {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: min(64vh, 620px);
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  flex: 1;
  min-height: 0;
}

.building-floorplan.is-expanded .floorplan-pc-list ul {
  max-height: min(78vh, 900px);
}

.floorplan-pc-empty {
  margin: 0;
  padding: 0.55rem 0.35rem;
  color: var(--text-muted);
  font-size: 0.78rem;
  line-height: 1.35;
  text-align: center;
}

.floorplan-pc-item {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  width: 100%;
  text-align: left;
  padding: 0.35rem 0.4rem;
  border-radius: 8px;
  border: 1px solid transparent;
  background: rgba(255, 255, 255, 0.03);
  color: inherit;
  cursor: pointer;
  font: inherit;
}

.floorplan-pc-item:hover {
  background: rgba(255, 255, 255, 0.07);
}

.floorplan-pc-item.is-selected {
  border-color: color-mix(in srgb, var(--accent-cyan) 55%, transparent);
  background: rgba(80, 180, 220, 0.1);
}

.floorplan-pc-item.is-placed .floorplan-pc-name::after {
  content: "";
  display: inline-block;
  width: 0.35rem;
  height: 0.35rem;
  margin-left: 0.3rem;
  border-radius: 50%;
  background: var(--accent-teal);
  vertical-align: middle;
}

.floorplan-pc-dot {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  flex-shrink: 0;
}

.floorplan-pc-dot.on {
  background: #2ecf8a;
}

.floorplan-pc-dot.off {
  background: #8a90a8;
}

.floorplan-pc-dot.pending {
  background: #e0a23a;
}

.floorplan-pc-meta {
  display: flex;
  flex-direction: column;
  min-width: 0;
  gap: 0.05rem;
}

.floorplan-pc-name {
  font-weight: 600;
  font-size: 0.78rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.floorplan-pc-sub {
  font-size: 0.66rem;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.floorplan-pc-clear {
  margin-left: auto;
  flex-shrink: 0;
  opacity: 0.7;
}

/* Semi-fullscreen floor plan overlay */
.floorplan-expand-overlay {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: grid;
  place-items: center;
  padding: 1vh 1.25vw;
}

.floorplan-expand-overlay[hidden] {
  display: none !important;
}

.floorplan-expand-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(6, 8, 20, 0.78);
  backdrop-filter: blur(5px);
}

.floorplan-expand-shell {
  position: relative;
  z-index: 1;
  width: min(1280px, 98vw);
  height: min(94vh, 980px);
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  padding: 0.75rem 0.9rem 0.9rem;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: linear-gradient(165deg, rgba(28, 30, 58, 0.99), rgba(14, 16, 34, 0.99));
  box-shadow: var(--shadow);
  animation: fadeIn 0.2s ease;
  overflow: hidden;
}

.floorplan-expand-chrome {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem 0.85rem;
  flex-shrink: 0;
}

.floorplan-expand-chrome-title {
  margin: 0;
  font-family: var(--display);
  font-size: 1.02rem;
}

.floorplan-expand-chrome-hint {
  margin: 0;
  flex: 1;
  min-width: 8rem;
  font-size: 0.78rem;
}

.floorplan-expand-chrome #btn-floorplan-expand-close {
  margin-left: auto;
}

.floorplan-expand-slot {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: auto;
}

.floorplan-expand-slot .building-floorplan.is-expanded #btn-floorplan-expand {
  display: none;
}

.floorplan-expand-slot .building-floorplan.is-expanded #btn-maps-expand {
  display: none;
}

/* --- Maps page --- */
.view-maps .view-head {
  margin-bottom: 1rem;
}

.maps-chrome {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  margin-bottom: 0.55rem;
}

.maps-toolbar {
  display: flex;
  flex-wrap: nowrap;
  align-items: flex-end;
  justify-content: flex-start;
  gap: 0.55rem 0.7rem;
  padding: 0.5rem 0.65rem;
  border-radius: 12px;
  border: 1px solid color-mix(in srgb, var(--border-subtle) 85%, transparent);
  background: rgba(255, 255, 255, 0.03);
}

.maps-toolbar-actions {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 0.45rem;
  flex-shrink: 0;
  padding-bottom: 0.05rem;
}

.maps-toolbar-actions[hidden] {
  display: none !important;
}

.maps-building-label {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  flex: 0 1 auto;
  width: min(24rem, 100%);
  max-width: 26rem;
  min-width: 0;
}

.maps-field-label {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.maps-building-label .inline-select,
.maps-building-select {
  min-width: 0;
  width: 100%;
  max-width: 100%;
}

.maps-mode-hint {
  margin: 0;
  padding-inline: 0.15rem;
  font-size: 0.78rem;
}

.maps-mode-hint[hidden] {
  display: none !important;
}

.maps-floorplan-section {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}

.maps-floorplan-body {
  grid-template-columns: minmax(0, 1fr) minmax(168px, 200px);
  gap: 0;
  border: 1px solid var(--border);
  border-radius: 12px;
  background:
    radial-gradient(ellipse 55% 45% at 42% 40%, rgba(0, 153, 153, 0.06), transparent 68%),
    rgba(8, 10, 28, 0.55);
  overflow: hidden;
}

.maps-floorplan-section .floorplan-map-wrap {
  min-height: min(68vh, 720px);
  border: none;
  border-radius: 0;
  background: transparent;
}

.maps-floorplan-section .floorplan-empty {
  min-height: min(68vh, 720px);
  font-size: 0.95rem;
}

.maps-floorplan-section .floorplan-map-wrap.has-image {
  height: min(74vh, 780px);
}

.maps-floorplan-section .floorplan-stage img {
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
}

.maps-floorplan-section .floorplan-pc-list {
  border-left: 1px solid color-mix(in srgb, var(--border) 90%, transparent);
  background: rgba(0, 0, 28, 0.38);
  padding: 0.65rem 0.55rem 0.55rem;
}

.maps-floorplan-section .floorplan-pc-list-head h4 {
  color: var(--text);
  font-size: 0.78rem;
  letter-spacing: 0.04em;
}

.maps-floorplan-section .floorplan-pc-list ul {
  max-height: min(74vh, 780px);
}

.maps-floorplan-section.is-expanded .maps-floorplan-body {
  flex: 1;
  min-height: 0;
}

.maps-floorplan-section.is-expanded .floorplan-map-wrap,
.maps-floorplan-section.is-expanded .floorplan-empty {
  min-height: min(72vh, 780px);
}

.maps-floorplan-section.is-expanded .floorplan-map-wrap.has-image {
  height: min(78vh, 900px);
}

.maps-floorplan-section.is-expanded .floorplan-pc-list ul {
  max-height: min(78vh, 900px);
}

@media (max-width: 720px) {
  .building-floorplan-body,
  .building-floorplan.is-expanded .building-floorplan-body {
    grid-template-columns: 1fr;
  }

  .floorplan-pc-list ul,
  .building-floorplan.is-expanded .floorplan-pc-list ul {
    max-height: 11rem;
  }

  .building-floorplan-head {
    align-items: flex-start;
  }

  .floorplan-head-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .floorplan-zoom {
    left: 0.45rem;
    bottom: 0.45rem;
  }

  .floorplan-info {
    right: 0.45rem;
    bottom: 3.15rem;
  }

  .floorplan-expand-shell {
    width: 100%;
    height: min(96vh, 100%);
    padding: 0.75rem;
  }

  .building-floorplan.is-expanded .floorplan-map-wrap,
  .building-floorplan.is-expanded .floorplan-empty {
    min-height: 42vh;
  }

  .building-floorplan.is-expanded .floorplan-map-wrap.has-image {
    height: 48vh;
  }

  .maps-toolbar {
    flex-wrap: wrap;
    align-items: stretch;
  }

  .maps-building-label {
    width: min(24rem, 100%);
    max-width: 100%;
  }

  .maps-toolbar-actions {
    width: auto;
    flex-wrap: wrap;
  }

  .maps-floorplan-body {
    grid-template-columns: 1fr;
  }

  .maps-floorplan-section .floorplan-map-wrap,
  .maps-floorplan-section .floorplan-empty {
    min-height: min(52vh, 480px);
  }

  .maps-floorplan-section .floorplan-pc-list {
    border-left: none;
    border-top: 1px solid color-mix(in srgb, var(--border) 90%, transparent);
  }

  .maps-floorplan-section .floorplan-pc-list ul {
    max-height: 11rem;
  }
}

/* --- Shared polish utilities --- */
.panel-stack {
  margin-top: 1rem;
}

.mt-sm {
  margin-top: 0.5rem;
}

.mt-md {
  margin-top: 0.75rem;
}

.gap-sm {
  gap: 0.5rem;
}

.bulk-select-actions {
  margin: 0.5rem 0;
  gap: 0.5rem;
}

.mfa-qr-wrap {
  margin: 0.75rem 0;
}

.mfa-qr-wrap img {
  display: none;
  background: #fff;
  padding: 8px;
  border-radius: 4px;
}

.mfa-qr-wrap img.is-visible {
  display: block;
}

.break-all {
  word-break: break-all;
}

.panel-subhead {
  margin: 0 0 0.5rem;
  font-family: var(--display);
  font-size: 1rem;
  font-weight: 650;
}

.form-block {
  display: block;
  margin-bottom: 0.75rem;
}

.form-block-flush {
  display: block;
}

.add-pc-mode-tabs {
  margin-bottom: 1rem;
}

.col-check {
  width: 2.5rem;
}

.panel-head.mt-md {
  margin-top: 0.75rem;
}

.view-head h1,
.dash-hero h1 {
  letter-spacing: -0.01em;
}

.view-head p,
.dash-subtitle {
  line-height: 1.45;
  max-width: 40rem;
}

.panel-head .group-meta {
  margin-left: 0;
}

@media (max-width: 720px) {
  .view-head,
  .dash-hero,
  .pcs-view-head,
  .apps-view-head,
  .setup-view-head,
  .maps-view-head {
    align-items: stretch;
  }

  .view-head .header-actions,
  .dash-hero > .btn {
    width: 100%;
  }

  .view-head .header-actions .btn,
  .dash-hero > .btn {
    flex: 1 1 auto;
  }

  .pcs-section-tabs,
  .apps-section-tabs,
  .setup-section-tabs,
  .maps-section-tabs,
  .security-section-tabs {
    max-width: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }

  .btn:hover {
    transform: none;
  }

  .view,
  .toast,
  .modal-card,
  .floorplan-expand-shell {
    animation: none;
  }
}

/* --- PC log viewer (Apphub | Heartbeat) --- */
.modal-card-logs {
  display: flex;
  flex-direction: column;
  width: min(960px, 100%);
  max-height: min(92vh, 900px);
  overflow: hidden;
  padding-bottom: 0.85rem;
}

.pc-logs-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem 1rem;
  margin: 0.35rem 0 0.65rem;
}

.pc-logs-toolbar .hint {
  margin: 0;
  flex: 1 1 12rem;
}

.pc-logs-toolbar-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
}

.pc-logs-search {
  min-width: 10rem;
  width: min(16rem, 42vw);
  padding: 0.4rem 0.65rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.25);
  color: var(--text);
  font-size: 0.875rem;
}

.pc-logs-tabs {
  display: flex;
  gap: 0.35rem;
  margin-bottom: 0.65rem;
}

.pc-logs-tab {
  appearance: none;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted, #9aa3b5);
  padding: 0.4rem 0.9rem;
  border-radius: 8px;
  font: inherit;
  font-size: 0.875rem;
  cursor: pointer;
}

.pc-logs-tab.is-active {
  color: var(--text);
  border-color: rgba(255, 255, 255, 0.28);
  background: rgba(255, 255, 255, 0.06);
}

.pc-logs-body {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.pc-logs-status {
  padding: 0.55rem 0.75rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.2);
  color: var(--muted, #9aa3b5);
  font-size: 0.875rem;
}

.pc-logs-status.is-error {
  color: #f0b4b4;
  border-color: rgba(220, 80, 80, 0.35);
}

.pc-logs-status.is-empty {
  color: var(--muted, #9aa3b5);
}

.pc-logs-viewer {
  flex: 1 1 auto;
  min-height: 18rem;
  max-height: min(62vh, 640px);
  margin: 0;
  padding: 0.85rem 1rem;
  overflow: auto;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.35);
  color: #d7dde8;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.78rem;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
}

.pc-logs-viewer mark {
  background: rgba(255, 196, 0, 0.35);
  color: inherit;
  border-radius: 2px;
  padding: 0 0.1em;
}
