  :root {
    --bg:#F1F4F9; --surface:#FFFFFF; --surface-2:#EDF0F6; --border:#DCE2EC; --border-strong:#C2CBDb;
    --ink:#0D1F3D; --ink-2:#45506A; --ink-3:#6B7688;
    --accent:#2B5CB8; --accent-weak:#E7EEFA;
    --violet:#6D3BC7; --violet-weak:#EEE7FA; --teal:#0E7C86; --teal-weak:#DBF0F1;
    --good:#1C7A4C; --good-weak:#E1F1E8; --warn:#A85B08; --warn-weak:#F9EEDA; --crit:#B7364A; --crit-weak:#FBE6E9;
    --shadow:0 1px 2px rgba(13,31,61,.05),0 4px 16px rgba(13,31,61,.05);
    --mono:"SF Mono","Roboto Mono",ui-monospace,Menlo,monospace;
    --sans:Avenir,"Avenir Next","Helvetica Neue",Helvetica,Arial,system-ui,sans-serif;
  }
  @media (prefers-color-scheme: dark) { :root {
    --bg:#0A1120; --surface:#111B2E; --surface-2:#1A2540; --border:#26324F; --border-strong:#35456A;
    --ink:#E9EEF7; --ink-2:#AEB9CE; --ink-3:#7E8BA5;
    --accent:#74A0EE; --accent-weak:#172741;
    --violet:#B499F0; --violet-weak:#241A3D; --teal:#58C3CC; --teal-weak:#10282B;
    --good:#52B888; --good-weak:#14291F; --warn:#E0A24C; --warn-weak:#2C2313; --crit:#E67C8E; --crit-weak:#2C1820;
    --shadow:0 1px 2px rgba(0,0,0,.3),0 4px 16px rgba(0,0,0,.25);
  } }
  :root[data-theme="light"] {
    --bg:#F1F4F9; --surface:#FFFFFF; --surface-2:#EDF0F6; --border:#DCE2EC; --border-strong:#C2CBDb;
    --ink:#0D1F3D; --ink-2:#45506A; --ink-3:#6B7688;
    --accent:#2B5CB8; --accent-weak:#E7EEFA;
    --violet:#6D3BC7; --violet-weak:#EEE7FA; --teal:#0E7C86; --teal-weak:#DBF0F1;
    --good:#1C7A4C; --good-weak:#E1F1E8; --warn:#A85B08; --warn-weak:#F9EEDA; --crit:#B7364A; --crit-weak:#FBE6E9;
    --shadow:0 1px 2px rgba(13,31,61,.05),0 4px 16px rgba(13,31,61,.05);
  }
  :root[data-theme="dark"] {
    --bg:#0A1120; --surface:#111B2E; --surface-2:#1A2540; --border:#26324F; --border-strong:#35456A;
    --ink:#E9EEF7; --ink-2:#AEB9CE; --ink-3:#7E8BA5;
    --accent:#74A0EE; --accent-weak:#172741;
    --violet:#B499F0; --violet-weak:#241A3D; --teal:#58C3CC; --teal-weak:#10282B;
    --good:#52B888; --good-weak:#14291F; --warn:#E0A24C; --warn-weak:#2C2313; --crit:#E67C8E; --crit-weak:#2C1820;
    --shadow:0 1px 2px rgba(0,0,0,.3),0 4px 16px rgba(0,0,0,.25);
  }

  * { box-sizing:border-box; }
  body { margin:0; background:var(--bg); color:var(--ink); font-family:var(--sans); line-height:1.5; -webkit-font-smoothing:antialiased; padding-bottom:84px; }
  .wrap { width:95%; max-width:1600px; margin:0 auto; padding:0 20px; }

  .topbar { background:var(--ink); color:#fff; border-bottom:3px solid var(--accent); }
  @media (prefers-color-scheme: dark) { .topbar { background:#0A1120; } }
  :root[data-theme="dark"] .topbar { background:#0A1120; }
  :root[data-theme="light"] .topbar { background:#0D1F3D; }
  .topbar .wrap { display:flex; align-items:center; justify-content:space-between; height:60px; gap:16px; }
  .brand { display:flex; align-items:baseline; gap:12px; }
  .brand .logo { font-weight:800; letter-spacing:.16em; font-size:18px; color:#fff; }
  .brand .sub { font-size:12.5px; color:#9FB0CC; letter-spacing:.02em; }
  .who { text-align:right; font-size:13px; color:#C6D2E6; }
  .who b { color:#fff; font-weight:600; }

  /* Admin view-as bar. Deliberately loud: it is the only thing on the page that
     says you are looking at someone else's screen. */
  .viewas { background:var(--warn-weak); border-bottom:1px solid var(--warn); }
  .viewas .wrap { display:flex; align-items:center; gap:14px; padding-top:9px; padding-bottom:9px; }
  .va-tag { flex:none; font-size:10.5px; font-weight:800; letter-spacing:.07em; text-transform:uppercase; color:#fff; background:var(--warn); border-radius:5px; padding:3px 8px; }
  .va-txt { font-size:13px; color:var(--ink-2); }
  .va-txt b { color:var(--ink); font-weight:700; }
  .va-exit { margin-left:auto; flex:none; font-size:12.5px; font-weight:600; color:var(--ink); text-decoration:none; border:1px solid var(--warn); border-radius:7px; padding:5px 12px; background:var(--surface); }
  .va-exit:hover { background:var(--warn); color:#fff; }
  @media (max-width:760px) { .viewas .wrap { flex-wrap:wrap; gap:8px; } .va-exit { margin-left:0; } }

  /* Under view-as, every control that writes is dimmed and takes the barred
     cursor. The banner alone did not carry it — on 18 Aug three admins clicked
     the flag icons 29 times on a screen already headed "read only", because a
     control that looks live reads as live. The click still lands and still
     explains itself; this just says so first. */
  body[data-viewas] .flag-btn,
  body[data-viewas] .flag-toggle,
  body[data-viewas] .flag-send,
  body[data-viewas] .btn-mark,
  body[data-viewas] #sig-toggle,
  body[data-viewas] #sig-send,
  body[data-viewas] #missing-toggle,
  body[data-viewas] #missing-send,
  body[data-viewas] #btn-confirm,
  body[data-viewas] .optin select,
  body[data-viewas] .optin-btn,
  body[data-viewas] .use-suggested,
  body[data-viewas] .panel.editable select,
  body[data-viewas] .panel.editable input,
  body[data-viewas] .toggle input { opacity:.55; cursor:not-allowed; }

  /* Admin-only top-bar nav. Advisers never see this — their screen is the app. */
  .topright { display:flex; align-items:center; gap:24px; margin-left:auto; }
  .topnav { display:flex; align-items:center; gap:2px; }
  .topnav a { font-size:13px; font-weight:600; color:#C6D2E6; text-decoration:none; padding:7px 13px; border-radius:7px; white-space:nowrap; }
  .topnav a:hover { background:rgba(255,255,255,.10); color:#fff; }
  .topnav a.on { background:rgba(255,255,255,.16); color:#fff; }
  @media (max-width:760px) {
    .topbar .wrap { height:auto; flex-wrap:wrap; padding-top:10px; padding-bottom:10px; gap:10px; }
    .topright { width:100%; justify-content:space-between; gap:12px; }
    .topnav a { padding:6px 9px; }
  }

  .notice { background:var(--accent-weak); border:1px solid var(--border); border-left:4px solid var(--accent); border-radius:10px; padding:14px 18px; margin:22px 0 18px; display:flex; gap:14px; align-items:flex-start; }
  .notice svg { flex:none; margin-top:2px; color:var(--accent); }
  .notice h1 { margin:0 0 3px; font-size:15.5px; font-weight:700; letter-spacing:-.01em; }
  .notice p { margin:0; font-size:13.5px; color:var(--ink-2); }
  .notice .deadline { color:var(--ink); font-weight:600; }

  .reviewbar { display:flex; flex-wrap:wrap; align-items:stretch; background:var(--surface); border:1px solid var(--border); border-radius:10px; box-shadow:var(--shadow); margin:0 0 18px; overflow:hidden; }
  .rb-cell { flex:1 1 auto; min-width:160px; padding:11px 18px; border-right:1px solid var(--border); display:flex; flex-direction:column; gap:3px; }
  .rb-lbl { font-size:10.5px; text-transform:uppercase; letter-spacing:.07em; color:var(--ink-3); font-weight:700; }
  .rb-val { font-size:14px; color:var(--ink); font-weight:600; }
  .rb-val b { font-variant-numeric:tabular-nums; }
  .rb-mut { color:var(--ink-3); font-weight:500; font-size:12.5px; }
  .rb-live { background:var(--accent-weak); border-right:0; }
  .rb-auto { flex:1 1 100%; display:flex; align-items:center; gap:9px; padding:9px 18px; border-top:1px solid var(--border); background:var(--surface-2); font-size:12px; color:var(--ink-2); }
  .rb-auto svg { flex:none; color:var(--good); }
  .rb-auto b { color:var(--ink); font-weight:700; }

  .saved-chip { display:inline-block; margin-left:10px; padding:2px 9px; border-radius:20px; background:var(--good-weak); color:var(--good); font-size:11.5px; font-weight:700; opacity:0; transform:translateY(2px); transition:opacity .2s, transform .2s; }
  .saved-chip.show { opacity:1; transform:none; }

  /* collapsible sections (profile, excluded) */
  .fold { background:var(--surface); border:1px solid var(--border); border-radius:14px; box-shadow:var(--shadow); margin:0 0 18px; overflow:hidden; }
  .fold-head { display:flex; align-items:center; justify-content:space-between; gap:12px; padding:13px 18px; cursor:pointer; }
  .fold-head h2 { margin:0; font-size:15px; font-weight:700; letter-spacing:-.01em; display:flex; align-items:center; }
  .fold-head .sub { font-size:12px; color:var(--ink-3); font-weight:500; margin-top:2px; }
  .fh-left { display:flex; align-items:center; gap:14px; min-width:0; }
  .fh-avatar { width:44px; height:44px; border-radius:50%; object-fit:cover; border:2.5px solid #ff3743; flex:none; background:#f8f9fa; }
  .fold-head .caret { transition:transform .15s; color:var(--ink-3); flex:none; }
  .fold.collapsed .caret { transform:rotate(-90deg); }
  .fold.collapsed .fold-body { display:none; }
  .cnt { font-size:12px; font-weight:700; color:var(--ink-3); background:var(--surface-2); border:1px solid var(--border); border-radius:100px; padding:1px 8px; margin-left:8px; }

  .profile-body { display:grid; grid-template-columns:600px 1fr; gap:24px; padding:2px 18px 18px; align-items:start; }
  .sig-mount { max-width:600px; }
  @media (max-width:1024px) { .profile-body { grid-template-columns:1fr; } }
  .cardprev { background:#f8f9fa; border:1px solid #e6e8eb; border-radius:12px; padding:18px 16px; font-family:var(--sans); }
  .cp-head { font-size:16px; font-weight:700; color:#0d1f3d; text-align:center; margin-bottom:14px; }
  .cp-inner { background:#fff; border:1px solid #eef0f2; border-radius:8px; padding:18px; }
  .cp-row { display:flex; gap:16px; align-items:flex-start; }
  .cp-photo { width:88px; height:88px; border-radius:50%; object-fit:cover; border:3px solid #ff3743; flex:none; background:#f8f9fa; }
  .cp-info { min-width:0; }
  .cp-nm { font-size:17px; font-weight:700; color:#0d1f3d; margin-bottom:4px; }
  .cp-tt { font-size:12px; color:#666; font-style:italic; margin-bottom:12px; }
  .cp-ln { font-size:13px; color:#0d1f3d; margin-bottom:5px; }
  .cp-em { font-size:13px; color:#ff3743; font-weight:700; word-break:break-all; }
  .cp-qr { text-align:center; margin-top:16px; }
  .cp-qr img { width:92px; height:92px; border:2px solid #e0e0e0; border-radius:8px; padding:4px; background:#fff; }
  .cp-qrcap { font-size:10.5px; color:#999; margin-top:6px; }
  .cp-btn { margin:16px auto 0; max-width:250px; background:#ff3743; color:#fff; font-weight:700; font-size:13px; text-align:center; padding:12px 20px; border-radius:4px; }
  .pform { display:grid; grid-template-columns:1fr 1fr; gap:12px; align-content:start; }
  .pform .field.full { grid-column:1 / -1; }
  .uploadrow { display:flex; gap:8px; align-items:center; }
  .compliance { font-size:10.5px; color:var(--warn); font-weight:600; }
  .pform-foot { grid-column:1 / -1; display:flex; justify-content:flex-end; margin-top:2px; }
  .sigmanage { min-width:0; }
  .managed-note { display:flex; gap:10px; align-items:flex-start; background:var(--surface-2); border:1px solid var(--border); border-radius:11px; padding:12px 14px; font-size:12.5px; color:var(--ink-2); line-height:1.5; }
  .managed-note svg { flex:none; margin-top:1px; color:var(--ink-3); }
  .managed-note b { color:var(--ink); font-weight:700; }
  .editor-toggle { margin-top:10px; background:none; border:0; padding:2px 0; font-family:inherit; font-size:11.5px; font-weight:600; color:var(--ink-3); cursor:pointer; display:inline-flex; align-items:center; gap:6px; }
  .editor-toggle:hover { color:var(--accent); }
  .editor-toggle .caret-i { flex:none; transition:transform .15s; }
  #sig-editor { margin-top:12px; }
  #sig-editor[hidden] { display:none; }
  .editor-cap { grid-column:1 / -1; font-size:11px; color:var(--warn); background:var(--warn-weak); border:1px solid color-mix(in srgb,var(--warn) 30%,transparent); border-radius:7px; padding:7px 10px; font-weight:600; line-height:1.4; }

  /* excluded list */
  .excluded-body { padding:2px 18px 16px; }
  .exlist { list-style:none; margin:0; padding:0; }
  .exlist li { display:flex; align-items:center; justify-content:space-between; gap:12px; padding:9px 2px; border-top:1px solid var(--border); font-size:13.5px; }
  .exlist li:first-child { border-top:0; }
  .exreason { font-size:11.5px; font-weight:600; padding:3px 9px; border-radius:100px; white-space:nowrap; flex:none; }
  .exreason.ph { background:var(--surface-2); color:var(--ink-2); }
  .exreason.consent { background:var(--warn-weak); color:var(--warn); }
  .exlist li.optin-row { flex-wrap:wrap; }
  .optin { display:flex; align-items:center; gap:8px; flex-basis:100%; flex-wrap:wrap; }
  .optin select { font:inherit; font-size:13px; padding:5px 8px; border:1px solid var(--border); border-radius:8px; background:var(--surface); color:var(--ink); max-width:100%; }
  .optin .flagmsg { margin-right:0; }
  /* Adviser picker on the admin landing — filter, then Enter for first match. */
  .advpick { max-width:620px; }
  .advpick label { display:block; font-size:12.5px; font-weight:600; color:var(--ink-2); margin-bottom:6px; }
  .advpick input[type="search"] { font-family:inherit; font-size:14.5px; color:var(--ink); background:var(--surface); border:1px solid var(--border-strong); border-radius:8px; padding:10px 13px; width:100%; }
  .advpick input[type="search"]:focus { outline:2px solid var(--accent); outline-offset:1px; }
  .advlist { list-style:none; margin:10px 0 0; padding:0; max-height:320px; overflow-y:auto; border:1px solid var(--border); border-radius:10px; background:var(--surface-2); }
  .advlist li { border-top:1px solid var(--border); }
  .advlist li:first-child { border-top:0; }
  .advlist a { display:flex; align-items:center; gap:11px; padding:10px 13px; text-decoration:none; }
  .advlist a:hover, .advlist a:focus { background:var(--accent-weak); outline:none; }
  .av-nm { font-size:13.5px; font-weight:600; color:var(--ink); }
  .av-loc { font-size:12px; color:var(--ink-3); }
  .advlist .exreason { margin-left:auto; }
  .av-none { font-size:13px; color:var(--ink-3); margin:10px 0 0; }

  .ra-right { display:flex; align-items:center; gap:12px; flex:none; }
  .ra-view { font-size:12.5px; font-weight:600; color:var(--accent); text-decoration:none; white-space:nowrap; }
  .ra-view:hover { text-decoration:underline; }
  .exmiss { margin:14px 0 0; font-size:12.5px; color:var(--ink-2); }
  .exmiss a { color:var(--accent); font-weight:600; cursor:pointer; }
  #excluded { border-color:color-mix(in srgb,var(--warn) 40%,var(--border)); border-left:4px solid var(--warn); }
  #excluded .fold-head { background:var(--warn-weak); }
  #excluded .fold-head h2 { font-size:16.5px; }
  #excluded .fold-head .sub { color:var(--ink-2); }
  #excluded .cnt { font-size:13px; background:var(--surface); color:var(--warn); border-color:color-mix(in srgb,var(--warn) 35%,transparent); }
  .ex-ico { width:36px; height:36px; border-radius:9px; background:var(--surface); color:var(--warn); display:inline-flex; align-items:center; justify-content:center; flex:none; border:1px solid color-mix(in srgb,var(--warn) 30%,transparent); }

  .tiles { display:grid; grid-template-columns:repeat(4,1fr); gap:12px; margin-bottom:8px; }
  .tile { background:var(--surface); border:1px solid var(--border); border-radius:12px; padding:14px 16px; box-shadow:var(--shadow); }
  .tile .n { font-size:26px; font-weight:800; letter-spacing:-.02em; font-variant-numeric:tabular-nums; }
  .tile .l { font-size:11.5px; text-transform:uppercase; letter-spacing:.06em; color:var(--ink-3); margin-top:2px; }
  .tile.attention .n { color:var(--warn); }
  .tile.done .n { color:var(--good); }

  .bar { display:flex; align-items:center; justify-content:space-between; margin:20px 0 12px; gap:12px; flex-wrap:wrap; }
  .seg { display:inline-flex; background:var(--surface-2); border:1px solid var(--border); border-radius:9px; padding:3px; }
  .seg button { font-family:inherit; font-size:13px; font-weight:600; color:var(--ink-2); background:none; border:0; padding:6px 14px; border-radius:7px; cursor:pointer; }
  .seg button[aria-pressed="true"] { background:var(--surface); color:var(--ink); box-shadow:var(--shadow); }
  .bar .meta { font-size:12.5px; color:var(--ink-3); }

  .client { display:flex; background:var(--surface); border:1px solid var(--border); border-radius:14px; box-shadow:var(--shadow); margin-bottom:14px; overflow:hidden; }
  .client[hidden] { display:none; }
  .stripe { width:5px; flex:none; background:var(--border-strong); }
  .client[data-status="attention"] .stripe { background:var(--warn); }
  .client[data-status="reviewed"] .stripe { background:var(--good); }
  .client[data-status="optout"] .stripe { background:var(--ink-3); }
  .client[data-status="inactive"] .stripe { background:var(--ink-3); }
  .client[data-status="review"] .stripe { background:var(--accent); }
  .cbody { flex:1; padding:15px 18px; min-width:0; }

  .chead { display:flex; align-items:flex-start; justify-content:space-between; gap:14px; margin-bottom:12px; }
  .ctitle { display:flex; align-items:baseline; gap:8px 12px; flex-wrap:wrap; }
  .ctitle h2 { margin:0; font-size:17px; font-weight:700; letter-spacing:-.015em; text-wrap:balance; }
  .etab { font-size:15px; font-weight:700; padding:3px 11px; border-radius:8px; letter-spacing:-.01em; white-space:nowrap; }
  .etab time { font-variant-numeric:tabular-nums; }
  .etab-pre { background:var(--accent-weak); color:var(--accent); }
  .etab-post { background:var(--violet-weak); color:var(--violet); }
  .etab-survey { background:var(--teal-weak); color:var(--teal); }

  .pill { flex:none; font-size:11.5px; font-weight:700; padding:4px 10px; border-radius:100px; letter-spacing:.02em; white-space:nowrap; }
  .pill-attention { background:var(--warn-weak); color:var(--warn); }
  .pill-reviewed { background:var(--good); color:#fff; }
  .pill-review { background:#ff3743; color:#fff; }

  .chead-right { display:flex; flex-direction:row; align-items:center; gap:10px; flex:none; }
  .lastrev { font-size:11.5px; color:var(--ink-3); white-space:nowrap; }
  .lastrev b { color:var(--ink-2); font-weight:600; }
  .lastrev.never { color:var(--warn); font-weight:600; }

  .cgrid { display:grid; grid-template-columns:250px minmax(0,1fr) 250px; gap:12px; align-items:stretch; margin-bottom:12px; }
  @media (max-width:1080px) { .cgrid { grid-template-columns:1fr; } }
  .panel { border:1px solid var(--border); border-radius:11px; padding:11px 13px; }
  .panel.readonly { background:var(--surface-2); }
  .col-manage { display:flex; flex-direction:column; }
  .mdiv { border:0; border-top:1px dashed var(--border); margin:11px 0 10px; width:100%; }
  .tblock + .tblock { margin-top:10px; }

  .plabel { font-size:10.5px; text-transform:uppercase; letter-spacing:.07em; font-weight:700; color:var(--ink-3); display:flex; align-items:center; gap:6px; margin-bottom:10px; }
  .plabel svg { color:var(--ink-3); }
  .plabel .dot { width:7px; height:7px; border-radius:50%; background:var(--accent); }

  dl { margin:0; display:grid; gap:11px; }
  dl > div { display:block; }
  dt { font-size:10.5px; text-transform:uppercase; letter-spacing:.05em; color:var(--ink-3); font-weight:600; margin-bottom:3px; }
  dd { margin:0; font-size:13.5px; color:var(--ink); font-weight:500; display:flex; align-items:baseline; gap:6px; flex-wrap:wrap; }
  dd .src { font-size:11px; color:var(--ink-3); font-weight:400; }
  dd.muted { color:var(--ink-3); font-weight:400; font-size:13px; }
  dd.email-val { font-size:13px; word-break:break-all; }
  .shared-badge { font-size:10.5px; color:var(--warn); background:var(--warn-weak); border-radius:5px; padding:1px 6px; font-weight:600; }
  .flag-btn { background:none; border:0; padding:0; margin-left:auto; cursor:pointer; color:var(--ink-3); display:inline-flex; align-items:center; }
  .flag-btn:hover { color:var(--warn); }
  .flag-btn.on { color:var(--warn); }
  .missing { color:var(--crit); font-weight:600; }
  .hint { margin:10px 0 0; font-size:11.5px; color:var(--ink-3); line-height:1.45; }
  .hint.warnflag { color:var(--warn); }

  .field { display:grid; gap:5px; }
  .field label { font-size:12.5px; font-weight:600; color:var(--ink-2); display:flex; align-items:center; gap:7px; flex-wrap:wrap; }
  .crmtag { display:none; font-family:var(--mono); font-size:10px; color:var(--ink-3); background:var(--surface-2); border:1px solid var(--border); padding:1px 6px; border-radius:5px; font-weight:500; }
  .panel.editable .crmtag { background:var(--bg); }
  select { font-family:inherit; font-size:13.5px; color:var(--ink); font-weight:500; background:var(--surface); border:1px solid var(--border-strong); border-radius:8px; padding:8px 11px; width:100%; cursor:pointer; appearance:none; background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236B7688' stroke-width='2.5' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat:no-repeat; background-position:right 10px center; padding-right:32px; }
  input[type="text"] { font-family:inherit; font-size:13.5px; color:var(--ink); font-weight:500; background:var(--surface); border:1px solid var(--border-strong); border-radius:8px; padding:8px 11px; width:100%; }
  textarea { font-family:inherit; font-size:13px; color:var(--ink); background:var(--surface); border:1px solid var(--border-strong); border-radius:8px; padding:9px 11px; width:100%; min-height:62px; resize:vertical; }
  select:focus-visible, button:focus-visible, input:focus-visible, textarea:focus-visible { outline:2px solid var(--accent); outline-offset:2px; }
  select.changed { border-color:var(--accent); box-shadow:0 0 0 3px var(--accent-weak); }
  .chg { font-size:11px; font-weight:700; color:var(--accent); margin-left:auto; }
  .chg[hidden] { display:none; }

  .held { font-size:12px; color:var(--ink-2); margin-bottom:10px; display:flex; align-items:center; gap:6px; flex-wrap:wrap; }
  .held .chip { background:var(--surface-2); border:1px solid var(--border); border-radius:6px; padding:2px 8px; font-size:11.5px; font-weight:600; color:var(--ink); }
  .trow { display:grid; grid-template-columns:1fr 1fr; gap:12px; align-items:start; }
  .warnline { display:flex; gap:9px; align-items:flex-start; margin-top:12px; background:var(--warn-weak); border:1px solid color-mix(in srgb,var(--warn) 30%,transparent); border-radius:9px; padding:9px 12px; font-size:12.5px; color:var(--warn); font-weight:500; }
  .warnline[hidden] { display:none; }
  .warnline svg { flex:none; margin-top:1px; }
  .warnline b { font-weight:700; }
  .surveynote { font-size:12.5px; color:var(--ink-2); display:flex; gap:9px; align-items:flex-start; }
  .surveynote svg { flex:none; margin-top:1px; color:var(--ink-3); }

  .prev-link { justify-self:start; background:none; border:0; padding:1px 0; font-family:inherit; font-size:11.5px; font-weight:600; color:var(--accent); cursor:pointer; display:inline-flex; align-items:center; gap:4px; }
  .prev-link:hover { text-decoration:underline; }
  .prev-panel { margin-top:12px; background:var(--surface-2); border:1px solid var(--border); border-radius:10px; padding:14px; display:flex; gap:16px; align-items:flex-start; }
  .prev-panel[hidden] { display:none; }
  .prev-img { width:230px; max-width:38%; aspect-ratio:16/10; object-fit:cover; border-radius:8px; flex:none; background:var(--border); }
  .prev-text { min-width:0; }
  .prev-text h4 { margin:0 0 7px; font-size:15px; color:var(--ink); font-weight:700; line-height:1.3; }
  .prev-text p { margin:0; font-size:13px; line-height:1.55; color:var(--ink-2); }
  .prev-generic { font-size:10px; color:var(--ink-3); margin:0 0 6px; font-weight:700; text-transform:uppercase; letter-spacing:.05em; }
  .prev-text .none { color:var(--ink-3); font-style:italic; }
  @media (max-width:680px){ .prev-panel { flex-direction:column; } .prev-img { width:100%; max-width:none; } }

  .optouts { border:1px solid var(--border); border-radius:11px; padding:11px 13px; }
  .toggle { display:flex; align-items:center; gap:10px; font-size:13px; color:var(--ink); font-weight:500; cursor:pointer; padding:5px 0; }
  .toggle input { position:absolute; opacity:0; width:0; height:0; }
  .track { width:38px; height:22px; border-radius:100px; background:var(--border-strong); flex:none; position:relative; transition:background .15s; }
  .track::after { content:""; position:absolute; top:2px; left:2px; width:18px; height:18px; border-radius:50%; background:#fff; box-shadow:0 1px 2px rgba(0,0,0,.25); transition:transform .15s; }
  .toggle input:checked + .track { background:var(--accent); }
  .toggle input:checked + .track::after { transform:translateX(16px); }
  .toggle.active input:checked + .track { background:var(--good); }
  .toggle.master { font-weight:700; }
  .toggle.master input:checked + .track { background:var(--crit); }
  .tgroup { display:grid; gap:2px; padding-top:2px; }
  .tgroup.disabled { opacity:.45; pointer-events:none; }
  .toggle .note { font-size:11px; color:var(--ink-3); font-weight:400; margin-left:4px; }
  .inactive-note { font-size:11.5px; color:var(--warn); background:var(--warn-weak); border-radius:7px; padding:7px 9px; margin:4px 0 0; line-height:1.4; }
  .inactive-note[hidden] { display:none; }
  .optreason { margin-top:9px; }
  .optreason[hidden] { display:none; }

  .reassign, .flagbox { border:1px solid var(--border); border-radius:11px; padding:11px 13px; margin-bottom:12px; background:var(--surface-2); }
  .reassign[hidden], .flagbox[hidden] { display:none; }
  .reassign-row { display:grid; grid-template-columns:1fr 1fr; gap:12px; }

  .cfoot { display:flex; gap:10px; align-items:center; flex-wrap:wrap; }
  .btn { font-family:inherit; font-size:13px; font-weight:600; border-radius:8px; padding:8px 15px; cursor:pointer; border:1px solid transparent; }
  .btn-ghost { background:var(--surface); border-color:var(--border-strong); color:var(--ink-2); }
  .btn-ghost:hover { background:var(--surface-2); }
  .btn-mark { background:#ff3743; color:#fff; margin-left:auto; }
  .btn-mark:hover { filter:brightness(1.06); }
  .client[data-status="reviewed"] .btn-mark { background:var(--good); }
  .btn.preview-email { background:transparent; border-color:#ff3743; color:#ff3743; }
  .btn.preview-email:hover { background:rgba(255,55,67,.08); border-color:#ff3743; }

  .report { background:var(--surface); border:1px dashed var(--border-strong); border-radius:12px; padding:16px 20px; margin:22px 0 10px; display:flex; gap:14px; align-items:flex-start; }
  .report svg { flex:none; color:var(--good); margin-top:2px; }
  .report h3 { margin:0 0 4px; font-size:14.5px; }
  .report p { margin:0; font-size:13px; color:var(--ink-2); }

  .actions { position:fixed; bottom:0; left:0; right:0; background:color-mix(in srgb,var(--surface) 92%,transparent); backdrop-filter:blur(8px); border-top:1px solid var(--border); z-index:10; }
  .actions .wrap { display:flex; align-items:center; justify-content:space-between; height:64px; gap:14px; }
  .actions .prog { font-size:13px; color:var(--ink-2); }
  .actions .prog b { color:var(--ink); font-variant-numeric:tabular-nums; }
  .actions .grp { display:flex; gap:10px; }
  .btn-lg { padding:10px 20px; font-size:13.5px; }
  .btn-primary { background:var(--ink); color:#fff; border-color:var(--ink); }
  @media (prefers-color-scheme: dark) { .btn-primary { background:var(--accent); border-color:var(--accent); } }
  :root[data-theme="dark"] .btn-primary { background:var(--accent); border-color:var(--accent); }
  .btn-primary:hover { filter:brightness(1.08); }

  .datanote { font-size:11.5px; color:var(--ink-3); margin:8px 0 24px; line-height:1.5; border-top:1px solid var(--border); padding-top:14px; }
  .datanote b { color:var(--warn); }

  @media (max-width:680px) { .tiles { grid-template-columns:repeat(2,1fr); } .trow { grid-template-columns:1fr; } .reassign-row { grid-template-columns:1fr; } .pform { grid-template-columns:1fr; } .who .tz { display:none; } .brand .sub { display:none; } }

  /* Preview-email modal */
  .emodal { position:fixed; inset:0; z-index:50; display:flex; align-items:flex-start; justify-content:center; }
  .emodal[hidden] { display:none; }
  .emodal-backdrop { position:absolute; inset:0; background:rgba(6,12,24,.55); -webkit-backdrop-filter:blur(2px); backdrop-filter:blur(2px); }
  .emodal-sheet { position:relative; margin:38px 16px; width:680px; max-width:calc(100% - 32px); max-height:calc(100vh - 76px); background:var(--surface); border-radius:14px; box-shadow:0 24px 70px rgba(0,0,0,.45); display:flex; flex-direction:column; overflow:hidden; }
  .emodal-bar { display:flex; align-items:center; justify-content:space-between; padding:12px 16px; border-bottom:1px solid var(--border); background:var(--surface-2); }
  .emodal-title { font-size:13px; font-weight:700; color:var(--ink); }
  .emodal-title span { color:var(--ink-3); font-weight:500; }
  .emodal-x { border:0; background:transparent; color:var(--ink-3); font-size:15px; cursor:pointer; padding:5px 9px; border-radius:6px; line-height:1; }
  .emodal-x:hover { background:var(--border); color:var(--ink); }
  .emodal-scroll { overflow-y:auto; padding:22px; background:#e9ecf1; }

  /* the email itself renders LIGHT regardless of theme — that's how the client sees it */
  .email-frame { max-width:600px; margin:0 auto; background:#ffffff; color:#3d4d63; border-radius:8px; overflow:hidden; box-shadow:0 2px 10px rgba(0,0,0,.14); }
  .email-frame .ef-topbar { height:6px; background:#ff3743; }
  .email-frame .ef-body { padding:26px 30px 8px; }
  .email-frame .ef-greet { font-size:15px; color:#243b53; margin:0 0 18px; }
  .email-frame .ef-sec { margin:0 0 26px; }
  .email-frame .ef-sec h3 { font-size:18px; color:#0d1f3d; margin:0 0 13px; line-height:1.3; font-weight:700; }
  .email-frame .ef-sec img { width:100%; height:auto; border-radius:6px; margin:0 0 15px; display:block; }
  .email-frame .ef-sec p { font-size:14px; line-height:1.62; color:#3d4d63; margin:0 0 12px; }
  .email-frame .ef-sec p:last-child { margin-bottom:0; }
  .email-frame .ef-cta { text-align:center; margin:20px 0 4px; }
  .email-frame .ef-cta a { display:inline-block; background:#ff3743; color:#fff; text-decoration:none; padding:11px 24px; border-radius:6px; font-weight:700; font-size:14px; }
  .email-frame .ef-sig { padding:6px 30px 22px; }
  .email-frame .ef-foot { padding:16px 30px 22px; border-top:1px solid #edf0f4; font-size:11px; color:#8595a8; line-height:1.55; }
  .email-frame .ef-missing { font-size:13px; color:#9aa7b8; font-style:italic; }
  .email-frame .ef-masthead { text-align:center; background:#ffffff; }
  .email-frame .ef-logo { width:190px; max-width:62%; height:auto; margin:26px auto 16px; display:block; }
  .email-frame .ef-hero { width:100%; height:auto; display:block; }
  .email-frame .ef-intro { margin:0 0 24px; }
  .email-frame .ef-intro p { font-size:14px; line-height:1.62; color:#243b53; margin:0 0 12px; }
  .email-frame .ef-intro p:last-child { margin-bottom:0; }
  .email-frame .ef-foot p { margin:0 0 10px; }
  .email-frame .ef-foot p:last-child { margin:0; }
  .email-frame .ef-foot a { color:#8595a8; text-decoration:underline; }

  /* Confirm-&-submit review screen */
  .cmodal-sheet { width:800px; }
  .cmodal-scroll { flex:1 1 auto; min-height:0; padding:20px 22px; background:var(--surface); }
  .csum-head { font-size:13.5px; color:var(--ink-2); margin:0 0 14px; line-height:1.5; }
  .csum-head b { color:var(--ink); }
  .csum-list { display:flex; flex-direction:column; gap:8px; }
  .csum-row { display:grid; grid-template-columns:1fr auto; gap:4px 14px; padding:10px 13px; border:1px solid var(--border); border-radius:8px; background:var(--surface-2); }
  .csum-row .cn { font-weight:600; font-size:13.5px; color:var(--ink); }
  .csum-row .cw { font-size:12.5px; font-weight:700; white-space:nowrap; text-align:right; }
  .csum-row .cw .cd { color:var(--ink-3); font-weight:500; }
  .csum-row .ctopics { grid-column:1 / -1; font-size:12px; color:var(--ink-2); }
  .csum-held { margin-top:14px; padding:11px 13px; border-radius:8px; background:var(--surface-2); border:1px dashed var(--border-strong); font-size:12.5px; color:var(--ink-3); line-height:1.5; }
  .csum-held b { color:var(--ink-2); }
  .csum-final { margin-top:14px; font-size:13px; color:var(--ink); background:var(--warn-weak); border:1px solid var(--warn); border-radius:8px; padding:11px 13px; line-height:1.5; }
  .cmodal-foot { display:flex; justify-content:flex-end; gap:10px; padding:13px 22px; border-top:1px solid var(--border); background:var(--surface-2); flex:none; }
  .csum-done { text-align:center; padding:34px 20px; }
  .csum-done .big { font-size:40px; line-height:1; }
  .csum-done h3 { margin:12px 0 5px; font-size:17px; color:var(--ink); }
  .csum-done p { margin:0; color:var(--ink-2); font-size:13.5px; line-height:1.5; }

  /* ---------------------------------------------------------------- auth screens
     Added for the live portal (the mockup had no login). Uses the same tokens so
     the sign-in page and the review screen read as one product. */
  .authwrap { min-height:calc(100vh - 60px); display:flex; align-items:flex-start; justify-content:center; padding:clamp(28px,9vh,80px) 20px 40px; }
  .authcard { width:100%; max-width:430px; background:var(--surface); border:1px solid var(--border); border-radius:14px; box-shadow:var(--shadow); padding:28px 30px 26px; }
  .authcard h1 { margin:0 0 6px; font-size:20px; font-weight:700; letter-spacing:-.02em; }
  .authcard .lede { margin:0 0 20px; font-size:13.5px; color:var(--ink-2); line-height:1.55; }
  .authcard .field { margin-bottom:16px; }
  .authcard label { font-size:12.5px; font-weight:600; color:var(--ink-2); margin-bottom:6px; display:block; }
  .authcard input[type="email"], .authcard input[type="text"] { font-family:inherit; font-size:15px; color:var(--ink); font-weight:500; background:var(--surface); border:1px solid var(--border-strong); border-radius:8px; padding:11px 13px; width:100%; }
  .authcard input:focus-visible { outline:2px solid var(--accent); outline-offset:2px; }
  .authcard .btn-lg { width:100%; text-align:center; }
  .code-input { font-family:var(--mono); font-size:26px !important; letter-spacing:.34em; text-align:center; padding:13px 10px !important; font-variant-numeric:tabular-nums; }
  .authfoot { margin:18px 0 0; padding-top:16px; border-top:1px solid var(--border); font-size:12px; color:var(--ink-3); line-height:1.55; }
  .authfoot a, .linkbtn { color:var(--accent); font-weight:600; text-decoration:none; background:none; border:0; padding:0; font-family:inherit; font-size:inherit; cursor:pointer; }
  .authfoot a:hover, .linkbtn:hover { text-decoration:underline; }
  .authmsg { border-radius:9px; padding:11px 13px; font-size:13px; line-height:1.5; margin:0 0 18px; border:1px solid transparent; }
  .authmsg.err { background:var(--crit-weak); color:var(--crit); border-color:color-mix(in srgb,var(--crit) 32%,transparent); font-weight:500; }
  .authmsg.ok { background:var(--good-weak); color:var(--good); border-color:color-mix(in srgb,var(--good) 32%,transparent); font-weight:500; }
  .authmsg.info { background:var(--accent-weak); color:var(--ink-2); border-color:var(--border); }
  .authmsg b { font-weight:700; }
  .sentto { font-family:var(--mono); font-size:12.5px; }
  .devbanner { background:var(--warn-weak); color:var(--warn); border-bottom:1px solid color-mix(in srgb,var(--warn) 35%,transparent); font-size:12px; font-weight:600; text-align:center; padding:7px 16px; }

  /* Per-client save confirmation — sits beside Mark reviewed, where the adviser
     is already looking, rather than only in the page-foot bar. */
  .cfoot .card-saved { margin-left:auto; align-self:center; }
  .cfoot .card-saved + .btn-mark { margin-left:10px; }

  /* Flag submission — a note an adviser writes must have somewhere to go. */
  .flagfoot { display:flex; align-items:center; gap:12px; justify-content:flex-end; margin-top:10px; }
  .flagmsg { font-size:12.5px; color:var(--good); font-weight:600; margin-right:auto; }
  .flagmsg.err { color:var(--crit); }
  .flag-btn.flagged { color:var(--warn); }
  .flag-btn.flagged svg { fill:currentColor; }

  /* Adviser FAQ (/faq) */
  .faq { max-width:760px; padding-top:22px; padding-bottom:48px; }
  .faq h1 { font-size:22px; margin:6px 0 4px; }
  .faq-lede { color:var(--ink-2); margin:0 0 18px; }
  .faq-back a, .rb-auto a { color:var(--accent); font-weight:600; text-decoration:none; }
  .faq-back a:hover, .rb-auto a:hover { text-decoration:underline; }
  .faq-sec { margin:0 0 18px; }
  .faq-sec h2 { font-size:15px; margin:0 0 6px; color:var(--ink); }
  .faq-item { border:1px solid var(--border); border-radius:10px; background:var(--surface); margin:0 0 6px; }
  .faq-item summary { cursor:pointer; padding:11px 14px; font-weight:600; font-size:14px; }
  .faq-item p { margin:0; padding:0 14px 12px; font-size:14px; line-height:1.55; color:var(--ink-2); }
