:root {
  --bg: #1e2530;
  --bg-elev: #2a3441;
  --bg-hover: #34404f;
  --fg: #e6edf3;
  --muted: #8b98a5;
  --accent: #58a6ff;
  --accent-dark: #3a82e0;
  --warn: #f97583;
  --ok: #56d364;
  --border: #3a4655;
  --code-bg: #2a3441;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  background: var(--bg);
  color: var(--fg);
  line-height: 1.5;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { color: var(--accent); margin-top: 0; }
h2 { color: var(--fg); margin-top: 1.6rem; margin-bottom: 0.6rem; font-size: 1.15rem; }
code {
  background: var(--code-bg);
  padding: 1px 6px;
  border-radius: 3px;
  font-family: ui-monospace, "SF Mono", monospace;
  font-size: 0.92em;
}
.muted { color: var(--muted); font-size: 0.9em; }
small.muted { display: block; margin-top: 0.2rem; }

/* Top navigation */
.topnav {
  display: flex;
  align-items: center;
  gap: 2rem;
  padding: 0.7rem 1.5rem;
  background: var(--bg-elev);
  border-bottom: 1px solid var(--border);
}
.topnav-brand a {
  font-weight: 600;
  font-size: 1.1rem;
  color: var(--accent);
}
.topnav-brand a:hover { text-decoration: none; }
.topnav-links {
  display: flex;
  gap: 1.2rem;
  flex: 1;
}
.topnav-links a {
  color: var(--fg);
  padding: 0.3rem 0;
  border-bottom: 2px solid transparent;
}
.topnav-links a:hover { text-decoration: none; color: var(--accent); }
.topnav-links a.is-active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}
.topnav-user {
  display: flex;
  align-items: center;
  gap: 1rem;
}
.topnav-name { color: var(--muted); font-size: 0.9em; }

main {
  max-width: 920px;
  margin: 2rem auto;
  padding: 0 1.5rem;
}

/* Auth (login) */
.auth-card {
  max-width: 380px;
  margin: 6rem auto 2rem;
  padding: 2rem;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 6px;
}
.auth-card h1 { text-align: center; margin-bottom: 0.3rem; }
.auth-card .muted { text-align: center; margin-bottom: 1.5rem; }

/* Pages and cards */
.page { max-width: 920px; }
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}
.card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1.2rem 1.5rem;
  margin: 1rem 0;
}

/* Key-value list */
.kv { list-style: none; padding: 0; margin: 0; }
.kv li {
  display: flex;
  justify-content: space-between;
  padding: 0.4rem 0;
  border-bottom: 1px solid var(--border);
}
.kv li:last-child { border-bottom: none; }
.kv span:first-child { color: var(--muted); }

/* Forms */
.form { display: flex; flex-direction: column; gap: 0.9rem; }
.form label {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.92em;
  color: var(--muted);
}
.form input, .form select, .form textarea {
  background: var(--bg);
  color: var(--fg);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.55rem 0.7rem;
  font-family: inherit;
  font-size: 0.95rem;
}
.form input:focus, .form select:focus, .form textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(88, 166, 255, 0.18);
}
.form input:disabled { opacity: 0.6; cursor: not-allowed; }
.form-actions { margin-top: 0.5rem; }

/* Buttons */
.btn {
  display: inline-block;
  background: var(--bg-hover);
  color: var(--fg);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.55rem 1.1rem;
  font-size: 0.95rem;
  font-family: inherit;
  cursor: pointer;
  text-decoration: none;
}
.btn:hover { background: var(--border); text-decoration: none; }
.btn-primary {
  background: var(--accent);
  color: #0c1119;
  border-color: var(--accent);
  font-weight: 600;
}
.btn-primary:hover { background: var(--accent-dark); border-color: var(--accent-dark); }
.btn-link {
  background: none;
  border: none;
  color: var(--accent);
  cursor: pointer;
  padding: 0;
  font: inherit;
}
.btn-link:hover { text-decoration: underline; }
.btn-link.btn-warn { color: var(--warn); }
.inline-form { display: inline; }

/* Tables */
table.data {
  width: 100%;
  border-collapse: collapse;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
}
table.data th, table.data td {
  text-align: left;
  padding: 0.6rem 0.8rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.92rem;
}
table.data th {
  background: var(--bg-hover);
  color: var(--muted);
  font-weight: 500;
}
table.data tr:last-child td { border-bottom: none; }
table.data tr.is-disabled { opacity: 0.55; }
table.data td.actions { text-align: right; white-space: nowrap; }
table.data td.actions > * { margin-left: 0.6rem; }
table.data th.actions { text-align: right; }

/* Badges */
.badge {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 9px;
  font-size: 0.78em;
  background: var(--bg-hover);
  color: var(--muted);
  border: 1px solid var(--border);
}
.badge-admin { background: rgba(88, 166, 255, 0.15); color: var(--accent); border-color: rgba(88, 166, 255, 0.4); }
.badge-user  { background: var(--bg-hover); color: var(--fg); }
.badge-ok    { background: rgba(86, 211, 100, 0.15); color: var(--ok); border-color: rgba(86, 211, 100, 0.4); }
.badge-warn  { background: rgba(249, 117, 131, 0.15); color: var(--warn); border-color: rgba(249, 117, 131, 0.4); }

/* Flash messages */
.flash {
  padding: 0.7rem 1rem;
  border-radius: 4px;
  border: 1px solid var(--border);
  margin: 0 0 1rem;
}
.flash-success { background: rgba(86, 211, 100, 0.10); border-color: rgba(86, 211, 100, 0.4); color: var(--ok); }
.flash-error   { background: rgba(249, 117, 131, 0.10); border-color: rgba(249, 117, 131, 0.4); color: var(--warn); }
.flash-info    { background: rgba(88, 166, 255, 0.10); border-color: rgba(88, 166, 255, 0.4); color: var(--accent); }
