/* Neda Teacher Portal: global look (the portal mock-up, 2026-11-15). Teal from the school logo, warm neutrals, light and
   dark by the device setting. Every colour is a token; the parent report sheet (reviews.css) stays white paper in both. */
:root {
  color-scheme: light dark;
  --bg: #f6f3ee; --surface: #ffffff; --surface-2: #efebe4;
  --fg: #23302f; --muted: #5b6968; --line: #ddd6ca; --input-line: #b9b2a6;
  --teal: #0e7c7b; --teal-dark: #0a5c5b; --teal-soft: #d9efee;
  --bar-bg: #0a5c5b; --on-bar: #ffffff;
  --btn-bg: #0a5c5b; --on-btn: #ffffff; --link: #0a5c5b;
  --ok: #2e7d32; --bad: #c62828; --late: #b35400; --exc: #6a1b9a; --warn-fg: #6d4b00;
  --msg-ok: #1b5e20; --msg-err: #b71c1c;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141c1c; --surface: #1d2828; --surface-2: #263332;
    --fg: #e6efee; --muted: #9db0ae; --line: #33423f; --input-line: #4b5c59;
    --teal: #3cb8b5; --teal-dark: #6fd2cf; --teal-soft: #1c3d3c;
    --bar-bg: #0f3f3e; --on-bar: #ffffff;
    --btn-bg: #3cb8b5; --on-btn: #08201f; --link: #6fd2cf;
    --ok: #2e7d32; --bad: #c62828; --late: #b35400; --exc: #8e44ad; --warn-fg: #f3d58a;
    --msg-ok: #8fdc9f; --msg-err: #ff9c9c;
  }
}
* { box-sizing: border-box; }
/* A rule that sets display (.navitem, .termpick, ...) would otherwise beat the hidden attribute, and the managers-only parts would show to everyone. */
[hidden] { display: none !important; }
body { margin: 0; font: 16px/1.6 "Vazirmatn", "Tahoma", system-ui, "Segoe UI", sans-serif; color: var(--fg); background: var(--bg); }
:focus-visible { outline: 3px solid var(--teal); outline-offset: 2px; }

header { background: var(--bar-bg); color: var(--on-bar); padding: 12px 16px; display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand img { height: 38px; background: #fff; border-radius: 8px; padding: 2px 4px; }
h1 { margin: 0; font-size: 1.15rem; }
#who { font-size: .8rem; opacity: .9; text-align: start; overflow-wrap: anywhere; }
#whoEmail { font-size: .75rem; opacity: .75; overflow-wrap: anywhere; }
main { padding: 18px 16px 40px; max-width: 720px; margin: 0 auto; flex: 1; width: 100%; }

/* Layout: a left menu (a strip across the top on a phone) beside the content, with a footer bar under it. */
.shell { display: flex; min-height: calc(100vh - 64px); }
#side { width: 236px; flex: none; background: var(--surface); border-inline-end: 1px solid var(--line); padding: 14px 12px; display: flex; flex-direction: column; gap: 14px; }
.content { flex: 1; min-width: 0; display: flex; flex-direction: column; }
#side .grp { display: flex; flex-direction: column; gap: 2px; }
#side .grp small { font-size: .7rem; color: var(--muted); padding: 0 10px 6px; }
#side .mgr { border-top: 1px solid var(--line); padding-top: 12px; }
.navitem { display: flex; align-items: center; gap: 11px; width: 100%; margin: 0; padding: 9px 10px; border: 0; border-radius: 8px; background: none; color: var(--fg); text-align: start; font-size: .95rem; white-space: nowrap; }
.navitem.parent { cursor: default; }
button.navitem:hover { background: var(--surface-2); }
button.navitem[aria-current=page] { background: var(--teal-soft); font-weight: 600; }
.navitem.sub { padding: 6px 10px; padding-inline-start: 39px; font-size: .88rem; color: var(--muted); }
button.navitem.sub[aria-current=page] { background: none; color: var(--link); }
#foot { border-top: 1px solid var(--line); padding: 14px 16px; text-align: center; font-size: .8rem; color: var(--muted); }
.attpick { display: grid; grid-template-columns: 1fr; gap: 0 14px; }
@media (min-width: 560px) { .attpick { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); } }   /* class, year and term side by side on Past sessions */
.attpick > #btnPastLoad { justify-self: start; align-self: end; }   /* as wide as its label, not the whole grid cell, and the normal button height instead of the full row */
#btnPastLoad, #btnRevLoad, #btnRepLoad { min-width: 6.5rem; }   /* every Load button the same size, as wide as a Save button */
.classpick { grid-column: 1 / -1; margin: 0 0 14px; }
.classpick .lbl { display: block; font-weight: 600; margin-bottom: 6px; }
.tabs { display: flex; flex-wrap: wrap; gap: 6px; }
.tab { margin: 0; padding: 8px 14px; min-height: 40px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--link); font-weight: 600; cursor: pointer; }
.tab[aria-selected=true] { background: var(--btn-bg); color: var(--on-btn); border-color: transparent; }
.sessionbox { margin: 0 0 14px; }
.sessionbox small { display: block; font-weight: 600; margin-bottom: 4px; }
.sessionbox strong { display: block; padding: 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); font-weight: 600; }
/* Top right: the name with Sign out right below it (the link takes the bar text colour, since the link colour is the bar colour in light mode). */
.account { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; min-width: 0; }
.account button.link { margin: 0; padding: 2px 0; font-size: .8rem; color: var(--on-bar); }
.navitem.parent.act { background: var(--teal-soft); font-weight: 600; }
.skip { position: absolute; inset-inline-start: -9999px; top: 0; background: var(--surface); color: var(--link); padding: 8px 12px; border-radius: 0 0 8px 0; z-index: 10; }
.skip:focus { inset-inline-start: 0; }
[tabindex="-1"]:focus { outline: none; }
#attSub { margin: 0 0 12px; white-space: pre-line; }   /* the second sentence of the role message starts on its own line (app.js) */
.readonly-note { background: var(--surface-2); border-radius: 8px; padding: 8px 12px; }
.seg button:disabled { opacity: 1; cursor: default; }
.seg button:disabled:not([aria-pressed=true]) { opacity: .45; }
li textarea:read-only { background: var(--surface-2); }

@media (max-width: 719px) {
  .shell { flex-direction: column; min-height: 0; }
  #side { width: 100%; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 4px; padding: 6px 8px; border-inline-end: 0; border-bottom: 1px solid var(--line); }
  #side .grp { flex-direction: row; flex-wrap: wrap; align-items: center; }
  #side .grp small, .navitem.parent, #side .navitem svg { display: none; }
  #side .mgr { border-top: 0; padding-top: 0; }
  .navitem, .navitem.sub { width: auto; padding: 8px 12px; font-size: .9rem; color: var(--fg); }
}

label { display: block; margin: 0 0 14px; font-weight: 600; }
select, input[type=date], input[type=number], textarea {
  display: block; width: 100%; margin-top: 4px; padding: 10px; font: inherit; color: var(--fg); background: var(--surface);
  border: 1px solid var(--input-line); border-radius: 8px;
}
button { font: inherit; padding: 7px 16px; min-height: 38px; border: 1px solid var(--btn-bg); background: var(--surface); color: var(--link); border-radius: 10px; margin: 0 0 12px; cursor: pointer; }
button.primary { background: var(--btn-bg); color: var(--on-btn); font-weight: 600; min-width: 6.5rem; }   /* as wide as its label, not the whole row */
button.link { border: 0; background: none; color: var(--link); text-decoration: underline; padding: 8px 0; }
button:disabled { opacity: .5; cursor: default; }
#msg { min-height: 1.4em; }
#msg.err { color: var(--msg-err); }
#msg.ok { color: var(--msg-ok); }
.bar { display: flex; gap: 12px; align-items: center; }

/* Roster */
ul { list-style: none; padding: 0; margin: 0 0 16px; }
li { border-bottom: 1px solid var(--line); padding: 12px 0; }
/* The roster is one card: each student is a row with the name on the left and the four status buttons on the right, the note under them. */
#rows { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
#rows li { padding: 12px 16px; }
#rows li:last-child { border-bottom: 0; }
.rowtop { display: flex; justify-content: space-between; align-items: center; gap: 8px 12px; flex-wrap: wrap; }
li .name { font-weight: 600; }
.seg { display: flex; gap: 6px; }
.seg button { margin: 0; padding: 8px 12px; font-size: .9rem; border-radius: 8px; border-color: var(--line); color: var(--muted); background: transparent; }
.seg button[aria-pressed=true] { color: #fff; border-color: transparent; }
.seg button[data-s=Present][aria-pressed=true] { background: var(--ok); }
.seg button[data-s=Absent][aria-pressed=true] { background: var(--bad); }
.seg button[data-s=Late][aria-pressed=true] { background: var(--late); }
.seg button[data-s=Excused][aria-pressed=true] { background: var(--exc); }
li textarea { margin-top: 10px; padding: 8px 10px; resize: vertical; min-height: 0; }
li.dirty .name::after { content: " \2022"; color: var(--late); }

dialog { width: min(90vw, 360px); border: 0; border-radius: 14px; padding: 20px; text-align: center; box-shadow: 0 8px 32px rgba(0, 0, 0, .3); background: var(--surface); color: var(--fg); }
dialog::backdrop { background: rgba(0, 0, 0, .5); }
dialog h2 { margin: 0 0 8px; font-size: 1.15rem; color: var(--msg-ok); }
dialog p { margin: 0 0 16px; }
dialog button { margin: 0; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
.navitem svg { flex: none; }

/* Demo mode (demo.js): a strip above the header on every screen. */
.demobar { background: var(--warn-fg); color: var(--bg); padding: 6px 16px; font-size: 14px; text-align: center; }
.demobar a { color: inherit; font-weight: 600; }

/* Two-button dialogs (the Mark all present confirmation). */
.dlgbtns { display: flex; gap: 10px; }
.dlgbtns button { flex: 1; }

/* Session report (sessions.js): the written report and files under the roster */
.sreport { margin-top: 24px; padding-top: 16px; border-top: 1px solid var(--line); }
.sreport h3 { margin: 0 0 4px; }
.sreport h4 { margin: 16px 0 6px; }
.sreport textarea { min-height: 8rem; resize: vertical; margin-bottom: 8px; }
.sreport textarea:read-only { background: var(--surface-2); }
.srfile { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; padding: 8px 0; }
.srfile .srname { flex: 0 1 auto; font-weight: 600; overflow-wrap: anywhere; }   /* sits right beside the size; the buttons are pushed to the far side */
.srfile > button:first-of-type { margin-inline-start: auto; }
.srfile small { color: var(--muted); }
.srfile button { margin: 0; padding: 6px 12px; font-size: .9rem; }
.filebtn { display: inline-block; font: inherit; padding: 7px 16px; border: 1px solid var(--btn-bg); background: var(--surface); color: var(--link); border-radius: 10px; margin: 0 0 12px; cursor: pointer; font-weight: 400; }
.filebtn input[type=file] { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; }
.filebtn:focus-within { outline: 2px solid var(--link); outline-offset: 2px; }
.filebtn.busy { opacity: .5; pointer-events: none; }
#srMsg.err { color: var(--msg-err); }
#srMsg.ok { color: var(--msg-ok); }
@media print { .sreport { display: none; } }

/* The upload window (sessions.js): one row per chosen file, as in the SEA portal's upload dialog. */
dialog.updlg { width: min(92vw, 480px); text-align: start; }
.updlg h2 { color: var(--fg); }
#upList { max-height: 360px; overflow-y: auto; margin: 0 0 12px; padding-inline-end: 4px; }
.uprow { display: flex; flex-direction: column; gap: 4px; padding: 10px 0; }
.uprow:last-child { border-bottom: 0; }
.uphead { display: flex; align-items: center; gap: 8px; }
.upname { flex: 1 1 auto; min-width: 0; font-size: .9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: right; }   /* right = the start of this RTL page, also for a Latin name */
.uptime, .uppct { color: var(--muted); font-size: .8rem; white-space: nowrap; }
.uppct { min-width: 2.5em; text-align: end; }
.upbadge { font-size: .75rem; font-weight: 600; padding: 2px 8px; border-radius: 999px; white-space: nowrap; }
.upbadge:empty { display: none; }
.upbadge.done { background: var(--ok); color: #fff; }
.upbadge.failed { background: var(--bad); color: #fff; }
.upbadge.cancelled { background: var(--surface-2); color: var(--muted); }
.upbar { height: 6px; border-radius: 3px; background: var(--surface-2); overflow: hidden; }
.upbar span { display: block; height: 100%; width: 0; background: var(--teal); transition: width .2s; }
.upbar.failed span { background: var(--bad); }
.upbar.cancelled span { background: var(--late); }
.upnote { font-size: .8rem; color: var(--muted); }
.upnote:empty { display: none; }
.upnote.err { color: var(--msg-err); }
.upnote.warn { color: var(--late); }
.upcancel { align-self: flex-end; margin: 0; padding: 4px 12px; font-size: .85rem; }
#upSummary { margin: 0 0 12px; font-size: .9rem; color: var(--muted); }
#upSummary:empty { display: none; }
#upSummary.ok { color: var(--msg-ok); }

/* Past sessions: the term overview table (past.js). A row per student, a column per session that has happened; the date buttons open that session. */
.overview { margin: 4px 0 16px; }
.ovwrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); direction: rtl; } /* rtl: the student name is the right-most column and the dates run right to left, oldest first */
.ovtable { border-collapse: collapse; width: 100%; font-size: .9rem; }
.ovtable th, .ovtable td { padding: 6px 4px; border-bottom: 1px solid var(--line); text-align: center; }
.ovtable td, .ovtable th[scope=row] { white-space: nowrap; }
.ovcaption { margin: 4px 0 8px; font-weight: 600; }
main:has(#overview:not([hidden])) { max-width: 1100px; }   /* Past sessions: room for a whole term (about ten dates) without a scroll bar on a computer or tablet */
.ovtable tbody tr:last-child th, .ovtable tbody tr:last-child td { border-bottom: 0; }
.ovtable thead th { background: var(--surface-2); }
.ovtable th[scope=row] { text-align: right; font-weight: 600; background: var(--surface); position: sticky; inset-inline-start: 0; max-width: 11rem; overflow: hidden; text-overflow: ellipsis; }
.ovtable thead th:first-child { text-align: right; position: sticky; inset-inline-start: 0; }
.ovdate { margin: 0; padding: 4px 6px; font-size: .8rem; line-height: 1.25; white-space: normal; border-radius: 8px; border: 1px solid var(--line); background: transparent; color: var(--link); cursor: pointer; }
.ovdate span { display: block; }
.ovnum { font-size: .72rem; font-weight: 400; opacity: .85; }
.ovdate[aria-pressed=true] { background: var(--btn-bg); color: var(--on-btn); border-color: transparent; }
.mark { display: inline-block; min-width: 1.7em; padding: 2px 4px; border-radius: 6px; font-weight: 600; color: var(--muted); border: 1px solid var(--line); }
.mark[data-s=Present] { background: var(--ok); border-color: transparent; color: #fff; }
.mark[data-s=Absent] { background: var(--bad); border-color: transparent; color: #fff; }
.mark[data-s=Late] { background: var(--late); border-color: transparent; color: #fff; }
.mark[data-s=Excused] { background: var(--exc); border-color: transparent; color: #fff; }
.ovtable td.none { background: var(--surface-2); }
.picked { margin: 28px 0 8px; font-weight: 600; }
.legenditem { display: inline-block; margin: 0 0 6px 16px; white-space: nowrap; }
.legenditem .mark { margin-inline-end: 4px; }

/* Hover: anything that can be clicked changes slightly under the pointer (only where a pointer can hover, so a touch screen does not keep it lit). */
button, .filebtn, .tab, .ovdate { transition: background-color .12s, border-color .12s, filter .12s, color .12s; }
@media (hover: hover) {
  button:not(:disabled):hover, .filebtn:hover { background: var(--surface-2); border-color: var(--link); }
  button.primary:not(:disabled):hover { background: var(--btn-bg); border-color: var(--btn-bg); filter: brightness(1.12); }
  button.link:not(:disabled):hover { background: none; text-decoration-thickness: 2px; filter: brightness(1.2); }
  .tab:hover, .ovdate:hover { background: var(--surface-2); border-color: var(--link); }
  .tab[aria-selected=true]:hover, .ovdate[aria-pressed=true]:hover { background: var(--btn-bg); filter: brightness(1.12); }
  .seg button:not(:disabled):not([aria-pressed=true]):hover { color: var(--fg); background: var(--surface-2); }
  .seg button[aria-pressed=true]:not(:disabled):hover { filter: brightness(1.12); }
  button.navitem:not(.parent):hover { background: var(--surface-2); }
  a:hover { text-decoration: underline; }
}

/* The save window: spinner while saving, then the result with OK. */
dialog h2.bad { color: var(--msg-err); }
.spinner { width: 36px; height: 36px; margin: 0 auto 14px; border: 4px solid rgba(128, 128, 128, .3); border-top-color: currentColor; border-radius: 50%; animation: spin .8s linear infinite; }
.spinner[hidden], #btnBusyOk[hidden] { display: none; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Home: a few cards (term, sessions held, next session). */
.homecards { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; margin: 12px 0; }
.homecard { display: flex; flex-direction: column; gap: 4px; padding: 14px 16px; border-radius: 12px; background: var(--surface-2); }
.homecard strong { font-size: 1.15rem; }

/* The footer stays at the bottom of the display at all times; the page gets room under it so nothing is hidden behind it. */
#foot { position: fixed; inset: auto 0 0 0; z-index: 5; background: var(--bg); padding: 10px 16px; }
body { padding-bottom: 46px; }
@media print { #foot { display: none; } body { padding-bottom: 0; } }
