.aggregation-health-card {
  margin-bottom: 1rem;
  overflow: hidden;
}
.aggregation-health-heading,
.aggregation-health-main,
.aggregation-health-actions,
.aggregation-health-meta,
.health-list-heading {
  display: flex;
  align-items: center;
  gap: .75rem;
  flex-wrap: wrap;
}
.aggregation-health-heading {
  justify-content: space-between;
  margin-bottom: .8rem;
}
.aggregation-health-heading h2,
.health-panel h3 { margin: 0; }
.aggregation-health-main {
  align-items: stretch;
  padding: 1rem;
  border: 1px solid var(--border, #dbe3ee);
  border-radius: .9rem;
  background: var(--surface-soft, #f4f7fb);
}
.aggregation-health-score {
  display: grid;
  place-content: center;
  min-width: 10rem;
  padding: 1rem;
  text-align: center;
  border-radius: .8rem;
  background: var(--surface, #fff);
}
.aggregation-health-score strong {
  font-size: clamp(2.4rem, 6vw, 4rem);
  line-height: 1;
}
.health-status-badge,
.health-importance {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  width: fit-content;
  padding: .25rem .55rem;
  border-radius: 999px;
  font-weight: 750;
}
.health-status-badge::before {
  content: "";
  width: .55rem;
  height: .55rem;
  border-radius: 50%;
  background: currentColor;
}
.health-status-badge.synchronized { color: #166534; background: #dcfce7; }
.health-status-badge.attention { color: #92400e; background: #fef3c7; }
.health-status-badge.critical { color: #991b1b; background: #fee2e2; }
.health-status-badge.disabled { color: #334155; background: #e2e8f0; }
.aggregation-health-summary {
  flex: 1 1 24rem;
  display: grid;
  align-content: center;
  gap: .55rem;
}
.aggregation-health-summary p { margin: 0; }
.aggregation-health-meta { color: var(--muted, #64748b); }
.aggregation-health-meta span { white-space: nowrap; }
.aggregation-health-actions { margin-top: .2rem; }
.aggregation-health-actions button[disabled] { cursor: wait; }
.aggregation-health-kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: .65rem;
  margin: .8rem 0;
}
.health-kpi {
  min-width: 0;
  padding: .7rem;
  border: 1px solid var(--border, #dbe3ee);
  border-radius: .7rem;
  background: var(--surface, #fff);
}
.health-kpi span,
.health-kpi small { display: block; color: var(--muted, #64748b); }
.health-kpi strong { display: block; margin: .2rem 0; font-size: 1.35rem; }
.aggregation-health-panels {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .75rem;
}
.health-panel {
  min-width: 0;
  padding: .8rem;
  border: 1px solid var(--border, #dbe3ee);
  border-radius: .8rem;
}
.health-list {
  display: grid;
  gap: .55rem;
  margin: .65rem 0 0;
  padding: 0;
  list-style: none;
}
.health-list > li {
  padding: .65rem;
  border-radius: .65rem;
  background: var(--surface-soft, #f4f7fb);
}
.health-list-heading { justify-content: space-between; }
.health-list p { margin: .25rem 0 0; }
.health-list small { color: var(--muted, #64748b); }
.health-empty { color: var(--muted, #64748b); }
.health-importance.critical { color: #991b1b; background: #fee2e2; }
.health-importance.high { color: #9a3412; background: #ffedd5; }
.health-importance.medium { color: #92400e; background: #fef3c7; }
.health-importance.low { color: #075985; background: #e0f2fe; }
.aggregation-health-card[aria-busy="true"] {
  opacity: .72;
}
.health-score-dialog {
  width: min(680px, calc(100vw - 2rem));
  max-height: calc(100vh - 2rem);
  overflow: auto;
  border: 0;
  border-radius: 1rem;
  padding: 1rem;
}
.health-score-dialog::backdrop { background: rgb(15 23 42 / .55); }
.health-score-dialog .dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
}
.health-score-penalties {
  display: grid;
  gap: .45rem;
  padding: 0;
  list-style: none;
}
.health-score-penalties li {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: .15rem .75rem;
  padding: .65rem;
  border-radius: .65rem;
  background: var(--surface-soft, #f4f7fb);
}
.health-score-penalties small { grid-column: 1 / -1; color: var(--muted, #64748b); }
.health-score-final { font-size: 1.15rem; }
@media (max-width: 980px) {
  .aggregation-health-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 700px) {
  .aggregation-health-main { padding: .7rem; }
  .aggregation-health-score { min-width: 100%; }
  .aggregation-health-panels { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
  .aggregation-health-kpis { grid-template-columns: 1fr; }
  .aggregation-health-actions > * { width: 100%; }
}
body.ui-compact .aggregation-health-card { margin-bottom: .5rem; }
body.ui-compact .aggregation-health-heading { margin-bottom: .4rem; }
body.ui-compact .aggregation-health-main,
body.ui-compact .health-panel { padding: .5rem; }
body.ui-compact .aggregation-health-score { padding: .55rem; }
body.ui-compact .aggregation-health-kpis { gap: .35rem; margin: .4rem 0; }
body.ui-compact .health-kpi { padding: .4rem .5rem; }
body.ui-compact .aggregation-health-panels { gap: .4rem; }
body.ui-compact .health-list { gap: .3rem; margin-top: .35rem; }
body.ui-compact .health-list > li { padding: .4rem .5rem; }
body.ui-compact .health-score-dialog { padding: .65rem; }
.smart-rebuild-dialog {
  width: min(980px, calc(100vw - 2rem));
  max-width: 100%;
  max-height: calc(100vh - 2rem);
  overflow: auto;
  border: 0;
  border-radius: 1rem;
  padding: 1rem;
}
.smart-rebuild-confirm-dialog {
  width: min(620px, calc(100vw - 2rem));
  max-height: calc(100vh - 2rem);
  overflow: auto;
  border: 0;
  border-radius: 1rem;
  padding: 1rem;
}
.smart-rebuild-confirm-dialog::backdrop {
  background: rgb(15 23 42 / .65);
}
.smart-rebuild-confirm-dialog .dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
}
.smart-rebuild-confirm-summary,
.smart-rebuild-differences,
.smart-rebuild-execution,
.smart-rebuild-health-progress {
  display: grid;
  gap: .55rem;
  padding: .75rem;
  border: 1px solid var(--border, #dbe3ee);
  border-radius: .75rem;
}
.smart-rebuild-differences {
  margin-bottom: .7rem;
  color: #92400e;
  border-color: #fcd34d;
  background: #fffbeb;
}
.smart-rebuild-execution-panel { margin-top: .75rem; }
.smart-rebuild-execution.completed {
  border-color: #86efac;
  background: #f0fdf4;
}
.smart-rebuild-execution.failed {
  border-color: #fecaca;
  background: #fef2f2;
}
.smart-rebuild-health-progress {
  margin-top: .75rem;
  background: var(--surface-soft, #f4f7fb);
}
.smart-execution-error { color: #991b1b; }
.smart-rebuild-dialog::backdrop { background: rgb(15 23 42 / .58); }
.smart-rebuild-dialog .dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  position: sticky;
  top: -1rem;
  z-index: 2;
  padding: .5rem 0;
  background: var(--surface, #fff);
}
.smart-rebuild-dialog h2,
.smart-rebuild-dialog h3,
.smart-rebuild-dialog h4 { margin: 0; }
.smart-rebuild-content {
  display: grid;
  gap: .8rem;
  min-width: 0;
  overflow-wrap: anywhere;
}
.smart-rebuild-loader {
  min-height: 9rem;
  display: grid;
  place-items: center;
  color: var(--muted, #64748b);
}
.smart-rebuild-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: .55rem;
}
.smart-rebuild-summary > div,
.smart-rebuild-interval,
.smart-rebuild-notes,
.smart-rebuild-empty {
  padding: .75rem;
  border: 1px solid var(--border, #dbe3ee);
  border-radius: .75rem;
  background: var(--surface-soft, #f4f7fb);
}
.smart-rebuild-summary span,
.smart-rebuild-summary strong { display: block; }
.smart-rebuild-summary span { color: var(--muted, #64748b); }
.smart-rebuild-intervals { display: grid; gap: .7rem; }
.smart-rebuild-interval {
  display: grid;
  gap: .6rem;
  min-width: 0;
}
.smart-rebuild-interval > header,
.smart-rebuild-facts {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: .55rem;
}
.smart-rebuild-interval > header { justify-content: space-between; }
.smart-rebuild-interval p,
.smart-rebuild-interval ul { margin: 0; }
.smart-rebuild-interval section { display: grid; gap: .3rem; }
.smart-rebuild-facts span {
  padding: .35rem .5rem;
  border-radius: .5rem;
  background: var(--surface, #fff);
}
.smart-conflict {
  padding: .25rem .55rem;
  border-radius: 999px;
  font-weight: 700;
}
.smart-conflict.none { color: #166534; background: #dcfce7; }
.smart-conflict.fully_covered,
.smart-conflict.partially_covered,
.smart-conflict.overlapping { color: #92400e; background: #fef3c7; }
.smart-rebuild-notes.critical { color: #991b1b; border-color: #fecaca; }
.smart-rebuild-readonly {
  padding: .7rem;
  border-radius: .65rem;
  background: #e0f2fe;
  color: #075985;
  font-weight: 650;
}
body.ui-compact .smart-rebuild-dialog { padding: .6rem; }
body.ui-compact .smart-rebuild-confirm-dialog { padding: .6rem; }
body.ui-compact .smart-rebuild-summary,
body.ui-compact .smart-rebuild-intervals { gap: .35rem; }
body.ui-compact .smart-rebuild-summary > div,
body.ui-compact .smart-rebuild-interval,
body.ui-compact .smart-rebuild-notes { padding: .45rem .55rem; }
@media (max-width: 700px) {
  .smart-rebuild-dialog {
    width: calc(100vw - 1rem);
    max-height: calc(100vh - 1rem);
    padding: .7rem;
  }
  .smart-rebuild-confirm-dialog {
    width: calc(100vw - 1rem);
    max-height: calc(100vh - 1rem);
    padding: .7rem;
  }
  .smart-rebuild-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 440px) {
  .smart-rebuild-summary { grid-template-columns: 1fr; }
  .smart-rebuild-dialog .dialog-actions > * { width: 100%; }
}
