/* Attendance register. ETMark palette, Atkinson Hyperlegible for fast reading of names and codes. */
:root {
  --navy: #002330;
  --navy-2: #0b3a4c;
  --cyan: #00aeef;
  --pale: #e6f7fd;
  --bg: #e6f7fd;
  --line: #d3e2e9;
  --muted: #557080;
  --white: #ffffff;

  --p: #17804a;   --p-bg: #e2f3e9;
  --a: #c4352b;   --a-bg: #fbe6e4;
  --h: #9a6200;   --h-bg: #fcefd3;
  --ncs: #56697a; --ncs-bg: #e6edf1;
  --wa: #0f7d6e;  --wa-dark: #0a5f54;

  --font: 'Outfit', system-ui, -apple-system, 'Segoe UI', sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  color: var(--navy);
  background: var(--bg);
}
a { color: #00739f; }
h1, h2, h3 { line-height: 1.2; margin: 0; }
h1 { font-size: 1.75rem; }
h2 { font-size: 1.2rem; }
p { margin: 0 0 .75rem; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 3px solid var(--cyan); outline-offset: 2px; }

/* Top bar */
.top { background: var(--navy); color: var(--white); border-bottom: 4px solid var(--cyan); }
.top-in {
  max-width: 1120px; margin: 0 auto; padding: .75rem 1.25rem;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: .7rem; color: var(--white); text-decoration: none; }
.brand-mark {
  display: grid; place-items: center; width: 2.1rem; height: 2.1rem;
  border: 2px solid var(--cyan); border-radius: 6px; font-weight: 700; color: var(--cyan);
}
.brand-text { font-weight: 700; display: flex; flex-direction: column; line-height: 1.15; }
.brand-text small { font-weight: 400; color: #9fd9ef; font-size: .8rem; }
.nav { display: flex; gap: .25rem; flex-wrap: wrap; }
.nav a {
  color: #cfe9f3; text-decoration: none; padding: .45rem .75rem; border-radius: 6px; font-size: .95rem;
}
.nav a:hover { background: var(--navy-2); color: var(--white); }
.nav a.on { background: var(--cyan); color: var(--navy); font-weight: 700; }
.nav-out { opacity: .8; }

.wrap { max-width: 1120px; margin: 0 auto; padding: 1.5rem 1.25rem 4rem; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.25rem; }
.section-title { margin: 2rem 0 .75rem; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  font: inherit; font-weight: 700; font-size: .95rem; line-height: 1;
  padding: .7rem 1rem; min-height: 44px; border-radius: 8px; cursor: pointer;
  border: 1.5px solid var(--navy); background: var(--white); color: var(--navy); text-decoration: none;
}
.btn:hover { background: var(--pale); }
.btn-primary { background: var(--navy); color: var(--white); }
.btn-primary:hover { background: var(--navy-2); }
.btn-ghost { border-color: var(--line); }
.btn-small { min-height: 36px; padding: .45rem .7rem; font-size: .875rem; }
.btn-danger { color: var(--a); border-color: #efc4c0; }
.btn-danger:hover { background: var(--a-bg); }
.btn-wa { background: var(--wa); border-color: var(--wa); color: var(--white); }
.btn-wa:hover { background: var(--wa-dark); }
.btn-wa.sent { background: var(--white); color: var(--wa); border-color: #a8d6cf; }
.linkish { font: inherit; background: none; border: 0; color: #00739f; text-decoration: underline; cursor: pointer; padding: .25rem; }

/* Messages */
.flash { padding: .8rem 1rem; border-radius: 8px; margin-bottom: 1rem; border-left: 5px solid; }
.flash-ok { background: var(--p-bg); border-color: var(--p); }
.flash-err { background: var(--a-bg); border-color: var(--a); }
.flash-warn { background: var(--h-bg); border-color: var(--h); }

.empty { background: var(--white); border: 1.5px dashed var(--line); border-radius: 12px; padding: 2rem 1.5rem; text-align: center; }
.empty h2 { margin-bottom: .5rem; }
.empty .btn { margin-top: .5rem; }

/* Forms */
label { display: flex; flex-direction: column; gap: .3rem; font-weight: 700; font-size: .9rem; }
.opt { font-weight: 400; color: var(--muted); }
input, select {
  font: inherit; font-weight: 400; color: var(--navy);
  padding: .6rem .7rem; min-height: 44px; border: 1.5px solid var(--line); border-radius: 8px; background: var(--white);
  width: 100%;
}
input:focus, select:focus { border-color: var(--cyan); outline: none; box-shadow: 0 0 0 3px rgba(0, 174, 239, .2); }
input[type=checkbox], input[type=radio] { width: auto; min-height: 0; }
label.check { flex-direction: row; align-items: center; gap: .5rem; font-weight: 400; }
.stack { display: grid; gap: 1rem; }

.panel { background: var(--white); border: 1px solid var(--line); border-radius: 12px; padding: 1.25rem; margin-bottom: 1rem; }
.panel h2 { margin-bottom: 1rem; }
.grid-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.span-2 { grid-column: span 2; }
.form-actions { display: flex; gap: .5rem; }
.import summary { cursor: pointer; font-weight: 700; }
.import[open] summary { margin-bottom: .75rem; }
.inline-form { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; margin-bottom: .5rem; }
.inline-form input[type=file] { width: auto; flex: 1 1 240px; }

.login { max-width: 380px; margin: 3rem auto; background: var(--white); border: 1px solid var(--line); border-radius: 12px; padding: 1.75rem; }
.login h1 { margin-bottom: .25rem; }

/* Lists and tables */
.list-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; margin: 2rem 0 .75rem; }
.count { display: inline-block; background: var(--pale); border-radius: 99px; padding: 0 .55rem; font-size: .9rem; color: var(--navy-2); }
.filters { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.filters select, .filters input[type=search] { width: auto; min-width: 180px; }

.table-wrap { overflow-x: auto; background: var(--white); border: 1px solid var(--line); border-radius: 12px; }
.table { width: 100%; border-collapse: collapse; font-size: .95rem; }
.table th, .table td { padding: .7rem .85rem; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table thead th { background: var(--pale); font-size: .85rem; color: var(--navy-2); white-space: nowrap; }
.table tbody tr:last-child td { border-bottom: 0; }
.table .num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.table .n { text-align: right; font-variant-numeric: tabular-nums; }
.table .pct { font-weight: 700; }
.low { color: var(--a); }
.is-inactive td { color: var(--muted); }
.row-actions { display: flex; gap: .4rem; justify-content: flex-end; }
.row-actions form { margin: 0; }

.tag { display: inline-block; font-size: .8rem; font-weight: 700; padding: .15rem .55rem; border-radius: 99px; vertical-align: middle; }
.tag-done { background: var(--p-bg); color: var(--p); }
.tag-part { background: var(--h-bg); color: var(--h); }
.tag-none { background: var(--ncs-bg); color: var(--ncs); }

/* Dashboard */
.batch-list { list-style: none; margin: 0; padding: 0; background: var(--white); border: 1px solid var(--line); border-radius: 12px; }
.batch-item { display: grid; grid-template-columns: 1fr auto auto; gap: 1rem; align-items: center; padding: 1rem 1.25rem; border-bottom: 1px solid var(--line); }
.batch-item:last-child { border-bottom: 0; }
.batch-name { display: flex; flex-direction: column; }
.batch-name strong { font-size: 1.1rem; }
.batch-actions { display: flex; gap: .5rem; }

/* Pickers */
.picker { display: flex; gap: .75rem; flex-wrap: wrap; align-items: flex-end; margin-bottom: 1.25rem; }
.picker label { min-width: 170px; }
.ranges { display: flex; gap: .25rem; margin-left: auto; }
.ranges a { padding: .5rem .7rem; border-radius: 6px; text-decoration: none; font-size: .9rem; }
.ranges a.on { background: var(--navy); color: var(--white); }

.day-nav { display: flex; justify-content: space-between; align-items: center; gap: .5rem; margin-bottom: 1rem; }
.day-nav strong { font-size: 1.15rem; text-align: center; }

/* Marking register: the heart of the app */
.quick { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin-bottom: .75rem; }
.chip {
  font: inherit; font-size: .875rem; font-weight: 700; padding: .45rem .8rem; min-height: 36px;
  border-radius: 99px; border: 1.5px solid currentColor; background: var(--white); cursor: pointer;
}
.chip-P { color: var(--p); }   .chip-P:hover { background: var(--p-bg); }
.chip-A { color: var(--a); }   .chip-A:hover { background: var(--a-bg); }
.chip-H { color: var(--h); }   .chip-H:hover { background: var(--h-bg); }
.chip-NCS { color: var(--ncs); } .chip-NCS:hover { background: var(--ncs-bg); }

.register { list-style: none; margin: 0; padding: 0; background: var(--white); border: 1px solid var(--line); border-radius: 12px 12px 0 0; }
.reg-row {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 1rem; align-items: center;
  padding: .6rem 1rem; border-bottom: 1px solid var(--line);
}
.reg-row:nth-child(5n) { border-bottom-color: #b9cfd9; }
.who { display: flex; align-items: baseline; gap: .9rem; min-width: 0; }
.roll { font-variant-numeric: tabular-nums; color: var(--muted); font-size: .85rem; min-width: 6.5rem; }
.name { font-weight: 700; font-size: 1.05rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.marks { display: flex; gap: .35rem; }
.mark { position: relative; display: block; cursor: pointer; }
.mark input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.mark > span:first-of-type {
  display: grid; place-items: center; min-width: 3.1rem; height: 44px; padding: 0 .5rem;
  border: 1.5px solid var(--line); border-radius: 8px; background: var(--white);
  font-weight: 700; font-size: .95rem; color: var(--muted); letter-spacing: .02em;
  transition: background-color .12s, color .12s, border-color .12s, transform .12s;
}
.mark:hover > span:first-of-type { border-color: var(--navy); }
.mark input:focus-visible + span { outline: 3px solid var(--cyan); outline-offset: 2px; }
.mark input:checked + span { color: var(--white); transform: scale(1.04); }
.m-P input:checked + span { background: var(--p); border-color: var(--p); }
.m-A input:checked + span { background: var(--a); border-color: var(--a); }
.m-H input:checked + span { background: var(--h); border-color: var(--h); }
.m-NCS input:checked + span { background: var(--ncs); border-color: var(--ncs); }

.savebar {
  position: sticky; bottom: 0; z-index: 5;
  display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap;
  background: var(--navy); color: var(--white); padding: .75rem 1rem; border-radius: 0 0 12px 12px;
}
.savebar .btn-primary { background: var(--cyan); border-color: var(--cyan); color: var(--navy); }
.savebar .btn-primary:hover { background: #33c1f3; }
.savebar .muted { color: #9fd9ef; }
.tally { display: flex; gap: .9rem; flex-wrap: wrap; align-items: center; font-variant-numeric: tabular-nums; }
.t { font-weight: 700; }
.t b { display: inline-block; min-width: 1.6rem; }
.t-P { color: #8fe0b2; } .t-A { color: #ffaaa3; } .t-H { color: #ffd27a; } .t-NCS { color: #c3d3dd; }
.clear-day { margin-top: 1rem; text-align: right; }

/* Reports */
.report-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; margin-bottom: .75rem; }
.report-head h2 .muted { font-weight: 400; font-size: 1rem; margin-left: .35rem; }
.sendbar { background: #e3f3f0; border: 1px solid #b7ddd6; border-radius: 12px; padding: 1rem 1.25rem; margin-bottom: 1rem; }
.sendbar-actions { display: flex; align-items: center; gap: .9rem; flex-wrap: wrap; }
tr.next-up td { background: #f0faf8; }

.person-meta { display: flex; flex-wrap: wrap; gap: .4rem 1.5rem; color: var(--muted); }
.person-meta b { color: var(--navy); }
.stats { display: grid; grid-template-columns: 1.4fr repeat(4, 1fr); gap: .5rem; margin: 1rem 0 .5rem; }
.stat { background: var(--white); border: 1px solid var(--line); border-top: 5px solid var(--line); border-radius: 10px; padding: .9rem 1rem; display: flex; flex-direction: column; }
.stat b { font-size: 1.8rem; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat span { color: var(--muted); font-size: .9rem; }
.s-pct { background: var(--navy); color: var(--white); border-color: var(--navy); border-top-color: var(--cyan); }
.s-pct span { color: #9fd9ef; }
.s-pct.low { border-top-color: #ff8a80; }
.s-pct.low b { color: #ffaaa3; }
.s-P { border-top-color: var(--p); } .s-A { border-top-color: var(--a); }
.s-H { border-top-color: var(--h); } .s-NCS { border-top-color: var(--ncs); }
.send-one { display: flex; align-items: flex-start; gap: 1rem; flex-wrap: wrap; margin: 1.25rem 0; }
.send-one details summary { cursor: pointer; padding: .7rem 0; color: #00739f; }
.wa-preview {
  font-family: var(--font); white-space: pre-wrap; background: #dcf8c6; color: #10251c;
  padding: .9rem 1rem; border-radius: 0 10px 10px 10px; max-width: 360px; margin: .25rem 0 0; font-size: .92rem;
}

.code {
  display: inline-block; min-width: 2rem; text-align: center; font-weight: 700; font-size: .78rem;
  padding: .12rem .3rem; border-radius: 5px;
}
.c-P { background: var(--p-bg); color: var(--p); }
.c-A { background: var(--a-bg); color: var(--a); }
.c-H { background: var(--h-bg); color: var(--h); }
.c-NCS { background: var(--ncs-bg); color: var(--ncs); }

.grid { border-collapse: collapse; font-size: .85rem; }
.grid th, .grid td { border-bottom: 1px solid var(--line); padding: .35rem .25rem; text-align: center; }
.grid thead th { background: var(--pale); font-weight: 700; min-width: 2.6rem; }
.grid thead th span { display: block; font-size: .95rem; }
.grid thead th small { color: var(--muted); font-weight: 400; }
.grid .g-name {
  position: sticky; left: 0; z-index: 1; background: var(--white); text-align: left;
  padding: .35rem .75rem; white-space: nowrap; font-weight: 700; min-width: 12rem; border-right: 1px solid var(--line);
}
.grid thead .g-name { background: var(--pale); }
.legend { display: flex; gap: 1rem; flex-wrap: wrap; margin-top: .6rem; }

/* Import */
.steps { margin: 0 0 .75rem; padding-left: 1.25rem; }
.steps li { margin-bottom: .35rem; }
.sub { font-size: 1rem; margin: 1.25rem 0 .5rem; }
.plain { margin: 0; padding-left: 1.1rem; }
.plain li { margin-bottom: .2rem; }
.notes { margin: 0; padding: .8rem 1rem .8rem 2rem; background: var(--h-bg); border-radius: 10px; }
.notes li { margin-bottom: .35rem; }
.stats-plain { grid-template-columns: repeat(6, 1fr); }
.date-map { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .5rem; }
.date-map span { display: inline-flex; flex-direction: column; font-size: .8rem; color: var(--muted); border: 1px solid var(--line); border-radius: 6px; padding: .3rem .5rem; }
.date-map b { color: var(--navy); }
.panel details summary { cursor: pointer; color: #00739f; margin-top: .5rem; }
.panel > .form-actions { margin-top: 1.25rem; flex-wrap: wrap; }
.panel > .form-actions form { margin: 0; }

/* Roster */
.rf { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1.25rem; margin-bottom: 2rem; }
.rf-field { display: flex; flex-direction: column; gap: .6rem; font-weight: 400; position: relative; }
.rf-label { font-size: .72rem; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--navy); }
.rf-box {
  display: flex; align-items: center; gap: .6rem; min-height: 60px; padding: 0 1.25rem;
  background: var(--white); border-radius: 18px; box-shadow: 0 6px 18px rgba(0, 35, 48, .06);
}
.rf-box svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.rf-search { color: #8aa3ae; }
.rf-box input, .rf-box select {
  border: 0; box-shadow: none; background: transparent; min-height: 58px; padding: 0; font-weight: 500; font-size: 1rem; color: var(--navy);
}
.rf-box input:focus, .rf-box select:focus { box-shadow: none; }
.rf-box:focus-within { box-shadow: 0 0 0 3px rgba(0, 174, 239, .35), 0 6px 18px rgba(0, 35, 48, .06); }
.rf-select { position: relative; }
.rf-select select { appearance: none; -webkit-appearance: none; padding-right: 1.75rem; cursor: pointer; }
.rf-select svg { position: absolute; right: 1.25rem; color: var(--cyan); pointer-events: none; }
.rf-multi { display: block; padding: 0; }
.rf-multi summary {
  list-style: none; display: flex; justify-content: space-between; align-items: center;
  min-height: 60px; padding: 0 1.25rem; cursor: pointer; font-weight: 500;
}
.rf-multi summary::-webkit-details-marker { display: none; }
.rf-multi summary svg { color: var(--cyan); }
.rf-multi[open] summary svg { transform: rotate(180deg); }
.rf-menu {
  position: absolute; z-index: 20; left: 0; right: 0; top: calc(100% + .4rem);
  background: var(--white); border-radius: 16px; box-shadow: 0 14px 34px rgba(0, 35, 48, .16);
  padding: .9rem 1rem; display: grid; gap: .35rem; max-height: 340px; overflow-y: auto;
}
.rf-menu-tools { display: flex; justify-content: space-between; margin-bottom: .25rem; }
.rf-menu .check { font-weight: 500; }
.rf-custom { display: flex; gap: .4rem; flex-wrap: wrap; }
.rf-custom[hidden] { display: none; }
.rf-custom input { flex: 1 1 120px; border-radius: 12px; }

.roster-head { display: flex; align-items: center; gap: 1.25rem; margin-bottom: .25rem; }
.roster-icon {
  display: grid; place-items: center; width: 60px; height: 60px; border-radius: 18px; background: var(--navy);
  box-shadow: 0 8px 18px rgba(0, 35, 48, .25);
}
.roster-icon svg { width: 28px; height: 28px; fill: none; stroke: var(--cyan); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.roster-head h1 { font-size: 2rem; font-weight: 600; letter-spacing: -.01em; }
.roster-sub { display: block; font-size: .72rem; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--cyan); }
.roster-bar { display: flex; align-items: center; gap: 1.5rem; margin-bottom: 2rem; }
.roster-bar form { margin: 0; }
.rf-sort { min-height: 50px; border-radius: 14px; padding: 0 1rem 0 1.2rem; }
.rf-sort select { min-height: 48px; font-size: .78rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; padding-right: 2rem; }
.rf-sort svg { right: 1rem; color: var(--navy); }
.roster-count { display: flex; flex-direction: column; align-items: center; line-height: 1.1; }
.roster-count b { font-size: 1.6rem; font-weight: 600; }
.roster-count span { font-size: .7rem; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }

.rgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 1.25rem; }
.rcard {
  --lvl: #10b981;
  background: var(--white); border-radius: 30px; padding: 1.6rem 1.6rem 1.5rem;
  box-shadow: 0 10px 30px rgba(0, 35, 48, .06); display: flex; flex-direction: column;
}
.rcard.lvl-good { --lvl: #00aeef; }
.rcard.lvl-avg { --lvl: #f59e0b; }
.rcard.lvl-low { --lvl: #e53935; }
.rcard.lvl-none { --lvl: #9aaab4; }
.rcard.is-inactive { opacity: .7; }
.rc-head { display: flex; align-items: flex-start; gap: 1rem; margin-bottom: 1.6rem; }
.rc-avatar {
  display: grid; place-items: center; flex: none; width: 56px; height: 56px; border-radius: 16px; background: var(--navy);
}
.rc-avatar svg { width: 24px; height: 24px; fill: none; stroke: var(--cyan); stroke-width: 2; stroke-linecap: round; }
.rc-who { display: flex; flex-direction: column; min-width: 0; flex: 1; padding-top: .1rem; }
.rc-name { color: var(--navy); text-decoration: none; font-size: 1.15rem; font-weight: 500; line-height: 1.25; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rc-name:hover { color: #00739f; }
.rc-batch { font-size: .68rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--cyan); margin-top: .35rem; }
.rc-roll { font-size: .66rem; letter-spacing: .1em; color: #9aaab4; }
.rc-wa {
  display: grid; place-items: center; flex: none; width: 40px; height: 40px; border-radius: 12px;
  background: #e8f8f0; color: #10b981;
}
.rc-wa svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linejoin: round; }
.rc-wa:hover { background: #10b981; color: var(--white); }
.rc-wa.sent { background: #10b981; color: var(--white); }
.rc-wa-off { background: #eef2f4; color: #9aaab4; }
.rc-wa-off:hover { background: #dde5e9; color: var(--muted); }
.rc-pct-row { display: flex; justify-content: space-between; align-items: flex-end; margin-bottom: .55rem; }
.rc-label { font-size: .7rem; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); padding-bottom: .35rem; }
.rc-pct { font-size: 2.4rem; font-weight: 500; line-height: 1; color: var(--lvl); font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.rc-bar { height: 10px; border-radius: 99px; background: #edf2f4; overflow: hidden; }
.rc-bar span { display: block; height: 100%; border-radius: 99px; background: var(--lvl); }
.rc-counts {
  display: grid; grid-template-columns: repeat(4, 1fr); margin: 1.6rem 0 1.4rem; padding-top: 1.3rem; border-top: 1px solid #edf2f4;
}
.rc-counts div { display: flex; flex-direction: column-reverse; align-items: center; gap: .35rem; }
.rc-counts dd { margin: 0; font-size: 1.5rem; font-weight: 600; line-height: 1; font-variant-numeric: tabular-nums; }
.rc-counts dt { font-size: .6rem; letter-spacing: .12em; text-transform: uppercase; color: #9aaab4; }
.k-p dd { color: #10b981; } .k-a dd { color: #e53935; } .k-h dd { color: #1e88e5; } .k-n dd { color: #8a9ba6; }
.rc-level {
  margin-top: auto; text-align: center; padding: .7rem; border-radius: 14px; background: var(--navy); color: var(--white);
  font-size: .7rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase;
}
.lvl-avg .rc-level { background: #fff3dc; color: #a36400; }
.lvl-low .rc-level { background: #fde7e6; color: #c62828; }
.lvl-none .rc-level { background: #eef2f4; color: var(--muted); }

/* Absentee report */
.share-btn {
  margin-left: auto; display: inline-flex; align-items: center; gap: .6rem; min-height: 50px; padding: 0 1.3rem;
  border: 0; border-radius: 14px; background: var(--cyan); color: var(--navy); cursor: pointer;
  font: inherit; font-size: .78rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase;
  box-shadow: 0 8px 18px rgba(0, 174, 239, .25);
}
.share-btn:hover { background: #33c1f3; }
.share-btn:disabled { opacity: .5; cursor: not-allowed; }
.share-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.ab-modal {
  width: min(800px, calc(100vw - 2rem)); max-height: calc(100vh - 2rem); border: 0; border-radius: 40px;
  padding: 2.5rem 2.5rem 2.25rem; color: var(--navy); box-shadow: 0 30px 80px rgba(0, 35, 48, .3);
}
.ab-modal::backdrop { background: rgba(0, 35, 48, .45); backdrop-filter: blur(3px); }
.ab-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; margin-bottom: 2rem; }
.ab-head h2 { font-size: 1.9rem; font-weight: 600; letter-spacing: -.01em; }
.ab-head p { margin: .35rem 0 0; font-size: .72rem; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: #8aa0aa; }
.ab-close { display: grid; place-items: center; width: 50px; height: 50px; border: 0; border-radius: 14px; background: var(--pale); color: var(--navy); cursor: pointer; flex: none; }
.ab-close svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.ab-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.ab-box { display: flex; align-items: center; min-height: 58px; padding: 0 1.4rem; background: var(--pale); border-radius: 18px; position: relative; }
.ab-box input, .ab-box select { border: 0; background: transparent; box-shadow: none; padding: 0; min-height: 56px; font-weight: 500; font-size: 1rem; }
.ab-box input:focus, .ab-box select:focus { box-shadow: none; }
.ab-box:focus-within { box-shadow: 0 0 0 3px rgba(0, 174, 239, .35); }
.ab-box.rf-select svg { width: 18px; height: 18px; fill: none; stroke: var(--navy); stroke-width: 2; }
.ab-check { flex-direction: row; align-items: center; gap: .7rem; margin: 1.4rem 0 .5rem; font-size: .75rem; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); cursor: pointer; }
.ab-check input { width: 20px; height: 20px; accent-color: var(--cyan); }
.ab-scope { font-size: .82rem; color: var(--muted); margin-bottom: .8rem; }
.ab-text {
  width: 100%; min-height: 190px; resize: vertical; border: 0; border-radius: 22px; background: var(--pale); color: var(--navy);
  padding: 1.3rem 1.5rem; font-family: ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace; font-size: .9rem; line-height: 1.6;
}
.ab-text:focus { outline: none; box-shadow: 0 0 0 3px rgba(0, 174, 239, .35); }
.ab-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-top: 1rem; }
.ab-btn {
  display: grid; place-items: center; min-height: 60px; border: 0; border-radius: 18px; cursor: pointer; text-decoration: none;
  font: inherit; font-size: .82rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase;
}
.ab-send { background: #10b981; color: var(--white); }
.ab-send:hover { background: #0e9f6f; }
.ab-copy { background: var(--navy); color: var(--white); }
.ab-copy:hover { background: var(--navy-2); }

/* Login portal */
body.bare .wrap { max-width: 1180px; min-height: 100vh; display: flex; flex-direction: column; justify-content: center; }
.portal { padding: 3rem 0; }
.portal-head { text-align: center; margin-bottom: 4rem; }
.portal-head h1 { font-size: clamp(2.5rem, 6vw, 3.75rem); font-weight: 700; letter-spacing: -.03em; color: var(--navy); }
.portal-head h1 span { color: var(--cyan); }
.portal-head p { margin-top: .6rem; font-size: .75rem; font-weight: 600; letter-spacing: .3em; text-transform: uppercase; color: #8aa0aa; }
.portal-roles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 2rem; max-width: 1120px; margin: 0 auto; }
.role-card {
  display: flex; flex-direction: column; align-items: center; gap: .5rem; padding: 2.75rem 1.5rem 3rem;
  background: rgba(255, 255, 255, .55); border-radius: 56px; text-decoration: none; color: var(--navy);
  transition: background-color .15s, transform .15s, box-shadow .15s;
}
.role-card:hover, .role-card:focus-visible { background: var(--white); transform: translateY(-3px); box-shadow: 0 16px 36px rgba(0, 35, 48, .08); }
.role-text { display: flex; flex-direction: column; align-items: center; gap: .45rem; margin-top: 1.4rem; }
.role-card strong { font-size: 1.5rem; font-weight: 600; }
.role-card small { font-size: .72rem; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: #8aa0aa; }
.role-icon {
  display: grid; place-items: center; width: 80px; height: 80px; border-radius: 20px; background: var(--navy); color: var(--cyan);
  box-shadow: 0 14px 30px rgba(0, 35, 48, .18);
}
.role-icon-student { background: var(--cyan); color: var(--navy); }
.role-icon svg { width: 32px; height: 32px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.portal-login {
  position: relative; max-width: 420px; margin: 0 auto; padding: 2.5rem 2rem 2rem; text-align: center;
  background: var(--white); border-radius: 40px; box-shadow: 0 16px 40px rgba(0, 35, 48, .08);
  display: flex; flex-direction: column; align-items: center;
}
.portal-login h2 { font-size: 1.5rem; font-weight: 600; margin: 1.25rem 0 1.25rem; }
.portal-login form { width: 100%; text-align: left; }
.portal-login .flash { width: 100%; text-align: left; }
.portal-back { position: absolute; top: 1.2rem; left: 1.5rem; font-size: .85rem; color: var(--muted); }

/* Student view */
.me-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 1.5rem; flex-wrap: wrap; margin-bottom: 1.75rem; }
.me-head h1 { font-size: 2rem; font-weight: 600; }
.me-meta { display: flex; gap: 1rem; margin: .35rem 0 0; font-size: .75rem; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--cyan); }
.me-range { min-width: 260px; }
.me-grid { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 1.25rem; align-items: start; }
.me-side { background: var(--white); border-radius: 30px; padding: 1.6rem; box-shadow: 0 10px 30px rgba(0, 35, 48, .06); }
.me-side h2 { margin-bottom: 1rem; }
.missed { list-style: none; margin: 0 0 1rem; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: .5rem; }
.missed li { display: flex; flex-direction: column; padding: .6rem .8rem; border-radius: 14px; background: var(--a-bg); }
.missed b { color: var(--a); font-weight: 600; }
.missed span { font-size: .78rem; color: var(--muted); }
.me-month { margin-bottom: 1rem; }
.me-month caption { text-align: left; padding: .9rem .85rem .4rem; font-weight: 600; }

/* Small screens */
@media (max-width: 1000px) {
  .rf { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 720px) {
  h1 { font-size: 1.4rem; }
  .wrap { padding: 1rem .9rem 4rem; }
  .grid-form { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
  .batch-item { grid-template-columns: 1fr; gap: .5rem; }
  .reg-row { grid-template-columns: 1fr; gap: .45rem; padding: .7rem .8rem; }
  .who { gap: .6rem; }
  .roll { min-width: 0; }
  .marks { display: grid; grid-template-columns: repeat(4, 1fr); }
  .mark > span:first-of-type { min-width: 0; }
  .picker label { flex: 1 1 140px; min-width: 0; }
  .ranges { margin-left: 0; }
  .stats, .stats-plain { grid-template-columns: repeat(2, 1fr); }
  .rf { grid-template-columns: 1fr; gap: .9rem; margin-bottom: 1.5rem; }
  .portal-head { margin-bottom: 2rem; }
  .roster-bar { flex-wrap: wrap; gap: 1rem; }
  .share-btn { margin-left: 0; width: 100%; justify-content: center; }
  .ab-modal { padding: 1.5rem 1.25rem; border-radius: 28px; }
  .ab-fields, .ab-actions { grid-template-columns: 1fr; }
  .portal-roles { grid-template-columns: 1fr; gap: 1rem; }
  .role-card { flex-direction: row; gap: 1.25rem; padding: 1.25rem 1.5rem; border-radius: 28px; text-align: left; }
  .role-text { margin-top: 0; align-items: flex-start; gap: .2rem; }
  .role-card .role-icon { width: 60px; height: 60px; border-radius: 16px; flex: none; }
  .me-grid { grid-template-columns: 1fr; }
  .me-range { min-width: 0; width: 100%; }
  .rgrid { grid-template-columns: 1fr; }
  .rc-pct { font-size: 2rem; }
  .s-pct { grid-column: span 2; }
  .filters select, .filters input[type=search] { min-width: 0; flex: 1 1 140px; }
  .day-nav strong { font-size: 1rem; }
  .savebar { flex-wrap: nowrap; padding: .6rem .7rem; gap: .5rem; }
  .tally { gap: .2rem .6rem; font-size: .85rem; }
  .t b { min-width: 1.1rem; }
  .savebar .btn { min-height: 44px; padding: .6rem .8rem; white-space: nowrap; }
  .nav { width: 100%; overflow-x: auto; flex-wrap: nowrap; }
  .nav a { white-space: nowrap; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
  .mark input:checked + span { transform: none; }
}
