:root {
  /* 4You Accounting & Taxation (4you.net.au) */
  --brand: #c42a2a;
  --brand-strong: #a02020;
  --brand-soft: #fdf0f0;
  --brand-line: #f3c9c9;
  /* Neutral status colour (opened, view-only, notices) - kept apart from the brand red so it never reads as an error */
  --info: #1d4ed8;
  --info-soft: #eff4ff;
  --info-line: #c7d6fe;
  --bg: #f5f7fb;
  --surface: #ffffff;
  --surface-2: #f9fafc;
  --text: #111827;
  --text-2: #4b5563;
  --text-3: #6b7280;
  --line: #e4e7ee;
  --line-strong: #d1d6e0;
  --ok: #15803d;
  --ok-soft: #e8f6ed;
  --warn: #b45309;
  --warn-soft: #fdf3e2;
  --bad: #b91c1c;
  --bad-soft: #fdecec;
  --muted-soft: #eef0f4;
  --radius: 10px;
  --radius-sm: 7px;
  --shadow: 0 1px 2px rgb(16 24 40 / 5%), 0 1px 3px rgb(16 24 40 / 6%);
  --shadow-lg: 0 12px 32px rgb(16 24 40 / 14%);
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { margin: 0; line-height: 1.25; letter-spacing: -0.01em; }
h1 { font-size: 24px; font-weight: 650; }
h2 { font-size: 17px; font-weight: 620; }
h3 { font-size: 15px; font-weight: 600; }
p { margin: 0; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

.muted { color: var(--text-3); }
.small { font-size: 13px; }
.boot { padding: 80px; text-align: center; color: var(--text-3); }
.stack { display: flex; flex-direction: column; gap: 12px; }
.row { display: flex; align-items: center; gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.spacer { flex: 1; }

/* ---- shell ---- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.topbar-inner {
  max-width: 1200px; margin: 0 auto; padding: 0 24px;
  height: 60px; display: flex; align-items: center; gap: 24px;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 680; font-size: 16px; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand-logo { height: 36px; width: auto; display: block; flex: none; }
.brand-logo.big { height: 72px; margin: 0 auto 14px; }
.brand-product { padding-left: 12px; border-left: 1px solid var(--line); color: var(--text-2); font-weight: 620; font-size: 15px; line-height: 22px; }
.nav { display: flex; gap: 4px; }
.nav a {
  padding: 6px 12px; border-radius: var(--radius-sm); color: var(--text-2); font-weight: 520; font-size: 14px;
}
.nav a:hover { background: var(--surface-2); text-decoration: none; color: var(--text); }
.nav a.active { background: var(--brand-soft); color: var(--brand); }
.user-chip { display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--text-2); }
.avatar {
  width: 32px; height: 32px; border-radius: 50%; flex: none;
  display: grid; place-items: center;
  font-size: 12px; font-weight: 650; color: #fff; background: var(--brand);
}
main.page { max-width: 1200px; margin: 0 auto; padding: 28px 24px 64px; }
.page-head { display: flex; align-items: flex-end; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head .sub { color: var(--text-3); margin-top: 4px; font-size: 14px; }

/* ---- controls ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 38px; padding: 0 16px; border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong); background: var(--surface);
  font-weight: 560; font-size: 14px; cursor: pointer; white-space: nowrap;
  box-shadow: var(--shadow); text-decoration: none !important; color: var(--text);
}
.btn:hover { background: var(--surface-2); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-strong); }
.btn.danger { color: var(--bad); }
.btn.danger:hover { background: var(--bad-soft); }
.btn.ghost { border-color: transparent; box-shadow: none; background: transparent; color: var(--text-2); }
.btn.ghost:hover { background: var(--muted-soft); }
.btn.sm { height: 30px; padding: 0 10px; font-size: 13px; }
.btn.icon { width: 30px; padding: 0; }

label.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 560; color: var(--text-2); }
.input, select.input, textarea.input {
  width: 100%; height: 38px; padding: 0 12px;
  border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  background: var(--surface); font-size: 14px; color: var(--text);
}
textarea.input { height: auto; min-height: 96px; padding: 10px 12px; resize: vertical; }
.input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.hint { font-size: 12.5px; color: var(--text-3); font-weight: 400; }

.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
}
.card-pad { padding: 20px; }
.card-head { padding: 16px 20px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 12px; }

.badge {
  display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px;
  border-radius: 999px; font-size: 12.5px; font-weight: 600; white-space: nowrap;
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.neutral { background: var(--muted-soft); color: var(--text-2); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.bad { background: var(--bad-soft); color: var(--bad); }
.badge.muted { background: var(--muted-soft); color: var(--text-3); }
.badge.info { background: var(--info-soft); color: var(--info); }

.alert { padding: 12px 14px; border-radius: var(--radius-sm); font-size: 14px; border: 1px solid; }
.alert.warn { background: var(--warn-soft); border-color: #f5d9a8; color: #7c3d06; }
.alert.bad { background: var(--bad-soft); border-color: #f5c2c2; color: #7f1d1d; }
.alert.info { background: var(--info-soft); border-color: var(--info-line); color: var(--info); }

/* ---- auth ---- */
.auth-page { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.auth-card { width: 100%; max-width: 400px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-lg); padding: 32px; }
.auth-card h1 { font-size: 22px; text-align: center; }
.auth-card .lead { text-align: center; color: var(--text-3); margin: 6px 0 24px; font-size: 14px; }
.auth-card form { display: flex; flex-direction: column; gap: 14px; }
.auth-card .btn { height: 42px; margin-top: 4px; }
.auth-card .switch { text-align: center; font-size: 14px; color: var(--text-3); margin-top: 18px; }
.auth-card .connect-signin { width: 100%; justify-content: center; text-decoration: none; }
.auth-card .alert { margin-bottom: 14px; }
.or-divider { display: flex; align-items: center; gap: 10px; color: var(--text-3); font-size: 13px; margin: 6px 0 10px; }
.or-divider::before, .or-divider::after { content: ''; flex: 1; border-top: 1px solid var(--line); }
.thanks { text-align: center; }
.thanks p { color: var(--text-2); margin-top: 10px; }

/* ---- dashboard ---- */
.tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 22px; }
.tile { padding: 16px 18px; cursor: pointer; text-align: left; border: 1px solid var(--line); }
.tile:hover { border-color: var(--brand-line); }
.tile.active { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.tile .label { font-size: 13px; color: var(--text-3); font-weight: 520; }
.tile .value { font-size: 28px; font-weight: 680; margin-top: 4px; font-variant-numeric: tabular-nums; }
.toolbar { display: flex; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.tabs { display: flex; gap: 4px; flex-wrap: wrap; }
.tab { border: 0; background: none; padding: 6px 12px; border-radius: var(--radius-sm); cursor: pointer; font-size: 14px; color: var(--text-2); font-weight: 520; }
.tab:hover { background: var(--muted-soft); }
.tab.active { background: var(--brand-soft); color: var(--brand); }
.search { max-width: 280px; margin-left: auto; }
table.list { width: 100%; border-collapse: collapse; }
table.list th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-3); font-weight: 600; padding: 10px 16px; background: var(--surface-2); border-bottom: 1px solid var(--line); }
table.list td { padding: 14px 16px; border-bottom: 1px solid var(--line); font-size: 14px; vertical-align: middle; }
table.list tr:last-child td { border-bottom: 0; }
table.list tbody tr { cursor: pointer; }
table.list tbody tr:hover td { background: var(--surface-2); }
.doc-title { font-weight: 580; color: var(--text); }
.doc-sub { font-size: 13px; color: var(--text-3); margin-top: 2px; max-width: 420px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.progress { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.bar { width: 72px; height: 6px; border-radius: 3px; background: var(--muted-soft); overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--ok); border-radius: 3px; }
.empty { padding: 56px 24px; text-align: center; color: var(--text-3); }
.empty h3 { color: var(--text); margin-bottom: 6px; }
.empty .btn { margin-top: 16px; }

/* ---- wizard ---- */
.steps { display: flex; gap: 8px; margin-bottom: 22px; flex-wrap: wrap; }
.step { display: flex; align-items: center; gap: 8px; padding: 6px 14px 6px 6px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); font-size: 14px; color: var(--text-3); font-weight: 540; }
.step .num { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: var(--muted-soft); font-size: 12px; font-weight: 650; }
.step.active { border-color: var(--brand); color: var(--brand); }
.step.active .num { background: var(--brand); color: #fff; }
.step.done { color: var(--text-2); }
.step.done .num { background: var(--ok-soft); color: var(--ok); }
.wizard-foot { display: flex; gap: 10px; margin-top: 20px; align-items: center; }

.dropzone {
  border: 2px dashed var(--line-strong); border-radius: var(--radius); padding: 48px 24px;
  text-align: center; background: var(--surface-2); cursor: pointer; transition: border-color .15s, background .15s;
}
.dropzone:hover, .dropzone.over { border-color: var(--brand); background: var(--brand-soft); }
.dropzone h3 { margin-bottom: 4px; }
.file-card { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface-2); }
.file-icon { width: 40px; height: 48px; border-radius: 6px; background: var(--bad-soft); color: var(--bad); display: grid; place-items: center; font-size: 11px; font-weight: 700; flex: none; }

.recipient-row { display: grid; grid-template-columns: 28px 1fr 1.3fr 190px auto; gap: 10px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.recipient-row:last-child { border-bottom: 0; }
.order-num { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 650; color: #fff; }
.toggle { display: inline-flex; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); overflow: hidden; }
.toggle button { border: 0; background: var(--surface); padding: 7px 14px; cursor: pointer; font-size: 13.5px; font-weight: 540; color: var(--text-2); }
.toggle button + button { border-left: 1px solid var(--line-strong); }
.toggle button.on { background: var(--brand-soft); color: var(--brand); }

/* ---- field editor ---- */
.editor { display: grid; grid-template-columns: 270px 1fr; gap: 20px; align-items: start; }
.editor-side { position: sticky; top: 80px; display: flex; flex-direction: column; gap: 14px; }
.side-title { font-size: 12px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-3); font-weight: 620; margin-bottom: 8px; }
.pick { display: flex; flex-direction: column; gap: 6px; }
.pick button {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
  border: 1px solid var(--line); background: var(--surface); border-radius: var(--radius-sm);
  padding: 8px 10px; cursor: pointer; font-size: 14px;
}
.pick button:hover { border-color: var(--line-strong); }
.pick button.on { border-color: var(--brand); box-shadow: 0 0 0 2px var(--brand-soft); }
.pick .dot { width: 12px; height: 12px; border-radius: 50%; flex: none; }
.pick .count { margin-left: auto; font-size: 12px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.pick .warnflag { margin-left: auto; font-size: 11.5px; color: var(--warn); font-weight: 600; }
.pages { display: flex; flex-direction: column; gap: 18px; align-items: center; }
.page-wrap { position: relative; box-shadow: var(--shadow-lg); background: #fff; border-radius: 2px; }
.page-wrap canvas { display: block; }
.page-label { font-size: 12px; color: var(--text-3); margin-bottom: -10px; }
.overlay { position: absolute; inset: 0; cursor: crosshair; }
.pfield {
  position: absolute; border: 2px solid var(--c); background: color-mix(in srgb, var(--c) 14%, transparent);
  border-radius: 4px; cursor: move; user-select: none; touch-action: none;
  display: flex; align-items: center; justify-content: center; overflow: hidden;
  font-size: 12px; font-weight: 650; color: var(--c);
}
.pfield .who { position: absolute; left: 4px; top: 1px; font-size: 10px; font-weight: 600; opacity: 0.85; }
.pfield .del {
  position: absolute; top: 2px; right: 2px; width: 18px; height: 18px; border-radius: 4px; border: 0;
  background: var(--c); color: #fff; font-size: 12px; line-height: 18px; cursor: pointer; padding: 0; display: none;
}
.pfield:hover .del, .pfield.sel .del { display: block; }
.pfield .grip { position: absolute; right: 0; bottom: 0; width: 12px; height: 12px; cursor: nwse-resize; background: linear-gradient(135deg, transparent 50%, var(--c) 50%); }
.pfield.sel { box-shadow: 0 0 0 3px color-mix(in srgb, var(--c) 30%, transparent); }

/* ---- document detail ---- */
.detail { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 20px; align-items: start; }
.recipient { display: flex; align-items: center; gap: 12px; padding: 14px 20px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.recipient:last-child { border-bottom: 0; }
.recipient .who { min-width: 0; flex: 1; }
.recipient .name { font-weight: 580; }
.recipient .email { font-size: 13px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; }
.recipient .actions { display: flex; gap: 6px; }
.meta-list { display: grid; grid-template-columns: 110px 1fr; gap: 8px 12px; font-size: 14px; }
.meta-list dt { color: var(--text-3); }
.meta-list dd { margin: 0; overflow-wrap: anywhere; }
.timeline { list-style: none; margin: 0; padding: 16px 20px; }
.timeline li { position: relative; padding: 0 0 16px 22px; font-size: 14px; }
.timeline li::before { content: ""; position: absolute; left: 4px; top: 7px; width: 8px; height: 8px; border-radius: 50%; background: var(--line-strong); }
.timeline li::after { content: ""; position: absolute; left: 7.5px; top: 18px; bottom: 0; width: 1px; background: var(--line); }
.timeline li:last-child { padding-bottom: 0; }
.timeline li:last-child::after { display: none; }
.timeline li.completed::before, .timeline li.signed::before { background: var(--ok); }
.timeline li.rejected::before, .timeline li.cancelled::before { background: var(--bad); }
.timeline li.pending::before { background: var(--brand); }
.timeline time { display: block; font-size: 12.5px; color: var(--text-3); }

dialog { border: 0; border-radius: 14px; padding: 0; box-shadow: var(--shadow-lg); width: min(440px, calc(100vw - 32px)); }
dialog::backdrop { background: rgb(17 24 39 / 40%); }
dialog .dlg-body { padding: 22px; display: flex; flex-direction: column; gap: 12px; }
dialog .dlg-foot { padding: 14px 22px; background: var(--surface-2); display: flex; justify-content: flex-end; gap: 10px; border-top: 1px solid var(--line); }
/* Email preview */
dialog.email-dialog { width: min(720px, calc(100vw - 32px)); max-height: calc(100vh - 48px); }
dialog.email-dialog .dlg-body { max-height: calc(100vh - 140px); overflow: auto; }
.email-tabs { display: flex; flex-wrap: wrap; gap: 6px; }
.email-tab { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 5px 12px; font: inherit; font-size: 13.5px; cursor: pointer; color: var(--text-2); }
.email-tab[aria-selected="true"] { background: var(--brand-soft); border-color: var(--brand-line); color: var(--brand-strong); font-weight: 600; }
.email-meta { display: grid; gap: 4px; font-size: 14px; padding: 10px 12px; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm); }
.email-meta .muted { display: inline-block; width: 64px; }
.email-frame { width: 100%; border: 1px solid var(--line); border-radius: var(--radius-sm); background: #f5f7fb; }

#toasts { position: fixed; bottom: 20px; right: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 100; }
.toast { background: var(--text); color: #fff; padding: 11px 16px; border-radius: var(--radius-sm); box-shadow: var(--shadow-lg); font-size: 14px; max-width: 380px; animation: pop .18s ease-out; }
.toast.bad { background: var(--bad); }
.toast.ok { background: var(--ok); }
@keyframes pop { from { transform: translateY(8px); opacity: 0; } }

@media (max-width: 900px) {
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .detail, .editor { grid-template-columns: 1fr; }
  .editor-side { position: static; }
  .recipient-row { grid-template-columns: 28px 1fr; }
  .recipient-row > :nth-child(n + 3) { grid-column: 2; }
  .search { max-width: none; margin-left: 0; width: 100%; }
  .nav { display: none; }
  table.list .hide-sm { display: none; }
}
.btn.primary.danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn.primary.danger:hover { background: #991b1b; }

/* ---- packs ---- */
.doc-tabs { display: flex; gap: 8px; flex-wrap: wrap; }
.doc-tabs:empty { display: none; }
.doc-tab {
  display: flex; align-items: center; gap: 8px; max-width: 280px;
  border: 1px solid var(--line); background: var(--surface); border-radius: var(--radius-sm);
  padding: 7px 12px 7px 7px; cursor: pointer; font-size: 13.5px; font-weight: 540; color: var(--text-2);
}
.doc-tab:hover { border-color: var(--line-strong); }
.doc-tab.on { border-color: var(--brand); color: var(--brand); box-shadow: 0 0 0 2px var(--brand-soft); }
.doc-tab-num { width: 22px; height: 22px; border-radius: 6px; display: grid; place-items: center; background: var(--muted-soft); font-size: 12px; font-weight: 650; flex: none; }
.doc-tab.on .doc-tab-num { background: var(--brand); color: #fff; }
.doc-tab-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc-tab .count { font-size: 12px; color: var(--text-3); font-weight: 450; white-space: nowrap; }
.file-list { margin: 16px 0 0; padding: 14px 0 0; border-top: 1px solid var(--line); list-style: none; counter-reset: f; display: flex; flex-direction: column; gap: 8px; }
.file-list li { counter-increment: f; display: flex; gap: 8px; align-items: baseline; font-size: 14px; }
.file-list li::before { content: counter(f) "."; color: var(--text-3); font-variant-numeric: tabular-nums; }
.file-list .name { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.pack-chip { display: inline-block; margin-right: 6px; padding: 0 7px; border-radius: 999px; background: var(--brand-soft); color: var(--brand); font-size: 11.5px; font-weight: 620; line-height: 18px; }
.file-icon.small-icon { width: 32px; height: 38px; font-size: 13px; }

/* ---- recipient signing page ---- */
body.signer .signer-page { padding-bottom: 210px; max-width: 980px; }
.signer-note { margin-bottom: 16px; white-space: pre-wrap; }
.signer-message .auth-card p { margin-top: 10px; }
.status-dot { width: 48px; height: 48px; border-radius: 50%; margin: 0 auto 16px; background: var(--brand-soft); position: relative; }
.status-dot::after { content: ""; position: absolute; inset: 16px; border-radius: 50%; background: var(--brand); }
.status-dot.ok { background: var(--ok-soft); } .status-dot.ok::after { background: var(--ok); }
.status-dot.bad { background: var(--bad-soft); } .status-dot.bad::after { background: var(--bad); }
.status-dot.muted { background: var(--muted-soft); } .status-dot.muted::after { background: var(--text-3); }
.code-input { height: 52px; font-size: 26px; letter-spacing: 0.4em; text-align: center; font-variant-numeric: tabular-nums; }
.signer-overlay { cursor: default; }
.sfield {
  position: absolute; display: flex; align-items: center; justify-content: center; overflow: hidden;
  border: 2px dashed #d97706; background: rgb(254 243 199 / 75%); border-radius: 4px;
  font-size: 12px; font-weight: 650; color: #92400e; padding: 0; margin: 0;
}
.sfield.action { cursor: pointer; font-family: inherit; }
.sfield.action:hover { background: rgb(253 230 138 / 85%); }
.sfield.done { border: 1.5px solid var(--ok); background: rgb(232 246 237 / 55%); color: var(--ok); }
.sfield.auto { border-style: solid; border-color: var(--line-strong); background: rgb(249 250 252 / 85%); color: var(--text-2); font-weight: 500; }
.sfield img { max-width: 100%; max-height: 100%; object-fit: contain; }
.sfield span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 0 4px; }
.sfield-input { width: 100%; height: 100%; border: 0; background: transparent; padding: 0 6px; font: inherit; font-weight: 500; color: var(--text); font-size: clamp(10px, 1.6vw, 14px); }
.sfield-input:focus { outline: none; }
.sfield:focus-within { box-shadow: 0 0 0 3px var(--brand-soft); border-color: var(--brand); }
.sfield.pulse { animation: pulse 0.6s ease-in-out 2; }
@keyframes pulse { 50% { box-shadow: 0 0 0 6px rgb(217 119 6 / 35%); } }
.sign-bar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; background: var(--surface); border-top: 1px solid var(--line); box-shadow: 0 -8px 24px rgb(16 24 40 / 8%); }
.sign-bar-inner { max-width: 980px; margin: 0 auto; padding: 14px 24px; display: flex; flex-direction: column; gap: 10px; }
.progress-text { font-size: 14px; font-weight: 560; }
.consent { display: flex; gap: 10px; align-items: flex-start; font-size: 13.5px; color: var(--text-2); cursor: pointer; }
.consent input { width: 18px; height: 18px; margin-top: 1px; flex: none; accent-color: var(--brand); }
.pad-dialog { width: min(680px, calc(100vw - 24px)); }
.pad-wrap { position: relative; width: 100%; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: #fff; }
.pad-wrap canvas { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; cursor: crosshair; }
.pad-wrap canvas.typing { cursor: default; }
.pad-line { position: absolute; left: 6%; right: 6%; bottom: 22%; border-bottom: 1px dashed var(--line-strong); pointer-events: none; }
@media (max-width: 640px) {
  body.signer .signer-page { padding: 18px 12px 260px; }
  .sign-bar-inner { padding: 12px; }
}

/* ---- identity checks ---- */
.recipient-row .identity { grid-column: 2 / -1; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: -2px; }
.identity-label { font-size: 12.5px; color: var(--text-3); font-weight: 520; }
.input.sm, select.input.sm { height: 32px; font-size: 13px; width: auto; min-width: 200px; }

[hidden] { display: none !important; }
body.signer #toasts { bottom: auto; top: 76px; }

/* ---- due dates, tags, review ---- */
.tile.alert-tile .value { color: var(--bad); }
.tile.attention { border-color: var(--brand); }
.tiles .tile .label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tag-bar { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; padding: 10px 16px; border-bottom: 1px solid var(--line); }
.tag-bar:empty { display: none; }
.tag { display: inline-flex; align-items: center; height: 22px; padding: 0 9px; border-radius: 999px; border: 1px solid var(--line-strong); background: var(--surface); font-size: 12px; font-weight: 560; color: var(--text-2); cursor: default; }
button.tag { cursor: pointer; }
button.tag:hover { border-color: var(--brand); color: var(--brand); }
.tag.on { background: var(--brand); border-color: var(--brand); color: #fff; }
.row-meta { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin-top: 6px; }
.due { font-size: 12px; color: var(--text-3); font-weight: 560; }
.due.overdue { color: var(--bad); }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; color: var(--text-2); cursor: pointer; }
.check input { width: 17px; height: 17px; margin-top: 2px; flex: none; accent-color: var(--brand); }
.link-btn { border: 0; background: none; padding: 0 0 0 8px; color: var(--brand); font-size: 13px; cursor: pointer; font-weight: 560; }
.link-btn:hover { text-decoration: underline; }
.review-banner { display: flex; gap: 14px; align-items: center; justify-content: space-between; flex-wrap: wrap; margin-bottom: 16px; }
.alert.warn, .alert.info { margin-bottom: 16px; }
.step-select { min-width: 96px !important; }

/* ---- 4You Connect lookup ---- */
.connect-pad { border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 10px; }
.connect-search { position: relative; }
.connect-results { position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 15; background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--radius-sm); box-shadow: var(--shadow-lg); max-height: 320px; overflow: auto; }
.connect-hit { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; width: 100%; text-align: left; border: 0; border-bottom: 1px solid var(--line); background: none; padding: 10px 12px; cursor: pointer; }
.connect-hit:last-child { border-bottom: 0; }
.connect-hit:hover, .connect-hit:focus { background: var(--brand-soft); outline: none; }
.connect-hit .name { font-weight: 580; font-size: 14px; }
.connect-hit .small { grid-column: 1; }
.connect-hit .badge { grid-column: 2; grid-row: 1 / span 2; align-self: center; }
.connect-empty { padding: 12px; }
.connect-spouse { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 0; }

/* ---- tax returns ---- */
.tax-chip { display: inline-flex; gap: 8px; align-items: center; margin-top: 6px; padding: 3px 10px 3px 3px; border-radius: 999px; background: var(--ok-soft); color: #14532d; font-size: 12.5px; font-weight: 520; }
.tax-chip-label { background: var(--ok); color: #fff; border-radius: 999px; padding: 1px 8px; font-size: 11.5px; font-weight: 650; }
.tax-place { width: 100%; }

/* ---- whole-document signing ---- */
.doc-banner { width: 100%; max-width: 900px; margin: 0; }
.whole-banner { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; justify-content: space-between; }
.sfield.whole-sign { position: static; width: 240px; height: 64px; flex: none; background: #fff; }

/* ===================== dashboard (table view) ===================== */
main.page:has(.dash), main.page:has(.compose) { max-width: 1440px; }
.dash { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 24px; align-items: start; }
.views { position: sticky; top: 80px; display: flex; flex-direction: column; gap: 2px; }
.views-title { font-size: 12px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-3); font-weight: 620; margin: 4px 10px 8px; }
.dash-view { display: flex; justify-content: space-between; align-items: center; border: 0; background: none; padding: 8px 10px; border-radius: var(--radius-sm); font-size: 14px; font-weight: 540; color: var(--text-2); cursor: pointer; text-align: left; }
.dash-view:hover { background: var(--muted-soft); }
.dash-view.on { background: var(--brand-soft); color: var(--brand); }
.dash-view .n { font-size: 12px; font-variant-numeric: tabular-nums; color: var(--text-3); background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 0 7px; min-width: 22px; text-align: center; }
.dash-view.alert .n { background: var(--bad); border-color: var(--bad); color: #fff; }
.dash-view.on .n { border-color: var(--brand-line); }
.toolbar .input[type=search] { max-width: 360px; }
.check.mine { margin-left: auto; align-items: center; font-size: 13.5px; }
.table-wrap { overflow-x: auto; }
table.list.dense td { padding: 9px 12px; font-size: 13.5px; }
table.list.dense th { padding: 9px 12px; white-space: nowrap; }
table.list .col-menu { width: 40px; padding-left: 8px; padding-right: 0; }
.col-subject { min-width: 260px; }
.col-subject .doc-title { font-weight: 560; }
.col-recipients { min-width: 200px; }
.nowrap { white-space: nowrap; }
tr.is-overdue td { background: color-mix(in srgb, var(--bad-soft) 45%, transparent); }
.overdue-icon { color: var(--warn); margin-right: 6px; }
.overdue-text { color: var(--bad); font-weight: 560; }
.sort { border: 0; background: none; padding: 0; font: inherit; color: inherit; text-transform: inherit; letter-spacing: inherit; cursor: pointer; }
.sort.on { color: var(--brand); }
.chips { display: flex; gap: 4px; flex-wrap: wrap; }
.chip { display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 8px; border-radius: 999px; font-size: 12px; font-weight: 560; white-space: nowrap; border: 1px solid transparent; }
.chip-icon { font-size: 10.5px; }
.chip.signed { background: var(--ok-soft); color: var(--ok); border-color: #b9e2c7; }
.chip.waiting { background: var(--warn-soft); color: var(--warn); border-color: #f2d6a8; }
.chip.opened { background: var(--info-soft); color: var(--info); border-color: var(--info-line); }
.chip.queued { background: var(--muted-soft); color: var(--text-3); }
.chip.declined { background: var(--bad-soft); color: var(--bad); border-color: #f2c1c1; }
.chip.copy { background: var(--surface); color: var(--text-3); border-color: var(--line); }
.chip.owner { background: var(--surface-2); color: var(--text-2); border-color: var(--line); }
.menu-wrap { position: relative; }
.row-menu { position: absolute; left: 0; top: 30px; z-index: 20; background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--radius-sm); box-shadow: var(--shadow-lg); min-width: 170px; padding: 4px; }
.row-menu button { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 8px 10px; border-radius: 6px; font-size: 13.5px; cursor: pointer; }
.row-menu button:hover { background: var(--brand-soft); color: var(--brand); }
@media (max-width: 900px) {
  .dash { grid-template-columns: 1fr; }
  .views { position: static; flex-direction: row; overflow-x: auto; }
  .views-title { display: none; }
  .dash-view { white-space: nowrap; gap: 8px; }
}

/* ===================== new request (all on one screen) ===================== */
.compose-top { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 20px; margin-bottom: 20px; }
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; }
.compose-docs { margin-bottom: 90px; }
.legend { font-size: 12.5px; color: var(--text-3); }
.legend b { font-weight: 650; padding: 0 5px; border-radius: 4px; }
.legend b.lg-none { background: var(--muted-soft); color: var(--text-2); }
.legend b.dash-view { background: var(--brand-soft); color: var(--brand); }
.legend b.lg-sign { background: var(--ok); color: #fff; }
.matrix-wrap { overflow-x: auto; padding: 16px 20px 4px; }
.matrix { display: grid; align-items: stretch; min-width: max-content; }
.mx { padding: 8px; display: flex; align-items: center; gap: 10px; min-width: 0; }
.mx.g0 { background: color-mix(in srgb, var(--brand-soft) 70%, transparent); }
.mx.g1 { background: color-mix(in srgb, var(--ok-soft) 70%, transparent); }
.mx-group { border-radius: 10px 10px 0 0; font-size: 12px; font-weight: 650; color: var(--text-2); text-transform: uppercase; letter-spacing: 0.04em; justify-content: space-between; padding: 8px 12px; }
.mx-corner { align-items: flex-end; padding-left: 0; }
.mx-card { align-items: stretch; }
.rcard { width: 100%; background: var(--surface); border: 1px solid var(--line); border-top: 3px solid var(--c); border-radius: 8px; padding: 6px 10px 10px; box-shadow: var(--shadow); min-width: 0; }
.rcard-top { display: flex; align-items: center; gap: 2px; justify-content: flex-end; margin-bottom: -4px; }
.rcard-top .dot { width: 10px; height: 10px; border-radius: 50%; margin-right: auto; }
.rcard-name { font-weight: 620; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rcard-line { font-size: 12px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rcard-check { font-size: 11.5px; margin-top: 6px; color: var(--text-2); font-weight: 540; }
.mx-add, .mx-addgroup { justify-content: center; }
.add-btn { display: flex; flex-direction: column; align-items: center; gap: 4px; border: 0; background: none; color: var(--brand); font-size: 12.5px; font-weight: 600; cursor: pointer; padding: 8px; border-radius: 8px; }
.add-btn:hover { background: var(--surface); }
.add-btn .plus { width: 34px; height: 34px; border-radius: 50%; background: var(--brand); color: #fff; display: grid; place-items: center; font-size: 20px; line-height: 1; }
.add-btn.ghosty { border: 1px dashed var(--line-strong); color: var(--text-2); }
.add-btn.ghosty .plus { background: var(--muted-soft); color: var(--text-2); font-size: 16px; }
.mx-doc { border-top: 1px solid var(--line); background: var(--surface); padding: 12px 12px 12px 0; }
.mx-doc-main { min-width: 0; flex: 1; }
.mx-doc-main .doc-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mx-doc-actions { display: flex; gap: 4px; }
.mx-toggle, .mx-pad { border-top: 1px solid var(--line); flex-direction: column; justify-content: center; gap: 4px; }
.seg { display: inline-flex; border: 1px solid var(--line-strong); border-radius: 7px; overflow: hidden; background: var(--surface); }
.seg button { border: 0; background: none; padding: 6px 9px; font-size: 11.5px; font-weight: 650; letter-spacing: 0.03em; color: var(--text-3); cursor: pointer; }
.seg button + button { border-left: 1px solid var(--line); }
.seg button:hover { background: var(--surface-2); color: var(--text); }
.seg button.none.on { background: #334155; color: #fff; }
.seg button.dash-view.on { background: var(--brand); color: #fff; }
.seg button.sign.on { background: var(--ok); color: #fff; }
.seg-note { font-size: 11px; color: var(--text-3); }
.dropzone.compact { padding: 18px; display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; }
.compose-foot { position: fixed; left: 0; right: 0; bottom: 0; z-index: 25; background: var(--surface); border-top: 1px solid var(--line); box-shadow: 0 -8px 24px rgb(16 24 40 / 8%); display: flex; gap: 10px; align-items: center; padding: 12px max(24px, calc((100vw - 1440px) / 2 + 24px)); }
.foot-hint { max-width: 420px; text-align: right; }
.foot-hint.ok { color: var(--ok); }
.recipient-dialog { width: min(520px, calc(100vw - 24px)); overflow: visible; }
.recipient-dialog .connect-results { max-height: 260px; }
.field-editor { position: fixed; inset: 0; z-index: 60; background: var(--bg); display: flex; flex-direction: column; }
.fe-head { display: flex; align-items: center; gap: 16px; padding: 14px 24px; background: var(--surface); border-bottom: 1px solid var(--line); }
.fe-body { flex: 1; overflow: auto; padding: 20px 24px 40px; }
.fe-body .editor { max-width: 1240px; margin: 0 auto; }
.fe-body .editor-side { top: 0; }
@media (max-width: 900px) {
  .compose-top, .settings-grid { grid-template-columns: 1fr; }
  .compose-foot { padding: 10px 12px; flex-wrap: wrap; }
  .foot-hint { order: -1; width: 100%; text-align: left; }
}

.tag { white-space: nowrap; }
details.preview { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 8px 12px; background: var(--surface-2); }
details.preview summary { cursor: pointer; font-size: 13px; font-weight: 560; color: var(--brand); }
.preview-item { margin-top: 10px; }
.preview-item p { white-space: pre-wrap; font-size: 13.5px; color: var(--text-2); }

.settings-grid.three { grid-template-columns: 1fr 1fr 1fr; }
.template-picker { width: auto; min-width: 200px; }
.place-tools .btn { width: 100%; }
.place-tools .input.sm { width: 100%; }
.empty.small { padding: 18px; font-size: 13.5px; }
@media (max-width: 900px) { .settings-grid.three { grid-template-columns: 1fr; } }

/* ---- per-document status on the request page ---- */
.docrow { border-bottom: 1px solid var(--line); padding: 14px 20px; }
.docrow:last-child { border-bottom: 0; }
.docrow-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.docrow-head .who { flex: 1; min-width: 0; }
.docrow-head .name { font-weight: 580; overflow-wrap: anywhere; }
.docrow-head .email { font-size: 13px; color: var(--text-3); }
.docrow-head .actions { display: flex; gap: 6px; }
.docrow-people { margin: 10px 0 0 44px; display: flex; flex-direction: column; gap: 6px; }
.person { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 13.5px; }
.person-name { font-weight: 560; min-width: 140px; }
.role-tag { font-size: 11px; font-weight: 650; text-transform: uppercase; letter-spacing: 0.04em; padding: 2px 7px; border-radius: 5px; min-width: 52px; text-align: center; }
.role-tag.sign { background: var(--ok); color: #fff; }
.role-tag.view { background: var(--info-soft); color: var(--info); }
.hidden-from { margin-top: 2px; }
@media (max-width: 640px) { .docrow-people { margin-left: 0; } .person-name { min-width: 0; } }

.warn-text { color: var(--warn); font-weight: 560; }
