/* ==========================================================================
   raideSMS Design System
   --------------------------------------------------------------------------
   Single source of truth for the visual language of the whole application.
   Loaded last (after bootstrap / mouldifi / RTL sheets) from
   Views/Shared/_headMeatadata_commLink.cshtml so it themes every module.

   Change a token in the ":root" block below and the whole product follows.

   CONTENTS
     01. Design tokens
     02. Base / reset
     03. Layout shell (sidebar, topbar, content, footer)
     04. Sidebar navigation
     05. Page header & breadcrumbs
     06. Cards (Bootstrap "panel" + "card")
     07. Buttons
     08. Forms & form controls
     09. Tables & DataTables
     10. Modals
     11. Alerts, badges, toasts
     12. Tabs, pagination, dropdowns
     13. Utilities, loading & empty states
     14. Responsive pass
     15. RTL adjustments
     16. Print safety
   ========================================================================== */


/* ==========================================================================
   01. DESIGN TOKENS
   ========================================================================== */

:root {
    /* ---- Brand palette (cyan/teal family, derived from the legacy brand) -- */
    --rds-primary-50: #ecfaff;
    --rds-primary-100: #d3f2fd;
    --rds-primary-200: #ade7fb;
    --rds-primary-300: #74d8f8;
    --rds-primary-400: #33c1ec;
    --rds-primary-500: #12a5d2;
    --rds-primary-600: #0d84b0;
    --rds-primary-700: #0f6a8f;
    --rds-primary-800: #135875;
    --rds-primary-900: #144a63;
    --rds-primary-950: #0b2f40;

    --rds-primary: var(--rds-primary-600);
    --rds-primary-hover: var(--rds-primary-700);
    --rds-primary-active: var(--rds-primary-800);
    --rds-primary-soft: var(--rds-primary-50);
    --rds-on-primary: #ffffff;

    /* ---- Secondary / accent ---------------------------------------------- */
    --rds-accent-50: #fff8eb;
    --rds-accent-100: #ffefc6;
    --rds-accent-500: #f59e0b;
    --rds-accent-600: #d97e06;
    --rds-accent-700: #b45c09;
    --rds-accent: var(--rds-accent-500);

    /* ---- Neutrals --------------------------------------------------------- */
    --rds-neutral-0: #ffffff;
    --rds-neutral-25: #fcfdfe;
    --rds-neutral-50: #f7f9fb;
    --rds-neutral-100: #eef2f6;
    --rds-neutral-200: #e2e8f0;
    --rds-neutral-300: #cbd5e1;
    --rds-neutral-400: #94a3b8;
    --rds-neutral-500: #64748b;
    --rds-neutral-600: #475569;
    --rds-neutral-700: #334155;
    --rds-neutral-800: #1e293b;
    --rds-neutral-900: #0f172a;

    /* ---- Semantic colours -------------------------------------------------- */
    --rds-success: #15803d;
    --rds-success-soft: #ecfdf3;
    --rds-success-border: #a7f3c4;
    --rds-warning: #b45309;
    --rds-warning-soft: #fffaeb;
    --rds-warning-border: #fde08a;
    --rds-danger: #b91c1c;
    --rds-danger-soft: #fef2f2;
    --rds-danger-border: #fca5a5;
    --rds-info: #0369a1;
    --rds-info-soft: #f0f9ff;
    --rds-info-border: #a5d8f5;

    /* ---- Surfaces & text --------------------------------------------------- */
    --rds-bg-app: var(--rds-neutral-50);
    --rds-bg-surface: var(--rds-neutral-0);
    --rds-bg-subtle: var(--rds-neutral-100);
    --rds-bg-muted: var(--rds-neutral-50);

    --rds-text: var(--rds-neutral-800);
    --rds-text-muted: var(--rds-neutral-500);
    --rds-text-subtle: var(--rds-neutral-400);
    --rds-text-inverse: #ffffff;
    --rds-text-heading: var(--rds-neutral-900);
    --rds-link: var(--rds-primary-700);
    --rds-link-hover: var(--rds-primary-800);

    /* ---- Sidebar ----------------------------------------------------------- */
    --rds-sidebar-bg: var(--rds-primary-950);
    --rds-sidebar-bg-alt: #0d3a4e;
    --rds-sidebar-text: #cfe6ef;
    --rds-sidebar-text-strong: #ffffff;
    --rds-sidebar-hover-bg: rgba(255, 255, 255, .08);
    --rds-sidebar-active-bg: var(--rds-primary-600);
    --rds-sidebar-sub-bg: rgba(0, 0, 0, .22);
    --rds-sidebar-border: rgba(255, 255, 255, .08);
    --rds-sidebar-width: 268px;
    --rds-sidebar-width-collapsed: 72px;

    /* ---- Topbar ------------------------------------------------------------ */
    --rds-topbar-height: 62px;
    --rds-topbar-bg: var(--rds-neutral-0);
    --rds-topbar-border: var(--rds-neutral-200);

    /* ---- Typography --------------------------------------------------------- */
    --rds-font-sans: "Inter", "Segoe UI", "Source Sans Pro", -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
    --rds-font-rtl: 'Jameel Noori Nastaleeq Regular', 'Jameel Noori Nastaleeq Kasheeda', 'Tahoma', serif;
    --rds-font-mono: "SFMono-Regular", "Cascadia Mono", Consolas, "Liberation Mono", monospace;

    --rds-font-size-xs: 11px;
    --rds-font-size-sm: 12.5px;
    --rds-font-size-base: 14px;
    --rds-font-size-md: 15px;
    --rds-font-size-lg: 17px;
    --rds-font-size-xl: 20px;
    --rds-font-size-2xl: 24px;
    --rds-font-size-3xl: 30px;

    --rds-font-weight-normal: 400;
    --rds-font-weight-medium: 500;
    --rds-font-weight-semibold: 600;
    --rds-font-weight-bold: 700;

    --rds-line-height-tight: 1.25;
    --rds-line-height-base: 1.55;
    --rds-line-height-loose: 1.75;

    /* ---- Spacing scale (4px base) ------------------------------------------- */
    --rds-space-0: 0;
    --rds-space-1: 4px;
    --rds-space-2: 8px;
    --rds-space-3: 12px;
    --rds-space-4: 16px;
    --rds-space-5: 20px;
    --rds-space-6: 24px;
    --rds-space-7: 32px;
    --rds-space-8: 40px;
    --rds-space-9: 48px;
    --rds-space-10: 64px;

    /* ---- Radii --------------------------------------------------------------- */
    --rds-radius-xs: 4px;
    --rds-radius-sm: 6px;
    --rds-radius-md: 8px;
    --rds-radius-lg: 12px;
    --rds-radius-xl: 16px;
    --rds-radius-pill: 999px;

    /* ---- Borders -------------------------------------------------------------- */
    --rds-border-width: 1px;
    --rds-border-color: var(--rds-neutral-200);
    --rds-border-color-strong: var(--rds-neutral-300);
    --rds-border: var(--rds-border-width) solid var(--rds-border-color);

    /* ---- Shadows --------------------------------------------------------------- */
    --rds-shadow-xs: 0 1px 2px rgba(15, 23, 42, .05);
    --rds-shadow-sm: 0 1px 3px rgba(15, 23, 42, .07), 0 1px 2px rgba(15, 23, 42, .04);
    --rds-shadow-md: 0 4px 12px rgba(15, 23, 42, .07), 0 1px 3px rgba(15, 23, 42, .05);
    --rds-shadow-lg: 0 12px 28px rgba(15, 23, 42, .10), 0 4px 8px rgba(15, 23, 42, .05);
    --rds-shadow-xl: 0 24px 48px rgba(15, 23, 42, .16);
    --rds-focus-ring: 0 0 0 3px rgba(13, 132, 176, .22);

    /* ---- Control sizing --------------------------------------------------------- */
    --rds-control-height: 38px;
    --rds-control-height-sm: 30px;
    --rds-control-height-lg: 46px;
    --rds-control-padding-x: 12px;

    /* ---- Motion ------------------------------------------------------------------ */
    --rds-transition-fast: 120ms ease;
    --rds-transition: 180ms ease;

    /* ---- Z-index scale ------------------------------------------------------------ */
    --rds-z-sidebar: 1030;
    --rds-z-topbar: 1020;
    --rds-z-backdrop: 1025;
    --rds-z-modal: 1050;
    --rds-z-toast: 1080;
    --rds-z-spinner: 1090;
}

/* Responsive breakpoints used throughout this file (Bootstrap 3 compatible):
     xs  < 768px      sm  >= 768px      md  >= 992px      lg  >= 1200px
   Declared here for documentation; media queries below reference them. */


/* ==========================================================================
   02. BASE / RESET
   ========================================================================== */

html {
    height: 100%;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--rds-font-sans);
    font-size: var(--rds-font-size-base);
    line-height: var(--rds-line-height-base);
    color: var(--rds-text);
    background-color: var(--rds-bg-app);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

h1, h2, h3, h4, h5, h6,
.h1, .h2, .h3, .h4, .h5, .h6 {
    font-family: inherit;
    color: var(--rds-text-heading);
    font-weight: var(--rds-font-weight-semibold);
    line-height: var(--rds-line-height-tight);
    margin-top: 0;
}

h1, .h1 { font-size: var(--rds-font-size-3xl); margin-bottom: var(--rds-space-4); }
h2, .h2 { font-size: var(--rds-font-size-2xl); margin-bottom: var(--rds-space-4); }
h3, .h3 { font-size: var(--rds-font-size-xl); margin-bottom: var(--rds-space-3); }
h4, .h4 { font-size: var(--rds-font-size-lg); margin-bottom: var(--rds-space-3); }
h5, .h5 { font-size: var(--rds-font-size-md); margin-bottom: var(--rds-space-2); }
h6, .h6 { font-size: var(--rds-font-size-base); margin-bottom: var(--rds-space-2); }

a {
    color: var(--rds-link);
    text-decoration: none;
    transition: color var(--rds-transition-fast);
}

a:hover,
a:focus {
    color: var(--rds-link-hover);
    text-decoration: none;
}

a:focus-visible,
button:focus-visible,
[tabindex]:focus-visible {
    outline: 2px solid var(--rds-primary-500);
    outline-offset: 2px;
}

hr {
    border: 0;
    border-top: var(--rds-border);
    margin: var(--rds-space-5) 0;
}

code, kbd, pre, samp { font-family: var(--rds-font-mono); }

::selection {
    background: var(--rds-primary-100);
    color: var(--rds-primary-900);
}

/* --------------------------------------------------------------------------
   ICON LANGUAGE
   Font Awesome is the single icon library for the product. The legacy template
   ships Entypo glyphs (".icon-*") that are still referenced by markup across
   ~200 views; rather than touching every view, the handful of Entypo glyphs
   actually in use are remapped onto their Font Awesome equivalents here. New
   markup should always use ".fa .fa-*".
   -------------------------------------------------------------------------- */

[class^="icon-"], [class*=" icon-"],
.fa, .fas, .far, .fab {
    line-height: inherit;
    vertical-align: middle;
}

.icon-down-open,
.icon-up-open,
.icon-left-open,
.icon-right-open,
.icon-arrows-ccw,
.icon-cancel,
.icon-menu,
.icon-home,
.icon-key,
.icon-logout,
.icon-gauge,
.icon-graduation-cap,
.icon-plus-circled,
.icon-eye,
.icon-flag,
.icon-book,
.icon-search,
.icon-user,
.icon-plus,
.icon-dot-3 {
    font-family: "FontAwesome" !important;
    font-style: normal;
    font-weight: normal;
    font-variant: normal;
    text-transform: none;
    speak: none;
    display: inline-block;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.icon-down-open::before { content: "\f078"; }        /* chevron-down   */
.icon-up-open::before { content: "\f077"; }          /* chevron-up     */
.icon-left-open::before { content: "\f053"; }        /* chevron-left   */
.icon-right-open::before { content: "\f054"; }       /* chevron-right  */
.icon-arrows-ccw::before { content: "\f021"; }       /* refresh        */
.icon-cancel::before { content: "\f00d"; }           /* times          */
.icon-menu::before { content: "\f0c9"; }             /* bars           */
.icon-home::before { content: "\f015"; }             /* home           */
.icon-key::before { content: "\f084"; }              /* key            */
.icon-logout::before { content: "\f08b"; }           /* sign-out       */
.icon-gauge::before { content: "\f0e4"; }            /* tachometer     */
.icon-graduation-cap::before { content: "\f19d"; }   /* graduation-cap */
.icon-plus-circled::before { content: "\f055"; }     /* plus-circle    */
.icon-eye::before { content: "\f06e"; }              /* eye            */
.icon-flag::before { content: "\f024"; }             /* flag           */
.icon-book::before { content: "\f02d"; }             /* book           */
.icon-search::before { content: "\f002"; }           /* search         */
.icon-user::before { content: "\f007"; }             /* user           */
.icon-plus::before { content: "\f067"; }             /* plus           */
.icon-dot-3::before { content: "\f142"; }            /* ellipsis-v     */

/* Buttons that carry Entypo icon classes directly (no <i> wrapper) */
.btn.icon-plus::before,
button.icon-plus::before {
    margin-inline-end: 6px;
    font-size: .95em;
}

.icon-dot-3.ellipsis-icon {
    cursor: pointer;
    color: var(--rds-text-muted);
    padding: 4px 8px;
    border-radius: var(--rds-radius-sm);
    transition: background var(--rds-transition-fast), color var(--rds-transition-fast);
}

.icon-dot-3.ellipsis-icon:hover {
    background: var(--rds-neutral-100);
    color: var(--rds-neutral-700);
}

/* Scrollbars */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--rds-neutral-300) transparent;
}

*::-webkit-scrollbar { width: 9px; height: 9px; }
*::-webkit-scrollbar-track { background: transparent; }

*::-webkit-scrollbar-thumb {
    background: var(--rds-neutral-300);
    border-radius: var(--rds-radius-pill);
}

*::-webkit-scrollbar-thumb:hover { background: var(--rds-neutral-400); }


/* ==========================================================================
   03. LAYOUT SHELL
   ========================================================================== */

.page-container {
    display: block;
    width: 100%;
    min-height: 100vh;
    height: auto;
    table-layout: auto;
    background-color: var(--rds-bg-app);
    position: relative;
}

/* Sidebar: fixed rail on desktop, off-canvas drawer on mobile. */
.page-sidebar {
    display: block;
    position: fixed;
    top: 0;
    inset-inline-start: 0;
    width: var(--rds-sidebar-width);
    height: 100vh;
    background: linear-gradient(180deg, var(--rds-sidebar-bg-alt) 0%, var(--rds-sidebar-bg) 100%);
    color: var(--rds-sidebar-text);
    border-inline-end: 1px solid rgba(255, 255, 255, .06);
    z-index: var(--rds-z-sidebar);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: width var(--rds-transition), transform var(--rds-transition);
}

.page-sidebar .sidebar-fixed {
    position: static;
    width: 100%;
    height: auto;
}

.main-container {
    display: block;
    width: auto;
    background-color: transparent;
    padding: 0 0 var(--rds-space-6);
    margin-inline-start: var(--rds-sidebar-width);
    min-height: 100vh;
    transition: margin var(--rds-transition);
    position: relative;
}

/* Collapsed (icon-only) sidebar */
.page-container.sidebar-collapsed .page-sidebar,
.sidebar-collapsed .page-sidebar .sidebar-fixed {
    width: var(--rds-sidebar-width-collapsed);
}

.page-container.sidebar-collapsed .main-container {
    margin-inline-start: var(--rds-sidebar-width-collapsed);
}

/* --- Brand / sidebar header ------------------------------------------------ */
.site-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--rds-space-3);
    min-height: var(--rds-topbar-height);
    padding: var(--rds-space-3) var(--rds-space-4);
    border-bottom: 1px solid var(--rds-sidebar-border);
    overflow: visible;
    flex: 0 0 auto;
}

.page-container.sidebar-collapsed .site-header {
    flex-direction: column;
    padding: var(--rds-space-2) 0;
    justify-content: center;
    gap: var(--rds-space-1);
}

.site-logo {
    float: none;
    display: flex;
    align-items: center;
    gap: var(--rds-space-3);
    min-width: 0;
    overflow: hidden;
}

.site-logo a {
    display: flex;
    align-items: center;
    gap: var(--rds-space-3);
    color: var(--rds-sidebar-text-strong);
    font-weight: var(--rds-font-weight-semibold);
    text-transform: none;
    min-width: 0;
}

.site-logo img {
    width: 38px !important;
    height: 38px !important;
    border-radius: var(--rds-radius-md);
    background: #fff;
    padding: 3px;
    object-fit: contain;
    flex: 0 0 auto;
}

.site-logo .site-logo-text {
    display: flex;
    flex-direction: column;
    line-height: 1.15;
    min-width: 0;
}

.site-logo .site-logo-title {
    font-size: var(--rds-font-size-md);
    font-weight: var(--rds-font-weight-bold);
    letter-spacing: .2px;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.site-logo .site-logo-sub {
    font-size: var(--rds-font-size-xs);
    color: var(--rds-primary-200);
    text-transform: uppercase;
    letter-spacing: .8px;
    white-space: nowrap;
}

.page-container.sidebar-collapsed .site-logo {
    width: auto;
    overflow: hidden;
}

.page-container.sidebar-collapsed .site-logo-text { display: none; }

.sidebar-collapse,
.sidebar-mobile-menu {
    float: none;
    position: relative;
    flex: 0 0 auto;
}

.sidebar-collapse a.sidebar-collapse-icon,
.sidebar-mobile-menu a.mobile-menu-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: var(--rds-radius-sm);
    color: var(--rds-sidebar-text);
    background: rgba(255, 255, 255, .06);
    font-size: 18px;
    line-height: 1;
    transition: background var(--rds-transition-fast), color var(--rds-transition-fast);
}

.sidebar-collapse a.sidebar-collapse-icon:hover,
.sidebar-mobile-menu a.mobile-menu-icon:hover {
    background: rgba(255, 255, 255, .16);
    color: #fff;
}

/* Keep the collapse/expand control visible in the narrow rail so the
   sidebar can always be restored. Tablet widths auto-collapse the rail
   (functions.js) and previously hid this button, leaving no way back. */
.page-container.sidebar-collapsed .sidebar-collapse {
    display: flex !important;
    margin: 0 auto;
}

/* --- Topbar ----------------------------------------------------------------- */
.main-header {
    position: sticky;
    top: 0;
    z-index: var(--rds-z-topbar);
    display: block;
    min-height: var(--rds-topbar-height);
    margin: 0;
    padding: 0 var(--rds-space-5);
    background-color: var(--rds-topbar-bg) !important;
    border-bottom: 1px solid var(--rds-topbar-border);
    box-shadow: var(--rds-shadow-xs);
}

.main-header.row { margin-left: 0; margin-right: 0; }

.main-header > [class*="col-"] {
    padding-left: 0;
    padding-right: 0;
}

/* The language/user partial lives inside the topbar. */
.main-header .headerRowFontStyle {
    display: flex;
    align-items: center;
    gap: var(--rds-space-3);
    min-height: var(--rds-topbar-height);
    font-size: var(--rds-font-size-base) !important;
    flex-wrap: wrap;
}

.main-header .row { margin-left: 0; margin-right: 0; }

/* Layouts without a sidebar (module launcher, home pages, error pages). */
body.rds-no-sidebar .main-container,
body.rds-no-sidebar footer { margin-inline-start: 0 !important; }

body.rds-no-sidebar .rds-topbar-toggle { display: none !important; }

/* When the rail is icon-only, also show the topbar hamburger so the
   sidebar can be expanded even if the in-rail control is hard to hit. */
.page-container.sidebar-collapsed .rds-topbar-toggle { display: inline-flex; }

body.rds-no-sidebar .main-content {
    max-width: 1440px;
    margin: 0 auto;
    width: 100%;
}

/* Mobile hamburger rendered inside the topbar. */
.rds-topbar-toggle {
    display: none;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    flex: 0 0 auto;
    border: var(--rds-border);
    border-radius: var(--rds-radius-sm);
    background: var(--rds-bg-surface);
    color: var(--rds-neutral-700);
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
}

.rds-topbar-toggle:hover,
.rds-topbar-toggle:focus {
    background: var(--rds-neutral-100);
    color: var(--rds-primary-700);
}

/* Session / campus switcher trigger in the topbar. */
#showSessionModal {
    display: inline-flex;
    align-items: center;
    gap: var(--rds-space-2);
    margin: 0 !important;
    padding: 6px var(--rds-space-3);
    border: var(--rds-border);
    border-radius: var(--rds-radius-pill);
    background: var(--rds-neutral-50);
    color: var(--rds-neutral-700);
    font-size: var(--rds-font-size-sm);
    font-weight: var(--rds-font-weight-medium);
    cursor: pointer;
    transition: background var(--rds-transition-fast), border-color var(--rds-transition-fast);
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#showSessionModal:hover {
    background: var(--rds-primary-50);
    border-color: var(--rds-primary-200);
    color: var(--rds-primary-800);
}

#showSessionModal b { font-weight: var(--rds-font-weight-semibold); }

/* User menu on the right of the topbar */
.user-info {
    display: flex;
    align-items: center;
    gap: var(--rds-space-2);
    margin: 0 0 0 auto;
    padding: 0;
    list-style: none;
}

.user-info.pull-right { float: none !important; }

.user-info > li { float: none; margin-right: 0; }

/* Legacy float helper used by the topbar user menu — the topbar is flex now. */
.main-header .right-align { float: none !important; display: inline-flex !important; text-align: inherit; }

.user-info .profile-info > a.dropdown-toggle {
    display: inline-flex !important;
    align-items: center;
    gap: var(--rds-space-2);
    padding: 5px var(--rds-space-3) 5px 5px;
    border: var(--rds-border);
    border-radius: var(--rds-radius-pill);
    background: var(--rds-bg-surface);
    color: var(--rds-neutral-700);
    float: none !important;
    text-align: start !important;
}

.user-info .profile-info > a.dropdown-toggle:hover,
.user-info .profile-info.open > a.dropdown-toggle {
    background: var(--rds-neutral-100);
    border-color: var(--rds-border-color-strong);
}

.user-info .profile-info img.avatar {
    width: 28px !important;
    height: 28px !important;
    border-radius: var(--rds-radius-pill);
    object-fit: cover;
    border: 2px solid var(--rds-neutral-200);
}

.user-info .profile-info .dropdown-menu {
    min-width: 230px;
    padding: var(--rds-space-2);
}

.user-info .profile-info .dropdown-menu > li > img,
.user-info .profile-info .dropdown-menu img.avatar {
    border-radius: var(--rds-radius-pill);
    object-fit: cover;
}

.user-info .profile-info .dropdown-menu > li[style*="center"] { padding: var(--rds-space-2) 0; }

/* --- Content area ------------------------------------------------------------ */
.main-content {
    padding: var(--rds-space-6) var(--rds-space-5);
    max-width: 100%;
}

.content-wrapper {
    max-width: 1440px;
    margin: 0 auto;
    padding: 0 var(--rds-space-4);
}

/* Views that render straight into RenderBody() without .main-content still get
   breathing room from the main container. */
.main-container > .row,
.main-container > .panel,
.main-container > .table-responsive,
.main-container > form,
.main-container > h1,
.main-container > h2,
.main-container > h3 {
    margin-left: var(--rds-space-5);
    margin-right: var(--rds-space-5);
}

.main-container > h1:first-of-type,
.main-container > h2:first-of-type,
.main-container > h3:first-of-type { margin-top: var(--rds-space-6); }

/* Bootstrap 3 rows inside content must never cause horizontal overflow. */
.main-container .row { margin-left: -12px; margin-right: -12px; }
.main-container [class*="col-"] { padding-left: 12px; padding-right: 12px; }

/* --- Footer -------------------------------------------------------------------- */
footer {
    margin-inline-start: var(--rds-sidebar-width);
    padding: var(--rds-space-4) var(--rds-space-5);
    border-top: var(--rds-border);
    background: var(--rds-bg-surface);
    color: var(--rds-text-muted);
    font-size: var(--rds-font-size-sm);
    transition: margin var(--rds-transition);
}

.sidebar-collapsed ~ footer,
body.sidebar-is-collapsed footer { margin-inline-start: var(--rds-sidebar-width-collapsed); }

footer .content-wrapper {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: var(--rds-space-2);
    padding: 0;
    max-width: none;
}

footer p { margin: 0; font-size: var(--rds-font-size-sm); }
footer .float-left, footer .float-right { float: none !important; }

.rds-app-footer .content-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    max-width: none;
}

.rds-app-footer__text {
    margin: 0;
    font-size: var(--rds-font-size-sm);
    color: var(--rds-text-muted);
    text-align: center;
}


/* ==========================================================================
   04. SIDEBAR NAVIGATION
   ========================================================================== */

/* The exam/campus sidebars are taller than the viewport. Bootstrap 3's
   .navbar-collapse.collapse rule sets overflow:visible !important and
   height:auto !important on #side-nav, which silently defeats scrolling.
   Beat that with a more specific selector and a flex-friendly height. */
.page-sidebar .rds-sidebar-scroll,
.page-sidebar ul.main-menu,
.page-sidebar #side-nav,
.page-sidebar #side-nav.navbar-collapse,
.page-sidebar #side-nav.navbar-collapse.collapse,
.page-sidebar #side-nav.navbar-collapse.collapse.in {
    flex: 1 1 auto;
    min-height: 0 !important;
    height: 0 !important;
    max-height: none !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}

ul.main-menu {
    font-size: var(--rds-font-size-base);
    list-style: none;
    margin: 0;
    padding: var(--rds-space-3) var(--rds-space-2) var(--rds-space-8);
}

ul.main-menu li { position: relative; }

ul.main-menu > li { margin-bottom: 2px; }

ul.main-menu li a {
    display: flex;
    align-items: center;
    gap: var(--rds-space-3);
    padding: 10px var(--rds-space-3);
    color: var(--rds-sidebar-text);
    border-radius: var(--rds-radius-sm);
    font-size: var(--rds-font-size-base);
    font-weight: var(--rds-font-weight-medium);
    text-decoration: none;
    transition: background var(--rds-transition-fast), color var(--rds-transition-fast);
}

ul.main-menu > li > a:hover,
ul.main-menu > li > a:focus {
    background-color: var(--rds-sidebar-hover-bg);
    color: var(--rds-sidebar-text-strong);
}

ul.main-menu > li.active > a {
    background-color: var(--rds-sidebar-active-bg);
    color: #fff;
    box-shadow: var(--rds-shadow-sm);
}

ul.main-menu li i {
    margin-right: 0;
    margin-inline-end: 0;
    width: 20px;
    font-size: 16px;
    text-align: center;
    flex: 0 0 auto;
    opacity: .9;
}

ul.main-menu li a span.title {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Sub-menus: flat, indented, no decorative connector dots/lines. */
ul.main-menu li ul {
    list-style: none;
    margin: 2px 0 var(--rds-space-2);
    padding: 0;
    position: relative;
    background-color: var(--rds-sidebar-sub-bg);
    border-radius: var(--rds-radius-sm);
    overflow: hidden;
}

ul.main-menu > li > ul::before,
ul.main-menu li ul li::before,
ul.main-menu li ul li::after,
ul.main-menu li ul::before { display: none !important; }

ul.main-menu li ul > li > a {
    padding-inline-start: 46px;
    padding-top: 8px;
    padding-bottom: 8px;
    font-size: var(--rds-font-size-sm);
    font-weight: var(--rds-font-weight-normal);
    color: rgba(255, 255, 255, .72);
    border-radius: 0;
}

ul.main-menu li ul > li > ul > li > a { padding-inline-start: 62px; }
ul.main-menu li ul > li > ul > li > ul > li > a { padding-inline-start: 78px; }
ul.main-menu li ul > li > ul > li > ul > li > ul > li > a { padding-inline-start: 94px; }

ul.main-menu .nav > li > a:hover,
ul.main-menu .nav > li > a:focus {
    background-color: rgba(255, 255, 255, .10);
    color: #fff;
}

ul.main-menu .nav > li.active > a,
ul.main-menu li ul li.active > a {
    color: #fff;
    background-color: rgba(255, 255, 255, .14);
    font-weight: var(--rds-font-weight-medium);
    box-shadow: inset 3px 0 0 var(--rds-primary-400);
}

ul.main-menu .nav > li > a { color: rgba(255, 255, 255, .72); }

ul.main-menu .nav > li.has-sub.active > a { background-color: rgba(255, 255, 255, .10); }

/* Expand/collapse chevron */
ul.main-menu li.has-sub > a::before {
    color: rgba(255, 255, 255, .55);
    content: "\f054";
    font-family: "FontAwesome";
    font-size: 11px;
    font-weight: normal;
    float: none;
    order: 3;
    margin-left: auto;
    margin-inline-start: auto;
    margin-inline-end: 0;
    transition: transform var(--rds-transition);
}

ul.main-menu li.active.has-sub > a::before { transform: rotate(90deg); }

/* Collapsed rail: flyout submenus */
.sidebar-collapsed .page-sidebar .main-menu { padding-inline: 8px; }

.sidebar-collapsed .page-sidebar .main-menu > li > a {
    justify-content: center;
    padding-inline: 0;
}

.sidebar-collapsed .page-sidebar .main-menu > li.has-sub > a::before { display: none; }

.sidebar-collapsed .page-sidebar .main-menu > li > a > span.title {
    background-color: var(--rds-primary-700);
    border: 0;
    border-radius: 0 var(--rds-radius-sm) var(--rds-radius-sm) 0;
    box-shadow: var(--rds-shadow-md);
    color: #fff;
    left: var(--rds-sidebar-width-collapsed);
    padding: 12px var(--rds-space-4);
    width: 232px;
}

.sidebar-collapsed .page-sidebar .main-menu > li.has-sub:hover > a,
.sidebar-collapsed .page-sidebar .main-menu > li:hover > a {
    background-color: var(--rds-primary-700);
}

.sidebar-collapsed .page-sidebar .main-menu > li > ul {
    left: var(--rds-sidebar-width-collapsed);
    width: 232px;
    max-height: calc(100vh - 80px);
    overflow-y: auto;
    background-color: var(--rds-primary-800);
    border-radius: 0 0 var(--rds-radius-sm) var(--rds-radius-sm);
    box-shadow: var(--rds-shadow-md);
}

/* Icon-only rail: let hover flyouts escape the narrow column. */
.page-container.sidebar-collapsed .page-sidebar {
    overflow: visible;
}

.page-container.sidebar-collapsed .page-sidebar #side-nav,
.page-container.sidebar-collapsed .page-sidebar ul.main-menu {
    overflow: visible !important;
    height: auto !important;
    max-height: none !important;
}

.sidebar-collapsed .page-sidebar ul.main-menu > li > ul > li > a { padding-inline-start: var(--rds-space-4); }
.sidebar-collapsed .page-sidebar ul.main-menu li ul > li > ul > li > a { padding-inline-start: var(--rds-space-7); }

/* Mobile backdrop shown when the drawer is open */
.rds-sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, .5);
    z-index: var(--rds-z-backdrop);
}


/* ==========================================================================
   05. PAGE HEADER & BREADCRUMBS
   ========================================================================== */

.page-title,
.main-content > h1,
.main-container > h1,
.main-container > h2 {
    font-size: var(--rds-font-size-2xl);
    font-weight: var(--rds-font-weight-semibold);
    color: var(--rds-text-heading);
    margin: 0 0 var(--rds-space-5);
    letter-spacing: -.2px;
}

.page-title:empty { display: none; margin: 0; }

/* Reusable page header block: title + description + actions. */
.rds-page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--rds-space-4);
    flex-wrap: wrap;
    padding-bottom: var(--rds-space-5);
    margin-bottom: var(--rds-space-5);
    border-bottom: var(--rds-border);
}

.rds-page-header__text { min-width: 0; }

.rds-page-header__title {
    margin: 0;
    font-size: var(--rds-font-size-2xl);
    font-weight: var(--rds-font-weight-semibold);
    color: var(--rds-text-heading);
}

.rds-page-header__subtitle {
    margin: var(--rds-space-1) 0 0;
    color: var(--rds-text-muted);
    font-size: var(--rds-font-size-base);
}

.rds-page-header__actions {
    display: flex;
    align-items: center;
    gap: var(--rds-space-2);
    flex-wrap: wrap;
}

.breadcrumb {
    background: transparent;
    padding: 0;
    margin-bottom: var(--rds-space-3);
    font-size: var(--rds-font-size-sm);
    color: var(--rds-text-muted);
}

.breadcrumb > li + li::before { content: "/"; color: var(--rds-neutral-300); padding: 0 6px; }
.breadcrumb > .active { color: var(--rds-text); font-weight: var(--rds-font-weight-medium); }


/* ==========================================================================
   06. CARDS  (Bootstrap 3 "panel" + template "card")
   ========================================================================== */

.panel,
.card {
    background-color: var(--rds-bg-surface);
    border: var(--rds-border);
    border-radius: var(--rds-radius-lg);
    box-shadow: var(--rds-shadow-sm);
    margin-bottom: var(--rds-space-5);
    overflow: hidden;
}

.panel-heading,
.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--rds-space-3);
    flex-wrap: wrap;
    padding: var(--rds-space-4) var(--rds-space-5);
    background-color: var(--rds-bg-surface);
    border-bottom: var(--rds-border);
    border-radius: 0;
}

.panel-heading > .panel-title,
.panel-heading > h1.panel-title,
.panel-heading > h2.panel-title,
.panel-heading > h3.panel-title,
.panel-heading > h4.panel-title {
    float: none;
    margin: 0;
    font-size: var(--rds-font-size-md);
    font-weight: var(--rds-font-weight-semibold);
    color: var(--rds-text-heading);
    line-height: var(--rds-line-height-tight);
    min-width: 0;
}

.panel-heading > .panel-title-center {
    font-size: var(--rds-font-size-lg);
    margin: 0;
}

.panel-body,
.card-body {
    position: relative;
    padding: var(--rds-space-5);
}

.panel-footer {
    padding: var(--rds-space-4) var(--rds-space-5);
    background-color: var(--rds-bg-muted);
    border-top: var(--rds-border);
}

.panel-heading .panel-tool-options {
    float: none;
    display: flex;
    align-items: center;
    gap: 2px;
    margin: 0 0 0 auto;
    padding: 0;
    list-style: none;
}

.panel-heading .panel-tool-options > li { display: inline-flex; }

.panel-heading .panel-tool-options > li > a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: var(--rds-radius-sm);
    color: var(--rds-text-subtle);
    font-size: 13px;
    transition: background var(--rds-transition-fast), color var(--rds-transition-fast);
}

.panel-heading .panel-tool-options > li > a:hover {
    background: var(--rds-neutral-100);
    color: var(--rds-neutral-700);
}

/* Contextual panels get a tinted header instead of a fully coloured block. */
.panel-default { border-color: var(--rds-border-color); }
.panel-default > .panel-heading { background-color: var(--rds-bg-surface); color: var(--rds-text-heading); border-color: var(--rds-border-color); }

.panel-primary { border-color: var(--rds-primary-200); }
.panel-primary > .panel-heading { background-color: var(--rds-primary-50); color: var(--rds-primary-900); border-color: var(--rds-primary-200); }

.panel-success { border-color: var(--rds-success-border); }
.panel-success > .panel-heading { background-color: var(--rds-success-soft); color: var(--rds-success); border-color: var(--rds-success-border); }

.panel-info { border-color: var(--rds-info-border); }
.panel-info > .panel-heading { background-color: var(--rds-info-soft); color: var(--rds-info); border-color: var(--rds-info-border); }

.panel-warning { border-color: var(--rds-warning-border); }
.panel-warning > .panel-heading { background-color: var(--rds-warning-soft); color: var(--rds-warning); border-color: var(--rds-warning-border); }

.panel-danger { border-color: var(--rds-danger-border); }
.panel-danger > .panel-heading { background-color: var(--rds-danger-soft); color: var(--rds-danger); border-color: var(--rds-danger-border); }

.panel-invert {
    border-color: var(--rds-primary-600);
    background-color: var(--rds-primary-600);
    color: #fff;
}

.panel-invert > .panel-heading {
    background-color: var(--rds-primary-600);
    color: #fff;
    border-color: rgba(255, 255, 255, .18);
}

.panel-group .panel { border-radius: var(--rds-radius-lg); }
.panel-group .panel + .panel { margin-top: var(--rds-space-3); }

.shadowless, .panel-minimal, .panel.minimal { box-shadow: var(--rds-shadow-xs); }
.minimal .panel-heading { padding: var(--rds-space-3) var(--rds-space-4); }
.minimal .panel-body { padding: var(--rds-space-4); }

.panel-content.panel-content { padding-top: 0; }

.panel > .panel-body.with-table { padding: 0; margin: 0; border: 0; }
.panel-body.with-table .table { margin-bottom: 0; }

/* Stat tiles used on dashboards (".panel.minimal" + ".stack-order") */
.stack-order h1 {
    font-size: var(--rds-font-size-3xl);
    font-weight: var(--rds-font-weight-bold);
    color: var(--rds-primary-700);
    margin: 0 0 var(--rds-space-1);
}

.stack-order h4 {
    font-size: var(--rds-font-size-sm);
    font-weight: var(--rds-font-weight-medium);
    color: var(--rds-text-muted);
    text-transform: uppercase;
    letter-spacing: .5px;
    margin: 0;
}

.card-title {
    font-size: var(--rds-font-size-lg);
    font-weight: var(--rds-font-weight-semibold);
    margin-bottom: var(--rds-space-4);
}

/* Generic reusable card component for new markup */
.rds-card {
    background: var(--rds-bg-surface);
    border: var(--rds-border);
    border-radius: var(--rds-radius-lg);
    box-shadow: var(--rds-shadow-sm);
    overflow: hidden;
}

.rds-card__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--rds-space-3);
    padding: var(--rds-space-4) var(--rds-space-5);
    border-bottom: var(--rds-border);
}

.rds-card__title { margin: 0; font-size: var(--rds-font-size-md); font-weight: var(--rds-font-weight-semibold); }
.rds-card__body { padding: var(--rds-space-5); }
.rds-card__footer { padding: var(--rds-space-4) var(--rds-space-5); border-top: var(--rds-border); background: var(--rds-bg-muted); }


/* ==========================================================================
   07. BUTTONS
   ========================================================================== */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--rds-space-2);
    min-height: var(--rds-control-height);
    padding: 8px var(--rds-space-4);
    border: 1px solid transparent;
    border-radius: var(--rds-radius-sm);
    font-family: inherit;
    font-size: var(--rds-font-size-base);
    font-weight: var(--rds-font-weight-medium);
    line-height: 1.4;
    text-align: center;
    white-space: nowrap;
    vertical-align: middle;
    cursor: pointer;
    box-shadow: var(--rds-shadow-xs);
    transition: background-color var(--rds-transition-fast),
                border-color var(--rds-transition-fast),
                color var(--rds-transition-fast),
                box-shadow var(--rds-transition-fast);
}

.btn:focus,
.btn:active:focus,
.btn.active:focus {
    outline: none;
    box-shadow: var(--rds-focus-ring);
}

.btn:active,
.btn.active { box-shadow: inset 0 1px 2px rgba(0, 0, 0, .12); }

.btn.disabled,
.btn[disabled],
fieldset[disabled] .btn {
    opacity: .55;
    box-shadow: none;
    cursor: not-allowed;
}

.btn + .btn { margin-inline-start: var(--rds-space-2); }

/* Sizes */
.btn-lg { min-height: var(--rds-control-height-lg); padding: 11px var(--rds-space-5); font-size: var(--rds-font-size-md); border-radius: var(--rds-radius-md); }
.btn-sm { min-height: var(--rds-control-height-sm); padding: 5px var(--rds-space-3); font-size: var(--rds-font-size-sm); }
.btn-xs { min-height: 26px; padding: 3px 10px; font-size: var(--rds-font-size-xs); }
.btn-block { display: flex; width: 100%; }
.btn-block + .btn-block { margin-inline-start: 0; margin-top: var(--rds-space-2); }

/* Variants */
.btn-primary {
    background-color: var(--rds-primary-600);
    border-color: var(--rds-primary-600);
    color: var(--rds-on-primary);
}

.btn-primary:hover,
.btn-primary:focus,
.btn-primary.focus {
    background-color: var(--rds-primary-hover);
    border-color: var(--rds-primary-hover);
    color: #fff;
}

.btn-primary:active,
.btn-primary.active,
.open > .dropdown-toggle.btn-primary {
    background-color: var(--rds-primary-active);
    border-color: var(--rds-primary-active);
    color: #fff;
}

.btn-default {
    background-color: var(--rds-bg-surface);
    border-color: var(--rds-border-color-strong);
    color: var(--rds-neutral-700);
}

.btn-default:hover,
.btn-default:focus,
.btn-default.focus {
    background-color: var(--rds-neutral-100);
    border-color: var(--rds-neutral-400);
    color: var(--rds-neutral-900);
}

.btn-default:active,
.btn-default.active,
.open > .dropdown-toggle.btn-default {
    background-color: var(--rds-neutral-200);
    border-color: var(--rds-neutral-400);
    color: var(--rds-neutral-900);
}

.btn-success { background-color: var(--rds-success); border-color: var(--rds-success); color: #fff; }
.btn-success:hover, .btn-success:focus, .btn-success:active, .btn-success.active { background-color: #14682f; border-color: #14682f; color: #fff; }

.btn-info { background-color: var(--rds-info); border-color: var(--rds-info); color: #fff; }
.btn-info:hover, .btn-info:focus, .btn-info:active, .btn-info.active { background-color: #025a89; border-color: #025a89; color: #fff; }

.btn-warning { background-color: var(--rds-accent-600); border-color: var(--rds-accent-600); color: #fff; }
.btn-warning:hover, .btn-warning:focus, .btn-warning:active, .btn-warning.active { background-color: var(--rds-accent-700); border-color: var(--rds-accent-700); color: #fff; }

.btn-danger { background-color: var(--rds-danger); border-color: var(--rds-danger); color: #fff; }
.btn-danger:hover, .btn-danger:focus, .btn-danger:active, .btn-danger.active { background-color: #991b1b; border-color: #991b1b; color: #fff; }

.btn-link {
    background: transparent;
    border-color: transparent;
    box-shadow: none;
    color: var(--rds-link);
    padding-inline: var(--rds-space-2);
}

.btn-link:hover, .btn-link:focus { color: var(--rds-link-hover); text-decoration: underline; background: transparent; box-shadow: none; }

/* Subtle/outline variants for secondary actions in new markup */
.rds-btn-soft {
    background-color: var(--rds-primary-50);
    border-color: var(--rds-primary-100);
    color: var(--rds-primary-800);
}

.rds-btn-soft:hover, .rds-btn-soft:focus { background-color: var(--rds-primary-100); color: var(--rds-primary-900); }

.rds-btn-outline {
    background-color: transparent;
    border-color: var(--rds-primary-600);
    color: var(--rds-primary-700);
}

.rds-btn-outline:hover, .rds-btn-outline:focus { background-color: var(--rds-primary-50); color: var(--rds-primary-800); }

/* Icon-only button */
.rds-btn-icon {
    width: var(--rds-control-height);
    min-width: var(--rds-control-height);
    padding: 0;
}

.rds-btn-icon.btn-sm { width: var(--rds-control-height-sm); min-width: var(--rds-control-height-sm); }
.rds-btn-icon.btn-xs { width: 26px; min-width: 26px; }

.btn [class^="icon-"],
.btn [class*=" icon-"],
.btn .fa, .btn .fas, .btn .far {
    margin-left: 0;
    margin-right: 0;
    font-weight: normal;
}

/* Legacy oversized icons inside small buttons */
.btn .fa-2x { font-size: 1.15em; }

.btn-group > .btn { box-shadow: none; }
.btn-group > .btn + .btn { margin-inline-start: -1px; }
.btn-group > .btn:first-child { border-radius: var(--rds-radius-sm) 0 0 var(--rds-radius-sm); }
.btn-group > .btn:last-child { border-radius: 0 var(--rds-radius-sm) var(--rds-radius-sm) 0; }
.btn-group > .btn:only-child { border-radius: var(--rds-radius-sm); }

/* Inputs styled as buttons (input[type=submit].btn) need flex removed. */
input.btn, button.btn { display: inline-block; }
input.btn.btn-block, button.btn.btn-block { display: block; width: 100%; }


/* ==========================================================================
   08. FORMS & FORM CONTROLS
   ========================================================================== */

label,
.control-label {
    display: inline-block;
    margin-bottom: 6px;
    font-size: var(--rds-font-size-sm);
    font-weight: var(--rds-font-weight-medium);
    color: var(--rds-neutral-700);
}

.form-group { margin-bottom: var(--rds-space-4); }

.form-control {
    display: block;
    width: 100%;
    height: var(--rds-control-height);
    padding: 7px var(--rds-control-padding-x);
    background-color: var(--rds-bg-surface);
    background-image: none;
    border: 1px solid var(--rds-border-color-strong);
    border-radius: var(--rds-radius-sm);
    color: var(--rds-text);
    font-family: inherit;
    font-size: var(--rds-font-size-base);
    line-height: 1.5;
    box-shadow: none;
    transition: border-color var(--rds-transition-fast), box-shadow var(--rds-transition-fast);
}

.form-control:hover { border-color: var(--rds-neutral-400); }

.form-control:focus {
    border-color: var(--rds-primary-500);
    box-shadow: var(--rds-focus-ring);
    outline: none;
}

.form-control::placeholder { color: var(--rds-text-subtle); }

.form-control[disabled],
.form-control[readonly],
fieldset[disabled] .form-control {
    background-color: var(--rds-neutral-100);
    color: var(--rds-text-muted);
    cursor: not-allowed;
    opacity: 1;
}

textarea.form-control { height: auto; min-height: 84px; padding: 10px var(--rds-control-padding-x); resize: vertical; }

select.form-control {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    padding-inline-end: 34px;
    background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 11px center;
    background-size: 15px;
}

[dir="rtl"] select.form-control { background-position: left 11px center; }

select.form-control[multiple], select.form-control[size] { height: auto; background-image: none; padding-inline-end: var(--rds-control-padding-x); }

.input-sm, .form-control.input-sm { height: var(--rds-control-height-sm); padding: 4px 10px; font-size: var(--rds-font-size-sm); }
.input-lg, .form-control.input-lg { height: var(--rds-control-height-lg); padding: 11px var(--rds-space-4); font-size: var(--rds-font-size-md); }

.input-group-addon {
    background-color: var(--rds-neutral-100);
    border: 1px solid var(--rds-border-color-strong);
    border-radius: var(--rds-radius-sm);
    color: var(--rds-text-muted);
    font-size: var(--rds-font-size-base);
    padding: 7px var(--rds-space-3);
}

.input-group .form-control:first-child,
.input-group-addon:first-child,
.input-group-btn:first-child > .btn { border-top-right-radius: 0; border-bottom-right-radius: 0; }

.input-group .form-control:last-child,
.input-group-addon:last-child,
.input-group-btn:last-child > .btn { border-top-left-radius: 0; border-bottom-left-radius: 0; }

.help-block { font-size: var(--rds-font-size-sm); color: var(--rds-text-muted); margin-top: 6px; }

/* Validation states (jQuery unobtrusive validation hooks) */
.field-validation-error,
.text-danger,
.validation-summary-errors ul li { color: var(--rds-danger) !important; font-size: var(--rds-font-size-sm); }

.input-validation-error,
.has-error .form-control {
    border-color: var(--rds-danger) !important;
    background-color: var(--rds-danger-soft);
}

.input-validation-error:focus,
.has-error .form-control:focus { box-shadow: 0 0 0 3px rgba(185, 28, 28, .18); }

.validation-summary-errors {
    background: var(--rds-danger-soft);
    border: 1px solid var(--rds-danger-border);
    border-radius: var(--rds-radius-md);
    color: var(--rds-danger);
    padding: var(--rds-space-3) var(--rds-space-4);
    margin-bottom: var(--rds-space-4);
}

.validation-summary-errors ul { margin: 0; padding-inline-start: var(--rds-space-5); }
.validation-summary-valid { display: none; }

.has-error .control-label { color: var(--rds-danger); }
.has-success .form-control { border-color: var(--rds-success); }

/* Checkboxes & radios */
.checkbox, .radio { margin-top: 6px; margin-bottom: 6px; }
.checkbox label, .radio label { font-weight: var(--rds-font-weight-normal); color: var(--rds-text); padding-inline-start: 22px; }

input[type="checkbox"],
input[type="radio"] {
    width: 16px;
    height: 16px;
    accent-color: var(--rds-primary-600);
    cursor: pointer;
    vertical-align: middle;
}

input[type="file"] {
    display: block;
    width: 100%;
    font-size: var(--rds-font-size-sm);
    color: var(--rds-text-muted);
}

input[type="file"]::file-selector-button {
    margin-inline-end: var(--rds-space-3);
    padding: 7px var(--rds-space-4);
    border: 1px solid var(--rds-border-color-strong);
    border-radius: var(--rds-radius-sm);
    background: var(--rds-bg-surface);
    color: var(--rds-neutral-700);
    font-family: inherit;
    font-size: var(--rds-font-size-sm);
    font-weight: var(--rds-font-weight-medium);
    cursor: pointer;
}

input[type="file"]::file-selector-button:hover { background: var(--rds-neutral-100); }

fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }

legend {
    width: 100%;
    padding-bottom: var(--rds-space-2);
    margin-bottom: var(--rds-space-4);
    border-bottom: var(--rds-border);
    font-size: var(--rds-font-size-md);
    font-weight: var(--rds-font-weight-semibold);
    color: var(--rds-text-heading);
}

/* Legacy filter bars built with .navbar inside panels */
.panel .navbar,
.panel-body > .navbar,
.navbar.navbar-default {
    background: var(--rds-bg-muted);
    border: var(--rds-border);
    border-radius: var(--rds-radius-md);
    box-shadow: none;
    min-height: 0;
    margin-bottom: var(--rds-space-5);
}

.filter-wrapper {
    background-color: var(--rds-bg-muted);
    border: var(--rds-border);
    border-radius: var(--rds-radius-md);
    color: var(--rds-text);
    padding: var(--rds-space-4);
}

/* select2 alignment with the design system */
.select2-container .select2-choice,
.select2-container--default .select2-selection--single {
    height: var(--rds-control-height) !important;
    border: 1px solid var(--rds-border-color-strong) !important;
    border-radius: var(--rds-radius-sm) !important;
    background: var(--rds-bg-surface) !important;
    box-shadow: none !important;
}

.select2-container--default .select2-selection--single .select2-selection__rendered {
    line-height: calc(var(--rds-control-height) - 2px) !important;
    color: var(--rds-text) !important;
    padding-inline-start: var(--rds-control-padding-x);
}

.select2-container--default .select2-selection--single .select2-selection__arrow { height: calc(var(--rds-control-height) - 2px) !important; }
.select2-dropdown { border-color: var(--rds-border-color-strong); border-radius: var(--rds-radius-sm); box-shadow: var(--rds-shadow-md); }
.select2-container--default .select2-results__option--highlighted[aria-selected] { background-color: var(--rds-primary-600); }

.form-group > .select2-container,
.modal-body .select2-container {
    display: block !important;
    width: 100% !important;
    margin-top: 0;
}

.modal-body .form-group > label {
    display: block;
}

/* jQuery UI datepicker */
.ui-datepicker {
    border: var(--rds-border) !important;
    border-radius: var(--rds-radius-md) !important;
    box-shadow: var(--rds-shadow-lg) !important;
    padding: var(--rds-space-2) !important;
    background: var(--rds-bg-surface) !important;
    font-family: var(--rds-font-sans) !important;
    font-size: var(--rds-font-size-sm) !important;
}

.ui-datepicker .ui-datepicker-header {
    background: transparent !important;
    border: 0 !important;
    border-radius: var(--rds-radius-sm) !important;
    color: var(--rds-text-heading) !important;
    font-weight: var(--rds-font-weight-semibold);
}

.ui-datepicker td a, .ui-datepicker td span { border-radius: var(--rds-radius-xs) !important; text-align: center; }
.ui-datepicker .ui-state-active { background: var(--rds-primary-600) !important; color: #fff !important; border-color: var(--rds-primary-600) !important; }

/* Dropzone */
.dropzone {
    border: 2px dashed var(--rds-border-color-strong) !important;
    border-radius: var(--rds-radius-lg) !important;
    background: var(--rds-bg-muted) !important;
    min-height: 140px;
}

.dropzone:hover { border-color: var(--rds-primary-400) !important; background: var(--rds-primary-50) !important; }


/* ==========================================================================
   09. TABLES & DATATABLES
   ========================================================================== */

.table {
    width: 100%;
    max-width: 100%;
    margin-bottom: var(--rds-space-4);
    background-color: var(--rds-bg-surface);
    border-collapse: separate;
    border-spacing: 0;
    font-size: var(--rds-font-size-base);
}

.table > thead > tr > th,
.table > tbody > tr > th,
.table > tfoot > tr > th,
.table > thead > tr > td,
.table > tbody > tr > td,
.table > tfoot > tr > td {
    padding: 10px var(--rds-space-3);
    vertical-align: middle;
    border-top: 0;
    border-bottom: var(--rds-border);
    line-height: var(--rds-line-height-base);
}

.table > thead > tr > th {
    background-color: var(--rds-neutral-50);
    border-bottom: 1px solid var(--rds-border-color-strong);
    color: var(--rds-neutral-600);
    font-size: var(--rds-font-size-sm);
    font-weight: var(--rds-font-weight-semibold);
    text-transform: uppercase;
    letter-spacing: .4px;
    white-space: nowrap;
    vertical-align: middle;
}

.table > tbody > tr:last-child > td { border-bottom: 0; }

.table-striped > tbody > tr:nth-of-type(odd) { background-color: var(--rds-neutral-25); }
.table-hover > tbody > tr:hover { background-color: var(--rds-primary-50); }

.table-bordered,
.table-bordered > thead > tr > th,
.table-bordered > tbody > tr > th,
.table-bordered > tfoot > tr > th,
.table-bordered > thead > tr > td,
.table-bordered > tbody > tr > td,
.table-bordered > tfoot > tr > td { border: var(--rds-border); }

.table-condensed > thead > tr > th,
.table-condensed > tbody > tr > td { padding: 6px var(--rds-space-2); }

.table > tbody > tr.success > td { background-color: var(--rds-success-soft); }
.table > tbody > tr.danger > td { background-color: var(--rds-danger-soft); }
.table > tbody > tr.warning > td { background-color: var(--rds-warning-soft); }
.table > tbody > tr.info > td { background-color: var(--rds-info-soft); }

/* Horizontal scroll container — the key to usable tables on small screens. */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border: 0;
    margin-bottom: var(--rds-space-4);
}

.table-responsive > .table { margin-bottom: 0; }

/* DataTables chrome */
.dataTables_wrapper { padding: 0; }

.dataTables_wrapper .dataTables_length,
.dataTables_wrapper .dataTables_filter,
.dataTables_wrapper .dataTables_info,
.dataTables_wrapper .dataTables_paginate {
    font-size: var(--rds-font-size-sm);
    color: var(--rds-text-muted);
    padding: var(--rds-space-2) 0;
}

.dataTables_wrapper .dataTables_length select,
.dataTables_wrapper .dataTables_filter input {
    height: var(--rds-control-height-sm);
    padding: 3px 10px;
    border: 1px solid var(--rds-border-color-strong);
    border-radius: var(--rds-radius-sm);
    background: var(--rds-bg-surface);
    color: var(--rds-text);
    font-size: var(--rds-font-size-sm);
    margin-inline: 6px;
}

.dataTables_wrapper .dataTables_filter input:focus,
.dataTables_wrapper .dataTables_length select:focus { border-color: var(--rds-primary-500); box-shadow: var(--rds-focus-ring); outline: none; }

.dataTables_wrapper .dataTables_paginate .paginate_button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 32px;
    padding: 0 10px !important;
    margin: 0 2px;
    border: var(--rds-border) !important;
    border-radius: var(--rds-radius-sm) !important;
    background: var(--rds-bg-surface) !important;
    color: var(--rds-neutral-700) !important;
    font-size: var(--rds-font-size-sm);
    cursor: pointer;
}

.dataTables_wrapper .dataTables_paginate .paginate_button:hover {
    background: var(--rds-neutral-100) !important;
    border-color: var(--rds-border-color-strong) !important;
    color: var(--rds-neutral-900) !important;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.current,
.dataTables_wrapper .dataTables_paginate .paginate_button.current:hover {
    background: var(--rds-primary-600) !important;
    border-color: var(--rds-primary-600) !important;
    color: #fff !important;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.disabled,
.dataTables_wrapper .dataTables_paginate .paginate_button.disabled:hover {
    background: transparent !important;
    border-color: var(--rds-border-color) !important;
    color: var(--rds-text-subtle) !important;
    cursor: default;
}

table.dataTable thead th.sorting,
table.dataTable thead th.sorting_asc,
table.dataTable thead th.sorting_desc { cursor: pointer; }

/* DataTables export buttons */
div.dt-buttons,
div.html5buttons {
    display: inline-flex;
    flex-wrap: wrap;
    gap: var(--rds-space-2);
    margin-bottom: var(--rds-space-3);
    float: none;
}

.dt-button,
div.html5buttons a.dt-button,
.dt-buttons .dt-button {
    display: inline-flex !important;
    align-items: center;
    gap: 6px;
    min-height: var(--rds-control-height-sm);
    padding: 5px var(--rds-space-3) !important;
    margin: 0 !important;
    border: var(--rds-border) !important;
    border-radius: var(--rds-radius-sm) !important;
    background: var(--rds-bg-surface) !important;
    background-image: none !important;
    box-shadow: var(--rds-shadow-xs) !important;
    color: var(--rds-neutral-700) !important;
    font-size: var(--rds-font-size-sm) !important;
    font-weight: var(--rds-font-weight-medium);
    text-shadow: none !important;
}

.dt-button:hover,
.dt-buttons .dt-button:hover {
    background: var(--rds-primary-50) !important;
    border-color: var(--rds-primary-200) !important;
    color: var(--rds-primary-800) !important;
}

.dt-button-collection {
    border-radius: var(--rds-radius-md) !important;
    box-shadow: var(--rds-shadow-lg) !important;
    border-color: var(--rds-border-color) !important;
    padding: var(--rds-space-2) !important;
}

/* DataTables places controls in a fluid row; keep them from overflowing. */
.dataTables_wrapper .row { margin-left: 0; margin-right: 0; }
.dataTables_wrapper .col-sm-6, .dataTables_wrapper .col-sm-12 { padding-left: 0; padding-right: 0; }

/* Any table living directly in a panel body gets a scroll wrapper look. */
.panel-body > .table,
.panel-body > .dataTables_wrapper { max-width: 100%; }


/* ==========================================================================
   10. MODALS
   ========================================================================== */

.modal-backdrop.in { opacity: .5; background-color: var(--rds-neutral-900); }

.modal-dialog { margin: var(--rds-space-7) auto; }

.modal-content {
    border: 0;
    border-radius: var(--rds-radius-lg);
    box-shadow: var(--rds-shadow-xl);
    background-color: var(--rds-bg-surface);
    overflow: hidden;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--rds-space-3);
    padding: var(--rds-space-4) var(--rds-space-5);
    border-bottom: var(--rds-border);
    background: var(--rds-bg-surface);
}

/* Bootstrap 3 clearfix pseudo-elements become extra flex items and shove the close button aside. */
.modal-header:before,
.modal-header:after {
    content: none;
    display: none;
}

.modal-title,
.modal-header > h1,
.modal-header > h2,
.modal-header > h3,
.modal-header > h4,
.modal-header > h5,
.modal-header > h6 {
    margin: 0;
    flex: 1;
    order: 1;
    font-family: inherit;
    font-size: var(--rds-font-size-lg);
    font-weight: var(--rds-font-weight-semibold);
    color: var(--rds-text-heading);
    line-height: var(--rds-line-height-tight);
}

.modal-header .close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    margin: 0;
    margin-inline-start: auto;
    padding: 0;
    float: none;
    order: 2;
    flex-shrink: 0;
    border: 0;
    border-radius: var(--rds-radius-sm);
    background: transparent;
    color: var(--rds-text-muted);
    font-size: 22px;
    line-height: 1;
    opacity: 1;
    text-shadow: none;
    cursor: pointer;
}

.modal-header .close:hover { background: var(--rds-neutral-100); color: var(--rds-neutral-900); opacity: 1; }

.modal-body { padding: var(--rds-space-5); }

.modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: var(--rds-space-2);
    padding: var(--rds-space-4) var(--rds-space-5);
    border-top: var(--rds-border);
    background: var(--rds-bg-muted);
}

.modal-footer .btn { min-width: 88px; }
.modal-footer .btn + .btn { margin-inline-start: 0; margin-bottom: 0; }
.modal-footer .btn-default { order: 1; }
.modal-footer .btn-primary,
.modal-footer .btn-success { order: 2; }

/* The session switcher uses a hand-rolled modal toggled via inline style. */
#sessionModal {
    position: fixed;
    inset: 0;
    z-index: var(--rds-z-modal);
    background: rgba(15, 23, 42, .5);
    overflow-y: auto;
}

#sessionModal .modal-dialog { margin: 12vh auto; max-width: 460px; width: 92%; }

#sessionModal .modal-content {
    position: relative;
    background: var(--rds-bg-surface);
    border-radius: var(--rds-radius-lg);
    box-shadow: var(--rds-shadow-xl);
}

#sessionModal #selectSession {
    display: block;
    width: 100%;
    height: var(--rds-control-height);
    margin-top: 0;
}


/* ==========================================================================
   11. ALERTS, BADGES, TOASTS
   ========================================================================== */

.alert {
    padding: var(--rds-space-4) var(--rds-space-5);
    margin-bottom: var(--rds-space-5);
    border: 1px solid transparent;
    border-radius: var(--rds-radius-md);
    font-size: var(--rds-font-size-base);
    box-shadow: var(--rds-shadow-xs);
}

.alert h4 { color: inherit; margin-top: 0; }
.alert .close { color: inherit; opacity: .6; text-shadow: none; }
.alert .close:hover { opacity: 1; }

.alert-success { background-color: var(--rds-success-soft); border-color: var(--rds-success-border); color: var(--rds-success); }
.alert-info { background-color: var(--rds-info-soft); border-color: var(--rds-info-border); color: var(--rds-info); }
.alert-warning { background-color: var(--rds-warning-soft); border-color: var(--rds-warning-border); color: var(--rds-warning); }
.alert-danger { background-color: var(--rds-danger-soft); border-color: var(--rds-danger-border); color: var(--rds-danger); }

.badge,
.label {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: var(--rds-radius-pill);
    font-size: var(--rds-font-size-xs);
    font-weight: var(--rds-font-weight-semibold);
    line-height: 1.5;
    letter-spacing: .2px;
    text-transform: none;
    vertical-align: middle;
}

.badge { background-color: var(--rds-neutral-500); color: #fff; }

.label-default { background-color: var(--rds-neutral-100); color: var(--rds-neutral-700); }
.label-primary { background-color: var(--rds-primary-50); color: var(--rds-primary-800); }
.label-success { background-color: var(--rds-success-soft); color: var(--rds-success); }
.label-info { background-color: var(--rds-info-soft); color: var(--rds-info); }
.label-warning { background-color: var(--rds-warning-soft); color: var(--rds-warning); }
.label-danger { background-color: var(--rds-danger-soft); color: var(--rds-danger); }

/* Status badge component for new markup */
.rds-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px;
    border: 1px solid transparent;
    border-radius: var(--rds-radius-pill);
    font-size: var(--rds-font-size-xs);
    font-weight: var(--rds-font-weight-semibold);
    line-height: 1.6;
}

.rds-badge--neutral { background: var(--rds-neutral-100); border-color: var(--rds-neutral-200); color: var(--rds-neutral-700); }
.rds-badge--primary { background: var(--rds-primary-50); border-color: var(--rds-primary-100); color: var(--rds-primary-800); }
.rds-badge--success { background: var(--rds-success-soft); border-color: var(--rds-success-border); color: var(--rds-success); }
.rds-badge--warning { background: var(--rds-warning-soft); border-color: var(--rds-warning-border); color: var(--rds-warning); }
.rds-badge--danger { background: var(--rds-danger-soft); border-color: var(--rds-danger-border); color: var(--rds-danger); }

/* toastr */
#toast-container > div {
    border-radius: var(--rds-radius-md) !important;
    box-shadow: var(--rds-shadow-lg) !important;
    opacity: 1 !important;
    padding: var(--rds-space-4) var(--rds-space-4) var(--rds-space-4) 50px !important;
    font-family: var(--rds-font-sans);
    font-size: var(--rds-font-size-base);
}

#toast-container > div:hover { box-shadow: var(--rds-shadow-xl) !important; }
#toast-container > .toast-success { background-color: #16794a !important; }
#toast-container > .toast-error { background-color: #b91c1c !important; }
#toast-container > .toast-info { background-color: #0369a1 !important; }
#toast-container > .toast-warning { background-color: #b45309 !important; }
.toast-title { font-weight: var(--rds-font-weight-semibold); }
.toast-message { font-size: var(--rds-font-size-sm); }

/* Bootstrap "well" used as a light container in a few views */
.well {
    background-color: var(--rds-bg-muted);
    border: var(--rds-border);
    border-radius: var(--rds-radius-md);
    box-shadow: none;
    padding: var(--rds-space-4);
}


/* ==========================================================================
   12. TABS, PAGINATION, DROPDOWNS, LIST GROUPS
   ========================================================================== */

.nav-tabs {
    border-bottom: 1px solid var(--rds-border-color);
    display: flex;
    flex-wrap: wrap;
    gap: 2px;
    padding: 0 var(--rds-space-3);
}

.nav-tabs > li { float: none; margin-bottom: -1px; }

.nav-tabs > li > a {
    margin: 0;
    padding: 11px var(--rds-space-4);
    border: 0;
    border-bottom: 2px solid transparent;
    border-radius: 0;
    color: var(--rds-text-muted);
    font-size: var(--rds-font-size-base);
    font-weight: var(--rds-font-weight-medium);
    background: transparent;
}

.nav-tabs > li > a:hover,
.nav-tabs > li > a:focus { background: transparent; border-color: transparent; border-bottom-color: var(--rds-neutral-300); color: var(--rds-text); }

.nav-tabs > li.active > a,
.nav-tabs > li.active > a:hover,
.nav-tabs > li.active > a:focus {
    background: transparent;
    border: 0;
    border-bottom: 2px solid var(--rds-primary-600);
    color: var(--rds-primary-700);
    font-weight: var(--rds-font-weight-semibold);
}

.tabs-container .tab-content { padding: 0; }
.tab-content > .tab-pane { padding-top: var(--rds-space-2); }

.nav-pills > li > a { border-radius: var(--rds-radius-pill); color: var(--rds-text-muted); font-weight: var(--rds-font-weight-medium); }
.nav-pills > li.active > a, .nav-pills > li.active > a:hover, .nav-pills > li.active > a:focus { background-color: var(--rds-primary-600); color: #fff; }

.pagination { border-radius: var(--rds-radius-sm); }

.pagination > li > a,
.pagination > li > span {
    min-width: 34px;
    padding: 6px 11px;
    border: var(--rds-border);
    color: var(--rds-neutral-700);
    font-size: var(--rds-font-size-sm);
    text-align: center;
}

.pagination > li:first-child > a, .pagination > li:first-child > span { border-radius: var(--rds-radius-sm) 0 0 var(--rds-radius-sm); }
.pagination > li:last-child > a, .pagination > li:last-child > span { border-radius: 0 var(--rds-radius-sm) var(--rds-radius-sm) 0; }
.pagination > li > a:hover, .pagination > li > span:hover { background-color: var(--rds-neutral-100); color: var(--rds-neutral-900); }

.pagination > .active > a,
.pagination > .active > span,
.pagination > .active > a:hover,
.pagination > .active > span:hover {
    background-color: var(--rds-primary-600);
    border-color: var(--rds-primary-600);
    color: #fff;
}

.pagination > .disabled > span, .pagination > .disabled > a { color: var(--rds-text-subtle); background: var(--rds-neutral-50); }

.dropdown-menu {
    border: var(--rds-border);
    border-radius: var(--rds-radius-md);
    box-shadow: var(--rds-shadow-lg);
    padding: 6px;
    font-size: var(--rds-font-size-base);
    min-width: 190px;
}

.dropdown-menu > li > a {
    display: flex;
    align-items: center;
    gap: var(--rds-space-2);
    padding: 8px var(--rds-space-3);
    border-radius: var(--rds-radius-sm);
    color: var(--rds-neutral-700);
    font-size: var(--rds-font-size-base);
}

.dropdown-menu > li > a:hover,
.dropdown-menu > li > a:focus { background-color: var(--rds-neutral-100); color: var(--rds-neutral-900); }

.dropdown-menu > .active > a, .dropdown-menu > .active > a:hover { background-color: var(--rds-primary-600); color: #fff; }
.dropdown-menu .divider { background-color: var(--rds-border-color); margin: 6px 0; }

.list-group { border-radius: var(--rds-radius-md); }
.list-group-item { border-color: var(--rds-border-color); padding: var(--rds-space-3) var(--rds-space-4); }
.list-group-item:first-child { border-radius: var(--rds-radius-md) var(--rds-radius-md) 0 0; }
.list-group-item:last-child { border-radius: 0 0 var(--rds-radius-md) var(--rds-radius-md); }

.progress { height: 8px; border-radius: var(--rds-radius-pill); background-color: var(--rds-neutral-200); box-shadow: none; }
.progress-bar { background-color: var(--rds-primary-600); box-shadow: none; }

/* Wizard steps used by the bootstrap wizard plugin */
.wizard-steps > li > a { border-radius: var(--rds-radius-sm); }
.wizard-steps > li.completed > a { color: var(--rds-success); }


/* ==========================================================================
   13. UTILITIES, LOADING & EMPTY STATES
   ========================================================================== */

.text-muted { color: var(--rds-text-muted) !important; }
.text-primary { color: var(--rds-primary-700) !important; }
.text-success { color: var(--rds-success) !important; }
.text-info { color: var(--rds-info) !important; }
.text-warning { color: var(--rds-warning) !important; }

.rds-stack { display: flex; flex-direction: column; gap: var(--rds-space-4); }
.rds-row { display: flex; flex-wrap: wrap; gap: var(--rds-space-3); align-items: center; }
.rds-row--end { justify-content: flex-end; }
.rds-row--between { justify-content: space-between; }

.rds-mt-0 { margin-top: 0 !important; }
.rds-mb-0 { margin-bottom: 0 !important; }
.rds-mb-2 { margin-bottom: var(--rds-space-2) !important; }
.rds-mb-4 { margin-bottom: var(--rds-space-4) !important; }
.rds-mb-5 { margin-bottom: var(--rds-space-5) !important; }
.rds-gap-2 { gap: var(--rds-space-2) !important; }
.rds-gap-3 { gap: var(--rds-space-3) !important; }

/* Loading overlay (markup already present in every layout) */
.spinner {
    display: none;
    position: fixed;
    inset: 0;
    z-index: var(--rds-z-spinner);
    width: 100%;
    height: 100%;
    background-color: rgba(15, 23, 42, .45);
    backdrop-filter: blur(1px);
    opacity: 1;
    filter: none;
}

.spinner .center-div {
    position: absolute;
    top: 50%;
    left: 50%;
    width: auto;
    height: auto;
    margin: 0;
    transform: translate(-50%, -50%);
}

.spinner .inner-div {
    display: flex;
    align-items: center;
    justify-content: center;
    width: auto;
    padding: var(--rds-space-6);
    background-color: var(--rds-bg-surface);
    border-radius: var(--rds-radius-lg);
    box-shadow: var(--rds-shadow-xl);
}

.spinner .loader {
    width: 44px;
    height: 44px;
    margin: 0;
    border: 4px solid var(--rds-neutral-200);
    border-top-color: var(--rds-primary-600);
    border-bottom-color: var(--rds-primary-600);
    border-radius: 50%;
    animation: spin 900ms linear infinite;
}

/* Skeleton / empty state */
.rds-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--rds-space-3);
    padding: var(--rds-space-9) var(--rds-space-5);
    text-align: center;
    color: var(--rds-text-muted);
}

.rds-empty-state__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    border-radius: var(--rds-radius-pill);
    background: var(--rds-primary-50);
    color: var(--rds-primary-600);
    font-size: 24px;
}

.rds-empty-state__title { margin: 0; font-size: var(--rds-font-size-md); font-weight: var(--rds-font-weight-semibold); color: var(--rds-text-heading); }
.rds-empty-state__text { margin: 0; font-size: var(--rds-font-size-sm); max-width: 420px; }

/* Media that must never blow out its container */
img, svg, video, canvas, iframe, embed, object { max-width: 100%; }
table img { max-width: none; }
pre { overflow-x: auto; }

/* Prevent long unbroken strings (IDs, emails) from forcing horizontal scroll */
.panel-body, .modal-body, .rds-card__body { overflow-wrap: break-word; }


/* ==========================================================================
   13c. ERROR / STATUS PAGES
   ========================================================================== */

.page-error-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 60vh;
    padding: var(--rds-space-7) var(--rds-space-4);
}

.page-error-content {
    width: 100%;
    max-width: 520px;
    padding: var(--rds-space-8) var(--rds-space-6);
    background: var(--rds-bg-surface);
    border: var(--rds-border);
    border-radius: var(--rds-radius-lg);
    box-shadow: var(--rds-shadow-sm);
    text-align: center;
}

.page-error-content .error-code {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 96px;
    height: 96px;
    margin-bottom: var(--rds-space-5);
    padding: 0 var(--rds-space-4);
    border-radius: var(--rds-radius-xl);
    background: var(--rds-primary-50);
    color: var(--rds-primary-700);
    font-size: 38px;
    font-weight: var(--rds-font-weight-bold);
    line-height: 1;
}

.page-error-content .title {
    margin: 0 0 var(--rds-space-2);
    font-size: var(--rds-font-size-xl);
    font-weight: var(--rds-font-weight-semibold);
    color: var(--rds-text-heading);
}

.page-error-content p { color: var(--rds-text-muted); margin-bottom: var(--rds-space-4); }
.page-error-content p:last-child { margin-bottom: 0; }
.page-error-content code { background: var(--rds-neutral-100); color: var(--rds-neutral-700); border-radius: var(--rds-radius-xs); padding: 2px 8px; }

body.page-error { background-color: var(--rds-bg-app); }


/* ==========================================================================
   13a. MODULE LAUNCHER
   ========================================================================== */

.rds-module-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: var(--rds-space-4);
    margin-bottom: var(--rds-space-6);
}

.rds-module {
    --rds-module-accent: var(--rds-primary-600);
    --rds-module-accent-soft: var(--rds-primary-50);

    position: relative;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: var(--rds-space-1);
    padding: var(--rds-space-5);
    background: var(--rds-bg-surface);
    border: var(--rds-border);
    border-radius: var(--rds-radius-lg);
    box-shadow: var(--rds-shadow-sm);
    color: var(--rds-text);
    overflow: hidden;
    transition: border-color var(--rds-transition), box-shadow var(--rds-transition), transform var(--rds-transition);
}

.rds-module::before {
    content: "";
    position: absolute;
    top: 0;
    inset-inline-start: 0;
    width: 100%;
    height: 3px;
    background: var(--rds-module-accent);
}

a.rds-module:hover,
a.rds-module:focus {
    border-color: var(--rds-module-accent);
    box-shadow: var(--rds-shadow-md);
    color: var(--rds-text);
    transform: translateY(-2px);
}

.rds-module__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 46px;
    height: 46px;
    margin-bottom: var(--rds-space-3);
    border-radius: var(--rds-radius-md);
    background: var(--rds-module-accent-soft);
    color: var(--rds-module-accent);
    font-size: 20px;
}

.rds-module__title {
    font-size: var(--rds-font-size-lg);
    font-weight: var(--rds-font-weight-semibold);
    color: var(--rds-text-heading);
    line-height: var(--rds-line-height-tight);
}

.rds-module__desc {
    font-size: var(--rds-font-size-sm);
    color: var(--rds-text-muted);
    line-height: var(--rds-line-height-base);
}

.rds-module__lock {
    position: absolute;
    top: var(--rds-space-4);
    inset-inline-end: var(--rds-space-4);
    color: var(--rds-text-subtle);
    font-size: 13px;
}

.rds-module--disabled {
    background: var(--rds-neutral-50);
    box-shadow: none;
    cursor: not-allowed;
    pointer-events: none;
}

.rds-module--disabled::before { background: var(--rds-neutral-300); }
.rds-module--disabled .rds-module__icon { background: var(--rds-neutral-100); color: var(--rds-neutral-400); }
.rds-module--disabled .rds-module__title { color: var(--rds-neutral-500); }
.rds-module--disabled .rds-module__desc { color: var(--rds-text-subtle); }

/* Accent variants — all drawn from the token palette. */
.rds-module--indigo { --rds-module-accent: #4f46e5; --rds-module-accent-soft: #eef2ff; }
.rds-module--blue { --rds-module-accent: #0369a1; --rds-module-accent-soft: #f0f9ff; }
.rds-module--cyan { --rds-module-accent: var(--rds-primary-600); --rds-module-accent-soft: var(--rds-primary-50); }
.rds-module--teal { --rds-module-accent: #0f766e; --rds-module-accent-soft: #f0fdfa; }
.rds-module--green { --rds-module-accent: var(--rds-success); --rds-module-accent-soft: var(--rds-success-soft); }
.rds-module--amber { --rds-module-accent: var(--rds-accent-600); --rds-module-accent-soft: var(--rds-accent-50); }
.rds-module--red { --rds-module-accent: var(--rds-danger); --rds-module-accent-soft: var(--rds-danger-soft); }
.rds-module--violet { --rds-module-accent: #7c3aed; --rds-module-accent-soft: #f5f3ff; }
.rds-module--slate { --rds-module-accent: var(--rds-neutral-700); --rds-module-accent-soft: var(--rds-neutral-100); }

@media (max-width: 480px) {
    .rds-module-grid { grid-template-columns: 1fr; gap: var(--rds-space-3); }
    .rds-module { padding: var(--rds-space-4); }
    .rds-module__icon { width: 40px; height: 40px; font-size: 17px; margin-bottom: var(--rds-space-2); }
}


/* ==========================================================================
   13b. AUTHENTICATION PAGES (login / forgot password / registration)
   ========================================================================== */

body.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: var(--rds-space-5);
    background-color: var(--rds-primary-950);
    background-image: radial-gradient(1200px 600px at 15% 0%, var(--rds-primary-800) 0%, transparent 60%),
                      radial-gradient(900px 500px at 90% 100%, var(--rds-primary-700) 0%, transparent 55%),
                      linear-gradient(160deg, var(--rds-primary-950) 0%, #071e2b 100%);
    overflow-y: auto;
}

body.login-page .login-container {
    width: 100%;
    max-width: 960px;
    padding: 0;
    margin: auto;
}

.login-shell {
    display: grid;
    grid-template-columns: 1fr 1fr;
    background: var(--rds-bg-surface);
    border-radius: var(--rds-radius-xl);
    box-shadow: var(--rds-shadow-xl);
    overflow: hidden;
}

.login-brand {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--rds-space-8) var(--rds-space-6);
    background: linear-gradient(155deg, var(--rds-primary-700) 0%, var(--rds-primary-900) 100%);
    color: #fff;
}

.login-brand__inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--rds-space-4);
    text-align: center;
    width: 100%;
}

.login-brand__logo {
    width: 68px;
    height: 68px;
    border-radius: var(--rds-radius-lg);
    background: #fff;
    padding: 6px;
    object-fit: contain;
    box-shadow: var(--rds-shadow-md);
}

.login-brand__wordmark {
    width: 190px;
    max-width: 100%;
    height: auto;
}

.login-brand__art {
    width: 240px;
    max-width: 100%;
    height: auto;
}

/* Override the legacy fixed-width login card. */
body.login-page .login-content {
    display: flex;
    flex-direction: column;
    justify-content: center;
    width: auto;
    max-width: none;
    margin: 0;
    padding: var(--rds-space-8) var(--rds-space-7);
    background: var(--rds-bg-surface);
    border-radius: 0;
    box-shadow: none;
    font-size: var(--rds-font-size-base);
}

.login-form__head { margin-bottom: var(--rds-space-6); }

.login-form__title {
    margin: 0;
    font-size: var(--rds-font-size-2xl);
    font-weight: var(--rds-font-weight-bold);
    color: var(--rds-text-heading);
}

.login-form__subtitle {
    margin: var(--rds-space-1) 0 0;
    color: var(--rds-text-muted);
    font-size: var(--rds-font-size-base);
}

/* The legacy sheet strips borders off login inputs — restore the DS control. */
body.login-page .login-content .form-control {
    height: var(--rds-control-height-lg);
    padding: 11px var(--rds-space-4);
    border: 1px solid var(--rds-border-color-strong);
    border-radius: var(--rds-radius-sm);
    font-size: var(--rds-font-size-md);
}

body.login-page .login-content .form-control:focus {
    border-color: var(--rds-primary-500);
    box-shadow: var(--rds-focus-ring);
}

body.login-page .login-content select.form-control { height: var(--rds-control-height-lg); }

.login-form__foot {
    margin: var(--rds-space-2) 0 0;
    text-align: center;
    font-size: var(--rds-font-size-sm);
}

body.login-page .validation-summary-errors { font-size: var(--rds-font-size-sm); }

/* Legacy branding block from the old template */
body.login-page .login-branding { display: none; }

@media (max-width: 767px) {
    body.login-page { padding: var(--rds-space-3); align-items: flex-start; }

    .login-shell { grid-template-columns: 1fr; border-radius: var(--rds-radius-lg); }

    .login-brand { padding: var(--rds-space-6) var(--rds-space-5); }
    .login-brand__art { display: none; }
    .login-brand__logo { width: 56px; height: 56px; }
    .login-brand__wordmark { width: 160px; }

    body.login-page .login-content { padding: var(--rds-space-6) var(--rds-space-5) var(--rds-space-7); }
    .login-form__title { font-size: var(--rds-font-size-xl); }
}


/* ==========================================================================
   13d. LEGACY MARKUP OVERRIDES
   --------------------------------------------------------------------------
   Styles that theme mouldifi / bootstrap patterns still present in ~580 views
   without requiring per-page markup changes.
   ========================================================================== */

/* Neutralise mouldifi grey utility backgrounds */
.gray-bg,
.bg-gray,
.main-header.gray-bg {
    background-color: var(--rds-topbar-bg) !important;
}

/* Search / filter toolbar block used on list pages */
.workingArea {
    margin: 0 var(--rds-space-5) var(--rds-space-5);
    padding: 0;
}

.workingArea > h3,
.workingArea > h3 b {
    margin: 0 0 var(--rds-space-4);
    font-size: var(--rds-font-size-lg);
    font-weight: var(--rds-font-weight-semibold);
    color: var(--rds-text-heading);
}

.workingArea .navbar.navbar-default {
    padding: var(--rds-space-4) !important;
    margin-bottom: 0;
}

.workingArea .navbar-form {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: var(--rds-space-3);
    margin: 0;
    padding: 0;
}

.workingArea .navbar-form .form-group {
    margin-bottom: 0;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--rds-space-2);
}

.workingArea .navbar-form label {
    margin-bottom: 0;
    white-space: nowrap;
}

.workingArea .navbar-form .form-control,
.workingArea .navbar-form select,
.workingArea .navbar-form input[type="text"] {
    width: auto;
    min-width: 140px;
    max-width: 100%;
}

/* Exam module print footer (hidden on screen, shown when printing) */
.print-footer {
    position: absolute;
    display: none;
    bottom: 0;
    width: 100%;
    height: 50px;
    background-color: var(--rds-neutral-100);
    color: var(--rds-text-muted);
    text-align: center;
    line-height: 50px;
    font-size: var(--rds-font-size-sm);
    border-top: var(--rds-border);
}

/* Horizontal form layout used across CRUD views */
.form-horizontal .control-label {
    padding-top: 9px;
}

.form-horizontal .form-group {
    margin-left: 0;
    margin-right: 0;
}

/* PagedList.Mvc pagination */
.pagination-container .pagination {
    margin: var(--rds-space-4) 0 0;
}

/* Module hub content area on the root layout */
body.rds-no-sidebar .main-content .rds-module-grid:last-of-type {
    margin-bottom: var(--rds-space-4);
}

body.rds-no-sidebar .main-content > .alert:last-child {
    margin-bottom: var(--rds-space-6);
}

@media (max-width: 767px) {
    .workingArea {
        margin-left: var(--rds-space-3);
        margin-right: var(--rds-space-3);
    }

    .workingArea .navbar-form {
        flex-direction: column;
        align-items: stretch;
    }

    .workingArea .navbar-form .form-group,
    .workingArea .navbar-form .form-control,
    .workingArea .navbar-form select,
    .workingArea .navbar-form input[type="text"] {
        width: 100%;
        min-width: 0;
    }

    .workingArea .navbar-form .btn {
        width: 100%;
    }
}


/* ==========================================================================
   14. RESPONSIVE PASS
   ========================================================================== */

/* --- Large desktops ------------------------------------------------------- */
@media (min-width: 1600px) {
    .main-content { padding: var(--rds-space-7) var(--rds-space-8); }
}

/* --- Laptops / small desktops (auto-collapse the rail) -------------------- */
@media (max-width: 1199px) {
    .main-content { padding: var(--rds-space-5) var(--rds-space-4); }
    .main-container > .row,
    .main-container > .panel,
    .main-container > .table-responsive,
    .main-container > form { margin-left: var(--rds-space-4); margin-right: var(--rds-space-4); }
}

/* --- Tablet (Bootstrap md/sm boundary) ------------------------------------ */
@media (max-width: 991px) {
    .page-sidebar .sidebar-fixed { position: static; width: 100%; }

    .panel-heading, .card-header { padding: var(--rds-space-3) var(--rds-space-4); }
    .panel-body, .card-body { padding: var(--rds-space-4); }
    .modal-dialog { margin: var(--rds-space-5) auto; width: auto; max-width: 92%; }
}

/* --- Mobile: sidebar becomes an off-canvas drawer ------------------------- */
@media (max-width: 767px) {
    .page-container { display: block; }

    .page-sidebar {
        width: min(84vw, 300px);
        transform: translateX(-100%);
        box-shadow: none;
    }

    [dir="rtl"] .page-sidebar { transform: translateX(100%); }

    /* Bootstrap's .collapse.in on #side-nav (existing JS hook) opens the drawer,
       and .rds-sidebar-open is set by the topbar toggle. */
    .page-sidebar.rds-sidebar-open,
    .page-container.rds-nav-open .page-sidebar {
        transform: translateX(0);
        box-shadow: var(--rds-shadow-xl);
    }

    .page-container.rds-nav-open .rds-sidebar-backdrop { display: block; }

    .main-container,
    footer { margin-inline-start: 0 !important; }

    .page-container.sidebar-collapsed .page-sidebar { width: min(84vw, 300px); }
    .page-container.sidebar-collapsed .main-container { margin-inline-start: 0; }

    /* The collapsed-rail flyouts must not appear on mobile. */
    .sidebar-collapsed .page-sidebar .main-menu > li > a { justify-content: flex-start; padding-inline: var(--rds-space-3); }
    .sidebar-collapsed .page-sidebar .main-menu > li > a > span.title {
        position: static;
        width: auto;
        left: auto;
        padding: 0;
        background: transparent;
        box-shadow: none;
        opacity: 1;
        visibility: visible;
    }
    .sidebar-collapsed .page-sidebar .main-menu > li > ul { position: static; width: auto; left: auto; height: auto; opacity: 1; visibility: visible; }
    .sidebar-collapsed .page-sidebar .main-menu > li.has-sub > a::before { display: inline-block; }

    /* Bootstrap 3 collapses #side-nav via .navbar-collapse — neutralise that so
       the drawer itself controls visibility. */
    #side-nav.navbar-collapse,
    #side-nav.navbar-collapse.collapse {
        display: block !important;
        min-height: 0 !important;
        height: 0 !important;
        max-height: none !important;
        overflow-y: auto !important;
        overflow-x: hidden !important;
        border-top: 0;
        box-shadow: none;
        padding: var(--rds-space-3) var(--rds-space-2) var(--rds-space-9);
        margin: 0;
    }

    .rds-topbar-toggle { display: inline-flex; }
    .sidebar-mobile-menu { display: none !important; }

    .main-header { padding: 0 var(--rds-space-3); }
    .main-header .headerRowFontStyle { gap: var(--rds-space-2); min-height: 56px; }

    #showSessionModal { font-size: var(--rds-font-size-xs); padding: 5px 10px; max-width: 40vw; }
    .user-info .profile-info > a.dropdown-toggle span#userName { display: none; }
    .user-info .profile-info .dropdown-menu { position: absolute; inset-inline-end: 0; inset-inline-start: auto; }

    .main-content { padding: var(--rds-space-4) var(--rds-space-3); }

    .main-container > .row,
    .main-container > .panel,
    .main-container > .table-responsive,
    .main-container > form,
    .main-container > h1,
    .main-container > h2,
    .main-container > h3 { margin-left: var(--rds-space-3); margin-right: var(--rds-space-3); }

    .page-title, .main-content > h1, .main-container > h1, .main-container > h2 { font-size: var(--rds-font-size-xl); }

    .rds-page-header { flex-direction: column; align-items: stretch; }
    .rds-page-header__actions { width: 100%; }
    .rds-page-header__actions .btn { flex: 1 1 auto; }

    .panel, .card { border-radius: var(--rds-radius-md); margin-bottom: var(--rds-space-4); }
    .panel-heading, .card-header { padding: var(--rds-space-3); }
    .panel-body, .card-body { padding: var(--rds-space-3); }

    /* Touch-friendly hit areas */
    .btn { min-height: 40px; }
    .btn-xs { min-height: 30px; }
    .btn-sm { min-height: 34px; }
    .form-control { height: 42px; font-size: 16px; /* prevents iOS zoom-on-focus */ }
    select.form-control { height: 42px; }
    textarea.form-control { height: auto; font-size: 16px; }
    ul.main-menu li a { padding-top: 12px; padding-bottom: 12px; }

    /* Tables always scroll horizontally rather than breaking the page. */
    .table-responsive { border: var(--rds-border); border-radius: var(--rds-radius-md); }
    .panel-body > .table:not(.table-responsive .table) { display: block; overflow-x: auto; white-space: nowrap; }

    .dataTables_wrapper .dataTables_length,
    .dataTables_wrapper .dataTables_filter,
    .dataTables_wrapper .dataTables_info,
    .dataTables_wrapper .dataTables_paginate { float: none !important; text-align: start !important; width: 100%; }

    .dataTables_wrapper .dataTables_filter input { width: 100%; margin-inline: 0; margin-top: 6px; }
    .dataTables_wrapper .dataTables_filter label { display: block; width: 100%; }
    .dataTables_wrapper .dataTables_paginate { display: flex; flex-wrap: wrap; gap: 4px; }
    div.dt-buttons, div.html5buttons { width: 100%; }

    .modal-dialog { margin: var(--rds-space-3); width: auto; max-width: none; }
    .modal-body { padding: var(--rds-space-4); max-height: 70vh; overflow-y: auto; }
    .modal-footer { flex-direction: column-reverse; align-items: stretch; }
    .modal-footer .btn { width: 100%; margin-inline-start: 0; }

    .nav-tabs { padding: 0; overflow-x: auto; flex-wrap: nowrap; }
    .nav-tabs > li > a { white-space: nowrap; padding: 10px var(--rds-space-3); }

    footer { padding: var(--rds-space-4) var(--rds-space-3); }
    footer .content-wrapper { justify-content: center; text-align: center; }

    /* Bootstrap 3 col-xs-* grids in dense forms get too cramped on phones. */
    .main-container .col-xs-3,
    .main-container .col-xs-4 { min-width: 0; }
}

/* --- Small phones ---------------------------------------------------------- */
@media (max-width: 480px) {
    .main-content { padding: var(--rds-space-3) var(--rds-space-2); }
    .main-container > .row,
    .main-container > .panel,
    .main-container > form { margin-left: var(--rds-space-2); margin-right: var(--rds-space-2); }
    .panel-heading, .card-header { flex-direction: column; align-items: flex-start; gap: var(--rds-space-2); }
    .panel-heading .panel-tool-options { margin-inline-start: 0; }
    .site-logo img { width: 34px !important; height: 34px !important; }

    /* Very dense legacy col-xs-* grids stack instead of squeezing. */
    .main-container .col-xs-2,
    .main-container .col-xs-3,
    .main-container .col-xs-4 { width: 100%; float: none; }
}


/* ==========================================================================
   15. RTL ADJUSTMENTS
   ========================================================================== */

[dir="rtl"] .page-sidebar { inset-inline-start: 0; }
[dir="rtl"] .user-info { margin: 0 auto 0 0; }
[dir="rtl"] .user-info.pull-right { float: none !important; }
[dir="rtl"] .right-align { float: none !important; text-align: start !important; }
[dir="rtl"] ul.main-menu li.has-sub > a::before { transform: scaleX(-1); }
[dir="rtl"] ul.main-menu li.active.has-sub > a::before { transform: scaleX(-1) rotate(-90deg); }
[dir="rtl"] .panel-heading .panel-tool-options { margin: 0 auto 0 0; }
[dir="rtl"] .modal-footer { justify-content: flex-start; }
[dir="rtl"] .dataTables_wrapper .dataTables_filter { text-align: left; }

/* languageSettingData.css zeroes .row gutters in RTL; restore inside content
   so cards do not sit flush against the viewport edge. */
[dir="rtl"] .main-container .row { margin-right: -12px !important; margin-left: -12px !important; }
[dir="rtl"] .main-header .row,
[dir="rtl"] .dataTables_wrapper .row { margin-right: 0 !important; margin-left: 0 !important; }

html[lang="ar"] body,
html[lang="ur"] body { font-family: var(--rds-font-rtl); }

html[lang="ar"] .page-title,
html[lang="ur"] .page-title,
html[lang="ar"] .panel-title,
html[lang="ur"] .panel-title { line-height: 1.9; }

/* The RTL font is tall; give controls room rather than clipping text. */
html[lang="ar"] .form-control,
html[lang="ur"] .form-control,
html[lang="ar"] select.form-control,
html[lang="ur"] select.form-control { height: 42px; line-height: 1.9; }

html[lang="ar"] .btn,
html[lang="ur"] .btn { line-height: 1.7; }


/* ==========================================================================
   16. PRINT SAFETY
   --------------------------------------------------------------------------
   Reports (.rtl-table / .ltr-table / print views) must keep their own layout.
   ========================================================================== */

@media print {
    .page-sidebar,
    .main-header,
    .rds-topbar-toggle,
    .rds-sidebar-backdrop,
    .spinner,
    footer,
    #toast-container,
    .panel-tool-options,
    .dt-buttons,
    .html5buttons,
    .dataTables_length,
    .dataTables_filter,
    .dataTables_paginate,
    .dataTables_info { display: none !important; }

    body { background: #fff !important; }

    .main-container,
    footer { margin-inline-start: 0 !important; }

    .main-content { padding: 0 !important; }

    .panel, .card, .rds-card {
        border: 0 !important;
        box-shadow: none !important;
        border-radius: 0 !important;
        margin: 0 !important;
        overflow: visible !important;
    }

    .panel-body, .card-body { padding: 0 !important; }
    .table-responsive { overflow: visible !important; border: 0 !important; }

    /* Do not interfere with the dedicated report table styles. */
    .rtl-table, .ltr-table, .rtl-TopHeadtable, .ltr-TopHeadtable { background: transparent !important; }
    .rtl-table > thead > tr > th, .ltr-table > thead > tr > th { background: transparent !important; text-transform: none !important; letter-spacing: normal !important; }
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@-webkit-keyframes spin {
    0% { -webkit-transform: rotate(0deg); }
    100% { -webkit-transform: rotate(360deg); }
}

/* Respect users who prefer reduced motion. */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
    }
    .spinner .loader { animation-duration: 900ms !important; animation-iteration-count: infinite !important; }
}
