:root{
    --navy:#071a35;
    --blue:#176fb0;
    --gold:#c89526;
    --bg:#f3f6fa;
    --text:#10233f;
    --muted:#6c7890;
    --line:#dfe5ed;
    --white:#fff;
    --danger:#a52b2b;
    --ok:#177245;
}

*{
    box-sizing:border-box;
}

html{
    scroll-behavior:smooth;
}

body{
    margin:0;
    font-family:Tahoma,Arial,sans-serif;
    font-size:16px;
    background:var(--bg);
    color:var(--text);
    direction:rtl;
    line-height:1.7;
}

a{
    color:var(--blue);
}

/* =========================
   HEADER
   ========================= */

.top,
.top.member-top{
    width:100%;
    min-height:92px;
    background:var(--navy);
    color:#fff;
    padding:10px 4%;
    display:flex;
    flex-direction:row;
    justify-content:space-between;
    align-items:center;
    gap:30px;
    position:sticky;
    top:0;
    z-index:50;
}

.union-brand{
    display:flex;
    align-items:center;
    gap:14px;
    min-width:0;
}

.union-logo{
    display:block;
    width:70px;
    height:70px;
    max-width:70px;
    max-height:70px;
    object-fit:contain;
    flex:0 0 70px;
}

.union-brand-text{
    line-height:1.4;
}

.union-brand-text strong{
    display:block;
    font-size:16px;
    font-weight:700;
    line-height:1.5;
}

.brand-en,
.union-brand-text .brand-en{
    font-size:11px;
    opacity:.78;
    direction:ltr;
    line-height:1.4;
    margin-top:2px;
}

/* =========================
   MEMBER NAVIGATION
   ========================= */

.member-nav,
.top nav{
    display:flex;
    align-items:center;
    flex-wrap:wrap;
    gap:4px;
}

.top a,
.member-nav a{
    display:inline-block;
    color:#fff;
    text-decoration:none;
    margin:0;
    padding:8px 10px;
    border-radius:7px;
    font-size:15px;
    font-weight:700;
    line-height:1.4;
    white-space:nowrap;
}

.member-nav a:hover,
.top nav a:hover{
    background:rgba(255,255,255,.12);
}

/* =========================
   MAIN PAGE
   ========================= */

.wrap,
main.member-wrap{
    width:94%;
    max-width:1200px;
    margin:30px auto;
    padding:0 20px;
}

.member-wrap h1,
.wrap h1{
    font-size:30px;
    line-height:1.4;
    margin:0 0 22px;
}

.member-wrap h2,
.wrap h2{
    font-size:25px;
    line-height:1.4;
}

/* =========================
   CARDS
   ========================= */

.card{
    width:100%;
    background:#fff;
    border:1px solid var(--line);
    border-radius:14px;
    padding:28px 32px;
    margin-bottom:20px;
    box-shadow:0 3px 16px rgba(0,0,0,.05);
    font-size:16px;
    line-height:1.8;
}

.card p{
    font-size:16px;
    line-height:1.8;
    margin:8px 0;
}

.card b{
    font-size:16px;
}

.member-details p{
    padding:9px 0;
    margin:0;
    border-bottom:1px solid #edf0f4;
}

.member-details p:last-child{
    border-bottom:0;
}

/* =========================
   FORMS
   ========================= */

label{
    display:block;
    font-size:16px;
    margin-top:5px;
}

input,
select,
textarea{
    width:100%;
    padding:11px 12px;
    border:1px solid #ccd3dd;
    border-radius:8px;
    margin:6px 0 14px;
    font:inherit;
    font-size:16px;
    background:#fff;
    min-height:46px;
}

textarea{
    min-height:120px;
}

input:focus,
select:focus,
textarea:focus{
    outline:none;
    border-color:var(--blue);
    box-shadow:0 0 0 2px rgba(23,111,176,.10);
}

/* Numbers and emails */

input[inputmode="numeric"],
input[type="tel"],
input[type="email"]{
    direction:ltr;
    text-align:left;
}

/* =========================
   BUTTONS
   ========================= */

.btn{
    display:inline-block;
    border:0;
    border-radius:9px;
    padding:10px 18px;
    background:var(--blue);
    color:#fff;
    text-decoration:none;
    cursor:pointer;
    font:inherit;
    font-size:15px;
}

.btn:hover{
    opacity:.92;
}

.btn.gold{
    background:var(--gold);
}

.btn.red{
    background:var(--danger);
}

.btn.gray{
    background:#657083;
}

/* =========================
   NOTICES
   ========================= */

.notice{
    padding:12px 15px;
    border-radius:8px;
    background:#e9f5ec;
    margin-bottom:15px;
    font-size:15px;
}

.error{
    background:#fdeaea;
    color:#8b1717;
}

.invalid{
    border:2px solid var(--danger)!important;
    background:#fff7f7!important;
}

.field-error{
    color:var(--danger);
    font-size:12px;
    font-weight:700;
}

/* =========================
   TABLES
   ========================= */

.scroll{
    overflow:auto;
}

table{
    width:100%;
    border-collapse:collapse;
    background:#fff;
}

th,
td{
    padding:11px;
    border-bottom:1px solid #e5e8ee;
    text-align:right;
    vertical-align:top;
}

th{
    background:#eef3f8;
}

/* =========================
   OTHER
   ========================= */

.grid{
    display:grid;
    grid-template-columns:repeat(auto-fit,minmax(210px,1fr));
    gap:15px;
}

.stat{
    font-size:28px;
    font-weight:700;
}

.muted,
.field-note{
    color:var(--muted);
}

.badge{
    padding:4px 9px;
    border-radius:20px;
    background:#e9eef5;
    font-size:12px;
}

.actions{
    display:flex;
    gap:7px;
    flex-wrap:wrap;
}

.reply{
    border-right:3px solid var(--blue);
    padding:10px 14px;
    margin:10px 0;
    background:#f8fbff;
}

.login{
    max-width:450px;
    margin:8vh auto;
}

/* =========================
   TABLET
   ========================= */

@media(max-width:900px){

    .top,
    .top.member-top{
        display:block;
        min-height:auto;
        padding:12px 18px;
    }

    .union-logo{
        width:60px;
        height:60px;
        max-width:60px;
        max-height:60px;
        flex-basis:60px;
    }

    .member-nav,
    .top nav{
        margin-top:12px;
    }

    .wrap,
    main.member-wrap{
        width:100%;
        margin:22px auto;
        padding:0 14px;
    }

    .member-wrap h1,
    .wrap h1{
        font-size:27px;
    }

    .card{
        padding:21px;
    }
}

/* =========================
   MOBILE
   ========================= */

@media(max-width:560px){

    .union-logo{
        width:52px;
        height:52px;
        max-width:52px;
        max-height:52px;
        flex-basis:52px;
    }

    .union-brand{
        gap:10px;
    }

    .union-brand-text strong{
        font-size:14px;
    }

    .union-brand-text .brand-en{
        font-size:9px;
    }

    .member-nav,
    .top nav{
        justify-content:center;
    }

    .member-nav a,
    .top nav a{
        font-size:13px;
        padding:7px 8px;
    }

    .member-wrap h1,
    .wrap h1{
        font-size:25px;
    }

    .card{
        padding:18px;
    }

    table{
        font-size:13px;
    }
}/* ===== إصلاح نهائي لحجم Header الإدارة ===== */

header.top{
    min-height:90px !important;
    height:auto !important;
    padding:10px 4% !important;
    display:flex !important;
    flex-direction:row !important;
    justify-content:space-between !important;
    align-items:center !important;
    gap:25px !important;
}

/* جهة الشعار واسم النقابة */
header.top .top-brand{
    display:flex !important;
    flex-direction:row !important;
    align-items:center !important;
    gap:12px !important;
    flex-shrink:0 !important;
}

/* حجم الشعار */
header.top .top-brand img.top-logo{
    width:70px !important;
    height:70px !important;
    max-width:70px !important;
    max-height:70px !important;
    min-width:70px !important;
    object-fit:contain !important;
    display:block !important;
}

/* اسم النقابة */
header.top .top-brand-text{
    width:auto !important;
    line-height:1.4 !important;
    white-space:nowrap !important;
}

header.top .top-brand-text strong{
    font-size:16px !important;
}

/* الاسم الإنجليزي */
header.top .brand-en{
    font-size:11px !important;
    line-height:1.4 !important;
}

/* روابط الإدارة */
header.top .top-nav{
    display:flex !important;
    flex-direction:row !important;
    align-items:center !important;
    justify-content:flex-start !important;
    flex-wrap:wrap !important;
    gap:2px !important;
    margin:0 !important;
}

header.top .top-nav a{
    margin:0 !important;
    padding:6px 7px !important;
    font-size:14px !important;
    white-space:nowrap !important;
}
.member-welcome {
    display: inline-flex;
    align-items: center;
    padding: 8px 12px;
    color: #ffffff;
    font-size: 14px;
    white-space: nowrap;
    border-left: 1px solid rgba(255,255,255,.25);
}

.member-welcome strong {
    margin-right: 4px;
    font-weight: 700;
}

/* الهاتف */
@media (max-width: 768px) {

    .member-welcome {
        width: 100%;
        justify-content: center;
        border-left: 0;
        border-bottom: 1px solid rgba(255,255,255,.15);
        padding: 9px 5px;
    }

}

/* =========================================================
   MEMBER MOBILE HAMBURGER MENU
   يعمل على صفحات العضو فقط
   ========================================================= */

/* مخفي على الكمبيوتر */
.member-menu-toggle,
.member-menu-close,
.member-menu-overlay{
    display:none;
}


/* =========================
   MEMBER MOBILE
   ========================= */

@media (max-width:768px){

    /* هيدر العضو فقط */
    header.top.member-top{
        min-height:76px !important;
        padding:8px 14px !important;
        display:flex !important;
        flex-direction:row !important;
        align-items:center !important;
        justify-content:space-between !important;
        gap:10px !important;
    }


    /* الهوية */
    header.member-top .union-brand{
        display:flex;
        align-items:center;
        gap:9px;
        min-width:0;
        flex:1 1 auto;
    }

    header.member-top .union-logo{
        width:52px;
        height:52px;
        max-width:52px;
        max-height:52px;
        flex:0 0 52px;
    }

    header.member-top .union-brand-text{
        min-width:0;
    }

    header.member-top .union-brand-text strong{
        font-size:13px;
        line-height:1.4;
    }

    header.member-top .brand-en{
        font-size:9px !important;
        line-height:1.3 !important;
    }


    /* زر الثلاث شرطات */
    .member-menu-toggle{
        width:48px;
        height:48px;
        min-width:48px;

        display:flex;
        flex-direction:column;
        justify-content:center;
        align-items:center;

        gap:5px;

        padding:0;
        margin:0;

        border:1px solid rgba(255,255,255,.20);
        border-radius:50%;

        background:rgba(255,255,255,.08);
        cursor:pointer;

        position:relative;
        z-index:1002;
    }

    .member-menu-toggle span{
        display:block;
        width:22px;
        height:2px;

        border-radius:3px;
        background:#fff;
    }


    /* خلفية سوداء شفافة عند فتح القائمة */
    .member-menu-overlay{
        display:block;

        position:fixed;
        inset:0;

        background:rgba(0,0,0,.48);

        opacity:0;
        visibility:hidden;

        transition:
            opacity .22s ease,
            visibility .22s ease;

        z-index:998;
    }

    .member-menu-overlay.mobile-open{
        opacity:1;
        visibility:visible;
    }


    /* القائمة الجانبية */
    header.member-top .member-nav{
        position:fixed !important;

        top:0;
        right:0;

        width:min(84vw,330px);
        height:100dvh;

        margin:0 !important;
        padding:76px 18px 25px !important;

        display:flex !important;
        flex-direction:column !important;
        flex-wrap:nowrap !important;
        align-items:stretch !important;
        justify-content:flex-start !important;

        gap:4px !important;

        background:var(--navy);

        overflow-y:auto;

        transform:translateX(105%);
        transition:transform .25s ease;

        box-shadow:-10px 0 30px rgba(0,0,0,.25);

        z-index:1001;
    }


    /* فتح القائمة */
    header.member-top .member-nav.mobile-open{
        transform:translateX(0);
    }


    /* زر X */
    .member-menu-close{
        display:flex;

        position:absolute;
        top:16px;
        left:16px;

        width:44px;
        height:44px;

        align-items:center;
        justify-content:center;

        padding:0;

        border:1px solid rgba(255,255,255,.20);
        border-radius:50%;

        background:rgba(255,255,255,.08);

        color:#fff;

        font-family:Arial,sans-serif;
        font-size:34px;
        line-height:1;

        cursor:pointer;
    }


    /* مرحباً بالعضو */
    header.member-top .member-welcome{
        width:100%;

        display:block;

        margin:0 0 10px;
        padding:10px 8px 14px;

        border-left:0;
        border-bottom:1px solid rgba(255,255,255,.16);

        color:#fff;

        text-align:right;
        font-size:14px;
    }


    /* روابط القائمة */
    header.member-top .member-nav a{
        display:block !important;

        width:100%;

        margin:0 !important;
        padding:12px 14px !important;

        border-radius:8px;

        color:#fff !important;

        text-align:right;

        font-size:15px !important;
        font-weight:700;

        white-space:normal !important;
    }

    header.member-top .member-nav a:hover,
    header.member-top .member-nav a:focus{
        background:rgba(255,255,255,.10);
    }


    /* منع الصفحة من التحرك خلف القائمة */
    body.member-menu-open{
        overflow:hidden;
    }
}

@media (max-width:768px){

    body.member-menu-open .member-menu-toggle{
        display:none !important;
    }

}

/* =========================================================
   صلاحيات الأعضاء - تحسين الموبايل فقط
   ========================================================= */

@media (max-width:600px){

    .permissions-grid{
        display:grid !important;
        grid-template-columns:1fr !important;
        gap:7px !important;
        margin-top:12px !important;
    }

    .permission-item{
        width:100% !important;
        min-height:52px !important;
        height:auto !important;

        display:flex !important;
        flex-direction:row !important;
        align-items:center !important;
        justify-content:flex-start !important;

        gap:10px !important;

        margin:0 !important;
        padding:10px 12px !important;

        border-radius:8px !important;
    }

    .permission-item input[type="checkbox"]{
        width:22px !important;
        height:22px !important;
        min-width:22px !important;
        min-height:22px !important;

        margin:0 !important;
        padding:0 !important;

        flex:0 0 22px !important;
    }

    .permission-item span{
        font-size:15px !important;
        line-height:1.4 !important;
        font-weight:700 !important;
    }

    .permission-item:nth-child(odd){
        background:#eef6fc !important;
    }

    .permission-item:nth-child(even){
        background:#ffffff !important;
    }

    .permission-actions{
        display:grid !important;
        grid-template-columns:1fr !important;
        gap:8px !important;
        margin-top:16px !important;
    }

    .permission-actions .btn{
        width:100% !important;
        text-align:center !important;
    }
}