/* =====================================================
   Sella Barómetro v2 - Estilos compartidos
   ===================================================== */

/* Widget pequeño Arriondas */
.sella-widget-arriondas {
  max-width: 460px;
  margin: 0 auto;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Inter, Helvetica, Arial, sans-serif;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  padding: 18px;
  box-sizing: border-box;
}

.sella-widget-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.sella-widget-title-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}

.sella-widget-title {
  font-weight: 800;
  color: #0f172a;
  line-height: 1;
}

.sella-widget-threshold {
  font-size: 12px;
  color: #64748b;
  line-height: 1.2;
}

.sella-widget-status {
  background: #e5e7eb;
  color: #374151;
  font-weight: 700;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 14px;
  white-space: nowrap;
}

.sella-widget-value-row {
  text-align: center;
  margin: 6px 0 4px 0;
}

.sella-widget-level {
  font-size: 54px;
  font-weight: 900;
  color: #0f172a;
  letter-spacing: 0.5px;
}

.sella-widget-unit {
  font-size: 22px;
  color: #0f172a;
  margin-left: 4px;
}

.sella-widget-meta {
  text-align: center;
  margin-bottom: 12px;
  color: #64748b;
  font-size: 14px;
}

.sella-widget-button {
  display: block;
  text-align: center;
  background: #3b82f6;
  color: #fff !important;
  font-weight: 700;
  padding: 14px 16px;
  border-radius: 12px;
  text-decoration: none !important;
}

.sella-widget-button:hover {
  background: #2563eb;
}

/* Tendencias compartidas */
.sella-trend {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  margin-left: 8px;
  border-radius: 999px;
  font-size: 24px;
  font-weight: 900;
  line-height: 1;
  vertical-align: middle;
  border: 1px solid transparent;
  box-sizing: border-box;
}

/* SUBIENDO = ROJO */
.sella-trend-up {
  color: #991b1b;
  background: #fee2e2;
  border-color: #fecaca;
}

/* BAJANDO = VERDE */
.sella-trend-down {
  color: #15803d;
  background: #dcfce7;
  border-color: #bbf7d0;
}

/* ESTABLE = GRIS */
.sella-trend-flat {
  color: #475569;
  background: #f1f5f9;
  border-color: #e2e8f0;
}

/* Medidor virtual completo */
.sella-medidor-virtual {
  max-width: 1100px;
  margin: 0 auto;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Inter, Helvetica, Arial, sans-serif;
}

.sella-meter-header {
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: space-between;
  margin: 8px 0 14px 0;
  flex-wrap: wrap;
}

.sella-meter-title {
  margin: 0;
  font-size: 28px;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 10px;
  color: #1f2937;
}

.sella-meter-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #334155;
  flex-wrap: wrap;
}

.sella-meter-controls select {
  padding: 6px 10px;
  border: 1px solid #CBD5E1;
  border-radius: 8px;
  min-width: 260px;
  background: #fff;
  color: #334155;
}

.sella-meter-cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
  margin: 12px 0 18px 0;
}

.sella-meter-card {
  position: relative;
  background: #F8FAFC;
  border: 1px solid #E2E8F0;
  border-radius: 14px;
  padding: 16px 18px;
  min-height: 138px;
  box-sizing: border-box;
}

.sella-meter-card-title {
  color: #334155;
  font-weight: 700;
  margin-bottom: 14px;
  font-size: 16px;
}

.sella-meter-card-value {
  font-size: 54px;
  line-height: 1.05;
  font-weight: 900;
  color: #0F172A;
  letter-spacing: -1px;
  padding-right: 48px;
  word-break: normal;
}

.sella-meter-card .sella-trend {
  position: absolute;
  right: 16px;
  bottom: 16px;
  width: 36px;
  height: 36px;
  font-size: 19px;
  margin-left: 0;
}

.sella-pill {
  display: inline-block;
  font-weight: 800;
  padding: 8px 14px;
  border-radius: 999px;
}

.sella-pill-ok { background: #DCFCE7; color: #15803D; }
.sella-pill-yellow { background: #FEF9C3; color: #854D0E; }
.sella-pill-orange { background: #FFEDD5; color: #9A3412; }
.sella-pill-red { background: #FEE2E2; color: #991B1B; }
.sella-pill-muted { background: #E5E7EB; color: #374151; }
.sella-pill-error { background: #FEE2E2; color: #991B1B; }

.sella-error {
  margin-top: 10px;
  color: #64748B;
  font-size: 13px;
  line-height: 1.35;
}

.sella-chart-box {
  background: #fff;
  border: 1px solid #E2E8F0;
  border-radius: 14px;
  padding: 14px;
}

.sella-meter-legend {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: #64748B;
  font-size: 15px;
  margin-top: 12px;
  gap: 10px;
  flex-wrap: wrap;
}

.legend-level-dot,
.legend-flow-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-right: 6px;
  vertical-align: middle;
}

.legend-level-dot { background: #3b82f6; }
.legend-flow-dot { background: #22c55e; }
.legend-flow-wrap { margin-left: 14px; }

.sella-section-title {
  margin: 18px 0 10px 0;
  font-size: 24px;
  color: #1f2937;
}

.sella-section-title-small {
  font-size: 22px;
}

.sella-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}

.sella-summary-title {
  font-weight: 800;
  color: #0F172A;
  margin-bottom: 10px;
}

.sella-mini-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.sella-mini {
  border: 1px solid #E2E8F0;
  border-radius: 12px;
  padding: 12px;
  background: #fff;
}

.sella-mini-label {
  color: #475569;
  font-weight: 700;
  margin-bottom: 4px;
}

.sella-mini-value {
  font-weight: 900;
  color: #0F172A;
  font-size: 28px;
}

.sella-mini-time {
  color: #94A3B8;
  font-size: 12px;
}

.sella-thresholds {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}

.sella-threshold-col {
  border: 1px solid #E2E8F0;
  border-radius: 12px;
  padding: 12px;
  background: #fff;
}

.sella-threshold-title {
  font-weight: 800;
  color: #0F172A;
  margin-bottom: 10px;
}

.sella-threshold-line {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 6px 0;
}

.sella-threshold-cap {
  font-size: 12px;
  color: #475569;
  font-weight: 800;
  width: 62px;
}

.sella-threshold-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 86px;
  padding: 6px 10px;
  border-radius: 999px;
  font-weight: 900;
  color: #0F172A;
  background: #F1F5F9;
}

.sella-threshold-chip.rojo { background: #FEE2E2; color: #991B1B; }
.sella-threshold-chip.naranja { background: #FFEDD5; color: #9A3412; }
.sella-threshold-chip.amarillo { background: #FEF9C3; color: #854D0E; }

.sella-source {
  color: #64748B;
  margin-top: 10px;
  font-size: 14px;
  line-height: 1.45;
}

@media (max-width: 820px) {
  .sella-meter-cards { grid-template-columns: 1fr; }
  .sella-meter-card { min-height: auto; }
  .sella-meter-card-value { font-size: 42px; }
  .sella-summary { grid-template-columns: 1fr; }
  .sella-thresholds { grid-template-columns: 1fr; }
  .sella-mini-grid { grid-template-columns: 1fr; }
  .sella-meter-controls select { width: 100%; min-width: 0 !important; }
}

@media (max-width: 480px) {
  .sella-widget-arriondas { padding: 16px !important; }
  .sella-widget-level { font-size: 46px !important; }
  .sella-widget-arriondas .sella-trend { width: 34px; height: 34px; font-size: 21px; }
}
