:root {
  color-scheme: light;
  --bg: #f6f7f9;
  --ink: #17202a;
  --muted: #667085;
  --line: #d8dee8;
  --panel: #ffffff;
  --accent: #0f766e;
  --accent-dark: #0b5f59;
  --danger: #b42318;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--ink);
}

a { color: var(--accent-dark); text-decoration: none; }
h1, h2, p { margin-top: 0; }

.topbar {
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  background: #101828;
  color: #fff;
}
.topbar a { color: #fff; }
.brand-lockup {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  min-height: 40px;
  color: #fff;
}
.brand-logo {
  display: block;
  object-fit: contain;
  flex: 0 0 auto;
}
.brand-logo-wpg {
  width: 74px;
  height: 36px;
}
.brand-divider {
  width: 1px;
  height: 32px;
  background: rgba(255,255,255,.28);
}
.brand-logo-salus {
  width: 132px;
  height: 38px;
}
.topbar-right {
  display: flex;
  align-items: center;
  gap: 18px;
  min-width: 0;
}
.topbar-customer {
  max-width: min(46vw, 460px);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #fff;
  font-weight: 750;
  text-align: right;
}
.topbar-nav { display: flex; gap: 18px; align-items: center; color: #d0d5dd; }

.shell { max-width: 1180px; margin: 0 auto; padding: 32px 20px; }
.page-head { display: flex; justify-content: space-between; align-items: center; gap: 20px; margin-bottom: 22px; }
.page-head p { color: var(--muted); margin-bottom: 0; }

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 22px;
  margin-bottom: 22px;
}
.auth { max-width: 440px; margin: 48px auto; }

.form { display: grid; gap: 16px; }
.form.grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form .wide { grid-column: 1 / -1; }
label { display: grid; gap: 7px; color: #344054; font-weight: 650; }
input, select, textarea {
  width: 100%;
  min-height: 44px;
  border: 1px solid #cbd5e1;
  border-radius: 7px;
  padding: 10px 12px;
  font: inherit;
  background: #fff;
  color: var(--ink);
}
textarea { min-height: 92px; resize: vertical; }

button, .button {
  border: 0;
  border-radius: 7px;
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-weight: 750;
  min-height: 42px;
  padding: 10px 15px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
button:hover, .button:hover { background: var(--accent-dark); }
.ghost { background: #eef4f3; color: var(--accent-dark); }
.ghost:hover { background: #dcebea; }
.actions { grid-column: 1 / -1; }
.button-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.stack { display: grid; gap: 14px; }

.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 13px 10px; border-bottom: 1px solid var(--line); text-align: left; }
.table th { color: #475467; font-size: 13px; text-transform: uppercase; }
.empty { color: var(--muted); text-align: center; }
.status { border: 1px solid var(--line); border-radius: 999px; padding: 4px 9px; font-size: 13px; }
.flash { border: 1px solid #fedf89; background: #fffaeb; border-radius: 8px; padding: 10px 14px; margin-bottom: 18px; }
.flash p { margin: 0; color: #7a4d00; }
.hash { overflow-wrap: anywhere; color: var(--muted); font-size: 13px; }

.viewer {
  height: min(72vh, 820px);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
  margin-bottom: 22px;
}
.viewer iframe { width: 100%; height: 100%; border: 0; }
.signing-panel h2 { margin-bottom: 18px; }
.sign-step {
  display: grid;
  grid-template-columns: 42px 1fr;
  gap: 16px;
  padding: 18px 0;
  border-top: 1px solid var(--line);
}
.sign-step:first-of-type { border-top: 0; padding-top: 0; }
.step-number {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #e8eef3;
  color: #344054;
  font-weight: 800;
}
.sign-step.done .step-number {
  background: #16a34a;
  color: #fff;
}
.step-body h3 {
  margin: 0 0 8px;
  font-size: 18px;
}
.step-body p { color: var(--muted); margin-bottom: 14px; }
.inline-form { margin-top: 12px; }
.success-state {
  display: grid;
  gap: 4px;
  border: 1px solid #86efac;
  background: #ecfdf3;
  color: #166534;
  border-radius: 8px;
  padding: 12px 14px;
  margin-bottom: 12px;
}
.success-state span { color: #166534; line-height: 1.45; }
.required-box {
  display: grid;
  gap: 12px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 14px;
  background: #f8fafc;
}
.check {
  grid-template-columns: auto 1fr;
  align-items: start;
  font-weight: 650;
}
.check input { width: 20px; min-height: 20px; margin-top: 2px; }
.otp-field input {
  max-width: 220px;
  font-size: 22px;
  font-weight: 750;
  letter-spacing: 2px;
  text-align: center;
}

@media (max-width: 820px) {
  .topbar { padding: 0 16px; }
  .brand-lockup { gap: 10px; }
  .brand-logo-wpg { width: 58px; height: 30px; }
  .brand-logo-salus { width: 104px; height: 32px; }
  .brand-divider { height: 26px; }
  .topbar-right { gap: 10px; }
  .topbar-customer { max-width: 36vw; font-size: 13px; }
  .shell { padding: 22px 14px; }
  .page-head { align-items: flex-start; flex-direction: column; }
  .form.grid { grid-template-columns: 1fr; }
  .table { display: block; overflow-x: auto; }
  .sign-step { grid-template-columns: 34px 1fr; gap: 12px; }
  .otp-field input { max-width: 100%; }
}
