:root {
  --ink: #1b2430;
  --ink-soft: #5b6675;
  --line: #dfe3e8;
  --bg: #f6f7f9;
  --card: #ffffff;
  --accent: #1f3a5f;
  --accent-hover: #16294a;
  --error-bg: #fdecec;
  --error-ink: #9d2c2c;
  --radius: 10px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  -webkit-tap-highlight-color: transparent;
}

.topbar {
  background: var(--accent);
  color: #fff;
  padding: 18px 20px;
}
.topbar-inner {
  max-width: 720px;
  margin: 0 auto;
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
}
.brand { font-weight: 700; font-size: 1.1rem; }
.brand-sub { opacity: 0.85; font-size: 0.9rem; }

.wizard {
  max-width: 720px;
  margin: 0 auto;
  padding: 24px 16px 80px;
}

.step {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 16px;
}

h1 { font-size: 1.4rem; margin: 0 0 8px; }
h2 { font-size: 1.05rem; margin: 0 0 8px; }
.lead { color: var(--ink-soft); margin: 0 0 20px; }
.hint { color: var(--ink-soft); font-size: 0.85rem; margin: 4px 0 16px; }

label {
  display: block;
  font-weight: 600;
  font-size: 0.85rem;
  margin-bottom: 6px;
}

input[type="text"],
input[type="email"],
select,
textarea {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 1rem;
  margin-bottom: 16px;
  font-family: inherit;
  background: #fff;
  color: var(--ink);
}
input:focus, select:focus, textarea:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.checkbox-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 12px 0;
}
.checkbox-row input[type="checkbox"] {
  width: 20px;
  height: 20px;
  margin-top: 2px;
  flex-shrink: 0;
}
.checkbox-row label { font-weight: 400; margin: 0; }

.btn {
  display: inline-block;
  border: none;
  border-radius: 8px;
  padding: 13px 20px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}
.btn-primary { background: var(--accent); color: #fff; width: 100%; }
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); }
.btn-primary:disabled { background: #a7b2c2; cursor: not-allowed; }
.btn-link {
  background: none;
  color: var(--accent);
  padding: 10px 0;
  text-decoration: underline;
}

.banner {
  padding: 12px 16px;
  border-radius: 8px;
  margin-bottom: 16px;
  font-size: 0.9rem;
}
.banner-error { background: var(--error-bg); color: var(--error-ink); }

.role-options {
  display: grid;
  gap: 12px;
}
.role-card {
  text-align: left;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 10px;
  padding: 16px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.role-card:hover, .role-card:focus { border-color: var(--accent); }
.role-title { font-weight: 700; font-size: 1.05rem; }
.role-desc { color: var(--ink-soft); font-size: 0.85rem; }

.doc-block { margin-bottom: 22px; }
.doc-frame {
  width: 100%;
  height: 420px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.sig-tabs { display: flex; gap: 8px; margin-bottom: 16px; }
.sig-tab {
  flex: 1;
  padding: 10px;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  font-family: inherit;
}
.sig-tab.active { background: var(--accent); color: #fff; border-color: var(--accent); }

#sig-canvas {
  width: 100%;
  height: 200px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  touch-action: none;
  background: #fff;
  display: block;
}

.sig-type-preview {
  font-family: "Dancing Script", cursive;
  font-size: 2.4rem;
  min-height: 70px;
  padding: 10px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: #fff;
}

.download-links {
  display: grid;
  gap: 10px;
}
.download-links a {
  display: block;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  text-decoration: none;
  color: var(--accent);
  font-weight: 600;
  background: #fff;
}

@media (max-width: 480px) {
  .field-row { grid-template-columns: 1fr; }
}
