/* ── Licencias y Certificaciones ─────────────────────────────────────────── */

#view-licencias {
  max-width: 1120px;
  margin: 0 auto;
  padding: 24px 16px 56px;
}

.cred-hero {
  padding: 24px;
  margin-bottom: 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--card);
}

.cred-hero .explorar-title {
  margin-bottom: 6px;
}

.cred-hero .explorar-sub {
  max-width: 760px;
  margin-bottom: 0;
  line-height: 1.55;
}

/* Filtros */
.cred-filters {
  display: grid;
  grid-template-columns: repeat(3, minmax(180px, 1fr));
  gap: 10px;
  margin: 0 0 10px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--card);
  align-items: flex-end;
}

.cred-filter-group {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.cred-filter-label {
  font-size: .72rem;
  font-weight: 800;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .02em;
}

.cred-select {
  background: var(--card);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  min-height: 38px;
  padding: 0 11px;
  font-size: .88rem;
  cursor: pointer;
  transition: border-color .15s;
  width: 100%;
}

.cred-select:focus {
  outline: none;
  border-color: var(--accent);
}

/* Chips de obligatoriedad */
.cred-obligation-chips {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(142px, 1fr));
  gap: 7px;
  padding: 12px;
  margin-bottom: 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--card);
}

.cred-chip {
  min-height: 36px;
  padding: 7px 10px;
  border-radius: 10px;
  font-size: .78rem;
  font-weight: 800;
  border: 1px solid var(--border);
  background: var(--card2);
  color: var(--muted);
  cursor: pointer;
  transition: all .15s;
  white-space: nowrap;
  text-align: center;
}

.cred-chip:hover {
  color: var(--text);
  border-color: var(--accent);
}

.cred-chip.is-active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.cred-chip--mandatory.is-active { background: #dc2626; border-color: #dc2626; }
.cred-chip--industry.is-active  { background: #d97706; border-color: #d97706; }
.cred-chip--edge.is-active      { background: #2563eb; border-color: #2563eb; }

/* Filtros secundarios */
.cred-filters-secondary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--card);
}

.cred-toggle-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--card2);
  cursor: pointer;
  font-size: .8rem;
  font-weight: 700;
  color: var(--muted);
  transition: color .15s;
}

.cred-toggle-label:hover { color: var(--text); }

.cred-toggle-input {
  flex: 0 0 auto;
  width: 14px;
  height: 14px;
  accent-color: var(--accent);
  cursor: pointer;
}

/* Contador */
.cred-results-meta {
  font-size: .82rem;
  color: var(--muted);
  margin-bottom: 12px;
  min-height: 20px;
}

/* Grid de resultados */
.cred-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
  margin-bottom: 40px;
}

/* Tarjeta de credencial */
.cred-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
  text-align: left;
  cursor: pointer;
  transition: border-color .15s, transform .12s;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 188px;
  width: 100%;
}

.cred-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}

.cred-card__top {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: start;
  gap: 8px;
}

.cred-card__country {
  font-size: .78rem;
  color: var(--muted);
  font-weight: 600;
}

.cred-card__badges {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  justify-content: flex-end;
  max-width: 170px;
}

.cred-card__name {
  font-size: .95rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.35;
}

.cred-card__summary {
  font-size: .82rem;
  color: var(--muted);
  line-height: 1.5;
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.cred-card__footer {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: auto;
}

/* Badges */
.cred-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: .72rem;
  font-weight: 700;
  white-space: nowrap;
}

.cred-badge--mandatory { background: rgba(220,38,38,.15);  color: #ef4444; }
.cred-badge--industry  { background: rgba(217,119,6,.15);  color: #f59e0b; }
.cred-badge--role      { background: rgba(124,58,237,.15); color: #8b5cf6; }
.cred-badge--edge      { background: rgba(37,99,235,.15);  color: #60a5fa; }
.cred-badge--type      { background: var(--card2); color: var(--muted); }

/* Chips pequeños */
.cred-chip-small {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: .70rem;
  font-weight: 700;
  white-space: nowrap;
}

.cred-chip-small--ok  { background: rgba(34,197,94,.15); color: #22c55e; }
.cred-chip-small--whv { background: rgba(245,158,11,.15); color: #f59e0b; }

.cred-pending-card {
  grid-column: 1 / -1;
  padding: 18px;
  border: 1px dashed var(--border);
  border-radius: 8px;
  background: var(--card);
}

.cred-pending-card__title {
  margin: 8px 0 6px;
  color: var(--text);
  font-size: 1rem;
  line-height: 1.35;
}

.cred-pending-card__intro {
  max-width: 760px;
  margin: 0 0 14px;
  color: var(--muted);
  font-size: .86rem;
  line-height: 1.55;
}

.cred-pending-categories {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 14px;
}

.cred-pending-category {
  padding: 5px 9px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--card2);
  color: var(--muted);
  font-size: .76rem;
  font-weight: 700;
}

.cred-pending-card__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.cred-driving-link {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 7px 11px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--card2);
  color: var(--accent);
  cursor: pointer;
  font-size: .82rem;
  font-weight: 800;
  text-align: left;
}

.cred-driving-link:hover {
  border-color: var(--accent);
}

/* Panel de detalle (overlay) */
.cred-detail-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.6);
  z-index: 500;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 24px 16px;
  overflow-y: auto;
}

.cred-detail-overlay.hidden { display: none; }

.cred-detail-panel {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  width: 100%;
  max-width: 640px;
  position: relative;
  padding: 28px 24px 32px;
}

.cred-detail-close {
  position: absolute;
  top: 12px;
  right: 14px;
  background: none;
  border: none;
  color: var(--muted);
  font-size: 1.2rem;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  transition: color .15s;
}

.cred-detail-close:hover { color: var(--text); }

.cred-detail-header { margin-bottom: 16px; }

.cred-detail-country {
  font-size: .78rem;
  color: var(--muted);
  font-weight: 600;
  margin-bottom: 6px;
}

.cred-detail-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-bottom: 10px;
}

.cred-detail-name {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text);
  margin: 0 0 4px;
  line-height: 1.3;
}

.cred-detail-name-en {
  font-size: .80rem;
  color: var(--muted);
  margin-bottom: 4px;
}

.cred-detail-summary {
  font-size: .88rem;
  color: var(--text);
  line-height: 1.6;
  margin: 0 0 16px;
}

.cred-detail-note {
  font-size: .82rem;
  color: var(--muted);
  background: var(--card2);
  border-left: 3px solid var(--border);
  padding: 8px 12px;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  margin-bottom: 12px;
  line-height: 1.5;
}

.cred-detail-note--obligation {
  border-left-color: #f59e0b;
}

.cred-detail-whv {
  font-size: .82rem;
  background: rgba(245,158,11,.08);
  border-left: 3px solid #f59e0b;
  padding: 8px 12px;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  margin-bottom: 12px;
  color: var(--text);
  line-height: 1.5;
}

.cred-detail-timing-note {
  font-size: .80rem;
  color: var(--muted);
  margin: -6px 0 10px 0;
  padding-left: 2px;
  font-style: italic;
}

.cred-detail-rows {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-bottom: 16px;
}

.cred-detail-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  padding: 7px 0;
  border-bottom: 1px solid var(--border);
  font-size: .84rem;
}

.cred-detail-row:last-child { border-bottom: none; }

.cred-detail-row__label {
  color: var(--muted);
  flex-shrink: 0;
  font-weight: 500;
}

.cred-detail-row__value {
  color: var(--text);
  text-align: right;
}

.cred-detail-section {
  margin-top: 16px;
}

.cred-detail-section__title {
  font-size: .75rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .05em;
  margin-bottom: 8px;
}

.cred-related-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.cred-related-tag {
  font-size: .78rem;
  padding: 4px 10px;
  background: var(--card2);
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--muted);
}

.cred-related-tag--link {
  cursor: pointer;
  transition: border-color .15s, color .15s;
}

.cred-related-tag--link:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.cred-official-links {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.cred-official-link {
  font-size: .84rem;
  color: var(--accent);
  text-decoration: none;
  transition: opacity .15s;
}

.cred-official-link:hover { opacity: .8; text-decoration: underline; }

.cred-detail-disclaimer {
  margin-top: 20px;
  font-size: .75rem;
  color: var(--muted);
  background: var(--card2);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  line-height: 1.5;
}

/* Estados de error y vacío */
.cred-empty,
.cred-error {
  color: var(--muted);
  font-size: .88rem;
  padding: 32px 0;
  text-align: center;
  grid-column: 1 / -1;
}

.cred-modal-open { overflow: hidden; }

/* Responsive */
@media (max-width: 640px) {
  #view-licencias { padding-inline: 12px; }
  .cred-hero { padding: 20px 16px; }
  .cred-filters { grid-template-columns: 1fr; gap: 10px; }
  .cred-filter-group { min-width: 100%; }
  .cred-grid { grid-template-columns: 1fr; }
  .cred-card__top { grid-template-columns: 1fr; }
  .cred-card__badges { justify-content: flex-start; max-width: none; }
  .cred-detail-panel { padding: 20px 16px 24px; }
  .cred-detail-overlay { padding: 12px 8px; }
}
