* { box-sizing: border-box; }
body {
  margin: 0;
  background: #e8eef6;
  color: #071a33;
  font-family: Arial, Helvetica, sans-serif;
  overflow-x: hidden;
}
.report-shell, .asset-shell { padding: 24px; }
.top-actions {
  max-width: 1120px;
  margin: 0 auto 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 12px;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 6px;
  background: #071423;
  box-shadow: 0 12px 30px rgba(7,20,35,0.24);
}
.top-actions a {
  display: inline-block;
  padding: 10px 14px;
  border-radius: 4px;
  border: 1px solid rgba(255,255,255,0.18);
  background: rgba(255,255,255,0.06);
  color: #f8fafc;
  text-decoration: none;
  font-weight: 700;
  font-size: 13px;
}
.top-actions a:hover { background: rgba(74,163,255,0.18); }
.top-actions a.secondary { background: rgba(255,255,255,0.1); }
.button {
  display: inline-block;
  padding: 10px 14px;
  border-radius: 4px;
  background: #168eea;
  color: #fff;
  text-decoration: none;
  font-weight: 700;
  font-size: 13px;
}
.report-dashboard {
  width: 100%;
  max-width: 1120px;
  margin: 0 auto 24px;
  padding: 30px;
  background: #fff;
  border: 1px solid #dbe3ef;
  box-shadow: 0 14px 34px rgba(15, 23, 42, 0.14);
}
.dashboard-header {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: flex-start;
  padding-bottom: 18px;
  border-bottom: 3px solid #071a33;
}
.dashboard-header h1 {
  margin: 4px 0 8px;
  color: #071a33;
  font-size: 46px;
}
.dashboard-meta {
  color: #475569;
  font-size: 13px;
  line-height: 1.55;
  text-align: right;
}
.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
  margin-top: 22px;
}
.dashboard-card {
  padding: 18px;
  border: 1px solid #dbe3ef;
  border-radius: 6px;
  background: #f8fafc;
}
.dashboard-card h2,
.chart-section h2,
.performance-section h2 {
  margin: 0 0 14px;
  color: #0b5fa5;
  font-family: Georgia, serif;
  font-size: 31px;
}
.changes-table th {
  width: 30%;
}
.changes-table .in-label {
  color: #07850d;
  font-weight: 800;
}
.changes-table .out-label {
  color: #e00000;
  font-weight: 800;
}
.chart-section,
.performance-section {
  margin-top: 22px;
}
.chart-stack {
  display: grid;
  gap: 16px;
}
.chart-frame {
  padding: 12px;
  border: 1px solid #dbe3ef;
  border-radius: 6px;
  background: #fff;
}
.chart-frame h3 {
  margin: 0 0 10px;
  color: #071a33;
  font-size: 19px;
}
.dashboard-chart {
  width: 100%;
  max-height: 760px;
  display: block;
  object-fit: contain;
  border: 1px solid #e2e8f0;
  background: #fff;
}
.performance-table td,
.performance-table th {
  font-size: 16px;
}
.metric-tooltip {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border-bottom: 1px dotted #0b5fa5;
  color: #071a33;
  font-weight: 800;
  cursor: help;
  outline: none;
}
.metric-tooltip::after {
  content: attr(data-tooltip);
  position: absolute;
  left: 0;
  bottom: calc(100% + 10px);
  z-index: 20;
  width: min(280px, calc(100vw - 48px));
  padding: 10px 12px;
  border-radius: 6px;
  background: #071423;
  color: #f8fafc;
  box-shadow: 0 12px 24px rgba(7, 20, 35, 0.24);
  font-size: 12px;
  font-weight: 400;
  line-height: 1.4;
  text-align: left;
  white-space: normal;
  opacity: 0;
  pointer-events: none;
  transform: translateY(4px);
  transition: opacity 0.16s ease, transform 0.16s ease;
}
.metric-tooltip::before {
  content: "";
  position: absolute;
  left: 14px;
  bottom: calc(100% + 4px);
  z-index: 21;
  border: 6px solid transparent;
  border-top-color: #071423;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.16s ease;
}
.metric-tooltip:hover::after,
.metric-tooltip:hover::before,
.metric-tooltip:focus::after,
.metric-tooltip:focus::before {
  opacity: 1;
  transform: translateY(0);
}
.metric-tooltip:focus {
  box-shadow: 0 0 0 3px rgba(11, 95, 165, 0.16);
}
.table-scroll {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.monthly-performance-table {
  width: max-content;
  min-width: 1040px;
  table-layout: auto;
  font-size: 13px;
}
.monthly-performance-table th,
.monthly-performance-table td {
  padding: 9px 6px;
  text-align: right;
  font-weight: 400 !important;
  white-space: nowrap;
  overflow-wrap: normal;
}
.monthly-performance-table th:first-child,
.monthly-performance-table td:first-child {
  position: sticky;
  left: 0;
  z-index: 1;
  background: #fff;
  text-align: left;
}
.monthly-performance-table th:nth-last-child(-n+3),
.monthly-performance-table td:nth-last-child(-n+3) {
  min-width: 96px;
}
.monthly-performance-table .negative-value { color: #b91c1c; }
.monthly-performance-table .positive-value { color: #166534; }
.monthly-performance-table .neutral-value { color: #475569; }
.data-note {
  margin: 0;
  padding: 14px;
  border: 1px solid #dbe3ef;
  border-radius: 6px;
  background: #f8fafc;
  color: #475569;
  font-size: 14px;
}
.contribution-chart {
  min-height: 300px;
  display: grid;
  grid-template-columns: repeat(10, minmax(56px, 1fr));
  gap: 12px;
  align-items: end;
  padding: 18px 12px 10px;
  border: 1px solid #dbe3ef;
  border-radius: 6px;
  background: linear-gradient(to top, #e2e8f0 1px, transparent 1px) 0 75% / 100% 25%;
}
.contribution-bar-wrap {
  height: 240px;
  display: grid;
  grid-template-rows: 1fr auto auto;
  align-items: end;
  gap: 6px;
  min-width: 0;
  text-align: center;
}
.contribution-bar {
  width: 100%;
  max-width: 42px;
  min-height: 8px;
  margin: 0 auto;
  border-radius: 4px 4px 0 0;
}
.contribution-bar.positive { background: #15803d; }
.contribution-bar.negative { background: #b91c1c; }
.contribution-value {
  color: #071a33;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}
.contribution-label {
  min-height: 28px;
  color: #475569;
  font-size: 11px;
  font-weight: 800;
  overflow-wrap: anywhere;
}
.ticker-link {
  color: #0b5fa5;
  font-weight: 800;
  text-decoration: none;
}
.ticker-link:hover {
  text-decoration: underline;
}
.mini-table th:first-child,
.mini-table td:first-child {
  min-width: 72px;
  white-space: nowrap;
  overflow-wrap: normal;
}
.selection-table {
  min-width: 840px;
  font-size: 13px;
}
.selection-table th,
.selection-table td {
  padding: 10px 8px;
  white-space: nowrap;
  overflow-wrap: normal;
}
.selection-table th:nth-child(2),
.selection-table td:nth-child(2) {
  min-width: 190px;
  white-space: normal;
  overflow-wrap: anywhere;
}
.selection-table .number-cell {
  text-align: right;
}
.changes-table {
  min-width: 520px;
  table-layout: auto;
}
.changes-table th {
  min-width: 170px;
}
.negative-value { color: #b91c1c; }
.positive-value { color: #166534; }
.neutral-value { color: #475569; }
.pdf-summary-page {
  padding: 34px 44px;
  font-size: 14px;
}
.pdf-summary-header {
  display: grid;
  grid-template-columns: 185px 1fr 185px;
  align-items: center;
  gap: 18px;
  padding-bottom: 14px;
  border-bottom: 2px solid #234f7c;
}
.pdf-logo {
  width: 116px;
  display: block;
}
.pdf-title {
  margin: 0;
  color: #214f7d;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 29px;
  font-weight: 800;
  line-height: 1.1;
  text-align: center;
}
.pdf-week {
  color: #111;
  font-size: 14px;
  text-align: right;
  white-space: nowrap;
}
.pdf-section-title {
  margin: 38px 0 14px;
  color: #214f7d;
  font-size: 22px;
  font-weight: 800;
}
.portfolio-summary-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  border: 1px solid #e2e2e2;
  font-size: 14px;
}
.portfolio-summary-table th {
  padding: 14px 12px;
  background: #214f7d;
  color: #fff;
  font-size: 15px;
  font-weight: 800;
  text-align: center;
}
.portfolio-summary-table td {
  height: 238px;
  padding: 14px 12px;
  border-left: 1px solid #e2e2e2;
  vertical-align: middle;
}
.portfolio-summary-table td:first-child {
  border-left: 0;
}
.market-cell strong {
  display: block;
}
.metric-mini-table {
  width: auto;
  margin: 0 auto;
  border-collapse: collapse;
}
.metric-mini-table th,
.metric-mini-table td {
  height: auto;
  padding: 4px 4px;
  border: 0;
  background: transparent;
  color: #111;
  font-size: 12px;
  text-align: right;
  white-space: nowrap;
}
.metric-mini-table th:first-child,
.metric-mini-table td:first-child {
  text-align: left;
  font-weight: 800;
}
.selection-list,
.changes-list {
  margin: 0;
  padding: 0;
  list-style: none;
  line-height: 2.05;
}
.changes-label-in {
  color: #07850d;
  font-weight: 800;
}
.changes-label-out {
  color: #f00;
  font-weight: 800;
}
.pdf-info-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
  margin-top: 20px;
}
.pdf-info-block {
  min-height: 170px;
  padding: 0 20px;
  border-left: 1px solid #d7dce4;
}
.pdf-info-block:first-child {
  border-left: 0;
}
.pdf-info-block h2 {
  margin: 0 0 8px;
  color: #214f7d;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 22px;
  font-weight: 800;
}
.pdf-info-block p {
  margin: 0;
  color: #111;
  font-size: 12.5px;
  line-height: 1.2;
}
.report-page {
  width: 100%;
  max-width: 1120px;
  min-height: 790px;
  margin: 0 auto 24px;
  padding: 30px;
  background: #fff;
  border: 1px solid #dbe3ef;
  box-shadow: 0 14px 34px rgba(15, 23, 42, 0.14);
}
.report-header {
  display: flex;
  justify-content: space-between;
  gap: 22px;
  padding-bottom: 18px;
  border-bottom: 3px solid #071a33;
}
.brand { color: #0b5fa5; font-size: 13px; font-weight: 800; letter-spacing: 1.2px; text-transform: uppercase; }
h1 { margin: 6px 0 6px; font-family: Georgia, serif; font-size: 42px; line-height: 1.1; }
h2 { margin: 0 0 16px; color: #0b5fa5; font-family: Georgia, serif; font-size: 31px; }
h3 { margin: 0 0 10px; color: #071a33; font-size: 21px; }
p { line-height: 1.55; }
.eyebrow { margin: 0 0 8px; color: #0b5fa5; font-size: 12px; font-weight: 800; letter-spacing: 1.2px; text-transform: uppercase; }
.meta { color: #475569; font-size: 13px; text-align: right; line-height: 1.6; }
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 10px;
  margin: 20px 0;
}
.kpi {
  padding: 13px;
  border-radius: 6px;
  background: #071a33;
  color: #fff;
}
.kpi span { display: block; color: #93c5fd; font-size: 11px; text-transform: uppercase; letter-spacing: 0.8px; }
.kpi strong { display: block; margin-top: 6px; font-size: 20px; }
.two-col {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 18px;
}
.two-col.balanced {
  grid-template-columns: 1fr 1fr;
}
.panel {
  padding: 18px;
  border: 1px solid #dbe3ef;
  border-radius: 6px;
  background: #f8fafc;
}
.full-chart-panel { padding: 12px; }
.chart-img {
  width: 100%;
  max-height: 525px;
  object-fit: contain;
  border: 1px solid #e2e8f0;
  background: #fff;
}
.wide-chart { max-height: 660px; }
.asset-chart {
  width: 100%;
  display: block;
  border: 1px solid #dbe3ef;
}
.asset-picture {
  display: block;
}
.mini-table, .asset-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 15px;
  table-layout: auto;
}
.mini-table th, .mini-table td, .asset-table th, .asset-table td {
  padding: 12px 12px;
  border-bottom: 1px solid #dbe3ef;
  text-align: left;
  vertical-align: top;
  overflow-wrap: anywhere;
}
.mini-table th, .asset-table th {
  color: #0b5fa5;
  font-size: 13px;
  letter-spacing: 0.7px;
  text-transform: uppercase;
}
table.monthly-performance-table {
  width: max-content;
  min-width: 1040px;
  max-width: none;
  table-layout: auto;
  font-size: 13px;
}
table.monthly-performance-table th,
table.monthly-performance-table td {
  padding: 9px 4px;
  text-align: right;
  font-weight: 400 !important;
  white-space: nowrap;
  overflow-wrap: normal;
}
table.monthly-performance-table th:first-child,
table.monthly-performance-table td:first-child {
  text-align: left;
}
table.monthly-performance-table th:nth-last-child(-n+3),
table.monthly-performance-table td:nth-last-child(-n+3) {
  min-width: 96px;
}
.status-badge {
  display: inline-block;
  padding: 5px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  white-space: nowrap;
}
.status-selected { background: #dcfce7; color: #166534; }
.status-watchlist { background: #fef3c7; color: #92400e; }
.status-rejected { background: #fee2e2; color: #991b1b; }
.status-neutral { background: #e2e8f0; color: #334155; }
.drivers {
  margin: 0;
  padding-left: 18px;
  line-height: 1.55;
}
.asset-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}
.asset-card {
  padding: 14px;
  border: 1px solid #dbe3ef;
  border-radius: 6px;
  background: #fff;
  text-decoration: none;
  color: #071a33;
}
.asset-card strong { display: block; margin-bottom: 6px; }
.asset-card span { color: #0b5fa5; font-size: 12px; font-weight: 700; }
.gallery-page {
  width: min(1440px, calc(100vw - 48px));
}
.gallery-page h1 { font-size: 48px; }
.gallery-table td {
  vertical-align: middle;
  font-size: 16px;
}
.gallery-table th {
  font-size: 14px;
}
.gallery-table td::before {
  display: none;
}
.thumb-button {
  width: 210px;
  padding: 0;
  border: 1px solid #dbe3ef;
  border-radius: 6px;
  background: #fff;
  cursor: pointer;
  overflow: hidden;
}
.thumb-button img {
  width: 100%;
  aspect-ratio: 16 / 10;
  display: block;
  object-fit: contain;
  background: #f8fafc;
}
.chart-modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 28px;
  background: rgba(7, 26, 51, 0.88);
}
.chart-modal.is-open { display: flex; }
.chart-modal img {
  max-width: min(1280px, 96vw);
  max-height: 88vh;
  border: 1px solid #dbe3ef;
  border-radius: 6px;
  background: #fff;
}
.chart-modal-close {
  position: fixed;
  top: 18px;
  right: 18px;
  padding: 10px 14px;
  border: 0;
  border-radius: 4px;
  background: #168eea;
  color: #fff;
  cursor: pointer;
  font-weight: 800;
}
.footer-note { margin-top: 18px; color: #64748b; font-size: 12px; }
@media (max-width: 1180px) {
  .report-dashboard { width: 100%; }
  .dashboard-header { display: block; }
  .dashboard-meta { text-align: left; }
  .dashboard-grid { grid-template-columns: 1fr; }
  .report-page { width: 100%; min-height: 0; }
  .pdf-summary-header { grid-template-columns: 1fr; text-align: left; }
  .pdf-title, .pdf-week { text-align: left; }
  .portfolio-summary-table { table-layout: auto; }
  .portfolio-summary-table td { height: auto; }
  .pdf-info-grid { grid-template-columns: 1fr; gap: 18px; }
  .pdf-info-block { border-left: 0; padding: 0; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .two-col { grid-template-columns: 1fr; }
  .asset-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 720px) {
  .report-shell, .asset-shell { padding: 10px; }
  .top-actions { gap: 8px; margin-bottom: 10px; }
  .top-actions a { width: 100%; text-align: center; }
  .report-dashboard,
  .report-page {
    padding: 16px 10px;
    margin-bottom: 14px;
    border-radius: 0;
  }
  .dashboard-header h1,
  .report-header h1,
  h1 {
    font-size: 34px;
    line-height: 1.08;
  }
  .dashboard-card {
    padding: 12px 8px;
  }
  .dashboard-card h2,
  .chart-section h2,
  .performance-section h2,
  h2 {
    font-size: 28px;
  }
  .mini-table,
  .asset-table {
    font-size: 12px;
    table-layout: fixed;
  }
  .mini-table th,
  .mini-table td,
  .asset-table th,
  .asset-table td {
    padding: 8px 5px;
  }
  .mini-table th,
  .asset-table th {
    font-size: 10px;
    letter-spacing: 0.3px;
  }
  .mini-table th:nth-child(1),
  .mini-table td:nth-child(1) {
    width: 22%;
  }
  .mini-table th:nth-child(2),
  .mini-table td:nth-child(2) {
    width: 32%;
  }
  .mini-table th:nth-child(3),
  .mini-table td:nth-child(3) {
    width: 46%;
  }
  .selection-table {
    min-width: 820px;
    table-layout: auto;
  }
  .selection-table th,
  .selection-table td {
    width: auto;
  }
  .changes-table {
    min-width: 520px;
    table-layout: auto;
  }
  .changes-table th,
  .changes-table td {
    width: auto;
  }
  .performance-table th,
  .performance-table td {
    font-size: 12px;
  }
  .monthly-performance-table {
    min-width: 900px;
    table-layout: auto;
    font-size: 12px;
  }
  .contribution-chart {
    grid-template-columns: repeat(5, minmax(48px, 1fr));
    gap: 10px;
  }
  .contribution-bar-wrap {
    height: 220px;
  }
  .changes-table th,
  .changes-table td {
    width: auto;
  }
  .chart-frame {
    padding: 8px 4px;
  }
  .asset-page { padding: 16px 10px 12px; }
  .asset-page h1 { font-size: 28px; margin-bottom: 12px; }
  .asset-picture {
    margin: 0 -10px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .asset-chart {
    width: 980px;
    max-width: none;
    border-radius: 0;
  }
  .gallery-page {
    width: 100%;
  }
  .gallery-page h1 {
    font-size: 38px;
  }
  .gallery-table,
  .gallery-table thead,
  .gallery-table tbody,
  .gallery-table tr,
  .gallery-table th,
  .gallery-table td {
    display: block;
    width: 100%;
  }
  .gallery-table {
    border-collapse: separate;
    border-spacing: 0;
  }
  .gallery-table thead {
    display: none;
  }
  .gallery-table tr {
    padding: 12px 0;
    border-bottom: 1px solid #dbe3ef;
  }
  .gallery-table td {
    display: grid;
    grid-template-columns: 88px minmax(0, 1fr);
    gap: 10px;
    align-items: start;
    padding: 5px 0;
    border-bottom: 0;
    font-size: 13px;
  }
  .gallery-table td::before {
    display: block;
    color: #0b5fa5;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.3px;
    text-transform: uppercase;
  }
  .gallery-table td:nth-child(1)::before { content: "Ticker"; }
  .gallery-table td:nth-child(2)::before { content: "Name"; }
  .gallery-table td:nth-child(3)::before { content: "Sector"; }
  .gallery-table td:nth-child(4)::before { content: "Industry"; }
  .gallery-table td:nth-child(5)::before { content: "Status"; }
  .gallery-table td:nth-child(6)::before { content: "Chart"; }
  .gallery-table td:nth-child(6) {
    display: block;
    padding-top: 8px;
  }
  .gallery-table td:nth-child(6)::before {
    margin-bottom: 6px;
  }
  .thumb-button {
    width: 100%;
    max-width: 320px;
  }
}
@media print {
  body { background: #fff; }
  .top-actions { display: none; }
  .report-shell, .asset-shell { padding: 0; }
  .report-page {
    width: 297mm;
    min-height: 210mm;
    margin: 0;
    box-shadow: none;
    page-break-after: always;
  }
  .pdf-summary-page {
    width: 297mm;
    min-height: 210mm;
  }
}
