:root {
  --bg: #0f172a;
  --panel: #1e293b;
  --panel-2: #273449;
  --border: #334155;
  --text: #e2e8f0;
  --muted: #94a3b8;
  --primary: #6366f1;
  --primary-hover: #4f46e5;
  --danger: #ef4444;
  --success: #22c55e;
  --radius: 10px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

.center-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  width: 100%;
  max-width: 380px;
}

.card h1 {
  font-size: 1.3rem;
  margin: 0 0 4px;
}

.card .subtitle {
  color: var(--muted);
  font-size: 0.85rem;
  margin-bottom: 20px;
}

label {
  display: block;
  font-size: 0.82rem;
  color: var(--muted);
  margin: 14px 0 6px;
}

input, select {
  width: 100%;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--text);
  font-size: 0.95rem;
}

input:focus, select:focus {
  outline: none;
  border-color: var(--primary);
}

button {
  cursor: pointer;
  border: none;
  border-radius: 8px;
  padding: 10px 16px;
  font-size: 0.9rem;
  font-weight: 600;
}

.btn-primary {
  background: var(--primary);
  color: white;
  width: 100%;
  margin-top: 20px;
  padding: 11px;
}
.btn-primary:hover { background: var(--primary-hover); }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; }

.btn-secondary {
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-secondary:hover { background: var(--border); }

.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { opacity: 0.85; }

.btn-sm { padding: 6px 10px; font-size: 0.8rem; }

.msg {
  margin-top: 14px;
  font-size: 0.85rem;
  padding: 10px 12px;
  border-radius: 8px;
  display: none;
}
.msg.error { display: block; background: rgba(239,68,68,0.12); color: #fca5a5; border: 1px solid rgba(239,68,68,0.3); }
.msg.success { display: block; background: rgba(34,197,94,0.12); color: #86efac; border: 1px solid rgba(34,197,94,0.3); }

/* Layout dashboard/admin */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
}
.topbar .brand { font-weight: 700; font-size: 1.05rem; }
.topbar .brand span { color: var(--primary); }
.topbar-actions { display: flex; align-items: center; gap: 12px; }
.badge {
  font-size: 0.72rem;
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(99,102,241,0.15);
  color: #a5b4fc;
  border: 1px solid rgba(99,102,241,0.35);
}

.container {
  max-width: 900px;
  margin: 0 auto;
  padding: 24px 16px 60px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 20px;
}
.panel h2 { margin: 0 0 4px; font-size: 1.05rem; }
.panel .desc { color: var(--muted); font-size: 0.82rem; margin-bottom: 16px; }

.row { display: flex; gap: 12px; flex-wrap: wrap; }
.row > div { flex: 1; min-width: 160px; }

table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--border); }
th { color: var(--muted); font-weight: 600; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.03em; }
tr:last-child td { border-bottom: none; }

.status-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 6px; }
.status-active { background: var(--success); }
.status-disabled { background: var(--danger); }

.actions-cell { display: flex; gap: 6px; flex-wrap: wrap; }

.modal-backdrop {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.55);
  align-items: center; justify-content: center;
  padding: 16px;
  z-index: 50;
}
.modal-backdrop.open { display: flex; }
.modal {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  width: 100%;
  max-width: 420px;
  max-height: 90vh;
  overflow-y: auto;
}
.modal h3 { margin: 0 0 16px; }
.modal-actions { display: flex; gap: 10px; margin-top: 20px; justify-content: flex-end; }

.loading { text-align: center; color: var(--muted); padding: 30px 0; font-size: 0.85rem; }
.empty { text-align: center; color: var(--muted); padding: 30px 0; font-size: 0.85rem; }

a { color: #a5b4fc; }
