/*
 * Teach Hub — Mobile-First Stylesheet
 * Single source of truth for all responsive behavior.
 * Loaded last so it wins over all other CSS files.
 * Breakpoints:
 *   xs  : 0–575px   (small phones)
 *   sm  : 576–767px (large phones)
 *   md  : 768–991px (tablets)
 *   lg  : 992px+    (desktop)
 */

/* ============================================================
   1. BASE — applies at every screen size
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; }

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
}

body {
    overflow-x: clip;
    -webkit-font-smoothing: antialiased;
}

/* Ensure Bootstrap modals are never clipped by overflow on body/html.
   overflow-x: clip prevents horizontal scroll but does NOT create a
   scroll container, so fixed/absolute modal backdrops render correctly. */
.modal,
.modal-backdrop {
    overflow-x: visible !important;
}

.modal-dialog {
    overflow: visible !important;
}

img, video, iframe, svg, canvas {
    max-width: 100%;
    height: auto;
    display: block;
}

.about-profile-image {
    width: 220px !important;
    height: 220px !important;
    max-width: 100% !important;
    object-fit: contain !important;
    border-radius: 20px !important;
    margin: 0 auto !important;
}

/* About page readability and visual hierarchy */
html:has(body[data-page="about"]),
body[data-page="about"],
body[data-page="about"] #page-top {
    background: #f3f7f4 !important;
}

body[data-page="about"] .page-header {
    background: linear-gradient(135deg, #0b6b36 0%, #084c28 100%) !important;
    padding: 2.25rem 1rem !important;
    margin-bottom: 0 !important;
}

body[data-page="about"] .page-header h1 {
    color: #ffffff !important;
    font-size: clamp(1.75rem, 4vw, 2.35rem) !important;
    font-weight: 700 !important;
    letter-spacing: 0 !important;
    margin-bottom: .65rem !important;
}

body[data-page="about"] .page-header p {
    color: #e5f7eb !important;
    font-size: 1rem !important;
    font-weight: 500 !important;
    opacity: 1 !important;
}

body[data-page="about"] > .container.py-5 {
    background: #f3f7f4 !important;
    max-width: none;
    width: 100%;
    padding-top: 2.75rem !important;
    padding-bottom: 3.5rem !important;
}

body[data-page="about"] .about-profile-image {
    border: 5px solid #ffffff;
    box-shadow: 0 12px 30px rgba(0, 0, 0, .18) !important;
}

body[data-page="about"] .card-modern {
    max-width: 900px;
    margin: 0 auto;
    background: #ffffff !important;
    border: 1px solid #dce7df !important;
    border-radius: 18px !important;
    box-shadow: 0 12px 32px rgba(13, 65, 36, .1) !important;
}

body[data-page="about"] .card-modern .card-body {
    padding: 2.5rem !important;
}

body[data-page="about"] .about-content {
    max-width: 760px;
    color: #24332a;
    font-size: 1rem;
    line-height: 1.8;
}

body[data-page="about"] .about-content p {
    margin-bottom: 1.25rem;
}

body[data-page="about"] .about-content h2,
body[data-page="about"] .about-content h3,
body[data-page="about"] .about-content h4 {
    color: #123d26;
    font-weight: 700;
    line-height: 1.3;
    margin-top: 1.75rem;
    margin-bottom: .75rem;
}

body[data-page="about"] .about-content hr {
    border-color: #cbd9cf;
    margin: 1.5rem 0;
    opacity: 1;
}

@media (max-width: 575.98px) {
    body[data-page="about"] .page-header {
        padding: 1.75rem 1rem !important;
    }

    body[data-page="about"] .card-modern .card-body {
        padding: 1.5rem !important;
    }
}

/* ===== SUPER ADMIN MOBILE SHELL ===== */
@media (max-width: 767.98px) {
    body[data-role="super_admin"] #content-wrapper #content > .container-fluid {
        width: 100% !important;
        max-width: 100% !important;
        padding: 0.75rem !important;
        margin: 0 !important;
        border-radius: 0 !important;
        overflow: visible !important;
    }

    body[data-role="super_admin"] #content > .topbar {
        margin-bottom: 0.75rem !important;
    }

    body[data-role="super_admin"] .container-fluid > .d-flex.justify-content-between,
    body[data-role="super_admin"] .container-fluid > .d-sm-flex {
        align-items: flex-start !important;
        flex-wrap: wrap;
        gap: 0.65rem;
        margin-bottom: 0.85rem !important;
    }

    body[data-role="super_admin"] .container-fluid > .d-flex.justify-content-between > h1,
    body[data-role="super_admin"] .container-fluid > .d-sm-flex > h1,
    body[data-role="super_admin"] .container-fluid > h1 {
        min-width: 0;
        margin: 0;
        font-size: 1.15rem;
        line-height: 1.25;
        overflow-wrap: anywhere;
    }

    body[data-role="super_admin"] .container-fluid > .d-flex.justify-content-between > .btn,
    body[data-role="super_admin"] .container-fluid > .d-sm-flex > .btn {
        flex: 0 0 auto;
        padding: 0.4rem 0.6rem;
        font-size: 0.72rem;
    }

    body[data-role="super_admin"] .card-body { padding: 0.85rem !important; }
    body[data-role="super_admin"] .card-header { padding: 0.7rem 0.85rem !important; }
    body[data-role="super_admin"] .card-header h5,
    body[data-role="super_admin"] .card-header h6 { font-size: 0.82rem; line-height: 1.25; }

    body[data-role="super_admin"] .table-responsive {
        width: 100%;
        max-width: 100%;
        overflow-x: auto !important;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
        border-radius: 0.45rem;
    }
    body[data-role="super_admin"] .table-responsive > table {
        min-width: 620px;
        margin-bottom: 0 !important;
    }
    body[data-role="super_admin"] .table th,
    body[data-role="super_admin"] .table td {
        white-space: nowrap;
        vertical-align: middle;
        font-size: 0.72rem;
        padding: 0.55rem 0.6rem;
    }

    body[data-role="super_admin"] form.row {
        row-gap: 0.5rem;
        margin-left: 0;
        margin-right: 0;
    }
    body[data-role="super_admin"] form.row > [class*="col-"] {
        width: 100%;
        padding-left: 0;
        padding-right: 0;
    }
    body[data-role="super_admin"] form.row .btn { width: 100%; }
    body[data-role="super_admin"] .form-control,
    body[data-role="super_admin"] .form-select { width: 100%; }

    body[data-role="super_admin"] .modal-dialog {
        width: auto;
        max-width: calc(100% - 1rem);
        margin: 0.5rem auto !important;
    }
    body[data-role="super_admin"] .modal-content { max-height: calc(100vh - 1rem); }
    body[data-role="super_admin"] .modal-body { overflow-y: auto; }

    body[data-role="super_admin"] .stats-grid,
    body[data-role="super_admin"] .ops-status-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: 0.6rem !important;
    }
    body[data-role="super_admin"] .stat-card,
    body[data-role="super_admin"] .quick-actions,
    body[data-role="super_admin"] .ops-panel {
        padding: 0.85rem !important;
        border-radius: 0.65rem;
    }
    body[data-role="super_admin"] .stat-number { font-size: 1.55rem !important; }
    body[data-role="super_admin"] .stat-icon { width: 40px !important; height: 40px !important; font-size: 1rem !important; }
    body[data-role="super_admin"] .stat-card .btn { padding: 0.5rem !important; font-size: 0.7rem !important; }
    body[data-role="super_admin"] .actions-grid { grid-template-columns: 1fr !important; gap: 0.5rem; }
    body[data-role="super_admin"] .actions-grid .btn { padding: 0.65rem; font-size: 0.76rem; }
    body[data-role="super_admin"] .ops-status .value { font-size: 1.25rem; }
}

/* ===== TEACHER MOBILE SHELL ===== */
@media (max-width: 767.98px) {
    body[data-role="teacher"] #content-wrapper #content > .container-fluid {
        width: 100% !important;
        max-width: 100% !important;
        padding: 0.75rem !important;
        margin: 0 !important;
        overflow: visible !important;
    }

    body[data-role="teacher"] #content > .topbar { margin-bottom: 0.75rem !important; }

    body[data-role="teacher"] .container-fluid > .d-flex.justify-content-between,
    body[data-role="teacher"] .container-fluid > .d-sm-flex,
    body[data-role="teacher"] .container-fluid > .page-header {
        align-items: flex-start !important;
        flex-wrap: wrap;
        gap: 0.6rem;
        margin-bottom: 0.85rem !important;
    }

    body[data-role="teacher"] .container-fluid h1,
    body[data-role="teacher"] .container-fluid .h1,
    body[data-role="teacher"] .container-fluid .h3 {
        min-width: 0;
        margin-bottom: 0;
        font-size: 1.15rem !important;
        line-height: 1.25;
        overflow-wrap: anywhere;
    }

    body[data-role="teacher"] .container-fluid > .d-flex > .btn,
    body[data-role="teacher"] .container-fluid > .d-sm-flex > .btn {
        flex: 0 0 auto;
        padding: 0.4rem 0.6rem;
        font-size: 0.72rem;
    }

    body[data-role="teacher"] .card-body { padding: 0.85rem !important; }
    body[data-role="teacher"] .card-header { padding: 0.7rem 0.85rem !important; }
    body[data-role="teacher"] .card-header h5,
    body[data-role="teacher"] .card-header h6 { font-size: 0.82rem; line-height: 1.25; }

    body[data-role="teacher"] .table-responsive {
        width: 100%;
        max-width: 100%;
        overflow-x: auto !important;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
        border-radius: 0.45rem;
    }
    body[data-role="teacher"] .table-responsive > table {
        min-width: 620px;
        margin-bottom: 0 !important;
    }
    body[data-role="teacher"] .table th,
    body[data-role="teacher"] .table td {
        white-space: nowrap;
        vertical-align: middle;
        font-size: 0.72rem;
        padding: 0.55rem 0.6rem;
    }

    body[data-role="teacher"] form.row {
        row-gap: 0.5rem;
        margin-left: 0;
        margin-right: 0;
    }
    body[data-role="teacher"] form.row > [class*="col-"] {
        width: 100%;
        padding-left: 0;
        padding-right: 0;
    }
    body[data-role="teacher"] form.row .btn { width: 100%; }
    body[data-role="teacher"] .form-control,
    body[data-role="teacher"] .form-select,
    body[data-role="teacher"] textarea { width: 100%; max-width: 100%; }

    body[data-role="teacher"] .nav-pills,
    body[data-role="teacher"] .nav-tabs {
        flex-wrap: nowrap !important;
        overflow-x: auto;
        overflow-y: hidden;
        gap: 0.25rem !important;
        padding-bottom: 0.25rem;
        scrollbar-width: none;
    }
    body[data-role="teacher"] .nav-pills::-webkit-scrollbar,
    body[data-role="teacher"] .nav-tabs::-webkit-scrollbar { display: none; }
    body[data-role="teacher"] .nav-pills .nav-item,
    body[data-role="teacher"] .nav-tabs .nav-item { flex: 0 0 auto; }
    body[data-role="teacher"] .nav-pills .nav-link,
    body[data-role="teacher"] .nav-tabs .nav-link {
        white-space: nowrap;
        padding: 0.4rem 0.6rem;
        font-size: 0.72rem;
    }

    body[data-role="teacher"] .modal-dialog {
        width: auto;
        max-width: calc(100% - 1rem);
        margin: 0.5rem auto !important;
    }
    body[data-role="teacher"] .modal-content { max-height: calc(100vh - 1rem); }
    body[data-role="teacher"] .modal-body { overflow-y: auto; }
    body[data-role="teacher"] .modal-footer {
        gap: 0.5rem;
        flex-wrap: wrap;
    }
    body[data-role="teacher"] .modal-footer .btn { min-height: 38px; }

    body[data-role="teacher"] .row.g-3,
    body[data-role="teacher"] .row.g-4 { row-gap: 0.75rem !important; }
    body[data-role="teacher"] .btn { min-height: 40px; }
    body[data-role="teacher"] .alert { font-size: 0.78rem; line-height: 1.35; }
}

/* Prevent iOS zoom on input focus */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="tel"],
input[type="search"],
input[type="url"],
input[type="date"],
input[type="time"],
select,
textarea,
.form-control,
.form-select {
    font-size: 16px !important;
}

/* Minimum touch target size */
.btn,
a.btn,
button,
[role="button"] {
    min-height: 44px;
    min-width: 44px;
}

.btn-sm {
    min-height: 36px;
}

/* Tables always scrollable */
.table-responsive {
    display: block;
    overflow-x: auto;
    max-width: 100%;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
}

@media (max-width: 767.98px) {
    .table-responsive > table {
        width: max-content;
        min-width: 100%;
    }
}

/* ============================================================
   2. PUBLIC NAVBAR — mobile-first
   ============================================================ */
.navbar-public {
    position: sticky;
    top: 0;
    z-index: 1030;
    background: #fff;
    border-bottom: 1px solid #e5e7eb;
    box-shadow: 0 1px 4px rgba(0,0,0,.06);
    /* Do NOT set overflow:hidden — it would clip the dropdown */
}

.navbar-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: .75rem 1rem;
    max-width: 1400px;
    margin: 0 auto;
    gap: .5rem;
}

.navbar-brand {
    display: flex;
    align-items: center;
    gap: .5rem;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--primary, #2563eb);
    text-decoration: none;
    flex-shrink: 0;
    max-width: calc(100% - 56px);
}

.navbar-brand span {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.navbar-brand img.brand-logo {
    height: 36px;
    width: auto;
    flex-shrink: 0;
}

/* Desktop Action Buttons (hidden on mobile via CSS) */
.navbar-actions {
    display: none;
}

/* Hamburger — mobile only, always last in flex row */
.navbar-toggler {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    padding: 0;
    background: transparent;
    border: none;
    border-radius: .5rem;
    color: #374151;
    font-size: 1.25rem;
    cursor: pointer;
    flex-shrink: 0;
    transition: background .15s;
}

.navbar-toggler:hover {
    background: #f3f4f6;
}

.navbar-toggler:focus {
    outline: 3px solid rgba(37,99,235,.14);
    outline-offset: 2px;
}

/* Mobile dropdown menu — full width block element below navbar-container */
.navbar-mobile-menu {
    display: block;
    width: 100%;
    background: #fff;
    /* Use absolute so the menu overlays content below the sticky header */
    position: absolute;
    left: 0;
    right: 0;
    top: 100%;
    border-top: none;
    box-shadow: 0 6px 18px rgba(15,23,42,0.08);
    max-height: 0;
    overflow: hidden;
    transition: transform .28s cubic-bezier(.2,.9,.2,1), opacity .22s ease;
    transform-origin: top center;
    transform: translateY(-6px) scaleY(.98);
    opacity: 0;
    z-index: 1029;
}

.navbar-mobile-menu.show {
    max-height: 1000px; /* allow expansion */
    transform: translateY(0) scaleY(1);
    opacity: 1;
}

.navbar-mobile-menu ul {
    list-style: none;
    margin: 0;
    padding: .5rem 0;
}

.navbar-mobile-menu a {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: 1rem 1.25rem;
    color: #374151;
    font-size: .98rem;
    font-weight: 600;
    text-decoration: none;
    border-left: 3px solid transparent;
    transition: background .15s, color .15s, border-color .15s;
    touch-action: manipulation;
}

.navbar-mobile-menu a:hover,
.navbar-mobile-menu a.active {
    background: #f9fafb;
    color: var(--primary, #2563eb);
    border-left-color: var(--primary, #2563eb);
}

/* Compact authenticated topbar controls on narrow screens. */
@media (max-width: 575.98px) {
    .topbar {
        height: 56px !important;
        padding: 0 0.5rem !important;
    }

    .topbar > .navbar-nav {
        align-items: center;
        gap: 0.125rem;
    }

    .topbar > .navbar-nav > .nav-item {
        margin-left: 0 !important;
        margin-right: 0 !important;
    }

    .topbar > .navbar-nav .nav-link,
    .topbar > .navbar-nav #bas-dark-toggle {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 36px !important;
        min-width: 36px !important;
        height: 36px !important;
        min-height: 36px !important;
        padding: 0 !important;
    }

    .topbar > .navbar-nav #bas-dark-toggle,
    .topbar > .navbar-nav #alertsDropdown,
    .topbar > .navbar-nav #userDropdown {
        width: 36px !important;
        min-width: 36px !important;
        height: 36px !important;
        min-height: 36px !important;
    }

    .topbar > .navbar-nav #alertsDropdown::after,
    .topbar > .navbar-nav #userDropdown::after {
        display: none;
    }

    .topbar > .navbar-nav #alertsDropdown .fa-bell {
        font-size: 0.9rem;
    }

    .topbar > .navbar-nav #userDropdown img.img-profile {
        width: 32px !important;
        height: 32px !important;
    }

    .topbar > .navbar-nav .notif-badge {
        top: 1px !important;
        left: auto !important;
        right: 0 !important;
        transform: none !important;
        min-width: 16px !important;
        height: 16px !important;
        padding: 0 3px !important;
        font-size: 0.55rem !important;
        line-height: 16px !important;
    }

    .topbar .dropdown-wide {
        position: fixed !important;
        top: 68px !important;
        right: 12px !important;
        left: 12px !important;
        width: auto !important;
        max-width: none !important;
        margin: 0 !important;
        transform: none !important;
    }
}

/* Auth buttons inside mobile menu */
.navbar-mobile-menu .mobile-auth {
    display: flex;
    flex-direction: column;
    gap: .5rem;
    padding: .75rem 1.25rem 1rem;
    border-top: 1px solid #e5e7eb;
}

.navbar-mobile-menu .mobile-auth .btn {
    width: 100%;
    justify-content: center;
}

/* ============================================================
   3. AUTHENTICATED LAYOUT — sidebar + topbar
   ============================================================ */

/* --- Topbar --- */
.topbar {
    position: sticky !important;
    top: 0 !important;
    z-index: 1020 !important;
    height: 60px !important;
    background: #fff !important;
    border-bottom: 1px solid #e5e7eb !important;
    box-shadow: 0 1px 4px rgba(0,0,0,.06) !important;
    display: flex !important;
    align-items: center !important;
    padding: 0 1rem !important;
}

/* Hamburger inside topbar */
#sidebarToggleTop {
    display: flex !important;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    background: transparent;
    border: none;
    border-radius: .5rem;
    color: #374151;
    font-size: 1.25rem;
    cursor: pointer;
    flex-shrink: 0;
    transition: background .15s;
}

#sidebarToggleTop:hover {
    background: #f3f4f6;
}

/* --- Sidebar --- */
.sidebar,
ul.navbar-nav.sidebar,
.navbar-nav.bg-gradient-primary.sidebar.sidebar-dark.accordion {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    height: 100vh !important;
    width: 280px !important;
    z-index: 1050 !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    transform: translateX(-100%) !important;
    transition: transform .3s cubic-bezier(.4,0,.2,1) !important;
    /* Smooth scrolling inside sidebar */
    -webkit-overflow-scrolling: touch;
}

/* Sidebar visible state */
.sidebar.toggled,
ul.navbar-nav.sidebar.toggled,
.navbar-nav.bg-gradient-primary.sidebar.sidebar-dark.accordion.toggled {
    transform: translateX(0) !important;
}

/* Content wrapper — always full width on mobile */
#content-wrapper,
div#content-wrapper {
    margin-left: 0 !important;
    width: 100% !important;
}

/* Prevent body scroll when sidebar is open */
body.sidebar-overlay-active {
    overflow: hidden !important;
}

/* Backdrop */
.sidebar-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.5);
    z-index: 1040;
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    animation: bas-fade-in .2s ease;
}

/* Sidebar nav items — always show text on mobile */
.sidebar .nav-link {
    display: flex !important;
    align-items: center !important;
    gap: .75rem !important;
    padding: .875rem 1rem !important;
    white-space: nowrap !important;
}

.sidebar .nav-link span,
.sidebar .sidebar-brand-text,
.sidebar .sidebar-heading,
.sidebar .collapse-item {
    display: block !important;
    opacity: 1 !important;
    visibility: visible !important;
}

.sidebar .nav-link i {
    width: 20px !important;
    flex-shrink: 0 !important;
    text-align: center;
}

.sidebar-brand {
    flex-direction: row !important;
    gap: .5rem !important;
    padding: 1rem !important;
    height: auto !important;
    min-height: 64px;
}

/* --- Content padding on mobile --- */
#content,
div#content {
    padding: .875rem !important;
}

.container-fluid {
    padding-left: .875rem !important;
    padding-right: .875rem !important;
}

/* ============================================================
   4. CARDS
   ============================================================ */
.card {
    border-radius: .75rem !important;
    margin-bottom: 1rem;
    border: 1px solid #e5e7eb;
    box-shadow: 0 1px 3px rgba(0,0,0,.06);
}

.card-body {
    padding: 1.25rem !important;
}

.card-header {
    padding: .875rem 1.25rem !important;
    font-size: .9375rem;
}

.card-footer {
    padding: .875rem 1.25rem !important;
}

/* ============================================================
   5. FORMS — clean, aligned, professional
   ============================================================ */

/* Form wrapper — consistent max-width on auth pages */
.container > .row.justify-content-center > [class*="col-"] > .card {
    border-radius: 1rem !important;
    box-shadow: 0 4px 24px rgba(0,0,0,.08) !important;
    border: none !important;
}

/* All form groups consistent spacing */
.mb-3,
.form-group {
    margin-bottom: 1.125rem !important;
}

/* Labels — always block, consistent weight */
.form-label {
    display: block;
    font-size: .875rem;
    font-weight: 600;
    color: #374151;
    margin-bottom: .375rem !important;
    line-height: 1.4;
}

/* All inputs — consistent height, padding, border */
.form-control,
.form-select {
    display: block;
    width: 100%;
    height: 46px;
    padding: .625rem .875rem !important;
    font-size: 16px !important; /* prevents iOS zoom */
    font-weight: 400;
    line-height: 1.5;
    color: #111827;
    background-color: #fff;
    border: 1.5px solid #d1d5db !important;
    border-radius: .5rem !important;
    transition: border-color .15s, box-shadow .15s;
    -webkit-appearance: none;
    appearance: none;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--primary, #2563eb) !important;
    box-shadow: 0 0 0 3px rgba(37,99,235,.12) !important;
    outline: none;
}

.form-control::placeholder {
    color: #9ca3af;
    font-size: .9375rem;
}

/* Textarea — auto height, no fixed height */
textarea.form-control {
    height: auto !important;
    min-height: 100px;
    resize: vertical;
    padding: .75rem .875rem !important;
}

/* Disabled inputs */
.form-control:disabled,
.form-control[readonly] {
    background-color: #f9fafb !important;
    color: #6b7280 !important;
    cursor: not-allowed;
}

/* Form text / helper text */
.form-text {
    display: block;
    margin-top: .3rem;
    font-size: .8125rem;
    color: #6b7280;
    line-height: 1.4;
}

/* Input group — icon + input side by side, perfectly aligned */
.input-group {
    display: flex;
    align-items: stretch;
    width: 100%;
    border-radius: .5rem;
    overflow: hidden;
}

.input-group .form-control {
    border-radius: 0 !important;
    border-right: none !important;
    flex: 1;
    min-width: 0;
}

.input-group .form-control:focus {
    z-index: 3;
    border-color: var(--primary, #2563eb) !important;
    box-shadow: none !important;
}

.input-group-text {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 .875rem;
    min-width: 44px;
    background-color: #f3f4f6;
    border: 1.5px solid #d1d5db;
    border-right: none;
    color: #6b7280;
    font-size: .9375rem;
    white-space: nowrap;
    border-radius: 0 !important;
}

/* First child rounded left */
.input-group > :first-child,
.input-group > .input-group-text:first-child {
    border-radius: .5rem 0 0 .5rem !important;
}

/* Last child rounded right */
.input-group > :last-child,
.input-group > .form-control:last-child,
.input-group > .btn:last-child {
    border-radius: 0 .5rem .5rem 0 !important;
    border-right: 1.5px solid #d1d5db !important;
}

/* Input group button (e.g. show/hide password) */
.input-group .btn {
    min-height: 46px;
    padding: 0 .875rem;
    border: 1.5px solid #d1d5db;
    border-left: none !important;
    background: #f3f4f6;
    color: #6b7280;
    border-radius: 0 .5rem .5rem 0 !important;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .15s, color .15s;
}

.input-group .btn:hover {
    background: #e5e7eb;
    color: #374151;
}

/* When input-group has focus, show border on all children */
.input-group:focus-within .input-group-text,
.input-group:focus-within .btn {
    border-color: var(--primary, #2563eb);
}

/* Form check (checkbox/radio) */
.form-check {
    display: flex;
    align-items: flex-start;
    gap: .5rem;
    padding-left: 0;
    margin-bottom: .5rem;
}

.form-check-input {
    width: 18px !important;
    height: 18px !important;
    min-width: 18px;
    margin-top: .125rem;
    border: 1.5px solid #d1d5db;
    border-radius: .25rem;
    cursor: pointer;
    flex-shrink: 0;
}

.form-check-input:checked {
    background-color: var(--primary, #2563eb);
    border-color: var(--primary, #2563eb);
}

.form-check-label {
    font-size: .9rem;
    color: #374151;
    cursor: pointer;
    line-height: 1.5;
}

/* d-flex justify-content-between for remember me + forgot password */
.d-flex.justify-content-between.align-items-center {
    flex-wrap: wrap;
    gap: .5rem;
}

/* ---- Remember me row (login page) ---- */
.remember-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .5rem;
}

.remember-check {
    display: flex;
    align-items: center;
    gap: .5rem;
    cursor: pointer;
    margin: 0;
    font-size: .9rem;
    color: #374151;
    font-weight: 500;
    user-select: none;
}

.remember-check input[type="checkbox"] {
    width: 18px !important;
    height: 18px !important;
    min-width: 18px;
    border: 1.5px solid #d1d5db;
    border-radius: .25rem;
    cursor: pointer;
    accent-color: var(--primary, #2563eb);
    flex-shrink: 0;
    margin: 0 !important;
}

.remember-check span {
    line-height: 1;
    white-space: nowrap;
}

.forgot-link {
    font-size: .875rem;
    font-weight: 500;
    color: var(--primary, #2563eb);
    text-decoration: none;
    white-space: nowrap;
    transition: color .15s;
}

.forgot-link:hover {
    color: var(--primary-hover, #1d4ed8);
    text-decoration: underline;
}

/* d-grid submit button — full width */
.d-grid .btn {
    width: 100%;
    justify-content: center;
}

/* Row columns — proper gutters on mobile */
.row {
    --bs-gutter-x: 1rem;
    --bs-gutter-y: 0;
    margin-left: calc(var(--bs-gutter-x) * -.5);
    margin-right: calc(var(--bs-gutter-x) * -.5);
}

.row > * {
    padding-left: calc(var(--bs-gutter-x) * .5);
    padding-right: calc(var(--bs-gutter-x) * .5);
}

/* On mobile, col-md-6 stacks to full width */
@media (max-width: 767.98px) {
    .col-md-6,
    .col-md-4,
    .col-md-8,
    .col-md-3 {
        width: 100% !important;
        max-width: 100% !important;
        flex: 0 0 100% !important;
    }
}

/* Auth card centering — proper vertical spacing */
.container > .row.justify-content-center {
    padding: 1.5rem 0;
}

/* Card title on auth pages */
.card-body .text-center.mb-4 h1,
.card-body .text-center.mb-4 .h3 {
    font-size: 1.5rem !important;
    font-weight: 700;
    color: #111827;
    margin-bottom: .375rem !important;
}

.card-body .text-center.mb-4 p {
    font-size: .9375rem;
    color: #6b7280;
    margin-bottom: 0;
}

/* Sign in / sign up link at bottom */
.card-body .text-center.mt-4 p {
    font-size: .9375rem;
    color: #6b7280;
    margin-bottom: 0;
}

/* Password strength meter */
.progress {
    height: 6px;
    border-radius: 3px;
    background: #e5e7eb;
    overflow: hidden;
}

/* Password requirements list */
.form-text span {
    display: inline-flex;
    align-items: center;
    gap: .25rem;
    font-size: .8rem;
}

/* Select dropdown arrow */
.form-select {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right .75rem center;
    background-size: 16px 12px;
    padding-right: 2.5rem !important;
}

/* Alert styling */
.alert {
    display: flex;
    align-items: flex-start;
    gap: .625rem;
    padding: .875rem 1rem;
    border-radius: .625rem;
    font-size: .9rem;
    border: none;
    margin-bottom: 1rem;
}

.alert i {
    flex-shrink: 0;
    margin-top: .125rem;
}

.alert .btn-close {
    margin-left: auto;
    flex-shrink: 0;
}

.alert-success {
    background: #d1fae5;
    color: #065f46;
}

.alert-danger {
    background: #fee2e2;
    color: #991b1b;
}

.alert-warning {
    background: #fef3c7;
    color: #92400e;
}

.alert-info {
    background: #dbeafe;
    color: #1e40af;
}

/* Profile page detail list */
.profile-details-list li {
    flex-wrap: nowrap !important;
    gap: .5rem;
}

.detail-value {
    font-size: .8125rem !important;
    word-break: break-word;
    text-align: right;
    max-width: 55%;
}

/* Contact page icon circles */
.icon-circle {
    width: 48px;
    height: 48px;
    min-width: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.125rem;
}

.icon-circle-primary { background: #dbeafe; color: #2563eb; }
.icon-circle-success { background: #d1fae5; color: #059669; }
.icon-circle-warning { background: #fef3c7; color: #d97706; }
.icon-circle-info    { background: #cffafe; color: #0891b2; }
.icon-circle-danger  { background: #fee2e2; color: #dc2626; }

/* text-end on mobile becomes text-start */
@media (max-width: 575.98px) {
    .text-end {
        text-align: left !important;
    }

    .text-end .btn {
        width: 100%;
        justify-content: center;
    }
}

/* ============================================================
   6. BUTTONS
   ============================================================ */
.btn {
    border-radius: .5rem;
    font-weight: 500;
    padding: .625rem 1.125rem;
    font-size: .9375rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .4rem;
    transition: all .15s;
}

.btn-sm {
    padding: .4rem .75rem;
    font-size: .8125rem;
    min-height: 34px;
}

.btn-lg {
    padding: .75rem 1.5rem;
    font-size: 1rem;
    min-height: 50px;
}

/* ============================================================
   7. TABLES
   ============================================================ */
.table th,
.table td {
    padding: .75rem .875rem;
    font-size: .875rem;
    vertical-align: middle;
}

.table thead th {
    font-size: .8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .4px;
    white-space: nowrap;
}

/* ============================================================
   8. MODALS
   ============================================================ */

/* Desktop: Bootstrap default centering — never override margin on desktop
   so the modal is not clipped behind the fixed sidebar */
.modal-dialog {
    margin-top: 1.75rem !important;
    margin-bottom: 1.75rem !important;
}

/* On mobile only: stretch modal to full width with small side margins */
@media (max-width: 767.98px) {
    .modal-dialog {
        margin: .5rem !important;
        max-width: calc(100% - 1rem) !important;
    }
}

.modal-body {
    padding: 1rem !important;
}

.modal-footer {
    padding: .75rem 1rem !important;
    flex-wrap: wrap;
    gap: .5rem;
}

@media (max-width: 767.98px) {
    .modal-footer .btn {
        flex: 1;
        min-width: 120px;
    }
}

/* ============================================================
   9. TYPOGRAPHY
   ============================================================ */
h1, .h1 { font-size: 1.75rem !important; }
h2, .h2 { font-size: 1.5rem !important; }
h3, .h3 { font-size: 1.25rem !important; }
h4, .h4 { font-size: 1.125rem !important; }

.display-4 { font-size: 2rem !important; }
.display-5 { font-size: 1.75rem !important; }
.lead { font-size: 1rem !important; }

/* ============================================================
   10. HERO SECTION (public pages)
   ============================================================ */
.hero-section {
    padding: 3rem 1rem !important;
    min-height: auto !important;
    text-align: center;
}

.hero-title,
.hero-section h1 {
    font-size: 1.75rem !important;
    line-height: 1.25 !important;
    margin-bottom: 1rem !important;
}

.hero-subtitle,
.hero-section p {
    font-size: 1rem !important;
    margin-bottom: 1.5rem !important;
}

.hero-cta {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: .75rem !important;
}

.hero-cta .btn {
    width: 100% !important;
    justify-content: center !important;
}

/* ============================================================
   11. FEATURES / GRID SECTIONS (public pages)
   ============================================================ */
.features-section,
.testimonials-section,
.stats-section,
.cta-section,
.pricing-section,
.contact-section,
.about-section,
.team-section {
    padding: 2.5rem 1rem !important;
}

.features-grid,
.testimonials-grid,
.pricing-grid,
.team-grid {
    grid-template-columns: 1fr !important;
    gap: 1rem !important;
}

.stats-grid {
    grid-template-columns: 1fr 1fr !important;
    gap: 1rem !important;
}

.section-title,
.section-header h2 {
    font-size: 1.5rem !important;
}

.section-subtitle,
.section-header p {
    font-size: .9375rem !important;
}

.feature-card,
.testimonial-card {
    padding: 1.5rem !important;
}

.contact-grid {
    grid-template-columns: 1fr !important;
    gap: 1.5rem !important;
}

/* ============================================================
   12. DASHBOARD STATS CARDS
   ============================================================ */
.dashboard-grid,
.stats-grid.dashboard {
    grid-template-columns: 1fr 1fr !important;
    gap: .75rem !important;
}

.stat-card,
.dashboard-card {
    padding: 1rem !important;
}

.stat-number,
.card-stats-value {
    font-size: 1.75rem !important;
}

.stat-icon,
.card-icon-circle {
    width: 48px !important;
    height: 48px !important;
    font-size: 1.25rem !important;
}

/* ============================================================
   13. PROFILE PAGE
   ============================================================ */
.profile-image-container {
    width: 110px !important;
    height: 110px !important;
}

.profile-stats {
    flex-direction: row !important;
    flex-wrap: wrap !important;
    gap: .5rem !important;
}

.profile-stat {
    flex: 1;
    min-width: 80px;
}

.profile-header {
    padding: 1.5rem 1rem !important;
}

/* ============================================================
   14. FOOTER
   ============================================================ */
.site-footer {
    padding: 2rem 1rem !important;
    text-align: center;
}

.site-footer .col-md-4,
.site-footer .col-md-3,
.site-footer .col-md-2 {
    margin-bottom: 1.5rem;
}

.site-footer a:hover {
    padding-left: 0 !important;
}

/* ============================================================
   15. UTILITIES
   ============================================================ */
.scroll-to-top {
    right: .875rem !important;
    bottom: .875rem !important;
    width: 42px !important;
    height: 42px !important;
}

.pagination {
    flex-wrap: wrap;
    gap: .25rem;
}

.page-link {
    padding: .5rem .75rem;
    font-size: .875rem;
}

.alert {
    padding: .875rem 1rem;
    font-size: .9rem;
    border-radius: .625rem;
}

/* ============================================================
   16. TABLET (576px – 991px) — 2-column grids, wider padding
   ============================================================ */
@media (min-width: 576px) {
    .navbar-container {
        padding: .875rem 1.25rem;
    }

    .hero-title,
    .hero-section h1 {
        font-size: 2.25rem !important;
    }

    .hero-cta {
        flex-direction: row !important;
        justify-content: center !important;
    }

    .hero-cta .btn {
        width: auto !important;
    }

    .features-grid,
    .team-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }

    .testimonials-grid {
        grid-template-columns: 1fr !important;
    }

    .dashboard-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }

    .modal-dialog {
        margin: 1.5rem auto !important;
        max-width: 500px !important;
    }

    .modal-footer .btn {
        flex: 0 0 auto;
        width: auto;
    }
}

@media (min-width: 768px) {
    #content,
    div#content {
        padding: 1.25rem !important;
    }

    .container-fluid {
        padding-left: 1.25rem !important;
        padding-right: 1.25rem !important;
    }

    .hero-section {
        padding: 4rem 1.5rem !important;
        text-align: left;
    }

    .hero-cta {
        justify-content: flex-start !important;
    }

    .features-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }

    .stats-grid {
        grid-template-columns: repeat(4, 1fr) !important;
    }

    .contact-grid {
        grid-template-columns: 1fr 1fr !important;
    }

    h1, .h1 { font-size: 2rem !important; }
    h2, .h2 { font-size: 1.75rem !important; }
    h3, .h3 { font-size: 1.5rem !important; }
}

/* ============================================================
   17. DESKTOP (992px+) — sidebar always visible, full layout
   ============================================================ */
@media (min-width: 992px) {

    /* Show desktop nav, hide mobile elements */
    .navbar-toggler {
        display: none !important;
    }

    .navbar-menu {
        display: flex !important;
        gap: 2rem;
        list-style: none;
        margin: 0;
        padding: 0;
        align-items: center;
        flex: 1;
        justify-content: center;
    }

    .navbar-menu a {
        color: #4b5563;
        font-size: .9375rem;
        font-weight: 500;
        text-decoration: none;
        padding: .375rem .5rem;
        position: relative;
        transition: color .15s;
    }

    .navbar-menu a:hover,
    .navbar-menu a.active {
        color: var(--primary, #2563eb);
    }

    .navbar-menu a::after {
        content: '';
        position: absolute;
        bottom: -2px;
        left: 50%;
        transform: translateX(-50%);
        width: 0;
        height: 2px;
        background: var(--primary, #2563eb);
        transition: width .15s;
    }

    .navbar-menu a:hover::after,
    .navbar-menu a.active::after {
        width: 80%;
    }

    .navbar-actions {
        display: flex !important;
        gap: .75rem;
        align-items: center;
        flex-shrink: 0;
    }

    .navbar-mobile-menu {
        display: none !important;
    }

    /* Sidebar — always visible on desktop */
    .sidebar,
    ul.navbar-nav.sidebar,
    .navbar-nav.bg-gradient-primary.sidebar.sidebar-dark.accordion {
        transform: translateX(0) !important;
        position: fixed !important;
        width: 260px !important;
    }

    /* Collapsed sidebar */
    body.sidebar-toggled .sidebar,
    body.sidebar-toggled ul.navbar-nav.sidebar {
        width: 80px !important;
        transform: translateX(0) !important;
    }

    body.sidebar-toggled .sidebar .sidebar-brand-text,
    body.sidebar-toggled .sidebar .nav-link span,
    body.sidebar-toggled .sidebar .sidebar-heading,
    body.sidebar-toggled .sidebar .collapse-inner {
        display: none !important;
    }

    body.sidebar-toggled .sidebar .nav-link {
        justify-content: center !important;
        padding: .875rem !important;
    }

    body.sidebar-toggled .sidebar .nav-link i {
        margin: 0 !important;
        width: auto !important;
    }

    /* Content wrapper offset */
    #content-wrapper,
    div#content-wrapper {
        margin-left: 260px !important;
        width: calc(100% - 260px) !important;
    }

    body.sidebar-toggled #content-wrapper,
    body.sidebar-toggled div#content-wrapper {
        margin-left: 80px !important;
        width: calc(100% - 80px) !important;
    }

    /* Hide mobile hamburger */
    #sidebarToggleTop {
        display: none !important;
    }

    /* Show desktop collapse button */
    #sidebarToggle {
        display: flex !important;
    }

    /* Content padding */
    #content,
    div#content {
        padding: 1.5rem !important;
    }

    .container-fluid {
        padding-left: 1.5rem !important;
        padding-right: 1.5rem !important;
    }

    /* Hero */
    .hero-section {
        padding: 5rem 0 !important;
        min-height: 520px !important;
    }

    .hero-title,
    .hero-section h1 {
        font-size: 2.75rem !important;
    }

    /* Features */
    .features-grid {
        grid-template-columns: repeat(3, 1fr) !important;
    }

    .testimonials-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }

    .pricing-grid {
        grid-template-columns: repeat(3, 1fr) !important;
    }

    .team-grid {
        grid-template-columns: repeat(3, 1fr) !important;
    }

    /* Dashboard */
    .dashboard-grid {
        grid-template-columns: repeat(4, 1fr) !important;
    }

    /* Typography */
    h1, .h1 { font-size: 2.25rem !important; }
    h2, .h2 { font-size: 2rem !important; }
    h3, .h3 { font-size: 1.75rem !important; }

    /* Modals */
    .modal-dialog {
        margin: 1.75rem auto !important;
        max-width: 500px !important;
    }

    .modal-footer .btn {
        flex: 0 0 auto;
        width: auto;
    }
}

@media (min-width: 1200px) {
    .hero-title,
    .hero-section h1 {
        font-size: 3.25rem !important;
    }

    .features-grid {
        grid-template-columns: repeat(4, 1fr) !important;
    }

    .testimonials-grid {
        grid-template-columns: repeat(3, 1fr) !important;
    }
}

/* Final Bootstrap modal sizing policy: keep every modal usable on small screens. */
@media (max-width: 767.98px) {
    .modal-dialog,
    .modal-dialog.modal-sm,
    .modal-dialog.modal-lg,
    .modal-dialog.modal-xl {
        width: calc(100% - 1rem) !important;
        max-width: none !important;
        margin: .5rem auto !important;
    }

    .modal-content {
        max-height: calc(100vh - 1rem) !important;
        overflow: hidden !important;
    }

    .modal-body {
        max-height: calc(100vh - 9rem) !important;
        overflow-y: auto !important;
        overflow-wrap: anywhere;
        -webkit-overflow-scrolling: touch;
    }

    .modal-header,
    .modal-footer {
        flex-shrink: 0;
    }

    .modal-footer {
        flex-wrap: wrap;
        gap: .5rem;
    }

    .modal-footer .btn {
        width: auto !important;
        min-width: 7rem;
        flex: 1 1 auto;
    }
}

/* ============================================================
   18. PRINT
   ============================================================ */
@media print {
    .sidebar,
    .topbar,
    .navbar-public,
    .site-footer,
    .scroll-to-top,
    .sidebar-backdrop,
    .btn:not(.btn-print),
    #sidebarToggleTop,
    #sidebarToggle {
        display: none !important;
    }

    #content-wrapper,
    div#content-wrapper {
        margin-left: 0 !important;
        width: 100% !important;
    }

    body {
        background: #fff !important;
        color: #000 !important;
    }

    .card {
        box-shadow: none !important;
        border: 1px solid #ccc !important;
        break-inside: avoid;
    }
}

    /* Keep realtime announcement toasts compact instead of stretching across the viewport. */
    .swal2-container .swal2-toast {
        width: min(30rem, calc(100vw - 2rem)) !important;
        max-width: calc(100vw - 2rem) !important;
        padding: .75rem 1rem !important;
        font-size: .9rem !important;
    }
    .swal2-container .swal2-toast .swal2-title {
        font-size: 1rem !important;
        margin: 0 .5rem !important;
    }
    .swal2-container .swal2-toast .swal2-html-container,
    .swal2-container .swal2-toast .swal2-content {
        margin: .25rem .5rem 0 !important;
        font-size: .82rem !important;
        line-height: 1.35 !important;
    }
