#dashboardViewLinks {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1px;
}

#dashboardViewsNav [hidden],
#dashboardViewSection [hidden],
#dashboardViewEditor [hidden] {
  display: none;
}

#dashboardViewSection {
  min-width: 0;
}

#dashboardViewSection > .section-heading {
  min-height: 0;
  align-items: center;
  flex-direction: row;
  margin-bottom: 1.35rem;
  padding: 0;
  border: 0;
  box-shadow: none;
  background: none;
}

#dashboardViewTitle {
  margin: 0;
  font-size: clamp(1.4rem, 3vw, 1.8rem);
  letter-spacing: -.045em;
  overflow-wrap: anywhere;
}

#btnEditDashboardView {
  flex: none;
}

.dashboard-view-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 23rem), 1fr));
  gap: 1rem;
}

.dashboard-view-widget-slot {
  display: grid;
  min-width: 0;
}

.custom-dashboard-widget {
  min-width: 0;
  container-type: inline-size;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--surface);
}

.custom-dashboard-widget-header {
  display: flex;
  align-items: center;
  gap: .55rem;
  padding: .85rem 1rem;
  border-bottom: 1px solid var(--line);
}

.custom-dashboard-widget-header i {
  color: var(--text-subtle);
  font-size: .85rem;
}

.custom-dashboard-widget-header h3 {
  color: var(--text);
  font-size: .95rem;
  font-weight: 700;
}

.custom-dashboard-widget-empty {
  padding: 1rem;
  color: var(--text-muted);
  font-size: .85rem;
}

.custom-dashboard-widget-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  background: var(--line);
  overflow: hidden;
  border-radius: 0 0 var(--r-lg) var(--r-lg);
}

.custom-dashboard-widget-metrics > div {
  display: grid;
  gap: .3rem;
  padding: .75rem .9rem;
  background: var(--surface);
}

.custom-dashboard-widget-metrics dt {
  color: var(--text-muted);
  font-size: .8rem;
}

.custom-dashboard-widget-metrics dd {
  color: var(--text);
  font: 500 1.55rem/1.15 var(--font-mono);
  letter-spacing: -.04em;
}

.custom-dashboard-widget-list {
  display: grid;
  gap: .35rem;
  max-block-size: 25rem;
  overflow: auto;
  padding: .45rem;
  scrollbar-width: thin;
}

.custom-dashboard-widget-list .attention-row {
  min-height: 2.75rem;
  padding: .55rem .6rem;
  font-size: .83rem;
}

.custom-dashboard-monitor-name {
  display: grid;
  flex: 1 1 auto;
  gap: .12rem;
  min-width: 0;
  overflow-wrap: anywhere;
}

.custom-dashboard-monitor-name small {
  margin-inline-start: 0;
  color: var(--text-muted);
}

.custom-dashboard-widget-list .dash-status,
.custom-dashboard-monitor-latency {
  white-space: nowrap;
}

.custom-dashboard-widget-list .attention-row > small {
  font: 400 .74rem/1.3 var(--font-mono);
}

.custom-dashboard-monitor-row .dash-status {
  margin-inline-start: auto;
}

.custom-dashboard-widget-list .attention-row > span:not(.dash-status) {
  overflow-wrap: anywhere;
}

#dashboardViewEditor {
  width: min(calc(100% - 1.5rem), 40rem);
  max-height: calc(100dvh - 1.5rem);
  margin: auto;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-lg);
  color: var(--text);
  background: var(--surface-raised);
  box-shadow: var(--shadow-lg);
}

#dashboardViewEditor::backdrop {
  background: var(--scrim);
}

#dashboardViewForm {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  max-height: inherit;
}

.dashboard-view-editor-header,
.dashboard-view-editor-body,
.dashboard-view-editor-footer {
  padding: .95rem 1.15rem;
}

.dashboard-view-editor-header {
  border-bottom: 1px solid var(--line);
}

.dashboard-view-editor-header h2 {
  font-size: 1.18rem;
}

.dashboard-view-editor-header p {
  margin-top: .2rem;
  color: var(--text-muted);
  font-size: .83rem;
}

.dashboard-view-editor-body,
#dashboardViewEditorWidgets {
  display: grid;
  gap: 1rem;
}

.dashboard-view-editor-body {
  overflow: auto;
  scrollbar-width: thin;
}

#dashboardViewEditorWidgets:empty {
  display: none;
}

.dashboard-view-editor-widget {
  min-width: 0;
  padding: .55rem .75rem .75rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
}

.dashboard-view-editor-widget legend {
  max-width: 100%;
  padding-inline: .35rem;
  font-size: .86rem;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.dashboard-view-editor-widget legend i {
  margin-inline-end: .3rem;
  color: var(--text-subtle);
}

.dashboard-view-widget-order,
.dashboard-view-widget-add,
.dashboard-view-editor-actions {
  display: flex;
  gap: .45rem;
  align-items: center;
}

.dashboard-view-widget-order,
.dashboard-view-editor-actions {
  flex-wrap: wrap;
}

.dashboard-view-widget-order {
  justify-content: flex-end;
}

.dashboard-view-monitor-count {
  color: var(--text-muted);
  font-size: .8rem;
}

.dashboard-view-monitor-scope,
.dashboard-view-monitor-picker {
  display: grid;
  gap: .4rem;
  margin-top: .7rem;
}

.dashboard-view-monitor-scope select {
  max-width: 15rem;
}

.dashboard-view-widget-add > select {
  min-width: 0;
}

.dashboard-view-widget-add > button {
  flex: none;
}

.dashboard-view-monitor-options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 12rem), 1fr));
  gap: .2rem .5rem;
  max-block-size: 13rem;
  padding: .35rem;
  overflow: auto;
  scrollbar-width: thin;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--fill);
}

.dashboard-view-monitor-options > label {
  display: flex;
  align-items: flex-start;
  gap: .45rem;
  min-width: 0;
  padding: .4rem;
  border-radius: var(--r-sm);
  color: var(--text);
  cursor: pointer;
  overflow-wrap: anywhere;
}

.dashboard-view-monitor-options > label:is(:hover, :focus-within) {
  background: var(--fill-hover);
}

.dashboard-view-monitor-options small {
  display: block;
  color: var(--text-muted);
  font-weight: 400;
}

#dashboardViewForm input[type="checkbox"] {
  flex: none;
  margin-top: .17rem;
  accent-color: var(--brand);
}

.dashboard-view-editor-footer {
  border-top: 1px solid var(--line);
}

.dashboard-view-editor-actions {
  justify-content: flex-end;
}

#btnDeleteDashboardView {
  margin-inline-end: auto;
}

#dashboardViewError {
  color: var(--down-text);
  font-size: .85rem;
}

#dashboardViewError:not(:empty) {
  margin-bottom: .65rem;
}

#dashboardViewDeleteConfirm {
  padding: .7rem;
  border: 1px solid var(--down-soft);
  border-radius: var(--r-md);
  background: var(--fill-subtle);
}

#dashboardViewDeleteMessage {
  margin-bottom: .6rem;
  color: var(--text);
  font-size: .85rem;
  overflow-wrap: anywhere;
}

#dashboardViewForm:has(#dashboardViewDeleteConfirm:not([hidden])) .dashboard-view-editor-footer > .dashboard-view-editor-actions {
  display: none;
}

@container (max-width: 420px) {
  .custom-dashboard-widget-list .attention-row {
    gap: .35rem;
    padding-inline: .45rem;
  }
}

@container (max-width: 365px) {
  .custom-dashboard-widget-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@container (min-width: 48rem) {
  .custom-dashboard-widget-metrics {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }
}

@media (max-width: 420px) {
  .dashboard-view-editor-header,
  .dashboard-view-editor-body,
  .dashboard-view-editor-footer {
    padding-inline: .75rem;
  }

  .dashboard-view-editor-actions .btn {
    padding-inline: .65rem;
  }
}
