/* ShareBox Ink - signer page + sender field editor.
   Loaded after app.css; uses its tokens so light/dark both work. */

@font-face {
  font-family: 'Dancing Script'; font-style: normal; font-weight: 400;
  font-display: block; src: url('/static/fonts/dancing-script-latin-400-normal.woff2') format('woff2');
}
@font-face {
  font-family: 'Dancing Script'; font-style: normal; font-weight: 700;
  font-display: block; src: url('/static/fonts/dancing-script-latin-700-normal.woff2') format('woff2');
}

:root {
  /* Logo palette (docs/brand/sb-ink-*.png): brand blue, navy ("Box"),
     sky (signature swoosh). */
  --ink-blue: #0059b3;
  --ink-navy: #1d2b4f;
  --ink-sky:  #8ec8f6;
  --ink-sky-soft: rgba(142, 200, 246, 0.22);
  /* Eight recipient colours, readable on light and dark, used for field
     outlines in the editor so senders can tell signers apart. */
  --ink-r0: #0059a9; --ink-r1: #b4511e; --ink-r2: #2a8a4a; --ink-r3: #7b3fb0;
  --ink-r4: #b0365a; --ink-r5: #1f7f8c; --ink-r6: #8a6d00; --ink-r7: #4a5568;
}

/* ---------- brand lockup ---------- */
.ink-brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; flex-shrink: 0; }
.ink-brand .ink-lockup-img { height: 40px; width: auto; display: block; }
.ink-topbar .ink-brand .ink-lockup-img { height: 28px; }
.ink-brand .ink-for {
  font-size: 13px; color: var(--text-muted); font-weight: 400;
  padding-left: 10px; border-left: 1px solid var(--border); line-height: 1.2;
}

/* ---------- card stages (verify / consent / messages) ---------- */
.ink-card { max-width: 520px; text-align: left; border-top: 4px solid var(--ink-blue); }
.ink-card .ink-brand { margin-bottom: 22px; }
.ink-card h2 { margin: 0 0 6px; font-size: 21px; text-align: left; color: var(--ink-navy); }
[data-theme="dark"] .ink-card h2 { color: var(--text); }
.ink-card .meta { text-align: left; margin-bottom: 18px; }
.ink-card p { line-height: 1.5; color: var(--text); font-size: 14px; }
.ink-card .ink-dim { color: var(--text-muted); font-size: 13px; }
.ink-note {
  background: var(--accent-soft); border: 1px solid var(--accent); color: var(--text);
  padding: 8px 12px; border-radius: var(--radius); font-size: 13px; margin-bottom: 16px;
}
.ink-msg {
  background: var(--surface-2); border-left: 3px solid var(--accent); border-radius: var(--radius-sm);
  padding: 10px 14px; margin: 14px 0; white-space: pre-wrap; font-size: 14px;
}
.ink-consent {
  max-height: 300px; overflow-y: auto; white-space: pre-wrap; font-size: 13px; line-height: 1.5;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px; margin: 12px 0 16px; color: var(--text);
}
.ink-wide { width: 100%; justify-content: center; padding: 11px; }
.ink-row { display: flex; gap: 10px; margin-top: 10px; }
.ink-row > * { flex: 1; }
.ink-link-btn {
  background: none; border: none; padding: 0; color: var(--accent-fg); font: inherit;
  font-size: 13px; cursor: pointer; text-decoration: underline;
}
.ink-foot { margin-top: 22px; font-size: 11px; color: var(--text-dim); text-align: center; line-height: 1.5; }
.ink-status-icon {
  width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center;
  margin-bottom: 14px; background: var(--ink-sky-soft); color: var(--ink-blue);
}
[data-theme="dark"] .ink-status-icon { color: var(--ink-sky); }
.ink-status-icon.ok { background: rgba(42, 157, 94, .14); color: var(--success); }
.ink-status-icon.bad { background: var(--danger-soft); color: var(--danger); }
.ink-status-icon svg { width: 26px; height: 26px; }
.ink-drop {
  display: block; margin: 16px 0 6px; padding: 26px 16px; text-align: center; cursor: pointer;
  border: 2px dashed var(--border-strong); border-radius: var(--radius-lg); color: var(--text-muted);
  background: var(--surface-2); font-size: 14px;
}
.ink-drop strong { color: var(--accent-fg); }
.ink-drop.over, .ink-drop:hover { border-color: var(--accent); background: var(--accent-soft); }
.ink-code-input { letter-spacing: 8px; text-align: center; font-size: 22px !important; font-weight: 700; }

/* ---------- full-page signing / editing workspace ---------- */
/* app.css sets html, body { height: 100% }, which makes sticky bars scroll
   away with a tall document; let the body grow instead. */
body.ink-workspace { background: var(--bg); min-height: 100vh; height: auto; }
.ink-topbar {
  position: sticky; top: 0; z-index: 50; display: flex; align-items: center; gap: 14px;
  padding: 10px 18px; background: var(--surface); border-bottom: 1px solid var(--border);
  border-top: 3px solid var(--ink-blue); box-shadow: var(--shadow-sm);
}
.ink-topbar .ink-title { flex: 1; min-width: 0; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ink-topbar .theme-toggle-fixed { position: static; }
.ink-actionbar {
  position: sticky; top: 53px; z-index: 40; display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 10px 18px; background: var(--surface-2); border-bottom: 1px solid var(--border); font-size: 14px;
}
.ink-actionbar .ink-grow { flex: 1; min-width: 180px; }
.ink-progress { font-size: 13px; color: var(--text-muted); white-space: nowrap; }
.ink-pages { padding: 24px 12px 120px; display: flex; flex-direction: column; align-items: center; gap: 18px; }
.ink-page {
  position: relative; background: #fff; box-shadow: var(--shadow); border-radius: 2px;
  max-width: 100%; flex-shrink: 0;
}
.ink-page canvas { display: block; width: 100%; height: 100%; }
.ink-page .ink-page-num {
  position: absolute; bottom: -18px; right: 0; font-size: 11px; color: var(--text-dim);
}
.ink-layer { position: absolute; inset: 0; }

/* Signer-side fields */
.ink-f {
  position: absolute; box-sizing: border-box; border-radius: 3px; font-size: 12px;
  display: flex; align-items: center; justify-content: center; color: #0d1b33;
}
.ink-f.todo { background: rgba(255, 214, 10, .30); border: 1.5px dashed #c58f00; cursor: pointer; }
.ink-f.todo:hover, .ink-f.todo:focus { background: rgba(255, 214, 10, .48); outline: none; }
.ink-f.done { background: rgba(42, 157, 94, .10); border: 1px solid rgba(42, 157, 94, .55); cursor: pointer; }
.ink-f.auto { background: rgba(0, 89, 169, .06); border: 1px dotted rgba(0, 89, 169, .45); color: #33415c; cursor: default; }
.ink-f .ink-tag {
  position: absolute; left: -2px; top: -20px; background: #c58f00; color: #fff; font-size: 10.5px;
  font-weight: 700; padding: 2px 6px; border-radius: 3px 3px 3px 0; white-space: nowrap; pointer-events: none;
}
.ink-f.done .ink-tag { display: none; }
.ink-f img { max-width: 100%; max-height: 100%; object-fit: contain; pointer-events: none; }
.ink-f input[type="text"] {
  width: 100%; height: 100%; border: none; background: transparent; padding: 0 4px; font-size: inherit;
  color: #0d1b33; font-family: var(--font-body); outline: none;
}
.ink-f input[type="checkbox"] { width: 70%; height: 70%; margin: 0; cursor: pointer; accent-color: var(--accent); }
.ink-f.active { box-shadow: 0 0 0 3px rgba(0, 89, 169, .45); }

/* Adopt-signature modal */
.ink-tabs { display: flex; gap: 6px; margin-bottom: 12px; }
.ink-tabs button[aria-selected="true"] { background: var(--accent); color: #fff; border-color: var(--accent); }
.ink-pad-wrap { border: 1px solid var(--border-strong); border-radius: var(--radius); background: #fff; position: relative; touch-action: none; }
.ink-pad-wrap canvas { display: block; width: 100%; height: 170px; cursor: crosshair; }
.ink-pad-wrap .ink-pad-line { position: absolute; left: 18px; right: 18px; bottom: 42px; border-bottom: 1px solid #c9d1de; pointer-events: none; }
.ink-pad-wrap .ink-pad-hint { position: absolute; left: 20px; bottom: 22px; font-size: 11px; color: #8a9bb3; pointer-events: none; }
.ink-typed-preview {
  font-family: 'Dancing Script', cursive; font-weight: 700; font-size: 44px; color: #0d1b33;
  background: #fff; border: 1px solid var(--border-strong); border-radius: var(--radius);
  height: 110px; display: flex; align-items: center; padding: 0 18px; overflow: hidden; white-space: nowrap;
}
.ink-intent { display: flex; gap: 10px; align-items: flex-start; font-size: 13.5px; line-height: 1.45; margin: 6px 0 4px; }
.ink-intent input { margin-top: 3px; width: 18px; height: 18px; flex-shrink: 0; }

/* ---------- sender editor (in the ShareBox SPA) ---------- */
.ink-editor {
  position: fixed; inset: 0; z-index: 900; background: var(--bg); display: flex; flex-direction: column;
}
.ink-editor-body { flex: 1; min-height: 0; display: flex; }
.ink-editor-doc { flex: 1; min-width: 0; overflow: auto; }
.ink-editor-side {
  width: 340px; flex-shrink: 0; border-left: 1px solid var(--border); background: var(--surface);
  overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 16px;
}
.ink-side-h { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--text-dim); font-weight: 700; margin: 0 0 8px; }
.ink-rcpt { border: 1px solid var(--border); border-radius: var(--radius); padding: 10px; margin-bottom: 8px; background: var(--surface); }
.ink-rcpt.selected { box-shadow: 0 0 0 2px var(--rc, var(--accent)); border-color: transparent; }
.ink-rcpt-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; cursor: pointer; }
.ink-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--rc); flex-shrink: 0; }
.ink-rcpt input, .ink-rcpt select {
  width: 100%; margin-top: 4px; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 6px 8px; color: var(--text); font-size: 13px;
}
.ink-rcpt .ink-rcpt-row { display: flex; gap: 6px; }
.ink-rcpt .ink-rcpt-row > * { flex: 1; }
.ink-palette { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.ink-palette button {
  display: flex; align-items: center; gap: 6px; justify-content: flex-start; font-size: 13px;
  padding: 7px 9px; border: 1px solid var(--border); background: var(--surface); color: var(--text);
  border-radius: var(--radius); cursor: grab;
}
.ink-palette button:hover { border-color: var(--rc, var(--accent)); background: var(--surface-2); }
.ink-palette button .ink-swatch { width: 10px; height: 10px; border-radius: 2px; background: var(--rc, var(--accent)); }
.ink-ef {
  position: absolute; box-sizing: border-box; border: 2px solid var(--rc); background: color-mix(in srgb, var(--rc) 14%, transparent);
  border-radius: 3px; font-size: 11px; color: #13223d; display: flex; align-items: center; padding: 0 4px;
  cursor: move; user-select: none; overflow: hidden; white-space: nowrap;
}
.ink-ef.sel { box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--rc); z-index: 3; }
.ink-ef .ink-ef-label { pointer-events: none; overflow: hidden; text-overflow: ellipsis; font-weight: 700; }
.ink-ef .ink-ef-h {
  position: absolute; right: -5px; bottom: -5px; width: 11px; height: 11px; background: var(--rc);
  border: 2px solid #fff; border-radius: 2px; cursor: nwse-resize;
}
.ink-ef .ink-ef-x {
  position: absolute; right: 1px; top: 1px; width: 14px; height: 14px; line-height: 12px; text-align: center;
  font-size: 12px; background: rgba(255,255,255,.8); color: #333; border-radius: 2px; cursor: pointer; display: none;
}
.ink-ef.sel .ink-ef-x { display: block; }
.ink-ef-props { border: 1px solid var(--border); border-radius: var(--radius); padding: 10px; background: var(--surface-2); font-size: 13px; }
.ink-ef-props label { display: block; margin-top: 6px; }
.ink-ef-props input[type="text"] { width: 100%; padding: 5px 7px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); color: var(--text); }
.ink-help { font-size: 12px; color: var(--text-muted); line-height: 1.45; }
.ink-pill { display: inline-block; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 10px; background: var(--surface-3); color: var(--text-muted); }

@media (max-width: 860px) {
  .ink-editor-body { flex-direction: column; }
  .ink-editor-side { width: auto; border-left: none; border-top: 1px solid var(--border); max-height: 45vh; }
  .ink-actionbar { top: 53px; }
}
