:root{
  --bg:#f4f7fb;--card:#fff;--text:#172033;--muted:#64748b;--border:#e2e8f0;
  --primary:#146c94;--primary-2:#0f5879;--success:#15803d;--danger:#b91c1c;--warning:#b45309;--info:#0369a1;
  --shadow:0 18px 45px rgba(15,23,42,.08);--radius:18px;
}
*{box-sizing:border-box}body{margin:0;font-family:Tajawal,"Segoe UI",Tahoma,Arial,sans-serif;background:var(--bg);color:var(--text);direction:rtl}a{color:inherit;text-decoration:none}.ltr{direction:ltr;unicode-bidi:embed}.small{font-size:12px}.muted{color:var(--muted)}
.auth-page{min-height:100vh;display:flex;align-items:center;justify-content:center;padding:24px;background:radial-gradient(circle at top right,#dff5ff,transparent 35%),linear-gradient(135deg,#f7fbff,#eef5f9)}
.auth-card{width:min(980px,100%);background:rgba(255,255,255,.92);border:1px solid rgba(226,232,240,.9);border-radius:26px;box-shadow:var(--shadow);padding:28px}.auth-card h1{margin:0 0 8px}.install-card{max-width:980px}.form-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:16px}.form-grid label,.stack label{display:flex;flex-direction:column;gap:7px;font-weight:700}.form-grid input,.form-grid select,.form-grid textarea,.stack input,.stack select,.stack textarea,input,select,textarea{width:100%;border:1px solid var(--border);border-radius:14px;padding:12px 13px;background:#fff;color:var(--text);font-family:inherit;font-size:15px}textarea{min-height:82px;resize:vertical}.full{grid-column:1/-1}.btn{display:inline-flex;align-items:center;justify-content:center;gap:7px;border:1px solid var(--border);border-radius:13px;padding:11px 16px;background:#fff;cursor:pointer;font-weight:800;font-family:inherit;font-size:14px}.btn-primary{background:var(--primary);border-color:var(--primary);color:#fff}.btn-primary:hover{background:var(--primary-2)}.btn-success{background:var(--success);border-color:var(--success);color:#fff}.btn-danger{background:var(--danger);border-color:var(--danger);color:#fff}.btn-warning{background:#f59e0b;border-color:#f59e0b;color:#111827}.btn-sm{padding:8px 10px;border-radius:10px;font-size:12px}.actions{display:flex;gap:8px;flex-wrap:wrap;align-items:center}.app{display:grid;grid-template-columns:260px 1fr;min-height:100vh}.sidebar{background:#0f2633;color:#eaf7fc;padding:20px;position:sticky;top:0;height:100vh;overflow:auto}.brand{display:flex;align-items:center;gap:10px;padding-bottom:16px;border-bottom:1px solid rgba(255,255,255,.12);margin-bottom:14px}.brand-mark{width:42px;height:42px;border-radius:14px;background:linear-gradient(135deg,#38bdf8,#14b8a6);display:grid;place-items:center;color:#fff;font-weight:900}.nav{display:flex;flex-direction:column;gap:6px}.nav a{padding:11px 12px;border-radius:13px;color:#dff5ff}.nav a:hover,.nav a.active{background:rgba(255,255,255,.12)}.content{padding:24px;min-width:0}.topbar{display:flex;justify-content:space-between;align-items:center;margin-bottom:18px;gap:12px}.card{background:var(--card);border:1px solid var(--border);border-radius:var(--radius);box-shadow:0 8px 24px rgba(15,23,42,.04);padding:18px;margin-bottom:16px}.card h2,.card h3{margin-top:0}.stats{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:14px}.stat{background:linear-gradient(180deg,#fff,#f8fbfd);border:1px solid var(--border);border-radius:18px;padding:18px}.stat b{font-size:28px;display:block}.table-wrap{overflow:auto;border:1px solid var(--border);border-radius:16px;background:#fff}table{width:100%;border-collapse:collapse;min-width:760px}th,td{padding:12px;border-bottom:1px solid var(--border);text-align:right;vertical-align:top}th{background:#f8fafc;color:#334155;white-space:nowrap}tr:last-child td{border-bottom:0}.badge{display:inline-flex;border-radius:999px;padding:5px 10px;font-size:12px;font-weight:800}.badge-success{background:#dcfce7;color:#166534}.badge-danger{background:#fee2e2;color:#991b1b}.badge-warning{background:#fef3c7;color:#92400e}.badge-info{background:#e0f2fe;color:#075985}.badge-muted{background:#f1f5f9;color:#475569}.alert{border-radius:15px;padding:12px 14px;margin:12px 0;border:1px solid}.alert-success{background:#ecfdf5;border-color:#bbf7d0;color:#166534}.alert-danger{background:#fef2f2;border-color:#fecaca;color:#991b1b}.alert-warning{background:#fffbeb;border-color:#fde68a;color:#92400e}.grid-2{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:16px}.grid-3{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:16px}.visit-days{display:flex;flex-direction:column;gap:12px}.visit-card{display:grid;grid-template-columns:120px 150px 1fr 1fr 1.2fr;gap:10px;align-items:start;border:1px solid var(--border);border-radius:18px;padding:14px;background:#fff}.visit-card .day-title{font-weight:900;color:var(--primary)}.other-school-input{margin-top:8px}.mobile-only{display:none}.print-sheet{background:#fff;border:1px solid var(--border);border-radius:20px;padding:28px}.official-head{display:flex;align-items:center;justify-content:space-between;border-bottom:2px solid #0f2633;padding-bottom:16px;margin-bottom:18px}.official-title{text-align:center}.official-title h1{margin:0;font-size:24px}.signature{display:grid;grid-template-columns:repeat(3,1fr);gap:16px;margin-top:26px}.signature div{border-top:1px dashed #94a3b8;padding-top:12px;text-align:center;color:#334155}.admin-note{background:#f8fafc;border:1px dashed #cbd5e1;border-radius:14px;padding:13px}.today-card{border:1px solid #bae6fd;background:#f0f9ff;border-radius:18px;padding:16px}
@media (max-width: 900px){.app{grid-template-columns:1fr}.sidebar{position:relative;height:auto}.content{padding:14px}.topbar{align-items:flex-start;flex-direction:column}.stats,.grid-2,.grid-3,.form-grid{grid-template-columns:1fr}.visit-card{grid-template-columns:1fr}.visit-card .field-label{display:block;color:var(--muted);font-size:12px;margin-bottom:5px}.desktop-only{display:none}.mobile-only{display:inline}.auth-card{padding:20px}.table-wrap{border:0;overflow:visible}table.responsive{min-width:0}table.responsive thead{display:none}table.responsive,tr.resp-row,td.resp-cell{display:block;width:100%}tr.resp-row{border:1px solid var(--border);border-radius:16px;margin-bottom:12px;background:#fff;overflow:hidden}td.resp-cell{border-bottom:1px solid var(--border)}td.resp-cell:before{content:attr(data-label);display:block;font-size:12px;color:var(--muted);font-weight:700;margin-bottom:5px}.signature{grid-template-columns:1fr}.official-head{flex-direction:column;text-align:center}}
@media print{body{background:#fff}.sidebar,.topbar,.no-print,.actions{display:none!important}.app{display:block}.content{padding:0}.card,.print-sheet{box-shadow:none;border:0;border-radius:0;margin:0}.table-wrap{overflow:visible;border:0}table{min-width:0;font-size:13px}a[href]:after{content:""}}
.stack{display:flex;flex-direction:column;gap:14px}

/* v1.3.2 - القالب الرسمي لخطة الزيارات */
.official-card{background:#f8fafc}.official-document{background:#fff;border:1.5px solid #13a085;border-radius:28px;padding:24px 28px 30px;max-width:900px;margin:0 auto;color:#111;position:relative;overflow:hidden}.official-document:before{content:"";position:absolute;inset:12px;border:1px solid rgba(19,160,133,.22);border-radius:22px;pointer-events:none}.official-top{display:grid;grid-template-columns:1fr 1.1fr 1fr;gap:12px;align-items:start;margin-bottom:10px;position:relative;z-index:1}.official-side{font-size:13px;color:#168d7c;line-height:1.9}.official-entity{text-align:right}.official-entity strong,.official-meta strong{display:inline-block;color:#168d7c}.official-entity span{display:block;color:#168d7c}.official-meta{text-align:left}.write-line{display:inline-block;min-width:92px;border-bottom:1px dotted #168d7c;height:14px;vertical-align:middle}.official-logo{text-align:center;color:#168d7c}.official-logo strong{display:block;font-size:21px;line-height:1.2}.official-logo small{display:block;color:#6b8f86;margin-top:3px}.logo-mark{width:82px;height:40px;margin:0 auto 4px;display:grid;grid-template-columns:repeat(3,12px);gap:6px;justify-content:center;align-content:center}.logo-mark span{width:10px;height:10px;border-radius:50%;background:#13a085;display:block;box-shadow:18px 0 0 #13a085}.official-main-title{text-align:center;font-size:18px;margin:8px 0 14px;font-weight:900;color:#111;position:relative;z-index:1}.official-letter{text-align:center;line-height:2.1;font-size:15px;margin-bottom:18px;position:relative;z-index:1}.official-letter p{margin:4px 0}.official-summary{display:grid;grid-template-columns:repeat(5,minmax(0,1fr));border:1px solid #b7d8c8;border-radius:14px;overflow:hidden;margin-bottom:14px;position:relative;z-index:1}.official-summary div{padding:9px 10px;background:#fbfffb;border-left:1px solid #d8eadc}.official-summary div:last-child{border-left:0}.official-summary span{display:block;color:#527064;font-size:12px;margin-bottom:2px}.official-summary strong{display:block;font-size:14px;color:#111}.official-today{margin-bottom:12px;position:relative;z-index:1}.official-note{margin:12px 0;position:relative;z-index:1}.official-table-wrap{border:1px solid #d7e8cf;border-radius:0;overflow:hidden;position:relative;z-index:1}.official-table{min-width:0;width:100%;border-collapse:collapse;table-layout:fixed}.official-table th{background:#65ad3b!important;color:#fff;text-align:center;border:1px solid #d7e8cf;padding:11px;font-size:15px}.official-table td{border:1px solid #d7e8cf;padding:10px 12px;text-align:center;vertical-align:middle;font-size:15px}.official-table tbody tr:nth-child(odd) td{background:#c8dfb7}.official-table tbody tr:nth-child(even) td{background:#e8f2df}.official-table .day-col{width:27%}.official-table .type-col{width:27%}.official-day-cell{background:#65ad3b!important;color:#fff}.official-day-cell strong{display:block;font-size:15px;margin-bottom:4px}.official-day-cell span{display:block;font-size:14px;color:#fff}.official-type-cell{font-weight:900;color:#111}.official-school-cell{text-align:right!important;min-height:54px}.official-school-cell span{display:block;min-height:22px}.official-school-cell small{display:block;margin-top:4px;color:#334155;font-size:12px}.empty-write-space{letter-spacing:1px;color:#334155}.official-footer{display:grid;grid-template-columns:repeat(3,1fr);gap:18px;margin-top:28px;position:relative;z-index:1}.footer-write-box{text-align:center;color:#111;min-height:64px}.footer-write-box strong{display:block;margin-bottom:22px}.footer-write-box span{display:block;border-top:1px dotted #333;width:70%;margin:0 auto}.official-document .badge{border:0;background:transparent;color:#111;padding:0;font-size:14px}
@media (max-width:900px){.official-document{padding:18px 14px;border-radius:22px}.official-top{grid-template-columns:1fr;text-align:center}.official-entity,.official-meta{text-align:center}.official-summary{grid-template-columns:1fr 1fr}.official-summary div{border-bottom:1px solid #d8eadc}.official-table-wrap{overflow:auto}.official-table{min-width:640px}.official-footer{grid-template-columns:1fr}.official-letter{text-align:right}}
@media print{@page{size:A4 portrait;margin:10mm}body{background:#fff!important}.content{padding:0!important}.official-card,.card{padding:0!important;margin:0!important;background:#fff!important;border:0!important}.official-document{max-width:none;width:100%;border:1.5px solid #13a085!important;border-radius:18px!important;padding:18px 22px!important;box-shadow:none!important;page-break-inside:avoid}.official-document:before{inset:8px;border-radius:14px}.official-main-title{font-size:17px}.official-letter{font-size:14px;line-height:1.8}.official-summary{grid-template-columns:repeat(5,1fr)}.official-table th,.official-table td{font-size:13px;padding:7px 8px}.official-day-cell strong{font-size:13px}.official-day-cell span{font-size:12px}.official-footer{margin-top:18px}.today-card,.official-note{font-size:12px;padding:8px 10px}.official-top{grid-template-columns:1fr 1.1fr 1fr}.official-entity{text-align:right}.official-meta{text-align:left}.official-logo strong{font-size:18px}.logo-mark{transform:scale(.85);height:32px}}


/* v1.3.3 - اعتماد المدير والتوقيع المصور */
.official-approval{display:grid;grid-template-columns:1fr 1.7fr;gap:24px;align-items:end;margin-top:26px;position:relative;z-index:1}.approval-stamp-box,.approval-sign-box{text-align:center;color:#111;min-height:110px;display:flex;flex-direction:column;align-items:center;justify-content:flex-end}.approval-sign-box strong,.approval-stamp-box strong{font-size:16px;margin-bottom:8px}.approval-sign-box b{font-size:16px;margin-top:6px}.approval-line{display:block;border-top:1px dotted #333;width:70%;height:28px;margin:14px auto 6px}.signature-img{max-width:190px;max-height:72px;object-fit:contain;display:block;margin:2px auto}.approval-stamp-box img{max-width:120px;max-height:92px;object-fit:contain;display:block;margin:4px auto}.settings-preview{display:block;border:1px dashed var(--border);border-radius:14px;padding:10px;margin-top:8px;background:#fff}.settings-preview img{max-width:180px;max-height:90px;object-fit:contain;display:block}.inline-check{display:flex!important;flex-direction:row!important;align-items:center;gap:8px;margin-top:8px;font-weight:600!important}.inline-check input{width:auto!important}.approval-preview{border:1px dashed var(--border);border-radius:18px;padding:18px;background:#fff;display:grid;grid-template-columns:1fr 1.7fr;gap:20px}.official-footer{display:none}
@media (max-width:900px){.official-approval,.approval-preview{grid-template-columns:1fr}.approval-sign-box,.approval-stamp-box{min-height:90px}}
@media print{.official-approval{margin-top:18px;grid-template-columns:1fr 1.6fr}.signature-img{max-height:58px}.approval-stamp-box img{max-height:72px}.approval-sign-box strong,.approval-stamp-box strong,.approval-sign-box b{font-size:14px}}

/* v1.3.4 - إعدادات الخطاب والاعتماد المتقدمة */
.placeholder-guide{background:#f8fafc;border:1px dashed var(--border);border-radius:16px;padding:12px;display:flex;gap:8px;flex-wrap:wrap;align-items:center}.placeholder-guide code{background:#eef2ff;border:1px solid #c7d2fe;color:#3730a3;border-radius:10px;padding:4px 7px;font-family:inherit;font-weight:700}.mini-document-preview{background:#fff;border:1px solid var(--border);border-radius:18px;padding:20px;line-height:2}.mini-document-preview h3{text-align:center;margin-top:0}.official-closing{margin:16px 0 4px;text-align:center;font-size:14px;line-height:1.9;position:relative;z-index:1}.official-approval{display:grid!important;grid-template-columns:repeat(3,minmax(0,1fr))!important;gap:18px!important;align-items:end!important;margin-top:24px}.official-approval .approval-sign-box{grid-column:2}.official-approval .approval-stamp-box{grid-column:1}.official-approval-align-right .approval-sign-box{grid-column:3}.official-approval-align-right .approval-stamp-box{grid-column:1}.official-approval-align-center .approval-sign-box{grid-column:2}.official-approval-align-center .approval-stamp-box{grid-column:1}.official-approval-align-left .approval-sign-box{grid-column:1}.official-approval-align-left .approval-stamp-box{grid-column:3}.official-approval-align-right .approval-sign-box{text-align:center}.official-approval-align-center .approval-sign-box{text-align:center}.official-approval-align-left .approval-sign-box{text-align:center}
@media (max-width:900px){.official-approval{grid-template-columns:1fr!important}.official-approval .approval-sign-box,.official-approval .approval-stamp-box{grid-column:auto!important}.placeholder-guide{display:block}.placeholder-guide code{display:inline-block;margin:4px 3px}.mini-document-preview{padding:14px}}
@media print{.official-closing{font-size:12px;margin:10px 0 0}.official-approval{grid-template-columns:repeat(3,1fr)!important;gap:12px!important;margin-top:16px!important}.official-approval .approval-sign-box,.official-approval .approval-stamp-box{min-height:76px}.official-approval-align-right .approval-sign-box{grid-column:3!important}.official-approval-align-right .approval-stamp-box{grid-column:1!important}.official-approval-align-center .approval-sign-box{grid-column:2!important}.official-approval-align-center .approval-stamp-box{grid-column:1!important}.official-approval-align-left .approval-sign-box{grid-column:1!important}.official-approval-align-left .approval-stamp-box{grid-column:3!important}}


/* v1.3.5 - إزالة خانة الختم من الاعتماد، وإظهار الصورة المرفوعة تحت اسم المشرف */
.supervisor-name-summary{align-items:center!important;justify-content:center!important;gap:4px!important}.supervisor-under-name-img{max-width:96px;max-height:64px;object-fit:contain;display:block;margin:6px auto 0}.preview-supervisor-name-box{border:1px solid #d8eadc;border-radius:14px;background:#f8fff8;padding:10px 12px;text-align:center;margin:12px auto;max-width:260px}.preview-supervisor-name-box span{display:block;color:#64748b;font-size:12px;font-weight:700}.preview-supervisor-name-box strong{display:block;font-size:16px}.official-approval .approval-stamp-box{display:none!important}.official-approval .approval-sign-box{grid-column:2}.official-approval-align-right .approval-sign-box{grid-column:3!important}.official-approval-align-center .approval-sign-box{grid-column:2!important}.official-approval-align-left .approval-sign-box{grid-column:1!important}
@media (max-width:900px){.supervisor-under-name-img{max-width:84px;max-height:56px}.official-approval .approval-sign-box{grid-column:auto!important}}
@media print{.supervisor-under-name-img{max-width:78px;max-height:48px}.official-approval .approval-sign-box{min-height:72px}.official-approval-align-right .approval-sign-box{grid-column:3!important}.official-approval-align-center .approval-sign-box{grid-column:2!important}.official-approval-align-left .approval-sign-box{grid-column:1!important}}


/* v1.3.6: شعار رسمي قابل للرفع بدل الشعار الافتراضي النقطي */
.logo-mark{display:none!important}
.official-logo{display:flex;align-items:center;justify-content:center;min-height:86px;text-align:center;color:#168d7c}
.official-header-logo{max-width:170px;max-height:86px;object-fit:contain;display:block;margin:0 auto}
.official-logo-empty{display:block;min-width:130px;min-height:58px}
.official-logo strong,.official-logo small{display:none!important}
.official-letter{word-spacing:0!important;letter-spacing:0!important}
.official-type-cell:empty::after{content:'غير محدد';color:#334155;font-weight:700}
@media print{.official-logo{min-height:70px}.official-header-logo{max-width:145px;max-height:70px}.official-logo-empty{min-height:48px}.official-type-cell:empty::after{content:'غير محدد'}}


/* v1.3.8 - إعدادات الهيدر المرنة وتجربة جوال أقرب للتطبيق */
.document-header-block{display:flex;flex-direction:column;gap:6px;align-items:center;justify-content:flex-start;color:#168d7c;line-height:1.55;min-height:72px}
.document-header-block .header-block-text strong{display:block;font-size:16px;color:#168d7c;font-weight:900}
.document-header-block .header-block-text span{display:block;font-size:13px;color:#168d7c;font-weight:600}
.header-align-right{align-items:flex-start;text-align:right}.header-align-center{align-items:center;text-align:center}.header-align-left{align-items:flex-end;text-align:left}
.header-layout-side{flex-direction:row;align-items:center}.header-layout-bottom .header-block-image-wrap{order:2}.header-layout-bottom .header-block-text{order:1}
.header-block-image{object-fit:contain;display:block;margin:0 auto}.header-logo-small .header-block-image{max-width:90px;max-height:48px}.header-logo-medium .header-block-image{max-width:150px;max-height:76px}.header-logo-large .header-block-image{max-width:210px;max-height:96px}
.official-entity.document-header-block{align-items:flex-start;text-align:right}.official-logo.document-header-block{align-items:center;text-align:center}.official-meta{display:flex;flex-direction:column;gap:3px;min-height:72px;justify-content:flex-start}
.settings-page{display:grid;grid-template-columns:minmax(0,1fr);gap:16px}.settings-section h2{margin-bottom:6px}.settings-subsection{border:1px solid var(--border);border-radius:18px;padding:16px;margin-top:14px;background:#fbfdff}.settings-subsection h3{margin:0 0 12px;color:#0f5879}.settings-form{display:block}.sticky-save-card{position:sticky;bottom:14px;z-index:20;border-color:#bfdbfe;background:rgba(255,255,255,.96);backdrop-filter:blur(12px)}.preview-paper{max-width:850px}.preview-paper:before{display:none}
@media (max-width:900px){
  html{background:#f4f7fb}body{padding-bottom:86px;-webkit-tap-highlight-color:transparent}.app{display:block;min-height:100dvh}.sidebar{position:fixed!important;right:10px;left:10px;bottom:10px;top:auto;height:auto;z-index:1000;padding:8px;border-radius:24px;background:rgba(15,38,51,.96);box-shadow:0 16px 40px rgba(15,23,42,.22);backdrop-filter:blur(18px);overflow:visible}.sidebar .brand{display:none}.sidebar .nav{display:grid;grid-auto-flow:column;grid-auto-columns:minmax(92px,1fr);overflow-x:auto;gap:6px;scrollbar-width:none}.sidebar .nav::-webkit-scrollbar{display:none}.sidebar .nav a{min-height:48px;border-radius:18px;padding:8px 10px;text-align:center;display:flex;align-items:center;justify-content:center;font-size:12px;white-space:nowrap}.sidebar .nav a.active{background:linear-gradient(135deg,#38bdf8,#14b8a6);color:#fff}.content{padding:14px 12px 26px}.topbar{position:sticky;top:0;z-index:60;background:rgba(244,247,251,.92);backdrop-filter:blur(16px);border-bottom:1px solid rgba(226,232,240,.8);margin:-14px -12px 14px;padding:12px}.topbar h1{font-size:20px;margin:0}.card{border-radius:22px;padding:16px;box-shadow:0 12px 34px rgba(15,23,42,.07)}.btn{min-height:46px;border-radius:16px}.actions{display:grid;grid-template-columns:1fr;gap:10px}.actions .btn{width:100%}input,select,textarea,.form-grid input,.form-grid select,.form-grid textarea{font-size:16px;min-height:48px;border-radius:16px}.visit-days{gap:14px}.visit-card{border-radius:22px;padding:16px;box-shadow:0 10px 24px rgba(15,23,42,.05)}.visit-card .day-title{font-size:18px}.other-school-input{margin-top:10px}.official-document{border-radius:24px!important;padding:16px 12px 18px!important;overflow:visible}.official-document:before{display:none}.official-top{grid-template-columns:1fr!important;gap:10px;text-align:center}.official-entity.document-header-block,.official-logo.document-header-block,.official-meta{align-items:center!important;text-align:center!important}.document-header-block{min-height:auto}.header-layout-side{flex-direction:column}.official-summary{grid-template-columns:1fr!important}.official-summary div{border-left:0!important;text-align:center}.official-table-wrap{overflow-x:auto;border-radius:16px}.official-table{min-width:640px}.settings-subsection{padding:12px}.sticky-save-card{bottom:86px}.auth-page{align-items:flex-start;padding:18px 12px}.auth-card{border-radius:26px;margin-top:28px}.preview-paper{padding:14px!important}
}
@media print{body{padding-bottom:0!important}.document-header-block{min-height:58px}.header-logo-small .header-block-image{max-height:42px}.header-logo-medium .header-block-image{max-height:64px}.header-logo-large .header-block-image{max-height:78px}.official-meta{min-height:58px}.sticky-save-card{display:none!important}.official-top{grid-template-columns:1fr 1.1fr 1fr!important}.official-entity.document-header-block{align-items:flex-start!important;text-align:right!important}.official-logo.document-header-block{align-items:center!important;text-align:center!important}.official-meta{text-align:left!important;align-items:flex-end!important}.official-table-wrap{overflow:visible!important}.official-table{min-width:0!important}}
/* تصحيح ظهور نص الوسط بعد تحويله إلى كتلة مرنة */
.official-logo .header-block-text strong,.official-logo .header-block-text span{display:block!important}
.official-logo .header-block-image-wrap{display:block!important}

/* v1.3.9 - تحسين توافق كتلة الجهة اليمنى عند رفع صورة مع النص */
.official-entity.document-header-block{
  width:100%;
  max-width:245px;
  min-width:0;
  overflow:visible;
}
.official-entity.document-header-block .header-block-text{
  min-width:0;
  max-width:100%;
  overflow-wrap:anywhere;
  word-break:normal;
}
.official-entity.document-header-block .header-block-image-wrap{
  flex:0 0 auto;
  display:flex;
  align-items:center;
  justify-content:center;
  max-width:86px;
}
.official-entity.document-header-block .header-block-image{
  width:auto;
  height:auto;
  max-width:78px;
  max-height:62px;
}
.official-entity.document-header-block.header-mode-both.header-layout-side{
  flex-direction:row;
  gap:10px;
  align-items:center;
  direction:rtl;
}
.official-entity.document-header-block.header-mode-both.header-layout-side .header-block-text{
  flex:1 1 auto;
}
.official-entity.document-header-block.header-layout-top,
.official-entity.document-header-block.header-layout-bottom{
  gap:5px;
}
.official-entity.document-header-block.header-align-right{
  align-items:flex-start!important;
  text-align:right!important;
}
.official-entity.document-header-block.header-align-center{
  align-items:center!important;
  text-align:center!important;
}
.official-entity.document-header-block.header-align-left{
  align-items:flex-end!important;
  text-align:left!important;
}
.official-entity.document-header-block.header-mode-both.header-layout-side.header-align-right{
  justify-content:flex-start;
}
.official-entity.document-header-block.header-mode-both.header-layout-side.header-align-center{
  justify-content:center;
}
.official-entity.document-header-block.header-mode-both.header-layout-side.header-align-left{
  justify-content:flex-end;
}
.official-entity.document-header-block.header-logo-small .header-block-image{max-width:56px;max-height:44px}
.official-entity.document-header-block.header-logo-medium .header-block-image{max-width:78px;max-height:62px}
.official-entity.document-header-block.header-logo-large .header-block-image{max-width:96px;max-height:74px}
@media (max-width:900px){
  .official-entity.document-header-block{max-width:100%;}
  .official-entity.document-header-block.header-mode-both.header-layout-side{flex-direction:column;gap:6px;}
  .official-entity.document-header-block .header-block-image{max-width:110px;max-height:70px;}
}
@media print{
  .official-entity.document-header-block{max-width:210px;}
  .official-entity.document-header-block.header-mode-both.header-layout-side{gap:8px;}
  .official-entity.document-header-block.header-logo-small .header-block-image{max-width:48px;max-height:38px}
  .official-entity.document-header-block.header-logo-medium .header-block-image{max-width:66px;max-height:52px}
  .official-entity.document-header-block.header-logo-large .header-block-image{max-width:82px;max-height:62px}
  .official-entity.document-header-block .header-block-text strong{font-size:14px;}
  .official-entity.document-header-block .header-block-text span{font-size:11px;}
}


/* v1.3.10 - تحكم يدوي في عرض وارتفاع صور الهيدر */
.document-header-block .header-block-image-wrap.manual-image-size{
  width:var(--manual-img-w,120px)!important;
  height:var(--manual-img-h,70px)!important;
  max-width:100%!important;
  max-height:none!important;
  overflow:hidden;
  display:flex!important;
  align-items:center;
  justify-content:center;
  flex:0 0 auto;
}
.document-header-block .header-block-image-wrap.manual-image-size .header-block-image{
  width:100%!important;
  height:100%!important;
  max-width:100%!important;
  max-height:100%!important;
  object-fit:var(--manual-img-fit, contain)!important;
  object-position:var(--manual-img-pos, center center)!important;
  display:block!important;
}
.official-entity.document-header-block .header-block-image-wrap.manual-image-size,
.official-logo.document-header-block .header-block-image-wrap.manual-image-size{
  max-width:100%!important;
}
@media (max-width:900px){
  .document-header-block .header-block-image-wrap.manual-image-size{
    max-width:min(100%, 220px)!important;
  }
}
@media print{
  .document-header-block .header-block-image-wrap.manual-image-size{
    max-width:100%!important;
    break-inside:avoid;
  }
}


/* v1.3.11 - تحسين ضبط صور الهيدر: احتواء/قص/تمديد وموضع الصورة */
.document-header-block .header-block-image-wrap.manual-image-size{
  background:transparent!important;
}
.document-header-block.header-mode-image .header-block-text{
  display:none!important;
}
.settings-preview img{
  object-fit:contain;
  max-width:180px;
  max-height:110px;
}
@media (max-width:900px){
  .settings-preview img{max-width:150px;max-height:90px;}
}

/* v1.3.12 - تبسيط الهيدر: صورة فقط أو صورة + مربع نص */
.document-header-block.header-mode-image_box{
  gap:8px;
}
.document-header-block.header-mode-image .header-text-box{
  display:none!important;
}
.document-header-block.header-layout-side{
  flex-direction:row;
  align-items:center;
}
.document-header-block.header-layout-bottom{
  flex-direction:column;
  align-items:center;
}
.document-header-block.header-layout-bottom .header-block-image-wrap{order:1!important;}
.document-header-block.header-layout-bottom .header-text-box{order:2!important;}
.document-header-block .header-text-box{
  width:var(--header-text-box-w,220px);
  max-width:100%;
  min-height:44px;
  padding:8px 10px;
  border:1px solid rgba(19,160,133,.22);
  border-radius:12px;
  background:rgba(255,255,255,.78);
  color:#0f766e;
  font-size:var(--header-text-box-font,13px);
  font-weight:800;
  line-height:1.75;
  white-space:pre-line;
  overflow-wrap:anywhere;
}
.document-header-block.header-align-right .header-text-box{text-align:right;}
.document-header-block.header-align-center .header-text-box{text-align:center;}
.document-header-block.header-align-left .header-text-box{text-align:left;}
.official-entity.document-header-block{max-width:320px;}
.official-logo.document-header-block .header-text-box{
  color:#168d7c;
  font-weight:900;
}
@media (max-width:900px){
  .document-header-block.header-layout-side{flex-direction:column;}
  .document-header-block .header-text-box{width:min(100%, var(--header-text-box-w,220px));}
  .official-entity.document-header-block,.official-logo.document-header-block{max-width:100%;}
}
@media print{
  .document-header-block.header-layout-side{gap:8px;}
  .document-header-block .header-text-box{
    padding:5px 7px;
    border-color:rgba(19,160,133,.18);
    background:#fff;
    line-height:1.55;
  }
  .official-entity.document-header-block{max-width:260px;}
}


/* v1.3.13 - خطوة يمين الهيدر: نص فقط / صورة فقط / نص + صورة */
.document-header-block.header-mode-text .header-block-image-wrap{
  display:none!important;
}
.document-header-block.header-mode-text{
  gap:0;
}
.official-entity.document-header-block.header-mode-text{
  justify-content:flex-start;
}
.official-entity.document-header-block.header-mode-text .header-text-box{
  width:var(--header-text-box-w,220px);
}

/* v1.3.14 - تحسين وضع النص فقط في يمين الهيدر
   الهدف: عند اختيار "نص فقط" لا يظهر النص كعمود ضيق، بل ككتلة رسمية واسعة بدون تكسير غير مناسب. */
.official-entity.document-header-block.header-mode-text{
  max-width:340px!important;
  min-width:230px;
}
.official-entity.document-header-block.header-mode-text .header-text-box{
  width:clamp(230px, var(--header-text-box-w,260px), 330px)!important;
  min-width:230px;
  max-width:100%!important;
  border:0!important;
  background:transparent!important;
  padding:0!important;
  border-radius:0!important;
  min-height:0!important;
  line-height:1.75!important;
  white-space:pre-line!important;
  overflow-wrap:normal!important;
  word-break:normal!important;
}
@media (max-width:900px){
  .official-entity.document-header-block.header-mode-text{
    min-width:0;
    width:100%;
    max-width:100%!important;
    align-items:center!important;
    text-align:center!important;
  }
  .official-entity.document-header-block.header-mode-text .header-text-box{
    width:min(100%, 330px)!important;
    min-width:0;
    text-align:center!important;
  }
}
@media print{
  .official-entity.document-header-block.header-mode-text{
    max-width:260px!important;
    min-width:210px;
  }
  .official-entity.document-header-block.header-mode-text .header-text-box{
    width:clamp(210px, var(--header-text-box-w,240px), 255px)!important;
    min-width:210px;
    line-height:1.55!important;
  }
}

/* v1.3.15 - إعادة تنظيم صفحة إعدادات الخطاب وتحسين فراغات الهيدر */
.letter-settings-page{max-width:1500px;margin:0 auto}
.letter-settings-layout{display:grid;grid-template-columns:minmax(0,1fr) 430px;gap:18px;align-items:start}
.letter-settings-main{min-width:0}.letter-preview-panel{min-width:0;order:-1}.preview-sticky-card{position:sticky;top:18px;max-height:calc(100dvh - 32px);overflow:auto}.preview-head{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:6px}.preview-head h2{margin:0;font-size:18px}.settings-hero{display:flex;align-items:flex-start;justify-content:space-between;gap:16px;background:linear-gradient(135deg,#fff,#f8fffd);border-color:#cdeee4}.settings-hero h2{margin:0 0 6px;color:#0f766e}.settings-hero .btn{white-space:nowrap}.settings-panel{background:#fff;border:1px solid var(--border);border-radius:22px;margin-bottom:14px;box-shadow:0 8px 22px rgba(15,23,42,.04);overflow:hidden}.settings-panel summary{list-style:none;cursor:pointer;padding:16px 18px;font-weight:900;color:#0f766e;display:flex;align-items:center;gap:10px;background:linear-gradient(180deg,#ffffff,#f8fbfd);border-bottom:1px solid transparent}.settings-panel summary::-webkit-details-marker{display:none}.settings-panel[open] summary{border-bottom-color:var(--border)}.settings-panel summary span{width:30px;height:30px;border-radius:12px;display:inline-grid;place-items:center;background:#e6f7f2;color:#0f766e;font-weight:900}.settings-panel-body{padding:16px 18px 18px}.settings-help{border:1px solid #bdebdc;background:#f0fdfa;color:#0f766e;border-radius:16px;padding:11px 13px;margin-bottom:14px;font-weight:700;line-height:1.8}.clean-grid{grid-template-columns:repeat(3,minmax(0,1fr));gap:14px}.compact-grid{grid-template-columns:repeat(3,minmax(0,1fr))}.upload-field{border:1px dashed #cbd5e1;border-radius:18px;padding:12px;background:#fbfdff}.final-save-card{border-style:dashed;background:#f8fafc}.placeholder-guide{margin-top:14px;display:flex;gap:8px;align-items:center;flex-wrap:wrap;background:#f8fafc;border:1px solid var(--border);border-radius:16px;padding:12px}.placeholder-guide code{direction:ltr;background:#e0f2fe;color:#075985;border-radius:999px;padding:4px 8px;font-size:12px}.settings-preview{display:flex;margin-top:10px}.settings-preview img{border:1px solid #e2e8f0;border-radius:12px;background:#fff;padding:5px}

/* ورقة الخطاب: هيدر أنظف وفراغات أقل */
.official-document .official-top{grid-template-columns:1.08fr 1fr 1.08fr;gap:18px;align-items:start;margin-bottom:18px}.official-document .document-header-block{min-height:0;line-height:1.45}.official-document .header-text-box{border:0!important;background:transparent!important;padding:0!important;border-radius:0!important;min-height:0!important;box-shadow:none!important;color:#08746b;font-weight:900;line-height:1.5;white-space:normal;overflow-wrap:break-word}.official-document .header-text-line{display:block;margin:0 0 5px}.official-document .header-text-line:last-child{margin-bottom:0}.official-document .header-text-line-primary{font-weight:950}.official-document .official-entity.document-header-block{max-width:330px!important;min-width:0!important;width:100%;align-items:flex-start!important;text-align:right!important}.official-document .official-logo.document-header-block{max-width:100%;align-items:center!important;text-align:center!important;justify-content:flex-start}.official-document .official-logo .header-text-box{font-size:var(--header-text-box-font,15px);text-align:center}.official-document .official-meta{font-size:13px;line-height:1.85;gap:5px;align-items:flex-end;text-align:left;min-height:0}.official-document .official-main-title{margin:16px 0 14px}.official-document .manual-image-size{border:0!important;background:transparent!important}.official-document .header-layout-side{gap:10px}.official-document .header-layout-bottom{gap:7px}.preview-paper{transform-origin:top center}.preview-paper .official-top{gap:12px}.preview-paper .official-document,.preview-paper{font-size:12px}.preview-paper .official-main-title{font-size:15px}.preview-line{margin:5px 0;text-align:center;line-height:1.8}.preview-supervisor-name-box{border:1px solid #d7e8cf;border-radius:12px;text-align:center;padding:8px;margin:10px 0}.preview-supervisor-name-box span{display:block;color:#64748b;font-size:12px}.preview-supervisor-name-box strong{display:block;color:#111}.supervisor-under-name-img{display:block;margin:6px auto 0;max-width:90px;max-height:50px;object-fit:contain}.approval-sign-box{display:inline-flex;flex-direction:column;align-items:center;gap:6px;min-width:150px}.approval-line{display:block;width:150px;border-bottom:1px dotted #64748b;height:26px}.signature-img{max-width:150px;max-height:56px;object-fit:contain}.official-approval-align-right{text-align:right}.official-approval-align-center{text-align:center}.official-approval-align-left{text-align:left}

@media (max-width:1180px){.letter-settings-layout{grid-template-columns:1fr}.letter-preview-panel{order:2}.preview-sticky-card{position:relative;top:auto;max-height:none}.clean-grid{grid-template-columns:repeat(2,minmax(0,1fr))}}
@media (max-width:900px){.settings-hero{flex-direction:column}.settings-hero .btn{width:100%}.clean-grid,.compact-grid{grid-template-columns:1fr}.settings-panel summary{padding:14px}.settings-panel-body{padding:14px}.official-document .official-top{grid-template-columns:1fr!important;gap:12px;text-align:center}.official-document .official-entity.document-header-block,.official-document .official-logo.document-header-block,.official-document .official-meta{align-items:center!important;text-align:center!important;max-width:100%!important}.official-document .header-text-box{text-align:center!important}.official-document .official-meta{align-items:center!important;text-align:center!important}.official-document .header-layout-side{flex-direction:column}.preview-paper{padding:14px!important}}
@media print{.letter-preview-panel,.settings-hero,.settings-panel,.final-save-card{display:none!important}.official-document .official-top{grid-template-columns:1.08fr 1fr 1.08fr!important;gap:14px!important;margin-bottom:14px!important}.official-document .header-text-box{line-height:1.42!important}.official-document .header-text-line{margin-bottom:3px}.official-document .official-main-title{margin-top:12px!important}.official-document .official-meta{line-height:1.65!important}.official-document .official-entity.document-header-block{max-width:255px!important}.official-document .official-logo.document-header-block{max-width:230px!important}}

/* v1.3.16 - توسيط نص الجهة اليمنى وتحسين اللمسة البصرية للخطاب والإعدادات */
.official-document .official-entity.document-header-block{
  align-items:center!important;
  justify-content:flex-start!important;
  text-align:center!important;
  padding-top:2px;
}
.official-document .official-entity.document-header-block .header-text-box{
  text-align:center!important;
  width:min(100%, var(--header-text-box-w,280px))!important;
  margin-inline:auto!important;
  color:#08746b!important;
  line-height:1.58!important;
  letter-spacing:0!important;
}
.official-document .official-entity.document-header-block.header-mode-text .header-text-box{
  padding:7px 10px!important;
  border-radius:18px!important;
  background:linear-gradient(180deg,rgba(255,255,255,.92),rgba(247,253,251,.78))!important;
  border:1px solid rgba(19,160,133,.18)!important;
  box-shadow:0 8px 20px rgba(15,118,110,.045)!important;
  min-height:0!important;
}
.official-document .official-entity.document-header-block .header-text-line{
  margin:0 0 4px!important;
}
.official-document .official-entity.document-header-block .header-text-line:last-child{
  margin-bottom:0!important;
}
.official-document .official-entity.document-header-block .header-text-line-primary{
  font-size:1.03em;
  font-weight:950!important;
}
.official-document .official-top{
  align-items:start!important;
  gap:16px!important;
}
.official-document .official-meta{
  padding-top:4px;
}
.official-document .official-logo.document-header-block{
  padding-top:0;
}

/* تحسين شكل صفحة إعدادات الخطاب بدون تغيير طريقة العمل */
.letter-settings-page{
  background:
    radial-gradient(circle at 100% 0%, rgba(20,184,166,.10), transparent 28%),
    radial-gradient(circle at 0% 12%, rgba(14,165,233,.08), transparent 24%);
  border-radius:28px;
  padding:4px;
}
.letter-settings-page .card,
.letter-settings-page .settings-panel,
.letter-settings-page .preview-sticky-card{
  box-shadow:0 16px 40px rgba(15,23,42,.06);
}
.settings-hero{
  border-radius:26px!important;
  background:
    linear-gradient(135deg,rgba(255,255,255,.96),rgba(240,253,250,.90)),
    radial-gradient(circle at 15% 25%, rgba(20,184,166,.14), transparent 34%)!important;
  position:relative;
  overflow:hidden;
}
.settings-hero:before{
  content:"";
  position:absolute;
  inset:auto -60px -80px auto;
  width:190px;
  height:190px;
  border-radius:999px;
  background:rgba(20,184,166,.08);
  pointer-events:none;
}
.settings-hero h2{
  font-size:24px;
  font-weight:950;
}
.settings-hero p{
  line-height:1.8;
  max-width:760px;
}
.settings-panel{
  border-radius:24px!important;
}
.settings-panel summary{
  background:linear-gradient(135deg,#ffffff,#f7fffc)!important;
  font-size:16px;
}
.settings-panel summary span{
  box-shadow:0 8px 18px rgba(15,118,110,.10);
}
.settings-panel[open] summary{
  color:#065f59;
}
.settings-panel-body{
  background:linear-gradient(180deg,#fff,#fbfefd);
}
.settings-help{
  background:linear-gradient(135deg,#ecfdf5,#f0fdfa)!important;
  border-color:#a7f3d0!important;
}
.letter-settings-page input,
.letter-settings-page select,
.letter-settings-page textarea{
  border-radius:16px;
  transition:border-color .18s ease, box-shadow .18s ease, background .18s ease;
}
.letter-settings-page input:focus,
.letter-settings-page select:focus,
.letter-settings-page textarea:focus{
  outline:none;
  border-color:#14b8a6;
  box-shadow:0 0 0 4px rgba(20,184,166,.12);
}
.upload-field{
  background:linear-gradient(180deg,#fff,#fbfdff)!important;
}
.preview-sticky-card{
  border-radius:26px!important;
  border-color:#dbeafe!important;
  background:linear-gradient(180deg,#fff,#fbfdff)!important;
}
.preview-head{
  padding-bottom:8px;
  border-bottom:1px solid #eef2f7;
}
.preview-head h2{
  color:#0f766e;
  font-weight:950;
}

@media (max-width:900px){
  .letter-settings-page{padding:0;background:transparent;}
  .official-document .official-entity.document-header-block .header-text-box{
    width:min(100%, 340px)!important;
    line-height:1.55!important;
  }
  .official-document .official-entity.document-header-block.header-mode-text .header-text-box{
    padding:8px 10px!important;
  }
}
@media print{
  .official-document .official-entity.document-header-block .header-text-box{
    width:min(100%, var(--header-text-box-w,240px))!important;
    line-height:1.38!important;
    box-shadow:none!important;
  }
  .official-document .official-entity.document-header-block.header-mode-text .header-text-box{
    padding:4px 7px!important;
    border-color:rgba(19,160,133,.16)!important;
    background:#fff!important;
  }
}

/* v1.3.17 - ترتيب إعدادات الخطاب RTL: التعبئة يمين والمعاينة يسار */
@media (min-width:1181px){
  .letter-settings-layout{
    direction:ltr;
    grid-template-columns:430px minmax(0,1fr)!important;
    grid-template-areas:"preview form";
    gap:22px!important;
  }
  .letter-settings-main{
    direction:rtl;
    grid-area:form;
    grid-column:auto!important;
    order:initial!important;
  }
  .letter-preview-panel{
    direction:rtl;
    grid-area:preview;
    grid-column:auto!important;
    order:initial!important;
  }
  .preview-sticky-card{
    top:22px;
  }
}
@media (max-width:1180px){
  .letter-settings-layout{
    display:flex!important;
    flex-direction:column!important;
    direction:rtl;
  }
  .letter-settings-main{
    order:1!important;
  }
  .letter-preview-panel{
    order:2!important;
  }
}

/* v1.3.18 - تقسيم صفحة إعدادات الخطاب بالتساوي وتصغير المعاينة */
@media (min-width:1181px){
  .letter-settings-layout{
    direction:ltr;
    grid-template-columns:minmax(0,1fr) minmax(0,1fr)!important;
    grid-template-areas:"preview form"!important;
    gap:22px!important;
    align-items:start!important;
  }
  .letter-settings-main{
    direction:rtl;
    grid-area:form!important;
    min-width:0!important;
  }
  .letter-preview-panel{
    direction:rtl;
    grid-area:preview!important;
    min-width:0!important;
  }
  .preview-sticky-card{
    top:22px!important;
    max-height:calc(100dvh - 44px)!important;
    overflow:auto!important;
  }
  .letter-preview-panel .mini-document-preview{
    max-width:390px!important;
    margin-inline:auto!important;
    padding:14px!important;
    zoom:.82;
  }
  .letter-preview-panel .preview-head h2{
    font-size:17px!important;
  }
  .letter-preview-panel .muted.small{
    font-size:12px!important;
    line-height:1.7!important;
  }
  .letter-preview-panel .official-document{
    border-radius:20px!important;
  }
  .letter-preview-panel .official-document:before{
    border-radius:16px!important;
  }
}
@supports not (zoom:1){
  @media (min-width:1181px){
    .letter-preview-panel .mini-document-preview{
      transform:scale(.82);
      transform-origin:top center;
      margin-bottom:-18%;
    }
  }
}
@media (max-width:1180px){
  .letter-preview-panel .mini-document-preview{
    max-width:460px!important;
    margin-inline:auto!important;
  }
}

/* v1.3.19 - إصلاح معاينة الخطاب: تصغير بالمقياس مع الحفاظ على عرض الورقة الحقيقي
   الهدف: لا يتم تضييق الورقة إلى 390px؛ بل تُرسم بعرض قريب من A4 ثم تُصغّر بصريًا لتظهر مثل الناتج النهائي. */
@media (min-width:1181px){
  .letter-preview-panel .preview-sticky-card{
    overflow:auto!important;
  }
  .letter-preview-panel .mini-document-preview.preview-paper{
    width:760px!important;
    max-width:none!important;
    margin-inline:auto!important;
    padding:20px 22px!important;
    zoom:.72!important;
  }
  .letter-preview-panel .mini-document-preview.preview-paper .official-top{
    display:grid!important;
    grid-template-columns:1.08fr 1fr 1.08fr!important;
    gap:18px!important;
    align-items:start!important;
  }
  .letter-preview-panel .mini-document-preview.preview-paper .official-entity.document-header-block{
    max-width:100%!important;
    width:100%!important;
  }
  .letter-preview-panel .mini-document-preview.preview-paper .official-logo.document-header-block{
    max-width:100%!important;
    width:100%!important;
  }
  .letter-preview-panel .mini-document-preview.preview-paper .official-meta{
    max-width:100%!important;
    width:100%!important;
    align-items:flex-end!important;
    text-align:left!important;
  }
}
@supports not (zoom:1){
  @media (min-width:1181px){
    .letter-preview-panel .mini-document-preview.preview-paper{
      transform:scale(.72)!important;
      transform-origin:top center!important;
      margin-bottom:-28%!important;
    }
  }
}
@media (max-width:1180px){
  .letter-preview-panel .mini-document-preview.preview-paper{
    width:100%!important;
    max-width:760px!important;
    zoom:1!important;
  }
}
@media (max-width:700px){
  .letter-preview-panel .mini-document-preview.preview-paper{
    max-width:100%!important;
    padding:14px!important;
  }
}

/* v1.3.20 - مربعات نص ذكية لنصوص الخطاب */
.letter-text-grid{
  gap:18px!important;
}
.smart-field textarea.smart-textarea{
  width:100%;
  min-height:92px;
  resize:vertical;
  direction:rtl;
  unicode-bidi:plaintext;
  line-height:1.9;
  font-size:15px;
  border-radius:18px;
  background:#fff;
  border:1px solid rgba(15,118,110,.22);
  box-shadow:0 0 0 3px rgba(45,212,191,.04);
}
.smart-field textarea.smart-textarea:focus{
  border-color:rgba(20,184,166,.70);
  box-shadow:0 0 0 4px rgba(20,184,166,.10);
  outline:none;
}
.smart-field textarea.smart-textarea.single-line{
  min-height:58px;
  overflow:hidden;
}
.text-style-box{
  grid-column:1 / -1;
  border:1px solid rgba(15,118,110,.12);
  background:linear-gradient(135deg, rgba(240,253,250,.82), rgba(255,255,255,.92));
  border-radius:18px;
  padding:12px;
  margin-top:-8px;
}
.text-style-title{
  font-weight:800;
  color:#0f766e;
  font-size:13px;
  margin-bottom:10px;
}
.text-style-grid{
  display:grid;
  grid-template-columns:repeat(4,minmax(0,1fr));
  gap:10px;
}
.text-style-grid label{
  margin:0!important;
  font-size:12px;
  color:#334155;
}
.text-style-grid select,
.text-style-grid input{
  min-height:42px!important;
  border-radius:14px!important;
  font-size:13px!important;
}
.smart-token-guide{
  display:flex;
  align-items:center;
  flex-wrap:wrap;
  gap:8px;
}
.smart-token-guide strong{
  margin-inline-end:4px;
  white-space:nowrap;
}
.tokens-hint{
  color:#64748b;
  font-size:13px;
  margin-inline-end:6px;
}
.smart-token-guide code,
.smart-token-guide .token-code{
  direction:ltr;
  unicode-bidi:isolate;
}
.token-btn{
  border:1px solid rgba(37,99,235,.20);
  background:linear-gradient(180deg,#f8fbff,#e0f2fe);
  color:#075985;
  border-radius:18px;
  padding:8px 12px;
  font-weight:800;
  cursor:pointer;
  line-height:1.25;
  transition:.15s ease;
  display:inline-flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  gap:3px;
  min-width:96px;
  min-height:48px;
  direction:rtl;
}
.token-label{
  font-size:13px;
  color:#0f766e;
  white-space:nowrap;
}
.token-code{
  font-size:10px;
  color:#0369a1;
  opacity:.72;
  letter-spacing:.1px;
  white-space:nowrap;
}
.token-btn:hover{
  transform:translateY(-1px);
  box-shadow:0 8px 18px rgba(37,99,235,.12);
  border-color:rgba(20,184,166,.36);
}
.token-btn:active{
  transform:translateY(0);
}
.official-letter p,
.preview-line,
.official-closing{
  white-space:normal;
}
@media (max-width:900px){
  .text-style-grid{
    grid-template-columns:repeat(2,minmax(0,1fr));
  }
}
@media (max-width:560px){
  .text-style-grid{
    grid-template-columns:1fr;
  }
  .smart-token-guide{
    gap:6px;
  }
  .token-btn{
    padding:8px 10px;
    font-size:12px;
  }
}

/* v1.3.22 - تثبيت بطاقة بيانات المشرف أفقيًا عند الطباعة
   المشكلة: بعض قواعد الجوال كانت تجعل بطاقة بيانات المشرف تظهر عمودية داخل نافذة الطباعة.
   الحل: إجبار الطباعة على شكل PDF الرسمي بأعمدة أفقية مهما كان عرض الشاشة قبل الطباعة. */
@media print{
  .official-document{
    width:100%!important;
    max-width:none!important;
    overflow:visible!important;
  }
  .official-summary{
    display:grid!important;
    grid-template-columns:repeat(5,minmax(0,1fr))!important;
    width:100%!important;
    border:1px solid #b7d8c8!important;
    border-radius:14px!important;
    overflow:hidden!important;
    page-break-inside:avoid!important;
    break-inside:avoid!important;
  }
  .official-summary div{
    display:block!important;
    padding:7px 8px!important;
    background:#fbfffb!important;
    border-left:1px solid #d8eadc!important;
    border-bottom:0!important;
    text-align:right!important;
    min-width:0!important;
  }
  .official-summary div:last-child{
    border-left:0!important;
  }
  .official-summary span{
    display:block!important;
    font-size:11px!important;
    line-height:1.35!important;
    margin-bottom:2px!important;
  }
  .official-summary strong{
    display:block!important;
    font-size:13px!important;
    line-height:1.35!important;
    white-space:normal!important;
    word-break:break-word!important;
  }
}

/* v1.3.23 - إخفاء ترويسة/تذييل المتصفح عند الطباعة
   ملاحظة: بعض المتصفحات تضيف التاريخ والرابط من إعدادات الطباعة نفسها.
   جعل هامش الصفحة صفرًا غالبًا يمنع ظهورها، مع إبقاء هامش داخلي للمستند. */
@media print{
  @page{
    size:A4 portrait;
    margin:0!important;
  }
  html,body{
    margin:0!important;
    padding:0!important;
    width:210mm!important;
    min-height:297mm!important;
    background:#fff!important;
  }
  body{
    -webkit-print-color-adjust:exact!important;
    print-color-adjust:exact!important;
  }
  .content{
    padding:7mm!important;
    margin:0!important;
    width:auto!important;
  }
  .official-card,
  .card.official-card,
  .card:has(.official-document){
    padding:0!important;
    margin:0!important;
    border:0!important;
    box-shadow:none!important;
    background:#fff!important;
  }
  .official-document{
    box-sizing:border-box!important;
    width:100%!important;
    min-height:calc(297mm - 14mm)!important;
    margin:0 auto!important;
  }
}

/* v1.3.24 - مراجعة توافق الكمبيوتر + تجربة جوال قريبة من التطبيق */
html{
  scroll-behavior:smooth;
  -webkit-text-size-adjust:100%;
}
body{
  overflow-x:hidden;
}
button,.btn,a,input,select,textarea{
  touch-action:manipulation;
}
.btn:active,.nav-link:active,.token-btn:active{
  transform:scale(.985);
}
.app{
  grid-template-columns:280px minmax(0,1fr);
}
.content{
  width:100%;
  max-width:1480px;
  margin-inline:auto;
}
.sidebar{
  border-inline-start:1px solid rgba(255,255,255,.08);
}
.sidebar .nav a,
.sidebar .nav-link{
  display:flex;
  align-items:center;
  gap:10px;
  line-height:1.35;
}
.nav-icon{
  width:28px;
  height:28px;
  flex:0 0 28px;
  display:inline-grid;
  place-items:center;
  border-radius:11px;
  background:rgba(255,255,255,.08);
  color:#b8f7ff;
  font-size:15px;
  font-weight:900;
}
.nav-label{
  min-width:0;
  overflow:hidden;
  text-overflow:ellipsis;
}
.sidebar .nav a.active .nav-icon,
.sidebar .nav-link.active .nav-icon{
  background:rgba(255,255,255,.18);
  color:#fff;
}
.nav-logout{
  margin-top:8px;
  color:#fee2e2!important;
}
.app-topbar{
  min-height:72px;
  padding:14px 18px;
  background:rgba(255,255,255,.78);
  border:1px solid rgba(226,232,240,.88);
  border-radius:24px;
  box-shadow:0 14px 34px rgba(15,23,42,.055);
  backdrop-filter:blur(14px);
}
.topbar-title h1{
  margin:0 0 4px;
  color:#0f766e;
  letter-spacing:-.4px;
}
.topbar-actions{
  display:flex;
  gap:8px;
  align-items:center;
  flex-wrap:wrap;
}
.card{
  scroll-margin-top:96px;
}
.card > h2:first-child,
.card > h3:first-child{
  color:#0f766e;
}
.form-grid.clean-grid,
.form-grid.letter-text-grid,
.form-grid.compact-grid{
  align-items:start;
}
.table-wrap{
  max-width:100%;
}
.resp-cell .actions,
td .actions{
  justify-content:flex-start;
}
select[multiple]{
  min-height:160px;
  line-height:1.7;
}
.today-card{
  box-shadow:0 16px 34px rgba(3,105,161,.08);
}
.auth-card{
  box-shadow:0 24px 60px rgba(15,23,42,.10);
}
@media (min-width:901px){
  .sidebar{
    width:280px;
  }
  .content{
    padding:28px;
  }
  .app-body-member .content{
    max-width:1180px;
  }
  .app-body-admin .content{
    max-width:1500px;
  }
  .card .actions:not(.topbar-actions){
    align-items:center;
  }
  .settings-layout.equal-settings-layout{
    grid-template-columns:minmax(0,1fr) minmax(0,1fr)!important;
    align-items:start;
  }
}
@media (max-width:900px){
  :root{
    --radius:22px;
  }
  body{
    min-height:100dvh;
    padding-bottom:calc(82px + env(safe-area-inset-bottom));
    background:linear-gradient(180deg,#f6fbff 0%,#eef6f4 100%);
  }
  .app{
    display:block;
  }
  .content{
    padding:12px 12px calc(24px + env(safe-area-inset-bottom));
  }
  .app-topbar{
    position:sticky;
    top:0;
    z-index:70;
    margin:-12px -12px 14px;
    border-radius:0 0 24px 24px;
    border-top:0;
    border-inline:0;
    min-height:64px;
    padding:calc(10px + env(safe-area-inset-top)) 12px 10px;
    background:rgba(255,255,255,.88);
  }
  .topbar-title h1{
    font-size:20px;
    line-height:1.25;
  }
  .topbar-actions{
    gap:6px;
  }
  .topbar-actions .btn{
    min-height:38px;
    padding:8px 10px;
    border-radius:14px;
    font-size:12px;
  }
  .sidebar{
    position:fixed!important;
    right:10px;
    left:10px;
    bottom:calc(8px + env(safe-area-inset-bottom));
    top:auto!important;
    height:auto!important;
    z-index:1000;
    padding:8px;
    border-radius:26px;
    background:rgba(15,38,51,.96);
    border:1px solid rgba(255,255,255,.10);
    box-shadow:0 18px 44px rgba(15,23,42,.26);
    backdrop-filter:blur(18px);
    overflow:hidden;
  }
  .sidebar .brand{
    display:none!important;
  }
  .sidebar .nav{
    display:grid;
    grid-auto-flow:column;
    grid-auto-columns:minmax(74px,1fr);
    gap:7px;
    overflow-x:auto;
    overscroll-behavior-x:contain;
    scroll-snap-type:x proximity;
    scrollbar-width:none;
    padding-bottom:0;
  }
  .sidebar .nav::-webkit-scrollbar{
    display:none;
  }
  .sidebar .nav a,
  .sidebar .nav-link{
    min-height:58px;
    padding:7px 8px;
    border-radius:19px;
    flex-direction:column;
    justify-content:center;
    align-items:center;
    text-align:center;
    gap:4px;
    white-space:nowrap;
    scroll-snap-align:center;
    color:#dff5ff;
  }
  .sidebar .nav a:hover,
  .sidebar .nav a.active,
  .sidebar .nav-link:hover,
  .sidebar .nav-link.active{
    background:linear-gradient(135deg,#0f766e,#0ea5a4);
    color:#fff;
  }
  .nav-icon{
    width:26px;
    height:24px;
    flex-basis:24px;
    border-radius:10px;
    font-size:14px;
    background:rgba(255,255,255,.10);
  }
  .nav-label{
    font-size:11px;
    max-width:86px;
  }
  .nav-logout{
    margin-top:0;
  }
  .card,.today-card,.auth-card{
    border-radius:24px;
    box-shadow:0 14px 38px rgba(15,23,42,.075);
  }
  .card{
    padding:16px;
    margin-bottom:14px;
  }
  .card > h2:first-child,
  .card > h3:first-child{
    font-size:18px;
    margin-bottom:10px;
  }
  .stats{
    grid-template-columns:repeat(2,minmax(0,1fr))!important;
    gap:10px;
  }
  .stat{
    border-radius:22px;
    padding:14px;
  }
  .stat b{
    font-size:24px;
  }
  .form-grid,.form-grid.clean-grid,.form-grid.letter-text-grid,.form-grid.compact-grid,.grid-2,.grid-3{
    grid-template-columns:1fr!important;
    gap:12px;
  }
  label{
    font-size:14px;
  }
  input,select,textarea,
  .form-grid input,.form-grid select,.form-grid textarea,.stack input,.stack select,.stack textarea{
    min-height:50px;
    border-radius:18px;
    padding:13px 14px;
    font-size:16px;
  }
  textarea{
    min-height:104px;
  }
  select[multiple]{
    min-height:190px;
  }
  .btn{
    min-height:48px;
    border-radius:18px;
    font-size:14px;
    padding:11px 14px;
  }
  .btn-sm{
    min-height:40px;
    border-radius:14px;
    font-size:12px;
  }
  .actions{
    display:grid;
    grid-template-columns:1fr;
    gap:9px;
    width:100%;
  }
  .actions .btn,
  .actions form,
  .actions form .btn{
    width:100%;
  }
  .table-wrap{
    overflow:visible!important;
    border:0!important;
    background:transparent!important;
  }
  table.responsive{
    min-width:0!important;
  }
  table.responsive thead{
    display:none!important;
  }
  table.responsive tbody,
  table.responsive tr.resp-row,
  table.responsive td.resp-cell{
    display:block!important;
    width:100%!important;
  }
  table.responsive tr.resp-row{
    margin-bottom:12px;
    border:1px solid var(--border);
    border-radius:22px;
    overflow:hidden;
    background:#fff;
    box-shadow:0 10px 26px rgba(15,23,42,.055);
  }
  table.responsive td.resp-cell{
    padding:12px 14px;
    border-bottom:1px solid #eef2f7;
  }
  table.responsive td.resp-cell:last-child{
    border-bottom:0;
  }
  table.responsive td.resp-cell:before{
    content:attr(data-label);
    display:block;
    color:#64748b;
    font-size:12px;
    font-weight:800;
    margin-bottom:4px;
  }
  .visit-card{
    grid-template-columns:1fr!important;
    border-radius:24px;
    background:linear-gradient(180deg,#fff,#fbfffd);
  }
  .visit-card .day-title{
    padding:8px 10px;
    border-radius:16px;
    background:#ecfdf5;
  }
  .official-card{
    padding:10px!important;
  }
  .official-document{
    max-width:100%!important;
    border-radius:24px!important;
  }
  .official-summary{
    grid-template-columns:1fr!important;
  }
  .official-summary div{
    border-left:0!important;
    border-bottom:1px solid #d8eadc!important;
    text-align:center!important;
  }
  .official-summary div:last-child{
    border-bottom:0!important;
  }
  .official-table-wrap{
    overflow-x:auto!important;
    -webkit-overflow-scrolling:touch;
  }
  .official-table{
    min-width:640px!important;
  }
  .preview-sticky-card{
    position:relative!important;
    top:auto!important;
  }
  .settings-layout,
  .settings-layout.equal-settings-layout{
    display:flex!important;
    flex-direction:column!important;
  }
  .settings-form-col{
    order:1;
  }
  .settings-preview-col{
    order:2;
  }
  .sticky-save-card,.final-save-card{
    position:sticky!important;
    bottom:calc(84px + env(safe-area-inset-bottom))!important;
    z-index:900;
    border-radius:24px;
    box-shadow:0 14px 36px rgba(15,23,42,.16);
  }
  .auth-page{
    align-items:flex-start;
    padding:16px 12px;
  }
  .auth-card{
    margin-top:calc(14px + env(safe-area-inset-top));
    width:100%!important;
  }
}
@media (max-width:430px){
  .stats{
    grid-template-columns:1fr!important;
  }
  .topbar-actions{
    display:none;
  }
  .sidebar .nav{
    grid-auto-columns:minmax(68px,1fr);
  }
  .nav-label{
    font-size:10.5px;
    max-width:74px;
  }
}
@media print{
  .app-topbar,
  .sidebar,
  .topbar-actions{
    display:none!important;
  }
  body{
    padding-bottom:0!important;
  }
  .content{
    max-width:none!important;
  }
}

/* v1.3.26 - Import template and Excel/CSV UI */
.template-actions{
  display:flex;
  flex-wrap:wrap;
  gap:10px;
  margin:14px 0 18px;
}
.import-form input[type="file"]{
  padding:12px;
  background:#fff;
}
.import-card-main .alert-info{
  background:#ecfeff;
  border-color:#bae6fd;
  color:#075985;
}
@media (max-width:900px){
  .template-actions{display:grid;grid-template-columns:1fr;}
  .template-actions .btn{width:100%;}
}

/* v1.3.30 - تحسين صفحة المدارس: تصغير النموذج ومنع شريط التمرير الأفقي غير الضروري */
@media (min-width:901px){
  .schools-admin-layout{
    grid-template-columns:minmax(330px,400px) minmax(0,1fr)!important;
    align-items:start;
  }
  .school-form-card{
    position:sticky;
    top:24px;
  }
  .school-form-compact{
    grid-template-columns:1fr 1fr!important;
    gap:12px!important;
  }
  .school-form-compact label{
    gap:6px!important;
    font-size:14px!important;
  }
  .school-form-compact input,
  .school-form-compact select{
    min-height:42px!important;
    padding:9px 11px!important;
    border-radius:13px!important;
    font-size:14px!important;
  }
  .school-save-btn{
    width:100%;
    min-height:44px!important;
  }
  table.school-table{
    min-width:560px!important;
    table-layout:auto;
  }
  .school-table th,
  .school-table td{
    padding:10px 11px!important;
  }
  .school-table th:last-child,
  .school-table td:last-child{
    width:150px;
  }
  .school-table .actions{
    display:flex!important;
    flex-wrap:nowrap!important;
    gap:6px!important;
  }
  .school-table .actions .btn,
  .school-table .actions form,
  .school-table .actions form .btn{
    width:auto!important;
    white-space:nowrap;
  }
}
@media (max-width:1100px) and (min-width:901px){
  .schools-admin-layout{
    grid-template-columns:minmax(300px,360px) minmax(0,1fr)!important;
  }
  table.school-table{
    min-width:500px!important;
  }
}
@media (max-width:900px){
  .school-form-card{
    padding:14px!important;
  }
  .school-form-card h2{
    font-size:20px!important;
    margin-bottom:12px!important;
  }
  .school-form-compact{
    gap:10px!important;
  }
  .school-form-compact input,
  .school-form-compact select{
    min-height:44px!important;
    padding:10px 12px!important;
    border-radius:15px!important;
  }
  .school-save-btn{
    width:100%;
  }
  table.school-table{
    min-width:0!important;
  }
  .school-table .actions{
    grid-template-columns:1fr 1fr!important;
  }
  .school-table .actions form{
    width:100%;
  }
}
@media (max-width:430px){
  .school-table .actions{
    grid-template-columns:1fr!important;
  }
}

/* v1.3.31 - صفحة المدارس: نموذج كامل بالأعلى والجدول بعرض كامل بالأسفل
   إلغاء التقسيم الجانبي لأنه يسبب فراغًا كبيرًا وضغطًا في جدول المدارس. */
@media (min-width:901px){
  .schools-admin-layout{
    grid-template-columns:1fr!important;
    gap:18px!important;
    align-items:start!important;
  }
  .school-form-card{
    position:relative!important;
    top:auto!important;
    max-width:none!important;
    width:100%!important;
  }
  .school-form-card h2{
    margin-bottom:14px!important;
  }
  .school-form-compact{
    grid-template-columns:repeat(3,minmax(0,1fr))!important;
    gap:12px 14px!important;
    align-items:end!important;
  }
  .school-form-compact .full{
    grid-column:1 / -1!important;
  }
  .school-save-btn{
    max-width:260px!important;
    width:100%!important;
  }
  .schools-admin-layout > .card:nth-child(2){
    width:100%!important;
    min-width:0!important;
  }
  .schools-admin-layout .table-wrap{
    overflow-x:auto!important;
    max-width:100%!important;
  }
  table.school-table{
    width:100%!important;
    min-width:0!important;
    table-layout:auto!important;
  }
  .school-table th,
  .school-table td{
    white-space:normal!important;
  }
  .school-table th:last-child,
  .school-table td:last-child{
    width:170px!important;
  }
}
@media (min-width:901px) and (max-width:1150px){
  .school-form-compact{
    grid-template-columns:repeat(2,minmax(0,1fr))!important;
  }
}


/* v1.3.32 - توحيد صفحات الإدارة: النموذج في اليمين والقائمة في اليسار مثل صفحة المدارس */
@media (min-width:901px){
  .admin-split-layout{
    display:grid!important;
    grid-template-columns:minmax(330px,420px) minmax(0,1fr)!important;
    gap:20px!important;
    align-items:start!important;
  }
  .admin-split-layout .admin-form-card{
    position:sticky;
    top:24px;
    order:1;
  }
  .admin-split-layout .admin-list-card{
    min-width:0;
    order:2;
  }
  .admin-form-card h2,
  .admin-list-card h2{
    margin-bottom:14px!important;
  }
  .admin-form-compact{
    gap:12px!important;
  }
  .admin-form-compact label{
    gap:6px!important;
    font-size:14px!important;
  }
  .admin-form-compact input,
  .admin-form-compact select,
  .admin-form-compact textarea{
    min-height:42px!important;
    padding:9px 11px!important;
    border-radius:13px!important;
    font-size:14px!important;
  }
  .admin-form-compact select[multiple]{
    min-height:170px!important;
    padding:10px!important;
  }
  .admin-form-compact .btn-primary,
  .admin-form-card .btn-primary{
    width:100%;
    min-height:44px!important;
  }
  .admin-list-card .table-wrap{
    overflow-x:auto!important;
    max-width:100%!important;
  }
  .admin-list-card table{
    width:100%!important;
    table-layout:auto!important;
  }
  .admin-list-card th,
  .admin-list-card td{
    padding:10px 11px!important;
  }
  .admin-list-card .actions{
    display:flex!important;
    flex-wrap:nowrap!important;
    gap:6px!important;
  }
  .admin-list-card .actions .btn,
  .admin-list-card .actions form,
  .admin-list-card .actions form .btn{
    width:auto!important;
    white-space:nowrap;
  }
  .schools-admin-layout{
    display:grid!important;
    grid-template-columns:minmax(330px,420px) minmax(0,1fr)!important;
    gap:20px!important;
    align-items:start!important;
  }
  .schools-admin-layout .school-form-card{
    position:sticky!important;
    top:24px!important;
    max-width:none!important;
    width:100%!important;
  }
  .schools-admin-layout > .card:nth-child(2){
    min-width:0!important;
  }
  .school-form-compact{
    grid-template-columns:repeat(2,minmax(0,1fr))!important;
    gap:12px!important;
  }
  .school-form-compact .full{grid-column:1 / -1!important;}
  .school-save-btn{max-width:none!important;width:100%!important;}
}
@media (min-width:901px) and (max-width:1150px){
  .admin-split-layout,
  .schools-admin-layout{
    grid-template-columns:minmax(300px,380px) minmax(0,1fr)!important;
    gap:16px!important;
  }
}
@media (max-width:900px){
  .admin-split-layout{display:grid!important;grid-template-columns:1fr!important;gap:14px!important;}
  .admin-split-layout .admin-form-card{order:1;position:relative!important;top:auto!important;}
  .admin-split-layout .admin-list-card{order:2;}
  .admin-form-card,.admin-list-card{padding:14px!important;border-radius:22px!important;}
  .admin-form-card h2,.admin-list-card h2{font-size:20px!important;margin-bottom:12px!important;}
  .admin-form-compact input,.admin-form-compact select,.admin-form-compact textarea{min-height:44px!important;border-radius:15px!important;font-size:16px!important;}
  .admin-list-card .actions{display:grid!important;grid-template-columns:1fr 1fr!important;gap:8px!important;}
  .admin-list-card .actions form,.admin-list-card .actions .btn,.admin-list-card .actions form .btn{width:100%!important;}
}
@media (max-width:430px){
  .admin-list-card .actions{grid-template-columns:1fr!important;}
}

/* v1.3.33 - توضيح التاريخ الميلادي المختار مع معاينة هجرية بدون تغيير حقل التاريخ الافتراضي */
.period-date-preview{
  display:grid;
  gap:8px;
  border:1px solid rgba(20,184,166,.28);
  background:linear-gradient(180deg,#f0fdfa,#ffffff);
  border-radius:18px;
  padding:12px 14px;
  box-shadow:0 8px 22px rgba(15,23,42,.04);
}
.period-date-preview .preview-row{
  display:grid;
  grid-template-columns:1fr auto;
  gap:4px 10px;
  align-items:center;
  border-bottom:1px dashed rgba(20,184,166,.22);
  padding-bottom:7px;
}
.period-date-preview .preview-row:last-of-type{border-bottom:0;padding-bottom:0}
.period-date-preview .preview-row span{color:#64748b;font-size:12px;font-weight:800}
.period-date-preview .preview-row strong{font-size:13px;color:#0f766e;text-align:left;direction:ltr;unicode-bidi:embed}
.period-date-preview .preview-row small{grid-column:1/-1;color:#0f766e;font-weight:900;font-size:13px;background:#ecfdf5;border:1px solid #bbf7d0;border-radius:999px;padding:5px 10px;display:inline-flex;width:max-content;max-width:100%}
.period-adjust-note{background:#fff7ed;border:1px solid #fed7aa;color:#9a3412!important;border-radius:12px;padding:8px 10px;font-weight:800}
.date-dual{display:flex;flex-direction:column;gap:3px;line-height:1.6}.date-dual strong{color:#0f766e}.date-dual span{font-size:12px;color:#64748b;direction:ltr;unicode-bidi:embed}
@media (max-width:900px){
  .period-date-preview .preview-row{grid-template-columns:1fr;align-items:start}
  .period-date-preview .preview-row strong{text-align:right}
}

/* v1.3.40 - روابط واتساب والتكليف العام */
.public-assignment-page{background:#f3f7fb;padding:18px;min-height:100vh}
.public-toolbar{max-width:980px;margin:0 auto 14px;display:flex;align-items:center;justify-content:space-between;gap:12px;background:#fff;border:1px solid #dce8f2;border-radius:20px;padding:12px 16px;box-shadow:0 12px 30px rgba(15,23,42,.06)}
.public-official-card{max-width:980px;margin:0 auto}
.whatsapp-settings-layout{margin-top:16px;margin-bottom:16px}
.stats-grid-mini{grid-template-columns:repeat(3,minmax(0,1fr));margin-top:14px;margin-bottom:14px}
.copy-area{width:100%;min-height:190px;font-size:13px;line-height:1.7;direction:rtl;resize:vertical;background:#f8fafc}
.copy-input{width:100%;min-width:240px;border:1px solid #dbe7ef;border-radius:12px;padding:8px 10px;background:#f8fafc;color:#0f766e;direction:ltr;text-align:left;font-size:12px}
.variable-pills{display:flex;flex-wrap:wrap;gap:6px;margin:4px 0 10px}
.variable-pills span{display:inline-flex;border:1px solid #bfdbfe;background:#eff6ff;color:#075985;border-radius:999px;padding:5px 9px;font-weight:800;direction:ltr;unicode-bidi:embed}
.danger-text{color:#b91c1c!important;font-weight:800}
.whatsapp-table td{vertical-align:middle!important}
@media (max-width:900px){
  .public-assignment-page{padding:10px}
  .public-toolbar{position:sticky;top:8px;z-index:10;border-radius:18px;align-items:flex-start;flex-direction:column}
  .public-toolbar .btn{width:100%}
  .stats-grid-mini{grid-template-columns:1fr}
  .copy-input{min-width:0}
}
@media print{
  .public-assignment-page{background:#fff;padding:0!important}
  .public-official-card{box-shadow:none!important;border:0!important;margin:0!important;max-width:none!important;padding:0!important}
}

/* v1.3.41 - إرسال واتساب جماعي متتابع */
.bulk-whatsapp-card .bulk-progress-card{
  border:1px solid rgba(20,184,166,.24);
  background:linear-gradient(180deg,#f0fdfa,#ffffff);
  border-radius:20px;
  padding:14px;
  margin:12px 0;
  box-shadow:0 10px 26px rgba(15,23,42,.05);
}
.bulk-progress-top{display:flex;align-items:center;justify-content:space-between;gap:10px;margin-bottom:10px;flex-wrap:wrap}
.bulk-progress-top strong{color:#0f766e;font-size:15px}
.bulk-progress-track{height:10px;background:#dbeafe;border-radius:999px;overflow:hidden;margin-bottom:10px}
.bulk-progress-track span{display:block;height:100%;width:0;background:linear-gradient(90deg,#0f766e,#22c55e);border-radius:999px;transition:width .25s ease}
.bulk-current-box{background:#fff;border:1px dashed rgba(15,118,110,.35);border-radius:16px;padding:10px 12px;line-height:1.8;min-height:72px}
.bulk-current-box strong{color:#0f172a}.bulk-current-box span{color:#475569;font-weight:800}
.bulk-actions{display:grid!important;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px!important;margin-bottom:10px!important}
.bulk-actions .btn{width:100%!important;justify-content:center!important;min-height:42px!important}
.btn-success{background:#16a34a!important;color:#fff!important;border-color:#16a34a!important}.btn-success:hover{background:#15803d!important;border-color:#15803d!important}
@media (max-width:900px){
  .bulk-actions{grid-template-columns:1fr!important}
  .bulk-progress-top{align-items:flex-start;flex-direction:column}
  .bulk-current-box{font-size:14px}
}

/* v1.3.42 - إعادة تصميم صفحة روابط واتساب: بطاقة إعداد + إحصائيات + تبويبات */
.wa-page{display:flex;flex-direction:column;gap:16px}
.wa-hero{display:flex;align-items:center;justify-content:space-between;gap:18px;padding:22px 24px;background:linear-gradient(135deg,#ffffff 0%,#f0fdfa 100%);overflow:hidden;position:relative}
.wa-hero:after{content:"";position:absolute;left:22px;top:18px;width:120px;height:120px;background:radial-gradient(circle,rgba(20,184,166,.16),transparent 68%);border-radius:50%;pointer-events:none}.wa-hero>*{position:relative;z-index:1}.wa-hero h2{margin:4px 0 8px;font-size:30px;color:#0f766e}.wa-kicker{display:inline-flex;padding:5px 11px;border-radius:999px;background:#e0f2fe;color:#075985;font-weight:900;font-size:12px}.wa-hero-actions{display:flex;gap:8px;flex-wrap:wrap;align-items:center}
.wa-control-card{padding:20px 22px}.wa-control-main{display:grid;grid-template-columns:minmax(280px,1fr) auto;gap:18px;align-items:end}.wa-period-form label{display:flex;flex-direction:column;gap:8px;font-weight:900}.wa-period-form select{min-height:48px}.wa-period-hint{margin-top:8px;color:#64748b;font-size:13px}.wa-period-hint strong{color:#0f766e}.wa-primary-actions{display:flex;gap:8px;flex-wrap:wrap;justify-content:flex-start}.wa-primary-actions .inline-form{display:inline-flex}.wa-primary-actions .btn{min-height:44px}
.wa-stats-grid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:12px;margin-top:18px}.wa-stat-card{border:1px solid #dbeafe;background:linear-gradient(180deg,#fff,#f8fbff);border-radius:18px;padding:14px 16px;box-shadow:0 8px 22px rgba(15,23,42,.04)}.wa-stat-card span{display:block;color:#64748b;font-weight:800;font-size:13px;margin-bottom:6px}.wa-stat-card strong{display:block;color:#0f766e;font-size:30px;line-height:1}.wa-stat-warning{border-color:#fed7aa;background:linear-gradient(180deg,#fff7ed,#fff)}.wa-stat-warning strong{color:#c2410c}.wa-inline-note{margin-top:14px;border:1px solid #bfdbfe;background:#eff6ff;color:#075985;border-radius:16px;padding:11px 14px;font-weight:800}
.wa-tabs{padding:0;overflow:hidden}.wa-tab-buttons{display:flex;gap:8px;padding:14px;border-bottom:1px solid var(--border);background:linear-gradient(180deg,#fff,#f8fafc)}.wa-tab-button{border:1px solid var(--border);background:#fff;border-radius:14px;padding:11px 16px;font-family:inherit;font-weight:900;cursor:pointer;color:#334155}.wa-tab-button.active{background:#0f766e;border-color:#0f766e;color:#fff;box-shadow:0 10px 22px rgba(15,118,110,.16)}.wa-tab-panel{display:none;padding:18px}.wa-tab-panel.active{display:block}.wa-section-head{display:flex;justify-content:space-between;gap:14px;align-items:flex-start;margin-bottom:14px}.wa-section-head h3,.wa-bulk-main h3,.wa-settings-card h3{margin:0 0 6px;color:#0f766e;font-size:22px}.wa-table-wrap{border-radius:20px}.wa-clean-table{min-width:920px}.wa-clean-table th{background:#f8fafc;color:#1e293b;font-size:14px}.wa-clean-table td{vertical-align:middle!important}.wa-phone{font-weight:900;color:#0f766e}.wa-phone-missing{color:#b91c1c}.wa-link-input{margin-top:8px}.wa-row-actions{display:flex;gap:6px;flex-wrap:wrap}.wa-row-actions .btn{white-space:nowrap}
.wa-bulk-grid{display:grid;grid-template-columns:minmax(0,1.2fr) minmax(280px,.8fr);gap:16px}.wa-bulk-main,.wa-bulk-side,.wa-settings-card{border:1px solid rgba(15,118,110,.14);background:linear-gradient(180deg,#ffffff,#fbfffd);border-radius:22px;padding:18px}.wa-bulk-progress-card{margin:14px 0!important}.wa-action-groups{display:flex;flex-direction:column;gap:10px}.wa-action-group{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px}.wa-action-group-primary{grid-template-columns:repeat(4,minmax(0,1fr))}.wa-action-group .btn{min-height:44px;justify-content:center}.wa-bulk-side h4{margin:0 0 10px;color:#0f766e}.wa-bulk-side ul{margin:0 0 14px;padding:0 20px;color:#475569;line-height:1.9;font-weight:700}.wa-copy-label{display:flex;flex-direction:column;gap:8px;font-weight:900}.wa-copy-label .copy-area{min-height:150px}.wa-settings-card{display:grid;grid-template-columns:minmax(220px,.65fr) minmax(0,1.35fr);gap:18px;align-items:start}.wa-template-form input,.wa-template-form textarea{background:#fff}.variable-pills-ar span{direction:rtl;unicode-bidi:normal}
@media (max-width:1100px){.wa-control-main{grid-template-columns:1fr}.wa-primary-actions{justify-content:stretch}.wa-primary-actions .btn,.wa-primary-actions .inline-form{width:100%}.wa-bulk-grid,.wa-settings-card{grid-template-columns:1fr}.wa-action-group,.wa-action-group-primary{grid-template-columns:repeat(2,minmax(0,1fr))}.wa-stats-grid{grid-template-columns:repeat(2,minmax(0,1fr))}}
@media (max-width:900px){.wa-hero{align-items:flex-start;flex-direction:column;border-radius:24px;padding:18px}.wa-hero h2{font-size:24px}.wa-hero-actions,.wa-hero-actions .btn{width:100%}.wa-hero-actions{display:grid;grid-template-columns:1fr 1fr}.wa-control-card,.wa-tab-panel{padding:14px}.wa-tab-buttons{display:grid;grid-template-columns:1fr;gap:8px}.wa-stats-grid{grid-template-columns:1fr 1fr;gap:10px}.wa-stat-card{padding:12px}.wa-stat-card strong{font-size:24px}.wa-clean-table{min-width:0}.wa-row-actions{display:grid;grid-template-columns:1fr 1fr}.wa-row-actions .btn{width:100%;justify-content:center}.wa-action-group,.wa-action-group-primary{grid-template-columns:1fr}.wa-bulk-main,.wa-bulk-side,.wa-settings-card{padding:14px;border-radius:20px}.wa-copy-label .copy-area{min-height:130px}}
@media (max-width:480px){.wa-stats-grid{grid-template-columns:1fr}.wa-hero-actions{grid-template-columns:1fr}.wa-row-actions{grid-template-columns:1fr}}

/* v1.3.43 - WhatsApp Arabic variable buttons */
.wa-template-help{margin:-2px 0 6px;color:#64748b;font-weight:700;line-height:1.7}
.wa-variable-buttons{gap:8px;margin-top:8px}
.variable-pills.wa-variable-buttons .var-pill{display:inline-flex;flex-direction:column;align-items:center;justify-content:center;gap:2px;border:1px solid #bfdbfe;background:linear-gradient(180deg,#eff6ff,#e0f2fe);color:#075985;border-radius:16px;padding:7px 12px;font-weight:900;cursor:pointer;min-height:48px;box-shadow:0 4px 12px rgba(14,116,144,.08);transition:.15s ease;direction:rtl;unicode-bidi:normal;font-family:inherit}
.variable-pills.wa-variable-buttons .var-pill:hover{transform:translateY(-1px);border-color:#38bdf8;background:#e0f2fe}
.variable-pills.wa-variable-buttons .var-pill span{border:0;background:transparent;color:#075985;padding:0;border-radius:0;font-weight:900;direction:rtl;unicode-bidi:normal}
.variable-pills.wa-variable-buttons .var-pill small{font-size:11px;color:#2563eb;direction:ltr;unicode-bidi:embed;font-weight:800;opacity:.85}
@media (max-width:700px){.variable-pills.wa-variable-buttons .var-pill{flex:1 1 45%;min-width:130px}}

/* v1.3.44 - صقل صفحة واتساب وتحسين القائمة للكمبيوتر والجوال */
.topbar-title-wrap{display:flex;align-items:center;gap:12px;min-width:0}
.topbar-menu-btn{display:none;min-width:42px;padding:8px 12px;font-size:18px;line-height:1;border-radius:14px}
.sidebar-backdrop{display:none}
.nav-group-title{padding:10px 12px 6px;color:#8fb9c7;font-size:12px;font-weight:900;letter-spacing:.2px}
.sidebar .nav{gap:4px}
.sidebar .nav a,.sidebar .nav-link{padding:10px 12px;border-radius:14px}
.sidebar .nav a:hover,.sidebar .nav a.active,.sidebar .nav-link:hover,.sidebar .nav-link.active{background:rgba(255,255,255,.10)}
.sidebar .nav a.active,.sidebar .nav-link.active{box-shadow:inset 0 0 0 1px rgba(255,255,255,.08)}
.nav-label{font-size:14px}
.content{padding-top:22px}
.app-topbar{margin-bottom:20px}
.topbar-actions .btn{min-height:38px}

.wa-page{gap:18px}
.wa-hero{padding:24px 26px;background:linear-gradient(135deg,#ffffff 0%,#f7fffd 100%)}
.wa-hero h2{font-size:32px;margin:6px 0 8px}
.wa-hero p{max-width:760px;line-height:1.9}
.wa-hero-actions{justify-content:flex-start}
.wa-hero-actions .btn{min-width:118px}
.wa-control-card{padding:22px 24px}
.wa-control-main{align-items:start}
.wa-period-form label{font-size:15px}
.wa-primary-actions{align-items:center}
.wa-primary-actions .inline-form{display:inline-flex}
.wa-stats-grid{margin-top:16px}
.wa-stat-card{padding:16px 18px;border-radius:20px}
.wa-stat-card strong{font-size:32px}
.wa-tabs{border-radius:28px}
.wa-tab-buttons{padding:16px;gap:10px;flex-wrap:wrap}
.wa-tab-button{min-height:46px;padding:11px 18px}
.wa-tab-panel{padding:20px}
.wa-clean-table{min-width:980px}
.wa-table-wrap{border-radius:22px}
.wa-row-actions{display:flex;align-items:center;gap:6px;flex-wrap:wrap}
.wa-bulk-grid{gap:18px}
.wa-bulk-main,.wa-bulk-side,.wa-settings-card{border-radius:24px;padding:20px}
.wa-action-group{grid-template-columns:repeat(3,minmax(0,1fr));gap:10px}
.wa-action-group-primary{grid-template-columns:repeat(4,minmax(0,1fr))}
.wa-action-group .btn{min-height:46px}
.wa-copy-label .copy-area{min-height:170px}
.wa-settings-card{grid-template-columns:minmax(240px,.62fr) minmax(0,1.38fr)}
.wa-template-form{gap:12px}
.wa-template-help{background:#f8fafc;border:1px dashed #cbd5e1;border-radius:16px;padding:10px 12px}
.variable-pills.wa-variable-buttons{display:grid;grid-template-columns:repeat(auto-fit,minmax(180px,1fr));gap:10px}
.variable-pills.wa-variable-buttons .var-pill{display:flex;align-items:flex-start;justify-content:space-between;flex-direction:row;gap:10px;text-align:right;padding:10px 12px;min-height:58px;width:100%}
.variable-pills.wa-variable-buttons .var-pill span{display:block;margin:0;color:#075985;font-size:14px;line-height:1.5}
.variable-pills.wa-variable-buttons .var-pill small{display:inline-flex;align-items:center;justify-content:center;white-space:nowrap;background:#fff;border:1px solid #bfdbfe;border-radius:999px;padding:5px 10px;font-size:11px;line-height:1.2}

@media (min-width:901px){
  .app{grid-template-columns:250px minmax(0,1fr)}
  .sidebar{padding:18px 14px}
  .sidebar .brand{padding-bottom:14px;margin-bottom:12px}
  .sidebar .nav{overflow:auto;max-height:calc(100vh - 92px);padding-inline-end:4px}
  .sidebar .nav a,.sidebar .nav-link{gap:9px}
  .nav-icon{width:26px;height:26px;flex:0 0 26px}
  .app-body-member .sidebar{width:230px}
}

@media (max-width:900px){
  body{padding-bottom:0}
  .topbar-menu-btn{display:inline-flex;align-items:center;justify-content:center}
  .topbar-actions{display:none!important}
  .sidebar-backdrop{display:block;position:fixed;inset:0;background:rgba(2,6,23,.42);z-index:999;opacity:0;pointer-events:none;transition:opacity .2s ease}
  .sidebar-backdrop.is-visible{opacity:1;pointer-events:auto}
  .sidebar{position:fixed!important;top:0!important;bottom:0!important;right:0!important;left:auto!important;width:min(320px,88vw)!important;height:100dvh!important;border-radius:0!important;padding:18px 14px 18px!important;transform:translateX(105%);transition:transform .24s ease;overflow:auto!important;z-index:1000;border-inline-start:1px solid rgba(255,255,255,.08)}
  .sidebar.is-open{transform:translateX(0)}
  .sidebar .brand{display:flex!important;margin-bottom:14px!important}
  .sidebar .nav{display:flex!important;flex-direction:column!important;gap:5px!important;overflow:visible!important;scroll-snap-type:none!important;grid-auto-flow:unset!important;grid-auto-columns:unset!important}
  .sidebar .nav a,.sidebar .nav-link{min-height:50px!important;flex-direction:row!important;justify-content:flex-start!important;align-items:center!important;text-align:right!important;gap:10px!important;padding:10px 12px!important;white-space:normal!important}
  .sidebar .nav a.active,.sidebar .nav-link.active{background:linear-gradient(135deg,#0f766e,#0ea5a4)!important}
  .nav-icon{width:28px;height:28px;flex:0 0 28px}
  .nav-label{font-size:14px;max-width:none}
  .nav-group-title{padding:12px 10px 4px}
  .content{padding:12px 12px 22px}
  .app-topbar{margin:-12px -12px 16px;padding:calc(10px + env(safe-area-inset-top)) 12px 10px}
  .wa-hero{padding:18px 18px 16px}
  .wa-hero h2{font-size:25px}
  .wa-hero-actions{display:grid;grid-template-columns:1fr 1fr;gap:8px;width:100%}
  .wa-hero-actions .btn{width:100%;min-width:0}
  .wa-control-card,.wa-tab-panel{padding:15px}
  .wa-control-main{grid-template-columns:1fr;gap:14px}
  .wa-primary-actions{display:grid;grid-template-columns:1fr;gap:8px}
  .wa-primary-actions .inline-form,.wa-primary-actions .btn{width:100%}
  .wa-stats-grid{grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}
  .wa-tab-buttons{display:grid;grid-template-columns:1fr;gap:8px}
  .wa-settings-card{grid-template-columns:1fr;gap:14px}
  .wa-action-group,.wa-action-group-primary{grid-template-columns:1fr}
  .variable-pills.wa-variable-buttons{grid-template-columns:1fr 1fr}
  .variable-pills.wa-variable-buttons .var-pill{flex-direction:column;align-items:flex-start}
  .wa-row-actions{display:grid;grid-template-columns:1fr 1fr}
  .wa-row-actions .btn{width:100%}
}

@media (max-width:520px){
  .wa-stats-grid,.variable-pills.wa-variable-buttons,.wa-row-actions{grid-template-columns:1fr}
  .wa-hero-actions{grid-template-columns:1fr}
}


/* v1.3.45 - توحيد واجهة الصفحات والقائمة بعد اعتماد القائمة الجانبية */
@media (min-width:901px){
  .app{grid-template-columns:248px minmax(0,1fr)!important;}
  .content{max-width:1540px!important;padding:24px!important;}
  .app-topbar{
    min-height:82px;
    padding:18px 22px!important;
    margin-bottom:20px!important;
    background:linear-gradient(135deg,rgba(255,255,255,.92),rgba(248,253,251,.9));
  }
  .topbar-title h1{font-size:32px;line-height:1.15;}
  .topbar-actions{justify-content:flex-start;}
  .sidebar{width:248px!important;padding:16px 12px!important;}
  .sidebar .brand{
    border-radius:20px;
    padding:12px;
    margin-bottom:12px;
    background:rgba(255,255,255,.055);
    border:1px solid rgba(255,255,255,.08);
  }
  .sidebar .nav{
    gap:3px!important;
    scrollbar-width:thin;
  }
  .sidebar .nav a,.sidebar .nav-link{
    min-height:42px;
    border-radius:13px!important;
    padding:8px 10px!important;
  }
  .nav-icon{width:24px!important;height:24px!important;flex-basis:24px!important;border-radius:9px!important;font-size:13px!important;}
  .nav-label{font-size:13.5px!important;}
  .nav-group-title{
    padding:12px 10px 5px!important;
    margin-top:4px;
    color:#9bcbd7!important;
    font-size:11.5px!important;
    border-top:1px solid rgba(255,255,255,.06);
  }
  .nav-group-title:first-child{border-top:0;margin-top:0;}
}

/* Unified admin cards */
.card{
  border-color:#dbe8f2;
}
.card > h2:first-child{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  padding-bottom:6px;
}
.admin-split-layout .admin-form-card,
.admin-split-layout .admin-list-card,
.schools-admin-layout .school-form-card,
.schools-admin-layout > .card{
  border-radius:26px;
}
.admin-form-card,.school-form-card{
  background:linear-gradient(180deg,#ffffff,#fbfffd);
}
.admin-list-card,.schools-admin-layout > .card:nth-child(2){
  background:rgba(255,255,255,.96);
}
.admin-form-compact label,
.school-form-compact label,
.wa-template-form label{
  color:#0f172a;
}
.table-wrap{
  box-shadow:inset 0 0 0 1px rgba(226,232,240,.35);
}
table.responsive th{
  font-size:14px;
  color:#1e293b;
}
table.responsive td{
  line-height:1.7;
}
td .badge, .resp-cell .badge{
  white-space:nowrap;
}

/* Make action areas calmer and consistent */
.admin-list-card .actions .btn,
.school-table .actions .btn,
.wa-row-actions .btn{
  box-shadow:none;
}
.btn-danger{background:#c81e1e!important;border-color:#c81e1e!important;color:#fff!important;}
.btn-primary{box-shadow:0 8px 18px rgba(15,118,110,.12);}
.btn-success{box-shadow:0 8px 18px rgba(22,163,74,.12);}

/* WhatsApp final polish */
.wa-hero-actions .btn{
  border-radius:16px;
}
.wa-tab-buttons{
  position:sticky;
  top:0;
  z-index:5;
}
.wa-clean-table td:first-child strong{
  color:#0f172a;
}
.wa-link-input{
  max-width:420px;
}
.variable-pills.wa-variable-buttons .var-pill{
  border-color:#bfdbfe!important;
}
.variable-pills.wa-variable-buttons .var-pill small{
  max-width:100%;
  overflow:hidden;
  text-overflow:ellipsis;
}

/* Mobile: drawer menu + app-like pages */
@media (max-width:900px){
  body.sidebar-open{overflow:hidden;}
  .content{padding:12px 10px 22px!important;}
  .app-topbar{
    display:flex!important;
    flex-direction:row!important;
    align-items:center!important;
    justify-content:space-between!important;
    gap:10px!important;
  }
  .topbar-title-wrap{
    flex:1;
    min-width:0;
  }
  .topbar-title{
    min-width:0;
  }
  .topbar-title h1{
    max-width:100%;
    white-space:nowrap;
    overflow:hidden;
    text-overflow:ellipsis;
    font-size:19px!important;
  }
  .topbar-menu-btn{
    display:inline-flex!important;
    flex:0 0 42px;
  }
  .sidebar{
    box-shadow:-20px 0 50px rgba(2,6,23,.30)!important;
  }
  .sidebar .nav a,.sidebar .nav-link{
    min-height:48px!important;
  }
  .card{
    border-radius:22px!important;
    padding:15px!important;
  }
  .card > h2:first-child{
    font-size:20px!important;
  }
  .admin-split-layout,.schools-admin-layout{
    gap:12px!important;
  }
  .admin-form-card,.admin-list-card,.school-form-card{
    padding:15px!important;
  }
  .table-wrap{
    box-shadow:none!important;
  }
  table.responsive tr.resp-row{
    border-radius:20px!important;
  }
  .wa-hero{
    margin-top:0;
  }
  .wa-kicker{
    font-size:11px;
  }
  .wa-hero h2{
    font-size:23px!important;
  }
  .wa-hero p{
    line-height:1.8;
  }
  .wa-tab-buttons{
    position:relative;
    top:auto;
  }
  .wa-tab-button{
    min-height:44px;
  }
  .wa-clean-table td.resp-cell{
    padding:12px!important;
  }
  .wa-link-input{
    max-width:100%;
  }
  .variable-pills.wa-variable-buttons .var-pill{
    min-height:54px;
  }
}


/* v1.3.46 - حذف تصدير التكاليف من القائمة + أقسام منطبقة + إعدادات اللوحة */
.nav-section{
  display:flex;
  flex-direction:column;
  gap:3px;
}
.nav-group-toggle{
  width:100%;
  border:0;
  background:transparent;
  color:#9bcbd7;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:8px;
  padding:10px 10px 5px;
  margin-top:4px;
  font-family:inherit;
  font-size:12px;
  font-weight:900;
  cursor:pointer;
  border-top:1px solid rgba(255,255,255,.06);
}
.nav-section:first-child .nav-group-toggle{
  border-top:0;
  margin-top:0;
}
.nav-chevron{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  width:20px;
  height:20px;
  border-radius:8px;
  background:rgba(255,255,255,.07);
  transition:transform .18s ease;
  color:#dff5ff;
}
.nav-group-links{
  display:none;
  flex-direction:column;
  gap:3px;
}
.nav-section.is-open .nav-group-links{
  display:flex;
}
.nav-section.is-open .nav-chevron{
  transform:rotate(180deg);
}
.nav-section .nav-link{
  margin-inline-start:4px;
}
.profile-settings-grid{
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:18px;
}
.profile-card{
  min-width:0;
}
.profile-card-wide{
  grid-column:1/-1;
}
.section-title-row{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:12px;
  margin-bottom:14px;
}
.section-title-row h2{
  margin:0 0 6px;
  color:#0f766e;
}
.section-title-row p{
  margin:0;
  line-height:1.8;
}
.profile-note{
  background:#fffbeb;
  border:1px solid #fde68a;
  color:#92400e;
  border-radius:16px;
  padding:12px 14px;
  line-height:1.8;
}
@media (min-width:901px){
  .nav-group-toggle:hover{
    color:#e8fbff;
  }
  .nav-section:not(.is-open) .nav-group-toggle{
    margin-bottom:2px;
  }
}
@media (max-width:900px){
  .nav-group-toggle{
    min-height:42px;
    padding:10px 10px 6px;
    border-radius:14px;
    background:rgba(255,255,255,.045);
  }
  .nav-section .nav-link{
    margin-inline-start:0;
  }
  .profile-settings-grid{
    grid-template-columns:1fr;
    gap:12px;
  }
  .profile-card-wide{
    grid-column:auto;
  }
  .section-title-row{
    flex-direction:column;
  }
}

/* v1.3.47 - إصلاح فتح أقسام القائمة القابلة للطي */
.nav-group-toggle{
  user-select:none;
  position:relative;
  z-index:2;
}
.nav-group-toggle:focus-visible{
  outline:2px solid rgba(56,189,248,.75);
  outline-offset:2px;
}
.nav-section.is-open > .nav-group-toggle{
  color:#e8fbff;
}
.nav-section.is-open > .nav-group-toggle .nav-chevron{
  background:rgba(20,184,166,.28);
}
@media (max-width:900px){
  .nav-section.is-open > .nav-group-toggle{
    background:rgba(255,255,255,.08);
  }
}

/* v1.3.48 - صقل تنسيق القائمة المنطوية */
.sidebar .nav{gap:10px!important}
.nav-section{
  background:rgba(255,255,255,.025);
  border:1px solid rgba(255,255,255,.06);
  border-radius:18px;
  padding:6px;
  overflow:hidden;
}
.nav-group-toggle{
  min-height:42px;
  padding:10px 12px!important;
  margin-top:0!important;
  border-top:0!important;
  border-radius:14px;
  color:#dff5ff!important;
  background:rgba(255,255,255,.035)!important;
  font-size:13px!important;
  line-height:1.2;
}
.nav-group-toggle:hover{background:rgba(255,255,255,.055)!important}
.nav-group-toggle span:first-child{font-size:14px;font-weight:800}
.nav-chevron{
  width:24px!important;
  height:24px!important;
  border-radius:10px!important;
  background:rgba(20,184,166,.18)!important;
  color:#f0fdff!important;
  font-size:13px;
}
.nav-group-links{
  padding:6px 2px 2px;
  gap:6px!important;
}
.nav-section .nav-link{
  margin-inline-start:0!important;
  min-height:44px!important;
  border-radius:14px!important;
  padding:10px 12px!important;
  background:transparent;
}
.nav-section .nav-link .nav-icon{
  background:rgba(255,255,255,.055);
  box-shadow:inset 0 0 0 1px rgba(255,255,255,.04);
}
.nav-section .nav-link .nav-label{
  font-size:14px!important;
  font-weight:700;
}
.nav-section .nav-link.active{
  background:linear-gradient(135deg,rgba(56,189,248,.16),rgba(20,184,166,.18))!important;
  box-shadow:inset 0 0 0 1px rgba(94,234,212,.18)!important;
}
.nav-section .nav-link.active .nav-icon{
  background:rgba(255,255,255,.14);
}
.nav-section.is-open{
  background:rgba(255,255,255,.035);
}
.nav-section.is-open > .nav-group-toggle{
  background:rgba(255,255,255,.07)!important;
}
.nav-section.is-open > .nav-group-toggle .nav-chevron{
  background:linear-gradient(135deg,rgba(56,189,248,.3),rgba(20,184,166,.32))!important;
}
.nav-logout{
  margin-top:4px;
}
@media (min-width:901px){
  .sidebar{padding:14px!important}
  .sidebar .brand{padding:14px!important}
  .sidebar .nav{max-height:calc(100vh - 104px)!important;padding-inline-end:2px}
}
@media (max-width:900px){
  .sidebar{padding:14px 12px 18px!important}
  .nav-group-toggle{min-height:44px!important}
  .nav-section .nav-link{min-height:46px!important}
  .nav-section{border-radius:20px}
}

/* v1.3.49 - تحسين تصميم الصفحة الرئيسية */
.dashboard-hero{
  display:grid;
  grid-template-columns:minmax(0,1.4fr) minmax(260px,.6fr);
  gap:18px;
  padding:24px;
  background:linear-gradient(135deg,#ffffff 0%,#f5fffd 55%,#eefdf8 100%);
  overflow:hidden;
}
.dashboard-hero-content h2{
  margin:6px 0 10px;
  color:#0f766e;
  font-size:34px;
  line-height:1.2;
}
.dashboard-kicker{
  display:inline-flex;
  align-items:center;
  gap:6px;
  padding:7px 12px;
  border-radius:999px;
  background:#e6fffb;
  color:#0f766e;
  font-weight:800;
  font-size:12px;
}
.dashboard-hero-content p{
  max-width:880px;
  line-height:2;
  margin-bottom:16px;
}
.dashboard-hero-actions{gap:10px}
.dashboard-hero-side{
  display:flex;
  align-items:stretch;
}
.dashboard-mini-card{
  width:100%;
  background:linear-gradient(180deg,#0f766e,#115e59);
  color:#fff;
  border-radius:24px;
  padding:20px;
  box-shadow:0 16px 36px rgba(15,118,110,.22);
  display:flex;
  flex-direction:column;
  justify-content:center;
  min-height:180px;
}
.dashboard-mini-card span{
  font-size:14px;
  opacity:.9;
}
.dashboard-mini-card strong{
  font-size:32px;
  margin:10px 0 8px;
}
.dashboard-mini-card small{
  color:rgba(255,255,255,.82);
  line-height:1.8;
}
.dashboard-stats-grid{
  display:grid;
  grid-template-columns:repeat(4,minmax(0,1fr));
  gap:14px;
  margin:16px 0;
}
.dashboard-stat-card{
  margin-bottom:0;
  padding:18px 18px 16px;
  background:linear-gradient(180deg,#fff,#fbfefd);
}
.dashboard-stat-card strong{
  display:block;
  font-size:40px;
  line-height:1;
  margin:14px 0 8px;
  color:#0f172a;
}
.dashboard-stat-head{
  display:flex;
  align-items:center;
  gap:10px;
  color:#0f172a;
  font-weight:800;
}
.dashboard-stat-icon{
  width:38px;
  height:38px;
  border-radius:14px;
  background:#f0fdfa;
  color:#0f766e;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  font-size:16px;
  box-shadow:inset 0 0 0 1px #ccfbf1;
}
.dashboard-stat-card.is-warn .dashboard-stat-icon{background:#fffbeb;color:#b45309;box-shadow:inset 0 0 0 1px #fde68a}
.dashboard-stat-card.is-success .dashboard-stat-icon{background:#ecfdf5;color:#166534;box-shadow:inset 0 0 0 1px #bbf7d0}
.dashboard-grid-2{
  display:grid;
  grid-template-columns:1.1fr .9fr;
  gap:16px;
}
.dashboard-workflow-card,.dashboard-shortcuts-card{
  margin-bottom:0;
  padding:20px;
}
.workflow-list{
  display:flex;
  flex-direction:column;
  gap:12px;
  margin-top:8px;
}
.workflow-item{
  display:flex;
  gap:12px;
  align-items:flex-start;
  padding:14px;
  border-radius:18px;
  background:#fbfffe;
  border:1px solid #dbe8f2;
}
.workflow-num{
  flex:0 0 34px;
  width:34px;
  height:34px;
  border-radius:12px;
  background:linear-gradient(135deg,#0f766e,#14b8a6);
  color:#fff;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  font-weight:900;
}
.workflow-item strong{display:block;margin-bottom:4px;color:#0f172a}
.workflow-item small{display:block;color:#64748b;line-height:1.8}
.dashboard-shortcuts-grid{
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:12px;
  margin-top:8px;
}
.shortcut-card{
  display:flex;
  align-items:flex-start;
  gap:12px;
  padding:15px;
  border:1px solid #dbe8f2;
  border-radius:18px;
  background:#fff;
  transition:transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}
.shortcut-card:hover{
  transform:translateY(-2px);
  box-shadow:0 14px 28px rgba(15,23,42,.06);
  border-color:#bfdbfe;
}
.shortcut-icon{
  width:40px;
  height:40px;
  border-radius:14px;
  background:#f0fdfa;
  color:#0f766e;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  flex:0 0 40px;
}
.shortcut-card strong{display:block;margin:2px 0 4px;color:#0f172a}
.shortcut-card small{display:block;color:#64748b;line-height:1.7}
@media (max-width:1200px){
  .dashboard-stats-grid{grid-template-columns:repeat(2,minmax(0,1fr));}
  .dashboard-grid-2{grid-template-columns:1fr;}
}
@media (max-width:900px){
  .dashboard-hero{grid-template-columns:1fr;padding:18px}
  .dashboard-hero-content h2{font-size:27px}
  .dashboard-mini-card{min-height:auto}
  .dashboard-stats-grid{grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}
  .dashboard-stat-card{padding:16px}
  .dashboard-stat-card strong{font-size:32px}
  .dashboard-shortcuts-grid{grid-template-columns:1fr}
}
@media (max-width:520px){
  .dashboard-stats-grid{grid-template-columns:1fr}
  .dashboard-hero-actions{display:grid;grid-template-columns:1fr;gap:8px}
}


/* v1.3.50 - إصلاح توافق صفحة الاستيراد مع الجوال */
.import-mobile-hero{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:18px;
  padding:22px 24px;
  background:linear-gradient(135deg,#ffffff 0%,#f5fffd 100%);
}
.import-mobile-hero h2{
  margin:6px 0 8px;
  color:#0f766e;
  font-size:28px;
}
.import-mobile-hero p{
  margin:0;
  line-height:1.9;
}
.import-hero-actions{
  display:flex;
  gap:10px;
  flex-wrap:wrap;
}
.import-page-layout{
  align-items:start;
}
.import-page-layout .import-card-main,
.import-page-layout .import-help-card{
  border-radius:26px;
}
.import-template-actions{
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:10px;
  margin:14px 0 16px;
}
.import-template-actions .btn{
  width:100%;
}
.import-form{
  gap:14px;
}
.import-file-label input[type="file"]{
  min-height:58px;
  padding:14px;
  background:#fff;
  border-style:dashed;
}
.import-check-row{
  display:flex!important;
  flex-direction:row!important;
  align-items:flex-start;
  gap:10px!important;
  padding:13px 14px;
  border:1px solid #dbe8f2;
  background:#fbfffd;
  border-radius:18px;
  line-height:1.8;
}
.import-check-row input{
  width:auto!important;
  min-height:auto!important;
  margin-top:6px;
}
.import-submit-btn{
  width:100%;
}
.import-tip{
  margin-top:14px;
}
.import-bottom-actions{
  margin-top:12px;
}
.import-columns-list{
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:10px;
  margin:12px 0 14px;
}
.import-column-card{
  border:1px solid #dbe8f2;
  background:#fff;
  border-radius:18px;
  padding:13px;
  display:flex;
  flex-direction:column;
  gap:5px;
}
.import-column-card strong{
  color:#0f172a;
}
.import-column-card span{
  width:max-content;
  max-width:100%;
  border-radius:999px;
  background:#f1f5f9;
  color:#475569;
  padding:3px 8px;
  font-size:12px;
  font-weight:800;
}
.import-column-card.is-required span{
  background:#dcfce7;
  color:#166534;
}
.import-column-card small{
  color:#64748b;
  line-height:1.7;
  word-break:break-word;
}
.import-details{
  border:1px solid #e2e8f0;
  border-radius:18px;
  overflow:hidden;
  margin-top:12px;
  background:#fff;
}
.import-details summary{
  cursor:pointer;
  padding:13px 14px;
  font-weight:900;
  color:#0f766e;
  background:#f8fafc;
}
.import-details .table-wrap{
  border:0;
  border-radius:0;
}
.import-warning{
  margin-top:14px;
}
.import-result-card{
  border-radius:26px;
}
.import-result-stats{
  display:grid;
  grid-template-columns:repeat(5,minmax(0,1fr));
  gap:10px;
}
.import-result-stats .stat{
  margin:0;
  padding:14px;
  border-radius:18px;
}
.import-report-list{
  margin-top:14px;
}
@media (max-width:1100px){
  .import-result-stats{
    grid-template-columns:repeat(2,minmax(0,1fr));
  }
}
@media (max-width:900px){
  .import-mobile-hero{
    flex-direction:column;
    align-items:stretch;
    padding:18px;
    border-radius:24px!important;
  }
  .import-mobile-hero h2{
    font-size:23px;
  }
  .import-hero-actions{
    display:grid;
    grid-template-columns:1fr 1fr;
    gap:8px;
  }
  .import-hero-actions .btn{
    width:100%;
  }
  .import-page-layout{
    display:flex!important;
    flex-direction:column!important;
  }
  .import-card-main{
    order:1!important;
  }
  .import-help-card{
    order:2!important;
  }
  .import-template-actions{
    grid-template-columns:1fr;
  }
  .import-columns-list{
    grid-template-columns:1fr;
  }
  .import-check-row{
    border-radius:16px;
    padding:12px;
  }
  .import-result-stats{
    grid-template-columns:1fr;
  }
  .import-details .table-wrap{
    overflow:visible!important;
  }
  .import-details table.responsive{
    min-width:0!important;
  }
}
@media (max-width:430px){
  .import-hero-actions{
    grid-template-columns:1fr;
  }
}

/* v1.3.52 - بوابة المشرف كتطبيق مستقل */
.member-app-body{
  min-height:100vh;
  background:
    radial-gradient(circle at top right,rgba(20,184,166,.13),transparent 34%),
    linear-gradient(180deg,#f5fbff 0%,#eef7f4 100%);
  overflow-x:hidden;
}
.member-app-shell{
  min-height:100vh;
  max-width:1180px;
  margin:0 auto;
  padding:18px 16px 96px;
}
.member-app-content{width:100%}
.member-app-header{
  position:sticky;
  top:12px;
  z-index:50;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  margin-bottom:16px;
  padding:14px 16px;
  border:1px solid rgba(219,232,242,.92);
  border-radius:28px;
  background:rgba(255,255,255,.86);
  box-shadow:0 18px 44px rgba(15,23,42,.075);
  backdrop-filter:blur(18px);
}
.member-header-main{display:flex;align-items:center;gap:12px;min-width:0}
.member-avatar{
  width:48px;height:48px;border-radius:18px;display:grid;place-items:center;
  background:linear-gradient(135deg,#0f766e,#14b8a6);color:#fff;font-size:22px;font-weight:900;
  box-shadow:0 12px 24px rgba(15,118,110,.20);
}
.member-app-header h1{margin:0 0 3px;color:#0f766e;font-size:24px;line-height:1.2}
.member-app-header p{margin:0;color:#64748b;font-size:13px;font-weight:800}
.member-header-actions{display:flex;gap:8px;flex-wrap:wrap}
.member-bottom-nav{
  position:fixed;right:50%;transform:translateX(50%);
  bottom:calc(12px + env(safe-area-inset-bottom));z-index:1000;width:min(560px,calc(100% - 22px));
  display:grid;grid-template-columns:repeat(3,1fr);gap:8px;padding:8px;border-radius:26px;
  background:rgba(15,38,51,.96);border:1px solid rgba(255,255,255,.10);
  box-shadow:0 18px 42px rgba(2,6,23,.28);backdrop-filter:blur(18px);
}
.member-bottom-nav a{
  min-height:58px;border-radius:20px;color:#dff5ff;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:4px;font-size:12px;
}
.member-bottom-nav a span{width:24px;height:24px;border-radius:10px;display:grid;place-items:center;background:rgba(255,255,255,.09)}
.member-bottom-nav a.active{background:linear-gradient(135deg,#0f766e,#0ea5a4);color:#fff}
.member-bottom-nav .nav-logout{color:#fee2e2!important}
.member-welcome-card{
  display:flex;align-items:center;justify-content:space-between;gap:14px;padding:22px;
  background:linear-gradient(135deg,#fff 0%,#f3fffc 100%);
}
.member-welcome-card h2{margin:7px 0 8px;color:#0f766e;font-size:26px}
.member-welcome-card p{margin:0;line-height:1.9}
.member-today-card{
  border:1px solid #bae6fd;background:linear-gradient(135deg,#ecfeff,#ffffff);
  border-radius:28px;padding:0;margin-bottom:16px;overflow:hidden;box-shadow:0 14px 34px rgba(14,116,144,.08);
}
.member-today-head{
  display:flex;align-items:center;justify-content:space-between;gap:12px;padding:16px 18px;
  background:linear-gradient(135deg,#0f766e,#0891b2);color:#fff;
}
.member-today-head span{font-weight:900}.member-today-head strong{font-size:22px}
.member-today-body{padding:16px 18px;display:grid;gap:8px}
.member-today-body p{margin:0;line-height:1.8}
.member-today-body p:first-child{display:flex;flex-direction:column;gap:2px}
.member-today-body p:first-child span{color:#64748b;font-size:13px}
.member-empty-today{background:linear-gradient(180deg,#fff,#fbfffd)}
.member-plans-card{border-radius:28px}
.member-plan-list{display:grid;gap:12px}
.member-plan-card{
  border:1px solid #dbe8f2;border-radius:22px;background:linear-gradient(180deg,#fff,#fbfefd);
  padding:15px;box-shadow:0 10px 24px rgba(15,23,42,.035);
}
.member-plan-main{display:flex;justify-content:space-between;gap:12px;align-items:flex-start}
.member-plan-main > div{min-width:0}.member-plan-main strong{color:#0f172a}
.member-plan-meta{margin:10px 0 12px;color:#64748b;font-size:13px;font-weight:800}
.member-plan-actions{display:flex;gap:8px;flex-wrap:wrap}
.member-empty-state{text-align:center;border:1px dashed #bfdbfe;background:#f8fafc;border-radius:22px;padding:24px}
.member-empty-state strong{display:block;color:#0f766e;font-size:18px;margin-bottom:6px}

/* supervisor login as app */
.member-login-page{
  min-height:100vh;display:grid;place-items:center;padding:18px;
  background:radial-gradient(circle at top right,rgba(20,184,166,.18),transparent 34%),linear-gradient(180deg,#f6fbff,#eef7f4);
}
.member-login-shell{width:min(480px,100%)}
.member-login-brand{display:flex;align-items:center;justify-content:center;gap:10px;margin-bottom:14px;color:#0f766e;font-weight:900}
.member-login-logo{
  width:44px;height:44px;border-radius:16px;display:grid;place-items:center;
  background:linear-gradient(135deg,#0f766e,#14b8a6);color:#fff;box-shadow:0 12px 24px rgba(15,118,110,.18);
}
.member-login-card{
  background:rgba(255,255,255,.92);border:1px solid #dbe8f2;border-radius:30px;padding:26px;
  box-shadow:0 24px 60px rgba(15,23,42,.11);backdrop-filter:blur(16px);
}
.member-login-card h1{color:#0f766e;margin:8px 0;font-size:28px}
.member-login-card p{line-height:1.9}
.member-login-note{
  margin-top:14px;border-radius:18px;background:#f8fafc;border:1px dashed #cbd5e1;color:#64748b;padding:12px;line-height:1.8;font-size:13px;
}

/* member edit/view polish */
.member-app-body .visit-card{border-radius:24px;box-shadow:0 12px 24px rgba(15,23,42,.04)}
.member-app-body .visit-card .day-title{font-size:18px}
.member-app-body .card{border-radius:26px}
.member-app-body .official-card{padding:12px}
@media (min-width:901px){
  .member-app-body .visit-card{grid-template-columns:120px 135px minmax(180px,1fr) minmax(170px,1fr) minmax(220px,1.1fr)}
}
@media (max-width:900px){
  .member-app-shell{padding:12px 10px 98px}
  .member-app-header{top:8px;border-radius:24px;padding:12px}
  .member-avatar{width:42px;height:42px;border-radius:16px;font-size:20px}
  .member-app-header h1{max-width:210px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;font-size:20px}
  .member-app-header p{max-width:210px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
  .member-header-actions{display:none}
  .member-welcome-card{flex-direction:column;align-items:stretch;padding:18px}
  .member-welcome-card h2{font-size:22px}
  .member-plan-main{flex-direction:column}
  .member-plan-actions{display:grid;grid-template-columns:1fr}
  .member-plan-actions .btn,.member-plan-actions form,.member-plan-actions form .btn{width:100%}
  .member-bottom-nav{width:calc(100% - 18px);bottom:calc(8px + env(safe-area-inset-bottom))}
  .member-login-card{padding:22px;border-radius:28px}.member-login-card h1{font-size:24px}
  .member-app-body .actions{display:grid;grid-template-columns:1fr}
  .member-app-body .actions .btn,.member-app-body .actions form,.member-app-body .actions form .btn{width:100%}
}
@media print{
  .member-app-body{background:#fff!important}
  .member-app-shell{max-width:none!important;padding:0!important}
  .member-bottom-nav,.member-app-header{display:none!important}
}


/* v1.3.53 - توافق بوابة المشرف مع الكمبيوتر مع بقاء تجربة الجوال كتطبيق */
.member-desktop-nav{
  display:none;
}
@media (min-width:901px){
  .member-app-body{
    background:
      radial-gradient(circle at top right,rgba(20,184,166,.11),transparent 32%),
      linear-gradient(180deg,#f7fbff 0%,#eef7f4 100%);
  }
  .member-app-shell{
    max-width:1360px;
    padding:24px 28px 38px;
  }
  .member-app-header{
    position:relative;
    top:auto;
    margin-bottom:14px;
    min-height:82px;
    padding:18px 22px;
  }
  .member-app-header h1{
    font-size:30px;
  }
  .member-avatar{
    width:58px;
    height:58px;
    border-radius:20px;
    font-size:26px;
  }
  .member-desktop-nav{
    display:grid;
    grid-template-columns:repeat(3,minmax(0,1fr));
    gap:12px;
    margin-bottom:18px;
  }
  .member-desktop-nav a{
    display:flex;
    align-items:center;
    gap:12px;
    min-height:72px;
    padding:14px 16px;
    border:1px solid #dbe8f2;
    border-radius:24px;
    background:rgba(255,255,255,.86);
    box-shadow:0 14px 34px rgba(15,23,42,.055);
    color:#0f172a;
    transition:transform .15s ease, box-shadow .15s ease, border-color .15s ease;
  }
  .member-desktop-nav a:hover{
    transform:translateY(-2px);
    box-shadow:0 18px 40px rgba(15,23,42,.08);
    border-color:#bfdbfe;
  }
  .member-desktop-nav a.active{
    background:linear-gradient(135deg,#0f766e,#0ea5a4);
    color:#fff;
    border-color:transparent;
  }
  .member-desktop-nav a span{
    width:42px;
    height:42px;
    border-radius:16px;
    display:grid;
    place-items:center;
    background:#f0fdfa;
    color:#0f766e;
    flex:0 0 42px;
    font-weight:900;
  }
  .member-desktop-nav a.active span{
    background:rgba(255,255,255,.18);
    color:#fff;
  }
  .member-desktop-nav a strong{
    display:block;
    font-size:16px;
    margin-bottom:2px;
  }
  .member-desktop-nav a small{
    display:block;
    color:#64748b;
    font-weight:700;
  }
  .member-desktop-nav a.active small{
    color:rgba(255,255,255,.82);
  }
  .member-bottom-nav{
    display:none!important;
  }
  .member-welcome-card{
    display:grid;
    grid-template-columns:minmax(0,1fr) auto;
    align-items:center;
    min-height:160px;
  }
  .member-welcome-card h2{
    font-size:30px;
  }
  .member-empty-today,
  .member-today-card,
  .member-plans-card{
    margin-bottom:18px;
  }
  .member-plan-list{
    grid-template-columns:repeat(2,minmax(0,1fr));
  }
  .member-plan-card{
    min-height:180px;
    display:flex;
    flex-direction:column;
    justify-content:space-between;
  }
  .member-plan-actions{
    margin-top:auto;
  }
}
@media (min-width:1200px){
  .member-app-content{
    display:grid;
    grid-template-columns:minmax(0,1fr);
    gap:0;
  }
}
@media (max-width:900px){
  .member-desktop-nav{
    display:none!important;
  }
}


/* v1.3.54 - بوابة المشرف بقائمة جانبية على الكمبيوتر مثل لوحة الإدارة */
.member-side-menu{
  display:none;
}
.member-mobile-avatar{
  display:grid;
}
@media (min-width:901px){
  .member-app-shell{
    max-width:none!important;
    width:100%;
    display:grid;
    grid-template-columns:260px minmax(0,1fr);
    grid-template-rows:auto 1fr;
    gap:20px;
    padding:22px 24px 38px!important;
    align-items:start;
  }
  .member-side-menu{
    display:block;
    grid-row:1 / span 2;
    grid-column:1;
    position:sticky;
    top:22px;
    height:calc(100vh - 44px);
    overflow:auto;
    padding:16px;
    border-radius:28px;
    background:#0f2633;
    border:1px solid rgba(255,255,255,.08);
    box-shadow:0 20px 46px rgba(2,6,23,.20);
    color:#eaf7fc;
  }
  .member-side-brand{
    display:flex;
    align-items:center;
    gap:12px;
    padding:12px;
    margin-bottom:14px;
    border-radius:22px;
    background:rgba(255,255,255,.055);
    border:1px solid rgba(255,255,255,.08);
  }
  .member-side-brand .member-avatar{
    width:48px;
    height:48px;
    border-radius:18px;
    flex:0 0 48px;
  }
  .member-side-brand strong{
    display:block;
    color:#fff;
    font-size:16px;
    margin-bottom:3px;
  }
  .member-side-brand span{
    display:block;
    color:#9bcbd7;
    font-size:12px;
    font-weight:800;
    max-width:145px;
    white-space:nowrap;
    overflow:hidden;
    text-overflow:ellipsis;
  }
  .member-side-nav{
    display:flex;
    flex-direction:column;
    gap:8px;
  }
  .member-side-nav a{
    display:flex;
    align-items:center;
    gap:11px;
    min-height:58px;
    padding:10px 12px;
    border-radius:18px;
    color:#dff5ff;
    background:rgba(255,255,255,.025);
    border:1px solid rgba(255,255,255,.045);
    transition:background .15s ease, transform .15s ease, border-color .15s ease;
  }
  .member-side-nav a:hover{
    transform:translateY(-1px);
    background:rgba(255,255,255,.07);
    border-color:rgba(255,255,255,.08);
  }
  .member-side-nav a.active{
    background:linear-gradient(135deg,#0f766e,#0ea5a4);
    color:#fff;
    border-color:transparent;
    box-shadow:0 12px 24px rgba(15,118,110,.20);
  }
  .member-side-nav a span{
    width:34px;
    height:34px;
    border-radius:14px;
    display:grid;
    place-items:center;
    background:rgba(255,255,255,.09);
    color:#b8f7ff;
    flex:0 0 34px;
    font-weight:900;
  }
  .member-side-nav a.active span{
    background:rgba(255,255,255,.18);
    color:#fff;
  }
  .member-side-nav a strong{
    display:block;
    font-size:14px;
    margin-bottom:2px;
    color:inherit;
  }
  .member-side-nav a small{
    display:block;
    color:#9bcbd7;
    font-size:11px;
    font-weight:800;
  }
  .member-side-nav a.active small{
    color:rgba(255,255,255,.82);
  }
  .member-side-nav .nav-logout{
    margin-top:8px;
    color:#fee2e2!important;
  }

  .member-app-header{
    grid-column:2;
    grid-row:1;
    position:relative!important;
    top:auto!important;
    margin-bottom:0!important;
  }
  .member-app-content{
    grid-column:2;
    grid-row:2;
    max-width:1280px;
    width:100%;
  }
  .member-desktop-nav{
    display:none!important;
  }
  .member-bottom-nav{
    display:none!important;
  }
  .member-mobile-avatar{
    display:none!important;
  }
  .member-app-header{
    min-height:82px;
  }
  .member-app-header h1{
    font-size:30px;
  }
  .member-header-main{
    padding-inline-start:2px;
  }
}
@media (max-width:900px){
  .member-side-menu{
    display:none!important;
  }
  .member-mobile-avatar{
    display:grid!important;
  }
}


/* v1.3.55 - إحصائيات بسيطة في رئيسية المشرف */
.member-simple-stats{
  display:grid;
  grid-template-columns:repeat(4,minmax(0,1fr));
  gap:12px;
  margin:0 0 16px;
}
.member-stat-tile{
  border:1px solid #dbe8f2;
  border-radius:22px;
  background:linear-gradient(180deg,#fff,#fbfefd);
  padding:16px;
  box-shadow:0 10px 24px rgba(15,23,42,.04);
}
.member-stat-tile span{
  display:block;
  color:#64748b;
  font-weight:900;
  font-size:13px;
  margin-bottom:10px;
}
.member-stat-tile strong{
  display:block;
  color:#0f172a;
  font-size:34px;
  line-height:1;
}
.member-stat-tile.is-waiting{
  background:linear-gradient(180deg,#fff,#fffbeb);
  border-color:#fde68a;
}
.member-stat-tile.is-waiting strong{
  color:#b45309;
}
.member-stat-tile.is-approved{
  background:linear-gradient(180deg,#fff,#ecfdf5);
  border-color:#bbf7d0;
}
.member-stat-tile.is-approved strong{
  color:#166534;
}
@media (max-width:900px){
  .member-simple-stats{
    grid-template-columns:repeat(2,minmax(0,1fr));
    gap:10px;
  }
  .member-stat-tile{
    border-radius:20px;
    padding:14px;
  }
  .member-stat-tile strong{
    font-size:28px;
  }
}
@media (max-width:420px){
  .member-simple-stats{
    grid-template-columns:1fr;
  }
}

/* v1.3.56 - صفحة خططي مستقلة للمشرف */
.member-plans-hero{
  margin-bottom:16px;
}
.member-bottom-nav{
  grid-template-columns:repeat(4,1fr)!important;
}
.member-bottom-nav a{
  min-width:0;
}
.member-bottom-nav a strong{
  font-size:11px;
}
@media (max-width:380px){
  .member-bottom-nav{
    gap:5px;
    padding:6px;
  }
  .member-bottom-nav a{
    min-height:54px;
    border-radius:17px;
  }
  .member-bottom-nav a strong{
    font-size:10px;
  }
}

/* v1.3.57 - تنظيم خطط المشرف حسب الجديد والحالي والمنتهي */
.member-plan-tabs{
  display:flex;
  gap:8px;
  flex-wrap:wrap;
  margin:14px 0 16px;
}
.member-plan-tabs a{
  display:inline-flex;
  align-items:center;
  gap:8px;
  min-height:42px;
  padding:9px 13px;
  border-radius:16px;
  border:1px solid #dbe8f2;
  background:#fff;
  color:#0f172a;
  font-weight:900;
}
.member-plan-tabs a strong{
  min-width:24px;
  height:24px;
  padding:0 7px;
  border-radius:999px;
  background:#e0f2fe;
  color:#075985;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  font-size:12px;
}
.member-plan-tabs a.active{
  background:linear-gradient(135deg,#0f766e,#0ea5a4);
  color:#fff;
  border-color:transparent;
  box-shadow:0 12px 24px rgba(15,118,110,.18);
}
.member-plan-tabs a.active strong{
  background:rgba(255,255,255,.18);
  color:#fff;
}
.member-plan-badges{
  display:flex;
  gap:6px;
  flex-wrap:wrap;
  margin:10px 0 0;
}
.member-plan-description{
  margin:10px 0 0;
  padding:10px 12px;
  border-radius:16px;
  background:#f8fafc;
  border:1px solid #e2e8f0;
  color:#475569;
  font-weight:800;
  line-height:1.7;
}
.member-plan-card.is-ended{
  opacity:.78;
  background:linear-gradient(180deg,#fff,#f8fafc);
}
.member-plan-card.is-ended .member-plan-description{
  background:#f1f5f9;
}
.member-home-summary-card .member-empty-state{
  grid-column:1/-1;
}
@media (min-width:901px){
  .member-home-plan-list{
    grid-template-columns:repeat(3,minmax(0,1fr));
  }
}
@media (max-width:900px){
  .member-plan-tabs{
    display:grid;
    grid-template-columns:repeat(2,minmax(0,1fr));
  }
  .member-plan-tabs a{
    justify-content:space-between;
  }
}
@media (max-width:420px){
  .member-plan-tabs{
    grid-template-columns:1fr;
  }
}

/* v1.3.58 - عنوان أسبوع الخطة ومنع الفترات السابقة */
.member-plan-card > .member-plan-main strong{
  font-size:17px;
}
.member-app-body .grid-2 > .card h3{
  color:#0f766e;
  font-size:20px;
  margin-bottom:10px;
}

/* v1.3.61 - شرح مصور لبوابة المشرف */
.member-guide-hero{
  margin-bottom:16px;
}
.member-guide-grid{
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:16px;
}
.member-guide-card{
  padding:0!important;
  overflow:hidden;
  display:flex;
  flex-direction:column;
}
.member-guide-card img{
  width:100%;
  display:block;
  background:#f8fafc;
  border-bottom:1px solid #dbe8f2;
}
.member-guide-body{
  padding:18px;
  position:relative;
}
.member-guide-number{
  position:absolute;
  top:-22px;
  inset-inline-start:18px;
  width:44px;
  height:44px;
  border-radius:16px;
  display:grid;
  place-items:center;
  background:linear-gradient(135deg,#0f766e,#14b8a6);
  color:#fff;
  font-weight:900;
  box-shadow:0 12px 22px rgba(15,118,110,.20);
}
.member-guide-body h2{
  color:#0f766e;
  margin:8px 0 8px;
  font-size:22px;
}
.member-guide-body p{
  line-height:1.9;
}
.member-guide-body ul{
  margin:12px 0 0;
  padding:0;
  list-style:none;
  display:grid;
  gap:8px;
}
.member-guide-body li{
  border:1px solid #dbe8f2;
  background:#fbfffd;
  border-radius:14px;
  padding:9px 12px;
  color:#475569;
  line-height:1.7;
}
.member-guide-summary{
  margin-top:16px;
}
.member-guide-summary-steps{
  display:grid;
  grid-template-columns:repeat(5,minmax(0,1fr));
  gap:10px;
}
.member-guide-summary-steps span{
  min-height:48px;
  border-radius:16px;
  background:#f0fdfa;
  color:#0f766e;
  display:flex;
  align-items:center;
  justify-content:center;
  font-weight:900;
  border:1px solid #ccfbf1;
}
.member-help-shortcut{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:14px;
  background:linear-gradient(135deg,#fff,#f8fffd);
}
.member-help-shortcut strong{
  color:#0f766e;
  font-size:18px;
}
.member-help-shortcut p{
  margin:6px 0 0;
  line-height:1.8;
}
.member-bottom-nav{
  grid-template-columns:repeat(5,1fr)!important;
}
.member-bottom-nav a strong{
  font-size:10.5px;
}
@media (max-width:900px){
  .member-guide-grid{
    grid-template-columns:1fr;
    gap:12px;
  }
  .member-guide-body{
    padding:16px;
  }
  .member-guide-body h2{
    font-size:20px;
  }
  .member-guide-summary-steps{
    grid-template-columns:1fr;
  }
  .member-help-shortcut{
    flex-direction:column;
    align-items:stretch;
  }
  .member-help-shortcut .btn{
    width:100%;
  }
  .member-bottom-nav{
    gap:5px!important;
    padding:6px!important;
  }
  .member-bottom-nav a{
    min-height:54px!important;
    border-radius:17px!important;
  }
  .member-bottom-nav a span{
    width:22px!important;
    height:22px!important;
  }
  .member-bottom-nav a strong{
    font-size:9.5px;
  }
}
@media (max-width:380px){
  .member-bottom-nav a strong{
    font-size:9px;
  }
}

/* v1.3.62 - تحسين ترتيب الشرح المصور للمشرف */
.member-guide-list{
  display:grid;
  grid-template-columns:1fr;
  gap:18px;
}
.member-guide-card-row{
  display:grid!important;
  grid-template-columns:minmax(320px, 42%) minmax(0, 58%);
  align-items:center;
  gap:18px;
  padding:18px!important;
  overflow:visible!important;
}
.member-guide-card-row img{
  width:100%;
  border-radius:24px;
  border:1px solid #dbe8f2;
  box-shadow:0 14px 28px rgba(15,23,42,.08);
  background:#fff;
}
.member-guide-card-row .member-guide-body{
  padding:6px 10px 6px 0;
}
.member-guide-card-row .member-guide-number{
  position:static;
  margin-bottom:14px;
}
.member-guide-card-row .member-guide-body h2{
  margin-top:0;
  margin-bottom:10px;
  font-size:26px;
}
.member-guide-card-row .member-guide-body p{
  margin:0 0 12px;
  font-size:16px;
}
.member-guide-card-row .member-guide-body li{
  font-size:15px;
}
.member-guide-summary{
  margin-top:18px;
}
.member-guide-hero{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:16px;
}
@media (max-width:980px){
  .member-guide-card-row{
    grid-template-columns:1fr;
    padding:14px!important;
  }
  .member-guide-card-row .member-guide-body{
    padding:0;
  }
  .member-guide-card-row .member-guide-body h2{
    font-size:22px;
  }
  .member-guide-hero{
    flex-direction:column;
    align-items:stretch;
  }
  .member-guide-hero .btn{
    width:100%;
  }
}
