.workspace {
  --intelligence-series-secondary: #4169a1;
  --intelligence-series-tertiary: #93610d;
  --intelligence-attention: #9b6109;
}
.dark .workspace {
  --intelligence-series-secondary: #93c5fd;
  --intelligence-series-tertiary: #fcd280;
  --intelligence-attention: #fcd280;
}
.page-heading {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-end;
  gap: 12px 20px;
  margin-bottom: 22px;
}
.page-heading h1 {
  margin: 0;
  font-size: clamp(1.65rem, 2.5vw, 2.5rem);
  line-height: 1.18;
  letter-spacing: -.055em;
  font-weight: 600;
  overflow-wrap: anywhere;
}
.page-heading p { margin: 6px 0 0; color: var(--muted-foreground); }
.heading-tag {
  display: inline-flex;
  max-width: 100%;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: .375rem;
  padding: .25rem .625rem;
  color: var(--accent-foreground);
  background: var(--accent);
  font-size: .75rem;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 10px;
  margin: 0 0 22px;
}
.filters label { flex: 1 0 8rem; min-width: 0; display: grid; gap: 5px; }
.filters label:has(#product) { flex-grow: 2; }
.filters label:has(#currency) { flex: .5 0 5.25rem; }
.filters label span { font-size: .8125rem; font-weight: 550; }
.filters .primary { flex-shrink: 0; }
.filters input, .filters select, .panel input, .panel select {
  width: 100%;
  min-width: 0;
  min-height: 2.5rem;
  border: 1px solid var(--input);
  border-radius: var(--radius);
  padding: .5rem .75rem;
  background: var(--background);
  color: var(--foreground);
  font: inherit;
  font-size: .8125rem;
}
.filters select, .panel select { padding-inline-end: 1.375rem; }
.panel-header select { width: auto; max-width: 100%; }
.filters input::placeholder, .panel input::placeholder { color: var(--muted-foreground); }

.page-status { margin: 0 0 16px; color: var(--muted-foreground); font-size: .875rem; }
.page-status.is-error, .data-error {
  padding: 12px 16px;
  border: 1px solid color-mix(in srgb, var(--erp-danger-text) 35%, var(--border));
  border-radius: var(--radius);
  color: var(--erp-danger-text);
  background: var(--erp-danger-surface);
}
.report { display: grid; grid-template-columns: minmax(0, 1fr); gap: 22px; }
.report #retry-report { justify-self: start; }
.brief {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 16px;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-inline-start: 3px solid var(--intelligence-attention, var(--primary));
  border-radius: var(--radius);
  background: var(--card);
  color: var(--muted-foreground);
  font-size: .875rem;
}
.workspace a { color: var(--primary); text-underline-offset: .2em; }
.brief a { font-weight: 600; }
.report .metrics, .report .dashboard-kpi-skeleton { margin: 0; }
.metric {
  display: grid;
  align-content: start;
}
.metric dt {
  align-items: flex-start;
  font-size: .8125rem;
}
.metric dt svg { width: 18px; height: 18px; flex: 0 0 18px; color: var(--primary); }
.metric strong {
  display: block;
  font-weight: inherit;
  overflow-wrap: anywhere;
}
.metric.is-missing strong { color: var(--muted-foreground); }
.metric small {
  display: block;
  margin-top: 8px;
  color: var(--muted-foreground);
  font-size: .75rem;
  font-weight: 400;
  line-height: 1.5;
  letter-spacing: 0;
}

.panel:not(.dashboard-chart-card) {
  min-width: 0;
  padding: 20px 22px 16px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--card);
  box-shadow: 0 2px 6px rgb(11 37 37 / .02);
}
.report .report-empty {
  padding: 24px;
  border-style: dashed;
}
.panel-header {
  margin-bottom: 14px;
}
.panel-header > div { min-width: 0; }
.panel-header h2 { margin: 0; font-size: 1rem; line-height: 1.35; font-weight: 600; letter-spacing: -.015em; }
.panel-header p { margin: 5px 0 0; color: var(--muted-foreground); font-size: .8125rem; }
.panel-body { min-width: 0; }
.panel-body > * + * { margin-top: 12px; }
.empty { margin-block: 0; color: var(--muted-foreground); font-size: .875rem; line-height: 1.6; }
.panel-body > .empty + a { display: inline-block; }

.chart-selector {
  flex-wrap: wrap;
}
.chart-selector .tab { border: 0; background: transparent; font-family: inherit; cursor: pointer; }
.chart-selector .tab:hover { background: var(--erp-hover); color: var(--foreground); }
.chart-stack { display: grid; gap: 14px; }
.chart-lane { min-width: 0; padding-top: 14px; border-top: 1px solid var(--border); }
.chart-lane:first-child { padding-top: 0; border-top: 0; }
.chart-legend { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 16px; margin-bottom: 6px; }
.chart-legend span { display: inline-flex; align-items: center; gap: 7px; color: var(--muted-foreground); font-size: .8125rem; }
.chart-legend i { width: 14px; flex: 0 0 14px; border-top: 2px solid currentColor; }
.chart-legend i[data-series="1"] { border-top-style: dashed; }
.chart-legend i[data-series="2"] { border-top-style: dotted; }
.chart-canvas { display: block; width: 100%; height: 180px; }
.chart-lane.main .chart-canvas { height: 225px; }
.chart-blank {
  display: grid;
  min-height: 86px;
  align-items: center;
  padding: 12px 0;
  color: var(--muted-foreground);
  font-size: .875rem;
}
.chart-cursor {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 16px;
  min-height: 2.625rem;
  margin-top: 12px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--background);
  color: var(--muted-foreground);
  font-size: .8125rem;
}
.chart-cursor strong { color: var(--foreground); font-weight: 600; }
.chart-cursor[data-selected] {
  border-radius: 12px;
  background: var(--card);
  font-size: .75rem;
  box-shadow: 0 8px 24px #0002;
}
.data-table { margin-top: 14px; border-top: 1px solid var(--border); }
.data-table summary {
  width: fit-content;
  padding: 10px 0;
  color: var(--muted-foreground);
  font-size: .8125rem;
  font-weight: 550;
  cursor: pointer;
}
.data-table summary:hover { color: var(--primary); }
.data-table .table-wrap { max-height: 22rem; }
.table-wrap { max-width: 100%; overflow: auto; border: 1px solid var(--border); border-radius: var(--radius); }
.table-wrap:focus-visible { outline-offset: -2px; }
.report table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  color: var(--foreground);
  background: var(--background);
  font-size: .8125rem;
  font-variant-numeric: tabular-nums;
}
.report thead { color: var(--muted-foreground); background: var(--muted); font-size: .6875rem; letter-spacing: .015em; }
.report th, .report td { padding: .875rem 1rem; vertical-align: middle; }
.report th { border-bottom: 1px solid var(--border); font-weight: 650; white-space: nowrap; }
.report tbody tr + tr { border-top: 1px solid var(--border); }
.report tbody tr:hover { background: var(--erp-hover); }
.report td a { display: inline-block; min-width: 7rem; font-weight: 600; text-decoration: none; overflow-wrap: anywhere; }
.report td a:hover { text-decoration: underline; }
.report td small { display: block; margin-top: 3px; color: var(--muted-foreground); font-size: .75rem; }
.table-value { text-align: right; white-space: nowrap; }
.grid-halves { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }

.comparison, .insights { padding: 0; margin: 0; list-style: none; }
.comparison { font-variant-numeric: tabular-nums; }
.comparison li {
  display: flex;
  justify-content: space-between;
  gap: 8px 16px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: .875rem;
}
.comparison li:last-child { border-bottom: 0; }
.comparison li.comparison-period { justify-content: flex-start; padding-top: 14px; font-weight: 600; }
.comparison li.comparison-period:first-child { padding-top: 0; }
.comparison-period small { display: block; font-weight: 400; }
.comparison strong { white-space: nowrap; }
.positive { color: var(--primary); }
.negative { color: var(--erp-danger-text); }
.data-points { display: grid; gap: 0; margin: 0; }
.data-points div {
  display: grid;
  grid-template-columns: 1fr minmax(0, 1fr);
  align-items: baseline;
  gap: 12px;
  padding: 10px 0;
  font-size: .875rem;
}
.data-points div + div { border-top: 1px solid var(--border); }
.data-points dt { color: var(--muted-foreground); }
.data-points dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.coverage-list { margin-block: 12px 0; padding-inline-start: 1.25rem; color: var(--muted-foreground); font-size: .875rem; }
.coverage-list li + li { margin-top: 6px; }
.insights li { padding: 10px 0; font-size: .875rem; line-height: 1.6; }
.insights li + li { border-top: 1px solid var(--border); }
.insights li:first-child { padding-top: 0; }
.insights strong { display: block; margin-bottom: 2px; }
.insights span, .muted { color: var(--muted-foreground); }
.data-error { margin-block: 12px 0; font-size: .875rem; line-height: 1.5; }

@media (max-width: 1100px) {
  .panel:not(.dashboard-chart-card) { padding: 17px 16px 14px; }
}
@media (max-width: 800px) {
  .grid-halves { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 480px) {
  .page-heading { margin-bottom: 18px; }
  .page-heading h1 { font-size: 1.6875rem; }
  .filters { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .filters label:has(#product), .filters .primary { grid-column: 1 / -1; }
  .filters input, .filters select, .panel input, .panel select { font-size: 1rem; }
  .report .metric dd { font-size: 1.45rem; }
  .metric dt svg { width: 15px; height: 15px; flex-basis: 15px; }
  .chart-lane.main .chart-canvas { height: 215px; }
  .report th, .report td { padding-inline: .6875rem; }
}
@media print {
  .filters, .chart-selector, .report .quiet, .report .primary { display: none !important; }
  .panel, .metric { break-inside: avoid; }
}
