/* Signatureman design system. Documented in docs/DESIGN.md: read it before adding a class.
   Rules: no style="" for layout, colours from tokens, class names match docs/DESIGN.md. */
:root {
  --ink: #18181b;
  --paper: #f5f5f2;
  --surface: #ffffff;
  --brand: #0f766e;        /* teal: primary actions, links */
  --brand-ink: #ffffff;
  --brand-soft: #e6f2f0;
  --line: #e4e4e0;
  --muted: #6b6b66;
  --ok: #15803d;  --ok-soft: #e8f5ec;
  --bad: #b42318; --bad-soft: #fdecea;
  --r: 12px;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --ink: #ececea; --paper: #141413; --surface: #1d1d1b; --brand: #2dd4bf; --brand-ink: #0b1f1d;
    --brand-soft: #16302d; --line: #33332f; --muted: #a3a39c;
    --ok: #4ade80; --ok-soft: #142a1b; --bad: #f87171; --bad-soft: #351816;
    color-scheme: dark;
  }
}
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 15px/1.5 var(--sans); }
a { color: var(--brand); }
h1 { font-size: 1.5rem; line-height: 1.25; margin: 0; }
h2 { font-size: 1.15rem; margin: 2rem 0 .75rem; }
code { font-size: .9em; background: var(--brand-soft); padding: 1px 5px; border-radius: 4px; }
[hidden] { display: none !important; }

/* ── page skeleton ── */
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 16px 48px; }
.topbar { background: var(--surface); border-bottom: 1px solid var(--line); margin-bottom: 24px; }
.topbar-in { display: flex; align-items: center; gap: 16px; min-height: 56px; padding-bottom: 0; }
.brandmark { font-weight: 700; color: var(--ink); text-decoration: none; display: flex; align-items: center; gap: 8px; }
.brandmark-icon { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; background: var(--brand); color: var(--brand-ink); font-size: 15px; }
.topnav { margin-left: auto; display: flex; align-items: center; gap: 16px; }
.topnav a { color: var(--ink); text-decoration: none; }
.topnav a:hover { color: var(--brand); }
.navrow { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.tabacts { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.lead { margin: 0 0 20px; max-width: 70ch; }
.split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 440px); gap: 20px; align-items: start; }
.split > .surface + .previewcol, .split > .previewcol { margin-top: 0; }
@media (max-width: 900px) { .split { grid-template-columns: minmax(0, 1fr); } .previewcol { order: -1; } }
.sticky { position: sticky; top: 16px; }

/* ── surfaces ── */
.surface { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 20px; }
.surface + .surface, .split + .surface, .surface + .split, .split + details.surface { margin-top: 16px; }
.surface.flush { padding: 0; overflow: hidden; }
.surface.empty { text-align: center; padding: 40px 20px; }
.surface.empty h2 { margin-top: 0; }
.surface.highlight { border-color: var(--brand); background: var(--brand-soft); }
.panel { max-width: 420px; margin: 40px auto; }
.panel h1 { margin-bottom: 4px; }
.sect + .sect { border-top: 1px solid var(--line); padding-top: 18px; margin-top: 18px; }
.sectlabel { font-size: .75rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin-bottom: 10px; }
.stack > * + * { margin-top: 12px; }
.sub { color: var(--muted); display: block; }
.hint { color: var(--muted); font-size: .85rem; display: block; margin-top: 4px; }
.pill { display: inline-block; font-size: .8rem; padding: 2px 10px; border-radius: 999px; background: var(--brand-soft); color: var(--brand); font-weight: 600; }

/* ── rows ── */
.chrow { display: flex; align-items: center; gap: 14px; padding: 14px 20px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.chrow:last-child { border-bottom: 0; }
.chrow .meta { flex: 1 1 220px; min-width: 0; }
.chrow .meta a { color: var(--ink); text-decoration: none; }
.chrow .meta a:hover { color: var(--brand); }
.thumb { width: 44px; height: 44px; object-fit: contain; border-radius: 8px; border: 1px solid var(--line); background: #fff; flex: none; }
.thumb.round, img.round { border-radius: 50%; }
.thumb.initials { display: inline-grid; place-items: center; border-radius: 50%; background: var(--brand-soft); color: var(--brand); font-weight: 700; border: 0; }
.thumb.swatch { border: 0; }

/* ── forms ── */
label.fld { display: block; font-weight: 600; font-size: .9rem; }
label.fld input, label.fld select, label.fld textarea { display: block; width: 100%; margin-top: 5px; font: inherit; font-weight: 400; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 9px 11px; }
label.fld input[type=file] { padding: 7px; }
label.fld input:focus, label.fld select:focus, label.fld textarea:focus { outline: 2px solid var(--brand); outline-offset: -1px; border-color: var(--brand); }
.fldrow { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px; }
.fldrow + .fldrow, .fldrow + label, label + .fldrow, .current + .fldrow { margin-top: 12px; }
label.check { display: flex; gap: 8px; align-items: center; font-size: .9rem; margin-top: 10px; }
.colorpick { display: flex; gap: 8px; margin-top: 5px; }
.colorpick input[type=color] { width: 46px; flex: none; padding: 2px; height: 42px; margin-top: 0; }
.colorpick input:not([type=color]) { margin-top: 0; }
.current { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 4px; }
.current img { max-height: 64px; max-width: 220px; border: 1px solid var(--line); border-radius: 6px; background: #fff; padding: 4px; }
.current label.check { margin-top: 0; }

/* ── buttons and action rows ── */
.btn { display: inline-flex; align-items: center; gap: 6px; font: inherit; font-weight: 600; border-radius: 8px; padding: 9px 16px; border: 1px solid var(--brand); background: var(--brand); color: var(--brand-ink); text-decoration: none; cursor: pointer; white-space: nowrap; }
.btn:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; color: var(--brand); border-color: var(--line); }
.btn.ghost:hover { border-color: var(--brand); }
.btn.danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn.sm { padding: 6px 12px; font-size: .875rem; }
.linkbtn { font: inherit; background: none; border: 0; color: var(--ink); cursor: pointer; padding: 0; }
.linkbtn:hover { color: var(--brand); }
.actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.actions.wrapgap { margin-top: 16px; }
.spacer { flex: 1 1 auto; }
form.inline { display: inline; margin: 0; }

/* ── notices ── */
.notice { border-radius: var(--r); padding: 12px 16px; margin-bottom: 16px; border: 1px solid; }
.notice ul { margin: 6px 0 0; padding-left: 20px; }
.notice.ok { background: var(--ok-soft); border-color: var(--ok); }
.notice.bad { background: var(--bad-soft); border-color: var(--bad); }

/* ── signature preview ── */
.paper.preview { min-height: 160px; padding: 16px; }
.paper { background: #fff; color: #18181b; border: 1px dashed var(--line); border-radius: 8px; padding: 24px; overflow-x: auto; }
.sharebox { display: flex; gap: 8px; flex-wrap: wrap; }
.sharebox input { flex: 1 1 260px; min-width: 0; font: inherit; font-size: .9rem; padding: 7px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--paper); color: var(--ink); }
.copystatus { min-height: 1.4em; }

/* ── disclosures ── */
details > summary { cursor: pointer; font-weight: 600; }
details.minor { margin-top: 12px; }
details.minor > summary { font-weight: 400; color: var(--muted); font-size: .9rem; }
details.minor[open] > summary { margin-bottom: 8px; }
details.danger > summary { color: var(--bad); }
details.danger[open] > summary { margin-bottom: 12px; }
.clients { display: grid; gap: 10px; }
.clients .surface + .surface { margin-top: 0; }
.client { padding: 14px 20px; }
.client[open] > summary { margin-bottom: 8px; }
.client ol { margin: 0; padding-left: 22px; }
.client li + li { margin-top: 4px; }
