/* Monthly reports and weekly recaps: the report document (portal, preview, print, PDF), the client's
   Monthly Reports tab, and the admin review editor. Base report styles (.report-doc, .report-section,
   .report-narrative, .report-note, .num-warning, print rules) live in app.css. */

/* ── Report document ─────────────────────────────────────────────────────── */
/* A report inside an admin page (the review editor) in the client's look: the colors come inline
   (clientThemeStyle), the fonts go back to the portal's instead of the agency's. */
.client-theme { --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; --font-heading: var(--font); font-family: var(--font); }
.report-cover .report-cover__title { font-size: 28px; }
.report-cover__text { min-width: 0; }
.report-cover__kicker { margin: 0 0 4px; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; color: var(--brand); }
.report-cover__meta { margin: 8px 0 2px; color: var(--text-2); font-size: 14px; }
.report-cover__period { margin: 0; color: var(--text-3); font-size: 13px; }
.report-cover__draft { margin: 10px 0 0; font-size: 13px; color: var(--text-2); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.report-cover__brand { flex-shrink: 0; color: var(--brand); }
.report-doc--review { padding: 28px 32px; margin-bottom: 16px; }
.report-doc--review .report-cover { margin-bottom: 0; }
.report-doc--review .report-footer { margin-top: 0; border-top: 0; padding-top: 0; }

.report-toc { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px 16px; margin: 0 0 28px; }
.report-toc__title { margin: 0 0 6px; font-size: 12px; font-weight: 600; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.06em; }
.report-toc ol { margin: 0; padding-left: 20px; font-size: 14px; }
.report-toc--columns ol { columns: 2; column-gap: 24px; }
.report-toc li { break-inside: avoid; padding: 2px 0; }

.report-narrative ul, .report-narrative ol { margin: 0 0 12px; padding-left: 22px; }
.report-narrative li { margin-bottom: 4px; }
.report-narrative p:last-child, .report-narrative ul:last-child { margin-bottom: 0; }
.report-note__label { margin: 0 0 4px; font-size: 12px; font-weight: 600; color: var(--brand); text-transform: uppercase; letter-spacing: 0.05em; }
.report-note__body p:last-child { margin-bottom: 0; }
.num-warning { padding: 0 2px; border-radius: 2px; color: inherit; }

.report-footer__block { margin-bottom: 12px; }
.report-footer__title { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-2); margin: 0 0 4px; }
.report-footer ul { margin: 0; padding-left: 18px; }
.report-footer__meta { margin: 0 0 10px; }
.report-footer__powered { display: flex; align-items: center; gap: 8px; margin: 0; }
.report-footer__powered img { height: 18px; width: auto; opacity: 0.85; }

.report-actions { max-width: 920px; margin: 0 auto 16px; display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }

/* ── Client: Monthly Reports tab ─────────────────────────────────────────── */
.report-cards { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; max-width: 920px; }
.report-card { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; padding: 16px 20px; background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--brand); border-radius: var(--radius); box-shadow: var(--shadow); }
.report-card__title { font-size: 17px; margin-bottom: 2px; }
.report-card__title a { color: var(--text); }
.report-card__text p { margin: 0; }
.report-card__actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ── Print view (and the PDF) ────────────────────────────────────────────── */
.print-bar { max-width: 920px; margin: 16px auto; padding: 12px 16px; display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; background: var(--info-bg); border: 1px solid #bfdbfe; border-radius: var(--radius-sm); color: #1e3a8a; font-size: 13px; }
.print-bar p { margin: 0; }
.report-print { padding: 0 16px 32px; }
body.print-mode .report-doc { margin: 0 auto; max-width: 920px; }

@media print {
  .print-bar, .report-actions, .report-toc { display: none !important; }
  .report-print { padding: 0; }
  .report-cover { break-after: avoid; }
  .report-section > h2 { break-after: avoid; }
  .report-narrative, .report-note { break-inside: avoid; }
  .report-section { break-inside: auto; }
  .report-widgets .card { break-inside: avoid; }
  .num-warning { background: none; border: 0; }
}

/* ── Admin: agency matrix and a client's reports ─────────────────────────── */
/* Wide enough for "September 2026 (in review)"; the full width on a phone. */
.draft-form .draft-form__month { width: auto; min-width: 16rem; max-width: 100%; }
@media (max-width: 520px) { .draft-form .draft-form__month { width: 100%; min-width: 0; } }
.report-matrix th[scope="row"] { font-weight: 600; color: var(--text); font-size: 13px; white-space: nowrap; }
.report-matrix th[scope="row"] .badge { margin-left: 6px; }
.report-cell { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

.recap-generate { margin-bottom: 12px; }
.recap-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.recap { border-top: 1px solid var(--border); padding-top: 12px; }
.recap__head { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; margin-bottom: 6px; }
.recap__text { font-family: var(--mono); font-size: 12.5px; background: var(--surface-2); margin-bottom: 4px; }

/* ── Admin: review editor ────────────────────────────────────────────────── */
.report-review { display: flex; flex-direction: column; gap: 16px; }
.review-summary__row { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.review-summary__status { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.review-summary__actions { display: flex; gap: 8px; flex-wrap: wrap; }
.review-notice { margin: 12px 0 0; }
.review-warnings { margin-top: 12px; padding: 10px 14px; border: 1px solid #fcd34d; background: var(--warn-bg); color: #78350f; border-radius: var(--radius-sm); font-size: 13px; }
.review-warnings p { margin: 0 0 6px; }
.review-warnings ul { margin: 0; padding-left: 18px; }
.review-warnings a { color: #78350f; text-decoration: underline; }
.publish-form { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--border); display: flex; gap: 8px 16px; align-items: center; flex-wrap: wrap; }
.publish-form .check { margin: 0; }

.review-layout { display: grid; grid-template-columns: minmax(0, 1fr) 260px; gap: 16px; align-items: start; }
.review-main { min-width: 0; display: flex; flex-direction: column; gap: 16px; }
.review-main .report-doc { max-width: none; margin-left: 0; margin-right: 0; }
.review-side { position: sticky; top: 16px; display: flex; flex-direction: column; gap: 16px; }
.review-side__title { font-size: 13px; margin-bottom: 8px; }
.review-toc ol { margin: 0; padding-left: 18px; font-size: 13px; }
.review-toc li { padding: 2px 0; }
.review-toc li .badge { margin-left: 4px; }
.review-toc li.is-hidden a { color: var(--text-3); }
.revision-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; font-size: 13px; }
.revision-list li { border-bottom: 1px solid #f1f2f4; padding-bottom: 8px; }
.revision-list li:last-child { border-bottom: 0; }
.revision-list form { margin-top: 2px; }

.section-editor { scroll-margin-top: 16px; }
.section-editor.is-hidden { opacity: 0.72; }
.section-editor__head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; padding: 14px 16px 0; }
.section-editor__head h2 { font-size: 17px; }
.section-editor__badges { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.section-editor__body { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; padding: 14px 16px; }
.section-editor__label { margin: 0 0 6px; font-size: 12px; font-weight: 600; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.05em; }
.section-editor__preview { border-left: 1px solid var(--border); padding-left: 20px; min-width: 0; }
.section-editor__preview .report-narrative { font-size: 14px; }
.section-form textarea[name="text"] { min-height: 160px; font-size: 13.5px; }
.widget-toggles { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 8px 12px 2px; margin: 0 0 12px; }
.widget-toggles legend { font-size: 13px; font-weight: 500; color: var(--text-2); padding: 0 4px; }
.autosave-status.is-error { color: var(--bad); }
.rewrite-form { display: flex; gap: 8px; align-items: flex-end; flex-wrap: wrap; padding: 0 16px 14px; }
.rewrite-form .field { flex: 1; min-width: 220px; margin-bottom: 0; }
.rewrite-form .btn { margin-bottom: 0; }
.section-editor__widgets { border-top: 1px solid var(--border); padding: 14px 16px 16px; background: var(--surface-2); border-radius: 0 0 var(--radius) var(--radius); }
.section-editor__widgets .report-widgets { margin: 0; }

.report-preview__hint { max-width: 920px; margin: 0 auto 12px; font-size: 12px; }

@media (max-width: 1100px) {
  .review-layout { grid-template-columns: 1fr; }
  .review-side { position: static; order: -1; }
}
@media (max-width: 860px) {
  .section-editor__body { grid-template-columns: 1fr; }
  .section-editor__preview { border-left: 0; padding-left: 0; border-top: 1px solid var(--border); padding-top: 14px; }
  .report-toc--columns ol { columns: 1; }
  .report-cover { flex-direction: column-reverse; }
  .report-doc--review { padding: 20px 16px; }
  .report-card { padding: 14px 16px; }
}
.recap-settings { display: flex; gap: 8px 16px; align-items: flex-end; flex-wrap: wrap; padding-bottom: 12px; margin-bottom: 12px; border-bottom: 1px solid var(--border); }
.recap-settings fieldset { border: 0; margin: 0; padding: 0; }
.report-row-actions { display: inline-flex; gap: 6px; align-items: center; justify-content: flex-end; }

/* KPI tiles in a report are narrower than on a dashboard: let long labels wrap instead of cutting them off. */
.report-widgets .kpi__label { white-space: normal; flex-wrap: wrap; align-items: flex-start; row-gap: 2px; }
