/* ==========================================================================
   App brand layer
   --------------------------------------------------------------------------
   Design tokens plus the shared component polish that used to live as inline
   <style> blocks inside master.blade.php and login.blade.php. Loaded after the
   Sneat theme stylesheets so it can override them, and deliberately scoped to
   app-specific class names (.auth-*, .brand-*) so it never fights the theme.
   ========================================================================== */

:root {
    /* Brand ---------------------------------------------------------------
       Blue is taken from the existing sidebar/navbar (#0169b6); green is the
       existing success/accent (#0db305). Everything else is derived from those
       two so tints stay consistent instead of being hand-picked per page. */
    --brand-blue: #0169b6;
    --brand-blue-600: #015da2;
    --brand-blue-700: #014f8a;
    --brand-blue-800: #013f6e;
    --brand-blue-050: #eaf4fc;
    --brand-blue-100: #d0e7f8;

    --brand-green: #0db305;
    --brand-green-700: #0a8c04;
    --brand-green-050: #e8f8e7;

    /* Neutrals */
    --brand-ink: #1b2a3a;
    --brand-ink-soft: #566a7f;
    --brand-ink-faint: #8592a3;
    --brand-line: #e4e8ee;
    --brand-surface: #ffffff;
    --brand-canvas: #f5f7fb;

    /* Elevation + shape */
    --brand-radius: 12px;
    --brand-radius-lg: 18px;
    --brand-shadow-sm: 0 1px 2px rgba(27, 42, 58, .06), 0 1px 3px rgba(27, 42, 58, .08);
    --brand-shadow-md: 0 4px 12px rgba(27, 42, 58, .08), 0 2px 4px rgba(27, 42, 58, .04);
    --brand-shadow-lg: 0 18px 40px rgba(1, 63, 110, .16);

    --brand-focus-ring: 0 0 0 .2rem rgba(1, 105, 182, .25);
}

/* ==========================================================================
   Authentication pages (login / forgot password / reset)
   ========================================================================== */

.auth-page {
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    background: var(--brand-canvas);
    color: var(--brand-ink);
}

/* --- Left: brand panel ---------------------------------------------------- */

.auth-brand {
    position: relative;
    flex: 0 0 46%;
    max-width: 46%;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 3rem 3.5rem;
    overflow: hidden;
    color: #fff;
    background:
        radial-gradient(circle at 18% 12%, rgba(13, 179, 5, .28), transparent 46%),
        linear-gradient(150deg, var(--brand-blue) 0%, var(--brand-blue-700) 58%, var(--brand-blue-800) 100%);
}

/* Subtle geometric wash so the panel is not a flat block of colour. */
.auth-brand::after {
    content: "";
    position: absolute;
    inset: 0;
    background-image:
        radial-gradient(rgba(255, 255, 255, .16) 1px, transparent 1px);
    background-size: 26px 26px;
    opacity: .5;
    pointer-events: none;
}

.auth-brand > * {
    position: relative;
    z-index: 1;
}

.auth-brand__mark {
    display: flex;
    align-items: center;
    gap: .875rem;
}

.auth-brand__logo {
    width: 62px;
    height: 62px;
    object-fit: contain;
    background: #fff;
    border-radius: 14px;
    padding: 7px;
    box-shadow: 0 6px 18px rgba(0, 0, 0, .18);
    flex: none;
}

.auth-brand__wordmark {
    font-size: 1.0625rem;
    font-weight: 600;
    line-height: 1.35;
    letter-spacing: .01em;
    margin: 0;
}

.auth-brand__headline {
    /* Sneat's core.css sets an explicit colour on h1-h6, which beats the
       inherited white from .auth-brand — so state it directly. */
    color: #fff;
    font-size: clamp(1.75rem, 2.4vw, 2.375rem);
    font-weight: 700;
    line-height: 1.22;
    margin: 0 0 .875rem;
    letter-spacing: -.015em;
}

.auth-brand__lede {
    font-size: 1.0625rem;
    line-height: 1.65;
    margin: 0;
    color: rgba(255, 255, 255, .84);
    max-width: 34ch;
}

.auth-brand__stats {
    display: flex;
    gap: 2.5rem;
    margin: 2.25rem 0 0;
    padding: 1.5rem 0 0;
    border-top: 1px solid rgba(255, 255, 255, .18);
    list-style: none;
}

.auth-brand__stat-value {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1.1;
}

.auth-brand__stat-label {
    display: block;
    font-size: .8125rem;
    color: rgba(255, 255, 255, .72);
    margin-top: .1875rem;
}

.auth-brand__foot {
    font-size: .8125rem;
    color: rgba(255, 255, 255, .62);
    margin: 0;
}

/* --- Right: form panel ---------------------------------------------------- */

.auth-form-pane {
    flex: 1 1 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2.5rem 1.5rem;
}

.auth-card {
    width: 100%;
    max-width: 26rem;
}

/* Compact logo shown only when the brand panel is hidden (mobile). */
.auth-card__mobile-mark {
    display: none;
    align-items: center;
    gap: .75rem;
    margin-bottom: 2rem;
}

.auth-card__mobile-logo {
    width: 48px;
    height: 48px;
    object-fit: contain;
    flex: none;
}

.auth-card__mobile-name {
    font-size: .9375rem;
    font-weight: 600;
    color: var(--brand-blue-700);
    line-height: 1.3;
    margin: 0;
}

.auth-card__title {
    font-size: 1.625rem;
    font-weight: 700;
    letter-spacing: -.015em;
    margin: 0 0 .375rem;
    color: var(--brand-ink);
}

.auth-card__subtitle {
    font-size: .9375rem;
    color: var(--brand-ink-soft);
    margin: 0 0 2rem;
}

.auth-field {
    margin-bottom: 1.25rem;
}

.auth-field__label {
    display: block;
    font-size: .8125rem;
    font-weight: 600;
    color: var(--brand-ink);
    margin-bottom: .4375rem;
}

.auth-field__row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: .4375rem;
}

.auth-field__row .auth-field__label {
    margin-bottom: 0;
}

.auth-link {
    font-size: .8125rem;
    font-weight: 500;
    color: var(--brand-blue);
    text-decoration: none;
}

.auth-link:hover,
.auth-link:focus-visible {
    color: var(--brand-blue-700);
    text-decoration: underline;
}

/* Inputs — override Sneat's defaults for a slightly taller, calmer field. */
.auth-page .form-control {
    height: auto;
    padding: .6875rem .875rem;
    font-size: .9375rem;
    border-radius: var(--brand-radius);
    border: 1px solid var(--brand-line);
    background-color: var(--brand-surface);
    color: var(--brand-ink);
    transition: border-color .15s ease, box-shadow .15s ease;
}

.auth-page .form-control::placeholder {
    color: var(--brand-ink-faint);
}

.auth-page .form-control:focus {
    border-color: var(--brand-blue);
    box-shadow: var(--brand-focus-ring);
}

.auth-page .form-control.is-invalid {
    border-color: #e04b4b;
}

.auth-page .form-control.is-invalid:focus {
    box-shadow: 0 0 0 .2rem rgba(224, 75, 75, .2);
}

/* Password field with a reveal toggle. */
.auth-password {
    position: relative;
}

.auth-password .form-control {
    padding-right: 2.875rem;
}

.auth-password__toggle {
    position: absolute;
    top: 0;
    right: 0;
    height: 100%;
    width: 2.875rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: 0;
    padding: 0;
    color: var(--brand-ink-faint);
    cursor: pointer;
    border-radius: 0 var(--brand-radius) var(--brand-radius) 0;
}

.auth-password__toggle:hover {
    color: var(--brand-ink-soft);
}

.auth-password__toggle:focus-visible {
    outline: none;
    box-shadow: var(--brand-focus-ring);
}

/* Validation + status messaging. */
.auth-error {
    display: block;
    font-size: .8125rem;
    color: #d13438;
    margin-top: .375rem;
}

.auth-alert {
    display: flex;
    align-items: flex-start;
    gap: .625rem;
    font-size: .875rem;
    padding: .75rem .875rem;
    border-radius: var(--brand-radius);
    margin-bottom: 1.5rem;
    border: 1px solid transparent;
}

.auth-alert--error {
    background: #fdecec;
    border-color: #f6c9c9;
    color: #a12b2f;
}

.auth-alert--success {
    background: var(--brand-green-050);
    border-color: #b9e7b6;
    color: #14691a;
}

.auth-alert--info {
    background: var(--brand-blue-050);
    border-color: var(--brand-blue-100);
    color: var(--brand-blue-800);
}

.auth-alert ul {
    margin: 0;
    padding-left: 1.1rem;
}

/* Caps-lock warning under the password field. */
.auth-hint {
    display: none;
    align-items: center;
    gap: .375rem;
    font-size: .8125rem;
    color: #9a6700;
    margin-top: .375rem;
}

.auth-hint.is-visible {
    display: flex;
}

.auth-check {
    display: flex;
    align-items: center;
    gap: .5rem;
    margin-bottom: 1.5rem;
}

.auth-page .form-check-input {
    margin: 0;
    width: 1.05rem;
    height: 1.05rem;
    border-color: #c9d1dc;
    cursor: pointer;
}

.auth-page .form-check-input:checked {
    background-color: var(--brand-blue);
    border-color: var(--brand-blue);
}

.auth-page .form-check-input:focus {
    box-shadow: var(--brand-focus-ring);
}

.auth-check label {
    font-size: .875rem;
    color: var(--brand-ink-soft);
    cursor: pointer;
    user-select: none;
    margin: 0;
}

/* Submit button. */
.auth-submit {
    width: 100%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    padding: .75rem 1rem;
    font-size: .9375rem;
    font-weight: 600;
    line-height: 1.4;
    color: #fff;
    background: var(--brand-blue);
    border: 1px solid var(--brand-blue);
    border-radius: var(--brand-radius);
    cursor: pointer;
    transition: background-color .15s ease, border-color .15s ease, box-shadow .15s ease, transform .05s ease;
}

.auth-submit:hover:not(:disabled) {
    background: var(--brand-blue-700);
    border-color: var(--brand-blue-700);
    color: #fff;
}

.auth-submit:focus-visible {
    outline: none;
    box-shadow: var(--brand-focus-ring);
}

.auth-submit:active:not(:disabled) {
    transform: translateY(1px);
}

.auth-submit:disabled {
    opacity: .68;
    cursor: progress;
}

.auth-submit__spinner {
    display: none;
    width: 1rem;
    height: 1rem;
    border: 2px solid rgba(255, 255, 255, .45);
    border-top-color: #fff;
    border-radius: 50%;
    animation: auth-spin .6s linear infinite;
}

.auth-submit.is-busy .auth-submit__spinner {
    display: inline-block;
}

@keyframes auth-spin {
    to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
    .auth-submit__spinner { animation-duration: 2s; }
    .auth-submit:active:not(:disabled) { transform: none; }
}

.auth-foot {
    margin-top: 2rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--brand-line);
    font-size: .8125rem;
    color: var(--brand-ink-faint);
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.auth-foot a {
    color: var(--brand-ink-faint);
    text-decoration: none;
}

.auth-foot a:hover {
    color: var(--brand-blue);
}

/* --- Responsive ----------------------------------------------------------- */

@media (max-width: 991.98px) {
    .auth-brand {
        display: none;
    }

    .auth-card__mobile-mark {
        display: flex;
    }

    .auth-form-pane {
        padding: 2rem 1.25rem;
        align-items: flex-start;
        padding-top: 3rem;
    }
}

@media (max-width: 400px) {
    .auth-card__title {
        font-size: 1.4375rem;
    }
}

/* --- Right-to-left -------------------------------------------------------- */

[dir="rtl"] .auth-password .form-control {
    padding-right: .875rem;
    padding-left: 2.875rem;
}

[dir="rtl"] .auth-password__toggle {
    right: auto;
    left: 0;
    border-radius: var(--brand-radius) 0 0 var(--brand-radius);
}

[dir="rtl"] .auth-alert ul {
    padding-left: 0;
    padding-right: 1.1rem;
}

/* ==========================================================================
   Admin — KPI cards and panels
   --------------------------------------------------------------------------
   Replaces the five saturated gradient "stat-card" blocks on the dashboard.
   A single calm surface with a small coloured icon chip reads as one system and
   keeps the numbers, not the background, as the loudest thing on the page.
   ========================================================================== */

.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.kpi {
    display: flex;
    align-items: flex-start;
    gap: .875rem;
    background: var(--brand-surface);
    border: 1px solid var(--brand-line);
    border-radius: var(--brand-radius);
    padding: 1.125rem 1.25rem;
    text-decoration: none;
    color: inherit;
    transition: border-color .16s ease, box-shadow .16s ease, transform .16s ease;
}

a.kpi:hover {
    border-color: transparent;
    box-shadow: var(--brand-shadow-md);
    transform: translateY(-2px);
    color: inherit;
    text-decoration: none;
}

.kpi__icon {
    flex: none;
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    border-radius: 11px;
    font-size: 1.0625rem;
}

.kpi__body { min-width: 0; }

.kpi__label {
    display: block;
    font-size: .75rem;
    font-weight: 600;
    letter-spacing: .045em;
    text-transform: uppercase;
    color: var(--brand-ink-faint);
    margin-bottom: .25rem;
    /* Wrap rather than truncate — "Inactive Students" clipped to
       "INACTIVE STU..." is worse than a second line. */
    line-height: 1.3;
}

.kpi__value {
    display: block;
    font-size: 1.75rem;
    font-weight: 700;
    line-height: 1.1;
    color: var(--brand-ink);
    font-variant-numeric: tabular-nums;
}

.kpi__meta {
    display: block;
    font-size: .8125rem;
    color: var(--brand-ink-faint);
    margin-top: .1875rem;
}

/* Icon chip tints. Only the 42px chip carries colour, so five metrics side by
   side stay distinguishable without turning the row into a rainbow. */
.kpi__icon--blue   { background: var(--brand-blue-050);        color: var(--brand-blue); }
.kpi__icon--green  { background: var(--brand-green-050);       color: var(--brand-green-700); }
.kpi__icon--amber  { background: #fff4e0;                      color: #b26a00; }
.kpi__icon--rose   { background: #fdecec;                      color: #c0392b; }
.kpi__icon--violet { background: #f0ecfd;                      color: #6544c4; }
.kpi__icon--slate  { background: #eef1f6;                      color: #4a5c73; }

/* --------------------------------------------------------------------------
   Empty states — several dashboard panels render as blank white boxes when a
   query returns nothing, which reads as a broken page rather than "no data".
   -------------------------------------------------------------------------- */

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 2.5rem 1.5rem;
    color: var(--brand-ink-faint);
}

.empty-state__icon {
    width: 48px;
    height: 48px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: var(--brand-canvas);
    color: var(--brand-ink-faint);
    font-size: 1.25rem;
    margin-bottom: .875rem;
}

.empty-state__title {
    font-size: .9375rem;
    font-weight: 600;
    color: var(--brand-ink-soft);
    margin: 0 0 .25rem;
}

.empty-state__text {
    font-size: .8125rem;
    margin: 0;
    max-width: 30ch;
}

.empty-state--sm {
    padding: 1.75rem 1rem;
}

.empty-state--sm .empty-state__icon {
    width: 38px;
    height: 38px;
    font-size: 1rem;
    margin-bottom: .625rem;
}

/* ==========================================================================
   Admin shell — sidebar and navbar
   --------------------------------------------------------------------------
   Replaces the inline <style> block that used to sit in admin/layouts/master.
   That block contained a global `.text-muted { color:#fff !important }`, which
   was meant for the blue sidebar but applied everywhere — the "Super Admin"
   label in the user dropdown was white-on-white, and every muted caption on a
   white card was invisible. All of these rules are now scoped to the shell.
   ========================================================================== */

/* --- Sidebar surface ------------------------------------------------------ */

/* Sidebar colour. --chrome-sidebar is emitted by
   admin/layouts/inc/theme-colors when one is configured in Settings; otherwise
   the sidebar keeps using the brand colour, which is the previous behaviour. */
.bg-menu-theme {
    background-color: var(--chrome-sidebar, var(--brand-blue)) !important;
}

/* Scoped replacement for the old global .text-muted override: only muted text
   sitting on the blue chrome is lightened. */
#layout-menu .text-muted,
#layout-navbar .text-muted {
    color: var(--chrome-sidebar-muted, rgba(255, 255, 255, .72)) !important;
}

/* --- Brand block ---------------------------------------------------------- */

.light-style .menu .app-brand.demo,
#layout-menu .app-brand.demo {
    height: auto;
    min-height: 0;
    padding: 1.125rem 1rem .875rem;
    display: flex;
    align-items: center;
    gap: .75rem;
}

#layout-menu .app-brand-link {
    display: flex;
    align-items: center;
    gap: .75rem;
    min-width: 0;
    flex: 1;
    text-decoration: none;
}

.app-brand__badge {
    flex: none;
    width: 46px;
    height: 46px;
    border-radius: 50%;
    background: #fff;
    display: grid;
    place-items: center;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, .18);
}

.app-brand__badge img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 3px;
}

/* The old rule set font-size:140% and text-align:justify, which stretched the
   school name across four ragged lines. */
#layout-menu .app-brand-text.menu-text {
    color: var(--chrome-sidebar-fg, #fff) !important;
    font-size: .875rem !important;
    font-weight: 600;
    line-height: 1.3;
    text-align: left;
    letter-spacing: .005em;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin: 0;
}

#layout-menu .app-brand .layout-menu-toggle {
    margin-top: 0 !important;
    flex: none;
}

/* Divider under the brand block (was an inline div with a grey border). */
#layout-menu .app-brand.demo + .menu-divider {
    height: 1px;
    background: var(--chrome-sidebar-line, rgba(255, 255, 255, .16));
    margin: 0 1rem .5rem;
}

/* --- Menu items ----------------------------------------------------------- */

.bg-menu-theme .menu-link,
.bg-menu-theme .menu-horizontal-prev,
.bg-menu-theme .menu-horizontal-next {
    color: var(--chrome-sidebar-soft, rgba(255, 255, 255, .86));
}

.bg-menu-theme.menu-vertical .menu-item .menu-link {
    border-radius: 8px;
    margin-inline: .5rem;
    padding-block: .5rem;
    font-size: .875rem;
    font-weight: 500;
    transition: background-color .14s ease, color .14s ease;
}

.bg-menu-theme.menu-vertical .menu-item .menu-link:hover {
    background: transparent !important;
    color: var(--chrome-sidebar-fg, #fff);
}

.bg-menu-theme .menu-icon {
    font-size: 1.075rem;
    opacity: .92;
}

/* Active item: a flat white-on-translucent treatment. The previous rule used a
   green gradient with a leftover purple shadow from the stock template. */
.bg-menu-theme.menu-vertical .menu-item.active > .menu-link:not(.menu-toggle) {
    background: var(--chrome-sidebar-fill-strong, rgba(255, 255, 255, .18)) !important;
    box-shadow: inset 3px 0 0 0 var(--brand-green);
    color: var(--chrome-sidebar-fg, #fff) !important;
    font-weight: 600;
}

.bg-menu-theme.menu-vertical .menu-item.open > .menu-link.menu-toggle {
    background: var(--chrome-sidebar-fill, rgba(255, 255, 255, .09));
    color: var(--chrome-sidebar-fg, #fff);
}

/* Sub-menus sit on a slightly darker inset so nesting is legible. */
.bg-menu-theme .menu-sub {
    background: var(--chrome-sidebar-sub, rgba(0, 0, 0, .12));
    border-radius: 8px;
    margin: .125rem .5rem .375rem;
    padding-block: .25rem;
}

.bg-menu-theme .menu-sub .menu-link {
    font-size: .8125rem;
    font-weight: 400;
    padding-block: .4375rem;
    color: var(--chrome-sidebar-soft, rgba(255, 255, 255, .8));
}

.bg-menu-theme .menu-sub .menu-item.active > .menu-link {
    background: var(--chrome-sidebar-fill-strong, rgba(255, 255, 255, .16)) !important;
    box-shadow: none;
    color: var(--chrome-sidebar-fg, #fff) !important;
    font-weight: 600;
}

/* Thin, unobtrusive scrollbar for a 20-module menu. */
#layout-menu .menu-inner {
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, .3) transparent;
}

#layout-menu .menu-inner::-webkit-scrollbar { width: 6px; }
#layout-menu .menu-inner::-webkit-scrollbar-track { background: transparent; }

#layout-menu .menu-inner::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, .28);
    border-radius: 3px;
}

#layout-menu .menu-inner::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, .45);
}

/* --- Top navbar ----------------------------------------------------------- */

/* Header colour, same fallback rule as the sidebar above. */
.bg-navbar-theme {
    background-color: var(--chrome-header, var(--brand-blue)) !important;
}

.bg-navbar-theme .navbar-nav > .nav-link,
.bg-navbar-theme .navbar-nav > .nav-item > .nav-link,
.bg-navbar-theme .navbar-nav > .nav > .nav-item > .nav-link {
    color: var(--chrome-sidebar-fg, #fff);
}

.bg-navbar-theme .navbar-search-wrapper .search-input,
.bg-navbar-theme .search-input-wrapper .search-input {
    background: transparent;
    color: var(--chrome-sidebar-fg, #fff);
}

.bg-navbar-theme .search-input::placeholder {
    color: rgba(255, 255, 255, .7);
}

/* The old block restyled .btn-info globally to the brand green; keep that
   intent but state it explicitly rather than as a side effect. */
.btn-info {
    color: #fff;
    background-color: var(--brand-green);
    border-color: var(--brand-green);
}

.btn-info:hover,
.btn-info:focus {
    color: #fff;
    background-color: var(--brand-green-700);
    border-color: var(--brand-green-700);
}

/* --- Footer --------------------------------------------------------------- */

/* Only applied when a footer colour is configured in Settings; otherwise the
   theme's default footer styling is left completely alone. */
.bg-footer-theme {
    background-color: var(--chrome-footer, transparent);
    color: var(--chrome-footer-fg, inherit);
}

.bg-footer-theme a,
.bg-footer-theme .fw-semibold {
    color: var(--chrome-footer-fg, inherit);
}

.bg-footer-theme .footer-container > div:last-child {
    color: var(--chrome-footer-muted, inherit);
}
