:root {
  color-scheme: light dark;
  --bg: #f6f7f9;
  --surface: #ffffff;
  --text: #1a1d23;
  --muted: #6b7280;
  --border: #e2e5ea;
  --accent: #2f6fed;
  --accent-hover: #2558c4;
  --danger: #d1453b;
  --success: #1a7f4e;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14161a;
    --surface: #1c1f26;
    --text: #e8eaed;
    --muted: #9aa1ac;
    --border: #2b2f38;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 2.5rem 1rem;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 2rem;
  width: 100%;
  max-width: 420px;
}

.card.wide {
  max-width: 720px;
}

/* Scoped to the admin dashboard specifically (body.dashboard-page) rather
   than widening .wide/.topbar everywhere — that page is a full-bleed
   operational console (6 KPI columns, a trend chart, a paginated event
   table beside an attention panel) and uses the whole viewport, while the
   account/OAuth-client/email-template pages stay in the shared centered
   column that suits their single-column forms. */
body.dashboard-page .topbar,
body.dashboard-page .card.wide {
  max-width: none;
}

h1 {
  font-size: 1.4rem;
  margin: 0 0 1.25rem;
}

h2 {
  font-size: 1.05rem;
  margin: 1.75rem 0 0.75rem;
}

label {
  display: block;
  font-size: 0.85rem;
  color: var(--muted);
  margin: 0.9rem 0 0.3rem;
}

input {
  width: 100%;
  padding: 0.55rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: transparent;
  color: var(--text);
  font-size: 0.95rem;
}

input:focus {
  outline: 2px solid var(--accent);
  outline-offset: -1px;
}

button {
  cursor: pointer;
  border: none;
  border-radius: 6px;
  padding: 0.6rem 1rem;
  font-size: 0.9rem;
  font-weight: 600;
  background: var(--accent);
  color: #fff;
}

button:hover { background: var(--accent-hover); }
button.secondary { background: transparent; color: var(--text); border: 1px solid var(--border); }
button.danger { background: transparent; color: var(--danger); border: 1px solid var(--border); }

.actions { margin-top: 1.25rem; display: flex; gap: 0.6rem; }

.error {
  color: var(--danger);
  font-size: 0.85rem;
  margin-top: 0.75rem;
  min-height: 1.1em;
}

.muted { color: var(--muted); font-size: 0.85rem; }

a { color: var(--accent); }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  margin-top: 0.5rem;
}

th, td {
  text-align: left;
  padding: 0.5rem 0.4rem;
  border-bottom: 1px solid var(--border);
}

th { color: var(--muted); font-weight: 600; }

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.75rem;
  margin: 1rem 0;
}

.stat {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.75rem;
}

.stat .value { font-size: 1.4rem; font-weight: 700; }
.stat .label { color: var(--muted); font-size: 0.8rem; }

.session-row { display: flex; justify-content: space-between; align-items: center; padding: 0.6rem 0; border-bottom: 1px solid var(--border); }
.badge { font-size: 0.7rem; background: var(--accent); color: #fff; border-radius: 4px; padding: 0.1rem 0.4rem; margin-left: 0.4rem; }
.badge.event-login_failed { background: var(--danger); }
.badge.event-logout { background: var(--muted); }

.topbar { width: 100%; max-width: 720px; display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; }
.topbar a { text-decoration: none; font-size: 0.85rem; }
