/* MyNHIA prototype components. Reads only tokens from tokens.css. */

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

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font: var(--type-body-l);
  color: var(--color-on-surface);
  background: var(--color-surface-container);
  -webkit-font-smoothing: antialiased;
}

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

button {
  cursor: pointer;
}

a.btn,
a.quick,
a.list-item,
a.id-card {
  text-decoration: none;
}

a.quick {
  color: inherit;
}

:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

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

.icon {
  width: 24px;
  height: 24px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon-sm {
  width: 18px;
  height: 18px;
}

.icon-lg {
  width: 32px;
  height: 32px;
}

/* ---------- Stage: device + review panel ---------- */

.stage {
  display: grid;
  grid-template-columns: minmax(0, 390px) minmax(0, 420px);
  gap: var(--space-8);
  justify-content: center;
  align-items: start;
  padding: var(--space-8) var(--space-4);
}

.device {
  position: relative;
  width: 390px;
  max-width: 100%;
  height: 844px;
  border-radius: 44px;
  background: var(--color-surface);
  box-shadow: 0 0 0 10px #1d211e, 0 0 0 11px #3b403c, 0 24px 60px rgb(0 0 0 / 0.28);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  isolation: isolate;
}

.status-bar {
  flex: none;
  height: 44px;
  padding: 0 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font: var(--type-label-l);
  color: var(--color-on-surface);
  background: var(--color-surface);
}

.status-bar .status-icons {
  display: flex;
  gap: 6px;
  align-items: center;
}

.screens {
  position: relative;
  flex: 1;
  min-height: 0;
}

.panel {
  position: sticky;
  top: var(--space-8);
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  min-width: 0;
}

.panel-card {
  background: var(--color-surface-container-lowest);
  border: 1px solid var(--color-outline-variant);
  border-radius: var(--radius-l);
  padding: var(--space-5);
  min-width: 0;
}

.panel h1 {
  font: var(--type-title-l);
  margin: 0 0 var(--space-1);
}

.panel h2 {
  font: var(--type-title-m);
  margin: 0 0 var(--space-2);
}

.panel p {
  margin: 0;
  font: var(--type-body-m);
  color: var(--color-on-surface-variant);
}

.panel-controls {
  display: grid;
  gap: var(--space-3);
  margin-top: var(--space-4);
}

.control-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  font: var(--type-label-l);
}

.segmented {
  display: inline-flex;
  border: 1px solid var(--color-outline);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.segmented button {
  border: 0;
  background: transparent;
  padding: 6px 12px;
  min-height: 36px;
  font: var(--type-label-m);
  color: var(--color-on-surface);
}

.segmented button + button {
  border-left: 1px solid var(--color-outline);
}

.segmented button[aria-pressed="true"] {
  background: var(--color-secondary-container);
  color: var(--color-on-secondary-container);
}

.screen-index {
  display: grid;
  gap: 2px;
  margin: 0;
  padding: 0;
  list-style: none;
  max-height: 280px;
  overflow: auto;
}

.screen-index a {
  display: flex;
  gap: var(--space-2);
  padding: 6px var(--space-2);
  border-radius: var(--radius-s);
  font: var(--type-body-m);
  color: var(--color-on-surface);
  text-decoration: none;
}

.screen-index a:hover {
  background: var(--color-surface-container);
}

.screen-index a[aria-current="true"] {
  background: var(--color-secondary-container);
  color: var(--color-on-secondary-container);
  font-weight: 600;
}

.screen-index .sid {
  font-family: var(--font-mono);
  font-size: 12px;
  opacity: 0.75;
  min-width: 2.5em;
}

.trace dl {
  margin: var(--space-3) 0 0;
  display: grid;
  gap: var(--space-3);
}

.trace dt {
  font: var(--type-label-m);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-on-surface-variant);
}

.trace dd {
  margin: var(--space-1) 0 0;
  font: var(--type-body-m);
  overflow-wrap: anywhere;
}

.trace .tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1);
}

.tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  background: var(--color-surface-container-high);
  font: var(--type-label-m);
}

.tag.theme {
  background: var(--color-tertiary-container);
  color: var(--color-on-tertiary-container);
}

/* ---------- Screens ---------- */

.screen {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  background: var(--color-surface);
  /* Screen ids double as #anchors and the phone is at the top of the page in every layout.
     The huge margin makes the browser's own anchor jumps on first load land at the top. */
  scroll-margin-top: 100vh;
}

.screen.active {
  display: flex;
  animation: screen-in var(--motion-medium) var(--motion-easing);
}

@keyframes screen-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .screen.active {
    animation: none;
  }
}

.app-bar {
  flex: none;
  display: flex;
  align-items: center;
  gap: var(--space-1);
  min-height: 64px;
  padding: var(--space-2) var(--space-1);
  background: var(--color-surface);
}

.app-bar h1,
.app-bar h2 {
  flex: 1;
  margin: 0;
  padding: 0 var(--space-3);
  font: var(--type-title-l);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.app-bar .icon-btn + h2,
.app-bar .icon-btn + h1 {
  padding-left: var(--space-1);
}

.icon-btn {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: var(--touch-target);
  height: var(--touch-target);
  border: 0;
  border-radius: var(--radius-full);
  background: transparent;
  color: var(--color-on-surface-variant);
}

.icon-btn:hover {
  background: var(--color-surface-container-high);
}

.icon-btn .dot {
  position: absolute;
  top: 10px;
  right: 10px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: var(--radius-full);
  background: var(--color-error);
  color: var(--color-on-error);
  font: 600 10px/16px var(--font-sans);
}

/* iOS-adaptive: chevron back, centred title */
[data-platform="ios"] .app-bar.has-back h2 {
  text-align: center;
  font: var(--type-title-m);
  padding-right: calc(var(--touch-target) + var(--space-1));
}

[data-platform="ios"] .back-android {
  display: none;
}

[data-platform="android"] .back-ios {
  display: none;
}

.content {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: var(--space-2) var(--space-4) var(--space-6);
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.content > * {
  flex-shrink: 0;
}

.footer-actions {
  flex: none;
  display: grid;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4) var(--space-5);
  background: var(--color-surface);
  border-top: 1px solid var(--color-outline-variant);
}

.lead {
  font: var(--type-body-l);
  color: var(--color-on-surface-variant);
  margin: 0;
}

.section-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin: var(--space-2) 0 calc(var(--space-2) * -1);
  font: var(--type-title-m);
}

.section-title a,
.link-btn {
  font: var(--type-label-l);
  color: var(--color-primary);
  text-decoration: none;
  background: none;
  border: 0;
  padding: var(--space-2) 0;
  min-height: 36px;
}

.muted {
  color: var(--color-on-surface-variant);
}

.small {
  font: var(--type-body-m);
}

.mono {
  font-family: var(--font-mono);
  letter-spacing: 0.02em;
}

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: var(--touch-target);
  padding: 0 var(--space-6);
  border: 0;
  border-radius: var(--radius-full);
  font: var(--type-label-l);
  font-size: 0.9375rem;
  background: var(--color-primary);
  color: var(--color-on-primary);
  transition: box-shadow var(--motion-short), opacity var(--motion-short);
}

.btn:hover {
  box-shadow: var(--elevation-1);
}

.btn.block {
  width: 100%;
}

.btn.compact {
  flex: none;
  padding: 0 var(--space-4);
}

.btn.tonal {
  background: var(--color-secondary-container);
  color: var(--color-on-secondary-container);
}

.btn.outlined {
  background: transparent;
  color: var(--color-primary);
  border: 1px solid var(--color-outline);
}

.btn.text {
  background: transparent;
  color: var(--color-primary);
  padding: 0 var(--space-3);
}

.btn.text:hover,
.btn.outlined:hover {
  box-shadow: none;
  background: var(--color-surface-container);
}

.btn:disabled,
.btn[aria-disabled="true"] {
  background: color-mix(in srgb, var(--color-on-surface) 12%, transparent);
  color: color-mix(in srgb, var(--color-on-surface) 45%, transparent);
  box-shadow: none;
  cursor: not-allowed;
}

.btn.outlined:disabled {
  background: transparent;
}

.btn .spinner {
  width: 18px;
  height: 18px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ---------- Fields ---------- */

.field {
  display: grid;
  gap: 6px;
}

.field label,
.field .label {
  font: var(--type-label-l);
  color: var(--color-on-surface);
}

.field .control {
  position: relative;
  display: flex;
  align-items: center;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  min-height: 52px;
  padding: 14px var(--space-4);
  border: 1px solid var(--color-outline);
  border-radius: var(--radius-s);
  background: var(--color-surface-container-lowest);
  font: var(--type-body-l);
}

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

.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 1px var(--color-primary);
}

.field .control .icon-btn {
  position: absolute;
  right: 2px;
}

.field .control input.has-action {
  padding-right: 52px;
}

.field .helper {
  font: var(--type-body-m);
  color: var(--color-on-surface-variant);
  display: flex;
  gap: 6px;
  align-items: flex-start;
}

.field.invalid input {
  border-color: var(--color-error);
  box-shadow: 0 0 0 1px var(--color-error);
}

.field.invalid .helper {
  color: var(--color-error);
}

.field.valid .helper {
  color: var(--color-success);
}

.readonly-value {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-s);
  background: var(--color-surface-container);
}

.readonly-value .value {
  font: var(--type-body-l);
  min-width: 0;
  overflow-wrap: anywhere;
}

.rules {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 4px;
  font: var(--type-body-m);
}

.rules li {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--color-on-surface-variant);
}

.rules li .icon {
  width: 18px;
  height: 18px;
}

.rules li.ok {
  color: var(--color-success);
}

.otp {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: var(--space-2);
}

.otp input {
  width: 100%;
  height: 56px;
  text-align: center;
  font: var(--type-headline);
  border: 1px solid var(--color-outline);
  border-radius: var(--radius-s);
  background: var(--color-surface-container-lowest);
  padding: 0;
}

.otp input:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 1px var(--color-primary);
}

/* ---------- Surfaces ---------- */

.card {
  border-radius: var(--radius-m);
  background: var(--color-surface-container-low);
  padding: var(--space-4);
  display: grid;
  gap: var(--space-3);
  min-width: 0;
}

.card.outlined {
  background: var(--color-surface);
  border: 1px solid var(--color-outline-variant);
}

.card.tonal {
  background: var(--color-primary-container);
  color: var(--color-on-primary-container);
}

.card h3 {
  margin: 0;
  font: var(--type-title-m);
}

.card p {
  margin: 0;
}

.card-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-width: 0;
}

.card-row > .grow {
  flex: 1;
  min-width: 0;
}

.avatar {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--color-tertiary-container);
  color: var(--color-on-tertiary-container);
  font: var(--type-label-l);
  flex: none;
}

.avatar.lg {
  width: 64px;
  height: 64px;
  font: var(--type-title-l);
}

.icon-tile {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-m);
  background: var(--color-secondary-container);
  color: var(--color-on-secondary-container);
  flex: none;
}

.quick-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-3);
}

.quick {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-height: 64px;
  padding: var(--space-3);
  border: 1px solid var(--color-outline-variant);
  border-radius: var(--radius-m);
  background: var(--color-surface);
  text-align: left;
  font: var(--type-label-l);
}

.quick:hover {
  background: var(--color-surface-container-low);
}

/* List */
.list {
  display: grid;
  margin: 0;
  padding: 0;
  list-style: none;
  border-radius: var(--radius-m);
  background: var(--color-surface-container-low);
  overflow: hidden;
}

.list > li + li {
  border-top: 1px solid var(--color-outline-variant);
}

.list-item {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  width: 100%;
  min-height: 56px;
  padding: var(--space-3) var(--space-4);
  border: 0;
  background: transparent;
  text-align: left;
  color: var(--color-on-surface);
  text-decoration: none;
}

button.list-item:hover,
a.list-item:hover {
  background: var(--color-surface-container);
}

.list-item .text {
  flex: 1;
  min-width: 0;
  display: grid;
  gap: 2px;
}

.list-item .primary {
  font: var(--type-body-l);
}

.list-item .secondary {
  font: var(--type-body-m);
  color: var(--color-on-surface-variant);
}

.list-item > .icon {
  color: var(--color-on-surface-variant);
}

/* Badges, chips, banners */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font: var(--type-label-m);
  white-space: nowrap;
  background: var(--color-surface-container-high);
  color: var(--color-on-surface-variant);
}

.badge.success {
  background: var(--color-success-container);
  color: var(--color-on-success-container);
}

.badge.warning {
  background: var(--color-warning-container);
  color: var(--color-on-warning-container);
}

.badge.error {
  background: var(--color-error-container);
  color: var(--color-on-error-container);
}

.badge.info {
  background: var(--color-info-container);
  color: var(--color-on-info-container);
}

.chips {
  display: flex;
  gap: var(--space-2);
  overflow-x: auto;
  padding-bottom: 2px;
  scrollbar-width: none;
}

.chip {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  padding: 0 var(--space-4);
  border: 1px solid var(--color-outline);
  border-radius: var(--radius-s);
  background: transparent;
  font: var(--type-label-l);
  color: var(--color-on-surface-variant);
}

.chip[aria-pressed="true"] {
  border-color: transparent;
  background: var(--color-secondary-container);
  color: var(--color-on-secondary-container);
}

.banner {
  display: flex;
  gap: var(--space-3);
  align-items: flex-start;
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-m);
  font: var(--type-body-m);
  background: var(--color-info-container);
  color: var(--color-on-info-container);
}

.banner.warning {
  background: var(--color-warning-container);
  color: var(--color-on-warning-container);
}

.banner.success {
  background: var(--color-success-container);
  color: var(--color-on-success-container);
}

.banner.error {
  background: var(--color-error-container);
  color: var(--color-on-error-container);
}

.banner strong {
  display: block;
  font: var(--type-label-l);
}

.offline-banner {
  display: none;
  flex: none;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  background: var(--color-inverse-surface);
  color: var(--color-inverse-on-surface);
  font: var(--type-body-m);
}

[data-offline="true"] .offline-banner {
  display: flex;
}

[data-offline="true"] .needs-network {
  opacity: 0.5;
  pointer-events: none;
}

.offline-only {
  display: none;
}

[data-offline="true"] .offline-only {
  display: flex;
}

/* Stepper */
.stepper {
  display: grid;
  gap: var(--space-2);
}

.stepper .meta {
  display: flex;
  justify-content: space-between;
  font: var(--type-label-m);
  color: var(--color-on-surface-variant);
}

.stepper .bar {
  display: grid;
  grid-auto-flow: column;
  gap: 4px;
}

.stepper .bar span {
  height: 4px;
  border-radius: 2px;
  background: var(--color-surface-container-highest);
}

.stepper .bar span.done {
  background: var(--color-primary);
}

/* Timeline */
.timeline {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
}

.timeline li {
  position: relative;
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: var(--space-3);
  padding-bottom: var(--space-4);
}

.timeline li::before {
  content: "";
  position: absolute;
  left: 13px;
  top: 28px;
  bottom: 0;
  width: 2px;
  background: var(--color-outline-variant);
}

.timeline li:last-child::before {
  display: none;
}

.timeline li.done::before {
  background: var(--color-primary);
}

.timeline .node {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid var(--color-outline);
  background: var(--color-surface);
  color: var(--color-on-primary);
}

.timeline li.done .node {
  border-color: var(--color-primary);
  background: var(--color-primary);
}

.timeline li.current .node {
  border-color: var(--color-primary);
  box-shadow: inset 0 0 0 5px var(--color-surface), inset 0 0 0 14px var(--color-primary);
}

.timeline .node .icon {
  width: 16px;
  height: 16px;
  stroke-width: 2.6;
}

.timeline .t-title {
  font: var(--type-label-l);
}

.timeline .t-sub {
  font: var(--type-body-m);
  color: var(--color-on-surface-variant);
}

/* Digital ID card */
.id-card {
  position: relative;
  border-radius: var(--radius-l);
  padding: var(--space-5);
  color: var(--card-id-text);
  background:
    radial-gradient(circle at 110% -10%, rgb(255 255 255 / 0.16) 0 38%, transparent 39%),
    radial-gradient(circle at -20% 120%, rgb(255 255 255 / 0.08) 0 40%, transparent 41%),
    linear-gradient(135deg, var(--card-id-bg-start), var(--card-id-bg-end));
  box-shadow: var(--elevation-2);
  display: grid;
  gap: var(--space-4);
  overflow: hidden;
  border: 0;
  text-align: left;
  width: 100%;
}

.id-card .id-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  font: var(--type-label-m);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.id-card .brand {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.id-card .name {
  font: var(--type-title-l);
}

.id-card .number {
  font: 600 1.375rem/1.75rem var(--font-mono);
  letter-spacing: 0.08em;
}

.id-card .grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-3) var(--space-4);
}

.id-card .k {
  font: var(--type-label-m);
  color: var(--card-id-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.id-card .v {
  font: var(--type-body-m);
  font-weight: 600;
  overflow-wrap: anywhere;
}

.id-card.mini {
  padding: var(--space-4);
  gap: var(--space-2);
  cursor: pointer;
}

.id-card.mini .number {
  font-size: 1.125rem;
}

/* Home photo carousel (after the nhia.gov.ng hero slider) */
.hero-carousel {
  position: relative;
  aspect-ratio: 716 / 280;
  border-radius: var(--radius-l);
  overflow: hidden;
  background: var(--color-surface-container-high);
  isolation: isolate;
}

.hc-track {
  display: flex;
  height: 100%;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
}

.hc-track::-webkit-scrollbar {
  display: none;
}

.hc-track.dragging {
  scroll-snap-type: none;
  cursor: grabbing;
}

.hc-slide {
  position: relative;
  flex: 0 0 100%;
  scroll-snap-align: start;
  scroll-snap-stop: always;
}

.hc-body {
  display: block;
  height: 100%;
  color: var(--photo-on-scrim);
  text-decoration: none;
}

.hc-body:focus-visible {
  box-shadow: none;
}

.hc-body::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, var(--photo-scrim) 0%, var(--photo-scrim) 38%, transparent 80%);
}

.hc-body:focus-visible::after {
  box-shadow: inset 0 0 0 3px var(--photo-on-scrim), inset 0 0 0 5px var(--brand-green);
  border-radius: var(--radius-l);
}

.hc-slide img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  user-select: none;
  -webkit-user-select: none;
}

.hc-caption {
  position: absolute;
  z-index: 1;
  left: var(--space-4);
  right: 144px;
  bottom: var(--space-3);
  font: 700 1rem/1.25rem var(--font-display);
  text-shadow: 0 1px 2px rgb(0 0 0 / 0.4);
}

.hc-caption .icon {
  margin-left: 2px;
  vertical-align: -3px;
}

.hc-toggle {
  position: absolute;
  z-index: 2;
  top: var(--space-2);
  right: var(--space-2);
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--photo-control);
  color: var(--photo-on-scrim);
}

.hc-toggle:focus-visible {
  box-shadow: 0 0 0 2px var(--photo-on-scrim), 0 0 0 4px var(--brand-green);
}

.hc-dots {
  position: absolute;
  z-index: 2;
  right: var(--space-2);
  bottom: 6px;
  display: flex;
}

.hc-dots button {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  padding: 0;
  border: 0;
  background: none;
}

.hc-dots button::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: var(--radius-full);
  background: var(--photo-dot-idle);
  transition: width var(--motion-short), background var(--motion-short);
}

.hc-dots button[aria-current="true"]::before {
  width: 20px;
  background: var(--photo-on-scrim);
}

.hc-dots button:focus-visible {
  box-shadow: inset 0 0 0 2px var(--photo-on-scrim);
  border-radius: var(--radius-s);
}

@media (prefers-reduced-motion: reduce) {
  .hc-dots button::before {
    transition: none;
  }
}

.qr {
  justify-self: center;
  background: #fff;
  padding: var(--space-3);
  border-radius: var(--radius-m);
  line-height: 0;
}

/* Bottom navigation */
.bottom-nav {
  flex: none;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  height: 80px;
  padding: var(--space-3) 0 var(--space-4);
  background: var(--color-surface-container);
}

.bottom-nav a {
  display: grid;
  justify-items: center;
  align-content: start;
  gap: 4px;
  font: var(--type-label-m);
  color: var(--color-on-surface-variant);
  text-decoration: none;
}

.bottom-nav .pill {
  display: grid;
  place-items: center;
  width: 64px;
  height: 32px;
  border-radius: var(--radius-full);
}

.bottom-nav a[aria-current="page"] {
  color: var(--color-on-surface);
}

.bottom-nav a[aria-current="page"] .pill {
  background: var(--color-secondary-container);
  color: var(--color-on-secondary-container);
}

[data-platform="ios"] .bottom-nav a[aria-current="page"] {
  color: var(--color-primary);
}

[data-platform="ios"] .bottom-nav a[aria-current="page"] .pill {
  background: transparent;
  color: var(--color-primary);
}

/* Switch */
.switch {
  position: relative;
  width: 52px;
  height: 32px;
  flex: none;
  border: 2px solid var(--color-outline);
  border-radius: var(--radius-full);
  background: var(--color-surface-container-highest);
  padding: 0;
}

.switch::after {
  content: "";
  position: absolute;
  top: 6px;
  left: 6px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--color-outline);
  transition: all var(--motion-short) var(--motion-easing);
}

.switch[aria-checked="true"] {
  border-color: var(--color-primary);
  background: var(--color-primary);
}

.switch[aria-checked="true"]::after {
  top: 2px;
  left: 22px;
  width: 24px;
  height: 24px;
  background: var(--color-on-primary);
}

[data-platform="ios"] .switch {
  border: 0;
  width: 51px;
  height: 31px;
}

[data-platform="ios"] .switch::after,
[data-platform="ios"] .switch[aria-checked="true"]::after {
  top: 2px;
  width: 27px;
  height: 27px;
  background: #fff;
  box-shadow: 0 2px 4px rgb(0 0 0 / 0.2);
}

[data-platform="ios"] .switch::after {
  left: 2px;
}

[data-platform="ios"] .switch[aria-checked="true"]::after {
  left: 22px;
}

/* Disclosure */
details.disclosure {
  border-radius: var(--radius-m);
  background: var(--color-surface-container-low);
}

details.disclosure + details.disclosure {
  margin-top: calc(var(--space-2) * -1);
}

details.disclosure summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  min-height: 56px;
  padding: var(--space-3) var(--space-4);
  cursor: pointer;
  list-style: none;
  font: var(--type-body-l);
}

details.disclosure summary::-webkit-details-marker {
  display: none;
}

details.disclosure summary .icon {
  transition: transform var(--motion-short);
  color: var(--color-on-surface-variant);
}

details.disclosure[open] summary .icon {
  transform: rotate(180deg);
}

details.disclosure .body {
  padding: 0 var(--space-4) var(--space-4);
  font: var(--type-body-m);
  color: var(--color-on-surface-variant);
}

.checklist {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: var(--space-2);
}

.checklist li {
  display: flex;
  gap: var(--space-2);
  align-items: flex-start;
}

.checklist .icon {
  width: 20px;
  height: 20px;
  color: var(--color-success);
}

.checklist.limits .icon {
  color: var(--color-warning);
}

.checklist.excl .icon {
  color: var(--color-error);
}

/* Uploads */
.upload {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border: 1px dashed var(--color-outline);
  border-radius: var(--radius-m);
  min-width: 0;
}

.upload.done {
  border-style: solid;
  border-color: var(--color-outline-variant);
  background: var(--color-surface-container-low);
}

.upload .text {
  flex: 1;
  min-width: 0;
  display: grid;
  gap: 2px;
}

.upload .actions {
  display: flex;
  gap: var(--space-1);
}

/* Radio cards */
.radio-card {
  display: flex;
  gap: var(--space-3);
  align-items: flex-start;
  padding: var(--space-4);
  border: 1px solid var(--color-outline-variant);
  border-radius: var(--radius-m);
  background: var(--color-surface);
  cursor: pointer;
}

.radio-card:has(input:checked) {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 1px var(--color-primary);
  background: var(--color-surface-container-low);
}

.radio-card input {
  width: 20px;
  height: 20px;
  margin: 2px 0 0;
  accent-color: var(--color-primary);
  flex: none;
}

.radio-card .text {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.radio-card .title {
  font: var(--type-title-m);
}

/* Map placeholder */
.map {
  height: 140px;
  border-radius: var(--radius-m);
  overflow: hidden;
  background: var(--color-surface-container-high);
}

.map svg {
  width: 100%;
  height: 100%;
  display: block;
}

/* Sheet + toast */
.scrim {
  position: absolute;
  inset: 0;
  background: var(--color-scrim);
  z-index: 20;
  display: none;
}

.sheet {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 21;
  display: none;
  flex-direction: column;
  gap: var(--space-4);
  max-height: 85%;
  overflow: auto;
  padding: var(--space-3) var(--space-5) var(--space-6);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  background: var(--color-surface-container-low);
  box-shadow: var(--elevation-3);
}

.sheet.open,
.scrim.open {
  display: flex;
}

.sheet .grabber {
  align-self: center;
  width: 32px;
  height: 4px;
  border-radius: 2px;
  background: var(--color-outline);
}

.sheet h3 {
  margin: 0;
  font: var(--type-title-l);
}

.toast {
  position: absolute;
  left: var(--space-4);
  right: var(--space-4);
  bottom: 96px;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-s);
  background: var(--color-inverse-surface);
  color: var(--color-inverse-on-surface);
  font: var(--type-body-m);
  box-shadow: var(--elevation-3);
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition: all var(--motion-medium) var(--motion-easing);
}

.toast.show {
  opacity: 1;
  transform: none;
}

.sample-note {
  text-align: center;
  font: var(--type-label-m);
  color: var(--color-on-surface-variant);
}

.hero {
  display: grid;
  gap: var(--space-4);
  justify-items: center;
  text-align: center;
  padding: var(--space-6) var(--space-2);
}

.id-card .seal {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #ffffff;
  flex: none;
}

.id-card .seal img {
  width: 24px;
  height: auto;
}

/* S01 Welcome: full-screen photo, theme-independent (always light text on a dark scrim) */
.screen.welcome {
  background: var(--photo-ground);
  color: var(--photo-on-scrim);
}

.welcome-bg {
  position: absolute;
  inset: 0;
  overflow: hidden;
  background: var(--photo-ground);
}

/* Slow crossfade: each photo holds 7s with a 1.5s fade (14s cycle). */
.welcome-bg img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  animation: welcome-fade 14s linear infinite backwards;
}

.welcome-bg img:nth-child(1) {
  animation-delay: -1.5s;
}

.welcome-bg img:nth-child(2) {
  animation-delay: 5.5s;
}

@keyframes welcome-fade {
  0% { opacity: 0; }
  10.71% { opacity: 1; }
  50% { opacity: 1; }
  60.71% { opacity: 0; }
  100% { opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .welcome-bg img {
    animation: none;
  }

  .welcome-bg img:first-child {
    opacity: 1;
  }
}

.welcome-bg::after {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--welcome-scrim);
}

.welcome-top,
.welcome-bottom {
  position: relative;
  z-index: 1;
  display: grid;
  padding: 0 var(--space-4);
}

.welcome-top {
  justify-items: center;
  gap: var(--space-1);
  /* The status bar overlays the photo on this screen */
  padding-top: calc(44px + var(--space-6));
  text-align: center;
}

[data-offline="true"] .welcome-top {
  padding-top: var(--space-6);
}

.welcome .logo {
  display: grid;
  place-items: center;
  width: 72px;
  height: 72px;
  margin-bottom: var(--space-2);
  border-radius: 20px;
  background: #ffffff; /* the emblem is drawn for a white ground in both themes */
  box-shadow: var(--elevation-1);
}

.welcome .logo img {
  width: 56px;
  height: auto;
}

.welcome h1 {
  margin: 0;
  font: var(--type-display);
}

.welcome-sub {
  margin: 0;
  font: var(--type-body-m);
}

.welcome-top,
.welcome-lead,
.welcome-points {
  text-shadow: 0 1px 3px rgb(0 0 0 / 0.5);
}

.welcome-bottom {
  margin-top: auto;
  gap: var(--space-2);
  padding-bottom: var(--space-6);
}

.welcome-lead {
  margin: 0 0 var(--space-1);
  font: var(--type-title-l);
}

.welcome-points {
  display: grid;
  gap: 6px;
  margin: 0 0 var(--space-3);
  padding: 0;
  list-style: none;
  font: var(--type-body-m);
}

.welcome-points li {
  display: flex;
  gap: var(--space-2);
  align-items: center;
}

.welcome .btn {
  background: var(--photo-on-scrim);
  color: var(--brand-green-deep);
}

.welcome .btn.outlined {
  background: transparent;
  color: var(--photo-on-scrim);
  border-color: var(--photo-on-scrim);
}

.welcome .btn.outlined:hover {
  background: rgb(255 255 255 / 0.12);
}

.welcome .sample-note {
  margin: var(--space-1) 0 0;
  color: var(--photo-on-scrim);
}

/* While Welcome shows, the status bar floats over its photo */
.device[data-screen="S01"]:not([data-offline="true"]) .status-bar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 3;
  background: transparent;
  color: var(--photo-on-scrim);
}

.amount {
  font: var(--type-headline);
}

.kv {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: var(--space-2) 0;
  font: var(--type-body-m);
}

.kv dt {
  color: var(--color-on-surface-variant);
}

.kv dd {
  margin: 0;
  padding-left: var(--space-4);
  text-align: right;
  font-weight: 600;
}

.kv .total {
  border-top: 1px solid var(--color-outline-variant);
  padding-top: var(--space-2);
  font: var(--type-title-m);
}

.seg-tabs {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(0, 1fr);
  border-bottom: 1px solid var(--color-outline-variant);
}

.seg-tabs button {
  border: 0;
  background: none;
  min-height: var(--touch-target);
  font: var(--type-label-l);
  color: var(--color-on-surface-variant);
  border-bottom: 3px solid transparent;
}

.seg-tabs button[aria-selected="true"] {
  color: var(--color-primary);
  border-bottom-color: var(--color-primary);
}

/* ---------- Responsive ---------- */

@media (max-width: 880px) {
  .stage {
    grid-template-columns: minmax(0, 390px);
    gap: var(--space-6);
    padding: var(--space-6) var(--space-4);
  }

  .panel {
    position: static;
  }
}

@media (max-width: 480px) {
  .stage {
    padding: 0 0 var(--space-6);
    gap: var(--space-4);
  }

  .device {
    width: 100%;
    height: 100dvh;
    min-height: 600px;
    border-radius: 0;
    box-shadow: none;
  }

  .panel {
    padding: 0 var(--space-4);
  }
}
