:root{
    --primary:#2563eb;
    --primary-dark:#1d4ed8;
    --navy:#0f172a;
    --navy-2:#111c33;
    --surface:#ffffff;
    --surface-soft:#f8fafc;
    --border:#e5e7eb;
    --text:#182033;
    --muted:#64748b;
    --success:#16a34a;
    --danger:#dc2626;
    --warning:#f59e0b;
    --radius:16px;
    --shadow:0 10px 30px rgba(15,23,42,.07);
}
*{box-sizing:border-box}
html,body{min-height:100%}
body{
    margin:0;
    background:#f1f5f9;
    color:var(--text);
    font-family:"Cairo",Tahoma,Arial,sans-serif;
    font-size:14px;
    line-height:1.75;
}
a{text-decoration:none}
button,input,select,textarea{font-family:inherit!important}

/* App shell */
.app-shell{min-height:100vh;display:flex;direction:rtl}
.app-sidebar{
    width:270px;position:fixed;right:0;top:0;bottom:0;z-index:1040;
    display:flex;flex-direction:column;background:linear-gradient(180deg,var(--navy) 0%,#0b1222 100%);
    color:#fff;border-left:1px solid rgba(255,255,255,.06);box-shadow:-8px 0 28px rgba(15,23,42,.16)
}
.sidebar-brand{height:82px;display:flex;align-items:center;gap:12px;padding:0 22px;border-bottom:1px solid rgba(255,255,255,.08)}
.brand-mark{width:44px;height:44px;display:grid;place-items:center;border-radius:14px;background:linear-gradient(135deg,#3b82f6,#1d4ed8);color:#fff;font-size:22px;box-shadow:0 8px 20px rgba(37,99,235,.35)}
.sidebar-brand strong{display:block;font-size:17px;font-weight:800}
.sidebar-brand small{display:block;color:#94a3b8;font-size:11px;margin-top:-2px}
.sidebar-nav{padding:18px 14px;overflow-y:auto;flex:1}
.nav-section{color:#64748b;font-size:11px;font-weight:700;padding:15px 13px 7px;letter-spacing:.04em}
.sidebar-nav .nav-item{height:46px;padding:0 13px;margin:4px 0;border-radius:12px;display:flex;align-items:center;gap:12px;color:#cbd5e1;font-weight:600;transition:.18s ease}
.sidebar-nav .nav-item i{font-size:17px;width:20px;text-align:center}
.sidebar-nav .nav-item:hover{background:rgba(255,255,255,.07);color:#fff;transform:translateX(-2px)}
.sidebar-nav .nav-item.active{background:linear-gradient(135deg,#2563eb,#1d4ed8);color:#fff;box-shadow:0 7px 18px rgba(37,99,235,.27)}
.sidebar-user{display:flex;align-items:center;gap:10px;padding:15px;border-top:1px solid rgba(255,255,255,.08);background:rgba(0,0,0,.10)}
.user-avatar{width:39px;height:39px;border-radius:12px;background:#334155;display:grid;place-items:center;font-size:16px;font-weight:800}
.user-meta{min-width:0;flex:1}.user-meta strong,.user-meta small{display:block;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.user-meta strong{font-size:13px}.user-meta small{font-size:11px;color:#94a3b8}
.logout-btn{width:36px;height:36px;border:0;border-radius:10px;background:rgba(239,68,68,.13);color:#fca5a5;font-size:17px}.logout-btn:hover{background:#dc2626;color:#fff}
.app-main{width:calc(100% - 270px);margin-right:270px;min-height:100vh}
.app-topbar{height:82px;position:sticky;top:0;z-index:1020;display:flex;align-items:center;gap:16px;padding:0 28px;background:rgba(255,255,255,.94);backdrop-filter:blur(14px);border-bottom:1px solid var(--border)}
.page-heading{flex:1}.page-heading h1{font-size:20px;font-weight:800;margin:0;color:var(--navy)}.page-heading span{font-size:11px;color:var(--muted)}
.sidebar-toggle{display:none;width:42px;height:42px;border:1px solid var(--border);border-radius:12px;background:#fff;font-size:22px}
.quick-add{height:42px;padding:0 16px;display:flex;align-items:center;gap:8px;border-radius:12px;background:var(--primary);color:#fff;font-weight:700;box-shadow:0 7px 17px rgba(37,99,235,.25)}.quick-add:hover{background:var(--primary-dark);color:#fff}
.app-content{padding:24px 28px 40px;max-width:1800px;margin:auto}
.sidebar-backdrop{display:none}

/* Auth */
.auth-shell{min-height:100vh;display:grid;grid-template-columns:minmax(320px,430px) minmax(0,1fr);direction:rtl;background:linear-gradient(135deg,#0f172a 0%,#18233a 48%,#eff6ff 48%,#f8fafc 100%)}
.auth-brand{padding:70px 55px;color:#fff;display:flex;align-items:flex-start;gap:16px}.auth-brand .brand-mark{width:58px;height:58px;font-size:27px}.auth-brand h1{font-weight:800;font-size:28px;margin:3px 0}.auth-brand p{color:#cbd5e1;margin:0}
.auth-content{display:flex;align-items:center;justify-content:center;padding:32px}
.auth-content .row{width:100%;justify-content-center!important}.auth-content .col-md-5,.auth-content .col-lg-4{width:min(100%,460px)!important}
.auth-content .card{box-shadow:0 28px 70px rgba(15,23,42,.14)!important;border:1px solid rgba(226,232,240,.9)}
.auth-content .card-body{padding:34px}.auth-content h3{font-weight:800;color:var(--navy);margin-bottom:24px!important}

/* Common components */
.card{border:1px solid var(--border)!important;border-radius:var(--radius)!important;background:var(--surface);box-shadow:var(--shadow)}
.card-body{padding:20px}
h2,h3,h4,h5{color:var(--navy);font-weight:800}
h2{font-size:22px;margin-bottom:18px}
.form-label{font-weight:700;color:#334155;font-size:13px;margin-bottom:6px}
.form-control,.form-select{min-height:44px;border:1px solid #dbe2ea;border-radius:11px;background:#fff;padding:.6rem .85rem;color:#1e293b;box-shadow:none!important}
textarea.form-control{min-height:105px}
.form-control:focus,.form-select:focus{border-color:#60a5fa;box-shadow:0 0 0 4px rgba(59,130,246,.11)!important}
.btn{border-radius:10px;font-weight:700;padding:.55rem .95rem;display:inline-flex;align-items:center;justify-content:center;gap:6px}
.btn-primary{background:var(--primary);border-color:var(--primary)}.btn-primary:hover{background:var(--primary-dark);border-color:var(--primary-dark)}
.btn-dark{background:var(--navy);border-color:var(--navy)}
.btn-secondary{background:#64748b;border-color:#64748b}
.btn-sm{border-radius:9px;padding:.4rem .68rem}
.alert{border-radius:12px}.app-alert{box-shadow:0 8px 18px rgba(15,23,42,.06);border:0}

/* Tables */
.table-responsive{background:#fff;border:1px solid var(--border);border-radius:15px;box-shadow:var(--shadow);overflow:hidden}
.table{margin:0;vertical-align:middle}.table>:not(caption)>*>*{padding:.83rem .85rem;border-bottom-color:#edf0f4}
.table thead th{background:#f8fafc;color:#475569;font-size:12px;font-weight:800;white-space:nowrap;border-bottom:1px solid var(--border)}
.table tbody tr{transition:.15s}.table tbody tr:hover{background:#f8fbff}.table-striped>tbody>tr:nth-of-type(odd)>*{--bs-table-accent-bg:#fbfdff}

/* Dashboard/stat cards */
.row.g-2.mb-3 .card.text-center{min-height:94px;overflow:hidden;position:relative;box-shadow:0 8px 24px rgba(15,23,42,.06)}
.row.g-2.mb-3 .card.text-center:before{content:"";position:absolute;right:0;top:0;bottom:0;width:4px;background:var(--primary)}
.row.g-2.mb-3 .card.text-center .small{font-size:12px;color:var(--muted);font-weight:700}
.row.g-2.mb-3 .card.text-center strong{display:block;font-size:24px;line-height:1.2;color:var(--navy);margin-top:5px}
.badge{font-size:.78rem;padding:.45rem .65rem;border-radius:9px;font-weight:700}
.status-new{background:#64748b}.status-in_progress{background:#2563eb}.status-done{background:#16a34a}.status-hold{background:#dc2626}.status-needs_revision{background:#f97316}
.note-box{background:#f8fafc;border:1px solid var(--border);border-radius:12px;padding:14px;margin-bottom:10px}
.history-item{border-right:4px solid var(--primary);padding:10px 14px;margin-bottom:10px;background:#f8fafc;border-radius:10px}

/* Automatically enrich common action links/buttons */
a[href="/jobs/new"]:not(.nav-item):not(.quick-add):before{content:"\F4FE";font-family:"bootstrap-icons"}
a[href^="/jobs/"][class*="outline-primary"]:before{content:"\F341";font-family:"bootstrap-icons"}
button.btn-primary:not(.btn-close):before{content:"\F52E";font-family:"bootstrap-icons"}
button.btn-dark:before{content:"\F52A";font-family:"bootstrap-icons"}

@media (max-width:991.98px){
    .app-sidebar{transform:translateX(105%);transition:.24s ease;width:275px}
    .sidebar-open .app-sidebar{transform:translateX(0)}
    .sidebar-backdrop{position:fixed;inset:0;background:rgba(2,6,23,.55);z-index:1035}
    .sidebar-open .sidebar-backdrop{display:block}
    .app-main{width:100%;margin-right:0}.sidebar-toggle{display:grid;place-items:center}.app-topbar{height:70px;padding:0 15px}.app-content{padding:17px 14px 30px}.page-heading h1{font-size:17px}.quick-add span{display:none}.quick-add{width:42px;padding:0;justify-content:center}
    .auth-shell{display:flex;flex-direction:column;background:linear-gradient(180deg,#0f172a 0 240px,#f1f5f9 240px)}.auth-brand{padding:34px 24px 52px}.auth-content{padding:0 14px 30px;margin-top:-42px}.auth-content .card-body{padding:25px}
}
@media (max-width:575.98px){
    body{font-size:13px}.app-content{padding:14px 10px 25px}.card-body{padding:15px}.table>:not(caption)>*>*{padding:.7rem .65rem}.row.g-2.mb-3 .col-6{width:50%}.btn{font-size:12px}.form-control,.form-select{font-size:13px}
}

/* ===== إصلاحات لوحة الأعمال ===== */
.jobs-table th{white-space:nowrap;font-size:.86rem;color:#475569;background:#f8fafc}
.jobs-table td{vertical-align:middle}
.quick-update-form{margin:0;min-width:145px}
.status-select,.priority-select{font-weight:700;border-radius:10px;border-width:1px}
.status-badge,.priority-badge{display:inline-flex;align-items:center;justify-content:center;min-width:105px;padding:.45rem .65rem;border-radius:999px;font-weight:700;font-size:.82rem}
.status-new{background:#e2e8f0!important;color:#334155!important;border-color:#cbd5e1!important}
.status-in_progress{background:#dbeafe!important;color:#1d4ed8!important;border-color:#93c5fd!important}
.status-ready_cut{background:#ede9fe!important;color:#6d28d9!important;border-color:#c4b5fd!important}
.status-ready_print{background:#cffafe!important;color:#0e7490!important;border-color:#67e8f9!important}
.status-installation{background:#fef3c7!important;color:#a16207!important;border-color:#fcd34d!important}
.status-fiber_engraving{background:#fae8ff!important;color:#a21caf!important;border-color:#e879f9!important}
.status-needs_revision{background:#ffedd5!important;color:#c2410c!important;border-color:#fdba74!important}
.status-note{background:#f1f5f9!important;color:#475569!important;border-color:#cbd5e1!important}
.status-hold{background:#fee2e2!important;color:#b91c1c!important;border-color:#fca5a5!important}
.status-done{background:#dcfce7!important;color:#15803d!important;border-color:#86efac!important}
.status-waiting_confirmation{background:#fef9c3!important;color:#854d0e!important;border-color:#fde047!important}
.status-delivered{background:#d1fae5!important;color:#047857!important;border-color:#6ee7b7!important}
.priority-low{background:#f1f5f9!important;color:#64748b!important;border-color:#cbd5e1!important}
.priority-normal{background:#e0f2fe!important;color:#0369a1!important;border-color:#7dd3fc!important}
.priority-high{background:#ffedd5!important;color:#c2410c!important;border-color:#fdba74!important}
.priority-urgent{background:#fee2e2!important;color:#b91c1c!important;border-color:#fca5a5!important}
.due-date{white-space:nowrap;font-weight:600;color:#475569}
.due-date.is-overdue{color:#b91c1c;background:#fee2e2;padding:.3rem .5rem;border-radius:8px}
@media(max-width:768px){.quick-update-form{min-width:125px}.jobs-table{font-size:.86rem}}

/* ===== لوحة الأعمال: إزالة التكرار وتوافق الجوال ===== */
.dashboard-stats{margin-top:0}
.dashboard-filters{align-items:stretch}
.dashboard-filters .form-control,
.dashboard-filters .form-select,
.dashboard-filters .btn{height:46px}
.jobs-table-wrap{width:100%;overflow-x:auto;-webkit-overflow-scrolling:touch}
.jobs-table{min-width:1180px}
.jobs-table td:last-child,.jobs-table th:last-child{position:sticky;left:0;background:#fff;z-index:2;box-shadow:8px 0 16px rgba(15,23,42,.05)}
.jobs-table thead th:last-child{background:#f8fafc;z-index:3}

@media (max-width:991.98px){
    .app-topbar{box-shadow:0 5px 18px rgba(15,23,42,.06)}
    .dashboard-stats{--bs-gutter-x:.65rem;--bs-gutter-y:.65rem}
    .dashboard-stats .card.text-center{min-height:86px}
    .dashboard-filters{--bs-gutter-x:.65rem;--bs-gutter-y:.65rem}
    .dashboard-filters>div{width:100%;max-width:100%;flex:0 0 100%}
    .dashboard-filters>div:last-child{width:100%;flex:0 0 100%}
    .dashboard-filters>div:last-child .btn{width:100%!important}
    .jobs-table-wrap{border-radius:13px}
}

@media (max-width:575.98px){
    .app-topbar{height:64px;padding:0 10px;gap:9px}
    .page-heading{min-width:0}
    .page-heading h1{font-size:16px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
    .page-heading span{font-size:10px}
    .sidebar-toggle,.quick-add{width:40px;height:40px;min-width:40px;border-radius:11px}
    .app-content{padding:12px 9px 24px}
    .dashboard-stats .col-6{width:50%!important;flex:0 0 50%!important}
    .dashboard-stats .card.text-center{min-height:80px;border-radius:13px!important}
    .dashboard-stats .card-body{padding:12px 8px}
    .dashboard-stats .card.text-center .small{font-size:11px;line-height:1.35}
    .dashboard-stats .card.text-center strong{font-size:20px;margin-top:4px}
    .dashboard-filters{margin-bottom:12px!important}
    .dashboard-filters .form-control,.dashboard-filters .form-select,.dashboard-filters .btn{height:44px;min-height:44px;font-size:12px}
    .jobs-table{min-width:1060px;font-size:12px}
    .jobs-table th,.jobs-table td{padding:.65rem .55rem!important}
    .quick-update-form{min-width:118px}
    .status-select,.priority-select{font-size:11px;padding:.35rem 1.85rem .35rem .5rem;min-height:38px}
}

/* ===== بطاقات الحالات الملوّنة: 3 بطاقات في صف الجوال ===== */
.dashboard-stats .status-card-col{
    display:flex;
}
.dashboard-stats .status-summary{
    width:100%;
    min-height:96px;
    position:relative;
    overflow:hidden;
    border-width:1px!important;
    box-shadow:0 8px 22px rgba(15,23,42,.07)!important;
    transition:transform .18s ease,box-shadow .18s ease;
}
.dashboard-stats .status-summary::before{
    content:"";
    position:absolute;
    top:0;
    right:0;
    bottom:0;
    width:5px;
    background:currentColor;
    opacity:.72;
}
.dashboard-stats .status-summary:hover{
    transform:translateY(-2px);
    box-shadow:0 12px 28px rgba(15,23,42,.11)!important;
}
.dashboard-stats .status-summary .card-body{
    width:100%;
    min-height:94px;
    display:flex;
    flex-direction:column;
    align-items:center;
    justify-content:center;
    padding:14px 10px;
}
.dashboard-stats .status-summary .small{
    color:inherit!important;
    font-size:12px!important;
    font-weight:800!important;
    line-height:1.35;
    min-height:33px;
    display:flex;
    align-items:center;
    justify-content:center;
    text-align:center;
}
.dashboard-stats .status-summary strong{
    color:inherit!important;
    font-size:25px!important;
    font-weight:900;
    line-height:1;
    margin-top:6px!important;
}

@media (max-width:575.98px){
    .dashboard-stats{
        --bs-gutter-x:.48rem;
        --bs-gutter-y:.48rem;
    }
    .dashboard-stats .status-card-col{
        width:33.333333%!important;
        flex:0 0 33.333333%!important;
        max-width:33.333333%!important;
    }
    .dashboard-stats .status-summary{
        min-height:88px;
        border-radius:12px!important;
    }
    .dashboard-stats .status-summary::before{
        width:4px;
    }
    .dashboard-stats .status-summary .card-body{
        min-height:86px;
        padding:10px 5px;
    }
    .dashboard-stats .status-summary .small{
        font-size:10px!important;
        line-height:1.25;
        min-height:30px;
        word-break:normal;
        overflow-wrap:anywhere;
    }
    .dashboard-stats .status-summary strong{
        font-size:20px!important;
        margin-top:4px!important;
    }
}

@media (max-width:359.98px){
    .dashboard-stats{--bs-gutter-x:.35rem;--bs-gutter-y:.35rem}
    .dashboard-stats .status-summary .card-body{padding:9px 3px}
    .dashboard-stats .status-summary .small{font-size:9px!important}
    .dashboard-stats .status-summary strong{font-size:18px!important}
}

/* ===== شاشة النسخ الاحتياطي والصلاحيات ===== */
.backup-page{max-width:1450px;margin-inline:auto}
.backup-security-note{display:flex;align-items:center;gap:14px;padding:16px 18px;margin-bottom:18px;border:1px solid #bbf7d0;border-radius:16px;background:linear-gradient(135deg,#f0fdf4,#ecfeff);color:#14532d}
.backup-security-note>i{font-size:2rem;color:#16a34a}
.backup-security-note strong,.backup-security-note span{display:block}
.backup-security-note span{font-size:.88rem;margin-top:3px;color:#3f6212}
.backup-action-card{border:1px solid #e2e8f0;box-shadow:0 8px 24px rgba(15,23,42,.05)}
.backup-action-card .card-body{padding:22px}
.backup-action-card p{color:#64748b;margin-bottom:18px}
.backup-action-icon{width:50px;height:50px;display:grid;place-items:center;border-radius:14px;font-size:1.45rem;margin-bottom:14px}
.backup-action-icon.create{background:#dbeafe;color:#1d4ed8}
.backup-action-icon.restore{background:#fee2e2;color:#b91c1c}
.backup-table th{white-space:nowrap;font-size:.85rem;color:#475569}
.backup-table td{vertical-align:middle}
.backup-table td:first-child strong{font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:.78rem;direction:ltr;display:inline-block}
.backup-actions{display:flex;align-items:center;gap:6px;flex-wrap:wrap}
.backup-actions form{margin:0}
.permission-box{padding:14px;border:1px solid #dbeafe;border-radius:12px;background:#f8fbff}
.permission-box .form-check{margin-bottom:7px}
.permission-box .form-check:last-of-type{margin-bottom:8px}
.restore-form .form-control{min-height:44px}

@media (max-width:767.98px){
  .backup-security-note{align-items:flex-start;padding:14px}
  .backup-security-note>i{font-size:1.5rem}
  .backup-action-card .card-body{padding:16px}
  .backup-table{min-width:760px}
  .backup-actions .btn span{display:none}
  .backup-actions .btn{width:36px;height:34px;padding:0;display:inline-grid;place-items:center}
  .modal-dialog{margin:.75rem}
  .permission-box{padding:12px}
}

/* ===== Comprehensive Management Dashboard ===== */
.management-dashboard{max-width:1600px;margin-inline:auto}.management-filter{border:0;background:linear-gradient(135deg,#fff,#f8fafc)}.management-kpis{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:14px}.management-kpi{position:relative;display:flex;align-items:center;gap:14px;min-height:112px;padding:18px;border:1px solid #e2e8f0;border-radius:18px;background:#fff;box-shadow:0 8px 24px rgba(15,23,42,.055);overflow:hidden}.management-kpi:after{content:"";position:absolute;inset-inline-end:-25px;bottom:-38px;width:100px;height:100px;border-radius:50%;background:currentColor;opacity:.07}.management-kpi .kpi-icon{width:48px;height:48px;border-radius:15px;display:grid;place-items:center;font-size:1.35rem;background:color-mix(in srgb,currentColor 12%,white);flex:0 0 auto}.management-kpi span{display:block;color:#64748b;font-size:.83rem;font-weight:700}.management-kpi strong{display:block;margin-top:3px;color:#0f172a;font-size:1.75rem;line-height:1}.kpi-primary{color:#2563eb}.kpi-info{color:#0891b2}.kpi-success{color:#16a34a}.kpi-danger{color:#dc2626}.kpi-warning{color:#d97706}.kpi-urgent{color:#e11d48}.kpi-secondary{color:#64748b}.kpi-purple{color:#7c3aed}.management-dashboard .card{border:1px solid #e5e7eb;border-radius:18px;box-shadow:0 8px 28px rgba(15,23,42,.045)}.section-title{display:flex;align-items:flex-start;justify-content:space-between;gap:12px;margin-bottom:20px}.section-title h4{font-size:1.03rem;font-weight:800;margin:0 0 4px;color:#0f172a}.section-title p{margin:0;color:#64748b;font-size:.82rem}.section-title>i{font-size:1.35rem;color:#2563eb;background:#eff6ff;width:42px;height:42px;border-radius:13px;display:grid;place-items:center}.stats-bar-row{margin-bottom:15px}.stats-bar-head{display:flex;justify-content:space-between;align-items:center;margin-bottom:7px;font-size:.85rem}.stats-bar-head span{font-weight:700;color:#334155}.stats-bar-head strong{color:#0f172a}.stats-bar-track,.department-track{height:9px;background:#eef2f7;border-radius:99px;overflow:hidden}.stats-bar-track span,.department-track span{display:block;height:100%;border-radius:inherit;background:#2563eb}.stats-bar-track .status-new{background:#3b82f6}.stats-bar-track .status-design{background:#8b5cf6}.stats-bar-track .status-approved{background:#06b6d4}.stats-bar-track .status-production{background:#f59e0b}.stats-bar-track .status-printing{background:#0ea5e9}.stats-bar-track .status-cutting{background:#f97316}.stats-bar-track .status-installation{background:#6366f1}.stats-bar-track .status-hold{background:#ef4444}.stats-bar-track .status-done{background:#22c55e}.stats-bar-track .status-delivered{background:#15803d}.performance-ring{--progress:0;width:170px;height:170px;margin:6px auto 22px;border-radius:50%;display:grid;place-items:center;background:conic-gradient(#2563eb calc(var(--progress)*1%),#e8eef7 0);position:relative}.performance-ring:before{content:"";position:absolute;inset:15px;background:#fff;border-radius:50%}.performance-ring>div{position:relative;text-align:center}.performance-ring strong{display:block;font-size:2rem;color:#0f172a}.performance-ring span{font-size:.8rem;color:#64748b}.performance-list{display:grid;gap:10px}.performance-list>div{display:flex;justify-content:space-between;gap:15px;padding:11px 13px;background:#f8fafc;border-radius:12px;font-size:.83rem}.performance-list span{color:#64748b}.performance-list strong{color:#0f172a;text-align:left}.department-row{margin-bottom:17px}.department-row>div:first-child{display:flex;justify-content:space-between;margin-bottom:7px;font-size:.85rem}.department-row span{font-weight:700;color:#334155}.department-track span{background:linear-gradient(90deg,#2563eb,#06b6d4)}.management-table{margin-bottom:0;white-space:nowrap}.management-table thead th{font-size:.76rem;color:#64748b;background:#f8fafc;border-bottom:0}.management-table tbody td{font-size:.82rem}.mini-badge{display:inline-grid;place-items:center;min-width:30px;height:28px;border-radius:9px;font-weight:800}.mini-badge.info{background:#ecfeff;color:#0e7490}.mini-badge.success{background:#ecfdf5;color:#15803d}.mini-badge.danger{background:#fef2f2;color:#dc2626}.attention-card{border-color:#fee2e2!important}.attention-table td:first-child small{display:block;color:#64748b;margin-top:3px}.empty-stat{padding:30px;text-align:center;color:#94a3b8}
@media(max-width:1199.98px){.management-kpis{grid-template-columns:repeat(2,minmax(0,1fr))}}
@media(max-width:575.98px){.management-dashboard{margin-inline:-4px}.management-kpis{grid-template-columns:repeat(2,minmax(0,1fr));gap:9px}.management-kpi{min-height:96px;padding:12px 10px;gap:9px;border-radius:14px}.management-kpi .kpi-icon{width:38px;height:38px;border-radius:11px;font-size:1rem}.management-kpi span{font-size:.69rem}.management-kpi strong{font-size:1.3rem}.management-dashboard .card{border-radius:14px}.management-dashboard .card-body{padding:14px}.section-title h4{font-size:.94rem}.section-title p{font-size:.72rem}.section-title>i{width:36px;height:36px;font-size:1rem}.performance-ring{width:145px;height:145px}.performance-list>div{display:block}.performance-list strong{display:block;margin-top:4px;text-align:right}.management-filter .btn{min-height:45px}}

/* ===== مراحل الإنتاج ===== */
.workflow-page{max-width:1180px;margin:0 auto}.workflow-intro{border:0;background:linear-gradient(135deg,#eef2ff,#f8fafc)}.workflow-intro-icon{width:58px;height:58px;border-radius:18px;display:grid;place-items:center;background:#312e81;color:#fff;font-size:1.65rem;box-shadow:0 10px 25px rgba(49,46,129,.2)}.workflow-stage-list{display:grid;gap:.75rem}.workflow-stage-row{display:flex;align-items:center;gap:.85rem;padding:.85rem 1rem;border:1px solid #e2e8f0;border-radius:14px;background:#fff;transition:.2s}.workflow-stage-row:hover{border-color:#cbd5e1;box-shadow:0 8px 20px rgba(15,23,42,.06)}.workflow-stage-row.is-disabled{opacity:.58;background:#f8fafc}.workflow-stage-order{min-width:40px;height:40px;border-radius:12px;display:grid;place-items:center;background:#f1f5f9;font-weight:800;color:#475569}.workflow-stage-color{font-size:1.35rem;color:var(--stage-color)}.workflow-stage-info{min-width:170px;display:flex;flex-direction:column}.workflow-stage-info strong{font-size:.98rem}.workflow-stage-info small{color:#94a3b8;direction:ltr;text-align:right}.workflow-stage-edit{display:grid;grid-template-columns:minmax(170px,1fr) 52px 85px 42px;gap:.5rem;align-items:center;flex:1}.workflow-order-input{min-width:75px}.permission-group-title{margin:.85rem 0 .35rem;padding:.4rem .55rem;border-radius:8px;background:#f1f5f9;color:#334155;font-size:.84rem;font-weight:800}.workflow-job-card{border:1px solid #dbeafe;background:linear-gradient(180deg,#fff,#f8fbff)}.current-stage-pill{display:inline-flex;align-items:center;gap:.5rem;padding:.55rem .85rem;border-radius:999px;background:color-mix(in srgb,var(--stage-color) 12%,#fff);border:1px solid color-mix(in srgb,var(--stage-color) 35%,#fff);color:var(--stage-color);font-weight:800}.stage-change-form{display:grid;grid-template-columns:minmax(180px,1fr) minmax(220px,1.4fr) auto;gap:.6rem;flex:1;max-width:760px}.stage-history{border-top:1px dashed #cbd5e1;padding-top:1rem}.stage-history-item{display:flex;gap:.7rem;padding:.65rem 0;border-bottom:1px solid #eef2f7}.stage-history-item:last-child{border-bottom:0}.stage-history-item>i{color:#6366f1;margin-top:.15rem}.stage-history-item div{display:flex;flex-direction:column;gap:.15rem}.stage-history-item span,.stage-history-item small{font-size:.82rem;color:#64748b}
@media(max-width:767.98px){.workflow-intro .card-body{align-items:flex-start!important}.workflow-intro-icon{width:48px;height:48px;border-radius:14px;font-size:1.3rem}.workflow-stage-row{align-items:flex-start;flex-wrap:wrap;padding:.75rem}.workflow-stage-info{min-width:calc(100% - 110px);flex:1}.workflow-stage-edit{grid-template-columns:1fr 54px 70px 42px;width:100%}.stage-change-form{grid-template-columns:1fr;width:100%;max-width:none}.stage-change-form .btn{width:100%}.current-stage-pill{font-size:.88rem}.workflow-job-card .card-body>.d-flex{align-items:stretch!important}}
@media(max-width:420px){.workflow-stage-edit{grid-template-columns:1fr 52px}.workflow-stage-edit .workflow-order-input{grid-column:1/2}.workflow-stage-edit .btn{grid-column:2/3}.workflow-stage-row>form:not(.workflow-stage-edit){margin-right:auto}}

/* Workflow help guide */
.workflow-help-button{white-space:nowrap;font-weight:700;border-radius:12px;padding:.65rem 1rem}
.workflow-help-modal .modal-content{border:0;border-radius:18px;overflow:hidden}
.workflow-help-modal .modal-header{background:#f8fafc;border-bottom:1px solid #e2e8f0;padding:1.2rem 1.35rem}
.workflow-help-modal .modal-footer{background:#f8fafc;border-top:1px solid #e2e8f0}
.workflow-help-content{background:#fff;padding:1.35rem}
.workflow-help-section{border:1px solid #e5e7eb;border-radius:14px;padding:1.15rem 1.2rem;margin-bottom:1rem;background:#fff}
.workflow-help-section:last-child{margin-bottom:0}
.workflow-help-section h5{display:flex;align-items:center;gap:.65rem;font-weight:800;margin-bottom:.85rem;color:#0f172a}
.workflow-help-section h5>span{display:inline-grid;place-items:center;width:30px;height:30px;border-radius:9px;background:#e0e7ff;color:#3730a3;font-size:.9rem;flex:0 0 auto}
.workflow-help-section p,.workflow-help-section li{line-height:1.9;color:#334155}
.workflow-help-section ol,.workflow-help-section ul{margin-bottom:0;padding-right:1.25rem}
.workflow-help-flow{display:flex;flex-wrap:wrap;align-items:center;gap:.5rem;margin-top:.8rem}
.workflow-help-flow span{background:#f1f5f9;border:1px solid #cbd5e1;border-radius:999px;padding:.42rem .75rem;font-weight:700;color:#334155}
.workflow-help-flow i{color:#64748b}
.workflow-help-example{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:.8rem;margin-top:.8rem}
.workflow-help-example>div{background:#f8fafc;border:1px solid #e2e8f0;border-radius:12px;padding:1rem}
.workflow-help-example small{display:block;color:#64748b;margin-bottom:.25rem}
.workflow-help-example strong{font-size:1.08rem;color:#0f172a}
.workflow-help-note,.workflow-help-warning{display:flex;align-items:flex-start;gap:.7rem;border-radius:12px;padding:.9rem 1rem;margin:1rem 0 0!important}
.workflow-help-note{background:#eff6ff;color:#1e3a8a!important;border:1px solid #bfdbfe}
.workflow-help-warning{background:#fff7ed;border:1px solid #fed7aa;color:#9a3412}
.workflow-help-order{display:grid;grid-template-columns:auto 1fr;gap:.45rem .7rem;max-width:420px;margin-top:.8rem}
.workflow-help-order b{background:#0f172a;color:#fff;border-radius:8px;padding:.35rem .55rem;text-align:center}
.workflow-help-order span{background:#f8fafc;border:1px solid #e2e8f0;border-radius:8px;padding:.35rem .65rem}
.workflow-help-table th{background:#f8fafc;white-space:nowrap}
.workflow-help-timeline{display:grid;gap:.75rem}
.workflow-help-timeline>div{display:flex;align-items:flex-start;gap:.8rem}
.workflow-help-timeline b{display:grid;place-items:center;width:32px;height:32px;border-radius:50%;background:#2563eb;color:#fff;flex:0 0 auto}
.workflow-help-timeline span{display:block;border-right:3px solid #dbeafe;padding-right:.8rem;padding-bottom:.55rem}
.workflow-help-timeline strong,.workflow-help-timeline small{display:block}
.workflow-help-timeline small{color:#64748b;margin-top:.2rem}
@media (max-width:767.98px){
  .workflow-help-button{width:100%;justify-content:center}
  .workflow-help-modal .modal-content{border-radius:0}
  .workflow-help-modal .modal-header{padding:1rem}
  .workflow-help-content{padding:.8rem}
  .workflow-help-section{padding:1rem;border-radius:12px}
  .workflow-help-section h5{font-size:1rem;align-items:flex-start}
  .workflow-help-flow{gap:.4rem}
  .workflow-help-flow span{font-size:.82rem;padding:.35rem .55rem}
  .workflow-help-example{grid-template-columns:1fr}
  .workflow-help-table{min-width:620px}
}

/* ===== Notifications ===== */
.topbar-actions{display:flex;align-items:center;gap:10px}
.notification-bell{position:relative;width:42px;height:42px;border:1px solid #dbe3ec;border-radius:12px;background:#fff;color:#334155;display:inline-flex;align-items:center;justify-content:center;font-size:1.12rem;box-shadow:0 4px 14px rgba(15,23,42,.06)}
.notification-bell:hover{background:#f8fafc;color:#0f172a}
.notification-bell>span{position:absolute;top:-5px;left:-5px;min-width:20px;height:20px;padding:0 5px;border-radius:999px;background:#dc2626;color:#fff;border:2px solid #fff;font-size:.68rem;font-weight:800;line-height:16px;text-align:center}
.notification-menu{width:min(390px,calc(100vw - 24px));padding:0;border:0;border-radius:16px;overflow:hidden;box-shadow:0 18px 45px rgba(15,23,42,.18)}
.notification-menu-head{display:flex;align-items:center;justify-content:space-between;padding:14px 16px;border-bottom:1px solid #eef2f7;background:#fff}
.notification-menu-head a{font-size:.8rem;text-decoration:none;font-weight:700}
.notification-item{display:flex;gap:11px;padding:12px 14px;text-decoration:none;color:#1e293b;border-bottom:1px solid #f1f5f9;background:#fff}
.notification-item:hover{background:#f8fafc}.notification-item.unread{background:#eff6ff}
.notification-item>i{width:34px;height:34px;border-radius:10px;background:#e2e8f0;display:flex;align-items:center;justify-content:center;flex:0 0 34px;color:#334155}
.notification-item.unread>i{background:#dbeafe;color:#2563eb}
.notification-item div{min-width:0}.notification-item strong,.notification-item span,.notification-item small{display:block}
.notification-item strong{font-size:.84rem;margin-bottom:3px}.notification-item span{font-size:.76rem;color:#64748b;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.notification-item small{font-size:.67rem;color:#94a3b8;margin-top:4px}
.notification-empty{padding:28px 16px;text-align:center;color:#64748b}
.notifications-page{max-width:1000px;margin:auto}
.notification-page-item{position:relative;display:flex;align-items:center;gap:14px;padding:16px 18px;color:#1e293b;text-decoration:none;border-bottom:1px solid #eef2f7;background:#fff}
.notification-page-item:hover{background:#f8fafc}.notification-page-item.unread{background:#f0f7ff}
.notification-page-icon{width:44px;height:44px;border-radius:13px;display:flex;align-items:center;justify-content:center;background:#e2e8f0;color:#334155;flex:0 0 44px;font-size:1.1rem}
.notification-page-icon.type-danger{background:#fee2e2;color:#dc2626}.notification-page-icon.type-warning{background:#fef3c7;color:#d97706}.notification-page-icon.type-info{background:#dbeafe;color:#2563eb}
.notification-page-content{flex:1;min-width:0}.notification-page-content strong{font-size:.94rem}.notification-page-content small{font-size:.72rem;color:#94a3b8;white-space:nowrap}.notification-page-content p{margin:5px 0 0;color:#64748b;font-size:.86rem}
.notification-dot{width:9px;height:9px;border-radius:50%;background:#2563eb;flex:0 0 9px}
.notification-empty-page{text-align:center;padding:55px 20px;color:#64748b}.notification-empty-page i{font-size:2.3rem;display:block;margin-bottom:10px}
@media(max-width:767.98px){
  .notification-bell{width:38px;height:38px;border-radius:11px}
  .topbar-actions{gap:7px}
  .notification-page-item{padding:13px 12px;gap:10px;align-items:flex-start}
  .notification-page-icon{width:38px;height:38px;flex-basis:38px;border-radius:11px}
  .notification-page-content>div{display:block!important}.notification-page-content small{display:block;margin-top:3px}
  .notifications-page>.d-flex{align-items:stretch!important}.notifications-page>.d-flex>div:last-child{width:100%}.notifications-page>.d-flex form{flex:1}.notifications-page>.d-flex button{width:100%;font-size:.78rem}
}

/* سجل التدقيق والأمان */
.audit-page-head{display:flex;align-items:center;justify-content:space-between;gap:1rem;flex-wrap:wrap}.audit-page-head h2{font-weight:800}.audit-filters{border:0;box-shadow:0 10px 30px rgba(15,23,42,.06)}.audit-table-wrap{max-height:68vh}.audit-table thead th{position:sticky;top:0;z-index:2;background:#f8fafc;white-space:nowrap}.audit-table td{vertical-align:top;min-width:115px}.audit-table td small{display:block;color:#64748b;margin-top:.2rem;line-height:1.45}.audit-action{font-weight:700;color:#0f172a}.audit-details{max-width:300px;white-space:normal}.audit-values{display:grid;gap:.25rem;max-width:340px}.audit-values span{display:block;background:#f8fafc;border:1px solid #e2e8f0;border-radius:8px;padding:.35rem .5rem;white-space:normal;overflow-wrap:anywhere;font-size:.82rem}.audit-result{display:inline-flex;align-items:center;justify-content:center;border-radius:999px;padding:.3rem .65rem;font-weight:700;font-size:.78rem;white-space:nowrap}.audit-result-success{background:#dcfce7;color:#166534}.audit-result-failed{background:#fee2e2;color:#991b1b}.audit-result-denied{background:#fef3c7;color:#92400e}
@media(max-width:767.98px){.audit-page-head{align-items:stretch}.audit-page-head .btn{width:100%}.audit-filters .col-lg-1.d-grid{margin-top:.35rem}.audit-table-wrap{max-height:none}.audit-table{min-width:1050px}.audit-page-head h2{font-size:1.25rem}.audit-page-head p{font-size:.85rem}}


/* إدارة العملاء */
.customer-name-cell{display:flex;align-items:center;gap:.75rem}.customer-avatar{width:42px;height:42px;border-radius:14px;display:inline-flex;align-items:center;justify-content:center;background:#e8eefc;color:#1d4ed8;font-weight:800;flex:0 0 auto}.customer-avatar.large{width:64px;height:64px;border-radius:20px;font-size:1.5rem}.customer-name-cell div{display:flex;flex-direction:column}.customer-name-cell small{color:#64748b}.customer-profile-head{display:flex;align-items:center;justify-content:space-between;gap:1rem;flex-wrap:wrap;background:#fff;border:1px solid #e5e7eb;border-radius:18px;padding:1.25rem;margin-bottom:1rem}.customer-profile-main{display:flex;align-items:center;gap:1rem}.customer-profile-main h2{margin:0}.customer-profile-main p{margin:.25rem 0 0;color:#64748b}.customer-stat{height:100%;background:#fff;border:1px solid #e5e7eb;border-radius:16px;padding:1rem;display:flex;flex-direction:column;gap:.35rem}.customer-stat span{color:#64748b;font-size:.9rem}.customer-stat strong{font-size:1.6rem}.customer-stat.danger{border-color:#fecaca;background:#fff7f7}.customer-stat.danger strong{color:#dc2626}.customer-details{display:grid;grid-template-columns:110px 1fr;gap:.75rem 1rem;margin:1rem 0 0}.customer-details dt{color:#64748b;font-weight:600}.customer-details dd{margin:0;font-weight:600;overflow-wrap:anywhere}.customer-form-card{max-width:980px;margin-inline:auto}.customer-table th{white-space:nowrap}
@media(max-width:767.98px){.customer-profile-head{padding:1rem}.customer-profile-main{width:100%}.customer-avatar.large{width:52px;height:52px;border-radius:16px}.customer-profile-main h2{font-size:1.25rem}.customer-profile-head>.d-flex{width:100%}.customer-profile-head>.d-flex .btn{flex:1}.customer-details{grid-template-columns:90px 1fr}.customer-table{min-width:760px}.customers-page .d-flex.gap-2 .btn{white-space:nowrap}}

/* ===== نموذج إضافة/تعديل العمل الموحد ===== */
.job-form-page{max-width:1180px;margin:0 auto}.job-form-hero{display:flex;align-items:center;gap:16px;background:linear-gradient(135deg,#0f172a,#1e3a8a);color:#fff;border-radius:22px;padding:22px 24px;margin-bottom:20px;box-shadow:0 18px 42px rgba(15,23,42,.16)}.job-form-hero h2{margin:0 0 5px;font-size:1.55rem;font-weight:800}.job-form-hero p{margin:0;color:rgba(255,255,255,.78)}.page-hero-icon{width:56px;height:56px;border-radius:18px;display:grid;place-items:center;background:rgba(255,255,255,.14);font-size:1.5rem;flex:0 0 auto}.job-form-shell{display:grid;gap:18px}.form-section{background:#fff;border:1px solid #e6ebf2;border-radius:20px;padding:22px;box-shadow:0 10px 30px rgba(15,23,42,.055)}.form-section-head{display:flex;align-items:center;gap:13px;padding-bottom:16px;margin-bottom:18px;border-bottom:1px solid #eef2f7}.form-section-head>span{width:44px;height:44px;border-radius:14px;display:grid;place-items:center;background:#eef4ff;color:#2563eb;font-size:1.15rem}.form-section-head h4{font-size:1.03rem;font-weight:800;margin:0 0 3px;color:#172033}.form-section-head p{font-size:.86rem;color:#748094;margin:0}.job-form-page .form-label{font-weight:700;color:#344054;margin-bottom:7px}.job-form-page .form-control,.job-form-page .form-select{min-height:47px;border-radius:12px;border-color:#dce3ed;background-color:#fff}.job-form-page textarea.form-control{min-height:130px}.job-form-page .form-control:focus,.job-form-page .form-select:focus{border-color:#7aa7ff;box-shadow:0 0 0 4px rgba(37,99,235,.1)}.input-icon{position:relative}.input-icon>i{position:absolute;right:14px;top:50%;transform:translateY(-50%);z-index:2;color:#8190a5}.input-icon .form-control{padding-right:42px}.job-form-actions{display:flex;justify-content:flex-end;gap:10px;padding:5px 0 2px}.job-form-actions .btn{min-width:145px;min-height:47px;border-radius:12px;font-weight:700}

/* باحث العملاء */
.customer-picker{position:relative}.customer-picker-input-wrap{position:relative}.customer-picker-input-wrap>i{position:absolute;right:15px;top:50%;transform:translateY(-50%);z-index:3;color:#7b8798}.customer-picker-input-wrap .form-control{padding-right:43px;padding-left:46px}.customer-picker-clear{position:absolute;left:5px;top:5px;width:37px;height:37px;padding:0;border:0;border-radius:10px;color:#667085}.customer-picker-menu{display:none;position:absolute;z-index:1080;top:calc(100% + 7px);right:0;left:0;max-height:330px;overflow:auto;background:#fff;border:1px solid #dce3ed;border-radius:16px;box-shadow:0 24px 55px rgba(15,23,42,.18);padding:7px}.customer-picker.open .customer-picker-menu{display:block}.customer-picker.has-error .customer-picker-input-wrap .form-control{border-color:#dc3545;box-shadow:0 0 0 4px rgba(220,53,69,.09)}.customer-option{width:100%;display:flex;align-items:center;gap:11px;border:0;background:#fff;padding:10px 11px;border-radius:12px;text-align:right;color:#1f2937;transition:.16s}.customer-option:hover,.customer-option.selected{background:#eef4ff;color:#1d4ed8}.customer-option>span:nth-child(2){display:flex;min-width:0;flex:1;flex-direction:column}.customer-option strong{font-size:.93rem;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.customer-option small{font-size:.76rem;color:#7a8698;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.customer-option>i{opacity:0}.customer-option.selected>i{opacity:1}.customer-option-avatar{width:39px;height:39px;border-radius:12px;display:grid;place-items:center;background:#eaf0fb;color:#315fb0;font-weight:800;flex:0 0 auto}.customer-picker-empty{display:none;align-items:center;justify-content:center;gap:8px;padding:25px;color:#8491a3}.customer-picker-empty i{font-size:1.25rem}

/* نافذة إضافة عميل سريع */
.quick-customer-modal{border:0;border-radius:22px;overflow:hidden;box-shadow:0 30px 90px rgba(15,23,42,.25)}.quick-customer-modal .modal-header{background:linear-gradient(135deg,#0f172a,#1d4ed8);color:#fff;border:0;padding:19px 22px}.quick-customer-modal .modal-header small{color:rgba(255,255,255,.72)}.quick-customer-modal .btn-close{filter:invert(1);opacity:.85}.modal-title-icon{width:45px;height:45px;border-radius:14px;display:grid;place-items:center;background:rgba(255,255,255,.14);font-size:1.15rem}.quick-customer-modal .modal-body{padding:22px}.quick-customer-modal .modal-footer{padding:15px 22px;border-color:#eef1f5}.quick-customer-modal .form-label{font-weight:700}.quick-customer-modal .form-control{min-height:46px;border-radius:12px}

@media(max-width:767.98px){.job-form-page{margin:0 -2px}.job-form-hero{border-radius:17px;padding:17px 16px;align-items:flex-start}.job-form-hero h2{font-size:1.22rem}.job-form-hero p{font-size:.82rem;line-height:1.7}.page-hero-icon{width:46px;height:46px;border-radius:14px;font-size:1.15rem}.form-section{border-radius:16px;padding:16px}.form-section-head{align-items:flex-start;margin-bottom:15px;padding-bottom:13px}.form-section-head>span{width:39px;height:39px;border-radius:12px}.form-section-head h4{font-size:.97rem}.form-section-head p{font-size:.79rem;line-height:1.6}.job-form-actions{position:sticky;bottom:0;z-index:20;background:rgba(245,247,251,.94);backdrop-filter:blur(9px);margin:0 -4px;padding:11px 4px}.job-form-actions .btn{flex:1;min-width:0}.customer-picker-menu{position:fixed;top:auto;right:12px;left:12px;bottom:12px;max-height:55vh;border-radius:18px;z-index:1095}.quick-customer-modal{border-radius:0}.quick-customer-modal .modal-body{padding:17px}.quick-customer-modal .modal-header{padding:15px 17px}}


/* ===== إدارة مواد العمل ===== */
.material-source-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:14px}.material-source-card{position:relative;display:flex;flex-direction:column;align-items:center;text-align:center;gap:7px;padding:18px 14px;border:1px solid #dbe3ee;border-radius:16px;background:#fff;cursor:pointer;transition:.2s ease}.material-source-card:hover{transform:translateY(-2px);border-color:#9db3d1;box-shadow:0 10px 24px rgba(15,23,42,.07)}.material-source-card input{position:absolute;opacity:0;pointer-events:none}.material-source-card.active{border-color:#2563eb;background:#eff6ff;box-shadow:0 0 0 3px rgba(37,99,235,.10)}.material-source-icon{width:48px;height:48px;border-radius:14px;display:grid;place-items:center;background:#eef2ff;color:#3157a4;font-size:1.35rem}.material-source-card strong{font-size:1rem;color:#172033}.material-source-card small{color:#64748b;line-height:1.5}.material-source-check{position:absolute;top:11px;left:11px;color:#2563eb;opacity:0}.material-source-card.active .material-source-check{opacity:1}.material-requirement-panel{padding:16px;border:1px dashed #f59e0b;border-radius:14px;background:#fffaf0}.material-requirement-panel.client{border-color:#22c55e;background:#f0fdf4}.material-panel-title{display:flex;align-items:center;gap:12px;margin-bottom:14px}.material-panel-title>i{font-size:1.4rem;color:#d97706}.material-panel-title strong,.material-panel-title small{display:block}.material-panel-title small{color:#64748b;margin-top:2px}.material-summary-card{border:0;box-shadow:0 12px 30px rgba(15,23,42,.06)}.material-summary-title{display:flex;align-items:center;gap:13px}.material-summary-title>i{width:48px;height:48px;border-radius:14px;background:#eef2ff;color:#3157a4;display:grid;place-items:center;font-size:1.3rem}.material-summary-title h4{margin:0}.material-summary-title p{margin:3px 0 0;color:#64748b}.material-summary-badges{display:flex;gap:8px;flex-wrap:wrap}.material-info-box{height:100%;padding:13px 15px;border-radius:12px;background:#f8fafc;border:1px solid #edf1f6}.material-info-box small,.material-info-box strong{display:block}.material-info-box small{color:#64748b;margin-bottom:4px}.material-details-box{padding:14px;border-radius:12px;background:#f8fafc;border-right:4px solid #3157a4;line-height:1.8}
@media(max-width:767.98px){.material-source-grid{grid-template-columns:1fr}.material-source-card{align-items:flex-start;text-align:right;padding:15px 70px 15px 38px}.material-source-icon{position:absolute;right:13px;top:50%;transform:translateY(-50%)}.material-summary-badges{width:100%}.material-summary-badges .badge{flex:1;padding:10px}.material-requirement-panel{padding:13px}}
.audit-summary{display:flex;align-items:center;justify-content:space-between;gap:1rem;background:linear-gradient(135deg,#eff6ff,#f8fafc);border:1px solid #dbeafe;border-radius:14px;padding:.85rem 1rem;margin-top:1rem}.audit-summary span{display:flex;align-items:center;gap:.5rem;color:#334155}.audit-summary strong{font-size:1.05rem;color:#0f172a}.audit-entity{display:inline-flex;align-items:center;padding:.35rem .65rem;border-radius:999px;background:#eef2ff;color:#3730a3;font-weight:700;white-space:nowrap}.audit-change{display:grid;grid-template-columns:minmax(110px,auto) minmax(120px,1fr) auto minmax(120px,1fr);gap:.45rem;align-items:center;background:#fff;border:1px solid #e2e8f0;border-radius:10px;padding:.5rem .6rem}.audit-change b{color:#334155;font-size:.78rem}.audit-change .before,.audit-change .after{display:block;border-radius:7px;padding:.3rem .45rem;font-size:.8rem;line-height:1.45;overflow-wrap:anywhere}.audit-change .before{background:#fff7ed;color:#9a3412}.audit-change .after{background:#ecfdf5;color:#166534}.audit-change i{color:#64748b}.audit-no-change{display:inline-flex;background:#f8fafc;color:#64748b;border:1px dashed #cbd5e1;border-radius:8px;padding:.4rem .6rem;font-size:.8rem}
@media(max-width:767.98px){.audit-summary{align-items:flex-start;flex-direction:column}.audit-table{min-width:1250px}.audit-change{grid-template-columns:120px 180px 24px 180px}}

/* ===== المرحلة الخامسة: تجربة المستخدم والحالات النظامية ===== */
.empty-state{min-height:190px;display:flex;flex-direction:column;align-items:center;justify-content:center;text-align:center;gap:7px;padding:28px 16px;color:#64748b}
.empty-state-icon{width:58px;height:58px;display:grid;place-items:center;border-radius:18px;background:#eff6ff;color:#2563eb;font-size:26px;margin-bottom:4px}
.empty-state strong{font-size:16px;color:#334155}.empty-state span{font-size:13px;max-width:420px}
.system-state-page{min-height:58vh;display:grid;grid-template-columns:auto minmax(0,520px);align-items:center;justify-content:center;gap:28px;padding:45px 20px;text-align:right}
.system-state-icon{width:112px;height:112px;display:grid;place-items:center;border-radius:32px;background:linear-gradient(145deg,#eff6ff,#dbeafe);color:#2563eb;font-size:50px;box-shadow:0 18px 45px rgba(37,99,235,.14)}
.system-state-code{font-size:13px;font-weight:800;letter-spacing:3px;color:#94a3b8;margin-bottom:6px}.system-state-page h2{font-size:28px;margin-bottom:10px}.system-state-page p{color:#64748b;line-height:1.9;margin-bottom:22px}.system-state-actions{display:flex;flex-wrap:wrap;gap:10px}
form[data-submitting="1"]{opacity:.78;pointer-events:none}.btn:disabled{cursor:not-allowed}
.spinner-border-sm{width:1rem;height:1rem}
.app-alert{animation:alert-enter .22s ease both}@keyframes alert-enter{from{opacity:0;transform:translateY(-8px)}to{opacity:1;transform:none}}
.form-control:invalid:not(:placeholder-shown){border-color:#ef4444}.form-control:valid:not(:placeholder-shown){border-color:#22c55e}
.table td .empty-state{border:0;box-shadow:none;background:transparent}
@media(max-width:575.98px){.system-state-page{grid-template-columns:1fr;text-align:center;padding:30px 10px}.system-state-icon{margin:auto;width:88px;height:88px;border-radius:25px;font-size:40px}.system-state-page h2{font-size:22px}.system-state-actions{justify-content:center}.system-state-actions .btn{flex:1 1 140px}}

/* ===== تحسين صلاحيات المستخدمين ونموذج العمل ===== */
.permission-accordion-list{display:grid;gap:8px}
.permission-accordion{border:1px solid #dbe4f0;border-radius:11px;background:#fff;overflow:hidden}
.permission-accordion summary{display:flex;align-items:center;justify-content:space-between;gap:10px;padding:11px 13px;cursor:pointer;list-style:none;font-size:.9rem;font-weight:800;color:#334155;background:#f8fafc;user-select:none}
.permission-accordion summary::-webkit-details-marker{display:none}
.permission-accordion summary>span{display:flex;align-items:center;gap:8px}
.permission-accordion summary>span>i{color:#2563eb;font-size:1rem}
.permission-accordion[open] summary{background:#eef4ff;color:#1e40af;border-bottom:1px solid #dbe4f0}
.permission-chevron{font-size:.8rem;transition:transform .18s ease}
.permission-accordion[open] .permission-chevron{transform:rotate(180deg)}
.permission-accordion-body{padding:10px 13px 5px;display:grid;gap:2px}
.permission-accordion-body .form-check{padding:7px 29px 7px 7px;margin:0;border-radius:8px;transition:background .15s ease}
.permission-accordion-body .form-check:hover{background:#f8fafc}
.permission-accordion-body .form-check-label{font-size:.87rem;line-height:1.55;cursor:pointer}

.job-form-page{max-width:1080px}
.job-form-hero{gap:12px;border-radius:16px;padding:15px 18px;margin-bottom:14px;box-shadow:0 10px 26px rgba(15,23,42,.12)}
.job-form-hero h2{font-size:1.28rem;margin-bottom:2px}
.job-form-hero p{font-size:.82rem}
.job-form-hero .page-hero-icon{width:42px;height:42px;border-radius:12px;font-size:1.08rem}
.job-form-shell{gap:12px}
.job-form-page .form-section{border-radius:14px;padding:15px 17px;box-shadow:0 5px 18px rgba(15,23,42,.04)}
.job-form-page .form-section-head{gap:10px;padding-bottom:10px;margin-bottom:13px}
.job-form-page .form-section-head>span{width:34px;height:34px;border-radius:10px;font-size:.92rem}
.job-form-page .form-section-head h4{font-size:.94rem;margin-bottom:1px}
.job-form-page .form-section-head p{font-size:.76rem}
.job-form-page .form-label{font-size:.84rem;margin-bottom:5px}
.job-form-page .form-control,.job-form-page .form-select{min-height:41px;border-radius:10px;font-size:.9rem}
.job-form-page textarea.form-control{min-height:88px}
.job-form-page .row.g-3{--bs-gutter-x:.8rem;--bs-gutter-y:.75rem}
.job-form-page .material-source-grid{gap:9px}
.job-form-page .material-source-card{display:grid;grid-template-columns:36px 1fr;grid-template-rows:auto auto;column-gap:10px;align-items:center;text-align:right;padding:11px 12px;min-height:76px;border-radius:12px}
.job-form-page .material-source-icon{grid-row:1/3;width:36px;height:36px;border-radius:10px;font-size:1rem}
.job-form-page .material-source-card strong{font-size:.88rem;align-self:end}
.job-form-page .material-source-card small{font-size:.72rem;line-height:1.35;align-self:start}
.job-form-page .material-source-check{top:7px;left:7px;font-size:.85rem}
.job-form-page .material-requirement-panel{padding:12px;border-radius:11px}
.job-form-page .material-panel-title{gap:9px;margin-bottom:10px}
.job-form-page .material-panel-title>i{font-size:1.1rem}
.job-form-page .material-panel-title strong{font-size:.88rem}
.job-form-page .material-panel-title small{font-size:.74rem}
.job-form-page .customer-option-avatar{width:34px;height:34px;border-radius:10px}
.job-form-page .customer-option{padding:8px 9px}
.job-form-actions .btn{min-width:125px;min-height:42px;border-radius:10px;font-size:.9rem}

@media(max-width:767.98px){
  .permission-box{padding:10px}
  .permission-accordion summary{padding:10px 11px;font-size:.86rem}
  .permission-accordion-body{padding:8px 10px 4px}
  .job-form-page{margin:0;max-width:none}
  .job-form-hero{padding:12px 13px;border-radius:13px;margin-bottom:10px}
  .job-form-hero .page-hero-icon{width:36px;height:36px;border-radius:10px;font-size:.95rem}
  .job-form-hero h2{font-size:1.08rem}
  .job-form-hero p{font-size:.74rem;line-height:1.45}
  .job-form-page .form-section{padding:12px;border-radius:12px}
  .job-form-page .form-section-head{margin-bottom:11px;padding-bottom:9px}
  .job-form-page .form-section-head>span{width:31px;height:31px}
  .job-form-page .form-section-head p{display:none}
  .job-form-page .material-source-grid{grid-template-columns:1fr}
  .job-form-page .material-source-card{padding:10px 11px;min-height:68px}
  .job-form-actions{padding:8px 2px}
}

/* ===== التحسين البصري الشامل للنماذج والواجهات ===== */
:root{
    --ui-primary:#2563eb;
    --ui-primary-soft:#eff6ff;
    --ui-border:#dbe3ef;
    --ui-muted:#64748b;
    --ui-surface:#ffffff;
    --ui-shadow:0 10px 28px rgba(15,23,42,.07);
}

.app-content .card{
    border:1px solid rgba(219,227,239,.9);
    box-shadow:var(--ui-shadow);
    border-radius:16px;
    overflow:hidden;
}
.app-content .card-body{padding:1.25rem}
.app-content h2,.app-content h3,.app-content h4{font-weight:800;color:#172033}

.form-label{
    font-size:.88rem;
    font-weight:700;
    color:#334155;
    margin-bottom:.42rem;
}
.form-control,.form-select{
    min-height:44px;
    border:1px solid var(--ui-border);
    border-radius:11px;
    background-color:#fff;
    color:#172033;
    box-shadow:none!important;
    transition:border-color .18s ease,box-shadow .18s ease,background-color .18s ease;
}
textarea.form-control{min-height:100px}
.form-control:hover,.form-select:hover{border-color:#b8c6da}
.form-control:focus,.form-select:focus{
    border-color:#77a7f8;
    box-shadow:0 0 0 4px rgba(37,99,235,.11)!important;
}
.form-control::placeholder{color:#94a3b8}

.visual-field{
    position:relative;
    display:block;
}
.visual-field>.field-icon{
    position:absolute;
    right:13px;
    top:50%;
    transform:translateY(-50%);
    z-index:4;
    color:#7b8ba2;
    font-size:1rem;
    pointer-events:none;
    line-height:1;
}
.visual-field>.form-control,
.visual-field>.form-select{
    padding-right:42px;
}
.visual-field.has-password-toggle>.form-control{
    padding-left:44px;
}
.visual-field>.password-toggle{
    position:absolute;
    left:7px;
    top:50%;
    transform:translateY(-50%);
    z-index:5;
    width:34px;
    height:34px;
    display:grid;
    place-items:center;
    border:0;
    border-radius:9px;
    color:#64748b;
    background:transparent;
    transition:.18s ease;
}
.visual-field>.password-toggle:hover{
    color:var(--ui-primary);
    background:var(--ui-primary-soft);
}
.visual-field>.password-toggle:focus-visible{
    outline:3px solid rgba(37,99,235,.18);
}
.visual-field.textarea-field>.field-icon{
    top:17px;
    transform:none;
}
.visual-field.textarea-field>.form-control{padding-top:12px}

.btn{
    border-radius:10px;
    font-weight:700;
    min-height:40px;
    display:inline-flex;
    align-items:center;
    justify-content:center;
    gap:.4rem;
}
.btn-sm{min-height:33px;border-radius:8px}
.btn-primary{box-shadow:0 6px 14px rgba(37,99,235,.18)}
.btn-primary:hover{transform:translateY(-1px)}

.table{
    --bs-table-bg:transparent;
    margin-bottom:0;
}
.table thead th{
    background:#f7f9fc;
    color:#475569;
    font-size:.82rem;
    font-weight:800;
    border-bottom:1px solid var(--ui-border);
    white-space:nowrap;
    padding:.85rem .8rem;
}
.table tbody td{
    padding:.82rem .8rem;
    border-color:#edf1f7;
    vertical-align:middle;
}
.table-hover>tbody>tr:hover>*{background:#f8fbff}

.permission-box{
    border:1px solid var(--ui-border);
    border-radius:14px;
    padding:12px;
    background:#f9fbfe;
}
.permission-accordion{
    border:1px solid #e4eaf3;
    border-radius:11px;
    background:#fff;
    overflow:hidden;
    margin-bottom:8px;
}
.permission-accordion summary{
    min-height:44px;
    padding:10px 13px;
    background:#fff;
}
.permission-accordion[open] summary{
    color:var(--ui-primary);
    background:var(--ui-primary-soft);
}
.permission-accordion-body{padding:10px 14px 12px}
.permission-accordion-body .form-check{
    padding:8px 30px 8px 8px;
    border-radius:8px;
}
.permission-accordion-body .form-check:hover{background:#f7f9fc}

.auth-content .card{
    border:1px solid rgba(219,227,239,.9)!important;
    border-radius:18px;
    box-shadow:0 18px 48px rgba(15,23,42,.12)!important;
}

@media (max-width:767.98px){
    .app-content .card-body{padding:1rem}
    .form-control,.form-select{min-height:42px}
    .visual-field>.field-icon{right:12px}
    .table thead th,.table tbody td{padding:.72rem .65rem}
}

/* المرحلة المالية والإعدادات */
.financial-entry-card,.job-financial-card,.customer-balance-card,.settings-card{border:1px solid #dbe5f0;border-radius:16px;background:linear-gradient(180deg,#fff,#fbfdff)}
.financial-entry-card{padding:18px}.financial-entry-head>div{display:flex;align-items:center;gap:10px;flex-wrap:wrap;margin-bottom:16px}.financial-entry-head i{font-size:1.35rem;color:#0d6efd}.financial-entry-head span{color:#64748b;font-size:.88rem;width:100%;padding-right:34px}
.remaining-amount-box{display:flex;align-items:center;gap:12px;padding:14px 16px;border-radius:13px;background:#fff7ed;border:1px solid #fed7aa}.remaining-amount-box span{color:#7c2d12}.remaining-amount-box strong{font-size:1.45rem;color:#c2410c;margin-right:auto}.remaining-amount-box small{font-weight:700;color:#9a3412}
.financial-summary-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:12px}.financial-summary-grid>div{padding:14px;border-radius:13px;background:#f8fafc;border:1px solid #e2e8f0}.financial-summary-grid span{display:block;color:#64748b;font-size:.82rem;margin-bottom:5px}.financial-summary-grid strong{font-size:1.05rem}.financial-summary-grid .has-balance{background:#fff7ed;border-color:#fed7aa}.financial-summary-grid .has-balance strong{color:#c2410c}.financial-summary-grid .is-paid{background:#f0fdf4;border-color:#bbf7d0}.financial-summary-grid .is-paid strong{color:#15803d}
.payment-entry-form{display:grid;grid-template-columns:1fr 1fr 1.4fr auto;gap:10px;align-items:end;padding:14px;border-radius:13px;background:#f8fafc;border:1px dashed #cbd5e1}.payment-entry-form .btn{height:42px}
.customer-currency-balance{height:100%;padding:15px;border:1px solid #e2e8f0;border-radius:13px;background:#f8fafc}.customer-currency-balance>strong{display:block;margin-bottom:10px;color:#0f172a}.customer-currency-balance>div{display:flex;justify-content:space-between;gap:12px;padding:6px 0;border-top:1px solid #e8eef5;font-size:.9rem}.customer-currency-balance span{color:#64748b}
.settings-page{max-width:980px}.settings-card .card-footer{padding:16px 20px;border-top:1px solid #edf2f7}
@media(max-width:767.98px){.financial-summary-grid{grid-template-columns:1fr}.payment-entry-form{grid-template-columns:1fr}.financial-entry-card{padding:14px}.remaining-amount-box{flex-wrap:wrap}.remaining-amount-box strong{margin-right:0}.remaining-amount-box small{margin-right:auto}}

/* Outstanding balance notice and WhatsApp payment request */
.unpaid-delivery-notice{display:flex;align-items:center;gap:14px;padding:14px 16px;margin-bottom:16px;border:1px solid #fecaca;border-radius:14px;background:linear-gradient(135deg,#fff7ed,#fff1f2)}
.unpaid-delivery-icon{width:44px;height:44px;flex:0 0 44px;border-radius:12px;display:grid;place-items:center;background:#fee2e2;color:#dc2626;font-size:1.2rem}
.unpaid-delivery-content{display:flex;flex-direction:column;gap:3px;min-width:0;flex:1}
.unpaid-delivery-content strong{color:#991b1b;font-size:.96rem}
.unpaid-delivery-content span{color:#7f1d1d;font-size:.88rem}
.whatsapp-payment-btn{white-space:nowrap;border-radius:10px;font-weight:700;display:inline-flex;align-items:center;justify-content:center}
.customer-phone-missing{font-size:.82rem;color:#92400e;background:#fef3c7;border:1px solid #fde68a;border-radius:9px;padding:8px 10px;white-space:nowrap}
@media(max-width:767.98px){.unpaid-delivery-notice{align-items:flex-start;flex-wrap:wrap}.unpaid-delivery-content{width:calc(100% - 58px)}.whatsapp-payment-btn,.customer-phone-missing{width:100%;text-align:center;justify-content:center}}

/* Stage 2 - financial integrity */
.financial-status-line{margin-top:.35rem}.financial-badge{display:inline-flex;align-items:center;border-radius:999px;padding:.18rem .55rem;font-size:.72rem;font-weight:700;white-space:nowrap}.financial-badge.unpriced{background:#fff7ed;color:#c2410c;border:1px solid #fed7aa}.financial-badge.due{background:#fef2f2;color:#b91c1c;border:1px solid #fecaca}.financial-badge.paid{background:#f0fdf4;color:#15803d;border:1px solid #bbf7d0}.financial-free-check{border:1px dashed #cbd5e1;border-radius:12px;padding:.8rem 2.4rem .8rem .8rem;background:#f8fafc}.unpriced-notice{background:#fff7ed!important;border-color:#fed7aa!important}.unpriced-notice .unpaid-delivery-icon{color:#c2410c}


/* ===== الاستجابة الشاملة للجوال - جميع صفحات النظام ===== */
html,body{max-width:100%;overflow-x:hidden}
img,svg,video,canvas{max-width:100%;height:auto}
.app-content{min-width:0}
.app-content>*{min-width:0}
.card,.card-body,.row>[class*="col-"]{min-width:0}

/* يمنع النصوص والأرقام الطويلة من توسيع الصفحة */
.table td,.table th,.card,.alert,.badge,.form-control,.form-select{
    overflow-wrap:anywhere;
    word-break:normal;
}
[dir="ltr"]{unicode-bidi:plaintext}

/* شريط تمرير واضح للجداول التي لا يمكن تحويلها */
.table-responsive{
    max-width:100%;
    overflow-x:auto;
    overflow-y:hidden;
    -webkit-overflow-scrolling:touch;
    scrollbar-width:thin;
    scrollbar-color:#94a3b8 #eef2f7;
}
.table-responsive::-webkit-scrollbar{height:7px}
.table-responsive::-webkit-scrollbar-track{background:#eef2f7;border-radius:999px}
.table-responsive::-webkit-scrollbar-thumb{background:#94a3b8;border-radius:999px}

/* الفلاتر وشريط الإجراءات */
.mobile-actions,.page-actions{display:flex;gap:.55rem;align-items:center;flex-wrap:wrap}
.pagination{flex-wrap:wrap;gap:.25rem;justify-content:center}
.pagination .page-link{border-radius:9px;min-width:36px;text-align:center}

@media(max-width:767.98px){
    body{line-height:1.65}
    .app-topbar{gap:9px;padding-inline:10px}
    .page-heading{min-width:0}
    .page-heading h1{font-size:1rem;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
    .page-heading span{font-size:.68rem}
    .topbar-actions{display:flex;align-items:center;gap:7px;flex:0 0 auto}
    .notification-menu{position:fixed!important;top:68px!important;right:10px!important;left:10px!important;width:auto!important;max-width:none!important;transform:none!important;max-height:72vh;overflow:auto}

    .app-content{padding:12px 9px 24px}
    .app-content>h2,.app-content>h3{font-size:1.18rem;margin-bottom:12px}
    .card{border-radius:13px!important}
    .card-body{padding:13px!important}
    .card-header,.card-footer{padding:12px 13px}

    /* ترتيب رؤوس الصفحات والأزرار */
    .app-content .d-flex.justify-content-between,
    .app-content .d-flex.align-items-center.justify-content-between{
        flex-wrap:wrap;
        gap:.65rem;
    }
    .app-content .d-flex.justify-content-between>h2,
    .app-content .d-flex.justify-content-between>h3,
    .app-content .d-flex.justify-content-between>h4,
    .app-content .d-flex.justify-content-between>h5{width:100%;margin-bottom:0}
    .app-content .d-flex.gap-2{flex-wrap:wrap}
    .app-content .d-flex.gap-2>.btn{flex:1 1 auto}

    /* الفلاتر: كل عنصر بعرض كامل إلا العناصر القصيرة */
    .app-content form.row.g-2>[class*="col-"],
    .app-content form.row.g-3>[class*="col-"],
    .management-filter>[class*="col-"]{width:100%;flex:0 0 100%;max-width:100%}
    .app-content form.row .btn{width:100%;min-height:43px}

    /* النوافذ المنبثقة */
    .modal-dialog{margin:.45rem;max-width:calc(100% - .9rem)}
    .modal-content{border-radius:15px}
    .modal-header,.modal-body,.modal-footer{padding:13px}
    .modal-footer{gap:.5rem;flex-wrap:wrap}
    .modal-footer .btn{flex:1 1 120px}

    /* القوائم المنسدلة */
    .dropdown-menu{max-width:calc(100vw - 20px);overflow-wrap:anywhere}

    /* تحويل جميع الجداول القياسية إلى بطاقات مقروءة */
    .table-responsive.mobile-card-wrap{
        overflow:visible;
        background:transparent;
        border:0;
        border-radius:0;
        box-shadow:none;
    }
    table.mobile-card-table{display:block;width:100%;background:transparent}
    table.mobile-card-table thead{display:none}
    table.mobile-card-table tbody{display:grid;gap:10px;width:100%}
    table.mobile-card-table tr{
        display:block;
        width:100%;
        background:#fff;
        border:1px solid #dfe6ef;
        border-radius:13px;
        box-shadow:0 5px 15px rgba(15,23,42,.055);
        overflow:hidden;
    }
    table.mobile-card-table tbody tr:hover{background:#fff}
    table.mobile-card-table td{
        display:grid;
        grid-template-columns:minmax(92px,38%) minmax(0,1fr);
        align-items:start;
        gap:10px;
        width:100%;
        min-height:39px;
        padding:9px 11px!important;
        border:0!important;
        border-bottom:1px solid #edf1f6!important;
        text-align:right!important;
        white-space:normal!important;
        background:transparent!important;
    }
    table.mobile-card-table td:last-child{border-bottom:0!important}
    table.mobile-card-table td::before{
        content:attr(data-label);
        color:#64748b;
        font-size:.75rem;
        font-weight:800;
        line-height:1.55;
    }
    table.mobile-card-table td[data-label=""],
    table.mobile-card-table td.mobile-full-cell{
        display:block;
        padding:11px!important;
    }
    table.mobile-card-table td[data-label=""]::before,
    table.mobile-card-table td.mobile-full-cell::before{display:none}
    table.mobile-card-table td[colspan]{display:block!important;text-align:center!important}
    table.mobile-card-table td[colspan]::before{display:none}
    table.mobile-card-table td .btn,
    table.mobile-card-table td form,
    table.mobile-card-table td .form-select{max-width:100%}
    table.mobile-card-table td:last-child .btn{width:100%}
    table.mobile-card-table .quick-update-form{min-width:0;width:100%}
    table.mobile-card-table .status-select,
    table.mobile-card-table .priority-select{width:100%;min-width:0}
    table.mobile-card-table .customer-name-cell{align-items:flex-start}

    /* جداول ضخمة تحتاج الشكل الأفقي الأصلي يمكن استثناؤها */
    table.keep-horizontal-mobile{display:table!important;min-width:850px}
    table.keep-horizontal-mobile thead{display:table-header-group!important}
    table.keep-horizontal-mobile tbody{display:table-row-group!important}
    table.keep-horizontal-mobile tr{display:table-row!important;box-shadow:none!important;border-radius:0!important}
    table.keep-horizontal-mobile td{display:table-cell!important;width:auto!important}
    table.keep-horizontal-mobile td::before{display:none!important}
    .table-responsive:has(.keep-horizontal-mobile){overflow-x:auto;border:1px solid var(--border);border-radius:13px;box-shadow:var(--shadow)}

    /* ملخصات البيانات */
    dl.customer-details{grid-template-columns:86px minmax(0,1fr);gap:8px 10px}
    dl.customer-details dd{min-width:0;overflow-wrap:anywhere}
    .financial-summary-grid{gap:8px}
    .financial-summary-grid>div{padding:11px}
    .customer-currency-balance>div{flex-wrap:wrap}

    /* البطاقات الإحصائية */
    .row.g-2.mb-3{--bs-gutter-x:.55rem;--bs-gutter-y:.55rem}
    .row.g-2.mb-3 .card.text-center{min-height:82px}
    .row.g-2.mb-3 .card.text-center .card-body{padding:10px!important}
    .row.g-2.mb-3 .card.text-center strong{font-size:1.25rem}

    /* الأزرار الطويلة */
    .btn{white-space:normal;text-align:center;line-height:1.4}
    .btn-group{display:flex;flex-wrap:wrap;width:100%}
    .btn-group>.btn{flex:1 1 auto;border-radius:9px!important;margin:2px}

    /* التنبيهات */
    .alert{padding:11px 12px}
    .app-alert{padding-left:38px}

    /* النماذج المالية والعمل */
    .payment-entry-form{padding:11px;gap:8px}
    .remaining-amount-box{align-items:flex-start}
    .remaining-amount-box strong{width:100%;font-size:1.2rem}
    .unpaid-delivery-content{width:calc(100% - 52px)}

    /* الصلاحيات */
    .permission-accordion-body .form-check{padding:8px 28px 8px 4px}
    .permission-accordion summary{line-height:1.5}

    /* صفحات الفحص والسجلات */
    .audit-change{grid-template-columns:1fr!important;gap:5px}
    .audit-change i{transform:rotate(90deg);margin:auto}
    .audit-table-wrap{overflow:visible!important}
}

@media(max-width:390px){
    .app-content{padding-inline:7px}
    .card-body{padding:11px!important}
    table.mobile-card-table td{grid-template-columns:minmax(78px,36%) minmax(0,1fr);padding:8px 9px!important;gap:7px}
    table.mobile-card-table td::before{font-size:.7rem}
    .sidebar-toggle,.quick-add,.notification-bell{width:38px!important;height:38px!important;min-width:38px!important}
    .page-heading h1{font-size:.92rem}
}

/* ===== لوحة الأعمال للجوال: بطاقات مخصصة ومرتبة ===== */
.jobs-mobile-list{display:grid;gap:12px;margin-bottom:14px}
.mobile-job-card{background:#fff;border:1px solid #dbe4ef;border-radius:16px;box-shadow:0 7px 22px rgba(15,23,42,.07);overflow:hidden}
.mobile-job-card__header{display:flex;align-items:flex-start;justify-content:space-between;gap:10px;padding:13px 13px 11px;background:linear-gradient(135deg,#f8fafc,#fff);border-bottom:1px solid #edf1f6}
.mobile-job-card__identity{display:flex;align-items:center;gap:10px;min-width:0}
.mobile-job-card__index{width:30px;height:30px;flex:0 0 30px;border-radius:9px;display:grid;place-items:center;background:#e8eefb;color:#3155a5;font-size:.78rem;font-weight:900}
.mobile-job-card__number{display:block;color:#102a56;font-weight:900;font-size:.98rem;text-decoration:none;line-height:1.35}
.mobile-job-card__number:hover{color:#1d4ed8}
.mobile-job-card__client{display:flex;align-items:center;gap:5px;color:#64748b;font-size:.77rem;margin-top:3px;min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.mobile-job-card__header>.status-badge{flex:0 0 auto;max-width:42%;font-size:.7rem;padding:.34rem .55rem}
.mobile-job-card__body{padding:12px 13px}
.mobile-job-card__title{display:flex;align-items:flex-start;gap:8px;color:#0f172a;margin-bottom:11px;font-size:.93rem;line-height:1.55}
.mobile-job-card__title i{color:#5673b6;margin-top:3px}
.mobile-job-card__meta{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}
.mobile-job-card__meta>div{min-width:0;padding:9px 10px;background:#f8fafc;border:1px solid #edf1f6;border-radius:11px}
.mobile-job-card__meta span{display:flex;align-items:center;gap:5px;color:#64748b;font-size:.69rem;font-weight:700;margin-bottom:3px}
.mobile-job-card__meta strong{display:block;color:#1e293b;font-size:.8rem;font-weight:800;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.mobile-job-card__financial{display:flex;align-items:center;justify-content:space-between;gap:8px;flex-wrap:wrap;margin-top:10px;padding-top:10px;border-top:1px dashed #dbe4ef}
.mobile-job-card__financial .financial-badge{font-size:.72rem;padding:.3rem .58rem;gap:4px}
.mobile-job-card__financial .priority-badge{font-size:.71rem;padding:.3rem .58rem}
.mobile-job-card__controls{display:grid;grid-template-columns:1fr 1fr;gap:8px;margin-top:11px;padding-top:10px;border-top:1px solid #edf1f6}
.mobile-job-card__controls form{min-width:0;margin:0}
.mobile-job-card__controls label{display:block;color:#64748b;font-size:.68rem;font-weight:800;margin-bottom:4px}
.mobile-job-card__controls .form-select{width:100%;height:38px;border-radius:9px;font-size:.76rem;padding-block:.25rem}
.mobile-job-card__footer{padding:10px 13px 13px}
.mobile-job-card__footer .btn{width:100%;min-height:41px;display:flex;align-items:center;justify-content:center;gap:7px;border-radius:10px;font-size:.83rem;font-weight:800}

@media(max-width:390px){
  .mobile-job-card__header{padding-inline:11px}
  .mobile-job-card__body{padding-inline:11px}
  .mobile-job-card__footer{padding-inline:11px}
  .mobile-job-card__meta{grid-template-columns:1fr 1fr;gap:6px}
  .mobile-job-card__meta>div{padding:8px}
  .mobile-job-card__controls{grid-template-columns:1fr}
}

/* ===== تحسينات مخصصة للجوال: بطاقات الحالات والعملاء والنسخ الاحتياطية ===== */
.status-summary{display:block;text-decoration:none;color:inherit;transition:.2s ease;cursor:pointer;position:relative;overflow:hidden}
.status-summary:hover{transform:translateY(-2px);box-shadow:0 8px 22px rgba(15,23,42,.1)}
.status-summary.is-active{outline:3px solid rgba(37,99,235,.18);border-color:#2563eb!important;box-shadow:0 10px 26px rgba(37,99,235,.14)}
.status-summary__hint{display:block;margin-top:3px;font-size:.62rem;color:#64748b;font-weight:700}
.status-summary.is-active .status-summary__hint{color:#1d4ed8}

.mobile-customer-card{background:#fff;border:1px solid #dbe4ef;border-radius:16px;box-shadow:0 7px 22px rgba(15,23,42,.07);overflow:hidden;margin-bottom:11px}
.mobile-customer-card__header{display:flex;align-items:flex-start;justify-content:space-between;gap:10px;padding:13px;background:linear-gradient(135deg,#f8fafc,#fff);border-bottom:1px solid #edf1f6}
.mobile-customer-card__identity{display:flex;align-items:center;gap:10px;min-width:0}
.mobile-customer-card__identity .customer-avatar{width:42px;height:42px;flex:0 0 42px;border-radius:13px;font-size:1rem}
.mobile-customer-card__name{display:block;color:#102a56;font-size:.94rem;font-weight:900;line-height:1.4;text-decoration:none;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.mobile-customer-card__code{display:block;color:#64748b;font-size:.72rem;margin-top:2px;direction:ltr;text-align:right}
.mobile-customer-card__body{padding:12px 13px}
.mobile-customer-card__grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}
.mobile-customer-card__grid>div{padding:9px 10px;background:#f8fafc;border:1px solid #edf1f6;border-radius:11px;min-width:0}
.mobile-customer-card__grid span{display:flex;align-items:center;gap:5px;color:#64748b;font-size:.68rem;font-weight:800;margin-bottom:4px}
.mobile-customer-card__grid strong{display:block;color:#1e293b;font-size:.79rem;font-weight:850;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.mobile-customer-card__footer{padding:0 13px 13px}
.mobile-customer-card__footer .btn{width:100%;min-height:42px;border-radius:10px;display:flex;align-items:center;justify-content:center;gap:7px;font-weight:800;font-size:.82rem}

.mobile-backup-card{background:#fff;border:1px solid #dbe4ef;border-radius:16px;box-shadow:0 7px 22px rgba(15,23,42,.07);overflow:hidden;margin-bottom:11px}
.mobile-backup-card__header{display:grid;grid-template-columns:42px minmax(0,1fr) auto;gap:10px;align-items:start;padding:13px;background:linear-gradient(135deg,#f8fafc,#fff);border-bottom:1px solid #edf1f6}
.mobile-backup-card__icon{width:42px;height:42px;border-radius:13px;display:grid;place-items:center;background:#eaf1ff;color:#3155a5;font-size:1.1rem}
.mobile-backup-card__title{min-width:0}
.mobile-backup-card__title strong{display:block;color:#102a56;font-size:.82rem;font-weight:900;direction:ltr;text-align:right;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.mobile-backup-card__title span{display:block;color:#64748b;font-size:.7rem;margin-top:4px}
.mobile-backup-card__status .badge{font-size:.66rem;white-space:nowrap}
.mobile-backup-card__meta{display:grid;grid-template-columns:1fr 1fr;gap:8px;padding:12px 13px}
.mobile-backup-card__meta>div{padding:9px 10px;background:#f8fafc;border:1px solid #edf1f6;border-radius:11px;min-width:0}
.mobile-backup-card__meta span{display:flex;align-items:center;gap:5px;color:#64748b;font-size:.68rem;font-weight:800;margin-bottom:4px}
.mobile-backup-card__meta strong{display:block;color:#1e293b;font-size:.78rem;font-weight:850;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.mobile-backup-card__actions{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px;padding:0 13px 13px}
.mobile-backup-card__actions form{margin:0;min-width:0}
.mobile-backup-card__actions .btn{width:100%;min-height:40px;border-radius:10px;display:flex;align-items:center;justify-content:center;gap:6px;font-size:.76rem;font-weight:800}
.backup-empty-mobile{display:flex;flex-direction:column;align-items:center;text-align:center;padding:30px 15px;color:#64748b}
.backup-empty-mobile i{font-size:2rem;margin-bottom:8px;color:#94a3b8}
.backup-empty-mobile strong{color:#334155;margin-bottom:4px}
.backup-empty-mobile span{font-size:.78rem}
.backup-audit-mobile article{background:#f8fafc;border:1px solid #e5ebf3;border-radius:13px;padding:12px;margin-bottom:9px}
.backup-audit-mobile article>div{display:flex;justify-content:space-between;gap:8px;align-items:flex-start;padding-bottom:8px;border-bottom:1px dashed #dbe4ef}
.backup-audit-mobile article>div strong{color:#1e293b;font-size:.82rem}
.backup-audit-mobile article>div span{color:#64748b;font-size:.68rem;white-space:nowrap}
.backup-audit-mobile dl{margin:9px 0 0;display:grid;gap:6px}
.backup-audit-mobile dl>div{display:flex;justify-content:space-between;gap:10px;font-size:.73rem}
.backup-audit-mobile dt{color:#64748b;font-weight:700}
.backup-audit-mobile dd{margin:0;color:#1e293b;font-weight:800;max-width:68%;overflow-wrap:anywhere}

@media(max-width:767.98px){
  .dashboard-stats{display:grid!important;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px;margin:0!important;padding:0;overflow:visible}
  .dashboard-stats .status-card-col{width:auto!important;max-width:none!important;flex:none!important;padding:0!important;margin:0!important}
  .dashboard-stats .status-summary{min-height:88px;height:100%;border-radius:13px}
  .dashboard-stats .card-body{padding:9px 5px;display:flex;flex-direction:column;justify-content:center;align-items:center;text-align:center}
  .dashboard-stats .small{width:100%;font-size:.66rem;line-height:1.25;white-space:normal;overflow:visible;text-overflow:clip}
  .dashboard-stats strong{font-size:1.2rem;line-height:1.1}
  .status-summary__hint{font-size:.54rem;line-height:1.2;margin-top:2px}

  .customers-page>.d-flex:first-child{align-items:stretch!important}
  .customers-page>.d-flex:first-child>div:first-child{width:100%}
  .customers-page>.d-flex:first-child>.d-flex{width:100%;display:grid!important;grid-template-columns:1fr 1fr}
  .customers-page>.d-flex:first-child>.d-flex .btn{width:100%;justify-content:center}
  .customers-page #customers-filter{background:#fff;border:1px solid #e3eaf3;border-radius:15px;padding:10px;margin-inline:0!important}
  .customers-page #customers-filter>div{width:100%}
  .customers-page #customers-filter .btn{min-height:42px}

  .backup-page .backup-security-note{align-items:flex-start;padding:13px;border-radius:15px}
  .backup-page .backup-security-note>i{font-size:1.35rem;margin-top:2px}
  .backup-page .backup-security-note strong{font-size:.87rem}
  .backup-page .backup-security-note span{font-size:.73rem;line-height:1.6}
  .backup-page>.alert{align-items:flex-start!important;padding:12px;border-radius:14px;font-size:.78rem}
  .backup-page>.row{gap:10px!important}
  .backup-action-card .card-body{padding:15px}
  .backup-action-card h4{font-size:1rem}
  .backup-action-card p{font-size:.76rem;line-height:1.7}
  .backup-action-card .btn{width:100%;min-height:44px}
  .backup-action-icon{width:46px;height:46px;font-size:1.2rem}
  .restore-form .form-control{min-height:44px}
  .backup-saved-card>.card-body,.backup-audit-card>.card-body{padding:13px}
  .backup-section-head h4,.backup-audit-card h4{font-size:.95rem}
  #restoreModal .modal-dialog{margin:10px}
  #restoreModal .modal-content{border-radius:16px}
  #restoreModal .modal-footer{display:grid;grid-template-columns:1fr 1fr}
  #restoreModal .modal-footer .btn{width:100%;margin:0}
}

@media(max-width:390px){
  .mobile-customer-card__grid,.mobile-backup-card__meta{grid-template-columns:1fr}
  .mobile-backup-card__header{grid-template-columns:38px minmax(0,1fr)}
  .mobile-backup-card__status{grid-column:1/-1;padding-right:48px}
  .mobile-backup-card__actions{grid-template-columns:1fr 1fr}
}


.btn-icon-only{
    width: 42px;
    min-width: 42px;
    height: 42px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    line-height: 1;
}
.btn-icon-only i{
    font-size: 1rem;
    margin: 0;
}
.jobs-table td:last-child,
.management-table td:last-child,
.customer-table td:last-child,
.attention-table td:last-child{
    white-space: nowrap;
}
