/* ============================================
    RESET Y VARIABLES GLOBALES
    ============================================ */
* { margin:0; padding:0; box-sizing:border-box; }

:root {
    --primary:      #2c3e50;
    --accent:       rgba(224, 64, 64, 1);
    --accent-hover: rgba(200, 48, 48, 1);
    --light-bg:     #f8f9fa;
    --header-bg:    #eef1f4;
    --card-bg:      #ffffff;
    --text-dark:    #2c3e50;
    --text-light:   #6c757d;
    --border-soft:  #e2e6ea;
    --favorito:     #9b59b6;
    --favorito-hover: #8e44ad;
    --peligro:      #ff4444;
    --peligro-suave:#ff6b6b;
    --shadow:       0 10px 30px rgba(0, 0, 0, 0.08);
    --shadow-hover: 0 20px 40px rgba(0, 0, 0, 0.12);
    --radius:       16px;
    --menu-w:       256px;

    /* Alturas de franjas fijas */
    --cabecera-h:   64px;
    --pie-h:        48px;
}

html, body {
    height: 100%;
    max-width: 100%;
    overflow: hidden;
    font-family: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
    color: var(--text-dark);
    line-height: 1.6;
    background: var(--light-bg);
}

img, svg, video { max-width:100%; height:auto; display:block; }

/* ============================================
    LAYOUT PRINCIPAL
    3 filas: header | main | paginación
    ============================================ */
.app {
    display: grid;
    grid-template-columns: var(--menu-w) 1fr;
    grid-template-rows: var(--cabecera-h) minmax(0, 1fr) auto;
    grid-template-areas:
        "menu header"
        "menu main"
        "menu paginacion";
    height: 100%;
    width: 100%;
    overflow: hidden;
}

/* ============================================
    MENÚ LATERAL
    ============================================ */
.menu {
    grid-area: menu;
    background: var(--header-bg);
    border-right: 1px solid var(--border-soft);
    display: grid;
    grid-template-rows: auto 1fr auto;
    height: 100%;
    overflow-x: hidden;
    overflow-y: auto;
    z-index: 200;
}

.menu::-webkit-scrollbar { width: 6px; }
.menu::-webkit-scrollbar-track { background: transparent; }
.menu::-webkit-scrollbar-thumb {
    background: rgba(44, 62, 80, 0.15);
    border-radius: 3px;
}
.menu::-webkit-scrollbar-thumb:hover {
    background: rgba(44, 62, 80, 0.3);
}

.menu-marca {
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: center;
    gap: 0.6rem;
    padding: 1rem 1.1rem;
    border-bottom: 1px solid var(--border-soft);
}

.menu-logo {
    display: grid;
    width: 40px; height: 40px;
    padding: 4px;
    border-radius: 12px;
    background: #f4f4f4;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    place-items: center;
    flex-shrink: 0;
}
.menu-logo svg { width: 100%; height: 100%; }

.menu-marca-texto {
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: -0.3px;
    color: var(--accent);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.menu-nav {
    padding: 0.9rem 0.65rem;
    display: grid;
    gap: 0.15rem;
    align-content: start;
}

.menu-titulo {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--text-light);
    padding: 0.75rem 0.75rem 0.35rem;
}

.menu-item {
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: center;
    gap: 0.7rem;
    padding: 0.6rem 0.75rem;
    border-radius: 10px;
    color: var(--primary);
    text-decoration: none;
    font-size: 0.92rem;
    font-weight: 500;
    transition: background 0.2s ease, color 0.2s ease;
    cursor: pointer;
    border: none;
    background: transparent;
    text-align: left;
    font-family: inherit;
}
.menu-item svg { width: 20px; height: 20px; color: var(--text-light); transition: color 0.2s; }

.menu-item:hover { background: rgba(224,64,64,0.08); }
.menu-item:hover svg { color: var(--accent); }

.menu-item.activo {
    background: rgba(224,64,64,0.12);
    color: var(--accent);
    font-weight: 700;
}
.menu-item.activo svg { color: var(--accent); }

.menu-pie {
    padding: 0.9rem 0.9rem;
    border-top: 1px solid var(--border-soft);
    font-size: 0.78rem;
    color: var(--text-light);
    display: grid;
    gap: 0.4rem;
}
.menu-usuario {
    display: grid;
    grid-template-columns: 32px 1fr;
    align-items: center;
    gap: 0.55rem;
    font-weight: 600;
    color: var(--primary);
}
.menu-avatar {
    width: 32px; height: 32px;
    border-radius: 50%;
    background: var(--accent);
    color: #fff;
    display: grid;
    place-items: center;
    font-weight: 700;
    font-size: 0.85rem;
    text-transform: uppercase;
}

/* ============================================
    CABECERA
    ============================================ */
.cabecera {
    grid-area: header;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.85rem 1.25rem;
    background: var(--header-bg);
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
    z-index: 100;
}

.cabecera-titulo {
    font-size: 1.15rem;
    font-weight: 800;
    color: var(--primary);
    letter-spacing: -0.4px;
    white-space: nowrap;
}

.cabecera-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    align-items: center;
    flex: 1;
    justify-content: flex-end;
}

.tag {
    border: 1px solid var(--border-soft);
    background: var(--card-bg);
    color: var(--primary);
    font-family: inherit;
    font-size: 0.82rem;
    font-weight: 600;
    padding: 0.35rem 0.85rem;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.2s ease;
}
.tag:hover { border-color: var(--accent); color: var(--accent); }
.tag.activo {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

/* ============================================
    ÁREA PRINCIPAL
    ============================================ */
.principal {
    grid-area: main;
    display: grid;
    gap: 1rem;
    padding: 1.25rem 1.25rem 1.25rem;
    align-content: start;
    max-width: 100%;
    overflow-x: hidden;
    overflow-y: auto;
}

.principal::-webkit-scrollbar { width: 10px; }
.principal::-webkit-scrollbar-track { background: transparent; }
.principal::-webkit-scrollbar-thumb {
    background: rgba(44, 62, 80, 0.15);
    border-radius: 5px;
}
.principal::-webkit-scrollbar-thumb:hover { background: var(--accent); }

.barra-busqueda {
    display: grid;
    grid-template-columns: 1fr auto auto;
    gap: 0.6rem;
    align-items: center;
    max-width: 760px;
}

.barra-busqueda input {
    width: 100%;
    padding: 0.7rem 1.1rem;
    border: 2px solid var(--border-soft);
    border-radius: 50px;
    font-size: 0.92rem;
    font-family: inherit;
    background: var(--card-bg);
    color: var(--text-dark);
    outline: none;
    transition: border-color 0.25s, box-shadow 0.25s;
}
.barra-busqueda input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 4px rgba(224,64,64,0.10);
}

.barra-busqueda button {
    padding: 0.7rem 1.3rem;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 50px;
    font-family: inherit;
    font-weight: 700;
    font-size: 0.9rem;
    cursor: pointer;
    transition: background 0.25s, transform 0.15s;
}
.barra-busqueda button:hover { background: var(--accent-hover); transform: translateY(-1px); }

.barra-busqueda .btn-agregar {
    background: var(--card-bg);
    color: var(--accent);
    border: none;
    box-shadow: inset 0 0 0 2px var(--accent);
    white-space: nowrap;
}
.barra-busqueda .btn-agregar:hover {
    background: var(--accent);
    color: #fff;
    box-shadow: none;
}

.contador {
    font-size: 0.85rem;
    color: var(--text-light);
}
.contador strong { color: var(--primary); }

/* Mosaico */
.mosaico {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 0.85rem;
}

.tarjeta {
    position: relative;
    display: grid;
    grid-template-rows: 1fr auto;
    background: var(--card-bg);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    cursor: pointer;
    transition: transform 0.25s ease, box-shadow 0.3s ease;
    border: none;
    font-family: inherit;
    text-align: left;
    padding: 0;
}
.tarjeta:hover { transform: translateY(-3px); box-shadow: var(--shadow-hover); }
.tarjeta:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

.tarjeta-mini {
    aspect-ratio: 1 / 1;
    background: var(--header-bg);
    overflow: hidden;
    display: grid;
    place-items: center;
    position: relative;
}

.tarjeta-mini img {
    width: 100%; height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.4s ease;
}
.tarjeta:hover .tarjeta-mini img { transform: scale(1.05); }

.tarjeta-mini .placeholder {
    display: grid;
    place-items: center;
    color: var(--accent);
    opacity: 0.35;
    width: 60%;
    height: 60%;
}

.badge-tipo {
    position: absolute;
    top: 0.6rem;
    right: 0.6rem;
    background: rgba(0,0,0,0.62);
    color: #fff;
    padding: 0.2rem 0.55rem;
    font-size: 0.68rem;
    font-weight: 700;
    border-radius: 20px;
    letter-spacing: 0.4px;
    text-transform: uppercase;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}
.badge-tipo svg { width: 11px; height: 11px; }

.badge-play {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    pointer-events: none;
}
.badge-play svg {
    width: 46px;
    height: 46px;
    color: #fff;
    filter: drop-shadow(0 2px 6px rgba(0,0,0,0.5));
    opacity: 0.92;
}

.tarjeta-datos {
    padding: 0.6rem 0.75rem 0.7rem;
    display: grid;
    gap: 0.15rem;
}
.tarjeta-nombre {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.tarjeta-meta {
    font-size: 0.72rem;
    color: var(--text-light);
    display: flex;
    justify-content: space-between;
    gap: 0.5rem;
}

.vacio, .cargando {
    grid-column: 1 / -1;
    padding: 3rem 1rem;
    text-align: center;
    color: var(--text-light);
    font-size: 0.95rem;
}
.vacio strong { color: var(--primary); }

/* ============================================
    PAGINACIÓN — Franja propia, SIN scroll vertical
    ============================================ */
.paginacion {
    grid-area: paginacion;
    background: var(--light-bg);
    border-top: 1px solid var(--border-soft);
    padding: 0.6rem 1rem;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: nowrap;
    gap: 0.4rem;
    overflow-x: auto;
    overflow-y: hidden;
    min-height: 60px;
    max-height: 60px;
    scrollbar-width: thin;
    scrollbar-color: rgba(44, 62, 80, 0.2) transparent;
}

.paginacion::-webkit-scrollbar { height: 6px; }
.paginacion::-webkit-scrollbar-track { background: transparent; }
.paginacion::-webkit-scrollbar-thumb {
    background: rgba(44, 62, 80, 0.2);
    border-radius: 3px;
}
.paginacion::-webkit-scrollbar-thumb:hover { background: var(--accent); }

.pag-btn {
    flex-shrink: 0;
    min-width: 42px;
    height: 42px;
    padding: 0 0.5rem;
    border: 1px solid var(--border-soft);
    background: var(--card-bg);
    color: var(--primary);
    font-family: inherit;
    font-size: 1rem;
    font-weight: 700;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: grid;
    place-items: center;
    white-space: nowrap;
    user-select: none;
    line-height: 1;
}

.pag-btn:hover:not(:disabled):not(.activo) {
    border-color: var(--accent);
    color: var(--accent);
    background: rgba(224, 64, 64, 0.06);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(224, 64, 64, 0.15);
}

.pag-btn:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.pag-btn.activo {
    background: var(--accent);
    color: #888;
    border-color: var(--accent);
    box-shadow: 0 4px 12px rgba(224, 64, 64, 0.30);
    cursor: default;
}

.pag-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
    background: var(--card-bg);
}
.pag-btn:disabled:hover {
    border-color: var(--border-soft);
    color: var(--primary);
    background: var(--card-bg);
    transform: none;
    box-shadow: none;
}

.pag-puntos {
    flex-shrink: 0;
    padding: 0 0.4rem;
    color: var(--text-light);
    font-weight: 700;
    user-select: none;
    display: grid;
    place-items: center;
    height: 42px;
    min-width: 28px;
}

/* ============================================
    PIE (footer) — Oculto temporalmente
    ============================================ */
.pie {
    grid-area: footer;
    display: none;
    justify-content: flex-end;
    align-items: center;
    padding: 0.5rem 1.25rem;
    border-top: 1px solid var(--border-soft);
    background: var(--light-bg);
}
.vers {
    font-size: 0.78rem;
    color: var(--text-light);
    user-select: none;
}

.vers-menu {
    opacity: 0.7;
    justify-self: end;
    text-align: right;
    user-select: none;
}

.version-line {
    margin-top: 1.25rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border-soft);
    font-size: 0.78rem;
    color: var(--text-light);
    user-select: none;
    text-align: right;
}

/* ============================================
    LIGHTBOX MODAL
    ============================================ */
.lightbox {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.88);
    display: none;
    z-index: 999;
    padding: 1rem;
    place-items: center;
}
.lightbox.visible { display: grid; }

.lightbox-caja {
    display: grid;
    grid-template-rows: auto 1fr;
    gap: 0.6rem;
    max-width: 90vw;
    max-height: 90vh;
    width: 100%;
}

.lightbox-cab {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    color: #fff;
    font-size: 0.9rem;
}
.lightbox-cab .nombre {
    font-weight: 700;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.lightbox-cerrar {
    background: transparent;
    color: #fff;
    border: none;
    cursor: pointer;
    font-size: 1.8rem;
    line-height: 1;
    padding: 0 0.4rem;
    transition: color 0.2s;
}
.lightbox-cerrar:hover { color: var(--accent); }

.lightbox-media {
    display: grid;
    place-items: center;
    overflow: hidden;
    max-height: 80vh;
}
.lightbox-media img,
.lightbox-media video {
    max-width: 100%;
    max-height: 80vh;
    object-fit: contain;
    border-radius: 8px;
}

/* ============================================
    FAVORITO, DESCARGA Y ELIMINAR
    ============================================ */
.btn-descarga,
.btn-favorito,
.btn-eliminar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    padding: 0;
    border: 1px solid rgba(255,255,255,0.2);
    background: rgba(255,255,255,0.1);
    border-radius: 50%;
    color: #fff;
    cursor: pointer;
    transition: background 0.2s, transform 0.15s, color 0.2s;
    flex-shrink: 0;
}
.btn-descarga:hover,
.btn-favorito:hover,
.btn-eliminar:hover {
    background: rgba(255,255,255,0.22);
    transform: scale(1.05);
}
.btn-descarga:active,
.btn-favorito:active,
.btn-eliminar:active { transform: scale(0.95); }
.btn-descarga:focus-visible,
.btn-favorito:focus-visible,
.btn-eliminar:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 2px;
}

.btn-descarga svg,
.btn-favorito svg,
.btn-eliminar svg {
    width: 18px;
    height: 18px;
    display: block;
}

.btn-favorito svg {
    stroke: var(--favorito);
    fill: none;
    transition: fill 0.2s ease, stroke 0.2s ease;
}
.btn-favorito.es-favorito svg {
    fill: var(--favorito);
    stroke: var(--favorito);
}

/* Ícono de basurero: rojo suave */
.btn-eliminar svg {
    stroke: var(--peligro-suave);
    fill: none;
    transition: stroke 0.2s ease;
}
.btn-eliminar:hover svg {
    stroke: var(--peligro);
}

.badge-fav {
    position: absolute;
    top: 0.6rem;
    left: 0.6rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    padding: 0;
    border: none;
    background: rgba(255,255,255,0.9);
    border-radius: 50%;
    box-shadow: 0 2px 8px rgba(0,0,0,0.20);
    z-index: 2;
    pointer-events: none;
}
.badge-fav svg {
    width: 16px;
    height: 16px;
    display: block;
    stroke: var(--favorito);
    fill: var(--favorito);
    stroke-width: 2;
}

.lightbox-acciones {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.lightbox-acciones .btn-favorito,
.lightbox-acciones .btn-descarga,
.lightbox-acciones .btn-eliminar {
    width: 44px;
    height: 44px;
}
.lightbox-acciones .btn-favorito svg,
.lightbox-acciones .btn-descarga svg,
.lightbox-acciones .btn-eliminar svg {
    width: 22px;
    height: 22px;
}

/* ============================================
    MODAL DE CONFIRMACIÓN — Eliminar
    ============================================ */
.modal-eliminar {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.75);
    display: none;
    z-index: 1000;
    padding: 1rem;
    place-items: center;
}
.modal-eliminar.visible { display: grid; }

.modal-eliminar-caja {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 1.75rem 1.5rem 1.5rem;
    max-width: 440px;
    width: 100%;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    display: grid;
    gap: 1.25rem;
    text-align: center;
    border-top: 4px solid var(--peligro-suave);
}

.modal-eliminar-icono {
    width: 56px;
    height: 56px;
    margin: 0 auto;
    display: grid;
    place-items: center;
    background: rgba(255, 107, 107, 0.1);
    border-radius: 50%;
    color: var(--peligro-suave);
}
.modal-eliminar-icono svg {
    width: 28px;
    height: 28px;
    stroke: currentColor;
    fill: none;
}

.modal-eliminar-titulo {
    font-size: 1.15rem;
    font-weight: 800;
    color: var(--primary);
    letter-spacing: -0.3px;
}

.modal-eliminar-texto {
    font-size: 0.95rem;
    color: var(--text-light);
    line-height: 1.5;
}
.modal-eliminar-texto strong {
    color: var(--primary);
    font-weight: 700;
    word-break: break-word;
}

.modal-eliminar-texto .tipo-label {
    color: var(--peligro-suave);
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.82rem;
    letter-spacing: 0.4px;
}

.modal-eliminar-acciones {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.6rem;
    margin-top: 0.5rem;
}

.modal-eliminar-btn {
    padding: 0.75rem 1rem;
    border: none;
    border-radius: 10px;
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    letter-spacing: 0.2px;
}
.modal-eliminar-btn:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.modal-eliminar-btn.cancelar {
    background: var(--light-bg);
    color: var(--primary);
    border: 1px solid var(--border-soft);
}
.modal-eliminar-btn.cancelar:hover {
    background: var(--border-soft);
}

.modal-eliminar-btn.confirmar {
    background: var(--peligro);
    color: #fff;
}
.modal-eliminar-btn.confirmar:hover {
    background: #e02020;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(255, 68, 68, 0.35);
}
.modal-eliminar-btn.confirmar:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* ============================================
    MODAL — AGREGAR FOTO/VIDEO
    ============================================ */
.modal-agregar {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.75);
    display: none;
    z-index: 1000;
    padding: 1rem;
    place-items: center;
}
.modal-agregar.visible { display: grid; }

.modal-agregar-caja {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 1.75rem 1.5rem 1.5rem;
    max-width: 460px;
    width: 100%;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    display: grid;
    gap: 1.1rem;
    border-top: 4px solid var(--accent);
}

.modal-agregar-cab { display: grid; gap: 0.35rem; }
.modal-agregar-titulo {
    font-size: 1.15rem;
    font-weight: 800;
    color: var(--primary);
    letter-spacing: -0.3px;
}
.modal-agregar-texto {
    font-size: 0.92rem;
    color: var(--text-light);
    line-height: 1.5;
}

.campo { display: grid; gap: 0.35rem; text-align: left; }
.campo label {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--primary);
}
.campo input[type="text"] {
    width: 100%;
    padding: 0.7rem 0.9rem;
    border: 2px solid var(--border-soft);
    border-radius: 10px;
    font-family: inherit;
    font-size: 0.92rem;
    background: var(--card-bg);
    color: var(--text-dark);
    outline: none;
    transition: border-color 0.25s, box-shadow 0.25s;
}

.campo input[type="file"] {
    width: 100%;
    padding: 0.35rem;
    border: 2px dashed var(--border-soft);
    border-radius: 12px;
    font-family: inherit;
    font-size: 0.88rem;
    background: var(--light-bg);
    color: var(--text-light);
    outline: none;
    cursor: pointer;
    transition: border-color 0.25s, background 0.25s;
}
.campo input[type="file"]:hover {
    border-color: var(--accent);
    background: rgba(224, 64, 64, 0.04);
}
.campo input[type="file"]::file-selector-button,
.campo input[type="file"]::-webkit-file-upload-button {
    margin-right: 0.75rem;
    padding: 0.55rem 1rem;
    border: none;
    border-radius: 8px;
    background: var(--accent);
    color: #fff;
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s ease;
}
.campo input[type="file"]::file-selector-button:hover,
.campo input[type="file"]::-webkit-file-upload-button:hover {
    background: var(--accent-hover);
}
.campo input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 4px rgba(224,64,64,0.10);
}
.campo-ayuda {
    font-size: 0.78rem;
    color: var(--text-light);
}

.aviso-agregar {
    display: none;
    background: rgba(255, 107, 107, 0.1);
    color: var(--peligro);
    padding: 0.7rem 0.9rem;
    border-radius: 10px;
    font-size: 0.85rem;
    font-weight: 500;
    border-left: 3px solid var(--peligro);
    text-align: left;
}
.aviso-agregar.visible { display: block; }

.modal-agregar-acciones {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.6rem;
    margin-top: 0.25rem;
}

.modal-agregar-btn {
    padding: 0.75rem 1rem;
    border: none;
    border-radius: 10px;
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    letter-spacing: 0.2px;
}
.modal-agregar-btn:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}
.modal-agregar-btn.cancelar {
    background: var(--light-bg);
    color: var(--primary);
    border: 1px solid var(--border-soft);
}
.modal-agregar-btn.cancelar:hover {
    background: var(--border-soft);
}
.modal-agregar-btn.confirmar {
    background: var(--accent);
    color: #fff;
}
.modal-agregar-btn.confirmar:hover {
    background: var(--accent-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(224, 64, 64, 0.35);
}
.modal-agregar-btn.confirmar:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ============================================
    COMBO SEARCH (etiquetas) — estilo Labor Segura
    ============================================ */
.busqueda { position: relative; }
.busqueda-resultados {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid var(--border-soft);
    border-radius: 10px;
    box-shadow: var(--shadow);
    max-height: 220px;
    overflow-y: auto;
    z-index: 50;
    display: none;
    margin-top: 0.25rem;
}
.busqueda-resultados.visible { display: block; }
.busqueda-item {
    display: grid;
    gap: 0.1rem;
    padding: 0.55rem 0.75rem;
    cursor: pointer;
    border-bottom: 1px solid var(--border-soft);
    font-size: 0.85rem;
}
.busqueda-item:last-child { border-bottom: none; }
.busqueda-item:hover { background: rgba(224, 64, 64, 0.06); }
.busqueda-item .bi-nombre { font-weight: 700; color: var(--primary); }
.busqueda-item .bi-meta { font-size: 0.72rem; color: var(--text-light); }
.busqueda-vacio { padding: 0.75rem; font-size: 0.85rem; color: var(--text-light); }

.busqueda-caja {
    position: relative;
    flex: 1;
    min-width: 0;
}
.busqueda-caja .busqueda-lupa {
    position: absolute;
    left: 0.85rem;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    color: var(--text-light);
    pointer-events: none;
    z-index: 1;
}
.campo.busqueda .busqueda-caja input {
    width: 100%;
    padding: 0.6rem 2.5rem 0.6rem 2.5rem;
    border: 2px solid var(--border-soft);
    border-radius: 10px;
    font-family: inherit;
    font-size: 0.9rem;
    color: var(--text-dark);
    outline: none;
    background: #fff;
    transition: border-color 0.25s, box-shadow 0.25s;
}
.campo.busqueda .busqueda-caja input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(224, 64, 64, 0.10);
}
.busqueda-limpiar {
    position: absolute;
    right: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
    width: 26px;
    height: 26px;
    border: none;
    background: transparent;
    color: var(--text-light);
    font-size: 1.4rem;
    line-height: 1;
    cursor: pointer;
    border-radius: 50%;
    display: none;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, color 0.2s;
    z-index: 1;
}
.busqueda-limpiar:hover { background: var(--border-soft); color: var(--primary); }
.busqueda-limpiar.visible { display: flex; }

/* ============================================
    RESPONSIVE
    ============================================ */
@media (max-width: 1279px) {
    :root { --menu-w: 240px; }
    .mosaico { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
}

@media (max-width: 1023px) {
    :root { --menu-w: 72px; }
    .menu-marca-texto,
    .menu-titulo,
    .menu-item span,
    .menu-usuario span,
    .menu-pie .vers-menu { display: none; }
    .menu-item { grid-template-columns: 1fr; justify-items: center; padding: 0.7rem; }
    .menu-usuario { grid-template-columns: 1fr; justify-items: center; }
    .mosaico { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
}

@media (max-width: 767px) {
    :root {
        --menu-w: 0px;
        --cabecera-h: 56px;
    }
    .app {
        grid-template-columns: 1fr;
        grid-template-rows: var(--cabecera-h) minmax(0, 1fr) auto;
        grid-template-areas:
            "header"
            "main"
            "paginacion";
    }
    .menu { display: none; }
    .cabecera { padding: 0.7rem 0.9rem; }
    .cabecera-titulo { font-size: 1rem; }
    .cabecera-tags { display: none; }
    .principal { padding: 0.9rem 0.75rem 1rem; }
    .mosaico { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 0.6rem; }
    .tags-movil {
        display: flex;
        flex-wrap: wrap;
        gap: 0.4rem;
        margin-bottom: 0.75rem;
    }
    .paginacion {
        padding: 0.5rem 0.6rem;
        min-height: 52px;
    }

    /* ✅ Modal un poco más ajustado en móvil */
    .modal-eliminar-caja {
        padding: 1.5rem 1.25rem 1.25rem;
    }
    .modal-eliminar-titulo {
        font-size: 1.05rem;
    }
    .modal-eliminar-texto {
        font-size: 0.9rem;
    }
}

@media (max-width: 511px) {
    .mosaico { grid-template-columns: 1fr 1fr; gap: 0.5rem; }
    .tarjeta-datos { padding: 0.5rem 0.6rem; }
    .tarjeta-nombre { font-size: 0.75rem; }
    .tarjeta-meta { font-size: 0.68rem; }

    .paginacion { justify-content: flex-start; }
    .pag-btn {
        min-width: 38px;
        height: 38px;
        font-size: 0.95rem;
    }
    .pag-puntos { height: 38px; }
}

@media (max-width: 360px) {
    .mosaico { grid-template-columns: 1fr; }
}

.tags-movil { display: none; }
@media (max-width: 767px) { .tags-movil { display: flex; } }

@media (max-width: 768px) {
    .barra-busqueda {
        display: flex;
        flex-wrap: wrap;
        justify-content: flex-end;
    }
    .barra-busqueda input {
        flex: 1 1 100%;
    }
}

/* ============================================
   ETIQUETAS (labels): títulos no seleccionables
   y sin activación del campo al hacer clic
   ============================================ */
label {
    padding-left: 3px;
    -webkit-user-select: none;
    -moz-user-select: none;
    user-select: none;
    pointer-events: none;
}