:root {
  --bg: #0f1115;
  --bg-alt: #161923;
  --border: #262b38;
  --text: #d7dae2;
  --text-dim: #8b90a0;
  --accent: #5b8cff;
}

* { box-sizing: border-box; }

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

body.centered {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-box {
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 2.5rem;
  width: 100%;
  max-width: 360px;
}

.login-box h1 { margin: 0 0 0.25rem; font-size: 1.4rem; }
.subtitle { color: var(--text-dim); font-size: 0.9rem; margin: 0 0 1.5rem; }

form.stacked-form, .login-box form { display: flex; flex-direction: column; gap: 1rem; }

label { display: flex; flex-direction: column; gap: 0.35rem; font-size: 0.9rem; color: var(--text-dim); }

input, select {
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.6rem 0.7rem;
  border-radius: 6px;
  font-size: 0.95rem;
}

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

button, .link-btn {
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 0.65rem 1rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.95rem;
}

.link-btn { background: none; color: var(--text-dim); padding: 0; text-decoration: underline; }
.link-btn.danger { color: #ff6b6b; }

.alert { padding: 0.6rem 0.8rem; border-radius: 6px; font-size: 0.9rem; margin-bottom: 1rem; }
.alert-error { background: rgba(255, 107, 107, 0.12); color: #ff8f8f; border: 1px solid rgba(255,107,107,0.3); }
.alert-success { background: rgba(91, 140, 255, 0.12); color: #9db8ff; border: 1px solid rgba(91,140,255,0.3); }

.topbar {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.9rem 1.5rem;
  border-bottom: 1px solid var(--border);
  background: var(--bg-alt);
}

.brand { font-weight: 600; }
.spacer { flex: 1; }
.user { color: var(--text-dim); font-size: 0.9rem; }
a.link { color: var(--accent); text-decoration: none; font-size: 0.9rem; }
a.link:hover { text-decoration: underline; }
.inline-form { display: inline; }

.layout { display: flex; min-height: calc(100vh - 57px); }

.sidebar {
  width: 260px;
  border-right: 1px solid var(--border);
  background: var(--bg-alt);
  padding: 1.2rem 0.8rem;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  overflow-y: auto;
}

.sidebar a {
  color: var(--text-dim);
  text-decoration: none;
  padding: 0.5rem 0.6rem;
  border-radius: 6px;
  font-size: 0.88rem;
}

.sidebar a:hover { background: rgba(255,255,255,0.04); color: var(--text); }
.sidebar a.active { background: rgba(91,140,255,0.15); color: var(--accent); }

.content {
  flex: 1;
  padding: 2rem 3rem;
  max-width: 900px;
}

.content h1 { font-size: 1.7rem; border-bottom: 1px solid var(--border); padding-bottom: 0.5rem; }
.content h2 { font-size: 1.3rem; margin-top: 2.2rem; color: var(--accent); }
.content h3 { font-size: 1.05rem; margin-top: 1.6rem; }
.content code { background: var(--bg-alt); padding: 0.15rem 0.4rem; border-radius: 4px; font-size: 0.88em; }
.content pre { background: var(--bg-alt); border: 1px solid var(--border); padding: 1rem; border-radius: 6px; overflow-x: auto; }
.content pre code { background: none; padding: 0; }
.content table { border-collapse: collapse; width: 100%; margin: 1rem 0; font-size: 0.9rem; }
.content th, .content td { border: 1px solid var(--border); padding: 0.5rem 0.7rem; text-align: left; }
.content th { background: var(--bg-alt); }
.content a { color: var(--accent); }
.content blockquote { border-left: 3px solid var(--accent); margin: 1rem 0; padding: 0.3rem 1rem; color: var(--text-dim); }

.users-table { border-collapse: collapse; width: 100%; margin-bottom: 2rem; }
.users-table th, .users-table td { border: 1px solid var(--border); padding: 0.5rem 0.8rem; text-align: left; font-size: 0.9rem; }
.users-table th { background: var(--bg-alt); }
.actions-cell { display: flex; flex-direction: column; gap: 0.4rem; align-items: flex-start; }
.inline-reset-form { display: flex; gap: 0.4rem; margin-top: 0.4rem; }
.inline-reset-form input { padding: 0.35rem 0.5rem; font-size: 0.85rem; }
.inline-reset-form button { padding: 0.35rem 0.7rem; font-size: 0.85rem; }
details summary { cursor: pointer; }
