/* Shared light palette for the application. Dark remains the default. */
html, body { width: 100%; max-width: 100%; overflow-x: clip; }
*, *::before, *::after { box-sizing: border-box; }
img, video, canvas, iframe { max-width: 100%; }
input, select, textarea, button { max-width: 100%; }
pre, code { max-width: 100%; overflow-wrap: anywhere; }
.wrap, .container, .container-fluid, main, .main, .content, .content-wrapper, .page-content,
.dashboard-content, .topbar, .sticky-hdr, .header, .student-list-grid { min-width: 0; max-width: 100%; }
.wrap > *, .container > *, .container-fluid > *, .topbar > *, .sticky-hdr > *, .header > * { min-width: 0; }
table { max-width: 100%; }
.table-responsive, .table-wrap, .table-container { max-width: 100%; overflow-x: auto; }
#student-list-mobile-area {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 360px), 1fr)) !important;
}
#student-list-mobile-area > * { min-width: 0; max-width: 100%; }
.student-mobile-card, .student-mobile-card * { min-width: 0; }
@media (max-width: 639px) {
    #student-list-mobile-area { grid-template-columns: minmax(0, 1fr) !important; }
}

html[data-theme="light"] {
    color-scheme: light;
    --navy: #f3f6fb;
    --navy2: #ffffff;
    --card: #ffffff;
    --card2: #eef2f8;
    --border: rgba(15, 23, 42, .13);
    --text: #172033;
    --muted: #64748b;
    --muted2: #475569;
    --bg: #f3f6fb;
    --ink: #172033;
    --paper: #f8fafc;
    --paper-2: #eef2f8;
    --paper-line: rgba(15, 23, 42, .13);
}

html[data-theme="light"] body {
    color: var(--text);
    background-color: var(--navy);
}

html[data-theme="light"] body::before { opacity: .16; }
html[data-theme="light"] body::after { opacity: .35; }
html[data-theme="light"] #siteHeader { background: rgba(248, 250, 252, .94); border-color: var(--paper-line); }
html[data-theme="light"] .mobile-menu { background: var(--paper); }
html[data-theme="light"] footer { color: var(--muted2); }

/* Dashboard panels with their own dark gradients need explicit light surfaces. */
html[data-theme="light"] body .topbar {
    background: linear-gradient(160deg, #ffffff, #edf2f9) !important;
    border-color: rgba(15, 23, 42, .12);
    box-shadow: 0 12px 28px -18px rgba(15, 23, 42, .24), inset 0 1px 0 rgba(255,255,255,.9);
}
html[data-theme="light"] body .topbar::after { opacity: .12; }
html[data-theme="light"].nt-merged { --nt-merge-bg: linear-gradient(90deg, #f8fafc, #e8eef6) !important; }
html[data-theme="light"] body .sticky-hdr,
html[data-theme="light"].nt-merged .sticky-hdr,
html[data-theme="light"] body .notice-ticker-wrap.is-stuck .notice-ticker {
    background: linear-gradient(90deg, #f8fafc, #e8eef6) !important;
    border-color: rgba(15, 23, 42, .12);
    box-shadow: 0 8px 20px -16px rgba(30, 64, 100, .28), inset 0 1px 0 rgba(255,255,255,.95);
}
html[data-theme="light"].nt-merged .sticky-hdr {
    border-bottom-color: transparent;
    box-shadow: inset 0 1px 0 rgba(255,255,255,.95);
}
html[data-theme="light"] body .sticky-hdr .tbar-greet,
html[data-theme="light"] body .sticky-hdr .tbar-brand,
html[data-theme="light"] body .sticky-hdr .tbar-meta { color: var(--text); }
html[data-theme="light"] body .notice-ticker {
    background: linear-gradient(180deg, #ffffff, #f1f5f9) !important;
}
html[data-theme="light"] body .notice-ticker::before { opacity: .15; }
html[data-theme="light"] body .nt-viewport::after { background: linear-gradient(180deg, rgba(248,250,252,.96), transparent 22%, transparent 78%, rgba(248,250,252,.96)); }
html[data-theme="light"] body .nt-item { color: #475569; }
html[data-theme="light"] body .nt-item .nt-title {
    background: none;
    color: #9a6700;
    -webkit-text-fill-color: currentColor;
}
html[data-theme="light"] body .hero-card,
html[data-theme="light"] body .hero-card.hero-collapsed,
html[data-theme="light"] body .hero-card-simple {
    background: linear-gradient(180deg, #ffffff, #f1f5f9) !important;
    color: var(--text);
    box-shadow: 0 12px 26px -18px rgba(15, 23, 42, .28), inset 0 1px 0 rgba(255,255,255,.9);
}
html[data-theme="light"] body .hero-card .hero-amount {
    background: none !important;
    color: #334155 !important;
    -webkit-text-fill-color: #334155 !important;
}
html[data-theme="light"] body .hero-card .hero-amount.cyan-grad {
    background: none !important;
    color: #0e7490 !important;
    -webkit-text-fill-color: #0e7490 !important;
}
html[data-theme="light"] body .hero-amount-wrap.amt-shown .amt-cover {
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
    transform: translateX(-105%) rotateY(-90deg) !important;
}
html[data-theme="light"] body .hero-card .amt-cover {
    background: linear-gradient(180deg, rgba(255,255,255,.78), rgba(236,253,245,.96) 42%, #d1fae5) !important;
    border-color: rgba(5, 150, 105, .38);
    box-shadow: 0 5px 14px -8px rgba(5, 80, 60, .24), inset 0 1px 0 rgba(255,255,255,.96) !important;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}
html[data-theme="light"] body .hero-card .amt-cover::before {
    background: repeating-linear-gradient(135deg, rgba(5,150,105,.035) 0 2px, transparent 2px 10px);
}
html[data-theme="light"] body .hero-card .amt-cover i {
    color: #047857;
    filter: none;
}
html[data-theme="light"] body .hero-card .amt-cover span {
    color: #166534;
    text-shadow: none;
}
html[data-theme="light"] body .hero-card .amt-cover:hover {
    background: linear-gradient(180deg, #ffffff, #d1fae5) !important;
    border-color: rgba(5, 150, 105, .55);
    box-shadow: 0 7px 16px -9px rgba(5, 80, 60, .28), inset 0 1px 0 rgba(255,255,255,.98) !important;
}
html[data-theme="light"] body .hero-card .amt-hide-hint { color: #475569; }
html[data-theme="light"] body .hero-card.hero-collapsed .hero-row .hero-mini.today .hm-val {
    color: #0f172a !important;
    background: #e0f2fe;
    border-color: rgba(8, 145, 178, .3);
    box-shadow: inset 0 1px 3px rgba(15, 23, 42, .08);
}
html[data-theme="light"] body .hero-card.hero-collapsed {
    --edge: #d7e2ed !important;
    --edge2: #c5d3e1 !important;
    box-shadow: 0 1px 0 #d7e2ed, 0 3px 0 #c5d3e1, 0 6px 0 #b8c8d9,
        0 12px 20px -12px rgba(30, 64, 100, .3), inset 0 1px 0 rgba(255,255,255,.95) !important;
}
html[data-theme="light"] body .hero-mini,
html[data-theme="light"] body .hero-stats,
html[data-theme="light"] body .hero-stats-4 .hs-item {
    background-color: rgba(15, 23, 42, .035);
}

/* Student directory cards use a separate glass palette from the dashboard. */
html[data-theme="light"] body .glass,
html[data-theme="light"] body .glass-strong,
html[data-theme="light"] body .student-mobile-card {
    background: #ffffff !important;
    color: #172033;
    border-color: rgba(15, 23, 42, .14);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    box-shadow: 0 8px 22px -16px rgba(15, 23, 42, .38);
}
html[data-theme="light"] body .student-mobile-card .card-top { border-bottom-color: rgba(15, 23, 42, .12); }
html[data-theme="light"] body .student-name-text { color: #172033; }
html[data-theme="light"] body .student-meta,
html[data-theme="light"] body .card-batch-info,
html[data-theme="light"] body .result-count,
html[data-theme="light"] body .page-info { color: #526078; }
html[data-theme="light"] body .finance-tile {
    background: #f5f7fb;
    border-color: rgba(15, 23, 42, .1);
}
html[data-theme="light"] body .finance-tile span { color: #526078; }
html[data-theme="light"] body .finance-tile strong { color: #334155; }
html[data-theme="light"] body .finance-tile strong.text-paid { color: #059669; }
html[data-theme="light"] body .finance-tile strong.text-due { color: #e11d48; }
html[data-theme="light"] body .finance-tile strong.text-months { color: #0891b2; }
html[data-theme="light"] body .search-wrap input,
html[data-theme="light"] body .modal-textarea { background: #fff; color: #172033; }
html[data-theme="light"] body .search-wrap input::placeholder { color: #64748b; }
html[data-theme="light"] body .batch-pill,
html[data-theme="light"] body .btn-reset,
html[data-theme="light"] body .page-btn.inactive { color: #475569; background: #f1f5f9; border-color: rgba(15, 23, 42, .13); }

/* Mobile dashboard navigation */
html[data-theme="light"] body .bnav {
    background: rgba(248, 250, 252, .98);
    border-color: rgba(15, 23, 42, .14);
    box-shadow: 0 -8px 24px -12px rgba(30, 64, 100, .24);
}
html[data-theme="light"] body .bn-item { color: #526078; }
html[data-theme="light"] body .bn-item.active { color: #4f46e5; }
html[data-theme="light"] body .bn-add.disabled-btn { background: #cbd5e1 !important; color: #475569; }

/* Student dashboard: replace dark-mode-only pastel text and glass surfaces. */
html[data-theme="light"] body.student-dashboard .stat-card,
html[data-theme="light"] body.student-dashboard .section {
    background: #ffffff !important;
    color: #172033 !important;
    border-color: #d7e0eb !important;
    box-shadow: 0 8px 22px -16px rgba(15, 23, 42, .28), inset 0 1px 0 #fff !important;
}
html[data-theme="light"] body.student-dashboard .section-head,
html[data-theme="light"] body.student-dashboard .std-row,
html[data-theme="light"] body.student-dashboard .std-notice-item { border-color: #e2e8f0 !important; }
html[data-theme="light"] body.student-dashboard .section-head .sh-title,
html[data-theme="light"] body.student-dashboard .stat-body .sv,
html[data-theme="light"] body.student-dashboard .std-notice-title,
html[data-theme="light"] body.student-dashboard .std-sub { color: #172033 !important; }
html[data-theme="light"] body.student-dashboard .section-head .sh-count,
html[data-theme="light"] body.student-dashboard .section-head .sh-arrow,
html[data-theme="light"] body.student-dashboard .stat-body .sl,
html[data-theme="light"] body.student-dashboard .feat-item .fi-label,
html[data-theme="light"] body.student-dashboard .std-empty,
html[data-theme="light"] body.student-dashboard .std-notice-meta,
html[data-theme="light"] body.student-dashboard .std-sub2 { color: #526078 !important; }
html[data-theme="light"] body.student-dashboard .std-grade-a { color: #047857 !important; }
html[data-theme="light"] body.student-dashboard .std-grade-b { color: #0e7490 !important; }
html[data-theme="light"] body.student-dashboard .std-grade-c { color: #a16207 !important; }
html[data-theme="light"] body.student-dashboard .std-grade-f { color: #be123c !important; }
html[data-theme="light"] body.student-dashboard .std-day-pill { color: #4338ca !important; background: #eef2ff !important; }
html[data-theme="light"] body.student-dashboard .std-nbadge { color: #be123c !important; background: #ffe4e6 !important; }
html[data-theme="light"] body.student-dashboard .std-s-paid { color: #047857 !important; background: #d1fae5 !important; }
html[data-theme="light"] body.student-dashboard .std-s-due { color: #be123c !important; background: #ffe4e6 !important; }
html[data-theme="light"] body.student-dashboard .std-fee-amt { color: #047857 !important; }

html[data-theme="light"] .header,
html[data-theme="light"] .tbar-account-pop,
html[data-theme="light"] .card,
html[data-theme="light"] .card-body,
html[data-theme="light"] .modal-content,
html[data-theme="light"] .dropdown-menu,
html[data-theme="light"] .list-group-item,
html[data-theme="light"] .table,
html[data-theme="light"] .table > :not(caption) > * > *,
html[data-theme="light"] .alert,
html[data-theme="light"] .form-control,
html[data-theme="light"] .form-select,
html[data-theme="light"] input:not([type="checkbox"]):not([type="radio"]):not([type="file"]),
html[data-theme="light"] select,
html[data-theme="light"] textarea {
    color: var(--text);
    border-color: var(--border);
}

html[data-theme="light"] .form-control,
html[data-theme="light"] .form-select,
html[data-theme="light"] input:not([type="checkbox"]):not([type="radio"]):not([type="file"]),
html[data-theme="light"] select,
html[data-theme="light"] textarea,
html[data-theme="light"] .dropdown-menu,
html[data-theme="light"] .list-group-item {
    background-color: var(--card);
}

html[data-theme="light"] .table {
    --bs-table-color: var(--text);
    --bs-table-bg: transparent;
    --bs-table-border-color: var(--border);
    --bs-table-striped-color: var(--text);
    --bs-table-striped-bg: rgba(15, 23, 42, .035);
}

html[data-theme="light"] .hdr-photo-backdrop {
    background: rgba(241, 245, 249, .94);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}
html[data-theme="light"] body .logo-lightbox {
    background: rgba(241, 245, 249, .96);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}
html[data-theme="light"] body .logo-lightbox img {
    background: #ffffff;
    box-shadow: 0 16px 42px -16px rgba(15, 23, 42, .32);
}
html[data-theme="light"] body .logo-lightbox-close {
    color: #334155;
    background: rgba(255,255,255,.9);
    border-color: rgba(15,23,42,.15);
}

.theme-mode-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    min-height: 36px;
    padding: 7px 11px;
    border: 1px solid var(--border);
    border-radius: 9px;
    background: var(--card2);
    color: var(--text);
    font: inherit;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
}
.theme-mode-toggle:hover { border-color: var(--indigo); }
.theme-mode-toggle:focus-visible { outline: 2px solid var(--indigo); outline-offset: 2px; }
.header .theme-mode-toggle { margin-left: 7px; vertical-align: middle; }
.tbar-account-pop .theme-mode-toggle { width: 100%; justify-content: flex-start; margin: 3px 0; }
.account-context-info {
    display: grid;
    gap: 7px;
    margin: 3px 4px 8px;
    padding: 9px 8px;
    border-bottom: 1px solid var(--border);
    color: var(--muted2);
    font-size: 11px;
}
.account-context-info > span { display: flex; align-items: center; gap: 7px; }
.account-context-info > span i { width: 14px; color: var(--cyan); text-align: center; }
.account-context-info .att-hdr.account-attendance-link {
    display: flex;
    width: 100%;
    max-width: 100%;
    justify-content: flex-start;
    padding: 8px 9px;
    border: 1px solid rgba(245, 158, 11, .22);
    border-radius: 9px;
    background: rgba(245, 158, 11, .08);
    color: #fbbf24;
    white-space: normal;
    text-decoration: none;
    font-size: 11px;
}
.account-context-info .att-hdr.account-attendance-link.none { color: #b45309; }
html[data-theme="light"] .account-context-info .att-hdr.account-attendance-link.none {
    color: #92400e;
    background: #fffbeb;
    border-color: rgba(180, 83, 9, .2);
}
.account-quick-links {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 7px;
    margin: 2px 4px 8px;
    padding-bottom: 9px;
    border-bottom: 1px solid var(--border);
}
.account-quick-links > a,
.account-quick-links > button {
    display: flex !important;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-width: 0;
    min-height: 38px;
    padding: 7px 5px !important;
    border: 1px solid var(--border) !important;
    border-radius: 10px !important;
    background: var(--card2) !important;
    color: var(--text) !important;
    box-shadow: none !important;
    text-decoration: none;
    font: inherit;
    font-size: 10px !important;
    font-weight: 700;
    cursor: pointer;
    transform: none !important;
}
.account-quick-links > a:hover,
.account-quick-links > button:hover { border-color: var(--indigo) !important; }
html.feat-off-hdr-pwa-btn .account-quick-links .pwa-action-proxy { display: none !important; }
html.feat-off-hdr-extractor-btn .account-quick-links .extractor-action { display: none !important; }

@media (prefers-reduced-motion: no-preference) {
    body, .header, .tbar-account-pop, .card, .modal-content, input, select, textarea {
        transition: background-color .18s ease, color .18s ease, border-color .18s ease;
    }
}

/* Light mode for setup pages. */
html[data-theme="light"] body:has(.batch-wrap) { background:#f3f6fb !important; color:#172033; }
html[data-theme="light"] .batch-wrap { --bg-deep:#f3f6fb !important; --bg-panel-1:#fff !important; --bg-panel-2:#f8fafc !important; --edge:rgba(15,23,42,.13) !important; --edge-bright:rgba(15,23,42,.2) !important; --text-main:#172033 !important; --text-muted:#64748b !important; background:#f3f6fb !important; color:#172033 !important; }
html[data-theme="light"] .batch-wrap .card,html[data-theme="light"] .batch-wrap .class-card,html[data-theme="light"] .batch-wrap .stat-card,html[data-theme="light"] .batch-wrap .modal-content,html[data-theme="light"] .batch-wrap .day-group,html[data-theme="light"] .batch-wrap .schedule-card { background:#fff !important; color:#172033 !important; border-color:rgba(15,23,42,.14) !important; }
html[data-theme="light"] .batch-wrap .form-control,html[data-theme="light"] .batch-wrap .form-select,html[data-theme="light"] .batch-wrap input,html[data-theme="light"] .batch-wrap select,html[data-theme="light"] .batch-wrap textarea { background:#fff !important; color:#172033 !important; border-color:rgba(15,23,42,.18) !important; }
html[data-theme="light"] .batch-wrap .page-link { background:#fff; color:#334155; border-color:rgba(15,23,42,.14); }
html[data-theme="light"]:has(body .subject-page) { --bg:#f3f6fb; --s1:#fff; --s2:#f8fafc; --s3:#eef2f8; --border:rgba(15,23,42,.13); --border-md:rgba(15,23,42,.2); --text:#172033; --sub:#526078; --dim:#64748b; }
html[data-theme="light"]:has(body .teacher-page) { --bg:#f3f6fb; --s1:#fff; --s2:#f8fafc; --border:rgba(15,23,42,.13); --text:#172033; --muted:#64748b; }
html[data-theme="light"]:has(body .sub-account-page) { --navy:#f3f6fb; --navy2:#fff; --card:#fff; --card2:#f1f5f9; --border:rgba(15,23,42,.13); --text:#172033; --muted:#64748b; --muted2:#526078; }
html[data-theme="light"] body.subject-page,html[data-theme="light"] body.teacher-page,html[data-theme="light"] body.sub-account-page { background:#f3f6fb !important; color:#172033 !important; }
html[data-theme="light"] body.subject-page .glass,html[data-theme="light"] body.subject-page .glass-strong,html[data-theme="light"] body.subject-page .modal-box,html[data-theme="light"] body.teacher-page .glass,html[data-theme="light"] body.teacher-page .glass-strong,html[data-theme="light"] body.teacher-page .panel,html[data-theme="light"] body.teacher-page .t-card,html[data-theme="light"] body.sub-account-page .glass,html[data-theme="light"] body.sub-account-page .glass-strong,html[data-theme="light"] body.sub-account-page .acc-card,html[data-theme="light"] body.sub-account-page .stat-card,html[data-theme="light"] body.sub-account-page .empty-state { background:#fff !important; color:#172033 !important; border-color:rgba(15,23,42,.14) !important; backdrop-filter:none !important; -webkit-backdrop-filter:none !important; }
html[data-theme="light"] body.teacher-page .topbar { background:rgba(248,250,252,.96) !important; }
html[data-theme="light"] body.sub-account-page .form-card { background:linear-gradient(#fff,#fff) padding-box,linear-gradient(135deg,#6366f1,#8b5cf6 45%,#06b6d4 85%) border-box !important; }
html[data-theme="light"] body.subject-page input,html[data-theme="light"] body.subject-page select,html[data-theme="light"] body.subject-page textarea,html[data-theme="light"] body.teacher-page input,html[data-theme="light"] body.teacher-page select,html[data-theme="light"] body.teacher-page textarea,html[data-theme="light"] body.sub-account-page input,html[data-theme="light"] body.sub-account-page select,html[data-theme="light"] body.sub-account-page textarea { background:#fff; color:#172033; border-color:rgba(15,23,42,.18); }
/* Standalone Extractor pages */
html[data-theme="light"] body.extractor-page { background:#f3f6fb !important; color:#172033 !important; background-image:none !important; --ink-900:#f3f6fb; --ink-800:#fff; --ink-700:#d5dde8; --paper:#172033; --paper-dim:#526078; --amber:#b45309; --amber-dim:rgba(180,83,9,.1); }
html[data-theme="light"] body.extractor-page .card,html[data-theme="light"] body.extractor-page .item,html[data-theme="light"] body.extractor-page .empty { background:#fff !important; color:#172033 !important; border-color:#d5dde8 !important; box-shadow:0 8px 24px -18px rgba(15,23,42,.35); }
html[data-theme="light"] body.extractor-page textarea,html[data-theme="light"] body.extractor-page .files li { background:#f8fafc !important; color:#172033 !important; border-color:#d5dde8 !important; }

/* Keep typed values, selected options, and hints readable in light mode across every page. */
html[data-theme="light"] body input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="submit"]):not([type="button"]),
html[data-theme="light"] body select,
html[data-theme="light"] body textarea {
    color:#172033 !important;
    -webkit-text-fill-color:#172033 !important;
    caret-color:#172033 !important;
}
html[data-theme="light"] body input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="submit"]):not([type="button"])::placeholder,
html[data-theme="light"] body textarea::placeholder {
    color:#64748b !important;
    -webkit-text-fill-color:#64748b !important;
    opacity:1 !important;
}
html[data-theme="light"] body select option {
    color:#172033 !important;
    background:#fff !important;
}
html[data-theme="light"] body.extractor-page .btn:not(.primary) { color:#334155 !important; border-color:#cbd5e1 !important; }
/* Keep all light-theme surfaces and text readable after page styling loads. */
html[data-theme="light"] body.subject-page .page-head h1,
html[data-theme="light"] body.subject-page .sub-name,
html[data-theme="light"] body.subject-page .modal-box,
html[data-theme="light"] body.subject-page .modal-box h3,
html[data-theme="light"] body.subject-page .confirm-sheet,
html[data-theme="light"] body.subject-page .confirm-sheet h3 { color:#172033 !important; }
html[data-theme="light"] body.subject-page .page-head .eyebrow,
html[data-theme="light"] body.subject-page .page-head .page-kicker { color:#4f46e5 !important; }
html[data-theme="light"] body.subject-page .panel,
html[data-theme="light"] body.subject-page .stat,
html[data-theme="light"] body.subject-page .filter-bar,
html[data-theme="light"] body.subject-page .sub-card,
html[data-theme="light"] body.subject-page .modal-box,
html[data-theme="light"] body.subject-page .confirm-sheet,
html[data-theme="light"] body.subject-page .empty-state { background:#fff !important; color:#172033 !important; border-color:rgba(15,23,42,.14) !important; backdrop-filter:none !important; -webkit-backdrop-filter:none !important; }
html[data-theme="light"] body.teacher-page .topbar { color:#172033 !important; }
html[data-theme="light"] body.teacher-page .topbar-title,
html[data-theme="light"] body.teacher-page .t-name,
html[data-theme="light"] body.teacher-page .panel-head { color:#172033 !important; }
html[data-theme="light"] body.teacher-page .stat-card,
html[data-theme="light"] body.teacher-page .panel,
html[data-theme="light"] body.teacher-page .t-card,
html[data-theme="light"] body.teacher-page .empty { background:#fff !important; color:#172033 !important; border-color:rgba(15,23,42,.14) !important; backdrop-filter:none !important; -webkit-backdrop-filter:none !important; }
html[data-theme="light"] body.sub-account-page .header-info h1,
html[data-theme="light"] body.sub-account-page .acc-name,
html[data-theme="light"] body.sub-account-page .modal-title { color:#172033 !important; }
html[data-theme="light"] body.sub-account-page .header-info p,
html[data-theme="light"] body.sub-account-page .stat-lbl,
html[data-theme="light"] body.sub-account-page .acc-meta,
html[data-theme="light"] body.sub-account-page .acc-email,
html[data-theme="light"] body.sub-account-page .empty-state p,
html[data-theme="light"] body.sub-account-page .form-group label,
html[data-theme="light"] body.sub-account-page .perm-label { color:#526078 !important; }
html[data-theme="light"] body.sub-account-page .stat-card .stat-num { color:#4f46e5; }
html[data-theme="light"] body.sub-account-page .modal-overlay { background:rgba(15,23,42,.45) !important; }
html[data-theme="light"] body.sub-account-page .modal-box { background:#fff !important; color:#172033 !important; }
html[data-theme="light"] body.sub-account-page .filter-btn { background:#f8fafc; color:#334155; }
html[data-theme="light"] body.sub-account-page .perm-item,
html[data-theme="light"] body.sub-account-page .role-option label,
html[data-theme="light"] body.sub-account-page .chip-picker { background:#f8fafc; color:#334155; }
html[data-theme="light"] body.subject-page .page-title { color:#172033 !important; }

/* Final light palette: cover every dark surface used by these custom pages. */
html[data-theme="light"] body.subject-page .stat,
html[data-theme="light"] body.subject-page .filter-bar,
html[data-theme="light"] body.subject-page .sub-card,
html[data-theme="light"] body.subject-page .sheet,
html[data-theme="light"] body.subject-page .confirm-sheet,
html[data-theme="light"] body.subject-page .empty-state,
html[data-theme="light"] body.teacher-page .stat-card,
html[data-theme="light"] body.teacher-page .panel,
html[data-theme="light"] body.teacher-page .t-card,
html[data-theme="light"] body.teacher-page .modal-box,
html[data-theme="light"] body.teacher-page .empty,
html[data-theme="light"] body.sub-account-page .stat-card,
html[data-theme="light"] body.sub-account-page .acc-card,
html[data-theme="light"] body.sub-account-page .empty-state,
html[data-theme="light"] body.sub-account-page .form-card,
html[data-theme="light"] body.sub-account-page .role-option label,
html[data-theme="light"] body.sub-account-page .perm-item,
html[data-theme="light"] body.sub-account-page .modal-box {
  background-color:#fff !important;
  color:#172033 !important;
  border-color:rgba(15,23,42,.15) !important;
  backdrop-filter:none !important;
  -webkit-backdrop-filter:none !important;
}
html[data-theme="light"] body.subject-page .sheet,
html[data-theme="light"] body.subject-page .confirm-sheet { background:#fff !important; }
html[data-theme="light"] body.teacher-page .topbar { background:#fff !important; color:#172033 !important; border-color:#d9e1eb !important; }
html[data-theme="light"] body.teacher-page .panel-head,
html[data-theme="light"] body.teacher-page .topbar-title,
html[data-theme="light"] body.teacher-page .t-name,
html[data-theme="light"] body.subject-page .page-title,
html[data-theme="light"] body.subject-page .sub-name,
html[data-theme="light"] body.subject-page .sheet-title,
html[data-theme="light"] body.subject-page .confirm-sheet h3,
html[data-theme="light"] body.sub-account-page .header-info h1,
html[data-theme="light"] body.sub-account-page .acc-name,
html[data-theme="light"] body.sub-account-page .modal-title { color:#172033 !important; }
html[data-theme="light"] body.subject-page .sub-info,
html[data-theme="light"] body.subject-page .sub-tags,
html[data-theme="light"] body.teacher-page .t-meta,
html[data-theme="light"] body.teacher-page .stat-lbl,
html[data-theme="light"] body.teacher-page .empty,
html[data-theme="light"] body.sub-account-page .header-info p,
html[data-theme="light"] body.sub-account-page .stat-lbl,
html[data-theme="light"] body.sub-account-page .acc-meta,
html[data-theme="light"] body.sub-account-page .acc-email,
html[data-theme="light"] body.sub-account-page .empty-state p,
html[data-theme="light"] body.sub-account-page .form-group label,
html[data-theme="light"] body.sub-account-page .perm-label { color:#526078 !important; }
html[data-theme="light"] body.subject-page .ff input,
html[data-theme="light"] body.subject-page .ff select,
html[data-theme="light"] body.subject-page .fg input,
html[data-theme="light"] body.subject-page .fg select,
html[data-theme="light"] body.teacher-page .fctrl,
html[data-theme="light"] body.sub-account-page .form-control,
html[data-theme="light"] body.sub-account-page .form-select { background:#fff !important; color:#172033 !important; border-color:#cbd5e1 !important; }
html[data-theme="light"] body.subject-page .backdrop,
html[data-theme="light"] body.teacher-page .modal-overlay,
html[data-theme="light"] body.sub-account-page .modal-overlay { background:rgba(15,23,42,.42) !important; }
html[data-theme="light"] body.subject-page .sheet *,
html[data-theme="light"] body.subject-page .confirm-sheet *,
html[data-theme="light"] body.teacher-page .modal-box * { text-shadow:none; }

/* Account popup layout: clear quick-tool tiles and account action cards. */
.tbar-account-pop { display:flex; flex-direction:column; gap:2px; padding:12px !important; }
.account-quick-links-heading { margin:8px 5px 3px; color:var(--muted2); font-size:10px; font-weight:800; letter-spacing:.04em; text-transform:uppercase; }
.account-quick-links { grid-template-columns:repeat(3,minmax(0,1fr)) !important; gap:8px !important; margin:0 2px 8px !important; padding:0 0 10px !important; }
.account-quick-links > a, .account-quick-links > button { min-height:56px !important; flex-direction:column !important; gap:5px !important; padding:8px 4px !important; font-size:10px !important; text-align:center; }
.account-quick-links > a > i, .account-quick-links > button > i { font-size:16px; }
.account-profile { padding:8px 5px 10px !important; }
.account-context-info { margin:2px 2px 7px !important; padding:8px 7px 10px !important; border:1px solid var(--border); border-radius:11px; background:var(--card2); }
.account-photo-form { margin:0 2px 6px; padding:9px 5px !important; border:1px solid var(--border); border-radius:11px; background:var(--card2); }
.tbar-account-subscription { margin:0 2px 6px !important; padding:9px 10px !important; border:1px solid rgba(16,185,129,.24); border-radius:11px; background:rgba(16,185,129,.08); }
.account-footer-actions { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:7px; margin:4px 2px 2px; padding-top:9px; border-top:1px solid var(--border); }
.account-footer-actions > a, .account-footer-actions > button, .tbar-account-pop .account-footer-actions .theme-mode-toggle { display:flex !important; flex-direction:column; align-items:center; justify-content:center; gap:5px; min-width:0; min-height:50px; margin:0 !important; padding:7px 4px !important; border:1px solid var(--border) !important; border-radius:10px !important; background:var(--card2) !important; color:var(--text) !important; box-shadow:none !important; font-size:9.5px !important; line-height:1.2; text-align:center; white-space:normal; }
.account-footer-actions > a i, .account-footer-actions > button i { font-size:14px; }
.account-footer-actions .logout-btn { color:#e11d48 !important; }
html[data-theme="light"] .account-context-info, html[data-theme="light"] .account-photo-form, html[data-theme="light"] .account-quick-links > a, html[data-theme="light"] .account-quick-links > button, html[data-theme="light"] .account-footer-actions > a, html[data-theme="light"] .account-footer-actions > button { background:#f8fafc !important; color:#172033 !important; border-color:rgba(15,23,42,.14) !important; }
html[data-theme="light"] .account-quick-links-heading { color:#526078; }
html[data-theme="light"] .account-context-info, html[data-theme="light"] .account-photo-hint { color:#526078; }
html[data-theme="light"] .account-footer-actions .logout-btn { color:#be123c !important; }
@media (min-width:640px) { .tbar-account-pop { max-height:min(78vh,620px); } .account-profile { flex-shrink:0; } }

.account-tool-label { display:block; max-width:100%; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }


/* Mobile-friendly plan status and icon-only app shortcut. */
.tbar-account-pop .account-quick-links .pwa-action-proxy { gap:0 !important; }
.tbar-account-pop .account-quick-links .pwa-action-proxy .account-tool-label { display:none !important; }
.tbar-account-pop .account-quick-links .all-cards-btn:hover,
.tbar-account-pop .account-quick-links .extractor-action:hover,
.tbar-account-pop .account-quick-links .pwa-action-proxy:hover { transform:translateY(-1px) !important; box-shadow:0 6px 14px -8px rgba(99,102,241,.45) !important; }
.tbar-account-pop .account-quick-links .all-cards-btn i { color:#818cf8; }
.tbar-account-pop .account-quick-links .extractor-action i { color:#06b6d4; }
.tbar-account-pop .account-quick-links .pwa-action-proxy i { color:#10b981; font-size:19px; }
.tbar-account-subscription { position:relative; overflow:hidden; }
.tbar-account-subscription::before { content:''; position:absolute; left:0; top:0; bottom:0; width:3px; border-radius:3px; background:currentColor; }
.tbar-account-subscription.is-trial { color:#b45309 !important; background:linear-gradient(135deg,rgba(245,158,11,.13),rgba(251,191,36,.06)) !important; border:1px solid rgba(217,119,6,.25) !important; }
.tbar-account-subscription.is-trial strong::before { content:'◷'; display:inline-grid; place-items:center; width:20px; height:20px; margin-right:7px; border-radius:7px; color:#b45309; background:rgba(245,158,11,.16); vertical-align:middle; }
.tbar-account-subscription.is-trial span { color:#92400e !important; }
.tbar-account-subscription.is-paid { color:#047857 !important; background:linear-gradient(135deg,rgba(16,185,129,.13),rgba(6,182,212,.06)) !important; border:1px solid rgba(5,150,105,.24) !important; }
.tbar-account-subscription.is-paid strong::before { content:'✓'; display:inline-grid; place-items:center; width:20px; height:20px; margin-right:7px; border-radius:7px; color:#047857; background:rgba(16,185,129,.16); vertical-align:middle; }
.tbar-account-subscription.is-paid span { color:#065f46 !important; }
html[data-theme="light"] .tbar-account-subscription.is-trial { color:#92400e !important; background:linear-gradient(135deg,#fffbeb,#fff7ed) !important; }
html[data-theme="light"] .tbar-account-subscription.is-trial span { color:#92400e !important; }
html[data-theme="light"] .tbar-account-subscription.is-paid { color:#065f46 !important; background:linear-gradient(135deg,#ecfdf5,#ecfeff) !important; }
html[data-theme="light"] .tbar-account-subscription.is-paid span { color:#065f46 !important; }
@media (max-width:639px) {
 .tbar-account-subscription { margin:4px 1px 8px !important; padding:11px 12px 11px 14px !important; border-radius:13px !important; }
 .tbar-account-subscription strong { display:flex; align-items:center; font-size:13px !important; }
 .tbar-account-subscription span { margin:5px 0 0 27px !important; font-size:11px !important; }
}

/* Icon-only quick actions, sized for touch on phones. */
.tbar-account-pop .account-quick-links { grid-template-columns:repeat(3,minmax(0,1fr)) !important; gap:10px !important; padding:2px 0 12px !important; }
.tbar-account-pop .account-quick-links > a,
.tbar-account-pop .account-quick-links > button { position:relative; display:grid !important; place-items:center !important; width:100% !important; min-width:0 !important; min-height:62px !important; height:62px !important; padding:0 !important; border:1px solid rgba(148,163,184,.2) !important; border-radius:16px !important; background:linear-gradient(160deg,rgba(99,102,241,.14),rgba(6,182,212,.07)) !important; color:var(--text) !important; box-shadow:0 5px 14px -12px rgba(15,23,42,.5),inset 0 1px 0 rgba(255,255,255,.08) !important; }
.tbar-account-pop .account-quick-links > a > i,
.tbar-account-pop .account-quick-links > button > i { display:grid; place-items:center; width:36px; height:36px; border-radius:12px; background:rgba(99,102,241,.14); font-size:18px !important; }
.tbar-account-pop .account-quick-links .all-cards-btn i { color:#818cf8 !important; }
.tbar-account-pop .account-quick-links .extractor-action i { color:#0891b2 !important; }
.tbar-account-pop .account-quick-links .pwa-action-proxy i { color:#059669 !important; }
.tbar-account-pop .account-quick-links > a:hover,
.tbar-account-pop .account-quick-links > button:hover { transform:translateY(-2px) !important; border-color:rgba(99,102,241,.45) !important; box-shadow:0 9px 18px -12px rgba(79,70,229,.7) !important; }
.tbar-account-pop .account-quick-links .account-tool-label { display:none !important; }
html[data-theme="light"] .tbar-account-pop .account-quick-links > a,
html[data-theme="light"] .tbar-account-pop .account-quick-links > button { background:linear-gradient(160deg,#fff,#f1f5f9) !important; border-color:#dbe3ed !important; box-shadow:0 5px 14px -10px rgba(15,23,42,.35),inset 0 1px 0 #fff !important; }
@media (max-width:639px) {
 .tbar-account-pop { left:10px !important; right:10px !important; width:auto !important; max-width:none !important; padding:14px !important; border-radius:18px !important; }
 .tbar-account-pop .account-quick-links { gap:9px !important; }
 .tbar-account-pop .account-quick-links > a, .tbar-account-pop .account-quick-links > button { min-height:60px !important; height:60px !important; border-radius:15px !important; }
}

@media (max-width:639px) {
 .tbar-account-pop .account-quick-links > a,
 .tbar-account-pop .account-quick-links > button { min-height:72px !important; height:72px !important; border-radius:17px !important; }
 .tbar-account-pop .account-quick-links > a > i,
 .tbar-account-pop .account-quick-links > button > i { width:46px !important; height:46px !important; border-radius:15px !important; font-size:23px !important; }
 .tbar-account-subscription { order:0; margin:7px 2px 8px !important; padding:12px 13px 12px 15px !important; }
 .account-profile { order:-1; }
}

/* Keep the plan card in the first visible part of the mobile account popup. */
.tbar-account-pop .tbar-account-subscription { display:block !important; visibility:visible !important; opacity:1 !important; flex:0 0 auto; }
@media (max-width:639px) {
 .tbar-account-pop .tbar-account-subscription { order:-2 !important; width:100%; margin:0 0 10px !important; padding:13px 14px 13px 16px !important; border-width:1px !important; border-radius:15px !important; box-shadow:0 8px 18px -14px rgba(15,23,42,.5),inset 0 1px 0 rgba(255,255,255,.65); }
 .tbar-account-pop .account-profile { order:-1 !important; }
 .tbar-account-pop .tbar-account-subscription strong { display:flex !important; align-items:center; gap:3px; font-size:14px !important; font-weight:800; }
 .tbar-account-pop .tbar-account-subscription span { margin:6px 0 0 27px !important; font-size:11.5px !important; font-weight:600; }
 .tbar-account-pop .account-quick-links > a, .tbar-account-pop .account-quick-links > button { border-width:1px !important; }
 .tbar-account-pop .account-quick-links .all-cards-btn > i { color:#6366f1 !important; background:linear-gradient(145deg,#eef2ff,#e0e7ff) !important; box-shadow:0 2px 6px rgba(79,70,229,.15); }
 .tbar-account-pop .account-quick-links .extractor-action > i { color:#0891b2 !important; background:linear-gradient(145deg,#ecfeff,#cffafe) !important; box-shadow:0 2px 6px rgba(8,145,178,.15); }
 .tbar-account-pop .account-quick-links .pwa-action-proxy > i { color:#059669 !important; background:linear-gradient(145deg,#ecfdf5,#d1fae5) !important; box-shadow:0 2px 6px rgba(5,150,105,.15); }
}
html[data-theme="light"] .tbar-account-subscription.is-trial { border-color:#f3cf83 !important; box-shadow:0 8px 18px -14px rgba(180,83,9,.35),inset 0 1px 0 #fff !important; }
html[data-theme="light"] .tbar-account-subscription.is-paid { border-color:#a7e6cf !important; box-shadow:0 8px 18px -14px rgba(5,150,105,.3),inset 0 1px 0 #fff !important; }

/* Popup order follows the account identity: plan immediately below the name. */
@media (max-width:639px) {
 .tbar-account-pop .account-profile { order:0 !important; }
 .tbar-account-pop .tbar-account-subscription { order:1 !important; }
 .tbar-account-pop .account-context-info { order:2 !important; }
 .tbar-account-pop .account-quick-links-heading { order:3 !important; }
 .tbar-account-pop .account-quick-links { order:4 !important; }
 .tbar-account-pop .account-photo-form { order:5 !important; }
 .tbar-account-pop .account-footer-actions { order:6 !important; }
}

.tbar-account-pop { overscroll-behavior-y:contain; }
@media (max-width:639px) { .tbar-account-pop .account-profile { order:0 !important; } .tbar-account-pop .tbar-account-subscription { order:1 !important; } }

@media screen {
/* Enforce the selected application palette after page-level legacy :root rules. */
html[data-theme="light"] {
    color-scheme: light !important;
    --navy:#f3f6fb !important; --navy2:#ffffff !important;
    --card:#ffffff !important; --card2:#eef2f8 !important;
    --border:rgba(15,23,42,.13) !important; --text:#172033 !important;
    --muted:#64748b !important; --muted2:#475569 !important;
    --bg:#f3f6fb !important; --ink:#172033 !important;
    --paper:#f8fafc !important; --paper-2:#eef2f8 !important;
    --paper-line:rgba(15,23,42,.13) !important;
}
html[data-theme="dark"] {
    color-scheme: dark !important;
    --navy:#0a0f1e !important; --navy2:#111827 !important;
    --card:#151c2c !important; --card2:#1a2235 !important;
    --border:rgba(148,163,184,.18) !important; --text:#f1f5f9 !important;
    --muted:#94a3b8 !important; --muted2:#aab6c9 !important;
    --bg:#0a0f1e !important; --ink:#f1f5f9 !important;
    --paper:#151c2c !important; --paper-2:#1a2235 !important;
    --paper-line:rgba(148,163,184,.18) !important;
}
html[data-theme="light"] body { color:var(--text) !important; background-color:var(--navy) !important; }
html[data-theme="dark"] body { color:var(--text) !important; background-color:var(--navy) !important; }

/* Normalize common legacy page panels in both themes. Page-specific labels and status colors remain intact. */
html[data-theme="light"] body :is(.card,.panel,.glass,.glass-strong,.glass-card,.content-card,.info-card,.data-card,.form-card,.empty-state,.empty,.modal-box,.modal-content,.section,.section-card,.stat-card,.stat-box,.summary-card,.result-card,.payment-card,.student-card,.schedule-card,.notice-card,.table-card,.filter-card,.search-card,.setting-card,.day-group,.accordion-item) {
    color:#172033;
    background-color:#ffffff !important;
    background-image:none !important;
    border-color:rgba(15,23,42,.14) !important;
    box-shadow:0 6px 18px -12px rgba(15,23,42,.24) !important;
    backdrop-filter:none !important;
    -webkit-backdrop-filter:none !important;
}
html[data-theme="dark"] body :is(.card,.panel,.glass,.glass-strong,.glass-card,.content-card,.info-card,.data-card,.form-card,.empty-state,.empty,.modal-box,.modal-content,.section,.section-card,.stat-card,.stat-box,.summary-card,.result-card,.payment-card,.student-card,.schedule-card,.notice-card,.table-card,.filter-card,.search-card,.setting-card,.day-group,.accordion-item) {
    color:#f1f5f9;
    background-color:#151c2c !important;
    background-image:none !important;
    border-color:rgba(148,163,184,.18) !important;
    box-shadow:0 7px 18px -14px rgba(0,0,0,.65) !important;
    backdrop-filter:none !important;
    -webkit-backdrop-filter:none !important;
}
html[data-theme="light"] body :is(.card-title,.panel-title,.section-title,.page-title,.empty-title,.empty-state-title,.stat-label,.stat-lbl,.muted,.text-muted,.help-text,.description,.sub-text,.meta-text,.hint-text) { color:#526078 !important; }
html[data-theme="dark"] body :is(.card-title,.panel-title,.section-title,.page-title,.empty-title,.empty-state-title,.stat-label,.stat-lbl,.muted,.text-muted,.help-text,.description,.sub-text,.meta-text,.hint-text) { color:#aab6c9 !important; }
html[data-theme="light"] body :is(input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="submit"]):not([type="button"]),select,textarea,.form-control,.form-select) { color:#172033 !important; background-color:#ffffff !important; border-color:#cbd5e1 !important; color-scheme:light; }
html[data-theme="dark"] body :is(input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="submit"]):not([type="button"]),select,textarea,.form-control,.form-select) { color:#f1f5f9 !important; background-color:#1a2235 !important; border-color:rgba(148,163,184,.24) !important; color-scheme:dark; }
html[data-theme="light"] body :is(input,textarea)::placeholder { color:#64748b !important; opacity:1 !important; }
html[data-theme="dark"] body :is(input,textarea)::placeholder { color:#94a3b8 !important; opacity:1 !important; }
}

