
:root {
    --bg-body: #f8fafc;
    --bg-sidebar: #0f172a;
    --text-main: #334155;
    --cyan-genius: #00e5ff;
    --white: #ffffff;
    --border: #e2e8f0;
}

* { margin: 0; padding: 0; box-sizing: border-box; font-family: 'Plus Jakarta Sans', sans-serif; }
body { background-color: var(--bg-body); color: var(--text-main); display: flex; height: 100vh; overflow: hidden; }


.sidebar {
    background-color: var(--bg-sidebar); 
    width: 260px;
    display: flex;
    flex-direction: column;
    border-right: 1px solid rgba(255, 255, 255, 0.03); 
    z-index: 100;
    transition: all 0.3s ease;
}

.sidebar-brand {
    padding: 30px 20px 25px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.sidebar-nav { 
    padding: 20px 15px; 
    display: flex; 
    flex-direction: column; 
    gap: 4px; 
    flex: 1;
    overflow-y: auto;
}

.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: #334155; border-radius: 4px; }

.nav-section-title { 
    padding: 15px 12px 8px 12px; 
    font-size: 11px; 
    font-weight: 700; 
    color: #64748b; 
    text-transform: uppercase; 
    letter-spacing: 1.2px; 
    margin-top: 5px; 
}

.nav-link { 
    display: flex; 
    align-items: center; 
    padding: 12px 16px; 
    border-radius: 10px; 
    color: #94a3b8; 
    text-decoration: none; 
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1); 
    position: relative; 
    font-size: 14px;
    font-weight: 600;
}

.nav-icon { 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    margin-right: 12px; 
    transition: all 0.2s ease;
}

.nav-icon svg { 
    width: 18px; 
    height: 18px; 
    stroke-width: 2px; 
}

.nav-link:hover { 
    background-color: rgba(255, 255, 255, 0.04); 
    color: #f8fafc; 
}

.nav-link:hover .nav-icon {
    transform: scale(1.15);
    color: var(--cyan-genius);
}

.nav-link.active { 
    background: rgba(0, 229, 255, 0.1); 
    color: var(--cyan-genius); 
    font-weight: 700;
    box-shadow: inset 0 0 0 1px rgba(0, 229, 255, 0.15); 
}

.nav-link.active .nav-icon {
    color: var(--cyan-genius);
    filter: drop-shadow(0 0 8px rgba(0, 229, 255, 0.5));
}

.nav-link.active::after {
    content: '';
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 6px;
    height: 6px;
    background: var(--cyan-genius);
    border-radius: 50%;
    box-shadow: 0 0 8px var(--cyan-genius);
}

.main-content { flex: 1; display: flex; flex-direction: column; overflow-y: auto; position: relative; }
.header { background: var(--white); padding: 15px 30px; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--border); }
.header-left h2 { font-size: 18px; color: #0f172a; font-weight: 700; }
.header-right { display: flex; align-items: center; gap: 20px; }
.workspace-switcher { display: flex; align-items: center; gap: 10px; background: var(--bg-body); padding: 8px 15px; border-radius: 8px; border: 1px solid var(--border); }
.workspace-switcher select { background: transparent; border: none; font-weight: 700; color: #0f172a; outline: none; cursor: pointer; font-size: 14px;}
.profile { display: flex; align-items: center; gap: 10px; }
.profile-avatar { width: 40px; height: 40px; background: #0f172a; color: var(--cyan-genius); border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: bold; }
.profile-info h4 { font-size: 14px; margin-bottom: 2px; }
.profile-info span { font-size: 12px; color: #64748b; font-weight: 600; }

.page-content { display: none; padding: 30px; animation: fadeIn 0.3s ease-in-out; }
.page-content.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

.welcome-box { background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%); border-radius: 12px; padding: 25px; color: white; margin-bottom: 25px; display: flex; justify-content: space-between; align-items: center; box-shadow: 0 10px 25px rgba(15, 23, 42, 0.1); }
.welcome-box h1 { font-size: 24px; margin-bottom: 5px; }
.welcome-box p { color: #cbd5e1; font-size: 14px; }
.btn-cyan { background: var(--cyan-genius); color: #0f172a; padding: 10px 20px; border-radius: 8px; font-weight: 700; text-decoration: none; border: none; cursor: pointer; transition: 0.2s;}
.stats-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; margin-bottom: 30px; }
.stat-card { background: var(--white); padding: 20px; border-radius: 12px; border: 1px solid var(--border); display: flex; align-items: center; gap: 15px; }
.stat-icon { width: 50px; height: 50px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 24px; }
.bg-blue { background: #e0f2fe; color: #0284c7; } .bg-orange { background: #ffedd5; color: #ea580c; } .bg-green { background: #dcfce3; color: #16a34a; }

.table-container { background: var(--white); border-radius: 12px; border: 1px solid var(--border); padding: 20px; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; padding: 12px 15px; font-size: 12px; color: #64748b; text-transform: uppercase; border-bottom: 2px solid var(--border); }
td { padding: 15px; font-size: 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.status-badge { padding: 5px 10px; border-radius: 20px; font-size: 11px; font-weight: 700; }
.status-pending { background: #fef3c7; color: #d97706; } .status-approved { background: #dcfce3; color: #16a34a; }
.card { background: #ffffff; border-radius: 12px; padding: 25px; border: 1px solid var(--border); box-shadow: 0 4px 6px -1px rgba(0,0,0,0.05); margin-bottom: 25px; }

.toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 25px; gap: 15px; }
.search-bar { flex: 1; display: flex; align-items: center; background: white; border: 1px solid #e2e8f0; border-radius: 12px; padding: 0 15px; box-shadow: 0 2px 4px rgba(0,0,0,0.02); }
.search-bar input { border: none; outline: none; padding: 14px 10px; width: 100%; font-size: 14px; background: transparent; }
.item-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 20px; }
.item-card { 
    background: #ffffff; border-radius: 16px; padding: 24px; 
    border: 1px solid #e2e8f0; transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1); 
    display: flex; flex-direction: column; position: relative;
}
.item-card:hover { 
    border-color: #3b82f6; box-shadow: 0 15px 30px -10px rgba(59, 130, 246, 0.2); 
    transform: translateY(-8px);
}
.item-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 15px; }
.item-code { font-size: 11px; font-weight: 800; color: #64748b; font-family: monospace; } 
.item-divisi-badge {
    font-size: 10px; font-weight: 900; padding: 5px 12px; 
    border-radius: 20px; background: #eff6ff; color: #1d4ed8; text-transform: uppercase;
}
.item-name { font-size: 15px; font-weight: 800; color: #0f172a; margin-bottom: 15px; line-height: 1.4; min-height: 42px; }
.stock-num-modern { font-size: 32px; font-weight: 900; color: #0f172a; line-height: 1; }
.stock-unit { font-size: 14px; font-weight: 700; color: #64748b; margin-left: 5px; }
.item-actions { display: flex; gap: 8px; border-top: 1px solid #f1f5f9; padding-top: 20px; margin-top: auto;}
.btn-action-modern {
    flex: 1; padding: 10px; border: none; border-radius: 10px; 
    font-weight: 800; font-size: 12px; cursor: pointer; transition: 0.2s;
}
.btn-in { background: #dcfce7; color: #15803d; }
.btn-out { background: #fee2e2; color: #b91c1c; }
.btn-log { background: #f1f5f9; color: #475569; }
.btn-action-modern:hover { opacity: 0.8; }

.chat-panel { position: fixed; top: 0; right: -400px; width: 400px; height: 100vh; background: white; box-shadow: -5px 0 25px rgba(0,0,0,0.15); transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1); z-index: 50; display: flex; flex-direction: column; }
.chat-panel.open { right: 0; }
.chat-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(15, 23, 42, 0.5); z-index: 40; display: none; backdrop-filter: blur(2px);}
.chat-overlay.open { display: block; }
.chat-header { background: #0f172a; color: white; padding: 20px; display: flex; justify-content: space-between; align-items: center; }
.chat-body { flex: 1; padding: 20px; overflow-y: auto; background: #f8fafc; display: flex; flex-direction: column; gap: 15px; }
.chat-bubble { max-width: 85%; padding: 12px 16px; border-radius: 12px; font-size: 13px; line-height: 1.5; }
.chat-bubble.left { background: white; border: 1px solid #e2e8f0; align-self: flex-start; border-bottom-left-radius: 2px;}
.chat-bubble.right { background: #dbeafe; color: #1e3a8a; align-self: flex-end; border-bottom-right-radius: 2px; }
.chat-input { padding: 15px; background: white; border-top: 1px solid #e2e8f0; display: flex; gap: 10px; }
.chat-input input { flex: 1; padding: 10px 15px; border: 1px solid #cbd5e1; border-radius: 8px; outline: none; }
.chat-input button { background: var(--cyan-genius); color: #0f172a; border: none; padding: 0 15px; border-radius: 8px; font-weight: bold; cursor: pointer; }

.modal-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 99999; 
    display: none; 
    align-items: center;
    justify-content: center;
    background: rgba(15, 23, 42, 0.6);
}
.history-panel {
    position: fixed;
    top: 0;
    right: -500px; 
    width: 500px;
    height: 100vh;
    background: white;
    z-index: 99999;
    box-shadow: -5px 0 25px rgba(0,0,0,0.1);
    transition: right 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    flex-direction: column;
}
.history-panel.open { right: 0; } 
.history-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(15, 23, 42, 0.5); z-index: 99998; display: none; backdrop-filter: blur(2px);
}
.history-overlay.open { display: block; }

#mobile-menu-btn {
    display: none;
    background: transparent !important;
    border: none !important;
    color: #0f172a;
    cursor: pointer;
    margin-right: 15px;
    padding: 0;
    outline: none !important;
    box-shadow: none !important;
}

#mobile-menu-btn svg {
    width: 28px;
    height: 28px;
}

#mobile-menu-btn:focus {
    outline: none;
}

@media (max-width: 768px) {
    #mobile-menu-btn {
        display: block !important;
    }

    .sidebar {
        position: fixed !important;
        top: 0;
        left: -300px;
        width: 260px !important;
        height: 100vh !important;
        z-index: 9999 !important;
        transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
        box-shadow: 5px 0 25px rgba(0,0,0,0.2);
    }

    .sidebar.show {
        left: 0 !important;
    }

    .nav-menu {
        display: block !important;
    }
    .nav-item {
        margin-bottom: 5px !important;
    }

    .main-content {
        margin-left: 0 !important;
        width: 100% !important;
        padding: 15px !important;
    }

    .header {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 15px !important;
        padding: 10px 0 20px 0 !important;
    }

    .header-right {
        width: 100% !important;
        justify-content: space-between !important;
        gap: 10px !important;
    }

    .welcome-box {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 15px !important;
        text-align: center !important;
        padding: 20px !important;
    }
    
    .welcome-box button, .toolbar, .search-bar, #filterKategori {
        width: 100% !important;
    }

    .toolbar {
        flex-direction: column !important;
        gap: 12px !important;
    }

    #form-pengajuan div[style*="grid-template-columns"],
    .modal-container div[style*="grid-template-columns"],
    div[style*="grid-template-columns: 2fr 0.8fr 1fr 1.5fr 1.5fr auto"] {
        grid-template-columns: 1fr !important;
        gap: 12px !important;
    }
    
    div[style*="grid-template-columns: 2fr 0.8fr 1fr 1.5fr 1.5fr auto"] button {
        width: 100% !important;
        height: 45px !important;
        margin-top: 5px !important;
    }

    .card table, .page-content table, .modal-container table {
        display: block !important;
        width: 100% !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
        white-space: nowrap !important;
    }

    .modal-container .card {
        width: 95% !important;
        max-width: 100% !important;
        margin: 10px !important;
        padding: 20px !important;
    }
    
    .history-panel {
        width: 100% !important;
    }
    
    .item-grid {
        grid-template-columns: 1fr !important;
    }

    
    .sidebar {
        background-color: var(--bg-sidebar) !important;
        box-shadow: 10px 0 30px rgba(0, 0, 0, 0.6) !important;
        border-right: 1px solid rgba(255, 255, 255, 0.05);
    }

    .nav-link.active {
        background: rgba(0, 229, 255, 0.1) !important;
        box-shadow: inset 0 0 0 1px rgba(0, 229, 255, 0.15) !important;
    }

    .nav-section-title {
        color: #64748b !important;
    }

}


.tab-gudang-container {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding-bottom: 5px;
    scrollbar-width: thin; 
}

.tab-gudang-container::-webkit-scrollbar {
    height: 4px;
}
.tab-gudang-container::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 10px;
}

.tab-btn {
    padding: 10px 22px;
    border-radius: 30px; 
    font-weight: 700;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    white-space: nowrap;
    border: none;
    outline: none;
}

.tab-btn.inactive {
    background: #f1f5f9;
    color: #64748b;
}

.tab-btn.inactive:hover {
    background: #e2e8f0;
    color: #334155;
    transform: translateY(-2px);
}

.tab-btn.active {
    background: var(--bg-sidebar); 
    color: var(--cyan-genius);     
    box-shadow: 0 4px 10px rgba(15, 23, 42, 0.2);
}

#inv-history-panel {
    z-index: 100000;
}
#inv-history-overlay {
    z-index: 99999;
}

.modal-rekap-wrapper {
    background: #fff; width: 1200px; max-width: 95%; border-radius: 16px; 
    box-shadow: 0 25px 50px -12px rgba(0,0,0,0.3); transform: translateY(20px); 
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1); 
    overflow: hidden; display: flex; flex-direction: column; height: 88vh;
}
.modal-rekap-header {
    background: #ffffff; border-bottom: 1px solid #e2e8f0; padding: 18px 25px; 
    display: flex; justify-content: space-between; align-items: center; flex-shrink: 0;
}
.modal-rekap-body {
    display: flex; flex: 1; overflow: hidden; background:#f8fafc;
}
.modal-rekap-left {
    flex: 6; overflow-y: auto; padding: 25px 35px; border-right: 1px solid #e2e8f0; background: #ffffff;
}
.modal-rekap-right {
    flex: 4; display: flex; flex-direction: column; background: #f8fafc;
}
.rekap-info-grid {
    border: 1px solid #e2e8f0; border-radius: 12px; padding: 20px; 
    display: grid; grid-template-columns: 1fr 1fr; gap: 20px; background:#fafafa; flex: 1;
}
.rekap-target-box {
    width: 200px; border: 2px dashed #fca5a5; background: #fef2f2; 
    border-radius: 12px; display: flex; flex-direction: column; 
    justify-content: center; align-items: center; text-align: center; padding: 20px;
}
.rekap-total-box {
    border: 2px dashed #3b82f6; background: #eff6ff; padding: 18px 35px; 
    border-radius: 12px; text-align: center; min-width: 280px; 
    box-shadow: 0 4px 6px -1px rgba(59, 130, 246, 0.1); display: inline-block;
}
.chat-textarea-rekap {
    flex: 1; padding: 12px 15px; border: 1px solid #cbd5e1; border-radius: 10px; 
    outline: none; font-size: 13px; resize: none; background:#f1f5f9; color:#334155; transition:0.2s;
}
.chat-textarea-rekap:focus { background:#fff; border-color:#3b82f6; }

::-webkit-scrollbar {
    width: 6px; 
    height: 6px;
}
::-webkit-scrollbar-track {
    background: transparent; 
}
::-webkit-scrollbar-thumb {
    background: #cbd5e1; 
    border-radius: 10px; 
}
::-webkit-scrollbar-thumb:hover {
    background: #94a3b8; 
}

div[id^="area-chat-"]::-webkit-scrollbar {
    width: 4px;
}

.spinner {
    display: inline-block;
    animation: pulse-spin 1.5s infinite ease-in-out;
}

@keyframes pulse-spin {
    0% { transform: scale(1) rotate(0deg); opacity: 1; }
    50% { transform: scale(1.2) rotate(18deg); opacity: 0.7; }
    100% { transform: scale(1) rotate(0deg); opacity: 1; }
}

@media (min-width: 769px) {
    .sidebar {
        width: 85px; 
        transition: width 0.4s cubic-bezier(0.25, 1, 0.5, 1); 
        overflow-x: hidden;
        white-space: nowrap; 
    }

    .sidebar:hover {
        width: 260px;
    }

    .sidebar-brand {
        height: 90px;
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 0;
        position: relative;
        border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    }
    
    .logo-mini {
        width: 40px;
        position: absolute;
        transition: all 0.3s ease;
        opacity: 1;
        transform: scale(1);
    }
    
    .logo-full {
        width: 130px;
        position: absolute;
        transition: all 0.3s ease;
        opacity: 0; 
        transform: scale(0.8);
        pointer-events: none;
    }

    .sidebar:hover .logo-mini {
        opacity: 0;
        transform: scale(0.5);
    }
    
    .sidebar:hover .logo-full {
        opacity: 1;
        transform: scale(1);
    }

    .nav-link {
        padding: 12px 15px; 
    }

    .nav-icon {
        min-width: 24px; 
        margin-right: 18px; 
        display: flex;
        justify-content: center;
    }

    .nav-text, .nav-section-title {
        opacity: 0;
        transition: opacity 0.2s ease;
    }

    .sidebar:hover .nav-text, 
    .sidebar:hover .nav-section-title {
        opacity: 1;
        transition-delay: 0.15s; 
    }
    
    .nav-link.active::after {
        opacity: 0;
        transition: opacity 0.2s;
    }
    
    .sidebar:hover .nav-link.active::after {
        opacity: 1;
        transition-delay: 0.2s;
    }
}

@media (max-width: 768px) {
    .pr-tabel-wrap { overflow: visible !important; border: none !important; }
    .pr-tabel-hp { min-width: 0 !important; white-space: normal !important; display: block; }
    .pr-tabel-hp thead { display: none; }
    .pr-tabel-hp tbody { display: block; }
    .pr-tabel-hp tr {
        display: block;
        background: #fff;
        border: 1px solid #e2e8f0;
        border-radius: 12px;
        padding: 6px 14px;
        margin-bottom: 12px;
        box-shadow: 0 2px 6px rgba(15, 23, 42, 0.05);
    }
    .pr-tabel-hp td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        flex-wrap: wrap;
        gap: 4px 12px;
        padding: 8px 0 !important;
        text-align: right !important;
        border: none !important;
        border-bottom: 1px dashed #e2e8f0 !important;
        word-break: break-word;
    }
    .pr-tabel-hp td:last-child { border-bottom: none !important; justify-content: center; }
    .pr-tabel-hp td::before {
        content: attr(data-label);
        font-size: 10px;
        font-weight: 800;
        color: #64748b;
        text-transform: uppercase;
        text-align: left;
    }
    .pr-tabel-hp td:last-child::before { display: none; }
    .pr-tabel-hp td[colspan] { display: block; text-align: center !important; border-bottom: none !important; }
    .pr-tabel-hp td[colspan]::before { content: none; }
}

@media (max-width: 768px) {
    .sidebar-brand {
        position: relative !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        height: 80px !important;
        overflow: hidden !important; 
    }
    
    .logo-full {
        width: 140px !important; 
        max-width: 100% !important;
        height: auto !important;
        position: static !important; 
        opacity: 1 !important; 
        transform: none !important;
    }

    .logo-mini {
        display: none !important; 
    }
}
