/* Individual report card, print stage (JS/features/okr-report-print.js): on-screen setup panel
   and ink-on-white document, read by the isolated preview `<iframe>` and the print document.
   Ink rules are unconditional, not in `@media print` (an iframe `srcdoc` renders on screen).
   Palette matches alt-okrs.css §11. No `size:` in `@page` (one canonical answer). */

/* ---------- on screen: the panel host ---------- */
.okr-report-print-panel{
  display:flex; flex-direction:column; gap:var(--a-3);
  min-width:0; padding-top:var(--a-2);
}
.okr-report-print-head{
  display:flex; flex-direction:column; gap:var(--a-2); min-width:0;
  padding-bottom:var(--a-2); border-bottom:1px solid var(--a-line-soft);
}
.okr-report-print-head .a-btn{ align-self:flex-start; }
.okr-report-print-head .a-hint{ margin:0; max-width:70ch; }

.okr-report-print-body{
  display:grid; grid-template-columns:260px minmax(0,1fr); gap:var(--a-4); min-width:0;
  align-items:start;
}
.okr-report-print-controls{
  display:flex; flex-direction:column; gap:6px; min-width:0;
  position:sticky; top:var(--a-2);
}
.okr-report-print-controls > .a-okr-lbl:not(:first-child){ margin-top:var(--a-2); }
.okr-report-print-controls > select.a-input{ margin:0 0 2px; }
.okr-report-print-actions{
  display:flex; flex-direction:column; gap:8px; margin-top:var(--a-3);
  padding-top:var(--a-3); border-top:1px solid var(--a-line-soft);
}

/* Preview: an `<iframe>` framed like a sheet. The wrap centres a fixed 816px page-width
   (framing only; the reader picks paper size in their print dialog). Uses `--a-shadow-sm`. */
.okr-report-print-previewwrap{
  display:flex; justify-content:center; align-items:flex-start;
  min-width:0; padding:var(--a-4);
  border:1px solid var(--a-line); border-radius:var(--a-r);
  background:var(--a-raised);
  overflow:auto; max-height:calc(100vh - 200px);
}
.okr-report-print-sheet{
  display:block; flex:0 0 auto;
  width:816px; max-width:100%;
  height:calc(100vh - 260px); min-height:520px;
  border:0; border-radius:2px; background:#fff;
  box-shadow:var(--a-shadow-sm);
}

/* ---------- responsive — phone width: controls stack above the preview ---------- */
@media (max-width:760px){
  .okr-report-print-body{ grid-template-columns:minmax(0,1fr); }
  .okr-report-print-controls{ position:static; }
  .okr-report-print-previewwrap{ padding:var(--a-3); max-height:calc(100vh - 260px); }
  .okr-report-print-sheet{ width:100%; height:calc(100vh - 320px); min-height:420px; }
}


@media print{

  /* The page margin — no `size:`, on the owner's own instruction (see header).
     16mm/14mm is CSS/okr-export.css's own binder-safe margin, reused verbatim. */
  @page{
    margin:16mm 14mm;
    @bottom-right{ content:"Page " counter(page) " of " counter(pages); font-size:8pt; color:#333; }
  }

  /* The panel's own chrome never prints — belt to the braces that only the
     staged document is ever unhidden for print. */
  .okr-report-print-panel{ display:none !important; }
}

/* The document itself: unconditional, self-contained, ink on white. Read by the iframe and the
   staged print document; unreachable from the rest of the app. */

.okr-report-print-page{ margin:0; background:#fff; color:#000; }

.okr-report-print{
  display:block; max-width:none;
  font-family:var(--a-body, -apple-system, sans-serif); font-size:11pt; line-height:1.4;
  color:#000; background:#fff;
}
/* The page margin, on screen only — `@page` above already reserves it on real
   paper; adding it again as padding would double it on an actual printed page. */
@media screen{
  .okr-report-print{ padding:16mm 14mm; }
}

/* ---------- the running frame — layer 1, identity that survives every real page ----------
   `<thead>`/`<tfoot>` repeat as a running header/footer across real pages; on
   screen, inside one continuously-scrolling preview, they simply render once. */
/* `table-layout:fixed`: an auto table sizes from cell content regardless of `width:100%` and
   grew past its box at narrow widths. Fixed lets the header text wrap. */
.okr-report-print .okr-report-print-frame{
  width:100%; table-layout:fixed; border-collapse:collapse;
}
@media print{
  .okr-report-print .okr-report-print-frame > thead{ display:table-header-group; }
  .okr-report-print .okr-report-print-frame > tfoot{ display:table-footer-group; }
}
/* `flex-wrap:wrap` and `min-width:0` on the two spans — a flex item otherwise
   refuses to shrink below its text's unwrapped width, forcing the whole
   document wider than its own box at narrow widths. */
.okr-report-print-runhead{
  display:flex; flex-wrap:wrap; justify-content:space-between; gap:2pt 10pt; align-items:baseline;
  padding:0 0 4pt; margin:0 0 8pt; border-bottom:1px solid #000;
  font-size:9pt; font-weight:700; color:#000; letter-spacing:.02em;
}
.okr-report-print-runhead > span{ min-width:0; overflow-wrap:anywhere; }
.okr-report-print-runfoot{
  padding:4pt 0 0; margin:8pt 0 0; border-top:1px solid #999;
  font-size:8pt; color:#333;
}

/* ---------- the identity block, page one ---------- */
.okr-report-print-id{ break-inside:avoid; page-break-inside:avoid; margin:0 0 12pt; }
.okr-report-print-id .a-okr-lbl{ font-size:9pt; }
.okr-report-print-id h1{ margin:2pt 0 4pt; font-size:20pt; line-height:1.2; font-weight:700; color:#000; }
.okr-report-print-email{ margin:0; font-size:10pt; color:#333; }
.okr-report-print-facts{
  margin:8pt 0 0; display:grid; gap:3pt 16pt;
  grid-template-columns:repeat(auto-fit, minmax(150pt, 1fr));
}
.okr-report-print-facts > div{ display:flex; gap:6pt; align-items:baseline; break-inside:avoid; }
.okr-report-print-facts dt{
  margin:0; font-size:9pt; font-weight:700; letter-spacing:.05em; text-transform:uppercase; color:#333;
}
.okr-report-print-facts dd{ margin:0; font-size:10pt; color:#000; overflow-wrap:anywhere; }

/* ---------- section rhythm — a heading that ends a page is a heading for nothing ---------- */
.okr-report-print-sec{ margin:0 0 12pt; }
.okr-report-print .a-okr-group-h{ margin:0; break-after:avoid; page-break-after:avoid; }
.okr-report-print h2{
  margin:0 0 5pt; font-size:13pt; line-height:1.25; font-weight:700; color:#000;
  border-bottom:1px solid #000; padding-bottom:3pt;
}
.okr-report-print h4{ margin:0; font-size:10.5pt; line-height:1.3; font-weight:700; color:#000; }
.okr-report-print .a-okr-lbl{
  font:700 9pt/1.4 var(--a-body, sans-serif); letter-spacing:.08em; text-transform:uppercase;
  color:#333; margin:0;
}
.okr-report-print-fig{ font-size:13pt; font-weight:700; }

/* ---------- a-okr-num — the shared figure class, everywhere it appears ---------- */
.okr-report-print .a-okr-num{
  font-family:var(--a-mono, monospace); font-variant-numeric:tabular-nums; color:#000;
}

/* a-okr-pill: health as a bordered text label, never a filled badge. Self-contained because
   the iframe never reaches alt-okrs.css; on real print its more specific selector wins. */
.okr-report-print .a-okr-pill{
  display:inline-flex; align-items:center; min-height:14pt; padding:1pt 6pt;
  border-radius:8pt; font:600 8.5pt/1.4 var(--a-body, sans-serif); white-space:nowrap;
  background:#fff; color:#000; border:1px solid #000;
  max-width:100%; overflow:hidden; text-overflow:ellipsis;
}

/* a-chip ("Pushed twice" and other plain facts): a complete rule for the same iframe reason
   (CSS/alt/alt-components.css is unreachable). #333 hairline, no meaning carried in colour,
   and it wraps like `.a-okr-th` since nowrap would widen its table column. */
.okr-report-print .a-chip{
  display:inline-flex; align-items:center; gap:4pt; min-height:12pt; padding:0.5pt 5pt;
  border-radius:8pt; font:600 8pt/1.35 var(--a-body, sans-serif); white-space:normal;
  background:#fff; color:#333; border:0.5pt solid #666;
  max-width:100%; overflow-wrap:anywhere;
}
/* Separated from the date it is about — `<td>` is not a flex container, so the
   gap must come from the chip itself. */
.okr-report-print .okr-report-print-push{ margin-left:4pt; }

/* a-okr-tscroll: screen-only safety net. This table never sets `min-width:max-content` and
   headers wrap, so `overflow-x:auto` is a backstop; paper cannot scroll. */
@media screen{
  .okr-report-print .a-okr-tscroll{ overflow-x:auto; max-width:100%; }
}

/* ---------- tables — the header repeats on real paper, nothing ever scrolls ---------- */
.okr-report-print table.a-okr-table{
  width:100%; min-width:0; table-layout:auto; border-collapse:collapse; margin:3pt 0 0;
}
@media print{
  .okr-report-print table.a-okr-table thead{ display:table-header-group; }
}
/* No `white-space:nowrap`: it forces the column to the whole phrase regardless of
   table-layout. alt-okrs.css keeps nowrap for its wide dark board; a narrow preview needs
   wrapping headers. */
.okr-report-print .a-okr-th{
  font:700 8pt/1.4 var(--a-body, sans-serif); letter-spacing:.06em; text-transform:uppercase;
  padding:3pt 5pt; text-align:left; color:#333;
  border-bottom:1px solid #000;
}
.okr-report-print .a-okr-tr{ border-bottom:1px solid #ccc; }
.okr-report-print .a-okr-tr:last-child{ border-bottom:0; }
.okr-report-print .a-okr-td{
  font-size:9pt; padding:3pt 5pt; vertical-align:top; overflow-wrap:anywhere; color:#000;
}
.okr-report-print .a-okr-th.num, .okr-report-print .a-okr-td.a-okr-num{ text-align:right; white-space:nowrap; }

/* Objectives: a left rule, not a boxed card. Not `.a-okr-card`, whose `break-inside:avoid`
   would push an over-tall objective to a fresh page. Heading and first rows are held with
   `break-after:avoid` plus the repeating `<thead>`. */
.okr-report-print .a-okr-group.okr-report-print-obj{
  display:block; margin:0 0 9pt; padding:0 0 6pt 8pt; border-left:2pt solid #000; border-bottom:0;
}
@media print{
  .okr-report-print .a-okr-group.okr-report-print-obj{ break-inside:auto; page-break-inside:auto; }
}
.okr-report-print-objh{ margin:0 0 3pt; }
.okr-report-print-objmeta{
  display:flex; align-items:center; flex-wrap:wrap; gap:3pt 8pt;
  margin:2pt 0 0; font-size:9pt; line-height:1.4; color:#000;
}
.okr-report-print-meta{ color:#333; }
.okr-report-print-desc{ margin:0 0 3pt; font-size:9.5pt; line-height:1.5; color:#333; max-width:78ch; }

/* Quarter groups: the "page break per quarter" toggle. Every group after the first in its
   section breaks; the first never does (same `:first-of-type` shape as okr-export.css). */
@media print{
  .okr-report-print.pagebreak-quarter .okr-report-print-qgroup{
    break-before:page; page-break-before:always;
  }
  .okr-report-print.pagebreak-quarter .okr-report-print-owned .okr-report-print-qgroup:first-of-type,
  .okr-report-print.pagebreak-quarter .okr-report-print-contributed .okr-report-print-qgroup:first-of-type{
    break-before:auto; page-break-before:auto;
  }
}
.okr-report-print-qh{ margin:0 0 4pt; font-size:9pt; letter-spacing:.08em; color:#333; }

/* ---------- the empty-state sentence (an honest zero is still a report) ---------- */
.okr-report-print .a-okr-empty{ font-size:9.5pt; color:#333; margin:0; }
