/* ============================================================
   Eduegate Parent Portal — Design v03 (Figma: Eduegate Portals)
   Shared design system: layout chrome, cards, buttons, badges.
   Scoped under .eg3-* prefixes so it can coexist with Design_v02.
   ============================================================ */

/* Tokens live in tokens.css (single source of truth) — loaded before this file. */

/* ---------- base ---------- */
/* Always reserve the vertical scrollbar and pin a single page background so
   navigating between full-page routes (My Wards <-> Fee Payment, etc.) doesn't
   flash a different colour or shift horizontally when the scrollbar toggles. */
html {
    overflow-y: scroll;
    background: var(--eg3-bg);
}

body.eg3-body {
    background: var(--eg3-bg) !important;
    font-family: var(--eg3-font);
    color: var(--eg3-fg-1);
    font-size: 16px;
    margin: 0;
    /* Legacy style.css sets body{overflow-x:hidden}, which (per spec) forces
       overflow-y:auto and turns BODY into its own scroll container — producing
       a second inner scrollbar while the html scrollbar sits dead.
       overflow-x:clip clips without creating a scroll container, so the window
       is the single scroller again. */
    overflow-x: clip;
    overflow-y: visible;
}

.eg3-body h1, .eg3-body h2, .eg3-body h3, .eg3-body h4, .eg3-body h5,
.eg3-body p, .eg3-body label, .eg3-body input, .eg3-body select,
.eg3-body textarea, .eg3-body button, .eg3-body table {
    font-family: var(--eg3-font);
}

/* neutralise the legacy .currSign pill (white bg + padding from Content/style.css);
   the QAR tag is drawn by each component's :before chip instead */
.eg3-body .currSign {
    background: transparent !important;
    padding: 0 !important;
    border-radius: 0 !important;
}

.eg3-container {
    /* Content band = inner 10 columns of the Figma 12-col grid (frame 702:338).
       Grid: 32px offset · 140px columns · 16px gutter on a 1920 artboard.
       Content skips the outer column+gutter on each side, so the effective
       side margin is 32 + 140 + 16 = 188px and the band is 10 cols + 9 gutters
       = (10*140) + (9*16) = 1544px. Below that, margins shrink responsively;
       above 1920 the band caps and centers. */
    width: 100%;
    max-width: 1544px;
    margin: 0 auto;
    padding: 0;             /* xxl: 188px margins come from the centered cap */
}

/* Fluid margins once the 1544 band no longer leaves ~64px breathing room */
@media (max-width: 1600px) { .eg3-container { padding: 0 32px; } }   /* xl */
@media (max-width: 1199px) { .eg3-container { padding: 0 24px; } }   /* lg / md */
@media (max-width: 767px)  { .eg3-container { padding: 0 16px; } }   /* sm / xs */

/* ---------- top header (white, 56px) — Figma 702:340 ---------- */
/* Bar: 56px tall (8px top/bottom padding around a 40px chip), 188px side
   padding on the artboard (inherited from .eg3-container), space-between. */
.eg3-header {
    background: var(--eg3-card-rest);
    min-height: 56px;
    display: flex;
    align-items: center;
    padding: 8px 0;
    position: relative;
    z-index: 1100;   /* above the pinned nav (1000) so the profile dropdown isn't covered */
}

.eg3-header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
}

.eg3-logo img {
    height: 35px;
    width: auto;
    display: block;
}

/* user chip — var(--eg3-info-bg) pill, 40px tall (4px pad + 32px avatar), gap 8 */
.eg3-user-chip {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--eg3-info-bg);
    border-radius: 69px;
    padding: 4px 8px 4px 4px;
    cursor: pointer;
    border: none;
    text-align: left;
}

/* avatar — 32px var(--eg3-brand-rest) circle with white initials, Poppins 16px */
.eg3-user-chip .eg3-user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--eg3-brand-rest);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--eg3-fg-on-brand);
    font-size: 15px;
    font-weight: 400;
    line-height: 1;
    overflow: hidden;
    flex-shrink: 0;
}

.eg3-user-chip .eg3-user-avatar img { width: 100%; height: 100%; object-fit: cover; }

.eg3-user-chip .eg3-user-name {
    font-size: 14px;
    font-weight: 400;
    color: var(--eg3-fg-1);
    line-height: 1.15;
    text-transform: uppercase;
    white-space: nowrap;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.eg3-user-chip .eg3-user-email {
    font-size: 12px;
    color: var(--eg3-fg-2);
    line-height: 1.4;
    white-space: nowrap;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.eg3-user-chip .eg3-caret { color: var(--eg3-fg-3); margin-left: 4px; display: inline-flex; }

/* small screens: profile shrinks to the bare avatar (no chip bg, no caret) */
@media (max-width: 767px) {
    .eg3-user-chip {
        background: transparent;
        padding: 0;
        gap: 0;
    }

        .eg3-user-chip .eg3-caret { display: none; }
}

/* ---------- main nav (blue, 56px) — Figma 722:861 ---------- */
/* 24px content (icon/text) + 16px top/bottom padding = 56px tall */
.eg3-nav {
    background: var(--eg3-brand-rest);
    min-height: 56px;
    position: relative;
    z-index: 1000;
}

/* pinned navigation (JS toggles .is-fixed once the brand bar scrolls away;
   position:sticky can't be used — the nav's ancestor wrapper ends at the header
   and legacy body{overflow-x:hidden} breaks viewport stickiness) */
.eg3-nav.is-fixed {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    box-shadow: var(--eg3-shadow);
}

/* keeps the page from jumping when the nav leaves the flow */
.eg3-nav-spacer { display: none; height: 56px; }
.eg3-nav-spacer.on { display: block; }

.eg3-nav-list {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 2px;
    list-style: none;
    margin: 0;
    padding: 0;
    flex-wrap: nowrap;
    width: 100%;
}

.eg3-nav-list > li { flex-shrink: 0; }

.eg3-nav-link {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--eg3-fg-on-brand) !important;
    font-size: 14px;
    font-weight: 400;
    padding: 16px 6px;
    text-decoration: none !important;
    cursor: pointer;
    white-space: nowrap;
    background: transparent;
    border: none;
    line-height: 21px;
    position: relative;
}

/* selected-tab indicator bar (redundant with the accent text colour) */
.eg3-nav-link::after {
    content: "";
    position: absolute;
    left: 6px;
    right: 6px;
    bottom: 0;
    height: 3px;
    border-radius: 3px 3px 0 0;
    background: var(--eg3-accent);
    transform: scaleX(0);
    transform-origin: center;
    transition: transform .18s ease;
}

.eg3-nav-link:hover::after { transform: scaleX(1); background: rgba(255, 255, 255, .45); }
.eg3-nav-link.active::after { transform: scaleX(1); background: var(--eg3-accent); }

.eg3-nav-link svg, .eg3-nav-link img { width: 20px; height: 20px; flex-shrink: 0; }

@media (max-width: 1399px) {
    .eg3-nav-link { font-size: 13px; padding: 16px 4px; }
    .eg3-nav-link svg, .eg3-nav-link img { width: 20px; height: 20px; }
}

@media (max-width: 1199px) {
    /* keep one line: scroll horizontally instead of wrapping */
    .eg3-nav .eg3-container { overflow-x: auto; scrollbar-width: thin; }
    .eg3-nav-list { justify-content: flex-start; gap: 6px; width: max-content; min-width: 100%; }
}

.eg3-nav-link:hover { color: var(--eg3-accent) !important; }

.eg3-nav-link.active { color: var(--eg3-accent) !important; font-weight: 500; }

.eg3-nav-link.active svg path,
.eg3-nav-link.active svg rect,
.eg3-nav-link.active svg circle { stroke: var(--eg3-accent); }

.eg3-nav-link.eg3-white-icon img { filter: brightness(0) invert(1); }
.eg3-nav-link.active img,
.eg3-nav-link:hover img { filter: invert(76%) sepia(75%) saturate(1069%) hue-rotate(1deg) brightness(105%) contrast(104%); }

/* ---------- My Wards nav dropdown (hover on desktop, tap on touch) ---------- */
.eg3-nav-ward { position: relative; }

.eg3-nav-caret {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-left: -4px;
    padding: 2px 0;
    border: none;
    background: transparent;
    color: inherit;
    cursor: pointer;
    border-radius: 4px;
    line-height: 0;
}
.eg3-nav-caret svg { width: 16px; height: 16px; transition: transform .18s ease; }
.eg3-nav-ward.open .eg3-nav-caret svg { transform: rotate(180deg); }

.eg3-nav-submenu {
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 244px;
    background: var(--eg3-card-rest);
    border: 1px solid var(--eg3-border);
    border-radius: 10px;
    box-shadow: var(--eg3-shadow-lg);
    padding: 8px;
    z-index: 1200;
    opacity: 0;
    visibility: hidden;
    transform: translateY(6px);
    transition: opacity .15s ease, transform .15s ease, visibility 0s .18s;
}

/* desktop: open on hover with a short close-delay (hover intent) */
@media (hover: hover) {
    .eg3-nav-ward:hover .eg3-nav-caret svg { transform: rotate(180deg); }
    .eg3-nav-ward:hover .eg3-nav-submenu {
        opacity: 1;
        visibility: visible;
        transform: translateY(0);
        transition: opacity .15s ease, transform .15s ease, visibility 0s 0s;
    }
}

/* touch / keyboard: opened via .open class */
.eg3-nav-ward.open .eg3-nav-submenu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    transition: opacity .15s ease, transform .15s ease, visibility 0s 0s;
}

.eg3-nav-sub-sec {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: var(--eg3-fg-3);
    padding: 8px 12px 4px;
}

.eg3-nav-sub-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border-radius: 8px;
    font-size: 14px;
    color: var(--eg3-fg-1) !important;
    text-decoration: none !important;
    cursor: pointer;
    white-space: nowrap;
}
.eg3-nav-sub-item svg { width: 18px; height: 18px; color: var(--eg3-fg-3); flex-shrink: 0; }
.eg3-nav-sub-item:hover { background: var(--eg3-hover); color: var(--eg3-brand-rest) !important; }
.eg3-nav-sub-item:hover svg { color: var(--eg3-brand-rest); }

/* ---------- profile dropdown (Figma 780:281) ---------- */
/* open on click/tap only — override the theme's global .dropdown:hover open */
.dropdown:hover .eg3-profile-menu:not(.show) { display: none !important; }

.eg3-profile-menu {
    background: var(--eg3-card-rest) !important;   /* don't inherit Bootstrap's fixed white */
    width: 280px !important;
    min-width: 0 !important;
    max-width: calc(100vw - 24px) !important;   /* responsive: never overflow the viewport */
    padding: 0 !important;
    border: 1px solid var(--eg3-border) !important;
    border-radius: 12px !important;
    box-shadow: var(--eg3-shadow-lg) !important;
    overflow: hidden;
    margin-top: 8px !important;
}
.eg3-profile-head {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 20px 16px 16px;
    border-bottom: 1px solid var(--eg3-border);
}
.eg3-profile-avatar {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--eg3-brand-rest);
    color: var(--eg3-fg-on-brand);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 10px;
}
.eg3-profile-name,
.eg3-profile-email { max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.eg3-profile-name { font-family: var(--eg3-font); font-size: 16px; font-weight: 600; color: var(--eg3-fg-1); }
.eg3-profile-email { font-size: 14px; color: var(--eg3-fg-3); }
.eg3-profile-items { padding: 8px; }
.eg3-profile-item {
    display: flex !important;
    align-items: center;
    gap: 12px;
    padding: 10px 12px !important;
    border-radius: 8px;
    font-family: var(--eg3-font);
    font-size: 15px;
    color: var(--eg3-fg-1) !important;
    text-decoration: none !important;
    cursor: pointer;
}
.eg3-profile-item svg { width: 18px; height: 18px; flex: 0 0 auto; color: var(--eg3-fg-3); }
.eg3-profile-item:hover { background: var(--eg3-hover) !important; color: var(--eg3-brand-rest) !important; }
.eg3-profile-item:hover svg { color: var(--eg3-brand-rest); }
.eg3-profile-chev { margin-left: auto; width: 14px !important; height: 14px !important; }
.eg3-profile-mode {
    margin-left: auto;
    font-size: 12px;
    font-weight: 500;
    color: var(--eg3-fg-3);
    background: var(--eg3-card2-hover);
    border-radius: 999px;
    padding: 2px 10px;
}

/* dark-mode support for Bootstrap's bg-light used on page roots */
.eg3-body .bg-light { background-color: var(--eg3-bg) !important; }
.eg3-body .bg-white { background-color: var(--eg3-card-rest) !important; }
/* the legacy page wrapper (Content/style.css) paints fixed white — retheme it */
.eg3-body .wrapper { background: var(--eg3-bg); }
.eg3-profile-sep { height: 1px; background: var(--eg3-border); }
.eg3-profile-item--danger { color: var(--eg3-danger-fg) !important; }
.eg3-profile-item--danger svg { color: var(--eg3-danger-fg); }
.eg3-profile-item--danger:hover { background: var(--eg3-danger-bg) !important; color: var(--eg3-danger-fg) !important; }
.eg3-profile-item--danger:hover svg { color: var(--eg3-danger-fg); }

/* match the Bootstrap nav dropdown (Application) to the My Wards submenu */
.eg3-nav-list .dropdown { position: relative; }
.eg3-nav-list .dropdown-menu {
    position: absolute !important;
    top: 100% !important;
    left: 0 !important;
    right: auto !important;
    transform: none !important;
    min-width: 244px !important;
    background: var(--eg3-card-rest) !important;
    border: 1px solid var(--eg3-border) !important;
    border-radius: 10px !important;
    box-shadow: var(--eg3-shadow-lg) !important;
    padding: 8px !important;
    margin-top: 0 !important;
}
/* remove the theme's caret/pointer on the dropdown panel */
.eg3-nav-list .dropdown-menu::before,
.eg3-nav-list .dropdown-menu::after {
    display: none !important;
    content: none !important;
}
.eg3-nav-list .dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border-radius: 8px;
    font-size: 14px;
    font-family: var(--eg3-font);
    color: var(--eg3-fg-1);
    white-space: nowrap;
}
.eg3-nav-list .dropdown-item:hover,
.eg3-nav-list .dropdown-item:focus,
.eg3-nav-list .dropdown-item.active {
    background: var(--eg3-hover);
    color: var(--eg3-brand-rest);
}

/* nav dropdown */
.eg3-nav .dropdown-menu {
    border-radius: 8px;
    border: 1px solid var(--eg3-border);
    box-shadow: var(--eg3-shadow-lg);
    font-family: var(--eg3-font);
}

.eg3-nav .dropdown-menu .dropdown-item {
    font-size: 15px;
    color: var(--eg3-fg-1);
    padding: 10px 18px;
    cursor: pointer;
}

.eg3-nav .dropdown-menu .dropdown-item:hover { background: var(--eg3-info-bg); color: var(--eg3-brand-rest); }

/* ---------- breadcrumb page-head (Figma 728:2958) ---------- */
/* Figma 787:12 — circular back button inline with the trail; title + subtitle
   below at the full left margin */
.eg3-crumb-head {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 24px;
}

/* row variant: header on the left, an action button on the right */
.eg3-crumb-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 24px;
}

.eg3-crumb-row .eg3-crumb-head { margin-bottom: 0; }

.eg3-crumb-topline {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.eg3-crumb-back {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1px solid var(--eg3-border);
    background: var(--eg3-card-rest);
    color: var(--eg3-fg-1);
    cursor: pointer;
    flex-shrink: 0;
    transition: border-color .15s ease, color .15s ease, background .15s ease;
}

.eg3-crumb-back svg { width: 16px; height: 16px; }

.eg3-crumb-back:hover {
    border-color: var(--eg3-brand-rest);
    color: var(--eg3-brand-rest);
    background: var(--eg3-hover);
}

/* legacy wrapper kept harmless for any straggler markup */
.eg3-crumb-body { display: contents; }

.eg3-crumb-trail { font-family: var(--eg3-font); font-size: 14px; line-height: 1.3; }
.eg3-crumb-parent { color: var(--eg3-fg-3); text-decoration: none; }
.eg3-crumb-parent:hover { color: var(--eg3-brand-rest); }
.eg3-crumb-sep { color: var(--eg3-fg-3); margin: 0 6px; }
.eg3-crumb-current { color: var(--eg3-brand-rest); }

.eg3-crumb-title {
    font-family: var(--eg3-font);
    font-size: 24px;
    font-weight: 400;
    color: var(--eg3-fg-1);
    margin: 0;
}

.eg3-crumb-sub { font-size: 16px; color: var(--eg3-fg-3); margin: 0; }

/* ---------- skeleton loading (token-based, dark-aware) ---------- */
/* Angular hides ng-cloak'd content until compiled; make sure the rule exists
   even before angular.js finishes loading */
[ng-cloak] { display: none !important; }

.eg3-skel {
    position: relative;
    overflow: hidden;
    background: var(--eg3-card2-hover);
    border-radius: 6px;
}

.eg3-skel::after {
    content: "";
    position: absolute;
    inset: 0;
    transform: translateX(-100%);
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .55), transparent);
    animation: eg3-shimmer 1.4s ease-in-out infinite;
}

:root[data-theme="dark"] .eg3-skel::after {
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .07), transparent);
}

@keyframes eg3-shimmer {
    100% { transform: translateX(100%); }
}

/* shape helpers (widths set inline per use) */
.eg3-skel-title  { height: 22px; }
.eg3-skel-text   { height: 14px; }
.eg3-skel-btn    { height: 40px; border-radius: 4px; }
.eg3-skel-tile   { height: 54px; border-radius: 8px; margin-bottom: 14px; }
.eg3-skel-circle { border-radius: 50%; }
.eg3-skel-photo  { border-radius: 8px; }

.eg3-skel-stack > * { margin-bottom: 10px; }
.eg3-skel-stack > *:last-child { margin-bottom: 0; }

/* ghost card used by list-screen skeletons (_SkeletonCards.cshtml) */
.eg3-skel-card {
    background: var(--eg3-card-rest);
    border: 1px solid var(--eg3-border);
    border-radius: 12px;
    padding: 20px;
}

/* these panes render skeletons now — suppress their legacy dark-scrim spinners
   (the scrim would sit on top of the skeleton) */
#AssignmentListOverlay,
#TopicListOverlay,
#LessonPlanListOverlay,
#FormsListOverlay,
#TCListOverlay,
#LeaveListOverlay,
#FeePaymentHistoryOverlay { display: none !important; }

/* ---------- page content ---------- */
.eg3-main {
    min-height: calc(100vh - 86px - 64px - 64px);
    padding: 40px 0;
}

/* big white page panel (inner pages) */
.eg3-panel {
    background: var(--eg3-card-rest);
    border-radius: 12px;
    box-shadow: var(--eg3-shadow);
    padding: 32px;
}

/* bare variant: page head + self-carded content sit directly on --eg3-bg
   (My Wards pattern) instead of inside one big white sheet */
.eg3-panel--bare {
    background: transparent;
    border-radius: 0;
    box-shadow: none;
    padding: 0;
}

.eg3-page-head {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 28px;
}

.eg3-page-head .eg3-page-icon {
    width: 40px;
    height: 40px;
    color: var(--eg3-fg-1);
    flex-shrink: 0;
}

.eg3-page-head h1 {
    font-size: 24px;
    font-weight: 400;
    color: var(--eg3-fg-1);
    margin: 0 0 4px;
}

.eg3-page-head .eg3-page-sub {
    font-size: 16px;
    color: var(--eg3-fg-3);
    margin: 0;
}

/* ---------- cards ---------- */
.eg3-card {
    background: var(--eg3-card-rest);
    border: 1px solid var(--eg3-border);
    border-radius: 8px;
    box-shadow: var(--eg3-shadow);
    padding: 24px;
}

.eg3-card-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 20px;
    font-weight: 400;
    color: var(--eg3-fg-1);
    margin-bottom: 18px;
}

.eg3-card-title svg, .eg3-card-title img { width: 24px; height: 24px; }

/* ---------- buttons ---------- */
.eg3-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-family: var(--eg3-font);
    font-size: 15px;
    font-weight: 500;
    border-radius: 4px;
    padding: 10px 22px;
    border: none;
    cursor: pointer;
    text-decoration: none !important;
    line-height: 1.4;
    transition: filter .15s ease;
}

.eg3-btn:hover { filter: brightness(1.08); }

.eg3-btn-primary { background: var(--eg3-brand-rest); color: var(--eg3-fg-on-brand) !important; }
.eg3-btn-success { background: var(--eg3-success-fg); color: var(--eg3-fg-on-brand) !important; }
.eg3-btn-danger { background: var(--eg3-danger-fg); color: var(--eg3-fg-on-brand) !important; }

.eg3-btn-outline {
    background: var(--eg3-card-rest);
    color: var(--eg3-fg-1) !important;
    border: 1px solid var(--eg3-border);
}

.eg3-btn-block { width: 100%; }

/* =========================================================
   Button component (Figma 776:241)
   Variants: primary | secondary | outline | danger | success
   States:   Rest(default) · Hover(:hover) · Pressed(:active) · :disabled · :focus-visible
   Icon:     put an <svg> or <span class="eg3-btn__icon"> inside; default left,
             add .eg3-btn--icon-right to move it after the label. Icon inherits currentColor.
   Usage:    <button class="eg3-btn eg3-btn--primary"><svg class="eg3-btn__icon">…</svg><span>Label</span></button>
   ========================================================= */
/* Button tokens live in tokens.css (mapped to Brand/Status/Card tokens). */

/* new-component variants reuse .eg3-btn layout but drive colours by state (no brightness filter) */
.eg3-btn[class*="eg3-btn--"] {
    transition: background-color .15s ease, border-color .15s ease, color .15s ease;
}
.eg3-btn[class*="eg3-btn--"]:hover { filter: none; }

.eg3-btn--primary { background: var(--eg3-btn-primary-bg); color: var(--eg3-fg-on-brand) !important; border: none; }
.eg3-btn--primary:hover { background: var(--eg3-btn-primary-hover); }
.eg3-btn--primary:active { background: var(--eg3-btn-primary-active); }

.eg3-btn--danger { background: var(--eg3-btn-danger-bg); color: var(--eg3-fg-on-brand) !important; border: none; }
.eg3-btn--danger:hover { background: var(--eg3-btn-danger-hover); }
.eg3-btn--danger:active { background: var(--eg3-btn-danger-active); }

.eg3-btn--success { background: var(--eg3-btn-success-bg); color: var(--eg3-fg-on-brand) !important; border: none; }
.eg3-btn--success:hover { background: var(--eg3-btn-success-hover); }
.eg3-btn--success:active { background: var(--eg3-btn-success-active); }

.eg3-btn--secondary {
    background: var(--eg3-card-rest);
    color: var(--eg3-btn-secondary-text) !important;
    border: 1px solid var(--eg3-btn-secondary-border);
}
.eg3-btn--secondary:hover { background: var(--eg3-btn-secondary-hover); }
.eg3-btn--secondary:active { background: var(--eg3-btn-secondary-active); }

.eg3-btn--outline {
    background: var(--eg3-card-rest);
    color: var(--eg3-btn-outline-text) !important;
    border: 1px solid var(--eg3-btn-outline-border);
}
.eg3-btn--outline:hover { background: var(--eg3-btn-outline-hover); color: var(--eg3-btn-outline-text-hover) !important; }
.eg3-btn--outline:active { background: var(--eg3-btn-outline-active); color: var(--eg3-btn-outline-text) !important; }

/* selected / toggled-on state (e.g. a Filter button whose panel is open) — mirrors Pressed */
.eg3-btn--primary.is-active { background: var(--eg3-btn-primary-active); }
.eg3-btn--danger.is-active { background: var(--eg3-btn-danger-active); }
.eg3-btn--success.is-active { background: var(--eg3-btn-success-active); }
.eg3-btn--secondary.is-active { background: var(--eg3-btn-secondary-active); }
.eg3-btn--outline.is-active { background: var(--eg3-btn-outline-active); color: var(--eg3-btn-outline-text) !important; }

/* icon */
.eg3-btn__icon { display: inline-flex; align-items: center; width: 18px; height: 18px; flex: 0 0 auto; }
.eg3-btn__icon svg { width: 100%; height: 100%; }
.eg3-btn--icon-right { flex-direction: row-reverse; }

/* optional sizes */
.eg3-btn--sm { padding: 7px 14px; font-size: 14px; }
.eg3-btn--lg { padding: 13px 28px; font-size: 16px; }

/* icon-only square (e.g. attachment download) — same height as the default button */
.eg3-btn--icon-only { padding: 10px; }

/* disabled + focus (accessibility, not in Figma) */
.eg3-btn[class*="eg3-btn--"]:disabled,
.eg3-btn.eg3-btn--disabled { opacity: .5; cursor: not-allowed; pointer-events: none; }
.eg3-btn[class*="eg3-btn--"]:focus-visible { outline: 2px solid var(--eg3-btn-outline-border); outline-offset: 2px; }

/* =========================================================
   SEARCH component (Figma 810:39)
   Spec: 355×44, radius 8, padding 10/6, placeholder 14px fg-3,
         20px magnifier right in fg-1.
   States: rest · hover (:hover) · active (:focus)
   Usage: <div class="eg3-search">
              <input type="text" placeholder="Search" ng-model="…" />
              <svg …magnifier…></svg>
          </div>
   (icon markup order doesn't matter — it's pinned to the right)
   ========================================================= */
.eg3-search {
    position: relative;
    width: 355px;
    max-width: 100%;
}

.eg3-search input {
    width: 100%;
    height: 44px;
    font-family: var(--eg3-font);
    font-size: 14px;
    color: var(--eg3-fg-1);
    background: var(--eg3-card-rest);
    border: 1px solid var(--eg3-search-border-rest);
    border-radius: 8px;
    padding: 6px 40px 6px 10px;
    outline: none;
    transition: border-color .15s ease;
}

.eg3-search input::placeholder { color: var(--eg3-fg-3); }

.eg3-search:hover input { border-color: var(--eg3-search-border-hover); }
.eg3-search input:focus {
    border-color: var(--eg3-search-border-active);
    box-shadow: var(--eg3-focus-ring);
}

.eg3-search svg {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    color: var(--eg3-fg-1);
    pointer-events: none;
}

/* =========================================================
   RESPONSIVE NAV — Figma bar on desktop (>=1200px, untouched).
   Below 1200px (tablet + mobile): the blue bar collapses, a burger
   sits in the sticky white header (left of the logo) and opens the
   blue left drawer (same .eg3-nav-list DOM).
   ========================================================= */
.eg3-hdr-burger,
.eg3-nav-backdrop { display: none; }

body.eg3-nav-lock { overflow: hidden !important; }

@media (max-width: 1199px) {
    /* one sticky header: fixed on top; JS keeps --eg3-hdr-offset = header height.
       !important because the legacy theme declares body { padding: 0 !important } */
    .eg3-header {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        z-index: 1100;
        box-shadow: var(--eg3-shadow-sm);
    }

    body.eg3-body { padding-top: var(--eg3-hdr-offset, 72px) !important; }

    /* the blue bar collapses entirely (the drawer inside it stays reachable) */
    .eg3-nav {
        min-height: 0;
        height: 0;
        padding: 0;
        background: transparent;
        overflow: visible;
        position: static;
        z-index: auto;
    }

    .eg3-nav-spacer { display: none !important; }

    .eg3-nav .eg3-container { overflow: visible; }

    /* burger in the header, before the logo */
    .eg3-hdr-burger {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 44px;
        height: 44px;
        margin-right: 8px;
        background: transparent;
        border: none;
        border-radius: 8px;
        color: var(--eg3-fg-1);
        cursor: pointer;
        flex-shrink: 0;
    }

        .eg3-hdr-burger:hover { background: var(--eg3-hover); color: var(--eg3-brand-rest); }

        .eg3-hdr-burger svg { width: 24px; height: 24px; }

        .eg3-hdr-burger .eg3-burger-close { display: none; }

    body.eg3-nav-lock .eg3-hdr-burger .eg3-burger-open { display: none; }
    body.eg3-nav-lock .eg3-hdr-burger .eg3-burger-close { display: block; }

    /* the item strip becomes a left drawer (same DOM, blue surface) */
    .eg3-nav-list {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        width: 300px;
        max-width: 85vw;
        min-width: 0;
        background: var(--eg3-brand-rest);
        z-index: 1400;
        display: flex;
        flex-direction: column;
        align-items: stretch;
        justify-content: flex-start;
        gap: 2px;
        padding: 16px 14px calc(16px + env(safe-area-inset-bottom));
        overflow-y: auto;
        box-shadow: var(--eg3-shadow-lg);
        transform: translateX(-105%);
        transition: transform .2s ease;
    }

    .eg3-nav.is-open .eg3-nav-list { transform: translateX(0); }

    .eg3-nav-list > li { flex-shrink: 0; width: 100%; }

    .eg3-nav-link {
        padding: 12px 10px;
        border-radius: 8px;
        width: 100%;
    }

        .eg3-nav-link::after { display: none; } /* no underline indicator in drawer */

        .eg3-nav-link:hover { background: rgba(255, 255, 255, .08); }

        .eg3-nav-link.active { background: rgba(255, 255, 255, .12); }

    /* My Wards submenu renders inline inside the drawer */
    .eg3-nav-submenu {
        display: none;
        position: static !important;
        background: transparent !important;
        border: none !important;
        box-shadow: none !important;
        padding: 0 0 6px 14px !important;
        margin: 0 !important;
        min-width: 0 !important;
    }

    .eg3-nav-ward.open .eg3-nav-submenu { display: block; }

    .eg3-nav-sub-sec { color: rgba(255, 255, 255, .55) !important; }

    .eg3-nav-sub-item {
        color: var(--eg3-fg-on-brand) !important;
        border-radius: 8px;
    }

        .eg3-nav-sub-item:hover { background: rgba(255, 255, 255, .08) !important; }

    /* Application dropdown renders inline too */
    .eg3-nav-list .dropdown-menu {
        position: static !important;
        transform: none !important;
        background: transparent !important;
        border: none !important;
        box-shadow: none !important;
        padding: 0 0 6px 14px !important;
        margin: 0 !important;
        min-width: 0 !important;
    }

        .eg3-nav-list .dropdown-menu .dropdown-item {
            color: var(--eg3-fg-on-brand) !important;
            background: transparent;
            border-radius: 8px;
            padding: 10px 12px;
        }

            .eg3-nav-list .dropdown-menu .dropdown-item:hover { background: rgba(255, 255, 255, .08) !important; }

    .eg3-nav-backdrop {
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, .45);
        z-index: 1390;
    }

    .eg3-nav.is-open .eg3-nav-backdrop { display: block; }
}

/* =========================================================
   Logout confirm dialog (profile menu accidental-tap guard)
   ========================================================= */
.eg3-logout-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, .45);
    z-index: 1300;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.eg3-logout-modal {
    width: 400px;
    max-width: 100%;
    background: var(--eg3-card-rest);
    border: 1px solid var(--eg3-border);
    border-radius: 12px;
    box-shadow: var(--eg3-shadow-lg);
    padding: 24px;
    font-family: var(--eg3-font);
}

.eg3-logout-modal h3 {
    font-size: 18px;
    font-weight: 600;
    color: var(--eg3-fg-1);
    margin: 0 0 8px;
}

.eg3-logout-modal p {
    font-size: 14px;
    color: var(--eg3-fg-2);
    margin: 0 0 20px;
}

.eg3-logout-actions {
    display: flex;
    gap: 12px;
}

/* link with play icon (View Profile / View Full Attendance) */
.eg3-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--eg3-success-fg);
    font-size: 16px;
    cursor: pointer;
    text-decoration: none;
}

.eg3-link:hover { text-decoration: underline; color: var(--eg3-success-fg); }
.eg3-link.eg3-link-blue { color: var(--eg3-brand-rest); }

/* ---------- badges ---------- */
.eg3-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 12px;
    font-size: 14px;
    border-radius: 4px;
    font-weight: 400;
}

.eg3-badge-danger-outline {
    color: var(--eg3-danger-fg);
    border: 1px solid var(--eg3-danger-fg);
    background: var(--eg3-card-rest);
}

.eg3-badge-primary { background: var(--eg3-brand-rest); color: var(--eg3-fg-on-brand); }
.eg3-badge-danger { background: var(--eg3-danger-fg); color: var(--eg3-fg-on-brand); }
.eg3-badge-success { background: var(--eg3-success-fg); color: var(--eg3-fg-on-brand); }
.eg3-badge-soft-success { background: var(--eg3-success-bg); color: var(--eg3-success-fg); }
.eg3-badge-soft-danger { background: var(--eg3-danger-bg); color: var(--eg3-danger-fg); }

/* ---------- service / quick-action tiles ---------- */
.eg3-tile {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    width: 100%;
    color: var(--eg3-fg-on-brand) !important;
    font-size: 16px;
    border: none;
    border-radius: 8px;
    padding: 16px 18px;
    cursor: pointer;
    text-decoration: none !important;
    transition: filter .15s ease;
}

.eg3-tile:hover { filter: brightness(1.15); }
.eg3-tile .eg3-tile-label { display: flex; align-items: center; gap: 12px; }
.eg3-tile svg, .eg3-tile img { width: 22px; height: 22px; }

.eg3-tile-assessment { background: var(--eg3-tile-assessment); }
.eg3-tile-notes { background: var(--eg3-tile-notes); }
.eg3-tile-lesson { background: var(--eg3-tile-lesson); }
.eg3-tile-leave { background: var(--eg3-tile-leave); }
.eg3-tile-tc { background: var(--eg3-tile-tc); }
.eg3-tile-teachers { background: var(--eg3-tile-teachers); }
.eg3-tile-forms { background: var(--eg3-tile-forms); }

/* ---------- forms ---------- */
.eg3-field { margin-bottom: 20px; }

.eg3-field > label {
    display: block;
    font-size: 14px;
    color: var(--eg3-fg-3);
    margin-bottom: 6px;
}

.eg3-input, .eg3-select, .eg3-textarea {
    width: 100%;
    font-family: var(--eg3-font);
    font-size: 15px;
    color: var(--eg3-fg-1);
    background: var(--eg3-card-rest);
    border: 1px solid var(--eg3-border);
    border-radius: 4px;
    padding: 10px 14px;
    outline: none;
}

/* custom chevron with comfortable right-side spacing (replaces the cramped native arrow) */
.eg3-select {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    padding-right: 42px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%23616161' viewBox='0 0 16 16'%3E%3Cpath fill-rule='evenodd' d='M1.646 4.646a.5.5 0 0 1 .708 0L8 10.293l5.646-5.647a.5.5 0 0 1 .708.708l-6 6a.5.5 0 0 1-.708 0l-6-6a.5.5 0 0 1 0-.708z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
    background-size: 15px;
}

.eg3-input:focus, .eg3-select:focus, .eg3-textarea:focus {
    border-color: var(--eg3-brand-rest);
    box-shadow: var(--eg3-focus-ring);
}

/* ---------- tables ---------- */
.eg3-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 15px;
}

.eg3-table th {
    background: var(--eg3-brand-rest);
    color: var(--eg3-fg-on-brand);
    font-weight: 500;
    text-align: left;
    padding: 12px 16px;
    white-space: nowrap;
}

.eg3-table th:first-child { border-radius: 8px 0 0 0; }
.eg3-table th:last-child { border-radius: 0 8px 0 0; }

.eg3-table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--eg3-border);
    color: var(--eg3-fg-1);
    vertical-align: middle;
}

.eg3-table tbody tr:hover { background: var(--eg3-card2-rest); }

/* ---------- footer ---------- */
.eg3-footer {
    background: var(--eg3-card-rest);
    min-height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    color: var(--eg3-fg-1);
}

/* ---------- utilities ---------- */
.eg3-grid { display: grid; gap: 24px; }
.eg3-grid-2 { grid-template-columns: repeat(2, 1fr); }
.eg3-grid-3 { grid-template-columns: repeat(3, 1fr); }
.eg3-muted { color: var(--eg3-fg-3); }
.eg3-danger-text { color: var(--eg3-danger-fg); }
.eg3-success-text { color: var(--eg3-success-fg); }
.eg3-primary-text { color: var(--eg3-brand-rest); }
.eg3-fw-500 { font-weight: 500; }
.eg3-fw-600 { font-weight: 600; }

@media (max-width: 1199px) {
    .eg3-grid-3 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 767px) {
    .eg3-grid-2, .eg3-grid-3 { grid-template-columns: 1fr; }
    .eg3-header { min-height: 70px; }
    .eg3-user-chip .eg3-user-email { display: none; }
    .eg3-panel { padding: 20px; }
    .eg3-main { padding: 24px 0; }
}
