:root {
  color-scheme: light;
  --ink: #111827;
  --muted: #667085;
  --line: #d8dee8;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --brand: #4f46e5;
  --accent: #b45309;
  --danger: #dc2626;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--surface-soft);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button { font: inherit; }

.signing-shell {
  display: grid;
  grid-template-columns: 220px 320px minmax(0, 1fr) 340px;
  min-height: 100vh;
}

.sidebar {
  padding: 18px 14px;
  background: #111827;
  color: white;
}

.brand-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 26px;
}

.logo {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 8px;
  background: var(--brand);
  font-weight: 800;
}

.nav-item {
  width: 100%;
  min-height: 42px;
  margin-bottom: 8px;
  padding: 0 12px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #cbd5e1;
  cursor: pointer;
  text-align: left;
}

.nav-item.active, .nav-item:hover {
  background: rgba(255, 255, 255, 0.1);
  color: white;
}

.document-list,
.document-workspace,
.checkout,
.document-card,
.selection-empty,
.selection-card,
.offer {
  border: 1px solid var(--line);
  background: var(--surface);
}

.document-list {
  padding: 20px;
  border-top: 0;
  border-bottom: 0;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--brand);
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1, h2, p { margin-top: 0; }

h1 {
  margin-bottom: 16px;
  font-size: clamp(1.7rem, 4vw, 2.55rem);
  line-height: 1;
  letter-spacing: 0;
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  color: var(--muted);
}

.status-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #94a3b8;
}

.status-dot.ok { background: var(--brand); }
.status-dot.warn { background: var(--danger); }

.document-card {
  display: grid;
  gap: 6px;
  margin-bottom: 10px;
  padding: 14px;
  border-radius: 8px;
  cursor: pointer;
}

.document-card.active {
  border-color: var(--brand);
  box-shadow: inset 0 0 0 1px var(--brand);
}

.document-card span,
.workspace-header span,
.routing span,
.fine-print,
.offer p {
  color: var(--muted);
}

.document-workspace {
  display: grid;
  grid-template-rows: auto minmax(360px, 1fr) auto;
  gap: 18px;
  padding: 20px;
  border-top: 0;
  border-bottom: 0;
}

.workspace-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.workspace-header strong {
  display: block;
  margin-top: 4px;
}

.workspace-header button,
.offer button {
  min-height: 38px;
  border: 0;
  border-radius: 8px;
  background: var(--ink);
  color: white;
  cursor: pointer;
  font-weight: 700;
}

.workspace-header button { padding: 0 14px; }

.paper {
  position: relative;
  align-self: stretch;
  max-width: 680px;
  width: 100%;
  margin: 0 auto;
  padding: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  box-shadow: 0 18px 42px rgba(15, 23, 42, 0.1);
}

.paper-line {
  height: 14px;
  width: 72%;
  margin-bottom: 18px;
  border-radius: 999px;
  background: #e5e7eb;
}

.paper-line.wide { width: 92%; }
.paper-line.short { width: 48%; }

.field {
  position: absolute;
  display: grid;
  place-items: center;
  min-height: 52px;
  border: 2px dashed var(--brand);
  border-radius: 8px;
  color: var(--brand);
  font-weight: 800;
}

.field.signature {
  right: 42px;
  bottom: 96px;
  width: 220px;
}

.field.date {
  right: 42px;
  bottom: 32px;
  width: 140px;
}

.routing {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.routing div {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdff;
}

.routing strong {
  display: block;
  margin-top: 6px;
}

.checkout {
  position: sticky;
  top: 0;
  min-height: 100vh;
  padding: 22px;
  border-top: 0;
  border-right: 0;
  border-bottom: 0;
}

.offers {
  display: grid;
  gap: 12px;
  margin-bottom: 14px;
}

.offer {
  display: grid;
  gap: 8px;
  padding: 14px;
  border-radius: 8px;
}

.price {
  color: var(--brand);
  font-weight: 800;
}

.selection-empty,
.selection-card {
  min-height: 110px;
  margin: 14px 0;
  padding: 14px;
  border-radius: 8px;
}

.selection-empty {
  display: grid;
  place-items: center;
  text-align: center;
  color: var(--muted);
  background: var(--surface-soft);
}

.primary-button {
  width: 100%;
  min-height: 44px;
  border: 0;
  border-radius: 8px;
  background: var(--brand);
  color: white;
  cursor: pointer;
  font-weight: 800;
}

.primary-button:disabled {
  cursor: not-allowed;
  background: #9ca3af;
}

@media (max-width: 1180px) {
  .signing-shell { grid-template-columns: 190px 300px minmax(0, 1fr); }
  .checkout {
    position: static;
    grid-column: 2 / -1;
    min-height: auto;
    margin: 0 20px 20px;
    border: 1px solid var(--line);
    border-radius: 8px;
  }
}

@media (max-width: 840px) {
  .signing-shell { grid-template-columns: 1fr; }
  .sidebar { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
  .brand-row { grid-column: 1 / -1; margin-bottom: 8px; }
  .document-list, .document-workspace { border-left: 0; border-right: 0; }
  .checkout { grid-column: 1; margin: 18px; }
  .routing { grid-template-columns: 1fr; }
  .field.signature, .field.date { left: 42px; right: auto; }
}


.legal-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: center;
  justify-content: center;
  padding: 18px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  background: var(--surface);
}

.legal-footer a,
.back-link {
  color: var(--brand);
  font-weight: 700;
  text-decoration: none;
}

.legal-page {
  width: min(720px, calc(100% - 36px));
  margin: 0 auto;
  padding: 48px 0;
  line-height: 1.7;
}

.legal-page h1 {
  margin: 18px 0;
  font-size: 2rem;
}

.auth-panel {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid rgba(148, 163, 184, 0.28);
}

.auth-panel h2 {
  margin: 0 0 12px;
  font-size: 1rem;
}

.auth-grid {
  display: grid;
  gap: 10px;
}

.auth-grid label {
  display: grid;
  gap: 5px;
  font-size: 0.85rem;
  color: inherit;
}

.auth-grid input {
  width: 100%;
  min-height: 40px;
  border: 1px solid rgba(148, 163, 184, 0.45);
  border-radius: 6px;
  padding: 0 10px;
  font: inherit;
  color: inherit;
  background: rgba(255, 255, 255, 0.9);
}

.auth-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.auth-actions button {
  min-height: 38px;
  border: 0;
  border-radius: 6px;
  padding: 0 12px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.auth-status {
  min-height: 20px;
  margin: 10px 0 0;
  font-size: 0.85rem;
}

.auth-status[data-state="error"] {
  color: #b91c1c;
}

.auth-status[data-state="ok"] {
  color: #047857;
}
