:root {
  --ink: #1a2332;
  --ink-soft: #2c3a52;
  --muted: #5b6473;
  --gold: #b8862e;
  --gold-light: #e8c77a;
  --paper: #fbf9f4;
  --paper-alt: #f2ede1;
  --white: #ffffff;
  --green: #2f8f5b;
  --red: #b0403f;
  --blue: #3a6ea5;
  --border: #e3ddd0;
  --radius: 10px;
  --shadow: 0 2px 10px rgba(26, 35, 50, 0.06);
  --shadow-lg: 0 12px 32px rgba(26, 35, 50, 0.12);
  font-size: 16px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.55;
}

body { display: flex; flex-direction: column; min-height: 100vh; }

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

h1, h2, h3, h4 { font-family: Georgia, 'Times New Roman', serif; color: var(--ink); line-height: 1.2; margin: 0 0 .5em; }
h1 { font-size: 2.1rem; }
h2 { font-size: 1.6rem; }
h3 { font-size: 1.25rem; }
p { margin: 0 0 1em; }

.container { width: 100%; max-width: 1120px; margin: 0 auto; padding: 0 20px; }
.container-narrow { width: 100%; max-width: 720px; margin: 0 auto; padding: 0 20px; }

/* --- Navigation --- */
.navbar {
  background: var(--ink);
  color: var(--white);
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: 0 1px 0 rgba(255,255,255,0.06);
}
.navbar .container { display: flex; align-items: center; justify-content: space-between; height: 64px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--white); font-family: Georgia, serif; font-weight: 700; font-size: 1.15rem; }
.brand:hover { text-decoration: none; color: var(--gold-light); }
.brand .brand-emoji { font-size: 1.5rem; }
.nav-links { display: flex; align-items: center; gap: 4px; list-style: none; margin: 0; padding: 0; flex-wrap: wrap; }
.nav-links a {
  color: #cfd6e2; padding: 8px 12px; border-radius: 6px; font-size: 0.92rem; font-weight: 500;
}
.nav-links a:hover, .nav-links a.active { color: var(--white); background: rgba(255,255,255,0.08); text-decoration: none; }
.nav-links a.nav-cta { background: var(--gold); color: var(--ink); font-weight: 700; }
.nav-links a.nav-cta:hover { background: var(--gold-light); }
.nav-toggle { display: none; }

@media (max-width: 880px) {
  .navbar .container { flex-wrap: wrap; height: auto; padding: 12px 20px; }
  .nav-links { width: 100%; justify-content: flex-start; padding-top: 8px; }
}

/* --- Buttons --- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 20px; border-radius: 8px; border: 1px solid transparent;
  font-size: 0.95rem; font-weight: 600; cursor: pointer; text-decoration: none;
  transition: all .15s ease; line-height: 1.2;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--ink); color: var(--white); }
.btn-primary:hover { background: var(--ink-soft); }
.btn-gold { background: var(--gold); color: #2c1c04; }
.btn-gold:hover { background: var(--gold-light); }
.btn-outline { background: transparent; border-color: var(--border); color: var(--ink); }
.btn-outline:hover { border-color: var(--ink); background: var(--paper-alt); }
.btn-danger { background: var(--red); color: var(--white); }
.btn-danger:hover { background: #8f3231; }
.btn-sm { padding: 6px 12px; font-size: 0.82rem; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }

/* --- Cards --- */
.card { background: var(--white); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 24px; }
.card + .card { margin-top: 16px; }
.card-flat { background: var(--white); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; }

.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 800px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }

/* --- Hero --- */
.hero {
  background: linear-gradient(135deg, var(--ink) 0%, #23324a 100%);
  color: var(--white);
  padding: 72px 0;
  text-align: center;
}
.hero h1 { color: var(--white); font-size: 2.6rem; }
.hero p.lead { color: #c9d1e0; font-size: 1.15rem; max-width: 640px; margin: 0 auto 28px; }
.hero .btn-row { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.stats-strip { background: var(--paper-alt); padding: 28px 0; border-bottom: 1px solid var(--border); }
.stats-strip .grid-3 { text-align: center; }
.stat-number { font-family: Georgia, serif; font-size: 2rem; color: var(--gold); font-weight: 700; }
.stat-label { color: var(--muted); font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.06em; }

/* --- Course cards --- */
.course-card { display: flex; flex-direction: column; height: 100%; }
.course-card .icon { font-size: 2.4rem; }
.course-card .meta-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; }
.badge {
  display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 0.75rem; font-weight: 700;
  background: var(--paper-alt); color: var(--ink-soft); border: 1px solid var(--border);
}
.badge-gold { background: #f6e9cf; color: #7a5312; border-color: #ecd6a4; }
.badge-green { background: #e2f3e8; color: var(--green); border-color: #c6e6d2; }
.badge-red { background: #f8e4e3; color: var(--red); border-color: #edc7c5; }
.badge-blue { background: #e5eef8; color: var(--blue); border-color: #c9dcef; }

/* --- Progress bar --- */
.progress-track { background: var(--paper-alt); border-radius: 999px; height: 12px; overflow: hidden; border: 1px solid var(--border); }
.progress-fill { background: linear-gradient(90deg, var(--gold), var(--gold-light)); height: 100%; transition: width .3s ease; }
.progress-label { font-size: 0.85rem; color: var(--muted); margin-top: 4px; }

/* --- Forms --- */
.form-group { margin-bottom: 18px; }
label { display: block; font-weight: 600; margin-bottom: 6px; font-size: 0.92rem; }
.hint { color: var(--muted); font-size: 0.82rem; margin-top: 4px; }
input[type=text], input[type=password], input[type=number], input[type=email],
select, textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px;
  font-size: 0.95rem; font-family: inherit; background: var(--white); color: var(--ink);
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--gold-light); border-color: var(--gold); }
textarea { min-height: 120px; resize: vertical; }
.checkbox-row { display: flex; align-items: center; gap: 8px; }
.checkbox-row input { width: auto; }
fieldset { border: 1px solid var(--border); border-radius: 8px; padding: 16px; margin-bottom: 18px; }
legend { padding: 0 8px; font-weight: 700; }

.auth-shell { max-width: 440px; margin: 48px auto; }
.auth-shell .card { padding: 32px; }

/* --- Alerts / flash --- */
.alert { padding: 12px 16px; border-radius: 8px; margin-bottom: 16px; font-size: 0.92rem; }
.alert-success { background: #e2f3e8; color: #1d5c3a; border: 1px solid #c6e6d2; }
.alert-error { background: #f8e4e3; color: #8a2c2b; border: 1px solid #edc7c5; }
.alert-warning { background: #fbf1d8; color: #7a5312; border: 1px solid #ecd6a4; }

/* --- Tables --- */
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); font-size: 0.92rem; }
th { color: var(--muted); font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.05em; }
tr:hover td { background: var(--paper-alt); }

/* --- Lesson / quiz interface --- */
.lesson-body { font-size: 1.05rem; }
.tip-box { background: #fff7e6; border: 1px solid var(--gold-light); border-left: 4px solid var(--gold); border-radius: 8px; padding: 16px 18px; margin: 20px 0; }
.tip-box .tip-title { font-weight: 700; color: #7a5312; margin-bottom: 6px; }
.curriculum-list { list-style: none; padding: 0; margin: 0; }
.curriculum-item {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 8px;
  border: 1px solid var(--border); margin-bottom: 8px; background: var(--white);
}
.curriculum-item.done { background: #f6faf7; }
.curriculum-item .check { width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--border); flex-shrink: 0; display: flex; align-items: center; justify-content: center; font-size: 0.8rem; }
.curriculum-item.done .check { background: var(--green); border-color: var(--green); color: white; }
.curriculum-item .module-tag { font-size: 0.75rem; color: var(--muted); text-transform: uppercase; }
.curriculum-item.locked { opacity: 0.55; }

.answer-option {
  display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; border: 1px solid var(--border);
  border-radius: 8px; margin-bottom: 8px; cursor: pointer; background: var(--white);
}
.answer-option:hover { border-color: var(--gold); background: #fffaf0; }
.answer-option input { margin-top: 3px; }

.quiz-result-score { text-align: center; padding: 32px 0; }
.quiz-result-score .big-score { font-size: 3rem; font-family: Georgia, serif; font-weight: 700; }
.pass-pill { display: inline-block; padding: 6px 18px; border-radius: 999px; font-weight: 700; font-size: 1.1rem; margin-top: 8px; }
.pass-pill.pass { background: #e2f3e8; color: var(--green); }
.pass-pill.fail { background: #f8e4e3; color: var(--red); }

/* --- Documents --- */
.doc-frame { width: 100%; height: 640px; border: 1px solid var(--border); border-radius: 8px; background: #eee; }

/* --- Verification --- */
.verify-hero { text-align: center; padding: 40px 0 10px; }
.verify-status { font-size: 2.2rem; font-weight: 700; margin-bottom: 6px; }
.verify-status.valid { color: var(--green); }
.verify-status.revoked { color: var(--red); }
.verify-detail-grid { display: grid; grid-template-columns: 160px 1fr; gap: 10px 20px; margin: 20px 0; }
.verify-detail-grid dt { color: var(--muted); font-weight: 600; }
.verify-detail-grid dd { margin: 0; }

/* --- Footer --- */
.site-footer { background: var(--ink); color: #b7c0cf; padding: 36px 0 24px; margin-top: auto; font-size: 0.88rem; }
.site-footer a { color: #d9e0ea; }
.site-footer .disclaimer { border-top: 1px solid rgba(255,255,255,0.12); margin-top: 20px; padding-top: 16px; color: #8792a3; font-size: 0.8rem; }
.footer-links { display: flex; gap: 16px; flex-wrap: wrap; margin-bottom: 10px; }

/* --- Empty states --- */
.empty-state { text-align: center; padding: 48px 20px; color: var(--muted); }
.empty-state .icon { font-size: 2.6rem; margin-bottom: 12px; }

/* --- Admin --- */
.admin-shell { display: grid; grid-template-columns: 220px 1fr; gap: 24px; align-items: start; }
.admin-sidebar { background: var(--white); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; position: sticky; top: 80px; }
.admin-sidebar a { display: block; padding: 8px 10px; border-radius: 6px; color: var(--ink); font-size: 0.9rem; margin-bottom: 2px; }
.admin-sidebar a:hover, .admin-sidebar a.active { background: var(--paper-alt); text-decoration: none; }
@media (max-width: 900px) { .admin-shell { grid-template-columns: 1fr; } .admin-sidebar { position: static; } }

.builder-module { border: 1px solid var(--border); border-radius: 10px; padding: 16px; margin-bottom: 16px; background: var(--paper-alt); }
.builder-lesson, .builder-quiz { background: var(--white); border: 1px solid var(--border); border-radius: 8px; padding: 12px 14px; margin-bottom: 8px; }
.inline-form { display: inline; }
.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.spacer { flex: 1; }

.page-header { display: flex; justify-content: space-between; align-items: flex-end; flex-wrap: wrap; gap: 12px; margin-bottom: 24px; }
.section { padding: 40px 0; }
.text-muted { color: var(--muted); }
.text-center { text-align: center; }
.mt-0 { margin-top: 0; }
.mb-0 { margin-bottom: 0; }
