:root {
  color-scheme: dark;
  --bg: #05060d;
  --bg-elevated: #080a16;
  --card-bg: #070a17;
  --card-bg-soft: #0a0d1c;
  --border-dim: #1c2033;
  --text: #f1f5fb;
  --text-dim: #98a2b8;
  --text-faint: #5b6478;

  --purple: #b34af5;
  --purple-soft: #d9a6ff;
  --purple-glow: rgba(179, 74, 245, 0.55);
  --purple-bg: rgba(179, 74, 245, 0.08);

  --cyan: #33d6f0;
  --cyan-glow: rgba(51, 214, 240, 0.5);
  --cyan-bg: rgba(51, 214, 240, 0.08);

  --green: #2be08a;
  --green-glow: rgba(43, 224, 138, 0.5);
  --green-bg: rgba(43, 224, 138, 0.08);

  --red: #ff5470;
  --red-glow: rgba(255, 84, 112, 0.5);
  --red-bg: rgba(255, 84, 112, 0.08);

  --amber: #ffc857;
  --amber-glow: rgba(255, 200, 87, 0.5);
  --amber-bg: rgba(255, 200, 87, 0.08);

  --blue: #4a9dff;
  --blue-glow: rgba(74, 157, 255, 0.5);
  --blue-bg: rgba(74, 157, 255, 0.08);

  /* Example Security's actual brand red, sampled from dashboard.example.com --
     deliberately its own tokens, not reused from --red above, since that's
     the dashboard's own neon-alert red and shouldn't drift if this one changes. */
  --brand-red: #d64537;
  --brand-red-bright: #ec6656;

  --radius: 14px;
  --radius-sm: 8px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

a {
  color: var(--purple-soft);
}

.hidden {
  display: none !important;
}

/* ---------- App shell: sidebar + main ---------- */

.app-shell {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: 100vh;
  align-items: start;
}

@media (max-width: 900px) {
  .app-shell {
    grid-template-columns: 1fr;
  }
  .sidebar {
    position: static;
    height: auto;
  }
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--purple-glow);
  box-shadow: 0 0 30px -10px var(--purple-glow) inset;
  background: linear-gradient(180deg, #0c0620 0%, #06030f 55%, #030207 100%);
  overflow: hidden;
}

.sidebar-inner {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 20px 16px;
  gap: 18px;
}

.brand {
  border: 1px solid var(--purple-glow);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: 0 0 18px -6px var(--purple-glow);
  background: radial-gradient(ellipse at top left, rgba(179, 74, 245, 0.12), transparent 70%);
}

.brand-word {
  font-size: 1.4rem;
  font-weight: 800;
  font-style: italic;
  letter-spacing: -0.02em;
  background: linear-gradient(90deg, #c98bff, #7fe0ff);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: 0 0 18px rgba(179, 74, 245, 0.35);
}

.brand-sub {
  margin-top: 2px;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.28em;
  color: var(--text-dim);
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  color: var(--text-dim);
  text-decoration: none;
  font-size: 0.92rem;
  font-weight: 600;
  border: 1px solid transparent;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.nav-item svg {
  width: 18px;
  height: 18px;
  flex: none;
}

.nav-item:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.03);
}

.nav-item.active {
  color: var(--purple-soft);
  background: var(--purple-bg);
  border-color: var(--purple-glow);
  box-shadow: 0 0 16px -6px var(--purple-glow);
}

.nav-spacer {
  flex: 1;
}

.account-widget {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 2px 12px;
}

.system-status-widget {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--border-dim);
  border-radius: var(--radius);
  padding: 14px;
  background: rgba(10, 14, 12, 0.85);
  transition: border-color 0.3s, box-shadow 0.3s;
}

/* Silver metallic dither -- a fine repeating hairline pattern (the "dither"
   grain, cool gray rather than warm white so it reads as brushed silver
   rather than a glass highlight) layered under a soft diagonal sheen in the
   same silver tone. Static, not an animated shimmer (this is a persistent
   info panel, not a loading skeleton, so a moving highlight would read as
   distracting rather than polished). Sits on top of the widget's own
   content in normal stacking order (an absolutely-positioned box with
   z-index:auto paints after in-flow siblings), which is exactly the "light
   catching a brushed-metal surface" look, not a bug -- opacity is low
   enough that it never affects text legibility. */
.system-status-widget::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    repeating-linear-gradient(115deg, rgba(210, 215, 225, 0.05) 0px, rgba(210, 215, 225, 0.05) 1px, rgba(210, 215, 225, 0) 1px, rgba(210, 215, 225, 0) 3px),
    linear-gradient(135deg, rgba(200, 205, 215, 0.14) 0%, rgba(200, 205, 215, 0.04) 30%, rgba(200, 205, 215, 0) 55%);
  pointer-events: none;
}

.system-status-widget .label {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  color: var(--text-dim);
  margin-bottom: 10px;
}

.system-info-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  padding: 5px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 0.8rem;
}

.system-info-row:first-of-type {
  border-top: none;
}

.system-info-label {
  color: var(--text-faint);
  flex: none;
}

.system-info-value {
  color: var(--text-dim);
  font-weight: 600;
  text-align: right;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex: none;
}

.dot-green { background: var(--green); box-shadow: 0 0 8px var(--green-glow); }
.dot-red { background: var(--red); box-shadow: 0 0 8px var(--red-glow); }
.dot-amber { background: var(--amber); box-shadow: 0 0 8px var(--amber-glow); }
.dot-gray { background: var(--text-faint); }
.dot-blue { background: var(--blue); box-shadow: 0 0 8px var(--blue-glow); }
.dot-purple { background: var(--purple); box-shadow: 0 0 8px var(--purple-glow); }
.dot-cyan { background: var(--cyan); box-shadow: 0 0 8px var(--cyan-glow); }


/* ---------- Main content ---------- */

.main {
  padding: 24px 28px 48px;
  min-width: 0;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 22px;
  flex-wrap: wrap;
}

.topbar h1 {
  margin: 0 0 6px;
  font-size: 1.7rem;
  font-weight: 800;
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 6px;
}

.brand-lockup .brand-mark {
  width: 30px;
  height: 30px;
  flex-shrink: 0;
}

.brand-lockup-text {
  font-size: 1.55rem;
  font-weight: 800;
  color: var(--text);
  line-height: 1;
}

.brand-lockup-text .brand-red {
  color: var(--brand-red-bright);
}

.topbar .subtitle {
  margin: 0;
  color: var(--text-dim);
  font-size: 0.9rem;
  max-width: 60ch;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.clock {
  text-align: right;
  font-size: 0.85rem;
  color: var(--text-dim);
  line-height: 1.3;
}

.clock .time {
  color: var(--text);
  font-weight: 700;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 14px;
  font-size: 0.85rem;
  color: var(--text-dim);
  text-decoration: none;
}

.back-link:hover {
  color: var(--purple-soft);
}

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

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 16px;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 700;
  border: 1px solid var(--border-dim);
  background: transparent;
  color: var(--text);
  cursor: pointer;
  transition: box-shadow 0.15s, background 0.15s, transform 0.05s;
  white-space: nowrap;
}

.btn svg {
  width: 15px;
  height: 15px;
}

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

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.btn-purple { color: var(--purple-soft); border-color: var(--purple-glow); background: var(--purple-bg); }
.btn-purple:hover { box-shadow: 0 0 16px -4px var(--purple-glow); }

.btn-cyan { color: var(--cyan); border-color: var(--cyan-glow); background: var(--cyan-bg); }
.btn-cyan:hover { box-shadow: 0 0 16px -4px var(--cyan-glow); }

.btn-green { color: var(--green); border-color: var(--green-glow); background: var(--green-bg); }
.btn-green:hover { box-shadow: 0 0 16px -4px var(--green-glow); }

.btn-red { color: var(--red); border-color: var(--red-glow); background: var(--red-bg); }
.btn-red:hover { box-shadow: 0 0 16px -4px var(--red-glow); }

.btn-blue { color: var(--blue); border-color: var(--blue-glow); background: var(--blue-bg); }
.btn-blue:hover { box-shadow: 0 0 16px -4px var(--blue-glow); }

.btn-amber { color: var(--amber); border-color: var(--amber-glow); background: var(--amber-bg); }
.btn-amber:hover { box-shadow: 0 0 16px -4px var(--amber-glow); }

.btn-sm { padding: 6px 12px; font-size: 0.78rem; }

.btn-icon {
  position: relative;
  width: 34px;
  height: 34px;
  padding: 0;
  justify-content: center;
}

.btn-icon.btn-sm {
  width: 30px;
  height: 30px;
}

.btn-tooltip {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  padding: 4px 9px;
  border-radius: 6px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-dim);
  color: var(--text);
  font-size: 0.72rem;
  font-weight: 600;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.12s, transform 0.12s;
  z-index: 20;
  box-shadow: 0 4px 16px -4px rgba(0, 0, 0, 0.6);
}

.btn-tooltip::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-top-color: var(--border-dim);
}

.btn-icon:hover .btn-tooltip,
.btn-icon:focus-visible .btn-tooltip {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

/* Segregates Console from the rest of node.html's action row once it's
   visible (provisioned) -- pushed to the far right of the flex line,
   distinct from the other per-node admin actions grouped on the left. A
   no-op while console-btn is hidden, so no separate JS-driven toggle is
   needed for this. */
#console-btn {
  margin-left: auto;
}

/* Nodes table specifically: 4 icon-only buttons should stay on one line
   (freed up by merging Version/Firmware into one column) -- .table-scroll's
   own overflow-x handles the rare too-narrow case, instead of the buttons
   wrapping to a second line and inflating every row's height. Scoped to
   #nodes-table rather than changing .row-actions globally, since node.html's
   text+icon action buttons are wider and still want to wrap on narrow
   screens. */
#nodes-table .row-actions {
  flex-wrap: nowrap;
}

/* ---------- Cards ---------- */

.card {
  background: var(--card-bg);
  border: 1px solid var(--border-dim);
  border-radius: var(--radius);
  padding: 18px 20px;
}

.card-glow-purple { border-color: var(--purple-glow); box-shadow: 0 0 24px -12px var(--purple-glow); }
.card-glow-cyan { border-color: var(--cyan-glow); box-shadow: 0 0 24px -12px var(--cyan-glow); }
.card-glow-green { border-color: var(--green-glow); box-shadow: 0 0 24px -12px var(--green-glow); }
.card-glow-amber { border-color: var(--amber-glow); box-shadow: 0 0 24px -12px var(--amber-glow); }
.card-glow-red { border-color: var(--red-glow); box-shadow: 0 0 24px -12px var(--red-glow); }

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.card-header h2 {
  margin: 0;
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 10px;
}

.card-header h2 svg {
  width: 20px;
  height: 20px;
}

.card-collapse-btn {
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  padding: 4px;
  display: flex;
}

.card-collapse-btn svg {
  width: 16px;
  height: 16px;
  transition: transform 0.15s;
}

.card.collapsed .card-collapse-btn svg {
  transform: rotate(180deg);
}

.card.collapsed .card-body {
  display: none;
}

.card-hint {
  color: var(--text-dim);
  font-size: 0.85rem;
  margin: 0 0 14px;
  line-height: 1.5;
}

.toggle-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  margin-bottom: 6px;
}

.toggle-row input[type='checkbox'] {
  width: 17px;
  height: 17px;
  accent-color: var(--amber);
  cursor: pointer;
}

/* ---------- Stat cards ---------- */

.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}

@media (max-width: 1100px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 560px) {
  .stat-grid { grid-template-columns: 1fr; }
}

.stat-card {
  background: var(--card-bg);
  border: 1px solid var(--border-dim);
  border-radius: var(--radius);
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  position: relative;
}

.stat-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
}

.stat-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  color: var(--text-dim);
}

.stat-card-clickable {
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.stat-card-clickable:hover {
  border-color: var(--amber-glow);
  box-shadow: 0 0 20px -10px var(--amber-glow);
}

.stat-card-chevron {
  width: 14px;
  height: 14px;
  transition: transform 0.15s;
}

.stat-card-clickable.expanded .stat-card-chevron {
  transform: rotate(180deg);
}

.stat-detail-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.stat-detail-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  padding: 9px 4px;
  border-bottom: 1px solid var(--border-dim);
  font-size: 0.85rem;
}

.stat-detail-row:last-child {
  border-bottom: none;
}

/* Alerts detail panel's 3-column rows: node name / message / descriptor
   (e.g. a version range) -- three equal-width columns so the name stays
   left, the message centers, and the descriptor right-aligns, regardless
   of how long any one of them is. An empty descriptor cell still reserves
   its column's width (rather than being omitted) so rows without one
   (stale/offline/check-in error) stay aligned with rows that have one. */
.stat-detail-row-alert .alert-name,
.stat-detail-row-alert .alert-message,
.stat-detail-row-alert .alert-descriptor {
  flex: 1 1 0;
}

.stat-detail-row-alert .alert-message {
  text-align: center;
}

.stat-detail-row-alert .alert-descriptor {
  text-align: right;
}

/* ---------- RESOURCES card expanded panel (live processes) ---------- */

.detail-panel-heading {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 12px;
}

.detail-panel-heading svg {
  width: 17px;
  height: 17px;
}

/* ---------- DEBUG card (embedded live console) ---------- */

/* Same treatment as .deploy-remote-log (the SSH remote-deploy transcript
   pane) -- this app's one existing "live console output" pattern, reused
   here rather than inventing a second one. Fixed height, scrolls on its
   own (no expand interaction -- see ensureDebugCard's comment). */
.debug-console {
  margin: 6px 0 0;
  height: 74px;
  overflow-y: auto;
  padding: 10px 12px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-dim);
  border-radius: var(--radius-sm);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.7rem;
  line-height: 1.5;
  color: var(--text-dim);
  white-space: pre-wrap;
  word-break: break-word;
}

.stat-icon {
  width: 34px;
  height: 34px;
  flex: none;
}

.stat-value {
  font-size: 2rem;
  font-weight: 800;
  line-height: 1;
}

.stat-foot {
  font-size: 0.8rem;
  font-weight: 600;
}

/* RESOURCES card: CPU/RAM side by side, flat label+value+sub (no icons or
   progress bars) -- matches the simpler reference design. */
.server-split {
  display: flex;
  gap: 16px;
  margin: 2px 0;
}

.server-flat-item {
  flex: 1;
  min-width: 0;
}

.server-flat-label {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--text-faint);
  margin-bottom: 2px;
}

.server-flat-value {
  font-size: 1.5rem;
  font-weight: 800;
  line-height: 1.2;
}

.server-flat-sparkline {
  display: block;
  width: 100%;
  height: 34px;
  margin-top: 4px;
}

/* ---------- Tables ---------- */

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

th {
  text-align: left;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--text-dim);
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-dim);
  white-space: nowrap;
}

td {
  padding: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  font-size: 0.88rem;
  vertical-align: middle;
}

tbody tr:last-child td {
  border-bottom: none;
}

.table-scroll {
  overflow-x: auto;
}

#nodes-table th[data-sort-key] {
  cursor: pointer;
  user-select: none;
}

#nodes-table th[data-sort-key]:hover {
  color: var(--text);
}

#nodes-table th[data-sort-key].sorted {
  color: var(--cyan);
}

.sort-arrow {
  display: inline-block;
  width: 0.8em;
  margin-left: 2px;
  font-size: 0.85em;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 700;
}

.console-badge {
  display: inline-flex;
  margin-left: 6px;
  padding: 0;
  background: none;
  border: none;
  color: var(--cyan);
  vertical-align: middle;
  cursor: pointer;
}
.console-badge:hover { color: var(--cyan-glow); }
.console-badge svg {
  width: 14px;
  height: 14px;
}

.text-green { color: var(--green); }
.text-red { color: var(--red); }
.text-amber { color: var(--amber); }
.text-cyan { color: var(--cyan); }
.text-blue { color: var(--blue); }
.text-dim { color: var(--text-dim); }
.text-faint { color: var(--text-faint); }

.status-sub {
  display: block;
  font-size: 0.75rem;
  margin-top: 2px;
}

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

label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.8rem;
  color: var(--text-dim);
  font-weight: 600;
}

/* Default spacing between stacked form fields -- several pages (node.html's
   maintenance modal, etc.) were getting this via a repeated inline
   `style="margin-bottom: 14px;"` on every label; account.html/login.html/
   users.html didn't replicate that, so their labels sat flush against the
   input above them. Scoped to a label that's a DIRECT child of <form>
   (not `label` generally) so it doesn't also apply inside
   .deploy-form-grid, which already sets its own row/column gap -- a label
   margin there would stack on top of that gap instead of replacing it. An
   inline margin-bottom on any individual label (the older pattern above)
   still wins over this via normal CSS specificity, so nothing double-set. */
form > label {
  margin-bottom: 14px;
}

input, select {
  background: var(--bg-elevated);
  border: 1px solid var(--border-dim);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 10px 12px;
  font-size: 0.9rem;
  font-family: inherit;
}

input:focus, select:focus, .btn:focus-visible {
  outline: 2px solid var(--cyan-glow);
  outline-offset: 1px;
}

/* ---------- comboSearch.js's fuzzy dropdown ---------- */

.combo-wrap {
  position: relative;
}

.combo-wrap input {
  width: 100%;
}

.combo-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  z-index: 20;
  background: var(--card-bg-soft);
  border: 1px solid var(--border-dim);
  border-radius: var(--radius-sm);
  max-height: 220px;
  overflow-y: auto;
  list-style: none;
  margin: 0;
  padding: 4px;
  box-shadow: 0 12px 24px -8px rgba(0, 0, 0, 0.6);
}

.combo-option {
  padding: 8px 10px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.9rem;
}

.combo-option:hover {
  background: var(--cyan-bg);
  color: var(--cyan);
}

.combo-empty {
  padding: 8px 10px;
  color: var(--text-faint);
  font-size: 0.85rem;
}

/* ---------- Search box ---------- */

.search-box {
  position: relative;
  flex: 1;
  min-width: 160px;
  max-width: 260px;
}

.search-box svg {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  width: 15px;
  height: 15px;
  color: var(--text-faint);
  pointer-events: none;
}

.search-box input {
  width: 100%;
  padding: 7px 10px 7px 32px;
  font-size: 0.82rem;
}

/* ---------- Activity log ---------- */

.activity-log {
  height: 360px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.activity-log .empty-state {
  padding: 12px 0;
}

.activity-entry {
  display: flex;
  gap: 10px;
  padding: 7px 4px;
  border-bottom: 1px solid var(--border-dim);
  font-size: 0.82rem;
  align-items: baseline;
}

.activity-entry:last-child {
  border-bottom: none;
}

.activity-entry .activity-time {
  color: var(--text-faint);
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}

.activity-entry .activity-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 4px;
}

.activity-entry .activity-message {
  color: var(--text-dim);
}

/* ---------- Content grid (add-node + topology) ---------- */

.content-grid {
  display: grid;
  grid-template-columns: 1fr 1.4fr;
  gap: 20px;
  align-items: stretch;
}

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

.add-node-illustration {
  position: absolute;
  right: 18px;
  top: 18px;
  width: 60px;
  height: 60px;
  opacity: 0.5;
  color: var(--cyan);
}

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

.topology-header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.topology-fullscreen-link {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 30px;
  height: 30px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-dim);
  color: var(--text-dim);
  transition: color 0.15s, border-color 0.15s;
}

.topology-fullscreen-link svg {
  width: 15px;
  height: 15px;
}

.topology-fullscreen-link:hover {
  color: var(--text);
  border-color: var(--purple-glow);
}

.topology-wrap {
  position: relative;
}

.topology-canvas {
  width: 100%;
  height: 360px;
  border-radius: var(--radius-sm);
  background: radial-gradient(ellipse at center, #1f1a38 0%, #05060d 85%);
  overflow: hidden;
  position: relative;
}

.topology-canvas canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.topology-hint {
  font-size: 0.78rem;
  color: var(--text-faint);
  margin-top: 10px;
}

.topology-legend {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  justify-content: flex-end;
  margin-top: 12px;
  font-size: 0.78rem;
  color: var(--text-dim);
}

.topology-legend .legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.topology-empty {
  color: var(--text-faint);
  font-size: 13px;
  text-align: center;
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.topology-hover-label {
  position: absolute;
  pointer-events: none;
  background: rgba(5, 6, 13, 0.85);
  border: 1px solid rgba(122, 91, 166, 0.5);
  border-radius: 4px;
  padding: 3px 8px;
  font-size: 12px;
  font-weight: 700;
  color: #f1f5fb;
  white-space: nowrap;
  z-index: 2;
}

/* ---------- Shared vintage window chrome (Mac OS 9 Platinum titlebar,
   dark-mode) -- used by both the topology click-action popup and the
   embedded console panel below, so the two match each other as much as
   they match the rest of this app's own purple-glow dark theme. A real
   OS9 titlebar is a horizontal pinstripe (repeating-linear-gradient here)
   broken by a solid "tab" behind the centered title, with a small beveled
   close box at the left -- this reproduces that structure in the app's
   own dark palette rather than light Platinum gray, and keeps the type
   in this app's own system font rather than a bitmap-style face, per
   "matching the rest of the UI." ---------- */

.topology-win-titlebar {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 22px;
  padding: 0 5px;
  flex: none;
  background-image: repeating-linear-gradient(to bottom, #262b47 0px, #262b47 2px, #171a2c 2px, #171a2c 4px);
  border-bottom: 1px solid #000;
  cursor: default;
}

.topology-win-close {
  flex: none;
  width: 13px;
  height: 13px;
  padding: 0;
  background: var(--card-bg);
  border: 1px solid #000;
  border-radius: 2px;
  box-shadow: inset 1px 1px 0 rgba(255, 255, 255, 0.22), inset -1px -1px 0 rgba(0, 0, 0, 0.7);
  cursor: pointer;
}

.topology-win-close:hover { background: var(--red-bg); border-color: var(--red); }
.topology-win-close:active { box-shadow: inset -1px -1px 0 rgba(255, 255, 255, 0.22), inset 1px 1px 0 rgba(0, 0, 0, 0.7); }

.topology-win-title-pill {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: var(--card-bg);
  border: 1px solid #000;
  border-radius: 3px;
  padding: 2px 8px;
  font-weight: 700;
  font-size: 0.72rem;
  letter-spacing: 0.02em;
}

.topology-win-title-pill .dot { flex: none; }

.topology-win-title-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---------- Topology click-action popup (retro dropdown) ---------- */

.topology-action-menu {
  position: absolute;
  z-index: 5;
  width: 240px;
  background: var(--card-bg);
  border: 1px solid #000;
  border-radius: 7px 7px 3px 3px;
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.06),
    0 16px 32px -12px rgba(0, 0, 0, 0.8),
    0 0 20px -4px var(--purple-glow);
  overflow: hidden;
  font-size: 0.82rem;
}

.topology-action-menu.hidden { display: none; }

.topology-action-menu-body {
  padding: 10px 0;
}

.topology-action-menu-info {
  padding: 8px 12px;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 3px 8px;
  color: var(--text-dim);
  font-size: 0.75rem;
}

.topology-action-menu-divider {
  border-top: 1px solid var(--border-dim);
  margin: 4px 0;
}

.topology-action-menu-list {
  display: flex;
  flex-direction: column;
}

.topology-action-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 12px;
  background: transparent;
  border: none;
  color: var(--text);
  font-size: 0.82rem;
  text-align: left;
  cursor: pointer;
  width: 100%;
}

.topology-action-menu-item:hover:not(:disabled) { background: var(--purple-bg); }
.topology-action-menu-item:disabled { opacity: 0.4; cursor: not-allowed; }
.topology-action-menu-item svg { width: 15px; height: 15px; flex: none; }

.topology-action-menu-item.item-red { color: var(--red); }
.topology-action-menu-item.item-purple { color: var(--purple-soft); }
.topology-action-menu-item.item-amber { color: var(--amber); }

/* ---------- Embedded mini console panel ---------- */

.topology-console-panel {
  position: absolute;
  z-index: 6;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 520px;
  max-width: calc(100% - 24px);
  height: 320px;
  max-height: calc(100% - 24px);
  background: var(--card-bg);
  border: 1px solid #000;
  border-radius: 8px 8px 4px 4px;
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.06),
    0 20px 40px -14px rgba(0, 0, 0, 0.85),
    0 0 30px -6px var(--purple-glow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.topology-console-panel.hidden { display: none; }

/* Drag handle -- see makeWindowDraggable() in topology.js. The close box
   inside keeps its own `cursor: pointer` from the shared rule above. */
.topology-console-panel .topology-win-titlebar { cursor: move; }

/* Larger to match the full-screen page's much bigger canvas (see
   topology-full.html) -- still capped by the base rule's
   calc(100% - 24px) above, so it never overflows a smaller viewport. */
.topology-full-body .topology-console-panel {
  width: 860px;
  height: 560px;
}

.topology-console-panel-body {
  flex: 1;
  padding: 8px;
  overflow: hidden;
}

.topology-console-terminal { width: 100%; height: 100%; }

/* ---------- Beta node map (2D circuit-schematic layout, beta.html/beta.js)
   ---------- */

.beta-canvas {
  position: relative;
  width: 100%;
  flex: 1;
  min-height: 0;
  border-radius: var(--radius-sm);
  background: radial-gradient(ellipse at top, #10122150 0%, #05060d 75%);
  overflow: hidden;
}

/* Child combinator, not descendant -- the action-menu popup and console
   panel (see beta.js) are also appended inside #beta-canvas, each with
   their own small icon <svg>s that must NOT be stretched to fill the
   container the way the map's own top-level <svg> should be. */
.beta-canvas > svg {
  display: block;
  width: 100%;
  height: 100%;
}

.beta-hub { fill: var(--purple-bg); stroke: var(--purple-soft); stroke-width: 2; }
.beta-hub-label { fill: var(--text); font-size: 15px; font-weight: 700; text-anchor: middle; }
.beta-hub-sub { fill: var(--text-faint); font-size: 10px; text-anchor: middle; }

/* Radar-style expanding ping ring behind the hub -- duration/opacity are
   set per-tick from real server_stats activity (see beta.js's
   applyHubActivityStyle()), so a busier box visibly pulses faster/brighter
   rather than this being a fixed decorative loop. transform-box: fill-box
   scales around the ring's own center instead of the SVG viewport's
   origin. */
.beta-hub-ping {
  fill: none;
  stroke: var(--purple-soft);
  stroke-width: 2;
  transform-box: fill-box;
  transform-origin: center;
  animation: beta-hub-ping var(--pulse-duration, 2.2s) ease-out infinite;
}
@keyframes beta-hub-ping {
  0% { transform: scale(1); opacity: var(--pulse-opacity, 0.5); }
  100% { transform: scale(1.9); opacity: 0; }
}

.beta-cloud { fill: var(--card-bg-soft); stroke: var(--border-dim); stroke-width: 1.5; }
.beta-cloud-label { fill: var(--text-dim); font-size: 10px; font-weight: 700; text-anchor: middle; letter-spacing: 0.04em; }

.beta-trace { stroke: var(--border-dim); stroke-width: 1.5; fill: none; }
.beta-junction { fill: var(--text-faint); }

/* "Traffic flowing" animation for real VPN peer edges only -- a dash
   pattern whose offset marches continuously in one direction, linear/
   infinite (NOT steps()), so it reads as current moving along a wire.
   beta.js gives every individual edge its own delay (not just its hub's),
   so a bundle of edges sharing one hub's color never marches in lockstep. */
@keyframes beta-line-flow {
  to { stroke-dashoffset: -24; }
}

/* Real resolved VPN peer edges -- color is set inline per edge (see
   beta.js's renderMap(), keyed on whichever endpoint has more peer edges
   overall), not a fixed status palette here; each individual edge gets its
   own flow delay (also inline), not just its hub's. */
.beta-peeredge { stroke-width: 1.5; stroke-dasharray: 4 3; fill: none; }
.beta-peeredge-pulse { animation: beta-line-flow 0.9s linear infinite; }

/* Node border: a plain on/off activity flash, NOT the peer edges' flowing
   dash -- animates stroke-opacity specifically (not plain opacity), so the
   circle's fill (its connectivity status) stays fully solid while only the
   border flashes. steps(2, jump-none) gives a hard toggle, not a fade. */
@keyframes beta-border-flash {
  0% { stroke-opacity: 1; }
  100% { stroke-opacity: 0.2; }
}
.beta-node { cursor: pointer; stroke-width: 4; transition: filter 0.1s; }
.beta-node-pulse-border { animation: beta-border-flash 1.1s steps(2, jump-none) infinite; }
.beta-node-group:hover .beta-node { filter: brightness(1.25); }
.beta-node-online { fill: var(--green); }
.beta-node-stale, .beta-node-pending { fill: var(--amber); }
.beta-node-offline { fill: var(--red); }
.beta-node-maintenance { fill: var(--blue); }
.beta-node-revoked { fill: var(--text-faint); }

/* Two classes beat one -- wins over whichever beta-node-<status> rule is
   also present, without needing !important. beta.js also clears the
   node's inline per-client stroke color on selection (inline always beats
   a class otherwise), so this stroke actually takes effect. */
.beta-node.beta-node-selected { fill: var(--cyan); stroke: #aef1fb; stroke-width: 4; }

.beta-node-label {
  fill: #05060d;
  font-size: 13px;
  font-weight: 800;
  text-anchor: middle;
  pointer-events: none;
}

/* ---------- Beta: bottom-left live activity widget (real server_stats
   feed, same data the sidebar's own graph uses -- see beta.js's
   connectServerStats()) ---------- */

.beta-activity-widget {
  position: absolute;
  z-index: 4;
  left: 12px;
  bottom: 12px;
  width: 230px;
  max-width: calc(100% - 24px);
  background: var(--card-bg);
  border: 1px solid #000;
  border-radius: 7px 7px 3px 3px;
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.06),
    0 14px 28px -12px rgba(0, 0, 0, 0.8);
  overflow: hidden;
}

.beta-activity-body { padding: 8px 10px 10px; }

.beta-activity-graph {
  width: 100%;
  height: 64px;
  display: block;
}

.beta-activity-line { fill: none; stroke-width: 1.6; }
.beta-activity-cpu { stroke: var(--cyan); }
.beta-activity-ram { stroke: var(--purple-soft); }
.beta-activity-net { stroke: var(--green); opacity: 0.85; }

.beta-activity-legend {
  display: flex;
  justify-content: space-between;
  gap: 6px;
  margin-top: 6px;
  font-size: 0.68rem;
  color: var(--text-dim);
}

.beta-activity-legend b { color: var(--text); font-weight: 700; }

.beta-activity-swatch {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 2px;
  margin-right: 3px;
}
.beta-activity-swatch-cpu { background: var(--cyan); }
.beta-activity-swatch-ram { background: var(--purple-soft); }
.beta-activity-swatch-net { background: var(--green); }

/* ---------- Beta: right-side node panel ("essentials + actions", opened
   via the popup's Node button instead of navigating away) -- always
   present in the DOM, slid off-canvas via transform when closed so the
   open/close transition always animates. ---------- */

.beta-side-panel {
  position: absolute;
  z-index: 6;
  top: 0;
  right: 0;
  height: 100%;
  width: 320px;
  max-width: calc(100% - 16px);
  background: var(--card-bg);
  border-left: 1px solid #000;
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.06),
    -20px 0 40px -18px rgba(0, 0, 0, 0.85),
    0 0 30px -8px var(--purple-glow);
  display: flex;
  flex-direction: column;
  transform: translateX(105%);
  transition: transform 0.32s cubic-bezier(0.2, 0.8, 0.2, 1);
  pointer-events: none;
}

.beta-side-panel.open {
  transform: translateX(0);
  pointer-events: auto;
}

.beta-side-panel-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.beta-side-panel-info {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 5px 10px;
  font-size: 0.8rem;
  color: var(--text-dim);
}
.beta-side-panel-info span:nth-child(odd) { color: var(--text-faint); }
.beta-side-panel-info span:nth-child(even) { color: var(--text); text-align: right; }

.beta-side-panel-divider { border-top: 1px solid var(--border-dim); }

.beta-side-panel-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.beta-side-action-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  flex: 1 0 calc(50% - 8px);
  padding: 10px 6px;
  background: var(--card-bg-soft);
  border: 1px solid var(--border-dim);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 0.72rem;
  text-align: center;
  cursor: pointer;
}
.beta-side-action-btn:hover { background: var(--purple-bg); border-color: var(--purple-glow); }
.beta-side-action-btn svg { width: 16px; height: 16px; }
.beta-side-action-btn.item-red { color: var(--red); }
.beta-side-action-btn.item-purple { color: var(--purple-soft); }
.beta-side-action-btn.item-amber { color: var(--amber); }

.beta-side-panel-full-link {
  margin-top: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 9px;
  border: 1px solid var(--border-dim);
  border-radius: var(--radius-sm);
  color: var(--text-dim);
  font-size: 0.78rem;
  text-decoration: none;
}
.beta-side-panel-full-link:hover { color: var(--text); border-color: var(--purple-glow); }
.beta-side-panel-full-link svg { width: 18px; height: 18px; flex: none; }

/* ---------- Live traffic graph ---------- */

.traffic-status {
  font-size: 0.78rem;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  gap: 6px;
}

.traffic-graph-wrap {
  position: relative;
}

#traffic-svg {
  width: 100%;
  height: 180px;
  border-radius: var(--radius-sm);
  background: var(--card-bg-soft);
}

.traffic-readout {
  display: flex;
  gap: 22px;
  margin-top: 12px;
  font-size: 0.85rem;
}

.traffic-readout .readout-item {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-dim);
}

.traffic-readout .readout-value {
  color: var(--text);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.traffic-empty {
  fill: var(--text-faint);
  font-size: 13px;
}

/* ---------- System Resources (CPU/Memory/Disk) + Live Traffic row ------- */

.node-half-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  align-items: stretch;
}

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

.resource-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.resource-row + .resource-row {
  margin-top: 16px;
}

.resource-label {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 84px;
  flex-shrink: 0;
  color: var(--text-dim);
  font-size: 0.85rem;
}

.resource-label svg {
  width: 16px;
  height: 16px;
}

.resource-bar {
  flex: 1;
  height: 8px;
  border-radius: 999px;
  background: var(--card-bg-soft);
  overflow: hidden;
}

.resource-bar-fill {
  height: 100%;
  border-radius: 999px;
  transition: width 0.4s ease;
}

.resource-value {
  width: 42px;
  flex-shrink: 0;
  text-align: right;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

/* ---------- Node summary grid ---------- */

.node-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 16px;
}

.node-summary .field-label {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--text-dim);
  margin-bottom: 4px;
}

.node-summary .field-value {
  font-size: 1rem;
  font-weight: 600;
}

.field-value-expandable {
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.field-chevron {
  width: 12px;
  height: 12px;
  transition: transform 0.15s;
}

.field-value-expandable.expanded .field-chevron {
  transform: rotate(180deg);
}

.field-sub {
  margin-top: 6px;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-dim);
}

.field-sub a {
  color: var(--cyan);
  font-weight: 700;
}

/* ---------- Badges (peer links) ---------- */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  border: 1px solid currentColor;
  text-decoration: none;
}

/* A single text-node space between a name and a following .badge reads as
   too tight (the badge's own border sits almost against the text) and
   leaves the two vertically misaligned relative to each other in a table
   cell. A real flex row fixes both at once. */
.user-row-name {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

/* ---------- Modal ---------- */

.modal {
  position: fixed;
  inset: 0;
  background: rgba(2, 2, 8, 0.75);
  backdrop-filter: blur(2px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 20;
  padding: 20px;
}

.modal-content {
  background: var(--card-bg);
  border: 1px solid var(--purple-glow);
  box-shadow: 0 0 40px -10px var(--purple-glow);
  border-radius: var(--radius);
  padding: 24px 28px;
  max-width: 560px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-content h2 {
  margin-top: 0;
}

.warning-box {
  background: var(--amber-bg);
  border: 1px solid var(--amber-glow);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 0.85rem;
  color: var(--amber);
}

/* ---------- Upgrade-choice modal (single hop vs. auto-continue) --------- */

.upgrade-choice-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.upgrade-choice-option {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  text-align: left;
  width: 100%;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-dim);
  background: var(--card-bg-soft);
  color: var(--text);
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.upgrade-choice-option:hover {
  border-color: var(--purple-glow);
  background: var(--purple-bg);
}

.upgrade-choice-title {
  font-weight: 700;
}

.upgrade-choice-desc {
  font-size: 0.82rem;
  color: var(--text-dim);
  line-height: 1.4;
}

code {
  word-break: break-all;
  background: rgba(255, 255, 255, 0.05);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.85em;
}

.hint {
  font-size: 0.8rem;
  color: var(--text-faint);
}

/* ---------- Remote deploy ---------- */

.deploy-remote-section {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border-dim);
}

.deploy-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 14px;
  margin-bottom: 14px;
}

.deployment-log-row .deploy-remote-log {
  margin-top: 0;
}

.deploy-remote-log {
  margin-top: 14px;
  max-height: 220px;
  overflow-y: auto;
  background: var(--bg-elevated);
  border: 1px solid var(--border-dim);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.78rem;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--text-dim);
}

.footer-note {
  margin-top: 28px;
  color: var(--text-faint);
  font-size: 0.78rem;
}

/* ---------- Empty / simple states ---------- */

.empty-state {
  color: var(--text-faint);
  font-size: 0.9rem;
  padding: 24px 0;
  text-align: center;
}

.kv-grid {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 10px 20px;
  font-size: 0.9rem;
}

.kv-grid dt {
  color: var(--text-dim);
  font-weight: 600;
}

.kv-grid dd {
  margin: 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.85rem;
}

/* ---------- Achievement toast (fleet-fully-updated easter egg) ---------- */

.achievement-toast {
  position: fixed;
  top: 22px;
  right: 22px;
  z-index: 500;
  display: flex;
  align-items: center;
  gap: 14px;
  background: linear-gradient(155deg, #182018 0%, var(--card-bg) 55%);
  border: 1px solid var(--green);
  box-shadow: 0 0 0 1px rgba(43, 224, 138, 0.15), 0 12px 32px rgba(0, 0, 0, 0.45), 0 0 28px var(--green-glow);
  border-radius: var(--radius);
  padding: 14px 20px 14px 14px;
  max-width: 340px;
  animation: achievement-in 0.5s cubic-bezier(0.2, 0.9, 0.3, 1.2) both;
}

.achievement-toast.hidden { display: none; }

.achievement-toast.leaving {
  animation: achievement-out 0.4s ease-in both;
}

.achievement-badge {
  flex: none;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #4dffb0, var(--green) 65%, #159b5e 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #0a1a10;
  position: relative;
  overflow: hidden;
}

.achievement-badge svg { width: 24px; height: 24px; }

.achievement-badge::after {
  content: '';
  position: absolute;
  inset: -50%;
  background: linear-gradient(75deg, transparent 40%, rgba(255, 255, 255, 0.75) 50%, transparent 60%);
  animation: achievement-shine 2.6s ease-in-out 0.3s 2;
}

.achievement-eyebrow {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--green);
  margin-bottom: 2px;
}

.achievement-title {
  font-size: 1.02rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.25;
}

.achievement-sub {
  font-size: 0.8rem;
  color: var(--text-dim);
  margin-top: 2px;
}

@keyframes achievement-in {
  from { transform: translateX(24px) scale(0.94); opacity: 0; }
  to { transform: translateX(0) scale(1); opacity: 1; }
}

@keyframes achievement-out {
  from { transform: translateX(0) scale(1); opacity: 1; }
  to { transform: translateX(24px) scale(0.96); opacity: 0; }
}

@keyframes achievement-shine {
  0% { transform: translateX(-100%) rotate(0deg); }
  100% { transform: translateX(100%) rotate(0deg); }
}

@media (prefers-reduced-motion: reduce) {
  .achievement-toast, .achievement-toast.leaving, .achievement-badge::after {
    animation: none;
  }
}
