@font-face { font-family: "Inter"; font-weight: 400; font-display: swap; src: url(/fonts/inter-latin-400-normal.woff2) format("woff2"); }
@font-face { font-family: "Inter"; font-weight: 600; font-display: swap; src: url(/fonts/inter-latin-600-normal.woff2) format("woff2"); }
@font-face { font-family: "Inter"; font-weight: 700; font-display: swap; src: url(/fonts/inter-latin-700-normal.woff2) format("woff2"); }
@font-face { font-family: "Merriweather"; font-weight: 400; font-display: swap; src: url(/fonts/merriweather-latin-400-normal.woff2) format("woff2"); }
@font-face { font-family: "Merriweather"; font-weight: 700; font-display: swap; src: url(/fonts/merriweather-latin-700-normal.woff2) format("woff2"); }
@font-face { font-family: "JetBrains Mono"; font-weight: 400; font-display: swap; src: url(/fonts/jetbrains-mono-latin-400-normal.woff2) format("woff2"); }
@font-face { font-family: "Alex Brush"; font-weight: 400; font-display: block; src: url(/fonts/alex-brush-latin-400-normal.woff2) format("woff2"); }

:root {
  --bg: #0b1120;
  --bg-2: #1a2942;
  --panel: #111a2c;
  --panel-line: #2a3a55;
  --paper: #ffffff;
  --ink: #0f172a;
  --ink-2: #334155;
  --muted: #64748b;
  --rule: #cbd5e1;
  --soft: #f8fafc;
  --accent: #0e7490;
  --accent-2: #0891b2;
  --accent-soft: #ecfeff;
  --ok: #047857;
  --ok-soft: #ecfdf5;
  --warn: #b45309;
  --warn-soft: #fffbeb;
  --bad: #be123c;
  --bad-soft: #fff1f2;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --serif: "Merriweather", Georgia, "Times New Roman", serif;
  --mono: "JetBrains Mono", ui-monospace, Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(circle at top right, var(--bg-2), var(--bg) 60%) fixed, var(--bg);
  color: var(--ink);
  font-family: var(--serif);
  line-height: 1.7;
  padding: 24px 16px 48px;
}
[hidden] { display: none !important; }

/* ---------- top bar ---------- */
.bar {
  max-width: 880px;
  margin: 0 auto 20px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  background: rgba(15, 23, 42, 0.92);
  border: 1px solid var(--panel-line);
  border-radius: 10px;
  padding: 12px 16px;
  font-family: var(--sans);
  color: #e2e8f0;
}
.bar .brand { font-weight: 700; letter-spacing: 0.18em; font-size: 13px; }
.bar .who { font-size: 12px; color: #94a3b8; }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 12px;
  border-radius: 999px;
  font: 700 11px/1.4 var(--sans);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border: 1px solid transparent;
}
.pill::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.pill.pending { background: rgba(245, 158, 11, 0.15); color: #fcd34d; border-color: rgba(245, 158, 11, 0.4); }
.pill.progress { background: rgba(6, 182, 212, 0.15); color: #67e8f9; border-color: rgba(6, 182, 212, 0.4); }
.pill.done { background: rgba(16, 185, 129, 0.15); color: #6ee7b7; border-color: rgba(16, 185, 129, 0.4); }
.pill.void { background: rgba(244, 63, 94, 0.15); color: #fda4af; border-color: rgba(244, 63, 94, 0.4); }

/* ---------- document ---------- */
.doc {
  max-width: 880px;
  margin: 0 auto;
  background: var(--paper);
  border-radius: 6px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
  padding: clamp(24px, 6vw, 64px);
}
.doc header.masthead {
  text-align: center;
  border-bottom: 2px solid var(--accent);
  padding-bottom: 28px;
  margin-bottom: 32px;
}
.masthead img { height: 128px; max-width: 100%; object-fit: contain; }
.masthead h1 {
  font-family: var(--sans);
  font-size: clamp(28px, 6vw, 44px);
  letter-spacing: 0.2em;
  margin: 12px 0 4px;
}
.masthead .tagline {
  font: 700 12px var(--sans);
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0;
}
.doc h2.title {
  font-family: var(--sans);
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: clamp(19px, 3.6vw, 26px);
  margin: 0 0 28px;
}
.doc h3 { font-family: var(--sans); font-size: 17px; margin: 30px 0 8px; }
.doc p, .doc li { color: var(--ink-2); font-size: 15px; }
.doc ul { padding-left: 26px; }
.doc li { margin: 4px 0; }
.party {
  border-left: 4px solid var(--rule);
  background: var(--soft);
  padding: 14px 16px;
  margin: 16px 0;
  border-radius: 0 6px 6px 0;
}
.party.receiving { border-left-color: var(--accent); }
.party strong { color: var(--ink); }
.and { text-align: center; font-weight: 700; color: var(--ink); }
.witness { font-weight: 700; color: var(--ink) !important; margin-top: 28px; }

/* ---------- form fields ---------- */
.field { margin: 0 0 14px; font-family: var(--sans); }
.field label {
  display: block;
  font: 600 11px var(--sans);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 4px;
}
.field input[type="text"], .field input[type="email"], .field textarea {
  width: 100%;
  font: 500 15px var(--sans);
  color: var(--ink);
  border: 0;
  border-bottom: 1px solid #94a3b8;
  background: #fff;
  padding: 8px 6px;
  border-radius: 2px;
}
.field input:focus, .field textarea:focus {
  outline: none;
  border-bottom-color: var(--accent-2);
  background: #f0fdfa;
  box-shadow: 0 2px 0 0 var(--accent-2);
}
.field input[readonly] { background: var(--soft); color: var(--ink-2); }
.field .hint { font-size: 12px; color: var(--muted); margin-top: 4px; }
.field.invalid input { border-bottom-color: var(--bad); background: var(--bad-soft); }
.check {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  font: 14px/1.5 var(--sans);
  color: var(--ink-2);
  margin: 16px 0;
}
.check input { width: 18px; height: 18px; margin-top: 2px; flex: none; accent-color: var(--accent); }

/* ---------- signature blocks ---------- */
.sign-grid { display: grid; grid-template-columns: 1fr; gap: 24px; margin-top: 36px; }
@media (min-width: 760px) { .sign-grid { grid-template-columns: 1fr 1fr; } }
.sign-card {
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 18px;
  background: #fcfdfe;
  font-family: var(--sans);
}
.sign-card.receiving { border-color: rgba(14, 116, 144, 0.25); }
.sign-card h4 {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin: 0 0 14px;
  padding-bottom: 10px;
  border-bottom: 2px solid #e2e8f0;
  font-size: 15px;
}
.sub-sign + .sub-sign { margin-top: 18px; padding-top: 18px; border-top: 1px solid #e2e8f0; }
.badge { font: 600 11px var(--sans); padding: 2px 8px; border-radius: 4px; white-space: nowrap; }
.badge.req { background: #fef3c7; color: #92400e; }
.badge.ok { background: #d1fae5; color: #065f46; }
.badge.wait { background: #e2e8f0; color: #334155; }
.badge.you { background: #cffafe; color: #155e75; }

.pad-wrap { position: relative; border: 1px solid #94a3b8; border-radius: 4px; background: #fff; }
.pad {
  display: block;
  width: 100%;
  aspect-ratio: 3 / 1;
  touch-action: none;
  cursor: crosshair;
  background-image: radial-gradient(#cbd5e1 1px, transparent 1px);
  background-size: 12px 12px;
  border-radius: 4px;
}
.pad-line { position: absolute; left: 6%; right: 6%; bottom: 22%; border-bottom: 1px dashed #cbd5e1; pointer-events: none; }
.pad-tools { display: flex; justify-content: space-between; align-items: center; margin: 6px 0 4px; font-size: 12px; color: var(--muted); }
.pad-tools .links { display: flex; gap: 12px; }
.sig-img { display: block; width: 100%; aspect-ratio: 3 / 1; object-fit: contain; border-bottom: 1px solid #94a3b8; background: #fff; }
.sig-empty {
  display: grid;
  place-items: center;
  aspect-ratio: 3 / 1;
  border: 1px dashed #cbd5e1;
  border-radius: 4px;
  color: var(--muted);
  font-size: 13px;
  background: var(--soft);
  text-align: center;
  padding: 8px;
}
.meta { display: grid; grid-template-columns: auto 1fr; gap: 2px 12px; font-size: 13px; margin-top: 8px; }
.meta dt { color: var(--muted); font-weight: 600; }
.meta dd { margin: 0; color: var(--ink); overflow-wrap: anywhere; }

/* ---------- buttons ---------- */
button, .btn {
  font: 600 13px var(--sans);
  border-radius: 6px;
  border: 1px solid transparent;
  padding: 10px 16px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-decoration: none;
  min-height: 40px;
}
button:disabled { opacity: 0.55; cursor: not-allowed; }
button:focus-visible, .btn:focus-visible, a:focus-visible, input:focus-visible { outline: 3px solid #67e8f9; outline-offset: 2px; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--accent-2); }
.btn-ok { background: var(--ok); color: #fff; }
.btn-ok:hover:not(:disabled) { background: #059669; }
.btn-ghost { background: transparent; color: #e2e8f0; border-color: #475569; }
.btn-ghost:hover { background: #1e293b; }
.btn-light { background: #fff; color: var(--ink); border-color: var(--rule); }
.btn-light:hover { background: var(--soft); }
.btn-danger { background: transparent; color: var(--bad); border-color: #fecdd3; }
.linklike { background: none; border: 0; padding: 0; min-height: 0; color: var(--accent); font: 600 12px var(--sans); text-decoration: underline; cursor: pointer; }
.linklike.danger { color: var(--bad); }

/* ---------- panels ---------- */
.panel {
  margin-top: 36px;
  padding: 22px;
  border-radius: 8px;
  background: #0f172a;
  color: #e2e8f0;
  font-family: var(--sans);
}
.panel h4 { margin: 0 0 6px; color: #67e8f9; text-transform: uppercase; letter-spacing: 0.06em; font-size: 14px; }
.panel p { color: #cbd5e1; font-size: 13px; margin: 0 0 12px; }
.panel .actions { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; }
.notice {
  font: 14px/1.55 var(--sans);
  padding: 12px 14px;
  border-radius: 6px;
  margin: 16px 0;
  border: 1px solid;
}
.notice.ok { background: var(--ok-soft); border-color: #a7f3d0; color: #065f46; }
.notice.warn { background: var(--warn-soft); border-color: #fde68a; color: #92400e; }
.notice.bad { background: var(--bad-soft); border-color: #fecdd3; color: #9f1239; }
.notice.info { background: var(--accent-soft); border-color: #a5f3fc; color: #155e75; }

.cert {
  margin-top: 32px;
  border: 1px solid var(--rule);
  border-radius: 6px;
  background: var(--soft);
  padding: 14px 16px;
  font: 12px/1.6 var(--sans);
  color: var(--ink-2);
}
.cert .head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; border-bottom: 1px solid #e2e8f0; padding-bottom: 8px; margin-bottom: 8px; }
.cert .head strong { text-transform: uppercase; letter-spacing: 0.05em; color: var(--ink); }
.mono { font-family: var(--mono); font-size: 11.5px; overflow-wrap: anywhere; }

.foot { text-align: center; color: #94a3b8; font: 11px var(--sans); letter-spacing: 0.08em; margin-top: 40px; padding-top: 18px; border-top: 1px solid #e2e8f0; }

/* ---------- director console ---------- */
.console { max-width: 880px; margin: 0 auto 20px; font-family: var(--sans); color: #e2e8f0; }
.list { background: var(--panel); border: 1px solid var(--panel-line); border-radius: 10px; overflow: hidden; }
.list-head { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--panel-line); gap: 12px; flex-wrap: wrap; }
.list-head h2 { margin: 0; font-size: 14px; text-transform: uppercase; letter-spacing: 0.08em; color: #67e8f9; }
.list-head select { background: #0b1120; color: #e2e8f0; border: 1px solid #475569; border-radius: 6px; padding: 6px 8px; font: 13px var(--sans); }
.rows { list-style: none; margin: 0; padding: 0; max-height: 340px; overflow: auto; }
.rows li { border-bottom: 1px solid #1e293b; }
.rows button {
  width: 100%;
  background: none;
  border: 0;
  border-radius: 0;
  color: inherit;
  text-align: left;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2px 12px;
  padding: 12px 16px;
  font-weight: 400;
}
.rows button:hover, .rows button[aria-current="true"] { background: #16213a; }
.rows .co { font-weight: 600; color: #f1f5f9; }
.rows .sub { font-size: 12px; color: #94a3b8; }
.rows .st { grid-row: span 2; align-self: center; }
.empty { padding: 24px 16px; color: #94a3b8; font-size: 14px; }
.events { font: 12px/1.5 var(--sans); margin: 8px 0 0; padding-left: 18px; color: var(--ink-2); }

/* ---------- verify ---------- */
.verify-card { max-width: 640px; margin: 0 auto; }
.drop {
  border: 2px dashed #94a3b8;
  border-radius: 8px;
  padding: 24px;
  text-align: center;
  font-family: var(--sans);
  color: var(--ink-2);
  background: var(--soft);
}
.drop.over { border-color: var(--accent-2); background: var(--accent-soft); }

@media print {
  body { background: #fff; padding: 0; }
  .bar, .panel, .console, .no-print { display: none !important; }
  .doc { box-shadow: none; padding: 0; max-width: none; }
}

.hint-dark { font-size: 12px; color: #94a3b8; }
.hint { color: var(--muted); font: 14px var(--sans); }
.cert .meta span:nth-child(odd) { color: var(--muted); font-weight: 600; }
