/* ============ Inventario TI - estilos ============ */
:root {
    --panel: #1e293b;
    --panel-oscuro: #0f172a;
    --fondo: #eef2f7;
    --borde: #dbe1ea;
    --texto: #1e293b;
    --tenue: #64748b;
    --azul: #2563eb;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
    color: var(--texto);
    background: var(--fondo);
}

/* ---------- Aplicacion con panel lateral ---------- */
.app {
    display: flex;
    min-height: 100vh;
}

.panel {
    width: 250px;
    flex-shrink: 0;
    background: linear-gradient(180deg, var(--panel) 0%, var(--panel-oscuro) 100%);
    color: #cbd5e1;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.marca {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 20px 18px 16px;
    font-size: 17px;
    letter-spacing: 1px;
    color: #fff;
    border-bottom: 1px solid rgba(255,255,255,.08);
}

.marca b { color: #60a5fa; }
.marca .caja { font-size: 22px; }

.menu {
    display: flex;
    flex-direction: column;
    padding: 10px 0;
    flex: 1;
}

.menu a {
    color: #cbd5e1;
    text-decoration: none;
    padding: 9px 18px;
    font-size: 14.5px;
    border-left: 3px solid transparent;
    transition: background .15s, color .15s;
}

.menu a:hover {
    background: rgba(255,255,255,.07);
    color: #fff;
    border-left-color: var(--azul);
}

.menu .grupo {
    margin-top: 14px;
    padding: 4px 18px 4px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: #64748b;
}

.sesion {
    padding: 14px 18px;
    border-top: 1px solid rgba(255,255,255,.08);
    font-size: 13px;
}

.sesion .usuario {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    color: #e2e8f0;
}

.rol-badge {
    font-size: 10px;
    padding: 2px 7px;
    border-radius: 10px;
    background: #334155;
    color: #93c5fd;
    letter-spacing: .5px;
}

.rol-admin { background: #7c3aed; color: #fff; }
.rol-captura { background: #0369a1; color: #fff; }

.salir {
    width: 100%;
    background: rgba(239,68,68,.15);
    border: 1px solid rgba(239,68,68,.4);
    color: #fca5a5;
    border-radius: 6px;
    padding: 7px;
    font-size: 13px;
    cursor: pointer;
}

.salir:hover { background: rgba(239,68,68,.3); color: #fff; }

/* ---------- Contenido ---------- */
.contenido {
    flex: 1;
    padding: 26px 30px;
    max-width: 1300px;
}

.titulo-pagina {
    display: flex;
    align-items: baseline;
    gap: 16px;
    margin-bottom: 20px;
}

.titulo-pagina h1 { font-size: 26px; margin: 0; font-weight: 600; }
.titulo-pagina .fecha { color: var(--tenue); font-size: 14px; text-transform: capitalize; }

/* KPIs */
.kpis {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 14px;
    margin-bottom: 22px;
}

.kpi {
    background: #fff;
    border: 1px solid var(--borde);
    border-radius: 10px;
    padding: 16px 18px;
    border-left: 4px solid var(--azul);
}

.kpi-num { font-size: 30px; font-weight: 700; line-height: 1.1; }
.kpi-txt { color: var(--tenue); font-size: 13px; margin-top: 3px; }
.kpi-azul { border-left-color: #2563eb; }
.kpi-verde { border-left-color: #16a34a; }
.kpi-morado { border-left-color: #9333ea; }
.kpi-naranja { border-left-color: #ea580c; }

/* Cuadros */
.cuadros {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 16px;
}

.tarjeta {
    background: #fff;
    border: 1px solid var(--borde);
    border-radius: 10px;
    padding: 16px 18px;
}

.tarjeta h2 {
    font-size: 15px;
    font-weight: 600;
    margin: 0 0 12px;
    color: #334155;
}

.tabla { width: 100%; font-size: 14px; }
.tabla td { padding: 7px 4px; border-top: 1px solid #f1f5f9; }
.tabla tr:first-child td { border-top: none; }
.tabla .num { text-align: right; font-weight: 600; }
.tabla .peligro { color: #dc2626; }
.tabla .detalle { color: var(--tenue); font-size: 12px; margin-top: 2px; }

.punto {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: 6px;
}

.vacio { color: var(--tenue); font-size: 13.5px; margin: 6px 0; }

/* ---------- Login ---------- */
.fondo-login {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background:
        radial-gradient(circle at 20% 20%, rgba(37,99,235,.25), transparent 45%),
        radial-gradient(circle at 80% 80%, rgba(147,51,234,.20), transparent 45%),
        var(--panel-oscuro);
}

.tarjeta-login {
    background: #fff;
    border-radius: 14px;
    padding: 34px 36px;
    width: 360px;
    box-shadow: 0 25px 60px rgba(0,0,0,.45);
}

.login-titulo { font-size: 24px; font-weight: 600; text-align: center; }
.login-sub { color: var(--tenue); text-align: center; font-size: 14px; margin: 6px 0 18px; }

.tarjeta-login label {
    display: block;
    font-size: 13px;
    color: #475569;
    margin: 12px 0 4px;
    font-weight: 600;
}

.entrada {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-size: 15px;
}

.entrada:focus { outline: 2px solid var(--azul); border-color: transparent; }

.btn-entrada {
    width: 100%;
    margin-top: 20px;
    padding: 11px;
    background: var(--azul);
    border: none;
    color: #fff;
    font-size: 15px;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    display: block;
    text-align: center;
    text-decoration: none;
}

.btn-entrada:hover { background: #1d4ed8; }

.alerta {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #b91c1c;
    border-radius: 8px;
    padding: 9px 12px;
    font-size: 14px;
    text-align: center;
}

/* ---------- Modulo en construccion ---------- */
.en-construccion {
    background: #fff;
    border: 1px dashed #94a3b8;
    border-radius: 14px;
    padding: 46px 40px;
    max-width: 720px;
    text-align: center;
    margin-top: 30px;
}

.ec-icono { font-size: 58px; }
.en-construccion h1 { font-size: 26px; margin: 10px 0 4px; }

.ec-estado {
    display: inline-block;
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #fcd34d;
    border-radius: 20px;
    padding: 4px 14px;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 14px;
}

.en-construccion p { color: #475569; font-size: 15px; line-height: 1.6; }
.ec-nota { font-size: 13px !important; color: var(--tenue) !important; margin-top: 22px; }

/* ---------- Movil (consulta desde el celular) ---------- */
@media (max-width: 900px) {
    .app { flex-direction: column; }
    .panel { width: 100%; height: auto; position: static; }
    .menu { flex-direction: row; flex-wrap: wrap; padding: 6px; }
    .menu a { border-left: none; border-radius: 6px; padding: 7px 12px; }
    .menu .grupo { display: none; }
    .sesion { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
    .sesion .usuario { margin-bottom: 0; }
    .salir { width: auto; }
    .contenido { padding: 16px; }
    .tabs { flex-wrap: wrap; }
}

/* ---------- Catalogos: pestanas, formularios, mensajes ---------- */
.msg-ok, .msg-err {
    border-radius: 8px;
    padding: 10px 14px;
    font-size: 14px;
    margin-bottom: 14px;
}

.msg-ok {
    background: #f0fdf4;
    border: 1px solid #86efac;
    color: #166534;
}

.msg-err {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #b91c1c;
}

.tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 16px;
    border-bottom: 2px solid var(--borde);
}

.tab {
    padding: 9px 16px;
    text-decoration: none;
    color: var(--tenue);
    font-size: 14px;
    font-weight: 600;
    border-radius: 8px 8px 0 0;
    border: 1px solid transparent;
    border-bottom: none;
}

.tab:hover { color: var(--texto); background: #e2e8f0; }

.tab.activa {
    background: #fff;
    color: var(--azul);
    border-color: var(--borde);
    margin-bottom: -2px;
    padding-bottom: 11px;
}

.tabla thead th {
    text-align: left;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .6px;
    color: var(--tenue);
    padding: 6px 4px;
    border-bottom: 2px solid var(--borde);
}

.tabla tr.inactivo td { color: #a0aec0; text-decoration: line-through; }
.tabla tr.inactivo td.acciones { text-decoration: none; }

.acciones { text-align: right; white-space: nowrap; font-size: 13px; }
.acciones a { color: var(--azul); text-decoration: none; margin-right: 10px; }
.acciones a:hover { text-decoration: underline; }

.acciones .inline { display: inline; }

.acciones button {
    background: none;
    border: none;
    color: #64748b;
    font-size: 13px;
    cursor: pointer;
    padding: 0;
}

.acciones button:hover { color: var(--azul); text-decoration: underline; }
.acciones button.peligro { color: #dc2626; }

.formulario {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 12px 16px;
    align-items: end;
}

.campo { display: flex; flex-direction: column; gap: 4px; }
.campo label { font-size: 12.5px; font-weight: 600; color: #475569; }

.campo input, .campo select {
    padding: 9px 11px;
    border: 1px solid #cbd5e1;
    border-radius: 7px;
    font-size: 14.5px;
    background: #fff;
}

/* Altura uniforme de 40 px para todos los controles de texto del formulario */
.campo input[type="text"],
.campo input[type="date"],
.campo input[type="number"],
.campo input[type="password"],
.campo input:not([type]),
.campo select {
    height: 40px;
    box-sizing: border-box;
}

.campo input:focus, .campo select:focus {
    outline: 2px solid var(--azul);
    border-color: transparent;
}

.entrada-corta { max-width: 130px; }
.entrada-color { max-width: 80px; height: 40px; padding: 3px; }

.botones { display: flex; gap: 10px; align-items: center; }

/* Botones de acción con la misma altura que los campos del formulario */
.botones .btn-primario,
.botones .btn-secundario {
    margin-bottom: 0;
    height: 40px;
    box-sizing: border-box;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
}

.btn-primario {
    display: inline-block;
    background: var(--azul);
    color: #fff;
    border: none;
    border-radius: 7px;
    padding: 9px 18px;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    margin-bottom: 14px;
}

.btn-primario:hover { background: #1d4ed8; color: #fff; text-decoration: none; }

.btn-secundario {
    display: inline-block;
    background: #e2e8f0;
    color: #334155;
    border-radius: 7px;
    padding: 9px 18px;
    font-size: 14px;
    text-decoration: none;
}

.btn-secundario:hover { background: #cbd5e1; color: #1e293b; text-decoration: none; }

.regresar { color: var(--tenue); text-decoration: none; font-weight: 400; font-size: 21px; }
.regresar:hover { color: var(--azul); }

.link-sucursal { color: var(--azul); font-weight: 600; text-decoration: none; }
.link-sucursal:hover { text-decoration: underline; }

/* ---------- Equipos: chips, filtros, ficha ---------- */
.chip {
    display: inline-block;
    padding: 3px 11px;
    border-radius: 999px;
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    vertical-align: middle;
}

.chip-gris { background: #94a3b8; }

/* Resumen de la lista de hardware: conteo por estado (los estados sin
   piezas quedan en gris; si aparece un estado nuevo, su chip sale solo) */
.resumen-estados {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 14px;
}

.chip.conteo { font-size: 13px; padding: 5px 13px; }
.chip.conteo.cero { color: #94a3b8; }

.filtros {
    display: flex;
    flex-wrap: wrap;
    gap: 9px;
    align-items: center;
    margin-bottom: 14px;
}

.filtros select, .filtros input {
    padding: 8px 10px;
    border: 1px solid #cbd5e1;
    border-radius: 7px;
    font-size: 13.5px;
    background: #fff;
}

.filtros input { min-width: 220px; }

.btn-filtro {
    background: var(--azul);
    color: #fff;
    border: none;
    border-radius: 7px;
    padding: 8px 16px;
    font-size: 13.5px;
    font-weight: 600;
    cursor: pointer;
}

.btn-filtro:hover { background: #1d4ed8; }

.filtros .btn-secundario { padding: 8px 14px; font-size: 13.5px; }

.casilla { display: flex; align-items: center; gap: 7px; font-size: 13.5px; font-weight: 400; color: #334155; }

.tabla.ficha th {
    text-align: left;
    font-size: 13px;
    color: #64748b;
    padding: 8px 14px 8px 0;
    white-space: nowrap;
    width: 190px;
    border-bottom: 1px solid var(--borde);
}

.tabla.ficha td { padding: 8px 0; border-bottom: 1px solid var(--borde); font-size: 14.5px; }
.tabla.ficha tr:last-child th, .tabla.ficha tr:last-child td { border-bottom: none; }

/* ---------- Hardware: miniaturas, galeria, preview de codigo ---------- */
.celda-thumb { width: 46px; padding-right: 0; }

.thumb {
    width: 38px;
    height: 38px;
    object-fit: cover;
    border-radius: 7px;
    border: 1px solid var(--borde);
    display: inline-block;
    vertical-align: middle;
}

.thumb-vacio {
    background: #f1f5f9;
    color: #94a3b8;
    font-size: 9.5px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    line-height: 1;
    overflow: hidden;
}

.preview-codigo { font-size: 12.5px; color: #64748b; }
.preview-codigo b { color: var(--azul); font-size: 13.5px; letter-spacing: .5px; }

.galeria { display: flex; flex-wrap: wrap; gap: 14px; }

.foto {
    max-width: min(420px, 100%);
    max-height: 320px;
    border-radius: 10px;
    border: 1px solid var(--borde);
    background: #fff;
}

/* ---------------- Mapa: zonas + iconos arrastrables ---------------- */
.mapa-zonas {
    display: flex;
    gap: 14px;
    align-items: flex-start;
    overflow-x: auto;
    padding-bottom: 6px;
}

.zona-col {
    flex: 0 0 auto;
    width: 178px;
    background: #f8fafc;
    border: 1px solid var(--borde);
    border-radius: 12px;
    padding: 8px;
}

.zona-cab {
    font-size: 13px;
    font-weight: 600;
    color: #334155;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 2px 4px 8px;
}

.zona-cont {
    background: #e2e8f0;
    color: #475569;
    border-radius: 10px;
    font-size: 11px;
    padding: 1px 7px;
}

.zona-lienzo { position: relative; min-height: 360px; }

.zona-vacia {
    color: #94a3b8;
    font-size: 12px;
    text-align: center;
    padding: 40px 6px;
    border: 1px dashed #cbd5e1;
    border-radius: 9px;
}

.eq-icono {
    position: absolute;
    width: 76px;
    padding: 7px 4px 6px;
    background: #fff;
    border: 2px solid #cbd5e1;
    border-radius: 11px;
    text-align: center;
    cursor: grab;
    user-select: none;
    box-shadow: 0 1px 3px rgba(15, 23, 42, .08);
}

.eq-icono.moviendo {
    opacity: .85;
    box-shadow: 0 8px 18px rgba(15, 23, 42, .25);
    cursor: grabbing;
    z-index: 5;
}

.eq-emo { font-size: 24px; line-height: 1.1; display: block; }

.eq-nombre {
    display: block;
    font-size: 10.5px;
    color: #475569;
    margin-top: 3px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.eq-punto {
    position: absolute;
    top: 5px;
    right: 5px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    border: 1.5px solid #fff;
}

/* ficha rápida (overlay) */
.ficha-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, .45);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 50;
    padding: 16px;
}

.ficha-overlay[hidden] { display: none; }

.ficha-caja {
    background: #fff;
    border-radius: 14px;
    padding: 20px 22px;
    width: min(420px, 100%);
    position: relative;
    box-shadow: 0 18px 50px rgba(15, 23, 42, .3);
}

.ficha-cierra {
    position: absolute;
    top: 8px;
    right: 12px;
    border: none;
    background: none;
    font-size: 18px;
    cursor: pointer;
    color: #64748b;
}

.ficha-emo { font-size: 40px; text-align: center; }

.ficha-caja h3 { text-align: center; margin: 6px 0 10px; }
.ficha-chip { text-align: center; margin-bottom: 12px; }

/* ---------------- Bitácora: paginación ---------------- */
.paginacion {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    margin-top: 14px;
}

.pag-info { font-size: 13px; color: #64748b; }

/* Etiqueta de la fila de filtros (Hardware) para no confundirla con el formulario de alta */
.etiqueta-filtros {
    font-size: 13px;
    font-weight: 600;
    color: #64748b;
    align-self: center;
    white-space: nowrap;
}

/* Buscador de equipo dentro del formulario de alta */
.entrada-buscar {
    width: 100%;
    height: 40px;
    box-sizing: border-box;
    padding: 8px 10px;
    border: 1px solid var(--borde);
    border-radius: 8px;
    font-size: 13px;
    margin-bottom: 6px;
    background: #fff;
}

/* Imagenes: botones de camara y galeria */
.fila-adjuntos { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.btn-adjuntar {
    display: inline-flex;
    align-items: center;
    height: 40px;
    box-sizing: border-box;
    padding: 0 14px;
    background: #eef2f7;
    border: 1px solid var(--borde);
    border-radius: 8px;
    font-size: 13px;
    cursor: pointer;
    color: #334155;
}

.btn-adjuntar:hover { background: #e2e8f0; }

.archivo-nombre { font-size: 12.5px; color: #475569; }

/* Pad de firma (Mantenimientos): se firma con el dedo o el lapiz en la
   tablet; touch-action evita que la pagina se mueva al dibujar */
.pad-firma {
    width: 100%;
    max-width: 640px;
    height: 170px;
    display: block;
    background: #fff;
    border: 1px dashed #cbd5e1;
    border-radius: 8px;
    cursor: crosshair;
    touch-action: none;
    -webkit-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
}

/* ---------------- Mantenimientos: radios y piezas ---------------- */
.radio-fila { display: flex; flex-wrap: wrap; gap: 18px; }

.radio-op {
    font-size: 14px;
    color: #334155;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
}

.hw-lista {
    border: 1px solid var(--borde);
    border-radius: 9px;
    padding: 10px 12px;
    max-height: 240px;
    overflow-y: auto;
    background: #f8fafc;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.hw-op {
    font-size: 13.5px;
    color: #334155;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    cursor: pointer;
}

/* Dashboard: alerta de planes vencidos */
.alerta-vencidos { border-top: 3px solid #dc3545; }
