@import url('https://fonts.googleapis.com/css2?family=Sora:wght@600;700;800&family=Inter:wght@400;500;600&display=swap');

:root {
  --bg: #0b0f1a;
  --surface: #121826;
  --surface-2: #182034;
  --border: #232c40;
  --text: #e7ebf3;
  --muted: #8b95ab;
  --blue: #3b82f6;
  --green: #22c55e;
  --red: #ef4444;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: 'Inter', system-ui, sans-serif; font-size: 15px; }
h1, h2, h3, .brand { font-family: 'Sora', system-ui, sans-serif; }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }

.brand { font-weight: 800; font-size: 1.3rem; }
.brand span { color: var(--blue); }
.badge {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--red);
  border: 1px solid var(--red);
  border-radius: 4px;
  padding: 1px 6px;
  margin-left: 8px;
  vertical-align: middle;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 32px;
  border-bottom: 1px solid var(--border);
}
.topbar nav a { margin-right: 18px; color: var(--muted); font-weight: 500; font-size: 0.9rem; }
.topbar nav a.active, .topbar nav a:hover { color: var(--text); text-decoration: none; }
.topbar form { margin: 0; }
.topbar button.linklike { background: none; border: none; color: var(--muted); cursor: pointer; font-size: 0.9rem; }

.main { padding: 32px; max-width: 1000px; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 16px; margin-top: 20px; }
.stat-card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 18px; }
.stat-card .num { font-size: 1.8rem; font-weight: 700; font-family: 'Sora', sans-serif; }
.stat-card .label { color: var(--muted); font-size: 0.85rem; }

table { width: 100%; border-collapse: collapse; margin-top: 20px; font-size: 0.88rem; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); }
th { color: var(--muted); font-weight: 600; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.03em; }
tr:hover { background: var(--surface); }

.pill { display: inline-block; padding: 2px 9px; border-radius: 20px; font-size: 0.75rem; }
.pill.on { background: rgba(34,197,94,0.12); color: #86efac; }
.pill.off { background: rgba(239,68,68,0.12); color: #fca5a5; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 28px; max-width: 460px; }
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }

label { display: block; font-size: 0.85rem; color: var(--muted); margin: 14px 0 6px; }
input[type="text"], input[type="email"], input[type="password"], input[type="number"], input[type="datetime-local"] {
  width: 100%; padding: 10px 12px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--bg); color: var(--text); font-size: 0.95rem;
}
.checkbox-row { display: flex; align-items: center; gap: 8px; margin: 8px 0; }
.checkbox-row input { width: auto; }

button, .btn {
  display: inline-block; margin-top: 20px; padding: 9px 16px; border-radius: 8px; border: none;
  background: var(--blue); color: #fff; font-weight: 600; cursor: pointer; font-size: 0.9rem;
}
button.danger { background: var(--red); }
button.ghost { background: transparent; border: 1px solid var(--border); color: var(--muted); margin-top: 0; }
button:hover, .btn:hover { opacity: 0.9; text-decoration: none; }

.msg { padding: 10px 12px; border-radius: 8px; font-size: 0.88rem; margin-top: 12px; }
.msg.error { background: rgba(239,68,68,0.12); color: #fca5a5; border: 1px solid rgba(239,68,68,0.3); }

.actions form { display: inline; }
code.gencode { display: block; background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; font-size: 1rem; color: var(--blue); margin-top: 6px; }

.table-wrap { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* ---- Responsive ---- */
@media (max-width: 768px) {
  .topbar { flex-wrap: wrap; gap: 10px; padding: 14px 20px; }
  .topbar nav { display: flex; flex-wrap: wrap; gap: 4px 14px; }
  .main { padding: 20px; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .card { max-width: 100%; padding: 22px; }
  table { min-width: 620px; }
  .auth-wrap { padding: 16px; min-height: auto; }
}

@media (max-width: 420px) {
  .brand { font-size: 1.1rem; }
  h1 { font-size: 1.4rem; }
  .stat-grid { grid-template-columns: 1fr; }
}
