/* ==========================================================================
   components.css — Formularios, inputs, loader, botones
   ========================================================================== */

/* ── Action Buttons ── */
.btn-action-muted {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--color-primary);
    background: none;
    border: none;
    padding: 0;
    transition: all var(--transition-base);
    text-decoration: none !important;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    outline: none !important;
}

.btn-action-muted:hover {
    color: var(--color-primary-dark);
    opacity: 0.8;
}

.btn-action-muted:focus,
.btn-action-muted:active {
    outline: none !important;
    box-shadow: none !important;
}

/* ── Restore Button ── */
.btn-restore-text {
    font-size: 0.75rem;
    font-weight: 600;
    color: #64748b;
    /* Color restaurado más sutil (slate/gray) en lugar de naranja */
    background: none;
    border: none;
    padding: 0;
    transition: all var(--transition-base);
    text-decoration: none !important;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    outline: none !important;
}

.btn-restore-text:hover {
    color: #334155;
    opacity: 0.8;
}

.btn-restore-text:focus,
.btn-restore-text:active {
    outline: none !important;
    box-shadow: none !important;
}

/* ── AI Processing Effect — shimmer sobrio dentro del textarea ── */
.ai-textarea-wrapper {
    position: relative;
    display: block;
    border-radius: 12px;
}

.ai-textarea-wrapper::before {
    content: none;
    /* sin pseudo-elemento externo */
}

.ai-textarea-wrapper.ai-animating textarea.form-control {
    background-color: transparent !important;
    background-image: linear-gradient(105deg,
            #ffffff 0%,
            #ffffff 35%,
            #e8edff 50%,
            #ffffff 65%,
            #ffffff 100%) !important;
    background-size: 300% 100% !important;
    animation: aiShimmer 1.8s ease-in-out infinite !important;
}

@keyframes aiShimmer {
    0% {
        background-position: 150% 0;
    }

    100% {
        background-position: -150% 0;
    }
}

.ai-textarea-wrapper textarea {
    position: relative;
    z-index: 2;
    border-radius: 12px !important;
    transition: border-color 0.2s, box-shadow 0.2s;
}

#editPlantaBtn {
    display: none;
}

/* ── Container / Card ── */
#mainForm,
#novedadesSection,
#calidadSection,
#ruteroSection,
#actualizarDatosSection {
    background: var(--color-card-bg);
    padding: 3rem;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--color-border);
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
}

@media (max-width: 767px) {

    #mainForm,
    #novedadesSection,
    #calidadSection,
    #ruteroSection,
    #actualizarDatosSection {
        padding: 1.5rem;
        border-radius: 0;
        /* Full width feel en móvil */
        border: none;
        box-shadow: none;
    }
}

/* ── Grid Layout para Datos del Lote (PC) ── */
@media (min-width: 768px) {
    #lotCollapseBody.open {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 1.5rem;
    }

    .row-pc-grid {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 1.5rem;
    }
}

/* ── Form Controls ── */
.form-control {
    border-radius: var(--radius-input);
    border: 1px solid var(--color-border);
    padding: 0.8rem 1rem;
    height: auto;
    font-size: 1rem;
    background-color: transparent;
    transition: all var(--transition-base);
    color: var(--color-text-main);
    appearance: none;
}

/* ── Input con Icono Integrado ── */
.input-with-icon {
    position: relative;
    display: flex;
    align-items: center;
}

.input-with-icon .input-icon {
    position: absolute;
    left: 1rem;
    color: #94a3b8;
    font-size: 0.9rem;
    pointer-events: none;
    z-index: 1;
    transition: color 0.2s ease;
}

.input-with-icon .form-control {
    padding-left: 2.75rem;
}

.input-with-icon:focus-within .input-icon {
    color: var(--color-primary);
}

/* Solo aplicar el fondo de flecha a los SELECT */
select.form-control {
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2364748b' stroke-width='2'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    background-size: 1.25rem;
    padding-right: 3rem;
}

/* Select con icono integrado */
.input-with-icon select.form-control {
    padding-left: 2.75rem;
    padding-right: 3rem;
}

/* Inputs y Textareas normales sin imagen de fondo */
input.form-control,
textarea.form-control {
    background-image: none;
    padding-right: 1rem;
}

.form-control:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px var(--color-primary-shadow);
    outline: none;
}

/* ── Smart Select (Selector Inteligente) ── */
.smart-select-container {
    position: relative;
    width: 100%;
}

.smart-select-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 12px;
    box-shadow: 0 12px 30px -5px rgba(0, 0, 0, 0.15), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
    z-index: 1100;
    max-height: 250px;
    overflow-y: auto;
    margin-top: 6px;
    padding: 4px;
    animation: slideInUpSlight 0.2s ease-out;
}

.smart-select-item {
    padding: 10px 16px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--color-text-main);
    border-radius: 8px;
    transition: all 0.2s ease;
}

.smart-select-item:hover {
    background: var(--color-primary-light);
    color: var(--color-primary-dark);
    padding-left: 20px;
}

.smart-select-input {
    transition: all 0.2s ease;
}

.form-control[readonly],
.form-control[disabled],
.form-control:disabled {
    background-color: #f1f5f9;
    /* Retorno al azul sutil para indicar edición deshabilitada */
    border-color: #e2e8f0;
    color: #475569;
    font-weight: 500;
    cursor: not-allowed;
}

/* ── Labels (Simetría Perfecta) ── */
.form-label,
label {
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-text-label);
    margin-bottom: 0.6rem;
    display: block;
}

/* ── Integrated Phone Input ── */
.phone-input-integrated {
    display: flex;
    align-items: center;
    background-color: #fff;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-input);
    transition: all var(--transition-base);
    overflow: hidden;
}

.phone-input-integrated:focus-within {
    border-color: var(--color-primary);
}

.phone-prefix-area {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 12px;
    background-color: #f8fafc;
    border-right: 1px solid var(--color-border);
    height: 48px;
    /* Altura estándar de nuestros inputs */
    user-select: none;
}

.phone-prefix-area img {
    border-radius: 2px;
}

.phone-prefix-text {
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--color-text-main);
}

.phone-input-integrated .form-control {
    border: none !important;
    box-shadow: none !important;
    height: 48px !important;
    flex: 1;
    padding-left: 12px !important;
}

.field-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    min-height: 20px;
    /* Asegura altura mínima para alineación */
}

.sync-placeholder {
    height: 1px;
    width: 1px;
}

/* ── Buttons ── */
.btn-primary {
    background-color: var(--color-primary);
    border: none;
    border-radius: var(--radius-input);
    padding: 1rem 3rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-size: 0.85rem;
    box-shadow: 0 4px 6px -1px var(--color-primary-shadow);
    transition: all var(--transition-base);
}

.btn-primary:hover {
    background-color: var(--color-primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 10px 15px -3px var(--color-primary-shadow);
}

/* ── Utility Classes ── */
.hidden {
    display: none !important;
}

/* ── Lot Data Collapse ── */
.lot-collapse-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin: 2.5rem 0 1.5rem;
    cursor: pointer;
}

.lot-collapse-header::before,
.lot-collapse-header::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--color-border);
}

.lot-collapse-label {
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-text-label);
}

.lot-collapse-body {
    display: none;
    width: 100%;
}

.lot-collapse-body.open {
    display: block;
    /* Fallback */
    margin-top: 1rem;
    padding: 1.5rem;
    background: #ffffff;
    /* Blanco puro, sin tinte azul */
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
}

@media (max-width: 767px) {
    .lot-collapse-body.open {
        display: block;
    }
}

.lot-chevron {
    transition: transform var(--transition-base);
    color: var(--color-text-muted);
}

.lot-collapse-header.open .lot-chevron {
    transform: rotate(180deg);
}

/* ── File Dropzone ── */
.file-dropzone {
    border: 2px dashed var(--color-border);
    border-radius: var(--radius-lg);
    padding: 3rem 2rem;
    background-color: #f8fafc;
    transition: all var(--transition-base);
}

.file-dropzone:hover {
    border-color: var(--color-primary);
    background-color: #f1f5f9;
}

/* ── Loader ── */
.loader {
    border: 3px solid #f1f5f9;
    border-top: 3px solid var(--color-primary);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 0.8s cubic-bezier(0.4, 0, 0.2, 1) infinite;
    margin: 2rem auto;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ── Suggestions List ── */
#loteSuggestions {
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--color-border);
    overflow: hidden;
    margin-top: 0.5rem;
    background: white;
}

.list-group-item {
    border: none;
    padding: 1rem 1.5rem;
    font-size: 0.95rem;
    transition: background-color var(--transition-base);
}

.list-group-item:hover {
    background-color: var(--color-primary-light);
    color: var(--color-primary-dark);
}

/* ── File Dropzone Details ── */
.file-dropzone {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    cursor: pointer;
}

.file-dropzone__icon {
    font-size: 2.5rem;
    color: var(--color-primary);
}

.file-dropzone__text {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 0.3rem;
    /* Espacio mínimo entre acción y formatos */
}

.file-dropzone__action {
    font-weight: 800;
    /* Más negrita como pidió el usuario */
    font-size: 1rem;
    color: var(--color-text-main);
}

.file-dropzone__hint {
    font-size: 0.75rem;
    color: var(--color-text-muted);
}

.file-dropzone__name {
    margin-top: 0.5rem;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--color-primary);
    background: white;
    padding: 0.4rem 1rem;
    border-radius: 20px;
    box-shadow: var(--shadow-sm);
}

.file-dropzone__input {
    display: none !important;
}

/* ── App Shell: Header Bar ── */
.app-header-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 32px;
    z-index: 1500;
    /* Visible inmediatamente, independiente del escudo del body */
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: auto !important;
}

.nav-brand-area {
    display: flex;
    align-items: center;
}

.nav-logo {
    height: 35px;
    width: auto;
    margin-right: 15px;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.05));
}

.brand-tag {
    font-weight: 700;
    font-size: 0.8rem;
    letter-spacing: 0.3px;
    color: var(--color-primary);
    background: none;
    padding: 0;
    border-radius: 0;
}

/* Compensación para el header fixed */
.content-wrapper {
    margin-top: 80px;
}

/* ── Expand toggle — botón para expandir contenedores al 100% en PC ── */
.btn-expand-view {
    display: none;
    /* solo visible en PC */
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px 10px;
    border-radius: 50%;
    color: #64748b;
    font-size: 1rem;
    transition: all 0.2s ease;
    -webkit-tap-highlight-color: transparent;
    outline: none;
}

.btn-expand-view:hover {
    background: #f1f5f9;
}

.btn-expand-view:focus {
    outline: none;
}

@media (min-width: 768px) {
    .btn-expand-view {
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }
}

/* ── Estado medio (900px) ── */
body.view-medium .wrapper-dashboard,
body.view-medium .seg-wrapper,
body.view-medium #mainForm,
body.view-medium #novedadesSection,
body.view-medium #calidadSection,
body.view-medium #ruteroSection,
body.view-medium #actualizarDatosSection,
body.view-medium .module-wrapper {
    max-width: 900px !important;
    margin-left: auto !important;
    margin-right: auto !important;
}

body.view-medium .container-fluid {
    max-width: 900px !important;
}

body.view-medium .content-wrapper,
body.view-medium #main-content-wrapper {
    padding-left: 1rem !important;
    padding-right: 1rem !important;
}

body.view-medium .empty-state-content {
    max-width: 100% !important;
}

/* ── Estado expandido (100%) ── */
body.view-expanded .wrapper-dashboard,
body.view-expanded .seg-wrapper,
body.view-expanded #mainForm,
body.view-expanded #novedadesSection,
body.view-expanded #calidadSection,
body.view-expanded #ruteroSection,
body.view-expanded #actualizarDatosSection,
body.view-expanded .module-wrapper {
    max-width: 100% !important;
    width: 100% !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
}

body.view-expanded .empty-state-content {
    max-width: 100% !important;
}

body.view-expanded .container-fluid {
    max-width: 100% !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
}

body.view-expanded .content-wrapper,
body.view-expanded #main-content-wrapper {
    padding-left: 0 !important;
    padding-right: 0 !important;
}

@media (min-width: 768px) {

    body.view-expanded .content-wrapper,
    body.view-expanded #main-content-wrapper {
        padding-left: 0 !important;
        padding-right: 0 !important;
    }
}

/* ── Module Wrapper — Contenedor unificado para todos los módulos ── */
.module-wrapper {
    background: var(--color-card-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    width: 96%;
    max-width: 1400px;
    margin: 0 auto 2rem;
    padding: 2rem;
}

@media (max-width: 767px) {
    .module-wrapper {
        width: 100%;
        border-radius: 0;
        border-left: none;
        border-right: none;
        box-shadow: none;
        padding: 2rem;
    }
}

@media (min-width: 768px) {
    .module-wrapper {
        padding: 3rem;
    }
}

/* ── AI History Menu (Premium Glassmorphism) ── */
.ai-history-menu {
    position: absolute;
    min-width: 240px;
    max-width: 300px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 14px;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
    z-index: 3000;
    overflow: hidden;
    animation: slideInUpSlight 0.2s ease-out;
}

@keyframes slideInUpSlight {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.ai-history-header {
    background: #f8fafc;
    padding: 10px 14px;
    font-size: 0.65rem;
    font-weight: 800;
    text-transform: uppercase;
    color: #64748b;
    border-bottom: 1px solid #f1f5f9;
    display: flex;
    align-items: center;
    gap: 8px;
}

.ai-history-item {
    padding: 12px 14px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.ai-history-item:hover {
    background: #f1f5f9;
}

.ai-history-num {
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--color-primary);
    background: var(--color-primary-shadow);
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    margin-top: 2px;
}

.ai-history-text {
    font-size: 0.8rem;
    color: #475569;
    line-height: 1.4;
    white-space: normal;
    word-break: break-word;
}

.btn-profile-toggle {
    background: white;
    border: 1px solid var(--color-border);
    padding: 6px 14px 6px 6px;
    /* Ajuste para dar espacio al icono derecho */
    border-radius: 30px;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    transition: all var(--transition-base);
    box-shadow: var(--shadow-sm);
    -webkit-tap-highlight-color: transparent;
    outline: none;
}

.btn-profile-toggle:hover {
    border-color: var(--color-primary);
    box-shadow: var(--shadow-md);
}

.btn-profile-toggle:focus {
    outline: none;
}

.avatar-mini {
    width: 28px;
    height: 28px;
    background: #94a3b8;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.75rem;
}

/* Colores mini por rol */
.btn-profile-toggle.role-admin .avatar-mini {
    background: var(--color-primary);
}

.btn-profile-toggle.role-user-c .avatar-mini {
    background: #10b981;
}

.btn-profile-toggle.role-user-p .avatar-mini {
    background: #f59e0b;
}

.btn-profile-toggle.user-guest .avatar-mini {
    background: #94a3b8;
}

/* ── App Shell: Sidebar Drawer ── */
.app-sidebar-drawer {
    position: fixed;
    top: 0;
    right: -320px;
    width: 320px;
    height: 100vh;
    background: white;
    z-index: 2500;
    box-shadow: -10px 0 30px rgba(0, 0, 0, 0.1);
    transition: right 0.22s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
}

.app-sidebar-drawer.open {
    right: 0;
}

.sidebar-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(4px);
    z-index: 2400;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.22s ease, visibility 0.22s ease;
}

.sidebar-backdrop.active {
    opacity: 1;
    visibility: visible;
}

/* Sidebar Content */
.sidebar-header {
    padding: 28px 30px 20px;
    border-bottom: 1px solid #f1f5f9;
    flex-shrink: 0;
}

.sidebar-user-card {
    display: flex;
    align-items: center;
    gap: 16px;
}

.user-avatar-large {
    width: 64px;
    height: 64px;
    min-width: 64px;
    min-height: 64px;
    flex-shrink: 0;
    background: #94a3b8;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    font-weight: 700;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

/* Colores grandes por rol */
.user-avatar-large.admin {
    background: var(--color-primary);
    box-shadow: 0 4px 12px var(--color-primary-shadow);
}

.user-avatar-large.user-c {
    background: #10b981;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.2);
}

.user-avatar-large.user-p {
    background: #f59e0b;
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.2);
}

.user-avatar-large.guest {
    background: #f1f5f9;
    color: #94a3b8;
}

.user-meta {
    display: flex;
    flex-direction: column;
}

.u-name {
    font-weight: 700;
    font-size: 1rem;
    color: var(--color-text-main);
    line-height: 1.2;
}

.u-role {
    font-size: 0.75rem;
    color: var(--color-primary);
    font-weight: 700;
    text-transform: uppercase;
    margin-top: 2px;
}

.sidebar-body {
    flex: 1;
    padding: 30px;
    overflow-y: auto;
}

.sidebar-label {
    font-size: 0.7rem;
    font-weight: 800;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 16px;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: #475569;
    text-decoration: none !important;
    border-radius: 8px;
    font-size: 0.88rem;
    font-weight: 600;
    transition: all 0.2s ease;
    margin-bottom: 4px;
}

.sidebar-link:hover {
    background: #f8fafc;
    color: var(--color-primary);
}

.sidebar-link.active {
    background: var(--color-primary-shadow);
    color: var(--color-primary);
}

.sidebar-link--disabled {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: 10px;
    color: #cbd5e1;
    font-size: 0.88rem;
    font-weight: 600;
    cursor: not-allowed;
    user-select: none;
}

.sidebar-footer {
    padding: 30px;
    border-top: 1px solid #f1f5f9;
}

.btn-logout-full {
    width: 100%;
    padding: 12px;
    border-radius: 8px;
    border: 1px solid #fee2e2;
    background: #fff;
    color: #ef4444;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-logout-full:hover {
    background: #fef2f2;
    transform: translateY(-2px);
}

.btn-login-sidebar {
    width: 100%;
    padding: 14px;
    border-radius: 12px;
    border: none;
    background: var(--color-primary);
    color: white;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 4px 12px var(--color-primary-shadow);
    transition: all 0.2s ease;
}

.btn-login-sidebar:hover {
    background: var(--color-primary-dark);
    transform: translateY(-2px);
}

@media (max-width: 767px) {
    .app-header-bar {
        padding: 0 16px;
    }

    .app-sidebar-drawer {
        width: 290px;
        right: -290px;
        border-top-left-radius: 20px;
        border-bottom-left-radius: 20px;
    }
}

/* ── Sidebar Footer & Credits ── */
.sidebar-footer {
    padding: 20px 30px 30px;
    border-top: 1px solid #f1f5f9;
    background: #fcfcfc;
}

.sidebar-credits {
    text-align: center;
    color: #94a3b8;
    font-size: 0.7rem;
    font-weight: 500;
}

.sidebar-credits p {
    margin-bottom: 12px;
}

.social-links-sidebar {
    display: flex;
    justify-content: center;
    gap: 15px;
}

.social-links-sidebar a {
    color: #cbd5e1;
    font-size: 1.1rem;
    transition: all 0.2s ease;
}

.social-links-sidebar a:hover {
    color: var(--color-primary);
    transform: translateY(-2px);
}

/* ── Sincronizador Discreto ── */
.sync-indicator {
    display: none;
    position: fixed;
    top: 75px;
    left: 32px;
    background: white;
    padding: 8px 16px;
    border-radius: 30px;
    box-shadow: var(--shadow-sm);
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--color-primary);
    z-index: 1000;
    border: 1px solid var(--color-border);
}

@media (max-width: 767px) {
    .sync-indicator {
        top: 70px;
        left: 15px;
        font-size: 0.7rem;
        padding: 6px 12px;
    }
}


/* ── Notification System ── */
@keyframes slideDownPanel {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes bellPulse {

    0%,
    100% {
        transform: rotate(0deg);
    }

    15% {
        transform: rotate(12deg);
    }

    30% {
        transform: rotate(-10deg);
    }

    45% {
        transform: rotate(8deg);
    }

    60% {
        transform: rotate(-6deg);
    }

    75% {
        transform: rotate(4deg);
    }
}

#notif-bell-btn.has-unread i {
    animation: bellPulse 0.8s ease-in-out;
    color: #3b82f6;
}

/* ── Chat Button (resolucion cards) ── */
.btn-chat-ultra {
    height: auto;
    border-radius: 10px;
    background: linear-gradient(135deg, #3b82f6, #6366f1);
    color: white;
    border: none;
    font-size: 0.65rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 8px 12px;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

.btn-chat-ultra:hover {
    transform: translateY(-1px);
    filter: brightness(1.1);
    box-shadow: 0 6px 12px rgba(59, 130, 246, 0.25);
}

.btn-chat-ultra i {
    font-size: 0.8rem;
}

/* ── Chat unread badge ── */
.btn-chat-ultra {
    position: relative;
}

.btn-chat-ultra.has-unread-chat {
    animation: chatPulse 1.8s ease-in-out infinite;
    background: linear-gradient(135deg, #f59e0b, #ef4444);
}

@keyframes chatPulse {

    0%,
    100% {
        box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    }

    50% {
        box-shadow: 0 0 0 5px rgba(239, 68, 68, 0.25);
    }
}

.chat-unread-dot {
    position: absolute;
    top: -4px;
    right: -4px;
    width: 10px;
    height: 10px;
    background: #ef4444;
    border-radius: 50%;
    border: 2px solid white;
    animation: dotBounce 1s ease-in-out infinite;
}

@keyframes dotBounce {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.3);
    }
}

/* ── Chat: typing dots animation ── */
.typing-dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.85);
    display: inline-block;
    animation: typingBounce 1.2s ease-in-out infinite;
}

.typing-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typingBounce {

    0%,
    60%,
    100% {
        transform: translateY(0);
        opacity: 0.5;
    }

    30% {
        transform: translateY(-4px);
        opacity: 1;
    }
}

/* ── Avatar customizer ── */
.avatar-edit-btn {
    position: relative;
    cursor: pointer;
    flex-shrink: 0;
    display: inline-block;
    border-radius: 50%;
}

.avatar-edit-btn .avatar-overlay {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.38);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s;
    font-size: 1.1rem;
    color: white;
    pointer-events: none;
}

.avatar-edit-btn:hover .avatar-overlay {
    opacity: 1;
}

.avatar-edit-btn.customizer-open .avatar-overlay {
    opacity: 1;
}

/* Botón de subir foto dentro del panel */
.avatar-upload-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--color-primary);
    background: white;
    border: 1.5px solid var(--color-primary);
    border-radius: 8px;
    padding: 5px 12px;
    cursor: pointer;
    transition: all 0.15s;
}

.avatar-upload-btn:hover {
    background: #eef2ff;
}

.avatar-customizer-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.avatar-customizer {
    margin-top: 12px;
    background: #f8fafc;
    border-radius: 12px;
    padding: 12px 14px;
    flex-direction: column;
    gap: 12px;
    animation: slideDownFade 0.18s ease-out;
}

@keyframes slideDownFade {
    from {
        opacity: 0;
        transform: translateY(-6px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.avatar-customizer {
    margin-top: 14px;
    background: #f8fafc;
    border-radius: 12px;
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.avatar-customizer-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.avatar-customizer-label {
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #94a3b8;
    min-width: 36px;
}

.avatar-color-picker-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
}

.avatar-color-picker-wrap input[type="color"] {
    width: 0;
    height: 0;
    opacity: 0;
    position: absolute;
    pointer-events: none;
}

.avatar-color-preview {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid rgba(0, 0, 0, 0.08);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
    transition: transform 0.15s;
    flex-shrink: 0;
}

.avatar-color-preview:hover {
    transform: scale(1.1);
}

.avatar-color-hex {
    font-size: 0.72rem;
    font-weight: 700;
    color: #64748b;
    font-family: 'JetBrains Mono', monospace;
    letter-spacing: 0.5px;
}

.avatar-icon-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    flex: 1;
}

.avatar-icon-btn {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: 1.5px solid #e2e8f0;
    background: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    color: #64748b;
    transition: all 0.15s;
}

.avatar-icon-btn:hover {
    border-color: var(--color-primary);
    color: var(--color-primary);
    background: #eef2ff;
    transform: scale(1.1);
}

.avatar-icon-btn.active {
    border-color: var(--color-primary);
    background: var(--color-primary);
    color: white;
}

/* ── Sidebar Settings Panel ── */
.sidebar-settings-section {
    margin-top: 24px;
}

.sidebar-settings-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    user-select: none;
    margin-bottom: 4px;
    padding: 0;
}

.sidebar-settings-title {
    font-size: 0.7rem;
    font-weight: 800;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.sidebar-settings-chevron {
    color: #94a3b8;
    font-size: 0.65rem;
    transition: transform 0.22s ease;
}

.sidebar-settings-chevron.open {
    transform: rotate(180deg);
}

.sidebar-settings-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.25s ease;
}

.sidebar-settings-content.open {
    max-height: 600px;
}

.sidebar-settings-label {
    display: none;
}

.settings-toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 4px;
    border-bottom: none;
}

.settings-toggle-row:last-child {
    border-bottom: none;
}

.settings-toggle-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.settings-toggle-title {
    font-size: 0.88rem;
    font-weight: 600;
    color: #475569;
    display: flex;
    align-items: center;
    gap: 12px;
}

.settings-toggle-title i {
    font-size: 1rem;
    color: #475569;
    width: 16px;
    text-align: center;
}

.settings-toggle-sub {
    font-size: 0.75rem;
    color: #94a3b8;
    padding-left: 28px;
}

.toggle-switch {
    position: relative;
    width: 42px;
    height: 24px;
    flex-shrink: 0;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-track {
    position: absolute;
    inset: 0;
    border-radius: 12px;
    background: #e2e8f0;
    cursor: pointer;
    transition: background 0.25s;
}

.toggle-track::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: white;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
    transition: transform 0.25s;
}

.toggle-switch input:checked+.toggle-track {
    background: var(--color-primary);
}

.toggle-switch input:checked+.toggle-track::after {
    transform: translateX(18px);
}

.toggle-switch input:disabled+.toggle-track {
    opacity: 0.45;
    cursor: not-allowed;
}

.toggle-track.is-on {
    background: var(--color-primary);
}

.toggle-track.is-on::after {
    transform: translateX(18px);
}

.toggle-track.is-disabled {
    opacity: 0.45;
    cursor: not-allowed;
}


/* ══════════════════════════════════════════════════════════════════════════
   Empty State Message — Mensaje profesional de bienvenida
   ══════════════════════════════════════════════════════════════════════════ */
.empty-state-message {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: flex-start;
    padding: 0;
    text-align: left;
    background: transparent;
    border-radius: 16px;
    border: none;
    box-shadow: none;
    margin-top: 20px;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.empty-state-message::before {
    content: none;
}

.empty-state-message.hidden {
    display: none;
}

/* Contenido del mensaje */
.empty-state-content {
    max-width: 100%;
    width: 100%;
    position: relative;
    z-index: 1;
}

.empty-state-text {
    text-align: justify;
    line-height: 1.8;
    color: #475569;
    font-size: 0.95rem;
}

.empty-state-text p {
    margin: 0 0 18px 0;
}

.empty-state-text p:last-of-type {
    margin-bottom: 0;
}

.empty-state-text strong {
    color: #1e293b;
    font-weight: 700;
}

/* Firma */
.empty-state-signature {
    margin-top: 32px !important;
    padding-top: 24px;
    border-top: 2px solid #e2e8f0;
    font-size: 1rem !important;
    color: #64748b !important;
    text-align: right !important;
    font-style: normal;
}

.empty-state-signature strong {
    color: #3b82f6;
    font-size: 1.15rem;
    font-weight: 800;
    font-style: normal;
    display: block;
    margin-top: 4px;
}

/* Responsive para móviles */
@media (max-width: 768px) {
    .empty-state-message {
        padding: 40px 24px;
    }

    .empty-state-message::before {
        width: 280px;
        height: 280px;
        opacity: 0.04;
    }

    .empty-state-text {
        font-size: 0.875rem;
        text-align: left;
        line-height: 1.7;
    }

    .empty-state-text p {
        margin-bottom: 16px;
    }

    .empty-state-signature {
        font-size: 0.9rem !important;
        margin-top: 28px !important;
        padding-top: 20px;
    }

    .empty-state-signature strong {
        font-size: 1.05rem;
    }
}

@media (max-width: 480px) {
    .empty-state-message {
        padding: 32px 20px;
    }

    .empty-state-message::before {
        width: 220px;
        height: 220px;
        opacity: 0.05;
    }

    .empty-state-text {
        font-size: 0.85rem;
    }
}


/* ══════════════════════════════════════════════════════════════════════════
   View Toggle — Cambiar entre búsqueda y tarjetas
   ══════════════════════════════════════════════════════════════════════════ */
.view-toggle {
    display: flex;
    width: 100%;
    background: transparent;
    border: 1px solid var(--color-border);
    border-radius: 10px;
    padding: 4px;
    gap: 4px;
}

.view-toggle-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1;
    padding: 8px 12px;
    border: none;
    background: transparent;
    color: #64748b;
    font-size: 0.875rem;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    outline: none;
}

.view-toggle-btn:hover {
    color: #334155;
    background: rgba(255, 255, 255, 0.5);
}

.view-toggle-btn:focus {
    outline: none;
    box-shadow: none;
}

.view-toggle-btn.active {
    background-color: white !important;
    background: white !important;
    color: #3b82f6;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12);
    border-radius: 6px;
}

.view-toggle-btn i {
    font-size: 0.9rem;
}

/* Responsive */
@media (max-width: 768px) {
    .view-toggle {
        width: 100%;
        justify-content: stretch;
    }

    .view-toggle-btn {
        flex: 1;
        justify-content: center;
        padding: 8px 10px;
    }
}

/* ══════════════════════════════════════════════════════════════════════════
   Lotes Cards — Vista de tarjetas para GUEST
   ══════════════════════════════════════════════════════════════════════════ */

.lotes-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    max-width: 100%;
    gap: 16px;
    margin-top: 12px;
}

/* Limitar a máximo 2 columnas en PC */
@media (min-width: 769px) {
    .lotes-cards-grid {
        grid-template-columns: repeat(auto-fit, minmax(280px, calc(50% - 8px)));
    }

    /* Si solo hay una tarjeta, que ocupe todo el ancho */
    .lotes-cards-grid:has(.lote-card:only-child) {
        grid-template-columns: 1fr;
    }
}

.lote-card {
    background: transparent;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    padding: 16px;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
}

.lote-card:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: #3b82f6;
    box-shadow: 0 8px 24px rgba(59, 130, 246, 0.15);
    transform: translateY(-2px);
}

.lote-card-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 12px;
}

.lote-card-lote {
    font-size: 1.25rem;
    font-weight: 800;
    color: #1e293b;
    line-height: 1.2;
}

.lote-card-badge {
    background: linear-gradient(135deg, #eff6ff, #dbeafe);
    color: #1e40af;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 6px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.lote-card-body {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.lote-card-row {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.875rem;
    line-height: 1.5;
}

.lote-card-icon {
    width: 20px;
    text-align: center;
    color: #64748b;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.lote-card-label {
    color: #64748b;
    font-weight: 600;
    min-width: 85px;
}

.lote-card-value {
    color: #334155;
    font-weight: 600;
    flex: 1;
}

.lote-card-footer {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #f1f5f9;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.lote-card-date {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.75rem;
    color: #94a3b8;
    line-height: 1.5;
}

.lote-card-date i {
    font-size: 0.75rem;
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.lote-card-action {
    font-size: 0.75rem;
    font-weight: 700;
    color: #3b82f6;
    display: flex;
    align-items: center;
    gap: 4px;
}

.lote-card-action i {
    font-size: 0.7rem;
    transition: transform 0.2s ease;
}

.lote-card:hover .lote-card-action i {
    transform: translateX(3px);
}

/* Estado vacío para tarjetas */
.lotes-cards-empty {
    text-align: center;
    padding: 60px 20px;
    color: #94a3b8;
}

.lotes-cards-empty i {
    font-size: 3rem;
    margin-bottom: 16px;
    opacity: 0.5;
}

.lotes-cards-empty p {
    font-size: 0.95rem;
    margin: 0;
}

/* Responsive */
@media (max-width: 768px) {
    .lotes-cards-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .lote-card {
        padding: 14px;
    }

    .lote-card-lote {
        font-size: 1.1rem;
    }
}

/* ══════════════════════════════════════════════════════════════════════════
   Summary Panel — Resumen de OPs y unidades
   ══════════════════════════════════════════════════════════════════════════ */
.summary-panel {
    background: white;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    margin-top: 16px;
    margin-bottom: 16px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.summary-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: white;
    font-weight: 700;
    font-size: 0.9rem;
}

.summary-header i {
    font-size: 1rem;
}

.summary-content {
    padding: 0;
}

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

.summary-box {
    padding: 20px;
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.summary-box:first-child {
    border-right: 2px solid #e2e8f0;
}

.summary-box-label {
    font-size: 0.875rem;
    color: #64748b;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.summary-box-value {
    font-size: 2rem;
    font-weight: 800;
    color: #3b82f6;
    line-height: 1;
}

@media (max-width: 768px) {
    .summary-panel {
        margin-top: 12px;
        margin-bottom: 12px;
    }

    .summary-box {
        padding: 16px;
    }

    .summary-box-value {
        font-size: 1.75rem;
    }
}


/* ══════════════════════════════════════════════════════════════════════════
   Welcome Collapse — Mensaje colapsable en vista de tarjetas
   ══════════════════════════════════════════════════════════════════════════ */
.welcome-collapse {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    margin-top: 20px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.welcome-collapse-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    cursor: pointer;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    transition: all 0.2s ease;
    user-select: none;
}

.welcome-collapse-header:hover {
    background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
}

.welcome-collapse-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.9rem;
    font-weight: 700;
    color: #334155;
}

.welcome-collapse-title i {
    color: #64748b;
    font-size: 1rem;
}

.welcome-collapse-icon {
    color: #64748b;
    font-size: 0.85rem;
    transition: transform 0.3s ease;
}

.welcome-collapse-header.open .welcome-collapse-icon {
    transform: rotate(180deg);
}

.welcome-collapse-body {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.welcome-collapse-body.open {
    max-height: 1000px;
}

.welcome-collapse-content {
    padding: 20px 24px;
    text-align: justify;
    line-height: 1.8;
    color: #475569;
    font-size: 0.9rem;
    background: white;
    position: relative;
    overflow: hidden;
}

.welcome-collapse-content::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 300px;
    height: 300px;
    background-image: url('../icons/app.svg');
    background-position: center center;
    background-repeat: no-repeat;
    background-size: contain;
    opacity: 0.03;
    filter: grayscale(100%) brightness(1.2);
    z-index: 0;
    pointer-events: none;
}

.welcome-collapse-content p {
    margin: 0 0 16px 0;
    position: relative;
    z-index: 1;
}

.welcome-collapse-content p:last-of-type {
    margin-bottom: 0;
}

.welcome-collapse-content strong {
    color: #1e293b;
    font-weight: 700;
}

.welcome-collapse-signature {
    margin-top: 24px !important;
    padding-top: 20px;
    border-top: 2px solid #e2e8f0;
    font-size: 0.95rem !important;
    color: #64748b !important;
    text-align: right !important;
    font-style: normal;
    position: relative;
    z-index: 1;
}

.welcome-collapse-signature strong {
    color: #1e293b;
    font-size: 1.1rem;
    font-weight: 800;
    display: block;
    margin-top: 4px;
}

/* Responsive */
@media (max-width: 768px) {
    .welcome-collapse-header {
        padding: 12px 16px;
    }

    .welcome-collapse-title {
        font-size: 0.85rem;
    }

    .welcome-collapse-content {
        padding: 16px 18px;
        font-size: 0.85rem;
        text-align: left;
    }

    .welcome-collapse-content::before {
        width: 200px;
        height: 200px;
        opacity: 0.04;
    }

    .welcome-collapse-content p {
        margin-bottom: 14px;
    }

    .welcome-collapse-signature {
        font-size: 0.875rem !important;
        margin-top: 20px !important;
        padding-top: 16px;
    }

    .welcome-collapse-signature strong {
        font-size: 1rem;
    }
}


/* ══════════════════════════════════════════════════════════════════════════
   Planta Filter — Filtro de planta para ADMIN en vista de tarjetas
   ══════════════════════════════════════════════════════════════════════════ */
#plantaFilter {
    width: 100%;
    margin-bottom: 0;
}

#plantaFilter .input-with-icon {
    width: 100%;
}

#plantaFilter .form-control {
    width: 100%;
}

/* Asegurar que el placeholder tenga exactamente el mismo estilo que el input de OP */
#plantaFilterInput::placeholder {
    font-weight: 400 !important;
    font-size: 1rem !important;
}

/* Asegurar que las tarjetas empiecen después del filtro con el mismo espaciado */
.lotes-cards-grid {
    width: 100%;
    margin-top: 20px;
}

/* Asegurar que el mensaje de ADMIN tenga el mismo espaciado que el de búsqueda */
#emptyStateMessageAdmin {
    margin-top: 0;
}

.planta-suggestions {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    max-height: 300px;
    overflow-y: auto;
    z-index: 100;
    list-style: none;
    padding: 0;
    margin: 0;
}

.planta-suggestions.hidden {
    display: none;
}

.planta-suggestions li {
    padding: 12px 16px;
    cursor: pointer;
    transition: all 0.15s ease;
    font-size: 0.875rem;
    color: #334155;
    border-bottom: 1px solid #f1f5f9;
}

.planta-suggestions li:last-child {
    border-bottom: none;
}

.planta-suggestions li:hover {
    background: #f8fafc;
    color: #3b82f6;
}

.planta-suggestions li:active {
    background: #eff6ff;
}

/* Responsive */
@media (max-width: 768px) {
    .planta-filter {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
        padding: 14px 16px;
    }

    .planta-filter-label {
        font-size: 0.85rem;
    }

    .planta-filter-input {
        width: 100%;
    }
}

/* ══════════════════════════════════════════════════════════════════════════
   Filas Dinámicas Responsive — Formulario de Novedades
   ══════════════════════════════════════════════════════════════════════════ */

/* Desktop: 2 columnas para insumos, corte y telas */
@media (min-width: 768px) {
    .fila-2-cols {
        display: grid !important;
        grid-template-columns: 1fr 1fr !important;
        gap: 1rem !important;
    }

    .fila-3-cols {
        display: grid !important;
        grid-template-columns: 1fr 1fr 1fr !important;
        gap: 0.75rem !important;
    }
}

/* Móvil: 1 columna para todos los campos dinámicos */
@media (max-width: 767px) {

    .fila-2-cols,
    .fila-3-cols {
        display: grid !important;
        grid-template-columns: 1fr !important;
        gap: 0.75rem !important;
    }
}

/* ── Productora Selection Overlay ── */
.productora-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #ffffff;
    /* Fondo blanco limpio */
    z-index: 99999;
    /* Por encima de todo */
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    animation: prodFadeIn 0.3s ease;
}

.productora-container {
    max-width: 450px;
    width: 100%;
    text-align: center;
    padding: 10px;
}

.productora-logo {
    width: 80px;
    height: 80px;
    margin-bottom: 24px;
}

.productora-header h2 {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--color-text-main);
    margin-bottom: 12px;
}

.productora-header p {
    font-size: 1rem;
    color: var(--color-text-label);
    margin-bottom: 32px;
    line-height: 1.5;
}

.productora-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: 400px;
    overflow-y: auto;
    padding: 10px 8px;
    border-radius: var(--radius-md);
}

/* Custom Scrollbar for list */
.productora-list::-webkit-scrollbar {
    width: 4px;
}

.productora-list::-webkit-scrollbar-thumb {
    background: var(--color-border);
    border-radius: 4px;
}

.productora-item {
    position: relative;
    /* Para el icono de fondo */
    overflow: hidden;
    /* Contener el icono de fondo */
    background-color: #f8fafc;
    border: 2px solid #f1f5f9;
    border-radius: var(--radius-md);
    padding: 24px 20px;
    /* Un poco más de aire */
    cursor: pointer;
    transition: all var(--transition-base);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    width: 100%;
    text-decoration: none !important;
}

.productora-item:hover {
    border-color: var(--color-primary);
    background-color: #f0f4ff;
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(63, 81, 181, 0.1);
}

.productora-item i.productora-bg-icon {
    position: absolute;
    right: -10px;
    bottom: -10px;
    font-size: 5rem;
    /* Ajustado para mejor visibilidad */
    color: var(--color-primary);
    opacity: 0.1;
    /* Aumentado de 0.05 para que se vea */
    z-index: 0;
    pointer-events: none;
    transform: rotate(-15deg);
    transition: all var(--transition-base);
}

.productora-item:hover i.productora-bg-icon {
    transform: rotate(-5deg) scale(1.1);
    opacity: 0.15;
}

.productora-item-info {
    position: relative;
    z-index: 1;
    /* Por encima del icono */
    width: 100%;
}

.productora-name {
    font-weight: 600;
    color: var(--color-text-main);
    display: block;
    font-size: 0.85rem;
    line-height: 1.2;
    /* Permitir que el texto se vea completo en varias líneas */
    white-space: normal;
    word-break: break-word;
}

.productora-nit {
    font-size: 0.75rem;
    /* Reducido */
    color: var(--color-text-muted);
}

.productora-item .fa-chevron-right {
    font-size: 0.7rem;
    /* Reducido */
    opacity: 0.2;
}

.productora-loader {
    padding: 40px;
    color: var(--color-text-muted);
    font-weight: 500;
}

@keyframes prodFadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* ── Botón Cambiar Productora (Sidebar) ── */
.btn-change-prod {
    width: 100%;
    padding: 12px;
    margin-bottom: 12px;
    background: #ffffff;
    color: #3b82f6;
    border: 1px solid #dbeafe;
    border-radius: 8px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-change-prod:hover {
    background: #eff6ff;
    border-color: #bfdbfe;
    color: #2563eb;
    transform: translateY(-2px);
}

.btn-change-prod:active {
    transform: translateY(0);
}

/* ── Modern Empty State for Data Grids ── */
.modern-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    text-align: center;
    border-radius: 16px;
    margin: 20px 0;
    color: #64748b;
    transition: all 0.3s ease;
}

.modern-empty-state:hover {
    border-color: #cbd5e1;
    background: #f1f5f9;
}

.modern-empty-state-icon {
    font-size: 3.5rem;
    color: #94a3b8;
    margin-bottom: 20px;
    opacity: 0.7;
    filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.05));
}

.modern-empty-state-title {
    font-size: 1.25rem;
    font-weight: 800;
    color: #334155;
    margin-bottom: 8px;
    letter-spacing: -0.01em;
}

.modern-empty-state-desc {
    font-size: 0.95rem;
    color: #64748b;
    max-width: 400px;
    line-height: 1.5;
    margin: 0 auto;
}

/* ==========================================================================
   Premium Floating Templates FAB & Modal Style
   ========================================================================== */

/* Botón Flotante (FAB) */
.fab-templates-trigger {
    position: fixed;
    top: calc(50% - 40px);
    right: 30px;
    left: auto;
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: rgba(15, 23, 42, 0.45); /* Estilo AssistiveTouch en reposo */
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    color: rgba(255, 255, 255, 0.75) !important;
    border: 2px solid rgba(255, 255, 255, 0.2);
    outline: none !important;
    box-shadow: none !important;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    cursor: pointer;
    z-index: 9990;
    opacity: 0.4;
    transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.2), opacity 0.3s ease, background 0.3s, border-color 0.3s, color 0.3s;
    touch-action: none; /* Prevenir gestos predeterminados del móvil durante el arrastre */
}

.fab-templates-trigger:hover,
.fab-templates-trigger:active,
.fab-templates-trigger.modal-open {
    opacity: 1;
    background: linear-gradient(135deg, #3f51b5, #6366f1); /* Se enciende en azul al tocarlo/abrirlo */
    border-color: rgba(255, 255, 255, 0.4);
    color: #ffffff !important;
    transform: scale(1.08);
    box-shadow: none !important;
}

.fab-templates-trigger:active {
    transform: scale(0.95);
}

/* Backdrop del Modal */
.templates-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 9995;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: none;
}

.templates-modal-backdrop.open {
    opacity: 1;
    pointer-events: auto;
}

/* Caja del Modal (Glassmorphism & Lux Design) */
.templates-modal-box {
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 24px;
    width: 520px;
    max-width: 92%;
    max-height: 85vh;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: none;
}

.templates-modal-backdrop.open .templates-modal-box {
    transform: none;
}

/* Cabecera del Modal */
.templates-modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid #f1f5f9;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f8fafc;
}

.templates-modal-title {
    font-size: 1.1rem;
    font-weight: 800;
    color: #0f172a;
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
}

.templates-modal-title i {
    color: #3f51b5;
}

.templates-modal-close {
    background: none;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    font-size: 1.2rem;
    transition: color 0.15s;
    outline: none !important;
}

.templates-modal-close:hover {
    color: #ef4444;
}



/* Pestañas (Tabs) */
.templates-tabs {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    background: #f1f5f9;
    padding: 5px;
    margin: 18px 24px 12px;
    border-radius: 16px;
    gap: 4px;
}

.templates-tab-btn {
    border: none;
    background: none;
    padding: 11px 12px;
    font-size: 0.8rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #64748b;
    cursor: pointer;
    border-radius: 12px;
    transition: background-color 0.15s, color 0.15s;
    outline: none !important;
}

.templates-tab-btn.active {
    background: #ffffff;
    color: #3f51b5;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

/* Cuerpo / Lista de Plantillas */
.templates-modal-body {
    padding: 16px 24px 28px;
    overflow-y: auto;
    flex: 1;
}

.templates-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.template-card {
    background: #f8fafc;
    border: 1px solid #f1f5f9;
    border-radius: 20px;
    padding: 20px;
    transition: background-color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.template-card:hover {
    background: #ffffff;
    border-color: #e2e8f0;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.04);
}

.template-text {
    font-size: 0.92rem;
    color: #334155;
    line-height: 1.6;
    font-weight: 500;
    margin: 0;
    white-space: pre-line;
}

/* Botones de acción de cada tarjeta */
.template-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    border-top: 1px solid #f1f5f9;
    padding-top: 10px;
}

.btn-template-action {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    padding: 6px 12px;
    border-radius: 10px;
    font-size: 0.72rem;
    font-weight: 700;
    color: #475569;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: all 0.15s;
    outline: none !important;
}

.btn-template-action:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
    color: #0f172a;
}

.btn-template-action.btn-insert {
    background: #3f51b5;
    border-color: #3f51b5;
    color: #ffffff;
}

.btn-template-action.btn-insert:hover {
    background: #303f9f;
    border-color: #303f9f;
}

.btn-template-action i {
    font-size: 0.8rem;
}

/* Estado Vacío de Búsqueda */
.templates-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    text-align: center;
    color: #94a3b8;
}

.templates-empty-state i {
    font-size: 2rem;
    margin-bottom: 12px;
    opacity: 0.7;
}

.templates-empty-state p {
    font-size: 0.85rem;
    margin: 0;
}

/* Media Queries para Mobile Compact */
@media (max-width: 480px) {
    .fab-templates-trigger {
        top: calc(50% - 36px);
        right: 20px;
        left: auto;
        width: 72px;
        height: 72px;
        font-size: 1.7rem;
    }

    .templates-modal-box {
        max-height: 80vh;
        border-radius: 20px;
    }

    .templates-modal-header {
        padding: 16px 20px;
    }

    .templates-tabs {
        margin: 10px 20px 6px;
    }

    .templates-tab-btn {
        padding: 6px 8px;
        font-size: 0.65rem;
    }

    .templates-modal-body {
        padding: 10px 20px 20px;
    }

    .template-card {
        padding: 12px;
        border-radius: 12px;
    }

    .template-text {
        font-size: 0.8rem;
    }

    .btn-template-action {
        padding: 5px 10px;
        font-size: 0.68rem;
    }
}