:root {
  --blue: #00679e;
  --blue-dark: #004f7a;
  --blue-soft: #e8f3f8;
  --ink: #22313a;
  --muted: #68767e;
  --line: #cdd7dc;
  --paper: #fff;
  --surface: #edf2f4;
  --success: #16734b;
  --danger: #b42318;
}

* { box-sizing: border-box; }

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background: var(--surface);
  font-family: Arial, Helvetica, sans-serif;
}

a { color: inherit; }
button, input { font: inherit; }

.site-header {
  position: sticky;
  z-index: 10;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px max(20px, calc((100vw - 1180px) / 2));
  color: #fff;
  background: #142832;
  box-shadow: 0 5px 20px rgb(10 30 40 / 18%);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  text-decoration: none;
}

.brand span, .login-mark {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 7px;
  color: #fff;
  background: var(--blue);
  font-size: 14px;
  font-weight: 800;
}

.page { width: min(1180px, calc(100% - 32px)); margin: 0 auto; padding: 42px 0 60px; }
.eyebrow { margin: 0 0 7px; color: var(--blue); font-size: 12px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.hero { max-width: 760px; margin-bottom: 30px; }
.hero h1 { margin: 0 0 10px; font-size: clamp(30px, 5vw, 50px); letter-spacing: -.035em; }
.hero > p:last-child { margin: 0; color: var(--muted); font-size: 17px; line-height: 1.55; }

.button {
  display: inline-flex;
  min-height: 42px;
  padding: 10px 15px;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 7px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}

.button:focus-visible, .signature-trigger:focus-visible, input:focus-visible { outline: 3px solid #79caf4; outline-offset: 2px; }
.button-primary { color: #fff; background: var(--blue); }
.button-primary:hover { background: var(--blue-dark); }
.button-secondary { color: var(--ink); background: #e1e8eb; }
.button-secondary:hover { background: #d5dfe3; }
.button-quiet { min-height: 36px; padding: 7px 11px; color: #fff; background: rgb(255 255 255 / 10%); }
.button:disabled { cursor: wait; opacity: .55; }

.alert { margin-bottom: 18px; padding: 13px 16px; border-radius: 7px; }
.alert-error { color: #7a1d16; background: #fee9e7; }

.login-page { display: grid; width: 100%; min-height: 100vh; padding: 24px; place-items: center; }
.login-card { width: min(460px, 100%); padding: 38px; border-top: 5px solid var(--blue); background: var(--paper); box-shadow: 0 18px 55px rgb(25 52 65 / 16%); }
.login-mark { width: 52px; height: 52px; margin-bottom: 24px; font-size: 18px; }
.login-card h1 { margin: 0 0 12px; font-size: 34px; }
.intro { margin: 0 0 27px; color: var(--muted); line-height: 1.55; }
.login-form { display: grid; gap: 10px; }
.login-form label { font-size: 13px; font-weight: 700; }
.login-form input { width: 100%; min-height: 49px; margin-bottom: 7px; padding: 10px 12px; border: 1px solid #aebdc4; border-radius: 6px; }

.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(330px, 1fr)); gap: 18px; }
.form-card { display: flex; min-height: 360px; padding: 25px; flex-direction: column; border-top: 4px solid var(--blue); background: var(--paper); box-shadow: 0 7px 24px rgb(26 55 68 / 9%); }
.form-card-top { display: flex; align-items: center; justify-content: space-between; }
.date-badge { color: var(--blue); font-size: 13px; font-weight: 800; }
.status-badge { padding: 5px 9px; border-radius: 999px; color: #744d05; background: #fff1c7; font-size: 11px; font-weight: 800; }
.status-badge.complete { color: #0f6240; background: #d9f3e7; }
.form-card h2 { margin: 24px 0 20px; font-size: 23px; line-height: 1.2; }
.form-card dl { display: grid; gap: 8px; margin: 0 0 22px; }
.form-card dl div { display: grid; grid-template-columns: 50px 1fr; gap: 10px; }
.form-card dt { color: var(--muted); font-size: 12px; font-weight: 700; text-transform: uppercase; }
.form-card dd { margin: 0; font-size: 14px; }
.progress { width: 100%; height: 8px; margin-top: auto; overflow: hidden; border: 0; border-radius: 99px; background: #dce4e8; appearance: none; }
.progress::-webkit-progress-bar { border-radius: 99px; background: #dce4e8; }
.progress::-webkit-progress-value { border-radius: 99px; background: var(--blue); }
.progress::-moz-progress-bar { border-radius: 99px; background: var(--blue); }
.progress-label { margin: 7px 0 19px; color: var(--muted); font-size: 12px; }
.card-actions { display: flex; flex-wrap: wrap; gap: 8px; }

.back-link { display: inline-block; margin-bottom: 17px; color: var(--blue-dark); font-weight: 700; text-decoration: none; }
.document { padding: 35px 40px; background: var(--paper); box-shadow: 0 8px 30px rgb(25 52 65 / 10%); }
.document-header h1 { max-width: 850px; margin: 0; font-size: clamp(27px, 4vw, 41px); letter-spacing: -.025em; }
.training-details { display: grid; grid-template-columns: 1fr 1fr 2fr; gap: 16px; margin: 25px 0 18px; padding: 17px; border-radius: 7px; background: var(--blue-soft); }
.training-details span { display: block; margin-bottom: 5px; color: var(--blue); font-size: 10px; font-weight: 800; text-transform: uppercase; }
.training-details strong { font-size: 14px; }
.statement { max-width: 1000px; margin: 0 0 20px; font-size: 14px; line-height: 1.55; }

.participant-list { border: 1px solid var(--line); }
.participant-row { display: grid; grid-template-columns: 55px minmax(170px, 1fr) minmax(310px, 1.15fr); align-items: center; min-height: 82px; }
.participant-row:nth-child(odd) { background: #f5f7f8; }
.participant-row > * { height: 100%; padding: 10px 14px; align-content: center; border-right: 1px solid var(--line); }
.participant-row > *:last-child { border-right: 0; }
.participant-head { min-height: 43px; color: #fff; background: var(--blue) !important; font-size: 12px; font-weight: 800; }
.participant-number { text-align: center; }
.signature-trigger { width: 100%; min-height: 57px; border: 2px dashed #5aa9d2; border-radius: 6px; color: var(--blue); background: #fff; font-weight: 700; cursor: pointer; }
.signature-trigger:hover { color: #fff; border-style: solid; background: var(--blue); }
.signed-box { position: relative; display: flex; min-height: 57px; align-items: center; justify-content: center; border: 1px solid #8bc3a9; border-radius: 6px; background: #f5fcf8; }
.signed-box img { width: calc(100% - 90px); height: 53px; object-fit: contain; }
.signed-box span { position: absolute; right: 8px; bottom: 5px; color: var(--success); font-size: 10px; font-weight: 800; text-transform: uppercase; }
.document-actions { margin-top: 20px; text-align: right; }

dialog { width: min(850px, calc(100% - 24px)); padding: 0; border: 0; border-radius: 12px; box-shadow: 0 25px 90px rgb(0 0 0 / 35%); }
dialog::backdrop { background: rgb(12 30 38 / 75%); }
.modal-head { padding: 23px 25px 14px; }
.modal-head h2 { margin: 0 0 7px; font-size: 27px; }
.modal-head > p:last-child { margin: 0; color: var(--muted); }
.canvas-wrap { padding: 0 25px; }
#signaturePad { display: block; width: 100%; height: 300px; border: 2px solid var(--blue); border-radius: 8px; background-color: #fff; background-image: linear-gradient(to bottom, transparent 79%, #ccd5d9 80%, transparent 81%); touch-action: none; cursor: crosshair; }
.confirmation-check { display: flex; gap: 10px; margin: 15px 25px 0; align-items: flex-start; font-size: 13px; line-height: 1.4; }
.confirmation-check input { width: 18px; height: 18px; flex: none; accent-color: var(--blue); }
.modal-error { min-height: 18px; margin: 10px 25px 0; color: var(--danger); font-size: 13px; font-weight: 700; }
.modal-actions { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px; padding: 12px 25px 25px; }
.modal-actions > div { display: flex; flex-wrap: wrap; gap: 8px; }

@media (max-width: 720px) {
  .page { width: 100%; padding: 27px 14px 45px; }
  .site-header { position: static; padding: 10px 14px; }
  .document { padding: 24px 14px; }
  .training-details { grid-template-columns: 1fr 1fr; }
  .training-details > div:last-child { grid-column: 1 / -1; }
  .participant-list { border: 0; }
  .participant-head { display: none; }
  .participant-row { grid-template-columns: 38px 1fr; margin-bottom: 10px; border: 1px solid var(--line); border-radius: 7px; background: #fff !important; }
  .participant-row > * { min-height: 48px; border: 0; }
  .participant-row > div:last-child { grid-column: 1 / -1; padding-top: 0; }
  .document-actions .button { width: 100%; }
  #signaturePad { height: 230px; }
  .modal-actions, .modal-actions > div { width: 100%; }
  .modal-actions .button { flex: 1; }
}
