/* Ajustes sobre el kit gob.cl (los estilos base vienen de vendor/gob.cl). Colores del kit:
   primario #006fb3, terciario #0a132d, gris #a8b7c7. */
:root { --gob-azul: #006fb3; --gob-azul-osc: #0a132d; --gob-gris: #a8b7c7; --gob-fondo: #f4f7fb; }

/* --- Cabecera ------------------------------------------------------------------------ */
header { border-bottom: 1px solid #e6e9ee; }
nav.navbar { padding-top: 0; padding-bottom: 0; }
nav.navbar .navbar-brand { display: flex; align-items: center; margin-right: .75rem; }
.marca { display: flex; align-items: center; gap: .5rem; margin-right: auto; padding-left: .75rem; border-left: 1px solid #d5dbe3;
  font-family: "Roboto Slab", serif; font-size: 1.25rem; color: var(--gob-azul-osc); white-space: nowrap; text-decoration: none !important; }
.marca:hover { color: var(--gob-azul); }
nav.navbar .navbar-nav .nav-item .nav-link.usuario { color: #4a4a4a; font-size: .9rem; }
nav.navbar .navbar-nav .nav-item .nav-link.usuario:hover { text-decoration: none; color: #4a4a4a; }
.toolbar.toolbar-movil { width: auto; height: 38px; justify-content: flex-end; gap: 4px; margin-right: .25rem; }
.toolbar.toolbar-movil .toolbar-btn-group .toolbar-btn { margin-left: 4px; }
@media (max-width: 575.98px) {
  nav.navbar .container:has(.toolbar-movil.active) .marca { display: none; }
  .marca { font-size: 1rem; padding-left: .5rem; }
  .marca .badge { display: none; }
  nav.navbar .navbar-brand img { height: 40%; }
}
@media (max-width: 991.98px) {
  nav.navbar .navbar-collapse .navbar-nav { padding: .5rem 0 1rem; border-top: 1px solid #e6e9ee; }
}

/* --- Estructura -------------------------------------------------------------------------- */
.encabezado { padding: 1.5rem 0 .75rem; }
#salud { margin-bottom: .75rem; }
.encabezado .line { max-width: 360px; }
@media (max-width: 575.98px) { .encabezado { padding: 1rem 0 .75rem; } .encabezado h1 { font-size: 1.5rem; } .encabezado p { font-size: .9rem; } }
.formulario { max-width: 760px; }
.nav-tabs { flex-wrap: nowrap; overflow-x: auto; overflow-y: hidden; scrollbar-width: thin; -webkit-overflow-scrolling: touch; }
.nav-tabs .nav-link { background: none; border-top: 0; border-left: 0; border-right: 0; cursor: pointer; white-space: nowrap; }
.tab-content { padding-top: 1.5rem !important; }
.cita { font-size: .9em; border-left: 3px solid var(--gob-azul); padding-left: 8px; margin: 6px 0; color: #4a4a4a; }
.table-sm td, .table-sm th { vertical-align: top; }
.skip:focus { position: absolute; z-index: 2000; background: #fff; padding: 8px; }

/* --- Casos: lista + asistente tipo chat --------------------------------------------- */
.casos-lista { max-height: 65vh; overflow-y: auto; }
.casos-lista .list-group-item { font-size: .9rem; }
.casos-lista .list-group-item.active small { color: #fff; }
.vacio { border: 1px dashed #c4c4c4; border-radius: 4px; padding: 2rem; color: #4a4a4a; }
.wizard fieldset { border: 1px solid #e0e0e0; border-radius: 4px; padding: 1rem 1.25rem .5rem; margin-bottom: 1rem; }
.wizard legend { width: auto; padding: 0 .5rem; font-size: 1.05rem; }
.paso { display: inline-block; width: 1.6em; height: 1.6em; line-height: 1.6em; text-align: center; border-radius: 50%; background: var(--gob-azul); color: #fff; font-size: .85em; margin-right: .25rem; }
.seleccion { max-height: 240px; overflow-y: auto; border: 1px solid #eee; border-radius: 4px; padding: .5rem .75rem; }
.seleccion .custom-control { margin-bottom: .35rem; }
.chat-cabecera { display: flex; justify-content: space-between; align-items: flex-start; flex-wrap: wrap; gap: .5rem; border-bottom: 2px solid var(--gob-azul); padding-bottom: .5rem; }
.chat-acciones .btn { margin-left: .25rem; }
.chat-ctx { background: #f6f8fb; border-radius: 4px; padding: .75rem 1rem; margin-top: .5rem; font-size: .9rem; }
.mensajes { height: calc(100vh - 380px); min-height: 340px; overflow-y: auto; padding: 1rem .25rem; background: #fafafa; }
.msg { display: flex; margin-bottom: 1rem; }
.msg-usuario { justify-content: flex-end; }
.msg-usuario .burbuja { background: var(--gob-azul); color: #fff; max-width: 75%; border-radius: 12px 12px 2px 12px; }
.msg-asistente .burbuja { background: #fff; border: 1px solid #e3e3e3; max-width: 88%; border-radius: 12px 12px 12px 2px; }
.burbuja { padding: .75rem 1rem; }
.burbuja p { margin-bottom: .5rem; } .burbuja ul { padding-left: 1.2rem; margin-bottom: .5rem; } .burbuja li { margin-bottom: .35rem; }
.burbuja > :last-child { margin-bottom: 0; }
.avatar { flex: 0 0 34px; height: 34px; border-radius: 50%; background: #e8eef6; color: var(--gob-azul); font-weight: 700; font-size: .75rem; display: flex; align-items: center; justify-content: center; margin-right: .5rem; }
.msg-sistema { justify-content: center; font-size: .85rem; color: #6c757d; text-align: center; }
.msg-pie { font-size: .75rem; color: #8a8a8a; margin-top: .5rem; }
a.ref { display: inline-block; min-width: 1.35em; padding: 0 .3em; margin: 0 1px; font-size: .75em; line-height: 1.5; vertical-align: super; text-align: center; border-radius: 3px; background: var(--gob-azul); color: #fff !important; text-decoration: none; }
a.ref:hover, a.ref:focus { background: var(--gob-azul-osc); }
.citas { border-top: 1px solid #eee; margin-top: .5rem; padding-top: .5rem; }
.citas-titulo { font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; color: #6c757d; margin-bottom: .25rem; }
.cita-item { display: flex; gap: .5rem; font-size: .85rem; color: #333 !important; text-decoration: none !important; padding: .35rem .25rem; border-radius: 4px; }
.cita-item:hover, .cita-item:focus { background: #f0f5fb; }
.cita-item .num { flex: 0 0 1.6em; height: 1.6em; border-radius: 3px; background: #e8eef6; color: var(--gob-azul); font-weight: 700; text-align: center; }
.escribiendo::after { content: " ●"; animation: parpadeo 1s infinite; }
@keyframes parpadeo { 50% { opacity: .2; } }
.composer { border-top: 1px solid #e3e3e3; padding-top: .75rem; }
.composer-fila { display: flex; gap: .5rem; align-items: flex-end; }
.composer-fila textarea { resize: vertical; }
.clip { cursor: pointer; }
.adjunto { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; background: #f6f8fb; padding: .5rem; border-radius: 4px; margin-bottom: .5rem; font-size: .9rem; }
.adjunto select { width: auto; }
.fragmento { padding: .25rem .5rem; border-left: 3px solid transparent; }
.fragmento.resaltado { background: #fff8e1; border-left-color: #e0701e; }
mark { background: #ffe08a; padding: 0; }
.composer-fila .btn { flex: 0 0 auto; white-space: nowrap; }

@media (max-width: 991.98px) {
  .casos-lista { max-height: 28vh; }
  .mensajes { height: 58vh; min-height: 300px; }
}
@media (max-width: 575.98px) {
  .msg-usuario .burbuja, .msg-asistente .burbuja { max-width: 100%; }
  .avatar { display: none; }
  .burbuja { padding: .6rem .75rem; }
  .chat-acciones { width: 100%; display: flex; flex-wrap: wrap; gap: .25rem; }
  .chat-acciones .btn { margin-left: 0; }
  .composer-fila { flex-wrap: wrap; }
  .composer-fila textarea { flex: 1 1 calc(100% - 60px); order: 1; }
  .composer-fila .clip { order: 0; }
  .composer-fila #chat-enviar { order: 2; width: 100%; }
  .wizard fieldset { padding: .75rem .75rem .25rem; }
  .modal-dialog { margin: .5rem; }
}

/* --- Visor y vista previa --------------------------------------------------------------- */
.visor-pestanas { margin-bottom: 1rem; }
.vista-pdf { width: 100%; height: 70vh; border: 1px solid #e3e3e3; }
.vista-texto { white-space: pre-wrap; font-family: inherit; font-size: .95rem; background: var(--gob-fondo); padding: 1rem; border-radius: 4px; max-height: 70vh; overflow: auto; }
.vista-doc { background: #fff; border: 1px solid #e3e3e3; padding: 1.5rem; max-height: 70vh; overflow: auto; }
.vista-doc table, .vista-hoja table { font-size: .85rem; }
.vista-hoja { max-height: 65vh; overflow: auto; border: 1px solid #e3e3e3; }
.vista-hoja th { position: sticky; top: 0; background: var(--gob-fondo); }
.vista-hoja td, .vista-hoja th { white-space: nowrap; }
.progress-fino { height: 6px; }

/* --- Login centrado ------------------------------------------------------------- */
.login { padding: 3rem 0 4rem; }
.login-card { border-top: 4px solid var(--gob-azul); box-shadow: 0 2px 12px rgba(10, 19, 45, .08); }
.login-card .card-body { padding: 2rem; }
@media (max-width: 575.98px) { .login { padding-top: 1.5rem; } .login-card .card-body { padding: 1.25rem; } }

/* --- Menú de secciones: pestañas con desplegables (sin recorte de los menús) -------- */
.nav-tabs.menu-secciones { flex-wrap: wrap; overflow: visible; }
.menu-secciones .dropdown-menu { margin-top: 0; border-top: 3px solid var(--gob-azul); min-width: 15rem; }
.menu-secciones .dropdown-item { cursor: pointer; }
.menu-secciones .dropdown-item.active, .menu-secciones .dropdown-item:active,
#nav-principal .dropdown-item.active { background: var(--gob-azul); color: #fff; }
.menu-secciones .nav-link.dropdown-toggle.active { color: var(--gob-azul); border-bottom-color: var(--gob-azul); }
#nav-principal .usuario.dropdown-toggle { cursor: pointer; }
@media (max-width: 575.98px) { .menu-secciones .nav-link { padding: .5rem .6rem; font-size: .95rem; } }

/* --- Paneles con gráficos ---------------------------------------------------------- */
.kpi { background: #fff; border: 1px solid #dde3ea; border-left: 4px solid var(--gob-gris); border-radius: 4px; padding: .75rem .9rem; height: 100%; }
.kpi-valor { font-family: "Roboto Slab", serif; font-size: 1.35rem; font-weight: 700; color: var(--gob-azul-osc); line-height: 1.2; word-break: break-word; }
.kpi-etiqueta { font-size: .8rem; color: #5f6a7d; margin-top: .2rem; }
.kpi-ok { border-left-color: #2d717c; } .kpi-mal { border-left-color: #fe6565; } .kpi-destacado { border-left-color: var(--gob-azul); }
.titulo-grafico { color: var(--gob-azul-osc); font-weight: 700; margin-bottom: .75rem; }
.grafico { position: relative; height: 260px; }
.grafico-alto { height: 340px; }
@media (max-width: 575.98px) { .grafico { height: 240px; } .grafico-alto { height: 300px; } .kpi-valor { font-size: 1.1rem; } }
.matriz td, .matriz th { text-align: center; }
.matriz td.diag { font-weight: 700; outline: 2px solid var(--gob-azul-osc); outline-offset: -2px; }
.calor-0 { background: #fff; } .calor-1 { background: #e3eef8; } .calor-2 { background: #b9d5ee; }
.calor-3 { background: #7fb2de; } .calor-4 { background: #3a8bc9; color: #fff; } .calor-5 { background: #006fb3; color: #fff; }
