/*
 * jhanu-theme.css — the Jhanu design system.
 *
 * The single source of truth for the Jhanu look. Every page stylesheet composes
 * the tokens declared here; no page may redeclare a --jhanu-* variable or hardcode
 * a brand colour. Before this file existed, 71 stylesheets each carried their own
 * copy of the palette.
 *
 * Load order on a page:
 *     1. bootstrap-5.0.2/css/bootstrap.min.css
 *     2. vendor CSS (Font Awesome, DataTables, AlertifyJS, ...)
 *     3. css/jhanu-theme.css          <-- this file
 *     4. the page's own stylesheet    <-- composes tokens only
 *
 * From jhanuweb pages:  <link rel="stylesheet" href="css/jhanu-theme.css">
 * From itfadmin pages:  <link rel="stylesheet" href="../css/jhanu-theme.css">
 *
 * See docs/UI_DESIGN_SYSTEM.md for the token table and the component gallery.
 *
 * Note on !important: AdminLTE is gone, and with it the !important on the buttons.
 * What remains is on the table and pagination rules, for a different reason: 67
 * pages load datatables.min.css after this file, so the cascade is against us
 * there until the load order is fixed. Each of those rules says so where it sits.
 */

/* ==========================================================================
   1. Tokens
   ========================================================================== */

:root {
    /* --- Brand palette (docs/color_palette.txt) --- */
    --jhanu-yellow: #F4C542;
    --jhanu-yellow-dark: #d4a835;
    --jhanu-yellow-light: #f9dc8b;
    --jhanu-blue: #3A7CA5;
    --jhanu-blue-dark: #2d6384;
    --jhanu-blue-light: #6ba3c7;
    --jhanu-black: #000000;
    --jhanu-white: #FFFFFF;

    /* Brand colours as RGB triplets, for rgba() composition without hardcoding. */
    --jhanu-yellow-rgb: 244, 197, 66;
    --jhanu-blue-rgb: 58, 124, 165;

    /* --- Semantic colours --- */
    --jhanu-success: #2f8f4e;
    --jhanu-success-dark: #256f3d;
    --jhanu-warning: var(--jhanu-yellow);
    --jhanu-warning-dark: var(--jhanu-yellow-dark);
    --jhanu-danger: #dc3545;
    --jhanu-danger-dark: #a71d2a;
    --jhanu-info: var(--jhanu-blue);
    --jhanu-info-dark: var(--jhanu-blue-dark);
    --jhanu-neutral: #6c757d;
    --jhanu-neutral-dark: #545b62;

    /* --- Surfaces --- */
    --jhanu-bg: #f4f6f9;
    --jhanu-surface: var(--jhanu-white);
    --jhanu-surface-alt: #f8f9fa;
    --jhanu-surface-hover: rgba(var(--jhanu-yellow-rgb), 0.15);
    --jhanu-surface-stripe: rgba(var(--jhanu-yellow-rgb), 0.05);
    --jhanu-border: #dee2e6;
    --jhanu-border-strong: #ced4da;

    /* --- Text --- */
    --jhanu-text: #333333;
    --jhanu-text-muted: #6c757d;
    --jhanu-text-subtle: #767676;
    --jhanu-text-on-brand: var(--jhanu-white);
    --jhanu-text-on-yellow: var(--jhanu-black);

    /*
     * Brand blue for small text. --jhanu-blue scores 4.21:1 against --jhanu-bg,
     * which fails WCAG AA for normal text (4.5:1 required); --jhanu-blue-dark
     * scores 6.01:1. Use --jhanu-blue for fills and for headings 24px or larger,
     * and --jhanu-blue-text for anything read at body size.
     */
    --jhanu-blue-text: var(--jhanu-blue-dark);

    /*
     * The same problem, worse, for the yellow. --jhanu-yellow-dark scores
     * 2.22:1 against --jhanu-bg: it works as a fill behind black text and fails
     * badly as text or as an icon on a light ground, which is where it had
     * spread to. #8a6810 scores 5.16:1 on a card and 4.77:1 on the page ground,
     * and still reads as the brand amber. Use --jhanu-yellow and
     * --jhanu-yellow-dark for fills, and this for anything drawn in the colour
     * itself: text, links, icons.
     */
    --jhanu-yellow-text: #8a6810;

    /*
     * --jhanu-success scores 4.07:1 on --jhanu-bg, just under AA. It is fine as
     * a fill; --jhanu-success-dark (6.14:1) is what green text should use.
     */
    --jhanu-success-text: var(--jhanu-success-dark);

    /* --- Typography --- */
    --jhanu-font-family: 'Source Sans Pro', -apple-system, BlinkMacSystemFont,
        'Segoe UI', Roboto, 'Helvetica Neue', Helvetica, Arial, sans-serif;
    --jhanu-font-family-mono: ui-monospace, SFMono-Regular, 'SF Mono', Menlo,
        Consolas, 'Liberation Mono', monospace;

    --jhanu-font-size-xs: 0.75rem;
    --jhanu-font-size-sm: 0.85rem;
    --jhanu-font-size-base: 1rem;
    --jhanu-font-size-lg: 1.1rem;
    --jhanu-font-size-xl: 1.5rem;
    --jhanu-font-size-2xl: 2rem;

    --jhanu-font-weight-normal: 400;
    --jhanu-font-weight-medium: 500;
    --jhanu-font-weight-semibold: 600;
    --jhanu-font-weight-bold: 700;

    --jhanu-line-height-tight: 1.25;
    --jhanu-line-height-base: 1.5;

    /* --- Spacing scale (4px base) --- */
    --jhanu-space-1: 0.25rem;   /*  4px */
    --jhanu-space-2: 0.5rem;    /*  8px */
    --jhanu-space-3: 0.75rem;   /* 12px */
    --jhanu-space-4: 1rem;      /* 16px */
    --jhanu-space-5: 1.25rem;   /* 20px */
    --jhanu-space-6: 1.5rem;    /* 24px */
    --jhanu-space-8: 2rem;      /* 32px */
    --jhanu-space-10: 2.5rem;   /* 40px */
    --jhanu-space-12: 3rem;     /* 48px */

    /* --- Radii --- */
    --jhanu-radius-sm: 4px;
    --jhanu-radius: 6px;
    --jhanu-radius-lg: 10px;
    --jhanu-radius-xl: 12px;
    --jhanu-radius-pill: 999px;

    /* --- Elevation --- */
    --jhanu-shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.1);
    --jhanu-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    --jhanu-shadow-lg: 0 4px 12px rgba(0, 0, 0, 0.1);
    --jhanu-shadow-xl: 0 8px 20px rgba(0, 0, 0, 0.15);
    --jhanu-shadow-modal: 0 10px 40px rgba(0, 0, 0, 0.25);

    /* --- Focus ring --- */
    --jhanu-focus-ring: 0 0 0 0.2rem rgba(var(--jhanu-blue-rgb), 0.25);
    --jhanu-focus-ring-yellow: 0 0 0 0.2rem rgba(var(--jhanu-yellow-rgb), 0.25);

    /* --- Motion --- */
    --jhanu-transition-fast: 0.15s ease;
    --jhanu-transition: 0.3s ease;

    /* --- Z-index scale --- */
    --jhanu-z-sticky: 1020;
    --jhanu-z-sidebar: 1030;
    --jhanu-z-backdrop: 1040;
    --jhanu-z-modal: 1050;
    --jhanu-z-palette: 1060;
    --jhanu-z-toast: 1070;

    /* --- Layout --- */
    --jhanu-sidebar-width: 240px;
    --jhanu-sidebar-width-collapsed: 60px;
    --jhanu-topbar-height: 56px;
}

/*
 * Breakpoints, for reference — CSS custom properties cannot be used in media
 * queries, so these values are written literally in @media rules below and must
 * be kept in sync with Bootstrap 5:
 *     sm 576px | md 768px | lg 992px | xl 1200px | xxl 1400px
 *
 * Dark mode is out of scope for PR-01. The token set above is deliberately split
 * into brand / semantic / surface / text groups so a future dark theme only has to
 * redeclare the surface and text groups inside a [data-bs-theme="dark"] block.
 */

/* ==========================================================================
   2. Base
   ========================================================================== */

body {
    font-family: var(--jhanu-font-family);
    font-size: var(--jhanu-font-size-base);
    line-height: var(--jhanu-line-height-base);
    color: var(--jhanu-text);
    background-color: var(--jhanu-bg);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a {
    color: var(--jhanu-blue-text);
    text-decoration: none;
}

a:hover,
a:focus {
    color: var(--jhanu-blue-dark);
    text-decoration: underline;
}

/* A visible, consistent focus ring for keyboard users on every interactive element. */
:focus-visible {
    outline: 2px solid var(--jhanu-blue);
    outline-offset: 2px;
}

/* Skip link for the application shell (PR-02 renders the target). */
.jhanu-skip-link {
    position: absolute;
    left: -9999px;
    top: 0;
    z-index: var(--jhanu-z-toast);
    padding: var(--jhanu-space-3) var(--jhanu-space-4);
    background: var(--jhanu-blue);
    color: var(--jhanu-white);
    border-radius: 0 0 var(--jhanu-radius) 0;
}

/*
 * On focus it lands over the top bar, which is already brand blue - so it takes
 * the yellow, with its own ring. A skip link the same colour as what it covers
 * is not visibly there at all.
 */
.jhanu-skip-link:focus {
    left: 0;
    background: var(--jhanu-yellow);
    color: var(--jhanu-text-on-yellow);
    text-decoration: none;
    outline: 2px solid var(--jhanu-black);
    outline-offset: -2px;
}

/* ==========================================================================
   3. Buttons
   ========================================================================== */

.btn {
    font-weight: var(--jhanu-font-weight-medium);
    transition: background-color var(--jhanu-transition-fast),
                border-color var(--jhanu-transition-fast),
                color var(--jhanu-transition-fast);
}

.btn:focus-visible {
    box-shadow: var(--jhanu-focus-ring);
}

/*
 * A button paints its own contents. Page stylesheets colour their icons for the
 * white card they sit on - ".bi-send-fill { color: var(--jhanu-blue) }" and the
 * like - and those selectors also match the icon inside a button, where brand
 * blue on a brand blue button is invisible. This is more specific than a bare
 * icon class, so the icon follows the button unless the button says otherwise.
 */
.btn i,
.btn .bi,
.btn svg {
    color: inherit;
}

/*
 * Primary — Jhanu blue. The !important is gone with AdminLTE: Bootstrap loads
 * before this file on every page, so equal specificity and later position are
 * enough. A page stylesheet that deliberately restyles its own primary button
 * now wins, which is the way round it should always have been.
 */
.btn-primary {
    background-color: var(--jhanu-blue);
    border-color: var(--jhanu-blue);
    color: var(--jhanu-text-on-brand);
}

.btn-primary:hover,
.btn-primary:focus,
.btn-primary:active,
.btn-primary.active {
    background-color: var(--jhanu-blue-dark);
    border-color: var(--jhanu-blue-dark);
    color: var(--jhanu-text-on-brand);
}

/*
 * Success — Jhanu yellow with black text. This is the established convention:
 * the yellow "call to action" button, used today for Excel export and primary
 * confirmations. Black on #F4C542 gives a 10.4:1 contrast ratio (WCAG AAA).
 */
.btn-success,
.btn-jhanu-yellow {
    background-color: var(--jhanu-yellow);
    border-color: var(--jhanu-yellow);
    color: var(--jhanu-text-on-yellow);
    font-weight: var(--jhanu-font-weight-semibold);
}

.btn-success:hover,
.btn-success:focus,
.btn-success:active,
.btn-jhanu-yellow:hover,
.btn-jhanu-yellow:focus,
.btn-jhanu-yellow:active {
    background-color: var(--jhanu-yellow-dark);
    border-color: var(--jhanu-yellow-dark);
    color: var(--jhanu-text-on-yellow);
}

.btn-secondary {
    background-color: var(--jhanu-neutral);
    border-color: var(--jhanu-neutral);
    color: var(--jhanu-white);
}

.btn-secondary:hover,
.btn-secondary:focus,
.btn-secondary:active {
    background-color: var(--jhanu-neutral-dark);
    border-color: var(--jhanu-neutral-dark);
}

.btn-danger {
    background-color: var(--jhanu-danger);
    border-color: var(--jhanu-danger);
    color: var(--jhanu-white);
}

.btn-danger:hover,
.btn-danger:focus,
.btn-danger:active {
    background-color: var(--jhanu-danger-dark);
    border-color: var(--jhanu-danger-dark);
}

.btn-outline-primary {
    color: var(--jhanu-blue);
    border-color: var(--jhanu-blue);
}

.btn-outline-primary:hover,
.btn-outline-primary:focus,
.btn-outline-primary:active {
    background-color: var(--jhanu-blue);
    border-color: var(--jhanu-blue);
    color: var(--jhanu-text-on-brand);
}

/*
 * Excel export button. Replaces the per-page "#buttonexcel .fa-file-excel" rules.
 * Markup: <a class="btn jhanu-btn-excel"><i class="fas fa-file-excel"></i> Export</a>
 */
.jhanu-btn-excel {
    background-color: var(--jhanu-yellow);
    border-color: var(--jhanu-yellow);
    color: var(--jhanu-text-on-yellow);
    font-weight: var(--jhanu-font-weight-semibold);
}

.jhanu-btn-excel:hover,
.jhanu-btn-excel:focus {
    background-color: var(--jhanu-yellow-dark);
    border-color: var(--jhanu-yellow-dark);
    color: var(--jhanu-text-on-yellow);
}

.jhanu-btn-excel i {
    color: var(--jhanu-text-on-yellow);
    font-size: var(--jhanu-font-size-lg);
}

/*
 * Clickable text/icon affordance used across the app (back arrows, inline actions).
 *
 * Deliberately sets no font-weight. The class is applied to Font Awesome icons as
 * often as to text - "spanOption fas fa-arrow-left" appears 76 times across 71
 * files - and FA 5 selects its solid face by weight 900. Setting any weight here
 * wins over .fas by load order and silently renders those icons blank.
 */
.spanOption {
    cursor: pointer;
    color: var(--jhanu-blue-text);
    text-decoration: none;
    transition: color var(--jhanu-transition-fast);
}

.spanOption:hover,
.spanOption:focus {
    color: var(--jhanu-yellow-text);
}

/* Row action icons in tables. */
.action-icon {
    cursor: pointer;
    margin: 0 var(--jhanu-space-1);
    font-size: var(--jhanu-font-size-lg);
    background: none;
    border: none;
    padding: var(--jhanu-space-1);
    transition: color var(--jhanu-transition-fast);
}

.action-icon.edit-icon {
    color: var(--jhanu-blue);
}

.action-icon.edit-icon:hover {
    color: var(--jhanu-blue-dark);
}

.action-icon.delete-icon {
    color: var(--jhanu-danger);
}

.action-icon.delete-icon:hover {
    color: var(--jhanu-danger-dark);
}

/* ==========================================================================
   4. Forms
   ========================================================================== */

.form-label,
.modal-body .form-label {
    color: var(--jhanu-blue);
    font-weight: var(--jhanu-font-weight-medium);
    margin-bottom: var(--jhanu-space-2);
}

.form-control:focus,
.form-select:focus {
    border-color: var(--jhanu-blue);
    box-shadow: var(--jhanu-focus-ring);
}

.input-group-text {
    background-color: var(--jhanu-blue);
    border-color: var(--jhanu-blue);
    color: var(--jhanu-text-on-brand);
}

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

.form-check-input:focus {
    border-color: var(--jhanu-blue);
    box-shadow: var(--jhanu-focus-ring);
}

/*
 * jquery-validation injects its message inside the .input-group, which is a flex
 * container: without a full-width basis the message lands beside the field and
 * squeezes it. Forcing 100% wraps it onto its own line below the input.
 */
label.error {
    flex-basis: 100%;
    width: 100%;
    color: var(--jhanu-danger);
    font-size: var(--jhanu-font-size-sm);
    font-weight: var(--jhanu-font-weight-normal);
    margin-top: var(--jhanu-space-1);
    margin-bottom: 0;
}

/* Numeric inputs tagged with .jnu_number_input keep their JS behaviour; this only
   aligns them the way accounting figures are read. */
.jnu_number_input {
    text-align: right;
}

/* ==========================================================================
   5. Layout: page header, toolbar, card
   ========================================================================== */

/*
 * Page header. Replaces the per-page ".page-header h2" rule duplicated across
 * ~50 stylesheets, and the AdminLTE ".content-header" block.
 */
.jhanu-page-header {
    padding: var(--jhanu-space-3) 0;
    margin-bottom: var(--jhanu-space-5);
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: var(--jhanu-space-3);
}

.jhanu-page-header__title {
    color: var(--jhanu-blue);
    font-size: var(--jhanu-font-size-xl);
    font-weight: var(--jhanu-font-weight-semibold);
    border-bottom: 3px solid var(--jhanu-yellow);
    padding-bottom: var(--jhanu-space-2);
    margin: 0;
    display: inline-block;
}

.jhanu-page-header__title i {
    margin-right: var(--jhanu-space-2);
}

.jhanu-page-header__subtitle {
    color: var(--jhanu-text-muted);
    font-size: var(--jhanu-font-size-sm);
    margin: var(--jhanu-space-2) 0 0;
    flex-basis: 100%;
}

.jhanu-page-header__actions {
    display: flex;
    flex-wrap: wrap;
    gap: var(--jhanu-space-2);
}

/* Toolbar above a list: create/configure/export actions and filters. */
.jhanu-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--jhanu-space-2);
    margin-bottom: var(--jhanu-space-4);
}

.jhanu-toolbar__spacer {
    margin-left: auto;
}

/*
 * Surface card. Replaces both the AdminLTE ".box" / ".box-body" and the ad-hoc
 * ".jhanu-card" defined separately in login.css, register.css and mysites.css.
 */
.jhanu-card,
.card.jhanu-card {
    background-color: var(--jhanu-surface);
    border: none;
    border-radius: var(--jhanu-radius-lg);
    box-shadow: var(--jhanu-shadow-sm);
    overflow: hidden;
}

/* The yellow top rule that identifies a Jhanu card on the sign-in screens. */
.jhanu-card--accent {
    border-top: 3px solid var(--jhanu-yellow);
}

/* A blue left rule, used for filter panels and highlighted sections. */
.jhanu-card--filter {
    border-left: 4px solid var(--jhanu-blue);
    border-radius: var(--jhanu-radius);
    padding: var(--jhanu-space-5);
    box-shadow: var(--jhanu-shadow);
}

.jhanu-card__body {
    padding: var(--jhanu-space-5);
}

.jhanu-card__header {
    padding: var(--jhanu-space-4) var(--jhanu-space-5);
    border-bottom: 1px solid var(--jhanu-border);
    font-weight: var(--jhanu-font-weight-semibold);
    color: var(--jhanu-blue);
}

/* ==========================================================================
   6. KPI card
   ========================================================================== */

.jhanu-kpi-card {
    background-color: var(--jhanu-surface);
    border-radius: var(--jhanu-radius-lg);
    padding: var(--jhanu-space-5);
    box-shadow: var(--jhanu-shadow-lg);
    display: flex;
    align-items: center;
    gap: var(--jhanu-space-4);
    height: 100%;
    border-left: 5px solid var(--jhanu-blue);
    transition: transform var(--jhanu-transition), box-shadow var(--jhanu-transition);
}

.jhanu-kpi-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--jhanu-shadow-xl);
}

.jhanu-kpi-card__icon {
    font-size: var(--jhanu-font-size-2xl);
    width: 60px;
    height: 60px;
    flex-shrink: 0;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: rgba(var(--jhanu-blue-rgb), 0.12);
    color: var(--jhanu-blue);
}

.jhanu-kpi-card__label {
    font-size: var(--jhanu-font-size-sm);
    color: var(--jhanu-text-muted);
    margin-bottom: var(--jhanu-space-1);
    font-weight: var(--jhanu-font-weight-medium);
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.jhanu-kpi-card__value {
    font-size: var(--jhanu-font-size-xl);
    font-weight: var(--jhanu-font-weight-bold);
    color: var(--jhanu-text);
    line-height: var(--jhanu-line-height-tight);
}

/* Semantic variants. */
.jhanu-kpi-card--positive { border-left-color: var(--jhanu-success); }
.jhanu-kpi-card--positive .jhanu-kpi-card__icon {
    background-color: rgba(47, 143, 78, 0.12);
    color: var(--jhanu-success-text);
}

.jhanu-kpi-card--negative { border-left-color: var(--jhanu-danger); }
.jhanu-kpi-card--negative .jhanu-kpi-card__icon {
    background-color: rgba(220, 53, 69, 0.12);
    color: var(--jhanu-danger);
}

.jhanu-kpi-card--warning { border-left-color: var(--jhanu-yellow); }
.jhanu-kpi-card--warning .jhanu-kpi-card__icon {
    background-color: rgba(var(--jhanu-yellow-rgb), 0.2);
    color: var(--jhanu-yellow-text);
}

/* ==========================================================================
   7. Empty state
   ========================================================================== */

/*
 * Every list and every dashboard card needs one of these. A brand new academy
 * must see guidance and a next action, never a blank table.
 */
.jhanu-empty-state {
    background: var(--jhanu-surface);
    border: 2px dashed var(--jhanu-border-strong);
    border-radius: var(--jhanu-radius);
    padding: var(--jhanu-space-12) var(--jhanu-space-6);
    text-align: center;
    color: var(--jhanu-text-muted);
}

.jhanu-empty-state__icon {
    font-size: 48px;
    margin-bottom: var(--jhanu-space-3);
    color: var(--jhanu-border-strong);
}

.jhanu-empty-state__title {
    color: var(--jhanu-blue);
    font-size: var(--jhanu-font-size-lg);
    font-weight: var(--jhanu-font-weight-semibold);
    margin-bottom: var(--jhanu-space-2);
}

.jhanu-empty-state__text {
    max-width: 480px;
    margin: 0 auto var(--jhanu-space-4);
}

/* A compact variant for empty dashboard cards. */
.jhanu-empty-state--compact {
    padding: var(--jhanu-space-6) var(--jhanu-space-4);
    border: none;
}

.jhanu-empty-state--compact .jhanu-empty-state__icon {
    font-size: 32px;
}

/*
 * Full-page error (403, 404, 500). Distinct from the empty state above, which
 * is a placeholder inside a card; this one is the whole page. The markup it
 * replaces used AdminLTE class names that had nothing left to style them, so
 * these pages were rendering as black serif text against the top-left corner.
 */
.jhanu-error-page {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: var(--jhanu-space-6);
    text-align: center;
    background: var(--jhanu-bg);
}

.jhanu-error-page__code {
    font-size: 72px;
    line-height: 1;
    font-weight: var(--jhanu-font-weight-bold);
    color: var(--jhanu-blue);
    margin: 0;
}

.jhanu-error-page__icon {
    font-size: 32px;
    color: var(--jhanu-yellow-text);
    margin-bottom: var(--jhanu-space-3);
}

.jhanu-error-page--critical .jhanu-error-page__icon {
    color: var(--jhanu-danger);
}

.jhanu-error-page__title {
    font-size: var(--jhanu-font-size-xl);
    font-weight: var(--jhanu-font-weight-semibold);
    color: var(--jhanu-text);
    margin: var(--jhanu-space-4) 0 var(--jhanu-space-2);
}

.jhanu-error-page__text {
    max-width: 420px;
    color: var(--jhanu-text-muted);
    margin: 0;
}

/*
 * Photo widget: a round portrait whose actions appear on hover. Shared by the
 * student record and the user profile - it started life in students.css, and a
 * second page needing it is the moment to stop copying it.
 *
 * The actions sit over the image rather than beside it because the picture is
 * the control: there is nothing else on that card to click.
 */
.jhanu-photo {
    position: relative;
    width: 200px;
    height: 200px;
    margin: 0 auto;
    border-radius: 50%;
    overflow: hidden;
    border: 3px solid var(--jhanu-blue);
    box-shadow: var(--jhanu-shadow);
    cursor: pointer;
    transition: transform .2s ease, box-shadow .2s ease;
}

.jhanu-photo:hover {
    transform: scale(1.02);
    box-shadow: var(--jhanu-shadow-lg);
}

.jhanu-photo__img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center center;
    display: block;
}

.jhanu-photo__actions {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: var(--jhanu-space-4);
    display: flex;
    justify-content: center;
    gap: var(--jhanu-space-2);
    background: linear-gradient(to top, rgba(0, 0, 0, .7) 0%, rgba(0, 0, 0, 0) 100%);
    opacity: 0;
    transition: opacity .3s ease;
}

/* Hover reveals them for a mouse; focus does the same for a keyboard, or the
   actions would be unreachable without one. */
.jhanu-photo:hover .jhanu-photo__actions,
.jhanu-photo:focus-within .jhanu-photo__actions {
    opacity: 1;
}

.jhanu-photo__action {
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: rgba(255, 255, 255, .9);
    color: var(--jhanu-text);
    cursor: pointer;
    transition: background-color .2s ease, transform .2s ease;
}

.jhanu-photo__action:hover {
    background-color: var(--jhanu-white);
    transform: scale(1.1);
}

.jhanu-photo__action--danger:hover {
    background-color: var(--jhanu-danger);
    color: var(--jhanu-white);
}

.jhanu-photo__action i {
    font-size: 14px;
}

/*
 * A phone has no hover, so the actions are always on and the portrait is a
 * little smaller to leave room for them.
 */
@media (max-width: 768px) {
    .jhanu-photo {
        width: 160px;
        height: 160px;
    }

    .jhanu-photo__actions {
        opacity: 1;
    }
}

/* While the portrait is being repositioned by dragging. */
.jhanu-photo--adjusting {
    cursor: move;
    border-color: var(--jhanu-yellow);
    box-shadow: 0 0 0 3px rgba(var(--jhanu-yellow-rgb), .4);
}

/* The actions would sit under the cursor while the portrait is being dragged. */
.jhanu-photo--adjusting .jhanu-photo__actions,
.jhanu-photo--adjusting:hover .jhanu-photo__actions {
    opacity: 0;
}

/* ==========================================================================
   8. Loading skeleton
   ========================================================================== */

.jhanu-skeleton {
    background: linear-gradient(90deg,
        var(--jhanu-surface-alt) 25%,
        #eef1f4 37%,
        var(--jhanu-surface-alt) 63%);
    background-size: 400% 100%;
    animation: jhanu-skeleton-shimmer 1.4s ease infinite;
    border-radius: var(--jhanu-radius-sm);
}

.jhanu-skeleton--text {
    height: 1em;
    margin-bottom: var(--jhanu-space-2);
}

.jhanu-skeleton--title {
    height: 1.75em;
    width: 40%;
    margin-bottom: var(--jhanu-space-4);
}

.jhanu-skeleton--card {
    height: 96px;
    margin-bottom: var(--jhanu-space-4);
}

@keyframes jhanu-skeleton-shimmer {
    0% { background-position: 100% 50%; }
    100% { background-position: 0 50%; }
}

/* ==========================================================================
   9. Badges
   ========================================================================== */

.jhanu-badge {
    display: inline-block;
    padding: var(--jhanu-space-1) var(--jhanu-space-3);
    border-radius: var(--jhanu-radius-pill);
    font-size: var(--jhanu-font-size-sm);
    font-weight: var(--jhanu-font-weight-semibold);
    line-height: var(--jhanu-line-height-tight);
}

.jhanu-badge--info    { background: rgba(var(--jhanu-blue-rgb), 0.15); color: var(--jhanu-blue-dark); }
.jhanu-badge--success { background: rgba(47, 143, 78, 0.15); color: var(--jhanu-success-dark); }
.jhanu-badge--warning { background: rgba(var(--jhanu-yellow-rgb), 0.25); color: #7a5c00; }
.jhanu-badge--danger  { background: rgba(220, 53, 69, 0.15); color: var(--jhanu-danger-dark); }
.jhanu-badge--neutral { background: var(--jhanu-surface-alt); color: var(--jhanu-text-muted); }

/*
 * Belt badge. Colour alone must never carry the meaning — the belt name is always
 * rendered as text inside the badge, so the information survives for colour-blind
 * users and in monochrome print.
 */
.jhanu-belt-badge {
    display: inline-flex;
    align-items: center;
    gap: var(--jhanu-space-2);
    padding: var(--jhanu-space-1) var(--jhanu-space-3);
    border-radius: var(--jhanu-radius-pill);
    border: 1px solid var(--jhanu-border);
    background: var(--jhanu-surface);
    color: var(--jhanu-text);
    font-size: var(--jhanu-font-size-sm);
    font-weight: var(--jhanu-font-weight-medium);
    white-space: nowrap;
}

/* The colour swatch. Set --jhanu-belt-color inline from the belt data. */
.jhanu-belt-badge::before {
    content: "";
    width: 12px;
    height: 12px;
    border-radius: 3px;
    flex-shrink: 0;
    background: var(--jhanu-belt-color, var(--jhanu-border-strong));
    border: 1px solid rgba(0, 0, 0, 0.25);
}

/* ==========================================================================
   10. Tables and DataTables 2.2.2
   ========================================================================== */

.table {
    background-color: var(--jhanu-surface);
    box-shadow: var(--jhanu-shadow-sm);
    margin-bottom: 0;
}

/*
 * The !important stays, and no longer because of AdminLTE: 67 pages load
 * datatables.min.css *after* this file, so without it DataTables' own header
 * styling wins. The real fix is the load order — vendor CSS, then the theme,
 * then the page stylesheet — which is a change to every page head and belongs
 * in its own PR.
 */
table.dataTable thead th,
table.dataTable thead td,
.table thead th,
table.dataTable tfoot th,
table.dataTable tfoot td,
.table tfoot th {
    background-color: var(--jhanu-blue) !important;
    color: var(--jhanu-text-on-brand) !important;
    font-weight: var(--jhanu-font-weight-semibold) !important;
    border-color: var(--jhanu-blue-dark) !important;
    padding: var(--jhanu-space-3) !important;
}

.table-striped tbody tr:nth-of-type(odd) {
    background-color: var(--jhanu-surface-stripe);
}

.table-hover tbody tr:hover {
    background-color: var(--jhanu-surface-hover);
}

/* Only tables whose rows actually navigate somewhere get the pointer. */
.table-hover.jhanu-table--clickable tbody tr:hover {
    cursor: pointer;
}

/* Wide tables scroll inside their own container instead of the page. */
.jhanu-table-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* --- DataTables container --- */

div.dt-container {
    margin-top: var(--jhanu-space-5);
}

div.dt-container .dt-length,
div.dt-container .dt-search {
    margin-bottom: var(--jhanu-space-4);
}

div.dt-container .dt-search input {
    border-color: var(--jhanu-blue);
}

div.dt-container .dt-search input:focus {
    border-color: var(--jhanu-yellow);
    box-shadow: var(--jhanu-focus-ring-yellow);
}

div.dt-container .dt-info {
    color: var(--jhanu-blue-text);
    font-weight: var(--jhanu-font-weight-medium);
}

div.dt-container .dt-processing {
    background-color: var(--jhanu-blue);
    color: var(--jhanu-text-on-brand);
    border-radius: var(--jhanu-radius-sm);
}

/* --- DataTables pagination. !important for the load-order reason above. --- */

div.dt-container div.dt-paging ul.pagination .page-item .page-link {
    color: var(--jhanu-blue) !important;
    border-color: var(--jhanu-border);
}

div.dt-container div.dt-paging ul.pagination .page-item.active .page-link {
    background-color: var(--jhanu-blue) !important;
    border-color: var(--jhanu-blue) !important;
    color: var(--jhanu-text-on-brand) !important;
}

div.dt-container div.dt-paging ul.pagination .page-item .page-link:hover {
    background-color: var(--jhanu-yellow) !important;
    border-color: var(--jhanu-yellow) !important;
    color: var(--jhanu-text-on-yellow) !important;
}

div.dt-container div.dt-paging ul.pagination .page-item.disabled .page-link {
    color: rgba(var(--jhanu-blue-rgb), 0.4) !important;
}

/* --- DataTables sorting indicators --- */

table.dataTable thead th.sorting,
table.dataTable thead th.sorting_asc,
table.dataTable thead th.sorting_desc {
    color: var(--jhanu-text-on-brand);
}

table.dataTable thead th.sorting:before,
table.dataTable thead th.sorting:after,
table.dataTable thead th.sorting_asc:before,
table.dataTable thead th.sorting_asc:after,
table.dataTable thead th.sorting_desc:before,
table.dataTable thead th.sorting_desc:after {
    color: rgba(255, 255, 255, 0.5);
}

table.dataTable thead th.sorting_asc:after,
table.dataTable thead th.sorting_desc:after {
    color: var(--jhanu-yellow) !important;
    opacity: 1 !important;
}

/* --- DataTables Responsive expand/collapse control --- */

table.dataTable.dtr-inline.collapsed > tbody > tr > td.dtr-control:before,
table.dataTable.dtr-inline.collapsed > tbody > tr > th.dtr-control:before {
    content: '+';
    background-color: var(--jhanu-blue);
    color: var(--jhanu-white);
    border: none;
    box-shadow: var(--jhanu-shadow-sm);
    font-family: var(--jhanu-font-family);
    font-size: 16px;
    font-weight: var(--jhanu-font-weight-bold);
    line-height: 16px;
    text-align: center;
}

table.dataTable.dtr-inline.collapsed > tbody > tr.parent > td.dtr-control:before,
table.dataTable.dtr-inline.collapsed > tbody > tr.parent > th.dtr-control:before {
    content: '\2212'; /* minus sign */
    background-color: var(--jhanu-yellow);
    color: var(--jhanu-text-on-yellow);
}

table.dataTable.dtr-inline.collapsed > tbody > tr > td.dtr-control:hover:before,
table.dataTable.dtr-inline.collapsed > tbody > tr > th.dtr-control:hover:before {
    background-color: var(--jhanu-yellow);
    color: var(--jhanu-text-on-yellow);
}

table.dataTable.dtr-inline.collapsed > tbody > tr.parent > td.dtr-control:hover:before,
table.dataTable.dtr-inline.collapsed > tbody > tr.parent > th.dtr-control:hover:before {
    background-color: var(--jhanu-blue);
    color: var(--jhanu-white);
}

/* ==========================================================================
   11. Modals
   ========================================================================== */

.modal-content {
    border: none;
    border-radius: var(--jhanu-radius-lg);
    box-shadow: var(--jhanu-shadow-modal);
    overflow: hidden;
}

.modal-header {
    background-color: var(--jhanu-blue);
    color: var(--jhanu-text-on-brand);
    border-bottom: 2px solid var(--jhanu-blue-dark);
}

.modal-title {
    color: var(--jhanu-text-on-brand);
    font-weight: var(--jhanu-font-weight-semibold);
}

.modal-header .btn-close {
    filter: brightness(0) invert(1);
    opacity: 0.85;
}

.modal-header .btn-close:hover {
    opacity: 1;
}

.modal-body {
    padding: var(--jhanu-space-5);
}

.modal-footer {
    border-top: 1px solid var(--jhanu-border);
    background-color: var(--jhanu-surface-alt);
}

/* ==========================================================================
   12. Tabs
   ========================================================================== */

.jhanu-tabs.nav-tabs {
    border-bottom: 2px solid var(--jhanu-border);
    gap: var(--jhanu-space-1);
}

.jhanu-tabs.nav-tabs .nav-link {
    color: var(--jhanu-text-muted);
    border: none;
    border-bottom: 3px solid transparent;
    border-radius: 0;
    font-weight: var(--jhanu-font-weight-medium);
    padding: var(--jhanu-space-3) var(--jhanu-space-4);
    transition: color var(--jhanu-transition-fast),
                border-color var(--jhanu-transition-fast);
}

.jhanu-tabs.nav-tabs .nav-link:hover {
    color: var(--jhanu-blue);
    border-bottom-color: var(--jhanu-border-strong);
}

.jhanu-tabs.nav-tabs .nav-link.active {
    color: var(--jhanu-blue);
    background: transparent;
    border-bottom-color: var(--jhanu-yellow);
    font-weight: var(--jhanu-font-weight-semibold);
}

.jhanu-tabs + .tab-content {
    background: var(--jhanu-surface);
    border-radius: 0 0 var(--jhanu-radius-lg) var(--jhanu-radius-lg);
    padding: var(--jhanu-space-5);
    box-shadow: var(--jhanu-shadow-sm);
}

/* Tabs scroll horizontally on narrow screens rather than wrapping into a stack. */
@media (max-width: 767.98px) {
    .jhanu-tabs.nav-tabs {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .jhanu-tabs.nav-tabs .nav-link {
        white-space: nowrap;
    }
}

/* ==========================================================================
   13. AlertifyJS
   ========================================================================== */

/*
 * No rule for .ajs-header here on purpose. It used to paint the header brand
 * blue, and it never took effect: AlertifyJS declares the same selector with
 * the same specificity and loads after this file. Every one of the 88 dialogs
 * in the product passes an empty title, so making it work would put a bar of
 * blue with nothing in it above every message. Left to Alertify.
 */

.alertify .ajs-dialog {
    border-radius: var(--jhanu-radius-lg);
    box-shadow: var(--jhanu-shadow-modal);
    overflow: hidden;
}

.alertify .ajs-footer {
    background-color: var(--jhanu-surface-alt);
    border-top: 1px solid var(--jhanu-border);
}

/*
 * The !important is on the colour and nothing else, and it is not decoration.
 * AlertifyJS ships this exact selector - ".alertify .ajs-footer .ajs-buttons
 * .ajs-button.ajs-ok { color: #3593d2 }" - so the two tie on specificity, and
 * its theme loads after this file on every page. Alertify won the colour while
 * we won the background, which put a mid blue on the brand blue: 1.36:1, a
 * button whose label you cannot read. White on the brand blue is 4.56:1.
 *
 * Same root cause as the DataTables rules above: vendor CSS loads after the
 * theme. Fixing the load order removes the need for all of them.
 */
.alertify .ajs-footer .ajs-buttons .ajs-button.ajs-ok {
    background-color: var(--jhanu-blue);
    border-color: var(--jhanu-blue);
    color: var(--jhanu-text-on-brand) !important;
    font-weight: var(--jhanu-font-weight-semibold);
}

.alertify .ajs-footer .ajs-buttons .ajs-button.ajs-ok:hover {
    background-color: var(--jhanu-blue-dark);
    border-color: var(--jhanu-blue-dark);
}

.alertify .ajs-footer .ajs-buttons .ajs-button.ajs-cancel {
    background-color: var(--jhanu-neutral);
    border-color: var(--jhanu-neutral);
    color: var(--jhanu-white) !important;
}

.alertify .ajs-footer .ajs-buttons .ajs-button.ajs-cancel:hover {
    background-color: var(--jhanu-neutral-dark);
    border-color: var(--jhanu-neutral-dark);
}

/* ==========================================================================
   14. Utilities
   ========================================================================== */

.jhanu-text-brand   { color: var(--jhanu-blue-text); }
.jhanu-text-accent  { color: var(--jhanu-yellow-text); }
.jhanu-text-muted   { color: var(--jhanu-text-muted); }
.jhanu-bg-brand     { background-color: var(--jhanu-blue); color: var(--jhanu-text-on-brand); }
.jhanu-bg-accent    { background-color: var(--jhanu-yellow); color: var(--jhanu-text-on-yellow); }
.jhanu-bg-surface   { background-color: var(--jhanu-surface); }

/* Accessible name for icon-only controls without visually hiding the icon. */
.jhanu-visually-hidden {
    position: absolute !important;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ==========================================================================
   15. Responsive
   ========================================================================== */

@media (max-width: 767.98px) {
    .jhanu-page-header {
        flex-direction: column;
        align-items: stretch;
    }

    .jhanu-page-header__title {
        font-size: var(--jhanu-font-size-lg);
    }

    .jhanu-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .jhanu-toolbar > .btn,
    .jhanu-toolbar > .btn-group {
        width: 100%;
    }

    .jhanu-toolbar__spacer {
        margin-left: 0;
    }

    .jhanu-card__body,
    .jhanu-card--filter,
    .modal-body {
        padding: var(--jhanu-space-4);
    }

    .jhanu-kpi-card {
        padding: var(--jhanu-space-4);
    }

    .jhanu-kpi-card__icon {
        width: 48px;
        height: 48px;
        font-size: var(--jhanu-font-size-xl);
    }
}

/* ==========================================================================
   16. Motion and print
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }

    .jhanu-kpi-card:hover {
        transform: none;
    }
}

@media print {
    body {
        background: var(--jhanu-white);
    }

    .jhanu-toolbar,
    .jhanu-page-header__actions,
    .action-icon,
    div.dt-container .dt-length,
    div.dt-container .dt-search,
    div.dt-container div.dt-paging {
        display: none !important;
    }

    .jhanu-card,
    .jhanu-kpi-card,
    .table {
        box-shadow: none;
    }

    /* Keep table headers legible when printers drop background colours. */
    table.dataTable thead th,
    .table thead th {
        background-color: var(--jhanu-white) !important;
        color: var(--jhanu-black) !important;
        border-bottom: 2px solid var(--jhanu-black) !important;
    }
}

/* ==========================================================================
   17. Row selection
   ========================================================================== */

/*
 * Selecting rows in a list to act on all of them at once. The action bar only
 * exists while something is selected, and it is pinned to the bottom of the
 * viewport so it stays reachable however far down the table the user has
 * scrolled - a selection made on row 3 is usually acted on from row 40.
 *
 * Pinned rather than stuck to the end of the card: these lists sit inside a
 * horizontally scrolling wrapper, which becomes the containing block for a
 * sticky element and leaves it stranded below the fold.
 */
.jhanu-select-col {
    width: 36px;
    text-align: center;
}

tr.jhanu-row--selected > td {
    background: rgba(var(--jhanu-blue-rgb), 0.1) !important;
}

.jhanu-select-bar {
    position: fixed;
    left: var(--jhanu-space-4);
    right: var(--jhanu-space-4);
    bottom: var(--jhanu-space-4);
    z-index: var(--jhanu-z-sticky);
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--jhanu-space-3);
    padding: var(--jhanu-space-3) var(--jhanu-space-4);
    background: var(--jhanu-blue);
    color: var(--jhanu-text-on-brand);
    border-radius: var(--jhanu-radius);
    box-shadow: var(--jhanu-shadow-lg);
}

/* The bar floats over the end of the page, so the last rows need room to clear it. */
body.jhanu-has-select-bar {
    padding-bottom: 96px;
}

.jhanu-select-bar__count {
    font-weight: var(--jhanu-font-weight-semibold);
}

.jhanu-select-bar__actions {
    display: flex;
    flex-wrap: wrap;
    gap: var(--jhanu-space-2);
    margin-left: auto;
}

/* On a phone the bar stacks, and its actions go full width so they stay tappable. */
@media (max-width: 575.98px) {
    .jhanu-select-bar {
        flex-direction: column;
        align-items: stretch;
    }

    .jhanu-select-bar__actions {
        margin-left: 0;
    }

    .jhanu-select-bar__actions .btn {
        flex: 1;
    }
}

/* The per-item outcome of a bulk action: which rows did not go through, and why. */
.jhanu-batch-failures {
    margin: var(--jhanu-space-3) 0 0;
    padding-left: var(--jhanu-space-5);
    font-size: var(--jhanu-font-size-sm);
}
