/* Web chat UI. Light mode only.
   Bank colours come from config via --brand / --on-brand / --accent / --canvas, set on :root by app.ts.
   Every other colour is derived from those (color-mix), so another bank's pack restyles the whole UI.
   Nothing here names a bank.

   Direction: a bank's own app, not a template. One brand colour used with intent (ink tint, primary
   action, avatars), a cool neutral canvas, hairlines instead of shadows, small key-like controls,
   a disciplined type scale (12 / 13 / 15 / 17 / 22 / 28, plus the amount), and an iMessage-faithful thread. */

:root {
  --brand: #1f2a44;
  --on-brand: #ffffff;
  --accent: #1f2a44;
  --canvas: #f4f5f8;

  /* ink: near-black carrying a trace of the brand hue */
  --ink: color-mix(in oklab, var(--brand) 12%, #0b0c0f);
  --ink-2: color-mix(in oklab, var(--ink) 66%, #ffffff); /* secondary text, AA on white and canvas */
  --ink-3: color-mix(in oklab, var(--ink) 38%, #ffffff); /* chevrons, placeholders: never body copy */
  --hair: color-mix(in oklab, var(--ink) 10%, transparent);
  --hair-2: color-mix(in oklab, var(--ink) 16%, transparent);
  --surface: #ffffff;
  --press: color-mix(in oklab, var(--ink) 5%, #ffffff);
  --fill: color-mix(in oklab, var(--ink) 6%, transparent);
  --fill-2: color-mix(in oklab, var(--ink) 11%, transparent);
  --brand-tint: color-mix(in oklab, var(--brand) 7%, #ffffff);
  --brand-tint-2: color-mix(in oklab, var(--brand) 13%, #ffffff);
  --brand-hover: color-mix(in oklab, var(--brand) 88%, #000000);

  /* system colours, picked for text contrast on white */
  --blue: #007aff;
  --red: #d70015;
  --green: #248a3d;
  --green-fill: #30b552;

  /* messaging */
  --bg: #ffffff;
  --me: #007aff;
  --them: #e9e9eb;
  --bar: rgba(250, 250, 251, 0.86);

  --shadow-edge: 0 0 0 1px color-mix(in oklab, var(--ink) 7%, transparent), 0 1px 2px color-mix(in oklab, var(--ink) 5%, transparent);
  --shadow-card:
    0 0 0 1px color-mix(in oklab, var(--ink) 8%, transparent), 0 1px 2px color-mix(in oklab, var(--ink) 5%, transparent),
    0 12px 28px -16px color-mix(in oklab, var(--brand) 30%, transparent);

  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", system-ui,
    "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-ja: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Yu Gothic UI", "Meiryo",
    system-ui, sans-serif;

  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);
  --ease-drawer: cubic-bezier(0.32, 0.72, 0, 1);

  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
  --nav-h: 92px;

  color-scheme: light; /* always light: the demo has no dark theme */
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  background: var(--canvas);
}

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--canvas);
  color: var(--ink);
  font: 400 17px/1.4 var(--font);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-tap-highlight-color: transparent;
  font-feature-settings: "palt" 0;
}

:lang(ja) {
  font-family: var(--font-ja);
  line-break: strict;
}
/* short display text breaks between phrases (Chromium); long prose and bubbles keep normal Japanese wrapping */
:lang(ja) :is(.title, .lead, .persona-story, .section-foot, .consent, .cc-note, .pay-hint, .pay-note, .sheet-title, .quick-btn, .quick-hints) {
  word-break: auto-phrase;
}

html.in-chat,
html.in-chat body {
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  background: var(--bg);
}

h1,
h2,
h3,
p,
ul,
ol,
dl,
dd {
  margin: 0;
}

button,
input,
textarea {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  touch-action: manipulation;
}
button:disabled {
  cursor: default;
}

:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.icon {
  display: inline-flex;
  width: 20px;
  height: 20px;
  flex: none;
}
.icon svg {
  width: 100%;
  height: 100%;
}
.icon-sm {
  width: 16px;
  height: 16px;
}
.icon-xs {
  width: 13px;
  height: 13px;
}

/* ---------- boot / fatal ---------- */

.boot {
  min-height: 100dvh;
  display: grid;
  place-items: center;
}
.spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid var(--hair-2);
  border-top-color: var(--ink-2);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
.spinner.sm {
  width: 16px;
  height: 16px;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
.fatal {
  max-width: 420px;
  margin: 0 auto;
  padding: calc(var(--safe-t) + 64px) 24px 32px;
  display: grid;
  gap: 12px;
  text-align: center;
  font-size: 15px;
  color: var(--ink-2);
}

/* ---------- buttons: small physical keys, not pills ---------- */

.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  padding: 0 18px;
  border: 0;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.005em;
  transition:
    transform 160ms var(--ease-out),
    background-color 160ms ease,
    box-shadow 160ms ease;
}
.btn:active:not(:disabled) {
  transform: scale(0.97);
}
.btn:disabled {
  opacity: 0.5;
}
.btn-brand {
  background: var(--brand);
  color: var(--on-brand);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.12),
    0 1px 2px color-mix(in oklab, var(--brand) 40%, transparent);
}
.btn-brand:active:not(:disabled) {
  background: var(--brand-hover);
}
.btn-secondary {
  background: var(--surface);
  color: var(--ink);
  box-shadow: inset 0 0 0 1px var(--hair-2);
}
.btn-secondary:active:not(:disabled) {
  background: var(--press);
}
.btn-link {
  background: none;
  color: var(--ink-2);
  font-size: 15px;
  font-weight: 500;
  min-height: 40px;
}
.btn-block {
  width: 100%;
}
.btn-brand .spinner {
  border-color: color-mix(in oklab, var(--on-brand) 35%, transparent);
  border-top-color: var(--on-brand);
}
.btn-lg {
  min-height: 52px;
  font-size: 17px;
  border-radius: 14px;
}
@media (hover: hover) and (pointer: fine) {
  .btn-brand:hover:not(:disabled) {
    background: var(--brand-hover);
  }
  .btn-secondary:hover:not(:disabled) {
    background: var(--press);
  }
  .btn-link:hover {
    color: var(--ink);
  }
}

/* ---------- picker ---------- */

.picker {
  min-height: 100dvh;
  padding: var(--safe-t) var(--safe-r) 0 var(--safe-l);
  background: var(--canvas);
}
.picker-top {
  max-width: 560px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 20px 0;
}
.lockup {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
}
.lockup-logo {
  height: 30px;
  width: auto;
  display: block;
}
.lockup-name {
  font-size: 17px;
  font-weight: 700;
  color: var(--brand);
}

/* language segmented control */
.seg {
  position: relative;
  display: inline-flex;
  padding: 2px;
  border-radius: 9px;
  background: var(--fill);
}
.seg-btn {
  min-width: 44px;
  min-height: 30px;
  border: 0;
  background: transparent;
  padding: 0 11px;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-2);
  transition:
    color 160ms ease,
    background-color 160ms ease;
}
.seg-btn[aria-pressed="true"] {
  background: var(--surface);
  color: var(--ink);
  font-weight: 600;
  box-shadow:
    0 0 0 0.5px color-mix(in oklab, var(--ink) 8%, transparent),
    0 2px 6px color-mix(in oklab, var(--ink) 10%, transparent);
}

.picker-main {
  max-width: 560px;
  margin: 0 auto;
  padding: 0 20px calc(40px + var(--safe-b));
}
.intro {
  padding: 12px 0 4px;
}
.eyebrow {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  line-height: 16px;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--brand);
}
:lang(ja) .eyebrow {
  letter-spacing: 0.04em;
  text-transform: none;
}
.title {
  margin-top: 12px;
  font-size: 28px;
  line-height: 34px;
  font-weight: 700;
  letter-spacing: -0.022em;
  color: var(--ink);
  text-wrap: balance;
}
:lang(ja) .title {
  font-size: 26px;
  line-height: 36px;
  letter-spacing: 0.01em;
}
.lead {
  margin-top: 10px;
  max-width: 34em;
  font-size: 15px;
  line-height: 22px;
  color: var(--ink-2);
  text-wrap: pretty;
}
:lang(ja) .lead {
  font-size: 14.5px;
  line-height: 24px;
  letter-spacing: 0.02em;
}
.flash {
  margin-top: 20px;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--surface);
  box-shadow: var(--shadow-edge);
  font-size: 15px;
  line-height: 21px;
}

.section {
  margin-top: 28px;
}
.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 0 4px 10px;
  text-wrap: balance;
  font-size: 13px;
  line-height: 18px;
  font-weight: 600;
  color: var(--ink-2);
}
.section-count {
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  color: var(--ink-3);
}
.section-foot {
  padding: 12px 4px 0;
  font-size: 13px;
  line-height: 19px;
  color: var(--ink-2);
  text-wrap: pretty;
}

/* grouped surface: one white card, rows split by inset hairlines */
.group {
  list-style: none;
  margin: 0;
  padding: 0;
  border-radius: 16px;
  overflow: hidden;
  background: var(--surface);
  box-shadow: var(--shadow-edge);
}
.group > li {
  position: relative;
}
.group > li + li::before {
  content: "";
  position: absolute;
  top: 0;
  left: var(--inset, 16px);
  right: 0;
  height: 1px;
  background: var(--hair);
  transform: scaleY(0.5);
  transform-origin: top;
  z-index: 1;
}

/* invite field */
.field-group {
  display: grid;
  gap: 8px;
}
.field-group .field-label {
  padding: 0 4px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-2);
}
.field-hint {
  padding: 0 4px;
  font-size: 13px;
  line-height: 18px;
  color: var(--ink-2);
}
.field {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 50px;
  padding: 0 16px;
  border-radius: 14px;
  background: var(--surface);
  box-shadow: var(--shadow-edge);
  cursor: text;
  transition: box-shadow 160ms ease;
}
.field:focus-within {
  box-shadow:
    0 0 0 1px color-mix(in oklab, var(--brand) 55%, transparent),
    0 0 0 4px color-mix(in oklab, var(--brand) 12%, transparent);
}
.field-label {
  flex: none;
  font-size: 15px;
  font-weight: 500;
}
.field-input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  outline: none;
  font-size: 17px; /* ≥16px: Safari won't zoom on focus */
  text-align: left;
}
.field-input::placeholder {
  color: var(--ink-3);
  letter-spacing: 0;
}
.field-group[data-invalid] .field,
.field[data-invalid] {
  box-shadow: 0 0 0 1px color-mix(in oklab, var(--red) 70%, transparent);
}
.field-error {
  padding: 8px 4px 0;
  font-size: 13px;
  line-height: 18px;
  color: var(--red);
}
.field-error:empty {
  display: none;
}

/* ---------- invite gate: one focused step, centred in the upper third ---------- */

.gate {
  display: flex;
  flex-direction: column;
}
.gate .picker-top {
  width: 100%;
}
.gate-main {
  width: 100%;
  max-width: 400px;
  margin: 0 auto;
  padding: clamp(48px, 14dvh, 120px) 24px calc(32px + var(--safe-b));
  display: flex;
  flex-direction: column;
}
.gate-title {
  font-size: 28px;
  line-height: 34px;
  font-weight: 700;
  letter-spacing: -0.022em;
  color: var(--ink);
  text-wrap: balance;
}
:lang(ja) .gate-title {
  font-size: 24px;
  line-height: 34px;
  letter-spacing: 0.01em;
}
.gate-lead {
  margin-top: 10px;
  font-size: 15px;
  line-height: 22px;
  color: var(--ink-2);
  text-wrap: pretty;
}
:lang(ja) .gate-lead {
  font-size: 14.5px;
  line-height: 24px;
  letter-spacing: 0.02em;
}
.gate-field {
  margin-top: 28px;
  display: flex;
  align-items: center;
  min-height: 54px;
  padding: 0 16px;
  border-radius: 14px;
  background: var(--surface);
  box-shadow: var(--shadow-edge);
  transition: box-shadow 160ms ease;
}
.gate-field:focus-within {
  box-shadow:
    0 0 0 1px color-mix(in oklab, var(--brand) 55%, transparent),
    0 0 0 4px color-mix(in oklab, var(--brand) 12%, transparent);
}
.gate-field:has(.gate-input[aria-invalid="true"]) {
  box-shadow: 0 0 0 1px color-mix(in oklab, var(--red) 70%, transparent);
}
.gate-input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  outline: none;
  font-size: 17px; /* ≥16px: Safari won't zoom on focus */
  letter-spacing: 0.01em;
  color: var(--ink);
}
.gate-input::placeholder {
  color: var(--ink-3);
}
.gate-error {
  padding: 8px 4px 0;
  font-size: 13px;
  line-height: 18px;
  color: var(--red);
}
.gate-error:empty {
  display: none;
}
.gate-go {
  margin-top: 16px;
}
.gate-note {
  margin-top: 16px;
  padding: 0 4px;
  font-size: 13px;
  line-height: 19px;
  color: var(--ink-2);
  text-align: center;
  text-wrap: pretty;
}

/* ---------- text the assistant on iMessage / LINE ---------- */
.chans {
  margin-top: 24px;
}
.chan-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.chan-row.is-single {
  grid-template-columns: 1fr;
}
/* Phones: one row per app so the name and number never truncate. */
@media (max-width: 560px) {
  .chan-row {
    grid-template-columns: 1fr;
    gap: 8px;
  }
}
.chan {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 64px;
  padding: 12px 10px 12px 12px;
  border-radius: 16px;
  background: var(--surface);
  box-shadow: var(--shadow-edge);
  color: var(--ink);
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
  transition:
    transform 160ms var(--ease-out),
    background-color 160ms ease;
}
.chan:active {
  transform: scale(0.98);
  background: var(--press);
}
@media (hover: hover) and (pointer: fine) {
  .chan:hover {
    background: var(--press);
  }
}
.chan-logo {
  flex: none;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  box-shadow: 0 1px 2px color-mix(in oklab, var(--ink) 14%, transparent);
}
.chan-text {
  display: grid;
  min-width: 0;
  flex: 1;
}
.chan-title {
  font-size: 15px;
  line-height: 20px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chan-sub {
  font-size: 13px;
  line-height: 18px;
  color: var(--ink-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-variant-numeric: tabular-nums;
}
:lang(ja) .chan-title {
  font-size: 14px;
}
.chan-go {
  flex: none;
  width: 16px;
  height: 16px;
  color: var(--ink-3);
}
.chan-go svg {
  width: 100%;
  height: 100%;
  display: block;
}

/* persona rows */
.personas {
  --inset: 78px;
}
.persona {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  width: 100%;
  padding: 16px 14px 16px 16px;
  border: 0;
  background: transparent;
  text-align: left;
  color: var(--ink);
  transition: background-color 200ms ease;
}
.persona:active {
  background: var(--press);
  transition: none;
}
@media (hover: hover) and (pointer: fine) {
  .persona:hover {
    background: color-mix(in oklab, var(--ink) 2.5%, #ffffff);
  }
}
.persona-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.persona-name {
  font-size: 17px;
  line-height: 22px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
:lang(ja) .persona-name {
  letter-spacing: 0.02em;
}
.persona-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px 8px;
  margin-top: 4px;
  font-size: 13px;
  line-height: 18px;
  color: var(--ink-2);
  font-variant-numeric: tabular-nums;
}
.persona-story {
  margin-top: 6px;
  font-size: 14px;
  line-height: 20px;
  color: var(--ink-2);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-wrap: pretty;
}
:lang(ja) .persona-story {
  font-size: 13.5px;
  line-height: 21px;
}
.persona-chev {
  align-self: center;
  width: 16px;
  height: 16px;
  color: var(--ink-3);
  transition: transform 200ms var(--ease-out);
}
.persona:active .persona-chev {
  transform: translateX(2px);
}
.tag {
  display: inline-flex;
  align-items: center;
  height: 20px;
  padding: 0 7px;
  border-radius: 6px;
  background: var(--brand-tint);
  color: var(--brand);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.01em;
  white-space: nowrap;
}

/* monogram avatar: brand-tinted, one treatment for everyone */
.monogram {
  flex: none;
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--brand-tint);
  color: var(--brand);
  box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--brand) 10%, transparent);
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.02em;
  user-select: none;
}
:lang(ja) .monogram {
  font-size: 15px;
  letter-spacing: 0.04em;
}
/* illustrated avatar: monochrome line art sits on the tinted disc, cropped to the circle like a portrait */
.monogram.has-img {
  overflow: hidden;
  background: var(--brand-tint-2);
}
.monogram-img {
  width: 112%;
  height: 112%;
  margin-top: 8%;
  object-fit: cover;
  display: block;
}
.monogram-lg {
  width: 60px;
  height: 60px;
  font-size: 21px;
}
:lang(ja) .monogram-lg {
  font-size: 19px;
}

/* First paint of the picker: a short lift, transform only. Text is fully opaque from frame one,
   so a paused or throttled animation timeline can never leave the list blank. */
.is-entering .intro,
.is-entering .personas > li {
  animation: lift 320ms var(--ease-out) both;
}
.is-entering .personas > li {
  animation-delay: calc(40ms + var(--i, 0) * 32ms);
}
@keyframes lift {
  from {
    transform: translateY(6px);
  }
}

/* ---------- chat shell ---------- */

.chat {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  margin: 0 auto;
  width: 100%;
  height: var(--vvh, 100dvh);
  transform: translateY(var(--vvt, 0px));
  display: flex;
  flex-direction: column;
  background: var(--bg);
  overflow: hidden;
}

/* Messages-style header: no solid bar. Content scrolls under a white fade; a floating round back button on the
   left; the contact's avatar centred with the name in a small frosted pill overlapping its lower edge. */
.nav {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 5;
  display: grid;
  grid-template-columns: 60px 1fr 60px;
  align-items: start;
  padding: calc(var(--safe-t) + 6px) calc(var(--safe-r) + 14px) 22px calc(var(--safe-l) + 14px);
  background: linear-gradient(to bottom, rgba(255, 255, 255, 0.97) 0%, rgba(255, 255, 255, 0.92) 62%, rgba(255, 255, 255, 0) 100%);
  pointer-events: none;
}
.nav > * {
  pointer-events: auto;
}
.glass {
  background: rgba(255, 255, 255, 0.88);
  -webkit-backdrop-filter: blur(12px) saturate(180%);
  backdrop-filter: blur(12px) saturate(180%);
  box-shadow:
    0 0 0 0.5px rgba(0, 0, 0, 0.06),
    0 2px 6px rgba(0, 0, 0, 0.06),
    0 8px 20px rgba(0, 0, 0, 0.07);
}
.nav-back {
  justify-self: start;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  margin-top: 8px;
  border: 0;
  padding: 0 2px 0 0;
  border-radius: 50%;
  color: #000;
  transition: transform 160ms var(--ease-out);
}
.nav-back .icon {
  width: 22px;
  height: 22px;
}
.nav-back:active {
  transform: scale(0.92);
}
.nav-contact {
  justify-self: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: 100%;
  border: 0;
  padding: 0;
  background: none;
  color: #000;
}
.nav-contact .avatar {
  width: 52px;
  height: 52px;
  font-size: 22px;
  transition: transform 160ms var(--ease-out);
}
.nav-contact:active .avatar,
.nav-contact:active .nav-name {
  transform: scale(0.96);
}
.avatar {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  overflow: hidden;
  background: linear-gradient(180deg, color-mix(in oklab, var(--brand) 72%, #ffffff), var(--brand));
  color: var(--on-brand);
  font-size: 17px;
  font-weight: 500;
  user-select: none;
}
.avatar-xl {
  width: 64px;
  height: 64px;
  font-size: 27px;
}
.avatar-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 6px;
  background: #fff;
}
.nav-name {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 2px;
  max-width: 100%;
  margin-top: -9px;
  padding: 3px 9px 3px 11px;
  border-radius: 999px;
  font-size: 15px;
  line-height: 20px;
  font-weight: 600;
  letter-spacing: -0.01em;
  white-space: nowrap;
  transition: transform 160ms var(--ease-out);
}
.nav-name > span:first-child {
  overflow: hidden;
  text-overflow: ellipsis;
}
.nav-name-chev {
  width: 12px;
  height: 12px;
  color: rgba(60, 60, 67, 0.45);
}

.scroller {
  flex: 1;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding-top: calc(var(--safe-t) + var(--nav-h));
}
.column {
  min-height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 0 calc(var(--safe-r) + 14px) 12px calc(var(--safe-l) + 14px);
}
.thread {
  display: flex;
  flex-direction: column;
}

/* contact card at the top of the conversation, as a messaging app shows a new contact */
.contact-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 16px 24px 0;
  text-align: center;
}
.cc-name {
  margin-top: 10px;
  font-size: 17px;
  line-height: 22px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.cc-sub {
  margin-top: 1px;
  font-size: 13px;
  line-height: 18px;
  color: var(--ink-2);
}
.cc-note {
  max-width: 300px;
  font-size: 12px;
  line-height: 16px;
  color: #8a8a8e;
  text-wrap: balance;
}
.cc-label {
  display: block;
  font-weight: 600;
}

/* ---------- rows + bubbles ---------- */

.stamp {
  margin: 18px 0 8px;
  text-align: center;
  font-size: 12px;
  line-height: 16px;
  color: #8a8a8e;
  font-variant-numeric: tabular-nums;
}
.stamp strong {
  font-weight: 600;
}

.row {
  display: flex;
  flex-direction: column;
  margin-top: 2px;
}
.row.is-first {
  margin-top: 10px;
}
.stamp + .row {
  margin-top: 0;
}
.row-me {
  align-items: flex-end;
}
.row-them {
  align-items: flex-start;
}

.bubble {
  position: relative;
  isolation: isolate;
  max-width: 75%;
  padding: 7px 13px 8px;
  border-radius: 19px;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Hiragino Sans", system-ui, sans-serif;
  font-size: 17px;
  line-height: 22px;
  letter-spacing: -0.022em;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}
:lang(ja) .bubble {
  font-size: 16px;
  line-height: 24px;
  letter-spacing: 0.01em;
}
.bubble.me {
  background: var(--me);
  color: #fff;
}
.bubble.them {
  background: var(--them);
  color: #000;
  white-space: normal;
}
.bubble p + p,
.bubble p + ul,
.bubble p + ol,
.bubble ul + p,
.bubble ol + p {
  margin-top: 6px;
}
.bubble ul,
.bubble ol {
  padding-left: 1.2em;
}
.bubble li + li {
  margin-top: 3px;
}
.bubble li::marker {
  color: color-mix(in oklab, currentColor 55%, transparent);
}
.bubble strong {
  font-weight: 600;
}

/* tail on the last bubble of a group: a coloured hook masked by the page background */
.row.is-last > .bubble:not(.typing)::before,
.row.is-last > .bubble:not(.typing)::after {
  content: "";
  position: absolute;
  bottom: 0;
  height: 18px;
  z-index: -1;
}
.row-me.is-last > .bubble::before {
  right: -7px;
  width: 20px;
  background: var(--me);
  border-bottom-left-radius: 16px 14px;
}
.row-me.is-last > .bubble::after {
  right: -26px;
  width: 26px;
  background: var(--bg);
  border-bottom-left-radius: 10px;
}
.row-them.is-last > .bubble:not(.typing)::before {
  left: -7px;
  width: 20px;
  background: var(--them);
  border-bottom-right-radius: 16px 14px;
}
.row-them.is-last > .bubble:not(.typing)::after {
  left: -26px;
  width: 26px;
  background: var(--bg);
  border-bottom-right-radius: 10px;
}

.delivered {
  margin: 4px 6px 0 0;
  text-align: right;
  font-size: 12px;
  line-height: 16px;
  font-weight: 600;
  color: #8a8a8e;
}
.delivered.is-failed {
  color: var(--red);
}

/* sent photos and files: photos are their own rounded bubbles, files a quiet card, both right-aligned */
.row-media {
  align-items: flex-end;
}
.media {
  position: relative;
  display: block;
  max-width: min(240px, 68%);
  border-radius: 18px;
  overflow: hidden;
  background: var(--fill);
  line-height: 0;
  -webkit-tap-highlight-color: transparent;
  transition:
    opacity 200ms ease,
    transform 160ms var(--ease-out);
}
.media:not(.is-loaded) {
  width: 180px;
  height: 135px;
}
.media img {
  display: block;
  max-width: 100%;
  max-height: 320px;
  width: auto;
  height: auto;
  object-fit: cover;
}
.media::after {
  /* hairline so white photos don't melt into the page */
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow: inset 0 0 0 0.5px rgba(0, 0, 0, 0.08);
  pointer-events: none;
}
.media:active,
.file-bubble:active {
  transform: scale(0.98);
}
.file-bubble {
  display: flex;
  align-items: center;
  gap: 11px;
  width: min(260px, 78%);
  min-height: 62px;
  padding: 10px 14px 10px 11px;
  border-radius: 18px;
  background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--hair-2);
  color: #000;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
  transition:
    opacity 200ms ease,
    transform 160ms var(--ease-out);
}
.row-me.is-sending .media,
.row-me.is-sending .file-bubble {
  opacity: 0.55;
}

/* document glyph with an extension tag, shared by the composer tray and the thread */
.file-ic {
  position: relative;
  flex: none;
  width: 30px;
  height: 38px;
  color: color-mix(in oklab, var(--ink) 22%, transparent);
  --kind: #8e8e93;
}
.file-ic svg {
  display: block;
  width: 100%;
  height: 100%;
}
.file-ic-tag {
  position: absolute;
  left: -3px;
  bottom: 6px;
  min-width: 22px;
  padding: 1px 3px;
  border-radius: 3px;
  background: var(--kind);
  color: #fff;
  font-size: 8px;
  line-height: 10px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-align: center;
}
.kind-pdf { --kind: #e2412f; }
.kind-spreadsheet { --kind: #1d8a4a; }
.kind-presentation { --kind: #e57a00; }
.kind-document { --kind: #2f6fde; }
.kind-image { --kind: #0f9bb5; }
.kind-audio { --kind: #d6336c; }
.kind-video { --kind: #7048e8; }
.kind-text,
.kind-other { --kind: #6e6e73; }
.file-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.file-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 15px;
  line-height: 20px;
  font-weight: 500;
  letter-spacing: -0.01em;
}
.file-meta {
  margin-top: 1px;
  font-size: 12px;
  line-height: 16px;
  color: #8a8a8e;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* system notes and errors: centred, quiet; errors get a tinted plate so they're not missed */
.row-center {
  align-self: center;
  max-width: 88%;
  margin: 14px 0 4px;
  display: inline-flex;
  align-items: flex-start;
  gap: 6px;
  text-align: center;
  font-size: 13px;
  line-height: 18px;
  color: var(--ink-2);
  white-space: pre-line;
  text-wrap: pretty;
}
.row-center.tone-error {
  padding: 8px 12px;
  border-radius: 12px;
  background: color-mix(in oklab, var(--red) 7%, #ffffff);
  color: var(--red);
  text-align: left;
}
.row-center .icon {
  margin-top: 1px;
}

/* new bubbles grow from their own corner */
.pop {
  animation: pop 300ms var(--ease-out) both;
}
.row-me.pop {
  transform-origin: 100% 100%;
}
.row-them.pop {
  transform-origin: 0 100%;
}
@keyframes pop {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.94);
  }
}

/* typing indicator: grey bubble, three dots, two trailing circles */
.row-typing {
  margin-top: 10px;
}
.row-typing[hidden] {
  display: none;
}
.bubble.typing {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 36px;
  padding: 0 14px;
  animation: pop 260ms var(--ease-out) both;
  transform-origin: 0 100%;
}
.bubble.typing i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #8e8e93;
  animation: blink 1.25s infinite ease-in-out;
}
.bubble.typing i:nth-child(2) {
  animation-delay: 0.16s;
}
.bubble.typing i:nth-child(3) {
  animation-delay: 0.32s;
}
.bubble.typing::before,
.bubble.typing::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  background: var(--them);
}
.bubble.typing::before {
  width: 13px;
  height: 13px;
  left: -2px;
  bottom: -2px;
}
.bubble.typing::after {
  width: 6px;
  height: 6px;
  left: -7px;
  bottom: -7px;
}
@keyframes blink {
  0%,
  70%,
  100% {
    opacity: 0.4;
    transform: translateY(0);
  }
  35% {
    opacity: 1;
    transform: translateY(-1.5px);
  }
}
/* the status line ("Looking up the payee…") gets a slow light sweep: live work, not decoration */
.typing-caption {
  margin: 8px 0 0 10px;
  font-size: 12px;
  line-height: 16px;
  color: var(--ink-2);
  background: linear-gradient(90deg, var(--ink-2) 0%, var(--ink-2) 40%, color-mix(in oklab, var(--ink-2) 35%, #ffffff) 50%, var(--ink-2) 60%, var(--ink-2) 100%);
  background-size: 250% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: sweep 1.8s linear infinite;
}
.typing-caption:empty {
  display: none;
}
@keyframes sweep {
  from {
    background-position: 100% 0;
  }
  to {
    background-position: -25% 0;
  }
}

/* suggested first messages */
.quick {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  margin-top: 26px;
}
.quick-head {
  margin: 0 4px 0 0;
  font-size: 11px;
  line-height: 14px;
  font-weight: 600;
  color: var(--ink-2);
}
.quick-btn {
  max-width: 82%;
  padding: 8px 14px;
  border: 0;
  border-radius: 18px;
  background: var(--surface);
  box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--blue) 32%, transparent);
  color: var(--blue);
  font-size: 16px;
  line-height: 21px;
  letter-spacing: -0.01em;
  text-align: left;
  transition:
    transform 160ms var(--ease-out),
    background-color 160ms ease;
}
:lang(ja) .quick-btn {
  font-size: 15px;
  letter-spacing: 0.01em;
}
.quick-btn:active {
  transform: scale(0.97);
  background: color-mix(in oklab, var(--blue) 8%, #ffffff);
}
@media (hover: hover) and (pointer: fine) {
  .quick-btn:hover {
    background: color-mix(in oklab, var(--blue) 5%, #ffffff);
  }
}
.quick-hints {
  max-width: 82%;
  margin-top: 10px;
  padding-right: 4px;
  text-align: right;
  font-size: 12px;
  line-height: 17px;
  color: var(--ink-2);
  text-wrap: pretty;
}
.quick-hints p + p {
  margin-top: 6px;
}
.quick-hints-head {
  margin-bottom: 4px;
  font-size: 11px;
  font-weight: 600;
}

/* ---------- composer ---------- */

.composer {
  position: relative;
  flex: none;
  padding: 6px calc(var(--safe-r) + 14px) calc(var(--safe-b) + 8px) calc(var(--safe-l) + 14px);
  background: linear-gradient(to top, #ffffff 70%, rgba(255, 255, 255, 0));
}
.kb-open .composer {
  padding-bottom: 8px;
}
.composer-row {
  display: flex;
  align-items: flex-end;
  gap: 10px;
}
.plus {
  flex: none;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 50%;
  color: #1c1c1e;
  transition: transform 160ms var(--ease-out);
}
.plus .icon {
  width: 22px;
  height: 22px;
}
.plus:active {
  transform: scale(0.92);
}
.pill {
  position: relative;
  flex: 1;
  min-width: 0;
  display: flex;
  min-height: 40px;
  margin: 0;
  border-radius: 20px;
}
.pill-input {
  flex: 1;
  min-width: 0;
  max-height: 140px;
  padding: 9px 44px 9px 16px;
  border: 0;
  outline: none;
  resize: none;
  background: transparent;
  font-size: 17px; /* ≥16px: Safari won't zoom on focus */
  line-height: 22px;
  letter-spacing: -0.022em;
}
.pill-input::placeholder {
  color: #a1a1a6;
}
.send {
  position: absolute;
  right: 5px;
  bottom: 5px;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--me);
  color: #fff;
  opacity: 0;
  transform: scale(0.6);
  pointer-events: none;
  transition:
    transform 200ms var(--ease-out),
    opacity 140ms ease;
}
.send.is-shown {
  opacity: 1;
  transform: scale(1);
  pointer-events: auto;
}
.send.is-shown:active {
  transform: scale(0.9);
}
.send.is-stop {
  background: #1c1c1e;
}
.send .icon {
  width: 19px;
  height: 19px;
}

/* attachments waiting in the composer: a strip inside the field, above the text, like Messages */
.pill {
  flex-direction: column;
}
.pill-input {
  flex: none;
  width: 100%;
}
.att-tray {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 8px 2px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
}
.att-tray::-webkit-scrollbar {
  display: none;
}
.att-tray[hidden] {
  display: none;
}
.att {
  position: relative;
  flex: none;
  animation: att-in 260ms var(--ease-out) both;
}
@keyframes att-in {
  from {
    opacity: 0;
    transform: scale(0.9);
  }
}
.att-img img {
  display: block;
  height: 84px;
  width: auto;
  min-width: 56px;
  max-width: 150px;
  border-radius: 14px;
  object-fit: cover;
  background: var(--fill);
  box-shadow: inset 0 0 0 0.5px rgba(0, 0, 0, 0.08);
}
.att-file {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 200px;
  height: 64px;
  padding: 0 32px 0 11px;
  border-radius: 14px;
  background: #fff;
  box-shadow: inset 0 0 0 1px var(--hair-2);
}
.att-file .file-name {
  font-size: 14px;
  line-height: 18px;
}
.att-x {
  position: absolute;
  top: 5px;
  right: 5px;
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(28, 28, 30, 0.62);
  color: #fff;
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  transition: transform 140ms var(--ease-out);
}
.att-x::before {
  /* 44px hit area around the small visual */
  content: "";
  position: absolute;
  inset: -11px;
}
.att-x .icon {
  width: 14px;
  height: 14px;
}
.att-x:active {
  transform: scale(0.88);
}
.att-file .att-x {
  top: 50%;
  margin-top: -11px;
  background: rgba(60, 60, 67, 0.32);
}
.att-error {
  margin: 0 4px 6px 50px;
  font-size: 13px;
  line-height: 18px;
  color: var(--red);
}
.att-error[hidden] {
  display: none;
}

/* drag-and-drop target over the whole chat (desktop) */
.chat.is-dropping::after {
  content: attr(data-drop);
  position: fixed;
  inset: 10px;
  z-index: 30;
  display: grid;
  place-items: center;
  border: 2px dashed color-mix(in oklab, var(--me) 60%, transparent);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.86);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  color: var(--me);
  font-size: 17px;
  font-weight: 600;
  pointer-events: none;
}

/* ---------- approval card: a bank document inside the thread ---------- */

.row-card {
  margin-top: 10px;
}
.pay {
  width: min(320px, 86%);
  border-radius: 19px;
  overflow: hidden;
  background: var(--surface);
  box-shadow: var(--shadow-card);
  font-variant-numeric: tabular-nums;
}
.pay-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 48px;
  padding: 12px 16px;
  background: var(--brand-tint);
  border-bottom: 1px solid color-mix(in oklab, var(--brand) 9%, transparent);
}
.pay-logo {
  display: block;
  height: 26px;
  width: auto;
}
.pay-logo-text {
  font-size: 15px;
  font-weight: 700;
  color: var(--brand);
}
.pay-kicker {
  font-size: 12px;
  line-height: 16px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--brand);
  text-align: right;
}
:lang(ja) .pay-kicker {
  letter-spacing: 0.02em;
  text-transform: none;
}
.pay-hero {
  padding: 18px 16px 16px;
}
.pay-title {
  font-size: 13px;
  line-height: 18px;
  font-weight: 500;
  color: var(--ink-2);
}
.pay-amount {
  margin-top: 4px;
  transition: opacity 240ms ease;
}
.pay-amount-main {
  display: flex;
  align-items: baseline;
  font-size: 36px;
  line-height: 42px;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--ink);
}
.pay-cur {
  font-size: 24px;
  font-weight: 600;
  letter-spacing: 0;
}
.pay-cur-pre {
  margin-right: 2px;
}
.pay-cur-post {
  margin-left: 2px;
}
.pay-amount-alt {
  margin-top: 2px;
  font-size: 14px;
  line-height: 18px;
  color: var(--ink-2);
}
.pay[data-status="declined"] .pay-amount,
.pay[data-status="expired"] .pay-amount,
.pay[data-status="failed"] .pay-amount {
  opacity: 0.4;
}
.pay[data-status="declined"] .pay-amount-main > span:not(.pay-cur),
.pay[data-status="expired"] .pay-amount-main > span:not(.pay-cur) {
  text-decoration: line-through;
  text-decoration-thickness: 2px;
}

.pay-lines {
  margin: 0 16px;
  border-top: 1px solid var(--hair);
}
.pay-line {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  padding: 10px 0;
  font-size: 14px;
  line-height: 19px;
}
.pay-line + .pay-line {
  border-top: 1px solid var(--hair);
}
.pay-line dt {
  flex: none;
  color: var(--ink-2);
}
.pay-line dd {
  min-width: 0;
  text-align: right;
  font-weight: 500;
  overflow-wrap: anywhere;
}
.pay-line-sub {
  display: block;
  margin-top: 1px;
  font-size: 12.5px;
  line-height: 17px;
  font-weight: 400;
  color: var(--ink-2);
}
.pay-line.is-total {
  padding: 12px 0;
  border-top: 1px solid var(--hair-2);
  font-size: 15px;
}
.pay-line.is-total dt {
  color: var(--ink);
  font-weight: 600;
}
.pay-line.is-total dd {
  font-weight: 700;
}

.pay-note {
  display: flex;
  gap: 8px;
  margin: 8px 16px 0;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--brand-tint);
  font-size: 12.5px;
  line-height: 18px;
  color: color-mix(in oklab, var(--brand) 70%, var(--ink));
  text-wrap: pretty;
}
.pay-note .icon {
  margin-top: 1px;
  color: var(--brand);
}
.pay-timer {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 12px 16px 0;
  font-size: 12.5px;
  line-height: 16px;
  color: var(--ink-2);
}
.pay-timer[hidden] {
  display: none;
}
.pay-timer.is-low {
  color: var(--red);
}
.pay-actions {
  padding: 14px 16px 16px;
}
.pay-actions:empty {
  display: none;
}
.pay-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.pay-buttons .btn {
  padding: 0 10px;
  white-space: nowrap;
}
.pay-confirm {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.pay-confirm,
.pay-busy {
  animation: swap 220ms var(--ease-out) both;
}
@keyframes swap {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
}
.pay-hint {
  margin-top: 6px;
  font-size: 12.5px;
  line-height: 17px;
  text-align: center;
  color: var(--ink-2);
  text-wrap: balance;
}
.pay-busy {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 46px;
  font-size: 15px;
  color: var(--ink-2);
}

/* hold to confirm: slow, linear fill while the finger decides; fast snap back on release */
.btn-hold {
  overflow: hidden;
  min-height: 52px;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}
.hold-fill {
  position: absolute;
  inset: 0;
  background: color-mix(in oklab, var(--on-brand) 22%, transparent);
  transform-origin: left center;
  transform: scaleX(var(--p, 0));
  transition: transform 220ms var(--ease-out);
}
.btn-hold.is-holding .hold-fill {
  transition: none;
}
.hold-icon,
.hold-label {
  position: relative;
}
.hold-label {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.btn-hold.is-holding {
  transform: scale(0.98);
}
.btn-hold.is-done {
  transform: scale(1);
}
.btn-hold.is-done .hold-fill {
  opacity: 0;
  transition: opacity 200ms ease;
}
.btn-hold.is-done .hold-icon {
  animation: pop-icon 280ms var(--ease-out) both;
}
@keyframes pop-icon {
  from {
    transform: scale(0.6);
    opacity: 0;
  }
}

.pay-result {
  padding: 0 16px 16px;
}
.pay-result:empty {
  display: none;
}
.pay-error {
  padding-top: 10px;
  font-size: 13px;
  line-height: 18px;
  color: var(--red);
}
.pay-receipt {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--hair-2);
}
.pay-receipt.is-new {
  animation: swap 260ms var(--ease-out) both;
}
.pay-receipt-top {
  display: flex;
  align-items: center;
  gap: 10px;
}
.pay-receipt-icon {
  display: inline-flex;
  flex: none;
  width: 24px;
  height: 24px;
}
.pay-receipt-icon svg {
  width: 100%;
  height: 100%;
}
.pay-receipt.is-executed .pay-receipt-icon {
  color: var(--green-fill);
}
.pay-receipt.is-new.is-executed .pay-receipt-icon {
  animation: pop-icon 320ms var(--ease-out) both;
}
.pay-receipt.is-new.is-executed .pay-receipt-icon path {
  stroke-dasharray: 16;
  stroke-dashoffset: 16;
  animation: draw 280ms 140ms var(--ease-out) forwards;
}
@keyframes draw {
  to {
    stroke-dashoffset: 0;
  }
}
.pay-receipt.is-declined .pay-receipt-icon,
.pay-receipt.is-expired .pay-receipt-icon {
  color: var(--ink-3);
}
.pay-receipt.is-failed .pay-receipt-icon {
  color: var(--red);
}
.pay-receipt-label {
  font-size: 15px;
  line-height: 20px;
  font-weight: 600;
}
.pay-receipt.is-executed .pay-receipt-label {
  color: var(--green);
}
.pay-receipt.is-failed .pay-receipt-label {
  color: var(--red);
}
.pay-receipt-text {
  margin-top: 6px;
  font-size: 13.5px;
  line-height: 19px;
  color: var(--ink-2);
  overflow-wrap: anywhere;
  text-wrap: pretty;
}
.pay-ref {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 10px;
  padding: 9px 12px;
  border-radius: 10px;
  background: var(--canvas);
  font-size: 12.5px;
  line-height: 17px;
}
.pay-ref dt {
  color: var(--ink-2);
}
.pay-ref dd {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-weight: 500;
  letter-spacing: 0.02em;
  user-select: all;
  -webkit-user-select: all;
}

/* ---------- sheets ---------- */

dialog.sheet {
  position: fixed;
  inset: auto 0 0 0;
  width: 100%;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  animation: sheet-in 460ms var(--ease-drawer) both;
}
dialog.sheet::backdrop {
  background: color-mix(in oklab, var(--ink) 38%, transparent);
  animation: fade-in 300ms ease both;
}
dialog.sheet.sheet-out {
  animation: sheet-out 240ms cubic-bezier(0.32, 0, 0.67, 0) both;
}
dialog.sheet.sheet-out::backdrop {
  animation: fade-out 240ms ease both;
}
@keyframes sheet-in {
  from {
    transform: translateY(100%);
  }
}
@keyframes sheet-out {
  to {
    transform: translateY(100%);
  }
}
@keyframes fade-in {
  from {
    opacity: 0;
  }
}
@keyframes fade-out {
  to {
    opacity: 0;
  }
}
.sheet-body {
  display: flex;
  flex-direction: column;
  max-height: calc(100dvh - var(--safe-t) - 10px);
  border-radius: 20px 20px 0 0;
  background: var(--canvas);
  box-shadow: 0 -1px 0 rgba(255, 255, 255, 0.6) inset;
}
.sheet-grip {
  flex: none;
  width: 36px;
  height: 5px;
  margin: 7px auto 0;
  border-radius: 3px;
  background: var(--hair-2);
}
.sheet-head {
  flex: none;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 14px 20px 18px;
}
.sheet-head-text {
  flex: 1;
  min-width: 0;
  padding-top: 2px;
}
.sheet-kicker {
  font-size: 12px;
  line-height: 16px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--brand);
}
:lang(ja) .sheet-kicker {
  letter-spacing: 0.03em;
  text-transform: none;
}
.sheet-title {
  margin-top: 3px;
  font-size: 22px;
  line-height: 28px;
  font-weight: 700;
  letter-spacing: -0.02em;
}
:lang(ja) .sheet-title {
  font-size: 21px;
  letter-spacing: 0.02em;
}
.sheet-head .persona-meta {
  margin-top: 6px;
}
.close-btn {
  flex: none;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  margin: -2px -4px 0 0;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--fill);
  color: var(--ink-2);
  transition:
    transform 160ms var(--ease-out),
    background-color 160ms ease;
}
.close-btn:active {
  transform: scale(0.92);
  background: var(--fill-2);
}
.close-btn .icon {
  width: 18px;
  height: 18px;
}
.sheet-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 0 16px 20px;
}
.sheet-things .sheet-scroll {
  padding-bottom: calc(var(--safe-b) + 20px);
}
.sheet-foot {
  position: relative;
  flex: none;
  padding: 14px 16px calc(var(--safe-b) + 12px);
  background: var(--canvas);
}
.sheet-foot::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 1px;
  background: var(--hair);
}
.consent {
  margin-top: 10px;
  text-align: center;
  font-size: 12px;
  line-height: 17px;
  color: var(--ink-2);
  text-wrap: balance;
}
.sheet-label {
  padding: 0 4px 8px;
  font-size: 13px;
  line-height: 18px;
  font-weight: 600;
  color: var(--ink-2);
}
.brief {
  padding: 16px;
  border-radius: 16px;
  background: var(--surface);
  box-shadow: var(--shadow-edge);
}
.brief-role {
  font-size: 15px;
  line-height: 22px;
  font-weight: 500;
  color: var(--ink);
  text-wrap: pretty;
}
.brief-list {
  list-style: none;
  margin: 12px 0 0;
  padding: 12px 0 0;
  border-top: 1px solid var(--hair);
  display: grid;
  gap: 9px;
}
.brief-list li {
  position: relative;
  padding-left: 16px;
  font-size: 14px;
  line-height: 20px;
  color: color-mix(in oklab, var(--ink) 82%, #ffffff);
  text-wrap: pretty;
}
.brief-list li::before {
  content: "";
  position: absolute;
  left: 2px;
  top: 8px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: color-mix(in oklab, var(--brand) 55%, #ffffff);
}
:lang(ja) .brief-role {
  font-size: 14.5px;
  line-height: 24px;
  letter-spacing: 0.02em;
}
:lang(ja) .brief-list li {
  font-size: 13.5px;
  line-height: 22px;
  letter-spacing: 0.02em;
}
:lang(ja) .brief-list li::before {
  top: 9px;
}
.fact {
  font-weight: 600;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.try-btn .cell-title {
  font-size: 15px;
  line-height: 21px;
}
:lang(ja) .try-btn .cell-title {
  font-size: 14.5px;
}
.try .group + .sheet-label {
  margin-top: 20px;
}
.prose.backstory {
  padding: 14px 16px;
  border-radius: 16px;
  background: var(--surface);
  box-shadow: var(--shadow-edge);
  font-size: 15px;
  line-height: 23px;
  text-wrap: pretty;
}
:lang(ja) .prose.backstory {
  font-size: 14.5px;
  line-height: 25px;
  letter-spacing: 0.02em;
}
.prose p + p,
.prose p + ul,
.prose ul + p {
  margin-top: 10px;
}
.prose ul,
.prose ol {
  padding-left: 1.2em;
}
.prose strong {
  font-weight: 600;
}
.try {
  margin-top: 24px;
}
.try-list {
  --inset: 46px;
  counter-reset: try;
}
.try-list li {
  counter-increment: try;
  padding: 12px 16px 12px 46px;
  font-size: 15px;
  line-height: 21px;
  text-wrap: pretty;
}
:lang(ja) .try-list li {
  font-size: 14.5px;
  line-height: 22px;
}
.try-list li::after {
  content: counter(try);
  position: absolute;
  left: 16px;
  top: 12px;
  width: 18px;
  height: 18px;
  margin-top: 1px;
  display: grid;
  place-items: center;
  border-radius: 5px;
  background: var(--brand-tint);
  color: var(--brand);
  font-size: 11px;
  font-weight: 700;
  line-height: 18px;
  font-variant-numeric: tabular-nums;
}
.try-list li.is-hint {
  color: var(--ink-2);
}
.try-list li.is-hint::after {
  background: var(--fill);
  color: var(--ink-2);
}

/* things-to-try sheet (from the chat) */
.try-say {
  --inset: 16px;
}
.cell {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 48px;
  padding: 12px 16px;
  border: 0;
  background: transparent;
  text-align: left;
  color: var(--ink);
  transition: background-color 200ms ease;
}
button.cell:active:not(:disabled) {
  background: var(--press);
  transition: none;
}
.cell-text {
  flex: 1;
  min-width: 0;
}
.cell-title {
  font-size: 16px;
  line-height: 21px;
}
.try-send {
  width: 24px;
  height: 24px;
  color: var(--blue);
}
.sheet-things .sheet-label {
  margin-top: 22px;
}
.cell-static {
  padding: 12px 16px;
  font-size: 14.5px;
  line-height: 21px;
  color: var(--ink-2);
}
.backstory-more {
  margin-top: 22px;
}
.backstory-more summary {
  padding: 0 4px 10px;
  font-size: 15px;
  font-weight: 500;
  color: var(--blue);
  cursor: pointer;
  list-style: none;
}
.backstory-more summary::-webkit-details-marker {
  display: none;
}

/* action sheet */
dialog.sheet-as {
  padding: 0 8px calc(var(--safe-b) + 8px);
}
.as {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 520px;
  margin: 0 auto;
}
.as-group {
  overflow: hidden;
  border-radius: 14px;
  background: rgba(246, 246, 248, 0.94);
  -webkit-backdrop-filter: blur(30px) saturate(180%);
  backdrop-filter: blur(30px) saturate(180%);
}
.as-head {
  padding: 14px 18px;
  text-align: center;
}
.as-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-2);
}
.as-msg {
  margin-top: 3px;
  font-size: 13px;
  line-height: 1.4;
  color: var(--ink-2);
}
.as-btn {
  position: relative;
  display: block;
  width: 100%;
  min-height: 56px;
  padding: 0 16px;
  border: 0;
  background: transparent;
  color: var(--blue);
  font-size: 19px;
}
.as-btn::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--hair-2);
  transform: scaleY(0.5);
  transform-origin: top;
}
.as-group > .as-btn:first-child::before,
.as-cancel::before {
  display: none;
}
.as-btn:active {
  background: var(--fill);
}
.as-btn.is-destructive {
  color: var(--red);
}
.as-cancel {
  border-radius: 14px;
  background: #fff;
  font-weight: 600;
}

/* ---------- toast ---------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--safe-b) + 96px);
  z-index: 50;
  transform: translateX(-50%);
  padding: 10px 16px;
  border-radius: 12px;
  background: color-mix(in oklab, var(--ink) 92%, transparent);
  color: #fff;
  font-size: 14px;
  white-space: nowrap;
  animation: toast-in 400ms ease both;
  transition: opacity 240ms ease;
}
@keyframes toast-in {
  from {
    opacity: 0;
    transform: translate(-50%, 8px);
  }
}
.toast-out {
  opacity: 0;
}

/* ---------- larger screens: a centred phone-width column ---------- */

@media (min-width: 700px) {
  .intro {
    padding-top: 56px;
  }
  .title {
    font-size: 32px;
    line-height: 38px;
  }
  html.in-chat body {
    background: var(--canvas);
  }
  .chat {
    width: 600px;
    box-shadow:
      -1px 0 0 var(--hair),
      1px 0 0 var(--hair);
  }
  dialog.sheet {
    inset: 0;
    margin: auto;
    width: min(480px, 92vw);
    height: fit-content;
    animation: pop-in 240ms var(--ease-out) both;
  }
  dialog.sheet.sheet-out {
    animation: fade-out 160ms ease both;
  }
  .sheet-body {
    max-height: 86vh;
    border-radius: 20px;
    box-shadow: 0 24px 64px -24px color-mix(in oklab, var(--ink) 40%, transparent);
  }
  .sheet-grip {
    display: none;
  }
  .sheet-head {
    padding-top: 20px;
  }
  .sheet-foot {
    padding-bottom: 16px;
    border-radius: 0 0 20px 20px;
  }
  dialog.sheet-as {
    width: min(400px, 92vw);
    padding: 0;
  }
  @keyframes pop-in {
    from {
      opacity: 0;
      transform: scale(0.97);
    }
  }
}

/* ---------- reduced motion: keep fades that explain, drop movement ---------- */

@media (prefers-reduced-motion: reduce) {
  *:not(.spinner),
  *::before,
  *::after,
  dialog.sheet::backdrop {
    animation-duration: 0.001ms !important;
    animation-delay: 0s !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  .typing-caption {
    -webkit-text-fill-color: currentColor;
    background: none;
  }
  .bubble.typing i {
    opacity: 0.6;
  }
  .pay-receipt.is-new.is-executed .pay-receipt-icon path {
    stroke-dashoffset: 0;
  }
}
