:root {
  --bg: #0f172a;
  --bg-accent: #1e293b;
  --card: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --brand: #4f46e5;
  --brand-dark: #4338ca;
  --ok-bg: #ecfdf5;
  --ok-border: #6ee7b7;
  --ok-text: #065f46;
  --border: #e2e8f0;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--text);
  background: radial-gradient(1200px 600px at 50% -10%, var(--bg-accent), var(--bg));
}

.card {
  width: 100%;
  max-width: 640px;
  background: var(--card);
  border-radius: 16px;
  box-shadow: 0 20px 50px rgba(2, 6, 23, 0.35);
  padding: 2.25rem;
}

.card--narrow {
  max-width: 420px;
}

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

/* The docs page is a full, scrollable page rather than a centred dialog. */
body.docs {
  align-items: flex-start;
}

.card__header h1 {
  margin: 0;
  font-size: 1.6rem;
}

.card__topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.card__links {
  display: flex;
  gap: 1rem;
}

.nav-link {
  color: var(--brand);
  font-weight: 600;
  font-size: 0.9rem;
  text-decoration: none;
}

.nav-link:hover { text-decoration: underline; }

.form-error {
  margin: 1.25rem 0 0;
  padding: 0.7rem 0.9rem;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 8px;
  color: #b91c1c;
  font-size: 0.9rem;
}

.subtitle {
  margin: 0.35rem 0 0;
  color: var(--muted);
}

.tabs {
  display: flex;
  gap: 0.25rem;
  margin-top: 1.5rem;
  border-bottom: 1px solid var(--border);
}

.tab {
  padding: 0.6rem 0.9rem;
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}

.tab:hover { color: var(--text); }

.tab.is-active {
  color: var(--brand);
  border-bottom-color: var(--brand);
}

.tab-panel { display: none; }
.tab-panel.is-active { display: block; }

.instructions {
  margin-top: 1.75rem;
}

.instructions h2 {
  font-size: 1.1rem;
  margin: 0 0 0.75rem;
}

.instructions h3 {
  font-size: 0.95rem;
  margin: 1.5rem 0 0.5rem;
}

.instructions p {
  margin: 0.5rem 0;
  color: var(--text);
}

.instructions__code {
  margin: 0.5rem 0;
  padding: 0.75rem 0.9rem;
  background: var(--bg-accent);
  color: #e2e8f0;
  border-radius: 8px;
  overflow-x: auto;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.85rem;
}

.instructions__code code { white-space: pre-wrap; word-break: break-all; }

.key-banner {
  margin: 1.75rem 0 0;
  padding: 1.1rem 1.25rem;
  background: var(--ok-bg);
  border: 1px solid var(--ok-border);
  border-radius: 12px;
  color: var(--ok-text);
}

.key-banner p { margin: 0 0 0.5rem; }
.key-banner__label { font-weight: 600; }

.key-banner__row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.key-banner__value {
  flex: 1;
  padding: 0.55rem 0.75rem;
  background: #ffffff;
  border: 1px solid var(--ok-border);
  border-radius: 8px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.85rem;
  word-break: break-all;
}

.create-form {
  margin-top: 1.75rem;
}

.create-form label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.45rem;
}

.create-form label ~ label {
  margin-top: 0.85rem;
}

.create-form__row {
  display: flex;
  gap: 0.5rem;
  margin-top: 1rem;
}

.create-form input,
.create-form select {
  width: 100%;
  padding: 0.65rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 1rem;
  background: #ffffff;
}

.create-form__row input,
.create-form__row select {
  flex: 1;
  width: auto;
}

.create-form__row .btn {
  flex-shrink: 0;
}

.create-form input:focus,
.create-form select:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
}

.btn--block {
  width: 100%;
  margin-top: 1.25rem;
}

.btn {
  padding: 0.65rem 1.1rem;
  border: none;
  border-radius: 8px;
  background: var(--brand);
  color: #ffffff;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease;
  white-space: nowrap;
}

.btn:hover { background: var(--brand-dark); }

.btn--ghost {
  background: transparent;
  color: var(--ok-text);
  border: 1px solid var(--ok-border);
}

.btn--ghost:hover { background: rgba(6, 95, 70, 0.08); }

.accounts {
  margin-top: 2rem;
  border-top: 1px solid var(--border);
  padding-top: 1.5rem;
}

.accounts h2 {
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.count {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--brand);
  background: rgba(79, 70, 229, 0.1);
  border-radius: 999px;
  padding: 0.1rem 0.6rem;
}

.accounts__list {
  list-style: none;
  margin: 0.75rem 0 0;
  padding: 0;
}

.accounts__list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 0.5rem;
  font-size: 0.95rem;
}

.accounts__email {
  word-break: break-all;
}

.regen-form {
  margin: 0;
  flex-shrink: 0;
}

.btn--small {
  padding: 0.4rem 0.75rem;
  font-size: 0.85rem;
}

.accounts__email {
  flex: 1;
}

.role-badge {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  border-radius: 999px;
  padding: 0.15rem 0.55rem;
}

.role-badge--admin {
  color: var(--brand-dark);
  background: rgba(79, 70, 229, 0.12);
}

.role-badge--user {
  color: var(--muted);
  background: rgba(100, 116, 139, 0.12);
}

.logs {
  width: 100%;
  border-collapse: collapse;
  margin-top: 0.75rem;
  font-size: 0.9rem;
}

.logs th,
.logs td {
  text-align: left;
  padding: 0.55rem 0.6rem;
  border-bottom: 1px solid var(--border);
}

.logs th {
  color: var(--muted);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.logs__endpoint {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  word-break: break-all;
}

.kind-badge {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  border-radius: 999px;
  padding: 0.12rem 0.5rem;
}

.kind-badge--api {
  color: #065f46;
  background: var(--ok-bg);
}

.kind-badge--mcp {
  color: var(--brand-dark);
  background: rgba(79, 70, 229, 0.12);
}

.accounts__empty {
  color: var(--muted);
  margin: 0.75rem 0 0;
}

.refresh-log {
  margin-top: 2rem;
  border-top: 1px solid var(--border);
  padding-top: 1.5rem;
}

.refresh-log h2 {
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.refresh-log__list {
  list-style: none;
  margin: 0.75rem 0 0;
  padding: 0;
}

.refresh-log__list li {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 0.5rem;
  font-size: 0.95rem;
}

.refresh-log__source {
  font-weight: 600;
}

.refresh-log__detail {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  color: var(--muted);
}

.refresh-log__rows {
  color: var(--muted);
}

.refresh-log__time {
  margin-left: auto;
  color: var(--muted);
  font-size: 0.85rem;
}

.refresh-log__empty {
  color: var(--muted);
  margin: 0.75rem 0 0;
}

/* --- Request analytics (issue 48) --------------------------------------- */

.period-nav {
  display: flex;
  gap: 0.4rem;
  margin-top: 0.75rem;
}

.period {
  font-size: 0.85rem;
  color: var(--muted);
  text-decoration: none;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.2rem 0.7rem;
}

.period:hover { color: var(--text); }

.period.is-active {
  color: #fff;
  background: var(--brand);
  border-color: var(--brand);
}

.stats {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

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

.stat__value {
  display: block;
  font-size: 1.4rem;
  font-weight: 600;
}

.stat__label {
  display: block;
  margin-top: 0.15rem;
  color: var(--muted);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.analytics-block {
  margin-top: 2rem;
  border-top: 1px solid var(--border);
  padding-top: 1.5rem;
}

.analytics-block h2 {
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0;
}

.analytics-block__empty {
  color: var(--muted);
  margin: 0.75rem 0 0;
}

.bars {
  list-style: none;
  margin: 0.75rem 0 0;
  padding: 0;
}

.bars__row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.9rem;
  padding: 0.2rem 0;
}

.bars__label {
  width: 6.5rem;
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

.bars__track {
  flex: 1;
  height: 0.6rem;
  border-radius: 999px;
  background: var(--border);
  overflow: hidden;
}

.bars__fill {
  display: block;
  height: 100%;
  background: var(--brand);
}

.bars__value {
  width: 3.5rem;
  text-align: right;
}

.kind-badge--page {
  color: var(--muted);
  background: rgba(100, 116, 139, 0.12);
}

.logs__row--expandable {
  cursor: pointer;
}

.logs__row--expandable:hover {
  background: rgba(79, 70, 229, 0.06);
}

.logs__arguments pre {
  margin: 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.82rem;
  white-space: pre-wrap;
  word-break: break-all;
}
