/* ===================================================
   esm-parent.css  --  ESM Parent Portal Theme
   Same class names/structure and same core colour
   identity as esm-student.css/esm-theme.css (admin) --
   the whole app uses one blue accent palette, just with
   its own type pairing per portal. A warm coral accent
   (--coral/--coral-soft) is kept as a secondary accent
   for urgency/energy highlights only.
   Change ONLY the :root variables below to retheme
   the parent portal independently from student/admin.
   =================================================== */

/* -- CSS Variables ----------------------------------- */
:root {
    --font-heading: 'Lexend', sans-serif;
    --font-body:    'Inter', sans-serif;
    --text-2xs: 11px;
    --text-xs:  12px;
    --text-sm:  13px;
    --text-base:14px;
    --text-md:  15px;
    --text-lg:  17px;

    /* -- Brand colours -- edit these to retheme --
       Matches admin/student's blue accent identity exactly, with a warm
       coral kept only as a secondary accent for urgency/energy. */
    --bg:            #f5f9ff;
    --surface:       #ffffff;
    --surface-alt:   #eef5fc;
    --panel:         #ffffff;
    --border:        #d7e3f3;
    --divider:       #e3edf8;
    --accent:        #1c4a96;
    --accent-soft:   #e8f3fb;
    --accent-strong: #005a9e;
    --coral:         #f0653e;
    --coral-soft:    #fee4da;
    --text:          #1b1b1b;
    --text-soft:     #4b5664;
    --text-faint:    #6d7b8a;
    --danger:        #d13438;
    --shadow-sm:     0 1px 2px rgba(0,0,0,.06);
    --shadow-md:     0 8px 24px rgba(28,74,150,.12);
    --radius-xs:     4px;
    --radius-sm:     6px;
    --radius-md:     9px;
    --radius-lg:     14px;
}

[data-theme='dark'] {
    --bg:            #0f172a;
    --surface:       #111827;
    --surface-alt:   #172036;
    --panel:         #111827;
    --border:        #22324d;
    --divider:       #1f2d45;
    --accent:        #4aa3ff;
    --accent-soft:   rgba(74,163,255,.15);
    --accent-strong: #8cc8ff;
    --coral:         #ff8a65;
    --coral-soft:    rgba(255,138,101,.15);
    --text:          #eaf2ff;
    --text-soft:     #b6c4d6;
    --text-faint:    #7f90a8;
    --danger:        #ff6b6b;
    --shadow-sm:     0 1px 2px rgba(0,0,0,.35);
    --shadow-md:     0 10px 28px rgba(0,0,0,.42);
    color-scheme: dark;
}

/* -- Reset ------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
img, svg { max-width: 100%; display: block; }
a { text-decoration: none; color: inherit; }

body {
    margin: 0;
    font-family: var(--font-body);
    font-size: var(--text-base);
    line-height: 1.4;
    color: var(--text);
    background: linear-gradient(180deg, #f6fbff 0%, #eef5fc 100%);
    overflow-x: hidden;
}

[data-theme='dark'] body {
    background: linear-gradient(180deg, #0b1220 0, #111827 100%);
}

/* -- App Shell (CSS Grid layout, same shape as student portal) -- */
.app-shell {
    display: grid;
    grid-template-columns: 220px minmax(0,1fr);
    grid-template-rows: 48px 1fr;
    min-height: 100vh;
    transition: grid-template-columns .18s ease;
}
.app-shell.is-collapsed {
    grid-template-columns: 56px minmax(0,1fr);
}
.app-shell > .topbar { grid-column: 1 / -1; grid-row: 1; }
.app-shell > .sidebar { grid-column: 1; grid-row: 2; }
.app-shell > .main    { grid-column: 2; grid-row: 2; }

/* -- Sidebar ------------------------------------------ */
.sidebar {
    position: sticky;
    top: 48px;
    height: calc(100vh - 48px);
    overflow-y: auto;
    overflow-x: hidden;
    background: linear-gradient(180deg, #f8fbff 0%, #edf5fd 100%);
    border-right: 1px solid var(--border);
    padding: 8px 8px 10px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    transition: padding .18s ease;
    z-index: 10020;
}
[data-theme='dark'] .sidebar {
    background: linear-gradient(180deg, #0f172a 0, #111827 100%);
}
.app-shell.is-collapsed .sidebar { padding-inline: 4px; }

.nav-scroll { flex: 1; overflow: hidden; }

/* -- Nav labels --------------------------------------- */
.nav-label {
    margin: 6px 4px 2px;
    font-size: var(--text-2xs);
    letter-spacing: .14em;
    text-transform: uppercase;
    color: var(--text-faint);
}
.app-shell.is-collapsed .nav-label { display: none; }

/* -- Nav list / items --------------------------------- */
.nav-list {
    list-style: none;
    padding: 0; margin: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

svg.nav-icon {
    width: 15px !important; height: 15px !important;
    min-width: 15px !important; max-width: 15px !important;
    flex: 0 0 15px !important;
    display: inline-block; vertical-align: middle;
}

.nav-item a {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 8px;
    border-radius: var(--radius-sm);
    font-size: var(--text-sm);
    color: var(--text-soft);
    text-decoration: none;
    transition: background .12s, color .12s;
    white-space: nowrap;
    overflow: hidden;
}
.nav-item a span { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.nav-item:not(.is-active) a:hover {
    background: rgba(28,74,150,.08);
    color: var(--text);
}
.nav-item.is-active a {
    background: linear-gradient(90deg, rgba(28,74,150,.16), rgba(28,74,150,.05));
    color: var(--accent-strong);
    font-weight: 600;
    border-left: 3px solid var(--accent);
    padding-left: 5px;
}
[data-theme='dark'] .nav-item.is-active a {
    background: linear-gradient(90deg, rgba(74,163,255,.2), rgba(74,163,255,.06));
}

/* Collapsed: hide text labels */
.app-shell.is-collapsed .nav-item a span { display: none; }
.app-shell.is-collapsed .nav-item a {
    justify-content: center;
    padding: 8px 0;
    border-left: none !important;
}
.app-shell.is-collapsed .nav-item.is-active a {
    background: rgba(28,74,150,.15);
    border-radius: var(--radius-sm);
}

/* -- Nav footer --------------------------------------- */
.nav-footer {
    border-top: 1px solid var(--border);
    padding-top: 8px;
    margin-top: auto;
}
.nav-meta {
    font-size: var(--text-2xs);
    color: var(--text-faint);
    padding: 2px 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.app-shell.is-collapsed .nav-footer { display: none; }

/* -- Topbar ------------------------------------------- */
.topbar {
    position: sticky;
    top: 0;
    z-index: 10030;
    height: 48px;
    display: flex;
    align-items: center;
    background: var(--accent);
    box-shadow: 0 1px 4px rgba(0,0,0,.2);
}
[data-theme='dark'] .topbar { background: #001233; }

.top-left {
    display: flex;
    align-items: center;
    height: 100%;
    gap: 0;
    flex-shrink: 0;
}

/* Hamburger */
.az-hamburger {
    width: 44px; height: 48px;
    border: none; background: transparent;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    color: rgba(255,255,255,.85);
    flex-shrink: 0;
}
.az-hamburger:hover { background: rgba(255,255,255,.12); color: #fff; }
.az-hamburger svg { width: 18px; height: 18px; }

/* Logo */
.az-logo {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 0 14px 0 4px;
    color: #fff;
    font-family: var(--font-heading);
    font-size: 13px;
    font-weight: 700;
    letter-spacing: .02em;
    white-space: nowrap;
    height: 100%;
    text-decoration: none;
}
.az-logo svg { flex-shrink: 0; }

.top-middle { flex: 1; display: flex; align-items: center; gap: 12px; min-width: 0; overflow: hidden; }
.top-greeting {
    font-family: var(--font-heading);
    font-size: 13px;
    font-weight: 600;
    color: rgba(255,255,255,.95);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex-shrink: 1;
    min-width: 40px;
}
.top-greeting-date {
    margin-left: 8px;
    font-family: var(--font-body);
    font-size: 11px;
    font-weight: 400;
    color: rgba(255,255,255,.65);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}

/* -- Child selector (parent-only) --------------------
   Sits in the topbar next to the greeting, lets a parent with multiple
   children switch which child's data every page shows. Styled as a
   compact select matching the topbar's dark accent background rather
   than the light form-control styling in esm-parent-forms.css. */
.child-select-wrap {
    flex-shrink: 0;
    display: flex;
    align-items: center;
}
#ddStudents {
    background: rgba(255,255,255,.14);
    color: #fff;
    border: 1px solid rgba(255,255,255,.28);
    border-radius: var(--radius-sm);
    font-family: var(--font-body);
    font-size: var(--text-xs);
    font-weight: 600;
    padding: 5px 26px 5px 10px;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23ffffff' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
    background-size: 12px;
    max-width: 160px;
    text-overflow: ellipsis;
}
#ddStudents:hover { background-color: rgba(255,255,255,.22); }
#ddStudents:focus { outline: none; box-shadow: 0 0 0 2px rgba(255,255,255,.35); }
#ddStudents option { color: #1b1b1b; }

@media (max-width: 480px) {
    .top-greeting-date { display: none; }
    .az-logo-text { display: none; }
    .icon-btn { width: 32px; }
    #ddStudents { max-width: 96px; }
}

.top-right {
    display: flex;
    align-items: center;
    height: 100%;
    flex-shrink: 0;
}

/* Topbar icon button */
.icon-btn {
    width: 40px; height: 48px;
    border: none; background: transparent;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    color: rgba(255,255,255,.85);
    position: relative;
    flex-shrink: 0;
}
.icon-btn:hover { background: rgba(255,255,255,.12); color: #fff; }
.icon-btn svg { width: 16px; height: 16px; }

/* -- Topbar popup panels ------------------------------ */
.topbar-feedback-wrap { position: relative; }

.feedback-badge {
    position: absolute;
    top: 7px; right: 6px;
    min-width: 14px; height: 14px;
    padding: 0 3px;
    border-radius: 999px;
    background: #ff6b35;
    color: #fff;
    font-size: 9px;
    font-weight: 700;
    line-height: 14px;
    text-align: center;
}

.feedback-panel {
    position: absolute;
    right: 0; top: calc(100% + 6px);
    width: 280px;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: 0 14px 34px rgba(0,0,0,.22), 0 2px 8px rgba(0,0,0,.10);
    padding: 4px;
    display: none;
    z-index: 9999;
}
[dir="rtl"] .feedback-panel {
    right: auto;
    left: 0;
}
[data-theme='dark'] .feedback-panel {
    background: var(--surface-alt);
    border-color: rgba(255,255,255,.14);
    box-shadow: 0 16px 40px rgba(0,0,0,.6), 0 0 0 1px rgba(255,255,255,.05);
}
.topbar-feedback-wrap.is-open .feedback-panel { display: block; }

.feedback-panel-head {
    display: flex; align-items: center; justify-content: space-between;
    gap: 8px;
    font-size: 10px; font-weight: 700; color: var(--text-faint);
    text-transform: uppercase; letter-spacing: .05em;
    padding: 6px 8px 5px;
    border-bottom: 1px solid var(--divider);
}
.feedback-panel-head a {
    font-size: var(--text-2xs); text-transform: none;
    letter-spacing: 0; font-weight: 600;
    color: var(--accent);
}
.feedback-panel-head a:hover { text-decoration: underline; }

.feedback-list {
    display: flex; flex-direction: column;
    max-height: 260px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
}

/* -- User chip / menu --------------------------------- */
.user-chip {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 12px;
    height: 48px;
    cursor: pointer;
    color: #fff;
    position: relative;
    white-space: nowrap;
    border-left: 1px solid rgba(255,255,255,.18);
    margin-left: 2px;
}
.user-chip:hover { background: rgba(255,255,255,.1); }

.user-avatar {
    width: 28px; height: 28px;
    border-radius: 50%;
    background: rgba(255,255,255,.22);
    display: grid;
    place-items: center;
    font-family: var(--font-heading);
    font-size: 11px;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
    border: 1.5px solid rgba(255,255,255,.4);
}

.user-name {
    font-size: var(--text-xs);
    color: rgba(255,255,255,.9);
    max-width: 110px;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* User dropdown panel */
.admin-menu-panel {
    position: absolute;
    right: 0; top: calc(100% + 6px);
    width: 180px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    padding: 4px;
    display: none;
    z-index: 9999;
}
.user-chip.is-open .admin-menu-panel { display: block; }

.admin-menu-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 10px;
    font-size: var(--text-sm);
    color: var(--text-soft);
    border-radius: var(--radius-sm);
    text-decoration: none;
    transition: background .1s, color .1s;
}
.admin-menu-item:hover { background: var(--surface-alt); color: var(--text); }
.admin-menu-item svg { width: 13px; height: 13px; flex-shrink: 0; }
.admin-menu-divider { border: none; border-top: 1px solid var(--divider); margin: 3px 0; }

/* -- Main content area -------------------------------- */
.main {
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.content-scroll {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
}

/* Footer */
.st-footer {
    text-align: center;
    padding: 12px 20px;
    font-size: var(--text-xs);
    color: var(--text-faint);
    border-top: 1px solid var(--divider);
    background: var(--surface);
}
.st-footer a { color: var(--accent); }

/* -- Responsive --------------------------------------- */
@media (max-width: 900px) {
    .app-shell.is-collapsed {
        grid-template-columns: 0 minmax(0,1fr);
    }
    .app-shell.force-open {
        grid-template-columns: 220px minmax(0,1fr);
    }
    .app-shell.force-open > .sidebar {
        position: fixed;
        left: 0; top: 48px;
        width: 220px;
        z-index: 10025;
        box-shadow: 4px 0 20px rgba(0,0,0,.18);
    }
    .app-shell.force-open::before {
        content: '';
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,.3);
        z-index: 10024;
    }
    .user-name { display: none; }
    .top-middle { gap: 6px; }
}

/* -- Panels ------------------------------------------- */
.panel {
    background: var(--panel);
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    padding: 8px 9px;
}

[data-theme='dark'] .panel { background: var(--surface); border-color: var(--border); }

.panel-success {
    background: #f0fdf4; border: 1px solid #86efac;
    border-radius: var(--radius-sm); color: #166534;
    padding: 10px 14px; font-size: var(--text-sm); margin-bottom: 14px;
}
.panel-danger {
    background: #fef2f2; border: 1px solid #fca5a5;
    border-radius: var(--radius-sm); color: #991b1b;
    padding: 10px 14px; font-size: var(--text-sm); margin-bottom: 14px;
}
.panel-info {
    background: var(--accent-soft); border: 1px solid rgba(28,74,150,.25);
    border-radius: var(--radius-sm); color: var(--accent-strong);
    padding: 10px 14px; font-size: var(--text-sm); margin-bottom: 14px;
}
.panel-warning {
    background: #fffbeb; border: 1px solid #fcd34d;
    border-radius: var(--radius-sm); color: #92400e;
    padding: 10px 14px; font-size: var(--text-sm); margin-bottom: 14px;
}
.panel-danger:empty,.panel-info:empty,
.panel-warning:empty,.panel-success:empty { display: none !important; }

[data-theme='dark'] .panel-danger  { background: rgba(239,68,68,.12); border-color: rgba(239,68,68,.3);  color: #f87171; }
[data-theme='dark'] .panel-info    { background: rgba(74,163,255,.1);  border-color: rgba(74,163,255,.2); color: var(--accent); }
[data-theme='dark'] .panel-warning { background: rgba(245,158,11,.12); border-color: rgba(245,158,11,.3); color: #fbbf24; }

/* -- Tables ------------------------------------------- */
.table-wrap {
    margin-top: 6px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--divider);
    overflow: hidden;
    background: var(--surface);
}

[data-theme='dark'] .table-wrap { background: var(--surface); border-color: var(--border); }

table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--text-xs);
}

thead { background: var(--surface-alt); }

th, td {
    padding: 8px 10px;
    border-bottom: 1px solid var(--divider);
    text-align: left;
}

th {
    font-weight: 600;
    color: var(--text-soft);
    font-size: var(--text-2xs);
    text-transform: uppercase;
    letter-spacing: .08em;
    white-space: nowrap;
}

tbody tr:hover { background: rgba(28,74,150,.05); }
tbody tr:last-child td { border-bottom: none; }

[data-theme='dark'] th, [data-theme='dark'] td { border-color: var(--divider); color: var(--text); }

/* -- Legacy layout helper classes ---------------------
   .box / .har / .hide / .maxtable are referenced across the pre-rebuild
   parent pages that haven't been converted to the .panel/.table-wrap
   convention yet during the mechanical rollout -- re-declared here,
   theme-aware, so anything still using them keeps a sane appearance
   instead of unstyled content. */
.box {
    border: 1px solid var(--divider);
    background: var(--surface);
    padding: 10px;
    border-radius: var(--radius-sm);
}

.har {
    text-align: right;
}

.hide {
    display: none;
}

.maxtable {
    width: 100%;
    border-collapse: collapse;
}

/* -- Status pills ------------------------------------- */
.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: var(--text-2xs);
    border: 1px solid var(--divider);
    color: var(--text-soft);
}

/* -- Sidebar tooltips (collapsed state) --------------- */
.nav-tooltip {
    position: fixed;
    background: #1e293b;
    color: #f1f5f9;
    font-size: 11px;
    font-weight: 500;
    padding: 5px 10px;
    border-radius: 5px;
    white-space: nowrap;
    pointer-events: none;
    z-index: 99999;
    opacity: 0;
    transform: translateX(-4px);
    transition: opacity .12s ease, transform .12s ease;
    box-shadow: 0 4px 12px rgba(0,0,0,.25);
}
.nav-tooltip::before {
    content: '';
    position: absolute;
    left: -4px;
    top: 50%;
    transform: translateY(-50%);
    border: 4px solid transparent;
    border-right-color: #1e293b;
    border-left: none;
}
.nav-tooltip.is-visible {
    opacity: 1;
    transform: translateX(0);
}
[data-theme='dark'] .nav-tooltip { background: #334155; }
[data-theme='dark'] .nav-tooltip::before { border-right-color: #334155; }

/* -- Admin-style page layout --------------------------- */
/* Was capped at max-width:1400px unconditionally, so on any laptop/desktop
   viewport wide enough that the sidebar+main area exceeds that (common once
   the sidebar collapses to its 56px icon rail), the page content stopped
   growing while .main kept its full width -- leaving a dead strip of bare
   background down the right edge instead of the content actually filling
   the space. Just fill .main's width; individual grids (kpi-row, dash-grid,
   etc.) already use their own responsive column tracks, so there's no need
   for an outer cap here. */
.page-wrap { padding: 16px 18px 28px; }

.page-header {
    display: flex; align-items: center; gap: 12px;
    margin-bottom: 18px; flex-wrap: wrap;
}
.page-icon {
    width: 38px; height: 38px;
    border-radius: var(--radius-sm);
    background: var(--accent-soft);
    display: grid; place-items: center;
    color: var(--accent); flex-shrink: 0;
}
.page-icon svg { width: 18px; height: 18px; }
.page-title { margin: 0; font-family: var(--font-heading); font-size: 19px; font-weight: 700; color: var(--text); }
.page-sub { margin: 2px 0 0; font-size: var(--text-xs); color: var(--text-faint); }
.page-actions { margin-left: auto; display: flex; gap: 8px; align-items: center; }

/* -- Notice / dropdown list items ---------------------
   Ported from esm-student.css -- was entirely missing here, so the
   topbar Alerts/Notices/Updates/Messages popups rendered as bare
   unstyled <li>/<a> lists instead of matching the student portal. */
.dlist { list-style: none; padding: 0; margin: 0; }
.dlist li { border-bottom: 1px solid var(--divider); }
.dlist li:last-child { border-bottom: none; }
.dlist a {
    display: block;
    padding: 8px 14px;
    font-size: var(--text-xs);
    color: var(--text-soft);
    transition: background .1s;
}
.dlist a:hover { background: var(--surface-alt); color: var(--text); }
.dlist span { font-size: 10px; color: var(--text-faint); display: block; margin-top: 1px; }
.dlist a.unread { color: var(--text); font-weight: 700; position: relative; padding-left: 22px; }
.dlist a.unread::before { content: ""; position: absolute; left: 10px; top: 15px; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }

/* -- My Courses cards (dashboard) ----------------------
   Card-grid layout: each course gets its own tile with a
   subject-colored progress ring for the current grade,
   course name + teacher, and a footer row with an
   attendance pill (reuses the .grade-badge/g-hi/g-ok/
   g-warn/g-low/g-na classes + banding) and a schedule
   icon-button link. cc-blue/green/amber/purple/coral cycle
   the same accent families already used by the KPI cards.
   Ported from esm-student.css. */
.course-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 12px;
    padding: 14px;
}
.course-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}
.course-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
    border-color: var(--ring-color, var(--accent));
}
.course-card-head { display: flex; align-items: center; gap: 12px; }

.course-ring {
    --pct: 0;
    position: relative;
    width: 52px; height: 52px;
    border-radius: 50%;
    flex-shrink: 0;
    display: grid; place-items: center;
    background: conic-gradient(var(--ring-color, var(--accent)) calc(var(--pct) * 1%), var(--divider) 0);
}
.course-ring::before {
    content: '';
    position: absolute; inset: 5px;
    border-radius: 50%;
    background: var(--surface);
}
.course-ring span {
    position: relative;
    font-family: var(--font-heading);
    font-size: 12px;
    font-weight: 700;
    color: var(--text);
}

.course-card-info { min-width: 0; }
.course-card-info .course-name {
    font-size: var(--text-sm);
    font-weight: 700;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.course-card-info .course-teacher {
    font-size: var(--text-2xs);
    color: var(--text-faint);
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.course-card-meta {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: var(--text-2xs);
    color: var(--text-soft);
}
.course-meta-row { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.course-meta-label {
    display: inline-block;
    min-width: 58px;
    font-weight: 600;
    color: var(--text-faint);
    text-transform: uppercase;
    letter-spacing: .04em;
    font-size: 9px;
    margin-right: 4px;
}
.course-meta-test .course-meta-label { color: var(--accent-strong); }
.course-meta-exam .course-meta-label { color: var(--coral); }

.course-card-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    border-top: 1px solid var(--divider);
    padding-top: 10px;
}
.course-sched-btn {
    display: grid;
    place-items: center;
    width: 28px;
    height: 28px;
    border-radius: var(--radius-sm);
    background: var(--accent-soft);
    flex-shrink: 0;
    transition: background .12s;
}
.course-sched-btn:hover { background: var(--divider); }
.course-sched-btn img { width: 14px; height: 14px; }

.course-card.cc-blue   { --ring-color: var(--accent-strong); }
.course-card.cc-green  { --ring-color: #059669; }
.course-card.cc-amber  { --ring-color: #d97706; }
.course-card.cc-purple { --ring-color: #7c3aed; }
.course-card.cc-coral  { --ring-color: var(--coral); }

/* -- Global print safety net --------------------------
   Same fix applied to esm-theme.css (admin) and esm-student.css --
   mirrored here because the parent portal's new CSS-Grid app-shell
   reintroduces the exact same risk those fixes address: .content-scroll
   is a flexed, overflow-y:auto pane clipped to viewport height, so
   without this reset a printed page only captures the on-screen scroll
   position of the content instead of the whole thing. */
@media print {
    .app-shell {
        display: block !important;
        min-height: 0 !important;
    }

    .sidebar,
    .topbar {
        display: none !important;
    }

    .main {
        display: block !important;
    }

    .content-scroll {
        overflow: visible !important;
        height: auto !important;
        max-height: none !important;
        padding: 0 !important;
    }

    :root, [data-theme='dark'] {
        --bg: #ffffff !important;
        --surface: #ffffff !important;
        --surface-alt: #f5f7fa !important;
        --panel: #ffffff !important;
        --border: #d0d5dd !important;
        --divider: #e4e7ec !important;
        --text: #101828 !important;
        --text-soft: #344054 !important;
        --text-faint: #667085 !important;
        --shadow-sm: none !important;
        --shadow-md: none !important;
    }
    body { background: #ffffff !important; }

    .grade-badge, .gt-badge-yes, .gt-badge-no,
    td.cal-p, td.cal-a, td.cal-h, td.cal-t, td.cal-l, td.cal-e,
    .cal-p-chip, .cal-a-chip, .p-chip, .a-chip, .h-chip, .t-chip, .l-chip, .e-chip {
        print-color-adjust: exact !important;
        -webkit-print-color-adjust: exact !important;
    }

    .btn, button, .page-actions, .nav-footer {
        box-shadow: none !important;
    }
}

/* -- Mobile card-reflow for data tables ---------------
   Same mechanism as esm-student.css -- see esm-parent-shell.js's
   enableMobileTableCards(). Runs on every table.table/.rc-table/etc
   found on any parent page automatically, no per-page markup changes
   needed. !important is deliberate: several pre-rebuild parent pages
   still carry their own inline <style> table rules that could otherwise
   win the cascade depending on markup order. */
@media (max-width: 640px) {
    table.mobile-cards-ready tr.mobile-card-header-row {
        display: none !important;
    }
    table.mobile-cards-ready,
    table.mobile-cards-ready tr,
    table.mobile-cards-ready td {
        display: block !important;
        width: 100% !important;
    }
    table.mobile-cards-ready tr:not(.mobile-card-header-row) {
        padding: 10px 12px !important;
        border-bottom: 1px solid var(--divider);
    }
    table.mobile-cards-ready tr:not(.mobile-card-header-row):last-child {
        border-bottom: none;
    }
    table.mobile-cards-ready td {
        display: flex !important;
        justify-content: space-between;
        align-items: center;
        gap: 10px;
        text-align: right !important;
        border-bottom: none !important;
        padding: 4px 0 !important;
    }
    table.mobile-cards-ready td[data-label]::before {
        content: attr(data-label);
        font-weight: 600;
        color: var(--text-faint);
        font-size: var(--text-2xs);
        text-transform: uppercase;
        letter-spacing: .04em;
        text-align: left;
        flex-shrink: 0;
    }

    table.mobile-cards-ready tr.mobile-card-pager-row > td {
        display: block !important;
        text-align: left !important;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    table.mobile-cards-ready tr.mobile-card-pager-row td tr {
        display: table-row !important;
    }
    table.mobile-cards-ready tr.mobile-card-pager-row td td {
        display: table-cell !important;
        width: auto !important;
        text-align: center !important;
        padding: 4px 8px !important;
    }

    .feedback-panel {
        position: fixed;
        top: 52px;
        left: 12px;
        right: 12px;
        width: auto;
        max-height: calc(100vh - 72px);
        overflow-y: auto;
    }

    .topbar-feedback-wrap.is-open::before {
        content: '';
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,.35);
        z-index: 9998;
    }

    .child-select-wrap { display: none; }
}

/* -- RTL (Arabic) ---------------------------------------
   Additive [dir="rtl"] overrides -- inert until the multilingual phase
   sets dir="<%=langdir%>" on <html>, kept in sync with esm-student.css
   from day one so that phase is a mechanical port, not new design work. */

[dir="rtl"] .sidebar {
    border-right: none;
    border-left: 1px solid var(--border);
}
[dir="rtl"] .nav-item.is-active a {
    border-left: none;
    border-right: 3px solid var(--accent);
    padding-left: 0;
    padding-right: 5px;
}
[dir="rtl"] .top-greeting-date {
    margin-left: 0;
    margin-right: 8px;
}
[dir="rtl"] .user-chip {
    border-left: none;
    border-right: 1px solid rgba(255,255,255,.18);
    margin-left: 0;
    margin-right: 2px;
}
[dir="rtl"] .page-actions {
    margin-left: 0;
    margin-right: auto;
}
[dir="rtl"] th, [dir="rtl"] td {
    text-align: right;
}
[dir="rtl"] .nav-tooltip::before {
    left: auto;
    right: -4px;
    border-right-color: transparent;
    border-left-color: #1e293b;
}
[data-theme='dark'][dir="rtl"] .nav-tooltip::before {
    border-left-color: #334155;
}

@media (max-width: 900px) {
    [dir="rtl"] .app-shell.force-open > .sidebar {
        left: auto;
        right: 0;
        box-shadow: -4px 0 20px rgba(0,0,0,.18);
    }
}

@media (max-width: 640px) {
    [dir="rtl"] table.mobile-cards-ready td {
        text-align: left !important;
    }
    [dir="rtl"] table.mobile-cards-ready td[data-label]::before {
        text-align: right;
    }
}
