/* Reports (view D) — screen layout, then the A4 print sheet. Tokens come from app.css. */

.d-reports { gap: 14px; }

/* tab strip: on a phone, a fade on the right says there are more tabs */
.tabs-wrap { position: relative; max-width: 100%; min-width: 0; }
.tabs-wrap::after {
  content: ''; position: absolute; top: 0; right: 0; bottom: 1px; width: 32px;
  pointer-events: none;
  background: linear-gradient(to left, var(--bg) 10%, transparent);
}
@media (min-width: 761px) {
  .tabs-wrap::after { display: none; }
}

/* controls: ward select and period chips */
.d-controls { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px 20px; }
.d-field { display: grid; gap: 4px; min-width: 0; }
.d-field select { min-width: 240px; }
.d-field .chips { gap: 8px; }

/* report wrapper */
.d-report { display: grid; gap: 14px; min-width: 0; }
.d-report-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 8px 16px; }
.d-report-head h2 { margin: 0; }
.d-period { margin: 2px 0 0; font-size: 14px; }
.d-actions { display: flex; flex-wrap: wrap; gap: 8px; }

/* plain-English summary */
.d-summary {
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 4px solid var(--primary);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 12px 16px;
}
.d-summary p { margin: 0 0 6px; font-size: 15px; max-width: 90ch; overflow-wrap: anywhere; }
.d-summary p:last-child { margin-bottom: 0; }

/* blocks (tables and charts) */
.d-block { display: grid; gap: 10px; min-width: 0; }
.d-block h3 { margin: 0; }
.d-note { margin: 0; font-size: 13px; color: var(--muted); overflow-wrap: anywhere; }
.d-scroll { overflow-x: auto; max-width: 100%; -webkit-overflow-scrolling: touch; }
.d-scroll svg { display: block; }

.d-alert { color: var(--alert); font-weight: 650; }
.d-warn { color: var(--warn); font-weight: 650; }

/* print heading is only shown when printing */
.d-print-head { display: none; }

@media (max-width: 760px) {
  .d-field { flex: 1 1 100%; }
  .d-field select { width: 100%; min-width: 0; }
  .d-report-head .d-actions { width: 100%; }
  .d-summary p { font-size: 14px; }
}

/* ---------- print: one active report, A4, no chrome ---------- */
@media print {
  @page { size: A4; margin: 14mm 12mm; }

  .d-screen-only { display: none !important; }

  .d-print-head { display: block; margin-bottom: 6mm; }
  .d-print-head h1 { font-size: 16pt; margin: 0 0 3px; }
  .d-print-head p { margin: 0 0 2px; font-size: 10pt; color: #333; }

  .d-report { gap: 8px; }
  .d-summary { box-shadow: none; border-color: #999; border-left-color: #333; page-break-inside: avoid; }
  .d-summary p { font-size: 11pt; }
  .d-block { page-break-inside: avoid; box-shadow: none; }
  .d-note { font-size: 9.5pt; color: #333; }
  .d-scroll { overflow: visible; }
  .d-scroll svg { min-width: 0 !important; width: 100% !important; }
  .d-alert, .d-warn { color: #000; text-decoration: underline; }

  .kpis { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .kpi { box-shadow: none; }
  .kpi-value { font-size: 16pt; }
  .table-wrap th { background: #eee; color: #000; }
  .table-wrap td, .table-wrap th { padding: 4px 6px; font-size: 9.5pt; }
}
