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

/* CSS Variables for Light / Dark Themes */
:root {
    --font-primary: 'Inter', sans-serif;
    --font-header: 'Outfit', sans-serif;
    
    /* Light Theme Variables */
    --bg-primary: #f4f6f9;
    --bg-secondary: #ffffff;
    --bg-sidebar: #1e293b;
    --bg-sidebar-hover: rgba(255, 255, 255, 0.08);
    --bg-sidebar-active: #1f3894;
    --sidebar-text: #f1f5f9;
    --sidebar-text-muted: #94a3b8;
    
    --text-main: #1e293b;
    --text-muted: #64748b;
    --text-light: #94a3b8;
    
    --border-color: #e2e8f0;
    --border-input: #cbd5e1;
    
    --accent-blue: #1f3894;
    --accent-blue-hover: #162a73;
    --accent-orange: #e67e22;
    --accent-orange-hover: #d35400;
    --accent-green: #10b981;
    --accent-yellow: #f59e0b;
    --accent-red: #ef4444;
    
    --card-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    --hover-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    
    --glass-bg: rgba(255, 255, 255, 0.85);
    --glass-border: rgba(255, 255, 255, 0.4);
    --backdrop-blur: blur(8px);
}

[data-theme="dark"] {
    /* Dark Theme Variables */
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-sidebar: #0f172a;
    --bg-sidebar-hover: rgba(255, 255, 255, 0.05);
    --bg-sidebar-active: #1f3894;
    --sidebar-text: #f8fafc;
    --sidebar-text-muted: #64748b;
    
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --text-light: #64748b;
    
    --border-color: #334155;
    --border-input: #475569;
    
    --card-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.2), 0 2px 4px -1px rgba(0, 0, 0, 0.1);
    --hover-shadow: 0 10px 20px -3px rgba(0, 0, 0, 0.3), 0 4px 12px -2px rgba(0, 0, 0, 0.2);
    
    --glass-bg: rgba(30, 41, 59, 0.8);
    --glass-border: rgba(255, 255, 255, 0.05);
}

/* Global Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    transition: background-color 0.3s, border-color 0.3s;
}

body {
    font-family: var(--font-primary);
    background-color: var(--bg-primary);
    color: var(--text-main);
    overflow-x: hidden;
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-header);
    font-weight: 600;
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: var(--bg-primary);
}
::-webkit-scrollbar-thumb {
    background: var(--border-input);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* Main Layout Structure */
.app-container {
    display: flex;
    min-height: 100vh;
    width: 100vw;
}

/* Sidebar Styling */
.sidebar {
    width: 260px;
    background-color: var(--bg-sidebar);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    transition: width 0.3s;
    z-index: 1000;
    box-shadow: 4px 0 10px rgba(0, 0, 0, 0.1);
}


.sidebar.collapsed {
    width: 70px;
}

.sidebar.collapsed .brand-text,
.sidebar.collapsed .user-info,
.sidebar.collapsed .menu-item span,
.sidebar.collapsed .menu-item-group-header span,
.sidebar.collapsed .caret-icon,
.sidebar.collapsed .submenu-list,
.sidebar.collapsed .logout-btn span {
    display: none !important;
}

.sidebar.collapsed .sidebar-header {
    justify-content: center !important;
    padding: 15px 5px !important;
}

.sidebar.collapsed .sidebar-header img {
    max-width: 38px !important;
}

.sidebar.collapsed .sidebar-user {
    justify-content: center;
    padding: 12px 5px;
}

.sidebar.collapsed .menu-item,
.sidebar.collapsed .menu-item-group-header {
    justify-content: center;
    padding: 12px 0;
    gap: 0;
}

.sidebar.collapsed .menu-item i,
.sidebar.collapsed .menu-item-group-header i {
    margin: 0;
    font-size: 1.25rem;
}

.sidebar.collapsed .logout-btn {
    padding: 10px 0;
    justify-content: center;
}


.sidebar-header {
    padding: 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    overflow: hidden;
    position: relative;
}

.sidebar-header-logo {
    max-width: 90%;
    max-height: 40px;
    object-fit: contain;
    transition: all 0.2s;
}

.sidebar-close-btn {
    display: none;
}

.sidebar-logo {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
}

.brand-text {
    font-family: var(--font-header);
    font-size: 1.15rem;
    font-weight: 700;
    white-space: nowrap;
    color: #ffffff;
    letter-spacing: 0.5px;
}

.sidebar-user {
    padding: 15px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    overflow: hidden;
}

.user-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-blue), var(--accent-orange));
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.1rem;
    flex-shrink: 0;
}

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

.user-name {
    font-weight: 600;
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-role {
    font-size: 0.75rem;
    color: var(--sidebar-text-muted);
    font-weight: 500;
}

.sidebar-menu {
    list-style: none;
    padding: 15px 10px;
    display: flex;
    flex-direction: column;
    gap: 5px;
    flex-grow: 1;
    overflow-y: auto;
}

.menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 15px;
    color: var(--sidebar-text);
    text-decoration: none;
    border-radius: 8px;
    font-size: 0.92rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.menu-item:hover {
    background-color: var(--bg-sidebar-hover);
}

.menu-item.active {
    background-color: var(--bg-sidebar-active);
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(31, 56, 148, 0.4);
}

.menu-item i {
    width: 20px;
    text-align: center;
    font-size: 1.1rem;
}

.sidebar-footer {
    padding: 15px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.logout-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px;
    background-color: rgba(239, 68, 68, 0.1);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.2);
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
}

.logout-btn:hover {
    background-color: #ef4444;
    color: white;
}

/* Content Area Layout */
.main-content {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    min-width: 0;
}

/* Header Navbar */
.navbar {
    height: 70px;
    background-color: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    z-index: 99;
}

.nav-left {
    display: flex;
    align-items: center;
    gap: 15px;
}

.menu-toggle {
    background: none;
    border: none;
    font-size: 1.3rem;
    color: var(--text-main);
    cursor: pointer;
    padding: 5px;
    border-radius: 4px;
}

.menu-toggle:hover {
    background-color: var(--bg-primary);
}

.page-title {
    font-family: var(--font-header);
    font-size: 1.3rem;
    font-weight: 700;
}

.nav-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.theme-toggle, .notification-bell {
    background: none;
    border: none;
    font-size: 1.2rem;
    color: var(--text-main);
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.theme-toggle:hover, .notification-bell:hover {
    background-color: var(--bg-primary);
}

.badge-dot {
    position: absolute;
    top: 5px;
    right: 5px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--accent-red);
}

.role-badge-nav {
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.role-superadmin { background-color: rgba(31, 56, 148, 0.12); color: var(--accent-blue); }
.role-admin { background-color: rgba(16, 185, 129, 0.12); color: var(--accent-green); }
.role-operator { background-color: rgba(245, 158, 11, 0.12); color: var(--accent-yellow); }
.role-operatordp { background-color: rgba(139, 92, 246, 0.15); color: #8b5cf6; border: 1px solid rgba(139, 92, 246, 0.3); font-weight: bold; }
.role-setting { background-color: rgba(239, 68, 68, 0.12); color: var(--accent-red); }

/* Main Content Body */
.content-body {
    padding: 24px;
    flex-grow: 1;
    overflow-y: auto;
    background-color: var(--bg-primary);
}

/* Tab/Page Transitions */
.page-section {
    display: none;
    animation: fadeIn 0.4s ease-out forwards;
}

.page-section.active {
    display: block;
}

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

/* Dashboard Summary Cards */
.summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.stat-card {
    background-color: var(--bg-secondary);
    border-radius: 12px;
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: var(--card-shadow);
    position: relative;
    overflow: hidden;
}

.stat-card::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 4px;
}

.stat-card.blue::after { background-color: var(--accent-blue); }
.stat-card.green::after { background-color: var(--accent-green); }
.stat-card.orange::after { background-color: var(--accent-orange); }
.stat-card.red::after { background-color: var(--accent-red); }

.stat-info h3 {
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.stat-info p {
    font-family: var(--font-header);
    font-size: 1.6rem;
    font-weight: 700;
}

.stat-icon {
    font-size: 2.2rem;
    opacity: 0.25;
}

/* Dashboard Charts Grid */
.charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(450px, 1fr));
    gap: 24px;
    margin-bottom: 24px;
}

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

.chart-card {
    background-color: var(--bg-secondary);
    border-radius: 12px;
    padding: 20px;
    box-shadow: var(--card-shadow);
}

.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 10px;
}

.chart-title {
    font-size: 1.05rem;
    font-weight: 600;
}

.chart-container {
    position: relative;
    height: 280px;
    width: 100%;
}

/* Card Component Styles */
.card {
    background-color: var(--bg-secondary);
    border-radius: 12px;
    box-shadow: var(--card-shadow);
    border: 1px solid var(--glass-border);
    margin-bottom: 24px;
    overflow: hidden;
}

.card-header {
    padding: 16px 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

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

.card-body {
    padding: 24px;
}

/* Forms and Inputs */
.form-group {
    margin-bottom: 18px;
}

.form-row {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

.form-col {
    flex: 1;
    min-width: 200px;
}

.form-label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--text-main);
}

.form-control {
    width: 100%;
    padding: 10px 14px;
    font-size: 0.9rem;
    border-radius: 8px;
    border: 1px solid var(--border-input);
    background-color: var(--bg-secondary);
    color: var(--text-main);
    outline: none;
    font-family: var(--font-primary);
}

.form-control:focus {
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 3px rgba(31, 56, 148, 0.15);
}

.form-control[readonly] {
    background-color: var(--bg-primary);
    opacity: 0.8;
}

.input-group {
    display: flex;
}

.input-group .form-control {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
}

.input-group-btn {
    padding: 0 14px;
    border: 1px solid var(--border-input);
    border-left: none;
    background-color: var(--bg-primary);
    color: var(--text-main);
    border-top-right-radius: 8px;
    border-bottom-right-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.input-group-btn:hover {
    background-color: var(--border-color);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 16px;
    font-size: 0.88rem;
    font-weight: 600;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary {
    background-color: var(--accent-blue);
    color: #ffffff;
}

.btn-primary:hover {
    background-color: var(--accent-blue-hover);
    box-shadow: 0 4px 10px rgba(31, 56, 148, 0.3);
}

.btn-orange {
    background-color: var(--accent-orange);
    color: #ffffff;
}

.btn-orange:hover {
    background-color: var(--accent-orange-hover);
    box-shadow: 0 4px 10px rgba(230, 126, 34, 0.3);
}

.btn-success {
    background-color: var(--accent-green);
    color: #ffffff;
}

.btn-success:hover {
    box-shadow: 0 4px 10px rgba(16, 185, 129, 0.3);
}

.btn-danger {
    background-color: var(--accent-red);
    color: #ffffff;
}

.btn-danger:hover {
    box-shadow: 0 4px 10px rgba(239, 68, 68, 0.3);
}

.btn-secondary {
    background-color: var(--bg-primary);
    border: 1px solid var(--border-color);
    color: var(--text-main);
}

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

.btn-sm {
    padding: 6px 12px;
    font-size: 0.78rem;
    border-radius: 6px;
}

/* Tables */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    margin-bottom: 15px;
}

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

.table th {
    padding: 12px 16px;
    border-bottom: 2px solid var(--border-color);
    font-weight: 600;
    color: var(--text-muted);
}

.table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
}

.table tbody tr:hover {
    background-color: rgba(0, 0, 0, 0.02);
}

[data-theme="dark"] .table tbody tr:hover {
    background-color: rgba(255, 255, 255, 0.02);
}

/* Double Form Area Invoice */
.invoice-forms-wrapper {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.invoice-section-title {
    font-family: var(--font-header);
    font-size: 1.05rem;
    font-weight: 700;
    margin-bottom: 15px;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 8px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 8px;
}

.invoice-section-title.upper {
    color: var(--accent-blue);
    border-color: rgba(31, 56, 148, 0.15);
}

.invoice-section-title.lower {
    color: var(--accent-orange);
    border-color: rgba(230, 126, 34, 0.15);
}

.table-input {
    border: none;
    background: transparent;
    width: 100%;
    padding: 6px;
    font-size: 0.85rem;
    color: var(--text-main);
}

.table-input:focus {
    background-color: var(--bg-primary);
    border-radius: 4px;
    outline: none;
}

.table-action-btn {
    color: var(--accent-red);
    cursor: pointer;
    background: none;
    border: none;
    padding: 5px;
    border-radius: 4px;
}

.table-action-btn:hover {
    background-color: rgba(239, 68, 68, 0.1);
}

/* Image Attachment Zone */
.image-upload-container {
    display: flex;
    gap: 15px;
    margin-top: 15px;
    flex-wrap: wrap;
}

.image-dropzone {
    width: 120px;
    height: 120px;
    border: 2px dashed var(--border-input);
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-muted);
    font-size: 0.75rem;
    gap: 8px;
    transition: all 0.2s;
    background-color: var(--bg-primary);
}

.image-dropzone:hover {
    border-color: var(--accent-blue);
    color: var(--accent-blue);
    background-color: rgba(31, 56, 148, 0.05);
}

.image-dropzone i {
    font-size: 1.5rem;
}

.uploaded-img-wrapper {
    width: 120px;
    height: 120px;
    position: relative;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: var(--card-shadow);
    border: 1px solid var(--border-color);
}

.uploaded-img-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.uploaded-img-wrapper .remove-img-btn {
    position: absolute;
    top: 5px;
    right: 5px;
    background-color: rgba(239, 68, 68, 0.85);
    color: white;
    border: none;
    border-radius: 50%;
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 0.75rem;
}

.uploaded-img-wrapper .remove-img-btn:hover {
    background-color: #ef4444;
}

/* Stock Cards */
.stocks-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 20px;
}

.stock-card {
    border-radius: 12px;
    padding: 20px;
    color: white;
    box-shadow: var(--card-shadow);
    position: relative;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: transform 0.2s, box-shadow 0.2s;
}

.stock-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--hover-shadow);
}

/* Color states based on qty: <= 700 Red, 701-1500 Yellow, >1500 Green */
.stock-card.critical {
    background: linear-gradient(135deg, #ef4444, #b91c1c);
    box-shadow: 0 4px 15px rgba(239, 68, 68, 0.3);
}

.stock-card.warning {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: #1e293b;
    box-shadow: 0 4px 15px rgba(245, 158, 11, 0.3);
}

.stock-card.warning .stock-label, .stock-card.warning .stock-history-title {
    color: rgba(30, 41, 59, 0.75);
}

.stock-card.safe {
    background: linear-gradient(135deg, #10b981, #047857);
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
}

.stock-card-content {
    position: relative;
    z-index: 2;
}

.stock-name {
    font-family: var(--font-header);
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.stock-qty {
    font-size: 2.2rem;
    font-weight: 800;
    font-family: var(--font-header);
    line-height: 1;
}

.stock-label {
    font-size: 0.78rem;
    text-transform: uppercase;
    font-weight: 600;
    opacity: 0.8;
}

.stock-card-icon {
    position: absolute;
    right: -10px;
    bottom: -10px;
    font-size: 5rem;
    opacity: 0.15;
    z-index: 1;
}

/* Modals */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
    backdrop-filter: blur(4px);
}

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

.modal-content {
    background-color: var(--bg-secondary);
    border-radius: 12px;
    width: 100%;
    max-width: 500px;
    box-shadow: var(--hover-shadow);
    transform: translateY(-20px);
    transition: transform 0.3s;
    overflow: hidden;
}

.modal.active .modal-content {
    transform: translateY(0);
}

.modal-content.large {
    max-width: 800px;
}

.modal-content.xl {
    max-width: 1100px;
}

.modal-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-title {
    font-size: 1.1rem;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.2rem;
    color: var(--text-muted);
    cursor: pointer;
}

.modal-close:hover {
    color: var(--text-main);
}

.modal-body {
    padding: 20px;
    max-height: 80vh;
    overflow-y: auto;
}

.modal-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* Login Panel Layout */
.login-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: linear-gradient(135deg, #f1f5f9 0%, #cbd5e1 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    padding: 20px;
}

.login-card {
    background-color: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 16px;
    width: 100%;
    max-width: 420px;
    padding: 40px 30px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.08);
    display: flex;
    flex-direction: column;
    align-items: center;
    animation: loginSlide 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

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

.login-logo-container {
    width: 90px;
    height: 90px;
    margin-bottom: 20px;
}

.login-form {
    width: 100%;
}

.login-form .form-group {
    margin-bottom: 20px;
}

.login-form .form-label {
    color: #1e293b;
}

.login-form .form-control {
    background-color: #f8fafc;
    border-color: #cbd5e1;
    color: #0f172a;
}

.login-form .form-control:focus {
    border-color: var(--accent-orange);
    box-shadow: 0 0 0 3px rgba(230, 126, 34, 0.2);
}

.login-err {
    background-color: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #ef4444;
    padding: 10px;
    border-radius: 8px;
    font-size: 0.82rem;
    margin-bottom: 20px;
    width: 100%;
    display: none;
    text-align: center;
}

/* Badge Layouts */
.badge {
    display: inline-block;
    padding: 5px 10px;
    font-size: 0.74rem;
    font-weight: 700;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.2px;
}

.badge-success { background-color: rgba(16, 185, 129, 0.12); color: var(--accent-green); }
.badge-danger { background-color: rgba(239, 68, 68, 0.12); color: var(--accent-red); }
.badge-warning { background-color: rgba(245, 158, 11, 0.12); color: var(--accent-yellow); }

.badge-clickable {
    cursor: pointer;
    user-select: none;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.badge-clickable:hover {
    transform: scale(1.05);
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.15);
}

/* Quick Status Checkbox in Invoice list */
.checkbox-container {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    user-select: none;
}

.checkbox-container input {
    cursor: pointer;
}

/* Filter controls bar */
.filter-bar {
    background-color: var(--bg-secondary);
    border-radius: 12px;
    padding: 16px 20px;
    margin-bottom: 24px;
    box-shadow: var(--card-shadow);
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    align-items: flex-end;
}

.filter-group {
    flex: 1;
    min-width: 150px;
}

.filter-actions {
    display: flex;
    gap: 10px;
}

/* RENDER OFF-SCREEN FOR PDF CAPTURING (Fixes Blank PDF issue) */
#pdf-print-area {
    position: absolute;
    left: -9999px;
    top: -9999px;
    width: 800px;
    background: #ffffff;
    color: #000000;
    z-index: -100;
}

/* ===================================================
WINDOWS FILE EXPLORER STYLE MONITOR (ENLARGED)
=================================================== */
.explorer-grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
gap: 24px;
width: 100%;
}
.explorer-item {
background-color: var(--bg-secondary);
border: 1px solid var(--border-color);
border-radius: 6px;
padding: 15px;
cursor: pointer;
display: flex;
flex-direction: column;
align-items: center;
position: relative;
transition: all 0.2s;
text-align: center;
min-height: 315px;
box-shadow: var(--card-shadow);
user-select: none;
}
.explorer-item:hover {
background-color: rgba(0, 120, 215, 0.08) !important;
border-color: rgba(0, 120, 215, 0.4) !important;
transform: translateY(-2px);
box-shadow: 0 8px 20px rgba(0, 120, 215, 0.15);
}
.explorer-item.overdue {
border: 1px solid var(--accent-red) !important;
box-shadow: 0 0 10px rgba(239, 68, 68, 0.25);
animation: explorerUrgentPulse 2s infinite;
}
@keyframes explorerUrgentPulse {
0% {
box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4);
border-color: rgba(239, 68, 68, 0.8);
}
70% {
box-shadow: 0 0 0 8px rgba(239, 68, 68, 0);
border-color: rgba(239, 68, 68, 0.3);
}
100% {
box-shadow: 0 0 0 0 rgba(239, 68, 68, 0);
border-color: rgba(239, 68, 68, 0.8);
}
}
.explorer-thumbnail {
width: 100%;
height: 185px;
background-color: #ffffff;
border: 1px solid var(--border-color);
border-radius: 4px;
display: flex;
align-items: center;
justify-content: center;
overflow: hidden;
margin-bottom: 12px;
box-shadow: inset 0 0 5px rgba(0,0,0,0.05);
position: relative;
}
.explorer-thumbnail canvas {
max-width: 100%;
max-height: 100%;
object-fit: contain;
display: block;
}
.explorer-label {
font-size: 0.85rem;
font-weight: 700;
color: var(--text-main);
word-break: break-word;
margin-bottom: 5px;
width: 100%;
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
overflow: hidden;
line-height: 1.3;
}
.explorer-meta {
font-size: 0.75rem;
color: var(--text-muted);
margin-bottom: 6px;
width: 100%;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.explorer-meta.timer {
font-size: 0.75rem;
color: var(--text-muted);
font-weight: 500;
}
.explorer-meta.timer.warning {
color: var(--accent-red);
font-weight: 700;
}
.explorer-actions {
margin-top: auto;
width: 100%;
display: flex;
justify-content: center;
gap: 5px;
padding-top: 8px;
border-top: 1px dashed var(--border-color);
}
/* Channel management list style */
.channel-mgmt-item {
display: flex;
justify-content: space-between;
align-items: center;
padding: 8px 12px;
background-color: var(--bg-secondary);
border: 1px solid var(--border-color);
border-radius: 6px;
font-size: 0.85rem;
font-weight: 500;
margin-bottom: 8px;
}
.channel-mgmt-item span {
color: var(--text-main);
font-weight: 600;
}
.channel-mgmt-item button {
background: none;
border: none;
color: var(--accent-red);
cursor: pointer;
padding: 4px;
border-radius: 4px;
transition: all 0.2s;
}
.channel-mgmt-item button:hover {
background-color: rgba(239, 68, 68, 0.1);
}
/* ===================================================

[data-theme="dark"] .pdf-preview-paper-sheet {
background-color: #ffffff;
color: #000000;
}
[data-theme="dark"] .pdf-preview-paper-sheet * {
color: #000000 !important;
}
#pdf-preview-container {
width: 100%;
height: 100%;
}
/* Report 3-column financial summary cards in Rekap PDF */
.pdf-report-cards {
display: flex;
gap: 15px;
margin-bottom: 25px;
width: 100%;
}
.pdf-report-card {
flex: 1;
background: #f8fafc;
border: 1px solid #cbd5e1;
border-radius: 6px;
padding: 12px 15px;
font-family: Arial, sans-serif;
}
.pdf-report-card.blue { border-left: 4px solid #1f3894; }
.pdf-report-card.green { border-left: 4px solid #10b981; }
.pdf-report-card.red { border-left: 4px solid #ef4444; }
.pdf-report-card h4 {
margin: 0 0 5px 0;
font-size: 0.72rem;
text-transform: uppercase;
color: #475569;
letter-spacing: 0.2px;
}
.pdf-report-card p {
margin: 0;
font-size: 1.15rem;
font-weight: bold;
color: #0f172a;
}
/* Sidebar Submenus */
.menu-item-group {
    display: flex;
    flex-direction: column;
}
.menu-item-group-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 15px;
    color: var(--sidebar-text);
    text-decoration: none;
    border-radius: 8px;
    font-size: 0.92rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    user-select: none;
    white-space: nowrap;
}
.menu-item-group-header:hover {
    color: #ffffff;
    background-color: var(--bg-sidebar-hover);
}
.menu-item-group-header i:first-child {
    width: 20px;
    font-size: 1.1rem;
    text-align: center;
    flex-shrink: 0;
    color: inherit;
}
.menu-item-group-header span {
    flex-grow: 1;
    font-size: 0.92rem;
    color: inherit;
}
.caret-icon {
    font-size: 0.75rem;
    transition: transform 0.2s ease-in-out;
    color: var(--sidebar-text-muted);
    margin-left: auto;
}
.menu-item-group.active .caret-icon {
    transform: rotate(180deg);
}
.submenu-list {
    list-style: none;
    padding: 4px 0 4px 12px;
    margin: 2px 0 6px 18px;
    border-left: 2px solid rgba(255, 255, 255, 0.15);
    display: flex;
    flex-direction: column;
    gap: 3px;
}
.submenu-list li {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--sidebar-text);
    opacity: 0.88;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.2s;
    user-select: none;
    white-space: nowrap;
}
.submenu-list li:hover {
    color: #ffffff;
    opacity: 1;
    background-color: var(--bg-sidebar-hover);
}
.submenu-list li.active {
    color: #ffffff;
    opacity: 1;
    font-weight: 600;
    background-color: var(--bg-sidebar-active);
    box-shadow: 0 2px 8px rgba(31, 56, 148, 0.4);
}
.submenu-list li i {
    width: 16px;
    font-size: 0.88rem;
    text-align: center;
    flex-shrink: 0;
}
/* Digital Printing Counter Report Style */
#dp-counter-report-area {
    width: 100%;
}

/* Stock Card Action Buttons */
.stock-card-actions {
    display: flex;
    gap: 8px;
    margin-top: 14px;
    position: relative;
    z-index: 5;
}

.stock-card-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 5px 12px;
    border-radius: 6px;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
    text-decoration: none;
}

.stock-card-btn.edit {
    background-color: rgba(255, 255, 255, 0.25);
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.45);
}

.stock-card-btn.edit:hover {
    background-color: #ffffff;
    color: #0f172a;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.stock-card-btn.delete {
    background-color: rgba(239, 68, 68, 0.4);
    color: #ffffff;
    border: 1px solid rgba(239, 68, 68, 0.6);
    padding: 5px 9px;
}

.stock-card-btn.delete:hover {
    background-color: #dc2626;
    color: #ffffff;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

/* ===================================================
   FINISHING KHUSUS (MULTI-CHECKBOX IN MONITOR PRODUKSI)
   =================================================== */
.finishing-checkbox-wrapper {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    background: var(--bg-secondary);
    border: 1px solid var(--border-input);
    border-radius: 8px;
    padding: 10px 14px;
    transition: border-color 0.2s;
}
.finishing-checkbox-wrapper:focus-within {
    border-color: #9333ea;
}
.finishing-check-item {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    cursor: pointer;
    padding: 6px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-primary);
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-main);
    user-select: none;
    transition: all 0.15s ease;
}
.finishing-check-item:hover {
    border-color: #9333ea;
    background: rgba(147, 51, 234, 0.05);
}
.finishing-check-item.active {
    border-color: #9333ea !important;
    background-color: rgba(147, 51, 234, 0.12) !important;
    color: #7e22ce !important;
    font-weight: 600 !important;
    box-shadow: 0 1px 3px rgba(147, 51, 234, 0.15);
}
.finishing-check-item input[type="checkbox"] {
    cursor: pointer;
    width: 15px;
    height: 15px;
    accent-color: #7e22ce;
    margin: 0;
}
[data-theme="dark"] .finishing-check-item.active {
    background-color: rgba(147, 51, 234, 0.25) !important;
    color: #d8b4fe !important;
    border-color: #a855f7 !important;
}

/* ===================================================
   MOBILE & RESPONSIVE STYLES (DRAWER & ADAPTIVE VIEW)
   =================================================== */

/* Backdrop for Mobile Sidebar Drawer */
.sidebar-backdrop {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    z-index: 1050;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.sidebar-backdrop.active {
    display: block !important;
    opacity: 1 !important;
    pointer-events: auto !important;
    cursor: pointer;
}

@media (min-width: 769px) {
    .sidebar-backdrop {
        display: none !important;
    }
}

@media (max-width: 768px) {
    /* Mobile App Container */
    .app-container {
        position: relative;
        overflow-x: hidden;
        width: 100%;
        min-height: 100vh;
    }

    /* Off-canvas Slide-out Mobile Sidebar */
    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        width: 280px !important;
        height: 100vh;
        z-index: 1100;
        transform: translateX(-100%);
        transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
        box-shadow: 4px 0 25px rgba(0, 0, 0, 0.35);
    }

    .sidebar.mobile-open {
        transform: translateX(0) !important;
    }

    .sidebar.collapsed {
        width: 280px !important;
        transform: translateX(-100%);
    }

    .sidebar.collapsed.mobile-open {
        transform: translateX(0) !important;
    }

    .sidebar.collapsed .brand-text,
    .sidebar.collapsed .user-info,
    .sidebar.collapsed .menu-item span,
    .sidebar.collapsed .menu-item-group-header span,
    .sidebar.collapsed .caret-icon,
    .sidebar.collapsed .logout-btn span {
        display: inline !important;
    }

    .sidebar-header,
    .sidebar.collapsed .sidebar-header {
        justify-content: space-between !important;
        padding: 14px 16px !important;
    }

    .sidebar-header-logo,
    .sidebar.collapsed .sidebar-header img,
    .sidebar.collapsed .sidebar-header-logo {
        max-width: 75% !important;
        max-height: 40px !important;
    }

    .sidebar-close-btn,
    .sidebar.collapsed .sidebar-close-btn {
        display: inline-flex !important;
        align-items: center;
        justify-content: center;
        width: 36px;
        height: 36px;
        border-radius: 8px;
        background: rgba(255, 255, 255, 0.1);
        border: 1px solid rgba(255, 255, 255, 0.22);
        color: #ffffff;
        font-size: 1.15rem;
        cursor: pointer;
        flex-shrink: 0;
        transition: all 0.2s ease;
    }

    .sidebar-close-btn:hover,
    .sidebar-close-btn:active {
        background: rgba(255, 255, 255, 0.25);
        color: #ffffff;
        transform: scale(0.95);
    }

    .sidebar.collapsed .sidebar-user {
        justify-content: flex-start !important;
        padding: 15px !important;
    }

    .sidebar.collapsed .menu-item,
    .sidebar.collapsed .menu-item-group-header {
        justify-content: flex-start !important;
        padding: 12px 15px !important;
        gap: 12px !important;
    }

    /* Main Content Takes Full 100% Width */
    .main-content {
        width: 100%;
        min-width: 0;
        flex-grow: 1;
    }

    /* Navbar on Mobile */
    .navbar {
        height: 56px;
        padding: 0 12px;
        position: sticky;
        top: 0;
    }

    .nav-left {
        gap: 10px;
        min-width: 0;
    }

    .menu-toggle {
        font-size: 1.2rem;
        padding: 6px 8px;
    }

    .page-title {
        font-size: 0.98rem;
        max-width: 150px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .nav-right {
        gap: 8px;
    }

    .role-badge-nav {
        padding: 4px 8px;
        font-size: 0.68rem;
    }

    .theme-toggle, .notification-bell {
        font-size: 1.05rem;
        padding: 6px;
    }

    /* Content Body Padding */
    .content-body {
        padding: 12px 10px;
        width: 100%;
        box-sizing: border-box;
    }

    /* Grids & Cards */
    .summary-grid {
        grid-template-columns: 1fr;
        gap: 10px;
        margin-bottom: 15px;
    }

    .stat-card {
        padding: 14px 12px;
    }

    .stat-info h3 {
        font-size: 0.8rem;
    }

    .stat-info p {
        font-size: 1.25rem;
    }

    .charts-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    /* Form Rows on Mobile */
    .form-row {
        flex-direction: column;
        gap: 0;
    }

    .form-col {
        width: 100%;
        min-width: 0;
    }

    .form-group {
        margin-bottom: 12px;
    }

    .form-label {
        font-size: 0.82rem;
        margin-bottom: 4px;
    }

    .form-control {
        padding: 8px 10px;
        font-size: 0.88rem;
    }

    /* Filter Bars */
    .filter-bar {
        padding: 12px 10px;
        gap: 10px;
        flex-direction: column;
        align-items: stretch;
        margin-bottom: 15px;
    }

    .filter-group {
        width: 100%;
        min-width: 0;
    }

    .filter-actions {
        width: 100%;
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
    }

    .filter-actions .btn {
        flex: 1;
        min-width: 110px;
        justify-content: center;
        padding: 8px 10px;
        font-size: 0.82rem;
    }

    /* Tables & Responsive Scrolling */
    .table-responsive {
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        border-radius: 6px;
    }

    .table th, .table td {
        padding: 8px 6px;
        font-size: 0.78rem;
        white-space: nowrap;
    }

    /* Explorer Grid for Production Monitor */
    .explorer-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 10px;
    }

    .explorer-item {
        min-height: 230px;
        padding: 10px;
    }

    .explorer-thumbnail {
        height: 120px;
    }

    .explorer-label {
        font-size: 0.78rem;
    }

    .explorer-meta {
        font-size: 0.7rem;
    }

    /* Stock Cards Grid */
    .stocks-grid {
        grid-template-columns: repeat(auto-fill, minmax(135px, 1fr));
        gap: 10px;
    }

    .stock-card {
        padding: 12px 10px;
    }

    .stock-name {
        font-size: 0.82rem;
    }

    .stock-qty {
        font-size: 1.25rem;
    }

    /* Modals on Mobile */
    .modal-content {
        width: 95%;
        max-width: 95%;
        margin: 10px;
        max-height: 92vh;
    }

    .modal-body {
        padding: 14px 12px;
    }

    .modal-footer {
        padding: 12px;
        flex-wrap: wrap;
        gap: 8px;
    }

    .modal-footer .btn {
        flex: 1;
        min-width: 100px;
        justify-content: center;
    }
}
