/* Estilos del portal Billiken (mismo aspecto que los sistemas) */
* { box-sizing: border-box; }
body { margin: 0; background: #f4f6f9; color: #333; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif; }

.navbar { background: #131B85; color: #fff; padding: 14px 24px; display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; }
.nav-botones { display: flex; gap: 10px; flex-wrap: wrap; }
.navbar a { display: inline-flex; align-items: center; height: 36px; padding: 0 14px; border-radius: 4px; font-size: 0.9em; font-weight: 600; text-decoration: none; color: #fff; }
.btn-volver { background: #17a2b8; } .btn-volver:hover { background: #138496; }
.btn-roles { background: #046BD2; } .btn-roles:hover { background: #0453A6; }
.btn-logout { background: #dc3545; } .btn-logout:hover { background: #bd2130; }

.contenedor { padding: 0 30px; margin: 25px auto; max-width: 1200px; }
.caja { background: #fff; padding: 25px 30px; border-radius: 8px; box-shadow: 0 2px 8px rgba(0,0,0,.08); margin-bottom: 25px; }
.caja-chica { max-width: 520px; margin-left: auto; margin-right: auto; }
h2 { margin-top: 0; }
.subtitulo { color: #64748b; margin-top: -8px; }

/* Botones de los sistemas */
.grilla-sistemas { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 20px; margin-top: 20px; }
.tarjeta-sistema { display: block; background: #fff; border: 1px solid #e2e8f0; border-radius: 10px; padding: 28px 22px; text-decoration: none; box-shadow: 0 2px 6px rgba(0,0,0,.04); transition: transform .2s, box-shadow .2s, border-color .2s; }
.tarjeta-sistema:hover { transform: translateY(-3px); box-shadow: 0 6px 14px rgba(0,0,0,.08); border-color: #046BD2; }
.tarjeta-sistema h3 { margin: 0 0 8px 0; color: #046BD2; font-size: 1.35rem; }
.tarjeta-sistema p { margin: 0; color: #64748b; line-height: 1.4; }

/* Login */
.pantalla-login { display: flex; justify-content: center; align-items: center; min-height: 100vh; }
.login-container { background: #fff; padding: 30px; border-radius: 8px; box-shadow: 0 0 10px rgba(0,0,0,.1); width: 340px; }
.login-container h2 { text-align: center; }
.logo-login-contenedor { text-align: center; margin-bottom: 20px; }
.logo-login { max-width: 180px; max-height: 85px; }

/* Formularios */
.form-group { margin-bottom: 15px; }
.form-group label { display: block; font-weight: 600; margin-bottom: 5px; }
input[type=text], input[type=password], input[type=number], select, textarea { width: 100%; padding: 9px 10px; border: 1px solid #cbd5e1; border-radius: 4px; font: inherit; }
.grilla-campos { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 0 20px; align-items: end; }
.casilla, .form-group label.casilla { display: flex; align-items: center; gap: 8px; margin: 6px 0; font-weight: normal; }
.casilla input { width: auto; }
button, .boton { display: inline-block; padding: 10px 20px; background: #046BD2; color: #fff; border: none; border-radius: 4px; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; }
button:hover, .boton:hover { background: #0453A6; }
.boton-gris { background: #6b7280; } .boton-gris:hover { background: #4b5563; }
.login-container button { width: 100%; }

.mensaje-error { background: #fde8e8; color: #9b1c1c; border: 1px solid #f8b4b4; padding: 10px 14px; border-radius: 4px; margin-bottom: 15px; }
.mensaje-exito { background: #e6f4ea; color: #1e6b34; border: 1px solid #a7d7b5; padding: 10px 14px; border-radius: 4px; margin-bottom: 15px; }
.texto-gris { color: #64748b; font-size: 0.9em; }

/* Tablas */
table { width: 100%; border-collapse: collapse; font-size: 0.95em; }
th { background: #f1f5f9; text-align: left; padding: 10px; border-bottom: 2px solid #e2e8f0; }
td { padding: 9px 10px; border-bottom: 1px solid #e2e8f0; vertical-align: top; }
.etiqueta { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 0.8em; font-weight: 600; background: #e2e8f0; color: #334155; margin: 1px 2px; }
.etiqueta-activo { background: #dcfce7; color: #166534; }
.etiqueta-inactivo { background: #fee2e2; color: #991b1b; }
.etiqueta-admin { background: #dbeafe; color: #1e40af; }
.etiqueta-critica { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 0.8em; font-weight: 700; background: #fee2e2; color: #991b1b; cursor: help; }
.etiqueta-comun { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 0.8em; font-weight: 600; background: #dcfce7; color: #166534; }
.globo-aviso { display: inline-block; min-width: 1.4em; padding: 0 5px; margin-left: 4px; border-radius: 10px; background: #e11d48; color: #fff; font-size: 0.8em; font-weight: 700; line-height: 1.4em; text-align: center; }
.tabla-contenedor { overflow-x: auto; }

@media (max-width: 768px) { .contenedor { padding: 0 15px; } }

/* ==========================================================================
   PANTALLA DE INGRESO (diseño "Caramelos": colores y marcas de Billiken)
   Las letras están guardadas en assets/fonts: funcionan sin internet.
   ========================================================================== */
@font-face { font-family: "Fredoka"; font-weight: 600; font-display: swap; src: url("fonts/fredoka-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Fredoka"; font-weight: 700; font-display: swap; src: url("fonts/fredoka-latin-700-normal.woff2") format("woff2"); }
@font-face { font-family: "Nunito"; font-weight: 400; font-display: swap; src: url("fonts/nunito-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Nunito"; font-weight: 700; font-display: swap; src: url("fonts/nunito-latin-700-normal.woff2") format("woff2"); }

.ingreso { position: relative; min-height: 100vh; background: #131B85; overflow: hidden; font-family: Nunito, sans-serif;
           display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 28px; padding: 40px 16px; box-sizing: border-box; }

/* Caramelos y regalices de fondo (solo decoración) */
.caramelo { position: absolute; border-radius: 50%; }
.c1 { width: 70px;  height: 70px;  background: #FFC20E; top: 9%;   left: 9%; }
.c2 { width: 36px;  height: 36px;  background: #E6007E; top: 28%;  left: 20%; }
.c3 { width: 110px; height: 110px; background: #046BD2; bottom: 11%; left: 12%; }
.c4 { width: 48px;  height: 48px;  background: #3FAB00; bottom: 33%; left: 6%; }
.c5 { width: 90px;  height: 90px;  background: #DE0000; top: 14%;  right: 12%; }
.c6 { width: 40px;  height: 40px;  background: #FFC20E; top: 38%;  right: 7%; }
.c7 { width: 130px; height: 130px; background: #7B2FBE; bottom: 9%; right: 10%; }
.c8 { width: 30px;  height: 30px;  background: #3FAB00; bottom: 31%; right: 26%; }
.regaliz { position: absolute; width: 380px; height: 26px; border-radius: 13px; }
.r1 { left: -60px;  top: 48%; transform: rotate(24deg);
      background: repeating-linear-gradient(90deg, #DE0000 0 22px, #FFC20E 22px 44px, #3FAB00 44px 66px, #E6007E 66px 88px); }
.r2 { right: -70px; top: 59%; transform: rotate(-24deg);
      background: repeating-linear-gradient(90deg, #046BD2 0 22px, #FFC20E 22px 44px, #E6007E 44px 66px, #ffffff 66px 88px); }

.tarjeta-ingreso { position: relative; width: 100%; max-width: 440px; background: #fff; border-radius: 32px; padding: 40px 44px 36px;
                   box-sizing: border-box; display: flex; flex-direction: column; align-items: center; box-shadow: 0 18px 0 #0B1160; }
.tarjeta-ingreso img { width: 260px; max-width: 100%; height: auto; margin-bottom: 28px; }
.tarjeta-ingreso form { width: 100%; display: flex; flex-direction: column; gap: 16px; }
.tarjeta-ingreso .campo { display: flex; flex-direction: column; gap: 6px; }
.tarjeta-ingreso label { font-weight: 700; font-size: 14px; color: #131B85; margin: 0; }
.tarjeta-ingreso input { height: 50px; border: 2px solid #D5D9EE; border-radius: 25px; padding: 0 20px; font-family: Nunito, sans-serif;
                         font-size: 16px; color: #1B1F3B; box-sizing: border-box; width: 100%; }
.tarjeta-ingreso input:focus { outline: none; border-color: #046BD2; box-shadow: 0 0 0 3px rgba(4, 107, 210, 0.18); }
.tarjeta-ingreso button { height: 54px; margin-top: 8px; border: none; border-radius: 27px; background: #FFC20E; color: #131B85; width: 100%;
                          font-family: Fredoka, sans-serif; font-weight: 700; font-size: 20px; cursor: pointer; box-shadow: 0 5px 0 #C99600; }
.tarjeta-ingreso button:hover { background: #FFD54A; }
.tarjeta-ingreso button:active { transform: translateY(3px); box-shadow: 0 2px 0 #C99600; }
.tarjeta-ingreso .mensaje-error { width: 100%; box-sizing: border-box; border-radius: 14px; text-align: center; }

.marcas { position: relative; display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.marcas span { padding: 7px 16px; border-radius: 18px; font-family: Fredoka, sans-serif; font-weight: 600; font-size: 15px; color: #fff; }
.m-billiken { background: #fff; color: #131B85 !important; }
.m-yummy { background: #FFC20E; color: #131B85 !important; }
.m-bulldog { background: #DE0000; }
.m-gongys { background: #7B2FBE; }
.m-drf { background: #2E7D0F; }
.m-pinata { background: #E6007E; }

@media (max-width: 600px) {
  .regaliz, .c2, .c3, .c4, .c6, .c7, .c8 { display: none; }
  .tarjeta-ingreso { padding: 32px 24px 28px; }
}

/* ==========================================================================
   TEMA BILLIKEN para el resto del portal
   ========================================================================== */
body { font-family: Nunito, -apple-system, "Segoe UI", Roboto, Arial, sans-serif; background: #F3F5FB; }
h1, h2, h3 { font-family: Fredoka, Nunito, sans-serif; color: #131B85; }
.navbar { border-bottom: 6px solid #FFC20E;
          border-image: repeating-linear-gradient(90deg, #DE0000 0 40px, #FFC20E 40px 80px, #3FAB00 80px 120px, #046BD2 120px 160px, #E6007E 160px 200px) 6; }
.navbar strong { font-family: Fredoka, Nunito, sans-serif; font-weight: 600; }
.navbar a { border-radius: 18px; }
button, .boton { border-radius: 22px; font-family: Fredoka, Nunito, sans-serif; font-weight: 600; }
.caja { border-radius: 18px; box-shadow: 0 4px 16px rgba(19, 27, 133, 0.07); }
input[type=text], input[type=password], input[type=number], select, textarea { border-radius: 10px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: #046BD2; box-shadow: 0 0 0 3px rgba(4, 107, 210, 0.15); }
th { background: #EEF0FA; color: #131B85; border-bottom-color: #D5D9EE; }
.tarjeta-sistema { border-radius: 18px; border-top: 8px solid #046BD2; }
.tarjeta-sistema:nth-child(6n+2) { border-top-color: #FFC20E; }
.tarjeta-sistema:nth-child(6n+3) { border-top-color: #DE0000; }
.tarjeta-sistema:nth-child(6n+4) { border-top-color: #3FAB00; }
.tarjeta-sistema:nth-child(6n+5) { border-top-color: #7B2FBE; }
.tarjeta-sistema:nth-child(6n+6) { border-top-color: #E6007E; }
.tarjeta-sistema h3 { font-family: Fredoka, Nunito, sans-serif; font-weight: 700; color: #131B85; }
.tarjeta-sistema:hover { border-color: #046BD2; }
.bloque-sistema { border: 1px solid #E1E5F2; border-radius: 12px; padding: 8px 14px; margin: 8px 0; background: #FAFBFE; }
.grupos-sistema { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 18px; margin: 2px 0 4px 26px; }
.mensaje-info { background: #EAF3FD; border-left: 5px solid #046BD2; color: #131B85; padding: 12px 16px; border-radius: 10px; margin: 12px 0; }
.titulo-modulo-permisos { margin: 22px 0 8px; color: #046BD2; border-bottom: 2px solid #E1E5F2; padding-bottom: 5px; font-size: 1.05em; }
.contenedor-permisos { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 12px; background: #FAFBFE; border: 1px solid #E1E5F2; border-radius: 12px; padding: 14px 18px; }
.permiso-item { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; }
.permiso-item input[type="checkbox"] { width: 18px; height: 18px; margin-top: 3px; flex: none; }
.descripcion-permiso { display: block; font-size: 0.85em; color: #666; }
.form-eliminar { margin-top: 18px; text-align: right; }
.boton-rojo, button.boton-rojo { background: #DE0000; }
input[type=date] { width: 100%; padding: 8px 10px; border: 1px solid #cbd5e1; border-radius: 10px; font: inherit; }
.filtros { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 4px 14px; align-items: end; background: #FAFBFE; border: 1px solid #E1E5F2; border-radius: 12px; padding: 12px 16px; margin: 10px 0 14px; }
.filtros .form-group { margin-bottom: 8px; }
.filtros .filtro-texto { grid-column: span 2; }
.filtros-botones { display: flex; gap: 8px; margin-bottom: 8px; }
.barra-resultados { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.botones-exportar { display: flex; gap: 8px; }
.boton-verde { background: #3FAB00; } .boton-verde:hover { background: #318600; }
@media (max-width: 600px) { .filtros .filtro-texto { grid-column: auto; } }
.tabla-manuales { table-layout: fixed; }
.tabla-manuales td { vertical-align: middle; }
.tabla-manuales th:nth-child(2) { width: 80px; }
.tabla-manuales th:nth-child(3) { width: 100px; }
.tabla-manuales th:nth-child(4) { width: 120px; }
.tabla-manuales th:nth-child(5) { width: 110px; }.celda-copia { font-size: 0.9em; min-width: 190px; }
.botones-copia { display: flex; flex-direction: column; gap: 6px; margin-top: 6px; }
.botones-copia form { margin: 0; }
button.boton-chico { padding: 5px 12px; font-size: 0.85em; width: 100%; }
button.boton-naranja { background: #E87722; }
button.boton-naranja:hover { background: #C9620F; }
.detalle-copia { margin: 8px 0 0 18px; font-size: 0.92em; }
button.boton-grande { padding: 12px 28px; font-size: 1.05em; }
.botones-copia-fila { display: flex; flex-wrap: wrap; gap: 6px; }
.botones-copia-fila form { margin: 0; }
.botones-copia-fila button.boton-chico { width: auto; }
.navegador-carpetas { border: 1px solid #E1E5F2; border-radius: 12px; background: #FAFBFE; padding: 12px 16px; }
.ruta-actual { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; margin: 4px 0 10px; }
.ruta-actual a { font-weight: 600; }
.lista-carpetas { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 6px; max-height: 320px; overflow-y: auto; background: #fff; border: 1px solid #E1E5F2; border-radius: 10px; padding: 10px; }
.lista-carpetas a { padding: 4px 8px; border-radius: 8px; text-decoration: none; color: #131B85; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lista-carpetas a:hover { background: #EAF3FD; }
.acciones-carpeta { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-top: 12px; }
.acciones-carpeta form { margin: 0; display: flex; gap: 8px; align-items: center; }
.form-crear-carpeta input[type=text] { width: 220px; }

/* Respaldos: elegir carpeta */
.elegir-carpeta { margin-top: 1.4rem; border-top: 1px solid #e3e7f0; padding-top: 1rem; }
.elegir-carpeta summary { cursor: pointer; font-weight: 700; color: #1a237e; margin-bottom: .6rem; }
.opciones-carpeta { display: flex; flex-wrap: wrap; gap: .6rem; margin: .6rem 0 1rem; }
.opciones-carpeta form { margin: 0; }
.boton-carpeta { background: #eef3fd; color: #1a237e; border: 1px solid #c9d6f2; }
.boton-carpeta:hover { background: #dfe9fb; }
.boton-carpeta.actual { background: #e6f4ea; border-color: #9fd3ae; color: #1e5b2e; }
.form-otra-carpeta { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; margin-bottom: .4rem; }
.form-otra-carpeta label { font-weight: 600; margin: 0; }
.form-otra-carpeta input[type=text] { flex: 1; min-width: 240px; margin: 0; }
.aviso-chico { background: #fff8e1; border-left: 4px solid #f9a825; padding: .5rem .8rem; border-radius: 6px; margin: .4rem 0 .8rem; font-size: .92rem; }

/* Respaldos: estado del backup automático */
.estado-auto { padding: .6rem .9rem; border-radius: 8px; margin: .2rem 0 1rem; font-size: .95rem; border-left: 4px solid; }
.estado-auto.bien { background: #e8f5e9; border-color: #43a047; }
.estado-auto.mal { background: #fdecea; border-color: #e53935; }
.estado-auto.apagado { background: #f1f3f7; border-color: #9aa3b5; }
.casilla-linea { display: flex; align-items: center; gap: .5rem; font-weight: 600; }
.casilla-linea input { width: auto; margin: 0; }

/* Respaldos: tabla de módulos */
.tabla-modulos td { vertical-align: middle; }
.tabla-modulos tr.fila-general td { background: #eef3fd; border-top: 2px solid #c9d6f2; }
.tabla-modulos form { margin: 0; }
.filtro-modulos { font-size: .92rem; margin: .2rem 0 .6rem; }
.filtro-modulos a { text-decoration: none; }
.filtro-modulos a.activo { font-weight: 700; text-decoration: underline; }

/* Actualizaciones */
.tabla-estado { width: auto; margin-bottom: 1rem; }
.tabla-estado th { text-align: left; padding-right: 1.5rem; white-space: nowrap; background: none; }
.fila-botones { display: flex; flex-wrap: wrap; align-items: center; gap: .8rem; margin: .6rem 0 1rem; }
.aviso-actualizacion { border: 2px solid #c9d6f2; background: #f5f8fe; border-radius: 10px; padding: 1rem 1.2rem; margin: 1rem 0; }
.aviso-actualizacion h3 { margin-top: 0; }
.aviso-actualizacion details { margin: .8rem 0; }
.aviso-actualizacion summary { cursor: pointer; font-weight: 600; color: #1a237e; }
.lista-archivos { font-family: Consolas, monospace; font-size: .85rem; max-height: 260px; overflow: auto; }
.lista-archivos span { display: inline-block; min-width: 70px; font-family: inherit; font-size: .75rem; font-weight: 700; }
.estado-A { color: #1e7e34; } .estado-M { color: #1a56db; } .estado-D { color: #c62828; }
.texto-ok { color: #1e7e34; font-weight: 600; }
.texto-error { color: #c62828; font-weight: 600; }

/* ==========================================================================
   PANTALLAS ADAPTABLES (celular / tablet). Ver assets/adaptable.js
   ========================================================================== */
@media (max-width: 700px) {
    /* Tablas que no entran a lo ancho: cada fila es una tarjeta */
    table.como-tarjetas, table.como-tarjetas tbody, table.como-tarjetas tfoot { display: block; width: 100% !important; min-width: 0 !important; }
    table.como-tarjetas thead { display: none; }
    table.como-tarjetas tr { display: block; margin: 0 0 12px; padding: 8px 12px; background: #fff; border: 1px solid #dbe2ef; border-radius: 10px; box-shadow: 0 1px 3px rgba(19, 27, 133, 0.06); }
    table.como-tarjetas tfoot tr { background: #eef2fb; font-weight: 700; }
    table.como-tarjetas td { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: auto !important; min-width: 0 !important; max-width: none !important; padding: 6px 0 !important; border: none !important; border-bottom: 1px solid #f0f2f7 !important; text-align: right; white-space: normal !important; word-break: break-word; }
    table.como-tarjetas td:last-child { border-bottom: none !important; }
    table.como-tarjetas td::before { content: attr(data-label); flex: 0 0 42%; text-align: left; font-weight: 700; font-size: 0.85em; color: #475569; }
    table.como-tarjetas td[data-label=""]::before { display: none; }
    table.como-tarjetas td[data-label=""] { justify-content: flex-end; }
    table.como-tarjetas td.col-oculta, table.como-tarjetas td.celda-vacia::before { display: none; }
    table.como-tarjetas td.celda-vacia { justify-content: center; }
    table.como-tarjetas td input, table.como-tarjetas td select, table.como-tarjetas td textarea { flex: 1; min-width: 0; width: auto !important; }
    table.como-tarjetas td > .input-con-boton { flex: 1; min-width: 0; display: flex; gap: 6px; }
    table.como-tarjetas td .input-con-boton button { flex: 0 0 auto; }

    /* Campos cómodos para el dedo (y sin el zoom automático del iPhone) */
    input[type="text"], input[type="number"], input[type="date"], input[type="password"], input[type="email"], input[type="search"], select, textarea { font-size: 16px; max-width: 100%; }
    form select { width: 100%; }
    button, .boton, .btn { min-height: 40px; }
}

.menu-hamburguesa { display: none; background: none; border: 0; color: #fff; font-size: 28px; line-height: 1; padding: 4px 8px; cursor: pointer; }
@media (max-width: 700px) {
    .navbar { padding: 12px 16px; }
    .navbar > div:first-child { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .menu-hamburguesa { display: block; }
    .nav-botones { display: none; width: 100%; flex-direction: column; gap: 8px; }
    .nav-botones.mostrar { display: flex; }
    .nav-botones a { width: 100%; justify-content: center; height: 42px; }
    .caja { padding: 20px 16px; }
    .fila-botones { flex-wrap: wrap; }
    .fila-botones button, .boton-grande { width: 100%; }
}
