/* =========================================================
   مطبوع · Matbou3
   ملف الأنماط الرئيسي (RTL / Bootstrap 5 / Tajawal)
   الهوية: Sage Green (#566F53) — مستوحاة من لوقو مطبوع
   ========================================================= */

:root {
    --primary-color: #566F53;       /* Sage 700 — اللون الأساسي */
    --primary-hover: #3F5240;       /* Sage 800 — Hover */
    --primary-rgb:   86, 111, 83;   /* لاستخدامات rgba */
    --secondary-color: #7A9275;     /* Sage 500 — Secondary */
    --secondary-rgb:  122, 146, 117;
    --accent-color: #B8865A;        /* Bronze — مكمّل دافئ */
    --accent-rgb:   184, 134, 90;
    --success-color: #10B981;       /* Emerald 500 */
    --warning-color: #F59E0B;       /* Amber 500 */
    --danger-color:  #EF4444;       /* Red 500 */
    --info-color:    #0284C7;       /* Sky 600 */
    --light-bg: #F6F7F3;            /* Off-white بمسحة sage خفيفة */
    --card-radius: 14px;
    --sidebar-width: 280px;
    --sidebar-width-lg: 300px;
    --topbar-height: 64px;
    --font-family-sans-serif: 'Tajawal', sans-serif;
}

html, body { height: 100%; }

body {
    margin: 0;
    background-color: var(--light-bg);
    font-family: var(--font-family-sans-serif);
    color: #1F2937;
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-family-sans-serif);
    font-weight: 700;
}

.btn, input, select, textarea {
    font-family: var(--font-family-sans-serif);
}

/* ===================== Sidebar (RTL fixed-right) ===================== */
.sidebar {
    position: fixed;
    top: 0;
    right: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: linear-gradient(180deg, #ffffff 0%, #F1F2F8 100%);
    padding-top: 20px;
    box-shadow: 0 0 25px rgba(86, 111, 83, 0.10);
    z-index: 1000;
    overflow-y: auto;
    overflow-x: hidden;
    border-left: 1px solid rgba(86, 111, 83, 0.12);
    scrollbar-width: thin;
    scrollbar-color: rgba(86, 111, 83, 0.4) rgba(0,0,0,0.05);
    display: flex;
    flex-direction: column;
}

.sidebar::-webkit-scrollbar { width: 6px; }
.sidebar::-webkit-scrollbar-track { background: rgba(0, 0, 0, 0.05); border-radius: 3px; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(86, 111, 83, 0.4); border-radius: 3px; }
.sidebar::-webkit-scrollbar-thumb:hover { background: rgba(86, 111, 83, 0.6); }

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 6px 16px 16px 16px;
    margin-bottom: 4px;
}
.sidebar-brand .brand-logo-wrap {
    position: relative;
    width: 60px;
    height: 60px;
    border-radius: 14px;
    background: radial-gradient(circle at 30% 25%, #ffffff 0%, #f8fafc 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow:
        0 6px 18px rgba(86, 111, 83, .18),
        0 1px 3px rgba(86, 111, 83, .08),
        inset 0 0 0 1px rgba(86, 111, 83, .06);
    flex-shrink: 0;
    overflow: hidden;
    padding: 6px;
    transition: transform .25s ease, box-shadow .25s ease;
}
.sidebar-brand .brand-logo-wrap::before {
    content: '';
    position: absolute;
    inset: -2px;
    border-radius: 16px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    z-index: -1;
    opacity: .14;
    filter: blur(8px);
}
.sidebar-brand:hover .brand-logo-wrap {
    transform: translateY(-1px);
    box-shadow:
        0 10px 24px rgba(86, 111, 83, .25),
        inset 0 0 0 1px rgba(86, 111, 83, .1);
}
.sidebar-brand .brand-logo-img,
.sidebar-brand .brand-logo-fallback {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary-color);
    font-size: 26px;
}

.sidebar-brand .brand-text { line-height: 1.25; min-width: 0; flex: 1; }
.sidebar-brand .brand-name {
    font-weight: 800;
    font-size: 15px;
    color: var(--primary-color);
    letter-spacing: -.01em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sidebar-brand .brand-sub {
    font-size: 11px;
    color: #94A3B8;
    margin-top: 2px;
    font-weight: 500;
    letter-spacing: .02em;
}

/* ─── Sayour credit (developer attribution) ─────────────────────────── */
/* الهوية: شارة هادئة مع كلمة "سيّور" بأزرق احترافي يميّز المطوّر */
:root {
    --sayour-blue:    #1E40AF;   /* Blue 800 — اللون الرسمي لسيّور */
    --sayour-blue-rgb: 30, 64, 175;
}
.sayour-credit {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border-radius: 999px;
    background: rgba(var(--sayour-blue-rgb), .06);
    border: 1px solid rgba(var(--sayour-blue-rgb), .12);
    color: #475569;
    font-size: 11px;
    font-weight: 500;
    text-decoration: none;
    transition: all .2s ease;
    white-space: nowrap;
    direction: rtl;
}
.sayour-credit:hover {
    background: rgba(var(--sayour-blue-rgb), .12);
    border-color: rgba(var(--sayour-blue-rgb), .28);
    color: var(--sayour-blue);
}
.sayour-credit-logo {
    height: 16px;
    width: 16px;
    object-fit: contain;
    flex: 0 0 auto;
}
.sayour-credit-label { color: #94A3B8; font-weight: 500; }
.sayour-credit-name  {
    font-weight: 800;
    color: var(--sayour-blue);
    letter-spacing: .02em;
}

.sayour-credit.sayour-credit-lg {
    padding: 8px 14px;
    font-size: 12px;
}
.sayour-credit.sayour-credit-lg .sayour-credit-logo {
    height: 18px;
    width: 18px;
}

/* تخفيف بصري لـ sidebar-footer */
.sidebar-footer { margin-top: auto; }

.sidebar hr {
    border: none;
    height: 2px;
    background: linear-gradient(90deg, transparent, rgba(86, 111, 83, 0.3), transparent);
    margin: 16px 0;
}

.sidebar-section-title {
    font-size: 11px;
    font-weight: 700;
    color: #95A5A6;
    text-transform: uppercase;
    padding: 10px 24px 6px;
    letter-spacing: 0.5px;
}

.sidebar .nav-link {
    color: #475569;
    padding: 12px 18px;
    margin: 3px 14px;
    border-radius: 12px;
    transition: all .25s cubic-bezier(.4,0,.2,1);
    font-size: 14px;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 12px;
    text-align: right;
    direction: rtl;
}
.sidebar .nav-link i {
    width: 20px;
    text-align: center;
    font-size: 17px;
    flex-shrink: 0;
    order: 2;
    margin-right: auto;
    color: var(--primary-color);
    transition: transform .25s ease;
}
.sidebar .nav-link span { order: 1; flex: 1; text-align: right; }
.sidebar .nav-link:hover {
    background: rgba(86, 111, 83, 0.08);
    color: #111827;
    transform: translateX(-4px);
}
.sidebar .nav-link:hover i { transform: scale(1.1); }
.sidebar .nav-link.active {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: #fff;
    box-shadow: 0 6px 14px rgba(86, 111, 83, 0.35);
}
.sidebar .nav-link.active i { color: #fff; }
.sidebar .nav-link .badge { margin-right: 6px; font-weight: 600; }

/* ===================== Topbar ===================== */
.navbar.app-navbar {
    background-color: #fff !important;
    box-shadow: 0 2px 6px rgba(0,0,0,0.06);
    margin-right: var(--sidebar-width);
    position: sticky;
    top: 0;
    z-index: 999;
    height: var(--topbar-height);
    padding: 0 1.25rem;
}
.app-navbar .navbar-brand {
    color: var(--primary-color) !important;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
}
/* اللوقو في التوب‌بار — شفاف بالكامل ليظهر بوضوح على الخلفية البيضاء */
.app-navbar .navbar-brand-img {
    width: 42px;
    height: 42px;
    object-fit: contain;
    background: transparent;
    border: none;
    box-shadow: none;
    padding: 0;
    border-radius: 0;
    display: inline-block;
}
/* الـ Fallback (أيقونة بدلاً من صورة) يبقى بتدرّج لتمييزه كأيقونة */
.app-navbar .navbar-brand-fallback {
    width: 36px;
    height: 36px;
    object-fit: contain;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: #fff;
    font-size: 18px;
}
.user-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    border-radius: 999px;
    background: #F1F2F8;
    color: #1F2937;
    font-weight: 500;
    font-size: 13px;
}
.user-chip .avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 12px;
}

/* ===================== Main content ===================== */
.main-content {
    margin-right: var(--sidebar-width);
    padding: 24px;
    min-height: calc(100vh - var(--topbar-height));
}

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 22px;
}
.page-header h1 {
    margin: 0;
    font-size: 1.4rem;
    color: var(--primary-color);
    display: flex;
    align-items: center;
    gap: 10px;
}
.page-header .breadcrumb {
    margin: 4px 0 0;
    font-size: 12px;
    background: transparent;
    padding: 0;
}
.page-header .breadcrumb a { color: var(--secondary-color); text-decoration: none; }
.page-header .breadcrumb a:hover { text-decoration: underline; }
.page-header .breadcrumb .breadcrumb-item.active { color: #6B7280; }
.page-header .breadcrumb-item + .breadcrumb-item::before { color: #ADB5BD; padding: 0 6px; }
.page-header-actions { flex-shrink: 0; }
.page-header-actions .btn {
    box-shadow: 0 4px 12px rgba(var(--primary-rgb), .18);
    font-weight: 600;
}
.page-header-actions .btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(var(--primary-rgb), .26);
}

/* ===================== Cards ===================== */
.card {
    border: none;
    border-radius: var(--card-radius);
    box-shadow: 0 4px 14px rgba(0,0,0,0.06);
}
.card-header {
    background: #fff;
    border-bottom: 1px solid #EEF0F2;
    padding: 14px 20px;
    border-top-left-radius: var(--card-radius) !important;
    border-top-right-radius: var(--card-radius) !important;
    font-weight: 600;
}

.stat-card {
    border-radius: var(--card-radius);
    padding: 20px;
    color: #fff;
    position: relative;
    overflow: hidden;
    box-shadow: 0 6px 18px rgba(0,0,0,0.10);
    transition: transform .25s ease, box-shadow .25s ease;
}
.stat-card:hover { transform: translateY(-3px); box-shadow: 0 10px 24px rgba(0,0,0,0.15); }
.stat-card .stat-icon { position: absolute; left: 16px; bottom: 14px; font-size: 56px; opacity: 0.18; }
.stat-card .stat-label { font-size: 13px; opacity: 0.92; margin-bottom: 6px; }
.stat-card .stat-value { font-size: 26px; font-weight: 800; line-height: 1.2; }
.stat-card .stat-trend { font-size: 12px; margin-top: 6px; opacity: 0.9; }

.stat-card.bg-primary-grad   { background: linear-gradient(135deg, var(--primary-color), #3F5240); }
.stat-card.bg-secondary-grad { background: linear-gradient(135deg, #B8865A, #8B6340); }   /* Bronze — accent دافئ */
.stat-card.bg-success-grad   { background: linear-gradient(135deg, #059669, #10B981); }
.stat-card.bg-warning-grad   { background: linear-gradient(135deg, #D97706, #F59E0B); }
.stat-card.bg-danger-grad    { background: linear-gradient(135deg, #DC2626, #EF4444); }
.stat-card.bg-info-grad      { background: linear-gradient(135deg, #0369A1, #0EA5E9); }
.stat-card.bg-purple-grad    { background: linear-gradient(135deg, #6D28D9, #A855F7); }
.stat-card.bg-slate-grad     { background: linear-gradient(135deg, #334155, #475569); }   /* رمادي داكن أنيق */
.stat-card.bg-teal-grad      { background: linear-gradient(135deg, #0F766E, #14B8A6); }   /* تركواز للإنتاج */

/* ===================== Master Data cards ===================== */
.master-card {
    transition: all .15s ease;
    border: 1px solid rgba(0,0,0,.08);
}
.master-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(86, 111, 83,.12);
    border-color: var(--primary-color);
}
.master-card-icon {
    width: 48px; height: 48px; border-radius: 12px;
    display: inline-flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: #fff; font-size: 1.4rem;
}

/* ===================== Buttons ===================== */
.btn-primary {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}
.btn-primary:hover, .btn-primary:focus {
    background-color: var(--primary-hover);
    border-color: var(--primary-hover);
}
.btn-outline-primary { color: var(--primary-color); border-color: var(--primary-color); }
.btn-outline-primary:hover { background: var(--primary-color); color: #fff; }

/* ===================== Tables ===================== */
.table {
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
}
.table thead th {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: #fff;
    border: none;
    font-weight: 600;
    text-align: center;
    padding: 12px 8px;
    white-space: nowrap;
}
.table tbody tr { transition: background .2s ease; border-bottom: 1px solid #EEF0F2; }
.table tbody tr:hover { background-color: #F8FAFC !important; }
.table tbody td { padding: 12px 8px; vertical-align: middle; border: none; }

.empty-state { padding: 48px 16px; text-align: center; color: #6B7280; }
.empty-state i { font-size: 56px; color: #CDD5DB; margin-bottom: 12px; display: block; }
.empty-state h5 { color: #1F2937; margin-bottom: 6px; }

/* ===================== Status Pills ===================== */
.status-pill {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
}
.status-pill.draft               { background: #FEF3C7; color: #92400E; }
.status-pill.approved            { background: #D1FAE5; color: #065F46; }
.status-pill.partially_paid      { background: #DBEAFE; color: #1E40AF; }
.status-pill.paid                { background: #BBF7D0; color: #14532D; }
.status-pill.cancelled           { background: #FEE2E2; color: #991B1B; }
.status-pill.delivered           { background: #CFFAFE; color: #155E75; }
.status-pill.linked_to_work_order{ background: #EDE9FE; color: #5B21B6; }
.status-pill.new                 { background: #E0E7FF; color: #3730A3; }
.status-pill.design              { background: #FDE68A; color: #78350F; }
.status-pill.waiting_customer_approval { background: #FED7AA; color: #9A3412; }
.status-pill.printing            { background: #BFDBFE; color: #1E3A8A; }
.status-pill.finishing           { background: #C7D2FE; color: #3730A3; }
.status-pill.ready_for_delivery  { background: #BBF7D0; color: #166534; }
.status-pill.postponed           { background: #E5E7EB; color: #374151; }

/* Payment status pills */
.status-pill.unpaid  { background: #FEE2E2; color: #991B1B; }
.status-pill.partial { background: #FEF3C7; color: #92400E; }
/* `paid` reused from above */

/* ===================== Pagination ===================== */
.pagination .page-link {
    border: none;
    color: var(--primary-color);
    margin: 0 2px;
    border-radius: 8px;
}
.pagination .page-link:hover { background-color: var(--primary-color); color: #fff; }
.pagination .page-item.active .page-link {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

/* ===================== Alerts ===================== */
.alert { border: none; border-radius: 12px; }

/* ===================== Auth (Guest) ===================== */
/* ═══════════════════════════════════════════════════════════════════
   AUTH — Split Screen Layout (Branding | Form)
   ═══════════════════════════════════════════════════════════════════ */
.auth-body { margin: 0; background: #fff; }

.auth-layout {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 1fr 1fr;
    direction: rtl;
}

/* ─── Brand panel (right side in RTL) ──────────────────────────── */
.auth-brand-panel {
    position: relative;
    overflow: hidden;
    color: #fff;
    padding: 60px 50px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    isolation: isolate;
    background: linear-gradient(135deg, var(--primary-color) 0%, #3F5240 100%);
}
.auth-brand-bg {
    position: absolute;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background:
        radial-gradient(circle at 20% 15%, rgba(255,255,255,.12), transparent 45%),
        radial-gradient(circle at 85% 90%, rgba(184,134,90,.20), transparent 50%),
        radial-gradient(circle at 70% 30%, rgba(122,146,117,.35), transparent 55%);
}
.auth-brand-bg::after {
    content: '';
    position: absolute;
    inset: 0;
    background-image:
        radial-gradient(circle at 1px 1px, rgba(255,255,255,.05) 1px, transparent 0);
    background-size: 24px 24px;
    opacity: .6;
}

.auth-brand-content { position: relative; z-index: 1; max-width: 480px; margin: 0 auto; }

.auth-brand-logo {
    width: 160px;
    height: 160px;
    margin: 0 auto 28px;
    padding: 20px;
    border-radius: 32px;
    background: rgba(255,255,255,.96);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow:
        0 24px 60px rgba(0,0,0,.18),
        0 6px 16px rgba(0,0,0,.10),
        inset 0 0 0 1px rgba(255,255,255,.4);
    transition: transform .3s ease;
}
.auth-brand-logo:hover { transform: translateY(-3px) scale(1.02); }
.auth-brand-logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}
.auth-brand-logo i {
    font-size: 80px;
    color: var(--primary-color);
}

.auth-brand-title {
    font-size: 2rem;
    font-weight: 800;
    text-align: center;
    margin: 0 0 10px;
    letter-spacing: -.02em;
    color: #fff;
    text-shadow: 0 2px 8px rgba(0,0,0,.15);
}
.auth-brand-tagline {
    font-size: 1rem;
    text-align: center;
    margin: 0 0 36px;
    color: rgba(255,255,255,.86);
    font-weight: 500;
    line-height: 1.65;
}

.auth-brand-features {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    gap: 12px;
    max-width: 380px;
    margin-inline: auto;
}
.auth-brand-features li {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    border-radius: 12px;
    background: rgba(255,255,255,.08);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    border: 1px solid rgba(255,255,255,.10);
    font-size: 14px;
    color: rgba(255,255,255,.95);
    font-weight: 500;
    transition: background .25s ease, transform .25s ease;
}
.auth-brand-features li:hover {
    background: rgba(255,255,255,.14);
    transform: translateX(-3px);
}
.auth-brand-features i {
    font-size: 18px;
    color: #B8865A;
    flex-shrink: 0;
}

/* تذييل سيّور داخل الـ branding panel */
.auth-brand-footer {
    position: relative;
    z-index: 1;
    margin-top: 36px;
    padding-top: 20px;
    border-top: 1px solid rgba(255,255,255,.12);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 12px;
    color: rgba(255,255,255,.75);
}
.auth-brand-footer-label { font-weight: 500; }
.auth-brand-footer-logo { height: 18px; width: 18px; object-fit: contain; }
.auth-brand-footer-name {
    font-weight: 800;
    color: #93C5FD;
    letter-spacing: .03em;
}

/* ─── Form panel (left side in RTL) ────────────────────────────── */
.auth-form-panel {
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    position: relative;
}
.auth-form-wrap {
    width: 100%;
    max-width: 420px;
}
.auth-form-header-logo {
    width: 64px;
    height: 64px;
    object-fit: contain;
}

.auth-form-head { margin-bottom: 28px; }
.auth-form-title {
    font-size: 1.5rem;
    font-weight: 800;
    color: #0F172A;
    margin: 0 0 6px;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    letter-spacing: -.01em;
}
.auth-form-title i {
    width: 38px; height: 38px;
    display: inline-flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, var(--primary-color), #3F5240);
    color: #fff;
    border-radius: 11px;
    font-size: 18px;
    box-shadow: 0 8px 20px rgba(86,111,83,.25);
}
.auth-form-sub {
    font-size: 14px;
    color: #64748B;
    margin: 0;
}

/* الحقول */
.auth-form .form-floating > label {
    color: #64748B;
    padding-right: 14px;
}
.auth-form .form-control {
    border: 1.5px solid #E2E8F0;
    border-radius: 12px;
    padding: 1rem .9rem;
    font-size: 14px;
    transition: all .2s ease;
    background: #F8FAFC;
}
.auth-form .form-control:hover { border-color: #CBD5E1; }
.auth-form .form-control:focus {
    border-color: var(--primary-color);
    background: #fff;
    box-shadow: 0 0 0 4px rgba(var(--primary-rgb), .10);
}
.auth-toggle-pass {
    position: absolute;
    inset-inline-start: 8px;
    top: 50%;
    transform: translateY(-50%);
    color: #94A3B8;
    padding: 6px 10px;
    text-decoration: none;
}
.auth-toggle-pass:hover { color: var(--primary-color); }

.form-check-input:checked {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}
.form-check-input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 .2rem rgba(var(--primary-rgb), .15);
}

.auth-submit {
    padding: 14px 18px;
    font-size: 15px;
    font-weight: 700;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--primary-color), #3F5240);
    border: none;
    box-shadow: 0 10px 24px rgba(var(--primary-rgb), .28);
    transition: transform .2s ease, box-shadow .2s ease;
}
.auth-submit:hover {
    transform: translateY(-1px);
    box-shadow: 0 14px 30px rgba(var(--primary-rgb), .35);
    background: linear-gradient(135deg, #3F5240, var(--primary-color));
}
.auth-submit:active { transform: translateY(0); }

.auth-form-foot {
    margin-top: 28px;
    padding-top: 18px;
    border-top: 1px solid #F1F5F9;
    text-align: center;
}

.form-control:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(var(--primary-rgb), 0.15);
}

/* ─── Responsive: Stack on smaller screens ─────────────────────── */
@media (max-width: 991.98px) {
    .auth-layout {
        grid-template-columns: 1fr;
    }
    .auth-brand-panel {
        padding: 40px 28px;
        min-height: auto;
    }
    .auth-brand-logo {
        width: 100px; height: 100px;
        padding: 14px;
        border-radius: 24px;
        margin-bottom: 18px;
    }
    .auth-brand-title { font-size: 1.4rem; }
    .auth-brand-tagline { font-size: 14px; margin-bottom: 20px; }
    .auth-brand-features { display: none; }
    .auth-brand-footer { margin-top: 20px; padding-top: 14px; }

    .auth-form-panel { padding: 28px 20px 40px; }
    .auth-form-wrap { max-width: 100%; }
}
@media (max-width: 575.98px) {
    .auth-brand-panel { padding: 28px 20px 24px; }
    .auth-brand-logo { width: 84px; height: 84px; padding: 10px; border-radius: 20px; }
    .auth-brand-title { font-size: 1.2rem; }
    .auth-form-title { font-size: 1.25rem; }
}

/* ===================== Tom Select tweaks ===================== */
.ts-wrapper { font-family: inherit; }
.ts-wrapper.single .ts-control,
.ts-wrapper.multi .ts-control {
    min-height: calc(1.5em + .75rem + 2px);
    padding: .375rem .75rem;
    border-radius: .375rem;
    border-color: #CED4DA;
}
.ts-wrapper.focus .ts-control {
    border-color: #A78BFA;
    box-shadow: 0 0 0 .25rem rgba(86, 111, 83, .15);
}
.ts-dropdown { font-size: .9rem; }
.ts-dropdown .option.active { background-color: var(--primary-color); color: #fff; }
.ts-dropdown .option:hover { background-color: rgba(86, 111, 83, .08); }
[dir="rtl"] .ts-wrapper.single .ts-control { padding-right: .75rem; padding-left: 2rem; }

/* ===================== Utilities ===================== */
.min-w-0, .min-width-0 { min-width: 0 !important; }
.text-break-anywhere { overflow-wrap: anywhere !important; word-break: break-word !important; }
html, body { overflow-x: hidden; }
.main-content { max-width: 100%; overflow-x: hidden; }
.table-responsive { max-width: 100%; }

/* ===================== Responsive ===================== */
@media (min-width: 1200px) {
    .sidebar { width: var(--sidebar-width-lg); }
    .main-content, .navbar.app-navbar { margin-right: var(--sidebar-width-lg); }
}
@media (max-width: 991.98px) {
    .sidebar {
        transform: translateX(100%);
        transition: transform .3s ease;
        z-index: 1050;
        width: 86%;
        max-width: 320px;
    }
    .sidebar.show { transform: translateX(0); }
    .main-content, .navbar.app-navbar { margin-right: 0; }
    .sidebar-backdrop {
        position: fixed; inset: 0;
        background: rgba(0,0,0,0.4);
        z-index: 1040;
        display: none;
    }
    .sidebar-backdrop.show { display: block; }

    .main-content { padding: 16px; }
    .card-body { padding: 1rem; }
    .card-header { padding: .75rem 1rem; }
}
@media (max-width: 575.98px) {
    .main-content { padding: 12px; }
    .stat-card .stat-value { font-size: 22px; }
    .stat-card .stat-icon { font-size: 44px; left: 12px; bottom: 10px; }
    .page-header h1 { font-size: 1.15rem; }
    .card-body { padding: .85rem; }
    .card-header { padding: .65rem .85rem; }
    .navbar.app-navbar { padding: 0 .5rem; height: auto; min-height: 56px; }
    .user-chip { padding: 4px 8px; font-size: 12px; }
    .user-chip .avatar { width: 26px; height: 26px; font-size: 11px; }
    .table { font-size: 13px; }
    .table thead th, .table tbody td { padding: 8px 6px; }
    .row.g-3 { --bs-gutter-x: .75rem; --bs-gutter-y: .75rem; }
    .table-responsive { -webkit-overflow-scrolling: touch; }
}

/* ═══════════════════════════════════════════════════════════════════
   Platform Mode (لوحة مالك المنصة)
   نستخدم نفس النظام البصري الكامل لـ Matbou3 (Sage Green / Tajawal / cards)
   مع شريط رفيع علوي + شارة في الـ topbar تُميّز أنه "وضع منصّة" لمنع الخلط.
   ═══════════════════════════════════════════════════════════════════ */
:root {
    --platform-accent: #1E40AF;       /* Blue 800 — لون مميِّز للمنصة */
    --platform-accent-2: #3B82F6;     /* Blue 500 */
    --platform-bar-h: 32px;
}

.platform-mode-bar {
    position: sticky;
    top: 0;
    z-index: 1100;
    height: var(--platform-bar-h);
    background: linear-gradient(135deg, var(--platform-accent) 0%, var(--platform-accent-2) 100%);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-size: 12.5px;
    font-weight: 600;
    letter-spacing: .02em;
    box-shadow: 0 2px 6px rgba(30,64,175,.15);
}
.platform-mode-bar i { font-size: 14px; }
.platform-mode-bar a { color: #fff; text-decoration: underline; opacity: .9; }
.platform-mode-bar a:hover { opacity: 1; }

/* عندما يكون الشريط ظاهراً، نُحرّك الـ sidebar والـ topbar للأسفل */
body.platform-mode .sidebar { top: var(--platform-bar-h); height: calc(100vh - var(--platform-bar-h)); }
body.platform-mode .navbar.app-navbar { top: var(--platform-bar-h); }

/* شارة "وضع المنصة" في الـ topbar */
.platform-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 999px;
    background: rgba(var(--sayour-blue-rgb), .10);
    color: var(--platform-accent);
    border: 1px solid rgba(var(--sayour-blue-rgb), .25);
    font-weight: 700;
    font-size: 11.5px;
    white-space: nowrap;
}
.platform-badge i { font-size: 13px; }

/* تمييز sidebar في وضع المنصة بـ accent بسيط على الـ border-left */
body.platform-mode .sidebar { border-left-color: rgba(var(--sayour-blue-rgb), .18); }
body.platform-mode .sidebar-brand .brand-name { color: var(--platform-accent); }
body.platform-mode .sidebar .nav-link.active {
    background: linear-gradient(135deg, var(--platform-accent), var(--platform-accent-2));
    box-shadow: 0 6px 14px rgba(30, 64, 175, 0.30);
}
body.platform-mode .sidebar .nav-link i { color: var(--platform-accent); }
body.platform-mode .sidebar .nav-link.active i { color: #fff; }
body.platform-mode .sidebar hr {
    background: linear-gradient(90deg, transparent, rgba(30, 64, 175, 0.25), transparent);
}

/* مؤشّر حالة tenant في الجداول */
.tenant-row-status-dot {
    display: inline-block; width: 8px; height: 8px; border-radius: 50%;
    margin-inline-start: 6px; vertical-align: middle;
}
.tenant-row-status-dot.active    { background: var(--success-color); box-shadow: 0 0 0 3px rgba(16,185,129,.18); }
.tenant-row-status-dot.suspended { background: var(--warning-color); box-shadow: 0 0 0 3px rgba(245,158,11,.18); }
.tenant-row-status-dot.trial     { background: var(--info-color);    box-shadow: 0 0 0 3px rgba(2,132,199,.18); }
.tenant-row-status-dot.expired   { background: var(--danger-color);  box-shadow: 0 0 0 3px rgba(239,68,68,.18); }

/* danger-zone في صفحة tenant.show */
.danger-zone {
    border: 1px dashed rgba(239,68,68,.4);
    background: rgba(254, 242, 242, .6);
    border-radius: var(--card-radius);
    padding: 18px 20px;
}
.danger-zone h6 { color: var(--danger-color); margin: 0 0 6px; font-weight: 700; }

/* ===================== Print ===================== */
@media print {
    .sidebar, .navbar.app-navbar, .btn, .pagination, .no-print, .platform-mode-bar { display: none !important; }
    .main-content { margin: 0 !important; padding: 0 !important; }
    .card { box-shadow: none !important; border: 1px solid #DDD !important; }
    body { background: #fff !important; }
}
