/* ── Variables ─────────────────────────────────────────────────── */
:root {
  --primary: #1a73e8;
  --primary-hover: #1557b0;
  --bg: #f8f9fa;
  --surface: #ffffff;
  --text: #202124;
  --muted: #5f6368;
  --border: #dadce0;
  --danger: #d93025;
  --success: #137333;
  --warning: #b06000;
  --radius: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,.12), 0 1px 2px rgba(0,0,0,.08);
  --shadow-md: 0 4px 6px rgba(0,0,0,.1), 0 1px 3px rgba(0,0,0,.08);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: 'Google Sans', Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

main.container { flex: 1; }

/* ── Navbar ────────────────────────────────────────────────────── */
.navbar {
  background: #0039a6;
  border-bottom: none;
  padding: 0 24px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 2px 8px rgba(0,0,0,.25);
  position: sticky;
  top: 0;
  z-index: 100;
}

.navbar-brand {
  font-size: 1.1rem;
  font-weight: 600;
  color: #fff;
  text-decoration: none;
}

.navbar-brand:hover { color: rgba(255,255,255,0.85); }

.navbar-user {
  display: flex;
  align-items: center;
  gap: 16px;
}

.user-email { font-size: 0.875rem; color: rgba(255,255,255,0.8); }

/* Botones dentro del navbar sobre fondo azul institucional */
.navbar .btn-outline {
  color: #fff;
  border-color: rgba(255,255,255,0.55);
}
.navbar .btn-outline:hover {
  background: rgba(255,255,255,0.15);
  border-color: #fff;
}
.navbar .btn-primary {
  background: #fff;
  color: #0039a6;
}
.navbar .btn-primary:hover {
  background: rgba(255,255,255,0.88);
  box-shadow: var(--shadow-md);
}

/* ── Container ─────────────────────────────────────────────────── */
.container {
  max-width: 1040px;
  margin: 0 auto;
  padding: 40px 24px;
}

/* Mayor especificidad para sobreescribir .container */
.container.container-wide {
  max-width: none;
  padding-left: 32px;
  padding-right: 32px;
}

/* ── Buttons ───────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 20px;
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  transition: background .15s, box-shadow .15s;
  border: none;
}

.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); box-shadow: var(--shadow-md); }

.btn-outline {
  background: transparent;
  color: var(--primary);
  border: 1px solid var(--border);
}
.btn-outline:hover { background: #f1f3f4; }

.btn-lg { padding: 14px 32px; font-size: 1rem; border-radius: 10px; }

/* Google sign-in button */
.btn-google {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  max-width: 320px;
  margin: 0 auto;
  padding: 12px 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--text);
  text-decoration: none;
  box-shadow: var(--shadow);
  transition: box-shadow .15s, background .15s;
}
.btn-google:hover { box-shadow: var(--shadow-md); background: #f8f9fa; }

/* ── Login card ─────────────────────────────────────────────────── */
.login-card {
  max-width: 400px;
  margin: 80px auto;
  background: var(--surface);
  border-radius: 12px;
  padding: 48px 40px;
  text-align: center;
  box-shadow: var(--shadow-md);
}

.login-title { font-size: 1.75rem; font-weight: 400; margin-bottom: 8px; }
.login-subtitle { color: var(--muted); margin-bottom: 32px; font-size: 0.9375rem; }

/* Divisor "o" */
.login-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 24px 0 20px;
  color: var(--muted);
  font-size: 0.8125rem;
}
.login-divider::before,
.login-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* Formulario local */
.login-form-local {
  text-align: left;
}

.form-group {
  margin-bottom: 14px;
}

.form-label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 5px;
  text-transform: uppercase;
  letter-spacing: .03em;
}

.form-input {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.9375rem;
  background: var(--surface);
  color: var(--text);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.form-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(26,115,232,.15);
}
.form-input-error {
  border-color: var(--danger);
}
.form-input-error:focus {
  box-shadow: 0 0 0 3px rgba(217,48,37,.15);
}

/* ── Landing ────────────────────────────────────────────────────── */
.hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 48px;
  padding: 64px 0 48px;
  flex-wrap: wrap;
}

.hero-content { flex: 1; min-width: 280px; }

.hero-badge {
  display: inline-block;
  background: #e8f0fe;
  color: var(--primary);
  font-size: 0.8125rem;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: 100px;
  margin-bottom: 16px;
  letter-spacing: .03em;
}

.hero-title {
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 700;
  line-height: 1.15;
  margin-bottom: 20px;
  color: var(--text);
}

.hero-desc {
  font-size: 1.0625rem;
  color: var(--muted);
  max-width: 480px;
  margin-bottom: 32px;
  line-height: 1.7;
}

/* Decorative rings */
.hero-graphic {
  position: relative;
  width: 280px;
  height: 280px;
  flex-shrink: 0;
}

.color-ring {
  position: absolute;
  border-radius: 50%;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

.ring-1 { width: 280px; height: 280px; background: #e8f0fe; }
.ring-2 { width: 200px; height: 200px; background: #c2d7f7; }
.ring-3 { width: 120px; height: 120px; background: var(--primary); opacity: .8; }

/* Feature cards */
.features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
  padding-bottom: 40px;
}

.feature-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 28px 24px;
  box-shadow: var(--shadow);
  transition: box-shadow .15s;
}

.feature-card:hover { box-shadow: var(--shadow-md); }
.feature-icon { font-size: 1.75rem; margin-bottom: 12px; color: var(--primary); }
.feature-card h3 { font-size: 1rem; font-weight: 600; margin-bottom: 8px; }
.feature-card p { font-size: 0.9rem; color: var(--muted); line-height: 1.6; }

/* ── Dashboard ──────────────────────────────────────────────────── */
.dashboard-header { margin-bottom: 24px; }
.dashboard-header h1 { font-size: 1.75rem; font-weight: 500; }

/* ── Profile card ───────────────────────────────────────────────── */
.profile-card {
  max-width: 480px;
  background: var(--surface);
  border-radius: 12px;
  padding: 40px;
  text-align: center;
  box-shadow: var(--shadow-md);
  margin-bottom: 32px;
}

.avatar {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  object-fit: cover;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}

.avatar-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--primary);
  color: #fff;
  font-size: 2rem;
  font-weight: 600;
  width: 96px;
  height: 96px;
  border-radius: 50%;
  margin: 0 auto 16px;
}

.profile-name { font-size: 1.4rem; font-weight: 500; margin-bottom: 4px; }
.profile-email { color: var(--muted); margin-bottom: 16px; }

.profile-meta {
  display: flex;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
}

.profile-actions {
  margin-top: 24px;
}

/* ── Badges ─────────────────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 100px;
  font-size: 0.8125rem;
  font-weight: 500;
  background: #e8f0fe;
  color: var(--primary);
}

.badge-role { font-weight: 600; }
.badge-administrador { background: #fce8e6; color: var(--danger); }
.badge-supervisor { background: #e6f4ea; color: var(--success); }
.badge-asesor { background: #e8f0fe; color: var(--primary); }
.badge-region { background: #fef7e0; color: var(--warning); }
.badge-warning { background: #fff3cd; color: #856404; }
.badge-admin { background: #fce8e6; color: var(--danger); }

/* ── Section activities ─────────────────────────────────────────── */
.section-activities {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 28px;
  margin-top: 24px;
  box-shadow: var(--shadow);
}

.section-title { font-size: 1.125rem; font-weight: 600; margin-bottom: 12px; }
.text-muted { color: var(--muted); font-size: 0.9375rem; margin-bottom: 16px; }

/* ── Alerts ─────────────────────────────────────────────────────── */
.messages { margin-bottom: 24px; }
.alert {
  padding: 12px 16px;
  border-radius: var(--radius);
  margin-bottom: 8px;
  font-size: 0.9375rem;
}
.alert-success { background: #e6f4ea; color: var(--success); }
.alert-error, .alert-danger { background: #fce8e6; color: var(--danger); }
.alert-warning { background: #fef7e0; color: var(--warning); }
.alert-info { background: #e8f0fe; color: var(--primary); }

/* ── Footer ─────────────────────────────────────────────────────── */
.footer {
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 18px 24px;
  margin-top: auto;
}

.footer-inner {
  max-width: 1040px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 0.875rem;
  color: var(--muted);
}

.footer-email strong { color: var(--text); }
.footer-copy { color: var(--muted); }

/* ── Monitor / Landing buscador ─────────────────────────────────── */
.monitor-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 24px;
}

.monitor-title { font-size: 1.75rem; font-weight: 600; }
.monitor-subtitle { color: var(--muted); font-size: 0.9375rem; margin-top: 4px; }

/* Search controls */
.search-bar-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 16px;
}

.search-input {
  flex: 1 1 280px;
  padding: 9px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.9375rem;
  outline: none;
  background: var(--surface);
  transition: border-color .15s, box-shadow .15s;
}
.search-input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(26,115,232,.15); }

.filter-select {
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.875rem;
  background: var(--surface);
  cursor: pointer;
  outline: none;
  min-width: 130px;
}
.filter-select:focus { border-color: var(--primary); }

/* Filtros con contenido largo (Programa, Modalidad, UTM): ancho acotado */
.filter-select-capped {
  max-width: 160px;
}

.filter-date {
  padding: 9px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.875rem;
  background: var(--surface);
  outline: none;
  color: var(--text);
  cursor: pointer;
}
.filter-date:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(26,115,232,.15); }

.btn-sm { padding: 8px 14px; font-size: 0.8125rem; }

/* Results meta */
.results-meta { margin-bottom: 12px; }
.results-count { font-size: 0.875rem; color: var(--muted); }

/* Table wrapper */
.table-wrapper {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow-x: auto;
  box-shadow: var(--shadow);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.data-table thead th {
  background: #f8f9fa;
  padding: 11px 14px;
  text-align: left;
  font-weight: 600;
  font-size: 0.8125rem;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  position: sticky;
  top: 0;
}

.data-table tbody tr {
  border-bottom: 1px solid #f0f0f0;
  cursor: pointer;
  transition: background .1s;
}
.data-table tbody tr:hover { background: #f5f8ff; }
.data-table tbody tr:last-child { border-bottom: none; }

.data-table td {
  padding: 10px 14px;
  vertical-align: middle;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.td-idcrm { font-family: monospace; font-size: 0.8125rem; color: var(--primary); }
.td-num { text-align: center; }
.td-fecha { white-space: nowrap; color: var(--muted); font-size: 0.8125rem; }
.td-atendido { max-width: 160px; }

/* Row color tint */
tr.row-rojo:hover    { background: #fff5f5 !important; }
tr.row-naranja:hover { background: #fff8f0 !important; }
tr.row-amarillo:hover{ background: #fffdf0 !important; }
tr.row-verde:hover   { background: #f0faf2 !important; }

/* Color badges */
.badge-color {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 100px;
  font-size: 0.8rem;
  font-weight: 600;
  white-space: nowrap;
}
.color-verde    { background: #e6f4ea; color: #1e7e34; }
.color-amarillo { background: #fef7e0; color: #8a6400; }
.color-naranja  { background: #fde8d8; color: #b85c00; }
.color-rojo     { background: #fce8e6; color: #c62828; }
.color-vacio    { background: #f1f3f4; color: var(--muted); }

/* Table states */
.table-loading, .table-empty, .table-error {
  text-align: center;
  padding: 48px 16px !important;
  color: var(--muted);
  font-size: 0.9375rem;
}
.table-error { color: var(--danger); }

/* Pagination */
.pagination-row {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 4px;
  margin-top: 20px;
  flex-wrap: wrap;
}

.page-btn {
  min-width: 36px;
  height: 36px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  cursor: pointer;
  font-size: 0.875rem;
  color: var(--text);
  transition: background .1s, border-color .1s;
}
.page-btn:hover:not(:disabled) { background: #f1f3f4; border-color: var(--primary); }
.page-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); font-weight: 600; }
.page-btn:disabled { opacity: .4; cursor: default; }
.page-ellipsis { padding: 0 6px; color: var(--muted); line-height: 36px; }

/* ── Modal ──────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  backdrop-filter: blur(2px);
}

/* El atributo [hidden] debe ganar sobre cualquier display */
[hidden] { display: none !important; }

.modal-box {
  background: var(--surface);
  border-radius: 16px;
  width: 100%;
  max-width: 640px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,.2);
  position: relative;
}

.modal-color-bar {
  height: 6px;
  border-radius: 16px 16px 0 0;
}
.bar-verde    { background: #34a853; }
.bar-amarillo { background: #fbbc04; }
.bar-naranja  { background: #f4830a; }
.bar-rojo     { background: #ea4335; }
.bar-vacio    { background: var(--border); }

.modal-close {
  position: absolute;
  top: 14px;
  right: 16px;
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--muted);
  line-height: 1;
  padding: 4px 8px;
  border-radius: var(--radius);
  transition: background .1s;
}
.modal-close:hover { background: #f1f3f4; color: var(--text); }

.modal-idcrm {
  font-family: monospace;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--primary);
  padding: 20px 24px 8px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.sf-link {
  font-family: var(--font);
  font-size: 0.75rem;
  font-weight: 500;
  color: #0070d2;
  background: #e8f4fd;
  border: 1px solid #aacfea;
  border-radius: 4px;
  padding: 2px 8px;
  text-decoration: none;
  white-space: nowrap;
}
.sf-link:hover { background: #cce5f6; }

.modal-nombre-lead {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text);
  padding: 16px 24px 0;
  margin: 0;
}
.puntaje-badge {
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 600;
  color: #1a6e3c;
  background: #d4edda;
  border: 1px solid #a8d5b5;
  border-radius: 4px;
  padding: 1px 7px;
  margin-left: 6px;
  vertical-align: middle;
}
.badge-descuento {
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 600;
  color: #856404;
  background: #fff3cd;
  border: 1px solid #ffc107;
  border-radius: 4px;
  padding: 1px 7px;
}

.modal-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  border-top: 1px solid var(--border);
  margin: 0 24px;
}

.modal-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px 0;
  border-bottom: 1px solid #f0f0f0;
}

.modal-field:nth-child(odd) { padding-right: 16px; border-right: 1px solid #f0f0f0; }
.modal-field:nth-child(even) { padding-left: 16px; }

.field-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--muted);
}

.field-long { white-space: normal; font-size: 0.875rem; }

.modal-justificacion {
  margin: 16px 24px 24px;
  padding: 16px;
  background: #f8f9fa;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.justificacion-text {
  margin-top: 8px;
  font-size: 0.9375rem;
  line-height: 1.7;
  color: var(--text);
  white-space: pre-wrap;
}

/* ── Conversación ───────────────────────────────────────────────── */
.modal-conversacion {
  margin: 0 24px 24px;
  padding: 16px;
  background: #f8f9fa;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.chat-container {
  margin-top: 12px;
  max-height: 360px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 4px 2px;
}

.chat-bubble {
  max-width: 78%;
  padding: 8px 12px;
  border-radius: 16px;
  font-size: 0.875rem;
  line-height: 1.5;
  word-break: break-word;
}

.chat-asesor {
  align-self: flex-end;
  background: var(--primary);
  color: #fff;
  border-bottom-right-radius: 4px;
}

.chat-lead {
  align-self: flex-start;
  background: #fff;
  color: var(--text);
  border-bottom-left-radius: 4px;
  box-shadow: var(--shadow);
}

.chat-meta {
  font-size: 0.7rem;
  opacity: 0.7;
  margin-bottom: 4px;
  font-weight: 500;
}

.chat-text {
  white-space: pre-wrap;
}

/* ── Formulario de fechas Auditoría ─────────────────────────────── */
.audit-date-form {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
  padding: 14px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.audit-date-label {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .03em;
}

/* ── Auditoría de Estatus ───────────────────────────────────────── */
.audit-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.audit-title { font-size: 1.5rem; font-weight: 600; }
.audit-subtitle { color: var(--muted); margin-top: 4px; font-size: 0.9375rem; }

.audit-cards {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 28px;
}

.audit-card {
  flex: 1;
  min-width: 90px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px 12px;
  text-align: center;
  box-shadow: var(--shadow);
}

.audit-card-value {
  display: block;
  font-size: 1.75rem;
  font-weight: 700;
  line-height: 1;
  margin-bottom: 6px;
}

.audit-card-link {
  text-decoration: none;
  cursor: pointer;
  transition: transform .15s, box-shadow .15s;
}
.audit-card-link:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.audit-row {
  cursor: pointer;
}
.audit-row:hover td {
  background: #f0f4ff;
}

.audit-card-label {
  font-size: 0.75rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--muted);
}

.audit-card-verde    { border-top: 3px solid #1e7e34; }
.audit-card-verde    .audit-card-value { color: #1e7e34; }
.audit-card-amarillo { border-top: 3px solid #d4a017; }
.audit-card-amarillo .audit-card-value { color: #d4a017; }
.audit-card-naranja  { border-top: 3px solid #cc5500; }
.audit-card-naranja  .audit-card-value { color: #cc5500; }
.audit-card-rojo     { border-top: 3px solid #b71c1c; }
.audit-card-rojo     .audit-card-value { color: #b71c1c; }
.audit-card-sin      { border-top: 3px solid var(--border); }

.audit-card-monto {
  display: block;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--muted);
  margin-top: 5px;
  font-variant-numeric: tabular-nums;
  letter-spacing: .01em;
}

/* Columnas tabla auditoría */
.audit-table .col-num  { text-align: center; width: 80px; }
.audit-table .col-bar  { width: 180px; }
.audit-table .col-monto-sub {
  display: block;
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  letter-spacing: .01em;
  white-space: nowrap;
  margin-top: 2px;
}
.audit-table .asesor-nombre { font-weight: 500; }

/* Encabezados de color en la tabla */
.audit-table th.color-verde    { color: #1e7e34; }
.audit-table th.color-amarillo { color: #d4a017; }
.audit-table th.color-naranja  { color: #cc5500; }
.audit-table th.color-rojo     { color: #b71c1c; }

/* Barra de distribución */
.color-bar {
  display: flex;
  height: 10px;
  border-radius: 5px;
  overflow: hidden;
  background: #e8eaed;
  width: 100%;
}

.bar-seg { height: 100%; transition: width .3s; }
.bar-verde    { background: #34a853; }
.bar-amarillo { background: #fbbc04; }
.bar-naranja  { background: #ea8600; }
.bar-rojo     { background: #d93025; }
.bar-sin      { background: #bdc1c6; }

.audit-empty {
  text-align: center;
  padding: 64px 24px;
  color: var(--muted);
  font-size: 1rem;
}

/* ── Auditoría Detallada (tabla jerarquizada) ───────────────────── */
.detalle-wrapper {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow-x: auto;
  box-shadow: var(--shadow);
}

.detalle-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
  table-layout: fixed;
}

.detalle-table thead th {
  background: #f8f9fa;
  padding: 10px 16px;
  text-align: left;
  font-weight: 600;
  font-size: 0.8125rem;
  color: var(--muted);
  border-bottom: 2px solid var(--border);
}

.col-jerarquia { width: auto; }
.col-recuento  { width: 100px; text-align: center; white-space: nowrap; }

/* Columnas de estatus integrado */
.col-estatus {
  width: 110px;
  text-align: center;
  white-space: normal;
  word-break: break-word;
  font-size: 0.72rem;
  line-height: 1.3;
  padding: 8px 6px !important;
  border-left: 1px solid var(--border);
}

.cell-estatus-count {
  text-align: center;
  border-left: 1px solid #f0f0f0;
  padding: 7px 8px;
}

.estatus-num {
  display: inline-block;
  min-width: 24px;
  font-weight: 600;
  font-size: 0.82rem;
  color: var(--text);
}

.estatus-vacio {
  color: #ccc;
  font-size: 0.75rem;
}

/* ── Filas colapsables ──────────────────────────────────────────── */
.fila-toggle {
  cursor: pointer;
  user-select: none;
}

.toggle-icon {
  display: inline-block;
  width: 14px;
  font-size: 0.65rem;
  color: var(--muted);
  margin-right: 4px;
  transition: transform .15s;
  vertical-align: middle;
}

/* Región */
.fila-region td {
  padding: 13px 16px 7px;
  font-size: 0.9375rem;
  font-weight: 700;
  color: var(--text);
  background: #eef2fb;
  border-top: 2px solid #c5d3f0;
  border-bottom: 1px solid #c5d3f0;
  letter-spacing: .01em;
}
.fila-region:hover td { background: #e4ecf8; }

/* Asesor */
.fila-asesor td {
  padding: 9px 16px 7px 32px;
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--primary);
  background: #f8faff;
  border-bottom: 1px solid #eaecf0;
}
.fila-asesor:hover td { background: #eef3ff; }

/* Color + recuento */
.fila-color td {
  padding: 7px 16px;
  border-bottom: 1px solid #f0f0f0;
}
.cell-color  { padding-left: 52px !important; }
.cell-recuento {
  text-align: center;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--muted);
}

/* Tints por color */
.fila-color-verde    td { background: #f4fcf5; }
.fila-color-amarillo td { background: #fffef2; }
.fila-color-naranja  td { background: #fff9f4; }
.fila-color-rojo     td { background: #fff5f5; }
.fila-color-sincolorimetría td { background: #f8f9fa; }

/* Filas de justificación */
.fila-justif td {
  border-bottom: 1px solid #f0f0f0;
  padding: 0;
}
.fila-justif-clickable {
  cursor: pointer;
  transition: background 0.12s;
}
.fila-justif-clickable:hover td {
  background: #f4f8ff;
}

/* Celda contenedora de toda la fila de justificación */
.cell-justif-row {
  padding: 5px 16px 5px 52px !important;
}

/* Layout horizontal: estatus | justif color | justif calificación */
.justif-inline {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

/* Columna del estatus */
.justif-estatus-col {
  flex: 0 0 auto;
  padding-top: 2px;
}

.badge-estatus-inline {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 100px;
  font-size: 0.68rem;
  font-weight: 600;
  background: #e8eaed;
  color: var(--muted);
  white-space: nowrap;
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.estatus-sin {
  background: #f1f3f4;
  color: #aaa;
  font-style: italic;
}

/* Columnas de texto de justificación */
.justif-text-col {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.justif-label {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--muted);
}

.justif-text {
  font-size: 0.72rem;
  color: var(--text);
  line-height: 1.4;
  white-space: pre-wrap;
  word-break: break-word;
}

/* Botón "Ver más / Ver menos" */
.ver-mas-btn {
  display: inline;
  background: none;
  border: none;
  padding: 0 0 0 4px;
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--primary);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
  line-height: inherit;
  vertical-align: baseline;
}
.ver-mas-btn:hover { color: var(--primary-hover); }

/* Separador visual en el form de filtros */
.filter-sep {
  color: var(--border);
  font-size: 1.2rem;
  line-height: 1;
  align-self: center;
  user-select: none;
}

/* ── Responsive ─────────────────────────────────────────────────── */
@media (max-width: 640px) {
  .hero { padding: 40px 0 24px; }
  .hero-graphic { display: none; }
  .login-card { margin: 40px auto; padding: 32px 24px; }
  .footer-inner { flex-direction: column; text-align: center; }
  .modal-grid { grid-template-columns: 1fr; }
  .modal-field:nth-child(odd) { border-right: none; padding-right: 0; }
  .modal-field:nth-child(even) { padding-left: 0; }
  .search-bar-row { flex-direction: column; }
  .filter-select, .search-input, .filter-date { width: 100%; }
  .audit-date-form { flex-direction: column; align-items: stretch; }
}
