/* ===========================================================================
   LeadPulse — print & PDF-mirroring stylesheet (docs/DESIGN_SYSTEM.md)
   Loaded with media="print" everywhere, and as the main stylesheet in
   layouts/print for report pages.
   =========================================================================== */
@page {
  size: A4;
  margin: 14mm 12mm 16mm;
}

@media print {
  :root {
    --bg: #ffffff;
    --surface: #ffffff;
    --surface-2: #f2f6f9;
    --text: #000000;
    --text-muted: #445;
    --border: #b9c4cd;
    --shadow: none;
    --shadow-sm: none;
    --shadow-lg: none;
  }

  html, body {
    background: #fff !important;
    color: #000 !important;
    font-size: 11pt;
  }

  /* Hide application chrome */
  .sidebar,
  .sidebar-backdrop,
  .topbar,
  .bottom-tabs,
  .toast-stack,
  .page-actions,
  .filter-bar,
  .pagination,
  .bulk-bar,
  .drawer,
  .drawer-backdrop,
  .modal-backdrop,
  .impersonation-banner,
  .no-print,
  .btn,
  .dropdown,
  .tabs,
  .skip-link { display: none !important; }

  .app-main { margin-left: 0 !important; }
  .app-content {
    padding: 0 !important;
    max-width: none !important;
  }
  .card {
    border: 1px solid var(--border) !important;
    box-shadow: none !important;
    break-inside: avoid;
    page-break-inside: avoid;
    margin-bottom: 8mm;
  }
  .card-header { background: #fff !important; }

  a { color: #000 !important; text-decoration: none !important; }
  a[href^="http"]::after {
    content: " (" attr(href) ")";
    font-size: 8pt;
    color: #555;
  }
  a[href^="/"]::after,
  a[href^="#"]::after { content: ""; }

  /* Report header / footer ------------------------------------------------ */
  .print-header {
    display: flex !important;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    border-bottom: 2pt solid #0097a7;
    padding-bottom: 6pt;
    margin-bottom: 10pt;
  }
  .print-header .print-logo { height: 34px; width: auto; }
  .print-header .print-meta { text-align: right; font-size: 9pt; color: #445; }
  .print-header h1 {
    font-size: 16pt;
    margin: 0 0 2pt;
    color: #0d2b45 !important;
  }

  .print-footer {
    display: block !important;
    position: fixed;
    bottom: 0; left: 0; right: 0;
    font-size: 8pt;
    color: #445;
    border-top: .5pt solid #b9c4cd;
    padding-top: 3pt;
  }

  /* Tables ---------------------------------------------------------------- */
  .table { font-size: 9.5pt; width: 100%; }
  .table thead { display: table-header-group; }
  .table tfoot { display: table-footer-group; }
  .table thead th {
    background: #0097a7 !important;
    color: #fff !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
    border: .5pt solid #0097a7;
    position: static;
  }
  .table th,
  .table td {
    border: .5pt solid #b9c4cd;
    padding: 4pt 6pt;
  }
  .table tbody tr:nth-child(even) {
    background: #eef3f7 !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  .table tbody tr { break-inside: avoid; page-break-inside: avoid; }
  .table.is-stacked thead { display: table-header-group !important; }
  .table.is-stacked,
  .table.is-stacked tbody,
  .table.is-stacked tr,
  .table.is-stacked td { display: revert !important; }
  .table.is-stacked td::before { content: none !important; }

  h1, h2, h3 {
    color: #0d2b45 !important;
    break-after: avoid;
    page-break-after: avoid;
  }
  h2 { font-size: 13pt; border-bottom: .5pt solid #0097a7; padding-bottom: 3pt; }

  .stat-card {
    border: .5pt solid #b9c4cd !important;
    box-shadow: none !important;
    break-inside: avoid;
  }
  .stat-icon { display: none; }
  .stat-value { font-size: 15pt; color: #0d2b45 !important; }

  .badge,
  .stage-badge,
  .gps-badge {
    border: .5pt solid #b9c4cd;
    background: #fff !important;
    color: #000 !important;
  }

  .grid-2, .grid-3, .grid-4 { display: grid !important; }
  .grid-4 { grid-template-columns: repeat(4, 1fr) !important; }
  .grid-3 { grid-template-columns: repeat(3, 1fr) !important; }
  .grid-2 { grid-template-columns: repeat(2, 1fr) !important; }

  .map-container { border: .5pt solid #b9c4cd; height: 90mm; }
  .chart-card .chart-canvas-wrap { height: 70mm; }

  .page-break { break-before: page; page-break-before: always; }
  .avoid-break { break-inside: avoid; page-break-inside: avoid; }
}

/* Screen preview of a print layout (layouts/print) ------------------------- */
.print-sheet {
  max-width: 210mm;
  margin: 0 auto;
  padding: 16mm 14mm;
  background: #fff;
  box-shadow: var(--shadow-lg);
}
.print-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 2px solid var(--tf-teal);
  padding-bottom: 10px;
  margin-bottom: 18px;
}
.print-header .print-logo { height: 38px; width: auto; }
.print-header .print-meta { text-align: right; font-size: var(--fs-xs); color: var(--text-muted); }
.print-footer {
  display: none;
  margin-top: 20px;
  border-top: 1px solid var(--border);
  padding-top: 8px;
  font-size: var(--fs-xs);
  color: var(--text-muted);
}
.print-sheet .print-footer { display: block; }
