/* Material 3 styles for the restaurants pages. Shared components live in m3.css. */

/* ---- Page header ------------------------------------------------------- */
.m3-rest-header-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.m3-rest-overline {
  margin: 0;
  color: var(--md-on-surface-variant);
  font: 500 0.75rem/1rem var(--m3-font);
  letter-spacing: 0.04em;
}

/* A text button whose icon follows the label (arrow_forward, open_in_new). */
.m3-btn.m3-rest-btn-trailing .m3-icon {
  margin-right: -4px;
  margin-left: 0;
}

/* ---- Banners ----------------------------------------------------------- */
.m3-banner.m3-rest-banner-warning {
  color: #261900;
  background: var(--md-warning-container);
}

.m3-rest-banner-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.m3-rest-banner-text strong {
  font-weight: 500;
  font-size: 1rem;
  line-height: 1.5rem;
}

.m3-rest-banner-text a {
  color: inherit;
  font-weight: 500;
  text-decoration: underline;
}

.m3-banner.m3-rest-banner > .m3-icon {
  margin-top: 2px;
}

/* ---- Restaurants table --------------------------------------------------- */
.m3-rest-name {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.m3-rest-name a,
.m3-rest-name strong {
  color: var(--md-on-surface);
  font-weight: 500;
  text-decoration: none;
}

.m3-rest-name a:hover {
  color: var(--md-primary);
  text-decoration: underline;
}

.m3-rest-name span {
  color: var(--md-on-surface-variant);
  font-size: 0.8125rem;
}

.m3-table .m3-rest-cell-end {
  position: relative; /* keeps a hidden label inside the scrolling table */
  width: 1%;
  text-align: right;
  white-space: nowrap;
}

.m3-table .m3-rest-cell-muted {
  color: var(--md-on-surface-variant);
  white-space: nowrap;
}

.m3-table .m3-rest-cell-mono {
  font-family: var(--critical-font);
  font-size: 0.8125rem;
}

.m3-rest-empty-icon {
  display: block;
  margin: 0 auto 8px;
}

.m3-rest-empty-icon.m3-icon {
  width: 32px;
  height: 32px;
}

/* ---- Stat tiles holding words rather than counts ---------------------------- */
.m3-rest-stats .m3-stat-label {
  align-items: flex-start;
}

.m3-rest-stats .m3-stat-label .m3-icon {
  width: 20px;
  height: 20px;
}

/* Keep a short row of tiles the same width as a full one above it. */
.m3-stat-row.m3-rest-stats-fill {
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
}

.m3-stat-value.m3-rest-stat-text {
  font-size: 1.125rem;
  line-height: 1.75rem;
  overflow-wrap: anywhere;
}

.m3-rest-stat-support {
  color: var(--md-on-surface-variant);
  font: 400 0.8125rem/1.125rem var(--m3-font);
  overflow-wrap: anywhere;
}

/* ---- Readiness checks (the polled health panel) --------------------------- */
.m3-rest-health .m3-rest-stats {
  margin-bottom: 16px;
}

.m3-list-item.m3-rest-check {
  align-items: center;
}

.m3-list-item.m3-rest-check > .m3-icon {
  margin-top: 0;
  align-self: flex-start;
}

.m3-list-item.m3-rest-check.is-ok > .m3-icon {
  color: var(--md-success);
}

.m3-list-item.m3-rest-check.is-warn > .m3-icon {
  color: #7c5800;
}

.m3-list-item.m3-rest-check.is-fail > .m3-icon {
  color: var(--md-error);
}

.m3-rest-check .m3-list-headline {
  font-weight: 500;
}

.m3-rest-check-action {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  margin-top: 4px;
  color: var(--md-on-surface);
  font: 400 0.875rem/1.25rem var(--m3-font);
}

.m3-rest-check-action .m3-icon {
  width: 16px;
  height: 16px;
  margin-top: 2px;
  color: var(--md-on-surface-variant);
}

.m3-rest-check > .m3-btn {
  flex: none;
}

@media (max-width: 760px) {
  .m3-list-item.m3-rest-check {
    flex-wrap: wrap;
  }
  /* Full width for the text; "Fix it" drops to its own line below. */
  .m3-rest-check > .m3-list-text {
    flex-basis: calc(100% - 40px);
  }
  .m3-rest-check > .m3-btn {
    margin-left: 28px;
  }
}

/* ---- Cards on the restaurant page ------------------------------------------ */
.m3-rest-section-title {
  margin: 32px 0 12px;
}

.m3-rest-card-form .m3-grid {
  margin-top: 8px;
}

.m3-card.m3-rest-danger {
  border-color: var(--md-error);
}

.m3-rest-danger .m3-card-head {
  margin-bottom: 16px;
}

.m3-rest-danger .m3-title-large {
  color: var(--md-error);
}

.m3-rest-danger-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 12px 16px;
}

.m3-rest-danger-row .m3-field {
  flex: 1 1 320px;
  max-width: 480px;
}

.m3-rest-danger-row .m3-btn {
  margin-top: 8px;
}

/* m3.css drops the outline of a disabled outlined button; without it the
   waiting delete button reads as loose text. */
.m3-rest-danger-row .m3-btn-outlined:disabled {
  border-color: rgb(25 28 32 / 12%);
}

/* ---- Live logs ------------------------------------------------------------ */
.m3-rest-log {
  max-height: 420px;
  margin: 0;
  padding: 16px;
  overflow: auto;
  border-radius: var(--md-radius-sm);
  color: #e3e3e3;
  background: #1e1e1e;
  font: 400 0.75rem/1.45 var(--critical-font);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.m3-rest-sig {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  vertical-align: middle;
}

.m3-rest-sig .m3-icon {
  width: 20px;
  height: 20px;
}

.m3-rest-sig.is-valid {
  color: var(--md-success);
}

.m3-rest-sig.is-invalid {
  color: var(--md-error);
}

/* ---- Sign-in ticket --------------------------------------------------------- */
.m3-rest-secret {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.m3-rest-secret code {
  padding: 4px 10px;
  border-radius: var(--md-radius-sm);
  color: var(--md-on-surface);
  background: var(--md-surface-container);
  font: 500 1.125rem/1.75rem var(--critical-font);
  letter-spacing: 0.06em;
}

.m3-rest-steps {
  display: grid;
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: m3-rest-step;
}

.m3-rest-steps li {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  font: 400 0.875rem/1.25rem var(--m3-font);
  counter-increment: m3-rest-step;
}

.m3-rest-steps li::before {
  content: counter(m3-rest-step);
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  margin-top: -4px;
  border-radius: 50%;
  color: var(--md-on-primary-container);
  background: var(--md-primary-container);
  font: 500 0.8125rem/1 var(--m3-font);
}

.m3-rest-note {
  margin-top: 16px;
}

/* ---- Utilities ---------------------------------------------------------- */
.m3-rest-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ---- Contract & consent on the restaurant page ------------------------------ */
.rest-consent { display: flex; align-items: center; gap: 16px; }
.rest-consent-sig {
  width: 200px;
  height: 80px;
  object-fit: contain;
  border: 1px solid var(--md-outline-variant);
  border-radius: var(--md-radius-md);
  background: #fff;
}
.rest-signed { display: inline-flex; align-items: center; gap: 2px; color: var(--md-success); font-weight: 600; }
.rest-signed .m3-icon { width: 14px; height: 14px; }

/* ---- Sales onboarding ------------------------------------------------------- */
.onb-page { max-width: 920px; }
.onb-back { margin: 0 0 8px -12px; }
.onb-form, .onb-sign { display: grid; gap: 16px; }

.onb-steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 18px 0 4px;
  padding: 0;
  list-style: none;
  counter-reset: none;
}

.onb-step {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--md-outline-variant);
  border-radius: var(--md-radius-lg);
  color: var(--md-on-surface-variant);
  background: var(--md-surface-container-low);
  font: 500 0.875rem/1.25rem var(--m3-font);
  transition: background-color 200ms, border-color 200ms;
}

.onb-step-dot {
  display: grid;
  place-items: center;
  flex: 0 0 32px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--md-surface-container-high);
}

.onb-step-dot .m3-icon { width: 18px; height: 18px; }
.onb-step.is-done { color: var(--md-on-surface); }
.onb-step.is-done .onb-step-dot { color: #fff; background: var(--md-success); }
.onb-step.is-current { border-color: var(--md-primary); color: var(--md-on-primary-container); background: var(--md-primary-container); }
.onb-step.is-current .onb-step-dot { color: #fff; background: var(--md-primary); }

.onb-list { display: grid; gap: 12px; margin: 0; padding: 0; list-style: none; }
.onb-row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; }
.onb-row-main { display: grid; gap: 2px; flex: 1 1 260px; min-width: 0; }
.onb-empty { display: grid; justify-items: center; gap: 12px; padding: 40px 20px; text-align: center; }
.onb-empty > .m3-icon { width: 40px; height: 40px; color: var(--md-outline); }

.onb-signin-state { display: flex; gap: 16px; align-items: flex-start; }
.onb-signin-state > .m3-icon { flex: 0 0 40px; width: 40px; height: 40px; color: var(--md-primary); }
.onb-signin-state.is-done > .m3-icon { color: var(--md-success); }

.onb-consent-hint { display: flex; align-items: center; gap: 8px; margin: 0 0 12px; }
.onb-consent-hint .m3-icon { width: 18px; height: 18px; }
.onb-consent-text {
  max-height: 46vh;
  overflow-y: auto;
  padding: 4px 18px 8px;
  border: 1px solid var(--md-outline-variant);
  border-radius: var(--md-radius-md);
  background: var(--md-surface-bright);
}

.consent-text h2 { margin: 14px 0 2px; font-size: 1.25rem; }
.consent-text h3 { margin: 16px 0 4px; font-size: 1rem; }
.consent-text p, .consent-text li { font-size: 0.9375rem; line-height: 1.55; }
.consent-text ul { padding-inline-start: 20px; }
.consent-meta { color: var(--md-on-surface-variant); font-size: 0.8125rem !important; }

/* The pad: a white sheet with a line to sign on. */
.onb-pad-wrap {
  position: relative;
  height: 200px;
  margin: 8px 0 4px;
  border: 2px dashed var(--md-outline);
  border-radius: var(--md-radius-lg);
  background: #fff;
}

.onb-pad-wrap.is-error { border-color: var(--md-error); }
.onb-pad { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; cursor: crosshair; border-radius: inherit; }
.onb-pad-line { position: absolute; left: 24px; right: 24px; bottom: 46px; height: 1px; background: var(--md-outline-variant); pointer-events: none; }
.onb-pad-hint {
  position: absolute;
  left: 24px;
  bottom: 54px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--md-outline);
  font-size: 0.9375rem;
  pointer-events: none;
}
.onb-pad-hint .m3-icon { width: 18px; height: 18px; }
.onb-pad-hint[hidden] { display: none; }
.onb-pad-clear { position: absolute; top: 6px; right: 6px; }

.onb-agree { display: flex; gap: 10px; align-items: flex-start; margin: 14px 0 4px; font-size: 0.9375rem; cursor: pointer; }
.onb-agree input { width: 20px; height: 20px; margin-top: 2px; flex: 0 0 auto; }
.onb-agree.is-error span { color: var(--md-error); }
.onb-error { margin: 2px 0 0; color: var(--md-error); font-size: 0.875rem; }

.onb-done { display: grid; justify-items: center; gap: 10px; padding: 32px 20px; text-align: center; }
.onb-done-icon .m3-icon { width: 56px; height: 56px; color: var(--md-success); }

/* ---- The signed consent, on screen and on paper ------------------------------ */
.consent-page { max-width: 820px; }
.consent-toolbar { display: flex; justify-content: space-between; margin-bottom: 16px; }
.consent-sheet {
  padding: 28px 36px;
  border: 1px solid var(--md-outline-variant);
  border-radius: var(--md-radius-lg);
  background: #fff;
  color: #111;
}
.consent-signature { margin-top: 28px; }
.consent-signature dl { display: flex; flex-wrap: wrap; gap: 8px 40px; margin: 0 0 8px; }
.consent-signature dt { color: #555; font-size: 0.8125rem; }
.consent-signature dd { margin: 0; font-weight: 600; }
.consent-signature-img { display: block; width: 320px; max-width: 100%; height: auto; }
.consent-signature-line { display: block; width: 320px; max-width: 100%; padding-top: 4px; border-top: 1px solid #333; color: #555; font-size: 0.8125rem; }
.consent-proof { margin-top: 24px; color: #555; font-size: 0.75rem; }
.consent-proof code { font-size: 0.6875rem; word-break: break-all; }

@media (max-width: 640px) {
  .onb-steps { grid-template-columns: 1fr; }
  .consent-sheet { padding: 18px; }
}

@media print {
  .navigation-drawer, .app-bar, .navigation-scrim, .no-print, .rail-tip { display: none !important; }
  .app-content { width: 100% !important; margin: 0 !important; padding: 0 !important; }
  .consent-sheet { border: 0; padding: 0; }
  body { background: #fff; }
}

/* ---- Approval, and the onboarding pages' motion -------------------------------- */
.rest-approval { margin-bottom: 16px; border: 1px solid color-mix(in srgb, var(--md-primary) 35%, transparent); }
.rest-approval.is-rejected { border-color: color-mix(in srgb, var(--md-error) 40%, transparent); }
.rest-checklist { display: grid; gap: 8px; margin: 4px 0 8px; padding: 0; list-style: none; }
.rest-checklist li {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  animation: onb-rise 360ms cubic-bezier(0.2, 0, 0, 1) both;
  animation-delay: calc(80ms + var(--i, 0) * 70ms);
}
.rest-checklist li > span:last-child { display: grid; gap: 1px; }
.rest-checklist small { color: var(--md-on-surface-variant); font-size: 0.8125rem; }
.rest-check-dot {
  display: grid;
  place-items: center;
  flex: 0 0 26px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  color: var(--md-on-surface-variant);
  background: var(--md-surface-container-high);
}
.rest-check-dot .m3-icon { width: 16px; height: 16px; }
.rest-checklist .is-done .rest-check-dot { color: #fff; background: var(--md-success); }
.rest-approval .m3-card-actions form { display: inline; }
.rest-waiting { margin-bottom: 16px; }

.onb-wait {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  max-width: 560px;
  margin: 4px auto;
  padding: 12px 14px;
  border-radius: var(--md-radius-md);
  color: var(--md-on-primary-container);
  background: var(--md-primary-container);
  text-align: start;
}
.onb-wait .m3-icon { flex: 0 0 22px; width: 22px; height: 22px; }

@keyframes onb-rise {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}

@keyframes onb-pop {
  0% { opacity: 0; transform: scale(0.4); }
  70% { opacity: 1; transform: scale(1.12); }
  100% { transform: scale(1); }
}

.onb-page .m3-card,
.onb-page .onb-steps,
.onb-page .m3-form-actions {
  animation: onb-rise 420ms cubic-bezier(0.2, 0, 0, 1) both;
}
.onb-page .onb-steps { animation-delay: 40ms; }
.onb-page .m3-card:nth-of-type(1), .onb-page .onb-list > :nth-child(1) { animation-delay: 90ms; }
.onb-page .m3-card:nth-of-type(2), .onb-page .onb-list > :nth-child(2) { animation-delay: 150ms; }
.onb-page .m3-card:nth-of-type(3), .onb-page .onb-list > :nth-child(3) { animation-delay: 210ms; }
.onb-page .m3-form-actions { animation-delay: 240ms; }
.onb-step.is-current .onb-step-dot { animation: onb-pop 420ms cubic-bezier(0.2, 0, 0, 1) 200ms both; }
.onb-done-icon { animation: onb-pop 520ms cubic-bezier(0.2, 0, 0, 1) 180ms both; }

@media (prefers-reduced-motion: reduce) {
  .onb-page *, .rest-checklist li { animation: none !important; }
}

/* ---- Dispatch timing: when the courier picks up, before delivery ----------- */
.rst-timing { margin-top: 20px; animation: rst-timing-in 360ms cubic-bezier(0.2, 0, 0, 1) both; }
.rst-timing .m3-title-large { display: flex; align-items: center; gap: 10px; }
.rst-timing .m3-title-large .m3-icon { width: 24px; height: 24px; color: var(--md-primary); }
.rst-timing-now {
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
  padding: 6px 14px;
  border-radius: 999px;
  color: var(--md-on-primary-container);
  background: var(--md-primary-container);
  font-weight: 500;
  white-space: nowrap;
}
.rst-timing-now strong { font-size: 1.375rem; font-variant-numeric: tabular-nums; }
.rst-timing-example {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 10px;
  margin: 18px 0 8px;
}
.rst-timing-dot {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  color: var(--md-on-primary-container);
  background: var(--md-primary-container);
}
.rst-timing-dot .m3-icon { width: 20px; height: 20px; }
.rst-timing-dot.is-drop { color: var(--md-on-primary); background: var(--md-primary); }
.rst-timing-line {
  position: relative;
  height: 6px;
  border-radius: 6px;
  background: var(--md-outline-variant);
}
.rst-timing-line::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: calc(25% + var(--lead, 0.25) * 75%);
  border-radius: 6px;
  background: var(--md-primary);
  transition: width 320ms cubic-bezier(0.2, 0, 0, 1);
}
.rst-timing-gap {
  position: absolute;
  left: 50%;
  bottom: 12px;
  transform: translateX(-50%);
  padding: 2px 10px;
  border-radius: 999px;
  color: var(--md-on-surface);
  background: var(--md-surface-container-high);
  font-size: 0.8125rem;
  font-weight: 600;
  white-space: nowrap;
}
.rst-timing-say { margin: 4px 0 16px; color: var(--md-on-surface-variant); }
.rst-timing-say strong { color: var(--md-on-surface); font-variant-numeric: tabular-nums; }
.rst-timing-form .m3-chip-set { margin-bottom: 14px; }
.rst-timing-preset { border: 0; background: none; padding: 0; cursor: pointer; }
.rst-timing-preset.is-on .m3-adm-filter-chip-body {
  color: var(--md-on-secondary-container, var(--md-on-primary-container));
  border-color: transparent;
  background: var(--md-secondary-container, var(--md-primary-container));
}
.rst-timing-row { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 12px; }
.rst-timing-row .m3-field { flex: 1 1 220px; max-width: 320px; }
.rst-timing-row .m3-btn { margin-top: 4px; }
@keyframes rst-timing-in { from { opacity: 0; transform: translateY(8px); } }
@media (prefers-reduced-motion: reduce) {
  .rst-timing { animation: none; }
  .rst-timing-line::before { transition: none; }
}

/* Dispatch timing: dynamic or fixed, each with its own panel. */
.rst-timing-modes { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin: 14px 0 16px; }
.rst-timing-mode { position: relative; cursor: pointer; }
.rst-timing-mode input { position: absolute; opacity: 0; pointer-events: none; }
.rst-timing-mode > span {
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: auto auto;
  column-gap: 10px;
  align-items: center;
  padding: 12px 14px;
  border: 1px solid var(--md-outline-variant);
  border-radius: 16px;
  transition: border-color 160ms, background-color 160ms, box-shadow 160ms;
}
.rst-timing-mode > span .m3-icon { grid-row: span 2; width: 26px; height: 26px; color: var(--md-primary); }
.rst-timing-mode small { color: var(--md-on-surface-variant); }
.rst-timing-mode input:checked + span {
  border-color: var(--md-primary);
  background: var(--md-primary-container);
  box-shadow: 0 0 0 1px var(--md-primary) inset;
}
.rst-timing-mode input:focus-visible + span { outline: 2px solid var(--md-primary); outline-offset: 2px; }
.rst-timing-panel { animation: rst-timing-in 260ms cubic-bezier(0.2, 0, 0, 1) both; }
.rst-timing [data-panel] { display: none; }
.rst-timing.is-mode-dynamic [data-panel="dynamic"],
.rst-timing.is-mode-lieferando [data-panel="lieferando"],
.rst-timing.is-mode-fixed [data-panel="fixed"] { display: block; }
.rst-timing-levels { margin: 6px 0 4px; }
.rst-timing-level-say { margin: 0 0 14px; min-height: 1.2em; }
.rst-timing-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.rst-timing-table { width: 100%; margin: 14px 0 6px; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.rst-timing-table th { padding: 6px 8px; color: var(--md-on-surface-variant); font-size: 0.75rem; font-weight: 600; text-align: start; }
.rst-timing-table td { padding: 8px; border-top: 1px solid var(--md-outline-variant); }
.rst-timing-table td[data-lead] { font-weight: 600; color: var(--md-primary); }
.rst-timing-now .m3-icon { width: 18px; height: 18px; margin-inline-end: 4px; vertical-align: -3px; }
@media (max-width: 640px) {
  .rst-timing-grid { grid-template-columns: 1fr; }
  .rst-timing-table th:nth-child(4), .rst-timing-table td:nth-child(4) { display: none; }
}
.rst-timing-grid > .m3-field { grid-column: auto; }
@media (max-width: 640px) { .rst-timing-modes { grid-template-columns: 1fr; } }

/* ---- The restaurant setup page: progress, steps and motion ------------------
   The same pieces as the onboarding page: cards rise in turn, a step that
   turns done pops its check, the progress bar grows, chips settle in. The
   dispatch timing is the last step of the list, not a card beside it. */
.rst-setup .m3-page-header { margin-bottom: 28px; }
.rst-setup-status { margin-top: 18px; }

.rst-progress {
  display: grid;
  gap: 8px;
  max-width: 520px;
  margin-bottom: 14px;
}
.rst-progress-text { font: 400 0.9375rem/1.25rem var(--m3-font); }
.rst-progress-text strong { font-weight: 600; font-variant-numeric: tabular-nums; }
.rst-progress-track {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--md-surface-container-high);
}
.rst-progress-fill {
  display: block;
  width: var(--p, 0%);
  height: 100%;
  border-radius: inherit;
  background: var(--md-primary);
  transition: width 600ms cubic-bezier(0.2, 0, 0, 1), background-color 300ms ease;
  animation: sales-grow 800ms cubic-bezier(0.2, 0, 0, 1) 120ms both;
}
.rst-progress.is-complete .rst-progress-fill { background: var(--md-success); }

.rst-setup-status .m3-chip {
  height: 30px;
  transition: background-color 300ms ease, color 300ms ease, border-color 300ms ease;
  animation: onb-rise 320ms cubic-bezier(0.2, 0, 0, 1) both;
}
.rst-setup-status .m3-chip:nth-child(2) { animation-delay: 30ms; }
.rst-setup-status .m3-chip:nth-child(3) { animation-delay: 60ms; }
.rst-setup-status .m3-chip:nth-child(4) { animation-delay: 90ms; }
.rst-setup-status .m3-chip:nth-child(5) { animation-delay: 120ms; }
.rst-setup-status .m3-chip:nth-child(6) { animation-delay: 150ms; }
/* A poll every five seconds must not replay the entrance. */
.rst-setup-status.is-settled .m3-chip,
.rst-setup-status.is-settled .rst-progress-fill { animation: none; }

.rst-setup .m3-steps { gap: 20px; }
.rst-setup .m3-step { animation: onb-rise 420ms cubic-bezier(0.2, 0, 0, 1) both; }
.rst-setup .m3-step:nth-child(1) { animation-delay: 60ms; }
.rst-setup .m3-step:nth-child(2) { animation-delay: 130ms; }
.rst-setup .m3-step:nth-child(3) { animation-delay: 200ms; }
.rst-setup .m3-step:nth-child(4) { animation-delay: 270ms; }
.rst-setup .m3-step-marker {
  transition: background-color 300ms ease, color 300ms ease, box-shadow 300ms ease;
}
.rst-setup .m3-step.is-done .m3-step-marker .m3-icon {
  animation: onb-pop 460ms cubic-bezier(0.2, 0, 0, 1) 320ms both;
}
.rst-setup .rst-step-settings .m3-step-marker {
  color: var(--md-on-primary-container);
  background: var(--md-primary-container);
}
.rst-setup .rst-step-settings .m3-step-marker .m3-icon { animation: none; width: 20px; height: 20px; }
.rst-setup .m3-step > .m3-card {
  transition: border-color 200ms ease, box-shadow 200ms ease;
}
.rst-setup .m3-step > .m3-card:hover {
  border-color: color-mix(in srgb, var(--md-primary) 30%, var(--md-outline-variant));
  box-shadow: 0 1px 2px rgb(0 0 0 / 6%), 0 4px 14px rgb(0 0 0 / 5%);
}
.rst-setup .m3-card-head .m3-chip { flex: none; }

/* The step as one card: its parts divided by a hairline, not loose headings. */
.rst-setup .m3-card .m3-subhead {
  padding-top: 20px;
  border-top: 1px solid var(--md-outline-variant);
}
.rst-setup .m3-card .m3-card-head + .m3-subhead,
.rst-setup .m3-card .m3-list + .m3-subhead:first-of-type { margin-top: 20px; }

.rst-setup .m3-expand-body { animation: onb-rise 260ms cubic-bezier(0.2, 0, 0, 1) both; }
.rst-setup .m3-choice { transition: background-color 160ms ease, border-color 160ms ease, transform 160ms ease; }
.rst-setup .m3-choice:active { transform: scale(0.995); }
.rst-setup .m3-banner { animation: onb-rise 320ms cubic-bezier(0.2, 0, 0, 1) both; }

/* The dispatch timing card keeps its own content, now inside the list. */
.rst-setup .rst-timing { margin-top: 0; animation: none; }
.rst-setup .rst-timing-now strong { font-size: inherit; }

@media (prefers-reduced-motion: reduce) {
  .rst-setup *, .rst-setup *::before { animation: none !important; transition: none !important; }
}

/* ---- The RiderX account panel on the setup page --------------------------- */
.rst-cred {
  padding: 16px 18px;
  border: 1px solid var(--md-outline-variant);
  border-radius: var(--md-radius-md);
  background: var(--md-surface-bright);
  transition: border-color 240ms ease, background-color 240ms ease;
  animation: onb-rise 360ms cubic-bezier(0.2, 0, 0, 1) both;
}
.rst-cred.is-connected { border-color: color-mix(in srgb, var(--md-success) 35%, transparent); }
.rst-cred.is-invalid_credentials { border-color: color-mix(in srgb, var(--md-error) 55%, transparent); }
.rst-cred.is-invalid_credentials .rst-cred-text strong { color: var(--md-error); }
.rst-cred-head { display: flex; align-items: center; gap: 14px; }
.rst-cred-icon {
  display: grid;
  place-items: center;
  flex: 0 0 40px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  color: var(--md-on-primary-container);
  background: var(--md-primary-container);
}
.rst-cred-icon .m3-icon { width: 22px; height: 22px; }
.rst-cred.is-connected .rst-cred-icon {
  color: #fff;
  background: var(--md-success);
  animation: onb-pop 460ms cubic-bezier(0.2, 0, 0, 1) 200ms both;
}
.rst-cred.is-invalid_credentials .rst-cred-icon { color: #410002; background: var(--md-error-container); }
.rst-cred-text { display: grid; gap: 2px; min-width: 0; flex: 1; }
.rst-cred-text strong { font: 500 1rem/1.4 var(--m3-font); }
.rst-cred-text span { color: var(--md-on-surface-variant); font: 400 0.875rem/1.3 var(--m3-font); }
.rst-cred-spinner {
  flex: 0 0 22px;
  width: 22px;
  height: 22px;
  border: 3px solid color-mix(in srgb, var(--md-primary) 25%, transparent);
  border-top-color: var(--md-primary);
  border-radius: 50%;
  animation: m3-spin 800ms linear infinite;
}

.rst-cred-edit { margin-top: 4px; }
.rst-cred-edit > summary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 10px 0 0 42px;
  padding: 6px 12px;
  border-radius: 999px;
  color: var(--md-primary);
  font: 500 0.875rem/1.25rem var(--m3-font);
  list-style: none;
  cursor: pointer;
}
.rst-cred-edit > summary::-webkit-details-marker { display: none; }
.rst-cred-edit > summary:hover { background: rgb(0 99 154 / 8%); }
.rst-cred-edit > summary .m3-icon { width: 18px; height: 18px; }
/* Not connected: the form is the point, so no "change" toggle above it. */
.rst-cred:not(.is-connected) .rst-cred-edit > summary { display: none; }
.rst-cred-form { display: grid; gap: 16px; margin-top: 18px; animation: onb-rise 280ms cubic-bezier(0.2, 0, 0, 1) both; }
.rst-cred-form .m3-field { margin-bottom: 0; }

.rst-cred-server { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; }
.rst-cred-label { color: var(--md-on-surface-variant); font: 500 0.875rem/1 var(--m3-font); }
.rst-cred-hint { color: var(--md-on-surface-variant); font: 400 0.8125rem/1.2 var(--m3-font); }
.rst-seg {
  display: inline-flex;
  overflow: hidden;
  border: 1px solid var(--md-outline);
  border-radius: 999px;
  background: var(--md-surface-bright);
}
.rst-seg input { position: absolute; opacity: 0; pointer-events: none; }
.rst-seg label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 84px;
  justify-content: center;
  padding: 7px 16px;
  font: 500 0.875rem/1.25rem var(--m3-font);
  cursor: pointer;
  transition: background-color 180ms ease, color 180ms ease;
}
.rst-seg label + input + label { border-inline-start: 1px solid var(--md-outline); }
.rst-seg label .m3-icon { width: 0; height: 18px; opacity: 0; transition: width 180ms ease, opacity 180ms ease; }
.rst-seg input:checked + label {
  color: var(--md-on-secondary-container, #0d1d2a);
  background: var(--md-primary-container);
}
.rst-seg input:checked + label .m3-icon { width: 18px; opacity: 1; }
.rst-seg input:focus-visible + label { outline: 2px solid var(--md-primary); outline-offset: -2px; }
.rst-seg label:hover { background: rgb(0 99 154 / 8%); }

.rst-cred-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }

@media (prefers-reduced-motion: reduce) {
  .rst-cred, .rst-cred *, .rst-cred-form { animation: none !important; transition: none !important; }
  .rst-cred-spinner { animation: m3-spin 1600ms linear infinite !important; }
}
/* Fields on the tinted panel: the same white as their floating labels. */
.rst-cred { --m3-field-bg: var(--md-surface-bright); }
.rst-cred .m3-field-input { background: var(--md-surface-bright); }

/* Delivery service: the destination chooser and the panel of the chosen one. */
.rst-destinations { border: 0; margin: 0 0 16px; padding: 0; min-width: 0; }
.rst-destination-form { margin-bottom: 8px; }
.rst-destination-panel { display: grid; gap: 8px; }
.rst-destination-panel[hidden] { display: none; }
/* Room for the floating legend of the first field below the intro line. */
.rst-destination-panel > .m3-grid { margin-top: 16px; }

/* ---- Branches: listed under the restaurant on the same Lieferando login ---- */
.rest-branch { position: relative; padding-left: 28px; }
.rest-branch::before {
  content: "";
  position: absolute;
  left: 8px;
  top: -6px;
  width: 12px;
  height: 18px;
  border-left: 2px solid var(--md-outline-variant);
  border-bottom: 2px solid var(--md-outline-variant);
  border-bottom-left-radius: 6px;
}
.rest-branch-row td { background: var(--md-surface-container-low); }
.m3-rest-name .m3-chip { margin-right: 6px; vertical-align: middle; }
