@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;500;600;700&display=swap');

/**
 * SOURX Margin Report - Single Page Executive Print Stylesheet
 * 
 * Strict Professional Executive Design System:
 * - Unified Typography: Inter for all text/headings, JetBrains Mono for all financial figures
 * - Restrained, Cohesive Executive Palettes (Zero generic rainbow colors):
 *   1. Theme Editorial Amber (User Mockup): Black (#18181B), Slate Gray, Warm Amber Gold (#D97706 / #F59E0B)
 *   2. Theme Corporate Carmine: Deep Slate (#0F172A), Neutral Gray, Executive Bordeaux (#BE123C / #9F1239)
 *   3. Theme Institutional Slate: Obsidian (#0F172A), Slate (#475569), Forest Emerald (#047857)
 * 
 * Guaranteed strictly 1-page A4 Portrait with zero spillover.
 */

#pdf-single-page-document {
  display: none;
}

body.pdf-single-page #pdf-single-page-document,
.preview-a4-sheet #pdf-single-page-document,
.sourx-preview-overlay #pdf-single-page-document {
  display: flex !important;
  flex-direction: column !important;
  justify-content: flex-start !important;
}

body.pdf-single-page .app-shell,
body.pdf-single-page .app-header,
body.pdf-single-page .app-sidebar,
body.pdf-single-page .sourx-modal-overlay,
body.pdf-single-page #pdf-editorial-glass-container,
body.pdf-single-page #pdf-minimal-illustrated-container,
body.pdf-single-page #pdf-corporate-carmine-container {
  display: none !important;
}

/* ==========================================================================
   ON-SCREEN EXECUTIVE DOCUMENT PREVIEW MODAL
   ========================================================================== */

.sourx-preview-overlay {
  position: fixed !important;
  inset: 0 !important;
  background: rgba(10, 15, 29, 0.88) !important;
  backdrop-filter: blur(10px) !important;
  -webkit-backdrop-filter: blur(10px) !important;
  z-index: 99999 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  padding: 16px;
  box-sizing: border-box;
}

.sourx-preview-overlay.is-active {
  opacity: 1 !important;
  pointer-events: auto !important;
}

.sourx-preview-overlay.is-closing {
  opacity: 0 !important;
  pointer-events: none !important;
}

.sourx-preview-card {
  width: 96vw;
  max-width: 1060px;
  height: 94vh;
  background: #0F172A;
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 25px 65px rgba(0, 0, 0, 0.65), 0 0 0 1px rgba(255, 255, 255, 0.1);
  animation: previewCardIn 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes previewCardIn {
  from {
    transform: scale(0.96) translateY(10px);
    opacity: 0;
  }
  to {
    transform: scale(1) translateY(0);
    opacity: 1;
  }
}

.preview-canvas-container {
  flex: 1;
  background: #0B1120;
  overflow-y: auto;
  overflow-x: auto;
  padding: 30px 20px;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  scrollbar-width: thin;
  scrollbar-color: #334155 #0B1120;
}

.preview-canvas-container::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
.preview-canvas-container::-webkit-scrollbar-track {
  background: #0B1120;
}
.preview-canvas-container::-webkit-scrollbar-thumb {
  background: #334155;
  border-radius: 4px;
}

.preview-a4-sheet {
  width: 210mm !important;
  min-width: 210mm !important;
  max-width: 210mm !important;
  min-height: 297mm !important;
  height: 297mm !important;
  flex-shrink: 0 !important;
  background: #FFFFFF !important;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5), 0 2px 10px rgba(0, 0, 0, 0.2) !important;
  border-radius: 3px;
  box-sizing: border-box;
  overflow: hidden;
  transform-origin: top center;
  transition: transform 0.15s ease-out;
  margin-bottom: 30px;
}

.preview-a4-sheet #pdf-single-page-document {
  min-height: 297mm !important;
  height: 297mm !important;
  box-sizing: border-box !important;
  background: #FFFFFF !important;
}

/* ==========================================================================
   PRINT MEDIA RULES (STRICT 1-PAGE A4 PORTRAIT ENFORCEMENT)
   ========================================================================== */

@media print {
  @page {
    size: A4 portrait !important;
    margin: 5mm 6mm !important;
  }

  html, body {
    background: #FFFFFF !important;
    color: #111827 !important;
    margin: 0 !important;
    padding: 0 !important;
    width: 100% !important;
    height: 100% !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  body.pdf-single-page {
    background: #FFFFFF !important;
  }

  .pdf-single-page-doc {
    width: 100% !important;
    height: 284mm !important;
    max-height: 284mm !important;
    box-sizing: border-box !important;
    padding: 1.5mm 2.5mm !important;
    margin: 0 auto !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: space-between !important;
    page-break-after: avoid !important;
    page-break-before: avoid !important;
    page-break-inside: avoid !important;
    break-after: avoid !important;
    break-before: avoid !important;
    break-inside: avoid !important;
    overflow: hidden !important;
    background: #FFFFFF !important;
  }
}

/* ==========================================================================
   GLOBAL TYPOGRAPHY (INTER & JETBRAINS MONO)
   ========================================================================== */

.pdf-single-page-doc,
.pdf-single-page-doc * {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  box-sizing: border-box;
}

.pdf-single-page-doc {
  color: #0F172A;
  background: #FFFFFF;
  line-height: 1.35;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Specific styling for the flagship reference theme */
.theme-editorial-reference,
.theme-editorial-reference table,
.theme-editorial-reference td,
.theme-editorial-reference th,
.theme-editorial-reference span,
.theme-editorial-reference div,
.theme-editorial-reference p,
.theme-carmine,
.theme-carmine *,
.theme-slate,
.theme-slate * {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;
}

.theme-editorial-reference h1,
.theme-editorial-reference .font-serif,
.theme-editorial-reference .report-title-serif,
.font-serif,
.pdf-single-page-doc .font-serif,
.pdf-single-page-doc h1,
.pdf-single-page-doc .report-title-serif {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;
}

.theme-editorial-reference td,
.theme-editorial-reference th,
.theme-editorial-reference .tabular-nums,
.tabular-nums {
  font-variant-numeric: tabular-nums lining-nums !important;
}

.font-mono,
.pdf-single-page-doc .font-mono,
.pdf-single-page-doc td.font-mono,
.pdf-single-page-doc th.font-mono,
.td-num,
.th-num,
.td-pct,
.th-pct,
.wf-val,
.p1-kpi-value,
.p1-chip-val,
.p1-doc-num,
.eg-chip-val,
.eg-footer,
.p1-footer {
  font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace !important;
  font-variant-numeric: tabular-nums lining-nums !important;
}

.font-bold { font-weight: 700 !important; }
.font-semibold { font-weight: 600 !important; }
.font-medium { font-weight: 500 !important; }
.text-right { text-align: right !important; }
.text-center { text-align: center !important; }
.text-muted { color: #64748B !important; }

/* ==========================================================================
   THEME 1: EDITORIAL AMBER (Directly Inspired by User's Mockup)
   Strict Palette: Jet Black (#18181B), Slate (#64748B), Warm Amber Gold (#D97706 / #F59E0B)
   ========================================================================== */

.theme-editorial-gold {
  color: #012e5c;
}

.eg-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 8px;
  border-bottom: 1.5px solid #012e5c;
  margin-bottom: 9px;
  position: relative;
}

/* SOURX Acid Lime Signature Accent on Divider */
.eg-header::after {
  content: '';
  position: absolute;
  bottom: -1.5px;
  left: 0;
  width: 64px;
  height: 2.5px;
  background: #b6e82c;
  border-radius: 2px;
}

.eg-header-main {
  flex: 1;
  min-width: 0;
  padding-right: 16px;
}

.eg-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-bottom: 2.5px;
  font-size: 7px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.eg-brand-badge {
  background: #012e5c;
  color: #b6e82c;
  padding: 1.5px 5.5px;
  border-radius: 3px;
  font-weight: 800;
  letter-spacing: 0.08em;
  font-size: 7px;
  display: inline-flex;
  align-items: center;
  border: 1px solid rgba(182, 232, 44, 0.4);
}

.eg-eyebrow-sep {
  color: #CBD5E1;
  font-weight: 400;
}

.eg-eyebrow-client {
  color: #c4123b;
  font-weight: 800;
  letter-spacing: 0.05em;
  background: #fdf2f4;
  padding: 1px 4.5px;
  border-radius: 2.5px;
  border: 1px solid #fecdd3;
  font-size: 6.8px;
}

.eg-eyebrow-doc {
  color: #009cdb;
  font-weight: 700;
}

.eg-eyebrow-type {
  color: #64748B;
  font-weight: 600;
}

.eg-main-title {
  font-family: 'Inter', sans-serif !important;
  font-size: 20px;
  font-weight: 800;
  color: #012e5c;
  margin: 0 0 2px 0;
  letter-spacing: -0.03em;
  line-height: 1.15;
}

.eg-lead-text {
  font-size: 8px;
  color: #475569;
  line-height: 1.38;
  margin: 0;
  max-width: 490px;
}

.eg-lead-text strong {
  color: #012e5c;
  font-weight: 700;
}

.eg-header-meta {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-shrink: 0;
}

.eg-client-brand-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3px 8px;
  background: #FFFFFF;
  border: 1px solid #E2E8F0;
  border-radius: 6px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
  height: 28px;
  flex-shrink: 0;
}

.eg-client-logo {
  height: 19px;
  max-width: 70px;
  object-fit: contain;
  display: block;
}

.eg-meta-card,
.eg-date-chip,
.eg-audit-chip {
  background: #FFFFFF;
  border: 1px solid #E2E8F0;
  border-radius: 6px;
  padding: 5px 11px;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  text-align: left;
  white-space: nowrap !important;
  flex-shrink: 0;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
}

.eg-card-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  color: #009cdb;
  opacity: 0.9;
  flex-shrink: 0;
}

.eg-card-content {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
}

.eg-card-lbl,
.eg-chip-lbl {
  font-size: 6.8px;
  text-transform: uppercase;
  color: #64748B;
  font-weight: 700;
  letter-spacing: 0.07em;
  line-height: 1;
  margin-bottom: 2px;
  white-space: nowrap !important;
}

.eg-card-val,
.eg-chip-val {
  font-size: 11px;
  font-weight: 700;
  color: #012e5c;
  line-height: 1.15;
  white-space: nowrap !important;
  font-family: 'JetBrains Mono', monospace !important;
}

.eg-date-card,
.eg-date-chip {
  background: #F0F7FC;
  border-color: #D0E4F5;
}

.eg-audit-card,
.eg-audit-chip {
  background: #F0FDF4;
  border-color: #BBF7D0;
}

.eg-audit-card .eg-card-lbl,
.eg-audit-chip .eg-chip-lbl {
  color: #166534;
}

.eg-status-val,
.text-gold {
  color: #012e5c !important;
  font-weight: 700;
}

.eg-status-dot-pulse {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #16A34A;
  box-shadow: 0 0 0 2px rgba(22, 163, 74, 0.25);
  flex-shrink: 0;
  display: inline-block;
}

.text-gold-dark { color: #012e5c !important; }
.text-dark { color: #012e5c !important; }

/* Signature SOURX Table */
.eg-table-section {
  margin-bottom: 8px;
  border: 1.5px solid #012e5c;
  border-radius: 4px;
  overflow: hidden;
}

.eg-gold-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 8px;
}

.eg-gold-table thead th {
  background: #012e5c !important;
  color: #FFFFFF !important;
  font-family: 'Inter', sans-serif !important;
  font-weight: 800 !important;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 5.5px 8px;
  border-bottom: 2.5px solid #b6e82c !important;
  font-size: 8px;
  text-align: left;
}

.eg-gold-table thead th.th-num,
.eg-gold-table thead th.th-pct {
  text-align: right;
}

.eg-gold-table thead th.th-status {
  text-align: center;
}

.eg-gold-table td {
  padding: 4px 8px;
  border-bottom: 1px solid #E2E8F0;
}

.eg-gold-table tr.row-alt {
  background: #F8FAFC;
}

.eg-gold-table tr.row-loss {
  background: #FEF2F2;
}

.eg-gold-table tr.row-summary-other {
  background: #F0F7FC;
  border-top: 1px dashed #CBD5E1;
}

.eg-gold-table tr.row-grand-total {
  background: #F0F7FC !important;
  border-top: 2px solid #012e5c;
  border-bottom: 2px solid #012e5c;
}

.eg-pill {
  font-size: 7px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 3px;
  text-transform: uppercase;
  display: inline-block;
}

.pill-ok { background: #E8F4FD; color: #012e5c; }
.pill-alert { background: #FEE2E2; color: #991B1B; }
.pill-reconciled { background: #012e5c; color: #b6e82c; border: 1px solid rgba(182, 232, 44, 0.5); }

/* Charts Section */
.eg-charts-section {
  display: grid;
  grid-template-columns: 1.12fr 0.88fr;
  gap: 10px;
  margin-bottom: 8px;
}

.eg-chart-card {
  border: 1px solid #E2E8F0;
  border-radius: 5px;
  padding: 8px 10px;
  background: #FFFFFF;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.eg-card-title {
  font-family: 'Inter', sans-serif !important;
  font-size: 11.5px;
  font-weight: 800;
  color: #012e5c;
  margin-bottom: 6px;
  padding-bottom: 4px;
  border-bottom: 1px solid #F1F5F9;
}

.eg-chart-flex {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 10px;
  align-items: center;
}

.eg-bar-svg-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.eg-bar-svg {
  width: 100%;
  height: 125px;
  overflow: visible;
}

.eg-chart-legend {
  display: flex;
  gap: 8px;
  font-size: 7.5px;
  color: #475569;
  margin-top: 4px;
}

.eg-legend-item {
  display: flex;
  align-items: center;
  gap: 3px;
}

.eg-legend-color {
  width: 7px;
  height: 7px;
  border-radius: 2px;
  display: inline-block;
}

.bg-sourx-navy { background: #012e5c !important; }
.bg-sourx-blue { background: #2574a9 !important; }
.bg-sourx-lime { background: #b6e82c !important; }
.bg-sourx-cyan { background: #009cdb !important; }
.bg-gold { background: #012e5c !important; }
.bg-charcoal { background: #2574a9 !important; }

.eg-highlights-box {
  display: flex;
  flex-direction: column;
  justify-content: space-around;
  height: 100%;
}

.eg-hl-block {
  position: relative;
  padding-top: 4px;
}

.eg-hl-stripe {
  height: 3px;
  width: 100%;
  margin-bottom: 3px;
  border-radius: 1px;
}

.eg-hl-title {
  font-size: 9px;
  font-weight: 800;
  color: #012e5c;
  display: block;
}

.eg-hl-desc {
  font-size: 7.5px;
  color: #475569;
  line-height: 1.35;
  margin: 2px 0 0 0;
}

/* Donut */
.eg-donut-svg-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
}

.eg-donut-svg {
  width: 100%;
  height: 135px;
  overflow: visible;
}

/* Numbered Callouts [01] & [02] */
.eg-callouts-section {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 8px;
}

.eg-callout-item {
  border: 1px solid #E2E8F0;
  border-radius: 5px;
  padding: 6px 10px;
  background: #F8FAFC;
  display: flex;
  gap: 8px;
  align-items: flex-start;
}

.eg-callout-badge {
  background: #012e5c;
  color: #b6e82c;
  font-family: 'Inter', sans-serif !important;
  font-weight: 800;
  font-size: 13px;
  width: 22px;
  height: 22px;
  border-radius: 3px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.eg-callout-badge.eg-badge-blue {
  background: #012e5c;
  color: #009cdb;
}

.eg-callout-content {
  flex: 1;
}

.eg-callout-heading {
  font-size: 9px;
  font-weight: 800;
  color: #012e5c;
  display: block;
  margin-bottom: 2px;
}

.eg-callout-text {
  font-size: 7.5px;
  color: #475569;
  line-height: 1.35;
  margin: 0;
}

/* Footer */
.eg-footer {
  border-top: 1.5px solid #012e5c;
  padding-top: 5px;
  display: flex;
  justify-content: space-between;
  font-size: 7.5px;
  color: #64748B;
}

.eg-footer-left, .eg-footer-right {
  display: flex;
  align-items: center;
  gap: 6px;
}

.eg-bullet {
  color: #CBD5E1;
}

/* ==========================================================================
   THEME 2: CORPORATE CARMINE (Executive Bordeaux & Warm Slate)
   Strict Palette: Obsidian Slate (#0F172A), Muted Gray, Deep Carmine (#BE123C)
   ========================================================================== */

.theme-carmine {
  color: #0F172A;
}

.carmine-top-stripe {
  height: 4px;
  background: #BE123C;
  width: 100%;
  margin-bottom: 6px;
  border-radius: 2px;
}

.carmine-header {
  border-bottom: 2px solid #BE123C !important;
}

.carmine-brand-box {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ==========================================================================
   THEME 2: CORPORATE CARMINE IDENTITY
   ========================================================================== */

.carmine-header {
  display: flex !important;
  justify-content: space-between !important;
  align-items: center !important;
  padding-bottom: 8px !important;
  border-bottom: 1.5px solid #0F172A !important;
  margin-bottom: 9px !important;
  position: relative !important;
}

.carmine-header::after {
  content: '';
  position: absolute;
  bottom: -1.5px;
  left: 0;
  width: 68px;
  height: 2.5px;
  background: #BE123C;
  border-radius: 2px;
}

.carmine-header-left,
.carmine-header-brand {
  display: flex !important;
  flex-direction: column !important;
  align-items: flex-start !important;
  gap: 2px !important;
  flex: 1 !important;
  min-width: 0 !important;
  padding-right: 20px !important;
}

.carmine-eyebrow {
  display: inline-flex !important;
  align-items: center !important;
  gap: 5px !important;
  margin-bottom: 2px !important;
  font-size: 7.5px !important;
  font-weight: 700 !important;
  letter-spacing: 0.08em !important;
  text-transform: uppercase !important;
}

.carmine-brand-badge {
  background: #BE123C !important;
  color: #FFFFFF !important;
  padding: 1.5px 5.5px !important;
  border-radius: 3px !important;
  font-weight: 800 !important;
  letter-spacing: 0.08em !important;
  font-size: 7px !important;
}

.carmine-eyebrow-sep {
  color: #CBD5E1 !important;
  font-weight: 400 !important;
}

.carmine-eyebrow-doc {
  color: #BE123C !important;
  font-weight: 700 !important;
}

.carmine-title {
  color: #0F172A !important;
  font-family: 'Inter', sans-serif !important;
  font-size: 20px !important;
  font-weight: 800 !important;
  margin: 0 !important;
  line-height: 1.15 !important;
  letter-spacing: -0.03em !important;
  white-space: nowrap !important;
}

.carmine-subtitle {
  font-size: 8.5px !important;
  color: #64748B !important;
  line-height: 1.35 !important;
  margin: 1px 0 0 0 !important;
}

.carmine-subtitle strong {
  color: #0F172A !important;
  font-weight: 700 !important;
}

/* Carmine Header Right (Clean, Uncrowded) */
.carmine-header-right {
  display: flex !important;
  align-items: center !important;
  flex-shrink: 0 !important;
}

.carmine-date-card {
  background: #FFF1F2 !important;
  border: 1px solid #FECDD3 !important;
  border-radius: 6px !important;
  padding: 6px 14px !important;
  display: flex !important;
  align-items: center !important;
  gap: 8px !important;
  white-space: nowrap !important;
  box-shadow: 0 1px 2px rgba(190, 18, 60, 0.04) !important;
  flex-shrink: 0 !important;
}

.carmine-date-card .carmine-card-icon {
  color: #BE123C !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
}

.carmine-date-card .carmine-card-content {
  display: flex !important;
  flex-direction: column !important;
  align-items: flex-start !important;
  line-height: 1.15 !important;
}

.carmine-date-card .carmine-card-lbl {
  font-size: 7px !important;
  text-transform: uppercase !important;
  color: #9F1239 !important;
  font-weight: 700 !important;
  letter-spacing: 0.06em !important;
  margin-bottom: 2px !important;
}

.carmine-date-card .carmine-card-val {
  font-size: 12px !important;
  font-weight: 700 !important;
  color: #BE123C !important;
  white-space: nowrap !important;
  line-height: 1.15 !important;
  font-family: 'JetBrains Mono', monospace !important;
}

.carmine-chip-date {
  border-color: #FECDD3 !important;
  background: #FFF1F2 !important;
}

/* 4 Corporate KPI Grid */
.carmine-kpis-grid {
  display: grid !important;
  grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
  gap: 8px !important;
  width: 100% !important;
  box-sizing: border-box !important;
  margin-bottom: 9px !important;
}

.carmine-kpi-card {
  background: #FFFFFF !important;
  border: 1px solid #E2E8F0 !important;
  border-top: 3px solid #64748B !important;
  padding: 7px 9px !important;
  border-radius: 4px !important;
  min-width: 0 !important;
  box-sizing: border-box !important;
  overflow: hidden !important;
}

.carmine-kpi-highlight {
  border-top-color: #BE123C !important;
  background: #FFFBFB !important;
}

.badge-carmine {
  background: #FFE4E6;
  color: #9F1239;
  font-size: 8px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 3px;
}

.badge-carmine-fill {
  background: #BE123C;
  color: #FFFFFF;
  font-size: 8px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 3px;
}

.badge-dark {
  background: #1E293B;
  color: #FFFFFF;
  font-size: 8px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 3px;
}

.badge-slate {
  background: #F1F5F9;
  color: #334155;
  font-size: 8px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 3px;
}

.carmine-box {
  border-top: 2px solid #BE123C !important;
}

.carmine-tag {
  background: #FFF1F2 !important;
  color: #BE123C !important;
}

.text-carmine {
  color: #BE123C !important;
}

/* Strategic Cost Absorption & Margin Allocation (100% Sense) */
.carmine-cost-structure {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  height: 100%;
}

.carmine-stacked-bar-wrap {
  margin: 3px 0 6px 0;
}

.carmine-stacked-bar {
  display: flex;
  height: 11px;
  border-radius: 3px;
  overflow: hidden;
  background: #F1F5F9;
  border: 1px solid #E2E8F0;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.05);
}

.csb-slice {
  height: 100%;
}

.slice-materials { background: #BE123C; }
.slice-labour { background: #E11D48; }
.slice-overhead { background: #64748B; }
.slice-profit { background: #0F172A; }

.carmine-breakdown-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px 7px;
  background: #F8FAFC;
  border: 1px solid #E2E8F0;
  border-radius: 4px;
  padding: 4px 7px;
  margin-bottom: 5px;
}

.cbg-item {
  display: flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
}

.cbg-dot {
  width: 6.5px;
  height: 6.5px;
  border-radius: 2px;
  flex-shrink: 0;
}

.dot-materials { background: #BE123C; }
.dot-labour { background: #E11D48; }
.dot-overhead { background: #64748B; }
.dot-profit { background: #0F172A; }

.cbg-info {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
  min-width: 0;
}

.cbg-label {
  font-size: 6.8px;
  color: #64748B;
  text-transform: uppercase;
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cbg-val {
  font-size: 9px;
  color: #0F172A;
  font-weight: 700;
  white-space: nowrap;
}

.cbg-pct {
  font-size: 7.5px;
  color: #64748B;
  font-weight: 500;
}

.carmine-callouts-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-top: 4px;
}

.carmine-callout-card {
  background: #FFF8F8;
  border: 1px solid #FFE4E6;
  border-radius: 4px;
  padding: 5px 7px;
  display: flex;
  gap: 6px;
  align-items: flex-start;
}

.cc-num {
  font-weight: 800;
  font-size: 12px;
  color: #BE123C;
  line-height: 1;
}

.cc-content {
  flex: 1;
  min-width: 0;
}

.cc-title {
  display: block;
  font-size: 8px;
  font-weight: 700;
  color: #0F172A;
  margin-bottom: 1.5px;
}

.cc-desc {
  margin: 0;
  font-size: 7px;
  color: #475569;
  line-height: 1.25;
}

.carmine-table-section {
  border-top: 2px solid #BE123C !important;
}

.carmine-table th {
  background: #0F172A !important;
  border-bottom: 2px solid #BE123C !important;
}

.carmine-grand-total {
  border-top: 2px solid #BE123C !important;
  border-bottom: 2px solid #BE123C !important;
  background: #FFF1F2 !important;
}

.pill-carmine-ok {
  background: #F1F5F9;
  color: #0F172A;
}

.carmine-footer {
  border-top: 1px solid #BE123C !important;
}

/* ==========================================================================
   THEME 3: INSTITUTIONAL SLATE (Minimalist Monochrome & Forest Emerald)
   Strict Palette: Obsidian (#0F172A), Slate (#475569), Forest Emerald (#047857)
   ========================================================================== */

.theme-fintech {
  color: #0F172A;
}

.p1-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 8px;
  border-bottom: 2px solid #0F172A;
  margin-bottom: 8px;
}

.p1-header-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.p1-logo-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  background: #0F172A;
  color: #FFFFFF;
  padding: 5px 10px;
  border-radius: 4px;
}

.p1-brand-name {
  font-weight: 800;
  font-size: 15px;
  letter-spacing: 0.05em;
}

.p1-title-block {
  display: flex;
  flex-direction: column;
}

.p1-doc-title {
  margin: 0;
  font-size: 18px;
  font-weight: 800;
  color: #0F172A;
  line-height: 1.15;
  text-transform: uppercase;
  letter-spacing: -0.02em;
}

.p1-doc-subtitle {
  font-size: 9px;
  color: #64748B;
  font-weight: 500;
  margin-top: 1px;
}

.p1-header-meta {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-shrink: 0;
}

.p1-meta-chip {
  background: #F8FAFC;
  border: 1px solid #E2E8F0;
  border-radius: 6px;
  padding: 5px 10px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  text-align: right;
  white-space: nowrap !important;
  flex-shrink: 0;
}

.p1-chip-label {
  font-size: 7px;
  text-transform: uppercase;
  color: #64748B;
  font-weight: 600;
  letter-spacing: 0.05em;
  margin-bottom: 2px;
  white-space: nowrap !important;
}

.p1-chip-val {
  font-size: 11px;
  font-weight: 700;
  color: #0F172A;
  white-space: nowrap !important;
}

.p1-kpis-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 5px;
  margin-bottom: 8px;
}

.p1-kpi-card {
  position: relative;
  background: #FFFFFF;
  border: 1px solid #E2E8F0;
  border-top: 3px solid #0F172A;
  border-radius: 4px;
  padding: 7px 9px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.p1-kpi-card.card-kpi-net {
  border-top-color: #047857 !important;
  background: #F0FDF4 !important;
}

.p1-kpi-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 3px;
}

.p1-kpi-label {
  font-size: 8.5px;
  font-weight: 700;
  color: #475569;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.p1-badge {
  font-size: 7.5px;
  font-weight: 700;
  padding: 1px 4px;
  border-radius: 3px;
  background: #F1F5F9;
  color: #334155;
}

.badge-emerald { background: #DCFCE7; color: #166534; }
.badge-rose { background: #FFE4E6; color: #9F1239; }

.p1-kpi-value {
  font-size: 15px;
  font-weight: 800;
  color: #0F172A;
  line-height: 1.1;
  margin-bottom: 2px;
}

.p1-kpi-unit {
  font-size: 9px;
  font-weight: 500;
  color: #64748B;
}

.p1-kpi-sub {
  font-size: 8px;
  color: #64748B;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.p1-charts-row {
  display: grid;
  grid-template-columns: 1.12fr 0.88fr;
  gap: 10px;
  margin-bottom: 9px;
}

.p1-chart-box {
  background: #FFFFFF;
  border: 1px solid #E2E8F0;
  border-radius: 5px;
  padding: 7px 9px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.p1-chart-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 5px;
  padding-bottom: 3px;
  border-bottom: 1px solid #F1F5F9;
}

.p1-chart-title {
  font-size: 11px;
  font-weight: 700;
  color: #0F172A;
}

.p1-chart-subtitle {
  font-size: 7.5px;
  color: #64748B;
}

.p1-chart-tag {
  font-size: 7.5px;
  color: #475569;
  background: #F1F5F9;
  padding: 1px 5px;
  border-radius: 3px;
  font-weight: 600;
}

.p1-waterfall-wrapper {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.p1-waterfall-svg {
  width: 100%;
  height: 155px;
  overflow: visible;
}

.wf-val {
  font-size: 8px;
  font-weight: 700;
  fill: #0F172A;
}

.wf-lbl {
  font-size: 7.5px;
  font-weight: 600;
  fill: #64748B;
}

.p1-split-structure {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  height: 100%;
}

.p1-split-lbl-row {
  display: flex;
  justify-content: space-between;
  font-size: 8px;
  font-weight: 600;
  color: #334155;
  margin-bottom: 3px;
}

.p1-multi-bar {
  height: 9px;
  background: #F1F5F9;
  border-radius: 2px;
  display: flex;
  overflow: hidden;
  margin-bottom: 3px;
}

.p1-bar-slice {
  height: 100%;
}

.p1-legend-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 7.5px;
  color: #475569;
}

.p1-legend-item {
  display: flex;
  align-items: center;
  gap: 3px;
}

.p1-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  display: inline-block;
}

.bg-dark { background: #0F172A !important; }
.bg-slate { background: #475569 !important; }
.bg-light-slate { background: #94A3B8 !important; }
.bg-emerald { background: #047857 !important; }

.p1-profit-banner {
  background: #F0FDF4;
  border: 1px solid #BBF7D0;
  border-radius: 4px;
  padding: 5px 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 6px;
}

.p1-pb-label {
  font-size: 8px;
  font-weight: 700;
  color: #166534;
  display: block;
}

.p1-pb-sub {
  font-size: 7px;
  color: #15803D;
}

.p1-pb-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.p1-pb-pct {
  font-size: 12px;
  line-height: 1.1;
  color: #047857;
}

.p1-pb-status {
  font-size: 7px;
  color: #166534;
  font-weight: 600;
}

.p1-table-section {
  background: #FFFFFF;
  border: 1px solid #0F172A;
  border-radius: 4px;
  padding: 5px 7px;
  margin-bottom: 7px;
}

.p1-table-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}

.p1-table-title {
  font-size: 10px;
  font-weight: 700;
  color: #0F172A;
}

.p1-table-badge {
  font-size: 7.5px;
  font-weight: 600;
  color: #475569;
  background: #F1F5F9;
  padding: 1px 5px;
  border-radius: 3px;
}

.p1-orders-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 7.5px;
}

.p1-orders-table th {
  background: #0F172A;
  color: #FFFFFF;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 3.5px 5px;
  font-size: 7px;
}

.p1-orders-table td {
  padding: 3px 5px;
  border-bottom: 1px solid #F1F5F9;
}

.p1-orders-table tr.row-alt { background: #FAFAFC; }
.p1-orders-table tr.row-loss { background: #FEF2F2; }
.p1-orders-table tr.row-summary-other { background: #F8FAFC; border-top: 1px dashed #CBD5E1; }
.p1-orders-table tr.row-grand-total { background: #F1F5F9; border-top: 2px solid #0F172A; border-bottom: 2px solid #0F172A; }

.p1-footer {
  border-top: 1px solid #0F172A;
  padding-top: 4px;
}

.p1-footer-audit {
  background: #F8FAFC;
  border: 1px solid #E2E8F0;
  border-radius: 3px;
  padding: 3px 6px;
  font-size: 7px;
  color: #334155;
  display: flex;
  align-items: center;
  gap: 5px;
  margin-bottom: 3px;
}

.p1-audit-check {
  font-weight: 700;
  color: #047857;
}

.p1-footer-bottom {
  display: flex;
  justify-content: space-between;
  font-size: 7px;
  color: #64748B;
}

.text-emerald { color: #047857 !important; }
.text-rose { color: #BE123C !important; }
