/* Cloud-Kosten (billing dashboard). Only the roles and tints of tokens.css and app.css, so the
   contrast pairs checked by tests/web/contrast.test.js hold here too; no new colours. */

/* ------------------------------------------------------------------ app bar: a third tab */
nav.tabs .tab { white-space: nowrap; }

/* ------------------------------------------------------------------ month, status and views */
.month-pick { display: flex; align-items: flex-end; gap: 8px; flex-wrap: wrap; }
.month-pick select { min-width: 260px; }
.bill-status { display: flex; align-items: center; gap: 6px 14px; flex-wrap: wrap; margin: 0 0 12px; padding: 10px 14px;
  background: var(--c-surface); border: 1px solid var(--c-line); border-left: 4px solid var(--c-accent); border-radius: var(--radius); }
.bill-status.provisional { border-left-color: var(--c-warn); }
.bill-status .chip { margin: 0; }
.bill-status .note { flex-basis: 100%; }
.subtabs { display: flex; flex-wrap: wrap; gap: 4px; margin: 0 0 16px; border-bottom: 1px solid var(--c-line); }
.subtab { display: inline-flex; align-items: center; min-height: 44px; padding: 0 14px; color: var(--c-text); text-decoration: none; font-weight: 500;
  border-bottom: 3px solid transparent; margin-bottom: -1px; }
.subtab:hover { color: var(--c-accent); }
.subtab[aria-current="page"] { color: var(--c-accent); border-bottom-color: var(--c-accent); font-weight: 600; }
.subtab:focus-visible { outline-offset: -4px; }
.notice.warn { border-color: var(--c-warn); background: var(--c-warn-bg); }

/* ------------------------------------------------------------------ overview */
.tiles { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; margin: 0; }
.tile { background: var(--c-page); border-radius: var(--radius); padding: 12px 14px; min-width: 0; }
.tile dt { font-weight: 500; font-size: var(--nc-text-p-xs); color: var(--c-text-2); }
.tile dd { margin: 0; }
.tile .value { font-size: var(--nc-text-p-l); font-weight: 600; white-space: nowrap; }
.tile .note { display: block; }
.bill-filters { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px 24px; margin-bottom: 12px; }
.bill-filters .search { flex: 1 1 260px; max-width: 360px; }
input[type="search"] { font: inherit; font-size: var(--nc-text-p-s); color: var(--c-text); background: var(--c-surface);
  border: 1px solid var(--c-control); border-radius: 6px; padding: 8px 10px; min-height: 44px; width: 100%; }
input[type="search"]:focus-visible { outline: 2px solid var(--c-accent); outline-offset: 0; border-color: var(--c-accent); }
.check { display: inline-flex; align-items: center; gap: 10px; min-height: 44px; cursor: pointer; }
.bill-count { margin: 0 0 8px; }
table.t th button.sort { font: inherit; font-weight: 600; color: inherit; background: none; border: 0; padding: 0; cursor: pointer;
  display: inline-flex; align-items: center; gap: 4px; text-align: inherit; white-space: nowrap; }
table.t th.num button.sort { flex-direction: row-reverse; }
table.t th button.sort:hover { color: var(--c-accent); }
table.t th button.sort .arrow { font-size: 10px; min-width: 10px; }
table.t th[aria-sort] button.sort { color: var(--c-text); }
table.t thead th:has(button.sort) { vertical-align: bottom; }
.bill-table tbody th { min-width: 220px; }
.bill-table tbody th a { font-weight: 600; }
.bill-table td:nth-child(2) { white-space: nowrap; }
.bill-table th .chips { display: block; margin-top: 4px; } /* hint badges under the customer's name */
.tiles.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
#bill-invoice .figures, #bill-discount .figures, #bill-split .figures { max-width: 640px; }

/* ------------------------------------------------------------------ tables: wrapping heads, sticky first column */
/* Long German column heads ("Marge seit Jahresbeginn") may take two lines, so the numbers fit. */
table.t.bill-wrap thead th { white-space: normal; } /* breaks at spaces and at the soft hyphen of "Rechnungs\00ADpositionen" only */
table.t.bill-wrap th button.sort { white-space: normal; }
table.t.bill-wrap th.num button.sort { text-align: right; }
/* While a table scrolls sideways (1024 px), its first column (customer, month, account) stays in
   view. Not for merged cells: a sticky "Total" over three columns would cover the totals. */
.bill-scroll table.t tr > :first-child:not([colspan]) { position: sticky; left: 0; z-index: 1; background: var(--c-surface); }
.bill-more { margin-top: 12px; }
.bill-filters .bill-more { margin: 0 0 10px; } /* on the line of the buttons' text */
.bill-asof { margin: -8px 0 12px; }

/* ------------------------------------------------------------------ customer */
.bill-grid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 16px; align-items: start; margin-top: 16px; }
.bill-grid > .card { margin-top: 0; }
.share { display: inline-flex; align-items: center; gap: 8px; }
.share .bar { display: inline-block; height: 8px; background: var(--c-accent); border-radius: 4px; }

/* ------------------------------------------------------------------ Jahresübersicht */
.bill-matrix th[scope="row"] { min-width: 200px; }
.bill-matrix .nodata { color: var(--c-text-2); background: var(--tint-grey-20); }
.bill-matrix abbr.prov { display: block; font-size: var(--nc-text-p-xs); font-weight: 500; color: var(--c-warn); text-decoration: none; cursor: help; }
.bill-matrix td.total { font-weight: 600; }

/* ------------------------------------------------------------------ Monatsabschluss */
.bill-actions { margin: 0 0 12px; }
/* The amount to invoice is the figure of the page: a tinted, bold column. */
table.t.bill-closing .amount { background: var(--tint-blue-10); font-weight: 600; }
table.t.bill-closing .amount .src { font-weight: 400; }

/* ------------------------------------------------------------------ Hinweise */
.alert-link { margin-top: 4px; }
.alert-link a { display: inline-block; min-height: 24px; padding: 2px 0; } /* WCAG 2.5.8: 24 px targets, apart from "Die n Konten anzeigen" */

/* ------------------------------------------------------------------ responsive */
@media (max-width: 1180px) {
  nav.tabs .tab { padding: 0 10px; }
  .bill-table tbody th { min-width: 170px; }
  .bill-matrix th[scope="row"] { min-width: 150px; }
  .tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .bill-grid { grid-template-columns: minmax(0, 1fr); } /* the account table needs the full width */
}
@media (max-width: 900px) {
  .tiles, .tiles.four { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .month-pick select { min-width: 0; }
}
