/* ============================================================
   TEACON: Beleg und Rechnung

   Am Bildschirm eine ruhige Karte, beim Drucken ein sauberes
   A4-Blatt: Navigation, Fussbereich und Schaltflächen
   verschwinden, der Zahlteil rutscht an den Blattfuss.
   ============================================================ */

.bl-page { background: var(--cream); padding: var(--sp-10) var(--sp-5) var(--sp-20); min-height: 70vh; }
.bl-wrap { max-width: 860px; margin: 0 auto; }
.bl-page [hidden] { display: none !important; }

.bl-zurueck {
  display: inline-flex; align-items: center; gap: 8px; margin-bottom: var(--sp-6);
  color: var(--text-muted); font-size: 0.92rem; font-weight: 600;
}
.bl-zurueck:hover { color: var(--navy); }
.bl-zurueck .ic { width: 16px; height: 16px; }

.bl-blatt {
  background: var(--white); border-radius: var(--radius-lg); padding: var(--sp-12);
  box-shadow: 0 1px 2px rgba(19,13,76,.03), 0 30px 70px -46px rgba(19,13,76,.3);
}

/* ---------- Kopf ---------- */
.bl-kopf { display: flex; justify-content: space-between; align-items: flex-start; gap: var(--sp-8); padding-bottom: var(--sp-8); border-bottom: 1.5px solid var(--navy); }
.bl-marke { display: flex; align-items: center; gap: var(--sp-4); }
.bl-marke img { width: 46px; height: 46px; }
.bl-marke .name { font-size: 1.4rem; font-weight: 800; letter-spacing: .02em; color: var(--navy); line-height: 1; }
.bl-marke .sub { font-size: 0.76rem; color: var(--text-muted); letter-spacing: .06em; margin-top: 3px; }
.bl-titel { text-align: right; }
.bl-titel h1 { font-size: 1.5rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--navy); margin: 0 0 6px; }
.bl-nr { font-family: ui-monospace, 'SF Mono', Menlo, monospace; font-size: 0.95rem; color: var(--text-muted); }

.bl-stempel {
  display: inline-flex; align-items: center; gap: 7px; margin-top: 10px;
  padding: 5px 13px; border-radius: 999px; font-size: 0.76rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase;
}
.bl-stempel .ic { width: 14px; height: 14px; }
.bl-stempel.bezahlt      { background: rgba(46,158,91,.14); color: #1F7A45; }
.bl-stempel.offen        { background: rgba(219,154,83,.18); color: var(--brown); }
.bl-stempel.storniert,
.bl-stempel.fehlgeschlagen { background: rgba(232,112,95,.15); color: var(--danger); }

/* ---------- Anschriften ---------- */
.bl-adressen { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-10); padding: var(--sp-8) 0; }
.bl-adr h4 { font-size: 0.7rem; font-weight: 800; letter-spacing: .16em; text-transform: uppercase; color: var(--brown); margin: 0 0 var(--sp-3); }
.bl-adr p { margin: 0; line-height: 1.75; color: var(--navy); font-size: 0.95rem; }
.bl-adr .leise { color: var(--text-muted); }

/* ---------- Positionen ---------- */
.bl-tab { width: 100%; border-collapse: collapse; margin-top: var(--sp-4); }
.bl-tab th {
  text-align: left; font-size: 0.7rem; font-weight: 800; letter-spacing: .14em; text-transform: uppercase;
  color: var(--brown); padding: 0 0 var(--sp-3); border-bottom: 1px solid var(--line);
}
.bl-tab th:last-child, .bl-tab td:last-child { text-align: right; }
.bl-tab td { padding: var(--sp-5) 0; border-bottom: 1px solid var(--line); color: var(--navy); font-size: 0.96rem; vertical-align: top; }
.bl-tab td small { display: block; color: var(--text-muted); font-size: 0.85rem; margin-top: 4px; line-height: 1.6; }
.bl-tab .betrag { font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; }
.bl-tab tr.rabatt td, .bl-tab tr.rabatt .betrag { color: #1F7A45; }
.bl-tab tr.zuschlag td, .bl-tab tr.zuschlag .betrag { color: var(--brown); }

.bl-summe { display: flex; justify-content: flex-end; padding-top: var(--sp-6); }
.bl-summe-box { min-width: 260px; }
.bl-summe-z { display: flex; justify-content: space-between; gap: var(--sp-6); padding: 7px 0; font-size: 0.95rem; color: var(--text-muted); }
.bl-summe-z span:last-child { font-variant-numeric: tabular-nums; font-weight: 600; color: var(--navy); }
.bl-summe-total {
  display: flex; justify-content: space-between; gap: var(--sp-6); align-items: baseline;
  margin-top: var(--sp-3); padding-top: var(--sp-4); border-top: 1.5px solid var(--navy);
  font-weight: 700; color: var(--navy);
}
.bl-summe-total .zahl { font-size: 1.45rem; font-weight: 800; font-variant-numeric: tabular-nums; }

.bl-notiz { margin-top: var(--sp-8); padding: var(--sp-5) var(--sp-6); background: var(--cream); border-radius: 14px; }
.bl-notiz h4 { font-size: 0.7rem; font-weight: 800; letter-spacing: .16em; text-transform: uppercase; color: var(--brown); margin: 0 0 8px; }
.bl-notiz p { margin: 0; color: var(--navy); font-size: 0.94rem; line-height: 1.7; }

/* ---------- Zahlteil nach Schweizer Norm ---------- */
.bl-zahlteil { margin-top: var(--sp-10); border-top: 1.5px dashed var(--line); padding-top: var(--sp-8); }
.bl-zahlteil-hd { font-size: 0.7rem; font-weight: 800; letter-spacing: .16em; text-transform: uppercase; color: var(--brown); margin-bottom: var(--sp-6); }
.bl-zt-grid { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: var(--sp-10); align-items: start; }
.bl-qr { width: 250px; }
.bl-qr svg { width: 100%; height: auto; display: block; }
.bl-qr-note { font-size: 0.8rem; color: var(--text-muted); margin-top: var(--sp-4); line-height: 1.6; }
.bl-zt-feld { margin-bottom: var(--sp-5); }
.bl-zt-feld h5 { font-size: 0.68rem; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; color: var(--brown); margin: 0 0 5px; }
.bl-zt-feld p { margin: 0; color: var(--navy); font-size: 0.95rem; line-height: 1.65; }
.bl-zt-feld .mono { font-family: ui-monospace, 'SF Mono', Menlo, monospace; letter-spacing: .03em; }
.bl-zt-betrag { font-size: 1.3rem; font-weight: 800; font-variant-numeric: tabular-nums; }

/* ---------- Fussnote und Schaltflächen ---------- */
.bl-fuss { margin-top: var(--sp-10); padding-top: var(--sp-6); border-top: 1px solid var(--line); font-size: 0.84rem; color: var(--text-muted); line-height: 1.75; }
.bl-fuss a { color: var(--brown); font-weight: 600; }

.bl-aktion { display: flex; gap: var(--sp-4); margin-top: var(--sp-8); flex-wrap: wrap; }
.bl-btn {
  display: inline-flex; align-items: center; gap: 9px; padding: 14px var(--sp-8);
  border-radius: 999px; border: 1.5px solid var(--navy); background: var(--white);
  color: var(--navy); font: inherit; font-weight: 700; font-size: 0.98rem; cursor: pointer;
  transition: background .18s ease, color .18s ease;
}
.bl-btn .ic { width: 17px; height: 17px; }
.bl-btn:hover { background: var(--navy); color: #fff; }
.bl-btn.voll { background: var(--navy); color: #fff; }
.bl-btn.voll:hover { background: #1B1466; }

.bl-fehler { background: var(--white); border-radius: var(--radius-lg); padding: var(--sp-12); text-align: center; color: var(--text-muted); }
.bl-fehler h2 { color: var(--navy); margin: 0 0 var(--sp-4); }

@media (max-width: 780px) {
  .bl-page { padding: var(--sp-6) var(--sp-4) var(--sp-12); }
  .bl-blatt { padding: var(--sp-6); border-radius: var(--radius); }
  .bl-kopf { flex-direction: column; gap: var(--sp-5); }
  .bl-titel { text-align: left; }
  .bl-adressen { grid-template-columns: 1fr; gap: var(--sp-6); }
  .bl-zt-grid { grid-template-columns: 1fr; gap: var(--sp-6); }
  .bl-qr { width: 210px; }
  .bl-summe-box { min-width: 0; width: 100%; }
  .bl-aktion .bl-btn { flex: 1; justify-content: center; }
}

/* ---------- Druck: sauberes A4-Blatt ---------- */
@media print {
  @page { size: A4; margin: 14mm; }
  body { background: #fff; }
  .site-header, .site-footer, .bl-aktion, .bl-zurueck, .menu-toggle { display: none !important; }
  .bl-page { background: #fff; padding: 0; min-height: 0; }
  .bl-wrap { max-width: none; }
  .bl-blatt { box-shadow: none; border-radius: 0; padding: 0; }
  .bl-zahlteil { break-inside: avoid; page-break-inside: avoid; }
  .bl-tab tr { break-inside: avoid; }
  a { text-decoration: none; color: inherit; }
}

/* ============================================================
   Bestellhistorie
   ============================================================ */
.bh-liste { display: grid; gap: var(--sp-4); }

.bh-zeile {
  display: grid; grid-template-columns: 52px minmax(0, 1fr) auto auto;
  gap: var(--sp-5); align-items: center;
  background: var(--white); border: 1px solid var(--line); border-radius: 18px;
  padding: var(--sp-5) var(--sp-6); text-align: left; width: 100%;
  font: inherit; color: inherit; cursor: pointer;
  transition: border-color .2s ease, transform .2s cubic-bezier(.34,1.3,.5,1), box-shadow .2s ease;
}
.bh-zeile:hover { border-color: rgba(19,13,76,.32); transform: translateY(-2px); box-shadow: 0 16px 34px -26px rgba(19,13,76,.5); }
.bh-zeile:focus-visible { outline: 3px solid rgba(19,13,76,.25); outline-offset: 2px; }

.bh-bild {
  width: 52px; height: 52px; border-radius: 15px; display: grid; place-items: center;
  background: var(--navy); color: #fff; font-weight: 800; font-size: 0.95rem;
}
.bh-text b { display: block; color: var(--navy); font-size: 1.02rem; font-weight: 700; margin-bottom: 4px; }
.bh-text span { font-size: 0.86rem; color: var(--text-muted); }
.bh-text .nr { font-family: ui-monospace, 'SF Mono', Menlo, monospace; font-size: 0.8rem; }
.bh-betrag { font-weight: 800; color: var(--navy); font-variant-numeric: tabular-nums; white-space: nowrap; }
.bh-pfeil { color: var(--text-faint); display: flex; }
.bh-pfeil .ic { width: 18px; height: 18px; }
.bh-zeile:hover .bh-pfeil { color: var(--navy); }

.bh-status {
  display: inline-flex; align-items: center; gap: 6px; margin-top: 7px;
  padding: 3px 10px; border-radius: 999px; font-size: 0.7rem; font-weight: 800;
  letter-spacing: .07em; text-transform: uppercase;
}
.bh-status .ic { width: 12px; height: 12px; }
.bh-status.bezahlt { background: rgba(46,158,91,.13); color: #1F7A45; }
.bh-status.offen   { background: rgba(219,154,83,.18); color: var(--brown); }
.bh-status.storniert, .bh-status.fehlgeschlagen { background: rgba(232,112,95,.14); color: var(--danger); }

.bh-leer { text-align: center; padding: var(--sp-16) var(--sp-6); background: var(--white); border: 1px solid var(--line); border-radius: 18px; }
.bh-leer .ic-gross { width: 46px; height: 46px; margin: 0 auto var(--sp-5); color: var(--text-faint); }
.bh-leer .ic-gross .ic { width: 100%; height: 100%; stroke-width: 1.3; }
.bh-leer h3 { color: var(--navy); margin: 0 0 var(--sp-3); font-size: 1.1rem; }
.bh-leer p { color: var(--text-muted); margin: 0 auto var(--sp-6); max-width: 40ch; line-height: 1.7; }

@media (max-width: 640px) {
  .bh-zeile { grid-template-columns: 44px minmax(0, 1fr) auto; gap: var(--sp-4); padding: var(--sp-5); }
  .bh-bild { width: 44px; height: 44px; border-radius: 13px; font-size: 0.85rem; }
  .bh-pfeil { display: none; }
}
