/* Sign & fill a PDF attachment (pdf-sign.js) */
.psign { position: fixed; inset: 0; z-index: 60; display: grid; grid-template-rows: auto auto minmax(0, 1fr); background: var(--bg); }
.psign-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 12px; padding: 10px 14px; border-radius: var(--r); }
.psign-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 40vw; }
.psign-hint { margin: 0 12px 8px; padding: 8px 12px; border-radius: 10px; background: var(--accent-soft); color: var(--accent-ink); font-size: 13px; }
.psign-body { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 12px; padding: 0 12px 12px; min-height: 0; }
.psign-pages { overflow: auto; display: flex; flex-direction: column; align-items: center; gap: 16px; padding: 4px 4px 24px; min-height: 0; }
.psign-page { position: relative; flex: none; width: min(820px, 100%); background: #fff; box-shadow: var(--shadow); border-radius: 4px; overflow: hidden; user-select: none; }
.psign-page img { display: block; width: 100%; height: auto; max-width: none; max-height: none; }
.psign.placing .psign-page { cursor: crosshair; }
.psign-field { position: absolute; box-sizing: border-box; border: 1px dashed color-mix(in srgb, var(--accent) 45%, transparent); background: color-mix(in srgb, var(--accent) 6%, transparent); color: #111; font-family: Helvetica, Arial, sans-serif; line-height: 1.1; padding: 0 2px; overflow: hidden; white-space: nowrap; display: flex; align-items: center; cursor: pointer; }
.psign-sig, .psign-text { position: absolute; touch-action: none; }
.psign-sig { cursor: move; outline: 1.5px solid var(--accent); outline-offset: 2px; border-radius: 2px; }
.psign-sig img { width: 100%; height: 100%; object-fit: contain; pointer-events: none; }
.psign-grip { position: absolute; right: -7px; bottom: -7px; width: 12px; height: 12px; border-radius: 50%; background: #fff; border: 2px solid var(--accent); cursor: nwse-resize; }
.psign-text { display: flex; align-items: flex-start; gap: 2px; font-family: Helvetica, Arial, sans-serif; color: #111; line-height: 1.15; }
.psign-move { cursor: move; color: var(--accent); font-size: 12px; line-height: 1; padding-top: 1px; }
.psign-edit { min-width: 40px; outline: 1px dashed var(--accent); outline-offset: 1px; white-space: pre; }
.psign-x { position: absolute; top: -10px; right: -10px; width: 20px; height: 20px; border-radius: 50%; border: 0; background: #1d1f24; color: #fff; font-size: 10px; cursor: pointer; display: none; }
.psign-sig:hover .psign-x, .psign-text:hover .psign-x, .psign-text:focus-within .psign-x { display: block; }
.psign-side { overflow: auto; background: var(--surface, #fff); border-radius: var(--r); padding: 16px; box-shadow: var(--shadow); }
.psign-side h3 { margin: 0 0 12px; font-size: 15px; }
.psign-row { display: grid; gap: 4px; margin-bottom: 10px; font-size: 13px; }
.psign-row label { color: var(--muted); font-size: 12px; }
.psign-row input, .psign-row select { font: inherit; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.psign-row.psign-check { grid-template-columns: auto 1fr; align-items: center; gap: 8px; }
.psign-note { font-size: 12px; margin-top: 14px; }
@media (max-width: 820px) {
  .psign-body { grid-template-columns: 1fr; grid-template-rows: minmax(0, 1fr) auto; }
  .psign-side { max-height: 36vh; }
  .psign-name { max-width: 100%; flex-basis: 100%; }
}
.psign-row.psign-check input { width: 16px; height: 16px; padding: 0; margin: 0; }
.psign-row.psign-check label { color: var(--text); font-size: 13px; }
/* An AI-suggested signature spot: faint until the owner accepts it */
.psign-sig.pending { outline-style: dashed; }
.psign-sig.pending img { opacity: .35; }
.psign-accept { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); white-space: nowrap; border: 0; border-radius: 999px; padding: 6px 12px; background: var(--accent); color: #fff; font: 600 12px/1 Inter, system-ui, sans-serif; cursor: pointer; box-shadow: 0 4px 12px rgba(20,22,40,.2); }

/* Stamps menu and the assistant */
.psign-stamp-wrap { position: relative; }
.psign-stamps { position: absolute; top: calc(100% + 6px); right: 0; z-index: 3; min-width: 180px; padding: 6px; display: grid; gap: 2px; }
.psign-stamps .mi { text-align: left; border: 0; background: none; padding: 8px 10px; border-radius: 8px; font: inherit; cursor: pointer; }
.psign-stamps .mi:hover { background: var(--accent-soft); }
.psign-none { margin: 6px 8px; font-size: 12px; }
.psign-stamp img { opacity: .92; }
.psign-side { display: grid; grid-template-rows: auto minmax(220px, 1fr); gap: 16px; }
.psign-chat { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; min-height: 220px; border-top: 1px solid var(--line); padding-top: 14px; }
.psign-log { overflow: auto; display: grid; align-content: start; gap: 8px; padding: 2px 0 10px; }
.psign-msg { font-size: 13px; line-height: 1.45; white-space: pre-wrap; background: var(--bg); border-radius: 12px; padding: 8px 12px; justify-self: start; max-width: 92%; }
.psign-msg.me { justify-self: end; background: var(--accent); color: #fff; }
.psign-ask { display: flex; gap: 8px; }
.psign-ask input { flex: 1; min-width: 0; font: inherit; font-size: 13px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }

/* Values the AI took from the owner's Vault are marked, so private details never go out unnoticed */
.psign-src { display: inline-block; margin-left: 6px; padding: 1px 6px; border-radius: 999px; background: #fff4e5; color: #8a4b00; font-size: 11px; }
.psign-text.from-vault .psign-edit { outline-color: #d97706; background: #fff4e5; }
