/* ── Badges ──────────────────────────────────────────────────── */
.co-badge {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  padding: .2rem .55rem;
  border-radius: 4px;
  font-size: .68rem;
  font-weight: 600;
  border: 1px solid transparent;
  white-space: nowrap;
}

.co-badge-green  { background: rgba(34,197,94,.12);   color: #22c55e; border-color: rgba(34,197,94,.20); }
.co-badge-red    { background: rgba(239,68,68,.12);   color: #ef4444; border-color: rgba(239,68,68,.20); }
.co-badge-yellow { background: rgba(245,158,11,.12);  color: #f59e0b; border-color: rgba(245,158,11,.20); }
.co-badge-blue   { background: rgba(14,165,233,.12);  color: #0ea5e9; border-color: rgba(14,165,233,.20); }
.co-badge-purple { background: rgba(129,140,248,.12); color: #818cf8; border-color: rgba(129,140,248,.20); }
.co-badge-grey   { background: rgba(115,115,115,.12); color: #a3a3a3; border-color: rgba(115,115,115,.20); }

/* ── Ahorro / Incremento display ─────────────────────────────── */
.co-saving       { color: #22c55e; font-weight: 600; }
.co-increase     { color: #ef4444; font-weight: 600; }
.co-neutral      { color: #737373; }
.co-pct-saving   { color: #22c55e; font-size: .75rem; }
.co-pct-increase { color: #ef4444; font-size: .75rem; }

/* ── Modal ───────────────────────────────────────────────────── */
.co-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .78);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 99999;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.co-modal-overlay.open {
  display: flex;
}

.co-modal {
  position: relative;
  width: min(920px, 96vw);
  max-height: 90vh;
  overflow: auto;
  background: #101418;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 16px;
  box-shadow: 0 24px 80px rgba(0,0,0,.55);
  color: var(--co-txt);
  z-index: 100000;
  isolation: isolate;
}

.co-modal-lg {
  width: min(1100px, 96vw);
}

.co-modal-hd,
.co-modal-body,
.co-modal-ft {
  background: #101418;
}

.co-modal-hd {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  padding: 1rem 1.1rem;
  border-bottom: 1px solid var(--co-rim);
  position: sticky;
  top: 0;
  z-index: 2;
}

.co-modal-title {
  font-size: .95rem;
  font-weight: 700;
  color: var(--co-txt);
  display: flex;
  align-items: center;
  gap: .5rem;
}

.co-modal-title i {
  color: var(--co-accent);
}

.co-modal-close {
  border: 1px solid var(--co-rim);
  background: var(--co-panel2);
  color: var(--co-txtM);
  width: 34px;
  height: 34px;
  border-radius: 8px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all .2s ease;
}

.co-modal-close:hover {
  color: var(--co-txt);
  background: #1c232c;
  border-color: var(--co-rim2);
}

.co-modal-body {
  padding: 1.1rem;
}

.co-modal-ft {
  display: flex;
  justify-content: flex-end;
  gap: .65rem;
  padding: 1rem 1.1rem;
  border-top: 1px solid var(--co-rim);
  position: sticky;
  bottom: 0;
  z-index: 2;
}

.co-field {
  margin-bottom: .95rem;
}

.co-field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .85rem;
}

@media (max-width: 800px) {
  .co-field-row {
    grid-template-columns: 1fr;
  }

  .co-modal,
  .co-modal-lg {
    width: 100%;
    max-height: 92vh;
    border-radius: 14px;
  }

  .co-modal-overlay {
    padding: 12px;
    align-items: flex-end;
  }
}

.co-label {
  display: block;
  margin-bottom: .35rem;
  font-size: .76rem;
  font-weight: 600;
  color: var(--co-txt);
}

.co-label .req {
  color: #ef4444;
}

.co-input,
.co-textarea,
.co-fselect {
  width: 100%;
  background: #0d1117;
  color: var(--co-txt);
  border: 1px solid var(--co-rim);
  border-radius: 10px;
  padding: .72rem .85rem;
  font-size: .82rem;
  outline: none;
  transition: border-color .2s ease, box-shadow .2s ease;
}

.co-input:focus,
.co-textarea:focus,
.co-fselect:focus {
  border-color: rgba(34,197,94,.45);
  box-shadow: 0 0 0 3px rgba(34,197,94,.10);
}

.co-textarea {
  min-height: 96px;
  resize: vertical;
}

.co-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  padding-top: .35rem;
}

.co-toggle-lbl {
  font-size: .8rem;
  color: var(--co-txt);
}

.co-toggle {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 28px;
}

.co-toggle input {
  opacity: 0;
  width: 0;
  height: 0;
}

.co-toggle-slider {
  position: absolute;
  inset: 0;
  background: #2a2a2a;
  border-radius: 999px;
  transition: .2s;
  border: 1px solid rgba(255,255,255,.08);
}

.co-toggle-slider:before {
  content: "";
  position: absolute;
  height: 20px;
  width: 20px;
  left: 3px;
  top: 3px;
  background: white;
  border-radius: 50%;
  transition: .2s;
}

.co-toggle input:checked + .co-toggle-slider {
  background: rgba(34,197,94,.35);
  border-color: rgba(34,197,94,.45);
}

.co-toggle input:checked + .co-toggle-slider:before {
  transform: translateX(20px);
}