:root {
    /* Colors — Navy & Gold (Ghana Theme) */
    --navy-50:  #f0f4f8;
    --navy-100: #d9e2ec;
    --navy-200: #bcccdc;
    --navy-300: #9fb3c8;
    --navy-400: #829ab1;
    --navy-500: #627d98;
    --navy-600: #486581;
    --navy-700: #334e68;
    --navy-800: #243b53;
    --navy-900: #102a43;

    --gold-50:  #fffbf0;
    --gold-100: #fef0c7;
    --gold-200: #fde08b;
    --gold-300: #facc50;
    --gold-400: #f5b026;
    --gold-500: #d4af37; /* Primary Gold */
    --gold-600: #b48e21;
    --gold-700: #8f6c12;
    --gold-800: #74550e;
    --gold-900: #614611;

    --bg-body:    #f8fafc;
    --bg-surface: #ffffff;

    --text-main:  #334e68;
    --text-muted: #627d98;
    --border-color: #d9e2ec;

    /* Alert Colours — replaces all hardcoded hex values in PHP files */
    --alert-success-bg:     #dcfce7;
    --alert-success-text:   #166534;
    --alert-success-border: #4ade80;
    --alert-error-bg:       #fee2e2;
    --alert-error-text:     #991b1b;
    --alert-error-border:   #f87171;
    --alert-warning-bg:     #fef3c7;
    --alert-warning-text:   #92400e;
    --alert-warning-border: #fbbf24;
    --alert-info-bg:        #eff6ff;
    --alert-info-text:      #1e40af;
    --alert-info-border:    #bfdbfe;

    /* Typography */
    --font-sans:    'Inter', system-ui, sans-serif;
    --font-display: 'Outfit', system-ui, sans-serif;
    --text-xs:   0.75rem;
    --text-sm:   0.875rem;
    --text-base: 1rem;
    --text-lg:   1.125rem;
    --text-xl:   1.25rem;
    --text-2xl:  1.5rem;
    --text-3xl:  1.875rem;

    /* Spacing */
    --space-1: 0.25rem;  --space-2: 0.5rem;
    --space-3: 0.75rem; --space-4: 1rem;
    --space-6: 1.5rem;  --space-8: 2rem;
    --space-12: 3rem;   --space-16: 4rem;

    /* Radius */
    --radius-sm: 0.25rem;
    --radius-md: 0.5rem;
    --radius-lg: 1rem;
    --radius-xl: 1.5rem;

    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgba(0,0,0,0.05);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -1px rgba(0,0,0,0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0,0,0,0.1), 0 10px 10px -5px rgba(0,0,0,0.04);
}

/* ============================================================
   RESET & BASE
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; }

body {
    font-family: var(--font-sans);
    color: var(--text-main);
    line-height: 1.6;
    margin: 0;
    background: var(--bg-body);
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-display);
    color: var(--navy-900);
    line-height: 1.3;
    margin-top: 0;
}

/* ============================================================
   HEADER BANNERS & GRADIENTS (Force High-Contrast White & Gold)
   ============================================================ */
.banner-gradient, .page-banner, .admin-page-banner, .sba-header-banner, .sba-card-hero, .parent-header, .student-hero, .profile-hero {
    background: linear-gradient(135deg, #0f2744 0%, #1a3a5c 100%) !important;
    color: #ffffff !important;
}

.banner-gradient h1,
.banner-gradient h2,
.banner-gradient h3,
.banner-title,
.page-banner h1,
.page-banner h2,
.page-banner h3,
.admin-page-banner h1,
.admin-page-banner h2,
.parent-header h1,
.parent-header h2,
.parent-header h3,
.student-hero h1,
.student-hero h2,
.student-hero h3,
.profile-hero h1,
.profile-hero h2,
.profile-hero h3,
.school-info h1,
.school-info h2,
.student-name-group h2,
.profile-hero-info h2 {
    color: #ffffff !important;
}

.banner-gradient p,
.banner-sub,
.page-banner p,
.page-banner-sub,
.admin-page-banner p {
    color: #cbd5e1 !important;
}

a { color: var(--gold-600); text-decoration: none; }
a:hover { color: var(--gold-700); }

img { max-width: 100%; height: auto; }

/* ============================================================
   APP LAYOUT — Sidebar + Main Content
   ============================================================ */
body.app-layout {
    display: flex;
    min-height: 100dvh;
    background: var(--navy-50);
    margin: 0;
}

.content-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    margin-left: 260px; /* offset for fixed sidebar */
}

.top-navbar {
    background: white;
    height: 64px;
    position: sticky;
    top: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding: 0 2rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    border-bottom: 1px solid var(--border-color);
}

.top-navbar-user {
    display: flex;
    align-items: center;
    gap: 1rem;
    position: relative;
}

.avatar-btn {
    background: var(--navy-100);
    color: var(--navy-700);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.1rem;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.2s;
}
.avatar-btn:hover {
    border-color: var(--navy-300);
    background: var(--navy-200);
}

.user-info {
    text-align: right;
    line-height: 1.2;
}
.user-name {
    font-weight: 600;
    color: var(--navy-900);
    font-size: 0.9rem;
}
.user-role {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 700;
}

.logout-dropdown {
    display: none;
    position: absolute;
    top: 110%;
    right: 0;
    background: white;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 0.5rem;
    min-width: 150px;
}
.top-navbar-user:hover .logout-dropdown {
    display: block;
}
.logout-dropdown button {
    width: 100%;
    text-align: left;
    background: none;
    border: none;
    padding: 0.75rem 1rem;
    color: #ef4444;
    font-weight: 600;
    cursor: pointer;
    border-radius: var(--radius-sm);
}
.logout-dropdown button:hover {
    background: #fef2f2;
}


.sidebar {
    width: 260px;
    background: var(--navy-900);
    color: white;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0;
    height: 100dvh;
    z-index: 100;
    transition: transform 0.2s;
}

.sidebar-header {
    padding: 1.5rem 1.25rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
    display: flex;
    align-items: center;
    gap: 0.85rem;
    background: linear-gradient(180deg, rgba(255,255,255,0.05) 0%, rgba(0,0,0,0) 100%);
}
.sidebar-brand-badge {
    width: 48px;
    height: 48px;
    min-width: 48px;
    border-radius: 12px;
    background: #ffffff;
    border: 2px solid #facc15;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    padding: 3px;
    flex-shrink: 0;
}
.sidebar-brand-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 8px;
}
.sidebar-initial-badge {
    background: linear-gradient(135deg, #fde047 0%, #d4af37 100%);
    color: #0f2744;
    font-family: var(--font-display);
    font-weight: 900;
    font-size: 1.45rem;
    line-height: 1;
    border-color: #ffffff;
    box-shadow: 0 4px 14px rgba(250, 204, 21, 0.45);
}
.sidebar-school-name {
    font-family: var(--font-display);
    font-weight: 800;
    color: #ffffff;
    font-size: 0.98rem;
    line-height: 1.25;
    letter-spacing: 0.02em;
    word-break: break-word;
}

.sidebar-role {
    padding: 0.75rem 1.5rem 0;
    font-size: 0.7rem;
    color: var(--navy-300);
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.sidebar-nav {
    flex: 1;
    padding: 0.75rem 0;
    overflow-y: auto;
}

.main-content {
    flex: 1;
    padding: 2rem;
    position: relative;
}

.nav-icon {
    font-size: 1.1rem;
    opacity: 0.7;
    transition: opacity 0.2s;
    width: 24px;
    text-align: center;
}
.nav-item:hover .nav-icon {
    opacity: 1;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.7rem 1.5rem;
    color: var(--navy-200);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.95rem;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
    border-left: 3px solid transparent;
}

.nav-item:hover {
    background: rgba(255,255,255,0.06);
    color: var(--gold-300);
    border-left-color: var(--gold-500);
}

.nav-item.active {
    background: rgba(245, 176, 38, 0.12);
    color: var(--gold-400);
    border-left-color: var(--gold-400);
    font-weight: 600;
}

.sidebar-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid rgba(255,255,255,0.08);
}



/* ============================================================
   PAGE HEADER
   ============================================================ */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.page-title {
    font-size: var(--text-2xl);
    margin: 0;
    color: var(--navy-900);
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn, .btn-primary, .btn-secondary, .btn-danger, .btn-ghost, .btn-sm {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.6rem 1.25rem;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-family: var(--font-sans);
    font-size: 0.9rem;
    text-decoration: none;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all 0.18s cubic-bezier(0.4, 0, 0.2, 1);
    white-space: nowrap;
}

.btn-primary {
    background: linear-gradient(180deg, var(--navy-700) 0%, var(--navy-900) 100%);
    color: #fff;
    border-color: var(--navy-900);
    box-shadow: 0 1px 3px rgba(16,42,67,0.25), inset 0 1px 0 rgba(255,255,255,0.08);
}
.btn-primary:hover {
    background: linear-gradient(180deg, var(--navy-600) 0%, var(--navy-800) 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(16,42,67,0.3);
    color: #fff;
}
.btn-primary:active { transform: translateY(0); }

.btn-secondary {
    background: white;
    color: var(--navy-800);
    border-color: var(--border-color);
    box-shadow: var(--shadow-sm);
}
.btn-secondary:hover {
    background: var(--navy-50);
    border-color: var(--navy-300);
    color: var(--navy-900);
}

.badge-success { background: var(--alert-success-bg); color: var(--alert-success-text); }
.badge-error   { background: var(--alert-error-bg);   color: var(--alert-error-text); }

/* Grade Badges */
.badge-grade { min-width: 28px; text-align: center; }
.grade-1, .grade-2 { background: #dcfce7; color: #166534; }
.grade-3, .grade-4 { background: #fef08a; color: #854d0e; }
.grade-5, .grade-6 { background: #ffedd5; color: #9a3412; }
.grade-7, .grade-8, .grade-9 { background: #fee2e2; color: #991b1b; }

.btn-danger {
    background: var(--alert-error-bg);
    color: var(--alert-error-text);
    border-color: var(--alert-error-border);
}
.btn-danger:hover {
    background: var(--alert-error-border);
    color: white;
}

.btn-ghost {
    background: transparent;
    color: var(--text-muted);
    border-color: transparent;
}
.btn-ghost:hover { background: var(--navy-100); color: var(--navy-800); }

.btn-sm {
    padding: 0.35rem 0.75rem;
    font-size: var(--text-sm);
    border-radius: var(--radius-sm);
}

.btn-gold {
    background: linear-gradient(180deg, var(--gold-400) 0%, var(--gold-600) 100%);
    color: var(--navy-900);
    border-color: var(--gold-600);
    font-weight: 700;
}
.btn-gold:hover {
    background: linear-gradient(180deg, var(--gold-300) 0%, var(--gold-500) 100%);
    transform: translateY(-1px);
    color: var(--navy-900);
}

/* Legacy support for inline style attribute buttons */
button[style*="var(--gold-600)"] {
    background: linear-gradient(180deg, var(--gold-400) 0%, var(--gold-600) 100%) !important;
    color: var(--navy-900) !important;
    border-color: var(--gold-600) !important;
    transform: translateY(-1px) !important;
}
/* ============================================================
   SBA PROFESSIONAL TABLE
   ============================================================ */
.sba-grid-container {
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-color);
    overflow: hidden;
    overflow-x: auto;
}

.sba-pro-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    min-width: 1000px;
    font-size: 0.95rem;
}
.sba-pro-table th {
    padding: 1rem 0.5rem;
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.8rem;
    letter-spacing: 0.05em;
    position: sticky;
    top: 0;
    z-index: 10;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}
.sba-pro-table th.cat-header { background: linear-gradient(180deg, var(--navy-800), var(--navy-900)); color: white; border-right: 1px solid rgba(255,255,255,0.05); }
.sba-pro-table th.exam-header { background: linear-gradient(180deg, #1e3a8a, #172554); color: white; border-right: 1px solid rgba(255,255,255,0.05); }
.sba-pro-table th.total-header { background: linear-gradient(180deg, var(--gold-400), var(--gold-600)); color: var(--navy-900); }
.sba-pro-table th.default-header { background: var(--gray-100); color: var(--navy-900); }

.sba-pro-table td {
    padding: 0.75rem 0.5rem;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
    text-align: center;
    background: white;
}
.sba-pro-table tbody tr {
    transition: all 0.15s;
}
.sba-pro-table tbody tr:hover td {
    background: var(--navy-50);
}
.sba-pro-table tbody tr:nth-child(even) td {
    background: #fafcff;
}
.sba-pro-table tbody tr:hover td.cell-computed {
    background: #e2e8f0;
}

.sba-pro-table td.sticky-col, .sba-pro-table th.sticky-col {
    position: sticky;
    left: 0;
    z-index: 5;
    box-shadow: 2px 0 5px rgba(0,0,0,0.05);
    text-align: left;
    background: white;
}
.sba-pro-table th.sticky-col { z-index: 15; background: var(--gray-100); }
.sba-pro-table tbody tr:nth-child(even) td.sticky-col { background: #fafcff; }
.sba-pro-table tbody tr:hover td.sticky-col { background: var(--navy-50); }

.sba-pro-input {
    width: 48px;
    padding: 0.4rem 0.1rem;
    text-align: center;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    font-family: var(--font-sans);
    font-weight: 700;
    font-size: 1rem;
    background: transparent;
    color: var(--navy-900);
    transition: all 0.2s;
}
.sba-pro-input:hover {
    background: white;
    border-color: var(--navy-200);
    box-shadow: var(--shadow-sm);
}
.sba-pro-input:focus {
    outline: none;
    background: white;
    border-color: var(--gold-500);
    box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.2);
}
.sba-pro-input.saving { background-color: #fef08a; }
.sba-pro-input.saved { background-color: #bbf7d0; }
.sba-pro-input.error { background-color: #fecaca; border-color: #ef4444; }

.cell-computed { background: #f8fafc; font-weight: 700; text-align: center; color: var(--navy-600); }
.cell-total-score.has-value { color: var(--navy-900); font-size: 1.1em; }


/* ============================================================
   PREMIUM FORMS
   ============================================================ */
.premium-form-card {
    background: white;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-color);
    overflow: hidden;
    max-width: 900px;
    margin: 0 auto;
}
.premium-form-header {
    background: linear-gradient(135deg, var(--navy-900), var(--navy-700));
    color: white;
    padding: 2rem 2.5rem;
}
.premium-form-header h2 {
    color: var(--gold-400);
    margin: 0 0 0.5rem 0;
    font-size: 1.75rem;
}
.premium-form-header p {
    margin: 0;
    color: var(--navy-200);
    font-size: 0.95rem;
}
.premium-form-body {
    padding: 2.5rem;
}
.premium-form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}
.premium-form-group {
    display: flex;
    flex-direction: column;
}
.premium-form-group.full-width {
    grid-column: 1 / -1;
}
.premium-form-label {
    font-weight: 700;
    color: var(--navy-800);
    margin-bottom: 0.5rem;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.premium-form-input {
    padding: 0.8rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-family: var(--font-sans);
    transition: all 0.2s;
    background: var(--bg-body);
}
.premium-form-input:focus {
    outline: none;
    border-color: var(--gold-500);
    box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.2);
    background: white;
}
.premium-form-footer {
    padding: 1.5rem 2.5rem;
    background: var(--navy-50);
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
}


/* ============================================================
   DASHBOARD REDESIGN
   ============================================================ */
.welcome-banner {
    background: linear-gradient(135deg, var(--navy-800), var(--navy-600));
    color: white;
    padding: 2.5rem;
    border-radius: var(--radius-xl);
    box-shadow: 0 10px 25px -5px rgba(26, 32, 44, 0.3);
    margin-bottom: 2rem;
    position: relative;
    overflow: hidden;
}
.welcome-banner::before {
    content: '';
    position: absolute;
    top: -50%; left: -10%;
    width: 60%; height: 200%;
    background: linear-gradient(to right, rgba(255,255,255,0.05), transparent);
    transform: rotate(30deg);
    pointer-events: none;
}
.welcome-banner > * {
    position: relative;
    z-index: 1;
}
.welcome-title {
    font-size: 2.5rem;
    font-weight: 800;
    margin: 0 0 0.5rem 0;
    font-family: var(--font-display);
    color: var(--gold-400);
}
.welcome-subtitle {
    font-size: 1.1rem;
    opacity: 0.9;
    margin: 0;
}
.welcome-meta {
    display: flex;
    gap: 2rem;
    margin-top: 1.5rem;
}
.meta-item {
    background: rgba(255,255,255,0.1);
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-full);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.1);
    font-weight: 600;
}
.meta-label {
    opacity: 0.7;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-right: 0.5rem;
}

.stat-grid-premium {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2.5rem;
}
.stat-card-premium {
    background: white;
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.05), 0 2px 4px -1px rgba(0,0,0,0.03);
    border: 1px solid var(--border-color);
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex;
    flex-direction: column;
}
.stat-card-premium:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05);
    border-color: var(--navy-200);
}
.stat-icon {
    font-size: 2rem;
    margin-bottom: 1rem;
    opacity: 0.8;
}
.stat-value-premium {
    font-size: 2.25rem;
    font-weight: 800;
    color: var(--navy-900);
    line-height: 1;
    margin-bottom: 0.25rem;
}
.stat-label-premium {
    font-size: 0.9rem;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.action-grid-premium {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}
.action-card-premium {
    background: linear-gradient(135deg, #ffffff, #f8fafc);
    border: 1px solid var(--border-color);
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    gap: 1.5rem;
    text-decoration: none;
    color: var(--navy-800);
    font-weight: 700;
    font-size: 1.1rem;
    transition: all 0.2s;
    box-shadow: var(--shadow-sm);
}
.action-card-premium:hover {
    background: linear-gradient(135deg, var(--gold-50), white);
    border-color: var(--gold-300);
    transform: translateX(5px);
    box-shadow: var(--shadow-md);
}
.action-icon-premium {
    font-size: 2.5rem;
    background: white;
    width: 60px; height: 60px;
    display: flex; align-items: center; justify-content: center;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
}



.progress-bar-container {
    width: 100%;
    height: 6px;
    background: var(--navy-100);
    border-radius: var(--radius-full);
    margin-top: 0.5rem;
    overflow: hidden;
}
.progress-bar-fill {
    height: 100%;
    background: var(--gold-500);
    border-radius: var(--radius-full);
    transition: width 1s ease-in-out;
}
.chart-card {
    background: white;
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1);
    border: 1px solid var(--border-color);
}

/* ============================================================
   RESPONSIVE MOBILE ENGINE (Screens <= 992px & <= 600px)
   ============================================================ */

.mobile-menu-btn {
    display: none;
    background: linear-gradient(135deg, #0f2744, #1a3a5c);
    color: #facc15 !important;
    border: 1px solid #d4af37;
    padding: 0.45rem 0.9rem;
    border-radius: 8px;
    font-weight: 800;
    font-size: 0.88rem;
    cursor: pointer;
    align-items: center;
    gap: 0.4rem;
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
    z-index: 60;
}
.mobile-menu-btn:hover {
    background: linear-gradient(135deg, #0b1d33, #152d47);
}
.mobile-menu-btn:active {
    transform: scale(0.96);
}

.sidebar-close-btn {
    display: none;
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.2);
    color: #ffffff;
    font-size: 1.1rem;
    border-radius: 6px;
    cursor: pointer;
    padding: 0.25rem 0.6rem;
    margin-left: auto;
}

.sidebar-backdrop {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(15, 39, 68, 0.7);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 9998;
    opacity: 0;
    transition: opacity 0.25s ease;
}

/* When Body has sidebar-mobile-active class */
body.sidebar-mobile-active {
    overflow: hidden !important;
}
body.sidebar-mobile-active .sidebar-backdrop {
    display: block !important;
    opacity: 1 !important;
}
body.sidebar-mobile-active .sidebar {
    transform: translateX(0) !important;
    visibility: visible !important;
}

/* ============================================================
   UNIVERSAL RESPONSIVE SYSTEM (ALL DEVICES: 320px - 1920px)
   ============================================================ */

/* Base Fluid Containers & Touch Scroll */
.table-responsive, .table-container, .ges-grid-card, .broadsheet-card, .sba-grid-container, .att-table-card {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

@media (max-width: 1200px) {
    .stat-grid-premium, .admin-kpi-grid, .stats-summary-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

@media (max-width: 992px) {
    .content-wrapper {
        margin-left: 0 !important;
        width: 100% !important;
    }
    
    body.admin-layout, body.app-layout {
        flex-direction: column !important;
    }

    .sidebar, .admin-sidebar {
        position: fixed !important;
        top: 0; left: 0; bottom: 0;
        width: 290px !important;
        max-width: 86vw !important;
        height: 100dvh !important;
        transform: translateX(-100%) !important;
        transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1) !important;
        z-index: 9999 !important;
        box-shadow: 10px 0 30px rgba(0,0,0,0.4) !important;
    }

    .mobile-menu-btn {
        display: inline-flex !important;
    }
    .sidebar-close-btn {
        display: block !important;
    }
    
    .top-navbar, .admin-top-navbar {
        justify-content: space-between;
        padding: 0 1rem;
        width: 100% !important;
    }
    
    .main-content {
        padding: 1.25rem 1rem !important;
        width: 100% !important;
        max-width: 100vw !important;
        overflow-x: hidden;
    }

    .sba-header-banner, .cfg-banner, .set-banner, .att-banner, .broadsheet-banner, .page-header-banner {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 1rem !important;
        padding: 1.25rem 1.25rem !important;
    }

    .sba-header-actions, .banner-controls, .att-banner-right, .cfg-banner-right, .header-actions {
        width: 100%;
        display: flex;
        flex-wrap: wrap;
        gap: 0.5rem;
        justify-content: flex-start;
    }

    .sba-nav-wrap, .analysis-subnav {
        flex-direction: row !important;
        align-items: center !important;
        overflow-x: auto !important;
        white-space: nowrap !important;
        padding: 0.5rem !important;
        -webkit-overflow-scrolling: touch;
        gap: 0.5rem;
    }
    .sba-nav-wrap::-webkit-scrollbar, .analysis-subnav::-webkit-scrollbar {
        height: 3px;
    }

    .ges-two-col, .cfg-grid-2, .set-grid-2col, .ticket-workspace-grid, .remed-grid-3 {
        grid-template-columns: 1fr !important;
    }
}

@media (max-width: 768px) {
    /* Fluid typography on tablets & phones */
    h1, .welcome-title, .cfg-title { font-size: 1.45rem !important; }
    h2 { font-size: 1.25rem !important; }
    h3 { font-size: 1.1rem !important; }

    .welcome-banner {
        padding: 1.5rem 1.25rem !important;
    }
    .welcome-meta {
        flex-direction: column !important;
        gap: 0.5rem !important;
    }
    .meta-item {
        width: 100%;
    }

    .stat-grid-premium, .admin-kpi-grid, .stats-summary-grid, .ges-top-stats {
        grid-template-columns: 1fr !important;
        gap: 1rem !important;
    }

    .form-grid, .cfg-form-grid-2, .premium-form-grid, .set-grid-2col, .filter-bar-grid {
        grid-template-columns: 1fr !important;
    }

    .premium-form-header, .premium-form-body, .premium-form-footer {
        padding: 1.25rem !important;
    }

    .premium-form-footer {
        flex-direction: column-reverse;
        gap: 0.75rem;
    }
    .premium-form-footer .btn, .premium-form-footer button {
        width: 100% !important;
    }

    .table-pagination-bar {
        flex-direction: column !important;
        align-items: center !important;
        text-align: center;
        gap: 0.75rem !important;
    }

    /* Modal dialogs full width on mobile */
    .modal-content, .modal-dialog {
        width: 94vw !important;
        max-width: 94vw !important;
        margin: 1rem auto !important;
        padding: 1.25rem !important;
    }

    .user-info {
        display: none;
    }

    /* Action buttons in cards stack nicely */
    .card-actions, .filter-actions {
        width: 100%;
        display: flex;
        flex-direction: column;
        gap: 0.5rem;
    }
    .card-actions .btn, .filter-actions .btn {
        width: 100% !important;
    }
}

@media (max-width: 480px) {
    .main-content {
        padding: 0.75rem 0.5rem !important;
    }

    .sba-pro-input, .att-input-box, .expected-days-input-field {
        min-width: 42px;
        min-height: 38px;
        font-size: 1rem !important;
        padding: 0.2rem !important;
    }

    .ges-table th, .ges-table td, .cfg-table th, .cfg-table td, .table th, .table td {
        padding: 0.4rem 0.35rem !important;
        font-size: 0.76rem !important;
    }

    .btn, .btn-primary, .btn-secondary, .btn-gold, .btn-cfg-primary {
        padding: 0.55rem 0.95rem !important;
        font-size: 0.84rem !important;
    }

    .sba-pill-select, .cfg-header-select {
        font-size: 0.82rem !important;
        padding: 0.3rem 0.6rem !important;
        max-width: 100% !important;
    }

    .ges-header-box {
        padding: 1rem 0.75rem !important;
    }
    .ges-header-box h1 { font-size: 1.15rem !important; }
    .ges-header-box h2 { font-size: 0.95rem !important; }

    .ges-meta-strip {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 0.5rem !important;
    }
}

/* ============================================================
   SBA PAGE — MOBILE-FIRST RESPONSIVE FIXES
   ============================================================ */

/* Control bar: stack vertically on small screens */
@media (max-width: 768px) {
    .sba-control-bar {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 1rem !important;
        padding: 1.25rem !important;
    }
    .sba-control-right {
        width: 100%;
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }
    .sba-control-right form {
        width: 100%;
        flex-wrap: wrap;
        gap: 0.5rem;
    }
    .sba-pill-select {
        flex: 1 1 140px;
        min-width: 130px;
        width: 100%;
        padding: 0.6rem 2.5rem 0.6rem 1rem !important;
        font-size: 0.88rem !important;
    }
    .sba-stat-chips {
        flex-wrap: wrap;
        gap: 0.5rem;
    }
    .sba-control-title {
        font-size: 1.2rem !important;
    }
    .sba-toolbar {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 0.75rem !important;
        padding: 0.85rem 1rem !important;
    }
    .sba-toolbar-right {
        width: 100%;
        flex-wrap: wrap;
        gap: 0.5rem;
    }
    .sba-toolbar-right .btn-toolbar,
    .sba-toolbar-right form,
    .sba-toolbar-right button {
        flex: 1 1 auto;
        min-width: 120px;
        justify-content: center;
        text-align: center;
        width: 100%;
    }
    .sba-toolbar-title {
        font-size: 0.95rem !important;
    }
    .sba-toolbar-badge {
        display: none;
    }
}

/* Score inputs: larger tap targets on touch screens */
@media (max-width: 768px) {
    .sba-input {
        width: 48px !important;
        height: 40px !important;
        font-size: 0.95rem !important;
        padding: 0 2px !important;
        border-radius: 8px !important;
        touch-action: manipulation;
    }
    .sba-sheet-table td {
        height: 56px !important;
        padding: 0 0.2rem !important;
    }
    .sba-sheet-table {
        font-size: 0.8rem !important;
    }
    .td-name-main {
        font-size: 0.82rem !important;
    }
    .td-name-sub {
        font-size: 0.68rem !important;
    }
    .sba-sheet-wrap {
        border-radius: 10px !important;
    }
}

/* Prevent inputs from zooming on iOS (font-size must be >= 16px on focus) */
@media (max-width: 992px) {
    .sba-input:focus,
    .sba-pill-select:focus,
    input[type="number"]:focus,
    input[type="text"]:focus,
    input[type="tel"]:focus,
    input[type="email"]:focus,
    select:focus {
        font-size: 16px !important;
    }
}

/* SBA nav tabs: horizontal scroll, no wrap, bigger touch areas on mobile */
@media (max-width: 768px) {
    .sba-nav-wrap {
        padding: 0.4rem 0.6rem !important;
        gap: 0.3rem !important;
    }
    .sba-tab {
        padding: 0.5rem 0.75rem !important;
        font-size: 0.8rem !important;
        border-radius: 6px !important;
        min-height: 38px;
        white-space: nowrap !important;
    }
    .sba-nav-section-label {
        display: none !important;
    }
}

/* Empty state padding */
@media (max-width: 480px) {
    .empty-state {
        padding: 2.5rem 1rem !important;
    }
    .sba-control-bar {
        padding: 1rem !important;
    }
}


/* ============================================================
   TABLE PAGINATION BAR STYLES
   ============================================================ */
.table-pagination-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    background: #ffffff;
    border-top: 1px solid #e2e8f0;
    flex-wrap: wrap;
    gap: 1rem;
    font-size: 0.88rem;
    color: #475569;
}
.pagination-info {
    font-weight: 600;
    color: #0f2744;
}
.pagination-controls {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}
.pag-btn {
    padding: 0.4rem 0.85rem;
    border: 1px solid #cbd5e1;
    background: #ffffff;
    color: #0f2744;
    font-weight: 700;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.85rem;
}
.pag-btn:hover:not(:disabled) {
    background: #f1f5f9;
    border-color: #0f2744;
}
.pag-btn.active {
    background: #0f2744;
    color: #ffffff;
    border-color: #0f2744;
}
.pag-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}
.pag-ellipsis {
    padding: 0 0.35rem;
    color: #94a3b8;
    font-weight: 700;
}


/* ============================================================
   SUPER ADMIN SIDEBAR — Premium Dark Navy + Gold Theme
   ============================================================ */

/* Admin layout uses same body.app-layout + content-wrapper pattern */
body.admin-layout {
    display: flex;
    min-height: 100dvh;
    background: #f0f4f8;
    margin: 0;
}

/* Admin sidebar extends the base .sidebar with extra polish */
.admin-sidebar {
    background: linear-gradient(180deg, #0a1a2e 0%, #0f2744 40%, #122f52 100%);
    border-right: 1px solid rgba(212,175,55,0.12);
    box-shadow: 4px 0 24px rgba(0,0,0,0.3);
    width: 260px;
}

.admin-sidebar .sidebar-header {
    padding: 1.25rem 1.25rem 1.25rem 1.5rem;
    border-bottom: 1px solid rgba(212,175,55,0.15);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: linear-gradient(180deg, rgba(212,175,55,0.06) 0%, rgba(0,0,0,0) 100%);
    min-height: 72px;
}

.admin-sidebar .sidebar-nav {
    padding: 1rem 0.75rem;
    overflow-y: auto;
    flex: 1;
}

/* Admin nav items — premium pill style */
.admin-sidebar .nav-item {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    padding: 0.75rem 1rem;
    color: #94a3b8;
    text-decoration: none;
    font-weight: 500;
    font-size: 0.925rem;
    border-radius: 10px;
    margin-bottom: 3px;
    border-left: none;
    transition: background 0.18s ease, color 0.18s ease, transform 0.15s ease;
    position: relative;
    letter-spacing: 0.01em;
}
.admin-sidebar .nav-item .nav-icon {
    font-size: 1.05rem;
    opacity: 0.75;
    width: 22px;
    text-align: center;
    transition: opacity 0.2s, transform 0.2s;
    flex-shrink: 0;
}

.admin-sidebar .nav-item:hover {
    background: rgba(212,175,55,0.1);
    color: #f5c842;
    border-left: none;
    transform: translateX(2px);
}
.admin-sidebar .nav-item:hover .nav-icon {
    opacity: 1;
    transform: scale(1.1);
}
.admin-sidebar .nav-item.active {
    background: linear-gradient(135deg, rgba(212,175,55,0.18) 0%, rgba(212,175,55,0.08) 100%);
    color: #facc15;
    border-left: none;
    font-weight: 700;
    box-shadow: inset 0 0 0 1px rgba(212,175,55,0.2);
}
.admin-sidebar .nav-item.active .nav-icon {
    opacity: 1;
}
/* Active left indicator as pseudo-element, not border-left */
.admin-sidebar .nav-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 60%;
    background: linear-gradient(180deg, #facc15, #d4af37);
    border-radius: 0 3px 3px 0;
}

/* Admin section label */
.admin-nav-section {
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #334e68;
    padding: 1rem 1rem 0.35rem;
    margin-top: 0.5rem;
}

/* Admin top navbar override */
.admin-top-navbar {
    background: #ffffff;
    border-bottom: 1px solid #e8edf2;
    padding: 0 1.75rem;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 90;
    box-shadow: 0 1px 8px rgba(0,0,0,0.06);
}

/* Status pill in admin navbar */
.admin-status-pill {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    color: #166534;
    padding: 0.3rem 0.8rem;
    border-radius: 50px;
    font-weight: 700;
    font-size: 0.78rem;
    letter-spacing: 0.03em;
}
.admin-status-dot {
    width: 7px;
    height: 7px;
    background: #22c55e;
    border-radius: 50%;
    animation: pulse-dot 2s ease infinite;
}
@keyframes pulse-dot {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.6; transform: scale(0.85); }
}

/* Admin scrollbar */
.admin-sidebar .sidebar-nav::-webkit-scrollbar {
    width: 4px;
}
.admin-sidebar .sidebar-nav::-webkit-scrollbar-track {
    background: transparent;
}
.admin-sidebar .sidebar-nav::-webkit-scrollbar-thumb {
    background: rgba(212,175,55,0.25);
    border-radius: 10px;
}
.admin-sidebar .sidebar-nav::-webkit-scrollbar-thumb:hover {
    background: rgba(212,175,55,0.5);
}

/* ============================================================
   STRICT NO-URL PRINT & PDF EXPORT ENGINE
   ============================================================ */
@page {
    size: auto;
    margin: 0mm !important;
}

@media print {
    /* Suppress all browser printed URL annotations & pseudo-elements */
    a[href]:after,
    a[href]:before {
        content: "" !important;
        display: none !important;
    }
    
    a, a:visited, a:hover, a:active {
        text-decoration: none !important;
        color: inherit !important;
    }

    /* Hide non-printable navigation bars, sidebars, buttons, and footers */
    .no-print,
    .print-hide,
    .btn,
    .btn-primary,
    .toolbar,
    .admin-sidebar,
    .sidebar,
    .app-header,
    .parent-header,
    .action-bar,
    header,
    nav,
    footer {
        display: none !important;
        visibility: hidden !important;
    }

    /* Force clean white background and high-contrast text */
    html, body {
        background: #ffffff !important;
        color: #000000 !important;
        margin: 0 !important;
        padding: 0 !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }
}
