/* =====================================================================
   DigiMind UI — brand colours taken from the logo (navy #1f4d81, sky #7cc9ef)
   Light + dark themes (html[data-bs-theme]), role accents (body.role-*)
   ===================================================================== */
:root {
  --brand-navy: #1f4d81;
  --brand-deep: #13315a;
  --brand-sky: #7cc9ef;
  --brand-ice: #e3f5fd;

  --dm-primary: #2a78d6;
  --dm-primary-rgb: 42, 120, 214;
  --dm-primary-soft: #eaf2fc;
  --dm-accent: #f59e0b;

  --dm-bg: #f3f6fb;
  --dm-surface: #ffffff;
  --dm-surface-2: #f8fafd;
  --dm-text: #16213a;
  --dm-muted: #5f6b80;
  --dm-border: #e3e8f0;
  --dm-shadow: 0 1px 2px rgba(16, 33, 64, .04), 0 4px 16px rgba(16, 33, 64, .05);
  --dm-shadow-lg: 0 12px 32px rgba(16, 33, 64, .12);

  --dm-sidebar: linear-gradient(180deg, #13315a 0%, #1f4d81 100%);
  --dm-sidebar-text: #c9d7ea;
  --dm-sidebar-muted: #8ea4c3;
  --dm-radius: 16px;

  --bs-primary: var(--dm-primary);
  --bs-primary-rgb: var(--dm-primary-rgb);
  --bs-link-color: var(--dm-primary);
  --bs-link-color-rgb: var(--dm-primary-rgb);
  --bs-body-font-family: "Hind Siliguri", "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
}
html[data-bs-theme="dark"] {
  --dm-primary-soft: rgba(57, 135, 229, .16);
  --dm-bg: #0e1422;
  --dm-surface: #171e2e;
  --dm-surface-2: #1c2437;
  --dm-text: #e8ecf4;
  --dm-muted: #9ba6ba;
  --dm-border: #28324a;
  --dm-shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 18px rgba(0, 0, 0, .25);
  --dm-shadow-lg: 0 12px 32px rgba(0, 0, 0, .45);
  --dm-sidebar: linear-gradient(180deg, #0a1426 0%, #10213d 100%);
  --bs-body-bg: #0e1422;
  --bs-body-color: #e8ecf4;
  --bs-secondary-bg: #1c2437;
  --bs-tertiary-bg: #1c2437;
  --bs-border-color: #28324a;
}

/* Role accents: the same shell re-colours itself per role */
body.role-student { --dm-primary: #2a78d6; --dm-primary-rgb: 42, 120, 214; }
body.role-teacher { --dm-primary: #0d9488; --dm-primary-rgb: 13, 148, 136; --dm-sidebar: linear-gradient(180deg, #0b2f33 0%, #115e59 100%); }
body.role-admin   { --dm-primary: #6d4fd8; --dm-primary-rgb: 109, 79, 216; --dm-sidebar: linear-gradient(180deg, #1e1446 0%, #3b2a86 100%); }
html:not([data-bs-theme="dark"]) body.role-teacher { --dm-primary-soft: #e6f6f4; }
html:not([data-bs-theme="dark"]) body.role-admin   { --dm-primary-soft: #efebfc; }
html[data-bs-theme="dark"] body.role-teacher { --dm-primary-soft: rgba(13, 148, 136, .18); --dm-sidebar: linear-gradient(180deg, #06201f 0%, #0b3b38 100%); }
html[data-bs-theme="dark"] body.role-admin   { --dm-primary-soft: rgba(109, 79, 216, .2); --dm-sidebar: linear-gradient(180deg, #120b2c 0%, #231a52 100%); }

html, body { font-family: var(--bs-body-font-family); }
body { background: var(--dm-bg); color: var(--dm-text); -webkit-font-smoothing: antialiased; }
a { color: var(--dm-primary); text-decoration: none; }
a:hover { text-decoration: underline; }
::selection { background: rgba(var(--dm-primary-rgb), .2); }
.text-primary { color: var(--dm-primary) !important; }
.bg-primary-soft { background: var(--dm-primary-soft) !important; }
.text-muted-2 { color: var(--dm-muted); }
.fw-800 { font-weight: 800; }

/* ---------- Buttons & form controls ---------- */
.btn { border-radius: 10px; font-weight: 500; transition: transform .12s ease, box-shadow .12s ease, background-color .15s; }
.btn:active { transform: translateY(1px); }
.btn-primary {
  --bs-btn-bg: var(--dm-primary); --bs-btn-border-color: var(--dm-primary);
  --bs-btn-hover-bg: color-mix(in srgb, var(--dm-primary) 86%, black); --bs-btn-hover-border-color: color-mix(in srgb, var(--dm-primary) 86%, black);
  --bs-btn-active-bg: color-mix(in srgb, var(--dm-primary) 76%, black); --bs-btn-disabled-bg: var(--dm-primary); --bs-btn-disabled-border-color: var(--dm-primary);
  box-shadow: 0 4px 12px rgba(var(--dm-primary-rgb), .25);
}
.btn-primary:hover { box-shadow: 0 6px 16px rgba(var(--dm-primary-rgb), .32); }
.btn-outline-primary {
  --bs-btn-color: var(--dm-primary); --bs-btn-border-color: rgba(var(--dm-primary-rgb), .45);
  --bs-btn-hover-bg: var(--dm-primary); --bs-btn-hover-border-color: var(--dm-primary); --bs-btn-active-bg: var(--dm-primary);
}
.btn-light { --bs-btn-bg: var(--dm-surface-2); --bs-btn-border-color: var(--dm-border); --bs-btn-color: var(--dm-text); --bs-btn-hover-bg: var(--dm-primary-soft); --bs-btn-hover-border-color: var(--dm-border); --bs-btn-hover-color: var(--dm-text); }
.btn.is-loading { position: relative; color: transparent !important; }
.btn.is-loading::after { content: ""; position: absolute; inset: 0; margin: auto; width: 1rem; height: 1rem; border-radius: 50%; border: 2px solid currentColor; border-color: #fff #fff transparent transparent; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.form-control, .form-select { border-radius: 10px; border-color: var(--dm-border); background-color: var(--dm-surface); color: var(--dm-text); }
.form-control:focus, .form-select:focus { border-color: var(--dm-primary); box-shadow: 0 0 0 .22rem rgba(var(--dm-primary-rgb), .15); }
.form-check-input:checked { background-color: var(--dm-primary); border-color: var(--dm-primary); }
.form-label { font-weight: 500; font-size: .92rem; }
.input-icon { position: relative; }
.input-icon > .bi { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--dm-muted); pointer-events: none; }
.input-icon > .form-control { padding-left: 40px; }
.input-icon > .btn-eye { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); border: 0; background: transparent; color: var(--dm-muted); }

/* ---------- App shell ---------- */
.app-shell { display: flex; min-height: 100vh; }
.app-sidebar { width: 264px; background: var(--dm-sidebar) !important; color: var(--dm-sidebar-text); flex-shrink: 0; transition: width .25s ease; }
@media (min-width: 992px) {
  .app-sidebar { position: sticky; top: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column; }
  .app-sidebar::-webkit-scrollbar { width: 6px; } .app-sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,.15); border-radius: 3px; }
  .app-shell.collapsed .app-sidebar { width: 80px; }
  .app-shell.collapsed .side-nav .label, .app-shell.collapsed .side-nav .section, .app-shell.collapsed .brand-text,
  .app-shell.collapsed .role-chip, .app-shell.collapsed .sidebar-card, .app-shell.collapsed .side-nav .badge { display: none !important; }
  .app-shell.collapsed .side-nav a { justify-content: center; }
  .app-shell.collapsed .app-sidebar .brand { justify-content: center; padding-left: 0; padding-right: 0; }
}
.app-sidebar .brand { display: flex; align-items: center; gap: .7rem; padding: 1.1rem 1.25rem .9rem; color: #fff; font-weight: 700; font-size: 1.3rem; letter-spacing: .2px; }
.app-sidebar .brand:hover { text-decoration: none; }
.brand-mark { width: 42px; height: 42px; border-radius: 12px; background: #fff; display: grid; place-items: center; overflow: hidden; flex-shrink: 0; box-shadow: 0 4px 12px rgba(0,0,0,.2); }
.brand-mark img { width: 118%; height: 118%; object-fit: cover; }
.app-sidebar .role-chip { margin: 0 1.25rem .75rem; font-size: .7rem; letter-spacing: .08em; text-transform: uppercase; padding: .28rem .7rem; border-radius: 999px; background: rgba(255,255,255,.12); color: #fff; display: inline-block; }
.side-nav { list-style: none; padding: 0 .75rem 1rem; margin: 0; }
.side-nav .section { font-size: .68rem; text-transform: uppercase; letter-spacing: .1em; color: var(--dm-sidebar-muted); padding: 1rem .75rem .4rem; }
.side-nav a { display: flex; align-items: center; gap: .75rem; padding: .62rem .8rem; border-radius: 12px; color: var(--dm-sidebar-text); font-weight: 500; position: relative; transition: background-color .15s, color .15s; }
.side-nav a:hover { background: rgba(255,255,255,.08); color: #fff; text-decoration: none; }
.side-nav a.active { background: rgba(255,255,255,.14); color: #fff; box-shadow: inset 3px 0 0 var(--brand-sky); }
body.role-teacher .side-nav a.active { box-shadow: inset 3px 0 0 #5eead4; }
body.role-admin .side-nav a.active { box-shadow: inset 3px 0 0 #c4b5fd; }
body.role-mentor { --dm-primary: #c2410c; --dm-primary-rgb: 194, 65, 12; --dm-sidebar: linear-gradient(180deg, #3b1606 0%, #7c2d12 100%); }
html:not([data-bs-theme="dark"]) body.role-mentor { --dm-primary-soft: #fff1e8; }
html[data-bs-theme="dark"] body.role-mentor { --dm-primary-soft: rgba(194, 65, 12, .2); --dm-sidebar: linear-gradient(180deg, #250d03 0%, #4a1a08 100%); }
body.role-mentor .side-nav a.active { box-shadow: inset 3px 0 0 #fdba74; }
.side-nav a .bi { font-size: 1.12rem; width: 1.3rem; text-align: center; }
.side-nav .badge { margin-left: auto; }
.sidebar-card { margin: auto 1rem 1rem; padding: .9rem 1rem; border-radius: 14px; background: rgba(255,255,255,.08); color: #fff; }
.sidebar-card .progress { height: 6px; background: rgba(255,255,255,.15); }
.sidebar-card .progress-bar { background: var(--brand-sky); }
.sidebar-card small { color: var(--dm-sidebar-text); }

.app-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.app-topbar { position: sticky; top: 0; z-index: 1020; background: color-mix(in srgb, var(--dm-surface) 86%, transparent); backdrop-filter: saturate(160%) blur(10px);
  border-bottom: 1px solid var(--dm-border); padding: .65rem 1.25rem; display: flex; align-items: center; gap: .75rem; }
.icon-btn { width: 40px; height: 40px; border-radius: 12px; display: inline-grid; place-items: center; border: 1px solid var(--dm-border); background: var(--dm-surface); color: var(--dm-text); }
.icon-btn:hover { background: var(--dm-primary-soft); }
.app-content { padding: 1.5rem; flex: 1; animation: fadeUp .35s ease both; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.avatar { width: 36px; height: 36px; border-radius: 50%; background: linear-gradient(135deg, var(--dm-primary), color-mix(in srgb, var(--dm-primary) 60%, #7cc9ef)); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: .85rem; flex-shrink: 0; }
.avatar.lg { width: 76px; height: 76px; font-size: 1.6rem; }
.points-pill { background: #fff4d6; color: #8a5a00; border-radius: 999px; padding: .32rem .8rem; font-weight: 600; font-size: .85rem; display: inline-flex; align-items: center; gap: .35rem; }
html[data-bs-theme="dark"] .points-pill { background: rgba(250, 178, 25, .15); color: #fcd27b; }
.dropdown-menu { border-radius: 14px; border-color: var(--dm-border); box-shadow: var(--dm-shadow-lg); padding: .4rem; }
.dropdown-item { border-radius: 8px; }

@media (max-width: 991.98px) {
  .app-sidebar.offcanvas-lg { width: 284px; }
  .app-content { padding: 1rem .9rem 5.8rem; }
}
.bottom-nav { position: fixed; bottom: 0; left: 0; right: 0; z-index: 1030; background: var(--dm-surface); border-top: 1px solid var(--dm-border);
  display: flex; justify-content: space-around; padding: .35rem 0 calc(.35rem + env(safe-area-inset-bottom)); box-shadow: 0 -6px 18px rgba(16,33,64,.06); }
.bottom-nav a, .bottom-nav button { display: flex; flex-direction: column; align-items: center; font-size: .7rem; color: var(--dm-muted); padding: .2rem .6rem; border-radius: 12px; }
.bottom-nav button { background: none; border: 0; font: inherit; font-size: .7rem; }
.bottom-nav a .bi, .bottom-nav button .bi { font-size: 1.3rem; }
.bottom-nav a.active { color: var(--dm-primary); background: var(--dm-primary-soft); }
.bottom-nav a:hover { text-decoration: none; }

/* ---------- Toasts ---------- */
.toast-stack { position: fixed; top: 72px; right: 16px; z-index: 1090; display: flex; flex-direction: column; gap: .5rem; max-width: min(420px, calc(100vw - 32px)); }
.toast { border: 0; border-radius: 14px; box-shadow: var(--dm-shadow-lg); background: var(--dm-surface); color: var(--dm-text); overflow: hidden; }
.toast .toast-body { display: flex; gap: .7rem; align-items: flex-start; padding: .85rem 1rem; }
.toast .toast-icon { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; flex-shrink: 0; }
.toast.ok .toast-icon { background: rgba(12, 163, 12, .14); color: #0a8a0a; }
.toast.err .toast-icon { background: rgba(208, 59, 59, .14); color: #d03b3b; }
.toast.ok { border-left: 4px solid #0ca30c; } .toast.err { border-left: 4px solid #d03b3b; }

/* ---------- Cards & widgets ---------- */
.card { border: 1px solid var(--dm-border); border-radius: var(--dm-radius); background: var(--dm-surface); box-shadow: var(--dm-shadow); color: var(--dm-text); }
.card-header { background: transparent; border-bottom: 1px solid var(--dm-border); font-weight: 600; padding: .9rem 1.1rem; }
.card-header:first-child { border-radius: var(--dm-radius) var(--dm-radius) 0 0; }
.list-group-item { background: transparent; color: var(--dm-text); border-color: var(--dm-border); }
.list-group-item-action:hover { background: var(--dm-primary-soft); }
.card-title-sm { font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; color: var(--dm-muted); font-weight: 600; }

.stat-card { padding: 1.1rem 1.2rem; display: flex; flex-direction: row; align-items: center; gap: 1rem; transition: transform .15s, box-shadow .15s; }
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--dm-shadow-lg); }
.stat-card .icon { width: 50px; height: 50px; border-radius: 14px; display: grid; place-items: center; font-size: 1.4rem; background: var(--dm-primary-soft); color: var(--dm-primary); flex-shrink: 0; }
.stat-card .icon.i-amber { background: rgba(245, 158, 11, .14); color: #c27803; }
.stat-card .icon.i-green { background: rgba(12, 163, 12, .12); color: #0a8a0a; }
.stat-card .icon.i-rose  { background: rgba(232, 73, 104, .12); color: #d0355a; }
.stat-card .icon.i-violet{ background: rgba(109, 79, 216, .12); color: #6d4fd8; }
html[data-bs-theme="dark"] .stat-card .icon.i-amber { color: #fbbf24; } html[data-bs-theme="dark"] .stat-card .icon.i-green { color: #4ade80; }
html[data-bs-theme="dark"] .stat-card .icon.i-rose { color: #fb7185; } html[data-bs-theme="dark"] .stat-card .icon.i-violet { color: #a78bfa; }
.stat-card .value { font-size: 1.7rem; font-weight: 700; line-height: 1.05; }
.stat-card .label { color: var(--dm-muted); font-size: .85rem; }

.page-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem; margin-bottom: 1.25rem; }
.page-head h1 { font-size: 1.55rem; font-weight: 700; margin: 0; }

/* Welcome banner used on every dashboard */
.hello-banner { position: relative; overflow: hidden; border-radius: 20px; padding: 1.6rem 1.75rem; color: #fff; margin-bottom: 1.5rem;
  background: linear-gradient(120deg, var(--dm-primary) 0%, color-mix(in srgb, var(--dm-primary) 55%, #13315a) 100%); box-shadow: 0 10px 28px rgba(var(--dm-primary-rgb), .28); }
.hello-banner::after { content: ""; position: absolute; right: -60px; top: -60px; width: 240px; height: 240px; border-radius: 50%; background: rgba(255,255,255,.08); }
.hello-banner::before { content: ""; position: absolute; right: 120px; bottom: -90px; width: 180px; height: 180px; border-radius: 50%; background: rgba(255,255,255,.06); }
.hello-banner h1 { font-size: 1.6rem; font-weight: 700; margin-bottom: .3rem; }
.hello-banner p { opacity: .88; margin-bottom: 0; }
.hello-banner .mascot { position: absolute; right: 24px; bottom: -6px; width: 128px; height: 128px; border-radius: 24px; background: #fff; padding: 6px; box-shadow: 0 8px 20px rgba(0,0,0,.18); z-index: 1; }
.hello-banner .mascot img { width: 100%; height: 100%; object-fit: contain; }
.hello-banner .content { position: relative; z-index: 2; max-width: calc(100% - 150px); }
.hello-banner .btn-light { --bs-btn-bg: #fff; --bs-btn-color: #13315a; --bs-btn-border-color: #fff; --bs-btn-hover-bg: #eef5ff; --bs-btn-hover-color: #13315a; }
.hello-banner .btn-outline-light:hover { color: #13315a; }
@media (max-width: 575.98px) { .hello-banner .mascot { display: none; } .hello-banner .content { max-width: 100%; } }

.quick-action { display: flex; align-items: center; gap: .8rem; padding: .9rem 1rem; border-radius: 14px; border: 1px solid var(--dm-border); background: var(--dm-surface); color: var(--dm-text); transition: all .15s; }
.quick-action:hover { border-color: rgba(var(--dm-primary-rgb), .5); background: var(--dm-primary-soft); text-decoration: none; transform: translateY(-2px); }
.quick-action .bi { font-size: 1.35rem; color: var(--dm-primary); }

.course-card { transition: transform .18s, box-shadow .18s; height: 100%; overflow: hidden; }
.course-card:hover { transform: translateY(-3px); box-shadow: var(--dm-shadow-lg); }
.course-card .cover { height: 100px; display: flex; align-items: center; justify-content: space-between; padding: 0 1.25rem; color: #fff; font-size: 2.1rem; position: relative; overflow: hidden; }
.course-card .cover::after { content: ""; position: absolute; right: -30px; top: -30px; width: 130px; height: 130px; border-radius: 50%; background: rgba(255,255,255,.14); }
.progress { height: 8px; border-radius: 99px; background: color-mix(in srgb, var(--dm-border) 70%, transparent); }
.progress-bar { background: var(--dm-primary); border-radius: 99px; transition: width .9s cubic-bezier(.2,.8,.2,1); }
.empty-state { text-align: center; padding: 2.5rem 1rem; color: var(--dm-muted); }
.empty-state .bi { font-size: 2.6rem; display: block; margin-bottom: .5rem; opacity: .55; }
.table { --bs-table-bg: transparent; --bs-table-color: var(--dm-text); }
.table > :not(caption) > * > * { padding: .75rem .8rem; border-bottom-color: var(--dm-border); }
.table thead th { font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; color: var(--dm-muted); font-weight: 600; background: var(--dm-surface-2); }
.table-card { overflow-x: auto; }
.table-hover > tbody > tr:hover > * { --bs-table-bg-state: var(--dm-primary-soft); }
.nav-tabs { border-bottom-color: var(--dm-border); }
.nav-tabs .nav-link { border: 0; color: var(--dm-muted); font-weight: 500; border-bottom: 2px solid transparent; }
.nav-tabs .nav-link.active { color: var(--dm-primary); background: transparent; border-bottom-color: var(--dm-primary); }
.badge { font-weight: 600; border-radius: 8px; }

/* ---------- Charts ---------- */
.chart-card .card-body { padding: 1rem 1.1rem 1.1rem; }
.chart-card .chart-sub { color: var(--dm-muted); font-size: .85rem; margin-top: -.15rem; margin-bottom: .6rem; }
.chart-canvas { position: relative; width: 100%; }
.chart-empty { height: 180px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .4rem; color: var(--dm-muted); border: 1px dashed var(--dm-border); border-radius: 12px; }
.chart-empty .bi { font-size: 1.8rem; opacity: .55; }
.chart-table { margin-top: .6rem; font-size: .85rem; }
.chart-table summary { color: var(--dm-muted); cursor: pointer; font-size: .8rem; list-style: none; display: inline-flex; align-items: center; gap: .3rem; }
.chart-table summary::before { content: "\F4FE"; font-family: "bootstrap-icons"; }
.chart-table summary::-webkit-details-marker { display: none; }
.chart-table table { margin-top: .4rem; }

/* ---------- Lesson reader ---------- */
.lesson-body { font-size: 1.08rem; line-height: 1.9; }
.lesson-body h3 { font-size: 1.22rem; font-weight: 700; margin-top: 1.6rem; }
.lesson-body pre { background: #0f172a; color: #e2e8f0; padding: 1rem; border-radius: 12px; overflow-x: auto; font-size: .9rem; line-height: 1.5; }
.lesson-body code { font-size: .92em; }
.lesson-body table { width: 100%; margin: 1rem 0; border-collapse: collapse; }
.lesson-body th, .lesson-body td { border: 1px solid var(--dm-border); padding: .5rem .7rem; }
.lesson-body img { max-width: 100%; height: auto; border-radius: 12px; }
.lesson-body .callout { background: var(--dm-primary-soft); border-left: 4px solid var(--dm-primary); padding: .85rem 1rem; border-radius: 10px; margin: 1rem 0; }
.chapter-list .lesson-link { display: flex; align-items: center; gap: .6rem; padding: .55rem .75rem; border-radius: 10px; color: var(--dm-text); }
.chapter-list .lesson-link:hover { background: var(--dm-primary-soft); text-decoration: none; }
.chapter-list .lesson-link.current { background: var(--dm-primary-soft); font-weight: 600; color: var(--dm-primary); }
.accordion { --bs-accordion-bg: var(--dm-surface); --bs-accordion-border-color: var(--dm-border); --bs-accordion-active-bg: var(--dm-primary-soft); --bs-accordion-active-color: var(--dm-text); --bs-accordion-btn-focus-box-shadow: none; }
.ratio iframe { border-radius: 14px; }
.note-text { white-space: pre-wrap; word-break: break-word; line-height: 1.75; }
.reading-progress { position: fixed; top: 0; left: 0; height: 3px; background: var(--dm-primary); z-index: 1100; width: 0; transition: width .1s; }

/* ---------- Exams ---------- */
.q-card .opt { display: flex; align-items: center; gap: .75rem; border: 1px solid var(--dm-border); border-radius: 12px; padding: .75rem .95rem; margin-bottom: .5rem; cursor: pointer; transition: all .12s; background: var(--dm-surface); }
.q-card .opt:hover { background: var(--dm-primary-soft); border-color: rgba(var(--dm-primary-rgb), .4); }
.q-card input[type=radio] { display: none; }
.q-card input[type=radio]:checked + .opt { border-color: var(--dm-primary); background: var(--dm-primary-soft); box-shadow: 0 0 0 3px rgba(var(--dm-primary-rgb), .12); }
.q-card .opt .key { width: 32px; height: 32px; border-radius: 50%; border: 1px solid var(--dm-border); display: grid; place-items: center; font-weight: 600; flex-shrink: 0; }
.q-card input[type=radio]:checked + .opt .key { background: var(--dm-primary); color: #fff; border-color: var(--dm-primary); }
.opt.correct { border-color: #0ca30c !important; background: rgba(12, 163, 12, .08) !important; }
.opt.wrong { border-color: #d03b3b !important; background: rgba(208, 59, 59, .08) !important; }
.exam-timer { position: sticky; top: 72px; z-index: 5; }
.timer-box { font-variant-numeric: tabular-nums; font-size: 1.4rem; font-weight: 700; }
.timer-box.danger { color: #d03b3b; animation: pulse 1s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .55; } }
.timer-track { height: 4px; background: var(--dm-border); border-radius: 4px; overflow: hidden; }
.timer-track > div { height: 100%; background: var(--dm-primary); transition: width 1s linear; }
.q-nav { display: flex; flex-wrap: wrap; gap: .35rem; }
.q-nav a { width: 32px; height: 32px; border-radius: 8px; display: grid; place-items: center; font-size: .8rem; font-weight: 600; border: 1px solid var(--dm-border); color: var(--dm-muted); }
.q-nav a.done { background: var(--dm-primary); color: #fff; border-color: var(--dm-primary); }
.q-nav a:hover { text-decoration: none; border-color: var(--dm-primary); }
.score-ring { width: 150px; height: 150px; border-radius: 50%; display: grid; place-items: center; margin: 0 auto;
  background: conic-gradient(var(--dm-primary) calc(var(--p) * 1%), var(--dm-border) 0); }
.score-ring > div { width: 120px; height: 120px; border-radius: 50%; background: var(--dm-surface); display: grid; place-items: center; font-size: 1.9rem; font-weight: 700; }

/* ---------- Public site ---------- */
.public-nav { background: color-mix(in srgb, var(--dm-surface) 88%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--dm-border); }
.public-nav .nav-link { color: var(--dm-text); font-weight: 500; }
.public-brand img { width: 40px; height: 40px; border-radius: 10px; object-fit: cover; background: #fff; }
.hero { position: relative; overflow: hidden; padding: 4.5rem 0 4rem;
  background: radial-gradient(900px 420px at 0% 0%, rgba(124, 201, 239, .35), transparent 60%),
              radial-gradient(700px 380px at 100% 10%, rgba(245, 158, 11, .14), transparent 60%), var(--dm-bg); }
.hero h1 { font-weight: 800; font-size: clamp(2.1rem, 5vw, 3.4rem); line-height: 1.18; letter-spacing: -.5px; }
.hero .lead { font-size: 1.18rem; color: var(--dm-muted); }
.hero-mascot { position: relative; max-width: 440px; margin: 0 auto; }
.hero-mascot .blob { position: absolute; inset: 6% 4%; border-radius: 42% 58% 55% 45% / 45% 40% 60% 55%; background: linear-gradient(135deg, #cdeefc, #a7dbf5); animation: morph 9s ease-in-out infinite; }
html[data-bs-theme="dark"] .hero-mascot .blob { background: linear-gradient(135deg, #16335a, #1f4d81); }
.hero-mascot img { position: relative; width: 100%; border-radius: 32px; mix-blend-mode: multiply; animation: float 5s ease-in-out infinite; }
html[data-bs-theme="dark"] .hero-mascot img { mix-blend-mode: normal; background: #fff; }
@keyframes float { 50% { transform: translateY(-10px); } }
@keyframes morph { 50% { border-radius: 55% 45% 40% 60% / 55% 60% 40% 45%; } }
.floating-chip { position: absolute; background: var(--dm-surface); border-radius: 14px; padding: .55rem .8rem; box-shadow: var(--dm-shadow-lg); font-size: .85rem; font-weight: 600; display: flex; align-items: center; gap: .45rem; z-index: 2; }
.floating-chip .bi { color: var(--dm-primary); font-size: 1.1rem; }
.feature { padding: 1.6rem; height: 100%; transition: transform .18s, box-shadow .18s; }
.feature:hover { transform: translateY(-3px); box-shadow: var(--dm-shadow-lg); }
.feature .icon { width: 54px; height: 54px; border-radius: 16px; display: grid; place-items: center; font-size: 1.5rem; background: var(--dm-primary-soft); color: var(--dm-primary); margin-bottom: 1rem; }
.step-num { width: 44px; height: 44px; border-radius: 50%; background: var(--dm-primary); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 1.1rem; margin: 0 auto .8rem; box-shadow: 0 6px 16px rgba(var(--dm-primary-rgb), .3); }
.cta-band { border-radius: 24px; padding: 2.5rem; color: #fff; background: linear-gradient(120deg, #13315a, #2a78d6); position: relative; overflow: hidden; }
.cta-band::after { content: ""; position: absolute; right: -80px; bottom: -80px; width: 260px; height: 260px; border-radius: 50%; background: rgba(124, 201, 239, .25); }
.section-alt { background: var(--dm-surface); border-top: 1px solid var(--dm-border); border-bottom: 1px solid var(--dm-border); }

/* Auth pages: brand panel + form */
.auth-split { min-height: calc(100vh - 66px); display: grid; grid-template-columns: 1fr; }
@media (min-width: 992px) { .auth-split { grid-template-columns: 5fr 7fr; } }
.auth-brand { display: none; position: relative; overflow: hidden; color: #fff; padding: 3rem; background: linear-gradient(160deg, #13315a 0%, #1f4d81 55%, #2a78d6 100%); }
@media (min-width: 992px) { .auth-brand { display: flex; flex-direction: column; justify-content: center; } }
.auth-brand .mascot { width: 220px; border-radius: 32px; background: #fff; padding: 10px; box-shadow: 0 16px 40px rgba(0,0,0,.25); animation: float 5s ease-in-out infinite; }
.auth-brand ul { list-style: none; padding: 0; margin: 1.5rem 0 0; }
.auth-brand li { display: flex; gap: .6rem; margin-bottom: .6rem; opacity: .92; }
.auth-brand::after { content: ""; position: absolute; width: 320px; height: 320px; border-radius: 50%; right: -120px; bottom: -120px; background: rgba(124, 201, 239, .18); }
.auth-form-wrap { display: grid; place-items: center; padding: 2rem 1rem; }
.auth-card { width: 100%; max-width: 460px; }
.auth-card.wide { max-width: 640px; }
.auth-wrap { min-height: calc(100vh - 140px); display: grid; place-items: center; padding: 2rem 1rem; }
footer.site-footer { background: #0c1a30; color: #9fb0c8; padding: 2.2rem 0; }
footer.site-footer a { color: #d3e0f2; }
.brand-logo { width: 34px; height: 34px; border-radius: 10px; background: var(--dm-primary); color: #fff; display: inline-grid; place-items: center; }

/* Motion preferences */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
/* Print: hide chrome */
@media print {
  .app-sidebar, .app-topbar, .bottom-nav, .toast-stack, .btn { display: none !important; }
  .app-content { padding: 0; }
  .card { box-shadow: none; }
}

/* ---------- Live classes ---------- */
.live-banner { display: flex; align-items: center; gap: .75rem; padding: .6rem 1.25rem; background: linear-gradient(90deg, #d03b3b, #e8577a); color: #fff; }
.live-dot { width: 10px; height: 10px; border-radius: 50%; background: #fff; box-shadow: 0 0 0 0 rgba(255,255,255,.7); animation: livePulse 1.6s infinite; flex-shrink: 0; }
@keyframes livePulse { 70% { box-shadow: 0 0 0 10px rgba(255,255,255,0); } 100% { box-shadow: 0 0 0 0 rgba(255,255,255,0); } }
.badge-live { background: #d03b3b; color: #fff; display: inline-flex; align-items: center; gap: .35rem; }
.badge-live::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: #fff; }
.live-card { border-left: 4px solid var(--dm-primary); }
.live-card.is-live { border-left-color: #d03b3b; }

/* ---------- Picture learning (all levels) ---------- */
.pic-thumb { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 12px; background: var(--dm-surface-2); border: 1px solid var(--dm-border); }
.pic-thumb.sm { width: 96px; }
.opt-img { width: 100%; max-width: 180px; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 10px; display: block; }
.q-image { max-width: 320px; width: 100%; border-radius: 14px; border: 1px solid var(--dm-border); }
.q-card .opt.pic { flex-direction: column; align-items: stretch; text-align: center; }
.pic-options { display: grid; grid-template-columns: repeat(2, 1fr); gap: .6rem; }
@media (min-width: 768px) { .pic-options { grid-template-columns: repeat(4, 1fr); } }
.pic-options .opt { margin-bottom: 0; }

/* ---------- Kids mode (Baby – Class 5): bigger, brighter, picture-first ---------- */
body.kids-mode { --dm-primary: #f97316; --dm-primary-rgb: 249, 115, 22; --dm-radius: 22px; font-size: 1.08rem;
  --dm-sidebar: linear-gradient(180deg, #7c2d12 0%, #c2410c 55%, #f97316 100%); }
html:not([data-bs-theme="dark"]) body.kids-mode { --dm-primary-soft: #fff1e6; --dm-bg: #fff8f1; }
html[data-bs-theme="dark"] body.kids-mode { --dm-primary-soft: rgba(249, 115, 22, .18); --dm-sidebar: linear-gradient(180deg, #2a1206 0%, #5a2308 100%); }
body.kids-mode .side-nav a { padding: .8rem .9rem; font-size: 1.05rem; }
body.kids-mode .side-nav a .bi { font-size: 1.35rem; }
body.kids-mode .side-nav a.active { box-shadow: inset 3px 0 0 #fde68a; }
body.kids-mode .btn { border-radius: 16px; }
body.kids-mode .btn-lg { padding: .9rem 1.6rem; font-size: 1.2rem; }
.kid-hero { border-radius: 28px; padding: 1.6rem; color: #fff; position: relative; overflow: hidden; margin-bottom: 1.5rem;
  background: linear-gradient(120deg, #f97316, #f59e0b 55%, #facc15); box-shadow: 0 12px 28px rgba(249, 115, 22, .3); }
.kid-hero h1 { font-size: clamp(1.6rem, 4vw, 2.3rem); font-weight: 800; }
.kid-hero .mascot { width: 140px; height: 140px; border-radius: 28px; background: #fff; padding: 8px; box-shadow: 0 10px 24px rgba(0,0,0,.18); animation: float 5s ease-in-out infinite; }
.kid-hero .mascot img { width: 100%; height: 100%; object-fit: contain; }
.star-count { display: inline-flex; align-items: center; gap: .5rem; background: rgba(255,255,255,.22); padding: .45rem 1rem; border-radius: 999px; font-weight: 700; font-size: 1.2rem; }
.kid-tile { display: block; border-radius: 24px; overflow: hidden; background: var(--dm-surface); border: 3px solid transparent; box-shadow: var(--dm-shadow);
  transition: transform .18s, border-color .18s; color: var(--dm-text); height: 100%; }
.kid-tile:hover { transform: translateY(-4px) rotate(-.4deg); border-color: var(--dm-primary); text-decoration: none; }
.kid-tile img, .kid-tile .kid-tile-art { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; display: block; }
.kid-tile .kid-tile-art { display: grid; place-items: center; font-size: 4rem; color: #fff; }
.kid-tile .body { padding: .9rem 1rem 1.1rem; }
.kid-tile .title { font-weight: 700; font-size: 1.15rem; }
.kid-tile .done-badge { position: absolute; top: 10px; right: 10px; background: #16a34a; color: #fff; border-radius: 999px; padding: .2rem .6rem; font-size: .85rem; font-weight: 600; }
.kid-progress { height: 14px; border-radius: 99px; background: var(--dm-border); overflow: hidden; }
.kid-progress > div { height: 100%; background: linear-gradient(90deg, #22c55e, #84cc16); border-radius: 99px; transition: width 1s; }
/* Slideshow */
.kid-slides .carousel-item img { width: 100%; max-height: 62vh; object-fit: contain; background: var(--dm-surface-2); border-radius: 24px; }
.kid-caption { font-size: clamp(1.4rem, 3.5vw, 2.1rem); font-weight: 700; text-align: center; margin-top: 1rem; }
.kid-slides .carousel-control-prev, .kid-slides .carousel-control-next { width: 64px; height: 64px; top: 40%; border-radius: 50%; background: var(--dm-primary); opacity: .92; }
.kid-slides .carousel-control-prev { left: 8px; } .kid-slides .carousel-control-next { right: 8px; }
.kid-dots { display: flex; justify-content: center; gap: .5rem; margin-top: .8rem; }
.kid-dots button { width: 14px; height: 14px; border-radius: 50%; border: 0; background: var(--dm-border); }
.kid-dots button.active { background: var(--dm-primary); width: 32px; border-radius: 99px; }
body.kids-mode .q-card .opt { padding: 1rem; font-size: 1.15rem; border-width: 2px; }
body.kids-mode .q-card .opt .key { width: 40px; height: 40px; font-size: 1.1rem; }
body.kids-mode .q-card .opt.pic .key { margin: .5rem auto 0; }
.celebrate { font-size: 3.5rem; animation: pop .6s ease; display: inline-block; }
@keyframes pop { 0% { transform: scale(.3); } 70% { transform: scale(1.2); } 100% { transform: scale(1); } }

/* ---------- Subjects (landing) ---------- */
.subject-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .75rem; }
.subject-tile { --sc: #2a78d6; display: flex; flex-direction: column; align-items: flex-start; gap: .35rem; padding: .9rem 1rem;
  border-radius: 16px; background: var(--dm-surface); border: 1px solid var(--dm-border); color: var(--dm-text); text-decoration: none;
  transition: transform .15s, box-shadow .15s, border-color .15s; }
.subject-tile:hover { transform: translateY(-2px); box-shadow: var(--dm-shadow); border-color: var(--sc); color: var(--dm-text); }
.subject-tile.active { border-color: var(--sc); box-shadow: 0 0 0 2px var(--sc) inset; }
.subject-tile .si { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; font-size: 1.25rem;
  color: var(--sc); background: color-mix(in srgb, var(--sc) 14%, transparent); }
.subject-tile .sn { font-weight: 700; line-height: 1.25; }
.subject-tile .sc { font-size: .78rem; color: var(--dm-muted, #6b7280); }
.class-chips { display: flex; flex-wrap: wrap; gap: .4rem; }
.class-chips .chip { padding: .35rem .8rem; border-radius: 99px; border: 1px solid var(--dm-border); background: var(--dm-surface);
  color: var(--dm-text); text-decoration: none; font-size: .88rem; }
.class-chips .chip:hover { border-color: #2a78d6; }
.class-chips .chip.active { background: #2a78d6; border-color: #2a78d6; color: #fff; }

/* ---------- Google / Microsoft sign-in ---------- */
.social-btn { display: flex; align-items: center; justify-content: center; gap: .6rem; font-size: 1rem; background: var(--dm-surface); }
.social-btn .bi { font-size: 1.15rem; }
.or-divider { display: flex; align-items: center; gap: .75rem; color: var(--dm-muted); font-size: .85rem; margin: 1.1rem 0; }
.or-divider::before, .or-divider::after { content: ""; flex: 1; border-top: 1px solid var(--dm-border); }

/* ---------- Live class room (Zoom-style) ---------- */
.room-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: .75rem; margin-bottom: 1rem; }
.meet-stage { position: relative; height: calc(100vh - 230px); min-height: 420px; border-radius: 18px; overflow: hidden;
  background: #0b1220; color: #e8ecf4; }
.meet-stage #meet { position: absolute; inset: 0; }
.meet-stage #meet iframe { border: 0; }
.stage-msg { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 2rem; gap: .25rem; }
.stage-msg > .bi { font-size: 3rem; opacity: .8; margin-bottom: .5rem; }
.stage-msg .text-muted-2 { color: #aab4c6 !important; }
.room-tools { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; }
.room-tools .btn.active { background: #2a78d6; color: #fff; }
#attList .dot { width: 8px; height: 8px; border-radius: 50%; background: #c3c2b7; flex-shrink: 0; }
#attList .dot.on { background: #16a34a; }
@media (max-width: 575px) { .meet-stage { height: 70vh; min-height: 360px; border-radius: 12px; } }
.zoom-badge { display: inline-flex; align-items: center; gap: .4rem; background: #2d8cff; color: #fff; font-weight: 700; padding: .3rem .8rem; border-radius: 99px; }
.zoom-clock { color: #aab4c6; }
.zoom-clock.warn { color: #ffb74d; font-weight: 600; }

/* ---------- "Install DigiMind" banner (PWA) ---------- */
.install-banner { position: fixed; left: 12px; right: 12px; bottom: 12px; z-index: 1080; max-width: 460px; margin: 0 auto;
  display: flex; align-items: center; gap: .75rem; padding: .7rem .8rem; border-radius: 16px;
  background: var(--dm-surface); color: var(--dm-text); border: 1px solid var(--dm-border); box-shadow: var(--dm-shadow-lg);
  padding-bottom: calc(.7rem + env(safe-area-inset-bottom)); animation: dmUp .3s ease-out; }
.install-banner img { width: 44px; height: 44px; border-radius: 12px; flex-shrink: 0; }
.install-banner .txt { flex: 1; min-width: 0; line-height: 1.25; }
.install-banner .txt strong { display: block; }
.install-banner .txt span { font-size: .85rem; color: var(--dm-muted); }
@keyframes dmUp { from { transform: translateY(20px); opacity: 0; } to { transform: none; opacity: 1; } }
/* opened from the home-screen icon: room for the phone's status bar */
@media (display-mode: standalone) { body { padding-top: env(safe-area-inset-top); } }
.pre-line { white-space: pre-line; }

/* ---------- Downloads ---------- */
.dl-row { display: flex; align-items: center; gap: .75rem; padding: .6rem 0; border-top: 1px solid var(--dm-border); }
.dl-row:first-of-type { border-top: 0; }
.subject-dot { width: 30px; height: 30px; border-radius: 9px; color: #fff; display: grid; place-items: center; flex-shrink: 0; }

/* ---------- Admin documentation ---------- */
.doc-icon { width: 52px; height: 52px; border-radius: 14px; background: #2a78d6; color: #fff; display: grid; place-items: center; font-size: 1.5rem; flex-shrink: 0; }
.doc-toc { position: sticky; top: 84px; }
.doc-body { line-height: 1.65; }
.doc-body h2 { font-size: 1.3rem; font-weight: 700; margin: 1.8rem 0 .7rem; padding-bottom: .3rem; border-bottom: 2px solid #2a78d6; scroll-margin-top: 80px; }
.doc-body h3 { font-size: 1.05rem; font-weight: 700; margin: 1.1rem 0 .4rem; }
.doc-body code { font-size: .86em; }
.doc-cover { border-left: 6px solid #2a78d6; padding: .5rem 0 .5rem 1rem; margin-bottom: 1rem; }
.doc-cover h1 { font-size: 1.7rem; font-weight: 700; margin: .25rem 0 .5rem; }
.doc-kicker { text-transform: uppercase; letter-spacing: .08em; font-size: .78rem; font-weight: 700; color: #2a78d6; }
.doc-lead { font-size: 1.05rem; color: var(--dm-muted); }
.doc-meta { border-collapse: collapse; font-size: .9rem; }
.doc-meta th { padding: 2px 14px 2px 0; color: var(--dm-muted); font-weight: 600; white-space: nowrap; vertical-align: top; }
.doc-meta td { padding: 2px 0; }
.doc-table { width: 100%; border-collapse: collapse; margin: .5rem 0 1rem; font-size: .9rem; }
.doc-table th, .doc-table td { border: 1px solid var(--dm-border); padding: 6px 9px; vertical-align: top; text-align: left; }
.doc-table th { background: color-mix(in srgb, #2a78d6 10%, transparent); }
.doc-grid3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: .75rem; margin: .75rem 0 1rem; }
.doc-box { border: 1px solid var(--dm-border); border-top: 4px solid #2a78d6; border-radius: 10px; padding: .7rem .85rem; }
.doc-box b { display: block; margin-bottom: .2rem; }
.doc-box span { font-size: .9rem; color: var(--dm-muted); }
.doc-layers { display: grid; gap: 6px; margin: .5rem 0 1rem; }
.doc-layers .layer { display: grid; grid-template-columns: 190px 1fr; gap: 10px; align-items: center; border-radius: 10px; padding: 8px 12px; color: #0b1a33; font-size: .9rem; }
.doc-layers .layer b { font-size: .92rem; }
.layer.l1 { background: #e3eefc; } .layer.l2 { background: #fde8dc; } .layer.l3 { background: #e7f6ec; }
.layer.l4 { background: #efe9fb; } .layer.l5 { background: #fff4d6; } .layer.l6 { background: #e9edf3; }
.doc-foot { margin-top: 2rem; padding-top: .5rem; border-top: 1px solid #ddd; font-size: .78rem; color: #777; }
.doc-print, .doc-print .doc-lead, .doc-print .doc-box span { color: #111; }
.doc-print .doc-table th, .doc-print .doc-table td, .doc-print .doc-box { border-color: #cfd6e0; }
@media (max-width: 575px) { .doc-layers .layer { grid-template-columns: 1fr; gap: 2px; } }

/* ---- pictures in courses, lessons, tutorials and notesheets ---- */
.lesson-body img { max-width: 100%; height: auto; border-radius: 12px; }
.lesson-body figure.pic { margin: 1.25rem 0; text-align: center; }
.lesson-body figure.pic img { border: 1px solid var(--dm-border); background: var(--dm-surface-2); }
.lesson-body figure.pic figcaption { font-size: .9rem; color: var(--dm-muted); margin-top: .4rem; }
.material-cover { width: 100%; aspect-ratio: 16 / 7; object-fit: cover; display: block; background: var(--dm-surface-2); }
.material-cover.lg { aspect-ratio: 16 / 6; max-height: 340px; }
.material-thumb { width: 44px; height: 44px; object-fit: cover; border-radius: 10px; flex-shrink: 0; vertical-align: middle; border: 1px solid var(--dm-border); }
.course-cover { width: 100%; max-height: 260px; object-fit: cover; display: block; }
.lesson-cover { width: 100%; max-height: 360px; object-fit: cover; border-radius: 14px; display: block; }
.lesson-slides { background: var(--dm-surface-2); border-radius: 14px; overflow: hidden; }
.lesson-slides .carousel-item img { width: 100%; max-height: 460px; object-fit: contain; display: block; margin: 0 auto; }
.lesson-slides .lesson-slide-caption { text-align: center; padding: .5rem 1rem .75rem; font-weight: 600; }
.lesson-slides .carousel-control-prev-icon, .lesson-slides .carousel-control-next-icon { filter: drop-shadow(0 0 3px rgba(0,0,0,.7)); }
@media (max-width: 575.98px) { .material-cover.lg { aspect-ratio: 16 / 9; } .lesson-slides .carousel-item img { max-height: 300px; } }

/* bottom menu on phones for every role: keep the install banner above it */
@media (max-width: 991.98px) { body:has(.bottom-nav) .install-banner { bottom: calc(72px + env(safe-area-inset-bottom)); } }

/* ---- interactive lesson parts: "নিজে যাচাই করো" questions with hidden answers ---- */
.lesson-body details.check { border: 1px solid var(--dm-border); border-left: 4px solid var(--dm-primary); border-radius: 12px;
  padding: .6rem .9rem; margin: .6rem 0; background: var(--dm-surface); }
.lesson-body details.check > summary { cursor: pointer; font-weight: 600; list-style: none; position: relative; padding-right: 7rem; }
.lesson-body details.check > summary::-webkit-details-marker { display: none; }
.lesson-body details.check > summary::after { content: "উত্তর দেখো ▾"; position: absolute; right: 0; top: 0; font-size: .8rem; font-weight: 600;
  color: var(--dm-primary); background: var(--dm-primary-soft); border-radius: 999px; padding: .1rem .6rem; }
.lesson-body details.check[open] > summary::after { content: "লুকাও ▴"; }
.lesson-body details.check[open] { background: var(--dm-primary-soft); }
.lesson-body details.check > :not(summary) { margin: .5rem 0 0; }
.lesson-body table { width: 100%; margin: .75rem 0; }
.lesson-body kbd { background: var(--dm-surface-2); color: var(--dm-text); border: 1px solid var(--dm-border); border-bottom-width: 3px; }
@media print { .lesson-body details.check > summary::after { display: none; } }

/* ---------- Rich text editor (Summernote) ---------- */
.note-editor.note-frame { border: 1px solid var(--dm-border) !important; border-radius: 12px; overflow: visible; }
.note-editor .note-toolbar { background: var(--dm-surface-2); border-bottom: 1px solid var(--dm-border); border-radius: 12px 12px 0 0;
  position: sticky; top: 62px; z-index: 5; padding: .35rem .4rem .1rem; }
.note-editor .note-toolbar .note-btn { background: var(--dm-surface); color: var(--dm-text); border-color: var(--dm-border); font-size: .85rem; }
.note-editor .note-toolbar .note-btn:hover, .note-editor .note-toolbar .note-btn.active { background: var(--dm-primary-soft); }
.note-editor .note-editing-area .note-editable { background: var(--dm-surface); color: var(--dm-text); padding: 1rem 1.25rem; }
.note-editor .note-editing-area .note-codable { background: #0f172a; color: #e2e8f0; }
.note-editor .note-statusbar { background: var(--dm-surface-2); border-radius: 0 0 12px 12px; }
.note-editor .note-placeholder { padding: 1rem 1.25rem; }
.note-editable details.check > summary::after, .note-editable details.check[open] > summary::after { content: "উত্তর (শিক্ষার্থী খুলে দেখবে)"; }
.note-editable img[data-dm-up] { opacity: .45; outline: 2px dashed var(--dm-primary); }
.note-editor.fullscreen { z-index: 1090; background: var(--dm-surface); }
.note-editor.fullscreen .note-toolbar { top: 0; }
.dm-sym-menu { width: 15.5rem; padding: .4rem !important; }
.dm-sym-menu .btn { min-width: 2rem; margin: 1px; padding: .1rem .35rem; }
.note-modal .modal-dialog { margin-top: 4rem; }
/* math / science symbols for plain-text fields */
.dm-symbols { display: flex; flex-wrap: wrap; gap: .25rem; margin: .35rem 0 .75rem; }
.dm-symbols .btn { min-width: 2rem; padding: .1rem .4rem; font-size: .95rem; line-height: 1.4; }

/* ---------- list filter bars (manage pages) ---------- */
.filter-bar { padding: .75rem .9rem; }
.filter-bar .form-label { color: var(--dm-muted); font-weight: 600; }
@media (max-width: 767.98px) { .filter-bar .btn { flex: 1; } }

/* ---------- Code Lab: runnable code boxes ---------- */
.code-runner > pre.run-stdin { display: none; }
.code-runner > pre[class*="run-"] { position: relative; }
.cr { border: 1px solid var(--dm-border); border-radius: 12px; margin: 1rem 0 1.25rem; background: var(--dm-surface); overflow: hidden; line-height: 1.5; font-size: 1rem; }
.cr-bar { display: flex; align-items: center; gap: .35rem; padding: .4rem .5rem; background: var(--dm-surface-2); border-bottom: 1px solid var(--dm-border); flex-wrap: wrap; }
.cr-lang { font-size: .8rem; font-weight: 700; color: var(--dm-muted); text-transform: uppercase; letter-spacing: .03em; }
.cr-spacer { flex: 1; }
.cr-editor .CodeMirror { height: auto; min-height: 60px; font-size: .92rem; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; background: #0f172a; color: #e2e8f0; }
.cr-editor .CodeMirror-gutters { background: #0b1222; border-right: 1px solid #1e293b; }
.cr-editor .CodeMirror-linenumber { color: #64748b; }
.cr-editor .CodeMirror-cursor { border-left-color: #e2e8f0; }
.cr-editor .CodeMirror-selected, .cr-editor .CodeMirror-focused .CodeMirror-selected { background: #334155; }
.cr-editor .cm-keyword { color: #c084fc; } .cr-editor .cm-def, .cr-editor .cm-variable-2 { color: #93c5fd; }
.cr-editor .cm-string, .cr-editor .cm-string-2 { color: #86efac; } .cr-editor .cm-number { color: #fca5a5; }
.cr-editor .cm-comment { color: #64748b; font-style: italic; } .cr-editor .cm-builtin, .cr-editor .cm-type { color: #fcd34d; }
.cr-editor .cm-tag { color: #f472b6; } .cr-editor .cm-attribute, .cr-editor .cm-property { color: #fdba74; }
.cr-editor .cm-operator, .cr-editor .cm-meta { color: #e2e8f0; } .cr-editor .cm-variable { color: #e2e8f0; }
.cr-editor .CodeMirror-matchingbracket { color: #fde047 !important; text-decoration: underline; }
.cr-editor textarea { width: 100%; min-height: 160px; border: 0; padding: .75rem; font-family: ui-monospace, Consolas, monospace; font-size: .9rem; background: #0f172a; color: #e2e8f0; }
.cr-ready .cr-editor textarea { display: none; }
.cr-input { padding: .5rem .75rem; border-top: 1px solid var(--dm-border); background: var(--dm-surface-2); }
.cr-result { border-top: 1px solid var(--dm-border); }
.cr-result-bar { display: flex; justify-content: space-between; align-items: center; padding: .2rem .75rem; font-size: .8rem; color: var(--dm-muted); background: var(--dm-surface-2); }
.cr-out { margin: 0; padding: .65rem .85rem; max-height: 340px; overflow: auto; white-space: pre-wrap; word-break: break-word;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .88rem; background: var(--dm-surface); color: var(--dm-text); border-radius: 0; }
.cr-out:empty { display: none; }
.cr-out .cr-err { color: #dc2626; } .cr-out .cr-info { color: var(--dm-muted); font-style: italic; } .cr-out .cr-echo { color: #16a34a; font-weight: 600; }
[data-bs-theme="dark"] .cr-out .cr-err { color: #f87171; } [data-bs-theme="dark"] .cr-out .cr-echo { color: #4ade80; }
.cr-tables { padding: 0 .75rem; } .cr-tables:not(:empty) { padding-top: .6rem; padding-bottom: .3rem; }
.cr-table { font-size: .85rem; margin-bottom: .25rem; } .lesson-body .cr-table th, .lesson-body .cr-table td { padding: .3rem .5rem; }
.cr-preview { width: 100%; border: 0; background: #fff; display: block; }
.lesson-body .cr pre { background: transparent; color: inherit; padding: .65rem .85rem; border-radius: 0; }
.code-lab .cr { margin: 0; }
@media (max-width: 575.98px) { .cr-out { max-height: 260px; } .cr-editor .CodeMirror { font-size: .85rem; } }

/* admin › backup: inline restore confirmation */
.dm-restore { position: relative; }
.dm-restore > summary { list-style: none; display: inline-block; }
.dm-restore > summary::-webkit-details-marker { display: none; }
.dm-restore-form { position: absolute; right: 0; top: calc(100% + 4px); width: 250px; z-index: 20; white-space: normal; }

/* ---------- question previews (admin) ---------- */
.opt-line { border: 1px solid var(--dm-border); background: var(--dm-surface); }
.opt-line.is-correct { border-color: #16a34a; background: color-mix(in srgb, #16a34a 12%, var(--dm-surface)); }
body.hide-answers .opt-line.is-correct { border-color: var(--dm-border); background: var(--dm-surface); }
body.hide-answers .ans, body.hide-answers .answer-guide { display: none !important; }
@media print {
  .preview-qs .card { break-inside: avoid; border: 0; padding: .25rem 0 !important; }
  .opt-line.is-correct { border-color: var(--dm-border); background: none; }
  .opt-line .ans, .preview-qs .ans { display: none !important; }
}
.cq-parts { list-style: none; padding-left: .25rem; }
.cq-parts li { margin: .25rem 0; }
.cq-parts .cq-k { font-weight: 700; margin-right: .25rem; }
.answer-guide { background: var(--dm-primary-soft); border-left: 4px solid var(--dm-primary); }
@media print { .written-q { break-inside: avoid; border: 0; } }
