/* Componentes compartidos de las páginas de contenido (Inventario, Cambios,
   FinOps). Asume que blueprint/style.css ya cargó las variables de marca,
   el topbar, el nav drawer y los botones. */

.page {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  max-width: 1280px;
  width: 100%;
  margin: 0 auto;
}

.page-title {
  font-size: 22px;
  font-weight: 700;
  margin: 0 0 4px;
}

.page-subtitle {
  color: var(--text-secondary);
  font-size: 13px;
  margin: 0 0 22px;
}

.cards {
  display: grid;
  gap: 14px;
  margin-bottom: 14px;
}

.cards-4 {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.cards-2 {
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
}

.card {
  background: var(--bg-carbon);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px;
  min-width: 0;
}

.card-title {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-secondary);
  margin: 0 0 14px;
}

/* Stat tiles — contrato del skill de dataviz: label · value · delta */
.stat-label {
  font-size: 12px;
  color: var(--text-secondary);
  margin: 0 0 6px;
}

.stat-value {
  font-size: 30px;
  font-weight: 600;
  margin: 0;
}

.stat-value.stat-hero {
  font-size: 42px;
}

.stat-delta {
  font-size: 12px;
  margin-top: 6px;
  color: var(--text-secondary);
}

.stat-delta.delta-good { color: #6ef7d9; }
.stat-delta.delta-bad { color: #e66767; }

/* Badges con tono — estado nunca solo con color: siempre llevan texto */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  white-space: nowrap;
}

.badge-good { color: #6ef7d9; border-color: rgba(110, 247, 217, 0.35); }
.badge-warn { color: #f2b84b; border-color: rgba(242, 184, 75, 0.35); }
.badge-bad { color: #e66767; border-color: rgba(230, 103, 103, 0.35); }
.badge-neutral { color: var(--text-secondary); }

/* Tablas */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.data-table th {
  text-align: left;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
  font-weight: 600;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.data-table td {
  padding: 9px 10px;
  border-bottom: 1px solid rgba(245, 245, 245, 0.05);
  vertical-align: middle;
}

.data-table tbody tr:hover {
  background: rgba(77, 124, 254, 0.06);
}

.data-table .num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.row-clickable { cursor: pointer; }

/* Filtros — una sola fila encima del contenido */
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 16px;
  align-items: center;
}

.filters input[type="search"],
.filters select {
  background: var(--bg-graphite);
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 13px;
  font-family: inherit;
}

.filters input[type="search"] { min-width: 220px; }

.filters input[type="search"]:focus,
.filters select:focus {
  outline: none;
  border-color: var(--accent);
}

.filters label.check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
}

/* Barras horizontales (magnitud, un solo hue — la identidad va en el label) */
.hbar-row {
  display: grid;
  grid-template-columns: minmax(110px, 200px) 1fr 90px;
  gap: 10px;
  align-items: center;
  padding: 5px 0;
  font-size: 13px;
}

.hbar-name {
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hbar-track { min-width: 0; }

.hbar-fill {
  height: 14px;
  background: var(--accent);
  border-radius: 0 4px 4px 0;
  min-width: 2px;
}

.hbar-value {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* Leyenda de series */
.legend {
  display: flex;
  gap: 16px;
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 10px;
}

.legend .key {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.legend .swatch {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  display: inline-block;
}

/* Tooltip de hover para charts */
.chart-tooltip {
  position: fixed;
  pointer-events: none;
  background: var(--bg-graphite);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 12px;
  color: var(--text-primary);
  z-index: 90;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  display: none;
  white-space: nowrap;
}

/* Panel lateral de detalle (mismo look del panel del Blueprint) */
.detail-panel {
  position: fixed;
  top: 76px;
  right: 16px;
  bottom: 16px;
  width: min(400px, calc(100vw - 32px));
  background: var(--bg-carbon);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 60;
  transition: transform 0.25s ease, opacity 0.25s ease;
}

.detail-panel-hidden {
  transform: translateX(16px);
  opacity: 0;
  pointer-events: none;
}

.detail-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
}

.detail-body {
  padding: 16px;
  overflow-y: auto;
  font-size: 13px;
  color: var(--text-secondary);
}

.detail-body dt {
  color: var(--text-secondary);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-top: 12px;
}

.detail-body dt:first-child { margin-top: 0; }

.detail-body dd {
  margin: 4px 0 0;
  color: var(--text-primary);
  word-break: break-word;
}

.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-secondary);
  font-size: 14px;
}

.empty-state .btn { margin-top: 14px; }

.muted { color: var(--text-secondary); }

.section-gap { margin-top: 22px; }
