:root{--bg:#050510;--card:#0e1025;--card2:#151735;--line:#2e53ff;--text:#fff;--muted:#9fb7ff;--ok:#00d68f;--danger:#ff4d6d;--warn:#d4a100;--blue:#0066ff;--radius:16px}*{box-sizing:border-box}body{margin:0;background:radial-gradient(circle at top,#0d1d4f,#050510 42%);color:var(--text);font-family:Inter,Segoe UI,Arial,sans-serif}.login-body{min-height:100vh;display:grid;place-items:center}.login-card{width:min(420px,92vw);background:rgba(14,16,37,.94);border:1px solid rgba(46,83,255,.45);border-radius:24px;box-shadow:0 0 38px rgba(0,102,255,.28);padding:32px}.login-logo{width:180px;display:block;margin:0 auto 16px;filter:drop-shadow(0 0 14px white)}h1,h2,h3{margin-top:0}.login-card p,.muted{color:var(--muted)}label{display:block;margin:14px 0 8px;color:var(--text);font-weight:600}input,select,textarea{width:100%;border:1px solid #253269;background:#090b1d;color:#fff;border-radius:12px;padding:12px;font:inherit}textarea{min-height:80px;resize:vertical}.btn{border:0;border-radius:12px;padding:11px 16px;font-weight:800;cursor:pointer;color:#fff;background:#2a2f66}.btn.primary{background:linear-gradient(135deg,#0066ff,#4169e1)}.btn.success{background:linear-gradient(135deg,#008f68,#00b985)}.btn.danger{background:linear-gradient(135deg,#ff4d6d,#c90035)}.btn.ghost{background:transparent;border:1px solid #3852a3}.btn.full{width:100%;margin-top:14px}.message,.alert{margin-top:14px;padding:12px;border-radius:12px}.message.error,.alert.error{background:rgba(255,77,109,.15);border:1px solid var(--danger)}.alert.ok{background:rgba(0,214,143,.15);border:1px solid var(--ok)}.hidden{display:none!important}.topbar{height:72px;display:flex;align-items:center;justify-content:space-between;padding:0 22px;background:#07091a;border-bottom:1px solid #253269;position:sticky;top:0;z-index:5}.brand{display:flex;align-items:center;gap:12px;font-weight:900}.brand img{height:46px;filter:drop-shadow(0 0 10px white)}.user-area{display:flex;align-items:center;gap:12px;color:var(--muted)}.tabs{display:flex;background:#0b0d21;border-bottom:1px solid #253269;overflow:auto}.tab{flex:1;min-width:120px;background:transparent;color:var(--muted);border:0;padding:16px;cursor:pointer;font-weight:800}.tab.active{color:#fff;background:#151735;box-shadow:inset 0 -3px 0 var(--blue)}.container{max-width:1420px;margin:0 auto;padding:28px}.section{display:none}.section.active{display:block}.section-head{display:flex;align-items:center;justify-content:space-between;gap:12px;flex-wrap:wrap}.stats-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(220px,1fr));gap:18px}.stat{background:rgba(14,16,37,.92);border:1px solid rgba(46,83,255,.35);border-radius:var(--radius);padding:24px;box-shadow:0 0 24px rgba(0,102,255,.15)}.stat strong{display:block;font-size:42px;color:#4f7cff}.stat span{color:var(--muted);text-transform:uppercase;font-size:13px;font-weight:900}.search{margin:14px 0 18px}.table-wrap{overflow:auto;background:rgba(14,16,37,.9);border:1px solid rgba(46,83,255,.3);border-radius:var(--radius)}table{width:100%;border-collapse:collapse;min-width:850px}th,td{padding:13px;border-bottom:1px solid #242a55;text-align:left;vertical-align:top}th{background:linear-gradient(135deg,#000080,#4169e1);color:#bdf6ff}td{background:#0d0f22}.badge{display:inline-block;padding:5px 10px;border-radius:999px;font-size:12px;font-weight:900}.Disponible{background:rgba(0,214,143,.14);color:#00ffab}.Prestado{background:rgba(65,105,225,.18);color:#8aa1ff}.Mantenimiento,.Con-detalles{background:rgba(212,161,0,.16);color:#ffd66b}.Baja,.Extraviado,.Vencido,.Cancelado{background:rgba(255,77,109,.16);color:#ff8aa0}.thumb{width:52px;height:42px;object-fit:cover;border-radius:8px;border:1px solid #33407a}.dialog{border:1px solid #2e53ff;border-radius:18px;background:#0e1025;color:#fff;max-width:760px;width:min(92vw,760px);box-shadow:0 0 60px rgba(0,0,0,.7)}.dialog::backdrop{background:rgba(0,0,0,.72);backdrop-filter:blur(4px)}.grid2{display:grid;grid-template-columns:repeat(2,1fr);gap:12px}.dialog-actions{display:flex;justify-content:flex-end;gap:10px;margin-top:18px}.codebox{background:#080a18;border:1px solid #253269;border-radius:14px;padding:16px;max-height:360px;overflow:auto}.bot-box{display:flex;gap:10px}.bot-box .search{margin:0}.bot-answer{margin-top:16px;background:rgba(14,16,37,.9);border:1px solid #253269;border-radius:14px;padding:18px}.actions{display:flex;gap:8px;flex-wrap:wrap}@media(max-width:760px){.grid2{grid-template-columns:1fr}.topbar{height:auto;gap:12px;align-items:flex-start;flex-direction:column;padding:14px}.bot-box{flex-direction:column}}
/* =========================================================
   WAYBOT V2 - CHATBOT FLOTANTE CON TARJETAS
========================================================= */

.waybot-toggle {
    position: fixed;
    right: 24px;
    bottom: 24px;
    width: 68px;
    height: 68px;
    border: none;
    border-radius: 50%;
    background: linear-gradient(135deg, #0066ff, #4169e1);
    color: #fff;
    cursor: pointer;
    z-index: 3000;
    box-shadow: 0 18px 45px rgba(0, 102, 255, 0.42);
    display: grid;
    place-items: center;
    transition: transform 0.22s ease, box-shadow 0.22s ease;
}

.waybot-toggle:hover {
    transform: translateY(-3px) scale(1.04);
    box-shadow: 0 22px 55px rgba(0, 102, 255, 0.55);
}

.waybot-icon {
    position: relative;
    z-index: 2;
    font-size: 29px;
}

.waybot-pulse {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: rgba(0, 191, 255, 0.25);
    animation: waybotPulse 2.3s infinite;
}

@keyframes waybotPulse {
    0% {
        transform: scale(1);
        opacity: 0.85;
    }
    70% {
        transform: scale(1.35);
        opacity: 0;
    }
    100% {
        transform: scale(1.35);
        opacity: 0;
    }
}

.waybot-mini-greeting {
    position: fixed;
    right: 24px;
    bottom: 104px;
    max-width: 270px;
    background: rgba(8, 13, 32, 0.96);
    border: 1px solid rgba(65, 105, 225, 0.38);
    color: #fff;
    border-radius: 18px;
    padding: 13px 15px;
    box-shadow: 0 18px 44px rgba(0, 0, 0, 0.35);
    z-index: 2999;
    display: flex;
    flex-direction: column;
    gap: 4px;
    opacity: 0;
    pointer-events: none;
    transform: translateY(10px);
    transition: 0.25s ease;
}

.waybot-mini-greeting.show {
    opacity: 1;
    transform: translateY(0);
}

.waybot-mini-greeting span {
    color: #b9caff;
    font-size: 13px;
}

.waybot-panel {
    position: fixed;
    right: 24px;
    bottom: 104px;
    width: 410px;
    height: 620px;
    max-width: calc(100vw - 28px);
    max-height: calc(100vh - 132px);
    background: linear-gradient(180deg, #0b1025 0%, #050814 100%);
    border: 1px solid rgba(65, 105, 225, 0.4);
    border-radius: 24px;
    box-shadow: 0 28px 80px rgba(0, 0, 0, 0.55);
    z-index: 3001;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    opacity: 0;
    transform: translateY(18px) scale(0.98);
    pointer-events: none;
    transition: 0.25s ease;
}

.waybot-panel.open {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

.waybot-header {
    padding: 16px 18px;
    background: rgba(255, 255, 255, 0.025);
    border-bottom: 1px solid rgba(65, 105, 225, 0.22);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.waybot-id {
    display: flex;
    align-items: center;
    gap: 12px;
}

.waybot-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, #0066ff, #00bfff);
    box-shadow: 0 0 22px rgba(0, 191, 255, 0.28);
    font-size: 23px;
}

.waybot-header h3 {
    margin: 0;
    color: #fff;
    font-size: 18px;
}

.waybot-header p {
    margin: 3px 0 0;
    color: #9db7ff;
    font-size: 13px;
}

.waybot-close {
    border: none;
    background: transparent;
    color: #eaf0ff;
    font-size: 30px;
    cursor: pointer;
    line-height: 1;
}

.waybot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    scroll-behavior: smooth;
}

.waybot-message {
    display: flex;
}

.waybot-message.bot {
    justify-content: flex-start;
}

.waybot-message.user {
    justify-content: flex-end;
}

.waybot-bubble {
    max-width: 92%;
    border-radius: 18px;
    padding: 12px 14px;
    line-height: 1.5;
    font-size: 14px;
    word-break: break-word;
}

.waybot-bubble p {
    margin: 0;
    white-space: pre-line;
}

.waybot-message.bot .waybot-bubble {
    color: #f7f9ff;
    background: rgba(255, 255, 255, 0.065);
    border: 1px solid rgba(65, 105, 225, 0.20);
    border-bottom-left-radius: 7px;
}

.waybot-message.user .waybot-bubble {
    color: #fff;
    background: linear-gradient(135deg, #0066ff, #4169e1);
    border-bottom-right-radius: 7px;
}

.waybot-typing {
    color: #aebfff;
    font-style: italic;
}

.waybot-cards {
    margin-top: 12px;
    display: grid;
    gap: 10px;
}

.waybot-card {
    background: rgba(5, 9, 22, 0.7);
    border: 1px solid rgba(65, 105, 225, 0.28);
    border-radius: 16px;
    padding: 12px;
    display: grid;
    gap: 7px;
}

.waybot-card strong {
    color: #fff;
    font-size: 14px;
}

.waybot-card-subtitle {
    color: #9db7ff;
    font-size: 12px;
}

.waybot-card-lines {
    display: grid;
    gap: 3px;
}

.waybot-card-lines p {
    margin: 0;
    color: #d9e2ff;
    font-size: 12px;
}

.waybot-card-btn {
    justify-self: start;
    margin-top: 5px;
    border: none;
    border-radius: 999px;
    padding: 8px 12px;
    background: rgba(0, 102, 255, 0.22);
    color: #fff;
    cursor: pointer;
    font-weight: 700;
    font-size: 12px;
    transition: 0.2s ease;
}

.waybot-card-btn:hover {
    background: rgba(0, 102, 255, 0.36);
}

.waybot-card-item {
    border-color: rgba(0, 191, 255, 0.32);
}

.waybot-card-loan {
    border-color: rgba(0, 255, 171, 0.30);
}

.waybot-card-movement {
    border-color: rgba(255, 213, 79, 0.30);
}

.waybot-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    padding: 0 16px 12px;
}

.waybot-actions button {
    border: 1px solid rgba(65, 105, 225, 0.32);
    background: rgba(65, 105, 225, 0.14);
    color: #dbe5ff;
    border-radius: 999px;
    padding: 8px 11px;
    cursor: pointer;
    font-size: 12px;
}

.waybot-actions button:hover {
    background: rgba(65, 105, 225, 0.24);
}

.waybot-form {
    display: flex;
    gap: 10px;
    padding: 14px 16px 16px;
    background: rgba(255, 255, 255, 0.025);
    border-top: 1px solid rgba(65, 105, 225, 0.18);
}

.waybot-form input {
    flex: 1;
    min-width: 0;
    background: #0c1229;
    color: #fff;
    border: 1px solid rgba(65, 105, 225, 0.35);
    border-radius: 14px;
    padding: 12px 14px;
    font-size: 14px;
}

.waybot-form input:focus {
    outline: none;
    border-color: #4d8bff;
    box-shadow: 0 0 0 3px rgba(77, 139, 255, 0.16);
}

.waybot-form button {
    border: none;
    border-radius: 14px;
    padding: 12px 16px;
    background: linear-gradient(135deg, #0066ff, #4169e1);
    color: #fff;
    font-weight: 800;
    cursor: pointer;
}

/* =========================================================
   RESPONSIVE GENERAL MEJORADO
========================================================= */

.tabs {
    overflow-x: auto;
    overflow-y: hidden;
    white-space: nowrap;
    scrollbar-width: none;
}

.tabs::-webkit-scrollbar {
    display: none;
}

.tab {
    min-width: 145px;
}

.table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.table-wrap table {
    min-width: 850px;
}

.section-head {
    gap: 14px;
}

@media (max-width: 900px) {
    .topbar {
        flex-wrap: wrap;
        gap: 12px;
    }

    .brand span {
        font-size: 18px;
    }

    .container {
        padding: 18px;
    }

    .stats-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .tab {
        min-width: 130px;
        padding-inline: 14px;
    }
}

@media (max-width: 640px) {
    body {
        padding: 0;
    }

    .topbar {
        padding: 12px;
    }

    .brand img {
        width: 76px;
    }

    .brand span {
        font-size: 16px;
    }

    .user-area {
        width: 100%;
        justify-content: space-between;
    }

    .container {
        padding: 14px;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .section-head {
        flex-direction: column;
        align-items: stretch;
    }

    .section-head .btn {
        width: 100%;
    }

    .search {
        font-size: 14px;
        padding: 13px 14px;
    }

    .waybot-toggle {
        right: 14px;
        bottom: 14px;
        width: 62px;
        height: 62px;
    }

    .waybot-mini-greeting {
        right: 14px;
        bottom: 90px;
        max-width: calc(100vw - 28px);
    }

    .waybot-panel {
        right: 10px;
        left: 10px;
        bottom: 88px;
        width: auto;
        height: 74vh;
        max-width: none;
        max-height: none;
        border-radius: 20px;
    }

    .waybot-bubble {
        max-width: 95%;
        font-size: 13px;
    }

    .waybot-form {
        flex-direction: column;
    }

    .waybot-form button {
        width: 100%;
    }
}

/* =========================================================
   NAVEGACIÓN RESPONSIVE CON HAMBURGUESA
========================================================= */

.mobile-nav-head {
    display: none;
}

.mobile-menu-btn {
    border: 1px solid rgba(65, 105, 225, 0.45);
    background: rgba(65, 105, 225, 0.12);
    color: #ffffff;
    border-radius: 12px;
    padding: 10px 14px;
    font-size: 22px;
    cursor: pointer;
}

@media (max-width: 760px) {
    .mobile-nav-head {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 12px 16px;
        background: #0b1025;
        border-top: 1px solid rgba(65, 105, 225, 0.25);
        border-bottom: 1px solid rgba(65, 105, 225, 0.25);
        color: #ffffff;
        font-weight: 800;
    }

    .tabs {
        display: none;
        flex-direction: column;
        background: #090d1f;
        border-bottom: 1px solid rgba(65, 105, 225, 0.25);
    }

    .tabs.open {
        display: flex;
    }

    .tab {
        width: 100%;
        min-width: 100%;
        text-align: left;
        padding: 15px 18px;
        border-bottom: 1px solid rgba(65, 105, 225, 0.16);
    }

    .tab.active {
        background: rgba(0, 102, 255, 0.16);
        border-left: 4px solid #0066ff;
    }
}

/* =========================================================
   TABLAS COMO TARJETAS EN MÓVIL
========================================================= */

@media (max-width: 760px) {
    .table-wrap,
    .table-container {
        overflow: visible;
        background: transparent;
        border: none;
        box-shadow: none;
    }

    table,
    .table {
        width: 100%;
        min-width: 0 !important;
        border-collapse: separate;
        border-spacing: 0 14px;
    }

    table thead,
    .table thead {
        display: none;
    }

    table tbody,
    .table tbody {
        display: grid;
        gap: 14px;
    }

    table tr,
    .table tr {
        display: block;
        background: rgba(15, 20, 44, 0.98);
        border: 1px solid rgba(65, 105, 225, 0.32);
        border-radius: 18px;
        padding: 12px;
        box-shadow: 0 14px 30px rgba(0, 0, 0, 0.24);
    }

    table td,
    .table td {
        display: grid;
        grid-template-columns: 110px 1fr;
        gap: 12px;
        align-items: start;
        padding: 10px 6px;
        border-bottom: 1px solid rgba(65, 105, 225, 0.12);
        background: transparent !important;
        color: #ffffff;
        word-break: break-word;
    }

    table td:last-child,
    .table td:last-child {
        border-bottom: none;
    }

    table td::before,
    .table td::before {
        content: attr(data-label);
        color: #9db7ff;
        font-weight: 800;
        font-size: 12px;
        text-transform: uppercase;
        letter-spacing: 0.03em;
    }

    table td img,
    .table td img {
        max-width: 90px;
        max-height: 90px;
        border-radius: 12px;
        object-fit: cover;
    }

    table td .btn,
    .table td .btn {
        width: 100%;
        margin: 4px 0;
    }

    .status-badge,
    .badge {
        width: fit-content;
    }
}

/* =========================================================
   TOPBAR RESPONSIVE
========================================================= */

@media (max-width: 760px) {
    .topbar {
        display: grid;
        grid-template-columns: 1fr;
        gap: 10px;
        padding: 14px;
    }

    .brand {
        display: flex;
        align-items: center;
        gap: 12px;
    }

    .brand img {
        width: 76px;
        height: auto;
    }

    .brand span {
        font-size: 18px;
        line-height: 1.2;
    }

    .user-area {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
        width: 100%;
        font-size: 14px;
    }

    .user-area .btn,
    .user-area button {
        width: auto;
        min-width: 86px;
    }
}

@media (max-width: 420px) {
    .brand img {
        width: 66px;
    }

    .brand span {
        font-size: 16px;
    }

    .user-area {
        font-size: 13px;
    }
}

/* =========================================================
   FORMULARIOS Y MODALES RESPONSIVE
========================================================= */

@media (max-width: 760px) {
    .modal-content,
    .dialog,
    .modal-card {
        width: calc(100vw - 24px) !important;
        max-width: none !important;
        margin: 12px auto !important;
        max-height: calc(100vh - 24px);
        overflow-y: auto;
        border-radius: 18px;
        padding: 18px;
    }

    .form-grid,
    .grid-2,
    .grid-3 {
        grid-template-columns: 1fr !important;
    }

    input,
    select,
    textarea {
        font-size: 16px;
    }

    .section-head {
        display: grid;
        grid-template-columns: 1fr;
        gap: 12px;
        align-items: stretch;
    }

    .section-head .btn,
    .section-head button {
        width: 100%;
    }
}

/* =========================================================
   WAYBOT MÁS CÓMODO EN CELULAR
========================================================= */

@media (max-width: 760px) {
    .waybot-panel {
        left: 8px;
        right: 8px;
        bottom: 82px;
        width: auto;
        height: 72vh;
        max-height: 72vh;
        border-radius: 20px;
    }

    .waybot-toggle {
        right: 16px;
        bottom: 16px;
        width: 60px;
        height: 60px;
    }

    .waybot-header {
        padding: 13px 14px;
    }

    .waybot-avatar {
        width: 42px;
        height: 42px;
    }

    .waybot-header h3 {
        font-size: 16px;
    }

    .waybot-header p {
        font-size: 12px;
    }

    .waybot-actions {
        overflow-x: auto;
        flex-wrap: nowrap;
        padding-bottom: 10px;
    }

    .waybot-actions button {
        flex: 0 0 auto;
    }

    .waybot-form {
        display: grid;
        grid-template-columns: 1fr;
    }

    .waybot-form button {
        width: 100%;
    }
}

.hint {
    display: block;
    color: #9db7ff;
    font-size: 12px;
    margin-top: 6px;
    margin-bottom: 12px;
}

.check-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 12px 0;
}

.check-row input {
    width: auto;
}

/* =========================================================
   VISOR DE FOTO EN GRANDE
========================================================= */

.clickable-thumb {
    cursor: zoom-in;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.clickable-thumb:hover {
    transform: scale(1.06);
    box-shadow: 0 0 16px rgba(0, 191, 255, 0.35);
}

.photo-dialog {
    width: min(92vw, 900px);
    max-width: 900px;
    border: 1px solid rgba(65, 105, 225, 0.45);
    border-radius: 22px;
    background: #0b1025;
    color: #ffffff;
    padding: 0;
}

.photo-dialog::backdrop {
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(6px);
}

.photo-viewer {
    padding: 18px;
}

.photo-viewer-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 16px;
}

.photo-viewer-head h3 {
    margin: 0;
    font-size: 20px;
}

.photo-viewer img {
    width: 100%;
    max-height: 75vh;
    object-fit: contain;
    border-radius: 16px;
    background: #050814;
    border: 1px solid rgba(65, 105, 225, 0.3);
}

@media (max-width: 760px) {
    .photo-dialog {
        width: calc(100vw - 20px);
        max-width: none;
    }

    .photo-viewer {
        padding: 14px;
    }

    .photo-viewer-head {
        flex-direction: column;
        align-items: stretch;
    }

    .photo-viewer-head .btn {
        width: 100%;
    }

    .photo-viewer img {
        max-height: 68vh;
    }
}

.waybot-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.waybot-clear {
    border: 1px solid rgba(65, 105, 225, 0.35);
    background: rgba(65, 105, 225, 0.12);
    color: #dbe5ff;
    border-radius: 999px;
    padding: 7px 10px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 700;
}

.waybot-clear:hover {
    background: rgba(65, 105, 225, 0.24);
}
.sync-status {
    position: fixed;
    left: 18px;
    bottom: 18px;
    z-index: 2500;
    display: none;
    background: rgba(0, 102, 255, 0.15);
    color: #dbe8ff;
    border: 1px solid rgba(65, 105, 225, 0.45);
    border-radius: 999px;
    padding: 10px 14px;
    font-size: 13px;
    font-weight: 700;
    box-shadow: 0 14px 35px rgba(0, 0, 0, 0.28);
}

.sync-status.visible {
    display: block;
}

.sync-status.offline {
    background: rgba(255, 170, 0, 0.15);
    color: #ffe8a3;
    border-color: rgba(255, 170, 0, 0.45);
}

@media (max-width: 760px) {
    .sync-status {
        left: 12px;
        right: 88px;
        bottom: 18px;
        text-align: center;
        border-radius: 14px;
    }
}