/* ── Static dashboard widgets ────────────────────────────────────────────── */

.admin-metrics-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  margin-bottom: 14px;
}

.admin-metrics-section {
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  box-shadow: var(--shadow-sm);
  padding: 16px;
}

.project-metrics-dashboard {
  margin-bottom: 14px;
}

.project-metric-hero {
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  box-shadow: var(--shadow-sm);
  display: flex;
  gap: 16px;
  justify-content: space-between;
  margin-bottom: 14px;
  padding: 16px;
}

.project-metric-hero h3 {
  font-size: 20px;
  line-height: 1.2;
  margin: 3px 0 5px;
}

.project-metric-hero p {
  color: var(--text-dim);
  font-size: 13px;
  margin: 0;
}

.project-metric-hero.error { border-color: rgba(239, 68, 68, .35); }
.project-metric-hero.running { border-color: rgba(14, 165, 233, .35); }
.project-metric-hero.review,
.project-metric-hero.ready { border-color: rgba(245, 158, 11, .35); }

.project-metric-kicker {
  color: var(--text-dim);
  font-size: 12px;
  font-weight: 650;
  text-transform: uppercase;
}

.project-metric-score {
  background: var(--surface2);
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  min-width: 116px;
  padding: 10px;
  text-align: center;
}

.project-metric-score span {
  display: block;
  font-size: 28px;
  font-weight: 750;
}

.project-metric-score small {
  color: var(--text-dim);
  font-size: 12px;
}

.project-metric-card-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.project-metric-card {
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  box-shadow: var(--shadow-sm);
  min-width: 0;
  padding: 14px;
}

.project-metric-card.wide {
  grid-column: span 2;
}

.project-metric-card.danger {
  border-color: rgba(239, 68, 68, .28);
}

.project-metric-card-head {
  align-items: flex-start;
  display: flex;
  gap: 10px;
  justify-content: space-between;
  margin-bottom: 12px;
}

.project-metric-card-head h3 {
  font-size: 15px;
  line-height: 1.25;
  margin: 0;
}

.project-metric-card-head span {
  color: var(--text-dim);
  font-size: 12px;
  white-space: nowrap;
}

.project-metric-bars,
.project-metric-category-list,
.project-metric-issue-list {
  display: grid;
  gap: 8px;
}

.project-metric-bar-row,
.project-metric-category {
  align-items: center;
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(92px, 150px) minmax(80px, 1fr) 34px;
}

.project-metric-bar-row,
.project-metric-stage {
  color: inherit;
  cursor: pointer;
  font: inherit;
  text-align: left;
}

.project-metric-bar-row {
  background: transparent;
  border: 0;
  padding: 0;
}

.project-metric-bar-row:focus-visible,
.project-metric-stage:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.project-metric-bar-row:disabled,
.project-metric-stage:disabled {
  cursor: default;
  opacity: .62;
}

.project-metric-bar-label {
  color: var(--text);
  font-size: 13px;
}

.project-metric-bar-track {
  background: var(--surface2);
  border-radius: 999px;
  height: 9px;
  overflow: hidden;
}

.project-metric-bar-track span {
  background: var(--accent);
  border-radius: inherit;
  display: block;
  height: 100%;
}

.project-metric-bar-row.error .project-metric-bar-track span { background: var(--red); }
.project-metric-bar-row.running .project-metric-bar-track span { background: var(--accent); }
.project-metric-bar-row.review .project-metric-bar-track span,
.project-metric-bar-row.ready .project-metric-bar-track span { background: var(--yellow); }
.project-metric-bar-row.done .project-metric-bar-track span { background: var(--green); }

.project-metric-bar-row strong,
.project-metric-category b {
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.project-metric-pipeline {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.project-metric-stage {
  background: var(--surface2);
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  min-width: 0;
  padding: 10px;
}

.project-metric-stage span {
  color: var(--text-dim);
  display: block;
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.project-metric-stage strong {
  display: block;
  font-size: 22px;
  margin-top: 4px;
}

.project-metric-issue-row {
  align-items: center;
  border-top: 1px solid var(--border-soft);
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(0, 1fr) auto;
  padding-top: 8px;
}

.project-metric-issue {
  color: inherit;
  display: grid;
  gap: 2px;
  min-width: 0;
  text-decoration: none;
}

.project-metric-issue span,
.project-metric-issue-row > span,
.project-metric-more,
.project-metric-empty,
.project-metric-category span {
  color: var(--text-dim);
  font-size: 12px;
}

.project-metric-issue strong {
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.project-metric-empty {
  padding: 8px 0;
}

.project-metric-category > div:first-child {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.project-metric-category strong {
  font-size: 13px;
}

.project-metric-recommendations {
  color: var(--text);
  display: grid;
  gap: 8px;
  margin: 0;
  padding-left: 18px;
}

.project-metric-recommendations li {
  font-size: 13px;
  line-height: 1.45;
}

@media (max-width: 760px) {
  .project-metric-hero {
    align-items: stretch;
    flex-direction: column;
  }

  .project-metric-score {
    min-width: 0;
  }

  .project-metric-card.wide {
    grid-column: span 1;
  }

  .project-metric-pipeline {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .project-metric-bar-row,
  .project-metric-category {
    grid-template-columns: minmax(0, 1fr) 42px;
  }

  .project-metric-bar-row .project-metric-bar-track,
  .project-metric-category .project-metric-bar-track {
    grid-column: 1 / -1;
    grid-row: 2;
  }
}

#usage-summary-widget {
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  box-shadow: var(--shadow-sm);
  margin: 0;
  padding: 16px;
}

#usage-summary-widget.admin-metrics-section {
  margin: 0;
}

#usage-summary-widget .usw-head {
  align-items: center;
  display: flex;
  gap: 12px;
  justify-content: space-between;
  margin-bottom: 12px;
}

#usage-summary-widget .usw-title {
  color: var(--text);
  font-size: 16px;
  font-weight: 650;
}

#usage-summary-widget .usw-periods {
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  display: inline-flex;
  overflow: hidden;
}

#usage-summary-widget button {
  background: transparent;
  border: 0;
  color: inherit;
  cursor: pointer;
  font: inherit;
  padding: 7px 11px;
}

#usage-summary-widget button.active {
  background: var(--accent-soft);
  font-weight: 650;
}

#usage-summary-widget table {
  border-collapse: collapse;
  font-size: 13px;
  width: 100%;
}

#usage-summary-widget th,
#usage-summary-widget td {
  border-top: 1px solid var(--border-soft);
  padding: 8px 6px;
  text-align: left;
  vertical-align: middle;
}

#usage-summary-widget th {
  color: var(--text-dim);
  font-size: 12px;
  font-weight: 650;
}

#usage-summary-widget .num {
  text-align: right;
  white-space: nowrap;
}

#usage-summary-widget .bar-cell {
  min-width: 150px;
  width: 28%;
}

#usage-summary-widget .bar {
  background: rgba(14, 165, 233, .18);
  border-radius: 999px;
  height: 8px;
  overflow: hidden;
}

#usage-summary-widget .bar span {
  background: var(--accent);
  border-radius: 999px;
  display: block;
  height: 100%;
}

#usage-summary-widget .mobile-label {
  display: none;
}

#usage-summary-widget .period {
  display: none;
}

#usage-summary-widget .empty,
#usage-summary-widget .error {
  color: var(--text-dim);
  font-size: 13px;
  padding: 12px 6px;
}

body.project-user-mode #usage-summary-widget {
  display: none;
}

body.project-user-mode #budget-alert-banner {
  display: none;
}

#budget-alert-banner {
  align-items: center;
  border-bottom: 1px solid transparent;
  box-sizing: border-box;
  display: none;
  flex: 0 0 100%;
  font-size: 13px;
  font-weight: 650;
  gap: 10px;
  line-height: 1.35;
  margin: 0;
  padding: 10px 16px;
  width: 100%;
}

#budget-alert-banner.warn {
  background: #fff7d6;
  border-color: #e2b93b;
  color: #5f4500;
  display: flex;
}

#budget-alert-banner.critical {
  background: #ffe1df;
  border-color: #d84b44;
  color: #7b1712;
  display: flex;
}

#budget-alert-banner .budget-dot {
  background: currentColor;
  border-radius: 999px;
  flex: 0 0 auto;
  height: 9px;
  width: 9px;
}

#budget-alert-banner .budget-text {
  min-width: 0;
}

.provider-recommendation-note {
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  color: inherit;
  font-size: 12px;
  line-height: 1.4;
  margin-top: 8px;
  max-width: 520px;
  padding: 9px 11px;
}

.provider-recommendation-note strong {
  font-weight: 650;
}

.provider-recommendation-note.warn {
  background: #fff7e6;
  border-color: #c77800;
  color: #5f3700;
}

.provider-recommendation-note.error {
  background: #fff1f0;
  border-color: #b42318;
  color: #7a1d15;
}

.provider-recommendation-note .muted {
  opacity: .72;
}
