/* PROJEKTCOCKPIT · TABELLEN – design/tabellen.css (ADR-088, Reihenfolge im <head>: design/README.md) */

/* 07 TABELLEN – Anatomie v12 „Karte“ (Julius 03.11.2026), Regeln design/komponenten.md §2, Muster im Styleguide; unter 640 px stapeln sich Zeilen (data-label aus dem Kopf, ui.anreichern) */
.tw { overflow-x: auto; max-width: 100%; overscroll-behavior-x: contain; }
.tw.sticky thead th { position: sticky; top: 0; z-index: 1; }
table { border-collapse: collapse; width: 100%; font-size: var(--fs-ui); font-variant-numeric: tabular-nums; }
.tw.card { border: 0; border-radius: var(--r-xl); box-shadow: var(--e-karte); }
th { font: var(--fw-regular) var(--fs-sm)/1.2 var(--fb); color: var(--ink-2); text-align: left; height: 42px; padding: 0 14px; border-bottom: 1px solid var(--line);
  white-space: nowrap; background: var(--surface); vertical-align: middle; }
.tw th { font: var(--fw-medium) var(--fs-xs)/1.2 var(--fb); letter-spacing: var(--ls-caps); text-transform: uppercase; color: var(--muted); height: var(--zeile-kopf-h); background: var(--surface-2); }
th:first-child, td:first-child { padding-left: var(--sp-4); } th:last-child, td:last-child { padding-right: var(--sp-4); }
th.n, td.n { text-align: right; }   /* Ziffernbreite: base.css */
th button { all: unset; cursor: pointer; }
th[aria-sort] button { color: var(--ink); font-weight: var(--fw-semibold); } th[aria-sort="ascending"] button::after { content: " ↑"; } th[aria-sort="descending"] button::after { content: " ↓"; }
th [data-erkl] { text-decoration: none; cursor: inherit; }   /* Kopfzeile ohne gepunktete Erklärung – Spaltenbegriffe erklären sich selbst (Julius 29.10.2026) */
td { height: var(--zeile-h); padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; white-space: nowrap; }
tbody tr:last-child td, tfoot tr:last-child td { border-bottom: 0; }
tbody tr { transition: background var(--dur-1); }
tr.click td, tr.edit td { cursor: pointer; }
tr.click:hover td, tr.edit:hover td, .tw.hover tbody tr:hover td { background: var(--surface-2); }
@media (hover: hover) { tr.click:hover td:first-child, tr.edit:hover td:first-child { box-shadow: inset 3px 0 0 var(--accent); } }   /* Touch: kein hängendes :hover */
tr.click:is(:focus-visible, :has(:focus-visible)) td:first-child, tr.edit:focus-within td:first-child { box-shadow: inset 3px 0 0 var(--accent); }
.tw tbody tr:not(.grp):not(.total):hover td { background: color-mix(in srgb, var(--surface-2) 70%, transparent); }   /* Lesehilfe: Zeile unter dem Zeiger leicht hervorheben */
tr.click td:last-child::after, tr.edit td:last-child::after { content: ""; display: inline-block; width: 7px; height: 7px; border-right: 1.5px solid var(--muted); border-top: 1.5px solid var(--muted); transform: rotate(45deg); margin-left: 10px; vertical-align: middle; position: absolute; right: var(--sp-4); top: 50%; margin: -4px 0 0; }
tr.click td:last-child, tr.edit td:last-child { position: relative; padding-right: var(--sp-7); }
tr.click td:last-child::after, tr.edit td:last-child::after { opacity: 0; transition: opacity var(--dur-1); }
tr.click:is(:hover, :focus-within) td:last-child::after, tr.edit:is(:hover, :focus-within) td:last-child::after { opacity: 1; }
@media (hover: none) { tr.click td:last-child::after, tr.edit td:last-child::after { opacity: 1; } }   /* Chevron immer am rechten Rand der Zeile (Runde 5) */
.tw.ohne-pfeil tr.click td:last-child::after, .tw.ohne-pfeil tr.edit td:last-child::after { content: none; }   /* ui.table({ ohnePfeil }) – ein Knopf führt weiter */
.tw.ohne-pfeil tr.click td:last-child, .tw.ohne-pfeil tr.edit td:last-child { padding-right: var(--sp-4); }
tr.total td { font-weight: var(--fw-semibold); border-top: 2px solid var(--line-2); background: var(--surface-2); }
/* dicht: Zeilen wie ui.kv (Drawer) */
.tw.dicht :is(th,td){height:auto;padding:5px var(--sp-2);font-size:var(--fs-sm)}.tw.dicht th{font-size:var(--fs-xs);color:var(--muted);text-transform:none;letter-spacing:0;background:none}
.tw.dicht :is(th,td):first-child{padding-left:0}.tw.dicht :is(th,td):last-child{padding-right:0}.tw.dicht .total td{border-top-width:1px;background:none}
tr.sub td:first-child { padding-left: calc(var(--sp-4) + 14px); color: var(--ink-2); }
tr.grp td { background: var(--surface-2); font: var(--fw-medium) var(--fs-sm) var(--fb); color: var(--ink-2); padding-top: 9px; padding-bottom: 9px; }
.t-grp { display: flex; align-items: center; gap: var(--sp-2); } .t-grp small { color: var(--muted); }
.t-grp .acts { display: flex; gap: var(--sp-1); margin-left: auto; }   /* v10: normale Schreibweise, 500 */
td.w { white-space: normal; min-width: 170px; }
td.st { white-space: normal; min-width: 118px; }
td.leerz { padding: 14px 20px; }
.tw.compact th { padding: 0 12px; } .tw.compact td { height: var(--zeile-h-kompakt); padding: 8px 12px; }
tr.sel td, tr[aria-selected="true"] td { background: var(--accent-2); }   /* Auswahl: dezente Akzentfläche, keine Zebrastreifen */
.pname { font-weight: var(--fw-medium); } .psub { font-size: var(--fs-sm); color: var(--muted); }
td.w .pn { display: flex; align-items: center; }
.thumb { width: 44px; height: 32px; border-radius: var(--r-xs); object-fit: cover; background: var(--surface-3); display: inline-block; vertical-align: middle; margin-right: 10px; flex: none; overflow: hidden; position: relative; }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
/* Mini-Balken in Zellen */
.mini { display: inline-flex; align-items: center; gap: 7px; }
.mini .bar { width: 42px; height: 5px; border-radius: 3px; background: var(--surface-3); position: relative; overflow: hidden; flex: none; }
.mini .bar i { position: absolute; inset: 0 auto 0 0; background: var(--accent); border-radius: 3px; }
.mini .bar i.r { background: var(--accent); opacity: .35; }
.mini span { font-variant-numeric: tabular-nums; font-size: var(--fs-sm); color: var(--ink-2); }
/* Matrix (Szenarien): alles rechtsbündig, farbige Zellen */
.matrix td, .matrix th { text-align: right; font-variant-numeric: tabular-nums; }
.matrix td:first-child, .matrix th:first-child { text-align: left; }
.cell { display: block; padding: 7px 8px; border-radius: var(--r-sm); font-weight: var(--fw-medium); }
.cell.g { background: color-mix(in srgb, var(--good) 14%, transparent); color: var(--good-ink); }
.cell.w { background: color-mix(in srgb, var(--warn) 20%, transparent); color: var(--warn-ink); }
.cell.c { background: color-mix(in srgb, var(--crit) 14%, transparent); color: var(--crit-ink); }
.cell.base { box-shadow: inset 0 0 0 2px var(--ink); }
/* Responsive Stapel: jede Zeile wird zur Karte, data-label liefert die Spaltenüberschrift */
@media (max-width: 640px) {
  .tw table.stapel thead { display: none; }
  .tw table.stapel { min-width: 0 !important; }   /* Mindestbreite gilt nur für die Tabellenansicht – sonst rutschen die Werte aus der Karte */
  .tw table.stapel, .tw table.stapel tbody, .tw table.stapel tfoot, .tw table.stapel tr, .tw table.stapel td { display: block; width: 100%; }
  .tw table.stapel tr { padding: 8px 0; border-bottom: 1px solid var(--line); }
  .tw table.stapel tr:last-child { border-bottom: 0; }
  .tw table.stapel td { display: grid; grid-template-columns: minmax(96px, 40%) 1fr; gap: 10px; align-items: baseline; height: auto; padding: 4px var(--sp-4); border: 0;
    white-space: normal; text-align: left; }
  .tw table.stapel td::before { content: attr(data-label); font: var(--fw-semibold) var(--fs-xs) var(--fb); letter-spacing: .05em; text-transform: uppercase; color: var(--muted); text-align: left; }
  .tw table.stapel td > * { justify-self: start; }
  .tw table.stapel td.n { text-align: right; } .tw table.stapel td.n > * { justify-self: end; }
  .tw table.stapel td:first-child { grid-template-columns: 1fr; font-weight: var(--fw-semibold); font-size: var(--fs-md); padding-top: 8px; padding-bottom: 6px; }
  .tw table.stapel td:first-child::before, .tw table.stapel td:not([data-label])::before { content: none; }
  .tw table.stapel td:not([data-label]) { grid-template-columns: 1fr; }
  .tw table.stapel td:empty { display: none; }
  .tw table.stapel tr.grp td, .tw table.stapel tr.total td { background: var(--surface-2); font-weight: var(--fw-semibold); }
  .tw table.stapel tr.total { border-top: 2px solid var(--line-2); }
  .tw table.stapel tr.click td:last-child::after { content: none; }
}
