:root {
  /* Primärfarbe: Blau. Grün nur als Akzent (Erfolg, Preise, Badges). */
  --dk-blue: #0f4fa9;
  --dk-blue-dark: #093068;
  --dk-blue-light: #e2e9f4;
  --dk-green: #2e7d32;
  --dk-green-dark: #1b5e20;
  --dk-green-light: #e8f3e9;
  --dk-ink: #1c2530;
  --dk-shadow: 0 6px 16px -6px rgba(13, 71, 161, .30);
}

html {
  height: 100%;
}
body {
  background: #f4f6f4;
  color: var(--dk-ink);
  height: 100%;
  min-height: 100%;
  margin: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ---- Header / Nav (oben fixiert) ---- */
.app-header {
  flex: 0 0 auto;
  position: sticky;
  top: 0;
  z-index: 1030;
  background: linear-gradient(135deg, var(--dk-blue), var(--dk-blue-dark));
  color: #fff;
  box-shadow: 0 4px 14px -6px rgba(0, 0, 0, .4);
}
.brand { color: #fff; }
.brand-text { display: flex; flex-direction: column; line-height: 1.05; font-weight: 700; }
.brand-text small { font-weight: 400; font-size: .68rem; opacity: .85; }
.user-badge { font-size: .9rem; opacity: .95; }

.app-nav { background: rgba(0, 0, 0, .12); }
.nav-pill {
  color: rgba(255, 255, 255, .85);
  text-decoration: none;
  padding: .35rem .9rem;
  border-radius: 999px;
  font-size: .92rem;
  font-weight: 600;
  transition: background .15s ease;
}
.nav-pill:hover { background: rgba(255, 255, 255, .15); color: #fff; }
.nav-pill.active { background: #fff; color: var(--dk-blue-dark); }

/* ---- Cards ---- */
.card {
  border: none;
  border-radius: 14px;
  box-shadow: var(--dk-shadow);
}
.login-card { border-top: 4px solid var(--dk-blue); }
.login-logo { max-height: 66px; width: auto; }
.login-row { margin-top: .5rem; }

/* "Noch kein Kunde?" – auffälliger, bebildeter Aufruf */
.intro-card {
  border: none;
  background: linear-gradient(150deg, var(--dk-blue), var(--dk-blue-dark));
  overflow: hidden;
}
.intro-img {
  width: 100%; height: 190px; object-fit: contain;
  background: #fff; padding: .5rem;
}
.intro-list { padding-left: 1.1rem; }
.intro-list li { margin-bottom: .3rem; }
.intro-card .btn-light { color: var(--dk-blue-dark); }

.plan-card { transition: transform .12s ease, box-shadow .12s ease; }
.plan-card:hover { transform: translateY(-3px); box-shadow: 0 12px 24px -10px rgba(13, 71, 161, .40); }
.plan-closed { opacity: .7; }
.plan-menu dt { font-size: .72rem; text-transform: uppercase; letter-spacing: .03em; color: var(--dk-blue); font-weight: 700; margin-top: .4rem; }
.plan-menu dd { margin: 0 0 .2rem; }

/* ---- Order items (responsive list, no table) ---- */
.order-card-body { padding: .35rem 1rem 1rem; }
.order-items {
  display: flex;
  flex-direction: column;
}
.order-item {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .65rem 1rem;
  padding: .9rem 0;
  border-bottom: 1px solid #e4e9e5;
}
.order-item:last-child { border-bottom: 0; padding-bottom: .25rem; }
.order-item-main {
  flex: 1 1 14rem;
  min-width: 0;
}
.order-item-meta {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: .75rem;
  flex: 0 0 auto;
  margin-left: auto;
}
.order-item-price {
  min-width: 4.5rem;
  text-align: right;
  font-weight: 600;
}
.qty-group {
  width: 8.5rem;
  flex: 0 0 8.5rem;
  flex-wrap: nowrap;
}
.qty-group > .btn,
.qty-group > .form-control {
  flex-shrink: 0;
}
.qty-input {
  max-width: 3rem;
  font-weight: 700;
  padding-left: .25rem;
  padding-right: .25rem;
}
.price { color: #55665c; white-space: nowrap; }
.order-dish-title { line-height: 1.3; }
.order-dish-label { color: #6b7d72; font-weight: 600; }
.order-dish-name { font-size: 1.05rem; font-weight: 700; color: var(--dk-ink); }
.order-dish-allerg {
  margin-top: .2rem;
  font-size: .8rem;
  color: #6b7d72;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: .35rem .5rem;
}
.allerg-plain { color: #6b7d72; }

.order-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
}
.order-footer-delivery { flex: 1 1 12rem; min-width: 0; }
.order-footer-total { flex: 0 0 auto; }
.total-box {
  display: inline-flex; align-items: baseline; gap: .6rem;
  background: var(--dk-blue-light); padding: .6rem 1.1rem; border-radius: 12px;
}
.total-amount { font-size: 1.6rem; font-weight: 800; color: var(--dk-green-dark); }

.order-actions {
  display: flex;
  gap: .65rem;
  margin-top: 1.25rem;
}
.order-actions .btn-outline-secondary { flex: 0 0 auto; }
.order-actions .btn-success { flex: 1 1 auto; }

@media (max-width: 575px) {
  .order-card-body { padding: .15rem .85rem .85rem; }
  .order-item {
    flex-direction: column;
    align-items: stretch;
    gap: .55rem;
    padding: 1rem 0;
  }
  .order-item-meta {
    width: 100%;
    margin-left: 0;
    justify-content: space-between;
  }
  .order-item-price {
    min-width: 0;
    text-align: left;
  }
  .qty-group {
    width: 9.25rem;
    flex-basis: 9.25rem;
  }
  .order-footer {
    flex-direction: column;
    align-items: stretch;
  }
  .order-footer-total .total-box {
    display: flex;
    width: 100%;
    justify-content: space-between;
  }
  .order-actions {
    flex-direction: column-reverse;
  }
  .order-actions .btn {
    width: 100%;
  }
}

.order-summary .q { display: inline-block; min-width: 2.2rem; font-weight: 700; color: var(--dk-green-dark); }

/* ---- Tables / misc ---- */
.th-link { color: inherit; text-decoration: none; }
.th-link:hover { color: var(--dk-green); }
.row-inactive { opacity: .5; text-decoration: line-through; }

/* Primäre CTAs sind blau. Die Vorlagen nutzen durchgängig .btn-success als
   Haupt-Aktionsknopf – daher hier zentral auf Blau umgefärbt. */
.btn-success {
  --bs-btn-bg: var(--dk-blue); --bs-btn-border-color: var(--dk-blue);
  --bs-btn-hover-bg: var(--dk-blue-dark); --bs-btn-hover-border-color: var(--dk-blue-dark);
  --bs-btn-active-bg: var(--dk-blue-dark); --bs-btn-active-border-color: var(--dk-blue-dark);
}
.btn-primary {
  --bs-btn-bg: var(--dk-blue); --bs-btn-border-color: var(--dk-blue);
  --bs-btn-hover-bg: var(--dk-blue-dark); --bs-btn-hover-border-color: var(--dk-blue-dark);
}
/* Grün als Akzent: Outline-Buttons, Erfolgs-Badges, Preise */
.btn-outline-success {
  --bs-btn-color: var(--dk-green-dark); --bs-btn-border-color: var(--dk-green);
  --bs-btn-hover-bg: var(--dk-green); --bs-btn-hover-border-color: var(--dk-green);
}
.text-bg-success { background-color: var(--dk-green) !important; }
.text-success { color: var(--dk-green-dark) !important; }
a { color: var(--dk-blue-dark); }
a:hover { color: var(--dk-blue); }

/* ---- Lieferlisten ---- */
.section-title { border-bottom: 2px solid var(--dk-blue-light); padding-bottom: .3rem; margin-bottom: 1rem; }
.tour-heading { background: var(--dk-blue-light); color: var(--dk-blue-dark); padding: .3rem .7rem; border-radius: 8px; display: inline-block; margin-bottom: .6rem; }
.delivery-table td { vertical-align: top; }
.pos-badge { display: inline-block; background: #f0f4f1; border: 1px solid #dde7e0; border-radius: 6px; padding: .1rem .5rem; margin: 0 .25rem .25rem 0; font-size: .85rem; white-space: nowrap; }
.pos-badge .q { font-weight: 700; color: var(--dk-green-dark); }

/* ---- Faktura ---- */
.billing-group { margin-bottom: 1.5rem; }
.billing-table .num { width: 46px; }
.billing-summary { margin-top: 2rem; }

/* ---- Inhaltsseiten / Allergene ---- */
.content-page { max-width: 900px; }
.info-hero {
  display: flex; align-items: center; gap: 1.2rem; flex-wrap: wrap;
  background: linear-gradient(150deg, var(--dk-blue), var(--dk-blue-dark));
  color: #fff; border-radius: 14px; padding: 1rem 1.4rem; box-shadow: var(--dk-shadow);
}
.info-hero img { height: 130px; width: auto; background: #fff; border-radius: 10px; padding: .3rem; }
.info-hero-text { flex: 1; min-width: 220px; }
.option-card { overflow: hidden; }
.option-img { width: 100%; height: 170px; object-fit: cover; }
.content-page li { margin-bottom: .2rem; }
.allerg-list li { padding: .15rem 0; border-bottom: 1px solid #eef2ef; }
.allerg-list b { display: inline-block; min-width: 2.2rem; color: var(--dk-green-dark); }
.allerg-cols { columns: 2; column-gap: 2rem; }
@media (max-width: 575px) { .allerg-cols { columns: 1; } }
.allerg-code { color: var(--dk-green-dark); font-size: .8em; font-weight: 600; }
.allerg-link { color: #7a8a80; font-size: .85em; text-decoration: none; }
.allerg-link:hover { color: var(--dk-green-dark); text-decoration: underline; }

/* Allergen-Hover-Popup bei Bestellung */
.allerg-tip {
  position: relative;
  display: inline-block;
  cursor: help;
  margin-left: .15rem;
}
.allerg-tip .allerg-code {
  border-bottom: 1px dotted var(--dk-green-dark);
}
.allerg-popup {
  display: none;
  position: absolute;
  left: 0;
  bottom: calc(100% + 6px);
  z-index: 40;
  min-width: 220px;
  max-width: 280px;
  padding: .55rem .7rem;
  background: #1c2530;
  color: #fff;
  border-radius: 10px;
  font-size: .78rem;
  line-height: 1.35;
  box-shadow: 0 10px 24px -10px rgba(0, 0, 0, .45);
  text-align: left;
  white-space: normal;
}
.allerg-popup::after {
  content: '';
  position: absolute;
  left: 1rem;
  top: 100%;
  border: 6px solid transparent;
  border-top-color: #1c2530;
}
.allerg-popup-title {
  display: block;
  font-weight: 700;
  margin-bottom: .35rem;
  color: #b8d4ff;
}
.allerg-popup-row {
  display: block;
  padding: .1rem 0;
}
.allerg-popup-row b {
  display: inline-block;
  min-width: 1.6rem;
  color: #9ee2a4;
}
.allerg-tip:hover .allerg-popup,
.allerg-tip:focus-within .allerg-popup {
  display: block;
}
@media (max-width: 575px) {
  .allerg-popup {
    left: auto;
    right: 0;
  }
  .allerg-popup::after {
    left: auto;
    right: 1rem;
  }
}

/* Hauptinhalt scrollt zwischen stabilem Header und Footer */
main.container {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

/* ---- Footer (unten fixiert) ---- */
.app-footer {
  flex: 0 0 auto;
  position: sticky;
  bottom: 0;
  z-index: 1020;
  margin-top: 0;
  background: #fff;
  border-top: 1px solid #e2e8e3;
  font-size: .85rem;
  color: #7a8a80;
  box-shadow: 0 -4px 12px -8px rgba(0, 0, 0, .18);
}
.footer-nav a { color: #7a8a80; text-decoration: none; }
.footer-nav a:hover { color: var(--dk-green-dark); text-decoration: underline; }

/* ---- Tablettkarten (Bildschirm) ---- */
.tray-stack { display: flex; flex-direction: column; gap: 0; }
.tray-card {
  border: 2px solid #1c2530;
  border-radius: 6px;
  padding: .45rem .65rem;
  background: #fff;
}
.tray-card-top {
  display: flex;
  flex-wrap: wrap;
  gap: .35rem 1rem;
  font-size: .85rem;
  margin-bottom: .2rem;
}
.tray-date { font-weight: 700; }
.tray-meta { font-weight: 600; color: #445; }
.tray-delivery {
  display: inline-block;
  font-weight: 800;
  font-size: 1rem;
  letter-spacing: .02em;
  padding: .12rem .55rem;
  border: 2px solid #1c2530;
  border-radius: 4px;
  background: #fff;
  text-transform: uppercase;
}
.tray-delivery-0 { background: #fff3cd; border-color: #b08900; color: #5c4500; } /* Einweg */
.tray-delivery-1 { background: #dbeafe; border-color: #1d4ed8; color: #1e3a8a; } /* Porzellan */
.tray-delivery-2 { background: #dcfce7; border-color: #15803d; color: #14532d; } /* Induktion */
.tray-customer { margin-bottom: .25rem; }
.tray-customer strong { display: block; font-size: 1.02rem; }
.tray-addr { display: block; font-size: .86rem; color: #556; }
.tray-dishes {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr;
  gap: .4rem;
  border-top: 2px solid #1c2530;
  padding-top: .35rem;
  margin-top: .15rem;
}
.tray-main { border-right: 2px solid #1c2530; padding-right: .4rem; }
.tray-kind { display: block; font-weight: 800; font-size: 1.05rem; }
.tray-name { display: block; font-size: .82rem; color: #333; }
.tray-side {
  font-weight: 700;
  font-size: .9rem;
  text-align: center;
  border-right: 2px solid #1c2530;
  padding: 0 .25rem;
}
.tray-side:last-child { border-right: none; }
/* Trennbereich zwischen Tabletts zum Abschneiden */
.tray-cut {
  height: 1.6rem;
  margin: .55rem 0 .65rem;
  border: none;
  background:
    repeating-linear-gradient(
      90deg,
      #8a9590 0 8px,
      transparent 8px 14px
    ) center / 100% 1px no-repeat;
  position: relative;
}
.tray-cut::before,
.tray-cut::after {
  content: '✂';
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  font-size: .75rem;
  color: #8a9590;
  line-height: 1;
}
.tray-cut::before { left: 0; }
.tray-cut::after { right: 0; }

/* ---- Druckansicht (Lieferlisten) ---- */
.print-only { display: none; }
.page-break { display: none; }

@media print {
  .app-header, .app-footer, .no-print, .btn { display: none !important; }
  .print-only { display: block !important; }

  /* Flex/Overflow verhindern Seitenumbrüche in Chrome/Safari – aufheben */
  html, body {
    background: #fff !important;
    display: block !important;
    height: auto !important;
    min-height: 0 !important;
    overflow: visible !important;
  }
  main.container,
  .print-area,
  .card,
  .table-responsive {
    display: block !important;
    margin: 0 !important;
    max-width: 100% !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
    overflow: visible !important;
    flex: none !important;
    min-height: 0 !important;
  }

  .card { box-shadow: none !important; border: 1px solid #ccc !important; border-radius: 0 !important; }
  .pos-badge { border: 1px solid #bbb; background: #fff !important; }
  tr { break-inside: avoid; page-break-inside: avoid; }

  /* Explizite Umbruch-Marken zwischen den Listen */
  .page-break {
    display: block !important;
    break-before: page;
    page-break-before: always;
    height: 0;
    margin: 0;
    border: 0;
    padding: 0;
  }

  /* Kompakte Tabletts, damit 6 inkl. Schnittlinien sicher auf eine A4-Seite passen */
  .print-sheet-tray h1.h4 { font-size: 1.1rem !important; margin-bottom: .15rem !important; }
  .print-sheet-tray > .d-flex { margin-bottom: .35rem !important; }
  .print-sheet-tray .text-muted { font-size: .8rem !important; }
  .print-sheet-tray .tray-card {
    break-inside: avoid;
    page-break-inside: avoid;
    padding: .28rem .5rem !important;
    border-width: 1.5px !important;
  }
  .print-sheet-tray .tray-card-top { font-size: .78rem !important; margin-bottom: .1rem !important; gap: .25rem .7rem !important; }
  .print-sheet-tray .tray-delivery {
    font-size: .9rem !important;
    padding: .08rem .45rem !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  .print-sheet-tray .tray-customer { margin-bottom: .15rem !important; }
  .print-sheet-tray .tray-customer strong { font-size: .95rem !important; }
  .print-sheet-tray .tray-addr { font-size: .78rem !important; }
  .print-sheet-tray .tray-dishes { padding-top: .2rem !important; margin-top: .1rem !important; gap: .25rem !important; }
  .print-sheet-tray .tray-kind { font-size: .95rem !important; }
  .print-sheet-tray .tray-name { font-size: .75rem !important; }
  .print-sheet-tray .tray-side { font-size: .8rem !important; }
  .tray-cut {
    display: block !important;
    height: .85rem;
    margin: .35rem 0 .4rem;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  .kitchen-day-block {
    break-inside: avoid;
    page-break-inside: avoid;
  }

  /* Einzelblatt-Druck: nur die gewählte Liste */
  body.print-one-sheet .print-sheet:not(.print-target),
  body.print-one-sheet .page-break { display: none !important; }
  body.print-one-sheet .print-sheet.print-target {
    break-before: auto !important;
    page-break-before: auto !important;
  }

  /* Faktura: eine Seite je Kunde (wie die alte faktura3-Druckliste) */
  .billing-group { page-break-after: always; }
  .billing-summary { page-break-before: always; }
}
