/* Redesign 2026, Runde 19 (2.81.0) */
:root {
  color-scheme: light;
  --text-muted: #565C67;      /* Sekundärtext und Chip-Text, 6,0:1 auf #F5F6F8 */
  --icon-muted: #6B717C;      /* nur Icons und Ränder */
  --page-gutter: 32px;
}
@media (max-width: 767px) { :root { --page-gutter: 16px; } }

/* R19-05 und R19-04: Freigabedialog als Sheet, Körper scrollt, Aktionszeile bleibt sichtbar */
.ac-overlay { padding: 8px; }
.ac-card { display: flex; flex-direction: column; max-height: calc(100dvh - 16px); overflow: hidden; padding-bottom: 0; }
.ac-card .ac-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding-bottom: .5rem; }
.ac-card .ac-actions { position: sticky; bottom: 0; flex: 0 0 auto; margin: 0 -1.25rem; padding: .75rem 1.25rem calc(.75rem + env(safe-area-inset-bottom, 0px)); background: #fff; border-top: 1px solid var(--orlop-line, #D8DCE4); }
.ac-blocklist { margin-top: .85rem; padding: .65rem .85rem; border: 1px solid #FCA5A5; background: #FEF2F2; border-radius: 12px; color: #7F1D1D; font-size: .875rem; }
.ac-blocklist ul { list-style: none; margin: .4rem 0 0; padding: 0; display: grid; gap: .4rem; }
.ac-blocklist li { display: flex; flex-wrap: wrap; gap: .25rem .5rem; align-items: baseline; }
.ac-blocklist li small { flex-basis: 100%; color: #7F1D1D; font-size: .8125rem; margin-left: 1rem; }
.ac-flag label { display: flex; gap: .6rem; align-items: flex-start; cursor: pointer; min-height: 24px; }
.ac-flag input[type="checkbox"] { width: 20px; height: 20px; margin: 1px 0 0; flex: 0 0 auto; accent-color: #0E1115; }
@media (max-width: 479px) {
  .ac-overlay { align-items: flex-end; padding: 0; }
  .ac-card { max-height: calc(100dvh - 16px); }
}
@media (max-height: 480px) and (orientation: landscape) {
  .ac-overlay { align-items: center; }
  .ac-card { max-height: calc(100dvh - 16px); border-radius: 14px !important; }
  .ac-card .ac-list { grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 1rem; }
}

/* R19-04: Touch und Mobil */
@media (max-width: 479px) {
  .page-head-actions { width: 100%; display: flex; }
  .page-head-actions > .btn-primary, .page-head-actions > .tp-btn-primary, .page-head-actions > a.btn-primary { flex: 1 1 100%; width: 100%; justify-content: center; min-height: 44px; }
  .btn-icon, .btn-icon-quick, .ph-icon-btn, .page-head-actions .btn-icon { min-width: 44px; min-height: 44px; width: 44px; height: 44px; }
  .app-footer { display: grid; grid-template-columns: 1fr; gap: 0; }
  .app-footer-links { display: flex; flex-wrap: wrap; gap: 0 .75rem; }
  .app-footer a { min-height: 44px; display: inline-flex; align-items: center; }
}
.doc-input-suffix:focus-within { box-shadow: var(--focus-shadow); }

/* R19-04: Bewegung reduzieren, ganz am Ende der Kaskade */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}

/* R19-02: Dashboard, ein Leerzustand */
.dash-first-card { background: #fff; border: 1px solid var(--orlop-line, #D8DCE4); border-radius: 18px; box-shadow: 0 1px 2px rgba(14,17,21,.06), 0 8px 24px rgba(14,17,21,.05); padding: 1.5rem; margin: 0 0 1rem; display: grid; gap: .6rem; justify-items: start; }
.dash-first-card[hidden] { display: none; }
.dash-first-card p { margin: 0; color: var(--text-muted); max-width: 60ch; }
.dashboard-empty .dash-columns, .dashboard-empty .upload-section, .dashboard-empty #dashZeroLine { display: none !important; }
#dashStrip[hidden] { display: none !important; }
@media (max-width: 479px) {
  #tabDashboard #dashStrip { grid-template-columns: repeat(var(--tile-cols, 2), minmax(0, 1fr)) !important; gap: 8px; }
  #dashStrip .step-tile { padding: .75rem .6rem; min-width: 0; }
  #dashStrip .step-tile .stat-chevron { display: none; }
  #dashStrip .step-tile .stat-value { font-size: 1.5rem; }
  #dashStrip .step-tile .stat-label, #dashStrip .step-tile .stat-sub { font-size: .75rem; overflow-wrap: anywhere; }
}

/* R19-03: Belegliste, Raster und Fehlt-Chip */
@media (min-width: 1280px) {
  .documents-grid .doc-table .doc-thead, .documents-grid .doc-table .doc-row { grid-template-columns: minmax(240px, 1.6fr) minmax(160px, 190px) minmax(130px, 150px) minmax(130px, 170px) minmax(130px, 170px) minmax(180px, 220px) 120px; column-gap: 24px; }
  .documents-grid .doc-table.has-co .doc-thead, .documents-grid .doc-table.has-co .doc-row { grid-template-columns: minmax(240px, 1.6fr) minmax(160px, 190px) minmax(0, 1fr) minmax(130px, 150px) minmax(130px, 170px) minmax(130px, 170px) minmax(180px, 220px) 120px; column-gap: 24px; }
}
.dr-missing { color: var(--text-muted); font-weight: 400; }
.docs-incomplete-row { display: flex; align-items: center; gap: .75rem; padding: .5rem .25rem; margin: 0 0 .5rem; color: #78350F; font-size: .875rem; font-weight: 600; }
.docs-incomplete-row .btn-textlink { min-height: 44px; }

/* R19-03: ein Badge-Baustein, Text >= 4,5:1 (Statusfarben in Liste, Detail, Dashboard, Zahlungen gleich) */
.badge.ui-badge--neutral { background: #E7EAF0; color: #2B3038; }
.badge.ui-badge--waiting { background: #DBE6FB; color: #1E3A8A; }
.badge.ui-badge--success { background: #D1FAE5; color: #065F46; }
.badge.ui-badge--danger { background: #FEE2E2; color: #7F1D1D; }
.badge.ui-badge--amber { background: #FEF3C7; color: #78350F; }
.badge.ui-badge .fas { margin-right: .15rem; }

/* R19-01: Belegseite als Seite, drei Karten, Rand 32/16, ruhige Fußleiste */
#documentDetailModal .doc-page-head { padding-left: var(--page-gutter); padding-right: var(--page-gutter); }
@media (max-width: 767px) { #documentDetailModal .doc-page-head { padding-left: .5rem; padding-right: 9rem; } #documentDetailModal .doc-page-head .doc-detail-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; } }
#documentDetailModal .doc-detail-actionbar { padding-left: var(--page-gutter); padding-right: var(--page-gutter); position: sticky; bottom: 0; z-index: 5; }
.doc-page-head .doc-detail-title { margin: 0; font-size: 1.25rem; font-weight: 900; letter-spacing: -0.02em; }
.dp-card-title { margin: 0; padding: .9rem 16px .25rem; font-size: .9375rem; font-weight: 800; }
.dp-card > summary { padding-left: 16px; padding-right: 16px; }
.dp-card .dp-card-body { padding: 0 16px 16px; }
.dp-card .dp-card-body[hidden] { display: none; }
.dp-tabs { display: flex; gap: .25rem; padding: 0 16px; margin: .25rem 0 .75rem; border-bottom: 1px solid var(--orlop-line, #D8DCE4); overflow-x: auto; }
.dp-tabs .ph-tab { min-height: 44px; }
.doc-section-title { margin: 0 0 .5rem; font-size: .9375rem; font-weight: 800; }
#documentDetailForm .doc-field :is(input:not([type="checkbox"]):not([type="radio"]), select, textarea) { width: 100%; box-sizing: border-box; }
#documentDetailModal .doc-scroll-list { max-height: none !important; overflow: visible; }
.doc-detail-panel .doc-detail-body { max-width: none; }

.af-chain { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; }
.af-chain-row { display: grid; grid-template-columns: 1.25rem minmax(0, 1fr) auto; column-gap: .5rem; row-gap: .1rem; padding: .6rem 0; border-top: 1px solid var(--orlop-line, #D8DCE4); font-size: .9375rem; }
.af-chain-row:first-child { border-top: 0; }
.af-chain-row .af-icon { grid-row: 1 / span 2; text-align: center; color: var(--text-muted); }
.af-chain-row.is-done .af-icon { color: #047857; }
.af-chain-row.is-you .af-icon { color: #0E1115; }
.af-chain-row .af-step { font-weight: 700; }
.af-chain-row .af-who { grid-column: 2; color: var(--text-muted); overflow-wrap: anywhere; }
.af-chain-row .af-state { grid-column: 3; grid-row: 1 / span 2; align-self: center; font-size: .8125rem; font-weight: 700; color: var(--text-muted); text-align: right; }
.af-chain-row.is-you .af-state { color: #0E1115; }
.af-chain-row .af-note { grid-column: 2 / span 2; font-size: .8125rem; color: var(--text-muted); }
.af-none { margin: 0; color: var(--text-muted); }

/* Ghost-Knöpfe: Später prüfen, Abweisen */
.doc-reject-btn, .doc-review-later { background: transparent; border: 0; text-decoration: none; min-height: 44px; padding: .5rem .9rem; border-radius: 999px; font-weight: 700; cursor: pointer; }
.doc-reject-btn:hover { background: #FEE2E2; color: #7F1D1D; }
.doc-review-later { color: var(--orlop-ink, #0E1115); }
.doc-review-later:hover { background: #E7EAF0; }
.doc-page-sub #docHeadStatus { white-space: normal; max-width: 100%; overflow: visible; text-overflow: clip; }

@media (min-width: 1024px) {
  .doc-page-body { overflow-y: auto; align-items: start; grid-auto-rows: max-content; align-content: start; }
  .doc-page-body .doc-detail-preview { position: sticky; top: 0; align-self: start; height: calc(100dvh - 72px - var(--doc-bar-h, 72px)); }
  .doc-page-body .doc-detail-panel { display: block; overflow: visible; align-self: stretch; height: auto; min-height: 0; padding-bottom: 24px; }
  .doc-page-body .doc-detail-panel .doc-detail-body { padding: 1.25rem var(--page-gutter) 1.25rem 1.25rem; }
}
#documentDetailForm #detail-dueDate { max-width: none; width: 100%; }

/* R19-06: Neuigkeiten, zweispaltig 2fr/1fr bis zum rechten Rand, Akzentbalken in der Karte */
#newsList .news-entry, #newsList .news-entry-body { max-width: none; }
.news-entry-body { position: relative; overflow: hidden; border-left: 1px solid var(--orlop-line, #D8DCE4); padding-left: calc(1.5rem + 4px); }
.news-entry-body::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--orlop-dark, #0E1115); }
.news-entry-body li { margin: 12px 0; }
.news-entry-body li.news-li-plain { margin-top: 20px; padding-top: 12px; border-top: 1px solid var(--orlop-line, #D8DCE4); color: var(--text-muted); font-size: .8125rem; }
@media (min-width: 1024px) {
  #newsList { display: grid; grid-template-columns: minmax(0, 2fr) minmax(14rem, 1fr); column-gap: 2rem; align-items: start; }
  #newsList > .news-entry { grid-column: 1; margin-bottom: 1rem; }
  #newsList > .news-index { display: block; grid-column: 2; grid-row: 1 / span 40; position: sticky; top: 1rem; padding: 1rem; background: #fff; border: 1px solid var(--orlop-line, #D8DCE4); border-radius: 14px; }
}
@media (min-width: 1280px) {
  .documents-grid .doc-table .dr-amount:has(.dr-missing) { justify-self: start; text-align: left; padding-left: 36px; }
}
.oi-head h1.page-title { margin: 0; font-size: 1.5rem; font-weight: 900; letter-spacing: -0.02em; }
