/* Omega Sign — one small stylesheet. --accent is set from config.php. */
:root { --accent: #1f3a5f; --bg: #f4f5f7; --card: #fff; --text: #1d2330; --muted: #677085; --line: #e2e5eb;
        --ok: #0f7a4a; --warn: #b45309; --err: #b42318; --radius: 10px; }
[hidden] { display: none !important; }
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.5 "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif; }
a { color: var(--accent); }
h1 { font-size: 1.6rem; margin: .2em 0 .4em; } h2 { font-size: 1.15rem; margin: .2em 0 .8em; } h3 { font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 1.2em 0 .5em; }
code { font-size: .85em; word-break: break-all; }
.wrap { max-width: 1180px; margin: 0 auto; padding: 0 20px; }
main.wrap { padding-top: 24px; padding-bottom: 60px; }
.muted { color: var(--muted); } .small { font-size: .85rem; } .right { text-align: right; } .center { text-align: center; } .nowrap { white-space: nowrap; }

/* Header */
header.top { background: var(--accent); color: #fff; }
header.top .wrap { display: flex; align-items: center; justify-content: space-between; min-height: 58px; gap: 16px; flex-wrap: wrap; }
.brand { color: #fff; text-decoration: none; font-weight: 600; font-size: 1.1rem; display: flex; align-items: center; gap: 8px; }
.brand small { font-weight: 400; opacity: .7; font-size: .8rem; }
.brand .mark { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; background: rgba(255,255,255,.15); }
header nav { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
header nav a { color: #fff; text-decoration: none; opacity: .9; } header nav a:hover { opacity: 1; text-decoration: underline; }
header nav a.btn { background: #fff; color: var(--accent); opacity: 1; text-decoration: none; }

/* Cards, forms, buttons */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px 24px; margin-bottom: 18px; }
.card.flush { padding: 0; overflow: hidden; } .card.narrow { max-width: 520px; margin: 30px auto; }
label { display: block; font-weight: 600; font-size: .9rem; margin-bottom: 14px; }
input, textarea, select { display: block; width: 100%; margin-top: 5px; padding: 9px 11px; font: inherit; font-weight: 400; border: 1px solid #c9ced8; border-radius: 7px; background: #fff; color: var(--text); }
input:focus, textarea:focus { outline: 2px solid color-mix(in srgb, var(--accent) 35%, transparent); border-color: var(--accent); }
label.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; }
label.check input { width: auto; margin-top: 4px; flex: none; }
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 9px 18px; border-radius: 7px; border: 1px solid var(--accent); background: var(--accent); color: #fff;
       font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { filter: brightness(1.1); } .btn:disabled { opacity: .45; cursor: not-allowed; filter: none; }
.btn.ghost { background: #fff; color: var(--accent); } .btn.small { padding: 5px 12px; font-size: .85rem; }
.btn.danger { background: var(--err); border-color: var(--err); color: #fff; } .btn.ghost.danger { background: #fff; color: var(--err); }
button.link { background: none; border: 0; padding: 0 0 0 12px; color: var(--accent); font: inherit; cursor: pointer; text-decoration: underline; }
button.link.danger { color: var(--err); } button.link.muted { color: var(--muted); }
form.inline { display: inline; }
.actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; align-items: center; }
.flash { padding: 11px 15px; border-radius: 8px; margin-bottom: 16px; background: #e8f6ee; color: var(--ok); border: 1px solid #bfe5cf; }
.flash.err { background: #fdecea; color: var(--err); border-color: #f5c2bd; }
pre.err { white-space: pre-wrap; background: #fdecea; padding: 10px; border-radius: 6px; }
.row-between { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; }

/* Lists & badges */
table.list { width: 100%; border-collapse: collapse; }
table.list th { text-align: left; font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; padding: 10px 14px; border-bottom: 1px solid var(--line); }
table.list td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.list tr:last-child td { border-bottom: 0; }
.card:not(.flush) table.list th:first-child, .card:not(.flush) table.list td:first-child { padding-left: 0; }
tr.clickable { cursor: pointer; } tr.clickable:hover td { background: #f8f9fb; } tr.clickable a { color: var(--text); text-decoration: none; }
.badge { display: inline-block; padding: 2px 10px; border-radius: 99px; font-size: .78rem; font-weight: 600; background: #eef0f4; color: #4a5263; white-space: nowrap; }
.b-sent, .b-viewed { background: #fff4e0; color: var(--warn); } .b-completed, .b-signed { background: #e3f5ea; color: var(--ok); }
.b-declined, .b-voided { background: #fdecea; color: var(--err); } .b-draft { background: #e8eefb; color: #2949a8; }
.tabs { display: flex; gap: 4px; margin-bottom: 14px; flex-wrap: wrap; border-bottom: 1px solid var(--line); }
.tabs a { padding: 8px 14px; text-decoration: none; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs a.on { color: var(--accent); border-color: var(--accent); font-weight: 600; }
.tabs a span { font-size: .75rem; background: #eef0f4; padding: 1px 7px; border-radius: 99px; margin-left: 3px; }
.search input { width: 260px; margin: 0; }
.empty { padding: 50px 20px; text-align: center; color: var(--muted); }
.steps { display: flex; gap: 6px; padding: 0; list-style: none; margin: 0 0 18px; flex-wrap: wrap; }
.steps li { padding: 5px 14px; border-radius: 99px; background: #e9ebf0; color: var(--muted); font-size: .85rem; }
.steps li.on { background: var(--accent); color: #fff; } .steps li.done { background: #e3f5ea; color: var(--ok); }
.danger-zone { display: flex; justify-content: flex-end; }

/* New document */
.drop { position: relative; border: 2px dashed #c3c9d4; border-radius: 10px; padding: 28px; text-align: center; color: var(--muted); font-weight: 400; margin-top: 6px; background: #fafbfc; }
.drop.over, .drop.has { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 6%, #fff); color: var(--text); }
.drop input { position: absolute; inset: 0; opacity: 0; cursor: pointer; margin: 0; }
.signer-row { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; }
.signer-row input { margin: 0; } .signer-row .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); flex: none; }

/* Document viewer */
.doc { min-width: 0; }
.doc .page { position: relative; background: #fff; box-shadow: 0 1px 4px rgba(0,0,0,.18); margin: 0 auto; width: 100%; max-width: 1000px; }
.doc .page canvas { display: block; width: 100%; height: 100%; }
.page-num { text-align: center; font-size: .75rem; color: var(--muted); margin: 6px 0 20px; }
.doc.single { max-width: 900px; margin: 0 auto; }
.doc.locked { filter: blur(1px); opacity: .55; pointer-events: none; }
.loading { padding: 60px; text-align: center; color: var(--muted); }
.field { position: absolute; border-radius: 3px; container-type: size; display: flex; align-items: center; overflow: visible; }
.field img { max-width: 100%; max-height: 100%; display: block; }
.field .val { font-size: min(70cqh, 14px); white-space: nowrap; overflow: hidden; padding-left: 2px; color: #1b2a6b; font-family: Helvetica, Arial, sans-serif; }

/* Prepare */
.prep { display: grid; grid-template-columns: 250px 1fr; gap: 24px; align-items: start; }
.tools { position: sticky; top: 12px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 6px 16px 16px; }
.tools h3:first-child { margin-top: 10px; }
.pick { display: flex; align-items: center; gap: 8px; width: 100%; text-align: left; background: #fff; border: 1px solid var(--line); border-radius: 7px; padding: 7px 10px; margin-bottom: 6px; font: inherit; cursor: pointer; }
.pick:hover { border-color: #b9c0cc; } .pick.on { border-color: var(--accent); box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 25%, transparent); font-weight: 600; }
.pick .dot { width: 11px; height: 11px; border-radius: 50%; flex: none; }
.pick .ico { width: 24px; text-align: center; font-size: .8rem; color: var(--muted); font-weight: 700; }
.hint { font-size: .85rem; color: var(--muted); }
.tool-actions { display: grid; gap: 8px; margin-top: 14px; }
.prep .page { cursor: crosshair; }
.prep-field { background: color-mix(in srgb, var(--c) 16%, transparent); border: 1.5px solid var(--c); cursor: move; touch-action: none; user-select: none; }
.prep-field.dragging { opacity: .8; }
.prep-field .lbl { font-size: min(45cqh, 11px); color: var(--c); font-weight: 700; padding: 0 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.prep-field .x, .sign-field .x { position: absolute; top: -9px; right: -9px; width: 18px; height: 18px; border-radius: 50%; border: 0; background: #374151; color: #fff; font-size: 10px; cursor: pointer; display: none; padding: 0; line-height: 18px; }
.prep-field:hover .x, .sign-field:hover .x { display: block; }
.prep-field .grip { position: absolute; right: -4px; bottom: -4px; width: 10px; height: 10px; background: var(--c); border-radius: 2px; cursor: nwse-resize; }

/* Sign */
.sign-head { display: flex; justify-content: space-between; align-items: flex-start; max-width: 900px; margin: 0 auto 10px; gap: 12px; }
.consent { max-width: 900px; margin: 0 auto 16px; display: flex; gap: 18px; align-items: center; justify-content: space-between; flex-wrap: wrap;
           border-left: 4px solid var(--accent); }
.consent label { margin: 0; flex: 1 1 400px; }
.note { max-width: 900px; margin: 0 auto 16px; padding: 12px 16px; background: #fffbea; border: 1px solid #f3e3a3; border-radius: 8px; }
.card.center { max-width: 900px; margin: 0 auto 20px; }
.sign-field { background: rgba(255, 214, 10, .28); border: 2px solid #e6b800; cursor: pointer; }
.sign-field.filled { background: transparent; border: 1.5px dashed rgba(30, 60, 150, .35); }
.sign-field .cta { font-size: min(42cqh, 13px); font-weight: 700; color: #6b5300; padding: 0 6px; white-space: nowrap; }
.sign-field input { margin: 0; height: 100%; border: 0; background: transparent; padding: 0 3px; font-size: min(70cqh, 14px); border-radius: 0; }
.sign-field input:focus { outline: 0; }
.sign-field.pulse { animation: pulse 1.1s ease-out; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(230,184,0,.7); } 100% { box-shadow: 0 0 0 16px rgba(230,184,0,0); } }
.signbar { position: sticky; bottom: 0; max-width: 900px; margin: 0 auto; display: flex; gap: 10px; align-items: center; justify-content: flex-end;
           background: var(--card); border: 1px solid var(--line); border-radius: 12px 12px 0 0; padding: 12px 16px; box-shadow: 0 -4px 16px rgba(0,0,0,.08); }
.signbar #progress { margin-right: auto; font-weight: 600; }
.dlg { border: 0; border-radius: 14px; padding: 22px 24px; width: min(560px, 94vw); box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.dlg::backdrop { background: rgba(20, 25, 40, .5); }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; margin-bottom: 12px; }
.seg button { border: 0; background: #fff; padding: 6px 18px; font: inherit; cursor: pointer; } .seg button.on { background: var(--accent); color: #fff; }
.sig-preview { height: 90px; display: flex; align-items: center; padding: 0 12px; margin-top: 8px; font-size: 44px; color: #1b2a6b; border-bottom: 1px solid #9aa3b3; white-space: nowrap; overflow: hidden; }
#sigPad { width: 100%; height: auto; aspect-ratio: 10 / 3; border: 1px dashed #9aa3b3; border-radius: 8px; touch-action: none; background: #fcfcfd; cursor: crosshair; }

#toast { position: fixed; left: 50%; bottom: 90px; transform: translate(-50%, 20px); background: #1f2937; color: #fff; padding: 10px 18px; border-radius: 8px;
         opacity: 0; pointer-events: none; transition: .2s; z-index: 50; max-width: 90vw; }
#toast.show { opacity: 1; transform: translate(-50%, 0); } #toast.err { background: var(--err); }

@media (max-width: 800px) {
  .prep { grid-template-columns: 1fr; } .tools { position: static; }
  .search input { width: 100%; } table.list th:nth-child(4), table.list td:nth-child(4) { display: none; }
  .wrap { padding: 0 12px; }
}
