/*
 * Usage Dashboard module - styles.
 *
 * Fully self-contained: every rule is scoped under .usage-dash, so this
 * file can be dropped into any other project without colliding with that
 * project's own CSS. Reads a small set of CSS variables (--surface,
 * --border, --text, --text-dim, --bg, --red) if the host page defines
 * them (ClipQuery already does); falls back to sane defaults otherwise so
 * it still looks reasonable in a page that doesn't define them.
 */

.usage-dash {
  --ud-accent: var(--red, #e64536);
  --ud-surface: var(--surface, #fff);
  --ud-border: var(--border, #e5e5e5);
  --ud-text: var(--text, #1a1a1a);
  --ud-text-dim: var(--text-dim, #767676);
  --ud-bg: var(--bg, #f7f7f7);
  font-size: 12.5px;
  color: var(--ud-text);
}

.usage-dash-empty {
  padding: 14px 0;
  color: var(--ud-text-dim);
}

.usage-dash-model {
  border: 1px solid var(--ud-border);
  border-radius: 10px;
  margin-bottom: 10px;
  overflow: hidden;
  background: var(--ud-surface);
}

.usage-dash-model-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  cursor: pointer;
  user-select: none;
}

.usage-dash-model-head:hover {
  background: var(--ud-bg);
}

.usage-dash-model-name {
  font-weight: 700;
  font-size: 12.5px;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.usage-dash-model-count {
  font-size: 11.5px;
  color: var(--ud-text-dim);
  flex: none;
}

.usage-dash-health {
  flex: none;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .02em;
  padding: 2px 7px;
  border-radius: 99px;
  cursor: default;
}

.usage-dash-health.ok {
  color: #16a34a;
  background: rgba(22, 163, 74, .12);
}

.usage-dash-health.failed {
  color: #dc2626;
  background: rgba(220, 38, 38, .14);
}

.usage-dash-health.pending {
  color: var(--ud-text-dim);
  background: var(--ud-bg);
}

.usage-dash-failure {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 14px 10px;
  padding: 8px 10px;
  border-radius: 8px;
  background: rgba(220, 38, 38, .08);
}

.usage-dash-failure-detail {
  flex: 1;
  min-width: 0;
  font-size: 11.5px;
  color: #dc2626;
  word-break: break-word;
}

.usage-dash-recheck-btn {
  flex: none;
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 99px;
  border: 1px solid #dc2626;
  background: transparent;
  color: #dc2626;
  cursor: pointer;
}

.usage-dash-recheck-btn:hover {
  background: rgba(220, 38, 38, .1);
}

.usage-dash-recheck-btn:disabled {
  opacity: .6;
  cursor: default;
}

.usage-dash-arrow {
  flex: none;
  transition: transform .15s ease;
  color: var(--ud-text-dim);
}

.usage-dash-model.open .usage-dash-arrow {
  transform: rotate(90deg);
}

.usage-dash-track {
  height: 5px;
  background: var(--ud-bg);
  border-radius: 3px;
  overflow: hidden;
  margin: 0 14px 12px;
}

.usage-dash-fill {
  height: 100%;
  background: var(--ud-accent);
  border-radius: 3px;
}

.usage-dash-body {
  display: none;
  padding: 4px 14px 16px;
  border-top: 1px solid var(--ud-border);
}

.usage-dash-model.open .usage-dash-body {
  display: block;
}

.usage-dash-detail {
  display: flex;
  gap: 20px;
  align-items: flex-start;
  flex-wrap: wrap;
  padding-top: 12px;
}

.usage-dash-pie {
  flex: none;
  width: 130px;
  height: 130px;
}

.usage-dash-legend {
  flex: 1;
  min-width: 180px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.usage-dash-legend-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 6px;
  border-radius: 6px;
  cursor: pointer;
}

.usage-dash-legend-row:hover {
  background: var(--ud-bg);
}

.usage-dash-legend-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex: none;
}

.usage-dash-legend-label {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.usage-dash-legend-value {
  flex: none;
  color: var(--ud-text-dim);
  font-variant-numeric: tabular-nums;
}
