/* =========================================================================
   PRINT — ink-friendly output for the pages worth printing: the client plan,
   reports/dashboard, and the leads table. Linked with media="print" from the
   admin + client shells, AFTER every other stylesheet, so equal-specificity
   overrides here win on source order.

   !important is justified in this file: the screen shell pins heights and
   overflow from several places at once (layout.css base rules plus the
   tablet/mobile width queries in responsive.css — width queries also match
   the PAPER width, so an A4 page lands in the "tablet" range), and printing
   must flow the full document regardless of which of those matched.
   ========================================================================= */
@media print {
  /* ---- force light output ---------------------------------------------
     tokens.css sets the dark palette on html[data-theme="dark"] (0,1,1),
     which outranks a bare :root (0,1,0) re-declaration. Declaring the light
     values on BOTH selectors — from a file linked last — wins in every theme
     by specificity + order, with no per-token !important. */
  html, html[data-theme="dark"] {
    color-scheme: light;
    --canvas:       #ffffff;
    --surface:      #ffffff;
    --surface-sunk: #f8f8fb;
    --text:         #1b1b23;
    --text-strong:  #000000;
    --text-muted:   #606062;
    --text-soft:    #8c8c9a;
    --border:       #d7d7df;
    --border-faint: #ebebeb;
  }
  body { background: #ffffff; color: #1b1b23; }

  /* ---- hide app chrome — nothing navigational prints */
  #splash,
  .sidebar,                    /* also matches the settings sidebar */
  .sb-scrim, .settings-nav-scrim,
  .topbar,
  .main-toolbar,
  .mobile-bottom,              /* holds .bottom-nav + .quick-fab */
  .bottom-nav, .quick-fab,
  .mobile-bottom-fade,
  .mobile-search-sheet,
  .quick-sheet, .quick-sheet-scrim,
  .app-toast { display: none !important; }

  /* ---- un-fix the shell so the document flows onto pages */
  .app-frame, .app, .main, #main, .view-scroll {
    height: auto !important;
    min-height: 0 !important;
    overflow: visible !important;
  }
  /* the shell is a sidebar+main grid; with the sidebar hidden the main
     column must own the full page width (block flow, no grid columns) */
  .app { display: block !important; box-shadow: none !important; }
  /* drop the mobile bottom-nav clearance padding */
  .view-scroll { padding-bottom: 0 !important; }

  /* ---- keep cards / KPI tiles / rows whole across page breaks */
  .card, .kpi, .plan-card, .table-card,
  .ctable tr, .plan-tl-row { break-inside: avoid; }

  /* ---- expand overflow containers — everything must be on the paper */
  .table-wrap, .table-card { overflow: visible !important; }
  /* leads-responsive floors the table at 820px for touch scrolling; on
     paper it must shrink to the page instead of clipping */
  .table-card .ctable { min-width: 0 !important; }

  /* shadows print as grey smears — flat hairline borders read cleaner */
  .card, .kpi, .plan-card, .table-card { box-shadow: none; }
}
