:root {
  --bg: #f6f7f9; --panel: #ffffff; --ink: #121826; --muted: #5b6475; --line: #dde1e8;
  --brand: #0f766e; --brand-ink: #ffffff; --warn-bg: #fff7e6; --warn-line: #e8b44c; --warn-ink: #6b4a00;
  --err-bg: #fdecec; --err-ink: #8a1c1c; --ok-bg: #e8f6f1; --ok-ink: #0d5b45; --focus: #2563eb;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0d1421; --panel: #152033; --ink: #eef2f7; --muted: #a0abbd; --line: #2a3850;
    --brand: #2dd4bf; --brand-ink: #062a26; --warn-bg: #3a2d10; --warn-line: #b8892a; --warn-ink: #f5d58b;
    --err-bg: #3a1616; --err-ink: #f4b4b4; --ok-bg: #0f3329; --ok-ink: #9fe3c9; --focus: #93c5fd;
  }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink);
  font: 15px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; }
a { color: var(--brand); }
header.top { background: var(--panel); border-bottom: 1px solid var(--line); }
header.top .wrap { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-top: 14px; padding-bottom: 14px; }
.brand { font-weight: 700; letter-spacing: .02em; text-decoration: none; color: var(--ink); }
.brand small { font-weight: 400; color: var(--muted); margin-left: 6px; }
.wrap { max-width: 960px; margin: 0 auto; padding: 0 16px; }
main.wrap { padding-top: 28px; padding-bottom: 48px; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 24px; margin-bottom: 20px; }
h1 { font-size: 24px; margin: 0 0 8px; } h2 { font-size: 18px; margin: 24px 0 8px; }
.muted { color: var(--muted); }
.draft-banner { background: var(--warn-bg); border-bottom: 1px solid var(--warn-line); color: var(--warn-ink);
  text-align: center; padding: 8px 16px; font-weight: 600; font-size: 13px; }
.flash { padding: 10px 14px; border-radius: 8px; margin-bottom: 12px; }
.flash.error { background: var(--err-bg); color: var(--err-ink); }
.flash.ok { background: var(--ok-bg); color: var(--ok-ink); }
form .grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 18px; }
@media (max-width: 640px) { form .grid { grid-template-columns: 1fr; } }
label { display: block; font-weight: 600; font-size: 13px; margin-bottom: 4px; }
input[type=text], input[type=email], input[type=password], textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); color: var(--ink); font: inherit; }
input:focus, textarea:focus, button:focus-visible, a:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.full { grid-column: 1 / -1; }
button, .btn { display: inline-block; padding: 11px 20px; border-radius: 8px; border: 1px solid var(--brand);
  background: var(--brand); color: var(--brand-ink); font: inherit; font-weight: 700; cursor: pointer; text-decoration: none; }
button.secondary, .btn.secondary { background: transparent; color: var(--ink); border-color: var(--line); }
button:disabled { opacity: .45; cursor: not-allowed; }
.agreement-box { border: 1px solid var(--line); border-radius: 8px; height: 55vh; overflow-y: auto; padding: 20px 24px; background: var(--panel); }
.agreement-box h1 { font-size: 20px; }
.binding-notice { border: 2px solid var(--ink); border-radius: 8px; padding: 12px 16px; margin: 12px 0 20px; }
.scroll-hint { font-size: 13px; color: var(--muted); margin: 8px 0 16px; }
.scroll-hint.done { color: var(--ok-ink); }
.check { display: flex; gap: 10px; align-items: flex-start; margin: 10px 0; font-weight: 400; font-size: 15px; }
.check input { margin-top: 4px; width: 18px; height: 18px; flex: none; }
.final-statement { background: var(--bg); border-left: 4px solid var(--ink); padding: 12px 16px; margin: 18px 0; font-weight: 600; }
.actions { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
table { border-collapse: collapse; width: 100%; font-size: 14px; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table-scroll { overflow-x: auto; }
.steps li { margin: 6px 0; } .tick { color: var(--ok-ink); font-weight: 700; } .pending { color: var(--muted); }
.record { border: 2px solid var(--ink); border-radius: 8px; padding: 16px 20px; margin: 20px 0; }
.record table td:first-child { width: 34%; font-weight: 600; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; word-break: break-all; }
.fees th, .fees td { border: 1px solid var(--line); }

/* Print: white page, black ink, no chrome */
@media print {
  :root { --bg: #fff; --panel: #fff; --ink: #000; --muted: #333; --line: #999; }
  header.top, .no-print, .draft-banner.no-print { display: none !important; }
  body { font: 11pt/1.45 Georgia, "Times New Roman", serif; }
  .panel { border: none; padding: 0; }
  .print-draft { display: block !important; }
  h2 { break-after: avoid; } .record { break-inside: avoid; }
  a { color: #000; text-decoration: none; }
}
.print-draft { display: none; text-align: center; font-weight: 700; border: 1px solid #000; padding: 6px; margin-bottom: 12px; }

.brand .logo { height: 28px; width: 28px; vertical-align: middle; margin-right: 8px; border-radius: 6px; }
.brand { display: inline-flex; align-items: center; }
