:root {
  --ink: #1b1f1d;
  --muted: #5d6662;
  --line: #dfe3e1;
  --soft: #f5f7f6;
  --accent: #0f5132;
  --accent-soft: #e6f0eb;
  --warn: #8a2c0d;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--ink);
  background: #fff;
}
* { box-sizing: border-box; }
body { margin: 0; line-height: 1.5; font-size: 16px; }
header.bar { border-bottom: 1px solid var(--line); padding: 14px 20px; display: flex; align-items: center; gap: 12px; }
header.bar .brand { font-weight: 650; letter-spacing: 0.01em; }
header.bar .spacer { flex: 1; }
main { max-width: 860px; margin: 0 auto; padding: 16px; }
html, body { overflow-x: hidden; }
h1 { font-size: 1.5rem; margin: 0.2em 0 0.4em; }
h2 { font-size: 1.1rem; margin: 1.6em 0 0.5em; }
p.muted, .muted { color: var(--muted); }
.small { font-size: 0.875rem; }
button, .btn {
  font: inherit; font-weight: 600; border-radius: 8px; padding: 10px 16px; min-height: 44px;
  border: 1px solid var(--accent); background: var(--accent); color: #fff; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
}
button.secondary, .btn.secondary { background: #fff; color: var(--accent); }
button.danger { background: #fff; color: var(--warn); border-color: var(--warn); }
button.link { background: none; border: none; color: var(--accent); padding: 4px 6px; min-height: 0; font-weight: 600; }
button:disabled { opacity: 0.45; cursor: not-allowed; }
input[type="text"], input[type="password"], select {
  font: inherit; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; min-height: 44px; width: 100%; background: #fff;
}
label.check { display: flex; gap: 10px; align-items: flex-start; padding: 8px 0; cursor: pointer; }
label.check input { width: 22px; height: 22px; margin-top: 2px; flex: none; accent-color: var(--accent); }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.row > * { flex: 1 1 auto; }
.row > button { flex: none; }
.list { border-top: 1px solid var(--line); }
.list > div { border-bottom: 1px solid var(--line); padding: 12px 0; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.list > div .grow { flex: 1 1 260px; }
.pill { font-size: 0.8rem; padding: 2px 10px; border-radius: 999px; background: var(--soft); color: var(--muted); white-space: nowrap; }
.pill.ok { background: var(--accent-soft); color: var(--accent); }
.notice { background: var(--accent-soft); color: var(--accent); padding: 12px 14px; border-radius: 8px; }
.error { background: #fbeee9; color: var(--warn); padding: 12px 14px; border-radius: 8px; }
.hidden { display: none !important; }
code, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.85em; word-break: break-all; }

/* documents */
.doc-title { margin: 1.4em 0 0.4em; font-weight: 650; }
.pages { display: flex; flex-direction: column; gap: 12px; align-items: center; }
.page { position: relative; box-shadow: 0 0 0 1px var(--line); background: #fff; max-width: 100%; }
.page canvas { display: block; width: 100%; height: 100%; }
.page .pno { position: absolute; right: 6px; bottom: 4px; font-size: 0.75rem; color: var(--muted); }
.box { position: absolute; border: 2px solid var(--accent); background: rgba(15, 81, 50, 0.08); border-radius: 4px; font-size: 10px; color: var(--accent); overflow: hidden; padding: 0 3px; line-height: 1.1; white-space: nowrap; }
.box.mine { background: rgba(255, 214, 0, 0.25); border-color: #b08900; color: #6b5300; }
.box .h { position: absolute; right: -1px; bottom: -1px; width: 14px; height: 14px; background: var(--accent); cursor: nwse-resize; }
.box .x { position: absolute; right: 1px; top: 0; cursor: pointer; font-weight: 700; padding: 0 3px; }
.editor .page { cursor: crosshair; }
.editor .box { cursor: move; }

/* signing */
.sigpad { border: 1px dashed var(--muted); border-radius: 8px; background: #fff; width: 100%; height: 180px; touch-action: none; display: block; }
.tabs { display: flex; gap: 6px; margin-bottom: 8px; }
.tabs button { flex: 1; }
.tabs button[aria-selected="false"] { background: #fff; color: var(--accent); }
.sticky { position: sticky; bottom: 0; background: #fff; border-top: 1px solid var(--line); padding: 12px 0; margin-top: 16px; }
.links input { font-family: ui-monospace, Menlo, monospace; font-size: 0.8rem; }
