/* P4 · Umsetzung der freigegebenen Belegarten-Mockups auf den P0-Tokens. */
.p4-types .pill, .p4-setup .pill { min-height: 26px; padding: 0 9px; }
.p4-types .page-head { align-items: center; }
.p4-type-list { overflow: hidden; }
.p4-type-row { display: grid; grid-template-columns: 28px minmax(180px,1fr) auto auto 16px; align-items: center; gap: 20px; min-height: 88px; padding: 16px 20px; color: var(--ink); text-decoration: none; border-bottom: 1px solid var(--line); }
.p4-type-row:last-child { border-bottom: 0; }
.p4-type-row:hover { background: var(--sunken); }
.p4-type-icon, .p4-type-icon svg { display: block; width: 28px; height: 28px; }
.p4-type-name { display: grid; gap: 4px; min-width: 0; }
.p4-type-name strong { font-size: 17px; font-weight: 700; }
.p4-type-name > .muted { font-size: 14px; }
.p4-type-stats { display: flex; gap: 28px; }
.p4-stat { display: grid; text-align: center; gap: 0; font-size: 14px; white-space: nowrap; }
.p4-stat b { font-family: 'DM Sans',sans-serif; font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }
.p4-stat > span { color: var(--muted); }
.p4-check { color: var(--check); }
.p4-safe { color: var(--safe); }
.p4-error { color: var(--error); }
.p4-zero { color: var(--faint); }
.p4-stat.p4-check > span { color: var(--check); }
.p4-stat.p4-safe > span { color: var(--safe); }
.p4-corrections { grid-column: 4; white-space: nowrap; }
.p4-row-arrow { justify-self: end; color: var(--muted); font-size: 22px; }
.p4-type-row > .p4-row-arrow { grid-column: 5; }
.p4-empty { min-height: 260px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 20px; padding: 32px; text-align: center; }
.p4-empty p { max-width: 560px; margin: 0; color: var(--muted); }
.p4-setup-head { align-items: center; flex-wrap: wrap; gap: 20px; }
.p4-setup-head h1 { font-size: 34px; overflow-wrap: anywhere; }
.p4-head-actions { flex-wrap: wrap; gap: 8px; }
.p4-tabs { display: flex; gap: 8px; overflow-x: auto; padding: 0; margin-bottom: 24px; border-bottom: 1px solid var(--line-strong); }
.p4-tabs .p4-tab { display: inline-flex; align-items: center; gap: 8px; flex-shrink: 0; padding: 14px 16px; min-height: 48px; text-decoration: none; color: var(--muted); border-bottom: 3px solid transparent; font-size: 15px; }
.p4-tabs .p4-tab:hover { background: var(--sunken); }
.p4-tabs .p4-tab[aria-current] { background: var(--accent-soft); border-bottom-color: var(--accent-ink); color: var(--accent-ink); font-weight: 700; }
.p4-tabs .pill { padding: 0 7px; }
.p4-doc-filters { display: flex; gap: 10px; margin-bottom: 20px; flex-wrap: wrap; }
.p4-doc-filters .btn { gap: 8px; }
.p4-doc-filters [aria-pressed=true] { background: var(--accent-soft); border-color: var(--accent-line); color: var(--accent-ink); }
.p4-doc-filters .pill { padding: 0 7px; }
.p4-docs { overflow-x: auto; }
.p4-doc-table { width: 100%; table-layout: auto; }
.p4-doc-table th, .p4-doc-table td { padding: 12px; }
.p4-doc-table th button { padding: 0; display: inline-flex; align-items: center; gap: 8px; background: transparent; color: inherit; border: 0; font: inherit; font-weight: 600; min-height: 24px; cursor: pointer; }
.p4-doc-table th button span { color: var(--muted); }
.p4-doc-table input { accent-color: var(--accent); width: 18px; height: 18px; min-height: 0; cursor: pointer; }
.p4-doc-table td { overflow-wrap: anywhere; }
.p4-doc-table tr[data-p4-doc] { cursor: pointer; }
.p4-doc-table tr[data-p4-doc]:hover { background: var(--sunken); }
.p4-file-cell { min-width: 160px; }
.p4-file-cell a { display: flex; gap: 10px; align-items: center; color: var(--ink); text-decoration: none; font-weight: 600; }
.p4-file-cell svg { width: 22px; height: 22px; flex: 0 0 22px; color: var(--accent-ink); }
.p4-file-cell > span { display: block; }
.p4-doc-table .p4-money { text-align: right; white-space: nowrap; }
.p4-doc-table th.p4-money button { margin-left: auto; }
.p4-date-cell { min-width: 118px; }
.p4-selection { margin: 10px 0 0; }
.p4-ask { min-height: 480px; display: flex; flex-direction: column; gap: 24px; }
.p4-examples { display: flex; flex-wrap: wrap; gap: 8px; }
.p4-examples .btn { white-space: normal; text-align: left; height: auto; min-height: 40px; font-size: 14px; font-weight: 500; }
.p4-examples svg { flex-shrink: 0; }
.p4-ask-empty { flex: 1; display: grid; align-items: center; text-align: center; color: var(--muted); min-height: 160px; }
.p4-ask-log { display: flex; flex-direction: column; gap: 24px; flex: 1; }
.p4-question { align-self: flex-end; max-width: 80%; display: grid; gap: 6px; text-align: right; }
.p4-question p { background: var(--sunken); border-radius: var(--r-card); color: var(--ink); padding: 14px 18px; text-align: left; margin: 0; }
.p4-answer { display: flex; align-items: flex-start; gap: 12px; max-width: 90%; }
.p4-answer > .card { min-width: 0; flex: 1; }
.p4-answer p { margin: 0; overflow-wrap: anywhere; }
.p4-answer-mark { display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-ink); border-radius: 999px; width: 40px; height: 40px; flex-shrink: 0; }
.p4-answer-mark svg { width: 28px; height: 28px; }
.p4-sources { margin-top: 16px; display: grid; gap: 8px; }
.p4-sources > div { display: flex; flex-wrap: wrap; gap: 8px; }
.p4-sources .btn { max-width: 100%; white-space: normal; overflow-wrap: anywhere; height: auto; min-height: 36px; }
.p4-sources svg { flex-shrink: 0; }
.p4-ask-form { display: flex; gap: 10px; margin-top: auto; }
.p4-ask-form .field { flex: 1; min-width: 0; margin: 0; }
.p4-ask-form input { width: 100%; min-height: 40px; }
.p4-clear { align-self: flex-start; }
.p4-ask-off { display: flex; align-items: center; gap: 12px; }
.p4-ask-off svg { width: 24px; height: 24px; flex-shrink: 0; }
.p4-learn-intro { margin: 0 0 20px; color: var(--muted); }
.p4-learn-stack { display: grid; gap: 16px; }
.p4-correction-card { overflow-x: auto; }
.p4-correction-card h2 { margin-bottom: 16px; }
.p4-correction-table td { overflow-wrap: anywhere; }
.p4-correction-table td:first-child a { display: block; margin-top: 4px; }
.p4-correction-table mark { background: var(--marker); color: #0F172A; padding: 2px 5px; border-radius: 2px; box-decoration-break: clone; -webkit-box-decoration-break: clone; }
.p4-proposal { margin-top: 16px; }
.p4-learn-stack .p4-proposal { margin-top: 0; }
.p4-proposal-actions { flex-wrap: wrap; justify-content: flex-end; }
.p4-comparison { display: grid; gap: 16px; margin: 8px 0; }
.p4-comparison-row { display: grid; grid-template-columns: 100px minmax(80px,1fr) 150px; gap: 16px; align-items: center; }
.p4-comparison-row > :last-child { text-align: right; }
.p4-comparison-row meter { width: 100%; height: 12px; border: 0; background: var(--sunken); border-radius: var(--r-ctl); appearance: none; }
.p4-comparison-row meter::-webkit-meter-bar { height: 12px; background: var(--sunken); border: 0; border-radius: var(--r-ctl); }
.p4-comparison-row meter::-webkit-meter-optimum-value { background: var(--accent); border-radius: var(--r-ctl); }
.p4-comparison-row meter::-moz-meter-bar { background: var(--accent); border-radius: var(--r-ctl); }
.p4-comparison-details { padding-left: 20px; }
.p4-comparison-details li { margin-top: 12px; }
.p4-instruction-change { margin-top: 16px; }
.p4-timeline { list-style: none; padding: 0 0 0 28px; margin: 0 0 0 6px; }
.p4-timeline-item { position: relative; padding-bottom: 16px; }
.p4-timeline-item::before { content: ''; position: absolute; width: 12px; height: 12px; border-radius: 999px; background: var(--line-strong); left: -28px; top: 26px; z-index: 1; }
.p4-timeline-item::after { content: ''; position: absolute; width: 2px; background: var(--line-strong); left: -23px; top: 30px; bottom: -30px; }
.p4-timeline-item:last-child::after { display: none; }
.p4-timeline-item.p4-current::before { background: var(--accent-ink); }
.p4-version-top { display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.p4-version-title { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.p4-version h2 { font-size: 20px; }
.p4-version-top p { margin-top: 8px; }
.p4-instruction { margin-top: 14px; }
.p4-instruction summary { cursor: pointer; color: var(--accent-ink); text-decoration: none; font-weight: 600; }
.p4-instruction .instruction { margin-top: 12px; overflow-wrap: anywhere; }
.p4-version > .small { margin: 12px 0 0; }
@media (max-width: 1200px) and (min-width: 861px) {
  .p4-type-row { gap: 14px; }
  .p4-type-stats { gap: 18px; }
  .p4-corrections { grid-column: 2 / 5; justify-self: start; }
  .p4-type-row > .p4-row-arrow { grid-row: 1; }
}
@media (max-width: 860px) {
  .p4-types .page-head { align-items: flex-start; }
  .p4-type-row { grid-template-columns: 28px minmax(0,1fr) 16px; gap: 10px 12px; padding: 16px; }
  .p4-type-name { grid-column: 2; }
  .p4-type-stats { grid-column: 2; grid-row: 2; justify-content: flex-start; gap: 24px; }
  .p4-stat { text-align: left; }
  .p4-type-row > .p4-row-arrow { grid-column: 3; grid-row: 1; }
  .p4-corrections { grid-column: 2 / 4; white-space: normal; justify-self: start; }
  .p4-setup-head { display: block; }
  .p4-head-actions { margin-top: 16px; flex-wrap: nowrap; }
  .p4-head-actions .p4-icon-action { width: 40px; padding: 0; flex-shrink: 0; }
  .p4-icon-action > span { display: none; }
  .p4-head-actions > .btn:last-child { flex: 1; padding-inline: 8px; }
  .p4-tabs { margin-inline: 0; gap: 0; }
  .p4-tabs .p4-tab { padding-inline: 12px; }
  .p4-doc-filters { gap: 8px; }
  .p4-doc-filters .btn { padding-inline: 10px; }
  .p4-docs { overflow: visible; }
  .p4-doc-table, .p4-doc-table tbody { display: block; }
  .p4-doc-table thead { display: none; }
  .p4-doc-table tr[data-p4-doc] { display: grid; grid-template-columns: 24px minmax(0,1fr) auto; padding: 14px 12px; gap: 8px; border-bottom: 1px solid var(--line); }
  .p4-doc-table tr:last-child { border-bottom: 0; }
  .p4-doc-table td { display: block; padding: 0; border: 0; min-width: 0; height: auto; }
  .p4-doc-table .p4-check-cell { grid-column: 1; grid-row: 1; padding-top: 2px; }
  .p4-file-cell { grid-column: 2 / 4; }
  .p4-doc-table td[data-label=Lieferant] { grid-column: 2 / 4; color: var(--muted); }
  .p4-doc-table td[data-label=Betrag] { grid-column: 2; text-align: left; }
  .p4-doc-table td[data-label=Stand] { grid-column: 3; }
  .p4-doc-table td.p4-version-cell { grid-column: 2; color: var(--muted); font-size: 14px; text-align: left; }
  .p4-version-cell::before { content: 'Version '; }
  .p4-doc-table td.p4-date-cell { grid-column: 2 / 4; font-size: 14px; }
  .p4-doc-table td.p4-row-arrow { display: none; }
  .p4-ask { gap: 20px; padding: 16px; }
  .p4-examples { display: grid; }
  .p4-question { max-width: 94%; }
  .p4-answer { max-width: 100%; gap: 8px; }
  .p4-answer-mark { width: 28px; height: 28px; }
  .p4-answer-mark svg { width: 22px; height: 22px; }
  .p4-answer .card-pad { padding: 12px; }
  .p4-ask-form { flex-wrap: wrap; }
  .p4-ask-form .field { flex-basis: 100%; }
  .p4-ask-form > .btn { margin-left: auto; }
  .p4-correction-table, .p4-correction-table tbody { display: block; }
  .p4-correction-table thead { display: none; }
  .p4-correction-table tr { display: grid; grid-template-columns: minmax(0,1fr); gap: 12px; padding: 16px 0; border-top: 1px solid var(--line); }
  .p4-correction-table td { display: block; border: 0; padding: 0; height: auto; }
  .p4-correction-table td[data-label]::before { content: attr(data-label); display: block; color: var(--muted); font-size: 14px; margin-bottom: 4px; }
  .p4-correction-table .p4-correction-arrow { display: none; }
  .p4-comparison-row { grid-template-columns: 1fr 1fr; gap: 8px; }
  .p4-comparison-row meter { grid-column: 1 / 3; grid-row: 2; }
  .p4-comparison-row > :last-child { grid-column: 2; grid-row: 1; }
  .p4-timeline { padding-left: 22px; }
  .p4-timeline-item::before { left: -22px; }
  .p4-timeline-item::after { left: -17px; }
  .p4-version-top { flex-wrap: wrap; }
}

/* P4b · Opus-Befunde: klare Zeilen und leere Kästchen in beiden Modi. */
.p4-setup > .crumb { display: none; }
.p4-tabs { flex-wrap: nowrap; }
.p4-doc-table { table-layout: fixed; min-width: 920px; }
.p4-doc-table th:first-child { width: 40px; }
.p4-doc-table th:nth-child(3) { width: 18%; }
.p4-doc-table th:nth-child(4) { width: 110px; }
.p4-doc-table th:nth-child(5) { width: 112px; }
.p4-doc-table th.p4-version-cell { width: 88px; }
.p4-doc-table .p4-version-cell { padding-inline: 8px; }
.p4-doc-table th:nth-child(7) { width: 132px; }
.p4-doc-table th:last-child { width: 28px; }
.p4-doc-table td { overflow-wrap: normal; }
.p4-file-cell { min-width: 0; }
.p4-file-cell a { max-width: 320px; min-width: 0; }
.p4-file-cell a > span, .p4-supplier { display: block; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.p4-doc-table .pill { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.p4-doc-table .pill svg { width: 16px; height: 16px; flex: 0 0 16px; }
.p4-doc-table .p4-version-cell { text-align: center; }
.p4-date-cell { min-width: 0; white-space: nowrap; }
.p4-ask-off { flex: 1; justify-content: center; }
.p4-ask-off h2 { margin-bottom: 8px; }
.p4-ask-off p { margin: 0; color: var(--muted); }
.p4-ask-error { display: grid; gap: 16px; }
.p4-ask-error .btn { justify-self: start; }
@media (max-width: 860px) {
  .p4-setup > .crumb { display: inline-flex; }
  .p4-doc-table { min-width: 0; }
  .p4-doc-table td.p4-version-cell { text-align: left; }
}

/* P4c · Vorgaben aus der Sichtprüfung vom 17.10. */
.p4-mobile-version { display: none; }
@media (max-width: 860px) {
  .p4-tabs-wrap { position: relative; }
  .p4-tabs-wrap::after { content: ''; position: absolute; inset: 0 0 1px auto; width: 28px; background: linear-gradient(to right, transparent, var(--bg)); pointer-events: none; opacity: 0; }
  .p4-tabs-wrap.p4-tabs-more::after { opacity: 1; }
  .p4-doc-filters { flex-wrap: nowrap; overflow-x: auto; }
  .p4-doc-filters .btn { flex: 0 0 auto; white-space: nowrap; }
  .p4-doc-table tr[data-p4-doc] { grid-template-columns: 20px minmax(0,1fr) auto; }
  .p4-doc-table .p4-check-cell { grid-column: 1; grid-row: 1; }
  .p4-doc-table .p4-file-cell { grid-column: 2; grid-row: 1; }
  .p4-doc-table .p4-file-cell svg { display: none; }
  .p4-doc-table td[data-label=Stand] { grid-column: 3; grid-row: 1; justify-self: end; }
  .p4-doc-table td[data-label=Lieferant] { grid-column: 1 / -1; grid-row: 2; }
  .p4-doc-table td[data-label=Betrag] { grid-column: 1 / 3; grid-row: 3; font-weight: 700; }
  .p4-doc-table td.p4-version-cell { display: none; }
  .p4-doc-table td.p4-date-cell { grid-column: 3; grid-row: 3; text-align: right; align-self: center; }
  .p4-mobile-version { display: inline; }
  .p4-correction-table .p4-correction-arrow { display: block; }
}
