/* Lectern design tokens and base components. No external fonts (works offline). */
:root {
  --ink: #1D3557;
  --accent: #2B6CB0;
  --accent-hover: #245C97;
  --accent-soft: #E6EFF9;
  --amber: #F2B544;
  --bg: #F4F6F9;
  --surface: #FFFFFF;
  --surface-2: #F8FAFC;
  --border: #DCE2EA;
  --border-strong: #C3CCD8;
  --text: #1B2533;
  --text-muted: #5A6B80;
  --danger: #B42318;
  --danger-soft: #FDECEA;
  --ok: #1E7A46;
  --ok-soft: #E5F4EB;
  --warn: #8A5A00;
  --warn-soft: #FFF4DB;
  --focus: 0 0 0 3px rgba(242, 181, 68, .55);
  --radius: 10px;
  --radius-sm: 7px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 4px 16px rgba(16, 24, 40, .06);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --ink: #E8EEF6;
    --accent: #5B9BE0;
    --accent-hover: #74ACE6;
    --accent-soft: #1C2D44;
    --bg: #0F1722;
    --surface: #16202D;
    --surface-2: #1B2736;
    --border: #2A3748;
    --border-strong: #3A4A5F;
    --text: #E3E9F1;
    --text-muted: #9AABBF;
    --danger: #F2867D;
    --danger-soft: #3A1E1E;
    --ok: #6FCF97;
    --ok-soft: #173326;
    --warn: #F2C46D;
    --warn-soft: #3A2E14;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 16px rgba(0, 0, 0, .25);
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font: 15px/1.5 var(--font);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.45rem; margin: 0 0 .35rem; color: var(--ink); letter-spacing: -.01em; }
h2 { font-size: 1.1rem; margin: 0 0 .75rem; color: var(--ink); }
p { margin: .5rem 0 1rem; }
.muted { color: var(--text-muted); }
.center { text-align: center; }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: 4px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
  font: inherit; font-weight: 600; font-size: .93rem;
  padding: .55rem 1rem; border-radius: var(--radius-sm);
  border: 1px solid transparent; cursor: pointer; text-decoration: none;
  transition: background .12s, border-color .12s, color .12s;
}
.btn:hover { text-decoration: none; }
.btn { white-space: nowrap; }
.btn svg { width: 18px; height: 18px; flex: none; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover:not([disabled]) { background: var(--accent-hover); }
.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--border-strong); }
.btn-secondary:hover:not([disabled]) { background: var(--surface-2); }
.btn-ghost { background: transparent; color: var(--text); }
.btn-ghost:hover:not([disabled]) { background: var(--accent-soft); }
.btn-block { width: 100%; }

/* Forms */
.field { margin-bottom: 1rem; }
.field label { display: block; font-weight: 600; font-size: .9rem; margin-bottom: .3rem; }
.field input[type=text], .field input[type=email], .field input[type=password], .field input[type=search],
.field select, .field textarea {
  width: 100%; font: inherit; color: var(--text); background: var(--surface);
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm); padding: .55rem .7rem;
}
.field input:focus { border-color: var(--accent); outline: none; box-shadow: var(--focus); }
.field.has-error input { border-color: var(--danger); }
.field .help { font-size: .82rem; color: var(--text-muted); margin: .3rem 0 0; }
.field .help ul { margin: .2rem 0 0; padding-left: 1.1rem; }
.field .error { font-size: .85rem; color: var(--danger); margin: .3rem 0 0; }
.field-check label { display: flex; align-items: center; gap: .55rem; font-weight: 500; }
.field-check input { width: 1.05rem; height: 1.05rem; accent-color: var(--accent); }
.actions { display: flex; justify-content: flex-end; gap: .5rem; margin-top: 1rem; }
.inline-form { margin: .5rem 0 0; }

/* Alerts and badges */
.alert { padding: .65rem .85rem; border-radius: var(--radius-sm); margin-bottom: 1rem; font-size: .92rem; border: 1px solid transparent; }
.alert-info { background: var(--accent-soft); border-color: var(--border); }
.alert-success { background: var(--ok-soft); color: var(--ok); }
.alert-warning { background: var(--warn-soft); color: var(--warn); }
.alert-error { background: var(--danger-soft); color: var(--danger); }
.badge { display: inline-block; font-size: .75rem; font-weight: 600; padding: .1rem .5rem; border-radius: 999px; vertical-align: 1px; }
.badge-ok { background: var(--ok-soft); color: var(--ok); }
.badge-warn { background: var(--warn-soft); color: var(--warn); }

/* Cards */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.5rem; }
.card + .card { margin-top: 1rem; }
.narrow { max-width: 640px; margin-left: auto; margin-right: auto; }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: .4rem 1.25rem; margin: 1rem 0; }
.facts dt { color: var(--text-muted); }
.facts dd { margin: 0; }
.disclosure { margin-top: 1rem; }
.disclosure summary { cursor: pointer; color: var(--accent); font-weight: 600; }

/* Auth pages */
body.auth {
  min-height: 100vh;
  background:
    radial-gradient(1200px 500px at 50% -10%, var(--accent-soft), transparent 70%),
    var(--bg);
}
.auth-shell { max-width: 420px; margin: 0 auto; padding: 48px 16px 32px; }
.auth-logo { display: flex; justify-content: center; margin-bottom: 1.5rem; }
.auth-logo img { height: 72px; width: auto; }
.auth-card h1 { text-align: left; }
.auth-foot { text-align: center; color: var(--text-muted); margin-top: 1.25rem; }

/* Top bar (shared by pages and the workspace) */
.topbar {
  height: 56px; display: flex; align-items: center; gap: 1rem; padding: 0 16px;
  background: var(--surface); border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: .55rem; font-weight: 700; color: var(--ink); font-size: 1.05rem; }
.brand:hover { text-decoration: none; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: .4rem; }
.topbar-actions form { margin: 0; }
.page-body { padding: 24px 16px 48px; }

/* Workspace styles live in app.css */
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover:not([disabled]) { filter: brightness(1.08); }
.btn-sm { padding: .35rem .7rem; font-size: .85rem; }
.btn.danger, .btn-ghost.danger { color: var(--danger); }
.avatar {
  width: 32px; height: 32px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  background: var(--ink); color: var(--surface); font-weight: 700; font-size: .85rem; border: 0; cursor: pointer; flex: none;
}
.menu { position: relative; }
.menu-panel {
  position: absolute; right: 0; top: calc(100% + 6px); min-width: 220px; z-index: 60;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 6px;
}
.menu-panel .who { padding: .5rem .7rem .6rem; border-bottom: 1px solid var(--border); margin-bottom: 4px; }
.menu-panel .who strong { display: block; }
.menu-panel a, .menu-panel button {
  display: flex; align-items: center; gap: .6rem; width: 100%; text-align: left; font: inherit; color: var(--text);
  background: none; border: 0; padding: .45rem .7rem; border-radius: var(--radius-sm); cursor: pointer;
}
.menu-panel a:hover, .menu-panel button:hover:not([disabled]), .menu-panel button:focus-visible { background: var(--surface-2); text-decoration: none; }
.menu-panel button[disabled] { opacity: .45; cursor: default; }
.menu-panel button.danger { color: var(--danger); }
.menu-panel hr { border: 0; border-top: 1px solid var(--border); margin: 4px 0; }
.menu-panel kbd { margin-left: auto; }
.noscript { padding: 2rem; text-align: center; }
body.app .messages { position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%); z-index: 80; min-width: 280px; }

/* Two-step verification */
.steps { padding-left: 1.2rem; }
.steps li { margin-bottom: 1rem; }
.qr { margin: .8rem 0; }
.qr img { border: 1px solid var(--border); border-radius: 8px; background: #fff; }
.secret { font: 600 1rem var(--mono); letter-spacing: .05em; background: var(--surface-2); padding: .2rem .4rem; border-radius: 4px; }
.inline-code { display: flex; gap: .5rem; margin-top: .5rem; flex-wrap: wrap; }
.inline-code input { font: 600 1.05rem var(--mono); width: 10ch; padding: .45rem .6rem; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); color: var(--text); background: var(--surface); }
.recovery-codes { columns: 2; font-size: 1.05rem; padding-left: 1.4rem; }
.recovery-codes code { font-family: var(--mono); }
hr.sep { border: 0; border-top: 1px solid var(--border); margin: 1.2rem 0; }

/* Sign-up captcha and honeypot */
.captcha { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; margin-bottom: .45rem; }
.captcha-img { display: block; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: #F6F8FB; max-width: 100%; height: auto; }
.captcha-new { font-size: .85rem; }
.captcha-input { text-transform: uppercase; letter-spacing: .15em; }
.field-hp { position: absolute !important; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.notice { background: var(--accent-soft); border-radius: var(--radius-sm); padding: .6rem .75rem; font-size: .9rem; margin: 0 0 1rem; }
