/* Wave 7: the creator's side, for real.

   Loads after hub.css, wave3-portal.css and the wave 5 and 6 files, so a
   rule here wins over the same selector there. Tokens come from hub.css
   :root and wave5-tokens.css; nothing is redefined. Five parts:

   1. Payout details, one question per screen: the progress dots, the IBAN
      field's tick and refusal, the review card.
   2. Signing that converts: the summary lines, the progress line, the two
      tabs, the two name styles, the consent box.
   3. The tracker: turn chips, the person who has it, the one button, a
      slipped date.
   4. The three celebrations: the sheet, the tick that draws itself, the
      way the page steps back under it.
   5. The hub: the cost line and the notifications row. */

/* ---------- 1. Payout details ---------- */

.portal-bank-progress {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: -4px 0 6px;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink-soft);
}

.portal-bank-dots {
  display: inline-flex;
  gap: 6px;
}

.portal-bank-dots i {
  display: block;
  width: 22px;
  height: 6px;
  border-radius: var(--r-pill);
  background: rgba(12, 65, 41, .14);
  transition: background var(--dur-base) var(--ease-out);
}

.portal-bank-dots i.done {
  background: var(--ink);
}

.portal-bank-dots i.current {
  background: var(--lime);
  box-shadow: inset 0 0 0 1.5px var(--ink);
}

.portal-bank-step h2 {
  margin-top: 0;
}

.portal-bank-intro p:first-child {
  margin-top: 0;
}

/* The IBAN in figures that line up, with the keyboard's capitals. */
.portal-iban-input {
  font-variant-numeric: var(--num);
  font-family: var(--font-num);
  font-weight: 600;
}

.portal-iban-paste {
  margin: -2px 0 8px;
}

/* On blur: the tick and two words, or one sentence that says what is wrong.
   Positive confirmation for a 23-character string typed from a screenshot. */
.iban-status {
  min-height: 1.4em;
  margin: 6px 0 0;
  font-weight: 600;
  transition: color var(--dur-base) var(--ease-out);
}

.iban-status.is-valid {
  color: var(--ok-ink);
}

.iban-status.is-valid::before {
  content: "✓";
  display: inline-block;
  margin-right: 6px;
  font-weight: 700;
}

.iban-status.is-invalid {
  color: var(--bad-ink);
}

.portal-main .input.is-invalid {
  border-color: var(--bad);
}

.portal-main .input.is-valid {
  border-color: var(--ok);
}

@media (prefers-reduced-motion: no-preference) {
  .iban-status.is-valid::before {
    animation: iban-tick var(--dur-slow) var(--ease-pop);
  }

  @keyframes iban-tick {
    0% { transform: scale(.6); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
  }
}

.portal-bank-name {
  font-size: 17px;
}

/* The review: three rows, each with its Edit link on the right. */
.portal-bank-review dd {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.portal-bank-review .table-link {
  flex: 0 0 auto;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}

.portal-bank-back {
  color: var(--ink);
  font-weight: 600;
}

/* ---------- 2. Signing ---------- */

/* Three to five lines, bold values, before any legal text. */
.portal-summary {
  list-style: none;
  margin: 0 0 14px;
  padding: 12px 14px;
  border-radius: var(--r-sm);
  background: rgba(12, 65, 41, .05);
  display: grid;
  gap: 6px;
  font-size: 15px;
  line-height: 1.45;
}

.portal-summary li {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 10px;
  align-items: baseline;
}

.portal-summary li span {
  flex: 0 0 auto;
  color: var(--ink-soft);
  font-size: 13.5px;
  font-weight: 600;
}

.portal-summary li strong {
  color: var(--ink);
}

/* "Section 3 of 9", kept in view under the summary while she reads. */
.portal-contract-progress {
  position: sticky;
  top: 8px;
  z-index: 2;
  width: fit-content;
  margin: 0 auto 8px;
  padding: 6px 14px;
  border-radius: var(--r-pill);
  background: var(--ink);
  color: #fff;
  font-size: 12.5px;
  font-weight: 700;
  box-shadow: var(--shadow-menu);
}

/* Two tabs, the typed one lit. */
.portal-sign-tabs {
  display: flex;
  gap: 6px;
  margin: 0 0 12px;
  padding: 4px;
  border-radius: var(--r-pill);
  background: rgba(12, 65, 41, .06);
}

.portal-sign-tab {
  flex: 1 1 0;
  min-height: 40px;
  border: 0;
  border-radius: var(--r-pill);
  background: transparent;
  color: var(--ink-soft);
  font: inherit;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out);
}

.portal-sign-tab.is-active {
  background: var(--surface-solid);
  color: var(--ink);
  box-shadow: var(--shadow-sm, 0 1px 2px rgba(12, 65, 41, .12));
}

.portal-sign-tab:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

.portal-sign-panel {
  margin-bottom: 14px;
}

/* Her name in the two faces, each a card she picks. */
.portal-sign-styles {
  display: grid;
  gap: 8px;
}

.portal-sign-style {
  position: relative;
  display: flex;
  align-items: center;
  min-height: 72px;
  padding: 10px 14px 10px 44px;
  border: 1.5px solid var(--line-strong, rgba(12, 65, 41, .25));
  border-radius: var(--r-sm);
  background: var(--surface-solid);
  cursor: pointer;
  transition: border-color var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out);
}

.portal-sign-style input {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--ink);
}

.portal-sign-style:has(:checked) {
  border-color: var(--ink);
  box-shadow: 0 0 0 2px var(--lime-glow);
}

.portal-sign-style:has(:focus-visible) {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

.portal-sign-preview {
  display: block;
  color: var(--ink);
  overflow-wrap: anywhere;
}

.portal-sign-preview.is-quicksand {
  font-family: "Quicksand", system-ui, sans-serif;
  font-style: italic;
  font-weight: 600;
  font-size: 26px;
  line-height: 1.2;
}

.portal-sign-preview.is-indarung {
  font-family: "Indarung", "Quicksand", sans-serif;
  font-size: 30px;
  line-height: 1.1;
}

/* One box, directly above the button. The target is the whole row. */
.portal-consent {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin: 4px 0 14px;
  padding: 12px 14px;
  border-radius: var(--r-sm);
  background: rgba(12, 65, 41, .05);
  font-size: 15px;
  line-height: 1.45;
  font-weight: 600;
  color: var(--ink);
  cursor: pointer;
}

.portal-consent input {
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  margin: 1px 0 0;
  accent-color: var(--ink);
}

/* ---------- 3. The tracker ---------- */

/* Rows grow a third line for the person and a fourth for the button; the
   grid in hub.css has two named areas, so this one has four. */
.portal-tracker li {
  grid-template-columns: 22px 1fr;
  grid-template-areas: "dot label" "dot when" "dot who" "dot action";
  padding-bottom: 18px;
}

.portal-tracker .portal-timeline-label {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.portal-tracker-turn {
  font-size: 10.5px;
}

.portal-tracker .portal-timeline-when {
  line-height: 1.5;
}

.portal-tracker-who {
  grid-area: who;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
  font-size: 13.5px;
  color: var(--ink);
}

.portal-tracker-avatar {
  width: 26px;
  height: 26px;
  font-size: 10.5px;
}

.portal-tracker-button {
  grid-area: action;
  justify-self: start;
  margin-top: 8px;
}

/* A date the team moved: the line is the news, in the warning colour. */
.portal-tracker li.is-slipped .portal-timeline-when {
  color: var(--warn-ink);
  font-weight: 600;
}

.portal-tracker li.next {
  color: var(--ink-faint);
}

/* The team's sheet under its tracker. */
.portal-tracker-move {
  margin-top: 4px;
}

/* ---------- 4. The celebrations ---------- */

/* A sheet over the page: the page steps back, the card comes up from the
   home indicator on the iOS curve, the tick draws itself. Opened by the
   controller after the stepper's beat; without it the card simply sits
   first on the page as a card. */
.portal-celebrate {
  position: relative;
  margin: 0 0 16px;
}

.portal-celebrate-card {
  padding: 28px 22px 22px;
  border-radius: var(--r-lg);
  background: var(--surface-solid);
  box-shadow: var(--shadow-sheet);
  text-align: center;
}

.portal-celebrate-card:focus {
  outline: none;
}

.portal-celebrate.is-open {
  position: fixed;
  inset: 0;
  z-index: var(--z-nav);
  margin: 0;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 16px;
  padding-bottom: calc(16px + var(--safe-b));
  background: rgba(12, 65, 41, .38);
}

.portal-celebrate.is-open .portal-celebrate-card {
  width: 100%;
  max-width: 480px;
}

@media (min-width: 761px) {
  .portal-celebrate.is-open {
    align-items: center;
  }
}

body.has-celebration {
  overflow: hidden;
}

.portal-celebrate-title {
  margin: 14px 0 6px;
  font-size: 24px;
  line-height: 1.2;
}

.portal-celebrate-fact {
  margin: 0 0 4px;
  font-size: 16px;
  font-weight: 700;
  color: var(--ink);
}

.portal-celebrate-next {
  margin: 0 0 18px;
  font-size: 14.5px;
  line-height: 1.5;
  color: var(--ink-soft);
  text-wrap: balance;
}

.portal-celebrate-secondary {
  margin-top: 8px;
}

/* The tick: a ring and a mark, each a stroke that draws itself in 600ms.
   Under reduced motion both are simply there. */
.portal-tick {
  width: 72px;
  height: 72px;
  display: block;
  margin: 0 auto;
}

.portal-tick-ring,
.portal-tick-mark {
  fill: none;
  stroke: var(--ink);
  stroke-width: 3.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.portal-tick-ring {
  stroke: var(--lime-deep);
  fill: var(--lime);
}

@media (prefers-reduced-motion: no-preference) {
  .portal-celebrate.is-open {
    animation: celebrate-dim var(--dur-enter) var(--ease-out) both;
  }

  .portal-celebrate.is-open .portal-celebrate-card {
    animation: celebrate-up 380ms var(--ease-sheet) both;
  }

  .portal-celebrate.is-closing .portal-celebrate-card {
    animation: celebrate-down 240ms var(--ease-in) both;
  }

  .portal-celebrate.is-open .portal-tick-ring {
    stroke-dasharray: 183;
    stroke-dashoffset: 183;
    animation: tick-draw 600ms var(--ease-out) 120ms forwards;
  }

  .portal-celebrate.is-open .portal-tick-mark {
    stroke-dasharray: 40;
    stroke-dashoffset: 40;
    animation: tick-draw 600ms var(--ease-out) 420ms forwards;
  }

  @keyframes tick-draw {
    to { stroke-dashoffset: 0; }
  }

  @keyframes celebrate-dim {
    from { background: rgba(12, 65, 41, 0); }
    to { background: rgba(12, 65, 41, .38); }
  }

  @keyframes celebrate-up {
    from { transform: translateY(24px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
  }

  @keyframes celebrate-down {
    from { transform: translateY(0); opacity: 1; }
    to { transform: translateY(24px); opacity: 0; }
  }
}

/* ---------- 5. The hub ---------- */

.whatsapp-cost {
  margin: 10px 0 0;
}

.whatsapp-cost strong {
  color: var(--ink);
}
