/* ==========================
   RESET / BASE
   ========================== */
* { margin: 0; padding: 0; box-sizing: border-box; }

html, body { height: 100%; }

body {
  background: #f5f6f8;
  font-family: 'Segoe UI', sans-serif;
  color: #111827;
}

/* ==========================
   LAYOUT
   ========================== */
.layout {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background: #f5f6f8;
}

.main-content {
  flex-grow: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  background-color: #f5f6f8;
}

/* Header (nav principal de la app) */
.header {
  height: 64px;
  background: #380818;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  gap: 1.5rem;
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 2rem;
  min-width: 0;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #fff;
  text-decoration: none;
  font-weight: 700;
  font-size: 1rem;
  white-space: nowrap;
}

.header-brand i { font-size: 1.3rem; color: #e8a0b0; }

.header-brand-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: #fff;
  flex-shrink: 0;
}

.header-brand-badge img {
  width: 22px;
  height: 22px;
  object-fit: contain;
  display: block;
}

.header-nav {
  display: flex;
  align-items: center;
  gap: 4px;
}

.header-nav-link {
  color: rgba(255,255,255,.75);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 600;
  padding: 8px 14px;
  border-radius: 10px;
  transition: background .15s ease, color .15s ease;
  white-space: nowrap;
}

.header-nav-link:hover { background: rgba(255,255,255,.08); color: #fff; }

.header-nav-link.active {
  background: #a81840;
  color: #fff;
}

/* Main */
main {
  flex-grow: 1;
  padding: 2rem;
  background: transparent;
}

/* ==========================
   HEADER SEARCH
   ========================== */
.search-box {
  display: flex;
  align-items: center;
  background: #fff;
  padding: 0.5rem 1rem;
  border-radius: 10px;
  border: 1px solid rgba(0,0,0,0.12);
  width: 300px;
}

.search-box input {
  border: none;
  outline: none;
  background: transparent;
  width: 100%;
  font-size: 1rem;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 8px;
  color: rgba(255,255,255,.85);
  font-size: 0.85rem;
  white-space: nowrap;
}

.icon-button {
  background: rgba(255,255,255,.08);
  color: rgba(255,255,255,.85);
  border: none;
  padding: 9px 10px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 0.9rem;
  transition: background .15s ease, color .15s ease;
}

.icon-button:hover { background: rgba(255,255,255,.16); color: #fff; }

.avatar img {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
}

/* ==========================
   TABLES (Lista Maestra)
   ========================== */
.table-wrapper {
  background: #fafafa;
  padding: 1.5rem;
  border-radius: 10px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.04);
  margin-top: 20px;
  border: 1px solid #e3e3e3;
}

.table-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.table-header h2 {
  font-size: 1.4rem;
  font-weight: 700;
  color: #222;
}

.table-search {
  padding: 0.55rem 0.75rem;
  border-radius: 8px;
  border: 1px solid #ccc;
  min-width: 260px;
  font-size: 0.9rem;
  transition: 0.2s;
}

.table-search:focus {
  outline: none;
  border-color: #a81840;
  box-shadow: 0 0 3px rgba(168, 24, 64, 0.3);
}

.docs-table {
  width: 100%;
  border-collapse: collapse;
  background: #ffffff;
  border-radius: 10px;
  overflow: hidden;
  font-size: 0.9rem;
  border: 1px solid #ddd;
}

.docs-table thead {
  background: #380818;
  color: #ffffff;
  font-weight: bold;
}

.docs-table thead th {
  padding: 0.75rem 0.85rem;
  text-align: left;
  white-space: nowrap;
}

.docs-table tbody td {
  padding: 0.6rem 0.85rem;
  border-bottom: 1px solid #e6e6e6;
}

.docs-table tbody tr:nth-child(even) { background: #f6f6f6; }
.docs-table tbody tr:hover { background: #f7eef1; cursor: pointer; }

/* ==========================
   BUTTONS (compat)
   ========================== */
.btn-primary {
  padding: 0.7rem 1.2rem;
  border-radius: 8px;
  border: none;
  background: #a81840;
  color: #fff;
  font-size: 0.9rem;
  cursor: pointer;
  font-weight: 600;
  transition: background 0.2s, transform 0.1s;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.btn-primary:hover { background: #6b0f2a; transform: translateY(-1px); }
.btn-primary:active { transform: translateY(0); }

.btn-secondary {
  padding: 0.7rem 1.2rem;
  background: #e0e0e0;
  color: #222;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 600;
  transition: 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.btn-secondary:hover { background: #c6c6c6; }

/* ==========================
   FORMS (genéricos)
   ========================== */
.form-wrapper { padding: 1rem 1rem; }

.form-wrapper h2 {
  font-size: 1.6rem;
  font-weight: 700;
  margin-bottom: 0.3rem;
}

.form-description { color: #555; margin-bottom: 1rem; }

.form-card {
  background: #fff;
  padding: 1.5rem;
  border-radius: 12px;
  border: 1px solid #ddd;
  box-shadow: 0 2px 6px rgba(0,0,0,0.04);
  max-width: 980px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
}

.form-group.full { grid-column: span 2; }

.form-group label {
  display: block;
  font-weight: 600;
  margin-bottom: 5px;
  color: #222;
}

.form-group input, .form-group select {
  width: 100%;
  padding: 0.6rem 0.8rem;
  border-radius: 8px;
  border: 1px solid #ccc;
  font-size: 0.95rem;
  background: #fafafa;
}

.form-group input:focus, .form-group select:focus {
  outline: none;
  border-color: #a81840;
  background: #fff;
}

.form-buttons {
  margin-top: 1.5rem;
  display: flex;
  gap: 1rem;
}

.help-text { font-size: 0.8rem; color: #666; margin-top: 4px; }

/* ==========================
   PROFILE
   ========================== */
.profile-container {
  padding: 2rem;
  border-radius: 10px;
  width: 100%;
  max-width: 800px;
  display: flex;
  gap: 2rem;
  flex-wrap: wrap;
}

.profile-picture {
  flex: 1 1 200px;
  text-align: center;
}

.profile-picture img {
  width: 140px;
  height: 140px;
  object-fit: cover;
  border-radius: 50%;
  border: 2px solid #380818;
}

.profile-form {
  flex: 2 1 400px;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.input-group { display: flex; flex-direction: column; }
.input-row { display: flex; gap: 1rem; }
.input-row .input-group { flex: 1; }

.submit-btn {
  background-color: #6b0f2a;
  border: none;
  padding: 0.8rem 1.2rem;
  border-radius: 6px;
  color: #ffffff;
  font-weight: bold;
  cursor: pointer;
  align-self: flex-start;
}

.submit-btn:hover { background-color: #a81840; }

/* ==========================
   STATUS / BADGES
   ========================== */
.status-danger { color: #b91c1c; font-weight: 600; }
.status-ok { color: #15803d; font-weight: 600; }
.status-warning{ color: #b45309; font-weight: 700; }

.badge-warning{
  display:inline-block;
  margin-left:8px;
  padding:2px 8px;
  border-radius:999px;
  font-size:12px;
  border:1px solid #f59e0b;
  background:#fff7ed;
}

.docs-table tbody tr.row-warning,
.docs-table tbody tr.row-warning td { background: #fff7ed !important; }

.docs-table tbody tr.row-warning:hover,
.docs-table tbody tr.row-warning:hover td { background: #ffedd5 !important; }

.docs-table tbody tr.row-danger,
.docs-table tbody tr.row-danger td { background: #fee2e2 !important; }

.docs-table tbody tr.row-danger:hover,
.docs-table tbody tr.row-danger:hover td { background: #fecaca !important; }

/* counters */
.status-counters{
  margin-top: 6px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.status-counters .counter{
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 13px;
  border: 1px solid #ddd;
  background: #fff;
  cursor: pointer;
  transition: transform .05s ease, box-shadow .1s ease;
}

.status-counters .counter:hover{
  transform: translateY(-1px);
  box-shadow: 0 2px 10px rgba(0,0,0,.06);
}

.counter.total{
  border-color: #a81840;
  background: #f7eef1;
  color: #6b0f2a;
}

.counter.warning{
  border-color: #f59e0b;
  background: #fff7ed;
  color: #b45309;
}

.counter.danger{
  border-color: #ef4444;
  background: #fee2e2;
  color: #b91c1c;
}

.status-counters .counter.active{
  outline: 2px solid rgba(0,0,0,.15);
}

.table-header .input{ min-width: 180px; }

.search-form{
  display:flex;
  gap:10px;
  align-items:center;
}
.search-form .input{ min-width: 280px; }

/* ==========================
   ALERTS (genéricos)
   ========================== */
.alerts { margin: 10px 0 14px; }
.alert {
  padding: 10px 12px;
  border-radius: 10px;
  margin-bottom: 8px;
  font-size: 14px;
}
.alert.success { background: #dcfce7; border: 1px solid #22c55e; }
.alert.error   { background: #fee2e2; border: 1px solid #ef4444; }

.errorlist {
  margin: 6px 0 0;
  padding: 0;
  list-style: none;
  color: #b91c1c;
  font-size: 13px;
}

/* ==========================
   MOLEX PAGE (polish)
   ========================== */
.page{
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 18px 22px 34px;
}

.page-header{
  display:flex;
  align-items:flex-end;
  justify-content:space-between;
  gap:16px;
  margin-bottom: 14px;
}

.page-title{
  font-size: 28px;
  line-height: 1.1;
  margin: 0;
  letter-spacing: .2px;
}

.page-subtitle{
  margin: 6px 0 0;
  color: rgba(0,0,0,.62);
  font-size: 14px;
}

/* Cards */
.card{
  background: #fff;
  border: 1px solid rgba(0,0,0,.08);
  border-radius: 14px;
  box-shadow: 0 10px 30px rgba(0,0,0,.05);
  margin-top: 14px;
  overflow: hidden;
  width: 100%;
}

.card-header{
  padding: 14px 16px;
  border-bottom: 1px solid rgba(0,0,0,.06);
  background: linear-gradient(to bottom, rgba(0,0,0,.02), rgba(0,0,0,0));
}

.card-header-row{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
}

.card-title{
  margin: 0;
  font-size: 16px;
  letter-spacing: .2px;
}

.card-hint{
  margin: 6px 0 0;
  font-size: 13px;
  color: rgba(0,0,0,.62);
}

.dash-audit-card{
  display: block;
  padding: 16px;
  border: 1px solid rgba(0,0,0,.08);
  border-radius: 12px;
  text-decoration: none;
  color: inherit;
  transition: box-shadow .15s ease, border-color .15s ease, transform .15s ease;
}

.dash-audit-card:hover{
  box-shadow: 0 8px 20px rgba(168,24,64,.12);
  border-color: rgba(168,24,64,.3);
  transform: translateY(-1px);
}

.dash-audit-card__title{
  font-weight: 700;
  font-size: 15px;
  color: #1a1a1a;
}

.dash-audit-card__sub{
  font-size: 13px;
  color: rgba(0,0,0,.55);
  margin-top: 2px;
}

.card-body{ padding: 16px; }

/* Form */
.form{ display:block; }

.form-grid{
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.field-span-2{ grid-column: 1 / -1; }

@media (max-width: 800px){
  .form-grid{ grid-template-columns: 1fr; }
  .field-span-2{ grid-column: auto; }
}

.field-label{
  display:block;
  font-size: 13px;
  color: rgba(0,0,0,.75);
  margin-bottom: 6px;
}

.field-control input,
.field-control select,
.field-control textarea{
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(0,0,0,.14);
  background: #fff;
  outline: none;
  transition: box-shadow .15s ease, border-color .15s ease;
}

.field-control input:focus,
.field-control select:focus,
.field-control textarea:focus{
  border-color: rgba(168, 24, 64, 0.45);
  box-shadow: 0 0 0 4px rgba(168, 24, 64, 0.12);
}

.field-error{
  margin-top: 6px;
  font-size: 12px;
  color: #b00020;
}

/* New button system for Molex */
.btn{
  display:inline-flex;
  align-items:center;
  gap:8px;
  border-radius: 12px;
  padding: 10px 14px;
  border: 1px solid transparent;
  text-decoration: none;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
}

.btn-small{ padding: 8px 12px; border-radius: 10px; font-size: 13px; }

.btn.btn-primary{
  background: #a81840;
  color: #fff;
}

.btn.btn-primary:hover{ filter: brightness(0.92); }

.btn.btn-secondary{
  background: #f3f4f6;
  color: #111827;
  border-color: rgba(0,0,0,.08);
}

.btn.btn-secondary:hover{ filter: brightness(0.98); }

.btn.btn-danger{
  background: #fee2e2;
  color: #b91c1c;
  border-color: rgba(220,38,38,.2);
}

.btn.btn-danger:hover{ background: #fecaca; }

.is-disabled{
  opacity: .55;
  pointer-events: none;
}

.form-actions{
  display:flex;
  gap:10px;
  flex-wrap: wrap;
  margin-top: 14px;
}

/* Table */
.table-wrap{
  width: 100%;
  overflow: auto;
}

.table{
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  min-width: 0;
}

.table thead th{
  text-align:left;
  font-size: 12px;
  letter-spacing: .4px;
  text-transform: uppercase;
  color: rgba(0,0,0,.55);
  padding: 10px 12px;
  border-bottom: 1px solid rgba(0,0,0,.08);
  background: rgba(0,0,0,.02);
}

.table tbody td{
  padding: 12px;
  border-bottom: 1px solid rgba(0,0,0,.06);
  vertical-align: middle;
}

.table tbody tr:hover{
  background: rgba(168, 24, 64, 0.04);
}

.th-actions, .td-actions{ text-align:right; width: 160px; }
.td-muted{ color: rgba(0,0,0,.65); }

.link{
  font-weight: 700;
  color: #6b0f2a;
  text-decoration: none;
}

.link:hover{ text-decoration: underline; }

.table-empty{
  padding: 18px 12px;
  color: rgba(0,0,0,.65);
  text-align: center;
}

/* Pills */
.pill{
  display:inline-flex;
  align-items:center;
  gap:8px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(0,0,0,.04);
  border: 1px solid rgba(0,0,0,.06);
  color: rgba(0,0,0,.75);
  font-size: 13px;
}

/* Pagination */
.pagination{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 12px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid rgba(0,0,0,.06);
}

.pagination-meta{
  color: rgba(0,0,0,.62);
  font-size: 13px;
}

.pagination-right{
  display:flex;
  align-items:center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content:flex-end;
}

.page-dot{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-width: 34px;
  height: 34px;
  padding: 0 10px;
  border-radius: 10px;
  border: 1px solid rgba(0,0,0,.10);
  background: #fff;
  color: rgba(0,0,0,.85);
  text-decoration:none;
  font-weight: 700;
  font-size: 13px;
}

.page-dot:hover{ background: rgba(0,0,0,.03); }

.page-dot.is-active{
  background: rgba(168, 24, 64, 0.10);
  border-color: rgba(168, 24, 64, 0.25);
  color: #6b0f2a;
}

/* inputs usados en forms.py */
.input{
  width:100%;
  padding:10px 12px;
  border-radius:10px;
  border:1px solid rgba(0,0,0,.14);
  background:#fff;
  outline:none;
  transition: box-shadow .15s ease, border-color .15s ease;
}

.docs-table td .input{
  width: auto;
  max-width: 220px;
  padding: 7px 10px;
  font-size: 13px;
  margin-right: 6px;
}

/* —— Overlay de carga (subir archivos / ejecutar auditoría) ————————— */
.loading-overlay{
  position: fixed;
  inset: 0;
  background: rgba(56, 8, 24, 0.92);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}

.loading-overlay__box{
  text-align: center;
  color: #fff;
  max-width: 380px;
  padding: 0 20px;
}

.loading-overlay__title{
  font-size: 1.3rem;
  font-weight: 700;
  margin-top: 20px;
}

.loading-overlay__hint{
  margin-top: 10px;
  font-size: 0.9rem;
  color: rgba(255,255,255,.75);
}

.loading-spinner{
  width: 52px;
  height: 52px;
  border: 5px solid rgba(255,255,255,.25);
  border-top-color: #fff;
  border-radius: 50%;
  margin: 0 auto;
  animation: loading-spin 0.9s linear infinite;
}

@keyframes loading-spin{
  to { transform: rotate(360deg); }
}

.input:focus{
  border-color: rgba(168, 24, 64, 0.45);
  box-shadow: 0 0 0 4px rgba(168, 24, 64, 0.12);
}

.checkbox{
  width: 18px;
  height: 18px;
}

/* ==========================
   RESPONSIVE
   ========================== */
@media (max-width: 768px) {
  .header { flex-wrap: wrap; height: auto; padding: 0.75rem 1rem; row-gap: 0.5rem; }
  .header-left { flex-wrap: wrap; row-gap: 0.5rem; }

  .table-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.6rem;
  }

  .table-search { width: 100%; }

  .docs-table {
    display: block;
    overflow-x: auto;
    white-space: nowrap;
  }

  .form-grid { grid-template-columns: 1fr; }
  .form-group.full { grid-column: span 1; }

  main { padding: 1rem; }
}


/* ===== Molex Detalle extras ===== */

.header-actions{
  display:flex;
  gap:10px;
  flex-wrap:wrap;
}

/* Grid de metadatos */
.meta-grid{
  display:grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

@media (max-width: 1100px){
  .meta-grid{ grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 640px){
  .meta-grid{ grid-template-columns: 1fr; }
}

.meta-item{
  border: 1px solid rgba(0,0,0,.06);
  background: rgba(0,0,0,.02);
  border-radius: 12px;
  padding: 12px;
}

.meta-label{
  font-size: 12px;
  color: rgba(0,0,0,.62);
  text-transform: uppercase;
  letter-spacing: .4px;
  margin-bottom: 6px;
}

.meta-value{
  font-size: 14px;
  color: rgba(0,0,0,.88);
  display:flex;
  align-items:center;
  gap:10px;
  flex-wrap:wrap;
}

/* Botones de descarga */
.actions-grid{
  display:flex;
  gap:10px;
  flex-wrap:wrap;
}

/* Textarea tipo editor */
.preview-textarea{
  width: 100%;
  height: 320px;
  border-radius: 12px;
  border: 1px solid rgba(0,0,0,.12);
  background: #0b1220;
  color: #e5e7eb;
  padding: 12px 14px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 13px;
  line-height: 1.45;
  resize: vertical;
  outline: none;
}

.preview-textarea:focus{
  border-color: rgba(168, 24, 64, 0.45);
  box-shadow: 0 0 0 4px rgba(168, 24, 64, 0.12);
}

.btn-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}


/* ============================================================
   MONITOR DE CORREOS — clases complementarias
   ============================================================ */

/* —— Stats grid ——————————————————————————————————————————— */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
  margin-top: 14px;
  margin-bottom: 4px;
}

.stat-card {
  background: #fff;
  border: 1px solid rgba(0,0,0,.08);
  border-radius: 14px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  box-shadow: 0 10px 30px rgba(0,0,0,.05);
}

.stat-label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: rgba(0,0,0,.55);
}

.stat-value {
  font-size: 1.7rem;
  font-weight: 700;
  color: #111827;
  line-height: 1;
}

.stat-card--blue   { border-left: 4px solid #a81840; }
.stat-card--green  { border-left: 4px solid #16a34a; }
.stat-card--red    { border-left: 4px solid #dc2626; }
.stat-card--yellow { border-left: 4px solid #d97706; }
.stat-card--gray   { border-left: 4px solid #9ca3af; }

.stat-card--blue   .stat-value { color: #a81840; }
.stat-card--green  .stat-value { color: #16a34a; }
.stat-card--red    .stat-value { color: #dc2626; }
.stat-card--yellow .stat-value { color: #d97706; }
.stat-card--gray   .stat-value { color: #9ca3af; }

/* —— Semáforo de hallazgos: botones redondos ———————————————— */
.semaforo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 14px;
}

.semaforo-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 22px 16px;
  border-radius: 28px;
  border: 2px solid transparent;
  text-decoration: none;
  text-align: center;
  cursor: pointer;
  box-shadow: 0 10px 30px rgba(0,0,0,.05);
  transition: transform .15s ease, box-shadow .15s ease;
}

.semaforo-card:hover { transform: translateY(-2px); box-shadow: 0 10px 30px rgba(0,0,0,.12); }

.semaforo-card .stat-value { font-size: 2rem; line-height: 1; }
.semaforo-card .stat-label {
  font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
}

.semaforo-card--red    { background: #fee2e2; border-color: rgba(220,38,38,.25); }
.semaforo-card--red    .stat-value,
.semaforo-card--red    .stat-label { color: #b91c1c; }

.semaforo-card--yellow { background: #fef3c7; border-color: rgba(217,119,6,.3); }
.semaforo-card--yellow .stat-value,
.semaforo-card--yellow .stat-label { color: #92400e; }

.semaforo-card--green  { background: #dcfce7; border-color: rgba(22,163,74,.25); }
.semaforo-card--green  .stat-value,
.semaforo-card--green  .stat-label { color: #15803d; }

.semaforo-card--active { box-shadow: 0 0 0 3px rgba(0,0,0,.08), 0 10px 30px rgba(0,0,0,.1); }
.semaforo-card--red.semaforo-card--active    { border-color: #dc2626; box-shadow: 0 0 0 3px rgba(220,38,38,.2), 0 10px 30px rgba(0,0,0,.1); }
.semaforo-card--yellow.semaforo-card--active { border-color: #d97706; box-shadow: 0 0 0 3px rgba(217,119,6,.2), 0 10px 30px rgba(0,0,0,.1); }
.semaforo-card--green.semaforo-card--active  { border-color: #16a34a; box-shadow: 0 0 0 3px rgba(22,163,74,.2), 0 10px 30px rgba(0,0,0,.1); }

/* —— Pills con color ———————————————————————————————————— */
.pill--blue   { background: #f7eef1; color: #6b0f2a; border-color: rgba(168, 24, 64, 0.2); }
.pill--green  { background: #dcfce7; color: #15803d; border-color: rgba(22,163,74,.2); }
.pill--red    { background: #fee2e2; color: #b91c1c; border-color: rgba(220,38,38,.2); }
.pill--yellow { background: #fef3c7; color: #92400e; border-color: rgba(217,119,6,.25); }
.pill--gray   { background: #f3f4f6; color: #4b5563; border-color: rgba(0,0,0,.08); }

/* —— Alert warning ————————————————————————————————————— */
.alert.alert-warning {
  background: #fff7ed;
  border: 1px solid #fed7aa;
  color: #92400e;
}

/* —— page-header-actions ————————————————————————————————— */
.page-header-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  padding-bottom: 2px;
}

/* —— Timeline —————————————————————————————————————————————— */
.timeline {
  list-style: none;
  padding: 0;
  margin: 0;
}

.timeline-item {
  display: flex;
  gap: 14px;
  padding-bottom: 20px;
  position: relative;
}

.timeline-item:not(:last-child)::before {
  content: "";
  position: absolute;
  left: 9px;
  top: 22px;
  bottom: 0;
  width: 2px;
  background: rgba(0,0,0,.08);
}

.timeline-dot {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 2px;
  border: 2px solid;
}

.timeline-dot--blue  { background: #f7eef1; border-color: #a81840; }
.timeline-dot--green { background: #dcfce7; border-color: #16a34a; }
.timeline-dot--red   { background: #fee2e2; border-color: #dc2626; }

.timeline-content {
  flex: 1;
  padding-bottom: 4px;
}

.timeline-header {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 2px;
}

.timeline-item--alerta .timeline-content {
  background: #fff7ed;
  border: 1px solid #fed7aa;
  border-radius: 12px;
  padding: 8px 12px;
}

/* —— Correo items ————————————————————————————————————————— */
.correo-item {
  border: 1px solid rgba(0,0,0,.08);
  border-radius: 14px;
  padding: 14px 16px;
  margin-bottom: 10px;
  background: #fff;
  box-shadow: 0 2px 6px rgba(0,0,0,.03);
  transition: box-shadow .15s ease;
}

.correo-item:hover {
  box-shadow: 0 4px 12px rgba(0,0,0,.07);
}

.correo-item--alerta {
  border-color: #fca5a5;
  background: #fff7f7;
}

.correo-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
  flex-wrap: wrap;
}

.correo-asunto {
  font-weight: 600;
  font-size: .9rem;
  color: #111827;
  margin-bottom: 4px;
}

.correo-cuerpo {
  font-size: .82rem;
  color: rgba(0,0,0,.62);
  line-height: 1.55;
  white-space: pre-wrap;
  border-left: 3px solid rgba(0,0,0,.08);
  padding-left: 10px;
  margin-top: 6px;
  max-height: 120px;
  overflow: hidden;
  position: relative;
}

.correo-cuerpo::after {
  content: "";
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 28px;
  background: linear-gradient(to bottom, transparent, #fff);
  pointer-events: none;
}

.correo-item--alerta .correo-cuerpo::after {
  background: linear-gradient(to bottom, transparent, #fff7f7);
}

/* —— Responsive ————————————————————————————————————————— */
@media (max-width: 768px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .timeline-header { flex-direction: column; gap: 2px; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .stat-value { font-size: 1.4rem; }
}


/* ==========================
   ANEXO 24 — extras
   ========================== */

/* Títulos de sección dentro de forms */
.form-section-title {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: rgba(0,0,0,.55);
  margin: 0 0 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid rgba(0,0,0,.07);
}

/* crispy field wrapper */
.mb-3 { margin-bottom: 12px; }
.mb-3 label { display: block; font-size: 13px; color: rgba(0,0,0,.75); margin-bottom: 6px; font-weight: 600; }
.mb-3 input, .mb-3 select, .mb-3 textarea {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(0,0,0,.14);
  background: #fff;
  outline: none;
  transition: box-shadow .15s ease, border-color .15s ease;
}
.mb-3 input:focus, .mb-3 select:focus, .mb-3 textarea:focus {
  border-color: rgba(168, 24, 64, 0.45);
  box-shadow: 0 0 0 4px rgba(168, 24, 64, 0.12);
}
.mb-3 .text-danger { font-size: 12px; color: #b00020; margin-top: 4px; }
