:root {
    --erp-primary: #0b5cab;
    --erp-primary-dark: #084080;
    --erp-primary-light: #1c7bd0;
    --erp-accent: #f59e0b;
    --erp-surface: #f7f9fc;
    --erp-surface-alt: #eef2f7;
    --erp-border: #dde3ed;
    --erp-text: #1f2937;
    --erp-text-muted: #6b7280;
    /* SackNova brand tokens */
    --sn-brand-1: #0b5cab;
    --sn-brand-2: #6d28d9;
    --sn-brand-3: #f59e0b;
}

/* === Motion tokens & keyframes (GPU-cheap; respects reduced-motion) === */
@keyframes sn-fade-up {
    from { opacity: 0; transform: translate3d(0, 12px, 0); }
    to   { opacity: 1; transform: translate3d(0, 0, 0); }
}
@keyframes sn-fade-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}
@keyframes sn-scale-in {
    from { opacity: 0; transform: scale(0.96); }
    to   { opacity: 1; transform: scale(1); }
}
@keyframes sn-pulse-dot {
    0%, 100% { transform: scale(1);   opacity: 1; }
    50%      { transform: scale(1.35); opacity: 0.55; }
}
@keyframes sn-gradient-shift {
    0%   { background-position:   0% 50%; }
    50%  { background-position: 100% 50%; }
    100% { background-position:   0% 50%; }
}
@keyframes sn-orbit-a {
    from { transform: translate3d(0, 0, 0); }
    50%  { transform: translate3d(-14px, 10px, 0); }
    to   { transform: translate3d(0, 0, 0); }
}
@keyframes sn-orbit-b {
    from { transform: translate3d(0, 0, 0); }
    50%  { transform: translate3d(18px, -12px, 0); }
    to   { transform: translate3d(0, 0, 0); }
}
@keyframes sn-caret {
    0%, 40%  { transform: translateX(0);  opacity: 0.6; }
    70%      { transform: translateX(3px); opacity: 1; }
    100%     { transform: translateX(0);  opacity: 0.6; }
}
@keyframes sn-shimmer {
    from { background-position: -200% 0; }
    to   { background-position:  200% 0; }
}

.sn-fade-up   { animation: sn-fade-up 480ms cubic-bezier(.22,.9,.32,1) both; }
.sn-fade-in   { animation: sn-fade-in 500ms ease-out both; }
.sn-scale-in  { animation: sn-scale-in 420ms cubic-bezier(.22,.9,.32,1) both; }
.sn-delay-1   { animation-delay: 60ms; }
.sn-delay-2   { animation-delay: 120ms; }
.sn-delay-3   { animation-delay: 180ms; }
.sn-delay-4   { animation-delay: 240ms; }
.sn-delay-5   { animation-delay: 300ms; }

@media (prefers-reduced-motion: reduce) {
    .sn-fade-up, .sn-fade-in, .sn-scale-in,
    .erp-institute-card, .erp-stat-card, .erp-login-brand::before, .erp-login-brand::after,
    .sn-wordmark .dot, .sn-wordmark::after {
        animation: none !important;
        transition: none !important;
    }
}

/* === SackNova wordmark === */
.sn-wordmark {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif;
    font-weight: 700;
    letter-spacing: -0.01em;
    line-height: 1;
    text-decoration: none;
    color: inherit;
}
.sn-wordmark .glyph {
    position: relative;
    width: 1.6em; height: 1.6em;
    border-radius: 30% 65% 30% 65% / 65% 30% 65% 30%;
    background: linear-gradient(135deg, var(--sn-brand-1), var(--sn-brand-2) 55%, var(--sn-brand-3));
    background-size: 200% 200%;
    animation: sn-gradient-shift 8s ease-in-out infinite;
    display: inline-flex;
    align-items: center; justify-content: center;
    box-shadow: 0 4px 12px -4px rgba(109, 40, 217, 0.35);
    flex-shrink: 0;
}
.sn-wordmark .glyph::after {
    content: "";
    position: absolute;
    inset: 22%;
    border-radius: 50%;
    background: rgba(255,255,255,0.92);
    box-shadow: 0 0 0 1px rgba(255,255,255,0.4) inset;
}
.sn-wordmark .glyph::before {
    content: "";
    position: absolute;
    top: 18%; right: 18%;
    width: 22%; height: 22%;
    border-radius: 50%;
    background: var(--sn-brand-3);
    box-shadow: 0 0 0 3px rgba(245,158,11,0.25);
    animation: sn-pulse-dot 2.6s ease-in-out infinite;
}
.sn-wordmark .name {
    font-size: 1.05em;
    background: linear-gradient(90deg, var(--sn-brand-1), var(--sn-brand-2) 55%, var(--sn-brand-3));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    background-size: 200% 100%;
    animation: sn-gradient-shift 10s ease-in-out infinite;
}
.sn-wordmark .name-tail {
    font-weight: 500;
    color: var(--erp-text-muted);
    letter-spacing: 0.02em;
    font-size: 0.72em;
    margin-left: 0.25em;
}
.sn-wordmark.on-dark .name-tail { color: rgba(255,255,255,0.75); }
.sn-wordmark.on-dark .glyph::after { background: rgba(255,255,255,0.95); }
.sn-wordmark.lg { font-size: 1.5rem; }
.sn-wordmark.xl { font-size: 2rem; }
.sn-wordmark.sm { font-size: 0.95rem; }

html, body { height: 100%; }
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: var(--erp-surface);
    color: var(--erp-text);
    font-size: 14px;
}

/* === Top navigation === */
.erp-navbar {
    background: linear-gradient(135deg, var(--erp-primary-dark), var(--erp-primary-light));
    box-shadow: 0 2px 4px rgba(0,0,0,0.08);
    padding: 0.5rem 0;
}
.erp-navbar .nav-link,
.erp-navbar .navbar-brand { color: #fff !important; }
.erp-navbar .nav-link:hover { color: rgba(255,255,255,0.85) !important; }
.erp-navbar .dropdown-menu { border: 0; }

/* === Main area === */
.erp-main {
    min-height: calc(100vh - 132px);
}

/* === Footer === */
.erp-footer {
    background: #fff;
    border-top: 1px solid var(--erp-border);
}
.erp-footer a { color: var(--erp-primary); text-decoration: none; }

/* === Buttons & brand tones === */
.btn-primary {
    background-color: var(--erp-primary);
    border-color: var(--erp-primary);
}
.btn-primary:hover,
.btn-primary:focus {
    background-color: var(--erp-primary-dark);
    border-color: var(--erp-primary-dark);
}
.btn-outline-primary {
    color: var(--erp-primary);
    border-color: var(--erp-primary);
}
.btn-outline-primary:hover {
    background-color: var(--erp-primary);
    color: #fff;
}

/* === Cards === */
.card {
    border-radius: 12px;
}
.card .card-body { padding: 1.25rem; }

/* === Sortable-table headers (2026-07-13) === */
/* Auto-attaches via sortable-table.js — no per-view markup change. Click
   a header to cycle asc → desc → original; opt any grid out with the
   `.no-sort` class on the <table> or the individual <th>. */
.sortable-table > thead > tr > th.sortable-th {
    cursor: pointer;
    user-select: none;
    position: relative;
    padding-right: 22px;   /* room for the sort arrow */
}
.sortable-table > thead > tr > th.sortable-th::after {
    content: "";
    position: absolute;
    right: 8px; top: 50%;
    width: 0; height: 0;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-top: 5px solid #cbd5e0;
    border-bottom: 5px solid #cbd5e0;
    transform: translateY(-50%);
    opacity: 0.55;
    transition: opacity .15s;
}
.sortable-table > thead > tr > th.sortable-th:hover::after { opacity: 1; }
.sortable-table > thead > tr > th.sortable-th.is-sorted-asc::after {
    border-top: 0;
    border-bottom: 5px solid var(--erp-primary);
    opacity: 1;
}
.sortable-table > thead > tr > th.sortable-th.is-sorted-desc::after {
    border-bottom: 0;
    border-top: 5px solid var(--erp-primary);
    opacity: 1;
}
.sortable-table > thead > tr > th.sortable-th:focus-visible {
    outline: 2px solid var(--erp-primary-light);
    outline-offset: -2px;
}

/* === Public-side (institute select / login) — minimal pro shell === */
.erp-login-body {
    background:
        radial-gradient(1200px 600px at 10% -10%, rgba(11,92,171,.12), transparent 60%),
        radial-gradient(900px 500px at 100% 110%, rgba(245,158,11,.10), transparent 55%),
        var(--erp-surface);
    min-height: 100vh;
    /* The animated orbit glows on the brand panel + institute-card entrance
       transforms briefly exceed their parent bounds; clip so no horizontal
       scrollbar shows up on the public-side pages. */
    overflow-x: hidden;
}

/* Split hero: brand panel on the left, form on the right. Stacks on mobile.
   Fills the viewport vertically so there's no dead space on tall monitors. */
.erp-login-body {
    display: flex;
    align-items: center;
    justify-content: center;
}
.erp-login-shell {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
    width: 100%;
    max-width: 1360px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
    box-sizing: border-box;
}
@media (min-width: 992px) {
    .erp-login-shell.with-brand {
        grid-template-columns: minmax(320px, 1fr) minmax(420px, 1.05fr);
        align-items: stretch;
        min-height: min(820px, calc(100vh - 3rem));
    }
    /* Let the form-side column stretch to match brand-panel height, and let
       the card grow with it. Content stays top-anchored inside the card so
       short forms (Login) look natural; long content (Institute selection)
       is free to fill the extra room without a scroll bar. */
    .erp-login-shell.with-brand > main {
        display: flex; flex-direction: column;
    }
    .erp-login-shell.with-brand > main > .erp-login-card {
        flex-grow: 1;
    }
}
@media (min-width: 1600px) {
    .erp-login-shell { max-width: 1520px; }
}
.erp-login-brand {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 2rem;
    color: #fff;
    border-radius: 20px;
    background:
        linear-gradient(135deg, var(--erp-primary-dark) 0%, var(--erp-primary) 55%, var(--erp-primary-light) 100%);
    box-shadow: 0 20px 40px -20px rgba(11,92,171,0.55);
    position: relative;
    overflow: hidden;
}
.erp-login-brand::before {
    content: "";
    position: absolute;
    inset: auto -40% -60% auto;
    width: 480px; height: 480px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255,255,255,0.14), transparent 65%);
    pointer-events: none;
    animation: sn-orbit-a 14s ease-in-out infinite;
    will-change: transform;
}
.erp-login-brand::after {
    content: "";
    position: absolute;
    inset: -30% auto auto -25%;
    width: 380px; height: 380px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(245,158,11,0.20), transparent 60%);
    pointer-events: none;
    animation: sn-orbit-b 18s ease-in-out infinite;
    will-change: transform;
}
.erp-login-brand > * { position: relative; z-index: 1; }
.erp-login-brand .brand-mark {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    font-size: 0.85rem;
    opacity: 0.9;
}
.erp-login-brand .brand-mark .dot {
    width: 8px; height: 8px; border-radius: 50%;
    background: var(--erp-accent);
    box-shadow: 0 0 0 4px rgba(245,158,11,0.25);
    animation: sn-pulse-dot 2.6s ease-in-out infinite;
}
.erp-login-brand h1 {
    font-size: clamp(1.6rem, 2.4vw, 2.2rem);
    line-height: 1.15;
    font-weight: 600;
    margin: 1.5rem 0 0.75rem;
}
.erp-login-brand p.tagline {
    font-size: 0.95rem;
    max-width: 42ch;
    opacity: 0.88;
    margin-bottom: 0;
}
.erp-login-brand .brand-highlights {
    display: grid;
    grid-template-columns: repeat(2, minmax(0,1fr));
    gap: 0.75rem;
    margin-top: 2rem;
}
.erp-login-brand .brand-highlights .hi {
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 12px;
    padding: 0.75rem 0.9rem;
    backdrop-filter: blur(4px);
}
.erp-login-brand .brand-highlights .hi i {
    font-size: 1.15rem;
    opacity: 0.9;
}
.erp-login-brand .brand-highlights .hi .lbl {
    font-size: 0.78rem;
    opacity: 0.85;
}
.erp-login-brand .brand-footer {
    font-size: 0.78rem;
    opacity: 0.75;
}

/* Mobile-only top brand strip: Company (Synchronik) | Product (SackNova).
   Images are capped to a display height so uploaded logos of any pixel size
   won't blow past the viewport width. Wraps to two rows if the two brands
   together exceed the available width. */
.erp-mobile-brandbar {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.35rem 0.5rem;
}
.erp-mobile-brandbar .sn-wordmark { font-size: 1.4rem; }
.erp-mobile-brand-img {
    height: 44px;
    width: auto;
    max-width: 80vw;
    max-height: 44px;
    object-fit: contain;
    display: block;
}

.erp-login-card {
    border-radius: 20px;
    background: #fff;
    box-shadow: 0 12px 40px -18px rgba(15,23,42,0.20);
}
.erp-login-card .card-body { padding: 2rem clamp(1.5rem, 4vw, 2.75rem); }
.erp-login-card .brand-lockup {
    display: flex; flex-direction: column; align-items: center;
    gap: 0.6rem; margin-bottom: 1.5rem;
}
.erp-login-card .brand-lockup img {
    height: 60px; width: 60px; object-fit: contain;
    padding: 6px;
    background: #fff;
    border: 1px solid var(--erp-border);
    border-radius: 14px;
    box-shadow: 0 4px 12px rgba(11,92,171,0.10);
}
.erp-login-card .brand-lockup .name {
    font-weight: 600; font-size: 1.05rem; color: var(--erp-text);
    text-align: center;
}
.erp-login-card .brand-lockup .code {
    font-size: 0.78rem; letter-spacing: 0.08em;
    color: var(--erp-text-muted);
    text-transform: uppercase;
}
.erp-login-card .brand-lockup .brand-lockup-divider {
    width: 40px; height: 1px;
    background: linear-gradient(90deg, transparent, var(--erp-border), transparent);
    margin: 0.35rem 0 0.15rem;
}
/* Product wordmark image inside the login-card lockup — override the
   60×60 square rule above (which is meant for the institute emblem). */
.erp-login-card .brand-lockup .erp-login-product-img {
    height: 34px; width: auto; max-width: 260px;
    padding: 0; background: transparent; border: 0; box-shadow: none;
    border-radius: 0; object-fit: contain;
}
.erp-login-card .brand-lockup .erp-login-product-img.lg {
    height: 50px; max-width: 320px;
}
/* On dark panels the navy SackNova mark disappears — this filter turns
   any coloured SVG into pure white while preserving anti-alias/alpha,
   so a single asset works on both light and dark surfaces. */
.erp-product-img-on-dark {
    filter: brightness(0) invert(1);
    -webkit-filter: brightness(0) invert(1);
}
/* Product wordmark as the solo brand in the top-bar left zone —
   contained in a white rounded pill so the natural navy SackNova mark
   reads clearly against the dark blue top-bar. Same visual treatment
   the mark receives on the white login card body. */
.erp-appbar-left a.erp-appbar-product-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 4px 2px;
    /*background: rgba(255,255,255,0.96);*/
   /* border-radius: 999px;*/
   /* box-shadow: 0 1px 3px rgba(0,0,0,0.15), inset 0 0 0 1px rgba(255,255,255,0.5);*/
    transition: transform 0.15s ease, background 0.15s ease;
}
.erp-appbar-left a.erp-appbar-product-chip:hover {
    transform: translateY(-1px);
    /*background: #fff;*/
}
.erp-appbar-left a img.erp-appbar-product-solo {
    height: 30px; width: auto; max-width: 190px;
    max-height: 30px;
    object-fit: contain; display: block;
    /* No invert filter — the pill provides the light backdrop the mark
       was designed for, so the wordmark shows in its natural colours. */
    filter: none;
    -webkit-filter: none;
}
/* Product wordmark inside the login hero brand panel (large, blue bg).
   Sized for the blue-bg SackNova asset — a near-square viewBox
   (~1685x1167 ≈ 1.44:1) rather than the wide wordmark. Height 150px
   yields ~216px wide, which reads as a proper brand mark on the panel.
   Horizontally centered on the panel's vertical axis via margin:auto.
   The slim 56px appbar uses a container-scoped override further down. */
.erp-login-brand-hero-img {
    height: 150px; width: auto; max-width: 260px;
    object-fit: contain; display: block;
    margin: 0 auto 1rem;
}
/* Same image inside the 56px appbar chip — cap height so it fits under
   the bar without overflowing. Width follows aspect ratio (~69px). The
   chip is a small inline-flex anchor so the auto horizontal margins
   collapse to zero — no visual impact here. */
.erp-appbar-product-chip .erp-login-brand-hero-img {
    height: 48px;
    max-width: 80px;
    margin: 0;
}
/* Product wordmark inside the mobile sidebar brand row (light bg). */
.erp-sidebar-brand-img {
    height: 26px; width: auto; max-width: 200px;
    object-fit: contain; display: block;
}
/* Product wordmark in the footer — sits at the left, slightly larger than
   the inline text so it reads as the primary brand mark on the page. */
.erp-footer-brand-img {
    height: 22px; width: auto; max-width: 140px;
    object-fit: contain; vertical-align: middle;
}
/* Company wordmark in the footer, replaces the "Synchronik" text link. */
.erp-footer-company-img {
    height: 18px; width: auto; max-width: 120px;
    object-fit: contain; vertical-align: middle;
}

/* Institute grid on the selection screen */
.erp-institute-search {
    position: relative;
    margin-bottom: 1rem;
}
.erp-institute-search .bi {
    position: absolute; top: 50%; left: 0.85rem; transform: translateY(-50%);
    color: var(--erp-text-muted); pointer-events: none;
}
.erp-institute-search .form-control {
    padding-left: 2.3rem;
    border-radius: 10px;
    border-color: var(--erp-border);
    background: #fff;
}
.erp-institute-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.75rem;
    max-height: 58vh;
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 4px;
}
@media (min-width: 576px) {
    .erp-institute-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 992px) {
    .erp-institute-grid { max-height: none; }
}
/* Grid items must never push past their column width — otherwise the
   fade-up transform + long institute names cause a horizontal scrollbar. */
.erp-institute-grid > * { min-width: 0; }
.erp-institute-card {
    display: flex; align-items: center; gap: 0.85rem;
    width: 100%; padding: 0.85rem 0.95rem;
    border: 1px solid var(--erp-border);
    border-radius: 12px;
    background: #fff;
    text-align: left;
    color: inherit;
    transition: transform 120ms ease, box-shadow 160ms ease, border-color 160ms ease;
}
.erp-institute-card:hover, .erp-institute-card:focus-visible {
    transform: translateY(-2px);
    box-shadow: 0 14px 30px -18px rgba(11,92,171,0.40);
    border-color: var(--erp-primary-light);
    outline: none;
}
.erp-institute-card .chev { transition: transform 180ms ease, opacity 180ms ease; }
.erp-institute-card:hover .chev,
.erp-institute-card:focus-visible .chev { transform: translateX(3px); }
.erp-institute-grid > * { animation: sn-fade-up 420ms cubic-bezier(.22,.9,.32,1) both; }
.erp-institute-grid > *:nth-child(1)  { animation-delay:  30ms; }
.erp-institute-grid > *:nth-child(2)  { animation-delay:  70ms; }
.erp-institute-grid > *:nth-child(3)  { animation-delay: 110ms; }
.erp-institute-grid > *:nth-child(4)  { animation-delay: 150ms; }
.erp-institute-grid > *:nth-child(5)  { animation-delay: 190ms; }
.erp-institute-grid > *:nth-child(6)  { animation-delay: 230ms; }
.erp-institute-grid > *:nth-child(7)  { animation-delay: 270ms; }
.erp-institute-grid > *:nth-child(8)  { animation-delay: 310ms; }
.erp-institute-grid > *:nth-child(n+9){ animation-delay: 340ms; }
.erp-institute-card img {
    width: 44px; height: 44px; object-fit: contain;
    padding: 4px;
    border: 1px solid var(--erp-border);
    border-radius: 10px;
    background: #fff;
    flex-shrink: 0;
}
.erp-institute-card .name {
    font-weight: 600; color: var(--erp-text);
    line-height: 1.2;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.erp-institute-card .meta {
    font-size: 0.75rem; color: var(--erp-text-muted);
    margin-top: 2px;
}
.erp-institute-card .chev {
    color: var(--erp-text-muted); opacity: 0; transition: opacity 120ms ease;
}
.erp-institute-card:hover .chev, .erp-institute-card:focus-visible .chev { opacity: 1; }

/* Login form refinements */
.erp-login-form .input-icon {
    position: relative;
}
.erp-login-form .input-icon > .bi:not(.input-pw-toggle .bi) {
    position: absolute; top: 50%; left: 0.85rem; transform: translateY(-50%);
    color: var(--erp-text-muted); pointer-events: none;
    font-size: 0.95rem;
}
.erp-login-form .input-icon .form-control {
    padding-left: 2.35rem;
    border-radius: 10px;
    border-color: var(--erp-border);
}
.erp-login-form .input-icon .form-control.has-pw-toggle,
.input-icon .form-control.has-pw-toggle {
    padding-right: 2.6rem;
}

/* Universal password visibility toggle — works inside .input-icon,
   .input-group, .form-floating, or a bare .position-relative wrapper. */
.input-pw-toggle {
    position: absolute;
    top: 50%;
    right: 0.4rem;
    transform: translateY(-50%);
    border: 0;
    background: transparent;
    color: var(--erp-text-muted);
    padding: 0.25rem 0.5rem;
    line-height: 1;
    border-radius: 6px;
    cursor: pointer;
    transition: color 140ms ease, background 140ms ease;
    z-index: 3;
}
.input-pw-toggle:hover  { color: var(--erp-primary); background: rgba(11,92,171,0.06); }
.input-pw-toggle:focus  { outline: none; color: var(--erp-primary); box-shadow: 0 0 0 0.2rem rgba(11,92,171,0.15); }
.input-pw-toggle:active { transform: translateY(-50%) scale(0.94); }
.input-pw-toggle .bi { font-size: 1rem; pointer-events: none; }
.erp-login-form .btn-signin {
    padding: 0.65rem 1rem;
    border-radius: 10px;
    font-weight: 500;
    letter-spacing: 0.01em;
    position: relative;
    overflow: hidden;
    transition: transform 140ms ease, box-shadow 200ms ease;
}
.erp-login-form .btn-signin:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 24px -14px rgba(11,92,171,0.55);
}
.erp-login-form .btn-signin i { transition: transform 180ms ease; }
.erp-login-form .btn-signin:hover i { transform: translateX(4px); }
.erp-login-form .btn-signin::before {
    content: "";
    position: absolute; inset: 0;
    background: linear-gradient(120deg, transparent 0%, rgba(255,255,255,0.28) 45%, transparent 90%);
    transform: translateX(-120%);
    transition: transform 620ms ease;
    pointer-events: none;
}
.erp-login-form .btn-signin:hover::before { transform: translateX(120%); }
.erp-login-footer-links a {
    color: var(--erp-primary);
    text-decoration: none;
    font-weight: 500;
}
.erp-login-footer-links a:hover { text-decoration: underline; }

/* === Dashboard welcome hero === */
.erp-welcome {
    background: linear-gradient(135deg, var(--erp-primary-dark) 0%, var(--erp-primary) 100%);
    color: #fff;
    border-radius: 16px;
    padding: 1.5rem 1.75rem;
    position: relative;
    overflow: hidden;
    box-shadow: 0 12px 28px -18px rgba(11,92,171,0.5);
}
.erp-welcome::after {
    content: "";
    position: absolute;
    right: -60px; bottom: -80px;
    width: 260px; height: 260px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(245,158,11,0.20), transparent 65%);
    pointer-events: none;
    animation: sn-orbit-a 16s ease-in-out infinite;
    will-change: transform;
}
.erp-welcome::before {
    content: "";
    position: absolute;
    left: -50px; top: -60px;
    width: 200px; height: 200px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255,255,255,0.16), transparent 60%);
    pointer-events: none;
    animation: sn-orbit-b 20s ease-in-out infinite;
    will-change: transform;
}
.erp-welcome .eyebrow {
    text-transform: uppercase;
    letter-spacing: 0.12em;
    font-size: 0.72rem;
    opacity: 0.85;
    font-weight: 500;
}
.erp-welcome h1 { font-size: clamp(1.35rem, 2vw, 1.7rem); font-weight: 600; margin: 0.35rem 0 0.25rem; }
.erp-welcome .sub { opacity: 0.85; font-size: 0.9rem; }

.erp-stat-card {
    border-radius: 14px;
    border: 1px solid var(--erp-border);
    transition: transform 160ms ease, box-shadow 160ms ease;
}
.erp-stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 26px -18px rgba(11,92,171,0.35);
}
.erp-stat-card .card-body { display: flex; align-items: center; gap: 0.85rem; }
.erp-stat-card .lbl {
    font-size: 0.75rem;
    letter-spacing: 0.04em;
    color: var(--erp-text-muted);
    text-transform: uppercase;
    font-weight: 500;
}
.erp-stat-card .val {
    font-size: 1.4rem; font-weight: 600; color: var(--erp-text);
    line-height: 1;
}

/* === Dashboard stat icons === */
.erp-stat-icon {
    width: 48px; height: 48px;
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: 10px;
    font-size: 1.5rem;
    flex-shrink: 0;
}

/* === Forms === */
.form-label { font-size: 0.85rem; font-weight: 500; margin-bottom: 0.25rem; }
.form-control:focus,
.form-select:focus {
    border-color: var(--erp-primary-light);
    box-shadow: 0 0 0 0.2rem rgba(11,92,171,.15);
}
.letter-spacing-large { letter-spacing: 0.4em; }

/* === Error page === */
.erp-error-body {
    background: var(--erp-surface);
    min-height: 100vh;
    display: flex;
    align-items: center;
}

/* === Utilities === */
.text-primary { color: var(--erp-primary) !important; }
.bg-primary   { background-color: var(--erp-primary) !important; }

/* === Mobile tweaks === */
@media (max-width: 576px) {
    .erp-main { padding-top: 1rem; padding-bottom: 1rem; }
    .card .card-body { padding: 1rem; }
}

/* === FieldGuide — the canonical (i) info-icon next to abbreviated
   grid headers AND form labels.
   Convention name: "FieldGuide". Two-layer treatment:
     1. native title="full form" tooltip on the <th> / <label> itself
        — instant hover glance.
     2. inline (i) icon tagged with .field-guide carrying a Bootstrap
        popover (data-bs-toggle="popover", data-bs-trigger="focus") for
        the longer explainer — tap-friendly on mobile.
   The icon is sized down so column / row width is stable between hover
   states. Init is global via window.erp.initFieldGuide() in app.js. */
.field-guide {
    cursor: help;
    font-size: 0.7rem;
    line-height: 1;
    vertical-align: 0.05em;
    opacity: 0.7;
}
.field-guide:hover, .field-guide:focus {
    opacity: 1;
    outline: none;
}

/* === Compact attendance roster grid ===
   Faculty Mark page must accommodate ~120 students per session without
   forcing the user to scroll on a desktop. Strategy: a responsive CSS grid
   of one tiny card per student. Per-card height target ≈ 28px. Cards reflow
   to 4 columns at desktop, 3 on laptop, 2 on tablet, 1 on mobile (the user
   confirmed mobile is fine as a stacked single-column scroll). The four
   status pills (P / A / L / OD) live inline at the right edge of each card.
   Per-student remarks input is intentionally hidden — the Mark page focuses
   on the most common action (one of four statuses). A future enhancement can
   add a per-card remarks popover. */
.att-roster-compact {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 4px;
}
.att-roster-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    padding: 2px 6px;
    /* Theme-aware border + background — hardcoded #fff / rgba(0,0,0,.07)
       used to render the card as a bright slab in dark mode and left
       the student name (previously #212529) invisible on that slab. */
    border: 1px solid var(--erp-border);
    border-radius: 4px;
    min-height: 28px;
    background: var(--erp-surface);
    color: var(--erp-text);
}
.att-roster-card:hover { background: var(--erp-surface-alt); }
.att-roster-id {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
    flex: 1 1 auto;
    font-size: 0.78rem;
    line-height: 1;
}
.att-roster-num { color: var(--erp-text-muted); font-size: 0.7rem; min-width: 22px; }
.att-roster-code {
    font-size: 0.68rem;
    color: var(--erp-text-muted);
    background: transparent;
}
.att-roster-name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
    flex: 1 1 auto;
    color: var(--erp-text);
}
/* Tight status pills — overrides Bootstrap's .btn padding so 4 fit at the
   right edge of even a narrow card. */
.att-roster-pills .btn {
    padding: 1px 6px;
    font-size: 0.65rem;
    font-weight: 600;
    line-height: 1.1;
    min-width: 22px;
}
.att-roster-pills .btn-check:checked + label.btn {
    /* Bootstrap keeps the colour; just bold so the pick reads at a glance. */
    font-weight: 700;
}

/* === Compact select for tight grid cells ===
   Bootstrap's .form-select reserves right-padding for the chevron, which
   crushes the visible value in a tight matrix-style cell (CO-PO mapping,
   correlation-level pickers, attendance status per session, etc.). Tag a
   <select> with .grid-select to strip the chevron and centre the value so
   the selected option stays readable on desktop AND mobile. The dropdown
   still opens normally on click / tap.

   When to use: any <select> embedded inside a narrow <td> in a matrix or
   row-grid. NOT for filter-row selects (those have plenty of width and
   benefit from the standard Bootstrap chevron). */
.grid-select {
    background-image: none !important;
    background-color: #fff;
    padding-right: 0.35rem !important;
    padding-left: 0.35rem !important;
    text-align: center;
    text-align-last: center;          /* Most browsers — centres the value */
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    text-indent: 0;
    font-variant-numeric: tabular-nums;
}
.grid-select:focus {
    box-shadow: 0 0 0 0.15rem rgba(13, 110, 253, .2);
}
.grid-select:disabled {
    background-color: #f3f5f8;
    color: #6c757d;
}
/* Defensive for older Firefox where text-align-last isn't honoured for selects. */
@-moz-document url-prefix() {
    .grid-select { text-indent: 0.01px; text-overflow: ''; }
}

/* ============================================================================
 * Print stylesheet — applies to every page rendered under _Layout (clerk-side)
 * or _StudentLayout (student-side). Authored once, used everywhere.
 *
 * Convention for new printable views:
 *   1. Wrap the printable content in a card or div with a sensible class
 *      (e.g. .receipt-printable, .ms-card). No special class is *required*
 *      for the global rules to work — anything that is NOT explicitly
 *      hidden below will print.
 *   2. Tag any on-screen-only chrome (page heading, action buttons, alerts,
 *      modals, "Print" buttons themselves) with the canonical .no-print
 *      class. Modals and dropdowns are also auto-hidden — you only need
 *      .no-print on per-view chrome (back buttons, tabs, edit handles, etc.).
 *   3. Do NOT inline @media print rules in the view unless they add
 *      something genuinely view-specific (e.g. marksheet table border).
 *   4. To force a page break before a section, add .page-break-before;
 *      to keep something together, .page-break-avoid.
 * ============================================================================ */
@media print {
    /* --- Hide BOTH layouts' chrome (clerk + student). --- */
    .erp-appbar,
    .erp-sidebar,
    .erp-sidebar-backdrop,
    .erp-footer,
    .student-topbar,
    .student-tile-menu,
    .student-tile-strip,
    .student-footer,
    /* Bootstrap modals + their backdrops never print (they are display:none
       when not shown, but if the user prints with one open the modal is
       irrelevant to the printed receipt/marksheet). */
    .modal,
    .modal-backdrop,
    .offcanvas,
    /* Session countdown overlay. */
    #sessionCountdownModal,
    /* Canonical per-view opt-out: tag any element with `no-print` to drop
       it from the printed page (page header, action buttons, alerts, tabs,
       Print/Back buttons, etc.). */
    .no-print {
        display: none !important;
    }

    /* --- Reset the layout wrappers so the printable area uses the full page.
         Both clerk and student layouts have a similar shell -> row -> content
         structure; flatten them all. --- */
    html, body,
    .erp-shell, .erp-shell-row, .erp-content,
    .student-shell, .student-shell-row, .student-content {
        margin: 0 !important;
        padding: 0 !important;
        max-width: none !important;
        width: 100% !important;
        background: #fff !important;
        color: #000 !important;
        box-shadow: none !important;
    }

    /* Container utilities should also not constrain width in print. */
    .container, .container-fluid, .container-sm, .container-md, .container-lg, .container-xl, .container-xxl {
        max-width: none !important;
        width: 100% !important;
        padding-left: 0 !important;
        padding-right: 0 !important;
    }

    /* --- Card flattening: in print, cards should look like plain document
         sections, not raised UI panels. View-specific stylesheets can still
         override this if a strong border helps (e.g. marksheet body). --- */
    .card {
        box-shadow: none !important;
        border: none !important;
        background: #fff !important;
    }
    .card .card-body { padding: 12px !important; }

    /* Badges flatten to outlined-on-white so they remain legible on a B/W
       printer (Bootstrap's `bg-*-subtle` is barely visible when printed). */
    .badge {
        border: 1px solid #444 !important;
        background: #fff !important;
        color: #000 !important;
        font-weight: 600 !important;
    }

    /* Code/monospace inherits text colour instead of Bootstrap's pink. */
    code { color: inherit !important; background: transparent !important; }

    /* Tables: denser cells, smaller font, avoid mid-row page breaks. */
    table { page-break-inside: avoid !important; }
    table th, table td { padding: 4px 6px !important; font-size: 11pt !important; }

    /* Strip the trailing " (http://…)" that browsers add after `<a href>`. */
    a, a:visited { color: #000 !important; text-decoration: none !important; }
    a[href]:after { content: "" !important; }

    /* Page-break helpers a view can tag onto its sections. */
    .page-break-before { page-break-before: always !important; }
    .page-break-avoid  { page-break-inside: avoid  !important; }
}

/* ──────────────────────────────────────────────────────────────────────
   Notification bell — shake animation (Phase 1b, 2026-06-11)
   Triggered by notif-bell.js when the unread count increases.
   ────────────────────────────────────────────────────────────────────── */
@keyframes notif-bell-shake {
    0%, 100% { transform: rotate(0); }
    15%      { transform: rotate(-14deg); }
    30%      { transform: rotate(12deg); }
    45%      { transform: rotate(-10deg); }
    60%      { transform: rotate(8deg); }
    75%      { transform: rotate(-5deg); }
    90%      { transform: rotate(3deg); }
}
.notif-bell-shake {
    animation: notif-bell-shake 1.5s ease-in-out;
    transform-origin: top center;
    display: inline-block;
}

/* ----- Phase 2L — Notice Board card decorations ----- */
.notice-pinned {
    box-shadow: 0 0 0 1px rgba(13, 110, 253, 0.35), 0 2px 8px rgba(0, 0, 0, 0.05) !important;
}
.notice-new-ribbon {
    position: absolute;
    top: 8px;
    right: -22px;
    transform: rotate(35deg);
    background: linear-gradient(90deg, #ffc107 0%, #ff9800 100%);
    color: #fff;
    padding: 2px 30px;
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
    z-index: 2;
    pointer-events: none;
}

/* ============================================================================
   Mobile modal footer safety (2026-09-17)
   ============================================================================
   Bootstrap's modal footer defaults to `flex-wrap: nowrap`; a modal with
   a wide footer (Cancel + a long primary button label like "Add Person"
   or "Save Changes") pushes the button row off the right edge of a
   narrow phone viewport. Combined with a scrollable modal body, the
   Cancel button ends up under the bell/hidden entirely and the user
   thinks the modal is broken. Wrap the footer at phone widths so
   buttons stack instead of clipping.
   ============================================================================ */
@media (max-width: 575.98px) {
    .modal-footer {
        flex-wrap: wrap;
        row-gap: 0.5rem;
        padding: 0.75rem 1rem;
    }
    .modal-footer > .btn { flex: 1 1 auto; }
    /* Modal body edges — reclaim horizontal room so tabs / forms don't
       clip a padding gutter. */
    .modal-body   { padding: 0.75rem 1rem; }
    .modal-header { padding: 0.75rem 1rem; }
    /* On very narrow viewports, .modal-lg / -xl still respect Bootstrap
       max-width; force them to the viewport so the tabbed forms
       (External Person / Committee / Fee Collection modals) get every
       pixel back for their content. */
    .modal-dialog.modal-lg,
    .modal-dialog.modal-xl,
    .modal-dialog.modal-fullscreen-md-down {
        margin: 0.5rem;
        max-width: calc(100vw - 1rem);
    }
}
