/* ============================================================================
   brief.css — Screen 5, the Forecast Brief. A document-like one-pager that reads
   as print-ready on screen, plus an @media print fallback so File → Print yields
   a clean result when server-side PDF rendering is unavailable.
   ========================================================================== */

.brief-screen {
  max-width: var(--page-max);
  margin: 0 auto;
  padding: var(--s-5) var(--page-pad) var(--s-7);
}

/* ---- Toolbar (screen only) ----------------------------------------------- */

.brief-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--s-3); flex-wrap: wrap;
  margin-bottom: var(--s-4);
}
.brief-toolbar .bt-left { display: flex; align-items: center; gap: var(--s-3); }
.brief-toolbar .bt-back {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 13px; color: var(--athera-grey);
}
.brief-toolbar .bt-back:hover { color: var(--athera-charcoal); text-decoration: none; }
.brief-toolbar .bt-back .arrow { font-family: var(--athera-mono); }

.brief-toolbar .bt-actions { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.brief-toolbar .bt-icon { font-size: 13px; line-height: 1; }
.btn.is-copied { border-color: var(--athera-blue-deep); color: var(--athera-blue-deep); }
.bt-history-toggle { letter-spacing: 0.04em; }

/* ---- Previous runs panel (screen only) ----------------------------------- */

.brief-history {
  border: 1px solid var(--athera-line);
  border-radius: var(--radius);
  background: var(--athera-white);
  padding: var(--s-3);
  margin-bottom: var(--s-4);
}
.brief-history .bh-head {
  display: flex; align-items: baseline; gap: 14px;
  padding-bottom: 12px; margin-bottom: 8px;
  border-bottom: 1px solid var(--athera-line-light);
}
.brief-history .bh-hint { color: var(--athera-grey-light); }
.brief-history .bh-list { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }

.bh-row {
  display: flex; flex-direction: column; gap: 6px;
  text-align: left; cursor: pointer;
  padding: 12px 14px;
  border: 1px solid var(--athera-line);
  border-radius: var(--radius-sm);
  background: var(--athera-off-white);
  transition: border-color var(--ease), background var(--ease);
}
.bh-row:hover:not(:disabled) { border-color: var(--athera-charcoal-light); background: var(--athera-white); }
.bh-row.is-current { border-color: var(--athera-blue-deep); background: rgba(95, 184, 214, 0.06); cursor: default; }
.bh-row:disabled { cursor: default; }
.bh-row-main { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.bh-when { font-size: 13px; color: var(--athera-charcoal); display: inline-flex; align-items: center; gap: 8px; }
.bh-tag {
  font-family: var(--athera-mono); font-size: 9px; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--athera-blue-deep); border: 1px solid rgba(42, 143, 176, 0.3);
  border-radius: 999px; padding: 1px 7px;
}
.bh-scope { font-size: 11px; color: var(--athera-grey-light); }
.bh-row-meta { font-size: 11px; color: var(--athera-grey); }

/* ---- The paper ----------------------------------------------------------- */

.brief-stage { display: flex; justify-content: center; }

.brief-paper {
  width: 100%;
  max-width: 820px;
  background: var(--athera-white);
  border: 1px solid var(--athera-line);
  border-radius: var(--radius);
  padding: 64px 72px 56px;
  color: var(--athera-charcoal);
}
.brief-paper.bp-state { padding: var(--s-6) 72px; color: var(--athera-grey); }

/* Masthead */
.bp-masthead { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s-3); }
.bp-masthead .bp-eyebrow { color: var(--athera-grey-light); }
.bp-rule { margin: 18px 0 28px; }

/* Title + meta */
.bp-title-block { margin-bottom: var(--s-5); }
.bp-title { margin: 0 0 18px; color: var(--athera-charcoal); max-width: 22ch; }
.bp-meta { color: var(--athera-grey); font-size: 11px; line-height: 1.5; }
.bp-meta .bp-meta-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 5px; }
.bp-meta .bp-meta-row:first-child { margin-top: 0; }
.bp-meta .bp-dot { color: var(--athera-line-strong); }

/* Sections */
.bp-section { margin-bottom: var(--s-5); }
.bp-section-label { margin-bottom: 16px; display: block; }

.bp-summary .bp-lead {
  font-family: var(--athera-sans);
  font-size: 17px; font-weight: 300; line-height: 1.7;
  color: var(--athera-charcoal-light);
  margin: 0;
  max-width: 64ch;
}

/* Point lists (demand changes, risks) */
.bp-points { list-style: none; margin: 0; padding: 0; }
.bp-point { display: flex; gap: 14px; padding: 9px 0; border-bottom: 1px solid var(--athera-line-light); }
.bp-point:last-child { border-bottom: none; }
.bp-marker { color: var(--athera-blue-deep); font-family: var(--athera-mono); flex: 0 0 auto; line-height: 1.6; }
.bp-point-text { font-size: 15px; line-height: 1.6; color: var(--athera-charcoal); }

/* Recommended actions, by team */
.bp-action-groups { display: grid; gap: var(--s-4); }
.bp-team { }
.bp-team-head {
  display: flex; align-items: baseline; gap: 12px;
  padding-bottom: 8px; margin-bottom: 12px;
  border-bottom: 1px solid var(--athera-line);
}
.bp-team-name { color: var(--athera-charcoal); }
.bp-team-count { color: var(--athera-grey-light); }
.bp-team-actions { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.bp-action { }
.bp-action-head { display: flex; align-items: baseline; gap: 12px; margin-bottom: 3px; }
.bp-action-title { font-size: 14px; font-weight: 500; color: var(--athera-charcoal); }
.bp-action-detail { margin: 0; font-size: 14px; line-height: 1.6; color: var(--athera-charcoal-light); max-width: 64ch; }
.bp-urgency {
  font-family: var(--athera-mono); font-size: 9px; letter-spacing: 0.08em; text-transform: uppercase;
  padding: 1px 8px; border-radius: 999px; border: 1px solid var(--athera-line);
  color: var(--athera-grey);
}
.bp-urgency.u-high { color: var(--athera-amber); border-color: rgba(200, 149, 90, 0.35); }

/* Assumptions & data sources */
.bp-foot-cols { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-4); }
.bp-foot-col .athera-label { display: block; margin-bottom: 12px; }
.bp-mono-list { list-style: none; margin: 0; padding: 0; }
.bp-mono-list li {
  font-size: 11px; line-height: 1.55; color: var(--athera-grey);
  padding: 5px 0 5px 14px; position: relative;
}
.bp-mono-list li::before {
  content: "·"; position: absolute; left: 2px; color: var(--athera-blue-deep);
}

/* Disclaimer */
.bp-disclaimer {
  border: 1px solid var(--athera-line);
  border-left: 2px solid var(--athera-grey-light);
  border-radius: var(--radius-sm);
  background: var(--athera-off-white);
  padding: 16px 20px;
  margin: var(--s-4) 0 var(--s-5);
}
.bp-disclaimer .athera-label { display: block; margin-bottom: 6px; }
.bp-disclaimer-text { margin: 0; font-size: 12.5px; line-height: 1.6; color: var(--athera-charcoal-light); }

/* Document footer */
.bp-footer {
  display: flex; align-items: flex-start; gap: 14px;
  padding-top: var(--s-3); border-top: 1px solid var(--athera-line);
  color: var(--athera-grey);
}
.bp-footer .bp-footer-text { font-size: 12px; color: var(--athera-charcoal-light); }
.bp-footer .bp-footer-sub { font-size: 10px; color: var(--athera-grey-light); margin-top: 3px; }

@media (max-width: 720px) {
  .brief-paper { padding: 40px 28px 36px; }
  .brief-history .bh-list, .bp-foot-cols { grid-template-columns: 1fr; }
}

/* ============================================================================
   Print fallback — File → Print yields a clean one-pager even without puppeteer.
   Hides the app shell and toolbar; the paper becomes the page.
   ========================================================================== */

@media print {
  @page { size: A4; margin: 18mm; }

  html, body { background: #fff !important; }
  .app-header, .app-footer, .brief-toolbar, .brief-history { display: none !important; }
  .app-main, .brief-screen, .brief-stage { display: block !important; margin: 0 !important; padding: 0 !important; }
  .screen-enter { animation: none !important; }

  .brief-paper {
    max-width: none; width: auto;
    border: none; border-radius: 0;
    padding: 0;
  }

  /* Keep sections and team blocks from splitting awkwardly across pages. */
  .bp-section, .bp-team, .bp-action, .bp-disclaimer { break-inside: avoid; }
  .bp-masthead, .bp-title-block { break-after: avoid; }

  /* Print colours faithfully. */
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
