/* ---------------------------------------------------------------------------
   Print stylesheet: a clean paper / PDF view of the dashboard.

   Linked with media="print", so these rules apply only when printing or
   exporting to PDF. Three jobs:
     1. Force the light palette, even if the viewer is in dark mode, so a print
        does not dump ink on a dark ground.
     2. Drop interactive chrome (sidebar, edit controls, avatar) that means
        nothing on paper.
     3. Unwind the Gridstack absolute layout so cards flow down the page and do
        not split across a page break.

   The RAG status colors (semaphores, meter zones, tiles) are preserved on
   purpose: they carry meaning, so print-color-adjust keeps them.
--------------------------------------------------------------------------- */

/* 1. Force the light palette. !important beats both dark selectors
   (@media prefers-color-scheme and [data-theme="dark"]) regardless of which
   one is active when the user hits print. Only color-bearing tokens are forced;
   type, geometry, and shadow tokens are theme-independent. */
:root {
  color-scheme: light !important;

  --bg:            #FFFFFF !important;
  --surface:       #FFFFFF !important;
  --surface-2:     #F6F6F4 !important;
  --surface-sink:  #F1F1EE !important;

  --ink:           #231F20 !important;
  --ink-2:         #55514F !important;
  --ink-3:         #6F6A67 !important;

  --line:          #E9E7E3 !important;
  --line-strong:   #DAD7D2 !important;

  --primary:       #2563EB !important;
  --primary-strong:#1D4FD7 !important;
  --primary-ink:   #FFFFFF !important;
  --primary-tint:  #EAF0FE !important;
  --primary-tint-2:#DCE7FD !important;

  --amber:         #F19D30 !important;
  --orange:        #ED6027 !important;
  --gold:          #F6C646 !important;
  --red:           #D13A2A !important;

  --good:          #1E9E63 !important;   --good-tint:     #E4F6EC !important;
  --warning:       #C67A12 !important;   --warning-tint:  #FBEFD8 !important;
  --serious:       #D9531E !important;   --serious-tint:  #FBE6DB !important;
  --critical:      #C5341F !important;   --critical-tint: #FBE2DD !important;

  --cat-onboarding:   #2563EB !important;
  --cat-buildouts:    #ED6027 !important;
  --cat-integrations: #0E9384 !important;
  --cat-custom:       #B4820E !important;

  --zone-healthy:  #1E9E63 !important;
  --zone-watch:    #F19D30 !important;
  --zone-risk:     #D9531E !important;
}

/* Keep the light brand mark visible even when the viewer is in dark mode. */
.logo-light { display: block !important; }
.logo-dark  { display: none  !important; }

/* 2. Page setup and color fidelity. */
@page { margin: 14mm; }

body {
  background: #FFFFFF !important;
  color: var(--ink) !important;
}

/* Preserve meaningful fills (status semaphores, meter zones, tiles, accents)
   so the report reads correctly on paper. */
.app, .main, .card, .tile,
.meter__bar, .meter__zone, .meter__fill,
.demo-pill, .nav-item__count,
[class*="sdot"], .bl-wrap, .bk-col, .cal {
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
}

/* 3. Hide interactive chrome and screen-only affordances. */
.side,
.topbar__right .layout-tools,
.btn-edit,
.btn-reset,
.theme-seg,
.usermenu {
  display: none !important;
}

/* Show the brand mark (the sidebar that normally carries it is hidden). */
.mobile-brand {
  display: flex !important;
  padding: 0 0 10px 0 !important;
}

/* Let main take the full page width. */
.app  { display: block !important; }
.main {
  padding: 0 !important;
  margin: 0 !important;
  overflow: visible !important;
  height: auto !important;
}

.topbar {
  border-bottom: 1px solid var(--line) !important;
  padding-bottom: 10px !important;
  margin-bottom: 14px !important;
}

/* Neutralize the live pulse on the demo pill; keep it as a static label so the
   print still says this is demo data. */
.demo-pill .live { animation: none !important; }

/* 4. Unwind the Gridstack absolute layout into a paginated 2-column grid.
   Big cards (capacity, backlog, team) span both columns; the numeric tiles
   flow 2-up. Each card avoids splitting across a page break. */
.grid-stack {
  display: grid !important;
  grid-template-columns: 1fr 1fr !important;
  gap: 12px !important;
  height: auto !important;
  min-height: 0 !important;
}

.grid-stack-item {
  position: static !important;
  transform: none !important;
  inset: auto !important;
  left: auto !important;
  top: auto !important;
  width: auto !important;
  min-width: 0 !important;
  height: auto !important;
  min-height: 0 !important;
  margin: 0 !important;
}

/* Break policy follows the widget's content type (the same data-resize tags the
   grid uses). Intrinsic cards (a meter, a number tile) stay whole. Long list
   cards (backlog, team) may break at a row so they fill the page instead of
   forcing white space, the same reason they are the scrollable ones on screen. */
.grid-stack-item[data-resize="width"] {
  break-inside: avoid;
  page-break-inside: avoid;
}
.grid-stack-item[data-resize="both"] {
  break-inside: auto;
  page-break-inside: auto;
}

.grid-stack-item-content {
  position: static !important;
  inset: auto !important;
  height: auto !important;
  overflow: visible !important;
  box-shadow: none !important;
}

/* Full-width cards. */
.grid-stack-item[gs-id="capacity"],
.grid-stack-item[gs-id="backlog"],
.grid-stack-item[gs-id="team"] {
  grid-column: 1 / -1 !important;
}

.card,
.bl-wrap,
.bk-col,
.cal {
  box-shadow: none !important;
  border: 1px solid var(--line) !important;
}

/* The newer views' tables and board: keep a row (or the board column pair)
   together on paper, and flow the board two columns wide. */
.bl-table tbody tr {
  break-inside: avoid;
  page-break-inside: avoid;
}
.bk-board {
  display: grid !important;
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  gap: 12px !important;
}

/* Paper: solid panels. */
