/* =====================================================================
 * report-layout.css — the shared LAYOUT SYSTEM for every report.
 *
 * Linked by every Reports/*.html AFTER report-base.css (tokens) and BEFORE
 * report-finance.css (finance content chrome, 6 reports only). Defines the
 * ONE header component + the small set of body-layout templates, so the
 * chrome that used to be copy-pasted per report (header.cover, the inline
 * header.report-header block ×7, the bare header{} rules, nav.toc / nav.top,
 * .lang-switch ×21) now lives in one place. See Logic/style_guide.md §7/§12.
 *
 * Templates (a report picks one body shape):
 *   T1 document  — .report-header + optional .report-nav + <main class="report-main report-main--wNNNN">
 *   T2 app/canvas — <body class="report-app"> + .report-header--compact + bars + .report-stage>canvas
 *   T3 split-pane — .report-header + .report-body--split (aside.sidebar + main.report-main--pane)
 *
 * NOTE: no global `body { font-size }` here — the room/timetable family
 * intentionally omits one, and each report keeps its own body font-size
 * (report-base.css §10.2 constraint). Only structural chrome lives here.
 * ===================================================================== */

/* ---- Reset / selection --------------------------------------------- */
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
::selection { background: var(--brand-accent-soft); color: var(--text); }

/* ---- Language switch (shared by all reports) ----------------------- */
.lang-switch { display: flex; gap: 3px; align-items: center; flex: 0 0 auto;
               background: rgba(255,255,255,0.18);
               border: 1px solid rgba(255,255,255,0.35);
               border-radius: 9px; padding: 3px; }
.lang-switch button {
  border: 0; border-radius: 6px; padding: 5px 12px; cursor: pointer;
  font: 600 12px var(--font-sans);
  background: transparent; color: var(--brand-primary-ink);
  opacity: 0.8; transition: background 0.15s, opacity 0.15s;
}
.lang-switch button.active { background: #ffffff; color: var(--brand-primary); opacity: 1; }

/* ---- Canonical header ---------------------------------------------- */
.report-header {
  background: linear-gradient(135deg, var(--brand-primary) 0%, var(--brand-primary-dim) 100%);
  color: var(--brand-primary-ink); padding: 22px 44px 20px;
  display: flex; gap: 20px; align-items: center;
  border-bottom: 4px solid var(--brand-accent);
  position: relative;
}
.report-header .logo { height: 64px; width: auto; flex: 0 0 auto; display: block;
                       background: #ffffff; padding: 6px 10px; border-radius: 6px; }
.report-header .titles { min-width: 0; flex: 1; }
.report-header .titles.has-switch { padding-right: 340px; }   /* room for .report-switch */
.report-header h1 { font-size: 24px; margin: 0 0 4px; font-weight: 700;
                    color: var(--brand-primary-ink); letter-spacing: -0.01em; }
.report-header .subtitle { font-size: 14px; color: var(--brand-primary-ink); opacity: 0.92;
                           margin: 0; }   /* neutralize UA <p> margins (room family uses <p class="subtitle">) */
.report-header .meta { font-size: 12px; color: var(--brand-primary-ink); opacity: 0.78; margin-top: 4px; }
/* DG data-update date badge (injected by report_boot.js for DG-based reports). */
.report-header .data-date { display: inline-block; margin-top: 5px; font-size: 12px;
                            font-weight: 600; color: var(--brand-primary-ink);
                            background: rgba(255, 255, 255, 0.16); border-radius: 999px;
                            padding: 2px 10px; }
.report-header .back { display: inline-block; color: var(--brand-primary-ink);
                       opacity: 0.9; text-decoration: none; font-size: 12.5px;
                       font-weight: 600; margin: 0 0 6px; }
.report-header .back:hover { opacity: 1; text-decoration: underline; }

/* Compact modifier — T2 apps + tight top bars. */
.report-header--compact { padding: 14px 20px; gap: 16px; }
.report-header--compact .logo { height: 46px; }
.report-header--compact h1 { font-size: 20px; }
.report-header--compact .subtitle { font-size: 12.5px; }

/* Room-family gradient angle (color identical — --pink ≡ --brand-primary). */
.report-header--room { background: linear-gradient(100deg, var(--brand-primary) 0%, var(--brand-primary-dim) 100%); }

/* Full-bleed modifier — for reports that keep body-level content in a padded
   <body> (the Sankey/allocation family) instead of a <main> container; the
   negative margin lets the shared header span edge-to-edge. `--bleed-h` is the
   body's horizontal padding (default 18px). */
.report-header--bleed { margin: -16px calc(-1 * var(--bleed-h, 18px)) 16px; }

/* ---- Report switcher (pill group; revenue ↔ revenue-projects) ------ */
.report-switch {
  position: absolute; top: 26px; right: 44px;
  display: inline-flex; gap: 6px; align-items: center;
  background: rgba(255,255,255,0.08); padding: 4px;
  border-radius: 999px; border: 1px solid rgba(255,255,255,0.18);
}
.report-switch a {
  color: rgba(255,255,255,0.85); text-decoration: none;
  font-size: 12.5px; padding: 5px 12px; border-radius: 999px;
  line-height: 1.2; transition: background .12s, color .12s;
}
.report-switch a:hover { background: rgba(255,255,255,0.18); color: #fff; }
.report-switch a[aria-current="page"] { background: #fff; color: var(--accent); font-weight: 600; }

/* ---- Report menu (grouped switcher injected by report_boot.js) ----- */
.report-menu { position: relative; flex: 0 0 auto; }
.report-menu > button {
  border: 1px solid rgba(255,255,255,0.35); border-radius: 9px;
  background: rgba(255,255,255,0.18); color: var(--brand-primary-ink);
  padding: 7px 14px; cursor: pointer; font: 600 12.5px var(--font-sans);
  transition: background 0.15s;
}
.report-menu > button:hover { background: rgba(255,255,255,0.32); }
.report-menu-panel {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 1000;
  background: #fff; border-radius: 12px; text-align: left;
  box-shadow: 0 10px 34px rgba(0,0,0,0.20); border: 1px solid var(--border);
  min-width: 264px; max-width: 330px; max-height: min(70vh, 540px);
  overflow: auto; padding: 6px 0 8px;
}
.report-menu-panel .grp { font-size: 11px; text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--muted); padding: 12px 16px 4px; }
.report-menu-panel a { display: block; padding: 7px 16px; font-size: 13.5px;
  color: var(--text); text-decoration: none; }
.report-menu-panel a:hover { background: var(--accent-soft); color: var(--accent); }
.report-menu-panel a[aria-current="page"] { color: var(--brand-primary);
  font-weight: 700; background: var(--brand-primary-soft, #F8E1EA); }
.report-menu-panel .sep { border-top: 1px solid var(--border); margin: 6px 0 2px; }

/* ---- Nav (unifies nav.toc sticky + nav.top sibling links) ---------- */
.report-nav {
  background: #fff; border-bottom: 1px solid var(--border);
  padding: 10px 44px; display: flex; gap: 14px; flex-wrap: wrap; align-items: center;
}
.report-nav--sticky { position: sticky; top: 0; z-index: 50; box-shadow: 0 1px 3px rgba(0,0,0,0.04); }
.report-nav--siblings { padding: 10px 24px; }
.report-nav a { color: var(--muted); text-decoration: none; font-size: 12.5px;
                padding: 4px 10px; border-radius: 4px; }
.report-nav a:hover { background: var(--accent-soft); color: var(--accent); }
.report-nav .spacer { flex: 1; }
.report-nav .yr-label { color: var(--muted); font-size: 11.5px; text-transform: uppercase;
                        letter-spacing: 0.05em; }

/* ---- T1 document container ----------------------------------------- */
.report-main { margin: 0 auto; padding: 22px clamp(16px, 3vw, 44px) 56px; }
.report-main--padbottom { padding-bottom: 130px; }   /* reports with a fixed bottom-bar */
.report-main--w920  { max-width: min(920px,  calc(100% - 32px)); }
.report-main--w1080 { max-width: min(1080px, calc(100% - 32px)); }
.report-main--w1180 { max-width: min(1180px, calc(100% - 32px)); }
.report-main--w1320 { max-width: min(1320px, calc(100% - 32px)); }
.report-main--w1340 { max-width: min(1340px, calc(100% - 32px)); }
.report-main--w1560 { max-width: min(1560px, calc(100% - 32px)); }
.report-main--w1760 { max-width: min(1760px, calc(100% - 32px)); }
.report-main--w1800 { max-width: min(1800px, calc(100% - 32px)); }
.report-main--full  { max-width: 100%; }

/* ---- T2 full-viewport app / canvas --------------------------------- */
.report-app { display: flex; flex-direction: column; height: 100vh; overflow: hidden; }
.report-app > .report-header { flex: 0 0 auto; }   /* header keeps its height; the stage absorbs the rest */
.report-app .report-stage { flex: 1; min-height: 0; position: relative; }
.report-app .report-stage canvas { display: block; }

/* ---- T3 split-pane app --------------------------------------------- */
.report-body--split { display: flex; min-height: calc(100vh - var(--header-h, 70px)); }
.report-body--split .sidebar { flex: 0 0 300px; width: 300px; }
.report-main--pane { flex: 1; min-width: 0; overflow: auto; }

/* =====================================================================
 * Responsive chrome — header / nav / main (Logic/style_guide.md §12).
 * Content responsive rules stay in report-finance.css.
 * ===================================================================== */
/* Presentation screens (≈1080p / large monitors). */
@media (min-width: 1600px) {
  .report-header { padding: 28px 72px 24px; }
  .report-header h1 { font-size: 27px; }
  .report-header .subtitle { font-size: 15px; }
  .report-header .logo { height: 70px; }
  .report-nav { padding: 12px 72px; font-size: 13px; }
  .report-main { padding-left: 72px; padding-right: 72px; font-size: 15px; }
}
/* Very wide screens (QHD 1440p, ultrawide, 4K). Widen the content containers
   so a report fills the screen instead of floating in whitespace, and scale
   the header / nav / base text up proportionally. Widths cap at a fixed px
   but never exceed 92vw, so they grow smoothly from ~2560 up to 4K. The
   full-viewport canvas dashboards (T2) already fill the screen; only their
   compact header scales here. */
@media (min-width: 2560px) {
  .report-header { padding: 42px 128px 34px; }
  .report-header h1 { font-size: 38px; }
  .report-header .subtitle { font-size: 20px; }
  .report-header .meta { font-size: 15px; }
  .report-header .back { font-size: 16px; }
  .report-header .logo { height: 100px; }
  .report-header--compact { padding: 24px 52px; }
  .report-header--compact .logo { height: 72px; }
  .report-header--compact h1 { font-size: 30px; }
  .report-header--compact .subtitle { font-size: 17px; }
  .lang-switch button { font-size: 15px; padding: 7px 16px; }
  .report-nav { padding: 18px 128px; font-size: 16px; gap: 18px; }
  .report-nav a { padding: 6px 14px; }
  .report-main { padding-left: 128px; padding-right: 128px; font-size: 18px; }
  .report-main--w920  { max-width: min(1400px, 92vw); }
  .report-main--w1080 { max-width: min(1640px, 92vw); }
  .report-main--w1180 { max-width: min(1800px, 92vw); }
  .report-main--w1320 { max-width: min(2000px, 92vw); }
  .report-main--w1340 { max-width: min(2040px, 92vw); }
  .report-main--w1560 { max-width: min(2360px, 92vw); }
  .report-main--w1760 { max-width: min(2680px, 92vw); }
  .report-main--w1800 { max-width: min(2760px, 92vw); }
}
@media (max-width: 1023px) {
  .report-header { padding: 18px 24px 16px; gap: 14px; }
  .report-header h1 { font-size: 20px; }
  .report-header .logo { height: 52px; }
  .report-header .titles.has-switch { padding-right: 0; }
  .report-switch { position: static; margin-top: 8px; }
  .report-nav { padding: 8px 24px; gap: 10px; font-size: 12.5px; }
  .report-main { padding-left: 16px; padding-right: 16px; }
}
@media (max-width: 599px) {
  .report-header { padding: 12px 14px 10px; flex-wrap: wrap; gap: 10px; border-bottom-width: 3px; }
  .report-header h1 { font-size: 17px; margin: 0 0 2px; }
  .report-header .subtitle { font-size: 12px; }
  .report-header .meta { font-size: 10.5px; }
  .report-header .logo { height: 40px; padding: 4px 6px; }
  .report-header--compact { padding: 10px 12px; }
  .report-header--compact .logo { height: 38px; }
  .report-header--compact h1 { font-size: 16px; }
  .report-nav { position: static; padding: 6px 12px; gap: 8px; font-size: 12px;
                overflow-x: auto; flex-wrap: nowrap; white-space: nowrap;
                -webkit-overflow-scrolling: touch; }
  .report-nav a { flex-shrink: 0; }
  .report-main { padding-left: 10px; padding-right: 10px; }
  .report-main--padbottom { padding-bottom: 150px; }
}

/* T3 split-pane stacks vertically on narrow screens (sidebar on top). */
@media (max-width: 760px) {
  .report-body--split { flex-direction: column; min-height: 0; }
  .report-body--split .sidebar { flex: none; width: 100%; max-height: 300px;
                                 position: static; }
}
