/*
 * نظام إدارة الفعاليات المدرسية
 * الهوية البصرية: نظام تصميم المواقع الحكومية البحرينية (Bahrain Government Web Design System v1.0)
 * المرجع: https://nea.gov.bh/Government-Website-Design-System — https://github.com/IGA-BH/BH-web-design-system
 * الخطوط الرسمية: Noto Kufi Arabic (عربي) + Public Sans (إنجليزي)
 */
@import url('https://fonts.googleapis.com/css2?family=Noto+Kufi+Arabic:wght@300;400;500;600;700&family=Public+Sans:wght@300;400;500;600;700&display=swap');

/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* ============================================================
   الرموز التصميمية الرسمية (Design Tokens)
   منقولة حرفياً من نظام التصميم الحكومي البحريني
   ============================================================ */
:root {
    /* الخطوط الرسمية */
    --bh-ff-primary: "Noto Kufi Arabic", "Public Sans", sans-serif;
    --bh-ff-secondary: "Noto Kufi Arabic", sans-serif;

    /* ألوان الهوية الرسمية */
    --bh-light: #ffffff;
    --bh-dark: #000000;
    --bh-brand: #012E5D;           /* الأزرق الحكومي الأساسي */
    --bh-brand-dark: #011E3D;
    --bh-inverse-brand: #34587D;
    --bh-accent: #C63B2B;          /* الأحمر البحريني */
    --bh-accent-hover: #9E2F22;
    --bh-primary: #000000;
    --bh-secondary: #333333;
    --bh-tertiary: #999999;

    /* الألوان الدلالية الرسمية */
    --bh-info: #0AA2C0;      --bh-info-off: #CFF4FC;      --bh-info-content: #055160;
    --bh-success: #3B9B6F;   --bh-success-off: #DBF3E8;   --bh-success-content: #2C7453;
    --bh-warning: #FF8300;   --bh-warning-off: #FFE6CC;   --bh-warning-content: #894701;
    --bh-failure: #DC3545;   --bh-failure-off: #F8D7DA;   --bh-failure-content: #B02A37;
    --bh-error-star: #A91E2C;
    --bh-focus: rgba(54, 149, 250, 0.6);

    /* خلفيات وحدود رسمية */
    --bh-bg-secondary: #F7F7F7;
    --bh-bg-light-grey: #E5E5E5;
    --bh-bg-light-brand: #E5EAEF;
    --bh-bg-light-brand1: #E7F1FB;
    --bh-border-primary: #999999;
    --bh-border-secondary: #CBCBCB;
    --bh-border-tertiary: #F1F1F1;

    /* أنصاف الأقطار الرسمية */
    --bh-border-radius-l: 16px;
    --bh-border-radius-m: 12px;
    --bh-border-radius-s: 8px;
    --bh-border-radius-xs: 4px;
    --bh-border-radius-xss: 2px;

    /* ---- ربط متغيرات النظام بالرموز الرسمية ---- */
    --primary-gradient: linear-gradient(135deg, #012E5D 0%, #34587D 100%);
    --primary-color: #012E5D;
    --primary-dark: #011E3D;
    --secondary-color: #34587D;

    /* Sidebar Colors - Light Mode */
    --sidebar-bg: #ffffff;
    --sidebar-hover: #E5EAEF;
    --sidebar-text: #333333;
    --sidebar-icon: #999999;
    --sidebar-active: #012E5D;

    /* Main Content Colors */
    --main-bg: #F7F7F7;
    --content-bg: #ffffff;
    --header-bg: #ffffff;

    /* Stat Card Colors — من اللوحة الرسمية */
    --card-purple: #012E5D;
    --card-blue: #0AA2C0;
    --card-orange: #FF8300;
    --card-red: #C63B2B;
    --card-green: #3B9B6F;
    --card-teal: #34587D;

    /* Text Colors */
    --text-primary: #000000;
    --text-secondary: #333333;
    --text-muted: #999999;
    --text-white: #ffffff;

    /* Border & Shadow */
    --border-color: #CBCBCB;
    --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.03);
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.04), 0 1px 2px rgba(0, 0, 0, 0.03);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px rgba(0, 0, 0, 0.03);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.06), 0 4px 6px rgba(0, 0, 0, 0.03);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.06), 0 8px 10px rgba(0, 0, 0, 0.03);
    --shadow-primary: 0 4px 14px rgba(1, 46, 93, 0.25);

    /* Spacing */
    --spacing-xs: 0.25rem;
    --spacing-sm: 0.5rem;
    --spacing-md: 1rem;
    --spacing-lg: 1.5rem;
    --spacing-xl: 2rem;
    --spacing-2xl: 3rem;

    /* Compact Dashboard Spacing */
    --compact-xs: 0.375rem;
    --compact-sm: 0.75rem;
    --compact-md: 1.25rem;

    /* Border Radius — مطابق لأنصاف الأقطار الرسمية */
    --radius-sm: 4px;
    --radius-md: 4px;
    --radius-lg: 8px;
    --radius-xl: 12px;
    --radius-2xl: 16px;

    /* Typography */
    --font-size-xs: 0.75rem;
    --font-size-sm: 0.875rem;
    --font-size-base: 1rem;
    --font-size-lg: 1.125rem;
    --font-size-xl: 1.25rem;
    --font-size-2xl: 1.5rem;
    --font-size-3xl: 1.875rem;

    /* Extra Palette (used by dashboard) */
    --cinnabar: #C63B2B;
    --tosca: #3B9B6F;
    --mine-shaft: #012E5D;
    --nutmeg: #894701;
    --moon-mist: #CBCBCB;
    --scorpion: #333333;

    /* Layout */
    --sidebar-width: 260px;
    --header-height: 64px;

    /* Transitions */
    --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-fast: all 0.15s ease;
}

/* Base Body Styles */
body {
    font-family: var(--bh-ff-primary);
    font-size: var(--font-size-base);
    line-height: 1.6;
    color: var(--text-primary);
    background-color: var(--main-bg);
    direction: rtl;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Admin Layout Structure */
.admin-layout {
    display: flex;
    min-height: 100vh;
    overflow-x: hidden;
}

/* ========================================
   Modern Sidebar — Refreshed Design
   ======================================== */
.sidebar-modern {
    width: var(--sidebar-width);
    background:
        radial-gradient(120% 70% at 100% 0%, rgba(52, 88, 125, 0.06) 0%, transparent 60%),
        linear-gradient(180deg, #ffffff 0%, #FFFFFF 100%);
    position: fixed;
    right: 0;
    top: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    z-index: 1000;
    transition: transform 0.3s ease, width 0.3s ease;
    border-left: 1px solid rgba(226, 232, 240, 0.8);
    box-shadow: -2px 0 24px rgba(15, 23, 42, 0.04);
}

/* Disable sidebar slide animation during initial page load to prevent
   the sidebar from briefly appearing on screen on mobile (FOUC fix). */
body.preload .sidebar-modern,
body.preload .sidebar {
    transition: none !important;
}

/* Custom scrollbar inside sidebar */
.sidebar-modern *::-webkit-scrollbar { width: 6px; }
.sidebar-modern *::-webkit-scrollbar-track { background: transparent; }
.sidebar-modern *::-webkit-scrollbar-thumb {
    background: rgba(52, 88, 125, 0.2);
    border-radius: 3px;
}
.sidebar-modern *::-webkit-scrollbar-thumb:hover { background: rgba(52, 88, 125, 0.4); }

/* ===== Brand ===== */
.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    padding: 1.15rem 1.25rem;
    border-bottom: 1px solid rgba(226, 232, 240, 0.7);
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(8px);
    position: relative;
}
.sidebar-brand::after {
    content: '';
    position: absolute;
    bottom: -1px; left: 1.25rem; right: 1.25rem;
    height: 2px;
    background: linear-gradient(90deg, transparent, rgba(52, 88, 125, 0.25), transparent);
}

.brand-logo {
    width: 46px; height: 46px;
    background: linear-gradient(135deg, #012E5D 0%, #34587D 50%, #4D7099 100%);
    border-radius: 14px;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    box-shadow:
        0 6px 16px rgba(1, 46, 93, 0.35),
        inset 0 1px 0 rgba(255, 255, 255, 0.25);
    position: relative;
    overflow: hidden;
}
.brand-logo::before {
    content: '';
    position: absolute; inset: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.3) 0%, transparent 50%);
    pointer-events: none;
}
.brand-logo img {
    width: 28px; height: 28px;
    object-fit: contain;
    filter: brightness(0) invert(1);
    position: relative; z-index: 1;
}

.brand-info h1 {
    color: #000000;
    font-size: 1.02rem;
    font-weight: 800;
    margin: 0;
    line-height: 1.25;
    letter-spacing: -0.01em;
}
.brand-info span {
    color: #333333;
    font-size: 0.72rem;
    font-weight: 500;
}

.sidebar-close-btn {
    display: none;
    background: rgba(198, 59, 43, 0.1);
    color: #C63B2B;
    border: none;
    border-radius: 8px;
    width: 32px;
    height: 32px;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    margin-right: auto;
    transition: all 0.2s ease;
}

.sidebar-close-btn:hover {
    background: rgba(198, 59, 43, 0.2);
    transform: scale(1.05);
}

@media (max-width: 1024px) {
    .sidebar-close-btn {
        display: flex;
    }
}

/* ===== Profile Card ===== */
.sidebar-profile {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.85rem 1rem;
    margin: 0.875rem 0.875rem 0.5rem;
    background: linear-gradient(135deg, rgba(52, 88, 125, 0.06) 0%, rgba(52, 88, 125, 0.02) 100%);
    border-radius: 14px;
    border: 1px solid rgba(52, 88, 125, 0.12);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.sidebar-profile:hover {
    border-color: rgba(52, 88, 125, 0.25);
    box-shadow: 0 4px 12px rgba(52, 88, 125, 0.08);
}

.profile-avatar {
    width: 40px; height: 40px;
    background: linear-gradient(135deg, #012E5D 0%, #4D7099 100%);
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 4px 10px rgba(1, 46, 93, 0.3);
    position: relative;
}
.profile-avatar::after {
    content: '';
    position: absolute;
    bottom: -1px; right: -1px;
    width: 11px; height: 11px;
    background: #3B9B6F;
    border: 2px solid #fff;
    border-radius: 50%;
}
.profile-avatar span {
    color: white;
    font-size: 1.05rem;
    font-weight: 700;
}

.profile-info { min-width: 0; flex: 1; }
.profile-info h4 {
    color: #000000;
    font-size: 0.875rem;
    font-weight: 600;
    margin: 0 0 0.125rem 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.profile-role {
    color: #34587D;
    font-size: 0.7rem;
    font-weight: 600;
    background: rgba(52, 88, 125, 0.1);
    padding: 1px 8px;
    border-radius: 6px;
    display: inline-block;
}

/* ===== Navigation ===== */
.sidebar-navigation {
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem 0 1rem;
}

.nav-group {
    margin-bottom: 0.5rem;
    padding: 0 0.625rem;
}

.nav-group-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.875rem 0.875rem 0.4rem;
    color: #999999;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
}
.nav-group-title::after {
    content: '';
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, rgba(203, 203, 203, 0.6), transparent);
}

.nav-group ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.nav-item-modern {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0.75rem;
    color: #333333;
    text-decoration: none;
    transition: background-color 0.2s ease, color 0.2s ease, transform 0.15s ease;
    position: relative;
    border-radius: 10px;
    font-size: 0.875rem;
    font-weight: 500;
}

.nav-item-modern::before {
    content: '';
    position: absolute;
    right: -10px;
    top: 50%;
    transform: translateY(-50%) scaleY(0);
    width: 3px;
    height: 22px;
    background: linear-gradient(180deg, #012E5D, #4D7099);
    border-radius: 3px 0 0 3px;
    transition: transform 0.25s ease;
}

.nav-item-modern:hover {
    background: rgba(52, 88, 125, 0.08);
    color: #012E5D;
}
.nav-item-modern:hover::before { transform: translateY(-50%) scaleY(0.6); }

.nav-item-modern.active {
    background: linear-gradient(135deg, rgba(1, 46, 93, 0.12) 0%, rgba(52, 88, 125, 0.06) 100%);
    color: #011E3D;
    font-weight: 600;
}
.nav-item-modern.active::before { transform: translateY(-50%) scaleY(1); }

.nav-item-icon {
    width: 32px; height: 32px;
    display: flex; align-items: center; justify-content: center;
    background: rgba(241, 245, 249, 0.7);
    border-radius: 9px;
    flex-shrink: 0;
    transition: background-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
    color: #333333;
}
.nav-item-modern:hover .nav-item-icon {
    background: rgba(52, 88, 125, 0.15);
    color: #012E5D;
    transform: scale(1.05);
}
.nav-item-modern.active .nav-item-icon {
    background: linear-gradient(135deg, #012E5D, #34587D);
    color: #fff;
    box-shadow: 0 4px 10px rgba(1, 46, 93, 0.3);
}

.nav-item-icon.add {
    background: linear-gradient(135deg, rgba(59, 155, 111, 0.15), rgba(5, 150, 105, 0.1));
    color: #2C7453;
}
.nav-item-modern:hover .nav-item-icon.add {
    background: linear-gradient(135deg, #3B9B6F, #2C7453);
    color: #fff;
    box-shadow: 0 4px 10px rgba(59, 155, 111, 0.3);
}
.nav-item-modern.active .nav-item-icon.add {
    background: linear-gradient(135deg, #3B9B6F, #2C7453);
    color: #fff;
}

.nav-item-icon svg { width: 18px; height: 18px; }

.nav-item-modern span:not(.nav-item-badge) {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.nav-item-badge {
    margin-right: auto;
    background: linear-gradient(135deg, #C63B2B 0%, #B02A37 100%);
    color: white;
    font-size: 0.65rem;
    font-weight: 700;
    padding: 0.175rem 0.5rem;
    border-radius: 999px;
    min-width: 20px;
    text-align: center;
    box-shadow: 0 2px 6px rgba(198, 59, 43, 0.35);
    line-height: 1.2;
}

/* ===== Sidebar Bottom ===== */
.sidebar-bottom {
    padding: 0.875rem 1rem;
    border-top: 1px solid rgba(226, 232, 240, 0.7);
    margin-top: auto;
    background: rgba(255, 255, 255, 0.5);
    backdrop-filter: blur(8px);
}

.logout-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.625rem;
    width: 100%;
    padding: 0.7rem 1rem;
    background: rgba(198, 59, 43, 0.06);
    color: #B02A37;
    border: 1px solid rgba(198, 59, 43, 0.18);
    border-radius: 11px;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.85rem;
    transition: background 0.2s ease, color 0.2s ease, transform 0.15s ease, box-shadow 0.2s ease;
}
.logout-btn svg { transition: transform 0.2s ease; }
.logout-btn:hover {
    background: linear-gradient(135deg, #C63B2B 0%, #B02A37 100%);
    color: white;
    border-color: transparent;
    box-shadow: 0 6px 16px rgba(198, 59, 43, 0.35);
    transform: translateY(-1px);
}
.logout-btn:hover svg { transform: translateX(-3px); }

/* Old Sidebar Styles - Keep for backwards compatibility */
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--sidebar-bg);
    color: var(--sidebar-text);
    position: fixed;
    right: 0;
    left: auto;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    z-index: 1000;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    padding: var(--spacing-xl);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
}

.sidebar-logo {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
}

.sidebar-title {
    font-size: var(--font-size-lg);
    font-weight: 600;
    color: var(--sidebar-text);
}

.sidebar-nav {
    padding: var(--spacing-lg) 0;
    flex: 1;
    overflow-y: auto;
}

.nav-section {
    margin-bottom: var(--spacing-xl);
}

.nav-section-title {
    padding: 0 var(--spacing-xl) var(--spacing-sm);
    font-size: var(--font-size-xs);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--sidebar-icon);
}

.nav-item {
    list-style: none;
}

.nav-link {
    display: flex;
    align-items: center;
    padding: var(--spacing-md) var(--spacing-xl);
    color: var(--sidebar-text);
    text-decoration: none;
    transition: var(--transition);
    position: relative;
}

.nav-link:hover {
    background-color: var(--sidebar-hover);
    color: var(--sidebar-text);
}

.nav-link.active {
    background-color: var(--sidebar-active);
    color: var(--text-white);
}

.nav-link.active::before {
    content: '';
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background-color: var(--text-white);
}

.nav-icon {
    width: 20px;
    height: 20px;
    margin-left: var(--spacing-md);
    color: var(--sidebar-icon);
    transition: var(--transition);
}

.nav-link:hover .nav-icon,
.nav-link.active .nav-icon {
    color: currentColor;
}

/* Main Content Area */
.main-content {
    flex: 1;
    padding-right: var(--sidebar-width);
    min-width: 0;
}

@media (max-width: 1024px) {
    .main-content {
        padding-right: 0;
    }
}

/* Compact Dashboard Styles */
.compact-dashboard .stats-grid {
    gap: var(--compact-sm);
}

.compact-dashboard .stat-card {
    padding: var(--compact-md);
}

.compact-dashboard .stat-number {
    font-size: var(--font-size-xl);
    margin-bottom: var(--compact-xs);
}

.compact-dashboard .stat-label {
    font-size: var(--font-size-sm);
}

.compact-dashboard .card {
    margin-bottom: var(--compact-md);
}

.compact-dashboard .card-body {
    padding: var(--compact-md);
}

.compact-dashboard .card-header {
    padding: var(--compact-sm) var(--compact-md);
}

.compact-dashboard .list-item {
    padding: var(--compact-sm) 0;
}

.compact-dashboard .list-item-title {
    font-size: var(--font-size-base);
    margin-bottom: var(--compact-xs);
}

.compact-dashboard .list-item-meta {
    font-size: var(--font-size-xs);
    line-height: 1.4;
}

.compact-dashboard .table th,
.compact-dashboard .table td {
    padding: var(--compact-xs) var(--compact-sm);
    font-size: var(--font-size-sm);
}

.compact-dashboard .form-row {
    gap: var(--compact-sm);
    margin-bottom: var(--compact-sm);
}

.compact-dashboard .form-group {
    margin-bottom: var(--compact-sm);
}

.compact-dashboard .form-label {
    font-size: var(--font-size-sm);
    margin-bottom: var(--compact-xs);
}

.compact-dashboard .btn-sm {
    padding: var(--compact-xs) var(--compact-sm);
    font-size: var(--font-size-xs);
}

.compact-dashboard .grid-2 {
    gap: var(--compact-md);
}

.compact-dashboard .mb-2xl {
    margin-bottom: var(--compact-md);
}

/* Page content wrapper */
.content-container {
    padding: var(--spacing-xl);
}

/* Desktop Collapsed Sidebar (RTL: hide to the right) */
.admin-layout.sidebar-collapsed .sidebar,
.sidebar.collapsed {
    transform: translateX(100%);
}

.admin-layout.sidebar-collapsed .main-content {
    padding-right: 0;
}

/* Top Header */
.top-header {
    background-color: var(--header-bg);
    border-bottom: 1px solid var(--border-color);
    padding: 0 var(--spacing-xl);
    height: var(--header-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-sm);
}

.top-header.scrolled {
    box-shadow: var(--shadow-md);
    background-color: var(--content-bg);
}

.header-left {
    display: flex;
    align-items: center;
    gap: var(--spacing-lg);
}

.page-title {
    font-size: var(--font-size-2xl);
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.breadcrumb {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
}

.breadcrumb-item {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.breadcrumb-item:not(:last-child)::after {
    content: '/';
    color: var(--text-muted);
}

.header-right {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
}

.user-menu {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-sm) var(--spacing-md);
    border-radius: var(--radius-lg);
    transition: var(--transition);
    cursor: pointer;
}

.user-menu:hover {
    background-color: var(--main-bg);
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
}

.user-info {
    text-align: right;
}

.user-name {
    font-size: var(--font-size-sm);
    font-weight: 500;
    color: var(--text-primary);
}

.user-role {
    font-size: var(--font-size-xs);
    color: var(--text-secondary);
}

/* Sidebar Footer */
.sidebar-footer {
    margin-top: auto;
    padding: var(--spacing-lg) var(--spacing-xl);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-logout {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    padding: var(--spacing-md) var(--spacing-lg);
    color: var(--sidebar-text);
    text-decoration: none;
    border-radius: var(--radius-md);
    transition: all 0.2s ease;
    opacity: 0.8;
}

.sidebar-logout:hover {
    background: rgba(198, 59, 43, 0.2);
    color: #fca5a5;
    opacity: 1;
}

.sidebar-logout .nav-icon {
    color: currentColor;
}

/* Nav Badge */
.nav-badge {
    background: var(--cinnabar);
    color: white;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 10px;
    margin-right: auto;
    margin-left: var(--spacing-sm);
}

/* User Dropdown */
.user-dropdown {
    position: relative;
}

.user-dropdown-trigger {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-sm) var(--spacing-md);
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all 0.2s ease;
}

.user-dropdown-trigger:hover {
    background: var(--main-bg);
    border-color: var(--sidebar-active);
}

.user-avatar-wrapper {
    position: relative;
}

.user-avatar-wrapper .user-avatar {
    width: 38px;
    height: 38px;
}

.user-status {
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 10px;
    height: 10px;
    background: #22c55e;
    border: 2px solid white;
    border-radius: 50%;
}

.user-dropdown-trigger .user-info {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    text-align: right;
}

.user-dropdown-trigger .user-name {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.2;
}

.user-role-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.dropdown-arrow {
    color: var(--text-muted);
    transition: transform 0.2s ease;
}

.user-dropdown.open .dropdown-arrow {
    transform: rotate(180deg);
}

.user-dropdown-menu {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    min-width: 240px;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s ease;
    z-index: 1000;
}

.user-dropdown.open .user-dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--spacing-md) var(--spacing-lg);
    background: var(--main-bg);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.dropdown-user-info {
    display: flex;
    flex-direction: column;
}

.dropdown-user-info strong {
    font-size: 0.9rem;
    color: var(--text-primary);
}

.dropdown-user-info span {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.dropdown-divider {
    height: 1px;
    background: var(--border-color);
    margin: var(--spacing-xs) 0;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-sm) var(--spacing-lg);
    color: var(--text-primary);
    text-decoration: none;
    transition: all 0.15s ease;
    font-size: 0.9rem;
}

.dropdown-item:hover {
    background: var(--main-bg);
    color: var(--sidebar-active);
}

.dropdown-item svg {
    color: var(--text-muted);
    flex-shrink: 0;
}

.dropdown-item:hover svg {
    color: var(--sidebar-active);
}

.dropdown-item-danger {
    color: var(--card-red);
}

.dropdown-item-danger:hover {
    background: #fef2f2;
    color: #B02A37;
}

.dropdown-item-danger svg {
    color: var(--card-red);
}

/* Badge Variants */
.badge-admin {
    background: linear-gradient(135deg, var(--card-purple), #011E3D);
    color: white;
}

.badge-info {
    background: linear-gradient(135deg, var(--sidebar-active), #34587D);
    color: white;
}

.badge-teacher {
    background: linear-gradient(135deg, var(--tosca), #2C7453);
    color: white;
}

/* Page Content */
.page-content {
    padding: var(--spacing-xl);
}

/* Stats Cards Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: var(--spacing-xl);
    margin-bottom: var(--spacing-2xl);
}

/* Two-column responsive grid helper */
.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--spacing-xl);
}

/* Stat Card Styles */
.stat-card {
    background: linear-gradient(135deg, var(--card-purple), #011E3D);
    color: var(--text-white);
    padding: var(--spacing-xl);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    position: relative;
    overflow: hidden;
    transition: var(--transition);
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
}

.stat-card.blue {
    background: linear-gradient(135deg, var(--card-blue), #0AA2C0);
}

.stat-card.orange {
    background: linear-gradient(135deg, var(--card-orange), #894701);
}

.stat-card.red {
    background: linear-gradient(135deg, var(--card-red), #B02A37);
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 100px;
    height: 100px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    transform: translate(30px, -30px);
}

.stat-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: var(--spacing-lg);
}

.stat-title {
    font-size: var(--font-size-sm);
    font-weight: 500;
    opacity: 0.9;
    margin: 0;
}

.stat-icon {
    width: 24px;
    height: 24px;
    opacity: 0.8;
}

.stat-value {
    font-size: var(--font-size-3xl);
    font-weight: 700;
    margin-bottom: var(--spacing-sm);
}

.stat-change {
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
    font-size: var(--font-size-sm);
    opacity: 0.9;
}

/* Dashboard stat tiles (alternate naming used in dashboard.php) */
.stat-number {
    font-size: var(--font-size-3xl);
    font-weight: 700;
    margin-bottom: var(--spacing-sm);
}

.stat-label {
    font-size: var(--font-size-sm);
    opacity: 0.9;
}

.stat-change.positive {
    color: #3B9B6F;
}

.stat-change.negative {
    color: #f87171;
}

/* Content Cards */
.content-card {
    background-color: var(--content-bg);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    overflow: hidden;
    margin-bottom: var(--spacing-xl);
}

/* Generic card component (used by dashboard) */
.card {
    background: linear-gradient(135deg, #ffffff 0%, #FFFFFF 100%);
    border: 1px solid rgba(0, 0, 0, 0.06);
    border-radius: 20px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
    overflow: visible;
    /* allow custom dropdowns to escape clipping */
}

/* Add padding to card content even when .card-body is not used */
.card> :not(.card-header) {
    padding: var(--spacing-xl);
}

.card-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    background: linear-gradient(135deg, rgba(1, 46, 93, 0.03) 0%, rgba(52, 88, 125, 0.03) 100%);
    border-radius: 20px 20px 0 0;
}

.card-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: #000000;
    margin: 0;
}

.card-subtitle {
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    margin-top: var(--spacing-xs);
}

.card-body {
    padding: 1.75rem;
}

/* Tables */
.table-container {
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--font-size-sm);
}

.table th {
    background-color: var(--main-bg);
    padding: var(--spacing-md) var(--spacing-lg);
    text-align: right;
    font-weight: 600;
    color: var(--text-primary);
    border-bottom: 2px solid var(--border-color);
    white-space: nowrap;
}

.table td {
    padding: var(--spacing-md) var(--spacing-lg);
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
    white-space: normal;
    overflow-wrap: normal;
    /* avoid breaking inside words to prevent vertical text */
    word-break: normal;
    /* keep words intact */
    hyphens: none;
    /* prevent automatic hyphenation */
}

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

/* Forms */
.form-group {
    margin-bottom: 1rem;
}

.form-group.compact {
    margin-bottom: 0.75rem;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: #333333;
    font-size: 0.875rem;
    letter-spacing: -0.01em;
}

.form-label .text-cinnabar {
    color: #C63B2B;
}

.form-control {
    width: 100%;
    padding: 0.625rem 0.875rem;
    border: 2px solid #CBCBCB;
    border-radius: 10px;
    font-size: 0.9rem;
    transition: all 0.25s ease;
    background-color: #ffffff;
    height: auto;
    min-height: 2.625rem;
}

.form-control:hover {
    border-color: #CBCBCB;
}

.form-control.invalid {
    border-color: #C63B2B !important;
    background-color: #fef2f2 !important;
}

.field-error {
    color: #C63B2B;
    font-size: 0.8rem;
    margin-top: 0.25rem;
    padding-right: 0.25rem;
    font-weight: 500;
}

/* Center text inside text boxes system-wide (inputs, textareas), exclude selects */


.form-control.compact {
    padding: 0.5rem 0.75rem;
    min-height: 2.375rem;
    font-size: 0.875rem;
}

.form-control:focus {
    outline: none;
    border-color: #012E5D;
    box-shadow: 0 0 0 4px rgba(1, 46, 93, 0.12);
    background-color: #fefefe;
}

select.form-control {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
    background-position: left 0.5rem center;
    background-repeat: no-repeat;
    background-size: 1.5em 1.5em;
    padding-left: 2.5rem;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-md) var(--spacing-lg);
    border: none;
    border-radius: var(--radius-md);
    font-size: var(--font-size-sm);
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: var(--transition);
    line-height: 1;
}

.btn-primary {
    background-color: var(--sidebar-active);
    color: var(--text-white);
}

.btn-primary:hover {
    background-color: #34587D;
    transform: translateY(-1px);
}

.btn-success {
    background-color: #2C7453;
    color: var(--text-white);
}

.btn-danger {
    background-color: var(--card-red);
    color: var(--text-white);
}

.btn-secondary {
    background-color: var(--main-bg);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background-color: #eef2f7;
}

/* Light button variant (used in cropper modal) */
.btn-light {
    background-color: #ffffff;
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-light:hover {
    background-color: #F7F7F7;
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: var(--spacing-xs) var(--spacing-sm);
    font-size: var(--font-size-xs);
    font-weight: 500;
    border-radius: var(--radius-sm);
    line-height: 1;
    white-space: nowrap;
    /* keep short labels like "ظ†ط´ط§ط· ط¯ط§ط®ظ„ظٹ" in one line */
}

.badge-success {
    background-color: #d4edda;
    color: #155724;
}

.badge-warning {
    background-color: #fff3cd;
    color: #856404;
}

.badge-danger {
    background-color: #f8d7da;
    color: #721c24;
}

/* Alerts */
.alert {
    padding: var(--spacing-lg);
    border-radius: var(--radius-md);
    margin-bottom: var(--spacing-lg);
    border: 1px solid transparent;
}

.alert-success {
    background-color: #d4edda;
    border-color: #c3e6cb;
    color: #155724;
}

.alert-error {
    background-color: #f8d7da;
    border-color: #f5c6cb;
    color: #721c24;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .sidebar, .sidebar-modern {
        transform: translateX(100%);
    }

    .sidebar.mobile-open, .sidebar-modern.mobile-open {
        transform: translateX(0);
    }

    .main-content {
        padding-right: 0;
    }

    .stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
        gap: var(--spacing-lg);
    }

    .grid-2 {
        grid-template-columns: 1fr;
    }
}

/* Ensure the first (title) column keeps enough width for readable wrapping */

.activities-table-card .table td:first-child {
    min-width: 220px;
}

.table .activity-title {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    /* standard property for newer browsers */
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.4;
    font-weight: 600;
}

.table .activity-desc {
    display: -webkit-box;
    -webkit-line-clamp: 1;
    line-clamp: 1;
    /* standard property for newer browsers */
    -webkit-box-orient: vertical;
    overflow: hidden;
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.activities-table-card .table th:nth-child(2),
.activities-table-card .table td:nth-child(2) {
    min-width: 120px;
    /* keep badge in one line */
    width: 14%;
    /* let other columns take remaining space */
    text-align: center;
    white-space: nowrap;
}

@media (max-width: 768px) {
    .page-content {
        padding: var(--spacing-lg);
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .stat-card {
        padding: var(--spacing-lg);
    }

    .top-header {
        padding: 0 var(--spacing-lg);
    }

    .page-title {
        font-size: var(--font-size-xl);
    }
}

/* Loading Animation */
@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.loading-spinner {
    animation: spin 1s linear infinite;
}

/* Simple fade/slide animation used by JS .animate-in */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-in {
    animation: fadeInUp .4s ease both;
}

/* Utility Classes */
.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

.text-left {
    text-align: left;
}

.d-none {
    display: none;
}

.d-block {
    display: block;
}

.d-flex {
    display: flex;
}

.justify-center {
    justify-content: center;
}

.justify-between {
    justify-content: space-between;
}

.nowrap {
    white-space: nowrap;
}

.align-center {
    align-items: center;
}

.items-start {
    align-items: flex-start;
}

.gap-sm {
    gap: var(--spacing-sm);
}

/* Visually hidden (for a11y) */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.gap-md {
    gap: var(--spacing-md);
}

.gap-lg {
    gap: var(--spacing-lg);
}

.mt-0 {
    margin-top: 0;
}

.mb-0 {
    margin-bottom: 0;
}

.p-0 {
    padding: 0;
}

/* Additional utilities */
.mt-sm {
    margin-top: var(--spacing-sm);
}

.mb-2xl {
    margin-bottom: var(--spacing-2xl);
}

.btn-sm {
    padding: 0.3rem 0.8rem;
    font-size: 0.8rem;
}

.btn-block {
    display: block;
    width: 100%;
    text-align: center;
}

.text-secondary {
    color: var(--text-secondary);
}

.text-cinnabar {
    color: var(--cinnabar);
}

.text-tosca {
    color: var(--tosca);
}

.text-mineshaft {
    color: var(--mine-shaft);
}

/* Lists and content helpers */
.scroll-area {
    max-height: 400px;
    overflow-y: auto;
}

.list-item {
    border-bottom: 1px solid var(--border-color);
    padding: var(--spacing-lg) 0;
}

.list-item:last-child {
    border-bottom: none;
}

.list-item-title {
    margin: 0 0 var(--spacing-sm) 0;
    font-weight: 600;
}

.list-item-meta {
    color: var(--text-secondary);
    font-size: var(--font-size-sm);
    margin: 0;
}

.list-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--spacing-md) 0;
    border-bottom: 1px solid var(--border-color);
}

.list-row:last-child {
    border-bottom: none;
}

.pill {
    background: var(--cinnabar);
    color: var(--text-white);
    padding: 0.3rem 0.8rem;
    border-radius: 999px;
    font-size: 0.9rem;
}

.actions-grid {
    display: grid;
    gap: var(--spacing-lg);
    padding: var(--spacing-lg) 0;
}

.card-footer-actions {
    display: flex;
    justify-content: center;
    gap: 1rem;
    padding-top: 1.5rem;
    margin-top: 1rem;
    border-top: 2px solid rgba(1, 46, 93, 0.1);
}

.card-footer-actions .btn {
    min-width: 140px;
    padding: 0.75rem 1.5rem;
    font-weight: 600;
    border-radius: 12px;
    transition: all 0.25s ease;
}

.card-footer-actions .btn-primary {
    background: linear-gradient(135deg, #012E5D 0%, #34587D 100%);
    border: none;
    box-shadow: 0 4px 15px rgba(1, 46, 93, 0.35);
}

.card-footer-actions .btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(1, 46, 93, 0.45);
}

.card-footer-actions .btn-secondary {
    background: #F1F1F1;
    color: #333333;
    border: 1px solid #CBCBCB;
}

.card-footer-actions .btn-secondary:hover {
    background: #CBCBCB;
    color: #333333;
}

.stat-tile {
    text-align: center;
    padding: var(--spacing-md);
    background: #f9f9f9;
    border-radius: 8px;
}

/* ========================================
   Modern Dashboard Styles
   ======================================== */

.dashboard-modern {
    max-width: 1400px;
    margin: 0 auto;
}

/* Hero Section */
.dashboard-hero {
    background: linear-gradient(135deg, #012E5D 0%, #34587D 100%);
    border-radius: var(--radius-xl);
    padding: 2.5rem;
    margin-bottom: 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    overflow: hidden;
    position: relative;
}

.hero-content {
    flex: 1;
    z-index: 1;
}

.hero-text h1 {
    color: white;
    font-size: 1.75rem;
    font-weight: 700;
    margin: 0 0 0.5rem 0;
}

.hero-text p {
    color: rgba(255, 255, 255, 0.85);
    font-size: 1rem;
    margin: 0 0 1.5rem 0;
    max-width: 500px;
}

.hero-actions {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.hero-actions .btn-lg {
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-outline-light {
    background: transparent;
    border: 2px solid rgba(255, 255, 255, 0.5);
    color: white;
}

.btn-outline-light:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: white;
}

.hero-illustration {
    width: 180px;
    height: 180px;
    opacity: 0.3;
    flex-shrink: 0;
}

.hero-illustration svg {
    width: 100%;
    height: 100%;
}

/* Stats Row */
.stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.25rem;
    margin-bottom: 2rem;
}

.stat-card-modern {
    background: white;
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    border: 1px solid var(--border-color);
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

.stat-card-modern:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
}

.stat-card-modern::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 4px;
    height: 100%;
}

.stat-card-modern.purple::before {
    background: linear-gradient(180deg, #012E5D, #34587D);
}

.stat-card-modern.blue::before {
    background: linear-gradient(180deg, #0AA2C0, #055160);
}

.stat-card-modern.orange::before {
    background: linear-gradient(180deg, #FF8300, #894701);
}

.stat-card-modern.green::before {
    background: linear-gradient(180deg, #3B9B6F, #2C7453);
}

.stat-card-icon {
    width: 56px;
    height: 56px;
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.stat-card-modern.purple .stat-card-icon {
    background: linear-gradient(135deg, rgba(1, 46, 93, 0.15), rgba(52, 88, 125, 0.15));
    color: #012E5D;
}

.stat-card-modern.blue .stat-card-icon {
    background: rgba(10, 162, 192, 0.1);
    color: #0AA2C0;
}

.stat-card-modern.orange .stat-card-icon {
    background: rgba(245, 158, 11, 0.1);
    color: #FF8300;
}

.stat-card-modern.green .stat-card-icon {
    background: rgba(59, 155, 111, 0.1);
    color: #3B9B6F;
}

.stat-card-content {
    flex: 1;
}

.stat-card-value {
    display: block;
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
}

.stat-card-label {
    display: block;
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

.stat-card-trend {
    color: #3B9B6F;
}

.stat-card-link {
    font-size: 0.8rem;
    color: var(--sidebar-active);
    text-decoration: none;
    padding: 0.25rem 0.75rem;
    background: rgba(10, 162, 192, 0.1);
    border-radius: 999px;
}

/* Dashboard Grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.dashboard-card {
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    border: 1px solid var(--border-color);
    overflow: hidden;
}

.dashboard-card.full-width {
    grid-column: 1 / -1;
}

.card-header-modern {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.card-title-group {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.card-title-group h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.card-icon {
    color: #012E5D;
}

.card-icon.upcoming {
    color: #FF8300;
}

.card-icon.chart {
    color: #3B9B6F;
}

.card-icon.actions {
    color: #C63B2B;
}

.card-icon.trophy {
    color: #FF8300;
}

.card-action-link {
    font-size: 0.85rem;
    color: var(--sidebar-active);
    text-decoration: none;
    font-weight: 500;
}

.card-action-link:hover {
    text-decoration: underline;
}

.badge-count {
    background: linear-gradient(135deg, #012E5D, #34587D);
    color: white;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.25rem 0.75rem;
    border-radius: 999px;
}

.card-body-modern {
    padding: 1.5rem;
}

/* Activity Timeline */
.activity-timeline {
    position: relative;
}

.activity-timeline::before {
    content: '';
    position: absolute;
    right: 6px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: linear-gradient(180deg, #012E5D 0%, transparent 100%);
}

.timeline-item {
    display: flex;
    gap: 1rem;
    padding-bottom: 1.25rem;
    position: relative;
    animation: fadeInUp 0.4s ease forwards;
    opacity: 0;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.timeline-item:last-child {
    padding-bottom: 0;
}

.timeline-dot {
    width: 14px;
    height: 14px;
    background: white;
    border: 3px solid #012E5D;
    border-radius: 50%;
    flex-shrink: 0;
    z-index: 1;
}

.timeline-content {
    flex: 1;
    min-width: 0;
}

.timeline-title {
    display: block;
    font-weight: 600;
    color: var(--text-primary);
    text-decoration: none;
    margin-bottom: 0.35rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.timeline-title:hover {
    color: #012E5D;
}

.timeline-meta {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.badge-type {
    font-size: 0.7rem;
    background: rgba(1, 46, 93, 0.1);
    color: #012E5D;
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    font-weight: 500;
}

.timeline-date {
    font-size: 0.8rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

/* Upcoming List */
.upcoming-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.upcoming-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: #F7F7F7;
    border-radius: var(--radius-md);
    border-right: 4px solid #CBCBCB;
    transition: all 0.2s ease;
}

.upcoming-item:hover {
    background: #F1F1F1;
}

.upcoming-item.urgent {
    border-right-color: #C63B2B;
    background: #fef2f2;
}

.upcoming-item.soon {
    border-right-color: #FF8300;
    background: #fffbeb;
}

.upcoming-date {
    width: 50px;
    text-align: center;
    flex-shrink: 0;
}

.upcoming-date .day {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
}

.upcoming-date .month {
    display: block;
    font-size: 0.7rem;
    color: var(--text-secondary);
    text-transform: uppercase;
}

.upcoming-info {
    flex: 1;
    min-width: 0;
}

.upcoming-title {
    display: block;
    font-weight: 600;
    color: var(--text-primary);
    text-decoration: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.upcoming-title:hover {
    color: #012E5D;
}

.upcoming-type {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.countdown-badge {
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.25rem 0.6rem;
    border-radius: 999px;
    flex-shrink: 0;
}

.countdown-badge.today {
    background: #fef2f2;
    color: #C63B2B;
}

.countdown-badge.tomorrow {
    background: #fffbeb;
    color: #894701;
}

.countdown-badge.week {
    background: #f0fdf4;
    color: #3B9B6F;
}

/* Chart Bars */
.chart-bars {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.chart-bar-item {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.chart-bar-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: var(--text-primary);
}

.chart-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.chart-bar-wrapper {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.chart-bar {
    height: 8px;
    border-radius: 999px;
    transition: width 0.6s ease;
}

.chart-bar-value {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    min-width: 30px;
}

/* Quick Actions Grid */
.quick-actions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 1rem;
}

.quick-action-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 1.25rem 1rem;
    border-radius: var(--radius-lg);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.85rem;
    transition: all 0.2s ease;
}

.quick-action-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

.quick-action-btn.primary {
    background: linear-gradient(135deg, #012E5D, #34587D);
    color: white;
}

.quick-action-btn.success {
    background: linear-gradient(135deg, #3B9B6F, #2C7453);
    color: white;
}

.quick-action-btn.secondary {
    background: #F1F1F1;
    color: var(--text-primary);
}

.quick-action-btn.secondary:hover {
    background: #CBCBCB;
}

.quick-action-btn.info {
    background: linear-gradient(135deg, #0AA2C0, #055160);
    color: white;
}

.quick-action-btn.warning {
    background: linear-gradient(135deg, #FF8300, #894701);
    color: white;
}

.quick-action-btn.dark {
    background: linear-gradient(135deg, #333333, #000000);
    color: white;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 2rem;
    color: var(--text-secondary);
}

.empty-state svg {
    color: #CBCBCB;
    margin-bottom: 1rem;
}

.empty-state p {
    margin: 0 0 1rem 0;
}

.empty-state.small {
    padding: 1rem;
}

.empty-state.small svg {
    width: 32px;
    height: 32px;
}

/* Top Teachers Grid */
.top-teachers-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.teacher-rank-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.25rem;
    background: #F7F7F7;
    border-radius: var(--radius-lg);
    transition: all 0.2s ease;
}

.teacher-rank-card:hover {
    background: #F1F1F1;
}

.teacher-rank-card.rank-1 {
    background: linear-gradient(135deg, #fef3c7, #fde68a);
}

.teacher-rank-card.rank-2 {
    background: linear-gradient(135deg, #F1F1F1, #CBCBCB);
}

.teacher-rank-card.rank-3 {
    background: linear-gradient(135deg, #fed7aa, #fdba74);
}

.rank-badge {
    width: 32px;
    height: 32px;
    background: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9rem;
    color: #012E5D;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.teacher-info {
    flex: 1;
}

.teacher-name {
    display: block;
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.95rem;
}

.teacher-count {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.rank-icon {
    font-size: 1.5rem;
}

/* Monthly Chart */
.monthly-chart {
    display: flex;
    align-items: flex-end;
    justify-content: space-around;
    height: 200px;
    gap: 1rem;
    padding-top: 1rem;
}

.monthly-bar-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    flex: 1;
    height: 100%;
}

.monthly-bar {
    width: 100%;
    max-width: 60px;
    background: linear-gradient(180deg, #012E5D, #34587D);
    border-radius: var(--radius-md) var(--radius-md) 0 0;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 0.5rem;
    transition: height 0.6s ease;
    margin-top: auto;
}

.monthly-value {
    font-size: 0.85rem;
    font-weight: 700;
    color: white;
}

.monthly-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-align: center;
}

/* Dashboard Section */
.dashboard-section {
    margin-bottom: 2rem;
}

/* ========================================
   Page Header Modern Styles - Enhanced
   ======================================== */
.page-header-modern {
    background: linear-gradient(135deg, #012E5D 0%, #34587D 50%, #34587D 100%);
    border-radius: 20px;
    padding: 1.75rem 2rem;
    margin-bottom: 1.5rem;
    color: white;
    position: relative;
    overflow: hidden;
    box-shadow: 0 10px 40px rgba(1, 46, 93, 0.3);
}

/* Decorative background pattern */
.page-header-modern::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -20%;
    width: 60%;
    height: 200%;
    background: radial-gradient(ellipse, rgba(255, 255, 255, 0.1) 0%, transparent 70%);
    pointer-events: none;
}

.page-header-modern::after {
    content: '';
    position: absolute;
    bottom: -30%;
    right: -10%;
    width: 40%;
    height: 150%;
    background: radial-gradient(ellipse, rgba(255, 255, 255, 0.08) 0%, transparent 60%);
    pointer-events: none;
}

.page-header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1.5rem;
    margin-bottom: 1.25rem;
    position: relative;
    z-index: 1;
}

.page-header-info {
    flex: 1;
}

.breadcrumb-modern {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.75);
    margin-bottom: 0.625rem;
    background: rgba(255, 255, 255, 0.1);
    padding: 0.35rem 0.875rem;
    border-radius: 20px;
    backdrop-filter: blur(4px);
}

.breadcrumb-modern a {
    color: rgba(255, 255, 255, 0.85);
    text-decoration: none;
    transition: color 0.2s ease;
}

.breadcrumb-modern a:hover {
    color: white;
}

.breadcrumb-modern span {
    color: white;
    font-weight: 500;
}

.breadcrumb-modern svg {
    opacity: 0.6;
}

.page-title {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    font-size: 1.5rem;
    font-weight: 800;
    margin: 0 0 0.375rem 0;
    letter-spacing: -0.02em;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.page-title svg {
    width: 26px;
    height: 26px;
    padding: 4px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 8px;
}

.page-subtitle {
    color: rgba(255, 255, 255, 0.85);
    font-size: 0.9rem;
    margin: 0;
    font-weight: 400;
}

.page-header-actions {
    display: flex;
    gap: 0.625rem;
    flex-shrink: 0;
    position: relative;
    z-index: 1;
}

.page-header-actions .btn {
    padding: 0.625rem 1.25rem;
    border-radius: 12px;
    font-weight: 600;
    font-size: 0.875rem;
    transition: all 0.25s ease;
}

.page-header-actions .btn-primary {
    background: rgba(255, 255, 255, 0.95);
    color: #012E5D;
    border: none;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
}

.page-header-actions .btn-primary:hover {
    background: white;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

.btn-outline-secondary {
    background: rgba(255, 255, 255, 0.12);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.25);
    backdrop-filter: blur(4px);
}

.btn-outline-secondary:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.4);
}

.page-stats {
    display: flex;
    gap: 1rem;
    padding-top: 1.25rem;
    border-top: 1px solid rgba(255, 255, 255, 0.12);
    position: relative;
    z-index: 1;
}

.page-stat-item {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.625rem 1rem;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 14px;
    backdrop-filter: blur(4px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    transition: all 0.25s ease;
}

.page-stat-item:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: translateY(-2px);
}

.page-stat-item .stat-icon {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.page-stat-item .stat-icon svg {
    width: 18px;
    height: 18px;
}

.page-stat-item .stat-icon.purple {
    background: rgba(255, 255, 255, 0.2);
}

.page-stat-item .stat-icon.green {
    background: rgba(59, 155, 111, 0.35);
}

.page-stat-item .stat-icon.orange {
    background: rgba(245, 158, 11, 0.35);
}

.page-stat-item .stat-data {
    display: flex;
    flex-direction: column;
}

.page-stat-item .stat-number {
    font-size: 1.25rem;
    font-weight: 800;
    line-height: 1.1;
    letter-spacing: -0.02em;
}

.page-stat-item .stat-text {
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.75);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Alert Modern */
.alert-modern {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    border-radius: var(--radius-lg);
    margin-bottom: 1.5rem;
    font-weight: 500;
}

.alert-modern.success {
    background: #ecfdf5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}

.alert-modern.error {
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

/* ========================================
   Filter Section Modern
   ======================================== */
.filter-section-modern {
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    border: 1px solid var(--border-color);
    margin-bottom: 1.5rem;
    overflow: hidden;
}

.filter-toggle-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
}

.filter-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--text-primary);
    font-weight: 500;
}

.filter-info svg {
    color: #012E5D;
}

.filter-count {
    background: linear-gradient(135deg, #012E5D, #34587D);
    color: white;
    font-size: 0.75rem;
    padding: 0.25rem 0.6rem;
    border-radius: 999px;
}

.filter-toggle-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: #F1F1F1;
    border: none;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.filter-toggle-btn:hover {
    background: #CBCBCB;
    color: var(--text-primary);
}

.filter-panel {
    padding: 1.5rem;
    background: #F7F7F7;
    border-top: 1px solid var(--border-color);
}

.filter-grid-modern {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.filter-group label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.filter-group label svg {
    color: #012E5D;
}

.filter-group input,
.filter-group select {
    padding: 0.625rem 0.875rem;
    border: 1px solid #CBCBCB;
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    background: white;
    transition: all 0.2s ease;
}

.filter-group input:focus,
.filter-group select:focus {
    outline: none;
    border-color: #012E5D;
    box-shadow: 0 0 0 3px rgba(1, 46, 93, 0.15);
}

.filter-actions-modern {
    display: flex;
    gap: 0.75rem;
    padding-top: 1rem;
    border-top: 1px solid #CBCBCB;
}

.btn-filter-apply {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    background: linear-gradient(135deg, #012E5D, #34587D);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-filter-apply:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(1, 46, 93, 0.3);
}

.btn-filter-reset {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    background: white;
    color: var(--text-secondary);
    border: 1px solid #CBCBCB;
    border-radius: var(--radius-md);
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s ease;
}

.btn-filter-reset:hover {
    background: #F1F1F1;
    color: var(--text-primary);
}

/* ========================================
   Activities Grid & Cards
   ======================================== */
.activities-container {
    margin-bottom: 2rem;
}

.activities-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.25rem;
}

.activity-card-modern {
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    border: 1px solid var(--border-color);
    overflow: hidden;
    transition: all 0.3s ease;
    animation: cardFadeIn 0.4s ease forwards;
    opacity: 0;
}

@keyframes cardFadeIn {
    from {
        opacity: 0;
        transform: translateY(15px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.activity-card-modern:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.1);
}

.activity-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem 0;
}

.activity-type-badge {
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.3rem 0.75rem;
    border-radius: 999px;
}

.activity-type-badge.internal {
    background: #ecfdf5;
    color: #2C7453;
}

.activity-type-badge.external {
    background: #fffbeb;
    color: #894701;
}

.activity-date {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.activity-card-body {
    padding: 1rem 1.25rem;
}

.activity-card-title {
    margin: 0 0 0.5rem 0;
    font-size: 1.05rem;
    font-weight: 600;
    line-height: 1.4;
}

.activity-card-title a {
    color: var(--text-primary);
    text-decoration: none;
    transition: color 0.2s ease;
}

.activity-card-title a:hover {
    color: #012E5D;
}

.activity-card-desc {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.6;
    margin: 0;
}

.activity-card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    padding: 0 1.25rem 1rem;
}

.activity-card-meta .meta-item {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.activity-card-meta .meta-item svg {
    color: #012E5D;
}

.activity-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    background: #F7F7F7;
    border-top: 1px solid var(--border-color);
}

.activity-author {
    display: flex;
    align-items: center;
    gap: 0.625rem;
}

.author-avatar {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, #012E5D, #34587D);
    color: white;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    font-weight: 600;
}

.activity-author span {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.activity-actions {
    display: flex;
    gap: 0.5rem;
}

.action-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.action-btn.view {
    background: #F1F1F1;
    color: #333333;
}

.action-btn.view:hover {
    background: #012E5D;
    color: white;
}

.action-btn.edit {
    background: #fef3c7;
    color: #894701;
}

.action-btn.edit:hover {
    background: #FF8300;
    color: white;
}

/* Empty State Modern */
.empty-state-modern {
    text-align: center;
    padding: 4rem 2rem;
    background: white;
    border-radius: var(--radius-lg);
    border: 2px dashed #CBCBCB;
}

.empty-state-modern .empty-icon {
    width: 100px;
    height: 100px;
    margin: 0 auto 1.5rem;
    background: linear-gradient(135deg, rgba(1, 46, 93, 0.1), rgba(52, 88, 125, 0.1));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #012E5D;
}

.empty-state-modern h3 {
    font-size: 1.25rem;
    color: var(--text-primary);
    margin: 0 0 0.5rem 0;
}

.empty-state-modern p {
    color: var(--text-secondary);
    margin: 0 0 1.5rem 0;
}

/* Activities Page Responsive */
@media (max-width: 768px) {
    .page-header-modern {
        padding: 1.5rem;
    }

    .page-header-content {
        flex-direction: column;
        gap: 1rem;
    }

    .page-header-actions {
        width: 100%;
    }

    .page-header-actions .btn {
        flex: 1;
        justify-content: center;
    }

    .page-title {
        font-size: 1.35rem;
    }

    .page-stats {
        flex-wrap: wrap;
        gap: 1rem;
    }

    .page-stat-item {
        flex: 1;
        min-width: 100px;
    }

    .filter-grid-modern {
        grid-template-columns: 1fr;
    }

    .activities-grid {
        grid-template-columns: 1fr;
    }
}

/* Responsive */
@media (max-width: 1024px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .dashboard-hero {
        flex-direction: column;
        text-align: center;
        padding: 2rem 1.5rem;
    }

    .hero-illustration {
        display: none;
    }

    .hero-actions {
        justify-content: center;
    }

    .stats-row {
        grid-template-columns: repeat(2, 1fr);
    }

    .stat-card-modern {
        padding: 1rem;
    }

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

    .quick-actions-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .top-teachers-grid {
        grid-template-columns: 1fr;
    }

    .monthly-chart {
        height: 150px;
    }
}

@media (max-width: 480px) {
    .stats-row {
        grid-template-columns: 1fr;
    }

    .hero-actions {
        flex-direction: column;
        width: 100%;
    }

    .hero-actions .btn {
        width: 100%;
        justify-content: center;
    }
}

/* Teacher Welcome Banner (Dashboard) */
.teacher-welcome-banner {
    background: linear-gradient(135deg, #012E5D 0%, #34587D 100%);
    border-radius: var(--radius-xl);
    padding: var(--spacing-xl);
    margin-bottom: var(--spacing-xl);
    box-shadow: var(--shadow-lg);
}

.teacher-welcome-content {
    display: flex;
    align-items: center;
    gap: var(--spacing-xl);
    flex-wrap: wrap;
}

.teacher-welcome-info {
    flex: 1;
    min-width: 200px;
}

.teacher-welcome-info h2 {
    color: white;
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0 0 var(--spacing-xs) 0;
}

.teacher-welcome-info p {
    color: rgba(255, 255, 255, 0.85);
    margin: 0;
    font-size: 0.95rem;
}

.teacher-quick-stats {
    display: flex;
    gap: var(--spacing-md);
}

.quick-stat {
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    padding: var(--spacing-md) var(--spacing-lg);
    border-radius: var(--radius-lg);
    text-align: center;
    min-width: 100px;
}

.quick-stat-value {
    display: block;
    color: white;
    font-size: 1.75rem;
    font-weight: 700;
    line-height: 1;
}

.quick-stat-label {
    display: block;
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.75rem;
    margin-top: var(--spacing-xs);
}

.teacher-welcome-banner .btn-light {
    background: white;
    color: #012E5D;
    font-weight: 600;
    padding: var(--spacing-sm) var(--spacing-lg);
}

.teacher-welcome-banner .btn-light:hover {
    background: #f8f9fa;
    transform: translateY(-2px);
}

@media (max-width: 768px) {
    .teacher-welcome-content {
        flex-direction: column;
        text-align: center;
    }

    .teacher-quick-stats {
        width: 100%;
        justify-content: center;
    }

    .quick-stat {
        flex: 1;
        min-width: 80px;
        padding: var(--spacing-sm) var(--spacing-md);
    }

    .quick-stat-value {
        font-size: 1.4rem;
    }

    .teacher-welcome-banner .btn-light {
        width: 100%;
        justify-content: center;
    }
}

/* Welcome Card for Teachers */
.welcome-card {
    background: linear-gradient(135deg, var(--sidebar-active) 0%, #34587D 100%);
    color: white;
    border-radius: var(--radius-xl);
    padding: var(--spacing-xl);
    margin-bottom: var(--spacing-xl);
    box-shadow: var(--shadow-lg);
}

.welcome-content {
    display: flex;
    align-items: center;
    gap: var(--spacing-xl);
    margin-bottom: var(--spacing-lg);
}

.welcome-icon {
    width: 64px;
    height: 64px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.welcome-icon svg {
    color: white;
}

.welcome-text {
    flex: 1;
}

.welcome-text h3 {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0 0 var(--spacing-xs) 0;
}

.welcome-text p {
    margin: 0;
    opacity: 0.9;
    font-size: 0.95rem;
}

.welcome-stats {
    display: flex;
    gap: var(--spacing-lg);
}

.welcome-stat {
    text-align: center;
    padding: var(--spacing-md) var(--spacing-xl);
    background: rgba(255, 255, 255, 0.15);
    border-radius: var(--radius-md);
}

.welcome-stat .stat-value {
    display: block;
    font-size: 1.75rem;
    font-weight: 700;
}

.welcome-stat .stat-label {
    font-size: 0.85rem;
    opacity: 0.9;
}

.welcome-actions {
    display: flex;
    gap: var(--spacing-md);
    padding-top: var(--spacing-lg);
    border-top: 1px solid rgba(255, 255, 255, 0.2);
}

.welcome-card .btn-primary {
    background: white;
    color: var(--sidebar-active);
}

.welcome-card .btn-primary:hover {
    background: #f0f0f0;
}

.welcome-card .btn-secondary {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.welcome-card .btn-secondary:hover {
    background: rgba(255, 255, 255, 0.3);
}

@media (max-width: 768px) {
    .welcome-content {
        flex-direction: column;
        text-align: center;
    }

    .welcome-actions {
        flex-direction: column;
    }

    .welcome-card .btn {
        width: 100%;
        justify-content: center;
    }
}

/* ========================================
   Footer - Modern Design
   ======================================== */
.footer {
    background: linear-gradient(135deg, #F7F7F7 0%, #F1F1F1 100%);
    border-top: none;
    padding: 1.5rem 2rem;
    position: relative;
    overflow: hidden;
}

.footer::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #012E5D 0%, #34587D 50%, #34587D 100%);
}

.footer-content {
    text-align: center;
    position: relative;
    z-index: 1;
}

.footer-content p {
    margin: 0.375rem 0;
    color: #333333;
    font-size: 0.8rem;
    line-height: 1.6;
}

.footer-content p:first-child {
    color: #000000;
    font-weight: 600;
    font-size: 0.85rem;
}

.footer-content p:nth-child(2) {
    color: #012E5D;
    font-weight: 500;
}

.footer-content p:last-child {
    color: #999999;
    font-size: 0.75rem;
}

/* Form helper for JS validation */
.field-error {
    color: #e3342f;
    font-size: var(--font-size-xs);
    margin-top: var(--spacing-xs);
}

.form-group.focused .form-label {
    color: var(--sidebar-active);
}

/* Login Page Specific Styles */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    padding: 0;
    position: relative;
    overflow: hidden;
}

/* Animated Background Shapes */
.login-bg-shapes {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    z-index: 0;
    pointer-events: none;
}

.shape {
    position: absolute;
    border-radius: 50%;
    opacity: 0.1;
    animation: floatShape 20s ease-in-out infinite;
}

.shape-1 {
    width: 400px;
    height: 400px;
    background: linear-gradient(135deg, var(--sidebar-active), #012E5D);
    top: -100px;
    right: -100px;
    animation-delay: 0s;
}

.shape-2 {
    width: 300px;
    height: 300px;
    background: var(--bh-brand);
    bottom: -80px;
    left: -80px;
    animation-delay: -5s;
}

.shape-3 {
    width: 200px;
    height: 200px;
    background: linear-gradient(135deg, #012E5D, #34587D);
    top: 50%;
    left: 20%;
    animation-delay: -10s;
}

.shape-4 {
    width: 150px;
    height: 150px;
    background: linear-gradient(135deg, var(--sidebar-active), #00d4ff);
    bottom: 20%;
    right: 10%;
    animation-delay: -7s;
}

.shape-5 {
    width: 100px;
    height: 100px;
    background: var(--bh-accent);
    top: 30%;
    right: 30%;
    animation-delay: -3s;
}

@keyframes floatShape {

    0%,
    100% {
        transform: translate(0, 0) rotate(0deg);
    }

    25% {
        transform: translate(20px, -30px) rotate(90deg);
    }

    50% {
        transform: translate(-20px, 20px) rotate(180deg);
    }

    75% {
        transform: translate(30px, 10px) rotate(270deg);
    }
}

/* Login Wrapper - Split Screen */
.login-wrapper {
    display: flex;
    width: 100%;
    min-height: 100vh;
    position: relative;
    z-index: 1;
}

/* Brand Side (Left) */
.login-brand-side {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-2xl);
    background: linear-gradient(135deg, rgba(1, 46, 93, 0.08) 0%, rgba(1, 46, 93, 0.1) 100%);
    backdrop-filter: blur(10px);
}

.brand-content {
    max-width: 450px;
    text-align: center;
    color: white;
}

.brand-icon {
    width: 100px;
    height: 100px;
    background: linear-gradient(135deg, var(--sidebar-active), #012E5D);
    border-radius: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto var(--spacing-xl);
    box-shadow: 0 20px 40px rgba(52, 152, 219, 0.3);
    animation: pulse 3s ease-in-out infinite;
}

@keyframes pulse {

    0%,
    100% {
        transform: scale(1);
        box-shadow: 0 20px 40px rgba(52, 152, 219, 0.3);
    }

    50% {
        transform: scale(1.05);
        box-shadow: 0 25px 50px rgba(52, 152, 219, 0.4);
    }
}

.brand-icon svg {
    color: white;
}

.brand-title {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: var(--spacing-md);
    background: linear-gradient(135deg, #ffffff 0%, #a8d8ff 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.brand-desc {
    font-size: 1.1rem;
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: var(--spacing-2xl);
    line-height: 1.7;
}

.brand-features {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
}

.feature-item {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    padding: var(--spacing-md) var(--spacing-lg);
    background: rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-lg);
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
}

.feature-item:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: translateX(-5px);
}

.feature-item svg {
    color: #4ade80;
    flex-shrink: 0;
}

.feature-item span {
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.95rem;
}

/* Form Side (Right) */
.login-form-side {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-2xl);
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
}

.login-container {
    background: transparent;
    padding: 0;
    border-radius: 0;
    box-shadow: none;
    width: 100%;
    max-width: 420px;
}

.login-header {
    text-align: center;
    margin-bottom: var(--spacing-2xl);
}

.login-logo {
    width: 90px;
    height: 90px;
    margin: 0 auto var(--spacing-lg);
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    transition: transform 0.3s ease;
}

.login-logo:hover {
    transform: scale(1.05) rotate(3deg);
}

.login-title {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: var(--spacing-sm);
}

.login-subtitle {
    color: var(--text-secondary);
    font-size: var(--font-size-base);
}

/* Login Form Styles */
.login-form-fields {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-lg);
}

.login-form-fields .form-group {
    margin-bottom: 0;
}

.login-form-fields .form-label {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--spacing-sm);
    display: block;
}

/* Input with Icon */
.input-icon-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-icon {
    position: absolute;
    right: 14px;
    color: var(--text-muted);
    pointer-events: none;
    transition: color 0.3s ease;
    z-index: 1;
}

.form-control.with-icon {
    padding-right: 48px;
    padding-left: 48px;
    height: 52px;
    font-size: 1rem;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-lg);
    background: white;
    transition: all 0.3s ease;
}

.form-control.with-icon:focus {
    border-color: var(--sidebar-active);
    box-shadow: 0 0 0 4px rgba(1, 46, 93, 0.08);
}

.form-group.focused .input-icon {
    color: var(--sidebar-active);
}

/* Password Toggle Button */
.password-toggle {
    position: absolute;
    left: 14px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    color: var(--text-muted);
    transition: color 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.password-toggle:hover {
    color: var(--sidebar-active);
}

/* Login Button */
.btn-login {
    width: 100%;
    height: 52px;
    font-size: 1.05rem;
    font-weight: 600;
    gap: var(--spacing-sm);
    background: linear-gradient(135deg, var(--sidebar-active), #34587D);
    border: none;
    border-radius: var(--radius-lg);
    box-shadow: 0 10px 30px rgba(52, 152, 219, 0.3);
    transition: all 0.3s ease;
    margin-top: var(--spacing-md);
}

.btn-login:hover {
    transform: translateY(-2px);
    box-shadow: 0 15px 40px rgba(52, 152, 219, 0.4);
    background: linear-gradient(135deg, #34587D, var(--sidebar-active));
}

.btn-login:active {
    transform: translateY(0);
}

.btn-login svg {
    transition: transform 0.3s ease;
}

.btn-login:hover svg {
    transform: translateX(-4px);
}

/* Alert with Icon */
.login-form-fields .alert-error,
.login-form .alert-error {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-md) var(--spacing-lg);
    border-radius: var(--radius-lg);
    animation: shake 0.5s ease-in-out;
}

@keyframes shake {

    0%,
    100% {
        transform: translateX(0);
    }

    20%,
    60% {
        transform: translateX(-5px);
    }

    40%,
    80% {
        transform: translateX(5px);
    }
}

/* Login Footer & Copyright Styles */
.login-footer {
    margin-top: 2rem;
    padding-top: 1.5rem;
}

.copyright-section {
    text-align: center;
    position: relative;
}

.copyright-divider {
    width: 60px;
    height: 2px;
    background: var(--bh-brand);
    margin: 0 auto 1.5rem;
    border-radius: 1px;
    position: relative;
}

.copyright-divider::before,
.copyright-divider::after {
    content: '';
    position: absolute;
    top: 50%;
    width: 4px;
    height: 4px;
    background: var(--cinnabar);
    border-radius: 50%;
    transform: translateY(-50%);
}

.copyright-divider::before {
    right: -8px;
}

.copyright-divider::after {
    left: -8px;
}

.copyright-main {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--mine-shaft);
    margin-bottom: 0.75rem;
    letter-spacing: 0.3px;
}

.copyright-designer {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--cinnabar);
    margin-bottom: 0.5rem;
    letter-spacing: 0.2px;
    position: relative;
    padding: 0.5rem 1rem;
    background: linear-gradient(135deg, rgba(198, 59, 43, 0.08), rgba(153, 72, 63, 0.08));
    border-radius: 12px;
    border: 1px solid rgba(233, 57, 42, 0.15);
    backdrop-filter: blur(10px);
    box-shadow:
        0 2px 8px rgba(233, 57, 42, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.copyright-designer::before {
    content: 'âœ¦';
    position: absolute;
    left: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.7rem;
    color: var(--cinnabar);
    opacity: 0.7;
}

.copyright-designer::after {
    content: 'âœ¦';
    position: absolute;
    right: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.7rem;
    color: var(--cinnabar);
    opacity: 0.7;
}

.copyright-description {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 0;
    opacity: 0.8;
    font-style: italic;
    letter-spacing: 0.1px;
}

/* Form Row Layouts */
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1rem;
    align-items: end;
}

.form-row-three {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1rem;
}

.form-row-four {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1rem;
}

/* ========================================
   Enhanced Form Section Styles
   ======================================== */
.form-section {
    margin-bottom: 1.75rem;
    padding: 1.5rem;
    background: linear-gradient(135deg, #ffffff 0%, #F7F7F7 100%);
    border-radius: 16px;
    border: 1px solid rgba(0, 0, 0, 0.06);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.04);
    position: relative;
    overflow: hidden;
}

.form-section::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 4px;
    height: 100%;
    background: linear-gradient(180deg, #012E5D 0%, #34587D 100%);
    border-radius: 0 16px 16px 0;
}

.form-section-title {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    font-size: 1.05rem;
    font-weight: 700;
    color: #000000;
    margin-bottom: 1.25rem;
    padding-bottom: 0.875rem;
    border-bottom: 2px solid rgba(1, 46, 93, 0.15);
    position: relative;
}

.form-section-title::before {
    content: '';
    width: 8px;
    height: 8px;
    background: linear-gradient(135deg, #012E5D 0%, #34587D 100%);
    border-radius: 50%;
}

.search-row {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr auto;
    gap: var(--spacing-lg);
    align-items: end;
}

/* Navigation Toggle for Mobile */
.nav-toggle {
    display: none;
    background: none;
    border: none;
    font-size: var(--font-size-xl);
    color: var(--text-primary);
    cursor: pointer;
}

@media (max-width: 1024px) {
    .nav-toggle {
        display: block;
    }

    /* Login Page Tablet Responsive */
    .login-brand-side {
        padding: var(--spacing-xl);
    }

    .brand-content {
        max-width: 380px;
    }

    .brand-title {
        font-size: 1.6rem;
    }

    .brand-desc {
        font-size: 1rem;
    }

    .brand-icon {
        width: 80px;
        height: 80px;
    }

    .brand-icon svg {
        width: 48px;
        height: 48px;
    }

    .feature-item {
        padding: var(--spacing-sm) var(--spacing-md);
    }

    .feature-item span {
        font-size: 0.9rem;
    }
}

/* Table Responsive */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.hide-sm {
    display: table-cell;
}

@media (max-width: 768px) {
    .form-row {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }

    .form-row-three,
    .form-row-four {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }

    .form-section {
        margin-bottom: 1.25rem;
        padding: 0.75rem;
    }

    .form-section-title {
        font-size: 0.95rem;
        margin-bottom: 0.5rem;
    }

    .search-row {
        grid-template-columns: 1fr;
        gap: var(--spacing-md);
    }

    /* Login Page Mobile Responsive */
    .login-wrapper {
        flex-direction: column;
    }

    .login-brand-side {
        display: none;
    }

    .login-form-side {
        min-height: 100vh;
        padding: var(--spacing-lg);
        background: linear-gradient(135deg, rgba(255, 255, 255, 0.98) 0%, rgba(255, 255, 255, 0.95) 100%);
    }

    .login-container {
        max-width: 100%;
    }

    .login-logo {
        width: 80px;
        height: 80px;
    }

    .login-title {
        font-size: 1.4rem;
    }

    .login-subtitle {
        font-size: 0.9rem;
    }

    .form-control.with-icon {
        height: 48px;
    }

    .btn-login {
        height: 48px;
        font-size: 1rem;
    }

    /* User Dropdown Mobile */
    .user-dropdown-trigger .user-info {
        display: none;
    }

    .user-dropdown-trigger {
        padding: var(--spacing-xs) var(--spacing-sm);
    }

    .dropdown-arrow {
        display: none;
    }

    .user-dropdown-menu {
        right: 0;
        left: auto;
        min-width: 200px;
    }

    /* Hide sidebar footer text on mobile */
    .sidebar-footer {
        padding: var(--spacing-md) var(--spacing-lg);
    }
}

@media (max-width: 480px) {
    .form-section {
        padding: 0.5rem;
    }

    .form-control.compact {
        padding: 0.325rem 0.4rem;
        height: 2.125rem;
        font-size: 0.85rem;
    }

    .form-label {
        font-size: 0.85rem;
        margin-bottom: 0.2rem;
    }

    /* Mobile copyright styles */
    .login-footer {
        margin-top: 1.5rem;
        padding-top: 1rem;
    }

    .copyright-divider {
        width: 50px;
        margin-bottom: 1rem;
    }

    .copyright-main {
        font-size: 0.8rem;
        margin-bottom: 0.5rem;
    }

    .copyright-designer {
        font-size: 0.75rem;
        padding: 0.4rem 0.8rem;
        margin-bottom: 0.4rem;
    }

    .copyright-designer::before,
    .copyright-designer::after {
        font-size: 0.6rem;
    }

    .copyright-description {
        font-size: 0.7rem;
        line-height: 1.4;
    }
}

/* Enhanced focus states for accessibility */
.form-control:focus,
.btn:focus,
.nav-link:focus {
    outline: 2px solid var(--sidebar-active);
    outline-offset: 2px;
}

/* Modal Styles */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 9999;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: all 0.3s ease;
}

.modal-overlay.show {
    display: flex;
    opacity: 1;
}

.modal-container {
    background: white;
    border-radius: 12px;
    box-shadow:
        0 20px 50px rgba(0, 0, 0, 0.15),
        0 10px 25px rgba(0, 0, 0, 0.1);
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow: hidden;
    transform: translateY(-20px) scale(0.95);
    transition: all 0.3s ease;
    margin: 1rem;
}

.modal-overlay.show .modal-container {
    transform: translateY(0) scale(1);
}

.modal-header {
    background: var(--bh-brand);
    color: white;
    padding: 14px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
}

.modal-header::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg,
            rgba(255, 255, 255, 0.2),
            rgba(255, 255, 255, 0.4),
            rgba(255, 255, 255, 0.2));
}

.modal-title {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.modal-close {
    background: none;
    border: none;
    color: white;
    font-size: 1.8rem;
    line-height: 1;
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 50%;
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

.modal-body {
    padding: 2rem;
    max-height: 70vh;
    overflow-y: auto;
}

.modal-body .form-group {
    margin-bottom: 1.25rem;
}

.modal-body .form-group:last-child {
    margin-bottom: 0;
}

.modal-body label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--mine-shaft);
    font-size: 0.9rem;
}

.modal-body input[type="text"],
.modal-body input[type="email"],
.modal-body input[type="password"],
.modal-body select {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #CBCBCB;
    border-radius: 8px;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    background: white;
}

.modal-body input:focus,
.modal-body select:focus {
    outline: none;
    border-color: var(--cinnabar);
    box-shadow: 0 0 0 3px rgba(233, 57, 42, 0.1);
}

.modal-body input[type="checkbox"] {
    margin-left: 0.5rem;
    transform: scale(1.2);
}

.modal-footer {
    background: #F7F7F7;
    padding: 1.5rem 2rem;
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    border-top: 1px solid #CBCBCB;
}

.modal-footer .btn {
    min-width: 100px;
    padding: 0.75rem 1.5rem;
    font-weight: 500;
}

/* Cropper Modal Specific Styles */
.cropper-modal .cropper-wrapper {
    max-height: 60vh;
    overflow: hidden;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 300px;
}

.cropper-modal #cropper-image {
    max-width: 100%;
    max-height: 100%;
    display: block;
    object-fit: contain;
}

.cropper-footer {
    display: flex;
    gap: 12px;
    justify-content: space-between;
    align-items: center;
}

.cropper-controls,
.cropper-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.cropper-actions #cropper-confirm {
    min-width: 120px;
}

/* Compact overrides for cropper footer buttons (avoid large modal defaults) */
.cropper-footer .btn {
    min-width: auto;
    padding: 0.4rem 0.6rem;
}

.cropper-footer #cropper-confirm {
    min-width: 96px;
    /* smaller primary button inside toolbar */
}

@media (max-width: 768px) {
    .cropper-footer {
        flex-direction: column-reverse;
        gap: 0.75rem;
        align-items: stretch;
    }

    /* Mobile-specific cropper adjustments */
    .cropper-modal .modal-container {
        max-height: 95vh;
        height: 95vh;
        display: flex;
        flex-direction: column;
    }

    .cropper-modal .modal-body {
        flex: 1;
        display: flex;
        flex-direction: column;
        padding: 1rem;
        overflow: hidden;
    }

    .cropper-modal .cropper-wrapper {
        flex: 1;
        max-height: none;
        height: 100%;
        min-height: 250px;
        margin-bottom: 1rem;
    }

    /* Ensure image fits properly in portrait mode */
    .cropper-modal #cropper-image {
        width: auto;
        height: auto;
        max-width: 100%;
        max-height: 100%;
        object-fit: contain;
    }

    /* Make cropper toolbar small and move it to the top on mobile */
    .cropper-modal .cropper-footer {
        order: 1;
        /* place under header */
        position: sticky;
        top: 0;
        z-index: 5;
        background: #F7F7F7;
        border-bottom: 1px solid #CBCBCB;
        border-top: none;
        padding: 0.5rem 0.75rem;
        flex-direction: row !important;
        align-items: center;
        justify-content: space-between;
        gap: 0.5rem;
    }

    .cropper-modal .modal-body {
        order: 2;
        padding-top: 0.5rem;
    }

    .cropper-modal .cropper-controls {
        justify-content: flex-start;
        flex-wrap: nowrap;
        gap: 0.35rem;
    }

    .cropper-modal .cropper-actions {
        flex-shrink: 0;
        gap: 0.35rem;
    }

    .cropper-modal .cropper-controls .btn,
    .cropper-modal .cropper-controls .btn-sm {
        width: 36px;
        height: 36px;
        padding: 0;
        font-size: 1rem;
        border-radius: 999px;
    }

    .cropper-modal .cropper-footer .btn {
        min-width: auto;
        padding: 0.35rem 0.6rem;
        font-size: 0.9rem;
    }
}

/* Enhanced UI Elements */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #CBCBCB;
}

.form-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #CBCBCB;
}

.icon {
    display: inline-block;
    margin-left: 0.25rem;
    font-style: normal;
}

.badge-sm {
    font-size: 0.7rem;
    padding: 0.2rem 0.4rem;
    margin-right: 0.25rem;
}

.actions-grid {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.alert {
    display: flex;
    align-items: center;
    padding: 1rem;
    margin-bottom: 1rem;
    border-radius: 8px;
    border: 1px solid transparent;
}

.alert .icon {
    margin-left: 0.5rem;
    font-size: 1.1rem;
}

.alert-success {
    background-color: #dcfce7;
    border-color: #bbf7d0;
    color: #15803d;
}

.alert-error {
    background-color: #fef2f2;
    border-color: #fecaca;
    color: #B02A37;
}

/* Responsive modal */
@media (max-width: 768px) {
    .modal-container {
        width: 95%;
        margin: 0.5rem;
    }

    .modal-header,
    .modal-body,
    .modal-footer {
        padding-left: 1.5rem;
        padding-right: 1.5rem;
    }

    .modal-body {
        padding-top: 1.5rem;
        padding-bottom: 1.5rem;
    }

    .modal-footer {
        flex-direction: column-reverse;
        gap: 0.75rem;
    }

    .modal-footer .btn {
        width: 100%;
    }

    .page-header {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
    }

    .form-actions {
        flex-direction: column;
        gap: 0.5rem;
    }

    .actions-grid {
        flex-direction: column;
        gap: 0.25rem;
    }
}

/* Smooth transitions for better UX */
.sidebar,
.main-content,
.stat-card,
.content-card {
    transition: var(--transition);
}

/* Enhanced Filter Card Styles */
.filter-card {
    margin-bottom: var(--spacing-xl);
}

.filter-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.filter-content {
    border-top: 1px solid var(--border-color);
    padding: var(--spacing-xl);
    background: var(--main-bg);
    animation: filterSlide 0.3s ease-out;
}

/* Modern browsers: ensure card shows dropdown when open */
.card:has(.ms-wrapper.open) {
    overflow: visible;
}

@keyframes filterSlide {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.filter-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--spacing-lg);
    margin-bottom: var(--spacing-xl);
}

.filter-actions {
    display: flex;
    gap: var(--spacing-md);
    justify-content: center;
    padding-top: var(--spacing-lg);
    border-top: 1px solid var(--border-color);
}

.filter-actions .btn {
    min-width: 120px;
}

/* Metrics and sections grids */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--spacing-lg);
    margin-bottom: var(--spacing-2xl);
}

.sections-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--spacing-2xl);
}

/* Professional Table Enhancements */
.activities-table-card .table {
    margin-bottom: 0;
}

/* Sticky headers and compact density for tables */
.table-sticky thead th {
    position: sticky;
    top: 0;
    z-index: 1;
    background-color: var(--content-bg);
}

.table-compact th,
.table-compact td {
    padding: var(--spacing-sm) var(--spacing-md);
}

.table-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.table-actions .btn {
    display: inline-flex;
    align-items: center;
    gap: var(--spacing-sm);
}

/* Metric helpers */
.metric-value {
    font-size: var(--font-size-2xl);
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.metric-label {
    margin-top: var(--spacing-xs);
    color: var(--text-secondary);
    font-size: var(--font-size-sm);
}

.metric-bar {
    width: 8px;
    height: 40px;
    border-radius: 4px;
}

.bar-primary {
    background-color: var(--sidebar-active);
}

.bar-success {
    background-color: #3B9B6F;
}

.bar-info {
    background-color: var(--tosca);
}

.bar-warning {
    background-color: #FF8300;
}

.activity-title {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--spacing-xs);
}

.activity-desc {
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    line-height: 1.4;
}

.badge-success {
    background-color: #3B9B6F;
    color: var(--text-white);
}

.badge-warning {
    background-color: #FF8300;
    color: var(--text-white);
}

.btn-group {
    display: flex;
    gap: var(--spacing-xs);
}

.btn-group .btn {
    display: inline-flex;
    align-items: center;
    gap: var(--spacing-xs);
}

/* Custom tooltip (used by app.js initTooltips) */
.tooltip {
    position: fixed;
    z-index: 9999;
    background: rgba(17, 24, 39, 0.95);
    color: var(--text-white);
    padding: 0.35rem 0.5rem;
    border-radius: 4px;
    font-size: var(--font-size-sm);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
    pointer-events: none;
    direction: rtl;
}

/* Empty State Styling */
.empty-state {
    text-align: center;
    padding: var(--spacing-2xl);
    color: var(--text-secondary);
}

.empty-icon {
    color: var(--text-muted);
    margin-bottom: var(--spacing-lg);
}

.empty-title {
    font-size: var(--font-size-xl);
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--spacing-sm);
}

.empty-text {
    font-size: var(--font-size-base);
    margin-bottom: var(--spacing-xl);
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
}

/* Activity Images Gallery */
.activity-images {
    display: grid;
    gap: var(--spacing-md);
}

.primary-image {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
    background: var(--content-bg);
}

.primary-image img {
    width: 100%;
    height: auto;
    display: block;
}

.thumbs {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: var(--spacing-sm);
}

.thumb {
    width: 100%;
    height: 90px;
    object-fit: cover;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--content-bg);
}

/* Make each thumbnail cell stack image + actions */
.thumbs>.text-center {
    display: flex;
    flex-direction: column;
    align-items: stretch;
}

/* Actions below each thumbnail in edit_activity.php */
.thumbs .actions-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--spacing-sm);
    padding: var(--spacing-sm) 0;
}

.thumbs .actions-grid .btn {
    width: 100%;
    padding: 0.35rem 0.5rem;
    font-size: 0.8rem;
    line-height: 1.2;
    text-align: center;
}

@media (max-width: 380px) {
    .thumbs .actions-grid {
        grid-template-columns: 1fr;
    }
}

/* Responsive Enhancements */
@media (max-width: 768px) {
    .filter-grid {
        grid-template-columns: 1fr;
        gap: var(--spacing-md);
    }

    .filter-actions {
        flex-direction: column;
    }

    .table-header {
        flex-direction: column;
        gap: var(--spacing-md);
        align-items: stretch;
    }

    .table-actions {
        display: flex;
        justify-content: center;
    }

    .btn-group {
        flex-direction: column;
        gap: var(--spacing-xs);
    }
}

/* Custom Checkbox Multi-Select */
.ms-wrapper {
    position: relative;
    width: 100%;
}

.ms-display {
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    min-height: 2.5rem;
    padding: 0.5rem 0.75rem;
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: 6px;
}

.ms-display:focus {
    outline: 2px solid var(--sidebar-active);
    outline-offset: 2px;
}

.ms-text.ms-placeholder {
    color: var(--text-secondary);
}

.ms-caret {
    margin-inline-start: 8px;
    color: #666;
    transition: transform .15s ease;
}

.ms-wrapper.open .ms-caret {
    transform: rotate(180deg);
}

.ms-menu {
    position: absolute;
    left: 0;
    top: calc(100% + 4px);
    width: 100%;
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: var(--shadow-md);
    display: none;
    z-index: 999999;
}

.ms-menu[data-detached="1"] {
    display: block !important;
}

.ms-wrapper.open .ms-menu {
    display: block;
}

.ms-wrapper.open {
    z-index: 1000000;
}

.ms-actions {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    padding: 8px 10px;
    border-bottom: 1px solid var(--border-color);
    background: #fafafa;
}

.ms-action {
    background: transparent;
    border: none;
    color: var(--card-blue);
    cursor: pointer;
    font-size: .85rem;
    padding: 4px 6px;
    border-radius: 6px;
}

.ms-action:hover {
    background: #eef2ff;
}

.ms-list {
    max-height: 260px;
    overflow: auto;
    padding: 6px;
}

.ms-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    border-radius: 6px;
    cursor: pointer;
}

.ms-item:hover {
    background: var(--main-bg);
}

.ms-item .ms-checkbox {
    width: 16px;
    height: 16px;
}

@media (max-width:768px) {
    .ms-list {
        max-height: 220px;
    }
}

/* Popup Select Styles */
.popup-select-wrapper {
    position: relative;
}

.popup-select-display {
    cursor: pointer !important;
}

.popup-select-display:hover {
    background-color: #f8f9fa;
}

/* Modal Actions Styles */
.modal-actions {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    margin-bottom: 1rem;
    padding: 0.75rem;
    background: #f8f9fa;
    border-radius: 6px;
}

.modal-actions .btn {
    padding: 0.4rem 0.8rem;
    font-size: 0.85rem;
}

/* Checkbox List Styles */
.checkbox-list {
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: #fff;
}

.checkbox-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.checkbox-item:last-child {
    border-bottom: none;
}

.checkbox-item:hover {
    background-color: #f8f9fa;
}

.checkbox-item input[type="checkbox"] {
    margin: 0;
    transform: scale(1.1);
}

.checkbox-item span {
    flex: 1;
    font-size: 0.9rem;
    line-height: 1.4;
}

/* Print styles */
@media print {

    .sidebar,
    .nav-toggle,
    .btn,
    .filter-card {
        display: none !important;
    }

    .no-print {
        display: none !important;
    }

    /* Hide global site footer in print to avoid duplication with page-specific print footers */
    .footer {
        display: none !important;
    }

    .main-content {
        padding-right: 0;
    }

    .page-content {
        padding: 0;
    }

    /* Auto-resize images for print */
    img {
        max-width: 100% !important;
        height: auto !important;
        page-break-inside: avoid;
        object-fit: contain;
        object-position: center;
    }

    /* Specific sizing for activity images - increased for better space utilization */
    .activity-images img,
    .img-box img {
        max-width: 250px !important;
        max-height: 200px !important;
        width: auto !important;
        height: auto !important;
    }

    /* Gallery/grid images */
    .image-gallery img,
    .images img {
        max-width: 150px !important;
        max-height: 100px !important;
    }

    /* Large single images */
    .image-container img,
    .activity-image img {
        max-width: 300px !important;
        max-height: 200px !important;
    }

    /* Avoid page breaks in image containers */
    .img-box,
    .image-container,
    .activity-images {
        page-break-inside: avoid;
        margin-bottom: 8px;
    }
}

/* ========================================
   Ultra Premium Professional Login Page â€” Light Mode
   ======================================== */
.login-page {
    margin: 0;
    padding: 0;
    min-height: 100vh;
    background: #f0f4f8;
    background-image:
        radial-gradient(ellipse at top right, rgba(52, 88, 125,0.08), transparent 50%),
        radial-gradient(ellipse at bottom left, rgba(10, 162, 192,0.06), transparent 50%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--bh-ff-primary);
    color: #000000;
}

.login-split-container {
    display: flex;
    width: 94%;
    max-width: 1140px;
    min-height: 600px;
    background: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.06);
    border-radius: 28px;
    box-shadow:
        0 20px 60px -15px rgba(0, 0, 0, 0.08),
        0 4px 20px rgba(0, 0, 0, 0.03);
    overflow: hidden;
    position: relative;
}

/* Left Side - Presentation */
.login-presentation {
    flex: 1.25;
    position: relative;
    padding: 4rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    background: linear-gradient(135deg, #012E5D 0%, #34587D 40%, #4D7099 100%);
    overflow: hidden;
    border-left: none;
}

.login-presentation::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: url('data:image/svg+xml;utf8,<svg width="30" height="30" xmlns="http://www.w3.org/2000/svg"><circle cx="3" cy="3" r="1.5" fill="rgba(255,255,255,0.07)"/></svg>');
    pointer-events: none;
    z-index: 1;
}

.presentation-content {
    position: relative;
    z-index: 10;
}

.hero-svg {
    width: 100%;
    max-width: 340px;
    height: auto;
    margin-bottom: 2.5rem;
    filter: drop-shadow(0 15px 30px rgba(0,0,0,0.15));
}

/* Override SVG strokes/fills for light mode presentation */
.login-presentation .hero-svg circle { fill-opacity: 0.15; }
.login-presentation .hero-svg path[stroke] { stroke: rgba(255,255,255,0.4); }
.login-presentation .hero-svg rect { stroke: rgba(255,255,255,0.3); fill: rgba(255,255,255,0.06); }
.login-presentation .hero-svg path[stroke="#CBCBCB"] { stroke: rgba(255,255,255,0.5); }

.presentation-title {
    font-size: 2.25rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    margin-bottom: 1rem;
    color: #ffffff;
    line-height: 1.25;
}

.presentation-desc {
    font-size: 1.05rem;
    color: rgba(255, 255, 255, 0.8);
    line-height: 1.7;
    margin-bottom: 2.5rem;
    max-width: 90%;
}

.feature-badges {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.badge {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.55rem 1.1rem;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 99px;
    font-size: 0.9rem;
    font-weight: 500;
    color: #ffffff;
    backdrop-filter: blur(6px);
}

.badge svg {
    color: rgba(255, 255, 255, 0.9);
}

.orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    z-index: 0;
}

.orb-1 { width: 300px; height: 300px; background: rgba(255,255,255,0.15); top: -80px; right: -60px; }
.orb-2 { width: 250px; height: 250px; background: rgba(255,255,255,0.1); bottom: -60px; left: -60px; }

/* Right Side - Form */
.login-form-section {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3.5rem;
    background: #ffffff;
    position: relative;
    z-index: 5;
}

.form-container {
    width: 100%;
    max-width: 380px;
}

.form-header {
    margin-bottom: 2.5rem;
}

.form-brand {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.75rem;
}

.form-brand svg path[fill] {
    fill: #012E5D;
}

.form-brand svg path[stroke] {
    stroke: #012E5D;
}

.form-brand h2 {
    font-size: 1.6rem;
    font-weight: 700;
    margin: 0;
    color: #000000;
}

.form-subtitle {
    font-size: 0.95rem;
    color: #333333;
    line-height: 1.5;
}

/* Floating Input Group */
.modern-form {
    display: flex;
    flex-direction: column;
    gap: 1.75rem;
}

.input-group {
    position: relative;
}

.floating-input {
    position: relative;
    display: flex;
    align-items: center;
}

.input-field {
    width: 100%;
    background: transparent;
    border: none;
    border-bottom: 2px solid #CBCBCB;
    padding: 1.25rem 0 0.5rem;
    font-size: 1.05rem;
    color: #000000;
    font-family: var(--bh-ff-primary);
    transition: all 0.3s ease;
}

.input-field:focus {
    outline: none;
    border-bottom-color: #012E5D;
}

.input-label {
    position: absolute;
    top: 1rem;
    right: 0; /* RTL alignment */
    font-size: 1.05rem;
    color: #999999;
    pointer-events: none;
    transition: all 0.3s ease;
}

/* Float label up when active or has value */
.input-field:focus ~ .input-label,
.input-field.has-value ~ .input-label,
.input-field:not(:placeholder-shown) ~ .input-label {
    top: -0.35rem;
    font-size: 0.8rem;
    color: #012E5D;
    font-weight: 600;
}

.input-highlight {
    position: absolute;
    bottom: 0px;
    left: 0;
    width: 0;
    height: 2px;
    background: #012E5D;
    transition: width 0.4s ease;
}

.input-field:focus ~ .input-highlight {
    width: 100%;
}

.btn-toggle-password {
    position: absolute;
    left: 0;
    bottom: 0.5rem;
    background: none;
    border: none;
    color: #999999;
    cursor: pointer;
    padding: 0;
    transition: color 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-toggle-password:hover {
    color: #012E5D;
}

.btn-submit {
    margin-top: 2rem;
    width: 100%;
    height: 3.5rem;
    border-radius: 14px;
    background: linear-gradient(135deg, #012E5D 0%, #34587D 100%);
    border: none;
    color: white;
    font-family: var(--bh-ff-primary);
    font-size: 1.1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 6px 20px -4px rgba(1, 46, 93, 0.4);
}

.btn-submit:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 28px -4px rgba(1, 46, 93, 0.5);
    background: linear-gradient(135deg, #011E3D 0%, #012E5D 100%);
}

.btn-submit:active {
    transform: translateY(0);
    box-shadow: 0 4px 12px rgba(1, 46, 93, 0.3);
}

/* Alert Error */
.login-page .alert-error {
    background: #fef2f2 !important;
    border: 1px solid #fecaca !important;
    color: #B02A37 !important;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1rem;
    border-radius: 12px;
    margin-bottom: 2rem;
    font-size: 0.9rem;
    font-weight: 500;
}

.login-page .alert-error svg {
    color: #B02A37;
    flex-shrink: 0;
}

/* Footer Section */
.form-footer {
    margin-top: 3.5rem;
    text-align: center;
}

.copyright-text {
    font-size: 0.85rem;
    color: #999999;
    margin-bottom: 0.3rem;
}

.designer-credit {
    font-size: 0.8rem;
    color: #CBCBCB;
}

/* Responsive Theme Adjustments */
@media (max-width: 992px) {
    .login-split-container {
        flex-direction: column;
        width: 100%;
        height: auto;
        min-height: 100vh;
        border-radius: 0;
        border: none;
        box-shadow: none;
    }
    
    .login-presentation {
        padding: 3rem 2rem;
        border-bottom: none;
    }
    
    .hero-svg {
        display: none;
    }
    
    .presentation-title {
        font-size: 1.75rem;
        text-align: center;
    }
    
    .presentation-desc {
        text-align: center;
        max-width: 100%;
    }
    
    .feature-badges {
        justify-content: center;
    }
    
    .login-form-section {
        padding: 2.5rem 2rem;
    }
}

@media (max-width: 576px) {
    .login-presentation {
        padding: 2rem 1.5rem;
    }
    
    .login-form-section {
        padding: 2rem 1.5rem;
    }
    
    .presentation-title {
        font-size: 1.5rem;
    }
}

/* ===== Academic Year switcher & archive banner ===== */
.year-switcher { display: flex; align-items: center; gap: .5rem; }
.year-switcher-label { font-size: .8rem; color: var(--text-secondary); white-space: nowrap; }
.year-switcher-select {
    padding: .45rem .75rem;
    border: 1px solid var(--border-color, #CBCBCB);
    border-radius: 10px;
    background: #fff;
    font-weight: 600;
    color: var(--primary-color, #012E5D);
    cursor: pointer;
    font-family: inherit;
    font-size: .9rem;
    min-width: 150px;
}
.year-switcher-select:focus { outline: none; box-shadow: 0 0 0 3px rgba(52, 88, 125,.2); border-color: var(--primary-color, #012E5D); }
.year-switcher-select.is-archived { color: #b45309; border-color: #FF8300; background: #fffbeb; }

.year-archive-banner {
    display: flex; align-items: center; gap: .75rem; flex-wrap: wrap;
    padding: .75rem 1rem; margin-bottom: 1rem;
    border-radius: 12px;
    background: #fffbeb; border: 1px solid #FF8300; color: #78350f;
    line-height: 1.6;
}
.year-archive-banner.is-preview { background: #eff6ff; border-color: #0AA2C0; color: #1e3a8a; }
.year-archive-banner svg { flex-shrink: 0; }
.year-archive-banner > div { flex: 1 1 320px; min-width: 0; }
.year-archive-banner .banner-sub { display: block; font-size: .88rem; opacity: .9; }
.year-archive-banner .btn { margin-inline-start: auto; white-space: nowrap; }

@media (max-width: 768px) {
    .year-switcher-label { display: none; }
    .year-switcher-select { min-width: 120px; font-size: .85rem; padding: .35rem .5rem; }
}
@media print {
    .year-switcher, .year-archive-banner { display: none !important; }
}

/* ============================================================
   مكوّنات نظام التصميم الحكومي البحريني
   Bahrain Government Web Design System — components
   ============================================================ */

/* --- رابط التخطي إلى المحتوى (إلزامي للوصولية) --- */
.govbh-skip-link {
    position: absolute; top: -60px; right: 16px; z-index: 2000;
    background: var(--bh-brand); color: #fff;
    padding: 10px 18px; border-radius: 0 0 var(--bh-border-radius-xs) var(--bh-border-radius-xs);
    font-weight: 700; text-decoration: none;
    transition: top .15s ease;
}
.govbh-skip-link:focus { top: 0; color: #fff; }

/* --- حلقة التركيز الرسمية (WCAG) --- */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
    outline: 2px solid var(--bh-brand);
    outline-offset: 2px;
    box-shadow: 0 0 0 3px var(--bh-focus);
}

/* --- ملاحظة الطباعة: إخفاء الشريط الحكومي --- */
@media print {
    .govbh-skip-link { display: none !important; }
}

/* --- روابط السياسات الإلزامية في التذييل --- */
.footer-policies {
    list-style: none; margin: 0 0 12px; padding: 0 0 12px;
    border-bottom: 1px solid var(--bh-border-tertiary);
    display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 20px;
    font-size: 13px;
}
.footer-policies a { color: var(--bh-brand); text-decoration: underline; font-weight: 500; }
.footer-policies a:hover { color: var(--bh-accent); }
@media print { .footer-policies { display: none !important; } }

/* --- ترتيب الترويسة على الشاشات الصغيرة مع مبدّل العام الدراسي --- */
@media (max-width: 640px) {
    .top-header { padding: 0 10px; gap: 6px; }
    .header-left { gap: 8px; min-width: 0; }
    .top-header .page-title {
        font-size: 15px; white-space: nowrap;
        overflow: hidden; text-overflow: ellipsis; max-width: 34vw;
    }
    .header-right { gap: 6px; }
    .year-switcher-select { min-width: 0; max-width: 34vw; font-size: 11px; padding: .3rem .4rem; }
    .user-dropdown-trigger { padding: 4px; }
}

/* ============================================================================
   تحديث واجهة صفحات التحكم الداخلية (UI/UX Refresh)
   الهدف: كثافة معلومات أفضل، حقول مقروءة، رؤوس صفحات موحّدة وأخف،
   وبطاقات وجداول مطابقة لنظام التصميم الحكومي البحريني.
   ============================================================================ */

/* ---------- 1) عرض المحتوى: منع التمدد على الشاشات العريضة ---------- */
.content-container {
    max-width: 1320px;
    margin-inline: auto;
    padding: 20px 24px 40px;
}
@media (max-width: 768px) { .content-container { padding: 14px 14px 28px; } }

/* ---------- 2) رؤوس الصفحات: نسخة مدمجة موحّدة ---------- */
/* الترويسة العلوية تعرض اسم الصفحة أصلاً، فلا داعي لكتلة ملوّنة ضخمة تكرره */
.page-header-modern {
    background: var(--content-bg);
    border: 1px solid var(--border-color);
    border-inline-start: 4px solid var(--bh-brand);
    border-radius: var(--bh-border-radius-s);
    box-shadow: none;
    color: var(--text-primary);
    padding: 16px 20px;
    margin-bottom: 18px;
}
.page-header-modern .page-header-content {
    display: flex; align-items: flex-start; justify-content: space-between;
    gap: 16px; flex-wrap: wrap;
}
.page-header-modern .page-title {
    color: var(--bh-brand); font-size: 20px; font-weight: 700;
    display: flex; align-items: center; gap: 10px; margin: 0;
}
.page-header-modern .page-title svg { width: 22px; height: 22px; }
.page-header-modern .page-subtitle {
    color: var(--text-secondary); font-size: 13px; line-height: 1.7; margin: 4px 0 0;
}
.page-header-modern .breadcrumb-modern {
    display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
    font-size: 12px; color: var(--text-muted); margin-bottom: 6px;
}
.page-header-modern .breadcrumb-modern a { color: var(--bh-brand); text-decoration: none; }
.page-header-modern .breadcrumb-modern a:hover { text-decoration: underline; }
.page-header-modern .breadcrumb-modern svg { width: 12px; height: 12px; opacity: .6; }
.page-header-modern .page-header-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* شريط الإحصائيات السريعة داخل رأس الصفحة */
.page-header-modern .page-stats {
    display: flex; flex-wrap: wrap; gap: 10px;
    margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--border-color);
}
.page-header-modern .page-stat-item {
    display: flex; align-items: center; gap: 10px;
    background: var(--bh-bg-secondary); border: 1px solid var(--border-color);
    border-radius: var(--bh-border-radius-xs); padding: 8px 14px;
}
.page-header-modern .page-stat-item .stat-icon {
    width: 30px; height: 30px; border-radius: var(--bh-border-radius-xs);
    display: grid; place-items: center; color: #fff; background: var(--bh-brand); flex-shrink: 0;
}
.page-header-modern .page-stat-item .stat-icon.green { background: var(--bh-success); }
.page-header-modern .page-stat-item .stat-icon.orange { background: var(--bh-warning); }
.page-header-modern .page-stat-item .stat-icon.purple { background: var(--bh-brand); }
.page-header-modern .page-stat-item .stat-number {
    font-size: 17px; font-weight: 700; color: var(--text-primary); display: block; line-height: 1.2;
}
.page-header-modern .page-stat-item .stat-text { font-size: 12px; color: var(--text-secondary); }

/* رأس الصفحة البسيط */
.page-header {
    margin-bottom: 18px; padding-bottom: 12px;
    border-bottom: 2px solid var(--bh-brand);
    gap: 12px; flex-wrap: wrap;
}
.page-header .page-title { color: var(--bh-brand); font-size: 20px; font-weight: 700; }

/* ---------- 3) البطاقات ---------- */
.card {
    background: var(--content-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--bh-border-radius-s);
    box-shadow: 0 1px 2px rgba(0, 0, 0, .04);
    margin-bottom: 18px;
}
.card-header {
    padding: 14px 18px; margin: 0;
    border-bottom: 1px solid var(--border-color);
    background: var(--bh-bg-secondary);
    border-radius: var(--bh-border-radius-s) var(--bh-border-radius-s) 0 0;
    display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
}
.card-header .card-title { font-size: 16px; font-weight: 700; color: var(--bh-brand); margin: 0; }
.card-body { padding: 18px; }
/* حشوة معتدلة لأبناء البطاقة المباشرين (كانت 32px على كل جهة لكل عنصر) */
.card > :not(.card-header):not(.card-body):not(.table-responsive) { padding: 0 18px; }
.card > :not(.card-header):not(.card-body):not(.table-responsive):first-child { padding-top: 16px; }
.card > :not(.card-header):not(.card-body):not(.table-responsive):last-child { padding-bottom: 16px; }
.card > .card-body { padding: 18px; }

/* ---------- 4) أقسام النماذج ---------- */
.form-section {
    background: var(--content-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--bh-border-radius-s);
    box-shadow: none;
    padding: 18px 20px 6px;
    margin-bottom: 16px;
}
.form-section::before { display: none !important; }
.form-section-title {
    display: flex; align-items: center; gap: 10px;
    font-size: 15px; font-weight: 700; color: var(--bh-brand);
    margin: 0 0 16px; padding-bottom: 10px;
    border-bottom: 1px solid var(--border-color);
}
.form-section-title::before { display: none !important; }
.add-activity-page .form-section:focus-within {
    box-shadow: none; border-color: var(--bh-brand);
}
.add-activity-page .section-svg {
    background: var(--bh-bg-light-brand); color: var(--bh-brand);
    border-radius: var(--bh-border-radius-xs);
}

/* ---------- 5) الحقول: مواصفات نظام التصميم الحكومي ---------- */
.form-group { margin-bottom: 14px; }
.form-label {
    display: block; margin-bottom: 6px;
    font-size: 13px; font-weight: 600; color: var(--text-secondary); letter-spacing: 0;
}
.form-label .text-cinnabar, .text-cinnabar { color: var(--bh-error-star); }

.form-control,
select.form-control,
textarea.form-control {
    width: 100%;
    min-height: 46px;
    padding: 10px 14px;
    border: 1px solid var(--bh-border-primary);
    border-radius: var(--bh-border-radius-xs);
    background-color: var(--content-bg);
    color: var(--text-secondary);
    font-family: var(--bh-ff-primary);
    font-size: 15px;
    line-height: 1.5;
    text-align: start;
    transition: border-color .2s ease, box-shadow .2s ease;
}
textarea.form-control { min-height: 110px; padding: 12px 14px; }
.form-control::placeholder { color: rgba(51, 51, 51, .5); text-align: start; }
.form-control:hover { border-color: var(--bh-brand); }
.form-control:focus,
.form-control:focus-visible {
    border-color: var(--bh-brand);
    box-shadow: 0 0 0 3px var(--bh-focus);
    outline: none;
}
.form-control[readonly] { background: var(--bh-bg-secondary); color: var(--text-muted); }
.form-control[readonly]:hover { border-color: var(--bh-border-primary); }
select.form-control { cursor: pointer; padding-inline-end: 34px; }
small.text-secondary, .form-group small { display: block; margin-top: 5px; font-size: 12px; line-height: 1.6; }

/* شبكات النماذج: تلتف على الشاشات الضيقة بدل الانضغاط */
.form-row { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px; margin-bottom: 0; }
.form-row-three { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; margin-bottom: 0; }
.form-row-four { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; margin-bottom: 0; }

/* ---------- 6) الأزرار: مواصفات نظام التصميم الحكومي ---------- */
.btn {
    padding: 11px 18px;
    border-radius: var(--bh-border-radius-xs);
    font-family: var(--bh-ff-primary);
    font-size: 14px; font-weight: 700; line-height: 1.2;
    border: 1px solid transparent;
    transition: background-color .2s ease, border-color .2s ease, color .2s ease;
}
.btn-sm { padding: 7px 12px; font-size: 12.5px; }
.btn-lg { padding: 13px 22px; font-size: 15px; }
.btn-primary { background-color: var(--bh-brand); border-color: var(--bh-brand); color: #fff; }
.btn-primary:hover { background-color: var(--bh-accent); border-color: var(--bh-accent); color: #fff; }
.btn-secondary {
    background-color: var(--content-bg); border-color: var(--bh-border-primary); color: var(--text-secondary);
}
.btn-secondary:hover { background-color: var(--bh-bg-secondary); border-color: var(--bh-brand); color: var(--bh-brand); }
.btn-danger { background-color: var(--bh-failure); border-color: var(--bh-failure); color: #fff; }
.btn-danger:hover { background-color: var(--bh-failure-content); border-color: var(--bh-failure-content); }
.btn-success { background-color: var(--bh-success); border-color: var(--bh-success); color: #fff; }
.btn-success:hover { background-color: var(--bh-success-content); border-color: var(--bh-success-content); }
.btn-outline-primary { background: transparent; border-color: var(--bh-brand); color: var(--bh-brand); }
.btn-outline-primary:hover { background: var(--bh-brand); color: #fff; }

/* ---------- 7) الجداول: أكثف وأوضح ---------- */
.table-responsive {
    overflow-x: auto;
    border-radius: 0 0 var(--bh-border-radius-s) var(--bh-border-radius-s);
}
.table { font-size: 13.5px; }
.table th {
    position: sticky; top: 0; z-index: 2;
    background: var(--bh-bg-light-brand);
    padding: 11px 14px;
    font-size: 12.5px; font-weight: 700; color: var(--bh-brand);
    border-bottom: 1px solid var(--bh-border-secondary);
}
.table td { padding: 10px 14px; vertical-align: middle; }
.table tbody tr:nth-child(even) { background: rgba(1, 46, 93, .02); }
.table tbody tr:hover { background: var(--bh-bg-light-brand); }
.table tbody tr:last-child td { border-bottom: 0; }
.actions-grid { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; padding: 0; }

/* ---------- 8) الشارات ---------- */
.badge {
    display: inline-flex; align-items: center;
    padding: 3px 10px; border-radius: 999px;
    font-size: 11.5px; font-weight: 700; line-height: 1.6; white-space: nowrap;
    background: var(--bh-brand); color: #fff;
}
.badge-success { background: var(--bh-success-off); color: var(--bh-success-content); }
.badge-warning { background: var(--bh-warning-off); color: var(--bh-warning-content); }
.badge-admin { background: var(--bh-brand); color: #fff; }
.badge-info { background: var(--bh-info-off); color: var(--bh-info-content); }
.badge-teacher { background: var(--bh-success-off); color: var(--bh-success-content); }
.badge-user { background: var(--bh-bg-light-grey); color: var(--text-secondary); }

/* ---------- 9) التنبيهات ---------- */
.alert {
    display: flex; align-items: flex-start; gap: 10px;
    padding: 12px 16px; margin-bottom: 16px;
    border-radius: var(--bh-border-radius-xs);
    border: 0; border-inline-start: 4px solid;
    font-size: 14px; line-height: 1.7;
}
.alert-success { background: var(--bh-success-off); border-color: var(--bh-success); color: var(--bh-success-content); }
.alert-error   { background: var(--bh-failure-off); border-color: var(--bh-failure); color: var(--bh-failure-content); }
.alert-info    { background: var(--bh-info-off); border-color: var(--bh-info); color: var(--bh-info-content); }

/* ---------- 10) أشرطة الفلترة ---------- */
.filter-section-modern, .filter-card {
    border: 1px solid var(--border-color);
    border-radius: var(--bh-border-radius-s);
    background: var(--content-bg);
    box-shadow: none;
    margin-bottom: 18px;
}
.filter-toggle-bar { padding: 12px 18px; }
.filter-grid-modern, .filter-grid {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px;
}
.filter-form-modern input, .filter-form-modern select,
.filter-form input, .filter-form select {
    width: 100%; min-height: 42px; padding: 8px 12px;
    border: 1px solid var(--bh-border-primary); border-radius: var(--bh-border-radius-xs);
    font-family: var(--bh-ff-primary); font-size: 14px; background: var(--content-bg);
}
.filter-form-modern input:focus, .filter-form-modern select:focus,
.filter-form input:focus, .filter-form select:focus {
    border-color: var(--bh-brand); box-shadow: 0 0 0 3px var(--bh-focus); outline: none;
}

/* ---------- 11) شريط الحفظ الثابت أسفل النماذج ---------- */
.form-actions-bar {
    background: var(--content-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--bh-border-radius-s);
    box-shadow: 0 -2px 10px rgba(0, 0, 0, .05);
    padding: 12px 18px;
}

/* ---------- 12) الحالة الفارغة ---------- */
.empty-state-modern, .empty-state {
    background: var(--content-bg); border: 1px dashed var(--bh-border-secondary);
    border-radius: var(--bh-border-radius-s); padding: 40px 20px; text-align: center;
}
.empty-state-modern .empty-icon svg, .empty-state svg { color: var(--bh-border-secondary); }
.empty-state-modern h3, .empty-state .empty-title { color: var(--text-primary); font-size: 17px; margin: 12px 0 6px; }
.empty-state-modern p, .empty-state .empty-text { color: var(--text-secondary); font-size: 14px; margin-bottom: 16px; }

/* توحيد حجم الحقول المضغوطة مع بقية النظام */
.form-control.compact,
select.form-control.compact,
textarea.form-control.compact {
    min-height: 46px; padding: 10px 14px; font-size: 15px;
}
textarea.form-control.compact { min-height: 110px; }
@media (max-width: 640px) {
    .form-control, .form-control.compact,
    select.form-control, select.form-control.compact,
    textarea.form-control, textarea.form-control.compact {
        min-height: 44px; font-size: 14px; padding: 9px 12px;
    }
    textarea.form-control, textarea.form-control.compact { min-height: 100px; }
}

/* رأس شريط الفلترة: يلتف على الشاشات الصغيرة بدل التداخل */
.filter-header {
    display: flex; align-items: center; justify-content: space-between;
    gap: 10px; flex-wrap: wrap; width: 100%;
}
.filter-header .card-title { margin: 0; }
.filter-header .table-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* --- مبدّل المدرسة للمدير العام --- */
.school-switcher { display: flex; align-items: center; gap: .5rem; }
.school-switcher .school-select {
    max-width: 240px; border-color: var(--bh-accent); color: var(--bh-accent);
    font-weight: 700;
}
@media (max-width: 900px) { .school-switcher .school-select { max-width: 130px; font-size: 11px; } }
@media (max-width: 640px) { .school-switcher .year-switcher-label { display: none; } }
.report-school { font-size: 14px; font-weight: 700; color: var(--bh-brand); margin-top: 2px; }

/* تقليل الفراغ داخل بطاقات صفحة عرض الفعالية */
.grid-2-1 > div > .card { margin-bottom: 16px !important; }
.grid-2-1 .card > h4 { margin-bottom: 10px !important; font-size: 15px; }
.side-info-item { padding: 8px 0; }
.side-info-item strong { margin-bottom: 2px; font-size: 12.5px; }
.quick-stat-item { padding: 12px; margin-bottom: 10px; }
.quick-stats > .quick-stat-item:last-child { margin-bottom: 0; }
.info-section { margin-bottom: 18px; }
.info-item { padding: 10px 12px; }
.info-item strong { margin-bottom: 2px; font-size: 12.5px; }
.description-box { padding: 14px 16px; }
.objective-card { padding: 14px 16px; margin-bottom: 12px; }

/* ===== تخطيط صفحة عرض الفعالية: عمود محتوى + عمود جانبي ===== */
/* الفئة .grid-2-1 لم تكن معرّفة إطلاقاً، فكان كل شيء يتمدد بعرض الصفحة كاملاً */
.grid-2-1 {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(300px, 1fr);
    gap: 18px;
    align-items: start;
}
@media (max-width: 1100px) { .grid-2-1 { grid-template-columns: 1fr; } }

/* صفوف المعلومات الجانبية: التسمية والقيمة في سطر واحد بدل سطرين ممتدين */
.side-info-item {
    display: flex; align-items: baseline; justify-content: space-between;
    gap: 12px; padding: 7px 0;
}
.side-info-item strong { display: inline; margin: 0; flex-shrink: 0; }
.side-info-item span { text-align: end; word-break: break-word; }

/* الإحصائيات السريعة جنباً إلى جنب */
.quick-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }
.quick-stat-item { margin-bottom: 0; }

/* الإجراءات السريعة تلتف بدل عمود طويل */
.quick-actions { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 8px; }
.quick-actions a { margin: 0 !important; width: auto !important; }

/* شريط الملخص أعلى الصفحة أكثف */
.meta-bar { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 8px; margin-bottom: 14px; }
.meta-item { padding: 8px 10px; }

/* معرض الصور في العمود الجانبي */
.thumbs { grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); gap: 6px; }
.thumbs .thumb { height: 64px; }

/* ============================================================================
   لوحة التحكم المطوّرة
   ============================================================================ */
.text-muted-inline { color: var(--text-muted); font-size: 12px; margin-inline-start: 8px; }

/* المؤشرات الرئيسية */
.dash-kpis {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px; margin-bottom: 16px;
}
@media (min-width: 1200px) { .dash-kpis { grid-template-columns: repeat(6, minmax(0, 1fr)); } }
@media (min-width: 1200px) { .dash-kpis:has(> :nth-child(7)) { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.kpi-card {
    display: flex; align-items: center; gap: 12px;
    background: var(--content-bg); border: 1px solid var(--border-color);
    border-radius: var(--bh-border-radius-s); padding: 12px 12px;
    text-decoration: none; color: inherit; min-width: 0;
    transition: border-color .15s ease, box-shadow .15s ease;
}
a.kpi-card:hover { border-color: var(--bh-brand); box-shadow: 0 2px 8px rgba(1, 46, 93, .08); }
.kpi-icon {
    width: 36px; height: 36px; border-radius: var(--bh-border-radius-xs); flex-shrink: 0;
    display: grid; place-items: center; color: #fff;
}
.kpi-icon.navy { background: var(--bh-brand); }
.kpi-icon.teal { background: var(--bh-inverse-brand); }
.kpi-icon.orange { background: var(--bh-warning); }
.kpi-icon.green { background: var(--bh-success); }
.kpi-icon.red { background: var(--bh-accent); }
.kpi-body { display: flex; flex-direction: column; min-width: 0; }
.kpi-value { font-size: 22px; font-weight: 700; color: var(--text-primary); line-height: 1.1; font-variant-numeric: tabular-nums; }
.kpi-value .kpi-of { font-size: 13px; font-weight: 600; color: var(--text-muted); margin-inline-start: 4px; }
.kpi-label { font-size: 12.5px; color: var(--text-secondary); margin-top: 3px; line-height: 1.5; }
.kpi-label small { display: block; color: var(--text-muted); font-size: 11.5px; }
.kpi-mine { border-inline-start: 3px solid var(--bh-success); }

/* صفوف اللوحة */
.dash-row { display: grid; gap: 16px; margin-bottom: 16px; align-items: stretch; }
.dash-row-2-1 { grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr); }
.dash-row-1-1 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 1000px) { .dash-row-2-1, .dash-row-1-1 { grid-template-columns: 1fr; } }

.dashboard-card { margin-bottom: 16px; border-radius: var(--bh-border-radius-s); box-shadow: 0 1px 2px rgba(0,0,0,.04); }
.dash-row .dashboard-card { margin-bottom: 0; }
.card-header-modern {
    padding: 12px 16px; border-bottom: 1px solid var(--border-color);
    background: var(--bh-bg-secondary);
    display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap;
}
.card-header-modern h3 { font-size: 15px; font-weight: 700; color: var(--bh-brand); margin: 0; }
.card-header-modern .card-icon { color: var(--bh-brand); }
.card-title-group { display: flex; align-items: center; gap: 8px; }
.card-action-link { font-size: 12.5px; color: var(--bh-brand); text-decoration: none; font-weight: 600; }
.card-action-link:hover { text-decoration: underline; color: var(--bh-accent); }
.card-hint { font-size: 12px; color: var(--text-secondary); background: var(--content-bg); border: 1px solid var(--border-color); border-radius: 999px; padding: 2px 10px; }
.card-body-modern { padding: 16px; }
.dash-note { margin: 10px 0 0; font-size: 12px; color: var(--bh-warning-content); }

/* مخطط الأشهر */
.months-chart {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(48px, 1fr));
    gap: 6px; height: 200px; align-items: end;
}
.month-col {
    display: flex; flex-direction: column; align-items: center; justify-content: flex-end;
    height: 100%; text-decoration: none; color: inherit; min-width: 0;
}
.month-value { font-size: 12px; font-weight: 700; color: var(--bh-brand); height: 18px; line-height: 18px; font-variant-numeric: tabular-nums; }
.month-bar-track { flex: 1; width: 100%; display: flex; align-items: flex-end; justify-content: center; border-bottom: 1px solid var(--border-color); }
.month-bar {
    width: 70%; max-width: 36px; background: var(--bh-brand); border-radius: 3px 3px 0 0;
    transition: background .15s ease;
}
.month-col:hover .month-bar { background: var(--bh-accent); }
.month-col.is-zero .month-bar-track::after { content: ''; width: 70%; max-width: 36px; height: 3px; background: var(--bh-border-secondary); border-radius: 2px; margin-bottom: 0; }
.month-label { font-size: 11px; color: var(--text-secondary); margin-top: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }

/* حسب النوع */
.type-split { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.type-donut {
    --internal: 0;
    width: 120px; height: 120px; border-radius: 50%; flex-shrink: 0;
    background: conic-gradient(var(--bh-brand) 0 calc(var(--internal) * 1%), var(--bh-warning) 0);
    display: grid; place-items: center; position: relative;
}
.type-donut::before { content: ''; position: absolute; inset: 16px; background: var(--content-bg); border-radius: 50%; }
.type-donut span { position: relative; font-size: 20px; font-weight: 700; color: var(--bh-brand); text-align: center; line-height: 1.1; }
.type-donut span small { display: block; font-size: 11px; font-weight: 500; color: var(--text-secondary); }
.type-legend { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; flex: 1; min-width: 140px; }
.type-legend li { display: flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--text-secondary); }
.type-legend li strong { margin-inline-start: auto; color: var(--text-primary); font-variant-numeric: tabular-nums; }
.type-legend .dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.type-participants { margin-top: 14px; padding-top: 12px; border-top: 1px dashed var(--border-color); display: flex; flex-direction: column; gap: 6px; }
.type-participants div { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--text-secondary); }
.type-participants strong { color: var(--text-primary); font-variant-numeric: tabular-nums; }

/* تغطية الأهداف */
.coverage-list { display: flex; flex-direction: column; gap: 6px; }
.coverage-row {
    display: grid; grid-template-columns: 34px minmax(0, 1fr) minmax(120px, 220px) 80px auto;
    align-items: center; gap: 12px;
    padding: 9px 12px; border: 1px solid var(--border-color); border-radius: var(--bh-border-radius-xs);
    text-decoration: none; color: inherit; transition: background .15s ease, border-color .15s ease;
}
.coverage-row:hover { background: var(--bh-bg-light-brand); border-color: var(--bh-brand); }
.coverage-row.is-empty { background: var(--bh-warning-off); border-color: rgba(255, 131, 0, .35); }
.coverage-num { width: 34px; height: 28px; display: grid; place-items: center; background: var(--bh-brand); color: #fff; font-weight: 700; font-size: 12.5px; border-radius: var(--bh-border-radius-xs); }
.coverage-row.is-empty .coverage-num { background: var(--bh-warning); }
.coverage-title { font-size: 13.5px; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.coverage-bar-track { height: 8px; background: var(--bh-bg-light-grey); border-radius: 999px; overflow: hidden; }
.coverage-bar { height: 100%; background: var(--bh-brand); border-radius: 999px; }
.coverage-count { font-weight: 700; color: var(--text-primary); font-size: 14px; text-align: start; font-variant-numeric: tabular-nums; white-space: nowrap; }
.coverage-count small { font-weight: 500; color: var(--text-muted); font-size: 11.5px; }
@media (max-width: 760px) {
    .coverage-row { grid-template-columns: 34px minmax(0, 1fr) 70px; }
    .coverage-bar-track, .coverage-row .badge { display: none; }
    .coverage-title { white-space: normal; }
}

/* قوائم */
.dash-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.dash-list li { padding: 9px 0; border-bottom: 1px solid var(--bh-border-tertiary); }
.dash-list li:last-child { border-bottom: 0; padding-bottom: 0; }
.dash-list li:first-child { padding-top: 0; }
.dash-list-title { display: block; font-size: 14px; font-weight: 600; color: var(--text-primary); text-decoration: none; margin-bottom: 4px; }
.dash-list-title:hover { color: var(--bh-brand); }
.dash-list-meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 12px; color: var(--text-secondary); }

/* المعلمون */
.teacher-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.teacher-list li { display: grid; grid-template-columns: 26px minmax(0, 1fr) minmax(80px, 140px) 76px; align-items: center; gap: 10px; }
.teacher-rank { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 700; background: var(--bh-bg-light-grey); color: var(--text-secondary); }
.teacher-rank.rank-1 { background: #f5c518; color: #4a3800; }
.teacher-rank.rank-2 { background: #c0c0c0; color: #333; }
.teacher-rank.rank-3 { background: #cd7f32; color: #fff; }
.teacher-name { font-size: 13.5px; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.teacher-bar-track { height: 8px; background: var(--bh-bg-light-grey); border-radius: 999px; overflow: hidden; }
.teacher-bar { height: 100%; background: var(--bh-success); border-radius: 999px; }
.teacher-count { font-weight: 700; font-size: 13.5px; color: var(--text-primary); font-variant-numeric: tabular-nums; white-space: nowrap; }
.teacher-count small { font-weight: 500; color: var(--text-muted); font-size: 11px; }

/* القادمة */
.upcoming-strip { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.upcoming-chip {
    display: flex; align-items: center; gap: 10px; padding: 10px 12px;
    border: 1px solid var(--border-color); border-radius: var(--bh-border-radius-xs);
    text-decoration: none; color: inherit;
}
.upcoming-chip:hover { border-color: var(--bh-brand); background: var(--bh-bg-light-brand); }
.chip-date { display: flex; flex-direction: column; align-items: center; min-width: 46px; padding: 4px 6px; background: var(--bh-brand); color: #fff; border-radius: var(--bh-border-radius-xs); font-size: 10.5px; line-height: 1.2; }
.chip-date strong { font-size: 17px; }
.chip-body { display: flex; flex-direction: column; min-width: 0; }
.chip-title { font-size: 13px; font-weight: 600; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chip-sub { font-size: 11.5px; color: var(--text-secondary); }

/* مخطط الأشهر على الشاشات الضيقة: تمرير أفقي بدل التفاف الأعمدة على سطرين */
@media (max-width: 640px) {
    .months-chart { grid-template-columns: repeat(10, 44px); overflow-x: auto; padding-bottom: 6px; justify-content: start; }
    .month-label { font-size: 10px; }
}

/* ============================================================================
   صفحة التقارير المطوّرة
   ============================================================================ */
.report-filters { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; align-items: end; }
.report-filters .form-group { margin: 0; }
.report-filters .form-control { min-height: 40px; padding: 7px 10px; font-size: 13.5px; }
.report-filters .form-label { font-size: 12px; margin-bottom: 4px; }
.report-filters-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 10px; }
.report-scope { font-size: 12.5px; color: var(--text-secondary); }
.report-scope strong { color: var(--bh-brand); }

.report-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 16px; }
@media (min-width: 1200px) { .report-kpis { grid-template-columns: repeat(6, minmax(0, 1fr)); } }

.report-grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-bottom: 16px; }
@media (max-width: 1000px) { .report-grid-2 { grid-template-columns: 1fr; } }
.report-grid-2 > .dashboard-card { margin-bottom: 0; }

.rtable { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.rtable th { background: var(--bh-bg-light-brand); color: var(--bh-brand); font-weight: 700; font-size: 12.5px; padding: 9px 12px; text-align: start; border-bottom: 1px solid var(--bh-border-secondary); white-space: nowrap; }
.rtable td { padding: 8px 12px; border-bottom: 1px solid var(--bh-border-tertiary); vertical-align: middle; }
.rtable tbody tr:last-child td { border-bottom: 0; }
.rtable tbody tr:hover { background: var(--bh-bg-secondary); }
.rtable .num { text-align: center; font-variant-numeric: tabular-nums; font-weight: 700; white-space: nowrap; }
.rtable .bar-cell { width: 34%; min-width: 120px; }
.rtable .bar-track { height: 8px; background: var(--bh-bg-light-grey); border-radius: 999px; overflow: hidden; }
.rtable .bar-fill { height: 100%; background: var(--bh-brand); border-radius: 999px; }
.rtable .bar-fill.green { background: var(--bh-success); }
.rtable .bar-fill.orange { background: var(--bh-warning); }
.rtable tr.is-empty td { background: var(--bh-warning-off); }
.rtable .muted { color: var(--text-muted); font-size: 12px; }
.rtable tfoot td { border-top: 2px solid var(--bh-border-secondary); font-weight: 700; background: var(--bh-bg-secondary); }

.spec-group { border: 1px solid var(--border-color); border-radius: var(--bh-border-radius-xs); margin-bottom: 8px; overflow: hidden; }
.spec-group > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 10px; padding: 10px 12px; background: var(--bh-bg-secondary); font-size: 13.5px; }
.spec-group > summary::-webkit-details-marker { display: none; }
.spec-group > summary .g-num { min-width: 30px; height: 26px; display: grid; place-items: center; background: var(--bh-brand); color: #fff; font-weight: 700; font-size: 12px; border-radius: var(--bh-border-radius-xs); }
.spec-group > summary .g-title { flex: 1; font-weight: 600; color: var(--text-primary); }
.spec-group > summary .g-count { font-weight: 700; color: var(--bh-brand); white-space: nowrap; }
.spec-group > summary .g-caret { transition: transform .2s ease; color: var(--text-muted); }
.spec-group[open] > summary .g-caret { transform: rotate(180deg); }
.spec-group .rtable th { background: transparent; }

.zero-teachers { margin-top: 10px; font-size: 13px; }
.zero-teachers summary { cursor: pointer; color: var(--bh-warning-content); font-weight: 600; }
.zero-teachers ul { margin: 8px 0 0; padding: 0; list-style: none; display: flex; flex-wrap: wrap; gap: 6px; }
.zero-teachers li { background: var(--bh-warning-off); color: var(--bh-warning-content); border-radius: 999px; padding: 2px 10px; font-size: 12px; }

.echart { width: 100%; height: var(--echart-height, 280px); }
.echart-print { display: none; }
.chart-legend-text { margin-top: 8px; font-size: 12.5px; line-height: 1.8; color: var(--text-secondary); }
.chart-legend-text .legend-line { padding: 1px 6px; border-radius: 4px; }
.chart-legend-text .legend-line.active { background: var(--bh-bg-light-brand); }
.specific-mode-toolbar { display: flex; gap: 6px; margin-bottom: 8px; }
.specific-mode-toolbar .btn.active { background: var(--bh-brand); color: #fff; border-color: var(--bh-brand); }

/* رأس الطباعة للتقرير */
.report-print-head { display: none; }

@media print {
    @page { size: A4 portrait; margin: 12mm; }
    body { background: #fff !important; }
    .sidebar-modern, .top-header, .nav-toggle, .no-print, .footer, .page-header-modern .page-header-actions, .report-filters-card, .year-archive-banner { display: none !important; }
    .main-content { padding: 0 !important; }
    .content-container { max-width: none; padding: 0 !important; }
    .report-print-head { display: flex !important; align-items: center; justify-content: space-between; gap: 12px; border-bottom: 2px solid #012E5D; padding-bottom: 8px; margin-bottom: 12px; }
    .report-print-head img { height: 48px; width: auto; }
    .report-print-head .ph-title { font-size: 16px; font-weight: 700; color: #012E5D; }
    .report-print-head .ph-meta { font-size: 11.5px; color: #333; line-height: 1.6; }
    .page-header-modern { border: 0 !important; padding: 0 !important; margin-bottom: 8px !important; }
    .report-kpis { grid-template-columns: repeat(6, 1fr) !important; gap: 6px !important; }
    .kpi-card { padding: 8px !important; break-inside: avoid; }
    .kpi-value { font-size: 18px !important; }
    .kpi-label { font-size: 11px !important; }
    .kpi-icon { display: none !important; }
    .dashboard-card, .rtable tr, .spec-group { break-inside: avoid; page-break-inside: avoid; }
    .report-grid-2 { grid-template-columns: repeat(2, 1fr) !important; }
    .card-header-modern { background: #F1F1F1 !important; }
    .rtable { font-size: 12px; }
    .rtable th, .rtable td { padding: 5px 8px; }
    .spec-group { break-inside: auto; }
    .spec-group[open] > summary .g-caret, .spec-group .g-caret { display: none; }
    .spec-group:not([open]) > .spec-body { display: block !important; }
    /* الرسوم والأشرطة الملوّنة تُطبع بألوانها حتى لو عُطّلت "طباعة الخلفيات" في المتصفح */
    *, *::before, *::after { -webkit-print-color-adjust: exact !important; print-color-adjust: exact !important; color-adjust: exact !important; }
    .echart { display: none !important; }
    .echart-print { display: block !important; width: 100%; max-height: 270px; object-fit: contain; margin: 0 auto; }
    .months-chart { height: 160px !important; }
    .chart-legend-text { font-size: 11px; }
    a { color: inherit !important; text-decoration: none !important; }
}

/* ===== النوافذ المنبثقة: مطابقة الهوية الحكومية ===== */
.modal-container { border-radius: var(--bh-border-radius-s); box-shadow: 0 20px 50px rgba(0,0,0,.18); }
.modal-header { background: var(--bh-brand); padding: 14px 20px; }
.modal-header::before { display: none; }
.modal-header .modal-title { font-size: 16px; font-weight: 700; margin: 0; letter-spacing: 0; }
.modal-header .modal-title::before { display: none; }
.modal-close { width: 32px; height: 32px; border-radius: var(--bh-border-radius-xs); background: rgba(255,255,255,.15); color: #fff; border: 0; font-size: 20px; line-height: 1; cursor: pointer; }
.modal-close:hover { background: rgba(255,255,255,.28); transform: none; }
.modal-body { padding: 18px 20px; }
.modal-body .form-group { margin-bottom: 14px; }
.modal-body .form-group:last-child { margin-bottom: 0; }
.modal-body label { display: block; font-size: 13px; font-weight: 600; color: var(--text-secondary); margin-bottom: 6px; }
.modal-body input[type="text"], .modal-body input[type="email"], .modal-body input[type="password"],
.modal-body input[type="number"], .modal-body input[type="date"], .modal-body input[type="file"],
.modal-body select, .modal-body textarea {
    width: 100%; min-height: 44px; padding: 9px 12px;
    border: 1px solid var(--bh-border-primary); border-radius: var(--bh-border-radius-xs);
    background: var(--content-bg); color: var(--text-secondary);
    font-family: var(--bh-ff-primary); font-size: 14.5px; line-height: 1.5; text-align: start;
    transition: border-color .2s ease, box-shadow .2s ease; box-sizing: border-box;
}
.modal-body textarea { min-height: 100px; resize: vertical; }
.modal-body input[type="file"] { padding: 8px 12px; cursor: pointer; }
.modal-body input:focus, .modal-body select:focus, .modal-body textarea:focus {
    outline: none; border-color: var(--bh-brand); box-shadow: 0 0 0 3px var(--bh-focus);
}
.modal-body input[type="checkbox"] { width: 18px; height: 18px; min-height: 0; margin-inline-end: 8px; vertical-align: middle; }
.modal-body .form-row { display: grid; grid-template-columns: 130px 1fr; gap: 12px; }
.modal-body .form-hint { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.modal-footer { background: var(--bh-bg-secondary); padding: 12px 20px; border-top: 1px solid var(--border-color); gap: 8px; }
@media (max-width: 520px) { .modal-body .form-row { grid-template-columns: 1fr; } }


/* ===== صفوف الأهداف المتعددة في نموذج إضافة فعالية ===== */
.objective-hint { font-size: .85rem; margin: 0 0 10px; }
.objective-rows { display: flex; flex-direction: column; gap: 10px; }
.objective-row { position: relative; padding: 12px 12px 4px; border: 1px solid var(--bh-border, #DDDDDD); border-radius: 8px; background: #FAFBFC; }
.objective-row::before { content: attr(data-index); position: absolute; top: -10px; inset-inline-start: 12px; background: var(--bh-brand, #012E5D); color: #fff; font-size: .72rem; font-weight: 700; min-width: 20px; height: 20px; line-height: 20px; text-align: center; border-radius: 10px; padding: 0 6px; }
.objective-specific-wrap { display: flex; gap: 8px; align-items: stretch; }
.objective-specific-wrap select { flex: 1 1 auto; min-width: 0; }
.objective-remove { flex: 0 0 auto; width: 46px; padding: 0; font-size: 1.25rem; line-height: 1; color: var(--bh-failure, #DC3545); }
.objective-remove[hidden] { display: none !important; }
.objective-actions { display: flex; align-items: center; gap: 12px; margin-top: 12px; }
.objective-actions #objectiveCountNote { font-size: .85rem; font-weight: 600; color: var(--bh-brand, #012E5D); }
@media print { .objective-actions, .objective-remove { display: none !important; } }

/* =====================================================================
   سجل العمليات، سلة المحذوفات، تقرير المعلمين
   ===================================================================== */
.rtable .small, .muted.small { font-size: 12px; }
.rtable .text-danger { color: var(--bh-accent); font-weight: 700; }

.trash-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.trash-actions form { margin: 0; }

.audit-badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; white-space: nowrap; background: #eef2f6; color: #012E5D; }
.audit-badge.audit-create  { background: rgba(59, 155, 111, .14); color: #2C7453; }
.audit-badge.audit-update  { background: rgba(52, 88, 125, .12); color: #012E5D; }
.audit-badge.audit-delete  { background: rgba(255, 131, 0, .15); color: #894701; }
.audit-badge.audit-restore { background: rgba(59, 155, 111, .14); color: #2C7453; }
.audit-badge.audit-purge   { background: rgba(198, 59, 43, .12); color: #B02A37; }
.audit-details { min-width: 220px; font-size: 13px; }
.audit-details summary { cursor: pointer; color: #012E5D; }
.audit-changes { margin: 6px 0 0; padding-inline-start: 18px; }
.audit-changes li { margin-bottom: 4px; line-height: 1.6; }
.audit-old { color: #B02A37; text-decoration: line-through; text-decoration-color: rgba(176, 42, 55, .4); }
.audit-new { color: #2C7453; }
.audit-pagination { display: flex; gap: 10px; align-items: center; justify-content: center; margin-top: 14px; }

.teacher-alert { border: 1px solid rgba(198, 59, 43, .3); background: rgba(198, 59, 43, .06); border-radius: 12px; padding: 12px 14px; margin-bottom: 16px; }
.teacher-alert-head { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; color: #B02A37; margin-bottom: 8px; }
.teacher-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.teacher-chip { background: #fff; border: 1px solid rgba(198, 59, 43, .25); border-radius: 999px; padding: 2px 10px; font-size: 13px; }
.teacher-tabs { display: flex; gap: 4px; flex-wrap: wrap; }
.teacher-tabs a { padding: 4px 12px; border-radius: 999px; font-size: 13px; text-decoration: none; color: #333; background: #f1f3f5; }
.teacher-tabs a.is-active { background: #012E5D; color: #fff; }
.status-pill { display: inline-block; padding: 1px 10px; border-radius: 999px; font-size: 12px; white-space: nowrap; }
.status-pill.active   { background: rgba(59, 155, 111, .14); color: #2C7453; }
.status-pill.inactive { background: rgba(255, 131, 0, .15); color: #894701; }
.status-pill.zero     { background: rgba(198, 59, 43, .12); color: #B02A37; }
.teacher-table tr.status-zero td { background: rgba(198, 59, 43, .03); }
.coverage-cell { display: flex; flex-direction: column; gap: 2px; min-width: 120px; }
@media print {
    .teacher-tabs, .teacher-alert-head a { display: none; }
    .teacher-table tr { break-inside: avoid; }
}
.teacher-table td:nth-child(2) { min-width: 170px; }
.audit-table td:nth-child(4) { min-width: 180px; }

/* =====================================================================
   القوائم الهجينة (combobox.js) وإعداد بنود الاستمارة
   ===================================================================== */
.cbx { position: relative; }
.cbx > .form-control { padding-inline-end: 2.2rem; }
.cbx-toggle { position: absolute; inset-inline-end: 6px; top: 50%; transform: translateY(-50%); background: none; border: 0; padding: 6px; color: var(--text-muted, #777); cursor: pointer; line-height: 0; }
.cbx.is-open .cbx-toggle svg { transform: rotate(180deg); }
.cbx-list { position: fixed; z-index: 9999; direction: rtl; text-align: right; margin: 0; padding: 4px; list-style: none; background: #fff; border: 1px solid var(--bh-border-secondary, #cbcbcb); border-radius: 10px; box-shadow: 0 10px 28px rgba(15, 23, 42, .12); max-height: 260px; overflow-y: auto; }
.cbx-list[hidden] { display: none; }
.cbx-list li { padding: 8px 10px; border-radius: 6px; cursor: pointer; font-size: 14px; line-height: 1.5; white-space: normal; overflow-wrap: anywhere; }
.cbx-list.cbx-floating { max-width: calc(100vw - 16px); min-width: 240px; }
.cbx-list li[role=option]:hover, .cbx-list li.is-active { background: rgba(1, 46, 93, .08); color: #012E5D; }
.cbx-list li.cbx-new { color: #2C7453; font-size: 13px; border-top: 1px dashed #ddd; margin-top: 2px; }
.cbx-list li.cbx-empty { color: #999; cursor: default; }
select.cbx-native { position: absolute !important; width: 1px !important; height: 1px !important; opacity: 0; pointer-events: none; overflow: hidden; }
.form-group { position: relative; }
.field-hint { display: block; margin-top: 4px; font-size: 12px; line-height: 1.6; }
@media (max-width: 640px) { .cbx-list li { padding: 11px 10px; font-size: 15px; } }

.form-fields-table td { vertical-align: middle; }
.form-fields-table input[type=text] { min-width: 180px; }
.form-fields-table input[type=checkbox] { width: 18px; height: 18px; }
.form-fields-table tr.is-locked td { background: rgba(1, 46, 93, .03); }
.form-fields-table .ff-up, .form-fields-table .ff-down { padding: 2px 8px; }
.cbx > .form-control.cbx-invalid { border-color: var(--bh-accent, #C63B2B); box-shadow: 0 0 0 3px rgba(198, 59, 43, .12); }

/* إدارة القوائم */
.lists-tabs { margin-bottom: 16px; }
.lists-inline-form { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; }
.lists-inline-form .form-control { flex: 1; min-width: 200px; }
.lists-radio { display: flex; align-items: center; gap: 6px; font-size: 14px; width: 100%; }
.similar-group { border: 1px solid var(--bh-border-tertiary, #e5e5e5); border-radius: 10px; padding: 10px 12px; margin-bottom: 10px; display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; }
.similar-values { display: flex; flex-wrap: wrap; gap: 6px; }
.similar-target { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.similar-target .form-control { min-width: 220px; }
.lists-search { max-width: 240px; }
.lists-table tr[hidden] { display: none; }
.lists-table tr.is-hidden-value td { opacity: .6; }
.lists-actions { display: flex; flex-wrap: wrap; gap: 4px; }
.merge-bar { position: sticky; top: 0; z-index: 5; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; background: #eef4fb; border: 1px solid #c9d8ea; border-radius: 10px; padding: 8px 12px; margin-bottom: 10px; }
.merge-bar[hidden] { display: none; }
.merge-bar .form-control { max-width: 280px; }
.lists-scope { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 14px; font-size: 13.5px; }
.lists-scope a { padding: 4px 12px; border-radius: 999px; text-decoration: none; color: #333; background: #f1f3f5; }
.lists-scope a.is-active { background: #012E5D; color: #fff; }

/* المرفقات والمسودة */
.attachment-list { list-style: none; margin: 6px 0 0; padding: 0; display: grid; gap: 4px; }
.attachment-item { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 13px; padding: 6px 10px; background: #f8fafc; border-radius: 8px; }
.attachment-item.is-too-big { color: #B02A37; background: rgba(198,59,43,.08); }
.attachment-list-lg .attachment-item { font-size: 14px; }
.attachment-item a { text-decoration: none; color: #012E5D; font-weight: 600; flex: 1; min-width: 0; overflow-wrap: anywhere; }
.draft-banner { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; background: rgba(255,131,0,.1) !important; color: #894701 !important; border-color: rgba(255,131,0,.35) !important; }
.draft-actions { display: flex; gap: 6px; }
.conflict-warn { margin-top: 6px; padding: 8px 10px; border-radius: 8px; background: rgba(255,131,0,.12); color: #894701; font-size: 13px; }
.conflict-warn[hidden] { display: none; }
.conflict-warn a { color: inherit; font-weight: 700; }
.plan-alerts { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.plan-alert { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 999px; text-decoration: none; font-size: 14px; border: 1px solid; }
.plan-alert b { font-size: 16px; }
.plan-alert.danger { background: rgba(198,59,43,.08); color: #B02A37; border-color: rgba(198,59,43,.3); }
.plan-alert.warn { background: rgba(255,131,0,.1); color: #894701; border-color: rgba(255,131,0,.35); }
.plan-alert.info { background: rgba(1,46,93,.06); color: #012E5D; border-color: rgba(1,46,93,.2); }

.btn-outline-danger { background: transparent; color: #B02A37; border: 1px solid rgba(198,59,43,.5); }
.btn-outline-danger:hover { background: rgba(198,59,43,.08); }

/* اعتماد الفعاليات */
.alert-warning { background: #FFF4E0; border: 1px solid #E0A93A; color: #7A4D00; }
.approval-banner { margin-bottom: 14px; }
.approval-badge { margin-inline-start: 6px; }

/* الطباعة الجماعية: تحديد الفعاليات */
.pick-act-label { display: inline-flex; align-items: center; margin-inline-start: auto; cursor: pointer; }
.pick-act-label input { width: 18px; height: 18px; accent-color: #012E5D; cursor: pointer; }
.activity-card-modern.is-picked { outline: 2px solid #012E5D; outline-offset: -2px; }
.pick-bar { position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%); z-index: 900; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; justify-content: center; background: #fff; border: 1px solid #cbd5e1; border-radius: 12px; padding: 10px 14px; box-shadow: 0 10px 30px rgba(15,23,42,.18); max-width: calc(100vw - 24px); }
.pick-bar[hidden] { display: none; }
@media print { .pick-bar, .pick-act-label { display: none !important; } }

/* جداول المعاينة الطويلة: تمرير أفقي على الجوال بدل عصر الأعمدة */
.table-responsive { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.rtable-wide { min-width: 820px; }

/* الجوال: خط 16px في الحقول يمنع تكبير الصفحة تلقائياً عند التركيز (سبب انزياح الصفحة أثناء الكتابة)،
   ومنع أي تمرير أفقي للصفحة كلها */
@media (max-width: 768px) {
    input, select, textarea, .form-control, .form-control.compact, .cbx-search-input { font-size: 16px !important; }
    html, body { max-width: 100%; overflow-x: clip; }
    .cbx > .form-control { text-overflow: ellipsis; }
}

/* إصلاح انزياح الصفحة على الجوال:
   overflow-x:hidden يبقى قابلاً للتمرير برمجياً، فكان المتصفح يزيح الحاوية كلها عند فتح لوحة المفاتيح نحو قائمة الحساب المخفية
   الممتدة خارج الشاشة ولا يعيدها. clip يمنع التمرير نهائياً، والقائمة المخفية لا تشغل مساحة */
.admin-layout { overflow-x: hidden; overflow-x: clip; }
.page-header-modern, .page-header-modern .page-title { overflow: clip !important; }
.user-dropdown:not(.open) .user-dropdown-menu { display: none; }
@media (max-width: 768px) {
    /* زر الحساب في يسار الشريط العلوي: القائمة تفتح نحو داخل الشاشة */
    .user-dropdown-menu { left: 0; right: auto; max-width: calc(100vw - 16px); }
}
