.field-hint {
  margin: 6px 0 0;
  color: var(--text-muted);
  font-size: 12px;
}

/* =============================================================
   AlgoPanel — Design System
   Deep Space dark theme + glassmorphism, per the product SRS.
   ============================================================= */

:root {
  --bg: #0F172A;
  --card: #1E293B;
  --card-glass: rgba(30, 41, 59, 0.6);
  --border-glass: rgba(255, 255, 255, 0.08);
  --border-glass-strong: rgba(255, 255, 255, 0.14);

  --violet: #8B5CF6;
  --violet-dark: #6D28D9;
  --violet-light: #A78BFA;
  --emerald: #10B981;
  --crimson: #EF4444;
  --blue: #3B82F6;
  --amber: #F59E0B;

  --text-primary: #F1F5F9;
  --text-secondary: #94A3B8;
  --text-muted: #64748B;

  --font-display: 'Plus Jakarta Sans', 'Inter', 'Segoe UI', system-ui, sans-serif;
  --font-body: 'Inter', 'Segoe UI', system-ui, sans-serif;

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --titlebar-height: 40px;
}

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

html, body { height: 100%; }

body {
  display: flex;
  flex-direction: column;
  background: var(--bg);
  background-image:
    radial-gradient(circle at 20% 10%, rgba(139, 92, 246, 0.08), transparent 40%),
    radial-gradient(circle at 80% 90%, rgba(16, 185, 129, 0.06), transparent 40%);
  color: var(--text-primary);
  font-family: var(--font-body);
  user-select: none;
  position: relative;
}

input, textarea { user-select: text; }

h1, h2, h3, h4 { font-family: var(--font-display); }

button { font-family: inherit; }

.brand-corner {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  color: var(--text-primary);
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 0.01em;
  position: fixed;
  top: 0;
  left: 0;
  z-index: 10;
}

.brand-corner svg { width: 24px; height: 24px; flex: 0 0 auto; }

/* Scrollbars */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(139, 92, 246, 0.35); border-radius: 999px; }
::-webkit-scrollbar-thumb:hover { background: rgba(139, 92, 246, 0.55); }

/* =============================================================
   Ambient background orbs
   ============================================================= */

.bg-orb {
  position: fixed;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.35;
  pointer-events: none;
  z-index: 0;
  animation: float-blob 18s ease-in-out infinite;
}
.bg-orb-1 { width: 420px; height: 420px; background: var(--violet); top: -120px; left: -100px; }
.bg-orb-2 { width: 380px; height: 380px; background: var(--emerald); bottom: -140px; right: -100px; animation-delay: -9s; }

@keyframes float-blob {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(30px, -20px) scale(1.08); }
}

/* =============================================================
   Titlebar (frameless window)
   ============================================================= */

.titlebar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--titlebar-height);
  flex-shrink: 0;
  background: rgba(15, 23, 42, 0.95);
  border-bottom: 1px solid var(--border-glass);
  -webkit-app-region: drag;
  padding-left: 14px;
  position: relative;
  z-index: 10;
}
.titlebar-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.02em;
}
.titlebar-controls { display: flex; height: 100%; -webkit-app-region: no-drag; }
.tb-btn {
  width: 46px; height: 100%;
  display: flex; align-items: center; justify-content: center;
  background: transparent; border: none; color: var(--text-secondary);
  cursor: pointer; transition: background 0.15s ease, color 0.15s ease;
}
.tb-btn svg { width: 14px; height: 14px; }
.tb-btn:hover { background: rgba(255, 255, 255, 0.06); color: var(--text-primary); }
.tb-close:hover { background: var(--crimson); color: #fff; }

/* =============================================================
   Glass panel base
   ============================================================= */

.glass-panel {
  background: var(--card-glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  position: relative;
  z-index: 1;
}

/* =============================================================
   Buttons
   ============================================================= */

.btn {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 14px;
  padding: 11px 20px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: transform 0.12s ease, box-shadow 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }

.btn-primary {
  background: linear-gradient(135deg, var(--violet), var(--violet-dark));
  color: #fff;
  box-shadow: 0 8px 24px -8px rgba(139, 92, 246, 0.6);
}
.btn-primary:hover:not(:disabled) { box-shadow: 0 10px 30px -6px rgba(139, 92, 246, 0.75); }

.btn-ghost {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-secondary);
  border-color: var(--border-glass);
}
.btn-ghost:hover:not(:disabled) { background: rgba(255, 255, 255, 0.08); color: var(--text-primary); }

.btn-danger {
  background: linear-gradient(135deg, var(--crimson), #B91C1C);
  color: #fff;
  box-shadow: 0 8px 24px -8px rgba(239, 68, 68, 0.55);
}

.btn-block { width: 100%; }
.btn svg { width: 16px; height: 16px; }

.icon-btn {
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 10px;
  border: 1px solid var(--border-glass);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s ease;
}
.icon-btn svg { width: 16px; height: 16px; }
.icon-btn:hover:not(:disabled) { background: rgba(139, 92, 246, 0.15); border-color: rgba(139, 92, 246, 0.4); color: var(--violet-light); }
.icon-btn-danger:hover:not(:disabled) { background: rgba(239, 68, 68, 0.15); border-color: rgba(239, 68, 68, 0.4); color: #FCA5A5; }
.icon-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* =============================================================
   Form fields
   ============================================================= */

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.field label { font-size: 12px; font-weight: 600; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.05em; }
.field input {
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 14px;
  outline: none;
  width: 100%;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.field input:focus { border-color: var(--violet); box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.18); }
.field input::placeholder { color: var(--text-muted); }

.field-row { display: flex; gap: 14px; }
.field-row .field { flex: 1; }

.password-wrap { position: relative; display: flex; align-items: center; }
.password-wrap input { padding-right: 42px; }
.pw-toggle {
  position: absolute; right: 10px; background: none; border: none; cursor: pointer;
  color: var(--text-muted); display: flex; padding: 4px;
}
.pw-toggle svg { width: 18px; height: 18px; }
.pw-toggle:hover { color: var(--text-secondary); }
.pw-toggle .eye-off { display: none; }
.pw-toggle-active .eye { display: none; }
.pw-toggle-active .eye-off { display: block; }

.checkbox-row { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-secondary); margin: 4px 0 20px; cursor: pointer; }
.checkbox-row input { accent-color: var(--violet); width: 14px; height: 14px; }

/* =============================================================
   Login screen
   ============================================================= */

.login-screen {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  z-index: 1;
  overflow-y: auto;
  padding: 32px;
}
.login-card { width: 400px; max-width: 100%; padding: 40px 36px; }
.login-brand { text-align: center; margin-bottom: 28px; }
.login-brand .logo-mark { margin: 0 auto 14px; width: 48px; height: 48px; }
.login-brand h1 {
  font-size: 32px; font-weight: 800;
  background: linear-gradient(135deg, #fff, var(--violet-light));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.login-subtitle { color: var(--text-secondary); font-size: 13px; margin-top: 4px; }
.login-hint { text-align: center; font-size: 12px; color: var(--text-muted); margin-top: 18px; line-height: 1.5; }

.spinner {
  width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.35); border-top-color: #fff;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* =============================================================
   Text link button (e.g. "Run setup from AlgoPanel" on login)
   ============================================================= */

.text-link-btn {
  display: block;
  width: 100%;
  text-align: center;
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 12.5px;
  font-family: var(--font-body);
  cursor: pointer;
  margin-top: 14px;
  padding: 4px;
  transition: color 0.15s ease;
}
.text-link-btn:hover { color: var(--violet-light); text-decoration: underline; }

/* =============================================================
   Code block (setup command reference, with copy button)
   ============================================================= */

.code-block {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: rgba(2, 6, 23, 0.55);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  margin-bottom: 12px;
}
.code-block code {
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
  font-size: 12px;
  color: var(--emerald);
  user-select: text;
  overflow-x: auto;
  white-space: nowrap;
}
.code-block .copy-btn { flex-shrink: 0; width: 30px; height: 30px; }
.code-block .copy-btn svg { width: 14px; height: 14px; }

.setup-success { color: var(--emerald); font-weight: 600; }

/* =============================================================
   Server Admin Tools modal (setup + create user)
   ============================================================= */

.modal-lg { width: 560px; }
.admin-modal-intro { font-size: 13.5px; color: var(--text-secondary); line-height: 1.5; margin-bottom: 20px; }

.seg-control {
  display: flex;
  gap: 4px;
  padding: 4px;
  margin-bottom: 20px;
  background: rgba(2, 6, 23, 0.4);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-sm);
}
.seg-btn {
  flex: 1;
  padding: 9px 10px;
  border: none;
  border-radius: calc(var(--radius-sm) - 3px);
  background: transparent;
  color: var(--text-secondary);
  font-family: var(--font-body);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.seg-btn:hover { color: var(--text-primary); }
.seg-btn.is-active {
  background: linear-gradient(135deg, var(--violet), var(--violet-dark));
  color: #fff;
}

.admin-log {
  max-height: 180px;
  overflow-y: auto;
  background: rgba(2, 6, 23, 0.55);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  margin-bottom: 20px;
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
  font-size: 11.5px;
  line-height: 1.6;
}
.admin-log-line { color: var(--text-secondary); white-space: pre-wrap; word-break: break-word; }
.admin-log-line + .admin-log-line { margin-top: 2px; }

/* =============================================================
   App shell / dashboard
   ============================================================= */

.app-shell { flex: 1; display: flex; min-height: 0; position: relative; z-index: 1; }
.sidebar { width: 224px; flex: 0 0 224px; display: flex; flex-direction: column; padding: 64px 14px 28px; border-right: 1px solid var(--border-glass); background: rgba(15, 23, 42, 0.5); }
.sidebar-label { padding: 0 12px 12px; color: var(--text-muted); font-size: 11px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; }
.sidebar-nav { display: flex; flex-direction: column; gap: 4px; }
.sidebar-spacer { flex: 1; min-height: 24px; }
.nav-item { display: flex; align-items: center; gap: 10px; width: 100%; border: 0; border-radius: var(--radius-sm); padding: 10px 12px; background: transparent; color: var(--text-secondary); font: 600 13px var(--font-display); text-align: left; cursor: pointer; transition: background 0.15s ease, color 0.15s ease; }
.nav-item svg { width: 17px; height: 17px; flex: 0 0 17px; }
.nav-item:hover { background: rgba(255, 255, 255, 0.05); color: var(--text-primary); }
.nav-item.is-active { background: rgba(139, 92, 246, 0.16); color: var(--violet-light); }
.app-main { flex: 1; min-width: 0; overflow-y: auto; padding: 28px 32px 48px; }
.app-view[hidden] { display: none; }
.info-view { max-width: 720px; padding-top: 28px; }
.view-heading { margin-bottom: 28px; }
.view-eyebrow { margin-bottom: 8px; color: var(--violet-light); font-size: 12px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; }
.view-heading h2 { margin-bottom: 12px; font-size: 26px; }
.view-heading p:last-child { max-width: 560px; color: var(--text-secondary); font-size: 14px; line-height: 1.6; }
.builder-create-btn { margin-top: 18px; }
.builder-create-form { margin-bottom: 16px; padding: 18px; border: 1px solid var(--border-glass); border-radius: var(--radius-sm); background: rgba(30, 41, 59, 0.42); }
.builder-create-form label { display: block; margin-bottom: 8px; color: var(--text-secondary); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; }
.builder-create-controls { display: flex; align-items: center; gap: 10px; }
.builder-create-controls input { flex: 1; min-width: 0; padding: 11px 12px; border: 1px solid var(--border-glass); border-radius: var(--radius-sm); outline: none; background: rgba(15, 23, 42, 0.6); color: var(--text-primary); font: 14px var(--font-body); }
.builder-create-controls input:focus { border-color: var(--violet); box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.18); }
.builder-site-list { display: grid; gap: 12px; }
.builder-site-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 18px; border: 1px solid var(--border-glass); border-radius: var(--radius-sm); background: rgba(30, 41, 59, 0.42); }
.builder-site-row h3 { margin-bottom: 4px; font-size: 16px; }
.builder-site-row p, .builder-empty { color: var(--text-secondary); font-size: 13px; }
.builder-empty { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 18px; border: 1px solid var(--border-glass); border-radius: var(--radius-sm); background: rgba(30, 41, 59, 0.42); }
.help-guide-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.contact-actions { display: flex; flex-wrap: wrap; gap: 12px; }
.help-contact { margin-top: 24px; padding: 22px; border: 1px solid var(--border-glass); border-radius: var(--radius-sm); background: rgba(30, 41, 59, 0.42); }
.help-contact h3 { margin-bottom: 8px; font-size: 16px; }
.help-contact p { margin-bottom: 16px; color: var(--text-secondary); font-size: 13px; }
.contact-btn { text-decoration: none; padding: 12px 20px; }
.contact-btn svg { width: 19px; height: 19px; flex-shrink: 0; }
.contact-whatsapp { background: #25D366; color: #062512; font-weight: 700; }
.contact-whatsapp:hover { background: #1FBE5A; }
.contact-email { background: rgba(255, 255, 255, 0.05); border-color: var(--border-glass-strong); color: var(--text-primary); }
.contact-email:hover { background: rgba(139, 92, 246, 0.16); border-color: rgba(139, 92, 246, 0.45); color: var(--violet-light); }
.help-guide { position: relative; padding: 22px; border: 1px solid var(--border-glass); border-radius: var(--radius-sm); background: rgba(30, 41, 59, 0.42); }
.help-guide-wide { grid-column: 1 / -1; }
.help-guide-number { margin-bottom: 12px; color: var(--violet-light); font: 700 12px var(--font-display); letter-spacing: 0.08em; }
.help-guide h3 { margin-bottom: 14px; font-size: 16px; }
.help-guide ol, .help-guide ul { display: grid; gap: 10px; padding-left: 20px; color: var(--text-secondary); font-size: 13px; line-height: 1.55; }
.help-guide strong { color: var(--text-primary); font-weight: 600; }
.help-note { margin-top: 16px; padding: 10px 12px; border-left: 2px solid var(--amber); background: rgba(245, 158, 11, 0.07); color: var(--text-secondary); font-size: 12px; line-height: 1.5; }

.app-header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 30px; }
.header-left h2 { font-size: 22px; font-weight: 700; margin-bottom: 8px; }
.server-chip { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--text-secondary); }
.chip-sep { color: var(--text-muted); }
.dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.dot-live { background: var(--emerald); box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.2); }

.header-right { display: flex; align-items: center; gap: 14px; }
.port-range-chip {
  font-size: 12.5px; color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.04); border: 1px solid var(--border-glass);
  padding: 9px 16px; border-radius: 999px; white-space: nowrap;
}

/* Metrics */
.metrics-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; margin-bottom: 36px; }
.metric-card { padding: 26px; display: flex; flex-direction: column; align-items: center; gap: 14px; }
.gauge-wrap { position: relative; width: 120px; height: 120px; }
.gauge-ring { width: 120px; height: 120px; transform: rotate(-90deg); }
.gauge-track { fill: none; stroke: rgba(255, 255, 255, 0.06); stroke-width: 9; }
.gauge-fill {
  fill: none; stroke: var(--blue); stroke-width: 9; stroke-linecap: round;
  stroke-dasharray: 326.7; stroke-dashoffset: 326.7;
  transition: stroke 0.45s ease;
}
.gauge-center { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; }
.gauge-value { font-family: var(--font-display); font-size: 22px; font-weight: 700; }
.metric-label { font-size: 12px; letter-spacing: 0.08em; color: var(--text-secondary); text-transform: uppercase; font-weight: 600; }
.metric-sub { font-size: 11.5px; color: var(--text-muted); margin-top: -8px; text-align: center; }

.vps-summary {
  padding: 20px 22px; margin-bottom: 30px;
}

.section-heading { margin-bottom: 14px; display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.section-heading h3 { font-size: 17px; font-weight: 700; }
.btn-boost { padding: 9px 14px; font-size: 12.5px; }
.vps-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}
.detail-item {
  display: flex; flex-direction: column; gap: 6px;
  background: rgba(255, 255, 255, 0.02); border: 1px solid var(--border-glass); border-radius: var(--radius-sm);
  padding: 12px 14px;
}
.detail-item span {
  color: var(--text-secondary); font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase;
}
.detail-item strong {
  color: var(--text-primary); font-size: 13.5px; line-height: 1.5; word-break: break-word;
}

/* Projects */
.projects-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; gap: 12px; flex-wrap: wrap; }
.projects-header h3 { font-size: 17px; font-weight: 700; }
.projects-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 18px; }

.project-card { padding: 20px; display: flex; flex-direction: column; gap: 14px; transition: border-color 0.2s ease, transform 0.15s ease; }
.project-card:hover { border-color: var(--border-glass-strong); transform: translateY(-2px); }
.project-card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.project-name { font-weight: 600; font-size: 15px; word-break: break-word; }
.project-meta { font-size: 12.5px; color: var(--text-secondary); }
.project-domain { font-size: 12.5px; color: var(--text-muted); overflow-wrap: anywhere; }
.project-domain a { color: var(--violet-light); text-decoration: none; }
.project-domain a:hover { text-decoration: underline; }
.project-actions { display: flex; gap: 8px; }
.project-error { color: #FCA5A5; font-size: 12px; line-height: 1.4; overflow-wrap: anywhere; }
.domain-instruction { border: 1px solid var(--border-glass); border-radius: var(--radius-sm); color: var(--text-secondary); font-size: 12.5px; line-height: 1.5; margin-bottom: 16px; padding: 10px 12px; overflow-wrap: anywhere; }
.dns-instruction-row { display: grid; grid-template-columns: 58px minmax(0, 1fr) auto; align-items: center; gap: 8px; padding: 5px 0; }
.dns-instruction-row span { color: var(--text-muted); }
.dns-instruction-row strong { color: var(--text-primary); overflow-wrap: anywhere; }
.dns-copy-btn { width: auto; min-width: 44px; height: 28px; padding: 0 8px; font-size: 11px; }

.status-badge { display: flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 600; padding: 4px 10px; border-radius: 999px; white-space: nowrap; flex-shrink: 0; }
.status-dot { width: 6px; height: 6px; border-radius: 50%; position: relative; }
.status-dot::after { content: ''; position: absolute; inset: -4px; border-radius: 50%; opacity: 0.55; animation: pulse-ring 1.8s cubic-bezier(0,0,0.2,1) infinite; }

.status-running { background: rgba(16, 185, 129, 0.12); color: var(--emerald); }
.status-running .status-dot { background: var(--emerald); }
.status-running .status-dot::after { background: var(--emerald); }

.status-stopped { background: rgba(148, 163, 184, 0.12); color: var(--text-secondary); }
.status-stopped .status-dot { background: var(--text-muted); }
.status-stopped .status-dot::after { display: none; }

.status-pending { background: rgba(245, 158, 11, 0.12); color: var(--amber); }
.status-pending .status-dot { background: var(--amber); }
.status-pending .status-dot::after { background: var(--amber); }

.status-error { background: rgba(239, 68, 68, 0.12); color: var(--crimson); }
.status-error .status-dot { background: var(--crimson); }
.status-error .status-dot::after { background: var(--crimson); }

@keyframes pulse-ring {
  0% { transform: scale(0.6); opacity: 0.55; }
  100% { transform: scale(1.8); opacity: 0; }
}

.empty-state { text-align: center; padding: 60px 20px; color: var(--text-secondary); }
.empty-icon { width: 56px; height: 56px; margin: 0 auto 16px; opacity: 0.5; }
.empty-state p { margin-bottom: 18px; font-size: 14px; }

/* =============================================================
   Modals
   ============================================================= */

.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(2, 6, 23, 0.6);
  backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  z-index: 50;
  animation: fade-in 0.15s ease;
  padding: 20px;
}
.modal-backdrop[hidden] { display: none; }

.modal { width: 460px; max-width: 100%; max-height: calc(100vh - 100px); overflow-y: auto; padding: 28px; }
.modal-sm { width: 380px; }
.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.modal-header h3 { font-size: 17px; font-weight: 700; }
.modal h3 { font-size: 16px; font-weight: 700; margin-bottom: 10px; }
.modal p { font-size: 13.5px; color: var(--text-secondary); line-height: 1.5; margin-bottom: 20px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 4px; }
.setup-note { color: var(--amber) !important; }

@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

/* Dropzone */
.dropzone {
  border: 2px dashed var(--border-glass-strong);
  border-radius: var(--radius-md);
  padding: 32px 20px;
  text-align: center;
  cursor: pointer;
  margin-bottom: 20px;
  transition: border-color 0.2s ease, background 0.2s ease;
  background: rgba(255, 255, 255, 0.015);
}
.dropzone:hover { border-color: rgba(139, 92, 246, 0.45); background: rgba(139, 92, 246, 0.04); }
.dropzone-active { border-color: var(--violet); background: rgba(139, 92, 246, 0.08); animation: dash-pulse 1s ease infinite; }
.dropzone-icon { width: 34px; height: 34px; margin: 0 auto 10px; color: var(--violet-light); }
.dropzone-title { font-size: 13.5px; font-weight: 600; margin-bottom: 4px; word-break: break-word; }
.dropzone-sub { font-size: 12px; color: var(--text-muted); }

@keyframes dash-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(139, 92, 246, 0.25); }
  50% { box-shadow: 0 0 0 8px rgba(139, 92, 246, 0); }
}

.deploy-progress { margin: 4px 0 20px; }
.deploy-progress-bar { height: 6px; border-radius: 999px; background: rgba(255, 255, 255, 0.06); overflow: hidden; margin-bottom: 8px; }
.deploy-progress-fill { height: 100%; width: 0%; background: linear-gradient(90deg, var(--violet), var(--emerald)); transition: width 0.3s ease; }
.deploy-progress p { font-size: 12px; color: var(--text-secondary); margin: 0; }

/* =============================================================
   Deploy wizard
   ============================================================= */

.modal-wizard { width: 640px; }

.wizard-steps { display: flex; align-items: center; margin-bottom: 24px; }
.wizard-step { display: flex; align-items: center; gap: 8px; }
.wizard-step-num {
  width: 26px; height: 26px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-size: 12px; font-weight: 700;
  background: rgba(255, 255, 255, 0.05); border: 1px solid var(--border-glass);
  color: var(--text-muted);
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}
.wizard-step-label { font-size: 12px; color: var(--text-muted); font-weight: 600; white-space: nowrap; transition: color 0.2s ease; }
.wizard-step-line { flex: 1; height: 1px; background: var(--border-glass); margin: 0 10px; min-width: 10px; }
.wizard-step.is-active .wizard-step-num { background: linear-gradient(135deg, var(--violet), var(--violet-dark)); border-color: transparent; color: #fff; }
.wizard-step.is-active .wizard-step-label { color: var(--text-primary); }
.wizard-step.is-done .wizard-step-num { background: rgba(16, 185, 129, 0.15); border-color: transparent; color: var(--emerald); }
.wizard-step.is-done .wizard-step-label { color: var(--text-secondary); }

.wizard-intro { font-size: 14px; font-weight: 600; color: var(--text-primary); margin-bottom: 14px; }
.wizard-subtle { font-size: 12.5px; color: var(--text-muted); margin-top: 4px; }
.wizard-panel { animation: fade-in 0.15s ease; }

/* Category picker (Step 1) */
.category-grid {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px;
  max-height: 360px; overflow-y: auto; padding-right: 4px; margin-bottom: 4px;
}
.category-tile {
  display: flex; align-items: flex-start; gap: 12px; text-align: left;
  padding: 14px; border-radius: var(--radius-md);
  border: 1px solid var(--border-glass); background: rgba(255, 255, 255, 0.02);
  cursor: pointer; font-family: var(--font-body); color: inherit;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.1s ease;
}
.category-tile:hover { border-color: var(--border-glass-strong); background: rgba(255, 255, 255, 0.045); }
.category-tile:active { transform: scale(0.985); }
.category-tile.is-selected { border-color: var(--violet); background: rgba(139, 92, 246, 0.1); box-shadow: 0 0 0 1px rgba(139, 92, 246, 0.35); }
.category-tile-icon {
  width: 34px; height: 34px; flex-shrink: 0; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(139, 92, 246, 0.12); color: var(--violet-light);
}
.category-tile-icon svg { width: 18px; height: 18px; }
.category-tile-body { flex: 1; min-width: 0; }
.category-tile-name { font-size: 13px; font-weight: 700; color: var(--text-primary); margin-bottom: 3px; }
.category-tile-tagline { font-size: 11.5px; color: var(--text-muted); line-height: 1.4; }
.category-tile-flag { display: inline-flex; align-items: center; gap: 4px; font-size: 10.5px; font-weight: 600; margin-top: 6px; }
.category-tile-flag svg { width: 11px; height: 11px; }
.category-tile-flag.is-ok { color: var(--emerald); }
.category-tile-flag.is-warn { color: var(--amber); }

.category-tile-auto {
  grid-column: 1 / -1; align-items: center;
  border-style: dashed; border-color: rgba(139, 92, 246, 0.4); background: rgba(139, 92, 246, 0.05);
}
.category-tile-auto .category-tile-icon { background: linear-gradient(135deg, var(--violet), var(--violet-dark)); color: #fff; }
.category-tile-auto.is-selected { background: rgba(139, 92, 246, 0.14); }

/* Review step (Step 3) */
.detect-summary {
  display: flex; align-items: flex-start; gap: 12px; padding: 14px; margin-bottom: 16px;
  border-radius: var(--radius-md); border: 1px solid var(--border-glass); background: rgba(255, 255, 255, 0.02);
}
.detect-summary-icon {
  width: 34px; height: 34px; border-radius: 10px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: rgba(16, 185, 129, 0.14); color: var(--emerald);
}
.detect-summary-icon svg { width: 18px; height: 18px; }
.detect-summary-icon.is-unsure { background: rgba(245, 158, 11, 0.14); color: var(--amber); }
.detect-summary-body { flex: 1; min-width: 0; }
.detect-summary-title { font-size: 13.5px; font-weight: 700; margin-bottom: 3px; }
.detect-summary-text { font-size: 12.5px; color: var(--text-secondary); line-height: 1.5; }
.detect-summary-link { background: none; border: none; padding: 0; margin-top: 8px; font-size: 12px; color: var(--violet-light); cursor: pointer; font-family: var(--font-body); display: block; }
.detect-summary-link:hover { text-decoration: underline; }

.requirement-notice {
  display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; margin-bottom: 16px;
  border-radius: var(--radius-sm); background: rgba(245, 158, 11, 0.08); border: 1px solid rgba(245, 158, 11, 0.25);
  font-size: 12.5px; color: var(--text-secondary); line-height: 1.5;
}
.requirement-notice svg { width: 16px; height: 16px; flex-shrink: 0; color: var(--amber); margin-top: 1px; }
.requirement-notice strong { color: var(--text-primary); }
.requirement-notice .btn { margin-top: 10px; }

.candidate-options { display: flex; flex-direction: column; gap: 8px; }
.candidate-option {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: var(--radius-sm);
  border: 1px solid var(--border-glass); background: rgba(255, 255, 255, 0.02); cursor: pointer; font-size: 13px;
}
.candidate-option input { accent-color: var(--violet); }
.candidate-option.is-selected { border-color: var(--violet); background: rgba(139, 92, 246, 0.08); }

/* Deploy progress checklist (Step 4) */
.deploy-checklist { display: flex; flex-direction: column; gap: 10px; margin-bottom: 18px; }
.checklist-item { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--text-muted); transition: color 0.2s ease; }
.checklist-item-icon {
  width: 22px; height: 22px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--border-glass); background: rgba(255, 255, 255, 0.02);
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}
.checklist-item-icon svg { width: 11px; height: 11px; }
.checklist-item-icon .spinner { width: 12px; height: 12px; border-width: 2px; border-color: rgba(139, 92, 246, 0.3); border-top-color: var(--violet-light); }
.checklist-item.is-active { color: var(--text-primary); }
.checklist-item.is-active .checklist-item-icon { border-color: var(--violet); background: rgba(139, 92, 246, 0.15); color: var(--violet-light); }
.checklist-item.is-done { color: var(--text-secondary); }
.checklist-item.is-done .checklist-item-icon { border-color: transparent; background: var(--emerald); color: #fff; }
.checklist-item.is-error .checklist-item-icon { border-color: transparent; background: var(--crimson); color: #fff; }

.deploy-result { text-align: center; padding: 16px 10px 6px; }
.deploy-result-icon {
  width: 52px; height: 52px; margin: 0 auto 14px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: rgba(16, 185, 129, 0.14); color: var(--emerald);
}
.deploy-result-icon svg { width: 26px; height: 26px; }
.deploy-result-icon.is-error { background: rgba(239, 68, 68, 0.14); color: var(--crimson); }
.deploy-result-title { font-size: 15px; font-weight: 700; margin-bottom: 6px; }
.deploy-result-text { font-size: 13px; color: var(--text-secondary); line-height: 1.5; }
.deploy-result-url { display: inline-block; margin-top: 10px; font-size: 13px; color: var(--violet-light); word-break: break-all; }

.category-badge {
  display: inline-flex; align-items: center; gap: 5px; font-size: 10.5px; font-weight: 600; color: var(--text-muted);
  background: rgba(255, 255, 255, 0.04); border: 1px solid var(--border-glass); padding: 3px 9px; border-radius: 999px; white-space: nowrap;
}

/* =============================================================
   Toasts
   ============================================================= */

.toast-container { position: fixed; top: 52px; right: 20px; display: flex; flex-direction: column; gap: 10px; z-index: 100; }
.toast {
  display: flex; align-items: center; gap: 10px;
  background: rgba(30, 41, 59, 0.92);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border-glass-strong);
  border-left: 3px solid var(--emerald);
  border-radius: 10px;
  padding: 12px 16px;
  font-size: 13px;
  min-width: 260px;
  max-width: 360px;
  box-shadow: 0 12px 30px -10px rgba(0, 0, 0, 0.5);
  opacity: 0; transform: translateX(20px);
  transition: opacity 0.25s ease, transform 0.25s ease;
}
.toast-show { opacity: 1; transform: translateX(0); }
.toast-error { border-left-color: var(--crimson); }
.toast-icon { width: 16px; height: 16px; flex-shrink: 0; }
.toast-success .toast-icon { color: var(--emerald); }
.toast-error .toast-icon { color: var(--crimson); }
.toast-msg { color: var(--text-primary); line-height: 1.4; }

/* =============================================================
   Responsive
   ============================================================= */

@media (max-width: 780px) {
  .sidebar { width: 60px; flex-basis: 60px; padding: 64px 8px 20px; }
  .sidebar-label, .nav-item span { display: none; }
  .nav-item { justify-content: center; padding: 11px; }
  .app-main { padding: 22px 18px 36px; }
  .builder-create-controls, .builder-empty { align-items: stretch; flex-direction: column; }
  .builder-site-row { align-items: flex-start; flex-direction: column; }
  .help-guide-grid { grid-template-columns: 1fr; }
  .help-guide-wide { grid-column: auto; }
  .metrics-grid { grid-template-columns: 1fr; }
  .app-header { flex-direction: column; gap: 16px; }
}

/* =============================================================
   Network note (e.g. VPN/WireGuard reminder on the login screen)
   ============================================================= */

.network-note {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 12px;
  color: var(--text-secondary);
  background: rgba(59, 130, 246, 0.08);
  border: 1px solid rgba(59, 130, 246, 0.22);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  margin: 16px 0 0;
  line-height: 1.5;
  text-align: left;
}
.network-note svg { width: 15px; height: 15px; flex-shrink: 0; color: var(--blue); margin-top: 1px; }
.network-note strong { color: var(--text-primary); }

/* =============================================================
   Footer / branding
   ============================================================= */

.app-footer {
  flex-shrink: 0;
  padding: 10px 24px;
  text-align: center;
  font-size: 11px;
  line-height: 1.6;
  color: var(--text-muted);
  border-top: 1px solid var(--border-glass);
  background: rgba(15, 23, 42, 0.7);
  position: relative;
  z-index: 1;
}
.app-footer strong { color: var(--text-secondary); font-weight: 600; }
.app-footer a { color: var(--text-secondary); text-decoration: none; cursor: pointer; }
.app-footer a:hover { color: var(--violet-light); text-decoration: underline; }
.app-footer .footer-sep { margin: 0 6px; color: var(--border-glass-strong); }
