/* ===== Document renderer: 3 themes (pink paper, emerald digital, blue & yellow) ===== */
.doc {
  --paper: #fff; --ink: #0b0c0c; --accent: #1d70b8; --accent-ink: #fff; --soft: #f3f2f1; --rule: #0b0c0c;
  --box-border: #0b0c0c; --box-bg: #fff; --call-bg: #fff7bf; --call-border: #ffdd00; --nhs: #005eb8;
  --legal-bg: #f3f2f1; --legal-border: #0b0c0c; --radius: 0px;
  font-family: Arial, Helvetica, sans-serif; color: var(--ink); font-size: 15px; line-height: 1.45;
  -webkit-print-color-adjust: exact; print-color-adjust: exact;
}
.doc *, .doc *::before, .doc *::after { box-sizing: border-box; }
.doc-page { background: var(--paper); width: 100%; max-width: 210mm; margin: 0 auto 22px; padding: 12mm 13mm 10mm;
  box-shadow: 0 3px 14px rgba(0,0,0,.18); position: relative; -webkit-box-decoration-break: clone; box-decoration-break: clone; }
@media (max-width: 640px) { .doc-page { padding: 18px 14px; } .doc { font-size: 14px; } }
.doc p { margin: 0 0 10px; }
.doc ul { margin: 0 0 10px; padding-left: 22px; }
.doc-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.doc-brand { display: flex; align-items: center; gap: 10px; }
.doc-mark { font-weight: 800; font-size: 20px; letter-spacing: 1px; border: 3px solid currentColor; padding: 0 6px; }
.doc-kicker { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .8px; max-width: 26ch; line-height: 1.25; }
.doc-ref { text-align: right; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .6px; }
.doc-ref-val { font-size: 18px; letter-spacing: 1px; white-space: nowrap; }
.doc-title { font-size: 24px; line-height: 1.15; margin: 4px 0 6px; font-weight: 800; }
.doc-intro { margin: 0 0 14px; font-size: 14px; }
.doc-addr { display: flex; justify-content: space-between; gap: 16px; margin: 6px 0 22px; flex-wrap: wrap; font-size: 15px; }
.doc-body { font-size: 15.5px; line-height: 1.55; }
.doc-body strong { font-weight: 700; }
.doc .mt { background: transparent; }
.doc--editing .mt { background: #fff7bf; outline: 1px dashed #b59f00; }
.doc--editing .mt--bad { background: #f4cdc6; outline: 1px dashed #d4351c; }
.doc-foot { margin-top: 18px; padding-top: 8px; border-top: 1px solid var(--rule); font-size: 11px; display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; opacity: .85; }

.doc-section { margin-bottom: 16px; break-inside: auto; }
.doc-sec-title { display: flex; align-items: center; gap: 10px; font-size: 16px; font-weight: 800; margin: 0 0 10px; padding: 6px 10px; background: var(--accent); color: var(--accent-ink); break-after: avoid; }
.doc-sec-num { width: 24px; height: 24px; border-radius: 50%; background: var(--accent-ink); color: var(--accent); display: flex; align-items: center; justify-content: center; font-size: 13px; flex: none; }
.doc-sec-body { padding: 0 2px; }
.doc-field { margin-bottom: 12px; break-inside: avoid; }
.doc-label { font-weight: 700; font-size: 14px; margin-bottom: 4px; }
.doc-req { color: #d4351c; margin-left: 3px; }
.doc-help { font-size: 12.5px; opacity: .8; margin: -2px 0 5px; }
.doc-line { border-bottom: 1.5px solid var(--rule); min-height: 26px; padding: 3px 2px 1px; font-family: "Courier New", monospace; font-weight: 700; font-size: 15px; }
.doc-lines .doc-line { margin-bottom: 4px; }
.doc-filled { border: 1.5px solid var(--box-border); background: var(--box-bg); padding: 6px 8px; white-space: pre-wrap; font-family: "Courier New", monospace; font-weight: 700; min-height: 48px; border-radius: var(--radius); }
.doc-chars { display: flex; flex-wrap: wrap; gap: 0; }
.doc-char { width: 22px; height: 28px; border: 1.5px solid var(--box-border); margin: 0 -1.5px -1.5px 0; background: var(--box-bg); display: inline-flex; align-items: center; justify-content: center; font-family: "Courier New", monospace; font-weight: 700; font-size: 16px; text-transform: uppercase; }
.doc-dob { display: flex; align-items: flex-end; gap: 10px; flex-wrap: wrap; }
.doc-dob-group { display: flex; flex-direction: column; align-items: flex-start; }
.doc-dob-group small { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; margin-bottom: 2px; }
.doc-opts { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 4px 12px; }
.doc-opt { display: flex; align-items: center; gap: 7px; font-size: 14px; min-height: 26px; }
.doc-box { width: 18px; height: 18px; border: 1.5px solid var(--box-border); background: var(--box-bg); display: inline-flex; align-items: center; justify-content: center; font-weight: 800; font-size: 14px; flex: none; }
.doc-box--round { border-radius: 50%; }
.doc-other { display: flex; align-items: flex-end; gap: 6px; grid-column: 1 / -1; }
.doc-other .doc-line { flex: 1; min-height: 22px; }
.doc-sig { border: 1.5px solid var(--box-border); background: var(--box-bg); padding: 8px 10px; break-inside: avoid; border-radius: var(--radius); }
.doc-sig-role { font-weight: 800; font-size: 13px; text-transform: uppercase; letter-spacing: .5px; margin-bottom: 4px; }
.doc-sig-pad { height: 64px; border-bottom: 1.5px dashed var(--rule); display: flex; align-items: flex-end; }
.doc-sig-pad img { max-height: 62px; max-width: 100%; }
.doc-sig-meta { display: grid; grid-template-columns: 1.6fr 1fr; gap: 12px; margin-top: 8px; font-size: 12px; font-weight: 700; }
@media (max-width: 520px) { .doc-sig-meta { grid-template-columns: 1fr; } }
.doc-callout { border-left: 8px solid var(--call-border); background: var(--call-bg); padding: 10px 12px; margin-bottom: 12px; break-inside: avoid; font-size: 14px; border-radius: var(--radius); }
.doc-callout strong { display: block; margin-bottom: 4px; font-size: 15px; }
.doc-callout p { margin: 0; }
.doc-callout--nhs { --call-border: var(--nhs); --call-bg: #e8f1f8; }
.doc-callout--nhs strong::before { content: "NHS"; background: var(--nhs); color: #fff; font-style: italic; font-weight: 800; padding: 0 5px; margin-right: 8px; font-size: 13px; }
.doc-callout--legal { --call-border: var(--legal-border); --call-bg: var(--legal-bg); }
.doc-callout--legal strong::before { content: "⚖ "; }
.doc-hidden-note { font-size: 12px; font-style: italic; opacity: .75; }

/* interactive (online) inputs */
.doc-input, .doc-textarea { width: 100%; font: 700 16px "Courier New", monospace; border: 2px solid var(--box-border); background: var(--box-bg); padding: 7px 8px; color: var(--ink); border-radius: var(--radius); }
.doc-textarea { min-height: 80px; resize: vertical; }
.doc-input:focus, .doc-textarea:focus, .doc-dob-in input:focus, .doc-opt input:focus { outline: 3px solid #ffdd00; outline-offset: 0; box-shadow: 0 0 0 5px #0b0c0c; }
.doc-opt input { width: 20px; height: 20px; margin: 0; accent-color: var(--accent); flex: none; }
label.doc-opt { cursor: pointer; }
.doc-dob-in { display: flex; align-items: flex-end; gap: 10px; flex-wrap: wrap; }
.doc-dob-in input { width: 30px; height: 38px; text-align: center; font: 700 18px "Courier New", monospace; border: 2px solid var(--box-border); background: var(--box-bg); margin-right: -2px; border-radius: 0; padding: 0; }
.sig-canvas { width: 100%; height: 120px; background: #fff; border: 1.5px dashed var(--rule); touch-action: none; display: block; cursor: crosshair; border-radius: var(--radius); }
.sig-tools { display: flex; gap: 10px; align-items: center; margin-top: 6px; flex-wrap: wrap; font-size: 13px; }
.sig-tools button { font: 700 13px Arial, sans-serif; background: var(--soft); border: 1px solid var(--box-border); padding: 4px 10px; cursor: pointer; color: var(--ink); }
.doc-field.has-error { border-left: 5px solid #d4351c; padding-left: 10px; }
.doc-field .doc-err { color: #d4351c; font-weight: 700; font-size: 14px; margin-bottom: 4px; }

/* ---------- Theme 1: DVLA-style pastel pink paper (matches the printed consent form) ---------- */
.doc--pink { --paper: #fbe2ea; --ink: #0b0c0c; --accent: #8e1450; --accent-ink: #fff; --soft: #fbe2ea; --rule: #0b0c0c;
  --box-border: #0b0c0c; --box-bg: #fff; --call-bg: #fff; --call-border: #8e1450; --legal-bg: #fff; --legal-border: #8e1450;
  --sec-bg: #fadbe5; --sec-border: #f3b9cc; }
/* ---------- Theme 2: Digital emerald green (matches the digital portal form) ---------- */
.doc--emerald { --paper: #e6f4e8; --ink: #0b0c0c; --accent: #1e5e28; --accent-ink: #fff; --soft: #e6f4e8; --rule: #0b0c0c;
  --box-border: #0b0c0c; --box-bg: #fff; --call-bg: #fff; --call-border: #1e5e28; --legal-bg: #fff; --legal-border: #1e5e28;
  --sec-bg: #e2f1e4; --sec-border: #c9e5cd; --sub: #3c8a46; }
.doc--pink { --sub: #b0185e; }
.doc--pink .doc-title, .doc--emerald .doc-title { color: var(--accent); text-transform: uppercase; font-size: 23px; letter-spacing: 0; }
.doc--pink .doc-form-top, .doc--emerald .doc-form-top { border-bottom: 3px solid var(--accent); padding-bottom: 6px; margin-bottom: 14px; }
.doc--pink .doc-head, .doc--emerald .doc-head { color: var(--accent); border-bottom: 3px solid var(--accent); padding-bottom: 8px; }
.doc--pink .doc-section, .doc--emerald .doc-section { background: var(--sec-bg); border: 1.5px solid var(--sec-border); padding: 10px 12px 4px; margin-bottom: 10px; }
.doc--pink .doc-sec-title, .doc--emerald .doc-sec-title { background: transparent; color: var(--accent); padding: 0; text-transform: uppercase; font-size: 16.5px; align-items: flex-start; }
.doc--pink .doc-sec-num { background: #fff; color: #0b0c0c; border: 2px solid #0b0c0c; border-radius: 0; width: 28px; height: 28px; font-size: 16px; }
.doc--emerald .doc-sec-num { background: var(--accent); color: #fff; border: 2px solid #0b0c0c; border-radius: 0; width: 28px; height: 28px; font-size: 16px; }
.doc--pink .doc-callout, .doc--emerald .doc-callout { border: 1.5px solid #0b0c0c; border-left: 1.5px solid #0b0c0c; }
.doc--pink .doc-callout--info, .doc--emerald .doc-callout--info { border-left: 6px solid var(--accent); }
.doc--pink .doc-callout--kit strong, .doc--emerald .doc-callout--kit strong { color: var(--accent); text-transform: uppercase; font-size: 13px; }
.doc--pink .doc-col strong, .doc--emerald .doc-col strong { color: #c00; font-size: 13px; }
.doc--pink .doc-sig, .doc--emerald .doc-sig { border-color: #0b0c0c; }
.doc--pink .doc-sig-role, .doc--emerald .doc-sig-role { color: var(--accent); }
.doc--emerald .doc-col strong { color: #c00; }
.doc-pill { display: inline-block; background: var(--accent); color: #fff; font-weight: 800; font-size: 11px; letter-spacing: 1px; text-transform: uppercase; padding: 3px 10px; border-radius: 3px; margin-bottom: 6px; }

/* ---------- Theme 3: GOV.UK / V5C style blue & yellow ---------- */
.doc--gov { --paper: #fff; --ink: #0b0c0c; --accent: #1d70b8; --accent-ink: #fff; --soft: #d2e2f1; --rule: #0b0c0c;
  --box-border: #0b0c0c; --box-bg: #fff; --call-bg: #fff2a8; --call-border: #ffdd00; --legal-bg: #fff2a8; --legal-border: #0b0c0c; }
.doc--gov .doc-page { padding-top: 0; }
.doc--gov .doc-head { margin: 0 -13mm 16px; padding: 12px 13mm; background: var(--accent); color: #fff; border-bottom: 8px solid #003078; }
@media (max-width: 640px) { .doc--gov .doc-head { margin: 0 -14px 14px; padding: 12px 14px; } }
.doc--gov .doc-section { background: var(--soft); padding: 10px 12px 2px; border-left: 6px solid var(--accent); }
.doc--gov .doc-sec-title { background: transparent; color: #0b0c0c; padding: 0; font-size: 17px; }
.doc--gov .doc-sec-num { background: #0b0c0c; color: #ffdd00; }
.doc--gov .doc-callout { border-left-width: 10px; }
.doc--gov .doc-callout--nhs { --call-bg: #fff; }
.doc--gov .doc-title { font-size: 26px; }

/* layout shared by all themes */
.doc-form-top { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.doc-form-top .doc-title { margin-top: 0; }
.doc-sec-name { display: block; }
.doc-sec-sub { display: block; font-size: 12.5px; font-weight: 700; text-transform: none; color: var(--sub, inherit); opacity: .95; margin-top: 1px; }
.doc-sec-body { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.doc-sec-body > * { grid-column: 1 / -1; }
.doc-sec-body > .doc-half { grid-column: auto; }
@media (max-width: 560px) { .doc-sec-body > .doc-half { grid-column: 1 / -1; } }
.doc-rect { border: 1.5px solid var(--box-border); background: var(--box-bg); min-height: 30px; padding: 4px 8px; font-family: "Courier New", monospace; font-weight: 700; font-size: 15px; }
.doc-opts { grid-template-columns: repeat(var(--cols, auto-fill), minmax(0, 1fr)); }
.doc-opts:not([style]) { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
@media (max-width: 560px) { .doc-opts[style]:not([style*="--cols:1"]) { grid-template-columns: 1fr 1fr; } }
.doc-help { font-size: 12.5px; opacity: .85; margin: 0 0 5px; }
.doc-callout { font-size: 13.5px; }
.doc-callout ul { margin: 2px 0 0; padding-left: 18px; }
.doc-callout p:last-child { margin-bottom: 0; }
.doc-callout--columns { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 0; background: transparent !important; border: 0 !important; }
.doc-callout--columns .doc-col { background: var(--box-bg); border: 1.5px solid var(--box-border); padding: 8px 10px; }
.doc-callout--columns p { margin-bottom: 2px; }
@media (max-width: 560px) { .doc-callout--columns { grid-template-columns: 1fr; } }
.doc-callout--info { background: var(--box-bg); }
.doc-callout--kit { background: var(--box-bg); }
.doc-callout--kit strong, .doc-callout--columns strong { display: block; }
.doc-inline { display: inline !important; }
.doc-confirm { font-size: 13px; align-items: flex-start; margin-bottom: 6px; }
.doc-sig .doc-label { margin-top: 6px; }
.doc-sig-pad { height: 56px; border: 1.5px solid var(--box-border); background: var(--box-bg); display: flex; align-items: center; justify-content: center; color: #6f777b; font-size: 13px; }
.doc-sig-date { display: flex; align-items: flex-end; gap: 8px; margin-top: 6px; font-size: 12px; font-weight: 700; }
.doc-sig-date .doc-char { width: 18px; height: 22px; font-size: 13px; }

/* print */
@media print {
  .doc-page { box-shadow: none; margin: 0; max-width: none; width: 210mm; min-height: 297mm; break-after: page; border-radius: 0 !important; }
  .doc-page:last-child { break-after: auto; }
  .doc--editing .mt, .doc--editing .mt--bad { background: none; outline: none; }
  .sig-tools { display: none; }
}

/* bulk PDF export */
.pdf-export .doc-page { box-shadow: none; margin: 0; width: 210mm; max-width: none; border-radius: 0; }
