/* Codex Regulatory — branding matched to staff-doormat IdP
 * (dark blue card on dark blue background, muted-blue accent).
 * Single dark theme; no light-mode toggle in v1. */

:root {
  --bg: #162132;
  --bg-elev: #202b3c;
  --bg-elev-2: #2a3650;
  --text: #d7e7ef;
  --text-muted: rgba(215, 231, 239, 0.65);
  --text-faint: rgba(215, 231, 239, 0.45);
  --accent: #7c9cb6;
  --accent-text: #162132;
  --border: rgba(215, 231, 239, 0.12);
  --border-strong: rgba(215, 231, 239, 0.25);
  --danger: #ef4444;
  --warn: #d97706;
  --ok: #16a34a;

  --section-evaluative: #d97706;
  --section-stable: #818cf8;
  --section-dynamic: #34d399;

  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 4px 18px rgba(0, 0, 0, 0.25);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.55 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  min-height: 100vh;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

code, .mono {
  font-family: ui-monospace, SFMono-Regular, "JetBrains Mono", Menlo, Monaco, monospace;
  font-size: 0.9em;
}

/* ─── Top bar ───────────────────────────────────────────────────────── */

.topbar {
  background: var(--bg-elev);
  border-bottom: 1px solid var(--border);
}

.topbar-inner {
  max-width: 64em;
  margin: 0 auto;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  font-weight: 600;
  color: var(--text);
}
.brand:hover { text-decoration: none; }

.brand-mark { font-size: 1.05rem; letter-spacing: 0.04em; }

.brand-sub {
  font-size: 0.7rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-weight: 500;
  color: var(--accent);
}

.topbar-nav {
  display: flex;
  align-items: center;
  gap: 16px;
}

.user {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
}
.user-name { color: var(--text); }
.user-email { color: var(--text-faint); font-size: 0.78rem; }

.badge {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 2px 7px;
  border-radius: 999px;
  font-weight: 600;
}
.badge-signer {
  background: color-mix(in srgb, var(--accent) 25%, transparent);
  color: var(--text);
  border: 1px solid color-mix(in srgb, var(--accent) 40%, transparent);
}
.badge-viewer {
  background: rgba(215, 231, 239, 0.08);
  color: var(--text-muted);
  border: 1px solid var(--border);
}

.logout-form { margin: 0; }

.btn-link {
  background: none;
  border: none;
  color: var(--accent);
  cursor: pointer;
  font-size: 0.85rem;
  padding: 4px 2px;
  font-family: inherit;
}
.btn-link:hover { text-decoration: underline; }

/* ─── Page container ────────────────────────────────────────────────── */

.page {
  max-width: 64em;
  margin: 0 auto;
  padding: 32px 24px;
}

.page > section + section { margin-top: 32px; }

h1, h2, h3 { font-weight: 600; line-height: 1.25; }
h1 { font-size: 1.5rem; margin: 0 0 0.5em; }
h2 {
  font-size: 1.05rem;
  margin: 0 0 1em;
  color: var(--accent);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 500;
}
h3 { font-size: 1.05rem; margin: 0 0 0.4em; }

p { margin: 0 0 1em; }
p.muted, .muted { color: var(--text-muted); }

/* ─── Login page ────────────────────────────────────────────────────── */

.login-card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 40px 32px;
  max-width: 420px;
  margin: 12vh auto 0;
  text-align: center;
  box-shadow: var(--shadow);
}

.login-card h1 { font-size: 1.4rem; margin-bottom: 4px; }

.login-card .subtitle {
  font-size: 0.78rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-weight: 500;
  color: var(--accent);
  margin-bottom: 2em;
}

.button-primary {
  display: inline-block;
  background: var(--accent);
  color: var(--accent-text);
  padding: 12px 24px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.95rem;
  border: none;
  cursor: pointer;
  margin: 8px 0 18px;
  transition: opacity 0.15s ease;
}
.button-primary:hover { opacity: 0.88; text-decoration: none; }

.login-card .help {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin: 0;
}

/* ─── Dashboard / lists ─────────────────────────────────────────────── */

ul.drafts, ul.signed {
  list-style: none;
  margin: 0;
  padding: 0;
}

ul.drafts > li, ul.signed > li {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-bottom: 12px;
}

ul.drafts li a, ul.signed li a {
  color: var(--text);
  font-weight: 600;
  font-size: 1rem;
}
ul.drafts li a:hover, ul.signed li a:hover {
  color: var(--accent);
  text-decoration: none;
}

.version {
  display: inline-block;
  margin-left: 10px;
  font-size: 0.75rem;
  font-family: ui-monospace, SFMono-Regular, monospace;
  color: var(--text-muted);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  background: rgba(215, 231, 239, 0.06);
}

.progress {
  display: block;
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-top: 4px;
}

details.what-changed {
  margin-top: 10px;
  border-top: 1px solid var(--border);
  padding-top: 10px;
}
details.what-changed summary {
  cursor: pointer;
  font-size: 0.85rem;
  color: var(--accent);
  user-select: none;
}
details.what-changed p { margin: 8px 0 4px; }
details.what-changed ul { margin: 4px 0 0 18px; padding: 0; }

/* ─── Doc detail ────────────────────────────────────────────────────── */

.doc-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}
.doc-header h2 { color: var(--text); text-transform: none; letter-spacing: 0; font-size: 1.3rem; }

.section {
  border-left: 3px solid var(--border-strong);
  background: var(--bg-elev);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 14px 18px;
  margin: 16px 0;
}
.section-evaluative { border-left-color: var(--section-evaluative); }
.section-stable { border-left-color: var(--section-stable); }
.section-dynamic { border-left-color: var(--section-dynamic); }

.guidance {
  background: rgba(217, 119, 6, 0.08);
  border: 1px solid rgba(217, 119, 6, 0.2);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  margin-top: 10px;
  font-size: 0.9rem;
  color: var(--text);
}

.signing {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  flex-wrap: wrap;
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}
.signing form { margin: 0; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }

button:not(.btn-link):not(.button-primary) {
  background: var(--bg-elev-2);
  color: var(--text);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 8px 14px;
  cursor: pointer;
  font-size: 0.88rem;
  font-family: inherit;
  transition: background 0.15s ease;
}
button:not(.btn-link):not(.button-primary):hover {
  background: color-mix(in srgb, var(--accent) 18%, var(--bg-elev-2));
}

textarea, input {
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  font-family: inherit;
  font-size: 0.9rem;
}
textarea:focus, input:focus {
  outline: none;
  border-color: var(--accent);
}

/* ─── Not-enrolled page ─────────────────────────────────────────────── */

.not-enrolled {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
  max-width: 560px;
  margin: 8vh auto 0;
  box-shadow: var(--shadow);
}
.not-enrolled h1 { font-size: 1.3rem; }
.not-enrolled code {
  background: rgba(215, 231, 239, 0.08);
  padding: 2px 6px;
  border-radius: 4px;
}

/* ─── Empty state ───────────────────────────────────────────────────── */

.empty {
  color: var(--text-muted);
  font-style: italic;
  padding: 14px 18px;
  background: var(--bg-elev);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
}
