/* Masari
   K & A Study Hub's look, as asked: the warm cream page, navy ink, coral
   buttons with a pressed edge, round friendly type, generous corners. Phone
   first; the same pages widen for tablets and computers. Written with
   logical properties (inline-start/end) so Arabic, right to left, needs no
   separate stylesheet. No glows, no emoji. */

:root {
  color-scheme: only light;       /* a phone's dark mode never repaints it */
  --navy: #1D375C;
  --navy-700: #142944;
  --navy-100: #DCE4EF;
  --navy-50: #EEF2F7;
  --coral: #DC6953;
  --coral-700: #B9503B;
  --coral-100: #F8DCD5;
  --coral-50: #FCEFEB;
  --green: #406756;
  --green-700: #2F4F41;
  --green-100: #D6E5DC;
  --green-50: #ECF3EF;
  --amber: #FCA549;
  --amber-700: #A9620F;
  --amber-100: #FFE6C7;
  --amber-50: #FFF5E8;

  --bg: #F6F1E9;
  --paper: #FFFFFF;
  --ink: #1C2A3D;
  --ink-soft: #5C6A7C;
  --line: #E8DFD1;
  --line-strong: #D6CBB9;
  --danger: #C2412D;
  --danger-50: #FCECE8;

  --radius: 22px;
  --radius-sm: 16px;
  --radius-xs: 12px;
  --shadow: 0 1px 2px rgba(29, 55, 92, .05), 0 4px 14px rgba(29, 55, 92, .06);
  --shadow-btn: 0 4px 0 var(--coral-700);
  --font: 'Baloo Bhaijaan 2', 'Segoe UI', system-ui, -apple-system, sans-serif;
  --tabbar-h: 0px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 90px; }
body {
  margin: 0; min-height: 100vh;
  background: var(--bg); color: var(--ink);
  font-family: var(--font); font-size: 16px; line-height: 1.55;
  padding-bottom: var(--tabbar-h);
  -webkit-tap-highlight-color: transparent;
}
[hidden] { display: none !important; }
img { max-width: 100%; }
h1, h2, h3 { color: var(--navy); line-height: 1.25; margin: 0 0 .5rem; font-weight: 800; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.22rem; margin-top: 1.4rem; }
h3 { font-size: 1.05rem; font-weight: 700; }
p { margin: 0 0 .75rem; }
a { color: var(--navy); text-decoration-thickness: 2px; text-underline-offset: 3px; }
b, strong { font-weight: 700; }
.muted { color: var(--ink-soft); }
.small { font-size: .88rem; }
.nowrap { white-space: nowrap; }
.spacer { flex: 1; }
.center { text-align: center; }
.wrap { width: 100%; max-width: 1140px; margin: 0 auto; padding: 0 16px; }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

.ic {
  width: 1.2em; height: 1.2em; flex: none;
  fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
  vertical-align: -.22em;
}
[dir="rtl"] .back-btn .ic, [dir="rtl"] .ic.flip, [dir="rtl"] .viewer-nav .ic { transform: scaleX(-1); }

/* ---------- app bar ---------- */
.appbar {
  position: sticky; top: 0; z-index: 30;
  background: #F6F1E9;
  border-bottom: 1px solid var(--line);
  padding: 8px 0; padding-top: max(8px, env(safe-area-inset-top));
}
.appbar-row { display: flex; align-items: center; gap: 8px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; min-width: 0; }
.brand img { width: 44px; height: 44px; flex: none; border-radius: 23.4%; }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; min-width: 0; overflow: hidden; }
.brand-text b { color: var(--navy); font-size: 1.25rem; font-weight: 800; white-space: nowrap; }
.brand-text small { color: var(--ink-soft); font-size: .74rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 430px) { body.signed-in .appbar-row:has([data-back]) .brand-text { display: none; } }
.back-btn, .icon-btn {
  position: relative; display: inline-flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; flex: none; padding: 0;
  border-radius: 50%; border: 1px solid var(--line-strong);
  background: var(--paper); color: var(--navy); cursor: pointer; text-decoration: none; font: inherit;
}
.back-btn { border-color: var(--navy); }
.back-btn:hover, .icon-btn:hover { background: var(--navy-50); }
.icon-btn.active { background: var(--navy); color: #fff; border-color: var(--navy); }
.dot-count {
  position: absolute; inset-block-start: -4px; inset-inline-end: -4px;
  min-width: 20px; height: 20px; padding: 0 5px; border-radius: 999px;
  background: var(--coral); color: #fff; font-size: .72rem; font-weight: 800; line-height: 20px; text-align: center;
  border: 2px solid var(--bg);
}
.chip {
  display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 14px;
  border-radius: 999px; border: 1px solid var(--line-strong); background: var(--paper); color: var(--navy);
  font-weight: 700; font-size: .9rem; text-decoration: none; white-space: nowrap;
}
.chip:hover { background: var(--navy-50); }
.inline-form { display: inline; margin: 0; }

/* ---------- section bar (computers) and tab bar (phones) ---------- */
.topnav { padding: 10px 0 2px; }
.topnav-row { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding-bottom: 6px; overscroll-behavior-x: contain; }
.topnav-row::-webkit-scrollbar { display: none; }
.topnav a {
  flex: none; display: inline-flex; align-items: center; gap: 7px; min-height: 42px; padding: 0 16px;
  border-radius: 999px; background: var(--paper); border: 1px solid var(--line);
  color: var(--ink-soft); text-decoration: none; font-weight: 700; font-size: .92rem;
}
.topnav a:hover { color: var(--navy); border-color: var(--line-strong); }
.topnav a.active { background: var(--navy); color: #fff; border-color: var(--navy); }
.tabbar {
  position: fixed; inset-inline: 0; bottom: 0; z-index: 40; display: none;
  background: var(--paper); border-top: 1px solid var(--line);
  padding: 6px 4px; padding-bottom: max(6px, env(safe-area-inset-bottom));
}
.tabbar a {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 4px 2px;
  border-radius: 14px; color: var(--ink-soft); text-decoration: none; font-size: .74rem; font-weight: 700;
}
.tabbar a .ic { width: 24px; height: 24px; }
.tabbar a.active { color: var(--coral); }
.tabbar a.active .ic { stroke-width: 2.4; }
@media (max-width: 899px) {
  body.role-student, body.role-teacher { --tabbar-h: 74px; }
  body.role-student .tabbar, body.role-teacher .tabbar { display: flex; }
  body.role-student .topnav, body.role-teacher .topnav { display: none; }
  .hide-sm { display: none !important; }
}
@media (max-width: 520px) {
  .brand-text small { display: none; }
  .lang-chip span { display: none; }
  .lang-chip { width: 44px; padding: 0; justify-content: center; }
  .hide-xs { display: none !important; }
  h1 { font-size: 1.42rem; }
}

/* ---------- page ---------- */
.page { padding-top: 16px; padding-bottom: 48px; min-height: 60vh; }
.page-head { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.page-head h1 { margin: 0; }
.page-head .actions { margin-inline-start: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.lead { color: var(--ink-soft); font-weight: 600; margin: 2px 0 0; }
.section-head { display: flex; align-items: center; gap: 10px; margin: 24px 0 10px; }
.section-head h2 { margin: 0; }
.section-head a { margin-inline-start: auto; font-weight: 700; font-size: .92rem; white-space: nowrap; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 46px; padding: 8px 22px; border-radius: 999px; border: none;
  background: var(--coral); color: #fff; font-family: inherit; font-size: 1rem; font-weight: 800; line-height: 1.2;
  text-decoration: none; cursor: pointer; text-align: center; box-shadow: var(--shadow-btn);
  transition: transform .08s ease, box-shadow .08s ease;
}
.btn:hover { background: #D45E48; }
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--coral-700); }
.btn.navy { background: var(--navy); box-shadow: 0 4px 0 var(--navy-700); }
.btn.navy:hover { background: #23446F; }
.btn.navy:active { box-shadow: 0 1px 0 var(--navy-700); }
.btn.green { background: var(--green); box-shadow: 0 4px 0 var(--green-700); }
.btn.ghost { background: var(--paper); color: var(--navy); border: 1.5px solid var(--line-strong); box-shadow: none; }
.btn.ghost:hover { background: var(--navy-50); }
.btn.ghost:active { transform: translateY(1px); }
.btn.danger { background: var(--paper); color: var(--danger); border: 1.5px solid #EAB9AE; box-shadow: none; }
.btn.danger:hover { background: var(--danger-50); }
.btn.small { min-height: 38px; padding: 6px 14px; font-size: .9rem; box-shadow: 0 3px 0 var(--coral-700); }
.btn.small.navy { box-shadow: 0 3px 0 var(--navy-700); }
.btn.small.ghost, .btn.small.danger { box-shadow: none; }
.btn.block { width: 100%; }
.btn.big { min-height: 56px; font-size: 1.1rem; }
.btn[disabled], .btn.disabled { opacity: .55; pointer-events: none; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.link-btn { background: none; border: none; padding: 0; color: var(--navy); font: inherit; font-weight: 700; text-decoration: underline; cursor: pointer; }
.btn, .tag, .pill { overflow-wrap: break-word; max-width: 100%; }
td .btn, td .tag, th { white-space: nowrap; }

/* ---------- cards ---------- */
.card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.card + .card { margin-top: 14px; }
.card > h2:first-child, .card > h3:first-child { margin-top: 0; }
.card.tint { background: var(--amber-50); border-color: var(--amber-100); box-shadow: none; }
.card.navy-card { background: var(--navy); border-color: var(--navy); color: #fff; }
.card.navy-card h2, .card.navy-card h3 { color: #fff; }
.card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.card-head h2, .card-head h3 { margin: 0; }
.card-head .more { margin-inline-start: auto; font-weight: 700; font-size: .92rem; }
.grid { display: grid; gap: 14px; }
.grid > .card + .card { margin-top: 0; }
@media (min-width: 700px) { .grid.cols-2 { grid-template-columns: repeat(2, 1fr); } .grid.cols-3 { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 980px) { .grid.cols-3 { grid-template-columns: repeat(3, 1fr); } }
.split { display: grid; gap: 14px; }
@media (min-width: 980px) { .split { grid-template-columns: 1.5fr 1fr; align-items: start; } }
.stack { display: grid; gap: 14px; }
.stack > .card + .card { margin-top: 0; }
.grid > *, .split > *, .stack > *, .tiles > *, .list > *, .row-2 > *, .row-3 > * { min-width: 0; }

/* ---------- flash ---------- */
.flash {
  display: flex; gap: 10px; align-items: flex-start; padding: 12px 16px; margin-bottom: 12px;
  border-radius: var(--radius-sm); background: var(--navy-50); color: var(--navy); font-weight: 600;
  border: 1px solid var(--navy-100); overflow-wrap: anywhere;
}
.flash .ic { margin-top: 3px; }
.flash.success { background: var(--green-50); color: var(--green-700); border-color: var(--green-100); }
.flash.error { background: var(--danger-50); color: var(--danger); border-color: #F2C6BC; }
.flash.warning { background: var(--amber-50); color: var(--amber-700); border-color: var(--amber-100); }

/* ---------- tags ---------- */
.tag {
  display: inline-flex; align-items: center; gap: 4px; padding: 1px 10px; border-radius: 999px;
  font-size: .78rem; font-weight: 800; line-height: 1.3; background: var(--navy-50); color: var(--navy);
}
.tag.ok { background: var(--green-50); color: var(--green-700); }
.tag.warn { background: var(--amber-50); color: var(--amber-700); }
.tag.danger { background: var(--danger-50); color: var(--danger); }
.tag.coral { background: var(--coral-50); color: var(--coral-700); }
.tag.gray { background: #F1ECE4; color: var(--ink-soft); }

/* ---------- forms ---------- */
form.stack { display: grid; gap: 14px; }
label { display: block; font-weight: 700; font-size: .93rem; color: var(--navy); }
label > input, label > select, label > textarea { display: block; margin-top: 5px; }
.hint { display: block; font-weight: 500; color: var(--ink-soft); font-size: .84rem; margin-top: 4px; }
input[type="text"], input[type="email"], input[type="password"], input[type="number"], input[type="date"],
input[type="search"], input:not([type]), select, textarea {
  width: 100%; min-width: 0; max-width: 100%; min-height: 48px; padding: 10px 14px;
  border: 1.5px solid var(--line-strong); border-radius: var(--radius-xs);
  background: #fff; color: var(--ink); font-family: inherit; font-size: 1rem;
}
textarea { min-height: 90px; resize: vertical; line-height: 1.5; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--navy); outline-offset: 1px; border-color: var(--navy); }
input[type="file"] { font: inherit; font-size: .92rem; max-width: 100%; }
.row-2, .row-3 { display: grid; gap: 12px; }
@media (min-width: 700px) { .row-2 { grid-template-columns: 1fr 1fr; } .row-3 { grid-template-columns: repeat(3, 1fr); } }
.check { display: flex; align-items: center; gap: 10px; font-weight: 600; color: var(--ink); cursor: pointer; }
.check input { width: 22px; height: 22px; accent-color: var(--navy); flex: none; }
.checks { display: flex; flex-wrap: wrap; gap: 8px; }
.pill {
  display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; border: 1.5px solid var(--line-strong);
  border-radius: 999px; background: #fff; font-weight: 700; font-size: .92rem; color: var(--ink); cursor: pointer;
  text-decoration: none;
}
.pill:has(input:checked) { background: var(--navy); border-color: var(--navy); color: #fff; }
.pill input { position: absolute; opacity: 0; pointer-events: none; }
.pill:has(input:focus-visible) { outline: 2px solid var(--navy); outline-offset: 2px; }
fieldset { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px 14px 14px; margin: 0; min-width: 0; }
legend { font-weight: 800; color: var(--navy); padding: 0 6px; }
.field-label { font-weight: 700; font-size: .93rem; color: var(--navy); margin-bottom: 6px; }
.form-card { max-width: 560px; margin: 0 auto; }
.auth-card { max-width: 460px; margin: 12px auto 0; }
.auth-card .logo { display: block; width: 84px; height: 84px; margin: 0 auto 10px; border-radius: 23.4%; }
.auth-card h1, .auth-card .lead { text-align: center; }
.alt-link { text-align: center; margin: 14px 0 0; font-weight: 600; }
.code-input { font-size: 1.8rem !important; letter-spacing: .4em; text-align: center; direction: ltr; font-weight: 800; }
.danger-zone { border-color: #F2C6BC; }
.switch { position: relative; display: inline-block; width: 52px; height: 30px; flex: none; cursor: pointer; }
.switch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.switch span { position: absolute; inset: 0; border-radius: 999px; background: #C9BFAF; transition: background .2s; }
.switch span::after { content: ""; position: absolute; top: 3px; inset-inline-start: 3px; width: 24px; height: 24px;
  border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: inset-inline-start .2s; }
.switch input:checked + span { background: var(--green); }
.switch input:checked + span::after { inset-inline-start: 25px; }
.switch input:focus-visible + span { outline: 3px solid var(--amber); outline-offset: 2px; }
.switch-row { display: flex; align-items: center; gap: 12px; font-weight: 700; color: var(--navy); }

/* ---------- tables and lists ---------- */
.table-wrap { overflow-x: auto; border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--paper); }
table { width: 100%; border-collapse: collapse; font-size: .93rem; }
th, td { padding: 10px 12px; text-align: start; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { background: var(--bg); color: var(--ink-soft); font-weight: 800; font-size: .8rem; }
tr:last-child td { border-bottom: none; }
td.num, th.num { text-align: end; font-variant-numeric: tabular-nums; white-space: nowrap; }
td .sub { display: block; color: var(--ink-soft); font-size: .84rem; }
tr.off td { color: var(--ink-soft); }
.list { display: grid; gap: 10px; }
.list-item {
  display: flex; gap: 12px; align-items: center; padding: 12px 14px; background: var(--paper);
  border: 1px solid var(--line); border-radius: var(--radius-sm); text-decoration: none; color: inherit;
}
a.list-item:hover { border-color: var(--line-strong); }
.list-item .main { flex: 1; min-width: 0; overflow-wrap: break-word; }
.list-item .main b { color: var(--navy); }
.list-item .sub { display: block; color: var(--ink-soft); font-size: .86rem; font-weight: 600; }
.row-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
@media (max-width: 640px) { .list-item:has(> .row-actions) { flex-wrap: wrap; } .list-item > .row-actions { flex-basis: 100%; } }
.empty { text-align: center; padding: 26px 16px; background: var(--paper); border: 1.5px dashed var(--line-strong); border-radius: var(--radius); }
.empty-ic { display: inline-flex; width: 54px; height: 54px; border-radius: 50%; align-items: center; justify-content: center;
  background: var(--green-50); color: var(--green); margin-bottom: 8px; }
.empty-ic .ic { width: 26px; height: 26px; }
.empty h3 { margin-bottom: 4px; }
.empty p { color: var(--ink-soft); margin: 0; }
.pager { display: flex; gap: 10px; align-items: center; justify-content: center; margin-top: 14px; }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: end; margin-bottom: 14px; }
.toolbar > * { flex: 1 1 150px; min-width: 0; }
.toolbar .btn { flex: 0 0 auto; }

/* ---------- avatars and icons in bubbles ---------- */
.avatar { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; flex: none;
  border-radius: 50%; background: var(--navy-50); color: var(--navy); box-shadow: inset 0 0 0 2px var(--navy-100);
  font-weight: 800; font-size: 1.1rem; }
.avatar.lg { width: 60px; height: 60px; font-size: 1.5rem; }
.bubble { display: inline-flex; align-items: center; justify-content: center; width: 46px; height: 46px; flex: none;
  border-radius: 14px; background: var(--c, var(--navy)); color: #fff; }
.bubble .ic { width: 25px; height: 25px; color: #fff; }
.bubble.sm { width: 36px; height: 36px; border-radius: 11px; }
.bubble.sm .ic { width: 20px; height: 20px; }
.k-quiz { --c: var(--navy); }
.k-interest { --c: var(--amber-700); }
.k-upload { --c: var(--green); }

/* ---------- the student's home ---------- */
.hello { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; }
.hello h1 { margin: 0; }
.task-card { display: flex; gap: 12px; align-items: center; padding: 14px; background: var(--paper);
  border: 1px solid var(--line); border-radius: var(--radius-sm); text-decoration: none; color: inherit; }
a.task-card:hover { border-color: var(--line-strong); }
.task-card .main { flex: 1; min-width: 0; }
.task-card b { display: block; color: var(--navy); font-size: 1.04rem; line-height: 1.3; }
.task-card .meta { display: flex; gap: 4px 10px; flex-wrap: wrap; color: var(--ink-soft); font-size: .86rem; font-weight: 600; margin-top: 2px; }
.task-card .go { color: var(--coral); }
[dir="rtl"] .task-card .go .ic { transform: scaleX(-1); }
.done-note { display: flex; align-items: center; gap: 10px; color: var(--green-700); font-weight: 700; }

/* ---------- answering a task ---------- */
.q-block { border: none; padding: 0; margin: 0 0 18px; }
.q-block legend { padding: 0; margin-bottom: 10px; font-size: 1.06rem; line-height: 1.4; display: flex; gap: 10px; }
.q-num { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; flex: none;
  border-radius: 50%; background: var(--navy-50); color: var(--navy); font-size: .9rem; }
.opts { display: grid; gap: 8px; }
@media (min-width: 700px) { .opts { grid-template-columns: 1fr 1fr; } }
.opt { position: relative; display: flex; align-items: center; gap: 10px; min-height: 54px; padding: 10px 14px;
  border: 2px solid var(--line-strong); border-radius: var(--radius-sm); background: #fff; color: var(--ink);
  font-weight: 600; cursor: pointer; }
.opt input { position: absolute; opacity: 0; pointer-events: none; }
.opt .mark { width: 22px; height: 22px; flex: none; border-radius: 50%; border: 2px solid var(--line-strong); background: #fff; }
.opt:has(input:checked) { border-color: var(--navy); background: var(--navy-50); }
.opt:has(input:checked) .mark { border-color: var(--navy); background: var(--navy); box-shadow: inset 0 0 0 4px #fff; }
.opt:has(input:focus-visible) { outline: 2px solid var(--navy); outline-offset: 2px; }
.opt.right { border-color: var(--green); background: var(--green-50); }
.opt.wrong { border-color: #EAB9AE; background: var(--danger-50); }
.opt.static { cursor: default; }
.score-ring { display: flex; align-items: center; gap: 14px; }
.score-ring b { font-size: 2.2rem; color: var(--navy); line-height: 1; }
.upload-drop { border: 2px dashed var(--line-strong); border-radius: var(--radius-sm); padding: 16px; background: var(--bg); }
.file-row { display: flex; gap: 12px; align-items: center; padding: 10px 12px; background: var(--paper); border: 1px solid var(--line); border-radius: 14px; }
.file-row .main { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.thumb { width: 56px; height: 56px; border-radius: 12px; object-fit: cover; background: var(--line); flex: none; }
.stars-show { display: inline-flex; gap: 2px; color: var(--amber-700); }
.stars-show .ic { width: 1.05em; height: 1.05em; }
.stars-show .ic.on { fill: currentColor; }
.stars-show .ic.off { color: var(--line-strong); }

/* ---------- My Path ---------- */
.choice { display: grid; gap: 10px; padding: 16px; background: var(--paper); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow); border-inline-start: 6px solid var(--c, var(--navy)); }
.choice + .choice { margin-top: 12px; }
.choice-head { display: flex; align-items: center; gap: 12px; }
.choice-head h3 { margin: 0; font-size: 1.15rem; }
.rank { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; flex: none;
  border-radius: 50%; background: var(--navy); color: #fff; font-weight: 800; }
.choice-fit { margin-inline-start: auto; font-weight: 800; color: var(--navy); font-size: 1.3rem; }
.choice p { margin: 0; }
.why-list { display: flex; flex-wrap: wrap; gap: 6px; }
.meter { height: 10px; border-radius: 999px; background: color-mix(in srgb, var(--c, var(--navy)) 16%, white); overflow: hidden; }
.meter i { display: block; height: 100%; border-radius: 999px; background: var(--c, var(--navy)); min-width: 4px; }
.gap-note { display: flex; gap: 8px; align-items: flex-start; font-size: .9rem; color: var(--amber-700); font-weight: 600; }
.gap-note .ic { margin-top: 3px; }
.legend { display: flex; gap: 6px 16px; flex-wrap: wrap; margin: 0 0 12px; font-size: .86rem; font-weight: 600; color: var(--ink-soft); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend .key-bar { width: 16px; height: 10px; border-radius: 3px; background: var(--navy); }
.legend .key-tick { width: 3px; height: 14px; border-radius: 2px; background: var(--ink); }
.legend .key-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--c); }

/* bars: the student against the whole grade. One colour; the grade's average
   is a dark tick, so the comparison never rests on colour. */
.bars { display: grid; gap: 12px; }
.bar-row { display: grid; grid-template-columns: 1fr auto; gap: 3px 10px; align-items: center; }
.bar-row .name { font-weight: 700; font-size: .93rem; display: flex; align-items: center; gap: 8px; min-width: 0; }
.bar-row .name .ic { color: var(--ink-soft); }
.bar-row .val { font-weight: 800; color: var(--navy); font-variant-numeric: tabular-nums; }
.bar-row .val.none { color: var(--ink-soft); font-weight: 600; }
.track-bar { grid-column: 1 / -1; position: relative; height: 12px; background: var(--navy-50); border-radius: 0 6px 6px 0; }
[dir="rtl"] .track-bar { border-radius: 6px 0 0 6px; }
.track-bar .fill { position: absolute; inset-block: 0; inset-inline-start: 0; background: var(--c, var(--navy)); border-radius: 0 4px 4px 0; min-width: 3px; }
[dir="rtl"] .track-bar .fill { border-radius: 4px 0 0 4px; }
.track-bar .avg { position: absolute; top: -3px; bottom: -3px; width: 3px; margin-inline-start: -1.5px; background: var(--ink); border-radius: 2px; box-shadow: 0 0 0 1.5px #fff; }
.bars.green { --c: var(--green); }
.bars.green .track-bar { background: var(--green-50); }
.bars.amber { --c: var(--amber-700); }
.bars.amber .track-bar { background: var(--amber-50); }
[data-tip] { cursor: default; }

.trend { display: block; width: 100%; max-width: 620px; height: auto; margin: 0 auto; overflow: visible; }
.trend .grid { stroke: var(--line); stroke-width: 1; }
.trend .tick { fill: var(--ink-soft); font-size: 13px; font-family: var(--font); font-weight: 600; }
.trend .line { fill: none; stroke: var(--navy); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.trend .dot { fill: var(--navy); stroke: #fff; stroke-width: 2; }
.trend .hit { fill: transparent; outline: none; }
.trend .hit:hover, .trend .hit:focus { fill: rgba(29, 55, 92, .06); }
.trend .end { fill: var(--ink); font-size: 15px; font-weight: 800; font-family: var(--font); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.area-chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px;
  background: var(--green-50); color: var(--green-700); font-weight: 700; font-size: .9rem; }
.area-chip.grow { background: var(--amber-50); color: var(--amber-700); }
.area-chip.like { background: var(--coral-50); color: var(--coral-700); }

.conf { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.conf-steps { display: inline-flex; gap: 4px; }
.conf-steps i { width: 26px; height: 8px; border-radius: 999px; background: var(--navy-100); }
.conf-steps i.on { background: var(--navy); }
.conf b { color: var(--navy); }

.advice { display: grid; gap: 12px; }
.advice-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.advice-head h2 { margin: 0; }
.advice-head .tag { margin-inline-start: auto; }
.advice .summary { font-size: 1.04rem; margin: 0; }
.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.steps li { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; background: var(--bg); border-radius: 14px; font-weight: 600; }
.steps li .n { display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px; flex: none;
  border-radius: 50%; background: var(--coral); color: #fff; font-size: .85rem; font-weight: 800; }
.fine { font-size: .8rem; color: var(--ink-soft); margin: 0; }
.gov-row { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.gov-row:last-child { border-bottom: none; }
.gov-row b { color: var(--navy); }
.gov-row .meter { grid-column: 1 / -1; }

/* ---------- KPI tiles ---------- */
.tiles { display: grid; gap: 12px; grid-template-columns: repeat(2, 1fr); }
@media (min-width: 760px) { .tiles { grid-template-columns: repeat(4, 1fr); } }
.tile { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 14px 16px; box-shadow: var(--shadow); }
.tile .label { color: var(--ink-soft); font-weight: 700; font-size: .86rem; display: flex; align-items: center; gap: 6px; }
.tile .value { color: var(--navy); font-weight: 800; font-size: 1.7rem; line-height: 1.2; margin-top: 2px; }
.tile .sub { color: var(--ink-soft); font-size: .84rem; font-weight: 600; }
.tile.accent { background: var(--navy); border-color: var(--navy); }
.tile.accent .label, .tile.accent .sub { color: var(--navy-100); }
.tile.accent .value { color: #fff; }
.setup { display: grid; gap: 8px; }
.setup a { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 14px; background: var(--bg); text-decoration: none; font-weight: 700; color: var(--navy); }
.setup a.done { color: var(--green-700); }

/* ---------- the teacher's check-in ---------- */
.progress { height: 10px; border-radius: 999px; background: var(--green-50); overflow: hidden; }
.progress i { display: block; height: 100%; background: var(--green); border-radius: 999px; }
.assign-card { display: grid; gap: 10px; }
.assign-card .top { display: flex; gap: 12px; align-items: center; }
.assign-card .top b { color: var(--navy); font-size: 1.06rem; display: block; }
.who-card { display: flex; gap: 12px; align-items: center; }
.who-card h2 { margin: 0; }
.rate-row { display: grid; gap: 6px; padding: 10px 0; border-bottom: 1px dashed var(--line); }
.rate-row:last-of-type { border-bottom: none; }
.rate-row .label { font-weight: 800; color: var(--navy); }
.rates { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; max-width: 360px; }
.rate { position: relative; }
.rate input { position: absolute; opacity: 0; pointer-events: none; }
.rate span { display: flex; align-items: center; justify-content: center; height: 46px; border-radius: 12px;
  border: 2px solid var(--line-strong); background: #fff; font-weight: 800; font-size: 1.1rem; color: var(--navy); cursor: pointer; }
.rate input:checked + span { background: var(--navy); border-color: var(--navy); color: #fff; }
.rate input:focus-visible + span { outline: 2px solid var(--coral); outline-offset: 2px; }
.scale-ends { display: flex; justify-content: space-between; max-width: 360px; font-size: .76rem; color: var(--ink-soft); font-weight: 700; }
.mark-row { display: flex; align-items: center; gap: 8px; }
.mark-row input { width: 92px; min-height: 52px; text-align: center; font-size: 1.2rem; font-weight: 800; }
.mark-row .of { font-weight: 800; color: var(--ink-soft); font-size: 1.2rem; }
.dots-nav { display: flex; flex-wrap: wrap; gap: 6px; }
.dots-nav a { display: inline-flex; align-items: center; justify-content: center; min-width: 32px; height: 32px; padding: 0 6px;
  border-radius: 999px; background: var(--paper); border: 1.5px solid var(--line-strong); color: var(--ink-soft);
  font-weight: 800; font-size: .8rem; text-decoration: none; }
.dots-nav a.done { background: var(--green-50); border-color: var(--green-100); color: var(--green-700); }
.dots-nav a.here { border-color: var(--navy); background: var(--navy); color: #fff; }

.review-card { display: grid; gap: 10px; }
.stars { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; max-width: 320px; }
.file-row .main b { display: block; color: var(--navy); }
.file-row .sub { display: block; }

/* ---------- notifications ---------- */
.notice { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; background: var(--paper);
  border: 1px solid var(--line); border-radius: var(--radius-sm); text-decoration: none; color: inherit; }
.notice.fresh { border-inline-start: 5px solid var(--coral); }
.notice b { color: var(--navy); display: block; }
.notice p { margin: 2px 0 0; }
.notice time { display: block; color: var(--ink-soft); font-size: .8rem; font-weight: 600; margin-top: 4px; }

/* ---------- the front page ---------- */
.landing { display: grid; gap: 22px; align-items: center; padding: 10px 0 8px; }
@media (min-width: 880px) { .landing { grid-template-columns: 1.1fr .9fr; } }
.landing h1 { font-size: 2.3rem; line-height: 1.15; }
.landing h1 .hl { color: var(--coral); }
.landing .lead { font-size: 1.1rem; margin-bottom: 18px; }
.landing-art { display: flex; justify-content: center; }
.landing-art img { width: min(320px, 70vw); border-radius: 23.4%; box-shadow: 0 18px 40px rgba(29, 55, 92, .18); }
.feature { display: flex; gap: 12px; align-items: flex-start; }
.feature b { display: block; color: var(--navy); }
.feature div > span { color: var(--ink-soft); font-weight: 600; font-size: .92rem; }

/* ---------- footer, viewer, tooltip ---------- */
.site-footer { border-top: 1px solid var(--line); padding: 18px 0 22px; color: var(--ink-soft); font-size: .88rem; }
.footer-row { display: flex; gap: 10px 16px; align-items: center; flex-wrap: wrap; }
.footer-row img { border-radius: 8px; }
.footer-row a { color: var(--navy); font-weight: 700; }
.viewer { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center;
  background: rgba(14, 24, 40, .94); padding: max(56px, env(safe-area-inset-top)) 12px max(24px, env(safe-area-inset-bottom)); }
.viewer figure { margin: 0; display: grid; gap: 10px; justify-items: center; max-width: 100%; }
.viewer img { max-width: 94vw; max-height: 78vh; border-radius: 12px; object-fit: contain; background: #fff; }
.viewer figcaption { color: #fff; font-weight: 600; text-align: center; }
.viewer-close { position: absolute; top: max(12px, env(safe-area-inset-top)); inset-inline-end: 12px; }
.viewer .icon-btn { background: rgba(255, 255, 255, .95); border-color: transparent; }
body.viewing { overflow: hidden; }
.tip { position: fixed; z-index: 120; max-width: 260px; padding: 7px 11px; border-radius: 10px; background: var(--ink);
  color: #fff; font-size: .86rem; font-weight: 700; pointer-events: none; box-shadow: 0 6px 18px rgba(0,0,0,.18); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}
@media print {
  .appbar, .topnav, .tabbar, .site-footer, .btn, .back-btn { display: none !important; }
  body { background: #fff; }
  .card, .choice, .tile { box-shadow: none; }
}
