/* Insured AF Agent Academy design system
   Tokens from the Insured AF brand palette and the layout language of insuredaf.com
   (diamond markers, gold accent rule, plain-English cards, gold call to action). */

@font-face { font-family: "Montserrat"; src: url("../fonts/Montserrat-Bold.ttf") format("truetype"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Montserrat"; src: url("../fonts/Montserrat-SemiBold.ttf") format("truetype"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Open Sans"; src: url("../fonts/OpenSans-Regular.ttf") format("truetype"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Open Sans"; src: url("../fonts/OpenSans-SemiBold.ttf") format("truetype"); font-weight: 600; font-display: swap; }

:root {
  --teal: #1B6B93;        /* primary: trust, healthcare */
  --teal-dark: #155675;
  --teal-50: #E7F1F6;
  --gold: #D4A843;        /* accent: veteran pride, warmth (never as text on white) */
  --gold-dark: #B88F2E;
  --gold-50: #FBF4E2;
  --navy: #1B2A4A;        /* headers, text */
  --navy-2: #24365E;
  --bg: #F5F9FC;          /* light background */
  --white: #FFFFFF;
  --red: #C0392B;         /* deadlines and errors, sparingly */
  --green: #1E7B4F;
  --ink: #1B2A4A;
  --muted: #4A5A73;       /* 7.0:1 on white */
  --line: #D9E3EC;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(27,42,74,.06), 0 6px 18px rgba(27,42,74,.06);
  --gutter: 4vw;          /* full-width layout with a proportional side buffer */
  --font-head: "Montserrat", "Segoe UI", Arial, sans-serif;
  --font-body: "Open Sans", "Segoe UI", Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 16px/1.6 var(--font-body); }
h1, h2, h3, h4 { font-family: var(--font-head); color: var(--navy); line-height: 1.25; margin: 0 0 .5rem; }
h1 { font-size: clamp(1.5rem, 1.1rem + 1.4vw, 2.1rem); font-weight: 700; }
h2 { font-size: 1.25rem; font-weight: 700; }
h3 { font-size: 1.05rem; font-weight: 600; }
h4 { font-size: 1rem; font-weight: 700; }
p { margin: 0 0 1rem; }
a { color: var(--teal); text-underline-offset: 2px; }
a:hover { color: var(--teal-dark); }
code { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .92em; background: var(--teal-50); padding: .1em .35em; border-radius: 4px; }
img { max-width: 100%; height: auto; }
:focus-visible { outline: 3px solid var(--teal); outline-offset: 2px; border-radius: 4px; }
.topbar :focus-visible, .footer :focus-visible, .resume-bar :focus-visible, .auth-hero :focus-visible { outline-color: var(--gold); }
.sr { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -9999px; top: 0; background: var(--gold); color: var(--navy); padding: .5rem 1rem; z-index: 100; font-weight: 600; }
.skip:focus { left: 1rem; top: 1rem; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.ok { color: var(--green); font-weight: 600; }
.warn { color: var(--red); font-weight: 600; }
.here { color: var(--teal); font-weight: 600; }
.eyebrow { font: 600 .78rem/1.3 var(--font-head); letter-spacing: .08em; text-transform: uppercase; color: var(--teal); margin: 0 0 .35rem; }
.hint { font-weight: 400; color: var(--muted); font-size: .85rem; }

/* ---------- top bar */
.topbar { background: var(--navy); border-bottom: 3px solid var(--gold); position: sticky; top: 0; z-index: 20; }
.topbar-inner { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .6rem var(--gutter); }
.brand { display: flex; align-items: center; gap: .6rem; text-decoration: none; color: var(--white); }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-name { font: 700 1.15rem var(--font-head); color: var(--white); }
.brand-name b { color: var(--gold); }
.brand-sub { font: 600 .72rem var(--font-head); letter-spacing: .1em; text-transform: uppercase; color: #C9D6E6; }
.brand-dark .brand-name { color: var(--navy); }
.brand-dark .brand-name b { color: #8A6A1E; }
.brand-dark .brand-sub { color: var(--muted); }
/* Official Insured American Family wordmark: black lettering, so it always sits on white */
.logo-plate { display: inline-flex; align-items: center; background: #FFFFFF; border-radius: 6px; padding: 5px 9px; line-height: 0; }
.logo-plate img { height: 30px; width: auto; display: block; }
.logo-plate-lg { padding: 10px 16px; border-radius: 8px; }
.logo-plate-lg img { height: 50px; }
.brand-dark { flex-direction: column; align-items: flex-start; gap: .35rem; }
.logo-img { height: 34px; width: auto; display: block; }
@media (max-width: 600px) { .logo-plate img { height: 22px; } .logo-plate-lg img { height: 38px; } .topbar .brand-sub { display: none; } }
.mainnav { display: flex; align-items: center; gap: .25rem; flex-wrap: wrap; }
.mainnav a, .mainnav .linkbtn { color: #E8EEF6; text-decoration: none; padding: .5rem .75rem; border-radius: 6px; font: 600 .92rem var(--font-head); }
.mainnav a:hover, .mainnav .linkbtn:hover { background: var(--navy-2); color: var(--white); }
.mainnav a[aria-current="page"] { color: var(--navy); background: var(--gold); }
.nav-toggle { display: none; }
.linkbtn { background: none; border: 0; cursor: pointer; color: var(--teal); font: inherit; padding: 0; text-decoration: underline; }
.mainnav .linkbtn { text-decoration: none; }
.inline { display: inline; margin: 0; }

/* ---------- page */
.page { padding: 1.5rem var(--gutter) 3rem; min-height: 70vh; }
.footer { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .5rem 2rem; padding: 1.25rem var(--gutter); background: var(--navy); color: #C9D6E6; font-size: .82rem; border-top: 3px solid var(--gold); }
.pagehead { display: flex; justify-content: space-between; align-items: flex-end; gap: 1.5rem; flex-wrap: wrap; margin-bottom: 1.25rem; }
.pagehead > div:first-child { max-width: 760px; flex: 1 1 420px; }
.pagehead-actions { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.pagehead-actions form { margin: 0; }
.crumbs { font-size: .875rem; margin-bottom: .75rem; color: var(--muted); }
.crumbs a { color: var(--muted); }
.panel { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.25rem 1.4rem; margin-bottom: 1.25rem; }
.panel.narrow { max-width: 640px; }
.panel.danger { border-color: #E9B8B2; }
.two-col { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 1.25rem; align-items: start; }
.two-col > .panel { margin-bottom: 0; }
.two-col + .panel, .two-col + .two-col { margin-top: 1.25rem; }
.notice { background: var(--gold-50); border-left: 4px solid var(--gold); padding: .75rem 1rem; border-radius: 6px; }

/* ---------- buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; min-height: 44px; padding: .55rem 1.1rem; border-radius: 8px; border: 2px solid transparent; font: 700 .92rem var(--font-head); text-decoration: none; cursor: pointer; line-height: 1.2; white-space: nowrap; }
.btn-primary { background: var(--teal); color: var(--white); }
.btn-primary:hover { background: var(--teal-dark); color: var(--white); }
.btn-gold { background: var(--gold); color: var(--navy); }
.btn-gold:hover { background: var(--gold-dark); color: var(--navy); }
.btn-ghost { background: var(--white); color: var(--teal); border-color: var(--teal); }
.btn-ghost:hover { background: var(--teal-50); }
.btn-danger { background: var(--red); color: var(--white); }
.btn-sm { min-height: 36px; padding: .35rem .75rem; font-size: .82rem; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .65; cursor: default; }
.btn-row { display: inline-flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.btn-row form { margin: 0; }
.btn-row.wrap { flex-wrap: wrap; }

/* ---------- flash */
.flash { padding: .75rem 1rem; border-radius: 8px; margin-bottom: 1rem; border-left: 4px solid; background: var(--white); }
.flash-success { border-color: var(--green); background: #EAF6EF; }
.flash-error { border-color: var(--red); background: #FBEDEB; }
.flash-info { border-color: var(--teal); background: var(--teal-50); }

/* ---------- stats */
.stats, .kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: .75rem; margin: 0; }
.stats { flex: 0 1 520px; }
.stats div, .kpis div { background: var(--white); border: 1px solid var(--line); border-top: 3px solid var(--gold); border-radius: var(--radius); padding: .75rem 1rem; }
.kpis { margin-bottom: 1.25rem; }
.stats dt, .kpis dt { font-size: .8rem; color: var(--muted); }
.stats dd, .kpis dd { margin: 0; font: 700 1.5rem var(--font-head); color: var(--navy); }

/* ---------- course cards */
.grid-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1.1rem; }
.ccard { display: flex; flex-direction: column; background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.1rem 1.2rem; border-top: 4px solid var(--teal); }
.ccard.is-done { border-top-color: var(--gold); }
.ccard.is-locked { background: #F9FBFD; }
.ccard-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: .4rem; }
.ccard-num { font: 600 .75rem var(--font-head); letter-spacing: .08em; text-transform: uppercase; color: var(--teal); }
.ccard-title { font-size: 1.08rem; margin-bottom: .35rem; }
.diamond { color: var(--gold-dark); font-size: .8em; }
.ccard-sum { color: var(--muted); font-size: .92rem; flex: 1; }
.ccard-meta { font-size: .82rem; color: var(--muted); margin-bottom: .6rem; }
.ccard-foot { display: flex; justify-content: space-between; align-items: center; gap: .5rem; margin-top: .75rem; flex-wrap: wrap; }
.ccard .pct { font: 700 .95rem var(--font-head); color: var(--navy); }
.lock { font-size: .82rem; color: var(--muted); max-width: 70%; }
.tag { display: inline-block; font: 600 .72rem var(--font-head); color: var(--navy); background: var(--gold-50); border: 1px solid #EAD9A6; border-radius: 99px; padding: .1rem .55rem; }
.pill { display: inline-block; border-radius: 99px; padding: .1rem .6rem; font: 600 .75rem var(--font-head); }
.pill-active { background: #EAF6EF; color: var(--green); }
.pill-pending { background: var(--gold-50); color: #7A5B12; }
.pill-disabled { background: #FBEDEB; color: var(--red); }

/* ---------- progress */
.progress { height: 10px; background: #E3EBF2; border-radius: 99px; overflow: hidden; }
.progress span { display: block; height: 100%; background: linear-gradient(90deg, var(--teal), #2A86B3); border-radius: 99px; transition: width .4s ease; }
.ccard.is-done .progress span { background: var(--gold); }
.progress-lg { height: 12px; margin: .75rem 0 .35rem; max-width: 560px; }
.progress-inline { display: inline-block; width: 120px; vertical-align: middle; margin-right: .4rem; }

.resume-bar { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; background: var(--navy); color: var(--white); border-radius: var(--radius); padding: 1rem 1.25rem; margin-bottom: 1.25rem; border-left: 6px solid var(--gold); }
.resume-bar .eyebrow { color: var(--gold); display: block; }
.resume-bar strong { font-family: var(--font-head); font-size: 1.1rem; }
.resume-bar .muted { color: #C9D6E6; }

/* ---------- tables */
.table-wrap { overflow-x: auto; background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 1.25rem; }
.table { width: 100%; border-collapse: collapse; font-size: .93rem; }
.table th { text-align: left; font: 600 .78rem var(--font-head); letter-spacing: .05em; text-transform: uppercase; color: var(--muted); background: #F0F5F9; padding: .6rem .8rem; border-bottom: 1px solid var(--line); }
.table td { padding: .6rem .8rem; border-bottom: 1px solid #EDF2F6; vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }
.table.compact td { padding: .4rem .6rem; }
.panel .table th { background: transparent; }
.w-num { width: 90px; text-align: right; }
.w-status { width: 130px; }
.quizrow td { background: var(--gold-50); }
.toolbar { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; align-items: flex-start; margin-bottom: 1rem; }
.inline-form { display: inline-flex; gap: .4rem; align-items: center; flex-wrap: wrap; margin: 0 0 0 .25rem; }
.add-learner summary { list-style: none; }
.add-learner summary::-webkit-details-marker { display: none; }
.add-learner[open] form { margin-top: .6rem; }

/* ---------- forms */
.form { display: grid; gap: .35rem; }
.form label { font-weight: 600; font-size: .92rem; margin-top: .5rem; }
.form .btn { margin-top: 1rem; justify-self: start; }
.form .btn-block { justify-self: stretch; }
input[type=text], input:not([type]), input[type=email], input[type=password], input[type=url], select {
  font: inherit; color: var(--ink); background: var(--white); border: 1.5px solid #B9C7D6; border-radius: 8px; padding: .55rem .7rem; min-height: 44px; width: 100%; }
.inline-form input, .inline-form select { width: auto; min-height: 36px; padding: .35rem .55rem; }
input:focus, select:focus { border-color: var(--teal); outline: 3px solid rgba(27,107,147,.25); outline-offset: 0; }
.check { display: flex; gap: .5rem; align-items: center; font-weight: 400 !important; }
.check input { width: 18px; height: 18px; }

/* ---------- subnav */
.subnav { display: flex; gap: .25rem; flex-wrap: wrap; border-bottom: 2px solid var(--line); margin-bottom: 1.25rem; }
.subnav a { padding: .55rem .9rem; text-decoration: none; font: 600 .9rem var(--font-head); color: var(--muted); border-bottom: 3px solid transparent; margin-bottom: -2px; }
.subnav a[aria-current="page"] { color: var(--navy); border-bottom-color: var(--gold); }

/* ---------- course outline */
.module { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 1rem; overflow: hidden; }
.module-head { padding: 1rem 1.2rem .25rem; border-bottom: 1px solid var(--line); }
.module-head h2 { font-size: 1.08rem; }
.mnum { color: var(--teal); font-size: .8rem; letter-spacing: .06em; text-transform: uppercase; margin-right: .4rem; }
.module .table td a { font-weight: 600; text-decoration: none; }
.module .table td a:hover { text-decoration: underline; }

/* ---------- lesson */
.lesson-layout { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 1.5rem; align-items: start; }
.lesson-side { position: sticky; top: 78px; background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; max-height: calc(100vh - 100px); overflow: auto; }
.side-back { display: block; font: 600 .88rem var(--font-head); text-decoration: none; margin-bottom: .75rem; }
.side-outline summary { font: 700 .85rem var(--font-head); cursor: pointer; margin: .5rem 0; }
.side-mod { font: 600 .78rem var(--font-head); color: var(--teal); text-transform: uppercase; letter-spacing: .04em; margin: .75rem 0 .25rem; }
.side-list { list-style: none; margin: 0; padding: 0; }
.side-list li a { display: block; padding: .3rem .5rem .3rem 1.4rem; font-size: .86rem; text-decoration: none; color: var(--ink); border-radius: 6px; position: relative; }
.side-list li a::before { content: "\25CB"; position: absolute; left: .35rem; color: #9AABBE; }
.side-list li.done a::before { content: "\2713"; color: var(--green); font-weight: 700; }
.side-list li.current a { background: var(--teal-50); font-weight: 600; }
.side-list li.quiz a { font-style: italic; }
.lesson { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.75rem clamp(1rem, 3vw, 2.5rem); }
.lesson h1 { padding-bottom: .6rem; border-bottom: 3px solid var(--gold); display: inline-block; }
.prose { font-size: 1.04rem; max-width: 82ch; }
.prose h4 { margin-top: 1.6rem; color: var(--teal); }
.prose ul, .prose ol { padding-left: 1.3rem; }
.prose li { margin-bottom: .35rem; }
.prose table { border-collapse: collapse; width: 100%; margin: 1rem 0; font-size: .94rem; display: block; overflow-x: auto; }
.prose th, .prose td { border: 1px solid var(--line); padding: .45rem .6rem; text-align: left; }
.prose th { background: #F0F5F9; }
.prose blockquote { margin: 1rem 0; padding: .75rem 1rem; border-left: 4px solid var(--line); background: #F7FAFC; }
.callout { margin: 1.2rem 0; padding: .85rem 1.1rem; border-radius: 8px; border-left: 5px solid; }
.callout p:last-child { margin-bottom: 0; }
.callout-field { background: var(--teal-50); border-color: var(--teal); }
.callout-confirm { background: var(--gold-50); border-color: var(--gold); }
.callout-compliance { background: #FBEDEB; border-color: var(--red); }
.callout-verify { background: #EEF1F5; border-color: var(--navy); }
.lesson-end { height: 1px; }
.lesson-actions { display: flex; justify-content: space-between; align-items: center; gap: .75rem; flex-wrap: wrap; margin-top: 2rem; padding-top: 1.25rem; border-top: 1px solid var(--line); }
.save-state { margin-top: .75rem; }

/* ---------- quiz */
.quiz { max-width: 900px; }
.qblock { border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.1rem; margin: 0 0 1rem; }
.qblock legend { font-weight: 600; padding: 0 .35rem; }
.qnum { color: var(--teal); font-family: var(--font-head); }
.opt { display: flex; gap: .65rem; align-items: flex-start; padding: .5rem .6rem; border-radius: 8px; cursor: pointer; }
.opt:hover { background: var(--teal-50); }
.opt input { margin-top: .3rem; width: 18px; height: 18px; flex: none; }
.result { padding: 1rem 1.2rem; border-radius: var(--radius); margin: 1rem 0; font-size: 1.05rem; }
.result-pass { background: #EAF6EF; border-left: 5px solid var(--green); }
.result-fail { background: #FBEDEB; border-left: 5px solid var(--red); }
.review { padding-left: 1.3rem; }
.review li { margin-bottom: 1rem; }
.review .q { font-weight: 600; margin-bottom: .2rem; }
.review li.right::marker { color: var(--green); }
.review li.wrong::marker { color: var(--red); }
.checklist li { margin-bottom: .3rem; }

/* ---------- certificate */
.cert-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.cert-img { display: block; width: 100%; max-width: 1100px; border: 1px solid var(--line); border-radius: 6px; }
.cert-html { text-align: center; border: 10px solid var(--navy); outline: 3px solid var(--gold); outline-offset: -18px; padding: 3rem 2rem; background: var(--white); }
.cert-name { font: 700 2rem var(--font-head); color: var(--navy); border-bottom: 2px solid var(--gold); display: inline-block; padding: 0 1rem .25rem; }
.cert-course { font: 600 1.4rem var(--font-head); color: var(--teal); }
.verify-ok { background: #EAF6EF; border-left: 5px solid var(--green); padding: 1rem; border-radius: 8px; margin-top: 1rem; }

/* ---------- auth */
.auth { background: var(--navy); }
.auth-wrap { display: grid; grid-template-columns: 1.1fr 1fr; min-height: 100vh; }
.auth-hero { background: linear-gradient(160deg, var(--teal) 0%, var(--navy) 75%); color: var(--white); display: flex; align-items: center; padding: 3rem var(--gutter); position: relative; }
.auth-hero::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 6px; background: var(--gold); }
.auth-hero-inner { max-width: 560px; }
.auth-hero .eyebrow { color: #FFFFFF; margin-top: 1rem; }
.hero-title { color: var(--white); font-size: clamp(1.8rem, 1.2rem + 2vw, 2.8rem); }
.hero-title span { color: var(--gold); }
.hero-copy { color: #DCE6F1; font-size: 1.08rem; }
.hero-points { list-style: none; padding: 0; display: flex; gap: 1.25rem; flex-wrap: wrap; font: 600 .9rem var(--font-head); }
.hero-points li::before { content: "\25C6  "; color: var(--gold); }
.auth-panel { background: var(--bg); display: flex; align-items: center; justify-content: center; padding: 2rem var(--gutter); }
.auth-card { width: 100%; max-width: 440px; background: var(--white); border-radius: 14px; box-shadow: var(--shadow); padding: 2rem; border-top: 4px solid var(--gold); }
.auth-card .brand { margin-bottom: 1.25rem; }
.auth-links { margin-top: 1rem; font-size: .92rem; text-align: center; }

/* ---------- responsive */
@media (max-width: 900px) {
  .lesson-layout { grid-template-columns: 1fr; }
  .lesson-side { position: static; max-height: none; }
  .side-outline:not([open]) { margin-bottom: 0; }
  .auth-wrap { grid-template-columns: 1fr; }
  .auth-hero { padding: 2rem var(--gutter) 2.5rem; min-height: auto; }
  .hero-copy, .hero-points { display: none; }
}
@media (max-width: 720px) {
  :root { --gutter: 4vw; }
  .nav-toggle { display: inline-flex; background: transparent; color: var(--white); border: 2px solid var(--gold); border-radius: 8px; padding: .4rem .8rem; font: 600 .9rem var(--font-head); min-height: 40px; }
  .mainnav { display: none; position: absolute; top: 100%; left: 0; right: 0; background: var(--navy); flex-direction: column; align-items: stretch; padding: .5rem var(--gutter) 1rem; border-bottom: 3px solid var(--gold); }
  .mainnav.open { display: flex; }
  .mainnav a, .mainnav .linkbtn { padding: .75rem; text-align: left; width: 100%; }
  .topbar-inner { position: relative; }
  .table { font-size: .88rem; }
  .w-num { width: auto; }
  .lesson { padding: 1.25rem 1rem; }
  .lesson-actions { flex-direction: column; align-items: stretch; }
  .lesson-actions .btn-row { flex-direction: column; align-items: stretch; }
  .lesson-actions .btn { white-space: normal; }
  .btn { white-space: normal; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
@media print {
  .topbar, .footer, .lesson-side, .lesson-actions, .save-state, .crumbs, .btn { display: none !important; }
  body { background: #fff; }
  .lesson, .panel { box-shadow: none; border: 0; }
}
.pager { display: flex; gap: .5rem; justify-content: flex-end; }
