:root {
  --paper: #fbfcfa;
  --surface: #ffffff;
  --surface-tint: #f2f7f5;
  --surface-deep: #e8f0ed;
  --ink: #173431;
  --ink-strong: #0d2927;
  --muted: #5d716d;
  --faint: #839590;
  --rule: #d9e5e1;
  --rule-strong: #b8ccc6;
  --accent: #006c67;
  --accent-deep: #004d4a;
  --accent-soft: #dceee9;
  --success: #1f7a52;
  --success-soft: #e2f2e9;
  --warning: #a46418;
  --warning-soft: #fff0d9;
  --danger: #a8473d;
  --danger-soft: #fbe8e5;
  --white: #fff;
  --radius-control: 4px;
  --radius-row: 8px;
  --radius-dialog: 12px;
  --shadow-dialog: 0 18px 42px -24px rgba(9, 44, 42, .42), 0 4px 10px -6px rgba(9, 44, 42, .18);
  --shadow-button: inset 0 1px 0 rgba(255, 255, 255, .16), 0 3px 7px -5px rgba(9, 44, 42, .4);
  --ease: cubic-bezier(.22, 1, .36, 1);
  --content-max: 1240px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--paper);
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background: var(--paper);
  color: var(--ink);
  font-family: "Avenir Next", Avenir, "Segoe UI", system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.55;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

button,
input,
select,
textarea {
  color: inherit;
  font: inherit;
}

button,
a,
input,
select,
textarea {
  -webkit-tap-highlight-color: transparent;
}

button,
a {
  touch-action: manipulation;
}

button {
  cursor: pointer;
}

a {
  color: inherit;
}

h1,
h2,
h3,
p,
dl,
dd,
dt,
ol,
ul {
  margin: 0;
}

h1,
h2,
h3 {
  color: var(--ink-strong);
  font-family: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  font-weight: 600;
  letter-spacing: -.035em;
  line-height: 1.12;
  text-wrap: balance;
}

p {
  max-width: 65ch;
  text-wrap: pretty;
}

strong {
  font-weight: 700;
}

fieldset {
  min-width: 0;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  z-index: 20;
  top: 12px;
  left: 16px;
  padding: 9px 14px;
  border-radius: var(--radius-control);
  background: var(--ink-strong);
  color: var(--white);
  font-size: .875rem;
  font-weight: 700;
  text-decoration: none;
  transform: translateY(-180%);
  transition: transform 160ms var(--ease);
}

.skip-link:focus {
  transform: translateY(0);
}

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

.app-shell {
  display: flex;
  min-height: 100vh;
  flex-direction: column;
}

.topbar {
  display: grid;
  grid-template-columns: minmax(190px, 1fr) auto minmax(190px, 1fr);
  align-items: center;
  gap: 24px;
  min-height: 78px;
  padding: 0 32px;
  border-bottom: 1px solid var(--rule);
  background: var(--surface);
}

.brand {
  display: inline-flex;
  width: fit-content;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border: 1px solid var(--accent);
  border-radius: var(--radius-control);
  background: var(--ink-strong);
  color: var(--white);
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .03em;
}

.brand-copy {
  display: grid;
  gap: 0;
  line-height: 1.1;
}

.brand-name {
  color: var(--ink-strong);
  font-size: .96rem;
  font-weight: 800;
  letter-spacing: -.02em;
}

.brand-area {
  color: var(--muted);
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.primary-nav {
  display: flex;
  align-items: stretch;
  align-self: stretch;
  gap: 24px;
}

.nav-link {
  position: relative;
  border: 0;
  border-bottom: 2px solid transparent;
  padding: 3px 0 0;
  background: transparent;
  color: var(--muted);
  font-size: .82rem;
  font-weight: 700;
  letter-spacing: .01em;
}

.nav-link:hover,
.nav-link.is-active {
  color: var(--ink-strong);
}

.nav-link.is-active {
  border-bottom-color: var(--accent);
}

.session-cluster {
  display: flex;
  min-width: 0;
  justify-content: flex-end;
  align-items: center;
  gap: 12px;
}

.sign-out-button {
  border: 0;
  border-bottom: 1px solid transparent;
  padding: 2px 0;
  background: transparent;
  color: var(--muted);
  font-size: .7rem;
  font-weight: 800;
}

.sign-out-button:hover {
  border-bottom-color: currentColor;
  color: var(--accent-deep);
}

.session-presence {
  display: inline-flex;
  min-width: 0;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: .78rem;
  font-weight: 600;
  white-space: nowrap;
}

.presence-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--success);
}

.avatar-button {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border: 1px solid var(--rule-strong);
  border-radius: 50%;
  background: var(--surface-tint);
  color: var(--accent-deep);
  font-size: .72rem;
  font-weight: 800;
}

main {
  width: min(100%, var(--content-max));
  flex: 1;
  margin: 0 auto;
  padding: 64px 32px 80px;
}

main:focus {
  outline: 0;
}

.session-loading {
  width: min(100%, 560px);
  padding-top: 68px;
  color: var(--muted);
}

.session-loading p {
  margin-top: 16px;
  font-size: .9rem;
}

.loading-line {
  height: 12px;
  border-radius: var(--radius-control);
  background: var(--surface-deep);
  animation: load-pulse 1.2s ease-in-out infinite alternate;
}

.loading-line-wide {
  width: min(100%, 340px);
}

.loading-line-medium {
  width: min(100%, 240px);
}

.loading-line-short {
  width: min(100%, 180px);
  margin-top: 10px;
}

@keyframes load-pulse {
  from { opacity: .48; }
  to { opacity: 1; }
}

.auth-state {
  max-width: 610px;
  padding: 68px 0 32px;
}

.auth-rule {
  width: 72px;
  height: 4px;
  margin-bottom: 28px;
  background: var(--accent);
}

.auth-rule-warning {
  background: var(--warning);
}

.eyebrow,
.field-label,
.stat-label,
.total-label,
.detail-list dt,
.confirm-facts dt {
  color: var(--muted);
  font-size: .69rem;
  font-weight: 800;
  letter-spacing: .08em;
  line-height: 1.3;
  text-transform: uppercase;
}

.auth-state h1 {
  max-width: 13ch;
  margin-bottom: 20px;
  font-size: clamp(2.4rem, 5vw, 4.25rem);
}

.auth-copy {
  max-width: 51ch;
  color: var(--muted);
  font-size: 1.05rem;
}

.auth-help {
  margin-top: 18px;
  color: var(--danger);
  font-size: .88rem;
}

.button {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  gap: 9px;
  border: 1px solid transparent;
  border-radius: var(--radius-control);
  padding: 10px 15px;
  font-size: .82rem;
  font-weight: 800;
  letter-spacing: .01em;
  line-height: 1.2;
  text-decoration: none;
  transition: background-color 160ms var(--ease), border-color 160ms var(--ease), color 160ms var(--ease), transform 160ms var(--ease), opacity 160ms var(--ease);
}

.button:hover:not(:disabled) {
  transform: translateY(-1px);
}

.button:active:not(:disabled) {
  transform: translateY(0);
}

.button:disabled {
  cursor: not-allowed;
  opacity: .52;
}

.button-primary {
  border-color: var(--accent-deep);
  background: var(--accent);
  box-shadow: var(--shadow-button);
  color: var(--white);
}

.button-primary:hover:not(:disabled) {
  background: var(--accent-deep);
}

.button-secondary {
  border-color: var(--rule-strong);
  background: var(--surface);
  color: var(--ink-strong);
}

.button-secondary:hover:not(:disabled) {
  border-color: var(--accent);
  background: var(--surface-tint);
}

.button-quiet {
  border-color: transparent;
  background: transparent;
  color: var(--accent-deep);
}

.button-quiet:hover:not(:disabled) {
  background: var(--accent-soft);
}

.button-danger {
  border-color: var(--danger);
  background: var(--danger);
  color: var(--white);
}

.button-danger:hover:not(:disabled) {
  background: #833a34;
}

.button-google {
  margin-top: 28px;
  padding-right: 18px;
  padding-left: 13px;
}

.google-g {
  display: grid;
  width: 22px;
  height: 22px;
  place-items: center;
  border-radius: 50%;
  background: var(--white);
  color: #4285f4;
  font-family: Arial, sans-serif;
  font-size: .82rem;
  font-weight: 800;
}

.page-heading,
.view-heading-row,
.detail-heading-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 32px;
}

.page-heading h1,
.view-heading h1 {
  max-width: 17ch;
  margin-top: 8px;
  font-size: clamp(2.3rem, 4vw, 4rem);
}

.lede {
  margin-top: 18px;
  color: var(--muted);
  font-size: 1rem;
}

.heading-action {
  flex: 0 0 auto;
  margin-bottom: 6px;
}

.stats-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-top: 58px;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
}

.stat-item {
  display: grid;
  min-height: 92px;
  align-content: center;
  gap: 7px;
  padding: 16px 20px 15px 0;
}

.stat-item + .stat-item {
  padding-left: 20px;
  border-left: 1px solid var(--rule);
}

.stat-value {
  color: var(--ink-strong);
  font-family: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  font-size: 1.65rem;
  letter-spacing: -.03em;
  line-height: 1;
}

.stat-value-text {
  font-family: inherit;
  font-size: .88rem;
  font-weight: 700;
  letter-spacing: 0;
}

.list-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 28px;
}

.search-field,
.filter-field {
  display: flex;
  min-height: 44px;
  align-items: center;
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius-control);
  background: var(--surface);
}

.search-field {
  flex: 1 1 360px;
  max-width: 480px;
  padding: 0 12px;
}

.search-glyph {
  margin-right: 8px;
  color: var(--faint);
  font-size: 1.25rem;
  line-height: 1;
  transform: translateY(-1px);
}

.search-field input,
.filter-field select {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink-strong);
  font-size: .84rem;
}

.search-field input::placeholder {
  color: var(--faint);
}

.filter-field {
  flex: 0 1 190px;
  padding: 0 10px;
}

.filter-field select {
  cursor: pointer;
}

.list-toolbar > .button {
  margin-left: auto;
}

.live-message,
.error-summary,
.form-error-summary {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  border-left: 3px solid var(--accent);
  padding: 12px 16px;
  background: var(--surface-tint);
  color: var(--ink);
  font-size: .86rem;
}

.live-message {
  margin-top: 22px;
}

.error-summary,
.form-error-summary {
  border-left-color: var(--danger);
  background: var(--danger-soft);
}

.error-summary p,
.form-error-summary p {
  margin-top: 3px;
  color: var(--muted);
  font-size: .82rem;
}

.error-summary .button {
  flex: 0 0 auto;
}

.agreement-list {
  margin-top: 22px;
  border-top: 1px solid var(--rule-strong);
}

.agreement-row {
  display: grid;
  grid-template-columns: minmax(190px, 1.5fr) minmax(135px, .75fr) minmax(150px, .8fr) auto;
  align-items: center;
  gap: 20px;
  min-height: 90px;
  border-bottom: 1px solid var(--rule);
  padding: 14px 0;
  transition: background-color 160ms var(--ease), padding 160ms var(--ease);
}

.agreement-row:hover {
  background: var(--surface-tint);
  padding-right: 12px;
  padding-left: 12px;
}

.agreement-row:focus-within {
  background: var(--surface-tint);
}

.agreement-customer,
.agreement-meta,
.agreement-stage,
.agreement-action {
  min-width: 0;
}

.agreement-customer {
  display: grid;
  gap: 3px;
}

.agreement-name {
  overflow-wrap: anywhere;
  color: var(--ink-strong);
  font-family: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  font-size: 1.2rem;
  font-weight: 600;
  letter-spacing: -.02em;
  line-height: 1.2;
}

.agreement-signer,
.agreement-meta,
.agreement-stage-note {
  overflow-wrap: anywhere;
  color: var(--muted);
  font-size: .78rem;
}

.agreement-meta,
.agreement-stage {
  display: grid;
  gap: 4px;
}

.agreement-meta-label {
  color: var(--faint);
  font-size: .66rem;
  font-weight: 800;
  letter-spacing: .07em;
  text-transform: uppercase;
}

.agreement-action {
  justify-self: end;
}

.empty-state {
  display: grid;
  gap: 11px;
  max-width: 620px;
  border-bottom: 1px solid var(--rule);
  padding: 34px 0 40px;
}

.empty-state h2 {
  font-size: 1.8rem;
}

.empty-state p {
  color: var(--muted);
}

.empty-state .button {
  width: fit-content;
  margin-top: 8px;
}

.status-badge {
  display: inline-flex;
  width: fit-content;
  align-items: center;
  gap: 7px;
  color: var(--ink);
  font-size: .76rem;
  font-weight: 800;
}

.status-badge::before {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--faint);
  content: "";
}

.status-draft::before,
.status-awaiting_customer::before {
  background: var(--warning);
}

.status-awaiting_rep::before {
  background: var(--accent);
}

.status-completed::before {
  background: var(--success);
}

.status-declined::before,
.status-voided::before,
.status-send_failed::before {
  background: var(--danger);
}

.mode-badge {
  display: inline-flex;
  width: fit-content;
  align-items: center;
  border: 1px solid var(--warning);
  border-radius: 999px;
  padding: 3px 8px;
  background: var(--warning-soft);
  color: #7a4a0f;
  font-size: .64rem;
  font-weight: 900;
  letter-spacing: .05em;
  line-height: 1.2;
  text-transform: uppercase;
}

.view-heading {
  max-width: 960px;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--accent-deep);
  font-size: .8rem;
  font-weight: 800;
}

.back-link:hover {
  color: var(--ink-strong);
}

.view-heading-row,
.detail-heading-row {
  margin-top: 32px;
}

.form-heading-badges {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.draft-indicator {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  border-left: 2px solid var(--success);
  padding: 5px 0 5px 10px;
  color: var(--success);
  font-size: .75rem;
  font-weight: 800;
}

.form-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 265px;
  align-items: start;
  gap: 72px;
  margin-top: 54px;
}

.agreement-form {
  min-width: 0;
}

.form-error-summary {
  margin-bottom: 28px;
}

.form-section {
  margin: 0;
  border: 0;
  border-top: 1px solid var(--rule-strong);
  padding: 30px 0 34px;
}

.form-section:last-of-type {
  border-bottom: 1px solid var(--rule-strong);
}

.form-section legend {
  float: left;
  width: 100%;
  padding: 0;
  color: var(--ink-strong);
  font-family: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  font-size: 1.55rem;
  font-weight: 600;
  letter-spacing: -.025em;
  line-height: 1.2;
}

.form-section legend::after {
  display: block;
  clear: both;
  content: "";
}

.section-number {
  display: inline-block;
  margin-right: 9px;
  color: var(--accent);
  font-family: "Avenir Next", Avenir, "Segoe UI", system-ui, sans-serif;
  font-size: .66rem;
  font-weight: 800;
  letter-spacing: .08em;
  vertical-align: .2em;
}

.section-intro {
  clear: both;
  padding-top: 9px;
  color: var(--muted);
  font-size: .86rem;
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 23px 20px;
  margin-top: 26px;
}

.field {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 8px;
}

.field-span-2 {
  grid-column: span 2;
}

.required-mark {
  color: var(--danger);
}

.field input:not([type="radio"]):not([type="checkbox"]),
.field select,
.field textarea {
  display: block;
  width: 100%;
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius-control);
  outline: 0;
  background: var(--surface);
  padding: 11px 12px;
  font-size: .9rem;
  line-height: 1.35;
  transition: background-color 160ms var(--ease), border-color 160ms var(--ease), box-shadow 160ms var(--ease);
}

.field input:not([type="radio"]):not([type="checkbox"]):hover,
.field select:hover,
.field textarea:hover {
  border-color: var(--accent);
}

.field input:not([type="radio"]):not([type="checkbox"]):focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.field input[aria-invalid="true"],
.field select[aria-invalid="true"],
.field textarea[aria-invalid="true"] {
  border-color: var(--danger);
  background: #fffaf9;
}

.field textarea {
  min-height: 72px;
  resize: vertical;
}

.field input::placeholder,
.field textarea::placeholder {
  color: var(--faint);
}

.field-hint,
.field-error,
.form-action-note,
.rail-note,
.timeline-note {
  color: var(--muted);
  font-size: .75rem;
  line-height: 1.45;
}

.field-error {
  color: var(--danger);
}

.input-prefix {
  display: flex;
  align-items: center;
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius-control);
  background: var(--surface);
  transition: border-color 160ms var(--ease), box-shadow 160ms var(--ease);
}

.input-prefix:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.input-prefix > span {
  padding-left: 12px;
  color: var(--muted);
  font-size: .9rem;
}

.input-prefix input {
  min-width: 0;
  flex: 1;
  border: 0 !important;
  box-shadow: none !important;
}

.choice-row,
.day-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.choice-row {
  margin-top: 2px;
}

.choice-control,
.day-control,
.none-toggle {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  gap: 9px;
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius-control);
  background: var(--surface);
  padding: 8px 12px;
  color: var(--ink);
  cursor: pointer;
  font-size: .83rem;
  font-weight: 700;
  transition: background-color 160ms var(--ease), border-color 160ms var(--ease), color 160ms var(--ease);
}

.choice-control:hover,
.day-control:hover,
.none-toggle:hover {
  border-color: var(--accent);
  background: var(--surface-tint);
}

.choice-control:has(input:checked),
.day-control:has(input:checked),
.none-toggle:has(input:checked) {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-deep);
}

.choice-control input,
.day-control input,
.none-toggle input {
  width: 17px;
  height: 17px;
  margin: 0;
  accent-color: var(--accent);
}

.none-toggle {
  width: fit-content;
  min-height: 36px;
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--muted);
  font-size: .78rem;
}

.none-toggle:hover,
.none-toggle:has(input:checked) {
  border: 0;
  background: transparent;
}

.none-toggle + textarea {
  margin-top: -1px;
}

.none-toggle:has(input:checked) + textarea {
  background: var(--surface-tint);
  color: var(--faint);
  text-decoration: line-through;
}

.day-row {
  margin-top: 2px;
}

.day-control {
  flex: 1 0 68px;
  justify-content: center;
  padding-right: 7px;
  padding-left: 7px;
}

.rep-identity {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(230px, 1.15fr) auto;
  align-items: center;
  gap: 22px;
  margin-top: 26px;
  padding: 18px 0 3px;
}

.rep-identity > div,
.profile-name-field {
  display: grid;
  min-width: 0;
  gap: 6px;
}

.rep-identity strong,
.rep-identity > div > span:not(.field-label) {
  overflow-wrap: anywhere;
  color: var(--ink-strong);
  font-size: .9rem;
}

.rep-identity input {
  width: 100%;
  min-height: 40px;
  border-color: var(--rule-strong);
  background: var(--surface);
}

.identity-lock {
  align-self: end;
  color: var(--muted);
  font-size: .7rem;
  font-weight: 700;
  white-space: nowrap;
}

.profile-title-field {
  display: grid;
  min-width: 0;
  gap: 6px;
}

.profile-title-field input {
  min-height: 40px;
  border-color: var(--rule-strong);
  background: var(--surface);
}

.profile-title-field .field-hint {
  margin-top: 0;
  color: var(--muted);
  font-size: .7rem;
  line-height: 1.4;
}

.profile-actions {
  display: grid;
  align-content: end;
  justify-items: start;
  gap: 5px;
  min-width: 130px;
}

.profile-actions .button {
  min-height: 34px;
  padding: 7px 9px;
  font-size: .72rem;
}

.profile-message {
  min-height: 1em;
  color: var(--muted);
  font-size: .68rem;
  line-height: 1.35;
}

.profile-message.is-error {
  color: var(--danger);
}

.profile-message.is-success {
  color: var(--accent-deep);
}

.test-mode-panel {
  margin-top: 24px;
  border: 1px solid var(--warning);
  border-radius: var(--radius-control);
  padding: 13px 15px;
  background: var(--warning-soft, #fff9e8);
}

.test-mode-toggle {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  color: var(--ink-strong);
  cursor: pointer;
}

.test-mode-toggle input {
  flex: 0 0 auto;
  margin-top: 3px;
}

.test-mode-toggle span {
  display: grid;
  gap: 4px;
}

.test-mode-toggle strong {
  font-size: .8rem;
}

.test-mode-toggle small {
  color: var(--muted);
  font-size: .72rem;
  line-height: 1.45;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 26px;
}

.form-action-note {
  max-width: 52ch;
  margin-top: 12px;
  margin-left: auto;
  text-align: right;
}

.review-rail {
  position: sticky;
  top: 24px;
  min-width: 0;
}

.rail-block {
  border-top: 1px solid var(--rule-strong);
  padding: 23px 0 26px;
}

.rail-block:last-child {
  border-bottom: 1px solid var(--rule-strong);
}

.rail-total {
  padding-top: 0;
}

.total-amount {
  display: block;
  margin-top: 14px;
  color: var(--ink-strong);
  font-family: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  font-size: clamp(2.35rem, 4vw, 3.45rem);
  letter-spacing: -.05em;
  line-height: 1;
}

.total-label {
  display: block;
  margin-top: 8px;
}

.rail-note {
  margin-top: 17px;
}

.checklist,
.signature-order {
  display: grid;
  gap: 13px;
  margin-top: 17px;
  padding: 0;
  list-style: none;
}

.checklist li,
.signature-order li {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  color: var(--muted);
  font-size: .77rem;
  line-height: 1.4;
}

.check-mark {
  flex: 0 0 16px;
  color: var(--faint);
  font-size: .88rem;
  line-height: 1.2;
}

.checklist li.is-complete {
  color: var(--ink);
}

.checklist li.is-complete .check-mark {
  color: var(--success);
}

.signature-order {
  counter-reset: signature;
}

.signature-order li span {
  flex: 0 0 19px;
  color: var(--accent);
  font-size: .66rem;
  font-weight: 800;
  letter-spacing: .05em;
}

.detail-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.detail-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(260px, .75fr);
  align-items: start;
  gap: 72px;
  margin-top: 52px;
}

.detail-sheet,
.timeline-panel {
  min-width: 0;
}

.detail-sheet {
  border-top: 1px solid var(--rule-strong);
}

.detail-status-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px;
  min-height: 72px;
  border-bottom: 1px solid var(--rule);
}

.detail-status-line > span:last-child {
  color: var(--muted);
  font-size: .78rem;
}

.detail-section {
  border-bottom: 1px solid var(--rule);
  padding: 26px 0;
}

.detail-section-last {
  border-bottom-color: var(--rule-strong);
}

.detail-list {
  display: grid;
  grid-template-columns: minmax(130px, .7fr) minmax(0, 1.3fr);
  gap: 13px 20px;
  margin-top: 18px;
}

.detail-list dd {
  overflow-wrap: anywhere;
  color: var(--ink-strong);
  font-size: .88rem;
}

.timeline-panel {
  border-top: 1px solid var(--rule-strong);
  padding-top: 23px;
}

.timeline {
  position: relative;
  display: grid;
  gap: 0;
  margin-top: 21px;
  padding: 0 0 0 21px;
  list-style: none;
}

.timeline::before {
  position: absolute;
  top: 6px;
  bottom: 6px;
  left: 4px;
  width: 1px;
  background: var(--rule-strong);
  content: "";
}

.timeline-item {
  position: relative;
  display: grid;
  gap: 5px;
  padding: 0 0 24px;
}

.timeline-item:last-child {
  padding-bottom: 4px;
}

.timeline-item::before {
  position: absolute;
  top: 5px;
  left: -21px;
  width: 9px;
  height: 9px;
  border: 2px solid var(--paper);
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
  content: "";
}

.timeline-label {
  color: var(--ink-strong);
  font-size: .85rem;
  font-weight: 800;
}

.timeline-meta,
.timeline-detail {
  color: var(--muted);
  font-size: .74rem;
}

.timeline-note {
  margin-top: 27px;
}

.modal {
  width: min(94vw, 1120px);
  max-width: 1120px;
  max-height: 92vh;
  margin: auto;
  border: 0;
  border-radius: var(--radius-dialog);
  padding: 0;
  background: var(--surface);
  box-shadow: var(--shadow-dialog), inset 0 1px 0 rgba(255, 255, 255, .16);
  color: var(--ink);
}

.modal::backdrop {
  background: rgba(13, 41, 39, .68);
}

.modal-shell {
  display: flex;
  max-height: 92vh;
  flex-direction: column;
}

.modal-header,
.modal-footer {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 24px 28px;
}

.modal-header {
  border-bottom: 1px solid var(--rule);
}

.modal-header h2 {
  margin-top: 7px;
  font-size: clamp(1.6rem, 3vw, 2.35rem);
}

.close-button {
  display: grid;
  width: 36px;
  height: 36px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius-control);
  background: transparent;
  color: var(--muted);
  font-size: 1.55rem;
  line-height: 1;
}

.close-button:hover {
  border-color: var(--accent);
  background: var(--surface-tint);
  color: var(--ink-strong);
}

.preview-body {
  display: grid;
  min-height: 0;
  grid-template-columns: minmax(220px, .7fr) minmax(360px, 1.3fr);
  gap: 28px;
  overflow: auto;
  padding: 28px;
}

.preview-copy {
  min-width: 0;
}

.preview-lede {
  color: var(--muted);
  font-size: .88rem;
}

.preview-facts,
.confirm-facts {
  display: grid;
  gap: 16px;
  margin-top: 24px;
}

.preview-facts > div,
.confirm-facts > div {
  display: grid;
  gap: 5px;
  border-bottom: 1px solid var(--rule);
  padding-bottom: 13px;
}

.preview-facts dd,
.confirm-facts dd {
  overflow-wrap: anywhere;
  color: var(--ink-strong);
  font-size: .88rem;
  font-weight: 700;
}

.preview-lock {
  margin-top: 24px;
  border-left: 2px solid var(--accent);
  padding-left: 12px;
  color: var(--muted);
  font-size: .77rem;
}

.pdf-preview {
  position: relative;
  min-height: 440px;
  overflow: hidden;
  border: 1px solid var(--rule-strong);
  border-radius: 8px;
  background: var(--surface-tint);
}

.pdf-preview iframe {
  display: block;
  width: 100%;
  height: min(62vh, 700px);
  min-height: 440px;
  border: 0;
  background: var(--white);
}

.pdf-loading,
.pdf-empty {
  display: grid;
  min-height: 440px;
  align-content: center;
  justify-items: center;
  gap: 10px;
  padding: 36px;
  text-align: center;
}

.pdf-loading p,
.pdf-empty p {
  max-width: 35ch;
  color: var(--muted);
  font-size: .8rem;
}

.pdf-empty-mark {
  display: grid;
  width: fit-content;
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius-control);
  padding: 6px 8px;
  color: var(--accent-deep);
  font-size: .7rem;
  font-weight: 800;
  letter-spacing: .08em;
}

.modal-footer {
  align-items: center;
  border-top: 1px solid var(--rule);
}

.confirm-body {
  max-width: 610px;
  overflow: auto;
  padding: 28px;
}

.confirm-body > p {
  color: var(--muted);
  font-size: .95rem;
}

.confirm-warning {
  border-left: 3px solid var(--warning);
  background: var(--warning-soft);
  padding: 11px 13px;
  color: var(--ink);
  font-size: .8rem !important;
}

.footer {
  display: flex;
  width: min(100%, var(--content-max));
  justify-content: space-between;
  gap: 20px;
  margin: auto;
  border-top: 1px solid var(--rule);
  padding: 19px 32px 24px;
  color: var(--muted);
  font-size: .72rem;
}

.footer a {
  color: var(--accent-deep);
  font-weight: 700;
  text-decoration: none;
}

.footer a:hover {
  text-decoration: underline;
}

[hidden] {
  display: none !important;
}

@media (max-width: 960px) {
  .topbar {
    grid-template-columns: 1fr auto;
  }

  .primary-nav {
    grid-column: 1 / -1;
    grid-row: 2;
    min-height: 42px;
    justify-content: flex-start;
    margin-top: -12px;
  }

  .session-cluster {
    grid-column: 2;
    grid-row: 1;
  }

  main {
    padding-top: 48px;
  }

  .form-layout,
  .detail-layout {
    grid-template-columns: minmax(0, 1fr);
    gap: 48px;
  }

  .review-rail {
    position: static;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 28px;
  }

  .rail-block,
  .rail-block:last-child {
    border-bottom: 1px solid var(--rule-strong);
  }

  .rail-total {
    border-top: 1px solid var(--rule-strong);
  }

  .detail-layout {
    gap: 46px;
  }

  .timeline-panel {
    max-width: 620px;
  }
}

@media (max-width: 720px) {
  .topbar {
    min-height: 110px;
    padding: 0 18px;
  }

  .brand-area {
    display: none;
  }

  main {
    padding: 42px 18px 58px;
  }

  .page-heading,
  .view-heading-row,
  .detail-heading-row {
    display: block;
  }

  .page-heading h1,
  .view-heading h1 {
    max-width: 14ch;
    font-size: clamp(2.35rem, 11vw, 3.35rem);
  }

  .heading-action {
    width: 100%;
    margin-top: 24px;
  }

  .stats-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-top: 42px;
  }

  .stat-item {
    min-height: 77px;
    padding-right: 14px;
  }

  .stat-item:nth-child(3) {
    border-top: 1px solid var(--rule);
    padding-left: 0;
  }

  .stat-item:nth-child(4) {
    border-top: 1px solid var(--rule);
  }

  .stat-item:nth-child(odd) {
    border-left: 0;
  }

  .stat-item:nth-child(even) {
    padding-left: 14px;
    border-left: 1px solid var(--rule);
  }

  .list-toolbar {
    align-items: stretch;
    flex-wrap: wrap;
  }

  .search-field {
    flex-basis: 100%;
    max-width: none;
  }

  .filter-field {
    flex: 1 1 180px;
  }

  .list-toolbar > .button {
    margin-left: 0;
  }

  .agreement-row {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 13px 14px;
    padding: 17px 0;
  }

  .agreement-customer {
    grid-column: 1 / -1;
  }

  .agreement-meta,
  .agreement-stage {
    align-self: start;
  }

  .agreement-action {
    grid-column: 2;
    grid-row: 2;
  }

  .agreement-row:hover {
    padding-right: 8px;
    padding-left: 8px;
  }

  .form-layout {
    margin-top: 40px;
  }

  .field-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .field-span-2 {
    grid-column: auto;
  }

  .rep-identity {
    grid-template-columns: minmax(0, 1fr);
    gap: 16px;
  }

  .profile-actions {
    align-content: start;
    justify-items: start;
  }

  .identity-lock {
    align-self: start;
  }

  .form-actions {
    flex-direction: column-reverse;
  }

  .form-actions .button {
    width: 100%;
  }

  .form-action-note {
    margin-left: 0;
    text-align: left;
  }

  .review-rail {
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
  }

  .rail-total {
    padding-top: 23px;
  }

  .detail-actions {
    justify-content: flex-start;
    margin-top: 24px;
  }

  .detail-actions .button {
    flex: 1 1 140px;
  }

  .detail-layout {
    margin-top: 40px;
  }

  .detail-list {
    grid-template-columns: minmax(110px, .8fr) minmax(0, 1.2fr);
    gap: 11px 14px;
  }

  .preview-body {
    grid-template-columns: minmax(0, 1fr);
    overflow: auto;
    padding: 22px 18px;
  }

  .pdf-preview,
  .pdf-loading,
  .pdf-empty {
    min-height: 320px;
  }

  .pdf-preview iframe {
    min-height: 320px;
    height: 60vh;
  }

  .modal-header,
  .modal-footer {
    padding: 19px 18px;
  }

  .modal-footer {
    flex-direction: column-reverse;
    align-items: stretch;
  }

  .modal-footer .button {
    width: 100%;
  }

  .confirm-body {
    padding: 22px 18px;
  }

  .footer {
    display: grid;
    padding: 17px 18px 22px;
  }
}

@media (max-width: 440px) {
  .topbar {
    gap: 14px;
  }

  .primary-nav {
    gap: 18px;
  }

  .session-presence {
    max-width: 130px;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .field-grid {
    gap: 20px;
  }

  .day-control {
    flex-basis: 62px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}
