:root {
  color-scheme: dark;
  --bg: #0a0a0a;
  --surface: #111111;
  --surface2: #1a1a1a;
  --surface3: #222222;
  --border: #222;
  --border-focus: #ff2d78;
  --text: #e8e8e8;
  --muted: #666;
  --pink: #ff2d78;
  --pink-dim: #cc2460;
  --pink-bg: rgba(255, 45, 120, 0.08);
  --pink-bg-hover: rgba(255, 45, 120, 0.14);
  --good: #22c55e;
  --bad: #ef4444;
  --warn: #f59e0b;
  --radius: 8px;
  --radius-lg: 12px;
  --sidebar-w: 240px;
  --topbar-h: 56px;
}

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

html, body { min-height: 100%; }

body {
  font-family: 'Inter', ui-sans-serif, system-ui, -apple-system, sans-serif;
  color: var(--text);
  background: var(--bg);
  font-size: 14px;
  line-height: 1.5;
}

a { color: var(--pink); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ═══════════════════════════════════════════════════════════
   SIDEBAR LAYOUT
   ═══════════════════════════════════════════════════════════ */

.app-layout {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
}

.sidebar-brand {
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.sidebar-brand-text h2 {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
  color: var(--text);
}

.sidebar-brand-text span {
  font-size: 10px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 12px 0;
}

.sidebar-section {
  padding: 0 12px;
  margin-bottom: 8px;
}

.sidebar-section-title {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  padding: 8px 12px 4px;
  font-weight: 600;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius);
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  transition: all 0.12s;
  text-decoration: none;
  cursor: pointer;
}

.sidebar-link:hover {
  background: var(--pink-bg);
  color: var(--text);
  text-decoration: none;
}

.sidebar-link.active {
  background: var(--pink-bg);
  color: var(--pink);
}

.sidebar-link .badge-count {
  margin-left: auto;
  background: var(--surface3);
  color: var(--muted);
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 999px;
  font-weight: 600;
}

.sidebar-link.active .badge-count {
  background: var(--pink);
  color: #fff;
}

.sidebar-footer {
  padding: 12px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

/* ═══════════════════════════════════════════════════════════
   MAIN CONTENT
   ═══════════════════════════════════════════════════════════ */

.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.topbar {
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  position: sticky;
  top: 0;
  z-index: 50;
}

.topbar h1 {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.topbar-actions { display: flex; gap: 8px; align-items: center; }

.page-content {
  flex: 1;
  padding: 24px;
}

/* ═══════════════════════════════════════════════════════════
   AUTH
   ═══════════════════════════════════════════════════════════ */

.auth-page {
  display: grid;
  place-items: center;
  min-height: 100vh;
  background: var(--bg);
}

.auth-card {
  width: min(400px, 100%);
  padding: 40px 32px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 8px;
}

.auth-brand-mark {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-lg);
  display: grid;
  place-items: center;
  background: var(--pink-bg);
  border: 1px solid var(--pink-dim);
  font-weight: 800;
  font-size: 13px;
  color: var(--pink);
  letter-spacing: -0.5px;
}

.auth-brand h1 { font-size: 22px; font-weight: 700; letter-spacing: -0.02em; }

.auth-sub { color: var(--muted); margin-bottom: 24px; font-size: 13px; }

.auth-help { color: var(--muted); font-size: 11px; margin-top: 16px; line-height: 1.6; }

/* ═══════════════════════════════════════════════════════════
   FORMS
   ═══════════════════════════════════════════════════════════ */

.form-group { margin-bottom: 16px; }

.form-group label {
  display: block;
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 6px;
  font-weight: 600;
}

input, textarea, select {
  width: 100%;
  padding: 10px 12px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  outline: none;
  transition: border-color 0.15s;
}

input:focus, textarea:focus, select:focus {
  border-color: var(--pink);
}

textarea { resize: vertical; font-family: 'JetBrains Mono', 'Fira Code', monospace; font-size: 12px; }

/* ═══════════════════════════════════════════════════════════
   BUTTONS
   ═══════════════════════════════════════════════════════════ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--pink);
  background: var(--pink);
  color: #fff;
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}

.btn:hover { background: var(--pink-dim); border-color: var(--pink-dim); }

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

.btn-ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
}

.btn-ghost:hover { border-color: var(--pink); color: var(--pink); background: var(--pink-bg); }

.btn-danger {
  background: transparent;
  border: 1px solid var(--bad);
  color: var(--bad);
}

.btn-danger:hover { background: rgba(239, 68, 68, 0.1); }

.btn-group { display: flex; gap: 8px; flex-wrap: wrap; }

/* ═══════════════════════════════════════════════════════════
   TOOLBAR
   ═══════════════════════════════════════════════════════════ */

.toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.toolbar input { max-width: 320px; }

.badge {
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}

.badge.pink { border-color: var(--pink-dim); color: var(--pink); background: var(--pink-bg); }
.badge.green { border-color: rgba(34,197,94,0.3); color: var(--good); background: rgba(34,197,94,0.08); }

.toggle-offline {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
  cursor: pointer;
}

.toggle-offline input[type="checkbox"] {
  width: auto;
  margin: 0;
  accent-color: var(--pink);
}

.uptime-cell {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  color: var(--muted);
  min-width: 80px;
}

/* ═══════════════════════════════════════════════════════════
   TABLE
   ═══════════════════════════════════════════════════════════ */

.table-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

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

th, td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

th {
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
  background: var(--surface2);
}

th.sortable { cursor: pointer; user-select: none; transition: color 0.15s; }
th.sortable:hover { color: var(--pink); }
th.sortable .sort-arrow { margin-left: 4px; font-size: 10px; }

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

tr:hover td { background: var(--pink-bg); }

.cell-main { font-weight: 500; }
.cell-sub { font-size: 11px; color: var(--muted); margin-top: 2px; word-break: break-all; font-family: monospace; }

/* ═══════════════════════════════════════════════════════════
   CLIENT CARDS (Dashboard grid)
   ═══════════════════════════════════════════════════════════ */

.client-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 12px;
}

.client-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  transition: border-color 0.15s;
  cursor: pointer;
  text-decoration: none;
  color: inherit;
  display: block;
}

.client-card:hover {
  border-color: var(--pink-dim);
  text-decoration: none;
}

.client-card-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.client-card-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius);
  background: var(--surface2);
  border: 1px solid var(--border);
  display: grid;
  place-items: center;
  font-size: 18px;
  flex-shrink: 0;
}

.client-card-title {
  flex: 1;
  min-width: 0;
}

.client-card-title h3 {
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.client-card-title span {
  font-size: 11px;
  color: var(--muted);
  font-family: monospace;
}

.client-card-status {
  flex-shrink: 0;
}

.client-card-meta {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--muted);
}

.client-card-meta span {
  display: flex;
  align-items: center;
  gap: 4px;
}

.client-card-meta .val { color: var(--text); }

.client-card-tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--pink-bg);
  border: 1px solid var(--pink-dim);
  color: var(--pink);
  font-size: 11px;
  font-weight: 500;
  margin-top: 8px;
}

/* ═══════════════════════════════════════════════════════════
   STATUS
   ═══════════════════════════════════════════════════════════ */

.status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.status.on { color: var(--good); background: rgba(34, 197, 94, 0.1); }
.status.off { color: var(--muted); background: var(--surface2); }
.status.grace { color: var(--warn); background: rgba(245, 158, 11, 0.1); }

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

.status-dot.on { background: var(--good); }
.status-dot.off { background: var(--muted); }

/* ═══════════════════════════════════════════════════════════
   CLIENT PAGE
   ═══════════════════════════════════════════════════════════ */

.client-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 16px;
}

.client-header-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.client-header-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-lg);
  background: var(--surface2);
  border: 1px solid var(--border);
  display: grid;
  place-items: center;
  font-size: 22px;
  flex-shrink: 0;
}

.client-header h1 { font-size: 20px; font-weight: 700; letter-spacing: -0.02em; }

.client-meta {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
}

.client-meta span { display: flex; align-items: center; gap: 4px; }
.client-meta .val { color: var(--text); }

.heartbeat-display {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.hb-item {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 4px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
}

.tag-row { display: flex; gap: 8px; align-items: center; }
.tag-row input { max-width: 200px; }

/* ═══════════════════════════════════════════════════════════
   TABS
   ═══════════════════════════════════════════════════════════ */

.tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
  overflow-x: auto;
  gap: 0;
}

.tab-btn {
  padding: 10px 16px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s;
}

.tab-btn:hover { color: var(--text); }

.tab-btn.active {
  color: var(--pink);
  border-bottom-color: var(--pink);
}

.tab-panel { display: none; }
.tab-panel.active { display: block; }

.sub-tabs { display: flex; gap: 0; margin-bottom: 16px; border-bottom: 1px solid var(--border); }

.sub-tab-btn {
  padding: 8px 14px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s;
}

.sub-tab-btn:hover { color: var(--text); }

.sub-tab-btn.active {
  color: var(--pink);
  border-bottom-color: var(--pink);
}

.sub-tab-panel { display: none; }
.sub-tab-panel.active { display: block; }

/* ═══════════════════════════════════════════════════════════
   CARDS
   ═══════════════════════════════════════════════════════════ */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 16px;
}

.card-title {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

/* ═══════════════════════════════════════════════════════════
   OUTPUT
   ═══════════════════════════════════════════════════════════ */

.output {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-size: 12px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 500px;
  overflow: auto;
  color: #ccc;
}

.output.error { border-color: var(--bad); color: var(--bad); }
.output.success { border-color: var(--good); color: var(--good); }

.hidden { display: none !important; }

/* ═══════════════════════════════════════════════════════════
   FILE BROWSER
   ═══════════════════════════════════════════════════════════ */

.file-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.file-path-input {
  flex: 1;
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-size: 12px;
  padding: 8px 12px;
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 12px;
  padding: 8px 12px;
  background: var(--surface2);
  border-radius: var(--radius);
  font-size: 13px;
  overflow-x: auto;
  flex-wrap: wrap;
}

.breadcrumb-item {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text);
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}

.breadcrumb-item:hover {
  background: var(--pink-bg);
  border-color: var(--pink);
  color: var(--pink);
}

.breadcrumb-item.current {
  background: var(--pink-bg);
  border-color: var(--pink);
  color: var(--pink);
  font-weight: 500;
}

.breadcrumb-sep {
  color: var(--muted);
  padding: 0 4px;
}

.file-list { list-style: none; }

.file-item {
  display: flex;
  align-items: center;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  gap: 12px;
  cursor: default;
  transition: background 0.1s;
}

.file-item:hover { background: var(--pink-bg); }

.file-icon { width: 20px; text-align: center; flex-shrink: 0; }
.file-name { flex: 1; font-size: 13px; }
.file-name.dir { color: var(--pink); cursor: pointer; font-weight: 500; }
.file-name.dir:hover { text-decoration: underline; }
.file-size { color: var(--muted); font-size: 12px; font-family: monospace; }
.file-modified { color: var(--muted); font-size: 12px; font-family: 'JetBrains Mono', monospace; }
.file-actions { display: flex; gap: 4px; }

/* ═══════════════════════════════════════════════════════════
   PROCESS / SERVICE LIST
   ═══════════════════════════════════════════════════════════ */

.proc-item {
  display: flex;
  align-items: center;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  gap: 12px;
  font-size: 13px;
}

.proc-item:hover { background: var(--pink-bg); }
.proc-name { flex: 1; font-weight: 500; }
.proc-info { color: var(--muted); font-size: 12px; font-family: monospace; }

.process-stats {
  display: flex;
  gap: 16px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.proc-stat-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  min-width: 160px;
}

.proc-stat-icon { font-size: 18px; }
.proc-stat-label { font-size: 12px; color: var(--muted); }
.proc-stat-value {
  font-size: 18px;
  font-weight: 600;
  color: var(--pink);
  margin-left: auto;
}

.process-toolbar {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.process-toolbar select,
.process-toolbar input {
  max-width: 200px;
}

.proc-group {
  margin-bottom: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.proc-group-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: var(--surface2);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s;
}

.proc-group-header:hover { background: var(--pink-bg); }

.proc-group-toggle {
  font-size: 10px;
  color: var(--muted);
  width: 16px;
}

.proc-group-content {
  background: var(--bg);
}

.proc-table { font-size: 12px; }

.proc-table-header {
  display: grid;
  grid-template-columns: 1fr 80px 100px 100px 60px;
  gap: 8px;
  padding: 8px 14px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  font-weight: 600;
}

.proc-table-row {
  display: grid;
  grid-template-columns: 1fr 80px 100px 100px 60px;
  gap: 8px;
  padding: 8px 14px;
  border-bottom: 1px solid var(--border);
  align-items: center;
  transition: background 0.1s;
}

.proc-table-row:hover { background: var(--pink-bg); }
.proc-table-row:last-child { border-bottom: none; }

.proc-col-name {
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.proc-col-pid {
  font-family: 'JetBrains Mono', monospace;
  color: var(--muted);
}

.proc-col-memory {
  font-family: 'JetBrains Mono', monospace;
  text-align: right;
}

.proc-col-status { font-size: 11px; color: var(--good); }
.proc-col-status:has(.error) { color: var(--bad); }
.proc-col-actions { text-align: right; }

@media (max-width: 768px) {
  .proc-table-header,
  .proc-table-row {
    grid-template-columns: 1fr 60px 80px 40px;
  }
  .proc-col-status { display: none; }
}

/* Services */
.svc-toolbar {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 12px;
}

.svc-table {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.svc-table-header {
  display: grid;
  grid-template-columns: 180px 1fr 100px 260px;
  gap: 8px;
  padding: 10px 14px;
  background: var(--surface2);
  border-bottom: 1px solid var(--border);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  font-weight: 600;
}

.svc-table-row {
  display: grid;
  grid-template-columns: 180px 1fr 100px 260px;
  gap: 8px;
  padding: 8px 14px;
  border-bottom: 1px solid var(--border);
  align-items: center;
  transition: background 0.1s;
  font-size: 12px;
}

.svc-table-row:hover { background: var(--pink-bg); }
.svc-table-row:last-child { border-bottom: none; }

.svc-col-name {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.svc-col-display {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text);
}

.svc-col-state { text-align: center; }
.svc-col-actions { display: flex; gap: 4px; justify-content: flex-end; }

.svc-state {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
}

.svc-state.running { color: var(--good); background: rgba(34, 197, 94, 0.1); }
.svc-state.stopped { color: var(--muted); background: var(--surface2); }
.svc-state.pending { color: var(--warn); background: rgba(245, 158, 11, 0.1); }

@media (max-width: 768px) {
  .svc-table-header,
  .svc-table-row {
    grid-template-columns: 1fr 80px 180px;
  }
  .svc-col-display { display: none; }
}

/* ═══════════════════════════════════════════════════════════
   INFO GRID
   ═══════════════════════════════════════════════════════════ */

.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}

.info-item {
  padding: 12px;
  background: var(--surface2);
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.info-label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 4px; font-weight: 600; }
.info-value { font-size: 13px; word-break: break-all; font-family: monospace; }

/* ═══════════════════════════════════════════════════════════
   ALERT
   ═══════════════════════════════════════════════════════════ */

.alert {
  padding: 12px 16px;
  border-radius: var(--radius);
  margin-bottom: 16px;
  font-size: 13px;
}

.alert-error {
  border: 1px solid rgba(239, 68, 68, 0.3);
  background: rgba(239, 68, 68, 0.08);
  color: var(--bad);
}

/* ═══════════════════════════════════════════════════════════
   LOADING SPINNER
   ═══════════════════════════════════════════════════════════ */

.loading {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid var(--border);
  border-top-color: var(--pink);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ═══════════════════════════════════════════════════════════
   COMMAND HISTORY
   ═══════════════════════════════════════════════════════════ */

.cmd-row {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
}

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

.cmd-header { display: flex; justify-content: space-between; margin-bottom: 4px; }
.cmd-type { font-weight: 600; color: var(--pink); }
.cmd-time { color: var(--muted); font-family: monospace; }

.cmd-status { font-size: 11px; padding: 2px 6px; border-radius: 4px; font-weight: 500; }
.cmd-status.done { color: var(--good); }
.cmd-status.failed { color: var(--bad); }
.cmd-status.sent { color: var(--warn); }
.cmd-status.queued { color: var(--muted); }

/* ═══════════════════════════════════════════════════════════
   SYSTEM INFO
   ═══════════════════════════════════════════════════════════ */

.sys-container {
  display: flex;
  flex-direction: column;
  gap: 16px;
  font-family: inherit;
  font-size: 13px;
  color: var(--text);
}

.sys-section {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.sys-section-title {
  padding: 10px 14px;
  background: var(--surface2);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--pink);
  border-bottom: 1px solid var(--border);
}

.sys-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1px;
  background: var(--border);
}

.sys-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 14px;
  background: var(--bg);
}

.sys-label {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
}

.sys-value {
  font-size: 13px;
  word-break: break-all;
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
}

/* ═══════════════════════════════════════════════════════════
   MODAL
   ═══════════════════════════════════════════════════════════ */

.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal-content {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  min-width: 400px;
  max-width: 600px;
  max-height: 80vh;
  overflow: auto;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

.modal-header h3 {
  font-size: 16px;
  font-weight: 600;
}

.modal-body {
  padding: 20px;
}

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

.info-table td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}

.info-table td:first-child {
  color: var(--muted);
  width: 120px;
  text-transform: uppercase;
  font-size: 11px;
  font-weight: 600;
}

.info-table td:last-child {
  color: var(--text);
}

.info-table code {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  word-break: break-all;
}

/* ═══════════════════════════════════════════════════════════
   SCHEDULER
   ═══════════════════════════════════════════════════════════ */

.scheduler-form {
  padding: 12px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.scheduler-form textarea {
  min-height: 38px;
  resize: vertical;
  font-size: 11px;
}

/* ═══════════════════════════════════════════════════════════
   MASS ACTIONS
   ═══════════════════════════════════════════════════════════ */

.progress-bar {
  background: var(--surface2);
  border-radius: 4px;
  height: 8px;
  overflow: hidden;
  margin-bottom: 8px;
}

.progress-fill {
  background: var(--pink);
  height: 100%;
  transition: width 0.3s;
  border-radius: 4px;
}

/* ═══════════════════════════════════════════════════════════
   STATISTICS
   ═══════════════════════════════════════════════════════════ */

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  text-align: center;
}

.stat-value {
  font-size: 32px;
  font-weight: 700;
  color: var(--pink);
}

.stat-label {
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  margin-top: 4px;
  font-weight: 600;
}

.chart-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}

.chart-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
}

.chart-card h3 {
  font-size: 14px;
  margin-bottom: 12px;
  color: var(--muted);
  font-weight: 600;
}

.chart-container {
  position: relative;
  height: 280px;
}

.chart-full {
  grid-column: 1 / -1;
}

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

.connection-map {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.conn-node {
  padding: 8px 12px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 12px;
}

.conn-node.online { border-color: var(--good); }
.conn-node.offline { border-color: var(--muted); opacity: 0.6; }

/* ═══════════════════════════════════════════════════════════
   WORLD MAP
   ═══════════════════════════════════════════════════════════ */

.world-map-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 24px;
}

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

.map-header h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
}

.map-legend {
  display: flex;
  gap: 16px;
  font-size: 12px;
  color: var(--muted);
}

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

.map-legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.map-legend-dot.online { background: var(--good); }
.map-legend-dot.offline { background: var(--bad); }
.map-legend-dot.mixed { background: var(--warn); }

.map-container {
  position: relative;
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

#world-map {
  width: 100%;
  height: auto;
  display: block;
}

.map-country {
  fill: var(--surface2);
  stroke: var(--border);
  stroke-width: 0.5;
  transition: fill 0.2s;
}

.map-country.has-clients {
  fill: rgba(255, 45, 120, 0.15);
  stroke: var(--pink-dim);
  stroke-width: 0.8;
}

.map-country.has-online {
  fill: rgba(34, 197, 94, 0.2);
  stroke: var(--good);
  stroke-width: 0.8;
}

.map-country:hover {
  fill: rgba(255, 45, 120, 0.3) !important;
}

.map-bubble {
  transition: r 0.3s, opacity 0.3s;
  cursor: pointer;
}

.map-bubble:hover {
  filter: brightness(1.5);
}

.map-tooltip {
  position: absolute;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 14px;
  font-size: 12px;
  color: var(--text);
  pointer-events: none;
  z-index: 100;
  white-space: nowrap;
}

.map-tooltip .tooltip-country {
  font-weight: 600;
  font-size: 13px;
  margin-bottom: 4px;
}

.map-tooltip .tooltip-detail {
  color: var(--muted);
  font-size: 11px;
}

.map-grid-line {
  stroke: var(--border);
  stroke-width: 0.3;
  stroke-dasharray: 2, 4;
  opacity: 0.5;
}

.map-ocean {
  fill: var(--bg);
}

.map-land {
  fill: var(--surface2);
  stroke: var(--border);
  stroke-width: 0.3;
}

/* ═══════════════════════════════════════════════════════════
   COMPUTE JOBS
   ═══════════════════════════════════════════════════════════ */

.job-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  margin-bottom: 12px;
}

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

.job-type {
  font-weight: 600;
  color: var(--pink);
}

.job-status {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 4px;
  text-transform: uppercase;
  font-weight: 500;
}

.job-status.pending { color: var(--muted); background: var(--surface2); }
.job-status.running { color: var(--warn); background: rgba(245,158,11,0.1); }
.job-status.completed { color: var(--good); background: rgba(34,197,94,0.1); }
.job-status.failed { color: var(--bad); background: rgba(239,68,68,0.1); }

.result-item {
  padding: 8px;
  background: var(--bg);
  border-radius: 4px;
  margin-top: 8px;
  font-family: monospace;
  font-size: 11px;
  max-height: 200px;
  overflow: auto;
}

.chunk-item {
  display: flex;
  justify-content: space-between;
  padding: 6px 10px;
  background: var(--bg);
  border-radius: 4px;
  margin-bottom: 4px;
  font-size: 12px;
}

.chunk-status { font-size: 10px; padding: 1px 6px; border-radius: 3px; font-weight: 500; }
.chunk-status.pending { color: var(--muted); }
.chunk-status.assigned { color: var(--warn); }
.chunk-status.done { color: var(--good); }
.chunk-status.failed { color: var(--bad); }

/* ═══════════════════════════════════════════════════════════
   RDP / SCREEN CAPTURE
   ═══════════════════════════════════════════════════════════ */

.rdp-container {
  position: relative;
  background: #000;
  border-radius: var(--radius);
  overflow: hidden;
  min-height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.rdp-container canvas {
  max-width: 100%;
  display: block;
}

#rdp-status {
  color: var(--muted);
  text-align: center;
  padding: 16px;
}

/* ═══════════════════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════════════════ */

@media (max-width: 768px) {
  .sidebar {
    width: 0;
    overflow: hidden;
    transition: width 0.2s;
  }

  .sidebar.open {
    width: var(--sidebar-w);
  }

  .main-content {
    margin-left: 0;
  }

  .container { padding: 16px; }
  .page-content { padding: 16px; }
  .tabs { gap: 0; }
  .tab-btn { padding: 8px 12px; font-size: 12px; }
  .info-grid { grid-template-columns: 1fr; }
  .client-grid { grid-template-columns: 1fr; }
}
