/* =========================================================================
   SGP · Estilos del sistema (sobre Bootstrap 5.3)
   --brand se define por empresa (color corporativo) en el <head>.
   ========================================================================= */
:root {
  --brand: #2563eb;
  --brand-rgb: 37, 99, 235;
  --sidebar-w: 264px;
  --sidebar-w-collapsed: 76px;
  --topbar-h: 64px;
  --radius: 14px;
  --surface: #ffffff;
  --surface-2: #f5f6fa;
  --border-soft: #e7e9f0;
  --text-soft: #6b7280;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .06);
  --shadow: 0 8px 24px rgba(16, 24, 40, .08);
  --bs-primary: var(--brand);
  --bs-primary-rgb: var(--brand-rgb);
  --bs-link-color: var(--brand);
  --bs-link-color-rgb: var(--brand-rgb);
  --bs-body-font-family: "Inter", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  --bs-body-bg: var(--surface-2);
}
[data-bs-theme="dark"] {
  --surface: #161b26;
  --surface-2: #0e121a;
  --border-soft: #262d3b;
  --text-soft: #9aa3b2;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow: 0 8px 24px rgba(0, 0, 0, .45);
  --bs-body-bg: var(--surface-2);
  --bs-body-color: #e4e7ee;
  --bs-border-color: var(--border-soft);
  --bs-secondary-bg: #1d2331;
  --bs-tertiary-bg: #1a2030;
}
body { background: var(--surface-2); font-size: .94rem; -webkit-font-smoothing: antialiased; }

/* ---------- Botones y colores de marca ---------- */
.btn-primary {
  --bs-btn-bg: var(--brand); --bs-btn-border-color: var(--brand);
  --bs-btn-hover-bg: rgba(var(--brand-rgb), .88); --bs-btn-hover-border-color: rgba(var(--brand-rgb), .88);
  --bs-btn-active-bg: rgba(var(--brand-rgb), .8); --bs-btn-active-border-color: rgba(var(--brand-rgb), .8);
  --bs-btn-disabled-bg: var(--brand); --bs-btn-disabled-border-color: var(--brand);
}
.btn-outline-primary {
  --bs-btn-color: var(--brand); --bs-btn-border-color: var(--brand);
  --bs-btn-hover-bg: var(--brand); --bs-btn-hover-border-color: var(--brand);
  --bs-btn-active-bg: var(--brand); --bs-btn-active-border-color: var(--brand);
}
.btn-soft { background: rgba(var(--brand-rgb), .1); color: var(--brand); border: 0; }
.btn-soft:hover { background: rgba(var(--brand-rgb), .18); color: var(--brand); }
.btn { border-radius: 10px; }
.btn-icon { width: 40px; height: 40px; display: inline-flex; align-items: center; justify-content: center; border-radius: 10px; border: 0; color: inherit; background: transparent; }
.btn-icon:hover { background: rgba(var(--brand-rgb), .08); }
.text-primary { color: var(--brand) !important; }
.bg-primary { background-color: var(--brand) !important; }
.bg-brand-soft { background: rgba(var(--brand-rgb), .1) !important; color: var(--brand); }
.form-control, .form-select { border-radius: 10px; }
.form-control:focus, .form-select:focus { border-color: rgba(var(--brand-rgb), .6); box-shadow: 0 0 0 .2rem rgba(var(--brand-rgb), .15); }
.form-check-input:checked { background-color: var(--brand); border-color: var(--brand); }
.form-label { font-weight: 500; font-size: .85rem; margin-bottom: .3rem; }
.nav-pills .nav-link.active { background: var(--brand); }
.nav-pills .nav-link { color: inherit; border-radius: 10px; }
.page-link { color: var(--brand); }
.active > .page-link, .page-link.active { background: var(--brand); border-color: var(--brand); }

/* ---------- Layout del panel ---------- */
.layout { min-height: 100vh; }
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w); z-index: 1040;
  background: var(--surface); border-right: 1px solid var(--border-soft);
  display: flex; flex-direction: column; transition: width .22s ease, transform .22s ease;
}
.sidebar-brand { height: var(--topbar-h); display: flex; align-items: center; justify-content: space-between; padding: 0 14px; border-bottom: 1px solid var(--border-soft); }
.brand-link { display: flex; align-items: center; gap: 10px; text-decoration: none; color: inherit; min-width: 0; }
.brand-icon { width: 40px; height: 40px; border-radius: 12px; background: var(--brand); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 1.25rem; flex: 0 0 40px; }
.brand-logo { width: 40px; height: 40px; object-fit: contain; border-radius: 10px; flex: 0 0 40px; background: #fff; }
.brand-text { font-weight: 700; line-height: 1.1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-text small { display: block; font-weight: 400; font-size: .72rem; color: var(--text-soft); }
.sidebar-nav { flex: 1; overflow-y: auto; padding: 10px; scrollbar-width: thin; }
.nav-group { margin-bottom: 4px; }
.nav-group-toggle {
  width: 100%; display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 0; background: transparent;
  color: var(--text-soft); font-weight: 600; font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; border-radius: 10px; white-space: nowrap;
}
.nav-group-toggle:hover { background: rgba(var(--brand-rgb), .06); color: inherit; }
.nav-group-toggle > i:first-child { font-size: 1.05rem; }
.nav-group-toggle .chev { margin-left: auto; transition: transform .2s; font-size: .75rem; }
.nav-group.open .nav-group-toggle { color: var(--brand); }
.nav-group.open .nav-group-toggle .chev { transform: rotate(180deg); }
.nav-group-items { overflow: hidden; max-height: 0; transition: max-height .25s ease; }
.nav-group.open .nav-group-items { max-height: 800px; }
.nav-item {
  display: flex; align-items: center; gap: 12px; padding: 9px 12px 9px 22px; margin: 2px 0; border-radius: 10px;
  color: inherit; text-decoration: none; white-space: nowrap; font-weight: 500;
}
.nav-item i { font-size: 1.05rem; opacity: .8; }
.nav-item:hover { background: rgba(var(--brand-rgb), .07); }
.nav-item.active { background: var(--brand); color: #fff; box-shadow: 0 4px 12px rgba(var(--brand-rgb), .3); }
.nav-item.active i { opacity: 1; }
.sidebar-foot { padding: 10px 14px; border-top: 1px solid var(--border-soft); display: flex; align-items: center; gap: 8px; }

.main { margin-left: var(--sidebar-w); transition: margin-left .22s ease; min-width: 0; }
.topbar {
  position: sticky; top: 0; z-index: 1030; height: var(--topbar-h); display: flex; align-items: center; gap: 10px; padding: 0 16px;
  background: var(--surface); background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: blur(10px); border-bottom: 1px solid var(--border-soft);
}
.topbar-title { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; }
.topbar-title h1 { font-size: 1.15rem; font-weight: 700; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-actions { display: flex; align-items: center; gap: 4px; }
.user-chip { display: flex; align-items: center; gap: 8px; border: 0; padding: 4px 8px; }
.content { padding: 22px; max-width: 1600px; margin: 0 auto; outline: none; }
.page-loader { display: flex; justify-content: center; padding: 80px 0; }

/* Colapsado (escritorio): el contenido crece */
@media (min-width: 992px) {
  .layout.collapsed .sidebar { width: var(--sidebar-w-collapsed); }
  .layout.collapsed .main { margin-left: var(--sidebar-w-collapsed); }
  .layout.collapsed .sidebar .brand-text,
  .layout.collapsed .sidebar .nav-group-toggle span,
  .layout.collapsed .sidebar .nav-group-toggle .chev,
  .layout.collapsed .sidebar .nav-item span,
  .layout.collapsed .sidebar .sidebar-foot-text { display: none; }
  .layout.collapsed .sidebar .nav-item { padding-left: 12px; justify-content: center; }
  .layout.collapsed .sidebar .nav-group-toggle { justify-content: center; }
  /* Al pasar el mouse se despliega temporalmente sobre el contenido */
  .layout.collapsed .sidebar:hover { width: var(--sidebar-w); box-shadow: var(--shadow); }
  .layout.collapsed .sidebar:hover .brand-text,
  .layout.collapsed .sidebar:hover .nav-group-toggle span,
  .layout.collapsed .sidebar:hover .nav-group-toggle .chev,
  .layout.collapsed .sidebar:hover .nav-item span,
  .layout.collapsed .sidebar:hover .sidebar-foot-text { display: inline; }
  .layout.collapsed .sidebar:hover .nav-group-toggle .chev { display: inline-block; }
  .layout.collapsed .sidebar:hover .nav-item { padding-left: 22px; justify-content: flex-start; }
  .layout.collapsed .sidebar:hover .nav-group-toggle { justify-content: flex-start; }
  .sidebar-backdrop { display: none !important; }
}
/* Móvil y tablet: menú deslizable */
@media (max-width: 991.98px) {
  .sidebar { transform: translateX(-100%); box-shadow: var(--shadow); width: min(300px, 86vw); }
  .layout.mobile-open .sidebar { transform: none; }
  .main { margin-left: 0; }
  .sidebar-backdrop { position: fixed; inset: 0; background: rgba(0, 0, 0, .45); z-index: 1035; display: none; }
  .layout.mobile-open .sidebar-backdrop { display: block; }
  .content { padding: 14px; }
}

/* ---------- Tarjetas y componentes ---------- */
.card { border: 1px solid var(--border-soft); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-sm); }
.card-header { background: transparent; border-bottom: 1px solid var(--border-soft); padding: 14px 18px; font-weight: 600; }
.card-body { padding: 18px; }
.section-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.section-head h2 { font-size: 1.05rem; font-weight: 700; margin: 0; }
.section-head p { margin: 2px 0 0; color: var(--text-soft); font-size: .85rem; }
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.search-box { position: relative; min-width: 220px; flex: 1; }
.search-box i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-soft); }
.search-box input { padding-left: 36px; }

.kpi { display: flex; gap: 14px; align-items: center; padding: 18px; height: 100%; }
.kpi-icon { width: 48px; height: 48px; border-radius: 14px; display: flex; align-items: center; justify-content: center; font-size: 1.35rem; flex: 0 0 48px; }
.kpi-value { font-size: 1.55rem; font-weight: 700; line-height: 1.1; }
.kpi-label { color: var(--text-soft); font-size: .8rem; }
.tone-brand { background: rgba(var(--brand-rgb), .12); color: var(--brand); }
.tone-green { background: rgba(16, 185, 129, .13); color: #0e9f6e; }
.tone-amber { background: rgba(245, 158, 11, .15); color: #c27803; }
.tone-red { background: rgba(239, 68, 68, .13); color: #dc2626; }
.tone-sky { background: rgba(14, 165, 233, .13); color: #0284c7; }
.tone-violet { background: rgba(139, 92, 246, .14); color: #7c3aed; }

/* Listados responsivos (en lugar de tablas) */
.data-list { display: flex; flex-direction: column; gap: 10px; }
.data-row {
  background: var(--surface); border: 1px solid var(--border-soft); border-radius: 12px; padding: 12px 16px;
  transition: box-shadow .15s, border-color .15s;
}
.data-row:hover { border-color: rgba(var(--brand-rgb), .35); box-shadow: var(--shadow-sm); }
.data-row .cell-label { display: block; font-size: .7rem; text-transform: uppercase; letter-spacing: .04em; color: var(--text-soft); }
.data-row .row-title { font-weight: 600; }
.data-row .row-sub { color: var(--text-soft); font-size: .82rem; }
.row-actions { display: flex; gap: 4px; justify-content: flex-end; flex-wrap: wrap; }
@media (min-width: 768px) { .data-row .cell-label.md-hide { display: none; } }

.grid-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
.item-card { overflow: hidden; display: flex; flex-direction: column; }
.item-card .item-img { aspect-ratio: 16/10; background: linear-gradient(135deg, rgba(var(--brand-rgb), .25), rgba(var(--brand-rgb), .05)); display: flex; align-items: center; justify-content: center; color: var(--brand); font-size: 2.4rem; overflow: hidden; }
.item-card .item-img img { width: 100%; height: 100%; object-fit: cover; }
.item-card .card-body { flex: 1; }

.avatar { width: 40px; height: 40px; border-radius: 50%; background: rgba(var(--brand-rgb), .14); color: var(--brand); display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: .85rem; overflow: hidden; flex: 0 0 auto; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar-sm { width: 32px; height: 32px; font-size: .75rem; }
.avatar-lg { width: 64px; height: 64px; font-size: 1.2rem; }
.avatar-xl { width: 110px; height: 110px; font-size: 2rem; }

.badge-estado { font-weight: 600; padding: .4em .7em; border-radius: 999px; font-size: .72rem; }
.st-pendiente { background: rgba(245, 158, 11, .15); color: #b45309; }
.st-confirmada { background: rgba(14, 165, 233, .15); color: #0369a1; }
.st-atendida { background: rgba(16, 185, 129, .15); color: #047857; }
.st-cancelada { background: rgba(239, 68, 68, .14); color: #b91c1c; }
.st-no_asistio { background: rgba(107, 114, 128, .18); color: #4b5563; }
.st-abierto { background: rgba(245, 158, 11, .15); color: #b45309; }
.st-en_proceso { background: rgba(14, 165, 233, .15); color: #0369a1; }
.st-resuelto, .st-enviado, .st-respondida { background: rgba(16, 185, 129, .15); color: #047857; }
.st-cerrado, .st-cancelado, .st-borrador { background: rgba(107, 114, 128, .18); color: #4b5563; }
.st-error { background: rgba(239, 68, 68, .14); color: #b91c1c; }
.st-manual { background: rgba(139, 92, 246, .15); color: #6d28d9; }
[data-bs-theme="dark"] .badge-estado { filter: brightness(1.5); }

.empty-state { text-align: center; padding: 50px 20px; color: var(--text-soft); }
.empty-state i { font-size: 2.6rem; display: block; margin-bottom: 10px; opacity: .6; }

.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 10px; }
.gallery-item { position: relative; border-radius: 10px; overflow: hidden; aspect-ratio: 1; background: var(--surface-2); border: 1px solid var(--border-soft); }
.gallery-item img { width: 100%; height: 100%; object-fit: cover; cursor: zoom-in; }
.gallery-item .doc { display: flex; flex-direction: column; align-items: center; justify-content: center; height: 100%; padding: 8px; text-align: center; font-size: .72rem; text-decoration: none; color: inherit; word-break: break-all; }
.gallery-item .doc i { font-size: 2rem; color: var(--brand); }
.gallery-item .gallery-del { position: absolute; top: 4px; right: 4px; width: 26px; height: 26px; border-radius: 50%; border: 0; background: rgba(0, 0, 0, .55); color: #fff; font-size: .75rem; }

.photo-picker { display: flex; align-items: center; gap: 14px; }
.photo-picker .avatar { cursor: pointer; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; background: rgba(var(--brand-rgb), .1); color: var(--brand); font-size: .75rem; font-weight: 600; }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex: 0 0 10px; }

.timeline { position: relative; padding-left: 26px; }
.timeline::before { content: ""; position: absolute; left: 9px; top: 4px; bottom: 4px; width: 2px; background: var(--border-soft); }
.timeline-item { position: relative; margin-bottom: 16px; }
.timeline-item::before { content: ""; position: absolute; left: -22px; top: 6px; width: 12px; height: 12px; border-radius: 50%; background: var(--brand); box-shadow: 0 0 0 3px rgba(var(--brand-rgb), .2); }

/* Barras simples (indicadores) */
.bar-track { height: 8px; border-radius: 99px; background: rgba(var(--brand-rgb), .1); overflow: hidden; }
.bar-fill { height: 100%; border-radius: 99px; background: var(--brand); }
.mini-bars { display: flex; align-items: flex-end; gap: 6px; height: 140px; }
.mini-bars .mb { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; height: 100%; justify-content: flex-end; }
.mini-bars .mb-bar { width: 100%; max-width: 34px; background: var(--brand); border-radius: 4px 4px 0 0; min-height: 2px; }
.mini-bars .mb-label { font-size: .68rem; color: var(--text-soft); }
.mini-bars .mb-val { font-size: .7rem; font-weight: 600; }

/* Chat (WhatsApp, solicitudes, IA) */
.chat-box { display: flex; flex-direction: column; gap: 10px; padding: 16px; overflow-y: auto; background: var(--surface-2); border-radius: 12px; min-height: 320px; max-height: 60vh; }
.msg { max-width: 82%; padding: 10px 14px; border-radius: 14px; line-height: 1.45; white-space: pre-wrap; word-wrap: break-word; font-size: .9rem; }
.msg.in { align-self: flex-start; background: var(--surface); border: 1px solid var(--border-soft); border-bottom-left-radius: 4px; }
.msg.out { align-self: flex-end; background: var(--brand); color: #fff; border-bottom-right-radius: 4px; }
.msg.ai { align-self: flex-start; background: rgba(139, 92, 246, .1); border: 1px solid rgba(139, 92, 246, .25); border-bottom-left-radius: 4px; }
.msg .meta { display: block; font-size: .68rem; opacity: .7; margin-top: 4px; }
.typing span { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: currentColor; margin: 0 2px; animation: blink 1.2s infinite; opacity: .4; }
.typing span:nth-child(2) { animation-delay: .2s; } .typing span:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 50% { opacity: 1; } }

/* Notificaciones */
.notif-dot { position: absolute; top: 4px; right: 2px; min-width: 18px; height: 18px; padding: 0 4px; border-radius: 9px; background: #ef4444; color: #fff; font-size: .65rem; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.notif-menu { width: 340px; max-width: 92vw; padding: 0; border-radius: 14px; overflow: hidden; }
.notif-list { max-height: 360px; overflow-y: auto; }
.notif-item { display: flex; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--border-soft); text-decoration: none; color: inherit; font-size: .85rem; }
.notif-item:hover { background: rgba(var(--brand-rgb), .05); }
.notif-item.unread { background: rgba(var(--brand-rgb), .06); }

/* Select2 con Bootstrap 5 + modo oscuro */
.select2-container--bootstrap-5 .select2-selection { border-radius: 10px; min-height: 38px; }
[data-bs-theme="dark"] .select2-container--bootstrap-5 .select2-selection,
[data-bs-theme="dark"] .select2-container--bootstrap-5 .select2-dropdown { background-color: var(--bs-body-bg); color: var(--bs-body-color); border-color: var(--bs-border-color); }
[data-bs-theme="dark"] .select2-container--bootstrap-5 .select2-selection--single .select2-selection__rendered { color: var(--bs-body-color); }
[data-bs-theme="dark"] .select2-container--bootstrap-5 .select2-dropdown .select2-search .select2-search__field { background: var(--surface); color: var(--bs-body-color); border-color: var(--border-soft); }
[data-bs-theme="dark"] .select2-container--bootstrap-5 .select2-dropdown .select2-results__options .select2-results__option.select2-results__option--highlighted { background: var(--brand); color: #fff; }
.select2-container--bootstrap-5 .select2-dropdown .select2-results__options .select2-results__option.select2-results__option--selected { background: var(--brand); color: #fff; }

/* SweetAlert en modo oscuro */
[data-bs-theme="dark"] .swal2-popup { background: var(--surface); color: var(--bs-body-color); }
[data-bs-theme="dark"] .swal2-title, [data-bs-theme="dark"] .swal2-html-container { color: var(--bs-body-color); }
[data-bs-theme="dark"] .swal2-input, [data-bs-theme="dark"] .swal2-textarea, [data-bs-theme="dark"] .swal2-select { background: var(--surface-2); color: var(--bs-body-color); }
.swal2-popup { border-radius: 16px !important; font-family: var(--bs-body-font-family); }

.modal-content { border-radius: 16px; border: 0; }
[data-bs-theme="dark"] .modal-content { background: var(--surface); }
.modal-header { border-bottom-color: var(--border-soft); }
.modal-footer { border-top-color: var(--border-soft); }
.offcanvas { background: var(--surface); }

/* =========================================================================
   Pantallas de acceso (login, registro, recuperación) a pantalla completa
   ========================================================================= */
.auth-page { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; background: var(--surface); }
.auth-hero {
  position: relative; overflow: hidden; color: #fff; padding: 56px; display: flex; flex-direction: column; justify-content: space-between;
  background: radial-gradient(circle at 15% 20%, rgba(255, 255, 255, .18), transparent 40%),
              radial-gradient(circle at 85% 85%, rgba(255, 255, 255, .12), transparent 45%),
              linear-gradient(135deg, var(--brand), #1e3a8a 70%, #0f172a);
}
.auth-hero::after { content: ""; position: absolute; width: 520px; height: 520px; border-radius: 50%; border: 70px solid rgba(255, 255, 255, .06); right: -160px; top: -160px; }
.auth-evolean-logo { display: block; width: min(220px, 72vw); height: auto; margin: 0 0 28px; padding: 9px 12px; border-radius: 10px; background: #fff; }
.auth-hero h1 { font-size: clamp(1.8rem, 3vw, 2.7rem); font-weight: 800; line-height: 1.15; }
.auth-hero p { opacity: .85; font-size: 1.05rem; max-width: 520px; }
.auth-feats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; max-width: 560px; position: relative; z-index: 1; }
.auth-feat { background: rgba(255, 255, 255, .1); border: 1px solid rgba(255, 255, 255, .15); border-radius: 14px; padding: 14px; backdrop-filter: blur(4px); }
.auth-feat i { font-size: 1.3rem; }
.auth-feat b { display: block; margin-top: 4px; }
.auth-feat small { opacity: .8; }
.auth-form-side { display: flex; align-items: center; justify-content: center; padding: 40px 24px; overflow-y: auto; }
.auth-form { width: 100%; max-width: 430px; }
.auth-form h2 { font-weight: 800; font-size: 1.7rem; }
.auth-form .form-control, .auth-form .form-select { padding: .7rem .9rem; }
.auth-form .input-group-text { border-radius: 10px; background: var(--surface-2); }
.auth-form .input-group > .form-control { border-radius: 0 10px 10px 0; }
.auth-form .input-group > .form-control:not(:last-child) { border-radius: 0; }
.auth-form .input-group > .btn:last-child { border-radius: 0 10px 10px 0; }
.btn-social { display: flex; align-items: center; justify-content: center; gap: 10px; border: 1px solid var(--border-soft); background: var(--surface); padding: .65rem; font-weight: 600; }
.btn-social:hover { background: var(--surface-2); }
.divider-text { display: flex; align-items: center; gap: 12px; color: var(--text-soft); font-size: .8rem; margin: 18px 0; }
.divider-text::before, .divider-text::after { content: ""; flex: 1; height: 1px; background: var(--border-soft); }
.empresa-preview { display: none; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; background: rgba(var(--brand-rgb), .08); margin-bottom: 12px; }
.empresa-preview img { width: 36px; height: 36px; border-radius: 8px; object-fit: contain; background: #fff; }
.auth-theme { position: fixed; top: 14px; right: 14px; z-index: 5; }
.comunicado-html img { display: block; max-width: 100%; height: auto; margin: 1rem 0; border-radius: .5rem; }
.comunicado-html figure { max-width: 100%; margin: 1rem 0; }
.comunicado-html figcaption { color: var(--text-soft); font-size: .875rem; margin-top: .35rem; }
.maestro-evolean-logo { display: block; width: 185px; max-width: 100%; height: auto; margin: 0 auto 24px; }
@media (max-width: 991.98px) {
  .auth-page { grid-template-columns: 1fr; }
  .auth-hero { padding: 28px 22px; min-height: auto; }
  .auth-evolean-logo { width: min(180px, 62vw); margin-bottom: 20px; }
  .auth-hero .auth-feats, .auth-hero .hero-foot { display: none; }
  .auth-hero p { font-size: .95rem; margin-bottom: 0; }
  .auth-form-side { padding: 28px 18px 40px; align-items: flex-start; }
}

/* Utilidades */
.cursor-pointer { cursor: pointer; }
.text-soft { color: var(--text-soft) !important; }
.min-w-0 { min-width: 0; }
.fw-600 { font-weight: 600; }
.ls-tight { letter-spacing: -.01em; }
.hover-lift { transition: transform .15s, box-shadow .15s; }
.hover-lift:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.preview-img { max-width: 100%; max-height: 80vh; border-radius: 12px; }
.markdown p:last-child { margin-bottom: 0; }

/* ---------- Editor de horario semanal ---------- */
.horario-dia{display:flex;flex-wrap:wrap;align-items:center;gap:.75rem 1rem;padding:.65rem .25rem;border-bottom:1px solid var(--border-soft)}
.horario-dia:last-child{border-bottom:0}
.horario-dia .form-check{min-width:130px}
.horario-turnos{display:flex;flex-wrap:wrap;align-items:center;gap:.5rem 1rem;flex:1}
.horario-turnos .turno{display:flex;align-items:center;gap:.4rem}
.horario-turnos .turno input{width:132px}
.horario-dia .cerrado{display:none}
.horario-dia.off .horario-turnos{display:none}
.horario-dia.off .cerrado{display:inline}
/* ---------- Checklist de permisos ---------- */
.perm-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(220px,1fr));gap:.5rem}
.perm-item{display:flex;align-items:center;gap:.6rem;padding:.55rem .75rem;border:1px solid var(--border-soft);border-radius:.6rem;background:var(--surface-2);cursor:pointer}
.perm-item i.bi{color:var(--brand)}
.tabs-scroll{overflow-x:auto;flex-wrap:nowrap;white-space:nowrap}
/* Filas con columna flexible: avatar/ícono + texto + acciones en una sola línea */
.data-row:has(> .flex-fill) { display: flex; align-items: center; gap: 12px; }
.data-row > .flex-fill { min-width: 0; }

/* =========================================================================
   SGP · Componentes propios
   ========================================================================= */
.card.kpi { flex-direction: row; }
.fw-700 { font-weight: 700; }
.st-aprobado, .st-asistio, .st-activo, .st-vigente, .st-cerrada, .st-pagado, .st-ok, .st-entrada { background: rgba(16, 185, 129, .15); color: #047857; }
.st-tardanza, .st-por_vencer, .st-incompleto, .st-calculada, .st-suspendido { background: rgba(245, 158, 11, .16); color: #b45309; }
.st-falta, .st-rechazado, .st-vencido { background: rgba(239, 68, 68, .14); color: #b91c1c; }
.st-descanso, .st-feriado, .st-exonerado, .st-anulado, .st-cesado, .st-finalizado, .st-renovado, .st-sin_marca, .st-auto { background: rgba(107, 114, 128, .16); color: #4b5563; }
.st-vacaciones, .st-permiso, .st-licencia, .st-descanso_medico, .st-salida { background: rgba(14, 165, 233, .15); color: #0369a1; }
.st-trabajo_descanso, .st-trabajo_feriado { background: rgba(139, 92, 246, .15); color: #6d28d9; }
.colab-card .avatar-lg { flex: 0 0 64px; }
.colab-card .chip { font-size: .7rem; }
.cell-label { display: block; font-size: .7rem; text-transform: uppercase; letter-spacing: .04em; color: var(--text-soft); }

/* Calendario mensual de asistencia */
.cal-mes { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.cal-mes .dow { text-align: center; font-size: .72rem; font-weight: 700; color: var(--text-soft); text-transform: uppercase; }
.cal-dia { border: 1px solid var(--border-soft); border-radius: 10px; padding: 6px; min-height: 74px; background: var(--surface); font-size: .74rem; display: flex; flex-direction: column; gap: 2px; }
.cal-dia .n { font-weight: 700; font-size: .85rem; }
.cal-dia.vacio { background: transparent; border-style: dashed; opacity: .4; }
.cal-dia.hoy { border-color: var(--brand); box-shadow: 0 0 0 2px rgba(var(--brand-rgb), .2); }
.cal-dia[data-st] { border-left-width: 4px; }
.cal-dia[data-st=asistio] { border-left-color: #10b981; } .cal-dia[data-st=tardanza] { border-left-color: #f59e0b; }
.cal-dia[data-st=falta] { border-left-color: #ef4444; } .cal-dia[data-st=incompleto] { border-left-color: #f59e0b; }
.cal-dia[data-st=vacaciones], .cal-dia[data-st=permiso], .cal-dia[data-st=licencia], .cal-dia[data-st=descanso_medico] { border-left-color: #0ea5e9; }
.cal-dia[data-st=feriado], .cal-dia[data-st=descanso] { background: var(--surface-2); }
@media (max-width: 575.98px) { .cal-dia { min-height: 54px; padding: 4px; font-size: .62rem; } .cal-dia .det { display: none; } }

/* Matriz de asistencia (colaboradores x días) */
.matriz { overflow-x: auto; border: 1px solid var(--border-soft); border-radius: 12px; background: var(--surface); }
.matriz table { border-collapse: separate; border-spacing: 0; font-size: .75rem; min-width: 100%; }
.matriz th, .matriz td { padding: 6px 4px; text-align: center; border-bottom: 1px solid var(--border-soft); white-space: nowrap; }
.matriz th:first-child, .matriz td:first-child { position: sticky; left: 0; background: var(--surface); text-align: left; padding-left: 12px; z-index: 1; min-width: 190px; }
.matriz .m { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 6px; font-weight: 700; font-size: .68rem; cursor: pointer; }
.m-A { background: rgba(16,185,129,.18); color: #047857; } .m-T { background: rgba(245,158,11,.22); color: #b45309; } .m-F { background: rgba(239,68,68,.2); color: #b91c1c; }
.m-V, .m-P, .m-L, .m-D { background: rgba(14,165,233,.18); color: #0369a1; } .m-X, .m-Fe { background: var(--surface-2); color: var(--text-soft); }
.m-I { background: rgba(245,158,11,.12); color: #b45309; outline: 1px dashed #f59e0b; } .m-E { background: rgba(139,92,246,.18); color: #6d28d9; } .m-S { background: transparent; color: var(--text-soft); }

/* Marcación grande (portal y kiosco) */
.marcar-wrap { display: flex; flex-direction: column; align-items: center; gap: 14px; text-align: center; }
.reloj { font-size: clamp(2.6rem, 9vw, 4rem); font-weight: 800; letter-spacing: -.02em; line-height: 1; font-variant-numeric: tabular-nums; }
.btn-marcar { width: 210px; height: 210px; border-radius: 50%; border: 0; color: #fff; font-weight: 800; font-size: 1.25rem; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  background: radial-gradient(circle at 30% 25%, rgba(255,255,255,.35), transparent 45%), var(--brand); box-shadow: 0 18px 40px rgba(var(--brand-rgb), .45), inset 0 -6px 0 rgba(0,0,0,.12); transition: transform .12s; }
.btn-marcar i { font-size: 3.2rem; }
.btn-marcar:active { transform: scale(.96); }
.btn-marcar.salida { background: radial-gradient(circle at 30% 25%, rgba(255,255,255,.35), transparent 45%), #ea580c; box-shadow: 0 18px 40px rgba(234,88,12,.4), inset 0 -6px 0 rgba(0,0,0,.12); }
.btn-marcar:disabled { opacity: .6; }
.gps-chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; font-size: .8rem; font-weight: 600; background: var(--surface-2); }
.gps-chip.ok { background: rgba(16,185,129,.14); color: #047857; } .gps-chip.mal { background: rgba(239,68,68,.12); color: #b91c1c; }
.mapa { height: 260px; border-radius: 12px; overflow: hidden; border: 1px solid var(--border-soft); z-index: 0; }
.leaflet-container { font: inherit; }
[data-bs-theme="dark"] .leaflet-tile { filter: brightness(.75) contrast(1.1) saturate(.8); }

/* Ítems de planilla */
.boleta-cols { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 767.98px) { .boleta-cols { grid-template-columns: 1fr; } }
.linea { display: flex; justify-content: space-between; gap: 10px; padding: 5px 0; border-bottom: 1px dashed var(--border-soft); font-size: .85rem; }
.linea b { font-variant-numeric: tabular-nums; white-space: nowrap; }
.num { font-variant-numeric: tabular-nums; }
.table-sgp { font-size: .85rem; }
.table-sgp th { font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; color: var(--text-soft); background: var(--surface-2) !important; white-space: nowrap; }
.table-sgp td.num, .table-sgp th.num { text-align: right; }
.paso { display: flex; gap: 12px; align-items: flex-start; }
.paso > b { flex: 0 0 28px; height: 28px; border-radius: 50%; background: var(--brand); color: #fff; display: grid; place-items: center; font-size: .85rem; }

/* ---- Multiempresa: acceso y registro ---- */
.auth-sep { display: flex; align-items: center; gap: 12px; margin: 18px 0; color: var(--text-soft); font-size: .85rem; }
.auth-sep::before, .auth-sep::after { content: ""; flex: 1; height: 1px; background: var(--border-soft); }
.reg-choice { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.reg-choice input { position: absolute; opacity: 0; pointer-events: none; }
.reg-choice label { display: flex; flex-direction: column; gap: 4px; padding: 14px; border: 2px solid var(--border-soft); border-radius: 14px; cursor: pointer; background: var(--surface); height: 100%; }
.reg-choice label i { font-size: 1.4rem; color: var(--brand); }
.reg-choice label small { color: var(--text-soft); line-height: 1.3; }
.reg-choice input:checked + label { border-color: var(--brand); background: rgba(var(--brand-rgb), .06); }
.reg-choice input:focus-visible + label { outline: 2px solid var(--brand); outline-offset: 2px; }
.sunat-card { border-radius: 14px; padding: 14px 16px; background: var(--surface-2); border: 1px solid var(--border-soft); font-size: .9rem; }
.sunat-card.ok { background: rgba(16,185,129,.09); border-color: rgba(16,185,129,.35); }
.sunat-card.warn { background: rgba(245,158,11,.1); border-color: rgba(245,158,11,.4); }
.reg-paso { font: 700 .72rem/1 inherit; text-transform: uppercase; letter-spacing: .08em; color: var(--text-soft); margin: 22px 0 10px; }
.empresa-chip { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--border-soft); }
.empresa-chip .ic { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; background: rgba(var(--brand-rgb), .12); color: var(--brand); font-size: 1.2rem; flex: 0 0 auto; overflow: hidden; }
.empresa-chip .ic img { width: 100%; height: 100%; object-fit: contain; }

/* ---------- Inteligencia artificial ---------- */
.sin-ia [data-ia-only], .sin-correo [data-correo-only] { display: none !important; }
.btn-ia { background: linear-gradient(135deg, #7c3aed, #2563eb); color: #fff !important; border: 0; box-shadow: 0 4px 14px rgba(124, 58, 237, .25); }
.btn-ia:hover, .btn-ia:focus { filter: brightness(1.08); color: #fff; }
.btn-ia:disabled { opacity: .7; }
.ia-md { font-size: .95rem; line-height: 1.6; max-height: 62vh; overflow: auto; padding-right: 4px; }
.ia-md .ia-h { margin: 1rem 0 .4rem; font-weight: 700; }
.ia-md h4.ia-h { font-size: 1.05rem; } .ia-md h5.ia-h { font-size: .98rem; } .ia-md h6.ia-h { font-size: .92rem; }
.ia-md p { margin: 0 0 .6rem; } .ia-md ul, .ia-md ol { margin: 0 0 .7rem; padding-left: 1.3rem; } .ia-md li { margin-bottom: .2rem; }
.ia-md table { font-size: .85rem; }
.ia-nota { margin-top: 12px; font-size: .78rem; color: var(--text-soft, #6b7280); text-align: left; }
.ia-cargando { display: grid; justify-items: center; gap: 8px; padding: 18px 0; }
.ia-orb { width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; font-size: 1.8rem; color: #fff; background: linear-gradient(135deg, #7c3aed, #2563eb); animation: iaPulso 1.4s ease-in-out infinite; }
@keyframes iaPulso { 0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(124, 58, 237, .45); } 50% { transform: scale(1.06); box-shadow: 0 0 0 14px rgba(124, 58, 237, 0); } }
@media (prefers-reduced-motion: reduce) { .ia-orb { animation: none; } }
.chat { display: flex; flex-direction: column; gap: 12px; }
.chat-msg { max-width: 88%; padding: 10px 14px; border-radius: 16px; line-height: 1.55; font-size: .95rem; }
.chat-msg.yo { align-self: flex-end; background: var(--brand); color: #fff; border-bottom-right-radius: 4px; white-space: pre-wrap; }
.chat-msg.ia { align-self: flex-start; background: var(--surface-2, #f3f5fa); border: 1px solid var(--border-soft, #e3e8f0); border-bottom-left-radius: 4px; }
.chat-msg.ia p:last-child, .chat-msg.ia ul:last-child, .chat-msg.ia ol:last-child { margin-bottom: 0; }
.chat-sug { display: flex; flex-wrap: wrap; gap: 8px; }
.chat-sug button { border: 1px solid var(--border-soft, #e3e8f0); background: var(--surface, #fff); border-radius: 999px; padding: 6px 12px; font-size: .85rem; color: inherit; }
.chat-sug button:hover { border-color: var(--brand); color: var(--brand); }
.chat-escribiendo span { display: inline-block; width: 7px; height: 7px; margin: 0 2px; border-radius: 50%; background: currentColor; opacity: .4; animation: iaPunto 1s infinite; }
.chat-escribiendo span:nth-child(2) { animation-delay: .15s; } .chat-escribiendo span:nth-child(3) { animation-delay: .3s; }
@keyframes iaPunto { 50% { opacity: 1; transform: translateY(-3px); } }
.ia-md th { white-space: nowrap; } .ia-md td, .ia-md th { padding: .35rem .5rem; vertical-align: top; }
