/* Wared design system for the web: the phone app's ui/designsystem/*.kt components, drawn with
   the tokens in tokens.css. Every class starts with ds- so nothing here restyles the existing views.
   Measurements are the Compose ones (Material 3 defaults where the app keeps them). */

/* ---------- Base ---------- */

/* Put on <body> (or a screen root) to get the app's background, ink and font. */
.ds-root {
  margin: 0;
  background: var(--color-background);
  color: var(--color-on-background);
  font: 400 1rem/1.5rem var(--font-family);
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}
.ds-root *, .ds-root *::before, .ds-root *::after,
[class^="ds-"], [class*=" ds-"], [class^="ds-"]::before, [class*=" ds-"]::before, [class^="ds-"]::after, [class*=" ds-"]::after { box-sizing: border-box; }
.ds-root :where(h1, h2, h3, p) { margin: 0; }
.ds-root :where(button, input, textarea, select) { font: inherit; color: inherit; }

.ds-spacer { flex: none; }
.ds-visually-hidden {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------- Icons ---------- */

.ds-icon { flex: none; display: block; overflow: visible; }
.ds-icon .ds-ps { fill: none; stroke: var(--icon-primary); }
.ds-icon .ds-as { fill: none; stroke: var(--icon-accent); }
.ds-icon .ds-pf { fill: var(--icon-primary); }
.ds-icon .ds-af { fill: var(--icon-accent); }
/* BrandIconOnColor: one colour (the content colour) on a coloured fill such as a teal button. */
.ds-icon.ds-on-color .ds-ps, .ds-icon.ds-on-color .ds-as { stroke: currentColor; }
.ds-icon.ds-on-color .ds-pf, .ds-icon.ds-on-color .ds-af { fill: currentColor; }
/* android:autoMirrored: directional icons point the reading way. */
[dir="rtl"] .ds-mirror { transform: scaleX(-1); }
[dir="rtl"] [dir="ltr"] .ds-mirror { transform: none; }

/* IconBadge: a brand icon on a soft circle of one brand colour. */
.ds-icon-badge {
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--color-primary-container);
}
.ds-icon-badge.ds-gold { background: var(--color-secondary-container); }

/* ---------- Interaction: Material state layers and the ripple ---------- */

.ds-interactive { position: relative; overflow: hidden; isolation: isolate; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.ds-interactive::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: currentColor;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--motion-duration-short) linear;
  z-index: -1;
}
@media (hover: hover) {
  .ds-interactive:hover:not(:disabled):not([aria-disabled="true"])::before { opacity: var(--state-hover); }
}
.ds-interactive:focus-visible::before { opacity: var(--state-focus); }
.ds-interactive:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 2px; }
.ds-interactive:disabled, .ds-interactive[aria-disabled="true"] { cursor: default; }
/* Compose's ripple: grows from the touch point, fades after release. */
.ds-ripple {
  position: absolute;
  border-radius: 50%;
  background: currentColor;
  opacity: var(--state-pressed);
  pointer-events: none;
  transform: scale(0.3);
  animation: ds-ripple-grow 225ms var(--motion-ease) forwards;
  z-index: -1;
}
.ds-ripple.ds-out { opacity: 0; transition: opacity 150ms linear; }
@keyframes ds-ripple-grow { to { transform: scale(1); } }

/* ---------- Buttons ---------- */

.ds-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  min-height: var(--size-button-height);
  padding: 8px 24px;
  border: 0;
  border-radius: var(--shape-medium);
  font: 600 1rem/1.5rem var(--font-family); /* titleMedium */
  text-align: center;
  transition: background-color var(--motion-duration) var(--motion-ease), color var(--motion-duration) var(--motion-ease), border-color var(--motion-duration) var(--motion-ease);
}
.ds-btn-primary { width: 100%; background: var(--color-primary); color: var(--color-on-primary); }
.ds-btn-primary.ds-gold { background: var(--color-secondary); color: var(--color-on-secondary); }
/* Disabled (and loading, which disables): Material's onSurface 12% / 38%. */
.ds-btn-primary:disabled {
  background: color-mix(in srgb, var(--color-on-surface) 12%, transparent);
  color: color-mix(in srgb, var(--color-on-surface) 38%, transparent);
}
.ds-btn-secondary {
  background: transparent;
  color: var(--color-primary);
  border: 1.5px solid var(--color-primary);
}
.ds-btn-secondary:disabled {
  color: color-mix(in srgb, var(--color-on-surface) 38%, transparent);
  border-color: color-mix(in srgb, var(--color-primary) 38%, transparent);
}
.ds-btn-secondary:disabled .ds-icon { opacity: 0.38; }
.ds-btn.ds-block { width: 100%; }
/* QuietButton = TextButton: pill, 40dp tall, labelLarge, teal text. */
.ds-btn-quiet {
  min-height: 40px;
  padding: 8px 12px;
  border-radius: var(--shape-full);
  background: transparent;
  color: var(--color-primary);
  font: 500 0.875rem/1.25rem var(--font-family);
}
.ds-btn-quiet.ds-danger { color: var(--color-error); }
.ds-btn-quiet:disabled { color: color-mix(in srgb, var(--color-on-surface) 38%, transparent); }
.ds-btn-quiet:disabled .ds-icon { opacity: 0.38; }

/* AnimatedContent: a new label rolls in from below while the old one leaves upwards (clipped). */
.ds-btn-label { display: inline-grid; overflow: hidden; }
.ds-btn-label > span { grid-area: 1 / 1; white-space: nowrap; }
.ds-btn-label > .ds-in { animation: ds-label-in var(--motion-duration) var(--motion-ease) both; }
.ds-btn-label > .ds-leaving { animation: ds-label-out var(--motion-duration) var(--motion-ease) both; }
@keyframes ds-label-in { from { transform: translateY(100%); opacity: 0; } }
@keyframes ds-label-out { to { transform: translateY(-100%); opacity: 0; } }

/* IconButton: 48dp target, 40dp round state layer, onSurfaceVariant content. */
.ds-icon-btn {
  flex: none;
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--color-on-surface-variant);
  clip-path: circle(20px);
}
.ds-icon-btn:focus-visible { clip-path: none; outline-offset: -4px; }
.ds-icon-btn:disabled .ds-icon { opacity: 0.38; }

/* CircularProgressIndicator (indeterminate): a rotating arc that grows and shrinks. */
.ds-progress { flex: none; display: block; animation: ds-progress-rotate 1.4s linear infinite; }
.ds-progress circle {
  fill: none;
  stroke: currentColor;
  stroke-linecap: square;
  stroke-dasharray: 1 200;
  stroke-dashoffset: 0;
  animation: ds-progress-dash 1.4s ease-in-out infinite;
}
.ds-progress.ds-primary { color: var(--color-primary); }
@keyframes ds-progress-rotate { to { transform: rotate(360deg); } }
@keyframes ds-progress-dash {
  0% { stroke-dasharray: 1 200; stroke-dashoffset: 0; }
  50% { stroke-dasharray: 89 200; stroke-dashoffset: -35; }
  100% { stroke-dasharray: 89 200; stroke-dashoffset: -124; }
}

/* LinearProgressIndicator (determinate), as the setup and plan bars use it. */
.ds-linear-progress {
  width: 100%;
  height: 4px;
  border-radius: var(--shape-full);
  background: var(--color-surface-container-highest);
  overflow: hidden;
}
.ds-linear-progress > span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--color-primary);
  transition: width var(--motion-duration) var(--motion-ease);
}

/* ---------- ChoiceCard ---------- */

.ds-choice-card {
  display: flex;
  align-items: center;
  gap: var(--space-lg);
  width: 100%;
  padding: var(--space-lg);
  border: 1px solid var(--color-outline-variant);
  border-radius: var(--shape-large);
  background: var(--color-surface-container-lowest);
  color: var(--color-on-surface);
  text-align: start;
  font: inherit;
}
.ds-choice-card[aria-checked="true"] {
  /* The 2dp border is drawn inside, like Compose's BorderStroke: the content does not move. */
  border-color: var(--color-primary);
  box-shadow: inset 0 0 0 1px var(--color-primary);
  background: color-mix(in srgb, var(--color-primary-container) 45%, transparent);
}
.ds-choice-card .ds-text { display: flex; flex-direction: column; gap: var(--space-xs); flex: 1 1 auto; min-width: 0; }
.ds-choice-card .ds-title { font: 600 1rem/1.5rem var(--font-family); }
.ds-choice-card .ds-desc { font: 400 0.875rem/1.375rem var(--font-family); color: var(--color-on-surface-variant); }

/* ---------- AppTextField (OutlinedTextField) ---------- */

.ds-tf { width: 100%; display: flex; flex-direction: column; }
.ds-tf-box {
  position: relative;
  display: flex;
  align-items: flex-start;
  min-height: 56px;
  border-radius: var(--shape-medium);
  background: var(--color-surface-container-lowest);
  color: var(--color-on-surface);
}
.ds-tf-input {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 56px;
  margin: 0;
  padding: 16px;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--color-on-surface);
  caret-color: var(--color-primary);
  font: 400 1rem/1.5rem var(--font-family); /* bodyLarge */
  resize: none;
  position: relative;
  z-index: 1;
}
textarea.ds-tf-input { display: block; overflow: hidden; }
.ds-tf.ds-has-icon .ds-tf-input { padding-inline-start: 4px; }
.ds-tf.ds-has-trailing .ds-tf-input { padding-inline-end: 4px; }
.ds-tf-input::placeholder { color: transparent; }
.ds-tf-leading, .ds-tf-trailing {
  flex: none;
  display: grid;
  place-items: center;
  min-width: 48px;
  min-height: 56px;
  position: relative;
  z-index: 1;
}
.ds-tf-label {
  position: absolute;
  top: 16px;
  inset-inline-start: 16px;
  max-width: calc(100% - 32px);
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  color: var(--color-on-surface-variant);
  font: 400 1rem/1.5rem var(--font-family);
  pointer-events: none;
  transform-origin: top left;
  z-index: 2;
  transition: top var(--motion-duration-short) var(--motion-ease), inset-inline-start var(--motion-duration-short) var(--motion-ease),
    font-size var(--motion-duration-short) var(--motion-ease), line-height var(--motion-duration-short) var(--motion-ease), color var(--motion-duration-short) linear;
}
.ds-tf.ds-has-icon .ds-tf-label { inset-inline-start: 52px; }
/* The label floats onto the border when focused or filled (bodySmall), cut into the outline. */
.ds-tf.ds-float .ds-tf-label, .ds-tf-box:focus-within .ds-tf-label {
  top: -8px;
  inset-inline-start: 16px;
  font-size: 0.75rem;
  line-height: 1rem;
}
.ds-tf-outline {
  position: absolute;
  inset: -8px 0 0;
  margin: 0;
  padding: 0 12px;
  border: 1px solid var(--color-outline-variant);
  border-radius: inherit;
  pointer-events: none;
  min-width: 0;
  transition: border-color var(--motion-duration-short) linear;
}
.ds-tf-outline legend {
  float: unset;
  display: block;
  width: auto;
  max-width: 0.01px;
  height: 16px;
  padding: 0;
  overflow: hidden;
  visibility: hidden;
  white-space: nowrap;
  font: 400 0.75rem/1rem var(--font-family);
  transition: max-width 50ms linear;
}
.ds-tf-outline legend > span { display: inline-block; padding: 0 4px; }
.ds-tf.ds-float .ds-tf-outline legend, .ds-tf-box:focus-within .ds-tf-outline legend { max-width: 100%; transition: max-width 100ms linear 50ms; }
.ds-tf-box:focus-within .ds-tf-outline { border-width: 2px; border-color: var(--color-primary); padding: 0 11px; }
.ds-tf-box:focus-within .ds-tf-label { color: var(--color-primary); }
.ds-tf.ds-error .ds-tf-outline { border-color: var(--color-error); }
.ds-tf.ds-error .ds-tf-label { color: var(--color-error); }
.ds-tf.ds-error .ds-tf-input { caret-color: var(--color-error); }
.ds-tf-support {
  margin: 0;
  padding: 4px 16px 0;
  color: var(--color-on-surface-variant);
  font: 400 0.75rem/1rem var(--font-family); /* bodySmall */
}
.ds-tf.ds-error .ds-tf-support { color: var(--color-error); }
.ds-tf.ds-disabled .ds-tf-input, .ds-tf.ds-disabled .ds-tf-label, .ds-tf.ds-disabled .ds-tf-support { color: color-mix(in srgb, var(--color-on-surface) 38%, transparent); }
.ds-tf.ds-disabled .ds-tf-outline { border-color: color-mix(in srgb, var(--color-on-surface) 12%, transparent); }
.ds-tf.ds-disabled .ds-tf-leading .ds-icon { opacity: 0.38; }

/* ---------- Lists ---------- */

.ds-list-group { width: 100%; display: flex; flex-direction: column; gap: var(--space-sm); }
.ds-list-group-title { font: 500 0.875rem/1.25rem var(--font-family); color: var(--color-on-surface-variant); }
.ds-list-surface {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--color-outline-variant);
  border-radius: var(--shape-small);
  background: var(--color-surface-container-lowest);
  color: var(--color-on-surface);
}
.ds-list-row { display: flex; flex-direction: column; width: 100%; }
.ds-list-row-main {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  min-height: 56px;
  padding: var(--space-md) var(--space-lg);
  color: var(--color-on-surface);
  text-align: start;
}
.ds-list-row-text { display: flex; flex-direction: column; gap: 2px; flex: 1 1 auto; min-width: 0; }
.ds-list-row-title { font: 400 1rem/1.5rem var(--font-family); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.ds-list-row-supporting {
  font: 400 0.75rem/1rem var(--font-family);
  color: var(--color-on-surface-variant);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.ds-list-row-value { flex: none; font: 400 0.875rem/1.375rem var(--font-family); color: var(--color-on-surface-variant); white-space: nowrap; }
.ds-divider { height: 1px; border: 0; margin: 0; flex: none; background: var(--color-surface-variant); }
.ds-divider.ds-outline { background: var(--color-outline-variant); }

.ds-avatar {
  flex: none;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--color-primary-container);
  color: var(--color-primary);
  font: 600 0.875rem/1.25rem var(--font-family);
}
.ds-status-dot { flex: none; display: block; width: 8px; height: 8px; border-radius: 50%; background: var(--color-primary); }
.ds-status-dot.ds-attention { background: var(--color-secondary); }

/* ---------- Messages ---------- */

.ds-inline-message {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  width: 100%;
  padding: var(--space-md);
  border-radius: var(--shape-small);
  background: var(--color-primary-container);
  color: var(--color-on-primary-container);
  font: 400 0.875rem/1.375rem var(--font-family);
}
.ds-inline-message.ds-warning { background: var(--color-secondary-container); color: var(--color-on-secondary-container); }
.ds-inline-message.ds-error { background: var(--color-error-container); color: var(--color-on-error-container); }
.ds-inline-message > p { margin: 0; flex: 1 1 auto; min-width: 0; }
/* AnimatedInlineMessage: fade + a third of its height of slide, in and out. */
.ds-animated-message { width: 100%; }
.ds-animated-message > .ds-inline-message { animation: ds-message-in var(--motion-duration) var(--motion-ease) both; }
.ds-animated-message > .ds-leaving { animation: ds-message-out var(--motion-duration) var(--motion-ease) both; }
@keyframes ds-message-in { from { opacity: 0; transform: translateY(-33%); } }
@keyframes ds-message-out { to { opacity: 0; transform: translateY(-33%); } }

/* Toasts (BrandSnackbar): inverse surface, bottom centre. */
.ds-toast-host {
  position: fixed;
  inset-inline: 0;
  bottom: 0;
  z-index: 50;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-bottom: env(safe-area-inset-bottom);
  pointer-events: none;
}
.ds-toast {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  width: calc(100% - 2 * var(--space-lg));
  max-width: 600px;
  min-height: 48px;
  margin: var(--space-lg);
  padding: 6px var(--space-lg);
  border-radius: var(--shape-medium);
  background: var(--color-inverse-surface);
  color: var(--color-inverse-on-surface);
  font: 400 0.875rem/1.375rem var(--font-family);
  box-shadow: 0 1px 3px rgb(0 0 0 / 0.3), 0 4px 8px 3px rgb(0 0 0 / 0.15);
  animation: ds-toast-in 150ms var(--motion-ease) both;
}
.ds-toast > span { flex: 1 1 auto; min-width: 0; padding: 8px 0; }
.ds-toast.ds-leaving { animation: ds-toast-out 75ms linear both; }
.ds-toast .ds-btn-quiet { color: var(--color-inverse-primary); font-weight: 600; margin-inline-end: -8px; }
@keyframes ds-toast-in { from { opacity: 0; transform: scale(0.8); } }
@keyframes ds-toast-out { to { opacity: 0; } }

/* ---------- Controls ---------- */

.ds-status-pill {
  display: inline-block;
  flex: none;
  padding: var(--space-xs) var(--space-md);
  border-radius: var(--shape-extra-large);
  background: var(--color-secondary-container);
  color: var(--color-on-secondary-container);
  font: 500 0.75rem/1rem var(--font-family); /* labelMedium */
  white-space: nowrap;
}
.ds-status-pill.ds-teal { background: var(--color-primary-container); color: var(--color-on-primary-container); }

.ds-switch-row {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  width: 100%;
  padding: var(--space-sm) 0;
  border: 0;
  border-radius: var(--shape-medium);
  background: transparent;
  color: var(--color-on-surface);
  text-align: start;
}
.ds-switch-row .ds-text { display: flex; flex-direction: column; gap: var(--space-xs); flex: 1 1 auto; min-width: 0; }
.ds-switch-row .ds-title { font: 600 0.875rem/1.25rem var(--font-family); }
.ds-switch-row .ds-body { font: 400 0.75rem/1rem var(--font-family); color: var(--color-on-surface-variant); }
.ds-switch-row:disabled .ds-text { opacity: 0.38; }

/* Material 3 Switch: 52x32 track; 16dp outlined thumb off, 24dp thumb on, 28dp while pressed. */
.ds-switch {
  flex: none;
  position: relative;
  width: 52px;
  height: 32px;
  border: 2px solid var(--color-outline);
  border-radius: var(--shape-full);
  background: var(--color-surface-container-highest);
  transition: background-color 100ms linear, border-color 100ms linear;
}
.ds-switch::after {
  content: "";
  position: absolute;
  top: 50%;
  inset-inline-start: 6px; /* centre 16dp from the start of the track */
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--color-outline);
  transform: translateY(-50%);
  transition: inset-inline-start 100ms linear, width 100ms linear, height 100ms linear, background-color 100ms linear;
}
[aria-checked="true"] > .ds-switch { background: var(--color-primary); border-color: var(--color-primary); }
[aria-checked="true"] > .ds-switch::after { inset-inline-start: 22px; width: 24px; height: 24px; background: var(--color-on-primary); }
.ds-switch-row:active:not(:disabled) > .ds-switch::after { width: 28px; height: 28px; inset-inline-start: 0; }
.ds-switch-row[aria-checked="true"]:active:not(:disabled) > .ds-switch::after { inset-inline-start: 20px; }
.ds-switch-row:disabled > .ds-switch { opacity: 0.38; }

/* Chips: 32dp, small shape, labelLarge. */
.ds-chips-row {
  display: flex;
  gap: var(--space-sm);
  width: 100%;
  overflow-x: auto;
  scrollbar-width: none;
}
.ds-chips-row::-webkit-scrollbar { display: none; }
.ds-chips-flow { display: flex; flex-wrap: wrap; gap: var(--space-sm); }
.ds-chip {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  height: 32px;
  padding: 0 16px;
  border: 1px solid var(--color-outline-variant);
  border-radius: var(--shape-small);
  background: transparent;
  color: var(--color-on-surface-variant);
  font: 500 0.875rem/1.25rem var(--font-family);
  white-space: nowrap;
  transition: background-color var(--motion-duration-short) linear, color var(--motion-duration-short) linear;
}
.ds-chip.ds-has-leading { padding-inline-start: 8px; }
.ds-chip.ds-has-trailing { padding-inline-end: 8px; }
.ds-chip.ds-assist { color: var(--color-on-surface); }
.ds-chip[aria-checked="true"], .ds-chip[aria-pressed="true"], .ds-chip.ds-selected {
  border-color: transparent;
  background: var(--color-secondary-container);
  color: var(--color-on-secondary-container);
}
.ds-chip:disabled { opacity: 0.38; }

/* ---------- Checklist ---------- */

.ds-checklist { width: 100%; display: flex; flex-direction: column; gap: var(--space-sm); }
.ds-checklist-title { font: 600 1rem/1.5rem var(--font-family); }
.ds-checklist-surface {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: var(--shape-large);
  background: var(--color-surface-container-lowest);
  color: var(--color-on-surface);
}
.ds-checklist-row {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  width: 100%;
  padding: var(--space-lg);
  border: 0;
  background: transparent;
  color: inherit;
  text-align: start;
}
.ds-checklist-row .ds-text { display: flex; flex-direction: column; gap: 2px; flex: 1 1 auto; min-width: 0; }
.ds-checklist-row .ds-title { font: 600 0.875rem/1.25rem var(--font-family); }
.ds-checklist-row .ds-body { font: 400 0.75rem/1rem var(--font-family); color: var(--color-on-surface-variant); }

/* ---------- Layouts ---------- */

.ds-journey {
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  background: var(--color-background);
  color: var(--color-on-background);
  padding: env(safe-area-inset-top) env(safe-area-inset-right) 0 env(safe-area-inset-left);
}
.ds-journey > .ds-backdrop { z-index: 0; }
.ds-journey-top, .ds-journey-content, .ds-journey-bottom { position: relative; z-index: 1; }
.ds-journey-top { flex: none; display: flex; align-items: center; height: 56px; padding: 0 var(--space-sm); }
.ds-journey-top > .ds-grow { flex: 1 1 auto; }
.ds-journey-content { flex: 1 1 auto; overflow-y: auto; padding: 0 var(--space-screen); overscroll-behavior: contain; }
.ds-journey-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  max-width: var(--size-content-max-width);
  margin: 0 auto;
}
.ds-journey-inner > * { max-width: 100%; }
/* Web only: on a wide window the pinned action keeps the content's width instead of spanning it. */
.ds-journey-bottom {
  flex: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-sm);
  width: 100%;
  max-width: calc(var(--size-content-max-width) + 2 * var(--space-screen));
  margin: 0 auto;
  padding: var(--space-lg) var(--space-screen) calc(var(--space-lg) + env(safe-area-inset-bottom));
}

.ds-step-dots { display: flex; gap: 6px; }
.ds-step-dots > span {
  display: block;
  width: 8px;
  height: 8px;
  border-radius: var(--shape-full);
  background: var(--color-outline-variant);
  transition: width var(--motion-duration-spring) var(--motion-ease-spring), background-color var(--motion-duration-spring) linear;
}
.ds-step-dots > span.ds-active { width: 24px; background: var(--color-primary); }

.ds-hero { width: 100%; display: flex; flex-direction: column; align-items: center; gap: var(--space-md); text-align: center; }
.ds-hero-title { font: 600 1.5rem/2rem var(--font-family); color: var(--color-on-background); }
.ds-hero-body { font: 400 1rem/1.5rem var(--font-family); color: var(--color-on-surface-variant); }

.ds-home {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--color-background);
  color: var(--color-on-background);
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}
.ds-home-header {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-md) var(--space-sm) var(--space-sm) var(--space-screen);
  padding-inline: var(--space-screen) var(--space-sm);
}
.ds-home-header .ds-text { display: flex; flex-direction: column; flex: 1 1 auto; min-width: 0; }
.ds-home-title { font: 600 1.3125rem/1.75rem var(--font-family); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.ds-home-subtitle { font: 400 0.75rem/1rem var(--font-family); color: var(--color-on-surface-variant); }
.ds-home-content { flex: 1 1 auto; display: flex; flex-direction: column; gap: var(--space-lg); padding: var(--space-md) var(--space-screen); }

.ds-backdrop { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }

/* OfflineBanner: slim gold pill with a 2dp shadow. */
.ds-offline-banner {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  margin: var(--space-sm) var(--space-lg);
  padding: var(--space-sm) var(--space-lg);
  border-radius: var(--shape-extra-large);
  background: var(--color-secondary-container);
  color: var(--color-on-secondary-container);
  font: 500 0.875rem/1.25rem var(--font-family);
  box-shadow: 0 1px 2px rgb(0 0 0 / 0.3), 0 1px 3px 1px rgb(0 0 0 / 0.15);
}

/* ---------- LottieIllustration ---------- */

.ds-lottie { position: relative; flex: none; display: grid; place-items: center; }
/* The night stage: a light disc 94% wide behind the black-ink illustration (transparent by day). */
.ds-lottie::before {
  content: "";
  position: absolute;
  width: 94%;
  height: 94%;
  border-radius: 50%;
  background: var(--lottie-stage);
}
.ds-lottie > .ds-lottie-player { position: absolute; inset: 0; }
.ds-lottie > .ds-lottie-player > svg { display: block; }

/* ---------- Sheets and dialogs ---------- */

.ds-scrim {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  background: rgb(0 0 0 / 0.32);
  animation: ds-fade-in var(--motion-duration) var(--motion-ease) both;
}
.ds-scrim.ds-leaving { animation: ds-fade-out 200ms var(--motion-ease) both; }
@keyframes ds-fade-in { from { opacity: 0; } }
@keyframes ds-fade-out { to { opacity: 0; } }

/* ModalBottomSheet: surface, 32dp top corners (shapes.extraLarge), drag handle, max 640dp. */
.ds-sheet {
  align-self: flex-end;
  width: 100%;
  max-width: 640px;
  max-height: calc(100dvh - 48px);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  border-radius: var(--shape-extra-large) var(--shape-extra-large) 0 0;
  background: var(--color-surface);
  color: var(--color-on-surface);
  animation: ds-sheet-in 350ms cubic-bezier(0.05, 0.7, 0.1, 1) both;
}
.ds-scrim.ds-leaving .ds-sheet { animation: ds-sheet-out 200ms cubic-bezier(0.3, 0, 0.8, 0.15) both; }
.ds-sheet-handle { flex: none; display: grid; place-items: center; height: 48px; }
.ds-sheet-handle > span { width: 32px; height: 4px; border-radius: var(--shape-full); background: color-mix(in srgb, var(--color-on-surface-variant) 40%, transparent); }
.ds-sheet-body {
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  padding: 0 var(--space-screen) calc(var(--space-xl) + env(safe-area-inset-bottom));
}
/* A tall sheet scrolls; its rows keep their height (scrolling chip rows would otherwise shrink to nothing). */
.ds-sheet-body > * { flex-shrink: 0; }
@keyframes ds-sheet-in { from { transform: translateY(100%); } }
@keyframes ds-sheet-out { to { transform: translateY(100%); } }

/* AlertDialog: surfaceContainerHigh, shapes.extraLarge, 24dp padding. */
.ds-dialog {
  margin: auto;
  width: calc(100% - 48px);
  min-width: 280px;
  max-width: 560px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  border-radius: var(--shape-extra-large);
  background: var(--color-surface-container-high);
  color: var(--color-on-surface);
  animation: ds-dialog-in var(--motion-duration) var(--motion-ease) both;
}
.ds-dialog-icon { align-self: center; margin-bottom: 16px; }
.ds-dialog-title { margin: 0 0 16px; font: 600 1.5rem/2rem var(--font-family); }
.ds-dialog-icon + .ds-dialog-title { text-align: center; }
.ds-dialog-text { margin: 0; font: 400 0.875rem/1.375rem var(--font-family); color: var(--color-on-surface-variant); }
.ds-dialog-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: var(--space-sm); padding-top: 24px; }
@keyframes ds-dialog-in { from { opacity: 0; transform: scale(0.9); } }

/* ---------- Navigation (admin shell): M3 NavigationBar, NavigationRail from 840dp ---------- */

/* NavigationBar: 80dp, surfaceContainerLowest, an outlineVariant hairline above (AdminNavigationBar). */
.ds-nav {
  position: fixed;
  inset-inline: 0;
  bottom: 0;
  z-index: 10;
  background: var(--color-surface-container-lowest);
  padding-bottom: env(safe-area-inset-bottom);
}
.ds-nav-items { display: flex; height: 80px; }
.ds-nav-item {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 12px 0 16px;
  border: 0;
  background: transparent;
  color: var(--color-on-surface-variant);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.ds-nav-item:focus-visible { outline: none; }
.ds-nav-icon { display: grid; place-items: center; width: 64px; height: 32px; position: relative; }
/* The pill: primaryContainer, growing out from its centre when selected (M3's indicator motion). */
.ds-nav-indicator {
  display: grid;
  place-items: center;
  width: 64px;
  height: 32px;
  border-radius: var(--shape-full);
  color: var(--color-on-surface-variant);
}
.ds-nav-indicator::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: var(--color-primary-container);
  opacity: 0;
  transform: scaleX(0.4);
  transition: opacity 150ms linear, transform var(--motion-duration) var(--motion-ease);
  z-index: -2;
}
.ds-nav-item.ds-selected .ds-nav-indicator::after { opacity: 1; transform: none; }
.ds-nav-item.ds-selected .ds-nav-indicator { color: var(--color-on-surface); }
@media (hover: hover) {
  .ds-nav-item:hover .ds-nav-indicator::before { opacity: var(--state-hover); }
}
.ds-nav-item:focus-visible .ds-nav-indicator::before { opacity: var(--state-focus); }
.ds-nav-item:focus-visible .ds-nav-indicator { outline: 2px solid var(--color-primary); outline-offset: 2px; }
.ds-nav-label {
  max-width: 100%;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font: 500 0.75rem/1rem var(--font-family); /* labelMedium */
  color: var(--color-on-surface-variant);
}
.ds-nav-item.ds-selected .ds-nav-label { font-weight: 600; color: var(--color-on-surface); }

/* NavigationRail: 80dp wide on the start side, items from the top, 56x32 pills. */
@media (min-width: 840px) {
  .ds-nav {
    position: sticky;
    top: 0;
    inset-inline: auto;
    bottom: auto;
    flex: none;
    width: 80px;
    height: 100vh;
    height: 100dvh;
    padding: 0;
    display: flex;
    flex-direction: row-reverse;
    background: var(--color-surface-container-lowest);
  }
  .ds-nav-divider { width: 1px; height: auto; }
  .ds-nav-items { flex: 1 1 auto; flex-direction: column; align-items: center; gap: 12px; height: auto; padding-top: 44px; }
  .ds-nav-item { flex: none; width: 80px; padding: 0 0 4px; }
  .ds-nav-icon, .ds-nav-indicator { width: 56px; }
}

/* ExtendedFloatingActionButton: 56dp, 16dp corners, primary, level-3 shadow. */
.ds-ext-fab {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-height: 56px;
  padding: 0 20px 0 16px;
  padding-inline: 16px 20px;
  border: 0;
  border-radius: var(--shape-medium);
  background: var(--color-primary);
  color: var(--color-on-primary);
  font: 500 0.875rem/1.25rem var(--font-family); /* labelLarge */
  box-shadow: 0 1px 3px rgb(0 0 0 / 0.3), 0 4px 8px 3px rgb(0 0 0 / 0.15);
}

/* ---------- Reduced motion: the same screens, still ---------- */

@media (prefers-reduced-motion: reduce) {
  .ds-root *, .ds-root *::before, .ds-root *::after,
  .ds-scrim, .ds-sheet, .ds-dialog, .ds-toast {
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 1ms !important;
  }
  .ds-progress, .ds-progress circle { animation-duration: 1.4s !important; animation-iteration-count: infinite !important; }
}
