/* distribution.css — كل أنماط صفحة «دابەشکرنا وانان» */
@import url('../fonts/fonts.css');
@font-face {
    font-family: 'UniQAIDAR_Free_005';
    src: url('../fonts/UniQAIDAR_Free_005.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'UniQAIDAR Free 005';
    src: url('../fonts/UniQAIDAR_Free_005.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

:root {
    --bs-primary-rgb: 99, 102, 241;
    /* Soft Indigo */
    --bs-success-rgb: 16, 185, 129;
    /* Soft Emerald */
    --bs-warning-rgb: 245, 158, 11;
    /* Soft Amber */
    --bs-danger-rgb: 239, 68, 68;
    /* Soft Rose */
    --bs-info-rgb: 6, 182, 212;
    /* Soft Cyan */

    --bs-body-bg: #e5eaf2;
    /* Playful soft gray-blue backdrop */
    --bs-body-color: #1e293b;
    /* Charcoal text */
    --bs-card-bg: #ffffff;
    --bs-border-color: rgba(255, 255, 255, 0.5);
    --bs-table-striped-bg: #f8fafc;

    /* Claymorphism shadows */
    --clay-outer-shadow: 10px 10px 20px rgba(166, 180, 200, 0.45), -10px -10px 20px rgba(255, 255, 255, 0.95);
    --clay-inner-shadow: inset 4px 4px 8px rgba(255, 255, 255, 0.85), inset -4px -4px 8px rgba(166, 180, 200, 0.25);
    --clay-btn-shadow: 5px 5px 12px rgba(166, 180, 200, 0.5), -5px -5px 12px rgba(255, 255, 255, 0.95), inset 3px 3px 6px rgba(255, 255, 255, 0.9), inset -3px -3px 6px rgba(0, 0, 0, 0.08);
    --clay-btn-active: inset 3px 3px 6px rgba(0, 0, 0, 0.15), inset -3px -3px 6px rgba(255, 255, 255, 0.7);
    --clay-input-shadow: inset 3px 3px 6px rgba(166, 180, 200, 0.35), inset -3px -3px 6px rgba(255, 255, 255, 0.95);

    --card-border-radius: 2.5rem;
    --elem-border-radius: 1.25rem;
}

[data-bs-theme="dark"] {
    --bs-body-bg: #0b0f19;
    /* Ultimate Deep Dark Slate */
    --bs-body-color: #f8fafc;
    --bs-card-bg: #151f32;
    --bs-border-color: rgba(255, 255, 255, 0.03);
    --bs-table-striped-bg: #1a263c;

    /* Dark Claymorphism shadows */
    --clay-outer-shadow: 12px 12px 24px rgba(0, 0, 0, 0.55), -12px -12px 24px rgba(255, 255, 255, 0.02);
    --clay-inner-shadow: inset 4px 4px 8px rgba(255, 255, 255, 0.04), inset -4px -4px 8px rgba(0, 0, 0, 0.4);
    --clay-btn-shadow: 5px 5px 12px rgba(0, 0, 0, 0.45), -5px -5px 12px rgba(255, 255, 255, 0.02), inset 3px 3px 6px rgba(255, 255, 255, 0.08), inset -3px -3px 6px rgba(0, 0, 0, 0.4);
    --clay-btn-active: inset 3px 3px 6px rgba(0, 0, 0, 0.5), inset -3px -3px 6px rgba(255, 255, 255, 0.02);
    --clay-input-shadow: inset 3px 3px 6px rgba(0, 0, 0, 0.55), inset -3px -3px 6px rgba(255, 255, 255, 0.02);
}

body {
    font-family: "Noto Kufi Arabic", sans-serif;
    font-size: 0.95rem;
    background-color: var(--bs-body-bg);
    color: var(--bs-body-color);
    transition: background-color 0.3s ease, color 0.3s ease;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ==========================================================================
   BUILT-IN ROBUST DROPDOWN STYLES (Self-Contained Safety)
   ========================================================================== */
.dropdown,
.btn-group {
    position: relative;
    display: inline-flex;
    vertical-align: middle;
}

.dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    left: auto;
    z-index: 1050;
    min-width: 12rem;
    padding: 0.5rem;
    margin: 0.25rem 0 0;
    font-size: 0.88rem;
    color: #1e293b;
    text-align: right;
    list-style: none !important;
    background-color: #ffffff;
    background-clip: padding-box;
    border: 1px solid rgba(203, 213, 225, 0.8);
    border-radius: 14px;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
}

.dropdown-menu.show,
.show>.dropdown-menu {
    display: block !important;
}

.dropdown-item {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 0.45rem 0.75rem;
    clear: both;
    font-weight: 500;
    color: #334155;
    text-align: right;
    text-decoration: none;
    white-space: nowrap;
    background-color: transparent;
    border: 0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.dropdown-item:hover,
.dropdown-item:focus {
    color: #1e293b;
    background-color: #f1f5f9;
}

.dropdown-item.active,
.dropdown-item:active {
    color: #ffffff;
    background-color: #4f46e5;
}

.dropdown-divider {
    height: 0;
    margin: 0.4rem 0;
    overflow: hidden;
    border-top: 1px solid #e2e8f0;
}

[data-bs-theme="dark"] .dropdown-menu {
    background-color: #1e293b;
    border-color: #334155;
    color: #f8fafc;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.4);
}

[data-bs-theme="dark"] .dropdown-item {
    color: #cbd5e1;
}

[data-bs-theme="dark"] .dropdown-item:hover,
[data-bs-theme="dark"] .dropdown-item:focus {
    color: #f8fafc;
    background-color: #334155;
}

[data-bs-theme="dark"] .dropdown-divider {
    border-top-color: #334155;
}

body.modal-open {
    overflow: hidden;
}

.main-container {
    margin-top: 30px;
    margin-bottom: 50px;
    display: block;
}

/* --- Bootstrap Helper Classes Redesigned as Claymorphism --- */
.shadow-sm {
    box-shadow: var(--clay-outer-shadow) !important;
}

.border {
    border: 2px solid var(--bs-border-color) !important;
}

.border-0 {
    border: none !important;
}

.rounded-2,
.rounded-3 {
    border-radius: var(--elem-border-radius) !important;
}

.bg-white,
.bg-light {
    background-color: var(--bs-card-bg) !important;
}

.text-primary {
    color: #6366f1;
}

.text-success {
    color: #059669 !important;
}

.text-danger {
    color: #dc2626 !important;
}

.text-warning {
    color: #d97706 !important;
}

.text-info {
    color: #0891b2 !important;
}

/* Claymorphism Cards */
.card {
    box-shadow: var(--clay-outer-shadow), var(--clay-inner-shadow);
    border-radius: var(--card-border-radius);
    border: 3px solid var(--bs-border-color);
    background-color: var(--bs-card-bg);
    overflow: visible !important;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.3s ease;
    margin-bottom: 25px;
    padding: 10px;
}

.card:hover {
    transform: translateY(-3px);
    box-shadow: 12px 12px 24px rgba(166, 180, 200, 0.55), -12px -12px 24px rgba(255, 255, 255, 0.95), var(--clay-inner-shadow);
}

[data-bs-theme="dark"] .card:hover {
    box-shadow: 15px 15px 30px rgba(0, 0, 0, 0.6), -15px -15px 30px rgba(255, 255, 255, 0.03), var(--clay-inner-shadow);
}

.card-header {
    padding: 1.75rem 2.25rem;
    background-color: transparent;
    border-bottom: 2px solid rgba(0, 0, 0, 0.03);
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

[data-bs-theme="dark"] .card-header {
    border-bottom: 2px solid rgba(255, 255, 255, 0.03);
}

/* ==========================================================
   SUPER 3D CLAYMORPHISM BUTTONS (كلاي مورفيزم ثلاثي الأبعاد لجميع الأزرار)
   ========================================================== */

/* Claymorphic Pill Trays (Button Groups) */
.btn-group,
.control-panel .btn-group,
.btn-group-vertical {
    background-color: transparent !important;
    box-shadow: none !important;
    border: none !important;
    padding: 0 !important;
    display: inline-flex !important;
    gap: 0.6rem !important;
}

.btn-group>.btn,
.btn-group-vertical>.btn,
.btn-group>.btn-group>.btn {
    border-radius: 50px !important;
    border: none !important;
}

/* Base Button Styling with Claymorphism */
.btn {
    font-weight: 700;
    border-radius: 50px;
    padding: 0.45rem 1.1rem;
    border: 1px solid rgba(255, 255, 255, 0.3) !important;
    transition: all 0.22s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    cursor: pointer;
    background: linear-gradient(145deg, #f8fafc, #e2e8f0);
    color: #1e293b;
    box-shadow: 0 5px 12px -2px rgba(148, 163, 184, 0.4),
        inset 2px 2px 4px rgba(255, 255, 255, 0.9),
        inset -2px -2px 4px rgba(100, 116, 139, 0.18) !important;
    text-shadow: none;
    user-select: none;
}

.btn-sm,
.control-panel .btn,
.control-panel .btn-group>.btn {
    padding: 0.4rem 0.85rem !important;
    font-size: 0.82rem !important;
    min-height: 36px !important;
    border-radius: 50px !important;
    gap: 0.35rem !important;
    white-space: nowrap !important;
}

.btn-xs {
    padding: 0.22rem 0.55rem !important;
    font-size: 0.73rem !important;
    min-height: 28px !important;
    border-radius: 50px !important;
    gap: 0.25rem !important;
}

.control-panel {
    display: flex !important;
    flex-wrap: wrap !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 0.45rem !important;
    width: 100% !important;
}

.control-panel .btn-group {
    display: inline-flex !important;
    margin: 0 !important;
    gap: 0 !important;
}

.btn:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 8px 18px -1px rgba(148, 163, 184, 0.5),
        inset 2px 2px 4px rgba(255, 255, 255, 0.95),
        inset -2px -2px 4px rgba(100, 116, 139, 0.15) !important;
}

.btn:active,
.btn.active,
.show>.btn.dropdown-toggle {
    transform: translateY(1px) scale(0.98);
    box-shadow: inset 3px 3px 6px rgba(0, 0, 0, 0.2),
        inset -2px -2px 4px rgba(255, 255, 255, 0.4),
        0 2px 4px rgba(0, 0, 0, 0.08) !important;
}

/* Primary (Indigo Clay) */
.btn-primary {
    background: linear-gradient(145deg, #a5b4fc, #6366f1) !important;
    color: #ffffff !important;
    border: 1px solid rgba(255, 255, 255, 0.35) !important;
    box-shadow: 0 4px 12px -2px rgba(99, 102, 241, 0.28),
        inset 2px 2px 4px rgba(255, 255, 255, 0.65),
        inset -2px -2px 4px rgba(0, 0, 0, 0.12) !important;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2) !important;
}

.btn-primary:hover {
    background: linear-gradient(145deg, #c7d2fe, #818cf8) !important;
    color: #ffffff !important;
    box-shadow: 0 7px 16px -2px rgba(99, 102, 241, 0.38),
        inset 2px 2px 4px rgba(255, 255, 255, 0.75),
        inset -2px -2px 4px rgba(0, 0, 0, 0.10) !important;
}

.btn-primary:active,
.btn-primary.active,
.show>.btn-primary.dropdown-toggle {
    background: linear-gradient(145deg, #818cf8, #4f46e5) !important;
    box-shadow: inset 3px 3px 6px rgba(0, 0, 0, 0.25),
        inset -2px -2px 4px rgba(255, 255, 255, 0.25),
        0 2px 4px rgba(0, 0, 0, 0.06) !important;
}

/* Success (Emerald Clay) */
.btn-success {
    background: linear-gradient(145deg, #86efac, #10b981) !important;
    color: #ffffff !important;
    border: 1px solid rgba(255, 255, 255, 0.35) !important;
    box-shadow: 0 4px 12px -2px rgba(16, 185, 129, 0.28),
        inset 2px 2px 4px rgba(255, 255, 255, 0.65),
        inset -2px -2px 4px rgba(0, 0, 0, 0.12) !important;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2) !important;
}

.btn-success:hover {
    background: linear-gradient(145deg, #bbf7d0, #22c55e) !important;
    color: #ffffff !important;
    box-shadow: 0 7px 16px -2px rgba(16, 185, 129, 0.38),
        inset 2px 2px 4px rgba(255, 255, 255, 0.75),
        inset -2px -2px 4px rgba(0, 0, 0, 0.10) !important;
}

.btn-success:active,
.btn-success.active,
.show>.btn-success.dropdown-toggle {
    background: linear-gradient(145deg, #4ade80, #059669) !important;
    box-shadow: inset 3px 3px 6px rgba(0, 0, 0, 0.25),
        inset -2px -2px 4px rgba(255, 255, 255, 0.25),
        0 2px 4px rgba(0, 0, 0, 0.06) !important;
}

/* Warning (Warm Amber Clay) */
.btn-warning {
    background: linear-gradient(145deg, #fde68a, #f59e0b) !important;
    color: #ffffff !important;
    border: 1px solid rgba(255, 255, 255, 0.38) !important;
    box-shadow: 0 4px 12px -2px rgba(245, 158, 11, 0.28),
        inset 2px 2px 4px rgba(255, 255, 255, 0.65),
        inset -2px -2px 4px rgba(0, 0, 0, 0.12) !important;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2) !important;
}

.btn-warning:hover {
    background: linear-gradient(145deg, #fef08a, #fbbf24) !important;
    color: #ffffff !important;
    box-shadow: 0 7px 16px -2px rgba(245, 158, 11, 0.38),
        inset 2px 2px 4px rgba(255, 255, 255, 0.75),
        inset -2px -2px 4px rgba(0, 0, 0, 0.10) !important;
}

.btn-warning:active,
.btn-warning.active,
.show>.btn-warning.dropdown-toggle {
    background: linear-gradient(145deg, #fcd34d, #d97706) !important;
    box-shadow: inset 3px 3px 6px rgba(0, 0, 0, 0.25),
        inset -2px -2px 4px rgba(255, 255, 255, 0.25),
        0 2px 4px rgba(0, 0, 0, 0.06) !important;
}

/* Danger (Coral Red Clay) */
.btn-danger {
    background: linear-gradient(145deg, #fecaca, #f87171) !important;
    color: #ffffff !important;
    border: 1px solid rgba(255, 255, 255, 0.35) !important;
    box-shadow: 0 4px 12px -2px rgba(239, 68, 68, 0.28),
        inset 2px 2px 4px rgba(255, 255, 255, 0.65),
        inset -2px -2px 4px rgba(0, 0, 0, 0.12) !important;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2) !important;
}

.btn-danger:hover {
    background: linear-gradient(145deg, #fee2e2, #fca5a5) !important;
    color: #ffffff !important;
    box-shadow: 0 7px 16px -2px rgba(239, 68, 68, 0.38),
        inset 2px 2px 4px rgba(255, 255, 255, 0.75),
        inset -2px -2px 4px rgba(0, 0, 0, 0.10) !important;
}

.btn-danger:active,
.btn-danger.active,
.show>.btn-danger.dropdown-toggle {
    background: linear-gradient(145deg, #fca5a5, #ef4444) !important;
    box-shadow: inset 3px 3px 6px rgba(0, 0, 0, 0.25),
        inset -2px -2px 4px rgba(255, 255, 255, 0.25),
        0 2px 4px rgba(0, 0, 0, 0.06) !important;
}

/* Info (Sky Cyan Clay) */
.btn-info {
    background: linear-gradient(145deg, #67e8f9, #22d3ee) !important;
    color: #ffffff !important;
    border: 1px solid rgba(255, 255, 255, 0.35) !important;
    box-shadow: 0 4px 12px -2px rgba(6, 182, 212, 0.28),
        inset 2px 2px 4px rgba(255, 255, 255, 0.65),
        inset -2px -2px 4px rgba(0, 0, 0, 0.12) !important;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2) !important;
}

.btn-info:hover {
    background: linear-gradient(145deg, #a5f3fc, #38e1fa) !important;
    color: #ffffff !important;
    box-shadow: 0 7px 16px -2px rgba(6, 182, 212, 0.38),
        inset 2px 2px 4px rgba(255, 255, 255, 0.75),
        inset -2px -2px 4px rgba(0, 0, 0, 0.10) !important;
}

.btn-info:active,
.btn-info.active,
.show>.btn-info.dropdown-toggle {
    background: linear-gradient(145deg, #0891b2, #075985) !important;
    box-shadow: inset 3px 3px 6px rgba(0, 0, 0, 0.35),
        inset -2px -2px 4px rgba(255, 255, 255, 0.18),
        0 2px 4px rgba(0, 0, 0, 0.1) !important;
}

/* Secondary / Light (Soft Slate Clay) */
.btn-secondary,
.btn-outline-secondary,
.btn-light {
    background: linear-gradient(145deg, #f8fafc, #cbd5e1) !important;
    color: #1e293b !important;
    border: 1px solid rgba(255, 255, 255, 0.6) !important;
    box-shadow: 0 6px 15px -2px rgba(148, 163, 184, 0.45),
        inset 2px 2px 4px rgba(255, 255, 255, 0.95),
        inset -2px -2px 4px rgba(100, 116, 139, 0.2) !important;
    text-shadow: none !important;
}

.btn-secondary:hover,
.btn-outline-secondary:hover,
.btn-light:hover {
    background: linear-gradient(145deg, #ffffff, #d8e2ed) !important;
    color: #0f172a !important;
    box-shadow: 0 9px 20px -2px rgba(148, 163, 184, 0.55),
        inset 2px 2px 4px rgba(255, 255, 255, 0.95),
        inset -2px -2px 4px rgba(100, 116, 139, 0.18) !important;
}

.btn-secondary:active,
.btn-outline-secondary:active,
.btn-light:active,
.show>.btn-secondary.dropdown-toggle,
.show>.btn-outline-secondary.dropdown-toggle {
    background: linear-gradient(145deg, #cbd5e1, #94a3b8) !important;
    box-shadow: inset 3px 3px 6px rgba(0, 0, 0, 0.25),
        inset -2px -2px 4px rgba(255, 255, 255, 0.6),
        0 2px 4px rgba(0, 0, 0, 0.08) !important;
}

/* Outline Buttons (Clean 2D Flat) */
.btn-outline-primary {
    background: transparent !important;
    color: #4f46e5 !important;
    border: 1.5px solid #4f46e5 !important;
    box-shadow: none !important;
}

.btn-outline-primary:hover {
    background: #4f46e5 !important;
    color: #ffffff !important;
    border-color: #4f46e5 !important;
    box-shadow: none !important;
}

.btn-outline-success {
    background: transparent !important;
    color: #059669 !important;
    border: 1.5px solid #059669 !important;
    box-shadow: none !important;
}

.btn-outline-success:hover {
    background: #059669 !important;
    color: #ffffff !important;
    border-color: #059669 !important;
    box-shadow: none !important;
}

.btn-outline-danger {
    background: transparent !important;
    color: #dc2626 !important;
    border: 1.5px solid #dc2626 !important;
    box-shadow: none !important;
}

.btn-outline-danger:hover {
    background: #dc2626 !important;
    color: #ffffff !important;
    border-color: #dc2626 !important;
    box-shadow: none !important;
}

.btn-check:checked+.btn,
.btn-check:checked+.btn-outline-primary,
.btn-check:checked+.btn-primary {
    color: #ffffff !important;
    background: #4f46e5 !important;
    box-shadow: none !important;
    border: 1px solid #4f46e5 !important;
}

/* Circular Icon Clay Buttons */
.btn.rounded-circle,
.rounded-circle.btn {
    border-radius: 50% !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 0 !important;
}

/* Bouncy close button for modals */
.btn-close {
    box-shadow: none !important;
    opacity: 0.85 !important;
    transition: all 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.btn-close:hover {
    opacity: 1 !important;
    transform: scale(1.18) rotate(90deg);
}

.btn-close:active {
    box-shadow: none !important;
    transform: scale(0.95);
}

/* SweetAlert2 Flat Modern Buttons */
.swal2-styled.swal2-confirm,
.swal2-confirm {
    border-radius: 50px !important;
    background: #4f46e5 !important;
    color: #ffffff !important;
    box-shadow: none !important;
    font-weight: 700 !important;
    border: none !important;
    padding: 0.65rem 1.8rem !important;
    transition: opacity 0.15s ease !important;
}

.swal2-styled.swal2-confirm:hover,
.swal2-confirm:hover {
    transform: none !important;
    box-shadow: none !important;
    opacity: 0.9 !important;
}

.swal2-styled.swal2-cancel,
.swal2-cancel {
    border-radius: 50px !important;
    background: #e2e8f0 !important;
    color: #1e293b !important;
    box-shadow: none !important;
    font-weight: 700 !important;
    border: 1px solid #cbd5e1 !important;
    padding: 0.65rem 1.8rem !important;
    transition: opacity 0.15s ease !important;
}

.swal2-styled.swal2-cancel:hover,
.swal2-cancel:hover {
    transform: none !important;
    box-shadow: none !important;
    opacity: 0.9 !important;
}

.swal2-styled.swal2-deny,
.swal2-deny {
    border-radius: 50px !important;
    background: #dc2626 !important;
    color: #ffffff !important;
    box-shadow: none !important;
    font-weight: 700 !important;
    border: none !important;
    padding: 0.65rem 1.8rem !important;
    transition: opacity 0.15s ease !important;
}

/* ==========================================================
   DARK MODE FLAT 2D BUTTONS
   ========================================================== */
[data-bs-theme="dark"] .btn {
    border: 1px solid #334155 !important;
    background: #1e293b;
    color: #f8fafc;
    box-shadow: none !important;
    transform: none !important;
}

[data-bs-theme="dark"] .btn:hover {
    box-shadow: none !important;
    transform: none !important;
    opacity: 0.9 !important;
}

[data-bs-theme="dark"] .btn-secondary,
[data-bs-theme="dark"] .btn-outline-secondary,
[data-bs-theme="dark"] .btn-light {
    background: #334155 !important;
    color: #f8fafc !important;
    border: 1px solid #475569 !important;
    box-shadow: none !important;
}

[data-bs-theme="dark"] .btn-primary,
[data-bs-theme="dark"] #stageSelectorBtn {
    background: #4f46e5 !important;
    color: #ffffff !important;
    box-shadow: none !important;
}

[data-bs-theme="dark"] .btn-success {
    background: #059669 !important;
    color: #ffffff !important;
    box-shadow: none !important;
}

[data-bs-theme="dark"] .btn-warning {
    background: #d97706 !important;
    color: #ffffff !important;
    box-shadow: none !important;
}

[data-bs-theme="dark"] .btn-danger {
    background: #dc2626 !important;
    color: #ffffff !important;
    box-shadow: none !important;
}

[data-bs-theme="dark"] .btn-info {
    background: #0284c7 !important;
    color: #ffffff !important;
    box-shadow: none !important;
}

[data-bs-theme="dark"] .btn-outline-primary {
    background: transparent !important;
    color: #818cf8 !important;
    border-color: #6366f1 !important;
    box-shadow: none !important;
}

[data-bs-theme="dark"] .btn-outline-success {
    background: transparent !important;
    color: #34d399 !important;
    border-color: #10b981 !important;
    box-shadow: none !important;
}

[data-bs-theme="dark"] .btn-outline-danger {
    background: transparent !important;
    color: #f87171 !important;
    border-color: #ef4444 !important;
    box-shadow: none !important;
}

/* Hollowed Clay Inputs */
.form-control,
.form-select {
    border-radius: var(--elem-border-radius);
    border: 2px solid var(--bs-border-color);
    background-color: var(--bs-body-bg);
    color: var(--bs-body-color);
    padding: 0.7rem 1.4rem;
    box-shadow: var(--clay-input-shadow);
    transition: all 0.2s ease-in-out;
}

.form-control:focus,
.form-select:focus {
    background-color: var(--bs-body-bg);
    color: var(--bs-body-color);
    border-color: rgba(var(--bs-primary-rgb), 0.5);
    box-shadow: var(--clay-input-shadow), 0 0 0 4px rgba(var(--bs-primary-rgb), 0.2);
    outline: none;
}

#scheduleSelector {
    background-color: #ffffff !important;
    color: #1e293b !important;
    font-weight: 800 !important;
    border: 2px solid #cbd5e1 !important;
    cursor: pointer !important;
    min-width: 150px;
    max-width: 220px;
}

[data-bs-theme="dark"] #scheduleSelector {
    background-color: #1e293b !important;
    color: #f8fafc !important;
    border-color: #475569 !important;
}

#scheduleSelector option {
    background-color: #ffffff !important;
    color: #1e293b !important;
    font-weight: 700 !important;
    padding: 6px 12px !important;
}

[data-bs-theme="dark"] #scheduleSelector option {
    background-color: #1e293b !important;
    color: #f8fafc !important;
}

/* Clay Tabs (Pill Layout) */
.nav-tabs {
    border-bottom: none;
    background-color: var(--bs-body-bg);
    border-radius: 50px;
    padding: 6px;
    gap: 0.4rem;
    box-shadow: var(--clay-input-shadow);
    margin-bottom: 1.5rem;
    display: inline-flex;
    width: auto;
}

.nav-tabs .nav-link {
    border-radius: 50px;
    font-weight: 800;
    color: var(--bs-body-color);
    opacity: 0.75;
    border: none;
    padding: 0.7rem 1.75rem;
    transition: all 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 8px !important;
}

.nav-tabs .nav-link i {
    margin: 0 !important;
    display: inline-block !important;
}

.nav-tabs .nav-link:hover {
    opacity: 1;
    transform: scale(1.04);
}

.nav-tabs .nav-link.active {
    opacity: 1;
    color: #ffffff !important;
    background: linear-gradient(145deg, #6366f1, #4f46e5) !important;
    box-shadow: 0 7px 16px -2px rgba(99, 102, 241, 0.48),
        inset 2px 2px 4px rgba(255, 255, 255, 0.45),
        inset -2px -2px 4px rgba(0, 0, 0, 0.25) !important;
    border: 1px solid rgba(255, 255, 255, 0.28) !important;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2) !important;
}

/* Clean, Premium SaaS Table Grid Layout with Unrestricted Vertical Scrolling */
.table-responsive,
.sub-master-scroll-container {
    border-radius: var(--elem-border-radius);
    border: 1px solid var(--bs-border-color) !important;
    background-color: var(--bs-card-bg);
    overflow-x: auto;
    overflow-y: visible;
    -webkit-overflow-scrolling: touch;
    margin: 20px 0;
}

[data-bs-theme="dark"] .table-responsive,
[data-bs-theme="dark"] .sub-master-scroll-container {
    border: 1px solid var(--bs-border-color) !important;
    box-shadow: none;
}

.table {
    vertical-align: middle;
    border-collapse: separate !important;
    border-spacing: 0 !important;
    background-color: transparent !important;
    width: 100%;
    contain: layout style;
}

.table th {
    font-weight: 700;
    border: 1px solid var(--bs-border-color) !important;
    border-bottom: 2px solid rgba(var(--bs-primary-rgb), 0.2) !important;
    background-color: rgba(var(--bs-primary-rgb), 0.05) !important;
    color: rgba(var(--bs-primary-rgb), 1) !important;
    padding: 12px 10px;
    text-align: center;
    font-size: 0.9rem;
    background-clip: padding-box;
}

[data-bs-theme="dark"] .table th {
    background-color: rgba(var(--bs-primary-rgb), 0.15) !important;
    color: #a5b4fc !important;
}

.table td {
    border: 1px solid var(--bs-border-color) !important;
    background-color: var(--bs-card-bg) !important;
    color: var(--bs-body-color);
    padding: 10px 8px;
    text-align: center;
    font-size: 0.9rem;
    background-clip: padding-box;
}

/* Zero-Lag 60fps Scroll Optimizations for All Tables */
.table,
.table *,
.table-responsive,
.table-responsive *,
.sub-master-scroll-container,
.sub-master-scroll-container * {
    transition: none !important;
    animation: none !important;
}

.table-responsive table td *,
.sub-master-scroll-container table td *,
.table td .badge,
.table td .shadow-sm,
.table td .shadow {
    box-shadow: none !important;
    text-shadow: none !important;
    filter: none !important;
}

/* Prevent Card Hover 3D Shift & Repaint for Tables */
.card:has(.table),
.card:has(.table-responsive),
.card:has(.sub-master-scroll-container) {
    transform: none !important;
    transition: none !important;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -1px rgba(0, 0, 0, 0.04) !important;
}

.card:has(.table):hover,
.card:has(.table-responsive):hover,
.card:has(.sub-master-scroll-container):hover {
    transform: none !important;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -1px rgba(0, 0, 0, 0.04) !important;
}

/* Clay-Tablet Draggable items */
.timetable-item {
    padding: 6px 8px;
    margin: 4px 0;
    font-weight: 800;
    border-radius: var(--elem-border-radius);
    border: 2px solid rgba(255, 255, 255, 0.4) !important;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05) !important;
    background: #c7d2fe !important;
    color: #1e1b4b !important;
    transition: all 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    min-height: 50px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

[data-bs-theme="dark"] .timetable-item {
    background: #312e81 !important;
    color: #e0e7ff !important;
    border-color: rgba(255, 255, 255, 0.05) !important;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2) !important;
}

.timetable-item:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 6px 10px rgba(0, 0, 0, 0.1) !important;
}

.timetable-item .badge {
    font-size: 0.65rem;
    border-radius: 50px;
    padding: 0.25em 0.5em;
    box-shadow: none !important;
}

/* ==========================================================
   Master Table (Grid) Specific Font Sizes and Distinct Colors
   Targeting divs directly inside td, NOT inside .timetable-item
   ========================================================== */
#timetableGridContainer table td {
    padding: 6px 2px !important;
}

#timetableGridContainer table td>div.text-primary,
#timetableGridContainer table td>div:first-child:not(.timetable-item) {
    font-size: calc(0.2vw + 0.45rem) !important;
    line-height: 1.2 !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    color: #0056b3 !important;
    /* Deep Blue for Subject */
    font-weight: 900 !important;
}

[data-bs-theme="dark"] #timetableGridContainer table td>div.text-primary,
[data-bs-theme="dark"] #timetableGridContainer table td>div:first-child:not(.timetable-item) {
    color: #60a5fa !important;
}

#timetableGridContainer table td>div.text-muted,
#timetableGridContainer table td>div:last-child:not(.timetable-item) {
    font-size: calc(0.18vw + 0.4rem) !important;
    line-height: 1.2 !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    color: #c62828 !important;
    /* Crimson Red for Teacher */
    font-weight: 800 !important;
}

[data-bs-theme="dark"] #timetableGridContainer table td>div.text-muted,
[data-bs-theme="dark"] #timetableGridContainer table td>div:last-child:not(.timetable-item) {
    color: #f87171 !important;
}

/* ==========================================================
   Draggable Items (Pills) Default Font Sizes
   These apply only to the pill boxes in single/multi views
   ========================================================== */
.timetable-item .text-primary,
.timetable-item div:first-child,
.timetable-item span:first-child {
    font-size: 0.95rem !important;
    line-height: 1.25 !important;
    white-space: normal !important;
    color: #4f46e5 !important;
    /* Vibrant Indigo/Blue */
    font-weight: 900 !important;
}

[data-bs-theme="dark"] .timetable-item .text-primary,
[data-bs-theme="dark"] .timetable-item div:first-child,
[data-bs-theme="dark"] .timetable-item span:first-child {
    color: #a5b4fc !important;
    /* Soft Light Indigo */
}

.timetable-item .text-muted,
.timetable-item div:last-child,
.timetable-item span:last-child {
    font-size: 0.65rem !important;
    line-height: 1.1 !important;
    white-space: normal !important;
    color: #475569 !important;
    /* Soft Slate Gray */
    font-weight: 600 !important;
}

[data-bs-theme="dark"] .timetable-item .text-muted,
[data-bs-theme="dark"] .timetable-item div:last-child,
[data-bs-theme="dark"] .timetable-item span:last-child {
    color: #cbd5e1 !important;
}

.sortable-ghost {
    opacity: 0.35;
    background: rgba(var(--bs-primary-rgb), 0.2) !important;
    border: 2px dashed rgba(var(--bs-primary-rgb), 0.4) !important;
    box-shadow: none !important;
}

.drag-handle {
    cursor: grab;
    color: rgba(var(--bs-primary-rgb), 0.4);
    padding: 4px;
    transition: color 0.2s ease;
}

.drag-handle:hover {
    color: rgba(var(--bs-primary-rgb), 0.8);
}

.btn-delete-col {
    position: absolute;
    top: 8px;
    right: 8px;
    border: none;
    background: transparent;
    color: rgba(239, 68, 68, 0.6);
    font-size: 0.85rem;
    opacity: 0;
    transition: all 0.2s ease-in-out;
    padding: 4px;
    line-height: 1;
    cursor: pointer;
    border-radius: 50px;
}

.btn-delete-col:hover {
    color: #ef4444;
    background-color: rgba(239, 68, 68, 0.15);
}

th:hover .btn-delete-col {
    opacity: 1;
}

.empty-state {
    text-align: center;
    padding: 80px 40px;
    color: #6b7280;
    background: var(--bs-body-bg);
    border: 3px solid var(--bs-border-color);
    box-shadow: var(--clay-input-shadow);
    border-radius: var(--card-border-radius);
    margin: 20px 0;
}

.empty-state i {
    color: rgba(var(--bs-primary-rgb), 0.3);
    margin-bottom: 1.5rem;
}

/* Cell styles */
.class-distribution-cell-padded,
.subjects-cell-padded {
    padding: 0 !important;
    vertical-align: top !important;
}

.class-distribution-cell-padded .subject-entry,
.subjects-cell-padded .subject-entry {
    padding: 12px;
    min-height: 46px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-bottom: 1px solid var(--bs-border-color) !important;
    white-space: nowrap !important;
}

.class-distribution-cell-padded .subject-entry:last-child,
.subjects-cell-padded .subject-entry:last-child {
    border-bottom: none !important;
}

/* Claymorphic Modals (Soft rounded windows) */
.modal-backdrop {
    background-color: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(8px);
}

.modal-content {
    border-radius: var(--card-border-radius);
    border: 6px solid rgba(255, 255, 255, 0.55);
    box-shadow: 18px 18px 36px rgba(0, 0, 0, 0.15), var(--clay-inner-shadow);
    background-color: var(--bs-card-bg);
    padding: 10px;
}

[data-bs-theme="dark"] .modal-content {
    border-color: rgba(255, 255, 255, 0.03);
    box-shadow: 18px 18px 36px rgba(0, 0, 0, 0.6), var(--clay-inner-shadow);
}

.modal-header {
    border-bottom: 2px solid rgba(0, 0, 0, 0.03);
    padding: 1.5rem 2rem;
    background-color: transparent;
}

[data-bs-theme="dark"] .modal-header {
    border-bottom: 2px solid rgba(255, 255, 255, 0.03);
}

.modal-footer {
    border-top: 2px solid rgba(0, 0, 0, 0.03);
    padding: 1.25rem 2rem;
    background-color: transparent;
}

[data-bs-theme="dark"] .modal-footer {
    border-top: 2px solid rgba(255, 255, 255, 0.03);
}

.modal-body {
    padding: 2.25rem;
}

.modal-header .btn-close {
    margin-left: 0;
    margin-right: auto;
}

/* Stat Cards */
.stat-card {
    background-color: var(--bs-card-bg);
    border: 3px solid var(--bs-border-color);
    border-radius: var(--elem-border-radius);
    box-shadow: var(--clay-outer-shadow), var(--clay-inner-shadow);
    transition: all 0.3s ease;
    padding: 1.5rem;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 14px 14px 28px rgba(166, 180, 200, 0.45), var(--clay-inner-shadow);
}

.stat-card h6 {
    color: rgba(var(--bs-primary-rgb), 1);
    font-weight: 800;
    margin-bottom: 0.75rem;
}

/* Custom Rounded Scrollbars */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: var(--bs-body-bg);
}

::-webkit-scrollbar-thumb {
    background: rgba(var(--bs-primary-rgb), 0.25);
    border-radius: 50px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(var(--bs-primary-rgb), 0.45);
}

/* Switch Toggle Customizations */
.form-check-input:checked {
    background-color: rgba(var(--bs-primary-rgb), 1);
    border-color: rgba(var(--bs-primary-rgb), 1);
}

.form-check-input {
    cursor: pointer;
    transition: all 0.2s ease-in-out;
}

.form-check-input:focus {
    box-shadow: 0 0 0 4px rgba(var(--bs-primary-rgb), 0.15);
    border-color: rgba(var(--bs-primary-rgb), 0.5);
}

/* Claymorphic Dropdown menus */
.dropdown-menu {
    border-radius: var(--elem-border-radius);
    border: 2px solid var(--bs-border-color);
    box-shadow: var(--clay-outer-shadow);
    background-color: var(--bs-card-bg);
    padding: 8px;
    margin-top: 8px !important;
}

.dropdown-item {
    border-radius: 50px;
    padding: 8px 16px;
    font-weight: 700;
    transition: all 0.2s ease;
}

.dropdown-item:hover {
    background-color: rgba(var(--bs-primary-rgb), 0.08);
    transform: scale(1.02);
}

/* Claymorphic SweetAlert2 Dialogues */
.swal2-popup {
    border-radius: var(--card-border-radius) !important;
    border: 6px solid rgba(255, 255, 255, 0.55) !important;
    box-shadow: 18px 18px 36px rgba(0, 0, 0, 0.15), var(--clay-inner-shadow) !important;
    background-color: var(--bs-card-bg) !important;
    color: var(--bs-body-color) !important;
}

.swal2-title,
.swal2-html-container {
    color: var(--bs-body-color) !important;
}

.swal2-confirm {
    background-color: #4f46e5 !important;
    background: #4f46e5 !important;
    border: none !important;
    box-shadow: var(--clay-btn-shadow) !important;
    border-radius: 50px !important;
    font-weight: 800 !important;
    color: #fff !important;
    padding: 0.75rem 1.8rem !important;
}

.swal2-cancel {
    background-color: #ef4444 !important;
    background: #ef4444 !important;
    border: none !important;
    box-shadow: var(--clay-btn-shadow) !important;
    border-radius: 50px !important;
    font-weight: 800 !important;
    color: #fff !important;
    padding: 0.75rem 1.8rem !important;
}

/* Claymorphic Availability Grid Buttons */
.period-block-btn {
    border-radius: 50px !important;
    padding: 10px 6px;
    font-size: 0.8rem;
    font-weight: 800;
    transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border: none !important;
    box-shadow: 3px 3px 6px rgba(166, 180, 200, 0.4),
        inset 2px 2px 4px rgba(255, 255, 255, 0.8),
        inset -2px -2px 4px rgba(0, 0, 0, 0.05);
}

.period-block-btn.btn-outline-success {
    color: #059669;
    border-color: rgba(16, 185, 129, 0.4) !important;
    background-color: #d1fae5 !important;
    background: #d1fae5 !important;
}

.period-block-btn.btn-outline-success:hover {
    color: #fff;
    background-color: #059669 !important;
    background: #059669 !important;
    border-color: transparent !important;
    transform: scale(1.05);
}

.period-block-btn.btn-danger {
    background-color: #ef4444 !important;
    background: #ef4444 !important;
    border: none !important;
    color: #fff !important;
    box-shadow: 3px 3px 6px rgba(239, 68, 68, 0.3) !important;
}

.period-block-btn.btn-danger:hover {
    transform: scale(1.05);
    background-color: #dc2626 !important;
    background: #dc2626 !important;
    box-shadow: 4px 4px 10px rgba(239, 68, 68, 0.4) !important;
}

/* Modal Tabs styling */
#teacherModalTabs .nav-link {
    border-radius: 50px;
    font-size: 0.9rem;
    padding: 0.6rem 1.35rem;
    margin-bottom: 0.5rem;
}

#teacherModalTabs .nav-link.active {
    border: none;
    background-color: #6366f1 !important;
    background: #6366f1 !important;
    color: #fff !important;
    box-shadow: 0 4px 6px rgba(99, 102, 241, 0.2) !important;
}

#teacherModalTabs .nav-link:not(.active) {
    border: none;
    background-color: rgba(var(--bs-primary-rgb), 0.05);
    color: var(--bs-body-color);
}

/* Class Input list in Modal */
.teacher-class-row {
    background-color: rgba(var(--bs-primary-rgb), 0.02);
    border: 1px solid var(--bs-border-color);
    border-radius: var(--elem-border-radius);
    padding: 0.75rem 1rem;
    margin-bottom: 0.5rem;
    transition: all 0.2s ease;
}

.teacher-class-row:hover {
    border-color: rgba(var(--bs-primary-rgb), 0.2);
    background-color: rgba(var(--bs-primary-rgb), 0.04);
}

/* Fix select arrow overlapping with RTL text */
.form-select {
    background-position: left 0.75rem center !important;
    padding-left: 2.25rem !important;
    padding-right: 0.75rem !important;
}

/* ==========================================================
   Responsive & Multi-Device Compatibility Styles
   (Mobile, Tablet, Laptop, Desktop, Ultra-Wide)
   ========================================================== */

/* Universal Responsive Tweaks */
html {
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
    scroll-behavior: smooth;
}

body {
    overflow-x: hidden;
    width: 100%;
}

/* Touch-friendly buttons and inputs globally */
.btn,
.form-control,
.form-select,
.nav-link {
    touch-action: manipulation;
}

/* Smooth scrolling for touch devices in tables */
.table-responsive {
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
}

/* Responsive Breakpoints */

/* 1. Large Desktops & Laptops (max-width: 1200px) */
@media screen and (max-width: 1200px) {
    .card-header {
        padding: 1.25rem 1.5rem;
    }

    .modal-body {
        padding: 1.5rem;
    }

    .btn {
        padding: 0.65rem 1.4rem;
        font-size: 0.9rem;
    }}

/* 2. Tablets Landscape & Medium Screens (max-width: 992px) */
@media screen and (max-width: 992px) {
    :root {
        --card-border-radius: 1.75rem;
        --elem-border-radius: 1rem;
    }

    .main-container {
        margin-top: 15px;
        margin-bottom: 30px;
        padding-left: 10px;
        padding-right: 10px;
    }

    .card {
        border-width: 2px;
        padding: 6px;
    }

    .card-header {
        padding: 1rem 1.25rem;
    }

    .card-title {
        font-size: 1.25rem;
    }

    /* Modal Layout on Tablets */
    .modal-dialog {
        max-width: 92% !important;
        margin: 1.5rem auto;
    }

    #teacherForm .row>[class*="col-"] {
        border-inline-end: none !important;
        border-left: none !important;
        border-right: none !important;
        border-bottom: 2px dashed var(--bs-border-color);
        padding-bottom: 1.5rem;
        margin-bottom: 1.5rem;
    }

    /* Table adjustments */
    .table th,
    .table td {
        padding: 12px 10px;
        font-size: 0.85rem;
    }

    .timetable-item {
        min-height: 44px;
        padding: 4px 6px;
    }

    .timetable-item .text-primary,
    .timetable-item div:first-child,
    .timetable-item span:first-child {
        font-size: 0.85rem !important;
    }}

/* 3. Mobile Devices (max-width: 767px) */
@media screen and (max-width: 767px) {
    :root {
        --card-border-radius: 1.35rem;
        --elem-border-radius: 0.85rem;
    }

    /* Card Header Mobile Stack */
    .card-header .d-flex.justify-content-between {
        flex-direction: column;
        align-items: stretch !important;
        gap: 0.75rem;
    }

    .card-header .d-flex.align-items-center.gap-3 {
        justify-content: space-between;
        width: 100%;
        flex-wrap: wrap;
    }

    /* Scrollable Nav Tabs on Mobile */
    .nav-tabs {
        display: flex !important;
        flex-wrap: nowrap !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
        white-space: nowrap !important;
        width: 100% !important;
        border-radius: 30px !important;
        padding: 4px !important;
        gap: 0.25rem !important;
        margin-bottom: 1rem !important;
        scrollbar-width: none;
    }

    .nav-tabs .nav-item {
        flex: 0 0 auto;
    }

    .nav-tabs .nav-link {
        padding: 0.5rem 1.1rem !important;
        font-size: 0.825rem !important;
        border-radius: 25px !important;
    }

    /* Control Panel Controls Tablet */
    .control-panel {
        width: 100% !important;
        display: flex !important;
        flex-wrap: wrap !important;
        gap: 0.35rem !important;
        align-items: center !important;
        justify-content: center !important;
    }

    .control-panel .btn-group {
        display: inline-flex !important;
        margin: 0 !important;
    }

    .control-panel .btn,
    .control-panel .btn-group>.btn {
        padding: 0.38rem 0.65rem !important;
        font-size: 0.76rem !important;
        min-height: 34px !important;
        border-radius: 50px !important;
        justify-content: center !important;
        white-space: nowrap !important;
    }

    .search-panel {
        width: 100% !important;
        min-width: 100% !important;
        margin-top: 0.35rem;
    }

    /* Timetable Header Mobile */
    #timetable-tab-pane .d-flex.justify-content-between {
        flex-direction: column;
        align-items: center !important;
        gap: 0.5rem;
    }

    /* Legacy btn-group override neutralized to support 2x2 grid */

    #timetableClassSelect,
    #timetableTeacherSelect {
        width: auto !important;
        flex: 1 1 auto !important;
        min-width: 120px !important;
    }

    /* Timetable Grid Container */
    #timetableGridContainer {
        min-height: 350px !important;
    }

    #timetableGridContainer table td>div.text-primary,
    #timetableGridContainer table td>div:first-child:not(.timetable-item) {
        font-size: 0.75rem !important;
    }

    #timetableGridContainer table td>div.text-muted,
    #timetableGridContainer table td>div:last-child:not(.timetable-item) {
        font-size: 0.68rem !important;
    }

    #unassignedSubjectsList {
        min-height: 200px !important;
        max-height: 350px !important;
    }

    /* Modal adjustments for small screens */
    .modal-dialog {
        max-width: 96% !important;
        margin: 0.5rem auto !important;
    }

    .modal-content {
        padding: 6px !important;
        border-width: 3px !important;
    }

    .modal-header {
        padding: 1rem 1.25rem !important;
    }

    .modal-body {
        padding: 1.25rem 1rem !important;
    }

    .modal-footer {
        padding: 1rem 1.25rem !important;
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .modal-footer .btn {
        flex: 1 1 auto;
    }

    /* Stat Cards Grid on Mobile */
    .stat-card {
        padding: 1rem;
        margin-bottom: 0.75rem;
    }}

/* 4. Small Mobile Phones (max-width: 480px) */
@media screen and (max-width: 480px) {
    :root {
        --card-border-radius: 1rem;
        --elem-border-radius: 0.75rem;
    }

    body {
        font-size: 0.875rem;
    }

    .card-title {
        font-size: 1.1rem !important;
    }

    .btn {
        padding: 0.5rem 0.75rem !important;
        font-size: 0.78rem !important;
        border-radius: 25px !important;
    }

    .form-control,
    .form-select {
        padding: 0.55rem 0.9rem !important;
        font-size: 0.85rem !important;
    }

    .table th,
    .table td {
        padding: 8px 5px !important;
        font-size: 0.78rem !important;
    }

    .class-distribution-cell-padded .subject-entry,
    .subjects-cell-padded .subject-entry {
        padding: 8px 4px !important;
        min-height: 38px !important;
        font-size: 0.78rem !important;
    }

    /* Availability Grid responsive buttons on mobile */
    #teacherAvailabilityGrid .d-flex {
        flex-wrap: wrap !important;
        gap: 0.25rem !important;
    }

    .period-block-btn {
        font-size: 0.72rem !important;
        padding: 6px 4px !important;
        flex: 1 1 30px !important;
        min-width: 32px !important;
    }

    /* Footer Mobile */
    footer {
        padding: 1rem 0.5rem !important;
        font-size: 0.78rem !important;
    }

    footer .fab {
        font-size: 1.25rem;
    }}

/* --- Mobile Phone Optimized Layout (Phones & Small Devices) --- */
@media screen and (max-width: 767px) {
    body {
        overflow-x: hidden !important;
        width: 100vw;
    }

    .main-container {
        margin-top: 8px !important;
        margin-bottom: 15px !important;
        padding-left: 4px !important;
        padding-right: 4px !important;
    }

    .card {
        padding: 6px !important;
        border-radius: 1rem !important;
        margin-bottom: 12px !important;
    }

    /* Top Bar Header on Phones */
    .card-title {
        font-size: 1.05rem !important;
        text-align: center;
        width: 100%;
    }

    .card .d-flex.flex-wrap.align-items-center.justify-content-between {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 0.5rem !important;
    }

    /* Mobile Pill Navigation Tabs */
    .nav-tabs {
        display: flex !important;
        flex-wrap: nowrap !important;
        overflow-x: auto !important;
        overflow-y: hidden !important;
        -webkit-overflow-scrolling: touch !important;
        scrollbar-width: none;
        padding: 4px !important;
        background: rgba(0, 0, 0, 0.03);
        border-radius: 50px;
    }

    .nav-tabs::-webkit-scrollbar {
        display: none;
    }

    .nav-tabs .nav-link {
        flex: 0 0 auto !important;
        font-size: 0.8rem !important;
        padding: 0.5rem 0.85rem !important;
        border-radius: 30px !important;
    }

    /* Action Control Buttons Grid on Mobile Phone */
    .control-panel {
        display: grid !important;
        grid-template-columns: repeat(auto-fill, minmax(105px, 1fr)) !important;
        gap: 0.3rem !important;
        width: 100% !important;
        align-items: center !important;
        justify-content: center !important;
    }

    .control-panel>.btn,
    .control-panel>.btn-group,
    .control-panel>.btn-group>.btn {
        width: 100% !important;
        margin: 0 !important;
    }

    .control-panel .btn {
        padding: 0.35rem 0.3rem !important;
        font-size: 0.72rem !important;
        min-height: 34px !important;
        border-radius: 50px !important;
        justify-content: center !important;
        white-space: nowrap !important;
        text-align: center !important;
    }

    /* Search panel full width on phone */
    .search-panel {
        width: 100% !important;
        min-width: 100% !important;
    }

    /* Table sticky columns for phone */
    .table-responsive {
        max-width: 100vw !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
        border-radius: 0.75rem !important;
    }

    /* Sticky first name column in mobile table view */
    .table th:nth-child(3),
    .table td:nth-child(3) {
        position: sticky;
        right: 0;
        background-color: var(--bs-card-bg);
        z-index: 2;
        box-shadow: -2px 0 5px rgba(0, 0, 0, 0.05);
    }

    /* Mobile Modal Dialogs */
    .modal-dialog {
        margin: 0.25rem !important;
        max-width: calc(100vw - 0.5rem) !important;
    }

    .modal-content {
        border-radius: 1.25rem !important;
        padding: 8px !important;
    }

    .modal-body {
        padding: 1rem 0.75rem !important;
        max-height: 80vh !important;
        overflow-y: auto !important;
    }}

/* Print Styles */
@media print {

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

    .print-area {
        width: 100%;
        margin: 0;
        padding: 0;
    }

    .page-break {
        page-break-before: always !important;
        break-before: page !important;
    }

    .row {
        page-break-inside: avoid !important;
        break-inside: avoid !important;
    }

    .table-responsive {
        overflow: visible !important;
        page-break-inside: avoid !important;
        break-inside: avoid !important;
        width: 100% !important;
    }

    *,
    *::before,
    *::after {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    body {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    .table {
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        table-layout: fixed !important;
        font-size: 0.9vw !important;
        page-break-inside: avoid !important;
        break-inside: avoid !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    .table th,
    .table td {
        padding: 0.2vw 0.4vw !important;
        border: 1px solid #000 !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    .preserve-table-styles th,
    .preserve-table-styles td {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    .subject-color-chip {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    @page {
        margin: 6mm 7mm !important;
    }}

/* --- Max Speed & GPU Acceleration Optimizations --- */
.table-responsive {
    contain: layout style;
    will-change: transform;
    -webkit-overflow-scrolling: touch;
}

.table tbody tr {
    content-visibility: auto;
    contain-intrinsic-size: 0 45px;
}

.modal-content,
.card {
    will-change: transform, opacity;
    transform: translateZ(0);
    backface-visibility: hidden;
}

.draggable-badge,
.badge {
    will-change: transform;
    transform: translateZ(0);
}

/* Micro-animations and hover effects for Subject Tracker */
.hover-shadow {
    transition: all 0.25s ease-in-out !important;
}

.hover-shadow:hover {
    transform: translateY(-2px) !important;
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.07) !important;
    background-color: var(--bs-white) !important;
    border-color: var(--bs-secondary-bg) !important;
}

/* Warm Beige Ledger Table styling matching printed list */
.table-ledger {
    border: 2px solid #5a4b41 !important;
}

.table-ledger th {
    background-color: #f3e9dc !important;
    color: #5a4b41 !important;
    border: 1px solid #c8b6a6 !important;
    font-weight: bold;
    text-align: center;
    vertical-align: middle;
}

.table-ledger td {
    border: 1px solid #c8b6a6 !important;
    color: #3e3229 !important;
}

.table-ledger tbody tr:hover {
    background-color: #fdfaf6 !important;
}

/* Scale the entire UI to 70% on screen (Desktop only) */
@media screen and (min-width: 992px) {
    .main-container {
        zoom: 0.7;
    }

    /* The user tuned the distribution tables to 57%. 
       Since the parent is at 70%, we use ~0.814 (0.814 * 0.7 = 0.57) */
    #tableContainer table,
    #additionalTablesContainer {
        zoom: 0.81428;
    }

    /* Make all modals (windows) 50% smaller (zoom out) */
    .modal-dialog {
        zoom: 0.5;
    }}

/* --- Locked Timetable Slots & Interactive Cells --- */
.timetable-cell {
    position: relative;
    transition: background-color 0.2s ease;
}

.timetable-cell:hover {
    background-color: rgba(99, 102, 241, 0.07) !important;
}

.timetable-item {
    position: relative;
    transition: all 0.2s ease-in-out;
}

.timetable-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.12) !important;
}

.timetable-item.is-locked {
    border: 2px solid #f59e0b !important;
    background-color: #fffbeb !important;
    box-shadow: 0 2px 6px rgba(245, 158, 11, 0.2) !important;
}

.locked-slot-badge {
    position: absolute;
    top: 2px;
    left: 2px;
    font-size: 0.65rem;
    padding: 2px 4px;
    border-radius: 4px;
    background: #f59e0b;
    color: #fff;
    cursor: pointer;
    z-index: 5;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.cell-click-hint {
    cursor: pointer;
}

.subject-restrict-card {
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    background: #ffffff;
    padding: 16px 20px;
    margin-bottom: 14px;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.03);
    transition: all 0.25s ease-in-out;
}

.subject-restrict-card:hover {
    border-color: #cbd5e1;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.06);
}

.subject-restrict-toolbar {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    padding: 12px 16px;
    margin-bottom: 16px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.02);
}

.subject-restrict-search {
    position: relative;
}

.subject-restrict-search input {
    border-radius: 50px;
    padding-left: 2.2rem;
    padding-right: 2.2rem;
    font-size: 0.88rem;
    border: 1.5px solid #e2e8f0;
    transition: all 0.2s ease;
}

.subject-restrict-search input:focus {
    border-color: #4f46e5;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
}

.subject-restrict-search .search-icon {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
}

[dir="rtl"] .subject-restrict-search .search-icon,
body.rtl .subject-restrict-search .search-icon {
    right: 14px;
}

[dir="ltr"] .subject-restrict-search .search-icon {
    left: 14px;
}

.period-chip-btn {
    min-width: 44px;
    height: 40px;
    border-radius: 12px;
    font-weight: 700;
    font-size: 0.95rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1.5px solid;
    cursor: pointer;
    user-select: none;
}

.period-chip-btn.is-allowed {
    background-color: #f8fafc !important;
    color: #334155 !important;
    border-color: #e2e8f0 !important;
}

.period-chip-btn.is-allowed:hover {
    background-color: #f1f5f9 !important;
    border-color: #cbd5e1 !important;
    color: #0f172a !important;
    transform: translateY(-2px);
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.05);
}

.period-chip-btn.is-blocked {
    background-color: #fee2e2 !important;
    color: #b91c1c !important;
    border-color: #fca5a5 !important;
    box-shadow: 0 2px 6px rgba(239, 68, 68, 0.15) !important;
    transform: translateY(-1px);
}

.period-chip-btn.is-blocked:hover {
    background-color: #fecaca !important;
    border-color: #f87171 !important;
    color: #991b1b !important;
}

.day-chip-btn {
    border-radius: 50px;
    font-size: 0.8rem;
    font-weight: 600;
    padding: 6px 14px;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    border: 1.5px solid;
    user-select: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.day-chip-btn.is-allowed {
    background-color: #f8fafc !important;
    color: #475569 !important;
    border-color: #e2e8f0 !important;
}

.day-chip-btn.is-allowed:hover {
    background-color: #f1f5f9 !important;
    color: #1e293b !important;
    border-color: #cbd5e1 !important;
    transform: translateY(-1px);
}

.period-block-btn {
    border-radius: 50px !important;
    font-size: 0.85rem !important;
    padding: 6px 10px !important;
    min-width: 42px !important;
    font-weight: bold !important;
    transition: all 0.2s ease-in-out !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
}

.period-block-btn.btn-outline-success {
    background-color: #d1fae5 !important;
    border-color: #a7f3d0 !important;
    color: #059669 !important;
}

.period-block-btn.btn-outline-success:hover {
    background-color: #a7f3d0 !important;
    color: #047857 !important;
    transform: scale(1.04);
}

.period-block-btn.btn-danger {
    background-color: #fee2e2 !important;
    border-color: #fca5a5 !important;
    color: #dc2626 !important;
    box-shadow: 0 2px 5px rgba(220, 38, 38, 0.2) !important;
}

.period-block-btn.btn-danger:hover {
    background-color: #fecaca !important;
    color: #b91c1c !important;
}

.subject-grid-card {
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    background: #ffffff;
    padding: 16px 20px;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.04);
}

.subject-pills-nav {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    padding: 4px 2px;
    scrollbar-width: thin;
}

.timetable-cell-swap-valid {
    background-color: #ecfdf5 !important;
    border: 2px solid #10b981 !important;
    border-radius: 8px !important;
    cursor: pointer !important;
    transition: all 0.2s ease-in-out !important;
}

.timetable-cell-swap-valid:hover {
    background-color: #d1fae5 !important;
    border-color: #059669 !important;
    transform: scale(1.04) !important;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.25) !important;
    z-index: 10;
}

.swal-wide-modal {
    max-width: 900px !important;
    width: 95% !important;
    border-radius: 20px !important;
    zoom: 0.70 !important;
    padding: 1rem !important;
}

.swal-master-swap-modal {
    max-width: 96vw !important;
    width: 96vw !important;
    zoom: 0.70 !important;
    padding: 0.75rem !important;
}

.swap-modal-table th,
.swap-modal-table td {
    padding: 4px 3px !important;
    vertical-align: middle !important;
}

.swap-modal-table .badge {
    font-size: 0.68rem !important;
    padding: 2px 6px !important;
}

/* High contrast bold vertical divider line between days ONLY in the Swap Modal Table */
.swap-modal-table .day-divider-start,
.swap-modal-table th.day-divider-start,
.swap-modal-table td.day-divider-start {
    border-inline-start: 3.5px solid #1e293b !important;
    border-right: 3.5px solid #1e293b !important;
}

.swap-modal-table .day-divider-end,
.swap-modal-table th.day-divider-end,
.swap-modal-table td.day-divider-end {
    border-inline-end: 3.5px solid #1e293b !important;
    border-left: 3.5px solid #1e293b !important;
}

/* --- Validation Modal Compact Styling (Scaled ~30% for Optimal Display) --- */
.swal-validation-compact {
    max-width: 490px !important;
    width: 92% !important;
    border-radius: 20px !important;
    padding: 14px 18px !important;
    zoom: 0.70 !important;
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.18) !important;
}

.swal-validation-compact .swal2-icon {
    width: 52px !important;
    height: 52px !important;
    margin: 8px auto 10px !important;
    border-width: 3px !important;
}

.swal-validation-compact .swal2-icon.swal2-success [class^='swal2-success-line'] {
    height: 4px !important;
}

.swal-validation-compact .swal2-icon.swal2-success .swal2-success-ring {
    width: 52px !important;
    height: 52px !important;
}

.swal-validation-compact .swal2-icon.swal2-warning {
    font-size: 2.2rem !important;
    line-height: 52px !important;
}

.swal-validation-compact .swal2-title {
    font-size: 1.05rem !important;
    padding: 0 0 8px !important;
    margin: 0 !important;
    line-height: 1.3 !important;
}

.swal-validation-compact .swal2-html-container {
    margin: 0 !important;
    padding: 0 !important;
}

.swal-validation-compact .swal2-actions {
    margin-top: 10px !important;
}

.swal-validation-compact .swal2-confirm {
    padding: 6px 24px !important;
    font-size: 0.85rem !important;
    border-radius: 20px !important;
}

/* --- Compact Nisab Modal (Scaled down by ~35% with clean layout & single-row buttons) --- */
.swal2-compact-nisab {
    padding: 10px 14px 12px !important;
    border-radius: 18px !important;
    max-height: 84vh !important;
    box-shadow: 0 14px 38px rgba(0, 0, 0, 0.22) !important;
    display: flex !important;
    flex-direction: column !important;
    box-sizing: border-box !important;
}

.swal2-compact-nisab .swal2-icon {
    zoom: 0.52;
    margin: 2px auto 0 !important;
    border-width: 2.5px !important;
}

@supports not (zoom: 0.52) {
    .swal2-compact-nisab .swal2-icon {
        transform: scale(0.52);
        transform-origin: center center;
        margin: -12px auto -6px !important;
    }}

.swal2-compact-nisab .swal2-icon .swal2-icon-content {
    font-size: 1.5rem !important;
    line-height: 40px !important;
}

.swal2-compact-nisab .swal2-title {
    font-size: 1.05rem !important;
    padding: 2px 10px 2px !important;
    margin: 2px 0 2px !important;
    font-weight: 800 !important;
    line-height: 1.3 !important;
    display: block !important;
    clear: both !important;
    position: relative !important;
    z-index: 5 !important;
}

.swal2-compact-nisab .swal2-html-container {
    margin: 0 !important;
    padding: 2px 10px 6px !important;
    max-height: 52vh !important;
    overflow-y: auto !important;
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 transparent;
}

.swal2-compact-nisab .swal2-html-container::-webkit-scrollbar-track {
    background: transparent;
}

.swal2-compact-nisab .swal2-html-container::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

.swal2-compact-nisab .swal2-actions {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    justify-content: center !important;
    align-items: center !important;
    gap: 6px !important;
    margin-top: 6px !important;
    width: 100% !important;
    padding: 0 2px !important;
}

.swal2-compact-nisab .swal2-actions button {
    flex: 1 1 0 !important;
    min-width: 0 !important;
    white-space: nowrap !important;
    padding: 8px 6px !important;
    font-size: 0.76rem !important;
    font-weight: 700 !important;
    border-radius: 12px !important;
    margin: 0 !important;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12) !important;
}

/* ========================================================
   Substitute Teacher Finder (دیتنا جهگرێ مامۆستایێ مۆڵەتپێدای)
   ======================================================== */
.substitute-slot-card {
    background: #ffffff;
    border-radius: 14px;
    border: 1.5px solid #e2e8f0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.04);
    transition: all 0.2s ease-in-out;
}

.substitute-slot-card:hover {
    border-color: #cbd5e1;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.08);
}

.substitute-cand-item {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 8px 12px;
    transition: all 0.15s ease;
}

.substitute-cand-item:hover {
    background: #f1f5f9;
    border-color: #cbd5e1;
    transform: translateY(-1px);
}

.substitute-cand-item.is-same-spec {
    background: #f0fdf4;
    border-color: #bbf7d0;
}

.substitute-cand-item.is-same-spec:hover {
    background: #dcfce7;
    border-color: #86efac;
}

.substitute-assigned-banner {
    background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%);
    border: 1.5px solid #10b981;
    border-radius: 10px;
    padding: 10px 14px;
    color: #065f46;
}

/* ========================================================
   Modern Responsive Substitute Top Header & Tabs (Adaptive for All Screens)
   ======================================================== */
.substitute-header-card {
    background: linear-gradient(145deg, #ffffff, #f8fafc) !important;
    border: 1.5px solid #e2e8f0 !important;
    border-radius: 16px !important;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.04) !important;
    padding: 10px 14px !important;
    transition: all 0.2s ease;
}

[data-bs-theme="dark"] .substitute-header-card {
    background: linear-gradient(145deg, #1e293b, #0f172a) !important;
    border-color: #334155 !important;
}

.substitute-toolbar-tier1 {
    border-bottom: 1px solid #f1f5f9;
    padding-bottom: 8px;
    margin-bottom: 8px;
}

[data-bs-theme="dark"] .substitute-toolbar-tier1 {
    border-color: #334155 !important;
}

.substitute-avatar-icon {
    width: 38px;
    height: 38px;
    min-width: 38px;
    border-radius: 50%;
    background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
    color: #dc2626;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 6px rgba(220, 38, 38, 0.15);
}

.substitute-segmented-nav {
    background-color: #f1f5f9;
    padding: 3px;
    border-radius: 50rem !important;
    border: 1px solid #cbd5e1;
    display: inline-flex;
    align-items: center;
    gap: 2px;
    flex-shrink: 0;
}

[data-bs-theme="dark"] .substitute-segmented-nav {
    background-color: #0f172a;
    border-color: #334155;
}

.substitute-segmented-tab {
    border-radius: 50rem !important;
    border: none !important;
    font-size: 0.81rem;
    font-weight: 700;
    padding: 5px 12px !important;
    transition: all 0.2s ease;
    color: #475569;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    cursor: pointer;
    text-decoration: none;
    margin: 0;
    height: 32px;
    background: transparent;
}

.substitute-segmented-tab:hover:not(.active) {
    color: #1e293b;
    background-color: rgba(255, 255, 255, 0.7);
}

[data-bs-theme="dark"] .substitute-segmented-tab:hover:not(.active) {
    color: #f1f5f9;
    background-color: rgba(255, 255, 255, 0.08);
}

.substitute-segmented-tab.active {
    background: linear-gradient(145deg, #4338ca 0%, #3b82f6 100%) !important;
    color: #ffffff !important;
    box-shadow: 0 3px 10px rgba(67, 56, 202, 0.35) !important;
}

.substitute-select {
    border-radius: 50rem !important;
    font-size: 0.82rem !important;
    font-weight: 700 !important;
    height: 34px !important;
    padding: 4px 28px 4px 12px !important;
    border: 1px solid #cbd5e1 !important;
    background-color: #ffffff !important;
    color: #1e293b !important;
    transition: all 0.2s ease;
}

[data-bs-theme="dark"] .substitute-select {
    background-color: #1e293b !important;
    border-color: #334155 !important;
    color: #f1f5f9 !important;
}

.substitute-select:focus {
    border-color: #4f46e5 !important;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15) !important;
    outline: none !important;
}

.substitute-filters-group {
    background-color: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 50rem !important;
    transition: all 0.2s ease;
}

[data-bs-theme="dark"] .substitute-filters-group {
    background-color: #0f172a;
    border-color: #334155;
}

.substitute-actions-toolbar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.substitute-btn-action {
    height: 34px !important;
    font-size: 0.8rem !important;
    font-weight: 700 !important;
    border-radius: 50rem !important;
    padding: 5px 13px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 6px !important;
    white-space: nowrap !important;
    transition: all 0.18s ease-in-out;
}

.substitute-btn-action:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

.substitute-btn-auto {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%) !important;
    color: #ffffff !important;
    border: none !important;
    box-shadow: 0 2px 8px rgba(217, 119, 6, 0.28) !important;
}

.substitute-btn-auto:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(217, 119, 6, 0.38) !important;
    filter: brightness(1.05);
}

/* Tablet & Medium Breakpoint (<= 991px) */
@media screen and (max-width: 991px) {
    .substitute-toolbar-tier1 {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 8px !important;
    }

    .substitute-filters-group {
        width: 100% !important;
        justify-content: space-between !important;
    }

    .substitute-filters-group select {
        flex: 1 1 0 !important;
        min-width: 0 !important;
    }

    .substitute-toolbar-tier2 {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 8px !important;
    }

    .substitute-status-info {
        width: 100% !important;
    }

    .substitute-actions-toolbar {
        width: 100% !important;
        justify-content: flex-start !important;
    }}

/* Mobile Breakpoint (<= 767px) */
@media screen and (max-width: 767px) {
    .substitute-header-card {
        padding: 8px 10px !important;
        border-radius: 12px !important;
    }

    .substitute-segmented-nav {
        display: flex !important;
        width: 100% !important;
        border-radius: 12px !important;
        padding: 2px !important;
        overflow-x: auto !important;
        scrollbar-width: none !important;
    }

    .substitute-segmented-tab {
        flex: 1 1 0 !important;
        min-width: 0 !important;
        padding: 5px 3px !important;
        font-size: 0.74rem !important;
        height: 30px !important;
    }

    .substitute-filters-group {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 5px !important;
        width: 100% !important;
    }

    .substitute-filters-group select {
        width: 100% !important;
        max-width: none !important;
        font-size: 0.76rem !important;
        height: 32px !important;
        padding: 3px 20px 3px 6px !important;
    }

    .substitute-actions-toolbar {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 5px !important;
        width: 100% !important;
    }

    .substitute-actions-toolbar .substitute-btn-auto {
        grid-column: 1 / -1 !important;
        height: 36px !important;
        font-size: 0.82rem !important;
    }

    .substitute-actions-toolbar .substitute-btn-action {
        width: 100% !important;
        height: 34px !important;
        padding: 4px 6px !important;
        font-size: 0.76rem !important;
        border-radius: 8px !important;
        justify-content: center !important;
    }}

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

    .print-only-substitute {
        display: block !important;
    }}

.substitute-general-wrapper table {
    border-collapse: separate;
    border-spacing: 0;
}

.substitute-general-wrapper th {
    font-weight: 700;
    vertical-align: middle;
}

.substitute-general-wrapper td {
    transition: background-color 0.15s ease;
}

.cursor-pointer {
    cursor: pointer;
}

.swal2-icon.swal2-icon-compact {
    transform: scale(0.65);
    margin: 4px auto -6px !important;
}

.print-signature-left {
    float: left !important;
    width: auto !important;
    min-width: 240px !important;
    max-width: none !important;
    text-align: start !important;
    direction: inherit !important;
    margin: 6px 0 0 10px !important;
    padding: 2px 10px !important;
    font-size: 7.5pt !important;
    line-height: 1.28 !important;
    white-space: nowrap !important;
    display: block !important;
    page-break-inside: avoid !important;
}

.print-signature-wrapper {
    width: 100% !important;
    display: block !important;
    clear: both !important;
    margin-top: 6px !important;
}

/* --- Modern Timetable Toolbar Styles (Adaptive for All Screens) --- */
.timetable-toolbar-wrapper {
    background: linear-gradient(145deg, #ffffff, #f8fafc) !important;
    border: 1.5px solid #e2e8f0 !important;
    border-radius: 16px !important;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.04) !important;
    padding: 10px 14px !important;
    transition: all 0.2s ease;
    position: relative !important;
    z-index: 50 !important;
    overflow: visible !important;
}

.timetable-toolbar-wrapper:has(.dropdown-menu.show),
.timetable-toolbar-wrapper:focus-within {
    z-index: 1060 !important;
}

[data-bs-theme="dark"] .timetable-toolbar-wrapper {
    background: linear-gradient(145deg, #1e293b, #0f172a) !important;
    border-color: #334155 !important;
}

.tt-toolbar-tier1 {
    border-bottom: 1px solid #f1f5f9;
    padding-bottom: 8px;
    margin-bottom: 8px;
    position: relative;
    z-index: 51;
    overflow: visible !important;
}

.tt-toolbar-tier2 {
    position: relative;
    z-index: 52;
    overflow: visible !important;
}

.tt-toolbar-tier2:has(.dropdown-menu.show),
.tt-toolbar-tier2:focus-within {
    z-index: 1060 !important;
}

[data-bs-theme="dark"] .tt-toolbar-tier1 {
    border-color: #334155 !important;
}

.tt-view-btn-group {
    background-color: #f1f5f9;
    padding: 3px;
    border-radius: 50rem !important;
    border: 1px solid #cbd5e1;
    display: inline-flex;
    align-items: center;
    gap: 2px;
    flex-shrink: 0;
}

[data-bs-theme="dark"] .tt-view-btn-group {
    background-color: #0f172a;
    border-color: #334155;
}

.tt-view-btn-group .btn {
    border-radius: 50rem !important;
    border: none !important;
    font-size: 0.81rem;
    font-weight: 700;
    padding: 5px 12px !important;
    transition: all 0.2s ease;
    color: #475569;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    margin: 0;
    height: 32px;
}

.tt-view-btn-group .btn:hover {
    color: #1e293b;
    background-color: rgba(255, 255, 255, 0.7);
}

[data-bs-theme="dark"] .tt-view-btn-group .btn:hover {
    color: #f1f5f9;
    background-color: rgba(255, 255, 255, 0.08);
}

.tt-view-btn-group .btn-check:checked+.btn {
    background: linear-gradient(145deg, #6366f1, #4f46e5) !important;
    color: #ffffff !important;
    box-shadow: 0 3px 10px rgba(99, 102, 241, 0.35) !important;
    border: none !important;
}

.tt-select-wrapper select {
    border-radius: 50rem !important;
    font-size: 0.81rem !important;
    font-weight: 700 !important;
    height: 34px !important;
    padding: 4px 28px 4px 12px !important;
    border: 1.5px solid #cbd5e1 !important;
    background-color: #ffffff !important;
    color: #1e293b !important;
    transition: all 0.2s ease;
}

[data-bs-theme="dark"] .tt-select-wrapper select {
    background-color: #1e293b !important;
    border-color: #334155 !important;
    color: #f1f5f9 !important;
}

.tt-select-wrapper select:focus {
    border-color: #6366f1 !important;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15) !important;
    outline: none !important;
}

/* --- Smooth Responsive Main Tabs --- */
#scheduleTabs {
    display: flex !important;
    flex-wrap: nowrap !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 2px;
}

#scheduleTabs::-webkit-scrollbar {
    display: none;
}

#scheduleTabs .nav-item {
    flex-shrink: 0;
}

/* Tablet & Medium Breakpoint (<= 991px) */
@media screen and (max-width: 991px) {
    .tt-toolbar-tier1 {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 8px !important;
    }

    .tt-select-wrapper {
        width: 100% !important;
    }

    .tt-select-wrapper select {
        width: 100% !important;
        max-width: none !important;
    }

    .tt-toolbar-tier2 {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 8px !important;
    }}

/* Mobile Breakpoint (<= 767px) */
@media screen and (max-width: 767px) {
    .timetable-toolbar-wrapper {
        padding: 8px 10px !important;
        border-radius: 12px !important;
    }

    .tt-view-btn-group {
        display: flex !important;
        width: 100% !important;
        border-radius: 12px !important;
        padding: 2px !important;
        overflow-x: auto !important;
        scrollbar-width: none !important;
    }

    .tt-view-btn-group .btn {
        flex: 1 1 0 !important;
        min-width: 0 !important;
        padding: 5px 3px !important;
        font-size: 0.74rem !important;
        height: 30px !important;
    }

    .tt-select-wrapper select {
        font-size: 0.76rem !important;
        height: 32px !important;
        padding: 3px 20px 3px 6px !important;
    }}

/* --- Supervision Responsive Control Toolbar --- */
.supervision-header-card {
    background: #ffffff;
    position: relative;
    z-index: 10 !important;
    overflow: visible !important;
}

.supervision-header-card:focus-within,
.supervision-header-card:has(.dropdown-menu.show) {
    z-index: 20 !important;
}

.supervision-actions-grid {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 7px;
    position: relative;
    z-index: 12;
    overflow: visible !important;
}

.supervision-actions-grid .dropdown {
    position: relative;
    z-index: 14;
}

.supervision-actions-grid .dropdown-menu {
    z-index: 1000 !important;
}

@media screen and (max-width: 991px) {
    .supervision-toolbar-row {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 12px !important;
    }

    .supervision-title-bar {
        width: 100% !important;
        display: flex !important;
        justify-content: space-between !important;
        align-items: center !important;
        flex-wrap: wrap !important;
        gap: 8px !important;
    }

    .supervision-quota-box {
        margin-left: auto;
    }

    .supervision-actions-grid {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 6px !important;
        width: 100% !important;
    }

    .supervision-actions-grid .btn,
    .supervision-actions-grid .dropdown,
    .supervision-actions-grid .dropdown>.btn {
        width: 100% !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        padding: 7px 8px !important;
        font-size: 0.78rem !important;
        border-radius: 50rem !important;
        white-space: nowrap !important;
    }}

/* --- Mentors Responsive Toolbar --- */
.mentors-toolbar-card {
    background: #ffffff;
    position: relative;
    z-index: 10 !important;
    overflow: visible !important;
}

.mentors-actions-grid {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 7px;
}

@media screen and (max-width: 767px) {
    .mentors-toolbar-card .d-flex.justify-content-between {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 12px !important;
    }

    .mentors-actions-grid {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 6px !important;
        width: 100% !important;
    }

    .mentors-actions-grid .btn,
    .mentors-actions-grid .dropdown,
    .mentors-actions-grid .dropdown>.btn {
        width: 100% !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        padding: 7px 8px !important;
        font-size: 0.78rem !important;
        border-radius: 50rem !important;
        white-space: nowrap !important;
    }}

/* --- Subject Class Row in Teacher Modal (Nisab Auto-Fill & Manual Editing) --- */
.subject-class-row {
    transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
    user-select: none;
    cursor: pointer;
}

.subject-class-row:hover {
    transform: translateY(-1.5px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.12) !important;
    border-color: #6366f1 !important;
}

.subject-class-row:active {
    transform: translateY(0) scale(0.99);
}

.subject-class-row.is-assigned {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.12), rgba(79, 70, 229, 0.08)) !important;
    border-color: rgba(99, 102, 241, 0.45) !important;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.08) !important;
}

.subject-class-row.is-assigned span.small {
    color: #4338ca !important;
    font-weight: 700 !important;
}

.subject-class-row input[type="number"] {
    transition: all 0.2s ease;
    border: 1px solid #e2e8f0 !important;
}

.subject-class-row input[type="number"]:focus {
    border-color: #6366f1 !important;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.25) !important;
    outline: none !important;
}

[data-bs-theme="dark"] .subject-class-row.is-assigned {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.25), rgba(79, 70, 229, 0.18)) !important;
    border-color: rgba(129, 140, 248, 0.5) !important;
}

[data-bs-theme="dark"] .subject-class-row.is-assigned span.small {
    color: #c7d2fe !important;
}

@keyframes fadeInTab {
    from {
        opacity: 0;
        transform: translateY(4px);
    }

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

/* 2. Modern Clay Cards */
.sup-modern-card {
    border-radius: 14px !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04) !important;
    transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.2s ease, border-color 0.2s ease !important;
}

.sup-modern-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08) !important;
    border-color: #cbd5e1 !important;
}

[data-bs-theme="dark"] .sup-modern-card {
    background: #1e293b !important;
    border-color: rgba(255, 255, 255, 0.1) !important;
}

[data-bs-theme="dark"] .sup-modern-card strong {
    color: #f1f5f9 !important;
}

/* 3. Official Table View */
.sup-official-table {
    border-radius: 14px;
    overflow: hidden;
}

.sup-official-table thead th {
    font-weight: 700;
    color: #334155;
    border-bottom: 2px solid #cbd5e1 !important;
}

.sup-official-table td {
    vertical-align: middle;
}

[data-bs-theme="dark"] .sup-official-table {
    border-color: rgba(255, 255, 255, 0.1) !important;
}

[data-bs-theme="dark"] .sup-official-table thead th {
    background: #1e293b !important;
    color: #f1f5f9 !important;
    border-bottom-color: rgba(255, 255, 255, 0.15) !important;
}

[data-bs-theme="dark"] .sup-official-table tbody td {
    background: #0f172a !important;
    border-color: rgba(255, 255, 255, 0.08) !important;
}

[data-bs-theme="dark"] .sup-official-table tfoot {
    background: #1e293b !important;
}

/* 4. Ultra-Compact List */
.sup-compact-item {
    transition: background-color 0.15s ease, transform 0.15s ease, border-color 0.15s ease;
}

.sup-compact-item:hover {
    background-color: #e2e8f0 !important;
    border-color: #94a3b8 !important;
    transform: translateX(-1px);
}

[data-bs-theme="dark"] .sup-compact-item {
    background: #1e293b !important;
    border-color: rgba(255, 255, 255, 0.1) !important;
}

[data-bs-theme="dark"] .sup-compact-item strong {
    color: #f1f5f9 !important;
}

[data-bs-theme="dark"] .sup-compact-item:hover {
    background: #334155 !important;
}

.sup-action-btn-danger:hover {
    background: #fee2e2 !important;
    color: #ef4444 !important;
    border-color: #fca5a5 !important;
}

.period-supervisor-item,
.sup-period-clay-item {
    background: #ffffff !important;
    border: 1.5px solid #ffffff !important;
    border-radius: 14px !important;
    padding: 6px 8px !important;
    margin-bottom: 5px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 3px 10px -2px rgba(148, 163, 184, 0.2),
        inset 1.5px 1.5px 2px rgba(255, 255, 255, 1),
        inset -1.5px -1.5px 2px rgba(0, 0, 0, 0.03) !important;
}

.period-supervisor-item:hover,
.sup-period-clay-item:hover {
    background: #f8fafc !important;
    border-color: #cbd5e1 !important;
    box-shadow: 0 6px 14px -2px rgba(148, 163, 184, 0.3) !important;
    transform: translateY(-1px);
}

.period-supervisor-name {
    font-size: 0.86rem;
    font-weight: 800;
    color: #0f172a;
    padding: 0 2px;
    display: inline-block;
}

.sup-period-compact-item {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 4px 8px;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.sup-period-table-slot {
    min-width: 130px;
    vertical-align: top !important;
    padding: 4px 6px !important;
}

/* ==========================================================================
   GLOBAL Z-INDEX & STACKING SYSTEM: PREVENT ANY WINDOW/MODAL/DROPDOWN FROM APPEARING IN THE BACK
   ========================================================================== */

/* 1. Global Dropdown Menus: Always appear in front of all cards, tables, headers, and backgrounds */
.dropdown-menu,
.dropdown-menu.show,
.dropdown-menu[data-bs-popper],
.supervision-actions-grid .dropdown-menu,
#supervisionWeeklyGrid .supervisor-slot-card .dropdown-menu,
.period-bell-card .dropdown-menu,
.class-mentors-dashboard .dropdown-menu {
    z-index: 2000 !important;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.2), 0 3px 8px rgba(0, 0, 0, 0.1) !important;
}

/* 2. Toolbars and wrappers in ALL sections: base z-index 50 and overflow visible */
.timetable-toolbar-wrapper,
.substitute-toolbar-card,
.supervision-header-card,
.mentors-toolbar-card,
.tt-toolbar-tier1,
.tt-toolbar-tier2,
.sub-view-bar-tier1,
.sub-view-bar-tier2,
.supervision-actions-grid,
.mentors-actions-grid,
.tt-actions-tray,
.substitute-actions-tray {
    position: relative !important;
    z-index: 50 !important;
    overflow: visible !important;
}

/* 3. When ANY container holds an active dropdown menu, promote its stacking context to 1060 */
.card:has(.dropdown-menu.show),
.card:focus-within:has(.dropdown-menu.show),
.timetable-toolbar-wrapper:has(.dropdown-menu.show),
.timetable-toolbar-wrapper:focus-within,
.substitute-toolbar-card:has(.dropdown-menu.show),
.substitute-toolbar-card:focus-within,
.tt-toolbar-tier2:has(.dropdown-menu.show),
.tt-toolbar-tier1:has(.dropdown-menu.show),
.sub-view-bar-tier2:has(.dropdown-menu.show),
.sub-view-bar-tier1:has(.dropdown-menu.show),
.supervision-header-card:has(.dropdown-menu.show),
.mentors-toolbar-card:has(.dropdown-menu.show),
.tt-actions-tray:has(.dropdown-menu.show),
.substitute-actions-tray:has(.dropdown-menu.show),
.btn-group:has(.dropdown-menu.show),
.dropdown:has(.dropdown-menu.show),
.dropdown-active-parent {
    position: relative !important;
    z-index: 1060 !important;
    overflow: visible !important;
}

/* 4. Bootstrap Modals & Backdrops: Always strictly above all page content and toolbars */
.modal-backdrop {
    z-index: 10490 !important;
}

.modal {
    z-index: 10500 !important;
}

.modal-dialog {
    z-index: 10501 !important;
}

/* 5. Tooltips and Popovers */
.tooltip,
.popover {
    z-index: 10600 !important;
}

/* 6. SweetAlert2 Dialogs & Popups: Highest priority, always on top of modals and page content */
.swal2-container {
    z-index: 20000 !important;
}

/* 7. Select2 Dropdowns */
.select2-container--open,
.select2-dropdown {
    z-index: 30000 !important;
}

/* 8. When a modal is open, lower in-page toolbars so they cannot overlay the modal backdrop */
body.modal-open .timetable-toolbar-wrapper,
body.modal-open .substitute-toolbar-card,
body.modal-open .supervision-header-card,
body.modal-open .supervision-actions-grid,
body.modal-open .supervision-wrapper,
body.modal-open .class-mentors-dashboard,
body.modal-open .mentors-toolbar-card,
body.modal-open #supervisionWeeklyGrid .day-card,
body.modal-open #supervisionWeeklyGrid .supervisor-slot-card,
body.modal-open .dropdown-active-parent {
    z-index: 1 !important;
}

@keyframes clayBounce {

    0%,
    100% {
        transform: translateY(0) scale(1);
    }

    50% {
        transform: translateY(-4px) scale(1.08);
    }
}

/* ==========================================================
   HEADER, TABS & TOOLBAR EXACT SCREENSHOT LAYOUT & STYLES
   ========================================================== */

/* 1. Top Header Card */
.top-header-card {
    background-color: var(--bs-card-bg);
    border: 1px solid rgba(226, 232, 240, 0.85) !important;
    border-radius: 1.15rem !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04) !important;
    padding: 0.6rem 1.25rem !important;
    margin-bottom: 0.65rem !important;
    transform: none !important;
}

.top-header-card:hover {
    transform: none !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06) !important;
}

[data-bs-theme="dark"] .top-header-card {
    border-color: rgba(255, 255, 255, 0.08) !important;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35) !important;
}

.header-app-title {
    font-weight: 800;
    font-size: 1.15rem;
    color: var(--bs-body-color);
    letter-spacing: -0.2px;
}

/* ==========================================================
   TOP HEADER 3D CLAYMORPHISM CONTROLS (أدوات الهيدر ثلاثية الأبعاد)
   ========================================================== */

/* 1. Header Card Styling */
.top-header-card {
    background: rgba(255, 255, 255, 0.9) !important;
    backdrop-filter: blur(14px) !important;
    border: 1px solid rgba(226, 232, 240, 0.9) !important;
    border-radius: 20px !important;
    box-shadow: 0 4px 20px -2px rgba(15, 23, 42, 0.05),
        inset 1px 1px 2px rgba(255, 255, 255, 0.95) !important;
    transition: all 0.25s ease !important;
}

[data-bs-theme="dark"] .top-header-card {
    background: rgba(30, 41, 59, 0.85) !important;
    border-color: rgba(255, 255, 255, 0.09) !important;
    box-shadow: 0 4px 20px -2px rgba(0, 0, 0, 0.45),
        inset 1px 1px 2px rgba(255, 255, 255, 0.08) !important;
}

/* 2. Branding App Icon 3D Badge */
.header-app-icon-badge {
    width: 36px;
    height: 36px;
    border-radius: 12px;
    background: linear-gradient(145deg, #c7d2fe, #6366f1);
    color: #ffffff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 10px -2px rgba(99, 102, 241, 0.35),
        inset 2px 2px 3px rgba(255, 255, 255, 0.8),
        inset -2px -2px 3px rgba(0, 0, 0, 0.12);
    font-size: 1.05rem;
    flex-shrink: 0;
}

.header-app-icon-badge i {
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.25));
}

/* 3. Base 3D Claymorphism Circle Button */
.header-circle-btn {
    width: 36px !important;
    height: 36px !important;
    min-width: 36px !important;
    min-height: 36px !important;
    border-radius: 50% !important;
    padding: 0 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    border: 1.5px solid rgba(255, 255, 255, 0.8) !important;
    transition: all 0.22s cubic-bezier(0.175, 0.885, 0.32, 1.275) !important;
    cursor: pointer !important;
    user-select: none !important;
    text-decoration: none !important;
}

.header-circle-btn i {
    font-size: 0.88rem !important;
    transition: transform 0.22s ease !important;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.25));
}

.header-circle-btn:hover {
    transform: translateY(-2px) scale(1.08) !important;
}

.header-circle-btn:hover i {
    transform: scale(1.15) !important;
}

.header-circle-btn:active {
    transform: translateY(1px) scale(0.95) !important;
}

/* 4. Rename Button (3D Sky Cyan Clay) */
.header-circle-rename {
    background: linear-gradient(145deg, #a5f3fc, #0ea5e9) !important;
    color: #ffffff !important;
    box-shadow: 0 4px 12px -2px rgba(14, 165, 233, 0.38),
        inset 2px 2px 4px rgba(255, 255, 255, 0.8),
        inset -2px -2px 4px rgba(0, 0, 0, 0.12) !important;
}

.header-circle-rename:hover {
    box-shadow: 0 6px 16px -2px rgba(14, 165, 233, 0.48),
        inset 2px 2px 4px rgba(255, 255, 255, 0.9),
        inset -2px -2px 4px rgba(0, 0, 0, 0.1) !important;
}

.header-circle-rename:active {
    box-shadow: inset 3px 3px 6px rgba(0, 0, 0, 0.25),
        inset -2px -2px 4px rgba(255, 255, 255, 0.4),
        0 2px 4px rgba(0, 0, 0, 0.08) !important;
}

/* 5. Delete Button (3D Coral Ruby Red Clay) */
.header-circle-delete {
    background: linear-gradient(145deg, #fecaca, #f87171) !important;
    color: #ffffff !important;
    box-shadow: 0 4px 12px -2px rgba(239, 68, 68, 0.38),
        inset 2px 2px 4px rgba(255, 255, 255, 0.8),
        inset -2px -2px 4px rgba(0, 0, 0, 0.12) !important;
}

.header-circle-delete:hover {
    box-shadow: 0 6px 16px -2px rgba(239, 68, 68, 0.48),
        inset 2px 2px 4px rgba(255, 255, 255, 0.9),
        inset -2px -2px 4px rgba(0, 0, 0, 0.1) !important;
}

.header-circle-delete:active {
    box-shadow: inset 3px 3px 6px rgba(0, 0, 0, 0.25),
        inset -2px -2px 4px rgba(255, 255, 255, 0.4),
        0 2px 4px rgba(0, 0, 0, 0.08) !important;
}

/* 6. Language Button (3D Soft Periwinkle Clay) */
.header-circle-lang {
    background: linear-gradient(145deg, #c7d2fe, #6366f1) !important;
    color: #ffffff !important;
    box-shadow: 0 4px 12px -2px rgba(99, 102, 241, 0.38),
        inset 2px 2px 4px rgba(255, 255, 255, 0.8),
        inset -2px -2px 4px rgba(0, 0, 0, 0.12) !important;
}

.header-circle-lang:hover {
    box-shadow: 0 6px 16px -2px rgba(99, 102, 241, 0.48),
        inset 2px 2px 4px rgba(255, 255, 255, 0.9),
        inset -2px -2px 4px rgba(0, 0, 0, 0.1) !important;
}

.header-circle-lang:active {
    box-shadow: inset 3px 3px 6px rgba(0, 0, 0, 0.25),
        inset -2px -2px 4px rgba(255, 255, 255, 0.4),
        0 2px 4px rgba(0, 0, 0, 0.08) !important;
}

/* 7. Active Schedule 3D Claymorphism Pill Dropdown */
.header-active-schedule-btn {
    background: linear-gradient(145deg, #ffffff, #f8fafc) !important;
    color: #1e293b !important;
    border: 1.5px solid rgba(203, 213, 225, 0.9) !important;
    min-width: 150px;
    height: 36px !important;
    padding: 0.35rem 0.9rem !important;
    font-size: 0.84rem !important;
    font-weight: 700 !important;
    border-radius: 50px !important;
    box-shadow: 0 4px 12px -2px rgba(100, 116, 139, 0.15),
        inset 2px 2px 4px rgba(255, 255, 255, 0.95),
        inset -2px -2px 4px rgba(0, 0, 0, 0.04) !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 0.5rem !important;
    transition: all 0.22s cubic-bezier(0.175, 0.885, 0.32, 1.275) !important;
}

.header-active-schedule-btn:hover {
    transform: translateY(-2px) scale(1.02) !important;
    box-shadow: 0 7px 16px -2px rgba(100, 116, 139, 0.22),
        inset 2px 2px 4px rgba(255, 255, 255, 0.95),
        inset -2px -2px 4px rgba(0, 0, 0, 0.04) !important;
}

.header-active-schedule-btn:active {
    transform: translateY(1px) scale(0.98) !important;
}

/* Calendar Icon 3D Badge inside Schedule Pill */
.header-schedule-icon-badge {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: linear-gradient(145deg, #93c5fd, #3b82f6);
    color: #ffffff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 6px rgba(59, 130, 246, 0.35),
        inset 1px 1px 2px rgba(255, 255, 255, 0.75),
        inset -1px -1px 2px rgba(0, 0, 0, 0.12);
    font-size: 0.75rem;
    flex-shrink: 0;
}

.header-schedule-icon-badge i {
    filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.2));
}

/* 8. Header Divider */
.header-divider {
    width: 2px;
    height: 24px;
    background-color: #cbd5e1;
    border-radius: 2px;
    align-self: center;
    margin: 0 0.2rem;
}

/* 9. Custom 3D Claymorphism Theme Toggle Switch */
.header-theme-toggle-wrapper {
    position: relative;
    display: inline-flex;
    align-items: center;
    user-select: none;
}

.header-theme-checkbox {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    pointer-events: none;
}

.header-theme-clay-track {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: space-between;
    width: 66px;
    height: 36px;
    border-radius: 50px;
    background: linear-gradient(145deg, #f1f5f9, #cbd5e1);
    border: 1.5px solid rgba(255, 255, 255, 0.9);
    box-shadow: inset 2px 2px 4px rgba(0, 0, 0, 0.12),
        inset -2px -2px 4px rgba(255, 255, 255, 0.8),
        0 3px 8px -2px rgba(100, 116, 139, 0.2);
    cursor: pointer;
    padding: 3px;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    margin-bottom: 0;
}

.theme-track-icons {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 9px;
    pointer-events: none;
}

.theme-track-icons .track-icon-sun {
    font-size: 0.78rem;
    color: #f59e0b;
    opacity: 0.35;
    transition: opacity 0.25s ease;
}

.theme-track-icons .track-icon-moon {
    font-size: 0.78rem;
    color: #6366f1;
    opacity: 0.75;
    transition: opacity 0.25s ease;
}

/* Knob 3D Clay Sphere */
.theme-knob-clay {
    position: absolute;
    left: 4px;
    top: 3px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: linear-gradient(145deg, #fef08a, #f59e0b);
    box-shadow: 0 3px 8px rgba(245, 158, 11, 0.4),
        inset 1.5px 1.5px 3px rgba(255, 255, 255, 0.9),
        inset -1.5px -1.5px 3px rgba(0, 0, 0, 0.12);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    font-size: 0.82rem;
    transition: all 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 2;
}

.theme-knob-clay i {
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.25));
}

.theme-knob-icon-sun {
    display: block;
}

.theme-knob-icon-moon {
    display: none;
}

/* Checked State (Dark Mode Theme Toggle) */
.header-theme-checkbox:checked+.header-theme-clay-track {
    background: linear-gradient(145deg, #1e1b4b, #312e81);
    border-color: rgba(255, 255, 255, 0.15);
    box-shadow: inset 2px 2px 5px rgba(0, 0, 0, 0.5),
        inset -2px -2px 4px rgba(255, 255, 255, 0.08),
        0 3px 10px -2px rgba(0, 0, 0, 0.5);
}

.header-theme-checkbox:checked+.header-theme-clay-track .theme-knob-clay {
    left: calc(100% - 32px);
    background: linear-gradient(145deg, #c7d2fe, #6366f1);
    box-shadow: 0 3px 10px rgba(99, 102, 241, 0.5),
        inset 1.5px 1.5px 3px rgba(255, 255, 255, 0.85),
        inset -1.5px -1.5px 3px rgba(0, 0, 0, 0.15);
}

.header-theme-checkbox:checked+.header-theme-clay-track .theme-knob-icon-sun {
    display: none;
}

.header-theme-checkbox:checked+.header-theme-clay-track .theme-knob-icon-moon {
    display: block;
}

.header-theme-checkbox:checked+.header-theme-clay-track .track-icon-sun {
    opacity: 0.75;
}

.header-theme-checkbox:checked+.header-theme-clay-track .track-icon-moon {
    opacity: 0.3;
}

/* 10. Dark Mode Overrides for Header */
[data-bs-theme="dark"] .header-circle-btn {
    border-color: rgba(255, 255, 255, 0.15) !important;
}

[data-bs-theme="dark"] .header-circle-rename {
    background: linear-gradient(145deg, #0369a1, #075985) !important;
    color: #bae6fd !important;
    box-shadow: 0 4px 12px -2px rgba(0, 0, 0, 0.5),
        inset 1.5px 1.5px 3px rgba(255, 255, 255, 0.3),
        inset -1.5px -1.5px 3px rgba(0, 0, 0, 0.4) !important;
}

[data-bs-theme="dark"] .header-circle-delete {
    background: linear-gradient(145deg, #b91c1c, #991b1b) !important;
    color: #fecaca !important;
    box-shadow: 0 4px 12px -2px rgba(0, 0, 0, 0.5),
        inset 1.5px 1.5px 3px rgba(255, 255, 255, 0.3),
        inset -1.5px -1.5px 3px rgba(0, 0, 0, 0.4) !important;
}

[data-bs-theme="dark"] .header-circle-lang {
    background: linear-gradient(145deg, #4338ca, #3730a3) !important;
    color: #c7d2fe !important;
    box-shadow: 0 4px 12px -2px rgba(0, 0, 0, 0.5),
        inset 1.5px 1.5px 3px rgba(255, 255, 255, 0.3),
        inset -1.5px -1.5px 3px rgba(0, 0, 0, 0.4) !important;
}

[data-bs-theme="dark"] .header-active-schedule-btn {
    background: linear-gradient(145deg, #334155, #1e293b) !important;
    color: #f8fafc !important;
    border-color: rgba(255, 255, 255, 0.12) !important;
    box-shadow: 0 4px 12px -2px rgba(0, 0, 0, 0.4),
        inset 1.5px 1.5px 3px rgba(255, 255, 255, 0.15),
        inset -1.5px -1.5px 3px rgba(0, 0, 0, 0.4) !important;
}

[data-bs-theme="dark"] .header-divider {
    background-color: rgba(255, 255, 255, 0.12);
}

/* 2. Main Navigation Tabs Bar */
.main-tabs-card {
    background-color: var(--bs-card-bg);
    border: 1px solid rgba(226, 232, 240, 0.85) !important;
    border-radius: 1.15rem !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04) !important;
    padding: 0.35rem 0.65rem !important;
    margin-bottom: 0.65rem !important;
    transform: none !important;
}

.main-tabs-card:hover {
    transform: none !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06) !important;
}

[data-bs-theme="dark"] .main-tabs-card {
    border-color: rgba(255, 255, 255, 0.08) !important;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35) !important;
}

.custom-main-tabs {
    border: none !important;
    gap: 0.25rem !important;
}

.custom-main-tabs .nav-link {
    border: none !important;
    border-radius: 0.65rem !important;
    padding: 0.5rem 0.85rem !important;
    font-size: 0.85rem !important;
    font-weight: 700 !important;
    color: #475569 !important;
    background: transparent !important;
    box-shadow: none !important;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    white-space: nowrap;
}

.custom-main-tabs .nav-link:hover {
    color: #0f172a !important;
    background: rgba(226, 232, 240, 0.6) !important;
    transform: none !important;
}

.custom-main-tabs .nav-link.active {
    background: #2563eb !important;
    color: #ffffff !important;
    box-shadow: none !important;
}

.custom-main-tabs .nav-link.active i {
    color: #ffffff !important;
}

[data-bs-theme="dark"] .custom-main-tabs .nav-link {
    color: #94a3b8 !important;
}

[data-bs-theme="dark"] .custom-main-tabs .nav-link:hover {
    color: #f8fafc !important;
    background: rgba(255, 255, 255, 0.06) !important;
}

[data-bs-theme="dark"] .custom-main-tabs .nav-link.active {
    background: #2563eb !important;
    color: #ffffff !important;
    box-shadow: none !important;
}

/* 3. Toolbar Container & Rows */
.distribution-toolbar-card {
    background-color: var(--bs-card-bg);
    border: 1px solid rgba(226, 232, 240, 0.85) !important;
    border-radius: 1.25rem !important;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.04) !important;
    padding: 0.75rem 1.25rem !important;
    margin-bottom: 1rem !important;
    transform: none !important;
}

.distribution-toolbar-card:hover {
    transform: none !important;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.04) !important;
}

[data-bs-theme="dark"] .distribution-toolbar-card {
    border-color: rgba(255, 255, 255, 0.08) !important;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35) !important;
}

/* Row 1: Views & Search */
.toolbar-row-view {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.toolbar-group-views {
    display: inline-flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
}

/* Row 2: Responsive Actions Toolbar */
.toolbar-row-actions {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 0.65rem;
    width: 100%;
}

.toolbar-group {
    display: inline-flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.45rem;
}

.toolbar-group-label {
    color: #64748b;
    font-size: 0.84rem;
    font-weight: 700;
    user-select: none;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

[data-bs-theme="dark"] .toolbar-group-label {
    color: #94a3b8;
}

/* Toolbar Divider */
.toolbar-divider {
    width: 2px;
    height: 24px;
    background-color: #cbd5e1;
    align-self: center;
    border-radius: 2px;
    margin: 0 0.25rem;
}

[data-bs-theme="dark"] .toolbar-divider {
    background-color: #475569;
}

/* Ensure all toolbar buttons have soft, 10% lighter Claymorphism styling */
.distribution-toolbar-card .btn {
    border-radius: 50px !important;
    font-weight: 700 !important;
    font-size: 0.83rem !important;
    min-height: 36px !important;
    padding: 0.4rem 1rem !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 0.45rem !important;
    border: 1px solid rgba(255, 255, 255, 0.35) !important;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2) !important;
    transition: all 0.22s cubic-bezier(0.175, 0.885, 0.32, 1.275) !important;
    user-select: none !important;
    white-space: nowrap !important;
}

.distribution-toolbar-card .btn:hover {
    transform: translateY(-2px) scale(1.02) !important;
    opacity: 1 !important;
}

.distribution-toolbar-card .btn:active {
    transform: translateY(1px) scale(0.98) !important;
}

/* 1. Stage Selector (سەرەتایی - Soft Pastel Royal Indigo Clay) */
.btn-tb-stage,
#stageSelectorBtn {
    background: linear-gradient(145deg, #a5b4fc, #6366f1) !important;
    color: #ffffff !important;
    box-shadow: 0 4px 12px -2px rgba(99, 102, 241, 0.28),
        inset 2px 2px 4px rgba(255, 255, 255, 0.65),
        inset -2px -2px 4px rgba(0, 0, 0, 0.12) !important;
}

.btn-tb-stage:hover,
#stageSelectorBtn:hover {
    background: linear-gradient(145deg, #c7d2fe, #818cf8) !important;
    box-shadow: 0 7px 16px -2px rgba(99, 102, 241, 0.38),
        inset 2px 2px 4px rgba(255, 255, 255, 0.75),
        inset -2px -2px 4px rgba(0, 0, 0, 0.10) !important;
}

.btn-tb-stage:active,
#stageSelectorBtn:active {
    background: linear-gradient(145deg, #818cf8, #4f46e5) !important;
    box-shadow: inset 3px 3px 6px rgba(0, 0, 0, 0.25),
        inset -2px -2px 4px rgba(255, 255, 255, 0.25),
        0 2px 4px rgba(0, 0, 0, 0.06) !important;
}

/* 2. View Toggle (ديمەنێ خشتەی - Soft Pastel Electric Sky Blue Clay) */
.btn-tb-view {
    background: linear-gradient(145deg, #7dd3fc, #0ea5e9) !important;
    color: #ffffff !important;
    box-shadow: 0 4px 12px -2px rgba(14, 165, 233, 0.28),
        inset 2px 2px 4px rgba(255, 255, 255, 0.65),
        inset -2px -2px 4px rgba(0, 0, 0, 0.12) !important;
}

.btn-tb-view:hover {
    background: linear-gradient(145deg, #bae6fd, #38bdf8) !important;
    box-shadow: 0 7px 16px -2px rgba(14, 165, 233, 0.38),
        inset 2px 2px 4px rgba(255, 255, 255, 0.75),
        inset -2px -2px 4px rgba(0, 0, 0, 0.10) !important;
}

.btn-tb-view:active {
    background: linear-gradient(145deg, #38bdf8, #0284c7) !important;
    box-shadow: inset 3px 3px 6px rgba(0, 0, 0, 0.25),
        inset -2px -2px 4px rgba(255, 255, 255, 0.25),
        0 2px 4px rgba(0, 0, 0, 0.06) !important;
}

/* 3. Sort (رێزبەندی - Soft Pastel Marine Teal Clay) */
.btn-tb-sort {
    background: linear-gradient(145deg, #5eead4, #14b8a6) !important;
    color: #ffffff !important;
    box-shadow: 0 4px 12px -2px rgba(13, 148, 136, 0.28),
        inset 2px 2px 4px rgba(255, 255, 255, 0.65),
        inset -2px -2px 4px rgba(0, 0, 0, 0.12) !important;
}

.btn-tb-sort:hover {
    background: linear-gradient(145deg, #99f6e4, #2dd4bf) !important;
    box-shadow: 0 7px 16px -2px rgba(13, 148, 136, 0.38),
        inset 2px 2px 4px rgba(255, 255, 255, 0.75),
        inset -2px -2px 4px rgba(0, 0, 0, 0.10) !important;
}

.btn-tb-sort:active {
    background: linear-gradient(145deg, #2dd4bf, #0d9488) !important;
    box-shadow: inset 3px 3px 6px rgba(0, 0, 0, 0.25),
        inset -2px -2px 4px rgba(255, 255, 255, 0.25),
        0 2px 4px rgba(0, 0, 0, 0.06) !important;
}

/* 4. New Schedule (خشتێ نوی - Soft Pastel Mint Emerald Clay) */
.btn-tb-new {
    background: linear-gradient(145deg, #86efac, #10b981) !important;
    color: #ffffff !important;
    box-shadow: 0 4px 12px -2px rgba(16, 185, 129, 0.28),
        inset 2px 2px 4px rgba(255, 255, 255, 0.65),
        inset -2px -2px 4px rgba(0, 0, 0, 0.12) !important;
}

.btn-tb-new:hover {
    background: linear-gradient(145deg, #bbf7d0, #22c55e) !important;
    box-shadow: 0 7px 16px -2px rgba(16, 185, 129, 0.38),
        inset 2px 2px 4px rgba(255, 255, 255, 0.75),
        inset -2px -2px 4px rgba(0, 0, 0, 0.10) !important;
}

.btn-tb-new:active {
    background: linear-gradient(145deg, #4ade80, #059669) !important;
    box-shadow: inset 3px 3px 6px rgba(0, 0, 0, 0.25),
        inset -2px -2px 4px rgba(255, 255, 255, 0.25),
        0 2px 4px rgba(0, 0, 0, 0.06) !important;
}

/* 5. Teachers (ماموستا - Soft Pastel Ocean Cyan Clay) */
.btn-tb-teacher {
    background: linear-gradient(145deg, #67e8f9, #22d3ee) !important;
    color: #ffffff !important;
    box-shadow: 0 4px 12px -2px rgba(6, 182, 212, 0.28),
        inset 2px 2px 4px rgba(255, 255, 255, 0.65),
        inset -2px -2px 4px rgba(0, 0, 0, 0.12) !important;
}

.btn-tb-teacher:hover {
    background: linear-gradient(145deg, #a5f3fc, #38e1fa) !important;
    box-shadow: 0 7px 16px -2px rgba(6, 182, 212, 0.38),
        inset 2px 2px 4px rgba(255, 255, 255, 0.75),
        inset -2px -2px 4px rgba(0, 0, 0, 0.10) !important;
}

.btn-tb-teacher:active {
    background: linear-gradient(145deg, #22d3ee, #0891b2) !important;
    box-shadow: inset 3px 3px 6px rgba(0, 0, 0, 0.25),
        inset -2px -2px 4px rgba(255, 255, 255, 0.25),
        0 2px 4px rgba(0, 0, 0, 0.06) !important;
}

/* 6. Classes / Columns (پول - Soft Pastel Amethyst Purple Clay) */
.btn-tb-class {
    background: linear-gradient(145deg, #d8b4fe, #9333ea) !important;
    color: #ffffff !important;
    box-shadow: 0 4px 12px -2px rgba(124, 58, 237, 0.28),
        inset 2px 2px 4px rgba(255, 255, 255, 0.65),
        inset -2px -2px 4px rgba(0, 0, 0, 0.12) !important;
}

.btn-tb-class:hover {
    background: linear-gradient(145deg, #e9d5ff, #a855f7) !important;
    box-shadow: 0 7px 16px -2px rgba(124, 58, 237, 0.38),
        inset 2px 2px 4px rgba(255, 255, 255, 0.75),
        inset -2px -2px 4px rgba(0, 0, 0, 0.10) !important;
}

.btn-tb-class:active {
    background: linear-gradient(145deg, #c084fc, #7c3aed) !important;
    box-shadow: inset 3px 3px 6px rgba(0, 0, 0, 0.25),
        inset -2px -2px 4px rgba(255, 255, 255, 0.25),
        0 2px 4px rgba(0, 0, 0, 0.06) !important;
}

/* 7. Auto Quota (دابەشکرنا نصابی - Soft Pastel Tangerine Orange Clay) */
.btn-tb-nisab {
    background: linear-gradient(145deg, #fed7aa, #f97316) !important;
    color: #ffffff !important;
    box-shadow: 0 4px 12px -2px rgba(249, 115, 22, 0.28),
        inset 2px 2px 4px rgba(255, 255, 255, 0.65),
        inset -2px -2px 4px rgba(0, 0, 0, 0.12) !important;
}

.btn-tb-nisab:hover {
    background: linear-gradient(145deg, #ffedd5, #fb923c) !important;
    box-shadow: 0 7px 16px -2px rgba(249, 115, 22, 0.38),
        inset 2px 2px 4px rgba(255, 255, 255, 0.75),
        inset -2px -2px 4px rgba(0, 0, 0, 0.10) !important;
}

.btn-tb-nisab:active {
    background: linear-gradient(145deg, #fdba74, #ea580c) !important;
    box-shadow: inset 3px 3px 6px rgba(0, 0, 0, 0.25),
        inset -2px -2px 4px rgba(255, 255, 255, 0.25),
        0 2px 4px rgba(0, 0, 0, 0.06) !important;
}

/* 8. Save & Cloud (هیلان و هەور - Soft Pastel Sapphire Sky Blue Clay) */
.btn-tb-cloud {
    background: linear-gradient(145deg, #bfdbfe, #3b82f6) !important;
    color: #ffffff !important;
    box-shadow: 0 4px 12px -2px rgba(37, 99, 235, 0.28),
        inset 2px 2px 4px rgba(255, 255, 255, 0.65),
        inset -2px -2px 4px rgba(0, 0, 0, 0.12) !important;
}

.btn-tb-cloud:hover {
    background: linear-gradient(145deg, #dbeafe, #60a5fa) !important;
    box-shadow: 0 7px 16px -2px rgba(37, 99, 235, 0.38),
        inset 2px 2px 4px rgba(255, 255, 255, 0.75),
        inset -2px -2px 4px rgba(0, 0, 0, 0.10) !important;
}

.btn-tb-cloud:active {
    background: linear-gradient(145deg, #93c5fd, #2563eb) !important;
    box-shadow: inset 3px 3px 6px rgba(0, 0, 0, 0.25),
        inset -2px -2px 4px rgba(255, 255, 255, 0.25),
        0 2px 4px rgba(0, 0, 0, 0.06) !important;
}

/* 9. Excel Export (ئێكسێل - Soft Pastel Forest Excel Green Clay) */
.btn-tb-excel {
    background: linear-gradient(145deg, #86efac, #22c55e) !important;
    color: #ffffff !important;
    box-shadow: 0 4px 12px -2px rgba(22, 163, 74, 0.28),
        inset 2px 2px 4px rgba(255, 255, 255, 0.65),
        inset -2px -2px 4px rgba(0, 0, 0, 0.12) !important;
}

.btn-tb-excel:hover {
    background: linear-gradient(145deg, #bbf7d0, #4ade80) !important;
    box-shadow: 0 7px 16px -2px rgba(22, 163, 74, 0.38),
        inset 2px 2px 4px rgba(255, 255, 255, 0.75),
        inset -2px -2px 4px rgba(0, 0, 0, 0.10) !important;
}

.btn-tb-excel:active {
    background: linear-gradient(145deg, #4ade80, #16a34a) !important;
    box-shadow: inset 3px 3px 6px rgba(0, 0, 0, 0.25),
        inset -2px -2px 4px rgba(255, 255, 255, 0.25),
        0 2px 4px rgba(0, 0, 0, 0.06) !important;
}

/* 10. HTML Export (HTML - Soft Pastel Warm Honey Amber Clay) */
.btn-tb-html {
    background: linear-gradient(145deg, #fde68a, #f59e0b) !important;
    color: #ffffff !important;
    box-shadow: 0 4px 12px -2px rgba(245, 158, 11, 0.28),
        inset 2px 2px 4px rgba(255, 255, 255, 0.65),
        inset -2px -2px 4px rgba(0, 0, 0, 0.12) !important;
}

.btn-tb-html:hover {
    background: linear-gradient(145deg, #fef08a, #fbbf24) !important;
    box-shadow: 0 7px 16px -2px rgba(245, 158, 11, 0.38),
        inset 2px 2px 4px rgba(255, 255, 255, 0.75),
        inset -2px -2px 4px rgba(0, 0, 0, 0.10) !important;
}

.btn-tb-html:active {
    background: linear-gradient(145deg, #fcd34d, #d97706) !important;
    box-shadow: inset 3px 3px 6px rgba(0, 0, 0, 0.25),
        inset -2px -2px 4px rgba(255, 255, 255, 0.25),
        0 2px 4px rgba(0, 0, 0, 0.06) !important;
}

/* 11. Print (چاپكرن - Soft Pastel Orchid Fuchsia Clay) */
.btn-tb-print {
    background: linear-gradient(145deg, #f0abfc, #c084fc) !important;
    color: #ffffff !important;
    box-shadow: 0 4px 12px -2px rgba(192, 38, 211, 0.28),
        inset 2px 2px 4px rgba(255, 255, 255, 0.65),
        inset -2px -2px 4px rgba(0, 0, 0, 0.12) !important;
}

.btn-tb-print:hover {
    background: linear-gradient(145deg, #f5d0fe, #d8b4fe) !important;
    box-shadow: 0 7px 16px -2px rgba(192, 38, 211, 0.38),
        inset 2px 2px 4px rgba(255, 255, 255, 0.75),
        inset -2px -2px 4px rgba(0, 0, 0, 0.10) !important;
}

.btn-tb-print:active {
    background: linear-gradient(145deg, #e879f9, #a855f7) !important;
    box-shadow: inset 3px 3px 6px rgba(0, 0, 0, 0.25),
        inset -2px -2px 4px rgba(255, 255, 255, 0.25),
        0 2px 4px rgba(0, 0, 0, 0.06) !important;
}

/* 12. Settings (رێكخستن - Soft Pastel Slate Steel Graphite Clay) */
.btn-tb-settings {
    background: linear-gradient(145deg, #cbd5e1, #64748b) !important;
    color: #ffffff !important;
    box-shadow: 0 4px 12px -2px rgba(71, 85, 105, 0.28),
        inset 2px 2px 4px rgba(255, 255, 255, 0.55),
        inset -2px -2px 4px rgba(0, 0, 0, 0.15) !important;
}

.btn-tb-settings:hover {
    background: linear-gradient(145deg, #e2e8f0, #94a3b8) !important;
    box-shadow: 0 7px 16px -2px rgba(71, 85, 105, 0.38),
        inset 2px 2px 4px rgba(255, 255, 255, 0.65),
        inset -2px -2px 4px rgba(0, 0, 0, 0.12) !important;
}

.btn-tb-settings:active {
    background: linear-gradient(145deg, #94a3b8, #475569) !important;
    box-shadow: inset 3px 3px 6px rgba(0, 0, 0, 0.25),
        inset -2px -2px 4px rgba(255, 255, 255, 0.25),
        0 2px 4px rgba(0, 0, 0, 0.06) !important;
}

/* 13. Delete / Clear (ژێبرن - Soft Pastel Coral Ruby Red Clay) */
.btn-tb-delete {
    background: linear-gradient(145deg, #fecaca, #f87171) !important;
    color: #ffffff !important;
    box-shadow: 0 4px 12px -2px rgba(239, 68, 68, 0.28),
        inset 2px 2px 4px rgba(255, 255, 255, 0.65),
        inset -2px -2px 4px rgba(0, 0, 0, 0.12) !important;
}

.btn-tb-delete:hover {
    background: linear-gradient(145deg, #fee2e2, #fca5a5) !important;
    box-shadow: 0 7px 16px -2px rgba(239, 68, 68, 0.38),
        inset 2px 2px 4px rgba(255, 255, 255, 0.75),
        inset -2px -2px 4px rgba(0, 0, 0, 0.10) !important;
}

.btn-tb-delete:active {
    background: linear-gradient(145deg, #fca5a5, #ef4444) !important;
    box-shadow: inset 3px 3px 6px rgba(0, 0, 0, 0.25),
        inset -2px -2px 4px rgba(255, 255, 255, 0.25),
        0 2px 4px rgba(0, 0, 0, 0.06) !important;
}

/* Merged timetable card styles */
.merged-cell-card {
    background: linear-gradient(180deg, #ffffff 0%, #faf8ff 100%);
    border: 1.5px solid #d8b4fe !important;
    box-shadow: 0 2px 6px rgba(124, 58, 237, 0.12);
    border-radius: 6px;
    padding: 3px;
    transition: all 0.2s ease-in-out;
}

.merged-cell-card:hover {
    border-color: #7c3aed !important;
    box-shadow: 0 4px 10px rgba(124, 58, 237, 0.22);
}

.merged-half-tag {
    font-size: 0.64rem;
    font-weight: 700;
    padding: 1px 4px;
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
}

.merged-half-primary {
    background: #ede9fe;
    color: #6d28d9;
}

.merged-half-partner {
    background: #f1f5f9;
    color: #475569;
    border-top: 1px dashed #cbd5e1;
    margin-top: 3px;
    padding-top: 2px;
    font-size: 0.68rem;
    text-align: right;
}

/* Responsive Rules for Desktop, Tablet, and Mobile */
@media (max-width: 1200px) {
    .distribution-toolbar-card {
        padding: 0.65rem 1rem !important;
    }

    .distribution-toolbar-card .btn {
        padding: 0.35rem 0.85rem !important;
        font-size: 0.8rem !important;
        min-height: 34px !important;
        gap: 0.35rem !important;
    }}

@media (max-width: 991px) {
    .toolbar-divider {
        display: none !important;
    }

    .toolbar-group {
        gap: 0.4rem !important;
    }

    .toolbar-row-view {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 0.5rem !important;
    }

    .toolbar-group-views {
        justify-content: flex-start !important;
    }

    .search-panel {
        max-width: 100% !important;
        width: 100% !important;
    }}

@media (max-width: 576px) {
    .distribution-toolbar-card .btn {
        padding: 0.3rem 0.65rem !important;
        font-size: 0.76rem !important;
        min-height: 32px !important;
    }}

/* Dark Mode Claymorphic Overrides */
[data-bs-theme="dark"] .distribution-toolbar-card .btn {
    border-color: rgba(255, 255, 255, 0.18) !important;
    box-shadow: 0 5px 14px -2px rgba(0, 0, 0, 0.55),
        inset 2px 2px 4px rgba(255, 255, 255, 0.25),
        inset -2px -2px 4px rgba(0, 0, 0, 0.45) !important;
}

[data-bs-theme="dark"] .distribution-toolbar-card .btn:hover {
    box-shadow: 0 8px 20px -2px rgba(0, 0, 0, 0.65),
        inset 2px 2px 4px rgba(255, 255, 255, 0.32),
        inset -2px -2px 4px rgba(0, 0, 0, 0.4) !important;
}

/* Timetable View Radio Button Group - Claymorphism */
.tt-view-btn-group {
    background: rgba(241, 245, 249, 0.9) !important;
    padding: 3px !important;
    border-radius: 50px !important;
    border: 1px solid rgba(226, 232, 240, 0.95) !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 3px !important;
    box-shadow: inset 1px 1px 3px rgba(0, 0, 0, 0.05) !important;
}

[data-bs-theme="dark"] .tt-view-btn-group {
    background: rgba(30, 41, 59, 0.8) !important;
    border-color: rgba(255, 255, 255, 0.1) !important;
    box-shadow: inset 1px 1px 3px rgba(0, 0, 0, 0.3) !important;
}

.tt-view-btn-group label.btn,
.tt-view-btn-group button.btn,
.tt-view-btn-group .nav-link {
    border-radius: 50px !important;
    font-size: 0.81rem !important;
    font-weight: 700 !important;
    padding: 0.38rem 0.95rem !important;
    min-height: 33px !important;
    border: none !important;
    color: #64748b !important;
    background: transparent !important;
    box-shadow: none !important;
    transition: all 0.22s cubic-bezier(0.175, 0.885, 0.32, 1.275) !important;
    cursor: pointer !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 0.35rem !important;
}

.tt-view-btn-group label.btn:hover,
.tt-view-btn-group button.btn:hover,
.tt-view-btn-group .nav-link:hover {
    color: #1e293b !important;
    background: rgba(255, 255, 255, 0.7) !important;
}

[data-bs-theme="dark"] .tt-view-btn-group label.btn,
[data-bs-theme="dark"] .tt-view-btn-group button.btn,
[data-bs-theme="dark"] .tt-view-btn-group .nav-link {
    color: #94a3b8 !important;
}

[data-bs-theme="dark"] .tt-view-btn-group label.btn:hover,
[data-bs-theme="dark"] .tt-view-btn-group button.btn:hover,
[data-bs-theme="dark"] .tt-view-btn-group .nav-link:hover {
    color: #f8fafc !important;
    background: rgba(255, 255, 255, 0.1) !important;
}

/* Checked or Active state: Soft pastel claymorphic pill */
.tt-view-btn-group .btn-check:checked+label.btn,
.tt-view-btn-group button.btn.active,
.tt-view-btn-group .nav-link.active {
    background: linear-gradient(145deg, #7dd3fc, #0ea5e9) !important;
    color: #ffffff !important;
    box-shadow: 0 4px 10px -2px rgba(14, 165, 233, 0.35),
        inset 1px 1px 3px rgba(255, 255, 255, 0.7),
        inset -1px -1px 3px rgba(0, 0, 0, 0.12) !important;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2) !important;
}

/* ==========================================================
   TIMETABLE SELECTOR & CONTEXT BADGE - 3D CLAYMORPHISM
   ========================================================== */

/* 1. Main Selector 3D Clay Capsule */
.tt-select-clay-capsule {
    height: 38px !important;
    min-height: 38px !important;
    border-radius: 50px !important;
    background: linear-gradient(145deg, #ffffff, #f1f5f9) !important;
    border: 1.5px solid rgba(255, 255, 255, 0.95) !important;
    box-shadow: 0 4px 14px -2px rgba(100, 116, 139, 0.16),
        inset 2px 2px 4px rgba(255, 255, 255, 0.95),
        inset -2px -2px 4px rgba(0, 0, 0, 0.05) !important;
    display: inline-flex !important;
    align-items: center !important;
    padding: 3px 5px !important;
    gap: 6px !important;
    transition: all 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275) !important;
    user-select: none !important;
}

.tt-select-clay-capsule:hover {
    transform: translateY(-2px) scale(1.02) !important;
    box-shadow: 0 7px 18px -2px rgba(100, 116, 139, 0.24),
        inset 2px 2px 4px rgba(255, 255, 255, 0.95),
        inset -2px -2px 4px rgba(0, 0, 0, 0.04) !important;
}

[data-bs-theme="dark"] .tt-select-clay-capsule {
    background: linear-gradient(145deg, #1e293b, #0f172a) !important;
    border-color: rgba(255, 255, 255, 0.12) !important;
    box-shadow: 0 4px 14px -2px rgba(0, 0, 0, 0.5),
        inset 1.5px 1.5px 3px rgba(255, 255, 255, 0.1),
        inset -1.5px -1.5px 3px rgba(0, 0, 0, 0.4) !important;
}

/* 2. 3D Clay Filter Icon Sphere Badge */
.tt-select-icon-badge {
    width: 28px !important;
    height: 28px !important;
    min-width: 28px !important;
    min-height: 28px !important;
    border-radius: 50% !important;
    background: linear-gradient(145deg, #7dd3fc, #0284c7) !important;
    color: #ffffff !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    box-shadow: 0 3px 8px rgba(2, 132, 199, 0.35),
        inset 1.5px 1.5px 2px rgba(255, 255, 255, 0.8),
        inset -1.5px -1.5px 2px rgba(0, 0, 0, 0.15) !important;
    font-size: 0.8rem !important;
    flex-shrink: 0 !important;
}

.tt-select-icon-badge i {
    filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.25)) !important;
}

/* 3. Clean Native Select (No ugly default borders or duplicate arrows) */
.tt-clay-select {
    border: none !important;
    background: transparent !important;
    background-image: none !important;
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    appearance: none !important;
    font-size: 0.86rem !important;
    font-weight: 700 !important;
    color: #1e293b !important;
    cursor: pointer !important;
    padding: 0 6px !important;
    min-width: 140px !important;
    max-width: 230px !important;
    outline: none !important;
    box-shadow: none !important;
    line-height: 1.4 !important;
}

[data-bs-theme="dark"] .tt-clay-select {
    color: #f8fafc !important;
}

.tt-clay-select option {
    background-color: #ffffff !important;
    color: #1e293b !important;
    font-weight: 600 !important;
    padding: 8px 12px !important;
}

[data-bs-theme="dark"] .tt-clay-select option {
    background-color: #1e293b !important;
    color: #f8fafc !important;
}

/* 4. 3D Clay Arrow Badge Indicator */
.tt-select-arrow-badge {
    width: 22px !important;
    height: 22px !important;
    min-width: 22px !important;
    min-height: 22px !important;
    border-radius: 50% !important;
    background: linear-gradient(145deg, #f8fafc, #e2e8f0) !important;
    border: 1px solid rgba(255, 255, 255, 0.9) !important;
    box-shadow: inset 1px 1px 2px rgba(255, 255, 255, 0.9),
        inset -1px -1px 2px rgba(0, 0, 0, 0.08),
        0 2px 4px rgba(0, 0, 0, 0.04) !important;
    color: #0284c7 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 0.68rem !important;
    pointer-events: none !important;
    flex-shrink: 0 !important;
}

[data-bs-theme="dark"] .tt-select-arrow-badge {
    background: linear-gradient(145deg, #334155, #1e293b) !important;
    color: #38bdf8 !important;
    border-color: rgba(255, 255, 255, 0.1) !important;
    box-shadow: inset 1px 1px 2px rgba(255, 255, 255, 0.15),
        inset -1px -1px 2px rgba(0, 0, 0, 0.3) !important;
}

/* 5. Context Badge 3D Clay Pill (خشتێ حەفتیانە) */
.tt-context-clay-badge {
    height: 38px !important;
    min-height: 38px !important;
    padding: 0.35rem 1rem !important;
    border-radius: 50px !important;
    background: linear-gradient(145deg, #e0f2fe, #bae6fd) !important;
    color: #0369a1 !important;
    border: 1.5px solid rgba(255, 255, 255, 0.85) !important;
    box-shadow: 0 4px 10px -2px rgba(2, 132, 199, 0.22),
        inset 2px 2px 4px rgba(255, 255, 255, 0.85),
        inset -2px -2px 4px rgba(0, 0, 0, 0.08) !important;
    font-size: 0.83rem !important;
    font-weight: 700 !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 0.45rem !important;
    white-space: nowrap !important;
    user-select: none !important;
}

.tt-context-clay-badge i {
    font-size: 0.88rem !important;
    filter: drop-shadow(0 1px 1px rgba(2, 132, 199, 0.3)) !important;
}

[data-bs-theme="dark"] .tt-context-clay-badge {
    background: linear-gradient(145deg, #075985, #0c4a6e) !important;
    color: #bae6fd !important;
    border-color: rgba(255, 255, 255, 0.12) !important;
    box-shadow: 0 4px 12px -2px rgba(0, 0, 0, 0.4),
        inset 1.5px 1.5px 3px rgba(255, 255, 255, 0.15),
        inset -1.5px -1.5px 3px rgba(0, 0, 0, 0.4) !important;
}

[data-bs-theme="dark"] .subject-clay-row:hover {
    background: rgba(30, 41, 59, 0.95) !important;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.3) !important;
}

.tt-status-dot {
    width: 9px !important;
    height: 9px !important;
    min-width: 9px !important;
    min-height: 9px !important;
    border-radius: 50% !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25) !important;
    flex-shrink: 0 !important;
}

/* ==========================================================================
   MAIN NAVIGATION TABS - CLAYMORPHISM & UNIQUE CALM COLOR PALETTES
   ========================================================================== */

/* 1. Main Navigation Card Container */
.main-tabs-card {
    background: rgba(255, 255, 255, 0.88) !important;
    backdrop-filter: blur(14px) !important;
    border: 1px solid rgba(226, 232, 240, 0.9) !important;
    border-radius: 20px !important;
    box-shadow: 0 4px 20px -2px rgba(15, 23, 42, 0.05),
        inset 1px 1px 2px rgba(255, 255, 255, 0.95) !important;
    padding: 0.45rem 0.6rem !important;
    transition: all 0.25s ease !important;
}

[data-bs-theme="dark"] .main-tabs-card {
    background: rgba(30, 41, 59, 0.85) !important;
    border-color: rgba(255, 255, 255, 0.09) !important;
    box-shadow: 0 4px 20px -2px rgba(0, 0, 0, 0.45),
        inset 1px 1px 2px rgba(255, 255, 255, 0.08) !important;
}

/* 2. Responsive Grid for Navigation Tabs */
.custom-main-tabs {
    display: grid !important;
    grid-template-columns: repeat(9, 1fr) !important;
    gap: 0.45rem !important;
    margin: 0 !important;
    padding: 0 !important;
    list-style: none !important;
    width: 100% !important;
}

.custom-main-tabs .nav-item {
    display: flex !important;
    width: 100% !important;
    min-width: 0 !important;
}

.custom-main-tabs .nav-link {
    width: 100% !important;
    border-radius: 50px !important;
    font-size: 0.90rem !important;
    font-weight: 800 !important;
    padding: 0.48rem 0.75rem !important;
    min-height: 42px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 0.45rem !important;
    white-space: nowrap !important;
    text-decoration: none !important;
    transition: all 0.22s cubic-bezier(0.175, 0.885, 0.32, 1.275) !important;
    user-select: none !important;
    cursor: pointer !important;
    border: 1.5px solid transparent !important;
}

.custom-main-tabs .nav-link i {
    font-size: 0.96rem !important;
    transition: transform 0.22s ease !important;
}

.custom-main-tabs .nav-link:hover i {
    transform: scale(1.15) !important;
}

.custom-main-tabs .nav-link:active {
    transform: translateY(1px) scale(0.97) !important;
}

/* ==========================================================================
   EACH SECTION (TAB) UNIQUE CALM PASTEL CLAYMORPHISM PALETTE (+10% Vibrancy)
   ========================================================================== */

/* --- 1. دابەشکرنا وانان (Distribution: Soft Royal Iris / Slate Periwinkle) --- */
.custom-main-tabs .nav-link.tab-distribution {
    background: rgba(99, 102, 241, 0.18) !important;
    color: #4338ca !important;
    border-color: rgba(99, 102, 241, 0.35) !important;
    box-shadow: inset 1px 1px 2px rgba(255, 255, 255, 0.8), 0 2px 6px rgba(99, 102, 241, 0.12) !important;
}

.custom-main-tabs .nav-link.tab-distribution:hover {
    background: rgba(99, 102, 241, 0.26) !important;
    color: #312e81 !important;
    border-color: rgba(99, 102, 241, 0.48) !important;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.22), inset 1px 1px 2px rgba(255, 255, 255, 0.9) !important;
    transform: translateY(-2px) scale(1.02) !important;
}

.custom-main-tabs .nav-link.tab-distribution.active {
    background: linear-gradient(145deg, #a5b4fc, #6366f1) !important;
    color: #ffffff !important;
    border-color: rgba(255, 255, 255, 0.45) !important;
    box-shadow: 0 6px 16px -2px rgba(99, 102, 241, 0.42),
        inset 2px 2px 4px rgba(255, 255, 255, 0.75),
        inset -2px -2px 4px rgba(0, 0, 0, 0.12) !important;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2) !important;
}

/* --- 2. خشتێ حەفتیانە (Timetable: Soft Cerulean / Deep Sky Blue) --- */
.custom-main-tabs .nav-link.tab-timetable {
    background: rgba(14, 165, 233, 0.18) !important;
    color: #0369a1 !important;
    border-color: rgba(14, 165, 233, 0.35) !important;
    box-shadow: inset 1px 1px 2px rgba(255, 255, 255, 0.8), 0 2px 6px rgba(14, 165, 233, 0.12) !important;
}

.custom-main-tabs .nav-link.tab-timetable:hover {
    background: rgba(14, 165, 233, 0.26) !important;
    color: #075985 !important;
    border-color: rgba(14, 165, 233, 0.48) !important;
    box-shadow: 0 4px 12px rgba(14, 165, 233, 0.22), inset 1px 1px 2px rgba(255, 255, 255, 0.9) !important;
    transform: translateY(-2px) scale(1.02) !important;
}

.custom-main-tabs .nav-link.tab-timetable.active {
    background: linear-gradient(145deg, #7dd3fc, #0284c7) !important;
    color: #ffffff !important;
    border-color: rgba(255, 255, 255, 0.45) !important;
    box-shadow: 0 6px 16px -2px rgba(2, 132, 199, 0.42),
        inset 2px 2px 4px rgba(255, 255, 255, 0.75),
        inset -2px -2px 4px rgba(0, 0, 0, 0.12) !important;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2) !important;
}

/* --- 3. ماموستایێن جێگر (Substitute: Soft Lavender Plum / Amethyst) --- */
.custom-main-tabs .nav-link.tab-substitute {
    background: rgba(168, 85, 247, 0.18) !important;
    color: #6b21a8 !important;
    border-color: rgba(168, 85, 247, 0.35) !important;
    box-shadow: inset 1px 1px 2px rgba(255, 255, 255, 0.8), 0 2px 6px rgba(168, 85, 247, 0.12) !important;
}

.custom-main-tabs .nav-link.tab-substitute:hover {
    background: rgba(168, 85, 247, 0.26) !important;
    color: #581c87 !important;
    border-color: rgba(168, 85, 247, 0.48) !important;
    box-shadow: 0 4px 12px rgba(168, 85, 247, 0.22), inset 1px 1px 2px rgba(255, 255, 255, 0.9) !important;
    transform: translateY(-2px) scale(1.02) !important;
}

.custom-main-tabs .nav-link.tab-substitute.active {
    background: linear-gradient(145deg, #d8b4fe, #9333ea) !important;
    color: #ffffff !important;
    border-color: rgba(255, 255, 255, 0.45) !important;
    box-shadow: 0 6px 16px -2px rgba(147, 51, 234, 0.42),
        inset 2px 2px 4px rgba(255, 255, 255, 0.75),
        inset -2px -2px 4px rgba(0, 0, 0, 0.12) !important;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2) !important;
}

/* --- 4. خشتێ چاڤدێریێ (Supervision: Soft Sage Mint / Emerald Green) --- */
.custom-main-tabs .nav-link.tab-supervision {
    background: rgba(16, 185, 129, 0.18) !important;
    color: #047857 !important;
    border-color: rgba(16, 185, 129, 0.35) !important;
    box-shadow: inset 1px 1px 2px rgba(255, 255, 255, 0.8), 0 2px 6px rgba(16, 185, 129, 0.12) !important;
}

.custom-main-tabs .nav-link.tab-supervision:hover {
    background: rgba(16, 185, 129, 0.26) !important;
    color: #064e3b !important;
    border-color: rgba(16, 185, 129, 0.48) !important;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.22), inset 1px 1px 2px rgba(255, 255, 255, 0.9) !important;
    transform: translateY(-2px) scale(1.02) !important;
}

.custom-main-tabs .nav-link.tab-supervision.active {
    background: linear-gradient(145deg, #86efac, #10b981) !important;
    color: #ffffff !important;
    border-color: rgba(255, 255, 255, 0.45) !important;
    box-shadow: 0 6px 16px -2px rgba(16, 185, 129, 0.42),
        inset 2px 2px 4px rgba(255, 255, 255, 0.75),
        inset -2px -2px 4px rgba(0, 0, 0, 0.12) !important;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2) !important;
}

/* --- 5. ڕێبەرێن پۆلان (Class Mentors: Soft Strawberry Rose / Coral Pink) --- */
.custom-main-tabs .nav-link.tab-mentors {
    background: rgba(244, 63, 94, 0.18) !important;
    color: #be123c !important;
    border-color: rgba(244, 63, 94, 0.35) !important;
    box-shadow: inset 1px 1px 2px rgba(255, 255, 255, 0.8), 0 2px 6px rgba(244, 63, 94, 0.12) !important;
}

.custom-main-tabs .nav-link.tab-mentors:hover {
    background: rgba(244, 63, 94, 0.26) !important;
    color: #881337 !important;
    border-color: rgba(244, 63, 94, 0.48) !important;
    box-shadow: 0 4px 12px rgba(244, 63, 94, 0.22), inset 1px 1px 2px rgba(255, 255, 255, 0.9) !important;
    transform: translateY(-2px) scale(1.02) !important;
}

.custom-main-tabs .nav-link.tab-mentors.active {
    background: linear-gradient(145deg, #fda4af, #f43f5e) !important;
    color: #ffffff !important;
    border-color: rgba(255, 255, 255, 0.45) !important;
    box-shadow: 0 6px 16px -2px rgba(244, 63, 94, 0.42),
        inset 2px 2px 4px rgba(255, 255, 255, 0.75),
        inset -2px -2px 4px rgba(0, 0, 0, 0.12) !important;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2) !important;
}

/* --- 6. نصاب وانان (Quotas / Nisab: Soft Golden Amber / Honey) --- */
.custom-main-tabs .nav-link.tab-nisab {
    background: rgba(245, 158, 11, 0.18) !important;
    color: #b45309 !important;
    border-color: rgba(245, 158, 11, 0.35) !important;
    box-shadow: inset 1px 1px 2px rgba(255, 255, 255, 0.8), 0 2px 6px rgba(245, 158, 11, 0.12) !important;
}

.custom-main-tabs .nav-link.tab-nisab:hover {
    background: rgba(245, 158, 11, 0.26) !important;
    color: #78350f !important;
    border-color: rgba(245, 158, 11, 0.48) !important;
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.22), inset 1px 1px 2px rgba(255, 255, 255, 0.9) !important;
    transform: translateY(-2px) scale(1.02) !important;
}

.custom-main-tabs .nav-link.tab-nisab.active {
    background: linear-gradient(145deg, #fcd34d, #f59e0b) !important;
    color: #ffffff !important;
    border-color: rgba(255, 255, 255, 0.45) !important;
    box-shadow: 0 6px 16px -2px rgba(245, 158, 11, 0.42),
        inset 2px 2px 4px rgba(255, 255, 255, 0.75),
        inset -2px -2px 4px rgba(0, 0, 0, 0.12) !important;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2) !important;
}

/* --- 7. فۆڕما ڕێکخستنا میلاکی (Staff Cadre / Milak: Soft Marine Teal / Turquoise) --- */
.custom-main-tabs .nav-link.tab-milak {
    background: rgba(20, 184, 166, 0.18) !important;
    color: #0f766e !important;
    border-color: rgba(20, 184, 166, 0.35) !important;
    box-shadow: inset 1px 1px 2px rgba(255, 255, 255, 0.8), 0 2px 6px rgba(20, 184, 166, 0.12) !important;
}

.custom-main-tabs .nav-link.tab-milak:hover {
    background: rgba(20, 184, 166, 0.26) !important;
    color: #134e4a !important;
    border-color: rgba(20, 184, 166, 0.48) !important;
    box-shadow: 0 4px 12px rgba(20, 184, 166, 0.22), inset 1px 1px 2px rgba(255, 255, 255, 0.9) !important;
    transform: translateY(-2px) scale(1.02) !important;
}

.custom-main-tabs .nav-link.tab-milak.active {
    background: linear-gradient(145deg, #5eead4, #14b8a6) !important;
    color: #ffffff !important;
    border-color: rgba(255, 255, 255, 0.45) !important;
    box-shadow: 0 6px 16px -2px rgba(20, 184, 166, 0.42),
        inset 2px 2px 4px rgba(255, 255, 255, 0.75),
        inset -2px -2px 4px rgba(0, 0, 0, 0.12) !important;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2) !important;
}

/* --- 8. ئامار و داتا (Statistics & Data: Soft Orchid Magenta / Pink Pearl) --- */
.custom-main-tabs .nav-link.tab-statistics {
    background: rgba(217, 70, 239, 0.18) !important;
    color: #a21caf !important;
    border-color: rgba(217, 70, 239, 0.35) !important;
    box-shadow: inset 1px 1px 2px rgba(255, 255, 255, 0.8), 0 2px 6px rgba(217, 70, 239, 0.12) !important;
}

.custom-main-tabs .nav-link.tab-statistics:hover {
    background: rgba(217, 70, 239, 0.26) !important;
    color: #701a75 !important;
    border-color: rgba(217, 70, 239, 0.48) !important;
    box-shadow: 0 4px 12px rgba(217, 70, 239, 0.22), inset 1px 1px 2px rgba(255, 255, 255, 0.9) !important;
    transform: translateY(-2px) scale(1.02) !important;
}

.custom-main-tabs .nav-link.tab-statistics.active {
    background: linear-gradient(145deg, #f0abfc, #d946ef) !important;
    color: #ffffff !important;
    border-color: rgba(255, 255, 255, 0.45) !important;
    box-shadow: 0 6px 16px -2px rgba(217, 70, 239, 0.42),
        inset 2px 2px 4px rgba(255, 255, 255, 0.75),
        inset -2px -2px 4px rgba(0, 0, 0, 0.12) !important;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2) !important;
}

/* ==========================================================================
   DARK MODE OVERRIDES FOR NAVIGATION TABS
   ========================================================================== */
[data-bs-theme="dark"] .custom-main-tabs .nav-link.tab-distribution {
    background: rgba(99, 102, 241, 0.18) !important;
    color: #c7d2fe !important;
    border-color: rgba(99, 102, 241, 0.35) !important;
}

[data-bs-theme="dark"] .custom-main-tabs .nav-link.tab-timetable {
    background: rgba(14, 165, 233, 0.18) !important;
    color: #bae6fd !important;
    border-color: rgba(14, 165, 233, 0.35) !important;
}

[data-bs-theme="dark"] .custom-main-tabs .nav-link.tab-substitute {
    background: rgba(168, 85, 247, 0.18) !important;
    color: #e9d5ff !important;
    border-color: rgba(168, 85, 247, 0.35) !important;
}

[data-bs-theme="dark"] .custom-main-tabs .nav-link.tab-supervision {
    background: rgba(16, 185, 129, 0.18) !important;
    color: #a7f3d0 !important;
    border-color: rgba(16, 185, 129, 0.35) !important;
}

[data-bs-theme="dark"] .custom-main-tabs .nav-link.tab-mentors {
    background: rgba(244, 63, 94, 0.18) !important;
    color: #fecdd3 !important;
    border-color: rgba(244, 63, 94, 0.35) !important;
}

[data-bs-theme="dark"] .custom-main-tabs .nav-link.tab-nisab {
    background: rgba(245, 158, 11, 0.18) !important;
    color: #fde68a !important;
    border-color: rgba(245, 158, 11, 0.35) !important;
}

[data-bs-theme="dark"] .custom-main-tabs .nav-link.tab-milak {
    background: rgba(20, 184, 166, 0.18) !important;
    color: #99f6e4 !important;
    border-color: rgba(20, 184, 166, 0.35) !important;
}

[data-bs-theme="dark"] .custom-main-tabs .nav-link.tab-statistics {
    background: rgba(217, 70, 239, 0.18) !important;
    color: #f5d0fe !important;
    border-color: rgba(217, 70, 239, 0.35) !important;
}

/* ==========================================================================
   COMPREHENSIVE UNIVERSAL RESPONSIVE SYSTEM (متناسب مع جميع مقاييس الشاشات)
   Desktops (4K, 2K, 1080p), Laptops, iPads & Tablets, and Mobile Devices
   ========================================================================== */

/* 1. Global Fluid Layout Container */
.main-container {
    width: 100% !important;
    max-width: 1920px !important;
    margin-left: auto !important;
    margin-right: auto !important;
    padding-left: clamp(8px, 1.6vw, 24px) !important;
    padding-right: clamp(8px, 1.6vw, 24px) !important;
    box-sizing: border-box !important;
}

/* 2. Universal Navigation Tabs Grid Breakpoints */
/* Desktops & Ultrawide (> 1360px): 1 Row of 9 Tabs */
@media (min-width: 1361px) {
    .custom-main-tabs {
        grid-template-columns: repeat(9, 1fr) !important;
        gap: 0.45rem !important;
    }}

/* Laptops, MacBooks, Tablets & iPads (768px - 1360px): Exactly 2 balanced Rows of 4 Tabs */
@media (max-width: 1360px) and (min-width: 768px) {
    .custom-main-tabs {
        grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)) !important;
        gap: 0.45rem !important;
    }

    .custom-main-tabs .nav-link {
        font-size: clamp(0.76rem, 0.95vw, 0.82rem) !important;
        padding: 0.42rem 0.55rem !important;
        min-height: 38px !important;
    }}

/* Mobile Devices & Small Tablets (<= 767px): Native App-Like Horizontal Swipeable Ribbon */
@media (max-width: 767px) {
    .main-tabs-card {
        padding: 0.35rem 0.4rem !important;
        border-radius: 16px !important;
        margin-bottom: 0.5rem !important;
        overflow: hidden !important;
    }

    .custom-main-tabs {
        display: flex !important;
        flex-wrap: nowrap !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
        scrollbar-width: none !important;
        gap: 0.35rem !important;
        padding: 2px 2px !important;
        width: 100% !important;
    }

    .custom-main-tabs::-webkit-scrollbar {
        display: none !important;
    }

    .custom-main-tabs .nav-item {
        flex: 0 0 auto !important;
        width: auto !important;
    }

    .custom-main-tabs .nav-link {
        white-space: nowrap !important;
        font-size: 0.79rem !important;
        font-weight: 700 !important;
        padding: 0.4rem 0.85rem !important;
        min-height: 36px !important;
        gap: 0.4rem !important;
        border-radius: 50px !important;
    }

    .custom-main-tabs .nav-link i {
        font-size: 0.82rem !important;
    }}

/* 3. Top Header Bar Mobile Architecture */
@media (max-width: 991px) {
    .top-header-card {
        padding: 0.55rem 0.85rem !important;
        border-radius: 16px !important;
    }

    .header-app-title {
        font-size: 1.05rem !important;
    }}

@media (max-width: 767px) {
    .top-header-card {
        padding: 0.5rem 0.75rem !important;
        border-radius: 18px !important;
        margin-bottom: 0.5rem !important;
    }

    .top-header-card>div {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 0.5rem !important;
    }

    .app-branding {
        justify-content: center !important;
        text-align: center !important;
    }

    .header-app-title {
        font-size: 1.05rem !important;
    }

    .header-divider {
        display: none !important;
    }

    .header-controls {
        display: flex !important;
        flex-direction: row !important;
        flex-wrap: nowrap !important;
        align-items: center !important;
        justify-content: space-between !important;
        width: 100% !important;
        gap: 6px !important;
    }

    .header-group-schedule {
        display: inline-flex !important;
        align-items: center !important;
        gap: 4px !important;
        flex: 1 1 auto !important;
        min-width: 0 !important;
    }

    #scheduleDropdownContainer {
        flex: 1 1 auto !important;
        min-width: 0 !important;
    }

    .header-active-schedule-btn {
        width: 100% !important;
        min-width: 0 !important;
        max-width: 100% !important;
        height: 34px !important;
        padding: 0.25rem 0.5rem !important;
        font-size: 0.78rem !important;
        gap: 0.35rem !important;
    }

    .header-active-schedule-btn span#activeScheduleLabel {
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        white-space: nowrap !important;
        display: inline-block !important;
        max-width: 80px !important;
    }

    .header-schedule-icon-badge {
        width: 20px !important;
        height: 20px !important;
        font-size: 0.7rem !important;
    }

    .header-circle-btn {
        width: 33px !important;
        height: 33px !important;
        min-width: 33px !important;
        min-height: 33px !important;
        flex-shrink: 0 !important;
    }

    .header-group-system {
        display: inline-flex !important;
        align-items: center !important;
        gap: 5px !important;
        flex-shrink: 0 !important;
    }

    .header-theme-clay-track {
        width: 56px !important;
        height: 32px !important;
    }

    .theme-knob-clay {
        width: 24px !important;
        height: 24px !important;
        top: 3px !important;
    }

    .header-theme-checkbox:checked+.header-theme-clay-track .theme-knob-clay {
        left: calc(100% - 28px) !important;
    }}

/* 4. Toolbars & Action Buttons Universal Responsiveness */
.distribution-toolbar-card {
    transition: all 0.25s ease;
}

@media (max-width: 1200px) {
    .distribution-toolbar-card {
        padding: 0.65rem 0.95rem !important;
    }

    .distribution-toolbar-card .btn {
        padding: 0.35rem 0.8rem !important;
        font-size: 0.8rem !important;
        min-height: 34px !important;
        gap: 0.35rem !important;
    }

    .toolbar-row-actions {
        gap: 0.5rem !important;
    }

    .toolbar-group {
        gap: 0.35rem !important;
    }}

/* ==========================================================
   DEDICATED TABLET LAYOUT (ALL iPad Models & Tablets: 768px - 1024px)
   (iPad Mini 768px, iPad 9.7"/10.2"/10.5", iPad Air 820px, iPad Pro 11" 834px, iPad Pro 12.9" portrait / standard iPad landscape 1024px)
   ========================================================== */
@media (min-width: 768px) and (max-width: 1024px) {

    /* 1. Base Tablet Toolbar Card */
    .distribution-toolbar-card {
        padding: 0.65rem 0.95rem !important;
        border-radius: 18px !important;
        margin-bottom: 0.75rem !important;
    }

    /* All buttons on iPad maintain compact, natural pill proportions - NO stretched giant blocks! */
    .distribution-toolbar-card .btn,
    .distribution-toolbar-card .btn-group>.btn {
        width: auto !important;
        min-width: 0 !important;
        padding: 0.32rem 0.68rem !important;
        font-size: 0.78rem !important;
        font-weight: 700 !important;
        border-radius: 50px !important;
        min-height: 33px !important;
        height: auto !important;
        white-space: nowrap !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        gap: 0.3rem !important;
    }

    .distribution-toolbar-card .btn i,
    .distribution-toolbar-card .btn-group>.btn i {
        font-size: 0.8rem !important;
    }

    /* Elegant subtle vertical divider between functional clusters */
    .toolbar-divider {
        display: inline-block !important;
        width: 1.5px !important;
        height: 20px !important;
        background: rgba(148, 163, 184, 0.4) !important;
        margin: 0 0.25rem !important;
        align-self: center !important;
    }

    [data-bs-theme="dark"] .toolbar-divider {
        background: rgba(255, 255, 255, 0.2) !important;
    }

    /* Labels inside groups */
    .toolbar-group-label {
        font-size: 0.77rem !important;
        font-weight: 700 !important;
        margin-inline-end: 0.2rem !important;
        white-space: nowrap !important;
    }

    /* Universal tablet actions row: strictly flex-start, cohesive grouping, NO stray floating buttons */
    .toolbar-row-actions {
        display: flex !important;
        flex-direction: row !important;
        align-items: center !important;
        justify-content: flex-start !important;
        flex-wrap: wrap !important;
        gap: 0.35rem !important;
        width: 100% !important;
    }

    .toolbar-group,
    .toolbar-group-build,
    .toolbar-group-export,
    .toolbar-group-system {
        display: inline-flex !important;
        flex-direction: row !important;
        align-items: center !important;
        flex-wrap: nowrap !important;
        gap: 0.3rem !important;
        width: auto !important;
        margin: 0 !important;
        border: none !important;
        padding: 0 !important;
    }

    /* Prevent system/clear group from pushing to the far edge */
    .toolbar-group-system {
        margin-inline-start: 0 !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
    }

    /* Select clay capsules on tablet */
    .tt-select-clay-capsule {
        height: 33px !important;
        min-height: 33px !important;
        padding: 2px 8px !important;
        border-radius: 50px !important;
    }

    .tt-context-clay-badge {
        height: 33px !important;
        min-height: 33px !important;
        padding: 2px 8px !important;
        border-radius: 50px !important;
        font-size: 0.78rem !important;
        gap: 4px !important;
    }

    /* --------------------------------------------------
       1. DISTRIBUTION TAB (iPad)
       -------------------------------------------------- */
    #distribution-tab-pane .toolbar-row-view {
        display: flex !important;
        flex-direction: row !important;
        align-items: center !important;
        justify-content: space-between !important;
        flex-wrap: nowrap !important;
        gap: 0.45rem !important;
        width: 100% !important;
        padding-bottom: 0.45rem !important;
        margin-bottom: 0.45rem !important;
        border-bottom: 1px solid rgba(226, 232, 240, 0.9) !important;
    }

    #distribution-tab-pane .toolbar-group-views {
        display: inline-flex !important;
        align-items: center !important;
        gap: 0.3rem !important;
        flex: 1 1 auto !important;
        flex-wrap: nowrap !important;
    }

    #distribution-tab-pane .search-panel {
        max-width: 200px !important;
        min-width: 140px !important;
        flex: 0 1 200px !important;
        margin: 0 !important;
    }

    /* Actions 2-Row Architecture: Row 1 = Build, Row 2 = Export + System */
    #distribution-tab-pane .toolbar-row-actions {
        display: flex !important;
        flex-direction: row !important;
        align-items: center !important;
        justify-content: flex-start !important;
        flex-wrap: wrap !important;
        gap: 0.35rem !important;
        width: 100% !important;
    }

    #distribution-tab-pane .toolbar-group-build {
        width: 100% !important;
        display: flex !important;
        flex-direction: row !important;
        align-items: center !important;
        justify-content: flex-start !important;
        flex-wrap: nowrap !important;
        gap: 0.35rem !important;
        padding-bottom: 0.4rem !important;
        margin-bottom: 0.15rem !important;
        border-bottom: 1px dashed rgba(226, 232, 240, 0.8) !important;
    }

    [data-bs-theme="dark"] #distribution-tab-pane .toolbar-group-build {
        border-bottom-color: rgba(255, 255, 255, 0.1) !important;
    }

    #distribution-tab-pane .toolbar-group-build+.toolbar-divider {
        display: none !important;
    }

    #distribution-tab-pane .toolbar-group-export,
    #distribution-tab-pane .toolbar-group-system {
        display: inline-flex !important;
        flex-direction: row !important;
        align-items: center !important;
        flex-wrap: nowrap !important;
        gap: 0.3rem !important;
        width: auto !important;
        margin: 0 !important;
    }

    /* --------------------------------------------------
       2. TIMETABLE TAB (iPad: Balanced Luxury Shelf)
       -------------------------------------------------- */
    #timetable-tab-pane .toolbar-row-view {
        display: flex !important;
        flex-direction: row !important;
        align-items: center !important;
        justify-content: space-between !important;
        flex-wrap: nowrap !important;
        gap: 0.5rem !important;
        width: 100% !important;
        padding: 0 4px 0.45rem 4px !important;
        margin-bottom: 0.45rem !important;
        border-bottom: 1px solid rgba(226, 232, 240, 0.9) !important;
    }

    [data-bs-theme="dark"] #timetable-tab-pane .toolbar-row-view {
        border-bottom-color: rgba(255, 255, 255, 0.1) !important;
    }

    #timetable-tab-pane .toolbar-group-views {
        display: inline-flex !important;
        width: auto !important;
        flex: 0 1 auto !important;
        flex-wrap: nowrap !important;
        align-items: center !important;
        gap: 0.35rem !important;
    }

    #timetable-tab-pane .tt-view-btn-group {
        display: inline-flex !important;
        width: auto !important;
        flex-wrap: nowrap !important;
        gap: 2px !important;
    }

    #timetable-tab-pane .tt-view-btn-group .btn {
        padding: 0.28rem 0.52rem !important;
        font-size: 0.76rem !important;
        white-space: nowrap !important;
    }

    /* Redundant context badge in Tab 2 on iPad hides to keep view row on one single clean line */
    #timetable-tab-pane .tt-context-clay-badge {
        display: none !important;
    }

    #timetable-tab-pane .tt-select-clay-capsule {
        max-width: 185px !important;
        min-width: 135px !important;
        flex: 0 1 185px !important;
        margin: 0 !important;
        padding: 2px 8px !important;
    }

    #timetable-tab-pane .tt-clay-select {
        font-size: 0.77rem !important;
        font-weight: 700 !important;
    }

    /* Actions Container: 2 Dedicated Rows (Row 2 = Build, Row 3 = Export & Clear) */
    #timetable-tab-pane .toolbar-row-actions {
        display: flex !important;
        flex-direction: row !important;
        align-items: center !important;
        justify-content: flex-start !important;
        flex-wrap: wrap !important;
        gap: 0.35rem !important;
        width: 100% !important;
        padding: 0 4px !important;
    }

    /* Row 2: Construction Tools - Uniform balanced 4-pill shelf */
    #timetable-tab-pane .toolbar-group-build {
        width: 100% !important;
        display: flex !important;
        flex-direction: row !important;
        align-items: center !important;
        justify-content: flex-start !important;
        flex-wrap: nowrap !important;
        gap: 0.35rem !important;
        padding-bottom: 0.4rem !important;
        margin-bottom: 0.15rem !important;
        border-bottom: 1px dashed rgba(226, 232, 240, 0.8) !important;
    }

    [data-bs-theme="dark"] #timetable-tab-pane .toolbar-group-build {
        border-bottom-color: rgba(255, 255, 255, 0.1) !important;
    }

    #timetable-tab-pane .toolbar-group-build .btn {
        flex: 1 1 0 !important;
        min-width: 0 !important;
        padding: 0.32rem 0.4rem !important;
        font-size: 0.74rem !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        justify-content: center !important;
    }

    /* Hide dividers between shelves */
    #timetable-tab-pane .toolbar-divider {
        display: none !important;
    }

    /* Row 3: Export & Print on Right, Clear on Left */
    #timetable-tab-pane .toolbar-group-export {
        display: inline-flex !important;
        flex-direction: row !important;
        align-items: center !important;
        flex-wrap: nowrap !important;
        gap: 0.35rem !important;
        width: auto !important;
        margin: 0 !important;
    }

    #timetable-tab-pane .toolbar-group-system {
        display: inline-flex !important;
        flex-direction: row !important;
        align-items: center !important;
        margin: 0 !important;
        margin-inline-start: auto !important;
        width: auto !important;
    }

    #timetable-tab-pane .toolbar-group-export .btn,
    #timetable-tab-pane .toolbar-group-system .btn {
        padding: 0.32rem 0.65rem !important;
        font-size: 0.76rem !important;
        min-height: 33px !important;
        white-space: nowrap !important;
    }

    /* --------------------------------------------------
       7. MILAK TAB (iPad)
       -------------------------------------------------- */
    #milak-tab-pane .toolbar-row-view {
        display: flex !important;
        flex-direction: row !important;
        align-items: center !important;
        justify-content: space-between !important;
        gap: 0.5rem !important;
        width: 100% !important;
        padding-bottom: 0.45rem !important;
        margin-bottom: 0.45rem !important;
    }

    #milak-tab-pane .toolbar-row-actions {
        display: flex !important;
        flex-direction: row !important;
        align-items: center !important;
        justify-content: flex-start !important;
        gap: 0.35rem !important;
        width: 100% !important;
    }

    #milak-tab-pane .toolbar-row-actions>div {
        display: inline-flex !important;
        align-items: center !important;
        gap: 0.35rem !important;
        width: auto !important;
    }}

/* Mobile Structured Toolbar Layout (<= 767px) */
@media (max-width: 767px) {
    .distribution-toolbar-card {
        padding: 0.65rem 0.65rem !important;
        border-radius: 18px !important;
        margin-bottom: 0.65rem !important;
    }

    /* Hide redundant text labels 'عرض' and 'بناء' on mobile */
    .toolbar-group-label {
        display: none !important;
    }

    .toolbar-divider {
        display: none !important;
    }

    /* Row 1: Views & Search */
    .toolbar-row-view {
        display: flex !important;
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 0.45rem !important;
        padding-bottom: 0.45rem !important;
        margin-bottom: 0.45rem !important;
    }

    /* Search input always on top, full width, sleek pill */
    .search-panel {
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        order: -1 !important;
        margin-bottom: 0.15rem !important;
    }

    .search-panel input {
        height: 36px !important;
        min-height: 36px !important;
        font-size: 0.82rem !important;
        border-radius: 50px !important;
    }

    /* View Mode buttons: Row 1 (2 equal columns), Row 2 (Full-width Stage Selector) */
    .toolbar-group-views {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 0.35rem !important;
        width: 100% !important;
    }

    .toolbar-group-views .btn,
    .toolbar-group-views .btn-group {
        width: 100% !important;
        min-width: 0 !important;
    }

    .toolbar-group-views .btn {
        padding: 0.38rem 0.45rem !important;
        font-size: 0.77rem !important;
        min-height: 35px !important;
        justify-content: center !important;
        white-space: nowrap !important;
    }

    /* Stage Selector spans 100% full width with zero text clipping */
    .toolbar-group-views .btn-group:last-child,
    #stageSelectorBtn {
        grid-column: 1 / -1 !important;
        width: 100% !important;
    }

    /* Row 2: Action Buttons */
    .toolbar-row-actions {
        display: flex !important;
        flex-direction: column !important;
        gap: 0.45rem !important;
        width: 100% !important;
    }

    /* Primary Creation Group: Balanced 2-column grid (خشتێ نوی, ماموستا / پول, دابەشکرنا نصابی) */
    .toolbar-group-build {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 0.35rem !important;
        width: 100% !important;
    }

    .toolbar-group-build .btn,
    .toolbar-group-build .btn-group {
        width: 100% !important;
        min-width: 0 !important;
    }

    .toolbar-group-build .btn {
        padding: 0.38rem 0.45rem !important;
        font-size: 0.77rem !important;
        min-height: 35px !important;
        justify-content: center !important;
        white-space: nowrap !important;
    }

    /* Secondary Export & Print Group: Perfectly balanced 2-column grid (هیلان و هەور, ئێكسێل / HTML, چاپكرن) */
    .toolbar-group-export {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 0.35rem !important;
        width: 100% !important;
        padding-top: 0.35rem !important;
        border-top: 1px dashed rgba(226, 232, 240, 0.9) !important;
    }

    .toolbar-group-export .btn,
    .toolbar-group-export .btn-group {
        width: 100% !important;
        min-width: 0 !important;
    }

    .toolbar-group-export .btn {
        padding: 0.38rem 0.45rem !important;
        font-size: 0.76rem !important;
        min-height: 35px !important;
        justify-content: center !important;
        white-space: nowrap !important;
    }

    /* System & Settings Group: Perfectly balanced 2-column grid (رێكخستن, ژێبرن) */
    .toolbar-group-system {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 0.35rem !important;
        width: 100% !important;
        padding-top: 0.35rem !important;
        border-top: 1px dashed rgba(226, 232, 240, 0.9) !important;
    }

    .toolbar-group-system .btn,
    .toolbar-group-system .btn-group {
        width: 100% !important;
        min-width: 0 !important;
    }

    .toolbar-group-system .btn {
        padding: 0.38rem 0.45rem !important;
        font-size: 0.76rem !important;
        min-height: 35px !important;
        justify-content: center !important;
        white-space: nowrap !important;
    }

    [data-bs-theme="dark"] .toolbar-group-export,
    [data-bs-theme="dark"] .toolbar-group-system {
        border-top-color: rgba(255, 255, 255, 0.1) !important;
    }}

/* Timetable Toolbar Dedicated Responsive Mobile Layout (<= 767px) */
@media (max-width: 767px) {

    /* Container & Toolbar card overflow containment */
    #timetable-tab-pane {
        max-width: 100% !important;
        overflow-x: hidden !important;
    }

    #timetable-tab-pane .distribution-toolbar-card {
        max-width: 100% !important;
        overflow: hidden !important;
        box-sizing: border-box !important;
    }

    /* 1. Timetable Toolbar Row View (Column flow on mobile) */
    #timetable-tab-pane .toolbar-row-view {
        display: flex !important;
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 0.45rem !important;
        padding-bottom: 0.45rem !important;
        margin-bottom: 0.45rem !important;
        width: 100% !important;
        max-width: 100% !important;
        overflow: hidden !important;
        box-sizing: border-box !important;
    }

    #timetable-tab-pane .toolbar-group-views {
        display: block !important;
        width: 100% !important;
        max-width: 100% !important;
        overflow: hidden !important;
        box-sizing: border-box !important;
    }

    /* 2. All 4 View Modes in a Perfect Balanced 2x2 Grid (خشتێ پولا, خشتێ ماموستا / ماستر پولان, ماستر ماموستایان) */
    #timetable-tab-pane .tt-view-btn-group,
    #timetable-tab-pane .toolbar-group-views .btn-group,
    #timetable-tab-pane .toolbar-group-views .btn-group[role="group"],
    #timetable-tab-pane .btn-group[role="group"] {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 0.35rem !important;
        width: 100% !important;
        max-width: 100% !important;
        border-radius: 16px !important;
        padding: 4px !important;
        overflow: hidden !important;
        box-sizing: border-box !important;
        flex-wrap: wrap !important;
    }

    #timetable-tab-pane .tt-view-btn-group input.btn-check,
    #timetable-tab-pane .toolbar-group-views input.btn-check {
        position: absolute !important;
        opacity: 0 !important;
        pointer-events: none !important;
        width: 0 !important;
        height: 0 !important;
        margin: 0 !important;
        padding: 0 !important;
        display: none !important;
    }

    #timetable-tab-pane .tt-view-btn-group label.btn,
    #timetable-tab-pane .toolbar-group-views label.btn {
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        border-radius: 12px !important;
        font-size: 0.74rem !important;
        font-weight: 700 !important;
        padding: 0.42rem 0.25rem !important;
        min-height: 35px !important;
        height: auto !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        text-align: center !important;
        white-space: nowrap !important;
        margin: 0 !important;
        box-sizing: border-box !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
    }

    /* 3. Filter Selector Row: Full width 100% */
    #timetable-tab-pane .toolbar-row-view>div:last-child {
        width: 100% !important;
        display: flex !important;
    }

    #timetable-tab-pane .tt-select-clay-capsule {
        width: 100% !important;
        max-width: 100% !important;
        flex: 1 1 100% !important;
        min-width: 0 !important;
        margin: 0 !important;
        height: 36px !important;
        min-height: 36px !important;
        border-radius: 50px !important;
    }

    #timetable-tab-pane .tt-clay-select {
        flex: 1 1 auto !important;
        width: 100% !important;
        font-size: 0.82rem !important;
        font-weight: 700 !important;
    }

    /* Hide redundant duplicate tab badge on mobile (already selected at top navigation) */
    #timetable-tab-pane .tt-context-clay-badge {
        display: none !important;
    }

    /* 4. Action Buttons Groups */
    #timetable-tab-pane .toolbar-group-build {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 0.35rem !important;
        width: 100% !important;
    }

    #timetable-tab-pane .toolbar-group-build .btn {
        width: 100% !important;
        min-width: 0 !important;
        padding: 0.38rem 0.45rem !important;
        font-size: 0.77rem !important;
        min-height: 35px !important;
        justify-content: center !important;
        white-space: nowrap !important;
    }

    #timetable-tab-pane .toolbar-group-export {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 0.35rem !important;
        width: 100% !important;
        padding-top: 0.35rem !important;
        border-top: 1px dashed rgba(226, 232, 240, 0.9) !important;
    }

    #timetable-tab-pane .toolbar-group-export .btn-group,
    #timetable-tab-pane .toolbar-group-export .btn {
        width: 100% !important;
        min-width: 0 !important;
    }

    #timetable-tab-pane .toolbar-group-export .btn {
        padding: 0.38rem 0.45rem !important;
        font-size: 0.76rem !important;
        min-height: 35px !important;
        justify-content: center !important;
        white-space: nowrap !important;
    }

    /* 5. Clear Timetable: Sleek Full-width Bottom Reset Bar */
    #timetable-tab-pane .toolbar-group-system {
        display: block !important;
        width: 100% !important;
        padding-top: 0.35rem !important;
        border-top: 1px dashed rgba(226, 232, 240, 0.9) !important;
    }

    [data-bs-theme="dark"] #timetable-tab-pane .toolbar-group-export,
    [data-bs-theme="dark"] #timetable-tab-pane .toolbar-group-system {
        border-top-color: rgba(255, 255, 255, 0.1) !important;
    }

    /* ==========================================================
       MILAK FORM TAB TOOLBAR MOBILE OPTIMIZATION
       ========================================================== */
    /* 1. Row 1: View Toggle (Col 1) & Year Badge (Col 2) Side-by-Side */
    #milak-tab-pane .toolbar-row-view {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 0.45rem !important;
        padding-bottom: 0.45rem !important;
        margin-bottom: 0.45rem !important;
    }

    #milak-tab-pane .toolbar-row-view>div:first-child {
        grid-column: 1 / 2 !important;
        width: 100% !important;
        display: flex !important;
    }

    #milak-tab-pane .toolbar-row-view>div:first-child .btn {
        width: 100% !important;
        height: 36px !important;
        min-height: 36px !important;
        font-size: 0.77rem !important;
        font-weight: 700 !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        white-space: nowrap !important;
        margin: 0 !important;
        border-radius: 50px !important;
    }

    /* Hide redundant duplicate title pill on mobile (already selected at top navigation) */
    #milak-tab-pane .toolbar-row-view>div:nth-child(2) {
        display: none !important;
    }

    /* Year Badge (Col 2) */
    #milak-tab-pane .toolbar-row-view>div:last-child {
        grid-column: 2 / 3 !important;
        width: 100% !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        margin: 0 !important;
    }

    #milak-tab-pane .toolbar-row-view>div:last-child .badge {
        width: 100% !important;
        height: 36px !important;
        min-height: 36px !important;
        border-radius: 50px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        gap: 4px !important;
        font-size: 0.78rem !important;
        font-weight: 700 !important;
        padding: 2px 8px !important;
    }

    /* 2. Row 2 & 3: Export & Print Actions */
    #milak-tab-pane .toolbar-row-actions {
        display: block !important;
        width: 100% !important;
    }

    #milak-tab-pane .toolbar-row-actions>div {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 0.35rem !important;
        width: 100% !important;
    }

    /* Excel (Col 1) */
    #milak-tab-pane .btn-tb-excel {
        grid-column: 1 / 2 !important;
        width: 100% !important;
        min-width: 0 !important;
        padding: 0.38rem 0.45rem !important;
        font-size: 0.77rem !important;
        min-height: 35px !important;
        justify-content: center !important;
        white-space: nowrap !important;
    }

    /* HTML (Col 2) */
    #milak-tab-pane .btn-tb-html {
        grid-column: 2 / 3 !important;
        width: 100% !important;
        min-width: 0 !important;
        padding: 0.38rem 0.45rem !important;
        font-size: 0.77rem !important;
        min-height: 35px !important;
        justify-content: center !important;
        white-space: nowrap !important;
    }

    /* Print: Full-width bottom bar */
    #milak-tab-pane .btn-tb-print {
        grid-column: 1 / -1 !important;
        width: 100% !important;
        min-width: 0 !important;
        min-height: 36px !important;
        font-size: 0.78rem !important;
        font-weight: 700 !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        gap: 6px !important;
        border-radius: 50px !important;
        margin-top: 0.15rem !important;
        box-shadow: 0 2px 8px rgba(168, 85, 247, 0.22) !important;
    }}

/* 5. Responsive Select Capsules & Filters */
.toolbar-sub-filters {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    transition: all 0.25s ease;
}

@media (max-width: 991px) {
    .toolbar-sub-filters {
        width: 100% !important;
        justify-content: flex-start !important;
        margin-top: 0.25rem !important;
        padding-top: 0.35rem !important;
        border-top: 1px dashed rgba(226, 232, 240, 0.8) !important;
    }

    [data-bs-theme="dark"] .toolbar-sub-filters {
        border-top-color: rgba(255, 255, 255, 0.1) !important;
    }}

@media (max-width: 576px) {
    .toolbar-sub-filters {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 0.45rem !important;
        width: 100% !important;
    }

    .toolbar-sub-filters .tt-select-clay-capsule {
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        justify-content: space-between !important;
    }

    .toolbar-sub-filters .tt-clay-select {
        flex: 1 1 auto !important;
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
    }}

/* 6. Universal Smooth Inertia Touch Scrolling for Tables */
.table-responsive {
    -webkit-overflow-scrolling: touch !important;
    scrollbar-width: thin !important;
    scrollbar-color: rgba(99, 102, 241, 0.35) rgba(0, 0, 0, 0.04) !important;
}

.table-responsive::-webkit-scrollbar {
    height: 7px !important;
    width: 7px !important;
}

.table-responsive::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.03) !important;
    border-radius: 10px !important;
}

.table-responsive::-webkit-scrollbar-thumb {
    background: linear-gradient(90deg, #a5b4fc, #6366f1) !important;
    border-radius: 10px !important;
}

[data-bs-theme="dark"] .table-responsive::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.04) !important;
}

[data-bs-theme="dark"] .table-responsive::-webkit-scrollbar-thumb {
    background: linear-gradient(90deg, #4338ca, #6366f1) !important;
}

/* Mobile Table Cells Compact Padding */
@media (max-width: 767px) {

    .table td,
    .table th {
        padding: 5px 4px !important;
        font-size: 0.78rem !important;
    }

    .table .btn-sm {
        padding: 2px 4px !important;
        font-size: 0.7rem !important;
    }}

/* 7. Modal Windows Fluid Sizing on Mobile */
@media (max-width: 576px) {
    .modal-dialog {
        margin: 0.5rem !important;
        max-width: calc(100% - 1rem) !important;
    }

    .modal-content {
        border-radius: 18px !important;
    }}

/* ==========================================================================
   OFFICIAL MINISTRY TABLE FORMAT (خشتێ دابەشکرنا بەهرێن حەفتیانە یێ فەرمی)
   ========================================================================== */
.official-doc-container {
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 12px;
    padding: 16px;
    box-shadow: 0 4px 20px -2px rgba(0, 0, 0, 0.06);
    margin-bottom: 24px;
    transition: all 0.3s ease;
}

[data-bs-theme="dark"] .official-doc-container {
    background: #1e293b;
    border-color: #334155;
    box-shadow: 0 4px 20px -2px rgba(0, 0, 0, 0.3);
}

/* Official Document Header (Exact Match to Ministry Document Table) */
.official-top-header-table {
    width: 100%;
    border: 2px solid #0f172a;
    border-collapse: collapse;
    margin-bottom: 4px;
    background: #ffffff;
}

[data-bs-theme="dark"] .official-top-header-table {
    border-color: #94a3b8;
    background: #0f172a;
}

.official-top-header-table td {
    border: none;
    vertical-align: middle;
    padding: 1px 4px !important;
}

.official-staff-line {
    font-size: 0.68rem;
    font-weight: 700;
    color: #0f172a;
    line-height: 1.2;
}

[data-bs-theme="dark"] .official-staff-line {
    color: #f8fafc;
}

.official-main-title {
    font-size: 0.74rem;
    font-weight: 800;
    color: #0f172a;
    letter-spacing: 0.2px;
    margin-bottom: 0;
}

[data-bs-theme="dark"] .official-main-title {
    color: #f8fafc;
}

.official-doc-meta {
    font-size: 0.68rem;
    font-weight: 700;
    color: #1e293b;
    line-height: 1.2;
}

[data-bs-theme="dark"] .official-doc-meta {
    color: #cbd5e1;
}

.official-school-line {
    font-size: 0.68rem;
    color: #0f172a;
    line-height: 1.2;
}

[data-bs-theme="dark"] .official-school-line {
    color: #f8fafc;
}

.official-header-center {
    text-align: center;
    align-items: center;
    gap: 8px;
}

.official-main-title-badge {
    font-size: 1.20rem;
    font-weight: 900;
    color: #0f172a;
    border-bottom: 2px solid #0f172a;
    padding-bottom: 3px;
    letter-spacing: 0.5px;
    display: inline-block;
}

[data-bs-theme="dark"] .official-main-title-badge {
    color: #f8fafc;
    border-bottom-color: #94a3b8;
}

.official-doc-meta-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    font-size: 0.84rem;
    font-weight: 600;
    color: #334155;
    flex-wrap: wrap;
}

[data-bs-theme="dark"] .official-doc-meta-row {
    color: #cbd5e1;
}

.official-meta-item {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.official-header-left {
    align-items: flex-end;
    justify-content: center;
}

.official-staff-summary-table {
    border-collapse: collapse;
    border: 1.5px solid #0f172a;
    width: 100%;
    max-width: 220px;
    font-size: 0.76rem;
    background: #ffffff;
    margin-left: 0;
}

[data-bs-theme="dark"] .official-staff-summary-table {
    border-color: #94a3b8;
    background: #1e293b;
}

.official-staff-summary-table th,
.official-staff-summary-table td {
    border: 1px solid #0f172a;
    padding: 2.5px 6px;
    text-align: center;
    vertical-align: middle;
}

[data-bs-theme="dark"] .official-staff-summary-table th,
[data-bs-theme="dark"] .official-staff-summary-table td {
    border-color: #64748b;
}

.official-staff-summary-table th {
    background: #f1f5f9;
    font-weight: 700;
    text-align: right;
    color: #0f172a;
}

[data-bs-theme="dark"] .official-staff-summary-table th {
    background: #334155;
    color: #f8fafc;
}

.official-staff-sum-row {
    background: #e2e8f0;
    font-weight: 800;
}

[data-bs-theme="dark"] .official-staff-sum-row {
    background: #475569;
}

/* Official Editable Text Fields */
.official-editable-field {
    border-bottom: 1.5px dashed rgba(99, 102, 241, 0.45);
    padding: 1px 4px;
    outline: none;
    display: inline-block;
    min-width: 25px;
    border-radius: 3px;
    transition: all 0.2s ease;
}

.official-editable-field:hover,
.official-editable-field:focus {
    background: rgba(99, 102, 241, 0.12);
    border-bottom-color: #4f46e5;
}

.official-sub-table td[contenteditable="true"] {
    outline: none;
    cursor: text;
    transition: background 0.15s ease;
}

.official-sub-table td[contenteditable="true"]:focus {
    background-color: rgba(99, 102, 241, 0.1) !important;
    outline: 1.5px solid #6366f1 !important;
    outline-offset: -1px;
}

/* Official Ministry Table Structure */
.table-official-ministry {
    border: 2px solid #0f172a !important;
    border-collapse: collapse !important;
    width: 100% !important;
    table-layout: auto !important;
    font-size: 0.82rem !important;
    margin-bottom: 0 !important;
}

.official-col-nowrap {
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
}

[data-bs-theme="dark"] .table-official-ministry {
    border-color: #94a3b8 !important;
}

.table-official-ministry th,
.table-official-ministry td {
    border: 1.2px solid #0f172a !important;
    padding: 4px 3px !important;
    text-align: center !important;
    vertical-align: middle !important;
}

[data-bs-theme="dark"] .table-official-ministry th,
[data-bs-theme="dark"] .table-official-ministry td {
    border-color: #64748b !important;
}

.table-official-ministry thead th.official-th {
    background: #e2e8f0 !important;
    color: #0f172a !important;
    font-weight: 800 !important;
    font-size: 0.84rem !important;
}

[data-bs-theme="dark"] .table-official-ministry thead th.official-th {
    background: #334155 !important;
    color: #f8fafc !important;
}

/* Class Column Headers */
.official-class-col-header {
    min-width: 32px !important;
    padding: 3px 2px !important;
    white-space: nowrap !important;
}

.official-class-combined {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 2px;
    white-space: nowrap;
}

.official-grade-num {
    font-size: 0.78rem !important;
    font-weight: 800 !important;
    line-height: 1 !important;
}

.official-section-let {
    font-size: 0.82rem !important;
    font-weight: 700 !important;
    line-height: 1 !important;
}

/* Alternating Shading for Grade Columns (as in Official PDF) */
.official-col-white {
    background-color: #ffffff !important;
    color: #0f172a !important;
}

.official-col-shaded {
    background-color: #cbd5e1 !important;
    color: #0f172a !important;
}

[data-bs-theme="dark"] .official-col-white {
    background-color: #1e293b !important;
    color: #f8fafc !important;
}

[data-bs-theme="dark"] .official-col-shaded {
    background-color: #334155 !important;
    color: #f8fafc !important;
}

.table-official-ministry tbody tr:hover td {
    filter: brightness(0.96);
}

[data-bs-theme="dark"] .table-official-ministry tbody tr:hover td {
    filter: brightness(1.15);
}

/* Subject items badge in official table */
.official-sub-item {
    font-size: 0.78rem;
    line-height: 1.35;
    white-space: nowrap;
}

.official-sub-item .sub-name {
    font-weight: 600;
}

.official-sub-item .sub-count {
    color: #2563eb;
}

[data-bs-theme="dark"] .official-sub-item .sub-count {
    color: #60a5fa;
}

/* Bottom Official Summary Grid (Page 3 of PDF) */
.official-bottom-container {
    margin-top: 18px;
    border: 2px solid #0f172a;
    border-radius: 8px;
    padding: 14px;
    background: #f8fafc;
}

[data-bs-theme="dark"] .official-bottom-container {
    border-color: #94a3b8;
    background: #0f172a;
}

.official-bottom-grid {
    display: flex !important;
    flex-direction: row !important;
    gap: 12px !important;
    align-items: flex-start !important;
    width: 100% !important;
}

.official-bottom-col-right {
    flex: 0 0 35% !important;
    max-width: 35% !important;
    width: 35% !important;
}

.official-bottom-col-left {
    flex: 0 0 65% !important;
    max-width: 65% !important;
    width: 65% !important;
}

.official-sub-main-title {
    background: #e2e8f0 !important;
    font-size: 0.90rem !important;
    font-weight: 900 !important;
    text-align: center !important;
    padding: 4px 6px !important;
    color: #0f172a !important;
    letter-spacing: 0.5px;
}

[data-bs-theme="dark"] .official-sub-main-title {
    background: #334155 !important;
    color: #f8fafc !important;
}

.official-sub-table {
    border: 1.5px solid #0f172a !important;
    border-collapse: collapse !important;
    width: 100% !important;
    font-size: 0.8rem !important;
}

[data-bs-theme="dark"] .official-sub-table {
    border-color: #64748b !important;
}

.official-sub-table th,
.official-sub-table td {
    border: 1px solid #0f172a !important;
    padding: 4px 6px !important;
    text-align: center !important;
    vertical-align: middle !important;
}

[data-bs-theme="dark"] .official-sub-table th,
[data-bs-theme="dark"] .official-sub-table td {
    border-color: #64748b !important;
}

.official-sub-table thead th {
    background: #e2e8f0 !important;
    font-weight: 800 !important;
    color: #0f172a !important;
}

[data-bs-theme="dark"] .official-sub-table thead th {
    background: #334155 !important;
    color: #f8fafc !important;
}

.official-leave-table {
    table-layout: auto !important;
    font-size: 0.78rem !important;
}

.official-leave-table th,
.official-leave-table td {
    padding: 3px 2px !important;
}

.official-reasons-header {
    font-size: 0.85rem;
    font-weight: 800;
    color: #0f172a;
    margin-bottom: 4px;
}

[data-bs-theme="dark"] .official-reasons-header {
    color: #f8fafc;
}

.official-reasons-box {
    border: 1.5px solid #0f172a;
    border-radius: 6px;
    min-height: 80px;
    padding: 8px 12px;
    background: #ffffff;
    font-size: 0.84rem;
    line-height: 1.5;
    outline: none;
}

[data-bs-theme="dark"] .official-reasons-box {
    border-color: #64748b;
    background: #1e293b;
    color: #f8fafc;
}

.official-checkbox-box {
    display: inline-block;
    width: 22px;
    height: 22px;
    border: 1.8px solid #0f172a;
    border-radius: 3px;
    background: #ffffff;
    vertical-align: middle;
}

[data-bs-theme="dark"] .official-checkbox-box {
    border-color: #94a3b8;
    background: #1e293b;
}

.official-sign-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 14px;
    padding-top: 10px;
    border-top: 1px dashed #cbd5e1;
}

[data-bs-theme="dark"] .official-sign-row {
    border-top-color: #334155;
}

.official-th-vertical {
    writing-mode: vertical-rl;
    text-orientation: mixed;
    transform: rotate(180deg);
    white-space: nowrap;
    vertical-align: middle;
    padding: 6px 3px !important;
    height: 130px !important;
    min-height: 130px !important;
    min-width: 32px !important;
    font-size: 0.76rem !important;
    line-height: 1 !important;
}

/* Print Optimization for Official Ministry Format */
@media print {
    @page {
        margin: 6mm 7mm !important;
    }

    *, *::before, *::after {
        box-sizing: border-box !important;
    }

    table {
        box-sizing: border-box !important;
    }

    html,
    body {
        background: #ffffff !important;
        color: #000000 !important;
        margin: 0 !important;
        padding: 0 !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
        overflow: visible !important;
    }

    /* Hide everything except the official document on print */
    body>*:not(#app):not(.tab-content):not(main):not(.main-container):not(.official-doc-container) {
        display: none !important;
    }

    /* Hide all tab panes except the one containing official doc */
    .tab-pane {
        display: none !important;
    }

    /* Show only official-doc-container and its parents */
    .tab-pane:has(.official-doc-container),
    .tab-pane.active {
        display: block !important;
    }

    /* Override any overflow that prevents page breaking */
    .table-responsive,
    #tableContainer,
    .print-area,
    .official-table-responsive {
        overflow: visible !important;
        overflow-x: visible !important;
        overflow-y: visible !important;
        display: block !important;
        height: auto !important;
        max-height: none !important;
    }

    footer,
    .no-print,
    .print-footer,
    .navbar,
    nav,
    .distribution-toolbar-card,
    .nav-tabs,
    .tab-nav,
    [role="tablist"] {
        display: none !important;
        visibility: hidden !important;
        height: 0 !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    .official-doc-container {
        border: none !important;
        box-shadow: none !important;
        padding: 0 !important;
        margin: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        display: block !important;
    }

    .official-top-header-table {
        width: 100% !important;
        border: 2px solid #000000 !important;
        border-collapse: collapse !important;
        background: #ffffff !important;
        color: #000000 !important;
        margin-bottom: 2px !important;
        /* page-break rules removed to prevent blank first pages */
    }

    .official-top-header-table td {
        border: none !important;
        color: #000000 !important;
        padding: 1px 4px !important;
        vertical-align: middle !important;
    }

    .official-staff-line,
    .official-school-line {
        font-size: 0.68rem !important;
        color: #000000 !important;
        line-height: 1.15 !important;
    }

    .official-main-title {
        font-size: 0.72rem !important;
        font-weight: 800 !important;
        color: #000000 !important;
        margin-bottom: 0 !important;
        letter-spacing: 0.2px !important;
    }

    .official-doc-meta {
        font-size: 0.68rem !important;
        font-weight: 700 !important;
        color: #000000 !important;
        line-height: 1.15 !important;
    }

    .official-th-vertical {
        writing-mode: vertical-rl !important;
        text-orientation: mixed !important;
        transform: rotate(180deg) !important;
        white-space: nowrap !important;
        vertical-align: middle !important;
        padding: 4px 1px !important;
        height: 110px !important;
        min-height: 110px !important;
        width: 24px !important;
        min-width: 24px !important;
        max-width: 26px !important;
        font-size: 0.68rem !important;
        line-height: 1 !important;
    }

    .table-official-ministry {
        border: 2px solid #000000 !important;
        width: 100% !important;
        max-width: 100% !important;
        font-size: 0.66rem !important;
        table-layout: auto !important;
    }

    .table-official-ministry thead,
    thead {
        display: table-row-group !important;
    }

    .table-official-ministry tfoot,
    tfoot {
        display: table-row-group !important;
    }

    .official-teacher-tbody,
    .table-official-ministry tbody,
    .table-official-ministry tr,
    tbody,
    tr {
        page-break-inside: avoid !important;
        break-inside: avoid !important;
        break-inside: avoid-page !important;
    }

    .table-official-ministry th,
    .table-official-ministry td {
        border: 1px solid #000000 !important;
        color: #000000 !important;
        padding: 1px 1px !important;
        line-height: 1.1 !important;
    }

    .table-official-ministry thead th.official-th {
        background: #e2e8f0 !important;
        color: #000000 !important;
        font-size: 0.68rem !important;
        font-weight: 800 !important;
    }

    .official-class-col-header {
        width: 17px !important;
        min-width: 17px !important;
        max-width: 20px !important;
        padding: 1px 0 !important;
    }

    .official-grade-num {
        font-size: 0.62rem !important;
        font-weight: 800 !important;
        line-height: 1 !important;
    }

    .official-section-let {
        font-size: 0.68rem !important;
        font-weight: 700 !important;
        line-height: 1 !important;
    }

    .official-col-shaded {
        background-color: #cbd5e1 !important;
        color: #000000 !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    .official-col-white {
        background-color: #ffffff !important;
        color: #000000 !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    .official-sub-item {
        font-size: 0.66rem !important;
        line-height: 1.15 !important;
    }

    .official-bottom-container {
        border: 2px solid #000000 !important;
        background: #ffffff !important;
        color: #000000 !important;
        padding: 4px 8px !important;
        margin-top: 6px !important;
        page-break-inside: avoid !important;
        break-inside: avoid !important;
        box-sizing: border-box !important;
    }

    .official-bottom-grid {
        display: flex !important;
        flex-direction: row !important;
        gap: 8px !important;
        align-items: flex-start !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }

    .official-bottom-col-right {
        flex: 0 0 35% !important;
        max-width: 35% !important;
        width: 35% !important;
        box-sizing: border-box !important;
    }

    .official-bottom-col-left {
        flex: 1 1 auto !important;
        max-width: calc(65% - 8px) !important;
        width: calc(65% - 8px) !important;
        box-sizing: border-box !important;
    }

    .official-sub-main-title {
        background-color: #e2e8f0 !important;
        color: #000000 !important;
        font-size: 0.74rem !important;
        font-weight: 800 !important;
        text-align: center !important;
        padding: 2px 4px !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    .official-sub-table {
        border: 1.5px solid #000000 !important;
        border-collapse: collapse !important;
        width: 100% !important;
        font-size: 0.68rem !important;
        margin-bottom: 0 !important;
    }

    .official-sub-table thead th {
        background-color: #f1f5f9 !important;
        color: #000000 !important;
        font-weight: 700 !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    .official-sub-table th,
    .official-sub-table td {
        border: 1px solid #000000 !important;
        color: #000000 !important;
        padding: 1.5px 3px !important;
        line-height: 1.15 !important;
        text-align: center !important;
        vertical-align: middle !important;
    }

    .official-reasons-wrapper {
        margin-top: 4px !important;
    }

    .official-reasons-header {
        font-size: 0.74rem !important;
        font-weight: 800 !important;
        color: #000000 !important;
        margin-bottom: 2px !important;
    }

    .official-reasons-box {
        border: 1.2px solid #000000 !important;
        border-radius: 4px !important;
        background: #ffffff !important;
        color: #000000 !important;
        min-height: 38px !important;
        padding: 3px 6px !important;
        font-size: 0.70rem !important;
        line-height: 1.25 !important;
        box-sizing: border-box !important;
    }

    .official-sign-row {
        display: flex !important;
        flex-direction: row !important;
        align-items: center !important;
        justify-content: space-between !important;
        margin-top: 8px !important;
        padding-top: 6px !important;
        border-top: 1px dashed #000000 !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }

    .official-sign-right {
        font-size: 0.74rem !important;
        font-weight: 700 !important;
        color: #000000 !important;
    }

    .official-sign-left {
        font-size: 0.74rem !important;
        font-weight: 700 !important;
        color: #000000 !important;
        text-align: center !important;
    }

    .official-sign-left .text-muted {
        color: #333333 !important;
        font-size: 0.68rem !important;
    }

    .official-sign-row {
        margin-top: 4px !important;
        padding-top: 3px !important;
    }

    .official-editable-field,
    .official-editable-text {
        border-bottom: none !important;
    }}

/* 5. Tangerine Orange Coral (Matches Auto Quota Button: .btn-tb-nisab) */
.sup-day-orange {
    background: linear-gradient(145deg, #fed7aa, #f97316) !important;
    box-shadow: 0 5px 14px -2px rgba(249, 115, 22, 0.35),
        inset 2px 2px 4px rgba(255, 255, 255, 0.65),
        inset -2px -2px 4px rgba(0, 0, 0, 0.12) !important;
}

/* Supervisor Item Top Row */
.sup-item-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
}

.sup-teacher-sub {
    font-size: 0.69rem;
    color: #64748b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
}

/* 3D Clay Chips: Location & Free Periods */
.sup-item-bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    padding-top: 5px;
    border-top: 1px dashed #e2e8f0;
}

.sup-location-chip {
    font-size: 0.68rem;
    font-weight: 800;
    padding: 2.5px 8px;
    border-radius: 9999px !important;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    max-width: 115px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05), inset 1px 1px 2px rgba(255, 255, 255, 0.7);
}

.sup-free-periods-chip {
    font-size: 0.68rem;
    font-weight: 800;
    padding: 2.5px 7px;
    border-radius: 9999px !important;
    background: #ecfdf5 !important;
    color: #059669 !important;
    border: 1px solid #a7f3d0 !important;
    display: inline-flex;
    align-items: center;
    gap: 3px;
    white-space: nowrap;
    box-shadow: 0 2px 4px rgba(5, 150, 105, 0.12), inset 1px 1px 2px rgba(255, 255, 255, 0.8);
}

/* ==========================================================
   SUPERVISION TAB: TABLE LAYOUT - 3D CLAYMORPHISM
   ========================================================== */
.sup-clay-table-card {
    background: #ffffff !important;
    border-radius: 24px !important;
    border: 2.5px solid #ffffff !important;
    box-shadow: 0 12px 30px -4px rgba(148, 163, 184, 0.22),
        inset 2px 2px 4px rgba(255, 255, 255, 1),
        inset -2px -2px 4px rgba(0, 0, 0, 0.04) !important;
    overflow: hidden !important;
}

.sup-clay-table {
    border-collapse: separate !important;
    border-spacing: 0 6px !important;
    width: 100% !important;
}

.sup-table-seq-th {
    vertical-align: middle !important;
    padding: 8px 6px !important;
    border: none !important;
}

.sup-table-seq-badge {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 32px !important;
    height: 32px !important;
    border-radius: 50% !important;
    background: linear-gradient(145deg, #f1f5f9, #e2e8f0) !important;
    border: 1.5px solid #ffffff !important;
    color: #475569 !important;
    font-weight: 800 !important;
    font-size: 0.85rem !important;
    box-shadow: 0 2px 5px rgba(148, 163, 184, 0.2), inset 1px 1px 2px rgba(255, 255, 255, 1) !important;
}

.sup-table-day-th {
    padding: 6px !important;
    border: none !important;
    min-width: 185px !important;
}

/* 3D Clay Day Headers */
.sup-table-day-header {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    padding: 8px 12px !important;
    border-radius: 16px !important;
    border: 2px solid #ffffff !important;
    color: #ffffff !important;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.22) !important;
    transition: all 0.2s ease !important;
}

.day-clay-hdr-5 {
    background: linear-gradient(145deg, #f472b6, #db2777) !important;
    box-shadow: 0 4px 12px rgba(219, 39, 119, 0.35), inset 1.5px 1.5px 2px rgba(255, 255, 255, 0.75), inset -1.5px -1.5px 2px rgba(0, 0, 0, 0.12) !important;
}

/* Row Number */
.sup-table-seq-td {
    vertical-align: middle !important;
    padding: 6px !important;
    border: none !important;
}

.sup-table-num-pill {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 28px !important;
    height: 28px !important;
    border-radius: 50% !important;
    background: linear-gradient(145deg, #f8fafc, #f1f5f9) !important;
    border: 1.5px solid #ffffff !important;
    color: #64748b !important;
    font-weight: 800 !important;
    font-size: 0.78rem !important;
    box-shadow: 0 2px 5px rgba(148, 163, 184, 0.15), inset 1px 1px 2px rgba(255, 255, 255, 1) !important;
}

.sup-table-td {
    vertical-align: middle !important;
    border: none !important;
}

/* Table Footer Add Button */
.sup-table-foot-add-btn {
    width: 100% !important;
    padding: 7px 12px !important;
    border-radius: 9999px !important;
    border: 1.5px solid #ffffff !important;
    background: linear-gradient(145deg, #38bdf8, #0284c7) !important;
    color: #ffffff !important;
    font-size: 0.78rem !important;
    font-weight: 800 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 6px !important;
    box-shadow: 0 3px 8px rgba(2, 132, 199, 0.3), inset 1px 1px 2px rgba(255, 255, 255, 0.8) !important;
    cursor: pointer !important;
    transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1) !important;
}

.sup-table-foot-add-btn:hover {
    background: linear-gradient(145deg, #0284c7, #0369a1) !important;
    transform: translateY(-2px) scale(1.02) !important;
    box-shadow: 0 6px 14px rgba(2, 132, 199, 0.42) !important;
}

/* ==========================================================
   SUBJECT COLORS SYSTEM (سیستەمێ رەنگێن بابەتان)
   ========================================================== */
.btn-tb-pastel-colors {
    background: linear-gradient(145deg, #fbcfe8, #f472b6) !important;
    color: #831843 !important;
    border: 1px solid rgba(255, 255, 255, 0.6) !important;
    box-shadow: 0 4px 12px -2px rgba(244, 114, 182, 0.35),
        inset 2px 2px 4px rgba(255, 255, 255, 0.85),
        inset -2px -2px 4px rgba(131, 24, 67, 0.15) !important;
    font-weight: 700 !important;
    border-radius: 50px !important;
    padding: 5px 14px !important;
    font-size: 0.82rem !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 5px !important;
    transition: all 0.22s cubic-bezier(0.175, 0.885, 0.32, 1.275) !important;
}

.btn-tb-pastel-colors:hover {
    background: linear-gradient(145deg, #fce7f3, #f472b6) !important;
    color: #500724 !important;
    transform: translateY(-2px) scale(1.02) !important;
    box-shadow: 0 7px 16px -2px rgba(244, 114, 182, 0.48),
        inset 2px 2px 4px rgba(255, 255, 255, 0.95),
        inset -2px -2px 4px rgba(131, 24, 67, 0.12) !important;
}

.btn-tb-pastel-colors::after {
    margin-right: 5px !important;
    vertical-align: middle !important;
}

/* Swatches in Subject Color Manager Modal */
.pastel-swatch-circle {
    width: 28px;
    height: 28px;
    min-width: 28px;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid #ffffff;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.15), inset 1px 1px 2px rgba(255, 255, 255, 0.8);
    transition: all 0.18s cubic-bezier(0.34, 1.56, 0.64, 1);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    margin: 2px;
}

.pastel-swatch-circle:hover {
    transform: scale(1.25);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.25);
    z-index: 5;
}

.pastel-swatch-circle.active {
    border-color: #0f172a !important;
    transform: scale(1.2);
    box-shadow: 0 0 0 2px #38bdf8, 0 4px 8px rgba(0, 0, 0, 0.2) !important;
}

.subject-color-preview-card {
    border-radius: 12px;
    padding: 8px 12px;
    text-align: center;
    min-width: 140px;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.06);
    transition: all 0.25s ease;
}

.subject-color-row {
    background: #ffffff;
    border-radius: 14px;
    border: 1px solid #e2e8f0;
    padding: 10px 14px;
    margin-bottom: 10px;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
}

.subject-color-row:hover {
    border-color: #cbd5e1;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

/* ==========================================
   Class Mentors Single Color Mode Dropdown
   ========================================== */
.btn-tb-color-mode-dropdown {
    display: inline-flex !important;
    align-items: center !important;
    gap: 6px !important;
    padding: 5px 14px !important;
    font-size: 0.8rem !important;
    font-weight: 700 !important;
    border-radius: 9999px !important;
    transition: all 0.22s cubic-bezier(0.34, 1.56, 0.64, 1) !important;
    border: 1px solid rgba(226, 232, 240, 0.9) !important;
    background: #ffffff !important;
    color: #334155 !important;
    box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.95), 0 2px 6px rgba(0, 0, 0, 0.04) !important;
}

.btn-tb-color-mode-dropdown.mode-auto {
    background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%) !important;
    border-color: #86efac !important;
    color: #15803d !important;
    box-shadow: 0 3px 8px rgba(34, 197, 94, 0.18), inset 0 1px 2px rgba(255, 255, 255, 0.95) !important;
}

.btn-tb-color-mode-dropdown.mode-manual {
    background: linear-gradient(135deg, #fdf2f8 0%, #fce7f3 100%) !important;
    border-color: #f472b6 !important;
    color: #be185d !important;
    box-shadow: 0 3px 8px rgba(219, 39, 119, 0.18), inset 0 1px 2px rgba(255, 255, 255, 0.95) !important;
}

.btn-tb-color-mode-dropdown.mode-none {
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%) !important;
    border-color: #cbd5e1 !important;
    color: #64748b !important;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.04), inset 0 1px 2px rgba(255, 255, 255, 0.8) !important;
}

.btn-tb-color-mode-dropdown:hover,
.btn-tb-color-mode-dropdown:focus {
    transform: translateY(-1px) scale(1.02) !important;
}

.btn-tb-color-mode-dropdown::after {
    margin-right: 4px;
    vertical-align: middle;
}

[data-bs-theme="dark"] .btn-tb-color-mode-dropdown {
    background: #1e293b !important;
    border-color: #334155 !important;
    color: #e2e8f0 !important;
}

/* ==========================================================================
   TIMETABLE DAY & PERIOD DISTINCT HEADERS
   ========================================================================== */
#timetableGridTable thead th,
.table thead th {
    letter-spacing: 0.3px;
    box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.05);
}

#timetableGridTable td.fw-bold,
.table td.fw-bold {
    letter-spacing: 0.2px;
}

/* Print accuracy */
@media print {

    #timetableGridTable thead th,
    #timetableGridTable tbody td.fw-bold,
    table.preserve-table-styles thead th,
    table.preserve-table-styles tbody td {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }}

/* ==========================================================================
   CLAYMORPHISM: MANUAL TIMETABLE EDITOR MODAL
   ========================================================================== */
.clay-modal-card {
    border-radius: 28px !important;
    background: #f8fafc !important;
    border: 1px solid rgba(255, 255, 255, 0.8) !important;
    box-shadow: 0 25px 60px -15px rgba(15, 23, 42, 0.25), inset 0 2px 5px rgba(255, 255, 255, 0.95) !important;
}

.clay-modal-header {
    background: linear-gradient(135deg, #1e40af 0%, #2563eb 50%, #0284c7 100%) !important;
    border-bottom: 2px solid rgba(255, 255, 255, 0.25) !important;
    box-shadow: inset 0 2px 4px rgba(255, 255, 255, 0.35), 0 4px 15px rgba(37, 99, 235, 0.25) !important;
}

.clay-header-icon-circle {
    width: 44px;
    height: 44px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.2);
    border: 1.5px solid rgba(255, 255, 255, 0.45);
    box-shadow: inset 0 2px 4px rgba(255, 255, 255, 0.35), 0 3px 8px rgba(0, 0, 0, 0.12);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    color: #ffffff;
}

.clay-modal-body {
    background: linear-gradient(145deg, #f8fafc 0%, #f1f5f9 100%) !important;
}

.clay-controls-bar {
    background: linear-gradient(145deg, #ffffff, #f8fafc) !important;
    border: 1px solid rgba(226, 232, 240, 0.9) !important;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.03), inset 0 1px 3px rgba(255, 255, 255, 0.9) !important;
}

.clay-badge-icon {
    width: 32px;
    height: 32px;
    border-radius: 10px;
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    box-shadow: inset 0 1px 2px rgba(255, 255, 255, 0.8);
}

.clay-select {
    border-radius: 12px !important;
    background: #ffffff !important;
    border: 1.5px solid #cbd5e1 !important;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.04), 0 2px 5px rgba(0, 0, 0, 0.02) !important;
    transition: all 0.2s ease !important;
}

.clay-select:focus {
    border-color: #3b82f6 !important;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2), inset 0 1px 2px rgba(255, 255, 255, 0.8) !important;
}

.clay-hint-pill {
    background: linear-gradient(145deg, #f0f9ff, #e0f2fe) !important;
    border: 1px solid #bae6fd !important;
    box-shadow: inset 0 1px 2px rgba(255, 255, 255, 0.85), 0 2px 6px rgba(2, 132, 199, 0.06) !important;
}

.clay-grid-table-container {
    background: #ffffff !important;
    border: 1.5px solid #e2e8f0 !important;
    box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.02), 0 8px 24px rgba(0, 0, 0, 0.04) !important;
    border-radius: 20px !important;
}

.clay-manual-table {
    border-collapse: separate !important;
    border-spacing: 5px 6px !important;
    border: none !important;
}

.clay-day-cell {
    border-radius: 12px !important;
    border: 1.5px solid rgba(0, 0, 0, 0.08) !important;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.04), inset 0 1px 2px rgba(255, 255, 255, 0.7) !important;
}

.clay-cell-wrapper {
    background: transparent !important;
    border: none !important;
    padding: 0 !important;
}

.clay-lesson-card {
    border-radius: 14px !important;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.04), inset 0 2px 4px rgba(255, 255, 255, 0.85), inset 0 -2px 4px rgba(0, 0, 0, 0.03) !important;
    transition: all 0.22s cubic-bezier(0.34, 1.56, 0.64, 1) !important;
    cursor: pointer;
    user-select: none;
}

.clay-lesson-card:hover {
    transform: translateY(-2px) scale(1.02) !important;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.09), inset 0 2px 4px rgba(255, 255, 255, 0.95) !important;
    z-index: 2;
}

.clay-card-locked {
    box-shadow: 0 3px 10px rgba(245, 158, 11, 0.18), inset 0 2px 4px rgba(255, 255, 255, 0.9) !important;
}

.clay-lock-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-radius: 6px;
    font-size: 0.68rem;
}

.clay-teach-chip {
    font-size: 0.73rem;
    font-weight: 600;
    opacity: 0.9;
    max-width: 95%;
}

.clay-empty-slot {
    border: 1.5px dashed #cbd5e1 !important;
    background: linear-gradient(145deg, #f8fafc, #f1f5f9) !important;
    border-radius: 14px !important;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.03) !important;
    transition: all 0.2s ease !important;
}

.clay-empty-slot:hover {
    border-color: #3b82f6 !important;
    background: linear-gradient(145deg, #eff6ff, #dbeafe) !important;
    transform: translateY(-1px) !important;
}

.clay-plus-circle {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    color: #3b82f6;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.78rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05), inset 0 1px 2px #ffffff;
    transition: all 0.2s ease;
}

.clay-modal-footer {
    background: linear-gradient(145deg, #ffffff, #f8fafc) !important;
    border-top: 1px solid #e2e8f0 !important;
}

.clay-btn-close {
    background: linear-gradient(145deg, #ffffff, #f1f5f9) !important;
    border: 1.5px solid #cbd5e1 !important;
    color: #334155 !important;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.05), inset 0 1px 2px #ffffff !important;
    transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1) !important;
}

.clay-btn-close:hover {
    background: linear-gradient(145deg, #f1f5f9, #e2e8f0) !important;
    color: #0f172a !important;
    transform: translateY(-1px) !important;
    box-shadow: 0 5px 12px rgba(0, 0, 0, 0.08), inset 0 1px 2px #ffffff !important;
}

[data-bs-theme="dark"] .clay-modal-card {
    background: #0f172a !important;
    border-color: #334155 !important;
}

[data-bs-theme="dark"] .clay-modal-body {
    background: #0f172a !important;
}

[data-bs-theme="dark"] .clay-controls-bar {
    background: #1e293b !important;
    border-color: #334155 !important;
}

[data-bs-theme="dark"] .clay-grid-table-container {
    background: #1e293b !important;
    border-color: #334155 !important;
}

[data-bs-theme="dark"] .clay-empty-slot {
    background: #0f172a !important;
    border-color: #334155 !important;
}

[data-bs-theme="dark"] .clay-modal-footer {
    background: #1e293b !important;
    border-color: #334155 !important;
}

/* ==========================================================================
   CLAYMORPHISM: SUBJECT RESTRICTIONS MODAL (قفل و سنوردارکرنا بابەتان)
   ========================================================================== */
.clay-modal-header-indigo {
    background: linear-gradient(135deg, #312e81 0%, #4338ca 45%, #6366f1 100%) !important;
    border-bottom: 2px solid rgba(255, 255, 255, 0.2) !important;
    box-shadow: inset 0 2px 4px rgba(255, 255, 255, 0.3), 0 4px 18px rgba(67, 56, 202, 0.3) !important;
}

.clay-alert-banner {
    background: linear-gradient(145deg, #f0fdf9 0%, #f8fafc 100%) !important;
    border: 1.5px solid #a7f3d0 !important;
    box-shadow: inset 0 1px 3px rgba(255, 255, 255, 0.9), 0 2px 8px rgba(16, 185, 129, 0.05) !important;
}

/* ==========================================================================
   Quick Action Buttons
   ========================================================================== */
.clay-quick-btn-danger {
    background: linear-gradient(145deg, #ffffff, #fff1f2) !important;
    border: 1.5px solid #fecdd3 !important;
    color: #be123c !important;
    box-shadow: 0 2px 6px rgba(190, 18, 60, 0.05) !important;
    transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1) !important;
    padding: 8px 18px !important;
    font-size: 0.9rem !important;
}

.clay-quick-btn-danger:hover {
    background: #ffe4e6 !important;
    border-color: #fda4af !important;
    transform: translateY(-1.5px) !important;
    box-shadow: 0 4px 12px rgba(190, 18, 60, 0.15) !important;
}

/* ==========================================================================
   Save & Close Footer Buttons
   ========================================================================== */
.subj-ref-purple-btn,
.clay-btn-save-indigo {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 50%, #1d4ed8 100%) !important;
    border: none !important;
    color: #ffffff !important;
    box-shadow: 0 6px 20px rgba(37, 99, 235, 0.35) !important;
    transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1) !important;
    padding: 10px 42px !important;
    font-size: 1.05rem !important;
}

.subj-ref-purple-btn:hover,
.clay-btn-save-indigo:hover {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%) !important;
    transform: translateY(-2px) scale(1.03) !important;
    box-shadow: 0 8px 24px rgba(37, 99, 235, 0.45) !important;
    color: #ffffff !important;
}

.clay-badge-icon {
    width: 36px;
    height: 36px;
    border-radius: 12px;
    background: #e0e7ff;
    color: #4338ca;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.05rem;
}

.clay-select {
    border-radius: 12px !important;
    border: 1.5px solid #cbd5e1 !important;
    background-color: #ffffff !important;
    color: #1e293b !important;
    transition: all 0.2s ease !important;
    padding: 6px 12px !important;
    font-size: 0.92rem !important;
}

.clay-select:focus {
    border-color: #3b82f6 !important;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2) !important;
}

.border-indigo-subtle {
    border-color: #c7d2fe !important;
}

.clay-merged-modal-content {
    background: #f8fafc !important;
    border-radius: 30px !important;
    box-shadow: 0 30px 60px -15px rgba(15, 23, 42, 0.25) !important;
    border: 1px solid rgba(255, 255, 255, 0.8) !important;
}

.clay-modal-header-violet {
    background: linear-gradient(135deg, #1e293b 0%, #1e40af 55%, #0284c7 100%) !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.15) !important;
    box-shadow: inset 0 2px 4px rgba(255, 255, 255, 0.2), 0 6px 20px rgba(30, 64, 175, 0.2) !important;
}

.clay-merged-header-icon {
    width: 52px;
    height: 52px;
    border-radius: 16px;
    background: linear-gradient(135deg, #38bdf8 0%, #0284c7 100%);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.45rem;
    box-shadow: 0 6px 16px rgba(2, 132, 199, 0.35), inset 0 2px 4px rgba(255, 255, 255, 0.5);
}

.clay-btn-save-violet {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%) !important;
    border: 2px solid #60a5fa !important;
    color: #ffffff !important;
    box-shadow: 0 6px 18px rgba(37, 99, 235, 0.3), inset 0 2px 4px rgba(255, 255, 255, 0.4) !important;
    transition: all 0.22s cubic-bezier(0.34, 1.56, 0.64, 1) !important;
    cursor: pointer;
}

.clay-merged-card {
    background: #ffffff !important;
    border: 1.5px solid #e2e8f0 !important;
    border-radius: 22px !important;
    box-shadow: 0 6px 20px -4px rgba(0, 0, 0, 0.04), inset 0 1px 2px #ffffff !important;
    transition: all 0.2s ease !important;
}

.clay-merged-hero-card {
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%) !important;
    border: 1.5px solid #cbd5e1 !important;
    box-shadow: 0 6px 18px -4px rgba(71, 85, 105, 0.08), inset 0 1px 3px #ffffff !important;
}

.clay-feature-icon-badge {
    width: 48px;
    height: 48px;
    border-radius: 15px;
    background: linear-gradient(135deg, #0284c7 0%, #2563eb 100%);
    color: #ffffff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    box-shadow: 0 6px 16px rgba(37, 99, 235, 0.25), inset 0 1px 2px rgba(255, 255, 255, 0.4);
}

.clay-switch-pill {
    background: #ffffff !important;
    border: 1.5px solid #cbd5e1 !important;
    box-shadow: 0 2px 8px rgba(71, 85, 105, 0.08) !important;
}

.clay-alert-banner {
    border: 1.5px solid #bfdbfe !important;
    background: #eff6ff !important;
    color: #1e40af !important;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.06) !important;
}

.clay-pair-deck-card-blue {
    background: linear-gradient(145deg, #f0f9ff 0%, #e0f2fe 100%) !important;
    border: 1.5px solid #bae6fd !important;
    border-radius: 18px !important;
    box-shadow: 0 4px 14px rgba(2, 132, 199, 0.06), inset 0 1px 2px #ffffff !important;
}

.clay-pair-deck-card-green {
    background: linear-gradient(145deg, #f0fdf4 0%, #dcfce7 100%) !important;
    border: 1.5px solid #bbf7d0 !important;
    border-radius: 18px !important;
    box-shadow: 0 4px 14px rgba(34, 197, 94, 0.06), inset 0 1px 2px #ffffff !important;
}

.clay-pair-connector-badge {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: linear-gradient(135deg, #0284c7 0%, #2563eb 100%);
    color: #ffffff;
    border: 2.5px solid #ffffff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    box-shadow: 0 6px 18px rgba(37, 99, 235, 0.25), inset 0 1px 2px rgba(255, 255, 255, 0.5);
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.clay-merged-item {
    background: #ffffff !important;
    border: 1.5px solid #e2e8f0 !important;
    border-radius: 20px !important;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.04), inset 0 1px 2px #ffffff !important;
    transition: all 0.22s cubic-bezier(0.34, 1.56, 0.64, 1) !important;
}

/* Navigation Tab 9: Teacher Covers */
.custom-main-tabs .nav-link.tab-teacher-covers {
    background: rgba(99, 102, 241, 0.18) !important;
    color: #4338ca !important;
    border-color: rgba(99, 102, 241, 0.35) !important;
    box-shadow: inset 1px 1px 2px rgba(255, 255, 255, 0.8), 0 2px 6px rgba(99, 102, 241, 0.12) !important;
}

.custom-main-tabs .nav-link.tab-teacher-covers:hover {
    background: rgba(99, 102, 241, 0.26) !important;
    color: #312e81 !important;
    border-color: rgba(99, 102, 241, 0.48) !important;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.22), inset 1px 1px 2px rgba(255, 255, 255, 0.9) !important;
    transform: translateY(-2px) scale(1.02) !important;
}

.custom-main-tabs .nav-link.tab-teacher-covers.active {
    background: linear-gradient(145deg, #a5b4fc, #6366f1) !important;
    color: #ffffff !important;
    border-color: rgba(255, 255, 255, 0.45) !important;
    box-shadow: 0 6px 16px -2px rgba(99, 102, 241, 0.42),
        inset 2px 2px 4px rgba(255, 255, 255, 0.75),
        inset -2px -2px 4px rgba(0, 0, 0, 0.12) !important;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2) !important;
}

[data-bs-theme="dark"] .custom-main-tabs .nav-link.tab-teacher-covers {
    background: rgba(99, 102, 241, 0.18) !important;
    color: #c7d2fe !important;
    border-color: rgba(99, 102, 241, 0.35) !important;
}

.teacher-covers-toolbar-card {
    background-color: var(--bs-card-bg);
    border: 1px solid rgba(226, 232, 240, 0.85) !important;
    border-radius: 1.25rem !important;
    box-shadow: 0 4px 18px -4px rgba(15, 23, 42, 0.06), 0 1px 3px rgba(15, 23, 42, 0.04) !important;
}

.tc-format-bar {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 8px 14px;
}

.tc-format-group {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.teacher-covers-pagination-bar {
    background-color: var(--bs-card-bg, #ffffff);
    border: 1px solid rgba(226, 232, 240, 0.9) !important;
    border-radius: 1.25rem !important;
    box-shadow: 0 4px 18px -4px rgba(15, 23, 42, 0.06), 0 1px 3px rgba(15, 23, 42, 0.04) !important;
    position: relative;
    z-index: 1;
}

@media screen and (max-width: 992px) {
#teacherForm .row>[class*="col-"]:last-child {
        border-bottom: none;
        padding-bottom: 0;
        margin-bottom: 0;
    }}

[data-bs-theme="dark"] .subject-color-row {
    background: #1e293b;
    border-color: #334155;
}

.table-striped tbody tr:nth-of-type(odd) td {
    background-color: var(--bs-table-striped-bg) !important;
}

@media (min-width: 768px) and (max-width: 1024px) {
#distribution-tab-pane #stageSelectorBtn {
        max-width: 175px !important;
        text-overflow: ellipsis !important;
        overflow: hidden !important;
        white-space: nowrap !important;
    }

#distribution-tab-pane .search-panel input {
        height: 33px !important;
        min-height: 33px !important;
        font-size: 0.79rem !important;
        border-radius: 50px !important;
    }}

.official-leave-table td:nth-child(4) {
    font-size: 0.75rem !important;
    line-height: 1.25 !important;
}

.swal2-compact-nisab .swal2-html-container::-webkit-scrollbar {
    width: 6px;
}

.swal2-compact-nisab .swal2-html-container::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

@media screen and (max-width: 767px) {
#unassignedCol {
        margin-top: 1rem;
    }}

.clay-manual-table thead th {
    border-radius: 12px !important;
    border: 1.5px solid rgba(0, 0, 0, 0.08) !important;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.04), inset 0 1px 2px rgba(255, 255, 255, 0.7) !important;
}

.clay-empty-slot:hover .clay-plus-circle {
    background: #2563eb;
    border-color: #1d4ed8;
    color: #ffffff;
    transform: scale(1.1);
}

.clay-merged-dialog {
    max-width: 960px !important;
}

.clay-btn-save-violet:hover {
    background: linear-gradient(135deg, #1d4ed8 0%, #1e40af 100%) !important;
    transform: translateY(-2px) scale(1.01) !important;
    box-shadow: 0 10px 24px rgba(37, 99, 235, 0.4), inset 0 2px 4px rgba(255, 255, 255, 0.45) !important;
    color: #ffffff !important;
}

.clay-pair-connector-badge:hover {
    transform: scale(1.12) rotate(180deg);
    box-shadow: 0 8px 22px rgba(37, 99, 235, 0.35);
}

.clay-merged-item:hover {
    transform: translateY(-2px) !important;
    border-color: #93c5fd !important;
    box-shadow: 0 8px 22px rgba(37, 99, 235, 0.12), inset 0 1px 2px #ffffff !important;
}

[data-bs-theme="dark"] .clay-merged-modal-content {
    background: #0b0f19 !important;
    border-color: #1e293b !important;
}

[data-bs-theme="dark"] .clay-modal-header-violet {
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 50%, #1e3a8a 100%) !important;
}

[data-bs-theme="dark"] .clay-merged-card {
    background: #151f32 !important;
    border-color: #1e293b !important;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4) !important;
}

[data-bs-theme="dark"] .clay-merged-hero-card {
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%) !important;
    border-color: #334155 !important;
}

[data-bs-theme="dark"] .clay-switch-pill {
    background: #0f172a !important;
    border-color: #334155 !important;
}

[data-bs-theme="dark"] .clay-alert-banner {
    background: #0f172a !important;
    border-color: #1e3a8a !important;
    color: #93c5fd !important;
}

[data-bs-theme="dark"] .clay-pair-deck-card-blue {
    background: linear-gradient(145deg, #0f172a 0%, #1e293b 100%) !important;
    border-color: #1e40af !important;
}

[data-bs-theme="dark"] .clay-pair-deck-card-green {
    background: linear-gradient(145deg, #022c22 0%, #064e3b 100%) !important;
    border-color: #059669 !important;
}

[data-bs-theme="dark"] .clay-pair-connector-badge {
    background: linear-gradient(135deg, #0284c7, #2563eb) !important;
    border-color: #1e293b !important;
}

[data-bs-theme="dark"] .clay-merged-item {
    background: #151f32 !important;
    border-color: #1e293b !important;
}

/* ==========================================================================
   Teacher Modal - Compact 2-Column Info Pane
   ========================================================================== */

/* Compact label utility */
html body .x-label {
    font-size: 0.74rem;
    font-weight: 600;
    color: var(--bs-secondary-color, #6c757d);
    display: block;
    line-height: 1.3;
}

/* Compact input/select utility */
html body .x-input {
    min-height: 30px !important;
    height: 30px;
    font-size: 0.8rem !important;
    padding: 0.2rem 0.5rem !important;
    border-radius: 6px !important;
}

/* Compact teacher info pane - reduce internal padding */
html body #teacherInfoPane {
    overflow: hidden;
}

html body #teacherInfoPane .row.g-2 {
    --bs-gutter-y: 0.4rem;
    --bs-gutter-x: 0.5rem;
}

/* Compact modal header for teacher modal */
html body #teacherModal .modal-header {
    padding: 0.5rem 1rem !important;
    min-height: auto;
}

html body #teacherModal .modal-footer {
    padding: 0.5rem 1rem !important;
}

/* Teacher modal tabs - more compact */
html body #teacherModal #teacherModalTabs .nav-link {
    padding: 0.4rem 1rem;
    font-size: 0.82rem;
}

html body #teacherModal .tab-content > .tab-pane > div:first-child {
    margin-bottom: 0.5rem !important;
}

/* Subject pills in compact mode */
html body #subjectsContainer .subject-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    background: rgba(99,102,241,0.08);
    border: 1px solid rgba(99,102,241,0.25);
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    color: #4f46e5;
    white-space: nowrap;
}

html body #subjectsContainer .subject-pill .btn-remove-subject {
    background: none;
    border: none;
    padding: 0;
    line-height: 1;
    cursor: pointer;
    color: #ef4444;
    font-size: 0.7rem;
    opacity: 0.7;
}

html body #subjectsContainer .subject-pill .btn-remove-subject:hover {
    opacity: 1;
}

/* Left pane: reduce top margin of tabs */
html body #teacherModal .col-xl-8 .d-flex.justify-content-center.mb-4,
html body #teacherModal .col-lg-7 .d-flex.justify-content-center.mb-4 {
    margin-bottom: 0.6rem !important;
}

/* ==========================================================================
   مودال زیادکرنا پۆلان (Add Classes Dialog) - مۆدێرن و ڕێکخراو
   ========================================================================== */
html body .swal2-popup.add-class-dialog {
    width: min(580px, calc(100vw - 2rem)) !important;
    max-width: min(580px, calc(100vw - 2rem)) !important;
    padding: 1.5rem !important;
    border-radius: 20px !important;
    border: 1px solid rgba(0, 0, 0, 0.08) !important;
    box-shadow: 0 20px 45px rgba(15, 23, 42, 0.16) !important;
    font-family: inherit !important;
    background: #ffffff !important;
    overflow: hidden;
}

[data-bs-theme="dark"] html body .swal2-popup.add-class-dialog {
    background: #1e293b !important;
    border-color: #334155 !important;
    color: #f1f5f9 !important;
}

.add-class-modal-box {
    color: #1e293b;
}

[data-bs-theme="dark"] .add-class-modal-box {
    color: #f1f5f9;
}

.add-class-header-icon {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    background: linear-gradient(135deg, #e0e7ff 0%, #c7d2fe 100%);
    color: #4338ca;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.35rem;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.18);
}

[data-bs-theme="dark"] .add-class-header-icon {
    background: linear-gradient(135deg, #312e81 0%, #3730a3 100%);
    color: #c7d2fe;
}

.add-class-tabs-nav {
    background: #f1f5f9 !important;
    border: 1px solid #e2e8f0 !important;
    padding: 4px !important;
    gap: 4px;
}

[data-bs-theme="dark"] .add-class-tabs-nav {
    background: #0f172a !important;
    border-color: #334155 !important;
}

.ac-tab-btn {
    border: none;
    background: transparent;
    color: #64748b;
    border-radius: 50px;
    padding: 0.45rem 1rem;
    font-size: 0.88rem;
    font-weight: 700;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.ac-tab-btn:hover {
    color: #1e293b;
}

[data-bs-theme="dark"] .ac-tab-btn:hover {
    color: #ffffff;
}

.ac-tab-btn.active {
    background: #ffffff !important;
    color: #4f46e5 !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08) !important;
}

[data-bs-theme="dark"] .ac-tab-btn.active {
    background: #1e293b !important;
    color: #818cf8 !important;
}

.ac-input-container {
    border: 1.5px solid #cbd5e1;
    border-radius: 12px;
    transition: all 0.2s ease;
    background: #ffffff;
}

[data-bs-theme="dark"] .ac-input-container {
    border-color: #475569;
    background: #0f172a;
}

.ac-input-container:focus-within {
    border-color: #6366f1;
    box-shadow: 0 0 0 3.5px rgba(99, 102, 241, 0.18);
}

.ac-input-container input {
    background: transparent !important;
    color: inherit !important;
}

.ac-input-container input:focus {
    box-shadow: none !important;
}

.preset-chip {
    transition: all 0.16s cubic-bezier(0.4, 0, 0.2, 1) !important;
    font-size: 0.82rem !important;
    font-weight: 600 !important;
    cursor: pointer;
    user-select: none;
    background: #ffffff;
    border: 1px solid #cbd5e1 !important;
    color: #334155 !important;
}

[data-bs-theme="dark"] .preset-chip {
    background: #1e293b;
    border-color: #475569 !important;
    color: #e2e8f0 !important;
}

.preset-chip:hover:not([disabled]) {
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(99, 102, 241, 0.2) !important;
    background: #4f46e5 !important;
    color: #ffffff !important;
    border-color: #4f46e5 !important;
}

.preset-chip:hover:not([disabled]) i {
    color: #ffffff !important;
}

.preset-chip[disabled] {
    opacity: 0.5 !important;
    cursor: not-allowed !important;
    background: #f1f5f9 !important;
    color: #94a3b8 !important;
    border-color: #e2e8f0 !important;
}

[data-bs-theme="dark"] .preset-chip[disabled] {
    background: #0f172a !important;
    color: #64748b !important;
    border-color: #334155 !important;
}

.existing-class-pill {
    font-size: 0.78rem;
    font-weight: 700;
    padding: 0.3rem 0.65rem;
    border-radius: 50px;
    background: #f8fafc;
    border: 1px solid #cbd5e1;
    color: #334155;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

[data-bs-theme="dark"] .existing-class-pill {
    background: #0f172a;
    border-color: #334155;
    color: #cbd5e1;
}

.ac-presets-box {
    background: #f8fafc;
    border: 1px dashed #cbd5e1;
    border-radius: 12px;
}

[data-bs-theme="dark"] .ac-presets-box {
    background: #0f172a;
    border-color: #334155;
}

.ac-existing-box {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
}

[data-bs-theme="dark"] .ac-existing-box {
    background: #0f172a;
    border-color: #334155;
}

/* ==========================================================================
   DISTRIBUTION UNIFIED RESPONSIVE DOCK (PHONE, IPAD, LAPTOP & DESKTOP)
   ========================================================================== */
.dist-control-dock {
    background: linear-gradient(180deg, #ffffff 0%, #f8faff 100%) !important;
    border: 1px solid #e2e8f0 !important;
    border-radius: 20px !important;
    padding: 10px 14px !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    overflow: visible !important;
    position: relative !important;
    z-index: 30 !important;
    box-sizing: border-box !important;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.dist-dock-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
    width: 100%;
    min-width: 0;
}

.dist-dock-top {
    padding-bottom: 8px;
    border-bottom: 1px solid #e2e8f0;
}

.dist-dock-views {
    display: flex;
    align-items: center;
    gap: 7px;
    flex-wrap: wrap;
    min-width: 0;
}

.dist-search-wrap {
    position: relative;
    flex: 1 1 240px;
    max-width: 340px;
    min-width: 180px;
}

.dist-search-ico {
    position: absolute;
    top: 50%;
    inset-inline-start: 14px;
    transform: translateY(-50%);
    color: #94a3b8;
    font-size: 0.82rem;
    pointer-events: none;
    z-index: 5;
}

.dist-search-input {
    width: 100% !important;
    min-height: 36px !important;
    padding-inline-start: 36px !important;
    padding-inline-end: 14px !important;
    border-radius: 999px !important;
    border: 1.5px solid #cbd5e1 !important;
    background: #f8fafc !important;
    font-size: 0.82rem !important;
    box-shadow: none !important;
}

.dist-search-input:focus {
    border-color: #6366f1 !important;
    background: #ffffff !important;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12) !important;
}

.dist-dock-mid {
    padding: 2px 0;
}

.dist-build-group,
.dist-system-group {
    display: flex;
    align-items: center;
    gap: 7px;
    flex-wrap: wrap;
    min-width: 0;
}

.dist-dock-export {
    background: #f4f7fc;
    border: 1px solid #e6ecf5;
    border-radius: 14px;
    padding: 6px 10px;
    justify-content: flex-start;
}

.dist-export-grid {
    display: flex;
    align-items: center;
    gap: 7px;
    flex-wrap: wrap;
    flex: 1 1 auto;
    min-width: 0;
}

.dist-act-btn {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 6px !important;
    min-height: 36px !important;
    padding: 5px 13px !important;
    border-radius: 999px !important;
    font-size: 0.79rem !important;
    font-weight: 800 !important;
    white-space: nowrap !important;
}

.dist-action-menu {
    font-size: 0.8rem;
    min-width: min(260px, calc(100vw - 2rem)) !important;
    max-width: calc(100vw - 1.5rem) !important;
    z-index: 1060 !important;
}

/* Tablet / iPad & Small Laptop (768px - 1199px) */
@media (max-width: 1199px) {
    .dist-search-wrap {
        max-width: 280px;
    }

    .dist-dock-mid {
        justify-content: space-between;
    }
}

@media (max-width: 991px) {
    .dist-dock-top {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }

    .dist-search-wrap {
        flex: 0 0 auto !important;
        flex-basis: auto !important;
        height: auto !important;
        min-width: 0;
        max-width: 100%;
        width: 100%;
    }

    .dist-search-input {
        height: 38px !important;
        min-height: 38px !important;
    }
}

/* Mobile Layout (<= 767px): Clean 2-Col Grids + Full Search, Zero Overflow */
@media (max-width: 767px) {
    #distribution-tab-pane {
        width: 100% !important;
        max-width: 100% !important;
        overflow-x: clip !important;
    }

    .dist-control-dock {
        padding: 10px !important;
        border-radius: 18px !important;
        gap: 8px;
    }

    .dist-dock-views {
        display: grid !important;
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: 7px !important;
        width: 100% !important;
    }

    .dist-stage-wrap {
        grid-column: 1 / -1 !important;
    }

    .dist-dock-mid {
        flex-direction: column;
        align-items: stretch;
        gap: 7px;
    }

    .dist-build-group,
    .dist-system-group,
    .dist-export-grid {
        display: grid !important;
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: 7px !important;
        width: 100% !important;
    }

    .dist-nisab-btn {
        grid-column: 1 / -1 !important;
    }

    .dist-system-group {
        padding-top: 7px;
        border-top: 1px dashed #e2e8f0;
    }

    [data-bs-theme="dark"] .dist-system-group {
        border-top-color: #273449;
    }

    .dist-dd-wrap,
    .dist-dd-wrap .btn,
    .dist-act-btn {
        width: 100% !important;
        min-width: 0 !important;
        font-size: 0.75rem !important;
        padding: 5px 8px !important;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .dist-dock-export {
        padding: 8px;
    }
}

[data-bs-theme="dark"] .dist-control-dock {
    background: linear-gradient(180deg, #151f32 0%, #111827 100%) !important;
    border-color: #273449 !important;
}

[data-bs-theme="dark"] .dist-dock-top { border-bottom-color: #273449; }

[data-bs-theme="dark"] .dist-dock-export {
    background: #0f172a;
    border-color: #273449;
}

[data-bs-theme="dark"] .dist-search-input {
    background: #1e293b !important;
    border-color: #334155 !important;
    color: #f8fafc !important;
}


