/* Shared UI components: cards, badges, stats, progress, sections, tables, range pickers */

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.4rem;
}

.page-subtitle,
.section-note,
.muted,
.refresh-indicator,
.chart-note,
.card-note {
  color: var(--text2);
}

.page-subtitle,
.section-note,
.chart-note,
.card-note,
.muted {
  font-size: 0.9rem;
}

.refresh-indicator {
  font-size: 0.8rem;
  white-space: nowrap;
}

.section {
  margin-bottom: 2rem;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.75rem;
}

.section-head-controls {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.range-picker {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.range-option {
  padding: 0.35rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text2);
  background: var(--surface);
  font-size: 0.85rem;
  text-decoration: none;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}

.range-option:hover,
.range-option-active {
  color: var(--text);
  border-color: var(--accent);
  background: var(--accent-soft);
}

.range-custom {
  display: inline-flex;
}

.range-custom-input {
  outline: none;
  text-decoration: none;
}

.range-custom-input:focus {
  border-color: var(--accent);
}

.card,
.stat-card,
table {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.card {
  padding: 1rem 1.25rem;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.85rem;
}

.card-title {
  font-size: 1rem;
  font-weight: 600;
}

.card-note {
  margin-top: 0.6rem;
}

.card-table {
  margin: 0.9rem 0;
}

.error-card {
  margin-bottom: 0.75rem;
  padding: 1rem;
  border: 1px solid var(--red);
  border-radius: var(--radius);
  background: #1c0f0f;
  color: var(--red);
}

.badge,
.plan-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
}

.badge-ok,
.plan-badge {
  background: var(--accent-soft);
  color: var(--accent);
}

.badge-warn {
  background: var(--orange-soft);
  color: var(--orange);
}

.stat-card {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 1rem;
}

.stat-card-label {
  color: var(--text2);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.stat-card-value {
  font-size: 1.35rem;
  font-variant-numeric: tabular-nums;
}

.stat-card-hint {
  color: var(--text2);
  font-size: 0.85rem;
}

.stat-card-good {
  border-color: rgba(63, 185, 80, 0.35);
}

.stat-card-warn {
  border-color: rgba(210, 153, 34, 0.35);
}

.stat-card-bad {
  border-color: rgba(248, 81, 73, 0.35);
}

.stat-card-muted,
.stat-card-info {
  border-color: var(--border);
}

.quota-details {
  display: flex;
  flex-direction: column;
  gap: 0.42rem;
}

.stat-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.15rem 0;
}

.stat-label {
  color: var(--text2);
  font-size: 0.85rem;
}

.stat-value {
  font-size: 0.95rem;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.stat-value.highlight {
  color: var(--accent);
  font-weight: 700;
}

.progress-bar {
  height: 8px;
  margin-top: 0.8rem;
  overflow: hidden;
  background: var(--border);
  border-radius: 999px;
}

.progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 999px;
  transition: width 0.3s;
  width: var(--w, 0%);
}

.progress-warn {
  background: var(--orange);
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  overflow: hidden;
}

th {
  padding: 0.65rem 0.75rem;
  background: var(--border);
  color: var(--text2);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-align: left;
  text-transform: uppercase;
}

td {
  padding: 0.58rem 0.75rem;
  border-top: 1px solid var(--border);
  font-size: 0.92rem;
  font-variant-numeric: tabular-nums;
}

tr:hover td {
  background: rgba(88, 166, 255, 0.04);
}

@media (max-width: 760px) {
  .page-header,
  .section-head {
    flex-direction: column;
    align-items: flex-start;
  }

  .range-picker {
    width: 100%;
  }

  .section-head-controls {
    width: 100%;
    flex-direction: column;
    align-items: flex-start;
  }
}
