/* =========================================================================
   EaseSchool — Teams-style shell
   Layout: 48px header · 68px app rail · 280px side panel · content
   ========================================================================= */
:root {
    --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans", sans-serif;
    --font-mono: 'JetBrains Mono', monospace;

    /* EaseBill Dark Navy Theme Tokens */
    --bg-main: #0B1120;
    --bg-surface: #131E35;
    --bg-card: #18233C;
    --bg-card-hover: #1E2D4C;
    --bg-sidebar: #0B1120;
    --bg-panel: #131B2E;
    --bg-topbar: #0F1A30;

    --border-color: rgba(255, 255, 255, 0.08);
    --border-color-focus: rgba(59, 130, 246, 0.5);

    --text-primary: #F8FAFC;
    --text-secondary: #94A3B8;
    --text-muted: #64748B;

    --primary: #3B82F6;
    --primary-hover: #2563EB;
    --primary-glow: rgba(59, 130, 246, 0.25);

    --success: #10B981;
    --success-hover: #059669;
    --success-bg: rgba(16, 185, 129, 0.12);

    --warning: #F59E0B;
    --warning-bg: rgba(245, 158, 11, 0.12);

    --danger: #EF4444;
    --danger-hover: #DC2626;
    --danger-bg: rgba(239, 68, 68, 0.12);

    --info: #06B6D4;
    --info-bg: rgba(6, 182, 212, 0.12);

    --purple: #8B5CF6;
    --purple-bg: rgba(139, 92, 246, 0.12);

    --tm-rail-w: 76px;
    --tm-panel-w: 260px;
    --topbar-height: 64px;
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --shadow-card: 0 4px 20px -2px rgba(0, 0, 0, 0.35);
    --shadow-glow: 0 0 25px rgba(59, 130, 246, 0.15);

    /* EaseSchool Shell tokens mapping */
    --es-brand: #3b82f6;
    --es-brand-hover: #2563eb;
    --es-brand-soft: rgba(59, 130, 246, 0.15);
    --es-header-bg: #0F1A30;
    --es-header-fg: #F8FAFC;
    --es-header-input: rgba(255, 255, 255, .1);
    --es-rail-bg: #0B1120;
    --es-rail-fg: #94A3B8;
    --es-rail-hover: rgba(255, 255, 255, 0.08);
    --es-panel-bg: #131B2E;
    --es-panel-hover: #18233C;
    --es-main-bg: #0B1120;
    --es-card-bg: #18233C;
    --es-border: rgba(255, 255, 255, 0.08);
    --es-text: #F8FAFC;
    --es-muted: #94A3B8;
    --es-shadow: 0 4px 20px -2px rgba(0,0,0,.35);
    --es-radius: 10px;
    --es-header-h: 64px;
    --es-rail-w: 76px;
    --es-panel-w: 260px;
    --es-bottom-h: 60px;
    --bs-primary: #3b82f6;
    --bs-primary-rgb: 59, 130, 246;
    --bs-link-color: #3b82f6;
    --bs-link-color-rgb: 59, 130, 246;
    --bs-link-hover-color: #60a5fa;
    --bs-body-bg: #0B1120;
    --bs-body-color: #F8FAFC;
    --bs-card-bg: #18233C;
    --bs-card-border-color: rgba(255, 255, 255, 0.08);
    --bs-card-color: #F8FAFC;
    --bs-border-color: rgba(255, 255, 255, 0.08);
    --bs-font-sans-serif: var(--font-sans);
    --bs-body-font-size: .92rem;
}
[data-bs-theme="dark"], [data-theme="dark"], body.theme-dark-navy {
    --es-brand: #3b82f6;
    --es-brand-hover: #2563eb;
    --es-brand-soft: rgba(59, 130, 246, 0.18);
    --es-header-bg: #0F1A30;
    --es-header-input: rgba(255, 255, 255, .1);
    --es-rail-bg: #0B1120;
    --es-rail-fg: #94A3B8;
    --es-rail-hover: rgba(255, 255, 255, 0.08);
    --es-panel-bg: #131B2E;
    --es-panel-hover: #18233C;
    --es-main-bg: #0B1120;
    --es-card-bg: #18233C;
    --es-border: rgba(255, 255, 255, 0.08);
    --es-text: #F8FAFC;
    --es-muted: #94A3B8;
    --es-shadow: 0 4px 20px -2px rgba(0,0,0,.35);
    --bs-body-bg: #0B1120;
    --bs-link-color: #3b82f6;
    --bs-link-color-rgb: 59, 130, 246;
    --bs-link-hover-color: #60a5fa;
    --bs-card-bg: #18233C;
    --bs-card-border-color: rgba(255, 255, 255, 0.08);
}

html, body { height: 100%; }
body { font-family: var(--bs-font-sans-serif); color: var(--es-text); background: var(--es-main-bg); }
.min-w-0 { min-width: 0; }
.es-prewrap { white-space: pre-wrap; }
.es-skip { position: absolute; z-index: 2000; left: 8px; top: 8px; background: #fff; padding: 6px 10px; border-radius: 4px; }

/* Buttons in brand colour */
.btn-primary, .es-btn.btn-primary {
    --bs-btn-bg: var(--es-brand); --bs-btn-border-color: var(--es-brand);
    --bs-btn-hover-bg: var(--es-brand-hover); --bs-btn-hover-border-color: var(--es-brand-hover);
    --bs-btn-active-bg: var(--es-brand-hover); --bs-btn-active-border-color: var(--es-brand-hover);
    --bs-btn-disabled-bg: var(--es-brand); --bs-btn-disabled-border-color: var(--es-brand);
    font-weight: 600;
}
.btn-outline-primary { --bs-btn-color: var(--es-brand); --bs-btn-border-color: var(--es-brand); --bs-btn-hover-bg: var(--es-brand); --bs-btn-hover-border-color: var(--es-brand); }
.form-control:focus, .form-select:focus { border-color: var(--es-brand); box-shadow: 0 0 0 .2rem rgba(91,95,199,.2); }
.form-check-input:checked { background-color: var(--es-brand); border-color: var(--es-brand); }
.text-bg-primary { background-color: var(--es-brand) !important; }

/* ---------- Brand mark ---------- */
.es-brand-mark {
    display: inline-flex; align-items: center; justify-content: center;
    width: 28px; height: 28px; border-radius: 6px; font-weight: 700; color: #fff;
    background: linear-gradient(135deg, #7b83eb 0%, #5b5fc7 60%, #444791 100%);
}
.es-brand-mark.xl { width: 64px; height: 64px; font-size: 2rem; border-radius: 14px; }

/* ================= HEADER ================= */
.es-header {
    position: fixed; inset: 0 0 auto 0; height: var(--es-header-h); z-index: 1040;
    display: flex; align-items: center; gap: 12px; padding: 0 8px;
    background: var(--es-header-bg); color: var(--es-header-fg);
}
.es-header-left, .es-header-right { display: flex; align-items: center; gap: 4px; }
.es-header-left { min-width: 0; flex: 0 0 auto; }
.es-header-right { margin-left: auto; flex: 0 0 auto; }
.es-brand { display: flex; align-items: center; gap: 8px; color: inherit; text-decoration: none; padding: 0 6px; }
.es-brand-name { font-weight: 600; font-size: .95rem; }
.es-brand-tag { font-size: .7rem; background: rgba(255,255,255,.2); padding: 1px 6px; border-radius: 10px; }
.es-icon-btn {
    display: inline-flex; align-items: center; justify-content: center;
    width: 36px; height: 36px; border: 0; border-radius: 6px; background: transparent; color: inherit;
    font-size: 1.15rem; text-decoration: none;
}
.es-icon-btn:hover, .es-icon-btn:focus-visible { background: rgba(255,255,255,.14); color: inherit; }
.es-panel .es-icon-btn:hover { background: var(--es-panel-hover); }
.es-lang { font-size: .85rem; font-weight: 600; }
.es-badge {
    position: absolute; top: 3px; right: 2px; min-width: 16px; height: 16px; padding: 0 4px;
    border-radius: 8px; background: #c4314b; color: #fff; font-size: .65rem; font-weight: 700; line-height: 16px; text-align: center;
}
.es-header-search {
    position: relative; flex: 1 1 auto; max-width: 560px; margin: 0 auto;
    display: flex; align-items: center; gap: 8px; height: 32px; padding: 0 10px;
    background: var(--es-header-input); border-radius: 6px;
}
.es-header-search input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; color: #fff; font-size: .875rem; }
.es-header-search input::placeholder { color: rgba(255,255,255,.75); }
.es-header-search:focus-within { background: #fff; color: #242424; }
.es-header-search:focus-within input { color: #242424; }
.es-header-search:focus-within input::placeholder { color: #707070; }
.es-header-search kbd { background: rgba(255,255,255,.2); font-size: .65rem; }
.es-search-results {
    position: absolute; top: 36px; left: 0; right: 0; max-height: 60vh; overflow: auto;
    background: var(--es-card-bg); color: var(--es-text); border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,.18); padding: 6px;
}
.es-search-results a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 6px; color: inherit; text-decoration: none; }
.es-search-results a:hover, .es-search-results a.active { background: var(--es-brand-soft); }
.es-search-results small { color: var(--es-muted); }
.es-school-btn {
    display: flex; align-items: center; gap: 8px; height: 36px; padding: 0 8px; max-width: 260px;
    border: 0; border-radius: 6px; background: transparent; color: inherit;
}
.es-school-btn:hover { background: rgba(255,255,255,.14); }
.es-school-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .85rem; }
.es-school-avatar {
    flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center;
    width: 28px; height: 28px; border-radius: 6px; background: #e8ebfa; color: #444791; font-size: .7rem; font-weight: 700;
}
.es-school-avatar.sm { width: 24px; height: 24px; font-size: .6rem; }
.es-avatar-btn { border: 0; background: transparent; padding: 4px; border-radius: 50%; }
.es-avatar {
    position: relative; display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto;
    width: 32px; height: 32px; border-radius: 50%; background: #c5cbfa; color: #444791; font-weight: 600; font-size: .75rem;
}
.es-avatar.sm { width: 28px; height: 28px; font-size: .65rem; }
.es-avatar.lg { width: 48px; height: 48px; font-size: 1rem; }
.es-avatar.xl { width: 72px; height: 72px; font-size: 1.4rem; }
.es-presence { position: absolute; right: -1px; bottom: -1px; width: 11px; height: 11px; border-radius: 50%; background: #6bb700; border: 2px solid var(--es-header-bg); }
.es-menu { min-width: 260px; border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,.18); border: 0; }
.es-menu .dropdown-item.active, .es-menu .dropdown-item:active { background: var(--es-brand-soft); color: var(--es-text); }
.es-profile-menu { min-width: 300px; }

/* ================= BODY GRID ================= */
.es-body { display: flex; padding-top: var(--es-header-h); min-height: 100vh; }

/* ---------- App rail ---------- */
.es-rail {
    position: fixed; top: var(--es-header-h); bottom: 0; left: 0; width: var(--es-rail-w); z-index: 1030;
    flex-direction: column; justify-content: space-between; padding: 4px 0;
    background: var(--es-rail-bg); overflow-x: hidden; overflow-y: auto; scrollbar-width: none;
}
.es-rail::-webkit-scrollbar { display: none; width: 0; height: 0; }
.es-rail-item {
    position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
    height: 56px; margin: 0 4px; border-radius: 6px; color: var(--es-rail-fg); text-decoration: none; font-size: .64rem; text-align: center;
}
.es-rail-item i { font-size: 1.25rem; line-height: 1; }
.es-rail-item span { max-width: 60px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.es-rail-item:hover { background: var(--es-rail-hover); color: var(--es-brand); }
.es-rail-item.active { color: var(--es-brand); font-weight: 600; }
.es-rail-item.active::before {
    content: ""; position: absolute; left: -4px; top: 14px; bottom: 14px; width: 3px; border-radius: 0 3px 3px 0; background: var(--es-brand);
}

/* ---------- Side panel ---------- */
.es-panel {
    background: var(--es-panel-bg); border-right: 1px solid var(--es-border);
    display: flex; flex-direction: column;
    overflow-x: hidden;
}
@media (min-width: 992px) {
    .es-panel {
        position: fixed !important; top: var(--es-header-h); bottom: 0; left: var(--es-rail-w);
        width: var(--es-panel-w); visibility: visible !important; transform: none !important; z-index: 1020;
    }
    .es-main { margin-left: calc(var(--es-rail-w) + var(--es-panel-w)); }
    body.es-panel-collapsed .es-panel { width: 0; overflow: hidden; border: 0; }
    body.es-panel-collapsed .es-main { margin-left: var(--es-rail-w); }
    body.es-panel-collapsed .es-panel-expand { display: inline-flex !important; }
}
.es-panel-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 12px 8px 20px; }
.es-panel-title { font-size: 1.1rem; font-weight: 700; margin: 0; }
.es-panel-list, .es-panel-mobile { flex: 1 1 auto; overflow-x: hidden; overflow-y: auto; padding: 4px 8px 12px; }
.es-panel-item {
    display: flex; align-items: center; gap: 10px; padding: 7px 12px; margin: 1px 0; border-radius: 6px;
    color: var(--es-text); text-decoration: none; font-size: .875rem;
}
.es-panel-item i { font-size: 1rem; color: var(--es-muted); width: 18px; text-align: center; }
.es-panel-item span:first-of-type { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.es-panel-item:hover { background: var(--es-panel-hover); color: var(--es-text); }
.es-panel-item.active { background: var(--es-card-bg); font-weight: 600; box-shadow: var(--es-shadow); }
.es-panel-item.active i { color: var(--es-brand); }
.es-pill {
    display: inline-block; flex: 0 0 auto; font-size: .62rem; font-weight: 600; padding: 1px 6px; border-radius: 10px;
    background: var(--es-brand-soft); color: var(--es-brand); vertical-align: middle;
}
.es-panel-foot { padding: 10px 20px; border-top: 1px solid var(--es-border); }
.es-group-toggle {
    width: 100%; display: flex; align-items: center; gap: 10px; padding: 9px 12px; border: 0; border-radius: 6px;
    background: transparent; color: var(--es-text); font-weight: 600; font-size: .9rem;
}
.es-group-toggle:hover { background: var(--es-panel-hover); }
.es-group-toggle .es-chev { transition: transform .15s; }
.es-group-toggle.collapsed .es-chev { transform: rotate(-90deg); }
.es-group .es-panel-item { padding-left: 38px; }

/* ---------- Main ---------- */
.es-main { flex: 1 1 auto; min-width: 0; outline: 0; }
.es-page { padding: 24px 32px 48px; width: 100%; }
.es-page-header { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 20px; }
.es-h1 { font-size: 1.35rem; font-weight: 700; margin: 0; }
.es-h2 { font-size: 1rem; font-weight: 600; margin: 0; }
.es-sub { color: var(--es-muted); margin: 4px 0 0; }
.es-page-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.breadcrumb { --bs-breadcrumb-divider-color: var(--es-muted); }

.es-card { background: var(--es-card-bg); border-radius: var(--es-radius); box-shadow: var(--es-shadow); padding: 16px 18px; }
.es-card.p-0 { padding: 0; overflow: hidden; }
.es-card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.es-stat { display: flex; align-items: center; gap: 14px; background: var(--es-card-bg); border-radius: var(--es-radius); box-shadow: var(--es-shadow); padding: 14px 16px; height: 100%; }
.es-stat-icon { display: inline-flex; align-items: center; justify-content: center; width: 42px; height: 42px; border-radius: 10px; font-size: 1.2rem; }
.tone-primary { background: var(--es-brand-soft); color: var(--es-brand); }
.tone-success { background: #e7f2da; color: #0e700e; }
.tone-info { background: #ebf3fc; color: #0f6cbd; }
.tone-warning { background: #fff4ce; color: #8a5a00; }
.tone-danger { background: #fdf3f4; color: #c4314b; }
[data-bs-theme="dark"] .tone-success { background: #1b3315; color: #9fd89f; }
[data-bs-theme="dark"] .tone-info { background: #0e2a45; color: #8ac0ef; }
[data-bs-theme="dark"] .tone-warning { background: #3d300c; color: #f9e2a2; }
[data-bs-theme="dark"] .tone-danger { background: #3e1a20; color: #f1a8b4; }
.es-stat-value { font-size: 1.35rem; font-weight: 700; line-height: 1.1; }
.es-stat-label { color: var(--es-muted); font-size: .8rem; }

.es-table { --bs-table-bg: transparent; margin: 0; }
.es-table thead th { font-size: .75rem; font-weight: 600; color: var(--es-muted); text-transform: uppercase; letter-spacing: .02em; border-bottom-color: var(--es-border); background: var(--es-card-bg); padding: 10px 12px; }
.es-table td { padding: 10px 12px; border-color: var(--es-border); }
.es-table tbody tr:hover { background: var(--es-brand-soft); }

.es-status { display: inline-block; font-size: .72rem; font-weight: 600; padding: 2px 8px; border-radius: 10px; background: #f0f0f0; color: #424242; text-transform: capitalize; }
.es-status-active, .es-status-published, .es-status-applied, .es-status-installed { background: #e7f2da; color: #0e700e; }
.es-status-suspended, .es-status-failed { background: #fdf3f4; color: #c4314b; }
.es-status-upcoming, .es-status-draft, .es-status-pending { background: #fff4ce; color: #8a5a00; }
.es-status-closed, .es-status-archived { background: #f0f0f0; color: #616161; }
[data-bs-theme="dark"] .es-status { background: #3d3d3d; color: #d6d6d6; }

.es-empty { text-align: center; padding: 48px 20px; }
.es-empty-icon { width: 72px; height: 72px; margin: 0 auto 16px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 2rem; background: var(--es-brand-soft); color: var(--es-brand); }
.es-banner { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-radius: var(--es-radius); background: var(--es-brand-soft); color: var(--es-text); text-decoration: none; }
.es-banner > i:first-child { color: var(--es-brand); font-size: 1.2rem; }
.es-checklist { list-style: none; padding: 0; margin: 0; }
.es-checklist li { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--es-border); }
.es-checklist li:last-child { border: 0; }
.es-checklist li i { color: var(--es-muted); }
.es-checklist li.done i { color: #13a10e; }
.es-checklist li.done a { text-decoration: line-through; color: var(--es-muted); }
.es-feed { list-style: none; padding: 0; margin: 0; }
.es-feed li { display: flex; gap: 10px; padding: 8px 0; }
.es-timeline { display: grid; gap: 12px; }
.es-update.unread { border-left: 3px solid var(--es-brand); }

/* ---------- All-apps waffle ---------- */
.es-app-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.es-app-tile { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 14px 6px; border-radius: 8px; color: var(--es-text); text-decoration: none; font-size: .8rem; text-align: center; }
.es-app-tile i { font-size: 1.5rem; color: var(--es-brand); }
.es-app-tile:hover { background: var(--es-brand-soft); }

/* ---------- Mobile ---------- */
.es-bottom-nav {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 1035; height: calc(var(--es-bottom-h) + env(safe-area-inset-bottom));
    padding-bottom: env(safe-area-inset-bottom); display: flex; background: var(--es-rail-bg); border-top: 1px solid var(--es-border);
}
.es-bottom-nav a, .es-bottom-nav button {
    flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
    border: 0; background: transparent; color: var(--es-rail-fg); text-decoration: none; font-size: .68rem;
}
.es-bottom-nav i { font-size: 1.3rem; }
.es-bottom-nav .active { color: var(--es-brand); font-weight: 600; }
@media (max-width: 991.98px) {
    .es-panel { width: min(320px, 86vw) !important; }
    .es-main { padding-bottom: calc(var(--es-bottom-h) + env(safe-area-inset-bottom)); }
    .es-page { padding: 16px 14px 32px; }
    .es-header { gap: 6px; }
    .es-brand-name { display: none; }
}
@media (max-width: 575.98px) {
    .es-header-search { max-width: none; }
    .es-header-search kbd { display: none; }
    .es-h1 { font-size: 1.15rem; }
}

/* ================= PRINT ================= */
@media print {
    .es-header, .es-rail, .es-panel, .es-bottom-nav, .es-page-actions, .btn, form, .alert { display: none !important; }
    .es-main { margin: 0 !important; padding: 0 !important; }
    .es-body { padding: 0; }
    .es-card, .es-stat { box-shadow: none; border: 1px solid #ccc; }
    body { background: #fff; color: #000; }
}

/* =========================================================================
   UP-0002 · Polish layer (full width, refined surfaces, SPA loaders, auth)
   ========================================================================= */
:root {
    --es-radius: 12px;
    --es-card-border: #e6e6ea;
    --es-shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 1px 3px rgba(16, 24, 40, .06);
    --es-shadow-lg: 0 12px 32px -8px rgba(16, 24, 40, .18);
    --es-main-bg: #f4f5fa;
    --es-surface-2: #f8f8fc;
    --es-ok: #0e7a0d; --es-ok-bg: #e5f3e5;
    --es-warn: #8a5a00; --es-warn-bg: #fff4ce;
    --es-bad: #b4233a; --es-bad-bg: #fde7ea;
    --es-neutral: #5c5c66; --es-neutral-bg: #eef0f4;
}
[data-bs-theme="dark"] {
    --es-card-border: #34343c;
    --es-main-bg: #18181c;
    --es-card-bg: #222228;
    --es-panel-bg: #1e1e23;
    --es-rail-bg: #19191d;
    --es-surface-2: #2a2a31;
    --es-shadow: 0 1px 2px rgba(0, 0, 0, .35);
    --es-shadow-lg: 0 16px 40px -8px rgba(0, 0, 0, .6);
    --es-ok: #8fd88f; --es-ok-bg: #1b3317;
    --es-warn: #f6d77c; --es-warn-bg: #3b2f0e;
    --es-bad: #f4a3b0; --es-bad-bg: #3e1a22;
    --es-neutral: #c8c8d0; --es-neutral-bg: #33333b;
}

/* ---- Layout: full width ---- */
.es-main { background: var(--es-main-bg); min-height: calc(100vh - var(--es-header-h)); }
@media (min-width: 1600px) { .es-page { padding: 28px 40px 56px; } }

/* ---- Header polish ---- */
.es-header { box-shadow: 0 1px 0 rgba(0,0,0,.12); background: linear-gradient(90deg, #3d3e6b 0%, #464775 45%, #4f5195 100%); }
[data-bs-theme="dark"] .es-header { background: linear-gradient(90deg, #232336 0%, #2b2b40 60%, #30304a 100%); }

/* ---- Rail polish (Teams 2.0 look) ---- */
.es-rail { border-right: 1px solid var(--es-card-border); }
.es-rail-item { margin: 2px 6px; height: 54px; font-size: .63rem; }
.es-rail-item span { max-width: 56px; }
.es-rail-item.active { background: var(--es-card-bg); box-shadow: var(--es-shadow); }
.es-rail-item.active::before { left: -6px; top: 12px; bottom: 12px; }

/* ---- Panel polish ---- */
.es-panel { border-right: 1px solid var(--es-card-border); }
.es-panel-head { padding: 16px 12px 10px 20px; }
.es-panel-item { padding: 8px 12px; border-radius: 8px; }
.es-panel-item.active { position: relative; }
.es-panel-item.active::before { content: ""; position: absolute; left: 0; top: 9px; bottom: 9px; width: 3px; border-radius: 3px; background: var(--es-brand); }
.es-pill { background: transparent; border: 1px solid color-mix(in srgb, var(--es-brand) 35%, transparent); font-weight: 500; }

/* ---- Page header ---- */
.es-page-header { align-items: center; margin-bottom: 24px; }
.es-page-head-main { display: flex; align-items: center; gap: 14px; min-width: 0; }
.es-page-icon {
    flex: 0 0 auto; width: 48px; height: 48px; border-radius: 14px; display: inline-flex; align-items: center; justify-content: center;
    font-size: 1.35rem; color: #fff; background: linear-gradient(135deg, #7b83eb 0%, #5b5fc7 55%, #444791 100%);
    box-shadow: 0 6px 16px -6px rgba(91, 95, 199, .6);
}
.es-h1 { font-size: 1.5rem; letter-spacing: -.01em; }
.es-sub { font-size: .875rem; }
.breadcrumb-item a { text-decoration: none; }

/* ---- Cards ---- */
.es-card, .es-stat { border: 1px solid var(--es-card-border); box-shadow: var(--es-shadow); border-radius: var(--es-radius); }
.es-card { padding: 20px 22px; }
.es-card-head { gap: 12px; }
.es-card-toolbar { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid var(--es-card-border); }
.es-card-title { font-size: 1rem; font-weight: 600; margin: 0; display: flex; align-items: center; gap: 8px; }
.es-count { display: inline-flex; min-width: 22px; height: 20px; padding: 0 7px; border-radius: 10px; align-items: center; justify-content: center; font-size: .72rem; font-weight: 600; background: var(--es-neutral-bg); color: var(--es-neutral); }
.es-filter { position: relative; min-width: 240px; }
.es-filter i { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--es-muted); }
.es-filter input { padding-left: 32px; border-radius: 8px; }
.es-stat { padding: 18px 20px; gap: 16px; position: relative; overflow: hidden; transition: transform .15s, box-shadow .15s; }
a.es-stat { color: inherit; text-decoration: none; }
a.es-stat:hover { transform: translateY(-2px); box-shadow: var(--es-shadow-lg); }
.es-stat-icon { width: 46px; height: 46px; border-radius: 12px; }
.es-stat-value { font-size: 1.6rem; letter-spacing: -.02em; }
.es-stat-foot { font-size: .75rem; color: var(--es-muted); margin-top: 2px; }

/* ---- Tables ---- */
.es-table thead th { background: var(--es-surface-2); border-bottom: 1px solid var(--es-card-border); padding: 11px 18px; }
.es-table td { padding: 14px 18px; border-color: var(--es-card-border); }
.es-table tbody tr { transition: background .12s; }
.es-table tbody tr:hover { background: color-mix(in srgb, var(--es-brand) 6%, transparent); }
.es-table tbody tr:last-child td { border-bottom: 0; }
.es-cell-title { display: flex; align-items: center; gap: 12px; }
.es-cell-icon { width: 36px; height: 36px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; background: var(--es-brand-soft); color: var(--es-brand); flex: 0 0 auto; }
.es-row-actions { display: inline-flex; gap: 6px; justify-content: flex-end; }
.es-act {
    display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border-radius: 8px; font-size: .8rem; font-weight: 600;
    border: 1px solid var(--es-card-border); background: var(--es-card-bg); color: var(--es-text); text-decoration: none; transition: all .12s;
}
.es-act:hover { border-color: var(--es-brand); color: var(--es-brand); background: var(--es-brand-soft); }
.es-act.ok:hover { border-color: var(--es-ok); color: var(--es-ok); background: var(--es-ok-bg); }
.es-empty-row td { padding: 48px 18px !important; text-align: center; color: var(--es-muted); }

/* ---- Status chips with dot ---- */
.es-status { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px 3px 8px; font-size: .74rem; border-radius: 999px; background: var(--es-neutral-bg); color: var(--es-neutral); }
.es-status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; opacity: .85; }
.es-status-active, .es-status-published, .es-status-applied, .es-status-installed { background: var(--es-ok-bg); color: var(--es-ok); }
.es-status-suspended, .es-status-failed { background: var(--es-bad-bg); color: var(--es-bad); }
.es-status-upcoming, .es-status-draft, .es-status-pending { background: var(--es-warn-bg); color: var(--es-warn); }
[data-bs-theme="dark"] .es-status { background: var(--es-neutral-bg); }
[data-bs-theme="dark"] .es-status-active, [data-bs-theme="dark"] .es-status-published, [data-bs-theme="dark"] .es-status-applied, [data-bs-theme="dark"] .es-status-installed { background: var(--es-ok-bg); color: var(--es-ok); }
[data-bs-theme="dark"] .es-status-suspended, [data-bs-theme="dark"] .es-status-failed { background: var(--es-bad-bg); color: var(--es-bad); }
[data-bs-theme="dark"] .es-status-upcoming, [data-bs-theme="dark"] .es-status-draft, [data-bs-theme="dark"] .es-status-pending { background: var(--es-warn-bg); color: var(--es-warn); }
.es-tag-current { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 999px; font-size: .7rem; font-weight: 700; color: #fff; background: linear-gradient(135deg, #13a10e, #0e7a0d); }

/* ---- Hero banner (dashboard / session) ---- */
.es-hero {
    position: relative; overflow: hidden; border-radius: 16px; padding: 26px 28px; margin-bottom: 24px; color: #fff;
    background: radial-gradient(1200px 300px at 100% 0%, rgba(255,255,255,.18), transparent 60%), linear-gradient(120deg, #444791 0%, #5b5fc7 55%, #7b83eb 100%);
    box-shadow: 0 12px 30px -12px rgba(68, 71, 145, .55);
}
.es-hero::after { content: ""; position: absolute; right: -60px; bottom: -80px; width: 260px; height: 260px; border-radius: 50%; background: rgba(255,255,255,.08); }
.es-hero h1 { font-size: 1.6rem; font-weight: 700; margin: 0 0 4px; }
.es-hero p { margin: 0; opacity: .85; }
.es-hero-meta { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; position: relative; z-index: 1; }
.es-hero-chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: 999px; background: rgba(255,255,255,.16); font-size: .8rem; backdrop-filter: blur(4px); color: #fff; text-decoration: none; }
a.es-hero-chip:hover { background: rgba(255,255,255,.26); color: #fff; }
.es-meter { height: 8px; border-radius: 999px; background: var(--es-neutral-bg); overflow: hidden; }
.es-meter > span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #7b83eb, #5b5fc7); }
.es-hero .es-meter { background: rgba(255,255,255,.22); }
.es-hero .es-meter > span { background: #fff; }

/* ---- Quick actions ---- */
.es-quick { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.es-quick a { display: flex; flex-direction: column; gap: 10px; padding: 14px; border-radius: 12px; border: 1px solid var(--es-card-border); background: var(--es-surface-2); color: var(--es-text); text-decoration: none; transition: all .15s; font-size: .85rem; font-weight: 600; position: relative; }
.es-quick a i { font-size: 1.3rem; color: var(--es-brand); }
.es-quick a:hover { border-color: var(--es-brand); background: var(--es-brand-soft); transform: translateY(-1px); }
.es-quick a .es-pill { position: absolute; top: 10px; right: 10px; }

/* ---- Segmented control (theme / language) ---- */
.es-seg { display: flex; gap: 2px; padding: 3px; border-radius: 10px; background: var(--es-neutral-bg); }
.es-seg-form { flex: 1; display: flex; }
.es-seg-btn {
    flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 32px; padding: 0 8px;
    border: 0; border-radius: 8px; background: transparent; color: var(--es-muted); font-size: .8rem; font-weight: 500; cursor: pointer; transition: all .15s;
}
.es-seg-btn:hover { color: var(--es-text); }
.es-seg-btn[aria-checked="true"] { background: var(--es-card-bg); color: var(--es-brand); font-weight: 700; box-shadow: 0 1px 3px rgba(0,0,0,.15); }
.es-seg-btn[aria-checked="true"]::after { content: "\F26E"; font-family: "bootstrap-icons"; font-size: .85rem; }
.es-profile-menu { min-width: 320px; padding-bottom: 6px; }

/* ---- Top progress bar ---- */
.es-progress { position: fixed; top: 0; left: 0; right: 0; height: 3px; z-index: 2000; pointer-events: none; opacity: 0; transition: opacity .3s; }
.es-progress.active { opacity: 1; }
.es-progress.done { opacity: 0; transition-delay: .2s; }
.es-progress-bar { height: 100%; width: 0; background: linear-gradient(90deg, #c5cbfa, #fff 40%, #7bf1ff); box-shadow: 0 0 10px rgba(123, 241, 255, .8); transition: width .2s ease-out; }

/* ---- Skeleton loaders ---- */
.es-skel {
    display: block; height: 12px; border-radius: 6px; max-width: 100%;
    background: linear-gradient(90deg, var(--es-neutral-bg) 25%, color-mix(in srgb, var(--es-neutral-bg) 45%, var(--es-card-bg)) 37%, var(--es-neutral-bg) 63%);
    background-size: 400% 100%; animation: es-shimmer 1.3s ease infinite;
}
.es-skel-sm { height: 9px; }
.es-skel-h1 { height: 22px; border-radius: 8px; }
.es-skel-h2 { height: 15px; }
.es-skel-icon { width: 46px; height: 46px; border-radius: 12px; flex: 0 0 auto; }
.es-skel-circle { width: 32px; height: 32px; border-radius: 50%; flex: 0 0 auto; }
.es-skel-input { height: 38px; border-radius: 8px; }
.es-skel-btn { height: 38px; border-radius: 8px; }
.es-skel-row { display: flex; gap: 6%; align-items: center; padding: 18px; border-bottom: 1px solid var(--es-card-border); }
.es-skel-thead { background: var(--es-surface-2); padding: 14px 18px; }
.es-skeleton .es-stat:hover { transform: none; }
@keyframes es-shimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }
@media (prefers-reduced-motion: reduce) { .es-skel { animation: none; } .es-progress-bar { transition: none; } }
.es-page[aria-busy="true"] { pointer-events: none; }

/* ---- Buttons ---- */
.btn { border-radius: 8px; }
.btn-primary { box-shadow: 0 4px 12px -4px rgba(91, 95, 199, .6); }
.es-busy { pointer-events: none; opacity: .85; }

/* ---- Forms ---- */
.form-control, .form-select { border-radius: 8px; border-color: var(--es-card-border); }
.form-label { font-weight: 600; font-size: .82rem; }
.es-form-section { padding: 22px; border-bottom: 1px solid var(--es-card-border); }
.es-form-section:last-child { border-bottom: 0; }
.es-form-section h3 { font-size: .95rem; font-weight: 700; margin: 0 0 4px; }
.es-form-section p { font-size: .8rem; color: var(--es-muted); margin: 0 0 16px; }
.es-form-foot { display: flex; gap: 8px; justify-content: flex-end; padding: 16px 22px; background: var(--es-surface-2); border-top: 1px solid var(--es-card-border); border-radius: 0 0 var(--es-radius) var(--es-radius); }

/* ================= AUTH (UP-0002 redesign) ================= */
.es-auth { display: flex; min-height: 100vh; background: var(--es-main-bg); }
.es-auth-art {
    position: relative; overflow: hidden; flex: 0 0 52%; flex-direction: column; justify-content: space-between; padding: 44px 56px; color: #fff;
    background:
        radial-gradient(600px 400px at 15% 10%, rgba(123, 131, 235, .55), transparent 60%),
        radial-gradient(500px 500px at 90% 90%, rgba(0, 188, 242, .25), transparent 60%),
        linear-gradient(155deg, #2b2c5a 0%, #3d3e7a 45%, #464775 100%);
}
.es-auth-art::before {
    content: ""; position: absolute; inset: 0; opacity: .18;
    background-image: linear-gradient(rgba(255,255,255,.12) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.12) 1px, transparent 1px);
    background-size: 36px 36px; mask-image: radial-gradient(circle at 30% 30%, #000 0%, transparent 70%);
}
.es-auth-art > * { position: relative; z-index: 1; }
.es-auth-brand { display: flex; align-items: center; gap: 12px; font-weight: 700; font-size: 1.15rem; }
.es-auth-hero h1 { font-size: clamp(1.8rem, 2.6vw, 2.6rem); font-weight: 800; line-height: 1.15; letter-spacing: -.02em; margin-bottom: 14px; }
.es-auth-hero h1 span { background: linear-gradient(90deg, #c5cbfa, #7bf1ff); -webkit-background-clip: text; background-clip: text; color: transparent; }
.es-auth-hero p { font-size: 1.02rem; opacity: .85; max-width: 520px; }
.es-auth-features { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; max-width: 560px; margin-top: 28px; }
.es-auth-feature { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 12px; background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.12); backdrop-filter: blur(6px); font-size: .85rem; }
.es-auth-feature i { font-size: 1.15rem; color: #c5cbfa; }
.es-auth-feature strong { display: block; font-size: .88rem; }
.es-auth-feature small { opacity: .75; }
.es-auth-mock { position: relative; height: 150px; max-width: 560px; margin-top: 28px; }
.es-mock-card { position: absolute; border-radius: 14px; padding: 12px 14px; background: rgba(255,255,255,.95); color: #242424; box-shadow: 0 16px 40px -12px rgba(0,0,0,.45); font-size: .78rem; }
.es-mock-card .es-mock-bars { display: flex; align-items: flex-end; gap: 5px; height: 46px; margin-top: 8px; }
.es-mock-card .es-mock-bars span { width: 12px; border-radius: 4px 4px 2px 2px; background: linear-gradient(180deg, #7b83eb, #5b5fc7); }
.es-mock-1 { left: 0; top: 10px; width: 200px; animation: es-float 6s ease-in-out infinite; }
.es-mock-2 { left: 220px; top: 0; width: 190px; animation: es-float 7s ease-in-out infinite .6s; }
.es-mock-3 { left: 140px; top: 92px; width: 220px; animation: es-float 6.5s ease-in-out infinite 1.2s; }
.es-mock-line { display: block; height: 7px; border-radius: 4px; background: #e6e6ef; margin-top: 6px; }
.es-mock-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; }
@keyframes es-float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
@media (prefers-reduced-motion: reduce) { .es-mock-card { animation: none !important; } }
.es-auth-foot { font-size: .78rem; opacity: .6; }

.es-auth-main { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 32px 20px; position: relative; }
.es-auth-topbar { position: absolute; top: 18px; right: 22px; left: 22px; display: flex; justify-content: space-between; align-items: center; }
.es-auth-card { width: 100%; max-width: 440px; background: var(--es-card-bg); border: 1px solid var(--es-card-border); border-radius: 18px; box-shadow: var(--es-shadow-lg); padding: 36px 34px; }
.es-auth-card h1 { font-size: 1.55rem; font-weight: 800; letter-spacing: -.02em; }
.es-auth-icon { width: 52px; height: 52px; border-radius: 14px; display: inline-flex; align-items: center; justify-content: center; font-size: 1.4rem; color: #fff; margin-bottom: 18px; background: linear-gradient(135deg, #7b83eb 0%, #5b5fc7 55%, #444791 100%); box-shadow: 0 10px 24px -10px rgba(91,95,199,.8); }
.es-input-icon { position: relative; }
.es-input-icon > i { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--es-muted); z-index: 5; pointer-events: none; }
.es-input-icon .form-control { padding-left: 42px; height: 48px; border-radius: 10px; }
.es-input-icon .es-eye { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); z-index: 5; border: 0; background: transparent; color: var(--es-muted); width: 38px; height: 38px; border-radius: 8px; }
.es-input-icon .es-eye:hover { background: var(--es-neutral-bg); color: var(--es-text); }
.es-auth-card .btn-lg { height: 48px; border-radius: 10px; font-size: 1rem; }
.es-caps { display: none; font-size: .78rem; color: var(--es-warn); margin-top: 6px; }
.es-caps.show { display: block; }
.es-secure-note { display: flex; align-items: center; justify-content: center; gap: 6px; font-size: .78rem; color: var(--es-muted); margin-top: 18px; }
.es-demo { margin-top: 22px; border: 1px dashed var(--es-card-border); border-radius: 12px; padding: 12px; }
.es-demo-title { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--es-muted); margin-bottom: 8px; }
.es-demo-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.es-demo button { text-align: left; border: 1px solid var(--es-card-border); background: var(--es-surface-2); border-radius: 8px; padding: 6px 10px; font-size: .78rem; color: var(--es-text); }
.es-demo button:hover { border-color: var(--es-brand); background: var(--es-brand-soft); }
.es-demo button small { display: block; color: var(--es-muted); font-size: .7rem; }
.es-auth-copy { margin-top: 20px; font-size: .75rem; color: var(--es-muted); }
@media (max-width: 991.98px) {
    .es-auth { background: linear-gradient(170deg, #3d3e7a 0%, #464775 220px, var(--es-main-bg) 220px); }
    .es-auth-main { justify-content: flex-start; padding-top: 84px; }
    .es-auth-topbar { color: #fff; }
    .es-auth-topbar .btn-link { color: #fff; }
    .es-auth-card { padding: 28px 22px; }
}
.es-minimal { background: var(--es-main-bg); }

/* ---- Check tiles, sections, roles ---- */
.es-check-tile { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border: 1px solid var(--es-card-border); border-radius: 10px; cursor: pointer; background: var(--es-card-bg); transition: all .12s; height: 100%; }
.es-check-tile:hover { border-color: var(--es-brand); }
.es-check-tile:has(input:checked) { border-color: var(--es-brand); background: var(--es-brand-soft); box-shadow: inset 0 0 0 1px var(--es-brand); }
.es-check-tile .form-check-input { margin-top: 3px; flex: 0 0 auto; }
.es-check-tile strong { display: block; font-size: .86rem; }
.es-check-tile small { display: block; color: var(--es-muted); font-size: .75rem; }
.es-check-tile.locked { cursor: not-allowed; opacity: .7; }
.es-section-row { border-bottom: 1px solid var(--es-card-border); }
.es-section-row summary { display: flex; align-items: center; gap: 12px; padding: 12px 18px; cursor: pointer; list-style: none; }
.es-section-row summary::-webkit-details-marker { display: none; }
.es-section-row summary:hover { background: var(--es-surface-2); }
.es-section-row .es-chev { transition: transform .15s; color: var(--es-muted); }
.es-section-row[open] .es-chev { transform: rotate(180deg); }
.es-section-row[open] summary { background: var(--es-surface-2); }
.es-add-row { padding: 16px 18px; background: var(--es-surface-2); border-radius: 0 0 var(--es-radius) var(--es-radius); }
.es-role { display: inline-flex; padding: 2px 9px; border-radius: 999px; font-size: .72rem; font-weight: 600; background: var(--es-brand-soft); color: var(--es-brand); }
.es-role-school_admin { background: #fde7f3; color: #a4262c; }
.es-role-principal { background: #fff4ce; color: #8a5a00; }
.es-role-teacher { background: #e5f3e5; color: #0e7a0d; }
.es-role-accountant { background: #e0f2fe; color: #0f6cbd; }
[data-bs-theme="dark"] .es-role-school_admin { background: #44202b; color: #f4a3b8; }
[data-bs-theme="dark"] .es-role-principal { background: #3b2f0e; color: #f6d77c; }
[data-bs-theme="dark"] .es-role-teacher { background: #1b3317; color: #8fd88f; }
[data-bs-theme="dark"] .es-role-accountant { background: #0e2a45; color: #8ac0ef; }
.es-matrix { max-height: 70vh; }
.es-matrix thead th { position: sticky; top: 0; z-index: 1; font-size: .68rem; }
.es-matrix td:first-child { min-width: 260px; }
.es-new-btn { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border: 0; border-radius: 8px; background: rgba(255,255,255,.95); color: #444791; font-weight: 700; font-size: .82rem; }
.es-new-btn:hover { background: #fff; color: #33346b; }
[data-bs-theme="dark"] .es-new-btn { background: #7f85f5; color: #fff; }
.es-new-menu .dropdown-item { display: flex; gap: 12px; align-items: center; padding: 8px 14px; }
.es-new-menu .dropdown-item i { width: 32px; height: 32px; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center; background: var(--es-brand-soft); color: var(--es-brand); }
.es-new-menu .dropdown-item small { display: block; color: var(--es-muted); font-size: .72rem; }
:root { --es-skel: #e3e5ee; }
[data-bs-theme="dark"] { --es-skel: #33333b; }
.es-skel { background: linear-gradient(90deg, var(--es-skel) 25%, color-mix(in srgb, var(--es-skel) 40%, var(--es-card-bg)) 37%, var(--es-skel) 63%); background-size: 400% 100%; }
.es-auth-main { min-width: 0; }
.es-demo-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.es-demo button { min-width: 0; }
.es-demo button small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 400px) { .es-demo-grid { grid-template-columns: 1fr; } }
.es-header-search { min-width: 0; flex: 1 1 0; }
@media (max-width: 575.98px) {
    .es-header { padding: 0 4px; gap: 4px; }
    .es-header-right { gap: 0; }
    .es-school-btn { padding: 0 4px; gap: 4px; }
    .es-school-btn .bi-chevron-down { display: none; }
    .es-new-btn { width: 32px; padding: 0; justify-content: center; }
    .es-header-search { padding: 0 8px; }
    .es-hero { padding: 20px; }
    .es-hero h1 { font-size: 1.3rem; }
}
.es-page-header { flex-wrap: nowrap; }
.es-page-head-main { flex: 1 1 auto; }
.es-page-actions { flex: 0 0 auto; margin-left: auto; }
@media (max-width: 767.98px) { .es-page-header { flex-wrap: wrap; } .es-page-actions { margin-left: 0; } }

/* ---- UP-0003: pipeline, timeline, calendar, timetable ---- */
.es-pipeline { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; }
.es-pipeline a { flex: 0 0 auto; min-width: 120px; display: flex; flex-direction: column; gap: 2px; padding: 10px 14px; border-radius: 12px; border: 1px solid var(--es-card-border); background: var(--es-card-bg); color: var(--es-text); text-decoration: none; box-shadow: var(--es-shadow); }
.es-pipeline a span { font-size: .75rem; color: var(--es-muted); }
.es-pipeline a strong { font-size: 1.25rem; }
.es-pipeline a.active { border-color: var(--es-brand); box-shadow: inset 0 0 0 1px var(--es-brand); background: var(--es-brand-soft); }
.es-pipeline a.due strong { color: var(--es-bad); }
.es-dl { display: grid; grid-template-columns: 130px 1fr; gap: 6px 12px; margin: 0; font-size: .86rem; }
.es-dl dt { color: var(--es-muted); font-weight: 500; }
.es-dl dd { margin: 0; }
.es-timeline-list { list-style: none; margin: 0; padding: 0; position: relative; }
.es-timeline-list::before { content: ""; position: absolute; left: 17px; top: 6px; bottom: 6px; width: 2px; background: var(--es-card-border); }
.es-timeline-list li { display: flex; gap: 14px; padding: 0 0 18px; position: relative; }
.es-tl-dot { flex: 0 0 auto; width: 36px; height: 36px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; position: relative; z-index: 1; border: 3px solid var(--es-card-bg); }
.es-cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border-top: 1px solid var(--es-card-border); border-left: 1px solid var(--es-card-border); }
.es-cal-head { padding: 8px; font-size: .72rem; font-weight: 700; text-transform: uppercase; color: var(--es-muted); background: var(--es-surface-2); border-right: 1px solid var(--es-card-border); border-bottom: 1px solid var(--es-card-border); text-align: center; }
.es-cal-day { min-height: 110px; padding: 6px; border-right: 1px solid var(--es-card-border); border-bottom: 1px solid var(--es-card-border); background: var(--es-card-bg); display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.es-cal-day.muted { background: var(--es-surface-2); }
.es-cal-day.muted .es-cal-num { opacity: .45; }
.es-cal-day.off { background: repeating-linear-gradient(135deg, var(--es-surface-2), var(--es-surface-2) 6px, transparent 6px, transparent 12px); }
.es-cal-num { font-size: .78rem; font-weight: 600; width: 26px; height: 26px; display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; }
.es-cal-day.today .es-cal-num { background: var(--es-brand); color: #fff; }
.es-ev { display: block; font-size: .72rem; padding: 2px 6px; border-radius: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-decoration: none; border-left: 3px solid currentColor; }
.es-ev-event { background: var(--es-brand-soft); color: var(--es-brand); }
.es-ev-holiday { background: var(--es-bad-bg); color: var(--es-bad); }
.es-ev-exam { background: var(--es-warn-bg); color: var(--es-warn); }
.es-ev-ptm, .es-ev-meeting { background: #e0f2fe; color: #0f6cbd; }
.es-ev-activity, .es-ev-other { background: var(--es-ok-bg); color: var(--es-ok); }
[data-bs-theme="dark"] .es-ev-ptm, [data-bs-theme="dark"] .es-ev-meeting { background: #0e2a45; color: #8ac0ef; }
@media (max-width: 767.98px) { .es-cal-day { min-height: 64px; } .es-ev { font-size: 0; padding: 0; height: 6px; border-left-width: 0; } }
.es-tt { width: 100%; border-collapse: separate; border-spacing: 6px; table-layout: fixed; }
.es-tt th { font-size: .72rem; text-transform: uppercase; color: var(--es-muted); font-weight: 700; text-align: center; padding: 6px; }
.es-tt th.es-tt-period { width: 120px; text-align: left; text-transform: none; color: var(--es-text); font-size: .8rem; }
.es-tt th.es-tt-period small { display: block; color: var(--es-muted); font-weight: 500; }
.es-tt-cell { display: flex; flex-direction: column; justify-content: center; min-height: 64px; width: 100%; padding: 8px 10px; border-radius: 10px; border: 1px dashed var(--es-card-border); background: transparent; color: var(--es-muted); font-size: .78rem; text-align: left; transition: all .12s; }
button.es-tt-cell:hover { border-color: var(--es-brand); color: var(--es-brand); background: var(--es-brand-soft); }
.es-tt-cell.filled { border-style: solid; background: var(--es-brand-soft); color: var(--es-text); border-color: transparent; border-left: 4px solid var(--es-brand); }
.es-tt-cell.filled strong { font-size: .84rem; }
.es-tt-cell.filled small { color: var(--es-muted); }
.es-tt-break td { text-align: center; font-size: .72rem; letter-spacing: .1em; text-transform: uppercase; color: var(--es-muted); background: var(--es-surface-2); border-radius: 8px; padding: 6px; }
.es-today-list { list-style: none; margin: 0; padding: 0; }
.es-today-list li { display: flex; gap: 14px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--es-card-border); }
.es-today-list li:last-child { border-bottom: 0; }
.es-today-time { flex: 0 0 auto; width: 74px; font-size: .78rem; color: var(--es-muted); }
.es-today-time strong { display: block; color: var(--es-text); font-size: .9rem; }
.es-today-list li.now { background: var(--es-brand-soft); border-radius: 10px; padding-left: 10px; padding-right: 10px; }
.es-period-row { display: flex; gap: 8px; align-items: center; padding: 10px 16px; border-bottom: 1px solid var(--es-card-border); flex-wrap: wrap; }
.es-period-row input[name="name"] { flex: 1 1 160px; }
.es-period-row input[type="time"] { width: 120px; }
.es-avatar-img { object-fit: cover; padding: 0; }
.es-profile-hero { display: flex; gap: 20px; align-items: center; padding: 22px; border-radius: 16px; background: var(--es-card-bg); border: 1px solid var(--es-card-border); box-shadow: var(--es-shadow); flex-wrap: wrap; }
.es-profile-hero .es-avatar.xl { width: 88px; height: 88px; font-size: 1.8rem; border-radius: 20px; }
.es-tabs { border-bottom-color: var(--es-card-border); gap: 4px; }
.es-tabs .nav-link { border: 0; color: var(--es-muted); font-weight: 600; font-size: .86rem; padding: 10px 14px; border-bottom: 2px solid transparent; background: transparent; }
.es-tabs .nav-link.active { color: var(--es-brand); border-bottom-color: var(--es-brand); background: transparent; }
.es-seg-radio { margin: 0; }
.es-seg-radio:has(input:checked) { background: var(--es-card-bg); color: var(--es-brand); font-weight: 700; box-shadow: 0 1px 3px rgba(0,0,0,.15); }
.es-seg-radio:has(input[value="detain"]:checked) { color: var(--es-warn); }
.es-seg-radio:has(input[value="leave"]:checked) { color: var(--es-bad); }
/* ---- Attendance ---- */
.es-att { display: inline-flex; gap: 4px; }
.es-att-btn { margin: 0; display: inline-flex; align-items: center; justify-content: center; min-width: 40px; height: 34px; padding: 0 8px; border-radius: 8px; border: 1px solid var(--es-card-border); font-size: .8rem; font-weight: 700; color: var(--es-muted); cursor: pointer; user-select: none; transition: all .1s; }
.es-att-btn:hover { border-color: var(--es-brand); }
.es-att-btn:has(input:disabled) { cursor: default; opacity: .7; }
.es-att-btn:has(input:focus-visible) { outline: 2px solid var(--es-brand); outline-offset: 1px; }
.tone-success-att:has(input:checked) { background: #13a10e; border-color: #13a10e; color: #fff; }
.tone-danger-att:has(input:checked) { background: #c4314b; border-color: #c4314b; color: #fff; }
.tone-warning-att:has(input:checked) { background: #e9a100; border-color: #e9a100; color: #fff; }
.tone-info-att:has(input:checked) { background: #0f6cbd; border-color: #0f6cbd; color: #fff; }
.tone-secondary-att:has(input:checked) { background: #6b6b75; border-color: #6b6b75; color: #fff; }
.tone-primary-att:has(input:checked) { background: var(--es-brand); border-color: var(--es-brand); color: #fff; }
.es-register th, .es-register td { text-align: center; padding: 6px 4px !important; font-size: .74rem; white-space: nowrap; }
.es-register th small { display: block; font-weight: 500; color: var(--es-muted); text-transform: none; }
.es-register .off { background: repeating-linear-gradient(135deg, var(--es-surface-2), var(--es-surface-2) 4px, transparent 4px, transparent 8px); }
.es-register .att-present, .es-register .att-late { color: #0e7a0d; font-weight: 700; }
.es-register .att-absent { color: #c4314b; font-weight: 700; background: var(--es-bad-bg); }
.es-register .att-leave { color: var(--es-muted); }
@media print { .es-register th, .es-register td { font-size: 9px; padding: 2px !important; } .es-register { page: es-landscape; } @page es-landscape { size: A4 landscape; margin: 10mm; } }

/* =========================================================================
   UP-0006 · Fees
   ========================================================================= */
.es-money { font-variant-numeric: tabular-nums; white-space: nowrap; }
.es-stat-value.es-money { font-size: 1.25rem; overflow: hidden; text-overflow: ellipsis; }
.es-steps { padding-left: 1.2rem; display: grid; gap: 6px; }
.es-steps li.done { color: var(--es-muted); text-decoration: line-through; }
.es-steps li.done a { color: inherit; }
.es-fee-grid input.es-amount { min-width: 96px; max-width: 140px; margin-left: auto; font-variant-numeric: tabular-nums; }
.es-fee-grid tfoot th { background: var(--es-surface-2); }
.es-sticky { position: sticky; top: 12px; }
.es-check-list { max-height: 240px; overflow: auto; border: 1px solid var(--es-card-border); border-radius: 10px; padding: 8px 12px; }
.es-quick-sm { grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); }
.es-quick-sm a { flex-direction: row; align-items: center; gap: 8px; padding: 10px 12px; }
.es-quick-sm a i { font-size: 1.05rem; }
.es-check-list .form-check { padding-block: 3px; }
.es-bar-row { display: grid; grid-template-columns: 56px 1fr 110px; gap: 10px; align-items: center; padding: 4px 0; }
.es-bar { height: 10px; border-radius: 6px; background: var(--es-surface-2); overflow: hidden; }
.es-bar span { display: block; height: 100%; border-radius: 6px; background: var(--es-brand); }
@media print {
    .es-receipt { border: 0 !important; box-shadow: none !important; padding: 0 !important; }
    .row:has(> .col-xl-8 > .es-receipt) > .col-xl-4 { display: none !important; }
    .row:has(> .col-xl-8 > .es-receipt) > .col-xl-8 { width: 100% !important; }
    body:has(.es-receipt) .es-page-header { display: none !important; }
}

/* =========================================================================
   UP-0007 · Exams
   ========================================================================= */
.es-steps-h { display: flex; flex-wrap: wrap; gap: 6px; }
.es-steps-h span { padding: 4px 12px; border-radius: 999px; background: var(--es-surface-2); color: var(--es-muted); font-size: .8rem; font-weight: 600; border: 1px solid var(--es-card-border); }
.es-steps-h span.on { background: var(--es-brand); color: #fff; border-color: transparent; }
.es-mark { max-width: 110px; font-variant-numeric: tabular-nums; }
.es-mark.is-invalid { background-image: none; }
.es-sheet td, .es-sheet th { white-space: nowrap; }
.es-dl-3 { grid-template-columns: max-content 1fr max-content 1fr; }
.es-admit-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 16px; }
.es-admit { break-inside: avoid; }
@media print {
    .es-report-card { break-after: page; border: 0 !important; box-shadow: none !important; margin: 0 !important; }
    .es-report-card:last-child { break-after: auto; }
    .es-admit-grid { grid-template-columns: 1fr 1fr; gap: 8mm; }
    .es-admit { border: 1px dashed #999 !important; box-shadow: none !important; }
    body:has(.es-report-card) .es-page-header, body:has(.es-admit) .es-page-header { display: none !important; }
    .es-sheet { font-size: 10px; }
}
@media (max-width: 640px) { .es-dl-3 { grid-template-columns: 110px 1fr; } }

/* =========================================================================
   UP-0008 · Documents: letterhead, certificates, ID cards, verification
   ========================================================================= */
.es-letterhead { display: flex; align-items: center; gap: 14px; padding-bottom: 10px; border-bottom: 3px solid var(--es-accent, #5b5fc7); }
.es-lh-logo { width: 64px; height: 64px; object-fit: contain; flex: 0 0 auto; }
.es-lh-initials { display: inline-flex; align-items: center; justify-content: center; border-radius: 14px; background: var(--es-accent, #5b5fc7); color: #fff; font-weight: 700; font-size: 1.4rem; }
.es-lh-main { flex: 1 1 auto; min-width: 0; }
.es-lh-name { font-size: 1.35rem; font-weight: 800; color: var(--es-accent, #5b5fc7); line-height: 1.2; }
.es-lh-meta { font-size: .78rem; color: var(--es-muted); }
.es-lh-right { flex: 0 0 auto; }
.es-a4 { max-width: 210mm; margin-inline: auto; padding: 14mm 14mm 10mm !important; }
.es-doc-title { text-align: center; font-size: 1.35rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; margin: 12px 0 16px; text-decoration: underline; text-underline-offset: 6px; }
.es-cert-text { font-size: 1.02rem; line-height: 2; text-align: justify; }
.es-tc-table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.es-tc-table td { padding: 5px 6px; vertical-align: top; border-bottom: 1px dotted #c8c8d0; }
.es-tc-n { width: 34px; color: var(--es-muted); }
.es-tc-l { width: 48%; }
.es-tc-v { font-weight: 600; }
.es-doc-sign { display: flex; align-items: flex-end; gap: 12px; justify-content: flex-end; }
.es-doc-sig { max-height: 52px; max-width: 170px; object-fit: contain; }
.es-doc-seal { max-height: 76px; max-width: 76px; object-fit: contain; opacity: .9; }
.es-doc-footer, .es-doc-verify { margin-top: 14px; padding-top: 6px; border-top: 1px solid #e3e3ea; font-size: .72rem; color: var(--es-muted); text-align: center; }
.es-qr { display: inline-block; width: 96px; height: 96px; }
.es-qr-sm { width: 76px; height: 76px; }
.es-qr svg, .es-idc-qr svg { width: 100%; height: 100%; display: block; }
.es-cancelled { position: relative; }
.es-cancelled::after { content: 'CANCELLED'; position: absolute; inset: 40% 0 auto; text-align: center; font-size: 5rem; font-weight: 900; color: rgba(196, 49, 75, .18); transform: rotate(-18deg); pointer-events: none; }
.es-tile { display: flex; gap: 14px; align-items: flex-start; text-decoration: none; color: inherit; transition: box-shadow .15s, transform .15s; }
.es-tile:hover { box-shadow: var(--es-shadow-lg); transform: translateY(-1px); color: inherit; }
.es-brand-preview { width: 72px; height: 72px; border-radius: 12px; border: 1px solid var(--es-card-border); object-fit: contain; background: #fff; flex: 0 0 auto; }
.es-brand-empty { display: inline-flex; align-items: center; justify-content: center; color: var(--es-muted); font-size: 1.6rem; background: var(--es-surface-2); }

/* ID cards: CR80 85.6 × 54 mm */
.es-idcard-sheet { display: grid; grid-template-columns: repeat(auto-fill, 85.6mm); gap: 6mm; justify-content: center; }
.es-idcard { width: 85.6mm; height: 54mm; border-radius: 3mm; overflow: hidden; background: #fff; color: #1b1b1f; border: 1px solid #d5d5dd; display: flex; flex-direction: column; font-size: 7.5pt; break-inside: avoid; }
.es-idc-head { display: flex; align-items: center; gap: 2mm; padding: 1.6mm 2.5mm; background: var(--es-accent, #5b5fc7); color: #fff; }
.es-idc-head img { width: 8mm; height: 8mm; object-fit: contain; background: #fff; border-radius: 1.5mm; }
.es-idc-school { font-weight: 800; font-size: 8.5pt; line-height: 1.1; }
.es-idc-sub { font-size: 6pt; opacity: .9; }
.es-idc-body { flex: 1; display: flex; gap: 2.5mm; padding: 2mm 2.5mm; align-items: flex-start; }
.es-idc-photo { width: 20mm; height: 25mm; border-radius: 1.5mm; overflow: hidden; background: #e8e9f8; display: flex; align-items: center; justify-content: center; font-weight: 700; color: #444791; flex: 0 0 auto; }
.es-idc-photo img { width: 100%; height: 100%; object-fit: cover; }
.es-idc-info { flex: 1; min-width: 0; line-height: 1.35; }
.es-idc-name { font-size: 9.5pt; font-weight: 800; line-height: 1.15; margin-bottom: .6mm; }
.es-idc-addr { font-size: 6.5pt; color: #555; }
.es-idc-qr { width: 15mm; height: 15mm; flex: 0 0 auto; align-self: flex-end; }
.es-idc-foot { display: flex; justify-content: space-between; align-items: center; padding: .8mm 2.5mm; background: #f3f3f8; font-size: 6pt; color: #555; }
.es-idc-reissue { border: 0; background: none; color: var(--es-brand); font-size: 6.5pt; padding: 0; text-decoration: underline; }

/* Public verification */
.es-verify { text-align: center; }
.es-verify-card { background: var(--es-surface, #fff); border: 1px solid var(--es-card-border); border-radius: 16px; padding: 28px; box-shadow: var(--es-shadow); }
.es-verify-badge { display: inline-flex; align-items: center; gap: 8px; padding: 8px 18px; border-radius: 999px; font-weight: 700; font-size: 1.05rem; }
.es-verify-badge.ok { background: #e7f2da; color: #0e700e; }
.es-verify-badge.bad { background: #fdf3f4; color: #c4314b; }

@media print {
    .es-a4 { border: 0 !important; box-shadow: none !important; padding: 0 !important; max-width: none; }
    body:has(.es-a4) .es-page-header, body:has(.es-idcard-sheet) .es-page-header, body:has(.es-idcard-sheet) form.es-card { display: none !important; }
    .es-idcard-sheet { grid-template-columns: repeat(2, 85.6mm); gap: 4mm 6mm; }
    .es-idcard { border-color: #999; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    .es-letterhead, .es-idc-head, .es-idc-foot { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    @page { margin: 10mm; }
}

/* =========================================================================
   UP-0009 · Portal, notices, notifications
   ========================================================================= */
.es-childbar { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; background: var(--es-surface, #fff); border: 1px solid var(--es-card-border); border-radius: var(--es-radius); padding: 12px 16px; }
.es-mini-stat { background: var(--es-surface-2); border-radius: 10px; padding: 10px 6px; }
.es-notice { padding: 12px 0; border-bottom: 1px solid var(--es-card-border); }
.es-notice:last-child { border-bottom: 0; }
.es-notice-body { font-size: .92rem; white-space: normal; margin-top: 4px; }
.es-notice-card.pinned, .es-notice.pinned { border-left: 4px solid #c4314b; }
.es-notif { display: flex; gap: 12px; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--es-card-border); color: inherit; text-decoration: none; }
.es-notif:hover { background: var(--es-surface-2); color: inherit; }
.es-notif.unread { background: color-mix(in srgb, var(--es-brand) 7%, transparent); }
.es-notif.unread .fw-semibold::before { content: ''; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--es-brand); margin-right: 6px; vertical-align: middle; }
.es-notif-icon { width: 36px; height: 36px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; background: var(--es-surface-2); color: var(--es-brand); flex: 0 0 auto; }
.es-att-cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.es-att-h { text-align: center; font-size: .75rem; color: var(--es-muted); font-weight: 600; }
.es-att-d { border: 1px solid var(--es-card-border); border-radius: 10px; min-height: 54px; padding: 4px 6px; display: flex; flex-direction: column; justify-content: space-between; font-size: .75rem; }
.es-att-d b { align-self: flex-end; font-size: .9rem; }
.es-att-d.att-present, .es-dot.att-present { background: #e7f2da; color: #0e700e; }
.es-att-d.att-absent, .es-dot.att-absent { background: #fdf3f4; color: #c4314b; }
.es-att-d.att-late, .es-dot.att-late { background: #fff4ce; color: #8a5a00; }
.es-att-d.att-half_day, .es-dot.att-half_day { background: #e8f1fb; color: #0f548c; }
.es-att-d.att-leave, .es-dot.att-leave { background: #f0f0f0; color: #616161; }
.es-att-d.closed { background: repeating-linear-gradient(135deg, var(--es-surface-2), var(--es-surface-2) 4px, transparent 4px, transparent 8px); }
.es-dot { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 4px; vertical-align: middle; border: 1px solid rgba(0,0,0,.08); }
@media (max-width: 576px) {
    .es-letterhead { flex-wrap: wrap; }
    .es-lh-logo { width: 48px; height: 48px; }
    .es-lh-main { flex-basis: calc(100% - 64px); }
    .es-lh-right { width: 100%; }
    .es-lh-right .text-end { text-align: left !important; }
    .es-a4 { padding: 14px !important; }
}

/* UP-0010 · PWA / app */
.es-toast { position: fixed; left: 50%; bottom: 84px; transform: translateX(-50%); z-index: 2000; max-width: min(92vw, 520px); background: #242424; color: #fff; padding: 12px 16px; border-radius: 12px; box-shadow: var(--es-shadow-lg); font-size: .9rem; transition: opacity .3s; }
.es-toast.out { opacity: 0; }
.es-shell { padding-top: env(safe-area-inset-top); }
.es-bottom-nav { padding-bottom: env(safe-area-inset-bottom); }

/* =========================================================================
   UP-0013 · Simpler, smoother UI: inputs, forms, motion, hover states
   (override layer — no markup changes required; dark mode via the same tokens)
   ========================================================================= */
:root {
    --es-ease: cubic-bezier(.2, .8, .2, 1);
    --es-input-bg: #ffffff;
    --es-input-border: #d8dbe7;
    --es-focus-ring: color-mix(in srgb, var(--es-brand) 20%, transparent);
    --es-label: #4a4a57;
}
[data-bs-theme="dark"] {
    --es-input-bg: #1c1c22;
    --es-input-border: #3b3b46;
    --es-label: #c4c4ce;
}

/* ---- Page & element entrance (re-played after every SPA navigation) ---- */
@keyframes es-enter { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes es-pop { from { opacity: 0; } to { opacity: 1; } }
@keyframes es-shake { 10%, 90% { transform: translateX(-1px); } 20%, 80% { transform: translateX(2px); } 30%, 50%, 70% { transform: translateX(-3px); } 40%, 60% { transform: translateX(3px); } }
@keyframes es-pulse-ring { 0% { box-shadow: 0 0 0 0 var(--es-focus-ring); } 100% { box-shadow: 0 0 0 10px transparent; } }
.es-page.es-enter > * { animation: es-enter .42s var(--es-ease) both; }
.es-page.es-enter > *:nth-child(2) { animation-delay: .04s; }
.es-page.es-enter > *:nth-child(3) { animation-delay: .08s; }
.es-page.es-enter > *:nth-child(4) { animation-delay: .12s; }
.es-page.es-enter > *:nth-child(5) { animation-delay: .16s; }
.es-page.es-enter > *:nth-child(n+6) { animation-delay: .2s; }
.es-page.es-enter .row > [class*="col"] > .es-stat,
.es-page.es-enter .es-quick a { animation: es-enter .45s var(--es-ease) both; }
.es-page.es-enter .row > [class*="col"]:nth-child(2) > .es-stat { animation-delay: .05s; }
.es-page.es-enter .row > [class*="col"]:nth-child(3) > .es-stat { animation-delay: .1s; }
.es-page.es-enter .row > [class*="col"]:nth-child(4) > .es-stat { animation-delay: .15s; }
.dropdown-menu.show, .es-menu:not([hidden]) { animation: es-pop .12s ease-out; }
.alert { animation: es-enter .3s var(--es-ease) both; border-radius: 12px; border-width: 1px; }

/* ---- Inputs ---- */
.form-control, .form-select {
    min-height: 44px; font-size: .92rem; color: var(--es-text);
    background-color: var(--es-input-bg); border: 1px solid var(--es-input-border); border-radius: 10px;
    transition: border-color .18s var(--es-ease), box-shadow .18s var(--es-ease), background-color .18s;
}
.form-control { padding: .58rem .9rem; }
.form-select { padding-top: .58rem; padding-bottom: .58rem; padding-left: .9rem; cursor: pointer; }
.form-control-sm, .form-select-sm { min-height: 36px; font-size: .84rem; border-radius: 8px; padding-top: .35rem; padding-bottom: .35rem; }
.form-control:hover:not(:focus):not(:disabled), .form-select:hover:not(:focus):not(:disabled) { border-color: color-mix(in srgb, var(--es-brand) 40%, var(--es-input-border)); }
.form-control:focus, .form-select:focus { border-color: var(--es-brand); box-shadow: 0 0 0 4px var(--es-focus-ring); background-color: var(--es-input-bg); outline: 0; }
.form-control::placeholder { color: var(--es-muted); opacity: .6; transition: opacity .18s; }
.form-control:focus::placeholder { opacity: .35; }
.form-control:disabled, .form-select:disabled, .form-control[readonly] { background-color: var(--es-surface-2); opacity: 1; cursor: not-allowed; }
textarea.form-control { min-height: 104px; line-height: 1.55; resize: vertical; }
.form-control[type="color"] { width: 64px; padding: 5px; }
.form-control[type="file"] { padding: .45rem .55rem; }
.form-control::file-selector-button { border: 0; border-radius: 7px; background: var(--es-brand-soft); color: var(--es-brand); font-weight: 600; padding: .38rem .85rem; margin: -.1rem .8rem -.1rem 0; transition: background-color .15s; }
.form-control:hover::file-selector-button { background: color-mix(in srgb, var(--es-brand) 20%, var(--es-brand-soft)); }
.form-label { font-size: .8rem; font-weight: 600; color: var(--es-label); margin-bottom: 6px; letter-spacing: .01em; transition: color .15s; }
[class*="col"]:focus-within > .form-label, .mb-2:focus-within > .form-label, .mb-3:focus-within > .form-label { color: var(--es-brand); }
.form-text { font-size: .76rem; color: var(--es-muted); margin-top: 6px; }
.form-control.is-invalid, .form-select.is-invalid { border-color: var(--bs-danger); animation: es-shake .4s ease both; background-image: none; padding-right: .9rem; }
.form-select.is-invalid { padding-right: 2.25rem; }
.form-control.is-invalid:focus, .form-select.is-invalid:focus { box-shadow: 0 0 0 4px rgba(220, 53, 69, .15); }
.invalid-feedback { font-size: .78rem; font-weight: 500; }
.invalid-feedback.d-block::before { content: "\F333"; font-family: "bootstrap-icons"; margin-right: 5px; vertical-align: -1px; }
.form-check-input { cursor: pointer; transition: background-color .15s, border-color .15s, box-shadow .15s, background-position .2s var(--es-ease); }
.form-check-input:focus { box-shadow: 0 0 0 4px var(--es-focus-ring); border-color: var(--es-brand); }
.form-switch .form-check-input { width: 2.4em; height: 1.3em; margin-top: .1em; }
.form-check-label { cursor: pointer; }
input[type="date"].form-control, input[type="time"].form-control, input[type="datetime-local"].form-control, input[type="month"].form-control { cursor: pointer; }
.input-group > .form-control, .input-group > .form-select { min-height: 44px; }
.input-group-text { border-color: var(--es-input-border); background: var(--es-surface-2); border-radius: 10px; color: var(--es-muted); }

/* ---- Form layout: clear numbered sections + sticky action bar ---- */
form.es-card, .es-card:has(> .es-form-section) { counter-reset: es-sec; }
.es-form-section { padding: 26px 28px 28px; position: relative; }
.es-form-section h3 { display: flex; align-items: center; gap: 10px; font-size: 1rem; font-weight: 700; margin: 0 0 4px; }
.es-form-section h3::before {
    counter-increment: es-sec; content: counter(es-sec);
    flex: 0 0 26px; height: 26px; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center;
    font-size: .78rem; font-weight: 700; background: var(--es-brand-soft); color: var(--es-brand);
}
.es-form-section h3 + p { margin-left: 36px; }
.es-form-section > p { font-size: .82rem; color: var(--es-muted); margin: 0 0 18px; }
.es-form-section h3:only-child, .es-form-section h3 + .row { margin-bottom: 18px; }
.es-form-section .row { --bs-gutter-y: 1.15rem; }
.es-form-foot {
    position: sticky; bottom: 0; z-index: 6; align-items: center;
    padding: 14px 28px; gap: 10px;
    background: color-mix(in srgb, var(--es-card-bg) 86%, transparent);
    -webkit-backdrop-filter: saturate(160%) blur(10px); backdrop-filter: saturate(160%) blur(10px);
    box-shadow: 0 -10px 24px -18px rgba(16, 24, 40, .35);
}
.es-form-foot .es-req-hint { font-size: .76rem; color: var(--es-muted); margin-right: auto; }
@media (max-width: 991.98px) { .es-form-foot { bottom: var(--es-bottom-h); padding: 12px 16px; } .es-form-foot .es-req-hint { display: none; } .es-form-section { padding: 20px 16px 22px; } }
.text-danger.req, label .text-danger { font-weight: 700; }

/* ---- Buttons: lift on hover, press on click ---- */
.btn { font-weight: 600; min-height: 40px; padding: .5rem 1rem; display: inline-flex; align-items: center; justify-content: center; gap: 2px;
    transition: transform .14s var(--es-ease), box-shadow .2s var(--es-ease), background-color .18s, border-color .18s, color .18s; }
.btn-sm { min-height: 32px; padding: .28rem .7rem; font-size: .8rem; }
.btn-lg { min-height: 48px; }
.btn-link { min-height: 0; }
.btn:not(:disabled):not(.disabled):not(.btn-link):hover { transform: translateY(-1px); }
.btn:not(:disabled):not(.disabled):not(.btn-link):active { transform: translateY(0) scale(.97); transition-duration: .06s; }
.btn-primary { background-image: linear-gradient(180deg, rgba(255, 255, 255, .14), rgba(255, 255, 255, 0)); }
.btn-primary:not(:disabled):hover { box-shadow: 0 8px 18px -6px color-mix(in srgb, var(--es-brand) 70%, transparent); }
.btn-outline-secondary { --bs-btn-color: var(--es-text); --bs-btn-border-color: var(--es-input-border); --bs-btn-hover-bg: var(--es-surface-2); --bs-btn-hover-color: var(--es-text); --bs-btn-hover-border-color: color-mix(in srgb, var(--es-brand) 40%, var(--es-input-border)); --bs-btn-active-bg: var(--es-surface-2); --bs-btn-active-color: var(--es-text); }
.btn.es-busy { position: relative; color: transparent !important; }
.btn.es-busy::after { content: ""; position: absolute; width: 16px; height: 16px; border-radius: 50%; border: 2px solid currentColor; border-color: rgba(255, 255, 255, .9) rgba(255, 255, 255, .9) rgba(255, 255, 255, .25) rgba(255, 255, 255, .25); animation: es-spin .7s linear infinite; }
.btn-outline-secondary.es-busy::after, .btn-outline-primary.es-busy::after, .btn-light.es-busy::after { border-color: var(--es-brand) var(--es-brand) var(--es-brand-soft) var(--es-brand-soft); }
@keyframes es-spin { to { transform: rotate(360deg); } }
:focus-visible { outline: 2px solid var(--es-brand); outline-offset: 2px; }
.btn:focus-visible { box-shadow: 0 0 0 4px var(--es-focus-ring); outline: 0; }

/* ---- Cards, tiles, tables: gentle hover feedback ---- */
.es-card, .es-stat { transition: box-shadow .22s var(--es-ease), transform .22s var(--es-ease), border-color .22s; }
a.es-stat:hover, a.es-card:hover, .es-quick a:hover, .es-app-tile:hover {
    transform: translateY(-3px); box-shadow: var(--es-shadow-lg);
    border-color: color-mix(in srgb, var(--es-brand) 30%, var(--es-card-border));
}
.es-quick a i { transition: transform .25s var(--es-ease); }
.es-quick a:hover i { transform: scale(1.15) rotate(-4deg); }
.es-stat-icon { transition: transform .25s var(--es-ease); }
.es-stat:hover .es-stat-icon { transform: scale(1.06); }
.es-table tbody tr { transition: background-color .15s, box-shadow .15s; }
.es-table tbody tr:hover > td:first-child { box-shadow: inset 3px 0 0 var(--es-brand); }
.es-table td a.fw-semibold, .es-table td a.es-cell-title { transition: color .15s; }
.es-row-actions .btn, .es-table .btn-outline-secondary { transition: transform .15s var(--es-ease), background-color .15s; }
.es-table tbody tr:hover .bi-chevron-right { transform: translateX(2px); }
.es-table .bi-chevron-right { display: inline-block; transition: transform .18s var(--es-ease); }

/* ---- Tabs with sliding underline feel ---- */
.es-tabs { border-bottom: 1px solid var(--es-card-border); flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
.es-tabs::-webkit-scrollbar { display: none; }
.es-tabs .nav-link { white-space: nowrap; position: relative; border-bottom: 0 !important; transition: color .18s; }
.es-tabs .nav-link::after { content: ""; position: absolute; left: 12px; right: 12px; bottom: -1px; height: 3px; border-radius: 3px 3px 0 0; background: var(--es-brand); transform: scaleX(0); transition: transform .25s var(--es-ease); }
.es-tabs .nav-link:hover { color: var(--es-text); }
.es-tabs .nav-link.active::after { transform: scaleX(1); }

/* ---- Navigation feedback ---- */
.es-panel-item { transition: background-color .15s, color .15s, box-shadow .15s, transform .15s var(--es-ease); }
.es-panel-item:hover:not(.active) { transform: translateX(2px); }
.es-rail-item { transition: background-color .15s, color .15s, transform .15s var(--es-ease); }
.es-rail-item:hover:not(.active) { transform: translateY(-1px); }
.es-rail-item i { transition: transform .2s var(--es-ease); }
.es-rail-item.active i { transform: scale(1.08); }

/* ---- Toolbar search used by the module lists ---- */
.es-toolbar-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; flex: 1 1 420px; justify-content: flex-end; }
.es-toolbar-form input[type="date"] { width: auto; flex: 0 0 auto; }
.es-toolbar-form .es-search { max-width: 380px; }
.es-toolbar-form .es-search { position: relative; min-width: 220px; flex: 1 1 240px; }
.es-toolbar-form .es-search i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--es-muted); pointer-events: none; }
.es-toolbar-form .es-search .form-control { padding-left: 36px; }
.es-toolbar-form .form-select, .es-toolbar-form .form-control { min-height: 38px; font-size: .85rem; border-radius: 9px; }
.es-toolbar-form .form-select { width: auto; max-width: 220px; }
.es-chip-clear { font-size: .8rem; text-decoration: none; }
details.es-settings > summary { cursor: pointer; list-style: none; font-weight: 600; font-size: .85rem; color: var(--es-muted); display: inline-flex; align-items: center; gap: 6px; }
details.es-settings > summary::-webkit-details-marker { display: none; }
details.es-settings[open] > summary { color: var(--es-brand); margin-bottom: 12px; }
details.es-settings > summary .bi-chevron-down { transition: transform .2s var(--es-ease); }
details.es-settings[open] > summary .bi-chevron-down { transform: rotate(180deg); }
.es-empty-row td i.fs-2 { display: inline-flex !important; width: 64px; height: 64px; border-radius: 50%; align-items: center; justify-content: center; background: var(--es-brand-soft); color: var(--es-brand); margin-bottom: 12px; }

/* ---- Badges / pills ---- */
.badge.rounded-pill { font-weight: 600; padding: .38em .75em; letter-spacing: .01em; }

/* ---- Respect people who prefer less motion ---- */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .001ms !important; animation-delay: 0s !important; transition-duration: .001ms !important; }
    .btn:hover, a.es-stat:hover, a.es-card:hover, .es-quick a:hover { transform: none !important; }
}
@media print {
    .es-page.es-enter > * { animation: none !important; }
    .es-form-foot { position: static; }
}
.es-form-foot .btn { white-space: nowrap; }
@media (max-width: 575.98px) {
    .es-form-foot { flex-wrap: wrap; }
    .es-form-foot .btn { flex: 1 1 0; }
    .es-form-foot .btn-primary.es-btn:last-child { flex: 1 1 100%; order: -1; }
    .es-page-actions { width: 100%; }
    .es-page-actions .btn { flex: 1 1 auto; }
}
@media (max-width: 575.98px) { .es-toolbar-form .form-select, .es-toolbar-form input[type="date"] { flex: 1 1 140px; max-width: none; } }

/* =========================================================================
   UP-0014 — EaseBill ERP Design System & UI/UX Upgrade
   Matches reference: E:\MyStuff\Apps\EaseBill
   ========================================================================= */

/* Global Body & Surface */
body {
    font-family: var(--font-sans);
    background-color: var(--bg-main) !important;
    color: var(--text-primary) !important;
    -webkit-font-smoothing: antialiased;
}

/* ================= AUTHENTICATION (Image 1) ================= */
.auth-page, .es-auth-page {
    min-height: 100vh;
    background: radial-gradient(circle at 8% 8%, #172D52 0%, #0B1120 42%, #080E1B 100%) !important;
    color: #F8FAFC !important;
    font-family: var(--font-sans);
}
.auth-layout {
    width: min(1260px, 100% - 48px);
    margin: 0 auto;
    display: grid;
    grid-template-columns: 1fr 480px;
    gap: 64px;
    align-items: center;
    min-height: 100vh;
    padding: 48px 0;
}
.auth-hero-brand-name {
    font-size: 20px;
    font-weight: 800;
    letter-spacing: -0.3px;
    color: #F8FAFC;
}
.auth-mark-sm {
    width: 34px;
    height: 34px;
    border-radius: 9px;
    display: inline-grid;
    place-items: center;
    background: linear-gradient(135deg, #3B82F6, #1D4ED8);
    color: #fff;
    font-size: 15px;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}
.auth-hero h1 {
    font-size: 52px;
    font-weight: 800;
    line-height: 1.14;
    letter-spacing: -2px;
    color: #F8FAFC;
    margin: 0 0 20px;
}
.auth-hero h1 span {
    color: #38BDF8;
    background: linear-gradient(135deg, #60A5FA 0%, #38BDF8 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}
.hero-copy {
    font-size: 16.5px;
    line-height: 1.7;
    color: #94A3B8;
    max-width: 680px;
    margin: 0;
}
.hero-perks {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-top: 24px;
    padding: 14px 18px;
    border: 1px solid rgba(255, 255, 255, 0.11);
    border-radius: 12px;
    background: #131E35;
}
.hero-perks span {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13.5px;
    font-weight: 600;
    color: #E2E8F0;
}
.hero-perks i {
    color: #60A5FA !important;
    background: rgba(59, 130, 246, 0.18) !important;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: inline-grid;
    place-items: center;
    font-size: 13px;
    flex-shrink: 0;
}
.auth-hero hr {
    border: 0;
    border-top: 1px solid rgba(255, 255, 255, 0.12);
    margin: 28px 0 16px;
}
.auth-hero h2 {
    font-size: 18px;
    font-weight: 700;
    color: #F8FAFC;
    margin: 0 0 18px;
}
.hero-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    gap: 13px;
}
.hero-list li {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14.5px;
    color: #94A3B8;
}
.hero-list li b {
    color: #F8FAFC;
}
.hero-list i {
    display: inline-grid;
    place-items: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    color: #38BDF8 !important;
    background: rgba(59, 130, 246, 0.18) !important;
    font-size: 12px;
    flex-shrink: 0;
}
.hero-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    margin-top: 28px;
    padding: 16px;
    border: 1px solid rgba(59, 130, 246, 0.32);
    border-radius: 14px;
    background: #131E35;
}
.hero-stats span {
    padding: 0 14px;
    border-right: 1px solid rgba(255, 255, 255, 0.1);
    color: #94A3B8;
    font-size: 12px;
}
.hero-stats span:last-child {
    border: 0;
}
.hero-stats b {
    display: block;
    color: #F8FAFC;
    font-size: 17px;
    font-weight: 700;
}

/* Auth Floating Card */
.auth-card {
    background: #18233C !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    border-radius: 16px !important;
    padding: 34px !important;
    box-shadow: 0 23px 50px rgba(0, 0, 0, 0.45) !important;
    color: #F8FAFC !important;
}
.auth-card-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 22px;
}
.auth-card-top h2 {
    font-size: 22px;
    font-weight: 800;
    color: #F8FAFC;
    letter-spacing: -0.4px;
    margin: 0 0 6px;
}
.auth-card-top p {
    font-size: 13.5px;
    color: #94A3B8;
    margin: 0;
}
.auth-mark {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    color: #FFF !important;
    background: linear-gradient(135deg, #3B82F6, #1D4ED8) !important;
    font-size: 20px;
    box-shadow: 0 8px 20px rgba(59, 130, 246, 0.35);
    flex-shrink: 0;
}
.auth-mark i {
    color: #FFF !important;
}
.auth-form {
    display: grid;
    gap: 16px;
}
.auth-form label {
    display: grid;
    gap: 7px;
    color: #94A3B8;
    font-size: 13px;
    font-weight: 600;
}
.input-wrap {
    display: flex;
    align-items: center;
    gap: 12px;
    height: 48px;
    padding: 0 14px;
    border: 1px solid rgba(255, 255, 255, 0.14) !important;
    border-radius: 10px;
    background: #0B1120 !important;
    transition: border-color .15s, box-shadow .15s;
    position: relative;
    width: 100%;
}
.input-wrap:focus-within {
    border-color: #3B82F6 !important;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.25) !important;
}
.input-wrap i {
    color: #60A5FA !important;
    font-size: 16px;
    flex-shrink: 0;
}
.input-wrap input {
    flex: 1;
    min-width: 0;
    border: 0 !important;
    background: transparent !important;
    color: #F8FAFC !important;
    font-size: 14.5px !important;
    box-shadow: none !important;
    outline: none !important;
    padding: 0 !important;
}
.input-wrap input::placeholder {
    color: #64748B !important;
}
.input-wrap .es-eye {
    border: 0;
    background: transparent;
    color: #94A3B8;
    cursor: pointer;
    padding: 4px;
    font-size: 15px;
}
.input-wrap .es-eye:hover {
    color: #F8FAFC;
}
.auth-primary {
    width: 100%;
    height: 46px;
    border: 0;
    border-radius: 10px;
    color: #FFF;
    background: linear-gradient(135deg, #3B82F6 0%, #2563EB 100%);
    box-shadow: 0 8px 20px rgba(59, 130, 246, 0.3);
    font: 700 14.5px var(--font-sans);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: transform .15s, box-shadow .15s;
}
.auth-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 12px 25px rgba(59, 130, 246, 0.42);
    background: linear-gradient(135deg, #2563EB 0%, #1D4ED8 100%);
}
.auth-card-bottom a {
    color: #38BDF8;
    text-decoration: none;
}
.auth-card-bottom a:hover {
    text-decoration: underline;
}

@media (max-width: 1080px) {
    .auth-layout { grid-template-columns: 1fr; gap: 40px; padding: 32px 16px; }
    .auth-hero h1 { font-size: 40px; }
    .hero-stats { grid-template-columns: repeat(2, 1fr); gap: 12px; }
}
@media (max-width: 640px) {
    .auth-hero h1 { font-size: 32px; letter-spacing: -1px; }
    .hero-perks { grid-template-columns: 1fr; }
    .hero-stats { display: none; }
    .auth-card { padding: 24px !important; }
}

/* ================= TOPBAR & SHELL (Image 2) ================= */
.es-header, .topbar-teams {
    position: fixed;
    inset: 0 0 auto 0;
    height: 64px !important;
    z-index: 1040;
    background: #0F1A30 !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px !important;
}
.es-brand-mark {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: inline-grid;
    place-items: center;
    background: linear-gradient(135deg, #3B82F6 0%, #1D4ED8 100%) !important;
    box-shadow: 0 4px 14px rgba(59, 130, 246, 0.35);
    color: #FFF !important;
    font-size: 16px;
}
.es-brand-name {
    font-size: 16px;
    font-weight: 800;
    letter-spacing: -0.3px;
    color: #F8FAFC !important;
}
.es-header-search {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    max-width: 480px;
    height: 38px;
    padding: 0 14px;
    border-radius: 20px;
    background: #0B1120 !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    margin: 0 auto;
    transition: border-color .15s, box-shadow .15s;
    position: relative;
}
.es-header-search:focus-within {
    border-color: #3B82F6 !important;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2) !important;
}
.es-header-search i.search-icon {
    color: #64748B;
    font-size: 13.5px;
}
.es-header-search input {
    background: transparent !important;
    border: 0 !important;
    color: #F8FAFC !important;
    font-size: 13.5px !important;
    width: 100% !important;
    outline: none !important;
    padding: 0 !important;
}
.es-header-search kbd {
    background: #18233C;
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: #94A3B8;
    border-radius: 5px;
    padding: 2px 7px;
    font-size: 11px;
    font-family: var(--font-mono);
}

/* User avatar pill matching EaseBill */
.tb-avatar {
    position: relative;
    width: 38px;
    height: 38px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    cursor: pointer;
}
.tb-avatar-circle {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #8B5CF6, #3B82F6);
    color: #fff;
    font: 700 13px var(--font-sans);
    letter-spacing: .3px;
}
.tb-avatar-circle.sm {
    width: 30px;
    height: 30px;
    font-size: 11px;
}
/* status-dot positioning is handled in .es-avatar-btn.tb-avatar below */
.user-menu-list {
    min-width: 270px;
    background: #18233C !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    border-radius: 12px;
    box-shadow: 0 14px 40px rgba(0, 0, 0, 0.45);
    padding: 8px 0;
    color: #F8FAFC !important;
}
.user-menu-list .dropdown-item {
    color: #CBD5E1 !important;
    padding: 8px 16px;
    font-size: 13.5px;
    display: flex;
    align-items: center;
}
.user-menu-list .dropdown-item:hover {
    background: rgba(255, 255, 255, 0.08) !important;
    color: #F8FAFC !important;
}

/* School badge */
.es-school-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: #F8FAFC;
    font-size: 13px;
    font-weight: 600;
}
.es-school-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.15);
}

/* ================= TEAMS-STYLE RAIL & PANEL (Image 2, 3, 4) ================= */
.es-body {
    display: flex;
    padding-top: 64px !important;
    min-height: 100vh;
    background: #0B1120 !important;
    overflow-x: hidden !important;
}
.es-rail, .tm-rail {
    width: 76px !important;
    flex: none;
    height: calc(100vh - 64px) !important;
    position: fixed;
    left: 0;
    top: 64px;
    background: #0B1120 !important;
    border-right: 1px solid rgba(255, 255, 255, 0.08) !important;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 12px 0 16px;
    z-index: 1030;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    scrollbar-width: none !important;
    -ms-overflow-style: none !important;
}
.es-rail::-webkit-scrollbar, .tm-rail::-webkit-scrollbar,
.es-rail::-webkit-scrollbar:horizontal, .tm-rail::-webkit-scrollbar:horizontal {
    display: none !important;
    width: 0 !important;
    height: 0 !important;
}
.tm-rail-list {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    width: 100%;
    overflow-x: hidden !important;
}
.tm-rail-btn, .es-rail-item {
    position: relative;
    width: 66px !important;
    max-width: 66px !important;
    min-height: 52px !important;
    padding: 6px 2px !important;
    border: 0;
    border-radius: 10px !important;
    background: transparent !important;
    color: #94A3B8 !important;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px !important;
    cursor: pointer;
    text-decoration: none;
    font-size: 10.5px !important;
    font-weight: 600 !important;
    letter-spacing: .1px;
    transition: background .15s, color .15s;
    overflow: hidden !important;
}
.tm-rail-btn i, .es-rail-item i {
    font-size: 18px !important;
    line-height: 1 !important;
    display: inline-block !important;
    transition: transform .15s;
}
.tm-rail-btn span, .es-rail-item span {
    line-height: 1.1;
    white-space: nowrap;
    max-width: 62px;
    overflow: hidden;
    text-overflow: ellipsis;
}
.tm-rail-btn:hover, .es-rail-item:hover {
    background: rgba(255, 255, 255, 0.06) !important;
    color: #F8FAFC !important;
}
.tm-rail-btn:hover i, .es-rail-item:hover i {
    transform: scale(1.08);
}
.tm-rail-btn.is-active, .tm-rail-btn.active, .es-rail-item.active {
    color: #3B82F6 !important;
    font-weight: 700 !important;
}
.tm-rail-btn.is-active::before, .tm-rail-btn.active::before, .es-rail-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 10px;
    bottom: 10px;
    width: 4px;
    border-radius: 0 4px 4px 0;
    background: #3B82F6;
}
.tm-version {
    font-size: 11px;
    color: #64748B;
    text-decoration: none;
    margin-top: auto;
    padding-top: 12px;
    white-space: nowrap;
}

/* Slideout Secondary Sub-Panel */
.es-panel, .tm-panel {
    width: var(--es-panel-w, 260px) !important;
    max-width: var(--es-panel-w, 260px) !important;
    height: calc(100vh - 64px) !important;
    position: fixed;
    left: 76px;
    top: 64px;
    background: #131B2E !important;
    border-right: 1px solid rgba(255, 255, 255, 0.08) !important;
    display: flex;
    flex-direction: column;
    z-index: 1020;
    transition: width .22s ease, transform .22s ease;
    overflow-x: hidden !important;
    scrollbar-width: none !important;
    -ms-overflow-style: none !important;
}
.es-panel::-webkit-scrollbar, .tm-panel::-webkit-scrollbar,
.es-panel::-webkit-scrollbar:horizontal, .tm-panel::-webkit-scrollbar:horizontal {
    display: none !important;
    width: 0 !important;
    height: 0 !important;
}
.tm-panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 16px 14px !important;
    background: #131B2E !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06) !important;
    flex-shrink: 0;
}
.tm-panel-head h2 {
    margin: 0;
    font-size: 18px !important;
    font-weight: 800 !important;
    letter-spacing: -0.3px;
    color: #F8FAFC !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.tm-panel-close {
    width: 30px;
    height: 30px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: #64748B;
    cursor: pointer;
    display: grid;
    place-items: center;
    flex-shrink: 0;
}
.tm-panel-close:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #F8FAFC;
}
.tm-panel-group, .es-panel-list {
    flex: 1 1 auto;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.12) transparent;
}
.tm-panel-group::-webkit-scrollbar, .es-panel-list::-webkit-scrollbar {
    width: 4px;
}
.tm-panel-group::-webkit-scrollbar-thumb, .es-panel-list::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.12);
    border-radius: 4px;
}
.tm-panel-group::-webkit-scrollbar:horizontal, .es-panel-list::-webkit-scrollbar:horizontal {
    display: none !important;
    height: 0 !important;
}
.tm-items {
    list-style: none;
    padding: 8px !important;
    margin: 0;
    display: grid;
    gap: 3px;
    overflow-x: hidden !important;
}
.tm-item, .es-panel-item {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 8px 10px !important;
    border-radius: 10px !important;
    color: #94A3B8 !important;
    text-decoration: none;
    font-size: 13.5px !important;
    font-weight: 500 !important;
    transition: all .15s;
    max-width: 100% !important;
    overflow: hidden !important;
}
.tm-item i, .es-panel-item i {
    width: 28px !important;
    height: 28px !important;
    flex: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50% !important;
    background: rgba(255, 255, 255, 0.05) !important;
    color: #64748B !important;
    font-size: 13px !important;
}
.tm-item span:first-of-type, .es-panel-item span:first-of-type {
    flex: 1 1 auto;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}
.tm-item .es-pill, .es-panel-item .es-pill {
    flex: 0 0 auto !important;
    flex-shrink: 0 !important;
    margin-left: auto !important;
    white-space: nowrap !important;
    overflow: visible !important;
    padding: 2px 7px !important;
    font-size: 0.65rem !important;
    font-weight: 600 !important;
    border-radius: 999px !important;
    letter-spacing: 0.02em !important;
}
.tm-item:hover, .es-panel-item:hover {
    background: rgba(255, 255, 255, 0.06) !important;
    color: #F8FAFC !important;
}
.tm-item.is-active, .tm-item.active, .es-panel-item.active {
    background: rgba(59, 130, 246, 0.16) !important;
    color: #F8FAFC !important;
    font-weight: 700 !important;
}
.tm-item.is-active i, .tm-item.active i, .es-panel-item.active i {
    background: #3B82F6 !important;
    color: #FFF !important;
}
.tm-panel-user, .es-panel-foot {
    padding: 12px 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex-shrink: 0;
    overflow-x: hidden !important;
    white-space: nowrap;
}
.tm-panel-user .user-name, .es-panel-foot > div {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Main Content Area */
.es-main, .content-body {
    margin-left: 320px !important;
    flex: 1;
    padding: 26px 30px !important;
    min-width: 0;
    background: #0B1120 !important;
    transition: margin-left .22s ease;
}
body.es-panel-collapsed .es-panel {
    width: 0 !important;
    border: 0 !important;
    overflow: hidden !important;
}
body.es-panel-collapsed .es-main {
    margin-left: 76px !important;
}

/* ================= DASHBOARD & KPI CARDS (Image 2) ================= */
.dash-icon-badge {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    background: rgba(59, 130, 246, 0.16);
    color: #3B82F6;
    font-size: 20px;
}
.page-title {
    font-size: 24px !important;
    font-weight: 800 !important;
    letter-spacing: -0.5px;
    color: #F8FAFC !important;
}
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 18px;
}
.kpi-card {
    background: #18233C !important;
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
    border-radius: 14px !important;
    padding: 20px !important;
    box-shadow: 0 4px 20px -2px rgba(0, 0, 0, 0.35) !important;
    transition: transform 0.2s ease, border-color 0.2s ease;
    display: block;
}
.kpi-card:hover {
    transform: translateY(-2px);
    border-color: rgba(59, 130, 246, 0.4) !important;
}
.kpi-icon-box {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    display: grid;
    place-items: center;
    font-size: 16px;
}
.bg-info-subtle {
    background: rgba(6, 182, 212, 0.12) !important;
}
.bg-warning-subtle {
    background: rgba(245, 158, 11, 0.12) !important;
}
.bg-purple-subtle {
    background: rgba(139, 92, 246, 0.12) !important;
}
.bg-success-subtle {
    background: rgba(16, 185, 129, 0.12) !important;
}
.text-purple {
    color: #8B5CF6 !important;
}

/* ================= CARDS, TABLES, FORMS (Images 4 & 5) ================= */
.card, .es-card {
    background-color: #18233C !important;
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
    border-radius: 14px !important;
    box-shadow: 0 4px 20px -2px rgba(0, 0, 0, 0.35) !important;
    color: #F8FAFC !important;
}
.card-header, .es-card-head {
    background-color: transparent !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
    padding: 16px 20px !important;
    color: #F8FAFC !important;
}
.card-body {
    padding: 20px !important;
}
.card-footer {
    background-color: rgba(0, 0, 0, 0.15) !important;
    border-top: 1px solid rgba(255, 255, 255, 0.08) !important;
    padding: 14px 20px !important;
}

/* Tables matching EaseBill Image 4 */
.table, .data-table, .es-table {
    color: #F8FAFC !important;
    border-collapse: separate;
    border-spacing: 0;
    margin-bottom: 0;
}
.table th, .data-table th, .es-table th {
    background: #131E35 !important;
    color: #94A3B8 !important;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 12px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
    border-top: 0 !important;
}
.table td, .data-table td, .es-table td {
    padding: 13px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05) !important;
    color: #F8FAFC;
    vertical-align: middle;
}
.table tbody tr:hover td, .data-table tbody tr:hover td, .es-table tbody tr:hover td {
    background: #1E2D4C !important;
}

/* Forms and Inputs matching EaseBill Image 5 */
.form-control, .form-select {
    background-color: #0B1120 !important;
    border: 1px solid rgba(255, 255, 255, 0.12) !important;
    color: #F8FAFC !important;
    border-radius: 8px !important;
    padding: 9px 13px !important;
    font-size: 14px !important;
}
.form-control:focus, .form-select:focus {
    background-color: #0B1120 !important;
    border-color: #3B82F6 !important;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.25) !important;
    color: #F8FAFC !important;
}
.form-control::placeholder {
    color: #64748B !important;
}
.form-label {
    color: #94A3B8 !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    margin-bottom: 6px !important;
}

/* Buttons */
.btn-primary {
    background: linear-gradient(135deg, #3B82F6 0%, #2563EB 100%) !important;
    border-color: #3B82F6 !important;
    color: #FFF !important;
    box-shadow: 0 6px 16px rgba(59, 130, 246, 0.3) !important;
    font-weight: 700 !important;
    border-radius: 9px !important;
    transition: transform .15s, box-shadow .15s;
}
.btn-primary:hover {
    background: linear-gradient(135deg, #2563EB 0%, #1D4ED8 100%) !important;
    transform: translateY(-1px);
    box-shadow: 0 8px 22px rgba(59, 130, 246, 0.42) !important;
}
.btn-secondary {
    background-color: #1E2D4C !important;
    border-color: rgba(255, 255, 255, 0.1) !important;
    color: #F8FAFC !important;
    font-weight: 600 !important;
    border-radius: 9px !important;
}
.btn-secondary:hover {
    background-color: #26385E !important;
    color: #FFF !important;
}
.btn-outline-secondary {
    border-color: rgba(255, 255, 255, 0.14) !important;
    color: #94A3B8 !important;
    border-radius: 9px !important;
}
.btn-outline-secondary:hover {
    background-color: rgba(255, 255, 255, 0.08) !important;
    color: #F8FAFC !important;
}

/* Quick Action Tiles on Dashboard */
.es-quick {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 12px;
}
.es-quick-link, .es-quick a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    border-radius: 10px;
    background: #131E35 !important;
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
    color: #F8FAFC !important;
    text-decoration: none;
    font-size: 13.5px;
    font-weight: 600;
    transition: all .15s;
}
.es-quick-link:hover, .es-quick a:hover {
    background: #1E2D4C !important;
    border-color: rgba(59, 130, 246, 0.35) !important;
    transform: translateY(-1px);
}
.es-quick-link i, .es-quick a i {
    color: #38BDF8;
    font-size: 15px;
}

/* =========================================================================
   Header School Pill + User Label (EaseBill topbar style)
   ========================================================================= */

/* School name pill in topbar left area */
.es-header-school-pill {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 5px 12px 5px 10px;
    background: rgba(59, 130, 246, 0.10);
    border: 1px solid rgba(59, 130, 246, 0.22);
    border-radius: 999px;
    margin-left: 8px;
    color: #93C5FD;
    font-size: .8rem;
    font-weight: 600;
    white-space: nowrap;
    max-width: 260px;
    overflow: hidden;
    text-overflow: ellipsis;
}
.es-header-school-pill i {
    font-size: .9rem;
    flex-shrink: 0;
}
.es-hsp-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* School header dropdown button (text + chevron, matches screenshot) */
.es-school-hdr-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 10px;
    background: rgba(255,255,255,.06);
    border: 1px solid rgba(255,255,255,.12);
    border-radius: 7px;
    color: var(--es-text, #F8FAFC);
    cursor: pointer;
    transition: background .15s;
    max-width: 280px;
}
.es-school-hdr-btn:hover {
    background: rgba(255,255,255,.12);
}
.es-school-hdr-name {
    font-size: .85rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 220px;
}
.es-school-hdr-caret {
    font-size: .7rem;
    color: var(--es-muted, #94A3B8);
    flex-shrink: 0;
    transition: transform .15s;
}
.es-school-hdr-btn[aria-expanded="true"] .es-school-hdr-caret {
    transform: rotate(180deg);
}

/* Header-left New button alignment */
.es-header-left .es-new-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    font-size: .82rem;
    font-weight: 700;
    border-radius: 7px;
    white-space: nowrap;
}

/* User name + role label shown next to avatar circle in topbar */
.tb-user-label {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    line-height: 1.2;
    margin-left: 6px;
    margin-right: 2px;
    max-width: 150px;
}
.tb-user-name {
    font-size: .82rem;
    font-weight: 700;
    color: var(--es-text, #F8FAFC);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 140px;
}
.tb-user-role {
    font-size: .68rem;
    color: var(--es-muted, #94A3B8);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 140px;
}

/* Avatar button adjusts when user label is shown — override fixed w/h/radius from original */
.es-avatar-btn.tb-avatar {
    display: inline-flex !important;
    align-items: center !important;
    gap: 6px !important;
    width: auto !important;
    height: auto !important;
    border-radius: 8px !important;
    padding: 4px 8px 4px 4px !important;
    transition: background .15s;
}
.es-avatar-btn.tb-avatar:hover {
    background: rgba(255, 255, 255, .10);
}

/* Wrap avatar circle so status-dot can anchor to it */
.es-avatar-btn.tb-avatar .tb-avatar-circle {
    position: relative;
    flex-shrink: 0;
}

/* Status dot anchors to the avatar circle, not the full button */
.es-avatar-btn.tb-avatar .status-dot {
    position: absolute;
    right: -1px;
    bottom: -1px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #10B981;
    box-shadow: 0 0 0 2px var(--es-header-bg, #0F1A30);
    pointer-events: none;
}

/* Avatar circle small variant */
.tb-avatar-circle.sm {
    width: 26px;
    height: 26px;
    font-size: .58rem;
}

/* =========================================================================
   Panel Footer: Sticky "New" Button + User Info Card
   ========================================================================= */

.es-panel-foot-wrap {
    margin-top: auto;
    border-top: 1px solid var(--es-border, rgba(255,255,255,.08));
    flex-shrink: 0;
}

/* "New" add button */
.es-panel-add {
    padding: 10px 12px;
    border-bottom: 1px solid var(--es-border, rgba(255,255,255,.08));
}
.es-panel-add-btn {
    display: flex !important;
    align-items: center;
    gap: 8px;
    padding: 8px 14px !important;
    border-radius: 8px !important;
    font-size: .875rem;
    font-weight: 600;
    letter-spacing: .01em;
    background: linear-gradient(135deg, #3B82F6 0%, #2563EB 100%) !important;
    border-color: #3B82F6 !important;
    box-shadow: 0 4px 14px rgba(59,130,246,.28) !important;
    transition: transform .15s, box-shadow .15s;
}
.es-panel-add-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(59,130,246,.4) !important;
}
.es-panel-add-btn .es-panel-add-caret {
    font-size: .75rem;
    transition: transform .15s;
}
.es-panel-add .show .es-panel-add-caret {
    transform: rotate(180deg);
}
.es-panel-add .es-new-menu {
    bottom: calc(100% + 4px);
    top: auto !important;
    transform: none !important;
}

/* Panel footer user card */
.es-panel-foot.tm-panel-user {
    padding: 12px 16px;
}
.epf-school {
    font-size: .72rem;
    font-weight: 600;
    color: var(--es-muted, #94A3B8);
    letter-spacing: .01em;
    text-transform: uppercase;
}
.epf-uname {
    font-size: .83rem;
    font-weight: 700;
    color: var(--es-text, #F8FAFC);
}
.epf-role {
    font-size: .72rem;
    color: var(--es-muted, #94A3B8);
}

/* =========================================================================
   Ensure panel uses flex-column for footer to stick to bottom
   ========================================================================= */
.es-panel, .tm-panel { display: flex !important; flex-direction: column; }
.es-panel-list.tm-panel-group, .es-panel-list { flex: 1 1 auto; overflow-y: auto; }

/* =========================================================================
   Combined school+session pill + avatar (right side of header)
   ========================================================================= */
.es-tb-user-pill {
    display: inline-flex;
    align-items: center;
    gap: 0;
    padding: 0;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: #1A2540;
    cursor: pointer;
    border-radius: 12px;
    transition: background .15s, border-color .15s;
    overflow: hidden;
}
.es-tb-user-pill:hover {
    background: #1E2D4C;
    border-color: rgba(255,255,255,.2);
}
.es-tbp-info {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    padding: 6px 10px 6px 12px;
    border-right: 1px solid rgba(255,255,255,.1);
    min-width: 72px;
}
.es-tbp-initials {
    font-size: .95rem;
    font-weight: 800;
    color: #F1F5F9;
    letter-spacing: .02em;
    line-height: 1.2;
}
.es-tbp-session {
    font-size: .64rem;
    color: #94A3B8;
    font-weight: 500;
    white-space: nowrap;
    margin-top: 1px;
}
.es-tbp-avatar {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 4px 8px;
}
.es-tb-user-pill .tb-avatar-circle {
    position: relative;
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    font-size: 12px;
}
.es-tbp-dot {
    position: absolute;
    right: 6px;
    bottom: 2px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #10B981;
    box-shadow: 0 0 0 2px #1A2540;
    pointer-events: none;
}

/* =========================================================================
   Full dark navy background coverage
   ========================================================================= */
html, body {
    min-height: 100vh;
    background-color: #0B1120 !important;
}
.es-shell, .es-body, .es-main, .es-page {
    background-color: #0B1120 !important;
}
.es-page {
    padding-bottom: 76px !important;
}

/* =========================================================================
   Sidebar bottom user panel (Image 2 exact match)
   ========================================================================= */
.tm-panel-user {
    padding: 12px 14px !important;
    background: #131B2E !important;
    border-top: 1px solid rgba(255, 255, 255, 0.08) !important;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.tm-panel-user .epf-school {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #93C5FD;
}
.tm-panel-user .epf-school i {
    font-size: 0.85rem;
    color: #60A5FA;
}
.tm-panel-user .epf-user {
    display: flex;
    align-items: center;
    gap: 10px;
}
.tm-panel-user .epf-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: linear-gradient(135deg, #8B5CF6 0%, #3B82F6 100%);
    color: #FFFFFF;
    font-weight: 700;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 2px 6px rgba(59, 130, 246, 0.25);
}
.tm-panel-user .epf-uname {
    font-size: 0.88rem;
    font-weight: 700;
    color: #FFFFFF;
    line-height: 1.25;
}
.tm-panel-user .epf-role {
    font-size: 0.75rem;
    font-weight: 500;
    color: #94A3B8;
    line-height: 1.2;
    margin-top: 2px;
}

/* =========================================================================
   Footer bar (Image 1 reference match)
   ========================================================================= */
.es-footer {
    position: fixed;
    bottom: 0;
    left: calc(var(--es-rail-w) + var(--es-panel-w));
    right: 0;
    height: 48px;
    background: #0B1120;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    z-index: 1015;
    transition: left .2s ease;
}
body.es-panel-collapsed .es-footer {
    left: var(--es-rail-w);
}
@media (max-width: 991.98px) {
    .es-footer {
        left: 0;
        bottom: var(--es-bottom-h, 60px);
    }
}
.es-footer-left {
    display: flex;
    align-items: center;
    gap: 16px;
}
.es-trial-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 12px;
    border-radius: 9999px;
    background: rgba(56, 189, 248, 0.08);
    border: 1px solid rgba(56, 189, 248, 0.35);
    color: #38BDF8;
    font-size: 0.75rem;
    font-weight: 500;
    text-decoration: none;
    transition: background .15s, border-color .15s;
}
.es-trial-badge:hover {
    background: rgba(56, 189, 248, 0.16);
    border-color: rgba(56, 189, 248, 0.55);
    color: #7DD3FC;
}
.es-trial-badge i {
    font-size: 0.8rem;
    color: #38BDF8;
}
.es-footer-copy {
    color: #64748B;
    font-size: 0.8rem;
    font-weight: 500;
}
.es-footer-right {
    display: flex;
    align-items: center;
}
.es-footer-new-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #2563EB !important;
    border-color: #2563EB !important;
    color: #FFFFFF !important;
    font-size: 0.82rem;
    font-weight: 600;
    padding: 5px 14px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.35);
    transition: all .15s ease-in-out;
}
.es-footer-new-btn:hover, .es-footer-new-btn:focus, .es-footer-new-btn:active {
    background: #1D4ED8 !important;
    border-color: #1D4ED8 !important;
    box-shadow: 0 4px 14px rgba(37, 99, 235, 0.5);
    color: #FFFFFF !important;
}
.es-footer-new-btn::after {
    display: none !important;
}
.es-footer-caret {
    font-size: 0.72rem;
    transition: transform .15s ease;
}
.es-footer-dropup .dropdown-menu {
    margin-bottom: 8px;
    border-radius: 10px;
    background: #18233C;
    border: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    min-width: 230px;
}

/* =========================================================================
   Dashboard: Academic & Fee Position KPI Grid
   ========================================================================= */
.kpi-grid.dash-kpis {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}
@media (max-width: 1199.98px) {
    .kpi-grid.dash-kpis {
        grid-template-columns: repeat(2, 1fr);
    }
}
@media (max-width: 575.98px) {
    .kpi-grid.dash-kpis {
        grid-template-columns: 1fr;
    }
}
.kpi-card {
    display: flex;
    flex-direction: column;
    padding: 18px 20px;
    background: #18233C !important;
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
    border-radius: 12px;
    transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}
.kpi-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    border-color: rgba(255, 255, 255, 0.16) !important;
}
.kpi-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.kpi-icon-box {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
}
.kpi-value {
    letter-spacing: -0.02em;
}

/* =========================================================================
   Dashboard: Today's Snapshot Grid (Image Fix)
   ========================================================================= */
.dash-snapshot-grid {
    display: grid !important;
    grid-template-columns: repeat(4, 1fr) !important;
    gap: 16px !important;
}
@media (max-width: 991.98px) {
    .dash-snapshot-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 12px !important;
    }
}
@media (max-width: 480px) {
    .dash-snapshot-grid {
        grid-template-columns: 1fr !important;
    }
}
.snap-tile {
    display: flex !important;
    flex-direction: column !important;
    gap: 4px !important;
    background: #111A2E !important;
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
    border-radius: 12px !important;
    padding: 16px 18px !important;
    transition: transform .15s ease, border-color .15s ease, box-shadow .15s ease !important;
}
.snap-tile:hover {
    transform: translateY(-2px) !important;
    border-color: rgba(255, 255, 255, 0.18) !important;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35) !important;
}
.snap-icon {
    width: 38px !important;
    height: 38px !important;
    border-radius: 8px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 1.15rem !important;
    margin-bottom: 6px !important;
}
.snap-val {
    font-size: 1.6rem !important;
    font-weight: 800 !important;
    line-height: 1.2 !important;
    color: #F8FAFC !important;
    letter-spacing: -0.02em !important;
}
.snap-label {
    font-size: 0.76rem !important;
    font-weight: 600 !important;
    color: #94A3B8 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.04em !important;
}

/* Tile color variants */
.snap-blue .snap-icon {
    background: rgba(59, 130, 246, 0.15) !important;
    color: #3B82F6 !important;
}
.snap-blue:hover {
    border-color: rgba(59, 130, 246, 0.45) !important;
}
.snap-amber .snap-icon {
    background: rgba(245, 158, 11, 0.15) !important;
    color: #F59E0B !important;
}
.snap-amber:hover {
    border-color: rgba(245, 158, 11, 0.45) !important;
}
.snap-teal .snap-icon {
    background: rgba(6, 182, 212, 0.15) !important;
    color: #06B6D4 !important;
}
.snap-teal:hover {
    border-color: rgba(6, 182, 212, 0.45) !important;
}
.snap-purple .snap-icon {
    background: rgba(139, 92, 246, 0.15) !important;
    color: #8B5CF6 !important;
}
.snap-purple:hover {
    border-color: rgba(139, 92, 246, 0.45) !important;
}

/* =========================================================================
   App Rail Bottom & Version Tag Fix (No Overlap)
   ========================================================================= */
.es-rail-bottom, .tm-rail-foot {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    width: 100% !important;
    margin-top: auto !important;
    padding-bottom: 8px !important;
    box-sizing: border-box !important;
}
.tm-version-box {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 100% !important;
    padding: 6px 4px 4px !important;
    box-sizing: border-box !important;
}
.tm-version {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 2px 8px !important;
    font-size: 0.65rem !important;
    font-weight: 600 !important;
    font-family: var(--font-mono, monospace) !important;
    color: #64748B !important;
    background: rgba(255, 255, 255, 0.05) !important;
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
    border-radius: 999px !important;
    text-decoration: none !important;
    letter-spacing: 0.02em !important;
    white-space: nowrap !important;
    line-height: 1.4 !important;
    text-align: center !important;
    transition: all .15s ease !important;
}
.tm-version:hover {
    color: #38BDF8 !important;
    background: rgba(56, 189, 248, 0.12) !important;
    border-color: rgba(56, 189, 248, 0.3) !important;
}

/* =========================================================================
   WhatsApp Web UI for Staff Chat (EaseSchool Theme)
   ========================================================================= */
.es-wa-container {
    height: calc(100vh - 165px);
    min-height: 560px;
    max-height: 860px;
    display: flex;
    background: #111A2E;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.45);
}

/* Left Sidebar */
.es-wa-sidebar {
    width: 340px;
    flex: 0 0 340px;
    background: #0F182A;
    border-right: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    flex-direction: column;
}
@media (max-width: 767.98px) {
    .es-wa-sidebar {
        width: 100%;
        flex: 1 1 100%;
    }
    .es-wa-container {
        flex-direction: column;
    }
}
.es-wa-side-header {
    height: 60px;
    padding: 10px 16px;
    background: #131E35;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.es-wa-user-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: linear-gradient(135deg, #8B5CF6 0%, #3B82F6 100%);
    color: #FFFFFF;
    font-weight: 700;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.es-wa-btn-icon {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: transparent;
    border: none;
    color: #94A3B8;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    cursor: pointer;
    text-decoration: none;
    transition: background .15s, color .15s;
}
.es-wa-btn-icon:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #F8FAFC;
}
.es-wa-search-box {
    padding: 8px 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}
.es-wa-search-wrap {
    background: #18233C;
    border-radius: 8px;
    padding: 6px 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    border: 1px solid rgba(255, 255, 255, 0.06);
}
.es-wa-search-icon {
    color: #64748B;
    font-size: 13px;
}
.es-wa-search-input {
    border: none;
    background: transparent;
    color: #F8FAFC;
    font-size: 13px;
    outline: none;
    width: 100%;
}
.es-wa-search-input::placeholder {
    color: #64748B;
}
.es-wa-search-clear {
    background: transparent;
    border: none;
    color: #64748B;
    font-size: 13px;
    cursor: pointer;
    padding: 0;
}
.es-wa-search-clear:hover {
    color: #94A3B8;
}
.es-wa-filters {
    padding: 8px 12px;
    display: flex;
    gap: 6px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}
.es-wa-filter-chip {
    padding: 3px 12px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 500;
    background: rgba(255, 255, 255, 0.05);
    color: #94A3B8;
    border: 1px solid rgba(255, 255, 255, 0.06);
    cursor: pointer;
    transition: all .15s;
}
.es-wa-filter-chip:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #F8FAFC;
}
.es-wa-filter-chip.active {
    background: rgba(59, 130, 246, 0.18);
    color: #38BDF8;
    border-color: rgba(59, 130, 246, 0.4);
    font-weight: 600;
}
.es-wa-chats-list {
    flex: 1 1 auto;
    overflow-y: auto;
    scrollbar-width: thin;
}
.es-wa-chat-item {
    padding: 12px 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    text-decoration: none !important;
    transition: background .15s;
}
.es-wa-chat-item:hover {
    background: rgba(255, 255, 255, 0.05);
}
.es-wa-chat-item.is-active {
    background: #18233C;
    border-left: 3px solid #3B82F6;
}
.es-wa-avatar-box {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-weight: 700;
    font-size: 13.5px;
}
.es-wa-avatar-box.md {
    width: 40px;
    height: 40px;
    font-size: 13px;
}
.es-wa-avatar-box.avatar-all {
    background: linear-gradient(135deg, #2563EB 0%, #1D4ED8 100%);
    color: #FFFFFF;
}
.es-wa-avatar-box.avatar-group {
    background: linear-gradient(135deg, #059669 0%, #0D9488 100%);
    color: #FFFFFF;
}
.es-wa-avatar-box.avatar-direct {
    background: linear-gradient(135deg, #7C3AED 0%, #4F46E5 100%);
    color: #FFFFFF;
}
.es-wa-chat-details {
    flex: 1 1 auto;
}
.es-wa-chat-name {
    font-size: 13.5px;
    font-weight: 600;
    color: #F8FAFC;
    line-height: 1.2;
}
.es-wa-chat-time {
    font-size: 11px;
    color: #64748B;
    white-space: nowrap;
    margin-left: 6px;
}
.es-wa-chat-snippet {
    font-size: 12.5px;
    color: #94A3B8;
    line-height: 1.2;
}
.es-wa-unread-badge {
    background: #10B981;
    color: #FFFFFF;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 999px;
    margin-left: 6px;
    flex-shrink: 0;
}

/* Right Main Chat Area */
.es-wa-main {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    background: #0B1120;
    min-width: 0;
}
.es-wa-main-header {
    height: 60px;
    padding: 10px 20px;
    background: #131E35;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.es-wa-header-title {
    font-size: 15px;
    font-weight: 700;
    color: #F8FAFC;
    margin: 0;
    line-height: 1.2;
}
.es-wa-header-sub {
    font-size: 11.5px;
    color: #94A3B8;
    line-height: 1.2;
    margin-top: 2px;
}
.es-wa-avatar-tiny {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #2563EB;
    color: white;
    font-size: 10px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* Messages Canvas */
.es-wa-canvas {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 20px 24px;
    background-color: #090E1A;
    background-image: radial-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 0);
    background-size: 24px 24px;
}
.es-wa-date-divider {
    text-align: center;
    margin: 8px 0 20px;
}
.es-wa-date-divider span {
    background: #18233C;
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: #94A3B8;
    padding: 4px 14px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}
.es-wa-message-feed {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.es-wa-row {
    display: flex;
    width: 100%;
}
.es-wa-row.is-outgoing {
    justify-content: flex-end;
}
.es-wa-row.is-incoming {
    justify-content: flex-start;
}
.es-wa-bubble {
    max-width: 65%;
    min-width: 120px;
    padding: 8px 12px 6px;
    border-radius: 8px;
    position: relative;
    font-size: 13.5px;
    line-height: 1.45;
    word-break: break-word;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
}
.es-wa-row.is-outgoing .es-wa-bubble {
    background: #1E3A8A;
    color: #F8FAFC;
    border: 1px solid rgba(59, 130, 246, 0.3);
    border-top-right-radius: 2px;
}
.es-wa-row.is-incoming .es-wa-bubble {
    background: #18233C;
    color: #F8FAFC;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-top-left-radius: 2px;
}
.es-wa-sender {
    font-size: 11.5px;
    font-weight: 700;
    color: #38BDF8;
    margin-bottom: 2px;
}
.es-wa-text {
    color: #F8FAFC;
}
.es-wa-meta {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 4px;
    margin-top: 4px;
    float: right;
    margin-left: 8px;
}
.es-wa-time {
    font-size: 10.5px;
    color: rgba(255, 255, 255, 0.55);
}
.es-wa-ticks {
    font-size: 13px;
    color: #38BDF8;
}
.es-wa-empty-state {
    text-align: center;
    padding: 40px 20px;
    color: #64748B;
}
.es-wa-empty-icon {
    font-size: 40px;
    color: #3B82F6;
    margin-bottom: 12px;
    opacity: 0.8;
}

/* Input Bar */
.es-wa-input-bar {
    height: 64px;
    background: #131E35;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: center;
    padding: 10px 18px;
    gap: 10px;
}
.es-wa-action-tool {
    color: #94A3B8;
    font-size: 18px;
}
.es-wa-action-tool:hover {
    color: #F8FAFC;
}
.es-wa-textarea {
    flex: 1 1 auto;
    background: #18233C;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    padding: 9px 14px;
    color: #F8FAFC;
    font-size: 13.5px;
    resize: none;
    outline: none;
    line-height: 1.4;
    transition: border-color .15s;
}
.es-wa-textarea:focus {
    border-color: #3B82F6;
}
.es-wa-send-button {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #2563EB;
    border: none;
    color: #FFFFFF;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    transition: background .15s, transform .15s;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.4);
    cursor: pointer;
}
.es-wa-send-button:hover {
    background: #1D4ED8;
    transform: scale(1.05);
}

/* Modals */
.es-wa-modal {
    background: #18233C !important;
    border: 1px solid rgba(255, 255, 255, 0.12) !important;
    border-radius: 14px !important;
    color: #F8FAFC !important;
}
.es-wa-modal-input, .es-wa-select {
    background: #111A2E !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    color: #F8FAFC !important;
    border-radius: 8px !important;
}
.es-wa-modal-input:focus, .es-wa-select:focus {
    border-color: #3B82F6 !important;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.25) !important;
}





