/* Cornerstone Private Wealth: Agreement to Proceed v1.0
   Same tokens and "quiet private bank" design as the Snapshot Fact Find v1.6. */
:root {
  color-scheme: light;
  --olive: #3f4129; --sage: #66684a; --brand-ink: #4c4e36; --sage-mid: #9a9e78; --sage-lt: #c3c98f; --sage-xl: #e7ead2;
  --bg: #f6f5f0; --surface: #ffffff; --surface-2: #f8f8f3; --tint: #eef0e4; --brand-soft: #e7ead2; --chip: #e7ead2; --chip-ink: #4c4e36;
  --ink: #23251a; --ink-2: #46483a; --muted: #64665a;
  --line: #e2e2d8; --line-2: #cbccbd; --ctl: #7f805e;
  --brand: #66684a; --btn: #4c4e36; --btn-hover: #3f4129; --btn-ink: #ffffff;
  --focus: #66684a; --focus-soft: rgba(102,104,74,.22);
  --warn: #8a4f0c; --warn-soft: #fbf0df; --danger: #a33a2b; --danger-soft: #fbecea; --ok: #3d6b34; --ok-soft: #e8f0e3;
  --dis-bg: #e9eae1; --dis-ink: #5e6052;
  --shadow: 0 1px 2px rgba(35,37,26,.05), 0 10px 30px -6px rgba(35,37,26,.08);
  --shadow-lg: 0 2px 6px rgba(35,37,26,.08), 0 24px 60px -12px rgba(35,37,26,.25);
  --radius: 16px; --r-ctl: 10px;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, "Times New Roman", serif;
  --sans: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, "Courier New", monospace;
  --pdf-bg: #e9e9e1;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #12140f; --surface: #1b1d16; --surface-2: #202219; --tint: #262820; --brand-soft: #2a2c21; --chip: #2f3224; --chip-ink: #cdd0ac;
    --ink: #e8ebe1; --ink-2: #c8cdbc; --muted: #a3aa96;
    --line: #33352a; --line-2: #4a4c3c; --ctl: #8b8f63;
    --brand: #b4b792; --brand-ink: #cdd0ac; --btn: #b4b792; --btn-hover: #c3c98f; --btn-ink: #12140f;
    --focus: #c3c98f; --focus-soft: rgba(195,201,143,.25);
    --warn: #e6b464; --warn-soft: #33281a; --danger: #ec9282; --danger-soft: #3a211c; --ok: #9fcf8f; --ok-soft: #1f2a1b;
    --dis-bg: #26281f; --dis-ink: #a3aa96; --pdf-bg: #0d0e0a;
    --shadow: 0 1px 2px rgba(0,0,0,.35), 0 10px 30px -6px rgba(0,0,0,.35);
    --shadow-lg: 0 2px 6px rgba(0,0,0,.4), 0 24px 60px -12px rgba(0,0,0,.6);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #12140f; --surface: #1b1d16; --surface-2: #202219; --tint: #262820; --brand-soft: #2a2c21; --chip: #2f3224; --chip-ink: #cdd0ac;
  --ink: #e8ebe1; --ink-2: #c8cdbc; --muted: #a3aa96;
  --line: #33352a; --line-2: #4a4c3c; --ctl: #8b8f63;
  --brand: #b4b792; --brand-ink: #cdd0ac; --btn: #b4b792; --btn-hover: #c3c98f; --btn-ink: #12140f;
  --focus: #c3c98f; --focus-soft: rgba(195,201,143,.25);
  --warn: #e6b464; --warn-soft: #33281a; --danger: #ec9282; --danger-soft: #3a211c; --ok: #9fcf8f; --ok-soft: #1f2a1b;
  --dis-bg: #26281f; --dis-ink: #a3aa96; --pdf-bg: #0d0e0a;
  --shadow: 0 1px 2px rgba(0,0,0,.35), 0 10px 30px -6px rgba(0,0,0,.35);
  --shadow-lg: 0 2px 6px rgba(0,0,0,.4), 0 24px 60px -12px rgba(0,0,0,.6);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; min-height: 100vh; background: var(--bg); color: var(--ink); font: 17px/1.55 var(--sans); -webkit-font-smoothing: antialiased; display: flex; flex-direction: column; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--brand-ink); text-underline-offset: 3px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
.sr { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }

/* header */
.top { position: sticky; top: 0; z-index: 20; background: var(--surface); border-bottom: 1px solid var(--line); }
.top-in { max-width: 1120px; margin: 0 auto; display: flex; align-items: center; gap: 14px; padding: 10px 16px; min-height: 60px; }
.brand { display: flex; align-items: center; min-height: 44px; text-decoration: none; flex: none; }
.brand img { height: 26px; width: auto; display: block; }
.top .doc { padding-left: 14px; border-left: 1px solid var(--line-2); font: 500 16px/1.2 var(--serif); color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.top .sp { flex: 1; }
.iconbtn { border: 1px solid var(--line); background: var(--surface); color: var(--brand-ink); border-radius: 10px; width: 44px; height: 44px; display: grid; place-items: center; cursor: pointer; flex: none; }
.iconbtn:hover { background: var(--brand-soft); }
.iconbtn svg { width: 22px; height: 22px; }
:root .i-sun { display: none; }
:root[data-theme="dark"] .i-sun { display: block; } :root[data-theme="dark"] .i-moon { display: none; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .i-sun { display: block; } :root:not([data-theme="light"]) .i-moon { display: none; } }
.who { font-size: 14px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 32vw; }
@media (min-width: 720px) { .brand img { height: 32px; } .top-in { padding: 12px 24px; min-height: 68px; } .top .doc { font-size: 17px; } }
@media (max-width: 420px) { .top .doc { display: none; } }

/* layout */
.wrap { width: 100%; max-width: 760px; margin: 0 auto; padding: 20px 16px 40px; flex: 1; }
.wrap.wide { max-width: 1120px; }
@media (min-width: 720px) { .wrap { padding: 36px 24px 56px; } }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px 18px; }
@media (min-width: 720px) { .card { padding: 34px 40px; } }
.card + .card, .card + section, section + .card { margin-top: 20px; }
.kicker { font: 600 13px/1.3 var(--sans); letter-spacing: .13em; text-transform: uppercase; color: var(--brand-ink); margin: 0 0 6px; }
h1.title { font: 500 30px/1.15 var(--serif); margin: 0; letter-spacing: -.005em; }
@media (min-width: 720px) { h1.title { font-size: 36px; } }
h2.sec { font: 500 24px/1.25 var(--serif); margin: 0 0 6px; display: flex; align-items: baseline; gap: 12px; }
h2.sec .n { font: 600 15px/1 var(--sans); color: var(--chip-ink); background: var(--chip); border-radius: 99px; width: 30px; height: 30px; display: inline-grid; place-items: center; flex: none; transform: translateY(-3px); }
h3 { font: 600 17px/1.35 var(--sans); margin: 22px 0 8px; }
.lead { font-size: 17.5px; color: var(--ink-2); margin: 12px 0 0; }
.muted { color: var(--muted); }
p { margin: 10px 0; }
.foot { text-align: center; font-size: 13.5px; color: var(--muted); padding: 22px 16px 30px; border-top: 1px solid var(--line); background: var(--surface); }

/* notes */
.note { background: var(--tint); border-left: 3px solid var(--brand); border-radius: 12px; padding: 14px 18px; color: var(--ink-2); font-size: 16px; margin: 18px 0; }
.note.warn { background: var(--warn-soft); border-color: var(--warn); color: var(--ink); }
.note.bad { background: var(--danger-soft); border-color: var(--danger); color: var(--ink); }
.note.good { background: var(--ok-soft); border-color: var(--ok); color: var(--ink); }
.note b { color: var(--ink); }

/* forms */
.grid { display: grid; gap: 16px; grid-template-columns: 1fr; }
@media (min-width: 640px) { .grid.two { grid-template-columns: 1fr 1fr; } .grid.three { grid-template-columns: 1fr 1fr 1fr; } }
.fld { display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.fld.wide { grid-column: 1 / -1; }
.fld > label, .fld > .lbl { font-weight: 600; font-size: 15.5px; color: var(--ink); }
.fld .help { font-size: 14.5px; color: var(--muted); }
input[type=text], input[type=email], input[type=tel], input[type=number], input[type=date], input:not([type]), select, textarea {
  width: 100%; min-height: 50px; border: 1.5px solid var(--line-2); border-radius: var(--r-ctl); background: var(--surface); padding: 11px 14px; font-size: 17px; }
textarea { min-height: 84px; resize: vertical; }
input:hover, select:hover, textarea:hover { border-color: var(--brand-ink); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px var(--focus-soft); }
.fld.bad input, .fld.bad select { border-color: var(--danger); box-shadow: 0 0 0 4px var(--danger-soft); }
.err-msg { color: var(--danger); font-size: 15.5px; margin: 12px 0 0; min-height: 0; }
.err-msg:empty { display: none; }
.money { position: relative; }
.money::before { content: "$"; position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.money input { padding-left: 28px; }
.dob { display: grid; grid-template-columns: 1fr 1fr 1.6fr; gap: 8px; }
.dob input { text-align: center; }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 10px; border-radius: var(--r-ctl); padding: 12px 22px; min-height: 50px; border: 1.5px solid var(--btn); background: var(--btn); color: var(--btn-ink);
  font: 600 16.5px/1.2 var(--sans); cursor: pointer; text-decoration: none; transition: background .15s, border-color .15s; }
.btn:hover { background: var(--btn-hover); border-color: var(--btn-hover); }
.btn:disabled, .btn[aria-disabled="true"] { background: var(--dis-bg); border-color: var(--dis-bg); color: var(--dis-ink); cursor: not-allowed; }
.btn.sec { background: var(--surface); color: var(--brand-ink); border-color: var(--ctl); }
.btn.sec:hover { background: var(--brand-soft); border-color: var(--brand); }
.btn.small { min-height: 40px; padding: 8px 14px; font-size: 15px; }
.btn.danger { background: var(--surface); color: var(--danger); border-color: var(--danger); }
.btn svg { width: 20px; height: 20px; flex: none; }
.actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 22px; align-items: center; }
.actions.end { justify-content: flex-end; }
@media (max-width: 520px) { .actions.stack .btn { width: 100%; } }

/* ticks */
.tick { display: flex; gap: 14px; align-items: flex-start; padding: 14px 16px; border: 1.5px solid var(--line-2); border-radius: 12px; background: var(--surface); cursor: pointer; margin: 10px 0; font-size: 16.5px; line-height: 1.45; }
.tick:hover { border-color: var(--brand-ink); background: var(--surface-2); }
.tick input { appearance: none; -webkit-appearance: none; width: 24px; height: 24px; min-height: 0; padding: 0; flex: none; border: 2px solid var(--ctl); border-radius: 6px; margin: 0; background: var(--surface); display: grid; place-items: center; cursor: pointer; }
.tick input::after { content: ""; width: 12px; height: 7px; border-left: 2.5px solid var(--btn-ink); border-bottom: 2.5px solid var(--btn-ink); transform: rotate(-45deg) translate(1px, -1px); opacity: 0; }
.tick input:checked { background: var(--brand); border-color: var(--brand); }
.tick input:checked::after { opacity: 1; }
.tick:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); box-shadow: inset 0 0 0 1px var(--brand); }
.tick input:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; box-shadow: none; }

/* details list (confirm only) */
.kv { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; margin: 12px 0 18px; }
.kv .h { background: var(--surface-2); padding: 10px 16px; font-weight: 650; color: var(--brand-ink); border-bottom: 1px solid var(--line); }
.kv dl { margin: 0; }
.kv .row { display: grid; grid-template-columns: 1fr; gap: 2px; padding: 11px 16px; border-top: 1px solid var(--line); }
.kv .row:first-child { border-top: 0; }
.kv dt { font-size: 14.5px; color: var(--muted); }
.kv dd { margin: 0; font-weight: 550; overflow-wrap: anywhere; }
@media (min-width: 600px) { .kv .row { grid-template-columns: 210px 1fr; gap: 16px; } .kv dt { font-size: 15.5px; } }

/* fees */
.fees { display: grid; gap: 12px; margin: 16px 0 6px; }
@media (min-width: 600px) { .fees.two { grid-template-columns: 1fr 1fr; } }
.fee { border: 1px solid var(--line); background: var(--surface-2); border-radius: 14px; padding: 16px 18px; }
.fee .l { font-size: 15px; color: var(--muted); }
.fee .v { font: 500 32px/1.2 var(--serif); color: var(--ink); margin-top: 4px; }
.fee .g { font-size: 14.5px; color: var(--ink-2); }

/* PDF viewer */
.pdf { background: var(--pdf-bg); border-radius: 12px; padding: 10px; margin: 16px 0 8px; display: grid; gap: 10px; justify-items: center; min-height: 160px; position: relative; }
.pdf canvas { width: 100%; height: auto; max-width: 820px; background: #fff; border-radius: 4px; box-shadow: 0 2px 10px rgba(0,0,0,.15); display: block; }
.pdf .loading { color: var(--muted); align-self: center; font-size: 15px; }

/* steps / progress */
.steps { display: flex; gap: 6px; margin: 18px 0 0; padding: 0; list-style: none; }
.steps li { flex: 1; height: 5px; border-radius: 99px; background: var(--line); }
.steps li.on { background: var(--brand); }

/* signer cards */
.signer { border: 1px solid var(--line); border-radius: 14px; padding: 16px 18px; margin: 14px 0; background: var(--surface); }
.signer .nm { font: 500 21px/1.3 var(--serif); }
.chip { display: inline-flex; align-items: center; gap: 6px; font-size: 13.5px; font-weight: 600; border-radius: 99px; padding: 4px 11px; background: var(--chip); color: var(--chip-ink); white-space: nowrap; }
.chip.ok { background: var(--ok-soft); color: var(--ok); }
.chip.warn { background: var(--warn-soft); color: var(--warn); }
.chip.bad { background: var(--danger-soft); color: var(--danger); }
.chip.grey { background: var(--dis-bg); color: var(--dis-ink); }
.sigpad { width: 100%; height: 180px; border: 1.5px dashed var(--ctl); border-radius: 12px; background: #fff; touch-action: none; display: block; cursor: crosshair; }
.sigrow { display: flex; justify-content: space-between; align-items: center; font-size: 14px; color: var(--muted); margin-top: 6px; }
.linkbtn { border: 0; background: none; color: var(--brand-ink); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; padding: 6px 4px; font-size: 15px; }

/* overlay sheet for embedded signing */
.sheet { position: fixed; inset: 0; z-index: 50; background: rgba(18,20,15,.55); display: grid; place-items: stretch; }
.sheet-in { background: var(--surface); display: flex; flex-direction: column; height: 100%; }
@media (min-width: 760px) { .sheet { place-items: center; padding: 24px; } .sheet-in { width: min(980px, 100%); height: min(92vh, 1000px); border-radius: 16px; overflow: hidden; box-shadow: var(--shadow-lg); } }
.sheet-hd { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.sheet-hd b { flex: 1; font-weight: 600; }
.sheet iframe { flex: 1; width: 100%; border: 0; background: #fff; }

/* busy + toast */
.busy { position: fixed; inset: 0; z-index: 60; background: rgba(246,245,240,.82); display: grid; place-items: center; }
:root[data-theme="dark"] .busy { background: rgba(18,20,15,.82); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .busy { background: rgba(18,20,15,.82); } }
.busy-card { display: grid; justify-items: center; gap: 14px; text-align: center; padding: 20px; }
.busy-card b { font: 500 21px/1.3 var(--serif); }
.spin { width: 48px; height: 48px; border-radius: 50%; border: 4px solid var(--brand-soft); border-top-color: var(--brand); animation: spin 1.1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spin { animation-duration: 3s; } }
.toast { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%) translateY(20px); background: var(--ink); color: var(--bg); padding: 12px 18px; border-radius: 12px; font-size: 15.5px; opacity: 0; pointer-events: none; transition: .2s; z-index: 70; max-width: calc(100vw - 32px); }
.toast.on { opacity: 1; transform: translateX(-50%); }

/* done */
.done-mark { width: 64px; height: 64px; border-radius: 50%; background: var(--ok-soft); color: var(--ok); display: grid; place-items: center; margin-bottom: 14px; }
.done-mark svg { width: 34px; height: 34px; }
ol.next { padding-left: 22px; } ol.next li { margin: 8px 0; }

/* staff dashboard */
.toolbar { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; }
.filters button { border: 1.5px solid var(--line-2); background: var(--surface); border-radius: 99px; padding: 7px 14px; min-height: 40px; cursor: pointer; font-size: 15px; }
.filters button[aria-pressed="true"] { border-color: var(--brand); background: var(--brand-soft); font-weight: 650; }
.search { max-width: 280px; min-height: 44px !important; }
table.list { width: 100%; border-collapse: collapse; font-size: 15.5px; }
table.list th { text-align: left; font-size: 13px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); font-weight: 600; padding: 10px 12px; border-bottom: 1px solid var(--line); }
table.list td { padding: 13px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.list tbody tr { cursor: pointer; }
table.list tbody tr:hover { background: var(--surface-2); }
table.list .nm { font-weight: 600; }
table.list .sub { font-size: 13.5px; color: var(--muted); }
@media (max-width: 760px) {
  table.list thead { display: none; }
  table.list, table.list tbody, table.list tr, table.list td { display: block; width: 100%; }
  table.list tr { border: 1px solid var(--line); border-radius: 12px; margin-bottom: 10px; padding: 6px 4px; background: var(--surface); }
  table.list td { border: 0; padding: 6px 12px; }
  table.list td[data-l]::before { content: attr(data-l) ": "; color: var(--muted); font-size: 13.5px; }
}
.empty { text-align: center; color: var(--muted); padding: 40px 10px; }
.drop { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 4px; border: 2px dashed var(--line-2); border-radius: 14px; padding: 22px 16px; cursor: pointer; background: var(--surface-2); min-height: 120px; }
.drop:hover, .drop.over { border-color: var(--brand); background: var(--brand-soft); }
.drop.has { border-style: solid; border-color: var(--brand); }
.drop b { font-weight: 650; }
.drop span { font-size: 14.5px; color: var(--muted); }
.seg { display: inline-flex; border: 1.5px solid var(--line-2); border-radius: 12px; overflow: hidden; }
.seg button { border: 0; background: var(--surface); padding: 10px 18px; min-height: 46px; cursor: pointer; font-weight: 600; }
.seg button[aria-pressed="true"] { background: var(--brand-soft); color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--brand); }
.per { border: 1px solid var(--line); border-radius: 14px; padding: 16px; margin-top: 14px; background: var(--surface-2); }
.per > .h { font-weight: 650; margin-bottom: 10px; color: var(--brand-ink); }
.drow { display: grid; grid-template-columns: 1fr 1.6fr auto; gap: 8px; align-items: center; margin-top: 8px; }
.drow input { min-height: 44px; font-size: 15.5px; }
@media (max-width: 600px) { .drow { grid-template-columns: 1fr auto; } .drow input:nth-child(2) { grid-column: 1; } }
.xbtn { border: 1px solid var(--line); background: var(--surface); border-radius: 10px; width: 40px; height: 40px; cursor: pointer; color: var(--muted); font-size: 20px; line-height: 1; }
.xbtn:hover { color: var(--danger); border-color: var(--danger); }
.linkbox { display: flex; gap: 8px; align-items: stretch; flex-wrap: wrap; }
.linkbox input { flex: 1 1 260px; font-family: var(--mono); font-size: 14px; }
.events { list-style: none; padding: 0; margin: 0; font-size: 14.5px; }
.events li { display: grid; grid-template-columns: 170px 1fr; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line); }
.events li .t { color: var(--muted); font-variant-numeric: tabular-nums; }
.events li .x { color: var(--muted); font-size: 13.5px; overflow-wrap: anywhere; }
@media (max-width: 600px) { .events li { grid-template-columns: 1fr; gap: 2px; } }
.banner { background: var(--warn-soft); color: var(--ink); border-bottom: 1px solid var(--line); font-size: 14.5px; text-align: center; padding: 8px 16px; }
.split { display: grid; gap: 20px; }
@media (min-width: 980px) { .split { grid-template-columns: 1.15fr .85fr; align-items: start; } }
