/* =========================================================
   THLA Portal - mock-up stylesheet
   School colours live in :root so each school can override them.
========================================================= */

:root {
    --brand: #123F22;          /* school primary colour */
    --brand-deep: #0C2E18;
    --brand-soft: #DCEFD3;
    --accent: #F4B740;         /* school accent colour */
    --accent-dark: #E0A020;

    --paper: #F6F9F2;
    --card: #FFFFFF;
    --ink: #1C2B20;
    --muted: #5A6E5F;
    --line: #DCE7D5;

    --good: #2E7D32;
    --good-bg: #E3F2E1;
    --mid: #9A6B00;
    --mid-bg: #FDF1D6;
    --low: #B3261E;
    --low-bg: #FBE4E1;
    --info: #1F5FA8;
    --info-bg: #E2ECF8;

    --font-display: "Fredoka", "Nunito", Arial, sans-serif;
    --font-body: "Nunito", Arial, Helvetica, sans-serif;

    --radius: 16px;
    --shadow: 0 6px 20px rgba(18, 63, 34, 0.08);
    --side: 240px;
    --top: 64px;
    --bottom: 64px;
}

* { box-sizing: border-box; }

html, body { margin: 0; }

body {
    font-family: var(--font-body);
    color: var(--ink);
    background: var(--paper);
    line-height: 1.5;
    font-size: 15px;
}

h1, h2, h3, h4 {
    font-family: var(--font-display);
    font-weight: 600;
    color: var(--brand);
    line-height: 1.2;
    margin: 0 0 0.5rem;
}

h1 { font-size: 1.6rem; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1.05rem; }

a { color: var(--brand); }

button, input, select { font: inherit; color: inherit; }

[hidden] { display: none !important; }

:focus-visible {
    outline: 3px solid var(--accent);
    outline-offset: 2px;
}

.muted { color: var(--muted); }
.small { font-size: 0.85rem; }


/* =========================================================
   MOCK-UP BANNER
========================================================= */

.mock-bar {
    background: var(--accent);
    color: var(--brand-deep);
    font-size: 0.8rem;
    font-weight: 700;
    text-align: center;
    padding: 0.35rem 0.75rem;
}

.mock-bar a {
    color: var(--brand-deep);
    margin: 0 0.3rem;
}


/* =========================================================
   BUTTONS, CHIPS, FORMS
========================================================= */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    padding: 0.6rem 1.1rem;
    border-radius: 999px;
    border: 2px solid var(--brand);
    background: var(--brand);
    color: #fff;
    font-family: var(--font-display);
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    white-space: nowrap;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.btn:hover { background: var(--brand-deep); border-color: var(--brand-deep); }

.btn-accent { background: var(--accent); border-color: var(--accent); color: var(--brand-deep); }
.btn-accent:hover { background: var(--accent-dark); border-color: var(--accent-dark); }

.btn-ghost { background: transparent; color: var(--brand); }
.btn-ghost:hover { background: var(--brand-soft); color: var(--brand); }

.btn-sm { padding: 0.35rem 0.8rem; font-size: 0.85rem; }
.btn-block { width: 100%; }

.chip {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.15rem 0.6rem;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 700;
    white-space: nowrap;
    background: var(--brand-soft);
    color: var(--brand);
}

.chip-good { background: var(--good-bg); color: var(--good); }
.chip-mid  { background: var(--mid-bg);  color: var(--mid); }
.chip-low  { background: var(--low-bg);  color: var(--low); }
.chip-info { background: var(--info-bg); color: var(--info); }
.chip-grey { background: #ECEFEC; color: #55605A; }

.field { display: block; margin-bottom: 0.9rem; }

.field span {
    display: block;
    font-weight: 700;
    font-size: 0.85rem;
    margin-bottom: 0.3rem;
}

.input, .select {
    width: 100%;
    padding: 0.6rem 0.8rem;
    border: 1.5px solid var(--line);
    border-radius: 12px;
    background: #fff;
}

.input:focus, .select:focus {
    outline: none;
    border-color: var(--brand);
    box-shadow: 0 0 0 3px var(--brand-soft);
}

.row-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 0.8rem;
}


/* =========================================================
   LOGIN PAGE
========================================================= */

.login-wrap {
    min-height: calc(100vh - 28px);
    display: grid;
    place-items: center;
    padding: 1.5rem 1rem;
    background:
        radial-gradient(circle at 15% 10%, var(--brand-soft) 0, transparent 45%),
        radial-gradient(circle at 90% 90%, #FCEBC4 0, transparent 40%),
        var(--paper);
}

.login-card {
    width: 100%;
    max-width: 880px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    background: var(--card);
    border-radius: 24px;
    overflow: hidden;
    box-shadow: 0 20px 50px rgba(18, 63, 34, 0.15);
}

.login-brand {
    position: relative;
    background: var(--brand);
    color: #E6F2E0;
    padding: 2.5rem 2rem 7rem;
}

.login-brand img {
    width: 88px;
    height: 88px;
    border-radius: 50%;
    border: 4px solid rgba(255, 255, 255, 0.15);
}

.login-brand h1 {
    color: #fff;
    font-size: 1.9rem;
    margin-top: 1rem;
}

.login-brand .tag {
    color: var(--accent);
    font-family: var(--font-display);
    font-size: 1.15rem;
    margin-bottom: 1rem;
}

.login-brand ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.login-brand li {
    display: flex;
    gap: 0.6rem;
    padding: 0.3rem 0;
}

.login-brand li i { color: var(--accent); margin-top: 0.3rem; width: 1rem; }

.login-hills {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 80px;
}

.login-form { padding: 2.5rem 2rem; }

.login-form h2 { font-size: 1.5rem; }

.divider {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--muted);
    font-size: 0.85rem;
    margin: 1.1rem 0;
}

.divider::before, .divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--line);
}

.btn-social {
    width: 100%;
    background: #fff;
    color: var(--ink);
    border: 1.5px solid var(--line);
    margin-bottom: 0.6rem;
    font-family: var(--font-body);
    font-weight: 700;
}

.btn-social:hover { background: var(--paper); border-color: #C9D6C2; }
.btn-social .fa-google { color: #DB4437; }
.btn-social .fa-facebook { color: #1877F2; }

.login-foot {
    margin-top: 1.2rem;
    font-size: 0.85rem;
    color: var(--muted);
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.demo-roles {
    margin-top: 1.4rem;
    padding: 0.9rem;
    border: 2px dashed var(--accent);
    border-radius: 14px;
    background: #FFFBF0;
}

.demo-roles p { margin: 0 0 0.5rem; font-weight: 700; font-size: 0.85rem; }

.demo-roles .grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.4rem;
}

.demo-roles a {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.2rem;
    padding: 0.5rem 0.25rem;
    border-radius: 10px;
    background: #fff;
    border: 1px solid var(--line);
    text-decoration: none;
    font-size: 0.8rem;
    font-weight: 700;
}

.demo-roles a:hover { border-color: var(--brand); }
.demo-roles a i { font-size: 1.1rem; }


/* =========================================================
   APP SHELL: top bar, side nav (desktop), bottom nav (phone)
========================================================= */

.topbar {
    position: sticky;
    top: 0;
    z-index: 50;
    height: var(--top);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0 1.25rem;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--line);
}

.topbar .logo {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    text-decoration: none;
    font-family: var(--font-display);
    font-weight: 600;
    color: var(--brand);
    font-size: 1.1rem;
    line-height: 1.1;
    min-width: 0;
}

.topbar .logo img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    flex-shrink: 0;
}

.topbar .logo small {
    display: block;
    font-family: var(--font-body);
    font-weight: 700;
    font-size: 0.72rem;
    color: var(--muted);
}

.topbar .spacer { flex: 1; }

.user-chip {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.user-chip .who { text-align: right; line-height: 1.15; }
.user-chip .who b { display: block; font-size: 0.9rem; }
.user-chip .who span { font-size: 0.75rem; color: var(--muted); }

.avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: var(--accent);
    color: var(--brand-deep);
    font-weight: 800;
    font-size: 0.85rem;
    flex-shrink: 0;
}

.icon-link {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    color: var(--muted);
    text-decoration: none;
}

.icon-link:hover { background: var(--brand-soft); color: var(--brand); }

.layout {
    display: grid;
    grid-template-columns: var(--side) 1fr;
    min-height: calc(100vh - var(--top) - 28px);
}

.sidenav {
    background: var(--brand);
    padding: 1.25rem 0.75rem;
    position: sticky;
    top: var(--top);
    height: calc(100vh - var(--top));
}

.sidenav a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.7rem 0.9rem;
    margin-bottom: 0.2rem;
    border-radius: 12px;
    color: #CFE3C8;
    text-decoration: none;
    font-weight: 700;
}

.sidenav a i { width: 1.2rem; text-align: center; }
.sidenav a:hover { background: rgba(255, 255, 255, 0.08); color: #fff; }
.sidenav a.active { background: var(--accent); color: var(--brand-deep); }

.sidenav .term {
    margin: 1.5rem 0.9rem 0;
    padding-top: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.12);
    color: #A9C4A2;
    font-size: 0.8rem;
}

.main {
    padding: 1.5rem 1.75rem 3rem;
    max-width: 1180px;
    width: 100%;
}

.page-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1.25rem;
}

.page-head h1 { margin: 0; }
.page-head p { margin: 0.2rem 0 0; color: var(--muted); }

.bottomnav { display: none; }


/* =========================================================
   CARDS, STATS, LISTS, TABLES
========================================================= */

.card {
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.15rem 1.25rem;
    margin-bottom: 1.25rem;
}

.card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-bottom: 0.8rem;
}

.card-head h2 { margin: 0; }

.grid-2 {
    display: grid;
    grid-template-columns: 1.3fr 1fr;
    gap: 1.25rem;
    align-items: start;
}

.grid-2 > .card { margin-bottom: 0; }

.stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.stat {
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1rem 1.1rem;
    border-bottom: 4px solid var(--accent);
}

.stat b {
    display: block;
    font-family: var(--font-display);
    font-size: 1.7rem;
    color: var(--brand);
    line-height: 1.1;
}

.stat span { color: var(--muted); font-size: 0.85rem; font-weight: 700; }

/* Child switcher for parents */
.kids {
    display: flex;
    gap: 0.6rem;
    margin-bottom: 1.25rem;
    overflow-x: auto;
    padding-bottom: 0.2rem;
}

.kid {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.5rem 1rem 0.5rem 0.5rem;
    border-radius: 999px;
    border: 2px solid var(--line);
    background: #fff;
    cursor: pointer;
    flex-shrink: 0;
    text-align: left;
}

.kid .avatar { width: 34px; height: 34px; background: var(--brand-soft); color: var(--brand); }
.kid b { display: block; font-size: 0.92rem; line-height: 1.1; }
.kid span { font-size: 0.75rem; color: var(--muted); }

.kid.active { border-color: var(--brand); background: var(--brand); color: #fff; }
.kid.active span { color: #CFE3C8; }
.kid.active .avatar { background: var(--accent); color: var(--brand-deep); }

/* Upcoming list */
.list { list-style: none; margin: 0; padding: 0; }

.list li {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    padding: 0.7rem 0;
    border-top: 1px solid var(--line);
}

.list li:first-child { border-top: 0; }

.date-badge {
    width: 50px;
    flex-shrink: 0;
    text-align: center;
    border-radius: 12px;
    background: var(--brand-soft);
    padding: 0.3rem 0;
    line-height: 1.05;
}

.date-badge b {
    display: block;
    font-family: var(--font-display);
    font-size: 1.25rem;
    color: var(--brand);
}

.date-badge span {
    font-size: 0.68rem;
    font-weight: 800;
    text-transform: uppercase;
    color: var(--muted);
}

.date-badge.event { background: #FCEBC4; }

.list .grow { flex: 1; min-width: 0; }
.list .grow > b { display: block; }
.list .grow > span { font-size: 0.85rem; color: var(--muted); }

/* Tables */
.table-wrap { overflow-x: auto; margin: 0 -0.25rem; }

table.data {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.92rem;
}

table.data th {
    text-align: left;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--muted);
    padding: 0.5rem 0.6rem;
    border-bottom: 2px solid var(--line);
    white-space: nowrap;
}

table.data td {
    padding: 0.65rem 0.6rem;
    border-bottom: 1px solid var(--line);
    vertical-align: middle;
}

table.data tr:last-child td { border-bottom: 0; }
table.data .num { text-align: right; white-space: nowrap; }
table.data .raw { font-weight: 800; font-variant-numeric: tabular-nums; }

.subject-group td {
    background: var(--paper);
    font-family: var(--font-display);
    font-weight: 600;
    color: var(--brand);
}

.pct {
    display: inline-block;
    min-width: 3.4rem;
    text-align: center;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    font-weight: 800;
    font-size: 0.85rem;
    font-variant-numeric: tabular-nums;
}

.pct-good { background: var(--good-bg); color: var(--good); }
.pct-mid  { background: var(--mid-bg);  color: var(--mid); }
.pct-low  { background: var(--low-bg);  color: var(--low); }

.filters {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.filters .select { width: auto; max-width: 100%; padding: 0.4rem 0.7rem; font-size: 0.88rem; }

/* Mark cards (phone view of marks) */
.mark-cards { display: none; }


/* =========================================================
   CALENDAR
========================================================= */

.cal-head {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.cal-head h2 { margin: 0 0.5rem; min-width: 9rem; text-align: center; }

.cal {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
}

.cal .dow {
    text-align: center;
    font-size: 0.72rem;
    font-weight: 800;
    color: var(--muted);
    text-transform: uppercase;
    padding: 0.2rem 0;
}

.cal .day {
    min-height: 92px;
    border-radius: 10px;
    background: var(--paper);
    padding: 0.3rem 0.35rem;
    border: 2px solid transparent;
    cursor: pointer;
    text-align: left;
    display: flex;
    flex-direction: column;
    gap: 2px;
    overflow: hidden;
}

.cal .day.out { opacity: 0.35; }
.cal .day.weekend { background: #EEF3EA; }
.cal .day.today { border-color: var(--accent); }
.cal .day.sel { border-color: var(--brand); background: #fff; }

.cal .num {
    font-weight: 800;
    font-size: 0.82rem;
    color: var(--muted);
}

.cal .ev {
    display: block;
    font-size: 0.7rem;
    font-weight: 700;
    line-height: 1.2;
    padding: 0.15rem 0.3rem;
    border-radius: 5px;
    background: var(--brand-soft);
    color: var(--brand);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cal .ev.exam { background: var(--low-bg); color: var(--low); }
.cal .ev.practical { background: var(--info-bg); color: var(--info); }
.cal .ev.event { background: #FCEBC4; color: var(--mid); }

.cal .dots { display: none; gap: 3px; margin-top: auto; }
.cal .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--brand); }
.cal .dot.exam { background: var(--low); }
.cal .dot.practical { background: var(--info); }
.cal .dot.event { background: var(--accent-dark); }

.legend {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    font-size: 0.8rem;
    color: var(--muted);
    margin-top: 0.8rem;
}

.legend span { display: inline-flex; align-items: center; gap: 0.35rem; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }


/* =========================================================
   TEACHER: mark capture grid
========================================================= */

.capture-head {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem 1.25rem;
    align-items: center;
    padding: 0.8rem 1rem;
    border-radius: 12px;
    background: var(--paper);
    margin-bottom: 0.8rem;
}

.capture-head b { font-family: var(--font-display); color: var(--brand); font-size: 1.05rem; }

.mark-input {
    width: 4.2rem;
    padding: 0.4rem 0.5rem;
    border: 1.5px solid var(--line);
    border-radius: 10px;
    text-align: right;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
}

.mark-input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.mark-input.bad { border-color: var(--low); background: var(--low-bg); }

.status-select {
    padding: 0.35rem 0.5rem;
    border: 1.5px solid var(--line);
    border-radius: 10px;
    background: #fff;
    font-size: 0.85rem;
}

.release-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    margin-top: 1rem;
    padding: 0.9rem 1rem;
    border-radius: 12px;
    background: var(--mid-bg);
}

.release-bar.released { background: var(--good-bg); }

/* Toggle switch */
.switch {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    cursor: pointer;
    font-weight: 700;
}

.switch input { position: absolute; opacity: 0; }

.switch .track {
    width: 44px;
    height: 24px;
    border-radius: 999px;
    background: #C9D3C5;
    position: relative;
    flex-shrink: 0;
    transition: background-color 0.2s ease;
}

.switch .track::after {
    content: "";
    position: absolute;
    top: 3px;
    left: 3px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #fff;
    transition: transform 0.2s ease;
}

.switch input:checked + .track { background: var(--brand); }
.switch input:checked + .track::after { transform: translateX(20px); }
.switch input:focus-visible + .track { outline: 3px solid var(--accent); outline-offset: 2px; }

.setting {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding: 0.9rem 0;
    border-top: 1px solid var(--line);
}

.setting:first-of-type { border-top: 0; }
.setting p { margin: 0.1rem 0 0; font-size: 0.85rem; color: var(--muted); }

.swatches { display: flex; gap: 0.5rem; align-items: center; }

.swatch {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    border: 3px solid #fff;
    box-shadow: 0 0 0 1px var(--line);
    padding: 0;
    cursor: pointer;
}

input[type="color"].swatch::-webkit-color-swatch-wrapper { padding: 0; }
input[type="color"].swatch::-webkit-color-swatch { border: 0; border-radius: 8px; }

.logo-drop {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.logo-drop img { width: 64px; height: 64px; border-radius: 50%; }

/* Audit trail */
.audit li { align-items: flex-start; }

.audit .ico {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: var(--info-bg);
    color: var(--info);
    flex-shrink: 0;
    font-size: 0.85rem;
}

.audit .ico.override { background: var(--mid-bg); color: var(--mid); }

.strike { text-decoration: line-through; color: var(--muted); }


/* =========================================================
   MODAL + TOAST
========================================================= */

.modal-back {
    position: fixed;
    inset: 0;
    z-index: 100;
    background: rgba(12, 46, 24, 0.45);
    display: grid;
    place-items: center;
    padding: 1rem;
}

.modal {
    width: 100%;
    max-width: 520px;
    max-height: 90vh;
    overflow-y: auto;
    background: #fff;
    border-radius: 20px;
    padding: 1.4rem;
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.25);
}

.modal-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.modal-head h2 { margin: 0; }

.modal-foot {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.close-x {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 0;
    background: var(--paper);
    cursor: pointer;
}

.toast {
    position: fixed;
    left: 50%;
    bottom: 1.5rem;
    transform: translate(-50%, 150%);
    z-index: 200;
    background: var(--brand-deep);
    color: #fff;
    padding: 0.7rem 1.2rem;
    border-radius: 999px;
    font-weight: 700;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
    transition: transform 0.3s ease;
    max-width: calc(100% - 2rem);
}

.toast.show { transform: translate(-50%, 0); }

.notice {
    display: flex;
    gap: 0.6rem;
    align-items: flex-start;
    padding: 0.75rem 0.9rem;
    border-radius: 12px;
    background: var(--info-bg);
    color: var(--info);
    font-size: 0.88rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

.notice i { margin-top: 0.2rem; }


/* =========================================================
   TABLET  (max 1023px)
========================================================= */

@media (max-width: 1023.98px) {
    :root { --side: 76px; }

    .sidenav a span, .sidenav .term { display: none; }
    .sidenav a { justify-content: center; padding: 0.8rem 0; }
    .sidenav a i { font-size: 1.15rem; }

    .grid-2 { grid-template-columns: 1fr; }
    .grid-2 > .card { margin-bottom: 1.25rem; }
    .stats { grid-template-columns: repeat(2, 1fr); }
}


/* =========================================================
   PHONE  (max 699px): bottom tab bar, cards instead of tables
========================================================= */

@media (max-width: 699.98px) {
    body { font-size: 15px; }

    .topbar { padding: 0 0.9rem; }
    .topbar .logo { font-size: 1rem; }
    .user-chip .who { display: none; }

    .layout { display: block; }
    .sidenav { display: none; }

    .main { padding: 1rem 1rem calc(var(--bottom) + 1.5rem); }

    h1 { font-size: 1.35rem; }

    .bottomnav {
        display: flex;
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 60;
        height: var(--bottom);
        background: #fff;
        border-top: 1px solid var(--line);
        box-shadow: 0 -6px 20px rgba(18, 63, 34, 0.06);
    }

    .bottomnav a {
        flex: 1;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 0.15rem;
        font-size: 0.7rem;
        font-weight: 800;
        color: var(--muted);
        text-decoration: none;
    }

    .bottomnav a i { font-size: 1.15rem; }
    .bottomnav a.active { color: var(--brand); }

    .bottomnav a.active i {
        background: var(--brand-soft);
        padding: 0.25rem 0.9rem;
        border-radius: 999px;
    }

    .card { padding: 1rem; border-radius: 14px; }
    .stats { gap: 0.6rem; }
    .stat { padding: 0.8rem; }
    .stat b { font-size: 1.4rem; }

    /* Calendar becomes a compact month with dots */
    .cal { gap: 2px; }
    .cal .day { min-height: 48px; align-items: center; padding: 0.3rem 0.1rem; }
    .cal .ev { display: none; }
    .cal .dots { display: flex; }
    .cal-head h2 { min-width: 7.5rem; font-size: 1.05rem; }

    /* Marks: cards replace the table */
    .marks-table { display: none; }
    .mark-cards { display: block; }

    .mark-card {
        display: flex;
        align-items: center;
        gap: 0.75rem;
        padding: 0.75rem 0;
        border-top: 1px solid var(--line);
    }

    .mark-card:first-child { border-top: 0; }
    .mark-card .grow { flex: 1; min-width: 0; }
    .mark-card .grow b { display: block; }
    .mark-card .grow span { font-size: 0.8rem; color: var(--muted); }
    .mark-card .score { text-align: right; }
    .mark-card .score .raw { display: block; font-weight: 800; font-size: 0.85rem; margin-bottom: 0.15rem; }

    .mark-subject {
        font-family: var(--font-display);
        color: var(--brand);
        font-weight: 600;
        margin: 1rem 0 0.2rem;
    }

    .mark-subject:first-child { margin-top: 0; }

    .login-card { grid-template-columns: 1fr; }
    .login-brand { padding: 1.5rem 1.5rem 4.5rem; text-align: center; }
    .login-brand img { width: 72px; height: 72px; }
    .login-brand h1 { font-size: 1.5rem; margin-top: 0.6rem; }
    .login-brand ul { display: none; }
    .login-hills { height: 50px; }
    .login-form { padding: 1.5rem; }

    .row-2 { grid-template-columns: 1fr; }

    .modal-back { align-items: end; padding: 0; }
    .modal { border-radius: 20px 20px 0 0; max-height: 92vh; }

    .toast { bottom: calc(var(--bottom) + 1rem); }

    .hide-phone { display: none !important; }

    .card-head .filters { flex: 1 1 100%; min-width: 0; }
    .card-head .filters .select { width: 100%; }
    .page-head .select { max-width: 100% !important; width: 100%; }
}

/* =========================================================
   INTERVENTIONS, PROFILES, ATTENDANCE
========================================================= */

textarea.input { resize: vertical; min-height: 84px; line-height: 1.45; }

.modal-wide { max-width: 680px; }

.conc-note {
    margin-top: 0.15rem;
    font-size: 0.76rem;
    font-weight: 700;
    color: var(--info);
}

.iv-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    margin-top: 0.25rem;
    padding: 0.25rem 0.65rem;
    border-radius: 999px;
    border: 1.5px solid transparent;
    font-size: 0.78rem;
    font-weight: 800;
    cursor: pointer;
    white-space: nowrap;
}

.iv-todo { background: var(--low); color: #fff; }
.iv-todo:hover { background: #8F1E18; }
.iv-new { background: var(--low-bg); color: var(--low); border-color: #F2B8B2; }
.iv-new:hover { border-color: var(--low); }
.iv-done { background: var(--good-bg); color: var(--good); }
.iv-done:hover { border-color: var(--good); }

.list .grow .iv-btn { display: inline-flex; }

.iv-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 0.6rem 1rem;
    padding: 0.85rem 1rem;
    border-radius: 12px;
    background: var(--paper);
    margin-bottom: 1rem;
}

.iv-summary > div > span, .iv-block > span {
    display: block;
    font-size: 0.72rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--muted);
}

.iv-summary b { font-size: 0.95rem; }
.iv-summary .pct { margin-left: 0.25rem; }
.iv-two { grid-template-columns: 1fr 1fr; }

.iv-block { margin-bottom: 1rem; }
.iv-block p { margin: 0.2rem 0 0; }

.pdf-link {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    font-weight: 700;
    color: var(--brand);
}

.pdf-link i { color: #C62828; }

.notice-good { background: var(--good-bg); color: var(--good); }
.notice-mid { background: var(--mid-bg); color: var(--mid); }

.ack-box {
    display: flex;
    gap: 0.6rem;
    align-items: flex-start;
    padding: 0.85rem 1rem;
    border-radius: 12px;
    border: 2px solid var(--accent);
    background: #FFFBF0;
    font-weight: 700;
    cursor: pointer;
    margin-bottom: 0.5rem;
}

.ack-box input { width: 18px; height: 18px; margin-top: 0.15rem; accent-color: var(--brand); flex-shrink: 0; }

/* Segmented buttons */
.seg {
    display: inline-flex;
    padding: 3px;
    border-radius: 999px;
    background: var(--paper);
    border: 1px solid var(--line);
    margin-bottom: 1rem;
}

.seg button {
    border: 0;
    background: transparent;
    padding: 0.4rem 0.9rem;
    border-radius: 999px;
    font-weight: 800;
    font-size: 0.85rem;
    color: var(--muted);
    cursor: pointer;
}

.seg button.on { background: var(--brand); color: #fff; }

.seg-att { margin: 0; flex-shrink: 0; }
.seg-att button { padding: 0.4rem 0.75rem; }
.seg-att button.on.present { background: var(--good); }
.seg-att button.on.absent { background: var(--low); }
.seg-att button.on.late { background: var(--accent-dark); color: var(--brand-deep); }

/* Attention banner */
.attention {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    border: 2px solid #F2B8B2;
    background: #FFF7F6;
}

.attention .grow { flex: 1; min-width: 0; }
.attention .grow b { display: block; }
.attention .grow span { font-size: 0.88rem; color: var(--muted); }

.attention-ico {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: var(--low-bg);
    color: var(--low);
    flex-shrink: 0;
    font-size: 1.1rem;
}

.attention-ico.sm { width: 36px; height: 36px; font-size: 0.9rem; }
.attention-ico.warn { background: var(--mid-bg); color: var(--mid); }

.kid { position: relative; }

.dot-badge {
    position: absolute;
    top: -6px;
    right: -4px;
    min-width: 20px;
    height: 20px;
    padding: 0 5px;
    border-radius: 999px;
    background: var(--low);
    color: #fff;
    font-size: 0.72rem;
    font-weight: 800;
    display: grid;
    place-items: center;
    border: 2px solid #fff;
}

/* Profile */
.profile-head {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    margin-bottom: 1rem;
}

.profile-head h2 { margin: 0; }

.avatar-lg {
    width: 56px;
    height: 56px;
    font-size: 1.1rem;
    background: var(--brand-soft);
    color: var(--brand);
}

.facts {
    display: grid;
    grid-template-columns: max-content 1fr;
    gap: 0.45rem 1.2rem;
    margin: 0;
}

.facts dt { font-weight: 800; font-size: 0.85rem; color: var(--muted); }
.facts dd { margin: 0; }

.att-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.6rem;
    margin-bottom: 0.8rem;
}

.att-stats div {
    padding: 0.7rem;
    border-radius: 12px;
    background: var(--paper);
    text-align: center;
}

.att-stats b {
    display: block;
    font-family: var(--font-display);
    font-size: 1.4rem;
    color: var(--brand);
}

.att-stats span { font-size: 0.78rem; font-weight: 700; color: var(--muted); }
.t-low { color: var(--low) !important; }
.t-mid { color: var(--mid) !important; }

/* Register */
.reg-controls {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 0 1rem;
    margin-bottom: 0.4rem;
}

.reg-controls .field { min-width: 160px; }
.reg-controls .js-rstate { padding-bottom: 1.3rem; }
.reg-list li { flex-wrap: wrap; }

.pct-input {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-weight: 800;
}

.pct-input .input { width: 5rem; text-align: right; }

@media (max-width: 699.98px) {
    .attention { flex-wrap: wrap; }
    .attention .btn { width: 100%; }
    .iv-two { grid-template-columns: 1fr 1fr; }
    .facts { grid-template-columns: 1fr; gap: 0.1rem; }
    .facts dd { margin-bottom: 0.5rem; }
    .reg-list .seg-att { width: 100%; display: flex; }
    .reg-list .seg-att button { flex: 1; }
    .reg-controls .field { flex: 1; min-width: 0; }
    .reg-controls .js-rstate { padding-bottom: 0.6rem; width: 100%; }
    .bottomnav a { font-size: 0.64rem; }
}

/* Admin notifications bell */
.bell { position: relative; border: 0; background: transparent; cursor: pointer; }
.bell-count {
    position: absolute;
    top: 2px;
    right: 0;
    min-width: 18px;
    height: 18px;
    padding: 0 4px;
    border-radius: 999px;
    background: var(--low);
    color: #fff;
    font-size: 0.7rem;
    font-weight: 800;
    display: grid;
    place-items: center;
    border: 2px solid #fff;
}
.attention-ico.info { background: var(--info-bg); color: var(--info); }

/* Terms, rewrites, emails, admin roles */
.check-line {
    display: flex;
    gap: 0.6rem;
    align-items: flex-start;
    padding: 0.7rem 0.85rem;
    border: 1.5px solid var(--line);
    border-radius: 12px;
    margin-bottom: 0.9rem;
    cursor: pointer;
}
.check-line input { width: 18px; height: 18px; margin-top: 0.15rem; accent-color: var(--brand); flex-shrink: 0; }

.term-seg { margin-bottom: 1rem; flex-wrap: wrap; }

.link-btn {
    border: 0;
    background: none;
    padding: 0;
    margin-top: 0.3rem;
    color: var(--brand);
    font-weight: 700;
    font-size: 0.85rem;
    text-decoration: underline;
    cursor: pointer;
}

.terms-grid .input { padding: 0.4rem 0.5rem; }
.terms-grid h3 { margin-top: 0.4rem; }

.closure-add {
    display: grid;
    grid-template-columns: 10rem 1fr auto;
    gap: 0.5rem;
    margin-top: 0.6rem;
}

.email-log {
    margin-top: 0.8rem;
    padding: 0.8rem 1rem;
    border-radius: 12px;
    background: var(--paper);
    font-size: 0.88rem;
}

.email-prev {
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 0.9rem 1rem;
    margin-bottom: 0.9rem;
}
.email-prev > span {
    display: block;
    font-size: 0.72rem;
    font-weight: 800;
    text-transform: uppercase;
    color: var(--muted);
    margin-bottom: 0.3rem;
}
.email-prev p { margin: 0.5rem 0 0; }

.doc-log {
    margin-top: 0.5rem;
    padding: 0.7rem 0.9rem;
    border-radius: 12px;
    background: var(--paper);
    font-size: 0.82rem;
    color: var(--muted);
}
.doc-log b { color: var(--ink); }

.nowrap { white-space: nowrap; }

@media (max-width: 699.98px) {
    .closure-add { grid-template-columns: 1fr; }
}

/* People page: add buttons, class checkboxes */
.head-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.check-row { display: flex; gap: 1rem; flex-wrap: wrap; padding-top: 0.2rem; }
.check-row label { display: inline-flex; align-items: center; gap: 0.35rem; font-weight: 700; cursor: pointer; }
.check-row input { width: 17px; height: 17px; accent-color: var(--brand); }

/* Leavers */
.btn-danger { background: var(--low); border-color: var(--low); color: #fff; }
.btn-danger:hover { background: #8F1E18; border-color: #8F1E18; }
.btn-ghost-danger { color: var(--low); border-color: var(--low); }
.btn-ghost-danger:hover { background: var(--low-bg); color: var(--low); }

.leave-box {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    margin-top: 1.2rem;
    padding: 0.9rem 1rem;
    border: 1.5px dashed #F2B8B2;
    border-radius: 12px;
    background: #FFF7F6;
}

.modal-report { max-width: 820px; }

/* Leaver's report (on screen and printed) */
.lr { font-size: 0.9rem; }
.lr-head {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    padding-bottom: 0.8rem;
    margin-bottom: 0.8rem;
    border-bottom: 2px solid var(--brand);
}
.lr-head img { width: 56px; height: 56px; border-radius: 50%; }
.lr-head h2 { margin: 0; }
.lr-head p { margin: 0; color: var(--muted); font-weight: 700; }
.lr-facts { display: grid; grid-template-columns: max-content 1fr; gap: 0.3rem 1.2rem; margin: 0 0 1rem; }
.lr-facts dt { font-weight: 800; color: var(--muted); }
.lr-facts dd { margin: 0; }
.lr h3 { margin: 1.1rem 0 0.4rem; font-size: 1rem; }
.lr-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.lr-table th { text-align: left; font-size: 0.72rem; text-transform: uppercase; color: var(--muted); border-bottom: 1.5px solid var(--line); padding: 0.3rem 0.4rem; }
.lr-table td { border-bottom: 1px solid var(--line); padding: 0.35rem 0.4rem; vertical-align: top; }
.lr-table .num { text-align: right; white-space: nowrap; }
.lr-note { margin-top: 1.2rem; font-size: 0.8rem; color: var(--muted); }

.print-body { background: #fff; padding: 1.5rem; max-width: 820px; margin: 0 auto; }

@media print {
    .print-body { padding: 0; }
    .lr-table tr { break-inside: avoid; }
    .lr h3 { break-after: avoid; }
}

/* Classes & subjects */
.subject-pool { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-bottom: 0.4rem; }
.chip-pool { background: var(--paper); border: 1px solid var(--line); color: var(--ink); padding: 0.25rem 0.7rem; font-size: 0.85rem; }
.chip-teacher { background: var(--brand-soft); color: var(--brand); padding: 0.25rem 0.4rem 0.25rem 0.7rem; font-size: 0.82rem; margin: 0.1rem 0; }
.chip-x {
    border: 0;
    background: transparent;
    color: inherit;
    font-size: 1rem;
    line-height: 1;
    padding: 0 0.2rem;
    cursor: pointer;
    opacity: 0.6;
}
.chip-x:hover { opacity: 1; }
.inline-field { display: inline-flex; align-items: center; gap: 0.5rem; font-weight: 700; font-size: 0.85rem; color: var(--muted); }
.teach-row { display: flex; gap: 0.8rem; align-items: flex-start; padding: 0.4rem 0; border-top: 1px solid var(--line); }
.teach-row:first-of-type { border-top: 0; }
.teach-row > b { min-width: 2.5rem; padding-top: 0.15rem; }
.teach-row .check-row { gap: 0.4rem 1rem; }
.teach-row .check-row label { font-weight: 600; font-size: 0.88rem; }

/* Subject choices grid */
.choices { margin-top: 1rem; padding-top: 0.8rem; border-top: 1px dashed var(--line); }
.choices h3 { margin-bottom: 0.4rem; }
.choice-box { width: 18px; height: 18px; accent-color: var(--brand); cursor: pointer; }
.choices table.data { width: auto; min-width: 320px; }
.choices table.data th.num, .choices table.data td.num { text-align: center; padding-left: 1.2rem; padding-right: 1.2rem; }

/* Collapsible classes and subject phases */
.cls-toolbar { display: flex; justify-content: space-between; align-items: baseline; margin: 1.6rem 0 0.4rem; }
.cls-toolbar h2 { margin: 0; }
.phase-title { margin: 1rem 0 0.5rem; }
.phase-title .muted { font-family: var(--font-body); font-weight: 700; }

.cls-card { padding: 0; margin-bottom: 0.7rem; }
.cls-card > summary, .phase-block > summary {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.4rem 0.8rem;
    padding: 0.9rem 1.25rem;
    cursor: pointer;
    list-style: none;
    border-radius: var(--radius);
}
.cls-card > summary::-webkit-details-marker, .phase-block > summary::-webkit-details-marker { display: none; }
.cls-card > summary::before, .phase-block > summary::before {
    content: "";
    width: 8px;
    height: 8px;
    border-right: 2px solid var(--muted);
    border-bottom: 2px solid var(--muted);
    transform: rotate(-45deg);
    transition: transform 0.15s ease;
    flex-shrink: 0;
}
.cls-card[open] > summary::before, .phase-block[open] > summary::before { transform: rotate(45deg); }
.cls-card > summary:hover, .phase-block > summary:hover { background: var(--paper); }
.cls-card[open] > summary { border-bottom: 1px solid var(--line); border-radius: var(--radius) var(--radius) 0 0; }
.cls-name { font-family: var(--font-display); font-weight: 600; font-size: 1.1rem; color: var(--brand); }
.cls-meta { color: var(--muted); font-size: 0.85rem; font-weight: 700; margin-right: auto; }
.cls-body { padding: 0.9rem 1.25rem 1.1rem; }
.cls-tools { display: flex; justify-content: flex-end; margin-bottom: 0.5rem; }

.phase-block { border: 1px solid var(--line); border-radius: 12px; margin-bottom: 0.5rem; }
.phase-block > summary { padding: 0.7rem 1rem; border-radius: 12px; }
.phase-block .cls-name { font-size: 1rem; }
.phase-body { padding: 0.2rem 1rem 0.9rem; }

/* Learner class and subject ticks */
.cls-edit { margin-top: 1rem; padding: 0.9rem 1rem; border: 1px solid var(--line); border-radius: 12px; background: var(--paper); }
.cls-edit h3 { margin-top: 0; }
.subj-ticks { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 0.4rem 0.8rem; margin-bottom: 0.8rem; }
.subj-tick { display: flex; gap: 0.5rem; align-items: flex-start; padding: 0.45rem 0.6rem; border-radius: 10px; background: #fff; border: 1px solid var(--line); cursor: pointer; }
.subj-tick.locked { cursor: default; opacity: 0.85; }
.subj-tick input { width: 17px; height: 17px; margin-top: 0.15rem; accent-color: var(--brand); flex-shrink: 0; }


/* =========================================================
   Live app additions (not in the mock-up)
========================================================= */

.notice-bad { background: var(--low-bg); color: var(--low); }
.field-error { display: block; margin-top: 0.3rem; color: var(--low); font-size: 0.85rem; font-weight: 700; }
.input.is-invalid { border-color: var(--low); }
.check-inline { display: flex; align-items: center; gap: 0.5rem; margin: 0 0 1rem; font-weight: 600; cursor: pointer; }
.check-inline input { width: 18px; height: 18px; accent-color: var(--brand); }
.home-wrap { max-width: 640px; margin: 3rem auto; padding: 0 16px; }
.home-wrap .card { padding: 1.5rem; }
.role-list { list-style: none; padding: 0; margin: 1rem 0; }
.role-list li { padding: 0.6rem 0; border-bottom: 1px solid var(--line); display: flex; gap: 0.6rem; align-items: center; }
.modal-back[hidden] { display: none; }
.modal-error { margin-bottom: 1rem; }
.modal-section { border-top: 1px solid var(--line); margin-top: 1.2rem; padding-top: 1rem; }
.inline-form { display: inline; margin: 0; }
.child-chip { display: inline-flex; align-items: center; gap: 0.25rem; margin: 0.1rem 0.2rem 0.1rem 0; }
.pick-list { max-height: 220px; overflow-y: auto; border: 1.5px solid var(--line); border-radius: 12px; padding: 0.4rem 0.7rem; }
.pick-list label { display: flex; gap: 0.5rem; align-items: center; padding: 0.3rem 0; font-weight: 600; cursor: pointer; }
.pick-list input { width: 17px; height: 17px; accent-color: var(--brand); }
.tab-link { text-decoration: none; color: inherit; }
.role-switch { white-space: nowrap; }
.seg a { padding: 0.4rem 0.9rem; border-radius: 999px; font-weight: 800; font-size: 0.85rem; color: var(--muted); text-decoration: none; }
.seg a.on { background: var(--brand); color: #fff; }
a.day { text-decoration: none; color: inherit; display: flex; flex-direction: column; }

/* Unread interventions badge on the child switcher */
.kid { position: relative; }

/* Attendance register: Present / Absent / Late as radio buttons */
.seg-att label {
    position: relative;
    padding: 0.4rem 0.75rem;
    border-radius: 999px;
    font-weight: 800;
    font-size: 0.85rem;
    color: var(--muted);
    cursor: pointer;
    text-align: center;
}
.seg-att label input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.seg-att label.present:has(input:checked) { background: var(--good); color: #fff; }
.seg-att label.absent:has(input:checked) { background: var(--low); color: #fff; }
.seg-att label.late:has(input:checked) { background: var(--accent-dark); color: var(--brand-deep); }
.seg-att label:has(input:focus-visible) { outline: 3px solid var(--accent); outline-offset: 2px; }
.seg-att label:has(input:disabled) { cursor: default; }
@media (max-width: 699.98px) {
    .reg-list .seg-att label { flex: 1; }
}

/* Set up your school (admin Home) */
.setup-steps { padding-left: 0; }

/* Learner photos */
.learner-photo { object-fit: cover; padding: 0; }
.avatar-sm-photo { width: 30px; height: 30px; border-radius: 50%; object-fit: cover; vertical-align: middle; margin-right: 0.4rem; }
