/* ==== 29LT Zarid Serif (system default typeface) ==== */
/* Weights are declared as ranges so that 700/bold maps to SemiBold */
/* instead of synthesising or jumping to Black, and no weight in    */
/* the 100-900 span falls back to a system font.                    */
@font-face {
    font-family: '29LT Zarid Serif';
    src: url('/fonts/29LTZarid/29LTZaridSerif-ExtraLight.woff2') format('woff2'),
         url('/fonts/29LTZarid/29LTZaridSerif-ExtraLight.woff') format('woff'),
         url('/fonts/29LTZarid/29LTZaridSerif-ExtraLight.ttf') format('truetype');
    font-weight: 100 300;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: '29LT Zarid Serif';
    src: url('/fonts/29LTZarid/29LTZaridSerif-Regular.woff2') format('woff2'),
         url('/fonts/29LTZarid/29LTZaridSerif-Regular.woff') format('woff'),
         url('/fonts/29LTZarid/29LTZaridSerif-Regular.ttf') format('truetype');
    font-weight: 400 500;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: '29LT Zarid Serif';
    src: url('/fonts/29LTZarid/29LTZaridSerif-SemiBold.woff2') format('woff2'),
         url('/fonts/29LTZarid/29LTZaridSerif-SemiBold.woff') format('woff'),
         url('/fonts/29LTZarid/29LTZaridSerif-SemiBold.ttf') format('truetype');
    font-weight: 600 700;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: '29LT Zarid Serif';
    src: url('/fonts/29LTZarid/29LTZaridSerif-Black.woff2') format('woff2'),
         url('/fonts/29LTZarid/29LTZaridSerif-Black.woff') format('woff'),
         url('/fonts/29LTZarid/29LTZaridSerif-Black.ttf') format('truetype');
    font-weight: 800 900;
    font-style: normal;
    font-display: swap;
}

:root {
    /* ==== RF Brand Identity (from rf-logo) ==== */
    --brandBlue: #0054a6;
    --brandBlueDark: #003c78;
    --brandBlueDeep: #002a55;
    --brandBlueInk: #0b1f3a;
    --brandGold: #dbb968;
    --brandGoldDark: #bf9c47;
    --brandGoldText: #8a6b18;
    --brandGoldLight: #eddcb4;
    --brandGoldSoft: #faf4e6;
    --brandGrey: #b1b1ae;
    --brandGreySoft: #f0f0ee;

    /* ==== Semantic tokens (mapped to the brand) ==== */
    --primaryColor: #dbb968;
    --secondaryColor: #0054a6;
    --triaryColor: #003c78;
    --textColor: #0b1f3a;
    --blackColor: #002a55;
    --greyColor: #566273;
    --hoverColor: #e8f0fa;
    --lightBg: #f5f7fa;
    --whiteColor: #ffffff;
    --successColor: #1e8f63;
    --dangerColor: #c0392b;
    --warningColor: #dbb968;
    --infoColor: #2a7fbf;
    --borderColor: #e6eaf0;

    --borderRadius: 14px;
    --shadow: 0 4px 18px rgba(11, 31, 58, 0.07);
    --shadowHover: 0 12px 32px rgba(11, 31, 58, 0.13);
    --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);

    --fontFamily: '29LT Zarid Serif', 'Cairo', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    /* Bootstrap components read this token, so overriding it here keeps
       cards, modals, tables and form controls on the brand typeface. */
    --bs-body-font-family: var(--fontFamily);
}

/* Global Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--fontFamily);
    background-color: var(--lightBg);
    color: var(--textColor);
    direction: rtl;
    text-align: right;
    line-height: 1.6;
    overflow-x: hidden;
}

:where(a, button, input, select, textarea, [tabindex]):focus-visible {
    outline: 3px solid var(--brandBlue);
    outline-offset: 2px;
    box-shadow: none !important;
}

.sidebar :where(a, button, [tabindex]):focus-visible,
.mobile-topbar :where(a, button, [tabindex]):focus-visible {
    outline-color: var(--brandGold);
}

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

/* ========= Sidebar (Brand Navy + Gold) ========= */
.sidebar {
    --sidebarWidth: 264px;
    --bs-offcanvas-width: min(320px, 88vw);
    background: linear-gradient(180deg, var(--brandBlueDeep) 0%, var(--brandBlueInk) 100%);
    box-shadow: -2px 0 24px rgba(11, 31, 58, 0.18);
    position: fixed;
    top: 0;
    right: 0;
    z-index: 1045;
    width: var(--bs-offcanvas-width);
    height: 100dvh;
    padding-top: 0;
    overflow: hidden;
    color: var(--whiteColor);
    border-left: 1px solid rgba(219, 185, 104, 0.2);
}

.sidebar::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    background:
        radial-gradient(circle at 85% 8%, rgba(219, 185, 104, 0.16), transparent 45%),
        radial-gradient(circle at 10% 92%, rgba(0, 84, 166, 0.35), transparent 50%);
    pointer-events: none;
}

.sidebar-shell {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
}

.sidebar-mobile-header {
    min-height: 56px;
    padding: 0.65rem 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
    font-size: 1rem;
    font-weight: 700;
}

.sidebar-navigation {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 0 0 0.75rem;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.3) transparent;
}

.sidebar-navigation::-webkit-scrollbar {
    width: 6px;
}

.sidebar-navigation::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar-navigation::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.28);
    border-radius: 999px;
}

.sidebar-footer {
    flex: 0 0 auto;
    padding: 0.65rem 0 0.8rem;
    border-top: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(2, 27, 54, 0.36);
}

/* Brand block at the top of the sidebar */
.sidebar-brand {
    flex: 0 0 auto;
    padding: 1.1rem 1rem 1rem;
    text-align: center;
    border-bottom: 1px solid rgba(219, 185, 104, 0.22);
    margin-bottom: 1rem;
}

.sidebar-brand .brand-plate {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--whiteColor);
    border-radius: 16px;
    padding: 0.85rem 1.25rem;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
    border: 1px solid rgba(219, 185, 104, 0.5);
}

.sidebar-brand .brand-plate img {
    height: 52px;
    width: auto;
    display: block;
}

.sidebar-brand .brand-title {
    display: block;
    margin-top: 0.85rem;
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--whiteColor);
    letter-spacing: 0.3px;
}

.sidebar-brand .brand-subtitle {
    display: block;
    font-size: 0.75rem;
    color: var(--brandGold);
    font-weight: 600;
    letter-spacing: 0.5px;
}

.sidebar hr {
    border-color: rgba(255, 255, 255, 0.12);
    margin: 1.25rem 1rem;
}

.sidebar .nav-link {
    color: rgba(255, 255, 255, 0.82);
    min-height: 48px;
    padding: 0.65rem 1rem;
    margin: 0.15rem 0.75rem;
    border-radius: 10px;
    transition: var(--transition);
    font-weight: 500;
    font-size: 1rem;
    display: flex;
    align-items: center;
    gap: 0.7rem;
    position: relative;
}

/* Collapsible items wrap their icon and label in a span, so reproduce the
   same spacing used by regular sidebar links. */
.sidebar .nav-link > span:first-child {
    display: inline-flex;
    align-items: center;
    gap: 0.7rem;
    min-width: 0;
}

.sidebar .nav-link > .bi-chevron-down {
    flex: 0 0 auto;
    margin-right: auto;
}

.sidebar .nav-link:hover {
    color: var(--whiteColor);
    background: rgba(255, 255, 255, 0.08);
}

.sidebar .nav-link.active {
    background: linear-gradient(90deg, rgba(0, 84, 166, 0.95), rgba(0, 60, 120, 0.65));
    color: var(--whiteColor);
    box-shadow: inset 0 0 0 1px rgba(219, 185, 104, 0.35);
}

.sidebar .nav-link.active::after {
    content: '';
    position: absolute;
    right: -0.5rem;
    top: 20%;
    height: 60%;
    width: 3px;
    border-radius: 3px;
    background: var(--brandGold);
}

.sidebar .nav-link i {
    font-size: 1.25rem;
    width: 24px;
    text-align: center;
    color: var(--brandGold);
}

.sidebar .nav-link.active i,
.sidebar .nav-link:hover i {
    color: var(--brandGoldLight);
}

.sidebar .nav-link .badge {
    margin-right: auto;
    margin-left: 0;
    padding: 0.3rem 0.6rem;
    font-weight: 600;
    border-radius: 20px;
}

.sidebar .submenu .nav-link i {
    font-size: 1.125rem;
}

.submenu {
    padding-right: 1.25rem;
    border-right: 1px solid rgba(219, 185, 104, 0.35);
    margin-right: 1.6rem;
    margin-top: 0.15rem;
}

.submenu .nav-link {
    min-height: 44px;
    font-size: 0.9375rem;
    padding: 0.55rem 0.75rem;
    margin: 0.1rem 0;
}

.nav-link[aria-expanded="true"] .bi-chevron-down {
    transform: rotate(180deg);
}

.bi-chevron-down {
    transition: transform 0.2s ease;
}

/* The submenu already has a gold rail, so skip the per-item marker */
.sidebar .submenu .nav-link.active::after {
    display: none;
}

.sidebar .btn-link {
    text-decoration: none;
}

/* Main Content Area */
.app-main {
    display: flex;
    flex-direction: column;
    width: 100%;
    margin-right: 0;
    padding: 1.1rem;
    min-height: 100vh;
    background: var(--lightBg);
}

/* Top Header Bar */
.border-bottom {
    border-bottom: 2px solid var(--hoverColor) !important;
    padding-bottom: 1.5rem !important;
    margin-bottom: 2rem !important;
}

.h2 {
    font-weight: 700;
    color: var(--textColor);
    font-size: 1.75rem;
}

/* ========= Page header ========= */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    background: var(--whiteColor);
    border: 1px solid var(--borderColor);
    border-radius: var(--borderRadius);
    min-height: 76px;
    padding: 0.85rem 1.5rem;
    margin-bottom: 1.75rem;
    box-shadow: var(--shadow);
    position: sticky;
    top: 1rem;
    z-index: 900;
    overflow: visible;
}

.page-header::before {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    right: 0;
    width: 5px;
    background: linear-gradient(180deg, var(--brandGold), var(--brandBlue));
}

.page-header .page-title {
    font-weight: 700;
    color: var(--textColor);
    font-size: 1.5rem;
    margin: 0;
}

.page-header .page-subtitle {
    color: var(--greyColor);
    font-size: 0.9375rem;
    margin: 0.15rem 0 0;
}

/* Section heading */
.section-title {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-weight: 700;
    color: var(--textColor);
    font-size: 1.1rem;
    margin-bottom: 1rem;
}

.section-title::before {
    content: '';
    width: 4px;
    height: 20px;
    border-radius: 4px;
    background: var(--brandGold);
}

/* Table cells (or parts of them) holding only a date, number or code, marked by the layout's script */
.table .cell-nowrap {
    white-space: nowrap;
}

/* ========= Cards ========= */
.card {
    border: 1px solid var(--borderColor);
    border-radius: var(--borderRadius);
    box-shadow: var(--shadow);
    margin-bottom: 1.5rem;
    transition: var(--transition);
    overflow: hidden;
    background: var(--whiteColor);
}

.card:hover {
    box-shadow: var(--shadowHover);
}

.card-header {
    background: var(--whiteColor);
    border-bottom: 1px solid var(--borderColor);
    padding: 1.1rem 1.5rem;
    font-weight: 600;
}

.card-header h5, .card-header h6 {
    color: var(--textColor);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.card-header i {
    color: var(--brandGoldText);
}

.card-body {
    padding: 1.5rem;
}

/* ========= Statistics cards ========= */
.card-stat {
    --statColor: var(--brandBlue);
    --statSoft: var(--hoverColor);
    border: 1px solid var(--borderColor);
    border-radius: var(--borderRadius);
    background: var(--whiteColor);
    position: relative;
    overflow: hidden;
}

.card-stat::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    left: 0;
    height: 4px;
    background: var(--statColor);
}

.card-stat:hover {
    transform: translateY(-3px);
}

.card-stat .card-body {
    padding: 1.35rem 1.5rem;
}

.card-stat .stat-label {
    color: var(--greyColor);
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 0.35rem;
}

.card-stat .stat-value {
    font-size: 2rem;
    font-weight: 700;
    line-height: 1.1;
    color: var(--statColor);
    margin: 0;
}

.card-stat .stat-unit {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--greyColor);
    margin-right: 0.25rem;
}

.card-stat .stat-icon {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--statSoft);
    color: var(--statColor);
    font-size: 1.5rem;
    flex-shrink: 0;
}

.card-stat .stat-link {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    margin-top: 1rem;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--statColor);
    text-decoration: none;
}

.card-stat .stat-link:hover {
    gap: 0.6rem;
    color: var(--brandBlueDark);
}

.stat-blue   { --statColor: var(--brandBlue);      --statSoft: #e8f0fa; }
.stat-navy   { --statColor: var(--brandBlueDark);  --statSoft: #e5ebf3; }
.stat-gold   { --statColor: var(--brandGoldText);  --statSoft: var(--brandGoldSoft); }
.stat-green  { --statColor: var(--successColor);   --statSoft: #e4f4ed; }
.stat-red    { --statColor: var(--dangerColor);    --statSoft: #fbeae8; }
.stat-grey   { --statColor: #7c7c78;               --statSoft: var(--brandGreySoft); }
.stat-teal   { --statColor: #17788c;               --statSoft: #e3f2f5; }

/* ========= Internal systems quick links ========= */
.card-systems .card-header {
    background: linear-gradient(90deg, var(--brandBlueDeep) 0%, var(--brandBlueInk) 100%);
    border-bottom: none;
}

.card-systems .card-header h6 {
    color: var(--whiteColor);
}

.card-systems .card-header h6 i {
    color: var(--brandGold);
}

.system-tile {
    --systemColor: var(--brandBlue);
    --systemSoft: #e8f0fa;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    gap: 0.65rem;
    height: 100%;
    padding: 1.1rem 0.75rem 0.95rem;
    border: 1px solid var(--borderColor);
    border-radius: 12px;
    background: var(--whiteColor);
    text-decoration: none;
    text-align: center;
    transition: var(--transition);
}

a.system-tile:hover {
    border-color: var(--systemColor);
    box-shadow: var(--shadowHover);
    transform: translateY(-3px);
}

.system-tile .system-icon {
    width: 54px;
    height: 54px;
    border-radius: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--systemSoft);
    color: var(--systemColor);
    font-size: 1.6rem;
    flex-shrink: 0;
    transition: var(--transition);
}

a.system-tile:hover .system-icon {
    background: var(--systemColor);
    color: var(--whiteColor);
}

.system-tile .system-label {
    font-size: 0.85rem;
    font-weight: 600;
    line-height: 1.4;
    color: var(--textColor);
}

.system-tile .system-external {
    position: absolute;
    top: 0.6rem;
    left: 0.6rem;
    font-size: 0.75rem;
    color: var(--brandGrey);
    transition: var(--transition);
}

a.system-tile:hover .system-external {
    color: var(--systemColor);
}

.system-tile-disabled {
    background: var(--brandGreySoft);
    cursor: not-allowed;
}

.system-tile-disabled .system-icon {
    background: #e4e4e1;
    color: var(--greyColor);
}

.system-tile-disabled .system-label {
    color: var(--greyColor);
}

.system-tone-blue   { --systemColor: var(--brandBlue);     --systemSoft: #e8f0fa; }
.system-tone-navy   { --systemColor: var(--brandBlueDark); --systemSoft: #e5ebf3; }
.system-tone-gold   { --systemColor: var(--brandGoldText); --systemSoft: var(--brandGoldSoft); }
.system-tone-teal   { --systemColor: #17788c;              --systemSoft: #e3f2f5; }
.system-tone-olive  { --systemColor: #5f7a3a;              --systemSoft: #eef3e4; }
.system-tone-purple { --systemColor: #6b4a9e;              --systemSoft: #f0eaf8; }

/* Progress bars */
.progress {
    height: 8px;
    border-radius: 20px;
    background: var(--brandGreySoft);
}

.progress-bar {
    border-radius: 20px;
    background: linear-gradient(90deg, var(--brandBlue), var(--brandBlueDark));
}

.progress-bar.bg-gold {
    background: linear-gradient(90deg, var(--brandGold), var(--brandGoldDark));
}

.progress-bar.bg-success {
    background: linear-gradient(90deg, var(--successColor), #2bab7b) !important;
}

/* ========= Buttons (Brand) ========= */
.btn {
    border-radius: 10px;
    padding: 0.6rem 1.35rem;
    font-weight: 600;
    transition: var(--transition);
    border: 1px solid transparent;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn-primary {
    background: var(--brandBlue);
    border-color: var(--brandBlue);
    color: var(--whiteColor);
    box-shadow: 0 4px 12px rgba(0, 84, 166, 0.22);
}

.btn-primary:hover, .btn-primary:focus {
    background: var(--brandBlueDark);
    border-color: var(--brandBlueDark);
    color: var(--whiteColor);
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(0, 84, 166, 0.3);
}

.btn-outline-primary {
    border-color: var(--brandBlue);
    color: var(--brandBlue);
    background: transparent;
}

.btn-outline-primary:hover {
    background: var(--brandBlue);
    border-color: var(--brandBlue);
    color: var(--whiteColor);
}

/* Gold accent button - the brand's secondary action */
.btn-gold {
    background: var(--brandGold);
    border-color: var(--brandGold);
    color: var(--brandBlueInk);
    box-shadow: 0 4px 12px rgba(219, 185, 104, 0.35);
}

.btn-gold:hover, .btn-gold:focus {
    background: var(--brandGoldDark);
    border-color: var(--brandGoldDark);
    color: var(--whiteColor);
    transform: translateY(-1px);
}

.btn-outline-gold {
    background: transparent;
    border-color: var(--brandGold);
    color: var(--brandGoldText);
}

.btn-outline-gold:hover {
    background: var(--brandGold);
    border-color: var(--brandGold);
    color: var(--brandBlueInk);
}

/* Kept for legacy markup that still uses the purple outline variant */
.btn-outline-purple {
    background: transparent;
    border-color: var(--brandGold);
    color: var(--brandGoldText);
}

.btn-outline-purple:hover {
    background: var(--brandGold);
    border-color: var(--brandGold);
    color: var(--brandBlueInk);
}

.btn-secondary {
    background: var(--brandBlueInk);
    border-color: var(--brandBlueInk);
    color: var(--whiteColor);
}

.btn-secondary:hover {
    background: var(--brandBlueDeep);
    border-color: var(--brandBlueDeep);
    transform: translateY(-1px);
}

.btn-outline-secondary {
    border-color: var(--brandGrey);
    color: var(--greyColor);
    background: transparent;
}

.btn-outline-secondary:hover {
    background: var(--brandGrey);
    border-color: var(--brandGrey);
    color: var(--brandBlueInk);
}

.btn-success {
    background: var(--successColor);
    border-color: var(--successColor);
}

.btn-success:hover {
    background: #17714f;
    border-color: #17714f;
}

.btn-warning {
    background: var(--brandGold);
    border-color: var(--brandGold);
    color: var(--brandBlueInk);
}

.btn-warning:hover {
    background: var(--brandGoldDark);
    border-color: var(--brandGoldDark);
    color: var(--whiteColor);
}

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

.btn-danger:hover {
    background: #a5312a;
    border-color: #a5312a;
}

.btn-info {
    background: var(--infoColor);
    border-color: var(--infoColor);
    color: var(--whiteColor);
}

.btn-sm {
    padding: 0.4rem 0.9rem;
    font-size: 0.85rem;
    border-radius: 8px;
}

.btn-lg {
    padding: 0.85rem 1.5rem;
    font-size: 1rem;
}


/* Action Buttons in Tables */
.btn-action {
    width: 40px;
    height: 40px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    border: 2px solid transparent;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.btn-action::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.3s, height 0.3s;
}

.btn-action:hover::before {
    width: 100px;
    height: 100px;
}

.btn-action i {
    font-size: 1.15rem;
    position: relative;
    z-index: 1;
}

.btn-action.btn-outline-primary {
    border-color: var(--secondaryColor);
    color: var(--secondaryColor);
    background: transparent;
}

.btn-action.btn-outline-primary:hover {
    background: var(--secondaryColor);
    color: var(--whiteColor);
    border-color: var(--secondaryColor);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(24, 130, 223, 0.3);
}

.btn-action.btn-outline-success {
    border-color: var(--successColor);
    color: var(--successColor);
    background: transparent;
}

.btn-action.btn-outline-success:hover {
    background: var(--successColor);
    color: var(--whiteColor);
    border-color: var(--successColor);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(40, 167, 69, 0.3);
}

.btn-action.btn-outline-warning {
    border-color: var(--warningColor);
    color: var(--warningColor);
    background: transparent;
}

.btn-action.btn-outline-warning:hover {
    background: var(--warningColor);
    color: var(--blackColor);
    border-color: var(--warningColor);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 193, 7, 0.3);
}

.btn-action.btn-outline-danger {
    border-color: var(--dangerColor);
    color: var(--dangerColor);
    background: transparent;
}

.btn-action.btn-outline-danger:hover {
    background: var(--dangerColor);
    color: var(--whiteColor);
    border-color: var(--dangerColor);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(220, 53, 69, 0.3);
}

.btn-action.btn-outline-info {
    border-color: var(--infoColor);
    color: var(--infoColor);
    background: transparent;
}

.btn-action.btn-outline-info:hover {
    background: var(--infoColor);
    color: var(--whiteColor);
    border-color: var(--infoColor);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(23, 162, 184, 0.3);
}

.btn-action.btn-outline-secondary {
    border-color: var(--greyColor);
    color: var(--greyColor);
    background: transparent;
}

.btn-action.btn-outline-secondary:hover {
    background: var(--greyColor);
    color: var(--whiteColor);
    border-color: var(--greyColor);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(101, 101, 101, 0.3);
}

/* ========= Tables ========= */
.table {
    margin-bottom: 0;
    border-radius: var(--borderRadius);
    overflow: hidden;
}

.table thead th {
    background: var(--brandBlueInk);
    color: var(--whiteColor);
    font-weight: 600;
    padding: 0.9rem 1.25rem;
    border: none;
    font-size: 0.85rem;
    letter-spacing: 0.3px;
    position: relative;
    white-space: nowrap;
    text-align: center;
    vertical-align: middle;
}

.table thead th:not(:last-child)::after {
    content: '';
    position: absolute;
    left: 0;
    top: 25%;
    height: 50%;
    width: 1px;
    background: rgba(219, 185, 104, 0.35);
}

.table tbody td,
.table tbody th {
    padding: 0.9rem 1.25rem;
    text-align: center;
    vertical-align: middle;
    border-bottom: 1px solid var(--borderColor);
    color: var(--textColor);
    transition: var(--transition);
}

/* Action buttons and other flex rows inside a cell */
.table tbody td > .d-flex {
    justify-content: center;
}

.table tbody tr:last-child td {
    border-bottom: none;
}

.table-hover tbody tr {
    transition: var(--transition);
}

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

.table-hover tbody tr:hover td {
    color: var(--brandBlueDark);
}

/* Table wrapper for better spacing. Wide tables scroll sideways (on
   phones) instead of being clipped; any overflow other than visible still
   clips the corners to the border radius. */
.table-responsive {
    border-radius: var(--borderRadius);
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
}


/* ========= Badges ========= */
.badge {
    padding: 0.38rem 0.75rem;
    font-weight: 600;
    border-radius: 20px;
    font-size: 0.78rem;
    letter-spacing: 0.2px;
}

.bg-primary {
    background: var(--brandBlue) !important;
}

.bg-success {
    background: var(--successColor) !important;
}

.bg-warning {
    background: var(--brandGold) !important;
    color: var(--brandBlueInk) !important;
}

.bg-danger {
    background: var(--dangerColor) !important;
}

.bg-info {
    background: var(--infoColor) !important;
    color: var(--whiteColor) !important;
}

.bg-secondary {
    background: var(--brandGrey) !important;
    color: var(--brandBlueInk) !important;
}

.bg-dark {
    background: var(--brandBlueInk) !important;
}

.badge.bg-gold {
    background: var(--brandGold) !important;
    color: var(--brandBlueInk) !important;
}

/* Soft badges */
.badge-soft-blue { background: #e8f0fa; color: var(--brandBlueDark); }
.badge-soft-gold { background: var(--brandGoldSoft); color: var(--brandGoldText); }
.badge-soft-green { background: #e4f4ed; color: var(--successColor); }
.badge-soft-red { background: #fbeae8; color: var(--dangerColor); }


/* ========= Forms ========= */
.form-label {
    font-weight: 600;
    color: var(--textColor);
    margin-bottom: 0.45rem;
    font-size: 0.9rem;
}

.form-control {
    border: 1px solid var(--borderColor);
    border-radius: 10px;
    padding: 0.65rem 0.95rem;
    background-color: var(--whiteColor);
    color: var(--textColor);
    transition: var(--transition);
}

.form-select {
    border: 1px solid var(--borderColor);
    border-radius: 10px;
    padding: 0.65rem 0.95rem;
    background-color: var(--whiteColor);
    color: var(--textColor);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

select option, select optgroup {
    background-color: #ffffff !important;
    color: #0b1f3a !important;
}

.select2-container {
    font-family: var(--fontFamily);
}

.select2-container--bootstrap-5 .select2-selection {
    border-radius: 10px !important;
}

.form-control:focus, .form-select:focus {
    border-color: var(--brandBlue);
    box-shadow: 0 0 0 0.2rem rgba(0, 84, 166, 0.12);
}

.form-control:hover, .form-select:hover {
    border-color: var(--brandGrey);
}

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

.form-check-input:focus {
    box-shadow: 0 0 0 0.2rem rgba(0, 84, 166, 0.12);
}

.input-group-text {
    background: var(--brandGoldSoft);
    border: 1px solid var(--borderColor);
    color: var(--brandGoldText);
    border-radius: 10px;
}


/* ========= Alerts ========= */
.alert {
    border: 1px solid var(--borderColor);
    border-radius: var(--borderRadius);
    padding: 1rem 1.25rem;
    margin-bottom: 1.5rem;
    box-shadow: none;
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
}

.alert-success {
    background: #e9f6f0;
    color: #14624a;
    border-right: 4px solid var(--successColor);
}

.alert-danger {
    background: #fbeae8;
    color: #8d2b23;
    border-right: 4px solid var(--dangerColor);
}

.alert-warning {
    background: var(--brandGoldSoft);
    color: #7a5f1d;
    border-right: 4px solid var(--brandGold);
}

.alert-info {
    background: #e8f0fa;
    color: var(--brandBlueDark);
    border-right: 4px solid var(--brandBlue);
}


/* ========= Dropdowns ========= */
.dropdown-menu {
    border: 1px solid var(--borderColor);
    border-radius: 12px;
    box-shadow: var(--shadowHover);
    padding: 0.5rem;
}

.dropdown-item {
    border-radius: 8px;
    padding: 0.6rem 0.9rem;
    transition: var(--transition);
}

.dropdown-item:hover {
    background: var(--hoverColor);
    color: var(--brandBlueDark);
}

/* ========= List groups ========= */
.list-group-item {
    border: 1px solid var(--borderColor);
    border-radius: 12px;
    margin-bottom: 0.5rem;
    transition: var(--transition);
    padding: 1rem 1.15rem;
}

.list-group-item:hover {
    background: var(--hoverColor);
}

.list-group-item-info {
    background: var(--hoverColor);
    border-right: 3px solid var(--brandBlue);
}

/* ========= Modals ========= */
.modal-content {
    border: none;
    border-radius: var(--borderRadius);
    box-shadow: var(--shadowHover);
}

.modal-header {
    background: linear-gradient(135deg, var(--brandBlueDeep), var(--brandBlueInk));
    color: var(--whiteColor);
    border-bottom: 3px solid var(--brandGold);
    border-radius: var(--borderRadius) var(--borderRadius) 0 0;
}

.modal-header .btn-close {
    filter: invert(1) grayscale(100%) brightness(200%);
}

.modal-title {
    font-weight: 700;
}

/* ========= Pagination ========= */
.pagination {
    margin-top: 1.5rem;
}

.page-link {
    border: 1px solid var(--borderColor);
    color: var(--brandBlue);
    padding: 0.5rem 0.9rem;
    margin: 0 0.2rem;
    border-radius: 8px;
    font-weight: 600;
    transition: var(--transition);
}

.page-link:hover {
    background: var(--hoverColor);
    color: var(--brandBlueDark);
}

.page-item.active .page-link {
    background: var(--brandBlue);
    border-color: var(--brandBlue);
    color: var(--whiteColor);
}

/* ========= Topbar actions ========= */
.header-icon-button {
    position: relative;
    width: 44px;
    height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 44px;
    border: 1px solid var(--borderColor);
    border-radius: 50%;
    background: var(--whiteColor);
    color: var(--brandBlueDark);
    text-decoration: none;
}

.header-icon-button:hover {
    background: var(--hoverColor);
    border-color: var(--brandBlue);
    color: var(--brandBlueDark);
}

.header-notification-badge,
.mobile-notification-badge {
    position: absolute;
    top: -3px;
    left: -3px;
    min-width: 18px;
    height: 18px;
    padding: 0 4px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    background: var(--dangerColor);
    color: var(--whiteColor);
    border: 2px solid var(--whiteColor);
    font-size: 0.65rem;
    font-weight: 700;
    line-height: 1;
}

.user-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    min-height: 44px;
    background: var(--whiteColor);
    border: 1px solid var(--borderColor);
    border-radius: 40px;
    padding: 0.25rem 0.85rem 0.25rem 0.4rem;
    font-weight: 600;
    color: var(--textColor);
    box-shadow: none;
}

.user-chip:hover, .user-chip:focus {
    background: var(--hoverColor);
    border-color: var(--brandBlue);
    color: var(--brandBlueDark);
}

.user-chip .avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--brandBlue), var(--brandBlueDeep));
    color: var(--whiteColor);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    font-weight: 700;
    border: 2px solid var(--brandGold);
}

.user-chip .user-name {
    font-size: 0.9375rem;
    max-width: 160px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ========= Scrollbar ========= */
::-webkit-scrollbar {
    width: 9px;
    height: 9px;
}

::-webkit-scrollbar-track {
    background: var(--brandGreySoft);
}

::-webkit-scrollbar-thumb {
    background: var(--brandGrey);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--brandBlue);
}


/* ========= Animations ========= */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}

.card {
    animation: fadeIn 0.35s ease-out;
}

/* ========= Mobile topbar ========= */
.mobile-topbar {
    display: none;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    min-height: 64px;
    background: linear-gradient(135deg, var(--brandBlueDeep), var(--brandBlueInk));
    border-bottom: 3px solid var(--brandGold);
    padding: 0.5rem 0.75rem;
    position: sticky;
    top: 0;
    z-index: 1040;
}

.mobile-page-title {
    flex: 1 1 auto;
    min-width: 0;
    padding: 0 0.35rem;
    color: var(--whiteColor);
    font-size: 1.1rem;
    font-weight: 700;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mobile-topbar-actions {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.mobile-icon-button,
.mobile-avatar {
    position: relative;
    width: 44px;
    height: 44px;
    min-width: 44px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--whiteColor);
    border: 1px solid rgba(219, 185, 104, 0.6);
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    text-decoration: none;
}

.mobile-icon-button:hover,
.mobile-avatar:hover {
    color: var(--whiteColor);
    background: rgba(255, 255, 255, 0.12);
}

.mobile-icon-button i {
    font-size: 1.4rem;
}

.mobile-avatar {
    border-radius: 50%;
    background: var(--brandBlue);
    border: 2px solid var(--brandGold);
    font-size: 0.8rem;
    font-weight: 700;
}

.mobile-avatar.dropdown-toggle::after {
    display: none;
}

.mobile-notification-badge {
    top: -4px;
    left: -4px;
    border-color: var(--brandBlueInk);
}

/* ========= Responsive ========= */
@media (min-width: 1200px) {
    .sidebar.offcanvas-xl {
        width: var(--sidebarWidth) !important;
        height: 100dvh !important;
        visibility: visible !important;
        background: linear-gradient(180deg, var(--brandBlueDeep) 0%, var(--brandBlueInk) 100%) !important;
        transform: none !important;
    }

    .app-main {
        width: calc(100% - var(--sidebarWidth, 264px));
        margin-right: var(--sidebarWidth, 264px);
        padding: clamp(1.5rem, 2vw, 2rem);
    }
}

@media (max-width: 1199.98px) {
    .mobile-topbar {
        display: flex;
    }

    .sidebar {
        width: var(--bs-offcanvas-width) !important;
        max-width: 88vw;
    }

    .app-main {
        margin-right: 0 !important;
        margin-left: 0 !important;
        width: 100%;
        max-width: 100%;
        flex: 0 0 100%;
        padding: 1rem;
    }

    .page-header {
        display: none;
    }

    .card-stat .stat-value {
        font-size: 1.7rem;
    }
}

@media (max-width: 575.98px) {
    .mobile-topbar {
        gap: 0.4rem;
        padding-inline: 0.6rem;
    }

    .mobile-page-title {
        font-size: 1rem;
    }

    .app-main {
        padding: 0.85rem;
    }
}

/* ========= Utilities ========= */
.spinner-border {
    color: var(--brandBlue);
}

.text-muted {
    color: var(--greyColor) !important;
}

.text-primary {
    color: var(--brandBlue) !important;
}

.text-gold {
    color: var(--brandGoldText) !important;
}

.text-brand-navy {
    color: var(--brandBlueInk) !important;
}

.bg-brand-soft {
    background: var(--hoverColor) !important;
}

.bg-gold-soft {
    background: var(--brandGoldSoft) !important;
}

a {
    color: var(--brandBlue);
    transition: var(--transition);
}

a:hover {
    color: var(--brandBlueDark);
    text-decoration: none;
}

hr {
    border-color: var(--borderColor);
    opacity: 1;
}

.app-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    min-height: 68px;
    margin-top: auto;
    padding: 1rem 0;
    border-top: 1px solid var(--borderColor);
    color: var(--greyColor);
    font-size: 0.875rem;
}

.app-footer .app-version {
    white-space: nowrap;
    font-size: 0.8125rem;
}

@media (max-width: 575.98px) {
    .app-footer {
        min-height: 84px;
        flex-direction: column;
        justify-content: center;
        gap: 0.25rem;
        text-align: center;
        font-size: 0.8125rem;
    }
}

/* Empty states */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
}

.empty-state i {
    font-size: 3rem;
    color: var(--brandGrey);
    display: block;
    margin-bottom: 0.75rem;
}

.empty-state p {
    color: var(--greyColor);
    margin: 0;
}

/* =========================================================
   Login / Authentication screen
   ========================================================= */
.auth-page {
    min-height: 100vh;
    background: var(--lightBg);
    display: flex;
    align-items: stretch;
}

.auth-split {
    display: flex;
    width: 100%;
    min-height: 100vh;
}

/* Brand panel */
.auth-brand {
    flex: 1 1 48%;
    position: relative;
    background:
        radial-gradient(circle at 20% 20%, rgba(0, 84, 166, 0.55), transparent 55%),
        linear-gradient(160deg, var(--brandBlueDeep) 0%, var(--brandBlueInk) 100%);
    color: var(--whiteColor);
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 3.5rem;
    overflow: hidden;
}

.auth-brand::before {
    content: '';
    position: absolute;
    width: 620px;
    height: 620px;
    border: 1px solid rgba(219, 185, 104, 0.22);
    border-radius: 50%;
    top: -180px;
    left: -180px;
}

.auth-brand::after {
    content: '';
    position: absolute;
    width: 420px;
    height: 420px;
    border: 1px solid rgba(219, 185, 104, 0.16);
    border-radius: 50%;
    bottom: -140px;
    right: -120px;
}

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

.auth-brand .auth-logo {
    background: var(--whiteColor);
    border-radius: 20px;
    padding: 1.25rem 1.75rem;
    display: inline-flex;
    align-self: flex-start;
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.28);
    border: 1px solid rgba(219, 185, 104, 0.5);
}

.auth-brand .auth-logo img {
    height: 96px;
    width: auto;
}

.auth-brand h1 {
    font-size: 2rem;
    font-weight: 700;
    margin: 2rem 0 0.75rem;
    line-height: 1.4;
}

.auth-brand .lead-text {
    color: rgba(255, 255, 255, 0.78);
    font-size: 1rem;
    max-width: 30rem;
    margin-bottom: 2.25rem;
}

.auth-brand .gold-rule {
    width: 72px;
    height: 4px;
    border-radius: 4px;
    background: var(--brandGold);
    margin-bottom: 1.75rem;
}

.auth-features {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    gap: 0.9rem;
}

.auth-features li {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.95rem;
}

.auth-features i {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(219, 185, 104, 0.16);
    color: var(--brandGold);
    font-size: 1rem;
    flex-shrink: 0;
}

/* Form panel */
.auth-form-side {
    flex: 1 1 52%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3rem 2rem;
    background: var(--whiteColor);
}

.auth-card {
    width: 100%;
    max-width: 430px;
}

.auth-card .auth-logo-sm {
    display: none;
    margin-bottom: 1.5rem;
    text-align: center;
}

.auth-card .auth-logo-sm img {
    height: 74px;
}

.auth-card h2 {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--textColor);
    margin-bottom: 0.35rem;
}

.auth-card .subtitle {
    color: var(--greyColor);
    margin-bottom: 2rem;
    font-size: 0.95rem;
}

.btn-microsoft {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.65rem;
    width: 100%;
    background: var(--brandBlue);
    border: 1px solid var(--brandBlue);
    color: var(--whiteColor);
    padding: 0.8rem 1rem;
    border-radius: 10px;
    font-weight: 600;
    font-size: 0.98rem;
    box-shadow: 0 6px 18px rgba(0, 84, 166, 0.25);
    transition: var(--transition);
}

.btn-microsoft:hover,
.btn-microsoft:focus-visible {
    background: var(--brandBlueDark);
    border-color: var(--brandBlueDark);
    color: var(--whiteColor);
}

/* keep the Microsoft mark legible on the blue fill */
.btn-microsoft svg {
    background: var(--whiteColor);
    border-radius: 3px;
    padding: 2px;
    box-sizing: content-box;
}

.auth-divider {
    text-align: center;
    margin: 1.5rem 0;
    position: relative;
}

.auth-divider::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: var(--borderColor);
}

.auth-divider span {
    background: var(--whiteColor);
    padding: 0 0.9rem;
    position: relative;
    color: var(--greyColor);
    font-size: 0.85rem;
}

.btn-email-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.65rem;
    width: 100%;
    background: transparent;
    border: 1px dashed var(--borderColor);
    color: var(--greyColor);
    padding: 0.7rem 1rem;
    border-radius: 10px;
    font-weight: 500;
    font-size: 0.9rem;
    transition: var(--transition);
}

.btn-email-toggle:hover,
.btn-email-toggle:focus-visible {
    background: var(--hoverColor);
    border-color: var(--brandBlue);
    color: var(--brandBlueDark);
}

.btn-email-toggle .toggle-chevron {
    font-size: 0.8rem;
    transition: transform 0.2s ease;
}

.btn-email-toggle[aria-expanded="true"] .toggle-chevron {
    transform: rotate(180deg);
}

.auth-card .btn-submit {
    width: 100%;
    background: var(--brandBlue);
    border-color: var(--brandBlue);
    color: var(--whiteColor);
    padding: 0.8rem 1rem;
    font-size: 1rem;
    box-shadow: 0 6px 18px rgba(0, 84, 166, 0.25);
}

.auth-card .btn-submit:hover {
    background: var(--brandBlueDark);
    border-color: var(--brandBlueDark);
    color: var(--whiteColor);
}

.auth-footer {
    margin-top: 2rem;
    text-align: center;
    color: var(--greyColor);
    font-size: 0.8rem;
}

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

    .auth-form-side {
        flex: 1 1 100%;
        background: var(--lightBg);
        padding: 2rem 1.25rem;
    }

    .auth-card {
        background: var(--whiteColor);
        border: 1px solid var(--borderColor);
        border-radius: var(--borderRadius);
        box-shadow: var(--shadow);
        padding: 2rem 1.5rem;
    }

    .auth-card .auth-logo-sm {
        display: block;
    }

    .auth-divider span {
        background: var(--whiteColor);
    }
}
