/* UI v3 C2 (lane U4): dashboard, 'Alle Mandanten', ui/charts.js, Tägliche-Aufgaben count. Ruled
   sections, no cards, role tokens only; inline-size containers only on the strip and KPI row. */
:root:has(.dash) { --bg-app: var(--bg-surface); }
.dash { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 16px 24px; align-items: start; }
.dash > * { grid-column: 1 / -1; min-width: 0; }
.dash > .page-head { margin: 0; min-height: 32px; }
.dash > .page-head > div:first-child { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 12px; }
.dash-scope { margin: 0; border-bottom: 0; }
.dash-section-head { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 12px; min-height: 36px; padding-top: 12px; border-top: 1px solid var(--border-hairline); }
.dash-section-head h2 { margin: 0; font-size: var(--text-lg); line-height: 24px; font-weight: var(--weight-bold); }
.dash-section-head p, .dash-empty { margin: 0; color: var(--text-muted); font-size: var(--text-sm); line-height: var(--lh-sm); }
.dash-empty { margin-top: 8px; }
.dash-head-actions { margin-left: auto; display: flex; align-items: center; gap: 16px; font-size: var(--text-sm); line-height: var(--lh-sm); }
.dash-head-actions a, .dash-links a { color: var(--accent-text); font-weight: var(--weight-medium); text-decoration: none; }
.dash-head-actions a:hover, .dash-links a:hover, .dash-list a:hover { color: var(--accent-text); text-decoration: underline; text-underline-offset: 2px; }
.dash-count { display: inline-block; min-width: 20px; padding: 0 5px; border-radius: var(--radius-xs); background: var(--bg-active); color: var(--text-secondary); font-size: var(--text-2xs); line-height: 18px; font-weight: var(--weight-medium); text-align: center; vertical-align: 1px; }
.dash-task-grid, .dash-steps, .dash-kpis { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border-top: 1px solid var(--border-hairline); border-bottom: 1px solid var(--border-hairline); }
.dash-task-grid, .dash-steps { margin-top: 8px; }
.dash-task, .dash-step, .dash-kpi { min-width: 0; display: grid; color: var(--text-primary); text-decoration: none; }
.dash-task, .dash-kpi { border-left: 1px solid var(--border-hairline); }
.dash-task:nth-child(3n + 1), .dash-kpi:nth-child(3n + 1) { border-left: 0; }
.dash-task:nth-child(n + 4), .dash-kpi:nth-child(n + 4) { border-top: 1px solid var(--border-hairline); }
.dash-task:hover, .dash-step:hover, .dash-kpi:hover { background: var(--bg-hover); }
.dash-task:focus-visible, .dash-kpi:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: -2px; }

.dash-tasks { container: dash-tasks / inline-size; }
.dash-task { grid-template-columns: 36px minmax(0, 1fr) 14px; gap: 0 10px; align-items: center; padding: 9px 12px 9px 4px; }
.dash-task > .ui-icon { grid-column: 3; grid-row: 1 / span 2; color: var(--text-muted); }
.dash-task-count { grid-row: 1 / span 2; display: grid; place-items: center; min-height: 28px; font-size: var(--text-xl); line-height: 28px; font-weight: var(--weight-bold); font-variant-numeric: tabular-nums lining-nums; }
.dash-task.is-urgent .dash-task-count { color: var(--error-fg); }
.dash-task.is-warn .dash-task-count, .dash-task.is-warn .dash-task-note { color: var(--warning-fg); }
.dash-task-count.is-done { color: var(--success-bar); }
.dash-task-count.is-pending { color: var(--border-default); font-weight: var(--weight-regular); }
/* No review period or no bank account: a muted dash (D-08), read as 0. */
.dash-task-count.is-none { color: var(--text-muted); font-weight: var(--weight-regular); }
.dash-task-title, .dash-task-note, .dash-kpi-label > span, .dash-kpi-value, .dash-kpi-foot > span, .dash-recent-text .cell-clip, .dash-recent-source, .dash-bank-account { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dash-task-title { font-size: var(--text-sm); line-height: var(--lh-sm); font-weight: var(--weight-medium); }
.dash-task-note { min-height: 16px; color: var(--text-muted); font-size: var(--text-xs); line-height: var(--lh-xs); }
.dash-task.is-zero .dash-task-title { color: var(--text-secondary); font-weight: var(--weight-regular); }
.dash-tasks-error { display: flex; align-items: center; gap: 12px; margin: 8px 0 0; color: var(--error-fg); font-size: var(--text-sm); }
@container dash-tasks (min-width: 1800px) {
  .dash-task-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .dash-task:nth-child(n) { border-left: 1px solid var(--border-hairline); border-top: 0; }
  .dash-task:first-child { border-left: 0; }
}

/* Alpi guide D-A4 item 6: each step is a link over the whole cell (::after) plus «Zeig es mir» below, the
   step state (Starten, Weiter, Erledigt) at the right of that row; four columns with «Firmendaten und IBAN». */
.dash-steps:has(> :nth-child(4)) { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.dash-step { position: relative; align-content: space-between; gap: 2px; padding: 10px 12px 8px 4px; }
.dash-step + .dash-step { border-left: 1px solid var(--border-hairline); padding-left: 12px; }
.dash-step-link { display: grid; grid-template-columns: 24px minmax(0, 1fr); gap: 0 10px; align-items: center; min-width: 0; color: var(--text-primary); text-decoration: none; }
.dash-step-link::after { content: ""; position: absolute; inset: 0; }
.dash-step-guide { position: relative; z-index: 1; justify-self: start; margin-left: 34px; padding: 2px 0; border: 0; background: transparent; color: var(--accent-text); font: inherit; font-size: var(--text-xs); line-height: var(--lh-xs); font-weight: var(--weight-medium); cursor: pointer; }
.dash-step-guide:hover { text-decoration: underline; text-underline-offset: 2px; }
.dash-step:not(:has(> .dash-step-guide)) { padding-bottom: 28px; }
.dash-step-mark { grid-row: 1 / span 2; width: 24px; height: 24px; display: grid; place-items: center; border-radius: var(--radius-sm); background: var(--accent); color: var(--text-on-solid); font-size: var(--text-xs); font-weight: var(--weight-bold); }
.dash-step.is-done .dash-step-mark { background: var(--success-bg); color: var(--success-fg); }
.dash-step-title { font-size: var(--text-sm); line-height: var(--lh-sm); font-weight: var(--weight-medium); }
.dash-step-copy { grid-column: 2; color: var(--text-muted); font-size: var(--text-xs); line-height: var(--lh-xs); }
.dash-step-action { position: absolute; right: 12px; bottom: 10px; color: var(--accent-text); font-size: var(--text-xs); line-height: var(--lh-xs); font-weight: var(--weight-medium); white-space: nowrap; }
.dash-step.is-done .dash-step-action { color: var(--success-fg); }

.dash-kpi-row { container: dash-kpis / inline-size; }
.dash-kpi { gap: 2px; padding: 12px 16px 10px; }
.dash-kpi:nth-child(3n + 1) { padding-left: 4px; }
.dash-kpi-label { display: flex; align-items: center; gap: 6px; min-width: 0; color: var(--text-muted); font-size: var(--text-xs); line-height: var(--lh-xs); }
.dash-kpi-value { font-size: var(--text-xl); line-height: 28px; font-weight: var(--weight-bold); letter-spacing: -.01em; font-variant-numeric: tabular-nums lining-nums; }
.dash-kpi-value .unit { margin: 0 2px 0 0; letter-spacing: 0; }
.dash-kpi-value.is-negative { color: var(--amount-negative); }
.dash-kpi-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 18px; color: var(--text-muted); font-size: var(--text-xs); line-height: var(--lh-xs); }
.dash-kpi-foot > span { min-width: 0; }
.spark { flex: 0 0 56px; width: 56px; height: 18px; overflow: visible; }
.spark polyline { fill: none; stroke: var(--chart-income); stroke-width: 1.5px; stroke-linejoin: round; stroke-linecap: round; }
.spark[data-series="expenseCents"] polyline { stroke: var(--chart-expense); }
@container dash-kpis (min-width: 1440px) {
  .dash-kpis { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .dash-kpi:nth-child(n) { border-left: 1px solid var(--border-hairline); border-top: 0; padding-left: 16px; }
  .dash-kpi:first-child { border-left: 0; padding-left: 4px; }
}
@container dash-kpis (min-width: 1680px) { .dash-kpi-value { font-size: var(--text-kpi); line-height: 32px; } }

.dash > .dash-chart, .dash > .dash-recent { grid-column: span 8; }
.dash > .dash-due, .dash > .dash-period { grid-column: span 4; }
.dash > .dash-bank { display: none; }
@media (min-width: 1880px) {
  .dash { row-gap: 24px; }
  .dash > .dash-recent, .dash > .dash-bank, .dash > .dash-period { display: block; grid-column: span 4; }
}
.dash-legend { display: inline-flex; align-items: center; gap: 12px; color: var(--text-muted); font-size: var(--text-xs); line-height: var(--lh-xs); }
.dash-legend > span::before, .chart-tip-row::before { content: ""; display: inline-block; width: 10px; height: 10px; margin-right: 6px; border-radius: 2px; vertical-align: -1px; background: var(--chart-income); }
.dash-legend > .is-expense::before, .chart-tip-row.series-1::before { background: var(--chart-expense); }
.dash-chart .empty-inline, .dash-chart .table-wrap { margin-top: 8px; }
.dash-chart-table tbody th, .dash-chart-table tbody td { background: var(--bg-surface); }
.dash-chart-table th[scope="row"] { font-weight: var(--weight-regular); text-align: left; color: var(--text-primary); }
/* The row header rules like its cells: the same hairline, none under the last row. */
.dash-chart-table tbody th { border-bottom-color: var(--border-hairline); }
.dash-chart-table tbody tr:last-child th { border-bottom: 0; }
.dash-head-actions .btn[aria-pressed="true"] { background: var(--bg-selected); color: var(--accent-text); }

.chart-frame { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 8px; height: 240px; margin-top: 8px; }
@media (min-width: 1880px) { .chart-frame { height: 280px; } }
.chart-axis { color: var(--text-muted); font-size: var(--text-2xs); line-height: var(--lh-2xs); text-align: right; font-variant-numeric: tabular-nums lining-nums; }
.chart-axis > span { position: relative; display: block; height: 0; white-space: nowrap; }
.chart-axis > span:nth-child(1) { top: calc(4% - 7px); }
.chart-axis > span:nth-child(2) { top: calc(25% - 7px); }
.chart-axis > span:nth-child(3) { top: calc(46% - 7px); }
.chart-axis > span:nth-child(4) { top: calc(67% - 7px); }
.chart-axis > span:nth-child(5) { top: calc(88% - 7px); }
.chart-plot { position: relative; min-width: 0; }
.chart-svg { display: block; overflow: visible; }
.chart-gridline, .chart-baseline { stroke: var(--stone-5); stroke-width: 1px; shape-rendering: crispEdges; }
.chart-baseline { stroke: var(--border-control); }
.chart-bar.is-income { fill: var(--chart-income); }
.chart-bar.is-expense { fill: var(--chart-expense); }
.chart-hit { fill: transparent; }
.chart-month[data-tip-title]:hover .chart-hit { fill: var(--bg-hover); }
.chart-month:focus { outline: none; }
.chart-month:focus-visible .chart-hit { fill: var(--bg-hover); stroke: var(--focus-ring); stroke-width: 2px; }
.chart-label { fill: var(--text-muted); font-size: var(--text-2xs); }
.chart-month.is-future .chart-label { fill: var(--text-disabled); }
/* Beside its month (charts.js chartTipPlace): never over the bars it describes or the focus ring. */
.chart-tip { position: absolute; top: 0; z-index: 1; display: grid; gap: 2px; min-width: 150px; padding: 6px 10px; border: 1px solid var(--border-hairline); border-radius: var(--radius); background: var(--bg-surface); box-shadow: var(--shadow-2); font-size: var(--text-xs); line-height: var(--lh-xs); pointer-events: none; transform: translateX(6px); }
.chart-tip[data-align="before"] { transform: translateX(calc(-100% - 6px)); }
.chart-tip[hidden] { display: none; }
.chart-tip strong, .chart-tip-row b { font-weight: var(--weight-medium); }
.chart-tip-row { display: flex; align-items: center; gap: 4px 12px; color: var(--text-secondary); }
.chart-tip-row::before { width: 8px; height: 8px; margin: 0; }
.chart-tip-row b { margin-left: auto; color: var(--text-primary); font-variant-numeric: tabular-nums lining-nums; }

.dash-due-list h3 { display: flex; align-items: center; gap: 8px; margin: 10px 0 2px; font-size: var(--text-sm); line-height: var(--lh-sm); font-weight: var(--weight-medium); }
.dash-due-list h3 a, .dash-due-name a { color: var(--text-primary); text-decoration: none; }
.dash-list { width: 100%; border-collapse: collapse; table-layout: fixed; font-size: var(--text-sm); line-height: var(--lh-sm); }
.dash-list td, .dash-list th, .dash-facts > div { padding: 5px 4px; border-bottom: 1px solid var(--stone-4); text-align: left; vertical-align: top; }
.dash-quiet-head th { height: 0; padding-top: 0; padding-bottom: 0; border: 0; line-height: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.dash-list thead:not(.dash-quiet-head) th { color: var(--text-secondary); font-size: var(--text-xs); line-height: var(--lh-xs); font-weight: var(--weight-medium); }
.dash-list tr:last-child td, .dash-facts > div:last-child { border-bottom: 0; }
.dash-list .num, .dash-list th.num { text-align: right; white-space: nowrap; }
.dash-due-name a { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden; overflow-wrap: anywhere; }
.dash-due-date, .dash-recent-date { width: 88px; color: var(--text-muted); white-space: nowrap; font-variant-numeric: tabular-nums lining-nums; }
.dash-due-list .num { width: 88px; }
.dash-recent-text .cell-clip { display: block; }
.dash-recent-source { width: 132px; color: var(--text-muted); }
.dash-bank .dash-list .num, .dash-bank .dash-list .dash-due-date { width: 120px; }
/* The heading may wrap (fr «Dernier mouvement» is 127 px); the dates below stay on one line. */
.dash-bank .dash-list th.dash-due-date { white-space: normal; }
/* Presentation polish (27.09.2026, I-16): «2 nicht zugeordnet» under the account, «Abgeglichen bis 31.08.2026» on one line. */
.dash-bank .dash-bank-open { display: block; color: var(--text-muted); font-size: var(--text-xs); line-height: var(--lh-xs); }
.dash-bank .dash-list td:last-child { white-space: nowrap; }
.dash-bank .dash-list th:last-child, .dash-bank .dash-list td:last-child { width: 204px; padding-left: 16px; }
.dash-facts { display: grid; margin: 8px 0 0; }
.dash-facts > div { display: flex; justify-content: space-between; gap: 12px; font-size: var(--text-sm); line-height: var(--lh-sm); }
.dash-facts dt { color: var(--text-muted); }
.dash-facts dd { margin: 0; text-align: right; }
.dash-links { display: flex; flex-wrap: wrap; gap: 4px 16px; margin: 8px 0 0; padding: 0 4px; font-size: var(--text-sm); line-height: var(--lh-sm); }

/* The Mandant cell stays a table cell (rules in line, grid ellipsis); the current row is marked by
   'Aktuell' only, since the petrol tint means selection. */
.dash-org-name { font-weight: var(--weight-medium); }
.dash-org-name .org-monogram { display: inline-grid; width: 20px; height: 20px; margin: -4px 8px -4px 0; vertical-align: middle; }
.dash-orgs .row-actions { white-space: nowrap; text-align: right; }
.dash-orgs .row-actions .btn + .btn { margin-left: 6px; }
/* Pinned: above the quiet row-action rule of styles.css (.data-table td > .btn.btn-small:not(…):not(…)). */
.dash-orgs .data-table td > .btn.btn-small.dash-pin[aria-pressed="true"] { color: var(--accent-text); background: var(--bg-selected); }
.dash-pin[aria-pressed="true"] .ui-icon { fill: currentColor; }

/* Mandanten-Cockpit (lane CK, docs/cockpit-acceptance.md), the tab «Alle Mandanten»: chips and the
   «Stand» line above the grid, fixed column widths (table-layout of .list-grid; above u1-lists.css),
   figures as links in the accent. Red stays with the overdue amount (.amount-overdue, styles.css);
   amber marks an unprepared VAT return within 14 days, an old open bank movement and an open review. */
.ck-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; margin: 0 0 8px; }
.ck-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.ck-chips .filter-chip { max-width: none; }
.ck-chips .filter-chip-group.is-active .filter-chip { border-radius: var(--radius-sm); }
.ck-chip-count { margin-left: 2px; font-variant-numeric: tabular-nums lining-nums; font-weight: var(--weight-semibold); }
.ck-meta { display: flex; align-items: center; gap: 8px; margin: 0 0 0 auto; color: var(--text-muted); font-size: var(--text-sm); line-height: var(--lh-sm); }
.ck-loading { margin: 0 0 8px; color: var(--text-muted); font-size: var(--text-sm); line-height: var(--lh-sm); }
.ck-notice { margin: 0 0 8px; }
.list-grid.ck-table th.ck-access-col { width: 112px; }
.list-grid.ck-table th.ck-count { width: 76px; }
.list-grid.ck-table th.ck-recon-col { width: 120px; }
.list-grid.ck-table th.num:not(.ck-count) { width: 108px; }
.list-grid.ck-table th.ck-vat-col { width: 166px; }
.list-grid.ck-table th.ck-payroll-col { width: 124px; }
.list-grid.ck-table th.col-date { width: 108px; }
/* Two-line column heads: the short counts keep a readable label instead of «…». */
.ck-table thead tr:first-child th { vertical-align: bottom; white-space: normal; }
.ck-table thead .grid-sort { align-items: flex-end; }
.ck-table thead .grid-sort > span:first-child { white-space: normal; text-overflow: clip; line-height: var(--lh-xs); }
.data-grid .data-grid-table.ck-table :is(th.ck-count, td.num:not(.grid-sum-value)) { padding-inline: 6px; }
.data-grid .data-grid-table.ck-table th.ck-count .grid-sort { width: calc(100% + 12px); margin-inline: -6px; padding-inline: 6px; }
/* The narrow count heads show the sort arrow only while sorted (the label keeps its room). */
.ck-table th.ck-count:not([aria-sort="ascending"], [aria-sort="descending"]) .grid-sort-indicator { display: none; }
.ck-name { font-weight: var(--weight-medium); }
.ck-dot { display: inline-block; width: 8px; height: 8px; margin: 0 8px 0 0; border-radius: var(--radius-full); background: var(--border-hairline); vertical-align: middle; }
.ck-dot.is-hoch { background: var(--warning-fg); }
.ck-dot.is-mittel { background: var(--warning-line); }
.ck-dot.is-niedrig { background: var(--stone-7); }
.ck-table td a { text-decoration: none; }
.ck-table td a:hover, .ck-table td a:focus-visible { text-decoration: underline; }
.ck-table td:is(.num, .ck-vat, .ck-recon, .ck-payroll, .col-date) a { color: var(--accent-text); }
.ck-table td.amount-overdue a { color: inherit; }
.ck-table td.ck-vat.is-soon a, .ck-table td.ck-recon:is(.is-open, .is-incomplete) a, .ck-table td.col-date.ck-old, .ck-table td.col-date.ck-old a { color: var(--warning-fg); }
.ck-sub { color: var(--text-muted); font-size: var(--text-xs); }
.ck-ok { color: var(--success-fg); }
.ck-ok .ui-icon { vertical-align: -2px; }
.ck-pending, .ck-payroll.is-keine { color: var(--text-muted); }
.ck-pin { color: var(--accent-text); }
.ck-pin .ui-icon { fill: currentColor; vertical-align: -1px; }
@media print { .ck-bar .btn, .ck-chips { display: none; } }
@media (forced-colors: active) { .ck-dot { forced-color-adjust: none; background: CanvasText; } .ck-dot.is-keine { background: GrayText; } }

.side-nav .nav-count, .modal-nav .nav-count { margin-left: auto; min-width: 20px; padding: 0 6px; border-radius: var(--radius-xs); background: var(--petrol-3); color: var(--accent-text); font-size: var(--text-2xs); line-height: 18px; font-weight: var(--weight-medium); text-align: center; font-variant-numeric: tabular-nums lining-nums; }
.is-rail .nav-count { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
@media print { .dash-scope, .dash-head-actions, .chart-tip, .dash-onboarding { display: none; } }
@media (forced-colors: active) {
  .chart-bar { fill: CanvasText; }
  .chart-bar.is-expense { fill: GrayText; }
  .dash-task-count.is-done, .dash-task.is-warn .dash-task-count, .dash-task.is-urgent .dash-task-count { color: CanvasText; }
}
