:root {
  --bg: #0f1115;
  --surface: #171a21;
  --surface-2: #1e222b;
  --border: #2a2f3a;
  --text: #e6e8ee;
  --muted: #8b93a7;
  --accent: #6d8cff;
  --accent-ink: #0b1020;
  --ok: #3ecf8e;
  --warn: #f5b041;
  --danger: #ff6b6b;
  --radius: 10px;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: dark;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #f5f6f8;
    --surface: #ffffff;
    --surface-2: #f0f2f5;
    --border: #dde1e8;
    --text: #1b1f27;
    --muted: #5f687a;
    --accent: #3d5afe;
    --accent-ink: #ffffff;
    color-scheme: light;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code, pre, .mono { font-family: var(--mono); font-size: 12.5px; }
h1 { font-size: 22px; margin: 0; }
h2 { font-size: 16px; margin: 0 0 12px; }
h3 { font-size: 14px; margin: 0 0 8px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }

/* ---------- layout ---------- */
.topbar {
  display: flex; align-items: center; gap: 24px;
  padding: 0 24px; height: 56px;
  background: var(--surface); border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 10;
}
.brand { font-weight: 700; font-size: 16px; color: var(--text); display: flex; gap: 8px; align-items: center; }
.brand-mark { width: 22px; height: 22px; border-radius: 6px; background: linear-gradient(135deg, var(--accent), #9b6dff); }
.brand-logo { width: 24px; height: 24px; border-radius: 6px; object-fit: contain; display: block; }
.user-area { display: flex; align-items: center; gap: 10px; }
.user-badge {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 4px 10px 4px 6px; border-radius: 8px;
  background: var(--surface-2); border: 1px solid var(--border);
  color: var(--text); font-size: 12.5px; font-weight: 500;
}
.user-avatar {
  width: 22px; height: 22px; border-radius: 6px;
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 11px; color: #fff; line-height: 1;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.25); flex-shrink: 0;
}
.nav { display: flex; gap: 4px; flex: 1; align-items: center; }
.nav a { color: var(--muted); padding: 6px 10px; border-radius: 8px; display: inline-flex; align-items: center; gap: 6px; font-size: 13.5px; }
.nav a svg { flex-shrink: 0; opacity: 0.8; }
.nav a.active, .nav a:hover { color: var(--text); background: var(--surface-2); text-decoration: none; }
.nav a.active svg, .nav a:hover svg { opacity: 1; }
.container { max-width: 1440px; margin: 0 auto; padding: 20px 24px; }
.container.wide { max-width: none; padding: 16px 20px; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.gap-1 { gap: 8px; }
.justify-end { justify-content: flex-end; } .justify-between { justify-content: space-between; } .items-center { align-items: center; }
.mb-1 { margin-bottom: 6px; } .mb-2 { margin-bottom: 14px; } .mb-3 { margin-bottom: 22px; }
.mt-2 { margin-top: 14px; } .mt-3 { margin-top: 22px; }
.bold { font-weight: 600; }
/* label above, field + button side by side (never wrapped under it) */
.copy-row { display: flex; gap: 8px; align-items: stretch; flex-wrap: nowrap; }
.copy-row input { flex: 1; min-width: 0; }
.copy-row .btn { flex: none; }
.spacer { flex: 1; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(360px, 1fr)); gap: 16px; }
.stack > * + * { margin-top: 16px; }

/* ---------- cards ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; }
.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; gap: 8px; }
.card-head h2 { margin: 0; }
.kv { display: grid; grid-template-columns: 140px 1fr; gap: 6px 12px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; word-break: break-word; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.empty { text-align: center; padding: 48px 16px; color: var(--muted); }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 14px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--surface-2); color: var(--text); font: inherit; cursor: pointer;
  white-space: nowrap;
}
.btn:hover { border-color: var(--muted); text-decoration: none; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.btn.danger { color: var(--danger); }
.btn.danger.solid { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.ok { color: var(--ok); }
.btn.start {
  background: color-mix(in srgb, var(--ok) 16%, var(--surface-2));
  border-color: color-mix(in srgb, var(--ok) 45%, var(--border));
  color: var(--ok);
  font-weight: 600;
}
.btn.start:hover {
  background: color-mix(in srgb, var(--ok) 26%, var(--surface-2));
  border-color: var(--ok);
}
.btn.stop {
  background: color-mix(in srgb, var(--danger) 16%, var(--surface-2));
  border-color: color-mix(in srgb, var(--danger) 45%, var(--border));
  color: var(--danger);
  font-weight: 600;
}
.btn.stop:hover {
  background: color-mix(in srgb, var(--danger) 26%, var(--surface-2));
  border-color: var(--danger);
}
.btn.live {
  background: color-mix(in srgb, var(--accent) 18%, var(--surface-2));
  border-color: color-mix(in srgb, var(--accent) 50%, var(--border));
  color: #fff;
  font-weight: 600;
}
.btn.live:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}
.btn.sm { padding: 4px 10px; font-size: 12.5px; }
.btn.busy { pointer-events: none; opacity: .75; }

@keyframes gp-spin {
  to { transform: rotate(360deg); }
}
.spinner {
  animation: gp-spin 0.75s linear infinite;
  display: inline-block;
  vertical-align: -2px;
}

/* ---------- table ---------- */
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; white-space: nowrap; }
.table tr:last-child td { border-bottom: none; }
.table-wrap { overflow-x: auto; }
.table th.th-cb, .table td.td-cb { width: 40px; text-align: center; padding-left: 14px; padding-right: 6px; }
.table input[type="checkbox"] { cursor: pointer; width: 16px; height: 16px; accent-color: var(--accent); vertical-align: middle; }
.table td.td-actions { text-align: right; padding-right: 14px; white-space: nowrap; width: 280px; }

/* Single line truncation cells */
.table td.cell-profile {
  max-width: 240px;
  white-space: nowrap;
}
.table td.cell-identity {
  max-width: 220px;
  white-space: nowrap;
}
.table td.cell-network {
  max-width: 150px;
  white-space: nowrap;
}
.table td.cell-ip {
  width: 175px;
  max-width: 185px;
  white-space: nowrap;
}
.table td.cell-last-launch {
  white-space: nowrap;
  width: 110px;
}

.ellipsis-line {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: inline-block;
  max-width: 100%;
  vertical-align: middle;
}

.ip-line-wrap {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  max-width: 100%;
  overflow: hidden;
  white-space: nowrap;
}
.ip-line-wrap .flag {
  flex-shrink: 0;
}
.ip-country-tag {
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 600;
  flex-shrink: 0;
}
.ip-line-wrap .mono {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: inline-block;
  vertical-align: middle;
  min-width: 0;
}

.ip-loc-tag {
  color: var(--muted);
  font-size: 11.5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 110px;
  display: inline-block;
  vertical-align: middle;
}

.profile-cell-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 100%;
  overflow: hidden;
}

.profile-name-link {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: inline-block;
  max-width: 160px;
  vertical-align: middle;
}

/* ---------- profile title & status dot ---------- */
.profile-title {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  display: inline-block;
  transition: all 0.3s ease;
}

.status-dot.running {
  background: #22c55e;
  box-shadow: 0 0 8px rgba(34, 197, 94, 0.7);
  animation: gp-pulse-dot 2.4s infinite ease-in-out;
}

.status-dot.stopped {
  background: rgba(255, 255, 255, 0.25);
  opacity: 0.35;
}

@keyframes gp-pulse-dot {
  0% {
    opacity: 0.3;
    transform: scale(0.9);
    box-shadow: 0 0 2px rgba(34, 197, 94, 0.2);
  }
  50% {
    opacity: 1;
    transform: scale(1.15);
    box-shadow: 0 0 10px rgba(34, 197, 94, 0.85);
  }
  100% {
    opacity: 0.3;
    transform: scale(0.9);
    box-shadow: 0 0 2px rgba(34, 197, 94, 0.2);
  }
}

/* ---------- unified action bar & icons ---------- */
.action-bar {
  display: inline-flex;
  align-items: flex-start;
  justify-content: flex-end;
  gap: 8px;
}

.action-item {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  width: 48px;
  gap: 4px;
  text-align: center;
}

.action-btn {
  width: 36px;
  height: 36px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font: inherit;
  cursor: pointer;
  transition: all 0.15s ease;
  flex-shrink: 0;
  text-decoration: none;
}

.action-btn:hover:not(:disabled):not(.disabled) {
  border-color: var(--muted);
  text-decoration: none;
  transform: translateY(-1px);
}

.action-btn:disabled,
.action-btn.disabled {
  opacity: 0.35;
  cursor: not-allowed;
  pointer-events: none;
  background: transparent;
  border-color: rgba(255, 255, 255, 0.08);
  color: var(--muted);
}

.action-label {
  font-size: 10.5px;
  line-height: 1.1;
  color: var(--muted);
  white-space: nowrap;
  font-weight: 500;
  user-select: none;
}

/* Specific button styles */
.action-btn.live {
  background: color-mix(in srgb, var(--accent) 18%, var(--surface-2));
  border-color: color-mix(in srgb, var(--accent) 50%, var(--border));
  color: #60a5fa;
}
.action-btn.live:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.action-btn.start {
  background: color-mix(in srgb, var(--ok) 16%, var(--surface-2));
  border-color: color-mix(in srgb, var(--ok) 45%, var(--border));
  color: var(--ok);
}
.action-btn.start:hover {
  background: color-mix(in srgb, var(--ok) 28%, var(--surface-2));
  border-color: var(--ok);
}

.action-btn.stop {
  background: color-mix(in srgb, var(--danger) 16%, var(--surface-2));
  border-color: color-mix(in srgb, var(--danger) 45%, var(--border));
  color: var(--danger);
}
.action-btn.stop:hover {
  background: color-mix(in srgb, var(--danger) 28%, var(--surface-2));
  border-color: var(--danger);
}

.action-btn.vpn-on {
  background: color-mix(in srgb, var(--ok) 16%, var(--surface-2));
  border-color: color-mix(in srgb, var(--ok) 45%, var(--border));
  color: var(--ok);
}
.action-btn.vpn-on:hover {
  background: color-mix(in srgb, var(--ok) 28%, var(--surface-2));
  border-color: var(--ok);
}

.action-btn.vpn-off {
  background: color-mix(in srgb, var(--danger) 16%, var(--surface-2));
  border-color: color-mix(in srgb, var(--danger) 45%, var(--border));
  color: var(--danger);
}
.action-btn.vpn-off:hover {
  background: color-mix(in srgb, var(--danger) 28%, var(--surface-2));
  border-color: var(--danger);
}

.action-btn.ip:hover,
.action-btn.info:hover {
  background: var(--surface);
  border-color: var(--accent);
  color: var(--accent);
}

.action-btn.warn {
  background: color-mix(in srgb, var(--warn) 16%, var(--surface-2));
  border-color: color-mix(in srgb, var(--warn) 45%, var(--border));
  color: var(--warn);
}
.action-btn.warn:hover {
  background: color-mix(in srgb, var(--warn) 28%, var(--surface-2));
  border-color: var(--warn);
}
.action-btn.accent {
  background: color-mix(in srgb, var(--accent) 16%, var(--surface-2));
  border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
  color: var(--accent);
}
.action-btn.accent:hover {
  background: color-mix(in srgb, var(--accent) 28%, var(--surface-2));
  border-color: var(--accent);
}
.action-btn.danger {
  background: color-mix(in srgb, var(--danger) 16%, var(--surface-2));
  border-color: color-mix(in srgb, var(--danger) 45%, var(--border));
  color: var(--danger);
}
.action-btn.danger:hover {
  background: color-mix(in srgb, var(--danger) 28%, var(--surface-2));
  border-color: var(--danger);
}
.action-btn.ok {
  background: color-mix(in srgb, var(--ok) 16%, var(--surface-2));
  border-color: color-mix(in srgb, var(--ok) 45%, var(--border));
  color: var(--ok);
}
.action-btn.ok:hover {
  background: color-mix(in srgb, var(--ok) 28%, var(--surface-2));
  border-color: var(--ok);
}

.action-btn.busy svg {
  animation: gp-spin 0.75s linear infinite;
}

.action-label.ok { color: var(--ok); }
.action-label.danger { color: var(--danger); }
.action-label.warn { color: var(--warn); }
.action-label.accent { color: var(--accent); }
.action-label.muted { color: var(--muted); opacity: 0.6; }

/* ---------- batch operations bar ---------- */
.batch-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: var(--surface);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  padding: 10px 16px;
  margin-bottom: 16px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
  flex-wrap: wrap;
  animation: batchSlideDown 0.18s ease-out;
}
@keyframes batchSlideDown {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}
.batch-count {
  font-weight: 600;
  font-size: 13px;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}
.batch-count .badge {
  background: color-mix(in srgb, var(--accent) 20%, var(--surface-2));
  color: var(--accent);
  border-color: var(--accent);
}
.batch-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* ---------- batch creation progress banner ---------- */
.batch-create-banner {
  background: var(--surface);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-bottom: 16px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
  animation: batchSlideDown 0.18s ease-out;
}
.batch-create-banner.completed {
  border-color: var(--ok);
}
.batch-create-banner.failed {
  border-color: var(--danger);
}
.batch-create-banner-content {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.batch-create-status-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.batch-create-icon-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text);
}
.batch-create-meta {
  display: flex;
  align-items: center;
}
.batch-create-meter-wrap {
  width: 100%;
  height: 6px;
  background: var(--surface-2);
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid var(--border);
}
.batch-create-meter-bar {
  height: 100%;
  background: var(--accent);
  border-radius: 999px;
  transition: width 0.3s ease;
}
.batch-create-banner.completed .batch-create-meter-bar {
  background: var(--ok);
}
.batch-create-banner.failed .batch-create-meter-bar {
  background: var(--danger);
}
.spinner-sm {
  width: 14px;
  height: 14px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: gp-spin 0.75s linear infinite;
  display: inline-block;
  flex-shrink: 0;
}

/* ---------- badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; border-radius: 999px; font-size: 12px; background: var(--surface-2); border: 1px solid var(--border); color: var(--muted); }
.badge.ok { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 40%, transparent); }
.badge.warn { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 40%, transparent); }
.badge.danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, transparent); }
.badge.accent { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 40%, transparent); }
.dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.label { display: inline-block; padding: 1px 7px; border-radius: 6px; background: var(--surface-2); font-size: 12px; margin: 1px 2px 1px 0; }
.flag { font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", "Segoe UI Symbol", sans-serif; font-size: 1.15em; line-height: 1; vertical-align: -0.1em; display: inline-block; margin-right: 4px; }

/* ---------- forms ---------- */
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px 16px; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field.full { grid-column: 1 / -1; }
.field label { color: var(--muted); font-size: 12.5px; font-weight: 600; }
.field .hint { color: var(--muted); font-size: 12px; }
input[type=text], input[type=password], input[type=number], input[type=url], input[type=search], select, textarea {
  width: 100%; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--bg); color: var(--text); font: inherit;
}
/* Selects: drop the native macOS/Windows widget so they match text inputs in height, radius and padding. */
select {
  -webkit-appearance: none; appearance: none; cursor: pointer; text-overflow: ellipsis;
  padding-right: 32px; line-height: 1.25;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 17px) 50%, calc(100% - 12px) 50%;
  background-size: 5px 5px, 5px 5px; background-repeat: no-repeat;
}
input[type=text], input[type=password], input[type=number], input[type=url], input[type=search] { line-height: 1.25; }
input[type=search] { -webkit-appearance: none; appearance: none; }
select option { background: var(--surface); color: var(--text); }
select:disabled { opacity: .6; cursor: not-allowed; }
textarea { min-height: 80px; resize: vertical; }
textarea.code { font-family: var(--mono); font-size: 12.5px; min-height: 120px; }
input:focus, select:focus, textarea:focus { outline: 2px solid color-mix(in srgb, var(--accent) 50%, transparent); outline-offset: 0; border-color: var(--accent); }
#name:focus::placeholder { color: transparent; opacity: 0; }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 13px; }
.check input[type="checkbox"] { width: 17px; height: 17px; accent-color: var(--accent); cursor: pointer; flex: 0 0 auto; margin: 0; }
.segmented { display: inline-flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.segmented label { padding: 7px 14px; cursor: pointer; color: var(--muted); border-right: 1px solid var(--border); }
.segmented label:last-child { border-right: none; }
.segmented input { display: none; }
.segmented input:checked + span { color: var(--text); }
.segmented label:has(input:checked) { background: var(--surface-2); color: var(--text); }
fieldset { border: none; padding: 0; margin: 0; }
.hidden { display: none !important; }

/* ---------- dropzone & tabs ---------- */
.dropzone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 28px 20px;
  text-align: center;
  background: var(--surface-2);
  cursor: pointer;
  transition: border-color .15s ease, background-color .15s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.dropzone:hover, .dropzone.dragover {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 8%, var(--surface-2));
}
.dropzone-icon {
  color: var(--muted);
  margin-bottom: 2px;
}
.tab-row {
  display: flex;
  gap: 8px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
}
.tab-btn {
  padding: 8px 16px;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  cursor: pointer;
  font: inherit;
  font-weight: 500;
}
.tab-btn:hover {
  color: var(--text);
}
.tab-btn.active {
  color: var(--text);
  border-bottom-color: var(--accent);
}

/* ---------- live view ---------- */
.container.wide { max-width: none; padding: 16px 20px; }
/* minmax(0, …): without it the VNC canvas' native width (e.g. 1920px) blows the column up. */
.live-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 16px; align-items: start; }
@media (max-width: 1100px) { .live-layout { grid-template-columns: minmax(0, 1fr); } }
.screen {
  position: relative; background: #000; border-radius: var(--radius); border: 2px solid var(--border);
  aspect-ratio: 16 / 9; overflow: hidden;
  /* Fit the whole remote screen in the viewport; noVNC letterboxes inside this box. */
  width: 100%; max-height: calc(100vh - 190px);
}
.screen.control { border-color: var(--warn); box-shadow: 0 0 0 3px color-mix(in srgb, var(--warn) 25%, transparent); }
.screen > div { width: 100%; height: 100%; }
.vnc-stats { font-family: var(--mono); font-size: 12px; color: var(--muted); }
.screen-overlay { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: #aaa; pointer-events: none; }
.banner { padding: 10px 14px; border-radius: 8px; border: 1px solid; display: flex; gap: 10px; align-items: center; }
.banner.warn { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 40%, transparent); background: color-mix(in srgb, var(--warn) 8%, transparent); }
.log {
  font-family: var(--mono); font-size: 12px; background: var(--bg); border: 1px solid var(--border); border-radius: 8px;
  padding: 8px; height: 320px; overflow-y: auto; white-space: pre-wrap; word-break: break-word;
}
.log .lvl-error { color: var(--danger); }
.log .lvl-warning { color: var(--warn); }
.log .lvl-debug { color: var(--muted); }

/* ---------- modal / toast ---------- */
dialog { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); color: var(--text); padding: 0; max-width: min(1100px, 95vw); width: 100%; box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45); }
dialog::backdrop { background: rgba(0, 0, 0, .6); backdrop-filter: blur(2px); }
dialog .dlg-head { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--border); }
dialog .dlg-body { padding: 16px; }
dialog video { width: 100%; max-height: 75vh; background: #000; border-radius: 8px; }
dialog.narrow { max-width: 480px; }
.confirm-dialog { max-width: 440px; }
.confirm-dialog .dlg-body { padding: 18px 20px; font-size: 14px; line-height: 1.5; color: var(--text); }
.confirm-dialog .dlg-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 20px; border-top: 1px solid var(--border); background: var(--surface-2); border-bottom-left-radius: var(--radius); border-bottom-right-radius: var(--radius); }
.toasts { position: fixed; bottom: 20px; right: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 100; }
.toast { background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--accent); padding: 10px 14px; border-radius: 8px; max-width: 420px; box-shadow: 0 6px 24px rgba(0,0,0,.25); }
.toast.error { border-left-color: var(--danger); }
.toast.ok { border-left-color: var(--ok); }

/* ---------- login ---------- */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; }
.login-card { width: 340px; }
.error-text { color: var(--danger); }

/* ---------- login loading & success overlay ---------- */
.login-loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 17, 21, 0.88);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
.login-loading-overlay:not(.hidden) {
  opacity: 1;
  pointer-events: auto;
}
@media (prefers-color-scheme: light) {
  .login-loading-overlay {
    background: rgba(245, 246, 248, 0.9);
  }
}

.login-feedback-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 36px 32px 30px;
  min-width: 300px;
  max-width: 360px;
  width: 90%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(255, 255, 255, 0.04);
  transform: scale(0.92) translateY(12px);
  opacity: 0;
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.35s ease;
}
.login-loading-overlay:not(.hidden) .login-feedback-card {
  transform: scale(1) translateY(0);
  opacity: 1;
}

.login-avatar-wrapper {
  position: relative;
  width: 96px;
  height: 96px;
  margin-bottom: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.logo-shield {
  width: 80px;
  height: 80px;
  border-radius: 22px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
  position: relative;
  z-index: 2;
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.4s ease, box-shadow 0.4s ease;
}
.splash-logo {
  width: 48px;
  height: 48px;
  border-radius: 10px;
  object-fit: contain;
  display: block;
}
.glow-ring {
  position: absolute;
  inset: -12px;
  border-radius: 34px;
  background: radial-gradient(circle, rgba(62, 207, 142, 0.45) 0%, rgba(62, 207, 142, 0) 70%);
  filter: blur(12px);
  z-index: 1;
  opacity: 0;
  transition: opacity 0.5s ease, background 0.5s ease;
}
.login-loading-overlay.is-success .glow-ring {
  opacity: 1;
  background: radial-gradient(circle, rgba(62, 207, 142, 0.5) 0%, rgba(62, 207, 142, 0) 70%);
}
.login-loading-overlay.is-loading .glow-ring {
  opacity: 0.85;
  background: radial-gradient(circle, rgba(109, 140, 255, 0.5) 0%, rgba(109, 140, 255, 0) 70%);
}
.login-loading-overlay.is-success .logo-shield {
  border-color: rgba(62, 207, 142, 0.6);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3), 0 0 24px rgba(62, 207, 142, 0.25);
  transform: scale(1.03);
}
.login-loading-overlay.is-loading .logo-shield {
  border-color: rgba(109, 140, 255, 0.4);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3), 0 0 24px rgba(109, 140, 255, 0.2);
  animation: logoBreath 1.8s ease-in-out infinite alternate;
}
@keyframes logoBreath {
  0% { transform: scale(1); }
  100% { transform: scale(1.04); }
}

.spinner-ring {
  position: absolute;
  inset: 2px;
  border-radius: 26px;
  border: 2px solid transparent;
  z-index: 3;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.35s ease;
}
.login-loading-overlay.is-loading .spinner-ring {
  opacity: 1;
  border-top-color: var(--accent);
  border-right-color: rgba(109, 140, 255, 0.25);
  box-shadow: 0 0 14px rgba(109, 140, 255, 0.35);
  animation: spinRing 1s linear infinite;
}
@keyframes spinRing {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.success-badge {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--ok);
  color: #0b1020;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(62, 207, 142, 0.45);
  z-index: 5;
  transform: scale(0);
  opacity: 0;
  transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.3s ease;
}
.login-loading-overlay.is-success .success-badge {
  transform: scale(1);
  opacity: 1;
}
.login-loading-overlay.is-loading .success-badge {
  transform: scale(0.4);
  opacity: 0;
}
.success-badge svg {
  width: 16px;
  height: 16px;
}
.check-path {
  stroke-dasharray: 24;
  stroke-dashoffset: 24;
}
.login-loading-overlay.is-success .check-path {
  animation: drawCheck 0.35s ease 0.15s forwards;
}
@keyframes drawCheck {
  to {
    stroke-dashoffset: 0;
  }
}

.feedback-stages {
  position: relative;
  min-height: 48px;
  width: 100%;
}
.stage {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transform: translateY(6px);
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}
.login-loading-overlay.is-success .stage-success {
  opacity: 1;
  transform: translateY(0);
}
.login-loading-overlay.is-loading .stage-loading {
  opacity: 1;
  transform: translateY(0);
}
.login-loading-overlay.is-loading .stage-success {
  opacity: 0;
  transform: translateY(-6px);
}

.feedback-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.01em;
  margin-bottom: 4px;
}
.feedback-sub {
  font-size: 13px;
  color: var(--muted);
}

.loading-dots span {
  display: inline-block;
  animation: dotPulse 1.2s infinite;
  opacity: 0.2;
}
.loading-dots span:nth-child(2) { animation-delay: 0.2s; }
.loading-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes dotPulse {
  0%, 100% { opacity: 0.2; transform: translateY(0); }
  50% { opacity: 1; transform: translateY(-1.5px); }
}

.feedback-progress {
  width: 180px;
  height: 4px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 99px;
  overflow: hidden;
  margin-top: 20px;
}
.feedback-progress-bar {
  height: 100%;
  width: 0%;
  border-radius: 99px;
  background: var(--ok);
  transition: width 0.7s cubic-bezier(0.16, 1, 0.3, 1), background 0.4s ease;
  box-shadow: 0 0 8px rgba(62, 207, 142, 0.5);
}
.login-loading-overlay.is-loading .feedback-progress-bar {
  background: linear-gradient(90deg, var(--ok), var(--accent));
  box-shadow: 0 0 10px rgba(109, 140, 255, 0.5);
  transition: width 1.1s cubic-bezier(0.4, 0, 0.2, 1);
}


/* ---------- dashboard overview styles ---------- */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 14px;
}

.stat-card {
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
  transition: transform 0.15s ease, border-color 0.15s ease;
}

.stat-card:hover {
  border-color: var(--muted);
  transform: translateY(-1px);
}

.stat-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.stat-title {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.stat-icon-wrap {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--surface-2);
  display: flex;
  align-items: center;
  justify-content: center;
}

.stat-val {
  font-size: 28px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.1;
  margin: 4px 0 6px;
  display: flex;
  align-items: center;
}

.stat-unit {
  font-size: 15px;
  font-weight: 500;
  color: var(--muted);
  margin-left: 6px;
}

.stat-sub {
  font-size: 12px;
  color: var(--muted);
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}

.stat-progress-bar {
  width: 100%;
  height: 4px;
  border-radius: 2px;
  background: var(--surface-2);
  margin-top: 10px;
  overflow: hidden;
}

.stat-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--ok), var(--accent));
  transition: width 0.4s ease;
}

.mode-tag {
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 500;
}
.mode-tag.direct { background: color-mix(in srgb, #6d8cff 18%, var(--surface-2)); color: #6d8cff; }
.mode-tag.vpn { background: color-mix(in srgb, #22c55e 18%, var(--surface-2)); color: #22c55e; }
.mode-tag.proxy { background: color-mix(in srgb, #f5b041 18%, var(--surface-2)); color: #f5b041; }
.mode-tag.trash { background: color-mix(in srgb, var(--danger) 18%, var(--surface-2)); color: var(--danger); }

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

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

.chart-card {
  padding: 20px;
}

.chart-box {
  position: relative;
  min-height: 180px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.chart-legend-top {
  display: flex;
  align-items: center;
  font-size: 12px;
  color: var(--muted);
}

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

.chart-svg {
  width: 100%;
  height: auto;
  max-height: 190px;
  overflow: visible;
}

.chart-col-group {
  cursor: pointer;
  transition: opacity 0.15s ease;
}

.chart-col-group:hover rect {
  filter: brightness(1.25);
}

.chart-tooltip {
  position: absolute;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 11.5px;
  pointer-events: none;
  white-space: nowrap;
  z-index: 20;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.donut-flex {
  display: flex;
  align-items: center;
  justify-content: space-around;
  width: 100%;
  gap: 20px;
  flex-wrap: wrap;
}

.donut-svg-wrap {
  width: 140px;
  height: 140px;
  flex-shrink: 0;
}

.donut-svg {
  width: 100%;
  height: 100%;
}

.donut-legend {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 160px;
}

.legend-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
}

.legend-color {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  flex-shrink: 0;
}

.legend-name {
  color: var(--muted);
  flex: 1;
}

.legend-val {
  font-weight: 600;
}

.live-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 14px;
}

.live-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: border-color 0.2s ease, transform 0.15s ease;
}

.live-card:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
}

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

.live-card-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14.5px;
}

.live-card-body {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
}

.live-meta-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.live-card-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 4px;
}

.live-empty {
  padding: 32px 20px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.live-empty-icon {
  color: var(--muted);
  opacity: 0.5;
  margin-bottom: 4px;
}

.live-empty-text {
  font-weight: 600;
  font-size: 14px;
  color: var(--text);
}

.live-empty-sub {
  color: var(--muted);
  font-size: 12.5px;
  max-width: 480px;
}

.quick-actions-card {
  background: linear-gradient(135deg, var(--surface), var(--surface-2));
  border: 1px solid var(--border);
  padding: 16px 20px;
}

.quick-launch-flex {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.quick-launch-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.quick-label {
  font-weight: 600;
  font-size: 13.5px;
  color: var(--text);
}

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

.sys-health-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 20px;
  gap: 16px;
  flex-wrap: wrap;
  font-size: 12.5px;
}

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

/* ---------- tasks & automation ---------- */
.checklist {
  border: 1px solid var(--border);
  border-radius: 8px;
  max-height: 200px;
  overflow-y: auto;
  background: var(--bg);
}
.checklist-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  transition: background .12s ease;
}
.checklist-item:last-child { border-bottom: none; }
.checklist-item:hover { background: var(--surface-2); }
.checklist-item.selected { background: color-mix(in srgb, var(--accent) 10%, var(--surface-2)); }
.checklist-item input[type="checkbox"] { width: 15px; height: 15px; accent-color: var(--accent); cursor: pointer; }
.checklist-name { font-weight: 600; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.checklist-meta { flex-shrink: 0; }

.param-form { display: flex; flex-direction: column; gap: 14px; }
.param-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px 18px;
  align-items: start;
}
.param-group + .param-group {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid color-mix(in srgb, var(--border) 65%, transparent);
}
.param-group-title {
  margin: 0 0 10px;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--muted);
}
.param-advanced > summary { cursor: pointer; color: var(--muted); font-size: 12px; font-weight: 600; margin: 10px 0 8px; }
.param-field { display: flex; flex-direction: column; gap: 6px; }
.param-field.wide { grid-column: 1 / -1; }
.param-pair { display: flex; align-items: center; gap: 6px; }
.param-pair input[type=number] { min-width: 0; flex: 1; }
.param-pair select { width: auto; flex: 0 0 auto; }
.param-slider { display: flex; align-items: center; gap: 10px; }
.param-slider input[type=range] { flex: 1; accent-color: var(--accent); }
.param-slider output { min-width: 38px; text-align: right; font-variant-numeric: tabular-nums; }
.param-field-head label { color: var(--muted); font-size: 12px; font-weight: 600; word-break: break-word; }
.param-field-head code { color: var(--accent); font-size: 10.5px; }
.param-field .hint { color: var(--muted); font-size: 11.5px; }

.timing-extra { display: flex; gap: 6px; align-items: center; margin-top: 8px; }
.timing-extra input { width: 100%; max-width: 260px; }

.run-progress {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  background: color-mix(in srgb, var(--accent) 10%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
}
.run-spinner {
  width: 15px;
  height: 15px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: gp-spin .75s linear infinite;
  flex-shrink: 0;
}

.badge.scheduled {
  color: var(--muted);
  border-color: var(--border);
  font-weight: 500;
}
.hint.error { color: var(--danger); }
.btn-row-fast { font-size: 13px; padding: 2px 7px; }

/* ---------- tasks catalog & task workspace ---------- */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--muted);
  margin: 18px 0 14px;
}
.breadcrumb a { color: var(--accent); text-decoration: none; }
.breadcrumb a:hover { text-decoration: underline; }
.breadcrumb .sep { opacity: .5; }
.breadcrumb span:last-child { color: var(--text); font-weight: 600; }

.task-kpis {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 12px;
}
.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--muted);
  white-space: nowrap;
}
.pill.ok {
  color: var(--ok);
  border-color: color-mix(in srgb, var(--ok) 40%, var(--border));
  background: color-mix(in srgb, var(--ok) 10%, var(--surface-2));
}
.pill.danger {
  color: var(--danger);
  border-color: color-mix(in srgb, var(--danger) 40%, var(--border));
  background: color-mix(in srgb, var(--danger) 10%, var(--surface-2));
}
.pill.scheduled { color: var(--muted); }

.task-card {
  transition: transform .12s ease, box-shadow .12s ease;
}
.task-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(0, 0, 0, .18);
}

.kpi-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin: 18px 0;
}
.kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.kpi-value { font-size: 26px; font-weight: 700; line-height: 1.1; }
.kpi-value.danger { color: var(--danger); }
.kpi-label { color: var(--muted); font-size: 12px; }

.task-toolbar {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin: 12px 0;
}

.badge.custom-params {
  color: var(--accent);
  border-color: color-mix(in srgb, var(--accent) 50%, var(--border));
  background: color-mix(in srgb, var(--accent) 12%, var(--surface-2));
}
.badge.default-params { color: var(--muted); }

.td-actions { text-align: right; }



/* ------------------------------------------------------------ Cluster topology widget */
.topo-card { display: flex; flex-direction: column; --topo-coral: #ff7a59; --topo-cyan: #7ff0ff; }
.topo-card:fullscreen,
.topo-card.is-fullscreen { background: var(--bg); padding: 20px; }
.topo-card:fullscreen .topo-canvas,
.topo-card.is-fullscreen .topo-canvas { flex: 1; height: auto; }
.topo-card.is-fullscreen:not(:fullscreen) { position: fixed; inset: 0; z-index: 1000; border-radius: 0; }

.topo-legend { display: flex; align-items: center; gap: 12px; font-size: 12px; color: var(--muted); flex-wrap: wrap; justify-content: flex-end; }
.topo-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 5px; vertical-align: middle; }
.topo-dot.idle { background: var(--accent); }
.topo-dot.inuse { background: var(--topo-coral); box-shadow: 0 0 6px var(--topo-coral); }
.topo-dot.pending { background: var(--warn); }
.topo-dot.offline { background: rgba(255, 255, 255, 0.25); }

.topo-canvas {
  position: relative;
  height: 420px;
  flex: none;
  border-radius: 10px;
  overflow: hidden;
  background-color: rgba(0, 0, 0, 0.22);
  background-image: radial-gradient(rgba(255, 255, 255, 0.09) 1px, transparent 1px);
  background-size: 22px 22px;
  border: 1px solid var(--border);
  cursor: grab;
  user-select: none;
}
.topo-canvas.grabbing { cursor: grabbing; }
.topo-svg { display: block; touch-action: none; }
.topology-viewport { will-change: transform; }

.topo-controls {
  position: absolute; left: 10px; bottom: 10px;
  display: flex; flex-direction: column;
  background: rgba(23, 26, 33, 0.7);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--border); border-radius: 10px; overflow: hidden;
}
.topo-controls button {
  width: 30px; height: 30px; display: grid; place-items: center;
  background: transparent; border: 0; color: var(--text); cursor: pointer;
}
.topo-controls button + button { border-top: 1px solid var(--border); }
.topo-controls button:hover { background: rgba(255, 255, 255, 0.08); color: var(--accent); }

.topo-tip {
  position: absolute; z-index: 5; pointer-events: none;
  background: rgba(15, 17, 21, 0.94); border: 1px solid var(--border); border-radius: 8px;
  padding: 8px 10px; font-size: 12px; line-height: 1.5; color: var(--text); max-width: 260px;
}
.topo-tip-title { font-weight: 600; margin-bottom: 2px; }
.topo-lat.ok { color: var(--ok); }
.topo-lat.warn { color: var(--warn); }
.topo-lat.danger { color: var(--danger); }

/* hub */
.topo-hub-body { fill: var(--surface); stroke: var(--border); stroke-width: 1.5; }
.topo-hub-halo { fill: none; stroke: transparent; stroke-width: 2; }
.topo-hub-label { fill: var(--text); font-size: 16px; font-weight: 700; letter-spacing: 0.2px; }
.topo-hub.active .topo-hub-body { stroke: var(--topo-coral); }
.topo-hub.active .topo-hub-halo {
  stroke: var(--topo-coral); opacity: 0.5;
  filter: drop-shadow(0 0 8px var(--topo-coral));
  animation: topo-pulse 2.4s ease-in-out infinite;
}
.topo-hub-badge rect { fill: var(--topo-coral); filter: drop-shadow(0 0 6px var(--topo-coral)); }
.topo-hub-badge text { fill: #1a0d08; font-size: 12px; font-weight: 700; }

/* edges */
.topo-edge path { fill: none; stroke-linecap: round; }
.topo-edge.offline .topo-edge-line { stroke: rgba(255, 255, 255, 0.08); stroke-width: 1.5; }
.topo-edge.pending .topo-edge-line { stroke: var(--warn); stroke-opacity: 0.35; stroke-width: 1.5; stroke-dasharray: 4 6; }
.topo-edge.idle .topo-edge-line { stroke: var(--accent); stroke-opacity: 0.55; stroke-width: 2; }
.topo-edge.inuse .topo-edge-base {
  stroke: var(--topo-coral); stroke-opacity: 0.28; stroke-width: 4;
  filter: drop-shadow(0 0 5px var(--topo-coral));
}
.topo-edge.inuse .topo-edge-flow {
  stroke-width: 3; stroke-dasharray: 10 22;
  animation: topo-flow 1.1s linear infinite;
}

/* nodes */
.topo-node-body { fill: var(--surface); stroke: var(--accent); stroke-opacity: 0.6; stroke-width: 1.5; }
.topo-node-halo { fill: none; stroke: transparent; }
.topo-kind { fill: rgba(109, 140, 255, 0.16); }
.topo-kind-text { fill: var(--accent); font-size: 10px; font-weight: 700; }
.topo-name { fill: var(--text); font-size: 12px; font-weight: 600; }
.topo-sub { fill: var(--muted); font-size: 10px; }
.topo-status-dot { fill: var(--ok); }
.topo-node { cursor: default; }

.topo-node.offline { opacity: 0.45; filter: grayscale(1); }
.topo-node.offline .topo-node-body { stroke: var(--border); stroke-opacity: 1; }
.topo-node.offline .topo-status-dot { fill: var(--muted); }
.topo-node.offline .topo-name,
.topo-node.offline .topo-sub { fill: var(--muted); }

.topo-node.pending { opacity: 0.65; }
.topo-node.pending .topo-node-body { stroke: var(--border); stroke-opacity: 1; }
.topo-node.pending .topo-status-dot { fill: var(--warn); animation: topo-blink 1.4s ease-in-out infinite; }

.topo-node.inuse .topo-node-body { stroke: var(--topo-coral); stroke-opacity: 1; }
.topo-node.inuse .topo-node-halo {
  stroke: var(--topo-coral); opacity: 0.45;
  filter: drop-shadow(0 0 8px var(--topo-coral));
  animation: topo-pulse 2.4s ease-in-out infinite;
}
.topo-count { fill: var(--topo-coral); filter: drop-shadow(0 0 5px var(--topo-coral)); }
.topo-count-text { fill: #1a0d08; font-size: 12px; font-weight: 700; }

@keyframes topo-flow { to { stroke-dashoffset: -32; } }
@keyframes topo-pulse { 0%, 100% { opacity: 0.25; } 50% { opacity: 0.7; } }
@keyframes topo-blink { 0%, 100% { opacity: 1; } 50% { opacity: 0.25; } }

.topo-card.paused .topo-svg * { animation-play-state: paused; }
@media (prefers-reduced-motion: reduce) {
  .topo-svg * { animation: none !important; }
}

/* ---------- RBAC viewer restrictions ---------- */
body[data-role="viewer"] a[href="/profiles/new"],
body[data-role="viewer"] a[href*="/edit"],
body[data-role="viewer"] a[href*="/sessions/"],
body[data-role="viewer"] .action-btn.live,
body[data-role="viewer"] .action-btn.start,
body[data-role="viewer"] .action-btn.stop,
body[data-role="viewer"] .action-btn.vpn-on,
body[data-role="viewer"] .action-btn.vpn-off,
body[data-role="viewer"] .action-btn.delete,
body[data-role="viewer"] .btn.live,
body[data-role="viewer"] .btn.start,
body[data-role="viewer"] .btn.stop,
body[data-role="viewer"] .viewer-hide {
  display: none !important;
}

/* ---------- workflows ---------- */
.wf-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 16px; }
.wf-card { display: flex; flex-direction: column; gap: 10px; }
.wf-card h2 { margin: 0; font-size: 16px; word-break: break-word; }
.wf-card.is-off { opacity: .7; }
.wf-meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.wf-chips { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.wf-chip { font-size: 11.5px; padding: 2px 8px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); color: var(--text); }
.wf-arrow { color: var(--muted); font-size: 11px; }
.wf-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: auto; }
.wf-hero-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

.wf-steps { display: flex; flex-direction: column; }
.wf-step { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.wf-step-head { display: flex; align-items: center; gap: 10px; padding: 10px 12px; flex-wrap: wrap; }
.wf-step-head select { min-width: 200px; flex: 1; max-width: 340px; }
.wf-step-num { width: 24px; height: 24px; border-radius: 50%; background: var(--surface-2); display: grid; place-items: center; font-size: 12px; font-weight: 700; color: var(--muted); flex: 0 0 auto; }
.wf-step-tools { margin-left: auto; display: flex; gap: 4px; }
.wf-step-body { display: flex; flex-direction: column; gap: 14px; padding: 14px; border-top: 1px solid var(--border); }
.wf-step-body h4 { margin: 0 0 8px; font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.wf-pause { text-align: center; color: var(--muted); font-size: 12px; padding: 8px 0; }
.wf-pause.has-pause { color: var(--accent); }
.wf-add { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 12px; }
.wf-add select { min-width: 220px; }
.wf-total { margin-top: 10px; color: var(--muted); font-size: 12.5px; }
.wf-error { margin-top: 12px; padding: 10px 12px; border-radius: 8px; color: var(--danger); background: color-mix(in srgb, var(--danger) 10%, transparent); border: 1px solid color-mix(in srgb, var(--danger) 35%, transparent); font-size: 13px; }

.wf-assign-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 16px; align-items: start; }
.wf-assign-list { max-height: 460px; overflow-y: auto; border: 1px solid var(--border); border-radius: var(--radius-control, 8px); background: var(--bg); }
.wf-assign-row { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-bottom: 1px solid var(--border); transition: background .12s ease; }
.wf-assign-row:hover { background: var(--surface-2); }
.wf-assign-row:last-child { border-bottom: none; }
.wf-assign-row.assigned { background: color-mix(in srgb, var(--accent) 8%, var(--surface-2)); }
.wf-assign-row input[type="checkbox"], .wf-cb { width: 15px; height: 15px; accent-color: var(--accent); cursor: pointer; flex: 0 0 auto; }
.wf-assign-name { flex: 1; min-width: 0; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wf-assign-tools { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.wf-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.wf-seg { display: inline-flex; align-items: center; gap: 2px; padding: 2px; border-radius: 8px; background: var(--bg); border: 1px solid var(--border); }
.wf-seg button { border: 0; background: transparent; color: var(--muted); font-size: 12px; font-weight: 500; padding: 4px 10px; border-radius: 6px; cursor: pointer; display: inline-flex; align-items: center; gap: 5px; }
.wf-seg button:hover { color: var(--text); }
.wf-seg button.active { background: var(--surface-2); color: var(--text); box-shadow: inset 0 0 0 1px var(--border); }
.tab-badge { font-family: var(--mono); font-size: 10.5px; padding: 1px 6px; margin-left: 4px; }

.wf-apply-list { max-height: 280px; overflow-y: auto; border: 1px solid var(--border); border-radius: 8px; background: var(--bg); }
.wf-apply-item { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-bottom: 1px solid var(--border); cursor: pointer; }
.wf-apply-item:last-child { border-bottom: none; }
.wf-apply-item:hover { background: var(--surface-2); }

.wf-switch { position: relative; display: inline-block; width: 34px; height: 19px; flex: 0 0 auto; }
.wf-switch input { opacity: 0; width: 0; height: 0; }
.wf-switch-slider { position: absolute; inset: 0; background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px; cursor: pointer; transition: .15s ease; }
.wf-switch-slider::before { content: ""; position: absolute; width: 13px; height: 13px; left: 2px; top: 2px; border-radius: 50%; background: var(--muted); transition: .15s ease; }
.wf-switch input:checked + .wf-switch-slider { background: color-mix(in srgb, var(--ok) 24%, var(--surface-2)); border-color: color-mix(in srgb, var(--ok) 60%, var(--border)); }
.wf-switch input:checked + .wf-switch-slider::before { transform: translateX(15px); background: var(--ok); }

.wf-sch-row { cursor: pointer; transition: background .12s ease; }
.wf-sch-row:hover { background: var(--surface-2); }
.wf-sch-runs-link { display: inline-flex; align-items: center; gap: 4px; color: var(--accent); font-size: 12px; font-weight: 500; margin-top: 2px; }
.wf-sch-runs-link:hover { text-decoration: underline; }

.wf-runs-banner { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 10px 14px; margin-bottom: 14px; border-radius: var(--radius); background: color-mix(in srgb, var(--accent) 10%, var(--surface)); border: 1px solid color-mix(in srgb, var(--accent) 45%, var(--border)); }
.wf-runs tr.selected { background: color-mix(in srgb, var(--accent) 9%, var(--surface-2)); }
.wf-runs td.cell-error { max-width: 280px; color: var(--muted); font-size: 12.5px; word-break: break-word; }
.wf-exec-table td, .wf-exec-table th { padding: 8px 10px; }

.pf-rules { display: flex; flex-direction: column; gap: 10px; }
.pf-rule-card { background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: 12px 14px; display: flex; flex-direction: column; gap: 12px; }
.pf-rule-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.pf-rule-head .pf-rule-creator { flex: 1; min-width: 180px; }
.pf-rule-follow-pill { display: inline-flex; align-items: center; gap: 8px; padding: 5px 10px; border-radius: 8px; background: var(--surface-2); border: 1px solid var(--border); cursor: pointer; font-size: 12.5px; font-weight: 500; user-select: none; }
.pf-rule-follow-pill:hover { border-color: var(--accent); }
.pf-rule-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px 16px; }
.pf-rule-item { display: flex; flex-direction: column; gap: 4px; }
.pf-rule-item > label { font-size: 11.5px; font-weight: 600; color: var(--muted); }
.pf-rule-item > .hint { font-size: 11px; color: var(--muted); line-height: 1.35; }

/* ---------- task creator ---------- */
.tc-toolbar { padding: 10px 14px; }
.tc-problems { position: sticky; top: 8px; z-index: 5; margin-bottom: 14px; padding: 10px 12px; border-radius: 8px; font-size: 13px;
  color: var(--danger); background: color-mix(in srgb, var(--danger) 12%, var(--surface)); border: 1px solid color-mix(in srgb, var(--danger) 40%, transparent); }
.tc-fields { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px 14px; }
.tc-field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.tc-field.wide { grid-column: 1 / -1; }
.tc-field > label { color: var(--muted); font-size: 12px; font-weight: 600; }
.tc-field .hint { color: var(--muted); font-size: 11.5px; }
.tc-item { border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 12px; background: var(--surface); }
.tc-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.tc-head .tc-name { font-family: var(--mono); font-weight: 600; min-width: 140px; max-width: 220px; }
.tc-head > input[type=text]:not(.tc-name) { flex: 1; min-width: 160px; }
.tc-list { display: flex; flex-direction: column; gap: 8px; }
.tc-action { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.tc-action > .tc-head { margin: 0; padding: 8px 10px; }
.tc-action > .tc-head select { min-width: 200px; max-width: 320px; }
.tc-summary { flex: 1; min-width: 80px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tc-body { padding: 10px 12px 12px; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 10px; }
.tc-body .tc-list { margin-left: 4px; padding-left: 12px; border-left: 2px solid var(--border); }
.tc-adv > summary { cursor: pointer; margin-bottom: 6px; }
.tc-add { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.tc-add select { min-width: 220px; }
.tc-cond { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 6px 8px; border-radius: 8px; background: var(--surface-2); }
.tc-cond > input, .tc-cond > select { min-width: 140px; flex: 1; }
.tc-children { display: flex; flex-direction: column; gap: 6px; width: 100%; padding-left: 12px; border-left: 2px solid var(--border); }
.tc-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.tc-row > input[type=text]:not(.tc-name) { flex: 1; min-width: 160px; }
.tc-head select, .tc-add select, .tc-cond > select, .tc-row > select { width: auto; flex: 0 1 auto; }
.tc-cond > input, .tc-row > input[type=text]:not(.tc-name), .tc-head > input[type=text]:not(.tc-name) { width: auto; flex: 1 1 160px; }

/* ---------- profiles: filters and grouping ---------- */
.filter-bar { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: flex-end; padding: 10px 14px; margin-bottom: 14px; }
.filter-bar .fb-item { display: flex; flex-direction: column; gap: 3px; min-width: 130px; }
.filter-bar .fb-item > span { color: var(--muted); font-size: 11.5px; font-weight: 600; }
.filter-bar select { width: auto; min-width: 130px; }
.filter-bar .fb-end { margin-left: auto; flex-direction: row; align-items: center; gap: 10px; min-width: 0; }
.table tr.group-row td { background: var(--surface-2); border-bottom: 1px solid var(--border); padding: 8px 14px; }
.table tr.group-row .group-toggle { border: none; background: transparent; color: var(--muted); cursor: pointer; font-size: 14px; padding: 0 6px 0 0; }
.table tr.group-row strong { margin-right: 8px; }

/* ---------- monitor wall ---------- */
.seg { display: inline-flex; gap: 0; }
.seg .btn { border-radius: 0; margin-left: -1px; }
.seg .btn:first-child { border-radius: var(--radius) 0 0 var(--radius); margin-left: 0; }
.seg .btn:last-child { border-radius: 0 var(--radius) var(--radius) 0; }
.seg .btn.active { background: var(--surface-2); color: var(--text); border-color: var(--accent); position: relative; }
/* 3-4 tiles per row on a normal screen; the column count follows the browser width. */
.mon-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 12px; align-items: start; }
.mon-tile { display: flex; flex-direction: column; gap: 8px; height: 300px; padding: 10px 12px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); contain: layout paint; }
.mon-tile.is-active { border-color: color-mix(in srgb, var(--ok) 35%, var(--border)); }
.mon-tile-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-width: 0; }
.mon-tile-title { min-width: 0; display: flex; flex-direction: column; }
.mon-tile-title strong, .mon-tile-title span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mon-tile-sub { font-size: 12px; color: var(--muted); min-height: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mon-tile-body { position: relative; flex: 1; min-height: 0; }
.mon-tile-body .log { height: 100%; font-size: 11px; line-height: 1.35; }
.mon-tile-body .screen { height: 100%; aspect-ratio: auto; max-height: none; }
.mon-tile-foot { display: flex; gap: 6px; flex-wrap: wrap; }
.mon-tile .mon-tag { font-size: 11px; }


/* ---------- Runs page: Workflow > Schedule groups ---------- */
.runs-toolbar { display: flex; flex-direction: column; gap: 10px; margin-bottom: 14px; }
.runs-cnt { font-family: var(--mono); font-size: 10.5px; color: var(--muted); }
.wf-seg button.active .runs-cnt { color: var(--text); }
.runs-group { padding: 0; margin-bottom: 14px; overflow: hidden; }
.runs-head { display: flex; align-items: center; gap: 10px; padding: 10px 14px; cursor: pointer; flex-wrap: wrap; }
.runs-head-wf { background: var(--surface-2); border-bottom: 1px solid var(--border); }
.runs-head-sub { background: color-mix(in srgb, var(--surface-2) 45%, var(--surface)); border-top: 1px solid var(--border); padding-left: 28px; }
.runs-head:hover { background: color-mix(in srgb, var(--accent) 6%, var(--surface-2)); }
.runs-chev { border: 0; background: transparent; color: var(--muted); cursor: pointer; width: 20px; height: 20px; padding: 0; font-size: 12px; line-height: 1; transition: transform .12s; }
.runs-chev.open { transform: rotate(90deg); }
.runs-title { flex: 1 1 220px; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.runs-title a { color: var(--text); text-decoration: none; }
.runs-title a:hover { color: var(--accent); }
.runs-badges { display: flex; gap: 6px; align-items: center; }
.runs-gactions { display: flex; gap: 6px; }
.runs-sub { border-left: 3px solid color-mix(in srgb, var(--accent) 55%, var(--border)); margin-left: 14px; }
.runs-sub .table-wrap { padding: 0 8px 8px 14px; }
.runs-group > .table-wrap { padding: 0 8px 8px; }
#runs-batch { position: sticky; top: 58px; z-index: 15; }

/* Monitor: one tile fullscreen */
.mon-tile-head .mon-full { padding: 3px 7px; flex: 0 0 auto; }
.mon-tile:fullscreen { height: 100vh; width: 100vw; padding: 20px 24px; gap: 14px; border-radius: 0; background: var(--surface); contain: none; }
.mon-tile:fullscreen .mon-tile-title strong { font-size: 18px; }
.mon-tile:fullscreen .mon-tile-sub { font-size: 14px; }
.mon-tile:fullscreen .mon-tile-body .log { font-size: 14px; line-height: 1.5; }
.mon-tile:fullscreen .mon-tile-body .screen { border-radius: var(--radius); }

/* Profile start pages: one field per URL */
.sp-list { display: flex; flex-direction: column; gap: 6px; margin-bottom: 6px; }
.sp-row { display: flex; gap: 6px; align-items: center; }
.sp-row .sp-input { flex: 1; min-width: 0; }

/* ---------- animated gradient-border button + onboarding wizard ---------- */
@keyframes glow-slide { from { background-position: 100% 100%; } to { background-position: 0% 0%; } }
.glow-btn { position: relative; isolation: isolate; }
.glow-btn::before, .glow-btn::after {
  content: ""; position: absolute; inset: -2px; border-radius: calc(var(--radius) + 2px); z-index: -1;
  background: linear-gradient(135deg, #6d8cff 0%, #7ff0ff 25%, #a78bfa 50%, #7ff0ff 75%, #6d8cff 100%);
  background-size: 300% 300%; background-position: 100% 100%;
  animation: glow-slide 7s ease-in-out infinite alternate;
}
.glow-btn::after { filter: blur(10px); opacity: .3; }
.glow-btn:disabled::before, .glow-btn:disabled::after { animation-play-state: paused; opacity: .3; }
.wizard-launch { background: #e6e8ee; color: #000; border-color: transparent; display: inline-flex; align-items: center; gap: 8px; padding: 8px 18px; font-size: 13.5px; font-weight: 600; }
.wizard-launch:hover { background: #fff; color: #000; }
.wizard-launch .wz-spark { display: inline-block; color: #000; box-shadow: none; background: none; width: auto; height: auto; animation: wz-spark 2.4s ease-in-out infinite; }
@keyframes wz-spark { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.18); } }

dialog.wizard-dialog { max-width: min(1280px, 96vw); width: 100%; max-height: 92vh; min-height: min(600px, 92vh); margin: auto; overflow: hidden; }
dialog.wizard-dialog:focus, dialog.wizard-dialog:focus-visible { outline: none; }
dialog.wizard-dialog[open] { display: flex; flex-direction: column; animation: wzIn .22s ease-out; }
@keyframes wzIn { from { opacity: 0; transform: translateY(14px) scale(.98); } to { opacity: 1; transform: none; } }
.wz-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 20px; border-bottom: 1px solid var(--border); }
.wz-body { flex: 1; overflow-y: auto; padding: 20px; }
.wz-pane { display: none; height: 100%; }
.wz-pane.active { display: block; animation: wzIn .2s ease-out; }
.wz-pane .card { margin: 0; }
.wz-foot { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px; padding: 12px 20px; border-top: 1px solid var(--border); background: var(--surface-2); }
.wz-mid { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.wz-right { display: flex; justify-content: flex-end; align-items: center; gap: 8px; }
.wz-steps { display: flex; gap: 8px; align-items: center; }
.wz-step { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--muted); }
.wz-step .wz-dot { width: 22px; height: 22px; border-radius: 50%; border: 1px solid var(--border); display: grid; place-items: center; font-size: 11px; font-family: ui-monospace, monospace; transition: all .2s; }
.wz-step.active { color: var(--text); }
.wz-step.active .wz-dot { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.wz-step.done .wz-dot { background: var(--ok); border-color: var(--ok); color: var(--accent-ink); }
.wz-step + .wz-step::before { content: ""; width: 18px; height: 1px; background: var(--border); }

.wz-only { display: none; }
.wz-pane .wz-only { display: inline-grid; }
.wz-pane .page-only { display: none !important; }
.wz-split { display: grid; gap: 20px; align-items: stretch; min-height: 100%; }
.wz-split.two { grid-template-columns: 1fr 1fr; }
.wz-split.three { grid-template-columns: 1fr auto 1fr; gap: 14px; }
.wz-pane textarea#onb-accounts-text { min-height: 280px; }
.wz-drop { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; text-align: center; padding: 24px; cursor: pointer; border: 2px dashed var(--border); border-radius: var(--radius); background: var(--surface); transition: border-color .15s, background .15s; }
.wz-drop:hover, .wz-drop.dragover { border-color: var(--accent); background: rgba(109, 140, 255, .07); }
.wz-drop-icon { font-size: 34px; color: var(--accent); line-height: 1; }
.wz-valid { width: 26px; height: 26px; border-radius: 50%; place-items: center; font-size: 14px; font-weight: 700; border: 1px solid var(--border); color: var(--muted); transition: all .2s; }
.wz-valid.ok { background: var(--ok); border-color: var(--ok); color: var(--accent-ink); }
.wz-valid.bad { background: var(--danger); border-color: var(--danger); color: var(--accent-ink); }

.wz-opt { position: relative; overflow: hidden; border: 1.5px solid var(--border); border-radius: var(--radius); padding: 16px; min-width: 0; transition: border-color .2s, box-shadow .2s; }
.wz-opt.selected { border-color: var(--ok); box-shadow: 0 0 0 1px var(--ok), 0 0 18px rgba(62, 207, 142, .15); }
.wz-opt > div > .card { border: 0; background: transparent; padding: 0; box-shadow: none; }
.wz-opt-title { font-weight: 600; font-size: 14px; margin-bottom: 12px; }
.wz-opt .wz-hide { display: none; }
.wz-opt .dlg-head, .wz-opt #onb-batch-cancel, .wz-opt #onb-batch-submit { display: none; }
.wz-opt .dlg-body { padding: 0; }
.wz-opt .onb-profile-select { min-width: 0 !important; width: 100%; }
.wz-opt .table th, .wz-opt .table td { padding: 14px 12px; }
.wz-opt .table-wrap { overflow-x: auto; }
.wz-opt .onb-profile-select { min-width: 150px !important; }
.wz-overlay { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; backdrop-filter: blur(7px); -webkit-backdrop-filter: blur(7px); background: rgba(15, 17, 21, .45); z-index: 2; }
.wz-overlay.hidden { display: none; }
.wz-or { display: flex; flex-direction: column; align-items: center; gap: 10px; color: var(--muted); font-size: 12.5px; text-transform: uppercase; letter-spacing: .08em; }
.wz-or::before, .wz-or::after { content: ""; flex: 1; border-left: 2px dotted var(--border); }

.wz-narrow { max-width: 560px; margin: 0 auto; }
#onb-slot-3 .form-grid { grid-template-columns: 1fr; gap: 20px; }
#onb-slot-3 input[type="text"], #onb-slot-3 input[type="number"] { padding: 12px 14px; font-size: 14.5px; width: 100%; }
#onb-slot-3 .field label { font-size: 13px; }
#onb-slot-3 .field[style] { justify-content: flex-start !important; }
#onb-slot-3 .field label.row { margin-top: 0 !important; }
.wz-pane #onb-apply-row { display: none; }
#onb-wz-actions #onb-apply-row { display: flex; margin: 0 !important; }
@media (max-width: 820px) {
  .wz-split.two, .wz-split.three { grid-template-columns: 1fr; }
  .wz-or { flex-direction: row; }
  .wz-or::before, .wz-or::after { border-left: 0; border-top: 2px dotted var(--border); }
  .wz-foot { grid-template-columns: 1fr; justify-items: center; }
}
@media (prefers-reduced-motion: reduce) {
  .glow-btn::before, .glow-btn::after, .wizard-launch .wz-spark, dialog.wizard-dialog[open], .wz-pane.active { animation: none !important; }
}

/* ---------- "Update available" button (admin top bar) ---------- */
@property --upd-angle { syntax: "<angle>"; inherits: false; initial-value: 0deg; }
@keyframes upd-spin { to { --upd-angle: 360deg; } }
.update-btn {
  --upd: #ff7a59;
  position: relative; display: inline-flex; align-items: center; gap: 7px; cursor: pointer;
  background: rgba(255, 122, 89, .08); color: var(--upd); font: inherit; font-size: 12.5px; font-weight: 600;
  border: 1px solid rgba(255, 122, 89, .35); border-radius: 999px; padding: 5px 12px;
}
.update-btn:hover { background: rgba(255, 122, 89, .16); }
.update-btn::before {  /* very slow rotating highlight on the border */
  content: ""; position: absolute; inset: -1px; border-radius: inherit; padding: 1.5px; pointer-events: none;
  background: conic-gradient(from var(--upd-angle), transparent 0 60%, var(--upd) 85%, transparent 100%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
  animation: upd-spin 14s linear infinite;
}
.update-btn .update-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--upd); }
.update-btn.busy { opacity: .75; pointer-events: none; }
@media (prefers-reduced-motion: reduce) { .update-btn::before { animation: none; } }
