/* ============================================================
   Smart Hospital — Modern Design System v2
   Full reskin overlay on top of AdminLTE 2 / Bootstrap 3.
   Loaded LAST in <head>; non-destructive (CSS-only).
   Target aesthetic: Pluscare / Mediso / MediKit references —
   white surfaces, soft shadows, green accent, generous spacing,
   refined typography, RTL-polished.
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Tajawal:wght@400;500;700&display=swap');

:root {
    /* Surfaces */
    --sh-bg:            #f6f7fb;
    --sh-surface:       #ffffff;
    --sh-surface-alt:   #fafbfd;
    --sh-border:        #eceff5;
    --sh-border-strong: #dfe3eb;

    /* Text */
    --sh-text:    #111827;
    --sh-text-2:  #374151;
    --sh-muted:   #6b7280;
    --sh-faint:   #9ca3af;

    /* Brand */
    --sh-brand:        #16a34a;
    --sh-brand-dark:   #15803d;
    --sh-brand-soft:   #e9f8ee;
    --sh-brand-softer: #f3fbf6;

    /* Status */
    --sh-info:    #2563eb;
    --sh-info-soft:   #e0ecff;
    --sh-warning: #f59e0b;
    --sh-warning-soft:#fef3c7;
    --sh-danger:  #ef4444;
    --sh-danger-soft: #fde8e8;

    /* Geometry — radius */
    --sh-r-sm:    8px;
    --sh-r:       12px;
    --sh-r-lg:    16px;

    /* Geometry — spacing scale (4px base, mostly multiples of 4)
       Use these instead of ad-hoc values. Cheat sheet:
         --sp-1  4px   icon gap, hairline padding
         --sp-2  8px   compact inline padding, small gap
         --sp-3 12px   default cell/list padding
         --sp-4 16px   card body / modal body
         --sp-5 20px   section padding (desktop default)
         --sp-6 24px   roomy section padding
         --sp-7 32px   hero / page-level padding
       --sh-pad is the legacy alias for "default padding" — kept as a
       pointer to --sp-5 so any straggling references still resolve. */
    --sp-1: 4px;
    --sp-2: 8px;
    --sp-3: 12px;
    --sp-4: 16px;
    --sp-5: 20px;
    --sp-6: 24px;
    --sp-7: 32px;
    --sh-pad: var(--sp-5);

    /* Shadow */
    --sh-shadow-1: 0 1px 2px rgba(16,24,40,.04), 0 1px 3px rgba(16,24,40,.06);
    --sh-shadow-2: 0 4px 12px rgba(16,24,40,.06), 0 2px 4px rgba(16,24,40,.04);
    --sh-shadow-3: 0 12px 32px rgba(16,24,40,.10);

    /* Type */
    --sh-font:    'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
    --sh-font-ar: 'Tajawal', 'Cairo', 'Noto Sans Arabic', -apple-system, BlinkMacSystemFont, sans-serif;
}

/* ============== RESET / BASE ============== */
html, body { background: var(--sh-bg) !important; }
body, body.skin-blue, body.skin-blue-light, body.hold-transition {
    background: var(--sh-bg) !important;
    color: var(--sh-text);
    font-family: var(--sh-font);
    font-size: 14px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    letter-spacing: -.005em;
}
[dir="rtl"] body { font-family: var(--sh-font-ar); }
.content-wrapper, .right-side { background: var(--sh-bg) !important; padding-bottom: 40px; }

/* 9 view files (chat, charges, expmedicine report, income search, online
   appointment, stock report, blood-bank status, unauthorized) hard-code
   inline `style="min-height: 946px;"` on .content-wrapper. That forces
   946px of vertical space on every viewport — fine on 1080p desktops,
   massive empty scroll on phones. Override globally with a viewport-
   relative minimum so the content area always fills the screen but
   never overshoots. Header is 60px desktop / 124px mobile (logo+navbar
   stacked); mobile override lives in the @media block at the bottom. */
.content-wrapper, .right-side { min-height: calc(100vh - 60px) !important; }

/* The body has class="fixed" so AdminLTE pins .main-header (and the
   sidebar) with position:fixed at the top of the viewport. AdminLTE's
   default content-wrapper padding-top is 50px (sized for its 50px
   navbar) — but our reskin made the header 60px. Need 60px to clear
   the header + 10px breathing room so the page content (welcome hero,
   content-header, etc.) doesn't touch the header's bottom edge. Mobile
   override at the bottom uses 134px (60px logo + 60px navbar + 14px). */
.fixed .content-wrapper, .fixed .right-side { padding-top: 70px !important; }

/* Headings */
h1, h2, h3, h4, h5, h6 { font-weight: 600; color: var(--sh-text); letter-spacing: -.01em; }

/* ============================================================
   UTILITY CLASSES (sh-u-*)
   ------------------------------------------------------------
   Purpose: kill the most-repeated inline `style="..."` patterns
   we found in the admin views (1,636 inline styles, top
   offenders: width:100% ~480x, display:none ~226x, color:red
   114x, padding-left:0 30x, text-transform:capitalize 28x,
   margin-bottom:18px 12x, height:50px 16x).

   Naming: `.sh-u-<intent>` — namespaced so it never collides
   with Bootstrap (.text-*, .pull-*) or AdminLTE (.no-padding,
   .text-center). Sized off the spacing scale (--sp-1..--sp-7)
   defined in :root.

   Intentionally small set — utility creep is real. Add to it
   when a new pattern shows up in 5+ places, not preemptively.
   ============================================================ */

/* Width / sizing */
.sh-u-w-full     { width: 100% !important; }
.sh-u-w-auto     { width: auto !important; }
.sh-u-mw-100     { max-width: 100% !important; }

/* Display */
.sh-u-hidden     { display: none !important; }
.sh-u-block      { display: block !important; }
.sh-u-inline-blk { display: inline-block !important; }
.sh-u-flex       { display: flex !important; }
.sh-u-flex-wrap  { flex-wrap: wrap !important; }
.sh-u-items-ctr  { align-items: center !important; }

/* Spacing — margin (uses --sp-1..--sp-7) */
.sh-u-m-0  { margin: 0 !important; }
.sh-u-mt-1 { margin-top: var(--sp-1) !important; }
.sh-u-mt-2 { margin-top: var(--sp-2) !important; }
.sh-u-mt-3 { margin-top: var(--sp-3) !important; }
.sh-u-mt-4 { margin-top: var(--sp-4) !important; }
.sh-u-mt-5 { margin-top: var(--sp-5) !important; }
.sh-u-mb-1 { margin-bottom: var(--sp-1) !important; }
.sh-u-mb-2 { margin-bottom: var(--sp-2) !important; }
.sh-u-mb-3 { margin-bottom: var(--sp-3) !important; }
.sh-u-mb-4 { margin-bottom: var(--sp-4) !important; }
.sh-u-mb-5 { margin-bottom: var(--sp-5) !important; }

/* Spacing — padding */
.sh-u-p-0  { padding: 0 !important; }
.sh-u-pl-0 { padding-left: 0 !important; }
.sh-u-pr-0 { padding-right: 0 !important; }
.sh-u-pt-0 { padding-top: 0 !important; }
.sh-u-pb-0 { padding-bottom: 0 !important; }
.sh-u-p-2  { padding: var(--sp-2) !important; }
.sh-u-p-3  { padding: var(--sp-3) !important; }
.sh-u-p-4  { padding: var(--sp-4) !important; }
.sh-u-p-5  { padding: var(--sp-5) !important; }
[dir="rtl"] .sh-u-pl-0 { padding-left: initial !important; padding-right: 0 !important; }
[dir="rtl"] .sh-u-pr-0 { padding-right: initial !important; padding-left: 0 !important; }

/* Text */
.sh-u-text-cap   { text-transform: capitalize !important; }
.sh-u-text-up    { text-transform: uppercase !important; }
.sh-u-text-low   { text-transform: lowercase !important; }
.sh-u-nowrap     { white-space: nowrap !important; }
.sh-u-truncate   { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sh-u-text-red   { color: var(--sh-danger) !important; } /* prefer Bootstrap .text-danger */

/* Float / clear */
.sh-u-clear      { clear: both; overflow: hidden; }

/* ============== TOP NAV ============== */
.skin-blue .main-header .navbar,
.main-header .navbar {
    background: var(--sh-surface) !important;
    border-bottom: 1px solid var(--sh-border);
    box-shadow: none !important;
    height: 60px;
    min-height: 60px;
}
.main-header { height: 60px; }
.skin-blue .main-header .logo,
.main-header .logo {
    background: var(--sh-surface) !important;
    color: var(--sh-text) !important;
    border-bottom: 1px solid var(--sh-border);
    border-right: 1px solid var(--sh-border);
    font-weight: 700;
    font-size: 18px;
    letter-spacing: -.02em;
    height: 60px;
    line-height: 60px;
}
[dir="rtl"] .skin-blue .main-header .logo,
[dir="rtl"] .main-header .logo {
    border-right: 0;
    border-left: 1px solid var(--sh-border);
}
.skin-blue .main-header .logo:hover { background: var(--sh-surface-alt) !important; }

/* Hospital name shown in the top nav (sidebar-session span). Override the
   skin defaults: LTR skin leaves it inheriting white-on-white; RTL skin
   sets a stale green (#b0dd38); both also force width:100% which makes
   the span overlap the sidebar-toggle / search / icons next to it.
   Force a brand-aligned dark color and cap width so it never collides. */
.main-header .sidebar-session,
.skin-blue .main-header .sidebar-session,
[dir="rtl"] .main-header .sidebar-session,
[dir="rtl"] .skin-blue .main-header .sidebar-session {
    color: var(--sh-text) !important;
    font-weight: 600;
    font-size: 15px;
    line-height: 60px;
    padding: 0 !important;
    width: auto !important;
    max-width: calc(100% - 8px);
    display: inline-block;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}
/* Keep the hospital-name column clear of the toggle on LTR (toggle floats left)
   and of the icons on RTL (toggle floats right). Adds a safe gap. */
.main-header .navbar > .col-lg-4,
.main-header .navbar > .col-md-4,
.main-header .navbar > .col-sm-3,
.main-header .navbar > .col-xs-3 {
    padding-left: 44px;
    padding-right: 44px;
}
.skin-blue .main-header .navbar .sidebar-toggle {
    color: var(--sh-text-2) !important;
    height: 60px;
    line-height: 30px;
}
.skin-blue .main-header .navbar .sidebar-toggle:hover {
    background: var(--sh-surface-alt) !important;
    color: var(--sh-brand) !important;
}
.skin-blue .main-header .navbar .nav > li > a {
    color: var(--sh-text-2) !important;
    height: 60px;
    line-height: 30px;
    padding: 15px 14px;
}
.skin-blue .main-header .navbar .nav > li > a:hover,
.skin-blue .main-header .navbar .nav > li > a:focus,
.skin-blue .main-header .navbar .nav .open > a,
.skin-blue .main-header .navbar .nav .open > a:hover,
.skin-blue .main-header .navbar .nav .open > a:focus {
    background: var(--sh-surface-alt) !important;
    color: var(--sh-brand) !important;
}
.skin-blue .main-header .navbar .nav > li > a > .label {
    background: var(--sh-danger);
    border: 2px solid var(--sh-surface);
    border-radius: 999px;
    font-weight: 600;
    font-size: 10px;
    padding: 2px 6px;
    top: 9px;
    right: 4px;
}

/* ============== TOP NAV SEARCH FORM ============== */
/* The patient-search input lives in the navbar (.search-form). It's a
   Bootstrap 3 input-group: <input> + <span.input-group-btn><button>.
   Two problems with the stock styling:
     1. Our global .form-control rule rounds ALL corners 8px, so the input
        no longer reads as "joined" to the button beside it.
     2. The button hard-codes inline border-radius:0 30px 30px 0 (pill
        right) and background:#fff with class="btn-flat" (no border) —
        result: input looks like a stub and the icon floats free.
   Fix: treat the whole group as one rounded pill, like the sidebar
   .search-form2. Override the input to flat-right, the button to flat-
   left with a connecting border. RTL flips both. */
.main-header .navbar .search-form { margin: 0; padding: 0; }
.main-header .navbar .search-form .input-group {
    padding-top: 0 !important;
    background: var(--sh-bg);
    border-radius: 999px;
    overflow: hidden;
    border: 1px solid var(--sh-border);
    width: 260px;
    max-width: 100%;
    height: 38px;
    margin-top: 10px;
}
.main-header .navbar .search-form .input-group .form-control {
    border: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    border-radius: 999px 0 0 999px !important;
    height: 36px !important;
    padding: 0 16px !important;
    color: var(--sh-text);
    font-size: 13.5px;
}
[dir="rtl"] .main-header .navbar .search-form .input-group .form-control {
    border-radius: 0 999px 999px 0 !important;
    padding: 0 16px !important;
}
.main-header .navbar .search-form .input-group .form-control:focus {
    box-shadow: none !important;
}
.main-header .navbar .search-form .input-group:focus-within {
    border-color: var(--sh-brand);
    box-shadow: 0 0 0 3px rgba(22,163,74,.12);
}
.main-header .navbar .search-form .input-group-btn .btn {
    /* Override the inline `border-radius:0 30px 30px 0` and `padding:3px 12px`
       on the button so it matches the input's height and the pill shape. */
    border-radius: 0 999px 999px 0 !important;
    background: transparent !important;
    border: 0 !important;
    color: var(--sh-muted) !important;
    height: 36px !important;
    padding: 0 14px !important;
    line-height: 1 !important;
    transition: color .15s ease, background .15s ease;
}
[dir="rtl"] .main-header .navbar .search-form .input-group-btn .btn {
    border-radius: 999px 0 0 999px !important;
}
.main-header .navbar .search-form .input-group-btn .btn:hover,
.main-header .navbar .search-form .input-group-btn .btn:focus {
    color: var(--sh-brand) !important;
    background: var(--sh-surface-alt) !important;
}

/* ============== SIDEBAR ============== */
.skin-blue .main-sidebar,
.skin-blue .left-side,
.main-sidebar, .left-side {
    background: var(--sh-surface) !important;
    border-right: 1px solid var(--sh-border);
    box-shadow: none;
    /* navbar is 60px (see TOP NAV section) — sidebar must clear it or
       its first item (Dashboard) gets hidden behind the navbar/logo. 8px
       extra for breathing room. */
    padding-top: 68px !important;
}
[dir="rtl"] .main-sidebar,
[dir="rtl"] .left-side {
    border-right: 0 !important;
    border-left: 1px solid var(--sh-border);
}
/* Sidebar search-form2: same single-pill pattern as the navbar
   .search-form. Border lives on the .input-group container, the
   <input> and <button> inside are transparent and borderless so
   they read as one connected pill. The earlier per-element border
   approach left a visible seam between the input's right edge and
   the button's left edge — especially noticeable on mobile when
   the sidebar drawer slides in. */
.main-sidebar .search-form2 { padding: 12px 14px 4px; }
.main-sidebar .search-form2 .input-group {
    background: var(--sh-bg);
    border: 1px solid var(--sh-border);
    border-radius: 999px;
    overflow: hidden;
    height: 40px;
    width: 100%;
    display: flex;
}
.main-sidebar .search-form2 .input-group:focus-within {
    border-color: var(--sh-brand);
    box-shadow: 0 0 0 3px rgba(22,163,74,.12);
}
.main-sidebar .search-form2 .form-control {
    border: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    border-radius: 999px 0 0 999px !important;
    height: 38px !important;
    padding: 0 16px !important;
    color: var(--sh-text);
    flex: 1;
    min-width: 0;
}
[dir="rtl"] .main-sidebar .search-form2 .form-control {
    border-radius: 0 999px 999px 0 !important;
}
.main-sidebar .search-form2 .form-control:focus { box-shadow: none !important; }
.main-sidebar .search-form2 .input-group-btn { display: flex; }
.main-sidebar .search-form2 .input-group-btn .btn {
    border-radius: 0 999px 999px 0 !important;
    background: transparent !important;
    border: 0 !important;
    color: var(--sh-muted) !important;
    height: 38px !important;
    padding: 0 16px !important;
    line-height: 1 !important;
    transition: color .15s ease, background .15s ease;
}
[dir="rtl"] .main-sidebar .search-form2 .input-group-btn .btn {
    border-radius: 999px 0 0 999px !important;
}
.main-sidebar .search-form2 .input-group-btn .btn:hover,
.main-sidebar .search-form2 .input-group-btn .btn:focus {
    color: var(--sh-brand) !important;
    background: var(--sh-surface-alt) !important;
}

/* sidebar menu items */
.skin-blue .sidebar-menu { padding: 4px 10px 80px; }
.skin-blue .sidebar-menu > li,
.sidebar-menu > li { margin: 1px 0; }
.skin-blue .sidebar-menu > li > a,
.sidebar-menu > li > a {
    color: var(--sh-text-2) !important;
    background: transparent !important;
    border-radius: var(--sh-r-sm);
    padding: 10px 12px;
    font-weight: 500;
    font-size: 13.5px;
    line-height: 1.4;
    transition: background .15s ease, color .15s ease;
    border-left: 0 !important;
    border-right: 0 !important;
    position: relative;
    /* Use AdminLTE's natural inline-block flow — flex was clipping labels
       when nested children (icon + multiple spans) didn't size as expected. */
    white-space: normal;
}
/* Sidebar scrolls if content exceeds viewport. AdminLTE manages position
   (fixed under navbar); we just enable internal scrolling. */
.main-sidebar, .left-side {
    overflow-y: auto;
    overflow-x: hidden;
}
.skin-blue .sidebar-menu > li:hover > a,
.skin-blue .sidebar-menu > li.menu-open > a {
    background: var(--sh-surface-alt) !important;
    color: var(--sh-text) !important;
}
.skin-blue .sidebar-menu > li.active > a {
    background: var(--sh-brand-soft) !important;
    color: var(--sh-brand-dark) !important;
    font-weight: 600;
}
.skin-blue .sidebar-menu > li > a > .fa,
.skin-blue .sidebar-menu > li > a > .fas,
.skin-blue .sidebar-menu > li > a > .glyphicon,
.skin-blue .sidebar-menu > li > a > .ion {
    color: var(--sh-muted);
    width: 22px;
    text-align: center;
    margin-right: 10px;
    font-size: 15px;
}
[dir="rtl"] .skin-blue .sidebar-menu > li > a > .fa,
[dir="rtl"] .skin-blue .sidebar-menu > li > a > .fas {
    margin-right: 0;
    margin-left: 10px;
}
.skin-blue .sidebar-menu > li:hover > a > .fa,
.skin-blue .sidebar-menu > li:hover > a > .fas,
.skin-blue .sidebar-menu > li.active > a > .fa,
.skin-blue .sidebar-menu > li.active > a > .fas {
    color: var(--sh-brand) !important;
}
.skin-blue .sidebar-menu > li > a > .pull-right-container > .fa-angle-left,
.skin-blue .sidebar-menu > li > a > .pull-right-container > .fa-angle-down {
    color: var(--sh-faint);
}

/* tree submenu */
.skin-blue .sidebar-menu .treeview-menu {
    background: transparent !important;
    padding: 4px 0 4px 24px;
}
[dir="rtl"] .skin-blue .sidebar-menu .treeview-menu {
    padding: 4px 24px 4px 0;
}
.skin-blue .sidebar-menu .treeview-menu > li > a {
    color: var(--sh-muted) !important;
    font-size: 13px;
    padding: 7px 12px;
    border-radius: var(--sh-r-sm);
}
.skin-blue .sidebar-menu .treeview-menu > li:hover > a,
.skin-blue .sidebar-menu .treeview-menu > li.active > a {
    background: var(--sh-surface-alt) !important;
    color: var(--sh-brand-dark) !important;
}
.skin-blue .sidebar-menu .treeview-menu > li > a > .fa,
.skin-blue .sidebar-menu .treeview-menu > li > a > .fas { display: none; }
.skin-blue .sidebar-menu .treeview-menu > li > a:before {
    content: "•";
    color: var(--sh-faint);
    margin-right: 8px;
}
[dir="rtl"] .skin-blue .sidebar-menu .treeview-menu > li > a:before {
    margin-right: 0;
    margin-left: 8px;
}

/* sidebar header label */
.skin-blue .sidebar-menu > .header,
.sidebar-menu > .header {
    background: transparent !important;
    color: var(--sh-faint) !important;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .08em;
    padding: 14px 14px 6px;
}

/* ============================================================
   SIDEBAR COLLAPSED STATE (body.sidebar-collapse)
   ------------------------------------------------------------
   When AdminLTE shrinks the sidebar to 50px (icon-only mode),
   the menu items inherit our expanded-state padding (10px 12px
   inside a 230px column). At 50px width that produces:
   - Icons pushed to the start edge instead of centered.
   - Active-state pill background bleeding to both edges.
   - Hover-flyout submenu (positioned absolutely by AdminLTE)
     using a default style that doesn't match our design system.
   This block restores symmetry and styles the flyout as a
   small floating card. Only applies on tablet+ (sidebar collapse
   isn't used at <768px — the off-canvas drawer is used instead).
   ============================================================ */
@media (min-width: 768px) {

    /* Trim sidebar inner padding so 50px is fully usable. */
    body.sidebar-collapse .skin-blue .sidebar-menu,
    body.sidebar-collapse .sidebar-menu { padding: 4px 4px 60px; }

    /* Each <li> gets a fixed gap. The <a> itself is transparent — we
       paint the active/hover state on a CENTERED 40x40 inline-block
       wrapper around the icon (via the link's flex centering). This
       way the highlight is a clean square hugging the icon instead
       of a wide rectangle bleeding to the edges of the 50px rail. */
    body.sidebar-collapse .skin-blue .sidebar-menu > li,
    body.sidebar-collapse .sidebar-menu > li {
        margin: 4px 0 !important;
    }
    body.sidebar-collapse .skin-blue .sidebar-menu > li > a,
    body.sidebar-collapse .sidebar-menu > li > a {
        padding: 0 !important;
        margin: 0 !important;
        background: transparent !important;
        display: flex !important;
        align-items: center;
        justify-content: center;
        height: 40px;
    }

    /* The icon becomes the visual "chip" — fixed 40x40 box that gets
       the rounded-square background on active/hover states. */
    body.sidebar-collapse .skin-blue .sidebar-menu > li > a > .fa,
    body.sidebar-collapse .skin-blue .sidebar-menu > li > a > .fas,
    body.sidebar-collapse .skin-blue .sidebar-menu > li > a > .glyphicon,
    body.sidebar-collapse .skin-blue .sidebar-menu > li > a > .ion {
        margin: 0 !important;
        width: 40px;
        height: 40px;
        line-height: 40px;
        font-size: 16px;
        text-align: center;
        border-radius: 10px;
        transition: background .15s ease, color .15s ease;
    }

    /* Hover: subtle surface tint behind the icon, no full-width fill. */
    body.sidebar-collapse .skin-blue .sidebar-menu > li:hover > a {
        background: transparent !important;
    }
    body.sidebar-collapse .skin-blue .sidebar-menu > li:hover > a > .fa,
    body.sidebar-collapse .skin-blue .sidebar-menu > li:hover > a > .fas {
        background: var(--sh-surface-alt);
        color: var(--sh-text);
    }

    /* Active: brand-soft green chip with brand-dark icon — same visual
       weight as the expanded-state pill but contained to the icon. */
    body.sidebar-collapse .skin-blue .sidebar-menu > li.active > a {
        background: transparent !important;
    }
    body.sidebar-collapse .skin-blue .sidebar-menu > li.active > a > .fa,
    body.sidebar-collapse .skin-blue .sidebar-menu > li.active > a > .fas,
    body.sidebar-collapse .skin-blue .sidebar-menu > li.menu-open > a > .fa,
    body.sidebar-collapse .skin-blue .sidebar-menu > li.menu-open > a > .fas {
        background: var(--sh-brand-soft) !important;
        color: var(--sh-brand-dark) !important;
    }

    /* Hide the optional dropdown chevron (pull-right .fa-angle-left/down)
       and any text labels that AdminLTE doesn't already hide. */
    body.sidebar-collapse .sidebar-menu > li > a > .pull-right-container,
    body.sidebar-collapse .sidebar-menu > li > a > .pull-right { display: none !important; }

    /* Hide section headers ("MAIN", "MODULES" etc) entirely — labels are
       just the strap-line text and would render as a small floating row. */
    body.sidebar-collapse .sidebar-menu > .header { display: none !important; }

    /* Hide the sidebar search-form (the search-form2 we styled earlier)
       — it can't render properly in 50px and AdminLTE's default rule may
       not catch our markup. */
    body.sidebar-collapse .main-sidebar .search-form2 { display: none !important; }

    /* The collapsed sidebar's hover-out submenu: AdminLTE positions it
       absolute at left:50px, width:180px. Restyle as a floating card
       matching our design tokens. */
    body.sidebar-collapse .sidebar-menu > li:hover > a > span:not(.pull-right) {
        background: var(--sh-text) !important;
        color: #fff !important;
        border-radius: 0 var(--sh-r-sm) var(--sh-r-sm) 0 !important;
        padding: 12px 16px !important;
        font-size: 13px !important;
        font-weight: 500 !important;
        box-shadow: var(--sh-shadow-2) !important;
    }
    body.sidebar-collapse .sidebar-menu > li:hover > .treeview-menu {
        background: var(--sh-surface) !important;
        border: 1px solid var(--sh-border) !important;
        border-radius: 0 0 var(--sh-r-sm) var(--sh-r-sm) !important;
        box-shadow: var(--sh-shadow-2) !important;
        padding: 6px !important;
    }
    body.sidebar-collapse .sidebar-menu > li:hover > .treeview-menu > li > a {
        color: var(--sh-text-2) !important;
        padding: 8px 12px !important;
        border-radius: var(--sh-r-sm) !important;
    }
    body.sidebar-collapse .sidebar-menu > li:hover > .treeview-menu > li > a:hover {
        background: var(--sh-surface-alt) !important;
        color: var(--sh-brand-dark) !important;
    }

    /* RTL: flyout opens to the LEFT of the 50px rail instead of the right.
       AdminLTE handles positioning via the rtl pack; we just flip the
       border-radius on the popping label. */
    [dir="rtl"] body.sidebar-collapse .sidebar-menu > li:hover > a > span:not(.pull-right) {
        border-radius: var(--sh-r-sm) 0 0 var(--sh-r-sm) !important;
    }
}

/* ============== CONTENT HEADER ============== */
.content-header {
    padding: 22px 22px 6px !important;
}
.content-header > h1 {
    font-size: 22px;
    font-weight: 700;
    color: var(--sh-text);
    letter-spacing: -.02em;
    margin: 0;
}
.content-header > h1 > small {
    color: var(--sh-muted);
    font-size: 13px;
    font-weight: 400;
    margin-left: 8px;
}
.content-header > .breadcrumb {
    background: transparent !important;
    border: 0 !important;
    padding: 4px 0 !important;
    margin: 6px 0 0 !important;
    color: var(--sh-muted);
    font-size: 13px;
    position: static !important;
    float: none !important;
}
.breadcrumb > li > a { color: var(--sh-brand); }
.breadcrumb > .active, .breadcrumb > li + li:before { color: var(--sh-faint); }
.content { padding: 8px 22px !important; }

/* ============== CARDS / BOXES ============== */
.box {
    background: var(--sh-surface);
    border: 1px solid var(--sh-border) !important;
    border-radius: var(--sh-r);
    box-shadow: var(--sh-shadow-1);
    margin-bottom: 22px;
    overflow: hidden;
}
.box.box-primary, .box.box-info, .box.box-success,
.box.box-warning, .box.box-danger {
    border-top: 1px solid var(--sh-border) !important;
}
.box-header {
    padding: 18px 20px !important;
    border-bottom: 1px solid var(--sh-border) !important;
    background: transparent;
}
.box-header.with-border { border-bottom: 1px solid var(--sh-border) !important; }
.box-header > .box-title,
.box-title {
    font-size: 15px !important;
    font-weight: 600 !important;
    color: var(--sh-text);
    letter-spacing: -.005em;
}
.box-header .box-tools .btn-box-tool {
    color: var(--sh-faint);
    background: transparent !important;
}
.box-body { padding: 20px !important; }
.box-footer { background: var(--sh-surface-alt); border-top: 1px solid var(--sh-border); padding: 14px 20px; }

/* AdminLTE info-boxes */
.info-box {
    border-radius: var(--sh-r);
    box-shadow: var(--sh-shadow-1);
    background: var(--sh-surface) !important;
    color: var(--sh-text) !important;
    min-height: 96px;
    padding: 4px;
    margin-bottom: 22px;
}
.info-box-icon {
    border-radius: var(--sh-r) 0 0 var(--sh-r);
    width: 92px;
    font-size: 32px;
    line-height: 88px;
}
[dir="rtl"] .info-box-icon { border-radius: 0 var(--sh-r) var(--sh-r) 0; }
.info-box-content { padding: 10px 14px; margin-left: 92px; }
[dir="rtl"] .info-box-content { margin-left: 0; margin-right: 92px; }
.info-box-text { color: var(--sh-muted); font-size: 12.5px; text-transform: uppercase; letter-spacing: .04em; font-weight: 600; }
.info-box-number { color: var(--sh-text); font-size: 24px; font-weight: 700; letter-spacing: -.02em; }

/* AdminLTE small-box (legacy dashboard tiles) */
.small-box {
    border-radius: var(--sh-r);
    box-shadow: var(--sh-shadow-1);
    overflow: hidden;
    margin-bottom: 22px;
}
.small-box.bg-aqua, .small-box.bg-green,
.small-box.bg-blue, .small-box.bg-yellow,
.small-box.bg-red, .small-box.bg-teal {
    color: #fff !important;
}
.small-box > .small-box-footer {
    background: rgba(0,0,0,.10) !important;
    color: rgba(255,255,255,.85) !important;
    padding: 10px 0;
}

/* ===== Custom modern stat card (used in new dashboards) ===== */
.sh-card {
    background: var(--sh-surface);
    border: 1px solid var(--sh-border);
    border-radius: var(--sh-r);
    box-shadow: var(--sh-shadow-1);
    padding: 20px;
    margin-bottom: 22px;
    transition: box-shadow .15s ease, transform .15s ease;
}
.sh-card:hover { box-shadow: var(--sh-shadow-2); }
.sh-card-lg { padding: 24px; border-radius: var(--sh-r-lg); }
.sh-card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.sh-card-title { font-size: 15px; font-weight: 600; color: var(--sh-text); margin: 0; }
.sh-card-subtitle { font-size: 12.5px; color: var(--sh-muted); margin: 2px 0 0; }

.sh-stat {
    display: flex;
    align-items: flex-start;
    gap: 14px;
}
.sh-stat-icon {
    width: 44px; height: 44px; border-radius: var(--sh-r-sm);
    display: flex; align-items: center; justify-content: center;
    font-size: 18px; flex-shrink: 0;
}
.sh-stat-icon.brand   { background: var(--sh-brand-soft);   color: var(--sh-brand-dark); }
.sh-stat-icon.info    { background: var(--sh-info-soft);    color: var(--sh-info); }
.sh-stat-icon.warning { background: var(--sh-warning-soft); color: #92400e; }
.sh-stat-icon.danger  { background: var(--sh-danger-soft);  color: #b91c1c; }
.sh-stat-body { flex: 1; min-width: 0; }
.sh-stat-label {
    font-size: 12.5px; color: var(--sh-muted); font-weight: 500;
    text-transform: uppercase; letter-spacing: .04em; margin-bottom: 4px;
}
.sh-stat-value {
    font-size: 26px; font-weight: 700; color: var(--sh-text);
    letter-spacing: -.02em; line-height: 1.15;
}
.sh-stat-trend {
    display: inline-flex; align-items: center; gap: 4px;
    font-size: 12px; font-weight: 600; margin-top: 6px;
    padding: 3px 8px; border-radius: 999px;
}
.sh-stat-trend.up   { background: var(--sh-brand-soft);  color: var(--sh-brand-dark); }
.sh-stat-trend.down { background: var(--sh-danger-soft); color: #b91c1c; }
.sh-stat-foot { color: var(--sh-muted); font-size: 12.5px; margin-top: 6px; }

/* Hero / welcome banner */
.sh-hero {
    background: linear-gradient(135deg, #16a34a 0%, #0e7c39 100%);
    color: #fff;
    border-radius: var(--sh-r-lg);
    padding: 28px 32px;
    margin-bottom: 22px;
    position: relative;
    overflow: hidden;
}
.sh-hero:after {
    content: "";
    position: absolute;
    top: -40px; right: -40px;
    width: 220px; height: 220px;
    background: rgba(255,255,255,.10);
    border-radius: 50%;
}
.sh-hero:before {
    content: "";
    position: absolute;
    bottom: -60px; right: 80px;
    width: 160px; height: 160px;
    background: rgba(255,255,255,.06);
    border-radius: 50%;
}
[dir="rtl"] .sh-hero:after { right: auto; left: -40px; }
[dir="rtl"] .sh-hero:before { right: auto; left: 80px; }
.sh-hero h2 { color: #fff; font-size: 22px; font-weight: 700; margin: 0 0 6px; letter-spacing: -.02em; position: relative; z-index: 1; }
.sh-hero p  { color: rgba(255,255,255,.88); font-size: 14px; margin: 0; position: relative; z-index: 1; }
.sh-hero .btn { position: relative; z-index: 1; }

/* Quick-action tile */
.sh-action {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    padding: 24px 14px; border-radius: var(--sh-r);
    background: var(--sh-surface); border: 1px solid var(--sh-border);
    color: var(--sh-text-2); text-decoration: none !important;
    transition: all .15s ease; height: 100%;
}
.sh-action:hover {
    border-color: var(--sh-brand); color: var(--sh-brand-dark);
    transform: translateY(-2px); box-shadow: var(--sh-shadow-2);
}
.sh-action-icon {
    width: 48px; height: 48px; border-radius: var(--sh-r-sm);
    background: var(--sh-brand-soft); color: var(--sh-brand-dark);
    display: flex; align-items: center; justify-content: center;
    font-size: 20px; margin-bottom: 12px;
}
.sh-action-label { font-size: 13.5px; font-weight: 500; text-align: center; }

/* ============== BUTTONS ============== */
.btn {
    border-radius: var(--sh-r-sm);
    font-weight: 500;
    padding: 8px 16px;
    font-size: 13.5px;
    border: 1px solid transparent;
    transition: all .15s ease;
    box-shadow: none !important;
}
.btn-lg { padding: 11px 22px; font-size: 14.5px; }
.btn-sm { padding: 5px 12px; font-size: 12.5px; }
.btn-primary, .btn-success {
    background: var(--sh-brand) !important;
    border-color: var(--sh-brand) !important;
    color: #fff !important;
}
.btn-primary:hover, .btn-success:hover,
.btn-primary:focus, .btn-success:focus {
    background: var(--sh-brand-dark) !important;
    border-color: var(--sh-brand-dark) !important;
}
.btn-default {
    background: var(--sh-surface) !important;
    border-color: var(--sh-border-strong) !important;
    color: var(--sh-text-2) !important;
}
.btn-default:hover { background: var(--sh-surface-alt) !important; }
.btn-info    { background: var(--sh-info) !important;    border-color: var(--sh-info) !important; color: #fff !important; }
.btn-warning { background: var(--sh-warning) !important; border-color: var(--sh-warning) !important; color: #fff !important; }
.btn-danger  { background: var(--sh-danger) !important;  border-color: var(--sh-danger) !important; color: #fff !important; }
.btn-link { color: var(--sh-brand-dark); }
.btn-light, .btn-outline {
    background: var(--sh-surface) !important;
    border-color: var(--sh-border) !important;
    color: var(--sh-text-2) !important;
}

/* ============== FORMS ============== */
.form-control,
.select2-container--default .select2-selection--single,
.select2-container--default .select2-selection--multiple {
    border-radius: var(--sh-r-sm) !important;
    border: 1px solid var(--sh-border-strong) !important;
    box-shadow: none !important;
    color: var(--sh-text);
    transition: border-color .15s ease, box-shadow .15s ease;
    height: 40px;
    padding: 8px 12px;
    background: var(--sh-surface) !important;
}
textarea.form-control { height: auto; }
.form-control:focus,
.select2-container--default.select2-container--focus .select2-selection--single,
.select2-container--default.select2-container--focus .select2-selection--multiple {
    border-color: var(--sh-brand) !important;
    box-shadow: 0 0 0 3px rgba(22,163,74,.12) !important;
}
.input-group-addon {
    background: var(--sh-surface-alt);
    border: 1px solid var(--sh-border-strong);
    border-radius: var(--sh-r-sm);
    color: var(--sh-muted);
}
label { font-weight: 500; color: var(--sh-text); font-size: 13px; }
.help-block { color: var(--sh-muted); font-size: 12.5px; }

/* ============== TABLES ============== */
.table { background: var(--sh-surface); color: var(--sh-text); margin-bottom: 0; }
.table > thead > tr > th {
    border-bottom: 1px solid var(--sh-border) !important;
    background: var(--sh-surface-alt);
    color: var(--sh-muted);
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .04em;
    padding: 13px 14px !important;
    border-top: 0 !important;
}
.table > tbody > tr > td {
    border-top: 1px solid var(--sh-border) !important;
    padding: 14px 14px !important;
    vertical-align: middle;
    font-size: 13.5px;
    color: var(--sh-text-2);
}
.table-hover > tbody > tr:hover { background: var(--sh-surface-alt); }
.dataTables_wrapper .dataTables_paginate .paginate_button {
    border-radius: var(--sh-r-sm) !important;
    margin: 0 2px;
}
.pagination > li > a {
    border-color: var(--sh-border);
    color: var(--sh-text-2);
}
.pagination > .active > a, .pagination > .active > a:hover {
    background: var(--sh-brand) !important;
    border-color: var(--sh-brand) !important;
}

/* ============== BADGES / LABELS ============== */
.label, .badge {
    font-weight: 600;
    border-radius: 999px;
    padding: 4px 10px;
    font-size: 11px;
    letter-spacing: .02em;
    display: inline-block;
}
.label-success, .badge-success, .label-green, .bg-green { background: var(--sh-brand-soft) !important; color: var(--sh-brand-dark) !important; }
.label-danger,  .badge-danger,  .bg-red   { background: var(--sh-danger-soft) !important; color: #b91c1c !important; }
.label-warning, .badge-warning, .bg-yellow { background: var(--sh-warning-soft) !important; color: #92400e !important; }
.label-info,    .badge-info,    .bg-aqua, .bg-blue { background: var(--sh-info-soft) !important; color: #1e40af !important; }
.label-default, .badge-default { background: var(--sh-bg) !important; color: var(--sh-muted) !important; }

/* status pill (custom) */
.sh-pill {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 11.5px; font-weight: 600;
    letter-spacing: .02em;
}
.sh-pill:before {
    content: ""; width: 6px; height: 6px; border-radius: 999px; background: currentColor;
}
.sh-pill.success { background: var(--sh-brand-soft); color: var(--sh-brand-dark); }
.sh-pill.warn    { background: var(--sh-warning-soft); color: #92400e; }
.sh-pill.danger  { background: var(--sh-danger-soft); color: #b91c1c; }
.sh-pill.info    { background: var(--sh-info-soft); color: #1e40af; }

/* ============== MODALS ============== */
.modal-content {
    border: 0;
    border-radius: var(--sh-r);
    box-shadow: var(--sh-shadow-3);
}
.modal-header {
    border-bottom: 1px solid var(--sh-border);
    padding: 18px 22px;
}
.modal-header .modal-title { font-weight: 600; color: var(--sh-text); }
.modal-body { padding: 20px 22px; }
.modal-footer { border-top: 1px solid var(--sh-border); padding: 14px 22px; }

/* ============== ALERTS / CALLOUTS ============== */
.alert {
    border-radius: var(--sh-r-sm);
    border: 1px solid var(--sh-border);
    padding: 14px 16px;
    box-shadow: var(--sh-shadow-1);
}
.alert-success { background: var(--sh-brand-softer); border-color: #cfe9d7; color: var(--sh-brand-dark); }
.alert-danger  { background: #fef2f2; border-color: #fbd5d5; color: #b91c1c; }
.alert-warning { background: #fffbea; border-color: #fde6b3; color: #92400e; }
.alert-info    { background: #eff5ff; border-color: #c8dcfb; color: #1e40af; }

/* ============== CHARTS ============== */
/* Bound chart heights so Chart.js with responsive:true + maintainAspectRatio:false
   can't expand to infinity inside an unbounded card. Charts MUST be wrapped in a
   div with fixed height; this is a safety net in case a view forgets the wrapper. */
canvas {
    max-width: 100%;
    max-height: 320px;
}
.sh-card canvas { display: block; }

/* ============== LINKS / MISC ============== */
a { color: var(--sh-brand-dark); }
a:hover, a:focus { color: var(--sh-brand); text-decoration: none; }
hr { border-color: var(--sh-border); }
.text-muted, .text-light { color: var(--sh-muted) !important; }
.bg-light { background: var(--sh-surface-alt) !important; }

/* ============== PROFILE / AVATAR ============== */
.sh-avatar {
    width: 40px; height: 40px; border-radius: 50%;
    background: var(--sh-brand-soft); color: var(--sh-brand-dark);
    display: inline-flex; align-items: center; justify-content: center;
    font-weight: 600; font-size: 14px; letter-spacing: -.01em;
    overflow: hidden; flex-shrink: 0;
}
.sh-avatar.lg { width: 56px; height: 56px; font-size: 18px; }
.sh-avatar img { width: 100%; height: 100%; object-fit: cover; }

/* ============== LIST ITEMS (recent activity etc.) ============== */
.sh-list { list-style: none; padding: 0; margin: 0; }
.sh-list > li {
    display: flex; align-items: center; gap: 14px;
    padding: 12px 0;
    border-bottom: 1px solid var(--sh-border);
}
.sh-list > li:last-child { border-bottom: 0; }
.sh-list .item-title { font-weight: 500; color: var(--sh-text); margin: 0; font-size: 13.5px; }
.sh-list .item-meta  { color: var(--sh-muted); font-size: 12.5px; margin: 2px 0 0; }
.sh-list .item-right { margin-left: auto; color: var(--sh-muted); font-size: 12.5px; white-space: nowrap; }
[dir="rtl"] .sh-list .item-right { margin-left: 0; margin-right: auto; }

/* ============== ORIGINAL .box_dashboard preserved ============== */
.box_dashboard {
    display: block;
    font-size: 15px;
    margin-top: 38px;
    white-space: nowrap;
    margin-left: 19px;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ============== RTL POLISH ============== */
[dir="rtl"] body { text-align: right; }
[dir="rtl"] .pull-right { float: left !important; }
[dir="rtl"] .pull-left  { float: right !important; }
[dir="rtl"] .text-right { text-align: left !important; }
[dir="rtl"] .text-left  { text-align: right !important; }

/* RTL fix for Bootstrap 3 col push/pull is handled by bootstrap-rtl */

/* ============== LANGUAGE SWITCHER ============== */
/* The switcher is an <li class="dropdown sh-lang-li"> in .navbar-nav with the
   <a class="sh-lang-toggle"> directly inside (Bootstrap 3 navbar-dropdown
   pattern). The parent .dropdown class is what makes Bootstrap's JS open the
   menu on click — without it, the data-toggle is dead. */
.sh-lang-li {
    list-style: none;
    padding: 12px 6px !important;
    line-height: 1 !important;
    display: list-item;
}
/* Override the navbar's default `.navbar-nav > li > a { padding: 15px 14px }`
   so our pill sits properly. */
.skin-blue .main-header .navbar .nav > li > a.sh-lang-toggle,
.main-header .navbar .nav > li > a.sh-lang-toggle,
.sh-lang-li > a.sh-lang-toggle {
    padding: 6px 12px !important;
    height: 36px !important;
    line-height: 1 !important;
    background: var(--sh-surface-alt) !important;
    border: 1px solid var(--sh-border) !important;
    border-radius: 999px !important;
}

.sh-lang-switcher {
    display: inline-block;
    vertical-align: middle;
    position: relative;
    margin: 0;
}
.sh-lang-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    height: 36px;
    border-radius: 999px;
    background: var(--sh-surface-alt);
    border: 1px solid var(--sh-border);
    color: var(--sh-text-2) !important;
    font-size: 13px;
    font-weight: 500;
    text-decoration: none !important;
    transition: background .15s ease, border-color .15s ease;
    line-height: 1;
    white-space: nowrap;
}
.sh-lang-toggle:hover, .sh-lang-toggle:focus {
    background: var(--sh-brand-soft);
    border-color: var(--sh-brand);
    color: var(--sh-brand-dark) !important;
}
.sh-lang-toggle .flag-icon {
    width: 22px; height: 16px;
    border-radius: 2px;
    flex-shrink: 0;
}
.sh-lang-label {
    line-height: 1;
    max-width: 110px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.sh-lang-caret {
    font-size: 10px !important;
    color: var(--sh-faint);
    margin-left: 2px;
}
[dir="rtl"] .sh-lang-caret { margin-left: 0; margin-right: 2px; }

.sh-lang-menu {
    min-width: 220px;
    padding: 6px;
    margin-top: 6px !important;
    border-radius: var(--sh-r);
    border: 1px solid var(--sh-border);
    box-shadow: var(--sh-shadow-2);
    background: var(--sh-surface);
    list-style: none;
}
[dir="rtl"] .sh-lang-menu { left: auto; right: 0; }
.sh-lang-menu > li > a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px !important;
    border-radius: var(--sh-r-sm);
    font-size: 13.5px;
    color: var(--sh-text-2) !important;
    line-height: 1;
}
.sh-lang-menu > li > a:hover, .sh-lang-menu > li > a:focus {
    background: var(--sh-surface-alt) !important;
    color: var(--sh-text) !important;
}
.sh-lang-menu > li.active > a {
    background: var(--sh-brand-soft) !important;
    color: var(--sh-brand-dark) !important;
    font-weight: 600;
}
.sh-lang-menu > li > a .flag-icon {
    width: 22px; height: 16px;
    border-radius: 2px;
    flex-shrink: 0;
}
.sh-lang-menu > li > a > span:not(.flag-icon) {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.sh-lang-check {
    color: var(--sh-brand);
    font-size: 11px !important;
    margin-left: auto;
}
[dir="rtl"] .sh-lang-check { margin-left: 0; margin-right: auto; }

/* Hide any leftover bootstrap-select wrappers on this dropdown */
.langdiv .bootstrap-select { display: none !important; }

/* ============== LIVE CONSULTATION REMOVAL ============== */
/* Feature removed per request. Catches any straggling buttons/links not
   already hidden by the DB permission flags or the controller stubs. */
a[href*="patient/dashboard/liveconsult"],
a[href*="patient/dashboard/join"],
a[href*="admin/zoom_conference"],
a[href*="zoom_conference/consult"],
a[href*="zoom_conference/meeting"],
a[href*="zoom_conference/join"],
a[href*="admin/report/live_consultation"],
.live-consult,
.live_consult_link,
[data-live-consult],
.btn-live-consult {
    display: none !important;
}

/* ============== SCROLLBAR (webkit) ============== */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--sh-bg); }
::-webkit-scrollbar-thumb { background: var(--sh-border-strong); border-radius: 8px; }
::-webkit-scrollbar-thumb:hover { background: var(--sh-faint); }

/* ============== MODAL FORM POLISH ==============
   Cleans up labels, required asterisks, file inputs, and field spacing
   inside any modal-form. Applies globally so every CRUD modal benefits.
*/
.modal .form-group {
    margin-bottom: 14px;
}
.modal .form-group > label {
    display: inline-block;
    font-weight: 600;
    font-size: 13px;
    color: var(--sh-text);
    margin-bottom: 6px;
    line-height: 1.3;
}
.modal .form-group > label small.req,
.modal .form-group small.req {
    color: #d9534f;
    font-weight: 700;
    font-size: 13px;
    margin-left: 2px;
}
[dir="rtl"] .modal .form-group > label small.req,
[dir="rtl"] .modal .form-group small.req {
    margin-left: 0;
    margin-right: 2px;
}
.modal .form-group .form-control {
    height: 38px;
    border-radius: 6px;
    border-color: var(--sh-border-strong);
    box-shadow: none;
    transition: border-color .15s, box-shadow .15s;
}
.modal .form-group .form-control:focus {
    border-color: var(--sh-brand);
    box-shadow: 0 0 0 3px rgba(48,127,226,0.12);
}
.modal .form-group textarea.form-control {
    height: auto;
    min-height: 80px;
    resize: vertical;
}
/* Match height of bootstrap-filestyle (file inputs) with regular inputs */
.modal .form-group .bootstrap-filestyle.input-group {
    width: 100%;
    display: flex;
}
.modal .form-group .bootstrap-filestyle.input-group .form-control {
    height: 38px;
    line-height: 1.5;
}
.modal .form-group .bootstrap-filestyle.input-group .group-span-filestyle .btn {
    height: 38px;
    border-radius: 0 6px 6px 0;
    padding-top: 8px;
}
[dir="rtl"] .modal .form-group .bootstrap-filestyle.input-group .group-span-filestyle .btn {
    border-radius: 6px 0 0 6px;
}
/* Tighter modal scrollable area, no jumpy resizes */
.modal .scroll-area {
    max-height: 70vh;
    overflow-y: auto;
    padding-right: 4px;
}
/* Inline form-error spans should not push fields around */
.modal .form-group .text-danger {
    display: block;
    font-size: 12px;
    margin-top: 4px;
    min-height: 0;
}

/* ============================================================
   TABLET + MOBILE NAVBAR COLLAPSE (max-width: 991px)
   ------------------------------------------------------------
   The navbar fits ~7 icons + search + hospital name only when
   the viewport is ≥1200px. Below that the icon row overflows
   downward and visually lands on top of the page hero (which
   is what the tablet bug screenshot showed). Collapse the row
   into the .sh-nav-more dropdown for everything ≤991px so
   tablets get the same clean overflow icon as phones. Hospital-
   name text + page-search form are also redundant here (the
   logo bar above shows the brand; users can search inside each
   list page). The desktop layout (≥992px) is untouched.

   This block only handles navbar/header layout. The richer
   mobile rules (typography, modals, hero, padding scale) stay
   in the 767px block below — tablets keep their roomier base.
   ============================================================ */
@media (max-width: 991px) {
    /* Hide the duplicate hospital-name text — the logo at the
       top of the header already shows the brand. */
    .main-header .sidebar-session,
    .skin-blue .main-header .sidebar-session { display: none !important; }

    /* Collapse the hospital-name column at every Bootstrap tier
       active in this range (col-sm-3 768-991px, col-xs-3 <768px). */
    .main-header .navbar > .col-sm-3,
    .main-header .navbar > .col-xs-3 {
        display: none !important;
    }
    /* Stretch the icons column to full width and clear the
       sidebar-toggle on the start side (50px on LTR/left,
       same on RTL/right). */
    .main-header .navbar > .col-sm-9,
    .main-header .navbar > .col-xs-9 {
        width: 100% !important;
        padding-left: 50px !important;
        padding-right: 8px !important;
    }
    [dir="rtl"] .main-header .navbar > .col-sm-9,
    [dir="rtl"] .main-header .navbar > .col-xs-9 {
        padding-left: 8px !important;
        padding-right: 50px !important;
    }

    /* The desktop navbar search form is a 260px pill — adds up to
       overflow on tablets. Hide it; per-page search inputs cover
       the same need. */
    .main-header .navbar .search-form { display: none !important; }

    /* Collapse all secondary action icons (notifications, bed,
       chat, calendar, tasks, branch switch — tagged .sh-nav-extra)
       and reveal the .sh-nav-more overflow dropdown. */
    .headertopmenu > li.sh-nav-extra { display: none !important; }
    .headertopmenu > li.sh-nav-more  { display: list-item !important; }

    /* Tighten icon padding so what's left (lang switcher, more,
       avatar) breathes without crowding the navbar edges. */
    .skin-blue .main-header .navbar .nav > li > a,
    .main-header .navbar .nav > li > a {
        padding: 15px 10px !important;
    }
    .headertopmenu > li {
        margin: 0 2px;
    }
    .headertopmenu > li.user-menu {
        margin-left: 6px;
    }
    [dir="rtl"] .headertopmenu > li.user-menu {
        margin-left: 0;
        margin-right: 6px;
    }
    .headertopmenu > li.sh-nav-more > a > .label {
        top: 6px;
        right: 0;
    }
    [dir="rtl"] .headertopmenu > li.sh-nav-more > a > .label {
        right: auto;
        left: 0;
    }
}

/* ============================================================
   TABLE OVERFLOW SAFETY NET (all viewports)
   ~163 admin views render <table class="table"> without a
   .table-responsive wrapper. Without this, those tables push
   the entire layout sideways on phones. Apply horizontal scroll
   to any unwrapped table inside content surfaces. Wrapped tables
   (.table-responsive > .table) are untouched — Bootstrap already
   handles them.
   ============================================================ */
.box-body > .table:not(.dataTable),
.box > .table:not(.dataTable),
.content > .table:not(.dataTable),
.tab-content > .table:not(.dataTable),
.modal-body > .table:not(.dataTable) {
    display: block;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* ============================================================
   MOBILE OVERRIDES (max-width: 767px)
   The base design system targets desktop. This block tightens
   spacing, sizes touch targets, and reflows modals/heroes for
   phones. Order matters: mobile rules live at the END of the
   file so they win the cascade against the desktop defaults
   above (which use !important in many places).
   ============================================================ */
@media (max-width: 767px) {

    /* ---------- Layout / content gutters ---------- */
    /* Desktop uses 22px gutters; phones can only afford ~12px. */
    .content-header { padding: 14px 12px 4px !important; }
    .content        { padding: 6px 12px !important; }
    .content-wrapper, .right-side { padding-bottom: 24px; }

    /* On mobile AdminLTE stacks the .logo bar ABOVE the .navbar (each is
       60px tall in our reskin), so the total fixed-header height is ~120px.
       Content needs to clear that PLUS a 10px gap so it doesn't touch
       the navbar's bottom edge. Total 134px (60+60+14). */
    .fixed .content-wrapper, .fixed .right-side { padding-top: 134px !important; }

    /* Mobile companion to the global content-wrapper min-height rule.
       Subtract the taller mobile header so viewport-fill pages (chat,
       reports, etc.) don't overflow the screen by a header's worth. */
    .content-wrapper, .right-side { min-height: calc(100vh - 124px) !important; }

    /* ---------- Typography ---------- */
    .content-header > h1 { font-size: 18px; }
    .content-header > h1 > small { display: block; margin-left: 0; margin-top: 2px; font-size: 12px; }
    .box-title, .box-header > .box-title { font-size: 14px !important; }

    /* ---------- Cards / boxes ---------- */
    .box           { margin-bottom: 14px; border-radius: 10px; }
    .box-header    { padding: 14px 14px !important; }
    .box-body      { padding: 14px !important; }
    .box-footer    { padding: 12px 14px; }
    .info-box,
    .small-box,
    .sh-card       { margin-bottom: 14px; }
    .sh-card       { padding: 16px; }
    .sh-card-lg    { padding: 18px; }

    /* ---------- Hero banner ---------- */
    .sh-hero       { padding: 16px 16px; border-radius: 12px; margin-bottom: 14px; }
    .sh-hero h2    { font-size: 18px; margin-bottom: 4px; }
    .sh-hero p     { font-size: 13px; margin-bottom: 0; }
    /* Decorative blobs (220px / 160px) eat the screen on phones — hide. */
    .sh-hero:before, .sh-hero:after { display: none; }
    /* The CTA column is float:right + text-right on desktop. On mobile we
       want it to sit cleanly under the headline, not floated, full-width
       so the search button looks intentional rather than stranded. */
    .sh-hero .row > [class*="col-"] { float: none; width: 100%; }
    .sh-hero .text-right {
        text-align: left !important;
        margin-top: 12px;
        padding-top: 0 !important; /* override inline style="padding-top:8px" */
    }
    [dir="rtl"] .sh-hero .text-right { text-align: right !important; }
    /* Hero CTA: full-width block on mobile so it reads as a clear primary
       action instead of a stranded icon button. Centered content keeps
       the icon and label balanced. */
    .sh-hero .btn {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 8px;
        width: 100%;
        min-height: 44px;
    }

    /* ---------- Touch targets (WCAG / Apple HIG: 44px min) ---------- */
    .btn           { min-height: 40px; padding: 10px 16px; font-size: 14px; }
    .btn-lg        { min-height: 48px; padding: 12px 22px; font-size: 15px; }
    .btn-sm        { min-height: 36px; padding: 8px 12px;  font-size: 13px; }
    .btn-xs        { min-height: 32px; padding: 6px 10px;  font-size: 12px; }

    /* ---------- Form inputs ----------
       16px input font-size prevents iOS Safari from auto-zooming on focus.
       Slightly taller controls give thumbs more room. */
    .form-control,
    .select2-container--default .select2-selection--single,
    .select2-container--default .select2-selection--multiple {
        height: 44px;
        font-size: 16px;
    }
    textarea.form-control { height: auto; min-height: 88px; }
    .modal .form-group .form-control { height: 42px; font-size: 16px; }
    .modal .form-group .bootstrap-filestyle.input-group .form-control,
    .modal .form-group .bootstrap-filestyle.input-group .group-span-filestyle .btn { height: 42px; }

    /* ---------- Modals ---------- */
    /* Bootstrap 3 modal-dialog defaults to ~600px centered with 10px margin.
       Make it edge-to-edge with a 6px gutter on phones so forms can breathe. */
    .modal-dialog          { margin: 6px; width: auto !important; }
    .modal-content         { border-radius: 10px; }
    .modal-header          { padding: 14px 16px; }
    .modal-body            { padding: 14px 16px; }
    .modal-footer          { padding: 12px 16px; }
    .modal .scroll-area    { max-height: 60vh; }
    /* Footer buttons stack on narrow screens instead of crowding. */
    .modal-footer .btn     { width: 100%; margin: 4px 0 !important; }

    /* ---------- Tables ---------- */
    /* Reduce row padding so dense data tables don't waste horizontal space
       once the safety-net wrapper makes them scrollable. */
    .table > thead > tr > th,
    .table > tbody > tr > td { padding: 10px 10px !important; font-size: 13px; }
    /* Hint that tables can be scrolled sideways. */
    .table-responsive,
    .box-body > .table,
    .box > .table { -webkit-overflow-scrolling: touch; }

    /* ---------- Top navbar / header ----------
       The 991px block above already collapses the navbar (hides hospital
       name, search form, and .sh-nav-extra; reveals .sh-nav-more). On
       phones we just want a slightly tighter icon padding than tablets. */
    .skin-blue .headertopmenu > li > a,
    .headertopmenu > li > a {
        padding: 15px 8px !important;
    }

    /* ---------- Sidebar ---------- */
    /* On mobile the fixed header is ~120px tall (logo bar 60px stacked
       above navbar 60px). The off-canvas sidebar (.main-sidebar) is
       ALSO fixed at top:0 — its first child (the search-form2 pill)
       was being hidden BEHIND the navbar with our previous 60px
       padding. Push it down to clear the full stacked header height
       + 10px gap, matching the content-wrapper. */
    .main-sidebar, .left-side { padding-top: 134px !important; }
    .skin-blue .sidebar-menu { padding: 4px 8px 60px; }
    .skin-blue .sidebar-menu > li > a,
    .sidebar-menu > li > a { padding: 12px 12px; font-size: 14px; }

    /* ---------- Stat / KPI cards ---------- */
    .sh-stat-value { font-size: 22px; }
    .info-box-icon { width: 70px; font-size: 24px; line-height: 70px; }
    .info-box-content { margin-left: 70px; padding: 8px 10px; }
    [dir="rtl"] .info-box-content { margin-left: 0; margin-right: 70px; }
    .info-box-number { font-size: 20px; }

    /* ---------- Charts ---------- */
    canvas { max-height: 240px; }

    /* ---------- Language switcher ---------- */
    .sh-lang-label { display: none; }   /* show flag + caret only */
    .sh-lang-toggle { padding: 6px 10px; }

    /* ---------- Navbar overflow (mobile) ----------
       Collapse the cluster of action icons (notifications, bed status,
       chat, calendar, tasks, branch switch — all tagged .sh-nav-extra
       in header.php) into the .sh-nav-more dropdown. The "more"
       dropdown is hidden on desktop (rule below this @media block)
       and revealed here so phones get one tappable overflow icon
       instead of a cramped row that wraps. */
    .headertopmenu > li.sh-nav-extra { display: none !important; }
    .headertopmenu > li.sh-nav-more  { display: list-item !important; }
}

/* ============================================================
   NAVBAR OVERFLOW MENU — desktop default (hidden)
   The .sh-nav-more <li> is mobile-only. On desktop the original
   .sh-nav-extra icons are visible inline. The mobile rule above
   inverts both inside the (max-width:767px) block.
   ============================================================ */
.headertopmenu > li.sh-nav-more { display: none; }

/* Style the "more" toggle to match the rest of the navbar icons. */
.headertopmenu > li.sh-nav-more > a {
    position: relative;
}
.headertopmenu > li.sh-nav-more > a > .fa-ellipsis-v {
    font-size: 16px;
    color: var(--sh-text-2);
}
.headertopmenu > li.sh-nav-more.open > a > .fa-ellipsis-v,
.headertopmenu > li.sh-nav-more > a:hover > .fa-ellipsis-v {
    color: var(--sh-brand);
}
/* Aggregate badge on the dots — same look as other navbar badges. */
.headertopmenu > li.sh-nav-more > a > .label {
    position: absolute;
    top: 9px; right: 4px;
}
[dir="rtl"] .headertopmenu > li.sh-nav-more > a > .label { right: auto; left: 4px; }

/* Dropdown menu — clean list with icon + label + optional badge. */
.sh-nav-more-menu {
    min-width: 240px;
    padding: 6px;
    margin-top: 6px !important;
    border-radius: var(--sh-r);
    border: 1px solid var(--sh-border);
    box-shadow: var(--sh-shadow-2);
    background: var(--sh-surface);
    list-style: none;
}
[dir="rtl"] .sh-nav-more-menu { left: auto; right: 0; }
.sh-nav-more-menu > li > a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px !important;
    border-radius: var(--sh-r-sm);
    font-size: 14px;
    color: var(--sh-text-2) !important;
    line-height: 1.2;
    min-height: 44px; /* touch target */
}
.sh-nav-more-menu > li > a:hover,
.sh-nav-more-menu > li > a:focus {
    background: var(--sh-surface-alt) !important;
    color: var(--sh-text) !important;
}
.sh-nav-more-menu > li > a > .fa,
.sh-nav-more-menu > li > a > .fas {
    color: var(--sh-muted);
    width: 18px;
    text-align: center;
    font-size: 15px;
    flex-shrink: 0;
}
.sh-nav-more-menu > li > a:hover > .fa,
.sh-nav-more-menu > li > a:hover > .fas {
    color: var(--sh-brand);
}
/* Badges inside the more menu — pull-right is set in PHP via Bootstrap class. */
.sh-nav-more-menu > li > a > .label.pull-right {
    margin-left: auto;
    align-self: center;
}
[dir="rtl"] .sh-nav-more-menu > li > a > .label.pull-right {
    margin-left: 0;
    margin-right: auto;
    float: none !important;
}

/* ============================================================
   EXTRA-NARROW PHONES (max-width: 374px)
   iPhone SE / older Android — even tighter gutters.
   ============================================================ */
@media (max-width: 374px) {
    .content-header { padding: 12px 10px 4px !important; }
    .content        { padding: 4px 10px !important; }
    .box-body       { padding: 12px !important; }
    .box-header     { padding: 12px !important; }
    .sh-card        { padding: 14px; }
    .sh-hero        { padding: 16px; }
    .content-header > h1 { font-size: 17px; }
}

/* ============================================================
   COARSE POINTER (touchscreens regardless of viewport size)
   Tablets in landscape may exceed 768px but still need bigger
   touch targets. Apply minimum tap sizes everywhere a finger
   may land.
   ============================================================ */
@media (hover: none) and (pointer: coarse) {
    .btn         { min-height: 40px; }
    .btn-sm      { min-height: 36px; }
    .pagination > li > a,
    .pagination > li > span { padding: 10px 14px; }
    .sidebar-menu > li > a { padding: 12px 12px; }
}
