/* ==========================================================================
   SignFlow — Sender Editor. Builds on signflow.css tokens (indigo #6366F1,
   Space Grotesk / Inter). DocuSign-style prepare surface.
   ========================================================================== */

.editor-body {
  height: 100vh;
  overflow: hidden;
  background: var(--bg);
}

.editor-topbar-inner { max-width: none; padding: 12px 22px; }
.editor-doc-title { display: flex; flex-direction: column; line-height: 1.2; margin-left: 18px; }
.editor-doc-title .eyebrow { font-size: 10.5px; }
.editor-fname { font-family: var(--font-display); font-weight: 600; font-size: 15px; color: var(--ink); letter-spacing: -0.01em; }
.editor-top-actions { margin-left: auto; display: flex; align-items: center; gap: 12px; }

.save-state { font-size: 12.5px; font-weight: 500; color: var(--slate-2); }
.save-state.dirty { color: #B45309; }
.save-state.ok { color: var(--success); }

.btn-ghost {
  font-family: var(--font-body);
  padding: 9px 16px; background: #fff; color: var(--ink-2);
  border: 1.5px solid var(--line); border-radius: 10px;
  font-size: 13.5px; font-weight: 600; cursor: pointer; transition: background .15s, border-color .15s;
}
.btn-ghost:hover { background: var(--bg); border-color: #D7D8E0; }
.btn-compact { padding: 10px 18px; font-size: 14px; border-radius: 11px; }

.editor-shell { display: flex; height: calc(100vh - 59px); }

/* ---- Sidebar ------------------------------------------------------------- */
.editor-sidebar {
  width: 300px; flex-shrink: 0;
  background: #fff; border-right: 1px solid var(--line);
  overflow-y: auto;
}
.ed-section { padding: 18px 20px; border-bottom: 1px solid var(--line-soft); }
.ed-section h3 {
  font-family: var(--font-display);
  font-size: 12px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase;
  color: var(--slate); margin-bottom: 4px;
}
.ed-hint { font-size: 12px; color: var(--slate-2); margin-bottom: 12px; line-height: 1.45; }

.palette { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 14px; }
.chip {
  display: flex; align-items: center; gap: 7px;
  padding: 11px 12px; background: var(--bg);
  border: 1.5px solid var(--line); border-radius: 10px;
  font-family: var(--font-body); font-size: 13px; font-weight: 600; color: var(--ink-2);
  cursor: grab; text-align: left; transition: background .15s, border-color .15s, box-shadow .15s;
  user-select: none;
}
.chip:hover { background: var(--indigo-50); border-color: var(--indigo-line); box-shadow: 0 2px 8px rgba(99,102,241,0.12); }
.chip:active { cursor: grabbing; }
.chip-ic { font-size: 14px; }

.btn-detect {
  width: 100%; display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px; background: var(--indigo-tint); color: var(--indigo-700);
  border: 1px solid var(--indigo-line); border-radius: 10px;
  font-family: var(--font-body); font-size: 12.5px; font-weight: 600; cursor: pointer;
  transition: background .15s;
}
.btn-detect:hover { background: var(--indigo-50); }

/* signers */
.signer-list { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.signer-empty { font-size: 12.5px; color: var(--slate-2); padding: 4px 0; }
.signer-item {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 10px; border-radius: 10px; border: 1.5px solid transparent;
  background: var(--bg); cursor: pointer; transition: border-color .15s, background .15s;
}
.signer-item.active { border-color: var(--indigo-line); background: var(--indigo-50); }
.signer-dot { width: 10px; height: 10px; border-radius: 50%; flex: 0 0 auto; }
.signer-name { font-size: 13px; font-weight: 600; color: var(--ink); }
.signer-email { font-size: 11.5px; color: var(--slate-2); margin-left: auto; max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.signer-form { display: flex; flex-direction: column; gap: 7px; }
.signer-form input {
  padding: 9px 11px; border: 1.5px solid var(--line); border-radius: 9px;
  font-family: var(--font-body); font-size: 13px; outline: none; transition: border-color .15s, box-shadow .15s;
}
.signer-form input:focus { border-color: var(--indigo); box-shadow: 0 0 0 3px var(--indigo-tint); }
.btn-outline {
  padding: 9px 12px; background: #fff; color: var(--indigo-700);
  border: 1.5px solid var(--indigo-line); border-radius: 9px;
  font-family: var(--font-body); font-size: 13px; font-weight: 600; cursor: pointer; transition: background .15s;
}
.btn-outline:hover { background: var(--indigo-50); }

/* inspector */
.inspector { background: linear-gradient(180deg,#fff,#FBFBFE); }
.insp-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.insp-row label { font-size: 12.5px; font-weight: 500; color: var(--slate); }
.insp-row select, .insp-row input[type=text] {
  padding: 7px 9px; border: 1.5px solid var(--line); border-radius: 8px;
  font-family: var(--font-body); font-size: 12.5px; outline: none; max-width: 160px; flex: 1;
}
.insp-row select:focus, .insp-row input:focus { border-color: var(--indigo); }
.insp-type { font-size: 12.5px; font-weight: 600; color: var(--indigo-700); text-transform: capitalize; }
.insp-check { display: flex; align-items: center; gap: 7px; cursor: pointer; }
.insp-check input { width: 15px; height: 15px; accent-color: var(--indigo); }
.btn-danger {
  width: 100%; margin-top: 6px; padding: 9px; background: #fff; color: #DC2626;
  border: 1.5px solid #FCA5A5; border-radius: 9px; font-family: var(--font-body);
  font-size: 12.5px; font-weight: 600; cursor: pointer; transition: background .15s;
}
.btn-danger:hover { background: #FEF2F2; }

/* ---- Canvas -------------------------------------------------------------- */
.editor-canvas {
  flex: 1; overflow-y: auto; padding: 28px;
  display: flex; flex-direction: column; align-items: center; gap: 26px;
  background:
    radial-gradient(900px 400px at 50% -10%, var(--indigo-50) 0%, rgba(238,240,255,0) 55%),
    linear-gradient(180deg, var(--bg-grad-a), var(--bg-grad-b));
}
.ed-page-wrap { display: flex; flex-direction: column; gap: 8px; }
.ed-page-num { font-size: 11.5px; font-weight: 600; color: var(--slate-2); letter-spacing: 0.04em; text-transform: uppercase; }
.ed-page {
  position: relative; background: #fff; border-radius: 6px;
  box-shadow: 0 6px 26px rgba(16,18,34,0.13); overflow: hidden;
}
.ed-page img { display: block; width: 100%; height: 100%; pointer-events: none; }

.ed-field {
  position: absolute; box-sizing: border-box;
  border: 1.6px solid var(--fcol, #6366F1);
  background: color-mix(in srgb, var(--fcol, #6366F1) 9%, transparent);
  border-radius: 5px; cursor: move;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 600; color: var(--fcol, #6366F1);
  user-select: none; transition: box-shadow .12s;
}
.ed-field.sender { border-style: dashed; }
.ed-field.selected { box-shadow: 0 0 0 3px color-mix(in srgb, var(--fcol,#6366F1) 28%, transparent); z-index: 5; }
.ed-field-label { pointer-events: none; padding: 0 6px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; max-width: 100%; }
.ed-resize {
  position: absolute; right: -5px; bottom: -5px; width: 12px; height: 12px;
  background: #fff; border: 2px solid var(--fcol, #6366F1); border-radius: 3px; cursor: nwse-resize;
}
.ed-del {
  position: absolute; top: -9px; right: -9px; width: 18px; height: 18px;
  background: #EF4444; color: #fff; border-radius: 50%; font-size: 12px; line-height: 16px;
  display: flex; align-items: center; justify-content: center; cursor: pointer;
  opacity: 0; transition: opacity .12s;
}
.ed-field:hover .ed-del, .ed-field.selected .ed-del { opacity: 1; }

/* ---- Send modal ---------------------------------------------------------- */
.send-summary { margin: 4px 0 18px; display: flex; flex-direction: column; gap: 6px; }
.ss-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 11px 14px; background: var(--bg); border: 1px solid var(--line); border-radius: 10px;
  font-size: 13.5px; font-weight: 600; color: var(--ink);
}
.ss-row em { font-style: normal; font-weight: 400; color: var(--slate-2); font-size: 12px; margin-left: 6px; }
.ss-row.sender { background: #FBFBFE; }
.ss-count { font-size: 12px; font-weight: 600; color: var(--indigo-700); background: var(--indigo-tint); padding: 3px 9px; border-radius: 999px; }
.send-result { margin-top: 14px; font-size: 13px; }
.send-ok { color: var(--success); font-weight: 600; }
.send-err { color: #DC2626; font-weight: 600; }
.send-links { margin-top: 6px; color: var(--slate); }
.send-links a { color: var(--indigo-700); }

@media (max-width: 820px) {
  .editor-shell { flex-direction: column; height: auto; }
  .editor-sidebar { width: 100%; }
  .editor-body { overflow: auto; height: auto; }
}
