/* ==========================================================================
   Design tokens extracted directly from the NextONE site's compiled CSS
   (dark theme HSL variables: background/card/accent/sidebar/font tokens).
   ========================================================================== */
:root {
  --background: 222 47% 6%;
  --foreground: 0 0% 95%;
  --card: 222 40% 10%;
  --card-foreground: 0 0% 95%;
  --primary: 203 73% 63%;
  --primary-foreground: 215 33% 15%;
  --secondary: 215 33% 27%;
  --secondary-foreground: 0 0% 95%;
  --muted: 222 30% 14%;
  --muted-foreground: 220 9% 60%;
  --accent: 190 90% 50%;
  --accent-foreground: 222 47% 6%;
  --destructive: 0 84.2% 60.2%;
  --destructive-foreground: 0 0% 98%;
  --border: 222 30% 18%;
  --ring: 190 90% 50%;
  --radius: 0.75rem;

  --sidebar-background: 222 47% 6%;
  --sidebar-foreground: 0 0% 95%;
  --sidebar-accent: 222 30% 14%;
  --sidebar-accent-foreground: 0 0% 95%;
  --sidebar-primary: 190 90% 50%;
  --sidebar-border: 222 30% 18%;

  --green: 152 60% 45%;
  --amber: 38 92% 55%;

  --font-heading: "Space Grotesk", ui-sans-serif, system-ui, sans-serif;
  --font-body: "Inter", ui-sans-serif, system-ui, sans-serif;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: hsl(var(--background));
  color: hsl(var(--foreground));
  font-family: var(--font-body);
  position: relative;
}

h1, h2, h3 { font-family: var(--font-heading); margin: 0; }

a { color: hsl(var(--accent)); }

/* Recreates the glowing dark tech-background look from the NextONE hero
   images, without shipping their artwork -- soft cyan/blue radial glows
   over the near-black base, plus a faint grid for texture. */
.bg-glow {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(circle at 12% 8%, hsla(190, 90%, 50%, 0.16) 0%, transparent 42%),
    radial-gradient(circle at 88% 12%, hsla(210, 100%, 55%, 0.13) 0%, transparent 38%),
    radial-gradient(circle at 50% 105%, hsla(200, 80%, 55%, 0.10) 0%, transparent 50%),
    radial-gradient(circle at 100% 100%, hsla(190, 90%, 50%, 0.08) 0%, transparent 35%),
    linear-gradient(180deg, hsl(222 47% 6%) 0%, hsl(222 47% 5%) 100%);
}

.bg-glow::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(hsla(0,0%,100%,0.025) 1px, transparent 1px),
    linear-gradient(90deg, hsla(0,0%,100%,0.025) 1px, transparent 1px);
  background-size: 42px 42px;
}

/* Login-only "stardust" background (see templates/_stardust_bg.html) --
   same radial glow as nearzero.eu's own page, plus an animated
   connecting-particle canvas instead of the plain pixel grid .bg-glow::after
   uses everywhere else. Positioning/z-index copied from the live site. */
.glow {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background: radial-gradient(circle, hsla(190, 90%, 50%, 0.16) 0%, transparent 70%);
}
#stardust-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
}

/* ---------- Login ---------- */

.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  z-index: 1;
}

.login-card {
  background: hsl(var(--card) / 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  padding: 2.5rem 2rem;
  width: 320px;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  box-shadow: 0 20px 60px -20px hsla(190, 90%, 50%, 0.25);
}

.login-card h1 {
  font-size: 1.3rem;
  text-align: center;
}

.subtitle {
  margin: 0 0 0.5rem;
  text-align: center;
  color: hsl(var(--muted-foreground));
  font-size: 0.85rem;
}

.login-card label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.85rem;
  color: hsl(var(--muted-foreground));
}

.login-card input {
  background: hsl(var(--background));
  border: 1px solid hsl(var(--border));
  border-radius: 6px;
  padding: 0.55rem 0.6rem;
  color: hsl(var(--foreground));
  font-size: 0.95rem;
}

.login-card input:focus {
  outline: none;
  border-color: hsl(var(--ring));
  box-shadow: 0 0 0 2px hsla(190, 90%, 50%, 0.25);
}

.flash {
  padding: 0.5rem 0.7rem;
  border-radius: 6px;
  font-size: 0.85rem;
}
.flash-error {
  background: hsla(0, 84%, 60%, 0.12);
  color: #ff9aa5;
  border: 1px solid hsla(0, 84%, 60%, 0.35);
}

/* ---------- App shell / sidebar ---------- */

html, body {
  height: 100%;
  overflow: hidden;
}

.app-shell {
  display: flex;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}

.sidebar {
  overflow-y: auto;
  width: 240px;
  flex-shrink: 0;
  background: hsl(var(--sidebar-background) / 0.75);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-right: 1px solid hsl(var(--sidebar-border));
  display: flex;
  flex-direction: column;
  padding: 1.25rem 1rem;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0 0.4rem 1.5rem;
}

.brand-mark {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  background: hsl(var(--sidebar-primary));
  box-shadow: 0 0 12px hsl(var(--sidebar-primary)), 0 0 24px hsl(var(--sidebar-primary) / 0.6);
  flex-shrink: 0;
  animation: brand-pulse 3s ease-in-out infinite;
}

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

.brand-text {
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 0.95rem;
  color: hsl(var(--sidebar-foreground));
  letter-spacing: 0.01em;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  flex: 1;
}

.sidebar-nav a {
  color: hsl(var(--sidebar-foreground) / 0.75);
  text-decoration: none;
  font-size: 0.88rem;
  padding: 0.55rem 0.7rem;
  border-radius: 8px;
  border-left: 2px solid transparent;
  transition: background 0.15s ease, color 0.15s ease;
}

.sidebar-nav a:hover {
  background: hsl(var(--sidebar-accent));
  color: hsl(var(--sidebar-foreground));
}

.sidebar-nav a.active {
  background: hsl(var(--sidebar-accent));
  color: hsl(var(--sidebar-primary));
  border-left: 2px solid hsl(var(--sidebar-primary));
  font-weight: 600;
}

/* ---------- Collapsible sidebar nav groups ---------- */

.nav-group-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  color: hsl(var(--sidebar-foreground) / 0.75);
  background: none;
  border: none;
  border-left: 2px solid transparent;
  font: inherit;
  font-size: 0.88rem;
  text-align: left;
  padding: 0.55rem 0.7rem;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.nav-group-toggle:hover {
  background: hsl(var(--sidebar-accent));
  color: hsl(var(--sidebar-foreground));
}

.nav-group.has-active .nav-group-toggle {
  color: hsl(var(--sidebar-foreground));
  font-weight: 600;
}

.nav-group-chevron {
  transition: transform 0.15s ease;
  opacity: 0.6;
  font-size: 0.75rem;
}

.nav-group.open .nav-group-chevron {
  transform: rotate(90deg);
}

.nav-group-items {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  overflow: hidden;
  max-height: 0;
  transition: max-height 0.2s ease;
}

.nav-group.open .nav-group-items {
  max-height: 20rem;
}

.nav-group-items a {
  padding-left: 1.6rem;
  font-size: 0.85rem;
}

.sidebar-footer {
  border-top: 1px solid hsl(var(--sidebar-border));
  padding-top: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.sidebar-user {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 0.4rem;
  font-size: 0.85rem;
}

.user-name { color: hsl(var(--sidebar-foreground)); }

.sidebar-exit {
  text-align: center;
  padding: 0.5rem;
  border-radius: 8px;
  background: hsl(var(--muted));
  color: hsl(var(--sidebar-foreground));
  text-decoration: none;
  font-size: 0.85rem;
}
.sidebar-exit:hover { background: hsl(var(--destructive) / 0.25); color: #ff9aa5; }

.sidebar-toggle {
  display: none;
  position: fixed;
  top: 0.9rem;
  left: 0.9rem;
  z-index: 50;
  background: hsl(var(--card));
  border: 1px solid hsl(var(--border));
  color: hsl(var(--foreground));
  border-radius: 8px;
  width: 38px;
  height: 38px;
  font-size: 1.1rem;
  cursor: pointer;
}

.app-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  overflow: hidden;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.75rem;
  border-bottom: 1px solid hsl(var(--border));
  flex-shrink: 0;
  background: hsl(var(--background) / 0.65);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.topbar h1 {
  font-size: 1.15rem;
  letter-spacing: 0.01em;
}

.content {
  padding: 1.5rem 1.75rem 2.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  max-width: 1100px;
  width: 100%;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}

.content::-webkit-scrollbar { width: 10px; }
.content::-webkit-scrollbar-track { background: transparent; }
.content::-webkit-scrollbar-thumb {
  background: hsl(var(--border));
  border-radius: 999px;
}
.content::-webkit-scrollbar-thumb:hover { background: hsl(var(--muted-foreground) / 0.5); }

@media (max-width: 860px) {
  .sidebar-toggle { display: block; }
  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 40;
    transform: translateX(-100%);
    transition: transform 0.2s ease;
  }
  body.sidebar-open .sidebar { transform: translateX(0); }
  .topbar { padding-left: 3.5rem; }
}

/* ---------- Panels / cards ---------- */

.panel {
  background: hsl(var(--card) / 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  padding: 1.25rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

/* ---------- Modal overlay (per-share restic backup config) ---------- */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: hsl(var(--background) / 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1rem;
}
.modal-overlay.hidden { display: none; }
.modal-box {
  background: hsl(var(--card));
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  padding: 1.5rem;
  width: 100%;
  max-width: 32rem;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px -12px hsl(0 0% 0% / 0.6);
}
.modal-box h2 { margin-top: 0; }

.panel:hover {
  border-color: hsl(var(--accent) / 0.35);
  box-shadow: 0 8px 32px -12px hsl(var(--accent) / 0.15);
}

.panel h2 {
  font-size: 0.85rem;
  margin: 0 0 1rem;
  color: hsl(var(--muted-foreground));
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-family: var(--font-body);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.panel h2::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 2px;
  background: hsl(var(--accent));
  box-shadow: 0 0 6px hsl(var(--accent) / 0.8);
  flex-shrink: 0;
}

.hint {
  margin: -0.5rem 0 0.75rem;
  color: hsl(var(--muted-foreground));
  font-size: 0.85rem;
}

.loading { color: hsl(var(--muted-foreground)); font-size: 0.9rem; }

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
}
@media (max-width: 700px) { .grid-2 { grid-template-columns: 1fr; } }

/* ---------- Pills ---------- */

.pill {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
}
.pill-ok { background: hsla(152, 60%, 45%, 0.15); color: hsl(var(--green)); }
.pill-warn { background: hsla(38, 92%, 55%, 0.15); color: hsl(var(--amber)); }
.pill-bad { background: hsla(0, 84%, 60%, 0.15); color: #ff9aa5; }
.pill-unknown { background: hsla(220, 9%, 60%, 0.15); color: hsl(var(--muted-foreground)); }
.pill-role-admin { background: hsla(190, 90%, 50%, 0.15); color: hsl(var(--accent)); }
.pill-role-readonly { background: hsla(220, 9%, 60%, 0.15); color: hsl(var(--muted-foreground)); }

/* Product license lockdown banner (app.py's gui_locked enforcement) -- same
   amber warning token as .pill-warn, not .pill-bad's red: this is a
   management-plane restriction, not a service outage. */
.panel-locked { border: 1px solid hsla(38, 92%, 55%, 0.4); background: hsla(38, 92%, 55%, 0.08); }
.panel-locked h2 { color: hsl(var(--amber)); }

/* ---------- Segmented control (compact multi-way slider/toggle) ---------- */

.segmented-control {
  position: relative;
  display: inline-flex;
  background: hsl(var(--muted));
  border-radius: 999px;
  padding: 3px;
  gap: 2px;
  width: fit-content;
}
.segmented-control button {
  position: relative;
  z-index: 1;
  border: none;
  background: transparent;
  color: hsl(var(--muted-foreground));
  padding: 0.35rem 1rem;
  border-radius: 999px;
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: color 0.2s ease;
  white-space: nowrap;
}
.segmented-control button.active { color: hsl(var(--accent-foreground)); }
.segmented-control button:hover:not(.active) { color: hsl(var(--foreground)); }
.segmented-slider {
  position: absolute;
  top: 3px;
  bottom: 3px;
  left: 3px;
  border-radius: 999px;
  background: hsl(var(--accent));
  transition: left 0.2s ease, width 0.2s ease;
  z-index: 0;
}

/* ---------- Metric cards (dashboard) ---------- */

.metric-card {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.metric-value {
  font-family: var(--font-heading);
  font-size: 1.8rem;
  font-weight: 600;
}
.metric-sub { color: hsl(var(--muted-foreground)); font-size: 0.8rem; }

.sparkline { width: 100%; height: 48px; display: block; }
.sparkline path.fill { fill: hsla(190, 90%, 50%, 0.15); stroke: none; }
.sparkline path.line { fill: none; stroke: hsl(var(--accent)); stroke-width: 2; }

.gauge-track {
  width: 100%;
  height: 10px;
  border-radius: 999px;
  background: hsl(var(--muted));
  overflow: hidden;
}
.gauge-fill {
  height: 100%;
  border-radius: 999px;
  background: hsl(var(--accent));
  transition: width 0.4s ease;
}
.gauge-fill.gauge-warn { background: hsl(var(--amber)); }
.gauge-fill.gauge-bad { background: hsl(var(--destructive)); }

/* Disk usage panel is a <button> (click opens the per-share breakdown
   overlay) but must look like the plain metric-card content it replaces,
   not a default button. */
.disk-usage-clickable {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  color: inherit;
  cursor: pointer;
}
.disk-usage-clickable:hover .metric-value { color: hsl(var(--accent)); }

/* Indeterminate variant: migrate/cluster actions block server-side for up
   to ~120s (waiting for DRBD promotion + winbind), so there's no real
   percentage to report -- a sliding highlight communicates "still working"
   without implying false precision. */
.gauge-fill.gauge-indeterminate {
  position: relative;
  width: 100% !important;
  background: hsl(var(--muted));
  overflow: hidden;
}
.gauge-fill.gauge-indeterminate::after {
  content: "";
  position: absolute;
  top: 0;
  left: -35%;
  width: 35%;
  height: 100%;
  background: hsl(var(--accent));
  border-radius: 999px;
  animation: gauge-indeterminate-slide 1.3s ease-in-out infinite;
}
@keyframes gauge-indeterminate-slide {
  0% { left: -35%; }
  100% { left: 100%; }
}

.action-progress {
  display: none;
  margin-top: 1rem;
}
.action-progress.active { display: block; }
.action-progress .gauge-track { height: 8px; }
.action-progress-text {
  margin-top: 0.5rem;
  font-size: 0.85rem;
  color: hsl(var(--muted-foreground));
}

/* ---------- Topology ---------- */

.topology {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}
@media (max-width: 640px) { .topology { grid-template-columns: 1fr; } }

.node-card {
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  padding: 1rem;
  background: hsl(var(--background) / 0.4);
}
.node-card.active { border-color: hsl(var(--green)); box-shadow: 0 0 0 1px hsla(152,60%,45%,0.3); }
.node-card.standby { border-color: hsl(var(--amber)); }
.node-card.offline { border-color: hsl(var(--destructive)); opacity: 0.7; }

.node-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}
.node-card-header .node-name { font-weight: 700; font-size: 1.02rem; font-family: var(--font-heading); }

.resource-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.4rem; }
.resource-list li { display: flex; align-items: center; gap: 0.5rem; font-size: 0.85rem; }

/* Dashboard's single active-node summary (architecture doc Section 6.19
   roadmap item 2), replacing the old per-service topology grid there --
   the full topology grid above still exists, just on the Cluster status
   page now. */
.active-node-indicator { display: flex; flex-direction: column; gap: 0.5rem; margin-bottom: 0.5rem; }
.active-node-line { display: flex; align-items: center; gap: 0.6rem; }
.active-node-name { font-weight: 700; font-size: 1.1rem; font-family: var(--font-heading); }
/* .hint's own -0.5rem top margin assumes it directly follows a .panel h2
   (pulling it up under the heading) -- found live, 2026-09-16: reused
   bare on the dashboard's new active-node summary, where it instead
   follows #active-node-indicator, so the negative margin pulled it up
   INTO that div instead, visibly overlapping the two lines. */
.active-node-footer-hint { margin-top: 0; }
/* Same class of bug as .active-node-footer-hint above, found live
   2026-09-25: product_license.html's #license-apply-message/
   #license-activate-message reuse bare .hint right after a <form>, not a
   .panel h2 -- the negative top margin pulled the "License installed..."
   result text up into the upload/activate form above it, visibly
   overlapping the submit button. */
.form-result-hint { margin-top: 0; }

/* ---------- Dashboard Cluster panel: node pair joined by the heartbeat link ---------- */
.cluster-pair { display: flex; align-items: center; justify-content: center; width: 100%; }
.cluster-node {
  flex: 0 0 auto;
  min-width: 9.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  padding: 1rem 1.25rem;
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  background: hsl(var(--background) / 0.4);
}
.cluster-node-name { font-weight: 700; font-size: 1.1rem; font-family: var(--font-heading); }
.cluster-node.cn-active { border-color: hsl(var(--green)); box-shadow: 0 0 0 1px hsla(152,60%,45%,0.3); }
.cluster-node.cn-standby { border-color: hsl(var(--amber)); }
.cluster-node.cn-offline { border-color: hsl(var(--destructive)); opacity: 0.7; }

/* The heartbeat link is a real <button>: keyboard-focusable, and the click target for the
   later drill-down (it fires a "heartbeat:open" event, see renderHeartbeatLink in app.js). */
.heartbeat-link {
  /* Compact on purpose: the two nodes sit close together, the link is only as long as it needs
     to be to read as a heartbeat (it used to stretch across the whole panel). */
  flex: 0 1 15rem;
  min-width: 8rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
  padding: 0.25rem 0.5rem;
  background: none;
  border: 0;
  border-radius: var(--radius);
  color: inherit;
  font: inherit;
  cursor: pointer;
}
.heartbeat-link:hover { background: hsl(var(--muted-foreground) / 0.1); }
.heartbeat-link:focus-visible { outline: 2px solid hsl(var(--green)); outline-offset: 2px; }

.hb-wave { width: 100%; height: 40px; overflow: visible; }
.hb-base, .hb-pulse {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.hb-base { stroke: hsl(var(--green) / 0.35); stroke-width: 2; }
/* pathLength=100 is set in JS, so these dash values are percentages of the line: a bright
   28% segment travels from the left node to the right one, once per beat. */
.hb-pulse {
  stroke: hsl(var(--green));
  stroke-width: 2.75;
  stroke-dasharray: 28 72;
  stroke-dashoffset: 28;
  filter: drop-shadow(0 0 3px hsl(var(--green) / 0.9));
  animation: hb-travel 1.6s linear infinite;
}
@keyframes hb-travel { from { stroke-dashoffset: 28; } to { stroke-dashoffset: -72; } }   /* exactly one lap (100 units) so the loop is seamless */
/* "lub-dub": the whole line and the label dot swell twice per beat, in step with the pulse. */
.hb-ok .hb-base { animation: hb-beat 1.6s ease-in-out infinite; }
@keyframes hb-beat {
  0%, 100% { stroke: hsl(var(--green) / 0.30); }
  12%      { stroke: hsl(var(--green) / 0.95); }
  24%      { stroke: hsl(var(--green) / 0.30); }
  36%      { stroke: hsl(var(--green) / 0.75); }
  50%      { stroke: hsl(var(--green) / 0.30); }
}

.hb-label { font-size: 0.8rem; font-weight: 600; color: hsl(var(--green)); display: inline-flex; align-items: center; gap: 0.4rem; }
.hb-label::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  animation: hb-dot 1.6s ease-in-out infinite;
}
@keyframes hb-dot {
  0%, 100% { transform: scale(0.7); opacity: 0.6; }
  12%      { transform: scale(1.4); opacity: 1; }
  24%      { transform: scale(0.7); opacity: 0.6; }
  36%      { transform: scale(1.2); opacity: 1; }
  50%      { transform: scale(0.7); opacity: 0.6; }
}
.hb-detail { font-size: 0.72rem; color: hsl(var(--muted-foreground)); }

/* Broken link: dashed red, flat, NO beat -- a dead heartbeat must be unmistakable. */
.hb-down .hb-pulse { display: none; }
.hb-down .hb-base { stroke: hsl(var(--destructive)); stroke-dasharray: 6 6; animation: none; }
.hb-down .hb-label { color: #ff9aa5; }
.hb-down .hb-label::before { animation: none; transform: none; opacity: 1; }
/* Unknown (fewer than two nodes reported): muted, no beat. */
.hb-unknown .hb-pulse { display: none; }
.hb-unknown .hb-base { stroke: hsl(var(--muted-foreground) / 0.5); stroke-dasharray: 3 5; animation: none; }
.hb-unknown .hb-label { color: hsl(var(--muted-foreground)); }
.hb-unknown .hb-label::before { animation: none; }

/* Narrow screens: stack the pair, heartbeat runs vertically between the cards. */
@media (max-width: 640px) {
  .cluster-pair { flex-direction: column; }
  .cluster-node { width: 100%; }
  .heartbeat-link { flex: 0 0 auto; width: 100%; padding: 0.25rem 0; }
  .hb-wave { width: 6rem; height: 2rem; margin: 2rem 0; transform: rotate(90deg); }
}

/* Reduced motion (Windows "Animation effects" off, macOS "Reduce motion", ...): drop only the
   MOVEMENT (the travelling pulse, the dot growing). The beat itself stays -- it is the status
   indicator, not decoration -- as a brightness pulse with nothing moving. Found 2026-09-21: with
   everything switched off here the link looked dead even when perfectly healthy. */
@keyframes hb-glow { 0%, 100% { opacity: 0.35; } 12% { opacity: 1; } 24% { opacity: 0.35; } 36% { opacity: 0.85; } 50% { opacity: 0.35; } }
@keyframes hb-dot-soft { 0%, 100% { opacity: 0.5; } 12% { opacity: 1; } 24% { opacity: 0.5; } 36% { opacity: 0.9; } 50% { opacity: 0.5; } }
@media (prefers-reduced-motion: reduce) {
  .hb-ok .hb-pulse { stroke-dasharray: none; filter: none; animation: hb-glow 1.6s ease-in-out infinite; }
  .hb-ok .hb-label::before { animation: hb-dot-soft 1.6s ease-in-out infinite; }
}

.dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.dot-ok { background: hsl(var(--green)); }
.dot-warn { background: hsl(var(--amber)); }
.dot-bad { background: hsl(var(--destructive)); }
.dot-grey { background: hsl(var(--muted-foreground)); }

.res-role { color: hsl(var(--muted-foreground)); font-size: 0.78rem; }

.vip-badge {
  display: inline-block;
  margin-top: 0.5rem;
  font-size: 0.72rem;
  background: hsla(190, 90%, 50%, 0.15);
  color: hsl(var(--accent));
  padding: 0.15rem 0.5rem;
  border-radius: 6px;
}

code {
  background: hsl(var(--muted));
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  font-size: 0.85em;
}

/* ---------- Buttons ---------- */

.actions-row { display: flex; flex-wrap: wrap; gap: 0.6rem; }

.at-time-field { display: flex; align-items: center; gap: 0.3rem; flex-wrap: nowrap; }
.at-time-select { width: 2.6rem; flex: 0 0 auto; padding-left: 0.25rem; padding-right: 0.25rem; }
.at-time-sep { color: hsl(var(--muted-foreground)); font-weight: 600; }

.btn {
  background: hsl(var(--muted));
  color: hsl(var(--foreground));
  border: 1px solid hsl(var(--border));
  border-radius: 8px;
  padding: 0.55rem 1rem;
  font-size: 0.85rem;
  cursor: pointer;
  font-family: var(--font-body);
}
.btn:hover { filter: brightness(1.2); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }

.btn-primary { background: hsl(var(--accent)); color: hsl(var(--accent-foreground)); border-color: transparent; font-weight: 600; }
.btn-danger { background: hsl(var(--destructive)); color: hsl(var(--destructive-foreground)); border-color: transparent; }
.btn-warn { background: hsl(var(--amber)); color: #1a1a1a; border-color: transparent; }
.btn-success { background: hsl(var(--green)); color: #1a1a1a; border-color: transparent; }

.node-actions, .cards-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}
@media (max-width: 640px) { .node-actions, .cards-grid { grid-template-columns: 1fr; } }

.node-actions-card {
  border: 1px solid hsl(var(--border));
  border-radius: 8px;
  padding: 0.85rem;
}
.node-actions-card h3 { margin: 0 0 0.6rem; font-size: 0.9rem; font-family: var(--font-body); font-weight: 600; }

.readonly-note {
  background: hsla(220, 9%, 60%, 0.1);
  border: 1px solid hsl(var(--border));
  border-radius: 8px;
  padding: 0.7rem 0.9rem;
  font-size: 0.85rem;
  color: hsl(var(--muted-foreground));
}

/* ---------- Notifications ---------- */

.notifications.hidden { display: none; }
.hidden { display: none; }

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.9rem 1.2rem;
  margin-bottom: 1rem;
}
@media (max-width: 700px) { .form-grid { grid-template-columns: 1fr; } }

.hint-inline {
  font-weight: 400;
  text-transform: none;
  letter-spacing: normal;
  color: hsl(var(--muted-foreground));
  font-size: 0.78rem;
}

.raw-output {
  background: hsl(var(--background));
  border: 1px solid hsl(var(--border));
  border-radius: 8px;
  padding: 0.85rem;
  font-size: 0.8rem;
  white-space: pre-wrap;
  word-break: break-word;
  margin-top: 0.75rem;
  max-height: 320px;
  overflow-y: auto;
}
#notifications-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.5rem; }

#totp-qr-container {
  background: #fff;
  display: inline-block;
  padding: 1rem;
  border-radius: 8px;
  margin: 0.5rem 0;
}
#totp-qr-container img {
  width: 220px;
  height: 220px;
  display: block;
  image-rendering: pixelated;
}
#notifications-list li {
  padding: 0.6rem 0.75rem;
  border-radius: 8px;
  background: hsla(0, 84%, 60%, 0.08);
  border: 1px solid hsla(0, 84%, 60%, 0.3);
  font-size: 0.85rem;
}

/* ---------- Tables (audit / users) ---------- */

/* Found live: no page ever wrapped its table in a scroll container, so
   a table wider than its panel (long audit "Detail" text, many columns,
   etc.) just overflowed the whole page to the right instead of scrolling
   locally. Every such container in this app follows one naming
   convention -- id="..._-table" (audit-table, users-table, buckets-table,
   sp-table, ...) -- so this single attribute selector covers all of them
   without touching each page's markup individually. */
[id$="-table"] {
  overflow-x: auto;
}

table.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.83rem;
}
table.data-table th {
  text-align: left;
  color: hsl(var(--muted-foreground));
  font-weight: 600;
  padding: 0.5rem 0.6rem;
  border-bottom: 1px solid hsl(var(--border));
  white-space: nowrap;
}
table.data-table td {
  padding: 0.5rem 0.6rem;
  border-bottom: 1px solid hsl(var(--border) / 0.6);
  vertical-align: top;
  max-width: 28rem;
  word-break: break-word;
}
table.data-table tr:hover td { background: hsl(var(--muted) / 0.4); }

/* .status-table -- modifier for .data-table's label/value status-display
   shape (e.g. Storage Performance's "Current" rows), as opposed to
   .data-table's other use (genuine multi-column data grids -- firewall
   rules, license lists). Root cause, found live 2026-09-13: .data-table
   td's own `max-width: 28rem` (needed elsewhere for wrapping long values
   like a full /dev/disk/by-id/... path) makes the browser's AUTO
   table-layout algorithm treat that column as shrink-to-fit-content
   capped at 28rem, rather than stretching to fill the table's remaining
   declared width -- so on a table with few/one row(s), the value
   column's rendered width (and therefore where its left-aligned text
   starts) shifts with every change in the value's own length. table-
   layout: fixed sidesteps the whole auto-sizing algorithm: column widths
   are set ONCE, from the declared/first-row widths only, permanently
   independent of any cell's actual content length after that -- the
   standard, robust fix for exactly this class of bug. Deliberately NOT
   applied to bare .data-table (would force firewall.html's genuine
   4-column Protocol/Port/Source/Purpose grid into equal-width columns,
   a real regression there) -- scoped to this modifier, opt-in per table. */
.status-table { table-layout: fixed; }
.status-table th { width: 11rem; }

.result-ok { color: hsl(var(--green)); }
.result-error { color: #ff9aa5; }
.result-blocked, .result-failed { color: hsl(var(--amber)); }

/* ---------- Forms ---------- */

.form-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  align-items: flex-end;
}
.form-field {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.8rem;
  color: hsl(var(--muted-foreground));
}
.form-field input, .form-field select {
  background: hsl(var(--background));
  border: 1px solid hsl(var(--border));
  border-radius: 6px;
  padding: 0.5rem 0.6rem;
  color: hsl(var(--foreground));
  font-size: 0.88rem;
  font-family: var(--font-body);
}

/* ---------- Toasts ---------- */

#toast-container {
  position: fixed;
  bottom: 1.25rem;
  right: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  z-index: 100;
}
.toast {
  padding: 0.7rem 1rem;
  border-radius: 8px;
  font-size: 0.85rem;
  max-width: 320px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.35);
}
.toast-ok { background: #123825; color: #b7f0cf; border: 1px solid hsla(152,60%,45%,0.4); }
.toast-error { background: #3d151b; color: #ffb3ba; border: 1px solid hsla(0,84%,60%,0.4); }
