:root {
  --brand: #4f46e5;
  --brand-dark: #312e81;
  --brand-soft: #eef2ff;
  --accent: #14b8a6;
  --button-brand: #4f46e5;
  --bg: #f8fafc;
  --card: #fff;
  --line: #e5e7eb;
  --line-strong: #d8dee9;
  --ink: #111827;
  --muted: #6b7280;
  --muted-light: #94a3b8;
  --success: #15803d;
  --success-bg: #dcfce7;
  --warning: #b45309;
  --warning-bg: #fff7ed;
  --danger: #b91c1c;
  --danger-bg: #fef2f2;
  --blue: #2563eb;
  --blue-bg: #eff6ff;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .05);
  --shadow-md: 0 14px 34px rgba(15, 23, 42, .08);
  --shadow-lg: 0 24px 60px rgba(15, 23, 42, .13);
  --radius: 16px;
}

* { box-sizing: border-box; }

html {
  color-scheme: light;
  scroll-behavior: smooth;
}

::selection {
  color: #fff;
  background: rgba(79, 70, 229, .9);
}

[hidden] { display: none !important; }

body {
  margin: 0;
  min-height: 100vh;
  display: grid;
  grid-template-columns: 272px minmax(0, 1fr);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
  font-weight: 400;
  color: var(--ink);
  background:
    radial-gradient(circle at top right, rgba(79, 70, 229, .08), transparent 32rem),
    var(--bg);
}

body[data-view="sign"],
body[data-view="login"] {
  grid-template-columns: 1fr;
}

body[data-view="sign"] aside,
body[data-view="login"] aside {
  display: none;
}

aside {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: hidden;
  padding: 24px 20px;
  background: rgba(255, 255, 255, .78);
  border-right: 1px solid var(--line);
  backdrop-filter: blur(18px);
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  align-content: start;
  gap: 20px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--brand-dark);
  font-size: 20px;
  font-weight: 600;
  letter-spacing: 0;
}

.brand span {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--brand), var(--brand-dark));
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 14px 28px rgba(79, 70, 229, .24);
}

.brand strong { font-weight: 600; }

.nav-stack {
  display: grid;
  gap: 6px;
}

button,
.mini-button {
  min-height: 42px;
  border: 0;
  border-radius: 12px;
  padding: 0 16px;
  cursor: pointer;
  font: inherit;
  font-weight: 600;
  color: #fff;
  background: linear-gradient(135deg, var(--button-brand), var(--brand-dark));
  box-shadow: 0 12px 24px rgba(79, 70, 229, .22);
  transform-origin: center;
  transition: transform .18s cubic-bezier(.2, .8, .2, 1), box-shadow .18s ease, background .18s ease, border-color .18s ease, opacity .18s ease;
  will-change: transform;
}

button:focus-visible,
.mini-button:focus-visible,
input:focus-visible,
a:focus-visible,
canvas:focus-visible {
  outline: 3px solid rgba(79, 70, 229, .35);
  outline-offset: 3px;
}

button:disabled,
button.quiet:disabled,
.mini-button[aria-disabled="true"] {
  cursor: not-allowed;
  opacity: 1;
  color: #64748b;
  background: #e5e7eb;
  border-color: transparent;
  box-shadow: none;
  transform: none;
}

button.is-loading {
  position: relative;
  padding-left: 42px;
}

button.is-loading::before {
  content: "";
  position: absolute;
  left: 17px;
  width: 14px;
  height: 14px;
  border-radius: 999px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  animation: spin .7s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

button:hover,
.mini-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 18px 34px rgba(79, 70, 229, .28);
}

button:active,
.mini-button:active {
  transform: translateY(0) scale(.985);
}

button.tap-bounce,
.mini-button.tap-bounce {
  animation: tapBounce .22s cubic-bezier(.2, .8, .2, 1);
}

aside button {
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 10px;
  text-align: left;
  background: transparent;
  color: #475569;
  box-shadow: none;
  font-weight: 500;
}

aside button:hover {
  background: #f1f5f9;
  color: var(--ink);
  box-shadow: none;
}

aside button.active {
  position: relative;
  background: var(--brand-soft);
  color: var(--brand-dark);
}

aside button.active::before {
  content: "";
  position: absolute;
  left: -10px;
  width: 4px;
  height: 22px;
  border-radius: 999px;
  background: var(--brand);
}

.notification-nav-button {
  position: relative;
}

#notification-badge {
  margin-left: auto;
  min-width: 22px;
  height: 22px;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  padding: 0 6px;
  color: #fff;
  background: #ef4444;
  font-size: 11px;
  font-weight: 700;
  box-shadow: 0 8px 18px rgba(239, 68, 68, .28);
}

aside svg {
  width: 18px;
  height: 18px;
  stroke-width: 1.9;
}

.logout-button {
  margin-top: 8px;
  color: #64748b;
}

main {
  width: min(1600px, 100%);
  min-width: 0;
  margin: 0 auto;
  padding: 34px 38px 52px;
  display: grid;
  gap: 18px;
  overflow-x: hidden;
  animation: pageIn .28s ease both;
}

.view-entering {
  animation: viewEnter .34s cubic-bezier(.2, .8, .2, 1) both;
}

@keyframes pageIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes viewEnter {
  from { opacity: 0; transform: translateY(10px); filter: blur(2px); }
  to { opacity: 1; transform: translateY(0); filter: blur(0); }
}

@keyframes tapBounce {
  0% { transform: translateY(0) scale(1); }
  45% { transform: translateY(1px) scale(.975); }
  100% { transform: translateY(0) scale(1); }
}

header,
.page-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
}

.eyebrow {
  margin-bottom: 6px;
  color: var(--brand);
  font-size: 13px;
  font-weight: 600;
}

h1 {
  margin: 0;
  color: var(--ink);
  font-size: 29px;
  line-height: 1.12;
  font-weight: 600;
  letter-spacing: -.01em;
}

h2 {
  margin: 0;
  color: var(--ink);
  font-size: 17px;
  line-height: 1.25;
  font-weight: 600;
}

p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
  font-weight: 400;
}

.panel,
.premium-panel,
.login-card,
.empty-state {
  background: rgba(255, 255, 255, .92);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}

.premium-panel {
  padding: 22px;
  box-shadow: var(--shadow-md);
}

#login-view {
  min-height: calc(100vh - 80px);
  display: grid;
  place-items: center;
}

.login-card {
  width: min(520px, 100%);
  display: grid;
  gap: 16px;
  padding: 30px;
  box-shadow: var(--shadow-lg);
}

.login-form {
  display: grid;
  gap: 16px;
}

.login-lede {
  margin: 0;
  color: #475569;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.55;
}

html.signing-entry aside,
html.signing-entry #admin-view,
html.signing-entry #dashboard-view,
html.signing-entry #login-view,
html.signing-entry #list-view,
html.signing-entry #details-view,
html.signing-entry #templates-view,
html.signing-entry #settings-view,
html.signing-entry #profile-view {
  display: none !important;
}

.login-brand { margin-bottom: 4px; }

.login-note {
  min-height: 22px;
  color: var(--warning);
  font-size: 14px;
  font-weight: 600;
}

.grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  gap: 14px;
}

label {
  position: relative;
  display: grid;
  gap: 8px;
  color: #475569;
  font-size: 14px;
  font-weight: 600;
}

label > span {
  color: #475569;
  font-weight: 600;
}

input,
select,
textarea {
  min-height: 44px;
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  padding: 10px 14px;
  font: inherit;
  color: var(--ink);
  background: #fff;
  outline: none;
  transition: border-color .16s ease, box-shadow .16s ease, transform .16s ease;
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(79, 70, 229, .8);
  box-shadow: 0 0 0 4px rgba(79, 70, 229, .12);
}

input::placeholder { color: #94a3b8; }

textarea {
  resize: vertical;
  line-height: 1.45;
}

textarea::placeholder { color: #94a3b8; }

.upload-section,
.template-name-line,
.expiry-line,
.envelope-email-fields { margin-top: 12px; }

.envelope-email-fields {
  display: grid;
  gap: 12px;
}

.recipient-options {
  margin-top: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: linear-gradient(180deg, #fff, #f8fafc);
  box-shadow: var(--shadow-sm);
}

.recipient-options-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}

.recipient-options h2 {
  margin: 0 0 4px;
  font-size: 16px;
  font-weight: 700;
}

.recipient-options p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
}

.toggle-line {
  display: inline-flex;
  grid-template-columns: none;
  align-items: center;
  gap: 8px;
  min-width: max-content;
  color: var(--ink);
}

.toggle-line input {
  width: 18px;
  min-height: 18px;
  accent-color: var(--primary);
}

.extra-signers {
  display: grid;
  gap: 10px;
}

.recipient-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  align-items: center;
  gap: 10px;
}

.add-signer-button {
  min-height: 38px;
  width: max-content;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 14px;
  color: var(--brand-dark);
  background: var(--brand-soft);
  border: 1px solid rgba(79, 70, 229, .14);
  box-shadow: none;
}

.add-signer-button:hover {
  background: #fff;
  box-shadow: var(--shadow-sm);
}

.add-signer-button svg {
  width: 17px;
  height: 17px;
}

.cc-line {
  margin-top: 12px;
}

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

.upload-section {
  display: grid;
  gap: 12px;
}

.upload-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
}

.upload-heading span {
  display: block;
  color: #475569;
  font-size: 14px;
  font-weight: 700;
}

.upload-heading p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.upload-heading button {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 14px;
  border-radius: 12px;
  font-size: 13px;
}

.upload-heading button svg,
.upload-dropzone svg,
.upload-item svg,
.icon-button svg {
  width: 18px;
  height: 18px;
}

.upload-dropzone {
  min-height: 118px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 20px;
  border: 1.5px dashed #cbd5e1;
  border-radius: 18px;
  color: #334155;
  background:
    radial-gradient(circle at top right, rgba(79, 70, 229, .08), transparent 18rem),
    linear-gradient(180deg, #fff, #f8fafc);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .9);
  cursor: pointer;
  transition: transform .18s ease, border-color .18s ease, background .18s ease, box-shadow .18s ease;
}

.upload-dropzone:hover,
.upload-dropzone:focus-visible,
.upload-dropzone.is-dragover {
  transform: translateY(-2px);
  border-color: rgba(79, 70, 229, .72);
  background:
    radial-gradient(circle at top right, rgba(79, 70, 229, .14), transparent 18rem),
    #fff;
  box-shadow: 0 18px 44px rgba(79, 70, 229, .12);
  outline: none;
}

.upload-dropzone.is-dragover {
  animation: uploadPulse .82s ease-in-out infinite alternate;
}

.upload-icon {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 15px;
  color: var(--brand);
  background: var(--brand-soft);
}

.upload-dropzone strong {
  display: block;
  font-size: 15px;
  font-weight: 800;
}

.upload-dropzone p {
  margin: 5px 0 0;
  color: var(--muted);
}

.upload-progress {
  height: 8px;
  border-radius: 999px;
  background: #e5e7eb;
  overflow: hidden;
}

.upload-progress span {
  display: block;
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--brand), #14b8a6);
  transition: width .22s ease;
}

.upload-list {
  display: grid;
  gap: 10px;
}

.upload-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
  box-shadow: var(--shadow-sm);
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}

.upload-item.active {
  border-color: rgba(79, 70, 229, .42);
  box-shadow: 0 14px 34px rgba(79, 70, 229, .10);
}

.upload-item:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.upload-item-main {
  min-height: 52px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  padding: 0;
  border: 0;
  color: var(--ink);
  background: transparent;
  box-shadow: none;
  text-align: left;
}

.upload-item-main:hover {
  transform: none;
  box-shadow: none;
}

.upload-item-main strong,
.upload-item-main small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.upload-item-main small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.icon-button {
  width: 38px;
  height: 38px;
  min-height: 38px;
  display: grid;
  place-items: center;
  padding: 0;
  border-radius: 12px;
  color: #64748b;
  background: #f8fafc;
  box-shadow: none;
}

.icon-button:hover {
  color: var(--danger);
  background: var(--danger-bg);
  box-shadow: var(--shadow-sm);
}

@keyframes uploadPulse {
  from { box-shadow: 0 18px 44px rgba(79, 70, 229, .12); }
  to { box-shadow: 0 24px 60px rgba(79, 70, 229, .22); }
}

.actions {
  margin-top: 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.actions button {
  min-height: 44px;
  padding: 0 20px;
  font-size: 14px;
}

.document-sent-view {
  display: grid;
  gap: 22px;
  margin: 18px 0 24px;
  padding: clamp(28px, 5vw, 56px);
  border: 1px solid rgba(21, 128, 61, .18);
  border-radius: 32px;
  background:
    radial-gradient(circle at 18% 12%, rgba(34, 197, 94, .18), transparent 34%),
    radial-gradient(circle at 86% 2%, rgba(79, 70, 229, .10), transparent 28%),
    linear-gradient(135deg, #f7fff9 0%, #ffffff 55%, #f8fafc 100%);
  box-shadow: 0 28px 80px rgba(15, 23, 42, .10);
  opacity: 0;
  transform: translateY(14px) scale(.992);
  transition: opacity .32s ease, transform .32s ease, box-shadow .32s ease;
}

.document-sent-view[hidden] {
  display: none;
}

.document-sent-view.is-visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.sent-hero {
  max-width: 760px;
}

.sent-success-orb {
  width: 92px;
  height: 92px;
  display: grid;
  place-items: center;
  margin-bottom: 22px;
  border-radius: 999px;
  color: #047857;
  background:
    radial-gradient(circle at 50% 40%, rgba(255, 255, 255, .96), rgba(220, 252, 231, .92)),
    #dcfce7;
  box-shadow: 0 18px 46px rgba(22, 163, 74, .22);
  animation: sentSuccessPop .52s cubic-bezier(.2, .95, .25, 1.18) both;
}

.sent-success-orb svg {
  width: 46px;
  height: 46px;
  stroke-width: 3;
}

.sent-hero h2 {
  margin: 4px 0 10px;
  font-size: clamp(34px, 5vw, 58px);
  line-height: 1.02;
  letter-spacing: -0.03em;
}

.sent-hero p:last-child {
  max-width: 660px;
  color: #52627a;
  font-size: 18px;
  line-height: 1.6;
}

.sent-summary-card {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 1px;
  overflow: hidden;
  border: 1px solid #e5e7eb;
  border-radius: 22px;
  background: #e5e7eb;
  box-shadow: 0 18px 48px rgba(15, 23, 42, .08);
}

.sent-summary-card > div {
  min-width: 0;
  padding: 18px;
  background: rgba(255, 255, 255, .94);
}

.sent-summary-card span {
  display: block;
  margin-bottom: 7px;
  color: #64748b;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.sent-summary-card strong {
  display: block;
  overflow: hidden;
  color: #0f172a;
  font-size: 15px;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sent-status-pill {
  display: inline-flex !important;
  width: fit-content;
  max-width: 100%;
  align-items: center;
  padding: 7px 11px;
  border-radius: 999px;
  color: #92400e !important;
  background: #fffbeb;
  border: 1px solid #fde68a;
}

.sent-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

.sent-actions button {
  min-height: 48px;
  padding: 0 22px;
  border-radius: 14px;
  font-size: 14px;
  font-weight: 800;
}

.sent-actions button:first-child {
  background: linear-gradient(135deg, #4f46e5, #312e81);
  box-shadow: 0 16px 34px rgba(79, 70, 229, .24);
}

@keyframes sentSuccessPop {
  0% {
    opacity: 0;
    transform: scale(.76);
  }
  65% {
    transform: scale(1.06);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

@media (max-width: 980px) {
  .sent-summary-card {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .document-sent-view {
    border-radius: 24px;
    padding: 24px;
  }

  .sent-success-orb {
    width: 76px;
    height: 76px;
  }

  .sent-summary-card {
    grid-template-columns: 1fr;
  }

  .sent-actions {
    display: grid;
  }

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

.quiet,
button.quiet {
  background: #eef2f7;
  color: #245f73;
  border: 1px solid transparent;
  box-shadow: none;
}

.quiet:hover,
button.quiet:hover {
  background: #e6edf5;
  box-shadow: none;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  gap: 12px;
}

.metric-card {
  min-height: 112px;
  display: grid;
  gap: 8px;
  align-content: start;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: var(--shadow-sm);
  transition: transform .18s ease, box-shadow .18s ease;
}

.metric-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.metric-card svg {
  width: 22px;
  height: 22px;
  color: var(--brand);
}

.metric-card span {
  color: var(--muted);
  font-size: 14px;
}

.metric-card strong {
  color: var(--ink);
  font-size: 28px;
  font-weight: 600;
}

.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.dashboard-header {
  align-items: center;
}

.dashboard-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.dashboard-actions button,
.quick-actions button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
}

.dashboard-actions svg,
.quick-actions svg {
  width: 18px;
  height: 18px;
}

.dashboard-metrics {
  grid-template-columns: repeat(auto-fit, minmax(168px, 1fr));
}

.dashboard-metrics .metric-card {
  min-height: 126px;
  position: relative;
  overflow: hidden;
}

.dashboard-metrics .metric-card::after {
  content: "";
  position: absolute;
  right: -34px;
  top: -34px;
  width: 82px;
  height: 82px;
  border-radius: 999px;
  background: rgba(79, 70, 229, .07);
}

.metric-card small {
  display: none;
  color: var(--muted-light);
  font-size: 12px;
  font-weight: 500;
}

.metric-highlight {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .95), rgba(255, 255, 255, .88)),
    radial-gradient(circle at top right, rgba(79, 70, 229, .18), transparent 60%);
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(320px, .75fr);
  gap: 14px;
  align-items: stretch;
}

.dashboard-grid.lower {
  grid-template-columns: minmax(360px, .9fr) minmax(0, 1.1fr);
}

.panel-pill {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: #475569;
  background: #fff;
  font-size: 12px;
  font-weight: 600;
}

.chart-panel {
  min-height: 286px;
}

.contracts-chart {
  height: 196px;
  display: grid;
  grid-template-columns: repeat(14, minmax(20px, 1fr));
  align-items: end;
  gap: 10px;
  padding: 10px 4px 0;
}

.chart-day {
  min-width: 0;
  height: 180px;
  display: grid;
  grid-template-rows: 22px 1fr 20px;
  align-items: end;
  justify-items: center;
  gap: 8px;
}

.chart-value {
  height: 18px;
  color: var(--brand-dark);
  font-size: 11px;
  font-weight: 600;
}

.chart-track {
  width: 100%;
  height: 126px;
  display: flex;
  align-items: end;
  justify-content: center;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(241, 245, 249, .7), rgba(241, 245, 249, .35));
  overflow: hidden;
}

.chart-track span {
  width: min(28px, 72%);
  display: block;
  border-radius: 999px 999px 6px 6px;
  background: linear-gradient(180deg, #818cf8, var(--brand));
  box-shadow: 0 12px 22px rgba(79, 70, 229, .22);
  animation: barRise .42s cubic-bezier(.2, .8, .2, 1) both;
}

.chart-day small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
}

@keyframes barRise {
  from { height: 8px; opacity: .45; }
}

.quick-actions-panel {
  min-height: 286px;
}

.quick-actions {
  display: grid;
  gap: 10px;
}

.quick-actions button {
  min-height: 58px;
  justify-content: flex-start;
  padding: 12px;
  text-align: left;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  box-shadow: var(--shadow-sm);
}

.quick-actions button:first-child {
  border-color: transparent;
  color: #fff;
  background: linear-gradient(135deg, var(--brand), var(--brand-dark));
  box-shadow: 0 18px 34px rgba(79, 70, 229, .22);
}

.quick-actions button > span {
  display: grid;
  gap: 2px;
}

.quick-actions strong {
  font-size: 14px;
  font-weight: 600;
}

.quick-actions small {
  display: none;
  color: currentColor;
  opacity: .7;
  font-size: 12px;
  font-weight: 500;
}

.activity-timeline {
  position: relative;
  display: grid;
  gap: 12px;
}

.activity-timeline::before {
  content: "";
  position: absolute;
  left: 19px;
  top: 12px;
  bottom: 12px;
  width: 1px;
  background: var(--line);
}

.timeline-item {
  position: relative;
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
}

.timeline-item > span {
  position: relative;
  z-index: 1;
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  color: var(--brand);
  box-shadow: var(--shadow-sm);
}

.timeline-item.success > span {
  color: var(--success);
  background: var(--success-bg);
  border-color: rgba(21, 128, 61, .18);
}

.timeline-item svg {
  width: 18px;
  height: 18px;
}

.timeline-item strong {
  display: block;
  color: var(--ink);
  font-weight: 600;
}

.timeline-item p {
  margin-top: 2px;
  font-size: 13px;
}

.dashboard-recent {
  display: grid;
  gap: 10px;
}

.template-context {
  margin-top: 14px;
  padding: 12px 14px;
  border: 1px solid #c7d2fe;
  border-radius: 12px;
  color: var(--brand-dark);
  background: var(--brand-soft);
  font-weight: 600;
}

.template-list {
  display: grid;
  gap: 12px;
}

.template-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fff;
  box-shadow: var(--shadow-sm);
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}

.template-card:hover {
  transform: translateY(-2px);
  border-color: #d7ddf3;
  box-shadow: var(--shadow-md);
}

.template-main {
  min-width: 0;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 14px;
  align-items: center;
}

.template-main strong {
  display: block;
  color: var(--ink);
  font-size: 16px;
  font-weight: 600;
}

.template-main p,
.template-main small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.template-main small {
  margin-top: 2px;
  color: var(--muted-light);
  font-size: 12px;
  font-weight: 500;
}

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

.template-actions .mini-button {
  min-height: 38px;
  padding: 0 12px;
  font-size: 13px;
}

.template-preview-card {
  width: min(1120px, calc(100vw - 36px));
  max-height: calc(100vh - 36px);
  overflow: hidden;
  padding: 0;
}

.template-preview-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
}

.template-preview-document {
  width: 100%;
  max-height: calc(100vh - 150px);
  overflow: auto;
  padding: 20px;
  background: #e8eef6;
}

.recent-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}

.recent-item:hover {
  transform: translateY(-1px);
  border-color: #d7ddf3;
  box-shadow: var(--shadow-sm);
}

.recent-item strong {
  display: block;
  font-weight: 600;
}

.recent-item p {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.document-icon {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  color: var(--brand);
  background: var(--brand-soft);
}

.document-icon svg {
  width: 20px;
  height: 20px;
}

.prepare-layout { display: block; }

.workspace {
  background: #e8eef6;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 22px;
  overflow: auto;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .7);
}

.document {
  width: min(860px, 100%);
  min-height: 460px;
  margin: 0 auto;
  display: grid;
  gap: 20px;
}

.pdf-page {
  position: relative;
  margin: 0 auto;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 24px 58px rgba(15, 23, 42, .16);
}

.pdf-canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.field-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.empty {
  min-height: 460px;
  display: grid;
  place-items: center;
  color: var(--muted);
  background: #fff;
  border: 1px dashed var(--line-strong);
  border-radius: 18px;
  box-shadow: var(--shadow-md);
}

.field-rail {
  position: static;
  min-height: 0;
  align-self: stretch;
  display: grid;
  align-content: start;
  gap: 10px;
  padding-top: 18px;
  padding-bottom: 8px;
  border-top: 1px solid var(--line);
  overflow-y: auto;
}

.field-rail h2 {
  font-size: 17px;
}

.field-rail p {
  color: var(--muted);
  font-size: 13px;
}

.field-owner-control {
  gap: 6px;
}

.field-owner-control span {
  font-size: 12px;
  color: var(--muted);
}

.field-owner-control select {
  min-height: 38px;
  border-radius: 10px;
  font-size: 13px;
}

.field-tool {
  min-height: 58px;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  padding: 11px;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  color: var(--ink);
  cursor: grab;
  box-shadow: var(--shadow-sm);
  transition: transform .18s cubic-bezier(.2, .8, .2, 1), box-shadow .18s ease, border-color .18s ease, background .18s ease;
  will-change: transform;
}

.field-tool:hover {
  background: #fbfdff;
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.field-tool:active {
  cursor: grabbing;
  transform: translateY(-1px) scale(1.02);
}

.field-tool.is-dragging {
  cursor: grabbing;
  border-color: rgba(79, 70, 229, .45);
  transform: translateY(-2px) scale(1.035) rotate(-1deg);
  box-shadow: 0 22px 44px rgba(79, 70, 229, .22);
}

.field-tool svg {
  width: 34px;
  height: 34px;
  padding: 8px;
  border-radius: 11px;
  color: var(--brand);
  background: var(--brand-soft);
}

.field-tool span {
  display: grid;
  gap: 2px;
}

.field-tool strong {
  color: var(--ink);
  font-weight: 600;
}

.field-tool small {
  display: none;
  color: var(--muted);
  font-size: 12px;
  font-weight: 400;
}

.field-drag-ghost {
  position: fixed;
  z-index: 9999;
  pointer-events: none;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  border: 1px solid rgba(79, 70, 229, .55);
  border-radius: 14px;
  padding: 10px 13px;
  background: rgba(255, 255, 255, .96);
  color: var(--brand-dark);
  font-weight: 600;
  transform: scale(1.05) rotate(-1.5deg);
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(14px);
  animation: ghostFloat .36s cubic-bezier(.2, .8, .2, 1) both;
}

.ghost-dot {
  width: 12px;
  height: 12px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--brand), var(--brand-dark));
  box-shadow: 0 0 0 5px rgba(79, 70, 229, .12);
}

@keyframes ghostFloat {
  from { opacity: 0; transform: scale(.92) rotate(-2deg) translateY(4px); }
  to { opacity: 1; transform: scale(1.05) rotate(-1.5deg) translateY(0); }
}

.page-tools {
  margin-top: 8px;
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 8px;
}

.field-rail .page-tools {
  display: grid;
  gap: 8px;
}

.page-tools label,
.field-rail .page-tools label {
  width: 100%;
}

.page-tools input {
  text-align: center;
  font-weight: 600;
}

.field-rail .page-tools button.quiet {
  width: 100%;
  justify-content: center;
  border: 1px solid var(--line);
  background: #fff;
  color: #245f73;
}

.field-rail .help {
  margin-top: 2px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.field {
  position: absolute;
  z-index: 5;
  pointer-events: auto;
  min-width: 86px;
  min-height: 30px;
  border: 1.5px solid var(--brand);
  border-radius: 10px;
  display: inline-grid;
  grid-template-columns: 22px 1fr;
  align-items: stretch;
  overflow: hidden;
  background: rgba(255, 255, 255, .94);
  color: var(--brand-dark);
  box-shadow: 0 10px 22px rgba(79, 70, 229, .18);
  cursor: grab;
  touch-action: none;
  user-select: none;
  font-size: 12px;
  font-weight: 600;
  transition: transform .16s cubic-bezier(.2, .8, .2, 1), box-shadow .16s ease, border-color .16s ease;
  will-change: transform;
}

.field-delete {
  position: absolute;
  top: -9px;
  right: -9px;
  z-index: 3;
  width: 20px;
  height: 20px;
  border: 1px solid rgba(226, 232, 240, .95);
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: #fff;
  color: #475569;
  box-shadow: 0 8px 18px rgba(15, 23, 42, .16);
  cursor: pointer;
  font-size: 15px;
  line-height: 1;
  opacity: 0;
  transform: scale(.86);
  transition: opacity .14s ease, transform .14s ease, color .14s ease, background .14s ease;
}

.field:hover .field-delete,
.field:focus-visible .field-delete,
.field-delete:hover {
  opacity: 1;
  transform: scale(1);
}

.field-delete:hover {
  background: #fef2f2;
  color: #dc2626;
}

.field:hover {
  transform: translateY(-1px);
  box-shadow: 0 16px 28px rgba(79, 70, 229, .23);
}

.field.is-dragging {
  z-index: 20;
  cursor: grabbing;
  border-color: #6366f1;
  transform: translateY(-2px) scale(1.035) rotate(-.8deg);
  box-shadow: 0 24px 44px rgba(79, 70, 229, .26);
}

.field-attention {
  animation: fieldAttention 1.1s ease both;
}

@keyframes fieldAttention {
  0% {
    transform: scale(1);
    box-shadow: 0 10px 22px rgba(79, 70, 229, .18);
  }
  35% {
    transform: scale(1.08);
    box-shadow: 0 0 0 8px rgba(79, 70, 229, .16), 0 24px 44px rgba(79, 70, 229, .28);
  }
  100% {
    transform: scale(1);
    box-shadow: 0 10px 22px rgba(79, 70, 229, .18);
  }
}

.field.signature,
.field.name,
.field.email,
.field.text { min-width: 112px; }
.field.checkbox { min-width: 28px; min-height: 28px; width: 28px; height: 28px; }

.field-required-badge {
  position: absolute;
  top: -7px;
  left: -7px;
  z-index: 3;
  width: 16px;
  height: 16px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: #b91c1c;
  color: #fff;
  font-size: 10px;
  font-weight: 800;
}

.field-optional {
  border-style: dashed;
}

.field-resize {
  position: absolute;
  right: -5px;
  bottom: -5px;
  z-index: 4;
  width: 12px;
  height: 12px;
  border-radius: 3px;
  background: var(--brand);
  cursor: nwse-resize;
  box-shadow: 0 0 0 2px #fff;
}

.consent-disclosure {
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #f8fafc;
  color: #475569;
}

.consent-disclosure summary {
  cursor: pointer;
  font-weight: 700;
  color: var(--brand-dark);
}

.consent-disclosure p {
  margin-top: 8px;
  font-size: 13px;
  line-height: 1.5;
}

.sign-complete-actions {
  display: grid;
  gap: 10px;
  width: 100%;
}

.sign-complete-actions a,
.sign-complete-actions .mini-button {
  width: 100%;
  justify-content: center;
}

#decline-signing {
  width: 100%;
}

.field-required-toggle {
  font-size: 12px;
}

.grip {
  display: grid;
  place-items: center;
  background: var(--brand);
  color: #fff;
}

.label {
  display: grid;
  place-items: center;
  padding: 6px 9px;
  white-space: nowrap;
}

.field-signer {
  position: absolute;
  right: 4px;
  bottom: -15px;
  max-width: 110px;
  padding: 1px 5px;
  border-radius: 999px;
  background: #eef2ff;
  color: var(--primary);
  font-size: 9px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  box-shadow: var(--shadow-sm);
}

.signature-mark {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 3px 6px;
  background: #fff;
}

.field.signed {
  grid-template-columns: 1fr;
  cursor: default;
  background: rgba(79, 70, 229, .08);
}

.field.signed .grip { display: none; }
.field:disabled { opacity: 1; }

.field-required {
  animation: requiredPulse 2.4s ease-in-out infinite;
}

@keyframes requiredPulse {
  0%, 100% { box-shadow: 0 10px 22px rgba(79, 70, 229, .18); }
  50% { box-shadow: 0 0 0 7px rgba(79, 70, 229, .12), 0 18px 34px rgba(79, 70, 229, .22); }
}

.sign-pages {
  margin-top: 0;
  margin-bottom: -4px;
}

#sign-page-label {
  min-height: 40px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0 16px;
  background: #fff;
  color: var(--ink);
  font-weight: 600;
}

.sign-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 18px;
  align-items: start;
}

.sign-header {
  display: grid;
  gap: 8px;
}

.sign-branding {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  width: fit-content;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, .78);
  box-shadow: var(--shadow-sm);
}

.sign-branding img,
.sign-branding span {
  width: 34px;
  height: 34px;
  border-radius: 10px;
}

.sign-branding img {
  object-fit: contain;
  background: #fff;
  border-radius: 10px;
}

.sign-branding span {
  display: grid;
  place-items: center;
  color: #fff;
  background: var(--brand);
  font-size: 11px;
  font-weight: 800;
}

.sign-branding strong {
  color: var(--brand-dark);
  font-size: 14px;
}

.sign-panel {
  position: sticky;
  top: 22px;
  display: grid;
  gap: 14px;
}

.sign-hidden-values {
  display: none;
}

.sign-guide {
  display: grid;
  gap: 8px;
  padding: 15px;
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(79, 70, 229, .1), rgba(255, 255, 255, .94));
  box-shadow: inset 0 0 0 1px rgba(79, 70, 229, .13);
}

.sign-guide span {
  color: var(--brand);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.sign-guide strong {
  color: var(--brand-dark);
  font-size: 17px;
  font-weight: 700;
}

.sign-guide p {
  margin: 0;
  color: #64748b;
  font-size: 13px;
  line-height: 1.45;
}

.sign-guide p.success {
  color: #047857;
  font-weight: 600;
}

.sign-guide .quiet {
  width: 100%;
  min-height: 42px;
  justify-content: center;
  background: #fff;
  color: var(--brand-dark);
  box-shadow: var(--shadow-sm);
}

.signature-options {
  display: grid;
  gap: 10px;
}

.signature-title {
  color: #475569;
  font-size: 14px;
  font-weight: 600;
}

.signature-mode-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.signature-mode-tabs button {
  min-height: 38px;
  background: #eef2f7;
  color: #245f73;
  box-shadow: none;
}

.signature-mode-tabs button.selected {
  background: linear-gradient(135deg, var(--brand), var(--brand-dark));
  color: #fff;
}

.signature-choice-grid {
  display: grid;
  gap: 8px;
}

.signature-choice {
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: var(--brand-dark);
  box-shadow: none;
  font-size: 18px;
  text-align: left;
}

.signature-choice.selected {
  border-color: var(--brand);
  box-shadow: 0 0 0 4px rgba(79, 70, 229, .12);
}

.signature-clean { font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; font-weight: 600; }
.signature-classic { font-family: Georgia, "Times New Roman", serif; font-style: italic; font-weight: 700; }
.signature-bold { font-family: "Courier New", monospace; font-weight: 800; }
.signature-formal { font-family: "Trebuchet MS", "Segoe UI", sans-serif; font-style: italic; font-weight: 800; }

.draw-signature-panel {
  display: grid;
  gap: 8px;
}

#signature-pad {
  width: 100%;
  min-height: 120px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  touch-action: none;
}

.clear-drawing {
  width: fit-content;
  min-height: 34px;
}

.complete-panel {
  display: grid;
  text-align: center;
  justify-items: center;
  gap: 10px;
  padding: 4px 2px 8px;
}

.complete-panel h2 {
  margin: 0;
}

.success-mark {
  width: 54px;
  height: 54px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: var(--success-bg);
  color: var(--success);
  font-size: 28px;
  font-weight: 600;
  animation: pop .28s ease both;
}

@keyframes pop {
  from { transform: scale(.85); opacity: .4; }
  to { transform: scale(1); opacity: 1; }
}

.check {
  grid-template-columns: 20px 1fr;
  align-items: start;
  color: var(--muted);
  line-height: 1.45;
}

.check input {
  min-height: auto;
  margin-top: 3px;
}

body.modal-open {
  overflow: hidden;
}

body.drawing-signature {
  overflow: hidden;
  overscroll-behavior: contain;
}

.signing-modal-backdrop {
  background: rgba(2, 6, 23, .62);
}

.signing-modal-card {
  width: min(640px, 100%);
  gap: 18px;
  padding: 24px;
  border-radius: 26px;
  border: 1px solid rgba(226, 232, 240, .76);
  box-shadow: 0 30px 80px rgba(2, 6, 23, .32);
}

.signing-modal-top {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  align-items: start;
}

.signing-modal-top h2 {
  margin: 3px 0 4px;
  font-size: 24px;
  line-height: 1.15;
}

.signing-modal-top p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

.signing-modal-body {
  display: grid;
  gap: 14px;
}

.modal-input-label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.modal-input-label input {
  min-height: 50px;
  border-radius: 16px;
  font-size: 16px;
}

.modal-preview-card,
.field-modal-date,
.reuse-value-button,
.upload-signature-panel {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #f8fafc;
}

.modal-preview-card {
  display: grid;
  gap: 8px;
  padding: 16px;
}

.modal-preview-card span,
.signature-title {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.modal-preview-card strong {
  color: var(--brand-dark);
  font-size: 22px;
  overflow-wrap: anywhere;
}

.field-modal-date {
  display: grid;
  justify-items: center;
  gap: 8px;
  padding: 22px;
  text-align: center;
}

.field-modal-date svg {
  width: 38px;
  height: 38px;
  padding: 9px;
  border-radius: 14px;
  color: var(--brand);
  background: var(--brand-soft);
}

.field-modal-date strong {
  color: var(--brand-dark);
  font-size: 26px;
}

.field-modal-date p {
  margin: 0;
  color: var(--muted);
}

.reuse-value-button {
  min-height: 44px;
  width: fit-content;
  padding-inline: 14px;
  gap: 8px;
}

.signature-mode-tabs {
  grid-template-columns: repeat(3, 1fr);
}

.signature-mode-tabs.two-tabs {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.signature-mode-tabs button {
  border-radius: 14px;
}

.signature-choice-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.signature-choice {
  min-height: 58px;
  padding: 12px 14px;
  border-radius: 16px;
  transition: transform .14s ease, box-shadow .14s ease, border-color .14s ease;
}

.signature-choice:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.upload-signature-panel {
  display: grid;
  gap: 10px;
  padding: 16px;
  color: var(--muted);
  font-weight: 700;
}

@keyframes sheetIn {
  from { transform: translateY(24px); opacity: .86; }
  to { transform: translateY(0); opacity: 1; }
}

.upload-signature-panel input {
  min-height: auto;
  padding: 0;
  border: 0;
  background: transparent;
}

.signing-modal-actions {
  padding-top: 2px;
}

.search-panel {
  padding: 14px;
  box-shadow: none;
}

.search-box {
  position: relative;
  display: flex;
  align-items: center;
}

.search-box > svg {
  position: absolute;
  left: 14px;
  width: 18px;
  height: 18px;
  color: var(--muted-light);
}

.search-box input {
  padding-left: 42px;
  padding-right: 48px;
  border-radius: 999px;
}

#clear-search {
  position: absolute;
  right: 6px;
  width: 34px;
  height: 34px;
  min-height: 34px;
  display: none;
  place-items: center;
  padding: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  box-shadow: none;
}

#clear-search.visible {
  display: grid;
}

#clear-search svg {
  width: 16px;
  height: 16px;
}

.list {
  display: grid;
  gap: 12px;
}

.row {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  justify-content: space-between;
  gap: 14px;
  box-shadow: var(--shadow-sm);
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}

.row:hover {
  transform: translateY(-2px);
  border-color: #d7ddf3;
  box-shadow: var(--shadow-md);
}

.envelope-card { align-items: start; }

.record-main {
  min-width: 0;
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.avatar {
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
  border-radius: 14px;
  display: grid;
  place-items: center;
  color: #fff;
  background: linear-gradient(135deg, #6366f1, #312e81);
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 10px 18px rgba(79, 70, 229, .18);
}

.avatar.small {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  font-size: 12px;
}

.record-main strong,
.row strong {
  color: var(--ink);
  font-weight: 600;
}

.muted,
.doc-name,
.record-meta {
  color: var(--muted);
}

.doc-name {
  max-width: 720px;
  margin-top: 6px;
  display: flex;
  align-items: center;
  gap: 7px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #64748b;
  font-weight: 600;
}

.doc-name svg {
  width: 16px;
  height: 16px;
  color: var(--brand);
}

.record-meta {
  display: grid;
  gap: 4px;
  text-align: right;
  font-size: 13px;
}

.record-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 7px;
  margin-top: 7px;
}

.reminder-note {
  max-width: 420px;
  justify-self: end;
  color: #64748b;
  font-size: 12px;
}

.reminder-controls {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.reminder-select {
  min-height: 36px;
  display: inline-grid;
  grid-template-columns: auto auto;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0 10px;
  background: #fff;
  color: #64748b;
  font-size: 12px;
  font-weight: 600;
}

.reminder-select span {
  white-space: nowrap;
}

.reminder-select select {
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
}

.auto-reminder-toggle {
  min-height: 36px;
  display: inline-grid;
  grid-template-columns: auto auto;
  align-items: center;
  gap: 8px;
  border-radius: 12px;
  padding: 0 12px;
  background: #eef2ff;
  color: var(--brand);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.auto-reminder-toggle input {
  width: 16px;
  height: 16px;
  accent-color: var(--brand);
}

.mini-button {
  min-height: 36px;
  display: inline-grid;
  grid-auto-flow: column;
  gap: 7px;
  place-items: center;
  border-radius: 12px;
  padding: 0 13px;
  font-size: 13px;
  text-decoration: none;
}

.mini-button svg {
  width: 15px;
  height: 15px;
}

.quiet-link {
  background: #eef2f7;
  color: #245f73;
  box-shadow: none;
}

.awaiting-pill {
  min-height: 34px;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  padding: 0 12px;
  background: var(--warning-bg);
  color: var(--warning);
  font-size: 13px;
  font-weight: 600;
}

.expired-pill {
  min-height: 34px;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  padding: 0 12px;
  background: #f1f5f9;
  color: #475569;
  font-size: 13px;
  font-weight: 700;
}

.expired-mark {
  width: 56px;
  height: 56px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: #f1f5f9;
  color: #475569;
  font-size: 30px;
  font-weight: 900;
  margin-bottom: 10px;
}

.danger-button {
  background: var(--danger-bg);
  color: var(--danger);
  border: 1px solid #fecaca;
  box-shadow: none;
}

.danger-button:hover {
  background: #fee2e2;
  box-shadow: none;
}

.status {
  justify-self: end;
  width: fit-content;
  border-radius: 999px;
  padding: 5px 10px;
  color: var(--warning);
  background: var(--warning-bg);
  font-weight: 600;
}

.signed-status,
.status-signed {
  color: var(--success);
  background: var(--success-bg);
}

.status-sent {
  color: var(--warning);
  background: var(--warning-bg);
}

.status-viewed {
  color: var(--blue);
  background: var(--blue-bg);
}

.status-delivered,
.status-waiting {
  color: var(--warning);
  background: var(--warning-bg);
}

.status-draft {
  color: #475569;
  background: #f1f5f9;
}

.status-declined,
.status-cancelled,
.status-voided {
  color: var(--danger);
  background: var(--danger-bg);
}

.status-expired,
.status-unknown {
  color: #475569;
  background: #f1f5f9;
}

.activity-modal-card {
  width: min(680px, calc(100vw - 32px));
  max-height: min(780px, calc(100vh - 44px));
  overflow: auto;
  padding: 0;
}

.activity-modal-top {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
  padding: 24px 24px 18px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, .94);
  backdrop-filter: blur(14px);
}

.activity-modal-top h2 {
  margin: 3px 0 4px;
  color: var(--ink);
  font-size: 24px;
  font-weight: 600;
}

.activity-modal-top p:last-child {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.envelope-activity-list {
  position: relative;
  display: grid;
  gap: 0;
  padding: 18px 24px 24px;
}

.envelope-activity-list::before {
  content: "";
  position: absolute;
  left: 44px;
  top: 30px;
  bottom: 34px;
  width: 1px;
  background: linear-gradient(#c7d2fe, #e5e7eb);
}

.envelope-activity-item {
  position: relative;
  display: grid;
  grid-template-columns: 42px 1fr;
  gap: 14px;
  padding: 12px 0;
}

.activity-icon {
  position: relative;
  z-index: 1;
  width: 42px;
  height: 42px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  border: 1px solid #dbe4f0;
  background: #fff;
  color: #64748b;
  box-shadow: 0 8px 22px rgba(15, 23, 42, .08);
}

.activity-icon svg {
  width: 18px;
  height: 18px;
}

.envelope-activity-item.done .activity-icon {
  color: #fff;
  border-color: transparent;
  background: linear-gradient(135deg, #4f46e5, #312e81);
  box-shadow: 0 14px 26px rgba(79, 70, 229, .18);
}

.envelope-activity-item strong {
  display: block;
  padding-top: 2px;
  color: var(--ink);
  font-size: 14px;
  font-weight: 600;
}

.envelope-activity-item p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.envelope-activity-item small {
  display: block;
  margin-top: 5px;
  color: #64748b;
  font-size: 12px;
}

.envelope-activity-item.pending strong,
.envelope-activity-item.pending p {
  color: #94a3b8;
}

.pdf-skeleton {
  min-height: 560px;
  width: min(820px, 100%);
  margin: 0 auto;
  display: grid;
  align-content: start;
  gap: 18px;
  padding: 58px;
  border-radius: 16px;
  background: #fff;
  box-shadow: var(--shadow-md);
}

.pdf-skeleton span,
.skeleton-lines span,
.skeleton-circle {
  display: block;
  overflow: hidden;
  position: relative;
  border-radius: 999px;
  background: #e8edf5;
}

.pdf-skeleton span::after,
.skeleton-lines span::after,
.skeleton-circle::after {
  content: "";
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .72), transparent);
  animation: shimmer 1.25s ease-in-out infinite;
}

.pdf-skeleton span:nth-child(1) { width: 48%; height: 22px; }
.pdf-skeleton span:nth-child(2) { width: 84%; height: 12px; }
.pdf-skeleton span:nth-child(3) { width: 76%; height: 12px; }
.pdf-skeleton span:nth-child(4) { width: 58%; height: 12px; }

@keyframes shimmer {
  to { transform: translateX(100%); }
}

.skeleton-row {
  align-items: center;
  grid-template-columns: auto 1fr;
  display: grid;
}

.skeleton-circle {
  width: 44px;
  height: 44px;
  border-radius: 14px;
}

.skeleton-lines {
  display: grid;
  gap: 10px;
}

.skeleton-lines span {
  height: 12px;
}

.skeleton-lines span:nth-child(1) { width: 34%; }
.skeleton-lines span:nth-child(2) { width: 52%; }
.skeleton-lines span:nth-child(3) { width: 44%; }

.empty-state {
  min-height: 280px;
  display: grid;
  place-items: center;
  text-align: center;
  align-content: center;
  gap: 12px;
  color: var(--muted);
}

.empty-state.compact {
  min-height: 180px;
}

.empty-state svg {
  width: 44px;
  height: 44px;
  color: var(--brand);
  padding: 10px;
  border-radius: 16px;
  background: var(--brand-soft);
}

#toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 10000;
  transform: translateX(-50%) translateY(8px);
  background: #111827;
  color: #fff;
  padding: 12px 16px;
  border-radius: 999px;
  opacity: 0;
  pointer-events: none;
  box-shadow: var(--shadow-lg);
  transition: opacity .18s ease, transform .18s ease;
}

#toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

#toast.success { background: #14532d; }
#toast.warning { background: #92400e; }
#toast.error { background: #991b1b; }

.notification-scrim {
  position: fixed;
  inset: 0;
  z-index: 9990;
  background: rgba(15, 23, 42, .24);
  backdrop-filter: blur(2px);
  animation: fadeIn .18s ease both;
}

.notification-center {
  position: fixed;
  top: 18px;
  right: 18px;
  bottom: 18px;
  z-index: 9991;
  width: min(440px, calc(100vw - 36px));
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  overflow: hidden;
  border: 1px solid rgba(226, 232, 240, .92);
  border-radius: 24px;
  background: rgba(255, 255, 255, .96);
  box-shadow: 0 30px 90px rgba(15, 23, 42, .22);
  backdrop-filter: blur(22px);
  animation: drawerIn .24s cubic-bezier(.2, .8, .2, 1) both;
}

.notification-center header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 22px 22px 18px;
  border-bottom: 1px solid var(--line);
}

.notification-center h2 {
  margin: 3px 0 0;
  font-size: 22px;
  line-height: 1.15;
}

.icon-only {
  width: 42px;
  min-height: 42px;
  padding: 0;
  display: inline-grid;
  place-items: center;
}

.notification-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 16px;
  color: var(--muted);
  font-size: 13px;
  border-bottom: 1px solid var(--line);
  background: #f8fafc;
}

.notification-actions button {
  min-height: 34px;
  padding: 0 12px;
  font-size: 13px;
}

.notification-list {
  min-height: 0;
  overflow: auto;
  padding: 8px;
}

.notification-item {
  width: 100%;
  min-height: 0;
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  padding: 12px;
  border: 1px solid transparent;
  border-radius: 18px;
  color: var(--ink);
  background: transparent;
  box-shadow: none;
  text-align: left;
}

.notification-item + .notification-item {
  margin-top: 6px;
}

.notification-item:hover {
  transform: translateY(-1px);
  border-color: var(--line);
  background: #fff;
  box-shadow: var(--shadow-sm);
}

.notification-item.unread {
  border-color: rgba(79, 70, 229, .16);
  background: linear-gradient(135deg, rgba(79, 70, 229, .08), rgba(255, 255, 255, .96));
}

.notification-icon {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  color: var(--brand);
  background: var(--brand-soft);
}

.notification-icon svg {
  width: 19px;
  height: 19px;
}

.notification-item strong,
.notification-item small,
.notification-item em {
  display: block;
}

.notification-item strong {
  color: var(--ink);
  font-size: 14px;
  line-height: 1.25;
}

.notification-item small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.notification-item em {
  margin-top: 7px;
  color: var(--muted-light);
  font-size: 12px;
  font-style: normal;
}

.notification-item.type-signed .notification-icon {
  color: var(--success);
  background: var(--success-bg);
}

.notification-item.type-viewed .notification-icon {
  color: var(--blue);
  background: var(--blue-bg);
}

.notification-item.type-reminder .notification-icon {
  color: var(--warning);
  background: var(--warning-bg);
}

.notification-item.type-expired .notification-icon,
.notification-item.type-failed .notification-icon {
  color: var(--danger);
  background: var(--danger-bg);
}

.notification-empty {
  min-height: 320px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 10px;
  text-align: center;
  color: var(--muted);
  padding: 28px;
}

.notification-empty svg {
  width: 46px;
  height: 46px;
  padding: 11px;
  border-radius: 18px;
  color: var(--brand);
  background: var(--brand-soft);
}

.notification-empty strong {
  color: var(--ink);
  font-size: 16px;
}

.notification-empty p {
  max-width: 280px;
  margin: 0;
  font-size: 13px;
  line-height: 1.45;
}

@keyframes drawerIn {
  from {
    opacity: 0;
    transform: translateX(18px) scale(.985);
  }
  to {
    opacity: 1;
    transform: translateX(0) scale(1);
  }
}

.celebration {
  position: fixed;
  inset: 0;
  z-index: 10002;
  pointer-events: none;
  overflow: hidden;
}

.celebration-check {
  position: absolute;
  left: 50%;
  top: 22px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px 10px 10px;
  border: 1px solid rgba(34, 197, 94, .28);
  border-radius: 999px;
  background: rgba(255, 255, 255, .96);
  color: #14532d;
  box-shadow: var(--shadow-lg);
  transform: translateX(-50%);
  backdrop-filter: blur(16px);
  animation: checkPop 1.35s cubic-bezier(.2, .8, .2, 1) both;
}

.celebration-check span {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: linear-gradient(135deg, #22c55e, #15803d);
  color: #fff;
  font-weight: 700;
}

.celebration-check strong {
  font-size: 13px;
  font-weight: 600;
}

.confetti-piece {
  position: absolute;
  left: var(--x);
  top: -18px;
  width: 7px;
  height: 12px;
  border-radius: 3px;
  background: var(--color);
  opacity: .9;
  animation: confettiFall 1.35s cubic-bezier(.12, .74, .34, 1) var(--delay) forwards;
}

@keyframes checkPop {
  0% { opacity: 0; transform: translateX(-50%) translateY(-12px) scale(.94); }
  16% { opacity: 1; transform: translateX(-50%) translateY(0) scale(1.02); }
  78% { opacity: 1; transform: translateX(-50%) translateY(0) scale(1); }
  100% { opacity: 0; transform: translateX(-50%) translateY(-6px) scale(.98); }
}

@keyframes confettiFall {
  0% { opacity: 0; transform: translate3d(0, 0, 0) rotate(0deg); }
  12% { opacity: 1; }
  100% { opacity: 0; transform: translate3d(var(--drift), 210px, 0) rotate(260deg); }
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 10001;
  display: grid;
  place-items: center;
  padding: 22px;
  background: rgba(15, 23, 42, .42);
  backdrop-filter: blur(10px);
  animation: fadeIn .16s ease both;
}

.modal-card {
  width: min(460px, 100%);
  display: grid;
  gap: 16px;
  padding: 22px;
  border: 1px solid rgba(255, 255, 255, .68);
  border-radius: 20px;
  background: #fff;
  box-shadow: var(--shadow-lg);
  animation: modalIn .18s ease both;
}

.modal-icon {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  color: var(--danger);
  background: var(--danger-bg);
}

.modal-icon svg {
  width: 20px;
  height: 20px;
}

.details-header {
  align-items: flex-end;
}

.back-button {
  width: fit-content;
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 18px;
  padding: 0 14px;
  border-radius: 12px;
  font-size: 13px;
}

.back-button svg,
.details-header-actions svg,
.details-tabs svg,
.details-card-title svg,
.details-stat svg {
  width: 17px;
  height: 17px;
}

.details-header-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.details-summary-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(145px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.details-stat {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 92px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, .9);
  box-shadow: var(--shadow-sm);
}

.details-stat > span {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 13px;
  color: var(--brand);
  background: var(--brand-soft);
}

.details-stat p {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.details-stat strong {
  display: block;
  color: var(--ink);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.25;
}

.details-shell {
  padding: 0;
  overflow: hidden;
}

.details-tabs {
  display: flex;
  gap: 4px;
  padding: 10px;
  border-bottom: 1px solid var(--line);
  background: rgba(248, 250, 252, .78);
  overflow-x: auto;
}

.details-tabs button {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
  padding: 0 14px;
  border: 0;
  border-radius: 12px;
  color: #475569;
  background: transparent;
  box-shadow: none;
  font-size: 13px;
  font-weight: 700;
}

.details-tabs button:hover {
  color: var(--brand-dark);
  background: #eef2ff;
  transform: translateY(-1px);
}

.details-tabs button.active {
  color: #fff;
  background: linear-gradient(135deg, var(--brand), var(--brand-dark));
  box-shadow: 0 14px 26px rgba(79, 70, 229, .22);
}

.details-content {
  padding: 22px;
}

.details-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 18px;
}

.details-card {
  min-width: 0;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fff;
  box-shadow: var(--shadow-sm);
}

.details-card-title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
}

.details-card-title > i,
.details-card-title > svg {
  color: var(--brand);
}

.details-card-title h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
}

.details-kv,
.settings-list {
  display: grid;
  gap: 12px;
}

.details-kv > div,
.settings-list > div {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.details-kv > div:last-child,
.settings-list > div:last-child {
  border-bottom: 0;
}

.details-kv span,
.settings-list span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.details-kv strong,
.settings-list strong {
  min-width: 0;
  overflow-wrap: anywhere;
  color: var(--ink);
  font-weight: 700;
}

.progress-track {
  height: 12px;
  margin-bottom: 14px;
  border-radius: 999px;
  background: #e5e7eb;
  overflow: hidden;
}

.progress-track span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #4f46e5, #14b8a6);
}

.details-mini-timeline {
  max-height: 340px;
  margin-top: 18px;
  padding-top: 4px;
  overflow: auto;
}

.enterprise-timeline {
  display: grid;
  gap: 12px;
}

.recipient-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  margin-bottom: 18px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #f8fafc;
}

.recipient-card strong,
.recipient-card p,
.recipient-card small {
  display: block;
  margin: 0;
}

.recipient-card p {
  color: var(--muted);
  overflow-wrap: anywhere;
}

.recipient-card small {
  margin-top: 4px;
  color: var(--muted-light);
  font-weight: 700;
}

.audit-list {
  display: grid;
  gap: 12px;
}

.audit-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 14px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #f8fafc;
}

.audit-item > span {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  color: var(--brand);
  background: #fff;
  box-shadow: var(--shadow-sm);
}

.audit-item strong {
  display: block;
  margin-bottom: 4px;
}

.audit-item p {
  margin: 0 0 10px;
  color: var(--muted);
}

.audit-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.audit-meta span {
  padding: 6px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: #475569;
  background: #fff;
  font-size: 12px;
  font-weight: 700;
}

.files-list {
  display: grid;
  gap: 12px;
}

.file-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  color: var(--ink);
  background: #f8fafc;
  text-decoration: none;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}

.file-card:hover {
  transform: translateY(-2px);
  border-color: rgba(79, 70, 229, .28);
  box-shadow: var(--shadow-md);
}

.file-card > span {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 13px;
  color: var(--brand);
  background: #fff;
  box-shadow: var(--shadow-sm);
}

.file-card strong,
.file-card p {
  margin: 0;
}

.file-card p {
  color: var(--muted);
  overflow-wrap: anywhere;
}

.file-card.unavailable {
  opacity: .72;
  cursor: not-allowed;
}

.field-summary-list {
  display: grid;
  gap: 10px;
}

.field-summary-list > div {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #f8fafc;
}

.field-summary-list span,
.field-summary-list small {
  color: var(--muted);
  font-weight: 700;
}

.settings-note {
  margin-top: 16px;
}

.profile-header {
  align-items: flex-end;
}

.profile-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(320px, .8fr);
  gap: 18px;
}

.profile-card {
  display: grid;
  gap: 18px;
}

.identity-card {
  grid-row: span 2;
}

.profile-card-heading {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 14px;
}

.profile-card-heading h2 {
  margin-bottom: 4px;
  font-size: 17px;
}

.profile-visual-row {
  display: grid;
  grid-template-columns: 160px minmax(0, 1fr);
  gap: 16px;
}

.image-picker {
  display: grid;
  gap: 9px;
}

.image-preview {
  min-height: 124px;
  width: 100%;
  display: grid;
  place-items: center;
  border: 1px dashed var(--line-strong);
  border-radius: 18px;
  color: var(--brand-dark);
  background: linear-gradient(135deg, #f8fafc, #eef2ff);
  box-shadow: none;
  overflow: hidden;
}

.image-preview:hover {
  border-color: rgba(79, 70, 229, .45);
  background: #fff;
  box-shadow: var(--shadow-sm);
}

.avatar-preview {
  width: 124px;
  border-radius: 32px;
  font-size: 28px;
  font-weight: 800;
}

.logo-preview {
  gap: 8px;
  color: var(--muted);
}

.logo-preview svg {
  width: 24px;
  height: 24px;
  color: var(--brand);
}

.image-preview.has-image {
  padding: 0;
  background: #fff;
  border-style: solid;
  overflow: hidden;
}

.image-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.logo-preview img {
  object-fit: contain;
  padding: 14px;
  border-radius: 24px;
}

.profile-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.profile-form-grid .full-width {
  grid-column: 1 / -1;
}

.brand-preview-card {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  padding: 16px;
  border: 1px solid var(--accent);
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(255, 255, 255, .96), rgba(248, 250, 252, .98));
  box-shadow: var(--shadow-sm);
}

#brand-preview-logo {
  width: 54px;
  height: 54px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  overflow: hidden;
  color: #fff;
  font-weight: 800;
  background: var(--brand);
}

#brand-preview-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 7px;
  background: #fff;
  border-radius: 14px;
}

.brand-preview-card strong,
.brand-preview-card span {
  display: block;
}

.brand-preview-card strong {
  color: var(--ink);
  font-size: 15px;
  font-weight: 700;
}

.brand-preview-card span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 13px;
}

.brand-preview-card button {
  min-height: 38px;
  background: linear-gradient(135deg, var(--preview-button, var(--button-brand)), var(--brand-dark));
}

.signature-preview-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 160px;
  gap: 12px;
}

.signature-preview-row > div {
  min-height: 88px;
  display: grid;
  align-content: center;
  gap: 8px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background:
    linear-gradient(90deg, rgba(148, 163, 184, .14) 1px, transparent 1px),
    #fff;
  background-size: 18px 18px;
}

.signature-preview-row span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.signature-preview-row strong {
  color: var(--brand-dark);
  font-size: 24px;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.security-card {
  align-content: start;
}

.security-list {
  display: grid;
  gap: 10px;
}

.security-list > div {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #f8fafc;
}

.security-list i,
.security-list svg {
  width: 38px;
  height: 38px;
  padding: 9px;
  border-radius: 13px;
  color: var(--brand);
  background: var(--brand-soft);
}

.security-list span {
  color: var(--ink);
  font-weight: 700;
}

.security-list strong {
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  text-align: right;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.modal-actions button {
  min-width: 108px;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes modalIn {
  from { opacity: 0; transform: translateY(8px) scale(.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@media (max-width: 1100px) {
  body { grid-template-columns: 240px minmax(0, 1fr); }
  main { padding: 32px 26px 44px; }
  .metric-grid { grid-template-columns: repeat(2, minmax(160px, 1fr)); }
  .dashboard-metrics { grid-template-columns: repeat(2, minmax(180px, 1fr)); }
  .dashboard-grid,
  .dashboard-grid.lower { grid-template-columns: 1fr; }
  .details-summary-grid { grid-template-columns: repeat(3, minmax(160px, 1fr)); }
  .details-grid { grid-template-columns: 1fr; }
  .profile-grid { grid-template-columns: 1fr; }
  .identity-card { grid-row: auto; }
  .template-card { grid-template-columns: 1fr; align-items: stretch; }
  .template-actions { justify-content: flex-start; }
  .grid { grid-template-columns: 1fr; }
  .recipient-row { grid-template-columns: 1fr; }
  .recipient-options-head { display: grid; }
  .sign-grid { grid-template-columns: 1fr; }
  .sign-panel { position: static; }
}

@media (max-width: 820px) {
  body { grid-template-columns: 1fr; }
  aside {
    position: static;
    height: auto;
    grid-template-rows: auto;
    padding: 18px;
  }
  .nav-stack {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  aside button.active::before { display: none; }
  .field-rail { position: static; }
  main { padding: 24px 16px 36px; }
  h1 { font-size: 28px; }
  .metric-grid { grid-template-columns: 1fr; }
  .dashboard-header { align-items: flex-start; display: grid; }
  .dashboard-actions { width: 100%; display: grid; grid-template-columns: 1fr; }
  .dashboard-actions button { width: 100%; }
  .upload-heading {
    display: grid;
    align-items: start;
  }
  .upload-heading button { width: 100%; justify-content: center; }
  .upload-dropzone {
    display: grid;
    justify-items: center;
    text-align: center;
  }
  .dashboard-metrics { grid-template-columns: 1fr; }
  .contracts-chart {
    grid-template-columns: repeat(7, minmax(26px, 1fr));
    overflow-x: auto;
    padding-bottom: 6px;
  }
  .chart-day { min-width: 38px; }
  .panel-heading { align-items: flex-start; display: grid; }
  .quick-actions button { width: 100%; }
  .template-actions {
    display: grid;
    grid-template-columns: 1fr;
  }
  .template-actions .mini-button { width: 100%; }
  .template-preview-top { display: grid; }
  .template-preview-document { padding: 14px; }
  .workspace { padding: 14px; border-radius: 16px; }
  .document { width: 100%; }
  .signing-modal-backdrop {
    align-items: end;
    padding: 0;
  }
  .signing-modal-card {
    width: 100%;
    max-height: 88vh;
    overflow: auto;
    border-radius: 24px 24px 0 0;
    padding: 20px;
    animation: sheetIn .2s ease both;
  }
  .signing-modal-top h2 {
    font-size: 21px;
  }
  .signature-choice-grid {
    grid-template-columns: 1fr;
  }
  .signing-modal-actions {
    position: sticky;
    bottom: -20px;
    padding: 12px 0 0;
    background: inherit;
  }
  .row { display: grid; }
  .record-meta { text-align: left; }
  .record-actions { justify-content: flex-start; }
  .details-header { display: grid; align-items: start; }
  .details-header-actions { justify-content: flex-start; }
  .details-summary-grid { grid-template-columns: 1fr; }
  .details-content { padding: 14px; }
  .details-card { padding: 16px; }
  .profile-header {
    display: grid;
    align-items: start;
  }
  .profile-header button {
    width: 100%;
    justify-content: center;
  }
  .profile-visual-row,
  .profile-form-grid,
  .signature-preview-row {
    grid-template-columns: 1fr;
  }
  .avatar-preview {
    width: 100%;
  }
  .security-list > div {
    grid-template-columns: 38px minmax(0, 1fr);
  }
  .security-list strong {
    grid-column: 2;
    text-align: left;
  }
  .details-kv > div,
  .settings-list > div { grid-template-columns: 1fr; gap: 4px; }
  .recipient-card { grid-template-columns: auto minmax(0, 1fr); }
  .recipient-card .status { grid-column: 1 / -1; }
  .field-summary-list > div { grid-template-columns: 1fr; }
  .reminder-note { justify-self: start; }
  .reminder-controls {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr;
  }
  .reminder-select,
  .auto-reminder-toggle,
  .reminder-controls .mini-button {
    width: 100%;
    justify-content: center;
  }
  .status { justify-self: start; }
  .modal-actions { display: grid; grid-template-columns: 1fr; }
  .modal-actions button { width: 100%; }
  .notification-center {
    top: 10px;
    right: 10px;
    bottom: 10px;
    left: 10px;
    width: auto;
    border-radius: 20px;
  }
  .notification-center header {
    padding: 18px;
  }
  .notification-actions {
    display: grid;
    align-items: stretch;
  }
  .notification-actions button {
    width: 100%;
    justify-content: center;
  }
  #toast {
    width: calc(100% - 32px);
    border-radius: 16px;
    text-align: center;
  }
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f172a;
    --card: #111827;
    --line: #253041;
    --line-strong: #334155;
    --ink: #f8fafc;
    --muted: #aab6c8;
    --muted-light: #64748b;
    --brand-soft: rgba(79, 70, 229, .18);
    --success-bg: rgba(21, 128, 61, .22);
    --warning-bg: rgba(180, 83, 9, .18);
    --danger-bg: rgba(185, 28, 28, .18);
    --blue-bg: rgba(37, 99, 235, .18);
  }

  html { color-scheme: dark; }

  body {
    background:
      radial-gradient(circle at top right, rgba(79, 70, 229, .22), transparent 32rem),
      var(--bg);
  }

  aside,
  .panel,
  .premium-panel,
  .login-card,
  .empty-state,
  .metric-card,
  .recent-item,
  .template-card,
  .quick-actions button,
  .upload-item,
  .upload-dropzone,
  .icon-button,
  .details-stat,
  .details-card,
  .file-card,
  .recipient-card,
  .audit-item,
  .timeline-item > span,
  .panel-pill,
  .row,
  .modal-card,
  .notification-center {
    background: rgba(17, 24, 39, .92);
  }

  aside button:hover,
  .quiet,
  button.quiet,
  .quiet-link,
  .signature-mode-tabs button {
    background: #1e293b;
    color: #cbd5e1;
  }

  aside button.active {
    background: rgba(79, 70, 229, .22);
  }

  .notification-actions {
    background: rgba(15, 23, 42, .72);
  }

  .notification-item:hover {
    background: rgba(30, 41, 59, .82);
  }

  .notification-item.unread {
    background: linear-gradient(135deg, rgba(79, 70, 229, .18), rgba(17, 24, 39, .96));
  }

  input,
  textarea,
  #sign-page-label,
  .field-tool,
  .field-rail .page-tools button.quiet,
  .signature-choice,
  #signature-pad,
  .modal-preview-card,
  .field-modal-date,
  .reuse-value-button,
  .upload-signature-panel,
  .empty,
  .chart-track,
  .pdf-skeleton {
    color: var(--ink);
    background: #0f172a;
    border-color: var(--line-strong);
  }

  .image-preview,
  .signature-preview-row > div,
  .security-list > div {
    background: #0f172a;
    border-color: var(--line-strong);
  }

  .modal-preview-card strong,
  .field-modal-date strong {
    color: var(--ink);
  }

  .metric-highlight {
    background:
      linear-gradient(180deg, rgba(17, 24, 39, .96), rgba(17, 24, 39, .9)),
      radial-gradient(circle at top right, rgba(79, 70, 229, .26), transparent 60%);
  }

  .document-icon {
    background: rgba(79, 70, 229, .18);
  }

  .upload-dropzone {
    background:
      radial-gradient(circle at top right, rgba(79, 70, 229, .18), transparent 18rem),
      #0f172a;
    border-color: var(--line-strong);
  }

  .upload-icon,
  .upload-item .document-icon {
    background: rgba(79, 70, 229, .18);
  }

  .upload-item-main,
  .upload-item-main:hover {
    color: var(--ink);
    background: transparent;
  }

  .pdf-page,
  .pdf-canvas {
    background: #fff;
  }

  .workspace {
    background: #1e293b;
  }

  .field,
  .field-drag-ghost {
    background: rgba(255, 255, 255, .96);
    color: #312e81;
  }

  .signature-mark,
  .signature-choice-grid .signature-choice {
    background: #fff;
    color: #312e81;
  }
}

/* Premium customer signing experience */
body[data-view="sign"] {
  color-scheme: light;
  color: #0f172a;
  background:
    radial-gradient(circle at 8% 0%, rgba(79, 70, 229, .12), transparent 28rem),
    linear-gradient(180deg, #f8fafc 0%, #eef4fb 44%, #f8fafc 100%);
}

body[data-view="sign"] main {
  width: min(100%, 1520px);
  max-width: 1520px;
  padding: 34px clamp(18px, 4vw, 52px) 52px;
  gap: 18px;
}

#sign-view:not([hidden]) {
  display: grid;
  gap: 18px;
  animation: pageIn .28s cubic-bezier(.2, .8, .2, 1) both;
}

body[data-view="sign"] .sign-header {
  display: grid;
  gap: 7px;
  max-width: 760px;
}

body[data-view="sign"] .sign-branding {
  width: max-content;
  max-width: 100%;
  min-height: 44px;
  padding: 7px 12px;
  border: 1px solid rgba(203, 213, 225, .9);
  border-radius: 999px;
  background: rgba(255, 255, 255, .92);
  box-shadow: 0 12px 30px rgba(15, 23, 42, .06);
  color: #1e293b;
}

body[data-view="sign"] .sign-branding img {
  width: 28px;
  height: 28px;
  border-radius: 9px;
  object-fit: cover;
}

body[data-view="sign"] .sign-branding strong {
  color: #1e293b;
  font-size: 14px;
  font-weight: 700;
}

body[data-view="sign"] #sign-title {
  margin: 0;
  color: #0f172a;
  font-size: clamp(30px, 4vw, 46px);
  font-weight: 760;
  letter-spacing: 0;
  line-height: 1.03;
}

body[data-view="sign"] #sign-subtitle {
  margin: 0;
  color: #475569;
  font-size: 16px;
  line-height: 1.45;
}

body[data-view="sign"] .sign-pages {
  width: max-content;
  min-height: 48px;
  margin: 0;
  padding: 6px;
  gap: 6px;
  border: 1px solid rgba(203, 213, 225, .9);
  border-radius: 18px;
  background: rgba(255, 255, 255, .92);
  box-shadow: 0 16px 34px rgba(15, 23, 42, .07);
}

body[data-view="sign"] .sign-pages button.quiet {
  min-height: 38px;
  border-radius: 12px;
  background: #f8fafc;
  color: #334155;
  font-size: 13px;
  font-weight: 720;
  box-shadow: none;
}

body[data-view="sign"] .sign-pages button.quiet:hover {
  background: #eef2ff;
  color: #312e81;
  transform: translateY(-1px);
}

body[data-view="sign"] #sign-page-label {
  min-width: 88px;
  min-height: 38px;
  border: 0;
  border-radius: 12px;
  background: #111827;
  color: #fff;
  font-size: 13px;
  font-weight: 780;
  box-shadow: 0 10px 22px rgba(15, 23, 42, .16);
}

body[data-view="sign"] .sign-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(310px, 370px);
  gap: 22px;
  align-items: start;
  padding: 30px;
  border: 1px solid rgba(203, 213, 225, .85);
  border-radius: 30px;
  background:
    linear-gradient(180deg, rgba(238, 244, 251, .95), rgba(226, 235, 246, .95)),
    #e8eef6;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, .8),
    0 26px 70px rgba(15, 23, 42, .12);
}

body[data-view="sign"] .sign-grid .document {
  width: min(940px, 100%);
  gap: 28px;
}

body[data-view="sign"] .sign-grid .pdf-page {
  border-radius: 6px;
  box-shadow:
    0 1px 0 rgba(15, 23, 42, .08),
    0 34px 90px rgba(15, 23, 42, .22);
}

body[data-view="sign"] .sign-panel {
  position: sticky;
  top: 28px;
  display: grid;
  gap: 14px;
  padding: 18px;
  border: 1px solid rgba(226, 232, 240, .95);
  border-radius: 26px;
  background: rgba(255, 255, 255, .96);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, .9) inset,
    0 24px 58px rgba(15, 23, 42, .12);
  backdrop-filter: blur(14px);
}

body[data-view="sign"] .sign-guide {
  position: relative;
  overflow: hidden;
  padding: 18px;
  border: 1px solid rgba(226, 232, 240, .95);
  border-radius: 22px;
  background: linear-gradient(180deg, #fff, #f8fafc);
  box-shadow: 0 14px 34px rgba(15, 23, 42, .06);
}

body[data-view="sign"] .sign-guide::after {
  content: "";
  position: absolute;
  left: 18px;
  right: 18px;
  bottom: 0;
  height: 3px;
  border-radius: 999px 999px 0 0;
  background: linear-gradient(90deg, #4f46e5, #2563eb);
  opacity: .24;
  transition: opacity .2s ease, background .2s ease;
}

body[data-view="sign"] .sign-guide.needs-consent::after {
  opacity: .58;
  background: linear-gradient(90deg, #f59e0b, #4f46e5);
}

body[data-view="sign"] .sign-guide.is-complete::after {
  opacity: .72;
  background: linear-gradient(90deg, #16a34a, #22c55e);
}

body[data-view="sign"] .sign-guide span {
  width: max-content;
  padding: 4px 8px;
  border-radius: 999px;
  background: #eef2ff;
  color: #3730a3;
  font-size: 11px;
  font-weight: 780;
  letter-spacing: .02em;
}

body[data-view="sign"] .sign-guide strong {
  color: #0f172a;
  font-size: 18px;
  font-weight: 760;
  line-height: 1.25;
}

body[data-view="sign"] .sign-guide p {
  color: #475569;
  font-size: 14px;
  line-height: 1.5;
}

body[data-view="sign"] .sign-guide p.success {
  color: #047857;
}

body[data-view="sign"] .sign-guide .quiet {
  min-height: 44px;
  border: 1px solid #dbe4ee;
  border-radius: 14px;
  background: #fff;
  color: #334155;
  box-shadow: 0 10px 22px rgba(15, 23, 42, .06);
}

body[data-view="sign"] .sign-guide .quiet:hover {
  border-color: #c7d2fe;
  color: #312e81;
  transform: translateY(-1px);
}

body[data-view="sign"] .check {
  min-height: 64px;
  display: grid;
  grid-template-columns: 30px 1fr;
  gap: 12px;
  align-items: center;
  padding: 14px 15px;
  border: 1.5px solid #cbd5e1;
  border-radius: 20px;
  background: #fff;
  color: #1e293b;
  cursor: pointer;
  font-size: 15px;
  font-weight: 720;
  line-height: 1.35;
  box-shadow: 0 12px 28px rgba(15, 23, 42, .05);
  transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease, background .18s ease;
}

body[data-view="sign"] .check:hover {
  border-color: #818cf8;
  box-shadow: 0 18px 38px rgba(79, 70, 229, .12);
  transform: translateY(-1px);
}

body[data-view="sign"] .check:has(input:focus-visible) {
  outline: 3px solid rgba(79, 70, 229, .24);
  outline-offset: 3px;
}

body[data-view="sign"] .check:has(input:checked) {
  border-color: #22c55e;
  background: #f0fdf4;
  box-shadow: 0 18px 38px rgba(22, 163, 74, .12);
}

body[data-view="sign"] .check input {
  appearance: none;
  width: 26px;
  height: 26px;
  min-height: 26px;
  margin: 0;
  border: 2px solid #64748b;
  border-radius: 9px;
  background: #fff;
  display: grid;
  place-items: center;
  transition: border-color .16s ease, background .16s ease, transform .16s ease;
}

body[data-view="sign"] .check input::after {
  content: "";
  width: 8px;
  height: 13px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg) scale(.5);
  opacity: 0;
  transition: transform .18s cubic-bezier(.2, .8, .2, 1), opacity .18s ease;
}

body[data-view="sign"] .check input:checked {
  border-color: #16a34a;
  background: #16a34a;
  transform: scale(1.04);
}

body[data-view="sign"] .check input:checked::after {
  opacity: 1;
  transform: rotate(45deg) scale(1);
}

.sign-trust-note {
  display: grid;
  grid-template-columns: 20px 1fr;
  gap: 9px;
  align-items: center;
  padding: 0 3px;
  color: #64748b;
  font-size: 12px;
  line-height: 1.35;
}

.sign-trust-note i {
  width: 17px;
  height: 17px;
  color: #059669;
}

body[data-view="sign"] #complete-signing {
  min-height: 54px;
  border-radius: 16px;
  background: linear-gradient(135deg, #4f46e5, #4338ca);
  color: #fff;
  font-size: 16px;
  font-weight: 760;
  box-shadow: 0 18px 38px rgba(79, 70, 229, .28);
}

body[data-view="sign"] #complete-signing:not(:disabled):hover {
  transform: translateY(-2px);
  box-shadow: 0 24px 52px rgba(79, 70, 229, .34);
}

body[data-view="sign"] #complete-signing:disabled {
  background: #e2e8f0;
  color: #64748b;
  box-shadow: none;
  cursor: not-allowed;
}

body[data-view="sign"] .field {
  min-height: 34px;
  border: 1.5px solid #6366f1;
  border-radius: 12px;
  background: rgba(255, 255, 255, .97);
  color: #312e81;
  box-shadow: 0 14px 32px rgba(79, 70, 229, .16);
  cursor: pointer;
}

body[data-view="sign"] .field:hover {
  transform: translateY(-2px) scale(1.015);
  border-color: #4f46e5;
  box-shadow: 0 0 0 5px rgba(99, 102, 241, .12), 0 20px 42px rgba(79, 70, 229, .22);
}

body[data-view="sign"] .field-empty:not(.field-required) {
  box-shadow: 0 12px 28px rgba(79, 70, 229, .14);
}

body[data-view="sign"] .field-required {
  animation: premiumRequiredPulse 2.15s ease-in-out infinite;
}

body[data-view="sign"] .field.signed {
  border-color: #cbd5e1;
  background: rgba(248, 250, 252, .96);
  color: #334155;
  box-shadow: 0 10px 24px rgba(15, 23, 42, .10);
}

body[data-view="sign"] .field.signed:hover {
  transform: none;
  border-color: #cbd5e1;
  box-shadow: 0 10px 24px rgba(15, 23, 42, .10);
}

body[data-view="sign"] .field .grip {
  background: #4f46e5;
}

body[data-view="sign"] .field .label {
  min-width: 0;
  padding: 6px 8px;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
}

body[data-view="sign"] .signature-mark {
  background: transparent;
}

@keyframes premiumRequiredPulse {
  0%, 100% {
    box-shadow: 0 14px 32px rgba(79, 70, 229, .18), 0 0 0 0 rgba(79, 70, 229, .2);
  }
  50% {
    box-shadow: 0 18px 42px rgba(79, 70, 229, .24), 0 0 0 8px rgba(79, 70, 229, .11);
  }
}

body[data-view="sign"] .signing-modal-backdrop {
  background: rgba(15, 23, 42, .48);
  backdrop-filter: blur(16px);
}

body[data-view="sign"] .signing-modal-card {
  border: 1px solid rgba(226, 232, 240, .95);
  border-radius: 28px;
  background: #fff;
  box-shadow: 0 34px 90px rgba(15, 23, 42, .24);
}

body[data-view="sign"] .signing-modal-top h2 {
  color: #0f172a;
}

body[data-view="sign"] .signing-modal-top p,
body[data-view="sign"] .field-modal-date span,
body[data-view="sign"] .signature-title {
  color: #475569;
}

body[data-view="sign"] .signature-choice {
  border-color: #dbe4ee;
  border-radius: 16px;
  background: #fff;
  color: #312e81;
}

body[data-view="sign"] .signature-choice.active {
  border-color: #6366f1;
  box-shadow: 0 0 0 4px rgba(99, 102, 241, .12);
}

@media (max-width: 1100px) {
  body[data-view="sign"] .sign-grid {
    grid-template-columns: 1fr;
  }

  body[data-view="sign"] .sign-panel {
    position: static;
  }
}

@media (max-width: 820px) {
  body[data-view="sign"] main {
    padding: 18px 12px 26px;
  }

  body[data-view="sign"] #sign-title {
    font-size: 32px;
  }

  body[data-view="sign"] .sign-pages {
    position: sticky;
    top: 0;
    z-index: 25;
    width: 100%;
    justify-content: space-between;
  }

  body[data-view="sign"] .sign-pages button.quiet,
  body[data-view="sign"] #sign-page-label {
    flex: 1;
    min-width: 0;
  }

  body[data-view="sign"] .sign-grid {
    gap: 14px;
    padding: 12px;
    border-radius: 24px;
  }

  body[data-view="sign"] .sign-grid .document {
    gap: 18px;
  }

  body[data-view="sign"] .sign-panel {
    padding: 14px;
    border-radius: 22px;
  }

  body[data-view="sign"] .sign-guide {
    padding: 15px;
    border-radius: 18px;
  }

  body[data-view="sign"] .check {
    min-height: 64px;
    grid-template-columns: 30px 1fr;
    font-size: 14px;
  }

  body[data-view="sign"] #complete-signing {
    min-height: 56px;
  }

  body[data-view="sign"] .field {
    min-width: 48px;
    min-height: 44px;
    font-size: 13px;
  }

  body[data-view="sign"] #complete-signing,
  body[data-view="sign"] #decline-signing {
    position: sticky;
    bottom: 0;
    z-index: 6;
  }

  body[data-view="sign"] .sign-grid .document {
    overflow-x: auto;
    max-width: 100%;
  }

  body[data-view="sign"] .signing-modal-card {
    width: 100%;
    max-height: 92vh;
    overflow: auto;
    border-radius: 28px 28px 0 0;
  }
}

body[data-view="sign"] #sign-document {
  width: 100%;
  justify-items: center;
  align-items: start;
  scroll-behavior: smooth;
}

body[data-view="sign"] .sign-grid .document {
  justify-items: center;
}

body[data-view="sign"] .sign-grid .pdf-page {
  max-width: 100%;
  border: 1px solid rgba(226, 232, 240, .9);
  background: #fff;
  outline: 10px solid rgba(255, 255, 255, .38);
  scroll-margin: 96px;
}

body[data-view="sign"] .sign-grid .pdf-canvas {
  image-rendering: auto;
}

body[data-view="sign"] .field {
  scroll-margin: 160px;
}

body[data-view="sign"] .sign-guide {
  box-shadow:
    0 1px 0 rgba(255, 255, 255, .9) inset,
    0 16px 38px rgba(15, 23, 42, .08);
}

body[data-view="sign"] .sign-guide strong {
  letter-spacing: 0;
}

body[data-view="sign"] .check {
  min-height: 78px;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 14px;
  padding: 16px;
  border-radius: 22px;
  border-color: rgba(148, 163, 184, .55);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .98), rgba(248, 250, 252, .98));
  box-shadow:
    0 1px 0 rgba(255, 255, 255, .9) inset,
    0 14px 34px rgba(15, 23, 42, .07);
}

body[data-view="sign"] .check span {
  color: #1e293b;
  font-size: 15px;
  font-weight: 760;
  line-height: 1.35;
}

body[data-view="sign"] .check:hover {
  border-color: rgba(79, 70, 229, .52);
  background: #fff;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, .92) inset,
    0 22px 48px rgba(79, 70, 229, .12);
}

body[data-view="sign"] .check:active {
  transform: translateY(0) scale(.995);
}

body[data-view="sign"] .check:has(input:checked) {
  border-color: rgba(22, 163, 74, .42);
  background:
    linear-gradient(180deg, rgba(240, 253, 244, .98), rgba(236, 253, 245, .98));
  box-shadow:
    0 1px 0 rgba(255, 255, 255, .9) inset,
    0 22px 48px rgba(22, 163, 74, .14);
}

body[data-view="sign"] .check input {
  width: 36px;
  height: 36px;
  min-height: 36px;
  border-radius: 999px;
  border-color: #94a3b8;
  box-shadow: 0 8px 18px rgba(15, 23, 42, .08);
}

body[data-view="sign"] .check input::after {
  width: 10px;
  height: 16px;
  border-width: 0 3px 3px 0;
  transform: rotate(45deg) scale(.35);
}

body[data-view="sign"] .check input:checked {
  border-color: #16a34a;
  background: linear-gradient(135deg, #22c55e, #16a34a);
  box-shadow: 0 12px 24px rgba(22, 163, 74, .22);
  transform: scale(1.06);
}

body[data-view="sign"] .check input:checked::after {
  transform: rotate(45deg) scale(1);
}

body[data-view="sign"] .sign-trust-note {
  padding: 2px 8px;
  color: #64748b;
}

body[data-view="sign"] #complete-signing {
  letter-spacing: 0;
}

@media (max-width: 820px) {
  body[data-view="sign"] .sign-grid {
    padding: 10px;
    box-shadow:
      inset 0 1px 0 rgba(255, 255, 255, .82),
      0 18px 44px rgba(15, 23, 42, .10);
  }

  body[data-view="sign"] .sign-grid .document {
    width: 100%;
  }

  body[data-view="sign"] .sign-grid .pdf-page {
    outline-width: 6px;
    border-radius: 5px;
    scroll-margin: 86px;
  }

  body[data-view="sign"] .field {
    scroll-margin: 130px;
  }

  body[data-view="sign"] .sign-panel {
    gap: 12px;
  }

  body[data-view="sign"] .check {
    min-height: 74px;
    grid-template-columns: 40px minmax(0, 1fr);
    padding: 15px;
  }

  body[data-view="sign"] .check input {
    width: 34px;
    height: 34px;
    min-height: 34px;
  }
}

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

.auth-switch { margin: 10px 0 0; color: var(--muted); }
.linkish {
  border: 0;
  background: none;
  color: var(--brand, #4f46e5);
  padding: 0;
  font: inherit;
  cursor: pointer;
  text-decoration: underline;
}
.auth-terms { margin: 8px 0 14px; align-items: flex-start; }
.auth-legal, .signer-legal {
  margin-top: 18px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}
.auth-legal a, .signer-legal a, .sign-legal-links a { color: inherit; }
.signer-legal { padding: 8px 4px 24px; }
.sign-legal-links { margin: 8px 0 0; font-size: 13px; }
.billing-banner {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin: 0 0 16px;
  padding: 12px 14px;
  border-radius: 12px;
  background: #fff7ed;
  color: #9a3412;
}
.billing-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.billing-card strong { display: block; font-size: 1.4rem; margin: 6px 0; }
.billing-card span, .billing-card small { color: var(--muted); }
.billing-notice { grid-column: 1 / -1; margin: 0; }
.invoice-table article {
  display: grid;
  grid-template-columns: 1.2fr .8fr 1fr;
  gap: 12px;
  align-items: center;
  padding: 12px 0;
  border-top: 1px solid var(--line, #e2e8f0);
}
.stack-form { display: grid; gap: 12px; max-width: 420px; }
.settings-password { padding: 20px; }
@media (max-width: 800px) {
  .billing-grid, .invoice-table article { grid-template-columns: 1fr; }
}
