/* ──────────────────────────────────────────────
   REPORT SECTIONS — unified layout contract
   ──────────────────────────────────────────────
   Każda sekcja (.report-page-body) = jedna kolumna, pełna szerokość.
   Karty metryk w siatce tylko wewnątrz .report-cards-grid.
   Nie używamy auto-fit 2-col na body — to powodowało puste lewe/prawe.
   ────────────────────────────────────────────── */

.report-page-body,
.report-section-body,
.collapsible-body-inner {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: var(--space-4);
  width: 100%;
  max-width: none;
  margin: 0;
  text-align: left;
}

.report-page-body > *,
.report-section-body > *,
.collapsible-body-inner > * {
  width: 100%;
  max-width: none;
  margin: 0;
  min-width: 0;
  box-sizing: border-box;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-4);
}

/* Bloki już „opakowane” (hub / table-card / smart-money) — bez podwójnej ramki */
.report-page-body > .research-hub,
.report-section-body > .research-hub,
.collapsible-body-inner > .research-hub,
.report-page-body > .table-card,
.report-section-body > .table-card,
.collapsible-body-inner > .table-card,
.report-page-body > .smart-money-section,
.report-section-body > .smart-money-section,
.collapsible-body-inner > .smart-money-section,
.report-page-body > .report-chart-section,
.report-section-body > .report-chart-section,
.collapsible-body-inner > .report-chart-section,
.report-page-body > .report-cards-grid,
.report-section-body > .report-cards-grid,
.collapsible-body-inner > .report-cards-grid,
.report-page-body > .data-rows,
.report-section-body > .data-rows,
.collapsible-body-inner > .data-rows {
  background: transparent;
  border: none;
  padding: 0;
  border-radius: 0;
}

/* Świadoma siatka kart (Fundamenty itp.) */
.report-cards-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-3);
  width: 100%;
}
.report-cards-grid > .data-card {
  margin: 0;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  min-width: 0;
}

/* ─── Sidebar rail — ghost nav (bez panelu) */
.report-rail {
  padding: var(--space-4) var(--space-2) var(--space-4) 0;
}

.stock-rail {
  display: none;
}
.stock-rail-head {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.stock-rail-ticker { font-size: var(--fs-xl); font-weight: var(--fw-bold); color: var(--text-bright); letter-spacing: -0.02em; }
.stock-rail-name { font-size: var(--fs-sm); color: var(--text-dim); line-height: 1.3; }
.stock-rail-meta { font-size: var(--fs-xs); color: var(--text-dim); line-height: 1.3; }
.stock-rail-metrics {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: var(--space-1);
}
.stock-rail-kv {
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  align-items: baseline;
  gap: var(--space-2);
  min-width: 0;
}
.stock-rail-kv-label {
  font-size: var(--fs-xs);
  color: var(--text-dim);
  flex: 1 1 auto;
  min-width: 0;
}
.stock-rail-kv-value {
  font-family: var(--mono);
  font-size: var(--fs-sm);
  color: var(--text-bright);
  flex: 0 0 auto;
  text-align: right;
  white-space: nowrap;
}
.stock-rail-change { font-family: var(--mono); font-size: var(--fs-sm); }
.stock-rail-confidence { display: flex; flex-wrap: wrap; gap: var(--space-2); font-size: var(--fs-xs); color: var(--text-dim); margin-top: var(--space-1); }
.stock-rail-stat { display: inline-flex; align-items: center; gap: 4px; }
.stock-rail-stat strong { color: var(--text-bright); font-weight: var(--fw-semibold); }

.report-current {
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 0 0 var(--space-3);
  margin-bottom: var(--space-3);
  border-bottom: 1px solid var(--border);
}
.report-current-label { font-size: var(--fs-xs); color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.08em; }
.report-current-title { font-size: var(--fs-sm); font-weight: var(--fw-medium); color: var(--text); margin: 2px 0 var(--space-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.report-current-progress { width: 100%; height: 2px; background: var(--border); border-radius: 1px; overflow: hidden; }
.report-current-progress-bar { height: 100%; width: 0; background: var(--accent); border-radius: 1px; transition: width 0.1s linear; opacity: 0.7; }

.report-nav-group { gap: 0; }
.report-nav-item,
.report-rail a,
.report-rail .report-nav-item {
  display: grid;
  grid-template-columns: 26px 1fr;
  gap: var(--space-2);
  align-items: center;
  padding: 5px 0;
  font-size: var(--fs-sm);
  border: none;
}
.report-nav-num {
  font-family: var(--mono);
  font-size: var(--fs-xs);
  color: var(--text-dim);
  text-align: right;
}
.report-nav-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.report-nav-item.active .report-nav-num { color: var(--accent-light); }

/* Przegląd — pierwszy link, bez ramki */
.report-nav-item.report-nav-item--overview {
  display: flex;
  grid-template-columns: none;
  align-items: center;
  gap: 0;
  margin: 0 0 var(--space-1);
  padding: 6px 0;
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  letter-spacing: 0;
  color: var(--text-dim);
  border: none;
  border-radius: 0;
}
.report-nav-item.report-nav-item--overview .report-nav-label {
  color: inherit;
}
.report-nav-item.report-nav-item--overview:hover {
  color: var(--text-bright);
  padding-left: 0;
  background: transparent;
}
.report-nav-item.report-nav-item--overview.active {
  color: var(--text-bright);
  font-weight: var(--fw-semibold);
  background: transparent;
  box-shadow: none;
}

/* Nadpisanie legacy z _components.css */
.report-rail .report-nav-item,
.report-rail .report-nav-item:hover,
.report-rail .report-nav-item.active {
  border-left: none !important;
  background: transparent !important;
  padding-left: 0 !important;
  margin-left: 0 !important;
  color: var(--text-dim);
}
.report-rail .report-nav-item:hover { color: var(--text-bright); }
.report-rail .report-nav-item.active { color: var(--text-bright); font-weight: var(--fw-semibold); }
.report-rail .report-nav-item.active .report-nav-num { color: var(--accent-light); }

/* ─── Hero overview ─ richer facts and thesis */
.report-hero { align-items: stretch; }
.hero-left {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  flex: 1;
  min-width: 0;
}
.hero-top { display: flex; gap: var(--space-5); align-items: start; }
.hero-identity { flex: 1; min-width: 0; }
.hero-description { background: var(--bg-inset); border: 1px solid var(--border); border-left: 2px solid var(--accent); border-radius: var(--radius-md); padding: var(--space-3) var(--space-4); }
.hero-description-label { font-size: var(--fs-xs); color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: var(--space-1); }
.hero-description p { margin: 0; color: var(--text); font-size: var(--fs-sm); line-height: var(--lh-relaxed); display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; line-clamp: 3; overflow: hidden; }
.hero-description.expanded p { -webkit-line-clamp: unset; line-clamp: unset; }
.hero-desc-more { margin-top: var(--space-2); padding: 0; background: transparent; border: none; color: var(--accent); font-size: var(--fs-xs); cursor: pointer; text-decoration: underline; }
.hero-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(100px, 1fr)); gap: var(--space-3); }
.hero-fact { background: var(--bg-inset); border: 1px solid var(--border); border-radius: var(--radius-md); padding: var(--space-3); display: flex; flex-direction: column; gap: 2px; }
.hero-fact-label { font-size: var(--fs-xs); color: var(--text-dim); }
.hero-fact-value { font-family: var(--mono); font-size: var(--fs-base); color: var(--text-bright); font-weight: var(--fw-semibold); }
.hero-fact.pos .hero-fact-value { color: var(--green); }
.hero-fact.neg .hero-fact-value { color: var(--red); }
.hero-extra {
  margin-top: var(--stack-gap);
  padding-top: var(--stack-gap);
  border-top: 1px solid var(--border);
}
.hero-meta-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.hero-meta-line {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: var(--fs-xs);
  color: var(--text-dim);
  line-height: 1.45;
  min-width: 0;
}
.hero-meta-bar {
  flex: 0 0 3px;
  width: 3px;
  align-self: stretch;
  min-height: 1em;
  border-radius: 2px;
  background: var(--border-strong);
  margin-top: 2px;
}
.hero-meta-line--asof .hero-meta-bar { background: var(--accent); opacity: 0.9; }
.hero-meta-line--horizon .hero-meta-bar { background: var(--accent-light); opacity: 0.75; }
.hero-meta-line--quality .hero-meta-bar { background: var(--border-strong); }
.hero-meta-line--link .hero-meta-bar { background: var(--accent); opacity: 0.6; }
.hero-meta-line--event .hero-meta-bar { background: var(--amber); opacity: 0.7; }
.hero-meta-text {
  flex: 1 1 auto;
  min-width: 0;
}
.hero-meta-link {
  color: var(--accent-light);
  text-decoration: none;
}
.hero-meta-link:hover { text-decoration: underline; }
/* legacy aliases */
.hero-website { color: var(--accent-light); text-decoration: none; }
.hero-website:hover { text-decoration: underline; }
.hero-earnings { display: inline-flex; align-items: center; gap: var(--space-1); }

/* Compact table-card — full width, aligned with section edge */
.table-card {
  width: 100%;
  max-width: none;
  margin: 0;
  padding: var(--space-4) var(--space-5);
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-sizing: border-box;
}

/* Generic data-row with aligned value columns */
.data-row {
  display: grid;
  grid-template-columns: minmax(120px, 1.5fr) 1.5fr 90px 70px;
  gap: var(--space-3);
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.data-row:last-child { border-bottom: none; }
.data-row > * { min-width: 0; }
.data-row .data-label { color: var(--text-bright); font-size: var(--fs-sm); }
.data-row .data-desc { color: var(--text-dim); font-size: var(--fs-sm); }
.data-row .data-value { font-family: var(--mono); color: var(--text-bright); text-align: right; }
.data-row .data-value.value-gold { color: var(--accent); }
.data-row .data-value.gap { font-size: var(--fs-sm); opacity: 0.9; }
.data-row .data-badge { justify-self: end; font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: 0.05em; padding: 2px 8px; border-radius: var(--radius-sm); background: var(--bg-inset); color: var(--text-dim); }
.data-row .data-badge.good { background: rgba(0,200,83,0.15); color: var(--green); }
.data-row .data-badge.ok { background: rgba(255,171,0,0.15); color: var(--amber); }
.data-row .data-badge.bad { background: rgba(255,82,82,0.15); color: var(--red); }

/* 02 Wycena — model table */
.valuation-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--fs-sm);
}
.valuation-table th,
.valuation-table td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
.valuation-table th { color: var(--text-dim); font-weight: var(--fw-medium); font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: 0.05em; }
.valuation-table th.num,
.valuation-table td.num { text-align: right; font-family: var(--mono); }
.valuation-table tr:last-child td { border-bottom: none; }
.valuation-table td .gap { font-size: var(--fs-xs); margin-left: var(--space-2); }

/* 04 Kurs i wolumen */
#chartArea {
  width: 100%;
  height: 300px;
  min-height: 280px;
  max-height: 360px;
  position: relative;
}
#chartArea > div {
  width: 100% !important;
  height: 100% !important;
}

/* 09 Aktywność inwestorów */
.smart-money-section {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}
.smart-summary-card {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-4) var(--space-5);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  flex-wrap: wrap;
  max-width: 720px;
  margin: 0 auto;
  width: 100%;
}
.smart-verdict-label { font-size: var(--fs-base); font-weight: var(--fw-bold); }
.smart-verdict-label.bullish { color: var(--green); }
.smart-verdict-label.bearish { color: var(--red); }
.smart-verdict-label.neutral { color: var(--text-dim); }
.smart-verdict-ratio { font-family: var(--mono); font-size: var(--fs-sm); color: var(--text-dim); }
.smart-verdict-bar { width: 120px; height: 6px; background: var(--bg-inset); border-radius: 3px; overflow: hidden; }
.smart-verdict-fill { height: 100%; border-radius: 3px; }
.smart-verdict-fill.bullish { background: var(--green); }
.smart-verdict-fill.bearish { background: var(--red); }
.smart-verdict-fill.neutral { background: var(--amber); }

.trade-list-section { width: 100%; max-width: none; margin: 0; }
.trade-section-title { font-size: var(--fs-xs); color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: var(--space-3); }
.trade-list { display: flex; flex-direction: column; gap: var(--space-2); }
.trade-card {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
  display: grid;
  grid-template-columns: 1fr auto auto auto;
  gap: var(--space-3);
  align-items: center;
  min-width: 0;
}
.trade-card > div:first-child { min-width: 0; }
.trade-name { font-weight: var(--fw-semibold); color: var(--text-bright); font-size: var(--fs-sm); }
.trade-meta { font-size: var(--fs-xs); color: var(--text-dim); }
.trade-value { font-family: var(--mono); color: var(--text-bright); font-size: var(--fs-sm); text-align: right; }
.trade-date { font-family: var(--mono); font-size: var(--fs-xs); color: var(--text-dim); text-align: right; white-space: nowrap; }
.trade-date-cell { font-family: var(--mono); font-size: var(--fs-xs); color: var(--text-dim); white-space: nowrap; }
.trade-date-abs { color: var(--text); }
.trade-date-sep { color: var(--text-dim); opacity: 0.6; }
.trade-date-rel { color: var(--accent-light); font-weight: var(--fw-medium); }
.research-radar-when {
  margin-top: 6px;
  font-size: var(--fs-xs);
  font-family: var(--mono);
  color: var(--text-dim);
}
.research-radar-when .trade-date-rel { color: var(--accent-light); }
.trade-badge { font-size: var(--fs-xs); font-weight: var(--fw-bold); text-transform: uppercase; padding: 2px 8px; border-radius: var(--radius-sm); }
.trade-badge.buy { background: rgba(0,200,83,0.15); color: var(--green); }
.trade-badge.sell { background: rgba(255,82,82,0.15); color: var(--red); }
.empty-state {
  background: var(--bg-inset);
  border: 1px dashed var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  text-align: center;
  color: var(--text-dim);
  font-size: var(--fs-sm);
}

/* 10 Sentyment rynku */
.sentiment-summary-bar {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
  margin-bottom: var(--space-4);
}
.sentiment-card .sentiment-summary-bar {
  background: transparent;
  border: none;
  padding: 0;
  margin-bottom: var(--space-3);
}
.news-list { display: flex; flex-direction: column; gap: var(--space-2); }
.news-item {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
  font-size: var(--fs-sm);
  color: var(--text);
  line-height: var(--lh-normal);
}
.news-item .sentiment-dot { margin-right: var(--space-2); flex-shrink: 0; }
.news-toggle-btn {
  background: var(--bg-inset);
  border: 1px solid var(--border);
  color: var(--text-dim);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-sm);
  font-size: var(--fs-sm);
  cursor: pointer;
  margin-top: var(--space-2);
}

/* 11 Ryzyko */
.risk-profile-title { font-size: var(--fs-xs); color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: var(--space-3); }
.risk-inline-header { display: flex; align-items: center; gap: var(--space-3); margin-bottom: var(--space-2); }
.risk-inline-label { font-size: var(--fs-lg); font-weight: var(--fw-bold); }
.risk-inline-score { font-family: var(--mono); font-size: var(--fs-sm); color: var(--text-dim); }
.risk-inline-bar { width: 100%; height: 8px; background: var(--bg-inset); border-radius: 4px; overflow: hidden; margin-bottom: var(--space-4); }
.risk-inline-fill { height: 100%; border-radius: 4px; }
.risk-rows { display: flex; flex-direction: column; gap: 2px; }

/* 12 Scenariusze wyceny */
.scenario-range-bar { background: var(--bg-panel); border: 1px solid var(--border); border-radius: var(--radius-md); padding: var(--space-4) var(--space-5); margin-bottom: var(--space-4); }
.scenario-card .scenario-range-bar { background: transparent; border: none; padding: 0; }
.scenario-range-track { position: relative; height: 8px; background: var(--bg-inset); border-radius: 4px; margin: var(--space-3) 0; }
.scenario-range-fill { position: absolute; height: 100%; background: var(--accent); border-radius: 4px; opacity: 0.35; }
.scenario-marker { position: absolute; top: 50%; transform: translate(-50%, -50%); width: 10px; height: 10px; border-radius: 50%; border: 2px solid var(--text-bright); background: var(--bg); }
.scenario-marker.base { border-color: var(--accent); }
.scenario-marker.current { border-color: var(--green); }
.scenario-marker-label { position: absolute; top: -22px; left: 50%; transform: translateX(-50%); font-size: var(--fs-xs); color: var(--text-dim); white-space: nowrap; }
.scenario-range-values { display: flex; justify-content: space-between; font-size: var(--fs-sm); color: var(--text-dim); }
.scenario-value { text-align: center; }
.scenario-value.bear { color: var(--red); }
.scenario-value.bull { color: var(--green); }
.scenario-value strong { color: var(--text-bright); display: block; }
.valuation-summary { display: flex; align-items: center; gap: var(--space-2); flex-wrap: wrap; font-size: var(--fs-sm); color: var(--text-dim); margin-bottom: var(--space-4); }
.scenario-details { width: 100%; max-width: none; margin: 0; }
.scenario-summary {
  background: var(--bg-inset);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: var(--space-2) var(--space-3);
  font-size: var(--fs-sm);
  color: var(--text-dim);
  cursor: pointer;
  list-style: none;
}
.scenario-summary::-webkit-details-marker { display: none; }
.info-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-3);
  align-items: start;
  margin-top: var(--space-3);
}
.info-item {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-top: 2px solid var(--accent);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  min-width: 0;
}
.info-item-label { font-size: var(--fs-sm); color: var(--text-dim); margin-bottom: var(--space-1); }
.info-item-value { font-family: var(--mono); font-size: var(--fs-xl); color: var(--text-bright); }
.info-item-sub { font-size: var(--fs-xs); color: var(--text-dim); margin-top: var(--space-2); line-break: anywhere; }

/* Metric cards wrapper */
.report-page-body > .metric-cards,
.report-section-body > .metric-cards,
.collapsible-body-inner > .metric-cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-4);
  background: transparent;
  border: none;
  padding: 0;
}

/* Smart money wrapper override */
.report-page-body > .smart-money-section,
.report-section-body > .smart-money-section,
.collapsible-body-inner > .smart-money-section {
  background: transparent;
  border: none;
  padding: 0;
}

/* Colors for value/badges */
.data-row .data-value.pos,
.data-row .data-value.positive,
.valuation-table td.pos,
.dcf-table td.pos { color: var(--green); }
.data-row .data-value.neg,
.data-row .data-value.negative,
.valuation-table td.neg,
.dcf-table td.neg { color: var(--red); }

/* 13 Parametry DCF */
.dcf-table {
  width: 100%;
  max-width: none;
  margin: 0;
  border-collapse: collapse;
  font-size: var(--fs-sm);
}
.dcf-table th,
.dcf-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}
.dcf-table th { text-align: left; color: var(--text-dim); font-weight: var(--fw-medium); font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: 0.05em; }
.dcf-table td { text-align: right; font-family: var(--mono); color: var(--text-bright); }
.dcf-table tr:last-child th,
.dcf-table tr:last-child td { border-bottom: none; }
.dcf-desc { font-size: var(--fs-sm); color: var(--text-dim); margin-bottom: var(--space-4); line-height: 1.5; }
.dcf-edit-form { background: var(--bg-panel); border: 1px solid var(--border); border-radius: var(--radius-md); padding: var(--space-4); margin-top: var(--space-4); }
.dcf-edit-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-3); }
.dcf-edit-actions { display: flex; gap: var(--space-2); margin-top: var(--space-3); }

/* Responsive */
@media (max-width: 1023px) {
  .report-cards-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .info-row { grid-template-columns: 1fr; }
  .data-row { grid-template-columns: 1fr auto; }
  .data-row .data-desc { display: none; }
  .trade-card { grid-template-columns: 1fr auto; }
  .trade-value, .trade-date { display: none; }
}
@media (max-width: 640px) {
  .report-cards-grid { grid-template-columns: 1fr; }
}
