@font-face {
  font-family: Inter;
  src: url(inter.woff2) format("woff2");
  font-weight: 400 700;
  font-display: swap;
}

:root {
  color-scheme: light;
  --bg: #eef1f5;
  --surface: #fff;
  --ink: #131c2b;
  --muted: #536074;
  --faint: #7a8597;
  --line: #d8dee8;
  --line-strong: #a5b0c0;
  --accent: #1b4f9c;
  --accent-hover: #143e7c;
  --accent-soft: #e5edf8;
  --amber: #85500a;
  --amber-soft: #fbefd9;
  --danger: #a3261c;
  --danger-soft: #fbebe8;
  /* Escala tipográfica (Untitled UI): úsala en lugar de tamaños sueltos. */
  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-md: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.25rem;
  --display-xs: 1.5rem;
  --display-sm: 1.875rem;
  --weight-medium: 500;
  --weight-semibold: 600;
  --weight-bold: 700;
  --radius: 8px;
  --shadow-sm: 0 1px 2px rgb(16 24 40 / 0.05);
  --shadow-md: 0 1px 3px rgb(16 24 40 / 0.06), 0 12px 24px -8px rgb(16 24 40 / 0.12);
  --radius-lg: 12px;
  --icon-check: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'><path d='m3.5 8.5 3 3 6-7'/></svg>");
  --icon-chevron: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'><path d='m1.5 1.75 4.5 4.5 4.5-4.5'/></svg>");
}

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

html {
  -webkit-tap-highlight-color: transparent;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 1rem/1.5 Inter, system-ui, sans-serif;
  font-feature-settings: "cv11", "ss01";
  -webkit-text-size-adjust: 100%;
}

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

h1 {
  font-size: var(--display-xs);
  line-height: 1.15;
  font-weight: 700;
  letter-spacing: -0.025em;
  text-wrap: balance;
}

h2,
.h2 {
  font-size: var(--text-lg);
  line-height: 1.35;
  font-weight: 650;
  letter-spacing: -0.01em;
}

h1.h2 {
  font-size: var(--text-xl);
}

h3 {
  font-size: var(--text-md);
  line-height: 1.35;
  font-weight: 600;
}

a {
  color: var(--accent);
  text-decoration: none;
}

:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--accent) 55%, transparent);
  outline-offset: 2px;
}

.muted,
.fine,
.hint {
  color: var(--muted);
}

.fine,
.hint {
  font-size: var(--text-sm);
}

.visually-hidden:where(:not(:focus-within, :active)) {
  position: absolute !important;
  clip-path: inset(50%) !important;
  overflow: hidden !important;
  width: 1px !important;
  height: 1px !important;
  margin: -1px !important;
  padding: 0 !important;
  border: 0 !important;
  white-space: nowrap !important;
}

[hidden] {
  display: none !important;
}

/* Estructura */

.shell {
  width: min(100% - 32px, 40rem);
  margin-inline: auto;
}

.shell.wide {
  width: min(100% - 32px, 76rem);
}

.shell.compact {
  width: min(100% - 32px, 26rem);
}

main {
  padding-block: clamp(24px, 5vw, 56px) 64px;
}

.top {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.top-inner {
  min-height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-weight: 650;
  text-decoration: none;
  letter-spacing: -0.01em;
}

.brand em {
  font-style: normal;
  font-weight: 400;
  color: var(--muted);
  margin-left: 4px;
}

.brand-mark {
  width: 28px;
  height: 28px;
  flex: none;
}

.brand-mark rect {
  fill: var(--accent);
}

.brand-mark path {
  fill: none;
  stroke: #fff;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.sheet,
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: clamp(20px, 4vw, 32px);
}

.sheet:not(dialog) + .sheet:not(dialog),
.panel + .panel {
  margin-top: 16px;
}

.stack {
  display: grid;
  gap: 20px;
}

.stack > .button {
  justify-self: start;
}

.intro {
  margin-bottom: 28px;
}

.intro .lede {
  margin-top: 10px;
  color: var(--muted);
  font-size: var(--text-md);
  max-width: 34em;
}

.back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  margin: -12px 0 4px;
  font-size: var(--text-sm);
  font-weight: 500;
}

.back::before {
  content: "";
  width: 10px;
  height: 7px;
  background: currentColor;
  mask: var(--icon-chevron) no-repeat center / contain;
  rotate: 90deg;
}

/* Datos del viaje */

.trip {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  margin-top: 24px;
  border-block: 1px solid var(--line-strong);
}

.trip div {
  padding: 14px 24px 14px 0;
}

.trip div + div {
  padding-left: 24px;
  border-left: 1px solid var(--line);
}

.trip dt {
  font-size: var(--text-xs);
  color: var(--muted);
}

.trip dd {
  font-weight: 600;
  margin-top: 2px;
}

/* Formularios */

fieldset {
  border: 0;
  padding: 0;
  min-width: 0;
}

legend + * {
  clear: both;
}

fieldset + fieldset {
  margin-top: 28px;
  padding-top: 28px;
  border-top: 1px solid var(--line);
}

legend {
  float: left;
  width: 100%;
  padding: 0;
  margin-bottom: 18px;
  font-size: var(--text-md);
  font-weight: 650;
}

.fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px 16px;
}

.span,
.pickup {
  grid-column: 1 / -1;
}

.pickup {
  display: grid;
  gap: 18px;
}

.field {
  display: grid;
  gap: 6px;
  min-width: 0;
  align-content: start;
}

label {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--ink);
}

.optional {
  font-weight: 400;
  color: var(--muted);
}

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

input:not([type="checkbox"], [type="radio"]),
select {
  appearance: none;
  width: 100%;
  min-height: 48px;
  margin: 0;
  padding: 11px 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background-color: var(--surface);
  color: var(--ink);
  font-size: var(--text-md);
  font-weight: 400;
  line-height: 1.4;
  transition: border-color 0.15s, box-shadow 0.15s;
}

input::placeholder {
  color: var(--faint);
  opacity: 1;
}

input:not([type="checkbox"], [type="radio"]):focus,
select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent);
}

input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--ink);
  box-shadow: 0 0 0 40px var(--surface) inset;
  caret-color: var(--ink);
}

input[type="search"]::-webkit-search-decoration,
input[type="search"]::-webkit-search-cancel-button,
input[type="search"]::-webkit-search-results-button {
  appearance: none;
  display: none;
}

input[type="search"] {
  padding-left: 40px;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none' stroke='%23536074' stroke-width='1.7' stroke-linecap='round'><circle cx='8.5' cy='8.5' r='5.5'/><path d='m13 13 4 4'/></svg>");
  background-repeat: no-repeat;
  background-position: 13px 50%;
  background-size: 18px;
}

input:disabled {
  background: var(--bg);
}

/* Selector: aspecto propio en todos los navegadores; con base-select también la lista. */
select {
  padding-right: 42px;
  cursor: pointer;
  background-image: var(--icon-chevron-muted, url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8' fill='none' stroke='%23536074' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'><path d='m1.5 1.75 4.5 4.5 4.5-4.5'/></svg>"));
  background-repeat: no-repeat;
  background-position: calc(100% - 16px) 50%;
  background-size: 12px 8px;
}

select:has(option[value=""]:checked) {
  color: var(--faint);
}

@supports (appearance: base-select) {
  select,
  select::picker(select) {
    appearance: base-select;
  }

  select {
    display: flex;
    align-items: center;
    padding-right: 14px;
    background-image: none;
  }

  select::picker-icon {
    content: "";
    width: 12px;
    height: 8px;
    margin-left: auto;
    background: var(--muted);
    mask: var(--icon-chevron) no-repeat center / contain;
    transition: rotate 0.2s;
  }

  select:open::picker-icon {
    rotate: 180deg;
  }

  select::picker(select) {
    margin-block: 6px;
    padding: 6px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--surface);
    box-shadow: 0 1px 2px rgb(20 33 30 / 0.06), 0 12px 32px -8px rgb(20 33 30 / 0.22);
    max-height: min(22rem, 60dvh);
  }

  select option {
    padding: 11px 12px;
    border-radius: 6px;
    color: var(--ink);
    font-size: var(--text-sm);
    line-height: 1.35;
    cursor: pointer;
  }

  select option[value=""] {
    display: none;
  }

  select option:focus-visible {
    background: var(--accent-soft);
    outline: none;
  }

  select option:checked {
    font-weight: 600;
  }

  select option::checkmark {
    order: 1;
    margin-left: auto;
    content: "";
    width: 14px;
    height: 14px;
    background: var(--accent);
    mask: var(--icon-check) no-repeat center / contain;
  }

  select option:not(:checked)::checkmark {
    visibility: hidden;
  }
}

/* Casilla */

.check {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-height: 44px;
  font-size: var(--text-sm);
  font-weight: 500;
  cursor: pointer;
}

input[type="checkbox"] {
  appearance: none;
  display: inline-grid;
  place-content: center;
  flex: none;
  width: 22px;
  height: 22px;
  margin: 0;
  border: 1.5px solid var(--line-strong);
  border-radius: 6px;
  background: var(--surface);
  cursor: pointer;
  transition: background-color 0.15s, border-color 0.15s;
}

input[type="checkbox"]::before {
  content: "";
  width: 14px;
  height: 14px;
  background: #fff;
  mask: var(--icon-check) no-repeat center / contain;
  scale: 0;
}

input[type="checkbox"]:checked {
  background: var(--accent);
  border-color: var(--accent);
}

input[type="checkbox"]:checked::before {
  scale: 1;
}

@media (prefers-reduced-motion: no-preference) {
  input[type="checkbox"]::before {
    transition: scale 0.15s ease;
  }
}

@media (forced-colors: active) {
  input[type="checkbox"]::before {
    background: CanvasText;
  }
}

/* Validación */

.field-error {
  display: none;
  align-items: flex-start;
  gap: 6px;
  color: var(--danger);
  font-size: var(--text-sm);
  font-weight: 500;
}

.field-error svg {
  flex: none;
  width: 16px;
  height: 16px;
  margin-top: 2px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
}

.field :is(:user-invalid, .user-invalid-fallback) {
  border-color: var(--danger);
  background-color: var(--danger-soft);
}

.field :is(:user-invalid, .user-invalid-fallback):focus {
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--danger) 20%, transparent);
}

.field :is(:user-invalid, .user-invalid-fallback) ~ .field-error,
.field:has(> .input-group :is(input, select)[aria-invalid="true"]) > .field-error {
  display: flex;
}

.alert,
.notice {
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: var(--text-sm);
  border-left: 4px solid;
}

.alert {
  background: var(--danger-soft);
  border-color: var(--danger);
  color: #6e1a13;
}

.notice {
  background: var(--accent-soft);
  border-color: var(--accent);
  margin-bottom: 20px;
}

main > .alert {
  margin-bottom: 16px;
}

/* Botones */

.button,
.text-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  margin: 0;
  border: 1px solid transparent;
  border-radius: var(--radius);
  font-size: var(--text-sm);
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  text-align: center;
  cursor: pointer;
  transition: background-color 0.15s, border-color 0.15s, color 0.15s;
}

.button {
  padding: 10px 18px;
}

.button.block {
  width: 100%;
}

.primary {
  background: var(--accent);
  color: #fff;
}

.secondary {
  background: var(--surface);
  border-color: var(--line-strong);
  color: var(--ink);
}

.ghost {
  background: none;
  color: var(--accent);
}

.danger {
  background: var(--danger);
  color: #fff;
}

.text-button {
  min-height: 40px;
  padding: 6px 14px;
  border-color: var(--line-strong);
  background: var(--surface);
  color: var(--ink);
  font-size: var(--text-sm);
}

.text-button svg {
  width: 16px;
  height: 16px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

form[data-sending] button {
  opacity: 0.7;
  cursor: progress;
}

.form-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px 20px;
  margin-top: 28px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}

.form-footer .fine {
  flex: 1 1 16rem;
}

/* Confirmación */

.done {
  display: grid;
  justify-items: start;
  gap: 14px;
}

.done-mark {
  width: 48px;
  height: 48px;
  margin-bottom: 4px;
}

.done-mark circle {
  fill: var(--accent-soft);
}

.done-mark path {
  fill: none;
  stroke: var(--accent);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.done p {
  color: var(--muted);
  max-width: 32em;
}

/* Panel */

.page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px 24px;
  margin-bottom: 24px;
}

.page-head .muted {
  margin-top: 4px;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.search {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 10px;
  margin-bottom: 24px;
}

.search .field {
  flex: 1 1 10rem;
}

.stack > .search {
  margin-bottom: 0;
}

progress {
  appearance: none;
  grid-column: 1 / -1;
  width: 100%;
  height: 6px;
  margin-top: 10px;
  border: 0;
  border-radius: 3px;
  background: var(--accent-soft);
  color: var(--accent);
  overflow: hidden;
}

progress::-webkit-progress-bar {
  background: var(--accent-soft);
  border-radius: 3px;
}

progress::-webkit-progress-value {
  background: var(--accent);
  border-radius: 3px;
}

progress::-moz-progress-bar {
  background: var(--accent);
  border-radius: 3px;
}

.empty {
  display: grid;
  justify-items: start;
  gap: 14px;
  padding: 32px;
  background: var(--surface);
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-lg);
  color: var(--muted);
}

/* Bloques plegables */

details > summary {
  list-style: none;
  cursor: pointer;
}

details > summary::-webkit-details-marker {
  display: none;
}

/* Formulario público */

.shell.register-width {
  width: min(100% - 32px, 70rem);
}

.register-photo {
  aspect-ratio: 2 / 1;
  margin-bottom: 16px;
  border-radius: 16px;
  background: #c4dcee url(register-juan-dolio.webp) center / cover no-repeat;
}

.panel {
  box-shadow: var(--shadow-sm);
}

.form-head .lede,
.success .lede {
  margin-top: 10px;
  color: var(--muted);
  font-size: var(--text-md);
}

.trip-facts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  margin-top: 18px;
  padding: 0;
  list-style: none;
  font-size: var(--text-sm);
  font-weight: 500;
}

.trip-facts li {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  text-align: start;
}

.icon {
  width: 20px;
  height: 20px;
  flex: none;
}

.trip-facts .icon {
  color: var(--accent);
  margin-block-start: max(0px, (1lh - 20px) / 2);
}

.register {
  display: grid;
  gap: 16px;
  align-items: start;
}

.form-card {
  min-width: 0;
  padding: clamp(20px, 4vw, 32px);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow-sm);
}

.form-head {
  display: grid;
  gap: 8px;
  padding-bottom: 24px;
}

.form-head .lede {
  margin-top: 0;
}

.form-head .trip-facts {
  margin-top: 8px;
}

.form-logo {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  margin-bottom: 8px;
  border-radius: 12px;
  background: var(--accent);
  color: #fff;
}

.form-logo .icon {
  width: 24px;
  height: 24px;
}

.form-card > .alert {
  margin-bottom: 24px;
}

.form-section {
  padding-top: 28px;
  border-top: 1px solid var(--line);
}

.form-section + .form-section {
  margin-top: 28px;
}

.form-section > h2 {
  margin-bottom: 18px;
}

.register h2 {
  font-size: var(--text-lg);
}

.panel > h2 {
  margin-bottom: 18px;
}

.choice-group {
  display: grid;
  gap: 12px;
}

.choice-group > legend {
  float: none;
  width: auto;
  margin-bottom: 0;
  padding: 0;
}

.choice-group > legend + * {
  clear: none;
}

.choice-group legend h2 {
  margin: 0;
}

.label,
.choice-group.nested > legend,
.choice-group.department > legend {
  font-size: var(--text-sm);
  font-weight: 600;
  margin-bottom: 8px;
}

.choice-group.department {
  margin-top: 20px;
}

.hint {
  margin-top: -2px;
}

/* Tarjeta seleccionable: el radio cubre toda la tarjeta, así el foco y el clic son de la tarjeta. */
.choice-cards {
  display: grid;
  gap: 12px;
}

.choice-card {
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  min-height: 76px;
  padding: 16px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: var(--surface);
  cursor: pointer;
  transition: border-color 0.15s, background-color 0.15s, box-shadow 0.15s;
}

.choice-card input,
.choice-row input {
  appearance: none;
  margin: 0;
  cursor: pointer;
}

.choice-card input {
  position: absolute;
  inset: 0;
  border-radius: inherit;
}

.choice-card input:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--accent) 45%, transparent);
  outline-offset: 2px;
}

.choice-icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: #f1f4f8;
  color: var(--muted);
  transition: background-color 0.15s, color 0.15s;
}

.choice-icon .icon {
  width: 22px;
  height: 22px;
}

.choice-text {
  display: grid;
  gap: 2px;
}

.choice-text strong {
  font-weight: 600;
}

.choice-text span {
  font-size: var(--text-sm);
  color: var(--muted);
}

.choice-check {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border: 1.5px solid var(--line-strong);
  border-radius: 50%;
  color: #fff;
  transition: background-color 0.15s, border-color 0.15s;
}

.choice-check .icon {
  width: 14px;
  height: 14px;
  stroke-width: 3;
  scale: 0;
}

.choice-card:has(input:checked) {
  border-color: var(--accent);
  background: #f6f9fe;
  box-shadow: inset 0 0 0 1px var(--accent);
}

.choice-card:has(input:checked) .choice-icon {
  background: var(--accent-soft);
  color: var(--accent);
}

.choice-card:has(input:checked) .choice-check {
  background: var(--accent);
  border-color: var(--accent);
}

.choice-card:has(input:checked) .choice-check .icon {
  scale: 1;
}

/* Fila de opción (departamentos y paradas) con un radio propio. */
.choice-grid,
.choice-list {
  display: grid;
  gap: 8px;
}

.choice-row {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 52px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  font-size: var(--text-sm);
  font-weight: 500;
  cursor: pointer;
  transition: border-color 0.15s, background-color 0.15s;
}

.choice-row input {
  display: grid;
  place-content: center;
  flex: none;
  width: 20px;
  height: 20px;
  border: 1.5px solid var(--line-strong);
  border-radius: 50%;
  background: var(--surface);
}

.choice-row input::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #fff;
  scale: 0;
}

.choice-row input:checked {
  border-color: var(--accent);
  background: var(--accent);
}

.choice-row input:checked::before {
  scale: 1;
}

.choice-row input:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--accent) 45%, transparent);
  outline-offset: 2px;
}

.choice-row:has(input:checked) {
  border-color: var(--accent);
  background: #f6f9fe;
}

.choice-row span {
  overflow-wrap: anywhere;
}

.choice-group:has(> :not(.reveal) input[aria-invalid="true"]) > .field-error {
  display: flex;
}

:is(.choice-card, .choice-row):has(input[aria-invalid="true"]) {
  border-color: var(--danger);
}

/* Pregunta que aparece según la opción elegida. */
.reveal {
  display: grid;
  gap: 16px;
  margin-top: 4px;
  padding: 16px;
  border-radius: 12px;
  background: #f5f7fb;
  border: 1px solid var(--line);
}

.reveal .choice-group.nested {
  gap: 0;
}

/* Campo con ícono y acción. */
.input-group {
  position: relative;
}

.input-group input[type="search"] {
  background-image: none;
}

.input-group .input-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  translate: 0 -50%;
  color: var(--faint);
  pointer-events: none;
}

.input-group input:not([type="checkbox"], [type="radio"]),
.input-group select {
  padding-left: 44px;
}

.input-group.has-action input {
  padding-right: 92px;
}

.reveal-password {
  position: absolute;
  right: 6px;
  top: 50%;
  translate: 0 -50%;
  min-width: 76px;
  min-height: 36px;
  padding: 0 12px;
  border: 0;
  border-radius: 6px;
  background: none;
  color: var(--accent);
  font-size: var(--text-sm);
  font-weight: 600;
  cursor: pointer;
}

.reveal-password:focus-visible {
  outline-offset: -2px;
}

/* Resumen del viaje */
.trip-summary {
  display: grid;
  gap: 18px;
  padding: 24px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow-sm);
}

.route {
  display: grid;
  gap: 0;
  margin: 0;
  padding: 0;
  list-style: none;
}

.route li {
  position: relative;
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) auto;
  column-gap: 12px;
  padding-bottom: 18px;
}

.route li:last-child {
  padding-bottom: 0;
}

.route li:not(:last-child)::before {
  content: "";
  position: absolute;
  left: 11px;
  top: 18px;
  bottom: 2px;
  border-left: 2px dashed var(--line-strong);
}

.route-dot {
  grid-row: 1 / span 3;
  width: 14px;
  height: 14px;
  margin: 3px 0 0 5px;
  border: 3px solid var(--accent);
  border-radius: 50%;
  background: var(--surface);
}

.route-dot.end {
  background: var(--accent);
}

.route-label {
  grid-column: 2;
  font-size: var(--text-xs);
  color: var(--muted);
}

.route strong {
  grid-column: 2;
  font-weight: 600;
}

.route-note {
  grid-column: 2;
  font-size: var(--text-sm);
  color: var(--muted);
  overflow-wrap: anywhere;
}

.route-note:empty {
  display: none;
}

.route .change {
  grid-column: 3;
  grid-row: 1 / span 2;
  align-self: start;
}

.change {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  font-size: var(--text-sm);
  font-weight: 600;
  justify-self: start;
}

.summary-list {
  display: grid;
  border-top: 1px solid var(--line);
}

.summary-list div {
  display: grid;
  grid-template-columns: 7.5rem minmax(0, 1fr);
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  font-size: var(--text-sm);
}

.summary-list dt {
  color: var(--muted);
}

.summary-list dd {
  font-weight: 500;
  overflow-wrap: anywhere;
}

.summary-list dd.is-empty,
.route strong.is-empty {
  color: var(--faint);
  font-weight: 400;
}

.trip-summary .fine {
  text-align: center;
  margin-top: -6px;
}

.trip-lines dd small {
  display: block;
  font-size: var(--text-sm);
  font-weight: 400;
  color: var(--muted);
}

.leg-block {
  display: grid;
  gap: 8px;
}

.leg-name {
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: var(--accent);
}

.button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* Botón con estado de carga */
.button[aria-busy="true"] {
  pointer-events: none;
  opacity: 0.85;
}

.button[aria-busy="true"]::before {
  content: "";
  width: 16px;
  height: 16px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to {
    rotate: 360deg;
  }
}

/* Mensajes */
.alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.alert .icon {
  margin-top: 1px;
  color: var(--danger);
}

/* Confirmación */
.success {
  display: grid;
  gap: 20px;
  max-width: 34rem;
  margin-inline: auto;
}

.success h1 {
  font-size: var(--display-xs);
}

.success .lede {
  margin-top: -10px;
}

.success-mark {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  box-shadow: 0 0 0 8px #f2f6fc;
}

.success-mark .icon {
  width: 28px;
  height: 28px;
  stroke-width: 2.5;
}

.success-actions {
  display: grid;
  gap: 10px;
  text-align: center;
}

.ticket {
  display: grid;
  gap: 16px;
}

.ticket + .ticket {
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

.ticket h2 {
  font-size: var(--text-md);
  font-weight: var(--weight-semibold);
}

[data-uppercase] {
  text-transform: uppercase;
}

/* Pase de abordaje (confirmación): todo centrado, como en la imagen que se descarga. */
.pass-wrap {
  display: grid;
  gap: 10px;
}

.pass-instructions {
  display: grid;
  gap: 4px;
  padding: 12px 14px;
  border-radius: var(--radius);
  background: var(--accent-soft);
  font-size: var(--text-sm);
}

.pass-backdrop {
  position: relative;
  display: grid;
  justify-items: center;
  padding: clamp(24px, 6vw, 40px);
  border-radius: 16px;
  background: var(--bg);
}

.pass-backdrop::before,
.pass-backdrop::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: repeat -14px 0 / 28px 28px url(icon.svg);
  mask-image: linear-gradient(90deg, black 50%, transparent 50%),
    linear-gradient(black 25%, transparent 25%);
  mask-size: 56px 112px;
  mask-position: -14px 0;
  mask-composite: intersect;
  opacity: 0.18;
  pointer-events: none;
}

.pass-backdrop::after {
  mask-position: 14px 56px;
}

.pass {
  position: relative;
  z-index: 1;
  display: grid;
  justify-items: center;
  width: min(100%, 352px);
  min-width: 0;
  padding: 24px 20px 22px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: var(--shadow-md);
  text-align: center;
}

.pass-head {
  display: grid;
  justify-items: center;
  gap: 10px;
}

.pass-main,
.pass-stub {
  display: grid;
  justify-items: center;
  width: 100%;
  min-width: 0;
}

.pass-logo {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--accent);
  color: #fff;
}

.pass-logo .icon {
  width: 24px;
  height: 24px;
}

.pass-head p {
  display: grid;
}

.pass-head strong {
  font-size: var(--text-md);
  font-weight: var(--weight-bold);
}

.pass-head p span {
  font-size: var(--text-sm);
  color: var(--muted);
}

.pass-body {
  display: grid;
  justify-items: center;
  gap: 2px;
  margin-top: 18px;
}

.pass-body h2 {
  font-size: var(--text-xl);
  font-weight: var(--weight-bold);
  overflow-wrap: anywhere;
}

.pass-dept {
  font-size: var(--text-sm);
  color: var(--muted);
  overflow-wrap: anywhere;
}

.pass-facts {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.pass-facts dt {
  font-size: var(--text-xs);
  color: var(--muted);
}

.pass-facts dd {
  font-size: var(--text-md);
  font-weight: var(--weight-semibold);
  overflow-wrap: anywhere;
}

.pass-cut {
  width: 100%;
  margin: 20px 0;
  border-top: 2px dashed #c3cad5;
}

.pass-qr {
  display: grid;
  justify-items: center;
  gap: 10px;
}

.qr {
  width: min(176px, 46vw);
  aspect-ratio: 1;
}

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

.pass-qr p {
  color: var(--ink);
  font-family: Inter, system-ui, sans-serif;
  font-size: var(--text-md);
  font-weight: var(--weight-bold);
}

.pass-qr strong {
  font-weight: inherit;
}

[data-pass-design|="ticket"] .pass {
  --notch: 13px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  box-shadow: none;
  filter: drop-shadow(0 4px 10px rgb(16 24 40 / 0.12));
}

[data-pass-design="ticket"] .pass-main,
[data-pass-design="ticket"] .pass-stub {
  background: var(--surface);
  mask: radial-gradient(circle at left var(--notch-edge), transparent var(--notch), black calc(var(--notch) + 1px)),
    radial-gradient(circle at right var(--notch-edge), transparent var(--notch), black calc(var(--notch) + 1px));
  mask-composite: intersect;
}

[data-pass-design|="ticket"] .pass-main {
  --notch-edge: bottom;
  padding: 24px 20px 20px;
  border-radius: 8px 8px 0 0;
}

[data-pass-design|="ticket"] .pass-stub {
  --notch-edge: top;
  padding: 0 20px 22px;
  border-radius: 0 0 8px 8px;
}

[data-pass-design|="ticket"] .pass-cut {
  margin-top: 0;
}

[data-pass-design="ticket-dawn"] .pass {
  --pass-photo: url("pass-juan-dolio-dawn.webp");
}

[data-pass-design="ticket-avenue"] .pass {
  --pass-photo: url("register-juan-dolio.webp");
}

[data-pass-design^="ticket-"] .pass {
  --pass-photo-shade: rgba(8, 23, 43, 0.65);
  --pass-photo-qr-shade: rgba(8, 23, 43, 0.88);
  --pass-photo-position: 40%;
  color: #fff;
}

[data-pass-design^="ticket-"] .pass::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: inherit;
  background: linear-gradient(var(--pass-photo-shade) 48%, var(--pass-photo-qr-shade) 64%), var(--pass-photo) #102b50;
  background-position: var(--pass-photo-position) center;
  background-size: cover;
  background-repeat: no-repeat;
  mask: radial-gradient(circle at left var(--pass-seam, 50%), transparent var(--notch), black calc(var(--notch) + 1px)),
    radial-gradient(circle at right var(--pass-seam, 50%), transparent var(--notch), black calc(var(--notch) + 1px));
  mask-composite: intersect;
}

[data-pass-design^="ticket-"] :is(.pass-head p span, .pass-dept, .pass-facts dt) {
  color: #e7f0fb;
}

[data-pass-design^="ticket-"] .pass-cut {
  border-color: rgb(255 255 255 / 0.72);
}

[data-pass-design^="ticket-"] .pass-qr p {
  color: #fff;
}

[data-pass-design^="ticket-"] .qr svg path[fill] {
  fill: none;
}

[data-pass-design^="ticket-"] .qr svg path[stroke] {
  stroke: #fff;
}

[data-pass-design="travel"] .pass {
  padding: 0 0 22px;
  background: #f6f9ff;
}

[data-pass-design="travel"] .pass-head {
  width: 100%;
  padding: 20px 12px;
  border-radius: 15px 15px 0 0;
  background: var(--accent);
  color: #fff;
}

[data-pass-design="travel"] .pass-head p span {
  color: #e4edff;
}

[data-pass-design="travel"] .pass-logo {
  background: #133b78;
}

[data-pass-design="travel"] .pass-body,
[data-pass-design="travel"] .pass-stub {
  width: 100%;
  padding-inline: 12px;
  min-width: 0;
}

[data-pass-design="travel"] .pass-facts div:first-child {
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--accent-soft);
}

[data-pass-design="travel"] .pass-cut {
  border-color: #d8e2f1;
}

[data-pass-design="travel"] .pass-qr {
  padding: 10px;
  border-radius: 10px;
  background: #fff;
}

/* Indicaciones antes de salir, en la confirmación. */
.notes {
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1px solid #c7d7f2;
  border-radius: 12px;
  background: #f5f8fd;
}

.notes h2 {
  font-size: var(--text-md);
  font-weight: var(--weight-semibold);
}

.notes ul {
  display: grid;
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.notes li {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.notes li .icon {
  flex: none;
  margin-top: 1px;
  color: var(--accent);
}

.notes p {
  font-size: var(--text-sm);
  color: var(--ink);
}

.notes strong {
  font-weight: var(--weight-semibold);
}

/* Pantalla final del formulario: centrada en vertical y en horizontal. */
.page-register.page-done main.shell {
  display: grid;
  align-content: center;
  min-height: 100dvh;
  padding-block: 24px;
}

.page-done .success {
  width: 100%;
}

/* Acceso */
.page-auth {
  background: var(--bg);
}

.auth {
  display: grid;
  place-items: center;
  min-height: 100dvh;
  padding: 24px 16px;
}

.auth-card {
  display: grid;
  gap: 20px;
  width: min(100%, 25rem);
  padding: clamp(24px, 6vw, 40px);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow-md);
}

.auth-head {
  display: grid;
  justify-items: center;
  gap: 8px;
  margin-bottom: 4px;
  text-align: center;
}

.auth-logo {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  margin-bottom: 8px;
  border-radius: 14px;
  background: var(--accent);
  color: #fff;
  box-shadow: 0 0 0 6px var(--accent-soft);
}

.auth-logo .icon {
  width: 26px;
  height: 26px;
}

.auth-head h1 {
  font-size: var(--display-xs);
  letter-spacing: -0.02em;
}

.auth-head p {
  color: var(--muted);
  font-size: var(--text-sm);
}

.auth-foot {
  text-align: center;
  font-size: var(--text-sm);
  color: var(--muted);
}

@media (prefers-reduced-motion: no-preference) {
  .choice-check .icon,
  .choice-row input::before {
    transition: scale 0.18s cubic-bezier(0.3, 1.4, 0.6, 1);
  }

  .reveal:not([hidden]) {
    animation: reveal-in 0.22s ease-out;
  }

  .success-mark {
    animation: pop-in 0.35s cubic-bezier(0.3, 1.4, 0.6, 1);
  }

  .auth-card {
    animation: reveal-in 0.3s ease-out;
  }
}

@keyframes reveal-in {
  from {
    opacity: 0;
    translate: 0 -6px;
  }
}

@keyframes pop-in {
  from {
    scale: 0.6;
    opacity: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .button[aria-busy="true"]::before {
    animation-duration: 2s;
  }
}

@media (min-width: 600px) {
  .choice-cards,
  .choice-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .choice-cards.has-bridge > :last-child {
    grid-column: 1 / -1;
  }
}

@media (min-width: 960px) {
  .register {
    grid-template-columns: minmax(0, 1fr) 22rem;
    gap: 24px;
  }

  .page-register main.shell {
    padding-top: 40px;
  }

  .page-register main.register-width {
    padding-top: clamp(88px, 12vh, 132px);
  }

  .page-register.page-done.page-pass-photo main.shell {
    padding-top: clamp(88px, 12vh, 132px);
  }

  .register-photo {
    position: fixed;
    inset: 0;
    aspect-ratio: auto;
    margin: 0;
    border-radius: 0;
    background-image: linear-gradient(rgb(15 35 57 / 0.1), rgb(15 35 57 / 0.28)), url(register-juan-dolio.webp);
  }

  .register-width .register,
  .page-pass-photo .success {
    position: relative;
  }

  .trip-summary {
    position: sticky;
    top: 24px;
  }
}

/* Tamaños por función: botones grandes 16, chicos 14; opciones 16; títulos 24 en móvil y 30 en escritorio. */
.button,
.choice-row,
.choice-text strong {
  font-size: var(--text-md);
}

.text-button,
.reveal-password {
  font-size: var(--text-sm);
}

label,
.label,
.choice-group.nested > legend,
.choice-group.department > legend {
  font-weight: var(--weight-medium);
}

legend,
.register h2 {
  font-size: var(--text-lg);
}

h1,
.success h1,
.auth-head h1 {
  font-size: var(--display-xs);
  line-height: 2rem;
}

.form-head .lede,
.success .lede,
.intro .lede {
  font-size: var(--text-md);
}

@media (min-width: 960px) {
  h1,
  .success h1,
  .auth-head h1 {
    font-size: var(--display-sm);
    line-height: 2.375rem;
  }

  .form-head .lede,
  .intro .lede {
    font-size: var(--text-lg);
  }
}

/* Logotipo centrado en móvil en las páginas públicas (sin acciones en el encabezado). */
/* Móvil: el formulario ocupa toda la pantalla, sin tarjeta, con el encabezado centrado. */
@media (max-width: 600px) {
  body.page-register {
    background: var(--surface);
  }

  .page-register main.shell {
    width: 100%;
    padding-block: 0;
  }

  .page-register.page-done.page-pass-photo main.shell {
    padding-top: 0;
  }

  .register-photo {
    margin: 0;
    border-radius: 0;
  }

  .page-register .form-card,
  .page-register .trip-summary,
  .page-register .success {
    padding: 28px 16px;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }

  .page-register .trip-summary {
    border-top: 8px solid var(--bg);
  }

  .form-head {
    justify-items: center;
    text-align: center;
  }

  .form-head .trip-facts {
    display: grid;
  }

  .page-register .register {
    gap: 0;
  }
}

/* ---------- Panel de coordinación (móvil primero) ---------- */

.page-panel {
  background: var(--bg);
}

.app {
  min-height: 100dvh;
}

.app-bar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 56px;
  padding: env(safe-area-inset-top) max(12px, env(safe-area-inset-right), calc((100% - 56rem) / 2)) 0 max(12px, env(safe-area-inset-left), calc((100% - 56rem) / 2));
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.app-title {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.app-title div {
  display: grid;
  line-height: 1.25;
}

.app-title strong {
  font-size: var(--text-md);
}

.app-title div span {
  font-size: var(--text-xs);
  color: var(--muted);
}

.app-logo {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: var(--accent);
  color: #fff;
}

.app-logo .icon {
  width: 18px;
  height: 18px;
}

.icon-button {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.icon-button .icon {
  width: 20px;
  height: 20px;
}

.menu[popover] {
  inset: auto;
  top: calc(env(safe-area-inset-top) + 52px);
  right: max(12px, env(safe-area-inset-right), calc((100vw - 56rem) / 2));
  margin: 0;
  min-width: 15rem;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-md);
}

.menu-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 52px;
  padding: 8px 12px;
  border: 0;
  border-radius: 10px;
  background: none;
  color: var(--ink);
  font-size: var(--text-md);
  font-weight: var(--weight-medium);
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}

/* Ícono en un cuadrito azul claro: la fila se ve tocable sin parecer un botón. */
.menu-icon {
  flex: none;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--accent-soft);
  color: var(--accent);
}

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

.menu-label {
  flex: 1;
  min-width: 0;
}

/* «›» en las opciones que abren otra ventana. */
.menu-chevron {
  display: grid;
  color: var(--faint);
}

.menu-chevron .icon {
  width: 18px;
  height: 18px;
  rotate: -90deg;
}

.menu-note {
  padding: 6px 12px 8px;
  font-size: var(--text-xs);
  color: var(--muted);
}

.menu > .menu-primary {
  display: flex;
  width: calc(100% - 16px);
  margin: 4px 8px 8px;
}

.menu-group {
  display: grid;
  padding: 8px 0;
  border-top: 1px solid var(--line);
}

.menu-heading {
  padding: 4px 12px 6px;
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--faint);
}

.menu-foot {
  padding: 12px 8px 4px;
  border-top: 1px solid var(--line);
}

.app-main {
  width: min(100% - 24px, 56rem);
  margin-inline: auto;
  padding: 0 0 calc(96px + env(safe-area-inset-bottom));
}

/* Pestañas (Untitled UI, estilo «botón con borde»): Ida | Regreso y los filtros por estado. */
.tabs-bar {
  position: sticky;
  top: calc(56px + env(safe-area-inset-top));
  z-index: 10;
  margin: 0 -12px 12px;
  padding: 10px 12px;
  background: var(--surface);
  /* La franja blanca llega a los bordes de la pantalla, como parte del encabezado fijo. */
  box-shadow: 0 0 0 100vmax var(--surface), 0 1px 0 100vmax var(--line);
  clip-path: inset(0 -100vmax -1px);
}

.tabs {
  display: flex;
  gap: 4px;
  padding: 4px;
  border: 1px solid #e3e7ee;
  border-radius: 10px;
  background: #f6f8fb;
}

.tabs > button {
  flex: 1 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 12px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font-size: var(--text-md);
  font-weight: var(--weight-semibold);
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 0.15s, color 0.15s, box-shadow 0.15s;
}

.tabs > button:is([aria-selected="true"], [aria-pressed="true"]) {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 1px 2px rgb(16 24 40 / 0.08), 0 4px 10px -2px rgb(27 79 156 / 0.45);
}

.tabs > button:focus-visible {
  outline-offset: 0;
}

/* Filtros: misma pestaña, más compacta; en pantallas muy angostas pasan a 2 x 2 dentro de su caja. */
.tabs.small {
  overflow-x: auto;
  scrollbar-width: none;
}

.tabs.small::-webkit-scrollbar {
  display: none;
}

.tabs.small > button {
  min-height: 40px;
  padding: 0 8px;
  font-size: var(--text-sm);
}

@media (max-width: 389px) {
  .tabs.small {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }
}

.metrics {
  display: grid;
  gap: 12px;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
}

.metric-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.metric-head p {
  color: var(--muted);
}

.metric-head strong {
  font-size: var(--display-xs);
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.metric-percent {
  font-size: var(--text-lg);
  font-weight: var(--weight-semibold);
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}

.progress {
  height: 8px;
  border-radius: 999px;
  background: var(--accent-soft);
  overflow: hidden;
}

.progress span {
  display: block;
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: var(--accent);
}

.metric-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.metric-row dt {
  font-size: var(--text-xs);
  color: var(--muted);
}

.metric-row dd {
  font-size: var(--text-lg);
  font-weight: var(--weight-semibold);
  font-variant-numeric: tabular-nums;
}

.toolbar {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.bottom-bar {
  position: fixed;
  inset: auto 0 0;
  z-index: 15;
  padding: 12px max(16px, env(safe-area-inset-right)) calc(12px + env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  background: rgb(255 255 255 / 0.96);
  border-top: 1px solid var(--line);
}

.bottom-bar {
  display: flex;
  gap: 10px;
}

.bottom-bar .button {
  flex: 1;
  min-width: 0;
  min-height: 48px;
  padding-inline: 12px;
  gap: 8px;
  white-space: nowrap;
}

/* «Marcar con código» es el texto más largo: toma un poco más de ancho. */
.bottom-bar [data-scan="code"] {
  flex: 1.35;
}

@media (max-width: 359px) {
  .bottom-bar .button {
    font-size: var(--text-sm);
  }
}

/* Buscador (campo de Untitled UI con ícono y botón para borrar). */
.search-field {
  position: relative;
}

.search-field input[type="search"] {
  min-height: 44px;
  padding: 10px 44px 10px 42px;
  border-color: #d0d5dd;
  border-radius: 8px;
  background-image: none;
  box-shadow: 0 1px 2px rgb(16 24 40 / 0.05);
  font-size: var(--text-md);
}

.search-field input[type="search"]::placeholder {
  color: #98a2b3;
}

.search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  translate: 0 -50%;
  color: #98a2b3;
  pointer-events: none;
}

.search-clear {
  position: absolute;
  right: 4px;
  top: 50%;
  translate: 0 -50%;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 6px;
  background: none;
  color: #98a2b3;
  cursor: pointer;
}

.search-clear .icon {
  width: 18px;
  height: 18px;
}

/* Botón del menú: tres líneas que se vuelven una X al abrirse. */
.burger {
  position: relative;
  width: 20px;
  height: 14px;
}

.burger span {
  position: absolute;
  left: 0;
  width: 100%;
  height: 2px;
  border-radius: 2px;
  background: currentColor;
  transition: translate 0.22s ease, rotate 0.22s ease, opacity 0.15s ease;
}

.burger span:nth-child(1) {
  top: 0;
}

.burger span:nth-child(2) {
  top: 6px;
}

.burger span:nth-child(3) {
  top: 12px;
}

.menu-toggle[aria-expanded="true"] {
  color: var(--ink);
}

.menu-toggle[aria-expanded="true"] .burger span:nth-child(1) {
  translate: 0 6px;
  rotate: 45deg;
}

.menu-toggle[aria-expanded="true"] .burger span:nth-child(2) {
  opacity: 0;
}

.menu-toggle[aria-expanded="true"] .burger span:nth-child(3) {
  translate: 0 -6px;
  rotate: -45deg;
}

@media (prefers-reduced-motion: reduce) {
  .burger span {
    transition: none;
  }
}

/* Tabla de pasajeros (Untitled UI): una por parada. */
.table-card {
  margin-top: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.table-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 16px 14px;
}

.table-head h2 {
  font-size: var(--text-md);
  font-weight: var(--weight-semibold);
}

.table-head p {
  margin-top: 2px;
  font-size: var(--text-sm);
  color: var(--muted);
}

.badge {
  flex: none;
  padding: 2px 10px;
  border: 1px solid #c7d7f2;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  white-space: nowrap;
}

/* Anchos fijos: la tabla nunca se sale de su tarjeta y las columnas quedan alineadas entre grupos. */
table.people {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

table.people th.col-phone {
  width: 9.5rem;
}

table.people th.col-check {
  width: 7rem;
  text-align: center;
}

table.people td.col-check {
  text-align: center;
}

table.people th {
  padding: 10px 16px;
  border-block: 1px solid var(--line);
  background: #f9fafb;
  color: var(--muted);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  text-align: left;
  white-space: nowrap;
}

table.people td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
  font-size: var(--text-sm);
}

table.people tbody tr:last-child td {
  border-bottom: 0;
}

table.people tr.is-boarded td {
  background: #f7f9fd;
}

table.people .col-actions {
  text-align: right;
}

.who-cell {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  min-width: 0;
}

.avatar {
  display: grid;
  place-items: center;
  flex: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #f2f4f7;
  color: #475467;
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
}

.is-boarded .avatar {
  background: var(--accent-soft);
  color: var(--accent);
}

.who-text {
  display: grid;
  gap: 1px;
  min-width: 0;
}

.who-text strong {
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: var(--ink);
  overflow-wrap: anywhere;
}

.who-text > span {
  color: var(--muted);
  overflow-wrap: anywhere;
}

.who-place {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--muted);
}

.who-place .icon,
.phone-link .icon {
  width: 14px;
  height: 14px;
  flex: none;
}

.who-inline {
  display: none;
}

.phone-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
  min-height: 28px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 10px 2px 8px;
  border: 1px solid #e4e7ec;
  border-radius: 999px;
  background: #f9fafb;
  color: #344054;
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  white-space: nowrap;
}

.status-badge .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #98a2b3;
}

.status-badge.boarded {
  border-color: #c7d7f2;
  background: var(--accent-soft);
  color: var(--accent);
}

.status-badge.boarded .dot {
  background: var(--accent);
}

.status-badge.pending {
  border-color: #fedf89;
  background: var(--amber-soft);
  color: var(--amber);
}

.status-badge.pending .dot {
  background: #f79009;
}

.status-note {
  display: block;
  margin-top: 4px;
  font-size: var(--text-xs);
  color: var(--muted);
}

.row-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 2px;
}

.board-button {
  min-height: 44px;
  padding: 0 14px;
  font-size: var(--text-sm);
  white-space: nowrap;
}

.board-button .icon,
.button .icon {
  width: 20px;
  height: 20px;
}

[aria-busy="true"].icon-button,
[aria-busy="true"].board-button {
  opacity: 0.6;
  pointer-events: none;
}

/* Fila: la persona abre su ficha; a la derecha, la casilla de abordaje. */
.row-open {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  width: 100%;
  min-height: 44px;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.row-open:focus-visible {
  outline-offset: 4px;
  border-radius: 6px;
}

.who-phone {
  display: none;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.check-toggle {
  display: inline-grid;
  justify-items: center;
  gap: 4px;
  min-width: 64px;
  min-height: 56px;
  padding: 6px 4px;
  border: 0;
  border-radius: 10px;
  background: none;
  cursor: pointer;
}

.check-mark {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 2px solid var(--line-strong);
  border-radius: 50%;
  background: var(--surface);
  color: transparent;
  transition: background-color 0.15s, border-color 0.15s, color 0.15s;
}

.check-mark .icon {
  width: 16px;
  height: 16px;
  stroke-width: 3;
}

.check-toggle.boarded .check-mark {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.check-toggle.independent .check-mark {
  border-color: #c3cad5;
  background: #e6e9ee;
  color: #475467;
}

.check-toggle.independent .check-mark .icon {
  stroke-width: 2;
}

.check-label {
  font-size: var(--text-xs);
  color: var(--muted);
  white-space: nowrap;
}

.check-toggle.boarded .check-label {
  color: var(--accent);
  font-weight: var(--weight-semibold);
}

.check-toggle.pending .check-label {
  color: var(--amber);
}

@media (prefers-reduced-motion: no-preference) {
  .check-toggle.boarded .check-mark {
    animation: pop-in 0.25s cubic-bezier(0.3, 1.4, 0.6, 1);
  }
}

/* Ficha de la persona: datos y acciones. */
.person-facts {
  border-top: 0;
}

.person-facts div {
  grid-template-columns: 6.5rem minmax(0, 1fr);
}

.person-facts div:first-child {
  padding-top: 0;
}

.action-list {
  display: grid;
  gap: 8px;
}

/* Enlace (Llamar) y botones con la misma caja: alto, borde, ícono y texto alineados. */
.action-item {
  appearance: none;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 52px;
  margin: 0;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: var(--text-md);
  font-weight: var(--weight-medium);
  line-height: 1.25;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.15s, border-color 0.15s;
}

.action-item[hidden] {
  display: none;
}

.action-item .icon {
  flex: none;
  width: 20px;
  height: 20px;
  color: var(--muted);
}

.action-item:focus-visible {
  outline-offset: 2px;
}

.action-item.danger {
  border-color: color-mix(in srgb, var(--danger) 30%, transparent);
  color: var(--danger);
}

.action-item.danger .icon {
  color: var(--danger);
}

/* Aviso con acción («Deshacer»). */
.toast {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.toast-action {
  flex: none;
  min-height: 32px;
  padding: 0 6px;
  border: 0;
  background: none;
  color: #fff;
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

/* Grupos plegables por departamento dentro de la tabla. */
table.people .group-row th {
  white-space: normal;
  padding: 0;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  text-align: left;
}

.group-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 48px;
  padding: 10px 16px;
  border: 0;
  background: none;
  color: var(--ink);
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  text-align: left;
  cursor: pointer;
}

.group-toggle:focus-visible {
  outline-offset: -3px;
}

.group-toggle .icon {
  width: 18px;
  height: 18px;
  flex: none;
  color: var(--muted);
  rotate: -90deg;
  transition: rotate 0.2s ease;
}

.group-toggle[aria-expanded="true"] .icon {
  rotate: 0deg;
}

.group-name {
  flex: 1;
  min-width: 0;
}

.group-count {
  flex: none;
  color: var(--muted);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
}

table.people tbody.group + tbody.group .group-row th {
  border-top: 1px solid var(--line);
}

table.people tbody tr:last-child td {
  border-bottom: 1px solid var(--line);
}

table.people tbody:last-child tr:last-child td {
  border-bottom: 0;
}

table.people .empty-row td {
  padding: 40px 24px;
  text-align: center;
  color: var(--muted);
  font-size: var(--text-sm);
}

.who-place {
  font-size: var(--text-sm);
}

/* Móvil: el teléfono y el estado se mueven debajo del nombre. */
@media (max-width: 719px) {
  table.people .col-phone,
  table.people .col-status {
    display: none;
  }

  .who-phone {
    display: block;
  }

  .who-inline {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 10px;
    margin-top: 6px;
  }

  table.people td {
    padding: 12px;
  }

  table.people th {
    padding: 8px 12px;
  }

  table.people th.col-check {
    width: 5.5rem;
  }

  .group-toggle {
    padding-inline: 12px;
  }

  .avatar {
    width: 36px;
    height: 36px;
  }
}

@media (max-width: 359px) {
  .board-button .icon {
    display: none;
  }

  .board-button {
    padding: 0 12px;
  }
}

@media (max-width: 479px) {
  .avatar {
    display: none;
  }

  table.people th.col-check {
    width: 6.25rem;
  }

  table.people td.col-check {
    padding-inline: 6px;
  }

  table.people td {
    padding: 12px 10px;
  }

  table.people td:first-child,
  table.people thead th:first-child {
    padding-left: 14px;
  }

  .group-toggle {
    padding-inline: 14px;
  }
}

.sharing-choices {
  display: grid;
  gap: 8px;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.sharing-choices legend {
  margin-bottom: 8px;
  padding: 0;
  font-weight: var(--weight-semibold);
}

.sharing-images {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.sharing-choice {
  display: grid;
  align-content: start;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  cursor: pointer;
}

.sharing-choice:has(input:checked) {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.sharing-choice img {
  display: block;
  width: 100%;
  height: auto;
}

.sharing-choice span {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  min-height: 44px;
  padding: 10px;
  font-size: var(--text-sm);
}

.sharing-choice input {
  flex: none;
  margin: 3px 0 0;
  accent-color: var(--accent);
}

.pass-sample {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.pass-sample h3 {
  font-size: var(--text-sm);
}

.pass-sample .pass-backdrop {
  padding: 24px;
}

/* Escáner de pases. */
.scan-view {
  position: relative;
  aspect-ratio: 1;
  border-radius: 14px;
  background: #0b1220;
  overflow: hidden;
}

.scan-view[hidden] {
  display: none;
}

.scan-view video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.scan-frame {
  position: absolute;
  inset: 8% 17% auto;
  aspect-ratio: 1;
  border-radius: 14px;
  overflow: hidden;
  color: #fff;
  box-shadow: 0 0 0 999px rgb(11 18 32 / 0.58), inset 0 0 0 1px rgb(255 255 255 / 0.25);
  pointer-events: none;
}

.scan-frame > span {
  position: absolute;
  inset: 0 auto auto 0;
  width: 30px;
  height: 30px;
  border: 3px solid currentColor;
  border-width: 3px 0 0 3px;
  border-top-left-radius: 14px;
}

.scan-frame > span:nth-child(2) {
  inset: 0 0 auto auto;
  rotate: 90deg;
}

.scan-frame > span:nth-child(3) {
  inset: auto 0 0 auto;
  rotate: 180deg;
}

.scan-frame > span:nth-child(4) {
  inset: auto auto 0 0;
  rotate: 270deg;
}

.scan-view.is-reading .scan-frame::after {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 2px;
  background: #8de7ff;
  box-shadow: 0 0 9px #44c9ff, 0 5px 20px 4px rgb(68 201 255 / 0.35);
  animation: scan-sweep 1.4s ease-in-out infinite alternate;
}

.scan-view.is-detected .scan-frame {
  color: #76f1aa;
  box-shadow: 0 0 0 999px rgb(11 18 32 / 0.58), inset 0 0 0 1px rgb(118 241 170 / 0.55);
}

@keyframes scan-sweep {
  to { top: calc(100% - 2px); }
}

@media (prefers-reduced-motion: reduce) {
  .scan-view.is-reading .scan-frame::after {
    top: 50%;
    animation: none;
  }
}

.scan-status {
  position: absolute;
  inset: auto 12px 12px;
  padding: 8px 12px;
  border-radius: 8px;
  background: rgb(11 18 32 / 0.7);
  color: #fff;
  font-size: var(--text-sm);
  text-align: center;
}

.scan-result {
  display: grid;
  justify-items: center;
  gap: 10px;
  padding: 24px 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  text-align: center;
}

.scan-result[hidden] {
  display: none;
}

.scan-state {
  padding: 4px 12px;
  border-radius: 999px;
  background: var(--amber-soft);
  color: var(--amber);
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
}

.scan-result.is-done .scan-state {
  background: var(--accent-soft);
  color: var(--accent);
}

.scan-result.is-error .scan-state {
  background: var(--danger-soft);
  color: var(--danger);
}

.scan-result h3 {
  font-size: var(--display-xs);
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.scan-meta {
  color: var(--muted);
  font-size: var(--text-sm);
}

.scan-result .button {
  min-height: 52px;
}

.scan-result .button.primary {
  margin-top: 6px;
  font-size: var(--text-md);
}

.scan-manual {
  display: grid;
  gap: 8px;
}

.scan-manual .button {
  margin-top: 8px;
}

/* La ventana del escáner tiene dos modos: cámara o código escrito. */
.scan[data-mode="camera"] .scan-manual,
.scan[data-mode="code"] .scan-view,
.scan[data-mode="code"] .scan-result:not([hidden]) ~ .scan-manual {
  display: none;
}

/* Ventanas: hoja desde abajo en móvil, centradas en escritorio. */
dialog.sheet {
  /* margin: auto centra la ventana; también anula el espacio entre «.sheet» seguidos del formulario. */
  margin: auto;
  width: min(100% - 32px, 34rem);
  max-width: none;
  max-height: min(88dvh, 52rem);
  padding: 0;
  border: 0;
  border-radius: 16px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 24px 48px -12px rgb(16 24 40 / 0.28);
  overflow: hidden;
}

dialog.sheet.compact {
  width: min(100% - 32px, 24rem);
}

dialog.sheet::backdrop {
  background: rgb(16 24 40 / 0.5);
}

.sheet-form {
  display: flex;
  flex-direction: column;
  max-height: inherit;
}

.sheet-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 12px 14px 20px;
  border-bottom: 1px solid var(--line);
}

.sheet-head h2 {
  font-size: var(--text-lg);
}

.sheet-sub {
  font-size: var(--text-sm);
  color: var(--muted);
}

.sheet-body {
  display: grid;
  gap: 18px;
  padding: 18px 20px 24px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.sheet-body h2 {
  font-size: var(--text-lg);
}

.sheet-foot {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 12px 20px calc(12px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: var(--surface);
}

.sheet [data-step] {
  display: grid;
  gap: 16px;
}

.sheet [data-step][hidden] {
  display: none;
}

.results {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.result {
  display: grid;
  justify-items: start;
  gap: 2px;
  width: 100%;
  min-height: 56px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.result strong {
  font-size: var(--text-md);
}

.result span {
  font-size: var(--text-sm);
  color: var(--muted);
}

.result:disabled {
  cursor: default;
  opacity: 0.65;
}

.muted-tag {
  background: var(--accent-soft);
  color: var(--accent);
}

.picked {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 10px;
  background: #f5f7fb;
  border: 1px solid var(--line);
}

.picked div {
  display: grid;
}

.picked span {
  font-size: var(--text-sm);
  color: var(--muted);
}

.sheet-actions {
  display: grid;
  gap: 8px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.danger-outline {
  background: var(--surface);
  border-color: color-mix(in srgb, var(--danger) 45%, transparent);
  color: var(--danger);
}

.stop-list {
  display: grid;
  margin: 0;
  padding: 0;
  list-style: none;
  border-top: 1px solid var(--line);
}

.stop-list li {
  padding: 12px 2px;
  border-bottom: 1px solid var(--line);
  font-size: var(--text-sm);
}

/* Avisos emergentes: tarjeta blanca arriba al centro, con ícono de color según el tipo. */
.toasts[popover] {
  inset: calc(12px + env(safe-area-inset-top)) auto auto 50%;
  translate: -50% 0;
  display: grid;
  gap: 8px;
  width: min(100% - 24px, 26rem);
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  overflow: visible;
}

.toast {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  color: var(--ink);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  line-height: 1.35;
  box-shadow: 0 18px 40px -12px rgb(16 24 40 / 0.35), 0 2px 6px rgb(16 24 40 / 0.08);
  transition: opacity 0.25s ease, translate 0.25s ease;
}

.toast-icon {
  flex: none;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #ecfdf3;
  color: #067647;
}

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

.toast.error .toast-icon {
  background: var(--danger-soft);
  color: var(--danger);
}

.toast-text {
  flex: 1;
  min-width: 0;
}

.toast .toast-action {
  color: var(--accent);
  font-weight: var(--weight-semibold);
}

.toast.leaving {
  opacity: 0;
  translate: 0 -10px;
}

@media (prefers-reduced-motion: no-preference) {
  .progress span {
    transition: width 0.3s ease;
  }

  .toast {
    animation: toast-in 0.32s cubic-bezier(0.34, 1.4, 0.64, 1);
  }
}

@media (max-width: 600px), (max-height: 600px) {
  /* En el móvil (vertical u horizontal) las ventanas ocupan toda la pantalla;
     la confirmación («compact») sigue pequeña. */
  dialog.sheet:not(.compact) {
    width: 100%;
    height: 100dvh;
    max-height: 100dvh;
    margin: 0;
    border-radius: 0;
  }

  dialog.sheet:not(.compact) .sheet-form {
    height: 100%;
  }

  dialog.sheet:not(.compact) .sheet-head {
    padding-top: calc(14px + env(safe-area-inset-top));
    padding-left: max(20px, env(safe-area-inset-left));
    padding-right: max(12px, env(safe-area-inset-right));
  }

  dialog.sheet:not(.compact) .sheet-body {
    flex: 1;
    align-content: start;
  }

  /* El menú baja desde la barra y ocupa todo el ancho y el alto restante, sin tapar el logo. */
  .menu[popover] {
    top: calc(env(safe-area-inset-top) + 57px);
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    height: auto;
    max-height: none;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 8px max(8px, env(safe-area-inset-right)) calc(12px + env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left));
    border-width: 0 0 1px;
    border-radius: 0;
    box-shadow: 0 16px 24px -12px rgb(16 24 40 / 0.25);
  }

  .sheet-foot .button {
    flex: 1;
  }
}

@media (min-width: 640px) {

  .board-button,
}

@media (min-width: 900px) and (min-height: 601px) {
  /* En escritorio los botones de marcar suben a la barra superior, junto al menú. */
  .bottom-bar {
    inset: calc(env(safe-area-inset-top) + 6px) calc(max(12px, env(safe-area-inset-right), (100vw - 56rem) / 2) + 52px) auto auto;
    z-index: 25;
    padding: 0;
    background: none;
    border: 0;
  }

  .bottom-bar {
    gap: 8px;
  }

  .bottom-bar .button {
    width: auto;
    min-height: 44px;
  }

  .app-main {
    padding-bottom: 48px;
  }

  .toasts[popover] {
    bottom: 24px;
  }
}

/* Efectos al pasar el mouse: solo en equipos con puntero, para que no se queden pegados al tocar. */

@media (hover: hover) {
  .icon-button:hover,
  .menu-item:hover {
    background: #f1f4f8;
    color: var(--ink);
  }

  .result:not(:disabled):hover {
    border-color: var(--accent);
  }

  .row-open:hover strong {
    color: var(--accent);
  }

  .action-item:hover {
    border-color: var(--line-strong);
    background: #f6f8fb;
  }

  .action-item.danger:hover {
    border-color: var(--danger);
    background: var(--danger-soft);
  }

  .check-toggle:hover .check-mark {
    border-color: var(--accent);
  }

  .tabs > button:not([aria-selected="true"], [aria-pressed="true"]):hover {
    color: var(--ink);
  }

  .choice-card:hover,
  .choice-row:hover {
    border-color: var(--accent);
  }

  input:not([type="checkbox"], [type="radio"]):hover,
  select:hover {
    border-color: #7f8ba0;
  }

  select option:hover {
    background: var(--accent-soft);
  }

  .primary:hover {
    background: var(--accent-hover);
  }

  .secondary:hover {
    border-color: var(--accent);
    color: var(--accent);
  }

  .ghost:hover {
    background: var(--accent-soft);
  }

  .danger:hover {
    background: #84190f;
  }

  .text-button:hover {
    border-color: var(--accent);
    color: var(--accent);
  }

}

@media (pointer: coarse) {
  .text-button {
    min-height: 44px;
  }
}

/* Pantallas pequeñas */

@media (max-width: 560px) {
  .fields {
    grid-template-columns: minmax(0, 1fr);
  }

  .page-head .actions,
  .page-head .actions .button {
    flex: 1;
  }

  .trip {
    grid-template-columns: minmax(0, 1fr);
  }

  .trip div + div {
    padding-left: 0;
    border-left: 0;
    border-top: 1px solid var(--line);
  }

  .form-footer .button {
    width: 100%;
  }

  .brand em {
    display: none;
  }

  .stack > .button {
    justify-self: stretch;
  }
}

/* Aviso de conexión del panel: ocupa el lugar de la fecha bajo «Transporte». */
.app-title .sync-note {
  color: var(--accent);
  font-weight: var(--weight-medium);
}

.app-title .sync-note.is-offline {
  color: var(--amber);
}

.app-title .sync-note[hidden],
.app-title:has(.sync-note:not([hidden])) .app-date {
  display: none;
}

/* Entradas y salidas: el menú baja desde la barra y las ventanas suben; al cerrar hacen lo
   contrario, un poco más rápido. @starting-style da el punto de partida al abrir y
   allow-discrete deja ver la salida antes de que el elemento desaparezca. */
@media (prefers-reduced-motion: no-preference) {
  .menu[popover] {
    opacity: 0;
    translate: 0 -10px;
    transition: opacity 0.16s ease-in, translate 0.18s ease-in,
      overlay 0.18s allow-discrete, display 0.18s allow-discrete;
  }

  .menu[popover]:popover-open {
    opacity: 1;
    translate: 0 0;
    transition: opacity 0.2s ease-out, translate 0.28s cubic-bezier(0.2, 0.8, 0.2, 1),
      overlay 0.28s allow-discrete, display 0.28s allow-discrete;
  }

  @starting-style {
    .menu[popover]:popover-open {
      opacity: 0;
      translate: 0 -10px;
    }
  }

  /* Las opciones del menú entran escalonadas. */
  .menu:popover-open > * {
    animation: menu-item-in 0.32s cubic-bezier(0.2, 0.8, 0.2, 1) both;
  }

  .menu:popover-open > :nth-child(2) { animation-delay: 20ms; }
  .menu:popover-open > :nth-child(3) { animation-delay: 40ms; }
  .menu:popover-open > :nth-child(4) { animation-delay: 60ms; }
  .menu:popover-open > :nth-child(5) { animation-delay: 80ms; }
  .menu:popover-open > :nth-child(6) { animation-delay: 100ms; }
  .menu:popover-open > :nth-child(7) { animation-delay: 120ms; }
  .menu:popover-open > :nth-child(8) { animation-delay: 140ms; }
  .menu:popover-open > :nth-child(9) { animation-delay: 160ms; }
  .menu:popover-open > :nth-child(n + 10) { animation-delay: 180ms; }

  dialog.sheet {
    opacity: 0;
    translate: 0 16px;
    transition: opacity 0.16s ease-in, translate 0.18s ease-in,
      overlay 0.18s allow-discrete, display 0.18s allow-discrete;
  }

  dialog.sheet[open] {
    opacity: 1;
    translate: 0 0;
    transition: opacity 0.2s ease-out, translate 0.32s cubic-bezier(0.2, 0.8, 0.2, 1),
      overlay 0.32s allow-discrete, display 0.32s allow-discrete;
  }

  @starting-style {
    dialog.sheet[open] {
      opacity: 0;
      translate: 0 16px;
    }
  }

  /* La confirmación pequeña aparece con un leve zoom en vez de subir. */
  dialog.sheet.compact {
    translate: 0 0;
    scale: 0.96;
    transition: opacity 0.14s ease-in, scale 0.14s ease-in,
      overlay 0.14s allow-discrete, display 0.14s allow-discrete;
  }

  dialog.sheet.compact[open] {
    scale: 1;
    transition: opacity 0.18s ease-out, scale 0.22s cubic-bezier(0.2, 0.8, 0.2, 1),
      overlay 0.22s allow-discrete, display 0.22s allow-discrete;
  }

  @starting-style {
    dialog.sheet.compact[open] {
      opacity: 0;
      scale: 0.96;
    }
  }

  dialog.sheet::backdrop {
    background: rgb(16 24 40 / 0);
    transition: background-color 0.18s ease-in, overlay 0.18s allow-discrete, display 0.18s allow-discrete;
  }

  dialog.sheet[open]::backdrop {
    background: rgb(16 24 40 / 0.5);
    transition: background-color 0.24s ease-out, overlay 0.24s allow-discrete, display 0.24s allow-discrete;
  }

  @starting-style {
    dialog.sheet[open]::backdrop {
      background: rgb(16 24 40 / 0);
    }
  }
}

/* A pantalla completa (móvil vertical u horizontal) la animación dice qué tipo de ventana es:
   - Tareas (Agregar, Editar, Escanear, Marcar con código): suben desde abajo como una hoja.
   - Consultas («push»: ficha del pasajero, Guagua y chofer, Paradas, Vista previa, Diseño del
     pase): entran desde la derecha y el panel de atrás se corre a la izquierda, como al entrar
     a otra pantalla; salen hacia la derecha, igual que el botón atrás.
   - Menú: se despliega desde la barra como una cortina.
   Entrada ~320 ms frenando suave; salida ~200 ms, para no hacer esperar. */
@media (prefers-reduced-motion: no-preference) and (max-width: 600px), (prefers-reduced-motion: no-preference) and (max-height: 600px) {
  dialog.sheet:not(.compact) {
    opacity: 1;
    translate: 0 100%;
    transition: translate 0.2s cubic-bezier(0.4, 0, 1, 1),
      overlay 0.2s allow-discrete, display 0.2s allow-discrete;
  }

  dialog.sheet:not(.compact)[open] {
    translate: 0 0;
    transition: translate 0.34s cubic-bezier(0.32, 0.72, 0, 1),
      overlay 0.34s allow-discrete, display 0.34s allow-discrete;
  }

  @starting-style {
    dialog.sheet:not(.compact)[open] {
      translate: 0 100%;
    }
  }

  dialog.sheet.push:not(.compact) {
    translate: 100% 0;
    box-shadow: -16px 0 32px -12px rgb(16 24 40 / 0.25);
  }

  dialog.sheet.push:not(.compact)[open] {
    translate: 0 0;
  }

  @starting-style {
    dialog.sheet.push:not(.compact)[open] {
      translate: 100% 0;
    }
  }

  dialog.sheet.push[open]::backdrop {
    background: rgb(16 24 40 / 0.22);
  }

  /* El panel de atrás se corre un poco hacia la izquierda mientras entra la consulta. */
  .app-bar,
  .app-main,
  .bottom-bar {
    transition: translate 0.2s cubic-bezier(0.4, 0, 1, 1);
  }

  body:has(dialog.push[open]) :is(.app-bar, .app-main, .bottom-bar) {
    translate: -22% 0;
    transition: translate 0.34s cubic-bezier(0.32, 0.72, 0, 1);
  }

  /* Menú como cortina: se descubre de arriba hacia abajo y se recoge hacia arriba. */
  .menu[popover] {
    opacity: 1;
    translate: 0 0;
    clip-path: inset(0 0 100% 0);
    transition: clip-path 0.2s cubic-bezier(0.4, 0, 1, 1),
      overlay 0.2s allow-discrete, display 0.2s allow-discrete;
  }

  .menu[popover]:popover-open {
    clip-path: inset(0 0 0 0);
    transition: clip-path 0.32s cubic-bezier(0.32, 0.72, 0, 1),
      overlay 0.32s allow-discrete, display 0.32s allow-discrete;
  }

  @starting-style {
    .menu[popover]:popover-open {
      opacity: 1;
      translate: 0 0;
      clip-path: inset(0 0 100% 0);
    }
  }
}

/* Con «reducir movimiento» las ventanas y el menú solo aparecen y se van con un fundido. */
@media (prefers-reduced-motion: reduce) {
  dialog.sheet,
  .menu[popover] {
    opacity: 0;
    transition: opacity 0.15s linear, overlay 0.15s allow-discrete, display 0.15s allow-discrete;
  }

  dialog.sheet[open],
  .menu[popover]:popover-open {
    opacity: 1;
  }

  @starting-style {
    dialog.sheet[open],
    .menu[popover]:popover-open {
      opacity: 0;
    }
  }
}

@keyframes menu-item-in {
  from {
    opacity: 0;
    translate: 0 -6px;
  }
}

/* Código del pase en casillas (Untitled UI, «verification code input» tamaño sm):
   esquinas de 12 px, borde fino gris, cifras grandes y un «0» tenue en las vacías. */
.pin-input {
  position: relative;
  width: 100%;
  max-width: 26rem;
  margin-top: 2px;
}

.pin-slots {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 4rem)) auto repeat(3, minmax(0, 4rem));
  justify-content: center;
  align-items: center;
  gap: clamp(6px, 2vw, 8px);
}

.pin-slot {
  position: relative;
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  border-radius: 12px;
  background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--line-strong), var(--shadow-sm);
  color: var(--ink);
  font-size: clamp(1.75rem, 9vw, 2.75rem);
  font-weight: var(--weight-medium);
  line-height: 1;
  letter-spacing: -0.02em;
  transition: box-shadow 0.1s linear, background-color 0.1s linear;
}

.pin-slot:empty::before {
  content: "0";
  color: rgb(122 133 151 / 0.4);
}

.pin-slot.is-filled {
  color: var(--accent);
  box-shadow: inset 0 0 0 2px var(--accent), var(--shadow-sm);
}

.pin-slot.is-active {
  box-shadow: inset 0 0 0 2px var(--accent), 0 0 0 2px var(--surface), 0 0 0 4px var(--accent);
}

/* Cursor parpadeante en la casilla activa vacía, en lugar del «0». */
.pin-slot.is-active:empty::before {
  content: "";
  width: 2px;
  height: 1em;
  background: var(--accent);
  animation: pin-caret 1s steps(1) infinite;
}

.pin-separator {
  padding-inline: 2px;
  color: var(--line-strong);
  font-size: clamp(1.75rem, 9vw, 2.75rem);
  font-weight: var(--weight-medium);
  line-height: 1;
}

.pin-input.is-invalid .pin-slot {
  color: var(--danger);
  box-shadow: inset 0 0 0 1px #f3b4ab, var(--shadow-sm);
}

.pin-input.is-invalid .pin-slot.is-active {
  box-shadow: inset 0 0 0 2px var(--danger), 0 0 0 2px var(--surface), 0 0 0 4px var(--danger);
}

/* El campo real cubre las casillas sin verse: recibe toques, teclado y lo que se pegue. */
.pin-native {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  color: transparent;
  caret-color: transparent;
  font-size: 16px;
  opacity: 0;
  cursor: text;
}

.scan-manual {
  justify-items: center;
}

.scan-manual > label,
.scan-manual > .hint {
  justify-self: stretch;
}

.scan-manual .hint {
  margin-top: 4px;
}

.scan-manual .button {
  justify-self: stretch;
}

@keyframes pin-caret {
  50% {
    opacity: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .pin-slot.is-active:empty::before {
    animation: none;
  }
}

.pin-input.is-invalid .pin-slot.is-active:empty::before {
  background: var(--danger);
}

/* Enviar pases: una fila por persona (se toca para abrir su pantalla) con su número de registro y
   el estado del envío. */
.passes-body {
  gap: 12px;
  /* Filas a su altura natural: la lista hace scroll y los filtros no se aplastan. */
  grid-auto-rows: max-content;
}

.pass-filters > button span {
  margin-left: 2px;
  color: var(--faint);
  font-variant-numeric: tabular-nums;
}

.pass-filters > button[aria-pressed="true"] span {
  color: inherit;
  opacity: 0.8;
}

.pass-list {
  display: grid;
  gap: 8px;
  margin: 4px 0 0;
  padding: 0;
  list-style: none;
}

.pass-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 14px 12px 14px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.pass-row.is-highlight {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.pass-rank {
  align-self: start;
  min-width: 2em;
  padding-top: 1px;
  color: var(--faint);
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  font-variant-numeric: tabular-nums;
}

/* «pass-row-body» y no «pass-body»: ese nombre ya es del pase y lo descolocaba. */
.pass-row-body {
  display: grid;
  justify-items: start;
  gap: 3px;
  min-width: 0;
}

.pass-name {
  font-weight: var(--weight-semibold);
}

.pass-meta {
  color: var(--muted);
  font-size: var(--text-sm);
}

.pass-tag {
  color: var(--accent);
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
}

.pass-chevron {
  display: grid;
  color: var(--faint);
}

.pass-chevron .icon {
  width: 20px;
  height: 20px;
  rotate: -90deg;
}

/* Estado del envío: sin enviar ámbar; ✓ enviado azul; ↻ reenviado gris. */
.pass-status {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 2px;
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  text-align: left;
}

.pass-status .icon {
  flex: none;
  width: 16px;
  height: 16px;
}

.pass-dot {
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
}

.pass-status.is-pending { color: var(--amber); }
.pass-status.is-sent { color: var(--accent); }
.pass-status.is-resent { color: #475467; }
.pass-status.is-disabled { color: var(--faint); }

.pass-empty {
  padding: 24px 0;
  color: var(--muted);
  text-align: center;
}

/* Pantalla de una persona: vista previa del pase arriba, estado, datos e historial. */
.pp-body {
  gap: 16px;
  grid-auto-rows: max-content;
}

.pp-preview-block {
  display: grid;
  gap: 8px;
}

/* Vista previa grande: el pase a todo el ancho (hasta 26rem) sobre un fondo suave. */
.pp-preview {
  position: relative;
  display: grid;
  place-items: center;
  width: 100%;
  padding: 12px;
  border: 0;
  border-radius: 14px;
  background: var(--bg);
  cursor: zoom-in;
}

.pp-preview img {
  display: block;
  width: 100%;
  max-width: 26rem;
  height: auto;
  aspect-ratio: 1080 / 1701;
  object-fit: contain;
  border-radius: 10px;
  background: #e3e8ef;
  box-shadow: var(--shadow-md);
}

.pp-preview:not([data-state="ready"]) img {
  visibility: hidden;
}

.pp-preview[data-state="ready"] .pp-preview-state {
  display: none;
}

/* Mientras se prepara (o si falla), un aviso en el lugar de la imagen. */
.pp-preview-state {
  position: absolute;
  inset: 12px;
  display: grid;
  place-items: center;
  padding: 24px;
  border-radius: 10px;
  background: #e3e8ef;
  color: var(--muted);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  text-align: center;
}

.pp-preview[data-state="loading"] .pp-preview-state {
  animation: pp-pulse 1.2s ease-in-out infinite;
}

@keyframes pp-pulse {
  50% { opacity: 0.55; }
}

.pp-preview-note {
  color: var(--muted);
  font-size: var(--text-xs);
  text-align: center;
}

/* Pase a pantalla completa. */
.pass-zoom {
  width: 100vw;
  max-width: none;
  height: 100dvh;
  max-height: none;
  margin: 0;
  padding: calc(16px + env(safe-area-inset-top)) 16px calc(16px + env(safe-area-inset-bottom));
  border: 0;
  background: rgb(8 12 20 / 0.94);
}

.pass-zoom[open] {
  display: grid;
  place-items: center;
}

.pass-zoom::backdrop {
  background: transparent;
}

.pass-zoom img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 10px;
}

.pass-zoom-close {
  position: absolute;
  top: calc(12px + env(safe-area-inset-top));
  right: 12px;
  color: #fff;
  background: rgb(255 255 255 / 0.12);
}

.pp-status {
  display: grid;
  gap: 6px;
}

.pp-status .pass-status {
  margin: 0;
  font-size: var(--text-md);
}

.pp-history h3 {
  margin-bottom: 8px;
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: var(--muted);
}

.pp-history ol {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.pp-history li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: var(--text-sm);
}

.pp-history li span {
  color: var(--muted);
  text-align: right;
}

.pp-foot {
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
}

.pp-no-phone {
  color: var(--muted);
  font-size: var(--text-sm);
  text-align: center;
}

@media (prefers-reduced-motion: reduce) {
  .pp-preview[data-state="loading"] .pp-preview-state {
    animation: none;
  }
}

/* Resumen en imagen: vista previa de la imagen que se comparte. */
.summary-body {
  justify-items: center;
  background: var(--bg);
}

.summary-image {
  width: 100%;
  max-width: 28rem;
  height: auto;
  border-radius: 12px;
  box-shadow: var(--shadow-md);
}

/* «Enviar por WhatsApp» es largo: los dos botones van uno sobre otro, el principal arriba. */
#summary-dialog .sheet-foot {
  flex-direction: column-reverse;
  align-items: stretch;
}

#summary-dialog .sheet-foot .button {
  width: 100%;
  white-space: nowrap;
}


/* Pase montado fuera de la pantalla solo para dibujar su imagen. */
.pass-render {
  position: fixed;
  top: 0;
  left: -10000px;
  width: 400px;
  pointer-events: none;
}

/* Versión de la app Android al pie del menú. */
.menu-version {
  padding: 10px 12px 2px;
  color: var(--faint);
  font-size: var(--text-xs);
  text-align: center;
}

/* Teléfono con botón «Copiar» en la pantalla de la persona. */
.pp-phone {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.pp-copy {
  flex: none;
  min-height: 36px;
  padding-inline: 12px;
  gap: 6px;
  font-size: var(--text-sm);
}

.pp-copy .icon {
  width: 16px;
  height: 16px;
}

/* Estado de los avisos en el menú: «Activados» en azul, «Desactivados» en gris. */
.menu-state {
  flex: none;
  padding: 2px 0;
  color: var(--faint);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
}

.menu-item.is-on .menu-state {
  color: var(--accent);
}

/* Escáner a pantalla completa (modo cámara): la imagen ocupa toda la ventana, el título va
   encima sobre un degradado, el visor queda centrado y los controles flotan abajo. */
.scan[data-mode="camera"] {
  background: #05080f;
  color: #fff;
}

@media (min-width: 601px) and (min-height: 601px) {
  dialog.sheet.scan[data-mode="camera"] {
    height: min(88dvh, 46rem);
  }
}

.scan[data-mode="camera"] .sheet-form {
  position: relative;
  height: 100%;
}

.scan[data-mode="camera"] .sheet-head {
  position: absolute;
  inset: 0 0 auto;
  z-index: 3;
  border: 0;
  background: linear-gradient(rgb(5 8 15 / 0.85), rgb(5 8 15 / 0));
  padding-bottom: 36px;
}

.scan[data-mode="camera"] .sheet-head h2,
.scan[data-mode="camera"] .sheet-head .icon-button {
  color: #fff;
}

.scan[data-mode="camera"] .sheet-head .sheet-sub {
  color: rgb(255 255 255 / 0.75);
}

.scan[data-mode="camera"] .sheet-body {
  position: relative;
  flex: 1;
  display: block;
  padding: 0;
  overflow: hidden;
}

.scan[data-mode="camera"] .scan-view {
  position: absolute;
  inset: 0;
  aspect-ratio: auto;
  border-radius: 0;
  background: #05080f;
}

.scan[data-mode="camera"] .scan-view video {
  transition: filter 0.2s ease;
}

.scan-view.is-paused video {
  filter: brightness(0.45) blur(2px);
}

/* Visor centrado, cuadrado y del tamaño de la pantalla (hasta 300 px). */
.scan[data-mode="camera"] .scan-frame {
  --frame: min(68vw, 44dvh, 300px);
  inset: auto;
  top: 45%;
  left: 50%;
  width: var(--frame);
  translate: -50% -50%;
  border-radius: 22px;
  box-shadow: 0 0 0 100vmax rgb(5 8 15 / 0.6);
}

.scan[data-mode="camera"] .scan-frame > span {
  width: 42px;
  height: 42px;
  border-width: 4px 0 0 4px;
  border-top-left-radius: 22px;
  transition: color 0.15s ease;
}

.scan-view.is-paused .scan-frame {
  opacity: 0;
}

/* Al leer un pase: marco verde y un ✓ que aparece en el centro. */
.scan-check {
  position: absolute;
  top: 45%;
  left: 50%;
  display: grid;
  place-items: center;
  width: 76px;
  height: 76px;
  border-radius: 50%;
  background: #12b76a;
  color: #fff;
  translate: -50% -50%;
  scale: 0.4;
  opacity: 0;
  pointer-events: none;
  box-shadow: 0 10px 30px rgb(18 183 106 / 0.45);
  transition: scale 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.15s ease;
}

.scan-check .icon {
  width: 38px;
  height: 38px;
  stroke-width: 3;
}

.scan-view.is-detected .scan-check {
  scale: 1;
  opacity: 1;
}

.scan[data-mode="camera"] .scan-status {
  inset: auto;
  top: calc(45% + min(68vw, 44dvh, 300px) / 2 + 22px);
  left: 50%;
  width: max-content;
  max-width: calc(100% - 48px);
  translate: -50% 0;
  padding: 8px 16px;
  border-radius: 999px;
  background: rgb(5 8 15 / 0.55);
  backdrop-filter: blur(8px);
  font-weight: var(--weight-medium);
}

.scan-view.is-detected .scan-status {
  background: #12b76a;
}

.scan-controls {
  position: absolute;
  inset: auto 0 calc(28px + env(safe-area-inset-bottom));
  display: flex;
  justify-content: center;
  gap: 32px;
}

.scan[data-mode="code"] .scan-controls {
  display: none;
}

.scan-control {
  display: grid;
  justify-items: center;
  gap: 8px;
  padding: 0;
  border: 0;
  background: none;
  color: #fff;
  font: inherit;
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  cursor: pointer;
}

.scan-control[hidden] {
  display: none;
}

.scan-control .icon {
  box-sizing: content-box;
  width: 24px;
  height: 24px;
  padding: 16px;
  border-radius: 50%;
  background: rgb(255 255 255 / 0.16);
  backdrop-filter: blur(8px);
  transition: background-color 0.15s ease, color 0.15s ease;
}

.scan-control[aria-pressed="true"] .icon {
  background: #fff;
  color: #05080f;
}

/* El resultado sube como tarjeta sobre la cámara; los controles se ocultan mientras tanto. */
.scan[data-mode="camera"] .scan-result {
  position: absolute;
  inset: auto 12px calc(12px + env(safe-area-inset-bottom));
  z-index: 4;
  padding: 24px 20px 20px;
  border: 0;
  border-radius: 22px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 -10px 40px rgb(0 0 0 / 0.35);
}

.scan[data-mode="camera"]:has(.scan-result:not([hidden])) :is(.scan-controls, .scan-status) {
  display: none;
}

@media (prefers-reduced-motion: no-preference) {
  .scan[data-mode="camera"] .scan-result:not([hidden]) {
    animation: scan-card-in 0.32s cubic-bezier(0.32, 0.72, 0, 1);
  }
}

@keyframes scan-card-in {
  from {
    translate: 0 40px;
    opacity: 0;
  }
}

/* El video de la cámara no se ve hasta que está en marcha (evita el ícono de pausa de Android). */
.scan-view video {
  opacity: 0;
  transition: opacity 0.2s ease;
}

.scan-view video.is-live {
  opacity: 1;
}

.scan-view video::-webkit-media-controls,
.scan-view video::-webkit-media-controls-overlay-play-button,
.scan-view video::-webkit-media-controls-start-playback-button {
  display: none !important;
  -webkit-appearance: none;
}

/* Teclado propio de «Marcar con código»: 4 filas de 8 teclas grandes. */
.keypad {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: 7px;
  width: 100%;
  max-width: 30rem;
  margin-top: 12px;
  padding: 8px;
  border-radius: 14px;
  background: var(--bg);
  justify-self: stretch;
}

.key {
  display: grid;
  place-items: center;
  min-height: 60px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 1.5rem;
  font-weight: var(--weight-bold);
  line-height: 1;
  box-shadow: 0 1px 0 rgb(16 24 40 / 0.06);
  cursor: pointer;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
  transition: background-color 0.08s ease, transform 0.08s ease;
}

.key:active {
  background: var(--accent-soft);
  border-color: var(--accent);
  transform: scale(0.94);
}

/* Los números se distinguen con un fondo suave. */
.key[data-key="2"], .key[data-key="3"], .key[data-key="4"], .key[data-key="5"],
.key[data-key="6"], .key[data-key="7"], .key[data-key="8"], .key[data-key="9"] {
  background: #f7f9fc;
}

.key-delete {
  background: #eef2f7;
  color: var(--muted);
}

.key-delete .icon {
  width: 28px;
  height: 28px;
}

/* Pantallas angostas o teléfono acostado: teclas algo menores para que todo quepa. */
@media (max-width: 359px) {
  .keypad {
    gap: 5px;
  }

  .key {
    min-height: 54px;
    font-size: 1.3rem;
  }
}

@media (max-height: 600px) {
  .key {
    min-height: 44px;
    font-size: 1.2rem;
  }
}

@keyframes toast-in {
  from {
    opacity: 0;
    translate: 0 -16px;
    scale: 0.96;
  }
}

/* Marcar con código: el teclado queda fijo abajo, a todo el ancho, como el del teléfono; el
   código y «Buscar pasajero» quedan arriba. */
.scan[data-mode="code"] .sheet-body {
  display: flex;
  flex-direction: column;
  padding-bottom: 0;
}

.scan[data-mode="code"] .scan-manual {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: stretch;
}

.scan[data-mode="code"] .scan-manual > :is(label, .hint) {
  align-self: stretch;
}

.scan[data-mode="code"] .scan-manual .pin-input {
  align-self: center;
}

.scan[data-mode="code"] .scan-manual > .button {
  order: 1;
  margin-top: 16px;
}

.scan[data-mode="code"] .keypad {
  order: 2;
  width: auto;
  max-width: none;
  margin: auto -20px 0;
  padding: 10px max(8px, env(safe-area-inset-left)) calc(10px + env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-right));
  border-radius: 18px 18px 0 0;
  background: #e6eaf0;
  box-shadow: 0 -1px 0 var(--line);
}

.scan[data-mode="code"] .keypad::before {
  content: "";
  grid-column: 1 / -1;
  justify-self: center;
  width: 36px;
  height: 4px;
  margin-bottom: 4px;
  border-radius: 2px;
  background: #c3cad5;
}
