:root {
    --primary: #1f6feb;
    --primary-dark: #144ea3;
    --bg: #f4f6f9;
    --card-bg: #ffffff;
    --text: #1b1f24;
    --muted: #6b7280;
    --danger: #e74c3c;
    --border: #e3e6ea;
}

* { box-sizing: border-box; }

html {
    -webkit-text-size-adjust: 100%;
}

html, body {
    max-width: 100%;
    overflow-x: hidden;
}

/* منع أي نص طويل بلا مسافات (رابط/إيميل/رقم) من كسر التخطيط */
body {
    overflow-wrap: break-word;
    word-wrap: break-word;
}

img, svg, video {
    max-width: 100%;
    height: auto;
}

button, input, select, textarea {
    max-width: 100%;
    font-family: inherit;
}

body {
    margin: 0;
    font-family: "Segoe UI", Tahoma, Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
}

/* ============================================================
   القائمة الجانبية (Sidebar) — Mobile First
   الجوال (الافتراضي): شريط علوي بسيط + قائمة همبرغر منسدلة
   من 881px فوق: قائمة جانبية ثابتة كاملة الطول
   الاتجاه يتبع اللغة أوتوماتيكياً: فرنسية (ltr) يسار | عربية (rtl) يمين
   ============================================================ */
.sidebar {
    background: linear-gradient(180deg, #0d1a3a 0%, #060e21 100%);
    color: #fff;
    position: relative;
    z-index: 100;
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 16px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    font-size: 1rem;
    text-decoration: none;
    color: #fff;
    min-width: 0;
}
.brand span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.brand-logo {
    width: 32px;
    height: 32px;
    object-fit: contain;
    flex-shrink: 0;
}

/* زر القائمة (همبرغر) — مرسوم بـ CSS برك (3 خطوط)، بلا أي إيموجي */
.nav-toggle-checkbox { display: none; }
.nav-toggle-btn {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    width: 40px;
    height: 40px;
    border-radius: 8px;
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.15s;
}
.nav-toggle-btn:hover { background: rgba(255,255,255,0.08); }
.nav-toggle-btn span {
    display: block;
    width: 20px;
    height: 2px;
    background: #fff;
    border-radius: 2px;
}

.sidebar-menu {
    display: none;
    flex-direction: column;
    padding: 4px 16px 18px;
}
.nav-toggle-checkbox:checked ~ .sidebar-menu { display: flex; }

.sidebar nav {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.sidebar nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: #aeb9dd;
    font-weight: 600;
    font-size: 0.92rem;
    padding: 12px 14px;
    border-radius: 12px;
    transition: background 0.15s, color 0.15s;
}
.sidebar nav a:hover { background: rgba(255,255,255,0.06); color: #fff; }
.sidebar nav a.active {
    background: linear-gradient(135deg, #00c6ff, #0072ff);
    color: #fff;
    box-shadow: 0 6px 16px rgba(0,114,255,0.35);
}

.sidebar-bottom {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    padding-top: 16px;
    margin-top: 12px;
    border-top: 1px solid rgba(255,255,255,0.08);
}

.sidebar .logout-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    text-decoration: none;
    color: #ff8a80 !important;
    font-weight: 700;
    font-size: 0.9rem;
    padding: 10px 14px;
    border-radius: 12px;
    transition: background 0.15s;
}
.sidebar .logout-link:hover { background: rgba(231,76,60,0.12); }

.sidebar .lang-switch-mini {
    background: rgba(255,255,255,0.08);
    margin-inline-start: 0;
    justify-content: center;
}
.sidebar .lang-switch-mini a { color: #b9c3e0; }
.sidebar .lang-switch-mini a.active { background: linear-gradient(135deg, #00c6ff, #0072ff); color: #fff; }

.container {
    max-width: 1180px;
    margin: 0 auto;
    padding: 18px 16px;
}

main {
    min-height: 100vh;
}

/* === من 881px فوق: قائمة جانبية ثابتة كاملة الطول (تطور تدريجي من الجوال) === */
@media (min-width: 881px) {
    .sidebar {
        position: fixed;
        top: 0;
        inset-inline-start: 0;
        width: 250px;
        height: 100vh;
        overflow-y: auto;
        display: flex;
        flex-direction: column;
        padding: 22px 16px;
        box-shadow: 0 0 30px rgba(0,0,0,0.25);
    }
    .sidebar-header {
        padding: 4px 8px 22px;
        margin-bottom: 14px;
        border-bottom: 1px solid rgba(255,255,255,0.08);
    }
    .nav-toggle-btn { display: none; }
    .sidebar-menu {
        display: flex !important;
        flex: 1;
        padding: 0;
    }
    .sidebar nav { flex: 1; }
    /* ملاحظة مهمة: <main> هو نفسو .container، فلازم التخصيص يكون main.container
       وإلا .container (صنف) يلغي margin متاع main (عنصر) فيغطي الشريط المحتوى */
    main.container {
        max-width: 1180px;
        margin-block: 30px;
        margin-inline-start: 250px;
        margin-inline-end: auto;
        padding: 0 24px;
    }
}

.flash {
    padding: 10px 16px;
    border-radius: 8px;
    margin-bottom: 16px;
    font-weight: 600;
}
.flash-success { background: #e6f7ec; color: #1e8a4c; }
.flash-error { background: #fdecea; color: #c0392b; }

.auth-box, .form-box, .member-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 28px;
    max-width: 480px;
    margin: 40px auto;
}

h2 { margin-top: 0; }
.hint { color: var(--muted); font-size: 0.9rem; }

label { display: block; margin: 14px 0 6px; font-weight: 600; font-size: 0.9rem; }

input[type="text"], input[type="password"], input[type="number"] {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 1rem;
}

.btn {
    display: inline-block;
    padding: 10px 18px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: #fff;
    color: var(--text);
    cursor: pointer;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.95rem;
}

.btn-primary {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}
.btn-primary:hover { background: var(--primary-dark); }

form .btn { margin-top: 20px; margin-inline-end: 8px; }

.page-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.search-form { display: flex; gap: 8px; margin-bottom: 16px; }
.search-form input { flex: 1; }

.table {
    width: 100%;
    border-collapse: collapse;
    background: var(--card-bg);
    border-radius: 10px;
}

.table th, .table td {
    padding: 12px 14px;
    text-align: start;
    border-bottom: 1px solid var(--border);
}

.table thead tr:first-child th:first-child { border-start-start-radius: 10px; }
.table thead tr:first-child th:last-child { border-start-end-radius: 10px; }
.table tbody tr:last-child td:first-child { border-end-start-radius: 10px; }
.table tbody tr:last-child td:last-child { border-end-end-radius: 10px; }

.table th { background: #eef2f7; font-size: 0.85rem; color: var(--muted); }

/* === خط دفاع عام: أي جدول آخر بالموقع (غير جدول المشتركين لي عندو حل مخصص)
   يمرر أفقياً داخل حدودو هو برك على الشاشات الصغيرة، الصفحة نفسها ما تتحركش === */
@media (max-width: 700px) {
    .table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    /* min-width:100% مع width:max-content = يملأ العرض إذا كان صغير،
       ويتوسع ويمرر إذا كان المحتوى أكبر (width:100% كان يضغط الأعمدة) */
    .table thead, .table tbody {
        display: table;
        width: max-content;
        min-width: 100%;
    }
    .table th, .table td { white-space: nowrap; padding: 10px 12px; font-size: 0.85rem; }
}

.badge {
    color: #fff;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
}

/* === خانة الإجراءات: صف أفقي منظم (يصلح المشكلة فكل الصفحات) === */
.actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: nowrap;
}
.actions a,
.actions form,
.actions details,
.actions button {
    margin: 0;
    display: inline-flex;
    align-items: center;
}
.actions a:not(.action-btn) {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
    white-space: nowrap;
}
.actions a:not(.action-btn):hover { text-decoration: underline; }
.link-danger {
    background: none; border: none; color: var(--danger);
    cursor: pointer; font-weight: 600; padding: 0; font-size: 0.95rem;
}

/* === أزرار إجراءات نصية أنيقة ومنظمة لصفوف الجداول === */
.action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 30px;
    padding: 0 11px;
    border-radius: 7px;
    border: 1px solid var(--border);
    background: #fff;
    color: var(--text);
    text-decoration: none;
    cursor: pointer;
    font-size: 0.78rem;
    font-weight: 700;
    white-space: nowrap;
    line-height: 1;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.action-btn:hover { background: #eef4ff; border-color: var(--primary); color: var(--primary-dark); text-decoration: none; }
.action-btn.action-btn-accent { background: var(--primary); border-color: var(--primary); color: #fff; }
.action-btn.action-btn-accent:hover { background: var(--primary-dark); border-color: var(--primary-dark); color: #fff; }
.action-btn.action-btn-danger { color: var(--danger); }
.action-btn.action-btn-danger:hover { background: #fdecea; border-color: var(--danger); color: var(--danger); }

.whatsapp-icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 7px;
    border: 1px solid var(--border);
    background: #fff;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}
.whatsapp-icon-btn:hover { background: #e6f7ec; border-color: #25D366; }

.empty { text-align: center; color: var(--muted); padding: 30px 0; }

.sub-info p { font-size: 1.05rem; margin: 10px 0; }
.warning { color: var(--danger); font-weight: 700; }

.link-success {
    background: none; border: none; color: #1e8a4c;
    cursor: pointer; font-weight: 600; padding: 0; font-size: 0.95rem;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 14px;
    margin: 20px 0 30px;
}

.stat-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 18px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.stat-num {
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--primary);
}

.activity-list {
    list-style: none;
    padding: 0;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 10px;
}

.activity-list li {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
}
.activity-list li:last-child { border-bottom: none; }

.muted { color: var(--muted); font-size: 0.85rem; }

/* === صور المشتركين === */
.avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid var(--border);
    display: block;
}

.avatar-preview {
    width: 96px;
    height: 96px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--border);
    display: block;
    margin: 0 auto 16px;
}

.current-photo { text-align: center; }

/* === بطاقات إحصائيات قابلة للضغط === */
.stat-card-link {
    text-decoration: none;
    color: inherit;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.stat-card-link:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 16px rgba(31, 111, 235, 0.15);
    border-color: var(--primary);
}

/* === إدارة الأصناف والأنشطة === */
.categories-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 18px;
}

.category-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px;
}

.category-card h3 {
    margin-top: 0;
    font-size: 1.05rem;
    color: var(--primary-dark);
}

.activity-tags {
    list-style: none;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    min-height: 32px;
    margin-bottom: 16px;
}

.activity-tag {
    background: #eef2f7;
    border-radius: 20px;
    padding: 6px 8px 6px 14px;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 6px;
}

.tag-remove {
    background: none;
    border: none;
    color: var(--danger);
    cursor: pointer;
    font-size: 1.1rem;
    line-height: 1;
    padding: 0 4px;
}

.empty-inline { color: var(--muted); font-size: 0.85rem; }

.add-activity-form {
    display: flex;
    gap: 8px;
}
.add-activity-form input {
    flex: 1;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
}

/* === الإحصائيات المالية === */
.finance-stats { margin-bottom: 30px; }

.finance-highlight {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
    border: none;
}
.finance-highlight .stat-num { color: #fff; }

.finance-months {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.month-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px 20px;
}

.month-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 10px;
}

.month-name {
    font-weight: 700;
    font-size: 1.05rem;
}

.month-income {
    font-weight: 800;
    color: var(--primary);
    font-size: 1.1rem;
}

.month-bar-track {
    background: #eef2f7;
    border-radius: 6px;
    height: 8px;
    overflow: hidden;
    margin-bottom: 10px;
}

.month-bar-fill {
    background: linear-gradient(90deg, var(--primary), #4f9cf0);
    height: 100%;
    border-radius: 6px;
}

.month-details {
    display: flex;
    justify-content: space-between;
    font-size: 0.9rem;
    color: var(--text);
}

/* === بطاقة الشهر القابلة للضغط === */
.month-card-link {
    text-decoration: none;
    color: inherit;
    display: block;
    transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}
.month-card-link:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(31, 111, 235, 0.15);
    border-color: var(--primary);
}

/* === تفصيل المداخيل حسب الصنف والنشاط === */
.category-breakdown {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.category-block {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 18px 20px;
}

.category-block-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.category-block-header h4 {
    margin: 0;
    color: var(--primary-dark);
}

.category-block-totals {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* === سجل الدخول والخروج === */
.checkin-timeline {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.checkin-day-block {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 14px;
    overflow: hidden;
}

.checkin-day-header {
    background: #eef2f7;
    padding: 10px 20px;
    font-weight: 700;
    color: var(--primary-dark);
    font-size: 0.95rem;
}

.checkin-list { padding: 6px 0; }

.checkin-row {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 10px 20px;
    border-bottom: 1px solid #f1f3f6;
}
.checkin-row:last-child { border-bottom: none; }

.checkin-row .avatar { width: 38px; height: 38px; }

.checkin-name {
    font-weight: 600;
    flex: 1;
}

.checkin-action-badge {
    font-size: 0.9rem;
    font-weight: 700;
    padding: 4px 12px;
    border-radius: 20px;
    background: #f4f6f9;
}

.checkin-check_in .checkin-action-badge { background: #e6f7ec; color: #1e8a4c; }
.checkin-check_out .checkin-action-badge { background: #e8f1fd; color: #1f6feb; }

.checkin-time {
    font-variant-numeric: tabular-nums;
    color: var(--muted);
    font-size: 0.9rem;
    min-width: 70px;
    text-align: left;
}

/* === بروفيل المشترك === */
.profile-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 30px;
    max-width: 800px;
}

.profile-header {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 28px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--border);
}

.profile-photo {
    width: 110px;
    height: 110px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--border);
}

.profile-name { margin: 0 0 8px; font-size: 1.5rem; }

.profile-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 18px;
    margin-bottom: 28px;
}

.profile-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.profile-label { font-size: 0.8rem; color: var(--muted); font-weight: 600; }
.profile-value { font-size: 1.05rem; font-weight: 600; color: var(--text); }

.profile-actions { display: flex; gap: 10px; flex-wrap: wrap; }

.member-name-link { color: var(--text); text-decoration: none; font-weight: 700; font-size: 0.92rem; }
.member-name-link:hover { color: var(--primary); text-decoration: underline; }

/* === زر واتساب === */
.whatsapp-dropdown { position: relative; display: inline-block; }
.whatsapp-dropdown summary {
    list-style: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    vertical-align: middle;
}
.whatsapp-dropdown summary svg { display: block; }
.whatsapp-dropdown summary::-webkit-details-marker { display: none; }
.whatsapp-dropdown-menu {
    position: absolute;
    z-index: 50;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: 0 8px 20px rgba(0,0,0,0.12);
    padding: 8px;
    min-width: 180px;
    top: 100%;
    margin-top: 4px;
    inset-inline-end: 0;
    max-width: calc(100vw - 32px);
}
.whatsapp-dropdown-menu a {
    display: block;
    padding: 8px 10px;
    border-radius: 6px;
    color: var(--text);
    text-decoration: none;
    font-size: 0.9rem;
    white-space: nowrap;
}
.whatsapp-dropdown-menu a:hover { background: #e6f7ec; }

/* === نتائج بحث سجل الدخول والخروج === */
.search-results-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin: 12px 0 24px;
}

.search-result-row {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 10px 16px;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 10px;
    text-decoration: none;
    color: var(--text);
    font-weight: 600;
}
.search-result-row:hover { border-color: var(--primary); background: #f4f8ff; }

/* === خيار رسالة واتساب الترحيبية / التجديد === */
.whatsapp-option {
    background: #f4fbf7;
    border: 1px solid #cdeedb;
    border-radius: 10px;
    padding: 12px 16px;
    margin: 10px 0 4px;
}

.whatsapp-option-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    font-size: 0.92rem;
    margin-bottom: 8px;
}

.whatsapp-option-choices {
    display: flex;
    gap: 20px;
}
.whatsapp-option-choices label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 500;
    margin: 0;
}
.whatsapp-option-choices input[type="radio"] { width: auto; }

/* ============================================================
   صفحة تسجيل الدخول - تصميم عصري split-screen داكن
   ============================================================ */
body:has(.login-split) { margin: 0; background: #060e21; }

.login-main {
    max-width: none !important;
    margin: 0 !important;
    padding: 0 !important;
}

.login-split {
    display: flex;
    min-height: 100vh;
    background: #060e21;
}

.login-hero {
    flex: 0 0 460px;
    position: relative;
    background: linear-gradient(160deg, #0d1a3a 0%, #060e21 80%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    overflow: hidden;
}

.login-hero-pattern {
    position: absolute;
    inset: 0;
    background-image:
        radial-gradient(circle at 12% 12%, rgba(255,255,255,0.07) 0, transparent 40%),
        radial-gradient(circle at 88% 85%, rgba(0,153,255,0.30) 0, transparent 48%),
        radial-gradient(circle at 85% 12%, rgba(56,199,255,0.18) 0, transparent 38%);
}

.lang-switch {
    position: absolute;
    top: 20px;
    inset-inline-end: 24px;
    z-index: 2;
    display: flex;
    gap: 4px;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 20px;
    padding: 4px;
}
.lang-switch a {
    text-decoration: none;
    color: #cfd6ea;
    font-size: 0.8rem;
    font-weight: 700;
    padding: 5px 14px;
    border-radius: 16px;
    transition: background 0.15s, color 0.15s;
}
.lang-switch a.active { background: linear-gradient(135deg, #00c6ff, #0072ff); color: #fff; }
.lang-switch a:hover:not(.active) { background: rgba(255,255,255,0.12); }

.login-hero-content {
    position: relative;
    z-index: 1;
    text-align: center;
    color: #fff;
}

.login-hero-logo-card {
    background: #ffffff;
    border-radius: 26px;
    padding: 28px 32px 22px;
    display: inline-block;
    box-shadow: 0 25px 60px rgba(0,0,0,0.45), 0 0 0 1px rgba(255,255,255,0.06);
    margin-bottom: 26px;
}

.login-hero-full-logo {
    display: block;
    width: 100%;
    max-width: 260px;
    height: auto;
    object-fit: contain;
}

.login-hero-tagline {
    color: #9fb3d9;
    font-size: 0.95rem;
    margin: 0 0 32px;
    line-height: 1.5;
}

.login-hero-features {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
}

.feature-pill {
    background: rgba(255,255,255,0.07);
    border: 1px solid rgba(255,255,255,0.16);
    color: #e7ebfa;
    padding: 7px 16px;
    border-radius: 20px;
    font-size: 0.85rem;
    backdrop-filter: blur(4px);
}

.login-form-panel {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 24px;
}

.login-form-box { width: 100%; max-width: 420px; }

.login-form-box h2 {
    color: #fff;
    text-align: center;
    font-size: 1.9rem;
    margin: 0 0 32px;
    font-weight: 800;
}

.login-form-box label {
    color: #b7c0e6;
    font-size: 0.85rem;
    font-weight: 600;
    display: block;
    margin: 18px 0 8px;
}

.login-form-box input {
    width: 100%;
    padding: 13px 16px;
    background: #1a2142;
    border: 1px solid #323d68;
    border-radius: 10px;
    color: #fff;
    font-size: 1rem;
    box-sizing: border-box;
    transition: border-color 0.2s;
}
.login-form-box input:focus {
    outline: none;
    border-color: #0099ff;
    box-shadow: 0 0 0 3px rgba(0,153,255,0.15);
}
.login-form-box input::placeholder { color: #6b7494; }

.login-submit-btn {
    width: 100%;
    margin-top: 30px;
    padding: 15px;
    background: linear-gradient(135deg, #00c6ff, #0072ff);
    border: none;
    border-radius: 10px;
    color: #fff;
    font-size: 1.05rem;
    font-weight: 700;
    cursor: pointer;
    transition: filter 0.2s, transform 0.15s;
}
.login-submit-btn:hover { filter: brightness(1.08); }
.login-submit-btn:active { transform: scale(0.99); }

.login-flash {
    padding: 10px 14px;
    border-radius: 8px;
    margin-bottom: 6px;
    font-size: 0.9rem;
    font-weight: 600;
}
.login-flash.flash-success { background: rgba(46,204,113,0.15); color: #6ee7a0; border: 1px solid rgba(46,204,113,0.3); }
.login-flash.flash-error { background: rgba(231,76,60,0.15); color: #ff8a80; border: 1px solid rgba(231,76,60,0.3); }

@media (max-width: 820px) {
    .login-split { flex-direction: column; }
    .login-hero { flex: 0 0 auto; padding: 34px 20px; }
    .login-hero-logo-card { padding: 20px 22px 16px; }
    .login-hero-full-logo { max-width: 190px; }
    .login-form-panel { padding: 34px 20px; }
}

/* === شريط تنقل My Website === */
.website-subnav {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 24px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 12px;
}

.website-subnav a {
    padding: 8px 16px;
    border-radius: 20px;
    text-decoration: none;
    color: var(--text);
    font-weight: 600;
    font-size: 0.9rem;
    background: #f4f6f9;
}
.website-subnav a.active { background: var(--primary); color: #fff; }
.website-subnav a:hover:not(.active) { background: #e6edf7; }

/* === معاينة الرابط العام (Slug) === */
.public-url-box {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #eef2f7;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 12px 16px;
    margin: 14px 0 24px;
    flex-wrap: wrap;
}
.public-url-box code {
    flex: 1;
    font-size: 0.95rem;
    color: var(--primary-dark);
    word-break: break-all;
}
.copy-btn {
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 8px 14px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.85rem;
}
.copy-btn:hover { background: var(--primary-dark); }

/* === بطاقات عامة (منتجات/أخبار/ألبومات) === */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 18px;
}

.item-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 14px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.item-card-img {
    width: 100%;
    aspect-ratio: 4/3;
    object-fit: cover;
    background: #eef2f7;
}

.item-card-body { padding: 14px 16px; flex: 1; display: flex; flex-direction: column; gap: 6px; }
.item-card-title { font-weight: 700; font-size: 1.05rem; }
.item-card-desc { color: var(--muted); font-size: 0.9rem; flex: 1; }
.item-card-price { font-weight: 800; color: var(--primary); font-size: 1.1rem; }
.item-card-actions { display: flex; gap: 10px; padding: 0 16px 14px; }

.news-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 18px 20px;
    margin-bottom: 16px;
}
.news-card-date { color: var(--muted); font-size: 0.85rem; margin-bottom: 8px; }
.news-card-media img, .news-card-media video { width: 100%; border-radius: 10px; margin: 10px 0; max-height: 400px; object-fit: cover; }

/* === My Website: News (إدارة) === */
.news-admin-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
}
.news-admin-card {
    display: flex;
    gap: 16px;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px;
    align-items: flex-start;
}
.news-admin-thumb {
    width: 110px;
    height: 90px;
    object-fit: cover;
    border-radius: 8px;
    flex-shrink: 0;
}
.news-admin-body { flex: 1; }
.news-admin-body p { margin: 0 0 6px; }

/* === My Website: Gallery (إدارة) === */
.albums-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
}
.album-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    text-decoration: none;
    color: var(--text);
    display: block;
}
.album-card img, .album-card video {
    width: 100%;
    height: 140px;
    object-fit: cover;
    display: block;
    background: #000;
}
.album-video-placeholder {
    width: 100%;
    height: 140px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    background: #eef2f7;
}
.album-card-body { padding: 12px 14px; display: flex; flex-direction: column; gap: 4px; }

.gallery-item-card { position: relative; }
.gallery-item-delete {
    position: absolute;
    top: 8px; left: 8px;
    background: rgba(0,0,0,0.6);
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 4px 10px;
    font-size: 0.8rem;
    cursor: pointer;
}

/* === شارة عدد الإشعارات === */
.nav-badge {
    display: inline-block;
    background: #e74c3c;
    color: #fff;
    font-size: 0.72rem;
    font-weight: 800;
    padding: 1px 7px;
    border-radius: 10px;
    margin-inline-start: 2px;
}

/* === صندوق الإشعارات === */
.notifications-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.notification-card {
    display: flex;
    align-items: center;
    gap: 16px;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 14px 18px;
    flex-wrap: wrap;
}
.notification-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 200px;
}

/* === مبدل اللغة الصغير فالشريط العلوي (كل صفحات لوحة التحكم) === */
.lang-switch-mini {
    display: inline-flex;
    gap: 2px;
    background: #eef2f7;
    border-radius: 14px;
    padding: 2px;
    margin-inline-start: 14px;
}
.lang-switch-mini a {
    text-decoration: none;
    color: var(--muted);
    font-size: 0.72rem;
    font-weight: 800;
    padding: 3px 9px;
    border-radius: 12px;
}
.lang-switch-mini a.active { background: var(--primary); color: #fff; }

/* ============================================================
   صفحة المشتركين — تصميم عصري ومنظم
   ============================================================ */
.members-toolbar {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.members-count-badge {
    display: inline-block;
    background: var(--primary);
    color: #fff;
    font-size: 0.78rem;
    font-weight: 700;
    padding: 3px 11px;
    border-radius: 20px;
    vertical-align: middle;
    margin-inline-start: 4px;
}

.search-bar-modern {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 4px 4px 4px 14px;
    margin-bottom: 18px;
    max-width: 420px;
}
.search-bar-modern .search-icon { color: var(--muted); font-size: 0.95rem; }
.search-bar-modern input {
    flex: 1;
    border: none;
    outline: none;
    background: transparent;
    font-size: 0.92rem;
    padding: 8px 0;
}
.search-bar-modern button {
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: 9px;
    padding: 9px 18px;
    font-weight: 700;
    font-size: 0.88rem;
    cursor: pointer;
    transition: background 0.15s;
}
.search-bar-modern button:hover { background: var(--primary-dark); }

.table-wrap {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 16px;
    /* على الجوال برك: تمرير أفقي. لاحظ أن أي overflow غير visible يقص
       القوائم المنسدلة (واتساب)، لذلك نرجعوه visible على الشاشات الواسعة تحت. */
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    box-shadow: 0 2px 14px rgba(20,30,60,0.04);
}
@media (min-width: 881px) {
    .table-wrap { overflow: visible; }
}

/* على الجوال الحاوية لازم تمرر أفقياً، والتمرير يقص أي عنصر مطلق.
   الحل: القائمة تولي داخل التدفق العادي (static) فما تتقصش أبداً. */
@media (max-width: 880px) {
    .whatsapp-dropdown { display: block; }
    .whatsapp-dropdown-menu {
        position: static;
        box-shadow: none;
        min-width: auto;
        margin-top: 6px;
        background: #f7f9fc;
    }
}
.table-wrap .table {
    border-radius: 0;
    width: 100%;
}
/* الحد الأدنى مطلوب برك على الشاشات الصغيرة (باش الأعمدة ما تنضغطش وتتداخل).
   على الشاشات الواسعة الجدول يتأقلم بحرية مع عدد أعمدتو مهما كان. */
@media (max-width: 880px) {
    .table-wrap .table { min-width: 640px; }
}
.table-wrap .table th {
    background: #f7f9fc;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: #7b8698;
    font-weight: 800;
    padding: 14px 14px;
    white-space: nowrap;
    border-bottom: 1px solid var(--border);
}
.table-wrap .table td {
    padding: 12px 14px;
    vertical-align: middle;
    font-size: 0.9rem;
    border-bottom: 1px solid #f0f2f6;
}
/* القص (ellipsis) للخلايا النصية برك — خانة الإجراءات لازم تبقى visible
   وإلا تقص القائمة المنسدلة متاع واتساب */
.table-wrap .table td:not(.actions) {
    overflow: hidden;
    text-overflow: ellipsis;
}
.table-wrap .table td.actions { overflow: visible; position: relative; }

/* === عروض الأعمدة: خاصة بجدول المشتركين برك (مش لكل الجداول) ===
   صورة / اسم / بطاقة / نشاط / حالة / تاريخ / إجراءات */
.members-table-wrap .table { table-layout: fixed; }
.members-table-wrap .table th:nth-child(1) { width: 78px; }
.members-table-wrap .table th:nth-child(2) { width: 20%; }
.members-table-wrap .table th:nth-child(3) { width: 15%; }
.members-table-wrap .table th:nth-child(4) { width: 18%; }
.members-table-wrap .table th:nth-child(5) { width: 12%; }
.members-table-wrap .table th:nth-child(6) { width: 15%; }
.members-table-wrap .table th:nth-child(7) { width: auto; }

.table-wrap .table tbody tr { transition: background 0.12s; }
.table-wrap .table tbody tr:hover { background: #f8fafc; }
.table-wrap .table thead tr:first-child th:first-child,
.table-wrap .table thead tr:first-child th:last-child,
.table-wrap .table tbody tr:last-child td:first-child,
.table-wrap .table tbody tr:last-child td:last-child {
    border-radius: 0;
}

.member-avatar-ring {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #fff;
    box-shadow: 0 0 0 1px var(--border);
    display: block;
}

.activity-tag-mini { font-size: 0.88rem; font-weight: 600; color: var(--text); line-height: 1.3; }
.activity-tag-mini .cat-label { display: block; font-size: 0.74rem; color: var(--muted); font-weight: 500; margin-top: 2px; }

.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 13px;
    border-radius: 20px;
    font-size: 0.76rem;
    font-weight: 700;
    color: #fff;
    white-space: nowrap;
}
.status-pill::before {
    content: "";
    width: 6px; height: 6px;
    border-radius: 50%;
    background: rgba(255,255,255,0.9);
}

.members-empty-state {
    text-align: center;
    padding: 64px 20px;
    color: var(--muted);
}
.members-empty-state .icon { font-size: 2.6rem; margin-bottom: 10px; }
.members-empty-state p { margin: 0; font-size: 0.95rem; }

/* ============================================================
   تحسينات Responsive عامة — Mobile First
   تنطبق على كل صفحات لوحة التحكم (تمتد من base.html)
   ============================================================ */

/* رأس الصفحة: يلتف بدل ما يضغط العنوان والأزرار جنب بعضهم فمساحة ضيقة */
.page-head {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
}

/* مجموعات الأزرار (Toolbar) — تبقى صف أفقي إذا كان فما مكان، وإلا تلتف */
.members-toolbar, .page-head > div {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

/* البطاقات (نماذج الدخول/الإضافة) تتكيف مع الشاشات الصغيرة جداً */
.auth-box, .form-box, .member-card {
    width: 100%;
}

/* الشبكات (Grids) — حد أدنى أصغر للأعمدة على الشاشات الضيقة جداً */
@media (max-width: 380px) {
    .stats-grid, .categories-grid, .albums-grid, .products-grid {
        grid-template-columns: 1fr !important;
    }
}

@media (max-width: 640px) {
    /* الحاويات والبطاقات: حشو أخف */
    .auth-box, .form-box, .member-card {
        padding: 20px;
        margin: 20px auto;
        border-radius: 10px;
    }

    /* رأس الصفحة يتحول لعمود، والأزرار تظهر عمودياً بعرض كامل */
    .page-head {
        flex-direction: column;
        align-items: stretch;
    }
    .members-toolbar, .page-head > div {
        flex-direction: column;
    }
    .members-toolbar .btn, .page-head > div .btn {
        width: 100%;
        text-align: center;
    }

    /* أزرار حفظ/إلغاء أسفل النماذج: عمودية بعرض كامل */
    form .btn, form button[type="submit"], .login-submit-btn {
        width: 100%;
        margin-inline-end: 0;
        text-align: center;
    }
    form .btn + .btn { margin-top: 8px; }

    /* خط عناوين أهدأ على الشاشات الصغيرة */
    h2 { font-size: 1.25rem; }
    h3 { font-size: 1.05rem; }

    .stats-grid, .categories-grid, .albums-grid, .products-grid {
        grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    }

    .search-form { flex-direction: column; }
    .search-form input { width: 100%; }
}

/* ============================================================
   إصلاحات إضافية للشاشات الصغيرة (صفوف Flex كانت تتجاوز الشاشة)
   ============================================================ */
@media (max-width: 640px) {
    /* صفوف تتحول لعمودية أو تلتف بدل ما تخرج بره الشاشة */
    .checkin-row,
    .search-result-row,
    .news-admin-card,
    .profile-header,
    .month-details,
    .notification-card {
        flex-wrap: wrap;
        gap: 10px;
    }

    .checkin-row { padding: 10px 14px; }
    .checkin-name { flex: 1 1 100%; }
    .checkin-time { text-align: start; }

    .profile-header { flex-direction: column; align-items: flex-start; text-align: start; }
    .profile-photo { width: 84px; height: 84px; }

    .news-admin-card { flex-direction: column; }
    .news-admin-thumb { width: 100%; height: 160px; }

    .notification-card .actions { width: 100%; }
    .notification-card .actions .btn { flex: 1; text-align: center; }

    .month-details { flex-direction: column; gap: 4px; }

    .search-result-row { font-size: 0.88rem; }

    /* شريط البحث الحديث: عمودي بعرض كامل */
    .search-bar-modern {
        flex-direction: column;
        align-items: stretch;
        padding: 10px;
        gap: 10px;
        max-width: 100%;
    }
    .search-bar-modern input { padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; }
    .search-bar-modern button { width: 100%; }

    /* الشريط الفرعي متاع My Website: يلتف بلا ما يخرج */
    .website-subnav { flex-wrap: wrap; gap: 6px; }
    .website-subnav a { font-size: 0.82rem; padding: 8px 12px; }

    /* صندوق رابط الموقع العام */
    .public-url-box { flex-direction: column; align-items: stretch; gap: 8px; }
    .public-url-box code { word-break: break-all; }
    .copy-btn { width: 100%; }

    /* البطاقات الإحصائية: خط أصغر شوية */
    .stat-num { font-size: 1.5rem; }

    /* أزرار الإجراءات فجدول المشتركين */
    .actions { gap: 5px; }
    .action-btn { padding: 0 9px; font-size: 0.74rem; }
}

/* === صفحة الإشعارات: صورة المشترك + صف رقم البطاقة + رفع الصورة === */
.notif-avatar {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #fff;
    box-shadow: 0 0 0 1px var(--border);
    flex-shrink: 0;
}

.card-number-row {
    display: flex;
    gap: 8px;
    align-items: stretch;
}
.card-number-row input { flex: 1; }
.card-number-row .btn { white-space: nowrap; }

.photo-change-label {
    display: block;
    margin-top: 12px;
    font-weight: 600;
    font-size: 0.9rem;
}
.current-photo input[type="file"] { margin-top: 6px; }

@media (max-width: 640px) {
    .card-number-row { flex-direction: column; }
    .card-number-row .btn { width: 100%; }
}

/* === زر إنشاء حساب فصفحة الدخول === */
.login-signup-btn {
    display: block;
    width: 100%;
    margin-top: 12px;
    padding: 14px;
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,0.25);
    background: transparent;
    color: #cfd8ee;
    font-size: 1rem;
    font-weight: 700;
    text-align: center;
    text-decoration: none;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.login-signup-btn:hover {
    background: rgba(255,255,255,0.07);
    color: #fff;
    border-color: rgba(255,255,255,0.45);
}

/* === صفحة إنشاء حساب قاعة === */
.signup-form-box { max-width: 460px; }
.signup-form-box .hint { color: #8b95b5; }

.signup-section {
    margin: 26px 0 4px;
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #7c86a6;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    padding-bottom: 8px;
}

.plan-option {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 14px;
    margin-top: 10px;
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 10px;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
}
.plan-option:hover { background: rgba(255,255,255,0.04); }
.plan-option:has(input:checked) {
    border-color: #0099ff;
    background: rgba(0,153,255,0.10);
}
.plan-option input[type="radio"] { width: auto; margin-top: 3px; flex-shrink: 0; }
.plan-option span { display: flex; flex-direction: column; gap: 2px; }
.plan-option strong { color: #fff; font-size: 0.95rem; }
.plan-option em { color: #98a3c2; font-size: 0.8rem; font-style: normal; }

/* === لوحة صلاحيات القاعة (صفحة الأدمين) === */
.perm-panel {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 20px;
    margin-bottom: 20px;
}
.perm-toolbar { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.perm-groups {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 18px;
    margin-bottom: 18px;
}
.perm-group {
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 14px 16px;
    background: #fbfcfe;
}
.perm-group h4 {
    margin: 0 0 10px;
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--primary-dark);
}
.perm-item {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 7px 0;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    margin: 0;
}
.perm-item input { width: auto; flex-shrink: 0; }
.perm-item:has(input:not(:checked)) span { color: var(--danger); text-decoration: line-through; opacity: 0.75; }

/* === شريط تذكير باشتراك القاعة (فالقائمة الجانبية) === */
.abo-banner {
    display: flex;
    flex-direction: column;
    gap: 3px;
    margin-top: 14px;
    padding: 12px 14px;
    border-radius: 12px;
    border: 1px solid rgba(255,255,255,0.10);
    background: rgba(255,255,255,0.05);
    border-inline-start: 3px solid #2ecc71;
}
.abo-banner .abo-label {
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #93a0c4;
    font-weight: 700;
}
.abo-banner .abo-date {
    font-size: 0.95rem;
    font-weight: 800;
    color: #fff;
    font-variant-numeric: tabular-nums;
}
.abo-banner .abo-days { font-size: 0.78rem; font-weight: 600; }

.abo-banner.abo-ok { border-inline-start-color: #2ecc71; }
.abo-banner.abo-ok .abo-days { color: #6ee7a8; }

.abo-banner.abo-soon {
    border-inline-start-color: #f39c12;
    background: rgba(243,156,18,0.12);
}
.abo-banner.abo-soon .abo-days { color: #f7c56b; }

.abo-banner.abo-expired {
    border-inline-start-color: #e74c3c;
    background: rgba(231,76,60,0.14);
}
.abo-banner.abo-expired .abo-days { color: #ff9d94; }

@media (max-width: 880px) {
    .abo-banner { margin-top: 10px; }
}
