:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --text: #1c2430;
  --muted: #5b6676;
  --border: #dde2e8;
  --brand: #1f4e79;
  --brand-ink: #ffffff;
  --brand-soft: #e7eef6;
  --ok: #1e7a46;
  --ok-soft: #e5f4ec;
  --warn: #9a5b00;
  --warn-soft: #fdf3e2;
  --err: #b42318;
  --err-soft: #fdecea;
  --radius: 10px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12161c; --surface: #1b2129; --text: #e6e9ee; --muted: #a2acb9; --border: #2e3742;
    --brand: #6ea8dc; --brand-ink: #0d1520; --brand-soft: #1d2b3a;
    --ok: #5cc28a; --ok-soft: #173025; --warn: #e3a64b; --warn-soft: #33270f; --err: #f07a6f; --err-soft: #3a1c1a;
  }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--brand); }
h1, h2, h3 { line-height: 1.25; }
h1 { font-size: 1.8rem; margin: 0 0 .5rem; }
.wrap { max-width: 980px; margin: 0 auto; padding: 0 16px; }
main.wrap { padding-top: 24px; padding-bottom: 48px; min-height: 60vh; }
main.auth { max-width: 520px; }
.muted { color: var(--muted); }
.small { font-size: .9rem; }

.topbar { background: var(--surface); border-bottom: 1px solid var(--border); }
.topbar-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; padding-top: 12px; padding-bottom: 12px; }
.brand { font-weight: 700; font-size: 1.1rem; color: var(--text); text-decoration: none; }
.topbar nav { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; font-size: .95rem; }
.topbar nav a { text-decoration: none; }
.inline { display: inline; margin: 0; }
.linklike { background: none; border: 0; color: var(--brand); font: inherit; cursor: pointer; padding: 0; }
.devbar { background: var(--warn-soft); color: var(--warn); text-align: center; padding: 6px 16px; font-size: .9rem; }
.footer { border-top: 1px solid var(--border); color: var(--muted); font-size: .85rem; padding: 16px 0 32px; }

.btn, button[type=submit], input[type=submit] {
  display: inline-block; background: var(--brand); color: var(--brand-ink); border: 0; border-radius: 8px;
  padding: 10px 18px; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; }
.btn:hover, button[type=submit]:hover { filter: brightness(1.08); }
.btn[disabled], button[disabled] { opacity: .5; cursor: not-allowed; }
.btn-secondary { background: var(--brand-soft); color: var(--brand); }
.btn-small { padding: 6px 12px; font-size: .9rem; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; margin-bottom: 16px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.price { font-size: 1.4rem; font-weight: 700; }
.pill { display: inline-block; font-size: .8rem; padding: 2px 10px; border-radius: 999px; background: var(--brand-soft); color: var(--brand); }
.pill-ok { background: var(--ok-soft); color: var(--ok); }
.pill-warn { background: var(--warn-soft); color: var(--warn); }
.pill-err { background: var(--err-soft); color: var(--err); }
.hero { padding: 24px 0 8px; }
.hero p { font-size: 1.1rem; color: var(--muted); max-width: 680px; }

.messages { list-style: none; padding: 0; margin: 0 0 16px; }
.msg { padding: 10px 14px; border-radius: 8px; margin-bottom: 8px; background: var(--brand-soft); }
.msg-success { background: var(--ok-soft); color: var(--ok); }
.msg-warning { background: var(--warn-soft); color: var(--warn); }
.msg-error { background: var(--err-soft); color: var(--err); }

/* Forms (also styles allauth's plain markup) */
form p, .field { margin: 0 0 14px; }
label { display: block; font-weight: 600; margin-bottom: 4px; }
input[type=text], input[type=email], input[type=password], input[type=tel], input[type=number], textarea, select {
  width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px;
  background: var(--surface); color: var(--text); font: inherit; }
textarea { min-height: 140px; }
input[type=checkbox] + label, .check label { display: inline; font-weight: 400; }
.helptext, form p span { display: block; color: var(--muted); font-size: .88rem; margin-top: 4px; }
.errorlist { color: var(--err); margin: 4px 0; padding-left: 18px; font-size: .9rem; }

/* Course player */
.progressbar { height: 10px; background: var(--brand-soft); border-radius: 999px; overflow: hidden; margin: 8px 0 4px; }
.progressbar > span { display: block; height: 100%; background: var(--brand); }
.outline { list-style: none; padding: 0; margin: 0; }
.outline li { display: flex; justify-content: space-between; gap: 12px; align-items: center; padding: 8px 0; border-top: 1px solid var(--border); }
.outline li:first-child { border-top: 0; }
.locked { color: var(--muted); }
.lesson-body { font-size: 1.05rem; }
.lesson-body img, .lesson-body video { max-width: 100%; height: auto; border-radius: 8px; }
.timer { font-variant-numeric: tabular-nums; }
.sticky-actions { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }

.question { padding: 16px 0; border-top: 1px solid var(--border); }
.question:first-of-type { border-top: 0; }
.question .prompt { font-weight: 600; margin-bottom: 8px; }
.choice { display: flex; gap: 10px; align-items: flex-start; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; margin-bottom: 6px; cursor: pointer; }
.choice input { margin-top: 4px; }
.choice span { font-weight: 400; }
.q-error { color: var(--err); font-size: .9rem; }
.ans-right { color: var(--ok); }
.ans-wrong { color: var(--err); }
.score { font-size: 2.4rem; font-weight: 800; }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 8px; border-bottom: 1px solid var(--border); }

/* Course content */
.draft-banner { padding: 8px 12px; border: 1px dashed var(--err); color: var(--err); border-radius: 8px; }
.lesson-body blockquote { margin: 16px 0; padding: 10px 16px; border-left: 4px solid var(--brand); background: var(--brand-soft); border-radius: 0 8px 8px 0; }
.lesson-body table { margin: 12px 0; }
.sources { margin-top: 28px; padding-top: 12px; border-top: 1px solid var(--border); font-size: .88rem; color: var(--muted); }
.sources h3 { font-size: .95rem; margin: 0 0 6px; }
.sources ul { margin: 0; padding-left: 18px; }
.preview-q { margin: 10px 0 14px; }
.preview-q .correct { color: var(--ok); font-weight: 600; }
@media print { .topbar, .footer, .devbar { display: none; } .card { break-inside: avoid-page; border: 0; } }

/* Privacy policy and terms */
.legal { max-width: 720px; line-height: 1.6; }
.legal h2 { margin-top: 1.6em; }
.legal li { margin-bottom: .4em; }
