/* Redesign 2026, Runde 17 (2.79.0) */

/* R17-03: Badge-Baustein mit fuenf Zustaenden, Kontrast mindestens 4,5:1, Punkt in Textfarbe */
.badge.ui-badge { display: inline-flex; align-items: center; border-radius: 9999px; font-weight: 700; }
.badge.ui-badge::before, .doc-row .badge.ui-badge::before { content: ""; display: inline-block; flex: none; width: .5rem; height: .5rem; margin-right: .4rem; border-radius: 50%; background: currentColor; }
.badge.ui-badge--neutral { background: #E7EAF0; color: #333840; }
.badge.ui-badge--waiting { background: #DDE4F3; color: #1E3A8A; }
.badge.ui-badge--success { background: #D1FAE5; color: #065F46; }
.badge.ui-badge--danger { background: #FEE2E2; color: #991B1B; }
.badge.ui-badge--amber { background: #FEF3C7; color: #78350F; }

/* R17-03: Belegliste Desktop, festes Spaltenraster bis zum rechten Rand */
.dr-chev { color: var(--orlop-text-2, #5B616B); font-size: .8125rem; }
.dr-arrow.is-idle { opacity: .35; }
.dr-actcol { display: flex; align-items: center; justify-content: flex-end; gap: .5rem; min-width: 0; }
.dr-actcol .dr-act { margin-left: 0; }
.dr-inv { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--orlop-text-2, #5B616B); font-variant-numeric: tabular-nums; }
.documents-grid .doc-row .dr-sub { display: none; }
/* R53-01: Listen-Umbruch bei 1100 px */
@media (min-width: 1100px) {
  .documents-grid .doc-table .doc-thead, .documents-grid .doc-table .doc-row { grid-template-columns: minmax(0, 1fr) 120px 120px 130px 150px 110px; gap: 0 1rem; }
  .documents-grid .doc-table .dr-inv, .documents-grid .doc-table .dr-co { display: none; }
  .documents-grid .doc-table .doc-row .dr-status { padding-right: 0; }
}
@media (min-width: 1280px) {
  .documents-grid .doc-table .doc-thead, .documents-grid .doc-table .doc-row { grid-template-columns: minmax(240px, 1fr) 170px 130px 130px 140px 170px 120px; }
  .documents-grid .doc-table .dr-inv { display: block; }
  .documents-grid .doc-table .doc-thead .dr-inv { display: flex; align-items: center; }
  .documents-grid .doc-table.has-co .doc-thead, .documents-grid .doc-table.has-co .doc-row { grid-template-columns: minmax(240px, 1.4fr) 170px minmax(0, 1fr) 130px 130px 140px 170px 120px; }
  .documents-grid .doc-table.has-co .dr-co { display: block; }
}

/* R17-01: Belegliste mobil, nichts ueberlappt */
/* R53-01: Listen-Umbruch bei 1100 px */
@media (max-width: 1099px) {
  .documents-grid .doc-row { max-height: none; height: auto; row-gap: .5rem; }
  .doc-thead { display: none; }
  .doc-row .dr-inv { display: none; }
  .documents-grid .doc-row .dr-vendor { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; white-space: normal; overflow: hidden; overflow-wrap: anywhere; }
  .documents-grid .doc-row .dr-status .badge, .documents-grid .doc-row .dr-status .dr-progress { min-width: 0; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: inline-block; }
  .documents-grid .doc-row .dr-status { max-width: 100%; }
  .documents-grid .doc-row:has(.dr-due.is-overdue) { grid-template-areas: "main amount" "status status" "due due"; }
  .documents-grid .doc-row .dr-due.is-overdue { font-size: .875rem; color: #B91C1C; }
}
.dash-overdue-text { color: #B91C1C; font-size: .875rem; font-weight: 700; }

/* R17-02: Vorschau-Leerzustand mittig, Fussleiste ruhig */
.has-no-preview { display: flex; align-items: center; justify-content: center; min-height: 320px; height: 100%; }
.preview-empty-actions { display: flex; flex-wrap: wrap; gap: .75rem; justify-content: center; align-items: center; margin-top: .75rem; }
.doc-auto-assigned strong { font-weight: 700; }
.doc-detected-chip { max-width: 100%; }
.doc-detail-actionbar { min-height: 72px; align-items: center; }
.doc-detail-actionbar .doc-bar-left { min-width: 0; align-items: center; }
.doc-detail-actionbar .doc-save-state { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.doc-detail-actionbar .doc-bar-right { align-items: center; }

/* R17-05: Dashboard im Fehlerfall, drei ruhige Platzhalter ohne Bewegung */
.dash-error .step-tile:nth-child(n+4) { display: none !important; }
.dash-error .step-tile, .dash-error .step-tile * { cursor: default; }
.dash-error .step-tile::after { animation: none !important; background: #E7EAF0; }

/* R17-05: Beleg-Fehlerseite mittig */
#docLoadError.beleg-error-page { text-align: center; display: flex; flex-direction: column; align-items: center; }
#docLoadError .beleg-error-actions { justify-content: center; }
#docLoadError .beleg-error-icon { font-size: 2.5rem; color: var(--orlop-primary, #6B717C); margin-bottom: .75rem; }

/* R17-05: Abweisen-Schublade, gesperrter Knopf neutral grau, aktiv rot gefuellt */
.beleg-drawer button[disabled], [data-docact-submit][disabled], [data-docact-submit][aria-disabled="true"] { background: #E7EAF0 !important; color: var(--orlop-muted-text, #565C67) !important; border-color: #E7EAF0 !important; cursor: not-allowed; opacity: 1 !important; }

/* R17-06: Mobile Fusszeile ueber der Tableiste, Links 44 px */
:root { --mshell-tab-h: 64px; }
@media (max-width: 767px) {
  .app-footer { padding-bottom: calc(var(--mshell-tab-h) + env(safe-area-inset-bottom, 0px) + 1rem); }
}
.app-footer a { display: inline-flex; align-items: center; min-height: 44px; }

/* R17-07: Hilfe und Neuigkeiten, Zeilenbreite */
.help-content > *, .help-article > *, .help-body > * { max-width: 72ch; }
.news-item-text, .news-entry-body li { max-width: 72ch; }
.news-item { align-items: baseline; }

/* R17-06: natives Datumsfeld am Handy */
.tp-dateinput--native { min-height: 44px; font: inherit; }
.tp-datetime-pair { display: flex; gap: 8px; align-items: stretch; }
.tp-datetime-pair .tp-dateinput { flex: 1 1 auto; min-width: 0; }
.tp-datetime-pair .tp-timeinput { flex: 0 0 112px; }

/* R17-02: Sperrgrund als eine Zeile links vom Knopf, Abweisen neutral */
@media (min-width: 768px) {
  .doc-detail-actionbar .doc-approve-wrap { flex-direction: row-reverse; align-items: center; gap: .75rem; }
  .doc-detail-actionbar .doc-approve-step { font-size: .875rem; text-align: right; max-width: none; white-space: nowrap; display: inline-flex; align-items: center; gap: .35rem; flex-wrap: nowrap; }
  .doc-detail-actionbar .doc-approve-step .doc-missing-chip { min-height: 32px; padding-block: 0; }
}
.doc-reject-btn, .doc-bar-right .doc-reject-btn.beleg-reject { color: var(--orlop-ink, #0E1115); }
