/* Upseeds signing page. Tokens follow the approved mockup (online-acceptance-mockup.html). One stylesheet; no inline styles (CSP). */
:root {
  --canvas: #f4f5f7; --panel: #ffffff; --ink: #14171c; --ink-2: #3d434d; --ink-3: #5c636e;
  --line: #dfe2e7; --edge: #868d98; --brand: #1f4fd1; --brand-ink: #ffffff; --brand-soft: #e8eefc; --brand-press: #1a43b3;
  --ok: #127a3e; --ok-soft: #e5f4ea; --bad: #b42318; --bad-soft: #fdecea; --warn-soft: #fff8e6; --warn-edge: #f0dca8;
  --r-card: 12px; --r-ctl: 10px; --r-chip: 99px;
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 20px; --s6: 24px;
  --fs-xs: 12px; --fs-sm: 13px; --fs-md: 15px; --fs-lg: 19px; --fs-xl: 26px;
  --ctl-h: 48px;
}
* { box-sizing: border-box; scrollbar-width: none; }
*::-webkit-scrollbar { display: none; }
html, body { overflow-x: clip; margin: 0; background: var(--canvas); color: var(--ink); font: var(--fs-md)/1.5 -apple-system, "SF Pro Text", "Segoe UI", Roboto, "Noto Sans Arabic", "Geeza Pro", Arial, sans-serif; -webkit-text-size-adjust: 100%; }
[dir="rtl"] body, [dir="rtl"] { font-family: -apple-system, "SF Arabic", "Geeza Pro", "Noto Sans Arabic", "Segoe UI", Tahoma, Arial, sans-serif; }
button { font: inherit; }
[hidden] { display: none !important; }

.top { position: sticky; top: 0; z-index: 5; background: var(--panel); border-bottom: 1px solid var(--line); }
.top-in { max-width: 760px; margin: 0 auto; padding: var(--s3) var(--s5); display: flex; align-items: center; gap: var(--s3); min-height: 56px; }
.logo { font-weight: 700; letter-spacing: -.01em; white-space: nowrap; }
.logo small { font-weight: 500; color: var(--ink-3); margin-inline-start: 6px; font-size: var(--fs-sm); }
.grow { flex: 1; min-width: 0; }
.where { color: var(--ink-3); font-size: var(--fs-sm); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lang { border: 1px solid var(--edge); background: var(--panel); border-radius: 8px; min-height: 36px; padding: 4px 12px; font-size: var(--fs-sm); color: var(--ink-2); cursor: pointer; }
.bar { height: 4px; background: var(--line); }
.bar i { display: block; height: 100%; width: 0; background: var(--brand); transition: width .25s ease; }

main { max-width: 760px; margin: 0 auto; padding: var(--s6) var(--s5) calc(120px + env(safe-area-inset-bottom)); }
.eyebrow { font-size: var(--fs-sm); color: var(--ink-3); margin: 0 0 6px; }
h1 { font-size: var(--fs-xl); line-height: 1.25; margin: 0 0 10px; letter-spacing: -.01em; }
h2 { font-size: var(--fs-lg); line-height: 1.3; margin: 0 0 var(--s2); }
p.lead { color: var(--ink-2); margin: 0 0 var(--s5); }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-card); padding: var(--s5); margin-bottom: 14px; }
.steps { display: grid; gap: 10px; margin: 18px 0 var(--s6); }
.step { display: flex; gap: 14px; align-items: flex-start; }
.num { flex: none; width: 28px; height: 28px; border-radius: 50%; background: var(--brand-soft); color: var(--brand); font-weight: 700; display: grid; place-items: center; font-size: 14px; }
.step b { display: block; }
.step span { color: var(--ink-3); font-size: 14px; }

.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field label { font-size: var(--fs-sm); font-weight: 600; color: var(--ink-2); }
.field .help { font-size: var(--fs-xs); color: var(--ink-3); }
input[type=text], input[type=tel], textarea, select { font: inherit; font-size: 16px; padding: 10px 12px; min-height: var(--ctl-h); border: 1px solid var(--edge); border-radius: 8px; background: var(--panel); color: var(--ink); width: 100%; }
input:focus-visible, textarea:focus-visible, select:focus-visible, button:focus-visible, a:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
input[readonly] { background: var(--canvas); color: var(--ink-2); }
textarea { min-height: 96px; resize: vertical; field-sizing: content; max-height: 50vh; }
.gate { max-width: 420px; margin-bottom: var(--s5); }
.gate .btn { width: 100%; margin-top: var(--s2); }
.code-in::placeholder { letter-spacing: 0; font-size: 16px; }
.code-in { font-size: 24px !important; letter-spacing: .3em; text-align: center; font-variant-numeric: tabular-nums; direction: ltr; }

.btn { font-weight: 600; border-radius: var(--r-ctl); min-height: var(--ctl-h); padding: 12px 18px; border: 1px solid var(--edge); background: var(--panel); color: var(--ink); cursor: pointer; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn.primary:active { background: var(--brand-press); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.small { min-height: 40px; padding: 8px 14px; font-size: 14px; }
.dock { position: fixed; inset-inline: 0; bottom: 0; background: var(--panel); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); z-index: 6; }
.dock-in { max-width: 760px; margin: 0 auto; padding: var(--s3) var(--s5); display: flex; gap: 10px; align-items: center; }
.hint { color: var(--ink-3); font-size: var(--fs-sm); line-height: 1.3; }
.muted { color: var(--ink-3); font-size: var(--fs-sm); }
.receipt { font: 12px/1.5 ui-monospace, Menlo, monospace; color: var(--ink-2); word-break: break-all; margin: var(--s2) 0 0; }
.err { color: var(--bad); font-size: 14px; margin: var(--s2) 0 0; }
.note { font-size: var(--fs-sm); color: var(--ink-2); background: var(--warn-soft); border: 1px solid var(--warn-edge); border-radius: 8px; padding: var(--s2) var(--s3); margin-bottom: var(--s4); }

/* Contract text (English source, always left-to-right) */
.doc { color: var(--ink-2); font-size: 15px; }
.doc p { margin: 0 0 10px; }
.doc ul, .doc ol { padding-inline-start: 22px; margin: 8px 0 12px; }
.doc li { margin-bottom: 4px; }
.doc h3 { font-size: 15px; margin: 16px 0 6px; color: var(--ink); }
.doc h4 { font-size: 14px; margin: 12px 0 4px; color: var(--ink); }
.doc blockquote { margin: 10px 0; padding: 8px 12px; border-inline-start: 3px solid var(--edge); background: var(--canvas); border-radius: 4px; }
.doc code { font: 13px ui-monospace, Menlo, monospace; background: var(--canvas); padding: 1px 4px; border-radius: 4px; }
.doc .tbl { overflow-x: auto; margin: 10px 0 14px; border: 1px solid var(--line); border-radius: 8px; }
.doc table { border-collapse: collapse; width: 100%; font-size: 14px; }
.doc th, .doc td { overflow-wrap: anywhere; padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.doc th { background: var(--canvas); color: var(--ink); font-weight: 600; font-size: var(--fs-sm); }
.doc tr:last-child td { border-bottom: 0; }
.doc .ph { background: #fff1bf; border-radius: 3px; padding: 0 2px; }
.doc .annex-note { color: var(--ink-3); font-size: 14px; }
.en-note { font-size: var(--fs-sm); color: var(--ink-3); margin: 0 0 var(--s3); }

.initial-row { display: flex; align-items: center; gap: var(--s3); margin-top: var(--s4); padding-top: 14px; border-top: 1px dashed var(--edge); }
.initial-box { flex: none; min-width: 96px; height: 56px; padding: 0 12px; border: 2px dashed var(--brand); border-radius: var(--r-ctl); background: var(--brand-soft); color: var(--brand); font-weight: 700; font-size: 14px; cursor: pointer; display: grid; place-items: center; }
.initial-box:disabled { border-color: var(--edge); background: var(--canvas); color: var(--ink-3); cursor: not-allowed; }
.initial-box.done { border-style: solid; border-color: var(--ink-2); background: var(--panel); color: var(--ink); font: italic 600 26px/1 "Snell Roundhand", "Segoe Script", "Brush Script MT", cursive; }
[dir="rtl"] .initial-box.done { font-style: normal; font-family: "Diwan Thuluth", "Geeza Pro", serif; }
.ini { font: italic 600 18px "Snell Roundhand", "Segoe Script", cursive; color: var(--ink-2); }

.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.chip { font-size: var(--fs-xs); padding: 3px 10px; border-radius: var(--r-chip); background: var(--panel); border: 1px solid var(--line); color: var(--ink-2); }
.chip b { color: var(--ink); }
.do, .expect { border-radius: var(--r-ctl); padding: 14px var(--s4); margin-bottom: var(--s3); }
.do { background: var(--panel); border: 1px solid var(--line); }
.expect { background: var(--ok-soft); }
.do h3, .expect h3 { margin: 0 0 4px; font-size: var(--fs-sm); text-transform: uppercase; letter-spacing: .04em; color: var(--ink-3); }
[dir="rtl"] .do h3, [dir="rtl"] .expect h3 { text-transform: none; letter-spacing: 0; }
.expect h3 { color: var(--ok); }
.do .txt, .expect .txt { color: var(--ink); }
.open { display: inline-flex; gap: 6px; align-items: center; min-height: 44px; margin: 0 0 var(--s3); color: var(--brand); font-weight: 600; text-decoration: none; }
.verdict { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: var(--s4); }
.vbtn { font-weight: 600; min-height: 52px; padding: 12px; border-radius: var(--r-ctl); border: 1.5px solid var(--edge); background: var(--panel); cursor: pointer; color: var(--ink); }
.vbtn.on.pass { border-color: var(--ok); background: var(--ok-soft); color: var(--ok); }
.vbtn.on.fail { border-color: var(--bad); background: var(--bad-soft); color: var(--bad); }
.issue { margin-top: var(--s4); }
.drop { display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 56px; border: 1.5px dashed var(--edge); border-radius: var(--r-ctl); padding: 12px; color: var(--ink-2); font-size: 14px; cursor: pointer; background: var(--panel); width: 100%; }
.thumbs { display: flex; gap: 8px; flex-wrap: wrap; margin-top: var(--s2); }
.thumb { position: relative; width: 72px; height: 72px; border-radius: 8px; overflow: hidden; border: 1px solid var(--line); background: var(--canvas); }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }

.list { display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; margin-bottom: var(--s4); }
.li { display: flex; gap: 10px; align-items: center; padding: 2px 12px; border: 1px solid var(--line); border-radius: var(--r-ctl); background: var(--panel); font-size: 14px; min-height: 48px; }
.sreq { margin: 0; padding-inline-start: 22px; }
.sreq li { margin-bottom: 10px; overflow-wrap: anywhere; }
.sreq li:last-child { margin-bottom: 0; }
.sreq .what { display: block; color: var(--ink); font-weight: 600; }
.sreq .muted { display: block; }
.li .n { flex: none; width: 24px; font-weight: 700; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.li .t { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#docs .li .t { white-space: normal; padding-block: 6px; line-height: 1.35; } /* document names wrap; only the summary rows shorten */
.li button.t { display: block; width: 0; min-height: 44px; border: 0; background: none; padding: 0; text-align: start; color: var(--ink); cursor: pointer; font-size: 14px; }
.tag { flex: none; font-size: var(--fs-xs); font-weight: 700; padding: 2px 8px; border-radius: var(--r-chip); }
.tag.p { background: var(--ok-soft); color: var(--ok); }
.tag.f { background: var(--bad-soft); color: var(--bad); }
.tag.n { background: var(--canvas); color: var(--ink-3); }

.sigpad { border: 1.5px solid var(--edge); border-radius: var(--r-ctl); background: #fff; width: 100%; height: 170px; touch-action: none; display: block; }
.row { display: flex; gap: 10px; align-items: center; }
.check { display: flex; gap: 12px; align-items: flex-start; font-size: 15px; color: var(--ink); margin: 0 0 var(--s4); cursor: pointer; }
.check input { width: 22px; height: 22px; margin: 1px 0 0; flex: none; accent-color: var(--brand); }
.done-mark { width: 64px; height: 64px; border-radius: 50%; background: var(--ok-soft); color: var(--ok); display: grid; place-items: center; font-size: 32px; margin-bottom: var(--s3); }
.req { border: 1px solid var(--line); border-radius: var(--r-ctl); padding: var(--s3); margin-bottom: var(--s3); background: var(--panel); }
.center { text-align: center; }
.skeleton { height: 18px; border-radius: 6px; background: linear-gradient(90deg, var(--line), #eceef2, var(--line)); background-size: 200% 100%; animation: sk 1.2s infinite linear; margin-bottom: 10px; }
.skeleton.w60 { width: 60%; } .skeleton.w80 { width: 80%; } .skeleton.h40 { height: 40px; }
@keyframes sk { from { background-position: 200% 0; } to { background-position: -200% 0; } }
@media (max-width: 520px) { .where { display: none; } .doc table { font-size: 13px; } .doc th, .doc td { padding: 6px 7px; } h1 { font-size: 23px; } main { padding-top: var(--s5); } .top-in { padding: var(--s2) var(--s4); } main, .dock-in { padding-inline: var(--s4); } .card { padding: var(--s4); } }
@media (prefers-reduced-motion: reduce) { .bar i, .skeleton { transition: none; animation: none; } }
