/* ==========================================================================
   ReCyF Tool - Dashboard Module Styles
   ========================================================================== */

/* --- Dashboard Layout --- */
.dash {
  max-width: 1200px;
  display: flex;
  flex-direction: column;
  gap: var(--space-xl);
}

.dash__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* --- Compliance Status Banner --- */
.dash-status {
  display: flex;
  align-items: center;
  gap: var(--space-lg);
  padding: var(--space-lg) var(--space-xl);
  border-radius: var(--radius-lg);
  border: 1px solid;
  box-shadow: var(--shadow-sm);
}

.dash-status--pass {
  background: var(--color-success-bg);
  border-color: rgba(43, 122, 15, 0.2);
}

.dash-status--fail {
  background: var(--color-danger-bg);
  border-color: var(--color-danger-border);
}

.dash-status--partial {
  background: var(--color-warning-bg);
  border-color: var(--color-warning-border);
}

.dash-status--insufficient {
  background: var(--color-warning-bg);
  border-color: var(--color-warning-border);
  opacity: 0.75;
}

.dash-status__icon {
  font-size: 2rem;
  flex-shrink: 0;
}

.dash-status__text {
  flex: 1;
}

.dash-status__title {
  font-family: var(--font-heading);
  font-weight: var(--weight-bold);
  font-size: var(--text-md);
  margin-bottom: 2px;
}

.dash-status__desc {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
}

.dash-status__score {
  text-align: center;
  flex-shrink: 0;
}

.dash-status__score-value {
  font-family: var(--font-heading);
  font-size: var(--text-3xl);
  font-weight: var(--weight-bold);
}

.dash-status__score-label {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

/* --- KPI Cards Row --- */
.dash-kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: var(--space-md);
  background: var(--color-bg);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  box-shadow: var(--shadow-sm);
}

.dash-kpi {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-md) var(--space-lg);
  text-align: center;
}

.dash-kpi__value {
  font-family: var(--font-heading);
  font-size: var(--text-2xl);
  font-weight: var(--weight-bold);
  color: var(--color-dark);
}

.dash-kpi__label {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  margin-top: var(--space-sm);
}

/* --- Maturity Thermometer --- */
.dash-thermometer { width: 100%; padding: var(--space-md) 0; }
.dash-thermometer svg { width: 100%; height: 80px; }

/* --- Two Column Layout (Chart + Table) --- */
.dash-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-xl);
}

/* Children of a columns grid don't need their own bottom margin */
.dash-columns > * {
  margin-bottom: 0;
}

.dash-column-stack {
  display: flex;
  flex-direction: column;
  gap: var(--space-xl);
}

.dash-panel {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.dash-panel__header {
  padding: var(--space-md) var(--space-lg);
  margin-bottom: var(--space-lg);
  border-bottom: 1px solid var(--color-border-light);
  font-family: var(--font-heading);
  font-weight: var(--weight-semibold);
  font-size: var(--text-md);
}

.dash-panel__body {
  padding: var(--space-lg);
}

/* --- Radar Chart --- */
.dash-radar {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 300px;
}

.dash-radar canvas {
  max-width: 100%;
  max-height: 320px;
}

/* --- Category Table --- */
.dash-cat-table {
  font-size: var(--text-xs);
  width: 100%;
}

.dash-cat-table th {
  text-align: left;
  padding: var(--space-xs) var(--space-sm);
  font-weight: var(--weight-semibold);
  color: var(--color-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  border-bottom: 1px solid var(--color-border);
  white-space: nowrap;
}

.dash-cat-table td {
  padding: var(--space-xs) var(--space-sm);
  border-bottom: 1px solid var(--color-border-light);
  vertical-align: middle;
}

.dash-cat-table tr:last-child td {
  border-bottom: none;
}

.dash-cat-table__bar {
  width: 60px;
  display: inline-block;
}

.dash-cat-table__score {
  font-weight: var(--weight-bold);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
}

.dash-cat-table__score--pass { color: var(--color-success); }
.dash-cat-table__score--fail { color: var(--color-danger); }
.dash-cat-table__score--warn { color: var(--color-warning); }

/* --- Maturity Heatmap --- */
.dash-heatmap-wrap {
  margin-bottom: var(--space-xl);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.dash-heatmap {
  font-size: var(--text-xs);
  width: 100%;
  min-width: 480px;
  border-collapse: collapse;
}

.dash-heatmap th {
  text-align: left;
  padding: var(--space-xs) var(--space-sm);
  font-weight: var(--weight-semibold);
  color: var(--color-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  border-bottom: 1px solid var(--color-border);
  white-space: nowrap;
}

.dash-heatmap td {
  padding: var(--space-xs) var(--space-sm);
  border-bottom: 1px solid var(--color-border-light);
  vertical-align: middle;
}

.dash-heatmap tr:last-child td {
  border-bottom: none;
}

.dash-heatmap__label {
  white-space: nowrap;
}

.dash-heatmap__cell {
  width: 48px;
  height: 32px;
  border-radius: var(--radius-sm);
  text-align: center;
  vertical-align: middle;
  font-size: var(--text-xs);
  font-weight: var(--weight-bold);
}

/* D3 Heatmap */
.dash-heatmap-svg {
  display: block;
}

svg .heatmap-label:hover text {
  fill: var(--color-primary);
}

.dash-heatmap-tooltip {
  display: none;
  position: absolute;
  z-index: var(--z-toast);
  background: var(--color-text);
  color: var(--color-header-text);
  font-size: 12px;
  font-family: var(--font-body);
  line-height: 1.5;
  padding: 8px 12px;
  border-radius: 6px;
  pointer-events: none;
  max-width: 280px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

/* --- Key Measures Section --- */
.dash-km {
  margin-bottom: var(--space-xl);
}

.dash-km__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: var(--space-sm);
}

.dash-km__item {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-xs) var(--space-md);
  border-radius: var(--radius-sm);
  font-size: var(--text-xs);
  border: 1px solid var(--color-border-light);
}

.dash-km__item--pass {
  background: var(--color-success-bg);
}

.dash-km__item--fail {
  background: var(--color-danger-bg);
}

.dash-km__id {
  font-family: var(--font-mono);
  font-weight: var(--weight-bold);
  color: var(--color-primary);
  min-width: 80px;
}

.dash-km__text {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dash-km__score {
  font-weight: var(--weight-bold);
  font-family: var(--font-mono);
  min-width: 36px;
  text-align: right;
}

/* --- Gap Analysis --- */
.dash-gap {
  margin-bottom: var(--space-xl);
}

.dash-gap__list {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.dash-gap__item {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-sm) var(--space-md);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-sm);
  font-size: var(--text-xs);
  cursor: pointer;
  transition: background var(--transition-fast);
}

.dash-gap__item:hover {
  background: var(--color-bg-alt);
}

.dash-gap__rank {
  font-weight: var(--weight-bold);
  color: var(--color-text-muted);
  min-width: 20px;
}

.dash-gap__id {
  font-family: var(--font-mono);
  font-weight: var(--weight-bold);
  color: var(--color-primary);
  min-width: 80px;
}

.dash-gap__text {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dash-gap__current {
  font-family: var(--font-mono);
  color: var(--color-danger);
  font-weight: var(--weight-bold);
}

.dash-gap__target {
  font-family: var(--font-mono);
  color: var(--color-success);
  font-weight: var(--weight-bold);
}

.dash-gap__impact {
  font-size: var(--text-xs);
  color: var(--color-warning);
  font-weight: var(--weight-semibold);
}

/* --- Trend Chart --- */
.dash-trend-wrap {
  margin-bottom: var(--space-xl);
}

.dash-trend {
  min-height: 250px;
}

.dash-trend canvas {
  max-width: 100%;
  max-height: 280px;
}

/* --- Level Comparison --- */
.dash-level-compare {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-md);
  margin-bottom: var(--space-xl);
}

.dash-level-card {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-lg);
  text-align: center;
  position: relative;
}

.dash-level-card--current {
  border-color: var(--color-primary);
  border-width: 2px;
}

.dash-level-card__badge {
  margin-bottom: var(--space-sm);
}

.dash-level-card__score {
  font-family: var(--font-heading);
  font-size: var(--text-2xl);
  font-weight: var(--weight-bold);
  margin-bottom: var(--space-xs);
}

.dash-level-card__target {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

.dash-level-card__label {
  position: absolute;
  top: var(--space-sm);
  right: var(--space-sm);
  font-size: var(--text-xs);
  color: var(--color-primary);
  font-weight: var(--weight-bold);
}

/* --- Progress Comparison (Snapshot delta) --- */
.dash-progress {
  margin-bottom: var(--space-xl);
}

.dash-progress__summary {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  margin-bottom: var(--space-md);
  font-size: var(--text-md);
}

.dash-progress__label {
  font-weight: var(--weight-semibold);
}

.dash-progress__delta {
  font-family: var(--font-mono);
  font-weight: var(--weight-bold);
  font-size: var(--text-lg);
}

.dash-progress__delta--positive {
  color: var(--color-success);
}

.dash-progress__delta--negative {
  color: var(--color-danger);
}

.dash-progress__counts {
  display: flex;
  gap: var(--space-lg);
  margin-bottom: var(--space-lg);
  font-size: var(--text-sm);
}

.dash-progress__count {
  font-weight: var(--weight-semibold);
}

.dash-progress__count--improved {
  color: var(--color-success);
}

.dash-progress__count--worsened {
  color: var(--color-danger);
}

.dash-progress__count--unchanged {
  color: var(--color-text-muted);
}

.dash-progress__table {
  width: 100%;
  font-size: var(--text-sm);
  border-collapse: collapse;
}

.dash-progress__table th {
  text-align: left;
  padding: var(--space-xs) var(--space-sm);
  font-weight: var(--weight-semibold);
  color: var(--color-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  font-size: var(--text-xs);
  border-bottom: 1px solid var(--color-border);
}

.dash-progress__table td {
  padding: var(--space-xs) var(--space-sm);
  border-bottom: 1px solid var(--color-border-light);
}

.dash-progress__table tr:last-child td {
  border-bottom: none;
}

.dash-progress__cell-num {
  font-family: var(--font-mono);
  font-weight: var(--weight-bold);
  text-align: right;
}

/* --- Profile Snapshots Table --- */
.profile-snapshots__table {
  width: 100%;
  font-size: var(--text-sm);
  border-collapse: collapse;
}

.profile-snapshots__table th {
  text-align: left;
  padding: var(--space-xs) var(--space-sm);
  font-weight: var(--weight-semibold);
  color: var(--color-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  font-size: var(--text-xs);
  border-bottom: 1px solid var(--color-border);
}

.profile-snapshots__table td {
  padding: var(--space-xs) var(--space-sm);
  border-bottom: 1px solid var(--color-border-light);
  vertical-align: middle;
}

.profile-snapshots__table tr:last-child td {
  border-bottom: none;
}

/* --- KM Donut inline with header --- */
.dash-panel__header--km {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
}

.dash-panel__header--km canvas {
  flex-shrink: 0;
}

/* --- Distribution Histogram --- */
.dash-distribution-wrap {
  margin-bottom: var(--space-xl);
}

.dash-distribution {
  min-height: 200px;
  max-height: 250px;
}

.dash-distribution canvas {
  max-width: 100%;
  max-height: 240px;
}

/* --- Risk Matrix (V7) --- */
.dash-risk-matrix-wrap {
  margin-bottom: var(--space-xl);
}

.dash-risk-matrix {
  border-collapse: separate;
  border-spacing: 0;
}

.dash-risk-matrix th {
  font-size: var(--text-xs);
  padding: 4px 8px;
  color: var(--color-text-muted);
}

.dash-risk-matrix td {
  width: 48px;
  height: 36px;
  text-align: center;
  font-size: var(--text-xs);
  font-weight: var(--weight-bold);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-sm);
}

/* --- Function Cards (D1) --- */
.dash-func-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-md);
  margin-bottom: var(--space-xl);
}

.dash-func-card {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-md) var(--space-lg);
}

.dash-func-card__header {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-bottom: var(--space-sm);
}

.dash-func-card__icon {
  color: var(--color-primary);
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
}

.dash-func-card__title {
  font-size: var(--text-sm);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dash-func-card__score {
  font-family: var(--font-heading);
  font-size: var(--text-2xl);
  font-weight: var(--weight-bold);
  margin-bottom: var(--space-sm);
}

.dash-func-card__score--pass {
  color: var(--color-success);
}

.dash-func-card__score--fail {
  color: var(--color-danger);
}

.dash-func-card__bars {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: var(--space-sm);
}

.dash-func-card__bar-row {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}

.dash-func-card__bar-label {
  font-size: 10px;
  font-family: var(--font-mono);
  color: var(--color-text-muted);
  min-width: 40px;
  text-align: right;
}

.dash-func-card__bar-track {
  flex: 1;
  height: 8px;
  background: var(--color-bg-alt);
  border-radius: 4px;
  overflow: hidden;
}

.dash-func-card__bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.3s ease;
  will-change: width;
}

.dash-func-card__bar-value {
  font-size: 10px;
  font-family: var(--font-mono);
  font-weight: var(--weight-bold);
  color: var(--color-text-secondary);
  min-width: 24px;
  text-align: right;
}

.dash-func-card__footer {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  text-align: right;
}

/* --- Executive Summary (D2) --- */
.dash-exec-summary {
  margin-bottom: var(--space-xl);
}

.dash-exec-summary__text {
  font-size: var(--text-sm);
  line-height: 1.7;
  color: var(--color-text);
  margin: 0;
}

.dash-exec-summary__list {
  margin: 0;
  padding: 0 0 0 var(--space-lg);
  font-size: var(--text-sm);
  line-height: 1.7;
  color: var(--color-text);
}

.dash-exec-summary__list li {
  margin-bottom: var(--space-xs);
}

.dash-low-data-warning {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-lg);
  background: var(--color-warning-bg);
  border: 1px solid var(--color-warning-border);
  border-radius: var(--radius-md);
  color: var(--color-warning);
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  margin-bottom: var(--space-lg);
}

/* --- Sector Benchmark Comparison --- */
.dash-benchmark {
  margin-bottom: var(--space-xl);
}

.dash-benchmark__panel {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.dash-benchmark__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-md) var(--space-lg);
  border-bottom: 1px solid var(--color-border);
  background: var(--color-bg);
}

.dash-benchmark__title {
  font-family: var(--font-heading);
  font-weight: var(--weight-semibold);
  font-size: var(--text-sm);
  color: var(--color-text);
}

.dash-benchmark__sector-tag {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  background: var(--color-bg-alt, #f5f5f5);
  padding: 2px var(--space-sm);
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
}

.dash-benchmark__body {
  padding: var(--space-lg);
}

/* Scores grid */
.dash-benchmark__scores {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-lg);
  margin-bottom: var(--space-lg);
}

@media (max-width: 1024px) {
  .dash-columns { grid-template-columns: 1fr; }
  .dash-level-compare { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 600px) {
  .dash-benchmark__scores { grid-template-columns: 1fr; }
  .dash-level-compare { grid-template-columns: 1fr; }
}

.dash-benchmark__score-block {}

.dash-benchmark__score-label {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: var(--space-xs);
}

.dash-benchmark__score-value {
  display: flex;
  align-items: baseline;
  gap: var(--space-xs);
  margin-bottom: var(--space-xs);
}

.dash-benchmark__score-number {
  font-family: var(--font-heading);
  font-size: var(--text-2xl);
  font-weight: var(--weight-bold);
  line-height: 1;
}

.dash-benchmark__score-number--user  { color: var(--color-primary); }
.dash-benchmark__score-number--sector { color: var(--color-text-secondary); }

.dash-benchmark__score-max {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

/* Progress bar */
.dash-benchmark__bar {
  height: 8px;
  background: var(--color-border);
  border-radius: 4px;
  overflow: hidden;
}

.dash-benchmark__bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.4s ease;
  will-change: width;
}

.dash-benchmark__bar-fill--user   { background: var(--color-primary); }
.dash-benchmark__bar-fill--sector { background: var(--color-text-muted); }

/* Delta badge */
.dash-benchmark__delta {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  padding: 2px var(--space-sm);
  border-radius: var(--radius-sm);
  margin-top: var(--space-sm);
}

.dash-benchmark__delta--above { background: var(--color-success-bg); color: var(--color-primary-hover); }
.dash-benchmark__delta--below { background: var(--color-danger-bg);  color: var(--color-danger); }
.dash-benchmark__delta--at    { background: var(--color-bg-alt, #f5f5f5); color: var(--color-text-muted); }

/* Confidence row */
.dash-benchmark__meta {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-sm) 0;
  border-top: 1px solid var(--color-border);
  margin-bottom: var(--space-md);
}

.dash-benchmark__conf-label {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  flex-shrink: 0;
}

.dash-benchmark__conf-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  padding: 2px 8px;
  border-radius: 99px;
}

.dash-benchmark__conf-badge--high   { background: var(--color-badge-pass-bg); color: var(--color-badge-pass-text); }
.dash-benchmark__conf-badge--medium { background: var(--color-badge-warn-bg); color: var(--color-badge-warn-text); }
.dash-benchmark__conf-badge--low    { background: var(--color-bg-alt); color: var(--color-text-secondary); }
.dash-benchmark__conf-badge--proxy  { background: var(--color-badge-warn-bg); color: var(--color-badge-warn-text); }
.dash-benchmark__conf-badge--none   { background: var(--color-bg-alt); color: var(--color-text-muted); }

.dash-benchmark__conf-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

.dash-benchmark__conf-badge--high   .dash-benchmark__conf-dot { background: var(--color-badge-pass-dot); }
.dash-benchmark__conf-badge--medium .dash-benchmark__conf-dot { background: var(--color-badge-warn-dot); }
.dash-benchmark__conf-badge--low    .dash-benchmark__conf-dot { background: var(--color-text-muted); }
.dash-benchmark__conf-badge--proxy  .dash-benchmark__conf-dot { background: var(--color-badge-warn-dot); }
.dash-benchmark__conf-badge--none   .dash-benchmark__conf-dot { background: var(--color-border); }

/* Caveat / disclaimer box */
.dash-benchmark__caveat {
  background: var(--color-bg-alt);
  border-left: 3px solid var(--color-border);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: var(--space-sm) var(--space-md);
  font-size: var(--text-xs);
  color: var(--color-text-secondary);
  line-height: 1.6;
  margin-bottom: var(--space-sm);
}

.dash-benchmark__caveat--warning {
  border-left-color: var(--color-warning);
  background: var(--color-warning-bg);
}

.dash-benchmark__caveat--risk-zone {
  border-left-color: var(--color-danger);
  background: var(--color-danger-bg);
  color: var(--color-danger);
  font-weight: var(--weight-medium);
}

/* Empty / no-data state inside panel */
.dash-benchmark__empty {
  text-align: center;
  padding: var(--space-xl) var(--space-lg);
  color: var(--color-text-muted);
}

.dash-benchmark__empty-icon {
  font-size: 2rem;
  margin-bottom: var(--space-sm);
  opacity: 0.4;
}

.dash-benchmark__empty-title {
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: var(--color-text-secondary);
  margin-bottom: var(--space-xs);
}

.dash-benchmark__empty-desc {
  font-size: var(--text-xs);
  margin-bottom: var(--space-md);
}

.dash-benchmark__conf-hint {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: rgba(0,0,0,0.12);
  font-size: 9px;
  font-weight: var(--weight-bold);
  line-height: 1;
  cursor: help;
  vertical-align: middle;
  margin-left: 2px;
}

.dash-benchmark__vintage {
  margin-left: auto;
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  white-space: nowrap;
}

/* Doc vs Impl chart */
.dash-doc-impl { min-height: 180px; }
.dash-doc-impl canvas { max-width: 100%; }

/* Waterfall chart */
.dash-waterfall { min-height: 180px; }
.dash-waterfall canvas { max-width: 100%; }

/* Colored KPI cards */
.dash-kpi--pass { background: var(--color-success-bg, #f0fdf4); border-color: rgba(43,122,15,0.3); }
.dash-kpi--warn { background: var(--color-warning-bg); border-color: rgba(245,158,11,0.3); }
.dash-kpi--fail { background: var(--color-danger-bg, #fff5f5); border-color: rgba(192,57,43,0.3); }
.dash-kpi--pass .dash-kpi__value { color: var(--color-primary); }
.dash-kpi--warn .dash-kpi__value { color: var(--color-kpi-warn); }
.dash-kpi--fail .dash-kpi__value { color: var(--color-danger); }

/* Progress ribbon */
.dash-progress-ribbon {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  margin-bottom: var(--space-lg);
  padding: var(--space-sm) var(--space-lg);
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
}
.dash-progress-ribbon__label {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  white-space: nowrap;
  font-weight: 600;
}
.dash-progress-ribbon__track {
  flex: 1;
  height: 8px;
  background: var(--color-bg-alt, #e5e7eb);
  border-radius: 4px;
  overflow: hidden;
}
.dash-progress-ribbon__fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.6s ease;
  will-change: width;
}
.dash-progress-ribbon__badge {
  font-size: var(--text-xs);
  font-weight: 700;
  font-family: var(--font-mono);
  min-width: 38px;
  text-align: right;
}

/* Gap analysis visual bar */
.dash-gap__bar {
  display: inline-block;
  width: 120px;
  height: 6px;
  background: var(--color-bg-alt);
  border-radius: 3px;
  position: relative;
  vertical-align: middle;
}
.dash-gap__bar-fill {
  height: 100%;
  border-radius: 3px;
  position: absolute;
  top: 0;
  left: 0;
}
.dash-gap__bar-target {
  position: absolute;
  top: -3px;
  width: 2px;
  height: 12px;
  background: var(--color-text);
  border-radius: 1px;
}

/* Score arc gauge in function cards */
.dash-func-card__gauge {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: var(--space-xs);
}
.dash-func-card__gauge svg { display: block; }
.dash-func-card__gauge-value {
  font-family: var(--font-heading);
  font-size: var(--text-lg);
  font-weight: var(--weight-bold);
  margin-top: -6px;
}


/* ==========================================================================
   PILLAR DETAIL CARDS (Section 16)
   ========================================================================== */

.dash-pillar-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: var(--space-md);
  margin-bottom: var(--space-xl);
}

.dash-pillar-card {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-md) var(--space-lg);
  border-top: 5px solid var(--color-border);
}

.dash-pillar-card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-sm);
}

.dash-pillar-card__name {
  font-family: var(--font-heading);
  font-weight: var(--weight-bold);
  font-size: var(--text-sm);
}

.dash-pillar-card__score {
  font-family: var(--font-heading);
  font-size: var(--text-xl);
  font-weight: var(--weight-bold);
}

.dash-pillar-card__objectives {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: var(--space-sm) 0;
}

.dash-pillar-card__obj {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-xs) var(--space-sm);
  border-radius: var(--radius-sm);
  font-size: var(--text-xs);
  transition: background var(--transition-fast);
}

.dash-pillar-card__obj:hover {
  background: var(--color-bg-alt);
}

.dash-pillar-card__obj-id {
  font-family: var(--font-mono);
  font-weight: var(--weight-bold);
  color: var(--color-text-secondary);
  min-width: 28px;
}

.dash-pillar-card__obj-label {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dash-pillar-card__obj-score {
  font-family: var(--font-mono);
  font-weight: var(--weight-bold);
  font-size: var(--text-xs);
  min-width: 28px;
  text-align: right;
}

.dash-pillar-card__footer {
  padding-top: var(--space-sm);
  border-top: 1px solid var(--color-border-light);
  text-align: right;
}


/* ==========================================================================
   SCORE RINGS — SVG circular gauges (Section 8)
   ========================================================================== */

.dash-rings-panel { /* extends .dash-panel */ }

.dash-rings {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: var(--space-lg);
}

.dash-ring {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-xs);
}

.dash-ring__label {
  font-family: var(--font-heading);
  font-size: var(--text-xs);
  font-weight: var(--weight-bold);
  text-align: center;
}

.dash-ring__score {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  text-align: center;
}


/* ==========================================================================
   COMPLETION RIBBON — segmented pillar bar (Section 23)
   ========================================================================== */

.dash-ribbon {
  margin-bottom: var(--space-lg);
}

.dash-ribbon__bar {
  display: flex;
  height: 10px;
  border-radius: 5px;
  overflow: hidden;
  background: var(--color-bg-alt, #e5e7eb);
  gap: 2px;
}

.dash-ribbon__segment {
  position: relative;
  background: var(--color-bg-alt, #e5e7eb);
  overflow: hidden;
}

.dash-ribbon__fill {
  height: 100%;
  transition: width 0.6s ease;
}

.dash-ribbon__legend {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm) var(--space-md);
  margin-top: var(--space-sm);
  font-size: var(--text-xs);
  color: var(--color-text-secondary);
}

.dash-ribbon__legend-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.dash-ribbon__dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}


/* ==========================================================================
   SNAPSHOT COMPARISON (Section 19)
   ========================================================================== */

.dash-compare-panel { /* extends .dash-panel */ }

.dash-compare__selectors {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-md);
  margin-bottom: var(--space-md);
}

.dash-compare__selectors label {
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: var(--color-text-secondary);
}

.dash-compare__selectors select {
  font-size: var(--text-sm);
  padding: var(--space-xs) var(--space-sm);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-bg);
}

.dash-compare__result {
  /* container for comparison output */
}

.dash-compare__overall {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  margin-bottom: var(--space-md);
  font-size: var(--text-md);
}

.dash-compare__label {
  font-weight: var(--weight-semibold);
  color: var(--color-text-secondary);
}

.dash-compare__delta {
  font-family: var(--font-mono);
  font-weight: var(--weight-bold);
  font-size: var(--text-lg);
}

.dash-compare__pillars {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm) var(--space-lg);
}

.dash-compare__pillar-delta {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-size: var(--text-sm);
}


/* ==========================================================================
   KPI SUBTITLE (Section 7)
   ========================================================================== */

.dash-kpi__subtitle {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  margin-top: 2px;
}


/* ==========================================================================
   OBJECTIVE BREAKDOWN TABLE (Section 17)
   ========================================================================== */

.dash-obj-table-panel { /* extends .dash-panel */ }

.dash-obj-table {
  width: 100%;
  font-size: var(--text-xs);
  border-collapse: collapse;
}

.dash-obj-table th {
  text-align: left;
  padding: var(--space-xs) var(--space-sm);
  font-weight: var(--weight-semibold);
  color: var(--color-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  border-bottom: 1px solid var(--color-border);
  white-space: nowrap;
  position: sticky;
  top: 0;
  background: var(--color-bg);
  z-index: var(--z-sticky);
}

.dash-obj-table td {
  padding: var(--space-xs) var(--space-sm);
  border-bottom: 1px solid var(--color-border-light);
  vertical-align: middle;
}

.dash-obj-table tr:last-child td {
  border-bottom: none;
}

.dash-obj-table__row {
  transition: background var(--transition-fast);
}

.dash-obj-table__row:hover {
  background: var(--color-bg-alt);
}


/* ==========================================================================
   DIFFICULTY BADGES (Gap Analysis — Section 12)
   ========================================================================== */

.badge--diff-very-easy {
  background: var(--color-badge-pass-bg);
  color: var(--color-badge-pass-text);
}

.badge--diff-easy {
  background: var(--color-difficulty-easy-bg);
  color: var(--color-difficulty-easy-text);
}

.badge--diff-moderate {
  background: var(--color-difficulty-moderate-bg);
  color: var(--color-difficulty-moderate-text);
}

.badge--diff-hard {
  background: var(--color-difficulty-hard-bg);
  color: var(--color-difficulty-hard-text);
}

.badge--diff-very-hard {
  background: var(--color-danger);
  color: var(--color-bg);
}


/* ==========================================================================
   RADAR & HEATMAP PANEL markers (Sections 9–10)
   ========================================================================== */

.dash-radar-panel { /* extends .dash-panel */ }
.dash-heatmap-panel {
  margin-bottom: var(--space-xl);
}


/* ==========================================================================
   PROGRESS SINCE SNAPSHOT — pillar deltas (Section 18)
   ========================================================================== */

.dash-progress__pillars {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm) var(--space-lg);
  margin-top: var(--space-sm);
}

.dash-progress__pillar {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
}


/* ==========================================================================
   GAP ANALYSIS TABLE (Section 12 — extended styles)
   ========================================================================== */

.dash-gap-panel { /* extends .dash-panel */ }

.dash-gap__filters {
  display: inline-flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
  margin-left: auto;
}

.dash-gap__filter-btn {
  font-size: var(--text-xs);
  border-radius: 99px;
  padding: 2px var(--space-sm);
  opacity: 0.6;
  transition: opacity var(--transition-fast);
}

.dash-gap__filter-btn--active {
  opacity: 1;
  font-weight: var(--weight-bold);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.dash-gap-table {
  width: 100%;
  font-size: var(--text-xs);
  border-collapse: collapse;
}

.dash-gap-table th {
  text-align: left;
  padding: var(--space-xs) var(--space-sm);
  font-weight: var(--weight-semibold);
  color: var(--color-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  border-bottom: 1px solid var(--color-border);
  white-space: nowrap;
}

.dash-gap-table td {
  padding: var(--space-xs) var(--space-sm);
  border-bottom: 1px solid var(--color-border-light);
  vertical-align: middle;
}

.dash-gap-table tr:last-child td {
  border-bottom: none;
}

.dash-gap__row {
  transition: background var(--transition-fast);
}

.dash-gap__row:hover {
  background: var(--color-bg-alt);
}

.dash-gap__means-id {
  white-space: nowrap;
}

.dash-gap__pillar-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: var(--space-xs);
  vertical-align: middle;
}

.dash-gap__label {
  max-width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dash-gap__score-badge {
  display: inline-block;
  font-family: var(--font-mono);
  font-weight: var(--weight-bold);
  font-size: var(--text-xs);
  margin-bottom: 2px;
}

.dash-gap__gap-value {
  font-family: var(--font-mono);
  font-weight: var(--weight-bold);
  color: var(--color-danger);
}


/* ==========================================================================
   SCORE DISTRIBUTION — stacked bar (Section 15)
   ========================================================================== */

.dash-distrib-panel { /* extends .dash-panel */ }

.dash-distrib__bar {
  display: flex;
  height: 24px;
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: var(--space-md);
}

.dash-distrib__segment {
  transition: width 0.4s ease;
  min-width: 2px;
}

.dash-distrib__legend {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs) var(--space-md);
  font-size: var(--text-xs);
  color: var(--color-text-secondary);
}

.dash-distrib__legend-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.dash-distrib__dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 2px;
  flex-shrink: 0;
}


/* ==========================================================================
   RISK OVERVIEW (Section 22)
   ========================================================================== */

.dash-risk-panel { /* extends .dash-panel */ }

.dash-risk-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-md);
}

@media (max-width: 1024px) {
  .dash-risk-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 600px) {
  .dash-risk-grid { grid-template-columns: 1fr; }
}

.dash-risk-column { /* one column per pillar */ }

.dash-risk-column__header {
  font-family: var(--font-heading);
  font-weight: var(--weight-bold);
  font-size: var(--text-sm);
  margin-bottom: var(--space-sm);
}

.dash-risk-column__empty {
  padding: var(--space-sm);
}

.dash-risk-item {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-xs) var(--space-sm);
  border-radius: var(--radius-sm);
  font-size: var(--text-xs);
  margin-bottom: var(--space-xs);
  transition: background var(--transition-fast);
}

.dash-risk-item:hover {
  background: var(--color-bg-alt);
}

.dash-risk-item__id {
  font-family: var(--font-mono);
  font-weight: var(--weight-bold);
  color: var(--color-text-secondary);
  min-width: 24px;
}

.dash-risk-item__label {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dash-risk-item__score {
  font-family: var(--font-mono);
  font-weight: var(--weight-bold);
  font-size: var(--text-xs);
  min-width: 28px;
  text-align: right;
}


/* ==========================================================================
   TREND SPARKLINES (Section 11)
   ========================================================================== */

.dash-trend-panel { /* extends .dash-panel */ }

.dash-trend-grid {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.dash-trend-row {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-xs) 0;
}

.dash-trend__label {
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  color: var(--color-text-secondary);
  min-width: 100px;
}

.dash-trend__current {
  font-family: var(--font-mono);
  font-weight: var(--weight-bold);
  font-size: var(--text-sm);
  min-width: 36px;
  text-align: right;
}

.dash-trend__spark {
  flex-shrink: 0;
}

.dash-trend__delta {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  min-width: 52px;
  text-align: right;
}

.dash-trend__delta--up {
  color: var(--color-success);
}

.dash-trend__delta--down {
  color: var(--color-danger);
}

.dash-trend__delta--flat {
  color: var(--color-text-muted);
}


/* ==========================================================================
   EVIDENCE COVERAGE TABLE (Section 13)
   ========================================================================== */

.dash-evidence-panel { /* extends .dash-panel */ }

.dash-evidence-table {
  width: 100%;
  font-size: var(--text-sm);
  border-collapse: collapse;
}

.dash-evidence-table th {
  text-align: left;
  padding: var(--space-xs) var(--space-sm);
  font-weight: var(--weight-semibold);
  color: var(--color-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  font-size: var(--text-xs);
  border-bottom: 1px solid var(--color-border);
}

.dash-evidence-table td {
  padding: var(--space-xs) var(--space-sm);
  border-bottom: 1px solid var(--color-border-light);
  vertical-align: middle;
}

.dash-evidence-table tr:last-child td {
  border-bottom: none;
}

.dash-evidence__dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: var(--space-xs);
  vertical-align: middle;
}

.dash-evidence__total {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
  margin-top: var(--space-md);
  padding-top: var(--space-md);
  border-top: 1px solid var(--color-border-light);
}


/* ==========================================================================
   EXECUTIVE SUMMARY (Section 24 — extended)
   ========================================================================== */

.dash-exec-panel { /* extends .dash-panel */
  margin-bottom: var(--space-xl);
}

.dash-exec__text {
  font-size: var(--text-sm);
  line-height: 1.7;
  color: var(--color-text);
  margin: 0;
}


/* ==========================================================================
   TOOLTIP (Section 25)
   ========================================================================== */

.dash-tooltip {
  display: none;
  position: absolute;
  z-index: var(--z-toast);
  background: var(--color-text);
  color: var(--color-header-text);
  font-size: 12px;
  font-family: var(--font-body);
  line-height: 1.5;
  padding: 8px 12px;
  border-radius: 6px;
  pointer-events: none;
  max-width: 280px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}


/* ==========================================================================
   NIS2 READINESS RING (F1)
   ========================================================================== */

.dash-readiness {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-xl);
  padding: var(--space-xl);
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}
.dash-readiness__info--completion {
  border-left: 1px solid var(--color-border-light);
  padding-left: var(--space-xl);
}

.dash-readiness__ring {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-xs);
  flex-shrink: 0;
}

.dash-readiness__status {
  font-family: var(--font-heading);
  font-size: var(--text-xs);
  font-weight: var(--weight-bold);
  text-align: center;
}

.dash-readiness__info {
  flex: 1;
}

.dash-readiness__title {
  font-family: var(--font-heading);
  font-size: var(--text-lg);
  font-weight: var(--weight-bold);
  color: var(--color-dark);
  margin-bottom: var(--space-xs);
}

.dash-readiness__means {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  margin-bottom: var(--space-sm);
}

.dash-readiness__maturity {
  display: flex;
  align-items: center;
  margin-top: var(--space-sm);
}


/* ==========================================================================
   MATURITY BADGES (F4)
   ========================================================================== */

.dash-maturity-badge {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  font-size: var(--text-xs);
  font-weight: var(--weight-bold);
  padding: 2px var(--space-sm);
  border-radius: var(--radius-pill);
  white-space: nowrap;
}

.dash-maturity-badge--sm {
  font-size: 10px;
  padding: 1px 6px;
}


/* ==========================================================================
   PROGRESS RING (V6) — reusable
   ========================================================================== */

.progress-ring {
  display: block;
}

.progress-ring__bg {
  /* inherits from inline attrs */
}

.progress-ring__fill {
  transition: stroke-dashoffset 1.5s ease-out;
}

.progress-ring__text {
  font-family: var(--font-heading);
  font-weight: var(--weight-bold);
}


/* ==========================================================================
   KPI SPARKLINES (V8)
   ========================================================================== */

.dash-kpi__sparkline {
  display: block;
  margin: var(--space-xs) auto 0;
  opacity: 0.6;
}


/* ==========================================================================
   BUBBLE CHART (V10)
   ========================================================================== */

.dash-bubble-panel {}

#dash-bubble-chart {
  position: relative;
  min-height: 360px;
  width: 100%;
}

#dash-bubble-chart svg {
  display: block;
  width: 100%;
  height: auto;
}

#dash-bubble-chart .bubble {
  transition: fill-opacity 0.2s ease, stroke-width 0.15s ease;
}

/* Bubble chart tooltip — appended to body, needs fixed positioning */
.dash-bubble-tooltip {
  position: fixed !important;
}


/* ==========================================================================
   D3 HEATMAP CELLS (V9) — animation + hover
   ========================================================================== */

.heatmap-cell rect {
  transition: all 0.15s ease;
}

.heatmap-cell:hover rect {
  filter: brightness(1.1);
}


/* ==========================================================================
   REDUCED MOTION
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
  .progress-ring__fill,
  .dash-ring__fill,
  .dash-ribbon__fill,
  .dash-distrib__segment,
  .dash-func-card__bar-fill,
  .dash-benchmark__bar-fill,
  .dash-progress-ribbon__fill,
  .heatmap-cell,
  #dash-bubble-chart .bubble {
    transition: none !important;
  }
  .heatmap-cell {
    opacity: 1 !important;
  }
}

@media (max-width: 600px) {
  .dash-readiness {
    flex-direction: column;
    text-align: center;
  }
  .dash-readiness__maturity {
    justify-content: center;
  }
}
