/* Teacher Portal - mobile first. Same teal as the main system (#0d9488). */
:root {
  --accent: #0d9488; --accent-dark: #0f766e; --accent-light: #f0fdf9;
  --bg: #f8fafc; --card: #ffffff; --border: #e2e8f0;
  --text: #0f172a; --muted: #64748b; --bad: #dc2626; --ok: #059669; --warn: #b45309;
  --radius: 12px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', sans-serif; font-size: 15px;
       background: var(--bg); color: var(--text); line-height: 1.45; }
a { color: var(--accent-dark); text-decoration: none; }
h1 { font-size: 20px; margin: 0 0 4px; font-weight: 800; }
h2 { font-size: 16px; margin: 0 0 8px; font-weight: 800; }
h2.section { margin: 22px 0 10px; font-size: 13px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); }
.muted { color: var(--muted); font-weight: 400; }
.small { font-size: 13px; }

/* Header */
.top { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; justify-content: space-between; gap: 10px;
       padding: 10px 16px; padding-top: max(10px, env(safe-area-inset-top));
       background: linear-gradient(135deg, var(--accent), var(--accent-dark)); color: #fff; }
.brand { display: flex; align-items: center; gap: 10px; color: #fff; min-width: 0; }
.brand-mark { width: 34px; height: 34px; border-radius: 9px; background: rgba(255,255,255,.2); display: grid; place-items: center; font-weight: 800; font-size: 13px; flex-shrink: 0; }
.brand strong { display: block; font-size: 15px; }
.brand small { display: block; font-size: 11px; opacity: .85; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-user { display: flex; align-items: center; gap: 10px; margin: 0; font-size: 13px; }
.top-user .who { max-width: 40vw; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
button.link { background: rgba(255,255,255,.18); color: #fff; border: 0; border-radius: 8px; padding: 7px 10px; font: inherit; font-weight: 700; cursor: pointer; white-space: nowrap; }
@media (max-width: 480px) { .top-user .who { display: none; } }   /* name is in the page greeting; keep the bar to one line */

.wrap { max-width: 980px; margin: 0 auto; padding: 16px 16px 110px; }
.foot { text-align: center; padding: 0 16px 30px; font-size: 13px; }

/* Cards, forms */
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; margin-bottom: 14px; }
.card.narrow { max-width: 420px; margin: 24px auto; }
.card.flush { padding: 0; overflow: hidden; }
.pad { padding: 16px; margin: 0; }
label { display: block; font-size: 13px; font-weight: 700; margin: 14px 0 6px; }
input[type=text], input[type=password] { width: 100%; padding: 12px 14px; font: inherit; font-size: 16px; border: 1px solid var(--border);
       border-radius: 10px; background: #fff; color: var(--text); }
input:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: var(--accent); }
.btn { display: inline-block; background: var(--accent); color: #fff; border: 0; border-radius: 10px; padding: 12px 20px;
       font: inherit; font-weight: 800; cursor: pointer; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-block { width: 100%; margin-top: 18px; }

.flash { border-radius: 10px; padding: 11px 14px; margin-bottom: 12px; font-size: 14px; border: 1px solid; }
.flash-success { background: #ecfdf5; border-color: #a7f3d0; color: #065f46; }
.flash-error   { background: #fef2f2; border-color: #fecaca; color: #991b1b; }
.flash-info    { background: #eff6ff; border-color: #bfdbfe; color: #1e40af; }

.page-head { margin-bottom: 12px; }
.back { display: inline-block; font-size: 14px; font-weight: 700; margin-bottom: 6px; padding: 4px 0; }

/* Term tabs */
.tabs { display: flex; gap: 6px; margin: 4px 0 14px; }
.tabs a { flex: 1; text-align: center; padding: 10px 6px; border-radius: 10px; border: 1px solid var(--border); background: var(--card);
          font-weight: 700; font-size: 14px; color: var(--text); }
.tabs a.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.lock { font-size: 12px; }

/* Home tiles */
.grid { display: grid; grid-template-columns: 1fr; gap: 10px; }
@media (min-width: 600px) { .grid { grid-template-columns: 1fr 1fr; } }
@media (min-width: 900px) { .grid { grid-template-columns: 1fr 1fr 1fr; } }
.tile { display: block; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; color: var(--text); }
.tile:active { transform: scale(.99); }
.tile-class { border-left: 4px solid var(--accent); }
.tile-title { font-size: 17px; font-weight: 800; margin-top: 6px; }
.tile-sub, .tile-foot { font-size: 13px; color: var(--muted); }
.pill { display: inline-block; font-size: 11px; font-weight: 800; padding: 3px 9px; border-radius: 99px; background: #fef3c7; color: var(--warn); }
.pill-ok { background: #d1fae5; color: var(--ok); }
.tile-class .pill { background: var(--accent-light); color: var(--accent-dark); }
.bar { display: block; height: 6px; border-radius: 99px; background: #e2e8f0; overflow: hidden; margin: 10px 0 6px; }
.bar > span { display: block; height: 100%; background: var(--accent); border-radius: 99px; }

/* Marks entry */
.help { margin: 0 0 10px; }
.mlist { list-style: none; margin: 0; padding: 0; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.mrow { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 12px; border-bottom: 1px solid var(--border); }
.mrow:last-child { border-bottom: 0; }
.mname { display: flex; align-items: center; gap: 10px; min-width: 0; }
.mname strong { display: block; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mname small, td small { display: block; font-size: 12px; color: var(--muted); }
.num { width: 24px; text-align: right; color: var(--muted); font-size: 12px; flex-shrink: 0; }
.mcell { display: flex; align-items: center; gap: 4px; flex-shrink: 0; }
.mcell input.mark { width: 68px; text-align: center; padding: 10px 6px; font-size: 17px; font-weight: 700; }
.mcell input.mark.bad { border-color: var(--bad); background: #fef2f2; color: var(--bad); }
.mcell input[readonly] { background: #f1f5f9; }
.tok { border: 1px solid var(--border); background: #fff; border-radius: 8px; padding: 10px 7px; font: inherit; font-size: 12px; font-weight: 800; color: var(--muted); cursor: pointer; }
.savebar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; display: flex; align-items: center; justify-content: space-between; gap: 12px;
           padding: 12px 16px; padding-bottom: max(12px, env(safe-area-inset-bottom));
           background: rgba(255,255,255,.97); border-top: 1px solid var(--border); box-shadow: 0 -4px 16px rgba(15,23,42,.06); font-size: 14px; font-weight: 700; }

/* Class page */
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
@media (min-width: 700px) { .stats { grid-template-columns: repeat(4, 1fr); } }
.stats > div { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; }
.stats b { display: block; font-size: 22px; font-weight: 800; }
.stats span { font-size: 12px; color: var(--muted); }
.srow { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-bottom: 1px solid var(--border); color: var(--text); }
.srow:last-child { border-bottom: 0; }
.sname { flex: 1; min-width: 0; }
.sname strong { display: block; font-size: 14px; }
.sname small { display: block; font-size: 12px; color: var(--muted); }
.sprog { width: 90px; flex-shrink: 0; text-align: right; }
.sprog .bar { margin: 0 0 3px; }
.sprog small { font-size: 12px; color: var(--muted); }
.go { font-weight: 800; font-size: 13px; color: var(--accent-dark); flex-shrink: 0; }
.scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.tbl { border-collapse: collapse; width: 100%; font-size: 13px; }
.tbl th, .tbl td { padding: 8px 10px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.tbl th { background: #f1f5f9; font-size: 11px; text-transform: uppercase; letter-spacing: .3px; color: var(--muted); text-align: left; }
.tbl th.sub { text-transform: none; letter-spacing: 0; }
.tbl .c { text-align: center; }
.tbl .stick { position: sticky; left: 0; background: var(--card); z-index: 1; min-width: 150px; box-shadow: 1px 0 0 var(--border); }
.tbl th.stick { background: #f1f5f9; }
.tbl td.low { color: var(--bad); font-weight: 700; }
