@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&display=swap');

:root {
    /* Paleta Beige, Blanco y Negro */
    --bg-canvas: #F7F5F0;
    --bg-canvas-subtle: #EFECE4;
    --bg-surface: #FFFFFF;
    --bg-surface-hover: #FAF8F5;
    --bg-dark: #18181B;
    --bg-dark-hover: #27272A;
    --bg-dark-subtle: #292524;
    
    --border-subtle: #E7E2D8;
    --border-medium: #D6CFBF;
    --border-dark: #18181B;

    --text-primary: #18181B;
    --text-secondary: #78716C;
    --text-muted: #A8A29E;
    --text-white: #FFFFFF;

    /* Estados Reclamos y Vehículos */
    --status-pendiente-bg: #FEF3C7;
    --status-pendiente-text: #92400E;
    --status-en-curso-bg: #E0F2FE;
    --status-en-curso-text: #0369A1;
    --status-resuelto-bg: #DCFCE7;
    --status-resuelto-text: #166534;
    --status-desestimado-bg: #F3F4F6;
    --status-desestimado-text: #4B5563;
    --status-cancelado-bg: #FEE2E2;
    --status-cancelado-text: #991B1B;

    /* Orígenes Institucionales */
    --badge-intendencia-bg: #18181B;
    --badge-intendencia-text: #FFFFFF;
    --badge-atencion-bg: #EDE9FE;
    --badge-atencion-text: #5B21B6;
    --badge-defensoria-bg: #FEF3C7;
    --badge-defensoria-text: #92400E;

    /* Turnos */
    --turno-manana-bg: #FEF9C3;
    --turno-manana-text: #854D0E;
    --turno-mediodia-bg: #FFEDD5;
    --turno-mediodia-text: #9A3412;
    --turno-tarde-bg: #DBEAFE;
    --turno-tarde-text: #1E40AF;
    --turno-noche-bg: #E0E7FF;
    --turno-noche-text: #3730A3;

    /* Geometría Redondeada */
    --radius-xs: 6px;
    --radius-sm: 10px;
    --radius-md: 14px;
    --radius-lg: 20px;
    --radius-xl: 26px;
    --radius-full: 9999px;

    /* Sombras Cálidas & Elevación */
    --shadow-sm: 0 2px 6px rgba(24, 24, 27, 0.03);
    --shadow-md: 0 6px 18px rgba(24, 24, 27, 0.05);
    --shadow-lg: 0 14px 32px rgba(24, 24, 27, 0.07);
    --shadow-modal: 0 20px 45px rgba(24, 24, 27, 0.14);

    --transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    -webkit-font-smoothing: antialiased;
}

/* Scrollbars modernas y elegantes */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: var(--border-medium);
    border-radius: 9999px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--border-dark);
}

body {
    background-color: var(--bg-canvas);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    position: relative;
}

/* Marca de Agua Semitransparente del Ave en el Fondo de la Web */
body::before {
    content: '';
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 650px;
    height: 650px;
    max-width: 80vw;
    max-height: 80vh;
    background-image: url('../imgs/DavidZnevnantranslucent.png');
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
    opacity: 0.045;
    pointer-events: none;
    z-index: 0;
}

/* Layout Principal */
.app-container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
    padding: 0 20px 40px 20px;
    position: relative;
    z-index: 1;
}

/* Topbar / Header */
.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 0;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border-subtle);
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: var(--text-primary);
}

.brand-icon {
    width: 42px;
    height: 42px;
    background-color: var(--bg-dark);
    color: var(--text-white);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 1.25rem;
    letter-spacing: -0.5px;
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.brand-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.brand-name {
    font-size: 1.35rem;
    font-weight: 800;
    letter-spacing: -0.5px;
}

.brand-tag {
    font-size: 0.75rem;
    background-color: var(--bg-canvas-subtle);
    color: var(--text-secondary);
    padding: 3px 8px;
    border-radius: var(--radius-full);
    font-weight: 600;
    margin-left: 4px;
}

.user-nav {
    display: flex;
    align-items: center;
    gap: 14px;
}

.user-badge {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--bg-surface);
    padding: 6px 14px 6px 6px;
    border-radius: var(--radius-full);
    border: 1px solid var(--border-subtle);
    box-shadow: var(--shadow-sm);
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-full);
    object-fit: cover;
    background: var(--bg-canvas-subtle);
    border: 1px solid var(--border-subtle);
}

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

.user-name {
    font-size: 0.85rem;
    font-weight: 700;
    line-height: 1.1;
}

.user-role {
    font-size: 0.72rem;
    color: var(--text-secondary);
    text-transform: capitalize;
}

/* Navegación por Pestañas (Pill Navigation SIN barra de scroll visible) */
.nav-pills-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 24px;
}

.nav-pills {
    display: flex;
    align-items: center;
    background: var(--bg-canvas-subtle);
    padding: 5px;
    border-radius: var(--radius-full);
    gap: 4px;
    overflow-x: auto;
    max-width: 100%;
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE y Edge */
}

/* Ocultar barra de desplazamiento en Chrome, Safari y Opera */
.nav-pills::-webkit-scrollbar {
    display: none !important;
    width: 0 !important;
    height: 0 !important;
}

.nav-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 9px 18px;
    border-radius: var(--radius-full);
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}

.nav-btn:hover {
    color: var(--text-primary);
}

.nav-btn.active {
    background: var(--bg-surface);
    color: var(--text-primary);
    box-shadow: var(--shadow-sm);
}

.btn-primary {
    background: var(--bg-dark);
    color: var(--text-white);
    border: none;
    padding: 10px 22px;
    border-radius: var(--radius-full);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
    background: var(--bg-dark-hover);
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--bg-surface);
    color: var(--text-primary);
    border: 1px solid var(--border-subtle);
    padding: 9px 18px;
    border-radius: var(--radius-full);
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn-secondary:hover {
    background: var(--bg-surface-hover);
    border-color: var(--border-medium);
}

.btn-icon {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
}

.btn-icon:hover {
    color: var(--text-primary);
    background: var(--bg-surface-hover);
}

/* Tarjetas y Contenedores */
.card {
    background: var(--bg-surface);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-subtle);
    padding: 24px;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}

.card-hover:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--border-medium);
}

/* Sección de Métricas / KPI Cards */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.kpi-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    box-shadow: var(--shadow-sm);
}

.kpi-title {
    font-size: 0.82rem;
    color: var(--text-secondary);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.kpi-value {
    font-size: 2rem;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: -1px;
}

.kpi-footer {
    font-size: 0.78rem;
    color: var(--text-muted);
}

/* Barra Avanzada de Filtros y Búsqueda */
.filter-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 20px;
    background: var(--bg-surface);
    padding: 14px 18px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-subtle);
    box-shadow: var(--shadow-sm);
}

.search-box {
    display: flex;
    align-items: center;
    background: var(--bg-canvas);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-full);
    padding: 8px 16px;
    gap: 10px;
    flex: 1;
    min-width: 280px;
    max-width: 480px;
}

.search-box input {
    border: none;
    background: transparent;
    font-size: 0.88rem;
    outline: none;
    width: 100%;
    color: var(--text-primary);
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.filter-select {
    background: var(--bg-canvas);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-full);
    padding: 8px 14px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    outline: none;
    cursor: pointer;
    transition: var(--transition);
}

.filter-select:focus {
    border-color: var(--border-dark);
}

/* Badges de Turnos, Estados y Orígenes DNI */
.status-pill {
    font-size: 0.72rem;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: var(--radius-full);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.status-pendiente { background: var(--status-pendiente-bg); color: var(--status-pendiente-text); }
.status-en-curso { background: var(--status-en-curso-bg); color: var(--status-en-curso-text); }
.status-resuelto { background: var(--status-resuelto-bg); color: var(--status-resuelto-text); }
.status-desestimado { background: var(--status-desestimado-bg); color: var(--status-desestimado-text); }
.status-cancelado { background: var(--status-cancelado-bg); color: var(--status-cancelado-text); }
.status-activo { background: var(--status-resuelto-bg); color: var(--status-resuelto-text); }
.status-mantenimiento { background: var(--status-pendiente-bg); color: var(--status-pendiente-text); }
.status-fuera_servicio { background: var(--status-cancelado-bg); color: var(--status-cancelado-text); }

.badge-dni-origen {
    font-size: 0.72rem;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: var(--radius-full);
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.dni-intendencia { background: var(--badge-intendencia-bg); color: var(--badge-intendencia-text); }
.dni-atencion { background: var(--badge-atencion-bg); color: var(--badge-atencion-text); }
.dni-defensoria { background: var(--badge-defensoria-bg); color: var(--badge-defensoria-text); }
.dni-civil { background: var(--bg-canvas-subtle); color: var(--text-primary); border: 1px solid var(--border-subtle); }

.badge-turno {
    font-size: 0.72rem;
    font-weight: 700;
    padding: 3px 9px;
    border-radius: var(--radius-full);
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.turno-mañana { background: var(--turno-manana-bg); color: var(--turno-manana-text); }
.turno-mediodia { background: var(--turno-mediodia-bg); color: var(--turno-mediodia-text); }
.turno-tarde { background: var(--turno-tarde-bg); color: var(--turno-tarde-text); }
.turno-noche { background: var(--turno-noche-bg); color: var(--turno-noche-text); }
.turno-rotativo { background: #F3E8FF; color: #6B21A8; }

/* Badge de Móvil Asignado al Reclamo */
.badge-movil-card {
    font-size: 0.7rem;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: var(--radius-full);
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: #EFF6FF;
    color: #1D4ED8;
    border: 1px solid #BFDBFE;
    white-space: nowrap;
    text-transform: none;
    letter-spacing: normal;
    transition: var(--transition);
}

.badge-movil-card.sin-asignar {
    background: #F1F5F9;
    color: #64748B;
    border: 1px solid #CBD5E1;
}

/* Badge y Widget de Radiofrecuencia de Emergencia (Radioaficionados VHF) */
.radio-qap-pill {
    background: #0F172A;
    color: #38BDF8;
    font-size: 0.72rem;
    font-weight: 800;
    padding: 4px 10px;
    border-radius: var(--radius-full);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: 1px solid #334155;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
}

.radio-qap-pill:hover {
    background: #1E293B;
    border-color: #38BDF8;
    box-shadow: 0 0 10px rgba(56, 189, 248, 0.25);
}

.radio-qap-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #22C55E;
    box-shadow: 0 0 6px #22C55E;
    display: inline-block;
    animation: radioPulse 2s infinite ease-in-out;
}

@keyframes radioPulse {
    0%, 100% { transform: scale(1); opacity: 1; box-shadow: 0 0 6px #22C55E; }
    50% { transform: scale(1.3); opacity: 0.85; box-shadow: 0 0 12px #22C55E; }
}

/* Banners del Sistema para Modo Tormenta y Lockdown */
.system-alert-banner {
    padding: 12px 18px;
    border-radius: var(--radius-lg);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    font-size: 0.86rem;
    font-weight: 600;
    box-shadow: var(--shadow-sm);
    animation: fadeIn 0.3s ease;
}

.system-alert-lockdown {
    background: #FEF2F2;
    border: 1.5px solid #F87171;
    color: #991B1B;
}

.system-alert-tormenta {
    background: #EFF6FF;
    border: 1.5px solid #60A5FA;
    color: #1E40AF;
}

.system-alert-blackout {
    background: #FFFBEB;
    border: 1.5px solid #FCD34D;
    color: #92400E;
}

.system-alert-congelar {
    background: #FAF5FF;
    border: 1.5px solid #C084FC;
    color: #6B21A8;
}

/* Grid de Reclamos */
.pedidos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 18px;
}

.pedido-card {
    background: var(--bg-surface);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-subtle);
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    cursor: pointer;
}

.pedido-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--border-medium);
}

.pedido-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 10px;
}

.pedido-id-tag {
    font-size: 0.78rem;
    font-weight: 800;
    color: var(--text-muted);
    letter-spacing: 0.5px;
}

.pedido-type {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
}

.pedido-submotivo {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 2px;
}

.pedido-address {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.88rem;
    color: var(--text-secondary);
}

.pedido-desc {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.pedido-photos {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 4px;
}

.pedido-thumb {
    width: 60px;
    height: 60px;
    border-radius: var(--radius-sm);
    object-fit: cover;
    border: 1px solid var(--border-subtle);
    background: var(--bg-canvas-subtle);
}

.pedido-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid var(--border-subtle);
    padding-top: 12px;
    margin-top: auto;
    font-size: 0.78rem;
    color: var(--text-muted);
}

/* Shortcuts para DNI en modal */
.dni-shortcuts {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-top: 6px;
}

.dni-shortcut-btn {
    background: var(--bg-canvas);
    border: 1px solid var(--border-subtle);
    padding: 4px 10px;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
}

.dni-shortcut-btn:hover {
    background: var(--bg-surface);
    border-color: var(--border-dark);
}

/* Grid de Ciudadanos (Civiles) */
.civiles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 18px;
}

.civil-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-xl);
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    cursor: pointer;
}

.civil-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--border-medium);
}

.civil-avatar-big {
    width: 56px;
    height: 56px;
    border-radius: var(--radius-full);
    object-fit: cover;
    border: 2px solid var(--border-subtle);
    background: var(--bg-canvas-subtle);
}

.civil-stat-pill {
    background: var(--bg-canvas);
    padding: 4px 10px;
    border-radius: var(--radius-full);
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--text-primary);
    border: 1px solid var(--border-subtle);
}

/* Ficha Detallada del Civil */
.civil-profile-header {
    display: flex;
    align-items: center;
    gap: 18px;
    background: var(--bg-canvas);
    padding: 18px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-subtle);
}

.civil-profile-avatar {
    width: 72px;
    height: 72px;
    border-radius: var(--radius-full);
    object-fit: cover;
    border: 2px solid var(--border-dark);
    background: var(--bg-surface);
}

.civil-kpis {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin-top: 6px;
}

.civil-kpi-box {
    background: var(--bg-canvas);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 10px 12px;
    text-align: center;
}

.civil-kpi-num {
    font-size: 1.3rem;
    font-weight: 800;
}

.civil-kpi-label {
    font-size: 0.72rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    font-weight: 600;
}

/* Flota & Vehículos Cards */
.fleet-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
    gap: 20px;
}

.vehicle-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-xl);
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    box-shadow: var(--shadow-sm);
    position: relative;
}

.vehicle-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
}

.vehicle-title {
    font-size: 1.25rem;
    font-weight: 800;
}

.vehicle-meta-tags {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 4px;
}

.vehicle-meta-pill {
    background: var(--bg-canvas);
    border: 1px solid var(--border-subtle);
    padding: 3px 8px;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-weight: 600;
}

.vehicle-alert-box {
    background: #FEF2F2;
    border: 1px solid #FECACA;
    border-radius: var(--radius-md);
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.vehicle-alert-title {
    font-size: 0.82rem;
    font-weight: 700;
    color: #991B1B;
    display: flex;
    align-items: center;
    gap: 6px;
}

.vehicle-alert-desc {
    font-size: 0.8rem;
    color: #7F1D1D;
    line-height: 1.3;
}

.vehicle-staff-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.staff-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-canvas);
    padding: 10px 14px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-subtle);
}

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

.staff-avatar {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-full);
    object-fit: cover;
    border: 1px solid var(--border-subtle);
}

.staff-name {
    font-size: 0.88rem;
    font-weight: 700;
}

.vehicle-actions-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    border-top: 1px solid var(--border-subtle);
    padding-top: 14px;
    margin-top: auto;
    flex-wrap: wrap;
}

/* Control de Turnos Layout (4 Columnas) */
.turnos-layout {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(290px, 1fr));
    gap: 18px;
}

.turno-col {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-xl);
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    box-shadow: var(--shadow-sm);
}

.turno-col-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-subtle);
}

.turno-col-title {
    font-size: 1.1rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    gap: 8px;
}

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

.turno-section-title {
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-secondary);
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}

.turno-item {
    background: var(--bg-canvas);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 10px 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
}

/* Timeline / Bitácora de Eventos */
.timeline-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.timeline-item {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 18px 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    box-shadow: var(--shadow-sm);
}

.timeline-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.timeline-motivo {
    font-size: 1.05rem;
    font-weight: 800;
}

.timeline-explicacion {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.5;
    background: var(--bg-canvas);
    padding: 12px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-subtle);
}

/* Modales & Drawers */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(24, 24, 27, 0.45);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    padding: 16px;
}

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

.modal {
    background: var(--bg-surface);
    width: 100%;
    max-width: 620px;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-modal);
    border: 1px solid var(--border-subtle);
    display: flex;
    flex-direction: column;
    max-height: 92vh;
    transform: scale(0.95) translateY(10px);
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    overflow: hidden;
}

.modal-backdrop.active .modal {
    transform: scale(1) translateY(0);
}

.modal > form {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

.modal-header {
    padding: 18px 24px;
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
    background: var(--bg-surface);
}

.modal-title {
    font-size: 1.2rem;
    font-weight: 800;
}

.modal-body {
    padding: 20px 24px;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 14px;
    scroll-behavior: smooth;
}

.modal-footer {
    padding: 14px 24px;
    border-top: 1px solid var(--border-subtle);
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 10px;
    background: var(--bg-canvas);
    flex-shrink: 0;
}

/* Formularios */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-label {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--text-primary);
}

.form-control {
    background: var(--bg-canvas);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 10px 14px;
    font-size: 0.9rem;
    color: var(--text-primary);
    outline: none;
    transition: var(--transition);
}

.form-control:focus {
    border-color: var(--border-dark);
    background: var(--bg-surface);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.photo-uploader {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.photo-slot {
    height: 90px;
    border: 2px dashed var(--border-medium);
    border-radius: var(--radius-md);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
    background: var(--bg-canvas);
}

.photo-slot:hover {
    border-color: var(--border-dark);
    background: var(--bg-surface);
}

.photo-slot img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    position: absolute;
    top: 0;
    left: 0;
}

/* Toasts */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 2000;
}

.toast {
    background: var(--bg-dark);
    color: var(--text-white);
    padding: 12px 20px;
    border-radius: var(--radius-full);
    font-size: 0.88rem;
    font-weight: 600;
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 10px;
    animation: toastIn 0.3s ease forwards;
}

@keyframes toastIn {
    from { opacity: 0; transform: translateY(10px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

/* ESTILOS DE TABLA INTERACTIVA PARA ASIGNACIÓN DE CUADRILLA */
.crew-table-container {
    max-height: 400px;
    overflow-y: auto;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    background: var(--bg-surface);
}

.crew-modal-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 0.85rem;
}

.crew-modal-table thead {
    position: sticky;
    top: 0;
    background: var(--bg-canvas);
    z-index: 10;
    border-bottom: 2px solid var(--border-subtle);
}

.crew-modal-table th {
    padding: 10px 14px;
    font-size: 0.76rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.crew-modal-table td {
    padding: 10px 14px;
    border-bottom: 1px solid var(--border-subtle);
    vertical-align: middle;
}

.crew-row {
    transition: background 0.15s ease;
    cursor: pointer;
}

.crew-row:hover {
    background: var(--bg-canvas);
}

.crew-row.row-selected {
    background: #EFF6FF !important;
}

.crew-avatar-mini {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-full);
    object-fit: cover;
    border: 1px solid var(--border-subtle);
}

.crew-role-select {
    width: 100%;
    padding: 5px 8px;
    font-size: 0.8rem;
    font-weight: 600;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    background: var(--bg-surface);
    color: var(--text-primary);
    cursor: pointer;
}

.crew-filter-btn {
    padding: 4px 10px;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 700;
    background: var(--bg-canvas);
    border: 1px solid var(--border-subtle);
    cursor: pointer;
    transition: var(--transition);
}

.crew-filter-btn.active, .crew-filter-btn:hover {
    background: var(--bg-dark);
    color: #fff;
    border-color: var(--bg-dark);
}

/* ESTILOS DE LÍNEA DE TIEMPO DE 24 HORAS */
.timeline-24h-wrapper {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-xl);
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    box-shadow: var(--shadow-sm);
    margin-bottom: 20px;
}

.timeline-24h-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    border-bottom: 1px solid var(--border-subtle);
    padding-bottom: 14px;
}

.timeline-vehicle-card {
    background: var(--bg-canvas);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

.timeline-zoom-wrapper {
    width: 100%;
    overflow-x: auto;
    padding-bottom: 8px;
}

.timeline-track-inner {
    min-width: 100%;
    transition: width 0.2s ease, min-width 0.2s ease;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.timeline-track-inner.zoom-1x {
    min-width: 100%;
}

.timeline-track-inner.zoom-2x {
    min-width: 1600px;
}

.timeline-track-inner.zoom-4x {
    min-width: 3200px;
}

.timeline-axis-24h {
    display: flex;
    justify-content: space-between;
    font-size: 0.72rem;
    color: #64748B;
    font-weight: 700;
    padding: 0 4px;
    user-select: none;
}

.timeline-bar-24h {
    height: 42px;
    width: 100%;
    background: #E2E8F0;
    border-radius: 8px;
    border: 1.5px solid #CBD5E1;
    position: relative;
    overflow: hidden;
    display: flex;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.05);
}

/* MARCADOR DE INICIO DE RUTA */
.timeline-marker-start {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 4px;
    background: #16A34A;
    z-index: 5;
    cursor: pointer;
}
.timeline-marker-start::after {
    content: '🚀';
    position: absolute;
    top: -18px;
    left: -8px;
    font-size: 0.85rem;
}

/* MARCADOR DE CIERRE DE RUTA */
.timeline-marker-end {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 4px;
    background: #DC2626;
    z-index: 5;
    cursor: pointer;
}
.timeline-marker-end::after {
    content: '🏁';
    position: absolute;
    top: -18px;
    left: -8px;
    font-size: 0.85rem;
}

/* SEGMENTOS DE TRABAJO / PEDIDOS EN LÍNEA DE TIEMPO */
.timeline-segment-active {
    height: 34px;
    top: 4px;
    background: linear-gradient(135deg, #16A34A, #15803D);
    position: absolute;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 0.7rem;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(22, 163, 74, 0.35);
    border: 1px solid #14532D;
    transition: transform 0.15s ease, filter 0.15s ease;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    padding: 0 6px;
    z-index: 3;
}
.timeline-segment-active:hover {
    transform: scaleY(1.08);
    filter: brightness(1.1);
    z-index: 10;
}

.timeline-segment-en-curso {
    height: 34px;
    top: 4px;
    background: linear-gradient(135deg, #0284C7, #0369A1);
    position: absolute;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 0.7rem;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(2, 132, 199, 0.35);
    border: 1px solid #075985;
    animation: pulseGlow 2s infinite;
    z-index: 4;
    overflow: hidden;
    white-space: nowrap;
    padding: 0 6px;
}

.timeline-segment-no-realizado {
    height: 34px;
    top: 4px;
    background: repeating-linear-gradient(45deg, #FECACA, #FECACA 8px, #DC2626 8px, #DC2626 16px);
    position: absolute;
    border-radius: 6px;
    cursor: pointer;
    border: 1px solid #991B1B;
    z-index: 3;
}

.timeline-kpis-summary {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    font-size: 0.82rem;
    color: var(--text-secondary);
}

.timeline-kpi-pill {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    padding: 5px 12px;
    border-radius: var(--radius-full);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-weight: 600;
    font-size: 0.8rem;
}

/* OPERATIVOS EXCEPCIONALES */
.operativo-card {
    background: var(--bg-surface);
    border: 1.5px solid var(--border-subtle);
    border-radius: var(--radius-xl);
    padding: 20px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 14px;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    position: relative;
}
.operativo-card:hover {
    border-color: #0284C7;
    box-shadow: var(--shadow-md);
}
.operativo-badge-estado {
    padding: 4px 10px;
    border-radius: var(--radius-full);
    font-size: 0.72rem;
    font-weight: 800;
    text-transform: uppercase;
}
.operativo-estado-programado { background: #FEF3C7; color: #92400E; border: 1px solid #FCD34D; }
.operativo-estado-en_curso { background: #E0F2FE; color: #0369A1; border: 1px solid #7DD3FC; }
.operativo-estado-listo_cuadrilla { background: #FDF4FF; color: #86198F; border: 1px solid #F0ABFC; }
.operativo-estado-aprobado { background: #DCFCE7; color: #166534; border: 1px solid #86EFAC; }
.operativo-estado-cancelado { background: #FEF2F2; color: #991B1B; border: 1px solid #FCA5A5; }

/* CHIPS MULTI-TAREA DE RESOLUCIÓN */
.task-chips-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: 280px;
    overflow-y: auto;
    padding: 10px;
    background: var(--bg-canvas);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
}

.task-chip-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.task-chip-group-title {
    font-size: 0.74rem;
    font-weight: 800;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.task-chips-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.task-chip {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-full);
    padding: 5px 12px;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-primary);
    cursor: pointer;
    transition: var(--transition);
    user-select: none;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.task-chip:hover {
    border-color: var(--border-dark);
    background: #F1F5F9;
}

.task-chip.active {
    background: #0284C7 !important;
    color: #fff !important;
    border-color: #0284C7 !important;
    box-shadow: 0 2px 4px rgba(2, 132, 199, 0.25);
}

/* UPLOADER DE 5 FOTOS */
.photo-uploader-5 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
    gap: 10px;
}

.photo-slot-5 {
    height: 80px;
    border: 2px dashed var(--border-medium);
    border-radius: var(--radius-md);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
    background: var(--bg-canvas);
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--text-muted);
}

.photo-slot-5:hover {
    border-color: var(--border-dark);
    background: var(--bg-surface);
}

.photo-slot-5 img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    position: absolute;
    top: 0;
    left: 0;
}

/* CAMPO DESHABILITADO EN GRIS (POSTE/COLUMNA) */
.input-disabled-gray {
    background: #F3F4F6 !important;
    border: 1px solid #E5E7EB !important;
    color: #9CA3AF !important;
    cursor: not-allowed !important;
    font-style: italic;
}

/* HOJA DE RUTA OPERATIVA (PANTALLA DE CUADRILLA) */
.focal-order-card {
    background: var(--bg-surface);
    border: 2px solid var(--border-subtle);
    border-radius: var(--radius-xl);
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    box-shadow: var(--shadow-md);
    position: relative;
}

.focal-order-card.order-en-curso {
    border-color: #0284C7;
    box-shadow: 0 4px 14px rgba(2, 132, 199, 0.15);
}

.focal-order-badge-banner {
    position: absolute;
    top: -12px;
    right: 24px;
    padding: 4px 12px;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ESTILOS DE IMPRESIÓN Y EXPORTACIÓN A PDF CON MARCA DE AGUA DEL AVE */
@media print {
    body {
        background: #fff !important;
        color: #000 !important;
    }
    body::before {
        opacity: 0.08 !important;
        width: 500px !important;
        height: 500px !important;
    }
    .topbar, .nav-pills-container, .filter-bar, .modal-footer, .btn-primary, .btn-secondary, .btn-icon, .toast-container {
        display: none !important;
    }
    .app-container {
        padding: 0 !important;
        max-width: 100% !important;
    }
    .card, .modal {
        box-shadow: none !important;
        border: 1px solid #ccc !important;
        page-break-inside: avoid;
    }
}

@media (max-width: 768px) {
    .app-container { padding: 0 12px 24px 12px; }
    .form-row { grid-template-columns: 1fr; }
    .nav-pills { width: 100%; }
    .pedidos-grid, .fleet-grid, .turnos-layout, .civiles-grid { grid-template-columns: 1fr; }
    .civil-kpis { grid-template-columns: repeat(2, 1fr); }
    .photo-uploader-5 { grid-template-columns: repeat(3, 1fr); }
}

/* COMUNICADOS Y AVISOS OFICIALES */
.comunicados-banner-wrapper {
    margin-bottom: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.comunicado-banner-item {
    padding: 12px 18px;
    border-radius: var(--radius-md);
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    box-shadow: var(--shadow-sm);
    animation: fadeIn 0.3s ease;
}
.comunicado-banner-item.tipo-urgente {
    background: #FEF2F2;
    border: 1px solid #F87171;
    color: #991B1B;
}
.comunicado-banner-item.tipo-aviso {
    background: #FFFBEB;
    border: 1px solid #FCD34D;
    color: #92400E;
}
.comunicado-banner-item.tipo-institucional {
    background: #FAF5FF;
    border: 1px solid #D8B4FE;
    color: #5B21B6;
}
.comunicado-banner-item.tipo-info {
    background: #EFF6FF;
    border: 1px solid #93C5FD;
    color: #1E40AF;
}

/* PIE DE PÁGINA OFICIAL & LEGAL ZNEVNAN */
.app-footer {
    margin-top: 40px;
    padding-top: 24px;
    padding-bottom: 24px;
    border-top: 1px solid var(--border-subtle);
    color: var(--text-secondary);
    font-size: 0.82rem;
}
.footer-content {
    display: flex;
    flex-direction: column;
    gap: 14px;
}
.footer-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 14px;
}
.footer-brand {
    display: flex;
    align-items: center;
    gap: 10px;
}
.footer-logo {
    width: 32px;
    height: 32px;
    object-fit: contain;
}
.footer-title {
    font-weight: 800;
    font-size: 0.86rem;
    color: var(--text-primary);
}
.footer-subtitle {
    font-size: 0.74rem;
    color: var(--text-muted);
}
.footer-links {
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
}
.footer-links a {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.78rem;
    font-weight: 600;
    transition: var(--transition);
}
.footer-links a:hover {
    color: #0284C7;
    text-decoration: underline;
}
.footer-divider {
    height: 1px;
    background: var(--border-subtle);
    width: 100%;
}
.footer-bottom {
    display: flex;
    flex-direction: column;
    gap: 4px;
    text-align: center;
}
.footer-legal {
    font-size: 0.78rem;
    color: var(--text-primary);
    margin: 0;
}
.footer-warning {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin: 0;
    line-height: 1.4;
}

/* =========================================================================
   12. ESTILOS PARA EL REGISTRO DE VERSIONES / CHANGELOG (EXCLUSIVO ZNEVNAN)
   ========================================================================= */
.changelog-timeline {
    display: flex;
    flex-direction: column;
    gap: 20px;
    position: relative;
    padding-left: 24px;
    margin-top: 16px;
}

.changelog-timeline::before {
    content: '';
    position: absolute;
    top: 8px;
    bottom: 8px;
    left: 7px;
    width: 2px;
    background: #CBD5E1;
}

.changelog-card {
    position: relative;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-xl);
    padding: 20px 24px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}

.changelog-card:hover {
    box-shadow: var(--shadow-md);
    border-color: #94A3B8;
}

.changelog-node-dot {
    position: absolute;
    left: -24px;
    top: 24px;
    transform: translate(-50%, 0);
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #0284C7;
    border: 3px solid #FFFFFF;
    box-shadow: 0 0 0 2px #0284C7;
}

.changelog-version-tag {
    font-family: monospace;
    font-size: 0.88rem;
    font-weight: 800;
    background: #0F172A;
    color: #38BDF8;
    padding: 3px 10px;
    border-radius: var(--radius-md);
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.changelog-type-pill {
    font-size: 0.68rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 2px 8px;
    border-radius: 9999px;
}

.release-major { background: #DC2626; color: #fff; }
.release-minor { background: #0284C7; color: #fff; }
.release-patch { background: #16A34A; color: #fff; }
.release-hotfix { background: #D97706; color: #fff; }
.release-security { background: #7C3AED; color: #fff; }

.changelog-changes-box {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 6px;
}

.changelog-category-title {
    font-size: 0.8rem;
    font-weight: 800;
    color: #334155;
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 2px;
}

.changelog-item-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.changelog-item-list li {
    font-size: 0.82rem;
    color: var(--text-secondary);
    line-height: 1.45;
    position: relative;
    padding-left: 16px;
}

.changelog-item-list li::before {
    content: '•';
    position: absolute;
    left: 4px;
    color: #0284C7;
    font-weight: 900;
}

/* =========================================================================
   13. SELECTOR DE NAVEGACIÓN CON DESPLAZAMIENTO ASISTIDO (◀ -)
   ========================================================================= */
.nav-pills-scroll-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
    gap: 6px;
    margin-bottom: 20px;
}

.nav-scroll-btn {
    width: 34px;
    height: 34px;
    min-width: 34px;
    border-radius: 50%;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    color: var(--text-primary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    font-weight: 800;
    cursor: pointer;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    z-index: 2;
}

.nav-scroll-btn:hover {
    background: #0284C7;
    color: #fff;
    border-color: #0284C7;
}

.nav-pills {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    scroll-behavior: smooth;
    padding: 4px 2px;
    flex: 1;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.nav-pills::-webkit-scrollbar {
    display: none;
}

/* =========================================================================
   14. PROTOCOLO DE ALERTA ROJA (CATÁSTROFE Y EMERGENCIA CRÍTICA)
   ========================================================================= */
.system-alert-alerta-roja {
    background: linear-gradient(135deg, #7F1D1D 0%, #991B1B 100%);
    border: 2px solid #EF4444;
    color: #FFFFFF;
    box-shadow: 0 4px 20px rgba(239, 68, 68, 0.45);
    animation: alertRedPulse 1.8s infinite alternate ease-in-out;
}

@keyframes alertRedPulse {
    0% { box-shadow: 0 0 10px rgba(239, 68, 68, 0.3); border-color: #DC2626; }
    100% { box-shadow: 0 0 25px rgba(239, 68, 68, 0.7); border-color: #F87171; }
}

/* =========================================================================
   15. SISTEMA DE TICKETS Y CHAT INTERNO ENTRE PERSONAL (STAFF)
   ========================================================================= */
.tickets-layout {
    display: grid;
    grid-template-columns: 360px 1fr;
    gap: 16px;
    height: calc(100vh - 210px);
    min-height: 600px;
}

.tickets-sidebar {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-xl);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.tickets-sidebar-header {
    padding: 16px;
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.tickets-list-scroll {
    overflow-y: auto;
    flex: 1;
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.ticket-item-card {
    background: var(--bg-canvas);
    border: 1.5px solid transparent;
    border-radius: var(--radius-lg);
    padding: 12px 14px;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.ticket-item-card:hover {
    background: var(--bg-surface);
    border-color: #CBD5E1;
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.ticket-item-card.active {
    background: #F0F9FF;
    border-color: #0284C7;
    box-shadow: 0 2px 8px rgba(2, 132, 199, 0.15);
}

.ticket-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.76rem;
}

.ticket-num-badge {
    font-family: monospace;
    font-weight: 800;
    color: #0284C7;
}

.ticket-chat-panel {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-xl);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.ticket-chat-header {
    padding: 14px 20px;
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    background: var(--bg-canvas);
}

.ticket-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.chat-bubble {
    max-width: 78%;
    padding: 10px 14px;
    border-radius: var(--radius-lg);
    font-size: 0.88rem;
    line-height: 1.4;
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.chat-bubble.mine {
    align-self: flex-end;
    background: #0284C7;
    color: #FFFFFF;
    border-bottom-right-radius: 2px;
}

.chat-bubble.theirs {
    align-self: flex-start;
    background: #F1F5F9;
    color: #1E293B;
    border-bottom-left-radius: 2px;
}

.chat-bubble.system {
    align-self: center;
    background: #FEF3C7;
    color: #92400E;
    font-size: 0.78rem;
    border-radius: 9999px;
    padding: 4px 14px;
    text-align: center;
    max-width: 90%;
}

.chat-sender-name {
    font-size: 0.74rem;
    font-weight: 800;
    color: #64748B;
    margin-bottom: 2px;
}

.chat-bubble.mine .chat-sender-name {
    color: #BAE6FD;
}

.chat-timestamp {
    font-size: 0.68rem;
    align-self: flex-end;
    opacity: 0.75;
}

.ticket-chat-input-bar {
    padding: 14px 18px;
    border-top: 1px solid var(--border-subtle);
    background: var(--bg-surface);
    display: flex;
    align-items: center;
    gap: 10px;
}

/* =========================================================================
   16. OPTIMIZACIÓN RESPONSIVE MÓVIL
   ========================================================================= */
@media (max-width: 768px) {
    .tickets-layout {
        grid-template-columns: 1fr;
        height: auto;
    }
    
    .tickets-sidebar {
        max-height: 380px;
    }

    .ticket-chat-panel {
        height: 520px;
    }

    .topbar {
        padding: 8px 12px;
    }

    .brand-name {
        font-size: 1.15rem;
    }

    .btn-primary, .btn-secondary {
        min-height: 40px;
    }

    .nav-btn {
        padding: 7px 12px;
        font-size: 0.8rem;
    }

    .pedido-card {
        padding: 14px;
    }
}

/* =========================================================================
   17. CAMPANITA DE NOTIFICACIONES EN HEADER
   ========================================================================= */
.header-notif-bell {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: #0F172A;
    border: 1.5px solid #334155;
    border-radius: 50%;
    color: #F8FAFC;
    font-size: 1.15rem;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    user-select: none;
}

.header-notif-bell:hover {
    border-color: #38BDF8;
    background: #1E293B;
    transform: scale(1.08);
}

.header-notif-bell .bell-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: #EF4444;
    color: #FFFFFF;
    font-size: 0.65rem;
    font-weight: 800;
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    border: 2px solid #0F172A;
    box-shadow: 0 2px 5px rgba(239, 68, 68, 0.5);
}

/* ANIMACIÓN DE DESTELLO Y VIBRACIÓN (RINGING) */
.header-notif-bell.bell-ringing {
    animation: bellRingPulse 1.8s infinite;
    border-color: #EF4444;
    background: #1E1B4B;
}

.header-notif-bell.bell-ringing .bell-icon {
    display: inline-block;
    animation: bellSwing 1.8s infinite ease-in-out;
}

@keyframes bellRingPulse {
    0% {
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7);
        border-color: #EF4444;
    }
    50% {
        box-shadow: 0 0 0 8px rgba(239, 68, 68, 0);
        border-color: #F87171;
    }
    100% {
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0);
        border-color: #EF4444;
    }
}

@keyframes bellSwing {
    0%, 100% { transform: rotate(0deg); }
    10%, 30% { transform: rotate(14deg); }
    20%, 40% { transform: rotate(-14deg); }
    50% { transform: rotate(8deg); }
    60% { transform: rotate(-8deg); }
    70% { transform: rotate(0deg); }
}






/* ESTILOS DE MENCIONES EN CHAT (@nombre) */
.chat-mention {
    display: inline-block;
    background: rgba(2, 132, 199, 0.18);
    color: #0284C7;
    font-weight: 800;
    padding: 1px 6px;
    border-radius: 6px;
    border: 1px solid rgba(2, 132, 199, 0.35);
    margin: 0 2px;
}

.chat-bubble.mine .chat-mention {
    background: rgba(255, 255, 255, 0.25);
    color: #FFFFFF;
    border-color: rgba(255, 255, 255, 0.5);
}

.chat-mention.chat-mention-me {
    background: #FEF3C7;
    color: #92400E;
    border: 1.5px solid #F59E0B;
    font-weight: 900;
    box-shadow: 0 0 6px rgba(245, 158, 11, 0.4);
    animation: pulseMention 2s infinite;
}

@keyframes pulseMention {
    0% { transform: scale(1); }
    50% { transform: scale(1.04); }
    100% { transform: scale(1); }
}
