/* Student, Teacher and Course pages: the shared entity page shell and its building blocks.
   Follows the Insights redesign (white cards on a pale page, chips, headline figures with a
   sentence) and the entity pages prototype. Colours come from css/anseo-design.css. */

.entity-page {
    background: var(--surface-page);
    color: var(--ink);
    font-size: 14px;
    line-height: 1.45;
    margin: -1.1rem -1.5rem 0 -1.5rem;
    min-height: calc(100vh - 3.5rem);
}

@media (min-width: 641px) {
    .entity-page {
        margin-left: -1rem;
        margin-right: -1.5rem;
    }
}

.entity-page *,
.entity-page *::before,
.entity-page *::after {
    box-sizing: border-box;
}

.entity-page a {
    color: var(--blue);
    text-decoration: none;
}

.entity-page a:hover {
    text-decoration: underline;
}

.entity-page :focus-visible {
    outline: 2px solid var(--blue);
    outline-offset: 2px;
}

.entity-page .ep-num {
    font-variant-numeric: tabular-nums;
}

/* ---------- header ---------- */
.ep-head {
    background: #fff;
    border-bottom: 1px solid var(--line);
}

.ep-crumb {
    padding: 12px 24px 0;
    font-size: 13px;
    color: var(--ink-2);
    display: flex;
    gap: 6px;
    align-items: center;
    flex-wrap: wrap;
}

.ep-crumb a {
    color: var(--ink-2);
    font-weight: 500;
}

.ep-crumb b {
    color: var(--ink);
}

.ep-main {
    display: flex;
    gap: 18px;
    align-items: flex-start;
    padding: 12px 24px 14px;
    flex-wrap: wrap;
}

.ep-id {
    flex: 1;
    min-width: 260px;
}

.ep-id h1 {
    margin: 0;
    font-size: 26px;
    font-weight: 700;
    letter-spacing: -0.015em;
    line-height: 1.15;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.ep-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 14px;
    margin-top: 6px;
    color: var(--ink-2);
    font-size: 13px;
}

.ep-meta i {
    color: var(--ink-3);
    margin-right: 4px;
}

.ep-act {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
    position: relative;
}

/* ---------- avatars ---------- */
.ep-av {
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: #fff;
    flex: none;
    overflow: hidden;
    background: #94a3b8;
}

.ep-av.ep-sq {
    border-radius: 10px;
}

.ep-av img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.ep-photo {
    width: 84px;
    height: 84px;
    border-radius: 10px;
    object-fit: cover;
    background: linear-gradient(160deg, #cbd5e1, #94a3b8);
    flex: none;
}

/* ---------- chips and buttons ---------- */
.ep-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    font-weight: 700;
    border-radius: 6px;
    padding: 3px 8px;
    white-space: nowrap;
    line-height: 1.3;
    letter-spacing: 0;
}

.ep-chip-ok { background: var(--green-bg); color: #166534; }
.ep-chip-act { background: #fed7aa; color: #7c2d12; }
.ep-chip-crit { background: #991b1b; color: #fff; }
.ep-chip-watch { background: var(--amber-bg); color: #92400e; }
.ep-chip-up { background: var(--green-bg); color: #166534; }
.ep-chip-down { background: var(--violet-bg); color: #5b21b6; }
.ep-chip-grey { background: #e2e8f0; color: #334155; }
.ep-chip-blue { background: var(--blue-bg); color: var(--blue); }
.ep-chip-pend { background: var(--amber-bg); color: #92400e; }
.ep-chip-rej { background: var(--red-bg); color: #991b1b; }
/* Exited and Inactive on the page header: bordered and bold so they aren’t missed. */
.ep-chip-loud { font-weight: 700; border: 1px solid currentColor; }
.ep-chip-out { background: #fff; color: var(--ink-2); border: 1px solid #cbd5e1; }
.ep-chip-unmarked { background: #fff; color: #b45309; border: 1px dashed #d97706; }
.ep-chip-ro { background: #f1f5f9; color: var(--ink-2); border: 1px dashed #94a3b8; }

.ep-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: 1px solid #cbd5e1;
    background: #fff;
    border-radius: 8px;
    padding: 7px 12px;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    color: var(--ink) !important;
    text-decoration: none !important;
    cursor: pointer;
    line-height: 1.3;
}

.ep-btn:hover {
    border-color: #94a3b8;
    background: #f8fafc;
}

.ep-btn-pri {
    background: #0f172a;
    border-color: #0f172a;
    color: #fff !important;
}

.ep-btn-pri:hover {
    background: #1e293b;
}

.ep-btn-sm {
    padding: 4px 9px;
    font-size: 12px;
}

.ep-btn[disabled] {
    opacity: 0.45;
    cursor: not-allowed;
}

/* A header button's label: plain button text (not the .ep-label caption style).
   On phones it is visually hidden but stays the button's accessible name. */
.ep-lbl {
    font: inherit;
    color: inherit;
    text-transform: none;
    letter-spacing: normal;
}

.ep-lock {
    font-size: 12px;
    color: var(--ink-3);
    display: inline-flex;
    gap: 5px;
    align-items: center;
}

.ep-menu {
    position: absolute;
    right: 0;
    top: calc(100% + 6px);
    z-index: 25;
    min-width: 240px;
    background: #fff;
    border: 1px solid #cbd5e1;
    border-radius: 12px;
    box-shadow: 0 18px 40px rgba(15, 23, 42, 0.18);
    padding: 6px;
    display: grid;
}

.ep-menu a {
    padding: 8px 10px;
    border-radius: 8px;
    color: var(--ink);
    display: flex;
    gap: 8px;
    align-items: center;
}

.ep-menu a:hover {
    background: var(--blue-bg);
    text-decoration: none;
}

/* ---------- right now strip ---------- */
.ep-now {
    display: flex;
    margin: 0 24px 14px;
    border: 1px solid var(--line);
    border-radius: 12px;
    overflow: hidden;
    background: #fff;
}

.ep-now-l {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    flex: 1.4;
    min-width: 0;
    border-left: 4px solid var(--green);
}

.ep-now-l.ep-idle { border-left-color: #94a3b8; }
.ep-now-l.ep-warn { border-left-color: #d97706; }

.ep-pulse {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #16a34a;
    box-shadow: 0 0 0 4px rgba(22, 163, 74, 0.18);
    flex: none;
}

.ep-idle .ep-pulse {
    background: #94a3b8;
    box-shadow: 0 0 0 4px rgba(148, 163, 184, 0.25);
}

.ep-warn .ep-pulse {
    background: #d97706;
    box-shadow: 0 0 0 4px rgba(217, 119, 6, 0.2);
}

.ep-now small,
.ep-label {
    display: block;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--ink-3);
}

.ep-now-what {
    font-size: 15px;
    font-weight: 700;
}

.ep-now-det {
    display: flex;
    flex-wrap: wrap;
    gap: 2px 14px;
    font-size: 13px;
    color: var(--ink-2);
}

.ep-now-det i {
    color: var(--ink-3);
    margin-right: 3px;
}

.ep-now-r {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    flex: 1;
    min-width: 0;
    background: #f8fafc;
    border-left: 1px solid var(--line);
}

.ep-now-r .ep-now-what {
    font-size: 14px;
}

.ep-now-link {
    margin-left: auto;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
}

/* ---------- tabs ---------- */
.ep-tabs {
    position: sticky;
    top: 3.5rem;
    z-index: 20;
    background: #fff;
    border-bottom: 1px solid var(--line);
    display: flex;
    gap: 4px;
    padding: 0 24px;
    overflow-x: auto;
    scrollbar-width: none;
}

.ep-tabs::-webkit-scrollbar {
    display: none;
}

.entity-page .ep-tabs a {
    padding: 12px 10px 11px;
    font-size: 14px;
    font-weight: 500;
    color: var(--ink-2);
    border-bottom: 2px solid transparent;
    white-space: nowrap;
    display: flex;
    gap: 6px;
    align-items: center;
    text-decoration: none;
}

.entity-page .ep-tabs a:hover {
    color: var(--ink);
}

.entity-page .ep-tabs a.ep-on {
    color: var(--blue);
    border-bottom-color: var(--blue);
    font-weight: 600;
}

.ep-tab-n {
    display: inline-block;
    padding: 0 7px;
    border-radius: 9px;
    background: #e2e8f0;
    color: #334155;
    font-size: 11.5px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.ep-tab-n.ep-alert {
    background: #fde68a;
    color: #78350f;
}

/* ---------- body and cards ---------- */
.ep-body {
    padding: 18px 24px 40px;
    display: grid;
    gap: 16px;
}

.ep-g2 { display: grid; grid-template-columns: 1.6fr 1fr; gap: 16px; align-items: start; }
.ep-g2e { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
.ep-g4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.ep-col { display: grid; gap: 16px; min-width: 0; }

.ep-card {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 16px 18px;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
    min-width: 0;
}

.ep-card > header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

.ep-card h2 {
    font-size: 16px;
    margin: 0;
    font-weight: 700;
}

.ep-card .ep-cap {
    font-size: 12.5px;
    color: var(--ink-2);
    margin: 2px 0 0;
}

.ep-card h3 {
    font-size: 12.5px;
    font-weight: 600;
    color: var(--ink-2);
    margin: 0 0 6px;
    display: flex;
    justify-content: space-between;
    gap: 6px;
}

.ep-card h3 a,
.ep-card header > a {
    font-size: 13px;
    font-weight: 600;
}

.ep-big {
    font-size: 30px;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.1;
    font-variant-numeric: tabular-nums;
}

.ep-big small {
    font-size: 14px;
    font-weight: 500;
    color: var(--ink-2);
    letter-spacing: 0;
}

.ep-sub {
    font-size: 12.5px;
    color: var(--ink-2);
    margin-top: 4px;
}

.ep-down { color: var(--red); font-weight: 600; }
.ep-up { color: var(--teal); font-weight: 600; }
.ep-muted { color: var(--ink-3); }
.ep-warnt { color: var(--amber); font-weight: 600; }

.ep-bar {
    height: 8px;
    background: #f1f5f9;
    border-radius: 4px;
    overflow: hidden;
    display: flex;
    margin: 8px 0 4px;
}

.ep-bar span {
    display: block;
    height: 100%;
    background: #f97316;
}

.ep-callout {
    display: flex;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 10px;
    font-size: 13px;
    background: var(--blue-bg);
    border: 1px solid var(--blue-line);
}

.ep-callout.ep-warn {
    background: #fffbeb;
    border-color: #fde68a;
}

.ep-callout.ep-plain {
    background: #f8fafc;
    border-color: #e2e8f0;
}

.ep-callout i {
    font-size: 16px;
    line-height: 1.2;
}

.ep-empty {
    padding: 22px;
    text-align: center;
    color: var(--ink-2);
    border: 1px dashed #cbd5e1;
    border-radius: 10px;
}

.ep-ro-banner {
    display: flex;
    gap: 10px;
    align-items: center;
    padding: 9px 14px;
    border-radius: 10px;
    background: #f1f5f9;
    border: 1px dashed #94a3b8;
    font-size: 13px;
    color: var(--ink-2);
}

/* ---------- definition lists, lists ---------- */
.ep-dl {
    display: grid;
    grid-template-columns: 150px 1fr;
    gap: 9px 14px;
    margin: 0;
    font-size: 13.5px;
}

.ep-dl dt {
    color: var(--ink-2);
    font-weight: 400;
}

.ep-dl dd {
    margin: 0;
    font-weight: 500;
    min-width: 0;
    overflow-wrap: anywhere;
}

.ep-copy {
    border: 0;
    background: none;
    color: var(--ink-3);
    padding: 0 4px;
    cursor: pointer;
}

.ep-copy:hover {
    color: var(--blue);
}

.ep-copy.ep-copied {
    color: var(--green);
}

.ep-copy-done {
    font-size: 11.5px;
    font-weight: 600;
    margin-left: 3px;
}

.ep-li {
    display: flex;
    gap: 12px;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid var(--line-2);
}

.ep-li:last-child {
    border-bottom: 0;
}

.ep-li .ep-t {
    flex: 1;
    min-width: 0;
}

.ep-li .ep-t b {
    display: block;
}

.ep-li .ep-t span {
    font-size: 12.5px;
    color: var(--ink-2);
}

/* A text-style button inside a definition, such as Show beside the masked PPSN. */
.ep-link-btn {
    background: none;
    border: 0;
    padding: 0 0 0 6px;
    color: var(--blue);
    font: inherit;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
}

.ep-link-btn:hover {
    text-decoration: underline;
}

.ep-link-btn:disabled {
    opacity: .6;
    cursor: default;
}

.ep-ico {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex: none;
    border: 1.5px solid #cbd5e1;
    color: var(--ink-2);
    background: #fff;
    font-weight: 700;
}

.ep-ico.ep-ok { border-color: #86efac; color: var(--green); }
.ep-ico.ep-bad { border-color: #fca5a5; color: var(--red); }
.ep-ico.ep-warn { border-color: #fcd34d; color: var(--amber); }
.ep-ico.ep-blue { border-color: var(--blue-line); color: var(--blue); }
.ep-ico.ep-vio { border-color: #c4b5fd; color: var(--violet); }

/* ---------- tables and toolbars ---------- */
.ep-tw {
    overflow-x: auto;
    /* Contains absolutely positioned screen-reader text in the table, which would otherwise
       sit outside the scroll box and widen the page on a phone. */
    position: relative;
}

.ep-tbl {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.ep-tbl th {
    font-size: 11.5px;
    color: var(--ink-3);
    font-weight: 700;
    text-align: left;
    padding: 7px 8px;
    border-bottom: 1px solid var(--line);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    white-space: nowrap;
}

.ep-tbl td {
    padding: 9px 8px;
    border-bottom: 1px solid var(--line-2);
    vertical-align: middle;
}

.ep-tbl tr:last-child td {
    border-bottom: 0;
}

.ep-tbl .ep-r {
    text-align: right;
}

.ep-tbl td.ep-pres { color: var(--green); font-weight: 600; }
.ep-tbl td.ep-abs { color: var(--red); font-weight: 600; }

.ep-dot {
    display: inline-block;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    margin-right: 6px;
    vertical-align: 0;
}

.ep-toolbar {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.ep-select {
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    padding: 5px 8px;
    font-size: 13px;
    background: #fff;
    color: var(--ink);
}

.ep-seg {
    display: inline-flex;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    overflow: hidden;
    font-size: 12.5px;
}

.ep-seg button {
    border: 0;
    background: #fff;
    padding: 5px 10px;
    color: var(--ink-2);
    cursor: pointer;
}

.ep-seg button.ep-on {
    background: #1e293b;
    color: #fff;
}

.ep-pager {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 10px;
    font-size: 13px;
    color: var(--ink-2);
    gap: 8px;
    flex-wrap: wrap;
}

/* A search box in a card's toolbar (Teacher and Course student lists). */
.ep-search {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    padding: 0 8px;
    background: #fff;
    color: var(--ink-3);
    font-size: 13px;
}

.ep-search input {
    border: 0;
    outline: 0;
    padding: 5px 0;
    min-width: 180px;
    font-size: 13px;
    color: var(--ink);
    background: transparent;
}

.ep-search:focus-within {
    border-color: var(--blue);
    box-shadow: 0 0 0 3px #dbeafe;
}

/* ---------- week timetable grid ---------- */
.ep-tt {
    display: grid;
    grid-template-columns: 78px repeat(5, minmax(120px, 1fr));
    gap: 4px;
    min-width: 720px;
}

.ep-tt-h {
    font-size: 12px;
    font-weight: 700;
    color: var(--ink-2);
    text-align: center;
    padding: 4px 0;
}

.ep-tt-h.ep-today {
    color: var(--blue);
}

.ep-tt-h small {
    display: block;
    font-weight: 500;
    color: var(--ink-3);
}

.ep-tt-p {
    font-size: 12px;
    color: var(--ink-2);
    padding: 6px 4px;
    text-align: right;
}

.ep-tt-p b {
    display: block;
    color: var(--ink);
    font-size: 12.5px;
}

.ep-tt-brk {
    grid-column: 1 / -1;
    font-size: 11px;
    color: var(--ink-3);
    text-align: center;
    background: repeating-linear-gradient(135deg, #f1f5f9 0 6px, #f8fafc 6px 12px);
    border-radius: 6px;
    padding: 2px;
}

.ep-tt-hol {
    border-radius: 8px;
    background: repeating-linear-gradient(135deg, #f1f5f9 0 8px, #fff 8px 16px);
    border: 1px dashed #cbd5e1;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    font-size: 12px;
    font-weight: 600;
    color: var(--ink-2);
    padding: 8px;
    writing-mode: horizontal-tb;
}

.ep-slot {
    border-radius: 8px;
    padding: 7px 9px;
    min-height: 62px;
    font-size: 12px;
    line-height: 1.35;
    border: 1px solid #e2e8f0;
    background: #f8fafc;
    position: relative;
    text-align: left;
    width: 100%;
    color: var(--ink);
    font-family: inherit;
}

button.ep-slot {
    cursor: pointer;
}

.ep-slot b {
    display: block;
    font-size: 12.5px;
    color: var(--ink);
}

.ep-slot span {
    color: var(--ink-2);
}

.ep-slot.ep-free {
    background: none;
    border: 1px dashed #e2e8f0;
}

.ep-slot.ep-cur {
    outline: 2.5px solid var(--green);
    outline-offset: 1px;
}

.ep-slot.ep-cur::after {
    content: "Now";
    position: absolute;
    top: -9px;
    right: 8px;
    background: var(--green);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 5px;
}

.ep-slot.ep-cover {
    background-image: repeating-linear-gradient(135deg, rgba(217, 119, 6, 0.1) 0 6px, transparent 6px 12px);
}

.ep-slot.ep-past {
    opacity: 0.72;
}

.ep-flag {
    display: inline-block;
    margin-top: 3px;
    font-size: 10.5px;
    font-weight: 700;
    color: #92400e !important;
    background: #fef3c7;
    border-radius: 4px;
    padding: 0 5px;
}

.ep-flag.ep-flag-blue {
    background: #dbeafe;
    color: #1e40af !important;
}

.ep-mk {
    position: absolute;
    right: 7px;
    bottom: 6px;
    font-size: 13px;
}

.ep-mk.ep-mk-ok { color: var(--green); }
.ep-mk.ep-mk-bad { color: var(--red); }
.ep-mk.ep-mk-warn { color: var(--amber); }
.ep-mk.ep-mk-grey { color: var(--ink-3); }

.ep-tt-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 16px;
    font-size: 12px;
    color: var(--ink-2);
    margin-top: 10px;
}

.ep-pop {
    margin-top: 12px;
    border: 1px solid #cbd5e1;
    border-radius: 12px;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.1);
    padding: 14px;
    max-width: 360px;
    background: #fff;
}

/* ---------- day strip (overview) ---------- */
.ep-day {
    display: grid;
    gap: 6px;
}

.ep-dslot {
    display: grid;
    grid-template-columns: 62px 1fr auto;
    gap: 10px;
    align-items: center;
    padding: 8px 10px;
    border-radius: 9px;
    border: 1px solid var(--line);
}

.ep-dslot.ep-cur {
    border-color: #86efac;
    background: #f0fdf4;
}

.ep-dslot .ep-tm {
    font-size: 12px;
    color: var(--ink-2);
    font-variant-numeric: tabular-nums;
}

.ep-dslot .ep-tm b {
    display: block;
    color: var(--ink);
}

/* ---------- attendance calendar and heat ---------- */
.ep-cal {
    display: inline-grid;
    grid-template-columns: 52px repeat(5, 30px);
    gap: 4px;
    font-size: 11.5px;
    color: var(--ink-2);
    align-items: center;
}

.ep-cal i {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 22px;
    border-radius: 4px;
    font-style: normal;
    font-size: 11px;
    font-weight: 700;
}

.ep-cal .ep-c-p { background: #bfdbfe; }
.ep-cal .ep-c-a { background: #b91c1c; color: #fff; }
.ep-cal .ep-c-e { background: #e2e8f0; color: #475569; border: 1px solid #cbd5e1; }
.ep-cal .ep-c-u { background: #fff; border: 1.5px dashed #d97706; color: #b45309; }
.ep-cal .ep-c-h { background: repeating-linear-gradient(135deg, #f1f5f9 0 3px, #fff 3px 6px); }
.ep-cal .ep-c-t { outline: 2px solid var(--ink); outline-offset: 1px; }

.ep-key {
    display: flex;
    gap: 12px;
    font-size: 12px;
    color: var(--ink-2);
    flex-wrap: wrap;
    margin-top: 8px;
}

.ep-key i {
    display: inline-block;
    width: 14px;
    height: 11px;
    border-radius: 3px;
    margin-right: 4px;
    vertical-align: -1px;
}

.ep-heat {
    border-collapse: separate;
    border-spacing: 3px;
    font-size: 12px;
}

.ep-heat th {
    font-weight: 600;
    color: var(--ink-2);
    padding: 0 4px;
}

.ep-heat td {
    width: 44px;
    height: 30px;
    text-align: center;
    border-radius: 5px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

/* ---------- absence request cards ---------- */
.ep-req {
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 14px 16px;
    display: grid;
    gap: 8px;
    background: #fff;
}

.ep-req.ep-pending {
    border-color: #fcd34d;
    box-shadow: 0 0 0 3px rgba(252, 211, 77, 0.18);
}

.ep-req-top {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.ep-req-top b {
    font-size: 15px;
}

.ep-req-top .ep-when {
    margin-left: auto;
    font-size: 12.5px;
    color: var(--ink-3);
}

.ep-req-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
    font-size: 13px;
}

.ep-req-grid small {
    display: block;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--ink-3);
}

.ep-req-note {
    font-size: 13.5px;
    background: #f8fafc;
    border-radius: 8px;
    padding: 8px 10px;
    border-left: 3px solid #cbd5e1;
}

.ep-req-note.ep-req-comment {
    border-left-color: #fca5a5;
}

.ep-req-act {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.ep-att {
    display: inline-flex;
    gap: 6px;
    align-items: center;
    font-size: 12.5px;
    border: 1px solid var(--line);
    border-radius: 7px;
    padding: 3px 8px;
    background: #fff;
}

/* ---------- timeline (contact history) ---------- */
.ep-tl {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 12px;
    position: relative;
}

.ep-tl::before {
    content: "";
    position: absolute;
    left: 16px;
    top: 6px;
    bottom: 6px;
    width: 2px;
    background: #e2e8f0;
}

.ep-tl li {
    display: grid;
    grid-template-columns: 34px 1fr;
    gap: 12px;
    position: relative;
}

.ep-tl .ep-b {
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 10px 12px;
    background: #fff;
}

.ep-tl .ep-tt2 {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.ep-tl .ep-tt2 .ep-when {
    margin-left: auto;
    font-size: 12px;
    color: var(--ink-3);
}

.ep-tl .ep-m {
    font-size: 12px;
    color: var(--ink-3);
    margin-top: 2px;
}

.ep-tl .ep-b p {
    margin: 6px 0 0;
    font-size: 13px;
    white-space: pre-line;
}

/* Band changes are worked out from attendance, not logged by anyone. */
.ep-tl .ep-b.ep-sys {
    background: #f8fafc;
    border-style: dashed;
}

.ep-tl .ep-help {
    margin-top: 6px;
    font-size: 12.5px;
    color: var(--ink-3);
}

.ep-tl .ep-help b {
    color: var(--ink-2);
}

.ep-tl .ep-step {
    margin-top: 6px;
    font-size: 12.5px;
    color: var(--ink-2);
}

/* #79's follow-up form inside a Student page card. */
.entity-page .ep-followup {
    margin-bottom: 14px;
}

/* ---------- loading ---------- */
.ep-skeleton {
    border-radius: 12px;
    background: linear-gradient(90deg, #f1f5f9 0%, #e2e8f0 50%, #f1f5f9 100%);
    background-size: 200% 100%;
    animation: ep-shimmer 1.4s ease-in-out infinite;
    min-height: 120px;
}

@keyframes ep-shimmer {
    from { background-position: 200% 0; }
    to { background-position: -200% 0; }
}

@media (prefers-reduced-motion: reduce) {
    .ep-skeleton { animation: none; }
}

/* ---------- narrow screens ---------- */
@media (max-width: 1100px) {
    .ep-g2,
    .ep-g2e {
        grid-template-columns: 1fr;
    }

    .ep-g4 {
        grid-template-columns: 1fr 1fr;
    }

    .ep-req-grid {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 720px) {
    .ep-crumb,
    .ep-main,
    .ep-body {
        padding-left: 16px;
        padding-right: 16px;
    }

    .ep-tabs {
        padding: 0 12px;
    }

    .ep-now {
        margin: 0 16px 12px;
        flex-direction: column;
    }

    .ep-now-r {
        border-left: 0;
        border-top: 1px solid var(--line);
    }

    .ep-id h1 {
        font-size: 21px;
    }

    .ep-act .ep-btn {
        position: relative;
    }

    .ep-act .ep-btn .ep-lbl {
        position: absolute;
        width: 1px;
        height: 1px;
        padding: 0;
        margin: -1px;
        overflow: hidden;
        clip: rect(0 0 0 0);
        white-space: nowrap;
        border: 0;
    }

    .ep-dl {
        grid-template-columns: 120px 1fr;
    }

    .ep-big {
        font-size: 24px;
    }
}

/* ---------- small charts ---------- */
.ep-cal .ep-c-x { background: #f8fafc; }

.ep-spark {
    flex: none;
    overflow: visible;
}

.ep-wchart {
    display: block;
    max-width: 100%;
    height: auto;
}

/* ---------- Editing: side panels, dialogs, form fields, the bulk bar and the toast ---------- */
.ep-scrim {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.42);
    z-index: 1050;
}

.ep-drawer,
.ep-dlg {
    position: fixed;
    z-index: 1051;
    background: #fff;
    display: flex;
    flex-direction: column;
    color: var(--ink);
    font-size: 14px;
    line-height: 1.45;
}

.ep-drawer {
    top: 0;
    right: 0;
    bottom: 0;
    width: min(600px, 100%);
    box-shadow: -12px 0 40px rgba(15, 23, 42, 0.2);
}

.ep-dlg {
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: min(560px, calc(100% - 32px));
    max-height: calc(100% - 40px);
    border-radius: 14px;
    box-shadow: 0 24px 60px rgba(15, 23, 42, 0.3);
}

.ep-dlg.ep-wide {
    width: min(720px, calc(100% - 32px));
}

.ep-d-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    padding: 18px 22px 12px;
    border-bottom: 1px solid var(--line);
}

.ep-d-head h2 {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
}

.ep-d-head p {
    margin: 3px 0 0;
    font-size: 13px;
    color: var(--ink-2);
}

.ep-x {
    border: 0;
    background: none;
    font-size: 22px;
    color: var(--ink-3);
    line-height: 1;
    cursor: pointer;
}

.ep-d-body {
    padding: 16px 22px;
    overflow-y: auto;
    display: grid;
    gap: 16px;
    flex: 1;
    align-content: start;
}

.ep-d-foot {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    align-items: center;
    padding: 12px 22px;
    border-top: 1px solid var(--line);
    background: #f8fafc;
    flex-wrap: wrap;
}

.ep-dlg .ep-d-foot {
    border-radius: 0 0 14px 14px;
}

.ep-d-foot .ep-lft {
    margin-right: auto;
    font-size: 12.5px;
    color: var(--ink-2);
}

.ep-d-foot .ep-lft.ep-bad {
    color: var(--red);
    font-weight: 600;
}

/* Leaving with unsaved changes asks first. */
.ep-discard {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
    padding: 10px 22px;
    background: var(--amber-bg, #fef3c7);
    border-top: 1px solid #fcd34d;
    font-size: 13px;
}

.ep-discard b {
    margin-right: auto;
}

.ep-fs {
    border: 0;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 10px;
    min-width: 0;
}

/* A section focused by a card's Edit button: focus only scrolls it into view. */
.ep-fs:focus {
    outline: none;
}

.ep-fs legend,
.ep-sec-label {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--ink-3);
    margin: 0 0 6px;
    padding: 0;
}

.ep-fg {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px 12px;
}

.ep-f {
    display: grid;
    /* Rows keep their own height, so a field without a hint lines up with its neighbour that has one. */
    align-content: start;
    gap: 4px;
    font-size: 12.5px;
    color: var(--ink-2);
    font-weight: 600;
    min-width: 0;
    margin: 0;
}

.ep-f.ep-full {
    grid-column: 1 / -1;
}

.ep-f input,
.ep-f select,
.ep-f textarea {
    font: inherit;
    font-size: 13.5px;
    font-weight: 400;
    color: var(--ink);
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    padding: 7px 10px;
    background: #fff;
    width: 100%;
}

.ep-f input[type="checkbox"] {
    width: auto;
}

.ep-f textarea {
    min-height: 68px;
    resize: vertical;
}

.ep-f .ep-hint {
    font-weight: 400;
    color: var(--ink-3);
    font-size: 12px;
}

.ep-f.ep-chg input,
.ep-f.ep-chg select,
.ep-f.ep-chg textarea {
    border-color: #60a5fa;
    background: #f8fbff;
}

.ep-f.ep-chg .ep-hint {
    color: var(--blue);
}

.ep-f.ep-err input,
.ep-f.ep-err select,
.ep-f.ep-err textarea {
    border-color: #dc2626;
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.12);
}

.ep-f.ep-err .ep-hint {
    color: #b91c1c;
}

.ep-check {
    display: flex;
    gap: 8px;
    align-items: flex-start;
    font-size: 13px;
}

.ep-check input {
    margin-top: 3px;
}

.ep-diff {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.ep-diff > div {
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 10px 12px;
    font-size: 13px;
}

.ep-diff ul {
    margin: 6px 0 0;
    padding-left: 18px;
}

.ep-diff .ep-rm li { color: #991b1b; }
.ep-diff .ep-ad li { color: #166534; }

.ep-pick {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.ep-pick button {
    border: 1px solid #cbd5e1;
    background: #fff;
    border-radius: 16px;
    padding: 4px 10px;
    font-size: 12.5px;
    font-weight: 500;
    color: var(--ink-2);
    cursor: pointer;
}

.ep-pick button.ep-on {
    background: #0f172a;
    color: #fff;
    border-color: #0f172a;
}

.ep-btn-ok {
    background: #15803d;
    border-color: #15803d;
    color: #fff !important;
}

.ep-btn-ok:hover {
    background: #166534;
}

.ep-btn-no {
    color: var(--red) !important;
    border-color: #fca5a5;
}

.ep-bulk {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
    padding: 10px 14px;
    margin-bottom: 12px;
    border-radius: 12px;
    background: #0f172a;
    color: #fff;
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.3);
}

.ep-bulk .ep-btn {
    background: #1e293b;
    border-color: #334155;
    color: #fff !important;
}

.ep-bulk .ep-btn:hover {
    background: #334155;
}

.ep-bulk .ep-note {
    margin-left: auto;
    font-size: 12px;
    color: #cbd5e1;
}

.ep-tbl tr.ep-sel td {
    background: var(--blue-bg);
}

.ep-toast {
    position: fixed;
    left: 50%;
    bottom: 22px;
    transform: translateX(-50%);
    background: #0f172a;
    color: #fff;
    padding: 10px 16px;
    border-radius: 10px;
    font-size: 13.5px;
    z-index: 1060;
    display: flex;
    gap: 10px;
    align-items: center;
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.35);
    max-width: calc(100% - 32px);
}

.entity-page .ep-toast button {
    background: none;
    border: 0;
    color: #93c5fd;
    font-weight: 600;
    cursor: pointer;
    padding: 0;
}

@media (max-width: 720px) {
    .ep-fg,
    .ep-diff {
        grid-template-columns: 1fr;
    }
}

.ep-photo-btn {
    border: 0;
    padding: 0;
    background: none;
    border-radius: 14px;
    cursor: pointer;
    line-height: 0;
}

.ep-photo-btn:hover .ep-photo,
.ep-photo-btn:hover .ep-av {
    outline: 3px solid var(--blue-line);
}

/* Insights components shown on the entity pages (trend chart, heatmap, reasons). Insights styles them from
   Insights.razor.css, scoped to the Insights pages, so the shared look is repeated here for .entity-page. */
.entity-page .insights-card { background: var(--surface-primary); border: 1px solid var(--border-default); border-radius: 14px; padding: 1rem 1.15rem; }
.entity-page .insights-section-heading-wrap { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.entity-page .insights-card-title { margin: 0; color: var(--text-primary); font-size: 1.05rem; font-weight: 700; line-height: 1.35; }
.entity-page .insights-card-subtitle { margin: 0.2rem 0 0; color: var(--text-secondary); font-size: 0.78rem; }
.entity-page .insights-chart-callout { color: var(--accent-primary); font-size: 0.78rem; font-weight: 600; }
.entity-page .insights-trend-meta { display: inline-flex; align-items: center; justify-content: flex-end; gap: 0.45rem; flex-wrap: wrap; }
.entity-page .insights-chart-chip { display: inline-flex; align-items: center; min-height: 24px; padding: 0.15rem 0.55rem; border-radius: 999px; background: var(--surface-secondary); color: var(--text-secondary); font-size: 0.72rem; font-weight: 600; }
.entity-page .insights-chart-chip-warning { background: var(--status-warning-bg); color: var(--status-warning-strong); }
.entity-page .insights-trend-chart { margin-top: 0.75rem; }
.entity-page .insights-trend-reading { margin: 0.5rem 0 0; color: var(--text-secondary); font-size: 0.85rem; }
.entity-page .insights-trend-tooltip { display: grid; gap: 0.2rem; color: var(--text-secondary); font-size: 0.8rem; }
.entity-page .insights-trend-tooltip strong { color: var(--text-primary); font-size: 0.78rem; }
.entity-page .insights-chart-skeleton { height: 220px; border-radius: 12px; background: var(--surface-secondary); }
.entity-page .insights-chart-empty { min-height: 180px; display: flex; align-items: center; justify-content: center; flex-direction: column; gap: 0.75rem; color: var(--text-secondary); text-align: center; }
.entity-page .insights-chart-empty-line { width: 100%; height: 2px; background: var(--surface-tertiary); }
.entity-page .insights-inline-link { color: var(--accent-primary-text); font-size: 0.75rem; font-weight: 600; text-decoration: none; }
.entity-page .ep-insights-chart { min-width: 0; }

/* ---------- Student header: More menu, and Contact history's Send something ---------- */
.ep-more {
    position: relative;
}

.ep-menu-scrim {
    position: fixed;
    inset: 0;
    z-index: 1040;
}

.ep-menu {
    position: absolute;
    right: 0;
    top: calc(100% + 6px);
    z-index: 1041;
    min-width: 260px;
    max-width: min(340px, calc(100vw - 32px));
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.14);
    padding: 6px;
    display: grid;
    gap: 2px;
}

.ep-menu a,
.ep-menu button {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    width: 100%;
    text-align: left;
    border: 0;
    background: none;
    border-radius: 8px;
    padding: 8px 10px;
    font: inherit;
    font-size: 13.5px;
    font-weight: 600;
    color: var(--ink) !important;
    text-decoration: none !important;
    cursor: pointer;
}

.ep-menu a:hover,
.ep-menu button:not([disabled]):hover {
    background: #f1f5f9;
}

.ep-menu button[disabled] {
    cursor: not-allowed;
    color: var(--ink-3) !important;
}

.ep-menu i {
    margin-top: 2px;
}

.ep-menu small {
    display: block;
    font-weight: 400;
    font-size: 12px;
    color: var(--ink-3);
    overflow-wrap: anywhere;
}

.ep-send {
    display: grid;
    gap: 8px;
}

.ep-send .ep-btn {
    justify-content: flex-start;
}

.ep-send .ep-btn[disabled] {
    cursor: not-allowed;
    opacity: 0.6;
}

.ep-why {
    font-size: 12px;
    color: var(--ink-3);
    margin-top: -4px;
}

.ep-app-preview {
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #f8fafc;
    padding: 12px 14px;
    font-size: 13.5px;
    overflow-wrap: anywhere;
}

.ep-app-preview p {
    margin: 6px 0 0;
    white-space: pre-line;
}

@media (max-width: 640px) {
    .ep-menu {
        right: auto;
        left: 0;
    }
}

/* Screen-reader tables (the trend chart's data table): a table won't shrink to Bootstrap's 1px
   visually-hidden width, so on a phone it pushed the page sideways. Fixed position keeps it out of
   the page's scroll width; it stays clipped and readable by screen readers. */
.entity-page table.visually-hidden {
    position: fixed !important;
    top: 0;
    left: 0;
}
