/* =======================================================
   REGISTER + PRIVACY pages. Builds on style.css tokens.
======================================================== */

:root {
  --wa-green: #0F7A43;
  --wa-green-dark: #0B6236;
  --danger: #B3261E;
  --danger-pale: #FDF0EF;
  --ok: #0F7A43;
  --ok-pale: #EAF6EF;
  --warn-pale: #FFF7E5;
  --warn-border: #E9D79E;
  --tap: 44px;
}

html { scroll-behavior: auto; }
body { padding-bottom: 0; }

.reg-page header { border-bottom-color: var(--border); }

.skip-link {
  position: absolute;
  left: -999px;
  top: 8px;
  z-index: 100;
  background: var(--ink);
  color: #fff;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
}
.skip-link:focus { left: 8px; }

/* Visible focus on every interactive element */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
summary:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
  outline: 3px solid #2B6CB0;
  outline-offset: 2px;
}

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ---------- Page head ---------- */

.reg-hero {
  padding: 36px 0 20px;
  text-align: center;
}
.reg-hero h1 {
  font-size: clamp(1.9rem, 6vw, 2.8rem);
  margin: 10px 0 12px;
}
.reg-hero p.lead {
  max-width: 560px;
  margin: 0 auto;
  color: var(--ink-soft);
  font-size: 1.02rem;
}

.reg-wrap {
  max-width: 760px;
  margin: 0 auto;
  padding: 0 16px 72px;
}

.demo-banner {
  background: var(--warn-pale);
  border: 1px solid var(--warn-border);
  color: #5B4A12;
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 0.88rem;
  margin-bottom: 16px;
}

/* ---------- Step indicator ---------- */

.stepper {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin: 0 0 18px;
  padding: 0;
  counter-reset: s;
}
.stepper li {
  position: relative;
  text-align: center;
  font-size: 0.78rem;
  line-height: 1.25;
  color: var(--grey);
  padding-top: 38px;
  font-weight: 500;
}
.stepper li::before {
  counter-increment: s;
  content: counter(s);
  position: absolute;
  top: 0; left: 50%;
  transform: translateX(-50%);
  width: 30px; height: 30px;
  border-radius: 50%;
  display: grid; place-items: center;
  background: var(--paper);
  border: 2px solid var(--border-strong);
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--grey);
}
.stepper li::after {
  content: "";
  position: absolute;
  top: 14px; left: calc(50% + 20px);
  width: calc(100% - 40px + 6px);
  height: 2px;
  background: var(--border-strong);
}
.stepper li:last-child::after { display: none; }
.stepper li.is-done { color: var(--ink-soft); }
.stepper li.is-done::before {
  content: "\2713";
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
}
.stepper li.is-done::after { background: var(--ink); }
.stepper li.is-current { color: var(--ink); font-weight: 700; }
.stepper li.is-current::before {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
  box-shadow: 0 0 0 4px rgba(26, 29, 31, 0.12);
}

/* ---------- Cards / panels ---------- */

.panel {
  background: var(--paper);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 22px 18px;
  box-shadow: 0 14px 30px -26px rgba(20, 23, 26, 0.5);
}
@media (min-width: 640px) {
  .panel { padding: 32px 36px; }
}
.panel h2 {
  font-size: 1.45rem;
  margin-bottom: 6px;
}
.panel .sub {
  color: var(--grey);
  font-size: 0.95rem;
  margin-bottom: 20px;
}
.panel h2:focus { outline: none; }

[hidden] { display: none !important; }

/* ---------- Role cards ---------- */

.role-cards {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}
@media (min-width: 560px) {
  .role-cards { grid-template-columns: 1fr 1fr; }
}
.role-card {
  text-align: left;
  font: inherit;
  color: inherit;
  background: var(--paper);
  border: 2px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 20px 18px;
  min-height: 112px;
  cursor: pointer;
  transition: border-color 160ms, box-shadow 160ms, background 160ms;
}
.role-card:hover { border-color: var(--ink); box-shadow: 0 10px 22px -18px rgba(0,0,0,.6); }
.role-card .rc-icon { font-size: 1.7rem; line-height: 1; display: block; margin-bottom: 8px; }
.role-card .rc-title { display: block; font-family: var(--display); font-size: 1.25rem; font-weight: 700; }
.role-card .rc-desc { display: block; color: var(--grey); font-size: 0.9rem; margin-top: 4px; }

.role-chip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  margin-bottom: 18px;
  padding: 10px 14px;
  background: var(--brand-pale);
  border: 1px solid var(--brand-pale-border);
  border-radius: var(--radius-sm);
  font-size: 0.92rem;
}
.role-chip strong { font-weight: 700; }

/* ---------- Links styled as buttons ---------- */

.link-btn {
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
  min-height: var(--tap);
  display: inline-flex;
  align-items: center;
}
.link-btn:hover { color: var(--brand-2); }
.link-btn[disabled] { color: var(--grey); text-decoration: none; cursor: not-allowed; }

.text-link { text-decoration: underline; text-underline-offset: 3px; }

/* ---------- Form fields ---------- */

.field { margin-bottom: 18px; position: relative; }
.field > label,
.field > .label,
fieldset.field > legend {
  display: block;
  font-weight: 600;
  font-size: 0.93rem;
  margin-bottom: 6px;
  padding: 0;
}
fieldset.field { border: 0; padding: 0; margin: 0 0 18px; min-width: 0; }
.field .req { color: var(--danger); margin-left: 2px; }
.field .opt { color: var(--grey); font-weight: 400; }
.field .hint { color: var(--grey); font-size: 0.85rem; margin-top: 6px; }

.input,
.select {
  width: 100%;
  min-height: 48px;
  padding: 11px 14px;
  font: inherit;
  font-size: 1rem; /* 16px stops iOS zoom */
  color: var(--ink);
  background: var(--paper);
  border: 1.5px solid var(--border-strong);
  border-radius: var(--radius-sm);
}
.input::placeholder { color: var(--grey); }
.input:hover, .select:hover { border-color: var(--grey); }
.input[aria-invalid="true"], .select[aria-invalid="true"] { border-color: var(--danger); }
.input[readonly], .input:disabled { background: var(--bg); color: var(--ink-soft); cursor: not-allowed; }

.error-text {
  color: var(--danger);
  font-size: 0.86rem;
  margin-top: 6px;
  font-weight: 500;
}
.error-text:empty { display: none; }

.note {
  margin-top: 8px;
  padding: 10px 14px;
  font-size: 0.9rem;
  border-radius: var(--radius-sm);
  background: var(--warn-pale);
  border: 1px solid var(--warn-border);
  color: #5B4A12;
}
.note.info { background: var(--brand-pale); border-color: var(--brand-pale-border); color: var(--ink-soft); }
.note.ok { background: var(--ok-pale); border-color: #BFE3CE; color: #0B5A31; }

.banner-error {
  background: var(--danger-pale);
  border: 1px solid #F0B8B4;
  color: #7A1913;
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  margin-bottom: 16px;
  font-size: 0.93rem;
  font-weight: 500;
}
.banner-error:empty { display: none; }

/* phone input with +91 */
.phone-wrap { display: flex; }
.phone-prefix {
  display: grid; place-items: center;
  padding: 0 14px;
  min-height: 48px;
  background: var(--brand-pale);
  border: 1.5px solid var(--border-strong);
  border-right: 0;
  border-radius: var(--radius-sm) 0 0 var(--radius-sm);
  font-weight: 600;
  color: var(--ink-soft);
}
.phone-wrap .input { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }

/* ---------- Combobox ---------- */

.combo { position: relative; }
.combo .input { padding-right: 44px; text-overflow: ellipsis; }
.combo::after {
  content: "";
  position: absolute;
  right: 16px; top: 21px;
  width: 8px; height: 8px;
  border-right: 2px solid var(--grey);
  border-bottom: 2px solid var(--grey);
  transform: rotate(45deg);
  pointer-events: none;
}
.combo.is-locked::after, .combo.is-disabled::after { opacity: 0.35; }
.combo.is-loading::after {
  width: 16px; height: 16px;
  border: 2px solid var(--border-strong);
  border-top-color: var(--ink);
  border-radius: 50%;
  top: 16px; right: 14px;
  transform: none;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.combo-list {
  position: absolute;
  z-index: 30;
  left: 0; right: 0;
  top: calc(100% + 4px);
  margin: 0;
  padding: 4px;
  list-style: none;
  max-height: min(300px, 46vh);
  overflow-y: auto;
  background: var(--paper);
  border: 1.5px solid var(--ink);
  border-radius: var(--radius-sm);
  box-shadow: 0 18px 36px -16px rgba(0, 0, 0, 0.4);
  overscroll-behavior: contain;
}
.combo-opt {
  padding: 11px 12px;
  min-height: var(--tap);
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.97rem;
  line-height: 1.35;
  word-break: break-word;
}
.combo-opt .code { color: var(--grey); font-size: 0.85em; }
.combo-opt[aria-selected="true"] { font-weight: 700; }
.combo-opt.is-active { background: var(--brand-pale); outline: 2px solid var(--ink); outline-offset: -2px; }
.combo-opt[aria-disabled="true"] { color: var(--grey); cursor: not-allowed; }
.combo-opt .opt-flag { display: block; font-size: 0.8rem; font-weight: 600; color: var(--danger); margin-top: 2px; }
.combo-msg {
  padding: 12px;
  color: var(--grey);
  font-size: 0.9rem;
  cursor: default;
}

.field-status { margin-top: 6px; font-size: 0.86rem; color: var(--grey); }
.field-status.is-error { color: var(--danger); font-weight: 500; }

/* ---------- Chips ---------- */

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { position: relative; }
.chip input {
  position: absolute;
  inset: 0;
  opacity: 0;
  margin: 0;
  cursor: pointer;
  width: 100%; height: 100%;
}
.chip span {
  display: inline-flex;
  align-items: center;
  min-height: var(--tap);
  padding: 8px 16px;
  border: 1.5px solid var(--border-strong);
  border-radius: var(--radius-pill);
  background: var(--paper);
  font-size: 0.93rem;
  font-weight: 500;
  user-select: none;
}
.chip.small span { min-width: var(--tap); justify-content: center; padding: 8px 12px; }
.chip input:hover + span { border-color: var(--grey); }
.chip input:checked + span {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
}
.chip input:checked + span::before { content: "\2713"; margin-right: 6px; font-weight: 700; }
.chip.small input:checked + span::before { content: none; margin: 0; }
.chip input:focus-visible + span { outline: 3px solid #2B6CB0; outline-offset: 2px; }

/* ---------- Consent ---------- */

.consent {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  min-height: var(--tap);
  padding: 4px 0;
}
.consent input {
  width: 24px; height: 24px;
  flex: 0 0 24px;
  margin: 10px 0 0;
  accent-color: var(--ink);
}
.consent label { font-size: 0.95rem; padding: 10px 0; }

/* ---------- Action rows ---------- */

.actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 16px;
  margin-top: 24px;
}
.actions .btn { min-height: 50px; white-space: normal; text-align: center; }
.actions .btn[disabled] { opacity: 0.55; cursor: not-allowed; }
@media (max-width: 479px) {
  .actions .btn-primary { width: 100%; }
}

.btn-wa {
  background: var(--wa-green);
  color: #fff;
  font-size: 1.1rem;
  padding: 18px 30px;
  min-height: 60px;
  width: 100%;
  box-shadow: 0 12px 24px -14px rgba(15, 122, 67, 0.8);
}
.btn-wa:hover { background: var(--wa-green-dark); }

/* ---------- Verify step ---------- */

.code-input {
  font-family: var(--mono);
  font-size: 1.7rem;
  letter-spacing: 0.5em;
  text-align: center;
  max-width: 300px;
  padding-left: 0.5em;
}
.sent-to {
  font-weight: 600;
  font-size: 1.02rem;
  margin-bottom: 14px;
}

/* ---------- Slip ---------- */

.status-head { display: flex; gap: 12px; align-items: flex-start; margin-bottom: 18px; }
.status-icon {
  flex: 0 0 40px; width: 40px; height: 40px;
  border-radius: 50%;
  display: grid; place-items: center;
  font-weight: 700; font-size: 1.2rem;
  background: var(--ok); color: #fff;
}
.status-icon.pending { background: #B7791F; }

.slip {
  border: 2px solid var(--ink);
  border-radius: var(--radius);
  background: var(--paper);
  overflow: hidden;
}
.slip-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 2px solid var(--ink);
  background: var(--brand-pale);
}
.slip-head img { height: 30px; width: auto; }
.slip-head .slip-title { font-weight: 700; font-size: 0.95rem; line-height: 1.25; }
.slip-head .slip-title small { display: block; font-weight: 500; color: var(--grey); font-size: 0.78rem; }
.slip-id { padding: 18px 18px 6px; }
.slip-id .lbl {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--grey);
}
.slip-id .tdx {
  font-family: var(--mono);
  font-weight: 500;
  font-size: clamp(1.45rem, 7.4vw, 2.4rem);
  letter-spacing: 0.02em;
  line-height: 1.2;
  word-break: break-all;
}
.slip dl { margin: 0; padding: 8px 18px 18px; }
.slip dl > div {
  display: grid;
  grid-template-columns: minmax(96px, 36%) 1fr;
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1px dashed var(--border-strong);
}
.slip dl > div:last-child { border-bottom: 0; }
.slip dt { color: var(--grey); font-size: 0.88rem; }
.slip dd { margin: 0; font-weight: 600; word-break: break-word; }
.slip-foot {
  padding: 10px 18px;
  font-size: 0.78rem;
  color: var(--grey);
  border-top: 1px solid var(--border);
  background: var(--bg);
}

.next-steps { margin-top: 22px; }
.next-steps p { color: var(--ink-soft); margin-top: 12px; font-size: 0.97rem; }

/* ---------- Unavailable ---------- */

.unavailable { text-align: center; padding: 36px 8px; }
.unavailable h2 { margin-bottom: 8px; }
.unavailable p { color: var(--ink-soft); margin-bottom: 18px; }

/* ---------- Loading skeleton ---------- */

.loading-line {
  height: 16px; border-radius: 6px; margin: 14px 0;
  background: linear-gradient(90deg, var(--brand-pale) 25%, #fafaf9 50%, var(--brand-pale) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.2s infinite linear;
}
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---------- Privacy page ---------- */

.doc { max-width: 760px; margin: 0 auto; padding: 40px 16px 72px; }
.doc h1 { font-size: clamp(1.9rem, 6vw, 2.6rem); margin-bottom: 8px; }
.doc .updated { color: var(--grey); font-family: var(--mono); font-size: 0.82rem; margin-bottom: 28px; }
.doc h2 { font-size: 1.35rem; margin: 34px 0 10px; }
.doc p, .doc li { color: var(--ink-soft); }
.doc ul { padding-left: 22px; margin: 8px 0; }
.doc li { margin: 6px 0; }
.doc p + p { margin-top: 10px; }
.doc a { text-decoration: underline; text-underline-offset: 3px; }
.doc .summary {
  background: var(--paper);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 18px 20px;
  margin: 18px 0 8px;
}

footer { padding-bottom: 56px; }
@media (max-width: 780px) { footer { padding-bottom: 56px; } }

/* ---------- Small phones ---------- */

@media (max-width: 400px) {
  .stepper li { font-size: 0.7rem; }
  .navbar { gap: 8px; }
  .brand-name { font-size: 0.98rem; }
}

@media (prefers-reduced-motion: reduce) {
  .combo.is-loading::after, .loading-line { animation: none; }
}

/* ---------- Print: only the slip ---------- */

@media print {
  body * { visibility: hidden !important; }
  #slip, #slip * { visibility: visible !important; }
  #slip {
    position: absolute;
    left: 0; top: 0;
    width: 100%;
    border-width: 2px;
  }
  .slip { box-shadow: none; }
  .slip-head, .slip-foot { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
