:root {
    --primary-color: #0f172a;       /* Dark Navy */
    --primary-light: #334155;
    --accent-color: #3b82f6;        /* Bright Blue */
    --success-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --info-color: #0ea5e9;
    --light-bg: #f8fafc;
    --card-bg: #ffffff;
    --border-radius: 12px;
}

/* --- Global Scrollbar & Body Fixes --- */
body {
    font-family: 'Inter', sans-serif;
    background-color: var(--light-bg);
    font-size: 0.85rem;
    color: #1e293b;
    overflow-x: hidden;
    padding-bottom: 0; 
    height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Custom Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* --- Tooltip Customization --- */
.tooltip-inner {
    max-width: 300px;
    text-align: left;
    padding: 10px;
    background-color: #1e293b;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

/* --- Header Styling --- */
.header-bar {
    background: #fff;
    border-bottom: 1px solid #e2e8f0;
    padding: 10px 0;
    position: sticky;
    top: 0;
    z-index: 1000;
    flex-shrink: 0;
}

.header-brand {
    font-weight: 800;
    font-size: 1.35rem;
    color: var(--primary-color);
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    letter-spacing: -0.5px;
    cursor: pointer;
}

.brand-icon-box {
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    color: white;
    border-radius: 8px;
    padding: 4px 8px;
    box-shadow: 0 4px 10px rgba(59, 130, 246, 0.3);
    transition: all 0.3s ease;
}

.by-somar {
    font-family: 'Dancing Script', cursive;
    font-size: 0.85rem;
    color: var(--accent-color);
    margin-top: -2px;
    opacity: 0.9;
    font-weight: 600;
}

.header-content-wrapper {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.header-content-wrapper > .header-brand-cluster {
    min-width: 0;
}

.user-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

.user-badge {
    background: #f1f5f9;
    padding: 5px 12px;
    border-radius: 50px;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 10px;
    border: 1px solid #e2e8f0;
    cursor: pointer;
    transition: all 0.2s;
    color: #334155;
    user-select: none;
}
.user-badge:hover, .user-badge[aria-expanded="true"] { background: #e2e8f0; border-color: #cbd5e1; }
.user-avatar { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; }

/* --- Sidebar (Premium Enterprise Design) --- */
.app-sidebar {
    position: fixed !important;
    top: 0 !important;
    left: 0;
    bottom: 0;
    width: min(292px, calc(100vw - 18px));
    /* إضافة تدرج لوني خفيف جداً للخلفية الغامقة لإعطاء عمق */
    background: linear-gradient(180deg, #0f172a 0%, #1e293b 100%); 
    border-right: 1px solid rgba(255, 255, 255, 0.05);
    z-index: 9999 !important;
    box-shadow: 4px 0 24px rgba(0,0,0,0.15);
    transform: translateX(-100%);
    /* حركة دخول وخروج أكثر نعومة وانسيابية */
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1); 
    overflow-y: auto; 
    overflow-x: hidden;
    padding: 15px 12px 18px !important;
}

.app-sidebar::-webkit-scrollbar { width: 4px; }
.app-sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 4px; }
.app-sidebar::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.25); }

.app-sidebar.open { transform: translateX(0); }

.sidebar-overlay {
    position: fixed !important;
    top: 0 !important;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(15, 23, 42, 0.4); /* تخفيف سواد الخلفية قليلاً */
    z-index: 9998 !important;
    display: none;
    backdrop-filter: blur(5px); /* زيادة تأثير الزجاج المغشى */
    -webkit-backdrop-filter: blur(5px);
    transition: opacity 0.3s ease;
}
.sidebar-overlay.show { display: block; }

.sidebar-welcome-card {
    list-style: none;
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 0 6px 14px;
    padding: 14px;
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 18px;
    background:
        radial-gradient(circle at top left, rgba(59, 130, 246, 0.28), transparent 34%),
        linear-gradient(135deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.04));
    box-shadow: 0 16px 36px rgba(2, 6, 23, 0.25);
    position: relative;
    overflow: hidden;
}

.sidebar-welcome-card::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(120deg, transparent, rgba(255, 255, 255, 0.08), transparent);
    transform: translateX(-120%);
    transition: transform 0.7s ease;
}

.sidebar-welcome-card:hover::after {
    transform: translateX(120%);
}

.sidebar-welcome-avatar {
    width: 42px;
    height: 42px;
    border-radius: 15px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: #dbeafe;
    font-weight: 800;
    font-size: 0.85rem;
    letter-spacing: 0.4px;
    background: linear-gradient(135deg, #2563eb, #38bdf8);
    box-shadow: 0 10px 24px rgba(37, 99, 235, 0.35);
    overflow: hidden;
    position: relative;
    z-index: 1;
}

.sidebar-welcome-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.sidebar-welcome-content {
    min-width: 0;
    position: relative;
    z-index: 1;
}

.sidebar-welcome-eyebrow,
.sidebar-welcome-meta {
    display: block;
    color: #94a3b8;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.sidebar-welcome-name {
    display: block;
    color: #f8fafc;
    font-size: 0.96rem;
    line-height: 1.2;
    margin: 2px 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-welcome-meta {
    color: #bfdbfe;
    font-size: 0.66rem;
    letter-spacing: 0.04em;
    text-transform: none;
}

.sidebar-section {
    list-style: none;
    margin: 0 0 10px;
    border: 1px solid rgba(148, 163, 184, 0.14);
    border-radius: 16px;
    background:
        linear-gradient(180deg, rgba(30, 41, 59, 0.46), rgba(15, 23, 42, 0.32));
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
    overflow: hidden;
    transition: border-color 0.25s ease, background 0.25s ease, box-shadow 0.25s ease;
}

.sidebar-section:hover {
    border-color: rgba(96, 165, 250, 0.28);
    background: rgba(15, 23, 42, 0.48);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), 0 14px 28px rgba(2, 6, 23, 0.16);
}

.sidebar-section.is-active {
    border-color: rgba(96, 165, 250, 0.26);
    background:
        linear-gradient(180deg, rgba(59, 130, 246, 0.1), rgba(15, 23, 42, 0.34));
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.07),
        0 10px 24px rgba(2, 6, 23, 0.14);
}

.sidebar-section.is-active .sidebar-section-toggle {
    background: linear-gradient(90deg, rgba(96, 165, 250, 0.07), transparent 72%);
}

.sidebar-section-toggle {
    width: 100%;
    border: 0;
    background: transparent;
    color: #cbd5e1;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    padding: 11px 12px 10px;
    cursor: pointer;
    text-align: left;
}

.sidebar-section-toggle:focus-visible {
    outline: 2px solid rgba(96, 165, 250, 0.7);
    outline-offset: -2px;
}

.sidebar-section-title-wrap {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: flex-start;
    gap: 8px;
}

.sidebar-section-title {
    color: #a7b4c7;
    display: -webkit-box;
    font-size: 0.76rem;
    font-weight: 800;
    letter-spacing: 0.035em;
    line-height: 1.25;
    max-height: 2.5em;
    text-transform: uppercase;
    overflow: hidden;
    text-overflow: clip;
    overflow-wrap: anywhere;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    text-shadow: none;
}

.sidebar-section.is-active .sidebar-section-title {
    color: #dbeafe;
    text-shadow: none;
}

.sidebar-section-count {
    min-width: 22px;
    height: 22px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #cbd5e1;
    background: rgba(148, 163, 184, 0.12);
    border: 1px solid rgba(148, 163, 184, 0.18);
    font-size: 0.68rem;
    font-weight: 800;
    flex-shrink: 0;
}

.sidebar-section.is-active .sidebar-section-count {
    color: #dbeafe;
    background: rgba(59, 130, 246, 0.14);
    border-color: rgba(96, 165, 250, 0.24);
}

.sidebar-section-chevron {
    color: #94a3b8;
    font-size: 0.78rem;
    margin-top: 3px;
    flex-shrink: 0;
    transition: transform 0.25s ease, color 0.25s ease;
}

.sidebar-section:not(.is-collapsed) .sidebar-section-chevron {
    color: #60a5fa;
}

.sidebar-section.is-collapsed .sidebar-section-chevron {
    transform: rotate(-90deg);
}

.sidebar-single-section .sidebar-section-toggle {
    cursor: default;
}

.sidebar-single-section .sidebar-section-chevron {
    display: none;
}

.sidebar-section-items {
    display: grid;
    grid-template-rows: 1fr;
    transition: grid-template-rows 0.32s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.25s ease;
    opacity: 1;
}

.sidebar-section.is-collapsed .sidebar-section-items {
    grid-template-rows: 0fr;
    opacity: 0;
}

.sidebar-section-list {
    min-height: 0;
    overflow: hidden;
    padding: 0 0 8px;
}

.sidebar-link {
    color: #cbd5e1; /* لون رمادي مزرق مريح للعين */
    font-size: 0.84rem;
    font-weight: 500;
    line-height: 1.22;
    padding: 9px 11px;
    margin: 2px 6px; /* جعل الزر كبسولة عائمة غير ملتصقة بالحواف */
    border-radius: 12px;
    transition: all 0.2s ease-in-out;
    display: flex;
    align-items: flex-start;
    position: relative;
    min-height: 40px;
}

.sidebar-link:hover { 
    background-color: rgba(255, 255, 255, 0.08); 
    color: #f8fafc; 
    transform: translateX(4px); 
}

/* تصميم الزر النشط (Active) الاحترافي */
.sidebar-link.active { 
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.22), rgba(14, 165, 233, 0.12));
    color: #dbeafe; /* لون نص أزرق مشرق */
    font-weight: 600; 
    box-shadow: 0 10px 24px rgba(37, 99, 235, 0.16);
}

/* الخط الجانبي المضيء للزر النشط */
.sidebar-link.active::before {
    content: '';
    position: absolute;
    left: -8px; /* إرجاع الخط ليلتصق بحافة القائمة اليسرى */
    top: 15%;
    height: 70%;
    width: 4px;
    background-color: #3b82f6; 
    border-radius: 0 4px 4px 0;
    box-shadow: 2px 0 8px rgba(59, 130, 246, 0.4);
}

.sidebar-link i { 
    font-size: 1.05rem; 
    opacity: 0.75; 
    transition: all 0.2s;
    line-height: 1.2;
    margin-top: 1px;
    flex-shrink: 0;
}

.sidebar-link span {
    display: -webkit-box;
    flex: 1;
    min-width: 0;
    max-height: 2.44em;
    overflow: hidden;
    overflow-wrap: anywhere;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.sidebar-link .badge {
    flex-shrink: 0;
    align-self: flex-start;
    margin-top: 1px;
}

.sidebar-link.active i {
    opacity: 1;
    color: #60a5fa;
}

/* تنسيق عناوين الأقسام (Category Headers) لتصبح أكثر فخامة */
#sidebar .text-white-50.text-uppercase {
    color: #64748b !important;
    letter-spacing: 1.1px; /* تباعد الحروف يعطي طابعاً احترافياً */
    font-weight: 700;
    font-size: 0.7rem !important;
    margin-left: 8px;
}
/* --- Main Content --- */
main.flex-grow-1 {
    background-color: #f1f5f9;
    width: 100%;
    overflow-y: auto; 
    height: calc(100vh - 70px); 
}

/* --- Interface Styles --- */
.custom-card {
    border: 1px solid #e2e8f0;
    border-radius: var(--border-radius);
    box-shadow: 0 2px 5px rgba(0,0,0,0.03);
    background: var(--card-bg);
    margin-bottom: 20px;
    overflow: hidden;
    transition: all 0.2s;
}
.card-header-custom { background-color: #fff; border-bottom: 1px solid #f1f5f9; padding: 15px 20px; font-weight: 700; color: #334155; display: flex; justify-content: space-between; align-items: center; }
.card-header-custom h6 { margin: 0; font-weight: 700; font-size: 0.95rem; }

/* Tables & Inputs */
.table-custom th { background-color: #f8fafc; color: #475569; font-weight: 700; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.3px; vertical-align: middle; text-align: center; border-bottom: 2px solid #e2e8f0; white-space: nowrap; padding: 12px 10px; }
.table-custom td { vertical-align: middle; text-align: center; padding: 10px 8px; border-bottom: 1px solid #f1f5f9; color: #334155; font-size: 0.85rem; }
.table-custom tr:last-child td { border-bottom: 0; }

/* إزالة الظل الرمادي المزعج عند التمرير على الجداول والبطاقات */
.table-hover > tbody > tr:hover > * {
    background-color: transparent !important;
    box-shadow: none !important;
    color: inherit !important;
}
.table-hover > tbody > tr:hover {
    background-color: #fff !important;
}

/* Sticky Header for Long Tables */
.sticky-header th {
    position: sticky;
    top: 0;
    z-index: 10;
    box-shadow: 0 2px 2px -1px rgba(0, 0, 0, 0.1);
}

.form-control-sm, .form-select-sm { border-radius: 6px; border: 1px solid #cbd5e1; text-align: center; font-size: 0.85rem; padding: 8px; background-color: #fff; transition: all 0.2s; font-weight: 500; }
.table-custom input.form-control-sm { min-width: 85px; }
.c-name { min-width: 140px !important; text-align: left !important; }
.c-rev, .c-cogs { min-width: 110px !important; } 
.form-control-sm:focus { border-color: var(--accent-color); box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1); }
.btn-icon { width: 28px; height: 28px; padding: 0; display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; transition: all 0.2s; }
.help-icon { cursor: help; color: #94a3b8; margin-left: 4px; font-size: 0.85rem; transition: color 0.2s; }
.help-icon:hover { color: var(--accent-color); }

/* Updated Report Table Styles */
.row-loss { background-color: #fef2f2 !important; }
.row-win { }
.clickable-cell { transition: all 0.2s; position: relative; }
.clickable-cell:hover { color: var(--accent-color) !important; background-color: #eff6ff; }
.alloc-badge { cursor: pointer; font-size: 0.7rem; padding: 4px 10px; background-color: #e2e8f0; color: #475569; border-radius: 20px; display: inline-block; border: 1px solid #cbd5e1; width: 100%; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 600; }
.alloc-badge:hover { background-color: #cbd5e1; border-color: #94a3b8; }
.brand-checkbox-list { max-height: 200px; overflow-y: auto; border: 1px solid #dee2e6; padding: 10px; border-radius: 6px; background: #fff; }
.form-check-label { font-size: 0.85rem; cursor: pointer; width: 100%; }
.year-select-container { display: inline-flex; align-items: center; background: #f1f5f9; padding: 4px 12px; border-radius: 20px; border: 1px solid #e2e8f0; }
.year-select-container select { background-color: transparent; border: none; color: #334155; font-weight: 700; cursor: pointer; outline: none; }
.auth-hidden { display: none !important; }

/* تبويبات الفلترة في التذاكر - لضمان بقائها بسطر واحد مع التقلص */
.nav-pills.flex-nowrap .nav-item { min-width: 0; }
.nav-pills.flex-nowrap .nav-link { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.type-filter-btn { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex-shrink: 1; }

/* Marketing & Others */
.hero-section { background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%); color: white; padding: 120px 0 100px; position: relative; overflow: hidden; }
.hero-shape { position: absolute; top: 0; right: 0; bottom: 0; left: 0; background-image: radial-gradient(circle at 70% 30%, rgba(59, 130, 246, 0.2) 0%, transparent 50%); pointer-events: none; }
.mock-report-card { background: white; border-radius: 12px; box-shadow: 0 20px 50px rgba(0,0,0,0.2); overflow: hidden; transform: rotate(2deg); border: 1px solid rgba(255,255,255,0.2); }
.mock-report-header { background: var(--primary-color); padding: 15px; color: white; font-weight: bold; display: flex; justify-content: space-between; }
.mock-row { border-bottom: 1px solid #eee; }
.mock-row td { padding: 12px; font-size: 0.9rem; }
.mock-loss { color: var(--danger-color); font-weight: bold; background: #fff1f2; }
.mock-win { color: var(--success-color); font-weight: bold; }
#loadingOverlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(255,255,255,0.98); z-index: 9999; display: flex; flex-direction: column; justify-content: center; align-items: center; }
.company-select-card { transition: transform 0.2s, box-shadow 0.2s; cursor: pointer; border: 1px solid #e2e8f0; position: relative; overflow: hidden; background: white; }
.company-select-card:hover { transform: translateY(-5px); box-shadow: 0 10px 25px rgba(0,0,0,0.08); border-color: var(--primary-color); }
.add-company-card { border: 2px dashed #cbd5e1; background-color: #f8fafc; }
.add-company-card:hover { border-color: var(--primary-color); background-color: #fff; }
.demo-company-card { border: 1px solid #fcd34d; background: #fffbeb; }
.demo-company-card:hover { border-color: #f59e0b; box-shadow: 0 10px 25px rgba(245, 158, 11, 0.15); }
.delete-comp-btn { position: absolute; top: 15px; right: 15px; background: #fee2e2; color: #ef4444; border: none; width: 30px; height: 30px; border-radius: 50%; display: flex; align-items: center; justify-content: center; transition: all 0.2s; z-index: 10; }
.delete-comp-btn:hover { background: #ef4444; color: white; }
.role-badge { font-size: 0.65rem; text-transform: uppercase; letter-spacing: 0.5px; padding: 3px 8px; border-radius: 4px; background: #fbbf24; color: #78350f; font-weight: 700; }
.sync-pulse { animation: pulse-green 1s ease-out; }
@keyframes pulse-green { 0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); } 100% { box-shadow: 0 0 0 10px rgba(16, 185, 129, 0); } }
.input-group-text { font-size: 0.75rem; background-color: #f8fafc; }
.demo-alert-bar { background-color: #dc2626; color: white; text-align: center; padding: 8px; font-weight: bold; font-size: 0.9rem; }
.pricing-card { border: 1px solid #e2e8f0; border-radius: 16px; padding: 2rem; text-align: center; transition: all 0.3s; }
.pricing-card:hover { transform: translateY(-5px); box-shadow: 0 10px 30px rgba(0,0,0,0.1); }
.pricing-highlight { border: 2px solid var(--primary-color); background: #f8fafc; position: relative; }
.pricing-badge { position: absolute; top: -12px; left: 50%; transform: translateX(-50%); background: var(--primary-color); color: white; padding: 4px 12px; border-radius: 20px; font-size: 0.75rem; font-weight: bold; }
.pin-input { letter-spacing: 0.5em; text-align: center; font-size: 1.5rem; font-weight: bold; }
.pro-status { background: linear-gradient(135deg, #f59e0b, #fbbf24); color: black; font-weight: bold; border: 1px solid #d97706; box-shadow: 0 2px 5px rgba(245, 158, 11, 0.3); }
.fade-in { animation: fadeIn 0.4s ease-in-out; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }

/* =========================================
   Sales Order Module Specific Styles
   ========================================= */

/* 1. Group Hover Lift */
.group-hover-lift {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.group-hover-lift:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
    background-color: #f8fafc;
    z-index: 1;
    position: relative;
}

/* 2. Read-Only Fields */
#orderForm input:disabled, 
#orderForm select:disabled, 
#orderForm textarea:disabled {
    background-color: transparent;
    border: none;
    padding-left: 0;
    padding-right: 0;
    color: #334155;
    font-weight: 600;
    opacity: 1; 
    cursor: text;
}

#orderForm select:disabled {
    background-image: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

#orderForm input:enabled, 
#orderForm select:enabled, 
#orderForm textarea:enabled {
    background-color: #fff;
    border: 1px solid #cbd5e1;
    padding: 0.375rem 0.75rem; 
    border-radius: 0.375rem;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}
.table-custom input.form-control-sm:enabled {
    padding: 4px 8px;
    text-align: center;
}

/* 3. Product Search Dropdown */
.product-search-results {
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    overflow: hidden;
    background: white;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}
.product-search-results .list-group-item {
    border: none;
    border-bottom: 1px solid #f1f5f9;
    cursor: pointer;
    transition: background-color 0.15s;
}
.product-search-results .list-group-item:last-child {
    border-bottom: none;
}
.product-search-results .list-group-item:hover {
    background-color: #f8fafc;
}

/* 4. Modal Toolbar */
#modalActionsToolbar button {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}
body.modal-open #salesMainFab {
    display: none !important;
}

/* 5. Sales Tabs (mobile scroll friendly) */
#orderTabs {
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
}

/* 6. Sales order workflow strip */
.sales-workflow-strip {
    gap: 0.35rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
.workflow-step {
    font-size: 0.72rem;
    font-weight: 700;
    color: #64748b;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 999px;
    padding: 0.22rem 0.55rem;
    white-space: nowrap;
    flex: 0 0 auto;
}
.workflow-step.active {
    color: #1d4ed8;
    background: #dbeafe;
    border-color: #93c5fd;
}
.workflow-step.done {
    color: #047857;
    background: #dcfce7;
    border-color: #86efac;
}
.workflow-dot {
    width: 6px;
    height: 6px;
    border-radius: 999px;
    background: #cbd5e1;
    flex: 0 0 auto;
}
/* --- Modern Modal Styling --- */
.modal-fullscreen .modal-header {
    border-bottom: 1px solid rgba(0,0,0,0.05) !important;
}
.modal-fullscreen .modal-footer {
    border-top: 1px solid rgba(0,0,0,0.05) !important;
    background: rgba(255,255,255,0.9);
    backdrop-filter: blur(10px);
}
.sales-order-modal-dialog {
    max-width: min(1300px, calc(100vw - 2rem));
}
#orderModal .sales-order-modal-dialog .modal-content {
    position: relative;
    border: 1px solid #dbe3ef;
    border-radius: 18px;
    overflow: hidden;
    box-shadow: 0 20px 45px rgba(15, 23, 42, 0.18);
}
#orderModal .sales-order-modal-dialog .modal-header {
    position: sticky;
    top: 0;
    z-index: 1062;
    background: rgba(255,255,255,0.92) !important;
    backdrop-filter: blur(8px);
    box-shadow: 0 2px 12px rgba(15, 23, 42, 0.06);
}
#orderModal .sales-order-modal-dialog .modal-body {
    background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
}
#orderModal #modalModeBadge {
    font-size: 0.68rem;
    letter-spacing: 0.02em;
}
#orderModal .modal-content.order-mode-preview #orderForm input:disabled,
#orderModal .modal-content.order-mode-preview #orderForm select:disabled,
#orderModal .modal-content.order-mode-preview #orderForm textarea:disabled {
    color: #0f172a;
}
#orderModal .modal-content.order-mode-edit #orderForm,
#orderModal .modal-content.order-mode-create #orderForm {
    box-shadow: inset 0 0 0 1px rgba(59, 130, 246, 0.12);
    border-radius: 14px;
    padding: 0.35rem;
    background: rgba(255, 255, 255, 0.35);
}
.order-section-card {
    border: 1px solid #e2e8f0 !important;
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.05) !important;
}
.order-summary-card {
    position: relative;
}
.order-summary-card .bg-light {
    border: 1px solid #e2e8f0;
}
#orderModal.show .sales-order-modal-dialog {
    animation: salesOrderModalIn 0.16s ease-out;
}
@keyframes salesOrderModalIn {
    from { transform: translateY(8px) scale(0.992); opacity: 0.85; }
    to { transform: translateY(0) scale(1); opacity: 1; }
}
.modal-backdrop.show {
    opacity: 0.58;
}
.order-modal-loader {
    position: absolute;
    inset: 0;
    z-index: 1070;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(248, 250, 252, 0.88);
    backdrop-filter: blur(2px);
    pointer-events: all;
}
#orderModal .modal-content.is-order-loading .modal-body,
#orderModal .modal-content.is-order-loading .modal-header,
#orderModal .modal-content.is-order-loading .modal-footer {
    filter: saturate(0.9);
}
.hover-scale { transition: transform 0.2s; }
.hover-scale:hover { transform: scale(1.02); }

/* Sales modal product area emphasis */
#linesContainer {
    background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
    border: 1px dashed #cbd5e1;
    border-radius: 14px;
    padding: 0.75rem;
}
#btnAddLineDesktop {
    border-radius: 12px !important;
    font-weight: 700;
    box-shadow: 0 6px 16px rgba(37, 99, 235, 0.2);
}
#linesTable #linesTableBody tr {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04);
    margin-bottom: 0.5rem;
}
#linesTable #linesTableBody td.col-product {
    background: #f8fafc;
    border-radius: 10px;
    padding: 0.6rem;
}

/* --- Mobile Optimization (Smart Cards V4.0 - Corrected Alignment) --- */
@media (max-width: 768px) {
    /* 1. إعدادات الحاوية العامة (تم تقليص الهوامش الجانبية لتكبير البطاقة، والاعتماد على Padding) */
    .container-fluid, .container, .row, .col-12, #appContainer {
        padding-left: 5px !important;
        padding-right: 5px !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
    }
    .row { margin: 0 !important; }
    main.flex-grow-1 { padding-top: 5px !important; padding-bottom: 80px !important; overflow-x: hidden !important; }

    /* إلغاء التمرير الأفقي الإجباري الذي يفرضه بوتستراب على الجداول */
    .table-responsive {
        overflow-x: visible !important; 
        width: 100% !important;
    }

    /* 2. تحويل الجداول إلى بطاقات */
    .table-responsive table, .table-responsive tbody, .table-responsive tr, .table-responsive td {
        display: block; width: 100%; box-sizing: border-box !important;
    }
    .table-responsive thead { display: none; }
    
    .table-responsive tr {
        background: #fff; 
        margin-bottom: 8px !important; 
        border: 1px solid #e2e8f0;
        border-radius: 10px; 
        box-shadow: 0 2px 5px rgba(0,0,0,0.03);
        padding: 10px 12px; 
        position: relative;
        /* تم إزالة الهوامش الجانبية تماماً لمنع عرض 100% + مسافة من اختراق الشاشة */
        margin-left: 0 !important; 
        margin-right: 0 !important;
        width: 100% !important;
    }

    /* التنسيق الافتراضي للخلايا */
    .table-responsive td {
        display: flex; justify-content: space-between; align-items: center;
        text-align: left; 
        padding: 5px 0; border-bottom: 1px dashed #f1f5f9; font-size: 0.9rem;
    }
    .table-responsive td:last-child { border-bottom: none; }


    /* --- 3. إصلاح تذاكر الصيانة (Helpdesk Custom Card V6.0 - Final Alignment) --- */
    
    #ticketsTableBody tr { 
        padding-top: 75px !important; 
        padding-bottom: 45px !important; 
        padding-left: 10px !important;
        padding-right: 10px !important;
        position: relative;
    }

    /* 1. أيقونة النوع (أقصى اليسار) */
    #ticketsTableBody td:nth-child(2) { 
        position: absolute;
        top: 12px;
        left: 10px !important; 
        right: auto !important;
        font-size: 1.3rem;
        border: none; padding: 0; margin: 0;
        width: 30px; text-align: center;
        display: block !important;
    }

    /* 2. اسم العيادة */
    #ticketsTableBody td:nth-child(5) { 
        position: absolute;
        top: 10px;
        left: 45px !important; 
        width: calc(100% - 135px) !important; 
        text-align: left !important;
        font-weight: 800;
        font-size: 0.95rem;
        color: #1e293b;
        border: none; padding: 0; margin: 0;
        
        white-space: normal !important; 
        display: -webkit-box !important;
        -webkit-line-clamp: 2; 
        -webkit-box-orient: vertical;
        overflow: hidden; 
        line-height: 1.2;
    }
    #ticketsTableBody td:nth-child(5)::before { display: none !important; }

    /* 3. رقم التذكرة */
    #ticketsTableBody td:nth-child(1) { 
        position: absolute;
        top: 50px !important; 
        left: 45px !important; 
        right: auto !important;
        text-align: left !important;
        font-size: 0.75rem;
        color: #94a3b8;
        font-weight: 600;
        border: none; padding: 0; margin: 0;
        width: auto;
        display: block !important;
    }

    /* 4. الحالة / البادج (تصغير واختصار النص) */
    #ticketsTableBody td:nth-child(3) { 
        position: absolute;
        top: 10px;
        right: 10px !important; 
        left: auto !important;
        
        display: flex !important;
        justify-content: flex-end;
        width: auto !important;
        max-width: 80px !important; /* تحديد أقصى عرض للبادج */
        
        border: none; padding: 0; margin: 0;
        background: transparent !important;
        z-index: 10; 
    }
    
    #ticketsTableBody td:nth-child(3) .badge {
        display: inline-block;
        max-width: 100%; /* يجب أن لا يتجاوز حاويته */
        overflow: hidden; /* إخفاء ما يزيد */
        text-overflow: ellipsis; /* وضع نقاط بدل النص الزائد */
        white-space: nowrap; /* إجبار النص على سطر واحد */
        
        font-size: 0.7rem; 
        padding: 4px 6px;
    }

    /* 5. جسم البطاقة (الوصف) */
    #ticketsTableBody td:nth-child(4) { 
        width: 100%;
        border-top: 1px dashed #e2e8f0;
        padding-top: 10px;
        margin-top: 0; 
        display: block !important;
        text-align: left !important;
    }
    
    .mobile-comment-text {
        display: -webkit-box;
        -webkit-line-clamp: 2; 
        -webkit-box-orient: vertical;
        overflow: hidden;
        text-overflow: ellipsis;
        font-size: 0.9rem;
        line-height: 1.4;
        color: #334155;
    }

    /* 6. الفوتر (التاريخ المستهدف) */
    #ticketsTableBody td:nth-child(6) { 
        position: absolute;
        bottom: 0; left: 0; right: 0;
        background-color: #f8fafc;
        border-top: 1px solid #e2e8f0;
        border-radius: 0 0 10px 10px;
        padding: 8px 12px;
        font-size: 0.8rem;
        color: #334155;
        display: flex !important;
        align-items: center; justify-content: space-between;
        height: 38px;
    }

    #ticketsTableBody td:nth-child(7) { display: none; }

    /* --- 4. باقي الموديولات (Assets & Sales) --- */
    
    /* Assets */
    #assets_grid .col-12 { padding: 0 2px !important; }
    #assets_grid .card { flex-direction: row; min-height: 90px; margin-bottom: 5px; }
    #assets_grid .card-body { padding: 10px !important; text-align: left; } 
    #assets_grid .border-top { margin-top: 6px !important; padding-top: 6px !important; display: flex; justify-content: space-between; }

    /* Sales Lines */
    #linesTable tr { display: flex !important; flex-wrap: wrap !important; padding: 10px !important; gap: 5px; }
    #linesTable td.col-product { width: 100% !important; display: block !important; border-bottom: 1px solid #eee !important; margin-bottom: 5px !important; text-align: left !important; }
    #linesTable td.col-qty, #linesTable td.col-price, #linesTable td.col-disc { width: 32% !important; flex-direction: column !important; align-items: center !important; border:none !important; }
    #linesTable td.col-total { width: 100% !important; background: #f0f9ff !important; margin-top: 5px !important; border-radius: 5px; padding: 5px 10px !important; }

    /* Sales tabs: horizontal scroll instead of overlap */
    #orderTabs {
        width: max-content !important;
        min-width: 100%;
        flex-wrap: nowrap !important;
    }
    #orderTabs .nav-item {
        flex: 0 0 auto !important;
        min-width: max-content;
        margin-right: 0.35rem;
    }
    #orderTabs .nav-link {
        white-space: nowrap;
        padding: 0.5rem 0.9rem !important;
        font-size: 0.82rem;
    }

    /* Order modal: better mobile readability */
    #orderModal .modal-header {
        align-items: stretch !important;
        gap: 0.5rem;
        flex-wrap: wrap;
        padding-bottom: 0.5rem !important;
    }
    #orderModal .sales-order-modal-dialog .modal-content {
        border-radius: 0 !important;
        border: 0 !important;
        box-shadow: none !important;
    }
    #orderModal .sales-order-modal-dialog {
        width: 100vw !important;
        max-width: 100vw !important;
        height: 100dvh !important;
        margin: 0 !important;
        left: 0 !important;
        right: 0 !important;
        transform: none !important;
    }
    #orderModal .sales-order-modal-dialog .modal-content {
        min-height: 100dvh;
        width: 100vw;
    }
    #orderModal .sales-order-modal-dialog .modal-body {
        overflow-x: hidden;
        padding-bottom: 90px !important;
    }
    #orderModal .modal-header > .d-flex:first-child {
        width: 100%;
    }
    #orderModal #modalActionsToolbar {
        max-width: 100% !important;
        width: 100% !important;
        justify-content: flex-end !important;
        overflow-x: auto;
        white-space: nowrap;
        padding-top: 0.3rem;
        border-top: 1px solid #e2e8f0;
        margin-left: auto;
    }
    #orderModal #modalActionsToolbar button,
    #orderModal #modalActionsToolbar span.badge {
        flex: 0 0 auto;
    }
    #orderModal .modal-body .container-lg {
        padding-left: 0.6rem !important;
        padding-right: 0.6rem !important;
    }
    #modalFooterEdit {
        position: fixed !important;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100%;
        z-index: 1085 !important;
        border-top: 1px solid #e2e8f0 !important;
        box-shadow: 0 -6px 18px rgba(15, 23, 42, 0.12);
        background: rgba(255,255,255,0.97) !important;
        backdrop-filter: blur(8px);
    }
    #modalFooterEdit .btn {
        min-height: 42px;
    }
    /* Lines table clarity in mobile cards */
    #linesTable #linesTableBody tr {
        background: #fff;
        border: 1px solid #e2e8f0;
        border-radius: 12px;
        box-shadow: 0 2px 6px rgba(15, 23, 42, 0.04);
        margin-bottom: 0.6rem;
    }
    #linesTable td.col-product .prod-search-input,
    #linesTable td.col-product .fw-bold {
        font-size: 0.95rem !important;
    }
    #linesTable td.col-qty::before,
    #linesTable td.col-price::before,
    #linesTable td.col-disc::before {
        content: attr(data-label);
        font-size: 0.68rem;
        color: #64748b;
        margin-bottom: 0.2rem;
        font-weight: 700;
        text-transform: uppercase;
    }
    #linesTable td.col-total {
        display: flex !important;
        justify-content: space-between;
        align-items: center;
    }
    #linesTable td.col-total::before {
        content: attr(data-label);
        font-size: 0.72rem;
        color: #0f172a;
        font-weight: 800;
        text-transform: uppercase;
    }
    #linesTable td.col-action {
        width: 100% !important;
        border: none !important;
        margin-top: 0.15rem;
    }
    #linesTable td.col-action .btn {
        border-radius: 10px !important;
    }
}/* --- New Landing Page Sections --- */
.features-section {
    padding: 5rem 0;
}

.feature-card {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
}

.feature-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
}

.feature-icon {
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.how-it-works-section {
    padding: 5rem 0;
}

.step-card {
    background: white;
    border-radius: 15px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.08);
    transition: transform 0.3s ease;
}

.step-card:hover {
    transform: translateY(-3px);
}

.step-number {
    display: flex;
    justify-content: center;
}

.testimonials-section {
    padding: 5rem 0;
}

.testimonial-card {
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.testimonial-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
}

.cta-section {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--accent-color) 100%);
    padding: 5rem 0;
}

/* Mobile responsiveness for new sections */
@media (max-width: 768px) {
    .features-section,
    .how-it-works-section,
    .testimonials-section,
    .cta-section {
        padding: 3rem 1rem;
    }

    .display-5 {
        font-size: 2rem;
    }

    .feature-card,
    .step-card,
    .testimonial-card {
        margin-bottom: 1rem;
    }
}

/* Footer Styles */
.footer {
    margin-top: 5rem;
}

.footer a:hover {
    color: var(--accent-color) !important;
}

/* =========================================
   ProfitLens SaaS Homepage Redesign
   ========================================= */
.pl-hero {
    background:
        radial-gradient(circle at 80% 20%, rgba(59, 130, 246, 0.22) 0, transparent 32%),
        linear-gradient(135deg, #0f172a 0%, #111827 55%, #1e293b 100%);
    color: #ffffff;
    padding: 120px 0 96px;
    position: relative;
    overflow: hidden;
}

.pl-hero::after {
    content: '';
    position: absolute;
    inset: auto -10% -30% -10%;
    height: 260px;
    background: rgba(255, 255, 255, 0.05);
    filter: blur(60px);
    pointer-events: none;
}

.pl-eyebrow,
.pl-kicker {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    color: #60a5fa;
    font-size: 0.76rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.pl-hero-title {
    font-size: clamp(2.6rem, 6vw, 4.7rem);
    line-height: 0.95;
    letter-spacing: -0.07em;
    font-weight: 850;
}

.pl-hero-copy {
    color: rgba(255, 255, 255, 0.72);
    font-size: 1.08rem;
    line-height: 1.8;
    max-width: 670px;
}

.pl-hero-note {
    display: flex;
    flex-wrap: wrap;
    gap: 0.8rem;
    color: rgba(255, 255, 255, 0.72);
    font-size: 0.82rem;
    font-weight: 700;
}

.pl-hero-note span {
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 999px;
    padding: 0.45rem 0.75rem;
}

.pl-command-card {
    background: rgba(255, 255, 255, 0.96);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 28px;
    padding: 1.2rem;
    box-shadow: 0 28px 70px rgba(2, 6, 23, 0.38);
}

.pl-command-top {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: flex-start;
    padding: 0.65rem 0.65rem 1rem;
}

.pl-metric-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.8rem;
    margin-bottom: 1rem;
}

.pl-metric {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 18px;
    padding: 1rem;
}

.pl-metric span,
.pl-metric small {
    display: block;
    font-size: 0.74rem;
    font-weight: 700;
}

.pl-metric span {
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.pl-metric strong {
    display: block;
    color: #0f172a;
    font-size: 1.35rem;
    margin: 0.3rem 0;
    letter-spacing: -0.03em;
}

.pl-workflow-list {
    border: 1px solid #e2e8f0;
    border-radius: 20px;
    overflow: hidden;
}

.pl-workflow-row {
    display: grid;
    grid-template-columns: 36px 1fr;
    gap: 0.8rem;
    padding: 1rem;
    background: #ffffff;
}

.pl-workflow-row + .pl-workflow-row {
    border-top: 1px solid #eef2f7;
}

.pl-workflow-row i {
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    background: #eff6ff;
}

.pl-workflow-row strong,
.pl-workflow-row span {
    display: block;
}

.pl-workflow-row strong {
    color: #0f172a;
    font-size: 0.9rem;
}

.pl-workflow-row span {
    color: #64748b;
    font-size: 0.8rem;
    margin-top: 0.2rem;
}

.pl-section {
    padding: 96px 0;
}

.pl-section-heading {
    max-width: 780px;
    margin: 0 auto 3rem;
    text-align: center;
}

.pl-section-heading h2 {
    color: #0f172a;
    font-weight: 850;
    letter-spacing: -0.045em;
    font-size: clamp(2rem, 4vw, 3.1rem);
    line-height: 1.05;
    margin: 0.8rem 0 1rem;
}

.pl-section-heading p {
    color: #64748b;
    font-size: 1.05rem;
    margin-bottom: 0;
}

.pl-module-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
}

.pl-module-card,
.pl-trust-card,
.pl-price-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 24px;
    padding: 1.4rem;
    transition: transform 0.22s ease, border-color 0.22s ease, box-shadow 0.22s ease;
}

.pl-module-card:hover,
.pl-trust-card:hover,
.pl-price-card:hover {
    transform: translateY(-4px);
    border-color: #bfdbfe;
    box-shadow: 0 18px 42px rgba(15, 23, 42, 0.08);
}

.pl-module-icon,
.pl-trust-card i {
    width: 46px;
    height: 46px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 16px;
    background: #eff6ff;
    color: #2563eb;
    font-size: 1.25rem;
    margin-bottom: 1rem;
}

.pl-module-card h5,
.pl-trust-card h5 {
    color: #0f172a;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.pl-module-card p,
.pl-trust-card p {
    color: #64748b;
    line-height: 1.7;
    margin-bottom: 1rem;
}

.pl-status {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 0.3rem 0.65rem;
    font-size: 0.7rem;
    font-weight: 800;
}

.pl-status.is-live {
    color: #047857;
    background: #ecfdf5;
    border: 1px solid #a7f3d0;
}

.pl-status.is-soon {
    color: #92400e;
    background: #fffbeb;
    border: 1px solid #fde68a;
}

.pl-flow-section,
.pl-security-section {
    background: #f8fafc;
    border-top: 1px solid #e2e8f0;
    border-bottom: 1px solid #e2e8f0;
}

.pl-flow-timeline {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 28px;
    padding: 0.7rem;
}

.pl-flow-step {
    display: grid;
    grid-template-columns: 52px 1fr;
    gap: 1rem;
    padding: 1.1rem;
    border-radius: 20px;
}

.pl-flow-step + .pl-flow-step {
    border-top: 1px solid #eef2f7;
}

.pl-flow-step span {
    width: 42px;
    height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #0f172a;
    color: #ffffff;
    border-radius: 50%;
    font-weight: 800;
}

.pl-flow-step h5 {
    color: #0f172a;
    font-weight: 800;
    margin-bottom: 0.35rem;
}

.pl-flow-step p {
    color: #64748b;
    margin-bottom: 0;
    line-height: 1.65;
}

.pl-security-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.8rem;
}

.pl-security-grid div {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 18px;
    padding: 1rem;
    color: #0f172a;
    font-weight: 750;
}

.pl-security-grid i {
    color: #2563eb;
    font-size: 1.15rem;
}

.pl-pricing-panel {
    display: grid;
    grid-template-columns: 1fr 340px;
    gap: 2rem;
    align-items: center;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 32px;
    padding: 2rem;
}

.pl-price {
    color: #0f172a;
    font-size: 3rem;
    font-weight: 850;
    letter-spacing: -0.06em;
    margin: 0.3rem 0 1rem;
}

.pl-price span {
    color: #64748b;
    font-size: 1rem;
    letter-spacing: 0;
    font-weight: 700;
}

.pl-final-cta {
    background: linear-gradient(135deg, #0f172a 0%, #1e40af 100%);
    color: #ffffff;
    padding: 88px 0;
}

.pl-footer {
    background: #0b1120;
    color: #ffffff;
    padding: 56px 0;
}

.pl-footer a {
    color: #94a3b8;
    text-decoration: none;
}

.pl-footer a:hover {
    color: #60a5fa;
}

@media (max-width: 991.98px) {
    .pl-hero {
        padding: 86px 0 72px;
    }
    .pl-hero-title {
        letter-spacing: -0.045em;
    }
    .pl-command-card {
        margin-top: 1rem;
    }
    .pl-module-grid,
    .pl-pricing-panel {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 767.98px) {
    .pl-section {
        padding: 64px 0;
    }
    .pl-metric-grid,
    .pl-security-grid {
        grid-template-columns: 1fr;
    }
    .pl-command-top {
        flex-direction: column;
    }
    .pl-flow-step {
        grid-template-columns: 44px 1fr;
        padding: 1rem 0.65rem;
    }
    .pl-pricing-panel {
        padding: 1.2rem;
        border-radius: 24px;
    }
}

/* =========================================
   CRM Clients Modal - Reps/Target polish
   ========================================= */
#clientFormModal .reps-table .team-row td {
    vertical-align: top;
    padding-top: 0.6rem;
    padding-bottom: 0.6rem;
}
#clientFormModal .reps-table .brand-tags-container {
    gap: 0.25rem;
}
#clientFormModal .reps-table .brand-tags-container .badge {
    font-size: 0.7rem;
    border: 1px solid #bfdbfe;
}
#clientFormModal #targetBrandTable td,
#clientFormModal #targetBrandTable th {
    vertical-align: middle;
}

@media (max-width: 768px) {
    #clientFormModal .reps-table,
    #clientFormModal .reps-table tbody,
    #clientFormModal .reps-table tr,
    #clientFormModal .reps-table td {
        display: block;
        width: 100%;
    }
    #clientFormModal .reps-table thead {
        display: none;
    }
    #clientFormModal .reps-table tr.team-row {
        border: 1px solid #e2e8f0;
        border-radius: 12px;
        padding: 0.6rem;
        margin-bottom: 0.65rem;
        background: #fff;
        box-shadow: 0 2px 6px rgba(15, 23, 42, 0.05);
    }
    #clientFormModal .reps-table tr.team-row td {
        border: none !important;
        padding: 0.3rem 0;
    }
    #clientFormModal .reps-table tr.team-row td:nth-child(1)::before { content: "Representative"; }
    #clientFormModal .reps-table tr.team-row td:nth-child(2)::before { content: "Role"; }
    #clientFormModal .reps-table tr.team-row td:nth-child(3)::before { content: "Allowed Brands"; }
    #clientFormModal .reps-table tr.team-row td:nth-child(4)::before { content: "Target"; }
    #clientFormModal .reps-table tr.team-row td:nth-child(5)::before { content: "Weight"; }
    #clientFormModal .reps-table tr.team-row td:nth-child(-n+5)::before {
        display: block;
        font-size: 0.68rem;
        color: #64748b;
        text-transform: uppercase;
        font-weight: 700;
        margin-bottom: 0.2rem;
        letter-spacing: 0.02em;
    }
    #clientFormModal .reps-table tr.team-row td:last-child {
        text-align: end;
        border-top: 1px dashed #e2e8f0;
        margin-top: 0.25rem;
        padding-top: 0.45rem;
    }
    #clientFormModal #targetBrandTable td:nth-child(2) {
        min-width: 120px;
    }
}

/* =========================================
   Purchase Orders Module
   ========================================= */
.po-module {
    padding: 1.15rem;
}

.po-hero {
    padding: 1.1rem;
    border: 1px solid #e2e8f0;
    border-radius: 22px;
    background:
        radial-gradient(circle at top left, rgba(59, 130, 246, 0.13), transparent 32%),
        linear-gradient(135deg, #ffffff, #f8fafc);
}

.po-eyebrow {
    display: inline-flex;
    align-items: center;
    color: #2563eb;
    background: rgba(37, 99, 235, 0.08);
    border: 1px solid rgba(37, 99, 235, 0.12);
    border-radius: 999px;
    padding: 0.35rem 0.7rem;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.po-primary-action {
    min-height: 42px;
    box-shadow: 0 12px 26px rgba(37, 99, 235, 0.22) !important;
}

.po-summary-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.85rem;
}

.po-summary-card {
    padding: 1rem;
    border: 1px solid #e2e8f0;
    border-radius: 18px;
    background: #ffffff;
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.05);
}

.po-summary-card span {
    display: block;
    color: #64748b;
    font-size: 0.72rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.po-summary-card strong {
    display: block;
    margin-top: 0.35rem;
    color: #0f172a;
    font-size: 1.15rem;
    line-height: 1.1;
}

.po-filter-card {
    background: linear-gradient(135deg, #ffffff, #f8fafc);
}

.po-filter-bar {
    display: grid;
    grid-template-columns: repeat(6, minmax(110px, 1fr));
    gap: 0.35rem;
}

.po-filter-btn {
    border: 0;
    border-radius: 999px;
    padding: 0.62rem 0.8rem;
    background: transparent;
    color: #64748b;
    font-size: 0.8rem;
    font-weight: 800;
    transition: all 0.18s ease;
}

.po-filter-btn:hover {
    background: #eef2ff;
    color: #1d4ed8;
}

.po-filter-btn.active {
    color: #ffffff;
    background: linear-gradient(135deg, #2563eb, #0ea5e9);
    box-shadow: 0 10px 20px rgba(37, 99, 235, 0.2);
}

.po-orders-table thead th {
    font-size: 0.7rem;
    letter-spacing: 0.04em;
    color: #64748b;
}

.po-row {
    transition: background 0.18s ease, transform 0.18s ease;
}

.po-row:hover {
    background: #f8fbff;
}

.po-number-link {
    border: 0;
    padding: 0;
    background: transparent;
    color: #2563eb;
    font-family: var(--bs-font-monospace);
    font-weight: 800;
}

.po-number-link:hover {
    color: #0f172a;
    text-decoration: underline;
}

.po-vendor-name {
    color: #0f172a;
    font-weight: 700;
}

.po-total-cell {
    color: #0f172a;
}

.po-status-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 88px;
    border-radius: 999px;
    padding: 0.32rem 0.72rem;
    font-size: 0.68rem;
    font-weight: 850;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

.po-status-pill.is-draft {
    color: #475569;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
}

.po-status-pill.is-approved {
    color: #1d4ed8;
    background: #dbeafe;
    border: 1px solid #bfdbfe;
}

.po-status-pill.is-receiving {
    color: #92400e;
    background: #fef3c7;
    border: 1px solid #fde68a;
}

.po-status-pill.is-complete {
    color: #047857;
    background: #d1fae5;
    border: 1px solid #a7f3d0;
}

.po-status-pill.is-cancelled {
    color: #b91c1c;
    background: #fee2e2;
    border: 1px solid #fecaca;
}

.po-view-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    border-radius: 999px;
    color: #334155;
    font-weight: 800;
}

.po-empty-state {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    gap: 0.3rem;
}

.po-empty-state i {
    color: #94a3b8;
    font-size: 2rem;
}

.po-empty-state strong {
    color: #334155;
}

.po-empty-state span {
    color: #64748b;
    font-size: 0.82rem;
}

.po-workspace-modal .modal-content {
    background: #f8fafc;
}

.po-workspace-modal .modal-header {
    color: #ffffff;
    border: 0;
    background:
        radial-gradient(circle at top left, rgba(56, 189, 248, 0.35), transparent 32%),
        linear-gradient(135deg, #0f172a, #1d4ed8);
    padding: 1.15rem 1.35rem;
}

.po-workspace-modal .modal-body {
    background:
        linear-gradient(180deg, rgba(239, 246, 255, 0.9), #f8fafc 190px);
}

.po-form-panel {
    padding: 1rem;
    border: 1px solid #dbeafe;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.92);
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.05);
}

.po-section-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
}

.po-section-heading h6 {
    color: #0f172a;
    font-weight: 850;
}

.po-section-kicker {
    display: inline-flex;
    margin-bottom: 0.25rem;
    color: #2563eb;
    font-size: 0.68rem;
    font-weight: 850;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.po-catalog-tools {
    padding: 1rem;
    border: 1px solid #e2e8f0;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.92);
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.05);
}

.po-check-card {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    min-height: 46px;
    margin: 0;
    padding: 0.65rem 0.8rem;
    border: 1px solid #dbe3ef;
    border-radius: 12px;
    background: #ffffff;
}

.po-check-card .form-check-input {
    margin-top: 0;
}

.po-smart-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 0.45rem;
}

.po-smart-actions .btn {
    font-weight: 800;
}

.po-workspace-modal .form-label {
    letter-spacing: 0.02em;
    text-transform: uppercase;
    font-size: 0.68rem;
}

.po-workspace-modal .form-control,
.po-workspace-modal .form-select {
    border-color: #dbe3ef;
    border-radius: 12px;
}

.po-lines-table-wrap {
    border: 1px solid #e2e8f0;
    border-radius: 18px;
    background: #ffffff;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.05);
    overflow: hidden;
}

.po-lines-table thead th {
    border-bottom: 1px solid #e2e8f0;
    color: #64748b;
    font-size: 0.68rem;
    letter-spacing: 0.04em;
}

.po-lines-table tbody td {
    border-color: #f1f5f9;
}

.po-lines-table .item-total {
    color: #0f172a;
}

.po-load-catalog-row td {
    background: #f8fafc;
}

@media (max-width: 768px) {
    .po-module {
        padding: 0.5rem !important;
    }

    .po-hero {
        flex-direction: column;
        padding: 1rem;
        border-radius: 18px;
    }

    .po-primary-action {
        width: 100%;
        justify-content: center;
    }

    .po-summary-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0.55rem;
    }

    .po-summary-card {
        padding: 0.8rem;
        border-radius: 15px;
    }

    .po-summary-card strong {
        font-size: 0.98rem;
    }

    .po-filter-bar {
        display: flex;
        overflow-x: auto;
        padding-bottom: 0.15rem;
        scroll-snap-type: x proximity;
    }

    .po-filter-btn {
        flex: 0 0 auto;
        min-width: 112px;
        scroll-snap-align: start;
    }

    .po-table-card {
        background: transparent;
        box-shadow: none !important;
        overflow: visible !important;
    }

    .po-table-card .table-responsive {
        overflow: visible !important;
    }

    .po-orders-table,
    .po-orders-table tbody,
    .po-orders-table tr,
    .po-orders-table td {
        display: block;
        width: 100%;
    }

    .po-orders-table thead {
        display: none;
    }

    .po-orders-table tr.po-row {
        position: relative;
        margin: 0 0 0.7rem !important;
        padding: 0.95rem;
        border: 1px solid #e2e8f0;
        border-radius: 18px;
        background: #ffffff;
        box-shadow: 0 8px 22px rgba(15, 23, 42, 0.06);
    }

    .po-orders-table td {
        display: flex !important;
        align-items: center;
        justify-content: space-between;
        gap: 0.75rem;
        border: 0 !important;
        padding: 0.34rem 0 !important;
        text-align: right !important;
        font-size: 0.82rem;
    }

    .po-orders-table td::before {
        content: attr(data-label);
        flex: 0 0 auto;
        color: #64748b;
        font-size: 0.68rem;
        font-weight: 850;
        letter-spacing: 0.04em;
        text-transform: uppercase;
    }

    .po-orders-table .po-number-cell {
        display: block !important;
        padding-bottom: 0.65rem !important;
        margin-bottom: 0.35rem;
        border-bottom: 1px dashed #e2e8f0 !important;
        text-align: left !important;
    }

    .po-orders-table .po-number-cell::before {
        display: block;
        margin-bottom: 0.2rem;
    }

    .po-number-link {
        font-size: 1rem;
    }

    .po-action-cell {
        justify-content: stretch !important;
        padding-top: 0.75rem !important;
    }

    .po-action-cell::before {
        display: none;
    }

    .po-view-btn {
        width: 100%;
        justify-content: center;
        padding: 0.55rem 1rem;
        background: #eff6ff;
        border-color: #bfdbfe !important;
        color: #1d4ed8;
    }

    .po-workspace-modal .modal-dialog {
        max-width: calc(100% - 0.75rem) !important;
        margin: 0.35rem auto;
    }

    .po-workspace-modal .modal-body {
        padding: 0.85rem !important;
    }

    .po-form-panel {
        padding: 0.85rem;
        border-radius: 16px;
    }

    .po-section-heading {
        display: block;
        padding: 0 0.1rem;
    }

    .po-catalog-tools {
        padding: 0.8rem;
        border-radius: 16px;
    }

    .po-check-card {
        min-height: auto;
    }

    .po-smart-actions {
        justify-content: stretch;
    }

    .po-smart-actions .btn {
        flex: 1 1 100%;
    }

    .po-lines-table-wrap {
        min-height: 0 !important;
        overflow: visible;
        border: 0;
        background: transparent;
        box-shadow: none;
    }

    .po-lines-table,
    .po-lines-table tbody,
    .po-lines-table tr,
    .po-lines-table td {
        display: block;
        width: 100%;
    }

    .po-lines-table thead {
        display: none;
    }

    .po-lines-table tbody tr {
        margin-bottom: 0.75rem;
        padding: 0.9rem;
        border: 1px solid #e2e8f0;
        border-radius: 18px;
        background: #ffffff;
        box-shadow: 0 8px 22px rgba(15, 23, 42, 0.06);
    }

    .po-lines-table tbody td {
        display: flex !important;
        align-items: center;
        justify-content: space-between;
        gap: 0.75rem;
        border: 0 !important;
        padding: 0.42rem 0 !important;
        text-align: right !important;
    }

    .po-lines-table tbody td[data-label]::before {
        content: attr(data-label);
        flex: 0 0 auto;
        color: #64748b;
        font-size: 0.68rem;
        font-weight: 850;
        letter-spacing: 0.04em;
        text-transform: uppercase;
    }

    .po-lines-table tbody td:not([data-label]) {
        display: block !important;
        text-align: center !important;
    }

    .po-lines-table tbody td[data-label="Product"] {
        display: block !important;
        padding-bottom: 0.75rem !important;
        margin-bottom: 0.35rem;
        border-bottom: 1px dashed #e2e8f0 !important;
        text-align: left !important;
    }

    .po-lines-table tbody td[data-label="Product"]::before {
        display: block;
        margin-bottom: 0.25rem;
    }

    .po-lines-table .form-control-sm {
        max-width: 150px;
        margin-left: auto;
    }

    .po-lines-table .item-total {
        font-size: 1rem;
    }

    .po-workspace-modal .modal-footer {
        gap: 0.65rem;
    }

    .po-workspace-modal .modal-footer,
    .po-workspace-modal .modal-footer > div {
        width: 100%;
    }

    .po-workspace-modal .modal-footer .btn {
        flex: 1 1 auto;
    }
}

/* =========================================
   Company Settings - Data Operations Hub
   ========================================= */
.company-settings-module {
    max-width: 1180px;
    margin: 0 auto;
}

.settings-hero {
    padding: 1.25rem;
    border: 1px solid #e2e8f0;
    border-radius: 24px;
    background:
        radial-gradient(circle at top left, rgba(14, 165, 233, 0.14), transparent 34%),
        linear-gradient(135deg, #ffffff, #f8fafc);
    box-shadow: 0 10px 26px rgba(15, 23, 42, 0.05);
}

.settings-eyebrow {
    display: inline-flex;
    align-items: center;
    border: 1px solid rgba(37, 99, 235, 0.14);
    border-radius: 999px;
    background: rgba(37, 99, 235, 0.08);
    color: #2563eb;
    padding: 0.35rem 0.75rem;
    font-size: 0.72rem;
    font-weight: 850;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.settings-tabs {
    gap: 0.45rem;
    padding: 0.4rem;
    border: 1px solid #e2e8f0;
    border-radius: 999px;
    background: #ffffff;
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.04);
    width: fit-content;
    max-width: 100%;
}

.settings-tabs .nav-link {
    border: 0;
    border-radius: 999px;
    color: #64748b;
    font-weight: 800;
    padding: 0.68rem 1rem;
}

.settings-tabs .nav-link.active {
    color: #ffffff;
    background: linear-gradient(135deg, #2563eb, #0ea5e9);
    box-shadow: 0 10px 22px rgba(37, 99, 235, 0.2);
}

.data-ops-grid {
    display: grid;
    gap: 1rem;
}

.data-ops-card {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
    padding: 1.2rem;
    border: 1px solid #e2e8f0;
    border-radius: 22px;
    background: #ffffff;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.05);
}

.data-ops-card-muted {
    background: linear-gradient(135deg, #f8fafc, #ffffff);
    border-style: dashed;
}

.data-ops-icon {
    width: 50px;
    height: 50px;
    border-radius: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 1.35rem;
}

@media (max-width: 768px) {
    .settings-tabs {
        width: 100%;
        border-radius: 18px;
    }

    .settings-tabs .nav-item,
    .settings-tabs .nav-link {
        flex: 1 1 auto;
        text-align: center;
    }

    .data-ops-card {
        flex-direction: column;
        border-radius: 18px;
        padding: 1rem;
    }

    .data-ops-card .btn {
        width: 100%;
        justify-content: center;
    }
}
