/* Gerador de assinatura de e-mail — UI clara estilo SaaS (Dica) */

.esig-app {
  --esig-bg: #eef1f8;
  --esig-surface: #ffffff;
  --esig-surface-2: #fafbfe;
  --esig-rail: #0b1530;
  --esig-rail-2: #121c3a;
  --esig-blue: #3b5bff;
  --esig-blue-hover: #2f4ae6;
  --esig-blue-soft: #eef1ff;
  --esig-ink: #1a1a2e;
  --esig-muted: #6b7280;
  --esig-label: #374151;
  --esig-border: #e5e8f0;
  --esig-input: #f6f7fb;
  --esig-input-border: #e4e7ef;
  --esig-input-focus-bg: #ffffff;
  --esig-placeholder: #9ca3af;
  --esig-radius: 14px;
  --esig-radius-sm: 10px;
  --esig-font: "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
  --esig-rail-w: 88px;
  --esig-shadow: 0 8px 28px rgba(15, 23, 42, 0.06);
  --esig-shadow-sm: 0 2px 10px rgba(15, 23, 42, 0.04);
  --esig-ghost-hover: #f3f4f8;
  --esig-client-hover: #f4f6fb;
  --esig-form-footer-border: #f0f2f7;

  position: relative;
  display: flex;
  width: 100%;
  max-width: none;
  margin: 0;
  min-height: 560px;
  background: var(--esig-bg);
  color: var(--esig-ink);
  font-family: var(--esig-font);
  color-scheme: light;
  overflow: hidden;
  border-radius: 0;
}

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

.esig-app p { margin: 0; }

/* Prevent theme CSS from stretching every SVG to full width (was drawing lines over inputs) */
.esig-app svg {
  max-width: 100%;
  height: auto;
}
.esig-app .esig-rail-ico svg,
.esig-app .esig-client-ico svg,
.esig-app .esig-btn-primary svg,
.esig-app .esig-btn-ghost svg {
  max-width: none;
  height: auto;
}

/* ---- Fullscreen workspace ---- */
body.is-fullscreen .fs-workspace:has(#esig-tool),
body.is-fullscreen .fs-workspace:has(.esig-app) {
  --esig-app-h: calc(100vh - 128px);
  --fs-workspace-min: var(--esig-app-h);
  height: var(--esig-app-h);
  min-height: 560px;
  max-height: var(--esig-app-h);
  padding: 0;
  border: 0;
  background: var(--esig-bg);
  overflow: hidden;
}

body.is-fullscreen .fs-workspace .esig-app {
  height: 100%;
  min-height: 0;
  max-height: 100%;
}

/* ---- Left rail ---- */
.esig-rail {
  flex: 0 0 var(--esig-rail-w);
  width: var(--esig-rail-w);
  background: linear-gradient(180deg, var(--esig-rail) 0%, #0a1228 100%);
  color: #c9d1e8;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 12px 8px 12px;
  z-index: 3;
}

.esig-rail-nav {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
  align-items: center;
  flex: 1 1 auto;
  padding-top: 0;
}

.esig-rail-item {
  appearance: none;
  border: 0;
  background: transparent;
  color: #9aa6c7;
  width: 100%;
  max-width: 72px;
  padding: 10px 4px 8px;
  border-radius: 12px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  font: inherit;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.15;
  transition: background .15s ease, color .15s ease;
}
.esig-rail-item:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #e8ecf8;
}
.esig-rail-item.is-active {
  background: var(--esig-blue);
  color: #fff;
  box-shadow: 0 6px 16px rgba(59, 91, 255, 0.35);
}
.esig-rail-ico {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
}
.esig-rail-ico svg { display: block; }

/* ---- Shell (right of rail) ---- */
.esig-shell {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ---- Workspace 2-col ---- */
.esig-workspace {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(320px, 1fr) minmax(340px, 1.05fr);
  gap: 16px;
  padding: 16px 18px 18px;
  overflow: hidden;
}

.esig-card {
  background: var(--esig-surface);
  border: 1px solid rgba(226, 232, 240, 0.9);
  border-radius: var(--esig-radius);
  box-shadow: var(--esig-shadow);
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.esig-card-title {
  margin: 0 0 4px;
  font-size: 18px;
  font-weight: 700;
  color: var(--esig-ink);
  letter-spacing: -0.01em;
}
.esig-card-sub {
  margin: 0 0 18px;
  font-size: 13px;
  color: var(--esig-muted);
}
.esig-req { color: #ef4444; font-weight: 700; }

/* ---- Form card ---- */
.esig-form-card {
  padding: 0;
}
.esig-panels {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  padding: 20px 22px 8px;
  scrollbar-width: thin;
}
.esig-panel { display: none; }
.esig-panel.is-active { display: block; }

.esig-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px 14px;
}
.esig-field { min-width: 0; }
.esig-field.full { grid-column: 1 / -1; }
.esig-field label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--esig-label);
  margin-bottom: 6px;
}

/* Beat theme form resets */
.esig-app input:not([type="checkbox"]):not([type="radio"]):not([type="color"]):not([type="range"]),
.esig-app select,
.esig-app textarea {
  appearance: none;
  -webkit-appearance: none;
  background-color: var(--esig-input) !important;
  color: var(--esig-ink) !important;
  border: 1px solid var(--esig-input-border);
  border-radius: var(--esig-radius-sm);
  font: inherit;
  font-size: 14px !important;
  line-height: 1.35;
  padding: 10px 12px !important;
  width: 100%;
  min-height: 42px;
  transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}
.esig-app input::placeholder,
.esig-app textarea::placeholder {
  color: var(--esig-placeholder) !important;
  opacity: 1;
}
.esig-app input:focus,
.esig-app select:focus,
.esig-app textarea:focus {
  outline: none;
  border-color: var(--esig-blue) !important;
  box-shadow: 0 0 0 3px rgba(59, 91, 255, 0.15);
  background: var(--esig-input-focus-bg) !important;
}
.esig-app textarea {
  min-height: 64px;
  resize: vertical;
}
.esig-app input[type="checkbox"] {
  appearance: auto;
  -webkit-appearance: auto;
  width: 16px !important;
  height: 16px !important;
  min-width: 16px;
  padding: 0 !important;
  margin: 0 !important;
  accent-color: var(--esig-blue);
  cursor: pointer;
}
.esig-app input[type="range"] {
  appearance: auto;
  -webkit-appearance: auto;
  background: transparent !important;
  border: 0 !important;
  min-height: 0;
  padding: 0 !important;
  height: 28px;
  cursor: pointer;
  accent-color: var(--esig-blue);
}
.esig-app input[type="color"] {
  width: 36px;
  height: 36px;
  padding: 2px !important;
  border: 1px solid var(--esig-input-border);
  border-radius: 8px;
  background: var(--esig-input-focus-bg) !important;
  cursor: pointer;
}
.esig-app select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='%236b7280'%3E%3Cpath d='M7 10l5 5 5-5z'/%3E%3C/svg%3E") !important;
  background-repeat: no-repeat !important;
  background-position: right 12px center !important;
  padding-right: 36px !important;
  cursor: pointer;
}

.esig-field .err {
  display: none;
  color: #dc2626;
  font-size: 12px;
  margin-top: 4px;
}
.esig-field.is-invalid .err { display: block; }
.esig-field.is-invalid input,
.esig-field.is-invalid .esig-input-ico input {
  border-color: #fca5a5 !important;
}

.esig-char {
  text-align: right;
  font-size: 11px;
  color: var(--esig-muted);
  margin-top: 4px;
}
.esig-field .hint,
.esig-panel .hint {
  display: block;
  font-size: 12px;
  color: var(--esig-muted);
  margin-top: 6px;
}

.esig-section-title {
  margin: 22px 0 12px;
  font-size: 14px;
  font-weight: 700;
  color: var(--esig-ink);
}

.esig-form-footer {
  flex: 0 0 auto;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
  padding: 12px 22px 16px;
  border-top: 1px solid var(--esig-form-footer-border);
  background: var(--esig-surface);
}
.esig-next-link {
  font-size: 14px !important;
  font-weight: 600 !important;
}

/* ---- Image cards / draw ---- */
.esig-img-card {
  border: 1px solid var(--esig-border);
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 12px;
  background: var(--esig-surface-2);
}
.esig-img-card h3 {
  margin: 0 0 10px;
  font-size: 14px;
  font-weight: 700;
}
.esig-size-row {
  display: flex;
  align-items: center;
  gap: 12px;
}
.esig-size-row input[type="range"] { flex: 1; }
.esig-size-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--esig-muted);
  min-width: 44px;
  text-align: right;
}
.esig-draw-wrap {
  border: 1px dashed var(--esig-border);
  border-radius: 10px;
  background: #fff; /* keep white — drawing surface */
  overflow: hidden;
  position: relative;
  height: 120px;
}
.esig-draw-wrap canvas {
  display: block;
  width: 100% !important;
  height: 120px !important;
  max-width: 100%;
  cursor: crosshair;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}
.esig-draw-actions { margin-top: 8px; }

/* ---- Templates ---- */
.esig-tpl-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.esig-tpl {
  position: relative;
  display: block;
  border: 2px solid var(--esig-border);
  border-radius: 12px;
  overflow: hidden;
  cursor: pointer;
  background: var(--esig-surface);
  transition: border-color .15s, box-shadow .15s;
}
.esig-tpl input { position: absolute; opacity: 0; pointer-events: none; }
.esig-tpl-label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  color: var(--esig-muted);
  padding: 6px 8px 0;
}
.esig-tpl-preview {
  display: block;
  position: relative;
  padding: 6px 8px 10px;
}
.esig-tpl-preview img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 6px;
  background: var(--esig-input);
}
.esig-tpl.is-selected {
  border-color: var(--esig-blue);
  box-shadow: 0 0 0 3px rgba(59, 91, 255, 0.12);
}
.esig-tpl-check {
  position: absolute;
  top: 10px;
  right: 12px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--esig-blue);
  display: none;
  align-items: center;
  justify-content: center;
}
.esig-tpl.is-selected .esig-tpl-check { display: flex; }

/* ---- Colors / font ---- */
.esig-color-row {
  display: flex;
  align-items: center;
  gap: 0;
  border: 1px solid var(--esig-input-border);
  border-radius: var(--esig-radius-sm);
  background: var(--esig-input);
  overflow: hidden;
  max-width: 280px;
}
.esig-color-row .esig-hash {
  padding: 0 0 0 12px;
  color: var(--esig-muted);
  font-weight: 600;
}
.esig-color-row input[type="text"] {
  border: 0 !important;
  box-shadow: none !important;
  background: transparent !important;
  min-height: 40px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace !important;
}
.esig-color-ok {
  color: #16a34a;
  font-weight: 700;
  padding: 0 6px;
  opacity: 0;
}
.esig-color-row.is-valid .esig-color-ok { opacity: 1; }
.esig-swatch {
  display: flex;
  align-items: center;
  padding: 4px 6px;
  margin: 0;
  cursor: pointer;
}
.esig-font-slider {
  position: relative;
  padding-top: 28px;
}
.esig-font-bubble {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  background: var(--esig-blue);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 6px;
  white-space: nowrap;
  pointer-events: none;
}

/* ---- Buttons ---- */
.esig-btn-primary {
  appearance: none;
  border: 0;
  background: var(--esig-blue);
  color: #fff !important;
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  padding: 11px 18px;
  border-radius: 10px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 6px 16px rgba(59, 91, 255, 0.28);
  transition: background .15s, transform .1s;
}
.esig-btn-primary:hover { background: var(--esig-blue-hover); }
.esig-btn-primary:active { transform: translateY(1px); }
.esig-btn-primary.is-success { background: #16a34a; box-shadow: none; }

.esig-btn-ghost {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--esig-muted);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  padding: 10px 12px;
  border-radius: 10px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: color .15s, background .15s;
}
.esig-btn-ghost:hover {
  color: var(--esig-ink);
  background: var(--esig-ghost-hover);
}

.esig-btn-link {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--esig-blue);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  padding: 0;
  cursor: pointer;
  text-decoration: none;
}
.esig-btn-link:hover { text-decoration: underline; }

.esig-check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--esig-ink);
  cursor: pointer;
  user-select: none;
}

/* ---- Preview card ---- */
.esig-preview-card {
  padding: 20px 22px 16px;
}
.esig-client-switch {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
  justify-content: center;
}
.esig-client-btn {
  appearance: none;
  border: 1px solid transparent;
  background: transparent;
  color: var(--esig-muted);
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  padding: 8px 12px;
  border-radius: 10px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background .15s, color .15s, border-color .15s, box-shadow .15s;
}
.esig-client-btn:hover {
  background: var(--esig-client-hover);
  color: var(--esig-ink);
}
.esig-client-btn.is-active {
  background: var(--esig-surface);
  color: var(--esig-ink);
  border-color: var(--esig-border);
  box-shadow: var(--esig-shadow-sm);
}
.esig-client-ico {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  width: 18px !important;
  height: 18px !important;
  min-width: 18px !important;
  max-width: 18px !important;
  flex-shrink: 0;
  line-height: 0;
}
.esig-client-ico svg {
  width: 18px !important;
  height: 18px !important;
  max-width: 18px !important;
  display: block;
}

.esig-mail {
  --esig-mail-ink: #1a1a2e;
  --esig-mail-muted: #5f6368;
  --esig-mail-bg: #ffffff;
  --esig-mail-meta-bg: #ffffff;
  --esig-mail-border: #e5e8ef;
  --esig-mail-hint-bg: #fafbfe;
  --esig-mail-hint-color: var(--esig-muted);
  --esig-mail-skeleton: #eef1f6;
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--esig-mail-bg);
  color: var(--esig-mail-ink);
  border: 1px solid var(--esig-border);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: var(--esig-shadow-sm);
  isolation: isolate;
}
.esig-mail-chrome {
  flex: 0 0 auto;
  min-height: 40px;
  background: linear-gradient(180deg, #f4f6fa, #ebeff5);
  border-bottom: 1px solid #e5e8ef;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 14px;
  transition: background .2s ease, border-color .2s ease;
}
.esig-mail-dots {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}
.esig-mail-dots i {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: block;
  background: #ff5f57;
}
.esig-mail-dots i:nth-child(2) { background: #febc2e; }
.esig-mail-dots i:nth-child(3) { background: #28c840; }
.esig-mail-chrome-title {
  font-size: 12px;
  font-weight: 700;
  color: #5f6368;
  letter-spacing: 0.01em;
}

.esig-mail-meta {
  flex: 0 0 auto;
  padding: 14px 18px 10px;
  font-size: 13px;
  color: var(--esig-mail-ink);
  line-height: 1.7;
  border-bottom: 1px solid var(--esig-mail-border);
  transition: background .2s ease, border-color .2s ease, color .2s ease;
  background: var(--esig-mail-meta-bg);
}
.esig-mail-meta-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
  color: var(--esig-mail-ink);
}
.esig-mail-meta strong,
.esig-mail-meta #esig-mail-to-label,
.esig-mail-meta #esig-mail-subj-label {
  color: var(--esig-mail-ink);
  font-weight: 700;
  min-width: 4.5em;
  opacity: 0.95;
}
.esig-mail-meta #esig-mail-subj-text {
  color: var(--esig-mail-ink);
  opacity: 0.9;
}
.esig-to-pill {
  display: inline-block;
  background: #e8f0fe;
  color: #1967d2;
  border-radius: 999px;
  padding: 2px 10px;
  font-size: 12px;
  font-weight: 600;
  transition: background .2s, color .2s;
}
.esig-mail-hint {
  flex: 0 0 auto;
  margin: 0;
  padding: 8px 14px 10px;
  font-size: 11px;
  line-height: 1.4;
  color: var(--esig-mail-hint-color);
  background: var(--esig-mail-hint-bg);
  border-top: 1px solid var(--esig-mail-border);
}
.esig-mail-skeleton {
  flex: 0 0 auto;
  padding: 12px 18px 6px;
}
.esig-mail-skeleton span {
  display: block;
  height: 8px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--esig-mail-skeleton), transparent, var(--esig-mail-skeleton));
  opacity: 0.7;
  margin-bottom: 8px;
  max-width: 92%;
}
.esig-mail-skeleton span:last-child { max-width: 62%; }

.esig-mail-body {
  flex: 1 1 auto;
  min-height: 200px;
  max-height: none;
  padding: 8px 18px 18px;
  overflow: auto;
  position: relative;
  background: var(--esig-mail-bg);
  color: var(--esig-mail-ink);
}
.esig-sig-frame {
  min-height: 200px !important;
  width: 100%;
  border: 0;
  background: transparent;
  filter: none !important;
}

.esig-sig-host {
  position: absolute;
  left: -9999px;
  top: 0;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
}
.esig-sig-frame {
  display: block;
  width: 100%;
  min-height: 160px;
  border: 0;
  background: transparent;
}

.esig-empty-preview {
  padding: 28px 12px;
  text-align: center;
  color: var(--esig-mail-muted, var(--esig-muted));
  font-size: 13px;
  line-height: 1.5;
}

.esig-preview-actions {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 14px;
  padding-top: 4px;
}

/* ---- Client skins (visible preview chrome only — signature HTML unchanged) ---- */

/* Gmail — brand red bar (like Outlook’s blue bar) */
.esig-mail[data-client-skin="gmail"] {
  border-color: #f6aea9;
}
.esig-mail[data-client-skin="gmail"] .esig-mail-chrome {
  background: linear-gradient(180deg, #ea4335, #d93025);
  border-bottom-color: #c5221f;
}
.esig-mail[data-client-skin="gmail"] .esig-mail-dots { display: none; }
.esig-mail[data-client-skin="gmail"] .esig-mail-chrome-title {
  color: #fff;
  font-size: 13px;
}
.esig-mail[data-client-skin="gmail"] .esig-mail-meta {
  background: #fff;
  border-bottom-color: #f1f3f4;
}
.esig-mail[data-client-skin="gmail"] .esig-to-pill {
  background: #fce8e6;
  color: #c5221f;
}
.esig-mail[data-client-skin="gmail"] .esig-mail-hint {
  border-top-color: #fce8e6;
  color: #c5221f;
  background: #fef7f6;
}

/* Outlook */
.esig-mail[data-client-skin="outlook"] {
  border-color: #c7e0f4;
}
.esig-mail[data-client-skin="outlook"] .esig-mail-chrome {
  background: linear-gradient(180deg, #0078d4, #106ebe);
  border-bottom-color: #005a9e;
}
.esig-mail[data-client-skin="outlook"] .esig-mail-dots { display: none; }
.esig-mail[data-client-skin="outlook"] .esig-mail-chrome-title {
  color: #fff;
  font-size: 13px;
}
.esig-mail[data-client-skin="outlook"] .esig-mail-meta {
  background: #f3f9fd;
  border-bottom-color: #c7e0f4;
}
.esig-mail[data-client-skin="outlook"] .esig-to-pill {
  background: #deecf9;
  color: #0078d4;
  border-radius: 2px;
}
.esig-mail[data-client-skin="outlook"] .esig-mail-hint {
  background: #f3f9fd;
  color: #0078d4;
  border-top-color: #c7e0f4;
}

/* Apple Mail */
.esig-mail[data-client-skin="apple"] {
  border-color: #d2d2d7;
  border-radius: 12px;
}
.esig-mail[data-client-skin="apple"] .esig-mail-chrome {
  background: linear-gradient(180deg, #f6f6f6, #e8e8ed);
  border-bottom-color: #d2d2d7;
  justify-content: center;
  position: relative;
}
.esig-mail[data-client-skin="apple"] .esig-mail-dots {
  position: absolute;
  left: 14px;
}
.esig-mail[data-client-skin="apple"] .esig-mail-chrome-title {
  color: #1d1d1f;
  font-weight: 600;
}
.esig-mail[data-client-skin="apple"] .esig-mail-meta {
  background: #fafafa;
  border-bottom-color: #e5e5ea;
}
.esig-mail[data-client-skin="apple"] .esig-to-pill {
  background: #e8e8ed;
  color: #1d1d1f;
  border-radius: 6px;
}
.esig-mail[data-client-skin="apple"] .esig-mail-hint {
  background: #fafafa;
  color: #6e6e73;
  border-top-color: #e5e5ea;
}

/* Yahoo Mail */
.esig-mail[data-client-skin="yahoo"] {
  border-color: #d4b8f0;
}
.esig-mail[data-client-skin="yahoo"] .esig-mail-chrome {
  background: linear-gradient(180deg, #6001d2, #7b1fa2);
  border-bottom-color: #4a00a8;
}
.esig-mail[data-client-skin="yahoo"] .esig-mail-dots { display: none; }
.esig-mail[data-client-skin="yahoo"] .esig-mail-chrome-title {
  color: #fff;
  font-size: 13px;
}
.esig-mail[data-client-skin="yahoo"] .esig-mail-meta {
  background: #faf5ff;
  border-bottom-color: #e9d5ff;
}
.esig-mail[data-client-skin="yahoo"] .esig-to-pill {
  background: #f3e8ff;
  color: #6001d2;
  border-radius: 4px;
}
.esig-mail[data-client-skin="yahoo"] .esig-mail-hint {
  background: #faf5ff;
  color: #6001d2;
  border-top-color: #e9d5ff;
}

.esig-client-btn.is-active {
  border-color: var(--esig-blue);
  box-shadow: 0 0 0 2px rgba(59, 91, 255, 0.15);
}

/* ---- Modal ---- */
.esig-modal {
  position: fixed;
  inset: 0;
  z-index: 10050;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.esig-modal.is-open { display: flex; }
.esig-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(2px);
}
.esig-modal-card {
  position: relative;
  z-index: 1;
  width: min(520px, 100%);
  background: #fff;
  border-radius: 16px;
  padding: 28px 24px 22px;
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.22);
  color: var(--esig-ink);
}
.esig-modal-close {
  position: absolute;
  top: 12px;
  right: 14px;
  appearance: none;
  border: 0;
  background: transparent;
  font-size: 26px;
  line-height: 1;
  color: var(--esig-muted);
  cursor: pointer;
  width: 36px;
  height: 36px;
}
.esig-modal-card h3 {
  margin: 0 0 8px;
  font-size: 20px;
  font-weight: 800;
}
.esig-modal-card > p {
  margin: 0 0 18px;
  font-size: 14px;
  color: var(--esig-muted);
  line-height: 1.5;
}
.esig-modal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}
#email-html {
  display: none;
  margin-top: 10px;
}
#email-html.htmlopen { display: block; }
#email-html-textarea {
  width: 100%;
  min-height: 140px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace !important;
  font-size: 12px !important;
  resize: vertical;
}
.esig-modal-tip {
  margin: 12px 0 0 !important;
  font-size: 12px !important;
  color: var(--esig-muted) !important;
  line-height: 1.45;
}

.esig-toast {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  display: none;
}
.esig-toast.is-visible { display: block; }
.esig-toast.is-ok {
  background: #ecfdf5;
  color: #047857;
  border: 1px solid #a7f3d0;
}
.esig-toast.is-err {
  background: #fef2f2;
  color: #b91c1c;
  border: 1px solid #fecaca;
}

/* ---- Article helpers (below tool) ---- */
.esig-checklist { margin: 0 0 1.25rem; padding-left: 1.2rem; }
.esig-checklist li { margin-bottom: 0.4rem; }
.esig-client-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 1rem;
}
.esig-client-tabs button {
  appearance: none;
  border: 1px solid var(--esig-border, #e5e8f0);
  background: #fff;
  color: #374151;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  padding: 8px 14px;
  border-radius: 999px;
  cursor: pointer;
}
.esig-client-tabs button.is-active {
  background: var(--esig-blue, #3b5bff);
  border-color: var(--esig-blue, #3b5bff);
  color: #fff;
}
.esig-client-panel { display: none; }
.esig-client-panel.is-active { display: block; }

.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
}

/* Mobile sticky chrome wrapper — desktop: transparent flex for left rail */
.esig-mobile-sticky {
  display: contents; /* desktop: children participate in .esig-app flex (rail left) */
}
.esig-mobile-modes {
  display: none;
}

/* ---- Responsive ---- */
@media (max-width: 1100px) {
  .esig-workspace {
    grid-template-columns: 1fr;
    overflow: auto;
  }
  .esig-form-card,
  .esig-preview-card {
    min-height: auto;
  }
  .esig-panels {
    max-height: none;
  }
  body.is-fullscreen .fs-workspace:has(#esig-tool) {
    height: auto;
    max-height: none;
    overflow: auto;
  }
  body.is-fullscreen .fs-workspace .esig-app {
    height: auto;
    max-height: none;
    min-height: calc(100vh - 128px);
  }
}

/* HubSpot-style mobile:
   1) Editar | Prévia  (sticky)
   2) Dados / Imagem / Modelos / Estilos / Extras  (sticky under tabs)
   3) Form OR full preview  (scrolls)
*/
@media (max-width: 720px) {
  .esig-app {
    flex-direction: column;
    /* overflow visible so sticky sticks to page/fs-workspace scroll */
    overflow: visible;
    min-height: 0;
  }

  /* Fixed stack: Edit/Preview + icons stay pinned (sticky fails under overflow parents) */
  .esig-mobile-sticky {
    display: flex;
    flex-direction: column;
    flex: 0 0 auto;
    order: 0;
    position: fixed;
    top: var(--esig-fixed-top, 0px);
    left: 0;
    right: 0;
    width: 100%;
    max-width: 100vw;
    z-index: 200;
    background: var(--esig-surface);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.22);
  }
  /* Spacer so form content is not hidden under the fixed chrome */
  .esig-app::before {
    content: "";
    display: block;
    flex: 0 0 auto;
    order: 0;
    height: var(--esig-fixed-h, 110px);
    pointer-events: none;
  }
  .esig-mobile-sticky {
    order: 0;
  }
  .esig-shell {
    order: 1;
  }

  /* 1) Edit / Preview */
  .esig-mobile-modes {
    display: flex;
    flex: 0 0 auto;
    gap: 0;
    margin: 0;
    padding: 0 12px;
    background: var(--esig-surface);
    border-bottom: 1px solid var(--esig-border);
  }
  .esig-mobile-mode {
    appearance: none;
    flex: 1 1 50%;
    border: 0;
    background: transparent;
    color: var(--esig-muted);
    font: inherit;
    font-size: 14px;
    font-weight: 700;
    padding: 14px 8px 12px;
    cursor: pointer;
    border-bottom: 3px solid transparent;
    margin-bottom: -1px;
  }
  .esig-mobile-mode.is-active {
    color: var(--esig-ink);
    border-bottom-color: var(--esig-blue);
  }

  /* 2) Step icons under those tabs */
  .esig-rail {
    flex: 0 0 auto;
    width: 100%;
    flex-direction: row;
    align-items: stretch;
    padding: 8px 6px;
    gap: 4px;
    overflow-x: auto;
    scrollbar-width: thin;
    background: var(--esig-rail);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  }
  .esig-app[data-mobile-mode="preview"] .esig-rail {
    display: none;
  }
  .esig-rail-nav {
    flex-direction: row;
    flex: 1 1 auto;
    width: 100%;
    justify-content: space-between;
    gap: 4px;
  }
  .esig-rail-item {
    max-width: none;
    flex: 1 1 0;
    min-width: 56px;
    width: auto;
    padding: 8px 4px;
    font-size: 10px;
    border-radius: 10px;
  }
  .esig-rail-ico {
    width: 24px;
    height: 24px;
  }
  .esig-rail-ico svg {
    width: 20px;
    height: 20px;
  }

  /* 3) Shell + content (scrolls under sticky chrome) */
  .esig-shell {
    order: 1;
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
  }
  .esig-workspace {
    display: block;
    padding: 12px;
    gap: 0;
    overflow: visible;
    flex: 1 1 auto;
  }
  .esig-form-card,
  .esig-preview-card {
    min-height: auto;
    width: 100%;
  }

  .esig-app[data-mobile-mode="edit"] .esig-preview-card {
    display: none !important;
  }
  .esig-app[data-mobile-mode="edit"] .esig-form-card {
    display: flex;
  }
  .esig-app[data-mobile-mode="preview"] .esig-form-card {
    display: none !important;
  }
  .esig-app[data-mobile-mode="preview"] .esig-preview-card {
    display: flex;
  }

  .esig-grid { grid-template-columns: 1fr; }
  .esig-tpl-list { grid-template-columns: 1fr; }
  .esig-preview-actions {
    flex-direction: column-reverse;
    align-items: stretch;
    position: sticky;
    bottom: 0;
    background: var(--esig-surface);
    padding: 10px 0 4px;
    margin-top: 8px;
    z-index: 2;
  }
  .esig-btn-primary { justify-content: center; width: 100%; }
  .esig-btn-ghost { justify-content: center; }

  .esig-client-switch {
    justify-content: flex-start;
    overflow-x: auto;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
  }
  .esig-client-btn { flex-shrink: 0; }

  body.is-fullscreen .fs-workspace:has(#esig-tool) {
    height: auto;
    max-height: none;
    overflow: auto;
  }
  body.is-fullscreen .fs-workspace .esig-app {
    height: auto;
    max-height: none;
    min-height: calc(100vh - 100px);
    overflow: visible;
  }
}

/* Desktop: sticky wrapper must not break left rail layout */
@media (min-width: 721px) {
  .esig-mobile-sticky {
    display: contents;
  }
}

/* ========== Dark mode (follows site html[data-theme="dark"]) ========== */
html[data-theme="dark"] .esig-app,
html.dark .esig-app {
  --esig-bg: #0f1419;
  --esig-surface: #1a1f2e;
  --esig-surface-2: #151a27;
  --esig-rail: #0a0e17;
  --esig-rail-2: #0d121c;
  --esig-blue: #6b8aff;
  --esig-blue-hover: #8aa3ff;
  --esig-blue-soft: #1e2a4a;
  --esig-ink: #e8eaef;
  --esig-muted: #9aa3b5;
  --esig-label: #c5cad6;
  --esig-border: #2a3344;
  --esig-input: #121722;
  --esig-input-border: #2f3a4d;
  --esig-input-focus-bg: #0e131c;
  --esig-placeholder: #6b7385;
  --esig-shadow: 0 8px 28px rgba(0, 0, 0, 0.35);
  --esig-shadow-sm: 0 2px 10px rgba(0, 0, 0, 0.25);
  --esig-ghost-hover: #242b3a;
  --esig-client-hover: #222938;
  --esig-form-footer-border: #2a3344;
  color-scheme: dark;
}

html[data-theme="dark"] body.is-fullscreen .fs-workspace:has(#esig-tool),
html[data-theme="dark"] body.is-fullscreen .fs-workspace:has(.esig-app),
html.dark body.is-fullscreen .fs-workspace:has(#esig-tool) {
  background: var(--esig-bg, #0f1419);
}

/* Select chevron visible on dark */
html[data-theme="dark"] .esig-app select,
html.dark .esig-app select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='%239aa3b5'%3E%3Cpath d='M7 10l5 5 5-5z'/%3E%3C/svg%3E") !important;
}

/* Color row / hash */
html[data-theme="dark"] .esig-color-row,
html.dark .esig-color-row {
  background: var(--esig-input);
  border-color: var(--esig-input-border);
}

/* Modal */
html[data-theme="dark"] .esig-modal-card,
html.dark .esig-modal-card {
  background: #1a1f2e;
  color: #e8eaef;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
}
html[data-theme="dark"] .esig-modal-card > p,
html[data-theme="dark"] .esig-modal-tip,
html.dark .esig-modal-card > p,
html.dark .esig-modal-tip {
  color: #9aa3b5 !important;
}
html[data-theme="dark"] .esig-modal-close,
html.dark .esig-modal-close {
  color: #9aa3b5;
}
html[data-theme="dark"] #email-html-textarea,
html.dark #email-html-textarea {
  background: #0e131c !important;
  color: #e8eaef !important;
  border-color: #2f3a4d;
}

/* Dark mode: entire mail preview is dark (including message body). */
html[data-theme="dark"] .esig-mail,
html.dark .esig-mail {
  --esig-mail-ink: #e8eaef;
  --esig-mail-muted: #9aa3b5;
  --esig-mail-bg: #121722;
  --esig-mail-meta-bg: #151a27;
  --esig-mail-border: #2a3344;
  --esig-mail-hint-bg: #151a27;
  --esig-mail-hint-color: #9aa3b5;
  --esig-mail-skeleton: #2a3344;
  background: #121722 !important;
  color: #e8eaef !important;
  border-color: #2a3344 !important;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.4);
}
html[data-theme="dark"] .esig-mail-meta,
html.dark .esig-mail-meta,
html[data-theme="dark"] .esig-mail[data-client-skin] .esig-mail-meta,
html.dark .esig-mail[data-client-skin] .esig-mail-meta {
  background: #151a27 !important;
  border-bottom-color: #2a3344 !important;
  color: #e8eaef !important;
}
html[data-theme="dark"] .esig-mail-meta strong,
html[data-theme="dark"] .esig-mail-meta #esig-mail-to-label,
html[data-theme="dark"] .esig-mail-meta #esig-mail-subj-label,
html[data-theme="dark"] .esig-mail-meta #esig-mail-subj-text,
html.dark .esig-mail-meta strong,
html.dark .esig-mail-meta #esig-mail-to-label,
html.dark .esig-mail-meta #esig-mail-subj-label,
html.dark .esig-mail-meta #esig-mail-subj-text {
  color: #e8eaef !important;
}
html[data-theme="dark"] .esig-to-pill,
html.dark .esig-to-pill {
  background: #1e2a4a !important;
  color: #8aa3ff !important;
}
/* Message body — dark (no white) */
html[data-theme="dark"] .esig-mail-body,
html.dark .esig-mail-body {
  background: #121722 !important;
  color: #e8eaef !important;
}
html[data-theme="dark"] .esig-sig-frame,
html.dark .esig-sig-frame {
  background: #121722 !important;
}
html[data-theme="dark"] .esig-empty-preview,
html.dark .esig-empty-preview {
  color: #9aa3b5 !important;
}
html[data-theme="dark"] .esig-mail-skeleton span,
html.dark .esig-mail-skeleton span {
  background: linear-gradient(90deg, #2a3344, #1a2230, #2a3344) !important;
  opacity: 0.85;
}
html[data-theme="dark"] .esig-mail-hint,
html.dark .esig-mail-hint,
html[data-theme="dark"] .esig-mail[data-client-skin] .esig-mail-hint,
html.dark .esig-mail[data-client-skin] .esig-mail-hint {
  background: #151a27 !important;
  border-top-color: #2a3344 !important;
  color: #9aa3b5 !important;
}
html[data-theme="dark"] .esig-mail[data-client-skin="gmail"] .esig-to-pill,
html.dark .esig-mail[data-client-skin="gmail"] .esig-to-pill {
  background: #3b1219 !important;
  color: #fca5a5 !important;
}
html[data-theme="dark"] .esig-mail[data-client-skin="gmail"] .esig-mail-hint,
html.dark .esig-mail[data-client-skin="gmail"] .esig-mail-hint {
  color: #fca5a5 !important;
}
html[data-theme="dark"] .esig-mail[data-client-skin="outlook"] .esig-mail-meta,
html.dark .esig-mail[data-client-skin="outlook"] .esig-mail-meta {
  background: #0f1a24 !important;
}
html[data-theme="dark"] .esig-mail[data-client-skin="outlook"] .esig-to-pill,
html.dark .esig-mail[data-client-skin="outlook"] .esig-to-pill {
  background: #0d2a40 !important;
  color: #6cb6f3 !important;
}
html[data-theme="dark"] .esig-mail[data-client-skin="outlook"] .esig-mail-hint,
html.dark .esig-mail[data-client-skin="outlook"] .esig-mail-hint {
  background: #0f1a24 !important;
  color: #6cb6f3 !important;
}
html[data-theme="dark"] .esig-mail[data-client-skin="apple"] .esig-mail-chrome,
html.dark .esig-mail[data-client-skin="apple"] .esig-mail-chrome {
  background: linear-gradient(180deg, #2c2c2e, #1c1c1e) !important;
  border-bottom-color: #3a3a3c !important;
}
html[data-theme="dark"] .esig-mail[data-client-skin="apple"] .esig-mail-chrome-title,
html.dark .esig-mail[data-client-skin="apple"] .esig-mail-chrome-title {
  color: #f5f5f7 !important;
}
html[data-theme="dark"] .esig-mail[data-client-skin="apple"] .esig-mail-meta,
html.dark .esig-mail[data-client-skin="apple"] .esig-mail-meta {
  background: #1c1c1e !important;
}
html[data-theme="dark"] .esig-mail[data-client-skin="apple"] .esig-to-pill,
html.dark .esig-mail[data-client-skin="apple"] .esig-to-pill {
  background: #2c2c2e !important;
  color: #f5f5f7 !important;
}
html[data-theme="dark"] .esig-mail[data-client-skin="apple"] .esig-mail-hint,
html.dark .esig-mail[data-client-skin="apple"] .esig-mail-hint {
  background: #1c1c1e !important;
  color: #98989d !important;
}
html[data-theme="dark"] .esig-mail[data-client-skin="yahoo"] .esig-mail-meta,
html.dark .esig-mail[data-client-skin="yahoo"] .esig-mail-meta {
  background: #1a1224 !important;
}
html[data-theme="dark"] .esig-mail[data-client-skin="yahoo"] .esig-to-pill,
html.dark .esig-mail[data-client-skin="yahoo"] .esig-to-pill {
  background: #2a1848 !important;
  color: #d4b8f0 !important;
}
html[data-theme="dark"] .esig-mail[data-client-skin="yahoo"] .esig-mail-hint,
html.dark .esig-mail[data-client-skin="yahoo"] .esig-mail-hint {
  background: #1a1224 !important;
  color: #d4b8f0 !important;
}
html[data-theme="dark"] .esig-mail[data-client-skin="gmail"] .esig-mail-chrome-title,
html[data-theme="dark"] .esig-mail[data-client-skin="outlook"] .esig-mail-chrome-title,
html[data-theme="dark"] .esig-mail[data-client-skin="yahoo"] .esig-mail-chrome-title,
html.dark .esig-mail[data-client-skin="gmail"] .esig-mail-chrome-title,
html.dark .esig-mail[data-client-skin="outlook"] .esig-mail-chrome-title,
html.dark .esig-mail[data-client-skin="yahoo"] .esig-mail-chrome-title {
  color: #ffffff !important;
}

/* Toast */
html[data-theme="dark"] .esig-toast.is-ok,
html.dark .esig-toast.is-ok {
  background: #0f2e22;
  color: #6ee7b7;
  border-color: #065f46;
}
html[data-theme="dark"] .esig-toast.is-err,
html.dark .esig-toast.is-err {
  background: #3b1219;
  color: #fca5a5;
  border-color: #7f1d1d;
}

/* Client active ring still visible */
html[data-theme="dark"] .esig-client-btn.is-active,
html.dark .esig-client-btn.is-active {
  border-color: var(--esig-blue);
  box-shadow: 0 0 0 2px rgba(107, 138, 255, 0.2);
}

/* Primary button keeps brand blue */
html[data-theme="dark"] .esig-btn-primary,
html.dark .esig-btn-primary {
  background: var(--esig-blue);
  color: #fff !important;
}
html[data-theme="dark"] .esig-btn-primary:hover,
html.dark .esig-btn-primary:hover {
  background: var(--esig-blue-hover);
}

/* Template wireframes: dark surface (invert light SVGs) */
html[data-theme="dark"] .esig-tpl,
html.dark .esig-tpl {
  background: #151a27;
  border-color: #2a3344;
}
html[data-theme="dark"] .esig-tpl:hover,
html.dark .esig-tpl:hover {
  border-color: #3d4a63;
}
html[data-theme="dark"] .esig-tpl.is-selected,
html.dark .esig-tpl.is-selected {
  border-color: var(--esig-blue);
  box-shadow: 0 0 0 3px rgba(107, 138, 255, 0.2);
  background: #1a2233;
}
html[data-theme="dark"] .esig-tpl-label,
html.dark .esig-tpl-label {
  color: #9aa3b5;
}
html[data-theme="dark"] .esig-tpl-preview,
html.dark .esig-tpl-preview {
  background: transparent;
}
html[data-theme="dark"] .esig-tpl-preview img,
html.dark .esig-tpl-preview img {
  background: #0e131c !important;
  /* White SVG wireframes → dark cards with light schematic lines */
  filter: invert(1) hue-rotate(180deg) brightness(0.92);
  border-radius: 8px;
}

/* Article client tabs below tool */
html[data-theme="dark"] .esig-client-tabs button,
html.dark .esig-client-tabs button {
  background: #1a1f2e;
  border-color: #2a3344;
  color: #e8eaef;
}
html[data-theme="dark"] .esig-client-tabs button.is-active,
html.dark .esig-client-tabs button.is-active {
  background: var(--esig-blue);
  border-color: var(--esig-blue);
  color: #fff;
}
