/*
 * Oriel design system - values taken from UI GUIDELINES/UI System.jpg.
 * Mobile first: the flow is laid out as a single column with a sticky action
 * bar, and the help rail only appears from 900px up, as in the desktop frames.
 */
:root {
  /* primary - Oriel teal */
  --teal-50: #d9f0ed;
  --teal-100: #bfe6e1;
  --teal-200: #9dd9d2;
  --teal-300: #6ec2b9; /* primary: buttons, links, highlights */
  --teal-400: #55a79e;
  --teal-500: #41746e; /* body text, headings */
  --teal-600: #34554f;
  --teal-700: #22312e;

  --teal-surface: #f0faf9; /* card fills, chip backgrounds */
  --border-default: #e5ede9; /* card borders, dividers */
  --border-accent: #c8e8e4; /* selected state borders */
  --input-border: #d6e8e5;
  --placeholder: #aeccc8;
  --page-bg: #f7fbfa;
  --white: #ffffff;
  --navy: #1a1a2e;

  /* accent and semantic */
  --amber: #fed478;
  --amber-surface: #fffbef;
  --sky: #9dd8e8;
  --sky-surface: #e6f4fb;
  --error: #e05252;
  --error-surface: #fef2f2;

  --radius-pill: 999px;
  --radius-lg: 16px;
  --radius: 12px;
  --radius-sm: 8px;

  --shadow-card: 0 1px 2px rgba(65, 116, 110, 0.04), 0 6px 20px rgba(65, 116, 110, 0.05);
  --font: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;

  --bar-height: 88px;
}

* {
  box-sizing: border-box;
}

/*
 * The hidden attribute is only a presentation hint, so any display rule below
 * would override it - which silently showed the verification overlay, the
 * review banner and the back button on every screen.
 */
[hidden] {
  display: none !important;
}

body {
  margin: 0;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.6;
  color: var(--teal-500);
  background: var(--page-bg);
  -webkit-font-smoothing: antialiased;
}

/* type scale: 16px base, 1.25 ratio */
h1 {
  font-size: 24px;
  font-weight: 700;
  line-height: 1.2;
  color: var(--teal-500);
  margin: 0;
}

h2 {
  font-size: 20px;
  font-weight: 700;
  line-height: 1.25;
  color: var(--teal-500);
  margin: 0;
}

h3 {
  font-size: 16px;
  font-weight: 600;
  line-height: 1.4;
  color: var(--teal-500);
  margin: 0;
}

p {
  margin: 0;
}

a {
  color: var(--teal-400);
}

.display {
  font-size: 28px;
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.01em;
  color: var(--teal-500);
  margin: 0;
}

.eyebrow {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--placeholder);
}

.muted {
  color: var(--teal-400);
}

/* --------------------------------------------------------------- app bar */

.appbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--white);
  border-bottom: 1px solid var(--border-default);
}

.appbar-row {
  max-width: 1120px;
  margin: 0 auto;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.icon-button {
  flex: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 0;
  background: var(--teal-surface);
  color: var(--teal-500);
  font-size: 16px;
  cursor: pointer;
  display: grid;
  place-items: center;
}

.icon-button:hover {
  background: var(--teal-50);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 20px;
  font-weight: 700;
  color: var(--teal-500);
  letter-spacing: -0.01em;
}

.brand-mark {
  display: inline-flex;
  gap: 2px;
  align-items: flex-end;
  height: 20px;
}

.brand-mark i {
  display: block;
  width: 4px;
  border-radius: 2px;
}

.brand-mark i:nth-child(1) {
  height: 12px;
  background: var(--teal-300);
}

.brand-mark i:nth-child(2) {
  height: 18px;
  background: var(--sky);
}

.brand-mark i:nth-child(3) {
  height: 15px;
  background: var(--amber);
}

.appbar-spacer {
  flex: 1;
}

.link-button {
  background: none;
  border: 0;
  font: inherit;
  font-size: 13px;
  color: var(--teal-300);
  cursor: pointer;
  padding: 0;
}

.link-button:hover {
  text-decoration: underline;
}

/* progress */
.progress-row {
  max-width: 1120px;
  margin: 0 auto;
  padding: 10px 16px 12px;
}

.progress-labels {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  margin-bottom: 6px;
}

.progress-percent {
  color: var(--teal-300);
  font-weight: 600;
}

.progress-track {
  height: 6px;
  border-radius: var(--radius-pill);
  background: var(--border-default);
  overflow: hidden;
}

.progress-fill {
  display: block;
  height: 100%;
  width: 0;
  border-radius: var(--radius-pill);
  background: var(--teal-300);
  transition: width 260ms ease;
}

.payee-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--teal-300);
  margin-top: 8px;
}

/* --------------------------------------------------------------- layout */

.flow {
  max-width: 1120px;
  margin: 0 auto;
  padding: 20px 16px calc(var(--bar-height) + 24px);
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
}

.step-head {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 18px;
}

.step-head p {
  color: var(--teal-400);
  max-width: 60ch;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.card {
  background: var(--white);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 20px;
}

.card-title {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--placeholder);
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
}

.card-title .glyph {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  background: var(--teal-surface);
  display: grid;
  place-items: center;
  font-size: 14px;
}

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

.field {
  display: block;
  margin-bottom: 16px;
}

.field:last-child {
  margin-bottom: 0;
}

.field-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--teal-500);
  margin-bottom: 6px;
}

.optional {
  font-weight: 400;
  color: var(--placeholder);
  margin-left: 4px;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  padding: 13px 14px;
  border: 1px solid var(--input-border);
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 14px;
  color: var(--teal-500);
  background: var(--white);
  transition: border-color 140ms ease, box-shadow 140ms ease;
}

.field textarea {
  resize: vertical;
  min-height: 92px;
}

.field input::placeholder {
  color: var(--placeholder);
}

.field input:focus,
.field select:focus {
  outline: none;
  border-color: var(--teal-300);
  box-shadow: 0 0 0 3px rgba(110, 194, 185, 0.22);
}

.field input:disabled,
.field input[readonly] {
  background: var(--teal-surface);
  color: var(--teal-400);
  cursor: default;
}

.field.is-invalid input,
.field.is-invalid select {
  border-color: var(--error);
  background: var(--error-surface);
}

.field-hint {
  display: block;
  margin-top: 6px;
  font-size: 12px;
  color: var(--placeholder);
}

.field-error {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
  font-size: 12px;
  color: var(--error);
}

.locked-wrap {
  position: relative;
}

.locked-wrap .lock {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--placeholder);
  font-size: 13px;
}

.grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
}

.phone-row {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 10px;
}

/* segmented yes/no control */
.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border: 1px solid var(--input-border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--teal-surface);
}

.segmented label {
  position: relative;
  text-align: center;
  padding: 11px 8px;
  font-size: 14px;
  font-weight: 600;
  color: var(--teal-400);
  cursor: pointer;
}

.segmented input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.segmented label:has(input:checked) {
  background: var(--white);
  color: var(--teal-500);
  box-shadow: var(--shadow-card);
  border-radius: var(--radius);
}

/* checkbox rows */
.confirm {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 14px;
  border-radius: var(--radius);
  background: var(--teal-surface);
  border: 1px solid var(--border-accent);
  font-size: 13.5px;
  cursor: pointer;
}

.confirm input,
.declaration input {
  flex: none;
  width: 20px;
  height: 20px;
  margin: 0;
  accent-color: var(--teal-300);
}

.declaration {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 14px 0;
  border-top: 1px solid var(--border-default);
  font-size: 13.5px;
  cursor: pointer;
}

.declaration:first-of-type {
  border-top: 0;
}

.declaration strong {
  color: var(--teal-500);
}

/* --------------------------------------------------------------- choices */

.choice-grid {
  display: grid;
  gap: 14px;
}

.choice {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 18px;
  background: var(--white);
  border: 1.5px solid var(--border-default);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: border-color 140ms ease, background-color 140ms ease;
}

.choice:hover {
  border-color: var(--border-accent);
}

.choice input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.choice-icon {
  flex: none;
  width: 44px;
  height: 44px;
  border-radius: var(--radius);
  background: var(--teal-surface);
  display: grid;
  place-items: center;
  font-size: 18px;
}

.choice-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.choice-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--teal-500);
}

.choice-text {
  font-size: 13.5px;
  color: var(--teal-400);
}

.choice-tick {
  flex: none;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 1.5px solid var(--border-accent);
  display: grid;
  place-items: center;
  color: transparent;
  font-size: 13px;
}

.choice:has(input:checked) {
  border-color: var(--teal-300);
  background: var(--teal-surface);
}

.choice:has(input:checked) .choice-tick {
  background: var(--teal-300);
  border-color: var(--teal-300);
  color: var(--white);
}

.choice input:focus-visible ~ .choice-tick {
  outline: 2px solid var(--teal-400);
  outline-offset: 2px;
}

/* ----------------------------------------------------------------- notes */

.note {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 14px 16px;
  border-radius: var(--radius);
  font-size: 13px;
  line-height: 1.55;
}

.note .note-icon {
  flex: none;
  margin-top: 1px;
}

.note-quiet {
  background: var(--teal-surface);
  border: 1px solid var(--border-default);
  color: var(--teal-400);
}

.note-info {
  background: var(--sky-surface);
  border: 1px solid var(--sky);
  color: #2b6f8d;
}

.note-warning {
  background: var(--amber-surface);
  border: 1px solid var(--amber);
  color: #8a6516;
}

.note-error {
  background: var(--error-surface);
  border: 1px solid #f6c9c9;
  color: var(--error);
}

.form-error {
  margin: 0;
  padding: 12px 14px;
  border-radius: var(--radius);
  background: var(--error-surface);
  border: 1px solid #f6c9c9;
  color: var(--error);
  font-size: 13px;
}

/* --------------------------------------------------------------- buttons */

.button {
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  border-radius: var(--radius-pill);
  padding: 14px 26px;
  cursor: pointer;
  border: 1px solid transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: background-color 140ms ease, border-color 140ms ease, color 140ms ease;
}

.button:focus-visible {
  outline: 2px solid var(--teal-400);
  outline-offset: 2px;
}

.button[disabled] {
  opacity: 0.55;
  cursor: default;
}

.button-primary {
  background: var(--teal-300);
  color: var(--white);
}

.button-primary:hover:not([disabled]) {
  background: var(--teal-400);
}

.button-ghost {
  background: var(--white);
  border-color: var(--input-border);
  color: var(--teal-500);
}

.button-ghost:hover:not([disabled]) {
  border-color: var(--teal-300);
}

.button-quiet {
  background: var(--teal-surface);
  color: var(--teal-500);
  font-size: 14px;
  padding: 11px 18px;
}

.button-block {
  width: 100%;
}

/* sticky action bar */
.actionbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--white);
  border-top: 1px solid var(--border-default);
  padding: 14px 16px calc(14px + env(safe-area-inset-bottom, 0px));
  z-index: 20;
}

.actionbar-row {
  max-width: 1120px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 12px;
}

.actionbar .button-primary {
  flex: 1;
}

/* ------------------------------------------------------------- summaries */

.summary-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
  background: var(--white);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
}

.summary-card .glyph {
  flex: none;
  width: 40px;
  height: 40px;
  border-radius: var(--radius);
  background: var(--teal-surface);
  display: grid;
  place-items: center;
  font-size: 17px;
}

.summary-body {
  flex: 1;
  min-width: 0;
}

.summary-body h3 {
  font-size: 15px;
}

.summary-body p {
  font-size: 13px;
  color: var(--teal-400);
  overflow-wrap: anywhere;
}

.pill {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 600;
  padding: 5px 11px;
  border-radius: var(--radius-pill);
}

.pill-complete {
  background: var(--teal-surface);
  color: var(--teal-500);
}

.pill-mandatory {
  background: var(--error-surface);
  color: var(--error);
}

.pill-signed {
  background: var(--teal-surface);
  color: var(--teal-500);
}

/* ---------------------------------------------------------------- upload */

.upload {
  border: 1.5px dashed var(--input-border);
  border-radius: var(--radius);
  padding: 20px;
  background: var(--teal-surface);
  text-align: center;
}

.upload input[type='file'] {
  width: 100%;
  font-size: 13px;
}

.upload-current {
  margin-top: 12px;
  font-size: 13px;
  color: var(--teal-500);
}

/* ------------------------------------------------------------- agreement */

.doc-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.doc-head {
  display: flex;
  gap: 14px;
  align-items: flex-start;
}

.doc-head .glyph {
  flex: none;
  width: 44px;
  height: 44px;
  border-radius: var(--radius);
  background: var(--teal-surface);
  display: grid;
  place-items: center;
  font-size: 18px;
}

.doc-meta {
  font-size: 12.5px;
  color: var(--placeholder);
}

.doc-parties {
  border: 1px solid var(--border-default);
  border-radius: var(--radius);
  overflow: hidden;
}

.doc-party {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  font-size: 13px;
  border-top: 1px solid var(--border-default);
}

.doc-party:first-child {
  border-top: 0;
}

.doc-party strong {
  color: var(--teal-500);
}

.doc-actions {
  display: flex;
  gap: 20px;
  border-top: 1px solid var(--border-default);
  padding-top: 14px;
}

.doc-actions a {
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  color: var(--teal-300);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.agreement-body {
  max-height: 260px;
  overflow-y: auto;
  border: 1px solid var(--border-default);
  border-radius: var(--radius);
  padding: 16px;
  background: var(--teal-surface);
}

.agreement-body h4 {
  margin: 16px 0 4px;
  font-size: 13.5px;
  color: var(--teal-500);
}

.agreement-body h4:first-child {
  margin-top: 0;
}

.agreement-body p {
  font-size: 13px;
  color: var(--teal-400);
}

/* signature */
.sig-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 6px;
}

.sig-signer {
  font-size: 13.5px;
  color: var(--teal-400);
}

.sig-signer strong {
  color: var(--teal-500);
}

.sig-tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border-default);
  margin: 12px 0;
}

.sig-tab {
  background: none;
  border: 0;
  border-bottom: 2px solid transparent;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  color: var(--placeholder);
  padding: 10px 14px;
  cursor: pointer;
}

.sig-tab.is-active {
  color: var(--teal-500);
  border-bottom-color: var(--teal-300);
}

.sig-pad {
  position: relative;
  border: 1px solid var(--border-default);
  border-radius: var(--radius);
  background: var(--teal-surface);
}

.sig-pad canvas {
  display: block;
  width: 100%;
  height: 180px;
  touch-action: none;
  border-radius: var(--radius);
}

.sig-placeholder {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 13px;
  color: var(--placeholder);
  pointer-events: none;
}

.sig-foot {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
  font-size: 13px;
}

.sig-colours {
  display: flex;
  gap: 8px;
  align-items: center;
}

.sig-colour {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  padding: 0;
}

.sig-colour.is-active {
  border-color: var(--teal-200);
  box-shadow: 0 0 0 2px var(--white) inset;
}

.sig-state {
  margin-left: auto;
  color: var(--placeholder);
}

.sig-upload {
  padding: 18px;
  border: 1.5px dashed var(--input-border);
  border-radius: var(--radius);
  background: var(--teal-surface);
}

/* ------------------------------------------- identity verification overlay */

.verify-overlay {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(21, 81, 77, 0.55);
  display: grid;
  place-items: center;
  padding: 16px;
}

.verify-frame {
  width: min(639px, 100%);
  max-height: 92vh;
  background: var(--white);
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 24px 60px rgba(21, 81, 77, 0.3);
}

.verify-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-default);
  font-weight: 600;
  color: var(--teal-500);
}

.verify-frame iframe {
  flex: 1;
  width: 100%;
  min-height: 600px;
  border: 0;
}

.verify-note {
  padding: 12px 18px;
  font-size: 12.5px;
  color: var(--teal-400);
  border-top: 1px solid var(--border-default);
}

/* --------------------------------------------------- intro / outcome pages */

.hero-icon {
  width: 84px;
  height: 84px;
  border-radius: 24px;
  background: var(--teal-surface);
  display: grid;
  place-items: center;
  font-size: 34px;
  margin: 8px auto 20px;
}

.centered {
  text-align: center;
}

.checklist {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.checklist li {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 14px;
  color: var(--teal-500);
}

.checklist .glyph {
  flex: none;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--teal-surface);
  display: grid;
  place-items: center;
  font-size: 15px;
}

.time-note {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  font-size: 13px;
  color: var(--teal-400);
}

.success-mark {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  margin: 12px auto 22px;
  display: grid;
  place-items: center;
  background: linear-gradient(160deg, var(--teal-300), var(--teal-500));
  color: var(--white);
  font-size: 38px;
  box-shadow: 0 0 0 6px var(--white), 0 0 0 8px var(--sky);
}

/* ------------------------------------------------------------ auth screens */

.auth-shell {
  min-height: calc(100vh - 61px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 16px 56px;
}

.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--white);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 28px 24px 24px;
}

.auth-head {
  margin-bottom: 22px;
}

.auth-head p {
  color: var(--teal-400);
  margin-top: 6px;
}

.auth-foot {
  margin-top: 20px;
  text-align: center;
  font-size: 13.5px;
  color: var(--teal-400);
}

.auth-foot button {
  font-weight: 600;
}

/* ------------------------------------------------------------- help rail */

.help-rail {
  display: none;
}

@media (min-width: 900px) {
  body {
    font-size: 15px;
  }

  .display {
    font-size: 32px;
  }

  .flow {
    grid-template-columns: minmax(0, 1fr) 300px;
    gap: 32px;
    padding: 32px 24px 48px;
    align-items: start;
  }

  .grid-2 {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0 18px;
  }

  .grid-2 .field-wide {
    grid-column: 1 / -1;
  }

  .choice-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .help-rail {
    display: flex;
    flex-direction: column;
    gap: 16px;
    position: sticky;
    top: 96px;
  }

  .help-card {
    background: var(--white);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    padding: 18px;
  }

  .help-card h3 {
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
  }

  .help-card p {
    font-size: 13px;
    color: var(--teal-400);
    margin-bottom: 8px;
  }

  .help-card p:last-child {
    margin-bottom: 0;
  }

  .help-card.estimate {
    background: var(--sky-surface);
    border-color: var(--sky);
  }

  .help-card.estimate h3,
  .estimate-value {
    color: #2b6f8d;
  }

  .estimate-value {
    font-size: 26px;
    font-weight: 700;
    line-height: 1.2;
  }

  .estimate-caption {
    font-size: 12.5px;
    color: #2b6f8d;
    opacity: 0.8;
  }

  /* on desktop the actions sit under the step, not pinned to the viewport */
  .actionbar {
    position: static;
    border: 0;
    background: none;
    padding: 20px 0 0;
  }

  .actionbar-row {
    padding: 0;
  }

  .actionbar .button-primary {
    flex: none;
    margin-left: auto;
  }
}
