:root {
  --bg: #0b0d10;
  --panel: #14171c;
  --panel-2: #1b1f26;
  --border: #262b33;
  --text: #e6e8eb;
  --text-dim: #8b929c;
  --accent: #4f8cff;
  --accent-dim: #2c4a85;
  --danger: #e5484d;
  --ok: #30a46c;
  --warn: #e2a336;
  --tor-purple: #8b5cf6;
  font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

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

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 32px;
  border-bottom: 1px solid var(--border);
  background: var(--panel);
}

.brand { font-size: 18px; font-weight: 700; letter-spacing: 0.02em; color: var(--text); text-decoration: none; }
.brand span { color: var(--accent); }

.topbar nav { display: flex; align-items: center; gap: 20px; }
.topbar nav a {
  color: var(--text-dim);
  text-decoration: none;
  font-size: 14px;
}
.topbar nav a:hover { color: var(--text); }

main { padding: 32px; }

.page-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}
.page-head h1 { font-size: 20px; margin: 0; display: flex; align-items: center; gap: 12px; }

.btn {
  background: var(--panel-2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 14px;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
}
.btn:hover { border-color: var(--accent); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn.small { padding: 5px 10px; font-size: 12px; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.danger { border-color: var(--danger); color: var(--danger); }
.btn.danger:hover { background: var(--danger); color: #fff; }
.btn.tor-active { background: var(--tor-purple); border-color: var(--tor-purple); color: #fff; }
.btn.tor-active:hover { background: var(--tor-purple); opacity: 0.85; }

.table-toolbar {
  display: flex;
  align-items: stretch;
  gap: 10px;
  margin-bottom: 14px;
}
.system-stats {
  display: flex;
  gap: 6px;
  margin-left: auto;
  min-width: 0;
}
.stat-card {
  min-width: 68px;
  height: 38px;
  padding: 5px 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel);
  display: grid;
  grid-template-columns: auto auto;
  align-content: center;
  align-items: baseline;
  column-gap: 5px;
}
.stat-card span { color: var(--text-dim); font-size: 9px; text-transform: uppercase; }
.stat-card small { display: none; }
.stat-card strong { font-size: 12px; white-space: nowrap; }
.stat-card strong.ok { color: var(--ok); }
.stat-card strong.bad { color: var(--danger); }
.stat-card strong.warn { color: var(--warn); }
@media (max-width: 1350px) { .table-toolbar { flex-wrap: wrap; } .system-stats { width: 100%; margin-left: 0; flex-wrap: wrap; } }
.search-input {
  flex: 1;
  max-width: 360px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 9px 14px;
  color: var(--text);
  font-size: 13px;
}
.search-input:focus { outline: none; border-color: var(--accent); }
.search-input::placeholder { color: var(--text-dim); }
.status-select {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 9px 14px;
  color: var(--text);
  font-size: 13px;
  cursor: pointer;
}
.status-select:focus { outline: none; border-color: var(--accent); }
.build-name-input { width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: 7px; background: var(--panel-2); margin-bottom: 10px; }
.builds-section { margin-top: 24px; }
.builds-section h2 { font-size: 16px; margin: 0 0 12px; }
.builds-table { width: 100%; border-collapse: collapse; background: var(--panel); font-size: 13px; }
.builds-table th, .builds-table td { padding: 11px 14px; border-bottom: 1px solid var(--border); text-align: left; }
.builds-table th { color: var(--text-dim); font-size: 11px; text-transform: uppercase; }
.builds-table tr:last-child td { border-bottom: 0; }
.builds-table a { color: var(--accent); text-decoration: none; margin-right: 6px; }
.builds-table .empty { text-align: center; color: var(--text-dim); padding: 28px; }
.ok-text { color: var(--ok); }
.copy-row { display: flex; gap: 8px; min-width: 0; }
.copy-row input { flex: 1; min-width: 0; padding: 9px; border: 1px solid var(--border); border-radius: 7px; background: var(--panel-2); }
.stats-page { width: min(1100px, 100%); margin: 24px auto; }
.stats-title { margin-bottom: 28px; }
.stats-title span, .stats-title small { color: var(--text-dim); }
.stats-title h1 { font-size: 30px; margin: 5px 0; }
.build-stat-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 18px; }
.build-stat-cards > div, .build-stat-panels section { border: 1px solid var(--border); border-radius: 12px; background: var(--panel); padding: 20px; }
.build-stat-cards span { display: block; color: var(--text-dim); font-size: 12px; margin-bottom: 10px; }
.build-stat-cards strong { font-size: 32px; }
.build-stat-cards strong.ok { color: var(--ok); }
.build-stat-panels { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.build-stat-panels h2 { margin: 0 0 18px; font-size: 15px; }
.stat-row { display: grid; grid-template-columns: minmax(90px, 1fr) 3fr 36px; align-items: center; gap: 10px; margin: 11px 0; font-size: 12px; }
.stat-row > span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat-row > div { height: 7px; border-radius: 5px; background: var(--panel-2); overflow: hidden; }
.stat-row i { display: block; height: 100%; background: var(--accent); border-radius: 5px; }
.stat-row strong { text-align: right; }
@media (max-width: 700px) { .build-stat-cards, .build-stat-panels { grid-template-columns: 1fr; } .copy-row input { min-width: 0; } }

.table-scroll {
  width: 100%;
  overflow-x: auto;
  border-radius: 10px;
  border: 1px solid var(--border);
}

.install-log-panel {
  margin-bottom: 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--panel);
}
.install-log-panel summary {
  cursor: pointer;
  padding: 10px 14px;
  font-size: 13px;
  color: var(--text-dim);
  list-style: none;
}
.install-log-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.install-log-panel summary::-webkit-details-marker { display: none; }
.install-log-panel[open] summary {
  border-bottom: 1px solid var(--border);
}
.install-log-panel .table-scroll {
  border: none;
  border-radius: 0 0 10px 10px;
  max-height: 320px;
  overflow-y: auto;
}

.agents-table {
  width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
  background: var(--panel);
  font-size: 13px;
}
.agents-table col.col-seq { width: 36px; }
.agents-table col.col-preview { width: 84px; }
.agents-table col.col-status { width: 88px; }
.agents-table col.col-agent { width: 100px; }
.agents-table col.col-host { width: 130px; }
.agents-table col.col-ip { width: 116px; }
.agents-table col.col-country { width: 120px; }
.agents-table col.col-os { width: 220px; }
.agents-table col.col-seen { width: 120px; }
.agents-table col.col-actions { width: 72px; }
.agents-table th.col-actions-th { text-align: center; padding-left: 0; padding-right: 0; }
.agents-table th.col-actions-th svg { width: 14px; height: 14px; opacity: 0.6; }
.agents-table th {
  text-align: left;
  padding: 10px 16px;
  background: transparent;
  color: var(--text-dim);
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
  border-bottom: 1px solid var(--border);
}
.agents-table th svg { width: 12px; height: 12px; opacity: 0.6; flex-shrink: 0; }
.agents-table td {
  padding: 9px 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  color: var(--text);
}
.agents-table tbody tr:last-child td { border-bottom: none; }
.agents-table th:last-child,
.agents-table td:last-child {
  position: sticky;
  right: 0;
  background: var(--panel);
  box-shadow: -6px 0 6px -6px rgba(0,0,0,0.4);
}
.agents-table th:last-child { background: var(--panel-2); }
.agents-table tbody tr:hover td:last-child { background: var(--panel-2); }
.agents-table .cell-truncate {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 0;
}
.agents-table .cell-dim { color: var(--text-dim); }
.agents-table .cell-mono { font-family: "Consolas", "SFMono-Regular", monospace; font-size: 12px; }
.agents-table a { color: var(--accent); text-decoration: none; font-weight: 500; }
.agents-table a:hover { text-decoration: underline; }
.agents-table .empty { text-align: center; color: var(--text-dim); padding: 40px; }
.agents-table tbody tr { transition: background-color 0.1s ease; }
.agents-table tbody tr:hover { background: var(--panel-2); }
.flag { width: 20px; height: 15px; margin-right: 6px; vertical-align: -2px; object-fit: cover; border-radius: 2px; }

.preview-thumb {
  width: 76px;
  height: 46px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: #000;
  display: block;
}
img.preview-thumb {
  cursor: zoom-in;
  transition: transform 0.15s ease, border-color 0.15s ease;
}
img.preview-thumb:hover { border-color: var(--accent); transform: scale(1.05); }
.preview-thumb.placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-dim);
  background: var(--panel-2);
}
.preview-thumb.placeholder svg { width: 24px; height: 24px; opacity: 0.4; }
.preview-thumb.placeholder.locked { color: var(--danger); }
.preview-thumb.placeholder.locked svg { opacity: 0.7; }
.preview-cell { position: relative; display: inline-block; }
.preview-refresh-btn {
  position: absolute;
  bottom: -6px;
  right: -6px;
  width: 20px;
  height: 20px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text-dim);
  cursor: pointer;
}
.preview-refresh-btn:hover { color: var(--accent); border-color: var(--accent); }
.preview-refresh-btn svg { width: 11px; height: 11px; }
.preview-refresh-btn.spinning svg { animation: spin 0.8s linear infinite; }
[data-action="cookies"].busy { pointer-events: none; opacity: 0.7; }
[data-action="cookies"].ready { background: var(--ok); border-color: var(--ok); color: #fff; }

#preview-dialog { width: auto; max-width: min(92vw, 1320px); padding: 10px; background: #000; }
#preview-dialog-img {
  display: block;
  width: auto;
  height: auto;
  max-width: min(88vw, 1280px);
  max-height: 82vh;
  border-radius: 6px;
}


.btn svg { width: 14px; height: 14px; vertical-align: -2px; }
.icon-label { display: inline-flex; align-items: center; gap: 8px; }
.btn.icon-btn { padding: 5px 6px; line-height: 0; }
.info-grid svg { width: 13px; height: 13px; opacity: 0.8; }

.row-menu { position: relative; display: inline-flex; gap: 6px; }
.row-menu-dropdown {
  position: fixed;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  min-width: 190px;
  padding: 6px;
  z-index: 100;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}
.row-menu-dropdown a,
.row-menu-dropdown .menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 10px;
  border-radius: 6px;
  border: none;
  background: none;
  color: var(--text);
  font-size: 13px;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}
.row-menu-dropdown a:hover,
.row-menu-dropdown .menu-item:hover { background: var(--panel); }
.row-menu-dropdown .menu-item.danger { color: var(--danger); }
.row-menu-dropdown svg { width: 14px; height: 14px; flex-shrink: 0; }

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(10px);
  background: var(--panel);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 18px;
  border-radius: 8px;
  font-size: 13px;
  opacity: 0;
  transition: opacity 0.2s, transform 0.2s;
  z-index: 1000;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}
.toast.visible { opacity: 1; transform: translateX(-50%) translateY(0); }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px 3px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.badge::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}
.status-online { background: rgba(48,164,108,0.15); color: var(--ok); }
.status-offline { background: rgba(139,146,156,0.15); color: var(--text-dim); }
.status-pending { background: rgba(226,163,54,0.15); color: var(--warn); }
.status-removing { background: rgba(229,72,77,0.15); color: var(--danger); }

.login-wrap { display: flex; justify-content: center; align-items: center; min-height: 80vh; }
.login-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 32px;
  width: 320px;
  display: flex;
  flex-direction: column;
}
.login-card { align-items: center; text-align: center; }
.login-sub { color: var(--text-dim); font-size: 13px; margin: 4px 0 20px; }

.btn.cta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 13px 20px;
  font-size: 15px;
  font-weight: 600;
  color: #fff;
  background: linear-gradient(135deg, var(--accent), #3a6fd8);
  border: none;
  border-radius: 10px;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(79,140,255,0.35);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.btn.cta:hover { transform: translateY(-1px); box-shadow: 0 6px 18px rgba(79,140,255,0.45); }
.btn.cta:active { transform: translateY(0); }
.btn.cta:disabled { opacity: 0.6; cursor: wait; transform: none; }

.login-code {
  font-family: "Consolas", "SFMono-Regular", monospace;
  font-size: 22px;
  letter-spacing: 0.08em;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px 18px;
  margin: 8px 0 16px;
  color: var(--accent);
}

.spinner {
  width: 22px;
  height: 22px;
  margin: 8px auto 0;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.btn-spinner {
  display: inline-block;
  width: 12px;
  height: 12px;
  border: 2px solid rgba(255,255,255,0.35);
  border-top-color: currentColor;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.login-error { color: var(--danger); font-size: 13px; margin-top: 14px; }

dialog {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  padding: 24px;
  width: 420px;
}
dialog::backdrop { background: rgba(0,0,0,0.6); }
@keyframes dialogIn {
  from { opacity: 0; transform: scale(0.96) translateY(8px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}
@keyframes backdropIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
dialog[open] { animation: dialogIn 0.18s cubic-bezier(0.2, 0.8, 0.2, 1); }
dialog[open]::backdrop { animation: backdropIn 0.18s ease-out; }
dialog label { display: block; font-size: 12px; color: var(--text-dim); margin: 12px 0 6px; }
dialog input {
  width: 100%;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px 12px;
  color: var(--text);
  font-size: 14px;
}
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }
dialog pre {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 12px;
  white-space: pre-wrap;
  word-break: break-all;
  font-size: 12px;
}
#create-agent-dialog { width: 680px; max-width: calc(100vw - 24px); overflow-x: hidden; }
#create-agent-dialog h3 { display: flex; align-items: center; gap: 10px; margin-top: 0; }
#create-agent-dialog h3 svg { width: 22px; height: 22px; flex: 0 0 22px; }
#create-agent-dialog pre { max-height: 190px; overflow-y: auto; overflow-x: hidden; line-height: 1.45; }
#create-agent-dialog .dialog-actions { flex-wrap: wrap; }
@media (max-width: 560px) { #create-agent-dialog { padding: 18px; } .copy-row { flex-direction: column; } .copy-row .btn { width: 100%; } }

#processes-dialog { width: 640px; max-width: 90vw; }
.processes-wrap { max-height: 60vh; overflow-y: auto; }
.processes-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.processes-table th {
  text-align: left;
  padding: 8px 10px;
  color: var(--text-dim);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  position: sticky;
  top: 0;
  background: var(--panel);
}
.processes-table td { padding: 6px 10px; border-top: 1px solid var(--border); }
.processes-table .empty { text-align: center; color: var(--text-dim); padding: 24px; }

#files-dialog { width: 640px; max-width: 90vw; }
#agent-log-dialog { width: 700px; max-width: 90vw; }
.agent-log-scroll { max-height: 60vh; overflow-y: auto; border: none; }
#python-dialog { width: 640px; max-width: 90vw; }
.module-form {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-width: 640px;
  margin-bottom: 24px;
}
.module-form label {
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  margin-top: 12px;
}
.module-form label:first-child {
  margin-top: 0;
}
.module-form input[type="text"] {
  width: 100%;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 12px;
  color: var(--text);
  font-size: 14px;
}
.module-form input[type="text"]:focus {
  outline: none;
  border-color: var(--accent);
}
.module-code-preview {
  max-width: 420px;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 12px;
  color: var(--text-dim);
  margin: 0;
}
.python-code-input {
  width: 100%;
  min-height: 260px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px 12px;
  color: var(--text);
  font-size: 13px;
  font-family: "Cascadia Code", Consolas, monospace;
  resize: vertical;
}
.files-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}
.files-breadcrumb { font-size: 13px; color: var(--text-dim); overflow-wrap: anywhere; flex-shrink: 1; }
.files-search { flex: 0 1 200px; min-width: 100px; }
.files-breadcrumb a { color: var(--accent); text-decoration: none; }
.files-shortcut { font-weight: 600; }
.files-wrap { max-height: 50vh; overflow-y: auto; }
.files-wrap svg { width: 15px; height: 15px; opacity: 0.8; }
.files-wrap a.files-nav { color: var(--accent); text-decoration: none; }

.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 24px;
}
.info-grid div { display: flex; flex-direction: column; gap: 4px; }
.info-grid b { font-size: 11px; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.04em; }
.info-grid span { font-size: 14px; }

.action-panel { display: flex; gap: 12px; flex-wrap: wrap; }
.screenshot-switch, .retention-control { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; }
.screenshot-switch input { display: none; }
.switch-track { width: 34px; height: 19px; padding: 2px; border-radius: 12px; background: var(--border); transition: background .15s; }
.switch-track span { display: block; width: 15px; height: 15px; border-radius: 50%; background: var(--text-dim); transition: transform .15s; }
.screenshot-switch input:checked + .switch-track { background: var(--ok); }
.screenshot-switch input:checked + .switch-track span { transform: translateX(15px); background: white; }
.retention-control input { width: 48px; padding: 5px; color: var(--text); background: var(--panel-2); border: 1px solid var(--border); border-radius: 6px; }
.screenshots-dialog { width: min(1100px, 94vw); }
.screenshots-grid { display: grid; grid-template-columns: repeat(4, minmax(180px, 1fr)); gap: 12px; height: min(500px, 65vh); overflow-y: auto; align-content: start; padding-right: 4px; }
.screenshot-item { padding: 0; border: 0; background: transparent; color: var(--text-dim); font-size: 11px; text-align: left; cursor: pointer; }
.screenshot-item strong, .screenshot-item span { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.screenshot-item strong { color: var(--text); font-size: 12px; margin-bottom: 3px; }
.screenshot-item img { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: cover; background: #000; border: 1px solid var(--border); border-radius: 7px; margin-bottom: 5px; cursor: zoom-in; }
.screenshot-viewer { position: fixed; inset: 0; z-index: 10000; background: rgba(0,0,0,.94); display: flex; align-items: center; justify-content: center; padding: 54px 70px 72px; }
.screenshot-viewer[hidden] { display: none; }
.screenshot-viewer img { max-width: 100%; max-height: 100%; object-fit: contain; user-select: none; -webkit-user-drag: none; }
.screenshot-viewer-close, .screenshot-viewer-nav { position: absolute; border: 0; color: white; background: rgba(35,39,46,.8); cursor: pointer; border-radius: 50%; }
.screenshot-viewer-close { top: 14px; right: 18px; width: 42px; height: 42px; font-size: 30px; line-height: 36px; }
.screenshot-viewer-nav { top: 50%; width: 48px; height: 64px; margin-top: -32px; font-size: 46px; line-height: 54px; }
.screenshot-viewer-nav.prev { left: 14px; }
.screenshot-viewer-nav.next { right: 14px; }
.screenshot-viewer-nav:disabled { opacity: .25; cursor: default; }
.screenshot-viewer-meta { position: absolute; left: 0; right: 0; bottom: 16px; text-align: center; display: flex; justify-content: center; gap: 14px; color: white; font-size: 13px; }
.screenshot-viewer-meta span { color: var(--text-dim); }
@media (max-width: 620px) { .screenshot-viewer { padding: 52px 8px 78px; } .screenshot-viewer-nav { top: auto; bottom: 12px; } .screenshot-viewer-nav.prev { left: 12px; } .screenshot-viewer-nav.next { right: 12px; } }
@media (max-width: 900px) { .screenshots-grid { grid-template-columns: repeat(3, minmax(150px, 1fr)); } }
@media (max-width: 620px) { .screenshots-grid { grid-template-columns: repeat(2, minmax(120px, 1fr)); height: 65vh; } }

.vnc-panel { margin-top: 20px; }
#vnc-canvas {
  max-width: 100%;
  background: #000;
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: crosshair;
  outline: none;
  display: block;
}
.vnc-hint { color: var(--text-dim); font-size: 12px; margin-top: 8px; }

.evnc-frame-wrap { position: relative; overflow: auto; display: flex; justify-content: center; }
.vnc-frame-wrap { position: relative; display: flex; justify-content: center; }
.evnc-img {
  width: 100%;
  background: #000;
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: default;
  display: block;
  user-select: none;
  -webkit-user-drag: none;
}
.evnc-zoom-level {
  display: inline-block;
  min-width: 48px;
  text-align: center;
  color: var(--text-dim);
  font-size: 13px;
}
.evnc-loading {
  position: absolute;
  top: 10px;
  right: 10px;
  background: rgba(0,0,0,0.7);
  color: var(--text);
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 999px;
}
.evnc-ping {
  position: absolute;
  top: 10px;
  left: 10px;
  background: rgba(0,0,0,0.7);
  color: var(--text-dim);
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 999px;
  font-variant-numeric: tabular-nums;
}
.evnc-frame-count { top: 42px; }
.evnc-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  flex-wrap: wrap;
}
.evnc-controls .terminal-input { flex: 1; min-width: 200px; }

.terminal-panel {
  margin-top: 20px;
  background: #0a0c0f;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}
.terminal-output {
  height: 360px;
  overflow-y: auto;
  padding: 14px 16px;
  font-family: "Consolas", "SFMono-Regular", monospace;
  font-size: 13px;
  line-height: 1.5;
  color: #d6f5d6;
  white-space: pre-wrap;
  word-break: break-word;
}
.terminal-input-row {
  display: flex;
  align-items: center;
  gap: 8px;
  border-top: 1px solid var(--border);
  padding: 10px 16px;
  background: var(--panel);
}
.terminal-prompt { color: var(--accent); font-family: monospace; }
.terminal-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text);
  font-family: "Consolas", "SFMono-Regular", monospace;
  font-size: 13px;
}

:root {
  --bg: #090c12;
  --panel: #121720;
  --panel-2: #19212d;
  --border: #283241;
  --text: #edf2f8;
  --text-dim: #929eae;
  --accent: #6f91ff;
  --accent-dim: #344d8d;
  --danger: #f26678;
  --ok: #39c889;
  --warn: #eeb552;
  --tor-purple: #9b7cf6;
  color-scheme: dark;
}

body {
  background-color: var(--bg);
  background-image: radial-gradient(circle at 50% -20%, rgba(80, 111, 210, .11), transparent 38rem);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection { color: #fff; background: rgba(111, 145, 255, .42); }

.topbar {
  background-color: rgba(18, 23, 32, .94);
  border-bottom-color: rgba(126, 145, 171, .17);
  box-shadow: 0 8px 28px rgba(0, 0, 0, .13);
  backdrop-filter: blur(14px);
}

.brand { letter-spacing: -.01em; }

.topbar nav a,
.agents-table a,
.builds-table a,
.files-breadcrumb a,
.files-wrap a.files-nav {
  transition: color .16s ease, opacity .16s ease;
}

.topbar nav a:hover { color: #fff; }

.btn {
  background-image: linear-gradient(180deg, rgba(255,255,255,.025), rgba(0,0,0,.035));
  box-shadow: 0 1px 0 rgba(255,255,255,.035) inset, 0 3px 10px rgba(0,0,0,.08);
  transition: color .16s ease, background-color .16s ease, border-color .16s ease, box-shadow .16s ease, transform .16s ease;
}

.btn:hover {
  border-color: #6689f5;
  box-shadow: 0 1px 0 rgba(255,255,255,.045) inset, 0 5px 15px rgba(0,0,0,.15);
  transform: translateY(-1px);
}

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

.btn.primary {
  background-image: linear-gradient(135deg, #7697ff, #5579ed);
  box-shadow: 0 6px 18px rgba(76, 108, 221, .22);
}

.btn.danger { background-color: rgba(242, 102, 120, .035); }
.btn.danger:hover { box-shadow: 0 6px 18px rgba(242, 102, 120, .16); }
.btn.tor-active { background-image: linear-gradient(135deg, #a589f8, #8060de); }

.btn:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible {
  outline: 2px solid rgba(111, 145, 255, .82);
  outline-offset: 2px;
}

.search-input,
.status-select,
.build-name-input,
.copy-row input,
dialog input,
.module-form input[type="text"],
.python-code-input,
.retention-control input {
  box-shadow: 0 1px 0 rgba(255,255,255,.025) inset;
  transition: border-color .16s ease, box-shadow .16s ease, background-color .16s ease;
}

.search-input:focus,
.status-select:focus,
dialog input:focus,
.module-form input[type="text"]:focus,
.python-code-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(111, 145, 255, .1);
}

.table-scroll,
.install-log-panel,
.info-grid,
.build-stat-cards > div,
.build-stat-panels section,
.login-card,
.terminal-panel {
  border-color: rgba(126, 145, 171, .17);
  box-shadow: 0 14px 36px rgba(0,0,0,.13), 0 1px 0 rgba(255,255,255,.018) inset;
}

.agents-table th,
.builds-table th {
  color: #8693a5;
  background-color: rgba(255,255,255,.012);
}

.agents-table td,
.builds-table td,
.processes-table td {
  border-color: rgba(126, 145, 171, .12);
}

.agents-table tbody tr,
.builds-table tbody tr {
  transition: background-color .14s ease;
}

.agents-table tbody tr:hover,
.builds-table tbody tr:hover {
  background-color: rgba(111, 145, 255, .045);
}

.agents-table tbody tr:hover td:last-child { background-color: #19212d; }

.preview-thumb,
.screenshot-item img,
#vnc-canvas,
.evnc-img {
  box-shadow: 0 6px 18px rgba(0,0,0,.17);
}

.badge { border: 1px solid rgba(255,255,255,.045); }
.badge::before { box-shadow: 0 0 7px currentColor; }

.row-menu-dropdown,
dialog,
.toast {
  border-color: rgba(126, 145, 171, .2);
  box-shadow: 0 18px 48px rgba(0,0,0,.34), 0 1px 0 rgba(255,255,255,.025) inset;
}

dialog::backdrop { background: rgba(2, 5, 10, .7); backdrop-filter: blur(3px); }

.switch-track,
.switch-track span { transition-duration: .2s; }

.login-card { background-color: rgba(18, 23, 32, .96); }

.terminal-output { color: #ccebd6; }
.terminal-prompt { text-shadow: 0 0 12px rgba(111,145,255,.45); }

* { scrollbar-color: #39475b transparent; scrollbar-width: thin; }
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #39475b; border: 2px solid transparent; border-radius: 999px; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background-color: #4a5b73; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}
