@font-face { font-family: 'Dancing Script'; src: url(/vendor/fonts/dancing-script/dancing-script-latin-400-normal.woff2) format('woff2'); font-display: block; }
@font-face { font-family: 'Great Vibes'; src: url(/vendor/fonts/great-vibes/great-vibes-latin-400-normal.woff2) format('woff2'); font-display: block; }
@font-face { font-family: 'Homemade Apple'; src: url(/vendor/fonts/homemade-apple/homemade-apple-latin-400-normal.woff2) format('woff2'); font-display: block; }

:root {
  --bg: #f4f5f7;
  --panel: #fff;
  --ink: #1f2937;
  --muted: #6b7280;
  --line: #e5e7eb;
  /* From the ScoutSign logo: green, navy, gold, on cream. */
  --brand: #365438;
  --brand-ink: #fff;
  --navy: #172e50;
  --gold: #b9984f;
  --cream: #f3f3e9;
  --accent: #f59e0b;
  --danger: #b91c1c;
  --radius: 10px;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font: 16px/1.45 system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif; color: var(--ink); background: var(--bg); }
a { color: var(--brand); }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5rem; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.15rem; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.hidden { display: none !important; }

header.top { background: var(--cream); color: var(--navy); padding: .35rem 1.25rem; display: flex; align-items: center; gap: 1rem; border-bottom: 3px solid var(--gold); }
header.top .logo { display: flex; align-items: center; line-height: 0; }
header.top .logo img { height: 48px; width: auto; }
header.top .btn { background: #fff; color: var(--navy); border-color: #d6d3c4; }
header.top .btn:hover { background: #fbfaf5; }
header.top .btn.primary { background: var(--brand); color: #fff; border-color: var(--brand); }
header.top .spacer { flex: 1; }
/* Who is signed in, with Admin and Sign out. */
header.top .me { display: flex; gap: .75rem; align-items: center; font-size: .875rem; color: var(--navy); }
header.top .me a { color: var(--brand); }
header.top .me button { border: none; background: none; padding: 0; color: var(--muted); text-decoration: underline; font-size: inherit; }
header.top .me button:hover { background: none; color: var(--navy); }
header.top .me span { max-width: 16rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 560px) { header.top .me span { display: none; } }

main { max-width: 1100px; margin: 0 auto; padding: 1.25rem; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.25rem; margin-bottom: 1rem; }

button, .btn {
  font: inherit; cursor: pointer; border: 1px solid var(--line); background: #fff; color: var(--ink);
  border-radius: 8px; padding: .55rem 1rem; display: inline-flex; align-items: center; gap: .4rem; text-decoration: none;
}
button:hover, .btn:hover { border-color: #cbd5e1; background: #f9fafb; }
button:disabled { opacity: .5; cursor: not-allowed; }
.primary { background: var(--brand); color: #fff; border-color: var(--brand); font-weight: 600; }
.primary:hover { background: #2b4530; }
.big { padding: .8rem 1.4rem; font-size: 1.05rem; }
.danger { color: var(--danger); }
.linkish { border: none; background: none; padding: .2rem; color: var(--muted); }
.linkish:hover { background: none; color: var(--ink); }

input[type=text], input[type=email], input[type=tel], input[type=password], input[type=number], select {
  font: inherit; padding: .5rem .65rem; border: 1px solid #d1d5db; border-radius: 8px; width: 100%; background: #fff;
}
label { display: block; font-size: .875rem; color: var(--muted); margin: .4rem 0 .2rem; }

.badge { display: inline-block; padding: .1rem .55rem; border-radius: 999px; font-size: .8rem; font-weight: 600; background: #e5e7eb; }
.badge.signed, .badge.completed { background: #dcfce7; color: #166534; }
.badge.pending, .badge.out { background: #fef3c7; color: #92400e; }
.dot { width: .8rem; height: .8rem; border-radius: 50%; display: inline-block; flex: none; }

table { width: 100%; border-collapse: collapse; }
td, th { text-align: left; padding: .55rem .4rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: .8rem; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }

.toast { position: fixed; left: 50%; bottom: 1.5rem; transform: translateX(-50%); background: #111827; color: #fff; padding: .6rem 1rem; border-radius: 8px; z-index: 100; }
.error { color: var(--danger); }

/* ---- PDF pages ---- */
/* Centred with auto margins, not flex centring: a flex-centred page wider than its
   container overflows to the left too, out of reach of the scrollbar and over
   whatever sits beside it. Auto margins collapse to 0 and overflow only rightwards. */
.pages { display: block; padding: 1rem 0 6rem; overflow-x: auto; }
.page { position: relative; width: 100%; max-width: 860px; margin: 0 auto 1rem; background: #fff; box-shadow: 0 1px 4px rgba(0,0,0,.18); container-type: inline-size; user-select: none; }
.page canvas { display: block; width: 100%; height: auto; }
.page .num { position: absolute; right: .4rem; bottom: .3rem; font-size: .7rem; color: var(--muted); pointer-events: none; }

.field {
  position: absolute; border: 2px solid var(--c, #2563eb); background: color-mix(in srgb, var(--c, #2563eb) 14%, transparent);
  border-radius: 4px; display: flex; align-items: center; overflow: hidden; font-size: 1.4cqw; color: var(--c); font-weight: 600;
  padding: 0 .3em; white-space: nowrap; touch-action: none;
}
/* Date boxes often sit on tiny blanks: keep the chrome thin so the text shows. */
.field.date { border-width: 1px; padding: 0 1px; }
.field.date .handle { width: 8px; height: 8px; }
/* A bigger invisible grab area than the visible corner, so tiny boxes are resizable. */
.field .handle::before { content: ''; position: absolute; inset: -6px; }
.field.part { justify-content: center; }
.field .content { display: contents; }
.field .date-text.prompt { color: #6b7280; font-style: italic; }
/* Fill-in boxes on the signing page: a real input laid over the blank. */
.field.text input { all: unset; width: 100%; height: 100%; font-family: Helvetica, Arial, sans-serif; color: #111; cursor: text; }
.field.text input::placeholder { color: #9ca3af; font-style: italic; }
.sign .field.text { cursor: text; animation: none; background: color-mix(in srgb, var(--c) 10%, #fff); }
.sign .field.text.missing { outline: 2px solid var(--danger); }
.field.ghost { border-style: dashed; pointer-events: none; }
.field.selected { outline: 3px solid color-mix(in srgb, var(--c) 40%, transparent); outline-offset: 1px; }
.field .handle { position: absolute; right: -1px; bottom: -1px; width: 14px; height: 14px; background: var(--c); cursor: nwse-resize; border-radius: 3px 0 3px 0; }
.field .date-text { color: #111; font-weight: 400; font-family: Helvetica, Arial, sans-serif; }
/* Signature preview: placed by sigfit.js (baseline on the box's dashed line). */
.field img { position: absolute; max-width: none; }
/* The signature box's baseline: line it up with the form's signature line. Room for
   descenders sits below it. Must match BASELINE in sigfit.js. */
.field.signature { align-items: flex-start; }
.field.signature::after { content: ''; position: absolute; left: 0; right: 0; top: 70%; border-top: 1.5px dashed var(--c); pointer-events: none; }
.sign .field.signature.filled::after { border-top-color: transparent; }
.prep .field { cursor: move; }
.prep .pages.placing .page { cursor: crosshair; }

/* signer view */
.sign .field { --c: #d97706; border-style: dashed; cursor: pointer; animation: pulse 2s infinite; }
.sign .field.filled { animation: none; border-style: solid; background: rgba(255,255,255,.4); }
/* Dates are filled in automatically: show where they go, but don't invite a click. */
.sign .field.date { cursor: default; animation: none; }
@keyframes pulse { 50% { background: color-mix(in srgb, var(--c) 30%, transparent); } }

.bar { position: fixed; left: 0; right: 0; bottom: 0; background: #fff; border-top: 1px solid var(--line); padding: .75rem 1rem; display: flex; gap: .75rem; align-items: center; justify-content: center; flex-wrap: wrap; z-index: 20; box-shadow: 0 -2px 10px rgba(0,0,0,.06); }

/* modal */
.modal-back { position: fixed; inset: 0; background: rgba(17,24,39,.55); display: flex; align-items: center; justify-content: center; z-index: 50; padding: 1rem; }
.modal { background: #fff; border-radius: 14px; width: min(620px, 100%); max-height: 95vh; overflow: auto; padding: 1.25rem; }
.tabs { display: flex; gap: .25rem; border-bottom: 1px solid var(--line); margin: .75rem 0 1rem; }
.tabs button { border: none; border-bottom: 3px solid transparent; border-radius: 0; background: none; padding: .5rem 1rem; font-weight: 600; color: var(--muted); }
.tabs button.on { color: var(--brand); border-bottom-color: var(--brand); }
.styles { display: grid; gap: .5rem; margin-top: .75rem; }
.styles button { justify-content: flex-start; font-size: 2rem; padding: .3rem 1rem; min-height: 3.6rem; overflow: hidden; white-space: nowrap; }
.styles button.on { border: 2px solid var(--brand); background: #f0fdf4; }
.pad-wrap { position: relative; border: 1px dashed #9ca3af; border-radius: 10px; background: #fafafa; }
.pad-wrap canvas { display: block; width: 100%; height: 210px; touch-action: none; cursor: crosshair; }
.pad-wrap .baseline { position: absolute; left: 8%; right: 8%; bottom: 52px; border-bottom: 1px solid #d1d5db; pointer-events: none; }
.pad-wrap .hint { position: absolute; left: 8%; bottom: 30px; font-size: .8rem; color: #9ca3af; pointer-events: none; }
.consent { display: flex; gap: .6rem; align-items: flex-start; margin: 1rem 0; font-size: .9rem; }
.consent input { margin-top: .25rem; width: 1.1rem; height: 1.1rem; }
.row { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
