:root {
  --bg: #f4f6fb;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --text: #111827;
  --muted: #6b7280;
  --border: #e5e7eb;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --danger: #dc2626;
  --success: #16a34a;
  --warning: #f59e0b;
  --shadow: 0 16px 40px rgba(15, 23, 42, .08);
  --radius: 18px;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
}
a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; }

.auth-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 20% 10%, rgba(37,99,235,.20), transparent 28%),
    radial-gradient(circle at 90% 5%, rgba(22,163,74,.18), transparent 24%),
    linear-gradient(135deg, #eef3ff, #f8fafc);
}
.auth-card {
  width: min(430px, 100%);
  background: rgba(255,255,255,.92);
  border: 1px solid rgba(255,255,255,.75);
  box-shadow: var(--shadow);
  border-radius: 26px;
  padding: 28px;
  backdrop-filter: blur(14px);
}
.install-card { width: min(560px, 100%); }
.brand-lockup {
  display: flex;
  gap: 14px;
  align-items: center;
  margin-bottom: 24px;
}
.brand-mark {
  width: 48px;
  height: 48px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 800;
  background: linear-gradient(135deg, #2563eb, #0f172a);
  box-shadow: 0 10px 24px rgba(37,99,235,.24);
}
.brand-lockup h1 { margin: 0; font-size: 23px; line-height: 1.15; }
.brand-lockup p { margin: 4px 0 0; color: var(--muted); font-size: 14px; }
.form-group { margin: 15px 0; }
label { display: block; font-size: 13px; font-weight: 700; margin-bottom: 7px; color: #374151; }
input, select {
  width: 100%;
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 13px;
  padding: 12px 13px;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus { border-color: rgba(37,99,235,.55); box-shadow: 0 0 0 4px rgba(37,99,235,.10); }
.auth-links { display: flex; justify-content: space-between; margin-top: 18px; font-size: 14px; color: var(--muted); }
.auth-links a { color: var(--primary); font-weight: 700; }

.app-shell { min-height: 100vh; }
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(255,255,255,.92);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(14px);
}
.topbar-inner {
  width: min(1240px, calc(100% - 32px));
  margin: 0 auto;
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}
.nav-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.user-pill {
  background: var(--surface-soft);
  border: 1px solid var(--border);
  color: #374151;
  border-radius: 999px;
  padding: 9px 12px;
  font-size: 13px;
  font-weight: 700;
}
.container {
  width: min(1240px, calc(100% - 32px));
  margin: 26px auto 60px;
}
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 10px 24px rgba(15,23,42,.04);
}
.hero-panel {
  padding: 24px;
  display: grid;
  grid-template-columns: 1.2fr .8fr;
  gap: 24px;
  align-items: center;
  margin-bottom: 18px;
}
.hero-panel h2 { margin: 0; font-size: clamp(25px, 3vw, 38px); letter-spacing: -0.04em; }
.hero-panel p { color: var(--muted); line-height: 1.65; margin: 10px 0 0; }
.protection-card {
  background: linear-gradient(135deg, rgba(37,99,235,.10), rgba(22,163,74,.10));
  border: 1px solid rgba(37,99,235,.12);
  border-radius: 18px;
  padding: 18px;
}
.protection-card strong { display: block; margin-bottom: 5px; }
.protection-card span { color: var(--muted); font-size: 14px; line-height: 1.5; }
.toolbar {
  padding: 18px;
  display: grid;
  grid-template-columns: 250px 1fr auto;
  gap: 12px;
  align-items: center;
  margin-bottom: 18px;
}
.toolbar-right { display: flex; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.stats-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 14px;
  margin-bottom: 18px;
}
.stat-card { padding: 18px; }
.stat-card span { color: var(--muted); font-size: 13px; font-weight: 700; }
.stat-card strong { display: block; margin-top: 8px; font-size: 26px; letter-spacing: -0.03em; }
.table-panel { overflow: hidden; }
.table-head {
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.table-head h3 { margin: 0; font-size: 17px; }
.table-wrap { overflow: auto; max-height: 64vh; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 13px 14px; border-bottom: 1px solid var(--border); white-space: nowrap; text-align: left; }
th { background: #f9fafb; color: #475569; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; position: sticky; top: 0; z-index: 2; }
tr:hover td { background: #fafafa; }
.status-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  border-radius: 999px;
  padding: 5px 8px;
  font-weight: 800;
  font-size: 12px;
  background: #eef2ff;
  color: #3730a3;
}
.status-badge.a { background: #dcfce7; color: #166534; }
.status-badge.n { background: #fee2e2; color: #991b1b; }
.btn {
  border: 1px solid var(--border);
  background: #fff;
  color: #111827;
  border-radius: 12px;
  padding: 10px 13px;
  font-weight: 800;
  font-size: 13px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: transform .12s, box-shadow .12s, background .12s;
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 8px 16px rgba(15,23,42,.08); }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-dark); }
.btn.danger { background: #fff5f5; border-color: #fecaca; color: var(--danger); }
.btn.ghost { background: var(--surface-soft); }
.btn.wide { width: 100%; }
.btn.small { padding: 7px 9px; font-size: 12px; }
.file-input { display: none; }
.alert {
  border-radius: 13px;
  padding: 12px 14px;
  margin: 14px 0;
  font-size: 14px;
  font-weight: 700;
}
.alert.success { background: #dcfce7; color: #166534; border: 1px solid #bbf7d0; }
.alert.error { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }
.install-notes { color: var(--muted); line-height: 1.65; margin-bottom: 18px; }
.install-notes code { display: inline-block; background: #0f172a; color: #fff; border-radius: 9px; padding: 5px 8px; }
.empty-state { padding: 38px; text-align: center; color: var(--muted); }
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,.45);
  z-index: 50;
  display: none;
  place-items: center;
  padding: 18px;
}
.modal-backdrop.show { display: grid; }
.modal {
  background: #fff;
  border-radius: 24px;
  width: min(720px, 100%);
  box-shadow: 0 25px 80px rgba(15,23,42,.24);
  overflow: hidden;
}
.modal-header { padding: 20px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }
.modal-header h3 { margin: 0; }
.modal-body { padding: 20px; }
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
.modal-footer { padding: 18px 20px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 10px; }
.toast-wrap { position: fixed; right: 20px; bottom: 20px; z-index: 80; display: grid; gap: 10px; }
.toast {
  min-width: min(360px, calc(100vw - 40px));
  background: #111827;
  color: #fff;
  border-radius: 15px;
  padding: 13px 15px;
  box-shadow: var(--shadow);
  font-weight: 700;
  font-size: 14px;
}
.toast.success { background: #166534; }
.toast.error { background: #991b1b; }
.users-grid { display: grid; gap: 14px; }
.user-row {
  padding: 16px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
}
.user-row strong { display: block; }
.user-row span { color: var(--muted); font-size: 13px; }
@media (max-width: 900px) {
  .hero-panel, .toolbar { grid-template-columns: 1fr; }
  .toolbar-right { justify-content: flex-start; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 560px) {
  .topbar-inner, .container { width: min(100% - 22px, 1240px); }
  .brand-lockup h1 { font-size: 19px; }
  .stats-grid, .form-grid { grid-template-columns: 1fr; }
  .nav-actions { justify-content: flex-start; }
  .topbar-inner { align-items: flex-start; flex-direction: column; padding: 12px 0; }
}

/* Upload-and-play installer polish */
.setup-card { max-width: 560px; }
.form-section-title {
    margin: 20px 0 12px;
    font-size: 15px;
    font-weight: 800;
    color: var(--text);
    letter-spacing: -0.01em;
}
.check-row {
    display: flex;
    gap: 10px;
    align-items: center;
    margin: 12px 0 18px;
    color: var(--muted);
    font-weight: 700;
    font-size: 14px;
}
.check-row input { width: auto; }
