/* ============================================================
   نظام الإشراف والمتابعة لأنشطة التغذية - RTL متجاوب
   ============================================================ */
* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --primary: #0d7a5f;
    --primary-dark: #095c47;
    --accent: #e8a13c;
    --bg: #f2f5f4;
    --card: #ffffff;
    --text: #1d2b28;
    --muted: #6b7d78;
    --border: #dde6e3;
    --good: #1a9e60;
    --ok: #3f7fbf;
    --warn: #e8a13c;
    --bad: #d64545;
    --sidebar-w: 230px;
    --radius: 12px;
    --shadow: 0 2px 10px rgba(20, 50, 40, .07);
}

body {
    font-family: 'Segoe UI', Tahoma, 'Noto Kufi Arabic', Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.7;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a { color: var(--primary); text-decoration: none; }

/* ---------- الشريط العلوي ---------- */
.topbar {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow);
}
.topbar-inner {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    max-width: 1400px;
    margin: auto;
}
.brand {
    color: #fff;
    font-weight: 700;
    font-size: 1.05rem;
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 0;
}
.brand-icon { font-size: 1.3rem; }
.user-box { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.user-name { font-size: .9rem; font-weight: 600; }
.role-badge {
    background: rgba(255,255,255,.2);
    border-radius: 20px;
    padding: 2px 12px;
    font-size: .78rem;
    white-space: nowrap;
}
.logout-link {
    color: #fff;
    background: rgba(255,255,255,.15);
    border-radius: 8px;
    padding: 6px 14px;
    min-height: 36px;
    display: inline-flex;
    align-items: center;
    font-size: .85rem;
}
.logout-link:hover { background: rgba(255,255,255,.3); }

.menu-toggle {
    display: none;
    background: rgba(255,255,255,.15);
    border: none;
    color: #fff;
    font-size: 1.3rem;
    border-radius: 8px;
    width: 44px;
    height: 44px;
    cursor: pointer;
}

/* ---------- التخطيط ---------- */
.layout {
    display: flex;
    flex: 1;
    max-width: 1400px;
    width: 100%;
    margin: 0 auto;
}
.layout-guest { justify-content: center; align-items: center; }

.sidebar {
    width: var(--sidebar-w);
    padding: 18px 10px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex-shrink: 0;
}
.sidebar a {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    min-height: 48px;
    border-radius: 10px;
    color: var(--text);
    font-weight: 600;
    font-size: .95rem;
    transition: background .15s;
}
.sidebar a:hover { background: #e3ede9; }
.sidebar a.active { background: var(--primary); color: #fff; }

.content {
    flex: 1;
    padding: 22px 20px 40px;
    min-width: 0;
}
.content-guest { display: flex; justify-content: center; align-items: center; width: 100%; }

.footer {
    text-align: center;
    color: var(--muted);
    font-size: .8rem;
    padding: 14px;
    border-top: 1px solid var(--border);
    background:  #35b18f;
}

/* ---------- البطاقات ---------- */
.card {
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px;
    margin-bottom: 20px;
}
.card h2 { font-size: 1.1rem; margin-bottom: 14px; color: var(--primary-dark); }
.page-title { font-size: 1.35rem; margin-bottom: 18px; color: var(--primary-dark); }

/* ---------- إحصائيات لوحة التحكم ---------- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 14px;
    margin-bottom: 20px;
}
.stat-card {
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 18px;
    text-align: center;
    border-top: 4px solid var(--primary);
}
.stat-card .stat-num { font-size: 1.9rem; font-weight: 800; color: var(--primary-dark); }
.stat-card .stat-label { color: var(--muted); font-size: .85rem; }
.stat-card.gold { border-top-color: var(--accent); }
.stat-card.blue { border-top-color: var(--ok); }
.stat-card.red  { border-top-color: var(--bad); }

.charts-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 18px;
}

/* ---------- الرسوم البيانية SVG ---------- */
.bar-chart { display: flex; flex-direction: column; gap: 8px; }
.bar-row { display: flex; align-items: center; gap: 8px; font-size: .82rem; }
.bar-label { width: 110px; flex-shrink: 0; text-align: left; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-track { flex: 1; background: #eef3f1; border-radius: 6px; height: 22px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 6px; background: linear-gradient(90deg, var(--primary), #35b18f); min-width: 2px; transition: width .5s; }
.bar-value { width: 46px; flex-shrink: 0; font-weight: 700; font-size: .8rem; }

.donut-wrap { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; justify-content: center; }
.donut-legend { display: flex; flex-direction: column; gap: 6px; font-size: .85rem; }
.legend-item { display: flex; align-items: center; gap: 8px; }
.legend-dot { width: 12px; height: 12px; border-radius: 3px; flex-shrink: 0; }

/* ---------- الجداول ---------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.data-table { width: 100%; border-collapse: collapse; font-size: .88rem; }
.data-table th, .data-table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    text-align: right;
    white-space: nowrap;
}
.data-table th { background: #f6faf8; color: var(--primary-dark); font-weight: 700; position: sticky; top: 0; }
.data-table tr:hover td { background: #f4faf7; }

/* ---------- الشارات ---------- */
.badge { display: inline-block; padding: 3px 12px; border-radius: 20px; font-size: .78rem; font-weight: 700; }
.badge.good, .st-approved { background: #ddf3e7; color: var(--good); }
.badge.ok   { background: #e0ecf7; color: var(--ok); }
.badge.warn { background: #fdf0da; color: #b57a1a; }
.badge.bad  { background: #fbe2e2; color: var(--bad); }
.st-draft    { background: #eceff1; color: #607d8b; }
.st-submitted{ background: #e0ecf7; color: var(--ok); }
.st-supervisor-approved { background: #e8f3ff; color: #245b8f; }
.st-state-approved { background: #e7f5ed; color: #187247; }

/* ---------- الأزرار ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 44px;
    padding: 10px 22px;
    border-radius: 10px;
    border: none;
    cursor: pointer;
    font-family: inherit;
    font-size: .92rem;
    font-weight: 700;
    transition: filter .15s, transform .1s;
}
.btn:hover { filter: brightness(1.07); }
.btn:active { transform: scale(.98); }
.btn-primary { background: var(--primary); color: #fff; }
.btn-accent  { background: var(--accent); color: #fff; }
.btn-outline { background: #fff; color: var(--primary); border: 2px solid var(--primary); }
.btn-danger  { background: var(--bad); color: #fff; }
.btn-sm { min-height: 36px; padding: 6px 14px; font-size: .82rem; }
.btn-block { width: 100%; }
.btn-group { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- النماذج ---------- */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 14px;
}
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group label { font-weight: 700; font-size: .88rem; }
input[type=text], input[type=password], input[type=number], input[type=date],
input[type=email], select, textarea {
    width: 100%;
    min-height: 44px;
    padding: 10px 12px;
    border: 1.5px solid var(--border);
    border-radius: 10px;
    font-family: inherit;
    font-size: .95rem;
    background: #fff;
    color: var(--text);
}
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(13,122,95,.12);
}
textarea { min-height: 80px; resize: vertical; }

/* ---------- أسئلة الاستمارة ---------- */
.section-block { margin-bottom: 22px; }
.section-head {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
    border-radius: var(--radius) var(--radius) 0 0;
    padding: 12px 18px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}
.section-head h3 { font-size: 1rem; }
.section-score-chip {
    background: rgba(255,255,255,.2);
    padding: 3px 14px;
    border-radius: 20px;
    font-size: .8rem;
}
.section-body {
    background: var(--card);
    border-radius: 0 0 var(--radius) var(--radius);
    box-shadow: var(--shadow);
    padding: 8px 0;
}
.q-row {
    display: grid;
    grid-template-columns: 44px 1fr 260px 44px;
    gap: 10px;
    align-items: center;
    padding: 10px 16px;
    border-bottom: 1px solid #f0f5f3;
}
.q-row:last-child { border-bottom: none; }
.q-num { font-weight: 800; color: var(--muted); font-size: .85rem; }
.q-text { font-size: .92rem; }
.q-text .q-max { color: var(--muted); font-size: .75rem; }
.q-input select, .q-input input { min-height: 44px; }
.q-note-toggle {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.1rem;
    color: var(--muted);
    width: 40px;
    height: 40px;
    border-radius: 8px;
}
.q-note-toggle:hover { background: #eef3f1; color: var(--primary); }
.q-note-box { grid-column: 1 / -1; display: none; padding: 0 8px 6px; }
.q-note-box.open { display: block; }
.q-header-row {
    background: #f0f7f4;
    font-weight: 800;
    color: var(--primary-dark);
    padding: 10px 16px;
    font-size: .95rem;
}
.score-hint { font-size: .72rem; color: var(--good); font-weight: 700; }

.score-summary {
    position: sticky;
    bottom: 0;
    background: #fff;
    border-top: 2px solid var(--primary);
    box-shadow: 0 -4px 14px rgba(0,0,0,.08);
    padding: 12px 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    z-index: 50;
    border-radius: var(--radius) var(--radius) 0 0;
}
.score-summary .big { font-size: 1.3rem; font-weight: 800; color: var(--primary-dark); }
.score-summary .spacer { flex: 1; }

/* ---------- تسجيل الدخول ---------- */
.login-card {
    background: #fff;
    border-radius: 16px;
    box-shadow: var(--shadow);
    padding: 34px 30px;
    width: 100%;
    max-width: 420px;
    margin: 40px auto;
}
.login-card .logo { text-align: center; font-size: 3rem; margin-bottom: 6px; }
.login-card h1 { text-align: center; font-size: 1.15rem; color: var(--primary-dark); margin-bottom: 22px; }

/* ---------- الفلاش ---------- */
.flash {
    padding: 12px 18px;
    border-radius: 10px;
    margin-bottom: 16px;
    font-weight: 600;
    font-size: .9rem;
}
.flash-success { background: #ddf3e7; color: #146c43; border-right: 4px solid var(--good); }
.flash-error   { background: #fbe2e2; color: #a33333; border-right: 4px solid var(--bad); }

/* ---------- الفلاتر ---------- */
.filters {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: flex-end;
    margin-bottom: 16px;
}
.filters .form-group { min-width: 150px; flex: 1; }
.filters .btn { flex-shrink: 0; }

/* ---------- عرض استمارة ---------- */
.answer-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 18px; font-size: .9rem; }
.answer-item { padding: 6px 0; border-bottom: 1px dashed #eef3f1; }
.answer-item .a-q { color: var(--muted); font-size: .8rem; }
.answer-item .a-v { font-weight: 600; }

.progress-ring-wrap { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }

/* ---------- التجاوب ---------- */
@media (max-width: 900px) {
    .menu-toggle { display: inline-flex; align-items: center; justify-content: center; }
    .sidebar {
        position: fixed;
        inset-inline-start: 0;
        top: 64px;
        bottom: 0;
        background: #fff;
        box-shadow: var(--shadow);
        z-index: 90;
        transform: translateX(100%);
        transition: transform .25s;
        padding-top: 12px;
    }
    .sidebar.open { transform: translateX(0); }
    .content { padding: 16px 12px 60px; }
    .q-row { grid-template-columns: 34px 1fr; grid-template-rows: auto auto; }
    .q-input { grid-column: 1 / -1; }
    .q-note-toggle { position: absolute; inset-inline-end: 8px; }
    .q-row { position: relative; padding-inline-end: 54px; }
    .answer-grid { grid-template-columns: 1fr; }
    .brand span:last-child { display: none; }
}

@media (max-width: 480px) {
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .login-card { margin: 16px; padding: 24px 18px; }
    .bar-label { width: 82px; }
}



.image-side {
            flex: 1;
            display: flex;
            justify-content: center;
            align-items: center;
        }
        .image-side img {
            max-width: 80%;
            height: auto;
            border-radius: 15px;
            opacity: 0.9;
            filter: drop-shadow(0 4px 15px rgba(0,0,0,0.1));
            animation: zoomIn 1s ease-in-out;
        }
		
		/* ============================================================
   حالة حقول الإجابة في الاستمارة
   فارغ = أحمر فاتح
   مكتمل = أخضر فاتح
   ============================================================ */

.answer-field {
    transition:
        background-color 0.2s ease,
        border-color 0.2s ease,
        box-shadow 0.2s ease;
}

/* الحقل الفارغ */
.answer-field.answer-empty {
    background-color: #fff1f1;
    border-color: #efb4b4;
}

/* الحقل الذي تمت الإجابة عليه */
.answer-field.answer-filled {
    background-color: #edfaf2;
    border-color: #a8d9bd;
}

/* عند التركيز على الحقل */
.answer-field.answer-empty:focus {
    background-color: #fff7f7;
    border-color: #d98282;
    box-shadow: 0 0 0 3px rgba(214, 69, 69, .08);
}

.answer-field.answer-filled:focus {
    background-color: #f4fcf7;
    border-color: #6fbe91;
    box-shadow: 0 0 0 3px rgba(26, 158, 96, .08);
}

/* ============================================================
   PREMIUM APPLICATION HEADER
   Nutrition Supervision System
============================================================ */

:root {
    --app-green: #176b4d;
    --app-green-dark: #0f513a;
    --app-green-soft: #eaf6f0;
    --app-green-light: #f3faf7;

    --app-text: #20352d;
    --app-muted: #71817a;
    --app-border: #e3ebe7;

    --header-height: 76px;
}


/* ============================================================
   HEADER
============================================================ */

.app-header {
    position: sticky;
    top: 0;
    z-index: 1000;

    width: 100%;

   
    background:
        linear-gradient(
            135deg,
            #176b4d,
            #0f513a
        );

    border-bottom:
        1px solid var(--app-border);

    box-shadow:
        0 4px 18px rgba(24, 65, 48, .06);

    backdrop-filter:
        blur(14px);

    transition:
        box-shadow .25s ease,
        transform .25s ease;
}


.app-header.is-scrolled {

    box-shadow:
        0 8px 28px rgba(24, 65, 48, .11);

}


.app-header-inner {

    width: 100%;

    min-height:
        var(--header-height);

    padding:
        0 24px;

    display: flex;

    align-items: center;

    gap: 20px;
}


/* ============================================================
   BRAND
============================================================ */

.app-brand {

    display: flex;

    align-items: center;

    gap: 11px;

    min-width: 250px;

    color:
        var(--app-text);

    text-decoration: none;

    flex-shrink: 0;
}


.app-brand:hover {

    color:
        var(--app-green);

}


.app-brand-mark {

    position: relative;

    width: 43px;
    height: 43px;

    border-radius: 13px;

    background:
        linear-gradient(
            145deg,
            var(--app-green),
            var(--app-green-dark)
        );

    display: flex;

    align-items: center;

    justify-content: center;

    box-shadow:
        0 7px 16px rgba(23, 107, 77, .20);
}


.brand-leaf {

    position: absolute;

    width: 15px;
    height: 21px;

    background: #fff;

    border-radius:
        100% 0 100% 0;

    opacity: .96;
}


.brand-leaf-one {

    transform:
        rotate(-28deg)
        translate(-4px, -1px);
}


.brand-leaf-two {

    transform:
        rotate(28deg)
        translate(4px, -1px);
}


.brand-cross {

    position: relative;

    width: 0px;
    height: 0px;

    background:
        var(--app-green);

    border-radius: 5px;

    z-index: 2;
}


.brand-cross::after {

    content: "";

    position: absolute;

    width: 26px;
    height: 6px;

    right: -10px;
    top: 10px;

    border-radius: 5px;

    background:
        var(--app-green);
}


.app-brand-text {

    display: flex;

    flex-direction: column;

    line-height: 1.25;
}


.app-brand-text strong {

    font-size: 15px;

    font-weight: 800;

    white-space: nowrap;
}


.app-brand-text small {

    margin-top: 3px;

    color:
        var(--app-muted);

    font-size: 11px;

    font-weight: 600;

    white-space: nowrap;
}


/* ============================================================
   HEADER CONTEXT
============================================================ */

.header-context {

    display: flex;

    align-items: center;

    gap: 12px;

    margin-inline: auto;
}


.system-status {

    display: inline-flex;

    align-items: center;

    gap: 7px;

    padding:
        8px 11px;

    border:
        1px solid #dcebe3;

    border-radius: 10px;

    background:
        #f6fbf8;

    color:
        #4d655b;

    font-size: 11px;

    font-weight: 700;

    white-space: nowrap;
}


.status-dot {

    width: 8px;
    height: 8px;

    border-radius: 50%;

    background:
        #20a56b;

    box-shadow:
        0 0 0 4px rgba(32, 165, 107, .10);
}


.scope-indicator {

    display: flex;

    align-items: center;

    gap: 9px;

    padding:
        6px 12px;

    border-right:
        1px solid var(--app-border);

}


.scope-icon {

    width: 34px;
    height: 34px;

    display: flex;

    align-items: center;
    justify-content: center;

    border-radius: 9px;

    color:
        var(--app-green);

    background:
        var(--app-green-soft);

}


.scope-content {

    display: flex;

    flex-direction: column;

    line-height: 1.25;
}


.scope-content small {

    color:
        var(--app-muted);

    font-size: 9px;

    font-weight: 600;
}


.scope-content strong {

    margin-top: 3px;

    color:
        var(--app-text);

    font-size: 11px;

    font-weight: 800;

    white-space: nowrap;
}


/* ============================================================
   HEADER ACTIONS
============================================================ */

.header-actions {

    display: flex;

    align-items: center;

    gap: 10px;

    margin-right: auto;
}


.header-icon-button {

    position: relative;

    width: 39px;
    height: 39px;

    border:
        1px solid var(--app-border);

    border-radius: 10px;

    background:
        #fff;

    color:
        #52665e;

    display: flex;

    align-items: center;
    justify-content: center;

    cursor: pointer;

    transition:
        .2s ease;
}


.header-icon-button:hover {

    color:
        var(--app-green);

    background:
        var(--app-green-light);

    border-color:
        #cce3d8;

    transform:
        translateY(-1px);
}


.header-icon-button i {

    font-size: 17px;
}


.notification-badge {

    position: absolute;

    top: -4px;
    left: -4px;

    min-width: 16px;
    height: 16px;

    padding: 0 4px;

    border-radius: 20px;

    background:
        #dc3545;

    color: #fff;

    font-size: 8px;

    display: flex;

    align-items: center;
    justify-content: center;

    border:
        2px solid #fff;
}


.header-divider {

    width: 1px;
    height: 30px;

    background:
        var(--app-border);

    margin-inline: 2px;
}


/* ============================================================
   USER MENU
============================================================ */

.user-menu {

    position: relative;
}


.user-menu-button {

    display: flex;

    align-items: center;

    gap: 9px;

    padding:
        5px 7px;

    border:
        1px solid transparent;

    border-radius: 12px;

    background: transparent;

    cursor: pointer;

    transition:
        .2s ease;
}


.user-menu-button:hover,
.user-menu.open .user-menu-button {

    background:
        var(--app-green-light);

    border-color:
        #dbece4;
}


.user-avatar {

    width: 39px;
    height: 39px;

    border-radius: 11px;

    display: flex;

    align-items: center;
    justify-content: center;

    color: #fff;

    background:
        linear-gradient(
            145deg,
            #2b9670,
            var(--app-green-dark)
        );

    font-size: 15px;

    font-weight: 800;

    box-shadow:
        0 4px 10px rgba(23, 107, 77, .16);
}


.user-details {

    display: flex;

    flex-direction: column;

    align-items: flex-start;

    line-height: 1.25;
}


.user-details strong {

    max-width: 150px;

    overflow: hidden;

    text-overflow: ellipsis;

    white-space: nowrap;

    color:
        var(--app-text);

    font-size: 12px;

    font-weight: 800;
}


.user-details small {

    margin-top: 3px;

    color:
        var(--app-muted);

    font-size: 9px;

    font-weight: 600;
}


.user-details small i {

    color:
        var(--app-green);

    margin-left: 3px;
}


.user-menu-arrow {

    color:
        #7b8a84;

    font-size: 11px;

    transition:
        transform .2s ease;
}


.user-menu.open
.user-menu-arrow {

    transform:
        rotate(180deg);
}


/* ============================================================
   USER DROPDOWN
============================================================ */

.user-dropdown {

    position: absolute;

    top: calc(100% + 9px);

    left: 0;

    width: 270px;

    padding: 10px;

    border:
        1px solid var(--app-border);

    border-radius: 15px;

    background: #fff;

    box-shadow:
        0 15px 45px rgba(25, 60, 45, .14);

    opacity: 0;

    visibility: hidden;

    transform:
        translateY(-7px);

    transition:
        .2s ease;

    z-index: 1100;
}


.user-menu.open
.user-dropdown {

    opacity: 1;

    visibility: visible;

    transform:
        translateY(0);
}


.user-dropdown-head {

    display: flex;

    align-items: center;

    gap: 10px;

    padding: 9px;
}


.user-dropdown-avatar {

    width: 42px;
    height: 42px;

    border-radius: 12px;

    display: flex;

    align-items: center;
    justify-content: center;

    background:
        var(--app-green-soft);

    color:
        var(--app-green);

    font-size: 15px;

    font-weight: 800;
}


.user-dropdown-head div:last-child {

    display: flex;

    flex-direction: column;
}


.user-dropdown-head strong {

    color:
        var(--app-text);

    font-size: 12px;
}


.user-dropdown-head span {

    margin-top: 3px;

    color:
        var(--app-muted);

    font-size: 10px;
}


.user-dropdown-scope {

    display: flex;

    align-items: center;

    gap: 8px;

    padding:
        9px 10px;

    border-radius: 9px;

    background:
        #f7faf8;

    color:
        #5f716a;

    font-size: 10px;

    font-weight: 700;
}


.user-dropdown-scope i {

    color:
        var(--app-green);
}


.user-dropdown-divider {

    height: 1px;

    background:
        #edf1ef;

    margin:
        7px 0;
}


.user-dropdown-link {

    display: flex;

    align-items: center;

    gap: 9px;

    padding:
        10px;

    border-radius: 9px;

    color:
        #50625b;

    text-decoration: none;

    font-size: 11px;

    font-weight: 700;

    transition:
        .2s ease;
}


.user-dropdown-link:hover {

    background:
        var(--app-green-light);

    color:
        var(--app-green);
}


.user-dropdown-link i {

    width: 20px;

    text-align: center;

    font-size: 15px;
}


.user-dropdown-link.logout {

    color:
        #b02a37;
}


.user-dropdown-link.logout:hover {

    background:
        #fff1f2;

    color:
        #b02a37;
}


/* ============================================================
   MOBILE MENU BUTTON
============================================================ */

.header-menu-toggle {

    display: none;

    width: 40px;
    height: 40px;

    border:
        1px solid var(--app-border);

    border-radius: 10px;

    background: #fff;

    color:
        var(--app-green);

    align-items: center;
    justify-content: center;

    cursor: pointer;
}


.header-menu-toggle i {

    font-size: 21px;
}


/* ============================================================
   SIDEBAR UPGRADE
============================================================ */

.sidebar {

    transition:
        transform .3s ease,
        box-shadow .3s ease;
}


.sidebar-header {

    min-height: 56px;

    padding:
        0 16px;

    display: flex;

    align-items: center;

    justify-content: space-between;

    color:
        #71817a;

    font-size: 10px;

    font-weight: 800;

    border-bottom:
        1px solid var(--app-border);
}


.sidebar-close {

    display: none;

    border: 0;

    background: transparent;

    color:
        #74857d;

    cursor: pointer;
}


.sidebar-link {

    position: relative;

    display: flex;

    align-items: center;

    gap: 11px;

    margin:
        4px 9px;

    padding:
        11px 12px;

    border-radius: 10px;

    color:
        #60736a;

    text-decoration: none;

    font-size: 12px;

    font-weight: 700;

    transition:
        .2s ease;
}


.sidebar-link:hover {

    color:
        var(--app-green);

    background:
        #f1f8f4;

    transform:
        translateX(-2px);
}


.sidebar-link.active {

    color:
        var(--app-green);

    background:
        linear-gradient(
            90deg,
            #e8f5ee,
            #f5faf7
        );

    box-shadow:
        inset -3px 0 0 var(--app-green);
}


.sidebar-link-icon {

    width: 30px;
    height: 30px;

    flex-shrink: 0;

    display: flex;

    align-items: center;
    justify-content: center;

    border-radius: 8px;

    background:
        #f1f5f3;

    color:
        #71817a;

    transition:
        .2s ease;
}


.sidebar-link:hover
.sidebar-link-icon,
.sidebar-link.active
.sidebar-link-icon {

    background:
        #f6fbf8;

    color:
        var(--app-green);
}


.sidebar-link-text {

    flex: 1;
}


.sidebar-footer {

    margin-top: auto;

    padding:
        12px;
}


.sidebar-system-card {

    display: flex;

    align-items: center;

    gap: 9px;

    padding:
        10px;

    border:
        1px solid #e1ebe6;

    border-radius: 11px;

    background:
        #f7faf8;
}


.sidebar-system-icon {

    width: 31px;
    height: 31px;

    display: flex;

    align-items: center;
    justify-content: center;

    border-radius: 8px;

    background:
        #e4f3eb;

    color:
        var(--app-green);
}


.sidebar-system-card div {

    display: flex;

    flex-direction: column;
}


.sidebar-system-card strong {

    color:
        #4f625a;

    font-size: 10px;
}


.sidebar-system-card small {

    margin-top: 2px;

    color:
        #91a099;

    font-size: 8px;
}


/* ============================================================
   SIDEBAR OVERLAY
============================================================ */

.sidebar-overlay {

    display: none;
}


/* ============================================================
   MOBILE
============================================================ */

@media (max-width: 1000px) {

    .app-header-inner {

        padding:
            0 15px;

        gap: 10px;
    }


    .header-menu-toggle {

        display: flex;
    }


    .app-brand {

        min-width: 0;

        margin-left: auto;
    }


    .app-brand-text strong {

        font-size: 12px;
    }


    .app-brand-text small {

        font-size: 9px;
    }


    .header-context {

        display: none;
    }


    .user-details {

        display: none;
    }


    .user-menu-arrow {

        display: none;
    }


    .header-actions {

        margin-right: 0;
    }


    .sidebar {

        position: fixed;

        top: 0;
        right: 0;

        width: 285px;

        height: 100vh;

        z-index: 1200;

        transform:
            translateX(110%);

        box-shadow:
            -10px 0 35px rgba(0,0,0,.12);

        background: #fff;

        overflow-y: auto;
    }


    .sidebar.mobile-open {

        transform:
            translateX(0);
    }


    .sidebar-close {

        display: block;
    }


    .sidebar-overlay {

        position: fixed;

        inset: 0;

        z-index: 1150;

        background:
            rgba(18, 38, 30, .42);

        backdrop-filter:
            blur(2px);

        opacity: 0;

        visibility: hidden;

        transition:
            .25s ease;
    }


    .sidebar-overlay.active {

        display: block;

        opacity: 1;

        visibility: visible;
    }
}


@media (max-width: 600px) {

    :root {

        --header-height: 66px;
    }


    .app-header-inner {

        min-height:
            var(--header-height);

        padding:
            0 10px;
    }


    .app-brand-mark {

        width: 37px;
        height: 37px;

        border-radius: 10px;
    }


    .app-brand-text strong {

        font-size: 11px;
    }


    .app-brand-text small {

        font-size: 8px;
    }


    .header-icon-button {

        width: 36px;
        height: 36px;
    }


    .user-avatar {

        width: 36px;
        height: 36px;
    }


    .user-dropdown {

        position: fixed;

        top:
            calc(var(--header-height) + 8px);

        left: 10px;
        right: 10px;

        width: auto;
    }


    .sidebar {

        width:
            min(285px, 88vw);
    }
}


.app-brand,
.app-brand:hover {
    color: #ffffff;
}

.app-brand-text small {
    color: rgba(255,255,255,.75);
}

.system-status {
    background: rgba(255,255,255,.10);
    border-color: rgba(255,255,255,.18);
    color: #ffffff;
}

.scope-indicator {
    border-right-color: rgba(255,255,255,.20);
}

.scope-content small {
    color: rgba(255,255,255,.65);
}

.scope-content strong {
    color: #ffffff;
}

.scope-icon {
    background: rgba(255,255,255,.13);
    color: #ffffff;
}

.header-icon-button {
    background: rgba(255,255,255,.10);
    border-color: rgba(255,255,255,.20);
    color: #ffffff;
}

.header-icon-button:hover {
    background: rgba(255,255,255,.18);
    color: #ffffff;
}

.header-divider {
    background: rgba(255,255,255,.20);
}

.user-menu-button:hover,
.user-menu.open .user-menu-button {
    background: rgba(255,255,255,.12);
    border-color: rgba(255,255,255,.18);
}

.user-details strong {
    color: #ffffff;
}

.user-details small {
    color: rgba(255,255,255,.70);
}

.user-details small i {
    color: #b9edcf;
}

.user-menu-arrow {
    color: rgba(255,255,255,.75);
}

/* ============================================================
PROFESSIONAL LOGIN PAGE
نظام الإشراف والمتابعة المتكامل لأنشطة التغذية
============================================================ */

.login-page {

position: relative;

width: 100%;

min-height:
    calc(100vh - 60px);

display: flex;

align-items: center;

justify-content: center;

padding:
    40px 20px;

overflow: hidden;

background:
    #eef6f2;

}

/* ============================================================
BACKGROUND
============================================================ */

.login-background {

position: absolute;

inset: 0;

overflow: hidden;

background:
    linear-gradient(
        135deg,
        #0d7a5f 0%,
        #095c47 48%,
        #063e31 100%
    );

}

.login-background::before {

content: "";

position: absolute;

inset: 0;

background:
    radial-gradient(
        circle at 15% 20%,
        rgba(255,255,255,.14),
        transparent 28%
    ),

    radial-gradient(
        circle at 85% 80%,
        rgba(111,214,164,.12),
        transparent 30%
    );

}

.login-pattern {

position: absolute;

inset: 0;

opacity: .08;

background-image:
    linear-gradient(
        30deg,
        #fff 12%,
        transparent 12.5%,
        transparent 87%,
        #fff 87.5%,
        #fff
    ),

    linear-gradient(
        150deg,
        #fff 12%,
        transparent 12.5%,
        transparent 87%,
        #fff 87.5%,
        #fff
    );

background-size:
    60px 105px;

}

.login-orb {

position: absolute;

border-radius: 50%;

filter:
    blur(2px);

}

.login-orb-one {

width: 420px;
height: 420px;

top: -230px;
left: -120px;

background:
    rgba(132, 224, 173, .10);

}

.login-orb-two {

width: 500px;
height: 500px;

right: -240px;
bottom: -300px;

background:
    rgba(255,255,255,.07);

}

/* ============================================================
LOGIN SHELL
============================================================ */

.login-shell {

position: relative;

z-index: 5;

width: 100%;

max-width: 1020px;

min-height: 610px;

display: grid;

grid-template-columns:
    1.05fr .95fr;

direction: rtl;

background: #fff;

border-radius: 24px;

overflow: hidden;

box-shadow:
    0 30px 80px rgba(0, 38, 28, .25);

animation:
    loginShellIn .55s ease both;

}

@keyframes loginShellIn {

from {

    opacity: 0;

    transform:
        translateY(18px)
        scale(.985);

}

to {

    opacity: 1;

    transform:
        translateY(0)
        scale(1);

}

}

/* ============================================================
GREEN INTRO PANEL
============================================================ */

.login-intro {

position: relative;

display: flex;

flex-direction: column;

justify-content: space-between;

padding:
    55px 48px 30px;

color: #fff;

background:
    linear-gradient(
        150deg,
        #0d7a5f,
        #095c47
    );

overflow: hidden;

}

.login-intro::after {

content: "";

position: absolute;

width: 340px;
height: 340px;

border-radius: 50%;

left: -170px;
bottom: -170px;

border:
    1px solid rgba(255,255,255,.12);

box-shadow:
    0 0 0 45px rgba(255,255,255,.025),
    0 0 0 90px rgba(255,255,255,.02);

}

.login-intro-content {

position: relative;

z-index: 2;

}

.login-brand-mark {

position: relative;

width: 68px;
height: 68px;

margin-bottom: 28px;

border-radius: 19px;

background:
    rgba(255,255,255,.13);

border:
    1px solid rgba(255,255,255,.20);

display: flex;

align-items: center;

justify-content: center;

box-shadow:
    0 10px 25px rgba(0,0,0,.10);

}

/* رمز نباتي محايد — لا يحمل أي دلالة دينية */

.login-leaf {

position: absolute;

width: 18px;
height: 31px;

background:
    #fff;

border-radius:
    100% 0 100% 0;

}

.leaf-one {

transform:
    rotate(-35deg)
    translate(-10px, 1px);

opacity: .95;

}

.leaf-two {

transform:
    rotate(35deg)
    translate(10px, 1px);

opacity: .78;

}

.leaf-three {

width: 15px;
height: 26px;

transform:
    translateY(-8px);

opacity: .9;

}

.login-eyebrow {

display: inline-flex;

align-items: center;

gap: 7px;

margin-bottom: 13px;

color:
    #bdebd2;

font-size: 12px;

font-weight: 700;

}

.login-eyebrow::before {

content: "";

width: 25px;
height: 2px;

border-radius: 5px;

background:
    #bdebd2;

}

.login-intro h1 {

margin: 0;

max-width: 460px;

font-size:
    clamp(25px, 3vw, 36px);

line-height: 1.45;

font-weight: 800;

color: #fff;

}

.login-intro h1 strong {

display: block;

color:
    #c9f3d9;

font-weight: 800;

}

.login-intro p {

max-width: 465px;

margin:
    20px 0 34px;

color:
    rgba(255,255,255,.76);

font-size: 14px;

line-height: 2;

}

/* ============================================================
FEATURES
============================================================ */

.login-features {

display: flex;

flex-direction: column;

gap: 13px;

}

.login-feature {

display: flex;

align-items: center;

gap: 12px;

}

.login-feature-icon {

width: 40px;
height: 40px;

flex-shrink: 0;

display: flex;

align-items: center;
justify-content: center;

border-radius: 11px;

background:
    rgba(255,255,255,.11);

border:
    1px solid rgba(255,255,255,.12);

color:
    #d1f5df;

}

.login-feature > span:last-child {

display: flex;

flex-direction: column;

}

.login-feature strong {

color: #fff;

font-size: 11px;

}

.login-feature small {

margin-top: 2px;

color:
    rgba(255,255,255,.60);

font-size: 9px;

}

/* ============================================================
INTRO FOOTER
============================================================ */

.login-intro-footer {

position: relative;

z-index: 2;

display: flex;

align-items: center;

gap: 12px;

color:
    rgba(255,255,255,.62);

font-size: 10px;

}

.login-intro-footer span {

display: inline-flex;

align-items: center;

gap: 5px;

}

.login-intro-footer i {

color:
     #f6fbf8;

}

.login-footer-dot {

width: 4px;
height: 4px;

border-radius: 50%;

background:
    rgba(255,255,255,.35);

}

/* ============================================================
FORM PANEL
============================================================ */

.login-form-panel {

display: flex;

flex-direction: column;

justify-content: space-between;

min-width: 0;

background:
    #fff;

}

.login-form-container {

width: 100%;

max-width: 410px;

margin:
    auto;

padding:
    50px 42px 25px;

}

/* ============================================================
HEADING
============================================================ */

.login-heading {

display: flex;

align-items: center;

gap: 13px;

}

.login-heading-icon {

width: 47px;
height: 47px;

flex-shrink: 0;

display: flex;

align-items: center;
justify-content: center;

border-radius: 13px;

background:
    #e9f6f0;

color:
    var(--primary);

font-size: 20px;

}

.login-heading > div {

display: flex;

flex-direction: column;

}

.login-heading > div > span {

color:
    var(--muted);

font-size: 10px;

font-weight: 600;

}

.login-heading h2 {

margin: 2px 0 0;

color:
    var(--primary-dark);

font-size: 23px;

font-weight: 800;

}

.login-subtitle {

margin:
    13px 0 27px;

color:
    var(--muted);

font-size: 11px;

}

/* ============================================================
ERROR
============================================================ */

.login-error {

display: flex;

align-items: flex-start;

gap: 10px;

padding:
    11px 12px;

margin-bottom: 19px;

border:
    1px solid #f2cccc;

border-right:
    3px solid var(--bad);

border-radius: 10px;

background:
    #fff6f6;

color:
    #9e3838;

}

.login-error-icon {

width: 27px;
height: 27px;

flex-shrink: 0;

display: flex;

align-items: center;
justify-content: center;

border-radius: 8px;

background:
    #fbe1e1;

}

.login-error div {

display: flex;

flex-direction: column;

}

.login-error strong {

font-size: 10px;

}

.login-error span:last-child {

margin-top: 2px;

font-size: 9px;

color:
    #a65a5a;

}

/* ============================================================
FORM
============================================================ */

.professional-login-form {

display: flex;

flex-direction: column;

gap: 19px;

}

.login-field {

display: flex;

flex-direction: column;

gap: 7px;

}

.login-field label {

color:
    #344d44;

font-size: 11px;

font-weight: 800;

}

.login-input-wrapper {

position: relative;

display: flex;

align-items: center;

}

.login-input-wrapper input {

width: 100%;

min-height: 51px;

padding:
    10px 45px 10px 45px;

border:
    1.5px solid #dce7e3;

border-radius: 11px;

background:
    #fbfdfc;

color:
    var(--text);

font-family: inherit;

font-size: 12px;

transition:
    .2s ease;

}

.login-input-wrapper input::placeholder {

color:
    #a7b5af;

}

.login-input-wrapper input:hover {

border-color:
    #c9dcd4;

}

.login-input-wrapper input:focus {

outline: none;

background:
    #fff;

border-color:
    var(--primary);

box-shadow:
    0 0 0 4px rgba(13,122,95,.09);

}

.login-input-icon {

position: absolute;

right: 14px;

z-index: 2;

color:
    #82938c;

font-size: 16px;

pointer-events: none;

}

.login-input-wrapper input:focus

* .password-toggle {

  color:
  var(--primary);

}

/* ============================================================
PASSWORD BUTTON
============================================================ */

.password-toggle {

position: absolute;

left: 10px;

width: 32px;
height: 32px;

display: flex;

align-items: center;
justify-content: center;

border: 0;

border-radius: 8px;

background: transparent;

color:
    #81918a;

cursor: pointer;

transition:
    .2s ease;

}

.password-toggle:hover {

background:
    #edf7f2;

color:
    var(--primary);

}

/* ============================================================
OPTIONS
============================================================ */

.login-options {

display: flex;

justify-content: flex-start;

margin-top: -4px;

}

.remember-option {

display: inline-flex;

align-items: center;

gap: 7px;

cursor: pointer;

color:
    #73837d;

font-size: 10px;

}

.remember-option input {

width: 15px;
height: 15px;

accent-color:
    var(--primary);

cursor: pointer;

}

/* ============================================================
SUBMIT
============================================================ */

.login-submit {

position: relative;

width: 100%;

min-height: 53px;

display: flex;

align-items: center;

justify-content: space-between;

padding:
    0 17px;

border: 0;

border-radius: 12px;

background:
    linear-gradient(
        135deg,
        #0d7a5f,
        #095c47
    );

color: #fff;

font-family: inherit;

font-size: 12px;

font-weight: 800;

cursor: pointer;

overflow: hidden;

box-shadow:
    0 8px 18px rgba(13,122,95,.20);

transition:
    transform .2s ease,
    box-shadow .2s ease,
    filter .2s ease;

}

.login-submit::before {

content: "";

position: absolute;

inset: 0;

background:
    linear-gradient(
        110deg,
        transparent 20%,
        rgba(255,255,255,.15) 50%,
        transparent 80%
    );

transform:
    translateX(-100%);

transition:
    transform .55s ease;

}

.login-submit:hover {

transform:
    translateY(-2px);

box-shadow:
    0 12px 25px rgba(13,122,95,.28);

}

.login-submit:hover::before {

transform:
    translateX(100%);

}

.login-submit span,
.login-submit-arrow {

position: relative;

z-index: 2;

}

.login-submit span {

display: inline-flex;

align-items: center;

gap: 8px;

}

.login-submit span i {

font-size: 16px;

}

.login-submit-arrow {

width: 29px;
height: 29px;

display: flex;

align-items: center;
justify-content: center;

border-radius: 8px;

background:
    rgba(255,255,255,.12);

}

/* ============================================================
SECURITY
============================================================ */

.login-security {

display: flex;

align-items: center;

gap: 9px;

margin-top: 25px;

padding:
    10px 11px;

border:
    1px solid #e5eeea;

border-radius: 10px;

background:
    #f8fbf9;

}

.login-security-icon {

width: 31px;
height: 31px;

flex-shrink: 0;

display: flex;

align-items: center;
justify-content: center;

border-radius: 8px;

background:
    #e6f4ed;

color:
    var(--primary);

}

.login-security div {

display: flex;

flex-direction: column;

}

.login-security strong {

color:
    #53665e;

font-size: 9px;

}

.login-security span {

margin-top: 2px;

color:
    #8b9994;

font-size: 8px;

}

/* ============================================================
VERSION
============================================================ */

.login-version {

padding:
    14px 20px 18px;

text-align: center;

color:
    #a0aca8;

font-size: 8px;

}

.login-version span {

margin:
    0 5px;

color:
    #c1cac6;

}

/* ============================================================
MOBILE
============================================================ */

@media (max-width: 850px) {

.login-page {

    min-height:
        calc(100vh - 0px);

    padding:
        25px 15px;

}


.login-shell {

    max-width: 520px;

    min-height: auto;

    grid-template-columns: 1fr;

    border-radius: 20px;

}


.login-intro {

    padding:
        35px 30px 28px;

}


.login-intro p {

    margin-bottom: 23px;

}


.login-features {

    display: grid;

    grid-template-columns:
        repeat(3, 1fr);

    gap: 8px;

}


.login-feature {

    flex-direction: column;

    align-items: flex-start;

    gap: 7px;

    padding: 9px;

    border-radius: 10px;

    background:
        rgba(255,255,255,.06);

}


.login-feature small {

    display: none;

}


.login-form-container {

    max-width: none;

    padding:
        35px 30px 20px;

}

}

@media (max-width: 520px) {

.login-page {

    padding:
        12px;

}


.login-intro {

    padding:
        28px 22px 22px;

}


.login-brand-mark {

    width: 55px;
    height: 55px;

    margin-bottom: 20px;

}


.login-intro h1 {

    font-size: 24px;

}


.login-intro p {

    font-size: 11px;

    line-height: 1.9;

}


.login-features {

    grid-template-columns: 1fr;

}


.login-feature {

    flex-direction: row;

    align-items: center;

}


.login-feature small {

    display: block;

}


.login-form-container {

    padding:
        30px 20px 15px;

}


.login-heading h2 {

    font-size: 20px;

}


}

/* =========================================================
   FOOTER — PROFESSIONAL MOHASOFT
   ========================================================= */

.footer {
    margin-top: 40px;
    background:
        linear-gradient(
            135deg,
            #0d4f39 0%,
            #126346 55%,
            #0b4935 100%
        );
    color: rgba(255, 255, 255, .92);
    border-top: 1px solid rgba(255, 255, 255, .08);
    box-shadow: 0 -8px 30px rgba(15, 81, 58, .08);
}

.footer-inner {
    max-width: 1400px;
    margin: 0 auto;
    min-height: 92px;
    padding: 18px 28px;

    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
}

/* ---------- الهوية ---------- */

.footer-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 250px;
}

.footer-brand-icon {
    width: 42px;
    height: 42px;

    display: flex;
    align-items: center;
    justify-content: center;

    border-radius: 12px;

    background: rgba(255, 255, 255, .10);
    border: 1px solid rgba(255, 255, 255, .14);

    color: #d9f3e7;
    font-size: 1.15rem;

    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, .08),
        0 5px 16px rgba(0, 0, 0, .08);
}

.footer-brand-text {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.footer-brand-text strong {
    color: #fff;
    font-size: .95rem;
    font-weight: 700;
    line-height: 1.4;
}

.footer-brand-text span {
    color: rgba(255, 255, 255, .62);
    font-size: .72rem;
    line-height: 1.5;
}

/* ---------- الفاصل ---------- */

.footer-divider {
    width: 1px;
    height: 38px;
    background: rgba(255, 255, 255, .13);
}

/* ---------- معلومات الفوتر ---------- */

.footer-meta {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 24px;

    font-size: .78rem;
}

.footer-version,
.footer-copy,
.footer-developed {
    display: flex;
    align-items: center;
    gap: 7px;
    white-space: nowrap;
}

.footer-version i,
.footer-copy i {
    color: #b9dfce;
    font-size: .85rem;
}

.footer-version,
.footer-copy {
    color: rgba(255, 255, 255, .62);
}

/* ---------- MOHASOFT ---------- */

.footer-developed {
    color: rgba(255, 255, 255, .58);
}

.mohasoft-link {
    display: inline-flex;
    align-items: center;
    gap: 5px;

    color: #fff;
    text-decoration: none;

    font-weight: 800;
    letter-spacing: .4px;

    transition:
        color .2s ease,
        transform .2s ease;
}

.mohasoft-link i {
    font-size: .72rem;
    opacity: .7;
    transition: transform .2s ease;
}

.mohasoft-link:hover {
    color: #d8f4e7;
    transform: translateY(-1px);
}

.mohasoft-link:hover i {
    transform: translate(-2px, -2px);
}

/* ---------- خط علوي بسيط ---------- */

.footer::before {
    content: "";
    display: block;
    height: 2px;
    width: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255,255,255,.22),
        transparent
    );
}

/* ---------- Responsive ---------- */

@media (max-width: 900px) {

    .footer-inner {
        padding: 18px 16px;
        flex-direction: column;
        align-items: stretch;
        gap: 15px;
    }

    .footer-brand {
        justify-content: center;
        text-align: center;
    }

    .footer-brand-text {
        align-items: flex-start;
        text-align: right;
    }

    .footer-divider {
        width: 100%;
        height: 1px;
    }

    .footer-meta {
        justify-content: center;
        flex-wrap: wrap;
        gap: 12px 20px;
    }
}

@media (max-width: 480px) {

    .footer {
        margin-top: 25px;
    }

    .footer-inner {
        padding: 16px 12px;
    }

    .footer-brand {
        gap: 9px;
    }

    .footer-brand-icon {
        width: 38px;
        height: 38px;
        font-size: 1rem;
    }

    .footer-brand-text strong {
        font-size: .82rem;
    }

    .footer-brand-text span {
        font-size: .66rem;
    }

    .footer-meta {
        flex-direction: column;
        gap: 9px;
        font-size: .72rem;
    }

    .footer-divider {
        margin: 1px 0;
    }
}

/* توحيد تنسيق حقل الهاتف مع بقية حقول الإدخال */
input[type="tel"] {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    background-color: #fff;
    color: #1f2937;
    font-family: inherit;
    font-size: 14px;
    line-height: 1.5;
    box-sizing: border-box;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

input[type="tel"]:focus {
    border-color: var(--primary, #198754);
    box-shadow: 0 0 0 3px rgba(25, 135, 84, 0.12);
}

/* الحفاظ على تناسق الحقل في الهواتف */
input[type="tel"]::placeholder {
    color: #9ca3af;
    opacity: 1;
}



/* ============================================================
   DESIGN SYSTEM REFINEMENT — Phase 1
   نطاق هذه الإضافات: المظهر العام والاستجابة فقط
   ============================================================ */

:root {
    --ui-green: #198754;
    --ui-green-dark: #146c43;
    --ui-green-deep: #0f5132;
    --ui-green-soft: #eaf6ef;
    --ui-page: #f5f7f8;
    --ui-surface: #ffffff;
    --ui-border: #e3e9e6;
    --ui-text: #24332c;
    --ui-muted: #6c7b73;
    --ui-radius: 16px;
    --ui-shadow: 0 6px 22px rgba(23, 55, 37, .055);
    --ui-shadow-hover: 0 12px 28px rgba(23, 55, 37, .095);
}

html {
    scroll-behavior: smooth;
    scroll-padding-top: calc(var(--header-height, 76px) + 18px);
}

body {
    background:
        radial-gradient(ellipse at top right, rgba(25,135,84,.035), transparent 38%),
        var(--ui-page);
    color: var(--ui-text);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

::selection {
    background: rgba(25, 135, 84, .18);
    color: var(--ui-green-deep);
}

a {
    transition: color .18s ease, background-color .18s ease, border-color .18s ease;
}

.layout {
    max-width: 1600px;
    align-items: stretch;
}

.sidebar {
    background: rgba(255,255,255,.96);
    border-left: 1px solid var(--ui-border);
    min-height: calc(100vh - var(--header-height, 76px));
}

.sidebar-header {
    letter-spacing: .01em;
}

.sidebar-link,
.sidebar a.sidebar-link {
    min-height: 46px;
    line-height: 1.5;
}

.sidebar-link:focus-visible,
.header-menu-toggle:focus-visible,
.user-menu-button:focus-visible,
.header-icon-button:focus-visible,
.btn:focus-visible,
button:focus-visible,
a:focus-visible {
    outline: 3px solid rgba(25,135,84,.35);
    outline-offset: 2px;
}

.content {
    padding: clamp(18px, 2.2vw, 32px);
    min-height: calc(100vh - var(--header-height, 76px));
}

.page-title {
    font-size: clamp(1.25rem, 1.8vw, 1.65rem);
    line-height: 1.45;
    letter-spacing: -.02em;
}

.card,
.login-card,
.stat-card {
    border: 1px solid var(--ui-border);
    border-radius: var(--ui-radius);
    box-shadow: var(--ui-shadow);
}

.card {
    transition: box-shadow .2s ease, border-color .2s ease;
}

.card h2 {
    line-height: 1.55;
}

.stats-grid {
    gap: 16px;
}

.stat-card {
    border-top: 0;
    overflow: hidden;
    position: relative;
}

.stat-card::before {
    content: "";
    position: absolute;
    inset: 0 0 auto;
    height: 4px;
    background: var(--ui-green);
}

.stat-card.gold::before { background: #d69a2d; }
.stat-card.blue::before { background: #4285c5; }
.stat-card.red::before { background: #cf5151; }

.table-wrap {
    border-radius: 13px;
}

table.data-table {
    border-collapse: separate;
    border-spacing: 0;
}

.data-table th {
    background: #f2f7f4;
    color: #304d3d;
}

.data-table tbody tr {
    transition: background-color .15s ease;
}

.data-table td {
    vertical-align: middle;
}

.btn {
    border-radius: 11px;
    font-weight: 750;
}

.btn-primary {
    background: var(--ui-green);
    box-shadow: 0 3px 8px rgba(25,135,84,.14);
}

.btn-primary:hover {
    background: var(--ui-green-dark);
}

input[type="text"],
input[type="password"],
input[type="number"],
input[type="date"],
input[type="email"],
input[type="tel"],
input[type="search"],
select,
textarea {
    border-radius: 11px;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--ui-green);
    box-shadow: 0 0 0 3px rgba(25,135,84,.12);
}

.flash {
    border-radius: 12px;
    box-shadow: 0 3px 12px rgba(20,50,35,.035);
}

.footer {
    margin-top: auto;
}

.footer-inner {
    width: 100%;
}

.mohasoft-link:focus-visible {
    outline: 2px solid rgba(255,255,255,.8);
    outline-offset: 4px;
    border-radius: 4px;
}

/* لوحة التحكم: تحسينات بصرية إضافية دون تغيير حساب المؤشرات */
.dashboard-page {
    max-width: 1500px;
    margin-inline: auto;
}

.dashboard-page .dashboard-heading {
    align-items: center;
    padding-bottom: 4px;
}

.dashboard-page .dashboard-role {
    box-shadow: 0 3px 10px rgba(25,135,84,.045);
}

.dashboard-page .dashboard-scope-card {
    position: relative;
    overflow: hidden;
}

.dashboard-page .dashboard-scope-card::after {
    content: "";
    position: absolute;
    inset-inline-start: -28px;
    bottom: -42px;
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: rgba(25,135,84,.045);
    pointer-events: none;
}

.dashboard-page .stat-card {
    box-shadow: 0 5px 18px rgba(30,60,44,.045);
}

.dashboard-page .stat-card:hover {
    border-color: #d4e6da;
}

.dashboard-page .card h2 {
    padding-bottom: 10px;
    border-bottom: 1px solid #edf2ee;
}

.dashboard-page .table-wrap {
    box-shadow: inset 0 1px 0 rgba(255,255,255,.8);
}

.dashboard-page .data-table th {
    letter-spacing: .01em;
}

.dashboard-page .dashboard-empty {
    line-height: 1.9;
}

@media (max-width: 900px) {
    .layout {
        width: 100%;
    }

    .sidebar {
        min-height: auto;
        border-left: 0;
    }

    .content {
        padding: 18px 14px 36px;
    }

    .footer {
        margin-top: 20px;
    }
}

@media (max-width: 600px) {
    .content {
        padding: 14px 10px 30px;
    }

    .page-title {
        font-size: 1.2rem;
    }

    .card {
        padding: 15px;
        border-radius: 14px;
    }

    .btn {
        max-width: 100%;
    }

    .filters .form-group {
        min-width: min(100%, 135px);
    }

    .footer-meta {
        align-items: center;
    }
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }

    *,
    *::before,
    *::after {
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
        scroll-behavior: auto !important;
    }
}

/* ============================================================
   MOBILE SIDEBAR DIRECTION FIX (AR / EN)
   Keep the drawer anchored to the logical start edge.
============================================================ */
@media (max-width: 1000px) {
    .sidebar {
        position: fixed;
        top: 0;
        bottom: 0;
        left: auto;
        right: auto;
        inset-inline-start: 0;
        inset-inline-end: auto;
        width: min(285px, 88vw);
        height: 100vh;
        height: 100dvh;
        min-height: 0;
        z-index: 1200;
        overflow-y: auto;
        background: #fff;
        transform: translateX(-110%);
        transition: transform .28s ease;
        will-change: transform;
    }

    html[dir="rtl"] .sidebar {
        left: auto;
        right: auto;
        inset-inline-start: 0;
        inset-inline-end: auto;
        transform: translateX(110%);
    }

    .sidebar.mobile-open {
        transform: translateX(0);
    }

    .sidebar-overlay {
        position: fixed;
        inset: 0;
        z-index: 1150;
    }

    body.sidebar-open {
        overflow: hidden;
        touch-action: none;
    }
}

/* ============================================================
   MOBILE USER DROPDOWN FIX (AR / EN)
   Keep the profile menu fully inside the viewport.
============================================================ */
@media (max-width: 1000px) {
    .user-menu {
        position: static;
    }

    .user-dropdown {
        position: fixed !important;
        top: calc(var(--header-height, 66px) + 8px) !important;
        left: 10px !important;
        right: 10px !important;
        inset-inline-start: 10px !important;
        inset-inline-end: 10px !important;
        width: auto !important;
        min-width: 0 !important;
        max-width: calc(100vw - 20px) !important;
        box-sizing: border-box;
        z-index: 1300;
        overflow-wrap: anywhere;
    }

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


/* Dashboard state filters */
.dashboard-page .dashboard-filter-row{display:flex;align-items:center;gap:10px;flex-wrap:wrap;margin:0 0 14px;padding:12px 14px;background:#f7faf8;border:1px solid #e3ece6;border-radius:12px}
.dashboard-page .dashboard-filter-row label{font-size:.86rem;font-weight:750;color:#40584a}
.dashboard-page .dashboard-filter{min-width:190px;max-width:100%;padding:9px 34px 9px 12px;border:1px solid #cdded3;border-radius:10px;background:#fff;color:#24392d;font:inherit;font-size:.88rem;outline:none}
.dashboard-page .dashboard-filter:focus{border-color:#198754;box-shadow:0 0 0 3px rgba(25,135,84,.12)}
@media(max-width:600px){.dashboard-page .dashboard-filter-row{align-items:stretch;flex-direction:column}.dashboard-page .dashboard-filter{width:100%;min-width:0}}

/* Consistent language switcher and sidebar icon styling */
.language-switcher{display:flex;align-items:center;margin:0;flex:0 0 auto}
.language-switcher-button{display:inline-flex;align-items:center;justify-content:center;gap:7px;min-height:38px;padding:7px 12px;border:1px solid rgba(255,255,255,.35);border-radius:11px;background:rgba(255,255,255,.13);color:#fff;font:inherit;font-size:.86rem;font-weight:750;white-space:nowrap;cursor:pointer;transition:background .2s ease,border-color .2s ease,transform .2s ease}
.language-switcher-button:hover,.language-switcher-button:focus-visible{background:rgba(255,255,255,.23);border-color:rgba(255,255,255,.6);color:#fff;outline:none}
.language-switcher-button i{font-size:1rem;line-height:1}
.sidebar-link-icon{width:36px;height:36px;border-radius:11px;background:#edf7f1;color:#176b43;display:inline-flex;align-items:center;justify-content:center;flex:0 0 36px}
.sidebar-link-icon i{display:inline-block;font-size:1.08rem;line-height:1}
.sidebar-link:hover .sidebar-link-icon,.sidebar-link.active .sidebar-link-icon{background:#dff2e6;color:#0d6b42}
@media(max-width:600px){.language-switcher-button{min-height:34px;padding:6px 9px;font-size:.78rem}.header-actions{gap:7px}}



/* Compact connection indicator and details popover */
.connection-status-wrap{position:relative;display:inline-flex;align-items:center;flex-shrink:0}
.system-status{appearance:none;cursor:pointer;font:inherit;display:inline-flex;align-items:center;gap:7px;padding:7px 9px;border:1px solid #dcebe3;border-radius:10px;background:#f6fbf8;color:#4d655b;font-size:11px;font-weight:700;white-space:nowrap;transition:background .18s,border-color .18s}
.system-status .status-dot{width:8px;height:8px;flex:0 0 8px;border-radius:50%;background:#20a56b;box-shadow:0 0 0 3px rgba(32,165,107,.10)}
.system-status.is-offline{background:#fff7e8;border-color:#f0d7a3;color:#81520a}
.system-status.is-offline .status-dot{background:#d99018;box-shadow:0 0 0 3px rgba(217,144,24,.13)}
.connection-status-chevron{font-size:9px;opacity:.65}
.connection-status-popover{position:absolute;z-index:1400;top:calc(100% + 10px);inset-inline-start:0;width:min(320px,calc(100vw - 28px));padding:16px;border:1px solid #dce7e0;border-radius:14px;background:#fff;color:#263b31;box-shadow:0 14px 36px rgba(21,53,38,.17);text-align:start;white-space:normal}
.connection-status-popover[hidden]{display:none!important}
.connection-popover-heading{display:flex;align-items:center;gap:9px;color:#176b4d;font-size:.98rem}
.connection-popover-heading i{font-size:1.2rem}
.connection-status-popover p{margin:9px 0 12px;color:#5b6f64;font-size:.88rem;line-height:1.65}
.connection-pending-row{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:9px 0;border-top:1px solid #edf2ee;font-size:.84rem}
.connection-pending-row strong{min-width:28px;text-align:center;padding:3px 8px;border-radius:20px;background:#eaf5ee;color:#176b4d}
.connection-popover-note{display:block;margin-top:9px;color:#75857c;line-height:1.6;font-size:.76rem}
.connection-sync-button{display:flex;align-items:center;justify-content:center;gap:7px;width:100%;margin-top:12px;padding:9px 12px;border:0;border-radius:9px;background:#176b4d;color:#fff;font:inherit;font-size:.86rem;font-weight:700;cursor:pointer}
.connection-sync-button:hover{background:#11563d}
@media(max-width:1000px){.connection-status-popover{inset-inline-start:auto;inset-inline-end:0}}
@media(max-width:600px){.system-status{padding:7px 8px;gap:5px}.connection-status-label{font-size:10px}.connection-status-chevron{display:none}.connection-status-popover{position:fixed;top:calc(var(--header-height,70px) + 8px);inset-inline:12px;width:auto}}

/* Offline drafting and audit log */
.offline-draft-panel{display:flex;align-items:center;justify-content:space-between;gap:16px;margin:0 0 18px;padding:15px 18px;border:1px solid #c7e3d2;border-radius:14px;background:#f0f8f3;color:#194c37}
.offline-draft-panel p{margin:5px 0 0;font-size:.9rem;line-height:1.7;color:#426454}
.offline-draft-actions{display:flex;gap:8px;flex-wrap:wrap}
.audit-filters{display:grid;grid-template-columns:repeat(4,minmax(140px,1fr));gap:12px;align-items:end}
.audit-filters label{display:flex;flex-direction:column;gap:6px;font-weight:700;font-size:.9rem}
.audit-filters input,.audit-filters select{width:100%;min-height:42px;padding:8px 10px;border:1px solid #d7e2dc;border-radius:9px;background:#fff;font:inherit}
.audit-action{display:inline-flex;padding:4px 8px;border-radius:7px;background:#eaf4ee;color:#175e40;font-weight:700;font-size:.85rem}
.audit-entity{display:block;color:#687c72;margin-top:4px}
.audit-result{display:inline-block;padding:4px 8px;border-radius:20px;font-size:.82rem;font-weight:700}
.audit-result.success{background:#e5f6eb;color:#176b3b}.audit-result.failure{background:#fff0ed;color:#a52b1b}
.audit-pagination{display:flex;justify-content:space-between;gap:10px;margin-top:16px}
.page-heading-row{display:flex;justify-content:space-between;align-items:center;gap:12px;margin-bottom:18px}.page-subtitle{margin:0;color:#65756c}.stat-chip{padding:8px 12px;border-radius:10px;background:#eaf4ee;color:#175e40;font-weight:700;white-space:nowrap}
@media(max-width:800px){.audit-filters{grid-template-columns:repeat(2,minmax(0,1fr))}.offline-draft-panel,.page-heading-row{align-items:stretch;flex-direction:column}}
@media(max-width:480px){.audit-filters{grid-template-columns:1fr}.offline-draft-actions{width:100%}.offline-draft-actions button{flex:1}}

/* NPMSS logo: preserve existing header dimensions */
.app-brand-mark { width: 42px; height: 42px; min-width: 42px; max-width: 42px; flex: 0 0 42px; overflow: hidden; display: inline-flex; align-items: center; justify-content: center; }
.app-brand-mark img { width: 100%; height: 100%; max-width: 42px; max-height: 42px; display: block; object-fit: contain; border-radius: 50%; }


/* NPMSS: تثبيت حجم شعار الترويسة في جميع الصفحات وبعد إعادة التحميل */
.app-header .app-brand .app-brand-mark,
.app-header .app-brand-mark,
.app-header-inner .app-brand-mark {
    box-sizing: border-box !important;
    width: 42px !important;
    height: 42px !important;
    min-width: 42px !important;
    min-height: 42px !important;
    max-width: 42px !important;
    max-height: 42px !important;
    flex: 0 0 42px !important;
    overflow: hidden !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
}

.app-header .app-brand .app-brand-mark img,
.app-header .app-brand-mark img,
.app-header-inner .app-brand-mark img {
    display: block !important;
    width: 100% !important;
    height: 100% !important;
    min-width: 0 !important;
    min-height: 0 !important;
    max-width: 100% !important;
    max-height: 100% !important;
    object-fit: contain !important;
    flex: 0 0 auto !important;
}

@media (max-width: 600px) {
    .app-header .app-brand .app-brand-mark,
    .app-header .app-brand-mark,
    .app-header-inner .app-brand-mark {
        width: 37px !important;
        height: 37px !important;
        min-width: 37px !important;
        min-height: 37px !important;
        max-width: 37px !important;
        max-height: 37px !important;
        flex-basis: 37px !important;
    }
}


/* NPMSS FINAL FIX: stable logo size across all pages and reloads */
.app-header .app-brand-mark {
    box-sizing: border-box !important;
    width: 42px !important;
    height: 42px !important;
    min-width: 42px !important;
    min-height: 42px !important;
    max-width: 42px !important;
    max-height: 42px !important;
    flex: 0 0 42px !important;
    overflow: hidden !important;
    padding: 0 !important;
}
.app-header .app-brand-mark img {
    display: block !important;
    width: 100% !important;
    height: 100% !important;
    min-width: 0 !important;
    min-height: 0 !important;
    max-width: 100% !important;
    max-height: 100% !important;
    object-fit: contain !important;
    flex: 0 0 auto !important;
}
@media (max-width: 600px) {
    .app-header .app-brand-mark {
        width: 37px !important;
        height: 37px !important;
        min-width: 37px !important;
        min-height: 37px !important;
        max-width: 37px !important;
        max-height: 37px !important;
        flex-basis: 37px !important;
    }
}

/* ============================================================
   NPMSS OFFICIAL VISUAL IDENTITY — BLUE & GREEN
   Applied as a presentation layer; no application logic changed.
   Palette sampled from the approved NPMSS logo.
============================================================ */
:root {
    --npmss-blue: #005098;
    --npmss-blue-dark: #003870;
    --npmss-blue-deep: #062b4f;
    --npmss-blue-soft: #eaf2f9;
    --npmss-blue-pale: #f3f7fb;
    --npmss-green: #389030;
    --npmss-green-dark: #187840;
    --npmss-green-light: #68a840;
    --npmss-green-soft: #edf6e9;

    --primary: var(--npmss-blue);
    --primary-dark: var(--npmss-blue-dark);
    --accent: var(--npmss-green-light);
    --bg: #f3f7fb;
    --card: #ffffff;
    --text: #203247;
    --muted: #718196;
    --border: #dce6ef;
    --good: var(--npmss-green);
    --ok: var(--npmss-blue);
    --warn: #d99525;
    --bad: #cf4545;
    --shadow: 0 5px 18px rgba(0, 56, 112, .065);

    --app-green: var(--npmss-green);
    --app-green-dark: var(--npmss-green-dark);
    --app-green-soft: var(--npmss-green-soft);
    --app-green-light: #f4f9f1;
    --app-text: #203247;
    --app-muted: #718196;
    --app-border: #dce6ef;

    --ui-green: var(--npmss-green);
    --ui-green-dark: var(--npmss-green-dark);
    --ui-green-deep: #145b32;
    --ui-green-soft: var(--npmss-green-soft);
}

html, body { background-color: var(--bg); }
body { color: var(--text); }
a { color: var(--npmss-blue); }
a:hover { color: var(--npmss-green-dark); }

/* Main application header */
.app-header {
    background: linear-gradient(112deg, var(--npmss-blue-dark) 0%, var(--npmss-blue) 68%, #12669f 100%) !important;
    border-bottom: 3px solid var(--npmss-green) !important;
    box-shadow: 0 5px 22px rgba(0, 56, 112, .17) !important;
}
.app-header.is-scrolled { box-shadow: 0 9px 28px rgba(0, 56, 112, .22) !important; }
.app-brand, .app-brand:hover { color: #fff !important; }
.app-brand-mark {
    background: #fff !important;
    border: 2px solid rgba(255,255,255,.72) !important;
    border-radius: 50% !important;
    box-shadow: 0 4px 15px rgba(0,0,0,.16) !important;
}
.app-brand-mark img { border-radius: 50% !important; }
.app-brand-text strong { color: #fff !important; letter-spacing: .04em; }
.app-brand-text small { color: rgba(255,255,255,.78) !important; }
.header-menu-toggle {
    color: #fff !important;
    background: rgba(255,255,255,.13) !important;
    border: 1px solid rgba(255,255,255,.22) !important;
}
.header-menu-toggle:hover { background: rgba(255,255,255,.22) !important; }
.system-status {
    background: rgba(255,255,255,.12) !important;
    color: #fff !important;
    border-color: rgba(255,255,255,.25) !important;
}
.scope-indicator { border-color: rgba(255,255,255,.22) !important; }
.scope-icon { background: rgba(255,255,255,.14) !important; color: #a9df7a !important; }
.scope-content small { color: rgba(255,255,255,.70) !important; }
.scope-content strong { color: #fff !important; }
.header-icon-button {
    background: rgba(255,255,255,.12) !important;
    border-color: rgba(255,255,255,.24) !important;
    color: #fff !important;
}
.header-icon-button:hover { background: rgba(255,255,255,.23) !important; color: #fff !important; }
.header-divider { background: rgba(255,255,255,.25) !important; }
.user-menu-button:hover, .user-menu.open .user-menu-button {
    background: rgba(255,255,255,.14) !important;
    border-color: rgba(255,255,255,.22) !important;
}
.user-details strong, .user-details small, .user-menu-arrow { color: #fff !important; }
.user-avatar {
    background: linear-gradient(145deg, var(--npmss-green-light), var(--npmss-green-dark)) !important;
    border: 1px solid rgba(255,255,255,.35) !important;
}
.language-switcher-button {
    background: rgba(255,255,255,.12) !important;
    border-color: rgba(255,255,255,.32) !important;
    color: #fff !important;
}
.language-switcher-button:hover { background: rgba(255,255,255,.23) !important; }
.connection-status-popover { border-color: var(--border) !important; box-shadow: 0 14px 38px rgba(0,56,112,.18) !important; }
.connection-popover-heading i { color: var(--npmss-blue) !important; }
.connection-sync-button { background: var(--npmss-blue) !important; }

/* Sidebar: institutional navy with green active state */
.sidebar {
    background: linear-gradient(180deg, #07345f 0%, #062b4f 100%) !important;
    border-inline-end: 1px solid rgba(255,255,255,.08) !important;
}
.sidebar-header {
    color: rgba(255,255,255,.66) !important;
    border-bottom-color: rgba(255,255,255,.13) !important;
}
.sidebar-close { color: rgba(255,255,255,.8) !important; }
.sidebar-link {
    color: rgba(255,255,255,.82) !important;
    border: 1px solid transparent;
}
.sidebar-link:hover {
    color: #fff !important;
    background: rgba(255,255,255,.10) !important;
    transform: translateX(-2px);
}
.sidebar-link.active {
    color: #fff !important;
    background: linear-gradient(100deg, rgba(56,144,48,.96), rgba(24,120,64,.88)) !important;
    border-color: rgba(255,255,255,.12) !important;
    box-shadow: inset -3px 0 0 #a8d879, 0 5px 14px rgba(0,0,0,.12) !important;
}
.sidebar-link-icon {
    color: #c8d9e8 !important;
    background: rgba(255,255,255,.10) !important;
}
.sidebar-link:hover .sidebar-link-icon,
.sidebar-link.active .sidebar-link-icon {
    color: #fff !important;
    background: rgba(255,255,255,.16) !important;
}
.sidebar-system-card {
    background: rgba(255,255,255,.08) !important;
    border-color: rgba(255,255,255,.14) !important;
}
.sidebar-system-icon { background: rgba(104,168,64,.20) !important; color: #b6e18d !important; }
.sidebar-system-card strong { color: #fff !important; }
.sidebar-system-card small { color: rgba(255,255,255,.58) !important; }
.sidebar-overlay { background: rgba(3,24,44,.58) !important; }

/* Page canvas, titles and surfaces */
.content { background: transparent !important; }
.page-title, .card h2 { color: var(--npmss-blue-dark) !important; }
.card, .dashboard-card, .report-card, .profile-card {
    border-color: var(--border);
    box-shadow: var(--shadow);
}
.card { border: 1px solid #e3ebf2; }
.card h2::after, .page-title::after { background: var(--npmss-green) !important; }

/* Dashboard metrics and charts */
.stat-card { border-top-color: var(--npmss-blue) !important; }
.stat-card .stat-num { color: var(--npmss-blue-dark) !important; }
.stat-card.gold { border-top-color: var(--npmss-green-light) !important; }
.stat-card.blue { border-top-color: var(--npmss-blue) !important; }
.stat-card.red { border-top-color: var(--bad) !important; }
.bar-track { background: #eaf0f6 !important; }
.bar-fill { background: linear-gradient(90deg, var(--npmss-blue), var(--npmss-green-light)) !important; }

/* Tables */
.table-wrap { border: 1px solid var(--border); border-radius: 13px; background: #fff; }
table.data-table { background: #fff; }
.data-table th {
    background: #eaf2f9 !important;
    color: var(--npmss-blue-dark) !important;
    border-bottom: 2px solid #c9dceb !important;
}
.data-table td { border-bottom-color: #e8eef4 !important; }
.data-table tbody tr:nth-child(even) td { background: #fbfdff; }
.data-table tr:hover td { background: #f0f7f1 !important; }

/* Buttons and controls */
.btn-primary, .login-submit, .connection-sync-button {
    background: linear-gradient(135deg, var(--npmss-blue), var(--npmss-blue-dark)) !important;
    color: #fff !important;
    box-shadow: 0 4px 11px rgba(0,80,152,.18);
}
.btn-primary:hover, .login-submit:hover { filter: brightness(1.08); }
.btn-accent, .btn-success, .btn-add {
    background: linear-gradient(135deg, var(--npmss-green), var(--npmss-green-dark)) !important;
    color: #fff !important;
}
.btn-outline { color: var(--npmss-blue) !important; border-color: var(--npmss-blue) !important; }
.btn-outline:hover { background: var(--npmss-blue-soft) !important; }
input:focus, select:focus, textarea:focus,
.login-input-wrapper input:focus {
    border-color: var(--npmss-blue) !important;
    box-shadow: 0 0 0 3px rgba(0,80,152,.13) !important;
}

/* Forms, question sections and progress */
.section-head {
    background: linear-gradient(110deg, var(--npmss-blue-dark), var(--npmss-blue)) !important;
    border-bottom: 3px solid var(--npmss-green) !important;
}
.section-score-chip { background: rgba(104,168,64,.28) !important; }
.q-row { border-bottom-color: #e7edf3 !important; }
.answer-field.answer-filled, .answer-field:valid {
    border-color: #a8d4a0;
}
.answer-field.answer-filled:focus { border-color: var(--npmss-green) !important; }
.progress-bar, .progress-fill { background: linear-gradient(90deg, var(--npmss-blue), var(--npmss-green)) !important; }

/* Status colors remain semantic and consistent */
.badge.good, .st-approved { background: #e8f4e4 !important; color: #26752c !important; }
.badge.ok, .st-submitted { background: #e6f0f8 !important; color: #07518f !important; }
.badge.warn { background: #fff4df !important; color: #a96b12 !important; }
.badge.bad { background: #fbe9e9 !important; color: #b83232 !important; }
.flash-success, .alert-success { border-color: #b8dcae !important; background: #eff8eb !important; color: #276c2b !important; }
.flash-error, .alert-danger { border-color: #efc2c2 !important; }

/* Login page */
.login-background {
    background: linear-gradient(135deg, #003870 0%, #005098 56%, #0c5b8e 100%) !important;
}
.login-intro {
    background: linear-gradient(145deg, #003870 0%, #005098 72%, #176b68 100%) !important;
}
.login-intro::after { border-color: rgba(255,255,255,.17) !important; }
.login-brand-mark {
    background: #fff !important;
    border: 3px solid rgba(255,255,255,.68) !important;
    border-radius: 50% !important;
    overflow: hidden !important;
}
.login-brand-mark img { border-radius: 50% !important; }
.login-eyebrow, .login-eyebrow::before { color: #bce29b !important; background-color: #bce29b !important; }
.login-intro h1 strong { color: #c9e9a9 !important; }
.login-feature-icon { color: #c8e8a8 !important; }
.login-heading h2, .login-heading > div > span { color: var(--npmss-blue-dark) !important; }
.login-heading-icon { background: var(--npmss-blue-soft) !important; color: var(--npmss-blue) !important; }
.login-security-icon { background: var(--npmss-green-soft) !important; color: var(--npmss-green-dark) !important; }
.login-language-switch button { color: var(--npmss-blue) !important; border-color: #cbddea !important; }

/* Footer */
.footer {
    background: linear-gradient(110deg, #062b4f 0%, #003870 58%, #005098 100%) !important;
    border-top: 3px solid var(--npmss-green) !important;
    color: rgba(255,255,255,.9) !important;
    box-shadow: 0 -6px 22px rgba(0,56,112,.09) !important;
}
.footer-brand-icon { color: #c6e7a5 !important; background: rgba(255,255,255,.10) !important; }
.footer-version i, .footer-copy i { color: #b7df8c !important; }
.mohasoft-link:hover { color: #c9e9a9 !important; }
.footer::before { background: linear-gradient(90deg, transparent, rgba(104,168,64,.8), transparent) !important; }

/* Keyboard focus and reduced motion */
:focus-visible { outline-color: var(--npmss-green) !important; }
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; }
}

@media (max-width: 1000px) {
    .sidebar { box-shadow: 8px 0 28px rgba(0,28,52,.22) !important; }
}
@media (max-width: 600px) {
    .app-header { border-bottom-width: 2px !important; }
    .app-header-inner { padding-inline: 12px !important; }
    .sidebar { background: linear-gradient(180deg, #07345f 0%, #062b4f 100%) !important; }
    .footer-inner { padding-inline: 16px !important; }
}


/* ============================================================
   NPMSS BALANCED BLUE/GREEN SIDEBAR — WAVY BRAND LAYERS
   ============================================================ */
.sidebar {
    position: relative;
    isolation: isolate;
    overflow: hidden;
    background: linear-gradient(160deg, #07345f 0%, #064775 54%, #062b4f 100%) !important;
    border-inline-end: 1px solid rgba(255,255,255,.12) !important;
}
.sidebar::before {
    content: "";
    position: absolute;
    z-index: -1;
    pointer-events: none;
    inset: 19% -44% 20% 16%;
    border-radius: 48% 0 0 52% / 38% 0 0 62%;
    background: linear-gradient(145deg, rgba(56,144,48,.96), rgba(24,120,64,.88));
    transform: rotate(-7deg);
    opacity: .94;
}
.sidebar::after {
    content: "";
    position: absolute;
    z-index: -1;
    pointer-events: none;
    width: 150%;
    height: 34%;
    inset-inline-start: -28%;
    bottom: -13%;
    border-radius: 50% 50% 0 0 / 28% 28% 0 0;
    background: linear-gradient(110deg, rgba(0,80,152,.96), rgba(0,56,112,.98));
    transform: rotate(5deg);
    box-shadow: 0 -10px 28px rgba(0,36,72,.12);
}
.sidebar > * { position: relative; z-index: 1; }
.sidebar-link { color: rgba(255,255,255,.94) !important; }
.sidebar-link:hover { background: rgba(255,255,255,.17) !important; color: #fff !important; }
.sidebar-link.active {
    background: linear-gradient(100deg, rgba(0,80,152,.96), rgba(0,56,112,.92)) !important;
    border-color: rgba(255,255,255,.22) !important;
    box-shadow: inset -3px 0 0 #b8e28f, 0 5px 14px rgba(0,0,0,.14) !important;
}
.sidebar-link-icon { background: rgba(255,255,255,.13) !important; color: #d6edc7 !important; }
.sidebar-header { color: #e3f0dc !important; }
.sidebar-system-card { background: rgba(3,42,71,.45) !important; border-color: rgba(255,255,255,.22) !important; }
.sidebar-system-icon { background: rgba(104,168,64,.28) !important; color: #d5efb9 !important; }
.sidebar-system-card strong { color: #fff !important; }
.sidebar-system-card small { color: rgba(255,255,255,.78) !important; }
@media (max-width: 1000px) {
    .sidebar { background: linear-gradient(160deg, #07345f 0%, #064775 54%, #062b4f 100%) !important; }
}
@media (max-width: 600px) {
    .sidebar { background: linear-gradient(160deg, #07345f 0%, #064775 54%, #062b4f 100%) !important; }
}

/* ============================================================
   NPMSS GREEN IDENTITY — USER APPROVED PALETTE
   Green-first institutional theme. Presentation only.
============================================================ */
:root {
    --npmss-green-bg: #E8F5E9;
    --npmss-green-primary: #198754;
    --npmss-green-sidebar: #146C43;
    --npmss-green-heading: #0F5132;
    --npmss-green-hover: #157347;
    --primary: #198754;
    --primary-dark: #0F5132;
    --accent: #157347;
    --bg: #E8F5E9;
    --card: #FFFFFF;
    --text: #244536;
    --muted: #687d70;
    --border: #d5e8d9;
    --good: #198754;
    --ok: #198754;
    --shadow: 0 5px 18px rgba(15,81,50,.07);
    --app-green: #198754;
    --app-green-dark: #146C43;
    --app-green-soft: #E8F5E9;
    --app-green-light: #f4faf5;
    --app-text: #244536;
    --app-muted: #687d70;
    --app-border: #d5e8d9;
    --ui-green: #198754;
    --ui-green-dark: #146C43;
    --ui-green-deep: #0F5132;
    --ui-green-soft: #E8F5E9;
}
html, body { background: #E8F5E9 !important; color: #244536; }
a { color: #198754; }
a:hover { color: #157347; }
.page-title, .card h2, h1, h2, h3 { color: #0F5132; }
.card, .dashboard-card, .report-card, .profile-card { background: #FFFFFF; }

/* Header: balanced green shades instead of blue */
.app-header {
    background: linear-gradient(105deg, #146C43 0%, #198754 58%, #157347 100%) !important;
    border-bottom: 3px solid #a8d5b5 !important;
    box-shadow: 0 5px 22px rgba(15,81,50,.16) !important;
}
.app-header.is-scrolled { box-shadow: 0 9px 28px rgba(15,81,50,.20) !important; }
.scope-icon { color: #c9ead2 !important; }
.user-avatar { background: linear-gradient(145deg,#65b982,#146C43) !important; }
.connection-popover-heading i { color: #198754 !important; }
.connection-sync-button { background: #198754 !important; }

/* Sidebar: layered green waves */
.sidebar {
    position: relative !important;
    isolation: isolate;
    overflow: hidden !important;
    background: linear-gradient(180deg,#146C43 0%,#0F5132 58%,#104a31 100%) !important;
    border-inline-end: 1px solid rgba(255,255,255,.12) !important;
}
.sidebar::before, .sidebar::after {
    content: "";
    position: absolute;
    z-index: -1;
    pointer-events: none;
    border-radius: 48% 52% 42% 58% / 48% 38% 62% 52%;
}
.sidebar::before {
    width: 290px; height: 390px;
    top: 18%; inset-inline-start: -175px;
    transform: rotate(-24deg);
    background: linear-gradient(145deg,rgba(25,135,84,.78),rgba(21,115,71,.12));
}
.sidebar::after {
    width: 320px; height: 360px;
    bottom: -190px; inset-inline-end: -175px;
    transform: rotate(28deg);
    background: linear-gradient(145deg,rgba(71,170,105,.38),rgba(15,81,50,.08));
    border: 1px solid rgba(210,242,219,.12);
}
.sidebar > * { position: relative; z-index: 1; }
.sidebar-header { color: rgba(255,255,255,.78) !important; border-bottom-color: rgba(255,255,255,.16) !important; }
.sidebar-close { color: rgba(255,255,255,.9) !important; }
.sidebar-link { color: rgba(255,255,255,.9) !important; }
.sidebar-link:hover { color: #fff !important; background: rgba(255,255,255,.13) !important; }
.sidebar-link.active {
    color: #fff !important;
    background: linear-gradient(100deg,#198754 0%,#157347 100%) !important;
    border-color: rgba(255,255,255,.18) !important;
    box-shadow: inset -3px 0 0 #b8e2c3,0 5px 14px rgba(0,0,0,.13) !important;
}
.sidebar-link-icon { color: #d4efdc !important; background: rgba(255,255,255,.12) !important; }
.sidebar-link:hover .sidebar-link-icon,.sidebar-link.active .sidebar-link-icon { color:#fff !important;background:rgba(255,255,255,.18) !important; }
.sidebar-system-card { background:rgba(255,255,255,.09) !important;border-color:rgba(255,255,255,.16) !important; }
.sidebar-system-icon { background:rgba(184,226,195,.18) !important;color:#c9ead2 !important; }
.sidebar-system-card strong { color:#fff !important; }
.sidebar-system-card small { color:rgba(255,255,255,.72) !important; }
.sidebar-overlay { background:rgba(8,49,30,.58) !important; }

/* Titles, cards, tables and metrics */
.page-title,.card h2 { color:#0F5132 !important; }
.card h2::after,.page-title::after { background:#198754 !important; }
.stat-card { border-top-color:#198754 !important; }
.stat-card .stat-num { color:#0F5132 !important; }
.stat-card.blue,.stat-card.gold { border-top-color:#198754 !important; }
.bar-track { background:#dcefe1 !important; }
.bar-fill { background:linear-gradient(90deg,#157347,#198754,#65b982) !important; }
.data-table th { background:#E8F5E9 !important;color:#0F5132 !important;border-bottom:2px solid #c6e2ce !important; }
.data-table tbody tr:nth-child(even) td { background:#fbfefb; }
.data-table tr:hover td { background:#f0f8f2 !important; }

/* Buttons and form controls */
.btn-primary,.login-submit,.connection-sync-button {
    background:#198754 !important;color:#fff !important;
    border-color:#198754 !important;box-shadow:0 4px 11px rgba(25,135,84,.18);
}
.btn-primary:hover,.login-submit:hover,.connection-sync-button:hover { background:#157347 !important;border-color:#157347 !important; }
.btn-accent,.btn-success,.btn-add { background:#198754 !important;color:#fff !important;border-color:#198754 !important; }
.btn-outline { color:#198754 !important;border-color:#198754 !important; }
.btn-outline:hover { background:#E8F5E9 !important;color:#0F5132 !important; }
input:focus,select:focus,textarea:focus,.login-input-wrapper input:focus {
    border-color:#198754 !important;box-shadow:0 0 0 3px rgba(25,135,84,.14) !important;
}
.section-head { background:linear-gradient(110deg,#146C43,#198754) !important;border-bottom:3px solid #a8d5b5 !important; }
.progress-bar,.progress-fill { background:linear-gradient(90deg,#146C43,#198754,#65b982) !important; }
.answer-field.answer-filled,.answer-field:valid { border-color:#9bcfac; }
.answer-field.answer-filled:focus { border-color:#198754 !important; }

/* Login and footer */
.login-background { background:linear-gradient(135deg,#0F5132 0%,#146C43 52%,#198754 100%) !important; }
.login-intro { background:linear-gradient(145deg,#0F5132 0%,#146C43 65%,#198754 100%) !important; }
.login-heading h2,.login-heading > div > span { color:#0F5132 !important; }
.login-heading-icon { background:#E8F5E9 !important;color:#198754 !important; }
.login-security-icon { background:#E8F5E9 !important;color:#146C43 !important; }
.login-language-switch button { color:#146C43 !important;border-color:#c6e2ce !important; }
.footer { background:linear-gradient(105deg,#0F5132 0%,#146C43 60%,#198754 100%) !important;border-top:3px solid #a8d5b5 !important; }
:focus-visible { outline-color:#157347 !important; }


/* Official NPMSS logo in the global footer */
.footer-brand-icon {
    width: 54px !important;
    height: 54px !important;
    flex: 0 0 54px;
    padding: 5px;
    overflow: hidden;
    border-radius: 16px !important;
    background: #ffffff !important;
    border: 1px solid rgba(255,255,255,.72) !important;
    box-shadow: 0 5px 16px rgba(0,35,18,.16) !important;
}
.footer-brand-icon img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 11px;
}
@media (max-width: 480px) {
    .footer-brand-icon {
        width: 46px !important;
        height: 46px !important;
        flex-basis: 46px;
    }
}


/* ============================================================
   NPMSS HEADER — DEEP GREEN GRADIENT & NESTED ORGANIC ARCHES
   Decorative CSS only; preserves all header controls and behavior.
============================================================ */
.app-header {
    position: relative !important;
    isolation: isolate;
    overflow: hidden !important;
    background:
        radial-gradient(ellipse at 82% 12%, rgba(112, 190, 137, .20) 0%, rgba(112, 190, 137, 0) 38%),
        linear-gradient(112deg, #0F5132 0%, #146C43 48%, #198754 100%) !important;
    border-bottom: 3px solid rgba(210, 242, 219, .72) !important;
    box-shadow: 0 7px 25px rgba(15, 81, 50, .22) !important;
}

/* Main translucent arch */
.app-header::before {
    content: "";
    position: absolute;
    z-index: 0;
    pointer-events: none;
    width: min(720px, 72vw);
    height: 250px;
    top: -168px;
    inset-inline-end: 7%;
    border: 1px solid rgba(232, 245, 233, .20);
    border-radius: 0 0 52% 48% / 0 0 62% 58%;
    background: linear-gradient(145deg,
        rgba(232, 245, 233, .10),
        rgba(232, 245, 233, .015) 68%,
        rgba(15, 81, 50, .04));
    transform: rotate(-5deg);
    box-shadow:
        0 0 0 17px rgba(232, 245, 233, .035),
        0 0 0 35px rgba(232, 245, 233, .025);
}

/* Nested lower arch, intentionally offset for depth */
.app-header::after {
    content: "";
    position: absolute;
    z-index: 0;
    pointer-events: none;
    width: min(590px, 58vw);
    height: 205px;
    top: -139px;
    inset-inline-end: 20%;
    border: 1px solid rgba(232, 245, 233, .16);
    border-radius: 0 0 50% 50% / 0 0 65% 65%;
    background: linear-gradient(120deg,
        rgba(255, 255, 255, .075),
        rgba(255, 255, 255, 0) 72%);
    transform: rotate(7deg);
    box-shadow:
        0 0 0 15px rgba(232, 245, 233, .025),
        0 0 0 31px rgba(232, 245, 233, .018);
}

.app-header-inner {
    position: relative;
    z-index: 1;
}

.app-header.is-scrolled {
    box-shadow: 0 10px 30px rgba(15, 81, 50, .27) !important;
}

@media (max-width: 700px) {
    .app-header::before {
        width: 82vw;
        height: 190px;
        top: -132px;
        inset-inline-end: -15%;
    }
    .app-header::after {
        width: 68vw;
        height: 160px;
        top: -112px;
        inset-inline-end: 8%;
    }
}


/* Keep the decorative header pinned while scrolling */
.app-header {
    position: sticky !important;
    top: 0 !important;
    z-index: 1100 !important;
}


/* Header dropdowns must extend outside the header box (sticky header remains pinned). */
.app-header {
    overflow: visible !important;
    position: sticky !important;
    top: 0 !important;
    z-index: 1100 !important;
}
.app-header-inner {
    position: relative;
    z-index: 2;
}
.user-menu,
.connection-status-wrap {
    position: relative;
    z-index: 3;
}
.user-dropdown,
.connection-status-popover {
    z-index: 1400 !important;
}


/* ============================================================
   NPMSS RESPONSIVE APP LAYOUT — MOBILE WIDTH & COMPONENTS
   Fixes narrow content canvas on phones without touching login.
============================================================ */
@media (max-width: 767px) {
    html, body {
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        overflow-x: hidden !important;
    }

    body > .layout {
        display: block !important;
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    body > .layout > main.content,
    .layout > main.content {
        display: block !important;
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        flex: none !important;
        box-sizing: border-box !important;
        margin: 0 !important;
        padding: 16px 12px 30px !important;
    }

    .dashboard-page {
        display: block !important;
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        margin: 0 !important;
        box-sizing: border-box !important;
    }

    .dashboard-page *,
    .content * {
        min-width: 0;
        box-sizing: border-box;
    }

    .dashboard-page .dashboard-heading {
        width: 100%;
        gap: 10px;
        margin-bottom: 16px;
    }

    .dashboard-page .dashboard-subtitle {
        max-width: 100%;
        overflow-wrap: anywhere;
    }

    .dashboard-page .dashboard-role {
        max-width: 100%;
        white-space: normal;
    }

    .dashboard-page .dashboard-scope-card,
    .dashboard-page .card,
    .dashboard-page .stats-grid,
    .dashboard-page .charts-row,
    .dashboard-page .table-wrap {
        width: 100%;
        max-width: 100%;
    }

    .dashboard-page .stats-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: 10px !important;
    }

    .dashboard-page .stat-card {
        width: 100%;
        min-width: 0 !important;
        padding: 14px 10px !important;
        overflow-wrap: anywhere;
    }

    .dashboard-page .stat-num {
        font-size: clamp(1.35rem, 6vw, 1.8rem);
        overflow-wrap: anywhere;
    }

    .dashboard-page .stat-label {
        font-size: .78rem;
        line-height: 1.55;
        overflow-wrap: anywhere;
    }

    .dashboard-page .charts-row {
        grid-template-columns: minmax(0, 1fr) !important;
        gap: 12px;
    }

    .dashboard-page .card {
        padding: 14px !important;
    }

    .dashboard-page .bar-row {
        grid-template-columns: minmax(0, 1fr) minmax(55px, 1.3fr) 38px !important;
        gap: 7px !important;
    }

    .dashboard-page .donut-wrap {
        gap: 12px;
    }

    .dashboard-page .donut-legend {
        min-width: 0;
        width: 100%;
    }

    .dashboard-page .table-wrap,
    .content .table-wrap {
        display: block;
        max-width: 100%;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
    }

    .dashboard-page table.data-table,
    .content table.data-table {
        min-width: 620px;
    }

    .content .form-row,
    .content .form-grid,
    .content .filters,
    .content .dashboard-grid,
    .content .grid-2,
    .content .grid-3 {
        max-width: 100%;
    }

    .content input,
    .content select,
    .content textarea,
    .content button,
    .content .btn {
        max-width: 100%;
    }

    .content img,
    .content svg,
    .content canvas {
        max-width: 100%;
    }
}

@media (max-width: 420px) {
    body > .layout > main.content,
    .layout > main.content {
        padding-inline: 10px !important;
    }

    .dashboard-page .stats-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: 8px !important;
    }

    .dashboard-page .stat-card {
        padding: 12px 8px !important;
    }

    .dashboard-page .stat-label {
        font-size: .73rem;
    }
}

/* Do not constrain the full-width app canvas on tablet-sized devices. */
@media (min-width: 768px) and (max-width: 1000px) {
    body > .layout {
        width: 100%;
        max-width: 100%;
    }
    .layout > main.content {
        min-width: 0;
        width: auto;
    }
}


/* ============================================================
   NPMSS MOBILE DRAWER — FINAL OVERRIDE
   Restore fixed positioning after theme decoration rules.
   Drawer opens below the sticky header in RTL and LTR.
============================================================ */
@media (max-width: 1000px) {
    .app-header {
        position: sticky !important;
        top: 0 !important;
        z-index: 1100 !important;
    }

    .layout {
        display: block !important;
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        margin: 0 !important;
    }

    .layout > .sidebar,
    .sidebar#sidebar {
        position: fixed !important;
        top: var(--header-height, 66px) !important;
        bottom: 0 !important;
        width: min(285px, 88vw) !important;
        height: auto !important;
        min-height: 0 !important;
        max-height: calc(100dvh - var(--header-height, 66px)) !important;
        z-index: 1200 !important;
        overflow-x: hidden !important;
        overflow-y: auto !important;
        visibility: visible !important;
        display: flex !important;
        flex-direction: column !important;
        transition: transform .28s ease !important;
        will-change: transform;
    }

    html[dir="rtl"] .layout > .sidebar,
    html[dir="rtl"] .sidebar#sidebar {
        right: 0 !important;
        left: auto !important;
        transform: translateX(110%) !important;
    }

    html[dir="ltr"] .layout > .sidebar,
    html[dir="ltr"] .sidebar#sidebar {
        left: 0 !important;
        right: auto !important;
        transform: translateX(-110%) !important;
    }

    html[dir="rtl"] .layout > .sidebar.mobile-open,
    html[dir="rtl"] .sidebar#sidebar.mobile-open,
    html[dir="ltr"] .layout > .sidebar.mobile-open,
    html[dir="ltr"] .sidebar#sidebar.mobile-open {
        transform: translateX(0) !important;
    }

    .sidebar-overlay {
        position: fixed !important;
        inset: var(--header-height, 66px) 0 0 !important;
        z-index: 1150 !important;
        display: block !important;
        opacity: 0 !important;
        visibility: hidden !important;
        pointer-events: none !important;
    }

    .sidebar-overlay.active {
        opacity: 1 !important;
        visibility: visible !important;
        pointer-events: auto !important;
    }

    body.sidebar-open {
        overflow: hidden !important;
        touch-action: none;
    }
}


/* =========================================================
   NPMSS FORM PAGE — BLUE SECTION HEADERS & WHITE TITLES
   Scoped to form.php; does not alter other pages or breakpoints
========================================================= */
.form-page-hero {
    position: relative;
    display: flex;
    align-items: center;
    gap: 22px;
    margin: 0 0 22px;
    padding: 25px 28px;
    overflow: hidden;
    color: #fff;
    border: 1px solid rgba(255,255,255,.18);
    border-radius: 20px;
    background:
        radial-gradient(circle at 8% 12%, rgba(255,255,255,.17), transparent 28%),
        linear-gradient(120deg, #123b68 0%, #155b91 52%, #1976a5 100%);
    box-shadow: 0 12px 28px rgba(20, 67, 105, .16);
}
.form-page-hero::after {
    content: "";
    position: absolute;
    width: 230px;
    height: 230px;
    left: -65px;
    bottom: -150px;
    border: 1px solid rgba(255,255,255,.14);
    border-radius: 50%;
    box-shadow: 0 0 0 24px rgba(255,255,255,.035), 0 0 0 48px rgba(255,255,255,.025);
    pointer-events: none;
}
.form-hero-icon {
    flex: 0 0 66px;
    width: 66px;
    height: 66px;
    display: grid;
    place-items: center;
    border: 1px solid rgba(255,255,255,.3);
    border-radius: 18px;
    background: rgba(255,255,255,.13);
    color: #fff;
    font-size: 30px;
}
.form-hero-content { min-width: 0; flex: 1; position: relative; z-index: 1; }
.form-hero-eyebrow {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
    color: rgba(255,255,255,.82);
    font-size: .78rem;
    font-weight: 700;
    letter-spacing: .2px;
}
.form-hero-live-dot {
    width: 8px; height: 8px; border-radius: 50%;
    background: #75e0a3;
    box-shadow: 0 0 0 4px rgba(117,224,163,.15);
}
.form-page-hero .page-title {
    margin: 0 0 7px !important;
    color: #fff !important;
    font-size: clamp(1.35rem, 2.2vw, 1.85rem);
    font-weight: 800;
    line-height: 1.45;
}
.form-page-hero .page-title::after { display: none !important; }
.form-hero-content > p {
    margin: 0;
    color: rgba(255,255,255,.82);
    font-size: .9rem;
    line-height: 1.7;
}
.form-hero-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 13px;
}
.form-hero-tags span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 10px;
    border: 1px solid rgba(255,255,255,.2);
    border-radius: 30px;
    background: rgba(255,255,255,.1);
    color: #fff;
    font-size: .74rem;
    white-space: nowrap;
}
.form-hero-side {
    position: relative;
    z-index: 1;
    flex: 0 0 190px;
    padding: 14px 16px;
    border: 1px solid rgba(255,255,255,.2);
    border-radius: 14px;
    background: rgba(5,30,55,.2);
}
.form-hero-side-label, .form-hero-side small {
    display: block;
    color: rgba(255,255,255,.72);
    font-size: .72rem;
}
.form-hero-side strong {
    display: block;
    margin: 5px 0;
    color: #fff;
    font-size: .95rem;
}
.form-hero-side strong i { color: #a9e8c2; margin-left: 4px; }

#supervisionForm .section-block {
    overflow: hidden;
    border: 1px solid #d9e5ef;
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 5px 18px rgba(25, 55, 85, .055);
}
#supervisionForm .section-head {
    min-height: 58px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 13px 20px;
    color: #fff !important;
    border: 0 !important;
    border-bottom: 3px solid #8dbce0 !important;
    background: linear-gradient(110deg, #123f70 0%, #17649b 58%, #2182b5 100%) !important;
}
#supervisionForm .section-head h3 {
    margin: 0;
    color: #fff !important;
    font-size: 1rem;
    font-weight: 800;
    line-height: 1.5;
}
#supervisionForm .section-score-chip {
    color: #fff !important;
    border-color: rgba(255,255,255,.28) !important;
    background: rgba(255,255,255,.13) !important;
}
#supervisionForm .section-body { padding: 8px 16px 14px; }
#supervisionForm .q-header-row {
    margin: 14px 0 9px;
    padding: 11px 15px;
    border-right: 4px solid #2b83b9;
    border-radius: 9px;
    background: #eaf3fa;
    color: #164b76;
    font-weight: 800;
}
#supervisionForm .q-row {
    border-bottom-color: #edf1f5;
}
#supervisionForm .q-num {
    background: #e8f1f8;
    color: #155783;
    font-weight: 800;
}
#supervisionForm .q-text { color: #26394b; }

@media (max-width: 1000px) {
    .form-page-hero { gap: 15px; padding: 21px; }
    .form-hero-side { flex-basis: 165px; }
}
@media (max-width: 700px) {
    .form-page-hero { align-items: flex-start; flex-wrap: wrap; padding: 18px; border-radius: 15px; }
    .form-hero-icon { flex-basis: 50px; width: 50px; height: 50px; font-size: 24px; border-radius: 14px; }
    .form-hero-content { flex-basis: calc(100% - 70px); }
    .form-hero-content > p { font-size: .82rem; }
    .form-hero-tags { gap: 6px; }
    .form-hero-tags span { font-size: .68rem; padding: 5px 8px; }
    .form-hero-side { flex: 1 1 100%; padding: 10px 13px; }
    #supervisionForm .section-head { padding: 11px 13px; min-height: 52px; }
    #supervisionForm .section-body { padding: 7px 10px 11px; }
}


/* =========================================================
   NPMSS DESKTOP SIDEBAR — STICKY SCROLL
   Desktop only: preserves mobile and tablet drawer behavior
========================================================= */

@media (min-width: 1001px) {

    .layout > #sidebar {
        position: sticky !important;

        /* يبقى أسفل الهيدر الثابت */
        top: var(--header-height, 76px) !important;

        /* منع تمدده مع ارتفاع الصفحة */
        align-self: flex-start !important;
        height: calc(100vh - var(--header-height, 76px)) !important;
        max-height: calc(100vh - var(--header-height, 76px)) !important;

        /* السماح بالتمرير داخل السايد بار عند الحاجة */
        min-height: 0 !important;
        overflow-x: hidden !important;
        overflow-y: auto !important;

        /* الحفاظ على عرض القائمة */
        flex-shrink: 0 !important;

        scrollbar-width: thin;
        scrollbar-color: rgba(255,255,255,.35) transparent;
    }

    /* تحسين شريط التمرير */
    .layout > #sidebar::-webkit-scrollbar {
        width: 5px;
    }

    .layout > #sidebar::-webkit-scrollbar-track {
        background: transparent;
    }

    .layout > #sidebar::-webkit-scrollbar-thumb {
        background: rgba(255,255,255,.3);
        border-radius: 10px;
    }
}

/* NPMSS: keep connection indicator visible on tablet and mobile layouts.
   The scope text is hidden on narrow headers, but the connection control remains. */
@media (max-width: 1000px) {
    .app-header .header-context {
        display: flex !important;
        align-items: center !important;
        flex: 0 1 auto !important;
        min-width: 0 !important;
        margin-inline: 0 !important;
        gap: 0 !important;
    }
    .app-header .scope-indicator {
        display: none !important;
    }
    .app-header .connection-status-wrap {
        display: inline-flex !important;
        flex: 0 0 auto !important;
    }
    .app-header .system-status {
        min-height: 34px;
    }
}
@media (max-width: 600px) {
    .app-header .header-context {
        display: flex !important;
        flex: 0 0 auto !important;
    }
    .app-header .connection-status-label {
        display: inline !important;
        max-width: 66px;
        overflow: hidden;
        text-overflow: ellipsis;
        font-size: 9px !important;
    }
    .app-header .system-status {
        gap: 5px !important;
        padding: 6px 7px !important;
    }
    .app-header .app-brand-text small {
        display: none;
    }
}
