/* Shared components. Loaded after the imported utility stylesheet so these
   contracts remain consistent on every screen, including the style guide. */
body {
  font-family: var(--font-sans);
}
.font-label {
  font-size: var(--text-label);
}
.app-content,
.screen-heading {
  padding-inline: var(--page-gutter);
}
.screen-title {
  font-size: var(--text-title);
  line-height: 1.3;
  font-weight: 600;
}
.card-soft,
.ui-card {
  background: var(--surface-soft);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius);
  box-shadow: var(--glass-shadow);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}
.ui-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: var(--control-height);
  padding: var(--space-3) var(--space-4);
  border: 1px solid transparent;
  border-radius: var(--radius-control);
  font-size: var(--text-body);
  font-weight: 500;
  line-height: 1.4;
  text-align: center;
  text-decoration: none;
  transition:
    background-color var(--motion-fast),
    box-shadow var(--motion-fast),
    opacity var(--motion-fast);
}
.ui-button--primary {
  background: var(--primary);
  color: var(--primary-foreground);
}
.ui-button--secondary {
  background: var(--surface-control);
  color: var(--foreground);
  border-color: var(--border);
}
.ui-button--danger {
  background: var(--destructive);
  color: var(--destructive-foreground);
}
.ui-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.ui-field {
  width: 100%;
  min-width: 0;
  min-height: var(--control-height);
  padding: var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-control);
  background: var(--surface-control);
  color: var(--foreground);
  font: inherit;
  font-size: 1rem;
  line-height: 1.5;
  transition:
    border-color var(--motion-fast),
    box-shadow var(--motion-fast);
}
textarea.ui-field {
  resize: vertical;
}
.ui-field::placeholder {
  color: var(--muted-foreground);
  opacity: 1;
}
.ui-field:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}
.ui-field[aria-invalid="true"] {
  border-color: var(--destructive);
}
.ui-label {
  display: block;
  font-size: var(--text-body);
  font-weight: 500;
  margin-bottom: var(--space-2);
}
.ui-help {
  font-size: var(--text-label);
  color: var(--muted-foreground);
  margin-top: var(--space-2);
}
.ui-chip {
  min-height: 2rem;
  border-radius: var(--radius-pill);
  font-size: var(--text-label);
  padding: var(--space-2) var(--space-3);
  line-height: 1.3;
}
.ui-chip[aria-pressed="true"] {
  background: var(--primary);
  color: var(--primary-foreground);
  border-color: var(--primary);
}
:where(button, a, input, textarea, select):focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: 3px;
}
@media (hover: hover) {
  .ui-button--primary:hover:not(:disabled) {
    background: color-mix(in srgb, var(--primary) 90%, black);
  }
  .ui-button--secondary:hover:not(:disabled) {
    background: var(--muted);
  }
  .ui-button--danger:hover:not(:disabled) {
    background: color-mix(in srgb, var(--destructive) 90%, black);
  }
}
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
/* Style guide uses the same live components and tokens as the app. */
.guide-stack {
  display: grid;
  gap: var(--space-6);
}
.guide-section {
  padding: var(--space-5);
  display: grid;
  gap: var(--space-4);
}
.guide-section h2 {
  font-size: var(--text-title);
}
.guide-intro {
  color: var(--muted-foreground);
  font-size: var(--text-body);
  line-height: 1.6;
}
.guide-eyebrow {
  font-size: var(--text-label);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted-foreground);
}
.guide-palette {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-3);
}
.guide-swatch {
  height: 3.5rem;
  border-radius: var(--radius-control);
  border: 1px solid var(--border);
  margin-bottom: var(--space-2);
}
.guide-caption {
  display: block;
  color: var(--muted-foreground);
  font-size: var(--text-label);
}
.guide-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-2);
}
.guide-status {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-body);
}
.guide-dot {
  width: 0.625rem;
  height: 0.625rem;
  border-radius: var(--radius-pill);
}
.guide-spacing {
  display: grid;
  gap: var(--space-3);
}
.guide-spacing > div {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  font-size: var(--text-label);
}
.guide-spacing span {
  width: 3rem;
}
.guide-spacing i {
  display: block;
  height: 0.75rem;
  background: var(--secondary);
  border-radius: var(--radius-pill);
}

/* Frosted navigation shares the translucent panel treatment. */
.app-tab-bar {
  background: var(--glass-surface);
  border-color: var(--glass-border);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  color: var(--glass-text);
}
.app-tab-bar .app-tab-item,
.app-tab-bar .app-tab-home-link > span:last-child { color: var(--glass-muted); }
.app-tab-bar a:focus-visible { outline: 2px solid var(--glass-text); outline-offset: 2px; }
.app-tab-home {
  --tw-ring-color: var(--glass-border);
}

.home-stack {
  display: grid;
  gap: var(--space-5);
  padding-top: var(--space-4);
  min-width: 0;
}
.home-stack > * {
  min-width: 0;
}

/* Status picker: fixed top-layer dialog never changes the home layout. */
.availability-trigger {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  width: 100%;
  padding: var(--space-4);
  text-align: left;
  background: var(--surface-navigation);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
}
.availability-icon {
  display: grid;
  place-items: center;
  width: var(--control-height);
  height: var(--control-height);
  flex-shrink: 0;
  border-radius: var(--radius-control);
  background: var(--muted);
}
.availability-copy {
  display: grid;
  gap: var(--space-1);
  flex: 1;
  min-width: 0;
}
.availability-current {
  font-size: var(--text-body);
  font-weight: 600;
}
.availability-edit {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  font-size: var(--text-label);
  color: var(--muted-foreground);
}
.status-dialog {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  height: 100dvh;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: var(--background);
  color: var(--foreground);
  overflow-y: auto;
  overscroll-behavior: contain;
}
.status-dialog::backdrop {
  background: var(--background);
}
.status-dialog-content {
  max-width: var(--page-width);
  margin-inline: auto;
  padding: max(var(--space-5), env(safe-area-inset-top)) var(--page-gutter)
    max(var(--space-8), env(safe-area-inset-bottom));
}
.status-dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-8);
}
.status-close {
  display: grid;
  place-items: center;
  width: var(--control-height);
  height: var(--control-height);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: var(--surface-navigation);
}
.status-dialog h1 {
  font-size: var(--text-heading);
  line-height: 1.3;
}
.status-dialog-description {
  margin-top: var(--space-3);
  font-size: var(--text-body);
  line-height: 1.6;
  color: var(--muted-foreground);
}
.status-options {
  display: grid;
  gap: var(--space-3);
  margin-block: var(--space-6);
}
.status-option {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4);
  text-align: left;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-navigation);
}
.status-option[aria-pressed="true"] {
  border-color: var(--primary);
  background: var(--muted);
  box-shadow: inset 0 0 0 1px var(--primary);
}
.status-option-title {
  font-size: var(--text-body);
  font-weight: 600;
}
.status-option-description {
  font-size: var(--text-label);
  color: var(--muted-foreground);
  line-height: 1.5;
}
.status-selection {
  width: var(--space-6);
  height: var(--space-6);
  flex-shrink: 0;
  display: grid;
  place-items: center;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
}
.status-option[aria-pressed="true"] .status-selection {
  background: var(--primary);
  color: var(--primary-foreground);
  border-color: var(--primary);
}
.status-option:disabled,
.status-close:disabled {
  opacity: 0.6;
  cursor: wait;
}
@media (hover: hover) {
  .availability-trigger:hover,
  .status-option:hover:not(:disabled) {
    background: var(--muted);
  }
}

.buddy-qr-panel {
  display: grid;
  justify-items: center;
  gap: var(--space-3);
  margin-block: var(--space-6);
  padding: var(--space-5);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--card);
  text-align: center;
}
.buddy-qr-code {
  width: 100%;
  max-width: 17rem;
  padding: var(--space-4);
  background: var(--card);
}
.buddy-qr-code svg {
  display: block;
  width: 100%;
  height: auto;
}
.buddy-qr-steps {
  list-style: decimal;
  padding-left: var(--space-5);
  margin-top: var(--space-3);
  font-size: var(--text-body);
  line-height: 1.6;
}
.buddy-qr-steps li + li {
  margin-top: var(--space-2);
}
.buddy-qr-note {
  margin-block: var(--space-5);
  line-height: 1.5;
}

.ui-action-link {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  width: 100%;
  padding: var(--space-4);
  border: 1px solid var(--secondary);
  border-radius: var(--radius-control);
  background: var(--surface-navigation);
  color: var(--foreground);
  text-decoration: none;
  box-shadow: var(--shadow-soft);
  transition:
    background-color var(--motion-fast),
    border-color var(--motion-fast),
    box-shadow var(--motion-fast);
}
.ui-action-copy {
  display: grid;
  gap: var(--space-1);
  flex: 1;
  min-width: 0;
}
.ui-action-title {
  font-size: var(--text-body);
  font-weight: 600;
  line-height: 1.4;
}
.ui-action-detail {
  font-size: var(--text-label);
  color: var(--muted-foreground);
}
.ui-action-number {
  font-size: var(--text-body);
  font-weight: 400;
  font-variant-numeric: tabular-nums;
}
.ui-action-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  gap: var(--space-2);
  min-height: var(--control-height);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-control);
  background: var(--primary);
  color: var(--primary-foreground);
  font-size: var(--text-body);
  font-weight: 600;
}
.ui-action-link:focus-visible,
.ui-action-link:active {
  background: var(--muted);
  border-color: var(--primary);
  box-shadow: inset 0 0 0 1px var(--primary);
}
.ui-action-link:active .ui-action-cta {
  background: var(--foreground);
}
@media (hover: hover) {
  .ui-action-link:hover {
    background: var(--muted);
    border-color: var(--primary);
  }
}

.conversation-setup {
  display: grid;
  gap: var(--space-5);
}
.conversation-intro {
  display: grid;
  justify-items: center;
  gap: var(--space-3);
  padding: var(--space-6);
  text-align: center;
}
.conversation-emblem {
  display: grid;
  place-items: center;
  padding: var(--space-4);
  border-radius: var(--radius);
  background: var(--secondary);
  color: var(--primary);
}
.conversation-intro h2 {
  font-size: var(--text-heading);
  line-height: 1.3;
}
.conversation-subtitle {
  font-size: var(--text-body);
  color: var(--muted-foreground);
  line-height: 1.5;
}
.conversation-actions {
  display: grid;
  width: 100%;
  gap: var(--space-2);
  margin-top: var(--space-2);
}
.conversation-start {
  width: 100%;
}
.conversation-start span {
  flex: 1;
}
.conversation-reassurance {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  font-size: var(--text-label);
  color: var(--muted-foreground);
}
.conversation-preferences {
  padding: var(--space-4);
}
.conversation-preferences-heading {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
}
.conversation-preferences-heading h3 {
  flex: 1;
  font-size: var(--text-body);
  font-weight: 600;
}
.conversation-preferences-heading > span {
  font-size: var(--text-label);
  color: var(--muted-foreground);
}
.conversation-preference-row + .conversation-preference-row {
  margin-top: var(--space-2);
}
.conversation-preference-row {
  border: 1px solid var(--border);
  border-radius: var(--radius-control);
  background: var(--surface-navigation);
}
.conversation-preference-toggle {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  width: 100%;
  padding: var(--space-3);
  border-radius: var(--radius-control);
  text-align: left;
}
.conversation-adjust {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  font-size: var(--text-label);
  color: var(--muted-foreground);
  flex-shrink: 0;
}
.conversation-preference-options {
  padding: var(--space-3);
  border-top: 1px solid var(--border);
}
.conversation-preference-options .ui-chip {
  min-height: var(--control-height);
}
.conversation-preference-hint {
  font-size: var(--text-label);
  line-height: 1.5;
  color: var(--muted-foreground);
  margin-top: var(--space-3);
}

.people-filter-dialog[open] {
  display: flex;
  flex-direction: column;
}
.people-filter-dialog .status-dialog-content {
  width: 100%;
  flex: 1;
}
.people-filter-fields {
  display: grid;
  gap: var(--space-6);
  margin-top: var(--space-6);
}
.people-filter-fields .ui-chip {
  min-height: var(--control-height);
}
.people-filter-footer {
  position: sticky;
  bottom: 0;
  background: var(--surface-navigation);
  border-top: 1px solid var(--border);
  padding: var(--space-3) var(--page-gutter)
    max(var(--space-3), env(safe-area-inset-bottom));
}
.people-filter-footer > div {
  display: flex;
  gap: var(--space-2);
  max-width: calc(var(--page-width) - var(--page-gutter) * 2);
  margin-inline: auto;
}
.people-filter-footer .ui-button--primary {
  flex: 1;
}

.ui-live-badge {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  gap: var(--space-2);
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-pill);
  background: var(--live-background);
  border: 1px solid var(--live-border);
  box-shadow: var(--live-glow);
  color: var(--primary);
  font-size: var(--text-label);
  font-weight: 600;
  line-height: 1.5;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.ui-live-badge > span {
  width: 0.375rem;
  height: 0.375rem;
  border-radius: var(--radius-pill);
  background: currentColor;
}

.ui-group-active {
  color: var(--status-available);
  font-weight: 500;
}
.ui-group-planned {
  color: var(--status-planned);
  font-weight: 500;
}

.app-tab-item {
  min-height: var(--control-height);
  max-width: 5rem;
  margin-inline: auto;
  padding: var(--space-1) var(--space-2);
  justify-content: center;
  border-radius: var(--radius-control);
  gap: var(--space-1);
}
.app-tab-item[aria-current="page"] {
  background: var(--primary);
  color: var(--primary-foreground);
}
.app-tab-item[aria-current="page"] > span,
.app-tab-home-link[aria-current="page"] > span:last-child {
  font-weight: 700;
}
.app-tab-item[aria-current="page"] svg,
.app-tab-home-link[aria-current="page"] svg {
  stroke-width: 2.2;
}
.app-tab-home-link:not([aria-current="page"]) .app-tab-home {
  background: var(--app-canvas);
  color: var(--glass-muted);
}
.app-tab-bar .app-tab-item[aria-current="page"],
.app-tab-bar .app-tab-home-link[aria-current="page"] > span:last-child {
  color: var(--glass-text);
}

.home-welcome {
  display: grid;
  gap: var(--space-3);
}
.home-greeting {
  padding-inline: var(--space-4);
  font-size: var(--text-body);
  font-weight: 500;
  color: var(--foreground);
  overflow-wrap: anywhere;
}

.screen-composer {
  position: fixed;
  inset-inline: 0;
  bottom: calc(var(--tab-bar-height) + env(safe-area-inset-bottom, 0px));
  z-index: 30;
  width: 100%;
  background: var(--surface-navigation);
  border-top: 1px solid var(--border);
}
.screen-composer-content {
  max-width: var(--page-width);
  margin-inline: auto;
  padding: var(--space-3) var(--page-gutter);
}
.screen-with-composer {
  padding-bottom: calc(
    var(--tab-bar-height) + var(--control-height) + var(--space-8) +
      env(safe-area-inset-bottom, 0px)
  );
}

.journal-editor-form {
  display: grid;
  gap: var(--space-4);
  margin-top: var(--space-6);
}
.journal-editor-form .ui-chip {
  min-height: var(--control-height);
}
.journal-editor-form > .ui-label {
  margin-bottom: calc(-1 * var(--space-2));
}

.ui-icon-button { width: var(--control-height); height: var(--control-height); flex: none; padding: 0; }

.ui-mood-label { display: inline-flex; align-items: center; gap: var(--space-1); vertical-align: middle; }
.ui-mood-label svg { flex-shrink: 0; }

.sos-contact { flex-direction: row; align-items: center; gap: var(--space-2); padding: var(--space-3); }
.sos-contact-actions { display: flex; align-items: center; flex-shrink: 0; gap: var(--space-2); }
.sos-contact .ui-opening-hours { padding: var(--space-1); gap: var(--space-1); border: 0; background: transparent; white-space: nowrap; }
.sos-contact .ui-opening-hours-label { display: none; }
.sos-contact .ui-action-cta { padding: var(--space-2) var(--space-4); gap: var(--space-2); }
.sos-contact .ui-action-number { white-space: nowrap; }
.ui-opening-hours { display: inline-flex; align-items: center; gap: var(--space-2); padding: var(--space-2) var(--space-3); border: 1px solid var(--border); border-radius: var(--radius-control); background: var(--muted); color: var(--primary); font-size: var(--text-label); line-height: 1.4; }
.ui-opening-hours-label { display: block; color: var(--muted-foreground); }
.ui-opening-hours strong { font-weight: 600; }

/* Green atmospheric canvas; light content surfaces keep their own contrast. */
.nordic-bg::before { background-color: var(--app-canvas); }
.nordic-bg .app-content { color: var(--app-canvas-text); }
.nordic-bg :is(.card-soft, .ui-card, .availability-trigger, .ui-field, .status-dialog) { color: var(--foreground); }
.nordic-bg .screen-heading { color: var(--app-canvas-text); }
.nordic-bg .screen-title,
.nordic-bg .app-content > div > :is(h1, h2),
.nordic-bg .home-greeting { color: var(--app-canvas-text); }
.nordic-bg .screen-heading .text-muted-foreground,
.nordic-bg .home-stack > section > p.text-muted-foreground,
.nordic-bg .app-content > div > .flex > span.text-muted-foreground { color: var(--app-canvas-muted); }
.nordic-bg .screen-heading > a { color: var(--foreground); }
.nordic-bg :is(.card-soft, .ui-card, .status-dialog) .screen-title { color: var(--foreground); }
.nordic-bg .app-content > div > .flex > button.ui-chip { background: var(--card); color: var(--foreground); }

.app-sos-header { pointer-events: none; }
.app-sos-header a { pointer-events: auto; }

.app-shell-compact { padding-top: 0; }
.app-shell-compact .home-greeting { display: flex; align-items: center; min-height: var(--control-height); padding-right: calc(var(--control-height) + var(--space-5)); }

/* Frosted green surfaces, scoped independently from light dialogs. */
.nordic-bg .ui-glass-panel {
  --foreground: var(--glass-text);
  --muted-foreground: var(--glass-muted);
  --primary: var(--glass-text);
  --color-primary: var(--glass-text);
  --color-foreground: var(--glass-text);
  --border: var(--glass-border);
  --color-border: var(--glass-border);
  background: var(--glass-surface); color: var(--glass-text);
  border: 1px solid var(--glass-border); box-shadow: var(--glass-shadow);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
}
.ui-glass-panel .availability-icon, .ui-glass-panel .home-glass-control { background: var(--glass-control); color: var(--glass-text); border-color: var(--glass-border); }
.ui-glass-panel .availability-icon svg { color: var(--glass-text); }
.ui-glass-panel .availability-edit, .ui-glass-panel .status-option-description { color: var(--glass-muted); }
@media (hover: hover) { .availability-trigger.ui-glass-panel:hover { background: color-mix(in srgb, var(--glass-surface), transparent 10%); border-color: var(--glass-text); } }
.ui-glass-panel:focus-visible, .ui-glass-panel a:focus-visible { outline-color: var(--glass-text); }

.home-contact-button { background: var(--surface-navigation); color: var(--primary); border: 1px solid var(--border); }
.home-contact-button--primary { box-shadow: var(--contact-primary-shadow); border: 2px solid var(--secondary); }
.home-contact-button--primary svg { stroke-width: 2.2; }
.home-contact-button:focus-visible { outline-color: var(--glass-text); outline-offset: 8px; }

.home-contact-button:not(.home-contact-button--primary) { background: var(--contact-secondary-surface); color: var(--glass-text); border-color: var(--contact-secondary-border); border-width: 1.5px; }
.home-contact-button:not(.home-contact-button--primary) .typing-dot { background: currentColor; animation: none; opacity: .65; }

/* Match homepage icon strokes to the regular-weight typography. */
.home-stack > .ui-glass-panel > div > svg,
.home-stack > .ui-glass-panel > div > span > svg,
.home-stack .home-contact-button > svg,
.home-stack .availability-trigger svg,
.home-stack .home-glass-control svg { stroke-width: 1.5; }

.home-contact-button--primary { position: relative; }
.home-contact-button--primary::before {
  content: ""; position: absolute; inset: -6px; border-radius: inherit;
  pointer-events: none; box-shadow: 0 0 20px 5px var(--contact-glow-color), inset 0 0 12px 3px var(--contact-glow-color);
  border: none;
  animation: home-contact-glow var(--contact-glow-duration) ease-in-out infinite;
}
@keyframes home-contact-glow {
  0%, 100% { transform: scale(1); opacity: .45; }
  50% { transform: scale(1.14); opacity: .9; }
}
@media (prefers-reduced-motion: reduce) {
  .home-contact-button--primary::before { animation: none; opacity: .45; }
}

/* Broad folded shapes add depth without competing with the glass controls. */
.nordic-bg::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: var(--app-texture-color);
  opacity: var(--app-texture-opacity);
  -webkit-mask: var(--app-texture-mask) center / 100% 100% no-repeat;
  mask: var(--app-texture-mask) center / 100% 100% no-repeat;
}

/* The recovery strip extends beyond the centered content to both screen edges. */
.app-shell-compact { overflow: visible; }
.home-recovery { min-width: 0; }
.home-recovery-ticker {
  width: 100vw;
  margin-inline: calc(50% - 50vw);
  margin-top: var(--space-3);
  overflow: hidden;
  padding-block: var(--space-1);
}
.home-recovery-ticker .home-glass-control {
  background: var(--glass-surface);
  color: var(--glass-text);
  border: 1px solid var(--glass-border);
}
.home-recovery-ticker .text-muted-foreground { color: var(--glass-muted); }

.nordic-bg .app-tab-item[aria-current="page"] { color: var(--primary-foreground); }
.home-canvas .home-contact-button--primary { border-color: var(--contact-primary-border); }

.nordic-bg::after {
  -webkit-mask-image: var(--app-texture-mask), var(--app-texture-fade);
  mask-image: var(--app-texture-mask), var(--app-texture-fade);
  -webkit-mask-composite: source-in;
  mask-composite: intersect;
}

.ui-glass-badge { background: var(--glass-control); color: var(--glass-text); border: 1px solid var(--glass-border); }

.sage-canvas .app-tab-item[aria-current="page"] { color: var(--primary-foreground); }

h1, h2, h3, h4, h5, h6, .font-display, .screen-title { font-family: var(--font-heading); }

.home-welcome .home-recovery-ticker { margin-top: 0; }

.home-recovery-reset {
  margin-top: calc(-1 * var(--space-2));
  justify-self: end;
  color: var(--app-canvas-muted);
  font-size: var(--text-label);
  font-weight: 400;
  text-decoration: underline;
  text-underline-offset: 3px;
  padding-block: var(--space-1);
}
.home-recovery-reset:hover { color: var(--app-canvas-text); }
.home-recovery-reset:focus-visible { outline: 2px solid var(--ring); outline-offset: 3px; border-radius: var(--space-1); }

.sos-pulse { position: relative; animation: none; }
.sos-pulse::before {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  pointer-events: none;
  box-shadow: 0 0 16px 4px var(--sos-glow-color);
  animation: home-contact-glow var(--contact-glow-duration) ease-in-out infinite;
}
@media (prefers-reduced-motion: reduce) {
  .sos-pulse::before { animation: none; opacity: .45; }
}

.sos-bell-link { display: grid; place-items: center; width: var(--control-height); height: var(--control-height); flex-shrink: 0; color: var(--sos-background); }
.sos-bell { width: 44px; height: 44px; overflow: visible; animation: sos-bell-light var(--contact-glow-duration) ease-in-out infinite; }
.sos-bell-label { fill: var(--destructive-foreground); font-family: var(--font-sans); font-size: 9px; font-weight: 600; letter-spacing: .3px; }
.sos-bell-link:focus-visible { outline: 2px solid var(--sos-background); outline-offset: 3px; border-radius: var(--radius-control); }
@keyframes sos-bell-light { 0%, 100% { filter: drop-shadow(0 0 2px var(--sos-glow-color)); } 50% { filter: drop-shadow(0 0 6px var(--sos-glow-color)); } }
@media (prefers-reduced-motion: reduce) { .sos-bell { animation: none; filter: drop-shadow(0 0 3px var(--sos-glow-color)); } }

/* Blank starting canvas for the separate homepage redesign. */
.home-v2-canvas { min-height: 100vh; min-height: 100dvh; background: var(--surface-navigation); }

.wallet-v2 { min-height: 100dvh; background: var(--wallet-bg); padding: 9px 12px 6px; color: var(--wallet-ink); font-family: Inter, sans-serif; }
.wallet-v2 button { font: inherit; cursor: pointer; }
.wallet-phone { max-width: 552px; margin: auto; border: 1px solid var(--wallet-line); border-radius: 42px; overflow: hidden; background: linear-gradient(150deg, transparent 25%, var(--wallet-glass)); min-height: calc(100dvh - 15px); display: flex; flex-direction: column; }
.wallet-status { display: flex; justify-content: space-between; align-items: center; padding: 17px 28px 0; color: var(--wallet-white); font-size: 13px; font-weight: 700; }
.wallet-status > div { display: flex; gap: 3px; align-items: center; }
.wallet-hero { text-align: center; padding: 32px 18px 30px; color: var(--wallet-white); }
.wallet-hero h1 { display: flex; align-items: center; justify-content: center; gap: 9px; font-family: Inter,sans-serif; font-size: 24px; font-weight: 600; color: inherit; margin: 0; letter-spacing: -.6px; }
.wallet-brand-icon { display: grid; place-items: center; border-radius: 50%; width: 19px; height: 19px; background: var(--wallet-white); color: var(--wallet-purple); font-size: 17px; }
.wallet-hero > p { margin: 50px 0 8px; font-size: 15px; opacity: .76; }
.wallet-balance { display: flex; justify-content: center; gap: 12px; align-items: center; white-space: nowrap; }
.wallet-balance strong { font-size: clamp(34px, 10.6vw, 62px); line-height: 1.15; letter-spacing: -1.8px; font-weight: 700; }
.wallet-balance button { background: none; border: 0; color: inherit; padding: 0; }
.wallet-main-actions { display: flex; gap: 15px; margin-top: 39px; }
.wallet-main-actions > :is(button, a) { flex: 1; border-radius: 999px; background: var(--wallet-white); color: var(--wallet-ink); height: 49px; border: 0; font-size: 13px; font-weight: 600; box-shadow: var(--wallet-shadow); }
.wallet-promo { display: flex; align-items: center; justify-content: space-between; gap: 8px; background: var(--wallet-glass); border-radius: 30px 30px 0 0; padding: 18px 18px 34px; }
.wallet-promo-copy { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; }
.wallet-ticket { width: 27px; height: 27px; background: var(--wallet-white); border-radius: 50%; display: grid; place-items: center; color: var(--wallet-purple); }
.wallet-promo > button { background: var(--wallet-purple); color: var(--wallet-white); border: 0; border-radius: 999px; padding: 11px 15px; font-size: 13px; font-weight: 500; }
.wallet-content { background: var(--wallet-white); border-radius: 30px 30px 0 0; margin-top: -16px; padding: 18px 18px 13px; flex: 1; }
.wallet-section-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.wallet-section-heading h2 { color: var(--wallet-ink); font-family: Inter,sans-serif; font-size: 18px; font-weight: 650; letter-spacing: -.6px; margin: 0; }
.wallet-section-heading button { background: none; border: 0; color: var(--wallet-muted); font-size: 13px; padding: 0; }
.wallet-actions { display: grid; grid-template-columns: repeat(3,1fr); gap: 11px; margin-top: 18px; }
.wallet-action { border: 0; border-radius: 19px; display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 15px 4px 14px; font-size: 13px !important; color: var(--wallet-ink); }
.wallet-action--transfer { background: var(--wallet-transfer); --action-ink: var(--wallet-transfer-ink); }
.wallet-action--topup { background: var(--wallet-topup); --action-ink: var(--wallet-topup-ink); }
.wallet-action--payment { background: var(--wallet-payment); --action-ink: var(--wallet-payment-ink); }
.wallet-action > span { position: relative; display: grid; place-items: center; width: 56px; height: 56px; border-radius: 50%; background: var(--wallet-white); color: var(--action-ink); box-shadow: var(--wallet-shadow); }
.wallet-action b { position: absolute; right: 15px; bottom: 12px; background: var(--wallet-white); font-size: 17px; line-height: 13px; }
.wallet-transactions-heading { margin-top: var(--space-4); }
.wallet-transaction { display: flex; align-items: center; gap: 11px; background: none; border: 0; padding: 18px 0 0; text-align: left; width: 100%; }
.wallet-avatar { width: 44px; height: 44px; flex-shrink: 0; border-radius: 50%; background-image: url('/assets/v2-reference.png'); background-size: 389px auto; background-position: -31px -664px; }
.wallet-person, .wallet-amount { display: flex; flex-direction: column; gap: 3px; }
.wallet-person strong { font-size: 14px; font-weight: 600; }
.wallet-amount { margin-left: auto; text-align: right; }
.wallet-amount strong { font-size: 13px; font-weight: 600; }
.wallet-transaction small { font-size: 11px; color: var(--wallet-muted); }
.wallet-nav { position: relative; display: grid; grid-template-columns: repeat(5,1fr); align-items: end; background: var(--wallet-white); padding: 16px 8px 16px; box-shadow: 0 -1px 8px rgb(0 0 0 / 5%); }
.wallet-nav button { display: flex; flex-direction: column; align-items: center; gap: 7px; font-size: 11px; background: none; border: 0; color: var(--wallet-ink); padding: 0; }
.wallet-nav button svg { width: 21px; height: 21px; }
.wallet-nav button[aria-current] { font-weight: 600; }
.wallet-nav .wallet-scan { align-self: start; margin: -45px auto 0; width: 63px; height: 63px; display: grid; place-items: center; border-radius: 50%; border: 1px solid var(--wallet-white); background: var(--wallet-scan-bg); color: var(--wallet-white); box-shadow: 0 10px 0 rgb(220 220 220 / 45%), var(--wallet-shadow); }
.wallet-nav .wallet-scan svg { width: 28px; height: 28px; }
.wallet-modal-backdrop { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 24px; background: rgb(20 14 50 / 35%); backdrop-filter: blur(8px); }
.wallet-modal { background: var(--wallet-white); border-radius: 24px; padding: 24px; max-width: 350px; width: 100%; }
.wallet-modal > button { float: right; background: none; border: 0; }
.wallet-modal h2 { margin-bottom: 16px; color: var(--wallet-ink); }
.wallet-v2 button:focus-visible { outline: 2px solid var(--wallet-purple); outline-offset: 4px; }
@media (min-width: 500px) { .wallet-v2 { padding-top: 14px; } .wallet-phone { min-height: 800px; } .wallet-hero { padding-top: 40px; } .wallet-hero > p { margin-top: 55px; } }

/* V2 fills the app viewport, without a simulated device frame. */
.wallet-v2 { padding: 0; }
.wallet-phone { max-width: none; min-height: 100dvh; border: 0; border-radius: 0; }
.wallet-hero { padding-top: max(36px, env(safe-area-inset-top)); }
.wallet-nav { padding-bottom: max(16px, env(safe-area-inset-bottom)); }

.wallet-main-actions .wallet-call-primary { display: flex; align-items: center; justify-content: center; gap: var(--space-2); background: var(--primary); color: var(--wallet-white); text-decoration: none; }
.wallet-call-primary:focus-visible { outline: 2px solid var(--wallet-white); outline-offset: 4px; }

.wallet-main-actions .wallet-chat-secondary { display: flex; align-items: center; justify-content: center; gap: var(--space-2); color: var(--primary); text-decoration: none; }
.wallet-chat-secondary:focus-visible { outline: 2px solid var(--wallet-white); outline-offset: 4px; }

.wallet-promo .wallet-sos { display: inline-flex; align-items: center; justify-content: center; min-height: var(--control-height); padding: 11px 22px; border-radius: var(--radius-pill); background: var(--sos-background); color: var(--wallet-white); font-size: 13px; font-weight: 600; text-decoration: none; }
.wallet-sos:focus-visible { outline: 2px solid var(--sos-background); outline-offset: 3px; }

.wallet-hero { position: relative; isolation: isolate; overflow: hidden; background: var(--wallet-hero-gradient); box-shadow: inset 0 1px 0 var(--wallet-line), inset 0 -1px 0 var(--wallet-line); }
.wallet-phone::before { content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none; background: var(--wallet-hero-glass); backdrop-filter: blur(18px) saturate(125%); -webkit-backdrop-filter: blur(18px) saturate(125%); }
.wallet-phone::after { content: ""; position: absolute; inset: -25% -15%; z-index: -1; pointer-events: none; border-radius: 45%; background: var(--wallet-hero-sheen); transform: rotate(-14deg); }

.wallet-hero { color: var(--wallet-hero-ink); }
.wallet-hero .wallet-brand-icon { color: var(--wallet-hero-ink); }

/* One continuous hero canvas behind the overlapping panels. */
.wallet-v2 { background: var(--wallet-hero-gradient); }
.wallet-phone { position: relative; isolation: isolate; background: var(--wallet-hero-gradient); }
.wallet-hero { background: transparent; box-shadow: none; }
.wallet-promo { background: var(--wallet-glass); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px); }
.wallet-content { position: relative; z-index: 1; }
.wallet-nav { z-index: 2; }

.wallet-main-actions { align-items: flex-start; }
.wallet-contact-action { flex: 1; min-width: 0; }
.wallet-main-actions .wallet-contact-action > a { height: 49px; border-radius: var(--radius-pill); font-size: 13px; font-weight: 600; box-shadow: var(--wallet-shadow); }
.wallet-availability { display: flex; justify-content: center; align-items: center; gap: 6px; margin-top: 9px; font-size: 11px; font-weight: 400; color: var(--wallet-hero-ink); }
.wallet-availability strong { font-weight: 600; }
.wallet-availability i { width: 5px; height: 5px; border-radius: 50%; background: var(--wallet-payment-ink); }

.wallet-main-actions .wallet-contact-action > .wallet-chat-secondary { background: var(--wallet-white); }

.wallet-promo { background: var(--wallet-sos-surface); border-top: 1px solid var(--wallet-sos-border); box-shadow: inset 0 1px 0 var(--wallet-sos-border); }
.wallet-promo .wallet-ticket { color: var(--sos-background); }

/* Match the Payment tile over the visible intro, not the full page height. */
.wallet-v2, .wallet-phone { background: var(--wallet-white); }
.wallet-phone::before, .wallet-phone::after { content: none; }
.wallet-intro { background: var(--wallet-payment); }

.wallet-promo-copy { min-width: 0; line-height: 1.45; }
.wallet-promo-copy .wallet-ticket, .wallet-promo .wallet-sos { flex-shrink: 0; }

.wallet-recovery-heading { justify-content: flex-start; gap: 4px; }
.wallet-recovery-reset { display: grid; place-items: center; width: 44px; height: 44px; margin-block: -13px; border-radius: 50%; color: var(--wallet-muted); }
.wallet-recovery-reset:hover { color: var(--primary); background: var(--secondary); }

.availability-trigger.availability-trigger--hero {
  position: relative;
  justify-content: center;
  width: fit-content;
  max-width: 100%;
  margin-inline: auto;
  padding: var(--space-2) var(--space-4);
  background: transparent;
  border: 0;
  box-shadow: none;
  text-align: center;
  color: var(--wallet-hero-ink);
}
.availability-trigger--hero .availability-copy { flex: initial; gap: var(--space-2); }
.availability-trigger--hero .font-label { font-family: inherit; font-size: var(--text-label); font-weight: 400; letter-spacing: 0; text-transform: none; color: inherit; opacity: .7; }
.availability-trigger--hero .availability-current { font-family: Inter, sans-serif; font-size: clamp(26px, 7vw, 40px); line-height: 1.15; letter-spacing: -1px; font-weight: 650; }
.availability-trigger--hero .availability-edit { align-self: flex-end; padding-bottom: var(--space-2); color: inherit; opacity: .65; }
.availability-trigger--hero .availability-edit svg { transform: rotate(90deg); }
.availability-trigger--hero:hover { opacity: .8; }

.wallet-sos-action { display: flex; flex-direction: column; align-items: center; gap: var(--space-1); flex-shrink: 0; }
.wallet-sos-caption { font-size: var(--text-label); font-weight: 500; line-height: 1.4; color: var(--wallet-muted); }

/* V2 status selection follows the homepage's soft gradient and white surfaces. */
.status-dialog {
  background: var(--wallet-payment);
  color: var(--wallet-hero-ink);
  font-family: Inter, sans-serif;
}
.status-dialog .status-dialog-content { padding-top: max(var(--space-5), env(safe-area-inset-top)); }
.status-dialog .status-dialog-header { margin-bottom: var(--space-8); }
.status-dialog .status-dialog-header .font-label { text-transform: none; letter-spacing: 0; font-family: inherit; font-weight: 500; color: var(--wallet-hero-ink); }
.status-dialog .status-close { background: var(--wallet-glass); border-color: var(--wallet-line); color: var(--wallet-hero-ink); backdrop-filter: blur(18px); }
.status-dialog h1 { display: block; margin: 0; font-family: inherit; font-size: clamp(28px, 7vw, 36px); letter-spacing: -1px; font-weight: 650; color: var(--wallet-hero-ink); }
.status-dialog .status-dialog-description { color: var(--wallet-hero-ink); opacity: .75; }
.status-dialog .status-options { gap: var(--space-3); margin-block: var(--space-8); }
.status-dialog .status-option { background: var(--wallet-white); border-color: var(--wallet-line); border-radius: var(--radius); padding: var(--space-4); box-shadow: var(--wallet-shadow); color: var(--wallet-hero-ink); }
.status-dialog .status-option .availability-icon { border-radius: 50%; background: var(--wallet-payment); }
.status-dialog .status-option[aria-pressed="true"] { background: var(--primary); border-color: var(--primary); color: var(--wallet-white); box-shadow: var(--wallet-shadow); }
.status-dialog .status-option[aria-pressed="true"] .status-option-description { color: var(--wallet-white); opacity: .8; }
.status-dialog .status-option[aria-pressed="true"] .status-selection { background: var(--wallet-white); color: var(--primary); border-color: var(--wallet-white); }
.status-dialog .ui-help { color: var(--wallet-hero-ink); opacity: .7; }

.wallet-intro { position: relative; isolation: isolate; overflow: hidden; background: var(--wallet-wave-base); }
.wallet-intro::before {
  content: "";
  position: absolute;
  inset: -25%;
  z-index: -1;
  pointer-events: none;
  background: var(--wallet-wave-colors);
  filter: blur(22px);
  transform-origin: center;
  animation: wallet-color-wave 7s ease-in-out infinite alternate;
}
@keyframes wallet-color-wave {
  0% { transform: translate(-4%, -3%) rotate(-7deg) scale(1.03); }
  50% { transform: translate(4%, 2%) rotate(4deg) scale(1.12); }
  100% { transform: translate(-1%, 5%) rotate(10deg) scale(1.04); }
}
@media (prefers-reduced-motion: reduce) {
  .wallet-intro::before { animation: none; }
}

.wallet-recovery-reset-text { display: flex; align-items: center; gap: var(--space-1); width: fit-content; margin: var(--space-2) 0 0 auto; padding-block: var(--space-1); font-size: var(--text-label); line-height: 1.4; color: var(--wallet-muted); text-decoration: none; }
.wallet-recovery-reset-text:hover { color: var(--primary); }

.wallet-content > .wallet-actions:first-child { margin-top: 0; }

.wallet-chat-avatar { width: 44px; height: 44px; flex-shrink: 0; border-radius: 50%; object-fit: cover; background: var(--wallet-payment); }
.wallet-chat-row { padding-block: var(--space-4); color: var(--wallet-ink); }
.wallet-chat-row .wallet-person { min-width: 0; flex: 1; }
.wallet-chat-row .wallet-person small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wallet-chat-time { align-self: flex-start; padding-top: var(--space-1); font-size: var(--text-label); color: var(--wallet-muted); white-space: nowrap; }

.wallet-sos-copy { display: flex; flex-direction: column; align-items: flex-start; gap: var(--space-1); }
.wallet-promo-copy .wallet-sos-caption { display: inline-flex; align-items: center; gap: var(--space-1); flex-shrink: 0; white-space: nowrap; padding: 2px var(--space-2); border-radius: var(--radius-pill); background: var(--wallet-glass); color: var(--wallet-hero-ink); font-weight: 600; }

.wallet-main-actions .wallet-contact-action > .wallet-call-primary { background: var(--wallet-call-surface); border: 1.5px solid var(--wallet-call-border); color: var(--wallet-white); box-shadow: var(--wallet-call-shadow); }
.wallet-call-primary:focus-visible { outline-color: var(--primary); }

.wallet-daily-quote { margin: var(--space-6) 0 var(--space-4); padding: var(--space-5); border-radius: var(--radius); background: var(--wallet-payment); color: var(--wallet-hero-ink); font-family: Inter, sans-serif; }
.wallet-daily-quote figcaption { display: flex; align-items: center; gap: var(--space-2); font-size: var(--text-label); font-weight: 500; }
.wallet-quote-icon { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: var(--wallet-glass); flex-shrink: 0; }
.wallet-daily-quote blockquote { margin: var(--space-3) 0 0; font-size: 18px; line-height: 1.55; font-weight: 500; letter-spacing: -.3px; }

.wallet-promo-copy .wallet-sos-caption { font-size: 14px; padding: var(--space-1) var(--space-2); }
.wallet-promo-copy .wallet-sos-caption svg { width: 14px; height: 14px; }

.availability-trigger.wallet-buddy-cta { margin-block: var(--space-4); background: var(--wallet-call-surface); color: var(--wallet-white); border: 1px solid var(--wallet-call-border); border-radius: var(--radius); box-shadow: var(--wallet-shadow); padding: var(--space-5); cursor: pointer; transition: transform .18s ease, filter .18s ease; }
.wallet-buddy-cta .availability-icon { background: var(--wallet-glass); color: var(--wallet-white); border-radius: 50%; }
.wallet-buddy-cta .availability-current { font-family: Inter, sans-serif; font-size: 16px; }
.wallet-buddy-cta .status-option-description, .wallet-buddy-cta > svg { color: var(--wallet-white); }
.availability-trigger.wallet-buddy-cta:hover { background: var(--wallet-call-surface); filter: brightness(1.06); }
.wallet-buddy-cta:active { transform: scale(.98); }
@media (prefers-reduced-motion: reduce) { .wallet-buddy-cta { transition: none; } }

.availability-trigger.wallet-buddy-cta { background: var(--wallet-buddy-surface); color: var(--wallet-hero-ink); border: 1.5px solid var(--wallet-call-border); box-shadow: var(--wallet-call-shadow); }
.wallet-buddy-cta .availability-icon { background: var(--wallet-white); color: var(--wallet-hero-ink); }
.wallet-buddy-cta .status-option-description, .wallet-buddy-cta > svg { color: var(--wallet-hero-ink); }
.availability-trigger.wallet-buddy-cta:hover { background: var(--wallet-buddy-surface); filter: brightness(.98); }

.wallet-daily-quote { background: var(--wallet-quote-gradient); color: var(--wallet-quote-ink); }
.wallet-daily-quote figcaption { color: var(--wallet-quote-ink); }

@keyframes wallet-enter {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}
.wallet-hero > section,
.wallet-main-actions,
.wallet-promo,
.wallet-content > .wallet-actions,
.wallet-recovery-reset-text,
.wallet-transactions-heading,
.wallet-recent-chats,
.wallet-daily-quote,
.wallet-content > section {
  animation: wallet-enter 600ms cubic-bezier(.22, 1, .36, 1) backwards;
}
.wallet-main-actions { animation-delay: 70ms; }
.wallet-promo { animation-delay: 130ms; }
.wallet-content > .wallet-actions { animation-delay: 190ms; }
.wallet-recovery-reset-text { animation-delay: 220ms; }
.wallet-transactions-heading { animation-delay: 250ms; }
.wallet-recent-chats { animation-delay: 290ms; }
.wallet-daily-quote { animation-delay: 350ms; }
.wallet-content > section { animation-delay: 410ms; }
@media (prefers-reduced-motion: reduce) {
  .wallet-hero > section,
  .wallet-main-actions,
  .wallet-promo,
  .wallet-content > .wallet-actions,
  .wallet-recovery-reset-text,
  .wallet-transactions-heading,
  .wallet-recent-chats,
  .wallet-daily-quote,
  .wallet-content > section { animation: none; }
}

.wallet-content { padding-bottom: calc(110px + env(safe-area-inset-bottom)); }
.wallet-nav { position: fixed; inset: auto 0 0; z-index: 20; align-items: end; background: var(--glass-surface); border-top: 1px solid var(--glass-border); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); padding: 12px 8px max(12px, env(safe-area-inset-bottom)); }
.wallet-nav > a { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 6px; min-height: 44px; text-decoration: none; font-size: 11px; color: var(--wallet-ink); }
.wallet-nav > a > svg { width: 23px; height: 23px; stroke-width: 1.7; }
.wallet-nav-home { font-weight: 600; }
.wallet-home-orb { display: grid; place-items: center; width: 63px; height: 63px; margin-top: -35px; border-radius: 50%; border: 4px solid var(--glass-surface); background: var(--wallet-home-gradient); box-shadow: var(--wallet-call-shadow); color: var(--wallet-white); }
.wallet-home-orb svg { width: 28px; height: 28px; }
.wallet-nav > a:focus-visible { outline: 2px solid var(--primary); outline-offset: 3px; border-radius: var(--radius); }

.wallet-chat-avatar { display: grid; place-items: center; }
.wallet-chat-avatar--transfer { background: var(--wallet-transfer); color: var(--wallet-transfer-ink); }
.wallet-chat-avatar--topup { background: var(--wallet-topup); color: var(--wallet-topup-ink); }
.wallet-chat-avatar--payment { background: var(--wallet-payment); color: var(--wallet-payment-ink); }

/* Full-screen gradient reveal before the white homepage sheet settles in. */
.wallet-phone::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background: var(--wallet-wave-colors), var(--wallet-wave-base);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  animation: wallet-intro-backdrop 1.25s ease both;
}
.wallet-content {
  animation: wallet-sheet-enter 950ms cubic-bezier(.22, 1, .36, 1) 220ms backwards;
}
.wallet-content > .wallet-actions { animation-delay: 450ms; }
.wallet-recovery-reset-text { animation-delay: 480ms; }
.wallet-transactions-heading { animation-delay: 510ms; }
.wallet-recent-chats { animation-delay: 550ms; }
.wallet-daily-quote { animation-delay: 610ms; }
.wallet-content > section { animation-delay: 670ms; }
.wallet-nav { animation: wallet-enter 600ms cubic-bezier(.22, 1, .36, 1) 750ms backwards; }
@keyframes wallet-sheet-enter {
  from { transform: translateY(100dvh); }
  to { transform: translateY(0); }
}
@keyframes wallet-intro-backdrop {
  0%, 80% { opacity: 1; }
  100% { opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .wallet-phone::before { content: none; animation: none; }
  .wallet-content, .wallet-nav { animation: none; }
}

@keyframes wallet-promo-enter {
  from { opacity: 0; transform: translateX(100%); }
  to { opacity: 1; transform: translateX(0); }
}
.wallet-promo { animation: wallet-promo-enter 750ms cubic-bezier(.22, 1, .36, 1) 350ms backwards; }
@media (prefers-reduced-motion: reduce) {
  .wallet-promo { animation: none; }
}

/* One continuous gradient underneath both the hero and entering content. */
.wallet-phone { background: var(--wallet-wave-base); }
.wallet-phone::before {
  position: fixed;
  inset: -25%;
  background: var(--wallet-wave-colors);
  filter: blur(22px);
  transform-origin: center;
  animation: wallet-color-wave 7s ease-in-out infinite alternate;
}
.wallet-intro { background: transparent; }
.wallet-intro::before { content: none; }
@media (prefers-reduced-motion: reduce) {
  .wallet-phone::before { content: ""; animation: none; }
}

.home-v3 { position: relative; width: 100%; height: 100dvh; min-height: 100svh; overflow: hidden; isolation: isolate; background: var(--v3-background); }
.home-v3-shade { position: absolute; inset: 38% 8% -5%; border-radius: 5%; background: var(--v3-shadow); filter: blur(clamp(28px, 8vw, 65px)); }

.home-v3-reveal { position: absolute; inset: 0; animation: v3-rise 3.2s cubic-bezier(.16, 1, .3, 1) both; }
.home-v3-shade { transform-origin: 50% 85%; animation: v3-breathe 6s ease-in-out 3.2s infinite alternate; }
.home-v3::after { content: ""; position: absolute; inset: -10%; pointer-events: none; background: var(--v3-glow); opacity: .35; animation: v3-glow 8s ease-in-out infinite alternate; }
@keyframes v3-rise {
  from { opacity: .72; transform: translateY(12vh); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes v3-breathe {
  from { transform: translateY(0) scaleX(1); opacity: 1; }
  to { transform: translateY(-3.5vh) scale(1.075, 1.025); opacity: .9; }
}
@keyframes v3-glow {
  from { opacity: .25; transform: scale(1); }
  to { opacity: .65; transform: scale(1.025); }
}
@media (prefers-reduced-motion: reduce) {
  .home-v3-reveal, .home-v3-shade, .home-v3::after { animation: none; }
}

.home-v3-status { position: relative; z-index: 1; padding: max(16px, env(safe-area-inset-top)) 18px 0; }
.home-v3-status .availability-trigger--hero { color: var(--wallet-white); }

.home-v3-actions { position: relative; z-index: 1; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-3); padding: 0 18px; margin-top: var(--space-8); }
.home-v3-contact { position: relative; display: flex; flex-direction: column; align-items: flex-start; justify-content: space-between; min-height: 154px; padding: var(--space-5); border-radius: 24px; background: var(--v3-control); border: 1px solid var(--v3-control-border); color: var(--wallet-white); text-decoration: none; backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); transition: transform .2s ease, border-color .2s ease; }
.home-v3-contact-icon { color: var(--v3-control-accent); }
.home-v3-contact-copy { display: flex; flex-direction: column; gap: var(--space-1); }
.home-v3-contact-copy strong { font-family: Inter, sans-serif; font-size: 20px; font-weight: 500; }
.home-v3-contact-copy small { font-size: var(--text-label); color: var(--v3-control-muted); }
.home-v3-contact-arrow { position: absolute; right: var(--space-4); top: var(--space-5); color: var(--v3-control-muted); }
.home-v3-contact:hover { border-color: var(--v3-control-accent); }
.home-v3-contact:active { transform: scale(.98); }
.home-v3-contact:focus-visible { outline: 2px solid var(--v3-control-accent); outline-offset: 4px; }
@media (prefers-reduced-motion: reduce) { .home-v3-contact { transition: none; } }


.home-v3-sos { position: relative; z-index: 1; display: flex; align-items: center; justify-content: space-between; gap: var(--space-4); margin: var(--space-4) 18px 0; padding: var(--space-5); border-radius: 28px; background: var(--v3-sos-surface); color: var(--wallet-white); }
.home-v3-sos-copy { display: flex; flex-direction: column; gap: var(--space-2); font-size: var(--text-body); line-height: 1.4; }
.home-v3-sos-label { display: inline-flex; align-items: center; gap: var(--space-1); font-size: var(--text-label); font-weight: 600; }
.home-v3-sos-button { display: grid; place-items: center; min-width: 64px; min-height: 44px; padding: var(--space-2) var(--space-4); flex-shrink: 0; border-radius: var(--radius-pill); background: var(--sos-background); color: var(--wallet-white); font-size: var(--text-body); font-weight: 600; text-decoration: none; }
.home-v3-sos-button:focus-visible { outline: 2px solid var(--wallet-white); outline-offset: 3px; }

.home-v3-recovery { position: relative; z-index: 1; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-3); margin: var(--space-4) 18px 0; }
.home-v3-recovery-card { min-height: 112px; display: flex; flex-direction: column; justify-content: space-between; gap: var(--space-3); padding: var(--space-4); border-radius: 24px; background: var(--v3-control); border: 1px solid var(--v3-control-border); color: var(--wallet-white); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }
.home-v3-recovery-card > svg { color: var(--v3-control-accent); }
.home-v3-recovery-card h2 { margin: 0; font-family: Inter, sans-serif; font-size: 16px; font-weight: 500; color: inherit; }
.home-v3-recovery-card p { margin: var(--space-1) 0 0; font-size: var(--text-label); color: var(--v3-control-muted); }

.home-v3 { height: auto; min-height: 100dvh; }
.home-v3-chats { position: relative; z-index: 1; margin: var(--space-5) 18px var(--space-4); color: var(--wallet-white); }
.home-v3-chat { display: flex; align-items: center; gap: var(--space-4); padding: var(--space-4) 0; }
.home-v3-chat-icon { flex-shrink: 0; margin-inline: var(--space-2); color: var(--wallet-white); }
.home-v3-chat-copy { display: flex; flex-direction: column; gap: var(--space-1); flex: 1; min-width: 0; }
.home-v3-chat-copy strong { font-size: var(--text-body); font-weight: 500; }
.home-v3-chat-copy > span { font-size: var(--text-label); color: var(--v3-control-muted); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.home-v3-chat-time { align-self: flex-start; padding-top: 2px; color: var(--v3-control-muted); font-size: var(--text-label); white-space: nowrap; }

.home-v3-contact { min-height: 88px; flex-direction: row; align-items: center; justify-content: flex-start; gap: var(--space-2); padding: var(--space-4); }
.home-v3-contact-icon { flex-shrink: 0; width: 22px; height: 22px; }
.home-v3-contact-copy { min-width: 0; }
.home-v3-contact-copy strong { font-size: 17px; }
.home-v3-contact-arrow { display: none; }

.wallet-daily-quote.home-v3-quote { position: relative; z-index: 1; margin: 0 18px var(--space-4); padding: var(--space-5); border-radius: 24px; background: var(--v3-control); border: 1px solid var(--v3-control-border); color: var(--wallet-white); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); animation: none; }
.home-v3-quote figcaption { color: var(--wallet-white); }
.home-v3-quote .wallet-quote-icon { background: transparent; color: var(--v3-control-accent); width: 24px; height: 24px; }
.home-v3-quote .wallet-quote-icon svg { width: 24px; height: 24px; }
.home-v3-quote blockquote { margin-top: var(--space-5); font-weight: 400; }

.home-v3-buddy { position: relative; z-index: 1; margin: 0 18px var(--space-8); }
.home-v3-buddy .wallet-buddy-cta { background: var(--v3-control); color: var(--wallet-white); border-color: var(--wallet-line); box-shadow: none; }
.home-v3-buddy .wallet-buddy-cta .availability-icon { background: transparent; color: var(--wallet-white); }
.home-v3-buddy .wallet-buddy-cta .status-option-description, .home-v3-buddy .wallet-buddy-cta > svg { color: var(--wallet-white); }
.home-v3-buddy .wallet-buddy-cta:hover { background: var(--v3-control); filter: brightness(1.1); }

.home-v3-actions { margin-top: var(--space-4); }

.home-v3-sos-button { background: var(--v3-sos-button); box-shadow: var(--v3-sos-glow); }

.home-v3-recovery-reset { position: relative; z-index: 1; margin-right: 18px; color: var(--v3-control-muted); animation: none; }
.home-v3-recovery-reset:hover { color: var(--wallet-white); }
.home-v3-recovery-reset + .home-v3-chats { margin-top: var(--space-2); }

.home-v3-chats-heading { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); }
.home-v3-chats-heading h2 { margin: 0; font-size: 17px; font-weight: 600; color: inherit; }
.home-v3-chats-heading button { border: 0; background: none; padding: var(--space-2) 0; color: var(--v3-control-muted); font: inherit; font-size: var(--text-body); cursor: pointer; }
.home-v3-chats-heading button:hover { color: var(--wallet-white); }
/* Stagger the cards individually, matching the V2 entrance rhythm. */
@keyframes v3-element-enter {
  from { opacity: 0; transform: translateY(48px) scale(.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.home-v3-status, .home-v3-contact, .home-v3-recovery-card, .home-v3-recovery-reset,
.home-v3-chats-heading, .home-v3-chat, .wallet-daily-quote.home-v3-quote, .home-v3-buddy {
  animation: v3-element-enter 950ms cubic-bezier(.22, 1, .36, 1) backwards;
}
.home-v3-status { animation-delay: 80ms; }
.home-v3-contact:nth-child(1) { animation-delay: 220ms; }
.home-v3-contact:nth-child(2) { animation-delay: 320ms; }
.home-v3-sos { animation: wallet-promo-enter 1000ms cubic-bezier(.22, 1, .36, 1) 420ms backwards; }
.home-v3-recovery-card:nth-child(1) { animation-delay: 570ms; }
.home-v3-recovery-card:nth-child(2) { animation-delay: 660ms; }
.home-v3-recovery-card:nth-child(3) { animation-delay: 750ms; }
.home-v3-recovery-reset { animation-delay: 810ms; }
.home-v3-chats-heading { animation-delay: 870ms; }
.home-v3-chat:nth-child(2) { animation-delay: 950ms; }
.home-v3-chat:nth-child(3) { animation-delay: 1040ms; }
.home-v3-chat:nth-child(4) { animation-delay: 1130ms; }
.wallet-daily-quote.home-v3-quote { animation-delay: 1220ms; }
.home-v3-buddy { animation-delay: 1320ms; }
@media (prefers-reduced-motion: reduce) {
  .home-v3-status, .home-v3-contact, .home-v3-sos, .home-v3-recovery-card,
  .home-v3-recovery-reset, .home-v3-chats-heading, .home-v3-chat,
  .wallet-daily-quote.home-v3-quote, .home-v3-buddy { animation: none; }
}

.home-v3 { padding-bottom: calc(100px + env(safe-area-inset-bottom)); }
.home-v3-nav { background: var(--v3-nav-surface); border-color: var(--v3-control-border); box-shadow: none; animation-delay: 1400ms; }
.home-v3-nav > a { color: var(--v3-control-muted); }
.home-v3-nav > a:hover, .home-v3-nav > a[aria-current] { color: var(--wallet-white); }
.home-v3-nav .wallet-home-orb { background: var(--v3-nav-home); border-color: var(--v3-nav-surface); box-shadow: var(--v3-nav-glow); }
.home-v3-nav > a:focus-visible { outline-color: var(--v3-control-accent); }
.home-v3-nav--preview { position: relative; margin-top: var(--space-8); animation: none; }

.home-v3-recovery-reset, .home-v3-chats-heading button { color: var(--wallet-white); }

.wallet-transactions-heading h2 { display: flex; align-items: center; gap: var(--space-2); }
.wallet-transactions-heading h2 > svg { color: var(--wallet-muted); flex-shrink: 0; }

.wallet-v2 .wallet-home-orb { border-color: var(--wallet-home-ring); box-shadow: var(--wallet-home-glow); }

.wallet-helping-outline { position: absolute; width: 230px; height: 230px; right: -12px; top: 4px; z-index: -1; color: var(--wallet-white); opacity: var(--wallet-helping-opacity); pointer-events: none; }

.wallet-helping-preview { position: relative; height: 230px; background: var(--wallet-hero-gradient); isolation: isolate; }

/* Status transition remains behind the hero controls and SOS strip. */
.wallet-intro::after { content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none; background: var(--wallet-hard-gradient); opacity: 0; transition: opacity 1200ms ease; }
.wallet-v2--hard .wallet-intro::after { opacity: 1; }
.wallet-difficult-outline { opacity: var(--wallet-hard-illustration-opacity); animation: wallet-enter 1200ms ease backwards; }
.wallet-difficult-head { transform-box: view-box; transform-origin: 160px 78px; animation: wallet-head-lower 2200ms cubic-bezier(.22, 1, .36, 1) both; }
.wallet-difficult-body { transform-box: view-box; transform-origin: 173px 151px; animation: wallet-quiet-breath 5500ms ease-in-out 2200ms infinite alternate; }
@keyframes wallet-head-lower { from { transform: rotate(12deg) translateY(-2px); } to { transform: rotate(-9deg) translateY(2px); } }
@keyframes wallet-quiet-breath { from { transform: translateY(0) rotate(0); } to { transform: translateY(2px) rotate(-1.5deg); } }
@media (prefers-reduced-motion: reduce) {
  .wallet-intro::after { transition: none; }
  .wallet-difficult-outline, .wallet-difficult-head, .wallet-difficult-body { animation: none; }
  .wallet-difficult-head { transform: rotate(-9deg) translateY(2px); }
}

.wallet-helping-preview--hard { background: var(--wallet-hard-gradient); }

.wallet-v2 .wallet-transactions-heading > button { color: var(--wallet-hero-ink); font-weight: 500; }

.wallet-content > .wallet-main-actions { margin-top: var(--space-4); margin-bottom: var(--space-6); animation-delay: 510ms; }
.wallet-content .wallet-main-actions .wallet-chat-secondary { border: 1px solid var(--wallet-call-border); box-shadow: var(--wallet-call-shadow); }
.wallet-v2 .wallet-hero .wallet-helping-outline { width: 150px; height: 150px; right: 8px; top: 0; }

.wallet-v2 .wallet-recovery-reset-text + .wallet-daily-quote { margin-top: var(--space-2); }

.availability-trigger.buddy-qr-icon-button { display: grid; place-items: center; width: 44px; height: 44px; min-height: 44px; padding: 0; border-radius: var(--radius-pill); border: 1px solid var(--wallet-line); background: var(--wallet-glass); color: var(--wallet-hero-ink); box-shadow: none; }
.buddy-qr-icon-button .availability-icon { width: auto; height: auto; background: none; color: inherit; }
.buddy-qr-icon-button:hover { background: var(--wallet-white); }
.buddy-qr-icon-button:focus-visible { outline: 2px solid var(--wallet-hero-ink); outline-offset: 3px; }
.wallet-hero > .buddy-qr-icon-wrapper { position: absolute; bottom: calc(16px + clamp(14.95px, 4.025vw, 23px)); left: 18px; z-index: 2; }

/* Calm horizon and translucent water layers for V3. */
.home-v3 { background: var(--v3-shore-near); }
.home-v3::after { content: none; }
.v3-landscape { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; background: var(--v3-landscape-sky); }
.v3-landscape-light { position: absolute; inset: -8%; background: var(--v3-landscape-light); animation: v3-horizon-drift 22s ease-in-out infinite alternate; }
.v3-landscape-water { position: absolute; inset: 34% 0 0; background: var(--v3-landscape-water); }
.v3-landscape-shores { position: absolute; inset: 27% -8% 0; width: 116%; height: 73%; filter: blur(3px); animation: v3-horizon-drift 26s ease-in-out infinite alternate; }
.v3-shore-far { fill: var(--v3-shore-far); opacity: .25; }
.v3-shore-middle { fill: var(--v3-shore-middle); opacity: .35; }
.v3-shore-near { fill: var(--v3-shore-near); opacity: .65; }
.v3-landscape-ripples { position: absolute; top: 35%; left: -8%; width: 116%; height: 65%; fill: none; stroke: var(--v3-ripple); stroke-width: .7; opacity: .19; animation: v3-water-drift 18s ease-in-out infinite alternate; }
.v3-landscape-scrim { position: absolute; inset: 0; background: var(--v3-landscape-scrim); }
@keyframes v3-horizon-drift { from { transform: translateX(-1%) scale(1.02); } to { transform: translateX(1%) scale(1.04); } }
@keyframes v3-water-drift { from { transform: translate(-1%, 0); } to { transform: translate(1%, 5px); } }
@media (prefers-reduced-motion: reduce) { .v3-landscape-light, .v3-landscape-shores, .v3-landscape-ripples { animation: none; } }

.home-v3-status > .buddy-qr-icon-wrapper { position: absolute; top: max(16px, env(safe-area-inset-top)); left: 18px; z-index: 2; }
.home-v3-status .buddy-qr-icon-button { background: var(--v3-control); border-color: var(--v3-control-border); color: var(--wallet-white); }
.home-v3-status .buddy-qr-icon-button:hover { background: var(--v3-control); filter: brightness(1.15); }
.home-v3-status .buddy-qr-icon-button:focus-visible { outline-color: var(--v3-control-accent); }

/* V3 follows the V2 content order, retaining its dark cards. */
.home-v3-recovery-reset + .home-v3-quote { margin-top: var(--space-2); margin-bottom: 0; }
.home-v3-chats-heading h2 { display: flex; align-items: center; gap: var(--space-2); }
.home-v3-sos { animation-delay: 180ms; }
.home-v3-recovery-card:nth-child(1) { animation-delay: 330ms; }
.home-v3-recovery-card:nth-child(2) { animation-delay: 420ms; }
.home-v3-recovery-card:nth-child(3) { animation-delay: 510ms; }
.home-v3-recovery-reset { animation-delay: 570ms; }
.wallet-daily-quote.home-v3-quote { animation-delay: 640ms; }
.home-v3-contact:nth-child(1) { animation-delay: 760ms; }
.home-v3-contact:nth-child(2) { animation-delay: 850ms; }
.home-v3-chats-heading { animation-delay: 940ms; }
.home-v3-chat:nth-child(2) { animation-delay: 1020ms; }
.home-v3-chat:nth-child(3) { animation-delay: 1110ms; }
.home-v3-chat:nth-child(4) { animation-delay: 1200ms; }

.wallet-v2 .wallet-daily-quote,
.wallet-v2 .wallet-daily-quote figcaption,
.wallet-v2 .wallet-buddy-cta .availability-current,
.wallet-v2 .wallet-buddy-cta .status-option-description { color: var(--wallet-ink); }

.home-v3 { background: var(--wallet-white); }
.v3-landscape { opacity: var(--v3-landscape-opacity); }

.home-v3-contact,
.home-v3-recovery-card,
.home-v3-buddy .wallet-buddy-cta,
.home-v3-buddy .wallet-buddy-cta:hover,
.home-v3-status .buddy-qr-icon-button,
.home-v3-status .buddy-qr-icon-button:hover,
.home-v3-nav .wallet-home-orb { background: var(--v3-sos-surface); }

.home-v3-contact,
.home-v3-recovery-card,
.home-v3-buddy .wallet-buddy-cta,
.home-v3-status .buddy-qr-icon-button { border-color: transparent; background-origin: border-box; background-clip: border-box; }
.home-v3-contact:hover { border-color: transparent; }

.wallet-daily-quote.home-v3-quote { background: var(--v3-sos-surface); border-color: transparent; background-origin: border-box; background-clip: border-box; }


/* Shared V2 screen system: pastel header, white sheet, green actions. */
.nordic-bg { isolation: isolate; background: var(--v2-page-surface); }
.nordic-bg::before { background-image: var(--v2-page-surface), var(--app-bg-image); background-size: 100% 420px; background-position: top center; }
.nordic-bg::after { content: none; }
.nordic-bg .app-content { background: var(--wallet-white); border-radius: var(--v2-sheet-radius) var(--v2-sheet-radius) 0 0; padding-top: var(--space-6); }
.nordic-bg .screen-heading { padding-top: var(--space-3); padding-bottom: var(--space-6); }
.nordic-bg .screen-heading .screen-title { font-size: var(--text-heading); font-weight: 650; letter-spacing: -.6px; color: var(--wallet-hero-ink); }
.nordic-bg .screen-heading > a { background: var(--wallet-glass); border-color: var(--wallet-line); width: var(--control-height); height: var(--control-height); }
.nordic-bg .ui-glass-panel { --primary: var(--wallet-call-surface); --color-primary: var(--wallet-call-surface); background: var(--wallet-buddy-surface); color: var(--wallet-ink); border-color: var(--border); }
.nordic-bg :is(.card-soft, .ui-card) { background: var(--wallet-buddy-surface); }
.ui-button { border-radius: var(--radius-pill); min-height: 49px; }
.ui-button--primary { background: var(--wallet-call-surface); border-color: var(--wallet-call-border); box-shadow: var(--wallet-call-shadow); }
.ui-button--secondary { background: var(--wallet-white); border-color: var(--wallet-call-border); color: var(--wallet-hero-ink); box-shadow: var(--wallet-call-shadow); }
.ui-icon-button { min-height: var(--control-height); }
.ui-field { background: var(--wallet-white); border-color: var(--wallet-call-border); }
.ui-chip[aria-pressed="true"], .nordic-bg .app-content > div > .flex > button.ui-chip[aria-pressed="true"] { background: var(--wallet-call-surface); color: var(--wallet-white); border-color: var(--wallet-call-border); }
.nordic-bg .availability-icon { border-radius: var(--radius-pill); background: var(--wallet-payment); color: var(--wallet-hero-ink); }
.status-dialog { font-family: var(--font-sans); background: var(--wallet-payment); }
.status-dialog .ui-field { background: var(--wallet-white); }
.status-dialog .status-close { color: var(--wallet-hero-ink); }
.status-dialog .status-option[aria-pressed="true"] { background: var(--wallet-call-surface); color: var(--wallet-white); }
.status-dialog .status-option[aria-pressed="true"] .status-option-description { color: var(--wallet-white); }
.wallet-modal { background: var(--wallet-payment); color: var(--wallet-ink); border: 1px solid var(--wallet-line); border-radius: var(--radius); box-shadow: var(--wallet-shadow); }
.wallet-modal-backdrop, .wallet-modal::backdrop { background: var(--v2-dialog-backdrop); backdrop-filter: blur(8px); }
.wallet-modal > button { border-radius: var(--radius-pill); min-width: var(--control-height); min-height: var(--control-height); display: grid; place-items: center; background: var(--wallet-white); color: var(--wallet-hero-ink); }
.people-filter-footer, .screen-composer { background: var(--wallet-white); }
.app-tab-bar { background: var(--wallet-white); border-top: 1px solid var(--border); padding-top: var(--space-3); }
.app-tab-bar > ul { height: 64px; padding-bottom: var(--space-3); }
.app-tab-bar .app-tab-item { color: var(--wallet-ink); gap: var(--space-2); }
.nordic-bg .app-tab-bar .app-tab-item[aria-current="page"] { background: var(--wallet-buddy-surface); color: var(--wallet-hero-ink); }
.app-tab-home-link .app-tab-home, .app-tab-home-link:not([aria-current="page"]) .app-tab-home { width: 63px; height: 63px; margin-top: -35px; border: 4px solid var(--wallet-home-ring); background: var(--wallet-home-gradient); color: var(--wallet-white); box-shadow: var(--wallet-home-glow); }
.app-tab-home svg { width: 28px; height: 28px; }
.app-tab-home-link { gap: var(--space-2); }
.app-tab-bar .app-tab-home-link > span:last-child { color: var(--wallet-ink); }
@media (prefers-reduced-motion: no-preference) {
  .nordic-bg .app-content, .status-dialog[open] .status-dialog-content { animation: v2-screen-enter .45s ease-out both; }
}
@keyframes v2-screen-enter { from { opacity: 0; translate: 0 10px; } to { opacity: 1; translate: 0 0; } }
/* Keep the raised Home button clear of message fields. */
.screen-composer { padding-bottom: var(--space-6); }
.screen-with-composer { padding-bottom: calc(var(--tab-bar-height) + var(--control-height) + var(--space-8) + var(--space-6) + env(safe-area-inset-bottom, 0px)); }

/* Group links share the homepage buddy action's surface and proportions. */
.availability-trigger.wallet-buddy-cta.ui-group-card { margin: 0; text-decoration: none; }
.ui-group-card .availability-copy { gap: var(--space-1); }
.ui-group-card .availability-current, .ui-group-card .status-option-description { color: var(--wallet-ink); }
.nordic-bg .ui-group-card .availability-icon { background: var(--wallet-white); color: var(--wallet-hero-ink); }
.ui-group-card-heading { display: flex; align-items: baseline; gap: var(--space-1); }
.ui-group-card .availability-current { line-height: 1.4; overflow-wrap: anywhere; }
.ui-group-card-meta { display: flex; flex-wrap: wrap; gap: var(--space-1) var(--space-3); margin-top: var(--space-1); font-size: var(--text-label); line-height: 1.5; color: var(--muted-foreground); }
.ui-group-card-live { display: inline-flex; align-items: center; gap: var(--space-1); color: var(--wallet-hero-ink); font-weight: 500; }
.ui-group-card-live i { width: 5px; height: 5px; border-radius: var(--radius-pill); background: currentColor; }

.ui-person-card { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-4); text-decoration: none; color: var(--wallet-ink); }
.ui-person-card-content { flex: 1; min-width: 0; }
.ui-person-card > svg { color: var(--wallet-hero-ink); }
.ui-person-card:hover { filter: brightness(.98); }

.people-filter-toolbar { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-3); }
.people-filter-toolbar > .card-soft { min-width: 0; }
.people-filter-trigger { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: var(--space-1); width: 100%; min-height: 80px; padding: var(--space-3); text-align: left; }
.people-filter-trigger-label { display: flex; align-items: center; gap: var(--space-1); font-size: var(--text-label); font-weight: 500; color: var(--wallet-hero-ink); }
.people-filter-trigger-label svg { flex-shrink: 0; }

.nordic-bg .people-page .card-soft { background: var(--wallet-white); }

.app-sos-header .people-header-search { min-height: var(--control-height); padding: var(--space-2) var(--space-3); font-size: var(--text-label); }

.people-gradient-canvas { background: transparent; }
.people-gradient-canvas::before { background-image: var(--people-gradient); background-size: cover; }
.nordic-bg.people-gradient-canvas .app-content { background: var(--people-content-glass); }

.home-v4 { min-height: 100dvh; padding-bottom: calc(100px + env(safe-area-inset-bottom)); background: var(--v4-canvas); color: var(--v4-ink); font-family: var(--font-sans); }
.home-v4-content { position: relative; max-width: 600px; margin: -8px auto 0; padding: var(--space-6) var(--space-4); border-radius: 24px 24px 0 0; background: var(--v4-canvas); }
.home-v4-recovery { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-2); }
.home-v4-recovery article { display: grid; justify-items: center; gap: var(--space-2); background: var(--v4-card); border-radius: var(--v4-card-radius); padding: var(--space-3) var(--space-2); }
.home-v4-recovery h2 { font-size: var(--text-body); font-weight: 600; margin: 0; }
.home-v4-recovery p { font-size: var(--text-label); margin: 0; }
.home-v4-recovery-icon { display: grid; place-items: center; width: 40px; height: 40px; background: var(--wallet-white); border-radius: var(--radius-pill); }
.home-v4-reset { display: flex; align-items: center; gap: var(--space-1); width: fit-content; margin: var(--space-2) 0 var(--space-4) auto; color: var(--v4-muted); font-size: var(--text-label); text-underline-offset: 4px; text-decoration: underline dotted; }
.home-v4-quote { margin: var(--space-6) 0 0; }
.home-v4-quote figcaption { display: flex; gap: var(--space-2); align-items: center; font-size: var(--text-body); font-weight: 600; }
.home-v4-quote figcaption > span { display: grid; place-items: center; width: 32px; height: 32px; border-radius: var(--radius-pill); color: var(--v4-action-ink); background: var(--v4-card); }
.home-v4-quote blockquote { margin: var(--space-3) 0 0; font-size: var(--text-body); line-height: 1.6; }
.home-v4-contact { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-4); margin: var(--space-6) 0 var(--space-1); }
.home-v4-contact .ui-button { width: 100%; min-height: 46px; font-size: var(--text-body); }
.home-v4-call { background: var(--v4-primary); color: var(--wallet-white); }
.home-v4-chat { background: var(--wallet-white); border: 1px solid var(--v4-primary); color: var(--v4-action-ink); }
.home-v4-contact p { display: flex; align-items: center; justify-content: center; gap: var(--space-1); font-size: 11px; color: var(--v4-muted); margin-top: var(--space-2); }
.home-v4-contact i { width: 5px; height: 5px; border-radius: var(--radius-pill); background: var(--v4-primary); }
.home-v4-chats-heading { display: flex; justify-content: space-between; align-items: center; gap: var(--space-3); }
.home-v4-chats-heading h2 { font-size: 18px; font-weight: 600; margin: 0; letter-spacing: -.5px; }
.home-v4-chats-heading > a { display: inline-flex; align-items: center; min-height: var(--control-height); font-size: var(--text-label); font-weight: 600; }
.home-v4-chats ul { padding: 0; margin: 0; list-style: none; }
.home-v4-chats li + li { border-top: 1px solid var(--v4-line); }
.home-v4-chats li button { display: flex; align-items: center; width: 100%; gap: var(--space-3); padding: var(--space-4) 0; text-align: left; }
.home-v4-avatar { width: 44px; height: 44px; display: grid; place-items: center; flex-shrink: 0; border-radius: var(--radius-pill); background: var(--v4-primary); color: var(--wallet-white); }
.home-v4-chat-copy { flex: 1; min-width: 0; display: grid; gap: var(--space-1); font-size: var(--text-label); }
.home-v4-chat-copy strong { font-size: var(--text-body); font-weight: 600; }
.home-v4-chat-copy > span { color: var(--v4-muted); line-height: 1.5; }
.home-v4-chats time { font-size: 10px; color: var(--v4-muted); flex-shrink: 0; }
.home-v4-dialog { margin: auto; background: var(--v4-canvas); color: var(--v4-ink); }
.home-v4-dialog form { display: flex; justify-content: flex-end; }
.home-v4-dialog h2 { font-size: var(--text-title); font-weight: 600; margin: var(--space-3) 0; }
@media (prefers-reduced-motion: no-preference) { .home-v4-content { animation: v2-screen-enter .5s ease-out both; } }


@media (prefers-reduced-motion: no-preference) {
  .home-v4-recovery article, .home-v4-recovery-icon, .home-v4-quote, .home-v4-quote figcaption > span, .home-v4-contact .ui-button, .home-v4-contact p, .home-v4-contact i, .home-v4-avatar, .home-v4-chat-copy > span, .home-v4-chats time, .home-v4-chats li, .home-v4-reset, .home-v4-nav, .home-v4-nav > a, .home-v4-nav .wallet-home-orb { transition: background-color .7s ease, color .7s ease, border-color .7s ease; }
}

/* V4 screen variant: compact green header and flat sage surfaces. */
.nordic-bg.app-v4 { background: var(--v4-canvas); color: var(--v4-ink); }
.nordic-bg.app-v4::before { background: var(--v4-primary); height: 100px; bottom: auto; }
.app-v4 .app-sos-header { background: var(--v4-primary); box-shadow: none; backdrop-filter: none; }
.app-v4 .app-sos-header > div { max-width: 600px; }
.app-v4 > .mx-auto { max-width: 600px; }
.app-v4 .app-content { background: var(--v4-canvas); border-radius: 24px 24px 0 0; padding: var(--space-6) var(--space-4); }
.app-v4 .people-header-search { background: transparent; color: var(--wallet-white); border-color: transparent; box-shadow: none; }
.app-v4 .sos-pulse { box-shadow: none; animation: none; }
.app-v4 :is(.card-soft, .ui-card), .nordic-bg.app-v4 .people-page .card-soft { background: var(--v4-card); border: 0; border-radius: var(--v4-card-radius); box-shadow: none; }
.app-v4 .people-filter-trigger { min-height: 68px; padding-block: var(--space-2); }
.app-v4 .people-filter-trigger-label { color: var(--v4-action-ink); }
.app-v4 .people-results { margin-top: var(--space-3); }
.app-v4 .people-results > li + li { border-top: 1px solid var(--v4-line); }
.nordic-bg.app-v4 .people-results .ui-person-card { background: transparent; padding: var(--space-5) 0; border-radius: 0; }
.app-v4 .ui-person-card-content > div > .flex { flex-wrap: wrap; }
.app-v4 .ui-person-card-content .truncate { white-space: normal; }
.app-v4 .ui-person-card > svg { color: var(--v4-action-ink); }

.app-v4 .ui-button { box-shadow: none; }
.app-v4 .status-dialog { background: var(--v4-canvas); }
.app-v4 .people-filter-footer { background: var(--v4-canvas); border-color: var(--v4-line); }
.app-v4 .app-tab-bar { background: var(--v4-canvas); border-color: var(--v4-line); box-shadow: none; backdrop-filter: none; padding-top: var(--space-2); }
.app-v4 .app-tab-bar > ul { max-width: 600px; height: 60px; }
.app-v4 .app-tab-bar .app-tab-item { color: var(--v4-ink); }
.nordic-bg.app-v4 .app-tab-bar .app-tab-item[aria-current="page"] { background: transparent; color: var(--v4-action-ink); }
.app-v4 .app-tab-home-link .app-tab-home { width: 52px; height: 52px; margin-top: -25px; border: 0; box-shadow: none; background: var(--v4-primary); }
.app-v4 .app-tab-home svg { width: 22px; height: 22px; }

.people-name-row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-1) var(--space-2); }
.people-last-contact { display: inline-flex; flex-shrink: 0; white-space: nowrap; align-items: center; gap: var(--space-1); color: var(--muted-foreground); font-size: var(--text-label); line-height: 1.5; }
.people-last-contact svg { flex-shrink: 0; color: var(--primary); }

.ui-contact-switch { display: flex; gap: var(--space-1); padding: var(--space-1); border: 1px solid var(--border); border-radius: var(--radius-pill); background: var(--wallet-white); }
.ui-contact-switch button { flex: 1; display: flex; align-items: center; justify-content: center; gap: var(--space-2); min-height: var(--control-height); padding: var(--space-2) var(--space-3); border-radius: var(--radius-pill); color: var(--muted-foreground); font-size: var(--text-body); font-weight: 500; }
.ui-contact-switch button[aria-pressed="true"] { background: var(--primary); color: var(--primary-foreground); }
.ui-contact-switch button:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }

/* Shared V4 titles, forms, dialogs and conversation surfaces. */
.nordic-bg.app-v4::before { height: 260px; }
.nordic-bg.app-v4 .screen-heading { background: var(--v4-primary); padding: var(--space-2) var(--space-4) var(--space-5); color: var(--wallet-white); }
.nordic-bg.app-v4 .screen-heading .screen-title { color: var(--wallet-white); font-size: var(--text-title); letter-spacing: -.3px; }
.app-v4 .screen-heading .text-muted-foreground { color: var(--wallet-white); opacity: .8; }
.nordic-bg.app-v4 .screen-heading > a { background: transparent; border-color: currentColor; color: var(--wallet-white); }
.app-v4 :is(.card-soft, .ui-card, .ui-glass-panel, .ui-field, .ui-chip, .availability-trigger, .wallet-buddy-cta) { box-shadow: none; backdrop-filter: none; }
.nordic-bg.app-v4 .ui-glass-panel { background: var(--v4-card); color: var(--v4-ink); border-color: var(--v4-line); border-radius: var(--v4-card-radius); }
.app-v4 .ui-button--primary { background: var(--v4-primary); border-color: transparent; }
.app-v4 .ui-button--secondary { background: var(--wallet-white); border-color: var(--v4-action-ink); color: var(--v4-action-ink); }
.app-v4 .ui-field { border-color: var(--v4-line); border-radius: var(--v4-card-radius); }
.app-v4 .ui-chip { box-shadow: none; }
.app-v4 .wallet-buddy-cta { background: var(--v4-card); border: 0; border-radius: var(--v4-card-radius); }
.app-v4 .ui-group-card .availability-icon { background: var(--v4-primary); color: var(--wallet-white); }
.app-v4 .status-dialog, .app-v4 .wallet-modal { background: var(--v4-canvas); color: var(--v4-ink); }
.app-v4 .status-dialog .status-close { background: var(--v4-card); color: var(--v4-action-ink); backdrop-filter: none; }
.app-v4 .status-dialog .status-option { background: var(--v4-card); border-color: transparent; box-shadow: none; border-radius: var(--v4-card-radius); }
.app-v4 .status-dialog .status-option[aria-pressed="true"] { background: var(--v4-primary); }
.app-v4 .conversation-emblem { background: var(--v4-quote); color: var(--v4-action-ink); }
.app-v4 .conversation-preference-row { box-shadow: none; border-color: var(--v4-line); border-radius: var(--v4-card-radius); }
.app-v4 .screen-composer { background: var(--v4-canvas); border-color: var(--v4-line); padding-bottom: 0; }
.app-v4 .screen-composer-content { max-width: 600px; }
.nordic-bg.app-v4-standalone::before { background: var(--v4-canvas); height: 100%; }
.nordic-bg.app-v4-standalone { background: var(--v4-canvas); }

.nordic-bg.app-v4 .app-content { animation: none; }

.app-v4 .ui-action-link { box-shadow: none; border-radius: var(--v4-card-radius); border-color: var(--v4-line); }
.app-v4 .ui-action-cta { border-radius: var(--radius-pill); }

.onboarding-v4 :is(.rounded-2xl, .rounded-3xl) { border-radius: var(--v4-card-radius); box-shadow: none; }

.app-v4 .app-sos-header .people-header-search { background: transparent; color: var(--wallet-white); border-color: transparent; }

/* Shared page composition. Header geometry and SOS have one implementation. */
.app-page { min-height: 100dvh; background: var(--v4-canvas); color: var(--v4-ink); }
.app-page-hero { background: var(--v4-primary); color: var(--wallet-white); padding-top: env(safe-area-inset-top, 0px); }
.app-page-hero-row { max-width: var(--app-page-width); min-height: var(--app-hero-height); margin-inline: auto; padding: var(--space-2) var(--space-4); display: flex; align-items: center; gap: var(--space-3); }
.app-page-hero-leading { flex-shrink: 0; }
.app-page-hero-leading:empty { display: none; }
.app-page-hero-copy { flex: 1; min-width: 0; }
.app-page-hero-copy h1 { font-size: var(--text-title); font-weight: 600; line-height: 1.3; letter-spacing: -.3px; margin: 0; color: inherit; overflow-wrap: anywhere; }
.app-page-hero-copy > p { margin-top: var(--space-1); font-size: var(--text-label); line-height: 1.4; opacity: .85; }
.app-page-hero-caption { max-width: var(--app-page-width); margin-inline: auto; padding: var(--space-2) var(--space-4) var(--space-4); border-radius: var(--app-sheet-radius) var(--app-sheet-radius) 0 0; background: var(--v4-quote); color: var(--v4-ink); text-align: center; font-size: var(--text-label); font-weight: 500; line-height: 1.6; }
.app-sos-button { display: grid; place-items: center; flex-shrink: 0; width: var(--app-sos-width); height: var(--app-hero-action-size); border: 0; border-radius: var(--radius-pill); background: var(--v4-sos); color: var(--wallet-white); font-size: var(--text-label); font-weight: 700; text-decoration: none; box-shadow: none; }
.app-hero-back { display: grid; place-items: center; width: var(--app-hero-action-size); height: var(--app-hero-action-size); border: 1px solid currentColor; border-radius: var(--radius-pill); color: inherit; }
.app-page-hero :is(.app-sos-button, .app-hero-back):focus-visible { outline: 2px solid var(--wallet-white); outline-offset: 3px; }
.app-page-hero .buddy-qr-icon-button { width: var(--app-hero-action-size); height: var(--app-hero-action-size); background: transparent; color: var(--wallet-white); border-color: transparent; }
.app-page-hero .availability-trigger--hero { padding: 0; color: var(--wallet-white); }
.app-page-hero .availability-copy { gap: var(--space-1); }
.app-page-hero .availability-current { font-size: var(--text-title); font-weight: 500; }
.app-page-hero .availability-trigger--hero .font-label { font-size: 11px; opacity: .85; }
.app-page-hero .availability-edit { padding-bottom: 0; }
.app-page-hero .people-header-search { min-height: var(--app-hero-action-size); padding: var(--space-2) var(--space-4); gap: var(--space-2); border: 1px solid var(--wallet-white); color: var(--v4-action-ink); background: var(--wallet-white); box-shadow: none; font-size: var(--text-label); font-weight: 600; }
.app-page-hero .people-header-search:hover { background: var(--v4-card); border-color: var(--v4-card); }
.app-page-hero .people-header-search:active { background: var(--v4-quote); }
.app-page-hero .people-header-search:focus-visible { outline: 2px solid var(--wallet-white); outline-offset: 3px; }
.app-v4 .app-page-content { position: relative; width: 100%; max-width: var(--app-page-width); min-height: calc(100dvh - var(--app-hero-height)); margin: -8px auto 0; padding: var(--space-6) var(--space-4) calc(110px + env(safe-area-inset-bottom, 0px)); border-radius: var(--app-sheet-radius) var(--app-sheet-radius) 0 0; background: var(--v4-canvas); }
.app-v4 .app-page-content--composer { padding-bottom: calc(180px + env(safe-area-inset-bottom, 0px)); }
.app-page .app-tab-bar .app-tab-item[aria-current="page"] { background: transparent; color: var(--v4-action-ink); }
.app-page :is(.card-soft, .ui-card) { background: var(--v4-card); }

.app-v4 .people-results .ui-person-card { background: transparent; padding: var(--space-5) 0; border-radius: 0; }
.app-page .ui-group-card .availability-icon { background: var(--v4-primary); color: var(--wallet-white); }
.home-v4.app-v4 { padding-bottom: 0; }
@media (prefers-reduced-motion: no-preference) { .app-page-hero, .app-page-hero-caption { transition: background-color .7s ease; } }

.message-meta { display: flex; align-items: center; gap: var(--space-1); margin-top: var(--space-1); color: var(--muted-foreground); font-size: var(--message-meta-size); line-height: 1.4; }
.message-meta--own { justify-content: flex-end; color: inherit; }
.message-meta--own > span:first-child { opacity: .7; }
.message-receipt { display: inline-flex; flex-shrink: 0; }
.message-receipt--read { color: var(--message-read); }

.app-page-title { display: flex; align-items: center; gap: var(--space-2); }
.app-page-title > svg { flex-shrink: 0; }

.ui-info-box { padding: var(--space-4); background: var(--v4-quote); color: var(--v4-ink); border: 0; border-radius: var(--v4-card-radius); box-shadow: none; font-size: var(--text-body); line-height: 1.6; }

.app-page--without-navigation .screen-composer { bottom: 0; padding-bottom: env(safe-area-inset-bottom, 0px); }
.app-v4.app-page--without-navigation .app-page-content--composer { padding-bottom: calc(var(--control-height) + var(--space-8) + env(safe-area-inset-bottom, 0px)); }

.ui-expandable-text { font-size: var(--text-body); line-height: 1.5; white-space: pre-line; overflow-wrap: anywhere; }
.ui-expandable-text--collapsed { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; overflow: hidden; }
.ui-read-more { display: inline-flex; align-items: center; min-height: var(--control-height); color: var(--primary); font-size: var(--text-body); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }

.ui-group-list { margin: 0; padding: 0; list-style: none; }
.ui-group-list > li + li { border-top: 1px solid var(--v4-line); }
.app-v4 .availability-trigger.wallet-buddy-cta.ui-group-card { background: transparent; border: 0; border-radius: 0; box-shadow: none; padding: var(--space-5) 0; }

.ui-menu-row { display: flex; padding: var(--space-5) 0; background: transparent; color: var(--foreground); }
section.ui-menu-row { display: block; }
.ui-menu-list > * + * { border-top: 1px solid var(--v4-line); }

/* Flat layout is the app default; only informational text has a filled box. */
.app-v4 :is(.card-soft, .ui-card) { background: transparent; border: 0; border-radius: 0; box-shadow: none; }
.app-v4 .ui-flat-section { background: transparent; border: 0; border-radius: 0; box-shadow: none; padding: var(--space-5) 0; }
.app-v4 .ui-flat-section + .ui-flat-section,
.app-v4 .ui-flat-list > * + * { border-top: 1px solid var(--v4-line); }
.ui-flat-list { margin-block: 0; padding: 0; list-style: none; }
.app-v4 .ui-action-link { background: transparent; border: 0; border-radius: 0; box-shadow: none; padding-inline: 0; }
.app-v4 .conversation-preference-row { background: transparent; border: 0; border-radius: 0; }
.app-v4 .conversation-preference-row + .conversation-preference-row { border-top: 1px solid var(--v4-line); }
.app-v4 .conversation-preference-toggle { padding-inline: 0; border-radius: 0; }
.app-v4 .conversation-preference-options { padding-inline: 0; }
.app-v4 .status-dialog .status-option { background: transparent; border: 0; border-bottom: 1px solid var(--v4-line); border-radius: 0; padding-inline: 0; color: var(--v4-ink); }
.app-v4 .status-dialog .status-option[aria-pressed="true"] { background: transparent; color: var(--v4-action-ink); }
.app-v4 .status-dialog .status-option[aria-pressed="true"] .status-option-description { color: var(--muted-foreground); }
.ui-choice-row[aria-pressed="true"] { color: var(--primary); font-weight: 600; }
.ui-choice-row[aria-pressed="true"]::after { content: "✓"; margin-left: auto; }

/* Filter launchers remain visibly grouped controls in the otherwise flat list. */
.app-v4 .people-filter-toolbar > .card-soft {
  background: var(--v4-card);
  border-radius: var(--v4-card-radius);
}

/* Keep expanded choices attached to their setting, without another card. */
.app-v4 .conversation-preference-options {
  border-top: 0;
  margin-left: var(--space-8);
  padding-top: 0;
  padding-left: var(--space-3);
  border-left: 2px solid var(--v4-primary);
}
.app-v4 .conversation-preference-row[data-expanded="true"] .conversation-preference-toggle {
  padding-bottom: var(--space-2);
}

/* Bring the first person closer to the contact switch. */
.people-page > .ui-contact-switch { margin-bottom: 0; }
.people-page > .ui-contact-switch + .people-results { margin-top: 0; }

.ui-chat-actions { display: flex; align-items: stretch; gap: var(--space-2); }
.ui-chat-actions > .ui-button { flex: 1; min-width: 0; padding-inline: var(--space-3); }
.ui-chat-actions > .ui-button:last-child { flex: 1.6; }
.ui-chat-actions > .ui-button > svg { flex-shrink: 0; }

.people-page > .people-buddies { margin-top: var(--space-3); }
.people-buddies > .people-results { margin: 0; }

/* Light status surfaces use dark foregrounds throughout the shared V4 UI. */
.app-v4 .app-page-hero,
.app-v4 .app-page-hero .availability-trigger--hero,
.app-v4 .app-page-hero .buddy-qr-icon-button,
.app-v4 .home-v4-call,
.app-v4 .app-tab-home,
.app-v4 .ui-group-card .availability-icon { color: var(--v4-ink); }
.app-v4 .text-primary { color: var(--v4-action-ink); }
.app-v4 .ui-chip[aria-pressed="true"] { color: var(--v4-ink); }

.home-hero-buddies { display: block; width: var(--app-hero-illustration-size); height: var(--app-hero-illustration-size); }
.home-hero-buddies .wallet-helping-outline { position: static; display: block; width: 100%; height: 100%; color: var(--v4-ink); opacity: 1; }

.availability-theme { display: contents; }

.auth-start-actions { display: grid; gap: var(--space-3); width: 100%; max-width: var(--app-page-width); margin-inline: auto; }
.auth-form { display: grid; gap: var(--space-3); }
.auth-password { position: relative; }
.auth-password input { padding-right: calc(var(--control-height) + var(--space-2)); }
.auth-password button { position: absolute; right: 0; top: 0; height: 100%; min-width: var(--control-height); display: grid; place-items: center; color: var(--v4-action-ink); }

.ui-date-choice { display: grid; gap: var(--space-2); min-width: 0; }
.ui-date-choice .ui-label { margin: 0; }
.ui-date-choice .ui-field { min-width: 0; max-width: 100%; }

.ui-icon-choice { display: flex; align-items: center; gap: var(--space-2); text-align: left; min-width: 0; }
.ui-icon-choice > svg { color: var(--v4-action-ink); }
.ui-icon-choice > span { min-width: 0; overflow-wrap: anywhere; }

.ui-switch-row { display: flex; align-items: center; justify-content: space-between; gap: var(--space-4); width: 100%; min-height: var(--control-height); padding: var(--space-3) 0; border: 0; border-radius: 0; background: transparent; color: var(--foreground); font-size: var(--text-body); text-align: left; }
.ui-switch-row + .ui-switch-row { border-top: 1px solid var(--border); }

.auth-form > .conversation-emblem { justify-self: start; }

/* Welcome surfaces and a quiet, staggered entrance. */
.app-v4 .ui-welcome-surface {
  border: 1px solid var(--welcome-border);
  box-shadow: var(--welcome-shadow);
}
.start-brand { padding: var(--space-6); border-radius: var(--radius); width: 100%; max-width: var(--app-page-width); }
.start-brand img { margin-inline: auto; }
.start-question { margin-top: var(--space-6); padding: var(--space-4) var(--space-6); border-radius: var(--radius); }
.ui-enter, .start-language > * { animation: welcome-enter var(--welcome-enter-duration) cubic-bezier(.22,1,.36,1) both; }
.start-language > * { box-shadow: var(--welcome-shadow); }
.start-brand { animation-delay: var(--welcome-enter-stagger); }
.start-question { animation-delay: calc(var(--welcome-enter-stagger) * 2); }
.start-screen .auth-start-actions > :first-child { animation-delay: calc(var(--welcome-enter-stagger) * 3); }
.start-screen .auth-start-actions > :last-child { animation-delay: calc(var(--welcome-enter-stagger) * 4); }
@keyframes welcome-enter { from { opacity: 0; transform: translateY(var(--welcome-enter-distance)); } to { opacity: 1; transform: translateY(0); } }
@media (prefers-reduced-motion: reduce) { .ui-enter, .start-language > * { animation: none; } }

.ui-location-field { position: relative; }
.ui-location-input { position: relative; }
.ui-location-input input { padding-right: var(--control-height); }
.ui-location-input > svg { position: absolute; right: var(--space-4); top: 50%; transform: translateY(-50%); pointer-events: none; }
.ui-location-popup { position: absolute; top: 100%; left: 0; right: 0; z-index: 20; margin-top: var(--space-1); padding: var(--space-2); background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--welcome-shadow); max-height: 240px; overflow-y: auto; }
.ui-location-popup ul { margin: 0; padding: 0; list-style: none; }
.ui-location-popup li { display: flex; justify-content: space-between; align-items: center; gap: var(--space-3); padding: var(--space-3); min-height: var(--control-height); border-radius: var(--radius); cursor: pointer; }
.ui-location-popup li:hover, .ui-location-popup li[aria-selected="true"] { background: var(--secondary); }
.ui-location-popup small { color: var(--muted-foreground); }

.app-v4 .ui-role-panel { margin-top: var(--space-6); padding: var(--space-5); border: 1px solid var(--v4-line); border-radius: var(--radius); background: var(--v4-card); display: grid; gap: var(--space-4); }
.ui-role-panel-heading { display: flex; align-items: center; gap: var(--space-3); }
.ui-role-panel-heading h2 { font-size: var(--text-body); font-weight: 600; margin: 0 0 var(--space-1); }
.ui-role-panel-icon { display: grid; place-items: center; width: var(--control-height); height: var(--control-height); border-radius: var(--radius); background: var(--v4-quote); color: var(--v4-action-ink); flex-shrink: 0; }
.ui-role-active { display: inline-flex; align-items: center; gap: var(--space-1); font-size: var(--text-label); color: var(--v4-action-ink); }
.ui-role-panel > .ui-help { margin: 0; }

.app-v4 .ui-choice-button {
  min-height: var(--control-height);
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--foreground);
  font-size: var(--text-body);
  cursor: pointer;
}
.app-v4 .ui-choice-button:hover { border-color: var(--v4-action-ink); }
.app-v4 .ui-choice-button[aria-pressed="true"] { background: var(--primary); border-color: var(--v4-action-ink); color: var(--foreground); }
.app-v4 .ui-choice-button:active { background: var(--secondary); }

.ui-empty-state { display: flex; flex-direction: column; align-items: center; gap: var(--space-3); padding: var(--space-6) var(--space-4); text-align: center; }
.ui-empty-state h3 { font-size: var(--text-body); font-weight: 600; margin: 0; }
.ui-empty-state .ui-help { margin: 0; max-width: var(--app-page-width); }
.ui-empty-state > .ui-button { margin-top: var(--space-2); }

.ui-role-setup { min-height: 100dvh; display: flex; flex-direction: column; gap: var(--space-4); }
.ui-role-setup-body { flex: 1; }
.ui-role-setup footer { padding-top: var(--space-6); }
.ui-setup-progress { appearance: none; border: 0; width: 100%; height: var(--space-1); border-radius: var(--radius-pill); overflow: hidden; background: var(--muted); color: var(--primary); }
.ui-setup-progress::-webkit-progress-bar { background: var(--muted); }
.ui-setup-progress::-webkit-progress-value { background: var(--primary); border-radius: var(--radius-pill); }
.ui-setup-progress::-moz-progress-bar { background: var(--primary); }

.more-menu-list > .ui-menu-row:first-child { padding-top: var(--space-1); }

/* An actionable third tile when two recovery meters leave room. */
.ui-recovery-edit-tile { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--space-2); min-width: 0; padding: var(--space-3) var(--space-2); border: 1px solid var(--primary); border-radius: var(--v4-card-radius); background: var(--secondary); color: var(--foreground); text-align: center; text-decoration: none; font-size: var(--text-label); font-weight: 600; line-height: 1.4; }
.ui-recovery-edit-tile:hover { background: var(--primary); }
.ui-recovery-edit-tile:active { background: var(--muted); }
.ui-recovery-edit-tile:focus-visible { outline: 2px solid var(--ring); outline-offset: 3px; }

.ui-compact-role-switcher { margin-top: var(--space-3); text-align: center; }
.ui-compact-role-options { display: inline-flex; align-items: center; gap: var(--space-1); padding: var(--space-1); border: 1px solid var(--border); border-radius: var(--radius-pill); background: var(--card); }
.ui-compact-role-options .ui-chip { min-height: var(--space-8); padding: var(--space-1) var(--space-3); border-color: transparent; background: transparent; color: var(--muted-foreground); font-size: var(--text-label); }
.ui-compact-role-options .ui-chip[aria-pressed="true"] { background: var(--primary); color: var(--primary-foreground); font-weight: 600; }
.ui-compact-role-options .ui-chip:not([aria-pressed="true"]):hover { background: var(--muted); }

.home-v4-recovery-heading { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: var(--space-2); margin-bottom: var(--space-2); }
.home-v4-recovery-heading:empty { display: none; }
.home-v4-recovery-heading .screen-title { margin: 0; }
.home-v4-recovery-heading .ui-compact-role-switcher { margin: 0 0 0 auto; }
.home-v4-recovery-heading .ui-compact-role-options { padding: var(--space-1); gap: 0; }
.home-v4-recovery-heading .ui-compact-role-options .ui-chip { padding-inline: var(--space-2); }

.ui-compact-role-options .ui-chip { position: relative; overflow: visible; }
.ui-role-unread-badge { position: absolute; top: calc(-1 * var(--space-1)); left: 50%; transform: translate(-50%, -50%); z-index: 1; display: grid; place-items: center; min-width: var(--space-5); height: var(--space-5); padding-inline: var(--space-1); border: 2px solid var(--card); border-radius: var(--radius-pill); background: var(--foreground); color: var(--background); font-size: var(--text-label); font-weight: 600; line-height: 1; pointer-events: none; }

.ui-schedule-day { padding-block: var(--space-3); border-bottom: 1px solid var(--border); }
.ui-schedule-day-label { display: flex; align-items: center; gap: var(--space-3); min-height: 44px; cursor: pointer; }
.ui-schedule-day-label input { width: var(--space-5); height: var(--space-5); accent-color: var(--primary); }
.ui-schedule-slot { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; align-items: end; gap: var(--space-2); margin-top: var(--space-2); }
.ui-schedule-slot .ui-field { display: block; width: 100%; min-width: 0; margin-top: var(--space-1); }
.ui-schedule-slot .ui-button { padding-inline: var(--space-3); }

/* Start: a light, colourful welcome with decorative conversation bubbles. */
.availability-theme .app-v4.start-screen { --v4-primary: var(--status-available); }
.start-screen { position: relative; isolation: isolate; overflow: hidden; display: flex; flex-direction: column; min-height: 100svh; padding: var(--space-6) var(--space-6) max(var(--space-6), env(safe-area-inset-bottom)); background: var(--start-background); }
.start-screen .start-language { display: flex; justify-content: flex-end; width: 100%; max-width: var(--app-page-width); margin-inline: auto; }
.start-story { width: 100%; max-width: var(--app-page-width); margin: auto; padding-block: var(--space-6); text-align: center; }
.start-screen .start-brand { padding: 0; margin-inline: auto; max-width: 215px; }
.start-screen .start-brand img { width: 100%; }
.start-connections { display: flex; align-items: center; justify-content: center; gap: var(--space-3); margin: var(--space-6) auto; }
.start-connection { display: grid; place-items: center; width: 64px; height: 64px; border-radius: var(--app-sheet-radius); box-shadow: var(--welcome-shadow); animation: start-float var(--start-float-duration) ease-in-out infinite; }
.start-connection svg { width: 28px; height: 28px; stroke-width: 1.6; }
.start-connection--chat { background: var(--start-blue); transform: rotate(-12deg); animation-delay: -2s; }
.start-connection--phone { background: var(--status-available); width: 80px; height: 80px; margin-top: var(--space-6); }
.start-connection--phone svg { width: 36px; height: 36px; }
.start-connection--people { background: var(--start-peach); transform: rotate(12deg); animation-delay: -4s; }
.start-eyebrow { font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--start-emphasis); }
.start-copy h1 { margin: var(--space-3) 0 var(--space-4); font-size: var(--start-title-size); font-weight: 650; line-height: 1.12; letter-spacing: -.045em; }
.start-copy h1 em { color: var(--start-emphasis); font-style: normal; }
.start-copy > p:last-child { max-width: 340px; margin-inline: auto; color: var(--v4-muted); line-height: 1.65; font-size: 15px; }
.start-reassurance { display: flex; align-items: center; justify-content: center; gap: var(--space-2); margin-top: var(--space-5); color: var(--start-emphasis); font-size: 12px; }
.start-screen .auth-start-actions { max-width: 380px; animation-delay: 300ms; }
.start-copy { animation-delay: 150ms; }
.start-reassurance { animation-delay: 250ms; }
@keyframes start-float { 0%, 100% { translate: 0 0; } 50% { translate: 0 -8px; } }
@media (max-height: 720px) { .start-story { padding-block: var(--space-4); } .start-connections { margin-block: var(--space-3); } .start-reassurance { margin-top: var(--space-3); } .start-screen .start-brand { max-width: 175px; } }
@media (prefers-reduced-motion: reduce) { .start-connection { animation: none; } }

@media (max-width: 380px) { .start-connections { gap: var(--space-2); } .start-connection { width: 56px; height: 56px; } .start-connection--phone { width: 68px; height: 68px; } }

/* Current page is visible through shape, colour and weight. */
.app-v4 .app-tab-bar .app-tab-item { min-height: 44px; padding: var(--space-2); margin-inline: var(--space-1); border-radius: var(--radius); color: var(--v4-muted); }
.app-v4 .app-tab-bar .app-tab-item[aria-current="page"],
.nordic-bg.app-v4 .app-tab-bar .app-tab-item[aria-current="page"] { background: var(--tab-active-surface); color: var(--tab-active-ink); }
.app-v4 .app-tab-bar .app-tab-item[aria-current="page"] svg { stroke-width: 2.3; }
.app-v4 .app-tab-bar .app-tab-item[aria-current="page"] > span { font-weight: 700; }
.app-v4 .app-tab-home-link:not([aria-current="page"]) .app-tab-home { background: var(--status-available); color: var(--tab-active-ink); }
.app-v4 .app-tab-home-link[aria-current="page"] .app-tab-home { background: var(--status-available); color: var(--tab-active-ink); }
.app-v4 .app-tab-bar .app-tab-home-link[aria-current="page"] > span:last-child { font-weight: 700; color: var(--tab-active-ink); }

/* Brand artwork keeps its original proportions and transparent background. */
.ui-brand-logo { display: block; width: auto; max-width: 100%; object-fit: contain; flex-shrink: 0; }
.ui-brand-logo--mark { aspect-ratio: 1; }
.home-hero-logo { width: auto; max-width: 100%; }
.start-screen .start-brand img { width: auto; height: var(--brand-full-height); max-width: 100%; object-fit: contain; }
.ui-welcome-logo { width: auto; height: var(--brand-welcome-height); max-width: 100%; object-fit: contain; }
.ui-start-gradient-preview { display: grid; place-items: center; padding: var(--space-6); border-radius: var(--radius); background: var(--start-background); }

.start-copy h1 em { color: var(--brand-purple-mid); }

.start-screen.app-v4 .start-language button[aria-pressed="true"] { background: var(--brand-purple-mid); color: var(--wallet-white); }
/* Landing-page intake forms and alternating lavender sections. */
.ui-site-lavender{background:color-mix(in srgb,var(--brand-purple-light) 18%,var(--v4-canvas));max-width:none}
.ui-site-lavender .cards article,.ui-site-lavender form{background:var(--v4-canvas)}
.ui-site-founder p{max-width:850px;margin-inline:auto;font-size:16px;line-height:1.85}
.ui-site-contact-row{margin-top:32px;padding-bottom:0;border-top-color:var(--border)}
.ui-site-intake :is(input:not([type=checkbox]):not([type=hidden]),select,textarea){display:block;box-sizing:border-box;width:100%;min-height:52px;padding:15px;margin:0 0 20px;border:1px solid var(--border);border-radius:var(--v4-field-radius,16px);background:var(--v4-canvas);color:var(--v4-ink);font:16px Inter,sans-serif;line-height:1.4}
.ui-site-intake textarea{resize:vertical;min-height:130px}
.ui-site-intake input[type=hidden],.ui-site-intake [hidden]{display:none!important}
.ui-site-intake .consent{display:flex;align-items:flex-start;gap:10px;font-size:12px;line-height:1.6;font-weight:400;margin:20px 0}
.ui-site-intake .consent input{flex-shrink:0;width:17px;height:17px;margin:2px 0 0;accent-color:var(--brand-purple-mid)}
.ui-site-intake .consent span{color:var(--v4-ink)}
.ui-site-intake .ui-site-choice{padding:14px;border:1px solid var(--border);border-radius:var(--radius);background:color-mix(in srgb,var(--brand-purple-light) 10%,var(--v4-canvas))}
.ui-site-intake .button{color:var(--wallet-white)}
.ui-site-intake :is(select,textarea):focus-visible{outline:3px solid var(--brand-purple-mid);outline-offset:4px}
.ui-site-intake [role=status]{font-size:14px;line-height:1.6;margin-bottom:0}
@media(max-width:760px){.ui-site-founder p{font-size:15px}.ui-site-contact-row{margin-top:24px}}
