:root {
  --forja-navy: #03152c;
  --forja-blue: #0a355b;
  --forja-mid-blue: #12639f;
  --forja-gold: #ffb30f;
  --forja-gray: #d7d8da;
  --forja-white: #ffffff;
  --page: #f3f6f9;
  --ink: #172033;
  --muted: #687385;
  --border: rgba(16, 63, 101, 0.16);
  --shadow: 0 18px 45px rgba(6, 25, 46, 0.10);
  --success: #207a46;
  --success-bg: #eaf7ef;
  --danger: #a63232;
  --danger-bg: #fff0f0;
  --warning: #8b5d00;
  --warning-bg: #fff7df;
  --radius: 16px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--page);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
img, svg { max-width: 100%; }
[hidden] { display: none !important; }

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  min-height: 76px;
  padding: 0 clamp(18px, 5vw, 72px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 22px;
  color: #fff;
  background: var(--forja-navy);
  border-bottom: 3px solid var(--forja-gold);
  box-shadow: 0 8px 24px rgba(6, 25, 46, .22);
}
.brand { display: inline-flex; align-items: center; gap: 12px; }
.brand-logo {
  width: 58px;
  height: 58px;
  display: block;
  flex: 0 0 58px;
  object-fit: contain;
  border-radius: 12px;
  mix-blend-mode: screen;
  filter: drop-shadow(0 5px 12px rgba(0,0,0,.32));
}
.brand-copy strong, .brand-copy small { display: block; line-height: 1; letter-spacing: .16em; }
.brand-copy strong { font-size: 1.24rem; }
.brand-copy small { margin-top: 5px; color: var(--forja-gold); font-size: .63rem; font-weight: 900; }
.site-nav { display: flex; align-items: center; gap: 22px; }
.site-nav a { color: rgba(255,255,255,.78); font-size: .92rem; }
.site-nav a:hover, .site-nav a.active { color: var(--forja-gold); }
.nav-with-badge { display: inline-flex; align-items: center; gap: 7px; }
.nav-badge { min-width: 20px; height: 20px; padding: 0 6px; display: inline-grid; place-items: center; border-radius: 999px; color: var(--forja-navy); background: var(--forja-gold); font-size: .68rem; font-weight: 950; }
.user-menu { display: flex; align-items: center; gap: 10px; }
.user-chip {
  min-height: 40px;
  padding: 0 13px;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  border: 1px solid rgba(255,255,255,.24);
  border-radius: 999px;
  background: rgba(255,255,255,.06);
}
.user-avatar {
  width: 29px;
  height: 29px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: var(--forja-navy);
  background: var(--forja-gold);
  font-size: .78rem;
  font-weight: 900;
}
.user-name { max-width: 160px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: .83rem; font-weight: 800; }
.student-menu-toggle { display:none; width:42px; height:42px; place-items:center; border:1px solid rgba(255,255,255,.3); border-radius:10px; color:#fff; background:rgba(255,255,255,.08); font-size:1.25rem; }
.student-sidebar { position:fixed; z-index:42; top:76px; bottom:0; left:0; width:244px; padding:22px 14px; overflow-y:auto; color:#fff; background:var(--forja-navy); border-right:1px solid rgba(255,255,255,.1); }
.student-nav { display:grid; gap:6px; }
.student-nav > a,.student-nav-group > button,.student-nav-submenu a { width:100%; min-height:44px; padding:10px 13px; display:flex; align-items:center; justify-content:space-between; gap:10px; border:0; border-radius:9px; color:rgba(255,255,255,.78); background:transparent; text-align:left; font-size:.9rem; font-weight:800; }
.student-nav > a:hover,.student-nav > a.active,.student-nav-group > button:hover,.student-nav-submenu a:hover,.student-nav-submenu a.active { color:var(--forja-navy); background:var(--forja-gold); }
.student-nav-group { display:grid; }
.student-nav-submenu { display:grid; gap:4px; padding:4px 0 4px 12px; }
.student-nav-submenu a { min-height:38px; font-size:.82rem; }
.student-sidebar-backdrop { display:none; }
body.student-portal > main,body.student-portal > .question-shell,body.student-portal > #question-loading,body.student-portal > [data-footer] { margin-left:244px; }

.container { width: min(1180px, calc(100% - 36px)); margin: 0 auto; }
.page-section { padding: 54px 0 76px; }
.page-title { margin: 0; color: var(--forja-navy); font-size: clamp(2rem, 4vw, 3.4rem); line-height: 1.05; letter-spacing: -.035em; }
.page-subtitle { max-width: 760px; margin: 14px 0 0; color: var(--muted); line-height: 1.7; }
.eyebrow { margin: 0 0 8px; color: var(--forja-gold); font-size: .72rem; font-weight: 900; letter-spacing: .17em; text-transform: uppercase; }
.eyebrow.blue { color: var(--forja-mid-blue); }
.section-heading { margin-bottom: 24px; }
.section-heading h2 { margin: 0; color: var(--forja-navy); font-size: clamp(1.55rem, 3vw, 2.35rem); }
.section-heading p { margin: 9px 0 0; color: var(--muted); }

.card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.card-body { padding: 24px; }
.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0,1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0,1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0,1fr)); }

.button {
  min-height: 44px;
  padding: 0 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: 10px;
  font-weight: 850;
  transition: .16s ease;
}
.button:hover { transform: translateY(-1px); }
.button:disabled { cursor: not-allowed; opacity: .6; transform: none; }
.button-primary { color: #fff; background: var(--forja-blue); }
.button-primary:hover { background: var(--forja-mid-blue); }
.button-gold { color: var(--forja-navy); background: var(--forja-gold); box-shadow: 0 9px 22px rgba(237,186,57,.24); }
.button-outline { color: var(--forja-blue); background: #fff; border-color: rgba(16,63,101,.28); }
.button-danger { color: #fff; background: var(--danger); }
.button-ghost { color: var(--forja-blue); background: transparent; }
.button-small { min-height: 36px; padding: 0 12px; font-size: .83rem; }
.button-row { display: flex; flex-wrap: wrap; gap: 10px; }

.badge { display: inline-flex; align-items: center; min-height: 25px; padding: 0 9px; border-radius: 999px; font-size: .68rem; font-weight: 900; letter-spacing: .05em; text-transform: uppercase; }
.badge-success { color: var(--success); background: var(--success-bg); }
.badge-warning { color: var(--warning); background: var(--warning-bg); }
.badge-danger { color: var(--danger); background: var(--danger-bg); }
.badge-neutral { color: var(--forja-blue); background: #edf3f8; }

.progress-track { height: 9px; overflow: hidden; background: #e4eaf0; border-radius: 999px; }
.progress-bar { height: 100%; background: var(--forja-gold); border-radius: inherit; transition: width .25s ease; }

.form-group { display: grid; gap: 7px; }
.form-group label { color: var(--forja-navy); font-size: .84rem; font-weight: 850; }
.input, .select, .textarea {
  width: 100%;
  min-height: 46px;
  padding: 0 13px;
  border: 1px solid rgba(16,63,101,.24);
  border-radius: 10px;
  color: var(--ink);
  background: #fff;
  outline: none;
}
.textarea { min-height: 110px; padding-top: 12px; resize: vertical; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--forja-mid-blue); box-shadow: 0 0 0 3px rgba(16,93,156,.12); }
.form-help { margin: 0; color: var(--muted); font-size: .78rem; line-height: 1.5; }
.form-error { margin: 0; color: var(--danger); font-size: .82rem; font-weight: 700; }
.form-success { margin: 0; color: var(--success); font-size: .82rem; font-weight: 700; }

.breadcrumb { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; color: var(--muted); font-size: .82rem; }
.breadcrumb a:hover { color: var(--forja-mid-blue); }

.table-wrap { overflow-x: auto; background: #fff; border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow); }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 14px 16px; border-bottom: 1px solid rgba(16,63,101,.11); text-align: left; vertical-align: middle; }
th { color: var(--forja-blue); background: #f7fafc; font-size: .75rem; letter-spacing: .05em; text-transform: uppercase; }
td { font-size: .9rem; }
tr:last-child td { border-bottom: 0; }

.empty-state, .error-state, .loading-state {
  padding: 34px;
  text-align: center;
  background: #fff;
  border: 1px dashed rgba(16,63,101,.25);
  border-radius: 14px;
  color: var(--muted);
}
.error-state { color: var(--danger); background: var(--danger-bg); }

.toast-region { position: fixed; right: 18px; bottom: 18px; z-index: 100; display: grid; gap: 10px; }
.toast { width: min(360px, calc(100vw - 36px)); padding: 14px 16px; border-radius: 12px; color: #fff; background: var(--forja-navy); box-shadow: 0 16px 40px rgba(6,25,46,.28); font-size: .88rem; line-height: 1.5; }
.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }

.modal-backdrop { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; padding: 20px; background: rgba(6,25,46,.62); }
.modal { width: min(620px, 100%); max-height: 90vh; overflow: auto; background: #fff; border-radius: 18px; box-shadow: 0 30px 80px rgba(0,0,0,.3); }
.modal.modal-large { width: min(900px, 100%); }
.modal-header, .modal-footer { padding: 18px 22px; display: flex; align-items: center; justify-content: space-between; gap: 12px; border-bottom: 1px solid var(--border); }
.modal-footer { border-top: 1px solid var(--border); border-bottom: 0; }
.modal-body { padding: 22px; display: grid; gap: 16px; }
.icon-button { width: 38px; height: 38px; display: grid; place-items: center; border: 0; border-radius: 50%; color: var(--forja-blue); background: #edf3f8; }

.site-footer { padding: 13px 20px; text-align: center; color: rgba(255,255,255,.72); background: var(--forja-navy); }
.site-footer strong { color: var(--forja-gold); letter-spacing: .12em; }
.legal-footer { display: grid; gap: 5px; }
.legal-footer p { width: min(980px, 100%); margin: 0 auto; font-size: .7rem; line-height: 1.35; }
.legal-footer nav { display: flex; justify-content: center; flex-wrap: wrap; gap: 18px; font-size: .8rem; font-weight: 800; }
.legal-footer a { color: #fff; text-decoration: underline; text-underline-offset: 3px; }
.legal-footer [data-cookie-settings] { padding:0; border:0; color:#fff; background:transparent; text-decoration:underline; text-underline-offset:3px; font-size:inherit; font-weight:inherit; }
.cookie-consent { position:fixed; z-index:140; inset:0; padding:20px; display:grid; place-items:end center; background:rgba(3,21,44,.5); }
.cookie-dialog { width:min(760px,100%); padding:24px; border:1px solid var(--border); border-radius:16px; background:#fff; box-shadow:0 26px 80px rgba(0,0,0,.35); }
.cookie-dialog h2 { margin:4px 0 10px; color:var(--forja-navy); }
.cookie-dialog p { line-height:1.55; }
.cookie-dialog a { color:var(--forja-mid-blue); font-weight:800; text-decoration:underline; }
.cookie-actions { margin-top:18px; display:flex; flex-wrap:wrap; gap:10px; }
.cookie-option { padding:13px 0; display:flex; align-items:flex-start; gap:12px; border-bottom:1px solid var(--border); }
.cookie-option input { width:18px; height:18px; margin-top:3px; accent-color:var(--forja-blue); }
.cookie-option span { display:grid; gap:4px; }
.cookie-option small { color:var(--muted); line-height:1.4; }
.lead-honeypot { position:absolute!important; left:-10000px!important; width:1px!important; height:1px!important; opacity:0!important; }
.lead-capture-modal .modal { width:min(600px,100%); }
.consent-option { display: flex; align-items: flex-start; gap: 10px; color: var(--ink); font-size: .84rem; line-height: 1.5; }
.consent-option input { width: 18px; height: 18px; margin-top: 2px; flex: 0 0 auto; accent-color: var(--forja-blue); }
.consent-option a, .privacy-caption a { color: var(--forja-mid-blue); font-weight: 800; text-decoration: underline; }
.required-consent { padding: 12px; border: 1px solid rgba(16,63,101,.18); border-radius: 10px; background: #f7fafc; }
.privacy-caption { margin: 0; color: var(--muted); font-size: .76rem; line-height: 1.5; text-align: center; }
.mfa-code { max-width: 220px; font-size: 1.4rem; letter-spacing: .3em; text-align: center; }
.mfa-qr { width: min(240px, 100%); background: #fff; }
.legal-public-header { padding: 12px clamp(18px,5vw,70px); display: flex; align-items: center; justify-content: space-between; gap: 18px; background: var(--forja-navy); }
.legal-back { color: #fff; border: 1px solid rgba(255,255,255,.45); background: rgba(255,255,255,.08); }
.legal-document-card { max-width: 900px; }
.legal-document-card h1 { margin: 0; color: var(--forja-navy); font-size: clamp(2rem,5vw,3.5rem); }
.legal-document { margin-top: 28px; padding: clamp(22px,4vw,42px); border: 1px solid var(--border); border-radius: var(--radius); background: #fff; box-shadow: var(--shadow); line-height: 1.75; white-space: normal; }
.legal-document h2, .legal-document h3, .legal-document h4 { margin: 1.45em 0 .55em; color: var(--forja-navy); line-height: 1.25; }
.legal-document h2:first-child, .legal-document h3:first-child, .legal-document h4:first-child { margin-top: 0; }
.legal-document ul, .legal-document ol { padding-left: 1.5rem; }
.legal-document u { text-underline-offset: 3px; }
.legal-editor { display: grid; gap: 18px; }
.legal-editor-area { min-height: 420px; line-height: 1.6; }
.legal-history-content { max-width: 520px; padding: 12px 0; white-space: pre-wrap; line-height: 1.55; }
.legal-admin-grid { display: grid; grid-template-columns: minmax(0,1.15fr) minmax(320px,.85fr); gap: 22px; margin-top: 22px; align-items: start; }
.legal-preview-panel { position: sticky; top: 20px; }
.legal-preview { margin-top: 15px; max-height: 620px; overflow: auto; box-shadow: none; }
.legal-toolbar { display: flex; flex-wrap: wrap; gap: 6px; padding: 8px; border: 1px solid rgba(16,63,101,.2); border-bottom: 0; border-radius: 10px 10px 0 0; background: #f3f7fa; }
.legal-toolbar button { min-height: 34px; padding: 0 10px; border: 1px solid rgba(16,63,101,.2); border-radius: 7px; color: var(--forja-navy); background: #fff; font-size: .76rem; font-weight: 750; }
.legal-toolbar button:hover { color: #fff; background: var(--forja-blue); }
.legal-toolbar + .legal-editor-area { border-radius: 0 0 10px 10px; }
@media (max-width: 1050px) { .legal-admin-grid { grid-template-columns: 1fr; }.legal-preview-panel { position: static; } }

.demo-banner { padding: 10px 18px; color: var(--forja-navy); background: var(--forja-gold); text-align: center; font-size: .82rem; font-weight: 850; }

@media (max-width: 900px) {
  .grid-4, .grid-3 { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .site-nav a.hide-mobile { display: none; }
  .student-menu-toggle { display:grid; }
  .student-sidebar { top:68px; transform:translateX(-105%); transition:transform .2s ease; box-shadow:16px 0 38px rgba(0,0,0,.25); }
  .student-menu-open .student-sidebar { transform:translateX(0); }
  .student-sidebar-backdrop { position:fixed; z-index:41; inset:68px 0 0; border:0; background:rgba(3,21,44,.55); }
  .student-menu-open .student-sidebar-backdrop { display:block; }
  body.student-portal > main,body.student-portal > .question-shell,body.student-portal > #question-loading,body.student-portal > [data-footer] { margin-left:0; }
}
@media (max-width: 680px) {
  .site-header { min-height: 68px; padding: 0 14px; }
  .brand-logo { width: 48px; height: 48px; flex-basis: 48px; }
  .brand-copy strong { font-size: 1rem; }
  .brand-copy small { font-size: .55rem; }
  .site-nav { gap: 10px; }
  .user-name { display: none; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .page-section { padding: 40px 0 60px; }
  .card-body { padding: 20px; }
}
.checkout-session-label{display:inline-flex;align-items:center;padding:8px 12px;border:1px solid rgba(255,255,255,.25);border-radius:999px;color:#fff;font-size:.8rem;font-weight:800}
