/* Hatem Heiba Learning Portal — local styles, no external CDN required */
:root {
  --brand: #4f46e5;
  --brand-dark: #3730a3;
  --brand-soft: #eef2ff;
  --ink: #182236;
  --muted: #67738a;
  --border: #e5eaf2;
  --canvas: #f5f7fb;
  --surface: #ffffff;
  --soft: #fafbfe;
  --teal: #0f9c8b;
  --teal-soft: #e6faf6;
  --orange: #e88b30;
  --orange-soft: #fff4e6;
  --red: #d74a61;
  --red-soft: #fff0f2;
  --blue: #2376d6;
  --shadow: 0 18px 48px rgba(26, 39, 67, .09);
  --radius: 18px;
  --radius-sm: 11px;
  --sidebar: 278px;
  font-synthesis: none;
}
* { box-sizing: border-box; }
html { background: var(--canvas); min-height: 100%; }
body { margin: 0; min-height: 100vh; background: var(--canvas); color: var(--ink); font-family: "Segoe UI", Tahoma, Arial, "Noto Sans Arabic", sans-serif; font-size: 15px; line-height: 1.55; }
body[dir="rtl"] { font-family: Tahoma, "Segoe UI", Arial, "Noto Sans Arabic", sans-serif; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
input, select, textarea { width: 100%; color: var(--ink); background: #fff; border: 1px solid #dfe5ee; border-radius: 10px; padding: 10px 12px; outline: none; transition: border-color .16s, box-shadow .16s, background .16s; }
input:focus, select:focus, textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(79, 70, 229, .12); }
textarea { min-height: 84px; resize: vertical; }
input[type="checkbox"], input[type="radio"] { width: 17px; height: 17px; padding: 0; accent-color: var(--brand); }
input[type="color"] { padding: 3px; height: 42px; }
hr { border: 0; border-top: 1px solid var(--border); margin: 24px 0; }
.icon { width: 20px; height: 20px; flex: 0 0 auto; vertical-align: middle; }
.sr-only { position: absolute!important; width: 1px!important; height: 1px!important; padding: 0!important; margin: -1px!important; overflow: hidden!important; clip: rect(0,0,0,0)!important; white-space: nowrap!important; border: 0!important; }
.muted, small { color: var(--muted); }
code { padding: 3px 6px; border-radius: 6px; color: #31405d; background: #f2f5fa; font-size: .9em; direction: ltr; display: inline-block; }

/* Layout */
.app-shell { min-height: 100vh; display: flex; }
.sidebar { position: fixed; inset: 0 auto 0 0; z-index: 20; width: var(--sidebar); display: flex; flex-direction: column; padding: 22px 15px 16px; color: #e6ebff; background: #18223a; background-image: radial-gradient(circle at 10% 0%, rgba(111, 102, 255, .34), transparent 32%), linear-gradient(156deg, #1c2945, #151d31 72%); }
[dir="rtl"] .sidebar { inset: 0 0 0 auto; }
.app-main { width: calc(100% - var(--sidebar)); margin-inline-start: var(--sidebar); min-height: 100vh; }
/* In RTL, inline-start is the right side. Reserve space there for the right sidebar. */
[dir="rtl"] .app-main { margin-inline-start: var(--sidebar); margin-inline-end: 0; }
.brand { display: flex; align-items: center; gap: 11px; padding: 4px 9px 25px; color: #fff; }
.brand__mark { width: 43px; height: 43px; display: grid; place-items: center; overflow: hidden; border-radius: 14px; color: var(--brand); background: #fff; box-shadow: 0 7px 18px rgba(0,0,0,.16); font-size: 15px; font-weight: 800; }
.brand__mark img { width: 100%; height: 100%; object-fit: cover; }
.brand__mark--large { width: 72px; height: 72px; border-radius: 22px; font-size: 21px; }
/* The supplied teacher logo is horizontal, so it is displayed uncropped. */
.brand--image { flex-direction: column; align-items: stretch; gap: 9px; padding: 2px 6px 20px; }
.brand__mark--image { width: 100%; height: auto; aspect-ratio: 1391 / 752; color: transparent; background: #061a2d; border-radius: 12px; box-shadow: 0 8px 20px rgba(0,0,0,.25); }
.brand__mark--image img { object-fit: cover; }
.brand--image .brand__words { align-items: center; text-align: center; }
.brand--image .brand__words strong { max-width: 100%; }
.brand__words { min-width: 0; display: grid; }
.brand__words strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.brand__words small { color: #aab5d4; font-size: 11px; }
.side-nav { display: flex; flex: 1; flex-direction: column; gap: 3px; overflow-y: auto; padding-bottom: 14px; }
.side-nav__label { padding: 21px 12px 6px; color: #9eacca; font-size: 10px; font-weight: 800; letter-spacing: .09em; text-transform: uppercase; }
.side-nav__item { display: flex; align-items: center; gap: 12px; min-height: 45px; padding: 0 12px; color: #b7c3df; border-radius: 11px; transition: .15s ease; font-weight: 600; }
.side-nav__item:hover { background: rgba(255,255,255,.08); color: #fff; }
.side-nav__item.is-active { color: #fff; background: rgba(124, 113, 255, .33); box-shadow: inset 0 0 0 1px rgba(255,255,255,.07); }
.sidebar__footer { padding-top: 14px; border-top: 1px solid rgba(255,255,255,.11); }
.user-mini { display: flex; align-items: center; gap: 9px; padding: 0 7px 12px; }
.user-mini span:last-child { display: grid; min-width: 0; }
.user-mini strong { overflow: hidden; color: #fff; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.user-mini small { color: #aab5d4; font-size: 11px; }
.avatar { width: 36px; height: 36px; display: inline-grid; place-items: center; flex: 0 0 auto; overflow: hidden; border-radius: 50%; color: #fff; background: linear-gradient(135deg, var(--brand), #7c3aed); font-weight: 800; }
.avatar--small { width: 30px; height: 30px; font-size: 12px; }
.avatar--large { width: 74px; height: 74px; margin-bottom: 10px; font-size: 28px; }
.avatar--top { transition: transform .15s; }
.avatar--top:hover { transform: translateY(-1px); }
.signout-form { margin: 0; }
.signout { width: 100%; display: flex; align-items: center; gap: 10px; padding: 8px 9px 0; color: #b7c3df; background: transparent; border: 0; font-size: 13px; text-align: inherit; }
.signout:hover { color: #fff; }
.topbar { height: 76px; display: flex; align-items: center; gap: 18px; padding: 0 clamp(20px, 4vw, 56px); background: rgba(255,255,255,.84); border-bottom: 1px solid #ebeff5; backdrop-filter: blur(10px); }
.global-search { position: relative; display: flex; align-items: center; width: min(475px, 55vw); }
.global-search .icon { position: absolute; inset-inline-start: 12px; color: #8b96aa; width: 19px; pointer-events: none; }
.global-search input { padding-inline-start: 40px; border-color: transparent; background: #f2f4f9; }
.global-search input:focus { border-color: var(--brand); background: #fff; }
.topbar__actions { display: flex; align-items: center; gap: 14px; margin-inline-start: auto; }
.language-switch { display: inline-flex; align-items: center; justify-content: center; min-height: 33px; padding: 0 10px; border: 1px solid var(--border); border-radius: 9px; color: #536078; background: #fff; font-size: 12px; font-weight: 700; }
.language-switch:hover { color: var(--brand); border-color: #c7c9fc; }
.icon-button { width: 34px; height: 34px; display: inline-grid; place-items: center; flex: 0 0 auto; padding: 0; color: #536078; background: #fff; border: 1px solid var(--border); border-radius: 9px; transition: .14s; }
.icon-button .icon { width: 17px; height: 17px; }
.icon-button:hover { color: var(--brand); border-color: #c8ccff; background: var(--brand-soft); }
.icon-button--danger:hover { color: var(--red); border-color: #facdd3; background: var(--red-soft); }
.mobile-menu { display: none; }
.sidebar-overlay { display: none; }
.content-wrap { max-width: 1500px; margin: auto; padding: 37px clamp(20px, 4vw, 56px) 58px; }

/* Headlines and actions */
.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin: 0 0 28px; }
.page-heading h1 { margin: 4px 0 6px; color: #17233a; font-size: clamp(26px, 3vw, 33px); letter-spacing: -.025em; line-height: 1.2; }
.page-heading p { max-width: 700px; margin: 0; color: var(--muted); }
.page-heading__actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 9px; }
.eyebrow { display: inline-block; color: var(--brand); font-size: 11px; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 15px; margin: 31px 0 15px; }
.section-heading h2, .card-panel h2 { margin: 0; color: #202a3d; font-size: 18px; }
.section-heading p { margin: 2px 0 0; color: var(--muted); font-size: 13px; }
.text-link { display: inline-flex; align-items: center; gap: 5px; color: var(--brand); font-size: 13px; font-weight: 800; }
.text-link .icon { width: 16px; height: 16px; transition: transform .15s; }
.text-link:hover .icon { transform: translateX(3px); }
[dir="rtl"] .text-link:hover .icon { transform: translateX(-3px); }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 0 14px; border: 1px solid transparent; border-radius: 10px; font-weight: 750; font-size: 13px; transition: .15s ease; }
.button .icon { width: 17px; height: 17px; }
.button--primary { color: #fff; background: var(--brand); box-shadow: 0 7px 15px rgba(79,70,229,.18); }
.button--primary:hover { background: var(--brand-dark); transform: translateY(-1px); box-shadow: 0 10px 20px rgba(79,70,229,.24); }
.button--secondary { color: #34415d; background: #edf1f6; }
.button--secondary:hover { background: #e4eaf3; }
.button--ghost { color: #3e4b65; background: #fff; border-color: var(--border); }
.button--ghost:hover { color: var(--brand); border-color: #c9caff; background: #fafaff; }
.button--danger { color: #fff; background: var(--red); }
.button--danger:hover { background: #b9364d; }
.button--light { color: var(--brand); background: #fff; }
.button--full { width: 100%; }
.button--small { min-height: 32px; padding: 0 10px; font-size: 12px; }

/* Generic surfaces */
.card, .card-panel, .table-card, .filter-card { background: var(--surface); border: 1px solid #e9edf4; border-radius: var(--radius); box-shadow: 0 5px 20px rgba(25,39,68,.035); }
.card { padding: 24px; }
.card-panel { padding: 22px; }
.content-columns { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 20px; margin-top: 27px; }
.two-column { display: grid; grid-template-columns: 1fr 1.5fr; gap: 20px; }
.two-column--narrow { max-width: 920px; grid-template-columns: minmax(200px,.7fr) 1.3fr; }
.profile-card { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 260px; text-align: center; }
.profile-card h2 { margin: 4px 0 0; }
.profile-card p { margin: 0 0 10px; color: var(--muted); }
.empty-state { display: grid; justify-items: center; max-width: 520px; margin: 30px auto; padding: 42px 24px; text-align: center; }
.empty-state__icon { width: 55px; height: 55px; display: grid; place-items: center; margin-bottom: 10px; color: var(--brand); background: var(--brand-soft); border-radius: 18px; }
.empty-state__icon .icon { width: 28px; height: 28px; }
.empty-state h3 { margin: 6px 0; font-size: 18px; }
.empty-state p { max-width: 350px; margin: 0 0 16px; color: var(--muted); }
.badge { display: inline-flex; align-items: center; justify-content: center; width: max-content; min-height: 25px; padding: 2px 9px; border-radius: 99px; font-size: 11px; font-weight: 800; white-space: nowrap; }
.badge--neutral { color: #58657a; background: #eef1f5; }
.badge--brand { color: var(--brand); background: var(--brand-soft); }
.badge--success { color: #168370; background: #e4f8f2; }
.badge--warning { color: #ab6818; background: #fff2dd; }
.badge--danger { color: #bd3c51; background: #ffeaee; }
.alert { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; padding: 12px 14px; border-radius: 12px; font-weight: 600; }
.alert button { border: 0; color: inherit; background: transparent; font-size: 20px; line-height: 1; }
.alert--success { color: #087864; background: #e6f8f2; }
.alert--danger { color: #ac3147; background: #ffeaee; }
.alert--warning { color: #8b5b18; background: #fff4df; }
.alert--info { color: #3d4ab6; background: #edf0ff; }

/* Student home */
.metric-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 16px; }
.metric-grid--four { grid-template-columns: repeat(4, minmax(0,1fr)); }
.metric-card { position: relative; display: flex; align-items: center; min-height: 105px; gap: 13px; padding: 17px; overflow: hidden; color: var(--ink); background: #fff; border: 1px solid #e7ecf5; border-radius: 16px; box-shadow: 0 7px 20px rgba(22,37,65,.035); }
.metric-card--link:hover { transform: translateY(-2px); border-color: #d5dafb; box-shadow: 0 12px 26px rgba(37,53,90,.09); }
.metric-card--link > .icon { width: 16px; color: #9da8ba; margin-inline-start: auto; }
.metric-card__icon { width: 45px; height: 45px; display: grid; place-items: center; border-radius: 13px; }
.metric-card__icon .icon { width: 23px; height: 23px; }
.metric-card__icon--brand { color: var(--brand); background: var(--brand-soft); }
.metric-card__icon--teal { color: var(--teal); background: var(--teal-soft); }
.metric-card__icon--orange { color: var(--orange); background: var(--orange-soft); }
.metric-card__icon--blue { color: var(--blue); background: #e9f3ff; }
.metric-card div { display: grid; }
.metric-card span:not(.metric-card__icon) { color: var(--muted); font-size: 12px; font-weight: 650; }
.metric-card strong { color: #202b40; font-size: 26px; line-height: 1.15; }
.metric-card strong small { margin-inline-start: 2px; color: inherit; font-size: 12px; }
.subject-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 15px; }
.subject-grid--large { grid-template-columns: repeat(2, minmax(0,1fr)); }
.subject-card { position: relative; display: flex; align-items: center; gap: 14px; min-height: 114px; padding: 18px; overflow: hidden; background: #fff; border: 1px solid #e8edf5; border-radius: 16px; box-shadow: 0 5px 16px rgba(35,50,85,.025); transition: .16s ease; }
.subject-card::after { position: absolute; width: 140px; height: 140px; inset: auto -52px -72px auto; border-radius: 50%; background: var(--subject-color); opacity: .055; content: ""; }
[dir="rtl"] .subject-card::after { inset: auto auto -72px -52px; }
.subject-card:hover { transform: translateY(-2px); border-color: color-mix(in srgb, var(--subject-color) 28%, #e8edf5); box-shadow: 0 14px 24px rgba(35,50,85,.08); }
.subject-card > .icon { position: relative; z-index: 1; width: 18px; color: #9ba7b9; margin-inline-start: auto; }
.subject-card__mark { position: relative; z-index: 1; width: 46px; height: 46px; display: grid; place-items: center; flex: 0 0 auto; color: var(--subject-color); background: color-mix(in srgb, var(--subject-color) 12%, white); border-radius: 14px; font-size: 18px; font-weight: 850; }
.subject-card div { position: relative; z-index: 1; min-width: 0; }
.subject-card h3, .subject-card h2 { margin: 0; font-size: 16px; }
.subject-card h2 { font-size: 19px; }
.subject-card p { margin: 3px 0 0; color: var(--muted); font-size: 12px; }
.subject-card--large { min-height: 166px; align-items: flex-start; }
.subject-card--large .subject-card__mark { width: 54px; height: 54px; font-size: 22px; }
.subject-card__stats { display: flex; gap: 12px; margin-top: 12px; color: #66738a; font-size: 12px; }
.subject-card__stats span { display: flex; align-items: center; gap: 4px; }
.subject-card__stats .icon { width: 15px; height: 15px; }
.compact-list { display: grid; }
.compact-list__item { display: flex; align-items: center; gap: 11px; padding: 12px 0; border-bottom: 1px solid #edf0f4; }
.compact-list__item:last-child { border-bottom: 0; }
.compact-list__item:hover strong { color: var(--brand); }
.compact-list__item > span:nth-child(2) { min-width: 0; display: grid; }
.compact-list__item strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; transition: color .14s; }
.compact-list__item small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; }
.compact-list__item > .icon { width: 16px; height: 16px; margin-inline-start: auto; color: #a2acbc; }
.compact-list__icon { width: 34px; height: 34px; display: grid; place-items: center; flex: 0 0 auto; color: var(--subject-color, var(--brand)); background: color-mix(in srgb, var(--subject-color, var(--brand)) 10%, #fff); border-radius: 10px; }
.compact-list__icon .icon { width: 17px; }
.compact-list__icon--soft { color: var(--brand); background: var(--brand-soft); }

/* Subject / Lesson */
.tab-row { display: flex; gap: 7px; margin-bottom: 17px; overflow-x: auto; }
.tab { display: inline-flex; align-items: center; gap: 7px; padding: 8px 12px; color: #68748a; border-radius: 9px; font-size: 13px; font-weight: 750; white-space: nowrap; }
.tab:hover, .tab.is-active { color: var(--brand); background: var(--brand-soft); }
.tab span { padding: 1px 6px; border-radius: 20px; color: inherit; background: rgba(79,70,229,.1); font-size: 11px; }
.stack-section { margin-top: 24px; }
.lesson-list { display: grid; overflow: hidden; background: #fff; border: 1px solid #e9edf4; border-radius: var(--radius); }
.lesson-row { display: flex; align-items: center; gap: 17px; min-height: 90px; padding: 16px 20px; border-bottom: 1px solid #eef1f5; transition: background .14s; }
.lesson-row:last-child { border-bottom: 0; }
.lesson-row:hover { background: #fafbfe; }
.lesson-row:hover h3 { color: var(--brand); }
.lesson-row__number { width: 37px; height: 37px; display: grid; place-items: center; flex: 0 0 auto; color: var(--brand); background: var(--brand-soft); border-radius: 10px; font-size: 12px; font-weight: 800; }
.lesson-row > div { min-width: 0; }
.lesson-row h3 { margin: 0; font-size: 15px; transition: .14s; }
.lesson-row p { overflow: hidden; max-width: 750px; margin: 2px 0 3px; color: var(--muted); text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
.lesson-row > .icon { width: 18px; color: #a5afbe; margin-inline-start: auto; }
.inline-meta { display: flex; flex-wrap: wrap; gap: 12px; color: #718096; font-size: 11px; }
.inline-meta span { display: inline-flex; align-items: center; gap: 4px; }
.inline-meta .icon { width: 14px; height: 14px; }
.mini-task { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid #edf0f4; }
.mini-task:last-child { border-bottom: 0; }
.mini-task:hover strong { color: var(--brand); }
.mini-task > span { width: 32px; height: 32px; display: grid; place-items: center; flex: 0 0 auto; color: var(--brand); background: var(--brand-soft); border-radius: 9px; }
.mini-task .icon { width: 16px; height: 16px; }
.mini-task div { display: grid; min-width: 0; }
.mini-task strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
.mini-task small { font-size: 10px; }
.video-card { overflow: hidden; margin-bottom: 20px; background: #11192b; border-radius: var(--radius); box-shadow: var(--shadow); }
.video-card__label { display: flex; align-items: center; gap: 7px; padding: 10px 15px; color: #dee6fa; background: rgba(0,0,0,.22); font-size: 12px; font-weight: 700; }
.video-card__label .icon { width: 16px; color: #8ea3ff; }
.video-frame { position: relative; width: 100%; padding-top: 56.25%; }
.video-frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.lesson-layout, .assignment-layout, .grade-layout, .settings-layout { display: grid; grid-template-columns: minmax(0, 1fr) 310px; gap: 20px; align-items: start; }
.lesson-body { min-width: 0; }
.lesson-aside { display: grid; gap: 16px; }
.lesson-aside .card { padding: 19px; }
.lesson-aside h3 { display: flex; align-items: center; gap: 8px; margin: 0 0 13px; font-size: 15px; }
.lesson-aside h3 .icon { width: 18px; color: var(--brand); }
.rich-content { color: #29364c; font-size: 15px; line-height: 1.85; }
.rich-content h2, .rich-content h3, .rich-content h4 { margin: 1.35em 0 .55em; color: #1f2a3e; line-height: 1.35; }
.rich-content h2 { font-size: 22px; }
.rich-content h3 { font-size: 18px; }
.rich-content p { margin: 0 0 1em; }
.rich-content ul, .rich-content ol { padding-inline-start: 23px; margin: 0 0 1em; }
.rich-content li { margin: .3em 0; }
.rich-content blockquote { margin: 1.2em 0; padding: 10px 15px; color: #58657b; border-inline-start: 4px solid var(--brand); background: #f6f7ff; }
.rich-content a { color: var(--brand); text-decoration: underline; font-weight: 650; }
.rich-content table { width: 100%; border-collapse: collapse; margin: 1em 0; }
.rich-content th, .rich-content td { padding: 8px 10px; border: 1px solid var(--border); }
.resource-list { display: grid; }
.resource-item { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid #edf0f4; }
.resource-item:last-child { border-bottom: 0; }
.resource-item:hover strong { color: var(--brand); }
.resource-item > span:first-child { width: 30px; height: 30px; display: grid; place-items: center; color: var(--red); background: var(--red-soft); border-radius: 9px; }
.resource-item > span:first-child .icon { width: 16px; height: 16px; }
.resource-item > span:last-child { display: grid; min-width: 0; }
.resource-item strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
.resource-item small { font-size: 10px; text-transform: uppercase; }

/* Tasks / homework */
.task-list { display: grid; gap: 12px; }
.task-card { display: flex; align-items: center; gap: 16px; min-height: 104px; padding: 17px 20px; background: #fff; border: 1px solid #e8edf5; border-radius: var(--radius); transition: .15s; }
.task-card:hover { border-color: #d6dafb; box-shadow: 0 12px 24px rgba(33,48,79,.075); transform: translateY(-1px); }
.task-card__icon { width: 48px; height: 48px; display: grid; place-items: center; flex: 0 0 auto; color: var(--subject-color, var(--brand)); background: color-mix(in srgb, var(--subject-color, var(--brand)) 11%, white); border-radius: 14px; }
.task-card__icon .icon { width: 23px; height: 23px; }
.task-card__main { min-width: 0; }
.task-card__main h2 { overflow: hidden; margin: 1px 0; text-overflow: ellipsis; white-space: nowrap; font-size: 16px; }
.task-card__main p { margin: 0; color: var(--muted); font-size: 12px; }
.task-card__status { display: flex; align-items: center; gap: 12px; margin-inline-start: auto; }
.task-card__status > .icon { width: 17px; color: #a6b0bf; }
.assignment-meta { display: flex; flex-wrap: wrap; gap: 12px 22px; margin-bottom: 22px; padding-bottom: 17px; border-bottom: 1px solid var(--border); color: #68758b; font-size: 12px; }
.assignment-meta span { display: inline-flex; align-items: center; gap: 6px; }
.assignment-meta .icon { width: 16px; color: var(--brand); }
.assignment-meta strong { color: #263349; }
.submission-history { display: grid; gap: 10px; }
.submission-history__item { display: grid; gap: 5px; padding: 10px; background: #f8f9fc; border-radius: 10px; font-size: 12px; }
.submission-history__item > div { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.submission-history__item small { display: block; font-size: 10px; }
.submission-history__item p { margin: 2px 0; color: #66738a; }
.submission-history__link:hover { background: var(--brand-soft); }
.file-download-card { display: flex; align-items: center; gap: 10px; margin-top: 15px; padding: 12px; color: var(--brand); background: var(--brand-soft); border-radius: 11px; }
.file-download-card > .icon { width: 22px; }
.file-download-card span { display: grid; }
.file-download-card small { font-size: 10px; }
.form-page { max-width: 900px; }
.form-page--wide { max-width: 1150px; }
.form-stack { display: grid; gap: 16px; }
.form-stack--roomy { gap: 21px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 17px; }
.form-grid > label, .form-stack > label, .form-inline > label { display: grid; gap: 6px; color: #40506a; font-size: 12px; font-weight: 750; }
.form-grid__wide, .form-actions--full { grid-column: 1 / -1; }
.form-label, fieldset legend { display: block; margin-bottom: 7px; color: #40506a; font-size: 12px; font-weight: 750; }
.field-note { margin: -2px 0 10px; color: var(--muted); font-size: 11px; }
.form-actions { display: flex; align-items: center; gap: 10px; margin-top: 5px; }
.form-actions--sticky { position: sticky; bottom: 12px; z-index: 5; justify-content: flex-end; padding: 12px; background: rgba(255,255,255,.93); border: 1px solid #e6eaf1; border-radius: 13px; box-shadow: 0 10px 24px rgba(31,46,79,.1); backdrop-filter: blur(7px); }
.check-label { display: flex!important; align-items: center; gap: 8px; min-height: 38px; color: #46536a!important; font-size: 13px!important; font-weight: 650!important; }
.check-label--wide { grid-column: 1 / -1; }
.checkbox-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 9px; }
.check-card { display: flex; align-items: center; gap: 9px; padding: 10px; background: #fafbfe; border: 1px solid #e7ebf2; border-radius: 10px; }
.check-card:has(input:checked) { background: var(--brand-soft); border-color: #cfd0ff; }
.check-card span { display: grid; min-width: 0; }
.check-card strong { font-size: 12px; }
.check-card small { font-size: 10px; }
fieldset { min-width: 0; margin: 0; padding: 14px; border: 1px solid #e5e9f0; border-radius: 11px; }

/* Quizzes */
.quiz-form { display: grid; gap: 15px; max-width: 950px; }
.quiz-question { display: grid; grid-template-columns: 44px minmax(0,1fr); gap: 16px; padding: 21px; background: #fff; border: 1px solid #e6eaf1; border-radius: var(--radius); }
.quiz-question__number { width: 34px; height: 34px; display: grid; place-items: center; color: var(--brand); background: var(--brand-soft); border-radius: 10px; font-weight: 850; }
.quiz-question__head { display: flex; align-items: start; justify-content: space-between; gap: 10px; }
.quiz-question__head h2 { margin: 0; font-size: 16px; line-height: 1.55; }
.quiz-question__head span { padding: 2px 7px; color: #5a68b4; background: #eef0ff; border-radius: 7px; font-size: 11px; font-weight: 750; white-space: nowrap; }
.quiz-options { display: grid; gap: 9px; margin-top: 16px; }
.quiz-option { display: flex; align-items: center; gap: 10px; padding: 10px 12px; color: #38455d; background: #fafbfe; border: 1px solid #e7eaf1; border-radius: 10px; cursor: pointer; transition: .13s; }
.quiz-option:hover { border-color: #caccff; background: #f5f5ff; }
.result-hero { display: grid; justify-items: center; max-width: 600px; margin: 5px auto 25px; padding: 30px; border-radius: 22px; text-align: center; }
.result-hero--pass { color: #09735f; background: #e6faf4; }
.result-hero--fail { color: #b73c51; background: #fff0f2; }
.result-hero__icon { width: 52px; height: 52px; display: grid; place-items: center; margin-bottom: 5px; color: #fff; background: currentColor; border-radius: 50%; }
.result-hero__icon .icon { width: 28px; stroke: #fff; }
.result-hero p { margin: 3px 0; font-size: 14px; font-weight: 800; }
.result-hero strong { font-size: 56px; line-height: 1; letter-spacing: -.06em; }
.result-hero strong small { color: inherit; font-size: 20px; }
.result-hero > span:last-child { margin-top: 7px; font-size: 12px; }
.answer-review { display: grid; gap: 12px; margin-top: 17px; }
.answer-review__item { padding: 16px; border: 1px solid var(--border); border-radius: 13px; }
.answer-review__item.is-correct { border-inline-start: 4px solid var(--teal); }
.answer-review__item.is-wrong { border-inline-start: 4px solid var(--red); }
.answer-review__head { display: flex; align-items: start; gap: 10px; margin-bottom: 11px; }
.answer-review__head > span { width: 27px; height: 27px; display: grid; place-items: center; flex: 0 0 auto; color: var(--brand); background: var(--brand-soft); border-radius: 8px; font-size: 12px; font-weight: 800; }
.answer-review__head h3 { flex: 1; margin: 1px 0; font-size: 14px; }
.answer-review__head > .icon { width: 20px; color: var(--teal); }
.answer-review__item.is-wrong .answer-review__head > .icon { color: var(--red); }
.answer-option { display: flex; align-items: center; gap: 8px; padding: 7px 9px; color: #57647b; border-radius: 8px; font-size: 13px; }
.answer-option.is-selected { background: #f1f3f7; }
.answer-option.is-correct-option { color: #087966; background: #e8faf4; }
.answer-option small { margin-inline-start: auto; color: inherit; font-size: 10px; font-weight: 800; }
.center-action { display: flex; justify-content: center; margin: 24px 0; }
.score-list { display: grid; }
.score-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px solid #edf0f4; }
.score-row:last-child { border-bottom: 0; }
.score-row:hover strong { color: var(--brand); }
.score-row > div { display: grid; min-width: 0; }
.score-row strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.score-row small { font-size: 10px; }
.score-row > div:last-child { justify-items: end; }

/* Lists / filters / tables */
.filter-card { padding: 13px; margin-bottom: 17px; }
.filter-form { display: flex; align-items: center; gap: 9px; }
.filter-form select { width: min(215px, 100%); }
.filter-form--cards { flex-wrap: wrap; }
.filter-form--cards label { display: grid; gap: 3px; color: #65738a; font-size: 10px; font-weight: 750; }
.filter-form--cards label input { min-width: 135px; padding: 8px 9px; }
.cards-summary { display: flex; align-items: center; gap: 14px; margin: 18px 0; padding: 15px 18px; background: linear-gradient(110deg, #eff3ff, #f9fbff); }
.cards-summary > div { display: grid; min-width: 90px; padding-inline-end: 14px; border-inline-end: 1px solid #d9e1f0; }
.cards-summary strong { color: var(--brand); font-size: 25px; line-height: 1; }
.cards-summary span { color: #607089; font-size: 11px; }
.cards-summary p { margin: 0; color: #57677f; font-size: 12px; }
.card--warning { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-top: 20px; background: #fffaf1; border-color: #f4d7a4; }
.card--warning h2 { margin: 0 0 4px; color: #8d5c14; font-size: 16px; }
.card--warning p { max-width: 760px; margin: 0; color: #745e42; font-size: 12px; }
.credential-reset-card form { flex: 0 0 auto; }
@media (max-width: 760px) { .card--warning, .cards-summary { align-items: flex-start; flex-direction: column; } .cards-summary > div { padding-bottom: 10px; padding-inline-end: 0; border-inline-end: 0; border-bottom: 1px solid #d9e1f0; } }
.search-input { position: relative; flex: 1; min-width: 180px; }
.search-input .icon { position: absolute; inset-inline-start: 10px; top: 10px; width: 18px; color: #8a95a8; }
.search-input input { padding-inline-start: 35px; }
.table-card { overflow: hidden; }
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; text-align: inherit; }
th { padding: 11px 14px; color: #778399; background: #fafbfc; border-bottom: 1px solid #e9edf3; font-size: 10px; font-weight: 850; letter-spacing: .055em; text-transform: uppercase; white-space: nowrap; }
td { padding: 13px 14px; border-bottom: 1px solid #edf0f4; vertical-align: middle; font-size: 12px; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fbfcff; }
td small { display: block; }
.table-person { display: flex; align-items: center; gap: 9px; min-width: 150px; }
.table-person > span:last-child { display: grid; }
.table-person strong { font-size: 12px; }
.row-actions { display: flex; align-items: center; justify-content: flex-end; gap: 5px; }
.inline-form { display: inline; }
.bulk-toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: 9px; padding: 10px 13px; background: #fff; border-bottom: 1px solid #e9edf3; }
.bulk-toolbar select { width: auto; min-width: 130px; padding: 6px 8px; }
.bulk-toolbar .muted { margin-inline-start: auto; font-size: 11px; }
.management-list { display: grid; gap: 11px; }
.management-row { display: flex; align-items: center; gap: 14px; padding: 16px 17px; background: #fff; border: 1px solid #e8edf5; border-radius: 15px; }
.management-row__icon, .subject-dot { width: 39px; height: 39px; display: grid; place-items: center; flex: 0 0 auto; color: var(--brand); background: var(--brand-soft); border-radius: 12px; }
.management-row__icon .icon { width: 20px; }
.management-row__icon--teal { color: var(--teal); background: var(--teal-soft); }
.subject-dot { width: 12px; height: 43px; background: var(--subject-color); border-radius: 9px; }
.management-row__main { min-width: 0; flex: 1; }
.management-row__main h2 { overflow: hidden; margin: 1px 0; text-overflow: ellipsis; white-space: nowrap; font-size: 16px; }
.management-row__main p { overflow: hidden; max-width: 700px; margin: 2px 0 4px; color: var(--muted); text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
.management-row__actions { display: flex; align-items: center; gap: 6px; }
.cohort-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 14px; }
.cohort-card { padding: 18px; background: #fff; border: 1px solid #e8edf5; border-radius: 15px; }
.cohort-card__top { display: flex; align-items: center; justify-content: space-between; }
.cohort-code { padding: 4px 8px; color: var(--brand); background: var(--brand-soft); border-radius: 7px; font-size: 11px; font-weight: 800; }
.cohort-card h2 { margin: 13px 0 10px; font-size: 17px; }
.cohort-card__stats { display: flex; flex-wrap: wrap; gap: 11px; margin-bottom: 12px; color: #627087; font-size: 11px; }
.cohort-card__stats span { display: flex; align-items: center; gap: 4px; }
.cohort-card__stats .icon { width: 14px; height: 14px; }
.timeline { display: grid; gap: 14px; }
.timeline__item { display: grid; grid-template-columns: 14px 1fr; gap: 8px; }
.timeline__item > span { width: 9px; height: 9px; margin-top: 6px; background: var(--brand); border-radius: 50%; box-shadow: 0 0 0 4px var(--brand-soft); }
.timeline__item strong { font-size: 12px; }
.timeline__item p { margin: 0; color: #58667c; font-size: 12px; }
.timeline__item small { font-size: 10px; }
.credential-banner { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 18px; padding: 16px 18px; color: #fff; background: linear-gradient(120deg, var(--brand), #6d58df); border-radius: 15px; box-shadow: 0 10px 25px rgba(79,70,229,.2); }
.bulk-preview-note { margin: 10px 4px 22px; font-size: 12px; }
.credential-banner > div { display: flex; align-items: center; gap: 11px; }
.credential-banner > div > .icon { width: 28px; height: 28px; }
.credential-banner__actions { display: flex; flex-wrap: wrap; gap: 8px; }
.credential-banner strong, .credential-banner p { display: block; margin: 0; }
.credential-banner p { color: #e6e4ff; font-size: 12px; }

/* Admin assessment builder */
.grade-layout { grid-template-columns: minmax(0,1fr) 340px; }
.grade-layout .card h2 { margin: 0 0 15px; font-size: 17px; }
.student-answer { min-height: 90px; padding: 13px; color: #35425a; background: #fafbfe; border: 1px solid #e8ecf3; border-radius: 11px; }
.builder-layout { display: grid; grid-template-columns: minmax(0,1fr) 370px; gap: 20px; align-items: start; }
.builder-questions { min-width: 0; }
.question-manager-list { display: grid; gap: 12px; }
.question-manager { padding: 16px; background: #fff; border: 1px solid #e7ebf2; border-radius: 15px; }
.question-manager__top { display: flex; align-items: flex-start; gap: 10px; }
.question-index { width: 28px; height: 28px; display: grid; place-items: center; flex: 0 0 auto; color: var(--brand); background: var(--brand-soft); border-radius: 8px; font-size: 12px; font-weight: 850; }
.question-manager__top > div:nth-child(2) { flex: 1; }
.question-manager h3 { margin: 1px 0; font-size: 14px; }
.question-manager p { margin: 0; color: var(--muted); font-size: 11px; }
.option-preview { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0 0 38px; }
.option-preview span { padding: 3px 7px; color: #6a768b; background: #f3f5f8; border-radius: 6px; font-size: 11px; }
.option-preview span.is-correct { color: #087864; background: #e5f8f2; }
.question-add { position: sticky; top: 16px; }
.question-add h2 { display: flex; align-items: center; gap: 8px; margin: 0 0 15px; font-size: 17px; }
.question-add h2 .icon { color: var(--brand); }
.form-inline { display: grid; grid-template-columns: 1fr 100px; gap: 10px; }
.option-editor-row { display: grid; grid-template-columns: 20px 1fr 1fr; gap: 7px; align-items: center; margin: 7px 0; }
.option-editor-row input[type="checkbox"] { justify-self: center; }

/* Rich text editor */
.rich-editor { overflow: hidden; border: 1px solid #dfe5ee; border-radius: 11px; background: #fff; }
.rich-editor:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(79,70,229,.11); }
.rich-editor__toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: 4px; padding: 7px; background: #f7f8fb; border-bottom: 1px solid #e9edf3; }
.rich-editor__toolbar button { width: 30px; height: 28px; padding: 0; color: #58657a; background: #fff; border: 1px solid #e1e6ee; border-radius: 7px; font-size: 12px; }
.rich-editor__toolbar button:hover { color: var(--brand); border-color: #c7caff; background: var(--brand-soft); }
.rich-editor__canvas { min-height: 185px; padding: 14px; outline: 0; line-height: 1.75; }
.rich-editor__canvas:empty::before { color: #9ba6b6; content: attr(data-placeholder); }

/* Search */
.search-page { display: flex; gap: 10px; max-width: 770px; margin-bottom: 22px; }
.search-results { display: grid; gap: 10px; }
.search-result { display: flex; align-items: center; gap: 14px; padding: 16px; background: #fff; border: 1px solid #e8edf5; border-radius: 14px; }
.search-result:hover { border-color: #cfd2ff; box-shadow: 0 8px 18px rgba(35,50,85,.06); }
.search-result > span { width: 38px; height: 38px; display: grid; place-items: center; color: var(--brand); background: var(--brand-soft); border-radius: 11px; }
.search-result > span .icon { width: 19px; }
.search-result > div { min-width: 0; flex: 1; }
.search-result small { color: var(--brand); font-size: 10px; font-weight: 750; }
.search-result h2 { margin: 1px 0; font-size: 15px; }
.search-result p { overflow: hidden; margin: 0; color: var(--muted); text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
.search-result > .icon { width: 17px; color: #a8b1bf; }

/* Auth */
.auth-body { background: #152039; }
.auth-main { min-height: 100vh; display: grid; place-items: center; padding: 25px; background: radial-gradient(circle at 0% 0%, #6754d9 0%, transparent 32%), radial-gradient(circle at 100% 100%, #268a9c 0%, transparent 27%), linear-gradient(135deg, #1c2945, #111a2d); }
.auth-grid { width: min(1010px,100%); display: grid; grid-template-columns: 1.1fr .9fr; overflow: hidden; background: #fff; border-radius: 26px; box-shadow: 0 30px 80px rgba(0,0,0,.28); }
.auth-intro { padding: clamp(38px, 6vw, 68px); color: #fff; background: linear-gradient(145deg, #4937bf, #6b59df); }
.auth-intro .brand__mark { margin-bottom: 31px; }
.auth-intro .brand__mark--image { width: min(280px, 100%); height: auto; aspect-ratio: 1391 / 752; border-radius: 14px; }
.auth-intro .eyebrow { color: #d9d5ff; }
.auth-intro h1 { max-width: 430px; margin: 9px 0; font-size: clamp(28px,4vw,42px); line-height: 1.2; }
.auth-intro p { max-width: 400px; margin: 0; color: #e4e2fb; font-size: 16px; }
.auth-points { display: grid; gap: 12px; margin-top: 37px; }
.auth-points span { display: flex; align-items: center; gap: 9px; color: #f3f2ff; font-size: 13px; }
.auth-points .icon { width: 18px; color: #b9ffeb; }
.auth-card { position: relative; padding: clamp(35px,6vw,62px); }
.auth-card h2 { margin: 21px 0 4px; font-size: 28px; }
.auth-card > p { margin: 0 0 27px; color: var(--muted); }
.auth-language { position: absolute; top: 20px; inset-inline-end: 20px; }
.demo-box { display: grid; gap: 4px; margin-top: 22px; padding: 13px; color: #58657b; background: #f6f7fb; border: 1px dashed #dbe0e9; border-radius: 11px; font-size: 11px; direction: ltr; text-align: left; }
.demo-box strong { color: #344159; font-size: 12px; }
.auth-alert { position: fixed; top: 22px; width: min(600px, calc(100% - 30px)); z-index: 50; box-shadow: var(--shadow); }

/* Settings */
.settings-layout { grid-template-columns: minmax(0,1fr) 310px; }
.settings-preview { position: sticky; top: 16px; text-align: center; }
.preview-brand { display: grid; justify-items: center; padding: 27px 0 10px; }
.preview-brand .brand__mark { margin-bottom: 13px; }
.preview-brand .brand__mark--image { width: min(250px, 100%); height: auto; aspect-ratio: 1391 / 752; border-radius: 12px; }
.preview-brand h2 { margin: 0; font-size: 18px; }
.preview-brand p { margin: 4px 0; color: var(--muted); }

@media (max-width: 1200px) {
  .metric-grid--four { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .subject-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .cohort-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
}
@media (max-width: 980px) {
  :root { --sidebar: 250px; }
  .sidebar { width: var(--sidebar); }
  .lesson-layout, .assignment-layout, .grade-layout, .settings-layout, .builder-layout { grid-template-columns: 1fr; }
  .lesson-aside { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .question-add, .settings-preview { position: static; }
  .content-columns { grid-template-columns: 1fr; }
  .subject-grid--large { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  body { font-size: 14px; }
  .sidebar { transform: translateX(-105%); width: min(288px, 88vw); transition: transform .2s ease; box-shadow: 10px 0 32px rgba(0,0,0,.22); }
  [dir="rtl"] .sidebar { transform: translateX(105%); box-shadow: -10px 0 32px rgba(0,0,0,.22); }
  body.sidebar-open .sidebar { transform: translateX(0); }
  .sidebar-overlay { position: fixed; inset: 0; z-index: 19; background: rgba(11,18,32,.42); opacity: 0; pointer-events: none; transition: opacity .2s; }
  body.sidebar-open .sidebar-overlay { display: block; opacity: 1; pointer-events: auto; }
  .app-main, [dir="rtl"] .app-main { width: 100%; margin: 0; }
  .topbar { height: 65px; padding: 0 17px; gap: 10px; }
  .mobile-menu { display: grid; }
  .global-search { width: auto; flex: 1; }
  .global-search input { min-width: 0; }
  .topbar__actions { gap: 8px; }
  .avatar--top { width: 32px; height: 32px; }
  .content-wrap { padding: 25px 17px 46px; }
  .page-heading { align-items: flex-start; flex-direction: column; gap: 13px; margin-bottom: 21px; }
  .page-heading__actions { justify-content: flex-start; }
  .metric-grid, .metric-grid--four, .subject-grid, .cohort-grid, .two-column, .two-column--narrow { grid-template-columns: 1fr; }
  .subject-grid--large { grid-template-columns: 1fr; }
  .lesson-aside { grid-template-columns: 1fr; }
  .form-grid, .checkbox-grid { grid-template-columns: 1fr; }
  .form-grid__wide, .form-actions--full { grid-column: auto; }
  .filter-form { align-items: stretch; flex-direction: column; }
  .filter-form select { width: 100%; }
  .search-page { flex-direction: column; }
  .management-row { align-items: flex-start; flex-wrap: wrap; }
  .management-row__actions { width: 100%; justify-content: flex-start; padding-inline-start: 53px; }
  [dir="rtl"] .management-row__actions { padding-inline-start: 0; padding-inline-end: 53px; }
  .task-card { align-items: flex-start; flex-wrap: wrap; }
  .task-card__status { width: 100%; margin-inline-start: 64px; justify-content: flex-start; }
  [dir="rtl"] .task-card__status { margin-inline-start: 0; margin-inline-end: 64px; }
  .quiz-question { grid-template-columns: 1fr; gap: 9px; }
  .quiz-question__number { width: 28px; height: 28px; }
  .form-inline { grid-template-columns: 1fr; }
  .option-editor-row { grid-template-columns: 20px 1fr; }
  .option-editor-row input:last-child { grid-column: 2; }
  .credential-banner { align-items: flex-start; flex-direction: column; }
  .auth-main { padding: 14px; }
  .auth-grid { grid-template-columns: 1fr; border-radius: 20px; }
  .auth-intro { padding: 30px; }
  .auth-intro .brand__mark { margin-bottom: 17px; }
  .auth-points { display: none; }
  .auth-card { padding: 35px 27px 30px; }
}
@media (max-width: 450px) {
  .language-switch { display: none; }
  .page-heading h1 { font-size: 25px; }
  .metric-card { min-height: 90px; }
  .metric-card strong { font-size: 23px; }
  .card, .card-panel { padding: 17px; }
  .management-row__actions, [dir="rtl"] .management-row__actions { padding: 0; }
  .table-card { margin-inline: -1px; }
}
