:root{--ui-bg:#ffffff;--ui-surface:#ffffff;--ui-text:#273446;--ui-muted:#6b7280;--ui-border:#e7e3ef;--ui-shadow:0 8px 25px rgba(32,22,66,.10);}
html[data-theme="dark"]{--ui-bg:#0f1420;--ui-surface:#171d2a;--ui-text:#eef2f8;--ui-muted:#aeb7c7;--ui-border:#30394b;--ui-shadow:0 10px 28px rgba(0,0,0,.28);color-scheme:dark;}
html[data-theme="dark"] body{background:var(--ui-bg)!important;color:var(--ui-text)!important;}
html[data-theme="dark"] .main,html[data-theme="dark"] .side,html[data-theme="dark"] .app,html[data-theme="dark"] .wrap,html[data-theme="dark"] .login-card,html[data-theme="dark"] .card,html[data-theme="dark"] .section,html[data-theme="dark"] .crumb,html[data-theme="dark"] .admin-footer,html[data-theme="dark"] .admin-main,html[data-theme="dark"] .admin-sidebar,html[data-theme="dark"] .content,html[data-theme="dark"] .login-card{background:var(--ui-surface)!important;color:var(--ui-text)!important;border-color:var(--ui-border)!important;}
html[data-theme="dark"] .hero,html[data-theme="dark"] .top,html[data-theme="dark"] .head,html[data-theme="dark"] .side-head,html[data-theme="dark"] .topbar{background:linear-gradient(180deg,#171d2a,#141a26)!important;color:var(--ui-text)!important;}
html[data-theme="dark"] h1,html[data-theme="dark"] h2,html[data-theme="dark"] h3,html[data-theme="dark"] h4,html[data-theme="dark"] p,html[data-theme="dark"] label,html[data-theme="dark"] .brand-text,html[data-theme="dark"] .brand h1,html[data-theme="dark"] .brand p,html[data-theme="dark"] .title h2,html[data-theme="dark"] .db-index-title h2{color:var(--ui-text)!important;}
html[data-theme="dark"] input,html[data-theme="dark"] textarea,html[data-theme="dark"] select{background:#111722!important;color:var(--ui-text)!important;border-color:var(--ui-border)!important;}
html[data-theme="dark"] .side-link,html[data-theme="dark"] .back,html[data-theme="dark"] .student-logout{background:#1c2331!important;color:var(--ui-text)!important;border-color:var(--ui-border)!important;}
html[data-theme="dark"] .numcard p,html[data-theme="dark"] .title p,html[data-theme="dark"] .sub,html[data-theme="dark"] .desc,html[data-theme="dark"] .hint,html[data-theme="dark"] .footer,html[data-theme="dark"] .admin-footer-bottom,html[data-theme="dark"] .admin-footer-label{color:var(--ui-muted)!important;}
.platform-ui-tools{position:fixed;left:18px;bottom:18px;z-index:99999;display:flex;gap:8px;align-items:center;direction:ltr;}
.platform-ui-tools .ui-tool{height:42px;min-width:42px;padding:0 13px;border:1px solid rgba(109,53,207,.18);border-radius:14px;background:rgba(255,255,255,.94);color:#6d35cf;box-shadow:0 8px 22px rgba(30,20,60,.12);font:700 13px Cairo,Tahoma,sans-serif;display:flex;align-items:center;justify-content:center;gap:7px;backdrop-filter:blur(10px);cursor:pointer;transition:.2s;}
.platform-ui-tools .ui-tool:hover{transform:translateY(-2px);box-shadow:0 11px 25px rgba(30,20,60,.18);}
html[data-theme="dark"] .platform-ui-tools .ui-tool{background:rgba(23,29,42,.95);border-color:#414b60;color:#b994ff;}
@media(max-width:700px){.platform-ui-tools{left:10px;bottom:10px}.platform-ui-tools .ui-tool{height:38px;border-radius:12px;padding:0 10px;font-size:12px}}
/* English layout helpers */
html[dir="ltr"] .brand-text{text-align:left}.brand-text{text-align:right}
html[dir="ltr"] .side-title,html[dir="ltr"] .side-link{text-align:left}
html[dir="ltr"] .field input{padding-left:48px;padding-right:14px}
html[dir="ltr"] .field-wrap>i{left:16px;right:auto}
html[dir="ltr"] .student-access .student-mini{text-align:left}

/* Robust dark theme: inherit readable colors across the platform and admin UI */
html[data-theme="dark"] body,
html[data-theme="dark"] body *{scrollbar-color:#465066 #101722;}
html[data-theme="dark"] .card,
html[data-theme="dark"] .section,
html[data-theme="dark"] .content,
html[data-theme="dark"] .wrap,
html[data-theme="dark"] .hero,
html[data-theme="dark"] .top,
html[data-theme="dark"] .head,
html[data-theme="dark"] .side,
html[data-theme="dark"] .main,
html[data-theme="dark"] .app,
html[data-theme="dark"] .crumb,
html[data-theme="dark"] .login-card,
html[data-theme="dark"] .admin-content > *,
html[data-theme="dark"] .settings-grid > .card,
html[data-theme="dark"] .edit-card,
html[data-theme="dark"] .edit-section-card{color:var(--ui-text)!important;}
html[data-theme="dark"] a{color:#c5a8ff;}
html[data-theme="dark"] a:hover{color:#decfff;}
html[data-theme="dark"] small,
html[data-theme="dark"] .muted,
html[data-theme="dark"] .meta,
html[data-theme="dark"] .help,
html[data-theme="dark"] .description,
html[data-theme="dark"] .subtitle,
html[data-theme="dark"] .eyebrow{color:var(--ui-muted)!important;}
html[data-theme="dark"] table{color:var(--ui-text)!important;border-color:var(--ui-border)!important;}
html[data-theme="dark"] th{background:#202838!important;color:#f5f7fb!important;border-color:var(--ui-border)!important;}
html[data-theme="dark"] td{background:#171d2a!important;color:var(--ui-text)!important;border-color:var(--ui-border)!important;}
html[data-theme="dark"] .btn,
html[data-theme="dark"] button{color:#f7f8fb;}
html[data-theme="dark"] .btn-secondary{background:#202838!important;border-color:#3b465a!important;color:#eef2f8!important;}
html[data-theme="dark"] .btn-primary{color:#fff!important;}
html[data-theme="dark"] .notice{background:#202838!important;color:#eef2f8!important;border-color:#465066!important;}
html[data-theme="dark"] .success-box{background:#172a22!important;color:#bff1d5!important;border-color:#285a43!important;}
html[data-theme="dark"] .error,
html[data-theme="dark"] .notice.error{background:#301f25!important;color:#ffd6dc!important;border-color:#74404b!important;}
html[data-theme="dark"] .editor,
html[data-theme="dark"] [contenteditable="true"]{background:#111722!important;color:#eef2f8!important;border-color:#3a4558!important;}
html[data-theme="dark"] .editor-toolbar{background:#202838!important;border-color:#3a4558!important;}
html[data-theme="dark"] .editor-toolbar button{background:#171d2a!important;color:#eef2f8!important;border-color:#3a4558!important;}
html[data-theme="dark"] .side-link:hover,
html[data-theme="dark"] .admin-nav a:hover{background:#242c3d!important;}
html[data-theme="dark"] .admin-nav a.active{background:linear-gradient(135deg,#3c2a62,#2a3850)!important;color:#fff!important;}
html[data-theme="dark"] .admin-footer,
html[data-theme="dark"] footer{background:#121824!important;color:#eef2f8!important;border-color:#30394b!important;}
html[data-theme="dark"] .admin-footer a,
html[data-theme="dark"] footer a{color:#cdb7ff!important;}
html[data-theme="dark"] .empty-state,
html[data-theme="dark"] .student-access,
html[data-theme="dark"] .quick-actions,
html[data-theme="dark"] .theme-demo{background:#1b2230!important;color:#eef2f8!important;border-color:#30394b!important;}


/* =========================================================
   Platform UI V3 — readable dark mode + clean contact strip
   Content/branding marked data-no-translate is never translated by JS.
   ========================================================= */
html[data-theme="dark"] .site-contact-strip{
    display:flex;align-items:center;justify-content:center;flex-wrap:wrap;gap:8px;
    width:min(1180px,calc(100% - 28px));margin:10px auto 14px;padding:10px 14px;
    background:#171d2a!important;color:#eef2f8!important;border:1px solid #30394b;
    border-radius:16px;box-shadow:0 8px 22px rgba(0,0,0,.22);
}
.site-contact-strip{
    display:flex;align-items:center;justify-content:center;flex-wrap:wrap;gap:8px;
    width:min(1180px,calc(100% - 28px));margin:10px auto 14px;padding:10px 14px;
    background:#fff;color:#273446;border:1px solid #e9e5f1;border-radius:16px;
    box-shadow:0 5px 18px rgba(32,22,66,.08);font-family:Cairo,Tahoma,sans-serif;
}
.site-contact-strip a{display:inline-flex;align-items:center;gap:6px;padding:6px 10px;border-radius:10px;text-decoration:none;font-size:12px;font-weight:700;color:#6d35cf;background:#f6f3ff;border:1px solid #eee8fb;}
html[data-theme="dark"] .site-contact-strip a{color:#d1bcff!important;background:#202838!important;border-color:#3a4558!important;}

html[data-theme="dark"] .main,
html[data-theme="dark"] .side{background:#151b27!important;color:var(--ui-text)!important;}
html[data-theme="dark"] .hero{background:linear-gradient(135deg,#171d2a,#1b2230)!important;color:var(--ui-text)!important;}
html[data-theme="dark"] .hero:after{background:linear-gradient(90deg,rgba(23,29,42,.82),rgba(23,29,42,.35),rgba(23,29,42,.82));}
html[data-theme="dark"] .welcome,
html[data-theme="dark"] .hero p,
html[data-theme="dark"] .title p,
html[data-theme="dark"] .db-index-title p{color:#c3ccda!important;}
html[data-theme="dark"] .hero h1{color:#67d1d9!important;}
html[data-theme="dark"] .crumb{background:#171d2a!important;color:#c3ccda!important;border-color:#30394b!important;box-shadow:none;}
html[data-theme="dark"] .crumb a{color:#d0b9ff!important;}
html[data-theme="dark"] .crumb .current{color:#6ed5dc!important;}

/* Home guide cards: do not let the global h2 rule turn colored cards into white-on-pastel. */
html[data-theme="dark"] .home-grid .guide{background:#1b2230!important;border-color:#3a4558!important;color:#eef2f8!important;}
html[data-theme="dark"] .home-grid .guide.p{border-color:#624d88!important;}
html[data-theme="dark"] .home-grid .guide.g{border-color:#4d7438!important;}
html[data-theme="dark"] .home-grid .guide.y{border-color:#80652b!important;}
html[data-theme="dark"] .home-grid .guide h2{color:#d6c2ff!important;}
html[data-theme="dark"] .home-grid .guide.g h2{color:#a9df76!important;}
html[data-theme="dark"] .home-grid .guide.y h2{color:#ffd76a!important;}
html[data-theme="dark"] .home-grid .guide p{color:#c2cbd8!important;}
html[data-theme="dark"] .home-grid .guide-icon{box-shadow:inset 0 0 0 6px rgba(255,255,255,.10);}
html[data-theme="dark"] .quote{color:#62cfd6!important;}

/* Public content components. */
html[data-theme="dark"] .content .title h2,
html[data-theme="dark"] .db-index-title h2{color:#d8c6ff!important;}
html[data-theme="dark"] .content .card,
html[data-theme="dark"] .content .section,
html[data-theme="dark"] .content .box,
html[data-theme="dark"] .content .pill,
html[data-theme="dark"] .content .session,
html[data-theme="dark"] .content .note,
html[data-theme="dark"] .content .studentbox,
html[data-theme="dark"] .content .parentbox{background:#1b2230!important;color:#eef2f8!important;border-color:#354054!important;}
html[data-theme="dark"] .content .numcard h3,
html[data-theme="dark"] .content .sh h3,
html[data-theme="dark"] .content .box h3{color:#d6c2ff!important;}
html[data-theme="dark"] .content .numcard p,
html[data-theme="dark"] .content .flow small,
html[data-theme="dark"] .content .note,
html[data-theme="dark"] .content .title p{color:#bcc6d5!important;}
html[data-theme="dark"] .content .pill,
html[data-theme="dark"] .content .session,
html[data-theme="dark"] .content .flow b{color:#d7c8ff!important;}
html[data-theme="dark"] .content .content-html{color:#eef2f8!important;}
html[data-theme="dark"] .content .content-html h1,
html[data-theme="dark"] .content .content-html h2,
html[data-theme="dark"] .content .content-html h3,
html[data-theme="dark"] .content .content-html h4,
html[data-theme="dark"] .content .content-html strong,
html[data-theme="dark"] .content .content-html b{color:#f0f3f8!important;}
html[data-theme="dark"] .content .content-html p,
html[data-theme="dark"] .content .content-html li,
html[data-theme="dark"] .content .content-html td,
html[data-theme="dark"] .content .content-html th{color:#d5dce7!important;}
html[data-theme="dark"] .content .content-html a{color:#cdb5ff!important;}
html[data-theme="dark"] .content .db-child-card .numcard{background:#1b2230!important;}
html[data-theme="dark"] .content .db-child-card .numcard h3{color:#d6c2ff!important;}
html[data-theme="dark"] .content .db-child-card .numcard p{color:#bac5d4!important;}

/* Public sidebar. */
html[data-theme="dark"] .side-head{background:#171d2a!important;border-color:#30394b!important;}
html[data-theme="dark"] .brand-text h2{color:#67d1d9!important;}
html[data-theme="dark"] .brand-text span{color:#c0c9d7!important;}
html[data-theme="dark"] .side-link{background:#1b2230!important;color:#eef2f8!important;border-color:#354054!important;}
html[data-theme="dark"] .side-link span:last-child{color:#d6c2ff!important;}
html[data-theme="dark"] .side-expand{background:#202838!important;color:#cdb5ff!important;border-color:#3a4558!important;}
html[data-theme="dark"] .student-access{border-color:#30394b!important;}
html[data-theme="dark"] .student-access .student-mini{color:#c3ccd9!important;}
html[data-theme="dark"] .student-access .student-logout{background:#302126!important;color:#ffb7c0!important;border-color:#65414a!important;}

/* Footer: keep brand/content readable without translating the stored names. */
html[data-theme="dark"] .site-footer{background:#171d2a!important;border-color:#30394b!important;color:#eef2f8!important;}
html[data-theme="dark"] .site-footer .footer-platform-name{color:#67d1d9!important;}
html[data-theme="dark"] .site-footer .footer-platform-desc,
html[data-theme="dark"] .site-footer .footer-social-title,
html[data-theme="dark"] .site-footer .footer-social-subtitle,
html[data-theme="dark"] .site-footer .footer-bottom{color:#bac5d4!important;}
html[data-theme="dark"] .site-footer .footer-contact a,
html[data-theme="dark"] .site-footer .social-links a{background:#202838!important;border-color:#3a4558!important;color:#d0b9ff!important;}
html[data-theme="dark"] .site-footer .footer-company-label{color:#bac5d4!important;}
html[data-theme="dark"] .site-footer .footer-company strong{color:#67d1d9!important;}
html[data-theme="dark"] .site-footer .footer-bottom{border-color:#30394b!important;}

/* Login/student pages and their fields. */
html[data-theme="dark"] .wrap{background:#151b27!important;color:#eef2f8!important;}
html[data-theme="dark"] .top{background:linear-gradient(180deg,#171d2a,#141a26)!important;color:#eef2f8!important;}
html[data-theme="dark"] .login-card{background:#1b2230!important;color:#eef2f8!important;border-color:#354054!important;}
html[data-theme="dark"] .login-card h1,
html[data-theme="dark"] .login-card h2{color:#f1f4f8!important;}
html[data-theme="dark"] .login-card .desc,
html[data-theme="dark"] .login-card .subtitle,
html[data-theme="dark"] .login-card .hint{color:#b9c4d3!important;}
html[data-theme="dark"] .login-card label{color:#e8edf4!important;}
html[data-theme="dark"] .login-card input{background:#111722!important;color:#eef2f8!important;border-color:#3a4558!important;}
html[data-theme="dark"] .login-card .back{color:#cdb5ff!important;}

/* Do not override explicit colored buttons/badges. */
html[data-theme="dark"] .btn,
html[data-theme="dark"] .submit,
html[data-theme="dark"] .student-login,
html[data-theme="dark"] .student-dashboard{color:#fff!important;}

@media(max-width:700px){
    .site-contact-strip{width:calc(100% - 20px);margin:8px auto 10px;padding:8px;gap:6px;}
    .site-contact-strip a{font-size:11px;padding:6px 8px;}
}
