/*
 * Abosoo Core admin theme — a visual pass over stock AdminLTE 3,
 * not a replacement framework. Loaded globally via the "Theme"
 * plugin block in config/adminlte.php.
 *
 * Structure:
 *   1. Design tokens (CSS variables)
 *   2. Base overrides (page bg, cards, tables)
 *   3. Semantic badge system (+ compatibility mapping for the
 *      existing badge-success/danger/... classes already used
 *      across ~48 views, so they pick up the new look for free)
 *   4. Stat cards, section cards, page header, avatars
 *   5. Table action buttons
 *   6. Pagination (matches resources/views/vendor/pagination/custom.blade.php)
 *   7. Forms — labels, inputs, selects (create/edit pages weren't
 *      touched by the index-page component rollout; this brings
 *      every form along for free without editing each _form.blade.php;
 *      also holds the permission catalog/grid styles, unnumbered)
 *   10. Record lists — row-per-record card bodies (HR Setup's
 *       reference lists, an employee's Education/Next of Kin/
 *       Training/Appraisals/Salary History)
 *   11. Messages navbar bell
 */

:root {
    --ui-bg: #eef1f6;
    --ui-card-bg: #ffffff;
    --ui-border: #e5e9f0;
    --ui-input-border: #c7cedb;
    --ui-radius: 10px;
    --ui-radius-sm: 6px;
    --ui-shadow: 0 4px 10px rgba(16, 24, 40, 0.08), 0 1px 3px rgba(16, 24, 40, 0.06);
    --ui-shadow-hover: 0 8px 20px rgba(16, 24, 40, 0.12), 0 2px 5px rgba(16, 24, 40, 0.08);

    --ui-text: #1f2937;
    --ui-text-muted: #6b7280;
    --ui-text-faint: #9aa3b2;

    /* Sampled from the Abosoo Core mark itself, not chosen freehand. */
    --ui-primary: #0e4d40;
    --ui-primary-hover: #0c4238;
    --ui-primary-dark: #073a31;
    --ui-primary-bg: #e6f0ed;
    --ui-primary-ring: rgba(14, 77, 64, 0.35);

    /* The mark's second color (the coins) — used for the one or two
       spots that should pop against the green rather than blend
       into it: the active sidebar item, a couple of small accents.
       Not a general-purpose button color — too low-contrast for body
       text and too close to the existing warning-orange to double as
       another semantic hue. */
    --ui-gold: #dca636;
    --ui-gold-dark: #b07e22;
    --ui-gold-bg: #fbf1dc;

    --ui-blue-bg: #eaf1ff;   --ui-blue-fg: #2f6fed;
    --ui-green-bg: #e8f8ef;  --ui-green-fg: #1a9d5c;
    --ui-orange-bg: #fff4e5; --ui-orange-fg: #b8720a;
    --ui-red-bg: #fdeaea;    --ui-red-fg: #d5304f;
    --ui-purple-bg: #f2ecfc; --ui-purple-fg: #7c4fd1;
    --ui-gray-bg: #eef0f3;   --ui-gray-fg: #5b6472;
}

/* ---------- 2. Base overrides ---------- */

.content-wrapper {
    background-color: var(--ui-bg);
}

.content-header h1 {
    color: var(--ui-text);
    font-weight: 700;
}

.card {
    border-radius: var(--ui-radius);
    border: 1px solid var(--ui-border);
    box-shadow: var(--ui-shadow);
    transition: box-shadow 0.15s ease, transform 0.15s ease;
}

/*
 * AdminLTE's card-outline + card-{color} combo paints a colored
 * top border (e.g. card-outline card-primary → blue top edge).
 * Neutralized system-wide — every card gets the same plain border,
 * regardless of which contextual color class is still present in
 * the markup.
 */
.card.card-outline,
.card[class*="card-outline-"] {
    border-top-width: 1px !important;
    border-top-color: var(--ui-border) !important;
}

.card-header {
    border-top-left-radius: var(--ui-radius) !important;
    border-top-right-radius: var(--ui-radius) !important;
    background-color: transparent;
}

/*
 * Global button restyle — every plain Bootstrap .btn across the app
 * (page headers, show-page action rows, forms, modals) picks this
 * up automatically, not just the hand-converted table-row actions
 * above. Contextual colors (btn-primary/success/danger/...) are
 * left alone; only shape/weight/motion change.
 */
.btn {
    border-radius: var(--ui-radius-sm);
    font-weight: 600;
    font-size: 0.85rem;
    border-width: 1px;
    box-shadow: none;
    transition: filter 0.12s ease, transform 0.05s ease;
}
.btn:not(.btn-link):hover {
    filter: brightness(0.94);
}
.btn:not(.btn-link):active {
    transform: translateY(1px);
}
.btn-sm, .btn-xs {
    border-radius: var(--ui-radius-sm);
    font-weight: 600;
}

.table thead th {
    text-transform: uppercase;
    font-size: 0.72rem;
    letter-spacing: 0.04em;
    color: var(--ui-text-muted);
    font-weight: 700;
    border-bottom: 2px solid var(--ui-border);
    white-space: nowrap;
}

.table td {
    vertical-align: middle;
    color: var(--ui-text);
}

.table-hover tbody tr:hover {
    background-color: #f8faff;
}

/*
 * AdminLTE renders alerts as solid, fully-saturated blocks
 * (bg-warning-strength orange, etc.) rather than Bootstrap's
 * muted pastel alert-* variants — softened here to match the
 * rest of the palette instead of clashing with it.
 */
.alert {
    border: none;
    border-radius: var(--ui-radius-sm);
    font-weight: 500;
}
.alert-success { background: var(--ui-green-bg);  color: #146c43; }
.alert-danger  { background: var(--ui-red-bg);    color: #9a1c34; }
.alert-warning { background: var(--ui-orange-bg); color: #92590a; }
.alert-info    { background: var(--ui-blue-bg);   color: #1848a0; }

/*
 * AdminLTE's stock .alert a{color:#fff} assumes solid, saturated
 * alert backgrounds — invisible against the soft pastel ones above.
 * Inheriting the alert's own text color keeps a link readable in
 * every variant automatically, with underline+weight as the only
 * visual cue distinguishing it from surrounding text.
 */
.alert a {
    color: inherit;
    text-decoration: underline;
    font-weight: 600;
}

/* ---------- 3. Semantic badges ---------- */

.badge, .ui-badge {
    font-weight: 600;
    font-size: 0.72rem;
    padding: 0.35em 0.7em;
    border-radius: 999px;
    letter-spacing: 0.01em;
}

.ui-badge-blue   { background: var(--ui-blue-bg);   color: var(--ui-blue-fg); }
.ui-badge-green  { background: var(--ui-green-bg);  color: var(--ui-green-fg); }
.ui-badge-orange { background: var(--ui-orange-bg); color: var(--ui-orange-fg); }
.ui-badge-red    { background: var(--ui-red-bg);    color: var(--ui-red-fg); }
.ui-badge-purple { background: var(--ui-purple-bg); color: var(--ui-purple-fg); }
.ui-badge-gray   { background: var(--ui-gray-bg);   color: var(--ui-gray-fg); }

/*
 * Compatibility mapping — every existing badge-success/danger/...
 * usage across the app (182 occurrences, 48 files as of the audit)
 * picks up the same pill look automatically, with zero per-file
 * changes. New code should prefer <x-ui.badge variant="..."> going
 * forward; this mapping exists so the old classes aren't visually
 * stuck in stock-Bootstrap style while migration happens gradually.
 */
.badge-success  { background: var(--ui-green-bg)  !important; color: var(--ui-green-fg)  !important; }
.badge-danger   { background: var(--ui-red-bg)    !important; color: var(--ui-red-fg)    !important; }
.badge-warning  { background: var(--ui-orange-bg) !important; color: var(--ui-orange-fg) !important; }
.badge-info     { background: var(--ui-blue-bg)    !important; color: var(--ui-blue-fg)    !important; }
.badge-primary  { background: var(--ui-primary-bg) !important; color: var(--ui-primary)    !important; }
.badge-secondary{ background: var(--ui-gray-bg)   !important; color: var(--ui-gray-fg)   !important; }
.badge-light    { background: var(--ui-gray-bg)   !important; color: var(--ui-gray-fg)   !important; }
.badge-dark     { background: var(--ui-gray-bg)   !important; color: var(--ui-text)      !important; }

/* ---------- 4. Stat cards, section cards, page header, avatars ---------- */

.ui-stat-card {
    background: var(--ui-card-bg);
    border: 1px solid var(--ui-border);
    border-radius: var(--ui-radius);
    box-shadow: var(--ui-shadow);
    transition: box-shadow 0.15s ease, transform 0.15s ease;
    padding: 1.35rem 1.5rem;
    position: relative;
    overflow: hidden;
    height: 100%;
    min-height: 108px;
}

.ui-stat-card:hover {
    box-shadow: var(--ui-shadow-hover);
    transform: translateY(-2px);
}

.ui-stat-card__label {
    text-transform: uppercase;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    color: var(--ui-text-muted);
    display: block;
    margin-bottom: 0.5rem;
}

.ui-stat-card__value {
    font-size: 1.9rem;
    font-weight: 800;
    color: var(--ui-text);
    line-height: 1.1;
    display: block;
}

.ui-stat-card__icon {
    position: absolute;
    right: 1.1rem;
    top: 1.2rem;
    font-size: 1.9rem;
    opacity: 0.24;
}

.ui-stat-card--blue .ui-stat-card__value,
.ui-stat-card--blue .ui-stat-card__icon { color: var(--ui-blue-fg); }
.ui-stat-card--green .ui-stat-card__value,
.ui-stat-card--green .ui-stat-card__icon { color: var(--ui-green-fg); }
.ui-stat-card--orange .ui-stat-card__value,
.ui-stat-card--orange .ui-stat-card__icon { color: var(--ui-orange-fg); }
.ui-stat-card--red .ui-stat-card__value,
.ui-stat-card--red .ui-stat-card__icon { color: var(--ui-red-fg); }
.ui-stat-card--purple .ui-stat-card__value,
.ui-stat-card--purple .ui-stat-card__icon { color: var(--ui-purple-fg); }

.ui-section-eyebrow {
    text-transform: uppercase;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    color: var(--ui-text-faint);
    margin: 1.25rem 0 0.6rem;
}
.ui-section-eyebrow:first-child { margin-top: 0; }

.ui-section-card {
    background: var(--ui-card-bg);
    border: 1px solid var(--ui-border);
    border-radius: var(--ui-radius);
    box-shadow: var(--ui-shadow);
    margin-bottom: 1.25rem;
    overflow: hidden;
}

.ui-section-card__header {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.9rem 1.1rem;
    border-bottom: 2px solid var(--ui-border);
}

.ui-section-card__header-icon {
    width: 28px;
    height: 28px;
    border-radius: 7px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    flex-shrink: 0;
}

.ui-section-card__title {
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--ui-text);
    margin: 0;
}

.ui-section-card__body {
    padding: 1.1rem;
}

.ui-page-header {
    background: var(--ui-card-bg);
    border: 1px solid var(--ui-border);
    border-radius: var(--ui-radius);
    box-shadow: var(--ui-shadow);
    padding: 1rem 1.25rem;
    margin-bottom: 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.ui-page-header__icon {
    width: 42px;
    height: 42px;
    border-radius: 9px;
    background: var(--ui-blue-bg);
    color: var(--ui-blue-fg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.ui-page-header__title {
    font-weight: 700;
    font-size: 1rem;
    color: var(--ui-text);
    margin: 0;
}

.ui-page-header__subtitle {
    font-size: 0.82rem;
    color: var(--ui-text-muted);
}

.ui-page-header__actions {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex-wrap: wrap;
    margin-left: auto;
}

.ui-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.85rem;
    color: #fff;
    flex-shrink: 0;
}

/* ---------- 5. Table action buttons ---------- */

.ui-icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: var(--ui-radius-sm);
    border: none;
    font-size: 0.85rem;
    color: #fff;
    text-decoration: none;
    cursor: pointer;
    transition: filter 0.12s ease;
}
.ui-icon-btn:hover,
.ui-icon-btn:focus { filter: brightness(0.92); color: #fff; text-decoration: none; }

.ui-icon-btn-view   { background: #4b5563; }
.ui-icon-btn-edit   { background: #ea9a2c; }
.ui-icon-btn-toggle { background: #d7dce2; color: #4b5563; }

/*
 * A table row's action controls are rarely all the same tag — a
 * plain <a> for "view", a <button> for a modal trigger, a <form>
 * wrapping a submit button for a direct POST. Mixed inline elements
 * like that rely on each browser's own baseline/vertical-align
 * behavior to land on the same line, which is exactly the kind of
 * thing that looks fine in one browser and drifts a couple of
 * pixels in another. Flex with a fixed gap sidesteps the whole
 * problem — every child centers on the same line no matter what
 * tag it is, with deliberate spacing instead of incidental
 * whitespace between inline elements.
 */
.ui-row-actions {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}
.ui-row-actions form {
    display: inline-flex;
    margin: 0;
}
.ui-icon-btn-delete { background: #e0384a; }

.ui-btn-view {
    display: inline-block;
    background: var(--ui-primary);
    color: #fff;
    border-radius: 999px;
    padding: 0.3rem 1rem;
    font-size: 0.82rem;
    font-weight: 600;
    border: none;
    text-decoration: none;
    cursor: pointer;
}
.ui-btn-view:hover,
.ui-btn-view:focus { background: var(--ui-primary-dark); color: #fff; text-decoration: none; }

/* ---------- 6. Pagination ---------- */

.ui-pagination-info {
    color: var(--ui-text-muted);
    font-size: 0.85rem;
}

.pagination {
    gap: 0.25rem;
}

.pagination .page-link {
    border-radius: var(--ui-radius-sm) !important;
    border: 1px solid var(--ui-border);
    color: var(--ui-text);
    margin: 0;
    font-weight: 600;
    font-size: 0.85rem;
}

.pagination .page-item.active .page-link {
    background: var(--ui-primary);
    border-color: var(--ui-primary);
    color: #fff;
}

.pagination .page-item.disabled .page-link {
    color: var(--ui-text-faint);
}

/* ---------- 7a. User menu (navbar trigger + dropdown) ---------- */

.ui-usermenu-trigger {
    display: flex !important;
    align-items: center;
    gap: 0.55rem;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
}

.ui-usermenu-trigger__avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--ui-primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.85rem;
    flex-shrink: 0;
}

.ui-usermenu-trigger__name {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--ui-text);
}

.ui-usermenu-trigger__role {
    font-size: 0.68rem;
    color: var(--ui-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.ui-usermenu-panel {
    width: 300px;
    padding: 0 !important;
    border: none;
    border-radius: var(--ui-radius);
    box-shadow: var(--ui-shadow-hover);
    overflow: hidden;
}

.ui-usermenu-header {
    background: linear-gradient(135deg, var(--ui-primary) 0%, var(--ui-primary-dark) 100%);
    padding: 1.25rem 1.1rem;
    display: flex;
    align-items: center;
    gap: 0.85rem;
}

.ui-usermenu-header__avatar {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.18);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.3rem;
    flex-shrink: 0;
    border: 2px solid rgba(255, 255, 255, 0.35);
}

.ui-usermenu-header__name {
    color: #fff;
    font-weight: 700;
    font-size: 0.95rem;
    margin: 0;
    line-height: 1.3;
}

.ui-usermenu-header__email {
    color: rgba(255, 255, 255, 0.82);
    font-size: 0.78rem;
    margin: 0;
}

.ui-usermenu-body {
    padding: 0.5rem;
}

.ui-usermenu-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0.65rem;
    border-radius: var(--ui-radius-sm);
    color: var(--ui-text);
    font-weight: 600;
    font-size: 0.86rem;
    text-decoration: none;
    background: transparent;
    border: none;
    width: 100%;
    text-align: left;
    cursor: pointer;
}

.ui-usermenu-item:hover,
.ui-usermenu-item:focus {
    background: var(--ui-bg);
    color: var(--ui-text);
    text-decoration: none;
}

.ui-usermenu-item__icon {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.82rem;
    flex-shrink: 0;
}

.ui-usermenu-item--danger {
    color: var(--ui-red-fg);
}

/* ---------- 7. Forms ---------- */

.form-group label:not(.form-check-label),
.form-group > strong {
    text-transform: uppercase;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    color: var(--ui-text-muted);
    margin-bottom: 0.4rem;
    display: inline-block;
}

.form-check-label {
    color: var(--ui-text);
    font-size: 0.88rem;
}

.form-control,
.custom-select {
    border: 1px solid var(--ui-input-border);
    border-radius: var(--ui-radius-sm);
    color: var(--ui-text);
    font-size: 0.88rem;
    padding: 0.5rem 0.75rem;
    height: auto;
    background-color: var(--ui-card-bg);
    transition: border-color 0.12s ease, box-shadow 0.12s ease;
}

.form-control:focus,
.custom-select:focus {
    border-color: var(--ui-primary);
    box-shadow: 0 0 0 3px var(--ui-primary-bg);
}

.form-control::placeholder {
    color: var(--ui-text-faint);
}

.form-text {
    font-size: 0.78rem;
}

.card-body h5 {
    text-transform: uppercase;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    color: var(--ui-text-faint);
    margin-bottom: 1rem;
}

/*
 * Neutralize the browser's own autofill styling (Chrome/Edge paint
 * autofilled fields with a yellow-tinted background and can shift
 * perceived text color) so a pre-filled edit form never looks
 * different from a freshly-typed one.
 */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus {
    -webkit-text-fill-color: var(--ui-text);
    box-shadow: 0 0 0 1000px var(--ui-card-bg) inset;
    transition: background-color 9999s ease-in-out 0s;
}

/*
 * ---------- 8. Bootstrap "primary" overrides ----------
 *
 * AdminLTE/Bootstrap ship precompiled CSS with #007bff baked
 * directly into every .btn-primary/.badge-primary/etc. rule (not a
 * CSS custom property Bootstrap itself reads), so retinting the
 * --ui-primary token above doesn't reach them on its own. This
 * section re-points the specific Bootstrap classes this app actually
 * uses in views (117 .btn-primary usages alone) at the same brand
 * green, so "primary" means one consistent color everywhere rather
 * than green in custom .ui-* components and blue in raw Bootstrap
 * ones sitting right next to each other.
 */

.btn-primary {
    color: #fff;
    background-color: var(--ui-primary);
    border-color: var(--ui-primary);
}

.btn-primary:hover {
    color: #fff;
    background-color: var(--ui-primary-hover);
    border-color: var(--ui-primary-hover);
}

.btn-primary:focus,
.btn-primary.focus {
    color: #fff;
    background-color: var(--ui-primary-hover);
    border-color: var(--ui-primary-hover);
    box-shadow: 0 0 0 3px var(--ui-primary-ring);
}

.btn-primary.disabled,
.btn-primary:disabled {
    color: #fff;
    background-color: var(--ui-primary);
    border-color: var(--ui-primary);
}

.btn-primary:not(:disabled):not(.disabled):active,
.btn-primary:not(:disabled):not(.disabled).active,
.show > .btn-primary.dropdown-toggle {
    color: #fff;
    background-color: var(--ui-primary-dark);
    border-color: var(--ui-primary-dark);
}

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

.btn-outline-primary:hover {
    color: #fff;
    background-color: var(--ui-primary);
    border-color: var(--ui-primary);
}

.btn-outline-primary:focus,
.btn-outline-primary.focus {
    box-shadow: 0 0 0 3px var(--ui-primary-ring);
}

.btn-outline-primary.disabled,
.btn-outline-primary:disabled {
    color: var(--ui-primary);
    background-color: transparent;
}

.btn-outline-primary:not(:disabled):not(.disabled):active,
.btn-outline-primary:not(:disabled):not(.disabled).active,
.show > .btn-outline-primary.dropdown-toggle {
    color: #fff;
    background-color: var(--ui-primary);
    border-color: var(--ui-primary);
}

.btn-link {
    color: var(--ui-primary);
}

.btn-link:hover {
    color: var(--ui-primary-dark);
}

.text-primary { color: var(--ui-primary) !important; }
.bg-primary   { background-color: var(--ui-primary) !important; }
.border-primary { border-color: var(--ui-primary) !important; }

.custom-control-input:checked ~ .custom-control-label::before {
    border-color: var(--ui-primary);
    background-color: var(--ui-primary);
}

.custom-control-input:focus ~ .custom-control-label::before {
    box-shadow: 0 0 0 3px var(--ui-primary-ring);
}

.dropdown-item.active,
.dropdown-item:active {
    color: #fff;
    background-color: var(--ui-primary);
}

/*
 * The active sidebar menu item — visible on every staff page. Gold,
 * not another shade of green: on a green sidebar, a green highlight
 * barely reads as "selected." Mirrors the mark itself, where the
 * coins are what pop against the green ring, not another green.
 */
.sidebar-dark-primary .nav-sidebar > .nav-item > .nav-link.active,
.sidebar-light-primary .nav-sidebar > .nav-item > .nav-link.active {
    background-color: var(--ui-gold);
    color: var(--ui-primary-dark);
}

.sidebar-dark-primary .nav-sidebar > .nav-item > .nav-link.active .nav-icon,
.sidebar-light-primary .nav-sidebar > .nav-item > .nav-link.active .nav-icon {
    color: var(--ui-primary-dark);
}

.sidebar-dark-primary .nav-sidebar.nav-legacy > .nav-item > .nav-link.active,
.sidebar-light-primary .nav-sidebar.nav-legacy > .nav-item > .nav-link.active {
    border-color: var(--ui-gold);
}

/* Select2's keyboard/hover-highlighted dropdown option. */
.select2-container--bootstrap4 .select2-results__option--highlighted,
.select2-container--bootstrap4 .select2-results__option--highlighted.select2-results__option[aria-selected="true"] {
    background-color: var(--ui-primary);
}

/*
 * The sidebar's own body background is a fixed neutral gray no
 * matter which "-primary/-danger/..." suffix classes_sidebar uses
 * (AdminLTE paints it via a wildcard [class*="sidebar-dark-"]
 * selector, unrelated to the primary accent color above) - without
 * this, the whole nav panel stayed AdminLTE's stock charcoal even
 * after every button/badge/highlight went green.
 */
[class*="sidebar-dark-"] {
    background-color: var(--ui-primary-dark);
}

/*
 * With the sidebar and navbar both fixed, AdminLTE's own
 * .layout-navbar-fixed .brand-link rule (more specific than the
 * wildcard above) repaints just the brand header back to stock gray
 * - only the header, leaving the rest of the panel green.
 */
.layout-navbar-fixed .wrapper .sidebar-dark-primary .brand-link:not([class*="navbar"]) {
    background-color: var(--ui-primary-dark);
}

/*
 * ---------- 9. Permission accordion (roles/_permission-checkboxes) ----------
 *
 * 63 modules / 157 permissions at last count — a plain grid of
 * always-expanded cards made the role form a very long scroll. Each
 * module collapses independently (not an exclusive single-panel
 * accordion — assigning a role usually means touching several
 * modules in one sitting), with a search box and a live count per
 * module so progress is visible without expanding everything.
 */

.ui-perm-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.ui-perm-search {
    position: relative;
    flex: 1 1 260px;
    max-width: 360px;
}

.ui-perm-search i {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--ui-text-faint);
    font-size: 0.85rem;
    pointer-events: none;
}

.ui-perm-search input {
    padding-left: 2.1rem;
}

.ui-perm-toolbar-actions {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-wrap: wrap;
}

.ui-perm-accordion {
    border: 1px solid var(--ui-border);
    border-radius: var(--ui-radius-sm);
    overflow: hidden;
}

.ui-perm-group {
    border-bottom: 1px solid var(--ui-border);
}

.ui-perm-group:last-child {
    border-bottom: none;
}

.ui-perm-group-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 1rem;
    cursor: pointer;
    background: var(--ui-card-bg);
    transition: background-color 0.12s ease;
}

.ui-perm-group-header:hover {
    background: var(--ui-bg);
}

.ui-perm-group-check {
    margin: 0;
    display: flex;
    align-items: center;
}

.ui-perm-group-check input {
    width: 1.05rem;
    height: 1.05rem;
    margin: 0;
}

.ui-perm-group-name {
    flex: 1 1 auto;
    font-weight: 600;
    font-size: 0.88rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--ui-text);
}

.ui-perm-group-count {
    font-size: 0.76rem;
    font-weight: 600;
    color: var(--ui-text-faint);
    background: var(--ui-gray-bg);
    border-radius: 999px;
    padding: 0.1rem 0.6rem;
    font-variant-numeric: tabular-nums;
}

.ui-perm-group-count--active {
    color: var(--ui-primary);
    background: var(--ui-primary-bg);
}

.ui-perm-group-chevron {
    color: var(--ui-text-faint);
    font-size: 0.8rem;
    transition: transform 0.15s ease;
}

.ui-perm-group-header[aria-expanded="true"] .ui-perm-group-chevron {
    transform: rotate(180deg);
}

.ui-perm-group-body .ui-perm-checkbox-grid {
    padding: 0.25rem 1rem 1rem 2.6rem;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 0.4rem 1rem;
}

.ui-perm-checkbox-grid .form-check {
    padding-left: 1.5rem;
}

/* Read-only catalog variant (permissions/index.blade.php) — a table
   instead of a checkbox grid, no per-group "select all" control. */
.ui-perm-group-body .table {
    margin: 0;
}

.ui-perm-group-body .table th,
.ui-perm-group-body .table td {
    padding: 0.5rem 1rem;
}

.ui-perm-no-results {
    padding: 1rem;
    text-align: center;
}

/* ---------- 10. Record lists ---------- */

/*
 * A scannable row-per-record list for inside a card body — replaces
 * the old `table table-sm` treatment (multiple fields crammed into
 * one <td>, actions always visible and cluttering the row) used
 * across HR Setup's reference lists and an employee's Education/
 * Next of Kin/Training/Appraisals/Salary History sections.
 */
.ui-list { border-top: 1px solid var(--ui-border); }

.ui-list-item {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.85rem 1.25rem;
    border-bottom: 1px solid var(--ui-border);
    transition: background-color 0.12s ease;
}
.ui-list-item:last-child { border-bottom: none; }
.ui-list-item:hover { background: var(--ui-bg); }

.ui-list-item__body { flex: 1 1 auto; min-width: 0; }
.ui-list-item__title { font-weight: 600; color: var(--ui-text); }
.ui-list-item__meta {
    font-size: 0.8rem;
    color: var(--ui-text-muted);
    margin-top: 0.15rem;
}

.ui-list-item__actions {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 0.35rem;
    opacity: 0;
    transition: opacity 0.12s ease;
}
.ui-list-item:hover .ui-list-item__actions,
.ui-list-item:focus-within .ui-list-item__actions { opacity: 1; }
@media (hover: none) {
    .ui-list-item__actions { opacity: 1; }
}

.ui-list-empty {
    text-align: center;
    padding: 2.25rem 1rem;
    color: var(--ui-text-faint);
}
.ui-list-empty i { font-size: 1.65rem; margin-bottom: 0.5rem; display: block; }
.ui-list-empty p { margin-bottom: 0.75rem; color: var(--ui-text-muted); }

.ui-list-scroll { max-height: 420px; overflow-y: auto; }

.ui-list-toolbar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.85rem 1.25rem;
    border-bottom: 1px solid var(--ui-border);
    flex-wrap: wrap;
}
.ui-list-search { position: relative; flex: 1 1 240px; min-width: 180px; }
.ui-list-search i {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--ui-text-faint);
    font-size: 0.8rem;
}
.ui-list-search input { padding-left: 2.1rem; }

.ui-list-no-matches { padding: 1rem; text-align: center; color: var(--ui-text-muted); }

/* Avatar background variants — same six hues as the badge system, so
   a record list's avatars and its status badges always read as the
   same palette. */
.ui-avatar-blue   { background: var(--ui-blue-fg); }
.ui-avatar-green  { background: var(--ui-green-fg); }
.ui-avatar-orange { background: var(--ui-orange-fg); }
.ui-avatar-red    { background: var(--ui-red-fg); }
.ui-avatar-purple { background: var(--ui-purple-fg); }
.ui-avatar-gray   { background: var(--ui-gray-fg); }
.ui-avatar-primary { background: var(--ui-primary); }
.ui-avatar-gold   { background: var(--ui-gold-dark); }

/* Server-side DataTables (see public/js/theme.js) — the vendored
   dataTables.bootstrap4 CSS handles the table/pagination look; this
   just lays out the info text + pagination footer and the
   processing spinner this app's dom string introduces. */
.ui-datatable-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
}
.ui-datatable-footer .dataTables_paginate { margin: 0 !important; }
.ui-datatable-footer .dataTables_info { color: var(--ui-text-muted); font-size: 0.85rem; padding: 0 !important; }

.ui-datatable-processing {
    position: relative;
    height: 0;
}
.ui-datatable-processing .dataTables_processing {
    position: absolute;
    top: 0.5rem;
    right: 1.25rem;
    left: auto;
    width: auto;
    margin: 0;
    padding: 0.25rem 0.75rem;
    background: var(--ui-primary-bg);
    color: var(--ui-primary);
    border-radius: var(--ui-radius-sm);
    font-size: 0.8rem;
    box-shadow: none;
}

/* ---------- 11. Messages navbar bell ---------- */

.ui-messages-badge {
    background-color: var(--ui-red-fg);
    color: #fff;
}
