/* XOR Partner Portal */
@font-face { font-family: "Great Vibes"; src: url("GreatVibes-Regular.ttf") format("truetype"); font-display: block; }

:root {
  --ink: #13314b;
  --ink-soft: #2c4a66;
  --blue: #2e9be5;
  --blue-deep: #1b6fae;
  --blue-wash: #e3f1fc;
  --orange: #ff7f00;
  --orange-deep: #d96a00;
  --canvas: #edf2f7;
  --surface: #ffffff;
  --line: #d3dce6;
  --muted: #5c6b7a;
  --good: #1d7f52;
  --good-wash: #e2f4ea;
  --bad: #b8432f;
  --bad-wash: #fbe9e5;
  --warn-wash: #fff3e0;
  --radius: 6px;
  --head: "Lexend", system-ui, sans-serif;
  --body: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--canvas); color: var(--ink); font: 16px/1.55 var(--body); }
a { color: var(--blue-deep); }
a:hover { color: var(--ink); }
:focus-visible { outline: 3px solid var(--orange); outline-offset: 2px; }
h1, h2, h3 { font-family: var(--head); font-weight: 600; line-height: 1.2; margin: 0 0 .5em; letter-spacing: -0.01em; }
h1 { font-size: 1.75rem; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.05rem; }
p { margin: 0 0 1em; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.nowrap { white-space: nowrap; }
.num { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }

/* Header */
.topbar { background: var(--surface); border-bottom: 1px solid var(--line); }
.topbar-inner { max-width: 1180px; margin: 0 auto; padding: 10px 24px; display: flex; align-items: center; gap: 28px; }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--ink); }
.brand img { height: 40px; width: auto; display: block; }
.brand span { font-family: var(--head); font-weight: 500; font-size: .95rem; color: var(--muted); border-left: 1px solid var(--line); padding-left: 12px; }
.nav { display: flex; gap: 4px; flex-wrap: wrap; flex: 1; }
.nav a { font-family: var(--head); font-size: .9rem; text-decoration: none; color: var(--ink-soft); padding: 8px 12px; border-radius: var(--radius); }
.nav a:hover { background: var(--canvas); color: var(--ink); }
.nav a.on { color: var(--blue-deep); background: var(--blue-wash); }
.who { display: flex; align-items: center; gap: 12px; font-size: .875rem; color: var(--muted); }
.who form { margin: 0; }
.linkbtn { background: none; border: 0; padding: 0; color: var(--blue-deep); font: inherit; cursor: pointer; text-decoration: underline; }

main.page { max-width: 1180px; margin: 0 auto; padding: 32px 24px 64px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.page-head h1 { margin: 0; }
.page-head p { margin: 4px 0 0; color: var(--muted); }

/* Panels */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; margin-bottom: 24px; }
.panel > h2:first-child { margin-top: 0; }
.panel-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.panel-head h2 { margin: 0; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.grid-main { display: grid; grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr); gap: 24px; align-items: start; }
@media (max-width: 860px) { .grid-2, .grid-main { grid-template-columns: 1fr; } }

/* Summary figures */
.figures { display: flex; gap: 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); margin-bottom: 24px; flex-wrap: wrap; }
.figure { flex: 1 1 160px; padding: 16px 20px; border-left: 1px solid var(--line); }
.figure:first-child { border-left: 0; }
.figure b { display: block; font-family: var(--head); font-size: 1.5rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.figure span { color: var(--muted); font-size: .875rem; }

/* Tables */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: .9375rem; }
table.data th { text-align: left; font-family: var(--head); font-weight: 500; font-size: .8125rem; color: var(--muted); padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.data td { padding: 12px 10px; border-bottom: 1px solid #e6ebf1; vertical-align: top; }
table.data tr:last-child td { border-bottom: 0; }
table.data td a.rowlink { font-weight: 600; text-decoration: none; }
table.data td a.rowlink:hover { text-decoration: underline; }
table.data th.num { text-align: right; }
.empty { padding: 20px; text-align: center; color: var(--muted); border: 1px dashed var(--line); border-radius: var(--radius); }
.empty p { margin: 0 0 10px; }
.empty p:last-child { margin: 0; }
dl.facts { display: grid; grid-template-columns: max-content 1fr; gap: 8px 20px; margin: 0; }
dl.facts dt { color: var(--muted); font-size: .875rem; padding-top: 2px; }
dl.facts dd { margin: 0; overflow-wrap: anywhere; }

/* Badges */
.badge { display: inline-block; font-family: var(--head); font-size: .78rem; font-weight: 500; padding: 3px 9px; border-radius: 999px; white-space: nowrap; }
.badge-neutral { background: #e8edf2; color: var(--ink-soft); }
.badge-active { background: var(--blue-wash); color: var(--blue-deep); }
.badge-good { background: var(--good-wash); color: var(--good); }
.badge-bad { background: var(--bad-wash); color: var(--bad); }
.badge-warn { background: var(--warn-wash); color: var(--orange-deep); }

/* Pipeline: the deal's progress through XOR's sales stages */
.pipeline { list-style: none; margin: 8px 0 4px; padding: 0; display: grid; grid-template-columns: repeat(6, 1fr); counter-reset: none; }
.pipeline li { position: relative; padding-top: 30px; font-family: var(--head); font-size: .8125rem; color: var(--muted); text-align: center; }
.pipeline li::before { content: ""; position: absolute; top: 9px; left: 0; right: 0; height: 4px; background: var(--line); }
.pipeline li:first-child::before { left: 50%; }
.pipeline li:last-child::before { right: 50%; }
.pipeline li::after { content: ""; position: absolute; top: 2px; left: 50%; width: 18px; height: 18px; margin-left: -9px; border-radius: 50%; background: var(--surface); border: 3px solid var(--line); }
.pipeline li.done { color: var(--ink); }
.pipeline li.done::before { background: var(--blue); }
.pipeline li.done::after { background: var(--blue); border-color: var(--blue); }
.pipeline li.now { color: var(--ink); font-weight: 600; }
.pipeline li.now::before { background: linear-gradient(90deg, var(--blue) 50%, var(--line) 50%); }
.pipeline li:first-child.now::before { background: var(--line); }
.pipeline li.now::after { border-color: var(--orange); background: var(--orange); box-shadow: 0 0 0 5px rgba(255, 127, 0, .18); }
.pipeline li.now.final::before { background: var(--blue); }
.pipeline li.now.final::after { border-color: var(--good); background: var(--good); box-shadow: 0 0 0 5px rgba(29, 127, 82, .16); }
.pipeline.stopped li.now::after { border-color: var(--bad); background: var(--bad); box-shadow: 0 0 0 5px rgba(184, 67, 47, .16); }
.pipeline-note { margin-top: 12px; font-size: .9rem; }
.mini-pipe { display: inline-flex; gap: 3px; vertical-align: middle; margin-right: 8px; }
.mini-pipe i { width: 14px; height: 5px; border-radius: 2px; background: var(--line); }
.mini-pipe i.done { background: var(--blue); }
.mini-pipe i.now { background: var(--orange); }
.mini-pipe.final i { background: var(--good); }
.mini-pipe.stopped i.now { background: var(--bad); }
@media (max-width: 640px) {
  .pipeline { grid-template-columns: 1fr; gap: 0; }
  .pipeline li { text-align: left; padding: 6px 0 6px 32px; }
  .pipeline li::before { top: 0; bottom: 0; left: 8px; right: auto; width: 4px; height: auto; }
  .pipeline li:first-child::before { left: 8px; top: 50%; }
  .pipeline li:last-child::before { right: auto; bottom: 50%; }
  .pipeline li::after { top: 50%; left: 10px; margin-top: -9px; }
}

/* Timeline (status history) */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { padding: 0 0 14px 20px; border-left: 2px solid var(--line); position: relative; }
.timeline li::before { content: ""; position: absolute; left: -6px; top: 6px; width: 10px; height: 10px; border-radius: 50%; background: var(--blue); }
.timeline li:last-child { border-left-color: transparent; }
.timeline time { display: block; font-size: .8125rem; color: var(--muted); }

/* Forms */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px 20px; }
.form-grid .full { grid-column: 1 / -1; }
@media (max-width: 640px) { .form-grid { grid-template-columns: 1fr; } }
.field label, .label { display: block; font-family: var(--head); font-size: .875rem; font-weight: 500; margin-bottom: 6px; }
.field .hint { font-size: .8125rem; color: var(--muted); margin-top: 4px; }
input[type=text], input[type=email], input[type=password], input[type=tel], input[type=date], input[type=number], input[type=file], select, textarea {
  width: 100%; font: inherit; color: var(--ink); background: var(--surface);
  border: 1px solid #b9c6d3; border-radius: var(--radius); padding: 9px 11px; min-height: 42px;
}
textarea { min-height: 110px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(46, 155, 229, .25); }
fieldset { border: 0; padding: 0; margin: 0; }
legend { font-family: var(--head); font-weight: 600; font-size: 1.05rem; padding: 0; margin-bottom: 12px; }
.check { display: flex; gap: 10px; align-items: flex-start; margin: 10px 0; }
.check input { margin-top: 4px; width: 18px; height: 18px; accent-color: var(--blue-deep); flex: none; }
.choice-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.choice { display: block; border: 2px solid var(--line); border-radius: var(--radius); padding: 14px 16px; cursor: pointer; background: var(--surface); }
.choice:hover { border-color: #9fb3c6; }
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice b { display: block; font-family: var(--head); font-weight: 600; }
.choice span { font-size: .875rem; color: var(--muted); }
.choice:has(input:checked) { border-color: var(--blue); background: var(--blue-wash); }
.choice:has(input:focus-visible) { outline: 3px solid var(--orange); outline-offset: 2px; }
.actions { display: flex; gap: 12px; align-items: center; margin-top: 20px; flex-wrap: wrap; }
[hidden] { display: none !important; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; font-family: var(--head); font-weight: 500; font-size: .9375rem;
  padding: 10px 18px; min-height: 42px; border-radius: var(--radius); border: 1px solid transparent; cursor: pointer; text-decoration: none; line-height: 1.2; }
.btn-primary { background: var(--blue-deep); color: #fff; }
.btn-primary:hover { background: var(--ink); color: #fff; }
.btn-accent { background: var(--orange); color: #1d1300; }
.btn-accent:hover { background: var(--orange-deep); color: #fff; }
.btn-ghost { background: var(--surface); color: var(--ink); border-color: #b9c6d3; }
.btn-ghost:hover { border-color: var(--ink); color: var(--ink); }
.btn-danger { background: var(--surface); color: var(--bad); border-color: #e0b3aa; }
.btn-danger:hover { background: var(--bad-wash); color: var(--bad); }
.btn-sm { min-height: 32px; padding: 5px 11px; font-size: .8125rem; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* Alerts */
.alert { border-radius: var(--radius); padding: 12px 16px; margin-bottom: 20px; border: 1px solid; }
.alert ul { margin: 0; padding-left: 18px; }
.alert-success { background: var(--good-wash); border-color: #b6dfc7; color: #12553a; }
.alert-error { background: var(--bad-wash); border-color: #eec3ba; color: #7d2a1b; }
.alert-warning { background: var(--warn-wash); border-color: #ffd29b; color: #7a4100; }
.alert-info { background: var(--blue-wash); border-color: #b5dbf5; color: #0f4c79; }

/* Auth / onboarding */
.auth-wrap { min-height: 100vh; display: flex; flex-direction: column; align-items: center; padding: 48px 20px; }
.auth-wrap .auth-logo img { height: 64px; display: block; margin: 0 auto 28px; }
.auth-card { width: 100%; max-width: 440px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 32px; }
.auth-card.wide { max-width: 760px; }
.auth-card h1 { font-size: 1.5rem; }
.auth-foot { margin-top: 20px; font-size: .875rem; color: var(--muted); text-align: center; }
.steps { list-style: none; display: flex; gap: 0; margin: 0 0 28px; padding: 0; counter-reset: step; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); overflow: hidden; }
.steps li { flex: 1; padding: 12px 16px; font-family: var(--head); font-size: .875rem; color: var(--muted); counter-increment: step; border-left: 1px solid var(--line); }
.steps li:first-child { border-left: 0; }
.steps li::before { content: counter(step) ". "; }
.steps li.done { color: var(--good); }
.steps li.done::before { content: "✓ "; }
.steps li.now { color: var(--ink); background: var(--blue-wash); font-weight: 600; }
@media (max-width: 640px) { .steps { flex-direction: column; } .steps li { border-left: 0; border-top: 1px solid var(--line); } .steps li:first-child { border-top: 0; } }
.onboard { max-width: 880px; margin: 0 auto; padding: 32px 20px 64px; }
.disclosure h2 { font-size: 1.05rem; margin-top: 1.4em; }
.disclosure ul { padding-left: 20px; }

/* Agreement reader */
.agreement-frame { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.agreement-scroll { max-height: 62vh; overflow-y: auto; padding: 36px 44px; }
@media (max-width: 640px) { .agreement-scroll { padding: 20px; } }
.read-meter { display: flex; align-items: center; gap: 12px; padding: 10px 16px; border-top: 1px solid var(--line); font-size: .875rem; color: var(--muted); background: #f7f9fb; border-radius: 0 0 var(--radius) var(--radius); }
.read-meter .bar { flex: 1; height: 6px; background: var(--line); border-radius: 3px; overflow: hidden; }
.read-meter .bar i { display: block; height: 100%; width: 0; background: var(--blue); transition: width .15s linear; }
.agreement { font-family: Georgia, "Times New Roman", serif; font-size: 1rem; line-height: 1.65; color: #1a1a1a; max-width: 72ch; margin: 0 auto; }
.agreement h2 { font-family: var(--head); font-size: 1.05rem; color: var(--ink); margin: 1.6em 0 .4em; }
.agreement h2:first-child { margin-top: 0; }
.agreement table { width: 100%; border-collapse: collapse; margin: .6em 0 1.2em; font-size: .9rem; }
.agreement th, .agreement td { border: 1px solid #b9c6d3; padding: 6px 8px; text-align: left; vertical-align: top; }
.agreement th { background: #eef3f8; font-family: var(--body); }
.agreement .sig-row td { height: 64px; vertical-align: middle; }
.agreement .sig-img { max-height: 54px; max-width: 220px; }
.agreement .sig-pending { color: var(--muted); font-style: italic; font-size: .875rem; }
.agreement .sig-typed { font-family: "Great Vibes", cursive; font-size: 1.9rem; color: #10325a; }

/* Signature pad */
.sig-tabs { display: flex; gap: 4px; margin-bottom: 10px; }
.sig-tabs button { font-family: var(--head); font-size: .875rem; padding: 7px 14px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface); color: var(--ink-soft); cursor: pointer; }
.sig-tabs button[aria-selected=true] { background: var(--ink); border-color: var(--ink); color: #fff; }
.sig-box { position: relative; border: 2px dashed #9fb3c6; border-radius: var(--radius); background: #fbfdff; }
.sig-box canvas { display: block; width: 100%; height: 160px; touch-action: none; cursor: crosshair; }
.sig-box .baseline { position: absolute; left: 24px; right: 24px; bottom: 40px; border-bottom: 1px solid #9fb3c6; pointer-events: none; }
.sig-box .x { position: absolute; left: 10px; bottom: 42px; color: #9fb3c6; font-size: 1.1rem; pointer-events: none; }
.sig-box .placeholder { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: #8a9aab; font-size: .9rem; pointer-events: none; }
.sig-typed-preview { font-family: "Great Vibes", cursive; }

.sign-panel { margin-top: 24px; }
.inline-form { display: inline; }
.stack > * + * { margin-top: 12px; }
.link-copy { display: flex; gap: 8px; }
.link-copy input { font-size: .8125rem; }
.schedule-row { display: grid; grid-template-columns: 1fr 1fr auto; gap: 10px; align-items: end; margin-bottom: 10px; }
.preview { background: #f7f9fb; border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; font-size: .9rem; }
.preview table { width: 100%; border-collapse: collapse; }
.preview td { padding: 3px 0; }
details.more summary { cursor: pointer; font-family: var(--head); font-size: .9rem; color: var(--blue-deep); }
details.more[open] summary { margin-bottom: 12px; }
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.filters select, .filters input { width: auto; min-width: 200px; }
.sig-preview-img { max-height: 70px; background: #fff; border: 1px solid var(--line); padding: 6px; border-radius: var(--radius); }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
@media print { .topbar, .actions, .btn { display: none !important; } body { background: #fff; } .panel { border: 0; } }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
