/* Redesign 2026, Runde 59 (2.124.0): Zahlungen mit einem Zustand, ruhiger Belegkopf am Handy, 56-px-Zeilen, Neuigkeiten-Zeitleiste, forced-colors.
   Copyright © Fabian Stamminger @ The Platform Group */
:root { --r57-row: 56px; }

/* R59-01: Primärknopf im Seitenkopf der Zahlungen, Grund direkt darunter */
html body #paymentsHead .pay-head-sepa { min-height: 44px; white-space: nowrap; }
html body #paymentsHead .pay-head-sepa[aria-disabled="true"] { background: #E8EAEF; color: #4A4F59; border-color: #D8DCE4; cursor: not-allowed; box-shadow: none; }
html body #paymentsHead .pay-flow-reason { display: block; margin-top: 12px; font-size: .875rem; color: #4A4F59; }
html body #paymentsHead .pay-flow-reason a { margin-left: 8px; }
html body .pay-empty--compact { max-width: none; }
html body .pay-empty--compact .btn-textlink { min-height: 44px; display: inline-flex; align-items: center; color: #0E1115; font-weight: 700; text-decoration: underline; background: none; border: 0; padding: 0; cursor: pointer; }
@media (max-width: 767px) { html body #paymentsHead .pay-head-actions { flex-wrap: wrap; } html body #paymentsHead .pay-head-sepa { width: 100%; } }

/* R59-01: gemeinsame Wizard-Shell. Die Fußleiste endet an der Kartenkante: links Zurück, rechts genau eine Primäraktion (Karte 960 px, schmale Karten und Hochladen 720 px) */
html body .sw .sw-foot, html body .uw .sw-foot, html body .uw .uw-foot { --sw-col: 960px; padding-left: max(16px, calc((100% - var(--sw-col)) / 2)); padding-right: max(16px, calc((100% - var(--sw-col)) / 2)); }
html body .sw:has(.sw-card.narrow) .sw-foot, html body .sw:has(.sw-foot-inner) .sw-foot, html body .uw .sw-foot, html body .uw .uw-foot { --sw-col: 720px; }
html body .uw .sw-foot > .sw-foot-inner { padding-left: 0; padding-right: 0; }
html body .sw-foot > .sw-main:last-child, html body .sw-foot > button:last-child:not(:first-child) { margin-left: auto; }

/* R59-02: Beleg-Kopf, einheitliche runde 44-px-Knöpfe */
html body #workQueueBell, html body #accountMenuBtn, html body #docDetailMore, html body .doc-review-nav .btn-icon-quick, html body .doc-review-nav .rv-keys-btn { width: 44px !important; height: 44px !important; min-width: 44px !important; min-height: 44px !important; border-radius: 999px !important; box-sizing: border-box; padding: 0; display: inline-flex; align-items: center; justify-content: center; }
html body #documentDetailModal .doc-page-back { border-radius: 999px !important; }
@media (max-width: 767px) {
  html body #documentDetailModal .doc-crumb { display: none; }
  html body #documentDetailModal .dph-row2 { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: nowrap; }
  html body #documentDetailModal .dph-row2 .doc-head-nr, html body #documentDetailModal .dph-row2 .doc-detail-badges, html body #documentDetailModal .dph-row2 .doc-head-stage:empty, html body #documentDetailModal .doc-review-nav .rv-keys-btn { display: none; }
  html body #documentDetailModal .doc-review-nav { margin-left: auto; display: flex; align-items: center; gap: 4px; }
  html body #documentDetailModal .doc-page-head { padding-top: 4px; padding-bottom: 4px; }
  /* Toast einzeilig, 8 px über der Fußleiste; der Inhaltsbereich endet über der Meldung, sie verdeckt nie ein Eingabefeld */
  html body #toastRegion .toast { padding: 4px 8px 4px 16px; flex-wrap: nowrap; }
  html body:has(#docDetailActionBar) #docPageBody { margin-bottom: calc(var(--toast-h, -40px) + 40px); }
  html body #toastRegion .toast .toast-text { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
  html body:has(#docDetailActionBar) #toastRegion, html body:has(#docDetailActionBar) .toast-region { bottom: calc(var(--doc-bar-h, 72px) + 8px + env(safe-area-inset-bottom, 0px)) !important; }
}
@media (min-width: 768px) {
  html body #toastRegion .toast { padding: 4px 8px 4px 16px; }
  html body:has(#docDetailActionBar) #docPageBody { margin-bottom: calc(var(--toast-h, -40px) + 40px); }
  html body:has(#docDetailActionBar) #toastRegion, html body:has(#docDetailActionBar) .toast-region { left: auto !important; right: 24px !important; transform: none !important; bottom: calc(var(--doc-bar-h, 72px) + 8px + env(safe-area-inset-bottom, 0px)) !important; }
}
/* Schrittbalken: kurze Beschriftung, nie ein Wortbruch */
html body .todo-step-label { overflow-wrap: normal; word-break: keep-all; hyphens: manual; white-space: nowrap; }

/* R59-03: Belegliste, ein Raster, 56-px-Zeilen, eine Stand-Pille */
@media (min-width: 1100px) {
  html body .documents-grid .doc-table:not(.has-co) .doc-thead, html body .documents-grid .doc-table:not(.has-co) .doc-row { grid-template-columns: minmax(0, 300px) 220px 200px 120px 180px minmax(0, 1fr) !important; }
  html body .documents-grid .doc-table:not(.has-co).no-status .doc-thead, html body .documents-grid .doc-table:not(.has-co).no-status .doc-row { grid-template-columns: minmax(0, 300px) 220px 200px 120px minmax(0, 1fr) !important; }
  html body .documents-grid .doc-table.has-co .doc-thead, html body .documents-grid .doc-table.has-co .doc-row { grid-template-columns: minmax(0, 300px) 220px minmax(0, 1fr) 200px 120px 180px 56px !important; }
  html body .documents-grid .doc-table.has-co.no-status .doc-thead, html body .documents-grid .doc-table.has-co.no-status .doc-row { grid-template-columns: minmax(0, 300px) 220px minmax(0, 1fr) 200px 120px 56px !important; }
  html body .documents-grid .doc-table .doc-row .dr-actcol { justify-self: end; }
  html body .documents-grid .doc-table .doc-row { height: 56px !important; min-height: 56px !important; max-height: 56px !important; }
}
html body .documents-grid .doc-row .dr-status, html body .documents-grid .doc-row .dr-stand { display: inline-flex; align-items: center; min-width: 0; }
html body .documents-grid .doc-row .dr-pill { align-self: center; }
.dr-pill-ok { background: #DCFCE7; color: #166534; }
html body .documents-grid .doc-row .dr-meta .dr-m2, html body .documents-grid .doc-row .dr-meta .dr-m2 * { font-size: max(12px, .75rem); }
@media (max-width: 767px) {
  html body .documents-grid .doc-row .dr-sel, html body .documents-grid .doc-row .dr-sel-box { min-width: 44px; min-height: 44px; }
  html body .documents-grid .doc-row .dr-status { white-space: nowrap; }
}

/* R59-04: Neuigkeiten, Auswahl "Springe zu" unter 1024 px, Zeitleiste und Tageskarten darüber */
.news-jump { display: flex; flex-direction: column; gap: 6px; margin: 0 0 16px; }
.news-jump a { display: none; }
.news-jump-label { font-weight: 700; font-size: .875rem; color: #0E1115; }
.news-jump-select { min-height: 44px; border: 1px solid #D8DCE4; border-radius: 12px; padding: 0 12px; background: #fff; color: #0E1115; font: inherit; max-width: 100%; box-sizing: border-box; }
html body #newsList .news-entry, html body #newsList .news-latest-banner { min-width: 0; }
html body #newsList .news-entry { padding-left: 16px; padding-right: 16px; }
html body #newsList .news-entry a, html body #newsList .news-latest-banner a, html body #newsList .news-index a { color: #0E1115; font-weight: 700; text-decoration: underline; text-underline-offset: 3px; display: inline-flex; align-items: center; min-height: 44px; }
html body #newsList .news-entry-versions { margin: 4px 0 0; font-size: .8125rem; color: #4A4F59; display: flex; flex-wrap: wrap; gap: 2px 12px; }
html body #newsList .news-entry-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; margin: 0 0 0 24px; padding: 0; }
html body #newsList .news-versions-more { flex: 1 0 100%; }
html body #newsList .news-versions-more summary { cursor: pointer; min-height: 44px; display: inline-flex; align-items: center; font-weight: 700; color: #0E1115; text-decoration: underline; text-underline-offset: 3px; }
html body #newsList .news-versions-more > span { display: block; padding: 2px 0; }
html body #newsList .news-version-head { text-transform: none; order: 0; flex: 1 0 100%; margin: 0; font-size: 1.125rem; font-weight: 900; }
html body #newsList .news-entry-versions { order: 1; flex: 1 1 auto; }
html body #newsList .news-entry-meta .news-entry-help { order: 2; }
html body #newsList .news-entry-versions time { font-weight: 700; color: #0E1115; }
html body #newsList .news-timeline-month { margin: 0 0 8px; }
html body #newsList .news-timeline-month > summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; font-weight: 800; font-size: .875rem; color: #0E1115; }
html body #newsList .news-timeline-month ul { list-style: none; margin: 0; padding: 0; }
html body #newsList .news-timeline-month li { display: flex; flex-direction: column; padding: 0; }
html body #newsList .news-timeline-month li > span { color: #4A4F59; font-size: .8125rem; margin-top: -8px; padding-bottom: 6px; }
html body #newsList .news-timeline-month a[aria-current="true"] { text-decoration-thickness: 3px; }
@media (max-width: 1023px) { html body #newsList > .news-index { display: none; } }
@media (min-width: 1024px) {
  html body .news-jump { display: none; }
  html body #newsList { display: grid; grid-template-columns: 260px minmax(0, 800px); column-gap: 32px; align-items: start; max-width: none; }
  html body #newsList > .news-index { display: block; grid-column: 1; grid-row: 1 / span 40; position: sticky; top: 16px; max-height: calc(100dvh - 32px); overflow-y: auto; background: #fff; border: 1px solid #D8DCE4; border-radius: 16px; padding: 12px 16px; }
  html body #newsList > .news-index ul::before, html body #newsList > .news-index li::before { display: none; }
  html body #newsList > .news-entry, html body #newsList > .news-day-block, html body #newsList > .news-older-all, html body #newsList > .news-latest-banner { grid-column: 2; max-width: 800px; width: 100%; margin-bottom: 16px; box-sizing: border-box; }
}
@media (min-width: 1600px) {
  html body #newsList { grid-template-columns: 260px repeat(2, minmax(0, 800px)); }
  html body #newsList > .news-entry, html body #newsList > .news-day-block { grid-column: auto; }
}
/* Footer: ein Satz, 32-px-Gutter wie der Seiteninhalt */
html body .app-footer { padding-left: 32px; padding-right: 32px; }
@media (max-width: 767px) { html body .app-footer { padding-left: 16px; padding-right: 16px; } }

/* R59-05: Windows-Kontrastmodus, Fokus und Ränder bleiben sichtbar */
@media (forced-colors: active) {
  :focus-visible { outline: 2px solid CanvasText !important; outline-offset: 2px; box-shadow: none !important; }
  .doc-card, .todo-card, .pay-flow, .state-box, .sw-card, .news-entry, .toast, .dr-pill, .badge, .ui-badge, .of-check-cell input, input, select, textarea, .btn-primary, .btn-secondary { border: 1px solid CanvasText; }
  .dr-pill, .badge, .ui-badge, .btn-primary { forced-color-adjust: auto; }
}

/* R59-01: ein Ausgang "Schließen" oben rechts, 44 x 44 */
html body .sw .sw-close, html body .uw .sw-close, html body .xw .sw-close, html body .ow .ow-close { min-width: 44px; min-height: 44px; }

/* R59-03: Zeilenkästchen 44 x 44, Mobilzeile in zwei Zeilen (Lieferant und Betrag oben; Nummer, Stand-Pille und Fälligkeit unten) */
html body .documents-grid .doc-table .doc-row .dr-sel { position: absolute; left: 0; top: 50%; bottom: auto; transform: translateY(-50%); width: 44px; height: 44px; min-width: 44px; min-height: 44px; display: flex; align-items: center; justify-content: center; }
@media (max-width: 767px) {
  html body .documents-grid .doc-table .doc-row.doc-card.doc-card { grid-template-columns: minmax(0, 1fr) auto auto !important; column-gap: 8px; min-height: 64px !important; }
  html body .documents-grid .doc-table .doc-row.doc-card.doc-card .dr-main { grid-column: 1 / span 2; grid-row: 1; }
  html body .documents-grid .doc-table .doc-row.doc-card.doc-card .dr-amount { grid-column: 3; grid-row: 1; }
  html body .documents-grid .doc-table .doc-row.doc-card.doc-card .dr-meta { grid-column: 1; grid-row: 2; }
  html body .documents-grid .doc-table .doc-row.doc-card.doc-card .dr-status { grid-column: 2; grid-row: 2; justify-self: end; white-space: nowrap; }
  html body .documents-grid .doc-table .doc-row.doc-card.doc-card .dr-due { grid-column: 3; grid-row: 2; white-space: nowrap; text-align: right; }
}

/* R59-05 (D-2744): Einstellungen 390 ohne Überstand, Tabellen in den Panels brechen um statt breiter zu werden */
@media (max-width: 767px) {
  html body .settings-panel table, html body #vendorDepartmentAssignments table { width: 100% !important; min-width: 0 !important; table-layout: auto; }
  html body .settings-panel table th, html body .settings-panel table td, html body #vendorDepartmentAssignments table th, html body #vendorDepartmentAssignments table td { white-space: normal !important; overflow-wrap: anywhere; padding-left: 6px; padding-right: 6px; min-width: 0; }
  html body .settings-panel, html body .settings-card { min-width: 0; max-width: 100%; }
}
