:root {
  --bg: #0f0f1a; --surface: #1a1a2e; --surface2: #23233a;
  --text: #e8e8f0; --muted: #9a9ab0; --primary: #7c3aed; --accent: #a78bfa;
  --danger: #e5484d; --ok: #3fb950; --border: #2e2e4a;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text);
  font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 0.85em; }
.error { background: #3a1d1d; color: #ffb4b4; padding: 10px; border-radius: 8px; margin-bottom: 12px; }
.warning { background: #3a2f10; color: #ffd479; padding: 10px 14px; border-radius: 8px; margin-bottom: 16px; }
.toast { background: var(--surface2); border: 1px solid var(--primary); padding: 10px 14px; border-radius: 8px; margin-bottom: 16px; }
h1, h2, h3 { margin: 0 0 12px; }
h2 { font-size: 1.4em; } h3 { margin-top: 28px; font-size: 1.1em; }

/* login */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; }
.login-card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 32px; width: 360px; }
.login-card h1 { color: var(--accent); margin-bottom: 2px; }
.login-card form { display: flex; flex-direction: column; gap: 12px; margin-top: 16px; }

/* forms */
label { display: flex; flex-direction: column; gap: 4px; font-size: 0.9em; color: var(--muted); }
label.check { flex-direction: row; align-items: center; gap: 8px; color: var(--text); }
input, select { background: var(--bg); color: var(--text); border: 1px solid var(--border);
  border-radius: 8px; padding: 9px 10px; font-size: 1em; width: 100%; }
input[type="color"] { padding: 2px; height: 38px; }
input[type="checkbox"] { width: auto; }
button, .btn { background: var(--primary); color: #fff; border: none; border-radius: 8px;
  padding: 10px 16px; font-size: 1em; cursor: pointer; }
button:hover, .btn:hover { filter: brightness(1.15); }
.btn.ghost { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn.danger { background: var(--danger); }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; max-width: 900px; }
.form-grid button { grid-column: 1 / -1; justify-self: start; }
.inline-form { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.inline-form input, .inline-form select { width: auto; flex: 1 1 160px; }
.inline-form button { flex: 0 0 auto; }
.row { display: flex; gap: 12px; align-items: center; margin-bottom: 12px; flex-wrap: wrap; }
.row label { flex-direction: row; align-items: center; }

/* app layout */
.topbar { display: flex; justify-content: space-between; align-items: center;
  padding: 12px 20px; background: var(--surface); border-bottom: 1px solid var(--border); }
.topbar .logo { color: var(--accent); }
.top-right { display: flex; gap: 14px; align-items: center; }
.brand-switch { flex-direction: row; align-items: center; gap: 6px; }
.brand-switch select { width: auto; }
.layout { display: flex; min-height: calc(100vh - 57px); }
.sidebar { width: 240px; background: var(--surface); border-right: 1px solid var(--border);
  padding: 16px 12px; display: flex; flex-direction: column; gap: 6px;
  position: fixed; left: 0; top: 0; bottom: 0; z-index: 100; overflow-y: auto;
  box-shadow: 4px 0 16px rgba(0, 0, 0, 0.45); }
.nav-btn { background: transparent; color: var(--text); text-align: left; }
.nav-btn.active { background: var(--primary); }

/* hamburger + collapsible nav categories (1.7.7) */
.menu-btn { padding: 6px 12px; font-size: 1.25em; line-height: 1; margin-right: 10px; }
.topbar .brand { display: flex; align-items: center; gap: 6px; }
.drawer-head { display: flex; justify-content: space-between; align-items: center;
  padding: 0 4px 10px; margin-bottom: 4px; border-bottom: 1px solid var(--border);
  font-weight: 600; color: var(--muted); }
.drawer-head button { padding: 4px 10px; font-size: 1em; line-height: 1; }
.nav-cat-wrap { display: flex; flex-direction: column; gap: 6px; }
.nav-cat { background: transparent; color: var(--muted); text-align: left;
  font-weight: 600; font-size: 0.85em; text-transform: uppercase; letter-spacing: 0.04em;
  padding: 8px 16px 4px; display: flex; justify-content: space-between; align-items: center; }
.nav-cat:hover { color: var(--text); filter: none; }
.nav-cat::after { content: "▾"; font-size: 0.9em; }
.nav-cat-wrap.collapsed .nav-cat::after { content: "▸"; }
.nav-cat-wrap.collapsed .nav-group { display: none; }
.nav-group { display: flex; flex-direction: column; gap: 6px; padding-left: 10px; }
body.sidebar-hidden .sidebar { display: none; }
.nav-backdrop { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.5); z-index: 90; }
@media (max-width: 768px) {
  .content { padding: 16px; }
  .topbar { padding: 12px 14px; flex-wrap: wrap; gap: 8px; }
  .login-card { width: calc(100vw - 32px); padding: 24px; }
  .sidebar { width: min(280px, 85vw); }
}
.content { flex: 1; padding: 24px; overflow-x: auto; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; margin-bottom: 20px; }
.cards .card { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 16px; }
.cards .card b { font-size: 1.6em; display: block; color: var(--accent); }
.code { background: #0a0a14; border: 1px solid var(--border); border-radius: 8px;
  padding: 14px; overflow: auto; font-size: 0.85em; white-space: pre-wrap; }
.tbl { width: 100%; border-collapse: collapse; font-size: 0.92em; }
.tbl th, .tbl td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); }
.tbl th { color: var(--muted); }
.tbl td { word-break: break-all; }
.tbl button { padding: 5px 10px; font-size: 0.9em; }
