:root {
  color-scheme: light;
  --ink: #1c2928;
  --muted: #4d5f5b;
  --accent: #12564c;
  --line: #b9c9c2;
  --paper: #fff;
  --bg: #f4f7f4;
  --danger: #9b2c2c;
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Yu Gothic UI", Meiryo, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.7;
}
* { box-sizing: border-box; }
body { margin: 0; }
main { max-width: 46rem; margin-inline: auto; padding: 1rem 1rem 3rem; }
h1, h2, h3 { line-height: 1.4; margin: 1.25rem 0 0.75rem; }
h1 { font-size: 1.45rem; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1rem; margin: 0 0 0.25rem; }
p { margin: 0.6rem 0; overflow-wrap: anywhere; }
a { color: var(--accent); }

.bar { display: flex; justify-content: space-between; align-items: center; gap: 0.5rem; padding: 0.5rem 1rem; background: var(--accent); color: #fff; }
.bar a.brand { color: #fff; font-weight: 700; text-decoration: none; }
.bar form { display: flex; align-items: center; gap: 0.5rem; margin: 0; }
.bar .who { font-size: 0.875rem; }
button.link { background: none; border: 0; color: #fff; text-decoration: underline; min-height: 44px; padding: 0 0.25rem; font: inherit; cursor: pointer; }

.card, .signer, .paper { background: var(--paper); border: 1px solid var(--line); border-radius: 0.5rem; padding: 1rem; margin: 1rem 0; }
.paper { font-size: 1.0625rem; line-height: 1.85; }
.paper .doc-title { text-align: center; margin-top: 0; }
.details { color: var(--muted); font-size: 0.9375rem; }
.pending { color: var(--muted); font-weight: 650; }
.signer.done { border-color: var(--accent); }
img.signature { display: block; width: 100%; max-width: 360px; aspect-ratio: 5 / 2; border: 1px solid var(--line); border-radius: 0.25rem; background: #fff; }

label { display: block; font-weight: 650; margin: 0.9rem 0 0.25rem; }
label.check { display: flex; gap: 0.5rem; align-items: flex-start; font-weight: 600; }
label.check input { width: 1.4rem; height: 1.4rem; flex: none; margin-top: 0.2rem; }
input, textarea {
  display: block; width: 100%; padding: 0.625rem 0.75rem; border: 1px solid #758d84; border-radius: 0.375rem;
  color: var(--ink); background: #fff; font: inherit;
}
input[type="checkbox"] { display: inline-block; width: auto; }

button, a.primary, a.secondary {
  display: inline-flex; align-items: center; justify-content: center; min-height: 44px; border-radius: 0.375rem;
  padding: 0.625rem 1rem; font: inherit; font-weight: 650; text-decoration: none; cursor: pointer; margin-top: 0.75rem;
}
.primary { background: var(--accent); color: #fff; border: 1px solid var(--accent); }
.secondary { background: #fff; color: var(--accent); border: 1px solid var(--accent); }
button:disabled { opacity: 0.5; cursor: default; }
form > .primary { width: 100%; }

.pad canvas {
  display: block; width: 100%; height: auto; aspect-ratio: 5 / 2; border-radius: 0.25rem;
  box-shadow: inset 0 0 0 1px #758d84; background: #f7faf8; touch-action: none; cursor: crosshair;
}

.notice { background: #e4eee8; border-inline-start: 3px solid var(--accent); padding: 0.6rem 0.75rem; font-size: 0.9375rem; }
.notice.error { background: #f8e8e8; border-color: var(--danger); color: var(--danger); }
.form-message { color: var(--danger); font-weight: 650; min-height: 1.2em; }
.hint { color: var(--muted); font-size: 0.875rem; }
.hash { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 0.8125rem; overflow-wrap: anywhere; }

.docs { list-style: none; padding: 0; }
.docs li a { display: block; background: #fff; border: 1px solid var(--line); border-radius: 0.5rem; padding: 0.75rem; margin: 0.5rem 0; text-decoration: none; color: var(--ink); }
.docs .title { display: block; font-weight: 700; }
.docs .meta { font-size: 0.875rem; color: var(--muted); }
.badge { display: inline-block; font-size: 0.8125rem; font-weight: 700; padding: 0 0.5rem; border-radius: 999px; background: #e7ecea; }
.badge.finalized { background: #d6ebe3; color: var(--accent); }
.badge.cancelled { background: #eee; color: #666; }
.log { padding-left: 1.2rem; font-size: 0.875rem; }

.issued img.qr { display: block; width: 220px; max-width: 100%; margin: 0.75rem 0; image-rendering: pixelated; }
details { margin: 1rem 0; }
summary { cursor: pointer; font-weight: 650; min-height: 44px; display: flex; align-items: center; overflow-wrap: anywhere; word-break: break-all; }
details.danger summary { color: var(--danger); }
