:root {
  --bg: #f6f6f4;
  --card: #ffffff;
  --text: #1c1c1a;
  --muted: #6b6b66;
  --line: #e2e2dd;
  --accent: #1f3a5f;
  --accent-text: #ffffff;
  --ok: #1d6b3a;
  --err: #a12a2a;
  --doc-bg: #fbfbfa;
  font-family: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, sans-serif;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141413;
    --card: #1d1d1b;
    --text: #ececea;
    --muted: #9a9a94;
    --line: #34342f;
    --accent: #8fb3e0;
    --accent-text: #0e1a2a;
    --ok: #6fcf97;
    --err: #ff8a8a;
    --doc-bg: #181816;
  }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); line-height: 1.5; }
.wrap { max-width: 760px; margin: 0 auto; padding: 32px 16px 64px; }
header.brand { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 20px; }
header.brand h1 { font-size: 22px; margin: 0; letter-spacing: -0.01em; }
header.brand span { color: var(--muted); font-size: 14px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 20px; margin-bottom: 16px; }
.card h2 { font-size: 15px; margin: 0 0 12px; }
label { display: block; font-size: 13px; color: var(--muted); margin: 12px 0 4px; }
input[type="text"], input[type="email"], input[type="url"] {
  width: 100%; padding: 10px 12px; font-size: 15px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--bg); color: var(--text);
}
input:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 560px) { .row { grid-template-columns: 1fr; } }
.choice { display: flex; gap: 10px; align-items: flex-start; padding: 10px; border: 1px solid var(--line); border-radius: 8px; margin-top: 8px; cursor: pointer; }
.choice input { margin-top: 4px; }
.choice small { display: block; color: var(--muted); }
.choice.disabled { opacity: 0.5; cursor: not-allowed; }
button, .btn {
  display: inline-block; border: 0; border-radius: 8px; padding: 12px 18px; font-size: 15px; font-weight: 600;
  background: var(--accent); color: var(--accent-text); cursor: pointer; text-decoration: none;
}
button.secondary { background: transparent; color: var(--text); border: 1px solid var(--line); font-weight: 500; }
button:disabled { opacity: 0.5; cursor: wait; }
.doc { background: var(--doc-bg); border: 1px solid var(--line); border-radius: 8px; padding: 20px 22px; max-height: 420px; overflow-y: auto;
  font-family: "Times New Roman", Georgia, serif; font-size: 15px; }
.doc h3 { text-align: center; font-size: 15px; margin: 0 0 14px; }
.doc p { margin: 0 0 10px; text-align: justify; }
.muted { color: var(--muted); font-size: 13px; }
.tabs { display: flex; gap: 6px; margin: 8px 0; }
.tabs button { padding: 6px 12px; font-size: 13px; }
.tabs button[aria-selected="false"] { background: transparent; color: var(--text); border: 1px solid var(--line); }
.sigbox { border: 1px dashed var(--line); border-radius: 8px; background: var(--doc-bg); height: 140px; position: relative; }
.sigbox canvas { width: 100%; height: 100%; display: block; touch-action: none; }
.sigbox .typed { display: flex; align-items: center; justify-content: center; height: 100%; font-family: "Caveat", cursive; font-size: 46px; padding: 0 12px; overflow: hidden; white-space: nowrap; }
.consent { display: flex; gap: 10px; align-items: flex-start; margin: 14px 0; font-size: 14px; }
.consent input { margin-top: 4px; }
.msg { padding: 12px 14px; border-radius: 8px; margin: 12px 0; font-size: 14px; border: 1px solid var(--line); }
.msg.err { color: var(--err); border-color: currentColor; }
.msg.ok { color: var(--ok); border-color: currentColor; }
.center { text-align: center; padding: 60px 0; }
.spinner { width: 28px; height: 28px; border: 3px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.8s linear infinite; margin: 0 auto 14px; }
@keyframes spin { to { transform: rotate(360deg); } }
.out { display: flex; gap: 8px; margin-top: 12px; }
.out input { font-family: ui-monospace, Menlo, monospace; font-size: 13px; }
[hidden] { display: none !important; }
