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

:root {
    /* Font family */
    --font-sans: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    
    /* Theme Light variables */
    --bg-primary: #f4f7f5;
    --bg-secondary: #e8ede9;
    --bg-gradient: linear-gradient(135deg, #eaf2eb 0%, #d8e5db 100%);
    --card-bg: rgba(255, 255, 255, 0.9);
    --modal-bg: #ffffff;
    --card-border: rgba(255, 255, 255, 0.8);
    --text-main: #14221a;
    --text-muted: #4e6056;
    --text-inverse: #ffffff;
    --border-color: rgba(206, 219, 211, 0.8);
    
    /* Brand Accent Colors - Dark Forest Green Theme */
    --primary-color: #1b4332; /* Deep Forest Green */
    --primary-hover: #081c15;
    --secondary-color: #2d6a4f; /* Medium Forest Green */
    --secondary-hover: #1b4332;
    --accent-color: #40916c; /* Sage Accent Green */
    
    /* Status Colors */
    --status-pending-bg: #fef3c7;
    --status-pending-text: #d97706;
    --status-processing-bg: #e0f2fe;
    --status-processing-text: #0284c7;
    --status-approved-bg: #dcfce7;
    --status-approved-text: #16a34a;
    --status-rejected-bg: #fee2e2;
    --status-rejected-text: #dc2626;
    --status-delivered-bg: #f3e8ff;
    --status-delivered-text: #9333ea;
    --status-total-text: #1b73e8;
    
    /* UI Helpers - Squared aesthetic */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -2px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 10px 15px -3px rgba(27, 67, 50, 0.08), 0 4px 6px -4px rgba(27, 67, 50, 0.08);
    --shadow-glass: 0 8px 32px 0 rgba(27, 67, 50, 0.04);
    --radius-sm: 1px;
    --radius-md: 2px;
    --radius-lg: 3px;
    --backdrop-blur: blur(8px);
    --transition: all 0.2s ease-in-out;
}

/* Dark Theme Variables override */
body.dark-theme {
    --bg-primary: #050d0a;
    --bg-secondary: #0a1712;
    --bg-gradient: linear-gradient(135deg, #040a08 0%, #010403 100%);
    --card-bg: rgba(10, 23, 18, 0.9);
    --modal-bg: #0a1712;
    --card-border: rgba(255, 255, 255, 0.04);
    --text-main: #e8ece9;
    --text-muted: #8fa096;
    --text-inverse: #050d0a;
    --border-color: rgba(255, 255, 255, 0.06);
    
    /* Adjust status backgrounds for dark mode readability */
    --status-pending-bg: rgba(217, 119, 6, 0.15);
    --status-pending-text: #fbbf24;
    --status-processing-bg: rgba(2, 132, 199, 0.15);
    --status-processing-text: #38bdf8;
    --status-approved-bg: rgba(22, 163, 74, 0.15);
    --status-approved-text: #4ade80;
    --status-rejected-bg: rgba(220, 38, 38, 0.15);
    --status-rejected-text: #f87171;
    --status-delivered-bg: rgba(147, 51, 234, 0.15);
    --status-delivered-text: #c084fc;
    --status-total-text: #4285f4;
    
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5), 0 4px 6px -4px rgba(0, 0, 0, 0.5);
    --shadow-glass: 0 8px 32px 0 rgba(0, 0, 0, 0.4);
}

/* Material Symbols alignment helper */
.material-symbols-outlined {
    font-size: 20px;
    vertical-align: middle;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

/* Base resets */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

a {
    text-decoration: none;
    color: inherit;
}

body {
    font-family: var(--font-sans);
    background: var(--bg-primary);
    background-image: var(--bg-gradient);
    background-attachment: fixed;
    background-size: cover;
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    transition: background 0.3s ease, color 0.3s ease;
}

/* Layout container */
.app-container {
    display: flex;
    flex: 1;
    position: relative;
}

/* Sidebar Styling */
.sidebar {
    width: 260px;
    background: var(--card-bg);
    backdrop-filter: var(--backdrop-blur);
    -webkit-backdrop-filter: var(--backdrop-blur);
    border-right: 1px solid var(--card-border);
    padding: 2rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
    box-shadow: var(--shadow-glass);
    transition: var(--transition);
    z-index: 100;
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.logo-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 800;
    font-size: 1.25rem;
    box-shadow: 0 4px 14px 0 rgba(27, 67, 50, 0.25);
}

.logo-text {
    font-weight: 700;
    font-size: 1.35rem;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -0.5px;
}

.nav-menu {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.nav-item a {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.75rem 1rem;
    color: var(--text-muted);
    text-decoration: none;
    border-radius: var(--radius-sm);
    font-weight: 500;
    transition: var(--transition);
}

.nav-item a:hover, .nav-item.active a {
    color: var(--primary-color);
    background: rgba(45, 106, 79, 0.08);
}

.nav-item.active a {
    color: white !important;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    box-shadow: 0 4px 12px 0 rgba(27, 67, 50, 0.15);
}

/* User Profile card in sidebar */
.profile-card {
    margin-top: auto;
    padding: 1rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    transition: var(--transition);
}

.profile-card:hover {
    border-color: var(--primary-color);
    background: var(--bg-primary);
}

.profile-details {
    flex: 1;
    min-width: 0;
}

.profile-name {
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.profile-role {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--accent-color);
    font-weight: 700;
    margin-top: 2px;
}

.profile-actions {
    display: flex;
    gap: 0.35rem;
    align-items: center;
}

.profile-action-btn {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    cursor: pointer;
    background: rgba(27, 67, 50, 0.05);
    color: var(--text-muted);
}

.profile-action-btn:hover {
    transform: translateY(-1px);
}

.profile-action-btn.settings-btn:hover {
    background: var(--primary-color);
    color: white;
}

.profile-action-btn.logout-btn {
    background: rgba(239, 68, 68, 0.05);
    color: #ef4444;
}

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

/* Main Content Area */
.main-content {
    flex: 1;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
    max-width: 1600px;
    margin: 0 auto;
    width: 100%;
}

/* Top bar with Lang and Theme switcher */
.top-bar {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.5rem;
}

.icon-btn {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    color: var(--text-main);
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1rem;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}

.icon-btn:hover {
    background: var(--bg-secondary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.lang-selector {
    display: flex;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-sm);
    padding: 0.25rem;
    box-shadow: var(--shadow-sm);
}

.lang-btn {
    text-decoration: none;
    font-size: 0.8rem;
    font-weight: 700;
    padding: 0.35rem 0.65rem;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    transition: var(--transition);
}

.lang-btn.active {
    background: var(--primary-color);
    color: white;
}

/* Cards & Glassmorphism Panels */
.glass-panel {
    background: var(--card-bg);
    backdrop-filter: var(--backdrop-blur);
    -webkit-backdrop-filter: var(--backdrop-blur);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-lg);
    padding: 2rem;
    box-shadow: var(--shadow-glass);
    transition: var(--transition);
}

.glass-panel:hover {
    box-shadow: var(--shadow-lg);
}

/* Page titles & mockup wrapper styling */
.page-header-wrapper {
    border-left: 3px solid var(--primary-color);
    padding-left: 0.75rem;
    margin-bottom: 2rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
}
body.dark-theme .page-header-wrapper {
    border-left-color: var(--accent-color);
}
.page-title {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text-main);
    margin: 0;
    line-height: 1.1;
    letter-spacing: -0.02em;
}
.page-subtitle {
    font-size: 0.82rem;
    color: var(--text-muted);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-top: 2px;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: var(--transition);
    border: none;
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    box-shadow: 0 4px 12px 0 rgba(27, 67, 50, 0.15);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px 0 rgba(27, 67, 50, 0.25);
}

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

.btn-secondary:hover {
    background: var(--border-color);
    transform: translateY(-2px);
}

.btn-danger {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
    box-shadow: 0 4px 12px 0 rgba(239, 68, 68, 0.2);
}

.btn-danger:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px 0 rgba(239, 68, 68, 0.35);
}

.btn-sm {
    padding: 0.4rem 0.8rem;
    font-size: 0.8rem;
    border-radius: var(--radius-sm);
}

/* Forms & Inputs */
.form-group {
    margin-bottom: 1.25rem;
}

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

.form-control {
    width: 100%;
    padding: 0.75rem 1rem;
    border-radius: var(--radius-sm);
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    font-family: var(--font-sans);
    font-size: 0.95rem;
    outline: none;
    transition: var(--transition);
}

.form-control:focus {
    border-color: var(--primary-color);
    background: var(--bg-primary);
    box-shadow: 0 0 0 3px rgba(45, 106, 79, 0.15);
}

/* Checkbox Toggle Switch (Urgent Toggle) */
.switch-container {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
}

.switch-input {
    display: none;
}

.switch-slider {
    width: 48px;
    height: 24px;
    background-color: var(--border-color);
    border-radius: var(--radius-sm);
    position: relative;
    transition: var(--transition);
}

.switch-slider::before {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    border-radius: var(--radius-sm);
    background-color: white;
    top: 3px;
    left: 3px;
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
}

.switch-input:checked + .switch-slider {
    background-color: var(--accent-color);
}

.switch-input:checked + .switch-slider::before {
    transform: translateX(24px);
}

/* Dynamic Grid Form Layouts */
.form-grid-3 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.25rem;
}

.form-grid-2 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(380px, 1fr));
    gap: 1.25rem;
}

/* Dashboard Statistics Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.5rem;
}

.stat-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    box-shadow: var(--shadow-glass);
}

.stat-title {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    font-weight: 600;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
}

.stat-card.stat-total { border-left: 4px solid var(--status-total-text); }
.stat-card.stat-pending { border-left: 4px solid var(--status-pending-text); }
.stat-card.stat-approved { border-left: 4px solid var(--status-approved-text); }
.stat-card.stat-rejected { border-left: 4px solid var(--status-rejected-text); }

/* Tables Design */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    -webkit-overflow-scrolling: touch;
}

.custom-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    background: var(--card-bg);
}

.custom-table th {
    background: var(--bg-secondary);
    padding: 1rem 1.25rem;
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid var(--border-color);
}

.custom-table td {
    padding: 1rem 1.25rem;
    font-size: 0.95rem;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-main);
    vertical-align: middle;
}

.custom-table tbody tr {
    transition: var(--transition);
}

.custom-table tbody tr:hover {
    background: rgba(45, 106, 79, 0.03);
}

/* Badges styling */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.35rem 0.75rem;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.3px;
    text-transform: uppercase;
}

.badge-urgent {
    background: #fee2e2;
    color: #ef4444;
}

.badge-normal {
    background: #f1f5f9;
    color: #475569;
}

/* Action icons inside tables */
.action-links {
    display: flex;
    gap: 0.5rem;
}

.action-btn {
    text-decoration: none;
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    border: none;
    cursor: pointer;
    font-size: 0.9rem;
}

.action-btn.view-btn {
    background: rgba(45, 106, 79, 0.1);
    color: var(--primary-color);
}

.action-btn.view-btn:hover {
    background: var(--primary-color);
    color: white;
}

.action-btn.edit-btn {
    background: rgba(45, 106, 79, 0.1);
    color: var(--secondary-color);
}

.action-btn.edit-btn:hover {
    background: var(--secondary-color);
    color: white;
}

.action-btn.delete-btn {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

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

/* Status colors and layout */
.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.35rem 0.75rem;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.3px;
}

.status-pending { background: var(--status-pending-bg); color: var(--status-pending-text); }
.status-processing { background: var(--status-processing-bg); color: var(--status-processing-text); }
.status-approved { background: var(--status-approved-bg); color: var(--status-approved-text); }
.status-rejected { background: var(--status-rejected-bg); color: var(--status-rejected-text); }
.status-delivered { background: var(--status-delivered-bg); color: var(--status-delivered-text); }

/* Master-detail Item form grid inputs */
.items-table-container {
    margin-top: 1.5rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: visible;
}

.items-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

.items-table tr:first-child th:first-child {
    border-top-left-radius: calc(var(--radius-md) - 1px);
}

.items-table tr:first-child th:last-child {
    border-top-right-radius: calc(var(--radius-md) - 1px);
}

.items-table tr:last-child td:first-child {
    border-bottom-left-radius: calc(var(--radius-md) - 1px);
}

.items-table tr:last-child td:last-child {
    border-bottom-right-radius: calc(var(--radius-md) - 1px);
}

.items-table th {
    background: var(--bg-secondary);
    padding: 0.85rem 1rem;
    text-align: left;
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.items-table td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-color);
    background: var(--card-bg);
}

/* Special styling for dynamic row inputs */
.items-table td input, .items-table td select {
    border: 1px solid var(--border-color);
    background: var(--bg-secondary);
    padding: 0.5rem;
    width: 100%;
    border-radius: var(--radius-sm);
    font-family: var(--font-sans);
    color: var(--text-main);
    transition: var(--transition);
}

.items-table td input:focus, .items-table td select:focus {
    border-color: var(--primary-color);
    background: var(--bg-primary);
    outline: none;
}

/* File Upload drag/drop simulator UI */
.file-upload-wrapper {
    position: relative;
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-md);
    padding: 2rem;
    text-align: center;
    background: var(--bg-secondary);
    cursor: pointer;
    transition: var(--transition);
}

.file-upload-wrapper:hover {
    border-color: var(--primary-color);
    background: rgba(45, 106, 79, 0.02);
}

.file-upload-input {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

.file-upload-icon {
    font-size: 2rem;
    color: var(--primary-color);
    margin-bottom: 0.75rem;
}

.file-upload-text {
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-main);
}

.file-upload-info {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

.file-upload-preview {
    margin-top: 1rem;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--secondary-color);
}

/* Login Screen layout */
.login-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 1rem;
    background-image: url('login_bg.png');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

.login-card {
    width: 100%;
    max-width: 440px;
    padding: 2.5rem;
    background: var(--card-bg);
    backdrop-filter: var(--backdrop-blur);
    -webkit-backdrop-filter: var(--backdrop-blur);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-glass);
}

.login-header {
    text-align: center;
    margin-bottom: 2rem;
}

.login-header .logo-icon {
    margin: 0 auto 1rem auto;
}

.login-header h2 {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-main);
}

.login-header p {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-top: 0.25rem;
}

/* Alerts and feedback */
.alert {
    padding: 0.85rem 1.25rem;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    margin-bottom: 1.25rem;
    font-weight: 500;
}

.alert-danger {
    background-color: #fee2e2;
    border: 1px solid #fca5a5;
    color: #dc2626;
}

.alert-success {
    background-color: #dcfce7;
    border: 1px solid #86efac;
    color: #16a34a;
}

/* Detail page specs */
.details-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.detail-item {
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.75rem;
}

.detail-label {
    font-size: 0.8rem;
    text-transform: uppercase;
    color: var(--text-muted);
    font-weight: 600;
    letter-spacing: 0.5px;
    margin-bottom: 0.25rem;
}

.detail-value {
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-main);
}

.detail-value.urgent-yes {
    color: #ef4444;
    font-weight: 700;
}

/* Floating Actions or Status controls for Admin */
.status-update-box {
    margin-top: 2rem;
    padding: 1.5rem;
    border-radius: var(--radius-md);
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

/* Sidebar Backdrop Overlay for Mobile Drawer */
.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(5, 13, 10, 0.4);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 1090;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}
.sidebar-overlay.active {
    opacity: 1;
    visibility: visible;
}

.mobile-menu-toggle-btn {
    display: none !important;
}

/* Responsive fixes */
@media (max-width: 992px) {
    .app-container {
        flex-direction: column;
    }
    
    .mobile-menu-toggle-btn {
        display: flex !important;
        margin-right: auto;
    }
    
    .top-bar {
        justify-content: flex-end;
        width: 100%;
        gap: 0.75rem;
    }
    
    .sidebar {
        position: fixed;
        top: 0;
        left: -280px; /* Hidden offscreen */
        width: 260px;
        height: 100vh;
        background: var(--modal-bg);
        border-right: 1px solid var(--border-color);
        box-shadow: var(--shadow-lg);
        z-index: 1100;
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        padding: 2rem 1.5rem;
        display: flex;
        flex-direction: column;
        gap: 2rem;
    }
    
    .sidebar.active {
        transform: translateX(280px); /* Slide in */
    }
    
    .logo-container {
        padding-bottom: 1.5rem;
        border-bottom: 1px solid var(--border-color);
    }
    
    .nav-menu {
        flex-direction: column;
        overflow-x: visible;
        gap: 0.5rem;
    }
    
    .nav-item a {
        white-space: normal;
    }
    
    .profile-card {
        margin-top: auto;
        display: flex; /* Keep visible on mobile inside the drawer */
    }
    
    .main-content {
        padding: 1.25rem 1rem;
        gap: 1.25rem;
    }
    
    .stats-grid {
        gap: 0.75rem;
    }
    
    .stat-card {
        padding: 1rem;
    }
    
    .stat-value {
        font-size: 1.6rem;
    }
}

@media (max-width: 768px) {
    .form-grid-3, .form-grid-2 {
        grid-template-columns: 1fr !important;
        gap: 1rem;
    }
    
    .glass-panel {
        padding: 1.25rem;
    }
    
    .page-title {
        font-size: 1.5rem;
    }

    /* Transform Dynamic Items Input Table to Cards on mobile */
    .items-table, 
    .items-table thead, 
    .items-table tbody, 
    .items-table tr, 
    .items-table td {
        display: block;
        width: 100% !important;
    }
    
    .items-table thead {
        display: none; /* Hide standard headers on mobile */
    }
    
    .items-table tbody tr {
        margin-bottom: 1.5rem;
        border: 1px solid var(--border-color);
        padding: 1rem;
        background: var(--card-bg);
        position: relative;
    }
    
    .items-table td {
        border: none !important;
        padding: 0.5rem 0 !important;
        display: flex;
        flex-direction: column;
        gap: 0.25rem;
        text-align: left !important;
    }
    
    /* Inject mobile labels from data-label attributes */
    .items-table td[data-label]::before {
        content: attr(data-label);
        font-weight: 700;
        font-size: 0.75rem;
        text-transform: uppercase;
        color: var(--accent-color);
        letter-spacing: 0.5px;
    }
    
    .items-table td:last-child {
        align-items: flex-end;
        border-top: 1px dashed var(--border-color) !important;
        margin-top: 0.5rem;
        padding-top: 0.75rem !important;
    }
    
    /* Expand buttons to full width on mobile screens for easy tapping */
    .btn {
        width: 100%;
        text-align: center;
    }
    
    .top-bar {
        justify-content: space-between;
        margin-bottom: 1rem;
        width: 100%;
    }
    
    .details-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(5, 13, 10, 0.4);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1100;
}

.modal-overlay.open {
    display: flex;
}

.modal-panel {
    background: var(--modal-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: 90%;
    max-width: 650px;
    padding: 2rem;
    position: relative;
    animation: modalFadeIn 0.25s ease-out;
}

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

.modal-close-btn {
    position: absolute;
    top: 1.25rem;
    right: 1.25rem;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.25rem;
    transition: var(--transition);
}

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

/* Custom Flatpickr Theme to match Deep Forest Green & Dark Mode */
.flatpickr-calendar,
.flatpickr-calendar * {
    font-family: var(--font-sans) !important;
}

.flatpickr-calendar {
    background: var(--modal-bg) !important;
    border: 1px solid var(--border-color) !important;
    border-radius: var(--radius-lg) !important;
    box-shadow: var(--shadow-lg) !important;
    color: var(--text-main) !important;
}

.flatpickr-calendar.arrowTop:before, .flatpickr-calendar.arrowTop:after,
.flatpickr-calendar.arrowBottom:before, .flatpickr-calendar.arrowBottom:after {
    border-top-color: var(--border-color) !important;
    border-bottom-color: var(--border-color) !important;
}

.flatpickr-months .flatpickr-month,
.flatpickr-months .flatpickr-prev-month, 
.flatpickr-months .flatpickr-next-month {
    color: var(--text-main) !important;
    fill: var(--text-main) !important;
}

.flatpickr-months .flatpickr-prev-month:hover, 
.flatpickr-months .flatpickr-next-month:hover {
    color: var(--primary-color) !important;
}

.flatpickr-current-month .numInputWrapper span.arrowUp:after {
    border-bottom-color: var(--text-main) !important;
}
.flatpickr-current-month .numInputWrapper span.arrowDown:after {
    border-top-color: var(--text-main) !important;
}

span.flatpickr-weekday {
    color: var(--text-muted) !important;
    font-weight: 600 !important;
}

.flatpickr-day {
    color: var(--text-main) !important;
    border-radius: var(--radius-sm) !important;
}

.flatpickr-day:hover, .flatpickr-day:focus {
    background: rgba(45, 106, 79, 0.15) !important;
    border-color: transparent !important;
    color: var(--primary-color) !important;
}

body.dark-theme .flatpickr-day:hover, body.dark-theme .flatpickr-day:focus {
    color: var(--accent-color) !important;
    background: rgba(64, 145, 108, 0.2) !important;
}

.flatpickr-day.today {
    border-color: var(--accent-color) !important;
}

.flatpickr-day.selected, .flatpickr-day.selected:hover {
    background: var(--primary-color) !important;
    color: white !important;
    border-color: var(--primary-color) !important;
}

body.dark-theme .flatpickr-day.selected, body.dark-theme .flatpickr-day.selected:hover {
    background: var(--accent-color) !important;
    color: var(--bg-primary) !important;
    border-color: var(--accent-color) !important;
}

.flatpickr-day.flatpickr-disabled, .flatpickr-day.flatpickr-disabled:hover {
    color: var(--text-muted) !important;
    opacity: 0.3 !important;
}

/* Print Specific Styles */
@media print {
    .print-only {
        display: block !important;
    }
    
    /* Reset basic page styles */
    body {
        background: #ffffff !important;
        color: #000000 !important;
        font-size: 11pt !important;
        line-height: 1.4 !important;
    }
    
    /* Hide all non-printable layout elements */
    .sidebar, 
    .top-bar, 
    .btn, 
    .status-update-box, 
    .no-print,
    .material-symbols-outlined {
        display: none !important;
    }
    
    /* Reset main content structure */
    .app-container {
        display: block !important;
        width: 100% !important;
        border: none !important;
    }
    
    .main-content {
        padding: 0 !important;
        margin: 0 !important;
        max-width: 100% !important;
        width: 100% !important;
    }
    
    .glass-panel {
        border: none !important;
        box-shadow: none !important;
        background: transparent !important;
        padding: 0 !important;
        backdrop-filter: none !important;
    }
    
    /* Details metadata grid: 3 solid columns for print alignment */
    .details-grid {
        display: grid !important;
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 1rem !important;
        margin-bottom: 1.5rem !important;
        border: 1px solid #ccc !important;
        padding: 1rem !important;
        background: #fafafa !important;
    }
    
    .detail-item {
        border-bottom: 1px solid #eee !important;
        padding-bottom: 0.4rem !important;
    }
    
    .detail-label {
        color: #444 !important;
        font-weight: 700 !important;
        font-size: 8pt !important;
    }
    
    .detail-value {
        color: #000 !important;
        font-size: 9.5pt !important;
        font-weight: 600 !important;
    }
    
    .detail-value.urgent-yes {
        color: #dc2626 !important;
        font-weight: 700 !important;
    }

    /* Long descriptions and comments boxes styling */
    .main-content div[style*="display: grid; grid-template-columns: repeat(auto-fit, minmax(380px, 1fr))"] {
        display: grid !important;
        grid-template-columns: 1fr 1fr !important;
        gap: 1rem !important;
        margin-bottom: 1.5rem !important;
    }
    
    div[style*="background: var(--bg-secondary)"] {
        background: #fafafa !important;
        border: 1px solid #ccc !important;
        padding: 0.85rem !important;
    }
    
    /* Attachment section styling for print */
    div[style*="margin-bottom: 2.5rem; background: var(--bg-secondary)"] {
        background: #fafafa !important;
        border: 1px solid #ccc !important;
        padding: 0.65rem 0.85rem !important;
        margin-bottom: 1.5rem !important;
    }
    
    /* Tables printable grid design */
    .custom-table {
        width: 100% !important;
        border: 1px solid #444 !important;
        border-collapse: collapse !important;
        margin-top: 0.5rem !important;
    }
    
    .custom-table th {
        background: #e2e8f0 !important;
        color: #000 !important;
        border: 1px solid #444 !important;
        font-weight: 700 !important;
        font-size: 8.5pt !important;
        padding: 0.4rem 0.6rem !important;
        text-align: left !important;
    }
    
    .custom-table td {
        border: 1px solid #444 !important;
        color: #000 !important;
        font-size: 9pt !important;
        padding: 0.4rem 0.6rem !important;
        background: transparent !important;
    }
    
    /* Badges printable styles */
    .badge, .status-badge {
        border: 1px solid #666 !important;
        background: transparent !important;
        color: #000 !important;
        padding: 0.1rem 0.35rem !important;
        font-size: 7pt !important;
        border-radius: 1px !important;
    }
    
    .status-badge {
        font-weight: 700 !important;
    }
    
    .status-pending { border-color: #d97706 !important; color: #d97706 !important; }
    .status-processing { border-color: #0284c7 !important; color: #0284c7 !important; }
    .status-approved { border-color: #16a34a !important; color: #16a34a !important; }
    .status-rejected { border-color: #dc2626 !important; color: #dc2626 !important; }
    
    .badge-urgent {
        border-color: #dc2626 !important;
        color: #dc2626 !important;
        font-weight: 700 !important;
    }
}

/* =============================================
   Catalog Item Search Autocomplete Component
   ============================================= */
.catalog-autocomplete {
    position: relative;
    margin-bottom: 5px;
    z-index: 1;
}

.catalog-autocomplete:focus-within {
    z-index: 10;
}

.catalog-autocomplete-input {
    width: 100%;
    padding: 0.5rem 2rem 0.5rem 0.5rem;
    border: 1px solid var(--border-color);
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
    font-family: var(--font-sans);
    color: var(--text-main);
    font-size: 0.88rem;
    transition: var(--transition);
    cursor: text;
}

.catalog-autocomplete-input::placeholder {
    color: var(--text-muted);
    font-style: italic;
    font-size: 0.82rem;
}

.catalog-autocomplete-input:focus {
    border-color: var(--primary-color);
    background: var(--bg-primary);
    outline: none;
    box-shadow: 0 0 0 3px rgba(45, 106, 79, 0.12);
}

/* Search icon indicator */
.catalog-autocomplete-icon {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
    font-size: 18px !important;
    transition: color 0.2s ease;
}

.catalog-autocomplete-input:focus ~ .catalog-autocomplete-icon {
    color: var(--primary-color);
}

/* Clear button */
.catalog-autocomplete-clear {
    position: absolute;
    right: 30px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 2px;
    display: none;
    font-size: 16px !important;
    line-height: 1;
    transition: color 0.2s ease;
    z-index: 2;
}

.catalog-autocomplete-clear:hover {
    color: #ef4444;
}

.catalog-autocomplete.has-value .catalog-autocomplete-clear {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Dropdown results panel */
.catalog-autocomplete-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    max-height: 260px;
    overflow-y: auto;
    background: var(--modal-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    display: none;
    animation: acDropdownSlide 0.15s ease-out;
}

.catalog-autocomplete-dropdown.open {
    display: block;
}

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

/* Individual result items */
.catalog-autocomplete-item {
    padding: 0.55rem 0.75rem;
    cursor: pointer;
    font-size: 0.85rem;
    color: var(--text-main);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 1px;
    transition: background 0.12s ease;
}

.catalog-autocomplete-item:last-child {
    border-bottom: none;
}

.catalog-autocomplete-item:hover,
.catalog-autocomplete-item.active {
    background: rgba(45, 106, 79, 0.08);
}

.catalog-autocomplete-item.active {
    background: rgba(45, 106, 79, 0.14);
}

.catalog-autocomplete-item-title {
    font-weight: 600;
    font-size: 0.85rem;
}

.catalog-autocomplete-item-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
    display: flex;
    gap: 0.75rem;
}

.catalog-autocomplete-item-erp {
    color: var(--accent-color);
    font-weight: 600;
    font-size: 0.78rem;
}

/* Highlight matched text */
.catalog-autocomplete-item mark {
    background: rgba(45, 106, 79, 0.18);
    color: var(--primary-color);
    font-weight: 700;
    border-radius: 1px;
    padding: 0 1px;
}

body.dark-theme .catalog-autocomplete-item mark {
    background: rgba(64, 145, 108, 0.25);
    color: var(--accent-color);
}

/* No results message */
.catalog-autocomplete-empty {
    padding: 0.75rem;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.82rem;
    font-style: italic;
}

/* Scrollbar styling for dropdown */
.catalog-autocomplete-dropdown::-webkit-scrollbar {
    width: 5px;
}

.catalog-autocomplete-dropdown::-webkit-scrollbar-track {
    background: transparent;
}

.catalog-autocomplete-dropdown::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

.catalog-autocomplete-dropdown::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}
