@font-face { font-family: "Montserrat"; font-weight: 400; font-display: swap; src: url(fonts/montserrat-latin-400-normal.woff2) format("woff2"); }
@font-face { font-family: "Montserrat"; font-weight: 500; font-display: swap; src: url(fonts/montserrat-latin-500-normal.woff2) format("woff2"); }
@font-face { font-family: "Montserrat"; font-weight: 600; font-display: swap; src: url(fonts/montserrat-latin-600-normal.woff2) format("woff2"); }
@font-face { font-family: "Montserrat"; font-weight: 700; font-display: swap; src: url(fonts/montserrat-latin-700-normal.woff2) format("woff2"); }

:root {
  --purple: #7141b1;
  --purple-dark: #5a3290;
  --teal: #48a1ba;
  --navy: #141d38;
  --ink: #1c2233;
  --muted: #5d6475;
  --line: #e2e4ec;
  --bg: #f5f6fa;
  --card: #ffffff;
  --ok-bg: #e7f6ee; --ok: #1d7a46;
  --err-bg: #fdecec; --err: #b3261e;
  --warn-bg: #fff4de; --warn: #8a5a00;
  --radius: 12px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font-family: "Montserrat", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 16px; line-height: 1.6; color: var(--ink); background: var(--bg);
}
a { color: var(--purple); }
a:hover { color: var(--purple-dark); }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .5em; color: var(--navy); }
h1 { font-size: 1.7rem; font-weight: 700; }
h2 { font-size: 1.25rem; font-weight: 700; }
h3 { font-size: 1.1rem; font-weight: 600; }
p { margin: 0 0 1em; }
code, .mono { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: .92em; }
code { background: #eef0f6; padding: .1em .35em; border-radius: 4px; word-break: break-all; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.center { text-align: center; }

.wrap { width: 100%; max-width: 980px; margin: 0 auto; padding: 0 16px; }
main.wrap { padding-top: 28px; padding-bottom: 40px; min-height: 60vh; }

/* Top bar */
.topbar { background: var(--navy); color: #fff; border-bottom: 4px solid var(--teal); }
.topbar-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 64px; flex-wrap: wrap; padding-top: 8px; padding-bottom: 8px; }
.brand { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.brand-name { font-weight: 700; font-size: 1.1rem; }
.brand-sub { color: #c9cfe3; font-size: .9rem; }
.logo { height: 40px; width: auto; max-width: 220px; object-fit: contain; background: #fff; padding: 4px 8px; border-radius: 6px; }
.nav { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; }
.nav a { color: #fff; text-decoration: none; font-weight: 500; }
.nav a:hover { color: var(--teal); }

/* Cards */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; margin-bottom: 20px; box-shadow: 0 1px 2px rgba(20,29,56,.04); }
.card.narrow { max-width: 560px; margin-left: auto; margin-right: auto; }
.eyebrow { text-transform: uppercase; letter-spacing: .08em; font-size: .78rem; font-weight: 700; color: var(--teal); margin-bottom: .4em; }
.section-title { margin-top: 28px; }
.row-between { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.link-card { display: block; text-decoration: none; color: inherit; margin: 0; transition: border-color .15s, transform .15s; }
.link-card:hover { border-color: var(--teal); transform: translateY(-2px); color: inherit; }
.link-card h3 { color: var(--purple); }
.link-card p:last-child { margin: 0; }

.course { display: flex; gap: 24px; justify-content: space-between; align-items: center; flex-wrap: wrap; border-left: 5px solid var(--purple); }
.course-main { flex: 1 1 380px; }
.course-main p:last-child { margin-bottom: 0; }
.course-actions { flex: 0 0 auto; }

/* Forms */
.form { display: flex; flex-direction: column; gap: 6px; margin-top: 12px; }
.form label { font-weight: 600; font-size: .92rem; margin-top: 10px; }
.form input[type=text], .form input[type=email], .form input[type=password], .form input:not([type]), .form textarea {
  width: 100%; font: inherit; padding: 11px 13px; border: 1px solid #c8ccd8; border-radius: 8px; background: #fff; color: var(--ink);
}
.form input:focus, .form textarea:focus { outline: 3px solid rgba(113,65,177,.25); border-color: var(--purple); }
.form .btn { margin-top: 16px; align-self: flex-start; }
.form label.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; }
.form label.check input { margin-top: 5px; width: 18px; height: 18px; flex: 0 0 auto; accent-color: var(--purple); }
.hint { font-size: .85rem; color: var(--muted); margin: 2px 0 0; }
.prefix-input { display: flex; border: 1px solid #c8ccd8; border-radius: 8px; overflow: hidden; background: #fff; }
.prefix-input span { background: #eef0f6; padding: 11px 10px; color: var(--muted); font-size: .85rem; white-space: nowrap; display: flex; align-items: center; max-width: 55%; overflow: hidden; text-overflow: ellipsis; }
.prefix-input input { border: 0 !important; border-radius: 0 !important; }
form.inline { display: inline; margin: 0; }

.btn { display: inline-block; font: inherit; font-weight: 600; background: var(--purple); color: #fff; border: 0; border-radius: 8px; padding: 11px 22px; cursor: pointer; text-decoration: none; }
.btn:hover { background: var(--purple-dark); color: #fff; }
.btn:focus-visible, .btn-link:focus-visible { outline: 3px solid var(--teal); outline-offset: 2px; }
.btn-secondary { background: #fff; color: var(--purple); border: 2px solid var(--purple); padding: 9px 20px; }
.btn-secondary:hover { background: #f3eefa; color: var(--purple-dark); }
.btn-danger { background: var(--err); }
.btn-danger:hover { background: #8e1d17; }
.btn-small { padding: 7px 14px; font-size: .9rem; }
.btn-link { background: none; border: 0; padding: 0; font: inherit; color: var(--purple); text-decoration: underline; cursor: pointer; }
.btn-link.light { color: #fff; }
.btn-link.danger { color: var(--err); }

.alert { padding: 12px 16px; border-radius: 8px; margin-bottom: 16px; font-weight: 500; }
.alert-ok { background: var(--ok-bg); color: var(--ok); }
.alert-error { background: var(--err-bg); color: var(--err); }

.badge { display: inline-block; font-size: .78rem; font-weight: 700; padding: 3px 10px; border-radius: 999px; background: #eef0f6; color: var(--muted); margin-bottom: 8px; white-space: nowrap; }
.badge-passed, .badge-completed { background: var(--ok-bg); color: var(--ok); }
.badge-in_progress { background: var(--warn-bg); color: var(--warn); }
.badge-failed { background: var(--err-bg); color: var(--err); }

.big-tick { width: 64px; height: 64px; margin: 0 auto 12px; border-radius: 50%; background: var(--ok-bg); color: var(--ok); font-size: 2rem; display: flex; align-items: center; justify-content: center; }

/* Tables */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.table th { text-align: left; font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); border-bottom: 2px solid var(--line); padding: 8px 10px; }
.table td { border-bottom: 1px solid var(--line); padding: 10px; vertical-align: top; }
.table .badge { margin: 0; }
.check-inline { display: inline-flex; align-items: center; gap: 4px; margin-right: 6px; color: var(--muted); }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px 24px; margin: 16px 0; }
.facts dt { font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; }
.facts dd { margin: 2px 0 0; }
details summary { cursor: pointer; font-weight: 600; color: var(--purple); }
.copy-box { width: 100%; margin-top: 10px; font: inherit; font-size: .9rem; padding: 12px; border: 1px solid var(--line); border-radius: 8px; background: #fafbfd; }
.danger-zone { border-color: #f1c4c1; }

.prose h2 { margin-top: 1.6em; }
.prose ul { padding-left: 1.3em; margin: 0 0 1em; }
.prose li { margin-bottom: .35em; }

.footer { border-top: 1px solid var(--line); padding: 20px 0 30px; color: var(--muted); font-size: .9rem; }
.footer p { margin: 0 0 .4em; }

/* Course player */
.player-body { height: 100vh; display: flex; flex-direction: column; overflow: hidden; background: var(--navy); }
.player-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 16px; background: var(--navy); color: #fff; border-bottom: 3px solid var(--teal); flex: 0 0 auto; }
.player-title { display: flex; flex-direction: column; line-height: 1.3; min-width: 0; }
.player-title .muted { color: #c9cfe3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.player-frame { flex: 1 1 auto; width: 100%; border: 0; background: #fff; }

/* Certificate */
.cert-body { background: #e9ebf2; }
.cert-toolbar { text-align: center; padding: 16px; }
.cert { max-width: 1000px; margin: 0 auto 40px; padding: 16px; }
.cert-inner {
  background: #fff; border: 10px solid var(--navy); outline: 3px solid var(--teal); outline-offset: -22px;
  padding: 56px 48px; text-align: center; aspect-ratio: 1.414 / 1; display: flex; flex-direction: column; justify-content: center;
}
.cert-inner { position: relative; overflow: hidden; }
.cert-content { position: relative; z-index: 1; display: flex; flex-direction: column; justify-content: center; }
.cert-wm { position: absolute; top: 50%; transform: translateY(-50%); width: 26%; display: flex; align-items: center; justify-content: center; opacity: .09; pointer-events: none; z-index: 0; }
.cert-wm-left { left: 3%; }
.cert-wm-right { right: 3%; }
.cert-wm img { width: 100%; height: auto; max-height: 320px; object-fit: contain; filter: grayscale(20%); }
.cert-wm svg { width: 75%; height: auto; color: var(--teal); }
.cert-wm-text { font-weight: 800; font-size: 2.6rem; line-height: 1.1; color: var(--purple); text-align: center; transform: rotate(-12deg); }
.cert-logo { max-height: 60px; max-width: 260px; margin: 0 auto 12px; object-fit: contain; }
.cert-brand { font-weight: 700; color: var(--navy); font-size: 1.2rem; margin-bottom: 4px; }
.cert-kicker { text-transform: uppercase; letter-spacing: .2em; font-weight: 700; color: var(--purple); font-size: 1.1rem; margin-bottom: 20px; }
.cert-small { color: var(--muted); margin-bottom: 6px; }
.cert-name { font-size: 2.4rem; font-weight: 700; color: var(--navy); margin: 4px 0 10px; border-bottom: 2px solid var(--line); display: inline-block; padding: 0 24px 6px; align-self: center; }
.cert-course { font-size: 1.5rem; font-weight: 700; color: var(--purple); margin: 6px 0 2px; }
.cert-meta { display: flex; justify-content: center; gap: 48px; margin: 28px 0 20px; flex-wrap: wrap; }
.cert-meta span { display: block; font-size: .75rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.cert-meta strong { color: var(--navy); }
.cert-foot { font-size: .72rem; color: var(--muted); margin: 0; }

@media (max-width: 640px) {
  h1 { font-size: 1.4rem; }
  .card { padding: 18px; }
  .cert-inner { aspect-ratio: auto; padding: 36px 20px; }
  .cert-name { font-size: 1.7rem; }
  .player-title .muted { display: none; }
}

@media print {
  @page { size: A4 landscape; margin: 0; }
  .no-print { display: none !important; }
  .cert-body { background: #fff; }
  .cert { max-width: none; margin: 0; padding: 8mm; }
  .cert-inner { height: 190mm; aspect-ratio: auto; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .cert-wm { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* Course selection on the organisation form */
.course-pick { border: 1px solid var(--line); border-radius: 10px; padding: 12px 16px 14px; margin: 14px 0 4px; }
.course-pick legend { font-weight: 600; font-size: .92rem; padding: 0 6px; }
.course-checks { margin: 4px 0 0 28px; display: flex; flex-direction: column; gap: 2px; }
.course-checks label.check { margin-top: 4px; }
.form details { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 10px; }
.form details[open] summary { margin-bottom: 4px; }
.form input[type=number], .form input[type=file] { font: inherit; padding: 9px 12px; border: 1px solid #c8ccd8; border-radius: 8px; background: #fff; max-width: 100%; }

/* Branding page */
.brand-preview { background: #f5f6fa; border: 1px dashed #c8ccd8; border-radius: 10px; padding: 18px; margin: 10px 0 6px; min-height: 90px; display: flex; align-items: center; justify-content: center; }
.brand-preview img { max-height: 110px; max-width: 100%; object-fit: contain; }
.form select.select { font: inherit; padding: 10px 12px; border: 1px solid #c8ccd8; border-radius: 8px; background: #fff; max-width: 260px; }
.course-credit { margin-top: -4px; }
