[hidden] {
  display: none !important;
}

.portal-nav-button-admin {
  display: none !important;
}

body.is-admin-session .portal-nav-button-admin {
  display: block !important;
}

body:not(.is-admin-session) #adminPanel,
body:not(.is-admin-session) #adminContactsPanel,
body:not(.is-admin-session) #adminDeviceInventoryPanel,
body:not(.is-admin-session) #adminTelemetryPanel,
body:not(.is-admin-session) #adminAnalyticsPanel {
  display: none !important;
}

#claimPanel,
#myDevicesCard {
  display: none !important;
}

.admin-analytics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  margin-top: 24px;
}

.admin-metric {
  min-height: 150px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.62);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.admin-metric span,
.admin-metric small {
  color: var(--soft-ink);
}

.admin-metric strong {
  font-size: clamp(2rem, 5vw, 3.4rem);
  line-height: 1;
  color: var(--accent-2);
}

:root {
  --bg: #e7f2e7;
  --ink: #1f2a2c;
  --accent: #cb5a2e;
  --accent-2: #164b6b;
  --accent-3: #6f7c4d;
  --panel: rgba(255, 255, 255, 0.72);
  --line: rgba(31, 42, 44, 0.14);
  --soft-ink: rgba(31, 42, 44, 0.72);
  --shadow: 0 20px 50px rgba(31, 42, 44, 0.08);
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Avenir Next", "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(111, 124, 77, 0.10), transparent 28%),
    radial-gradient(circle at 80% 14%, rgba(127, 171, 128, 0.12), transparent 22%),
    radial-gradient(circle at bottom right, rgba(22, 75, 107, 0.08), transparent 34%),
    var(--bg);
}

a {
  color: inherit;
}

code, pre {
  font-family: "SFMono-Regular", "Menlo", "Consolas", monospace;
}

.shell {
  max-width: 1120px;
  margin: 0 auto;
  padding: 48px 20px 80px;
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(280px, 0.9fr);
  gap: 22px;
  align-items: stretch;
}

.hero-copy,
.hero-panel {
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--panel);
  backdrop-filter: blur(8px);
  box-shadow: var(--shadow);
}

.hero-copy {
  padding: 30px 28px;
}

.hero-panel {
  padding: 24px;
  position: relative;
  overflow: hidden;
}

.hero-panel::after {
  content: "";
  position: absolute;
  inset: auto -40px -40px auto;
  width: 140px;
  height: 140px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(22, 75, 107, 0.2), transparent 68%);
}

.hero h1,
.guide-hero h1 {
  margin: 0 0 16px;
  max-width: 12ch;
  font-size: clamp(2.8rem, 6vw, 5rem);
  line-height: 0.94;
  letter-spacing: -0.04em;
}

.eyebrow {
  margin: 0 0 12px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.78rem;
  color: var(--accent-2);
}

.lede {
  max-width: 62ch;
  font-size: 1.05rem;
  line-height: 1.6;
  color: var(--soft-ink);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 24px;
}

.button-link,
button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 999px;
  padding: 12px 18px;
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: transform 140ms ease, box-shadow 140ms ease, background 140ms ease;
}

.button-link:hover,
button:hover {
  transform: translateY(-1px);
}

.button-link-primary,
button {
  color: white;
  background: linear-gradient(135deg, var(--accent), #e27d4f);
  box-shadow: 0 12px 24px rgba(203, 90, 46, 0.22);
}

.button-link-secondary {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.66);
  border: 1px solid var(--line);
}

.panel-label,
.card-kicker,
.section-kicker {
  margin: 0 0 10px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent-2);
}

.status-list {
  margin: 0;
  padding-left: 18px;
  line-height: 1.7;
  position: relative;
  z-index: 1;
}

.section-header {
  margin-top: 40px;
}

.section-header h2 {
  margin: 0;
  font-size: clamp(1.8rem, 3vw, 2.6rem);
  letter-spacing: -0.03em;
}

.grid,
.guide-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 18px;
  margin-top: 28px;
}

.card {
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--panel);
  backdrop-filter: blur(8px);
  box-shadow: var(--shadow);
}

.card h3 {
  margin: 0 0 12px;
  font-size: 1.3rem;
  letter-spacing: -0.02em;
}

.card p {
  margin: 0 0 14px;
  line-height: 1.65;
  color: var(--soft-ink);
}

.stack {
  display: grid;
  gap: 14px;
}

.field {
  display: grid;
  gap: 8px;
  font-weight: 600;
  color: var(--ink);
}

.field span {
  font-size: 0.92rem;
  color: var(--accent-2);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 14px;
  font: inherit;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.88);
}

.field textarea {
  resize: vertical;
  min-height: 120px;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: 2px solid rgba(22, 75, 107, 0.22);
  outline-offset: 2px;
}

.button-reset {
  border: 1px solid var(--line);
}

.card ul,
.card ol {
  padding-left: 18px;
  margin: 0;
  line-height: 1.7;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(22, 75, 107, 0.1);
  color: var(--accent-2);
  font-size: 0.92rem;
  font-weight: 600;
}

.claim-panel {
  margin-top: 18px;
}

.claim-success {
  margin-top: 14px;
}

.claim-success p:last-child {
  margin: 10px 0 0;
  color: var(--soft-ink);
}

.device-grid {
  display: grid;
  gap: 14px;
  margin-top: 18px;
}

.device-tile {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.55);
}

.device-thumb {
  width: 88px;
  height: 88px;
  border-radius: 14px;
  object-fit: cover;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.9);
}

.device-meta h4 {
  margin: 0 0 6px;
  font-size: 1.1rem;
}

.device-meta p {
  margin: 0 0 8px;
}

.device-facts {
  display: grid;
  gap: 6px;
  margin: 0 0 12px;
  color: var(--soft-ink);
  font-size: 0.94rem;
}

.device-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.portal-shell {
  max-width: 760px;
  margin: 0 auto;
  padding: 56px 20px 80px;
}


.portal-workspace {
  display: grid;
  gap: 18px;
}

.portal-nav {
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--panel);
  backdrop-filter: blur(8px);
  box-shadow: var(--shadow);
}

.portal-nav-buttons {
  display: grid;
  gap: 10px;
}

.portal-nav-button {
  width: 100%;
  justify-content: flex-start;
  padding: 14px 16px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid var(--line);
  color: var(--ink);
  box-shadow: none;
}

.portal-nav-button.is-active {
  background: linear-gradient(135deg, rgba(22, 75, 107, 0.92), rgba(51, 111, 146, 0.92));
  color: white;
  border-color: rgba(22, 75, 107, 0.72);
}

.portal-panels {
  min-width: 0;
}

.panel-section.is-inactive {
  display: none;
}

.portal-intro {
  margin-bottom: 22px;
  text-align: center;
}

.portal-mark {
  margin: 0 0 10px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent-2);
}

.portal-intro h1 {
  margin: 0;
  font-size: clamp(2.4rem, 8vw, 4.8rem);
  line-height: 0.95;
  letter-spacing: -0.06em;
}

.portal-subtle {
  margin: 14px 0 0;
  color: var(--soft-ink);
  font-size: 1rem;
}

.portal-card {
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--panel);
  backdrop-filter: blur(8px);
  box-shadow: var(--shadow);
}

.portal-card + .portal-card,
.portal-card + .portal-links {
  margin-top: 18px;
}

.portal-card h2 {
  margin: 0 0 12px;
  font-size: clamp(1.6rem, 4vw, 2.4rem);
  letter-spacing: -0.03em;
}

.portal-copy {
  margin: 0 0 14px;
  line-height: 1.65;
  color: var(--soft-ink);
}

.portal-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 16px;
  margin-top: 22px;
}

.portal-link {
  font-weight: 700;
  text-decoration: none;
  color: var(--accent-2);
}

.portal-link:hover {
  text-decoration: underline;
}

.config-status {
  display: none;
}

.claim-divider {
  height: 1px;
  margin: 20px 0 18px;
  background: var(--line);
}

.text-link {
  color: var(--accent-2);
  font-weight: 700;
  text-decoration: none;
}

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

pre {
  overflow-x: auto;
  margin: 14px 0 16px;
  padding: 14px;
  border-radius: 14px;
  background: rgba(31, 42, 44, 0.06);
}

#statusText {
  margin-top: 12px;
  min-height: 1.6em;
}

#authStatus {
  min-height: 1.6em;
}

.guide-shell {
  max-width: 980px;
}

.guide-hero {
  padding: 8px 0 8px;
}

.site-footer {
  margin-top: 34px;
  padding: 18px 4px 0;
  border-top: 1px solid var(--line);
  color: var(--soft-ink);
  font-size: 0.92rem;
}

.site-footer p {
  margin: 0 0 6px;
}

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

  .portal-shell {
    max-width: 880px;
  }

  .hero h1,
  .guide-hero h1 {
    max-width: 14ch;
  }
}

@media (max-width: 640px) {
  .shell {
    padding: 28px 14px 56px;
  }

  .portal-shell {
    padding: 32px 14px 56px;
  }

  .portal-nav {
    padding: 16px;
  }

  .portal-nav-button {
    padding: 12px 14px;
  }

  .hero-copy,
  .hero-panel,
  .card {
    padding: 18px;
  }

  .actions {
    flex-direction: column;
  }

  .button-link,
  button {
    width: 100%;
  }
}

.admin-network-shell {
  display: grid;
  gap: 18px;
  margin-top: 18px;
}

.admin-network-graph-wrap {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.55);
  padding: 10px;
}

.admin-network-graph {
  display: block;
  width: 100%;
  height: auto;
}

.network-edge {
  stroke: rgba(22, 75, 107, 0.5);
  stroke-width: 4;
  cursor: pointer;
}

.network-edge.is-oneway {
  stroke-dasharray: 8 8;
}

.network-edge.is-pending {
  stroke: rgba(203, 90, 46, 0.7);
  stroke-width: 3;
  stroke-dasharray: 10 8;
}

.network-node {
  cursor: pointer;
}

.network-node circle {
  fill: rgba(255, 255, 255, 0.96);
  stroke: rgba(22, 75, 107, 0.35);
  stroke-width: 2;
}

.network-node.is-unclaimed circle {
  stroke: rgba(111, 124, 77, 0.45);
}

.network-node-name,
.network-node-meta {
  text-anchor: middle;
  pointer-events: none;
}

.network-node-name {
  font-size: 14px;
  font-weight: 700;
  fill: var(--ink);
}

.network-node-meta {
  font-size: 12px;
  fill: var(--soft-ink);
}

.admin-pending-list,
.admin-device-stats {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.55);
}

.admin-pending-list p,
.admin-device-stats p {
  margin: 0 0 10px;
}

.admin-pending-list ul {
  margin: 0;
  padding-left: 18px;
  color: var(--soft-ink);
}

.admin-device-list {
  display: grid;
  gap: 10px;
}

.admin-device-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  color: var(--soft-ink);
}

.admin-device-row:first-child {
  padding-top: 0;
  border-top: 0;
}

#adminContactsStatus,
#adminMessageStatus {
  min-height: 1.6em;
}

@media (min-width: 860px) {
  .admin-network-shell {
    grid-template-columns: minmax(0, 1.3fr) minmax(280px, 0.9fr);
    align-items: start;
  }
}

.network-node.is-build-1 circle,
.admin-device-row.is-build-1 {
  border-color: rgba(203, 90, 46, 0.45);
}

.network-node.is-build-1 circle {
  fill: rgba(203, 90, 46, 0.08);
  stroke: rgba(203, 90, 46, 0.55);
}

.network-node.is-build-2 circle {
  fill: rgba(22, 75, 107, 0.08);
  stroke: rgba(22, 75, 107, 0.55);
}

.network-node.is-build-unknown circle {
  fill: rgba(111, 124, 77, 0.06);
  stroke: rgba(111, 124, 77, 0.5);
}

.admin-device-row.is-build-1 {
  box-shadow: inset 4px 0 0 rgba(203, 90, 46, 0.55);
}

.admin-device-row.is-build-2 {
  box-shadow: inset 4px 0 0 rgba(22, 75, 107, 0.55);
}

.admin-device-row.is-build-unknown {
  box-shadow: inset 4px 0 0 rgba(111, 124, 77, 0.5);
}

.admin-device-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.55);
}

.admin-device-table {
  width: 100%;
  min-width: 980px;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.admin-device-table th,
.admin-device-table td {
  padding: 13px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.admin-device-table tbody tr:last-child td { border-bottom: 0; }
.admin-device-table tbody tr:hover { background: rgba(22, 75, 107, 0.05); }

.admin-sort-button {
  padding: 0;
  border: 0;
  color: var(--ink);
  background: transparent;
  font: inherit;
  font-weight: 700;
  white-space: nowrap;
}

.admin-sort-button::after { content: " ↕"; color: var(--soft-ink); }
.admin-sort-button[aria-sort="ascending"]::after { content: " ↑"; color: var(--accent); }
.admin-sort-button[aria-sort="descending"]::after { content: " ↓"; color: var(--accent); }

.admin-device-primary { font-weight: 700; }
.admin-device-secondary { margin-top: 3px; color: var(--soft-ink); font-size: 0.8rem; }
.admin-firmware-value { font-family: "SFMono-Regular", "Menlo", "Consolas", monospace; }


#adminTelemetryStatus {
  min-height: 1.6em;
}

.admin-telemetry-toolbar {
  display: flex;
  justify-content: flex-start;
  margin-bottom: 14px;
}

.admin-telemetry-range-field {
  max-width: 220px;
}

.admin-telemetry-shell {
  display: grid;
  gap: 18px;
}

.admin-telemetry-graph-wrap,
.admin-telemetry-legend,
#adminTelemetryLatest {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.55);
}

.admin-telemetry-graph {
  width: 100%;
  height: auto;
  display: block;
}

.telemetry-grid {
  stroke: rgba(22, 75, 107, 0.12);
  stroke-width: 1;
}

.telemetry-grid.is-vertical {
  stroke-dasharray: 4 6;
}

.telemetry-frame {
  fill: none;
  stroke: rgba(22, 75, 107, 0.18);
}

.telemetry-axis,
.telemetry-empty {
  font-size: 12px;
  fill: var(--soft-ink);
}

.telemetry-line {
  fill: none;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.telemetry-point {
  stroke: white;
  stroke-width: 2;
}

.admin-telemetry-legend {
  display: grid;
  gap: 10px;
}

.telemetry-legend-item {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--soft-ink);
}

.telemetry-swatch {
  width: 14px;
  height: 14px;
  border-radius: 999px;
  flex: 0 0 14px;
}

.admin-traffic-block {
  margin-top: 26px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
}

.admin-traffic-graph {
  display: block;
  width: 100%;
  min-height: 280px;
  overflow: visible;
}

.traffic-bar { fill: var(--accent-2); opacity: 0.84; }
.traffic-bar:hover { fill: var(--accent); opacity: 1; }
.traffic-axis { stroke: var(--line); stroke-width: 2; }
.traffic-axis-label { fill: var(--soft-ink); font-size: 12px; }

.infrastructure-grid {
  display: grid;
  gap: 18px;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.infrastructure-card {
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.58);
}

.infrastructure-card.is-error { border-color: rgba(180, 54, 54, 0.38); }
.infrastructure-card h3 { margin: 0; }
.infrastructure-card-heading,
.headroom-metric-heading {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
}

.headroom-metric { margin-top: 20px; }
.headroom-metric-heading span { color: var(--soft-ink); font-size: 0.88rem; }
.headroom-track {
  height: 10px;
  margin: 8px 0 5px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(31, 42, 44, 0.10);
}
.headroom-fill { display: block; height: 100%; border-radius: inherit; }
.headroom-fill.is-healthy { background: #5f8f63; }
.headroom-fill.is-warning { background: #c48b2a; }
.headroom-fill.is-danger { background: #b43636; }
.headroom-metric small,
.credential-note { color: var(--soft-ink); }


@media (min-width: 980px) {
  .portal-shell {
    max-width: 1220px;
  }

  .portal-workspace {
    grid-template-columns: minmax(220px, 260px) minmax(0, 1fr);
    align-items: start;
  }

  .portal-nav {
    position: sticky;
    top: 24px;
  }
}
