:root {
  color-scheme: light;
  --bg: #f3efe8;
  --ink: #1c1915;
  --muted: #6d675f;
  --line: #e4ddd2;
  --paper: #fffcf8;
  --card: #fff;
  --green: #1c6b45;
  --bad: #8d3d34;
  --wait: #8a6a1f;
  --shadow: 0 18px 50px rgba(48, 36, 18, 0.06);
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--bg);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  line-height: 1.5;
}

a { color: inherit; }

:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

.top {
  position: sticky;
  top: 0;
  z-index: 20;
  padding: 0.65rem 1.25rem;
  background: rgba(255, 252, 248, 0.92);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(10px);
}

.top .quiet { font-size: 0.85rem; white-space: nowrap; }

.mark {
  font-weight: 600;
  letter-spacing: -0.04em;
  text-decoration: none;
  font-size: 1.05rem;
}

.site-shell {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: min(1180px, 100%);
  margin: 0 auto;
}

.site-shell__bar,
.site-shell__panel,
.main-nav,
.nav-group {
  display: flex;
  align-items: center;
}

.site-shell__bar { flex: 0 0 auto; }

.site-shell__panel {
  flex: 1 1 auto;
  justify-content: space-between;
  gap: 0.7rem;
  min-width: 0;
}

.main-nav { gap: 0.2rem; }

.main-nav > a,
.nav-group a,
.who-name {
  border-radius: 7px;
  text-decoration: none;
}

.main-nav > a,
.nav-group a {
  display: inline-flex;
  align-items: center;
  min-height: 2.25rem;
  padding: 0.35rem 0.52rem;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 650;
}

.main-nav a:hover,
.main-nav a[aria-current="page"],
.who-name:hover,
.who-name[aria-current="page"] {
  color: var(--ink);
  background: rgba(138, 111, 62, 0.09);
}

.main-nav a[aria-current="page"],
.who-name[aria-current="page"] { box-shadow: inset 0 -2px 0 #8a6f3e; }

.nav-group {
  gap: 0.05rem;
  margin: 0 0.25rem;
  padding: 0.15rem;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.5);
}

.nav-group__label {
  padding: 0 0.45rem 0 0.35rem;
  color: var(--muted);
  font-size: 0.65rem;
  font-weight: 750;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.nav-toggle {
  display: none !important;
  min-height: 2.25rem;
  padding: 0.3rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  color: var(--ink);
  font: inherit;
  font-size: 0.85rem;
  font-weight: 700;
}

.nav-toggle__icon,
.nav-toggle__icon::before,
.nav-toggle__icon::after {
  display: block;
  width: 1rem;
  height: 2px;
  border-radius: 2px;
  background: currentColor;
}

.nav-toggle__icon { position: relative; margin-left: 0.45rem; }
.nav-toggle__icon::before,
.nav-toggle__icon::after { position: absolute; left: 0; content: ""; }
.nav-toggle__icon::before { top: -0.32rem; }
.nav-toggle__icon::after { top: 0.32rem; }

.who {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--muted);
  font-size: 0.92rem;
}

.who form { margin: 0; }

.mode-switch {
  display: inline-flex;
  align-items: center;
  gap: 0.1rem;
  margin: 0 0 0 auto;
  padding: 0.15rem;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.5);
}
.mode-switch__label {
  padding: 0 0.4rem 0 0.35rem;
  color: var(--muted);
  font-size: 0.65rem;
  font-weight: 750;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.mode-switch button {
  min-height: 2rem;
  padding: 0.25rem 0.6rem;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
}
.mode-switch button[aria-pressed="true"] { cursor: default; }
.mode-switch.is-dry_run { border-color: #eadcba; background: #fbf6ea; }
.mode-switch.is-dry_run [value="dry_run"] { background: var(--wait); color: #fff; }
.mode-switch.is-live { border-color: #ecd3ce; background: #fbf1ef; }
.mode-switch.is-live [value="live"] { background: var(--bad); color: #fff; }
.mode-switch.is-live [value="live"]::before { content: "● "; }
.who-name { padding: 0.4rem 0.55rem; color: inherit; font-weight: 600; }
.form-note { margin: 0.2rem 0 1rem; font-size: 0.85rem; color: var(--muted); }

.sitemap-intro { max-width: 44rem; }
.sitemap-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  margin-top: 1.25rem;
}
.sitemap-card { display: flex; flex-direction: column; min-height: 13rem; }
.sitemap-card__eyebrow {
  margin: 0 0 0.35rem;
  color: #8a6f3e;
  font-size: 0.68rem;
  font-weight: 750;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.sitemap-card h2 { margin-bottom: 0.35rem; font-size: 1.15rem; }
.sitemap-card p { margin: 0 0 0.85rem; color: var(--muted); }
.sitemap-links { display: grid; gap: 0.35rem; margin-top: auto; }
.sitemap-link {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.55rem 0;
  border-top: 1px solid var(--line);
  font-weight: 650;
  text-decoration: none;
}
.sitemap-link::after { content: "→"; color: #8a6f3e; }

main {
  width: min(920px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 2rem 0 4rem;
}

h1 {
  font-size: 1.8rem;
  font-weight: 560;
  letter-spacing: -0.03em;
  margin: 0 0 0.35rem;
}

h2 {
  font-size: 1rem;
  font-weight: 600;
  margin: 0 0 0.75rem;
}

.lede, .quiet { color: var(--muted); }

.page-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

body.desk { font-size: 1.05rem; }
body.desk h1 { font-size: 2rem; }
.desk-lead { max-width: 36rem; margin: 0.15rem 0 0; font-size: 1.05rem; }

.kit-actions {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.7rem;
  width: min(32.5rem, 100%);
}
.kit-actions form { margin: 0; display: flex; }
.kit-actions button.glass {
  position: relative;
  isolation: isolate;
  width: 100%;
  min-height: 3rem;
  padding: 0.65rem 0.9rem;
  border-radius: 5px;
  border: 3px solid rgba(232, 241, 252, 0.82);
  background: rgba(240, 247, 255, 0.16);
  color: var(--ink);
  font-size: 0.98rem;
  font-weight: 650;
  letter-spacing: -0.015em;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.9),
    inset 0 0 0 1px rgba(255, 255, 255, 0.3),
    0 0 0 1px rgba(151, 176, 206, 0.18),
    0 12px 24px rgba(42, 56, 74, 0.08);
  backdrop-filter: blur(15px) saturate(1.25);
  -webkit-backdrop-filter: blur(15px) saturate(1.25);
}
.kit-actions button.glass:hover {
  background: rgba(244, 249, 255, 0.24);
  border-color: rgba(244, 249, 255, 0.96);
}

.desk-list-shell {
  margin-top: 1.1rem;
  padding: 1rem;
  border: 1px solid rgba(224, 233, 245, 0.94);
  border-radius: 12px;
  background: rgba(252, 253, 255, 0.5);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.96),
    inset 0 0 0 1px rgba(255, 255, 255, 0.42),
    0 18px 36px rgba(38, 48, 64, 0.08);
  backdrop-filter: blur(20px) saturate(1.08);
  -webkit-backdrop-filter: blur(20px) saturate(1.08);
}
.desk-list-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 0.7rem;
}
.desk-list-head h2 {
  margin: 0.15rem 0 0;
  font-size: 1.22rem;
}

.list-switch { display: flex; gap: 0.55rem; margin: 0 0 0.95rem; align-items: center; }
.desk-list-shell .list-switch { margin: 0; }
.list-switch a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.65rem;
  min-width: 6.6rem;
  padding: 0.4rem 0.95rem;
  border-radius: 5px;
  border: 3px solid rgba(255, 255, 255, 0.72);
  background: rgba(255, 255, 255, 0.16);
  color: var(--ink);
  text-decoration: none;
  font-weight: 650;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.9),
    inset 0 0 0 1px rgba(255, 255, 255, 0.35),
    0 0 0 1px rgba(176, 156, 126, 0.18),
    0 8px 18px rgba(48, 36, 18, 0.05);
  backdrop-filter: blur(14px) saturate(1.3);
  -webkit-backdrop-filter: blur(14px) saturate(1.3);
}
.list-switch a.is-on {
  background: rgba(255, 255, 255, 0.34);
  border-color: rgba(255, 255, 255, 0.92);
}

.flash, .banner {
  border-radius: 10px;
  padding: 0.7rem 0.85rem;
  margin: 0 0 1rem;
  background: var(--card);
  border: 1px solid var(--line);
}

.flash.ok, .banner.ok { background: #eef6f1; border-color: #cfe3d8; }
.flash.error, .banner.error, .banner.bad { background: #fbf1ef; border-color: #ecd3ce; }
.banner.wait { background: #fbf6ea; border-color: #eadcba; }

.card, .paper {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
}

.card { padding: 1.1rem 1.15rem 1.2rem; }

.paper { padding: 2.4rem 2.2rem 2rem; }

label {
  display: block;
  font-size: 0.86rem;
  margin: 0 0 0.85rem;
}

input, textarea {
  display: block;
  width: 100%;
  margin-top: 0.35rem;
  padding: 0.6rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: inherit;
  font: inherit;
}

textarea {
  min-height: 22rem;
  resize: vertical;
  font-family: "Iowan Old Style", Palatino, Georgia, serif;
  font-size: 1.02rem;
  line-height: 1.55;
}

textarea.note-field {
  min-height: 6rem;
  font-family: inherit;
  font-size: 0.95rem;
}

.check {
  display: flex;
  gap: 0.6rem;
  align-items: flex-start;
  font-size: 0.95rem;
}

.check input {
  width: auto;
  margin: 0.2rem 0 0;
}

.btn, button:not(.glass):not(.es-btn):not(.es-x):not(.es-link):not(.es-guide), summary.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.65rem;
  padding: 0.45rem 0.95rem;
  border-radius: 5px;
  border: 3px solid rgba(255, 255, 255, 0.74);
  background: rgba(255, 255, 255, 0.16);
  color: var(--ink);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.92),
    inset 0 0 0 1px rgba(255, 255, 255, 0.32),
    0 0 0 1px rgba(176, 156, 126, 0.16),
    0 8px 18px rgba(48, 36, 18, 0.05);
  backdrop-filter: blur(14px) saturate(1.35);
  -webkit-backdrop-filter: blur(14px) saturate(1.35);
  font: inherit;
  font-size: 0.95rem;
  font-weight: 650;
  letter-spacing: -0.01em;
  text-decoration: none;
  cursor: pointer;
}

.btn:hover, button:not(.glass):not(.es-btn):not(.es-x):not(.es-link):not(.es-guide):hover, summary.btn:hover {
  background: rgba(255, 255, 255, 0.32);
  border-color: rgba(255, 255, 255, 0.94);
}

.btn.quiet, button.quiet,
.btn.file, button.file {
  color: var(--ink);
}

.btn.danger, button.danger, summary.btn.danger {
  color: var(--bad);
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 236, 232, 0.9);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.85),
    inset 0 0 0 1px rgba(190, 120, 112, 0.28),
    0 0 0 1px rgba(141, 61, 52, 0.16),
    0 8px 18px rgba(48, 36, 18, 0.05);
}

.btn.danger:hover, button.danger:hover, summary.btn.danger:hover {
  background: rgba(255, 248, 246, 0.34);
  border-color: #fff;
}

.btn.small, button.small {
  min-height: 2.25rem;
  padding: 0.28rem 0.7rem;
  font-size: 0.86rem;
}

.row-actions, .split-actions, .toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.toolbar { margin-top: 1rem; }

.split-actions button[value="send"] { order: -1; }

.composer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 17.5rem;
  gap: 1rem;
  align-items: start;
}

.side { display: grid; gap: 1rem; }

.templates { margin: 0.2rem 0 0; padding: 0; list-style: none; }
.templates li { margin: 0.35rem 0; }
.templates a { color: var(--ink); }

.agreements-head {
  display: grid;
  grid-template-columns: 10rem minmax(0, 1.3fr) 8rem auto;
  gap: 0.9rem;
  align-items: center;
  margin: 0 0 0.45rem;
  padding: 0 0.8rem;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.agreements { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.35rem; }
.agreement {
  display: grid;
  grid-template-columns: 10rem minmax(0, 1.3fr) 8rem auto;
  gap: 0.9rem;
  align-items: center;
  padding: 0.68rem 0.8rem;
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(224, 230, 239, 0.95);
  border-radius: 10px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.88);
}
.agreement-date,
.agreement-main,
.agreement-state { min-width: 0; }
.agreement-date time,
.agreement-ref,
.agreement-client { display: block; }
.agreement-date time {
  font-size: 0.92rem;
  font-weight: 670;
}
.agreement-ref,
.agreement-client {
  margin-top: 0.12rem;
  color: var(--muted);
  font-size: 0.84rem;
}
.agreement-main { min-width: 0; }
.agreement-actions {
  display: flex;
  flex-wrap: nowrap;
  gap: 0.45rem;
  justify-content: flex-end;
  align-items: center;
}
.agreement-actions form,
.agreement-actions .danger-confirm { margin: 0; }
.agreement-actions .btn { min-width: 5.8rem; min-height: 2.2rem; padding: 0.3rem 0.8rem; font-size: 0.92rem; }
.agree-title {
  display: block;
  margin: 0;
  font-size: 1.03rem;
  font-weight: 680;
  letter-spacing: -0.015em;
  text-decoration: none;
}
.agree-title:hover { text-decoration: underline; }
.agreement-client {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.agreement-state {
  display: flex;
  justify-content: flex-start;
}

.danger-confirm { position: relative; }
.danger-confirm summary { list-style: none; }
.danger-confirm summary::-webkit-details-marker { display: none; }
.danger-confirm form {
  position: absolute;
  z-index: 3;
  right: 0;
  width: 16.5rem;
  margin: 0.4rem 0 0;
  padding: 0.8rem;
  background: #fff;
  border: 1px solid #e3c7c2;
  border-radius: 12px;
  box-shadow: var(--shadow);
}
.danger-confirm p { margin: 0 0 0.65rem; font-size: 0.95rem; }


.pill {
  justify-self: end;
  font-size: 0.85rem;
  font-weight: 650;
  letter-spacing: 0.01em;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  background: #eeeae4;
  color: var(--muted);
}
.pill.out_for_signature { background: #f8f1dc; color: var(--wait); }
.pill.completed { background: #e7f3ec; color: var(--green); }
.pill.declined, .pill.voided { background: #f8ece9; color: var(--bad); }

.kicker {
  margin: 0 0 0.35rem;
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.paper h1 {
  font-family: "Iowan Old Style", Palatino, Georgia, serif;
  font-weight: 500;
  font-size: 2rem;
}

.prose {
  white-space: pre-wrap;
  font-family: "Iowan Old Style", Palatino, Georgia, serif;
  font-size: 1.05rem;
  line-height: 1.6;
  margin: 1.25rem 0;
}

.note {
  margin: 1rem 0 0;
  padding: 0.75rem 0.85rem;
  background: #f7f3ea;
  border-radius: 10px;
  white-space: pre-wrap;
}

.sign-slot {
  margin-top: 1.5rem;
  min-height: 7.5rem;
  padding: 0.9rem 1rem 1rem;
  border: 1px dashed #cfc6ba;
  border-radius: 12px;
}

.slot-label, .finger, .signed-meta, .mono {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.75rem;
  color: var(--muted);
}

.finger { overflow-wrap: anywhere; margin: 1.25rem 0 0; }

.script, .sig-preview {
  font-family: "Snell Roundhand", "Segoe Script", "Apple Chancery", cursive;
  font-size: 2.1rem;
  line-height: 1.2;
  margin: 0.35rem 0 0.15rem;
}

.ink, #live-ink {
  display: block;
  max-width: 280px;
  height: auto;
  margin-top: 0.35rem;
}

.signed-by { margin: 0.15rem 0 0; }

.certificate, .timeline, .linkbox, .adopt {
  margin-top: 1rem;
}
.cert-foot {
  margin: 0.85rem 0 0;
  padding-top: 0.7rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.45;
}

dl { margin: 0; }
dl div { display: grid; grid-template-columns: 7rem minmax(0, 1fr); gap: 0.75rem; padding: 0.35rem 0; }
dt { color: var(--muted); }
dd { margin: 0; overflow-wrap: anywhere; }

.timeline { list-style: none; padding: 0; }
.timeline li {
  display: grid;
  grid-template-columns: 11rem minmax(0, 1fr);
  gap: 0.75rem;
  padding: 0.45rem 0;
  border-top: 1px solid var(--line);
}
.timeline li:first-child { border-top: 0; }

.linkbox code {
  display: block;
  margin: 0.4rem 0 0.7rem;
  overflow-wrap: anywhere;
  font-size: 0.82rem;
}

.tabs { display: flex; gap: 0.55rem; margin-bottom: 0.9rem; align-items: center; }
.tabs button[aria-selected="true"] {
  background: rgba(255, 255, 255, 0.34);
  border-color: rgba(255, 255, 255, 0.94);
  color: var(--ink);
}

#pad {
  width: 100%;
  height: 160px;
  background: #fff;
  border: 1px dashed #cfc6ba;
  border-radius: 12px;
  touch-action: none;
  cursor: crosshair;
}

.dock {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-top: 0.5rem;
  padding: 0.9rem 0 0.2rem;
  background: var(--bg);
  border-top: 1px solid var(--line);
}

details.decline { color: var(--muted); }
details.decline summary { cursor: pointer; }
details.decline form { margin-top: 0.6rem; }

.foot {
  margin-top: 2rem;
  color: var(--muted);
  font-size: 0.85rem;
}

.empty {
  padding: 2rem 1.2rem;
  text-align: left;
}

.warn { color: var(--bad); margin: 0; }
.warn:empty { display: none; }

@media (max-width: 800px) {
  .top { padding: 0.7rem 1rem; }
  .site-shell { display: block; }
  .site-shell__bar { justify-content: space-between; width: 100%; }
  .nav-toggle { display: inline-flex !important; align-items: center; }
  .site-shell__panel {
    display: none;
    align-items: stretch;
    flex-direction: column;
    gap: 0.8rem;
    padding: 0.8rem 0 0.25rem;
  }
  .site-shell.is-open .site-shell__panel { display: flex; }
  .main-nav { align-items: stretch; flex-direction: column; }
  .main-nav > a { min-height: 2.7rem; }
  .nav-group {
    align-items: stretch;
    flex-direction: column;
    gap: 0.1rem;
    margin: 0.35rem 0;
    padding: 0.45rem;
  }
  .nav-group__label { padding: 0.25rem 0.55rem; }
  .nav-group a { min-height: 2.55rem; padding-left: 0.85rem; }
  .mode-switch { align-self: flex-start; margin: 0; }
  .who {
    justify-content: space-between;
    padding-top: 0.7rem;
    border-top: 1px solid var(--line);
  }
  .sitemap-grid { grid-template-columns: 1fr; }
  .composer, .agreement, .timeline li, dl div { grid-template-columns: 1fr; }
  .desk-list-shell { padding: 1rem 0.9rem; }
  .desk-list-head { align-items: flex-start; flex-direction: column; }
  .agreements-head { display: none; }
  .agreement-actions { justify-content: flex-start; }
  .danger-confirm form { right: auto; left: 0; }
  .paper { padding: 1.4rem 1.1rem 1.2rem; }
  .pill { justify-self: start; }
  .page-head { align-items: flex-start; flex-direction: column; }
  .kit-actions { width: 100%; }
}

.packet-page { margin-top: 1.25rem; }
.packet-page:first-child { margin-top: 0; }
.packet-title { margin: 0.4rem 0 0.8rem; font-size: 1.35rem; }
.packet-deal { margin-bottom: 1.25rem; }
.packet-again { margin-top: 1rem; }
.packet-edit textarea { min-height: 6rem; }

.clause {
  display: grid;
  grid-template-columns: 5.2rem minmax(0, 1fr);
  gap: 0.75rem;
  margin: 0.9rem 0;
}
.initial input, .initial-mark {
  width: 100%;
  text-align: center;
  letter-spacing: 0.04em;
}
.initial-mark {
  display: block;
  min-height: 2.4rem;
  line-height: 2.4rem;
  border: 1px dashed #cfc6ba;
  border-radius: 10px;
  background: #fff;
}
.clause-n { margin: 0; font-size: 0.8rem; color: var(--muted); }
.field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem 1rem;
  margin: 0.8rem 0;
}
.field-grid .wide, label.wide { grid-column: 1 / -1; }
.filled { margin: 0.35rem 0 0.8rem; }
.yesno, .checks {
  margin: 0.8rem 0;
  border: 0;
  padding: 0;
}
.yesno select { max-width: 8rem; margin-top: 0.35rem; }
.checks { display: flex; flex-wrap: wrap; gap: 0.35rem 0.8rem; }
.checks legend { width: 100%; padding: 0; margin-bottom: 0.35rem; font-size: 0.86rem; }
.sign-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}
.office-name { font-size: 1.6rem; }

@media (max-width: 800px) {
  .field-grid, .sign-row, .clause { grid-template-columns: 1fr; }
}

@media print {
  body { background: #fff; }
  .top, .noprint, .dock, .flash { display: none !important; }
  main { width: auto; margin: 0; padding: 0; }
  .paper { border: 0; box-shadow: none; }
  .packet-page { page-break-after: always; }
}


/* Inbound text-reply alert, pinned just under the header */
.reply-alert {
  position: sticky;
  top: var(--top-h, 3.4rem);
  z-index: 19;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.7rem 1.25rem;
  background: #1c6b45;
  color: #fff;
  border-bottom: 3px solid #0f4a2d;
  box-shadow: 0 6px 18px rgba(15, 74, 45, 0.28);
  font-size: 0.98rem;
}
.reply-alert__dot {
  flex: 0 0 auto;
  width: 0.8rem;
  height: 0.8rem;
  border-radius: 50%;
  background: #fff;
  animation: reply-dot 1.6s ease-in-out infinite;
}
.reply-alert__text {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.reply-alert__open,
.reply-alert__all {
  flex: 0 0 auto;
  padding: 0.35rem 0.9rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.85);
  color: #fff;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.9rem;
}
.reply-alert__open { background: #fff; color: #0f4a2d; }
.reply-alert__open:hover { background: #e9f5ee; }
.reply-alert__all:hover { background: rgba(255, 255, 255, 0.16); }
.reply-alert :focus-visible { outline-color: #fff; }
.reply-alert.is-pulse { animation: reply-flash 0.9s ease-out 3; }
@keyframes reply-dot {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.5); opacity: 0.55; }
}
@keyframes reply-flash {
  0% { background: #2fa36b; }
  100% { background: #1c6b45; }
}
@media (max-width: 800px) {
  .reply-alert { flex-wrap: wrap; padding: 0.6rem 1rem; }
  .reply-alert__text { flex-basis: calc(100% - 2rem); white-space: normal; }
}
@media (prefers-reduced-motion: reduce) {
  .reply-alert__dot, .reply-alert.is-pulse { animation: none; }
}

/* Cleanse leads control in the CRM nav group */
.cleanse {
  display: inline-flex;
  align-items: center;
  gap: 0.15rem;
  margin-left: 0.15rem;
  padding-left: 0.3rem;
  border-left: 1px solid var(--line);
}
.cleanse__btn,
.cleanse__refresh {
  min-height: 2.25rem;
  margin: 0;
  padding: 0.35rem 0.6rem;
  border: 1px solid #cfe3d8;
  border-radius: 7px;
  background: #eef6f1;
  color: var(--green);
  font-size: 0.86rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: none;
}
.cleanse__refresh { padding: 0.35rem 0.5rem; font-size: 0.95rem; }
.cleanse__btn:hover:not(:disabled),
.cleanse__refresh:hover:not(:disabled) { background: #dfeee6; }
.cleanse__btn:disabled,
.cleanse__refresh:disabled { opacity: 0.65; cursor: progress; }
.cleanse__status {
  max-width: 16rem;
  padding: 0 0.35rem;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.78rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cleanse__status:empty { display: none; }
.cleanse-toast {
  position: fixed;
  right: 1.25rem;
  bottom: 1.25rem;
  z-index: 50;
  max-width: min(28rem, calc(100vw - 2.5rem));
  padding: 0.8rem 1rem;
  border-radius: 10px;
  background: #1c6b45;
  color: #fff;
  font-size: 0.92rem;
  box-shadow: 0 12px 30px rgba(15, 74, 45, 0.3);
  opacity: 0;
  transform: translateY(0.5rem);
  transition: opacity 0.2s, transform 0.2s;
  pointer-events: none;
}
.cleanse-toast.is-on { opacity: 1; transform: none; }
.cleanse-toast.is-bad { background: var(--bad); }
@media (max-width: 800px) {
  .cleanse { margin: 0.3rem 0 0; padding: 0.3rem 0 0; border-left: 0; border-top: 1px solid var(--line); flex-wrap: wrap; }
  .cleanse__status { max-width: none; white-space: normal; }
}
