/* MJS Digital Hub. Phone first: bottom bar on phones, left sidebar on computers.
   Colours follow the teacher dashboard sample. Each kind of action has its own colour:
   green = save / main, blue = people, purple = marks, amber = exams / careful, red = log out / danger. */
:root {
  --bg: #f3f6f5; --surface: #ffffff; --surface-2: #eef3f1; --ink: #15212a; --muted: #5a6a72; --line: #dce4e1;
  --brand: #136b5e; --brand-ink: #ffffff; --brand-soft: #e1f0ec;
  --blue: #1f5fae; --blue-soft: #e3edf9;
  --purple: #6a3fb5; --purple-soft: #eee7fa;
  --amber: #a8680f; --amber-soft: #fbf0dc; --amber-btn: #c77d0a;
  --red: #bf3a30; --red-soft: #fbe7e4;
  --good: #1d8549; --good-soft: #e3f4ea;
  --danger: #bf3a30; --ok-bg: #e3f4ea; --err-bg: #fbe7e4;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-head: "Space Grotesk", "Inter", system-ui, sans-serif;
  --side: 232px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1416; --surface: #162024; --surface-2: #1c282c; --ink: #e4ecea; --muted: #9bacaa; --line: #27353a;
    --brand: #3dbba5; --brand-ink: #06201b; --brand-soft: #17352f;
    --blue: #6ea8f0; --blue-soft: #16273d;
    --purple: #b79af0; --purple-soft: #2a2140;
    --amber: #e3a94b; --amber-soft: #3a2c13; --amber-btn: #e3a94b;
    --red: #ef7065; --red-soft: #3b1d1a;
    --good: #53c584; --good-soft: #163323;
    --danger: #ef7065; --ok-bg: #163323; --err-bg: #3b1d1a;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 15px/1.5 var(--font); background: var(--bg); color: var(--ink); }
a { color: var(--brand); }
h1, h2 { font-family: var(--font-head); line-height: 1.2; }
h1 { font-size: 22px; margin: 4px 0 16px; }
h2 { font-size: 17px; margin: 24px 0 8px; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

/* ---- shell ---- */
.top { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 16px; background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 3; }
.logo { width: 34px; height: 34px; border-radius: 9px; background: var(--brand); color: var(--brand-ink); display: inline-grid; place-items: center; font: 700 14px var(--font-head); flex: none; }
.brand { display: flex; align-items: center; gap: 10px; font-family: var(--font-head); font-weight: 700; text-decoration: none; color: var(--ink); }
.who { font-size: 13px; color: var(--muted); text-align: right; line-height: 1.3; }
main { max-width: 720px; margin: 0 auto; padding: 16px 16px 96px; }

.menu { position: fixed; left: 0; right: 0; bottom: 0; display: flex; background: var(--surface); border-top: 1px solid var(--line); z-index: 3; padding-bottom: env(safe-area-inset-bottom, 0px); }
.menu a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 2px 8px; font-size: 12px; color: var(--muted); text-decoration: none; min-height: 58px; }
.menu a svg { width: 22px; height: 22px; }
.menu a.on { font-weight: 700; color: var(--ink); box-shadow: inset 0 3px 0 var(--c); }
.menu a .ic { color: var(--c); display: grid; place-items: center; }
.menu .side-only { display: none; }

@media (min-width: 900px) {
  .top { display: none; }
  .menu { top: 0; bottom: 0; right: auto; width: var(--side); flex-direction: column; border-top: 0; border-right: 1px solid var(--line); padding: 18px 12px; gap: 4px; }
  .menu .side-only { display: flex; }
  .menu .brandrow { align-items: center; gap: 10px; padding: 4px 8px 16px; font-family: var(--font-head); font-weight: 700; font-size: 16px; }
  .menu a { flex: none; flex-direction: row; gap: 12px; padding: 0 12px; min-height: 40px; font-size: 15px; border-radius: 10px; }
  .menu a.on { background: var(--surface-2); box-shadow: inset 4px 0 0 var(--c); }
  .menu a:hover { background: var(--surface-2); }
  .menu .spacer { flex: 1; }
  .menu .me.side-only { display: block; }
  .menu .me { padding: 10px 12px; font-size: 13px; color: var(--muted); border-top: 1px solid var(--line); }
  .menu .me b { display: block; color: var(--ink); font-size: 14px; }
  .menu .me form { margin-top: 8px; }
  body.has-menu { padding-left: var(--side); }
  main { max-width: 860px; padding: 28px 32px 48px; }
}

/* ---- cards and lists ---- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 16px; margin-bottom: 12px; }
.card.tint-green { border-top: 3px solid var(--brand); }
.card.tint-blue { border-top: 3px solid var(--blue); }
.card.tint-purple { border-top: 3px solid var(--purple); }
.card.tint-amber { border-top: 3px solid var(--amber-btn); }
.list { list-style: none; margin: 0; padding: 0; }
.list li { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; margin-bottom: 8px; }
.list a.row, .list .row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 16px; text-decoration: none; color: var(--ink); min-height: 48px; }
.list a.row:hover { background: var(--surface-2); border-radius: 12px; }
.muted { color: var(--muted); font-size: 14px; }
.tag { display: inline-block; font-size: 12px; padding: 2px 8px; border-radius: 99px; border: 1px solid var(--line); color: var(--muted); }
.big-num { font: 700 30px var(--font-head); }

/* ---- buttons: one colour per kind of action ---- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 46px; padding: 0 18px; border-radius: 10px; border: 1px solid transparent; background: var(--brand); color: var(--brand-ink); font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; }
.btn:hover { filter: brightness(1.06); }
.btn.green { background: var(--brand); color: var(--brand-ink); }
.btn.blue { background: var(--blue); color: #fff; }
.btn.purple { background: var(--purple); color: #fff; }
.btn.amber { background: var(--amber-btn); color: #1d1304; }
.btn.red { background: var(--red); color: #fff; }
.btn.light { background: var(--surface); color: var(--brand); border-color: var(--line); }
.btn.soft-red { background: var(--red-soft); color: var(--red); }
.btn.soft-blue { background: var(--blue-soft); color: var(--blue); }
.btn.soft-purple { background: var(--purple-soft); color: var(--purple); }
.btn.soft-amber { background: var(--amber-soft); color: var(--amber); }
@media (prefers-color-scheme: dark) { .btn.blue, .btn.purple, .btn.red { color: #0b1217; } }
.btn.block { width: 100%; }
.btn.small { min-height: 40px; padding: 0 14px; font-size: 14px; }
.btn:disabled { opacity: .5; cursor: not-allowed; filter: none; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }

/* ---- forms ---- */
form p { margin: 0 0 14px; }
label { display: block; font-weight: 600; margin-bottom: 4px; }
input, select, textarea { width: 100%; min-height: 46px; padding: 10px 12px; font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 10px; }
input[type=checkbox] { width: 24px; min-height: 24px; height: 24px; vertical-align: middle; }
input[type=file] { padding: 8px; }
.helptext, .help { display: block; color: var(--muted); font-size: 14px; margin-top: 4px; }
.errorlist { color: var(--danger); margin: 0 0 6px; padding-left: 18px; font-size: 14px; }
.field { margin-bottom: 12px; }
.hint { font-size: 13px; color: var(--muted); margin: 4px 0 0; }
.card .row { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.card .row > * { flex: 1 1 140px; min-width: 0; }
.msg { padding: 12px 16px; border-radius: 10px; margin-bottom: 12px; background: var(--ok-bg); color: var(--good); }
.msg.error { background: var(--err-bg); color: var(--danger); }
.pw-wrap { position: relative; display: block; }
.pw-wrap input { padding-right: 76px; }
.pw-toggle { position: absolute; right: 4px; top: 4px; bottom: 4px; min-width: 64px; border: 0; border-radius: 8px; background: transparent; color: var(--brand); font: inherit; font-weight: 600; cursor: pointer; }

/* ---- status chips, alerts, bars ---- */
.chip { display: inline-block; font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 99px; white-space: nowrap; }
.chip.ok { background: var(--good-soft); color: var(--good); }
.chip.info { background: var(--blue-soft); color: var(--blue); }
.chip.warn { background: var(--amber-soft); color: var(--amber); }
.chip.bad { background: var(--red-soft); color: var(--red); }
.alert { padding: 10px 12px; border-radius: 8px; background: var(--amber-soft); color: var(--amber); font-size: 14px; margin-bottom: 12px; }
.bar { display: block; height: 8px; border-radius: 99px; background: var(--surface-2); overflow: hidden; margin: 6px 0; border: 1px solid var(--line); }
.bar i { display: block; height: 100%; background: var(--good); }

/* ---- marks entry rows, log ---- */
.stu { display: grid; grid-template-columns: 1fr 96px; gap: 4px 10px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); }
.stu .nm { font-weight: 600; }
.stu .meta { grid-column: 1 / -1; font-size: 13px; }
.log { font-size: 14px; }
.log .change { margin-top: 6px; }
.log del { color: var(--danger); }
.log ins { text-decoration: none; font-weight: 600; }
.login-wrap { max-width: 420px; margin: 8vh auto 0; }
.pager { display: flex; justify-content: space-between; margin-top: 12px; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* ---- top-right menu, grouped sidebar, plan box ---- */
.topright { display: flex; align-items: center; gap: 10px; }
.helplink { font-size: 14px; color: var(--muted); text-decoration: none; }
.usermenu { position: relative; }
.usermenu summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 8px; font-size: 14px; }
.usermenu summary::-webkit-details-marker { display: none; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--brand); color: var(--brand-ink); display: inline-grid; place-items: center; font-weight: 700; }
.uname { max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 520px) { .uname, .brandname { display: none; } }
.drop { position: absolute; right: 0; top: 40px; min-width: 230px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 8px 24px #0002; padding: 6px; z-index: 10; }
.drop a, .drop .dlogout { display: block; width: 100%; text-align: left; padding: 11px 12px; border-radius: 8px; color: var(--ink); text-decoration: none; background: none; border: 0; font: inherit; cursor: pointer; }
.drop a:hover, .drop .dlogout:hover { background: var(--surface-2); }
.drop .adm { color: var(--red); font-weight: 600; }
.drop .dlogout { color: var(--red); }
.drop .dhead { padding: 8px 12px 10px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.drop .dhead b, .drop .dhead span { display: block; } .drop .dhead span { color: var(--muted); font-size: 13px; }
.menu .grp { display: none; }
@media (min-width: 900px) {
  .top { display: flex; position: fixed; left: var(--side); right: 0; top: 0; justify-content: flex-end; height: 56px; }
  .top .brand { display: none; }
  main { padding-top: 76px; }
  .menu { overflow-y: auto; }
  .menu .grp.side-only { display: block; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); padding: 12px 12px 2px; }
  .menu .grp.adm { color: var(--red); }
  .planbox { display: block !important; flex: none; min-height: 0 !important; margin: 8px 0; padding: 10px 12px !important; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); font-size: 13px; }
  .planbox b, .planbox span, .planbox em { display: block; }
  .planbox em { color: var(--brand); font-style: normal; font-weight: 600; margin-top: 4px; }
}

/* ---- dashboard bits ---- */
.cards4 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 12px; }
@media (min-width: 700px) { .cards4 { grid-template-columns: repeat(4, 1fr); } }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; display: flex; justify-content: space-between; align-items: flex-start; text-decoration: none; color: var(--ink); }
.stat b { display: block; font: 700 26px var(--font-head); }
.stat small { color: var(--muted); display: block; }
.stat .ico { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; font-size: 18px; background: var(--c-soft, var(--brand-soft)); }
.stat.warn { border-color: var(--amber-btn); }
.steps { list-style: none; margin: 0; padding: 0; }
.steps li { display: flex; gap: 10px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); }
.steps li:last-child { border: 0; }
.steps .dot { width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--line); display: grid; place-items: center; font-size: 13px; flex: none; }
.steps .done .dot { background: var(--good); border-color: var(--good); color: #fff; }
.steps .done a { color: var(--muted); text-decoration: line-through; }
.steps a { font-weight: 600; text-decoration: none; }
.cardhead { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.linkbtn { background: none; border: 0; color: var(--muted); font: inherit; font-size: 13px; cursor: pointer; text-decoration: underline; min-height: 0; padding: 4px; }
.warnbar { padding: 10px 14px; border-radius: 10px; background: var(--amber-soft); color: var(--amber); margin-bottom: 8px; font-weight: 600; }
.warnbar.bad { background: var(--red-soft); color: var(--red); }
.warnbar a { color: inherit; }
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 8px 0 12px; }
.toolbar input[type=search], .toolbar input[name=q] { flex: 1 1 180px; }
.toolbar select { flex: 0 1 150px; width: auto; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin: 8px 0; }
.tabs a { padding: 8px 14px; border-radius: 99px; background: var(--surface); border: 1px solid var(--line); color: var(--ink); text-decoration: none; font-size: 14px; }
.tabs a.on { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); font-weight: 600; }
.tablewrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
table.tbl th, table.tbl td { padding: 9px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
table.tbl th a { color: var(--ink); text-decoration: none; }
.usage { margin: 10px 0; } .usage .top2 { display: flex; justify-content: space-between; font-size: 14px; }
.bar.warn i { background: var(--amber-btn); } .bar.bad i { background: var(--red); }
.plans { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
.plancard { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 14px; }
.plancard.cur { border: 2px solid var(--brand); }
.plancard .price { font: 700 24px var(--font-head); } .plancard ul { padding-left: 18px; margin: 8px 0; font-size: 14px; }
.keybox { border: 1px solid var(--line); border-radius: 12px; margin-bottom: 10px; background: var(--surface); }
.keybox summary { list-style: none; cursor: pointer; padding: 12px 14px; display: flex; gap: 8px; align-items: center; justify-content: space-between; }
.keybox summary::-webkit-details-marker { display: none; }
.keybox .inner { padding: 0 14px 14px; }
.stepsrow { display: grid; gap: 8px; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); margin-bottom: 12px; }
.stepsrow div { background: var(--surface-2); border-radius: 10px; padding: 10px 12px; font-size: 13px; }
.helpcenter ol { padding-left: 20px; } .helpcenter li { margin-bottom: 6px; }
.helpcenter details { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; margin-bottom: 8px; }
.helpcenter summary { font-weight: 700; cursor: pointer; }
.langsw { display: flex; gap: 6px; margin-bottom: 8px; }

/* class sheet table: summary first, name column stays while scrolling */
.sheetwrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.sheet { border-collapse: separate; border-spacing: 0; width: 100%; font-size: 14px; }
table.sheet th { text-align: left; color: var(--muted); font-size: 12px; padding: 6px; white-space: nowrap; }
table.sheet td { padding: 6px; border-top: 1px solid var(--line); }
table.sheet .r { text-align: right; }
table.sheet .nowrap { white-space: nowrap; }
table.sheet .stick { position: sticky; left: 0; background: var(--surface); z-index: 1; min-width: 110px; max-width: 150px; }
table.sheet .failmark { color: var(--danger); font-weight: 700; }
table.sheet .missmark { color: var(--amber); font-weight: 700; }
table.sheet .small { font-size: 11px; }
@media (max-width: 520px) { table.sheet { font-size: 13px; } table.sheet td, table.sheet th { padding: 5px 4px; } }
/* long names (exams, classes) wrap instead of being cut on phones */
.list .row > span:first-child { min-width: 0; overflow-wrap: anywhere; }
select { text-overflow: ellipsis; }
.banner-support { background: #bf3a30; color: #fff; padding: 8px 14px; display: flex; gap: 10px; align-items: center; justify-content: space-between; flex-wrap: wrap; font-size: 14px; }
.banner-support form { margin: 0; }
.banner-support button { background: #fff; color: #bf3a30; border: 0; border-radius: 8px; padding: 6px 10px; font-weight: 700; cursor: pointer; }
.alertcard { border-left: 5px solid var(--amber); }
.alertcard a { font-weight: 700; }
.stu:has(input + input) { grid-template-columns: 1fr 76px 76px; }

/* ---- simple school screens (2026-11-29) ---- */
.langsw { display: inline-flex; border: 1px solid var(--line); border-radius: 99px; overflow: hidden; font-size: 13px; }
.langsw a { padding: 4px 10px; text-decoration: none; color: var(--muted); }
.langsw a.on { background: var(--brand); color: var(--brand-ink); font-weight: 700; }
.eyebrow { display: block; font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--brand); }
.pwshow { font-family: ui-monospace, Menlo, monospace; font-size: 22px; letter-spacing: .08em; }
.card.next { border: 2px solid var(--brand); padding: 20px; }
.card.next h2 { margin: 6px 0 4px; font-size: 22px; }
.card.next .btn { margin-top: 10px; width: 100%; min-height: 54px; font-size: 17px; }
.change { display: flex; gap: 8px; align-items: center; padding: 10px 0; border-top: 1px solid var(--line); flex-wrap: wrap; }
.change .grow { flex: 1; min-width: 180px; }
.change .when { display: block; font-size: 12px; color: var(--muted); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 12px; }
.tile { display: flex; flex-direction: column; gap: 4px; padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--ink); text-decoration: none; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin: 8px 0 12px; }
.chips a { padding: 6px 14px; border-radius: 99px; border: 1px solid var(--line); text-decoration: none; color: var(--ink); font-size: 14px; }
.chips a.on { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); font-weight: 700; }
.check { display: flex; gap: 8px; align-items: center; padding: 4px 0; font-size: 14px; }
.check i { font-style: normal; font-weight: 700; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: 13px; }
.check i.y { background: var(--good-soft); color: var(--good); }
.check i.n { background: var(--red-soft); color: var(--red); }
.check i.q { background: var(--amber-soft); color: var(--amber); }
.av { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; background: var(--surface-2); display: inline-grid; place-items: center; font-size: 11px; color: var(--muted); flex: none; }
.tablewrap { overflow-x: auto; }
.tablewrap table { border-collapse: collapse; width: 100%; font-size: 14px; }
.tablewrap th, .tablewrap td { padding: 6px 8px; border-top: 1px solid var(--line); text-align: start; white-space: nowrap; }
.tablewrap th { font-size: 12px; color: var(--muted); }
body.ur { font-family: "Noto Nastaliq Urdu", "Noto Naskh Arabic", var(--font, Inter), sans-serif; }
@media (max-width: 899px) { .menu a { font-size: 11px; padding: 8px 0; } .menu a svg { width: 20px; height: 20px; } }
