/* ============================================
   LAYOUT PRINCIPAL - APP SHELL
   ============================================ */
.app-shell {
    display: flex;
    height: 100vh;
    width: 100vw;
    overflow: hidden;
    margin-left: 0;
}

/* ============================================
   SIDEBAR IZQUIERDO
   ============================================ */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 250px;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    padding: 20px 14px;
    gap: 8px;
    z-index: 300;
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.4,0,0.2,1);
    box-shadow: var(--shadow-lg);
}

.sidebar.visible {
    transform: translateX(0);
}

.sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    z-index: 250;
}

.sidebar-backdrop.visible {
    display: block;
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 8px 20px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 8px;
}

.sidebar-logo .logo-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent-orange);
    font-size: 28px;
    flex-shrink: 0;
}

.sidebar-logo .logo-text {
    font-size: 18px;
    font-weight: 900;
    letter-spacing: 2px;
    line-height: 1.1;
    color: var(--text-primary);
}
.sidebar-logo .logo-text span {
    display: block;
    color: var(--text-secondary);
    font-weight: 300;
    font-size: 9px;
    letter-spacing: 0.3px;
    line-height: 1.3;
    margin-top: 2px;
}

.nav-section-label {
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 2px;
    color: var(--text-secondary);
    text-transform: uppercase;
    padding: 8px 10px 4px;
    opacity: 0.6;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 12px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
    position: relative;
    border: 1px solid transparent;
}

.nav-item:hover {
    background: var(--bg-card);
    color: var(--text-primary);
}

.nav-item.active {
    background: var(--accent-orange-dim);
    color: var(--accent-orange);
    border-color: rgba(255,107,0,0.2);
    font-weight: 700;
}

.nav-item .nav-icon {
    width: 18px;
    text-align: center;
    font-size: 13px;
}

.nav-item .nav-badge {
    margin-left: auto;
    background: var(--accent-orange);
    color: #fff;
    font-size: 9px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 10px;
}

.sidebar-footer {
    margin-top: auto;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
}

.user-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
}

.user-card:hover { background: var(--bg-card); }

.user-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--accent-orange-dim);
    border: 1px solid var(--accent-orange);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    color: var(--accent-orange);
    flex-shrink: 0;
}

.user-info .user-name { font-size: 11px; font-weight: 700; line-height: 1.2; }
.user-info .user-cargo { font-size: 10px; font-weight: 800; color: var(--accent-orange); letter-spacing: 1px; text-transform: uppercase; margin-top: 2px; }
.user-info .user-rol-badge {
    display: inline-block;
    font-size: 8px;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: var(--accent-blue);
    background: var(--accent-blue-dim);
    padding: 1px 6px;
    border-radius: 3px;
    margin-top: 2px;
}

/* ============================================
   CONTENIDO CENTRAL
   ============================================ */
.main-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--bg-base);
}

.topbar {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 0 28px;
    height: 58px;
    background: var(--bg-sidebar);
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
    z-index: 10;
}

.topbar-title {
    font-size: 17px;
    font-weight: 800;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    flex: 1;
}

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

/* Indicador de sincronización */
.sync-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 10px;
    color: var(--text-secondary);
    padding: 6px 10px;
    border-radius: 20px;
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    transition: var(--transition);
}

.sync-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--text-secondary);
    transition: var(--transition);
    flex-shrink: 0;
}

.sync-indicator.syncing .sync-dot {
    background: var(--accent-orange);
    animation: pulse-dot 1s infinite;
}

.sync-indicator.synced .sync-dot {
    background: var(--accent-green);
    box-shadow: 0 0 6px var(--accent-green);
}

.sync-indicator.synced { color: var(--accent-green); border-color: rgba(16,185,129,0.3); }

@keyframes pulse-dot {
    0%, 100% { opacity: 1; transform: scale(1); }
    50%       { opacity: 0.4; transform: scale(0.8); }
}

.icon-btn {
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 14px;
    cursor: pointer;
    transition: var(--transition);
}

.icon-btn:hover {
    border-color: var(--accent-orange);
    color: var(--accent-orange);
}

.mobile-only { display: none; }

/* Vistas SPA */
.view-content {
    flex: 1;
    overflow: hidden;
    position: relative;
}

.view {
    position: absolute;
    inset: 0;
    overflow-y: auto;
    padding: 24px 28px;
    display: none;
    animation: fadeSlide 0.25s ease forwards;
}

.view.active { display: block; }

@keyframes fadeSlide {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ============================================
   PANEL OVERLAY
   ============================================ */
.panel-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 150;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.panel-overlay.visible { display: block; }
.panel-overlay.show { opacity: 1; }

/* ============================================
   PANEL LATERAL DERECHO (DETALLE) - OVERLAY
   ============================================ */
.detail-panel {
    position: fixed;
    top: 0;
    right: -440px;
    bottom: 0;
    width: 420px;
    background: var(--bg-sidebar);
    border-left: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    transition: right 0.3s cubic-bezier(0.4,0,0.2,1);
    z-index: 200;
    box-shadow: var(--shadow-lg);
}

.detail-panel.open {
    right: 0;
}

.detail-panel-inner {
    height: 100%;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.panel-topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}

.panel-close-btn {
    width: 28px;
    height: 28px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: none;
    color: var(--text-secondary);
    font-size: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.panel-close-btn:hover { color: var(--accent-orange); border-color: var(--accent-orange); }

/* ============================================
   COMPONENTES REUTILIZABLES
   ============================================ */
.glass-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
}

.section-title {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--accent-orange);
    display: flex;
    align-items: center;
    gap: 8px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 16px;
}

.btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    background: var(--accent-orange);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    font-family: var(--font-mono);
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
}

.btn-primary:hover { filter: brightness(1.1); transform: translateY(-1px); }
.btn-primary:active { transform: translateY(0); }

.btn-secondary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-family: var(--font-mono);
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
}

.btn-secondary:hover { border-color: var(--accent-orange); color: var(--accent-orange); }

.search-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 0 14px;
    flex: 1;
    transition: var(--transition);
}

.search-bar:focus-within {
    border-color: var(--accent-orange);
}

.search-bar i { color: var(--text-secondary); font-size: 13px; }

.search-bar input {
    flex: 1;
    background: none;
    border: none;
    outline: none;
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--text-primary);
    padding: 11px 0;
}

.search-bar input::placeholder { color: var(--text-secondary); }

/* Status Pills */
.pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    white-space: nowrap;
}

.pill-ok      { background: var(--accent-green-dim); color: var(--accent-green); border: 1px solid rgba(16,185,129,0.3); }
.pill-obs     { background: var(--accent-red-dim);   color: var(--accent-red);   border: 1px solid rgba(239,68,68,0.3); }
.pill-pend    { background: var(--accent-gray-dim);  color: var(--text-secondary); border: 1px solid rgba(100,116,139,0.2); }

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 1280px) {
    .detail-panel { width: 380px; right: -400px; }
}

@media (max-width: 1024px) {
    .detail-panel { width: 400px; right: -420px; }
}

@media (max-width: 768px) {
    .detail-panel { width: 100% !important; right: -104%; }
    .sidebar { width: 260px; }
    .view { padding: 16px; }
    .topbar { padding: 0 16px; }
}