/* ========================================================
   THEME DEFINITIONS: Crisp Modern Light (Default) & Rich Slate Dark
   ======================================================== */
:root {
  /* Crisp, bright modern look (Default) */
  --bg-primary: #f0f4f9;
  --bg-card: #ffffff;
  --bg-card-hover: #f8fafc;
  --bg-surface: #edf2f7;
  --border-color: #e2e8f0;
  --border-glow: rgba(2, 132, 199, 0.25);
  
  --text-main: #0f172a;
  --text-muted: #475569;
  --text-dim: #64748b;

  --cyan: #0284c7;
  --cyan-glow: rgba(2, 132, 199, 0.2);
  --emerald: #059669;
  --emerald-glow: rgba(5, 150, 105, 0.2);
  --purple: #7c3aed;
  --purple-glow: rgba(124, 58, 237, 0.2);
  --amber: #d97706;
  --rose: #e11d48;

  --shadow-card: 0 4px 14px rgba(0, 0, 0, 0.05), 0 1px 3px rgba(0, 0, 0, 0.03);
  --shadow-hover: 0 10px 25px rgba(0, 0, 0, 0.08), 0 3px 6px rgba(0, 0, 0, 0.04);
  --shadow-glow: 0 0 16px rgba(2, 132, 199, 0.15);

  --font-sans: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  --radius-lg: 16px;
  --radius-md: 10px;
  --radius-sm: 6px;
}

/* Rich, high-contrast Slate Dark (when toggled) */
[data-theme="dark"] {
  --bg-primary: #0f172a;
  --bg-card: #1e293b;
  --bg-card-hover: #334155;
  --bg-surface: #141e30;
  --border-color: #334155;
  --border-glow: rgba(56, 189, 248, 0.35);
  
  --text-main: #f8fafc;
  --text-muted: #cbd5e1;
  --text-dim: #94a3b8;

  --cyan: #38bdf8;
  --cyan-glow: rgba(56, 189, 248, 0.25);
  --emerald: #34d399;
  --emerald-glow: rgba(52, 211, 153, 0.25);
  --purple: #a78bfa;
  --purple-glow: rgba(167, 139, 250, 0.25);
  --amber: #fbbf24;
  --rose: #f43f5e;

  --shadow-card: 0 6px 20px rgba(0, 0, 0, 0.25);
  --shadow-hover: 0 12px 30px rgba(0, 0, 0, 0.4);
  --shadow-glow: 0 0 20px rgba(56, 189, 248, 0.25);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  background-color: var(--bg-primary);
  background-image: 
    radial-gradient(circle at 15% 15%, rgba(2, 132, 199, 0.05) 0%, transparent 45%),
    radial-gradient(circle at 85% 85%, rgba(124, 58, 237, 0.05) 0%, transparent 45%);
  color: var(--text-main);
  font-family: var(--font-sans);
  min-height: 100vh;
  line-height: 1.5;
  transition: background-color 0.3s ease, color 0.3s ease;
  -webkit-font-smoothing: antialiased;
}

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

.text-cyan { color: var(--cyan); }
.text-emerald { color: var(--emerald); }
.text-purple { color: var(--purple); }
.text-amber { color: var(--amber); }
.text-rose { color: var(--rose); }

.app-container {
  max-width: 1440px;
  margin: 0 auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* ========================================================
   HEADER & NAVIGATION
   ======================================================== */
.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  padding: 16px 24px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.logo-icon {
  position: relative;
  width: 44px;
  height: 44px;
  background: linear-gradient(135deg, rgba(2, 132, 199, 0.12), rgba(124, 58, 237, 0.12));
  border: 1px solid var(--border-glow);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--cyan);
}

.pulse-ring {
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 12px;
  border: 1px solid var(--cyan);
  animation: pulse-border 2.5s infinite ease-out;
  pointer-events: none;
}

@keyframes pulse-border {
  0% { transform: scale(1); opacity: 0.8; }
  100% { transform: scale(1.3); opacity: 0; }
}

.brand-text h1 {
  font-size: 1.35rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
  letter-spacing: -0.02em;
}

.badge-tag {
  font-size: 0.65rem;
  font-family: var(--font-mono);
  background: rgba(2, 132, 199, 0.12);
  color: var(--cyan);
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid var(--border-glow);
}

.subtitle {
  font-size: 0.82rem;
  color: var(--text-muted);
}

.header-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

/* Theme Toggle Button */
.theme-toggle-btn {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  font-family: var(--font-sans);
  font-size: 0.78rem;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.theme-toggle-btn:hover {
  border-color: var(--cyan);
  background: var(--bg-card);
}

.view-mode-toggle,
.source-toggle {
  display: flex;
  background: var(--bg-surface);
  padding: 3px;
  border-radius: 10px;
  border: 1px solid var(--border-color);
}

.toggle-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 0.78rem;
  font-family: var(--font-sans);
  padding: 6px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.toggle-btn.active {
  background: var(--cyan);
  color: #ffffff;
  font-weight: 600;
  box-shadow: 0 2px 6px var(--cyan-glow);
}

.connection-status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.78rem;
  font-family: var(--font-mono);
  color: var(--text-muted);
  background: var(--bg-surface);
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--emerald);
  box-shadow: 0 0 8px var(--emerald);
  animation: blink 2s infinite;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* ========================================================
   FLEET BAR SECTION
   ======================================================== */
.fleet-bar-section {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: var(--shadow-card);
}

.fleet-bar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.fleet-title {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-main);
}

.fleet-title h3 {
  font-size: 0.95rem;
  font-weight: 600;
}

.btn-add-node {
  background: rgba(2, 132, 199, 0.08);
  border: 1px solid var(--border-glow);
  color: var(--cyan);
  font-family: var(--font-sans);
  font-size: 0.8rem;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-add-node:hover {
  background: var(--cyan);
  color: #ffffff;
}

.fleet-cards-scroll {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px;
}

.fleet-node-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: all 0.2s ease;
  position: relative;
}

.fleet-node-card:hover {
  border-color: var(--cyan);
  background: var(--bg-card-hover);
  transform: translateY(-2px);
  box-shadow: var(--shadow-card);
}

.fleet-node-card.selected {
  border-color: var(--cyan);
  background: rgba(2, 132, 199, 0.06);
  box-shadow: var(--shadow-glow);
}

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

.node-card-brand {
  display: flex;
  align-items: center;
  gap: 8px;
}

.node-os-icon {
  font-size: 1.1rem;
}

.node-card-name {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 150px;
}

.node-status-pill {
  font-size: 0.68rem;
  font-family: var(--font-mono);
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
}

.node-status-pill.online {
  background: rgba(5, 150, 105, 0.12);
  color: var(--emerald);
}

.node-status-pill.offline {
  background: rgba(225, 29, 72, 0.12);
  color: var(--rose);
}

.node-card-stats {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 6px;
  font-size: 0.72rem;
  font-family: var(--font-mono);
  background: var(--bg-card);
  padding: 6px 8px;
  border-radius: 6px;
  border: 1px solid var(--border-color);
}

.node-mini-stat {
  display: flex;
  flex-direction: column;
}

.node-mini-lbl {
  font-size: 0.6rem;
  color: var(--text-dim);
}

.node-mini-val {
  font-weight: 600;
}

/* ========================================================
   ALERT BANNER (Shown when Task or Agent is stopped/deleted)
   ======================================================== */
.agent-alert-banner {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 20px;
  background: rgba(225, 29, 72, 0.1);
  border: 1px solid rgba(225, 29, 72, 0.4);
  border-radius: var(--radius-lg);
  color: var(--text-main);
  box-shadow: 0 4px 14px rgba(225, 29, 72, 0.15);
  margin-bottom: 14px;
  animation: pulse-alert 3s infinite ease-in-out;
}

@keyframes pulse-alert {
  0%, 100% { border-color: rgba(225, 29, 72, 0.4); }
  50% { border-color: rgba(225, 29, 72, 0.85); box-shadow: 0 4px 20px rgba(225, 29, 72, 0.3); }
}

.alert-icon {
  font-size: 1.6rem;
  line-height: 1;
}

.alert-content {
  display: flex;
  flex-direction: column;
  flex-grow: 1;
  gap: 2px;
}

.alert-content strong {
  color: var(--rose);
  font-size: 0.92rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.alert-content span {
  font-size: 0.82rem;
  color: var(--text-muted);
}

.alert-meta {
  font-size: 0.78rem;
  color: var(--text-dim);
  background: var(--bg-card);
  padding: 4px 10px;
  border-radius: 6px;
  border: 1px solid var(--border-color);
  white-space: nowrap;
}

/* ========================================================
   ACTIVE NODE BANNER
   ======================================================== */
.active-node-banner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  padding: 16px 22px;
  background: linear-gradient(90deg, rgba(2, 132, 199, 0.08), rgba(124, 58, 237, 0.06));
  border: 1px solid var(--border-glow);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
}

.active-badge {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--cyan);
  display: inline-block;
  margin-bottom: 2px;
}

.active-node-info h2 {
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1.2;
}

.active-node-info p {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.system-meta-bar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.meta-pill {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.78rem;
  display: flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
}

.meta-label {
  color: var(--text-dim);
  font-weight: 600;
  font-size: 0.7rem;
}

.meta-val {
  color: var(--text-main);
  font-weight: 600;
}

.btn-restart-pc {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: linear-gradient(135deg, rgba(217, 119, 6, 0.15), rgba(225, 29, 72, 0.12));
  border: 1px solid rgba(217, 119, 6, 0.4);
  color: #fbbf24;
  font-family: var(--font-sans);
  font-size: 0.8rem;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.btn-restart-pc:hover {
  background: linear-gradient(135deg, #d97706, #e11d48);
  color: #ffffff;
  border-color: transparent;
  box-shadow: 0 3px 12px rgba(217, 119, 6, 0.35);
  transform: translateY(-1px);
}

.btn-restart-pc:active {
  transform: translateY(0);
}

.btn-comp-restart {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(217, 119, 6, 0.12);
  border: 1px solid rgba(217, 119, 6, 0.35);
  color: #fbbf24;
  font-family: var(--font-sans);
  font-size: 0.76rem;
  font-weight: 600;
  padding: 8px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.18s ease;
}

.btn-comp-restart:hover {
  background: #d97706;
  color: #ffffff;
  border-color: #d97706;
  box-shadow: 0 2px 8px rgba(217, 119, 6, 0.3);
}

/* ========================================================
   FLEET COMPARISON GRID VIEW
   ======================================================== */
.comparison-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
  gap: 20px;
}

.comp-node-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  box-shadow: var(--shadow-card);
  transition: all 0.2s ease;
}

.comp-node-card:hover {
  border-color: var(--cyan);
  box-shadow: var(--shadow-hover);
  transform: translateY(-2px);
}

.comp-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.comp-title-block h3 {
  font-size: 1.15rem;
  font-weight: 700;
}

.comp-title-block p {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.comp-metrics-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.comp-metric-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.comp-metric-info {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
}

.btn-comp-drill {
  background: rgba(2, 132, 199, 0.08);
  border: 1px solid var(--border-glow);
  color: var(--cyan);
  font-family: var(--font-sans);
  font-size: 0.82rem;
  font-weight: 600;
  padding: 10px;
  border-radius: 8px;
  cursor: pointer;
  text-align: center;
  transition: all 0.2s;
  margin-top: 6px;
}

.btn-comp-drill:hover {
  background: var(--cyan);
  color: #ffffff;
}

/* ========================================================
   DASHBOARD GRID & TELEMETRY CARDS
   ======================================================== */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
  gap: 20px;
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  box-shadow: var(--shadow-card);
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.card:hover {
  border-color: var(--border-glow);
  box-shadow: var(--shadow-hover);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.card-title {
  display: flex;
  align-items: center;
  gap: 10px;
}

.card-title .icon {
  color: var(--cyan);
}

.card-title h2 {
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.metric-freq {
  font-size: 0.75rem;
  font-family: var(--font-mono);
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  padding: 4px 8px;
  border-radius: 6px;
  color: var(--text-muted);
}

/* Gauge layout */
.gauge-section {
  display: flex;
  align-items: center;
  gap: 20px;
}

.radial-gauge-container {
  position: relative;
  width: 100px;
  height: 100px;
  flex-shrink: 0;
}

.radial-svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.radial-bg {
  fill: none;
  stroke: var(--bg-surface);
  stroke-width: 9;
}

.radial-bar {
  fill: none;
  stroke-width: 9;
  stroke-linecap: round;
  stroke-dasharray: 314;
  stroke-dashoffset: 226;
  transition: stroke-dashoffset 0.6s cubic-bezier(0.4, 0, 0.2, 1), stroke 0.3s ease;
}

.cpu-radial { stroke: var(--cyan); filter: drop-shadow(0 0 4px var(--cyan-glow)); }
.ram-radial { stroke: var(--purple); filter: drop-shadow(0 0 4px var(--purple-glow)); }

.radial-content {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  display: flex;
  flex-direction: column;
}

.radial-value {
  font-size: 1.35rem;
  font-weight: 700;
  font-family: var(--font-mono);
  letter-spacing: -0.03em;
}

.radial-sub {
  font-size: 0.6rem;
  color: var(--text-dim);
  font-weight: 700;
}

.quick-stats {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex-grow: 1;
}

.stat-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  padding-bottom: 3px;
  border-bottom: 1px dashed var(--border-color);
}

.stat-label {
  color: var(--text-muted);
}

.stat-value {
  font-weight: 600;
  color: var(--text-main);
}

/* Cores Grid */
.cores-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--bg-surface);
  border-radius: var(--radius-md);
  padding: 12px;
  border: 1px solid var(--border-color);
}

.cores-header {
  display: flex;
  justify-content: space-between;
  font-size: 0.72rem;
  color: var(--text-dim);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.cores-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 6px;
}

.core-bar-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.core-track {
  width: 100%;
  height: 38px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: flex-end;
}

.core-fill {
  width: 100%;
  background: linear-gradient(to top, var(--cyan), #38bdf8);
  border-radius: 3px;
  transition: height 0.4s ease;
}

.core-lbl {
  font-size: 0.6rem;
  font-family: var(--font-mono);
  color: var(--text-dim);
}

/* Storage / Memory Allocation Bars */
.storage-bar-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.bar-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.multi-progress {
  height: 10px;
  background: var(--bg-surface);
  border-radius: 6px;
  border: 1px solid var(--border-color);
  display: flex;
  overflow: hidden;
}

.progress-segment {
  height: 100%;
  transition: width 0.5s ease;
}

.seg-used { background: var(--purple); }
.seg-cached { background: var(--cyan); opacity: 0.7; }
.seg-free { background: transparent; }

.progress-legend {
  display: flex;
  gap: 14px;
  font-size: 0.7rem;
  color: var(--text-dim);
}

.dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  margin-right: 4px;
}

.dot-used { background: var(--purple); }
.dot-cached { background: var(--cyan); }
.dot-free { background: var(--text-dim); }

/* Drives */
.drives-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.drive-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.drive-info {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
}

.drive-type {
  font-size: 0.68rem;
  color: var(--text-dim);
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  padding: 1px 5px;
  border-radius: 4px;
  margin-left: 4px;
}

.progress-track {
  width: 100%;
  height: 8px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  overflow: hidden;
}

.progress-track.sm {
  height: 6px;
  margin-top: 6px;
}

.progress-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.4s ease;
}

.fill-cyan { background: var(--cyan); }
.fill-emerald { background: var(--emerald); }
.fill-purple { background: var(--purple); }
.fill-amber { background: var(--amber); }

.disk-io-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  font-family: var(--font-mono);
  color: var(--cyan);
}

.io-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 6px var(--cyan);
  animation: io-blink 0.6s infinite alternate;
}

@keyframes io-blink {
  from { opacity: 0.2; }
  to { opacity: 1; }
}

.disk-rates-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.rate-box {
  background: var(--bg-surface);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  border: 1px solid var(--border-color);
}

.rate-title {
  display: block;
  font-size: 0.68rem;
  color: var(--text-dim);
  font-weight: 600;
}

.rate-value {
  font-size: 1.1rem;
  font-weight: 700;
}

/* Network */
.net-speed-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.speed-box {
  background: var(--bg-surface);
  border-radius: var(--radius-md);
  padding: 12px;
  border: 1px solid var(--border-color);
  text-align: center;
}

.speed-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 0.7rem;
  color: var(--text-dim);
  margin-bottom: 4px;
}

.speed-number {
  font-size: 1.6rem;
  font-weight: 700;
  display: block;
  line-height: 1.1;
}

.speed-unit {
  font-size: 0.7rem;
  color: var(--text-dim);
}

.net-details {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.ping-badge {
  font-size: 0.75rem;
  background: rgba(5, 150, 105, 0.1);
  color: var(--emerald);
  border: 1px solid rgba(5, 150, 105, 0.2);
  padding: 3px 8px;
  border-radius: 6px;
}

/* GPU Card */
.quick-stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.mini-stat-card {
  background: var(--bg-surface);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  border: 1px solid var(--border-color);
}

.mini-label {
  display: block;
  font-size: 0.7rem;
  color: var(--text-dim);
  margin-bottom: 2px;
}

.mini-val {
  font-size: 1.05rem;
  font-weight: 600;
}

/* Sparklines Canvas */
.sparkline-wrapper {
  width: 100%;
  height: 60px;
  background: var(--bg-surface);
  border-radius: var(--radius-sm);
  padding: 4px;
  border: 1px solid var(--border-color);
}

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

/* Processes Section */
.processes-card {
  grid-column: 1 / -1;
}

.table-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.search-input {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 0.8rem;
  color: var(--text-main);
  outline: none;
  width: 200px;
  transition: border-color 0.2s ease;
}

.search-input:focus {
  border-color: var(--cyan);
}

.process-counter {
  font-size: 0.75rem;
  color: var(--text-dim);
}

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

.proc-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
  text-align: left;
}

.proc-table th {
  color: var(--text-dim);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-color);
}

.proc-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-color);
  font-family: var(--font-mono);
  color: var(--text-muted);
}

.proc-table tbody tr:hover {
  background: var(--bg-surface);
}

.proc-name-cell {
  font-family: var(--font-sans) !important;
  color: var(--text-main) !important;
  vertical-align: middle;
}

.proc-name-flex {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 24px;
}

.proc-chevron {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  font-size: 0.68rem;
  color: var(--text-muted);
  user-select: none;
  border-radius: 3px;
  transition: color 0.15s ease, background-color 0.15s ease;
}

.proc-chevron.expandable {
  cursor: pointer;
}

.proc-chevron.expandable:hover {
  color: var(--cyan);
  background: rgba(2, 132, 199, 0.1);
}

.proc-chevron.empty {
  visibility: hidden;
  pointer-events: none;
}

.proc-icon {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 2px;
  background: rgba(2, 132, 199, 0.25);
  border: 1px solid var(--cyan);
  flex-shrink: 0;
}

.proc-title {
  font-weight: 600;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.status-badge {
  font-size: 0.7rem;
  padding: 2px 6px;
  border-radius: 4px;
}

.status-badge.running {
  background: rgba(5, 150, 105, 0.12);
  color: var(--emerald);
}

.status-badge.sleeping {
  background: rgba(100, 116, 139, 0.12);
  color: var(--text-dim);
}

/* Footer */
.footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  padding: 16px 24px;
  font-size: 0.8rem;
  color: var(--text-dim);
  border-top: 1px solid var(--border-color);
}

.footer strong {
  color: #f38020;
}

.footer-links {
  display: flex;
  align-items: center;
  gap: 8px;
}

.footer-links a {
  color: var(--cyan);
  text-decoration: none;
  transition: opacity 0.2s;
}

.footer-links a:hover {
  text-decoration: underline;
}

/* Modals */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(6px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 16px;
}

.modal-overlay.active {
  display: flex;
}

.modal-content {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px;
  max-width: 520px;
  width: 100%;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.25);
  color: var(--text-main);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.modal-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.4rem;
  cursor: pointer;
}

.modal-body p {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 14px;
}

.code-step {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.step-num {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--cyan);
  color: #ffffff;
  font-weight: 700;
  font-size: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.code-step code {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  padding: 8px 12px;
  border-radius: 6px;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--emerald);
  flex-grow: 1;
}

.modal-note {
  font-size: 0.78rem !important;
  color: var(--text-dim) !important;
  margin-top: 14px;
  border-left: 2px solid var(--cyan);
  padding-left: 10px;
}

/* Modal Form */
.modal-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-main);
}

.form-group input,
.form-group select {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--text-main);
  font-family: var(--font-sans);
  font-size: 0.85rem;
  outline: none;
  transition: border-color 0.2s;
}

.form-group input:focus,
.form-group select:focus {
  border-color: var(--cyan);
}

.form-group small {
  font-size: 0.72rem;
  color: var(--text-dim);
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 8px;
}

.btn-cancel {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  font-family: var(--font-sans);
  font-size: 0.8rem;
  padding: 8px 14px;
  border-radius: 8px;
  cursor: pointer;
}

.btn-primary {
  background: var(--cyan);
  border: none;
  color: #ffffff;
  font-family: var(--font-sans);
  font-size: 0.8rem;
  font-weight: 700;
  padding: 8px 16px;
  border-radius: 8px;
  cursor: pointer;
  transition: opacity 0.2s;
}

.btn-primary:hover {
  opacity: 0.9;
}

/* Sortable Table Headers */
.sortable-th {
  cursor: pointer;
  user-select: none;
  transition: color 0.2s ease, background-color 0.2s ease;
  white-space: nowrap;
}

.sortable-th:hover {
  color: var(--cyan);
  background: var(--bg-surface);
}

.sortable-th.sorted {
  color: var(--cyan);
  font-weight: 700;
}

.sort-arrow {
  display: inline-block;
  margin-left: 5px;
  font-size: 0.72rem;
  opacity: 0.5;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.sortable-th.sorted .sort-arrow {
  opacity: 1;
  color: var(--cyan);
  font-weight: bold;
}

/* Sticky Header & Scrollable Process Table */
.table-responsive {
  max-height: 620px;
  overflow-y: auto;
  position: relative;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

.proc-table thead th {
  position: sticky;
  top: 0;
  z-index: 5;
  background: var(--bg-card);
  box-shadow: 0 1px 0 var(--border-color);
}

/* Process Group & Child Rows */
.proc-group-row {
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.proc-group-row:hover {
  background-color: var(--bg-surface);
}

.proc-chevron {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  margin-right: 6px;
  font-size: 0.68rem;
  color: var(--text-muted);
  transition: color 0.15s ease;
  user-select: none;
}

.proc-group-row:hover .proc-chevron {
  color: var(--cyan);
}

.proc-count-badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-left: 6px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  padding: 1px 6px;
  border-radius: 10px;
}

/* Child Instance Rows */
.proc-child-row {
  background-color: rgba(0, 0, 0, 0.02);
  font-size: 0.82rem;
}

[data-theme="dark"] .proc-child-row {
  background-color: rgba(255, 255, 255, 0.02);
}

.proc-child-row:hover {
  background-color: var(--bg-surface);
}

.proc-child-indent {
  padding-left: 20px;
}

.proc-child-branch {
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  flex-shrink: 0;
}

.proc-child-icon {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 2px;
  background: rgba(168, 85, 247, 0.3);
  border: 1px solid var(--purple);
  flex-shrink: 0;
}

.proc-child-name {
  color: var(--text-muted);
  font-size: 0.82rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.proc-child-idx {
  color: var(--text-dim);
  font-size: 0.72rem;
  flex-shrink: 0;
}

/* Task Manager Heatmap Tints */
.heat-cell {
  position: relative;
  transition: background-color 0.2s ease;
}

.heat-cpu-active {
  background-color: rgba(168, 85, 247, 0.12) !important;
  color: var(--purple) !important;
  font-weight: 600;
}

.heat-cpu-high {
  background-color: rgba(244, 63, 94, 0.16) !important;
  color: var(--rose) !important;
  font-weight: 700;
}

.heat-mem-low {
  background-color: rgba(168, 85, 247, 0.06) !important;
}

.heat-mem-med {
  background-color: rgba(168, 85, 247, 0.15) !important;
  color: var(--purple) !important;
  font-weight: 600;
}

.heat-mem-high {
  background-color: rgba(168, 85, 247, 0.25) !important;
  color: #a855f7 !important;
  font-weight: 700;
}

/* Process Table Kill Button & Controls */
.btn-kill-row {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(244, 63, 94, 0.12);
  border: 1px solid rgba(244, 63, 94, 0.35);
  color: var(--rose);
  font-family: var(--font-sans);
  font-size: 0.72rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.18s ease;
}

.btn-kill-row:hover {
  background: var(--rose);
  color: #ffffff;
  border-color: var(--rose);
  box-shadow: 0 0 10px rgba(244, 63, 94, 0.35);
  transform: translateY(-1px);
}

.btn-kill-row:active {
  transform: translateY(0);
}

.btn-outline-danger {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(244, 63, 94, 0.1);
  border: 1px solid rgba(244, 63, 94, 0.4);
  color: var(--rose);
  font-size: 0.78rem;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-outline-danger:hover {
  background: var(--rose);
  color: #ffffff;
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-main);
  pointer-events: auto;
  animation: toastIn 0.3s ease forwards;
}

.toast.toast-success {
  border-left: 4px solid var(--emerald);
}

.toast.toast-error {
  border-left: 4px solid var(--rose);
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Responsive */
@media (max-width: 768px) {
  .header {
    flex-direction: column;
    align-items: flex-start;
  }
  .system-meta-bar {
    width: 100%;
  }
  .dashboard-grid {
    grid-template-columns: 1fr;
  }
  .fleet-cards-scroll {
    grid-template-columns: 1fr;
  }
}
