:root {
  color-scheme: light;
  --bg: #f4f6f9;
  --surface: #ffffff;
  --surface-alt: #f1f4f7;
  --ink: #142033;
  --muted: #637087;
  --line: #d8e0ea;
  --teal: #24746a;
  --teal-dark: #1e5f57;
  --blue: #26358f;
  --amber: #d57a1f;
  --red: #c7362f;
  --green: #2f8f3a;
  --orange: #f26a3d;
  --shadow: 0 16px 36px rgba(20, 32, 51, 0.07);
  --radius: 8px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background: var(--bg);
}

.print-footer {
  display: none;
}

button,
input,
select {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(250px, 300px) minmax(0, 1fr);
  grid-template-rows: auto 1fr;
}

.topbar {
  grid-column: 1 / -1;
  min-height: 84px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 24px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
  border-bottom: 1px solid var(--line);
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 13px;
  min-width: 0;
}

.brand-logo {
  width: 44px;
  height: 44px;
  object-fit: contain;
  flex: 0 0 auto;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.topbar h1,
.report-title h2,
.control-section h2,
.chart-panel h3,
.text-panel h3 {
  margin: 0;
  letter-spacing: 0;
}

.topbar h1 {
  font-size: 24px;
  line-height: 1.1;
  color: var(--ink);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.language-control {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 10px;
  color: var(--muted);
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-size: 12px;
  font-weight: 750;
}

.language-control select {
  min-height: 28px;
  width: auto;
  min-width: 104px;
  padding: 0 26px 0 8px;
  border: 0;
  background-color: transparent;
  color: var(--ink);
  font-size: 13px;
}

.eyebrow {
  margin: 0 0 4px;
  font-size: 11px;
  color: var(--muted);
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.primary-button,
.ghost-button,
.segment {
  min-height: 40px;
  border-radius: 8px;
  padding: 0 14px;
  font-weight: 750;
  white-space: nowrap;
}

.primary-button {
  color: #ffffff;
  background: var(--blue);
}

.primary-button:hover {
  background: #1f2b74;
}

.ghost-button {
  color: var(--ink);
  background: #ffffff;
  border: 1px solid var(--line);
}

.control-panel {
  padding: 18px;
  background: #fbfcfd;
  border-right: 1px solid var(--line);
  overflow: auto;
}

.control-section {
  padding: 0 0 18px;
  margin-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.control-section h2 {
  font-size: 14px;
  margin-bottom: 10px;
}

.upload-drop {
  display: grid;
  place-items: center;
  min-height: 130px;
  padding: 16px;
  text-align: center;
  background: #f7fafc;
  border: 1px dashed #a7b4c3;
  border-radius: var(--radius);
}

.upload-drop.dragging {
  border-color: var(--teal);
  background: #e8f5f2;
}

.upload-drop input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.upload-title {
  display: block;
  font-weight: 850;
  margin-bottom: 4px;
}

.upload-note,
.file-status,
.sample-link,
.report-meta {
  color: var(--muted);
  font-size: 13px;
}

.sample-link {
  display: inline-block;
  margin-top: 10px;
  color: var(--teal-dark);
  font-weight: 750;
}

.file-status {
  min-height: 18px;
  margin: 10px 0 0;
}

.file-status.success {
  padding: 10px 11px;
  color: #14532d;
  background: #ecfdf3;
  border: 1px solid #bbf7d0;
  border-radius: var(--radius);
  font-weight: 750;
}

.file-status.error {
  padding: 10px 11px;
  color: var(--red);
  background: #fff7f7;
  border: 1px solid #fecaca;
  border-radius: var(--radius);
  font-weight: 750;
}

.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 10px;
}

.segment {
  color: var(--muted);
  background: #ffffff;
  border: 1px solid var(--line);
}

.segment.active {
  color: #ffffff;
  background: var(--blue);
  border-color: var(--blue);
}

.check-list {
  display: grid;
  gap: 5px;
  max-height: 210px;
  overflow: auto;
  padding-right: 4px;
}

.check-row,
.toggle-row,
.control-section label:not(.upload-drop) {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ink);
  font-size: 14px;
}

.check-row {
  justify-content: flex-start;
  min-height: 34px;
  padding: 6px 9px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
}

.check-row input,
.toggle-row input {
  inline-size: 16px;
  block-size: 16px;
}

.control-section label:not(.upload-drop) {
  flex-direction: column;
  align-items: stretch;
  font-weight: 750;
  margin-bottom: 10px;
}

.check-row {
  flex-direction: row !important;
  align-items: center !important;
  font-weight: 700 !important;
  margin-bottom: 0 !important;
}

.toggle-row {
  flex-direction: row !important;
  align-items: center !important;
  font-weight: 650 !important;
}

.options-section {
  padding-bottom: 14px;
}

.options-section .toggle-row {
  min-height: 32px;
  margin-bottom: 7px !important;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
  color: #263348;
  font-size: 12.5px;
}

.options-section .toggle-row:has(input:checked) {
  border-color: #cfd7f2;
  background: #f7f8ff;
}

.options-section input[type="checkbox"] {
  accent-color: var(--blue);
}

select {
  width: 100%;
  min-height: 40px;
  color: var(--ink);
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0 10px;
}

.full-width {
  width: 100%;
}

.dashboard {
  min-width: 0;
  padding: 22px;
  overflow: auto;
}

.report-title {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 18px;
  margin-bottom: 16px;
}

.report-title h2 {
  font-size: 22px;
}

.validation-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.validation-item {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
  box-shadow: 0 8px 22px rgba(20, 32, 51, 0.04);
}

.validation-item strong {
  display: block;
  font-size: 13px;
}

.validation-item span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-top: 2px;
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.metric-card {
  min-height: 104px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(180deg, #ffffff 0%, #fbfcfd 100%);
  box-shadow: var(--shadow);
}

.metric-card.danger {
  border-color: #fecaca;
  background: #fff7f7;
}

.metric-card.warning {
  border-color: #fde68a;
  background: #fffaf0;
}

.metric-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.metric-value {
  font-size: 25px;
  line-height: 1;
  font-weight: 850;
}

.metric-value.negative,
.metric-value.danger,
.danger-text {
  color: var(--red);
  fill: var(--red);
}

.metric-value.warning {
  color: var(--amber);
}

.metric-note {
  color: var(--muted);
  font-size: 12px;
}

.analysis-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.chart-panel,
.text-panel {
  min-width: 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(180deg, #ffffff 0%, #fbfcfd 100%);
  box-shadow: var(--shadow);
}

.chart-panel.wide {
  grid-column: 1 / -1;
}

.is-hidden {
  display: none !important;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 12px;
}

.panel-header h3 {
  font-size: 16px;
}

.panel-badge,
.risk-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 26px;
  border-radius: 999px;
  padding: 0 10px;
  font-size: 12px;
  font-weight: 850;
  background: #eef2f6;
  color: var(--muted);
}

.risk-pill.growth {
  color: var(--green);
  background: #e8f6ee;
}

.risk-pill.stable {
  color: var(--blue);
  background: #eaf1ff;
}

.risk-pill.watch {
  color: var(--amber);
  background: #fff6df;
}

.risk-pill.risk {
  color: var(--red);
  background: #fff0e8;
}

.chart-frame {
  height: 310px;
  min-height: 260px;
}

.trend-chart-panel .chart-frame {
  height: 250px;
  min-height: 220px;
}

.tall-chart .chart-frame {
  height: 700px;
  min-height: 620px;
}

.pipeline-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 22px 0 20px;
  border-bottom: 1px solid var(--line);
}

.pipeline-tab {
  min-height: 54px;
  color: #53627a;
  background: #ffffff;
  border: 1px solid var(--line);
  border-bottom: 0;
  border-radius: 8px 8px 0 0;
  font-size: 16px;
  font-weight: 850;
}

.pipeline-tab.active {
  color: #ffffff;
  background: var(--blue);
  border-color: var(--blue);
  box-shadow: inset 0 -2px 0 rgba(255, 255, 255, 0.16);
}

.pipeline-legend {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 18px 34px;
  width: fit-content;
  max-width: 100%;
  min-height: 42px;
  margin-bottom: 22px;
  padding: 11px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
}

.pipeline-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: #4b5b73;
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
}

.pipeline-legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
}

.pipeline-legend-dot.square {
  border-radius: 2px;
}

.chart-frame svg {
  display: block;
  width: 100%;
  height: 100%;
}

.chart-note {
  min-height: 40px;
  margin: 12px 0 0;
  padding: 10px 12px;
  color: #314155;
  background: #f7fafb;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-size: 13px;
  line-height: 1.45;
}

.position-diagnosis {
  display: grid;
  gap: 14px;
  color: #283546;
  font-size: 13px;
  line-height: 1.45;
}

.position-summary-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 18px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.position-summary-item {
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.position-summary-item:nth-last-child(-n + 2) {
  border-bottom: 0;
}

.position-summary-item span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.position-summary-item strong {
  display: block;
  margin-top: 4px;
  color: var(--ink);
  font-size: 20px;
  line-height: 1.1;
}

.position-summary-item strong.negative {
  color: var(--red);
}

.position-summary-item strong.positive {
  color: var(--green);
}

.position-seasonal-note {
  padding: 10px 12px;
  border-left: 3px solid #7c3aed;
  background: #f5f3ff;
  color: #3b2c65;
}

.position-plan-list {
  display: grid;
  gap: 9px;
  padding: 0;
  margin: 0;
  list-style: none;
}

.position-plan-list li {
  position: relative;
  padding-left: 18px;
}

.position-plan-list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 8px;
  width: 7px;
  height: 7px;
  border-radius: 2px;
  background: var(--teal);
}

.trend-table-wrap {
  margin-top: 12px;
  overflow-x: auto;
}

.trend-table {
  width: 100%;
  min-width: 560px;
  border-collapse: collapse;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
  font-size: 13px;
}

.trend-table th,
.trend-table td {
  padding: 9px 10px;
  border-bottom: 1px solid var(--line);
  text-align: right;
  white-space: nowrap;
}

.trend-table th:first-child,
.trend-table td:first-child {
  text-align: left;
}

.trend-table th {
  color: var(--muted);
  background: var(--surface-alt);
  font-size: 12px;
  font-weight: 850;
  text-transform: uppercase;
}

.trend-table tr:last-child td {
  border-bottom: 0;
}

.trend-table .negative {
  color: var(--red);
  font-weight: 400;
}

.trend-table .positive {
  color: var(--green);
  font-weight: 400;
}

.axis-text {
  fill: var(--muted);
  font-size: 11px;
}

.chart-label {
  fill: var(--ink);
  font-size: 12px;
  font-weight: 750;
}

.legend-text {
  fill: #334155;
  font-size: 11px;
  font-weight: 750;
}

.heatmap {
  display: grid;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.heat-row {
  display: grid;
  grid-template-columns: minmax(130px, 1.2fr) repeat(var(--term-count), minmax(76px, 1fr));
  gap: 6px;
  min-width: 620px;
}

.heat-cell {
  min-height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  color: #10202f;
  font-size: 12px;
  font-weight: 750;
  border: 1px solid rgba(24, 33, 47, 0.08);
}

.heat-head {
  background: var(--surface-alt);
  color: var(--muted);
}

.heat-label {
  justify-content: flex-start;
  padding-left: 10px;
  background: #ffffff;
}

.commentary-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 14px;
  margin-top: 14px;
}

.recovery-campaign-layout {
  margin-top: 14px;
}

.campaign-lead {
  margin: 0 0 12px;
  color: #344054;
  line-height: 1.45;
}

.campaign-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  padding: 0;
  margin: 0;
  list-style: none;
}

.campaign-list li {
  padding: 12px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--orange);
  border-radius: var(--radius);
  background: #fffdfb;
}

.campaign-list strong,
.campaign-list span,
.campaign-list p {
  display: block;
}

.campaign-list strong {
  margin-bottom: 4px;
  color: var(--ink);
}

.campaign-list span {
  margin-bottom: 6px;
  color: var(--amber);
  font-size: 12px;
  font-weight: 800;
}

.campaign-list p {
  margin: 0;
  color: #344054;
  line-height: 1.4;
}

.insight-list {
  display: grid;
  gap: 10px;
  padding: 0;
  margin: 0;
  list-style: none;
}

.insight-list li {
  position: relative;
  padding: 10px 12px 10px 34px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fbfcfd;
  color: #283546;
  line-height: 1.58;
}

.insight-list li::before {
  content: "";
  position: absolute;
  left: 13px;
  top: 16px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--teal);
}

.empty-state {
  display: grid;
  place-items: center;
  min-height: 180px;
  color: var(--muted);
  text-align: center;
  padding: 20px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  background: #fbfcfd;
}

@media (max-width: 1100px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .control-panel {
    border-right: 0;
    border-bottom: 1px solid var(--line);
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
  }

  .control-section {
    margin-bottom: 0;
  }

  .control-panel > .primary-button {
    grid-column: 1 / -1;
  }

  .validation-strip,
  .metrics-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .topbar,
  .report-title {
    align-items: stretch;
    flex-direction: column;
  }

  .topbar-actions {
    justify-content: stretch;
  }

  .topbar-actions button {
    flex: 1;
  }

  .control-panel,
  .analysis-grid,
  .commentary-layout,
  .campaign-list,
  .validation-strip,
  .metrics-grid {
    grid-template-columns: 1fr;
  }

  .dashboard {
    padding: 16px;
  }

  .chart-frame {
    height: 270px;
  }
}

@page {
  size: A4 portrait;
  margin: 9mm 10mm 9mm;
}

body.print-layout {
  min-width: 0;
  background: #ffffff;
}

body.print-layout * {
  print-color-adjust: exact;
  -webkit-print-color-adjust: exact;
}

body.print-layout .app-shell {
  display: block;
  min-height: auto;
}

body.print-layout .control-panel,
body.print-layout .topbar-actions,
body.print-layout .validation-strip,
body.print-layout .panel-badge,
body.print-layout .pipeline-tabs {
  display: none !important;
}

body.print-layout .print-footer {
  position: fixed;
  right: 10mm;
  bottom: 2mm;
  left: 10mm;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 5mm;
  padding-top: 1mm;
  color: #667085;
  border-top: 1px solid #d6dee8;
  background: #ffffff;
  font-size: 6.3pt;
  line-height: 1;
  z-index: 20;
}

body.print-layout .print-footer span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body.print-layout .print-footer span:first-child,
body.print-layout .print-footer span:last-child {
  flex: 1 1 0;
}

body.print-layout .print-footer span:last-child {
  text-align: right;
}

body.print-layout #printBranchName {
  flex: 0 1 58mm;
  color: #344054;
  font-weight: 750;
  text-align: center;
}

body.print-layout .topbar {
  width: 188mm;
  max-width: 100%;
  min-height: 0;
  padding: 0 0 4mm;
  margin: 0 auto 4mm;
  background: #ffffff;
  border-bottom: 1px solid #cfd8e3;
}

body.print-layout .brand-logo {
  width: 10mm;
  height: 10mm;
  padding: 1mm;
}

body.print-layout .topbar h1 {
  font-size: 13pt;
}

body.print-layout .topbar .eyebrow {
  font-size: 6.5pt;
}

body.print-layout .dashboard {
  display: flex;
  flex-direction: column;
  gap: 0;
  width: 188mm;
  max-width: 100%;
  margin: 0 auto;
  padding: 0 0 5mm;
  overflow: visible;
}

body.print-layout .report-title {
  order: 1;
  align-items: flex-end;
  margin: 0 0 3mm;
  break-inside: avoid;
}

body.print-layout .report-title h2 {
  font-size: 13pt;
}

body.print-layout .report-meta {
  font-size: 7pt;
}

body.print-layout .validation-strip {
  order: 2;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 2mm;
  margin: 0 0 3mm;
  break-inside: avoid;
}

body.print-layout .validation-item {
  min-height: 14mm;
  padding: 2mm;
  border-radius: 5px;
  box-shadow: none;
}

body.print-layout .validation-item strong {
  font-size: 7.5pt;
  line-height: 1.15;
}

body.print-layout .validation-item span {
  display: -webkit-box;
  margin-top: 1mm;
  overflow: hidden;
  color: #667085;
  font-size: 6.5pt;
  line-height: 1.2;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

body.print-layout .metrics-grid {
  order: 3;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 2mm;
  margin: 0 0 4mm;
  break-inside: avoid;
}

body.print-layout .metric-card {
  min-height: 18mm;
  padding: 2mm;
  border-radius: 5px;
  box-shadow: none;
}

body.print-layout .metric-label {
  font-size: 6.5pt;
}

body.print-layout .metric-value {
  font-size: 14pt;
}

body.print-layout .metric-note {
  font-size: 6.5pt;
  line-height: 1.15;
}

body.print-layout .commentary-layout {
  order: 5;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 3mm;
  margin: 0 0 4mm;
  break-inside: avoid;
  width: 100%;
}

body.print-layout .recovery-campaign-layout {
  order: 7;
  width: 100%;
  margin: 0 0 4mm;
  break-inside: avoid;
}

body.print-layout .analysis-grid {
  display: contents;
}

body.print-layout .analysis-grid > * {
  order: 6;
  width: 100%;
  margin: 0 0 4mm;
}

body.print-layout .trend-chart-panel {
  order: 4;
}

body.print-layout .chart-panel,
body.print-layout .text-panel {
  padding: 3mm;
  border-radius: 5px;
  background: #ffffff;
  box-shadow: none;
  break-inside: avoid;
  page-break-inside: avoid;
}

body.print-layout .panel-header {
  margin-bottom: 2mm;
}

body.print-layout .eyebrow {
  font-size: 6.5pt;
}

body.print-layout .panel-header h3,
body.print-layout .text-panel h3 {
  font-size: 10pt;
}

body.print-layout .chart-frame {
  height: 76mm;
  min-height: 0;
}

body.print-layout .trend-chart-panel .chart-frame {
  height: 72mm;
}

body.print-layout .tall-chart .chart-frame {
  height: 96mm;
}

body.print-layout .trend-table-wrap {
  display: block !important;
  margin-top: 2mm;
  overflow: visible;
}

body.print-layout .trend-table {
  min-width: 0;
  border-radius: 4px;
  font-size: 6.3pt;
}

body.print-layout .trend-table th,
body.print-layout .trend-table td {
  padding: 1.1mm 1.3mm;
}

body.print-layout .trend-table th {
  font-size: 5.8pt;
  font-weight: 750;
}

body.print-layout .chart-note {
  display: -webkit-box;
  min-height: 0;
  max-height: 11mm;
  margin-top: 2mm;
  padding: 1.7mm 2mm;
  overflow: hidden;
  border-radius: 5px;
  font-size: 7pt;
  line-height: 1.25;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

body.print-layout .pipeline-legend {
  min-height: 0;
  margin-bottom: 2mm;
  padding: 1.5mm 2mm;
  gap: 2mm 5mm;
}

body.print-layout .pipeline-legend-item {
  font-size: 7pt;
}

body.print-layout .position-diagnosis {
  gap: 2mm;
  font-size: 7.2pt;
  line-height: 1.25;
}

body.print-layout .position-summary-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0 2mm;
}

body.print-layout .position-summary-item {
  padding: 1.5mm 0;
  border-bottom: 0;
}

body.print-layout .position-summary-item span {
  font-size: 6pt;
}

body.print-layout .position-summary-item strong {
  font-size: 10pt;
}

body.print-layout .position-seasonal-note {
  padding: 1.5mm 2mm;
}

body.print-layout .position-plan-list {
  gap: 1mm;
}

body.print-layout .heatmap {
  max-height: 75mm;
  overflow: hidden;
}

body.print-layout .heat-row {
  min-width: 0;
  gap: 1mm;
  grid-template-columns: minmax(24mm, 1.2fr) repeat(var(--term-count), minmax(10mm, 1fr));
}

body.print-layout .heat-cell {
  min-height: 5mm;
  border-radius: 3px;
  font-size: 6pt;
}

body.print-layout .insight-list {
  gap: 1.5mm;
}

body.print-layout .insight-list li {
  padding: 1.8mm 2mm 1.8mm 5mm;
  border-radius: 5px;
  font-size: 7.2pt;
  line-height: 1.4;
}

body.print-layout .insight-list li::before {
  left: 2mm;
  top: 3.2mm;
  width: 1.6mm;
  height: 1.6mm;
}

body.print-layout .campaign-lead {
  margin: 0 0 2mm;
  font-size: 7.2pt;
  line-height: 1.25;
}

body.print-layout .campaign-list {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 2mm;
}

body.print-layout .campaign-list li {
  padding: 2mm;
  border-radius: 4px;
  font-size: 7pt;
  line-height: 1.25;
}

body.print-layout .campaign-list span {
  margin-bottom: 1mm;
  font-size: 6.5pt;
}

body.print-layout .campaign-list p {
  line-height: 1.25;
}

@media print {
  html,
  body {
    min-width: 0;
    background: #ffffff;
    print-color-adjust: exact;
    -webkit-print-color-adjust: exact;
  }

  .app-shell {
    display: block;
    min-height: auto;
  }

  .control-panel,
  .topbar-actions,
  .validation-strip,
  .panel-badge,
  .pipeline-tabs {
    display: none !important;
  }

  .print-footer {
    position: fixed;
    right: 10mm;
    bottom: 2mm;
    left: 10mm;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 5mm;
    padding-top: 1mm;
    color: #667085;
    border-top: 1px solid #d6dee8;
    background: #ffffff;
    font-size: 6.3pt;
    line-height: 1;
    z-index: 20;
  }

  .print-footer span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .print-footer span:first-child,
  .print-footer span:last-child {
    flex: 1 1 0;
  }

  .print-footer span:last-child {
    text-align: right;
  }

  #printBranchName {
    flex: 0 1 58mm;
    color: #344054;
    font-weight: 750;
    text-align: center;
  }

  .topbar {
    min-height: 0;
    padding: 0 0 4mm;
    margin: 0 0 4mm;
    background: #ffffff;
    border-bottom: 1px solid #cfd8e3;
  }

  .brand-logo {
    width: 10mm;
    height: 10mm;
    padding: 1mm;
  }

  .topbar h1 {
    font-size: 13pt;
  }

  .topbar .eyebrow {
    font-size: 6.5pt;
  }

  .dashboard {
    display: flex;
    flex-direction: column;
    gap: 0;
    padding: 0 0 5mm;
    overflow: visible;
  }

  .report-title {
    order: 1;
    align-items: flex-end;
    margin: 0 0 3mm;
    break-inside: avoid;
  }

  .report-title h2 {
    font-size: 13pt;
  }

  .report-meta {
    font-size: 7pt;
  }

  .validation-strip {
    order: 2;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 2mm;
    margin: 0 0 3mm;
    break-inside: avoid;
  }

  .validation-item {
    min-height: 14mm;
    padding: 2mm;
    border-radius: 5px;
    box-shadow: none;
  }

  .validation-item strong {
    font-size: 7.5pt;
    line-height: 1.15;
  }

  .validation-item span {
    display: -webkit-box;
    margin-top: 1mm;
    overflow: hidden;
    color: #667085;
    font-size: 6.5pt;
    line-height: 1.2;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
  }

  .metrics-grid {
    order: 3;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 2mm;
    margin: 0 0 4mm;
    break-inside: avoid;
  }

  .metric-card {
    min-height: 18mm;
    padding: 2mm;
    border-radius: 5px;
    box-shadow: none;
  }

  .metric-label {
    font-size: 6.5pt;
  }

  .metric-value {
    font-size: 14pt;
  }

  .metric-note {
    font-size: 6.5pt;
    line-height: 1.15;
  }

  .commentary-layout {
    order: 5;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 3mm;
    margin: 0 0 4mm;
    break-inside: avoid;
    width: 100%;
  }

  .recovery-campaign-layout {
    order: 7;
    width: 100%;
    margin: 0 0 4mm;
    break-inside: avoid;
  }

  .analysis-grid {
    display: contents;
  }

  .analysis-grid > * {
    order: 6;
    width: 100%;
    margin: 0 0 4mm;
  }

  .trend-chart-panel {
    order: 4;
  }

  .chart-panel,
  .text-panel {
    padding: 3mm;
    border-radius: 5px;
    background: #ffffff;
    box-shadow: none;
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .panel-header {
    margin-bottom: 2mm;
  }

  .eyebrow {
    font-size: 6.5pt;
  }

  .panel-header h3,
  .text-panel h3 {
    font-size: 10pt;
  }

  .chart-frame {
    height: 76mm;
    min-height: 0;
  }

  .trend-chart-panel .chart-frame {
    height: 72mm;
  }

  .tall-chart .chart-frame {
    height: 96mm;
  }

  .trend-table-wrap {
    display: block !important;
    margin-top: 2mm;
    overflow: visible;
  }

  .trend-table {
    min-width: 0;
    border-radius: 4px;
    font-size: 6.3pt;
  }

  .trend-table th,
  .trend-table td {
    padding: 1.1mm 1.3mm;
  }

  .trend-table th {
    font-size: 5.8pt;
    font-weight: 750;
  }

  .chart-note {
    display: -webkit-box;
    min-height: 0;
    max-height: 11mm;
    margin-top: 2mm;
    padding: 1.7mm 2mm;
    overflow: hidden;
    border-radius: 5px;
    font-size: 7pt;
    line-height: 1.25;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
  }

  .pipeline-legend {
    min-height: 0;
    margin-bottom: 2mm;
    padding: 1.5mm 2mm;
    gap: 2mm 5mm;
  }

  .pipeline-legend-item {
    font-size: 7pt;
  }

  .position-diagnosis {
    gap: 2mm;
    font-size: 7.2pt;
    line-height: 1.25;
  }

  .position-summary-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0 2mm;
  }

  .position-summary-item {
    padding: 1.5mm 0;
    border-bottom: 0;
  }

  .position-summary-item span {
    font-size: 6pt;
  }

  .position-summary-item strong {
    font-size: 10pt;
  }

  .position-seasonal-note {
    padding: 1.5mm 2mm;
  }

  .position-plan-list {
    gap: 1mm;
  }

  .heatmap {
    max-height: 75mm;
    overflow: hidden;
  }

  .heat-row {
    min-width: 0;
    gap: 1mm;
    grid-template-columns: minmax(24mm, 1.2fr) repeat(var(--term-count), minmax(10mm, 1fr));
  }

  .heat-cell {
    min-height: 5mm;
    border-radius: 3px;
    font-size: 6pt;
  }

  .insight-list {
    gap: 1.5mm;
  }

  .insight-list li {
    padding: 1.8mm 2mm 1.8mm 5mm;
    border-radius: 5px;
    font-size: 7.2pt;
    line-height: 1.4;
  }

  .insight-list li::before {
    left: 2mm;
    top: 3.2mm;
    width: 1.6mm;
    height: 1.6mm;
  }

  .campaign-lead {
    margin: 0 0 2mm;
    font-size: 7.2pt;
    line-height: 1.25;
  }

  .campaign-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 2mm;
  }

  .campaign-list li {
    padding: 2mm;
    border-radius: 4px;
    font-size: 7pt;
    line-height: 1.25;
  }

  .campaign-list span {
    margin-bottom: 1mm;
    font-size: 6.5pt;
  }

  .campaign-list p {
    line-height: 1.25;
  }
}
