/* Branch statistics share the authenticated workspace palette and controls. */
.statistics-workspace .statistics-filter-form { display: grid; grid-template-columns: minmax(14rem, 1.2fr) minmax(10rem, 1fr) minmax(10rem, 1fr) auto; gap: 16px; align-items: end; max-width: 1100px; }
.statistics-workspace .statistics-filter-form :is(input, select) { width: 100%; min-width: 0; font-size: 16px; }
@media (max-width: 900px) {
  .statistics-workspace .statistics-filter-form { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .statistics-workspace .statistics-metric-field, .statistics-workspace .statistics-filter-form button { grid-column: 1 / -1; }
}
.statistics-workspace .statistics-shortcuts { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 16px; }
.statistics-workspace .statistics-shortcuts p { margin: 0 0 0 8px; color: var(--muted); font-size: 14px; }
.statistics-workspace .statistics-shortcuts button { padding-inline: 14px; }
.statistics-workspace .statistics-shortcuts [aria-pressed="true"] { border-color: var(--accent-text); color: var(--accent-text); background: var(--control-hover); box-shadow: inset 0 -2px 0 var(--accent-text); }
.statistics-workspace #statistics-date-error { margin: 16px 0 0; }
.statistics-workspace .statistics-feedback { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-bottom: 20px; }
.statistics-workspace .statistics-feedback p { margin: 0; font-size: 16px; }
.statistics-workspace .statistics-feedback[data-state="error"] { color: var(--danger); border-left: 3px solid var(--danger); padding-left: 14px; }
.statistics-workspace .statistics-feedback[data-state="stale"] { border-left: 3px solid var(--accent); padding-left: 14px; }
.statistics-workspace .statistics-result-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.statistics-workspace .statistics-result-heading h2 { margin: 0; font-size: 21px; }
.statistics-workspace .statistics-result-heading p { margin: 4px 0 0; color: var(--muted); font-size: 14px; }
.statistics-workspace .statistics-export-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.statistics-workspace .statistics-export-status { margin: 0 0 16px; color: var(--text); padding: 10px 14px; border-left: 2px solid var(--accent); font-size: 14px; }
.statistics-workspace .statistics-export-status[data-state="error"] { color: var(--danger); border-color: var(--danger); }
.statistics-workspace .statistics-summary { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border: 1px solid var(--line); border-top: 2px solid var(--accent); background: var(--surface); border-radius: 8px; margin-bottom: 14px; }
.statistics-workspace .statistics-summary article { padding: 20px 24px; }
.statistics-workspace .statistics-summary article + article { border-left: 1px solid var(--line); }
.statistics-workspace .statistics-summary article > span { font-size: 14px; color: var(--muted); }
.statistics-workspace .statistics-summary p { margin: 4px 0 0; display: flex; align-items: baseline; gap: 8px; }
.statistics-workspace .statistics-summary strong { font-family: Georgia, "Times New Roman", serif; font-size: 38px; line-height: 1.2; font-variant-numeric: tabular-nums; font-weight: 600; color: var(--accent-text); }
.statistics-workspace .statistics-summary p span { color: var(--muted); font-size: 14px; }
.statistics-workspace .statistics-definition { color: var(--muted); font-size: 14px; margin: 0 0 24px; }
.statistics-workspace .statistics-branch-totals { margin: 0; padding: 0; list-style: none; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 24px; }
.statistics-workspace .statistics-branch-totals li { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.statistics-workspace .statistics-branch-totals .statistics-branch-name { min-width: 0; overflow-wrap: anywhere; }
.statistics-workspace .statistics-branch-totals strong { font-variant-numeric: tabular-nums; font-size: 19px; white-space: nowrap; }
.statistics-workspace .statistics-matrix-wrap { max-width: 100%; overflow-x: auto; border: 1px solid var(--line); border-radius: 6px; }
.statistics-workspace .statistics-matrix { border-collapse: separate; border-spacing: 0; width: 100%; font-size: 15px; }
.statistics-workspace .statistics-matrix :where(th, td) { text-align: right; min-width: 100px; padding: 13px 15px; border-bottom: 1px solid var(--line); font-variant-numeric: tabular-nums; white-space: nowrap; }
.statistics-workspace .statistics-matrix thead th { background: var(--surface-raised); font-size: 14px; }
.statistics-workspace .statistics-matrix th:first-child { text-align: left; position: sticky; left: 0; z-index: 1; background: var(--surface); min-width: 130px; border-right: 1px solid var(--line); }
.statistics-workspace .statistics-matrix thead th:first-child { background: var(--surface-raised); }
.statistics-workspace .statistics-matrix .statistics-row-total { font-weight: 700; color: var(--accent-text); }
.statistics-workspace .statistics-matrix tbody tr:last-child :where(th, td) { border-bottom: 0; }
.statistics-workspace .statistics-daily-cards { display: none; }
.statistics-workspace .statistics-pagination { display: flex; justify-content: flex-end; gap: 12px; align-items: center; margin-top: 18px; }
.statistics-workspace .statistics-pagination span { font-size: 14px; color: var(--muted); }
.statistics-workspace .statistics-detail-note { margin: 14px 0 0; font-size: 14px; color: var(--muted); }
.statistics-print-report, .statistics-print-blocked { display: none; }
@media (max-width: 1000px) {
  .statistics-workspace .statistics-branch-totals { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .statistics-workspace .statistics-result-heading { align-items: flex-start; flex-direction: column; }
}
@media (max-width: 800px) {
  .statistics-workspace .statistics-matrix-wrap { display: none; }
  .statistics-workspace .statistics-daily-cards { display: grid; gap: 14px; }
  .statistics-workspace .statistics-day-card { border: 1px solid var(--line); border-radius: 6px; padding: 14px; background: var(--surface); }
  .statistics-workspace .statistics-day-card header { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
  .statistics-workspace .statistics-day-card h3 { margin: 0; font-size: 17px; }
  .statistics-workspace .statistics-day-card header p { margin: 0; font-weight: 650; color: var(--accent-text); }
  .statistics-workspace .statistics-day-card dl { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 20px; margin: 12px 0 0; }
  .statistics-workspace .statistics-day-card dl > div { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; min-width: 0; }
  .statistics-workspace .statistics-day-card dt { font-size: 14px; color: var(--muted); overflow-wrap: anywhere; }
  .statistics-workspace .statistics-day-card dd { margin: 0; font-size: 16px; font-weight: 600; font-variant-numeric: tabular-nums; }
}
@media (max-width: 620px) {
  .statistics-workspace .statistics-filter-form { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px 10px; }
  .statistics-workspace .statistics-metric-field { grid-column: 1 / -1; }
  .statistics-workspace .statistics-filter-form button { grid-column: 1 / -1; }
  .statistics-workspace .statistics-shortcuts p { margin: 4px 0 0; width: 100%; }
  .statistics-workspace .statistics-export-actions { width: 100%; }
  .statistics-workspace .statistics-export-actions button { flex: 1; padding-inline: 10px; }
  .statistics-workspace .statistics-result-heading h2 { font-size: 19px; }
  .statistics-workspace .statistics-summary article { padding: 14px 10px; }
  .statistics-workspace .statistics-summary article > span { font-size: 12px; }
  .statistics-workspace .statistics-summary strong { font-size: 29px; }
  .statistics-workspace .statistics-summary p { gap: 4px; }
  .statistics-workspace .statistics-branch-totals { grid-template-columns: minmax(0, 1fr); }
  .statistics-workspace .statistics-pagination { justify-content: space-between; gap: 8px; }
  .statistics-workspace .statistics-pagination button { padding-inline: 12px; }
  .statistics-workspace .statistics-day-card dl { grid-template-columns: minmax(0, 1fr); }
}
@media print {
  @page { size: A4 portrait; margin: 14mm; }
  .statistics-workspace .statistics-screen, .statistics-workspace .site-header, .statistics-workspace footer { display: none !important; }
  .statistics-workspace[data-statistics-ready="true"] .statistics-print-report { display: block !important; color: #111; font-size: 10pt; line-height: 1.5; }
  .statistics-workspace:not([data-statistics-ready="true"]) .statistics-print-blocked { display: block !important; color: #111; }
  .statistics-workspace .statistics-print-report h1 { font-size: 19pt; margin: 0 0 8pt; }
  .statistics-workspace .statistics-print-report h2 { font-size: 13pt; margin: 16pt 0 8pt; break-after: avoid; }
  .statistics-workspace .statistics-print-report p { margin: 4pt 0; }
  .statistics-workspace .statistics-print-report table { width: 100%; border-collapse: collapse; margin: 8pt 0 12pt; }
  .statistics-workspace .statistics-print-report th, .statistics-workspace .statistics-print-report td { padding: 5pt 7pt; border: 1px solid #bbb; color: #111; background: #fff; text-align: left; white-space: normal; }
  .statistics-workspace .statistics-print-report thead { display: table-header-group; }
  .statistics-workspace .statistics-print-report tr { break-inside: avoid; page-break-inside: avoid; }
  .statistics-workspace .statistics-print-report :where(th, td):last-child { text-align: right; font-variant-numeric: tabular-nums; }
}
