/* =========================================================================
   Dune Dedicated Server Manager — Operator Command Center
   ========================================================================= */

:root {
  /* Surfaces — warm near-black, desert-at-night */
  --color-bg-base: #0b0a08;
  --color-bg-panel: #131210;
  --color-bg-elevated: #1a1814;
  --color-bg-input: #1f1c17;
  --color-bg-hover: #25221c;
  --color-bg-active: #2d291f;

  /* Borders — hairlines first, visible second */
  --color-border-hair: #221f1a;
  --color-border-muted: #2c2922;
  --color-border-default: #38332c;
  --color-border-strong: #4a443a;

  /* Text — warm cream descending */
  --color-text-primary: #ece5d6;
  --color-text-secondary: #b1aa9b;
  --color-text-muted: #797366;
  --color-text-faint: #4c473f;

  /* Accents */
  --color-accent: #d97757;
  --color-accent-strong: #ea8b6d;
  --color-accent-dim: rgba(217, 119, 87, 0.16);
  --color-accent-ring: rgba(217, 119, 87, 0.35);

  --color-ok: #76b876;
  --color-ok-strong: #8acf8a;
  --color-ok-dim: rgba(118, 184, 118, 0.16);

  --color-warn: #d4a85e;
  --color-warn-dim: rgba(212, 168, 94, 0.16);

  --color-err: #d6695e;
  --color-err-dim: rgba(214, 105, 94, 0.16);

  --color-info: #67a3d9;

  /* Radii */
  --radius-1: 3px;
  --radius-2: 5px;
  --radius-3: 8px;
  --radius-pill: 999px;

  /* Shadows */
  --shadow-1: 0 1px 0 0 rgba(255, 255, 255, 0.02) inset, 0 4px 12px -2px rgba(0, 0, 0, 0.5);
  --shadow-2: 0 1px 0 0 rgba(255, 255, 255, 0.03) inset, 0 12px 32px -8px rgba(0, 0, 0, 0.65);

  /* Motion */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);

  /* Typography */
  --font-display: "Funnel Display", "Geist", system-ui, sans-serif;
  --font-sans: "Geist", system-ui, -apple-system, sans-serif;
  --font-mono: "Geist Mono", "JetBrains Mono", "Cascadia Mono", Consolas, monospace;

  font-family: var(--font-sans);
  font-feature-settings: "ss01", "cv11";
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  color-scheme: dark;
}

/* Radix Theme overrides — push the accent toward copper sand */
.radix-themes {
  --default-font-family: var(--font-sans);
  --heading-font-family: var(--font-display);
  --code-font-family: var(--font-mono);
  --color-background: var(--color-bg-base);
  --color-panel-solid: var(--color-bg-panel);
  --color-panel-translucent: rgba(28, 26, 23, 0.7);
  --color-surface: var(--color-bg-elevated);
  --color-focus-root: var(--color-accent-ring);
}

* {
  box-sizing: border-box;
}

html,
body,
#root {
  width: 100%;
  height: 100%;
  margin: 0;
}

body {
  overflow: hidden;
  background: var(--color-bg-base);
  color: var(--color-text-primary);
}

/* App shell — subtle vignette/grain for atmosphere */
.app-shell {
  position: relative;
  width: 100vw;
  height: 100vh;
  background:
    radial-gradient(ellipse at 80% -10%, rgba(217, 119, 87, 0.06) 0%, transparent 55%),
    radial-gradient(ellipse at -5% 100%, rgba(118, 184, 118, 0.03) 0%, transparent 50%),
    linear-gradient(180deg, #0c0a07 0%, var(--color-bg-base) 30%);
}

.app-shell::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.5 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)' opacity='0.55'/></svg>");
  opacity: 0.025;
  mix-blend-mode: overlay;
  z-index: 999;
}

.content-shell {
  position: relative;
  flex: 1;
  min-height: 0;
  z-index: 1;
}

.main-pane {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
}

.pane {
  min-height: 0;
}

.page-pane {
  height: 100%;
  overflow: hidden;
  background: var(--color-bg-panel);
  border: 1px solid var(--color-border-hair);
  border-radius: var(--radius-3);
}

.page-scroll {
  min-height: 0;
  flex: 1;
  overflow: auto;
  padding-right: var(--space-2);
}

.page-scroll::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
.page-scroll::-webkit-scrollbar-thumb {
  background: var(--color-border-muted);
  border-radius: var(--radius-pill);
  border: 2px solid var(--color-bg-panel);
}
.page-scroll::-webkit-scrollbar-thumb:hover {
  background: var(--color-border-default);
}

/* Header — operator-terminal title bar */
.app-header {
  border-bottom: 1px solid var(--color-border-hair);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.015), transparent 60%);
}

.app-title {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: -0.01em;
  font-size: 15px;
  color: var(--color-text-primary);
}

.app-title-sub {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--color-text-muted);
}

.app-glyph {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border: 1px solid var(--color-border-default);
  border-radius: var(--radius-2);
  background:
    radial-gradient(circle at 30% 30%, rgba(217, 119, 87, 0.25), transparent 60%),
    var(--color-bg-elevated);
  color: var(--color-accent-strong);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 14px;
  line-height: 1;
}

/* Headings */
.h-display {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: -0.015em;
}

/* ------------------------------------------------------------------------
   Top nav — per-server tab strip
   ------------------------------------------------------------------------ */

.top-nav {
  min-width: 0;
  overflow: hidden;
}

.server-tab-strip {
  display: flex;
  align-items: center;
  gap: 2px;
  max-width: 64vw;
  overflow-x: auto;
  scrollbar-gutter: stable both-edges;
}

.server-tab-strip::-webkit-scrollbar {
  height: 4px;
}
.server-tab-strip::-webkit-scrollbar-thumb {
  background: var(--color-border-default);
  border-radius: var(--radius-pill);
}

.server-tab-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  margin-right: 8px;
  background: var(--color-text-faint);
  vertical-align: middle;
}
.server-tab-dot[data-tone="ok"] {
  background: var(--color-ok);
}
.server-tab-dot[data-tone="warn"] {
  background: var(--color-warn);
}
.server-tab-dot[data-tone="err"] {
  background: var(--color-err);
}

.server-tab-label {
  font-family: var(--font-sans);
  vertical-align: middle;
}

.server-tab-add {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: 6px;
  width: 26px;
  height: 26px;
  border-radius: var(--radius-2);
  border: 1px solid var(--color-border-muted);
  background: var(--color-bg-elevated);
  color: var(--color-text-secondary);
  cursor: pointer;
  transition: border-color 140ms var(--ease-out), color 140ms var(--ease-out);
}
.server-tab-add:hover {
  border-color: var(--color-accent);
  color: var(--color-accent-strong);
}

/* ------------------------------------------------------------------------
   Server list (index view)
   ------------------------------------------------------------------------ */

.server-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.server-row {
  position: relative;
  display: grid;
  grid-template-columns: 4px minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  padding: 12px 16px 12px 0;
  border: 1px solid var(--color-border-hair);
  border-radius: var(--radius-3);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.012), transparent),
    var(--color-bg-panel);
  color: inherit;
  text-align: left;
  cursor: pointer;
  overflow: hidden;
  animation: card-in 360ms var(--ease-out) both;
  transition: border-color 160ms var(--ease-out), transform 90ms var(--ease-out);
}
.server-row:hover {
  border-color: var(--color-border-default);
}
.server-row:active {
  transform: translateY(1px);
}
.server-row:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px var(--color-bg-base), 0 0 0 4px var(--color-accent-ring);
}

.server-row-rail {
  align-self: stretch;
  width: 4px;
  background: var(--color-text-faint);
}
.server-row[data-tone="ok"] .server-row-rail {
  background: var(--color-ok);
  box-shadow: 0 0 8px 0 var(--color-ok-dim);
}
.server-row[data-tone="warn"] .server-row-rail {
  background: var(--color-warn);
}
.server-row[data-tone="err"] .server-row-rail {
  background: var(--color-err);
}

.server-row-content {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.server-row-name {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 15px;
  letter-spacing: -0.01em;
  color: var(--color-text-primary);
}

.server-row-host {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--color-text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ------------------------------------------------------------------------
   Server detail tabs — make the sub-tab content area actually scroll
   ------------------------------------------------------------------------ */

.server-detail-tabs {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
}

.server-detail-tab-content {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-gutter: stable;
  margin-top: var(--space-3);
  padding-right: var(--space-2);
}

.server-detail-tabs .rt-TabsList {
  flex: 0 0 auto;
  min-height: 36px;
}

.server-detail-tab-content::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
.server-detail-tab-content::-webkit-scrollbar-thumb {
  background: var(--color-border-muted);
  border-radius: var(--radius-pill);
  border: 2px solid var(--color-bg-panel);
}
.server-detail-tab-content::-webkit-scrollbar-thumb:hover {
  background: var(--color-border-default);
}

/* ------------------------------------------------------------------------
   Server detail hero
   ------------------------------------------------------------------------ */

.server-detail-hero {
  display: grid;
  grid-template-columns: 4px minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  padding: 14px 16px 14px 0;
  border: 1px solid var(--color-border-hair);
  border-radius: var(--radius-3);
  flex: 0 0 auto;
  min-height: 64px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.015), transparent),
    var(--color-bg-panel);
  overflow: hidden;
}

.server-detail-hero-rail {
  align-self: stretch;
  width: 4px;
  background: var(--color-text-faint);
  transition: background-color 360ms var(--ease-out), box-shadow 360ms var(--ease-out);
}
.server-detail-hero[data-tone="ok"] .server-detail-hero-rail {
  background: var(--color-ok);
  box-shadow: 0 0 12px 0 var(--color-ok-dim);
}
.server-detail-hero[data-tone="warn"] .server-detail-hero-rail {
  background: var(--color-warn);
  box-shadow: 0 0 12px 0 var(--color-warn-dim);
}
.server-detail-hero[data-tone="err"] .server-detail-hero-rail {
  background: var(--color-err);
  box-shadow: 0 0 12px 0 var(--color-err-dim);
}

/* ------------------------------------------------------------------------
   Pods table (per-server Pods sub-tab)
   ------------------------------------------------------------------------ */

.pods-table {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.pod-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.pod-row {
  border: 1px solid var(--color-border-hair);
  border-radius: var(--radius-2);
  background: var(--color-bg-panel);
  overflow: hidden;
  transition: border-color 160ms var(--ease-out);
}
.pod-row[data-open="true"] {
  border-color: var(--color-border-muted);
}

.pod-row-summary {
  display: grid;
  grid-template-columns: 20px minmax(0, 1.6fr) auto minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  width: 100%;
  padding: 10px 12px;
  background: transparent;
  border: 0;
  color: inherit;
  text-align: left;
  cursor: pointer;
  font-family: var(--font-sans);
  font-size: 12.5px;
}
.pod-row-summary:hover {
  background: var(--color-bg-hover);
}

.pod-row-chevron {
  display: inline-flex;
  align-items: center;
  color: var(--color-text-muted);
}

.pod-row-title {
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
}

.pod-row-name {
  font-weight: 500;
  color: var(--color-text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pod-row-key {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--color-text-muted);
}

.pod-row-summary-text {
  font-size: 12px;
  color: var(--color-text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pod-row-body {
  padding: 0 12px 12px 32px;
  border-top: 1px solid var(--color-border-hair);
  background: var(--color-bg-elevated);
}

/* ------------------------------------------------------------------------
   Server card — status-first layout with hero indicator
   ------------------------------------------------------------------------ */

.server-card {
  position: relative;
  padding: 0;
  border: 1px solid var(--color-border-hair);
  border-radius: var(--radius-3);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.012) 0%, transparent 30%),
    var(--color-bg-panel);
  box-shadow: var(--shadow-1);
  overflow: hidden;
  animation: card-in 420ms var(--ease-out) both;
}

@keyframes card-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.server-card:hover {
  border-color: var(--color-border-muted);
}

.server-card-hero {
  display: grid;
  grid-template-columns: 14px minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-4) var(--space-4) var(--space-4) 0;
  border-bottom: 1px solid var(--color-border-hair);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.015), transparent);
}

.server-card-rail {
  align-self: stretch;
  width: 4px;
  background: var(--color-text-faint);
  margin-left: 0;
  transition: background-color 360ms var(--ease-out), box-shadow 360ms var(--ease-out);
}
.server-card[data-tone="ok"] .server-card-rail {
  background: var(--color-ok);
  box-shadow: 0 0 12px 0 var(--color-ok-dim);
}
.server-card[data-tone="warn"] .server-card-rail {
  background: var(--color-warn);
  box-shadow: 0 0 12px 0 var(--color-warn-dim);
}
.server-card[data-tone="err"] .server-card-rail {
  background: var(--color-err);
  box-shadow: 0 0 12px 0 var(--color-err-dim);
}
.server-card[data-tone="gray"] .server-card-rail {
  background: var(--color-text-faint);
}

.server-card-body {
  padding: var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

/* Hero name + meta */
.server-name {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 18px;
  letter-spacing: -0.015em;
  color: var(--color-text-primary);
}

.server-host {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.02em;
  color: var(--color-text-muted);
}

/* Status pill */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--color-border-muted);
  background: var(--color-bg-elevated);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--color-text-secondary);
  transition: border-color 220ms var(--ease-out), background-color 220ms var(--ease-out);
}
.status-pill[data-tone="ok"] {
  color: var(--color-ok-strong);
  border-color: rgba(118, 184, 118, 0.35);
  background: var(--color-ok-dim);
}
.status-pill[data-tone="warn"] {
  color: var(--color-warn);
  border-color: rgba(212, 168, 94, 0.35);
  background: var(--color-warn-dim);
}
.status-pill[data-tone="err"] {
  color: var(--color-err);
  border-color: rgba(214, 105, 94, 0.35);
  background: var(--color-err-dim);
}

/* Status dot */
.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 0 0 currentColor;
}
.status-dot[data-pulse="true"] {
  animation: dot-pulse 1.8s var(--ease-out) infinite;
}
@keyframes dot-pulse {
  0% {
    box-shadow: 0 0 0 0 currentColor;
  }
  70% {
    box-shadow: 0 0 0 6px transparent;
  }
  100% {
    box-shadow: 0 0 0 0 transparent;
  }
}

/* Metric grid */
.metric-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 1px;
  background: var(--color-border-hair);
  border: 1px solid var(--color-border-hair);
  border-radius: var(--radius-2);
  overflow: hidden;
}

.metric {
  padding: 10px 12px;
  background: var(--color-bg-panel);
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.metric-label {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--color-text-muted);
}

.metric-value {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--color-text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.metric-value[data-tone="ok"] {
  color: var(--color-ok-strong);
}
.metric-value[data-tone="warn"] {
  color: var(--color-warn);
}
.metric-value[data-tone="err"] {
  color: var(--color-err);
}
.metric-value[data-tone="muted"] {
  color: var(--color-text-muted);
}

/* Server stats sub-table */
.server-stats {
  border: 1px solid var(--color-border-hair);
  border-radius: var(--radius-2);
  overflow: hidden;
}

.server-stats-header,
.server-stats-row {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) 70px 80px 60px;
  gap: var(--space-3);
  padding: 8px 12px;
  font-family: var(--font-mono);
  font-size: 11px;
  align-items: center;
}

.server-stats-header {
  background: var(--color-bg-elevated);
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 10px;
  border-bottom: 1px solid var(--color-border-hair);
}

.server-stats-row {
  border-top: 1px solid var(--color-border-hair);
  background: var(--color-bg-panel);
  color: var(--color-text-primary);
}
.server-stats-row:first-child {
  border-top: 0;
}
.server-stats-row[data-tone="ok"] .server-stats-cell-phase {
  color: var(--color-ok-strong);
}
.server-stats-row[data-tone="warn"] .server-stats-cell-phase {
  color: var(--color-warn);
}
.server-stats-row[data-tone="err"] .server-stats-cell-phase {
  color: var(--color-err);
}

/* Action row */
.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

/* ------------------------------------------------------------------------
   ActionButton — proper reaction to every action
   ------------------------------------------------------------------------ */

.action-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 14px;
  min-height: 32px;
  border-radius: var(--radius-2);
  border: 1px solid var(--color-border-default);
  background: var(--color-bg-elevated);
  color: var(--color-text-primary);
  font-family: var(--font-sans);
  font-size: 12.5px;
  font-weight: 500;
  letter-spacing: 0.005em;
  cursor: pointer;
  transition:
    background-color 140ms var(--ease-out),
    border-color 140ms var(--ease-out),
    color 140ms var(--ease-out),
    transform 90ms var(--ease-out);
}

.action-btn:hover:not(:disabled):not([data-state="pending"]) {
  background: var(--color-bg-hover);
  border-color: var(--color-border-strong);
}
.action-btn:active:not(:disabled) {
  transform: translateY(1px) scale(0.98);
}
.action-btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px var(--color-bg-panel), 0 0 0 4px var(--color-accent-ring);
}
.action-btn:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.action-btn[data-tone="accent"] {
  border-color: rgba(217, 119, 87, 0.45);
  background: linear-gradient(180deg, rgba(217, 119, 87, 0.22), rgba(217, 119, 87, 0.12));
  color: var(--color-accent-strong);
}
.action-btn[data-tone="accent"]:hover:not(:disabled):not([data-state="pending"]) {
  border-color: var(--color-accent-strong);
  color: #fff5ee;
  background: linear-gradient(180deg, rgba(217, 119, 87, 0.32), rgba(217, 119, 87, 0.18));
}

.action-btn[data-tone="ok"] {
  border-color: rgba(118, 184, 118, 0.45);
  color: var(--color-ok-strong);
}
.action-btn[data-tone="ok"]:hover:not(:disabled):not([data-state="pending"]) {
  background: var(--color-ok-dim);
}

.action-btn[data-tone="danger"] {
  border-color: rgba(214, 105, 94, 0.35);
  color: var(--color-err);
}
.action-btn[data-tone="danger"]:hover:not(:disabled):not([data-state="pending"]) {
  background: var(--color-err-dim);
  border-color: rgba(214, 105, 94, 0.6);
}

.action-btn[data-state="pending"] {
  cursor: progress;
  background: var(--color-bg-elevated);
  color: var(--color-text-secondary);
}

.action-btn[data-state="success"] {
  animation: btn-success-flash 700ms var(--ease-out);
}
@keyframes btn-success-flash {
  0% {
    background-color: var(--color-bg-elevated);
    border-color: var(--color-border-default);
  }
  20% {
    background-color: var(--color-ok-dim);
    border-color: var(--color-ok-strong);
    box-shadow: 0 0 0 3px rgba(118, 184, 118, 0.18);
  }
  100% {
    background-color: var(--color-bg-elevated);
    border-color: var(--color-border-default);
    box-shadow: 0 0 0 0 transparent;
  }
}

.action-btn[data-state="error"] {
  animation: btn-error-shake 500ms var(--ease-out);
}
@keyframes btn-error-shake {
  0%,
  100% {
    transform: translateX(0);
    background-color: var(--color-bg-elevated);
  }
  15% {
    background-color: var(--color-err-dim);
  }
  20% {
    transform: translateX(-3px);
  }
  40% {
    transform: translateX(3px);
  }
  60% {
    transform: translateX(-2px);
  }
  80% {
    transform: translateX(2px);
  }
}

/* Inline spinner used inside ActionButton */
.inline-spinner {
  width: 12px;
  height: 12px;
  border: 1.5px solid var(--color-border-default);
  border-top-color: var(--color-accent);
  border-radius: 50%;
  animation: spin 700ms linear infinite;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ------------------------------------------------------------------------
   Sections, dividers, tunnel rows, components
   ------------------------------------------------------------------------ */

.section-title {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-text-muted);
  padding-bottom: 6px;
  border-bottom: 1px solid var(--color-border-hair);
  margin-bottom: 10px;
}

.tunnel-controls,
.component-health {
  padding-top: var(--space-3);
  border-top: 1px solid var(--color-border-hair);
}

.tunnel-row {
  padding: 10px 12px;
  border: 1px solid var(--color-border-hair);
  border-radius: var(--radius-2);
  background: var(--color-bg-elevated);
  display: flex;
  align-items: center;
  gap: 12px;
}

.tunnel-url {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--color-accent-strong);
  max-width: 280px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.component-group {
  border: 1px solid var(--color-border-hair);
  border-radius: var(--radius-2);
  padding: var(--space-2);
  background: var(--color-bg-elevated);
}

.component-group[open] {
  border-color: var(--color-border-muted);
}

.component-group-summary,
.component-summary {
  cursor: pointer;
  list-style: none;
  outline: none;
}

.component-group-summary::-webkit-details-marker,
.component-summary::-webkit-details-marker {
  display: none;
}

.component-group-title {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-text-muted);
}

.component-group-summary:hover .component-group-title {
  color: var(--color-text-secondary);
}

.component-row {
  border: 1px solid var(--color-border-hair);
  border-radius: var(--radius-2);
  background: var(--color-bg-panel);
}

.component-row[open] {
  border-color: var(--color-border-muted);
}

.component-summary {
  display: flex;
  padding: 8px 12px;
}

.component-summary:hover {
  background: var(--color-bg-hover);
}

.component-summary-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--color-text-primary);
}

.component-body {
  padding: 0 12px 12px;
}

.component-details {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 6px 0 0;
  padding-left: 1rem;
  color: var(--color-text-muted);
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 1.45;
}

.component-log {
  max-height: 240px;
  overflow: auto;
  padding: 10px 12px;
  border: 1px solid var(--color-border-hair);
  border-radius: var(--radius-2);
  background: var(--color-bg-base);
  color: var(--color-text-secondary);
  font-family: var(--font-mono);
  font-size: 11.5px;
  line-height: 1.45;
}

/* Empty state */
.empty-state {
  padding: var(--space-6) var(--space-4);
  border: 1px dashed var(--color-border-muted);
  border-radius: var(--radius-3);
  background:
    radial-gradient(circle at 50% -10%, rgba(217, 119, 87, 0.06), transparent 60%),
    var(--color-bg-panel);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 6px;
  min-height: 260px;
}

/* Server error block */
.server-error {
  white-space: pre-wrap;
  padding: 10px 14px;
  border: 1px solid rgba(214, 105, 94, 0.35);
  border-radius: var(--radius-2);
  color: var(--color-err);
  background: var(--color-err-dim);
  font-family: var(--font-mono);
  font-size: 11.5px;
}

/* ------------------------------------------------------------------------
   Log sidebar
   ------------------------------------------------------------------------ */

.log-sidebar {
  flex: 0 0 440px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--color-bg-panel);
  border: 1px solid var(--color-border-hair);
  border-radius: var(--radius-3);
  transition: flex-basis 220ms var(--ease-out);
}

.log-sidebar[data-collapsed="true"] {
  flex-basis: 44px;
  align-items: center;
  padding-block: var(--space-3);
  gap: 10px;
}

.log-sidebar[data-collapsed="true"] .log-sidebar-rail {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding-top: 8px;
  writing-mode: vertical-rl;
}

.log-sidebar[data-collapsed="true"] .log-sidebar-rail-label {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  color: var(--color-text-muted);
}

.log-sidebar[data-collapsed="true"] .log-sidebar-rail-count {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--color-text-secondary);
  writing-mode: horizontal-tb;
}

.log-sidebar-rail-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--color-text-faint);
  writing-mode: horizontal-tb;
}
.log-sidebar-rail-dot.log-info {
  background: var(--color-info);
}
.log-sidebar-rail-dot.log-warn {
  background: var(--color-warn);
}
.log-sidebar-rail-dot.log-error {
  background: var(--color-err);
}
.log-sidebar-rail-dot.log-debug {
  background: var(--color-text-muted);
}

.log-sidebar-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: var(--radius-2);
  border: 1px solid var(--color-border-muted);
  background: var(--color-bg-elevated);
  color: var(--color-text-secondary);
  cursor: pointer;
  transition: border-color 140ms var(--ease-out), color 140ms var(--ease-out);
}
.log-sidebar-toggle:hover {
  border-color: var(--color-accent);
  color: var(--color-accent-strong);
}

.log-sidebar-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: var(--radius-2);
  border: 1px solid var(--color-border-muted);
  background: var(--color-bg-elevated);
  color: var(--color-text-secondary);
  cursor: pointer;
  transition: border-color 140ms var(--ease-out), color 140ms var(--ease-out);
}
.log-sidebar-icon-btn:hover:not(:disabled) {
  border-color: var(--color-border-strong);
  color: var(--color-text-primary);
}
.log-sidebar-icon-btn:disabled {
  cursor: not-allowed;
  opacity: 0.4;
}

.log-scope-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--color-border-muted);
  background: var(--color-bg-elevated);
  color: var(--color-text-secondary);
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
  transition: border-color 140ms var(--ease-out), color 140ms var(--ease-out);
}
.log-scope-toggle[data-scoped="true"] {
  border-color: rgba(217, 119, 87, 0.45);
  color: var(--color-accent-strong);
  background: var(--color-accent-dim);
}
.log-scope-toggle:hover {
  border-color: var(--color-accent);
}

.log-body {
  min-height: 0;
  flex: 1;
  overflow: auto;
}

.log-line {
  min-height: 22px;
  align-items: baseline;
  padding: 2px var(--space-2);
  border-radius: var(--radius-1);
  animation: log-in 240ms var(--ease-out);
}
@keyframes log-in {
  from {
    opacity: 0;
    transform: translateX(-4px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.log-line:hover {
  background: var(--color-bg-hover);
}

.log-text {
  font-family: var(--font-mono);
  font-size: 11.5px;
  line-height: 1.4;
  color: var(--color-text-secondary);
}

.log-meta {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--color-text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.log-level {
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.log-debug .log-level {
  color: var(--color-text-muted);
}
.log-info .log-level {
  color: var(--color-info);
}
.log-warn .log-level {
  color: var(--color-warn);
}
.log-error .log-level {
  color: var(--color-err);
}

.mono {
  font-family: var(--font-mono);
}

/* Field labels */
.field-label {
  display: block;
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--color-text-muted);
  margin-bottom: 4px;
}

/* Radix Button general polish */
button,
[role="button"],
.rt-Button,
.rt-SelectTrigger,
.rt-TabNavLink {
  cursor: pointer;
}

button:disabled,
[aria-disabled="true"],
.rt-Button:disabled,
.rt-Button[data-disabled],
.rt-SelectTrigger[data-disabled] {
  cursor: not-allowed;
}

.rt-Button,
.rt-SelectTrigger,
.rt-TabNavLink {
  font-family: var(--font-sans);
  transition:
    background-color 140ms var(--ease-out),
    border-color 140ms var(--ease-out),
    color 140ms var(--ease-out),
    transform 90ms var(--ease-out);
}

.rt-Button:not(:disabled):not([data-disabled]):active,
.rt-SelectTrigger:not([data-disabled]):active {
  transform: translateY(1px) scale(0.98);
}

.install-step-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px 10px;
  border: 1px solid var(--color-border-hair);
  border-radius: var(--radius-2);
  background: var(--color-bg-elevated);
}

.install-step-row {
  font-family: var(--font-sans);
}

.install-step-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 5px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  border-radius: var(--radius-1);
  border: 1px solid var(--color-border-hair);
  background: var(--color-bg-panel);
  color: var(--color-text-muted);
}

.install-step-icon.install-step-running {
  color: var(--amber-11);
  border-color: var(--amber-7);
}

.install-step-icon.install-step-ok {
  color: var(--green-11);
  border-color: var(--green-7);
}

.install-step-icon.install-step-error {
  color: var(--red-11);
  border-color: var(--red-7);
}

.install-step-icon.install-step-skipped {
  color: var(--gray-9);
}

.run-row-summary {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  cursor: pointer;
  list-style: none;
}

.run-row-summary::-webkit-details-marker {
  display: none;
}

.run-row {
  border: 1px solid var(--color-border-hair);
  border-radius: var(--radius-2);
  background: var(--color-bg-panel);
}

.run-row[open] {
  border-color: var(--color-border-muted);
}

.run-row-body {
  padding: 0 12px 12px;
}

.run-log-box {
  max-height: 320px;
  overflow: auto;
  padding: 10px 12px;
  border: 1px solid var(--color-border-hair);
  border-radius: var(--radius-2);
  background: var(--color-bg-base);
  font-family: var(--font-mono);
  font-size: 11.5px;
  line-height: 1.45;
}

.log-level-error { color: var(--red-11); }
.log-level-warn { color: var(--amber-11); }
.log-level-info { color: var(--gray-11); }
.log-ts { color: var(--gray-9); margin: 0 6px; }

.combobox-trigger {
  width: 100%;
  justify-content: stretch;
  text-align: left;
}

.combobox-trigger-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.combobox-list {
  display: flex;
  flex-direction: column;
  gap: 1px;
  max-height: 260px;
  overflow-y: auto;
  border: 1px solid var(--color-border-hair);
  border-radius: var(--radius-2);
  background: var(--color-bg-panel);
  padding: 2px;
}

.combobox-option {
  display: block;
  width: 100%;
  padding: 6px 8px;
  border: 0;
  background: transparent;
  color: var(--color-text-primary);
  font: inherit;
  text-align: left;
  cursor: pointer;
  border-radius: var(--radius-1);
}

.combobox-option:hover,
.combobox-option:focus-visible {
  background: var(--color-bg-hover);
  outline: none;
}

.schedule-grid {
  display: grid;
  grid-template-columns: 200px minmax(0, 1fr);
  row-gap: 10px;
  column-gap: 12px;
  align-items: center;
}

.schedule-section {
  border: 1px solid var(--color-border-hair);
  border-radius: var(--radius-2);
  background: var(--color-bg-elevated);
  padding: 14px 16px;
}

@media (max-width: 980px) {
  .content-shell {
    flex-direction: column;
  }
  .log-pane,
  .log-pane.is-collapsed {
    flex: 0 0 260px;
    width: 100%;
  }
  .server-stats-header,
  .server-stats-row {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 60px 70px;
  }
  .server-stats-cell-age {
    display: none;
  }
}

/* Release-notes markdown shown in the update dialog. Bounded with scroll so a
   long changelog stays compact, and headings are toned down to fit a dialog. */
.release-notes-md {
  margin-top: var(--space-1);
  max-height: 220px;
  overflow-y: auto;
  font-size: var(--font-size-2);
  line-height: 1.5;
  color: var(--gray-12);
}
.release-notes-md > :first-child {
  margin-top: 0;
}
.release-notes-md h1,
.release-notes-md h2,
.release-notes-md h3 {
  font-size: var(--font-size-2);
  font-weight: 600;
  margin: var(--space-3) 0 var(--space-1);
}
.release-notes-md p {
  margin: var(--space-1) 0;
}
.release-notes-md ul,
.release-notes-md ol {
  margin: var(--space-1) 0;
  padding-left: 1.2rem;
}
.release-notes-md li {
  margin: 2px 0;
}
.release-notes-md code {
  font-family: var(--code-font-family, monospace);
  font-size: 0.9em;
  background: var(--gray-3);
  padding: 0 4px;
  border-radius: 4px;
}
