:root {
  --blue: #0c2f6b;
  --blue-2: #0f4c9b;
  --bg: #f4f7fb;
  --line: #d6dee9;
  --muted: #667085;
  --danger: #d92d20;
  --success: #16794b;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--bg); color: #172033; font-family: Arial, Helvetica, sans-serif; }
.wrap { width: min(1080px, calc(100% - 36px)); margin: 0 auto; }
.topbar { background: var(--blue); color: #fff; box-shadow: 0 2px 10px #0002; }
.topbar__inner { min-height: 80px; display: flex; justify-content: space-between; align-items: center; gap: 24px; }
.brand { font-size: 26px; font-weight: 800; letter-spacing: -.02em; }
.brand-sub { margin-top: 2px; font-size: 12px; opacity: .82; letter-spacing: .04em; text-transform: uppercase; }
.institution { max-width: 470px; text-align: right; font-size: 14px; line-height: 1.4; opacity: .95; }
.app-shell { padding: 42px 0 30px; }
.intro { margin-bottom: 26px; }
.eyebrow { margin: 0 0 8px; color: var(--blue-2); font-size: 12px; font-weight: 800; letter-spacing: .1em; }
.intro h1 { margin: 0 0 12px; color: #17365f; font-size: clamp(28px, 4vw, 42px); line-height: 1.08; letter-spacing: -.03em; }
.intro p:last-child { max-width: 820px; margin: 0; color: #536070; line-height: 1.58; font-size: 15px; }
.form-grid { display: grid; gap: 20px; }
.form-section { background: #fff; border: 1px solid #e1e7ef; border-radius: 16px; padding: 24px; box-shadow: 0 8px 24px #162b4a0c; }
.form-section h2 { margin: 0 0 20px; color: #153760; font-size: 19px; line-height: 1.2; }
.fields { display: grid; gap: 18px; }
.fields.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.span-2 { grid-column: 1 / -1; }
label { display: flex; flex-direction: column; gap: 7px; min-width: 0; color: #25344b; font-size: 13px; font-weight: 700; }
label small { color: var(--muted); font-size: 12px; font-weight: 400; line-height: 1.35; }
.field-label { display: block; }
.field-hint { display: block; min-height: 16px; color: var(--muted); font-size: 12px; font-weight: 400; line-height: 1.35; }
.fields.two > label,
.fields.two > .span-2 {
  display: grid;
  grid-template-rows: auto 18px 44px;
  gap: 5px;
  align-content: start;
}
.fields.two > label input,
.fields.two > .span-2 input {
  grid-row: 3;
}
.fields.two > label small,
.fields.two > .span-2 small,
.fields.two > label .field-hint,
.fields.two > .span-2 .field-hint {
  grid-row: 2;
  min-height: 18px;
}
.fields.two > label .field-label,
.fields.two > .span-2 .field-label {
  grid-row: 1;
}
input[type="date"]::-webkit-calendar-picker-indicator { cursor: pointer; }
input { width: 100%; height: 44px; border: 1px solid var(--line); border-radius: 9px; padding: 0 12px; background: #fff; color: #111827; font: 400 14px Arial, Helvetica, sans-serif; outline: none; }
input:focus { border-color: #4e7fc5; box-shadow: 0 0 0 3px #4e7fc51c; }
.invalid-field { border-color: var(--danger) !important; box-shadow: 0 0 0 3px #d92d2014 !important; }
.sig-pad-wrap { margin-top: 20px; border: 1px solid var(--line); border-radius: 14px; padding: 14px; background: #fbfcfe; }
.sig-pad-top { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 10px; }
.sig-pad-top strong { color: #153760; font-size: 15px; }
.sig-pad-hint { max-width: 720px; margin-top: 4px; color: var(--muted); font-size: 12px; line-height: 1.4; }
.signature-canvas-shell { position: relative; width: 100%; height: 190px; }
canvas.signature-pad { position: absolute; inset: 0; width: 100%; height: 190px; display: block; background: #fff; border: 1px dashed #9fb0c8; border-radius: 10px; cursor: crosshair; touch-action: none; user-select: none; -webkit-user-select: none; }
.signature-placeholder { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); color: #a0aaba; font-size: 14px; font-weight: 600; pointer-events: none; }
.hidden { display: none !important; }
.btn-ghost { border: 1px solid #d8e0ec; border-radius: 8px; padding: 8px 14px; background: #f4f7fb; color: #344054; font-size: 13px; font-weight: 700; cursor: pointer; }
.actions { position: sticky; bottom: 0; z-index: 5; display: flex; justify-content: flex-end; gap: 10px; padding: 18px 0; background: linear-gradient(transparent, var(--bg) 28%); }
.btn { border: 0; border-radius: 10px; padding: 13px 20px; font-size: 15px; font-weight: 800; cursor: pointer; }
.btn-primary { background: var(--blue-2); color: #fff; }
.btn-secondary { background: #fff; color: var(--blue); border: 1px solid #bfcce0; }
.status { min-height: 22px; margin: 0; color: var(--muted); font-size: 14px; text-align: right; }
.status.error { color: var(--danger); font-weight: 700; }
.site-footer { border-top: 1px solid #dfe6ef; background: #fff; }
.site-footer__inner { min-height: 64px; display: flex; align-items: center; justify-content: space-between; gap: 18px; color: var(--muted); font-size: 12px; line-height: 1.45; }
.site-footer a { color: var(--blue-2); font-weight: 700; text-decoration: none; }
.site-footer a:hover, .site-footer a:focus { text-decoration: underline; }
.privacy-card { max-width: 820px; margin: 0 auto; background: #fff; border: 1px solid #e1e7ef; border-radius: 16px; padding: 28px; box-shadow: 0 8px 24px #162b4a0c; }
.privacy-card h1 { margin: 0 0 18px; color: #17365f; font-size: clamp(26px, 4vw, 38px); line-height: 1.12; }
.privacy-card h2 { margin: 26px 0 8px; color: #153760; font-size: 18px; }
.privacy-card p { margin: 0 0 14px; color: #3f4b5d; line-height: 1.65; font-size: 14px; }
.privacy-card a { color: var(--blue-2); font-weight: 700; }
.privacy-back { display: inline-block; margin-top: 10px; }
.preview-open { overflow: hidden; }
#previewDialog { position: fixed; inset: 0; z-index: 9999; display: flex; align-items: center; justify-content: center; padding: 20px; background: #0b172ab8; }
.preview-box { width: min(980px, 96vw); height: min(95vh, 1120px); overflow: hidden; background: #fff; border-radius: 14px; box-shadow: 0 30px 70px #0005; }
.dialog-head { height: 58px; display: flex; justify-content: space-between; align-items: center; padding: 10px 14px 10px 18px; background: #fff; border-bottom: 1px solid #e5e7eb; }
.dialog-actions { display: flex; align-items: center; gap: 8px; }
.dialog-print { border: 0; border-radius: 8px; padding: 9px 14px; background: var(--blue-2); color: #fff; font-weight: 800; cursor: pointer; }
.dialog-close { border: 0; padding: 4px 8px; background: transparent; font-size: 28px; line-height: 1; cursor: pointer; }
#previewFrame { width: 100%; height: calc(100% - 58px); border: 0; background: #d8dce2; }
@media (max-width: 760px) {
  .topbar__inner { flex-direction: column; align-items: flex-start; padding: 16px 0; }
  .institution { text-align: left; }
  .site-footer__inner { flex-direction: column; align-items: flex-start; justify-content: center; padding: 14px 0; }
  .fields.two { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
  .form-section { padding: 18px; }
  .sig-pad-top { flex-direction: column; align-items: flex-start; }
  .actions { justify-content: stretch; }
  .btn { flex: 1; }
  #previewDialog { padding: 6px; }
  .preview-box { width: 100%; height: 98vh; border-radius: 8px; }
  .dialog-head > strong { font-size: 13px; }
  .dialog-print { padding: 8px 10px; font-size: 12px; }
}
