/* ======================== RESET & BASE ======================== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:         #0d1117;
  --surface:    #161b22;
  --surface2:   #1c2128;
  --border:     #30363d;
  --border2:    #21262d;
  --text:       #e6edf3;
  --text-muted: #8b949e;
  --blue:       #58a6ff;
  --blue-dim:   #1f6feb;
  --green:      #3fb950;
  --red:        #f85149;
  --yellow:     #d29922;
  --purple:     #bc8cff;
  --radius:     8px;
  --radius-lg:  12px;
}

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

/* ======================== UTILS ======================== */
.hidden { display: none !important; }

/* ======================== SCREENS ======================== */
.screen { min-height: 100vh; }

/* ======================== LOGIN ======================== */
#login-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.login-card {
  width: 100%;
  max-width: 400px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 36px 32px;
}

.login-header {
  text-align: center;
  margin-bottom: 32px;
}
.login-header svg { margin-bottom: 12px; }
.login-header h1 { font-size: 22px; font-weight: 700; margin-bottom: 6px; }
.login-header p  { color: var(--text-muted); font-size: 13px; }
.login-header strong { color: var(--blue); }

.form-group { margin-bottom: 16px; }
.form-group label {
  display: block;
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 6px;
  font-weight: 500;
}

input[type="email"],
input[type="text"],
input[type="search"] {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  padding: 10px 12px;
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s;
}
input:focus { border-color: var(--blue); }
input::placeholder { color: var(--text-muted); }

/* OTP inputs */
.otp-hint {
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
  margin-bottom: 20px;
  line-height: 1.6;
}
.otp-hint strong { color: var(--text); }

.otp-row {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-bottom: 20px;
}
.otp-digit {
  width: 48px !important;
  height: 54px;
  text-align: center;
  font-size: 24px;
  font-weight: 700;
  font-family: monospace;
  border-radius: var(--radius);
  caret-color: var(--blue);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  text-decoration: none;
  white-space: nowrap;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-full { width: 100%; }
.btn-sm { padding: 5px 12px; font-size: 12px; }

.btn-primary {
  background: var(--blue-dim);
  color: #fff;
  border-color: var(--blue-dim);
}
.btn-primary:hover:not(:disabled) { background: #388bfd; border-color: #388bfd; }

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border-color: var(--border);
}
.btn-ghost:hover:not(:disabled) { background: var(--surface2); color: var(--text); }

.btn-danger {
  background: transparent;
  color: var(--red);
  border-color: var(--red);
}
.btn-danger:hover:not(:disabled) { background: rgba(248,81,73,0.1); }

.btn-success {
  background: transparent;
  color: var(--green);
  border-color: var(--green);
}
.btn-success:hover:not(:disabled) { background: rgba(63,185,80,0.1); }

.btn-purple {
  background: transparent;
  color: var(--purple);
  border-color: var(--purple);
}
.btn-purple:hover:not(:disabled) { background: rgba(188,140,255,0.1); }

.btn-warning {
  background: transparent;
  color: var(--yellow);
  border-color: var(--yellow);
}
.btn-warning:hover:not(:disabled) { background: rgba(210,153,34,0.1); }

#resend-btn { margin-top: 8px; }

.error-msg {
  color: var(--red);
  font-size: 12px;
  margin-top: 10px;
  padding: 8px 12px;
  background: rgba(248,81,73,0.1);
  border: 1px solid rgba(248,81,73,0.3);
  border-radius: var(--radius);
}

/* Spinner */
.btn-spinner {
  width: 14px; height: 14px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ======================== DASHBOARD HEADER ======================== */
.dash-header {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  height: 56px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.dash-header-left {
  display: flex;
  align-items: center;
  gap: 10px;
}
.dash-title { font-weight: 700; font-size: 16px; }

.dash-header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}
.user-email { color: var(--text-muted); font-size: 12px; }

/* ======================== DASHBOARD BODY ======================== */
.dash-body { padding: 24px; max-width: 1400px; margin: 0 auto; }

.stats-bar {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.stat-pill {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 18px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.stat-label { color: var(--text-muted); font-size: 12px; }
.stat-value { font-weight: 700; font-size: 18px; }
.stat-value.danger { color: var(--red); }

.search-bar { margin-bottom: 20px; }
.search-bar input {
  max-width: 360px;
  background: var(--surface);
}

/* ======================== SERVER SECTIONS ======================== */
.server-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-bottom: 20px;
  overflow: hidden;
}

.server-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  background: var(--surface2);
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  user-select: none;
}
.server-section-header:hover { background: var(--border2); }

.server-info { display: flex; align-items: center; gap: 12px; }
.server-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 6px var(--green);
}
.server-dot.error { background: var(--red); box-shadow: 0 0 6px var(--red); }

.server-name { font-weight: 600; font-size: 15px; }
.server-host { color: var(--text-muted); font-size: 12px; font-family: monospace; }

.server-meta { display: flex; align-items: center; gap: 12px; }
.account-count {
  font-size: 12px;
  color: var(--text-muted);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 2px 10px;
}
.server-error {
  font-size: 12px;
  color: var(--red);
  background: rgba(248,81,73,0.08);
  border: 1px solid rgba(248,81,73,0.2);
  border-radius: var(--radius);
  padding: 2px 10px;
}

.chevron { color: var(--text-muted); transition: transform 0.2s; font-size: 16px; }
.chevron.open { transform: rotate(90deg); }

/* ======================== ACCOUNTS TABLE ======================== */
.accounts-wrapper { overflow-x: auto; }

.accounts-table {
  width: 100%;
  border-collapse: collapse;
}
.accounts-table th {
  text-align: left;
  padding: 10px 16px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.accounts-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border2);
  vertical-align: middle;
}
.accounts-table tr:last-child td { border-bottom: none; }
.accounts-table tr:hover td { background: var(--surface2); }
.accounts-table tr.suspended-row td { opacity: 0.55; }

.domain-cell { font-weight: 500; }
.domain-cell .subdomain { color: var(--text-muted); font-size: 12px; }
.user-cell { font-family: monospace; font-size: 13px; color: var(--blue); }
.plan-cell { font-size: 12px; color: var(--text-muted); }

/* Disk bar */
.disk-cell { min-width: 120px; }
.disk-bar-wrap { background: var(--bg); border-radius: 4px; height: 5px; margin-bottom: 4px; overflow: hidden; }
.disk-bar-fill {
  height: 100%;
  border-radius: 4px;
  background: var(--blue);
  transition: width 0.3s;
}
.disk-bar-fill.warn  { background: var(--yellow); }
.disk-bar-fill.crit  { background: var(--red); }
.disk-text { font-size: 11px; color: var(--text-muted); }

/* Status badge */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
}
.badge-green  { background: rgba(63,185,80,0.15);  color: var(--green); }
.badge-red    { background: rgba(248,81,73,0.15);  color: var(--red); }
.badge-yellow { background: rgba(210,153,34,0.15); color: var(--yellow); }
.badge-blue   { background: rgba(88,166,255,0.15); color: var(--blue); }

/* Actions */
.actions-cell { white-space: nowrap; }
.actions-cell .btn { margin-right: 4px; margin-bottom: 2px; }

/* Empty state */
.empty-state {
  text-align: center;
  padding: 40px;
  color: var(--text-muted);
  font-size: 13px;
}

/* Loading */
.loading-state {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 60px;
  color: var(--text-muted);
}
.spinner {
  width: 20px; height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  flex-shrink: 0;
}

/* ======================== MODAL ======================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 680px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  animation: modal-in 0.18s ease;
}
@keyframes modal-in {
  from { opacity: 0; transform: scale(0.95) translateY(-8px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.modal-header h2 { font-size: 16px; font-weight: 600; }
.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 22px;
  cursor: pointer;
  line-height: 1;
  padding: 2px 6px;
  border-radius: var(--radius);
}
.modal-close:hover { background: var(--surface2); color: var(--text); }

.modal-body {
  padding: 20px;
  overflow-y: auto;
}

/* Password reveal box */
.password-box {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-bottom: 16px;
}
.password-box .label { font-size: 11px; color: var(--text-muted); margin-bottom: 6px; }
.password-value {
  font-family: monospace;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 2px;
  color: var(--green);
  word-break: break-all;
  margin-bottom: 12px;
}
.copy-row { display: flex; gap: 8px; }

/* WP installations */
.wp-install {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.wp-info { flex: 1; min-width: 0; }
.wp-domain { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wp-path   { font-size: 12px; color: var(--text-muted); font-family: monospace; }
.wp-version { font-size: 12px; color: var(--text-muted); }
.wp-meta   { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.update-badge {
  background: rgba(210,153,34,0.15);
  color: var(--yellow);
  border: 1px solid rgba(210,153,34,0.3);
  border-radius: 20px;
  padding: 2px 10px;
  font-size: 12px;
  font-weight: 600;
}
.update-badge.none {
  background: rgba(63,185,80,0.1);
  color: var(--green);
  border-color: rgba(63,185,80,0.2);
}

/* Backup list */
.backup-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 8px;
  background: var(--surface2);
  gap: 12px;
  flex-wrap: wrap;
}
.backup-info { flex: 1; }
.backup-date  { font-size: 13px; font-weight: 500; }
.backup-size  { font-size: 12px; color: var(--text-muted); }
.backup-create-bar {
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
}

/* ======================== TOAST ======================== */
#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.toast {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 16px;
  font-size: 13px;
  max-width: 340px;
  animation: toast-in 0.2s ease;
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}
@keyframes toast-in {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}
.toast.success { border-color: rgba(63,185,80,0.4); }
.toast.error   { border-color: rgba(248,81,73,0.4); }
.toast-icon.success { color: var(--green); }
.toast-icon.error   { color: var(--red); }
.toast-icon.info    { color: var(--blue); }
