/*
 * Terms signing pieces shared by the signing page after login (terms/sign), the invite page
 * (auth/passwords/invite) and sign-up step 5 (OP-1475, OP-1648): the document card, the drawer
 * that shows it at step 5, and the signature block. Every class starts with ts- so neither page's own styles reach them.
 */
:root {
    --ts-blue: #1D93F8;
    --ts-blue-dark: #0b6fc4;
    --ts-text: #1a1a1a;
    --ts-muted: #6b7280;
    --ts-line: #e5e7eb;
    --ts-green: #0f7b3f;
    --ts-green-bg: #dcf5e6;
}

/* Document card */
.ts-doc { display: flex; flex-direction: column; background: #fff; border: 1px solid var(--ts-line); border-radius: 10px; font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif; color: var(--ts-text); text-align: left; }
.ts-doc-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 16px 18px 14px; }
.ts-doc-title { font-size: 14px; font-weight: 600; margin: 0; line-height: 1.4; color: var(--ts-text); }
.ts-doc-meta { font-size: 12px; color: var(--ts-muted); margin-top: 2px; }
.ts-doc-text { max-height: 360px; overflow-y: auto; overflow-x: hidden; padding: 6px 28px 20px; font-size: 14px; line-height: 1.7; color: #27272a; overflow-wrap: anywhere; }
.ts-doc-text h1, .ts-doc-text h2, .ts-doc-text h3, .ts-doc-text h4 { font-size: 14px; font-weight: 600; margin: 16px 0 6px; }
.ts-doc-text p { margin: 0 0 10px; }
/* The editor can save fixed widths and inline styles; keep everything inside the card. */
.ts-doc-text * { max-width: 100% !important; box-sizing: border-box; }
.ts-doc-text ol, .ts-doc-text ul { padding-left: 20px; }
.ts-doc-text table { width: 100% !important; table-layout: fixed; }
.ts-doc-text img { height: auto; }
.ts-doc-foot { border-top: 1px solid var(--ts-line); padding: 14px 18px; }
.ts-check { display: flex; align-items: center; gap: 10px; cursor: pointer; font-size: 13px; margin: 0; }
.ts-check input { width: 16px; height: 16px; margin: 0; accent-color: var(--ts-blue); cursor: pointer; }

/* Drawer (sign-up step 5) */
.ts-backdrop { position: fixed; inset: 0; z-index: 1040; background: rgba(15, 23, 42, .45); opacity: 0; transition: opacity .2s ease; }
.ts-drawer { position: fixed; top: 0; right: 0; bottom: 0; z-index: 1050; display: flex; flex-direction: column; width: min(600px, 100%); background: #fff; box-shadow: -8px 0 30px rgba(15, 23, 42, .18); transform: translateX(100%); transition: transform .25s ease; font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif; }
.ts-drawer[hidden], .ts-backdrop[hidden] { display: none; }
.ts-drawer.open { transform: none; }
.ts-backdrop.open { opacity: 1; }
.ts-drawer .ts-doc { flex: 1; min-height: 0; border: 0; border-radius: 0; }
.ts-drawer .ts-doc-head { padding: 18px 20px 14px; }
.ts-drawer .ts-doc-text { flex: 1; max-height: none; }
.ts-drawer-close { border: 0; background: none; padding: 2px 4px; margin: -2px -4px 0 4px; font-size: 22px; line-height: 1; color: var(--ts-muted); cursor: pointer; }
.ts-drawer-close:hover { color: var(--ts-text); }
.ts-drawer .ts-doc-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.ts-drawer .ts-doc-foot a { font-size: 13px; color: var(--ts-blue); }
.ts-done { border: 0; border-radius: 7px; padding: 8px 18px; background: var(--ts-blue); color: #fff; font: inherit; font-size: 14px; font-weight: 500; cursor: pointer; }
.ts-done:disabled { background: #ececee; color: #8b8b93; cursor: not-allowed; }
body.ts-drawer-open { overflow: hidden; }

/* Signature block */
.ts-sig { font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif; color: var(--ts-text); text-align: left; }
.ts-sig-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.ts-sig-label { font-size: 13px; font-weight: 500; margin: 0; }
.ts-sig-box { position: relative; height: 112px; border: 1px dashed #c4c8cf; border-radius: 8px; background: #fcfcfd; overflow: hidden; cursor: text; }
.ts-sig-box:focus-within { border-color: var(--ts-blue); }
.ts-sig-line { position: absolute; left: 14px; right: 14px; bottom: 32px; border-top: 1px solid #d4d4d8; pointer-events: none; }
.ts-sig-hint { position: absolute; left: 14px; bottom: 10px; font-size: 11px; color: var(--ts-muted); pointer-events: none; }
.ts-sig-typed { position: absolute; left: 14px; right: 14px; bottom: 34px; width: calc(100% - 28px); height: auto; padding: 0; border: 0; background: transparent; box-shadow: none; text-align: center; font: italic 34px 'Brush Script MT', 'Segoe Script', cursive; color: var(--ts-text); }
.ts-sig-typed::placeholder { font: italic 20px 'Inter', system-ui, sans-serif; color: #b4b9c2; }
.ts-sig-typed:focus { outline: none; box-shadow: none; }
.ts-sig-under { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 6px; font-size: 12px; color: var(--ts-muted); }
.ts-clear { border: 0; background: none; padding: 0; font: inherit; font-size: 12px; color: var(--ts-blue); text-decoration: underline; cursor: pointer; }

/* Compact signature (sign-up step 5, OP-1581): an ordinary field the size of the payment fields. */
.ts-sig-compact .ts-sig-label { display: block; margin-bottom: 6px; }
.ts-sig-compact .ts-sig-field { border-radius: 8px; }
.ts-sig-compact .ts-sig-typed { position: static; display: block; width: 100%; height: 40px; padding: 0 12px; border: 1px solid #d4d4d8; border-radius: 8px; background: #fff; text-align: left; font: 400 14px 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif; color: var(--ts-text); }
.ts-sig-compact .ts-sig-typed::placeholder { font: inherit; color: #9ca3af; }
.ts-sig-compact .ts-sig-typed:focus { border-color: var(--ts-blue); box-shadow: 0 0 0 3px rgba(29, 147, 248, .15); }
.ts-sig-note { margin: 6px 0 0; font-size: 12px; color: var(--ts-muted); }
