/*
 * Endeavor FMS — glass theme (light glassmorphism). Owner request 2026-10-16: "use glassmorphic theme".
 * Loaded AFTER the theme block in includes/header.php and by the sign-in pages (index, forgot/new password,
 * verify email). Self-contained: delete the <link> to return to the flat theme.
 *
 * Rules of the theme
 *  - Light only (never a dark theme): a soft pastel backdrop that frosted surfaces can blur.
 *  - Top-level surfaces (cards, sidebar, top bar, sign-in card) are frosted: translucent white + backdrop blur,
 *    a bright hairline border and a soft shadow. Things INSIDE a card are translucent but not blurred again
 *    (nested blur is expensive and adds nothing visually).
 *  - Text stays dark on light: contrast is unchanged from the flat theme.
 *  - Phones get a lighter blur; browsers without backdrop-filter, and users who ask for reduced transparency,
 *    get near-solid surfaces.
 *  - Selectors are prefixed with `html body.ea-glass` so they win over Tailwind CDN utilities, which are
 *    injected later than this file.
 */

:root {
    --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .2 0 0 0 0 .2 0 0 0 0 .35 0 0 0 .5 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.10'/%3E%3C/svg%3E");
    --glass-bg: rgba(255, 255, 255, 0.58);
    --glass-bg-strong: rgba(255, 255, 255, 0.78);
    --glass-bg-soft: rgba(255, 255, 255, 0.42);
    --glass-inner: rgba(255, 255, 255, 0.55);
    --glass-border: rgba(255, 255, 255, 0.75);
    --glass-edge: rgba(99, 102, 241, 0.14);
    --glass-blur: 18px;
    --glass-shadow: 0 1px 0 rgba(255, 255, 255, 0.85) inset, 0 10px 34px -12px rgba(30, 41, 110, 0.18), 0 2px 6px rgba(30, 41, 110, 0.05);
    --glass-shadow-hover: 0 1px 0 rgba(255, 255, 255, 0.9) inset, 0 18px 44px -14px rgba(37, 99, 235, 0.28), 0 3px 8px rgba(30, 41, 110, 0.06);
}

/* ---------------------------------------------------------------- backdrop the glass blurs */
html body.ea-glass {
    background-color: #eef2ff;
    background-image:
        var(--grain),
        radial-gradient(900px 620px at 8% 0%, rgba(147, 197, 253, 0.65), transparent 62%),
        radial-gradient(820px 600px at 100% 8%, rgba(196, 181, 253, 0.58), transparent 60%),
        radial-gradient(760px 560px at 85% 100%, rgba(165, 243, 252, 0.55), transparent 62%),
        radial-gradient(700px 520px at 0% 100%, rgba(251, 207, 232, 0.48), transparent 60%),
        linear-gradient(160deg, #f4f6ff 0%, #eef1ff 50%, #f5f3ff 100%);
    background-attachment: fixed;
    background-size: auto;
}
html:has(body.ea-glass) { background: #eef2ff; }
/* A very faint film grain (2026 "tactile" look; also hides gradient banding) is the TOP layer of the page background
   (--grain below), so it sits behind all content and never dulls text. */

/* ---------------------------------------------------------------- frosted top-level surfaces ("liquid glass")
   2026 refinement of glassmorphism: besides the blur, each surface has a light-catching RIM (a gradient border,
   brighter at the top-left like light on a glass edge) and a soft inner highlight, so it reads as a pane of
   glass with depth rather than a blurred box. The rim is drawn with the padding-box/border-box background
   trick, so it follows the rounded corners exactly. */
:root {
    --rim: linear-gradient(140deg, rgba(255, 255, 255, 0.98) 0%, rgba(255, 255, 255, 0.55) 28%, rgba(199, 210, 254, 0.45) 62%, rgba(255, 255, 255, 0.85) 100%);
}
html body.ea-glass :is(.glass-card, .glass-card-tech, .glass-card-subtle, .card-elevated, .ea-auth-card) {
    border: 1px solid transparent;
    background: linear-gradient(var(--glass-bg), var(--glass-bg)) padding-box, var(--rim) border-box;
    -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(170%);
    backdrop-filter: blur(var(--glass-blur)) saturate(170%);
    box-shadow: var(--glass-shadow);
    transition: box-shadow .25s ease, transform .25s ease;
}
html body.ea-glass .glass-card-subtle { background: linear-gradient(var(--glass-bg-soft), var(--glass-bg-soft)) padding-box, var(--rim) border-box; }
html body.ea-glass :is(.glass-card, .card-interactive):hover { box-shadow: var(--glass-shadow-hover); }
html body.ea-glass .glass-card-tech::before { background: linear-gradient(90deg, #2563eb, #7c3aed, #06b6d4); height: 2px; opacity: .9; }

/* Count cards (key numbers): MORE OPAQUE than the chrome, per 2026 dashboard guidance — glass for navigation
   and overlays, near-solid for the data people read. Faint tint of their status colour + the glass rim. */
html body.ea-glass :is(.card-sky, .card-amber, .card-emerald, .card-rose, .card-indigo, .card-purple, .card-slate) {
    border: 1px solid transparent;
    -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(170%);
    backdrop-filter: blur(var(--glass-blur)) saturate(170%);
    transition: box-shadow .25s ease, transform .25s ease;
}
html body.ea-glass .card-sky { background: linear-gradient(140deg, rgba(224, 242, 254, 0.92), rgba(255, 255, 255, 0.80)) padding-box, var(--rim) border-box; }
html body.ea-glass .card-slate { background: linear-gradient(140deg, rgba(226, 232, 240, 0.92), rgba(255, 255, 255, 0.80)) padding-box, var(--rim) border-box; }
html body.ea-glass .card-amber { background: linear-gradient(140deg, rgba(254, 243, 199, 0.92), rgba(255, 255, 255, 0.80)) padding-box, var(--rim) border-box; }
html body.ea-glass .card-emerald { background: linear-gradient(140deg, rgba(209, 250, 229, 0.92), rgba(255, 255, 255, 0.80)) padding-box, var(--rim) border-box; }
html body.ea-glass .card-rose { background: linear-gradient(140deg, rgba(255, 228, 230, 0.92), rgba(255, 255, 255, 0.80)) padding-box, var(--rim) border-box; }
html body.ea-glass .card-indigo { background: linear-gradient(140deg, rgba(224, 231, 255, 0.92), rgba(255, 255, 255, 0.80)) padding-box, var(--rim) border-box; }
html body.ea-glass .card-purple { background: linear-gradient(140deg, rgba(237, 233, 254, 0.92), rgba(255, 255, 255, 0.80)) padding-box, var(--rim) border-box; }
html body.ea-glass :is(.card-sky, .card-amber, .card-emerald, .card-rose, .card-indigo, .card-purple, .card-slate):hover { transform: translateY(-2px); }
/* big numbers: bold, fixed-width digits so columns of figures line up */
html body.ea-glass :is(.card-sky, .card-amber, .card-emerald, .card-rose, .card-indigo, .card-purple, .card-slate) :is(h3, h4, .text-2xl, .text-3xl) {
    font-variant-numeric: tabular-nums; letter-spacing: -0.02em; font-weight: 800;
}

/* Colour (owner: "use some colors too"): each count card keeps its own colour — gradient icon chip,
   coloured label and a thin coloured top accent. Overrides the flat theme, which made them all grey/blue. */
html body.ea-glass .card-sky { box-shadow: inset 0 3px 0 -0.5px rgba(14,165,233,.75), var(--glass-shadow); }
html body.ea-glass .card-sky:hover { box-shadow: inset 0 3px 0 -0.5px rgba(14,165,233,.75), var(--glass-shadow-hover); }
html body.ea-glass .card-sky .bg-gradient-to-br { background: linear-gradient(135deg, #38bdf8, #2563eb) !important; color: #fff !important; border: 0; box-shadow: 0 8px 18px -8px rgba(14,165,233,.75) !important; }
html body.ea-glass .card-sky :is([class*="text-sky-"], [class*="text-amber-"], [class*="text-emerald-"], [class*="text-rose-"], [class*="text-indigo-"], [class*="text-purple-"], [class*="text-violet-"]):not(a) { color: #0369a1 !important; }
html body.ea-glass .card-amber { box-shadow: inset 0 3px 0 -0.5px rgba(245,158,11,.8), var(--glass-shadow); }
html body.ea-glass .card-amber:hover { box-shadow: inset 0 3px 0 -0.5px rgba(245,158,11,.8), var(--glass-shadow-hover); }
html body.ea-glass .card-amber .bg-gradient-to-br { background: linear-gradient(135deg, #fbbf24, #f97316) !important; color: #fff !important; border: 0; box-shadow: 0 8px 18px -8px rgba(245,158,11,.8) !important; }
html body.ea-glass .card-amber :is([class*="text-sky-"], [class*="text-amber-"], [class*="text-emerald-"], [class*="text-rose-"], [class*="text-indigo-"], [class*="text-purple-"], [class*="text-violet-"]):not(a) { color: #b45309 !important; }
html body.ea-glass .card-emerald { box-shadow: inset 0 3px 0 -0.5px rgba(16,185,129,.75), var(--glass-shadow); }
html body.ea-glass .card-emerald:hover { box-shadow: inset 0 3px 0 -0.5px rgba(16,185,129,.75), var(--glass-shadow-hover); }
html body.ea-glass .card-emerald .bg-gradient-to-br { background: linear-gradient(135deg, #34d399, #059669) !important; color: #fff !important; border: 0; box-shadow: 0 8px 18px -8px rgba(16,185,129,.75) !important; }
html body.ea-glass .card-emerald :is([class*="text-sky-"], [class*="text-amber-"], [class*="text-emerald-"], [class*="text-rose-"], [class*="text-indigo-"], [class*="text-purple-"], [class*="text-violet-"]):not(a) { color: #047857 !important; }
html body.ea-glass .card-rose { box-shadow: inset 0 3px 0 -0.5px rgba(244,63,94,.75), var(--glass-shadow); }
html body.ea-glass .card-rose:hover { box-shadow: inset 0 3px 0 -0.5px rgba(244,63,94,.75), var(--glass-shadow-hover); }
html body.ea-glass .card-rose .bg-gradient-to-br { background: linear-gradient(135deg, #fb7185, #e11d48) !important; color: #fff !important; border: 0; box-shadow: 0 8px 18px -8px rgba(244,63,94,.75) !important; }
html body.ea-glass .card-rose :is([class*="text-sky-"], [class*="text-amber-"], [class*="text-emerald-"], [class*="text-rose-"], [class*="text-indigo-"], [class*="text-purple-"], [class*="text-violet-"]):not(a) { color: #be123c !important; }
html body.ea-glass .card-indigo { box-shadow: inset 0 3px 0 -0.5px rgba(99,102,241,.8), var(--glass-shadow); }
html body.ea-glass .card-indigo:hover { box-shadow: inset 0 3px 0 -0.5px rgba(99,102,241,.8), var(--glass-shadow-hover); }
html body.ea-glass .card-indigo .bg-gradient-to-br { background: linear-gradient(135deg, #818cf8, #4f46e5) !important; color: #fff !important; border: 0; box-shadow: 0 8px 18px -8px rgba(99,102,241,.8) !important; }
html body.ea-glass .card-indigo :is([class*="text-sky-"], [class*="text-amber-"], [class*="text-emerald-"], [class*="text-rose-"], [class*="text-indigo-"], [class*="text-purple-"], [class*="text-violet-"]):not(a) { color: #4338ca !important; }
html body.ea-glass .card-purple { box-shadow: inset 0 3px 0 -0.5px rgba(139,92,246,.8), var(--glass-shadow); }
html body.ea-glass .card-purple:hover { box-shadow: inset 0 3px 0 -0.5px rgba(139,92,246,.8), var(--glass-shadow-hover); }
html body.ea-glass .card-purple .bg-gradient-to-br { background: linear-gradient(135deg, #c084fc, #7c3aed) !important; color: #fff !important; border: 0; box-shadow: 0 8px 18px -8px rgba(139,92,246,.8) !important; }
html body.ea-glass .card-purple :is([class*="text-sky-"], [class*="text-amber-"], [class*="text-emerald-"], [class*="text-rose-"], [class*="text-indigo-"], [class*="text-purple-"], [class*="text-violet-"]):not(a) { color: #6d28d9 !important; }
html body.ea-glass :is(.card-sky, .card-amber, .card-emerald, .card-rose, .card-indigo, .card-purple, .card-slate) a[class*="text-"] { color: #1d4ed8 !important; }
/* the active (filtering) count card */
html body.ea-glass .status-card[aria-pressed="true"] { box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.55), var(--glass-shadow-hover); }

/* Decorative badges: their own colours again (the flat theme turned them all brand-blue) */
html body.ea-glass .badge-tech-cyan   { background: rgba(207, 250, 254, 0.75); color: #0e7490; border-color: rgba(103, 232, 249, 0.7); }
html body.ea-glass .badge-tech-indigo { background: rgba(224, 231, 255, 0.75); color: #4338ca; border-color: rgba(165, 180, 252, 0.7); }
html body.ea-glass .badge-tech-purple { background: rgba(237, 233, 254, 0.75); color: #6d28d9; border-color: rgba(196, 181, 253, 0.7); }
/* Table headers: a faint indigo-to-violet tint */
html body.ea-glass :is(.table-tech-head, thead tr) { background: linear-gradient(90deg, rgba(224, 231, 255, 0.60), rgba(237, 233, 254, 0.45)) !important; }

/* Page banners (the light gradient strips at the top of pages) become tinted glass */
html body.ea-glass main :is([class*="bg-gradient-to-r"][class*="from-sky-1"], [class*="bg-gradient-to-r"][class*="from-indigo-1"],
                            [class*="bg-gradient-to-r"][class*="from-sky-5"], [class*="bg-gradient-to-br"][class*="from-sky-1"],
                            [class*="bg-gradient-to-br"][class*="from-indigo-1"]):not(button):not(a):not(span) {
    background: linear-gradient(120deg, rgba(219, 234, 254, 0.70), rgba(237, 233, 254, 0.55) 55%, rgba(255, 255, 255, 0.45));
    -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(170%);
    backdrop-filter: blur(var(--glass-blur)) saturate(170%);
    border-color: var(--glass-border);
    box-shadow: var(--glass-shadow);
}

/* Plain white panels that are not using the card classes: translucent, no second blur */
html body.ea-glass main :is(.bg-white, [class*="bg-white/9"], [class*="bg-white/8"], [class*="bg-white/6"]):is(.rounded-xl, .rounded-2xl, .rounded-3xl):not(button):not(a):not(input):not(select):not(textarea):not(.btn-secondary) {
    background-color: var(--glass-inner);
    border-color: rgba(255, 255, 255, 0.8);
}
html body.ea-glass main :is([class*="bg-slate-50"]):is(.rounded-xl, .rounded-2xl, .rounded-lg):not(button):not(a):not(input):not(select):not(textarea) {
    background-color: rgba(248, 250, 255, 0.55);
}

/* ---------------------------------------------------------------- sidebar + top bar */
@media (min-width: 1024px) {
    html body.ea-glass #main-sidebar {
        background: rgba(255, 255, 255, 0.42);
        background-image: linear-gradient(180deg, rgba(255, 255, 255, 0.55), rgba(238, 242, 255, 0.32));
        -webkit-backdrop-filter: blur(24px) saturate(180%);
        backdrop-filter: blur(24px) saturate(180%);
        border-right: 1px solid rgba(255, 255, 255, 0.75);
        box-shadow: 1px 0 0 rgba(99, 102, 241, 0.10), 8px 0 30px -18px rgba(30, 41, 110, 0.25);
    }
}
html body.ea-glass #main-sidebar nav a:not([class*="bg-gradient"]):hover { background: rgba(255, 255, 255, 0.6); }
html body.ea-glass header.glass-card {
    background: rgba(255, 255, 255, 0.48);
    background-image: none;
    border: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.75);
    box-shadow: 0 1px 0 var(--glass-edge), 0 8px 24px -18px rgba(30, 41, 110, 0.35);
}
html body.ea-glass header :is(.rounded-xl, .rounded-full, .rounded-lg):is([class*="bg-"], [class*="border"]):not(button) {
    background-color: rgba(255, 255, 255, 0.55);
}

/* ---------------------------------------------------------------- tables */
html body.ea-glass thead th { background: transparent; }
html body.ea-glass tbody tr:hover, html body.ea-glass .table-tech-row:hover { background: rgba(255, 255, 255, 0.55) !important; }
html body.ea-glass table.dataTable tbody tr { background-color: transparent; }
html body.ea-glass .dataTables_wrapper .dataTables_paginate .paginate_button.current { background: rgba(37, 99, 235, 0.9) !important; color: #fff !important; border-radius: 10px; }

/* ---------------------------------------------------------------- form controls */
html body.ea-glass :is(input:not([type=checkbox]):not([type=radio]):not([type=file]):not([type=range]):not([type=hidden]), select, textarea) {
    background-color: rgba(255, 255, 255, 0.62);
    border-color: rgba(148, 163, 184, 0.45);
}
html body.ea-glass :is(input, select, textarea):focus { background-color: rgba(255, 255, 255, 0.92); }
html body.ea-glass :is(input, select, textarea)[readonly] { background-color: rgba(241, 245, 249, 0.55); }
html body.ea-glass .btn-secondary, html body.ea-glass main a.bg-white, html body.ea-glass main button.bg-white {
    background-color: rgba(255, 255, 255, 0.65);
    border-color: rgba(255, 255, 255, 0.85);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
}
html body.ea-glass .btn-primary, html body.ea-glass .tab-pill.active { box-shadow: 0 8px 22px -10px rgba(79, 70, 229, 0.65), inset 0 1px 0 rgba(255, 255, 255, 0.25); }

/* Micro-interactions: buttons press in slightly; the active sidebar item is a glowing gradient pill */
html body.ea-glass :is(button, a.btn-primary, .btn-primary, .btn-secondary) { transition: transform .12s ease, box-shadow .2s ease, filter .2s ease; }
html body.ea-glass :is(button, a.btn-primary, .btn-primary, .btn-secondary):active { transform: scale(.97); }
html body.ea-glass #main-sidebar nav a[class*="bg-gradient"] { box-shadow: 0 10px 24px -10px rgba(99, 102, 241, 0.7), inset 0 1px 0 rgba(255, 255, 255, 0.35); }

/* ---------------------------------------------------------------- modals and dropdowns */
html body.ea-glass .fixed.inset-0[class*="bg-slate-9"], html body.ea-glass .fixed.inset-0[class*="bg-black"] {
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
}
html body.ea-glass .fixed.inset-0 :is(.bg-white, [class*="bg-white/9"]):is(.rounded-2xl, .rounded-3xl, .rounded-xl):not(button):not(a) {
    background-color: rgba(255, 255, 255, 0.86);
    -webkit-backdrop-filter: blur(22px) saturate(170%);
    backdrop-filter: blur(22px) saturate(170%);
    border: 1px solid var(--glass-border);
}
html body.ea-glass #pickList {
    background: rgba(255, 255, 255, 0.86);
    -webkit-backdrop-filter: blur(20px) saturate(170%);
    backdrop-filter: blur(20px) saturate(170%);
    border-color: var(--glass-border);
}
/* ---------------------------------------------------------------- pop-ups (SweetAlert2), owner 17 Oct 2026:
   "modern, round corners, Apple-glass or something professional". Frosted panel, soft depth, calm type,
   pill-ish buttons. A pop-up's own confirmButtonColor (inline style) still wins over the default colour. */
html body.ea-glass .swal2-container.swal2-backdrop-show {
    background: rgba(15, 23, 42, 0.40) !important;
    -webkit-backdrop-filter: blur(10px) saturate(140%); backdrop-filter: blur(10px) saturate(140%);
}
/* corner notifications (toasts) never dim or blur the page */
html body.ea-glass .swal2-container.swal2-backdrop-show:has(> .swal2-toast),
html body.ea-glass .swal2-container:has(> .swal2-toast) { background: transparent !important; -webkit-backdrop-filter: none !important; backdrop-filter: none !important; }
/* Glassmorphic pane (owner, 17 Oct 2026: "glassmorphic" for the pop-ups): see-through frosted glass with a bright
   rim and a soft top sheen. The backdrop behind is dimmed and blurred, so text on the glass keeps WCAG AA contrast. */
html body.ea-glass .swal2-popup:not(.swal2-toast) {
    position: relative; overflow: hidden;
    border-radius: 26px !important;
    padding: 30px 28px 24px !important;
    background: linear-gradient(155deg, rgba(255, 255, 255, 0.80) 0%, rgba(255, 255, 255, 0.66) 55%, rgba(241, 245, 255, 0.70) 100%) !important;
    -webkit-backdrop-filter: blur(30px) saturate(190%); backdrop-filter: blur(30px) saturate(190%);
    border: 1px solid rgba(255, 255, 255, 0.70);
    box-shadow: 0 34px 90px -28px rgba(15, 23, 42, 0.55), 0 2px 8px rgba(15, 23, 42, 0.08),
                inset 0 1px 0 rgba(255, 255, 255, 0.95), inset 0 0 0 1px rgba(255, 255, 255, 0.25);
    font-family: inherit;
}
html body.ea-glass .swal2-popup:not(.swal2-toast)::before {
    content: ""; position: absolute; inset: 0 0 auto 0; height: 46%; pointer-events: none; border-radius: inherit;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.55), rgba(255, 255, 255, 0));
}
html body.ea-glass .swal2-popup:not(.swal2-toast) > * { position: relative; z-index: 1; }
html body.ea-glass .swal2-popup .swal2-title { font-size: 20px; font-weight: 800; letter-spacing: -0.01em; color: #0f172a; padding: 6px 0 0; }
html body.ea-glass .swal2-popup .swal2-html-container { font-size: 14px; line-height: 1.55; color: #475569; margin: 10px 4px 0; }
html body.ea-glass .swal2-popup .swal2-icon { transform: scale(0.78); margin: 2px auto 0; }
html body.ea-glass .swal2-popup .swal2-actions { gap: 10px; margin-top: 22px; }
html body.ea-glass .swal2-popup .swal2-styled {
    margin: 0; border-radius: 12px !important; padding: 0.62em 1.35em; font-size: 14px; font-weight: 700;
    box-shadow: 0 6px 16px -8px rgba(15, 23, 42, 0.45); transition: transform .12s ease, filter .12s ease;
}
html body.ea-glass .swal2-popup .swal2-styled:hover { filter: brightness(1.05); transform: translateY(-1px); }
html body.ea-glass .swal2-popup .swal2-styled:focus-visible { outline: 3px solid rgba(79, 70, 229, 0.35); outline-offset: 2px; box-shadow: none; }
html body.ea-glass .swal2-popup .swal2-styled.swal2-confirm { background-color: #4f46e5; }
html body.ea-glass .swal2-popup .swal2-styled.swal2-cancel,
html body.ea-glass .swal2-popup .swal2-styled.swal2-deny { background: #ffffff !important; color: #334155 !important; border: 1px solid #e2e8f0; box-shadow: none; }
html body.ea-glass .swal2-popup .swal2-input, html body.ea-glass .swal2-popup .swal2-textarea, html body.ea-glass .swal2-popup .swal2-select {
    border-radius: 12px; border: 1px solid #cbd5e1; box-shadow: none; font-size: 14px;
}
html body.ea-glass .swal2-popup .swal2-close { border-radius: 10px; color: #94a3b8; }
html body.ea-glass .swal2-popup .swal2-close:hover { color: #0f172a; background: rgba(15, 23, 42, 0.05); }
html body.ea-glass .swal2-popup.swal2-toast {
    border-radius: 16px !important; background: rgba(255, 255, 255, 0.92) !important;
    -webkit-backdrop-filter: blur(20px) saturate(170%); backdrop-filter: blur(20px) saturate(170%);
    border: 1px solid rgba(255, 255, 255, 0.75); box-shadow: 0 16px 40px -16px rgba(15, 23, 42, 0.35);
}
@media (prefers-reduced-motion: no-preference) {
    html body.ea-glass .swal2-popup.swal2-show:not(.swal2-toast) { animation: ea-pop-in .18s ease-out; }
    @keyframes ea-pop-in { from { opacity: 0; transform: translateY(6px) scale(0.98); } to { opacity: 1; transform: none; } }
}

/* ---------------------------------------------------------------- sign-in pages */
html body.ea-glass .ea-auth-card { background: rgba(255, 255, 255, 0.50); }
html body.ea-glass .ea-auth-pane { background: rgba(255, 255, 255, 0.40); }
html body.ea-glass .ea-auth-side { background: linear-gradient(160deg, rgba(191, 219, 254, 0.62), rgba(221, 214, 254, 0.48) 60%, rgba(207, 250, 254, 0.40)); }
/* Sign-in pages: stronger coloured light behind the card, so the frosting is visible */
html body.ea-glass.ea-auth {
    background-image:
        var(--grain),
        radial-gradient(520px 420px at 18% 22%, rgba(59, 130, 246, 0.45), transparent 65%),
        radial-gradient(560px 460px at 86% 18%, rgba(139, 92, 246, 0.40), transparent 65%),
        radial-gradient(520px 420px at 78% 92%, rgba(34, 211, 238, 0.35), transparent 65%),
        radial-gradient(480px 380px at 10% 95%, rgba(244, 114, 182, 0.30), transparent 65%),
        linear-gradient(160deg, #eef2ff 0%, #f3f0ff 55%, #ecfeff 100%);
}

/* ---------------------------------------------------------------- phones: lighter blur, mobile table cards */
@media (max-width: 767px) {
    :root { --glass-blur: 12px; }
    html body.ea-glass table.ea-cards tr {
        background: rgba(255, 255, 255, 0.62);
        border-color: rgba(255, 255, 255, 0.85);
    }
}

/* ---------------------------------------------------------------- fallbacks */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
    html body.ea-glass :is(.glass-card, .glass-card-tech, .card-elevated, .card-sky, .card-amber, .card-emerald, .card-rose,
                           .card-indigo, .card-purple, .ea-auth-card, header.glass-card, #main-sidebar) {
        background-color: rgba(255, 255, 255, 0.94);
    }
}
@media (prefers-reduced-motion: reduce) {
    html body.ea-glass :is(.card-sky, .card-amber, .card-emerald, .card-rose, .card-indigo, .card-purple, .card-slate):hover { transform: none; }
}
@media (prefers-reduced-transparency: reduce) {
    html body.ea-glass :is(.glass-card, .glass-card-tech, .card-elevated, .card-sky, .card-amber, .card-emerald, .card-rose,
                           .card-indigo, .card-purple, .ea-auth-card, header.glass-card, #main-sidebar) {
        background: #ffffff;
        -webkit-backdrop-filter: none;
        backdrop-filter: none;
    }
}

/* ---------------------------------------------------------------- phones: finger-sized links
   Text links ("Back to …", "Review ›", "View ›", "Forgot password?", work titles) were 13-20 px tall; a finger
   needs about 36 px. Links inside running text (p/li/td text) keep their normal line height. */
@media (max-width: 767px) {
    html body.ea-glass :is(main, .ea-auth-card) a[href]:not(p a):not(li a):not(label a):not([class*="btn"]):not(.fms-tbl-btn) {
        min-height: 36px;
        display: inline-flex;
        align-items: center;
    }
    html body.ea-glass main a[href].block { display: flex; }
    html body.ea-glass main a[href][class*="rounded"][class*="py-1"] { min-height: 40px; }
}

/* ---------- WCAG 1.4.3 contrast (accessibility audit 2026-10-17)
 * On the glass gradients, text-slate-400 measured 2.3-2.5:1 and text-slate-500 3.9-4.3:1 (minimum 4.5:1).
 * Same hierarchy, darker greys: 400 -> about 5.4:1, 500 -> about 7.4:1 on white. Placeholders were 2.45:1. */
html body.ea-glass .text-slate-400 { color: #5b6577 !important; }
html body.ea-glass .text-slate-500 { color: #4a5465 !important; }
html body.ea-glass ::placeholder { color: #556070 !important; opacity: 1; } /* 5.2:1+ on every field tint (WCAG AA) */
/* white text on emerald-600 badges/buttons was 3.75:1 -> emerald-700 (5.5:1) */
html body.ea-glass .bg-emerald-600 { background-color: #047857 !important; }
html body.ea-glass .hover\:bg-emerald-500:hover { background-color: #065f46 !important; }
/* every date input gets a visible keyboard focus ring (some had none) */
html body.ea-glass input[type="date"]:focus-visible, html body.ea-glass input[type="checkbox"]:focus-visible { outline: 2px solid #1d4ed8 !important; outline-offset: 2px; }

/* List pop-ups ("Issued to N people"): compact, frosted header that stays readable while the list scrolls */
html body.ea-glass .swal2-popup.ea-list-pop { padding: 20px 20px 16px !important; }
html body.ea-glass .ea-list-pop .swal2-title { font-size: 18px; padding: 0; }
html body.ea-glass .ea-list-pop .swal2-html-container { margin: 10px 0 0 !important; text-align: left; }
html body.ea-glass .ea-list-pop .swal2-actions { margin-top: 14px; }
.ea-stats { display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; margin-bottom: 10px; }
.ea-chip { display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 999px; font-size: 11px; font-weight: 700; border: 1px solid; white-space: nowrap; }
.ea-chip.ea-neutral { background: #eef2ff; color: #3730a3; border-color: #c7d2fe; }
.ea-chip.ea-ok { background: #ecfdf5; color: #047857; border-color: #a7f3d0; }
.ea-chip.ea-wait { background: #fffbeb; color: #92400e; border-color: #fde68a; }
button.ea-chip { cursor: pointer; opacity: .6; transition: opacity .15s, box-shadow .15s; }
button.ea-chip:hover, button.ea-chip.ea-on { opacity: 1; }
button.ea-chip.ea-on { box-shadow: 0 0 0 2px #fff, 0 0 0 4px currentColor; }
.ea-list { max-height: 58vh; overflow: auto; border-radius: 14px; border: 1px solid rgba(148, 163, 184, .35); background: rgba(255, 255, 255, .72); }
.ea-list table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }
.ea-list th { position: sticky; top: 0; z-index: 1; text-align: left; padding: 9px 12px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: #475569;
    background: rgba(241, 245, 249, .96); -webkit-backdrop-filter: blur(12px) saturate(160%); backdrop-filter: blur(12px) saturate(160%); border-bottom: 1px solid rgba(148, 163, 184, .35); }
.ea-list td { padding: 8px 12px; border-top: 1px solid rgba(226, 232, 240, .9); vertical-align: middle; }
.ea-list tbody tr:first-child td { border-top: 0; }
.ea-list tbody tr:hover td { background: rgba(238, 242, 255, .55); }
.ea-list .ea-right { text-align: right; }
.ea-list .ea-type { color: #475569; font-size: 12px; }
.ea-list .ea-person { color: #4338ca; font-weight: 600; text-decoration: none; }
.ea-list .ea-person:hover { text-decoration: underline; }
.ea-list .ea-mail { font-size: 11px; color: #64748b; margin-top: 1px; }

/* Banded rows (light grey, owner 17 Oct 2026) on EVERY table in the app, incl. the Expanded view (moved out of <main>), like Excel's table styles (owner 17 Oct 2026: "for all tables, in all pages").
   One rule for DataTables lists and plain tables alike; frozen columns keep an opaque copy (table-tools.js).
   Opt out with class="no-stripe". */
html body.ea-glass main table:not(.no-stripe) > tbody > tr:nth-child(even) > td,
html body.ea-glass .fms-tbl-full table:not(.no-stripe) > tbody > tr:nth-child(even) > td { background-color: #f3f4f6; }   /* light grey band */
html body.ea-glass main table:not(.no-stripe) > tbody > tr:nth-child(odd) > td,
html body.ea-glass .fms-tbl-full table:not(.no-stripe) > tbody > tr:nth-child(odd) > td { background-color: #ffffff; }
html body.ea-glass main table:not(.no-stripe) > tbody > tr:hover > td,
html body.ea-glass .fms-tbl-full table:not(.no-stripe) > tbody > tr:hover > td { background-color: #e8ecf8; }
html body.ea-glass main table:not(.no-stripe) > tbody > tr > td,
html body.ea-glass .fms-tbl-full table:not(.no-stripe) > tbody > tr > td { border-bottom: 1px solid #e5e7eb; }
.ea-list tbody tr:nth-child(even) td { background: rgba(248, 250, 252, .85); }

/* Glassmorphic document preview + signature pop-ups (owner 17 Oct 2026, reference: clear glass card with a bright
   bevelled edge, no decoration). A see-through pane: the page shows through, blurred; edge highlight + diagonal sheen;
   header, footer and document area sit directly on the glass. Markup in includes/modals.php is unchanged. */
html body.ea-glass #preview-modal, html body.ea-glass #signature-modal {
    background: radial-gradient(1200px 600px at 20% 10%, rgba(99, 102, 241, 0.22), transparent 60%),
                radial-gradient(900px 500px at 85% 90%, rgba(14, 165, 233, 0.20), transparent 60%),
                rgba(15, 23, 42, 0.42) !important;
    -webkit-backdrop-filter: blur(14px) saturate(150%); backdrop-filter: blur(14px) saturate(150%);
}
html body.ea-glass #preview-modal .glass-card, html body.ea-glass #signature-modal .glass-card {
    position: relative;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.30) 0%, rgba(255, 255, 255, 0.12) 45%, rgba(255, 255, 255, 0.20) 100%) !important;
    -webkit-backdrop-filter: blur(26px) saturate(170%); backdrop-filter: blur(26px) saturate(170%);
    border: 1.5px solid rgba(255, 255, 255, 0.55) !important; border-radius: 30px !important;
    box-shadow: 0 30px 80px -20px rgba(2, 6, 23, 0.55),
                inset 0 1.5px 0 rgba(255, 255, 255, 0.85),      /* top edge highlight */
                inset 1.5px 0 0 rgba(255, 255, 255, 0.35),      /* left edge */
                inset 0 -1px 0 rgba(255, 255, 255, 0.25),       /* bottom edge */
                inset 0 0 40px rgba(255, 255, 255, 0.08) !important;
}
/* diagonal sheen across the pane */
html body.ea-glass #preview-modal .glass-card::before, html body.ea-glass #signature-modal .glass-card::before {
    content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; z-index: 0;
    background: linear-gradient(120deg, rgba(255, 255, 255, 0.35) 0%, rgba(255, 255, 255, 0.06) 28%, transparent 42%, transparent 70%, rgba(255, 255, 255, 0.10) 100%);
}
html body.ea-glass #preview-modal .glass-card > *, html body.ea-glass #signature-modal .glass-card > * { position: relative; z-index: 1; }
html body.ea-glass #preview-modal .glass-card > div:first-child,
html body.ea-glass #preview-modal .glass-card > div:last-child { background: transparent !important; border-color: rgba(255, 255, 255, 0.28) !important; }
html body.ea-glass #preview-modal .glass-card > div:nth-child(2) { background: transparent !important; }
html body.ea-glass #preview-modal #preview-modal-title { color: #fff; text-shadow: 0 1px 2px rgba(2, 6, 23, 0.35); }
html body.ea-glass #preview-modal .glass-card > div:last-child { color: rgba(255, 255, 255, 0.85) !important; }
html body.ea-glass #preview-modal .glass-card > div:first-child .w-8 { background: rgba(255, 255, 255, 0.25) !important; color: #fff !important; border: 1px solid rgba(255, 255, 255, 0.45); }
html body.ea-glass #preview-modal .glass-card > div:first-child button { color: rgba(255, 255, 255, 0.9) !important; }
html body.ea-glass #preview-modal .glass-card > div:first-child button:hover { background: rgba(255, 255, 255, 0.18) !important; }
html body.ea-glass #preview-modal #preview-image, html body.ea-glass #preview-modal #preview-iframe {
    border-radius: 18px; box-shadow: 0 24px 60px -20px rgba(2, 6, 23, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.5);
}
html body.ea-glass #preview-modal-download {
    background: rgba(255, 255, 255, 0.18) !important; color: #fff !important; border: 1px solid rgba(255, 255, 255, 0.5);
    -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
}
html body.ea-glass #preview-modal-download:hover { background: rgba(255, 255, 255, 0.3) !important; }
html body.ea-glass #preview-modal .glass-card > div:last-child button {
    border-radius: 999px; padding-left: 18px; padding-right: 18px;
    background: rgba(255, 255, 255, 0.9) !important; color: #0f172a !important; box-shadow: 0 6px 18px -8px rgba(2, 6, 23, 0.5);
}

/* documents themselves stay on solid white for reading */
html body.ea-glass #preview-modal #preview-iframe { background: #fff !important; }
/* image previews: the window wraps the picture (owner: "why a lot of empty space? fit the document size") */
html body.ea-glass #preview-modal .glass-card.ea-fit { width: auto !important; min-width: min(460px, 94vw); max-width: min(1100px, 94vw); }
html body.ea-glass #preview-modal .glass-card.ea-fit > div:nth-child(2) { min-height: 0 !important; padding: 14px !important; }
html body.ea-glass #preview-modal .glass-card.ea-fit #preview-image { max-height: 76vh; max-width: 100%; width: auto; height: auto; background: transparent !important; }

/* Change-request conversation (assets/js/remarks-chat.js) */
.rm-chat { border-radius: 20px; border: 1px solid rgba(244, 63, 94, .28); background: linear-gradient(180deg, rgba(255, 241, 242, .92), rgba(255, 255, 255, .9)); box-shadow: 0 10px 30px -18px rgba(190, 18, 60, .45); overflow: hidden; }
.rm-chat[data-status="Done"] { border-color: rgba(245, 158, 11, .4); background: linear-gradient(180deg, rgba(255, 251, 235, .95), rgba(255, 255, 255, .9)); }
.rm-chat[data-status="none"] { border-color: rgba(148, 163, 184, .35); background: rgba(255, 255, 255, .85); box-shadow: none; }
.rm-chat.rm-gone { display: none; }
.rm-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 16px; border-bottom: 1px solid rgba(244, 63, 94, .15); }
.rm-title { display: flex; align-items: center; gap: 8px; font-size: 14px; color: #0f172a; flex-wrap: wrap; }
.rm-dot { width: 9px; height: 9px; border-radius: 999px; background: #e11d48; box-shadow: 0 0 0 4px rgba(225, 29, 72, .15); }
.rm-chat[data-status="Done"] .rm-dot { background: #f59e0b; box-shadow: 0 0 0 4px rgba(245, 158, 11, .18); }
.rm-chat[data-status="none"] .rm-dot { background: #94a3b8; box-shadow: none; }
.rm-status { font-size: 11px; font-weight: 700; color: #9f1239; background: rgba(255, 255, 255, .8); border: 1px solid rgba(244, 63, 94, .25); padding: 2px 9px; border-radius: 999px; }
.rm-chat[data-status="Done"] .rm-status { color: #92400e; border-color: rgba(245, 158, 11, .35); }
.rm-live { font-size: 10px; font-weight: 700; color: #059669; text-transform: uppercase; letter-spacing: .06em; }
.rm-live::before { content: "●"; margin-right: 4px; animation: rmPulse 1.6s infinite; }
@keyframes rmPulse { 50% { opacity: .3; } }
.rm-list { max-height: 320px; overflow-y: auto; padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; }
.rm-msg { display: flex; flex-direction: column; max-width: 82%; }
.rm-mine { align-self: flex-end; align-items: flex-end; }
.rm-theirs { align-self: flex-start; align-items: flex-start; }
.rm-bubble { padding: 9px 12px; border-radius: 16px; font-size: 13px; line-height: 1.45; color: #0f172a; background: #fff; border: 1px solid #e2e8f0; white-space: normal; word-break: break-word; }
.rm-mine .rm-bubble { background: #4f46e5; color: #fff; border-color: #4f46e5; border-bottom-right-radius: 6px; }
.rm-theirs .rm-bubble { border-bottom-left-radius: 6px; }
.rm-meta { font-size: 10.5px; color: #64748b; margin-top: 3px; }
.rm-sys { align-self: center; font-size: 11px; color: #475569; background: rgba(241, 245, 249, .9); border: 1px solid #e2e8f0; padding: 3px 10px; border-radius: 999px; }
.rm-sys span { color: #94a3b8; }
.rm-form { padding: 10px 12px 12px; border-top: 1px solid rgba(244, 63, 94, .12); background: rgba(255, 255, 255, .7); }
.rm-form textarea { width: 100%; resize: vertical; min-height: 44px; border-radius: 12px; border: 1px solid #cbd5e1; padding: 8px 10px; font-size: 13px; background: #fff; }
.rm-form textarea:focus { outline: 2px solid rgba(79, 70, 229, .35); border-color: #6366f1; }
.rm-actions { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 8px; flex-wrap: wrap; }
.rm-hint { font-size: 11px; color: #64748b; }
.rm-btns { display: flex; gap: 6px; flex-wrap: wrap; margin-left: auto; }
.rm-b { padding: 7px 14px; border-radius: 10px; font-size: 12px; font-weight: 700; border: 1px solid transparent; cursor: pointer; }
.rm-primary { background: #4f46e5; color: #fff; }
.rm-primary:hover { background: #4338ca; }
.rm-ok { background: #059669; color: #fff; }
.rm-ok:hover { background: #047857; }
.rm-ghost { background: #fff; color: #334155; border-color: #cbd5e1; }
.rm-ghost:hover { background: #f8fafc; }

/* ---------------------------------------------------------------- WCAG AA contrast (owner, 17 Oct 2026: "all
   placeholder and secondary texts meet WCAG AA/AAA contrast against their container background"). Measured on
   every page with axe-core plus pixel sampling: these Tailwind shades sat below 4.5:1 on white / light tints, so
   they move one step darker portal-wide (icons using the same classes darken with them, which is fine). */
html body.ea-glass .text-slate-300, html body.ea-glass .text-slate-400,
html body.ea-glass .text-slate-500 { color: #556070 !important; }   /* secondary grey: 5.2:1 even on the tinted rows / headers */
html body.ea-glass .text-gray-400  { color: #6b7280 !important; }
html body.ea-glass .text-sky-500, html body.ea-glass .text-sky-600 { color: #0369a1 !important; }        /* 5.9 */
html body.ea-glass .text-amber-500, html body.ea-glass .text-amber-600 { color: #b45309 !important; }    /* 5.0 */
html body.ea-glass .text-amber-700 { color: #92400e !important; }                                       /* 6.8 on amber-50 */
html body.ea-glass .text-emerald-500, html body.ea-glass .text-emerald-600 { color: #047857 !important; } /* 5.5 */
html body.ea-glass .text-emerald-700 { color: #065f46 !important; }                                     /* 7.3 on emerald-50 */
html body.ea-glass .text-rose-500, html body.ea-glass .text-rose-600 { color: #be123c !important; }      /* 6.3 */
html body.ea-glass .text-rose-700 { color: #9f1239 !important; }
html body.ea-glass .text-brand-500, html body.ea-glass .text-brand-600 { color: #1d4ed8 !important; }    /* 6.7 */
html body.ea-glass .text-indigo-500 { color: #4338ca !important; }
html body.ea-glass .text-teal-600 { color: #0f766e !important; }
/* white text on a coloured button */
html body.ea-glass .bg-emerald-600 { background-color: #047857 !important; }
html body.ea-glass .bg-sky-600 { background-color: #0369a1 !important; }
html body.ea-glass .bg-amber-600, html body.ea-glass .bg-amber-500 { background-color: #b45309 !important; }
html body.ea-glass .bg-teal-600 { background-color: #0f766e !important; }
html body.ea-glass .text-white\/60, html body.ea-glass .text-white\/70 { color: rgba(255, 255, 255, 0.88) !important; }
/* the "Show N records" picker and DataTables info line */
html body.ea-glass .dataTables_wrapper .dataTables_length select, html body.ea-glass .dataTables_wrapper .dataTables_length,
html body.ea-glass .dataTables_wrapper .dataTables_info { color: #334155 !important; }
