/* Custom on top of Tailwind CDN. Keep minimal — Tailwind utilities first. */

.tab-btn {
  padding: 0.4rem 0.9rem;
  border-radius: 0.375rem;
  color: #6b7280;
  font-weight: 500;
  border: 1px solid transparent;
  background: transparent;
  cursor: pointer;
  transition: all 0.15s;
}
.tab-btn:hover {
  background: #f3f4f6;
  color: #111827;
}
.tab-btn.tab-active {
  background: #1f2937;
  color: white;
  border-color: #1f2937;
}

/* Make tabular numeric data align cleanly */
.tabular { font-variant-numeric: tabular-nums; }

/* Color-coded api_status pills */
.pill {
  display: inline-block;
  padding: 0.1rem 0.5rem;
  border-radius: 9999px;
  font-size: 0.7rem;
  font-weight: 600;
  white-space: nowrap;
}
.pill-success         { background: #d1fae5; color: #065f46; }
.pill-failed          { background: #fee2e2; color: #991b1b; }
.pill-skipped         { background: #e5e7eb; color: #374151; }
.pill-skipped-dryrun  { background: #fef3c7; color: #92400e; }

/* Decision pills */
.dec-PAUSE      { background: #fee2e2; color: #991b1b; }
.dec-ACTIVATE   { background: #d1fae5; color: #065f46; }
.dec-SET_BUDGET { background: #dbeafe; color: #1e40af; }

/* Hover tooltips on pills (pure CSS, no JS) — shows Chinese description
 * above the pill. Wrapping allowed so long phrases don't overflow.
 */
.pill[data-tooltip] {
  position: relative;
  cursor: help;
}
.pill[data-tooltip]:hover::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: #1f2937;
  color: white;
  padding: 0.45rem 0.7rem;
  border-radius: 0.3rem;
  font-size: 0.75rem;
  font-weight: 500;
  white-space: normal;
  width: max-content;
  max-width: 280px;
  line-height: 1.4;
  text-align: center;
  z-index: 50;
  pointer-events: none;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}
.pill[data-tooltip]:hover::before {
  content: "";
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-top-color: #1f2937;
  z-index: 50;
  pointer-events: none;
}

/* Bar chart cells in breakdown tables */
.bar-cell {
  position: relative;
  background: #f9fafb;
  border-radius: 0.25rem;
  overflow: hidden;
}
.bar-fill {
  position: absolute;
  inset: 0 auto 0 0;
  background: #e0e7ff;
}
.bar-fill-failed { background: #fecaca; }
.bar-content {
  position: relative;
  padding: 0.25rem 0.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
}

/* Tables shared */
.data-table {
  width: 100%;
  font-size: 0.85rem;
  border-collapse: collapse;
}
.data-table th {
  text-align: left;
  color: #6b7280;
  font-weight: 500;
  border-bottom: 1px solid #e5e7eb;
  padding: 0.5rem;
}
.data-table td {
  padding: 0.5rem;
  border-bottom: 1px solid #f3f4f6;
  vertical-align: top;
}
.data-table tr:hover td { background: #fafafa; }

.timeline-row {
  padding: 0.75rem 1rem;
  border-left: 3px solid #e5e7eb;
  background: white;
  margin-bottom: 0.5rem;
  border-radius: 0 0.375rem 0.375rem 0;
}
.timeline-row.tl-failed   { border-left-color: #dc2626; background: #fef2f2; }
.timeline-row.tl-success  { border-left-color: #16a34a; }
.timeline-row.tl-skipped  { border-left-color: #9ca3af; }

.kv-table {
  font-size: 0.75rem;
  margin-top: 0.25rem;
}
.kv-table td:first-child {
  color: #6b7280;
  padding-right: 0.75rem;
  white-space: nowrap;
}
.kv-table code {
  background: #f3f4f6;
  padding: 0 0.25rem;
  border-radius: 0.2rem;
  font-size: 0.85em;
}
