/* E-Signature (SIGNDOC) — projects-templates/e-signature.php */

/* Hide theme chrome for full-screen app */
body.e-signature-page .site-header,
body.e-signature-page .site-header__nav-backdrop {
  display: none !important;
}

body.e-signature-page {
  margin: 0;
}

body.e-signature-page .site-main.e-signature {
  max-width: none;
  margin: 0;
  padding: 0;
}

/* ——— Theme tokens (light is default) ——— */
.es-app {
  --es-font-sans: 'Inter', system-ui, sans-serif;
  --es-font-display: 'DM Serif Display', Georgia, 'Times New Roman', serif;
  --es-radius: 10px;
  --es-radius-pill: 999px;
  --es-transition: 0.2s ease;
  --es-bg: #f9f7f2;
  --es-bg-elevated: #ffffff;
  --es-bg-sidebar: #f3f1ec;
  --es-bg-canvas: #f0ede6;
  --es-text: #1a1a1a;
  --es-text-muted: #6b6560;
  --es-text-faint: #9a948c;
  --es-border: #ddd8cf;
  --es-border-strong: #c8c2b8;
  --es-accent: #1a1a1a;
  --es-accent-fg: #ffffff;
  --es-btn-light-bg: #ffffff;
  --es-btn-light-border: #ddd8cf;
  --es-dropzone-bg: transparent;
  --es-shadow-page: 0 4px 24px rgba(26, 26, 26, 0.08);
  --es-modal-overlay: rgba(26, 26, 26, 0.35);
  --es-pad-bg: #ffffff;
  --es-pad-ink: #1a1a1a;
  --es-field-border: #3662e3;
  --es-page-active-bg: #1a1a1a;
  --es-page-active-fg: #ffffff;
  min-height: 100vh;
  min-height: 100dvh;
  font-family: var(--es-font-sans);
  font-size: 0.9375rem;
  line-height: 1.5;
  color: var(--es-text);
  background: var(--es-bg);
  color-scheme: light;
}

.es-app[data-es-theme='light'] {
  color-scheme: light;
}

/* Dark theme — same neutrals as geometric-color-palettes (--gcp-*) */
.es-app[data-es-theme='dark'] {
  --es-bg: #252525;
  --es-bg-elevated: #2c2c2c;
  --es-bg-sidebar: #2c2c2c;
  --es-bg-canvas: #222222;
  --es-text: #ececec;
  --es-text-muted: #9a9a9a;
  --es-text-faint: #757575;
  --es-border: #3d3d3d;
  --es-border-strong: #4f4f4f;
  --es-accent: #ececec;
  --es-accent-fg: #252525;
  --es-btn-light-bg: #333333;
  --es-btn-light-border: #3d3d3d;
  --es-dropzone-bg: transparent;
  --es-shadow-page: 0 8px 28px rgba(0, 0, 0, 0.28);
  --es-modal-overlay: rgba(0, 0, 0, 0.52);
  --es-pad-bg: #333333;
  --es-pad-ink: #ececec;
  --es-field-border: #3662e3;
  --es-page-active-bg: #3662e3;
  --es-page-active-fg: #ffffff;
  color-scheme: dark;
}

body.e-signature-page:has(.es-app[data-es-theme='dark']) {
  background: #252525;
  color-scheme: dark;
}

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

/* DM Serif Display — OpenType ligatures (match Google Fonts preview) */
.es-landing__title,
.es-features__label {
  font-family: var(--es-font-display);
  font-weight: 400;
  font-variant-ligatures: common-ligatures contextual;
  font-feature-settings: 'liga' 1, 'clig' 1, 'kern' 1;
  text-rendering: optimizeLegibility;
}

.es-file-input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

/* Off-screen host for DOCX → PDF conversion (removed after use) */
.es-docx-host {
  position: fixed;
  left: -99999px;
  top: 0;
  width: 8.5in;
  pointer-events: none;
  visibility: hidden;
}

/* html2canvas cannot capture visibility:hidden / far off-screen nodes (blank PDF). */
.es-app.es-is-exporting-pdf .es-docx-host {
  left: 0;
  top: 0;
  width: 210mm;
  visibility: visible;
  z-index: 100000;
  pointer-events: none;
}

.es-html-doc--export {
  display: block !important;
  box-sizing: border-box;
  width: 210mm;
  min-height: 297mm;
  padding: 18mm 16mm;
  background: #fff;
  color: #1a1a1a;
  overflow: visible;
  box-shadow: none;
}

.es-html-doc--export .es-html-doc__inner {
  display: flex;
  flex-direction: column;
  min-height: calc(297mm - 36mm);
  transform: none !important;
  width: 100% !important;
}

/* Sample contract PDF export — A4 physical size for capture and PDF output */
.es-sample-export-page {
  position: relative;
  width: 210mm;
  height: 297mm;
  flex-shrink: 0;
  background: #fff;
  overflow: hidden;
  box-sizing: border-box;
}

.es-sample-export-page__doc {
  display: block !important;
  width: 100%;
  height: 100%;
  box-sizing: border-box;
  padding: 18mm 16mm;
  background: #fff;
  color: #1a1a1a;
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 12pt;
  line-height: 1.55;
  overflow: hidden;
}

.es-sample-export-page__doc .es-html-doc__inner {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
}

.es-sample-export-page__fields {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.es-sample-export-page__fields img,
.es-sample-export-page__fields .es-sample-export-page__date {
  position: absolute;
  box-sizing: border-box;
}

.es-sample-export-page__fields img {
  object-fit: contain;
}

.es-sample-export-page__date {
  display: flex;
  align-items: center;
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 12pt;
  line-height: 1.2;
  text-align: center;
  color: #1a1a1a;
  white-space: nowrap;
}

.es-docx-page {
  box-sizing: border-box;
  width: 8.5in;
  min-height: 11in;
  padding: 0.75in 0.85in;
  background: #fff;
  color: #1a1a1a;
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 12pt;
  line-height: 1.55;
}

.es-docx-page p {
  margin: 0 0 0.65em;
}

.es-docx-page h1,
.es-docx-page h2,
.es-docx-page h3 {
  margin: 1em 0 0.45em;
  line-height: 1.25;
}

.es-docx-page table {
  width: 100%;
  border-collapse: collapse;
  margin: 0.5em 0 1em;
}

.es-docx-page td,
.es-docx-page th {
  border: 1px solid #ccc;
  padding: 0.35em 0.5em;
  vertical-align: top;
}

/* ——— Wordmark ——— */
.es-wordmark {
  margin: 0;
  font-family: var(--es-font-sans);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--es-text-muted);
}

.es-wordmark--sm {
  font-size: 0.625rem;
  letter-spacing: 0.22em;
}

/* ——— Theme toggle ——— */
.es-theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  border: 1px solid var(--es-border);
  border-radius: var(--es-radius-pill);
  background: var(--es-bg-elevated);
  color: var(--es-text-muted);
  cursor: pointer;
  transition: border-color var(--es-transition), color var(--es-transition);
}

.es-theme-toggle:hover {
  border-color: var(--es-border-strong);
  color: var(--es-text);
}

.es-theme-toggle__icon {
  display: none;
  line-height: 0;
}

.es-app[data-es-theme='light'] .es-theme-toggle__icon--sun,
.es-app[data-es-theme='dark'] .es-theme-toggle__icon--moon {
  display: block;
}

.es-theme-toggle--compact {
  width: 2rem;
  height: 2rem;
}

/* ——— Buttons ——— */
.es-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.55rem 1.15rem;
  border-radius: 10px;
  border: 1px solid transparent;
  font: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: filter var(--es-transition), background var(--es-transition), border-color var(--es-transition);
}

.es-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.es-btn--dark {
  background: var(--es-accent);
  color: var(--es-accent-fg);
  border-color: var(--es-accent);
}

.es-btn--dark:hover:not(:disabled) {
  filter: brightness(1.08);
}

.es-btn--light {
  background: var(--es-btn-light-bg);
  color: var(--es-text);
  border-color: var(--es-btn-light-border);
}

.es-btn--light:hover:not(:disabled) {
  border-color: var(--es-border-strong);
}

.es-btn--outline {
  background: var(--es-bg-elevated);
  color: var(--es-text);
  border-color: var(--es-border);
}

.es-btn--outline:hover:not(:disabled) {
  border-color: var(--es-border-strong);
}

.es-btn--wide {
  width: 100%;
  max-width: 40rem;
  border-radius: 6px;
  background-color: transparent;
  border: 1px solid var(--es-border);
  padding: 16px;
}

.es-btn[data-es-sample-contract] {
  box-shadow: none;
  transition:
    background var(--es-transition),
    border-color var(--es-transition),
    box-shadow var(--es-transition);
}

.es-btn[data-es-sample-contract]:hover:not(:disabled) {
  border-color: var(--es-border-strong);
  box-shadow: 0 6px 18px rgba(26, 26, 26, 0.09);
}

.es-app[data-es-theme='dark'] .es-btn[data-es-sample-contract]:hover:not(:disabled) {
  border-color: #6a6a6a;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.22);
}

.es-app[data-es-theme='dark'] .es-btn[data-es-sample-contract] {
  border-color: #555555;
}

.es-app[data-es-theme='dark'] .es-dropzone {
  border-color: #636363;
}

.es-app[data-es-theme='dark'] .es-dropzone:hover,
.es-app[data-es-theme='dark'] .es-dropzone:focus-visible,
.es-app[data-es-theme='dark'] .es-dropzone.es-dropzone--drag {
  border-color: #858585;
}

.es-btn--text {
  padding: 0.35rem 0.5rem;
  background: transparent;
  border: none;
  color: var(--es-text-muted);
}

.es-btn--text:hover:not(:disabled) {
  color: var(--es-text);
}

/* ——— Landing ——— */
.es-landing {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 100vh;
  min-height: 100dvh;
  padding: clamp(1.5rem, 4vw, 2.5rem) clamp(1.25rem, 5vw, 2rem) 3rem;
}

.es-landing[hidden],
.es-editor[hidden] {
  display: none !important;
}

.es-landing__top {
  display: flex;
  justify-content: flex-end;
  align-self: flex-end;
  width: 100%;
  max-width: 40rem;
  margin-bottom: clamp(2rem, 8vh, 4rem);
}

.es-landing__hero {
  text-align: center;
  max-width: 35rem;
  margin-bottom: clamp(2rem, 5vh, 2.75rem);
}

.es-landing__title {
  margin: 0.75rem 0 0.65rem;
  font-size: clamp(2rem, 5.25vw, 2.875rem);
  line-height: 1.12;
  letter-spacing: 0;
  color: var(--es-text);
}

.es-landing__lead {
  margin: 0;
  font-size: 1rem;
  color: var(--es-text-muted);
  line-height: 1.55;
}

.es-dropzone {
  width: 100%;
  max-width: 40rem;
  padding: 2.5rem 1.5rem;
  border: 1px dashed var(--es-border-strong);
  border-radius: var(--es-radius);
  background: var(--es-dropzone-bg);
  text-align: center;
  cursor: pointer;
  transition: border-color var(--es-transition), background var(--es-transition);
}

.es-dropzone:hover,
.es-dropzone:focus-visible,
.es-dropzone.es-dropzone--drag {
  border-color: var(--es-text-muted);
  background: var(--es-bg-elevated);
  outline: none;
}

.es-dropzone__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 3rem;
  height: 3rem;
  margin: 0 auto 1rem;
  border-radius: 50%;
  border: 1px solid var(--es-border);
  color: var(--es-text-muted);
}

.es-dropzone__title {
  margin: 0 0 0.35rem;
  font-weight: 600;
  color: var(--es-text);
}

.es-dropzone__hint {
  margin: 0;
  font-size: 0.8125rem;
  color: var(--es-text-faint);
}

.es-landing__or {
  display: flex;
  align-items: center;
  gap: 1rem;
  width: 100%;
  max-width: 40rem;
  margin: 1.35rem 0;
}

.es-landing__or-line {
  flex: 1;
  height: 1px;
  background: var(--es-border);
}

.es-landing__or-text {
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  color: var(--es-text-faint);
}

.es-features {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(1rem, 4vw, 2.5rem);
  width: 100%;
  max-width: 42rem;
  margin: clamp(3rem, 10vh, 5rem) 0 0;
  padding: 0;
  list-style: none;
  text-align: center;
}

.es-features__label {
  display: block;
  margin-bottom: 0.35rem;
  font-size: 1rem;
  color: var(--es-text);
}

.es-features__desc {
  font-size: 0.8125rem;
  color: var(--es-text-muted);
  line-height: 1.45;
}

@media (max-width: 40rem) {
  .es-features {
    grid-template-columns: 1fr;
    gap: 1.25rem;
  }
}

/* ——— Editor ——— */
.es-app[data-es-view='editor'] {
  height: 100dvh;
  overflow: hidden;
}

.es-editor {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  overflow: hidden;
}

.es-editor__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem clamp(1rem, 3vw, 1.75rem);
  border-bottom: 1px solid var(--es-border);
  background: var(--es-bg);
}

.es-editor__brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
  padding: 0.2rem 0.45rem 0.2rem 0;
  margin: -0.2rem 0;
  border-radius: 8px;
  color: inherit;
  text-decoration: none;
  transition: background var(--es-transition), opacity var(--es-transition);
}

.es-editor__brand:hover {
  text-decoration: none;
  background: var(--es-bg-elevated);
  opacity: 0.92;
}

.es-editor__brand:focus-visible {
  outline: 2px solid var(--es-text-muted);
  outline-offset: 2px;
}

.es-editor__back {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  color: var(--es-text-muted);
}

.es-editor__brand-text {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  min-width: 0;
}

.es-editor__filename {
  font-size: 0.875rem;
  color: var(--es-text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: min(28vw, 14rem);
}

.es-editor__actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.es-editor__body {
  display: flex;
  flex: 1;
  min-height: 0;
}

/* ——— Sidebar ——— */
.es-sidebar {
  flex: 0 0 clamp(10rem, 18vw, 13.5rem);
  padding: 1.25rem 1rem;
  border-right: 1px solid var(--es-border);
  background: var(--es-bg-sidebar);
  overflow-y: auto;
}

.es-sidebar__title {
  margin: 0 0 1rem;
  font-size: 0.625rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--es-text-faint);
}

.es-page-nav {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.es-page-nav__btn {
  display: block;
  width: 100%;
  padding: 0.65rem 0.85rem;
  border: none;
  border-radius: 8px;
  background: transparent;
  text-align: left;
  font: inherit;
  cursor: pointer;
  transition: background var(--es-transition);
}

.es-page-nav__btn:hover {
  background: var(--es-bg-elevated);
}

.es-page-nav__btn--active {
  background: var(--es-page-active-bg);
  color: var(--es-page-active-fg);
}

.es-page-nav__btn--active .es-page-nav__sub {
  color: inherit;
  opacity: 0.75;
}

.es-page-nav__btn--active:hover,
.es-page-nav__btn--active:focus-visible {
  background: var(--es-bg-elevated);
  color: var(--es-text);
}

.es-page-nav__btn--active:hover .es-page-nav__sub,
.es-page-nav__btn--active:focus-visible .es-page-nav__sub {
  color: var(--es-text-muted);
  opacity: 1;
}

.es-page-nav__num {
  display: block;
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.es-page-nav__sub {
  display: block;
  margin-top: 0.15rem;
  font-size: 0.625rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--es-text-faint);
}

.es-app[data-es-theme='dark'] .es-page-nav__btn:hover:not(.es-page-nav__btn--active) {
  background: #383838;
}

.es-app[data-es-theme='dark'] .es-page-nav__btn--active:hover,
.es-app[data-es-theme='dark'] .es-page-nav__btn--active:focus-visible {
  background: #4a75e6;
  color: var(--es-page-active-fg);
}

.es-app[data-es-theme='dark'] .es-page-nav__btn--active:hover .es-page-nav__sub,
.es-app[data-es-theme='dark'] .es-page-nav__btn--active:focus-visible .es-page-nav__sub {
  color: inherit;
  opacity: 0.75;
}

/* ——— Canvas ——— */
.es-canvas-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--es-bg-canvas);
  position: relative;
}

.es-canvas-scroll {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: clamp(1rem, 2.5vw, 1.5rem);
  display: flex;
  justify-content: center;
  align-items: center;
}

.es-app[data-es-doc-mode='sample-html'] .es-canvas-scroll {
  align-items: center;
  padding: 0.5rem 0.65rem;
}

.es-canvas-scale-wrap {
  position: relative;
  flex-shrink: 0;
  overflow: hidden;
}

.es-app[data-es-doc-mode='sample-html'] .es-canvas-stage {
  width: 210mm;
  height: 297mm;
  flex-shrink: 0;
}

.es-canvas-stage {
  position: relative;
  background: #fff;
  box-shadow: var(--es-shadow-page);
}

.es-canvas {
  display: block;
  width: auto;
  max-width: 100%;
  max-height: 100%;
  height: auto;
  image-rendering: auto;
}

.es-app[data-es-doc-mode='sample-html'] .es-canvas {
  display: none !important;
}

.es-html-doc {
  display: none;
  width: 100%;
  height: 100%;
  box-sizing: border-box;
  padding: 18mm 16mm;
  background: #fff;
  color: #1a1a1a;
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 12pt;
  line-height: 1.55;
  overflow: hidden;
}

.es-html-doc:not([hidden]) {
  display: block;
  background-color: #f9f7f2;
}

.es-html-doc__inner {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
}

.es-html-doc__eyebrow {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 2.25rem;
  font-family: Courier, 'Courier New', monospace;
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #6f6a63;
}

.es-html-doc__badge {
  width: 2rem;
  height: 2rem;
  border: 1px solid #2a2724;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.88rem;
  font-weight: 600;
  color: #2a2724;
}

.es-html-doc__title {
  margin: 0 0 1.1rem;
  font-family: var(--es-font-display);
  font-size: 1.75rem;
  line-height: 1.1;
  color: #1b1814;
}

.es-html-doc__rule {
  border-top: 1px solid #d8d3cb;
  margin-bottom: 1.8rem;
}

.es-html-doc__subtitle {
  margin: 0 0 0.5rem;
  font-family: var(--es-font-display);
  font-size: 1.35rem;
  line-height: 1.12;
  color: #1b1814;
}

.es-html-doc__meta {
  margin: 0 0 1.4rem;
  font-family: Courier, 'Courier New', monospace;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  color: #6f6a63;
}

.es-html-doc__section {
  margin: 0 0 1.18rem;
}

.es-html-doc__section h3 {
  margin: 0 0 0.52rem;
  font-family: var(--es-font-sans);
  font-size: 0.98rem;
  letter-spacing: 0.01em;
  text-transform: none;
  color: #2b2824;
}

.es-html-doc__section p {
  margin: 0;
}

.es-html-doc__grow {
  flex: 1;
  min-height: 2rem;
}

.es-html-doc__sign-row {
  display: grid;
  grid-template-columns: 1fr 0.44fr;
  gap: 1.15rem;
  margin-top: 1.75rem;
}

.es-html-doc__sign-col {
  min-width: 0;
}

.es-html-doc__signature-line {
  width: 100%;
  border-top: 1px solid #1a1a1a;
  margin-bottom: 0.4rem;
}

.es-html-doc__signature-label {
  font-family: var(--es-font-sans);
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: none;
  color: #6f6a63;
}

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

.es-field-layer:not([hidden]) {
  pointer-events: auto;
}

.es-signature-field {
  position: absolute;
  border: 1px dashed var(--es-field-border);
  border-radius: 6px;
  background: rgba(54, 98, 227, 0.06);
  overflow: visible;
  touch-action: none;
  transition: box-shadow 0.15s ease, border-color 0.15s ease;
}

.es-signature-field--signed {
  border: 1px solid #c8c4bc;
  background: rgba(255, 255, 255, 0.35);
}

.es-app[data-es-theme='dark'] .es-signature-field--signed {
  border-color: var(--es-border-strong);
  background: rgba(51, 51, 51, 0.55);
}

/* Editor document pages are white — signed fields stay paper-like in every theme */
.es-app[data-es-view='editor'] .es-signature-field--signed {
  border: 1px solid #c8c4bc;
  background: rgba(255, 255, 255, 0.35);
}

.es-app[data-es-view='editor'] .es-date-field.es-signature-field--signed {
  border-color: transparent;
  background: transparent;
}

.es-app[data-es-view='editor'] .es-signature-field--dragging {
  box-shadow: 0 8px 24px rgba(26, 26, 26, 0.14);
}

.es-signature-field--dragging {
  box-shadow: 0 8px 24px rgba(26, 26, 26, 0.14);
}

.es-app[data-es-theme='dark'] .es-signature-field--dragging {
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.28);
}

.es-signature-field__toolbar {
  position: absolute;
  top: -0.55rem;
  right: -0.55rem;
  z-index: 2;
  display: flex;
  gap: 0.3rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
}

.es-signature-field--signed:hover .es-signature-field__toolbar,
.es-signature-field--signed.es-signature-field--dragging .es-signature-field__toolbar {
  opacity: 1;
  pointer-events: auto;
}

.es-sig-control {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.65rem;
  height: 1.65rem;
  padding: 0;
  border: none;
  border-radius: 5px;
  color: #fff;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.18);
  transition: filter 0.15s ease, transform 0.15s ease;
}

.es-sig-control:hover {
  filter: brightness(1.08);
}

.es-sig-control:active {
  transform: scale(0.96);
}

.es-sig-control--move {
  background: #2f5e48;
  cursor: grab;
}

.es-sig-control--delete {
  background: #b83838;
}

.es-signature-field--dragging .es-sig-control--move {
  cursor: grabbing;
}

.es-signature-field__img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
  border-radius: 4px;
}

/* ——— Modal ——— */
.es-modal {
  position: fixed;
  inset: 0;
  z-index: 100000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.es-modal[hidden] {
  display: none !important;
}

.es-modal__backdrop {
  position: absolute;
  inset: 0;
  background: var(--es-modal-overlay);
  border: none;
  cursor: pointer;
}

.es-modal__panel {
  position: relative;
  width: 100%;
  max-width: 24rem;
  background: var(--es-bg-elevated);
  border: 1px solid var(--es-border);
  border-radius: 12px;
  box-shadow: var(--es-shadow-page);
}

.es-modal__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.15rem;
  border-bottom: 1px solid var(--es-border);
}

.es-modal__title {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
}

.es-modal__close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border: none;
  background: transparent;
  font-size: 1.35rem;
  line-height: 1;
  color: var(--es-text-muted);
  cursor: pointer;
}

.es-modal__close:hover {
  color: var(--es-text);
}

.es-modal__body {
  padding: 1.15rem;
}

.es-pad-wrap {
  border: 1px solid #ddd8cf;
  border-radius: 8px;
  overflow: hidden;
  background: #ffffff;
}

.es-app[data-es-theme='dark'] .es-pad-wrap {
  border-color: #c8c2b8;
}

.es-pad {
  display: block;
  width: 100%;
  height: 140px;
  touch-action: none;
  cursor: crosshair;
}

.es-pad-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-top: 0.85rem;
}

.es-pad-controls__sliders {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.es-pad-controls__label {
  font-size: 0.8125rem;
  color: var(--es-text-muted);
  white-space: nowrap;
}

.es-pad-controls .es-range {
  flex: 1;
  min-width: 4rem;
  accent-color: var(--es-accent);
}

.es-btn--pad-clear {
  flex-shrink: 0;
  padding: 0.45rem 0.85rem;
  font-size: 0.8125rem;
}

.es-modal__foot {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem;
  padding: 1rem 1.15rem;
  border-top: 1px solid var(--es-border);
}

.es-modal__foot .es-btn--modal-primary {
  flex: 1;
  min-width: 0;
  background: var(--es-accent);
  color: var(--es-accent-fg);
  border-color: var(--es-accent);
  padding: 0.55rem 1.15rem;
}

.es-modal__foot .es-btn--modal-primary:hover:not(:disabled) {
  filter: brightness(1.08);
}

.es-modal__foot .es-btn--modal-primary:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  filter: none;
  background: var(--es-accent);
  color: var(--es-accent-fg);
}

.es-date-field__text {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  padding: 0.15rem 0.25rem;
  box-sizing: border-box;
  font-family: var(--es-font-sans);
  font-size: 0.9375rem;
  font-weight: 400;
  line-height: 1.2;
  text-align: center;
  color: #1a1a1a;
  pointer-events: none;
  white-space: nowrap;
}

.es-date-field.es-signature-field--signed {
  border: 1px solid transparent;
  background: transparent;
}

/* ——— Toast & loading ——— */
.es-toast {
  position: absolute;
  z-index: 12;
  left: 50%;
  top: 1.25rem;
  transform: translateX(-50%);
  margin: 0;
  padding: 0.65rem 1.15rem;
  border-radius: var(--es-radius-pill);
  font-size: 0.8125rem;
  white-space: nowrap;
  pointer-events: none;
  background: var(--es-accent);
  color: var(--es-accent-fg);
  box-shadow: var(--es-shadow-page);
}

.es-toast[hidden] {
  display: none !important;
}

.es-toast--error {
  background: #8b2e2e;
  color: #fff;
}

.es-app--loading::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 99999;
  background: var(--es-modal-overlay);
  pointer-events: all;
}

@media (max-width: 48rem) {
  .es-editor__bar {
    flex-wrap: wrap;
  }

  .es-editor__filename {
    display: none;
  }

  .es-sidebar {
    flex: 0 0 auto;
    width: 100%;
    border-right: none;
    border-bottom: 1px solid var(--es-border);
    padding: 0.75rem 1rem;
  }

  .es-page-nav {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 0.35rem;
  }

  .es-page-nav__btn {
    width: auto;
    padding: 0.45rem 0.75rem;
  }

  .es-editor__body {
    flex-direction: column;
    min-height: 0;
  }

  .es-canvas-wrap {
    flex: 1;
    min-height: 12rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .es-btn,
  .es-dropzone,
  .es-page-nav__btn,
  .es-theme-toggle {
    transition: none;
  }
}
