@import url("portal-login.css?v=20261013-1");
/* =====================================================================
   SNES Health Management System - main stylesheet (mobile first)
   Theme: deep maroon + soft school colours. Built on Bootstrap 5.3.
   ===================================================================== */

:root {
    --maroon-900: #00484d;
    --maroon-800: #00585d;
    --maroon-700: #006d73;      /* primary */
    --maroon-600: #007d82;
    --maroon-500: #009b9e;
    --maroon-100: #e0f1f2;
    --maroon-50:  #f0f8f8;

    --bg: #f5f7f9;
    --surface: #ffffff;
    --line: #dce5e8;
    --ink: #243746;
    --ink-2: #526474;
    --muted: #64748b;

    --soft-green: #e4f4e9;   --on-green: #17622f;
    --soft-blue: #e4effb;    --on-blue: #1b5aa6;
    --soft-yellow: #fff3d1;  --on-yellow: #7a5200;
    --soft-red: #fde6ea;     --on-red: #a3122a;
    --soft-gray: #eceaea;    --on-gray: #4f4749;

    --male: #2a78d6;
    --female: #eb6834;

    --radius: 16px;
    --radius-sm: 10px;
    --shadow: 0 2px 12px rgba(0, 72, 77, .07);
    --shadow-lg: 0 10px 30px rgba(0, 72, 77, .14);
    --sidebar-w: 272px;
    --topbar-h: 64px;
    --bottom-h: 64px;

    --bs-primary: #006d73;
    --bs-primary-rgb: 0, 109, 115;
    --bs-link-color: #006d73;
    --bs-link-color-rgb: 0, 109, 115;
    --bs-link-hover-color: #004f54;
    --bs-link-hover-color-rgb: 0, 79, 84;
    --bs-body-bg: var(--bg);
    --bs-body-color: var(--ink);
    --bs-border-color: var(--line);
    --bs-body-font-family: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
    --bs-focus-ring-color: rgba(0, 109, 115, .25);
}

html { -webkit-text-size-adjust: 100%; }
body { background: var(--bg); color: var(--ink); font-size: .95rem; -webkit-tap-highlight-color: transparent; }
.min-w-0 { min-width: 0; }
.tiny { font-size: .72rem; }
.text-truncate-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.skip-link { position: absolute; left: .5rem; top: .5rem; z-index: 3000; background: #fff; padding: .5rem 1rem; border-radius: 8px; }

/* ---- Bootstrap colour overrides ------------------------------------ */
.btn-primary {
    --bs-btn-bg: #006d73; --bs-btn-border-color: #006d73; --bs-btn-color: #fff;
    --bs-btn-hover-bg: #00585d; --bs-btn-hover-border-color: #00585d; --bs-btn-hover-color: #fff;
    --bs-btn-active-bg: #004f54; --bs-btn-active-border-color: #004f54; --bs-btn-active-color: #fff;
    --bs-btn-disabled-bg: #006d73; --bs-btn-disabled-border-color: #006d73;
    --bs-btn-focus-shadow-rgb: 0, 109, 115;
}
.btn-outline-primary {
    --bs-btn-color: #006d73; --bs-btn-border-color: #006d73;
    --bs-btn-hover-bg: #006d73; --bs-btn-hover-border-color: #006d73; --bs-btn-hover-color: #fff;
    --bs-btn-active-bg: #00585d; --bs-btn-active-border-color: #00585d; --bs-btn-active-color: #fff;
    --bs-btn-focus-shadow-rgb: 0, 109, 115;
}
.btn { border-radius: 10px; font-weight: 500; }
.btn-light { --bs-btn-bg: #fff; --bs-btn-border-color: var(--line); }
.btn-lg-touch { min-height: 46px; padding: .55rem 1.1rem; }
.form-check-input:checked { background-color: #006d73; border-color: #006d73; }
.form-check-input:focus, .form-control:focus, .form-select:focus { border-color: #009b9e; box-shadow: 0 0 0 .22rem rgba(0, 109, 115, .15); }
.page-link { color: #006d73; }
.page-item.active .page-link { background-color: #006d73; border-color: #006d73; color: #fff; }
.progress-bar { background-color: #006d73; }
.form-control, .form-select { border-radius: 10px; border-color: #cfdde0; }
.form-label { font-weight: 600; font-size: .85rem; color: var(--ink-2); margin-bottom: .3rem; }
.form-control-lg-touch, .form-select-lg-touch { min-height: 48px; font-size: 1rem; }
.text-maroon { color: var(--maroon-700) !important; }
.bg-maroon { background: var(--maroon-700) !important; color: #fff; }
.required::after { content: " *"; color: #c1121f; }

/* ---- App shell ----------------------------------------------------- */
.app-shell { display: flex; min-height: 100vh; }
.app-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.content { flex: 1 0 auto; padding: 1rem 1rem calc(var(--bottom-h) + 28px + env(safe-area-inset-bottom)); outline: none; }
@media (min-width: 992px) { .content { padding: 1.6rem 2rem 2rem; } }
.plain-main { min-height: 100vh; }

/* Sidebar (desktop) and drawer (mobile) share styling */
.sidebar {
    flex: 0 0 var(--sidebar-w); width: var(--sidebar-w); position: sticky; top: 0; height: 100vh;
    flex-direction: column; color: #fff;
    background: linear-gradient(180deg, var(--maroon-700) 0%, var(--maroon-800) 55%, var(--maroon-900) 100%);
}
.sidebar-brand { padding: 1.1rem 1.1rem .9rem; border-bottom: 1px solid rgba(255,255,255,.12); }
.sidebar-nav { flex: 1 1 auto; overflow-y: auto; padding: .8rem .7rem; }
.brand { display: flex; align-items: center; gap: .7rem; color: #fff; text-decoration: none; }
.brand:hover { color: #fff; }
.brand-logo { width: 44px; height: 44px; object-fit: contain; background: #fff; border-radius: 12px; padding: 3px; flex: 0 0 auto; }
.brand-text { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.brand-text strong { font-size: .92rem; font-weight: 700; }
.brand-text small { font-size: .72rem; opacity: .8; letter-spacing: .02em; }
.nav-menu li + li { margin-top: 2px; }
.nav-link-item {
    display: flex; align-items: center; gap: .75rem; padding: .62rem .85rem; border-radius: 10px;
    color: rgba(255,255,255,.86); text-decoration: none; font-size: .92rem; font-weight: 500; cursor: pointer;
}
.nav-link-item i { font-size: 1.1rem; width: 1.3rem; text-align: center; }
.nav-link-item:hover { background: rgba(255,255,255,.1); color: #fff; }
.nav-link-item.active { background: #fff; color: var(--maroon-700); box-shadow: 0 4px 14px rgba(0,0,0,.18); }
.sidebar-user { display: flex; align-items: center; gap: .7rem; padding: .9rem 1.1rem; border-top: 1px solid rgba(255,255,255,.12); }
.avatar { width: 40px; height: 40px; border-radius: 50%; background: rgba(255,255,255,.18); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; flex: 0 0 auto; }
.avatar.sm { width: 34px; height: 34px; background: var(--maroon-700); font-size: .9rem; }
.sidebar-drawer { background: linear-gradient(180deg, var(--maroon-700), var(--maroon-900)); color: #fff; max-width: 86vw; }
.sidebar-drawer .offcanvas-body { padding-top: 0; }

/* Top bar */
.topbar {
    position: sticky; top: 0; z-index: 1020; min-height: var(--topbar-h); background: rgba(255,255,255,.96);
    backdrop-filter: blur(6px); border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between;
    gap: .75rem; padding: .4rem 1rem; padding-top: calc(.4rem + env(safe-area-inset-top));
}
@media (min-width: 992px) { .topbar { padding: .4rem 2rem; } }
.topbar-title { font-weight: 700; font-size: 1.05rem; color: var(--maroon-700); line-height: 1.2; }
.topbar-context { font-size: .75rem; color: var(--muted); }
.topbar-context .dot { margin: 0 .25rem; }
.brand-mini img { border-radius: 9px; background: #fff; border: 1px solid var(--line); padding: 2px; object-fit: contain; }
.btn-icon { width: 42px; height: 42px; border-radius: 50%; border: 0; background: transparent; font-size: 1.25rem; color: var(--ink-2); display: inline-flex; align-items: center; justify-content: center; }
.btn-icon:hover { background: var(--maroon-50); color: var(--maroon-700); }
.notif-count { position: absolute; top: 3px; right: 1px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: #d62839; color: #fff; font-size: .68rem; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; border: 2px solid #fff; }
.user-btn { display: inline-flex; align-items: center; border: 0; padding: .2rem .4rem; border-radius: 30px; background: transparent; }
.user-btn::after { margin-left: .5rem; }
.user-btn:hover { background: var(--maroon-50); }
.notif-menu { width: min(380px, 92vw); padding: 0; border-radius: 14px; border: 0; overflow: hidden; }
.notif-item { display: flex; gap: .7rem; padding: .7rem 1rem; text-decoration: none; color: var(--ink); border-bottom: 1px solid var(--line); }
.notif-item i { color: var(--maroon-700); font-size: 1.15rem; margin-top: .1rem; }
.notif-item.unread { background: var(--maroon-50); }
.notif-item:hover { background: #edf6f6; color: var(--ink); }

.app-footer { padding: 1rem; text-align: center; font-size: .78rem; color: var(--ink-2); border-top: 1px solid var(--line); background: #fff; margin-bottom: calc(var(--bottom-h) + env(safe-area-inset-bottom)); }
@media (min-width: 992px) { .app-footer { margin-bottom: 0; } }
.plain-footer { text-align: center; font-size: .78rem; color: var(--ink-2); padding: 1rem; }

/* Bottom navigation (phones/tablets) */
.bottom-nav {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 1030; display: flex; align-items: stretch;
    background: #fff; border-top: 1px solid var(--line); box-shadow: 0 -4px 18px rgba(0, 72, 77,.08);
    padding-bottom: env(safe-area-inset-bottom); min-height: calc(var(--bottom-h) + env(safe-area-inset-bottom));
}
.bn-item {
    flex: 1 1 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; position: relative;
    color: var(--muted); text-decoration: none; font-size: .68rem; font-weight: 600; border: 0; background: transparent; min-height: var(--bottom-h); padding: 4px 2px;
}
.bn-item i { font-size: 1.35rem; line-height: 1; }
.bn-item.active { color: var(--maroon-700); }
.bn-item.active::before { content: ""; position: absolute; top: 0; left: 28%; right: 28%; height: 3px; border-radius: 0 0 4px 4px; background: var(--maroon-700); }
.bn-add i { background: var(--maroon-700); color: #fff; width: 44px; height: 44px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 1.5rem; margin-top: -18px; box-shadow: 0 6px 16px rgba(0, 109, 115,.4); border: 3px solid #fff; }
.bn-add span { color: var(--maroon-700); margin-top: 0; }
.bn-add.active::before { display: none; }
.bn-dot { position: absolute; top: 10px; right: calc(50% - 20px); width: 10px; height: 10px; border-radius: 50%; background: #d62839; border: 2px solid #fff; }

/* ---- Page heading ---------------------------------------------------- */
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: .75rem 1rem; margin-bottom: 1.1rem; }
.page-title { font-size: 1.45rem; font-weight: 800; color: var(--ink); margin: 0; letter-spacing: -.01em; }
.page-sub { margin: .15rem 0 0; color: var(--ink-2); font-size: .9rem; }
.page-actions { display: flex; flex-wrap: wrap; gap: .5rem; }
@media (max-width: 575.98px) { .page-actions { width: 100%; } .page-actions .btn { flex: 1 1 auto; } .page-title { font-size: 1.25rem; } }

/* ---- Cards ------------------------------------------------------------ */
.card-soft { border: 0; border-radius: var(--radius); box-shadow: var(--shadow); background: var(--surface); }
.card-soft > .card-header { background: transparent; border-bottom: 1px solid var(--line); font-weight: 700; padding: .9rem 1.1rem; display: flex; align-items: center; justify-content: space-between; gap: .5rem; flex-wrap: wrap; }
.card-soft > .card-body { padding: 1.1rem; }
.card-title-sm { font-size: .98rem; font-weight: 700; margin: 0; display: flex; align-items: center; gap: .5rem; }
.card-title-sm i { color: var(--maroon-700); }

.stat-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem; margin-bottom: 1.1rem; }
@media (min-width: 768px) { .stat-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1rem; } }
.stat-grid.cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 768px) { .stat-grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.stat-card { display: flex; align-items: center; gap: .85rem; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: .95rem 1rem; }
.stat-icon { flex: 0 0 auto; width: 46px; height: 46px; border-radius: 14px; display: inline-flex; align-items: center; justify-content: center; font-size: 1.4rem; }
.stat-value { font-size: 1.75rem; font-weight: 800; line-height: 1.05; letter-spacing: -.02em; }
.stat-label { font-size: .8rem; color: var(--ink-2); font-weight: 600; }
.stat-hint { font-size: .7rem; color: var(--muted); }
.tint-maroon .stat-icon { background: var(--maroon-100); color: var(--maroon-700); }
.tint-blue .stat-icon { background: var(--soft-blue); color: var(--on-blue); }
.tint-pink .stat-icon { background: #fde8ef; color: #b3265e; }
.tint-green .stat-icon { background: var(--soft-green); color: var(--on-green); }
.tint-yellow .stat-icon { background: var(--soft-yellow); color: var(--on-yellow); }
.tint-red .stat-icon { background: var(--soft-red); color: var(--on-red); }
.tint-gray .stat-icon { background: var(--soft-gray); color: var(--on-gray); }
.tint-orange .stat-icon { background: #fde9df; color: #b4410f; }
@media (max-width: 575.98px) { .stat-value { font-size: 1.45rem; } .stat-card { padding: .8rem; gap: .65rem; } .stat-icon { width: 40px; height: 40px; font-size: 1.2rem; border-radius: 12px; } }

/* ---- Charts ------------------------------------------------------------ */
.chart-card .card-body { padding-top: .6rem; }
.chart-box { position: relative; height: 280px; }
.chart-box.tall { height: 340px; }
.chart-box.short { height: 230px; }
.chart-table { display: none; max-height: 280px; overflow: auto; }
.chart-card.show-table .chart-table { display: block; }
.chart-card.show-table .chart-box { display: none; }
.chart-toggle { font-size: .75rem; padding: .15rem .55rem; }
.chart-legend { display: flex; flex-wrap: wrap; gap: .35rem 1rem; font-size: .8rem; color: var(--ink-2); margin-bottom: .4rem; }
.chart-legend .key { display: inline-flex; align-items: center; gap: .4rem; }
.chart-legend .swatch { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.chart-empty { height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; color: var(--muted); font-size: .9rem; }
.chart-empty i { font-size: 1.8rem; margin-bottom: .3rem; }

/* ---- Tables ------------------------------------------------------------- */
.table { --bs-table-bg: transparent; margin-bottom: 0; }
.table > thead > tr > th { font-size: .74rem; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-2); font-weight: 700; background: #f5f7f9; border-bottom: 1px solid var(--line); white-space: nowrap; padding: .7rem .75rem; }
.table > tbody > tr > td { padding: .7rem .75rem; vertical-align: middle; border-color: #e8eef0; }
.table-hover > tbody > tr:hover > * { --bs-table-bg-state: #f0f8f8; }
.table .actions { white-space: nowrap; text-align: right; }
.table .actions .btn { padding: .2rem .5rem; }
.cell-title { font-weight: 600; color: var(--ink); }
.cell-sub { font-size: .76rem; color: var(--muted); }

/* Wide tables turn into compact two-column cards on phones */
@media (max-width: 767.98px) {
    .table-stack thead { display: none; }
    .table-stack, .table-stack tbody { display: block; width: 100%; }
    .table-stack tr {
        display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0 .9rem; align-items: start;
        background: #fff; border: 1px solid var(--line); border-radius: 14px; margin: 0 0 .7rem; padding: .55rem .85rem .6rem; box-shadow: 0 1px 4px rgba(0, 72, 77,.05);
    }
    .table-stack td { display: block; padding: .3rem 0; border: 0; text-align: left; font-size: .88rem; min-width: 0; overflow-wrap: anywhere; }
    .table-stack td::before { content: attr(data-label); display: block; font-size: .64rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-bottom: .05rem; }
    .table-stack td.cell-primary { grid-column: 1 / -1; order: -1; font-size: 1rem; border-bottom: 1px solid var(--line); padding-bottom: .4rem; margin-bottom: .15rem; }
    .table-stack td.cell-primary::before { display: none; }
    .table-stack td.cell-wide { grid-column: 1 / -1; }
    .table-stack td.actions { grid-column: 1 / -1; display: flex; justify-content: flex-end; gap: .4rem; flex-wrap: wrap; padding-top: .5rem; margin-top: .2rem; border-top: 1px dashed #dce5e8; white-space: normal; }
    .table-stack td.actions::before { display: none; }
    .table-stack td.actions .btn { padding: .4rem .8rem; min-height: 38px; }
    .table-stack td[data-label=""]::before { display: none; }
    .table-stack tr.collapse-row { display: block; padding: 0; border: 0; box-shadow: none; background: transparent; margin: -.4rem 0 .7rem; }
    .table-stack tr.collapse-row td { display: block; }
    .table-stack tr.collapse-row td::before { display: none; }
    .card-flush-mobile { background: transparent !important; box-shadow: none !important; }
    .card-flush-mobile > .card-body, .card-flush-mobile > .table-responsive { padding: 0 !important; }
    .card-flush-mobile > .card-header { background: #fff; border-radius: var(--radius); margin-bottom: .7rem; border: 0; box-shadow: var(--shadow); }
    .card-flush-mobile > .card-body.border-top { padding: .5rem 0 !important; border: 0 !important; }
}

/* ---- Badges --------------------------------------------------------------- */
.status-badge, .sex-badge, .tag {
    display: inline-flex; align-items: center; gap: .3rem; padding: .22rem .6rem; border-radius: 999px; font-size: .74rem; font-weight: 700; white-space: nowrap; line-height: 1.25; border: 1px solid transparent;
}
.status-resolved { background: var(--soft-green); color: var(--on-green); border-color: #bfe3cb; }
.status-active   { background: var(--soft-blue);  color: var(--on-blue);  border-color: #bcd6f2; }
.status-followup { background: var(--soft-yellow); color: var(--on-yellow); border-color: #f2d98a; }
.status-referred { background: var(--soft-red);   color: var(--on-red);   border-color: #f3b7c0; }
.status-archived { background: var(--soft-gray);  color: var(--on-gray);  border-color: #d6d0d1; }
.sex-male   { background: #e9f1fc; color: #1d5fb0; }
.sex-female { background: #fdece5; color: #b4410f; }
.tag { background: var(--maroon-50); color: var(--maroon-700); border-color: var(--maroon-100); }
.tag.gray { background: var(--soft-gray); color: var(--on-gray); border-color: transparent; }
.tag.yellow { background: var(--soft-yellow); color: var(--on-yellow); }

/* ---- Filters ------------------------------------------------------------- */
.filter-card .card-body { padding: .9rem 1rem; }
.filter-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .65rem; }
@media (min-width: 768px) { .filter-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (min-width: 1200px) { .filter-grid.cols-6 { grid-template-columns: repeat(6, minmax(0, 1fr)); } .filter-grid.cols-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); } }
.filter-grid .full { grid-column: 1 / -1; }
.filter-actions { display: flex; gap: .5rem; align-items: end; }
.search-wrap { position: relative; }
.search-wrap > i { position: absolute; left: .85rem; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.search-wrap .form-control { padding-left: 2.4rem; }

/* ---- Empty states ----------------------------------------------------------- */
.empty-state { text-align: center; padding: 2.2rem 1rem; color: var(--ink-2); }
.empty-state > i { font-size: 2.4rem; color: #bdcdd1; display: block; margin-bottom: .5rem; }

/* ---- Health record form ----------------------------------------------------- */
.form-section { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.1rem; margin-bottom: 1rem; }
.form-section > h2 { font-size: 1rem; font-weight: 700; display: flex; align-items: center; gap: .5rem; margin: 0 0 .9rem; }
.form-section > h2 i { color: var(--maroon-700); }
.pupil-picker { position: relative; }
.pupil-results { position: absolute; z-index: 40; left: 0; right: 0; top: calc(100% + 4px); background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-lg); max-height: 320px; overflow-y: auto; }
.pupil-result { display: flex; align-items: center; gap: .75rem; width: 100%; padding: .65rem .85rem; border: 0; background: transparent; text-align: left; border-bottom: 1px solid #edf2f4; }
.pupil-result:last-child { border-bottom: 0; }
.pupil-result:hover, .pupil-result.active { background: var(--maroon-50); }
.pupil-result .initial { width: 36px; height: 36px; border-radius: 50%; background: var(--maroon-100); color: var(--maroon-700); font-weight: 700; display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; }
.pupil-card { display: none; border: 1px solid var(--maroon-100); background: var(--maroon-50); border-radius: 14px; padding: .85rem 1rem; margin-top: .75rem; }
.pupil-card.show { display: block; }
.pupil-card dl { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .5rem 1rem; margin: 0; }
@media (min-width: 768px) { .pupil-card dl { grid-template-columns: repeat(5, minmax(0, 1fr)); } }
.pupil-card dt { font-size: .68rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 700; }
.pupil-card dd { margin: 0; font-weight: 600; word-break: break-word; }

.chip-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .5rem; }
@media (min-width: 576px) { .chip-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 992px) { .chip-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } .chip-grid.wide { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.chip-grid.one-col { grid-template-columns: 1fr; }
@media (min-width: 576px) { .chip-grid.one-col { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.chip { position: relative; }
.chip input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; z-index: 2; }
.chip label { display: flex; align-items: center; justify-content: center; gap: .4rem; min-height: 50px; padding: .45rem .6rem; border: 1.5px solid #cfdde0; border-radius: 12px; background: #fff; font-weight: 600; font-size: .9rem; text-align: center; line-height: 1.2; color: var(--ink); transition: all .12s; user-select: none; }
.chip.left label { justify-content: flex-start; text-align: left; }
.chip input:checked + label { background: var(--maroon-700); border-color: var(--maroon-700); color: #fff; box-shadow: 0 4px 12px rgba(0, 109, 115,.25); }
.chip input:checked + label::before { content: "\F26A"; font-family: "bootstrap-icons"; font-size: 1rem; }
.chip input:focus-visible + label { outline: 3px solid rgba(0, 109, 115,.35); outline-offset: 2px; }
.chip.status-opt input:checked + label { color: var(--ink); box-shadow: none; }
.chip.status-opt[data-status="Active"] input:checked + label { background: var(--soft-blue); border-color: #5b9be0; color: var(--on-blue); }
.chip.status-opt[data-status="Resolved"] input:checked + label { background: var(--soft-green); border-color: #4cae6c; color: var(--on-green); }
.chip.status-opt[data-status="Referred"] input:checked + label { background: var(--soft-red); border-color: #dc5a6f; color: var(--on-red); }
.chip.status-opt[data-status="Follow-up Needed"] input:checked + label { background: var(--soft-yellow); border-color: #e0b13a; color: var(--on-yellow); }
.med-row { background: #f5f7f9; border: 1px solid var(--line); border-radius: 12px; padding: .7rem; margin-bottom: .6rem; }
.sticky-save { position: sticky; bottom: calc(var(--bottom-h) + env(safe-area-inset-bottom) + 6px); z-index: 30; background: rgba(255,255,255,.96); backdrop-filter: blur(6px); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow-lg); padding: .65rem; display: flex; gap: .6rem; }
.sticky-save .btn { flex: 1 1 0; min-height: 50px; font-size: 1rem; }
@media (min-width: 992px) { .sticky-save { bottom: 12px; justify-content: flex-end; } .sticky-save .btn { flex: 0 0 auto; min-width: 180px; } }
.success-panel { text-align: center; padding: 2rem 1rem; }
.success-panel .tick { width: 76px; height: 76px; margin: 0 auto 1rem; border-radius: 50%; background: var(--soft-green); color: var(--on-green); display: flex; align-items: center; justify-content: center; font-size: 2.6rem; }

/* ---- Detail pages ------------------------------------------------------------- */
.detail-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .9rem 1.2rem; margin: 0; }
@media (min-width: 992px) { .detail-grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } .detail-grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.detail-grid dt { font-size: .7rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 700; margin-bottom: .1rem; }
.detail-grid dd { margin: 0; font-weight: 600; word-break: break-word; }
.detail-grid .span-2 { grid-column: span 2; }
.detail-grid .span-all { grid-column: 1 / -1; }
.note-box { background: #f5f7f9; border-left: 4px solid var(--maroon-500); border-radius: 8px; padding: .65rem .9rem; white-space: pre-line; }
.confidential-strip { background: var(--soft-yellow); color: var(--on-yellow); border-radius: 10px; padding: .45rem .8rem; font-size: .8rem; font-weight: 600; display: flex; gap: .5rem; align-items: center; }

.summary-tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem; }
@media (min-width: 768px) { .summary-tiles { grid-template-columns: repeat(5, minmax(0, 1fr)); } }
.summary-tile { background: #f5f7f9; border-radius: 14px; padding: .8rem; }
.summary-tile .v { font-size: 1.35rem; font-weight: 800; line-height: 1.15; }
.summary-tile .l { font-size: .72rem; color: var(--ink-2); font-weight: 600; }

/* Timeline (pupil health history) */
.timeline { position: relative; margin: 0; padding: 0 0 0 1.4rem; list-style: none; }
.timeline::before { content: ""; position: absolute; left: .45rem; top: .4rem; bottom: .4rem; width: 2px; background: var(--maroon-100); }
.timeline > li { position: relative; padding-bottom: 1.25rem; }
.timeline > li::before { content: ""; position: absolute; left: -1.38rem; top: .3rem; width: 14px; height: 14px; border-radius: 50%; background: #fff; border: 3px solid var(--maroon-700); }
.timeline .t-date { font-weight: 800; }
.timeline .t-body { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: .7rem .9rem; margin-top: .3rem; }

/* ---- Notifications page ------------------------------------------------------ */
.notif-row { display: flex; gap: .9rem; padding: .9rem 1rem; border-bottom: 1px solid var(--line); text-decoration: none; color: var(--ink); align-items: flex-start; }
.notif-row:last-child { border-bottom: 0; }
.notif-row.unread { background: var(--maroon-50); }
.notif-row .ico { width: 40px; height: 40px; border-radius: 12px; background: var(--maroon-100); color: var(--maroon-700); display: inline-flex; align-items: center; justify-content: center; font-size: 1.2rem; flex: 0 0 auto; }
.notif-row:hover { background: #edf6f6; color: var(--ink); }

/* ---- Alerts (neutral system notices) ----------------------------------------- */
.neutral-alert { display: flex; gap: .7rem; align-items: flex-start; background: var(--soft-yellow); border: 1px solid #f2d98a; color: #5d4100; border-radius: 12px; padding: .7rem .9rem; margin-bottom: .55rem; font-size: .9rem; }
.neutral-alert i { margin-top: .1rem; }
.disclaimer { font-size: .78rem; color: var(--muted); }

/* ---- Auth / login ---------------------------------------------------------------- */
.auth-wrap { min-height: 100vh; display: flex; flex-direction: column; }
.auth-grid { flex: 1; display: grid; grid-template-columns: 1fr; }
@media (min-width: 992px) { .auth-grid { grid-template-columns: 1.05fr .95fr; } }
.auth-hero { background: linear-gradient(155deg, var(--maroon-700), var(--maroon-900)); color: #fff; padding: 2.2rem 1.6rem; display: flex; flex-direction: column; justify-content: center; position: relative; overflow: hidden; }
.auth-hero::after { content: ""; position: absolute; width: 420px; height: 420px; border-radius: 50%; right: -140px; bottom: -160px; background: rgba(255,255,255,.07); }
.auth-hero::before { content: ""; position: absolute; width: 260px; height: 260px; border-radius: 50%; left: -90px; top: -90px; background: rgba(255,255,255,.06); }
.auth-hero .logo { width: 84px; height: 84px; background: #fff; border-radius: 22px; padding: 6px; object-fit: contain; box-shadow: 0 10px 30px rgba(0,0,0,.25); }
.auth-hero h1 { font-weight: 800; font-size: 1.55rem; line-height: 1.2; margin: 1rem 0 .3rem; }
.auth-hero p { opacity: .85; max-width: 440px; margin: 0; }
.auth-hero .pill-list { margin-top: 1.4rem; display: flex; flex-wrap: wrap; gap: .5rem; position: relative; z-index: 1; }
.auth-hero .pill-list span { background: rgba(255,255,255,.14); border-radius: 999px; padding: .3rem .8rem; font-size: .8rem; }
@media (min-width: 992px) { .auth-hero { padding: 3rem 4rem; } .auth-hero h1 { font-size: 2.1rem; } }
.auth-panel { display: flex; align-items: center; justify-content: center; padding: 1.6rem 1.1rem; }
.auth-card { width: 100%; max-width: 420px; }
.input-group-text.toggle { cursor: pointer; background: #fff; }
.error-wrap { max-width: 540px; margin: 8vh auto; padding: 0 1rem; }
.error-icon { font-size: 3.4rem; color: var(--maroon-700); line-height: 1; margin-bottom: .6rem; }

/* ---- Misc ---------------------------------------------------------------------------- */
.divider-label { display: flex; align-items: center; gap: .75rem; color: var(--muted); font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; font-weight: 700; margin: 1.1rem 0 .6rem; }
.divider-label::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.repeat-flag { color: #8a5a00; background: var(--soft-yellow); border-radius: 8px; padding: .1rem .5rem; font-size: .75rem; font-weight: 700; white-space: nowrap; }
.sub-tabs { display: flex; gap: .35rem; overflow-x: auto; padding-bottom: .25rem; margin-bottom: 1rem; -webkit-overflow-scrolling: touch; }
.sub-tabs a { white-space: nowrap; padding: .5rem .95rem; border-radius: 999px; background: #fff; border: 1px solid var(--line); text-decoration: none; color: var(--ink-2); font-weight: 600; font-size: .88rem; }
.sub-tabs a.active { background: var(--maroon-700); border-color: var(--maroon-700); color: #fff; }
.class-pill-nav { display: flex; gap: .4rem; flex-wrap: wrap; }
.class-pill-nav a { padding: .35rem .85rem; border-radius: 999px; background: #fff; border: 1px solid var(--line); font-weight: 600; text-decoration: none; color: var(--ink-2); font-size: .85rem; }
.class-pill-nav a.active { background: var(--maroon-700); color: #fff; border-color: var(--maroon-700); }
.copy-box { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 1.15rem; letter-spacing: .04em; background: #fff; border: 2px dashed var(--maroon-500); border-radius: 10px; padding: .6rem .9rem; display: inline-block; user-select: all; }

/* ---- Report preview (screen) ---------------------------------------------------------- */
.report-toolbar { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; justify-content: space-between; margin-bottom: 1rem; }
.report-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.report-sheet { background: #fff; width: 100%; max-width: 297mm; margin: 0 auto; padding: 14mm 12mm; box-shadow: var(--shadow); border-radius: 6px; color: #000; font-size: 10.5pt; min-width: 640px; }
.report-header { text-align: center; line-height: 1.35; border-bottom: 2px solid #006d73; padding-bottom: 8px; margin-bottom: 12px; position: relative; }
.report-header .rh-logo { position: absolute; left: 0; top: 0; width: 70px; height: 70px; object-fit: contain; }
.report-header .rh-line { font-size: 9.5pt; letter-spacing: .03em; }
.report-header .rh-school { font-size: 15pt; font-weight: 800; color: #006d73; text-transform: uppercase; }
.report-header .rh-system { font-size: 11pt; font-weight: 700; text-transform: uppercase; }
.report-title { text-align: center; font-size: 13pt; font-weight: 800; text-transform: uppercase; margin: 10px 0 6px; }
.report-meta { display: flex; flex-wrap: wrap; gap: 4px 28px; justify-content: center; font-size: 9.5pt; margin-bottom: 12px; }
.report-meta b { font-weight: 700; }
.report-table { width: 100%; border-collapse: collapse; font-size: 9.5pt; margin-bottom: 14px; }
.report-table th, .report-table td { border: 1px solid #555; padding: 4px 6px; vertical-align: top; }
.report-table th { background: #e0f1f2; text-align: left; font-weight: 700; }
.report-table td.num, .report-table th.num { text-align: right; white-space: nowrap; }
.report-table tfoot td { font-weight: 800; background: #f0f8f8; }
.report-h2 { font-size: 11pt; font-weight: 800; margin: 14px 0 6px; color: #006d73; text-transform: uppercase; }
.report-summary { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.report-summary div { border: 1px solid #999; padding: 4px 12px; border-radius: 4px; font-size: 9.5pt; }
.report-summary b { font-size: 12pt; display: block; }
.report-sign { display: flex; justify-content: space-between; gap: 30px; margin-top: 34px; page-break-inside: avoid; }
.report-sign div { flex: 1; text-align: center; font-size: 9.5pt; }
.report-sign .line { border-top: 1px solid #000; margin-top: 34px; padding-top: 3px; font-weight: 700; }
.report-foot { margin-top: 18px; font-size: 8.5pt; text-align: center; color: #333; border-top: 1px solid #aaa; padding-top: 6px; }
.report-note { font-size: 8.5pt; color: #444; font-style: italic; margin-bottom: 8px; }

/* Elements that exist only on paper */
.print-only, .print-confidential { display: none; }

.pupil-picker { scroll-margin-top: 84px; }
.pupil-results { max-height: min(320px, 42vh); }

/* Keep focused / scrolled-to controls clear of the sticky top bar and the bottom navigation (WCAG 2.2 "Focus Not Obscured") */
input, select, textarea, button, a, .chip, .form-section, summary { scroll-margin-top: 84px; scroll-margin-bottom: 110px; }

/* Secondary table columns are shown on tablets/desktops; phones get a shorter card (details are one tap away) */
.show-mobile { display: none; }
@media (max-width: 767.98px) { .hide-mobile { display: none !important; } .show-mobile { display: inline; } }
@media (max-width: 991.98px) { .hide-md-down { display: none !important; } }

/* Simplified report form: two big In School / At Home buttons, numbered steps */
.chip-grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.chip-grid.two .chip label { min-height: 64px; font-size: 1.05rem; gap: .5rem; }
.chip-grid.two .chip label i { font-size: 1.3rem; }
.step-no { display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px; border-radius: 50%; background: var(--maroon-700); color: #fff; font-size: .8rem; font-weight: 700; flex: 0 0 auto; }
details.form-section > summary { list-style: none; }
details.form-section > summary::-webkit-details-marker { display: none; }
details.form-section > summary::after { content: "\F282"; font-family: "bootstrap-icons"; float: right; transition: transform .15s; }
details.form-section[open] > summary::after { transform: rotate(180deg); }

/* eLeave-inspired utility header, compact navigation and bordered panels. */
:root { --radius: 6px; --radius-sm: 4px; --shadow: 0 1px 3px rgba(0,0,0,.1); --bg: #f5f7f9; }
body { font-family: Arial, Helvetica, sans-serif; }
.app-main, .content, .card-body { min-width: 0; }
.btn, .form-control, .form-select { border-radius: 4px; }
.btn { min-height: 44px; }
.form-control, .form-select { min-height: 44px; }
.card-soft, .form-section { border: 1px solid var(--line); border-radius: 6px; }
.card-header { background: #f5f7f9; }
.pupil-list-row { display:flex; align-items:center; justify-content:space-between; gap:12px; padding:12px 0; border-bottom:1px solid var(--line); }
.pupil-list-row:last-child { border-bottom:0; }
.pupil-list-row a { overflow-wrap:anywhere; }
.pupil-list-row > .btn { flex-shrink:0; }
.pupil-results { max-height:360px; overflow-y:auto; }
.pupil-result { min-height:56px; }
.pupil-result .min-w-0 { overflow-wrap:anywhere; }
.chip label { white-space:normal; overflow-wrap:anywhere; }
/* Original sidebar and content placement, with the current visual styling. */
@media(min-width:992px) {
 .sidebar { background:var(--maroon-700); }
 .nav-link-item { border-radius:4px; min-height:44px; font-size:.85rem; }
}
@media(max-width:575.98px) {
 .card-header { flex-wrap:wrap; gap:8px; }
}
