/* ============================================================
   Reports — a week, a month or your own dates: what was done
   per operation, field work, timber harvested, tickets, notes.
   rp- prefix. Colours are tokens only; the operation dots take
   the operation's own colour from the database.
   ============================================================ */

.rp-period-label { font-size: 15px; font-weight: 600; color: hsl(var(--muted-foreground)); margin-top: 4px; }

/* ── period picker ──────────────────────────────────────────────── */

.rp-controls { gap: var(--space-sm) var(--space-md); }
.rp-controls select.input { min-width: 200px; }
.rp-controls [hidden] { display: none !important; }
.rp-custom { display: flex; align-items: center; gap: var(--space-sm); flex-wrap: wrap; }
.rp-custom .input { width: auto; min-width: 150px; }
.rp-to { font-size: 13px; color: hsl(var(--muted-foreground)); }

.rp-note { font-size: 13px; color: hsl(var(--muted-foreground)); margin-top: 4px; line-height: 1.45; }
.rp-muted { font-size: 13.5px; color: hsl(var(--muted-foreground)); padding: var(--space-sm) 0; }
.rp-faint { color: var(--text-muted); font-size: 12px; }
.rp-sub {
  font-size: 11.5px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
  color: hsl(var(--muted-foreground)); margin: var(--space-lg) 0 var(--space-sm);
}
.rp-section-heading { margin-top: var(--space-xl); }

/* ── what was done, per operation ───────────────────────────────── */

.rp-op { padding-bottom: var(--space-md); }
.rp-op-head {
  display: flex; align-items: baseline; justify-content: space-between; gap: var(--space-sm) var(--space-md);
  flex-wrap: wrap; margin-bottom: var(--space-sm);
}
.rp-op-title { display: flex; align-items: center; gap: 10px; font-size: 17px; font-weight: 700; letter-spacing: -0.01em; }
.rp-op-title a:hover { color: var(--accent-ink); text-decoration: underline; text-underline-offset: 3px; }
.rp-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; border: 1px solid var(--line-strong); }
.rp-op-sum { font-size: 13px; color: hsl(var(--muted-foreground)); }

.rp-items { display: flex; flex-direction: column; }
.rp-item {
  display: flex; align-items: flex-start; justify-content: space-between; gap: var(--space-md);
  padding: 10px 0; min-height: 44px;
  border-top: 1px solid var(--line);
  color: inherit;
}
.rp-item:first-child { border-top: 0; }
.rp-item:hover .rp-item-title { color: var(--accent-ink); }
.rp-item-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.rp-item-title { font-size: 14px; font-weight: 600; line-height: 1.4; overflow-wrap: anywhere; }
.rp-item-meta { display: block; font-size: 12.5px; color: hsl(var(--muted-foreground)); line-height: 1.45; overflow-wrap: anywhere; }
.rp-item-side {
  display: flex; flex-direction: column; align-items: flex-end; gap: 2px; flex-shrink: 0;
  font-size: 12.5px; color: hsl(var(--muted-foreground)); white-space: nowrap; text-align: right;
}
.rp-projects { margin-top: var(--space-xs); }
.rp-project { padding: 8px 0; border-top: 1px solid var(--line); font-size: 14px; }
.rp-project:first-of-type { border-top: 0; }
.rp-op-foot {
  margin-top: var(--space-sm); padding-top: var(--space-sm); border-top: 1px dashed var(--line-strong);
  font-size: 13px; color: hsl(var(--muted-foreground));
}
.rp-op-foot a { color: var(--accent-ink); font-weight: 600; }
.rp-op-foot a:hover { text-decoration: underline; text-underline-offset: 2px; }

/* ── field work ─────────────────────────────────────────────────── */

.rp-activity { min-width: 220px; }
.rp-activity .lbl { font-size: 12px; margin-bottom: 4px; }
.rp-answer {
  background: var(--accent-tint); border: 1px solid var(--accent-line); border-radius: var(--radius-md);
  padding: 12px 14px; font-size: 14px; line-height: 1.5; margin-bottom: var(--space-lg);
}
.rp-answer strong { color: var(--ink); }
.rp-charts { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-lg); margin-bottom: var(--space-sm); }
.rp-charts[hidden] { display: none; }

table.rp-table { font-size: 13.5px; }
.rp-table th, .rp-table td { padding: 10px 12px; }
.rp-table td { vertical-align: top; white-space: nowrap; }
table.rp-table-sm { min-width: 380px; }
.rp-table td.rp-blocks { min-width: 200px; max-width: 300px; white-space: normal; font-size: 12.5px; line-height: 1.5; }
.chart-host.rp-chart-empty { min-height: 0; }
.rp-total-row td, .rp-table tfoot td { font-weight: 700; background: var(--canvas); }
.rp-table tfoot td { border-top: 1px solid var(--line); }
.rp-block-link:hover { color: var(--accent-ink); text-decoration: underline; text-underline-offset: 2px; }
.rp-running td { background: var(--warning-tint); }

/* ── timber and tickets ─────────────────────────────────────────── */

.rp-mini-figs { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: var(--space-sm); margin-bottom: var(--space-md); }
.rp-mini { background: var(--canvas); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 12px; }
.rp-mini-label { font-size: 11.5px; color: hsl(var(--muted-foreground)); text-transform: uppercase; letter-spacing: 0.04em; font-weight: 600; }
.rp-mini-value { font-size: 18px; font-weight: 700; letter-spacing: -0.01em; margin-top: 3px; font-variant-numeric: tabular-nums; }
.rp-split { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-lg); }
.rp-split:empty { display: none; }

.rp-note-by { margin-top: 4px; }
/* .btn and .panel set a display that outranks the hidden attribute. */
#add-note[hidden], #rp-notes-panel[hidden] { display: none; }

/* ── phones ─────────────────────────────────────────────────────── */

@media (max-width: 760px) {
  .rp-charts, .rp-split { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .rp-controls select.input, .rp-controls .rp-custom { flex: 1 1 100%; min-width: 0; width: 100%; }
  .rp-custom .input { flex: 1 1 130px; min-width: 0; }
  .rp-custom .btn { flex: 1 1 100%; min-height: 44px; }
  .rp-activity { min-width: 0; width: 100%; }
  .rp-item { gap: var(--space-sm); }
  .rp-item-side { max-width: 40%; white-space: normal; }
  .report-grid.rp-figs { grid-template-columns: 1fr 1fr; gap: var(--space-sm); }
  .rp-figs .report-figure { padding: var(--space-md); }
  .rp-figs .report-figure-value { font-size: 24px; }
  .rp-figs .report-figure-label { font-size: 11px; letter-spacing: 0.06em; }
}

/* ── print: the report is meant to be handed over ───────────────── */

@media print {
  .rp-controls, .rp-activity, #add-note { display: none !important; }
  .rp-op, .rp-field, .rp-timber, .rp-tickets { break-inside: auto; }
  .rp-item, .rp-table tr, .rp-mini { break-inside: avoid; }
  .rp-answer { background: none; }
  .table-wrap { overflow: visible; border: 0; }
  table.data-table, table.rp-table-sm { min-width: 0; }
  .rp-period-label { color: var(--ink); }
}
