/* SafeHaven Training Academy. Brand colors from the SafeHaven palette. */
:root {
  --gold: #febf2c;
  --gold-deep: #ffb000;
  --gold-bright: #fecc1a;
  --gold-tint: #fff6dc;
  --gray: #626262;
  --black: #000000;
  --ink: #141414;
  --white: #ffffff;
  --paper: #f6f5f1;
  --line: #e4e1d8;
  --danger: #b42318;
  --danger-tint: #fdecea;
  --ok: #1d7a3e;
  --ok-tint: #e7f5ec;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(0, 0, 0, .06), 0 4px 14px rgba(0, 0, 0, .05);
  --font: "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  --font-heavy: "Arial Black", "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--paper);
}
img { max-width: 100%; height: auto; }
a { color: var(--ink); text-decoration-color: var(--gold-deep); text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--gold-deep); outline-offset: 2px; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .4em; }
h1 { font-family: var(--font-heavy); font-size: clamp(1.6rem, 4vw, 2.2rem); letter-spacing: -.01em; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.1rem; }
p { margin: 0 0 1em; }

.wrap { width: 100%; max-width: 1080px; margin: 0 auto; padding: 0 16px; }
.main { flex: 1; padding-top: 32px; padding-bottom: 48px; }
.muted { color: var(--gray); }
.small { font-size: .875rem; }
.eyebrow {
  margin: 0 0 .4em;
  font-size: .78rem;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--gray);
}

/* Test-mode banner */
.dev-banner {
  background: var(--black);
  color: var(--gold);
  font-size: .8rem;
  text-align: center;
  padding: 6px 16px;
}

/* Header */
.site-header {
  background: var(--white);
  border-bottom: 4px solid var(--gold);
}
.header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 76px;
  padding-top: 10px;
  padding-bottom: 10px;
}
.brand { display: flex; align-items: center; gap: 14px; text-decoration: none; }
.brand img { width: 200px; height: auto; display: block; }
.brand-tag {
  border-left: 2px solid var(--line);
  padding-left: 14px;
  font-weight: 700;
  font-size: .8rem;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--gray);
}
.account { display: flex; align-items: center; gap: 14px; }
.account-name { display: flex; flex-direction: column; text-align: right; line-height: 1.25; }
.account-name span { font-size: .85rem; color: var(--gray); }
.account form { margin: 0; }

/* Footer */
.site-footer { background: var(--black); color: #bdbdbd; font-size: .85rem; }
.footer-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px 24px;
  padding-top: 20px;
  padding-bottom: 20px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 10px 18px;
  border: 2px solid transparent;
  border-radius: 8px;
  font: inherit;
  font-weight: 700;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
  transition: background-color .15s, border-color .15s;
}
.btn-primary { background: var(--gold); color: var(--black); border-color: var(--gold); }
.btn-primary:hover { background: var(--gold-deep); border-color: var(--gold-deep); }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--ink); }
.btn-ghost:hover { background: var(--black); color: var(--gold); }
.btn-small { min-height: 36px; padding: 6px 12px; font-size: .9rem; white-space: nowrap; }
.btn-block { width: 100%; }
.btn.is-disabled { background: #eceae4; border-color: #eceae4; color: #7a7a7a; cursor: not-allowed; }

.link-button {
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  font-weight: 600;
  color: var(--ink);
  text-decoration: underline;
  text-decoration-color: var(--gold-deep);
  text-underline-offset: 3px;
  cursor: pointer;
}

/* Forms */
.stack { display: flex; flex-direction: column; gap: 10px; }
label { font-weight: 700; font-size: .95rem; }
input[type="email"], input[type="text"], input:not([type]), .code-input {
  width: 100%;
  min-height: 48px;
  padding: 10px 14px;
  border: 2px solid var(--line);
  border-radius: 8px;
  font: inherit;
  font-size: 1.05rem;
  background: var(--white);
}
input:focus { border-color: var(--black); outline: none; box-shadow: 0 0 0 3px var(--gold); }
.code-input { font-size: 1.6rem; letter-spacing: .4em; text-align: center; font-variant-numeric: tabular-nums; }

/* Alerts */
.alert { padding: 12px 14px; border-radius: 8px; border-left: 4px solid; }
.alert-error { background: var(--danger-tint); border-color: var(--danger); color: #7a1610; }
.alert-dev { background: var(--gold-tint); border-color: var(--gold-deep); }
.alert-dev .code { font-size: 1.25rem; letter-spacing: .15em; }

/* Sign-in pages */
.page-auth .main { display: flex; flex-direction: column; align-items: center; }
.auth-card {
  width: 100%;
  max-width: 440px;
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.auth-head { background: var(--black); padding: 24px 28px 20px; border-bottom: 4px solid var(--gold); }
.auth-head .eyebrow { color: var(--gold); }
.auth-head h1 { color: var(--white); margin: 0; }
.auth-body { padding: 24px 28px 28px; }
.test-accounts {
  width: 100%;
  max-width: 440px;
  margin-top: 20px;
  padding: 16px 20px;
  border: 2px dashed var(--gold-deep);
  border-radius: var(--radius);
  background: var(--gold-tint);
}
.test-accounts h2 { font-size: .9rem; text-transform: uppercase; letter-spacing: .08em; }
.test-accounts ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.test-accounts li span { display: block; font-size: .85rem; color: var(--gray); }

/* Page headings */
.page-head { margin-bottom: 28px; }
.page-head .muted { max-width: 680px; }

/* Course library */
.category { margin-bottom: 36px; }
.category-title {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: .95rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .1em;
  margin-bottom: 16px;
}
.category-title::before { content: ""; width: 28px; height: 4px; background: var(--gold); border-radius: 2px; }
.course-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 420px), 1fr)); gap: 18px; }
.course-card {
  display: flex;
  flex-direction: column;
  background: var(--white);
  border: 1px solid var(--line);
  border-top: 4px solid var(--black);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}
.course-card p { color: #3d3d3d; flex: 1; }
.course-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
.course-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 4px; }
/* Title image across the top of the card, edge to edge. */
.course-card.has-banner { overflow: hidden; }
.course-banner { margin: -20px -20px 16px; line-height: 0; }
.course-banner img { display: block; width: 100%; height: auto; aspect-ratio: 8 / 3; object-fit: cover; background: var(--black); }
.banner-preview { display: block; width: 100%; max-width: 480px; height: auto; margin: 4px 0 8px; border-radius: 6px; }

.pill {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: .78rem;
  font-weight: 700;
  background: #eeece6;
  color: #3d3d3d;
}
.pill-progress { background: var(--gold-tint); color: #6b4a00; }
.pill-done { background: var(--ok-tint); color: var(--ok); }

.progress { height: 8px; background: #eeece6; border-radius: 999px; overflow: hidden; margin-bottom: 14px; }
.progress span { display: block; height: 100%; background: var(--gold-deep); }

/* Panels and tables */
.panel, .placeholder {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 22px;
  box-shadow: var(--shadow);
}
.placeholder { border-left: 4px solid var(--gold); }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .95rem; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td:first-child { white-space: normal; }
th { font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; color: var(--gray); background: #faf9f6; }
.num { text-align: right; }
.empty { padding: 24px; background: var(--white); border-radius: var(--radius); border: 1px dashed var(--line); }

/* Course page */
.back-link { margin-bottom: 18px; font-weight: 600; }
.watch { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 28px; align-items: start; }
.watch-title { font-size: clamp(1.35rem, 3vw, 1.9rem); margin-bottom: 18px; }
.player-shell {
  background: var(--black);
  border-radius: var(--radius);
  overflow: hidden;
  border-bottom: 4px solid var(--gold);
  box-shadow: var(--shadow);
}
.player-shell video { display: block; width: 100%; aspect-ratio: 16 / 9; background: var(--black); }
.watch-status { margin-top: 16px; }
.watch-status p { margin-bottom: .6em; }
.progress-lg { height: 12px; margin-bottom: 8px; }
.complete-banner {
  margin-top: 18px;
  padding: 18px 20px;
  border-radius: var(--radius);
  background: var(--black);
  color: var(--white);
  border-left: 6px solid var(--gold);
}
.complete-banner h2 { color: var(--gold); }
.complete-banner p { margin: 0; color: #e6e6e6; }
.watch-side .panel h2 { font-size: 1rem; }
.tight { margin: 0; padding-left: 1.2em; }
.tight li { margin-bottom: 6px; }

@media (max-width: 900px) {
  .watch { grid-template-columns: 1fr; }
}

.complete-banner .cert-line { margin: 10px 0 14px; }
.complete-banner .cert-line strong { color: var(--gold); letter-spacing: .05em; }
.site-footer a { color: var(--gold); }

/* Certificate check */
.verify-card { max-width: 520px; }
.verify-card input[name="id"] { text-transform: uppercase; letter-spacing: .08em; }
.verify-result { margin-top: 22px; padding: 16px 18px; border-radius: 8px; border-left: 5px solid; }
.verify-ok { background: var(--ok-tint); border-color: var(--ok); }
.verify-bad { background: var(--danger-tint); border-color: var(--danger); }
.verify-warn { background: var(--gold-tint); border-color: var(--gold-deep); }
.verify-warn .verify-badge { color: #6b4a00; }
.verify-badge { font-weight: 800; font-size: 1.1rem; margin-bottom: 10px; }
.verify-ok .verify-badge { color: var(--ok); }
.verify-bad .verify-badge { color: var(--danger); }
.verify-result dl { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0; }
.verify-result dt { font-weight: 700; color: var(--gray); font-size: .9rem; }
.verify-result dd { margin: 0; }

/* Header navigation */
.main-nav { display: flex; gap: 18px; margin-left: auto; margin-right: 8px; }
.main-nav a { font-weight: 700; font-size: .92rem; text-decoration: none; padding: 6px 0; border-bottom: 3px solid transparent; white-space: nowrap; }
@media (max-width: 1000px) {
  .site-header .brand-tag { display: none; }
  .main-nav { gap: 14px; }
}
.main-nav a:hover { border-bottom-color: var(--gold); }

/* Training records */
.records-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 16px; }
.org-picker { display: flex; align-items: center; gap: 10px; margin-top: 6px; }
select {
  min-height: 44px;
  padding: 8px 12px;
  border: 2px solid var(--line);
  border-radius: 8px;
  font: inherit;
  background: var(--white);
  max-width: 100%;
}
select:focus { border-color: var(--black); outline: none; box-shadow: 0 0 0 3px var(--gold); }
input[type="search"] {
  width: 100%;
  min-height: 44px;
  padding: 8px 12px;
  border: 2px solid var(--line);
  border-radius: 8px;
  font: inherit;
  background: var(--white);
}
.summary-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: 16px; margin-bottom: 24px; }
.summary-card { background: var(--white); border: 1px solid var(--line); border-top: 4px solid var(--gold); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); }
.summary-card h2 { font-size: .95rem; line-height: 1.35; }
.summary-number { font-size: 1.05rem; margin-bottom: 8px; }
.summary-number strong { font-family: var(--font-heavy); font-size: 1.6rem; }
.summary-card .progress { margin-bottom: 8px; }
.filters {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 12px;
}
.filters .field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.filters .field.grow { flex: 1 1 220px; }
.filters .field select { width: 100%; max-width: 280px; }
.filters .field.actions { flex-direction: row; gap: 8px; }
.filters label { font-size: .85rem; }
.results-count { margin-bottom: 10px; }
.table-panel { padding: 0; overflow: hidden; }
.records-table td { vertical-align: top; }
.records-table .sub { display: block; font-size: .85rem; color: var(--gray); }
.records-table .wrap-cell { white-space: normal; min-width: 220px; }
.cert-id { font-variant-numeric: tabular-nums; letter-spacing: .03em; font-weight: 600; }
.pager { display: flex; align-items: center; justify-content: center; gap: 14px; margin-top: 16px; }

@media (max-width: 760px) {
  .main-nav { display: none; }
  /* Records table becomes stacked cards on phones */
  .records-table thead { display: none; }
  .records-table, .records-table tbody, .records-table tr, .records-table td { display: block; width: 100%; }
  .records-table tr { padding: 12px 14px; border-bottom: 1px solid var(--line); }
  .records-table td { border: 0; padding: 3px 0; white-space: normal; }
  .records-table td[data-label]:not(:first-child)::before {
    content: attr(data-label) ": ";
    font-size: .8rem;
    font-weight: 700;
    color: var(--gray);
  }
  .records-table .wrap-cell { min-width: 0; }
  .filters .field select { max-width: none; }
  .filters .field { flex: 1 1 100%; }
}

/* Admin screens */
.subnav { display: flex; flex-wrap: wrap; gap: 6px; margin: -10px 0 22px; }
.subnav a {
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--white);
  font-weight: 600;
  font-size: .9rem;
  text-decoration: none;
}
.subnav a:hover { border-color: var(--ink); }
.subnav a.is-active { background: var(--black); color: var(--gold); border-color: var(--black); }
.alert-ok { background: var(--ok-tint); border-color: var(--ok); color: #14532d; }
.alert p { margin: 0; }
.alert p + p { margin-top: 4px; }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; }
.panel-head h2 { margin: 0; }
.form-panel { max-width: 760px; }
.form-panel h2 { margin-bottom: 14px; }
textarea {
  width: 100%;
  padding: 10px 14px;
  border: 2px solid var(--line);
  border-radius: 8px;
  font: inherit;
  background: var(--white);
  resize: vertical;
}
textarea:focus { border-color: var(--black); outline: none; box-shadow: 0 0 0 3px var(--gold); }
input[type="number"] {
  min-height: 44px;
  padding: 8px 12px;
  border: 2px solid var(--line);
  border-radius: 8px;
  font: inherit;
  background: var(--white);
}
input[type="file"] { font: inherit; max-width: 100%; }
.short-input { width: 180px; }
.order-input { width: 80px; }
fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
fieldset.choice, fieldset.file-field {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 14px 14px;
  display: grid;
  gap: 8px;
}
fieldset legend { font-weight: 700; padding: 0 6px; }
fieldset.choice label, label.check { font-weight: 400; display: flex; gap: 10px; align-items: flex-start; }
fieldset.choice input, label.check input { margin-top: 4px; width: 18px; height: 18px; accent-color: var(--black); flex: none; }
.category-rows { display: grid; gap: 10px; }
.category-row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.category-row form { margin: 0; }
.inline-form { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; flex: 1 1 360px; }
.inline-form input[type="text"] { flex: 1 1 220px; width: auto; min-height: 40px; }
.link-button.danger { color: var(--danger); text-decoration-color: var(--danger); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.upload-progress p { margin: 0; }

/* People */
.people-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 24px; align-items: start; }
.people-layout aside .panel h2 { font-size: 1.05rem; }
.form-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.pill-error { background: var(--danger-tint); color: var(--danger); }
.summary-warn { border-top-color: var(--danger); }
.page-head .eyebrow a { color: inherit; }
@media (max-width: 900px) {
  .people-layout { grid-template-columns: 1fr; }
  .people-layout aside { order: -1; }
}

/* Retraining */
.text-danger { color: var(--danger); }
.validity { margin-top: -6px; }
.cert-valid { display: block; font-size: .9rem; color: #e6e6e6; margin-top: 4px; }
.retrain-box {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 16px 18px;
  margin-bottom: 16px;
  border-radius: var(--radius);
  background: var(--gold-tint);
  border-left: 5px solid var(--gold-deep);
}
.retrain-box.is-expired { background: var(--danger-tint); border-left-color: var(--danger); }
.retrain-box h2 { font-size: 1.05rem; margin-bottom: 4px; }
.retrain-box p { margin: 0; }
.retrain-box form { margin: 0; }

/* Phones */
@media (max-width: 640px) {
  .header-row { min-height: 64px; }
  .brand img { width: 140px; }
  .brand-tag { display: none; }
  .account-name span { display: none; }
  .account-name strong { font-size: .9rem; }
  .main { padding-top: 22px; }
  .auth-head, .auth-body { padding-left: 20px; padding-right: 20px; }
  .course-card { padding: 16px; }
  .course-banner { margin: -16px -16px 14px; }
  .footer-row { flex-direction: column; }
}

/* Per-client certificate length on the organization page */
.course-choice { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 16px; padding: 8px 0; border-bottom: 1px solid rgba(0, 0, 0, 0.06); }
.course-choice:last-child { border-bottom: 0; }
.client-months { display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; }
fieldset.choice .client-months label { font-weight: 400; font-size: 0.9rem; margin: 0; display: inline; }
fieldset.choice .client-months .short-input { width: 5.5em; height: auto; margin-top: 0; }

/* "View as" preview banner (platform admin only) */
.preview-banner { background: var(--gold); color: var(--ink); border-bottom: 2px solid var(--ink); }
.preview-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; padding-top: 8px; padding-bottom: 8px; }
.preview-row p { margin: 0; font-size: .92rem; }
.preview-banner .btn { background: var(--ink); color: var(--white); border-color: var(--ink); }
.view-as { margin-top: 8px; }
.view-as form { margin: 0; }

/* License end dates */
.date-input { width: 200px; }
tr.row-soon td { background: var(--gold-tint); }
tr.row-ended td { background: var(--danger-tint); }

/* Records downloads and the video page note */
.download-actions { display: flex; align-items: center; gap: 12px; }
.browser-note { margin: 6px 0 0; }

/* Final pass 2 */
.switched-off { margin: 4px 0 0 28px; color: var(--danger); }
.btn-danger { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-danger:hover { background: #8f1c13; border-color: #8f1c13; }
.danger-zone { border-left: 4px solid var(--danger); }
.danger-zone h2 { color: var(--danger); font-size: 1.05rem; }
.delete-link { color: var(--danger); margin-top: 4px; }
.delete-panel h2 { font-size: 1.05rem; margin-top: 18px; }
fieldset.choice .client-months .date-input { width: 165px; height: auto; margin-top: 0; }
.small-heading { font-size: .95rem; margin: 18px 0 8px; }
.inline-form { display: inline; margin: 0; }
.caption-form { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }
.legal { max-width: 820px; }
.legal h2 { font-size: 1.1rem; margin-top: 22px; }
.legal h2:first-child { margin-top: 0; }
.legal li { margin-bottom: 6px; }
.delete-panel form { margin-top: 18px; }
