:root {
  --red: #e31e24;
  --red-dark: #b8141a;
  --ink: #1d1d1f;
  --muted: #6b6b70;
  --line: #e2e2e6;
  --soft: #f5f5f7;
  --ok: #1f8a4c;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--ink);
  background: var(--soft);
  line-height: 1.45;
}
header.top {
  background: #fff;
  border-bottom: 3px solid var(--red);
  padding: 14px 18px;
}
header.top img { height: 30px; display: block; }
main { max-width: 640px; margin: 0 auto; padding: 18px 14px 60px; }
h1 { font-size: 1.6rem; margin: 6px 0 4px; }
.lead { color: var(--muted); margin: 0 0 18px; }

.card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px;
  margin-bottom: 14px;
}
fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
legend {
  display: flex; align-items: center; gap: 10px;
  font-weight: 700; font-size: 1.1rem; margin-bottom: 10px; padding: 0;
}
legend .step {
  background: var(--red); color: #fff; font-size: .75rem; letter-spacing: .04em;
  padding: 3px 8px; border-radius: 6px;
}
.hint { color: var(--muted); font-size: .88rem; margin: -4px 0 12px; }

.field { margin-bottom: 14px; }
.field:last-child { margin-bottom: 0; }
.field > label, .field > .label {
  display: block; font-weight: 600; font-size: .92rem; margin-bottom: 5px;
}
.req { color: var(--red); }
input[type=text], input[type=date], input[type=time], input[type=number], textarea, select {
  width: 100%; font: inherit; font-size: 16px;
  padding: 11px 12px; border: 1px solid #cfcfd4; border-radius: 10px; background: #fff;
}
textarea { min-height: 84px; resize: vertical; }
input:focus, textarea:focus { outline: 2px solid var(--red); outline-offset: 1px; border-color: transparent; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.group-title {
  font-size: .78rem; text-transform: uppercase; letter-spacing: .06em;
  color: var(--muted); font-weight: 700; margin: 10px 0 6px;
}
.group-title:first-child { margin-top: 0; }
.choices { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.choice {
  display: flex; align-items: center; gap: 8px;
  border: 1px solid #cfcfd4; border-radius: 10px; padding: 10px 11px;
  font-size: .95rem; cursor: pointer; background: #fff;
}
.choice input { accent-color: var(--red); width: 18px; height: 18px; margin: 0; flex: none; }
.choice:has(input:checked) { border-color: var(--red); background: #fff3f3; }

.check { display: flex; gap: 10px; align-items: flex-start; font-size: .95rem; }
.check input { accent-color: var(--red); width: 20px; height: 20px; margin-top: 1px; flex: none; }

.sig-wrap {
  border: 1px dashed #b9b9bf; border-radius: 12px; background: #fff; position: relative;
  touch-action: none;
}
.sig-wrap { user-select: none; -webkit-user-select: none; }
.sig-wrap canvas { width: 100%; height: 170px; display: block; border-radius: 12px; touch-action: none; cursor: crosshair; }
.sig-wrap .placeholder {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  color: #b0b0b6; pointer-events: none; font-size: .95rem;
}
.sig-tools { display: flex; justify-content: flex-end; margin-top: 6px; }
.link-btn { background: none; border: 0; color: var(--red); font: inherit; font-weight: 600; cursor: pointer; padding: 4px; }

.btn {
  display: block; width: 100%; text-align: center; text-decoration: none;
  background: var(--red); color: #fff; border: 0; border-radius: 12px;
  font: inherit; font-weight: 700; font-size: 1.05rem; padding: 15px; cursor: pointer;
}
.btn:hover { background: var(--red-dark); }
.btn[disabled] { opacity: .6; cursor: wait; }
.btn.secondary { background: #fff; color: var(--red); border: 2px solid var(--red); }

.error {
  display: none; background: #fff3f3; border: 1px solid #f2b8ba; color: #9b1116;
  padding: 10px 12px; border-radius: 10px; margin-bottom: 12px; font-size: .93rem;
}
.error.show { display: block; }

.small-print { font-size: .8rem; color: var(--muted); }
.small-print h3 { font-size: .85rem; color: var(--ink); margin: 0 0 4px; }
.small-print ul { margin: 0 0 10px; padding-left: 18px; }

.done { text-align: center; padding: 30px 16px; }
.done .tick {
  width: 64px; height: 64px; border-radius: 50%; background: var(--ok); color: #fff;
  display: flex; align-items: center; justify-content: center; font-size: 34px; margin: 0 auto 12px;
}
.hidden { display: none !important; }

.menu a.card { display: block; text-decoration: none; color: inherit; }
.menu a.card strong { font-size: 1.15rem; display: block; margin-bottom: 2px; }
.menu a.card span { color: var(--muted); font-size: .93rem; }
.menu a.card:hover { border-color: var(--red); }

@media (max-width: 420px) {
  .choices { grid-template-columns: 1fr; }
}

table.summary { width: 100%; border-collapse: collapse; font-size: .93rem; }
table.summary th, table.summary td { text-align: left; vertical-align: top; padding: 7px 8px; border-bottom: 1px solid var(--line); }
table.summary th { width: 42%; color: var(--muted); font-weight: 600; }

.badge { display: inline-block; font-size: .85rem; font-weight: 600; padding: 5px 10px; border-radius: 8px; margin: 0 0 6px; }
.badge.ok { background: #e8f5ee; color: var(--ok); }
.badge.warn { background: #fff3f3; color: #9b1116; }

.tabs { display: flex; gap: 6px; margin-bottom: 12px; overflow-x: auto; }
.tab { border: 1px solid #cfcfd4; background: #fff; border-radius: 999px; padding: 8px 14px; font: inherit; font-weight: 600; font-size: .9rem; cursor: pointer; white-space: nowrap; }
.tab.active { background: var(--red); border-color: var(--red); color: #fff; }
.item { display: flex; gap: 12px; align-items: center; justify-content: space-between; }
.item .who { font-weight: 700; }
.item .meta { color: var(--muted); font-size: .88rem; }
.item .actions { display: flex; gap: 6px; flex: none; }
.small-btn { border: 0; background: var(--red); color: #fff; border-radius: 9px; padding: 9px 12px; font: inherit; font-weight: 700; font-size: .88rem; cursor: pointer; text-decoration: none; }
.small-btn.secondary { background: #fff; color: var(--red); border: 1.5px solid var(--red); }
.pill { display: inline-block; font-size: .75rem; font-weight: 700; padding: 2px 8px; border-radius: 999px; margin-left: 6px; vertical-align: 1px; }
.pill.pending { background: #fff4e0; color: #8a5a00; }
.pill.signed { background: #e8f5ee; color: var(--ok); }
.empty { text-align: center; color: var(--muted); padding: 26px 10px; }
@media (max-width: 420px) { .item { flex-direction: column; align-items: stretch; } .item .actions { justify-content: flex-start; } }
