:root {
  --ink: #1b2430; --muted: #5b6573; --line: #d5dbe3; --bg: #f4f6f9; --card: #fff;
  --primary: #1d5fa8; --primary-dark: #154a85; --ok: #1f7a46; --ok-bg: #e6f4ec;
  --warn: #8a5a00; --warn-bg: #fff4dc; --err: #b3261e; --err-bg: #fdecea; --info-bg: #e8f0fb;
  --radius: 12px; --focus: 0 0 0 3px #ffbf47;
}
* { box-sizing: border-box; }
html { font-size: 18px; }
body { margin: 0; font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: var(--ink); background: var(--bg); line-height: 1.5; }
body.admin { font-size: 15px; }
.wrap { max-width: 720px; margin: 0 auto; padding: 0 16px 48px; }
.wrap-wide { max-width: 1200px; margin: 0 auto; padding: 0 16px 48px; }
h1 { font-size: 1.6rem; line-height: 1.25; margin: 0 0 .6em; }
h2 { font-size: 1.2rem; margin: 1.2em 0 .5em; }
h3 { font-size: 1.05rem; margin: 1em 0 .4em; }
a { color: var(--primary); }
:focus-visible { outline: none; box-shadow: var(--focus); }
.small { font-size: .85rem; } .muted { color: var(--muted); } .nowrap { white-space: nowrap; } .break { word-break: break-all; }
.mt { margin-top: 1rem; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin: 16px 0; }
.card.narrow { max-width: 520px; margin: 32px auto; }
.lead { font-size: 1.1rem; }
.sim-banner { background: #3b2f00; color: #ffe9a8; font-size: .8rem; padding: 6px 16px; text-align: center; }
.flash { background: var(--info-bg); border-left: 4px solid var(--primary); padding: 10px 14px; margin: 12px 0; border-radius: 6px; }

/* employee header + progress */
.emp-header { background: var(--primary); color: #fff; }
.emp-header .wrap { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; }
.emp-header .brand { font-weight: 600; font-size: .9rem; }
.emp-header .exit { color: #fff; font-size: .9rem; }
.progress { padding-top: 14px; padding-bottom: 0; }
.progress-text { margin: 0 0 6px; font-weight: 600; color: var(--muted); font-size: .9rem; }
.bar { height: 10px; background: #dfe5ee; border-radius: 6px; overflow: hidden; }
.bar span { display: block; height: 100%; width: 0; background: var(--ok); transition: width .3s; }
.steps { display: none; list-style: none; padding: 0; margin: 8px 0 0; gap: 6px; flex-wrap: wrap; font-size: .75rem; }
.steps li { padding: 2px 8px; border-radius: 10px; background: #e6eaf0; color: var(--muted); }
.steps li.done { background: var(--ok-bg); color: var(--ok); } .steps li.cur { background: var(--primary); color: #fff; }
@media (min-width: 700px) { .steps { display: flex; } }

/* fields */
.field { margin: 18px 0; }
.field[hidden] { display: none; }
.label, legend { display: block; font-weight: 600; margin-bottom: 4px; }
fieldset { border: 0; padding: 0; margin: 0; }
.help { color: var(--muted); font-size: .88rem; margin: 2px 0 8px; }
.req { display: inline-block; font-size: .7rem; font-weight: 700; color: var(--err); background: var(--err-bg); padding: 1px 6px; border-radius: 8px; vertical-align: middle; }
.opt { font-weight: 400; color: var(--muted); font-size: .85rem; }
input[type=text], input:not([type]), input[type=email], input[type=tel], input[type=date], input[type=password], select, textarea {
  width: 100%; font: inherit; padding: 12px; border: 2px solid #9aa6b5; border-radius: 8px; background: #fff; min-height: 50px; }
body.admin input:not([type=checkbox]):not([type=radio]), body.admin select, body.admin textarea { min-height: 38px; padding: 7px 9px; border-width: 1px; }
input:focus, select:focus, textarea:focus { border-color: var(--primary); }
.has-error input, .has-error select, .has-error textarea, .has-error fieldset { border-color: var(--err); }
.has-error { border-left: 4px solid var(--err); padding-left: 12px; }
.err { color: var(--err); font-weight: 600; margin: 6px 0 0; font-size: .92rem; }
.choice, .check { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border: 2px solid var(--line); border-radius: 10px; margin: 8px 0; cursor: pointer; background: #fff; }
.choice:has(input:checked), .check:has(input:checked) { border-color: var(--primary); background: #f1f6fd; }
.choice input, .check input { width: 24px; height: 24px; margin: 2px 0 0; flex: none; accent-color: var(--primary); }
.choice.inline { display: inline-flex; margin-right: 8px; }
body.admin .choice, body.admin .check { padding: 6px 10px; border-width: 1px; }
body.admin .check.small, body.admin .choice.small { display: inline-flex; padding: 4px 8px; margin: 3px; }
body.admin .check input, body.admin .choice input { width: 18px; height: 18px; }
.code-input { font-size: 1.6rem !important; letter-spacing: .3em; text-align: center; }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; font: inherit; font-weight: 600; border-radius: 10px; padding: 12px 22px; min-height: 52px; border: 2px solid transparent; cursor: pointer; text-decoration: none; }
.btn-primary { background: var(--primary); color: #fff; } .btn-primary:hover { background: var(--primary-dark); }
.btn-primary[disabled] { opacity: .5; cursor: not-allowed; }
.btn-secondary { background: #fff; color: var(--primary); border-color: var(--primary); }
.btn-warn { background: var(--warn); color: #fff; }
.btn-link { background: none; border: 0; color: var(--primary); text-decoration: underline; padding: 6px; min-height: 0; font-weight: 500; }
.btn-block { width: 100%; margin-top: 12px; } .btn-big { font-size: 1.15rem; min-height: 60px; }
.btn-small { padding: 6px 12px; min-height: 36px; font-size: .85rem; }
body.admin .btn { min-height: 38px; padding: 8px 16px; }
.actions { display: flex; gap: 12px; justify-content: space-between; flex-wrap: wrap; margin-top: 28px; }
.actions .btn-primary { flex: 1 1 220px; }
.autosave-status { color: var(--muted); font-size: .85rem; text-align: center; margin: 14px 0 0; }

/* notices */
.notice { border-radius: 10px; padding: 12px 16px; margin: 14px 0; background: var(--info-bg); }
.notice.error { background: var(--err-bg); border-left: 5px solid var(--err); }
.notice.warn { background: var(--warn-bg); border-left: 5px solid var(--warn); }
.notice.ok { background: var(--ok-bg); border-left: 5px solid var(--ok); }
.notice.corrections { background: var(--warn-bg); border-left: 5px solid var(--warn); }
.instructions { background: #f7f9fc; border-radius: 10px; padding: 4px 16px; color: #334; }
.checklist li { margin: 6px 0; }
.ok-text { color: var(--ok); font-weight: 600; }

/* uploads */
.upload-item { display: flex; align-items: center; gap: 12px; margin: 8px 0; flex-wrap: wrap; }
.upload-item img { max-width: 160px; max-height: 90px; border: 1px solid var(--line); border-radius: 6px; }
.file-btn { display: block; position: relative; border: 2px dashed var(--primary); border-radius: 10px; padding: 18px; text-align: center; color: var(--primary); font-weight: 600; cursor: pointer; }
.file-btn input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.notice-pages img { width: 100%; border: 1px solid var(--line); border-radius: 6px; margin: 6px 0; }
.terms { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; }
.terms dt { font-weight: 600; } .terms dd { margin: 0; }

/* review */
.review-sec { border-top: 1px solid var(--line); padding-top: 6px; }
.review-sec.flagged { background: var(--warn-bg); }
.review-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.review-list { display: grid; grid-template-columns: minmax(120px, 40%) 1fr; gap: 4px 14px; margin: 6px 0 14px; }
.review-list dt { color: var(--muted); } .review-list dd { margin: 0; font-weight: 500; overflow-wrap: anywhere; }
@media (max-width: 520px) { .review-list { grid-template-columns: 1fr; } .review-list dd { margin-bottom: 8px; } }

/* signing */
.doc-status { list-style: none; padding: 0; }
.doc-status li { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.doc-title { flex: 1 1 200px; font-weight: 600; }
.pill { display: inline-block; font-size: .75rem; font-weight: 700; padding: 2px 8px; border-radius: 10px; background: #e6eaf0; }
.pill-signed { background: var(--ok-bg); color: var(--ok); } .pill-unsigned, .pill-error { background: var(--err-bg); color: var(--err); }
.pill-resign, .pill-warn { background: var(--warn-bg); color: var(--warn); } .pill-info { background: var(--info-bg); color: var(--primary); }
.sigpad canvas { width: 100%; max-width: 600px; height: auto; aspect-ratio: 600 / 160; border: 2px solid #9aa6b5; border-radius: 10px; background: #fff linear-gradient(transparent 75%, #c9d1dc 75%, #c9d1dc 76%, transparent 76%); touch-action: none; display: block; }
.typed-preview { font-family: "Brush Script MT", "Segoe Script", cursive; font-size: 2rem; border-bottom: 2px solid #9aa6b5; min-height: 2.6rem; color: #0d1a73; }
.declaration { font-size: .85rem; color: var(--muted); }
.submit-box { background: var(--ok-bg); border-radius: 12px; padding: 4px 18px 18px; margin-top: 20px; }
.success-icon { width: 64px; height: 64px; border-radius: 50%; background: var(--ok); color: #fff; font-size: 2.2rem; display: flex; align-items: center; justify-content: center; }
.doc-links li { margin: 8px 0; }

/* admin */
.admin-header { background: #18222f; color: #fff; }
.admin-header .wrap-wide { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px; padding: 10px 16px; }
.admin-header .brand { color: #fff; font-weight: 700; text-decoration: none; }
.admin-nav { display: flex; gap: 14px; flex-wrap: wrap; align-items: center; font-size: .9rem; }
.admin-nav a { color: #cfe0f5; } .admin-nav .who { color: #8b9bb0; }
.dash-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 18px; }
.head-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.status-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin: 12px 0; }
.status-tabs a { padding: 6px 12px; border-radius: 16px; background: #fff; border: 1px solid var(--line); text-decoration: none; color: var(--ink); font-size: .85rem; }
.status-tabs a.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.status { font-size: .75rem; font-weight: 700; padding: 3px 9px; border-radius: 10px; vertical-align: middle; background: #e6eaf0; }
.st-invited { background: #ece8fb; color: #4b3a9a; } .st-in_progress { background: var(--info-bg); color: var(--primary); }
.st-submitted { background: #fff0d6; color: #8a5a00; } .st-needs_corrections { background: var(--err-bg); color: var(--err); }
.st-completed { background: var(--ok-bg); color: var(--ok); }
.search { display: flex; gap: 8px; max-width: 420px; margin: 8px 0; }
.tbl { width: 100%; border-collapse: collapse; background: #fff; }
.tbl th, .tbl td { text-align: left; padding: 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.tbl th { font-size: .8rem; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.wrap-wide > .tbl, .card .tbl { display: block; overflow-x: auto; }
@media (min-width: 900px) { .wrap-wide > .tbl, .card .tbl { display: table; } }
.grid2 { display: grid; gap: 16px; } @media (min-width: 800px) { .grid2 { grid-template-columns: 1fr 1fr; } }
.grid2 .card { margin: 0; }
.grid-fields { display: grid; gap: 0 18px; } @media (min-width: 800px) { .grid-fields { grid-template-columns: 1fr 1fr; } }
.group { border: 1px solid var(--line); border-radius: 10px; padding: 8px 14px; margin: 12px 0; }
.todo li, .flags li { margin: 4px 0; }
.flags { list-style: none; padding: 0; }
.corr-box { background: var(--warn-bg); padding: 10px; border-radius: 8px; margin-bottom: 10px; }
.corr-fields { display: flex; flex-wrap: wrap; }
.jump { margin: 8px 0; }
.history-item { border-left: 3px solid var(--line); padding: 4px 12px; margin: 10px 0; }
.inline-forms { display: flex; gap: 8px; align-items: center; margin-top: 8px; }
pre.json, .mail-body { background: #0f1720; color: #d7e3f0; padding: 14px; border-radius: 8px; overflow: auto; font-size: .8rem; white-space: pre-wrap; }
.mail summary { cursor: pointer; }
.sticky-save { position: sticky; bottom: 0; box-shadow: 0 -4px 16px rgba(0,0,0,.08); }
code { background: #eef1f5; padding: 1px 5px; border-radius: 4px; }

/* simplified screens */
.next-step { border: 2px solid var(--primary); }
.next-step h2 { margin-top: 0; font-size: 1.35rem; }
details.fold > summary { cursor: pointer; list-style: none; }
details.fold > summary::-webkit-details-marker { display: none; }
details.fold > summary h2 { display: inline; margin: 0; font-size: 1.1rem; }
details.fold > summary::before { content: "▸ "; color: var(--muted); }
details.fold[open] > summary::before { content: "▾ "; }
details.group > summary { cursor: pointer; padding: 6px 0; }
.signing-as { font-size: 1.05rem; }
.holder-box { background: #f7f9fc; border-radius: 10px; padding: 4px 14px 14px; margin: 16px 0; }
.doclist summary { cursor: pointer; color: var(--primary); font-weight: 600; margin: 8px 0; }
.start-card h1 { font-size: 1.8rem; }
.next-col { font-weight: 600; }

/* signing statements */
.sign-section { margin: 18px 0; }
.sign-section h2 { margin-bottom: 6px; }
.statements { padding-left: 1.3em; margin: 10px 0; }
.statement { margin: 0 0 14px; }
.statement-head { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; }
.statement blockquote { margin: 6px 0 0; padding: 10px 14px; background: #f7f9fc; border-left: 4px solid var(--primary); border-radius: 6px; font-size: .95rem; }
.esign-terms summary { cursor: pointer; color: var(--primary); font-size: .9rem; margin-top: 6px; }
.esign-terms p { font-size: .88rem; color: var(--muted); }

/* employee link box */
.copy-row { display: flex; gap: 8px; margin: 8px 0; }
.copy-row input { flex: 1; font-family: monospace; font-size: .85rem; }
.row-form { display: inline; }

/* two-step sign in */
.qr { text-align: center; margin: 10px 0; }
.qr img { background: #fff; padding: 6px; border: 1px solid var(--line); border-radius: 8px; }
.setup-key { font-size: 1rem; letter-spacing: .05em; word-break: break-all; }
.setup-steps li { margin: 10px 0; }
.backup-codes { columns: 2; font-size: 1.1rem; list-style: none; padding: 0; }
.backup-codes li { margin: 6px 0; }
