/* Phone and tablet layout for Bestellhub v3. Desktop (wider than 900px) is unchanged. */

@media (max-width: 900px) {
  html, body { overflow-x: hidden; }
  .page, .checkout, .wizard-card, .order-grid, .summary { max-width: 100%; }
  img, svg, video { max-width: 100%; height: auto; }

  .app-header {
    padding: 0.2rem 0.65rem 0.15rem;
    gap: 0;
  }
  .app-header .nav { order: 1; flex: 1 1 auto; width: auto; margin: 0; }
  .app-header .account { order: 2; margin-left: auto; }
  .app-header .brand { order: 0; }
  .app-header .powered-by { display: none; }
  .nav a {
    min-height: 44px;
    padding: 0 0.45rem;
    font-size: 0.95rem;
  }
  .account .login-quiet,
  .account button.linkish {
    min-height: 44px;
    padding: 0 0.35rem;
    font-size: 0.78rem;
    font-weight: 500;
    color: #8a8a8a;
    text-decoration: none;
  }

  html.embedded .app-header .brand { display: none; }
  html.embedded .app-header { border-bottom: 0; padding-top: 0.15rem; }

  /* One step indicator: «Schritt n von 5» plus the current name. No dots, no bar. */
  .screen-kicker { display: none; }
  .wizard-card h2 {
    font-size: 1.55rem;
    line-height: 1.15;
    margin-bottom: 0.35rem;
  }
  .screen-lead, .wizard-card .hint { font-size: 0.95rem; }

  .checkout .stepper {
    margin: 0 0 0.85rem;
    padding: 0;
    background: none;
    border: 0;
  }
  .checkout .stepper ol,
  .checkout .step-track { display: none !important; }
  .checkout .step-meter {
    display: flex !important;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.75rem;
    margin: 0;
    padding: 0.15rem 0 0.45rem;
    border-bottom: 1px solid #111;
    font-size: 0.82rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #5c5c5c;
  }
  .checkout .step-meter strong {
    margin-left: auto;
    font-size: 1rem;
    font-weight: 650;
    letter-spacing: 0;
    text-transform: none;
    color: #111;
  }

  /* Both choices on one row, without the tall empty cards. */
  .type-grid, .delivery-mode {
    grid-template-columns: 1fr 1fr !important;
    gap: 0.5rem;
    align-items: stretch;
  }
  .type-card {
    min-height: 0 !important;
    height: auto;
    padding: 0.65rem 0.55rem 0.7rem;
    gap: 0.2rem;
    justify-content: flex-start;
  }
  .type-lead {
    font-size: 0.78rem;
    line-height: 1.25;
    max-width: none;
  }
  .type-card strong { font-size: 0.95rem; line-height: 1.2; }

  .row.sources {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0.45rem;
  }
  .row.sources .btn {
    width: 100%;
    min-height: 48px;
    justify-content: flex-start;
  }
  .drop-zone { min-height: 7.5rem; }
  .cat-tab, .tile, .choice, .opt-btn, .btn, .btn.small {
    min-height: 44px;
  }
  .cat-tab { width: 100%; justify-content: center; }

  .wizard-card .field,
  .wizard-card .field-row {
    display: block;
  }
  .wizard-card .field label { display: block; margin-bottom: 0.25rem; }
  input, select, textarea { font-size: 16px; }

  .summary { width: 100%; margin-top: 1rem; }
  .summary-facts { display: grid; gap: 0.35rem; }
  .file, .file-row { max-width: 100%; }

  .choice-list .btn, .login-providers .btn {
    width: 100%;
    min-height: 48px;
  }
  .gate, .login-providers { max-width: none; }

  /* Direct hub: the action bar sticks to the phone. Our website frame draws its own. */
  html.embedded:not(.framed-fixed) .order-actions { display: none !important; }
  html.embedded #app { padding-bottom: calc(4.75rem + env(safe-area-inset-bottom)); }
  html:not(.embedded) .order-actions {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 30;
    margin: 0;
    padding: 0.65rem 0.85rem calc(0.65rem + env(safe-area-inset-bottom));
    background: #fff;
    border-top: 1px solid #111;
    box-shadow: 0 -6px 18px rgba(0, 0, 0, 0.06);
  }
  html:not(.embedded) .order-actions .btn { min-height: 48px; flex: 1; }
  html:not(.embedded) .page { padding-bottom: calc(6.5rem + env(safe-area-inset-bottom)); }

  .sp-mask, .od-mask, .pv-mask {
    padding: 0;
    align-items: stretch;
  }
  .sp-panel, .od-panel, .pv-panel {
    width: 100%;
    max-width: none;
    min-height: 100%;
    height: 100%;
    max-height: none;
    margin: 0;
    border: 0;
    border-radius: 0;
  }
  .od-panel, .pv-panel { min-height: 100dvh; }
}

/* Fixed-height third-party iframe (scrolling=no, no height ack): scroll inside the frame. */
html.framed-fixed,
html.framed-fixed body {
  height: 100%;
  height: 100dvh;
  max-height: 100dvh;
  margin: 0;
  overflow: hidden;
}
html.framed-fixed #app {
  height: 100%;
  height: 100dvh;
  max-height: 100dvh;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  box-sizing: border-box;
  padding-bottom: calc(5rem + env(safe-area-inset-bottom));
}
html.framed-fixed .order-actions {
  display: flex !important;
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 40;
  gap: 0.5rem;
  margin: 0;
  padding: 0.65rem 0.85rem calc(0.65rem + env(safe-area-inset-bottom));
  background: #fff;
  border-top: 1px solid #111;
  box-shadow: 0 -6px 18px rgba(0, 0, 0, 0.06);
}
html.framed-fixed .order-actions .btn { flex: 1; min-height: 48px; }

@media (max-width: 390px) {
  .wizard-card h2 { font-size: 1.4rem; }
}

/* Desktop: one row. Active step is bold with a single underline. */
@media (min-width: 901px) {
  .screen-kicker { display: none; }
  .checkout .stepper {
    background: none;
    border: 0;
    padding: 0;
    margin: 0 0 1.15rem;
  }
  .checkout .step-meter,
  .checkout .step-track { display: none !important; }
  .checkout .stepper ol {
    display: flex !important;
    flex-wrap: wrap;
    align-items: stretch;
    gap: 0 1.5rem;
    width: auto;
    margin: 0;
    padding: 0;
    border: 0;
    overflow: visible;
    grid-template-columns: none;
  }
  .checkout .stepper ol::before { content: none; }
  .checkout .stepper .step { flex: 0 0 auto; min-width: 0; }
  .checkout .stepper .step button {
    display: inline-flex;
    flex-direction: row;
    align-items: baseline;
    justify-content: flex-start;
    gap: 0.4rem;
    width: auto;
    min-height: 44px;
    padding: 0.2rem 0 0.4rem;
    margin: 0;
    border: 0;
    border-bottom: 2px solid transparent;
    border-radius: 0;
    background: none;
    color: #8a8a8a;
    font-weight: 500;
    font-size: 0.98rem;
    letter-spacing: 0;
    line-height: 1.2;
  }
  .checkout .stepper .step.done button { color: #111; font-weight: 500; }
  .checkout .stepper .step.current button {
    color: #111;
    font-weight: 700;
    border-bottom-color: #111;
  }
  .checkout .stepper .step-index {
    font-size: 0.78rem;
    font-weight: 650;
    letter-spacing: 0.02em;
  }
  .checkout .stepper .step.current .step-index { font-weight: 700; }
  .checkout .stepper .step-label { font-size: inherit; text-align: left; }
}

/* Product cards and optional add-ons. Same on desktop and phone. */
.line-card {
  border: 1px solid #111;
  margin: 0.75rem 0;
  background: #fff;
}
.line-card > summary::after {
  content: "▾";
  margin-left: 0.75rem;
  font-size: 0.85rem;
}
.line-card:not([open]) > summary::after { content: "▸"; }
.cat-tabs { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 0 0 0.8rem; }
.cat-general { border: 1px solid #111; padding: 0.75rem 1rem; margin: 0 0 0.8rem; }
.qty { display: inline-flex; align-items: center; gap: 0.35rem; }
.qty-btn { min-width: 3rem; min-height: 3rem; font-size: 1.35rem; line-height: 1; padding: 0 0.4rem; }
.qty-val { min-width: 1.6rem; text-align: center; font-weight: 700; }
.qty-line { display: flex; justify-content: space-between; align-items: center; gap: 0.75rem; margin: 0.35rem 0; }
.qty-master, .qty-multi { margin: 0.8rem 0; }
.extra-opts { flex-wrap: wrap; margin: 0.35rem 0 0.6rem; }
.file-row { flex-wrap: wrap; }

/* Review: lists scroll on their own so Senden stays reachable. */
.wizard-card[data-pane="review"] {
  max-height: min(70vh, 42rem);
  overflow: auto;
}
.summary-files {
  max-height: 16rem;
  overflow: auto;
}
.checkout .order-actions {
  position: sticky;
  bottom: 0;
  background: #fff;
  z-index: 2;
}
.row.sources.share-row { margin-top: 0.35rem; }
.clock-field { display: inline-flex; align-items: center; gap: 0.4rem; }
.clock-field input { max-width: 6.5rem; font-variant-numeric: tabular-nums; }
.row.sources.share-row .btn { flex: 1 1 100%; }
.line-card > summary {
  cursor: pointer;
  min-height: 44px;
  padding: 0.75rem 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  font-weight: 650;
  list-style: none;
}
.line-card > summary::-webkit-details-marker { display: none; }
.line-product { font-weight: 500; color: #5c5c5c; text-align: right; }
.line-body { padding: 0 1rem 0.85rem; }
.scale-note { border-left: 2px solid #111; padding-left: 0.65rem; }
.line-card .file-product,
.line-card select { max-width: 100%; min-height: 44px; }
.addon-row { margin: 0.35rem 0; }
.addon-link {
  background: none;
  border: 0;
  padding: 0.55rem 0;
  min-height: 44px;
  color: #111;
  font-weight: 650;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 0.18em;
}
.addon-body {
  margin: 0.35rem 0 1rem;
  padding: 0.85rem 1rem 0.35rem;
  border: 1px solid #111;
}

/* Page-1 preview of each PDF. The icon stays until the image is ready. */
.file { grid-template-columns: auto 1fr auto auto; }
img.pdf-thumb[hidden] { display: none !important; }
.file-thumb.pdf-thumb,
.sum-thumb.pdf-thumb {
  object-fit: contain;
  background: #f3f3f3;
}
.file-thumb.pdf-thumb { width: 64px; height: 84px; }
.sum-thumb.pdf-thumb { width: 36px; height: 48px; }
.pdf-preview {
  flex: 1;
  overflow: auto;
  background: #2b2b2b;
  padding: 0.75rem;
}
.pdf-page {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 0 auto;
  background: #fff;
}
.pdf-count { color: #5c5c5c; }

/* Only the step navigation (Zurück / Weiter, sidebar and phone bar) uses the serif.
   Every other button, including option chips and tabs, uses the page font. */
button,
.btn,
.btn.accent,
.btn.secondary,
.btn.small,
.btn.accent:hover:not(:disabled),
.btn.secondary:hover:not(:disabled),
.choice.on,
.choice.on span,
.cat-tab.on {
  font-family: inherit;
}
.btn[data-act="wiz-back"],
.btn[data-act="wiz-next"],
.btn[data-act="wiz-back"]:hover:not(:disabled),
.btn[data-act="wiz-next"]:hover:not(:disabled) {
  font-family: "Berlingske Serif Bold", "Times New Roman", Times, serif;
  font-weight: 700;
  letter-spacing: 0.01em;
  text-transform: none;
}

/* Sortierung: a paid order is visible above the file list. */
.sort-bar { margin: 0 0 .4rem; }
.sort-bar .hint { margin: .45rem 0 0; }
.sort-notice {
  margin: .55rem 0 0;
  padding: .5rem .7rem;
  border: 1px solid #111;
  border-left-width: 4px;
  background: #f7f7f7;
  font-size: .88rem;
  color: #111;
}
.file-group.sorted .file-list { margin-top: .6rem; }
