/* ============================================================
   الهوية البصرية — متغيرات CSS قابلة للتخصيص لكل مستخدم
   ============================================================ */
:root {
    /* ألوان الهوية */
    --brand-primary:    #4ecba3;
    --brand-hover:      #5fd9b3;    /* ← لون hover الأزرار — قابل للتخصيص */
    --brand-font:       'Segoe UI', 'Cairo', system-ui, sans-serif;

    /* طبقات الخلفية */
    --bg-base:          #1a1f27;
    --bg-surface:       #222933;
    --bg-elevated:      #2a3140;
    --bg-hover:         #313d50;
    --bg-active:        #3a4860;

    /* الحدود */
    --border-subtle:    rgba(255,255,255,0.06);
    --border-default:   rgba(255,255,255,0.11);
    --border-strong:    rgba(255,255,255,0.20);

    /* النصوص */
    --text-primary:     #e8ecf2;
    --text-secondary:   #8896aa;
    --text-muted:       #506070;
    --text-on-brand:    #0f1a14;

    /* ألوان الحالات (ثابتة) */
    --green:    #4ecba3;
    --green-d:  rgba(78,203,163,0.14);
    --red:      #f06464;
    --red-d:    rgba(240,100,100,0.14);
    --yellow:   #f5c842;
    --yellow-d: rgba(245,200,66,0.14);
    --blue:     #5b9cf6;
    --blue-d:   rgba(91,156,246,0.14);
    --purple:   #a78bfa;

    /* ظلال */
    --shadow-sm: 0 2px 8px rgba(0,0,0,0.35);
    --shadow-md: 0 4px 16px rgba(0,0,0,0.45);
    --shadow-lg: 0 8px 32px rgba(0,0,0,0.55);

    /* زوايا */
    --r-sm: 6px;
    --r-md: 10px;
    --r-lg: 14px;
    --r-xl: 22px;

    --transition: all 0.18s ease;
}

/* ============================================================
   أساسيات
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: var(--brand-font);
    background-color: var(--bg-base);
    color: var(--text-primary);
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    font-size: 14px;
    line-height: 1.5;
}

/* ============================================================
   الهيدر
   ============================================================ */
header {
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border-subtle);
    padding: 0 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    height: 52px;
    flex-shrink: 0;
    z-index: 200;
    position: relative;
    overflow: visible;
}
.header-left   { display: flex; align-items: center; gap: 5px; overflow: visible; }
.header-actions{ display: flex; align-items: center; gap: 5px; overflow: visible; position: relative; }

#app-title {
    font-size: 13px; font-weight: 700;
    color: var(--text-secondary);
    margin: 0 6px; white-space: nowrap;
    max-width: 160px; overflow: hidden; text-overflow: ellipsis;
}

/* ============================================================
   نظام الأزرار — موحّد بالكامل
   ============================================================ */

/* الزر الأساسي — الجذر المشترك */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 5px;
    height: 30px;
    padding: 0 12px;
    border: 1px solid transparent;
    border-radius: var(--r-sm);
    cursor: pointer;
    font-family: var(--brand-font);
    font-size: 12px;
    font-weight: 600;
    line-height: 1;
    white-space: nowrap;
    transition: var(--transition);
    text-decoration: none;
    vertical-align: middle;
}

/* ✅ أزرار الهيدر — نمط واحد لكلها */
.header-btn {
    background: transparent;
    color: var(--text-secondary);
    border-color: var(--border-default);
}
.header-btn:hover {
    background: var(--bg-elevated);
    color: var(--text-primary);
    border-color: var(--border-strong);
}

/* الرئيسية فقط تأخذ لون البراند */
.header-btn-primary {
    background: var(--brand-primary);
    color: var(--text-on-brand);
    border-color: var(--brand-primary);
    font-weight: 700;
}
.header-btn-primary:hover {
    background: var(--brand-hover);
    border-color: var(--brand-hover);
    color: var(--text-on-brand);
}

/* ✅ الأزرار العامة في الصفحات */
.primary-btn {
    background: var(--brand-primary);
    color: var(--text-on-brand);
    border-color: var(--brand-primary);
    box-shadow: 0 2px 8px rgba(78,203,163,0.2);
}
.primary-btn:hover {
    background: var(--brand-hover);
    border-color: var(--brand-hover);
    box-shadow: 0 4px 14px rgba(78,203,163,0.35);
    transform: translateY(-1px);
}
.primary-btn:active { transform: none; box-shadow: none; }

.secondary-btn {
    background: transparent;
    color: var(--text-secondary);
    border-color: var(--border-default);
}
.secondary-btn:hover {
    background: var(--bg-elevated);
    color: var(--text-primary);
    border-color: var(--border-strong);
}

.danger-btn {
    background: transparent;
    color: var(--red);
    border-color: rgba(240,100,100,0.3);
}
.danger-btn:hover { background: var(--red); color: #fff; border-color: var(--red); }

/* زر اللغة */
.lang-btn, .header-btn-lang {
    background: transparent;
    color: var(--yellow);
    border: 1px solid rgba(245,200,66,0.3);
}
.lang-btn:hover, .header-btn-lang:hover {
    background: var(--yellow);
    color: #1a1a00;
    border-color: var(--yellow);
}

/* زر الخروج */
.header-btn-danger {
    background: transparent;
    color: var(--red);
    border-color: rgba(240,100,100,0.3);
}
.header-btn-danger:hover { background: var(--red); color: #fff; border-color: var(--red); }

/* زر الأيقونة */
.icon-btn {
    background: transparent; border: none; cursor: pointer;
    font-size: 16px; color: var(--text-secondary); padding: 5px;
    border-radius: var(--r-sm); transition: var(--transition);
    position: relative; display: inline-flex; align-items: center; justify-content: center;
    height: 30px; width: 30px;
}
.icon-btn:hover { background: var(--bg-elevated); color: var(--text-primary); }
.icon-btn:disabled { opacity: 0.25; cursor: not-allowed; }

.notification-badge {
    position: absolute; top: 1px; right: 1px;
    background: var(--red); color: white; font-size: 9px; font-weight: 700;
    border-radius: 50%; padding: 1px 3px; min-width: 14px; text-align: center; line-height: 1.4;
}

/* أزرار كامل العرض */
.btn-full { width: 100%; height: 42px; font-size: 14px; font-weight: 700; }

/* View selector */
.view-select {
    background: var(--bg-elevated); color: var(--text-secondary);
    border: 1px solid var(--border-default); border-radius: var(--r-sm);
    padding: 0 10px; font-size: 12px; font-family: var(--brand-font);
    outline: none; cursor: pointer; height: 30px; transition: var(--transition);
}
.view-select:focus { border-color: var(--brand-primary); color: var(--text-primary); }
.view-select option { background: var(--bg-elevated); }

/* ============================================================
   شريط البحث
   ============================================================ */
.search-container { position: relative; }
.search-input {
    padding: 0 14px; border-radius: var(--r-xl);
    border: 1px solid var(--border-default); outline: none;
    background: var(--bg-elevated); color: var(--text-primary);
    width: 180px; font-size: 12px; font-family: var(--brand-font);
    height: 30px; transition: var(--transition);
}
.search-input:focus {
    width: 240px; border-color: var(--brand-primary);
    box-shadow: 0 0 0 3px rgba(78,203,163,0.12);
}
.search-input::placeholder { color: var(--text-muted); }

/* ============================================================
   معلومات المستخدم في الهيدر
   ============================================================ */
.header-user-info {
    display: flex; align-items: center; gap: 6px;
    padding-right: 8px; margin-right: 4px; border-right: 1px solid var(--border-subtle);
}
[dir="ltr"] .header-user-info {
    padding-right: 0; padding-left: 8px; margin-right: 0; margin-left: 4px;
    border-right: none; border-left: 1px solid var(--border-subtle);
}
#display-logged-username {
    font-size: 12px; font-weight: 600; color: var(--text-secondary);
    cursor: pointer; transition: color 0.15s; white-space: nowrap;
}
#display-logged-username:hover { color: var(--brand-primary); }

/* زر العداد */
.timer-stopped {
    display: inline-flex; align-items: center; gap: 5px; height: 28px;
    background: transparent; color: var(--text-secondary);
    border: 1px solid var(--border-default); border-radius: var(--r-xl);
    padding: 0 10px; font-size: 11px; font-weight: 700;
    cursor: pointer; font-family: var(--brand-font); transition: var(--transition);
}
.timer-stopped:hover { background: var(--bg-elevated); color: var(--text-primary); }
.timer-running {
    display: inline-flex; align-items: center; gap: 5px; height: 28px;
    background: var(--green-d); color: var(--green);
    border: 1px solid rgba(78,203,163,0.35); border-radius: var(--r-xl);
    padding: 0 10px; font-size: 11px; font-weight: 700;
    cursor: pointer; font-family: var(--brand-font);
    animation: pulse-green 2s infinite;
}
@keyframes pulse-green {
    0%   { box-shadow: 0 0 0 0 rgba(78,203,163,0.4); }
    70%  { box-shadow: 0 0 0 5px rgba(78,203,163,0); }
    100% { box-shadow: 0 0 0 0 rgba(78,203,163,0); }
}

.board-active-users { display: flex; align-items: center; cursor: pointer; }
.board-active-users .avatar { margin-left: -7px; border: 2px solid var(--bg-surface); transition: transform 0.15s; }
[dir="rtl"] .board-active-users .avatar { margin-left: 0; margin-right: -7px; }
.board-active-users:hover .avatar { transform: translateY(-3px); }

/* ============================================================
   ✅ إصلاح الصفحات — الخلفية تغطي الشاشة كاملاً
   ============================================================ */
.page-view {
    display: none;
    width: 100%;
    flex: 1;
    /* ✅ خلفية تغطي الشاشة كاملاً */
    background: var(--bg-base);
    overflow-y: auto;
    height: calc(100vh - 52px);
}

/* ✅ اللوحة تحتاج معالجة خاصة — لا scroll عمودي */
#board-page-container {
    overflow-y: hidden !important;
    padding-bottom: 0;
    height: calc(100vh - 52px);
}

/* ✅ طريقة إصلاح الصفحات ذات المحتوى المحدود العرض:
   الصفحة نفسها = الخلفية الكاملة
   المحتوى الداخلي = محدود العرض بـ wrapper */
.page-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px 24px 48px;
}
.page-inner-wide  { max-width: 1400px; margin: 0 auto; padding: 24px 24px 48px; }
.page-inner-narrow{ max-width: 960px;  margin: 0 auto; padding: 28px 22px 48px; }

/* الصفحة الرئيسية */
#home-page-container { padding-top: 0; }
#home-page-container .home-sections-wrapper {
    max-width: 1200px; margin: 0 auto; padding: 24px 24px 48px;
    display: flex; flex-direction: column; gap: 24px;
}

/* ✅ مهامي — خلفية كاملة */
#my-tasks-page-container { padding: 0; }
#my-tasks-page-container > * { padding: 22px; }

/* ✅ فريقي — خلفية كاملة */
#team-page-container { padding: 22px; }

/* ✅ بروفايل — المحتوى محدود لكن الخلفية كاملة */
#profile-page-container { padding: 0; }
#profile-page-container > .profile-inner {
    max-width: 960px; margin: 0 auto; padding: 28px 22px 48px;
}

/* ✅ لوحة التحكم — خلفية كاملة */
#admin-page-container { padding: 0; }
#admin-page-container > .admin-inner {
    max-width: 1200px; margin: 0 auto; padding: 22px 22px 48px;
}

/* تسجيل الدخول */
#login-page-container {
    display: flex; justify-content: center; align-items: center;
    height: 100vh; background: var(--bg-base);
    position: absolute; top: 0; left: 0; width: 100%; z-index: 9999;
    background-image:
        radial-gradient(ellipse at 15% 60%, rgba(78,203,163,0.07) 0%, transparent 55%),
        radial-gradient(ellipse at 85% 20%, rgba(91,156,246,0.05) 0%, transparent 50%);
}
.login-box {
    background: var(--bg-surface); padding: 44px 36px;
    border-radius: var(--r-xl); box-shadow: var(--shadow-lg);
    width: 400px; max-width: 92%; text-align: center;
    border: 1px solid var(--border-default);
}
.login-box h2 { color: var(--brand-primary); margin-bottom: 8px; font-size: 22px; font-weight: 800; }
.login-box p  { color: var(--text-secondary); margin-bottom: 28px; font-size: 13px; }
.login-box select {
    width: 100%; padding: 0 14px; margin-bottom: 14px;
    border: 1px solid var(--border-default); border-radius: var(--r-md);
    font-size: 13px; font-family: var(--brand-font); outline: none;
    background: var(--bg-elevated); color: var(--text-primary);
    cursor: pointer; transition: var(--transition); height: 42px;
}
.login-box select:focus { border-color: var(--brand-primary); box-shadow: 0 0 0 3px rgba(78,203,163,0.15); }
.login-box select option { background: var(--bg-elevated); }

/* ============================================================
   قسم الهوية البصرية + إعدادات المستخدم
   ============================================================ */
.brand-settings-section {
    background: var(--bg-surface);
    border-radius: var(--r-lg); padding: 22px;
    border: 1px solid var(--border-subtle); margin-bottom: 20px;
}
.brand-settings-section h3 {
    margin-bottom: 18px; padding-bottom: 12px;
    border-bottom: 1px solid var(--border-subtle);
    font-size: 15px; font-weight: 700; color: var(--text-primary);
}
.brand-colors-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 14px; margin-bottom: 16px;
}
.brand-color-item { display: flex; flex-direction: column; gap: 7px; }
.brand-color-item label {
    font-size: 11px; font-weight: 700; color: var(--text-muted);
    text-transform: uppercase; letter-spacing: 0.6px;
}
.brand-color-preview {
    display: flex; align-items: center; gap: 10px;
    background: var(--bg-elevated); padding: 9px 12px;
    border-radius: var(--r-sm); border: 1px solid var(--border-default);
    cursor: pointer; transition: var(--transition);
}
.brand-color-preview:hover { border-color: var(--brand-primary); }
.brand-color-swatch {
    width: 28px; height: 28px; border-radius: var(--r-sm);
    border: 2px solid rgba(255,255,255,0.12); flex-shrink: 0; cursor: pointer;
}
.brand-color-hex {
    font-size: 12px; font-weight: 600; color: var(--text-primary);
    font-family: 'Courier New', monospace;
}

/* Font picker */
.brand-font-select {
    width: 100%; padding: 0 12px; height: 38px;
    border: 1px solid var(--border-default); border-radius: var(--r-sm);
    background: var(--bg-elevated); color: var(--text-primary);
    font-size: 13px; font-family: var(--brand-font);
    outline: none; cursor: pointer; transition: var(--transition);
}
.brand-font-select:focus { border-color: var(--brand-primary); }
.brand-font-select option { background: var(--bg-elevated); }

/* Emoji style picker */
.emoji-style-select {
    width: 100%; padding: 0 12px; height: 38px;
    border: 1px solid var(--border-default); border-radius: var(--r-sm);
    background: var(--bg-elevated); color: var(--text-primary);
    font-size: 13px; font-family: var(--brand-font);
    outline: none; cursor: pointer; transition: var(--transition);
}
.emoji-style-select:focus { border-color: var(--brand-primary); }
.emoji-style-select option { background: var(--bg-elevated); }

/* Preview strip */
.brand-preview-strip {
    background: var(--bg-elevated); border-radius: var(--r-sm);
    padding: 12px 16px; border: 1px solid var(--border-subtle);
    display: flex; gap: 12px; align-items: center; flex-wrap: wrap;
    margin-bottom: 14px;
}
.brand-preview-strip span { font-size: 12px; color: var(--text-muted); }
.preview-btn-sample {
    background: var(--brand-primary); color: var(--text-on-brand);
    border: none; border-radius: var(--r-sm); padding: 5px 12px;
    font-size: 12px; font-weight: 700; font-family: var(--brand-font);
}
.preview-btn-sample.hover-preview {
    background: var(--brand-hover);
}

/* ============================================================
   بطاقات الصفحات الداخلية
   ============================================================ */
.home-section {
    background: var(--bg-surface);
    border-radius: var(--r-lg); padding: 22px;
    border: 1px solid var(--border-subtle);
}
.home-section h2, .home-section h3 {
    margin-bottom: 16px; padding-bottom: 12px;
    border-bottom: 1px solid var(--border-subtle);
    color: var(--text-primary); font-size: 15px; font-weight: 700;
}

.admin-header { display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--border-subtle); padding-bottom: 14px; margin-bottom: 20px; }
.admin-header h2 { font-size: 17px; font-weight: 800; }
.admin-grid { display: grid; grid-template-columns: 1fr; gap: 20px; }
#admin-dashboard-btn {
    display: none; background: transparent; color: var(--yellow);
    border: 1px solid rgba(245,200,66,0.3); font-weight: 700;
    padding: 0 13px; border-radius: var(--r-sm); cursor: pointer;
    font-size: 12px; font-family: var(--brand-font); height: 30px;
    transition: var(--transition);
}
#admin-dashboard-btn:hover { background: var(--yellow); color: #1a1a00; }

/* ============================================================
   اللوحات والبطاقات
   ============================================================ */
.boards-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.board-card {
    height: 115px; border-radius: var(--r-md); padding: 15px;
    font-weight: 700; font-size: 14px; cursor: pointer;
    display: flex; flex-direction: column; justify-content: space-between;
    box-shadow: var(--shadow-sm); transition: var(--transition);
    position: relative; overflow: hidden;
}
.board-card::after { content:''; position:absolute; inset:0; background:rgba(255,255,255,0); transition:background .15s; }
.board-card:hover::after { background: rgba(255,255,255,0.07); }
.board-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.board-card.create-new-board {
    background: var(--bg-elevated) !important; color: var(--text-muted) !important;
    justify-content: center; align-items: center;
    border: 1px dashed var(--border-default); box-shadow: none; font-size: 13px; font-weight: 600;
}
.board-card.create-new-board:hover { background: var(--bg-hover) !important; border-color: var(--brand-primary); color: var(--brand-primary) !important; }
.board-card.create-new-board::after { display: none; }
.board-members-preview { display: flex; align-items: center; }
.board-members-preview .avatar { width: 20px; height: 20px; font-size: 9px; margin-left: -4px; border: 2px solid rgba(0,0,0,0.25); }
[dir="rtl"] .board-members-preview .avatar { margin-left: 0; margin-right: -4px; }

.avatar {
    width: 28px; height: 28px; border-radius: 50%;
    display: flex; justify-content: center; align-items: center;
    color: white; font-size: 12px; font-weight: 700; flex-shrink: 0;
    box-shadow: 0 1px 4px rgba(0,0,0,0.3);
}

/* اللوحة الداخلية */
.content-wrapper { display: flex; flex-grow: 1; overflow: hidden; width: 100%; position: relative; }
.board-container {
    display: flex; padding: 14px; gap: 12px;
    overflow-x: auto; overflow-y: hidden; flex-grow: 1; align-items: flex-start; height: 100%;
}
.board-container::-webkit-scrollbar { height: 6px; }
.board-container::-webkit-scrollbar-thumb { background: var(--border-default); border-radius: 4px; }

.column {
    background: var(--bg-surface); min-width: 282px; max-width: 282px;
    border-radius: var(--r-md); padding: 10px;
    display: flex; flex-direction: column;
    max-height: calc(100vh - 85px);
    border: 1px solid var(--border-subtle); box-shadow: var(--shadow-sm);
}
.column.column-dragging { opacity: 0.45; transform: scale(0.97); z-index: 500; }

.column-header-container {
    display: flex; justify-content: space-between; align-items: center;
    padding: 3px 2px 8px 2px; cursor: grab; flex-shrink: 0; gap: 5px;
    overflow: visible;
}
.column-header-container:active { cursor: grabbing; }
.column-header { font-weight: 700; font-size: 13px; flex-grow: 1; color: inherit; pointer-events: none; }

/* ✅ زر ··· الأعمدة — مرئي دائماً */
.column-header-container .menu-btn {
    background: transparent; border: none; cursor: pointer;
    font-size: 16px; font-weight: 700; color: inherit;
    padding: 2px 6px; border-radius: var(--r-sm);
    opacity: 0.45; transition: opacity .15s, background .15s;
    pointer-events: auto; flex-shrink: 0; position: static;
    font-family: inherit; line-height: 1;
}
.column-header-container .menu-btn:hover { opacity: 1; background: rgba(255,255,255,0.1); }
.column-header-container:hover .menu-btn { opacity: 0.8; }

/* ✅ زر ··· البطاقات */
.card .menu-btn {
    position: absolute; top: 5px; opacity: 0;
    background: transparent; border: none; cursor: pointer;
    font-size: 15px; font-weight: 700; color: inherit;
    padding: 2px 5px; border-radius: var(--r-sm);
    transition: opacity .15s, background .15s; pointer-events: auto;
    font-family: inherit; line-height: 1;
}
[dir="rtl"] .card .menu-btn { right: auto; left: 5px; }
[dir="ltr"] .card .menu-btn { right: 5px; left: auto; }
.card:hover .menu-btn { opacity: 0.7; }
.menu-btn:hover { background: rgba(255,255,255,0.1); opacity: 1 !important; }

/* زر ··· التقويم */
.calendar-card .menu-btn { position: absolute; top: 2px; opacity: 0; font-size: 13px; padding: 1px 4px; }
[dir="rtl"] .calendar-card .menu-btn { right: auto; left: 2px; }
[dir="ltr"] .calendar-card .menu-btn { right: 2px; left: auto; }
.calendar-card:hover .menu-btn { opacity: 0.8; }

.cards-container {
    display: flex; flex-direction: column; gap: 7px; min-height: 10px;
    padding-bottom: 8px; overflow-y: auto; flex-grow: 1;
}
.cards-container::-webkit-scrollbar { width: 4px; }
.cards-container::-webkit-scrollbar-thumb { background: var(--border-default); border-radius: 4px; }

.add-card-btn {
    background: none; border: none; color: var(--text-muted); text-align: start;
    padding: 6px 4px; cursor: pointer; font-weight: 600; font-size: 12px;
    font-family: var(--brand-font); flex-shrink: 0; border-radius: var(--r-sm);
    transition: var(--transition);
}
.add-card-btn:hover { background: var(--bg-elevated); color: var(--text-primary); padding-right: 8px; }

.add-column-wrapper { display: flex; align-items: flex-start; flex-shrink: 0; }
.add-column-inline-btn {
    background: rgba(255,255,255,0.04); color: var(--text-muted);
    border: 1px dashed var(--border-default); border-radius: var(--r-md);
    padding: 0 16px; font-size: 12px; font-weight: 600; font-family: var(--brand-font);
    cursor: pointer; white-space: nowrap; transition: var(--transition);
    min-width: 190px; height: 38px; display: flex; align-items: center;
}
.add-column-inline-btn:hover { background: var(--bg-elevated); border-color: var(--brand-primary); color: var(--brand-primary); }

/* البطاقة */
.card {
    background: var(--bg-elevated); padding: 10px;
    border-radius: var(--r-sm); box-shadow: var(--shadow-sm);
    cursor: grab; word-wrap: break-word; position: relative;
    transition: box-shadow .15s, transform .15s, background .15s;
    border: 1px solid var(--border-subtle);
}
.card:hover { background: var(--bg-hover); box-shadow: var(--shadow-md); transform: translateY(-1px); border-color: var(--border-default); }
.card.dragging { opacity: 0.4; z-index: 1000; transform: rotate(1.5deg); cursor: grabbing; }
.card.selected-card { box-shadow: 0 0 0 2px var(--brand-primary), var(--shadow-md) !important; background: var(--bg-active) !important; border-color: var(--brand-primary) !important; }
.card.hidden-by-search { display: none !important; }
.card.drag-over-file { border: 2px dashed var(--brand-primary) !important; background: rgba(78,203,163,0.07) !important; }

.card-cover { width: calc(100% + 20px); height: 120px; object-fit: cover; border-radius: 5px 5px 0 0; margin: -10px -10px 10px -10px; display: block; border-bottom: 1px solid var(--border-subtle); pointer-events: none; user-select: none; }
.card-title-area { display: flex; align-items: flex-start; margin-bottom: 5px; padding-right: 18px; }
[dir="ltr"] .card-title-area { padding-right: 0; padding-left: 18px; }
.card-title-text { font-size: 13px; line-height: 1.45; color: inherit; }
.card-completed-icon { color: var(--green); font-size: 12px; margin-left: 4px; flex-shrink: 0; }
[dir="ltr"] .card-completed-icon { margin-left: 0; margin-right: 4px; }
.card-labels-preview { display: flex; flex-wrap: wrap; gap: 3px; margin-bottom: 5px; }
.card-label-indicator { height: 5px; min-width: 32px; border-radius: 3px; cursor: pointer; font-size: 0; color: transparent; display: inline-block; transition: all .15s; }
.card-label-indicator.expanded { height: auto; padding: 2px 6px; font-size: 11px; font-weight: 600; color: white; text-shadow: 0 1px 2px rgba(0,0,0,0.4); }
.card-dates-container { display: flex; flex-wrap: wrap; gap: 3px; margin-bottom: 6px; }
.date-badge { padding: 2px 6px; border-radius: 4px; font-size: 10px; font-weight: 600; }
.date-badge.future   { background: var(--bg-base); color: var(--text-secondary); border: 1px solid var(--border-default); }
.date-badge.current  { background: var(--yellow-d); color: var(--yellow); border: 1px solid rgba(245,200,66,0.3); }
.date-badge.overdue  { background: var(--red-d); color: var(--red); border: 1px solid rgba(240,100,100,0.3); }
.date-badge.completed{ background: var(--green-d); color: var(--green); border: 1px solid rgba(78,203,163,0.3); }
.card-footer { display: flex; justify-content: space-between; align-items: center; margin-top: 6px; padding-top: 5px; border-top: 1px solid var(--border-subtle); }

/* ============================================================
   القائمة المنسدلة الطافية
   ============================================================ */
.floating-dropdown {
    position: fixed; z-index: 99999;
    background: var(--bg-elevated); min-width: 170px;
    box-shadow: var(--shadow-lg); border-radius: var(--r-md);
    padding: 5px; display: none; border: 1px solid var(--border-default);
}
.floating-dropdown.show { display: block; }
.dropdown-item {
    padding: 6px 11px; display: flex; align-items: center;
    color: var(--text-secondary); cursor: pointer; font-size: 12px;
    background: none; border: none; width: 100%; text-align: start;
    gap: 7px; font-family: var(--brand-font); border-radius: var(--r-sm); transition: var(--transition);
}
.dropdown-item:hover { background: var(--bg-hover); color: var(--text-primary); }
.dropdown-item.danger { color: var(--red); }
.dropdown-item.danger:hover { background: var(--red-d); color: var(--red); }
.dropdown-item-label-preview { display: inline-block; width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; margin-left: 5px; vertical-align: middle; }
[dir="ltr"] .dropdown-item-label-preview { margin-left: 0; margin-right: 5px; }
.color-item-wrapper { position: relative; overflow: hidden; }
.color-item-wrapper input[type="color"] { position: absolute; right: 0; top: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }

/* ============================================================
   شريط التحديد المتعدد
   ============================================================ */
.bulk-actions-bar {
    position: fixed; top: -70px; left: 50%; transform: translateX(-50%);
    background: var(--bg-elevated); padding: 8px 16px; border-radius: var(--r-xl);
    box-shadow: var(--shadow-lg); display: flex; align-items: center;
    gap: 12px; z-index: 1000;
    transition: top 0.3s cubic-bezier(0.34,1.56,0.64,1);
    color: var(--text-primary); font-weight: 600; font-size: 12px;
    border: 1px solid var(--border-default);
}
.bulk-actions-bar.active { top: 12px; }
.bulk-buttons { display: flex; gap: 6px; flex-wrap: wrap; }
.bulk-buttons select {
    background: var(--bg-hover); border: 1px solid var(--border-default);
    border-radius: var(--r-sm); padding: 0 8px; font-size: 12px;
    font-family: var(--brand-font); outline: none; cursor: pointer; color: var(--text-primary); height: 28px;
}

/* ============================================================
   الحركة والـ Split
   ============================================================ */
.is-panning-mode { cursor: grab !important; }
.is-panning-mode * { pointer-events: none !important; user-select: none !important; }
.panning-active { cursor: grabbing !important; }
.ctrl-pressed-mode .card { cursor: cell !important; }
.resizer { display: none; width: 5px; background: var(--border-subtle); cursor: col-resize; z-index: 10; transition: background .15s; }
.resizer:hover, .resizer.is-resizing { background: var(--brand-primary); }
.is-resizing-body * { user-select: none !important; pointer-events: none !important; }
.content-wrapper.split-mode #board { width: 35%; flex: none !important; }
.content-wrapper.split-mode .resizer { display: block; flex: none !important; }
.content-wrapper.split-mode #calendar-view { width: calc(65% - 5px); flex: none !important; margin: 0; border-radius: 0; box-shadow: none; display: flex !important; }
.content-wrapper.split-mode .card.has-date { display: none !important; }

/* ============================================================
   التقويم
   ============================================================ */
.calendar-container { padding: 16px; flex-grow: 1; display: flex; flex-direction: column; background: var(--bg-surface); margin: 12px; border-radius: var(--r-lg); overflow-y: auto; border: 1px solid var(--border-subtle); }
.calendar-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; color: var(--text-primary); }
.calendar-grid-header { display: grid; grid-template-columns: repeat(7, 1fr); text-align: center; font-weight: 700; font-size: 11px; color: var(--text-muted); margin-bottom: 7px; padding-bottom: 7px; border-bottom: 1px solid var(--border-subtle); text-transform: uppercase; letter-spacing: 0.5px; }
.calendar-grid { display: grid; grid-template-columns: repeat(7, 1fr); grid-auto-rows: minmax(90px, auto); gap: 5px; flex-grow: 1; }
.calendar-day { border: 1px solid var(--border-subtle); border-radius: 5px; padding: 5px; display: flex; flex-direction: column; gap: 3px; background: var(--bg-elevated); transition: background .15s; position: relative; }
.calendar-day:hover { background: var(--bg-hover); }
.calendar-day.empty { background: transparent; border: none; }
.calendar-day.drag-over { background: rgba(78,203,163,0.08); border: 1px dashed var(--brand-primary); }
.day-header-area { display: flex; justify-content: space-between; align-items: center; margin-bottom: 3px; }
.calendar-date-num { font-weight: 700; font-size: 11px; color: var(--text-muted); }
.add-to-day-btn { background: none; border: none; color: var(--text-muted); font-size: 14px; font-weight: 700; cursor: pointer; opacity: 0; transition: opacity .15s; padding: 0 3px; }
.calendar-day:hover .add-to-day-btn { opacity: 1; }
.calendar-card { font-size: 11px; padding: 3px 6px; border-radius: 4px; cursor: grab; box-shadow: var(--shadow-sm); display: flex; flex-direction: column; position: relative; transition: filter .15s, transform .15s; border: 1px solid rgba(255,255,255,0.07); }
.calendar-card:hover { filter: brightness(1.12); transform: translateY(-1px); }
.calendar-card.dragging { opacity: 0.5; cursor: grabbing; }
.calendar-card-labels { display: flex; gap: 2px; margin-bottom: 2px; }
.calendar-mini-label { height: 3px; width: 9px; border-radius: 2px; }
.calendar-card-header { display: flex; justify-content: space-between; align-items: flex-start; padding-right: 13px; }
[dir="ltr"] .calendar-card-header { padding-right: 0; padding-left: 13px; }
.calendar-card-title-wrapper { display: flex; align-items: center; overflow: hidden; flex-grow: 1; gap: 3px; }
.calendar-card-title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: inherit; }
.calendar-avatar { width: 12px; height: 12px; border-radius: 50%; font-size: 7px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; color: white; font-weight: 700; }
.calendar-card-column-badge { font-size: 9px; padding: 1px 4px; border-radius: 8px; margin-top: 3px; display: inline-block; align-self: flex-start; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; opacity: 0.8; }

/* ============================================================
   النوافذ المنبثقة
   ============================================================ */
.modal { display: none; position: fixed; z-index: 2000; left: 0; top: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.65); backdrop-filter: blur(3px); justify-content: center; align-items: center; }
.modal-content { background: var(--bg-surface); padding: 24px; border-radius: var(--r-lg); position: relative; color: var(--text-primary); border: 1px solid var(--border-default); box-shadow: var(--shadow-lg); }
.modal-content.large-modal { width: 760px; max-width: 95%; max-height: 90vh; overflow-y: auto; }
.modal-content.drag-over-file { border: 2px dashed var(--brand-primary) !important; background: rgba(78,203,163,0.05) !important; }
.modal-content::-webkit-scrollbar { width: 5px; }
.modal-content::-webkit-scrollbar-thumb { background: var(--border-default); border-radius: 4px; }
.close-btn { position: absolute; font-size: 20px; cursor: pointer; color: var(--text-muted); transition: color .15s; line-height: 1; background: none; border: none; padding: 4px; }
.close-btn:hover { color: var(--text-primary); }
[dir="rtl"] .close-btn { left: 16px; top: 14px; }
[dir="ltr"] .close-btn { right: 16px; top: 14px; }
.modal-body { display: flex; gap: 20px; margin-top: 16px; }
.main-details { flex: 3; display: flex; flex-direction: column; gap: 16px; }
.sidebar-details { flex: 1; min-width: 165px; display: flex; flex-direction: column; gap: 12px; }
.modal-header-actions { display: flex; align-items: center; gap: 10px; }
#modal-card-title { font-size: 16px; font-weight: 700; }
.detail-section h3, .detail-section h4 { margin-bottom: 6px; color: var(--text-muted); font-size: 10px; text-transform: uppercase; letter-spacing: 0.9px; font-weight: 700; }
.modal-textarea, .modal-input { width: 100%; padding: 8px 11px; border: 1px solid var(--border-default); border-radius: var(--r-sm); font-family: var(--brand-font); font-size: 13px; outline: none; background: var(--bg-elevated); color: var(--text-primary); transition: var(--transition); }
.modal-textarea:focus, .modal-input:focus { border-color: var(--brand-primary); box-shadow: 0 0 0 3px rgba(78,203,163,0.13); }
.modal-textarea { min-height: 75px; resize: vertical; }
.modal-input option { background: var(--bg-elevated); }
.inline-edit-input, .inline-input { width: 100%; padding: 4px 7px; font-family: var(--brand-font); font-size: inherit; border: 2px solid var(--brand-primary); border-radius: var(--r-sm); outline: none; background: var(--bg-elevated); color: var(--text-primary); box-shadow: 0 0 0 3px rgba(78,203,163,0.12); }

/* ============================================================
   السجلات والتعليقات
   ============================================================ */
.logs-list { display: flex; flex-direction: column; gap: 8px; }
.log-item { position: relative; padding-right: 12px; border-right: 2px solid var(--brand-primary); margin-bottom: 2px; }
[dir="ltr"] .log-item { padding-right: 0; padding-left: 12px; border-right: none; border-left: 2px solid var(--brand-primary); }
.log-item::before { content:''; position:absolute; top:5px; right:-5px; width:8px; height:8px; border-radius:50%; background:var(--brand-primary); border:2px solid var(--bg-surface); }
[dir="ltr"] .log-item::before { right:auto; left:-5px; }
.log-time { font-size: 10px; color: var(--text-muted); font-weight: 600; display: block; margin-bottom: 2px; }
.log-text { font-size: 12px; color: var(--text-secondary); }
.log-card-ref { color: var(--brand-primary); cursor: pointer; font-size: 11px; }
.log-card-ref:hover { text-decoration: underline; }
.comments-list { display: flex; flex-direction: column; gap: 7px; margin-top: 7px; }
.comment-item { background: var(--bg-elevated); padding: 8px 11px; border-radius: var(--r-sm); border: 1px solid var(--border-subtle); }
.comment-date { font-size: 10px; color: var(--text-muted); display: block; margin-bottom: 3px; }

/* التصنيفات */
.global-labels-list { display: flex; flex-direction: column; gap: 7px; }
.global-label-row { display: flex; align-items: center; gap: 6px; }
.global-label-checkbox { width: 14px; height: 14px; cursor: pointer; accent-color: var(--brand-primary); }
.global-label-input { flex-grow: 1; padding: 5px 8px; border: 1px solid var(--border-default); border-radius: var(--r-sm); font-size: 12px; background: var(--bg-elevated); color: var(--text-primary); outline: none; font-family: var(--brand-font); }
.global-label-input:focus { border-color: var(--brand-primary); }
.color-picker { width: 24px; height: 24px; border: none; border-radius: 50%; cursor: pointer; padding: 0; background: none; }

/* ============================================================
   جداول الموظفين والصلاحيات
   ============================================================ */
.table-wrapper { background: var(--bg-elevated); border-radius: var(--r-md); border: 1px solid var(--border-subtle); overflow: hidden; }
.company-users-table { width: 100%; border-collapse: collapse; text-align: right; }
[dir="ltr"] .company-users-table { text-align: left; }
.company-users-table th, .company-users-table td { padding: 10px 13px; border-bottom: 1px solid var(--border-subtle); font-size: 13px; }
.company-users-table th { background: var(--bg-surface); color: var(--text-muted); font-weight: 700; font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; }
.company-users-table tr:hover td { background: var(--bg-hover); }
.company-users-table tr:last-child td { border-bottom: none; }
.role-badge { padding: 2px 8px; border-radius: var(--r-xl); font-size: 11px; font-weight: 700; display: inline-block; }
.role-admin    { background: var(--green-d); color: var(--green); }
.role-manager  { background: var(--yellow-d); color: var(--yellow); }
.role-supervisor { background: var(--blue-d); color: var(--blue); }
.role-employee { background: rgba(167,139,250,0.14); color: var(--purple); }
.role-client   { background: var(--red-d); color: var(--red); }
.role-guest    { background: var(--bg-hover); color: var(--text-muted); }
.permissions-table { width: 100%; border-collapse: collapse; text-align: center; background: var(--bg-elevated); border-radius: var(--r-md); overflow: hidden; border: 1px solid var(--border-subtle); }
.permissions-table th { background: var(--bg-surface); padding: 10px; border-bottom: 1px solid var(--border-subtle); color: var(--text-muted); font-size: 11px; font-weight: 700; }
.permissions-table td { padding: 8px 10px; border-bottom: 1px solid var(--border-subtle); color: var(--text-secondary); font-size: 12px; }
.permissions-table tr:hover td { background: var(--bg-hover); }
.role-col-header { text-align: start !important; font-weight: 700; color: var(--text-primary) !important; }
.permissions-table td input[type="checkbox"] { width: 14px; height: 14px; cursor: pointer; accent-color: var(--brand-primary); }
.custom-perms-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; padding: 12px; background: var(--bg-elevated); border-radius: var(--r-sm); border: 1px solid var(--border-subtle); }
.perm-check-label { display: flex; align-items: center; gap: 6px; font-size: 12px; cursor: pointer; color: var(--text-secondary); }
.perm-check-label input { accent-color: var(--brand-primary); }
.disabled-input { opacity: 0.3; pointer-events: none; }

/* ============================================================
   البروفايل
   ============================================================ */
.profile-header-card { background: var(--bg-surface); border-radius: var(--r-lg); padding: 24px; box-shadow: var(--shadow-sm); display: flex; align-items: center; gap: 16px; margin-bottom: 18px; border: 1px solid var(--border-subtle); border-top: 3px solid var(--brand-primary); }
.profile-avatar-large { width: 70px; height: 70px; border-radius: 50%; display: flex; justify-content: center; align-items: center; color: white; font-size: 26px; font-weight: 800; flex-shrink: 0; }
.profile-info h2 { margin-bottom: 4px; font-size: 18px; font-weight: 800; }
.profile-info p  { color: var(--text-secondary); font-size: 13px; margin-bottom: 3px; }
.profile-filters { background: var(--bg-surface); padding: 12px 15px; border-radius: var(--r-md); margin-bottom: 16px; display: flex; gap: 10px; align-items: center; border: 1px solid var(--border-subtle); border-right: 3px solid var(--brand-primary); flex-wrap: wrap; }
[dir="ltr"] .profile-filters { border-right: 1px solid var(--border-subtle); border-left: 3px solid var(--brand-primary); }
.profile-filters h4 { color: var(--text-secondary); margin: 0; font-size: 13px; font-weight: 600; }
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 11px; margin-bottom: 18px; }
.stat-card { background: var(--bg-surface); border-radius: var(--r-md); padding: 16px; text-align: center; border: 1px solid var(--border-subtle); transition: var(--transition); }
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.stat-card h3 { font-size: 30px; margin-bottom: 5px; font-weight: 800; }
.stat-card p  { font-size: 11px; color: var(--text-muted); font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; }
.stat-total    { border-bottom: 3px solid var(--brand-primary); } .stat-total h3    { color: var(--brand-primary); }
.stat-completed{ border-bottom: 3px solid var(--green); }         .stat-completed h3{ color: var(--green); }
.stat-pending  { border-bottom: 3px solid var(--yellow); }        .stat-pending h3  { color: var(--yellow); }
.stat-overdue  { border-bottom: 3px solid var(--red); }           .stat-overdue h3  { color: var(--red); }
.hours-summary-card { background: linear-gradient(135deg, #1e3a2f, #152b22); padding: 16px 22px; border-radius: var(--r-md); margin-bottom: 16px; display: flex; justify-content: space-around; align-items: center; box-shadow: 0 4px 20px rgba(78,203,163,0.15); flex-wrap: wrap; gap: 12px; border: 1px solid rgba(78,203,163,0.2); }
.hours-stat { text-align: center; }
.hours-stat h2 { font-size: 26px; margin-bottom: 3px; font-weight: 800; color: var(--brand-primary); }
.hours-stat p  { font-size: 11px; opacity: 0.7; text-transform: uppercase; letter-spacing: 0.5px; }
.hours-divider { width: 1px; height: 38px; background: rgba(255,255,255,0.1); }
@media (max-width: 600px) { .hours-divider { display: none; } }
.charts-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 18px; }
.chart-container { background: var(--bg-surface); padding: 16px; border-radius: var(--r-md); border: 1px solid var(--border-subtle); position: relative; width: 100%; height: 260px; }
@media (max-width: 900px) { .charts-grid { grid-template-columns: 1fr; } }

/* ============================================================
   جداول الدوام
   ============================================================ */
.timesheet-table { width: 100%; border-collapse: collapse; background: var(--bg-elevated); text-align: right; }
[dir="ltr"] .timesheet-table { text-align: left; }
.timesheet-table th, .timesheet-table td { padding: 9px 12px; border-bottom: 1px solid var(--border-subtle); font-size: 12px; }
.timesheet-table th { background: var(--bg-surface); color: var(--text-muted); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; position: sticky; top: 0; z-index: 2; }
.timesheet-table tr:hover td { background: var(--bg-hover); }
.timesheet-wrapper { max-height: 220px; overflow-x: auto; transition: max-height 0.4s ease-in-out; border-bottom: 1px solid var(--border-subtle); border-radius: var(--r-md) var(--r-md) 0 0; overflow: hidden; }
.timesheet-wrapper.expanded { max-height: 2000px; }
.expand-table-btn { width: 100%; padding: 8px; background: var(--bg-elevated); border: none; border-top: 1px solid var(--border-subtle); border-radius: 0 0 var(--r-md) var(--r-md); color: var(--brand-primary); font-weight: 700; cursor: pointer; font-size: 12px; font-family: var(--brand-font); transition: background .15s; }
.expand-table-btn:hover { background: var(--bg-hover); }
.schedule-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; margin-top: 12px; }
.day-schedule { background: var(--bg-elevated); padding: 8px; border-radius: var(--r-sm); text-align: center; border: 1px solid var(--border-subtle); }
.day-schedule h4 { font-size: 10px; color: var(--text-muted); margin-bottom: 5px; text-transform: uppercase; }
.day-schedule input { width: 100%; text-align: center; padding: 4px; border: 1px solid var(--border-default); border-radius: var(--r-sm); background: var(--bg-base); color: var(--text-primary); font-size: 13px; font-weight: 700; font-family: var(--brand-font); outline: none; }
.day-schedule input:focus { border-color: var(--brand-primary); }

/* ============================================================
   مهامي
   ============================================================ */
#my-tasks-btn { display: none; background: transparent; color: var(--text-secondary); border: 1px solid var(--border-default); font-weight: 600; padding: 0 12px; border-radius: var(--r-sm); cursor: pointer; font-size: 12px; font-family: var(--brand-font); height: 30px; transition: var(--transition); }
#my-tasks-btn:hover { background: var(--bg-elevated); color: var(--text-primary); }
.my-tasks-grid { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 16px; align-items: flex-start; }
.task-group-col { background: var(--bg-surface); border-radius: var(--r-md); width: 280px; min-width: 280px; max-height: calc(100vh - 130px); display: flex; flex-direction: column; border: 1px solid var(--border-subtle); }
.task-group-header { padding: 12px 14px; font-weight: 700; font-size: 13px; border-bottom: 1px solid var(--border-subtle); display: flex; justify-content: space-between; align-items: center; }
.task-group-header span:last-child { background: var(--bg-elevated); padding: 1px 7px; border-radius: var(--r-xl); font-size: 11px; color: var(--text-muted); }
.task-group-cards { padding: 8px; overflow-y: auto; flex-grow: 1; display: flex; flex-direction: column; gap: 6px; }
.group-overdue   .task-group-header { color: var(--red);           border-top: 2px solid var(--red);           border-radius: var(--r-md) var(--r-md) 0 0; }
.group-today     .task-group-header { color: var(--yellow);        border-top: 2px solid var(--yellow);        border-radius: var(--r-md) var(--r-md) 0 0; }
.group-upcoming  .task-group-header { color: var(--brand-primary); border-top: 2px solid var(--brand-primary); border-radius: var(--r-md) var(--r-md) 0 0; }
.group-completed .task-group-header { color: var(--green);         border-top: 2px solid var(--green);         border-radius: var(--r-md) var(--r-md) 0 0; }
.my-task-card { background: var(--bg-elevated); padding: 10px; border-radius: var(--r-sm); cursor: pointer; border: 1px solid var(--border-subtle); transition: var(--transition); }
.my-task-card:hover { transform: translateY(-1px); box-shadow: var(--shadow-md); border-color: var(--border-default); }
.my-task-board-name { font-size: 10px; color: var(--text-muted); margin-bottom: 4px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.4px; }
.my-task-title { font-size: 13px; color: var(--text-primary); margin-bottom: 6px; line-height: 1.4; }
.my-task-meta  { display: flex; justify-content: space-between; font-size: 11px; color: var(--text-muted); }

/* ============================================================
   لوحة الفريق
   ============================================================ */
.team-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 13px; margin-top: 16px; }
.team-member-card { background: var(--bg-surface); border-radius: var(--r-md); padding: 17px; border: 1px solid var(--border-subtle); border-top: 2px solid var(--border-default); transition: var(--transition); }
.team-member-card:hover { box-shadow: var(--shadow-md); }
.team-member-card.is-online { border-top-color: var(--green); }
.team-member-header { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; border-bottom: 1px solid var(--border-subtle); padding-bottom: 12px; }
.status-indicator { width: 7px; height: 7px; border-radius: 50%; background: var(--border-default); display: inline-block; margin-right: 3px; }
[dir="ltr"] .status-indicator { margin-right: 0; margin-left: 3px; }
.status-indicator.online { background: var(--green); box-shadow: 0 0 5px var(--green); }
.team-tasks-list { margin-top: 6px; font-size: 12px; }
.team-task-item { padding: 5px 8px; background: var(--bg-elevated); border: 1px solid var(--border-subtle); border-radius: var(--r-sm); margin-bottom: 4px; display: flex; justify-content: space-between; gap: 6px; }

/* ============================================================
   المرفقات وعارض الوسائط
   ============================================================ */
.attachments-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(125px, 1fr)); gap: 8px; margin-top: 10px; }
.attachment-item { border: 1px solid var(--border-subtle); border-radius: var(--r-sm); overflow: hidden; position: relative; background: var(--bg-elevated); transition: var(--transition); cursor: pointer; display: flex; flex-direction: column; }
.attachment-item:hover { box-shadow: var(--shadow-md); border-color: var(--border-default); }
.attachment-preview { height: 80px; background: var(--bg-base); display: flex; justify-content: center; align-items: center; overflow: hidden; font-size: 24px; color: var(--text-muted); }
.attachment-preview img, .attachment-preview video { width: 100%; height: 100%; object-fit: cover; }
.attachment-info { padding: 6px; font-size: 11px; }
.attachment-name { font-weight: 600; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-bottom: 2px; }
.attachment-meta { color: var(--text-muted); font-size: 10px; }
.delete-attachment-btn { display: none !important; }
.attachment-menu-btn { position: absolute; top: 4px; right: 4px; background: rgba(0,0,0,0.55); color: white; border: none; border-radius: 4px; width: 20px; height: 20px; cursor: pointer; display: none; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; }
[dir="ltr"] .attachment-menu-btn { right: auto; left: 4px; }
.attachment-item:hover .attachment-menu-btn { display: flex; }
#media-viewer-modal { background: rgba(0,0,0,0.95); z-index: 100000; }
#media-viewer-modal .close-btn { color: white; font-size: 32px; }
#media-viewer-content { width: 100%; height: 100%; display: flex; justify-content: center; align-items: center; padding: 46px; }
#media-viewer-content img, #media-viewer-content video { max-width: 100%; max-height: 100%; border-radius: var(--r-md); box-shadow: 0 0 40px rgba(0,0,0,0.8); }
.media-nav-btn { position: absolute; top: 50%; transform: translateY(-50%); background: rgba(255,255,255,0.1); color: white; border: 1px solid rgba(255,255,255,0.15); font-size: 20px; width: 44px; height: 44px; cursor: pointer; border-radius: 50%; z-index: 100001; transition: background .15s; display: flex; justify-content: center; align-items: center; }
.media-nav-btn:hover { background: rgba(255,255,255,0.22); }
#media-prev-btn { right: 16px; } [dir="ltr"] #media-prev-btn { left: 16px; right: auto; }
#media-next-btn { left: 16px; } [dir="ltr"] #media-next-btn { right: 16px; left: auto; }

/* ============================================================
   الأقسام والعطل والـ badges
   ============================================================ */
.dept-list-item { background: var(--bg-elevated); padding: 8px 12px; border-radius: var(--r-sm); border: 1px solid var(--border-subtle); margin-bottom: 6px; display: flex; justify-content: space-between; align-items: center; }
.dept-name-badge { display: inline-block; padding: 3px 9px; border-radius: var(--r-xl); font-size: 12px; font-weight: 700; color: white; }
.holiday-list-item { background: var(--red-d); padding: 8px 12px; border-radius: var(--r-sm); border: 1px solid rgba(240,100,100,0.25); margin-bottom: 6px; display: flex; justify-content: space-between; align-items: center; color: var(--red); }
.client-hidden-badge { font-size: 10px; background: var(--red-d); color: var(--red); border: 1px solid rgba(240,100,100,0.3); padding: 2px 7px; border-radius: var(--r-xl); margin-right: auto; margin-left: 8px; font-weight: 700; display: inline-block; white-space: nowrap; }
[dir="ltr"] .client-hidden-badge { margin-right: 8px; margin-left: auto; }
.export-btn { display: inline-flex; align-items: center; gap: 5px; background: var(--green-d); color: var(--green); border: 1px solid rgba(78,203,163,0.3); padding: 0 10px; border-radius: var(--r-sm); cursor: pointer; font-size: 12px; font-weight: 700; font-family: var(--brand-font); transition: var(--transition); height: 30px; }
.export-btn:hover { background: var(--green); color: var(--text-on-brand); }
.hidden-by-permission { display: none !important; }
.board-member-row { display: flex; align-items: center; justify-content: space-between; padding: 8px 12px; border-bottom: 1px solid var(--border-subtle); transition: background .12s; }
.board-member-row:last-child { border-bottom: none; }
.board-member-row:hover { background: var(--bg-elevated); }
.board-member-row label { display: flex; align-items: center; gap: 8px; cursor: pointer; flex-grow: 1; color: var(--text-secondary); font-size: 13px; }
.board-member-row input[type="checkbox"] { width: 14px; height: 14px; cursor: pointer; accent-color: var(--brand-primary); }
.users-list-container { display: flex; flex-direction: column; gap: 6px; max-height: 340px; overflow-y: auto; }
.user-list-item { display: flex; align-items: center; justify-content: space-between; padding: 8px 12px; background: var(--bg-elevated); border: 1px solid var(--border-subtle); border-radius: var(--r-sm); }
.user-info-flex { display: flex; align-items: center; gap: 8px; font-weight: 600; color: var(--text-primary); }
.user-actions-flex { display: flex; align-items: center; gap: 6px; }
.role-select { padding: 3px 7px; border: 1px solid var(--border-default); border-radius: var(--r-sm); font-size: 12px; background: var(--bg-base); color: var(--text-primary); cursor: pointer; outline: none; font-family: var(--brand-font); }
.role-select:focus { border-color: var(--brand-primary); }

/* ============================================================
   Scrollbars ومدخلات
   ============================================================ */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-default); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-strong); }
select option, .modal-input option { background: var(--bg-elevated); color: var(--text-primary); }
input[type="date"]::-webkit-calendar-picker-indicator { filter: invert(0.65); cursor: pointer; }
input[type="color"] { border-radius: var(--r-sm); cursor: pointer; }
input[type="number"] { background: var(--bg-elevated); color: var(--text-primary); border: 1px solid var(--border-default); border-radius: var(--r-sm); padding: 4px 7px; font-family: var(--brand-font); outline: none; }
input[type="number"]:focus { border-color: var(--brand-primary); }
/* ============================================================
   قائمة المستخدم المنبثقة
   ============================================================ */
.user-menu-wrapper {
    position: relative;
    z-index: 9999;
}
.user-menu-trigger {
    display: flex;
    align-items: center;
    gap: 7px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-default);
    border-radius: var(--r-lg);
    padding: 5px 10px 5px 7px;
    cursor: pointer;
    color: var(--text-primary);
    font-size: 13px;
    transition: var(--transition);
    white-space: nowrap;
}
.user-menu-trigger:hover { background: var(--bg-hover); border-color: var(--border-strong); }
.user-menu-avatar {
    width: 28px; height: 28px;
    border-radius: 50%;
    background: var(--brand-primary);
    color: var(--text-on-brand);
    font-weight: 700;
    font-size: 13px;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.user-menu-trigger #display-logged-username {
    max-width: 130px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 12px;
}
.user-menu-caret { font-size: 10px; color: var(--text-secondary); margin-inline-start: 2px; }

.user-dropdown {
    position: absolute;
    top: calc(100% + 6px);
    /* RTL: تنبثق من اليمين */
    right: 0;
    left: auto;
    /* عرض تلقائي حسب المحتوى */
    width: max-content;
    min-width: 200px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-default);
    border-radius: var(--r-lg);
    box-shadow: 0 8px 32px rgba(0,0,0,0.6);
    z-index: 99999;
    overflow: hidden;
    animation: dropdownFadeIn 0.15s ease;
}
/* LTR: تنبثق من اليسار */
[dir="ltr"] .user-dropdown { right: auto; left: 0; }

@keyframes dropdownFadeIn {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}
.user-dropdown-header {
    display: flex; align-items: center; gap: 10px;
    padding: 14px 16px 12px;
    background: var(--bg-surface);
    white-space: nowrap;
}
.user-dropdown-avatar {
    width: 38px; height: 38px;
    border-radius: 50%;
    background: var(--brand-primary);
    color: var(--text-on-brand);
    font-weight: 700; font-size: 16px;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.user-dropdown-name { font-weight: 700; font-size: 13px; color: var(--text-primary); white-space: nowrap; }
.user-dropdown-role { font-size: 11px; color: var(--text-muted); margin-top: 2px; white-space: nowrap; }
.user-dropdown-divider { height: 1px; background: var(--border-subtle); margin: 3px 0; }
.user-dropdown-item {
    display: flex; align-items: center;
    width: 100%; padding: 10px 18px;
    background: none; border: none;
    color: var(--text-primary); font-size: 13px;
    cursor: pointer;
    text-align: right;
    transition: background 0.12s;
    gap: 8px;
    white-space: nowrap;
}
.user-dropdown-item:hover { background: var(--bg-hover); }
.user-dropdown-item-danger { color: var(--red) !important; }
.user-dropdown-item-danger:hover { background: var(--red-d) !important; }

/* ============================================================
   قسم الاختصارات + Bento Grid
   ============================================================ */
.shortcuts-section { margin-top: 18px; }
.shortcuts-header {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 16px;
}
.shortcuts-header h2 { font-size: 16px; }

.bento-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 14px;
    align-items: start;
}
.bento-empty-hint {
    grid-column: 1/-1;
    text-align: center;
    color: var(--text-muted);
    padding: 36px;
    border: 2px dashed var(--border-subtle);
    border-radius: var(--r-lg);
    font-size: 13px;
}

/* بطاقة الاختصار */
.bento-widget {
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: var(--r-lg);
    overflow: hidden;
    position: relative;
    transition: box-shadow 0.2s;
    cursor: default;
}
.bento-widget:hover { box-shadow: var(--shadow-md); }
.bento-widget.bento-wide { grid-column: span 2; }
.bento-widget.bento-tall { grid-row: span 2; }

.bento-widget-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 10px 12px 8px;
    border-bottom: 1px solid var(--border-subtle);
    background: var(--bg-surface);
    cursor: grab;
    user-select: none;
}
.bento-widget-header:active { cursor: grabbing; }
.bento-widget-title { font-size: 12px; font-weight: 700; color: var(--text-secondary); display: flex; align-items: center; gap: 6px; }
.bento-widget-remove {
    background: none; border: none;
    color: var(--text-muted); font-size: 14px;
    cursor: pointer; padding: 2px 5px;
    border-radius: 4px; line-height: 1;
    transition: background 0.12s, color 0.12s;
}
.bento-widget-remove:hover { background: var(--red-d); color: var(--red); }
.bento-widget-body { padding: 14px; }

/* محتوى الاختصارات */
.widget-stat-row { display: flex; gap: 10px; justify-content: space-around; }
.widget-stat-item { text-align: center; }
.widget-stat-item h3 { font-size: 22px; color: var(--brand-primary); font-weight: 800; }
.widget-stat-item p { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

.widget-tasks-list { display: flex; flex-direction: column; gap: 7px; max-height: 200px; overflow-y: auto; }
.widget-task-item {
    background: var(--bg-surface);
    border-radius: var(--r-sm);
    padding: 7px 10px;
    font-size: 12px;
    display: flex; justify-content: space-between; align-items: center;
    cursor: pointer;
    transition: background 0.12s;
    border: 1px solid var(--border-subtle);
}
.widget-task-item:hover { background: var(--bg-hover); }
.widget-task-item.completed { opacity: 0.55; text-decoration: line-through; }

.widget-hours-display { text-align: center; padding: 6px 0; }
.widget-hours-display h2 { font-size: 32px; color: var(--brand-primary); font-weight: 800; }
.widget-hours-display p { font-size: 12px; color: var(--text-muted); }

.widget-timesheet { width: 100%; border-collapse: collapse; font-size: 11px; }
.widget-timesheet th { color: var(--text-muted); padding: 4px 6px; border-bottom: 1px solid var(--border-subtle); font-weight: 600; }
.widget-timesheet td { padding: 5px 6px; border-bottom: 1px solid var(--border-subtle); color: var(--text-secondary); }
.widget-timesheet tr:last-child td { border-bottom: none; }

.widget-open-link {
    display: block; width: 100%;
    margin-top: 10px; padding: 6px;
    text-align: center; font-size: 11px;
    color: var(--brand-primary);
    background: var(--green-d);
    border-radius: var(--r-sm);
    cursor: pointer; border: none;
    transition: background 0.12s;
}
.widget-open-link:hover { background: rgba(78,203,163,0.22); }

/* قائمة اختيار الاختصارات */
.shortcut-picker-list { display: flex; flex-direction: column; gap: 4px; max-height: 420px; overflow-y: auto; }
.shortcut-picker-page {
    border-radius: var(--r-md);
    overflow: hidden;
    border: 1px solid var(--border-subtle);
}
.shortcut-picker-page-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 10px 14px;
    background: var(--bg-surface);
    cursor: pointer;
    font-weight: 600; font-size: 13px;
    user-select: none;
    transition: background 0.12s;
}
.shortcut-picker-page-header:hover { background: var(--bg-hover); }
.shortcut-picker-arrow { font-size: 11px; color: var(--text-muted); transition: transform 0.2s; }
.shortcut-picker-arrow.open { transform: rotate(180deg); }
.shortcut-picker-page-btn {
    display: flex; align-items: center; justify-content: space-between;
    width: 100%; padding: 8px 14px 8px 24px;
    background: none; border: none; border-top: 1px solid var(--border-subtle);
    color: var(--text-secondary); font-size: 12px;
    cursor: pointer; text-align: right;
    transition: background 0.1s, color 0.1s;
}
.shortcut-picker-page-btn:hover { background: var(--bg-hover); color: var(--text-primary); }
.shortcut-picker-page-btn .add-badge {
    font-size: 11px; color: var(--brand-primary);
    background: var(--green-d);
    border-radius: 10px; padding: 1px 7px;
}
.shortcut-picker-add-all {
    width: 100%; padding: 9px 14px;
    background: none; border: none; border-top: 1px solid var(--border-subtle);
    color: var(--brand-primary); font-size: 13px; font-weight: 600;
    cursor: pointer; text-align: right;
    transition: background 0.12s;
}
.shortcut-picker-add-all:hover { background: var(--green-d); }

/* نمط الإيموجي */
body.emoji-outline button,
body.emoji-outline .header-btn,
body.emoji-outline .user-dropdown-item {
    font-family: 'Segoe UI Symbol', sans-serif;
}
body.emoji-outline .icon-btn,
body.emoji-outline [id*="-btn"] {
    filter: grayscale(1);
}
body.emoji-fill button { filter: none; }
body.emoji-colored button { filter: none; }

/* ملخص العطل في لوحة التحكم */
#holidays-summary, #private-holidays-summary {
    font-size: 12px;
    color: var(--text-secondary);
    padding: 6px 10px;
    background: var(--bg-base);
    border-radius: var(--r-sm);
    border: 1px solid var(--border-subtle);
}

/* ============================================================
   صورة البروفايل الشخصية
   ============================================================ */
.profile-avatar-wrapper {
    position: relative;
    display: inline-block;
    flex-shrink: 0;
}
.profile-avatar-edit {
    position: absolute;
    bottom: 2px;
    left: 2px;
    width: 28px; height: 28px;
    border-radius: 50%;
    background: var(--bg-elevated);
    border: 2px solid var(--bg-surface);
    display: flex; align-items: center; justify-content: center;
    font-size: 13px;
    cursor: pointer;
    transition: background 0.15s;
    box-shadow: var(--shadow-sm);
}
.profile-avatar-edit:hover { background: var(--brand-primary); }

/* ============================================================
   نافذة الإشعارات
   ============================================================ */
.notif-item {
    display: flex; align-items: flex-start; gap: 10px;
    padding: 10px 12px;
    border-radius: var(--r-md);
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    cursor: pointer;
    transition: background 0.12s;
    position: relative;
}
.notif-item:hover { background: var(--bg-hover); }
.notif-item.notif-unread {
    border-color: var(--brand-primary);
    background: rgba(78,203,163,0.07);
}
.notif-icon { font-size: 18px; flex-shrink: 0; margin-top: 1px; }
.notif-body { flex: 1; }
.notif-text { font-size: 13px; color: var(--text-primary); line-height: 1.4; }
.notif-meta { font-size: 11px; color: var(--text-muted); margin-top: 4px; }
.notif-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    background: var(--brand-primary);
    flex-shrink: 0;
    margin-top: 5px;
}

/* ============================================================
   نظام المنشن
   ============================================================ */
.mention-dropdown {
    background: var(--bg-elevated);
    border: 1px solid var(--border-default);
    border-radius: var(--r-md);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    min-width: 200px;
    max-height: 220px;
    overflow-y: auto;
}
.mention-item {
    display: flex; align-items: center; gap: 8px;
    padding: 8px 12px;
    cursor: pointer;
    font-size: 13px;
    color: var(--text-primary);
    transition: background 0.1s;
}
.mention-item:hover { background: var(--bg-hover); }
.mention-avatar {
    width: 24px; height: 24px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 11px; font-weight: 700;
    color: var(--text-on-brand);
    flex-shrink: 0;
}
/* تمييز النص المنشن في التعليقات */
.comment-mention {
    color: var(--brand-primary);
    font-weight: 600;
    background: var(--green-d);
    border-radius: 3px;
    padding: 0 3px;
}

/* ============================================================
   فلاتر سجل النشاطات
   ============================================================ */
.logs-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    align-items: center;
    padding: 10px 14px;
    background: var(--bg-surface);
    border-radius: var(--r-md);
    border: 1px solid var(--border-subtle);
}