/* TEXSOLON Onboarding — shared styles (public form, admin, print) */
:root {
  --navy: #0b1f4d; --navy-2: #13306e; --accent: #c8a24a; --ink: #14182b; --muted: #6b7290;
  --line: #e3e6ef; --bg: #f4f6fb; --card: #fff; --ok: #157347; --warn: #9a6a00; --err: #b42318;
  --radius: 12px; --shadow: 0 1px 2px rgba(16,24,40,.05), 0 4px 16px rgba(16,24,40,.06);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif; color: var(--ink); background: var(--bg); }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .6em; }
h1 { font-size: 1.6rem; } h2 { font-size: 1.15rem; } h3 { font-size: 1rem; margin-top: 1.2em; }
a { color: var(--navy-2); }
.muted { color: var(--muted); } .small { font-size: .85rem; } .req { color: var(--err); font-weight: 600; }
.full { grid-column: 1 / -1; }

/* forms */
label { display: flex; flex-direction: column; gap: 6px; font-size: .88rem; font-weight: 500; }
input, select, textarea {
  font: inherit; width: 100%; padding: 10px 12px; border: 1px solid #cfd4e2; border-radius: 9px; background: #fff; color: var(--ink);
}
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(19,48,110,.25); border-color: var(--navy-2); }
input.invalid, select.invalid, textarea.invalid { border-color: var(--err); background: #fff6f5; }
input[type=file] { padding: 8px; background: #fafbfe; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px 16px; }
.stack > * + * { margin-top: 14px; }
.check { flex-direction: row; align-items: flex-start; gap: 10px; font-weight: 400; margin: 14px 0; }
.check input { width: 18px; height: 18px; margin-top: 2px; flex: none; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 10px 16px; border-radius: 9px;
  border: 1px solid #cfd4e2; background: #fff; color: var(--ink); font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; white-space: nowrap;
}
.btn:hover { background: #f3f5fa; }
.btn.primary { background: var(--navy); color: #fff; border-color: var(--navy); }
.btn.primary:hover { background: var(--navy-2); }
.btn.danger { color: var(--err); border-color: #f1c0bb; }
.btn.ok { background: var(--ok); color: #fff; border-color: var(--ok); }
.btn.sm { padding: 6px 10px; font-size: .85rem; }
.btn:disabled { opacity: .6; cursor: wait; }
.link { background: none; border: 0; color: var(--navy-2); font: inherit; font-weight: 600; cursor: pointer; padding: 0; }
.file-btn { position: relative; overflow: hidden; }
.file-btn input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

.alert { padding: 12px 14px; border-radius: 10px; margin: 0 0 16px; border: 1px solid; }
.alert ul { margin: 6px 0 0 18px; padding: 0; }
.alert.err { background: #fef3f2; border-color: #fecdca; color: #7a271a; }
.alert.ok { background: #ecfdf3; border-color: #abefc6; color: #05603a; }
.alert.warn { background: #fffaeb; border-color: #fedf89; color: #7a4f01; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px; }

/* auth / message pages */
.auth-body { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; background: radial-gradient(1200px 600px at 10% -10%, #1d3d85 0, var(--navy) 55%); }
.auth-card { width: 100%; max-width: 420px; background: #fff; border-radius: 16px; padding: 30px; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.auth-card.wide { max-width: 640px; }
.brand-mark { width: 52px; height: 52px; border-radius: 12px; background: var(--navy); color: var(--accent); display: grid; place-items: center; font-weight: 800; letter-spacing: .5px; margin-bottom: 16px; font-size: .95rem; }
.brand-mark.light { background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.25); margin: 0; flex: none; }
.checks { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: .85rem; }
.checks .ok { color: var(--ok); } .checks .bad { color: var(--err); font-weight: 600; }

/* public form */
.form-body { background: var(--bg); }
.hero { background: linear-gradient(135deg, var(--navy) 0, #163a85 100%); color: #fff; padding: 34px 16px 0; }
.hero-in { max-width: 860px; margin: 0 auto; display: flex; gap: 18px; align-items: flex-start; }
.hero-logo { width: 60px; height: 60px; object-fit: contain; background: #fff; border-radius: 12px; padding: 6px; flex: none; }
.eyebrow { margin: 0 0 4px; text-transform: uppercase; letter-spacing: .12em; font-size: .75rem; color: var(--accent); font-weight: 700; }
.hero h1 { color: #fff; font-size: 1.75rem; margin-bottom: .3em; }
.hero-sub { margin: 0; color: rgba(255,255,255,.8); max-width: 560px; }
.offer { max-width: 860px; margin: 24px auto 0; display: grid; grid-template-columns: repeat(4, 1fr); background: #fff; color: var(--ink); border-radius: 14px 14px 0 0; border: 1px solid var(--line); border-bottom: 0; }
.offer div { padding: 14px 16px; border-right: 1px solid var(--line); }
.offer div:last-child { border-right: 0; }
.offer dt { font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.offer dd { margin: 2px 0 0; font-weight: 600; }
.form-wrap { max-width: 860px; margin: 0 auto; padding: 24px 16px 40px; }
.stepper { list-style: none; padding: 0; margin: 0 0 18px; display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; }
.stepper li { flex: 1 0 auto; display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 10px; cursor: pointer; color: var(--muted); font-size: .82rem; background: #fff; border: 1px solid var(--line); }
.stepper li span { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: #eef1f8; font-weight: 700; font-size: .78rem; flex: none; }
.stepper li em { font-style: normal; white-space: nowrap; }
.stepper li.active { border-color: var(--navy); color: var(--navy); font-weight: 600; }
.stepper li.active span { background: var(--navy); color: #fff; }
.stepper li.done span { background: var(--ok); color: #fff; }
.step { display: none; } .step.active { display: block; }
.nav-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 18px; }
.foot { text-align: center; margin-top: 26px; }

.photo-box { display: flex; gap: 20px; align-items: flex-start; margin-bottom: 22px; }
.photo-preview { width: 150px; aspect-ratio: 3/4; border: 2px dashed #cfd4e2; border-radius: 12px; display: grid; place-items: center; text-align: center; padding: 8px; color: var(--muted); font-size: .85rem; overflow: hidden; flex: none; background: #fafbfe; }
.photo-preview img { width: 100%; height: 100%; object-fit: cover; border-radius: 8px; }
.photo-actions { display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }
.photo-actions p { margin: 0; }
.camera { margin-top: 6px; }
.camera video { width: 100%; max-width: 320px; border-radius: 10px; background: #000; display: block; margin-bottom: 8px; transform: scaleX(-1); }
.docs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; }
.doc { padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: #fcfcfe; }

.declaration { background: #f7f8fc; border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; font-size: .92rem; color: #333a52; max-height: 220px; overflow: auto; }
.sig-wrap { border: 1px solid var(--line); border-radius: 12px; padding: 12px; background: #fff; }
.sig-head { display: flex; justify-content: space-between; font-size: .88rem; font-weight: 500; margin-bottom: 8px; }
#sigPad { width: 100%; height: 180px; border: 1px dashed #b9c0d4; border-radius: 10px; background: repeating-linear-gradient(#fff 0 39px, #f2f4f9 39px 40px); touch-action: none; cursor: crosshair; display: block; }
.sig-line { display: flex; justify-content: space-between; border-top: 1px solid var(--ink); margin: 10px 4px 0; padding-top: 4px; font-size: .82rem; color: var(--muted); }

/* admin */
.admin-body { background: var(--bg); }
.topbar { background: var(--navy); color: #fff; }
.topbar-in { max-width: 1200px; margin: 0 auto; padding: 0 16px; display: flex; align-items: center; gap: 18px; min-height: 58px; flex-wrap: wrap; }
.topbar .logo { font-weight: 800; letter-spacing: .03em; color: #fff; text-decoration: none; display: flex; align-items: center; gap: 10px; }
.topbar .logo b { color: var(--accent); }
.topbar nav { display: flex; gap: 4px; flex: 1; flex-wrap: wrap; }
.topbar nav a { color: rgba(255,255,255,.78); text-decoration: none; padding: 8px 12px; border-radius: 8px; font-weight: 500; font-size: .92rem; }
.topbar nav a.on, .topbar nav a:hover { background: rgba(255,255,255,.1); color: #fff; }
.topbar .me { font-size: .85rem; color: rgba(255,255,255,.75); }
.topbar .me a { color: #fff; margin-left: 8px; }
.wrap { max-width: 1200px; margin: 0 auto; padding: 24px 16px 48px; }
.page-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head h1 { margin: 0; font-size: 1.4rem; }
.stats { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; margin-bottom: 18px; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; text-decoration: none; color: inherit; }
.stat b { display: block; font-size: 1.5rem; } .stat span { color: var(--muted); font-size: .82rem; }
.stat.on { border-color: var(--navy); box-shadow: inset 0 0 0 1px var(--navy); }
.filters { display: flex; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.filters input, .filters select { width: auto; min-width: 180px; }
.table-wrap { background: #fff; border: 1px solid var(--line); border-radius: 12px; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th, td { text-align: left; padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); background: #fafbfe; font-weight: 600; }
tr:last-child td { border-bottom: 0; }
td .sub { display: block; color: var(--muted); font-size: .8rem; }
.avatar { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; background: #e6e9f2; display: inline-grid; place-items: center; font-weight: 700; color: var(--navy); font-size: .8rem; vertical-align: middle; }
.who { display: flex; gap: 10px; align-items: center; }
.badge { display: inline-block; padding: 3px 9px; border-radius: 99px; font-size: .75rem; font-weight: 600; white-space: nowrap; }
.b-invited { background: #eef4ff; color: #3538cd; } .b-submitted { background: #fffaeb; color: #b54708; }
.b-changes { background: #fdf2fa; color: #c11574; } .b-approved { background: #ecfdf3; color: #067647; }
.b-revoked, .b-expired { background: #f2f4f7; color: #475467; }
.empty { padding: 40px; text-align: center; color: var(--muted); }
.copybox { display: flex; gap: 8px; } .copybox input { font-family: ui-monospace, monospace; font-size: .85rem; }
.two-col { display: grid; grid-template-columns: 1fr 320px; gap: 18px; align-items: start; }
.kv { display: grid; grid-template-columns: 200px 1fr; gap: 0; margin: 0; font-size: .92rem; }
.kv dt, .kv dd { padding: 8px 0; border-bottom: 1px solid var(--line); margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { font-weight: 500; white-space: pre-line; }
.side-photo { width: 100%; aspect-ratio: 3/4; object-fit: cover; border-radius: 10px; border: 1px solid var(--line); }
.sig-img { max-width: 100%; max-height: 110px; display: block; background: #fff; }
.doc-list { list-style: none; padding: 0; margin: 0; }
.doc-list li { display: flex; justify-content: space-between; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: .9rem; }
.timeline { list-style: none; padding: 0; margin: 0; font-size: .85rem; }
.timeline li { padding: 6px 0 6px 14px; border-left: 2px solid var(--line); position: relative; }
.timeline li::before { content: ""; position: absolute; left: -5px; top: 12px; width: 8px; height: 8px; border-radius: 50%; background: var(--navy-2); }
.card + .card { margin-top: 16px; }
.section-title { font-size: .78rem; text-transform: uppercase; letter-spacing: .1em; color: var(--navy-2); margin: 22px 0 6px; }
.section-title:first-child { margin-top: 0; }

/* print record */
.print-page { background: #fff; max-width: 820px; margin: 0 auto; padding: 32px; }
.print-head { display: flex; justify-content: space-between; align-items: center; border-bottom: 3px solid var(--navy); padding-bottom: 12px; margin-bottom: 18px; }
.print-head h1 { margin: 0; font-size: 1.3rem; color: var(--navy); }
.print-head img { max-height: 54px; }
.print-grid { display: grid; grid-template-columns: 1fr 140px; gap: 20px; }
.print-photo { width: 140px; height: 180px; object-fit: cover; border: 1px solid #999; }
.ptable { width: 100%; border-collapse: collapse; font-size: .85rem; margin-bottom: 10px; }
.ptable th, .ptable td { border: 1px solid #c9ccd6; padding: 6px 8px; text-transform: none; letter-spacing: 0; font-size: .85rem; color: var(--ink); background: none; }
.ptable th { width: 34%; background: #f4f6fb; font-weight: 600; }
.ptable caption { text-align: left; font-weight: 700; padding: 10px 0 4px; color: var(--navy); }
.sign-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; margin-top: 28px; align-items: end; }
.sign-row > div { display: flex; flex-direction: column; justify-content: flex-end; min-height: 80px; font-size: .8rem; text-align: center; }
.sign-row .line { border-top: 1px solid #333; padding-top: 4px; }
.sign-row img { max-height: 64px; max-width: 100%; display: block; margin: 0 auto 4px; }
.no-print { margin-bottom: 16px; }
@media print {
  body { background: #fff; }
  .no-print, .topbar { display: none !important; }
  .print-page { padding: 0; max-width: none; }
  @page { margin: 14mm; }
}

@media (max-width: 860px) {
  .stats { grid-template-columns: repeat(3, 1fr); }
  .two-col { grid-template-columns: 1fr; }
  .offer { grid-template-columns: repeat(2, 1fr); }
  .offer div:nth-child(2) { border-right: 0; }
  .offer div:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
}
@media (max-width: 600px) {
  .grid2, .grid3, .docs { grid-template-columns: 1fr; }
  .stepper li em { display: none; } .stepper li.active em { display: inline; }
  .photo-box { flex-direction: column; align-items: center; }
  .photo-actions { align-items: stretch; width: 100%; }
  .card { padding: 16px; }
  .hero h1 { font-size: 1.4rem; }
  .hero-in { flex-direction: column; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .kv { grid-template-columns: 1fr; } .kv dt { border: 0; padding-bottom: 0; }
  .print-grid { grid-template-columns: 1fr; }
}
