:root {
  --bg-app: #0F0F17;
  --bg-surface: #191924;
  --bg-surface-alt: #20202E;
  --bg-input: #1D1D2A;
  --border: #2B2B40;
  --accent: #8B7FFF;
  --accent-hover: #7566EE;
  --teal: #3ECFB0;
  --teal-hover: #2FB89C;
  --coral: #FF6B6B;
  --coral-hover: #E8514F;
  --amber: #FBBF24;
  --neutral-btn: #292939;
  --neutral-btn-hover: #34344A;
  --text-primary: #F3F3FA;
  --text-muted: #9C9CB4;
  --text-success: #4ADE80;
  --text-danger: #FF7A7A;
  --chart-1: #4FA3F7;
  --chart-2: #3ECFB0;
}

* { box-sizing: border-box; }

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

header.topbar {
  background: var(--bg-surface);
  padding: 18px 24px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--border);
}
header.topbar .dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--accent);
}
header.topbar h1 { font-size: 19px; margin: 0; }
header.topbar .subtitle { color: var(--text-muted); font-size: 12px; }
header.topbar .spacer { flex: 1; }
header.topbar .user-info { color: var(--text-muted); font-size: 13px; margin-right: 14px; }

nav.tabs {
  display: flex; gap: 6px; padding: 16px 24px 0 24px; flex-wrap: wrap;
}
nav.tabs a {
  padding: 10px 16px; border-radius: 10px; text-decoration: none;
  color: var(--text-primary); font-size: 13px; font-weight: 600;
  background: var(--bg-surface-alt);
}
nav.tabs a.active { background: var(--accent); color: white; }

main { padding: 20px 24px 40px 24px; max-width: 1200px; margin: 0 auto; }

.card {
  background: var(--bg-surface-alt);
  border-radius: 12px;
  padding: 18px 20px;
  margin-bottom: 16px;
  border: 1px solid var(--border);
}

h2.section { font-size: 16px; margin: 0 0 4px 0; }
p.muted { color: var(--text-muted); font-size: 12px; margin: 0 0 14px 0; }

label { display: block; font-size: 11px; color: var(--text-muted); margin-bottom: 4px; }

input[type=text], input[type=password], input[type=date], textarea, select {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-primary);
  padding: 9px 12px;
  font-size: 13px;
  font-family: inherit;
  width: 100%;
}
textarea { min-height: 130px; resize: vertical; }

.btn {
  display: inline-block; border: none; border-radius: 10px;
  padding: 10px 18px; font-size: 13px; font-weight: 700; cursor: pointer;
  text-decoration: none; color: white; background: var(--accent);
}
.btn:hover { background: var(--accent-hover); }
.btn.secondary { background: var(--neutral-btn); color: var(--text-primary); border: 1px solid var(--border); }
.btn.secondary:hover { background: var(--neutral-btn-hover); }
.btn.teal { background: var(--teal); color: #08251F; }
.btn.teal:hover { background: var(--teal-hover); }
.btn.danger { background: var(--coral); }
.btn.danger:hover { background: var(--coral-hover); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; padding: 10px 12px; background: var(--bg-surface); color: var(--text-primary); font-weight: 700; }
td { padding: 8px 12px; border-top: 1px solid var(--border); }
tr:hover td { background: rgba(255,255,255,0.02); }
.status-ok { color: var(--text-success); font-weight: 600; }
.status-fail { color: var(--text-danger); font-weight: 600; }
.status-warn { color: var(--amber); font-weight: 600; }

.filter-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 12px; }
.filter-row .field { min-width: 140px; }

.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 16px; }
.stat-card { background: var(--bg-surface-alt); border-radius: 12px; padding: 16px; border: 1px solid var(--border); }
.stat-card .value { font-size: 26px; font-weight: 800; color: var(--chart-1); }
.stat-card .label { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

.flash { padding: 10px 14px; border-radius: 8px; margin-bottom: 14px; font-size: 13px; }
.flash.error { background: rgba(255,107,107,0.15); color: var(--text-danger); border: 1px solid var(--coral); }
.flash.success { background: rgba(74,222,128,0.15); color: var(--text-success); border: 1px solid var(--text-success); }

.login-wrap { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.login-card { background: var(--bg-surface-alt); padding: 36px; border-radius: 16px; width: 360px; border: 1px solid var(--border); }
.login-card h1 { text-align: center; font-size: 20px; margin-bottom: 24px; }
.login-card .field { margin-bottom: 14px; }
.login-card .btn { width: 100%; padding: 12px; margin-top: 6px; }
.qr-box { text-align: center; margin: 16px 0; }
.qr-box img { border-radius: 8px; background: white; padding: 10px; }
code.secret { background: var(--bg-input); padding: 8px 10px; border-radius: 6px; display: block; text-align: center; letter-spacing: 2px; margin: 10px 0; }

.checkbox-row { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text-muted); margin: 8px 0; }
.badge { display: inline-block; padding: 3px 8px; border-radius: 6px; font-size: 11px; font-weight: 700; }
.badge.admin { background: rgba(139,127,255,0.2); color: var(--accent); }
.badge.user { background: rgba(156,156,180,0.2); color: var(--text-muted); }
