/* =====================================================================
   theme3.css — مظهر مستوحى من منصة سراجي: أزرق نيلي داكن + كهرماني + أزرار مدوّرة.
   يُحمَّل بعد بقية ملفات CSS. لإلغائه احذف سطر <link> الخاص به من index.html.
   ===================================================================== */

/* كل القواعد للشاشة فقط حتى لا تتأثر الطباعة */
@media screen {
/* ---------- المتغيرات (الوضع الفاتح) ---------- */
:root {
    --wc-ink: #1c1950;          /* شريط التنقل */
    --wc-deep: #2c2878;         /* بداية تدرج الشريط العلوي */
    --wc-indigo: #3b34a5;       /* اللون الأساسي */
    --wc-indigo-2: #3a2f96;     /* نهاية تدرج الشريط العلوي */
    --wc-amber: #f59e0b;
    --wc-purple: #7c3aed;
    --wc-red: #d1204a;
}
html:not([data-theme="dark"]) {
    --primary-color: #3b34a5;
    --border-color: #dfe3f1;
}
html:not([data-theme="dark"]) body.app-on { background: #eef1f9 !important; }

/* ---------- شكل الأزرار العام (مدوّرة وبخط عريض) ---------- */
.btn-blue, .btn-edit, .btn-del, .btn-action-print, .btn-action-warning, .btn-wa, .btn-cancel, .btn-danger {
    border-radius: 10px !important;
    font-weight: 800;
}
.btn-action-warning { background: var(--wc-amber) !important; color: #1f2937 !important; border-color: var(--wc-amber) !important; }
.class-card-item.active { background: var(--wc-indigo) !important; color: #fff !important; border-color: var(--wc-indigo) !important; }

/* ---------- أسماء الطلاب في المنتصف ---------- */
.student-card-header { text-align: center !important; justify-content: center !important; }
.student-card .student-card-header { width: 100%; box-sizing: border-box; }

/* =====================================================================
   صفحة البداية
   ===================================================================== */
#landing .ld-top {
    display: grid !important;
    grid-template-columns: auto 1fr auto;
    grid-template-areas: "brand title actions";
    align-items: center;
    gap: 12px;
    background: linear-gradient(135deg, var(--wc-deep), var(--wc-indigo-2)) !important;
    color: #fff;
    padding: 10px 24px !important;
    box-shadow: 0 8px 22px rgba(28, 25, 80, 0.30);
    border-bottom: 3px solid var(--wc-amber);
    position: sticky; top: 0; z-index: 30;
}
#landing .ld-brand { grid-area: brand; justify-self: start; display: flex; align-items: center; gap: 10px; color: #fff; }
#landing .ld-brand b { color: #fff; font-size: 1.05rem; letter-spacing: 0.5px; }
#landing .ld-brand-logo, #landing .ld-brand img {
    width: 54px; height: 54px; border-radius: 16px; background: #fff; padding: 4px;
    object-fit: contain; box-shadow: 0 4px 14px rgba(0, 0, 0, 0.28);
}
#landing .ld-title {
    grid-area: title; justify-self: center; margin: 0; text-align: center; color: #fff;
    font-size: clamp(1.3rem, 2.8vw, 2.1rem); font-weight: 800; line-height: 1.3; text-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}
#landing .ld-top-actions { grid-area: actions; justify-self: end; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
/* أزرار أصغر مع بقاء ألوانها المعروفة */
#landing .ld-btn { padding: 6px 12px !important; font-size: 0.82rem !important; border-radius: 10px !important; line-height: 1.4 !important; min-height: 0 !important; }
#landing .ld-btn-primary { background: #fff !important; color: var(--wc-indigo) !important; border-color: #fff !important; }
#landing .ld-btn-accent { background: var(--wc-amber) !important; color: #1f2937 !important; border-color: var(--wc-amber) !important; }
#landing .ld-btn-ghost { background: transparent !important; color: #fff !important; border: 1.5px solid rgba(255, 255, 255, 0.7) !important; }
#landing .ld-btn-icon { background: rgba(255, 255, 255, 0.16) !important; color: #fff !important; border-color: transparent !important; padding: 6px 10px !important; }

/* المميزات: مستطيلات طولية بجوار بعضها */
#landing .ld-main { padding-top: 16px; margin-top: 0; }
#landing .ld-grid { display: grid !important; grid-template-columns: repeat(6, minmax(0, 1fr)) !important; gap: 14px !important; }
#landing .ld-card {
    display: flex !important; flex-direction: column; align-items: center; justify-content: flex-start; text-align: center;
    min-height: 0 !important; padding: 14px 10px !important; border-radius: 16px;
}
#landing .ld-card > span { font-size: 2rem !important; margin-bottom: 4px; line-height: 1.2; }
#landing .ld-card h3 { font-size: 0.95rem !important; margin: 4px 0 6px !important; text-align: center; line-height: 1.4; }
#landing .ld-card p { font-size: 0.78rem !important; line-height: 1.65 !important; margin: 0 !important; text-align: center; }
#landing .ld-grid { gap: 12px !important; }

/* قسم الخطوات الثلاث: أضغط ليظهر مع المميزات */
#landing .ld-steps { margin-top: 4px !important; }
#landing .ld-steps h2 { font-size: 1.15rem !important; margin: 12px 0 8px !important; }
#landing .ld-steps-list { gap: 12px !important; }
#landing .ld-steps-list li { padding: 10px 14px !important; }
#landing .ld-steps-list li b { width: 30px !important; height: 30px !important; font-size: 0.95rem !important; margin-bottom: 4px !important; }
#landing .ld-steps-list li span { font-size: 0.95rem !important; }
#landing .ld-steps-list li small { font-size: 0.8rem !important; line-height: 1.5 !important; }

/* =====================================================================
   بعد الدخول: الشريط العلوي (اسم يمين، شعار منتصف، بيانات وتصدير/استيراد يسار) ثم شريط التنقل
   ===================================================================== */
#app-content .bar-top-header {
    display: block !important; padding: 0 !important; overflow: hidden; border-radius: 18px;
    background: linear-gradient(135deg, var(--wc-deep), var(--wc-indigo-2)) !important;
    color: #fff; box-shadow: 0 8px 24px rgba(44, 40, 120, 0.28);
}
.hdr-top {
    display: grid; grid-template-columns: 1fr auto 1fr;
    grid-template-areas: "right center left";
    align-items: center; gap: 12px; padding: 12px 18px;
}
.hdr-right { grid-area: right; justify-self: start; text-align: right; min-width: 0; }
.hdr-right h1 { margin: 0 !important; font-size: 1.25rem !important; font-weight: 800; color: #fff !important; line-height: 1.3; overflow-wrap: anywhere; }
.hdr-right p { margin: 2px 0 0 !important; color: #fbbf24 !important; font-weight: 700; font-size: 0.82rem !important; }
.hdr-center { grid-area: center; justify-self: center; }
.hdr-center .brand-logo {
    display: block !important; width: 68px !important; height: 68px !important; border-radius: 18px !important;
    background: #fff; padding: 5px; object-fit: contain; box-shadow: 0 6px 16px rgba(0, 0, 0, 0.30); margin: 0 !important;
}
.hdr-left { grid-area: left; justify-self: end; display: flex; align-items: center; justify-content: flex-end; gap: 12px; flex-wrap: wrap; }
.hdr-data { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.hdr-data .sync-status { margin: 0 !important; }
.hdr-actions { display: flex; align-items: center; gap: 6px; }
.hdr-ico {
    display: inline-flex; align-items: center; justify-content: center; gap: 0; height: 36px; min-width: 36px; padding: 0;
    border: none; border-radius: 10px; background: rgba(255, 255, 255, 0.16); color: #fff; font-size: 1.05rem; cursor: pointer;
}
.hdr-ico:hover { background: rgba(255, 255, 255, 0.28); }
.hdr-ico .t { display: none; }
@media (min-width: 1150px) {
    .hdr-ico { padding: 0 12px; }
    .hdr-ico .t { display: inline; margin-inline-start: 6px; font-size: 0.8rem; font-weight: 800; }
}
.hdr-chip {
    display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 0.78rem; font-weight: 800; line-height: 1.6;
    background: rgba(255, 255, 255, 0.18); color: #fff; white-space: nowrap;
}
.hdr-chip.ok { background: #16a34a; }
.hdr-chip.warn { background: #f59e0b; color: #1f2937; }
.hdr-chip.bad { background: #dc2626; }

/* شريط التنقل: داكن مع أزرار مدوّرة (الزر النشط نيلي) */
#app-content .nav-buttons-section {
    display: flex !important; flex-wrap: wrap; justify-content: center; gap: 8px;
    padding: 8px 12px !important; margin: 0 !important; background: var(--wc-ink) !important; border-radius: 0 !important;
}
#app-content .nav-buttons-section .btn-blue {
    background: transparent !important; color: #e0e7ff !important; border: 1px solid transparent !important;
    border-radius: 10px !important; padding: 7px 14px !important; font-weight: 800; box-shadow: none !important;
}
#app-content .nav-buttons-section .btn-blue:hover { background: rgba(255, 255, 255, 0.10) !important; }
#app-content .nav-buttons-section .btn-blue.active { background: #4338ca !important; color: #fff !important; }
#app-content .nav-buttons-section #btn-admin { background: var(--wc-purple) !important; color: #fff !important; }
#app-content .nav-buttons-section #btn-logout { background: var(--wc-red) !important; color: #fff !important; }

/* =====================================================================
   الشاشات الصغيرة
   ===================================================================== */
@media (max-width: 1100px) {
    #landing .ld-grid { grid-template-columns: repeat(3, minmax(0, 1fr)) !important; }
}
@media (max-width: 720px) {
    #landing .ld-top { grid-template-columns: auto 1fr; grid-template-areas: "brand title" "actions actions"; row-gap: 8px; column-gap: 10px; padding: 8px 12px !important; }
    #landing .ld-brand b { display: none; }
    #landing .ld-brand-logo, #landing .ld-brand img { width: 46px; height: 46px; }
    #landing .ld-title { justify-self: start; text-align: right; font-size: 1.15rem; }
    #landing .ld-top-actions { justify-content: center; gap: 6px; }
    #landing .ld-btn-ghost:not(.install-btn) { display: none !important; }
}
@media (max-width: 560px) {
    #landing .ld-grid { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
    #landing .ld-card { min-height: 230px; }
}

/* =====================================================================
   تثبيت أزرار الفصول وتبويبات الإحصائيات المالية أعلى الشاشة (الكمبيوتر فقط) داخل مستطيل مميّز
   (--stick-top يحسبها auth.js: ارتفاع الشريط العلوي إن كان ثابتاً، وإلا صفر)
   ===================================================================== */
@media (min-width: 900px) {
    #app-content, #app-content .page-view, #view-home, #view-stats > .section-bar,
    #view-phones > .section-bar, #view-contact > .section-bar, #view-admin-stats > .section-bar { overflow: visible !important; }

    #view-home .class-picker, #view-stats .inner-tabs,
    #phoneClassesContainer, #contactClassesContainer, #adminStatsClassesContainer {
        position: sticky; top: var(--stick-top, 0px); z-index: 40;
        background: #fff; border: 2px solid var(--wc-indigo) !important; border-radius: 14px;
        box-shadow: 0 8px 20px rgba(59, 52, 165, 0.20);
    }
    html[data-theme="dark"] #view-home .class-picker, html[data-theme="dark"] #view-stats .inner-tabs,
    html[data-theme="dark"] #phoneClassesContainer, html[data-theme="dark"] #contactClassesContainer,
    html[data-theme="dark"] #adminStatsClassesContainer { background: #1b1e36; }

    /* شريط الصفوف في الرئيسية: صف واحد مضغوط (العنوان والتبديل ثم الأزرار) */
    #view-home .class-picker { display: flex !important; flex-direction: row !important; align-items: center; gap: 14px; padding: 8px 14px !important; }
    #view-home .class-picker .cp-head { flex: none; display: flex; align-items: center; gap: 10px; margin: 0 !important; }
    #view-home .class-picker .cp-head h4 { margin: 0 !important; white-space: nowrap; }
    #view-home .class-picker #classesCardsContainer { flex: 1; min-width: 0; margin: 0 !important; }

    /* أزرار الفصول في كل الشاشات: صف أفقي مضغوط يتمرر إن كثرت */
    #classesCardsContainer, #phoneClassesContainer, #contactClassesContainer, #adminStatsClassesContainer {
        display: flex; flex-wrap: nowrap; gap: 8px; overflow-x: auto;   /* بدون !important حتى يعمل إخفاء الأزرار في وضع القائمة المنسدلة */
    }
    #phoneClassesContainer, #contactClassesContainer, #adminStatsClassesContainer { padding: 8px 12px; margin-bottom: 10px !important; }
    .classes-card-container .class-card-item { flex: none !important; width: auto !important; min-width: 0 !important; padding: 6px 14px !important; font-size: 0.85rem !important; white-space: nowrap; }

    /* تبويبات الإحصائيات المالية */
    #view-stats .inner-tabs { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; padding: 6px 10px; }
}

/* =====================================================================
   الهاتف بعد الدخول: شريط علوي ثابت مضغوط (شعار + اسم + أيقونات / شارات / أزرار التنقل في صف واحد)
   ===================================================================== */
@media (max-width: 899px) {
    body { overflow-x: hidden; overflow-x: clip; max-width: 100%; }
    #app-content { padding-top: var(--hdr-h, 130px) !important; }
    #app-content .bar-top-header {
        position: fixed !important; top: 0; left: 0; right: 0; z-index: 100; margin: 0 !important;
        border-radius: 0 0 16px 16px !important;
    }
    .hdr-top { grid-template-columns: auto 1fr auto; grid-template-areas: "center right actions" "data data data"; gap: 4px 10px; padding: 8px 12px; }
    .hdr-left { display: contents; }
    .hdr-center { grid-area: center; justify-self: start; }
    .hdr-right { grid-area: right; justify-self: stretch; }
    .hdr-actions { grid-area: actions; justify-self: end; }
    .hdr-data { grid-area: data; justify-content: flex-start; gap: 5px; }
    .hdr-center .brand-logo { width: 44px !important; height: 44px !important; border-radius: 12px !important; padding: 3px; }
    .hdr-right h1 { font-size: 1rem !important; }
    .hdr-right p { font-size: 0.72rem !important; }
    .hdr-chip { font-size: 0.7rem; padding: 1px 8px; }
    #app-content .nav-buttons-section { flex-wrap: nowrap; overflow-x: auto; gap: 4px; padding: 5px 8px !important; justify-content: space-between; }
    #app-content .nav-buttons-section .btn-blue { padding: 6px 8px !important; flex: 1 0 auto; justify-content: center; }
    #app-content .nav-buttons-section .nl { display: none; }

    /* عدم خروج المربعات عن عرض الشاشة */
    #app-content .page-view, #app-content .section-bar { max-width: 100%; box-sizing: border-box; }
    #app-content .section-bar > *, #app-content .cards-container > *, #app-content .student-card, #app-content .card-field { min-width: 0; max-width: 100%; box-sizing: border-box; }
    #app-content .home-stats { flex-wrap: wrap; }
    #app-content .collect-meter { flex: 1 1 100%; min-width: 0; }
    #app-content .classes-card-container { display: flex; flex-wrap: wrap; gap: 6px; }
    #app-content .class-card-item { flex: 1 1 calc(50% - 6px); min-width: 0; }
    #app-content table { display: block; max-width: 100%; overflow-x: auto; }
    #app-content img, #app-content select, #app-content input { max-width: 100%; }
}

/* =====================================================================
   الإعدادات: السنة والشهر والمبلغ والعملة في سطر، والاسم والجملة وزر الحفظ في سطر (الكمبيوتر)
   ===================================================================== */
@media (min-width: 900px) {
    .settings-period .gf-grid { display: flex !important; flex-wrap: nowrap; align-items: flex-end; gap: 14px; }
    .settings-period .gf-grid .gf-f { flex: 1 1 0; min-width: 0; }
    .settings-period .gf-grid .gf-amt { flex: 1.8 1 0; }
}
.name-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.name-row input { flex: 1 1 220px; min-width: 0; }
.name-row button { flex: none; }

/* =====================================================================
   أزرار الفصول: خلفية غامقة وكتابة فاتحة، والمفعّل بلون مختلف (برتقالي غامق)
   ===================================================================== */
.class-card-item { background: #1f2a5c !important; color: #e0e7ff !important; border: 1.5px solid #2c2878 !important; font-weight: 800; }
.class-card-item * { color: inherit !important; }
.class-card-item:hover { background: #2c3a7a !important; color: #fff !important; }
.class-card-item.active { background: #c2410c !important; color: #fff !important; border-color: #fb923c !important; box-shadow: 0 4px 12px rgba(194, 65, 12, 0.40); }
html[data-theme="dark"] .class-card-item { background: #3a3f78 !important; color: #fff !important; border-color: #5560a8 !important; }
html[data-theme="dark"] .class-card-item:hover { background: #4a5099 !important; }
html[data-theme="dark"] .class-card-item.active { background: #c2410c !important; border-color: #fb923c !important; }

/* =====================================================================
   صفحة البداية: بيانات الدعم في سطر واحد
   ===================================================================== */
#landing .ld-contact { display: flex !important; align-items: center; justify-content: center; gap: 14px; flex-wrap: wrap; padding: 8px 16px !important; margin-top: 10px !important; }
#landing .ld-contact h3 { margin: 0 !important; font-size: 0.95rem !important; }
#landing .ld-contact-row { display: flex !important; align-items: center; justify-content: center; gap: 10px; flex-wrap: wrap; margin: 0 !important; }
#landing .ld-contact a { padding: 4px 12px !important; font-size: 0.85rem !important; white-space: nowrap; }
#landing .ld-footer { padding: 8px 12px !important; font-size: 0.78rem !important; }

/* =====================================================================
   بطاقات الإدارة (حضانات / مستخدمون / طلبات)
   ===================================================================== */
.adm-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 12px; }
.adm-msg { padding: 14px; color: #64748b; font-weight: 700; text-align: center; grid-column: 1 / -1; }
.adm-card { background: #fff; border: 1px solid var(--border-color); border-top: 5px solid #94a3b8; border-radius: 14px; overflow: hidden; box-shadow: 0 4px 14px rgba(44, 40, 120, 0.08); min-width: 0; }
.adm-card.ok { border-top-color: #16a34a; } .adm-card.warn { border-top-color: #f59e0b; } .adm-card.bad { border-top-color: #dc2626; }
.adm-card.owner { border-top-color: #7c3aed; } .adm-card.mgr { border-top-color: #3b34a5; }
.adm-card-head { text-align: center; font-weight: 800; font-size: 1.02rem; padding: 10px 12px; color: #1e1b4b; background: #f1f5f9; overflow-wrap: anywhere; }
.adm-card.ok .adm-card-head { background: #dcfce7; } .adm-card.warn .adm-card-head { background: #fef3c7; } .adm-card.bad .adm-card-head { background: #fee2e2; }
.adm-card-body { padding: 8px 12px; display: flex; flex-direction: column; gap: 6px; }
.adm-field { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 0.9rem; }
.adm-label { color: #64748b; font-weight: 700; flex: none; }
.adm-val { font-weight: 800; color: #1e1b4b; text-align: left; min-width: 0; overflow-wrap: anywhere; }
.adm-val input { max-width: 100%; }
.adm-actions { display: flex; flex-wrap: wrap; gap: 6px; padding: 8px 12px 12px; border-top: 1px dashed var(--border-color); }
.adm-actions button { flex: 1 1 auto; }
html[data-theme="dark"] .adm-card { background: #1b1e36; }
html[data-theme="dark"] .adm-card-head, html[data-theme="dark"] .adm-val { color: #e0e7ff; }
html[data-theme="dark"] .adm-card-head { background: #262a45; }
html[data-theme="dark"] .adm-card.ok .adm-card-head { background: #14532d; } html[data-theme="dark"] .adm-card.warn .adm-card-head { background: #78350f; } html[data-theme="dark"] .adm-card.bad .adm-card-head { background: #7f1d1d; }

/* =====================================================================
   الإحصائيات الإدارية: العنوان والمؤشرات الثلاثة في شريط واحد عرضي
   ===================================================================== */
.adm-stats-row { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.adm-stats-row h3 { flex: none; }
.adm-stats-row .admin-charts { display: flex !important; flex-direction: row !important; flex-wrap: wrap; align-items: center; gap: 10px; margin: 0 !important; padding: 0 !important; flex: 1 1 auto; justify-content: flex-start; height: auto !important; min-height: 0 !important; }
.adm-stats-row .admin-chart-item { display: flex !important; flex-direction: row !important; align-items: center; gap: 8px; padding: 4px 12px; border-radius: 12px; background: #fff; border: 1px solid var(--border-color); height: auto !important; width: auto !important; min-width: 0; }
.adm-stats-row .chart-label { font-weight: 800; font-size: 0.9rem; white-space: nowrap; margin: 0 !important; }
.adm-stats-row .chart-bar-container { width: 16px !important; height: 30px !important; flex: none; margin: 0 !important; }
.adm-stats-row .chart-value { font-weight: 800; font-size: 1rem; margin: 0 !important; min-width: 28px; text-align: center; }
html[data-theme="dark"] .adm-stats-row .admin-chart-item { background: #1b1e36; }

/* أزرار التراجع والتقدم */
.ops-bar { display: flex; gap: 6px; flex-wrap: wrap; }
.ops-undo:disabled, .ops-redo:disabled { opacity: 0.45; cursor: not-allowed; }

/* =====================================================================
   الهاتف: أزرار التنقل تحت الشريط العلوي (بأسمائها، ثابتة)، ومنع أي تمرير أفقي للصفحة
   ===================================================================== */
@media (max-width: 899px) {
    #app-content { overflow-x: hidden; max-width: 100vw; padding-bottom: 12px !important; }
    body.app-on { padding-bottom: 0 !important; }
    #app-content .nav-buttons-section {
        position: static !important; inset: auto !important; width: auto !important; max-width: none !important; height: auto !important;
        transform: none !important; box-shadow: none !important; border-radius: 0 !important;
        display: flex !important; flex-wrap: nowrap !important; overflow-x: auto; justify-content: flex-start; gap: 4px; padding: 5px 8px !important;
        scrollbar-width: none; -webkit-overflow-scrolling: touch;
    }
    #app-content .nav-buttons-section::-webkit-scrollbar { display: none; }
    #app-content .nav-buttons-section .btn-blue { flex: 0 0 auto !important; flex-direction: row !important; white-space: nowrap; padding: 6px 10px !important; }
    #app-content .nav-buttons-section .nl { display: inline !important; font-size: 0.78rem; margin-inline-start: 4px; }
    #app-content div[style*="display: flex"] { flex-wrap: wrap; }
    .adm-cards { grid-template-columns: minmax(0, 1fr); }
    .adm-stats-row { gap: 8px; }
}
}

/* =====================================================================
   إصلاحات الجوال (آيفون/أندرويد): المناطق الآمنة، ثبات الشريط، اللمس، النوافذ، تكبير iOS
   ===================================================================== */
@media screen {
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body.app-on { padding-left: max(15px, env(safe-area-inset-left, 0px)); padding-right: max(15px, env(safe-area-inset-right, 0px)); }
#landing .ld-top { padding-top: calc(10px + env(safe-area-inset-top, 0px)) !important; }

/* النوافذ: تمرير داخلي بدل القص (الوضع الأفقي ولوحة المفاتيح) */
.custom-modal, #login-overlay { overflow-y: auto; overscroll-behavior: contain; align-items: flex-start; -webkit-backdrop-filter: blur(4px); }
.custom-modal-content, .dialog-box, .login-box { margin: auto; }
.custom-modal-content, .dialog-box { max-height: 90vh; max-height: 90dvh; overflow-y: auto; }

/* اللمس: لا تبقى حركة hover عالقة بعد الضغط */
@media (hover: none) {
    .student-card:hover, .class-card-item:hover, .btn-blue:hover, .btn-action-print:hover, .btn-action-warning:hover,
    .ld-card:hover, .ld-btn:hover, .stat-badge:hover { transform: none !important; }
}

@media (min-width: 900px) { body.app-on { padding-top: max(15px, env(safe-area-inset-top, 0px)); } }

@media (max-width: 899px) {
    /* الشريط الثابت لا يدخل تحت الساعة/النوتش */
    #app-content .bar-top-header { padding-top: env(safe-area-inset-top, 0px) !important; padding-left: env(safe-area-inset-left, 0px) !important; padding-right: env(safe-area-inset-right, 0px) !important; }
    #landing .ld-top { padding-left: max(12px, env(safe-area-inset-left, 0px)) !important; padding-right: max(12px, env(safe-area-inset-right, 0px)) !important; }
    /* صف الحالة بسطر واحد دائماً حتى لا يتغير ارتفاع الشريط ويقفز المحتوى */
    .hdr-data { flex-wrap: nowrap; min-width: 0; overflow: hidden; }
    .hdr-data .hdr-chip { flex: none; }
    .hdr-data .sync-status { flex: 0 1 auto; min-width: 0; max-width: 60vw; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    /* iOS يكبّر الصفحة عند التركيز على حقل أصغر من 16px */
    input, select, textarea, .gf-f input, .gf-f select { font-size: 16px !important; }
}
}

/* =====================================================================
   الشريط الجانبي على اليمين (الكمبيوتر ≥900px). الجوال يبقى كما هو.
   الشعار والاسم ثم العدّاد والشهر وحالة الحفظ تحت الشعار، ثم أزرار المظهر/التصدير/الاستيراد، ثم القائمة، والخروج في الأسفل.
   ===================================================================== */
@media screen {
.ni svg { width: 18px; height: 18px; display: block; flex: none; }
}
@media screen and (min-width: 900px) {
    body.app-on { padding-right: calc(var(--sb-w) + 20px); }
    #app-content .bar-top-header {
        position: fixed !important; top: 0; right: 0; bottom: 0; left: auto; width: var(--sb-w); height: 100vh; height: 100dvh; max-width: none;
        margin: 0 !important; border-radius: 0 !important; z-index: 100; box-sizing: border-box;
        display: grid !important; grid-template-columns: auto 1fr; grid-template-rows: auto auto auto 1fr; align-content: start;
        column-gap: 10px; row-gap: 10px; padding: 16px 12px !important; overflow-x: hidden; overflow-y: auto; scrollbar-width: thin;
        background: linear-gradient(180deg, var(--sb-bg-1), var(--sb-bg-2)) !important; box-shadow: -6px 0 24px rgba(28, 25, 80, 0.25);
    }
    #app-content .hdr-top, #app-content .hdr-left { display: contents; }
    #app-content .hdr-center { grid-column: 1; grid-row: 1; justify-self: start; }
    #app-content .hdr-center .brand-logo { width: 52px !important; height: 52px !important; border-radius: 14px !important; }
    #app-content .hdr-right { grid-column: 2; grid-row: 1; align-self: center; justify-self: stretch; text-align: right; min-width: 0; }
    #app-content .hdr-right h1 { font-size: 1.05rem !important; line-height: 1.3; }
    #app-content .hdr-right p { font-size: 0.72rem !important; }
    #app-content .hdr-data { grid-column: 1 / -1; grid-row: 2; display: flex; flex-wrap: wrap; justify-content: flex-start; gap: 6px; padding-bottom: 10px; border-bottom: 1px solid rgba(255, 255, 255, 0.12); }
    #app-content .hdr-actions { grid-column: 1 / -1; grid-row: 3; display: flex; gap: 6px; }
    #app-content .hdr-actions .hdr-ico { flex: 1; padding: 0; }
    #app-content .hdr-actions .hdr-ico .t { display: none !important; }
    #app-content .nav-buttons-section {
        grid-column: 1 / -1; grid-row: 4; display: flex !important; flex-direction: column !important; flex-wrap: nowrap !important;
        justify-content: flex-start !important; gap: 4px !important; padding: 4px 0 0 !important; background: transparent !important; border-radius: 0 !important; min-height: 0; overflow: visible;
    }
    #app-content .nav-buttons-section .btn-blue { width: 100% !important; justify-content: flex-start !important; gap: 12px; padding: 9px 12px !important; font-size: 0.92rem; border-radius: 12px !important; text-align: start; }
    #app-content .nav-buttons-section .btn-blue.active,
    #app-content .nav-buttons-section #btn-admin.active { background: var(--sb-active) !important; color: #1f2937 !important; }
    #app-content .nav-buttons-section #btn-logout { margin-top: auto; }
}

/* =====================================================================
   الألوان (أزرق/أبيض)، شريط العمل العلوي
   ===================================================================== */
@media screen {
.btn-action-warning { background: var(--primary-color) !important; color: #fff !important; border-color: var(--primary-color) !important; }
.btn-wa { background-color: var(--primary-color) !important; }
.btn-cancel, .btn-action-print.btn-undo { background-color: #5b6b9a !important; border-color: #5b6b9a !important; color: #fff; }
.custom-modal-header .btn-danger { background-color: var(--primary-color); border-color: var(--primary-color); }
.class-card-item.active, html[data-theme="dark"] .class-card-item.active { background: #2563eb !important; border-color: #93c5fd !important; box-shadow: 0 4px 12px rgba(37, 99, 235, 0.40); }
#landing .ld-btn-accent { background: #bfdbfe !important; color: #1c1950 !important; border-color: #bfdbfe !important; }
#app-content .nav-buttons-section #btn-admin, #app-content .nav-buttons-section #btn-admin:hover { background: var(--btn-admin) !important; color: #fff !important; }
#app-content .nav-buttons-section #btn-admin.active { background: var(--sb-active) !important; color: #166534 !important; }
#app-content #sub-days.hdr-chip { background: var(--btn-counter) !important; color: #1f2937 !important; }
.work-top { display: none; }
}
@media screen and (min-width: 900px) {
    #app-content .hdr-actions, #app-content #hdr-month { display: none !important; }
    .work-top { display: flex; align-items: center; gap: 10px; position: sticky; top: 8px; z-index: 90; margin-bottom: 14px; padding: 8px 18px; min-height: 52px; box-sizing: border-box; border-radius: 16px; color: #fff;
        background: linear-gradient(90deg, var(--sb-bg-1), var(--sb-bg-2)); box-shadow: 0 8px 22px rgba(28, 25, 80, 0.25); }
    .work-top h2 { margin: 0; flex: 1; min-width: 0; font-size: 1.3rem; font-weight: 800; color: #fff; }
    .wt-ico { display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 14px; border: 0; border-radius: 10px; background: rgba(255, 255, 255, 0.16); color: #fff; font-weight: 800; font-size: 0.85rem; cursor: pointer; font-family: inherit; }
    .wt-ico:hover { background: rgba(255, 255, 255, 0.28); }
    .wt-ico svg { width: 18px; height: 18px; flex: none; }
    .wt-chip { display: inline-block; padding: 6px 16px; border-radius: 999px; background: #fff; color: #2c2878; font-weight: 800; font-size: 0.85rem; white-space: nowrap; }
    .wt-chip.warn { background: #fde68a; color: #1f2937; }
}

/* شارة الشهر في الشريط العلوي: قائمة اختيار بشكل شارة */
@media screen and (min-width: 900px) {
    .wt-chip { position: relative; display: inline-flex; align-items: center; gap: 6px; cursor: pointer; padding: 4px 12px 4px 10px; }
    .wt-chip select { -webkit-appearance: none; appearance: none; border: 0; background: transparent; color: inherit; font: inherit; font-weight: 800; cursor: pointer; padding: 2px 4px; outline: none; max-width: 110px; }
    .wt-chip select option { color: #1f2937; background: #fff; }
    .wt-chip::after { content: '▾'; font-size: 0.8em; opacity: 0.7; }
    .wt-chip:hover { box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.35); }
    body.app-on .wt-chip select:focus, body.app-on .wt-chip select:focus-visible { box-shadow: none !important; }
}

/* الشريط العلوي الثابت: لا يظهر محتوى الصفحة في الفراغ فوقه عند التمرير */
@media screen and (min-width: 900px) {
    .work-top::before { content: ''; position: absolute; left: 0; right: 0; top: -8px; height: 8px; background: var(--bg-color, #eef1f9); }
}

/* =====================================================================
   ألوان جديدة (تركوازي داكن + ذهبي + كريمي): ربط القواعد الثابتة القديمة بالمتغيرات في theme2.css
   لإلغائها احذف هذا القسم فقط وقسم "لوحة الألوان الجديدة" في theme2.css
   ===================================================================== */
@media screen {
html:not([data-theme="dark"]) body.app-on { background: var(--bg-color) !important; }
html:not([data-theme="dark"]) #landing { background: linear-gradient(180deg, #faf8f3 0%, #efece6 100%); }
.btn-action-warning { background: var(--t-gold) !important; border-color: var(--t-gold) !important; color: #fff !important; }
.btn-action-warning:hover { background: var(--t-gold-hover) !important; }
.btn-cancel, .btn-action-print.btn-undo { background-color: #5b7a82 !important; border-color: #5b7a82 !important; }
.class-card-item { background: var(--t-deep) !important; border-color: var(--t-ink) !important; color: #e6f4f1 !important; }
.class-card-item:hover { background: var(--t-teal-2) !important; }
.class-card-item.active, html[data-theme="dark"] .class-card-item.active { background: var(--t-gold) !important; border-color: var(--t-gold-soft) !important; color: #fff !important; box-shadow: 0 4px 12px rgba(184,137,58,.40); }
html[data-theme="dark"] .class-card-item { background: #1d4a57 !important; border-color: #2c6272 !important; }
#view-home .class-picker, #view-stats .inner-tabs, #phoneClassesContainer, #contactClassesContainer, #adminStatsClassesContainer { border-color: var(--t-teal) !important; box-shadow: 0 8px 20px rgba(15,118,110,.18); }
html[data-theme="dark"] #view-home .class-picker, html[data-theme="dark"] #view-stats .inner-tabs, html[data-theme="dark"] #phoneClassesContainer, html[data-theme="dark"] #contactClassesContainer, html[data-theme="dark"] #adminStatsClassesContainer { background: #12262d; }
#landing .ld-btn-accent { background: var(--t-gold-soft) !important; border-color: var(--t-gold-soft) !important; color: var(--t-ink) !important; }
#landing .ld-btn-primary { color: var(--t-teal-2) !important; }
.ld-contact { background: linear-gradient(135deg, var(--t-ink), var(--t-deep)) !important; }
.ld-contact-row a:hover { background: var(--t-gold); color: #fff; }
#login-overlay { background: radial-gradient(800px 400px at 50% 0%, rgba(184,137,58,.22), transparent 60%), rgba(12,59,78,.92); }
.custom-modal { background: rgba(12,59,78,.62); }
.wt-chip { color: var(--t-ink); }
@media (max-width: 899px) { #app-content .nav-buttons-section .btn-blue.active { background: var(--t-teal) !important; color: #fff !important; } }
.adm-card.mgr { border-top-color: var(--t-teal); } .adm-card.owner { border-top-color: var(--t-gold); }
.adm-card-head, .adm-val { color: var(--t-ink); }
html[data-theme="dark"] .adm-card { background: #12262d; } html[data-theme="dark"] .adm-card-head { background: #1a343d; color: #d7efea; } html[data-theme="dark"] .adm-val { color: #d7efea; }
html[data-theme="dark"] .adm-stats-row .admin-chart-item { background: #12262d; }
html:not([data-theme="dark"]) body.app-on .printable-list-table th { background: var(--t-th); color: #fff; }
html:not([data-theme="dark"]) body.app-on .printable-list-table tbody tr:nth-child(even) { background: #f7f4ed; }
html:not([data-theme="dark"]) body.app-on .printable-list-table tbody tr:hover { background: #efe9dc; }
html:not([data-theme="dark"]) body.app-on .student-card-header { background: linear-gradient(180deg, #fbf9f4, #f1ede3); }
html:not([data-theme="dark"]) body.app-on .cm-track { background: #e4dfd2; }
html:not([data-theme="dark"]) body.app-on .inner-tabs, html:not([data-theme="dark"]) .seg, html:not([data-theme="dark"]) .count-pill { background: var(--t-sand); }
html:not([data-theme="dark"]) body.app-on .section-bar { border-color: rgba(15,118,110,.12); }
body.app-on .inner-tabs .btn-blue:hover { background: rgba(15,118,110,.10); }
body.app-on :focus-visible, body.app-on input:focus, body.app-on select:focus, body.app-on textarea:focus { box-shadow: 0 0 0 3px rgba(15,118,110,.25) !important; }
.att-table td.att-no, .att-table td.att-name { background: var(--surface, #fff); }
}
