/* ==========================================================================
   REPORT.CSS — analysis document design system
   --------------------------------------------------------------------------
   A stylesheet for long-form analysis documents, business cases and briefs.

   Design intent: a clean-room worksheet. Wafer-grey paper, ink-black text,
   photolithography amber as the single accent, monospace for anything
   instrumental (headings, labels, figures) and sans for prose. Hairline
   rules instead of boxes and shadows. Nothing decorative.

   USAGE
     <link rel="stylesheet" href="report.css">
     <link href="https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500;600&family=IBM+Plex+Sans:wght@400;500;600&display=swap" rel="stylesheet">

   STRUCTURE
     .wrap                 page container
       header.hero         title block
       section             numbered section
         .sec-head         section heading row
         .body             indented section content

   Class aliases are provided throughout so documents written against
   earlier versions (.idea / .gap / .pick / .layer, .econ / .score) continue
   to work. Prefer the canonical names in new work: .block and .stat-grid.
   ========================================================================== */


/* --------------------------------------------------------------------------
   1. TOKENS
   -------------------------------------------------------------------------- */

:root {
  /* Surfaces */
  --wafer:       #EDEEEA;   /* page background */
  --wafer-2:     #F7F8F5;   /* raised panels, table zebra, cards */

  /* Ink */
  --ink:         #12161B;   /* primary text */
  --ink-2:       #4A5560;   /* secondary text, labels */
  --rule:        #CFD3CB;   /* hairlines, borders */

  /* Accents — use sparingly, one meaning each */
  --amber:       #D8A012;   /* the accent: section numbers, emphasis */
  --amber-soft:  #FBF0D2;   /* callout background */
  --amber-line:  #E8D9A8;   /* callout border */
  --amber-text:  #8A6A0B;   /* callout label text */

  --indigo:      #243A6B;   /* focus rings, secondary accent */

  --red:         #9C2B1E;   /* negative values, warnings */
  --red-soft:    #F7E6E3;
  --red-line:    #E6C3BC;

  --green:       #2F6B4F;   /* positive values, good outcomes */
  --green-soft:  #EAF3ED;
  --green-line:  #BFD9C9;

  /* Type */
  --mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --sans: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;

  /* Layout */
  --measure:     67ch;      /* max prose width */
  --page:        920px;     /* container width; 880 narrow, 980 wide tables */
  --indent:      28px;      /* section body indent */
}


/* --------------------------------------------------------------------------
   2. BASE
   -------------------------------------------------------------------------- */

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--wafer);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.58;
}

p { margin: 0 0 12px; max-width: var(--measure); }

a { color: var(--indigo); text-underline-offset: 2px; }

code {
  font-family: var(--mono);
  font-size: 0.9em;
  background: #E3E5DF;
  padding: 1px 4px;
}

pre {
  font-family: var(--mono);
  font-size: 12.5px;
  background: var(--wafer-2);
  border: 1px solid var(--rule);
  border-left: 3px solid var(--rule);
  padding: 13px 15px;
  overflow-x: auto;
  line-height: 1.6;
}

:focus-visible { outline: 2px solid var(--indigo); outline-offset: 2px; }


/* --------------------------------------------------------------------------
   3. LAYOUT
   -------------------------------------------------------------------------- */

.wrap { max-width: var(--page); margin: 0 auto; padding: 0 24px 100px; }
.wrap--narrow { max-width: 880px; }
.wrap--wide   { max-width: 980px; }

header.hero { padding: 52px 0 30px; border-bottom: 1px solid var(--rule); }

section { padding: 36px 0 10px; border-bottom: 1px solid var(--rule); }
section:last-of-type { border-bottom: 0; }

.sec-head { display: flex; gap: 16px; align-items: baseline; margin-bottom: 14px; }

/* Section number — the amber marker down the left edge of the document */
.sec-n {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .1em;
  color: var(--amber);
  padding-top: 4px;
}

/* Indents section content to align under the heading text, not the number */
.body { margin-left: var(--indent); }

footer {
  padding: 32px 0;
  color: var(--ink-2);
  font-size: 13.5px;
  max-width: 64ch;
}


/* --------------------------------------------------------------------------
   4. TYPOGRAPHY
   -------------------------------------------------------------------------- */

h1 {
  font-family: var(--mono);
  font-weight: 600;
  font-size: clamp(26px, 4.6vw, 40px);
  line-height: 1.1;
  letter-spacing: -.02em;
  margin: 14px 0 16px;
}

h2 { font-family: var(--mono); font-weight: 600; font-size: 19px; margin: 0; }

h3 { font-family: var(--mono); font-weight: 600; font-size: 17px; margin: 0 0 6px; }

/* Small uppercase label used above groups within a block */
h4 {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--ink-2);
  margin: 24px 0 8px;
}

/* Kicker above the h1 — document type, date, status */
.eyebrow {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--ink-2);
}

/* Standfirst paragraph under the h1 */
.lede { color: var(--ink-2); max-width: 64ch; }

/* Explanatory line under a section heading or block title */
.sub, .sec-note { font-size: 13.5px; color: var(--ink-2); max-width: 64ch; margin: 0 0 15px; }
.sec-note { margin-left: var(--indent); margin-bottom: 22px; }

ul.plain, ol { margin: 0 0 14px; padding-left: 20px; max-width: var(--measure); }
ul.plain li { margin: 7px 0; }
ol { padding-left: 22px; }
ol li { margin: 9px 0; }


/* --------------------------------------------------------------------------
   5. VALUE UTILITIES
   Apply to any figure. .num forces tabular monospace so columns align.
   -------------------------------------------------------------------------- */

.num  { font-family: var(--mono); font-size: 12.5px; white-space: nowrap; }
.ok   { color: var(--green); font-weight: 600; }
.warn { color: var(--amber-text); font-weight: 600; }
.bad  { color: var(--red); font-weight: 600; }


/* --------------------------------------------------------------------------
   6. CALLOUTS
   Three severities. Default (amber) = notable. .good = opportunity.
   .hard = risk, blocker or bad news. One per idea; they lose force in runs.
   -------------------------------------------------------------------------- */

.callout {
  background: var(--amber-soft);
  border: 1px solid var(--amber-line);
  padding: 15px 17px;
  margin: 0 0 18px;
}
.callout.good { background: var(--green-soft); border-color: var(--green-line); }
.callout.hard { background: var(--red-soft);   border-color: var(--red-line); }

.callout .tag {
  display: block;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--amber-text);
  margin-bottom: 7px;
}
.callout.good .tag { color: var(--green); }
.callout.hard .tag { color: var(--red); }

.callout p:last-child { margin: 0; }


/* --------------------------------------------------------------------------
   7. TABLES
   Wrap every table in .tw so it scrolls rather than breaking the layout.
   -------------------------------------------------------------------------- */

.tw { overflow-x: auto; }

table { border-collapse: collapse; width: 100%; font-size: 13px; margin: 0 0 14px; }
table.wide { min-width: 700px; }

th {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  text-align: left;
  color: var(--ink-2);
  border-bottom: 1px solid var(--ink);
  padding: 0 9px 7px;
  vertical-align: bottom;
}

td { border-bottom: 1px solid var(--rule); padding: 9px; vertical-align: top; }
td:first-child { font-family: var(--mono); font-size: 12px; }

/* Secondary prose cell — dims commentary so figures stay dominant */
td.note { color: var(--ink-2); font-size: 12.5px; min-width: 240px; }

/* Emphasised final row */
tr.total td { border-bottom: 2px solid var(--ink); font-weight: 600; background: var(--wafer-2); }

/* Full-width category divider inside a long table */
tr.catrow td {
  background: var(--wafer-2);
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--amber);
  padding: 11px 9px 6px;
}


/* --------------------------------------------------------------------------
   8. STAT GRID
   Row of key figures. Hairline gaps via background bleed, no borders.
   Aliases: .econ .score .legend
   -------------------------------------------------------------------------- */

.stat-grid, .econ, .score, .legend {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(145px, 1fr));
  gap: 1px;
  background: var(--rule);
  border: 1px solid var(--rule);
  margin: 0 0 16px;
}
.legend { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }

.stat, .e, .s, .lg { background: var(--wafer-2); padding: 11px 13px; }

.stat .k, .e .k, .s .k, .lg .k {
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--ink-2);
}
.lg .k { color: var(--amber); font-weight: 600; font-size: 10.5px; letter-spacing: .08em; }

.stat .v, .e .v, .s .v {
  font-family: var(--mono);
  font-size: 14px;
  font-weight: 600;
  margin-top: 3px;
}
.s .v { font-size: 15px; }

.stat .v.good, .e .v.good, .s .v.good { color: var(--green); }
.stat .v.warn, .e .v.warn, .s .v.warn { color: var(--amber-text); }
.stat .v.bad,  .e .v.bad,  .s .v.bad  { color: var(--red); }

.lg .d, .stat .d { font-size: 12.5px; color: var(--ink-2); margin-top: 3px; }


/* --------------------------------------------------------------------------
   9. BLOCK
   The main content unit: an accented left rule, a rank tag, a title.
   Aliases: .idea .gap .pick .layer .proj
   Accent variants: --good (green) --alt (indigo) --warn (amber) --bad (red)
   Legacy variants: .a .g1 .l2 .p1 = green, .b .g2 .l3 .p2 = indigo, etc.
   -------------------------------------------------------------------------- */

.block, .idea, .gap, .pick, .layer, .proj {
  border-left: 3px solid var(--rule);
  padding: 4px 0 4px 20px;
  margin: 0 0 38px;
}

.block--good, .idea.a, .gap.g1, .pick.a, .layer.l2, .proj.p1 { border-left-color: var(--green); }
.block--alt,  .idea.b, .gap.g2, .pick.b, .layer.l3, .proj.p2 { border-left-color: var(--indigo); }
.block--warn, .idea.c, .gap.g3, .pick.c, .layer.l1, .proj.p3 { border-left-color: var(--amber); }
.block--bad,  .idea.d, .gap.g4, .pick.d                       { border-left-color: var(--red); }

/* Rank / status tag at the top of a block */
.tag-rank, .rank, .tagline, .block .n, .layer .n {
  display: inline-block;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .1em;
  padding: 2px 7px;
  margin-bottom: 9px;
  color: #fff;
  background: var(--ink);
}

.block--good .tag-rank, .block--good .rank, .block--good .tagline,
.idea.a .rank, .idea.a .tagline, .gap.g1 .rank, .pick.a .tagline, .layer.l2 .n { background: var(--green); }

.block--alt .tag-rank, .block--alt .rank, .block--alt .tagline,
.idea.b .rank, .idea.b .tagline, .gap.g2 .rank, .pick.b .tagline, .layer.l3 .n { background: var(--indigo); }

.block--warn .tag-rank, .block--warn .rank, .block--warn .tagline,
.idea.c .rank, .idea.c .tagline, .gap.g3 .rank, .pick.c .tagline, .layer.l1 .n { background: var(--amber); color: var(--ink); }

.block--bad .tag-rank, .block--bad .rank, .block--bad .tagline,
.idea.d .rank, .gap.g4 .rank { background: var(--red); }

/* Footnote line at the bottom of a block */
.flag {
  font-size: 12.5px;
  color: var(--ink-2);
  border-top: 1px solid var(--rule);
  padding-top: 9px;
  margin-top: 4px;
}
.flag b {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--amber);
}


/* --------------------------------------------------------------------------
   10. PROBLEM / KILL BLOCKS
   Red-ruled panels for risks, blockers and stop conditions.
   -------------------------------------------------------------------------- */

.prob, .kill {
  background: var(--wafer-2);
  border-left: 3px solid var(--red);
  padding: 13px 16px;
  margin: 0 0 14px;
}
.prob { border: 1px solid var(--rule); border-left: 3px solid var(--red); }

.prob .n, .kill .t {
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--red);
  margin-bottom: 6px;
  background: none;
  padding: 0;
  display: block;
}
.prob p, .kill p { margin: 0 0 8px; font-size: 14px; }
.prob p:last-child, .kill p:last-child { margin: 0; }


/* --------------------------------------------------------------------------
   11. RECEIPT
   Monospace figure list with a ruled total. For cost breakdowns and
   worked examples. Alias: .mock
   -------------------------------------------------------------------------- */

.receipt, .mock {
  background: var(--wafer-2);
  border: 1px solid var(--rule);
  padding: 16px 18px;
  margin: 0 0 16px;
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.75;
}

.receipt .row, .mock .row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--rule);
  padding: 3px 0;
}
.receipt .row:last-child, .mock .row:last-child { border-bottom: 0; }

.receipt .row.big, .mock .row.big {
  border-top: 2px solid var(--ink);
  border-bottom: 0;
  margin-top: 6px;
  padding-top: 8px;
  font-weight: 600;
}

.receipt .hid, .mock .hid { color: var(--red); }

.receipt .cta, .mock .cta {
  margin-top: 13px;
  padding-top: 11px;
  border-top: 1px dashed var(--rule);
  font-family: var(--sans);
  font-size: 13.5px;
  color: var(--ink-2);
}


/* --------------------------------------------------------------------------
   12. TIMELINE / STEP ROWS
   Two-column rows: an amber monospace marker and its content.
   Aliases: .tl (date) .week (phase)
   -------------------------------------------------------------------------- */

.timeline { margin: 0 0 18px; }

.tl, .week { display: grid; grid-template-columns: 130px 1fr; border-bottom: 1px solid var(--rule); }
.week { grid-template-columns: 110px 1fr; }

.tl .d, .week .w {
  font-family: var(--mono);
  font-size: 11.5px;
  font-weight: 600;
  color: var(--amber);
  padding: 11px 12px 11px 0;
}
.tl .c, .week .c { padding: 11px 0; font-size: 13.5px; }


/* --------------------------------------------------------------------------
   13. FORM CONTROLS
   For questionnaires and fillable documents.
   -------------------------------------------------------------------------- */

textarea, input[type="text"], input[type="email"], input[type="number"] {
  width: 100%;
  font-family: var(--sans);
  font-size: 14.5px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--wafer-2);
  border: 1px solid var(--rule);
  padding: 11px 13px;
  transition: border-color .15s, background .15s;
}

textarea {
  min-height: 76px;
  resize: vertical;
  border-left: 3px solid var(--rule);
}
textarea:focus { background: #fff; border-left-color: var(--amber); }
textarea.filled { border-left-color: var(--amber); }
textarea.short { min-height: 46px; }

/* Label-and-field row */
.field {
  display: grid;
  grid-template-columns: 190px 1fr;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--rule);
}
.field label {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--ink-2);
}
.field input { border: 0; background: transparent; padding: 9px 6px; font-size: 14px; }
.field input:focus { background: #fff; }

/* Radio / checkbox list */
.choices { display: grid; border: 1px solid var(--rule); background: var(--wafer-2); }
.choice {
  display: flex;
  gap: 11px;
  align-items: flex-start;
  padding: 11px 14px;
  cursor: pointer;
  border-bottom: 1px solid var(--rule);
}
.choice:last-child { border-bottom: 0; }
.choice:hover { background: #fff; }
.choice input { margin: 4px 0 0; accent-color: var(--indigo); flex: 0 0 auto; }


/* --------------------------------------------------------------------------
   14. STICKY BAR
   Toolbar for filters, progress readouts and actions.
   -------------------------------------------------------------------------- */

.bar, .filters {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(237, 238, 234, .95);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--rule);
}
.filters { margin: 0 -24px; padding: 11px 24px; display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }

.bar-in {
  max-width: var(--page);
  margin: 0 auto;
  padding: 10px 24px;
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
}

.filters .lab, .readout {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--ink-2);
  white-space: nowrap;
}
.readout b { color: var(--ink); font-weight: 600; }

button {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .05em;
  text-transform: uppercase;
  padding: 7px 12px;
  border: 1px solid var(--ink);
  background: transparent;
  color: var(--ink);
  border-radius: 0;
  cursor: pointer;
  transition: background .15s, color .15s;
}
button:hover { background: var(--ink); color: var(--wafer); }
button.primary { background: var(--ink); color: var(--wafer); }
button.primary:hover { background: var(--indigo); border-color: var(--indigo); }

/* Quiet variant used in filter bars */
.filters button { border-color: var(--rule); color: var(--ink-2); text-transform: none; }
.filters button:hover { border-color: var(--ink); color: var(--ink); background: transparent; }
.filters button.on { background: var(--ink); border-color: var(--ink); color: var(--wafer); }

.actions { display: flex; gap: 8px; margin-left: auto; }

/* Transient confirmation message */
.toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translate(-50%, 20px);
  background: var(--ink);
  color: var(--wafer);
  font-family: var(--mono);
  font-size: 12px;
  padding: 10px 18px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s, transform .2s;
  z-index: 40;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }


/* --------------------------------------------------------------------------
   15. RESPONSIVE
   -------------------------------------------------------------------------- */

@media (max-width: 640px) {
  .wrap { padding: 0 16px 80px; }
  .body, .sec-note { margin-left: 0; }
  .sec-head { gap: 10px; }
  .block, .idea, .gap, .pick, .layer, .proj { padding-left: 14px; }
  .filters { margin: 0 -16px; padding: 10px 16px; }
  .bar-in { padding: 9px 16px; gap: 12px; }
  .field { grid-template-columns: 1fr; gap: 0; }
  .field label { padding-top: 8px; }
  .tl, .week { grid-template-columns: 1fr; }
  .tl .d, .week .w { padding: 11px 0 0; }
  .tl .c, .week .c { padding: 4px 0 11px; }
  .receipt, .mock { font-size: 12px; }
}


/* --------------------------------------------------------------------------
   16. PRINT
   -------------------------------------------------------------------------- */

@media print {
  body { background: #fff; font-size: 11pt; }
  .bar, .filters, .toast, .actions, button { display: none !important; }
  .wrap { max-width: none; padding: 0; }
  section { page-break-inside: auto; }
  .block, .idea, .gap, .pick, .callout, .prob, .kill, .receipt, .mock { page-break-inside: avoid; }
  h1, h2, h3 { page-break-after: avoid; }
  .tw { overflow: visible; }
  table { page-break-inside: auto; }
  tr { page-break-inside: avoid; }
  a { color: inherit; text-decoration: none; }
}


/* --------------------------------------------------------------------------
   17. MOTION
   -------------------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
