/* =========================================
   المتغيرات (Variables) والأساسيات
   ========================================= */
:root {
    /* الألوان الأساسية */
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --secondary: #1e293b;
    --dark: #0f172a;
    --bg: #f8fafc;
    --white: #ffffff;
    
    /* ألوان الحالة (Status Colors) */
    --success: #16a34a;
    --success-light: #dcfce7;
    --warning: #f59e0b;
    --warning-light: #fef3c7;
    --danger: #dc2626;
    --danger-light: #fee2e2;
    --info: #06b6d4;
    --info-light: #cffafe;
    --purple: #8b5cf6;
    
    /* الرمادي والحدود */
    --gray-dark: #475569;
    --gray: #94a3b8;
    --gray-light: #e2e8f0;
    --border: #e2e8f0;
    
    /* الظلال (Shadows) */
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1);
    
    /* الحواف والانتقالات */
    --radius: 12px;
    --radius-sm: 8px;
    --transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Cairo', sans-serif;
}

body {
    background-color: var(--bg);
    color: var(--dark);
    line-height: 1.6;
    overflow-x: hidden;
}

/* =========================================
   التخطيط الرئيسي (Desktop Layout)
   ========================================= */
.admin-container {
    display: flex;
    min-height: 100vh;
}

/* --- الشريط الجانبي --- */
.sidebar {
    width: 260px;
    background: linear-gradient(180deg, var(--secondary) 0%, var(--dark) 100%);
    color: var(--white);
    padding: 0;
    position: fixed;
    top: 0;
    right: 0;
    height: 100vh;
    overflow-y: auto;
    z-index: 100;
    transition: var(--transition);
    box-shadow: var(--shadow-lg);
}

.sidebar-logo {
    padding: 25px 20px;
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    margin-bottom: 10px;
}

.sidebar-logo h2 {
    font-size: 24px;
    font-weight: 900;
    margin: 0;
    color: var(--white);
}

.sidebar-logo h2 span {
    color: var(--warning);
}

.sidebar-logo p {
    font-size: 13px;
    color: var(--gray);
    margin-top: 5px;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    padding: 15px 0;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    padding: 13px 20px;
    color: #cbd5e1;
    text-decoration: none;
    font-size: 15px;
    font-weight: 600;
    transition: var(--transition);
    margin: 3px 12px;
    border-radius: var(--radius-sm);
    gap: 12px;
}

.sidebar-nav a:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--white);
    padding-right: 25px;
}

.sidebar-nav a.active {
    background: var(--primary);
    color: var(--white);
    box-shadow: 0 4px 15px rgba(37, 99, 235, 0.3);
}

.sidebar-nav a i {
    width: 22px;
    text-align: center;
    font-size: 18px;
}

.sidebar-nav a.back-to-site {
    margin-top: 30px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding-top: 18px;
    color: var(--warning);
}

.sidebar-nav a.back-to-site:hover {
    background: rgba(245, 158, 11, 0.15);
    color: #fbbf24;
}

/* --- المحتوى الرئيسي --- */
.main-content {
    flex: 1;
    margin-right: 260px; /* تعويض مساحة الشريط الجانبي */
    padding: 25px;
    min-height: 100vh;
}

.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding: 20px 25px;
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.page-title h1 {
    font-size: 24px;
    font-weight: 800;
    color: var(--dark);
}

.admin-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 700;
    color: var(--secondary);
}

.admin-profile .avatar {
    width: 45px;
    height: 45px;
    background: var(--primary);
    color: var(--white);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

/* =========================================
   النماذج والإدخال (Forms & Inputs)
   ========================================= */
.form-container {
    background: var(--white);
    padding: 30px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 25px;
    max-width: 900px;
}

.form-container h2 {
    font-size: 20px;
    font-weight: 800;
    margin-bottom: 20px;
    color: var(--dark);
    display: flex;
    align-items: center;
    gap: 10px;
}

.form-row {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.form-group {
    margin-bottom: 20px;
    flex: 1;
    min-width: 200px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 700;
    color: var(--gray-dark);
    font-size: 14px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    transition: var(--transition);
    background: var(--bg);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    background: var(--white);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-group textarea {
    resize: vertical;
    min-height: 100px;
}

/* =========================================
   الأزرار (Buttons)
   ========================================= */
.submit-btn {
    width: 100%;
    padding: 14px 25px;
    background: var(--primary);
    color: var(--white);
    border: none;
    border-radius: var(--radius-sm);
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin-top: 10px;
}

.submit-btn:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}

.submit-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* أزرار الإجراءات داخل الجداول */
.btn-edit,
.btn-delete {
    color: var(--white);
    border: none;
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    transition: var(--transition);
}

.btn-edit { background: var(--primary); }
.btn-edit:hover { background: var(--primary-dark); }

.btn-delete { background: var(--danger); }
.btn-delete:hover { background: #b91c1c; }

/* =========================================
   الإحصائيات (Stats Cards)
   ========================================= */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 22px;
    box-shadow: var(--shadow);
    border-right: 5px solid var(--primary);
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: var(--transition);
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.stat-card.green { border-right-color: var(--success); }
.stat-card.orange { border-right-color: var(--warning); }
.stat-card.red { border-right-color: var(--danger); }
.stat-card.purple { border-right-color: var(--purple); }

.stat-info h4 {
    font-size: 14px;
    color: var(--gray);
    margin: 0 0 8px;
    font-weight: 600;
}

.stat-info .stat-value {
    font-size: 28px;
    font-weight: 900;
    color: var(--dark);
}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: var(--white);
    background: var(--primary);
}

.stat-card.green .stat-icon { background: var(--success); }
.stat-card.orange .stat-icon { background: var(--warning); }
.stat-card.red .stat-icon { background: var(--danger); }
.stat-card.purple .stat-icon { background: var(--purple); }

/* =========================================
   الجداول (Tables)
   ========================================= */
.table-wrapper {
    overflow-x: auto;
    border-radius: var(--radius-sm);
}

.products-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}

.products-table th,
.products-table td {
    padding: 12px 15px;
    text-align: right;
    border-bottom: 1px solid var(--gray-light);
}

.products-table th {
    background: var(--bg);
    color: var(--gray-dark);
    font-weight: 800;
    font-size: 13px;
    text-transform: uppercase;
}

.products-table tr:hover {
    background: var(--bg);
}

.products-table img {
    width: 50px;
    height: 50px;
    object-fit: cover;
    border-radius: 8px;
    box-shadow: var(--shadow-sm);
}

/* =========================================
   النوافذ المنبثقة (Modals) والعناصر الإضافية
   ========================================= */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.modal-content {
    background-color: var(--white);
    margin: 5% auto;
    padding: 30px;
    width: 90%;
    max-width: 650px;
    border-radius: var(--radius);
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.close-modal {
    background: none;
    border: none;
    font-size: 28px;
    cursor: pointer;
    color: var(--gray-dark);
    transition: var(--transition);
}

.close-modal:hover { color: var(--danger); }

.success-msg {
    color: var(--success);
    background: var(--success-light);
    padding: 15px;
    border-radius: var(--radius-sm);
    margin-top: 20px;
    font-weight: 700;
    text-align: center;
    display: none;
}

hr {
    border: none;
    border-top: 2px solid var(--border);
    margin: 25px 0;
}

/* =========================================
   إعدادات الموبايل (Mobile Responsive View)
   ========================================= */
@media (max-width: 768px) {
    /* 1. التخطيط الرئيسي */
    .admin-container {
        flex-direction: column;
    }

    .main-content {
        margin-right: 0; /* إلغاء الهامش الأيمن للشريط الجانبي */
        width: 100%;
        padding: 15px;
        padding-bottom: 100px; /* مساحة سفلية لحماية المحتوى من شريط التنقل السفلي */
    }

    .admin-header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
        padding: 20px 15px;
    }

    /* 2. تحويل الشريط الجانبي إلى شريط سفلي (Bottom Navigation) */
    .sidebar {
        width: 100%;
        height: auto;
        position: fixed;
        bottom: 0;
        top: auto;
        padding: 10px 5px;
        background: linear-gradient(180deg, var(--secondary) 0%, var(--dark) 100%);
        z-index: 1000;
        box-shadow: 0 -5px 20px rgba(0, 0, 0, 0.2);
        border-radius: 20px 20px 0 0;
    }

    .sidebar-logo {
        display: none; /* إخفاء اللوجو في الموبايل لتوفير مساحة */
    }

    .sidebar-nav {
        flex-direction: row;
        overflow-x: auto;
        padding: 5px 10px;
        gap: 15px;
        align-items: center;
        scroll-behavior: smooth;
    }

    /* إخفاء شريط التمرير (Scrollbar) في الموبايل */
    .sidebar-nav::-webkit-scrollbar {
        display: none; 
    }

    /* تحويل روابط التنقل لأزرار دائرية (FAB-style) */
    .sidebar .sidebar-nav a {
        display: flex;
        justify-content: center;
        align-items: center;
        width: 55px;
        min-width: 55px;
        height: 55px;
        border-radius: 50%;
        padding: 0;
        margin: 0;
        background: rgba(255, 255, 255, 0.08);
        border: 1px solid rgba(255, 255, 255, 0.1);
        color: var(--gray-light);
        box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    }

    /* إخفاء النصوص وإبقاء الأيقونات فقط */
    .sidebar .sidebar-nav a .nav-text {
        display: none;
    }

    .sidebar .sidebar-nav a i {
        font-size: 22px;
        margin: 0;
        width: auto;
    }

    /* تأثيرات الزر النشط في الموبايل */
    .sidebar .sidebar-nav a.active, 
    .sidebar .sidebar-nav a:hover {
        background: var(--primary);
        color: var(--white);
        transform: translateY(-8px); /* رفع الزر لأعلى */
        box-shadow: 0 10px 20px rgba(37, 99, 235, 0.4);
        border-color: var(--primary);
    }

    .sidebar .sidebar-nav a.back-to-site {
        background: rgba(220, 38, 38, 0.15);
        border-top: none;
        margin-top: 0;
        padding-top: 0;
    }
    
    .sidebar .sidebar-nav a.back-to-site.active,
    .sidebar .sidebar-nav a.back-to-site:hover {
        background: var(--danger);
        box-shadow: 0 10px 20px rgba(220, 38, 38, 0.4);
        border-color: var(--danger);
    }

    /* 3. النماذج (Forms) */
    .form-container {
        padding: 20px 15px;
    }

    .form-row {
        flex-direction: column;
        gap: 0;
    }

    .form-group {
        min-width: 100%;
        margin-bottom: 15px;
    }

    /* 4. تحويل الجداول إلى نظام البطاقات (Cards View) */
    .products-table thead {
        display: none; 
    }

    .products-table, 
    .products-table tbody, 
    .products-table tr, 
    .products-table td {
        display: block;
        width: 100%;
    }

    .products-table tr {
        background: var(--white);
        margin-bottom: 15px;
        border-radius: var(--radius);
        padding: 15px;
        box-shadow: var(--shadow-sm);
        border: 1px solid var(--border);
    }

    .products-table td {
        text-align: right;
        padding: 10px 0;
        border-bottom: 1px dashed var(--border);
        font-size: 14px;
        font-weight: 600;
        color: var(--secondary);
    }

    .products-table td:last-child {
        border-bottom: none;
        display: flex;
        flex-direction: row;
        gap: 10px;
        margin-top: 10px;
        padding-bottom: 0;
    }

    .products-table img {
        width: 70px;
        height: 70px;
        display: block;
        margin: 0 auto 10px auto;
    }

    .btn-edit, 
    .btn-delete {
        flex: 1;
        padding: 12px;
        font-size: 14px;
        text-align: center;
        margin: 0;
    }

    /* 5. النوافذ المنبثقة (Modals) */
    .modal-content {
        width: 95%;
        margin: 10% auto;
        padding: 20px 15px;
    }
}

/* منع التمرير (Scroll) أثناء الإمساك بعلامة السحب على الموبايل */
.drag-handle {
    touch-action: none; 
}

/* شكل العنصر وهو بيتسحب (بيكون شفاف شوية عشان يوضح مكانه) */
.sortable-ghost {
    opacity: 0.4;
    background-color: #f1f5f9;
}

/* =====================================================
   تحسينات نهائية للموبايل + واجهة إدارة أكثر ثباتاً
   ===================================================== */
html {
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
}

body {
    min-width: 320px;
}

button,
a,
input,
select,
textarea {
    -webkit-tap-highlight-color: transparent;
}

input,
select,
textarea,
button {
    font-family: inherit;
}

.optional-tag {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    margin-right: 6px;
    border-radius: 999px;
    background: var(--gray-light);
    color: var(--gray-dark);
    font-size: 11px;
    font-weight: 800;
}

.file-upload-wrapper {
    padding: 14px;
    border: 1.5px dashed var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg);
}

.file-upload-wrapper input[type="file"] {
    background: var(--white);
    cursor: pointer;
}

.refresh-stats-btn,
.filter-btn {
    border: none;
    border-radius: var(--radius-sm);
    padding: 11px 16px;
    font-weight: 800;
    cursor: pointer;
    transition: 0.25s ease;
}

.refresh-stats-btn {
    background: var(--secondary);
    color: var(--white);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-bottom: 18px;
}

.refresh-stats-btn:hover,
.filter-btn:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow);
}

.filter-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 18px;
}

.filter-btn {
    background: var(--white);
    color: var(--secondary);
    border: 1px solid var(--border);
}

.filter-btn.active { background: var(--primary); color: var(--white); border-color: var(--primary); }
.filter-btn.pending { color: var(--warning); }
.filter-btn.completed { color: var(--success); }
.filter-btn.cancelled { color: var(--danger); }
.filter-btn.active.pending,
.filter-btn.active.completed,
.filter-btn.active.cancelled { color: var(--white); }

.notification {
    position: fixed;
    top: 18px;
    left: 18px;
    z-index: 5000;
    max-width: min(420px, calc(100vw - 36px));
    padding: 13px 16px;
    border-radius: 14px;
    color: var(--white);
    background: var(--secondary);
    box-shadow: var(--shadow-lg);
    font-weight: 800;
    display: flex;
    align-items: center;
    gap: 10px;
    animation: notificationIn 0.22s ease both;
}

.notification.success { background: var(--success); }
.notification.error { background: var(--danger); }
.notification.info { background: var(--primary); }

@keyframes notificationIn {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}

.stat-card.teal { border-right-color: var(--info); }
.stat-card.teal .stat-icon { background: var(--info); }

@media (min-width: 769px) {
    .main-content .form-container {
        max-width: 1180px;
        width: 100%;
    }
}

@media (max-width: 768px) {
    :root {
        --radius: 16px;
        --radius-sm: 12px;
    }

    body {
        background: #f1f5f9;
        padding-bottom: env(safe-area-inset-bottom);
    }

    .admin-container {
        display: block;
        min-height: 100svh;
    }

    .main-content {
        margin-right: 0 !important;
        padding: 12px;
        padding-bottom: calc(102px + env(safe-area-inset-bottom));
        width: 100%;
    }

    .admin-header {
        position: sticky;
        top: 8px;
        z-index: 50;
        flex-direction: row;
        align-items: center;
        text-align: right;
        gap: 10px;
        padding: 12px;
        margin-bottom: 14px;
        border: 1px solid rgba(226, 232, 240, 0.85);
        backdrop-filter: blur(12px);
        background: rgba(255, 255, 255, 0.92);
    }

    .page-title h1 {
        font-size: 18px;
        line-height: 1.35;
    }

    .admin-profile {
        gap: 8px;
        max-width: 48%;
        justify-content: flex-end;
        font-size: 12px;
    }

    #adminName {
        max-width: 120px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        direction: ltr;
    }

    .admin-profile .avatar {
        width: 36px;
        height: 36px;
        min-width: 36px;
        font-size: 16px;
    }

    .sidebar {
        right: 0;
        left: 0;
        bottom: 0;
        width: 100% !important;
        height: auto !important;
        max-height: 88px;
        overflow: hidden;
        padding: 8px 6px calc(8px + env(safe-area-inset-bottom));
        border-radius: 22px 22px 0 0;
    }

    .sidebar-nav {
        flex-direction: row;
        overflow-x: auto;
        overflow-y: hidden;
        gap: 8px;
        padding: 6px 8px;
        scrollbar-width: none;
        -webkit-overflow-scrolling: touch;
    }

    .sidebar-nav::-webkit-scrollbar { display: none; }

    .sidebar .sidebar-nav a {
        width: 58px;
        min-width: 58px;
        height: 58px;
        margin: 0;
        padding: 0 !important;
        border-radius: 18px;
        border: 1px solid rgba(255, 255, 255, 0.08);
        background: rgba(255, 255, 255, 0.05);
        flex-direction: column;
        gap: 2px;
    }

    .sidebar .sidebar-nav a i {
        font-size: 20px;
        width: auto;
    }

    .sidebar .sidebar-nav a .nav-text {
        display: block;
        max-width: 52px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        font-size: 9px;
        line-height: 1.1;
        opacity: 0.92;
    }

    .sidebar .sidebar-nav a.active,
    .sidebar .sidebar-nav a:hover {
        transform: translateY(-5px);
    }

    .form-container {
        max-width: none;
        width: 100%;
        padding: 16px 12px;
        margin-bottom: 14px;
        border: 1px solid var(--border);
        box-shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
    }

    .form-container h2 {
        font-size: 17px;
        line-height: 1.4;
        align-items: flex-start;
    }

    .form-row {
        display: block;
    }

    .form-group {
        min-width: 0;
        width: 100%;
        margin-bottom: 14px;
    }

    .form-group input,
    .form-group select,
    .form-group textarea {
        min-height: 46px;
        font-size: 16px;
        padding: 11px 12px;
    }

    .submit-btn,
    .refresh-stats-btn,
    .filter-btn {
        min-height: 46px;
        font-size: 15px;
    }

    #saveAllInventory {
        width: 100% !important;
        margin-top: 10px;
    }

    .stats-grid {
        grid-template-columns: 1fr;
        gap: 12px;
        margin-bottom: 18px;
    }

    .stat-card {
        padding: 16px;
        border-right-width: 4px;
    }

    .stat-info .stat-value {
        font-size: 23px;
        line-height: 1.25;
    }

    .stat-icon {
        width: 48px;
        height: 48px;
        min-width: 48px;
        font-size: 19px;
    }

    .filter-buttons {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
    }

    .table-wrapper {
        overflow: visible;
        border-radius: 0;
    }

    .products-table,
    .products-table[style] {
        min-width: 0 !important;
        width: 100%;
        margin-top: 12px;
    }

    .products-table thead {
        display: none;
    }

    .products-table,
    .products-table tbody,
    .products-table tr,
    .products-table td {
        display: block;
        width: 100%;
    }

    .products-table tr {
        position: relative;
        margin-bottom: 12px;
        padding: 12px;
        background: var(--white);
        border: 1px solid var(--border);
        border-radius: 16px;
        box-shadow: 0 8px 20px rgba(15, 23, 42, 0.06);
    }

    .products-table td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: 12px;
        text-align: left;
        padding: 10px 0;
        border-bottom: 1px dashed var(--border);
        color: var(--secondary);
        word-break: break-word;
    }

    .products-table td::before {
        content: attr(data-label);
        flex: 0 0 42%;
        color: var(--gray-dark);
        font-size: 12px;
        font-weight: 900;
        text-align: right;
    }

    .products-table td:not([data-label])::before,
    .products-table td[data-label=""]::before {
        display: none;
    }

    .products-table td:last-child {
        border-bottom: none;
        justify-content: stretch;
        align-items: stretch;
        flex-wrap: wrap;
        padding-bottom: 0;
    }

    .products-table td:last-child::before {
        display: none;
    }

    .products-table td:last-child .btn-edit,
    .products-table td:last-child .btn-delete,
    .products-table td:last-child button {
        flex: 1 1 46%;
        min-height: 42px;
    }

    .products-table img {
        width: 64px !important;
        height: 64px !important;
        margin: 0;
        border-radius: 12px;
    }

    .drag-handle {
        width: 100% !important;
        justify-content: center !important;
        min-height: 34px;
        margin-bottom: 4px;
        color: var(--gray) !important;
        touch-action: none;
    }

    .inventory-row input {
        width: 110px;
        max-width: 48vw;
        text-align: center;
    }

    .modal {
        padding: 10px;
    }

    .modal-content {
        width: 100%;
        max-width: none !important;
        max-height: calc(100svh - 24px);
        margin: 0 auto;
        padding: 16px 12px;
        border-radius: 18px;
    }

    .modal-header h2 {
        font-size: 18px;
    }

    .close-modal {
        width: 42px;
        height: 42px;
        border-radius: 50%;
        background: var(--bg);
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    .notification {
        top: 10px;
        left: 10px;
        right: 10px;
        max-width: none;
        justify-content: center;
        text-align: center;
        font-size: 13px;
    }
}

@media (max-width: 420px) {
    .main-content {
        padding-left: 8px;
        padding-right: 8px;
    }

    .sidebar .sidebar-nav a {
        width: 54px;
        min-width: 54px;
    }

    .page-title h1 {
        font-size: 16px;
    }

    .filter-buttons {
        grid-template-columns: 1fr;
    }

    .products-table td {
        align-items: flex-start;
        flex-direction: column;
        text-align: right;
        gap: 5px;
    }

    .products-table td::before {
        flex-basis: auto;
    }
}
