/* ==========================================================================
   Happi Learning — Admin Panel design system
   --------------------------------------------------------------------------
   Single source of truth for the admin CMS shell and its components. Linked
   from application/views/common/header.php. Page views should consume these
   classes and `var(--admin-*)` tokens rather than declaring their own colours,
   radii or shadows — that is what made the panel drift in the first place.

   Scope: the admin CMS only. The Family Portal (Portal/, Practice/, Learn/,
   Diagnostic/, Coach/, Simulator/, Family/, Subscription/) is a separate,
   parent-facing app on its own shell and palette — it does not load this file.
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Design tokens
   -------------------------------------------------------------------------- */
:root {
    /* --- Brand ------------------------------------------------------------
       Navy carries structure (header, sidebar, primary actions, active nav).
       Gold is the CTA/highlight accent. Teal and coral are status accents.
       The -dark/-deep/-soft variants are shades of those same hues, added
       because a UI needs hover, active and on-light-text versions — they are
       not new colours. */
    --admin-navy: #22285C;
    --admin-navy-light: #2E3573;
    --admin-navy-dark: #1A1E47;
    --admin-navy-darker: #141838;
    --admin-navy-soft: rgba(34, 40, 92, 0.08);
    --admin-navy-softer: rgba(34, 40, 92, 0.04);

    --admin-gold: #F8AA1C;
    --admin-gold-hover: #DE9310;
    --admin-gold-deep: #8F5D02;   /* gold as TEXT on a light surface (>=4.5:1) */
    --admin-gold-soft: rgba(248, 170, 28, 0.14);

    --admin-teal: #2CBFC1;
    --admin-teal-deep: #17696B;   /* teal as TEXT on a light surface */
    --admin-teal-soft: rgba(44, 191, 193, 0.14);

    --admin-coral: #FA7161;
    /* Clears 4.5:1 against its own coral-tinted badge/alert background,
       not just against plain white. */
    --admin-coral-deep: #AE4330;  /* coral as TEXT on a light surface */
    --admin-coral-soft: rgba(250, 113, 97, 0.13);

    --admin-charcoal: #22252C;

    /* --- Surfaces --------------------------------------------------------- */
    --admin-bg: #FFF9EF;
    --admin-surface: #FFFFFF;
    --admin-surface-alt: #FDFAF3;      /* table heads, hovered rows, wells */
    --admin-border: #E9E4DB;
    --admin-border-strong: #D8D1C2;

    /* --- Text ------------------------------------------------------------- */
    --admin-heading: #20264F;
    --admin-text: #5F6068;
    /* #85868E measured 3.62:1 on white — below AA for the sidebar group
       labels, stat labels, inactive tabs and every .text-muted that use it. */
    --admin-text-muted: #6E6F77;
    --admin-text-on-dark: rgba(255, 255, 255, 0.92);

    /* --- Status ----------------------------------------------------------- */
    /* Derived from the accents so status never introduces a new hue. */
    --admin-success: var(--admin-teal-deep);
    --admin-success-bg: var(--admin-teal-soft);
    --admin-success-bd: rgba(44, 191, 193, 0.32);
    --admin-warning: var(--admin-gold-deep);
    --admin-warning-bg: var(--admin-gold-soft);
    --admin-warning-bd: rgba(248, 170, 28, 0.38);
    --admin-danger: var(--admin-coral-deep);
    --admin-danger-bg: var(--admin-coral-soft);
    --admin-danger-bd: rgba(250, 113, 97, 0.36);
    --admin-info: var(--admin-navy);
    --admin-info-bg: var(--admin-navy-soft);
    --admin-info-bd: rgba(34, 40, 92, 0.2);

    /* --- Shape ------------------------------------------------------------ */
    --admin-radius-sm: 8px;
    --admin-radius: 12px;
    --admin-radius-lg: 16px;
    --admin-radius-pill: 50px;

    --admin-shadow-xs: 0 1px 2px rgba(34, 40, 92, 0.05);
    --admin-shadow-sm: 0 2px 8px rgba(34, 40, 92, 0.05);
    --admin-shadow: 0 4px 16px rgba(34, 40, 92, 0.06);
    --admin-shadow-md: 0 10px 24px rgba(34, 40, 92, 0.09);
    --admin-shadow-lg: 0 20px 44px rgba(34, 40, 92, 0.14);

    /* --- Spacing ---------------------------------------------------------- */
    --admin-space-1: 0.25rem;
    --admin-space-2: 0.5rem;
    --admin-space-3: 0.75rem;
    --admin-space-4: 1rem;
    --admin-space-5: 1.5rem;
    --admin-space-6: 2rem;

    /* --- Layout ----------------------------------------------------------- */
    --admin-sidebar-w: 248px;
    --admin-header-h: 60px;

    --admin-transition: 0.2s ease;
    --admin-ease-out: cubic-bezier(0.16, 1, 0.3, 1);

    /* --- Legacy aliases ---------------------------------------------------
       Inline styles across the page views still reference these names. They
       are mapped onto the new palette so no screen renders unstyled while the
       per-page cleanup proceeds. Do NOT use them in new code. */
    --color-primary-start: var(--admin-navy);
    --color-primary-end: var(--admin-navy-light);
    --color-primary-hover-start: var(--admin-navy-dark);
    --color-primary-hover-end: var(--admin-navy);
    --color-primary-gradient: linear-gradient(135deg, var(--admin-navy) 0%, var(--admin-navy-light) 100%);
    --color-primary-gradient-hover: linear-gradient(135deg, var(--admin-navy-dark) 0%, var(--admin-navy) 100%);
    --color-bg-start: var(--admin-bg);
    --color-bg-end: var(--admin-bg);
    --color-table-head-bg: var(--admin-surface-alt);
    --color-ink: var(--admin-text);
    --color-navy: var(--admin-navy);
}

/* --------------------------------------------------------------------------
   2. Base + typography
   -------------------------------------------------------------------------- */
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--admin-bg);
    color: var(--admin-text);
    min-height: 100vh;
    padding-top: var(--admin-header-h);
    font-size: 0.95rem;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6 {
    font-family: inherit;
    color: var(--admin-heading);
    font-weight: 700;
    letter-spacing: -0.01em;
}
h1, .h1 { font-size: 1.6rem; }
h2, .h2 { font-size: 1.35rem; }
h3, .h3 { font-size: 1.18rem; }
h4, .h4 { font-size: 1.05rem; }
h5, .h5 { font-size: 0.98rem; }
h6, .h6 { font-size: 0.9rem; }

a { color: var(--admin-navy); text-decoration: none; transition: color var(--admin-transition); }
a:hover { color: var(--admin-navy-light); }

.text-muted { color: var(--admin-text-muted) !important; }
small, .small { font-size: 0.85rem; }

/* One visible focus treatment everywhere. Bootstrap's default blue ring is
   off-palette and several vendor widgets set outline:none outright. */
:focus-visible,
.form-control:focus-visible,
.form-select:focus-visible,
.btn:focus-visible,
a:focus-visible,
button:focus-visible {
    outline: 2px solid var(--admin-gold);
    outline-offset: 2px;
    border-radius: var(--admin-radius-sm);
}

/* --------------------------------------------------------------------------
   3. Layout — header, sidebar, content, footer
   -------------------------------------------------------------------------- */
header.admin-header {
    background: var(--admin-navy);
    color: #fff;
    height: var(--admin-header-h);
    box-shadow: var(--admin-shadow-sm);
    border-bottom: 1px solid var(--admin-navy-dark);
    z-index: 1040;
}
.admin-header .header-brand-link { min-width: 0; overflow: hidden; }
.admin-header .header-brand {
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 45vw;
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: -0.01em;
}
.admin-header .nav-link { color: rgba(255, 255, 255, 0.85) !important; transition: color var(--admin-transition); }
.admin-header .nav-link:hover,
.admin-header .nav-link:focus { color: #fff !important; }
.admin-header .btn-icon-ghost {
    width: 34px; height: 34px;
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: var(--admin-radius-sm);
    border: 1px solid rgba(255, 255, 255, 0.22);
    background: rgba(255, 255, 255, 0.06);
    color: #fff;
    transition: background var(--admin-transition), border-color var(--admin-transition);
}
.admin-header .btn-icon-ghost:hover { background: rgba(255, 255, 255, 0.16); border-color: rgba(255, 255, 255, 0.4); color: #fff; }
.admin-header .header-badge {
    background: var(--admin-gold);
    color: var(--admin-navy);
    font-size: 0.65rem;
    font-weight: 700;
}

@media (max-width: 480px) {
    .admin-header .header-brand { max-width: 38vw; font-size: 0.95rem; }
}

/* Sidebar */
.sidebar {
    width: var(--admin-sidebar-w);
    position: fixed;
    top: var(--admin-header-h);
    bottom: 0;
    left: 0;
    z-index: 1030;
    background: var(--admin-surface);
    padding-top: var(--admin-space-4);
    overflow-y: auto;
    overscroll-behavior: contain;
    border-right: 1px solid var(--admin-border);
    box-shadow: var(--admin-shadow-xs);
    transition: left 0.3s var(--admin-ease-out);
}
.sidebar::-webkit-scrollbar { width: 8px; }
.sidebar::-webkit-scrollbar-thumb { background: var(--admin-border); border-radius: 8px; }

.sidebar a,
.sidebar .sidebar-navitem {
    display: flex;
    align-items: center;
    padding: 10px 14px;
    color: var(--admin-text);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.92rem;
    border-radius: var(--admin-radius-sm);
    margin: 2px 12px;
    transition: background var(--admin-transition), color var(--admin-transition);
}
.sidebar a i { font-size: 1rem; flex-shrink: 0; }

.sidebar a:hover {
    background: var(--admin-navy-softer);
    color: var(--admin-navy);
}
/* Active nav is navy per the palette; the gold rail marks "you are here"
   without a heavy fill fighting the header. */
.sidebar a.active {
    background: var(--admin-navy);
    color: #fff;
    font-weight: 600;
    box-shadow: var(--admin-shadow-xs);
    position: relative;
}
.sidebar a.active::before {
    content: '';
    position: absolute;
    left: -12px;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 22px;
    border-radius: 0 3px 3px 0;
    background: var(--admin-gold);
}
.sidebar a.active i { color: var(--admin-gold); }

/* Sidebar groups */
.sidebar-group-toggle {
    display: flex;
    align-items: center;
    width: calc(100% - 24px);
    padding: 10px 14px;
    margin: 12px 12px 2px;
    color: var(--admin-text-muted);
    background: transparent;
    border: none;
    border-radius: var(--admin-radius-sm);
    font-weight: 700;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    transition: background var(--admin-transition), color var(--admin-transition);
    cursor: pointer;
}
.sidebar-group-toggle:hover { background: var(--admin-navy-softer); color: var(--admin-navy); }
.sidebar-group-toggle.active-group { color: var(--admin-navy); }
.sidebar-group-chevron { font-size: 0.75rem; transition: transform 0.25s var(--admin-ease-out); }
.sidebar-group-toggle[aria-expanded="true"] .sidebar-group-chevron { transform: rotate(180deg); }
.sidebar-subitem { margin-left: 20px !important; width: calc(100% - 44px); font-size: 0.88rem !important; }

/* Sidebar search */
.sidebar-search { margin-top: 2px; }
.sidebar-search-icon {
    position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
    color: var(--admin-text-muted); font-size: 0.85rem; pointer-events: none;
}
.sidebar-search-input {
    padding-left: 32px !important;
    border-radius: var(--admin-radius-sm);
    border: 1px solid var(--admin-border);
    background: var(--admin-surface-alt);
    color: var(--admin-text);
    font-size: 0.88rem;
}
.sidebar-search-input::placeholder { color: var(--admin-text-muted); }
.sidebar-search-input:focus {
    border-color: var(--admin-navy);
    background: var(--admin-surface);
    box-shadow: 0 0 0 3px var(--admin-navy-soft);
}
.sidebar-search-empty { font-size: 0.82rem; color: var(--admin-text-muted); padding: 4px 4px 0; }

/* Content */
.content {
    margin-left: var(--admin-sidebar-w);
    padding: var(--admin-space-5) var(--admin-space-6) var(--admin-space-6);
    transition: margin-left 0.3s var(--admin-ease-out);
}

/* Footer */
footer.admin-footer {
    background: var(--admin-charcoal);
    color: rgba(255, 255, 255, 0.7);
    padding: 14px;
    text-align: center;
    font-size: 0.85rem;
    margin-left: var(--admin-sidebar-w);
    transition: margin-left 0.3s var(--admin-ease-out);
}
footer.admin-footer a { color: rgba(255, 255, 255, 0.9); }

/* --------------------------------------------------------------------------
   4. Page header (title + breadcrumb + actions)
   -------------------------------------------------------------------------- */
.page-head {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--admin-space-3);
    margin-bottom: var(--admin-space-5);
}
.page-head-title { margin: 0; font-size: 1.45rem; font-weight: 800; color: var(--admin-heading); }
.page-head-sub { margin: 0.25rem 0 0; color: var(--admin-text-muted); font-size: 0.9rem; }
.page-head-actions { display: flex; flex-wrap: wrap; gap: var(--admin-space-2); }

.admin-breadcrumb {
    display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem;
    list-style: none; margin: 0 0 0.35rem; padding: 0;
    font-size: 0.8rem; color: var(--admin-text-muted);
}
.admin-breadcrumb a { color: var(--admin-text-muted); }
.admin-breadcrumb a:hover { color: var(--admin-navy); }
.admin-breadcrumb li + li::before { content: '/'; margin-right: 0.4rem; color: var(--admin-border-strong); }
.admin-breadcrumb [aria-current="page"] { color: var(--admin-heading); font-weight: 600; }

/* --------------------------------------------------------------------------
   5. Cards
   -------------------------------------------------------------------------- */
.content .card,
.admin-card {
    border-radius: var(--admin-radius-lg);
    border: 1px solid var(--admin-border);
    background: var(--admin-surface);
    box-shadow: var(--admin-shadow-sm) !important;
    overflow: hidden;
}
.content .card-header,
.admin-card > .card-header {
    background: var(--admin-surface);
    border-bottom: 1px solid var(--admin-border);
    padding: 16px 20px;
    color: var(--admin-heading);
}
.content .card-header h5,
.content .card-header h6 { color: inherit; margin: 0; font-weight: 700; }

/* The panel-style header used by list_partials/card_header + form_partials/
   section_header. Navy per the palette's "important sections". */
.content .card-header.card-header-navy,
.card-header.card-header-navy {
    background: var(--admin-navy) !important;
    border-bottom: none;
    color: #fff !important;
}
.card-header-navy h5, .card-header-navy h6 { color: #fff !important; }
.card-header-navy .card-header-icon { color: var(--admin-gold); }

.content .card-body { padding: var(--admin-space-5); }
.card-title { color: var(--admin-heading); font-weight: 700; }

/* Soft supporting panel inside a card (help text, notes) */
.admin-well {
    background: var(--admin-surface-alt);
    border: 1px solid var(--admin-border);
    border-radius: var(--admin-radius);
    padding: var(--admin-space-4);
    color: var(--admin-text);
    font-size: 0.9rem;
}

/* --------------------------------------------------------------------------
   6. Buttons
   -------------------------------------------------------------------------- */
.btn {
    border-radius: var(--admin-radius-sm);
    font-weight: 600;
    font-size: 0.9rem;
    padding: 0.5rem 1rem;
    transition: background-color var(--admin-transition), border-color var(--admin-transition),
                color var(--admin-transition), box-shadow var(--admin-transition), transform var(--admin-transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    line-height: 1.4;
}
.btn:active { transform: translateY(1px); }
.btn:disabled, .btn.disabled { opacity: 0.55; cursor: not-allowed; box-shadow: none; transform: none; }

/* Primary = navy (structure/confirm) */
.btn-primary {
    background: var(--admin-navy);
    border: 1px solid var(--admin-navy);
    color: #fff;
    box-shadow: var(--admin-shadow-xs);
}
.btn-primary:hover:not(:disabled) { background: var(--admin-navy-dark); border-color: var(--admin-navy-dark); color: #fff; box-shadow: var(--admin-shadow-sm); }
.btn-primary:active { background: var(--admin-navy-darker); border-color: var(--admin-navy-darker); }

/* Gold CTA — the one "create / go do the thing" button per screen */
.btn-gold {
    background: var(--admin-gold);
    border: 1px solid var(--admin-gold);
    color: var(--admin-navy);
    box-shadow: var(--admin-shadow-xs);
}
.btn-gold:hover:not(:disabled) { background: var(--admin-gold-hover); border-color: var(--admin-gold-hover); color: var(--admin-navy); box-shadow: 0 6px 16px rgba(248, 170, 28, 0.32); }

.btn-outline-primary {
    border: 1px solid var(--admin-navy);
    color: var(--admin-navy);
    background: transparent;
}
.btn-outline-primary:hover:not(:disabled) { background: var(--admin-navy); color: #fff; border-color: var(--admin-navy); }

.btn-secondary {
    background: var(--admin-surface);
    border: 1px solid var(--admin-border-strong);
    color: var(--admin-text);
}
.btn-secondary:hover:not(:disabled) { background: var(--admin-surface-alt); border-color: var(--admin-navy); color: var(--admin-navy); }

.btn-danger {
    background: var(--admin-coral-deep);
    border: 1px solid var(--admin-coral-deep);
    color: #fff;
}
.btn-danger:hover:not(:disabled) { background: #A33F2E; border-color: #A33F2E; color: #fff; }

.btn-outline-danger { border: 1px solid var(--admin-danger-bd); color: var(--admin-danger); background: transparent; }
.btn-outline-danger:hover:not(:disabled) { background: var(--admin-coral-deep); border-color: var(--admin-coral-deep); color: #fff; }

.btn-light, .btn-outline-light { border-radius: var(--admin-radius-sm); }
.btn-success { background: var(--admin-teal-deep); border-color: var(--admin-teal-deep); color: #fff; }
.btn-success:hover:not(:disabled) { background: #125355; border-color: #125355; color: #fff; }
.btn-warning { background: var(--admin-gold); border-color: var(--admin-gold); color: var(--admin-navy); }
.btn-warning:hover:not(:disabled) { background: var(--admin-gold-hover); border-color: var(--admin-gold-hover); color: var(--admin-navy); }
.btn-info { background: var(--admin-teal); border-color: var(--admin-teal); color: var(--admin-navy); }

.btn-sm { padding: 0.35rem 0.7rem; font-size: 0.82rem; }
.btn-lg { padding: 0.7rem 1.4rem; font-size: 1rem; }

/* Icon-only square button (table row actions) */
.btn-icon {
    width: 34px; height: 34px; padding: 0 !important;
    border-radius: var(--admin-radius-sm) !important;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 0.9rem;
}

/* Inline busy state: <button class="btn btn-primary is-loading"> */
.btn.is-loading { position: relative; color: transparent !important; pointer-events: none; }
.btn.is-loading::after {
    content: '';
    position: absolute; top: 50%; left: 50%;
    width: 15px; height: 15px; margin: -8px 0 0 -8px;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    color: #fff;
    animation: admin-spin 0.7s linear infinite;
}
.btn-gold.is-loading::after, .btn-secondary.is-loading::after, .btn-warning.is-loading::after { color: var(--admin-navy); }
@keyframes admin-spin { to { transform: rotate(360deg); } }

.btn-group-actions { display: flex; flex-wrap: wrap; gap: var(--admin-space-2); }

/* --------------------------------------------------------------------------
   7. Forms
   -------------------------------------------------------------------------- */
.form-label {
    font-weight: 600;
    font-size: 0.88rem;
    color: var(--admin-heading);
    margin-bottom: 0.35rem;
}
.form-control, .form-select {
    border: 1px solid var(--admin-border);
    border-radius: var(--admin-radius-sm);
    padding: 0.55rem 0.8rem;
    font-size: 0.92rem;
    color: var(--admin-text);
    background-color: var(--admin-surface);
    transition: border-color var(--admin-transition), box-shadow var(--admin-transition);
}
.form-control::placeholder { color: var(--admin-text-muted); }
.form-control:focus, .form-select:focus {
    border-color: var(--admin-navy);
    box-shadow: 0 0 0 3px var(--admin-navy-soft);
    background-color: var(--admin-surface);
    color: var(--admin-text);
}
.form-control:disabled, .form-select:disabled, .form-control[readonly] {
    background-color: var(--admin-surface-alt);
    color: var(--admin-text-muted);
    cursor: not-allowed;
}
.form-text { color: var(--admin-text-muted); font-size: 0.82rem; margin-top: 0.3rem; }

/* Validation */
.form-control.is-invalid, .form-select.is-invalid,
.was-validated .form-control:invalid, .was-validated .form-select:invalid {
    border-color: var(--admin-coral-deep);
    box-shadow: 0 0 0 3px var(--admin-coral-soft);
    background-image: none;
}
.invalid-feedback { color: var(--admin-danger); font-size: 0.82rem; }
.form-control.is-valid, .was-validated .form-control:valid {
    border-color: var(--admin-teal); background-image: none;
}
.valid-feedback { color: var(--admin-success); }
.text-danger { color: var(--admin-danger) !important; }

.form-check-input { border-color: var(--admin-border-strong); }
.form-check-input:checked { background-color: var(--admin-navy); border-color: var(--admin-navy); }
.form-check-input:focus { border-color: var(--admin-navy); box-shadow: 0 0 0 3px var(--admin-navy-soft); }

/* Fieldset grouping inside long forms */
.form-section { border-top: 1px solid var(--admin-border); margin-top: var(--admin-space-5); padding-top: var(--admin-space-5); }
.form-section:first-child { border-top: none; margin-top: 0; padding-top: 0; }
.form-section-title {
    font-size: 0.74rem; font-weight: 700; text-transform: uppercase;
    letter-spacing: 0.08em; color: var(--admin-text-muted); margin-bottom: var(--admin-space-4);
}
.form-actions {
    display: flex; flex-wrap: wrap; justify-content: flex-end; gap: var(--admin-space-2);
    border-top: 1px solid var(--admin-border);
    margin-top: var(--admin-space-5);
    padding-top: var(--admin-space-4);
}

/* --------------------------------------------------------------------------
   8. Tables
   -------------------------------------------------------------------------- */
.content .table {
    border: 1px solid var(--admin-border) !important;
    border-radius: var(--admin-radius) !important;
    margin-bottom: 0;
    overflow: hidden;
}
.content .table,
.content .table th,
.content .table td { border-color: var(--admin-border) !important; }

.content .table thead th {
    background: var(--admin-surface-alt) !important;
    color: var(--admin-text-muted) !important;
    font-size: 0.74rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 12px 14px;
    white-space: nowrap;
    border-bottom: 1px solid var(--admin-border) !important;
}
.content .table tbody td {
    color: var(--admin-text);
    font-size: 0.9rem;
    padding: 12px 14px;
    vertical-align: middle;
}
.content .table tbody tr { transition: background var(--admin-transition); }
.content .table tbody tr:hover { background: var(--admin-surface-alt); }
.content .table tbody tr:last-child td { border-bottom: none !important; }

/* Row action cluster — markup sets inline 45px squares + flex-column on some
   screens, hence the !important. */
.content .table td div.d-flex {
    flex-direction: row !important;
    justify-content: center;
    gap: 6px !important;
}
.content .table td .btn {
    width: 34px !important;
    height: 34px !important;
    border-radius: var(--admin-radius-sm) !important;
    padding: 0 !important;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    font-size: 0.88rem;
}

.table-responsive { border-radius: var(--admin-radius); }

/* --------------------------------------------------------------------------
   9. DataTables
   -------------------------------------------------------------------------- */
div.dataTables_wrapper div.dataTables_length { float: left; text-align: left !important; }
div.dataTables_wrapper div.dataTables_filter { float: right; text-align: right !important; }
div.dataTables_wrapper table.dataTable { clear: both; width: 100% !important; margin: 0 !important; }

div.dataTables_wrapper .dataTables_length select,
div.dataTables_wrapper .dataTables_filter input {
    border: 1px solid var(--admin-border);
    border-radius: var(--admin-radius-sm);
    padding: 6px 10px;
    background: var(--admin-surface);
    color: var(--admin-text);
    font-size: 0.88rem;
}
div.dataTables_wrapper .dataTables_length label,
div.dataTables_wrapper .dataTables_filter label { color: var(--admin-text-muted); font-size: 0.86rem; }
div.dataTables_wrapper .dataTables_filter input:focus,
div.dataTables_wrapper .dataTables_length select:focus {
    border-color: var(--admin-navy);
    box-shadow: 0 0 0 3px var(--admin-navy-soft);
    outline: none;
}
div.dataTables_wrapper .dataTables_info { color: var(--admin-text-muted); padding-top: 14px; font-size: 0.85rem; }
div.dataTables_wrapper .dataTables_empty { color: var(--admin-text-muted); padding: 2rem !important; }

div.dataTables_wrapper .dataTables_paginate .paginate_button {
    border-radius: var(--admin-radius-sm) !important;
    border: 1px solid transparent !important;
    background: none !important;
    color: var(--admin-text) !important;
    margin: 0 2px;
    padding: 0.35rem 0.7rem;
}
div.dataTables_wrapper .dataTables_paginate .paginate_button:hover:not(.disabled):not(.current) {
    background: var(--admin-navy-softer) !important;
    color: var(--admin-navy) !important;
    border-color: var(--admin-border) !important;
}
div.dataTables_wrapper .dataTables_paginate .paginate_button.current {
    background: var(--admin-navy) !important;
    color: #fff !important;
    border: none !important;
}
div.dataTables_wrapper .dataTables_paginate .paginate_button.disabled { color: var(--admin-text-muted) !important; opacity: 0.5; }

/* Bootstrap pagination (non-DataTables screens) */
.pagination .page-link { color: var(--admin-text); border-color: var(--admin-border); border-radius: var(--admin-radius-sm); margin: 0 2px; }
.pagination .page-link:hover { background: var(--admin-navy-softer); color: var(--admin-navy); border-color: var(--admin-border); }
.pagination .page-item.active .page-link { background: var(--admin-navy); border-color: var(--admin-navy); color: #fff; }
.pagination .page-item.disabled .page-link { color: var(--admin-text-muted); background: var(--admin-surface-alt); }

/* --------------------------------------------------------------------------
   10. Badges + status pills
   -------------------------------------------------------------------------- */
.admin-badge {
    display: inline-flex; align-items: center; gap: 0.3rem;
    padding: 0.24rem 0.6rem;
    border-radius: var(--admin-radius-pill);
    font-size: 0.74rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    border: 1px solid transparent;
    white-space: nowrap;
}
.admin-badge-success { background: var(--admin-success-bg); color: var(--admin-success); border-color: var(--admin-success-bd); }
.admin-badge-warning { background: var(--admin-warning-bg); color: var(--admin-warning); border-color: var(--admin-warning-bd); }
.admin-badge-danger  { background: var(--admin-danger-bg);  color: var(--admin-danger);  border-color: var(--admin-danger-bd); }
.admin-badge-info    { background: var(--admin-info-bg);    color: var(--admin-info);    border-color: var(--admin-info-bd); }
.admin-badge-neutral { background: var(--admin-surface-alt); color: var(--admin-text); border-color: var(--admin-border); }

/* Bootstrap badge classes used in existing markup, remapped onto the palette
   so no screen keeps rendering Bootstrap's default blue/green/red. */
.badge.bg-primary { background: var(--admin-info-bg) !important; color: var(--admin-info) !important; border: 1px solid var(--admin-info-bd); font-weight: 700; }
.badge.bg-success { background: var(--admin-success-bg) !important; color: var(--admin-success) !important; border: 1px solid var(--admin-success-bd); font-weight: 700; }
.badge.bg-warning { background: var(--admin-warning-bg) !important; color: var(--admin-warning) !important; border: 1px solid var(--admin-warning-bd); font-weight: 700; }
.badge.bg-danger  { background: var(--admin-danger-bg) !important;  color: var(--admin-danger) !important;  border: 1px solid var(--admin-danger-bd); font-weight: 700; }
.badge.bg-info    { background: var(--admin-success-bg) !important; color: var(--admin-success) !important; border: 1px solid var(--admin-success-bd); font-weight: 700; }
.badge.bg-secondary { background: var(--admin-surface-alt) !important; color: var(--admin-text) !important; border: 1px solid var(--admin-border); font-weight: 700; }
.badge { border-radius: var(--admin-radius-pill); padding: 0.28rem 0.62rem; font-size: 0.74rem; }

/* --------------------------------------------------------------------------
   11. Alerts
   -------------------------------------------------------------------------- */
.alert { border-radius: var(--admin-radius); border-width: 1px; border-left-width: 4px; font-size: 0.9rem; padding: 0.85rem 1rem; }
.alert-success { background: var(--admin-success-bg); border-color: var(--admin-success-bd); color: var(--admin-success); }
.alert-warning { background: var(--admin-warning-bg); border-color: var(--admin-warning-bd); color: var(--admin-warning); }
.alert-danger  { background: var(--admin-danger-bg);  border-color: var(--admin-danger-bd);  color: var(--admin-danger); }
.alert-info    { background: var(--admin-info-bg);    border-color: var(--admin-info-bd);    color: var(--admin-info); }
.alert-light   { background: var(--admin-surface-alt); border-color: var(--admin-border); color: var(--admin-text); }

/* --------------------------------------------------------------------------
   12. Tabs
   -------------------------------------------------------------------------- */
.nav-tabs { border-bottom: 1px solid var(--admin-border); gap: 0.25rem; }
.nav-tabs .nav-link {
    border: none;
    border-bottom: 2px solid transparent;
    border-radius: 0;
    color: var(--admin-text-muted);
    font-weight: 600;
    font-size: 0.9rem;
    padding: 0.7rem 1rem;
    transition: color var(--admin-transition), border-color var(--admin-transition), background var(--admin-transition);
}
.nav-tabs .nav-link:hover { color: var(--admin-navy); border-bottom-color: var(--admin-border-strong); background: transparent; }
.nav-tabs .nav-link.active {
    color: var(--admin-navy);
    background: transparent;
    border-bottom-color: var(--admin-gold);
}
.nav-tabs .nav-link i { color: inherit; }

/* --------------------------------------------------------------------------
   13. Modals + dropdowns
   -------------------------------------------------------------------------- */
.modal-content { border: none; border-radius: var(--admin-radius-lg); box-shadow: var(--admin-shadow-lg); overflow: hidden; }
.modal-header { background: var(--admin-navy); color: #fff; border-bottom: none; padding: 1rem 1.25rem; }
.modal-header .modal-title { color: #fff; font-size: 1.02rem; font-weight: 700; }
.modal-header .btn-close { filter: invert(1) grayscale(100%) brightness(200%); opacity: 0.8; }
.modal-header .btn-close:hover { opacity: 1; }
.modal-body { padding: var(--admin-space-5); }
.modal-footer { border-top: 1px solid var(--admin-border); padding: 1rem 1.25rem; gap: var(--admin-space-2); }
.modal-backdrop.show { opacity: 0.45; }

.dropdown-menu {
    border: 1px solid var(--admin-border);
    border-radius: var(--admin-radius);
    box-shadow: var(--admin-shadow-md);
    padding: 0.35rem;
    font-size: 0.9rem;
}
.dropdown-item { border-radius: var(--admin-radius-sm); padding: 0.5rem 0.7rem; color: var(--admin-text); }
.dropdown-item:hover, .dropdown-item:focus { background: var(--admin-navy-softer); color: var(--admin-navy); }
.dropdown-item.text-danger:hover { background: var(--admin-danger-bg); color: var(--admin-danger); }
.dropdown-divider { border-color: var(--admin-border); }

/* --------------------------------------------------------------------------
   14. Toolbar / search + filters
   -------------------------------------------------------------------------- */
.admin-toolbar {
    display: flex; flex-wrap: wrap; align-items: center; gap: var(--admin-space-2);
    padding: var(--admin-space-4) var(--admin-space-5);
    border-bottom: 1px solid var(--admin-border);
    background: var(--admin-surface);
}
.admin-toolbar .admin-search { position: relative; flex: 1 1 220px; max-width: 340px; }
.admin-toolbar .admin-search i {
    position: absolute; left: 11px; top: 50%; transform: translateY(-50%);
    color: var(--admin-text-muted); font-size: 0.85rem; pointer-events: none;
}
.admin-toolbar .admin-search .form-control { padding-left: 31px; }
.admin-toolbar .admin-toolbar-spacer { margin-left: auto; }

/* --------------------------------------------------------------------------
   15. Empty + loading states
   -------------------------------------------------------------------------- */
.admin-empty {
    text-align: center;
    padding: 3rem 1.5rem;
    border: 1px dashed var(--admin-border-strong);
    border-radius: var(--admin-radius);
    background: var(--admin-surface-alt);
}
.admin-empty-icon {
    width: 56px; height: 56px; margin: 0 auto var(--admin-space-4);
    display: flex; align-items: center; justify-content: center;
    border-radius: 50%;
    background: var(--admin-gold-soft);
    color: var(--admin-gold-deep);
    font-size: 1.4rem;
}
.admin-empty h3 { font-size: 1.05rem; margin-bottom: 0.35rem; }
.admin-empty p { color: var(--admin-text-muted); font-size: 0.9rem; max-width: 30rem; margin: 0 auto var(--admin-space-4); }

.admin-skeleton {
    background: linear-gradient(90deg, var(--admin-surface-alt) 25%, #F2ECE1 37%, var(--admin-surface-alt) 63%);
    background-size: 400% 100%;
    animation: admin-shimmer 1.4s ease infinite;
    border-radius: var(--admin-radius-sm);
    height: 1rem;
}
@keyframes admin-shimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

.admin-spinner {
    display: inline-block; width: 1.1rem; height: 1.1rem;
    border: 2px solid var(--admin-border-strong);
    border-right-color: var(--admin-navy);
    border-radius: 50%;
    animation: admin-spin 0.7s linear infinite;
}

/* --------------------------------------------------------------------------
   16. Stat / KPI cards
   -------------------------------------------------------------------------- */
.stat-card {
    background: var(--admin-surface);
    border: 1px solid var(--admin-border);
    border-radius: var(--admin-radius-lg);
    padding: var(--admin-space-4) var(--admin-space-5);
    box-shadow: var(--admin-shadow-xs);
    height: 100%;
    display: flex;
    align-items: center;
    gap: var(--admin-space-4);
    transition: transform var(--admin-transition), box-shadow var(--admin-transition), border-color var(--admin-transition);
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--admin-shadow); border-color: var(--admin-border-strong); }
.stat-icon {
    width: 46px; height: 46px; flex-shrink: 0;
    border-radius: var(--admin-radius);
    display: flex; align-items: center; justify-content: center;
    font-size: 1.15rem;
}
.stat-value { font-size: 1.6rem; font-weight: 800; color: var(--admin-heading); line-height: 1.1; }
.stat-label { font-size: 0.8rem; color: var(--admin-text-muted); font-weight: 600; }

/* Accent variants — the only four tints a KPI tile may use. */
.stat-icon-navy  { background: var(--admin-navy-soft);  color: var(--admin-navy); }
.stat-icon-gold  { background: var(--admin-gold-soft);  color: var(--admin-gold-deep); }
.stat-icon-teal  { background: var(--admin-teal-soft);  color: var(--admin-teal-deep); }
.stat-icon-coral { background: var(--admin-coral-soft); color: var(--admin-coral-deep); }

/* --------------------------------------------------------------------------
   17. Toasts
   -------------------------------------------------------------------------- */
.toast-stack {
    position: fixed; top: 76px; right: 20px; z-index: 1080;
    width: 340px; max-width: calc(100vw - 40px);
    display: flex; flex-direction: column; gap: 10px;
}
.app-toast {
    display: flex; align-items: flex-start; gap: 10px;
    background: var(--admin-surface);
    border: 1px solid var(--admin-border);
    border-left: 4px solid transparent;
    border-radius: var(--admin-radius);
    padding: 13px 15px;
    font-weight: 500;
    font-size: 0.9rem;
    color: var(--admin-text);
    box-shadow: var(--admin-shadow-md);
    opacity: 0;
    transform: translateX(24px);
    transition: opacity 0.25s ease, transform 0.25s ease;
}
.app-toast.show { opacity: 1; transform: translateX(0); }
.app-toast i { font-size: 1.1rem; margin-top: 1px; flex-shrink: 0; }
.app-toast span { flex: 1; line-height: 1.45; }
.app-toast-close {
    background: transparent; border: none; color: var(--admin-text-muted);
    font-size: 1.2rem; line-height: 1; padding: 0; cursor: pointer; flex-shrink: 0;
}
.app-toast-close:hover { color: var(--admin-heading); }
.app-toast-success { border-left-color: var(--admin-teal); }
.app-toast-success i { color: var(--admin-success); }
.app-toast-warning { border-left-color: var(--admin-gold); }
.app-toast-warning i { color: var(--admin-warning); }
.app-toast-error { border-left-color: var(--admin-coral); }
.app-toast-error i { color: var(--admin-danger); }

/* --------------------------------------------------------------------------
   18. Responsive
   -------------------------------------------------------------------------- */
@media (max-width: 991.98px) {
    .content { padding: var(--admin-space-4); }
}

@media (max-width: 768px) {
    .sidebar { left: calc(-1 * var(--admin-sidebar-w)); }
    .sidebar.active { left: 0; box-shadow: var(--admin-shadow-lg); }
    .content { margin-left: 0; padding: var(--admin-space-4) var(--admin-space-3); }
    footer.admin-footer { margin-left: 0; }
    .page-head { flex-direction: column; align-items: stretch; }
    .page-head-actions { width: 100%; }
    .page-head-actions .btn { flex: 1 1 auto; }
    .sidebar-overlay {
        display: none;
        position: fixed; top: var(--admin-header-h); left: 0; right: 0; bottom: 0;
        background: rgba(20, 24, 56, 0.45);
        z-index: 1020;
    }
    .sidebar-overlay.active { display: block; }
    .content .table thead th, .content .table tbody td { padding: 10px; }
}

@media (max-width: 576px) {
    div.dataTables_wrapper div.dataTables_length,
    div.dataTables_wrapper div.dataTables_filter { float: none; text-align: left !important; }
    div.dataTables_wrapper div.dataTables_filter { margin-top: 0.5rem; }
    .toast-stack { top: 72px; right: 12px; left: 12px; width: auto; }
    .modal-body { padding: var(--admin-space-4); }
    .admin-toolbar { padding: var(--admin-space-3); }
    .admin-toolbar .admin-search { max-width: none; }
}

/* Desktop: the toggle collapses the sidebar rather than showing it off-canvas */
@media (min-width: 769px) {
    .sidebar.active { left: calc(-1 * var(--admin-sidebar-w)); }
    .content.active { margin-left: 0; }
    footer.admin-footer.active { margin-left: 0; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
    .stat-card:hover { transform: none; }
    .btn:active { transform: none; }
}

/* Utility */
.text-navy { color: var(--admin-navy) !important; }
.text-gold { color: var(--admin-gold-deep) !important; }
.text-teal { color: var(--admin-teal-deep) !important; }
.text-coral { color: var(--admin-coral-deep) !important; }
.bg-navy-soft { background: var(--admin-navy-soft) !important; }
.visually-hidden-focusable:not(:focus):not(:focus-within) { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* --------------------------------------------------------------------------
   19. Dashboard
   Was a per-page <style> block that redefined .stat-card/.stat-icon on top of
   the shared ones. Only the genuinely dashboard-specific chrome lives here.
   -------------------------------------------------------------------------- */
.stat-card { text-decoration: none; }
.stat-card .stat-body { min-width: 0; flex: 1 1 auto; }
.stat-card .stat-number { font-size: 1.45rem; font-weight: 800; color: var(--admin-heading); line-height: 1.1; }
.stat-card .stat-label {
    font-size: 0.72rem; color: var(--admin-text-muted); font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.02em; margin-top: 3px;
    /* overflow-wrap: break-word breaks INSIDE a word once it no longer fits,
       which is what produced "TESTIMONI ALS", "ADMISSION S" and "SUBSCRIBE RS"
       on the dashboard: six cards across leaves ~100px of label width and
       "TESTIMONIALS" needs ~91px at the old 0.05em tracking, so it sat right on
       the boundary. Wrap at spaces only -- these are one- or two-word labels,
       so there is nothing legitimate to break mid-word -- and the tighter
       tracking buys back the few pixels that caused the overflow. */
    white-space: normal; overflow-wrap: normal; word-break: keep-all;
}

.dash-card {
    border-radius: var(--admin-radius-lg);
    border: 1px solid var(--admin-border);
    background: var(--admin-surface);
    box-shadow: var(--admin-shadow-xs);
    overflow: hidden;
}
.dash-card-header {
    display: flex; align-items: center; justify-content: space-between; gap: var(--admin-space-3);
    padding: 16px 20px;
    border-bottom: 1px solid var(--admin-border);
    background: var(--admin-surface);
}
.dash-card-header h6 { color: var(--admin-heading); }
.dash-card-link { font-size: 0.82rem; font-weight: 700; color: var(--admin-navy); text-decoration: none; }
.dash-card-link:hover { color: var(--admin-navy-light); text-decoration: underline; }

.legend-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex-shrink: 0; }

.dash-table thead th {
    background: var(--admin-surface-alt);
    color: var(--admin-text-muted);
    font-size: 0.74rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 700;
    border-bottom: 1px solid var(--admin-border);
    padding: 12px 20px;
}
.dash-table td { padding: 12px 20px; border-color: var(--admin-border); }
/* Fixed layout so the declared <th> widths are actually honoured — without it
   a long email lets the Contact column swallow the row and squeeze the rest. */
.dash-table { table-layout: fixed; }
/* Long names/emails/cities ellipsize instead of wrapping into a second line
   and making rows uneven. Full value stays available via the title attribute. */
.dash-cell-truncate {
    display: block;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.dash-contact-link { color: inherit; text-decoration: none; }
.dash-contact-link:hover, .dash-contact-link:focus-visible { color: var(--admin-navy); text-decoration: underline; }
.avatar-initial {
    width: 34px; height: 34px; border-radius: 50%;
    background: var(--admin-navy);
    color: #fff; font-weight: 700; font-size: 0.85rem;
    display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}

/* --------------------------------------------------------------------------
   20. Auth screens (login / forgot / reset / change password)
   These are standalone documents outside the admin shell. They previously
   carried five different palettes — orange, three Bootstrap blue→purple
   gradients and a lone violet. One component now covers all of them.
   -------------------------------------------------------------------------- */
body.admin-auth {
    padding-top: 0;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--admin-navy);
    background-image:
        radial-gradient(circle at 15% 15%, rgba(248, 170, 28, 0.16) 0%, rgba(248, 170, 28, 0) 45%),
        radial-gradient(circle at 85% 85%, rgba(44, 191, 193, 0.14) 0%, rgba(44, 191, 193, 0) 45%),
        linear-gradient(135deg, var(--admin-navy) 0%, var(--admin-navy-darker) 100%);
    padding: var(--admin-space-5) var(--admin-space-4);
}
body.admin-auth .card {
    border: none;
    border-radius: var(--admin-radius-lg);
    overflow: hidden;
    box-shadow: var(--admin-shadow-lg);
    background: var(--admin-surface);
}
body.admin-auth .logo-section {
    background: var(--admin-navy);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    padding: 2rem;
    text-align: center;
}
body.admin-auth .logo-section img { max-width: 120px; margin-bottom: 1rem; }
body.admin-auth .logo-section h1,
body.admin-auth .logo-section h2,
body.admin-auth .logo-section h3,
body.admin-auth .logo-section h4,
body.admin-auth .logo-section h5 { color: #fff; }
body.admin-auth .logo-section p { color: rgba(255, 255, 255, 0.75); }
body.admin-auth .form-section { padding: 2rem; }
body.admin-auth .form-section h1,
body.admin-auth .form-section h2,
body.admin-auth .form-section h3,
body.admin-auth .form-section h4 { color: var(--admin-heading); margin-bottom: 0.35rem; }
/* The auth CTA is the one gold button in the panel's entry flow. */
body.admin-auth .btn-primary {
    background: var(--admin-gold);
    border-color: var(--admin-gold);
    color: var(--admin-navy);
    border-radius: var(--admin-radius-pill);
    font-weight: 700;
    padding: 0.6rem 1.5rem;
}
body.admin-auth .btn-primary:hover:not(:disabled) {
    background: var(--admin-gold-hover);
    border-color: var(--admin-gold-hover);
    color: var(--admin-navy);
}
body.admin-auth a { color: var(--admin-navy); font-weight: 600; }
body.admin-auth a:hover { color: var(--admin-gold-deep); }

/* --------------------------------------------------------------------------
   21. Bootstrap background-utility overrides
   .bg-primary/.bg-dark etc. are !important in Bootstrap, so they beat the
   component rules above. Remap them onto the palette as a safety net for any
   markup that still reaches for them.
   -------------------------------------------------------------------------- */
.bg-primary { background-color: var(--admin-navy) !important; }
.bg-dark { background-color: var(--admin-charcoal) !important; }
.bg-light { background-color: var(--admin-surface-alt) !important; }
.bg-secondary { background-color: var(--admin-text-muted) !important; }
.text-primary { color: var(--admin-navy) !important; }
.text-success { color: var(--admin-success) !important; }
.text-warning { color: var(--admin-warning) !important; }
.text-info { color: var(--admin-teal-deep) !important; }
/* .badge.bg-* is remapped to soft tints in §10; keep .text-dark legible on those. */
.badge.text-dark { color: var(--admin-heading) !important; }
