/* NemuBiz: tipografía Montserrat servida por img.php (este servidor solo deja pasar .php y .css). Paleta: Navy #0B2D5B, Blue #007AFF, Cyan #00C2E8, Green #22D68F, Light #F4F8FF. */
@font-face { font-family: "Montserrat"; font-style: normal; font-weight: 400 800; font-display: swap; src: url("img.php?f=fuente-ext") format("woff2");
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Montserrat"; font-style: normal; font-weight: 400 800; font-display: swap; src: url("img.php?f=fuente") format("woff2");
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
* { box-sizing: border-box; }
body { margin: 0; font-family: "Montserrat", "Segoe UI", Arial, Helvetica, sans-serif; background: #f4f8ff; color: #1f2a37; font-size: 13.5px; -webkit-font-smoothing: antialiased; }
.top { background: #0b2d5b linear-gradient(90deg, #007aff, #00c2e8, #22d68f) left bottom / 100% 3px no-repeat; color: #fff; padding: 0 20px; height: 54px; display: flex; align-items: center; justify-content: space-between; }
.marca { color: #fff; text-decoration: none; font-size: 20px; font-weight: 700; display: inline-flex; align-items: center; }
.marca img { height: 32px; width: auto; display: block; }
.marca span { color: #00c2e8; } .tk-presencia { font-size: 13px; margin: 10px 0 0; color: #6b7785; }
.tk-presencia i { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: #aab3c0; margin-right: 4px; }
.tk-presencia.on { color: #16803c; font-weight: 700; }
.tk-presencia.on i { background: #2ecc71; animation: tk-pulso 1.6s infinite; }
@keyframes tk-pulso { 70% { box-shadow: 0 0 0 7px rgba(46, 204, 113, 0); } 0% { box-shadow: 0 0 0 0 rgba(46, 204, 113, .6); } 100% { box-shadow: 0 0 0 0 rgba(46, 204, 113, 0); } }
.nuevo-msg { animation: tk-entra .5s ease-out; }
@keyframes tk-entra { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.tk-kpis { display: grid; grid-template-columns: repeat(6, 1fr); gap: 10px; margin-bottom: 16px; }
.tk-kpi { display: block; background: #fff; border: 1px solid #e1e6ee; border-top: 4px solid #c9d2df; border-radius: 10px; padding: 10px 12px; text-decoration: none; color: inherit; }
.tk-kpi:hover { box-shadow: 0 4px 12px rgba(16, 24, 40, .1); }
.tk-kpi b { display: block; font-size: 24px; color: #1f2a37; line-height: 1.1; } .tk-kpi span { font-size: 12px; color: #6b7785; }
.tk-kpi.k-info { border-top-color: #2f8fff; } .tk-kpi.k-warn { border-top-color: #e0a100; } .tk-kpi.k-bad { border-top-color: #d64545; } .tk-kpi.k-ok { border-top-color: #2e9e5b; }
.tk-kpi.pide b { color: #c0392b; }
.tk-prev { max-width: 460px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
tr.p-urgente td:first-child { box-shadow: inset 4px 0 0 #d64545; } tr.p-alta td:first-child { box-shadow: inset 4px 0 0 #e0a100; }
.top .der { display: flex; align-items: center; gap: 8px; }
.mas { position: relative; }
.mas summary { list-style: none; } .mas summary::-webkit-details-marker { display: none; }
.mas summary:after { content: ''; display: inline-block; margin-left: 7px; vertical-align: middle; border-left: 4px solid transparent; border-right: 4px solid transparent; border-top: 5px solid currentColor; }
.mas-lista { position: absolute; right: 0; top: 40px; z-index: 30; min-width: 230px; background: #fff; border-radius: 8px; box-shadow: 0 10px 28px rgba(15, 40, 80, .28); padding: 6px 0; }
.mas-lista a { display: block; padding: 10px 16px; color: #1f2a37; text-decoration: none; font-size: 13.5px; } .mas-lista a:hover { background: #e8f1ff; color: #0b2d5b; }
.top .btn { white-space: nowrap; }
.marca small { font-weight: 400; font-size: 13px; opacity: .8; margin-left: 8px; }
.cont { max-width: 1100px; margin: 0 auto; padding: 22px 16px 50px; }
.btn { display: inline-block; min-height: 34px; height: 34px; font-family: inherit; line-height: 32px; padding: 0 14px; border: 1px solid #c9d2df; border-radius: 6px; background: #fff; color: #1f2a37; text-decoration: none; cursor: pointer; font-size: 13px; }
.btn:hover { background: #f3f5f8; }
.btn-p { background: #007aff; border-color: #007aff; color: #fff; font-weight: 600; } .btn-p:hover { background: #0062cc; }
.btn-d { background: #c0392b; border-color: #c0392b; color: #fff; } .btn-d:hover { background: #a02f23; }
.btn-ok { background: #2e8b57; border-color: #2e8b57; color: #fff; } .btn-ok:hover { background: #257248; }
.btn-s { height: 28px; line-height: 26px; padding: 0 10px; font-size: 12px; }
.card { background: #fff; border: 1px solid #e1e6ee; border-radius: 10px; padding: 18px 20px; margin-bottom: 18px; box-shadow: 0 1px 2px rgba(16, 24, 40, .05); }
.card h2 { margin: 0 0 14px; font-size: 17px; color: #0b2d5b; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 12px; text-transform: uppercase; color: #6b7785; padding: 8px 10px; border-bottom: 2px solid #e1e6ee; }
td { padding: 10px; border-bottom: 1px solid #edf0f5; vertical-align: middle; }
tr:hover td { background: #f8fafc; }
td small { color: #6b7785; display: block; }
.badge { display: inline-block; padding: 3px 10px; border-radius: 12px; font-size: 12px; font-weight: 700; }
.b-ok { background: #e3f4ea; color: #1d6b40; } .b-warn { background: #fff1d0; color: #8a5a00; } .b-bad { background: #fde3e0; color: #a02f23; } .b-info { background: #e1effb; color: #0b2d5b; }
.aviso { border-radius: 8px; padding: 12px 16px; margin-bottom: 16px; } .aviso.ok { background: #e3f4ea; color: #1d6b40; } .aviso.err { background: #fde3e0; color: #a02f23; } .aviso.info { background: #e1effb; color: #0b2d5b; }
.fila { display: flex; flex-wrap: wrap; margin: 0 -8px; }
.campo { padding: 0 8px 12px; flex: 1 1 240px; min-width: 200px; }
.campo label { display: block; font-size: 12px; font-weight: 700; color: #4a5563; margin-bottom: 4px; }
.campo input, .campo select, .campo textarea { width: 100%; height: 36px; border: 1px solid #c9d2df; border-radius: 6px; padding: 0 10px; font-size: 14px; font-family: inherit; background: #fff; }
.campo textarea { height: 80px; padding: 8px 10px; }
.campo .ayuda { font-size: 12px; color: #6b7785; margin-top: 3px; }
.resumen { display: flex; flex-wrap: wrap; margin: 0 -8px 10px; }
.resumen > div { flex: 1 1 140px; margin: 0 8px 12px; background: #fff; border: 1px solid #e1e6ee; border-radius: 10px; padding: 12px 16px; }
.resumen b { display: block; font-size: 24px; color: #0b2d5b; } .resumen span { font-size: 12px; color: #6b7785; text-transform: uppercase; }
.login { max-width: 360px; margin: 10vh auto; }
.clave { font-family: monospace; font-size: 18px; background: #f3f5f8; border: 1px dashed #9aa5b5; border-radius: 6px; padding: 8px 12px; display: inline-block; user-select: all; }
.acciones form { display: inline; }
@media (max-width: 720px) { .ocultar-m { display: none; } }
.modulo { border: 1px solid #e1e6ee; border-radius: 8px; margin: 0 0 12px; padding: 8px 14px 10px; }
.modulo legend { padding: 0 6px; font-size: 14px; }
.modulo .mdesc { color: #6b7785; font-size: 12px; margin-bottom: 6px; }
.mpant label { display: inline-block; width: 49%; min-width: 230px; margin: 2px 0; font-size: 13px; vertical-align: top; }
/* Móvil: objetivo táctil de 44 px y texto de 16 px en los campos (con menos, iOS hace zoom al enfocar). */
@media (max-width: 760px) {
    .btn { height: 44px; min-height: 44px; line-height: 42px; }
    .btn-s { height: 36px; min-height: 36px; line-height: 34px; }
    .campo input, .campo select, .campo textarea { height: 44px; font-size: 16px; }
    .campo textarea { height: auto; }
    .mas-lista a { padding: 13px 16px; }
}

/* =====================================================================================================================
   CELULAR (hasta 900 px): el panel se usa como una app. Barra superior mínima, pestañas abajo (al alcance del pulgar) con una hoja para el resto
   del menú, tablas en forma de tarjetas, formularios de una columna y objetivos táctiles de 44 px. La computadora no cambia.
   ===================================================================================================================== */
.solo-mov { display: none; }
body { -webkit-tap-highlight-color: transparent; }
a, button, summary, input, select, textarea { touch-action: manipulation; }
.card code, .clave, td, .aviso, .campo .ayuda { overflow-wrap: anywhere; }

@media (max-width: 900px) {
    .solo-esc { display: none !important; }
    .solo-mov { display: flex; }

    /* Barra superior: logo + acción rápida; respeta la muesca (notch) cuando se instala como app */
    .top { position: sticky; top: 0; z-index: 40; height: calc(54px + env(safe-area-inset-top)); padding: env(safe-area-inset-top) calc(14px + env(safe-area-inset-right)) 0 calc(14px + env(safe-area-inset-left)); flex-wrap: nowrap; gap: 8px; }
    .marca small { display: none; }
    .top-nuevo { align-items: center; gap: 6px; min-height: 40px; padding: 0 14px; border-radius: 20px; background: #007aff; color: #fff; text-decoration: none; font-weight: 700; font-size: 14px; }
    .top-nuevo .ico { width: 18px; height: 18px; }

    /* Contenido: margen para que la barra de pestañas no tape lo último */
    .cont { padding: 14px calc(12px + env(safe-area-inset-right)) calc(92px + env(safe-area-inset-bottom)) calc(12px + env(safe-area-inset-left)); }
    body.sin-menu .cont { padding-bottom: 40px; }
    body { font-size: 15px; }
    .card { padding: 14px; border-radius: 12px; margin-bottom: 14px; }
    .card h2 { font-size: 17px; margin-bottom: 10px; }

    /* Barra de pestañas */
    .tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 45; background: #fff; border-top: 1px solid #dfe5ee; box-shadow: 0 -4px 18px rgba(11, 45, 91, .10); padding: 4px calc(6px + env(safe-area-inset-right)) calc(4px + env(safe-area-inset-bottom)) calc(6px + env(safe-area-inset-left)); justify-content: space-around; }
    .tab { position: relative; flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 54px; padding: 4px 2px; border: 0; background: transparent; color: #5b6b82; text-decoration: none; font: inherit; font-size: 11px; font-weight: 600; cursor: pointer; border-radius: 12px; }
    .tab span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .tab .ico { width: 24px; height: 24px; }
    .tab.act { color: #007aff; }
    .tab.act:before { content: ""; position: absolute; top: 0; left: 30%; right: 30%; height: 3px; border-radius: 0 0 3px 3px; background: #007aff; }
    .tab:active { background: #eef4ff; }
    .tab-n { position: absolute; top: 3px; left: calc(50% + 6px); min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: #e5484d; color: #fff; font-style: normal; font-size: 11px; font-weight: 700; line-height: 18px; text-align: center; }
    .tab-n[hidden] { display: none; }

    /* Hoja de «Más» */
    .hoja-vel { position: fixed; inset: 0; z-index: 48; background: rgba(8, 20, 40, .5); }
    .hoja-vel[hidden], .hoja[hidden] { display: none; }
    .hoja { position: fixed; left: 0; right: 0; bottom: 0; z-index: 49; background: #fff; border-radius: 18px 18px 0 0; padding: 8px 14px calc(14px + env(safe-area-inset-bottom)); max-height: 82vh; overflow-y: auto; box-shadow: 0 -10px 40px rgba(8, 20, 40, .35); animation: hoja-sube .22s ease-out; }
    @keyframes hoja-sube { from { transform: translateY(40px); opacity: .4; } to { transform: none; opacity: 1; } }
    .hoja-asa { width: 44px; height: 5px; border-radius: 3px; background: #d3dbe7; margin: 2px auto 10px; }
    .hoja-it { display: flex; align-items: center; gap: 10px; min-height: 52px; padding: 0 12px; border-radius: 12px; color: #1f2a37; text-decoration: none; font-size: 16px; font-weight: 600; }
    .hoja-it b { margin-left: auto; color: #9aa7ba; font-size: 22px; font-weight: 400; }
    .hoja-it:active, .hoja-it.act { background: #eef4ff; color: #0b2d5b; }
    .hoja-prim { background: #007aff; color: #fff; margin-bottom: 6px; }
    .hoja-prim:active { background: #0062cc; color: #fff; }
    .hoja-prim .ico { width: 20px; height: 20px; }
    .hoja-salir { margin-top: 6px; border-top: 1px solid #edf0f5; border-radius: 0 0 12px 12px; color: #b3261e; justify-content: center; }
    body.hoja-abierta { overflow: hidden; }

    /* Tarjetas de resumen */
    .tk-kpis { grid-template-columns: repeat(2, 1fr); gap: 10px; }
    .tk-kpi b { font-size: 26px; }
    .resumen { margin: 0 0 6px; gap: 10px; }
    .resumen > div { margin: 0; flex: 1 1 calc(50% - 5px); padding: 12px 14px; }
    .resumen b { font-size: 26px; }

    /* Formularios: una columna */
    .fila { margin: 0; }
    .campo { flex: 1 1 100%; min-width: 0; padding: 0 0 12px; }
    .campo label { font-size: 13px; }
    .mpant label { display: block; width: 100%; min-width: 0; padding: 6px 0; }
    .mpant input[type=checkbox], .campo input[type=checkbox], .campo input[type=radio] { width: 22px; height: 22px; }
    .login { margin: 6vh auto; max-width: none; }
    .acciones, .acciones form { display: block; }
    .acciones .btn { width: 100%; margin-bottom: 8px; }
    .btn { display: inline-flex; align-items: center; justify-content: center; }

    /* Tablas -> tarjetas (las marca el script de vista.php con .t-card y el nombre de cada columna) */
    table:not(.t-card) { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
    table.t-card, table.t-card tbody { display: block; width: 100%; }
    table.t-card thead { display: none; }
    table.t-card tr { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; background: #f9fbff; border: 1px solid #e1e8f3; border-radius: 12px; padding: 12px 14px 8px; margin: 0 0 12px; }
    table.t-card tr:hover td { background: transparent; }
    table.t-card td { display: block; min-width: 0; padding: 0 0 10px; border: 0; text-align: left; }
    table.t-card td.t-ancho { grid-column: 1 / -1; }
    table.t-card td:before { content: attr(data-label); display: block; font-size: 10.5px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: #6b7785; margin-bottom: 2px; }
    table.t-card td[data-label=""]:before { display: none; }
    table.t-card td:first-child { font-size: 16px; font-weight: 700; color: #0b2d5b; }
    table.t-card td:first-child:before { display: none; }
    table.t-card td:first-child small { font-weight: 400; font-size: 12.5px; }
    table.t-card td .btn, table.t-card td form, table.t-card td button { width: 100%; }
    table.t-card td.t-acc { display: flex; flex-wrap: wrap; gap: 8px; white-space: normal !important; }
    table.t-card td.t-acc form { flex: 1 1 120px; margin: 0; }
    table.t-card td.t-acc > .btn, table.t-card td.t-acc > a { flex: 1 1 120px; width: auto; }
    table.t-card td.t-acc form .btn, table.t-card td.t-acc form button { width: 100%; }
    table.t-card td .badge { white-space: normal; }
    table.t-card td small { display: block; }
    table.t-card tr.p-urgente { border-left: 4px solid #d64545; } table.t-card tr.p-alta { border-left: 4px solid #e0a100; }
    table.t-card tr.p-urgente td:first-child, table.t-card tr.p-alta td:first-child { box-shadow: none; }
    .tk-prev { max-width: none; white-space: normal; }
    .vs-tabla table { min-width: 0; }

    /* Tickets (chat) y otras pantallas */
    .tk-m { max-width: 96%; }
    .vs-2 { grid-template-columns: 1fr; }
    .vs-grafico { height: 150px; }
}
/* Secciones plegables (solo celular, en pantallas muy largas como el detalle de un cliente): se toca el título para abrir o cerrar */
@media (max-width: 900px) {
    .card.plegable > h2 { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 0; cursor: pointer; min-height: 32px; -webkit-user-select: none; user-select: none; }
    .card.plegable > h2:after { content: ""; flex: 0 0 auto; width: 9px; height: 9px; border-right: 2.5px solid #6b7c93; border-bottom: 2.5px solid #6b7c93; transform: rotate(45deg); transition: transform .15s; margin-right: 4px; }
    .card.plegable:not(.plegada) > h2 { margin-bottom: 12px; }
    .card.plegable:not(.plegada) > h2:after { transform: rotate(-135deg); }
    .card.plegable.plegada > *:not(h2) { display: none !important; }
    .card.plegable > h2:focus-visible { outline: 3px solid #007aff; outline-offset: 3px; border-radius: 6px; }
}
@media (max-width: 380px) { .tk-kpis { grid-template-columns: 1fr 1fr; } .tab { font-size: 10.5px; } }
