:root { color-scheme: light dark; --line: #8884; --muted: #666; --accent: #1f4fd6; --danger: #b42318; --ok: #1b7a3d; --warn: #9a5b00; }
body { font: 15px/1.45 system-ui, -apple-system, "Segoe UI", sans-serif; margin: 0 auto; max-width: 76rem; padding: 1rem 1.25rem 3rem; }
.skip { position: absolute; left: -999px; }
.skip:focus { left: 1rem; top: 0.5rem; background: Canvas; padding: 0.25rem 0.5rem; }
h1 { font-size: 1.5rem; margin: 0.5rem 0 0.25rem; }
h2 { font-size: 1.15rem; margin: 2rem 0 0.5rem; }
h3 { font-size: 1rem; margin: 1.25rem 0 0.4rem; }
header p, .note { color: var(--muted); margin: 0.25rem 0; }
nav ul { list-style: none; display: flex; flex-wrap: wrap; gap: 0.25rem 1rem; padding: 0; margin: 0.5rem 0 0; }
fieldset { border: 1px solid var(--line); border-radius: 6px; margin: 0 0 1rem; padding: 0.5rem 1rem 1rem; }
legend { font-weight: 600; padding: 0 0.25rem; }
.row { display: flex; flex-direction: column; gap: 0.2rem; margin: 0.6rem 0; max-width: 36rem; }
.inline { display: flex; flex-wrap: wrap; gap: 0.5rem 1rem; align-items: end; margin: 0.6rem 0; }
.inline > div { display: flex; flex-direction: column; gap: 0.2rem; }
label.choice { display: block; margin: 0.35rem 0; }
input, select, textarea, button { font: inherit; padding: 0.35rem 0.5rem; }
input[type="number"] { width: 6rem; }
textarea { width: 100%; box-sizing: border-box; }
button { cursor: pointer; border: 1px solid var(--accent); background: transparent; color: var(--accent); border-radius: 6px; }
button.primary { background: var(--accent); color: #fff; }
button.danger { border-color: var(--danger); color: var(--danger); }
button:disabled { opacity: 0.55; cursor: not-allowed; }
:focus-visible { outline: 3px solid #2563eb; outline-offset: 2px; }
.actions { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 0.75rem 0; }
.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; margin: 0.25rem 0 1rem; }
caption { text-align: left; font-weight: 600; padding: 0.25rem 0; }
th, td { border-bottom: 1px solid var(--line); padding: 0.35rem 0.5rem; text-align: left; vertical-align: top; }
td .actions { margin: 0; }
dl.facts { display: grid; grid-template-columns: max-content 1fr; gap: 0.2rem 1rem; margin: 0.5rem 0 1rem; }
dl.facts dt { font-weight: 600; }
dl.facts dd { margin: 0; }
.callout { border: 1px solid var(--line); border-left: 4px solid var(--accent); padding: 0.6rem 0.8rem; margin: 0.75rem 0; border-radius: 4px; }
.callout.warn { border-left-color: var(--warn); }
.error { color: var(--danger); }
#status[data-state="error"] { color: var(--danger); }
#status[data-state="ok"] { color: var(--ok); }
.signer-row { display: flex; flex-wrap: wrap; gap: 0.5rem 1rem; align-items: end; padding: 0.5rem 0; border-bottom: 1px dashed var(--line); }
.signer-row > div { display: flex; flex-direction: column; gap: 0.2rem; }
.swatch { display: inline-block; width: 0.9rem; height: 0.9rem; border-radius: 2px; vertical-align: middle; margin-right: 0.35rem; }
#pages { display: flex; flex-direction: column; gap: 1rem; margin: 1rem 0; }
.page { position: relative; align-self: flex-start; border: 1px solid var(--line); background: #fff; cursor: crosshair; max-width: 100%; }
.page canvas { display: block; }
.page-label { font-size: 0.85rem; color: var(--muted); margin: 0 0 0.2rem; }
.field-box { position: absolute; box-sizing: border-box; border: 2px solid; background: rgba(31, 79, 214, 0.12); font-size: 11px; line-height: 1.1; color: #111; overflow: hidden; display: flex; align-items: flex-start; justify-content: space-between; }
.field-box span { padding: 1px 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.field-box button { border: 0; background: #fff; color: #111; padding: 0 4px; font-size: 12px; line-height: 1.2; border-radius: 0; }
details.audit summary { cursor: pointer; font-weight: 600; margin: 0.5rem 0; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.85em; word-break: break-all; }

/* esu1: views, the template editor, "Send to a person" and the #kiosk lock screen. */
[hidden] { display: none !important; }
nav a[aria-current="page"] { font-weight: 700; }
.editor { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1rem; }
.editor-pages { min-width: 0; overflow-x: auto; }
#t-pages { display: flex; flex-direction: column; gap: 1rem; margin: 0.5rem 0 1rem; }
.editor-side fieldset .row { max-width: none; }
#view-templates input[type="file"] { border: 1px solid #767676; border-radius: 6px; }
.editor-side input:not([type="checkbox"]):not([type="radio"]):not([type="number"]), .editor-side select { width: 100%; box-sizing: border-box; }
.editor-side .inline input[type="number"] { width: 5.5rem; }
.role-row { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: end; margin: 0.4rem 0; }
.role-row > div { display: flex; flex-direction: column; gap: 0.2rem; flex: 1 1 10rem; }
.insp-type { font-weight: 600; margin: 0.25rem 0; }
#t-pages .page { cursor: crosshair; }
#t-pages.ro .page { cursor: default; }
.tfield { position: absolute; box-sizing: border-box; border: 2px solid; border-radius: 0; margin: 0; padding: 0; background: rgba(31, 79, 214, 0.12);
  color: #111; font-size: 11px; line-height: 1.1; text-align: left; overflow: hidden; cursor: move; touch-action: none; }
#t-pages.ro .tfield { cursor: pointer; }
.tfield[aria-pressed="true"] { box-shadow: 0 0 0 2px #fff, 0 0 0 4px #111; overflow: visible; }
.tfield-text { display: block; padding: 1px 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; pointer-events: none; }
.tfield .grip { position: absolute; right: -1px; bottom: -1px; width: 10px; height: 10px; background: #111; cursor: nwse-resize; }
.tfield-list { list-style: none; padding: 0; margin: 0.25rem 0 1rem; display: flex; flex-direction: column; gap: 0.3rem; }
.tfield-list button { width: 100%; text-align: left; color: inherit; border-color: var(--line); }
.tfield-list button[aria-pressed="true"] { border-color: var(--accent); border-width: 2px; font-weight: 600; }
.results { margin-top: 0.75rem; }
label.person { display: flex; gap: 0.6rem; align-items: center; }
.person-text { display: flex; flex-direction: column; min-width: 0; overflow-wrap: anywhere; }
.person-name { font-weight: 600; }
.done-heading { font-weight: 600; margin: 0 0 0.5rem; }
main p { overflow-wrap: anywhere; }     /* a long email in "Sent to … at …" or #status wraps instead of widening the page */
.lock { max-width: 36rem; margin: 15vh auto 0; text-align: center; }
.lock ul { list-style: none; padding: 0; display: flex; flex-direction: column; gap: 0.75rem; align-items: center; }
.lock h1:focus { outline: none; }
.lock a { display: inline-flex; align-items: center; justify-content: center; padding: 0.6rem 1rem; border: 1px solid var(--accent); border-radius: 6px; color: var(--accent); }
#view-send input:not([type="radio"]):not([type="checkbox"]), #view-send select, #view-send textarea { width: 100%; max-width: 36rem; box-sizing: border-box; }

@media (min-width: 70rem) {
  .editor { grid-template-columns: minmax(0, 1fr) 21rem; }
  .editor-side { position: sticky; top: 0.5rem; align-self: start; max-height: calc(100vh - 1rem); overflow-y: auto; padding-right: 0.25rem; }
}

/* Phones: 44 px targets on the send flow and the lock screen, nothing wider than the screen. */
@media (max-width: 40rem) {
  body { padding: 0.75rem 0.75rem 2rem; }
  #view-send button, #view-send input:not([type="radio"]):not([type="checkbox"]), #view-send select, .lock a { min-height: 44px; }
  #view-send label.choice { display: flex; gap: 0.6rem; align-items: center; min-height: 44px; }
  #view-send .actions button { flex: 1 1 100%; }
  #view-send fieldset { padding: 0.5rem 0.75rem 0.75rem; min-width: 0; }
}
