:root {
  --bg: #0a0d14; --surface: #0f172a; --surface-2: #1e293b; --surface-3: #272a32;
  --border: #334155; --border-soft: rgba(51, 65, 85, 0.4);
  --text: #f8fafc; --text-dim: #94a3b8; --text-faint: #64748b;
  --accent: #38bdf8; --accent-hover: #0284c7; --green: #10b981; --red: #f43f5e; --amber: #f59e0b;
  --shadow: 0 8px 24px -4px rgba(0, 0, 0, 0.6);
  --sans: "Geist", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, Menlo, monospace;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 13px/18px var(--sans); -webkit-font-smoothing: antialiased; }
button, input, select { font: inherit; color: var(--text); }
.hidden { display: none !important; }

.brand { display: flex; align-items: center; gap: 8px; }
.brand.center { justify-content: center; }
.brand h1 { margin: 0; font-size: 18px; line-height: 24px; font-weight: 600; letter-spacing: -0.01em; }
.logo { width: 22px; height: 22px; border-radius: 4px; background: linear-gradient(135deg, var(--accent), #6366f1); }

.sidebar { position: fixed; inset: 0 auto 0 0; width: 240px; background: var(--bg); border-right: 1px solid var(--border); display: flex; flex-direction: column; }
.sidebar > .brand { height: 56px; padding: 0 12px; background: var(--surface); border-bottom: 1px solid var(--border); }
.nav { display: flex; flex-direction: column; gap: 2px; padding: 8px; flex: 1; }
.nav .btn { justify-content: flex-start; border-color: transparent; color: var(--text-dim); width: 100%; }
.nav .btn:hover { background: var(--surface-2); color: var(--text); border-color: transparent; }
.nav .btn.active { background: var(--surface-2); color: var(--accent); font-weight: 500; }
.count { margin-left: auto; padding: 1px 5px; border-radius: 4px; background: var(--surface-3); color: var(--green); font: 500 11px/14px var(--mono); }
.sidebar-foot { padding: 8px; border-top: 1px solid var(--border); }
.engine-box { padding: 8px; border-radius: 4px; background: var(--surface); border: 1px solid var(--border-soft); }
.engine-box .k { font: 600 10px/12px var(--mono); letter-spacing: 0.08em; color: var(--text-faint); }
.engine-box .v { font: 500 11px/14px var(--mono); color: var(--text-dim); margin-top: 4px; }

.main { margin-left: 240px; min-height: 100vh; }
.topbar { position: sticky; top: 0; height: 56px; display: flex; align-items: center; gap: 16px; padding: 0 20px; background: rgba(15, 23, 42, 0.85); backdrop-filter: blur(16px); border-bottom: 1px solid var(--border); }
.crumbs { display: flex; gap: 4px; font: 500 11px/14px var(--mono); color: var(--text-dim); }
.crumbs .muted { color: var(--text-faint); }
.crumbs .cur { color: var(--accent); }
.topnav { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.user-pill { display: inline-flex; gap: 6px; align-items: center; padding: 4px 10px; border-radius: 4px; border: 1px solid var(--border); font-size: 12px; }
.user-pill .role { font: 600 10px/12px var(--mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent); }

.app { padding: 16px 32px 48px; }
.page-head { margin-bottom: 16px; }
.page-head h2 { margin: 0; font-size: 32px; line-height: 40px; font-weight: 600; letter-spacing: -0.02em; }
.page-head p { margin: 2px 0 0; color: var(--text-dim); font-size: 12px; }

.btn { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 4px; border: 1px solid var(--border); background: transparent; cursor: pointer; transition: background .12s, border-color .12s, color .12s; }
.btn:hover { background: var(--surface-2); border-color: var(--accent); }
.btn:focus-visible { outline: none; border-color: var(--accent); box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.2); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--bg); font-weight: 600; justify-content: center; }
.btn.primary:hover { background: var(--accent-hover); color: #fff; }
.btn.danger { background: rgba(244, 63, 94, 0.1); border-color: var(--red); color: var(--red); }
.btn.danger:hover { background: var(--red); color: #fff; }
.btn.sm { padding: 3px 8px; font-size: 12px; }
.btn.wide { width: 100%; height: 36px; }

.table-wrap { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; overflow: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 0 12px; height: 44px; text-align: left; white-space: nowrap; }
th { height: 36px; font: 600 10px/12px var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--text-dim); border-bottom: 1px solid var(--border); }
tbody tr { border-bottom: 1px solid var(--border-soft); }
tbody tr:hover { background: var(--surface-2); }
td.name { color: var(--accent); font-weight: 500; padding: 6px 12px; }
td.muted { color: var(--text-dim); font: 12px/18px var(--mono); }
.id { font: 11px/14px var(--mono); color: var(--text-faint); }
.state-msg { padding: 40px 20px; text-align: center; color: var(--text-dim); }

.login-overlay { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; padding: 16px; background: radial-gradient(ellipse at top, rgba(56, 189, 248, 0.08), transparent 60%), var(--bg); }
.login-card { width: min(380px, 100%); padding: 28px 24px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow); }
.login-sub { text-align: center; margin: 6px 0 20px; font: 600 10px/12px var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--text-dim); }
.field { width: 100%; height: 36px; margin-bottom: 10px; padding: 0 10px; border-radius: 4px; border: 1px solid var(--border); background: var(--bg); outline: none; }
.field:focus { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.2); }
.form-err { min-height: 1.2em; margin-bottom: 8px; color: var(--red); font-size: 12px; text-align: center; }
.login-divider { display: flex; align-items: center; gap: 10px; margin: 14px 0 12px; color: var(--text-faint); font: 600 10px/12px var(--mono); letter-spacing: .08em; text-transform: uppercase; }
.login-divider::before, .login-divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.btn.google { justify-content: center; background: var(--surface-2); }
.btn.google:hover { background: var(--surface-3); border-color: var(--accent); }
.btn.google svg { flex: none; }

.toasts { position: fixed; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 100; }
.toast { padding: 10px 14px; border-radius: 8px; background: var(--surface-2); border: 1px solid var(--border); border-left: 3px solid var(--green); box-shadow: var(--shadow); }
.toast.error { border-left-color: var(--red); }

@media (max-width: 1023px) { .sidebar { position: static; width: auto; } .main { margin-left: 0; } .app { padding: 16px; } }
