/* Role dashboards */
.dash-overview {
  max-width: 72rem;
  margin: 0 auto;
  padding: 1.5rem 0 2rem;
}

.dash-overview--admin .dash-overview__title {
  font-size: 1.75rem;
}

.dash-overview__hero {
  margin-bottom: 2rem;
}

.dash-overview__eyebrow {
  font-size: var(--ib-text-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ib-primary);
  margin: 0;
}

.dash-overview__title {
  margin: 0.25rem 0 0;
  font-size: 2rem;
  font-weight: 800;
  color: var(--ib-on-surface);
  letter-spacing: -0.02em;
}

.dash-overview__lead {
  margin: 0.75rem 0 0;
  max-width: 42rem;
  color: var(--ib-on-surface-muted);
  line-height: 1.6;
}

.dash-banner {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  padding: 1rem 1.25rem;
  border-radius: var(--ib-radius);
  margin-bottom: 1.5rem;
  border: 1px solid rgba(217, 119, 6, 0.25);
  background: var(--ib-warning-bg);
}

.dash-banner--amber .dash-banner__title { font-weight: 600; color: var(--ib-on-surface); margin: 0; }
.dash-banner__text { margin: 0.25rem 0 0; font-size: var(--ib-text-sm); color: var(--ib-warning); }

.dash-loading, .dash-error {
  border-radius: var(--ib-radius);
  padding: 2.5rem;
  text-align: center;
  border: 1px solid var(--ib-outline-light);
  background: var(--ib-surface-card);
  color: var(--ib-on-surface-muted);
}

.dash-error {
  border-color: rgba(220, 38, 38, 0.2);
  background: var(--ib-error-bg);
  color: var(--ib-error);
}

.dash-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.dash-toolbar__h { margin: 0; font-size: var(--ib-text-lg); font-weight: 700; color: var(--ib-on-surface); }
.dash-toolbar__actions { display: flex; flex-wrap: wrap; gap: 0.5rem; }

.dash-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.6rem 1rem;
  border-radius: var(--ib-radius-sm);
  font-size: var(--ib-text-sm);
  font-weight: 600;
  cursor: pointer;
  border: none;
  text-decoration: none;
  transition: all var(--ib-transition);
}

.dash-btn--outline {
  border: 1px solid var(--ib-outline);
  background: var(--ib-surface-card);
  color: var(--ib-on-surface);
  box-shadow: var(--ib-shadow);
}

.dash-btn--outline:hover { border-color: var(--ib-primary); background: var(--ib-primary-light); color: var(--ib-primary-dark); }

.dash-btn--primary { color: #fff; }

.dash-btn--compact {
  padding: 0.45rem 0.7rem;
  font-size: var(--ib-text-xs);
}

.dash-kpi__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.dash-kpi__hint {
  margin: 0.45rem 0 0;
  font-size: var(--ib-text-xs);
  color: var(--ib-on-surface-muted);
  line-height: 1.45;
}

.dash-kpi--accent {
  border-top: 3px solid var(--ib-primary);
}

.dash-kpi--success {
  border-top: 3px solid var(--ib-success);
}

.dash-kpi--warning {
  border-top: 3px solid var(--ib-warning);
}

.admin-summary-grid,
.admin-data-grid,
.admin-action-grid {
  display: grid;
  gap: 1rem;
}

.admin-summary-grid {
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  margin: 0 0 1.5rem;
}

.admin-data-grid {
  grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.25fr);
  margin-bottom: 1rem;
}

.admin-action-grid {
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  margin-top: 1rem;
}

.admin-summary-panel,
.admin-data-card,
.admin-action {
  background: var(--ib-surface-card);
  border: 1px solid var(--ib-outline-light);
  border-radius: var(--ib-radius);
  box-shadow: var(--ib-shadow);
}

.admin-summary-panel,
.admin-data-card {
  padding: 1.1rem;
}

.admin-summary-panel__header,
.admin-data-card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.9rem;
}

.admin-summary-panel__header h3,
.admin-data-card__header h3 {
  margin: 0;
  font-size: var(--ib-text-md);
  font-weight: 800;
  color: var(--ib-on-surface);
}

.admin-data-card__header a {
  font-size: var(--ib-text-sm);
  font-weight: 700;
  color: var(--ib-primary);
  text-decoration: none;
}

.admin-data-card__header a:hover {
  color: var(--ib-primary-dark);
  text-decoration: underline;
}

.admin-meter-row,
.admin-status-row,
.admin-list-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.admin-meter-row {
  align-items: flex-start;
  padding: 0.65rem 0;
  border-bottom: 1px solid var(--ib-outline-light);
}

.admin-meter-row:last-child,
.admin-list-row:last-child {
  border-bottom: 0;
}

.admin-meter-row strong,
.admin-list-row strong,
.admin-table strong {
  display: block;
  color: var(--ib-on-surface);
  font-size: var(--ib-text-sm);
  font-weight: 800;
}

.admin-meter-row span,
.admin-list-row span,
.admin-table span {
  display: inline-block;
  margin-top: 0.15rem;
  color: var(--ib-on-surface-muted);
  font-size: var(--ib-text-xs);
}

.admin-meter {
  width: 92px;
  height: 8px;
  margin-top: 0.4rem;
  border-radius: 999px;
  background: var(--ib-surface-hover);
  overflow: hidden;
  flex-shrink: 0;
}

.admin-meter span {
  display: block;
  height: 100%;
  margin: 0;
  background: var(--ib-primary);
  border-radius: inherit;
}

.admin-status-row {
  min-height: 2.25rem;
  padding: 0.4rem 0;
  border-bottom: 1px solid var(--ib-outline-light);
}

.admin-status-row:last-child {
  border-bottom: 0;
}

.admin-status-row strong {
  font-size: var(--ib-text-lg);
  font-variant-numeric: tabular-nums;
}

.admin-pill {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  max-width: 100%;
  padding: 0.22rem 0.55rem;
  border-radius: 999px;
  background: var(--ib-surface-hover);
  color: var(--ib-on-surface-muted);
  font-size: var(--ib-text-xs);
  font-weight: 800;
  line-height: 1.2;
  white-space: nowrap;
}

.admin-pill--success {
  background: var(--ib-success-bg);
  color: #166534;
}

.admin-pill--warning {
  background: var(--ib-warning-bg);
  color: #854d0e;
}

.admin-pill--danger {
  background: var(--ib-error-bg);
  color: var(--ib-error);
}

.admin-pill--info {
  background: var(--ib-info-bg);
  color: #075985;
}

.admin-pill--neutral {
  background: var(--ib-secondary-light);
  color: var(--ib-secondary);
}

.admin-list {
  display: flex;
  flex-direction: column;
}

.admin-list-row {
  align-items: flex-start;
  padding: 0.72rem 0;
  border-bottom: 1px solid var(--ib-outline-light);
}

.admin-list-row__meta {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.admin-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--ib-outline-light);
  border-radius: var(--ib-radius-sm);
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 540px;
}

.admin-table th,
.admin-table td {
  padding: 0.75rem 0.85rem;
  text-align: left;
  border-bottom: 1px solid var(--ib-outline-light);
  vertical-align: top;
  font-size: var(--ib-text-sm);
}

.admin-table th {
  background: var(--ib-surface-hover);
  color: var(--ib-on-surface-muted);
  font-size: var(--ib-text-xs);
  font-weight: 800;
  text-transform: uppercase;
}

.admin-table tr:last-child td {
  border-bottom: 0;
}

.admin-empty {
  margin: 0;
  padding: 1.25rem;
  border-radius: var(--ib-radius-sm);
  background: var(--ib-surface);
  color: var(--ib-on-surface-muted);
  text-align: center;
  font-size: var(--ib-text-sm);
}

.admin-action {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.25rem;
  min-height: 5rem;
  padding: 1rem;
  border-radius: var(--ib-radius);
  color: var(--ib-on-surface);
  text-align: left;
  cursor: pointer;
  transition: border-color var(--ib-transition), box-shadow var(--ib-transition), transform var(--ib-transition);
}

.admin-action:hover {
  border-color: rgba(232, 32, 28, 0.35);
  box-shadow: var(--ib-shadow-md);
  transform: translateY(-1px);
}

.admin-action span {
  font-size: var(--ib-text-sm);
  font-weight: 800;
}

.admin-action small {
  color: var(--ib-on-surface-muted);
  font-size: var(--ib-text-xs);
  line-height: 1.45;
}

.dash-kpi-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  margin-bottom: 1.5rem;
}

.dash-kpi-grid--four {
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
}

.dash-kpi {
  background: var(--ib-surface-card);
  border: 1px solid var(--ib-outline-light);
  border-radius: var(--ib-radius);
  padding: 1.25rem;
  box-shadow: var(--ib-shadow);
  transition: transform var(--ib-transition), box-shadow var(--ib-transition);
}

.dash-kpi:hover {
  transform: translateY(-2px);
  box-shadow: var(--ib-shadow-md);
}

.dash-kpi__label {
  font-size: var(--ib-text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ib-on-surface-muted);
  margin: 0 0 0.5rem;
}

.dash-kpi__value {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--ib-on-surface);
  letter-spacing: -0.02em;
  margin: 0;
}

.dash-kpi__sub {
  font-size: var(--ib-text-xs);
  color: var(--ib-on-surface-muted);
  margin: 0.35rem 0 0;
}

.dash-kpi--accent .dash-kpi__value { color: var(--ib-primary); }
.dash-kpi--success .dash-kpi__value { color: var(--ib-success); }
.dash-kpi--warning .dash-kpi__value { color: var(--ib-warning); }

.dash-chart-panel {
  background: var(--ib-surface-card);
  border: 1px solid var(--ib-outline-light);
  border-radius: var(--ib-radius-lg);
  padding: 1.25rem 1.35rem 1.15rem;
  box-shadow: var(--ib-shadow);
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.dash-chart-panel--wide {
  grid-column: 1 / -1;
}

.dash-chart-panel__title {
  font-size: var(--ib-text-md);
  font-weight: 700;
  color: var(--ib-on-surface);
  margin: 0 0 0.35rem;
}

.dash-chart-panel__subtitle {
  margin: 0 0 1rem;
  font-size: var(--ib-text-sm);
  color: var(--ib-on-surface-muted);
  line-height: 1.5;
}

.dash-chart-panel__footnote {
  margin: 0.85rem 0 0;
  font-size: 11px;
  color: var(--ib-on-surface-subtle, #94a3b8);
}

.dash-chart-panel__empty {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 160px;
  padding: 1.5rem;
  border-radius: var(--ib-radius);
  background: var(--ib-surface, #f8fafc);
  color: var(--ib-on-surface-muted);
  font-size: var(--ib-text-sm);
  text-align: center;
}

/* Insights section */
.dash-insights {
  margin-top: 2.5rem;
  padding-top: 2rem;
  border-top: 1px solid var(--ib-outline-light);
}

.dash-insights__intro {
  max-width: 42rem;
  margin-bottom: 1.5rem;
}

.dash-insights__eyebrow {
  margin: 0 0 0.35rem;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ib-primary);
}

.dash-insights__h2 {
  margin: 0 0 0.5rem;
  font-size: clamp(1.25rem, 2vw, 1.5rem);
  font-weight: 800;
  color: var(--ib-on-surface);
  letter-spacing: -0.02em;
}

.dash-insights__p {
  margin: 0;
  font-size: var(--ib-text-sm);
  line-height: 1.6;
  color: var(--ib-on-surface-muted);
}

.dash-insights__actions {
  margin-top: 0.85rem;
}

.dash-insights__grid {
  display: grid;
  gap: 1.25rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

@media (max-width: 900px) {
  .dash-insights__grid {
    grid-template-columns: 1fr;
  }
}

/* Column chart */
.dash-col-chart {
  width: 100%;
}

.dash-col-chart__plot {
  display: flex;
  align-items: flex-end;
  gap: 0.45rem;
  min-height: 180px;
  padding: 0.5rem 0.25rem 0;
  border-bottom: 1px solid var(--ib-outline-light);
}

.dash-col-chart__col {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
}

.dash-col-chart__value {
  font-size: 11px;
  font-weight: 700;
  color: var(--ib-on-surface);
  line-height: 1;
}

.dash-col-chart__bar-wrap {
  width: 100%;
  height: 140px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.dash-col-chart__bar {
  width: 100%;
  max-width: 36px;
  border-radius: 8px 8px 3px 3px;
  min-height: 4px;
  transition: height 0.35s ease;
  box-shadow: 0 6px 12px -6px rgba(220, 38, 38, 0.45);
}

.dash-col-chart__label {
  font-size: 10px;
  font-weight: 600;
  color: var(--ib-on-surface-muted);
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

/* Grouped comparison chart */
.dash-grouped-chart {
  width: 100%;
}

.dash-grouped-chart__legend {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 0.85rem;
}

.dash-grouped-chart__legend-item {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 12px;
  font-weight: 600;
  color: var(--ib-on-surface-muted);
}

.dash-grouped-chart__legend-item i {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  display: inline-block;
}

.dash-grouped-chart__plot {
  display: flex;
  align-items: flex-end;
  gap: 0.65rem;
  min-height: 200px;
  padding: 0.25rem 0.15rem 0;
  border-bottom: 1px solid var(--ib-outline-light);
}

.dash-grouped-chart__group {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
}

.dash-grouped-chart__bars {
  height: 150px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 4px;
  width: 100%;
}

.dash-grouped-chart__bar {
  width: 42%;
  max-width: 28px;
  border-radius: 7px 7px 2px 2px;
  min-height: 4px;
  position: relative;
  transition: height 0.35s ease;
}

.dash-grouped-chart__bar span {
  position: absolute;
  top: -16px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 10px;
  font-weight: 700;
  color: var(--ib-on-surface);
}

.dash-grouped-chart__label {
  font-size: 10px;
  font-weight: 600;
  color: var(--ib-on-surface-muted);
}

/* Donut */
.dash-donut-wrap {
  display: flex;
  align-items: center;
  gap: 1.75rem;
  flex-wrap: wrap;
  justify-content: center;
  padding: 0.5rem 0;
}

.dash-donut-ring {
  width: 160px;
  height: 160px;
  border-radius: 50%;
  flex-shrink: 0;
  mask: radial-gradient(circle, transparent 52%, #000 53%);
  -webkit-mask: radial-gradient(circle, transparent 52%, #000 53%);
  box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.04);
}

.dash-donut-legend {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  min-width: 180px;
}

.dash-donut-legend li {
  display: grid;
  grid-template-columns: 12px 1fr auto;
  align-items: center;
  gap: 0.55rem;
  font-size: var(--ib-text-sm);
  color: var(--ib-on-surface);
}

.dash-donut-legend__swatch {
  width: 12px;
  height: 12px;
  border-radius: 3px;
}

.dash-donut-legend__name {
  font-weight: 600;
}

.dash-donut-legend__meta {
  color: var(--ib-on-surface-muted);
  font-variant-numeric: tabular-nums;
}

.dash-donut-legend__meta em {
  font-style: normal;
  opacity: 0.75;
}

.dash-donut-empty {
  min-height: 140px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ib-on-surface-muted);
  font-size: var(--ib-text-sm);
}

.dash-pipeline-split {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 1.25rem;
  align-items: center;
}

@media (max-width: 720px) {
  .dash-pipeline-split {
    grid-template-columns: 1fr;
  }
}

.dash-section {
  margin-bottom: 2rem;
}

.dash-section__title {
  font-size: var(--ib-text-lg);
  font-weight: 700;
  color: var(--ib-on-surface);
  margin: 0 0 1rem;
}

.dash-grid-2 {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
}

.dash-donut { display: flex; align-items: center; gap: 1.5rem; flex-wrap: wrap; }
.dash-donut__svg { flex-shrink: 0; }
.dash-donut__legend { display: flex; flex-direction: column; gap: 0.5rem; }
.dash-donut__legend-item { display: flex; align-items: center; gap: 0.5rem; font-size: var(--ib-text-sm); color: var(--ib-on-surface-muted); }
.dash-donut__swatch { width: 12px; height: 12px; border-radius: 3px; flex-shrink: 0; }

.dash-bars { display: flex; align-items: flex-end; gap: 0.5rem; height: 160px; padding-top: 1rem; }
.dash-bars__col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 0.35rem; }
.dash-bars__bar { width: 100%; max-width: 48px; border-radius: 6px 6px 0 0; background: var(--ib-primary); transition: height 0.4s ease; min-height: 4px; }
.dash-bars__label { font-size: 10px; color: var(--ib-on-surface-muted); text-align: center; }

.dash-analytics { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }

.dash-home { padding: 0; }
.dash-home__welcome { margin-bottom: 1.5rem; }
.dash-home__welcome h2 { font-size: var(--ib-text-xl); font-weight: 700; color: var(--ib-on-surface); margin: 0 0 0.5rem; }
.dash-home__welcome p { color: var(--ib-on-surface-muted); margin: 0; line-height: 1.6; }

.dash-metrics-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--ib-primary);
  font-size: var(--ib-text-sm);
  font-weight: 600;
  text-decoration: none;
}

.dash-metrics-link:hover { text-decoration: underline; color: var(--ib-primary-dark); }

/* Owner metrics detail */
.dash-metrics {
  max-width: 48rem;
}

.dash-metrics__back {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin-bottom: 1.5rem;
  padding: 0;
  border: none;
  background: none;
  font-size: var(--ib-text-sm);
  font-weight: 600;
  color: var(--ib-on-surface-muted);
  cursor: pointer;
}

.dash-metrics__back:hover {
  color: var(--ib-primary);
}

.dash-metrics__header {
  margin-bottom: 2rem;
}

.dash-metrics__section {
  margin-bottom: 2rem;
  padding: 1.5rem;
  background: var(--ib-surface-card);
  border: 1px solid var(--ib-outline-light);
  border-radius: var(--ib-radius-lg);
  box-shadow: var(--ib-shadow);
}

.dash-metrics__h2 {
  margin: 0 0 0.75rem;
  font-size: var(--ib-text-lg);
  font-weight: 700;
  color: var(--ib-on-surface);
}

.dash-metrics__sub {
  margin: 0 0 1rem;
  font-size: var(--ib-text-sm);
  color: var(--ib-on-surface-muted);
  line-height: 1.6;
}

.dash-metrics__stats {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.dash-metrics__stat-row {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 1rem;
  border: 1px solid var(--ib-outline-light);
  border-radius: var(--ib-radius);
  background: var(--ib-surface);
}

@media (min-width: 640px) {
  .dash-metrics__stat-row {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
}

.dash-metrics__stat-label {
  margin: 0;
  font-weight: 600;
  color: var(--ib-on-surface);
}

.dash-metrics__stat-help {
  margin: 0.15rem 0 0;
  font-size: var(--ib-text-xs);
  color: var(--ib-on-surface-muted);
}

.dash-metrics__stat-value {
  margin: 0;
  font-size: var(--ib-text-xl);
  font-weight: 800;
  color: var(--ib-on-surface);
  font-variant-numeric: tabular-nums;
}

.dash-metrics__empty-box {
  padding: 1.25rem;
  border-radius: var(--ib-radius);
  background: var(--ib-surface);
  text-align: center;
  font-size: var(--ib-text-sm);
  color: var(--ib-on-surface-muted);
}

@media (max-width: 920px) {
  .admin-data-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .dash-overview {
    padding-top: 0.75rem;
  }

  .admin-summary-panel,
  .admin-data-card {
    padding: 0.9rem;
  }

  .admin-meter-row,
  .admin-list-row {
    flex-direction: column;
    align-items: stretch;
  }

  .admin-list-row__meta {
    justify-content: flex-start;
  }

  .admin-meter {
    width: 100%;
  }

  .admin-action {
    min-height: auto;
  }
}
