/* SiAnalytics Control Room — tema "Orbita" */

:root {
  color-scheme: dark;
  font-family: ui-sans-serif, system-ui, -apple-system, "SF Pro Text", "Segoe UI", sans-serif;
  font-size: 14px;
  color: #dbe7f5;
  background: #05070d;
  --space: #05070d;
  --surface: rgba(12, 22, 42, .78);
  --surface-solid: #0c162a;
  --surface-raised: #11203b;
  --input: #070d19;
  --line: #1f3358;
  --line-strong: #2f4d80;
  --text: #dbe7f5;
  --text-strong: #f2f8ff;
  --muted: #8ea4c2;
  --dim: #5d7aa3;
  --accent: #7fe3ff;
  --accent-strong: #c4f3ff;
  --accent-deep: #0f2a44;
  --glow: rgba(127, 227, 255, .28);
  --green: #5ee8b0;
  --amber: #ffc47a;
  --red: #ff9aa2;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
  --radius: 18px;
  --radius-small: 12px;
  --ease: cubic-bezier(.2, .8, .2, 1);
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { background: var(--space); }
body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(ellipse 80% 60% at 50% 0%, #10203d 0%, transparent 70%),
    radial-gradient(circle at 85% 90%, rgba(70, 60, 160, .18) 0%, transparent 45%),
    var(--space);
  background-attachment: fixed;
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image:
    radial-gradient(1px 1px at 20% 30%, #9fc7ff 50%, transparent 51%),
    radial-gradient(1px 1px at 70% 15%, #c4f3ff 50%, transparent 51%),
    radial-gradient(1px 1px at 40% 80%, #7f9fd0 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 90% 60%, #c4f3ff 50%, transparent 51%),
    radial-gradient(1px 1px at 10% 70%, #9fc7ff 50%, transparent 51%),
    radial-gradient(#1a2a47 1px, transparent 1px);
  background-size: 620px 620px, 540px 540px, 700px 700px, 880px 880px, 460px 460px, 28px 28px;
  opacity: .55;
}
h1, h2, p, dl { margin: 0; }
a { color: var(--accent); text-decoration: none; }
button, input, select, textarea { font: inherit; }
button, select { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .5; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
::selection { background: rgba(127, 227, 255, .3); }

/* Brand */
.brand { display: flex; gap: 12px; align-items: center; }
.brand-mark {
  position: relative;
  display: grid;
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  place-items: center;
  border-radius: 50%;
  border: 2px solid var(--accent);
  background: radial-gradient(circle at 35% 30%, #1d3d66, #08111f 70%);
  box-shadow: 0 0 18px var(--glow), inset 0 0 10px rgba(127, 227, 255, .2);
  color: var(--text-strong);
  font-weight: 760;
  font-size: 14px;
  letter-spacing: -.04em;
}
.brand strong { display: block; font-size: 13px; font-weight: 650; letter-spacing: .16em; text-transform: uppercase; color: var(--text-strong); }
.brand small, .account small { display: block; color: var(--muted); margin-top: 2px; font-size: 12px; }

/* Loading and login */
.initial, .login-layout { min-height: 100vh; display: grid; place-items: center; padding: 22px; }
.initial { color: var(--muted); letter-spacing: .08em; }
.initial::before {
  content: "";
  display: block;
  width: 56px;
  height: 56px;
  margin: 0 auto 18px;
  border-radius: 50%;
  border: 2px solid var(--line);
  border-top-color: var(--accent);
  animation: spin 1.1s linear infinite;
}
.login-layout { position: relative; overflow: hidden; }
.login-layout::before, .login-layout::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  border-radius: 50%;
  pointer-events: none;
}
.login-layout::before { width: 720px; height: 720px; margin: -360px 0 0 -360px; border: 1px dashed var(--line); }
.login-layout::after {
  width: 980px; height: 980px; margin: -490px 0 0 -490px;
  border: 1px solid #13233f; border-top-color: rgba(127, 227, 255, .4);
  animation: spin 60s linear infinite;
}
.login-card {
  position: relative;
  z-index: 1;
  width: min(100%, 410px);
  padding: clamp(24px, 6vw, 36px);
  border: 1px solid var(--line-strong);
  border-radius: 24px;
  background: rgba(10, 18, 34, .85);
  backdrop-filter: blur(18px);
  box-shadow: 0 0 0 1px rgba(127, 227, 255, .05), 0 30px 90px rgba(0, 0, 0, .55), 0 0 60px rgba(127, 227, 255, .08);
  animation: rise .6s var(--ease) both;
}
.login-card h1 { font-size: 24px; letter-spacing: -.03em; margin: 26px 0 22px; }
.login-card form { display: grid; gap: 8px; }
.login-card label { font-weight: 600; font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.login-card input { margin-bottom: 10px; }
.login-card .primary { margin-top: 8px; }

/* Shell: glass top bar + content */
.workspace { min-height: 100vh; display: flex; flex-direction: column; }
.sidebar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 24px;
  min-width: 0;
  min-height: 72px;
  padding: 12px clamp(16px, 3vw, 32px);
  background: rgba(5, 7, 13, .72);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid #15223a;
}
.sidebar nav { display: flex; gap: 6px; margin-inline-start: auto; }
.nav-link {
  display: inline-flex;
  min-height: 40px;
  gap: 9px;
  align-items: center;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-weight: 600;
  transition: color .2s, border-color .2s, background .2s, box-shadow .2s;
}
.nav-link:hover { color: var(--text-strong); border-color: var(--line-strong); }
.nav-link[aria-current="page"] {
  color: var(--accent);
  border-color: var(--accent);
  background: rgba(127, 227, 255, .08);
  box-shadow: 0 0 18px rgba(127, 227, 255, .15);
}
.nodes-icon {
  position: relative;
  width: 15px;
  height: 11px;
  border: 1.5px solid currentColor;
  border-radius: 3px;
}
.nodes-icon::after {
  content: "";
  position: absolute;
  left: 3px;
  right: 3px;
  bottom: -5px;
  border-top: 1.5px solid currentColor;
}
.account { display: flex; align-items: center; gap: 12px; margin: 0; padding: 0 0 0 20px; border-left: 1px solid var(--line); }
.account-label { text-align: right; overflow-wrap: anywhere; max-width: 220px; }
.account-label strong { font-weight: 600; color: var(--text-strong); }
.account-logout { min-height: 38px; }
.content {
  width: 100%;
  max-width: 1480px;
  padding: 28px clamp(16px, 4vw, 48px) 56px;
  margin-inline: auto;
}
.page-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  min-height: 40px;
  margin-bottom: 16px;
}
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 0 14px 0 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--text);
  font-weight: 600;
  transition: border-color .2s, color .2s;
}
.back-link span { color: var(--accent); }
.back-link:hover { border-color: var(--accent); color: var(--text-strong); }
.refresh-tools { margin-inline-start: auto; display: flex; align-items: center; gap: 12px; }
.refresh-tools time { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.refresh-tools time::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-inline-end: 7px;
  border-radius: 50%;
  background: var(--green);
  vertical-align: middle;
  animation: pulse-dot 2.4s ease-in-out infinite;
}

/* Controls */
.button, input, select { min-height: 42px; border: 1px solid var(--line); border-radius: 12px; }
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 16px;
  background: rgba(17, 32, 59, .7);
  color: var(--text-strong);
  font-weight: 600;
  white-space: nowrap;
  transition: background .2s, border-color .2s, color .2s, box-shadow .2s, transform .12s;
}
.button span { color: var(--accent); font-size: 16px; }
.button:hover:not(:disabled) { background: #183056; border-color: var(--line-strong); }
.button:active:not(:disabled) { transform: scale(.98); }
.button.primary {
  min-height: 44px;
  background: var(--accent-deep);
  border-color: var(--accent);
  color: var(--accent);
  box-shadow: 0 0 20px rgba(127, 227, 255, .12);
}
.button.primary:hover:not(:disabled) { background: var(--accent); color: #05070d; box-shadow: 0 0 28px var(--glow); }
.button.danger { background: #3a1820; border-color: #c25b68; color: #ffc2c8; }
.button.danger:hover:not(:disabled) { background: #b84a58; border-color: #e07a86; color: #fff; }
input, select, textarea { padding: 0 12px; background: var(--input); color: var(--text-strong); min-width: 0; transition: border-color .2s, box-shadow .2s; }
input:hover, select:hover, textarea:hover { border-color: var(--line-strong); }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(127, 227, 255, .12); outline: none; }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
input:disabled, select:disabled, textarea:disabled { opacity: .55; cursor: not-allowed; }
input::placeholder, textarea::placeholder { color: #6a83a6; }
input[type="file"] { padding: 9px 12px; }
input[type="file"]::file-selector-button {
  margin-inline-end: 10px;
  padding: 4px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--surface-raised);
  color: var(--text-strong);
  font: inherit;
  cursor: pointer;
}
select option { background: var(--surface-solid); }

/* Headings */
h1 { font-size: clamp(30px, 3.6vw, 40px); font-weight: 650; letter-spacing: -.035em; line-height: 1.12; color: var(--text-strong); }
h2 { font-size: 12px; font-weight: 650; letter-spacing: .16em; text-transform: uppercase; color: var(--muted); }
.view-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

/* Metrics */
.overview { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin: 22px 0; }
.metric {
  position: relative;
  min-width: 0;
  display: grid;
  padding: 16px 18px 14px;
  gap: 6px;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.metric::after {
  content: "";
  position: absolute;
  right: -30px;
  top: -30px;
  width: 90px;
  height: 90px;
  border-radius: 50%;
  border: 1px solid currentColor;
  opacity: .08;
}
.metric span { display: flex; gap: 8px; align-items: center; color: var(--muted); font-size: 12px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; }
.metric strong { font-size: 30px; font-weight: 650; line-height: 1.15; font-variant-numeric: tabular-nums; color: var(--text-strong); }
.metric i, .status::before { width: 7px; height: 7px; background: currentColor; border-radius: 50%; flex: 0 0 7px; box-shadow: 0 0 8px currentColor; }
.metric.online, .metric.online i, .status.online, .status.active, .status.healthy, .status.installed { color: var(--green); }
.metric.offline, .metric.offline i, .status.offline, .status.failed { color: var(--red); }
.metric.degraded, .metric.degraded i, .status.degraded, .status.pending, .status.installing, .status.suspended { color: var(--amber); }
.metric.online strong { color: var(--green); }
.metric.offline strong { color: var(--red); }
.metric.degraded strong { color: var(--amber); }

/* Panels */
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  min-width: 0;
  backdrop-filter: blur(10px);
}
.nodes-panel { margin-top: 22px; }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; padding: 14px 18px; min-height: 60px; }
.panel-head h2 { margin-inline-end: auto; }
.filters { display: flex; gap: 8px; }
.filters input { width: 240px; }
.view-toggle {
  display: inline-flex;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--input);
}
.toggle-option {
  min-height: 34px;
  padding: 0 14px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  transition: background .2s, color .2s;
}
.toggle-option:hover { color: var(--text-strong); }
.toggle-option[aria-pressed="true"] { background: var(--accent-deep); color: var(--accent); box-shadow: inset 0 0 0 1px rgba(127, 227, 255, .5); }

/* Tables */
.table-wrap { overflow: auto; border-top: 1px solid var(--line); border-radius: 0 0 var(--radius) var(--radius); }
table { border-collapse: collapse; width: 100%; text-align: left; }
.nodes-panel table { min-width: 685px; }
th, td { padding: 13px 15px; vertical-align: middle; }
th:first-child, td:first-child { padding-inline-start: 18px; }
th:last-child, td:last-child { padding-inline-end: 18px; }
th { background: rgba(7, 13, 25, .6); color: var(--dim); font-size: 11px; font-weight: 650; letter-spacing: .14em; text-transform: uppercase; }
tbody tr + tr td { border-top: 1px solid rgba(31, 51, 88, .7); }
tbody tr { transition: background .15s; }
#node-rows tr:hover, #node-rows tr:focus-within, #organization-rows tr:hover, #organization-rows tr:focus-within { background: rgba(127, 227, 255, .05); }
#node-rows td:first-child { width: 34%; }
.node-link { display: inline-block; color: var(--accent-strong); font-weight: 650; overflow-wrap: anywhere; }
.node-link:hover { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.node-site { display: block; margin-top: 4px; font-size: 12px; color: var(--muted); overflow-wrap: anywhere; }
.cell-muted { color: var(--muted); }
.version { font-family: var(--mono); font-size: 12px; overflow-wrap: anywhere; }
.status {
  display: inline-flex;
  min-height: 24px;
  align-items: center;
  gap: 7px;
  padding: 2px 10px;
  border: 1px solid currentColor;
  border-radius: 999px;
  background: rgba(5, 7, 13, .5);
  color: #a8b6cc;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.status::before { content: ""; }
.status.unknown, .status.disabled, .status.archived, .status.inactive, .status.not_installed, .status.stopped { color: #a8b6cc; border-color: #3a4a66; }
.empty { color: var(--muted); padding: 28px 18px; }
.panel-head + .empty { border-top: 1px solid var(--line); }
.muted { color: var(--muted); }
.notice {
  padding: 11px 14px;
  border: 1px solid #6b4a2a;
  background: rgba(60, 38, 18, .7);
  color: #ffd9a8;
  border-radius: var(--radius-small);
  line-height: 1.45;
}
.page-notice, .offline-notice { margin-bottom: 16px; }

/* Orbit map */
.orbit {
  --step: 170px;
  --squash: .78;
  --slot-w: 158px;
  --slot-h: 128px;
  position: relative;
  height: calc(var(--rings) * var(--step) * var(--squash) * 2 + var(--slot-h) + 48px);
  min-height: 380px;
  overflow: hidden;
  border-top: 1px solid var(--line);
  background: radial-gradient(ellipse at 50% 50%, rgba(19, 37, 74, .7), transparent 70%);
}
.orbit-items { list-style: none; margin: 0; padding: 0; position: absolute; inset: 0; }
.orbit-core {
  position: absolute;
  left: 50%;
  top: 50%;
  display: grid;
  place-items: center;
  width: 84px;
  height: 84px;
  margin: -42px 0 0 -42px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #1d3d66, #0a1426 70%);
  border: 1px solid var(--line-strong);
  box-shadow: 0 0 40px rgba(127, 227, 255, .15), inset 0 0 24px rgba(127, 227, 255, .12);
  color: var(--text-strong);
  font-size: 24px;
  font-weight: 650;
}
.orbit-core::before {
  content: "";
  position: absolute;
  inset: -12px;
  border-radius: 50%;
  border: 1px solid #16264a;
  border-top-color: rgba(127, 227, 255, .5);
  animation: spin 24s linear infinite;
}
.orbit-core span { position: relative; font-size: 13px; letter-spacing: .18em; text-transform: uppercase; color: var(--accent); }
#node-orbit .orbit-core span { font-size: 22px; letter-spacing: 0; text-transform: none; color: var(--text-strong); }
.orbit-ring {
  position: absolute;
  left: 50%;
  top: 50%;
  width: calc(var(--ring) * var(--step) * 2);
  height: calc(var(--ring) * var(--step) * var(--squash) * 2);
  transform: translate(-50%, -50%);
  border: 1px dashed #1f3358;
  border-radius: 50%;
  pointer-events: none;
}
.orbit-slot {
  position: absolute;
  left: 50%;
  top: 50%;
  width: var(--slot-w);
  transform: translate(-50%, -50%) translate(calc(var(--x) * var(--step)), calc(var(--y) * var(--step) * var(--squash)));
  animation: orbit-in .55s var(--ease) both;
}
.orbit-slot:nth-child(3n + 2) { animation-delay: .05s; }
.orbit-slot:nth-child(3n) { animation-delay: .1s; }
.orbit-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  min-width: 0;
  padding: 10px 8px;
  border-radius: 16px;
  color: var(--text);
  text-align: center;
  transition: transform .25s var(--ease), background .25s;
}
.orbit-item:hover, .orbit-item:focus-visible { transform: scale(1.07); background: rgba(127, 227, 255, .06); }
.orbit-item:focus-visible { outline-offset: 2px; }
.orbit-name { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; font-weight: 650; color: var(--text-strong); }
.orbit-meta { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; color: var(--muted); }
.orbit-item .status { margin-top: 2px; }
.orbit-planet {
  display: grid;
  place-items: center;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, #24477a, #0b1529 75%);
  border: 1px solid #3a5f99;
  color: var(--text-strong);
  font-size: 22px;
  font-weight: 650;
  animation: planet-pulse 3.2s ease-in-out infinite;
}
.orbit-organization:hover .orbit-planet, .orbit-organization:focus-visible .orbit-planet { border-color: var(--accent); }
.orbit-monitor {
  position: relative;
  width: 52px;
  height: 34px;
  margin-bottom: 8px;
  border: 2px solid currentColor;
  border-radius: 6px;
  background: linear-gradient(160deg, rgba(127, 227, 255, .12), transparent 70%);
  box-shadow: 0 0 18px -2px currentColor;
}
.orbit-monitor::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -9px;
  width: 22px;
  height: 5px;
  transform: translateX(-50%);
  border-bottom: 2px solid currentColor;
  border-left: 2px solid currentColor;
  border-right: 2px solid currentColor;
}
.orbit-node { color: #a8b6cc; }
.orbit-node.online, .orbit-node.healthy { color: var(--green); }
.orbit-node.offline, .orbit-node.failed { color: var(--red); }
.orbit-node.degraded, .orbit-node.pending, .orbit-node.installing { color: var(--amber); }
.orbit-node.online .orbit-monitor { animation: monitor-glow 3s ease-in-out infinite; }
.orbit-node .orbit-name { color: var(--text-strong); }

/* Grid fallback: too many entries, or not enough room for the rings */
.orbit[data-rings="grid"] { height: auto; min-height: 0; padding: 18px; background: none; }
.orbit[data-rings="grid"] .orbit-core, .orbit[data-rings="grid"] .orbit-ring { display: none; }
.orbit[data-rings="grid"] .orbit-items { position: static; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.orbit[data-rings="grid"] .orbit-slot { position: static; width: auto; transform: none; }
.orbit[data-rings="grid"] .orbit-item { height: 100%; border: 1px solid var(--line); background: rgba(7, 13, 25, .5); }

@media (max-width: 1240px) {
  .orbit[data-rings="3"] { height: auto; min-height: 0; padding: 18px; background: none; }
  .orbit[data-rings="3"] .orbit-core, .orbit[data-rings="3"] .orbit-ring { display: none; }
  .orbit[data-rings="3"] .orbit-items { position: static; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
  .orbit[data-rings="3"] .orbit-slot { position: static; width: auto; transform: none; }
  .orbit[data-rings="3"] .orbit-item { height: 100%; border: 1px solid var(--line); background: rgba(7, 13, 25, .5); }
}
@media (max-width: 900px) {
  .orbit[data-rings="2"] { height: auto; min-height: 0; padding: 18px; background: none; }
  .orbit[data-rings="2"] .orbit-core, .orbit[data-rings="2"] .orbit-ring { display: none; }
  .orbit[data-rings="2"] .orbit-items { position: static; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
  .orbit[data-rings="2"] .orbit-slot { position: static; width: auto; transform: none; }
  .orbit[data-rings="2"] .orbit-item { height: 100%; border: 1px solid var(--line); background: rgba(7, 13, 25, .5); }
}
@media (max-width: 600px) {
  .orbit[data-rings="1"] { --step: 112px; --squash: .95; --slot-w: 118px; }
  .orbit[data-rings="1"] .orbit-core { width: 64px; height: 64px; margin: -32px 0 0 -32px; }
  .orbit[data-rings="1"] .orbit-core::before { inset: -12px; }
  .orbit[data-rings="1"] .orbit-planet { width: 52px; height: 52px; font-size: 17px; }
  .orbit[data-rings="1"] .orbit-item .status { display: none; }
}
@media (max-width: 380px) {
  .orbit[data-rings="1"] { height: auto; min-height: 0; padding: 14px; background: none; }
  .orbit[data-rings="1"] .orbit-core, .orbit[data-rings="1"] .orbit-ring { display: none; }
  .orbit[data-rings="1"] .orbit-items { position: static; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .orbit[data-rings="1"] .orbit-slot { position: static; width: auto; transform: none; }
  .orbit[data-rings="1"] .orbit-item { height: 100%; border: 1px solid var(--line); background: rgba(7, 13, 25, .5); }
  .orbit[data-rings="1"] .orbit-item .status { display: inline-flex; }
}

/* Node detail — two columns like the Orbita concept */
.crumbs ol { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 0; padding: 0; list-style: none; }
.crumbs li { display: inline-flex; align-items: center; gap: 6px; min-width: 0; }
.crumbs li + li::before { content: "›"; color: var(--dim); }
.crumb-link, .crumb-current {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  max-width: 260px;
  padding: 0 14px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--text);
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.crumb-link:hover { border-color: var(--accent); color: var(--text-strong); }
.crumb-current { border-color: transparent; color: var(--accent); padding-inline: 6px; }
.page-bar:has(#crumbs:not([hidden])) #back { display: none; }

.eyebrow { margin: 0 0 6px; font-size: 12px; font-weight: 600; letter-spacing: .2em; text-transform: uppercase; color: var(--dim); overflow-wrap: anywhere; }
.detail-heading { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; margin-bottom: 20px; }
.detail-heading h1 { overflow-wrap: anywhere; }
.detail-heading #detail-site { display: none; }
.detail-heading .status { font-size: 13px; min-height: 30px; padding-inline: 14px; }
.detail-layout { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 24px; align-items: start; }
.detail-main, .detail-side { display: grid; gap: 16px; min-width: 0; }
.detail-side > .panel, .detail-side > .access-card { margin: 0; }

.node-monitor {
  --tone: var(--accent);
  position: relative;
  display: grid;
  justify-items: center;
  align-content: center;
  min-height: 300px;
  padding: 34px 24px 30px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: radial-gradient(ellipse at 50% 40%, #13254a, #070c18 75%);
  overflow: hidden;
}
.node-monitor.online, .node-monitor.healthy { --tone: var(--green); }
.node-monitor.offline, .node-monitor.failed { --tone: var(--red); }
.node-monitor.pending, .node-monitor.degraded, .node-monitor.installing { --tone: var(--amber); }
.node-monitor.disabled, .node-monitor.unknown, .node-monitor.archived, .node-monitor.suspended,
.node-monitor.stopped { --tone: #a8b6cc; }
.node-monitor-screen {
  width: min(100%, 300px);
  min-height: 176px;
  padding: 18px 20px;
  border: 3px solid var(--tone);
  border-radius: 12px;
  background: linear-gradient(160deg, rgba(127, 227, 255, .08), rgba(3, 6, 12, .9) 70%);
  box-shadow: 0 0 40px color-mix(in srgb, var(--tone) 30%, transparent), inset 0 0 30px color-mix(in srgb, var(--tone) 14%, transparent);
  animation: monitor-on .9s var(--ease) both;
}
.node-monitor-screen ul { display: grid; gap: 7px; margin: 0; padding: 0; list-style: none; font: 12px/1.45 var(--mono); color: var(--tone); }
.node-monitor-screen li { overflow-wrap: anywhere; }
.node-monitor-screen li:last-child::after { content: "▋"; margin-inline-start: 4px; animation: pulse-dot 1s steps(1) infinite; }
.node-monitor-neck { width: 64px; height: 22px; border: 3px solid var(--tone); border-top: 0; }
.node-monitor-base { width: 150px; height: 3px; margin-top: 6px; border-radius: 2px; background: var(--tone); }

.fact-group { display: grid; gap: 10px; }
.fact-group h2 { padding-inline: 2px; }
.fact-tiles { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.fact-tiles .fact {
  display: grid;
  grid-template-columns: none;
  gap: 4px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(7, 13, 25, .55);
}
.fact-tiles .fact dt { font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--dim); }
.fact-tiles .fact dd { font-size: 14px; }

.access-card {
  display: grid;
  gap: 14px;
  padding: 20px;
  border: 1px solid var(--line-strong);
  border-radius: 22px;
  background: rgba(12, 22, 42, .78);
  backdrop-filter: blur(10px);
}
.access-card:not(:has(> .access-block:not([hidden]))) { display: none; }
.access-title { margin: 0; }
.access-block { display: grid; gap: 10px; }
.access-block + .access-block { padding-top: 14px; border-top: 1px solid var(--line); }
.access-block summary { width: fit-content; color: var(--accent); font-weight: 600; cursor: pointer; }
.access-block summary:hover { color: var(--accent-strong); }
.access-primary {
  justify-content: flex-start;
  min-height: 60px;
  padding-inline: 20px;
  border-color: var(--accent);
  border-radius: 16px;
  background: var(--accent-deep);
  color: var(--accent);
  font-size: 16px;
}
.access-primary span { font-family: var(--mono); font-size: 16px; }
.access-primary:hover:not(:disabled) { background: var(--accent); color: #05070d; }
.access-primary:hover:not(:disabled) span { color: #05070d; }
.access-primary:not(:disabled) { animation: ready-glow 2.6s ease-in-out infinite; }
.access-secondary { justify-content: flex-start; min-height: 50px; padding-inline: 18px; border-radius: 14px; }
.portal-open-link::after { content: "↗"; margin-inline-start: 6px; color: inherit; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

.action-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.action-tiles:not(:has(> .action-tile:not([hidden]))) { display: none; }
.action-tile { margin: 0; display: flex; flex-direction: column; }
.action-tile .panel-head { min-height: 0; padding: 14px 16px 6px; flex-direction: column; align-items: stretch; }
.action-tile .panel-head .button { width: 100%; }
.action-tile .health-check-summary { border-top: 0; padding: 6px 16px 14px; font-size: 13px; }
.services-panel table { min-width: 0; }

.facts { display: grid; }
.fact { display: grid; grid-template-columns: minmax(112px, .8fr) minmax(0, 1.2fr); gap: 10px; padding: 12px 18px; border-top: 1px solid rgba(31, 51, 88, .7); }
.fact dt { color: var(--muted); }
.fact dd { margin: 0; overflow-wrap: anywhere; color: var(--text-strong); }
.inventory-panel { margin-top: 14px; }
.inventory-panel table { min-width: 340px; }
@keyframes monitor-on { 0% { opacity: 0; transform: scaleY(.04); } 60% { opacity: 1; transform: scaleY(1.02); } 100% { transform: none; } }
.portal-access-body {
  border-top: 1px solid var(--line);
  display: grid;
  gap: 12px;
  padding: 14px 18px;
}
.portal-access-body summary { width: fit-content; color: var(--accent); font-weight: 600; cursor: pointer; }
.portal-access-body summary:hover { color: var(--accent-strong); }
#portal-access-form { display: grid; gap: 8px; margin-top: 12px; max-width: 580px; }
.portal-address-row { display: flex; gap: 8px; }
.portal-address-row input { flex: 1; }
.health-check-summary { border-top: 1px solid var(--line); padding: 14px 18px; color: var(--muted); }
.health-check-summary .notice { margin-top: 10px; }
.enrollment-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.node-enrollment-body label { display: block; margin-bottom: 6px; font-weight: 600; }
#node-enrollment-value {
  width: 100%;
  padding: 12px;
  resize: vertical;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-small);
  background: #03060c;
  color: var(--accent-strong);
  font: 0.9rem/1.55 var(--mono);
}

/* Dialogs */
dialog {
  width: min(460px, calc(100% - 28px));
  padding: 24px;
  border: 1px solid var(--line-strong);
  border-radius: 22px;
  background: rgba(10, 18, 34, .96);
  color: inherit;
  box-shadow: 0 30px 90px rgba(0, 0, 0, .6), 0 0 50px rgba(127, 227, 255, .08);
}
dialog[open] { animation: dialog-in .35s var(--ease) both; }
dialog::backdrop { background: rgba(2, 4, 9, .78); backdrop-filter: blur(4px); }
dialog h2 { font-size: 19px; font-weight: 650; letter-spacing: -.02em; text-transform: none; color: var(--text-strong); }
dialog p { margin-top: 10px; color: var(--muted); overflow-wrap: anywhere; }
.dialog-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 9px; margin-top: 22px; }
.management-form { display: grid; gap: 8px; }
.management-form label { margin-top: 6px; font-size: 13px; font-weight: 600; color: var(--muted); }
.management-form .dialog-actions { margin-top: 12px; }
.management-form p { margin: 0; }
.credential-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; margin-top: 14px; }
.credential-row input { width: 100%; font-family: var(--mono); color: var(--accent-strong); }
.credential-node { display: inline-flex; align-items: center; }
#credential-message, #credential-expiry { color: var(--accent); }

/* Terminal window */
#terminal-settings-form, #terminal-key-fields, #terminal-password-fields { display: grid; gap: 8px; }
#terminal-host-key {
  width: 100%;
  padding: 10px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-small);
  color: inherit;
  background: var(--input);
  font: 13px/1.5 var(--mono);
}
#terminal-dialog {
  width: min(94vw, 960px);
  padding: 0;
  overflow: hidden;
  border-color: var(--accent);
  background: #03060c;
  box-shadow: 0 0 0 1px rgba(127, 227, 255, .15), 0 0 70px rgba(127, 227, 255, .18), 0 40px 100px rgba(0, 0, 0, .7);
}
#terminal-dialog[open] { animation: terminal-in .6s var(--ease) both; }
.terminal-dialog-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  background: rgba(12, 22, 42, .9);
}
.terminal-dialog-head h2 { font: 600 13px var(--mono); letter-spacing: .04em; color: var(--accent); }
.terminal-dialog-head h2::before { content: "●"; margin-inline-end: 10px; color: var(--green); text-shadow: 0 0 8px currentColor; }
.terminal-dialog-head .button { min-height: 34px; padding-inline: 14px; border-radius: 999px; font-size: 13px; }
#terminal-dialog > .notice { margin: 12px 16px 0; }
#terminal-login-form { max-width: 480px; margin: 22px auto 26px; padding: 0 20px; }
#terminal-screen {
  height: min(64vh, 580px);
  min-height: 220px;
  overflow: hidden;
  margin: 10px;
  border-radius: var(--radius-small);
  background: #0b1120;
  padding: 8px;
  box-shadow: inset 0 0 40px rgba(127, 227, 255, .05);
}
#terminal-screen iframe { width: 100%; height: 100%; border: 0; display: block; }

/* Users */
.users-panel { margin-top: 22px; }
.user-email { display: block; color: var(--muted); overflow-wrap: anywhere; }
.users-panel td:first-child { min-width: 180px; }
.users-panel table { min-width: 900px; }
.user-self { display: block; margin-top: 4px; color: var(--accent); font-size: 12px; }
.user-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.user-actions .button { min-height: 34px; padding-block: 4px; font-size: 13px; }
.flag { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; white-space: nowrap; }
.flag::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.flag.ok { color: var(--green); }
.flag.pending { color: var(--amber); }
.password-row { margin-top: 0; }
.password-row input { font-family: var(--mono); }

/* Second factor (TOTP) */
.mfa-card { width: min(100%, 460px); }
.mfa-card h1 { margin-bottom: 10px; }
.mfa-card #mfa-intro { margin: 0 0 16px; line-height: 1.5; }
.mfa-steps { margin: 0 0 16px; padding-inline-start: 20px; color: var(--muted); line-height: 1.55; }
.mfa-qr { display: grid; place-items: center; margin: 4px auto 16px; }
.mfa-qr svg {
  display: block;
  width: min(100%, 232px);
  height: auto;
  border-radius: var(--radius-small);
  box-shadow: 0 0 0 1px var(--line-strong), 0 0 40px rgba(127, 227, 255, .12);
}
.mfa-qr .qr-light { fill: #ffffff; }
.mfa-qr .qr-dark { fill: #05070d; }
.mfa-facts { display: grid; gap: 8px; margin: 0 0 12px; }
.mfa-facts div { display: grid; gap: 2px; }
.mfa-facts dt { color: var(--muted); font-size: 12px; letter-spacing: .08em; text-transform: uppercase; }
.mfa-facts dd { margin: 0; overflow-wrap: anywhere; }
.mfa-secret { font-family: var(--mono); color: var(--accent-strong); letter-spacing: .06em; user-select: all; }
#mfa-expiry { margin: 0 0 16px; font-size: 12px; }
#mfa-code { font-family: var(--mono); font-size: 20px; letter-spacing: .4em; text-align: center; }
.mfa-card form .button + .button { margin-top: 4px; }

/* Database (read only) */
.database-note { margin: 0; }
.database-layout { display: grid; grid-template-columns: minmax(220px, 280px) minmax(0, 1fr); gap: 18px; margin-top: 22px; align-items: start; }
.database-tables { padding-bottom: 8px; }
.database-table-list { list-style: none; margin: 0; padding: 0 8px; border-top: 1px solid var(--line); display: grid; gap: 2px; padding-top: 8px; }
.database-table-link {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 2px 10px;
  padding: 9px 12px;
  border: 1px solid transparent;
  border-radius: var(--radius-small);
  color: var(--text);
}
.database-table-link strong { font-weight: 600; overflow-wrap: anywhere; }
.database-table-name { grid-column: 1; color: var(--dim); font: 12px var(--mono); overflow-wrap: anywhere; }
.database-count { grid-row: 1 / span 2; grid-column: 2; align-self: center; color: var(--muted); font: 12px var(--mono); font-variant-numeric: tabular-nums; }
.database-table-link:hover { border-color: var(--line-strong); background: rgba(127, 227, 255, .04); }
.database-table-link[aria-current="true"] { border-color: rgba(127, 227, 255, .5); background: var(--accent-deep); color: var(--accent-strong); }
.database-head h2 { flex: 1 1 200px; text-transform: none; letter-spacing: 0; font-size: 14px; color: var(--text-strong); }
.database-head .filters input { width: 220px; }
.database-auto { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; cursor: pointer; }
.database-auto input { min-height: 0; width: 16px; height: 16px; accent-color: var(--accent); }
.database-data table { width: max-content; min-width: 100%; }
.database-data th { white-space: nowrap; font-family: var(--mono); text-transform: none; letter-spacing: 0; }
.database-data td { vertical-align: top; font-size: 13px; }
.database-value { font-family: var(--mono); white-space: nowrap; }
.database-value.expanded { display: block; width: min(60ch, 70vw); white-space: pre-wrap; overflow-wrap: anywhere; }
.database-redacted { color: var(--dim); font-style: italic; white-space: nowrap; }
.database-toggle {
  display: block;
  margin-top: 4px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--accent);
  font-size: 12px;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.database-pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 18px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.database-pager span { color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
@media (max-width: 920px) {
  .database-layout { grid-template-columns: 1fr; }
  .database-head .filters, .database-head .filters input { width: 100%; }
}

/* View transitions */
.zoom-enter { animation: zoom-in .7s var(--ease) both; }
.fade-enter { animation: rise .4s var(--ease) both; }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes zoom-in {
  0% { opacity: 0; transform: scale(.12); filter: blur(8px); }
  60% { opacity: 1; filter: blur(0); }
  100% { opacity: 1; transform: none; filter: none; }
}
@keyframes orbit-in { from { opacity: 0; scale: .5; } to { opacity: 1; scale: 1; } }
@keyframes dialog-in { from { opacity: 0; transform: translateY(16px) scale(.96); } to { opacity: 1; transform: none; } }
@keyframes terminal-in {
  0% { opacity: 0; transform: scale(.3); filter: blur(6px); }
  60% { opacity: 1; filter: blur(0); }
  100% { opacity: 1; transform: none; filter: none; }
}
@keyframes planet-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(127, 227, 255, .35), 0 0 20px rgba(127, 227, 255, .12); }
  50% { box-shadow: 0 0 0 12px rgba(127, 227, 255, 0), 0 0 26px rgba(127, 227, 255, .2); }
}
@keyframes monitor-glow { 0%, 100% { box-shadow: 0 0 14px -4px currentColor; } 50% { box-shadow: 0 0 22px 0 currentColor; } }
@keyframes ready-glow { 0%, 100% { box-shadow: 0 0 14px rgba(127, 227, 255, .12); } 50% { box-shadow: 0 0 28px rgba(127, 227, 255, .35); } }
@keyframes pulse-dot { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* Responsive */
@media (max-width: 920px) {
  .detail-layout { grid-template-columns: 1fr; }
  .nodes-panel table, .nodes-panel tbody { display: block; min-width: 0; }
  .nodes-panel thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  #node-rows tr {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px 14px;
    padding: 14px 18px;
  }
  #node-rows tr + tr { border-top: 1px solid var(--line); }
  #node-rows td { display: block; padding: 0; border: 0; }
  #node-rows td:first-child { grid-column: 1 / -1; width: auto; }
  #node-rows td:not(:first-child)::before {
    display: block;
    content: attr(data-label);
    margin-bottom: 3px;
    font-size: 11px;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--dim);
  }
  .account-label { display: none; }
  .account { padding-left: 14px; }
}

@media (max-width: 670px) {
  .sidebar { flex-wrap: wrap; gap: 10px; padding: 10px 14px; min-height: 0; }
  .sidebar nav { order: 3; width: 100%; margin: 0; overflow-x: auto; }
  .nav-link { padding-inline: 12px; gap: 6px; min-height: 38px; }
  .account { margin-inline-start: auto; padding: 0; border: 0; }
  .account-logout { min-height: 38px; }
  .content { padding: 16px 14px 32px; }
  .overview { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 16px; }
  .metric { padding: 12px 14px; }
  .metric strong { font-size: 24px; }
  .nodes-panel .panel-head { align-items: stretch; flex-direction: column; }
  .filters { width: 100%; flex-wrap: wrap; }
  .filters input { flex: 1 1 140px; width: auto; }
  .view-toggle { align-self: flex-start; }
  .node-monitor { min-height: 240px; padding: 24px 16px; }
  .crumb-link, .crumb-current { max-width: 160px; }
  .inventory-panel table { min-width: 0; table-layout: fixed; }
  .inventory-panel td, .inventory-panel th { padding-inline: 8px; overflow-wrap: anywhere; }
  .panel-head .button, .enrollment-actions { flex: 1 1 auto; }
  .portal-address-row { flex-wrap: wrap; }
  #terminal-dialog { width: calc(100% - 16px); max-height: calc(100% - 16px); }
  #terminal-screen { height: 60vh; margin: 6px; }
}

@media (max-width: 450px) {
  .sidebar .brand small { display: none; }
  .brand strong { font-size: 11px; letter-spacing: .12em; }
}

@media (max-width: 360px) {
  .refresh-tools time { display: none; }
  .sidebar .nodes-icon { display: none; }
}
