/* Shared detail modal for clickable top metrics. Kept intentionally plain. */
.rs-metric-card:is(button) {
  appearance: none;
  width: 100%;
  margin: 0;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.rs-metric-card[data-rs-metric-detail] { position: relative; }
.rs-metric-card[data-rs-metric-detail]::after {
  content: "";
  position: absolute;
  right: 12px;
  top: 12px;
  width: 6px;
  height: 6px;
  border-radius: var(--rst-ui-radius-round);
  background: var(--rst-state-info-text);
}

.rs-detail-dialog {
  width: min(760px,calc(100vw - 32px));
  max-height: min(760px,calc(100dvh - 42px));
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--rst-ui-text);
}
.rs-detail-dialog::backdrop { background: var(--rst-overlay-bg); }

.rs-detail-card {
  max-height: min(760px,calc(100dvh - 42px));
  display: grid;
  grid-template-rows: auto minmax(0,1fr) auto;
  overflow: hidden;
  border: 1px solid var(--rst-ui-line);
  border-radius: var(--rst-ui-radius-xl);
  background: var(--rst-ui-workspace-body);
  font-family: var(--rst-ui-font);
}

.rs-detail-head,
.rs-detail-footer {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  border-bottom: 1px solid var(--rst-ui-divider);
  background: var(--rst-ui-workspace-header);
}
.rs-detail-footer { justify-content: flex-end; border-top: 1px solid var(--rst-ui-divider); border-bottom: 0; }

.rs-detail-head > div { min-width: 0; flex: 1 1 auto; }
.rs-detail-head > div > span {
  display: block;
  color: var(--rst-ui-muted);
  font-size: 10px;
  font-weight: var(--rst-fw-bold);
  letter-spacing: .12em;
  text-transform: uppercase;
}
.rs-detail-head h2 { margin: 2px 0 0; color: var(--rst-ui-text); font-size: 20px; line-height: 1.05; font-weight: var(--rst-fw-display); }
.rs-detail-head p { margin: 4px 0 0; color: var(--rst-ui-muted); font-size: 12px; font-weight: var(--rst-fw-medium); }

.rs-detail-icon,
.rs-detail-close {
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  display: grid;
  place-items: center;
  border: 1px solid var(--rst-state-neutral-border);
  border-radius: var(--rst-ui-radius-md);
  background: var(--rst-state-neutral-bg);
  color: var(--rst-state-neutral-text);
}
.rs-detail-icon svg,
.rs-detail-close svg { width: 18px; height: 18px; }
.rs-detail-icon.is-success { border-color: var(--rst-state-success-border); background: var(--rst-state-success-bg); color: var(--rst-state-success-text); }
.rs-detail-icon.is-warning { border-color: var(--rst-state-warning-border); background: var(--rst-state-warning-bg); color: var(--rst-state-warning-text); }
.rs-detail-icon.is-danger { border-color: var(--rst-state-danger-border); background: var(--rst-state-danger-bg); color: var(--rst-state-danger-text); }
.rs-detail-icon.is-info { border-color: var(--rst-state-info-border); background: var(--rst-state-info-bg); color: var(--rst-state-info-text); }
.rs-detail-close { cursor: pointer; }
.rs-detail-close:hover { background: var(--rst-ui-section-row-hover); color: var(--rst-ui-text); }

.rs-detail-body {
  overflow: auto;
  display: grid;
  gap: 12px;
  padding: 14px;
}
.rs-detail-section {
  overflow: hidden;
  border: 1px solid var(--rst-ui-divider-soft);
  border-radius: var(--rst-ui-radius-lg);
  background: transparent;
}
.rs-detail-section header {
  min-height: 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--rst-ui-divider-soft);
}
.rs-detail-section h3 { margin: 0; color: var(--rst-ui-panel-title); font-size: 13px; font-weight: var(--rst-fw-bold); }
.rs-detail-section small { color: var(--rst-ui-muted); font-size: 11px; font-weight: var(--rst-fw-medium); }

.rs-detail-list { display: grid; }
.rs-detail-row {
  min-height: 50px;
  display: grid;
  grid-template-columns: 34px minmax(0,1fr) auto auto;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-top: 1px solid var(--rst-ui-divider-soft);
}
.rs-detail-row:first-child { border-top: 0; }
.rs-detail-row__copy { min-width: 0; display: grid; gap: 3px; }
.rs-detail-row :is(strong,small,b) { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.rs-detail-row strong { color: var(--rst-ui-text); font-size: 13px; font-weight: var(--rst-fw-bold); }
.rs-detail-row small { color: var(--rst-ui-muted); font-size: 11px; font-weight: var(--rst-fw-medium); }
.rs-detail-row b { color: var(--rst-ui-text); font-size: 12px; font-weight: var(--rst-fw-bold); }
.rs-detail-row__actions { display: flex; gap: 7px; justify-content: flex-end; }

.rs-detail-mini-btn {
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid var(--rst-ui-divider);
  border-radius: var(--rst-ui-radius-sm);
  background: transparent;
  color: var(--rst-ui-text);
  font: inherit;
  font-size: 11px;
  font-weight: var(--rst-fw-bold);
  cursor: pointer;
}
.rs-detail-mini-btn:hover,
.rs-detail-mini-btn.is-success { background: var(--rst-ui-section-row-hover); }

.rs-detail-empty,
.rs-detail-more {
  padding: 14px;
  color: var(--rst-ui-muted);
  font-size: 12px;
  font-weight: var(--rst-fw-medium);
}
.rs-detail-empty { min-height: 70px; display: grid; place-items: center; text-align: center; }
.rs-detail-empty svg { width: 18px; height: 18px; color: var(--rst-ui-muted); }
