@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@400;500;600;700;800&family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');

.hidden,
[hidden],
.admin-only-view.hidden,
.kebab-item.hidden {
    display: none !important;
}

:root {
    --font-display: 'Outfit', sans-serif;
    --bg-body: oklch(96.8% 0.008 245); /* Warm slate surface tint instead of flat gray #f1f5f9 */
    --sidebar-bg: oklch(20% 0.035 255); /* Deep slate navy #0f172a */
    --sidebar-hover: oklch(27% 0.04 255);
    --primary-blue: oklch(50% 0.22 260); /* Vibrant royal blue #2563eb */
    --primary-blue-glow: rgba(37, 99, 235, 0.22);
    --accent-gold: oklch(68% 0.16 75); /* Warm academic gold #d97706 */
    --accent-gold-glow: rgba(217, 119, 6, 0.22);
    --table-blue: #0f172a;
    --purple-header: oklch(48% 0.20 270);
    --text-dark: oklch(18% 0.03 255); /* #0f172a */
    --text-gray: oklch(45% 0.03 255); /* Warm slate medium #64748b */
    --text-muted: oklch(60% 0.02 255);
    --border-color: oklch(89% 0.015 250); /* #cbd5e1 soft tinted border */
    --border-color-hover: oklch(75% 0.06 255);
    --card-bg: #ffffff;
    --card-bg-tint: oklch(99.2% 0.004 245);
    --bg-hover: #f1f5f9;

    /* Dedicated Input & Box Variables */
    --input-bg: oklch(98.5% 0.005 245);
    --input-text: oklch(18% 0.03 255);
    --input-placeholder: oklch(65% 0.02 255);
    --quiz-box-bg: oklch(97.2% 0.006 245);

    /* Semantic Status & Category Palette */
    --color-success: oklch(52% 0.17 155); /* Emerald Green */
    --color-success-bg: oklch(96% 0.03 155);
    --color-success-border: oklch(85% 0.07 155);
    
    --color-warning: oklch(62% 0.16 65); /* Warm Amber/Orange */
    --color-warning-bg: oklch(97% 0.04 65);
    --color-warning-border: oklch(88% 0.09 65);
    
    --color-danger: oklch(52% 0.22 25); /* Rich Crimson/Rose */
    --color-danger-bg: oklch(96% 0.04 25);
    --color-danger-border: oklch(86% 0.09 25);
    
    --color-info: oklch(50% 0.16 230); /* Ocean Blue/Teal */
    --color-info-bg: oklch(96% 0.03 230);
    --color-info-border: oklch(86% 0.08 230);
    
    --color-purple: oklch(50% 0.18 300); /* Amethyst Violet */
    --color-purple-bg: oklch(96.5% 0.03 300);
    --color-purple-border: oklch(86% 0.08 300);

    /* Category Chips */
    --chip-math: oklch(52% 0.20 260);
    --chip-science: oklch(54% 0.16 180);
    --chip-english: oklch(62% 0.16 65);
    --chip-character: oklch(55% 0.17 150);
}

html, body {
    font-family: 'Plus Jakarta Sans', sans-serif;
    margin: 0 !important;
    padding: 0 !important;
    background: var(--bg-body);
    color: var(--text-dark);
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}

/* ==========================================================================
   REFINE ACADEMIC ELEGANCE & SHARP TYPOGRAPHY AMPLIFICATION
   ========================================================================== */
h1, h2, h3, h4, h5, h6,
.page-title, .brand-title, .section-title, .menu-header, .stat-value, .brand-text {
    font-family: var(--font-display) !important;
    font-weight: 800 !important;
    letter-spacing: -0.02em !important;
}

h1, .page-title {
    font-size: 2.2rem !important;
    color: #0f172a !important;
}

h2, .section-title {
    font-size: 1.6rem !important;
}

/* High-Contrast Dark Slate Table Headers */
table th, .table th, th {
    background-color: #0f172a !important;
    color: #f8fafc !important;
    font-family: var(--font-display) !important;
    font-weight: 700 !important;
    letter-spacing: 0.8px !important;
    text-transform: uppercase !important;
    font-size: 11.5px !important;
    padding: 12px 16px !important;
}

/* Elevated Sidebar Active Pills with Warm Gold Accent */
.sidebar-btn.active, .menu-btn.active, .submenu-btn.active {
    background: #1e293b !important;
    color: #ffffff !important;
    border-left: 4px solid #d97706 !important;
    font-weight: 700 !important;
}

/* ======================================================
   REINFORCED FORM INPUTS & QUIZ BUILDER LAYOUT FIX
   ====================================================== */

/* 1. Standard text inputs & textareas (Excludes Radio & Checkboxes) */
input:not([type="radio"]):not([type="checkbox"]),
select,
textarea:not(#boardInPlaceEditor) {
    box-sizing: border-box !important;
    border-radius: 10px !important;
    border: 1px solid var(--border-color, #e2e8f0) !important;
    font-size: 14px !important;
    font-family: inherit !important;
    background: var(--input-bg, #f8fafc) !important;
    color: var(--input-text, #2b3674) !important;
    transition: background 0.2s, color 0.2s, border-color 0.2s !important;
}

/* Apply full-width block layout to standalone form inputs */
.box>input:not([type="radio"]):not([type="checkbox"]),
.box>select,
.box>textarea,
#loginScreen input {
    display: block !important;
    width: 100% !important;
    margin: 8px 0 !important;
    padding: 12px 16px !important;
}

/* 2. Reset Radio & Checkbox buttons to inline sizes */
input[type="radio"],
input[type="checkbox"] {
    display: inline-block !important;
    width: 18px !important;
    height: 18px !important;
    margin: 0 !important;
    padding: 0 !important;
    cursor: pointer !important;
    accent-color: var(--primary-blue, #1e5eff) !important;
}

/* 3. Quiz Builder Question Header Flex Fix */
.gform-question-header {
    display: flex !important;
    flex-direction: row !important;
    gap: 15px !important;
    margin-bottom: 16px !important;
    align-items: flex-start !important;
    width: 100% !important;
}

.gform-q-input,
.blk-prompt {
    flex: 1 1 auto !important;
    min-width: 0 !important;
    /* Prevents flex item from collapsing */
    width: 100% !important;
    background: var(--quiz-box-bg, #f1f3f4) !important;
    color: var(--text-dark, #2b3674) !important;
    border: none !important;
    border-bottom: 1px solid var(--border-color, #70757a) !important;
    border-radius: 4px 4px 0 0 !important;
    padding: 16px !important;
    font-size: 15px !important;
    box-sizing: border-box !important;
}

.gform-type-select {
    width: 200px !important;
    flex-shrink: 0 !important;
    /* Prevents select from taking 100% width */
    margin: 0 !important;
    padding: 12px !important;
    background: var(--card-bg, #ffffff) !important;
    color: var(--text-dark, #202124) !important;
    border: 1px solid var(--border-color, #dadce0) !important;
    border-radius: 4px !important;
}

/* 4. Quiz Builder Option Rows Flex Fix */
.gform-opt-row {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    gap: 12px !important;
    margin-bottom: 12px !important;
    width: 100% !important;
}

.gform-opt-input {
    flex: 1 !important;
    width: auto !important;
    margin: 0 !important;
    padding: 8px 0 !important;
    border: none !important;
    border-bottom: 1px solid transparent !important;
    border-radius: 0 !important;
    background: transparent !important;
    color: var(--text-dark, #202124) !important;
    font-size: 14px !important;
}

.gform-opt-input:focus {
    border-bottom: 2px solid var(--purple-header, #673ab7) !important;
    outline: none !important;
}

/* Textarea height adjustment */
textarea {
    min-height: 100px;
    resize: vertical;
}

/* Placeholder text color */
input::placeholder,
textarea::placeholder {
    color: var(--input-placeholder, #a3aed1) !important;
    opacity: 0.85;
}

/* Focus outline and border highlighting */
input:focus,
select:focus,
textarea:focus {
    outline: none !important;
    border-color: var(--primary-blue, #1e5eff) !important;
    background: var(--card-bg, #ffffff) !important;
}

/* Autocomplete wrapper fix */
.autocomplete-container {
    position: relative;
    width: 100% !important;
    display: block !important;
}

/* --- Layout Structure --- */
/* --- Facebook-Style Icon Top Navigation Bar --- */
.app-container {
    display: flex;
    flex-direction: column !important;
    width: 100vw !important;
    height: 100vh !important;
    overflow: hidden !important;
}

.sidebar,
.student-sidebar {
    width: 100vw !important;
    height: 56px !important;
    min-height: 56px !important;
    background: var(--sidebar-bg, #0b1437) !important;
    color: white !important;
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: space-between !important;
    padding: 0 16px !important;
    box-sizing: border-box !important;
    overflow: visible !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1) !important;
    z-index: 1000 !important;
}

.sidebar {
    padding: 0 20px !important;
}

.brand {
    display: flex !important;
    align-items: center !important;
    gap: 12px !important;
    margin-left: 2px !important;
    padding: 0 !important;
    border-bottom: none !important;
    flex-shrink: 0 !important;
}

.brand-badge,
.brand-logo-container,
.brand>div:first-child {
    width: 34px !important;
    height: 34px !important;
    min-width: 34px !important;
    min-height: 34px !important;
    background-color: #ffffff !important;
    border-radius: 8px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 4px !important;
    overflow: hidden !important;
    flex-shrink: 0 !important;
    box-sizing: border-box !important;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12) !important;
}

.brand-badge img,
.brand-logo-container img,
.brand>div:first-child img {
    width: 100% !important;
    height: 100% !important;
    max-width: 100% !important;
    max-height: 100% !important;
    object-fit: contain !important;
    display: block !important;
}

.brand h2 {
    font-size: 15px !important;
    font-weight: 800 !important;
    margin: 0 !important;
    letter-spacing: 0.5px !important;
    color: #ffffff !important;
}

.brand p {
    font-size: 11px !important;
    margin: 0 !important;
    color: var(--text-gray, #a0aec0) !important;
}

.menu-bar {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 6px !important;
    padding: 0 8px !important;
    height: 100% !important;
    width: auto !important;
    flex: 1 1 0 !important;
    min-width: 0 !important;
    overflow: visible !important;
}

/* Icon-only nav button with tooltip hover */
.menu-btn {
    background: transparent !important;
    color: var(--text-gray, #a0aec0) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 46px !important;
    min-width: 46px !important;
    height: 48px !important;
    padding: 0 !important;
    border-radius: 8px !important;
    border: none !important;
    cursor: pointer !important;
    position: relative !important;
    box-shadow: none !important;
    transition: all 0.2s ease !important;
    flex-shrink: 0 !important;
}

.menu-btn.menu-btn-expandable {
    width: auto !important;
    min-width: 52px !important;
    padding: 0 6px !important;
    gap: 2px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
}

.menu-btn-content {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
}

.menu-btn:hover {
    background: var(--sidebar-hover, rgba(255, 255, 255, 0.1)) !important;
    color: #ffffff !important;
    transform: none !important;
}

/* Active Tab Indicator (Facebook Style Bottom Line) */
.menu-btn.active {
    background: transparent !important;
    color: #1e5eff !important;
    box-shadow: none !important;
}

.menu-btn.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 4px;
    right: 4px;
    height: 3px;
    background: #1e5eff;
    border-radius: 3px 3px 0 0;
}

.menu-btn .menu-label {
    display: none !important;
    /* Hidden by default, shown on hover tooltip */
}

@keyframes tooltipSlideFade {
    from {
        opacity: 0;
        transform: translate(-50%, -5px);
    }
    to {
        opacity: 1;
        transform: translate(-50%, 0);
    }
}

/* Tooltip on Cursor Hover */
.menu-btn:hover::before {
    content: attr(data-label);
    position: absolute;
    top: 54px;
    left: 50%;
    transform: translateX(-50%);
    background: #0f172a;
    color: #ffffff;
    padding: 5px 10px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
    z-index: 10000;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
    pointer-events: none;
    animation: tooltipSlideFade 0.18s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.menu-icon {
    width: 22px !important;
    height: 22px !important;
    stroke: currentColor !important;
}

.user-profile-bottom {
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    padding: 0 !important;
    margin: 0 !important;
    border-top: none !important;
    flex-shrink: 0 !important;
}

.main-wrapper {
    flex: 1 !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    padding: 0 32px 40px !important;
    height: calc(100vh - 56px) !important;
    width: 100% !important;
    box-sizing: border-box !important;
}

/* Centered Main Content Wrapper (Focuses content in the middle, avoiding overstretch on large displays) */
.admin-main-container {
    width: 100% !important;
    max-width: 1240px !important;
    margin: 0 auto !important;
    display: flex !important;
    flex-direction: column !important;
    box-sizing: border-box !important;
}

.menu-btn:hover .menu-icon {
    transform: scale(1.08);
}

.menu-btn.active .menu-icon {
    transform: scale(1.05);
}

/* Submenu & Expandable Group for Top Navigation Bar */
.menu-item-group {
    position: relative !important;
    display: inline-flex !important;
    align-items: center !important;
    overflow: visible !important;
}

.submenu-arrow {
    width: 12px !important;
    height: 12px !important;
    flex-shrink: 0 !important;
    margin-left: 2px !important;
    transition: transform 0.2s ease !important;
    stroke: currentColor !important;
}

.menu-item-group:hover .submenu-arrow,
.menu-item-group.open .submenu-arrow {
    transform: rotate(180deg) !important;
}

/* Hover & Click Dropdown Popup for Databases */
.submenu {
    display: none !important;
    position: absolute !important;
    top: calc(100% + 2px) !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    background: #0b1437 !important;
    border: 1px solid rgba(255, 255, 255, 0.15) !important;
    border-radius: 12px !important;
    padding: 6px !important;
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.45) !important;
    z-index: 999999 !important;
    min-width: 170px !important;
    flex-direction: column !important;
    gap: 4px !important;
}

/* Invisible bridge so mouse moving from button to dropdown never drops hover */
.submenu::before {
    content: '' !important;
    position: absolute !important;
    top: -10px !important;
    left: 0 !important;
    right: 0 !important;
    height: 10px !important;
}

.menu-item-group:hover .submenu,
.menu-item-group.open .submenu {
    display: flex !important;
    animation: fadeIn 0.15s ease-out !important;
}

.submenu-btn {
    background: transparent !important;
    color: #a0aec0 !important;
    border: none !important;
    border-radius: 8px !important;
    box-shadow: none !important;
    display: flex !important;
    align-items: center !important;
    gap: 10px !important;
    padding: 8px 12px !important;
    font-size: 13.5px !important;
    font-weight: 600 !important;
    cursor: pointer !important;
    transition: all 0.15s ease !important;
    text-align: left !important;
    width: 100% !important;
    box-sizing: border-box !important;
    user-select: none !important;
    white-space: nowrap !important;
}

.submenu-btn:hover {
    background: rgba(255, 255, 255, 0.1) !important;
    color: #ffffff !important;
    transform: none !important;
}

.submenu-btn.active {
    background: rgba(30, 94, 255, 0.25) !important;
    color: #ffffff !important;
    font-weight: 600 !important;
    border-left: 3px solid var(--primary-blue, #1e5eff) !important;
    border-radius: 4px 10px 10px 4px !important;
}

.submenu-icon {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    stroke: currentColor;
}

/* Registration Mode Toggle */
.register-mode-toggle {
    display: inline-flex;
    background: #f1f5f9;
    padding: 3px;
    border-radius: 10px;
    border: 1px solid var(--border-color, #e2e8f0);
}

.toggle-mode-btn {
    background: transparent;
    border: none;
    padding: 6px 14px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-gray, #64748b);
    cursor: pointer;
    transition: all 0.2s ease;
}

.toggle-mode-btn.active {
    background: #ffffff;
    color: var(--primary-blue, #1e5eff);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

body.dark-theme .register-mode-toggle {
    background: #111c44;
    border-color: rgba(255, 255, 255, 0.1);
}

body.dark-theme .toggle-mode-btn {
    color: #a0aec0;
}

body.dark-theme .toggle-mode-btn.active {
    background: #1b254b;
    color: #60a5fa;
}

/* Database Table Pagination */
.db-pagination-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px solid var(--border-color, #e2e8f0);
    flex-wrap: wrap;
    gap: 12px;
}

.db-pagination-info {
    font-size: 13px;
    color: var(--text-gray, #64748b);
    font-weight: 500;
}

.db-pagination-buttons {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-top: 14px;
}

.db-page-btn {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    color: var(--text-dark, #2b3674) !important;
    min-width: 32px !important;
    height: 32px !important;
    padding: 0 8px !important;
    border-radius: 6px !important;
    font-size: 13.5px !important;
    font-weight: 600 !important;
    cursor: pointer !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: background 0.15s ease, color 0.15s ease !important;
    transform: none !important;
    outline: none !important;
}

.db-page-btn:hover:not(:disabled) {
    background: #f1f5f9 !important;
    border: none !important;
    box-shadow: none !important;
    color: var(--primary-blue, #1e5eff) !important;
    transform: none !important;
}

.db-page-btn.active {
    background: var(--primary-blue, #1e5eff) !important;
    border: none !important;
    box-shadow: none !important;
    color: #ffffff !important;
    font-weight: 700 !important;
    transform: none !important;
}

.db-page-btn:disabled {
    opacity: 0.35 !important;
    cursor: not-allowed !important;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    color: var(--text-gray, #94a3b8) !important;
    transform: none !important;
}

body.dark-theme .db-page-btn {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    color: #a0aec0 !important;
}

body.dark-theme .db-page-btn:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.08) !important;
    color: #60a5fa !important;
    border: none !important;
    box-shadow: none !important;
}

body.dark-theme .db-page-btn.active {
    background: var(--primary-blue, #1e5eff) !important;
    border: none !important;
    box-shadow: none !important;
    color: #ffffff !important;
}

body.dark-theme .db-page-btn:disabled {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    color: #64748b !important;
}

.user-profile-bottom {
    margin-top: auto;
    padding: 20px 24px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

/* --- Main Content Area --- */
.main-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 0 32px 40px;
    width: 100%;
    box-sizing: border-box;
}

/* --- Topbar Styling --- */
.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px 0;
    position: sticky;
    top: 0;
    background: var(--bg-body);
    z-index: 10;
}

.header-title h1 {
    margin: 0;
    font-size: 26px;
    font-weight: 800;
    color: var(--text-dark);
    letter-spacing: -0.5px;
}

.header-title p {
    margin: 6px 0 0 0;
    color: var(--text-gray, #707eae);
    font-size: 16px;
    font-weight: 500;
}

.welcome-user-highlight {
    font-size: 17.5px;
    font-weight: 800;
    color: var(--primary-blue, #1e5eff);
    letter-spacing: 0.2px;
}

body.dark-theme .welcome-user-highlight,
body.dark-mode .welcome-user-highlight {
    color: #60a5fa !important;
    text-shadow: 0 0 16px rgba(96, 165, 250, 0.4);
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

.logout-btn {
    background: transparent;
    color: #e02d2d;
    border: 1px solid #e02d2d;
    padding: 8px 20px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: 0.2s;
}

.logout-btn:hover {
    background: #ffeaea;
}

/* --- Dashboard Stats --- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    /* Updated for 6 items */
    gap: 20px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--card-bg);
    border-radius: 16px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.03);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.stat-info p {
    margin: 0;
    font-size: 12px;
    color: #707eae;
    font-weight: 500;
}

.stat-info h3 {
    margin: 4px 0 0;
    font-size: 22px;
    color: var(--text-dark);
}

/* --- Content Layout --- */
.tab-content {
    display: none;
    width: 100%;
    max-width: 1240px;
    margin-left: auto;
    margin-right: auto;
    box-sizing: border-box;
}

.tab-content.active {
    display: block !important;
    animation: fadeInUpTab 0.22s cubic-bezier(0.22, 1, 0.36, 1) !important;
}

@keyframes fadeInUpTab {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.dashboard-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 24px;
    margin-bottom: 24px;
    align-items: start;
    /* Prevents boxes from stretching vertically */
}

.box {
    background: var(--card-bg);
    padding: 24px;
    border-radius: 20px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.03);
    margin-bottom: 24px;
    height: fit-content;
    /* Hugs the internal content height strictly */
}

.box h3 {
    margin-top: 0;
    font-size: 18px;
    color: var(--text-dark);
    font-weight: 700;
    margin-bottom: 16px;
}

/* --- Form Elements --- */
/* Global Form Elements Dark/Light Synchronization */
input,
select,
textarea:not(#boardInPlaceEditor) {
    display: block;
    width: 100%;
    margin: 8px 0;
    padding: 12px 16px;
    box-sizing: border-box;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    font-size: 14px;
    background: var(--input-bg);
    color: var(--input-text);
    transition: background 0.2s, color 0.2s, border-color 0.2s;
}

input:focus,
select:focus {
    outline: none;
    border-color: var(--primary-blue);
    background: white;
}

.box button.btn-submit,
.box button.login-btn,
.form-box button {
    background: var(--primary-blue);
    color: white;
    border: none;
    font-weight: 600;
    cursor: pointer;
    transition: 0.2s;
    padding: 12px;
    border-radius: 8px;
    width: 100%;
}

.box button.btn-submit:hover,
.box button.login-btn:hover,
.form-box button:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

.table-responsive {
    display: block;
    width: 100%;
    overflow-x: auto !important;
    overflow-y: auto;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    min-height: 220px;
    /* Prevents short tables from cutting off kebab popups */
    padding-bottom: 50px;
    /* Extra spacing at bottom for open menus */
    -webkit-overflow-scrolling: touch;
    touch-action: pan-x pan-y;
}

/* Kebab Dropdown Menu Z-Index & Positioning */
.dropdown-menu {
    display: none;
    position: absolute;
    right: 0;
    top: 100%;
    background: white;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
    border-radius: 8px;
    z-index: 999;
    /* Keeps popup above all other table rows */
    min-width: 170px;
    border: 1px solid var(--border-color);
}

table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    white-space: nowrap;
}

th,
td {
    border-bottom: 1px solid var(--border-color);
    padding: 16px;
    text-align: left;
    font-size: 14px;
}

#studentsTable th,
#adminTable th {
    background-color: var(--table-blue);
    color: white;
    font-weight: 500;
}

#pointsTable th {
    background-color: var(--purple-header);
    color: white;
    font-weight: 500;
}

td {
    color: #475569;
    font-weight: 500;
}

edit-btn,
.delete-btn {
    width: auto;
    padding: 6px 12px;
    font-size: 12px;
    border-radius: 6px;
    margin: 2px;
}

.edit-btn {
    background: transparent;
    border: 1px solid var(--primary-blue);
    color: var(--primary-blue);
}

.delete-btn {
    background: transparent;
    border: 1px solid #e02d2d;
    color: #e02d2d;
}

.edit-btn:hover {
    background: var(--primary-blue);
    color: white;
}

.delete-btn:hover {
    background: #e02d2d;
    color: white;
}

.hidden {
    display: none !important;
}

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

/* Notice List Styling */
.notice-item {
    display: flex;
    gap: 16px;
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid #eee;
}

.notice-date {
    background: #f0f4ff;
    color: var(--primary-blue);
    padding: 8px 12px;
    border-radius: 8px;
    text-align: center;
    height: fit-content;
    font-weight: bold;
}

.notice-content h4 {
    margin: 0 0 4px 0;
    font-size: 15px;
}

.notice-content p {
    margin: 0;
    font-size: 13px;
    color: #707eae;
}

/* Dashboard Overview Grid & Panels */
.dashboard-overview-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
    margin-bottom: 24px;
    align-items: stretch;
}

.dashboard-panel {
    margin-bottom: 0 !important;
    height: 100%;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
}

.quick-actions-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.quick-action-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 14px 18px;
    border-radius: 14px;
    border: 1px solid #edf2f7;
    background: var(--card-bg, #ffffff);
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-sizing: border-box;
}

.quick-action-item:hover {
    background: #f8fafc;
    border-color: rgba(30, 94, 255, 0.3);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.quick-action-item .stat-icon {
    border-radius: 12px;
    flex-shrink: 0;
    transition: transform 0.2s ease;
}

.quick-action-item:hover .stat-icon {
    transform: scale(1.06);
}

body.dark-theme .quick-action-item {
    border-color: rgba(255, 255, 255, 0.08);
    background: #18224d;
}

body.dark-theme .quick-action-item:hover {
    background: #1f2c63;
    border-color: rgba(30, 94, 255, 0.5);
}

/* ======================================================
   LOGIN SCREEN CONTAINER FIX
   ====================================================== */

.hidden,
#adminDashboard.hidden,
#loginScreen.hidden {
    display: none !important;
}

#loginScreen {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    z-index: 9999 !important;
    background: var(--bg-body) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 20px !important;
    box-sizing: border-box !important;
}

/* Force hiding when JavaScript adds the .hidden class */
#loginScreen.hidden {
    display: none !important;
}

.login-card {
    width: 100% !important;
    max-width: 400px !important;
    padding: 32px 28px !important;
    border-radius: 20px !important;
    background: var(--card-bg) !important;
    border: 1px solid var(--border-color) !important;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3) !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 16px !important;
    box-sizing: border-box !important;
}

#loginScreen h2 {
    margin: 0 0 4px 0;
    color: var(--text-dark);
    font-size: 22px;
    font-weight: 700;
    text-align: center;
}

#loginScreen input {
    margin: 0 !important;
    width: 100% !important;
    height: 48px;
    padding: 12px 16px;
    font-size: 14px;
    background: var(--input-bg);
    color: var(--input-text);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    box-sizing: border-box;
}

#loginScreen input::placeholder {
    color: var(--input-placeholder);
    opacity: 0.85;
}

#loginScreen button {
    margin-top: 8px !important;
    height: 48px;
    font-size: 15px;
    font-weight: 600;
    background: var(--primary-blue);
    color: #ffffff;
    border-radius: 10px;
    cursor: pointer;
    transition: opacity 0.2s ease;
}

#loginScreen button:hover {
    opacity: 0.9;
}

.kebab-menu {
    position: relative;
    display: inline-block;
}

.kebab-btn {
    background: none;
    border: none;
    font-size: 20px;
    font-weight: bold;
    cursor: pointer;
    padding: 0 10px;
    color: var(--text-gray);
    width: auto;
}

.kebab-btn:hover {
    color: var(--text-dark);
}

.dropdown-menu {
    display: none;
    position: absolute;
    right: 0;
    top: 100%;
    background: white;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
    border-radius: 8px;
    overflow: hidden;
    z-index: 100;
    min-width: 170px;
    border: 1px solid var(--border-color);
}

.dropdown-menu.show {
    display: block;
    animation: fadeIn 0.2s ease-in-out;
}

.dropdown-item {
    display: block;
    width: 100%;
    text-align: left;
    padding: 10px 16px;
    background: none;
    border: none;
    border-bottom: 1px solid #f1f5f9;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    color: var(--text-dark);
    border-radius: 0;
}

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

.dropdown-item:hover {
    background: #f8fafc;
    color: var(--primary-blue);
    transform: none;
    /* overrides global button hover */
}

.dropdown-item.danger {
    color: #e02d2d;
}

.dropdown-item.danger:hover {
    background: #ffeaea;
}

.eye-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 16px;
    padding: 4px;
    color: #a3aed1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: 0.2s;
    border-radius: 4px;
    width: auto;
    margin: 0;
}

.eye-btn:hover {
    background: #eef2ff;
    color: var(--primary-blue);
}

/* --- Autocomplete Dropdowns --- */
.autocomplete-container {
    position: relative;
    width: 100%;
}

.autocomplete-items {
    position: absolute;
    border: 1px solid var(--border-color);
    border-top: none;
    z-index: 99;
    top: 100%;
    left: 0;
    right: 0;
    max-height: 200px;
    overflow-y: auto;
    background: white;
    border-radius: 0 0 10px 10px;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.05);
}

.autocomplete-items div {
    padding: 12px 16px;
    cursor: pointer;
    background-color: #fff;
    border-bottom: 1px solid #f1f5f9;
    font-size: 14px;
    color: var(--text-dark);
}

.autocomplete-items div:hover {
    background-color: #eef2ff;
    color: var(--primary-blue);
    font-weight: 500;
}

.autocomplete-items div:last-child {
    border-bottom: none;
}

/* --- Redesigned Manage Quiz Layout --- */
.quiz-header-bar {
    background: #1c1c1c;
    color: white;
    padding: 20px 30px;
    border-radius: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.quiz-header-info h2 {
    margin: 0;
    font-size: 18px;
    display: inline-block;
}

.save-status {
    font-size: 12px;
    color: #a3aed1;
    margin-left: 15px;
}

.quiz-header-info p {
    margin: 5px 0 0;
    font-size: 13px;
    color: #a3aed1;
}

.preview-btn {
    background: #dcd6ff;
    color: #5a32a3;
    border-radius: 8px;
    width: auto;
    font-weight: 600;
    padding: 10px 20px;
}

.preview-btn:hover {
    background: #cbbfff;
}

.quiz-tabs {
    display: flex;
    gap: 20px;
    border-bottom: 1px solid #e2e8f0;
    margin-bottom: 24px;
    padding-bottom: 10px;
}

.tab-btn {
    background: none;
    color: #707eae;
    border: none;
    font-size: 14px;
    font-weight: 600;
    padding: 0;
    width: auto;
    cursor: pointer;
}

.tab-btn.active {
    color: #2b3674;
}

.tab-btn.text-blue {
    color: #1e5eff;
}

.quiz-builder-layout {
    display: grid;
    grid-template-columns: 240px 1fr 300px;
    gap: 24px;
    align-items: start;
}

/* Left Sidebar */
.quiz-sidebar-left h4 {
    margin-top: 0;
    color: #2b3674;
}

.question-category h5 {
    color: #707eae;
    font-size: 12px;
    text-transform: uppercase;
    margin: 20px 0 10px;
}

.q-type-btn {
    background: white;
    border: 1px solid transparent;
    color: #2b3674;
    text-align: left;
    padding: 10px 15px;
    border-radius: 8px;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.02);
}

.q-type-btn.active,
.q-type-btn:hover {
    border: 1px solid #9b51e0;
    background: #faf7ff;
}

.q-type-btn .icon {
    display: inline-flex;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    color: white;
}

.mcq-icon {
    background: #9b51e0;
}

.tf-icon {
    background: #8b5cf6;
}

.open-icon {
    background: #334155;
}

.poll-icon {
    background: #475569;
}

.reorder-icon {
    background: #10b981;
}

.match-icon {
    background: #34d399;
}

.drag-icon {
    background: #3b82f6;
}

.sequence-icon {
    background: #60a5fa;
}

/* Middle Editor */
.editor-title-row {
    margin-bottom: 20px;
}

.invisible-input {
    border: none;
    background: transparent;
    font-size: 22px;
    font-weight: bold;
    color: #2b3674;
    padding: 0;
    width: 100%;
    border-bottom: 1px solid transparent;
}

.invisible-input:focus {
    border-bottom: 1px solid #e2e8f0;
    background: white;
}

.quiz-block-new {
    background: white;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.02);
}

.q-settings-row {
    display: flex;
    gap: 10px;
    align-items: center;
    background: #f8fafc;
    padding: 8px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.q-settings-row select,
.q-settings-row .styled-select {
    margin: 0;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 8px;
    font-size: 13px;
    width: auto;
    flex: 1;
}

.q-number-badge {
    background: #9b51e0;
    color: white;
    border-radius: 4px;
    padding: 4px 8px;
    font-size: 13px;
    font-weight: bold;
}

.q-actions {
    margin-left: auto;
    display: flex;
    gap: 5px;
}

.icon-btn {
    background: transparent;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    width: 32px;
    height: 32px;
    padding: 0;
    color: #707eae;
    display: flex;
    align-items: center;
    justify-content: center;
}

.icon-btn:hover {
    background: #f1f5f9;
    color: #e02d2d;
}

.q-block-body label {
    font-size: 13px;
    font-weight: 600;
    color: #2b3674;
    margin-bottom: 8px;
    display: block;
}

.q-text-input {
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 12px;
    width: 100%;
    margin-bottom: 10px;
    font-family: inherit;
    resize: vertical;
}

.add-media-link,
.add-explanation-link {
    color: #9b51e0;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    display: inline-block;
    margin-bottom: 20px;
}

.toggle-row {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    margin-bottom: 20px;
    font-weight: 500;
}

.option-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.opt-radio {
    margin: 0;
    width: 20px;
    height: 20px;
    accent-color: #10b981;
}

.opt-input-wrapper {
    flex: 1;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.opt-label {
    font-size: 11px;
    color: #707eae;
    background: #f8fafc;
    padding: 6px 12px;
    border-bottom: 1px solid #e2e8f0;
    font-weight: 600;
}

.opt-text {
    border: none;
    margin: 0;
    border-radius: 0;
    background: white;
    padding: 10px 12px;
}

.add-choice-btn {
    background: #f8fafc;
    color: #707eae;
    border: 1px dashed #cbd5e1;
    width: 100%;
    font-weight: 600;
    padding: 12px;
    border-radius: 8px;
    margin-top: 10px;
}

.add-choice-btn:hover {
    background: #f1f5f9;
}

.save-quiz-btn {
    background: #9b51e0;
    color: white;
    padding: 15px;
    border-radius: 12px;
    font-size: 15px;
}

/* Right Sidebar */
.right-panel-box {
    background: white;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    padding: 20px;
    margin-bottom: 20px;
}

.right-panel-box h4 {
    margin-top: 0;
    margin-bottom: 15px;
    color: #2b3674;
}

.flex-row {
    display: flex;
    gap: 12px;
}

.field-group {
    flex: 1;
    margin-bottom: 15px;
}

.field-group label {
    display: block;
    font-size: 13px;
    color: #707eae;
    margin-bottom: 6px;
    font-weight: 600;
}

.styled-select,
.styled-textarea {
    width: 100%;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 10px;
    background: white;
    margin: 0;
}

.media-upload-box {
    border: 1px dashed #cbd5e1;
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    background: #f8fafc;
}

.media-upload-box .upload-icon {
    display: block;
    font-size: 24px;
    margin-bottom: 10px;
    color: #9b51e0;
}

.media-upload-box p {
    font-size: 12px;
    color: #707eae;
    margin: 0;
}

.media-upload-box a {
    color: #9b51e0;
    font-weight: 600;
    text-decoration: none;
}

.resource-card {
    background: white;
    padding: 20px;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
}

.resource-card h5 {
    margin: 0 0 15px 0;
    font-size: 14px;
    color: #2b3674;
    line-height: 1.4;
}

.author-info {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 15px;
}

.progress-bar-container {
    display: flex;
    align-items: center;
    gap: 10px;
}

.progress-bar {
    height: 6px;
    background: #e2e8f0;
    border-radius: 3px;
    flex: 1;
    position: relative;
}

.progress-bar::after {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 78%;
    background: #9b51e0;
    border-radius: 3px;
}

.progress-text {
    font-size: 12px;
    font-weight: bold;
    color: #9b51e0;
}

/* --- Google Forms Style Quiz Builder --- */
.gform-container {
    background-color: #f0ebf8;
    position: fixed;
    /* Changed from absolute to fixed */
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    /* Changed to force bounds */
    z-index: 2000 !important;
    overflow-y: auto;
    /* Re-enables scrolling */
}

/* Reset button overrides for Quiz Builder elements */
.gform-container button {
    width: auto;
    font-family: inherit;
}

.gform-header {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    background: var(--card-bg, #ffffff) !important;
    padding: 0 24px !important;
    height: 64px !important;
    min-height: 64px !important;
    border-bottom: 1px solid var(--border-color, #dadce0) !important;
    position: sticky !important;
    top: 0 !important;
    z-index: 100 !important;
    box-sizing: border-box !important;
}

.gform-header-left {
    display: flex !important;
    align-items: center !important;
    gap: 12px !important;
}

.gform-title-input {
    font-size: 18px !important;
    border: none !important;
    padding: 6px 10px !important;
    border-radius: 6px !important;
    color: var(--text-dark, #202124) !important;
    background: transparent !important;
    width: 250px !important;
}

.gform-title-input:focus {
    background: #f1f3f4 !important;
    outline: none !important;
    border-bottom: 2px solid #673ab7 !important;
    border-bottom-left-radius: 0 !important;
    border-bottom-right-radius: 0 !important;
}

.gform-header-center {
    display: flex !important;
    align-items: flex-end !important;
    justify-content: center !important;
    height: 100% !important;
    position: absolute !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    top: 0 !important;
    bottom: 0 !important;
}

.gform-tab {
    background: transparent !important;
    border: none !important;
    font-size: 15px !important;
    color: var(--text-gray, #5f6368) !important;
    padding: 0 20px !important;
    height: 100% !important;
    width: auto !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer !important;
    font-weight: 600 !important;
    border-radius: 0 !important;
    border-bottom: 3px solid transparent !important;
    margin-bottom: -1px !important;
    transition: all 0.2s ease !important;
}

.gform-tab:hover {
    color: var(--text-dark, #202124) !important;
    background: rgba(103, 58, 183, 0.04) !important;
}

.gform-tab.active {
    color: #673ab7 !important;
    border-bottom-color: #673ab7 !important;
    background: transparent !important;
}

.gform-publish-btn {
    background: #673ab7;
    color: white;
    border-radius: 4px;
    padding: 8px 24px;
    font-weight: 500;
    font-size: 14px;
    border: none;
    cursor: pointer;
}

.save-status {
    color: #70757a;
    font-size: 14px;
    margin-left: 10px;
}

.gform-body {
    padding: 30px 20px 150px 20px;
    /* Added extra bottom padding */
    display: flex;
    justify-content: center;
    position: relative;
}

.gform-content-wrapper {
    width: 100%;
    max-width: 770px;
    position: relative;
}

/* The Cards */
.gform-card {
    background: white;
    border-radius: 8px;
    border: 1px solid #dadce0;
    margin-bottom: 12px;
    padding: 24px;
    position: relative;
    transition: box-shadow 0.2s;
    cursor: pointer;
}

.gform-card.active-card {
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    border-left: 6px solid #4285f4;
    border-radius: 8px;
    cursor: default;
}

.title-card {
    border-top: 10px solid #673ab7;
    padding-top: 32px;
    border-left: 1px solid #dadce0;
    border-radius: 8px;
}

.title-card.active-card {
    border-left: 6px solid #4285f4;
    border-top: 10px solid #673ab7;
    border-top-left-radius: 8px;
}

/* Inputs */
.gform-h1-input {
    font-size: 32px;
    font-weight: 400;
    width: 100%;
    border: none;
    border-bottom: 1px solid transparent;
    padding: 4px 0;
    margin-bottom: 8px;
}

.gform-h1-input:focus {
    border-bottom: 2px solid #673ab7;
    outline: none;
}

.gform-desc-input {
    font-size: 13px;
    color: #202124;
    width: 100%;
    border: none;
    border-bottom: 1px solid transparent;
    padding: 4px 0;
}

.gform-desc-input:focus {
    border-bottom: 2px solid #673ab7;
    outline: none;
}

/* Floating Toolbar */
.gform-floating-toolbar {
    position: absolute !important;
    right: -58px !important;
    top: 0;
    background: #ffffff !important;
    border-radius: 12px !important;
    border: 1px solid #cbd5e1 !important;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08) !important;
    display: flex !important;
    flex-direction: column !important;
    padding: 6px !important;
    gap: 6px !important;
    transition: top 0.22s cubic-bezier(0.2, 0.8, 0.2, 1) !important;
    z-index: 100 !important;
    width: auto !important;
}

.gform-floating-toolbar button {
    background: #f8fafc !important;
    border: 1px solid #e2e8f0 !important;
    color: #334155 !important;
    cursor: pointer !important;
    padding: 0 !important;
    border-radius: 8px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 36px !important;
    height: 36px !important;
    min-width: 36px !important;
    max-width: 36px !important;
    transition: all 0.2s ease !important;
}

.gform-floating-toolbar button:hover {
    background: #673ab7 !important;
    border-color: #673ab7 !important;
    color: #ffffff !important;
    transform: scale(1.06) !important;
}

.gform-floating-toolbar button:hover {
    background: #f1f3f4;
    color: #202124;
}

/* Question Block Elements */
.gform-question-header {
    display: flex;
    gap: 15px;
    margin-bottom: 16px;
    align-items: flex-start;
}

.gform-q-input {
    flex: 1;
    background: #f1f3f4;
    border: none;
    border-bottom: 1px solid #70757a;
    border-radius: 4px 4px 0 0;
    padding: 16px;
    font-size: 15px;
}

.gform-q-input:focus {
    border-bottom: 2px solid #673ab7;
    outline: none;
    background: #e8eaed;
}

.gform-type-select {
    border: 1px solid #dadce0;
    border-radius: 4px;
    padding: 12px;
    font-size: 14px;
    background: white;
    width: 200px;
    color: #202124;
}

.gform-opt-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.gform-opt-row input[type="radio"] {
    width: 18px !important;
    height: 18px !important;
    margin: 0 !important;
    cursor: pointer !important;
    pointer-events: auto !important;
    /* Re-enables mouse clicks */
    accent-color: var(--primary-blue, #1e5eff) !important;
}

.gform-opt-input {
    flex: 1;
    border: none;
    border-bottom: 1px solid transparent;
    padding: 4px 0;
    font-size: 14px;
}

.gform-opt-input:focus {
    border-bottom: 2px solid #673ab7;
    outline: none;
}

.gform-add-opt {
    color: #1a73e8;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
}

.gform-card-footer {
    border-top: 1px solid #dadce0;
    margin-top: 24px;
    padding-top: 16px;
    display: flex;
    justify-content: flex-end;
    gap: 16px;
    align-items: center;
    color: #5f6368;
}

/* --- Floating Rich Text Popup & ContentEditable Styles --- */
.rich-text-popup {
    position: fixed !important;
    z-index: 3000 !important;
    display: none;
    align-items: center !important;
    gap: 6px !important;
    padding: 6px 12px !important;
    background: #ffffff !important;
    border: 1px solid #cbd5e1 !important;
    border-radius: 30px !important;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12), 0 2px 6px rgba(0, 0, 0, 0.04) !important;
    pointer-events: auto !important;
    width: auto !important;
}

.rich-text-popup select {
    background: #f8fafc !important;
    border: 1px solid #cbd5e1 !important;
    border-radius: 20px !important;
    padding: 5px 12px !important;
    font-size: 13px !important;
    font-weight: 500 !important;
    color: #1e293b !important;
    outline: none !important;
    cursor: pointer !important;
    width: auto !important;
}

.rich-text-popup select:hover {
    background: #f1f5f9 !important;
    border-color: #94a3b8 !important;
}

.rich-text-popup .rt-btn {
    background: transparent !important;
    border: 1px solid #cbd5e1 !important;
    border-radius: 20px !important;
    min-width: 32px !important;
    width: 32px !important;
    height: 32px !important;
    padding: 0 !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    color: #334155 !important;
    cursor: pointer !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: all 0.2s ease !important;
}

.rich-text-popup .rt-btn:hover {
    background: #f1f5f9 !important;
    color: #0f172a !important;
    border-color: #94a3b8 !important;
}

.rich-text-popup .rt-btn:active {
    background: #e2e8f0 !important;
}

/* Force SVGs inside buttons and containers to be clearly visible */
.gform-container svg,
.rich-text-popup svg {
    display: inline-block !important;
    vertical-align: middle !important;
    stroke: currentColor !important;
    flex-shrink: 0 !important;
}

/* Unified icon-btn styles inside Quiz Builder */
.gform-container .icon-btn,
.icon-btn {
    background: #ffffff !important;
    border: 1px solid #cbd5e1 !important;
    border-radius: 8px !important;
    width: 34px !important;
    height: 34px !important;
    min-width: 34px !important;
    max-width: 34px !important;
    padding: 0 !important;
    color: #334155 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05) !important;
}

.gform-container .icon-btn:hover,
.icon-btn:hover {
    background: #f1f5f9 !important;
    color: #0f172a !important;
    border-color: #94a3b8 !important;
    transform: translateY(-1px) !important;
}

.gform-container .icon-btn.duplicate,
.icon-btn.duplicate {
    color: #64748b !important;
}

.gform-container .icon-btn.duplicate:hover,
.icon-btn.duplicate:hover {
    background: #eff6ff !important;
    border-color: #93c5fd !important;
    color: #2563eb !important;
}

.gform-container .icon-btn.delete,
.icon-btn.delete {
    color: #64748b !important;
}

.gform-container .icon-btn.delete:hover,
.icon-btn.delete:hover {
    background: #fef2f2 !important;
    border-color: #fca5a5 !important;
    color: #dc2626 !important;
}

/* Dark Theme overrides for Quiz Builder */
body.dark-theme .gform-container {
    background-color: #0b1437 !important;
}

body.dark-theme .gform-header {
    background: #111c44 !important;
    border-bottom-color: rgba(255, 255, 255, 0.1) !important;
}

body.dark-theme .gform-title-input {
    color: #ffffff !important;
    background: transparent !important;
}

body.dark-theme .gform-title-input:focus {
    background: #1b254b !important;
}

body.dark-theme .gform-tab {
    color: #a3aed1 !important;
}

body.dark-theme .gform-tab:hover {
    color: #ffffff !important;
    background: rgba(139, 92, 246, 0.1) !important;
}

body.dark-theme .gform-tab.active {
    color: #a78bfa !important;
    border-bottom-color: #a78bfa !important;
}

body.dark-theme .gform-card {
    background: #111c44 !important;
    border-color: rgba(255, 255, 255, 0.1) !important;
}

body.dark-theme .gform-card.active-card {
    border-left-color: #6366f1 !important;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4) !important;
}

body.dark-theme .title-card {
    border-top-color: #8b5cf6 !important;
}

body.dark-theme .gform-h1-input {
    color: #ffffff !important;
}

body.dark-theme .gform-desc-input {
    color: #cbd5e1 !important;
}

body.dark-theme .gform-q-input,
body.dark-theme .blk-prompt {
    background: #1b254b !important;
    color: #ffffff !important;
    border-bottom-color: #475569 !important;
}

body.dark-theme .gform-q-input:focus {
    background: #24305e !important;
    border-bottom-color: #8b5cf6 !important;
}

body.dark-theme .gform-opt-input {
    color: #ffffff !important;
}

body.dark-theme .gform-type-select {
    background: #1b254b !important;
    color: #ffffff !important;
    border-color: rgba(255, 255, 255, 0.15) !important;
}

body.dark-theme .gform-container .icon-btn,
body.dark-theme .icon-btn {
    background: #1b254b !important;
    border-color: rgba(255, 255, 255, 0.15) !important;
    color: #e2e8f0 !important;
}

body.dark-theme .gform-container .icon-btn:hover,
body.dark-theme .icon-btn:hover {
    background: #24305e !important;
    color: #ffffff !important;
    border-color: rgba(255, 255, 255, 0.3) !important;
}

body.dark-theme .gform-container .icon-btn.delete,
body.dark-theme .icon-btn.delete {
    color: #94a3b8 !important;
}

body.dark-theme .gform-container .icon-btn.delete:hover,
body.dark-theme .icon-btn.delete:hover {
    background: #7f1d1d !important;
    border-color: #ef4444 !important;
    color: #fca5a5 !important;
}

body.dark-theme .gform-floating-toolbar {
    background: #111c44 !important;
    border-color: rgba(255, 255, 255, 0.15) !important;
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.5) !important;
}

body.dark-theme .gform-floating-toolbar button {
    background: #1b254b !important;
    border-color: rgba(255, 255, 255, 0.1) !important;
    color: #e2e8f0 !important;
}

body.dark-theme .gform-floating-toolbar button:hover {
    background: #8b5cf6 !important;
    border-color: #8b5cf6 !important;
    color: #ffffff !important;
}

body.dark-theme .rich-text-popup {
    background: #111c44 !important;
    border-color: rgba(255, 255, 255, 0.15) !important;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6) !important;
}

body.dark-theme .rich-text-popup select {
    background: #1b254b !important;
    border-color: rgba(255, 255, 255, 0.15) !important;
    color: #ffffff !important;
}

body.dark-theme .rich-text-popup .rt-btn {
    border-color: rgba(255, 255, 255, 0.15) !important;
    color: #e2e8f0 !important;
}

body.dark-theme .rich-text-popup .rt-btn:hover {
    background: #1b254b !important;
    color: #ffffff !important;
    border-color: #8b5cf6 !important;
}

div.gform-h1-input,
div.gform-desc-input {
    min-height: 1.2em;
    cursor: text;
    outline: none;
}

div.gform-h1-input:empty:before {
    content: attr(data-placeholder);
    color: #70757a;
    pointer-events: none;
    display: block;
}

div.gform-desc-input:empty:before {
    content: attr(data-placeholder);
    color: #70757a;
    pointer-events: none;
    display: block;
}

div.gform-q-input {
    flex: 1;
    background: #f1f3f4;
    border: none;
    border-bottom: 1px solid #70757a;
    border-radius: 4px 4px 0 0;
    padding: 16px;
    font-size: 15px;
    min-height: 24px;
    cursor: text;
    outline: none;
}

div.gform-q-input:focus {
    border-bottom: 2px solid #673ab7;
    outline: none;
    background: #e8eaed;
}

div.gform-q-input:empty:before {
    content: attr(data-placeholder);
    color: #70757a;
    pointer-events: none;
    display: block;
}



[contenteditable="true"]:empty:before {
    content: attr(data-placeholder);
    color: #707eae;
    pointer-events: none;
    display: block;
}

.blk-prompt,
.blk-desc {
    min-height: 24px;
    /* Prevents the div from completely collapsing */
    outline: none;
}

/* ======================================================
   RESPONSIVE MOBILE FIX (IPHONE 13 & MOBILE SCREENS)
   ====================================================== */
/* ======================================================
   RESPONSIVE MOBILE FIX (IPHONE 13 & MOBILE SCREENS)
   ====================================================== */
@media screen and (max-width: 430px) {

    /* 1. Native Page Vertical Scrolling Fix */
    html,
    body {
        width: 100% !important;
        max-width: 100vw !important;
        min-height: 100% !important;
        height: auto !important;
        overflow-x: hidden !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch !important;
        position: relative !important;
    }

    .app-container {
        display: flex !important;
        flex-direction: column !important;
        width: 100% !important;
        max-width: 100vw !important;
        height: auto !important;
        min-height: 100vh !important;
        overflow: visible !important;
        box-sizing: border-box !important;
    }

    .main-wrapper {
        width: 100% !important;
        max-width: 100vw !important;
        height: auto !important;
        overflow: visible !important;
        padding: 0 12px 32px !important;
        box-sizing: border-box !important;
    }

    /* 2. Mobile Topbar Fix (Horizontal Flex Bar across iPhone & Mobile Screens) */
    .sidebar,
    .student-sidebar {
        width: 100vw !important;
        height: 56px !important;
        min-height: 56px !important;
        max-height: 56px !important;
        padding: 0 8px !important;
        display: flex !important;
        flex-direction: row !important;
        align-items: center !important;
        justify-content: space-between !important;
        box-sizing: border-box !important;
        overflow: visible !important;
    }

    .brand {
        display: flex !important;
        flex-direction: row !important;
        align-items: center !important;
        width: auto !important;
        margin: 0 !important;
        padding: 0 !important;
        flex-shrink: 0 !important;
    }

    .menu-bar {
        display: flex !important;
        flex-direction: row !important;
        align-items: center !important;
        justify-content: center !important;
        gap: 2px !important;
        padding: 0 !important;
        width: auto !important;
        flex: 1 !important;
        margin: 0 4px !important;
        overflow: visible !important;
    }

    .menu-btn {
        width: 36px !important;
        height: 36px !important;
        min-width: 36px !important;
        padding: 0 !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        border-radius: 8px !important;
    }

    .menu-icon {
        width: 16px !important;
        height: 16px !important;
    }

    .submenu {
        margin-left: 6px !important;
        padding: 4px 0 4px 8px !important;
    }

    .user-profile-bottom {
        display: none !important;
    }

    /* 3. Topbar Header & Actions */
    .topbar {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 12px !important;
        padding: 12px 0 !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }

    .header-title h1 {
        font-size: 20px !important;
    }

    .topbar-actions {
        width: 100% !important;
        display: flex !important;
        justify-content: space-between !important;
        gap: 10px !important;
        box-sizing: border-box !important;
    }

    .theme-toggle-btn,
    .logout-btn {
        flex: 1 !important;
        text-align: center !important;
        box-sizing: border-box !important;
    }

    .tab-content {
        width: 100% !important;
        box-sizing: border-box !important;
    }

    /* 4. Container & Box Overflow Fix */
    .stats-grid,
    .dashboard-grid,
    .behavior-form-row-split,
    .box div[style*="grid-template-columns"] {
        display: flex !important;
        flex-direction: column !important;
        grid-template-columns: 1fr !important;
        gap: 12px !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }

    .box {
        padding: 16px 12px !important;
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
        overflow: visible !important;
    }

    /* 5. Dropdowns & Form Controls */
    .form-row,
    .form-group,
    .behavior-action-row,
    .box div[style*="display: flex"] {
        display: flex !important;
        flex-direction: column !important;
        width: 100% !important;
        gap: 10px !important;
        align-items: stretch !important;
    }

    .box select,
    .box input:not([type="radio"]):not([type="checkbox"]),
    .box button,
    .box textarea,
    .box div[style*="display: flex"] select,
    .box header select,
    #sortPoints,
    #sortStudents,
    #filterClass,
    #filterScoreClass,
    #filterPointsClass,
    #ledgerClassSelect,
    #ledgerQuizSelect,
    #ledgerSortSelect,
    #directSubjectSelect,
    #directClassSelect,
    #directQuizSelect {
        width: 100% !important;
        min-width: 0 !important;
        max-width: 100% !important;
        display: block !important;
        box-sizing: border-box !important;
        margin: 0 0 8px 0 !important;
    }

    /* Modal Windows */
    #loginScreen,
    .modal-card,
    #quizResultsModal .box,
    #studentAnswersModal .box,
    #pointModal .box {
        width: 95% !important;
        max-width: 100% !important;
        padding: 20px 16px !important;
        border-radius: 14px !important;
    }

    /* 6. Table Touch Scrolling (Restores Vertical & Horizontal Gestures) */
    .table-responsive {
        width: 100% !important;
        max-width: 100% !important;
        overflow-x: auto !important;
        overflow-y: visible !important;
        -webkit-overflow-scrolling: touch !important;
        touch-action: auto !important;
        display: block !important;
        box-sizing: border-box !important;
        border-radius: 8px !important;
    }

    .table-responsive table,
    #studentsTable,
    #pointsTable,
    #behaviorTabPointsTable,
    #manageScoreTable,
    #manageNewsTable,
    #quizTable {
        width: 100% !important;
        min-width: 580px !important;
        border-collapse: collapse !important;
        white-space: nowrap !important;
    }
}


/* ======================================================
   RESPONSIVE DESIGN: IPAD & TABLET (768px to 1024px)
   ====================================================== */
@media screen and (min-width: 768px) and (max-width: 1024px) {
    .app-container {
        flex-direction: column !important;
    }

    .menu-btn {
        padding: 10px 14px !important;
        font-size: 13px !important;
    }

    .main-wrapper {
        padding: 0 20px 28px !important;
    }

    /* 2-Column Stats Grid for iPad */
    .stats-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 16px !important;
    }

    /* Stack Dashboard Columns on iPad for Roomy Tables */
    .dashboard-grid,
    .dashboard-overview-grid {
        grid-template-columns: 1fr !important;
        gap: 20px !important;
    }

    .table-responsive {
        max-height: 400px !important;
        overflow-x: auto !important;
    }

    /* Mobile Quiz Builder Adjustments */
    .gform-body {
        padding: 12px 8px 100px 8px;
    }

    .gform-content-wrapper {
        max-width: 100%;
    }

    .gform-floating-toolbar {
        position: fixed;
        right: 12px;
        bottom: 16px;
        top: auto !important;
        flex-direction: row !important;
        padding: 6px 12px;
        z-index: 300;
        background: #ffffff;
        box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    }

    .gform-header {
        flex-direction: column;
        gap: 10px;
        align-items: flex-start;
        padding: 12px;
    }

    .gform-header-center {
        position: static;
        transform: none;
    }

    .gform-title-input {
        width: 100%;
    }

    .gform-question-header {
        flex-direction: column !important;
    }

    .gform-type-select {
        width: 100%;
    }

    /* Forces table width on mobile so horizontal dragging works */
    .table-responsive table {
        width: 100%;
        min-width: 550px;
        /* Guarantees overflow for touch scrolling */
        border-collapse: collapse;
        white-space: nowrap;

    }
}

/* ======================================================
   DARK MODE STYLES
   ====================================================== */
body.dark-theme,
body.dark-mode {
    --bg-body: #0b1437;
    --card-bg: #111c44;
    --text-dark: #f4f7fe;
    --text-gray: #a3aed1;
    --border-color: #1b254b;
    --sidebar-bg: #080f28;
    --sidebar-hover: #152046;
    --bg-hover: #162252;

    /* Dedicated Input & Box Variables for Dark Mode */
    --input-bg: #1b254b;
    --input-text: #ffffff;
    --input-placeholder: #707eae;
    --quiz-box-bg: #1b254b;

    background: #0b1437 !important;
    color: #f4f7fe !important;
}

body.dark-theme .app-container,
body.dark-mode .app-container,
body.dark-theme .main-wrapper,
body.dark-mode .main-wrapper {
    background: #0b1437 !important;
}

body.dark-theme .box,
body.dark-mode .box {
    background: #111c44 !important;
    border: 1px solid #1b254b !important;
    color: #f4f7fe !important;
}

/* Dark Mode Overrides */
body.dark-theme table,
body.dark-mode table {
    background: var(--card-bg);
}

body.dark-theme td,
body.dark-mode td {
    color: #cbd5e1;
    border-bottom-color: var(--border-color);
}

body.dark-theme input,
body.dark-mode input,
body.dark-theme select,
body.dark-mode select,
body.dark-theme textarea:not(#boardInPlaceEditor),
body.dark-mode textarea:not(#boardInPlaceEditor) {
    background: #1b254b;
    color: #ffffff;
    border-color: #2b3674;
}

body.dark-theme input:focus,
body.dark-mode input:focus,
body.dark-theme select:focus,
body.dark-mode select:focus {
    background: #24305e;
}

body.dark-theme .dropdown-menu,
body.dark-mode .dropdown-menu {
    background: #111c44;
    border-color: #1b254b;
}

body.dark-theme .dropdown-item,
body.dark-mode .dropdown-item {
    color: #f4f7fe;
    border-bottom-color: #1b254b;
}

body.dark-theme .dropdown-item:hover,
body.dark-mode .dropdown-item:hover {
    background: #1b254b;
}

body.dark-theme .topbar,
body.dark-mode .topbar {
    background: var(--bg-body);
}

/* Theme Toggle Button Styling */
.theme-toggle-btn {
    background: transparent;
    color: var(--text-dark);
    border: 1px solid var(--border-color);
    padding: 8px 16px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: 0.2s;
    width: auto;
}

.theme-toggle-btn:hover {
    background: var(--border-color);
}

/* Autocomplete Dropdown Dark Mode Overrides */
body.dark-theme .autocomplete-items {
    background-color: var(--card-bg);
    border-color: var(--border-color);
}

body.dark-theme .autocomplete-items div {
    background-color: var(--card-bg);
    color: var(--text-dark);
    border-bottom-color: var(--border-color);
}

body.dark-theme .autocomplete-items div:hover {
    background-color: #1b254b;
    color: #60a5fa;
}

input::placeholder,
textarea::placeholder {
    color: var(--input-placeholder);
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--primary-blue);
    background: var(--card-bg);
}

/* Fix Contenteditable / Question Prompt Containers */
[contenteditable="true"] {
    color: var(--text-dark) !important;
}

.gform-q-input,
.blk-prompt {
    background: var(--quiz-box-bg) !important;
    color: var(--text-dark) !important;
    border-bottom: 1px solid var(--border-color) !important;
}

/* ======================================================
   FORM INPUTS & DROPDOWN LAYOUT FIX (SCORES & BEHAVIOR)
   ====================================================== */

/* Standardize all text inputs, number inputs, and select dropdowns */
.box input:not([type="radio"]):not([type="checkbox"]),
.box select {
    display: block !important;
    width: 100% !important;
    height: 42px !important;
    padding: 8px 14px !important;
    font-size: 14px !important;
    font-family: inherit !important;
    border-radius: 8px !important;
    /* Restores clean rectangular box with subtle rounded corners */
    border: 1px solid var(--border-color, #e2e8f0) !important;
    background: var(--input-bg, #f8fafc) !important;
    color: var(--input-text, #2b3674) !important;
    box-sizing: border-box !important;
    margin: 0 !important;
    box-shadow: none !important;
}

/* Custom styling for File Upload Inputs */
.box input[type="file"] {
    padding: 4px 8px !important;
    height: 42px !important;
    line-height: 32px !important;
    cursor: pointer !important;
}

.box input[type="file"]::file-selector-button {
    background: var(--primary-blue, #1e5eff) !important;
    color: #ffffff !important;
    border: none !important;
    padding: 6px 14px !important;
    border-radius: 6px !important;
    margin-right: 12px !important;
    cursor: pointer !important;
    font-weight: 600 !important;
    font-size: 13px !important;
    transition: opacity 0.2s ease !important;
}

.box input[type="file"]::file-selector-button:hover {
    opacity: 0.9 !important;
}

/* Structured Form Rows & Groups */
.form-row {
    display: flex !important;
    gap: 16px !important;
    align-items: flex-end !important;
    flex-wrap: wrap !important;
    margin-bottom: 16px !important;
    width: 100% !important;
}

.form-group {
    display: flex !important;
    flex-direction: column !important;
    gap: 6px !important;
    flex: 1 !important;
    min-width: 180px !important;
}

.form-group label {
    font-size: 13px !important;
    font-weight: 600 !important;
    color: var(--text-dark, #2b3674) !important;
    margin: 0 !important;
}

/* Consistent Action Button Height */
.box button {
    height: 42px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 0 20px !important;
    font-size: 14px !important;
    border-radius: 8px !important;
    font-weight: 600 !important;
}

/* ======================================================
   BEHAVIOR POINT INPUT & BUTTON FLEXBOX FIX
   ====================================================== */

/* Ensure the flex wrapper spans full width */
.behavior-action-row {
    display: flex !important;
    gap: 12px !important;
    align-items: center !important;
    width: 100% !important;
}

/* Allocate proportional width to the number input */
#customPointValue {
    flex: 1 1 180px !important;
    min-width: 150px !important;
    height: 44px !important;
    margin: 0 !important;
}

/* Allow the button to adjust cleanly alongside the input */
#saveCustomPointBtn {
    flex: 1.5 1 auto !important;
    height: 44px !important;
    white-space: nowrap !important;
    margin: 0 !important;
}

/* ======================================================
   KEBAB DROPDOWN MENU LAYOUT OVERRIDE
   ====================================================== */

/* --- KEBAB MENU POPUP STYLING (FLAT CLEAN LIST) --- */
.kebab-wrapper {
    position: relative;
    display: inline-block;
}

.kebab-btn {
    background: transparent;
    border: none;
    font-size: 18px;
    font-weight: 800;
    cursor: pointer;
    padding: 4px 10px;
    border-radius: 6px;
    color: var(--text-gray, #64748b);
    line-height: 1;
    transition: all 0.2s ease;
}

.kebab-btn:hover {
    background: var(--bg-hover, #f1f5f9);
    color: var(--text-dark, #0f172a);
}

.dropdown-menu,
.kebab-dropdown,
.dropdown-menu.hidden,
.kebab-dropdown.hidden {
    position: absolute !important;
    right: 0 !important;
    top: 100% !important;
    background: #ffffff !important;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1) !important;
    border-radius: 12px !important;
    z-index: 1000 !important;
    min-width: 190px !important;
    border: 1px solid var(--border-color, #e2e8f0) !important;
    overflow: hidden !important;
    padding: 6px !important;
    display: none !important;
    flex-direction: column !important;
    gap: 2px !important;
}

.dropdown-menu.show,
.kebab-dropdown.show,
.dropdown-menu.active,
.kebab-dropdown.active {
    display: flex !important;
    animation: fadeIn 0.15s ease-out;
}

.box .dropdown-menu button.dropdown-item,
.dropdown-menu .dropdown-item,
.kebab-dropdown .kebab-item {
    display: flex !important;
    align-items: center !important;
    gap: 10px !important;
    width: 100% !important;
    height: 38px !important;
    min-height: 38px !important;
    padding: 8px 14px !important;
    margin: 0 !important;
    background: transparent !important;
    border: none !important;
    border-radius: 8px !important;
    color: var(--text-dark, #0f172a) !important;
    font-size: 13.5px !important;
    font-weight: 600 !important;
    text-align: left !important;
    justify-content: flex-start !important;
    cursor: pointer !important;
    box-shadow: none !important;
    white-space: nowrap !important;
    transition: background 0.15s ease, color 0.15s ease !important;
}

.dropdown-menu .dropdown-item:hover,
.kebab-dropdown .kebab-item:hover {
    background: #f1f5f9 !important;
    color: var(--primary-blue, #1e5eff) !important;
    transform: none !important;
}

.dropdown-menu .dropdown-item.danger,
.kebab-dropdown .kebab-item.danger {
    color: #ef4444 !important;
}

.dropdown-menu .dropdown-item.danger:hover,
.kebab-dropdown .kebab-item.danger:hover {
    background: #fef2f2 !important;
    color: #dc2626 !important;
}

/* Dark mode overrides for kebab popups */
body.dark-theme .dropdown-menu,
body.dark-theme .kebab-dropdown {
    background: #1e293b !important;
    border-color: #334155 !important;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.4) !important;
}

body.dark-theme .dropdown-menu .dropdown-item,
body.dark-theme .kebab-dropdown .kebab-item {
    color: #f8fafc !important;
}

body.dark-theme .dropdown-menu .dropdown-item:hover,
body.dark-theme .kebab-dropdown .kebab-item:hover {
    background: #334155 !important;
    color: #60a5fa !important;
}

body.dark-theme .dropdown-menu .dropdown-item.danger:hover,
body.dark-theme .kebab-dropdown .kebab-item.danger:hover {
    background: #450a0a !important;
    color: #fca5a5 !important;
}

/* ======================================================
   FORM INPUT SPACING & HEADER DROPDOWN WIDTH FIX
   ====================================================== */

/* 1. Restore vertical spacing between stacked form inputs inside boxes */
.box input:not([type="radio"]):not([type="checkbox"]) {
    margin-bottom: 12px !important;
}

/* Ensure buttons immediately below input groups have top separation */
.box button {
    margin-top: 4px !important;
}

/* 2. Prevent header dropdowns from expanding to 100% full width */
.box header select,
#sortPoints,
#sortStudents,
#filterClass,
#filterScoreClass,
#filterPointsClass {
    width: auto !important;
    min-width: 130px !important;
    max-width: 220px !important;
    display: inline-block !important;
    margin: 0 !important;
}

/* Centered Form Stacks (Single Score, View Score, Behavior, Attendance, Reminders) */
.single-score-centered-container,
.view-score-centered-container,
.behavior-form-centered-container,
.attendance-form-centered-container,
.reminder-form-centered-container {
    max-width: 580px !important;
    margin: 0 auto !important;
    width: 100% !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 15px !important;
}

.single-score-centered-container select,
.single-score-centered-container input:not([type="radio"]):not([type="checkbox"]),
.view-score-centered-container select,
.view-score-centered-container input:not([type="radio"]):not([type="checkbox"]),
.behavior-form-centered-container select,
.behavior-form-centered-container input:not([type="radio"]):not([type="checkbox"]),
.attendance-form-centered-container select,
.attendance-form-centered-container input:not([type="radio"]):not([type="checkbox"]),
.reminder-form-centered-container select,
.reminder-form-centered-container input:not([type="radio"]):not([type="checkbox"]),
#directSubjectSelect,
#directClassSelect,
#directQuizSelect,
#ledgerSubjectSelect,
#ledgerClassSelect,
#ledgerQuizSelect,
#ledgerSortSelect,
#attSessionSubject,
#attSessionClass {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 100% !important;
    display: block !important;
    box-sizing: border-box !important;
}

.single-score-centered-container button,
#loadDirectStudentsBtn {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
}

/* 3. Keep inputs inside flex rows (side-by-side forms) aligned without bottom margins */
.form-row input:not([type="radio"]):not([type="checkbox"]),
.form-row select,
.behavior-action-row input {
    margin-bottom: 0 !important;
}

/* ======================================================
   BEHAVIOR POINTS FORM LAYOUT FIX
   ====================================================== */

/* Form wrapper spanning full card width */
.behavior-form-container {
    display: flex;
    flex-direction: column;
    gap: 16px;
    width: 100%;
}

/* Two-column layout for top inputs on desktop */
.behavior-form-row-split {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    width: 100%;
}

/* ======================================================
   MOBILE KEBAB TOPBAR NAVIGATION SYSTEM (<= 768px)
   ====================================================== */

.sidebar {
    overflow: visible !important;
}

.mobile-kebab-container {
    display: none;
    position: relative;
    z-index: 999999;
}

.mobile-kebab-btn,
#mobileTopbarKebabBtn {
    background: #1e5eff !important;
    color: #ffffff !important;
    border: 1px solid rgba(255, 255, 255, 0.35) !important;
    border-radius: 10px !important;
    width: 38px !important;
    height: 38px !important;
    min-width: 38px !important;
    min-height: 38px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 0 !important;
    cursor: pointer !important;
    box-shadow: 0 3px 10px rgba(30, 94, 255, 0.45) !important;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

.mobile-kebab-btn:hover,
#mobileTopbarKebabBtn:hover {
    background: #2563eb !important;
    border-color: rgba(255, 255, 255, 0.7) !important;
    transform: scale(1.05) !important;
}

.mobile-kebab-btn:active,
#mobileTopbarKebabBtn:active {
    transform: scale(0.92) !important;
    background: #1d4ed8 !important;
}

.mobile-kebab-btn svg,
#mobileTopbarKebabBtn svg {
    width: 20px !important;
    height: 20px !important;
    stroke: #ffffff !important;
    fill: none !important;
    stroke-width: 2.2 !important;
    color: #ffffff !important;
    pointer-events: none !important;
    display: block !important;
}

body.dark-theme .mobile-kebab-btn,
body.dark-mode .mobile-kebab-btn,
body.dark-theme #mobileTopbarKebabBtn,
body.dark-mode #mobileTopbarKebabBtn {
    background: #2563eb !important;
    border: 1px solid rgba(147, 197, 253, 0.6) !important;
    color: #ffffff !important;
    box-shadow: 0 0 14px rgba(37, 99, 235, 0.6) !important;
}

.mobile-topbar-dropdown {
    position: fixed !important;
    top: 54px !important;
    right: 12px !important;
    width: 240px !important;
    max-width: calc(100vw - 24px) !important;
    background: var(--card-bg, #ffffff) !important;
    border: 1px solid var(--border-color, #e2e8f0) !important;
    border-radius: 16px !important;
    padding: 12px !important;
    box-shadow: 0 20px 45px -5px rgba(0, 0, 0, 0.45) !important;
    z-index: 999999 !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 4px !important;
    max-height: calc(100dvh - 70px) !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
    animation: kebabDropdownFadeIn 0.2s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

@keyframes kebabDropdownFadeIn {
    from {
        opacity: 0;
        transform: translateY(-8px) scale(0.96);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.mobile-topbar-dropdown.hidden {
    display: none !important;
}

.kebab-group-label {
    font-size: 10px !important;
    font-weight: 800 !important;
    letter-spacing: 1px !important;
    color: var(--text-gray, #64748b) !important;
    padding: 6px 10px 4px !important;
    text-transform: uppercase !important;
}

.kebab-item {
    display: flex !important;
    align-items: center !important;
    gap: 12px !important;
    padding: 10px 12px !important;
    border-radius: 10px !important;
    font-size: 13.5px !important;
    font-weight: 600 !important;
    color: var(--text-dark, #0f172a) !important;
    text-decoration: none !important;
    background: transparent !important;
    border: none !important;
    width: 100% !important;
    text-align: left !important;
    cursor: pointer !important;
    transition: background 0.15s, color 0.15s !important;
    box-sizing: border-box !important;
    box-shadow: none !important;
}

.kebab-item.hidden {
    display: none !important;
}

.kebab-item:hover,
.kebab-item.active {
    background: var(--input-bg, #f1f5f9) !important;
    color: var(--primary-blue, #1e5eff) !important;
}

.kebab-item.active {
    font-weight: 700 !important;
}

.kebab-divider {
    height: 1px !important;
    background: var(--border-color, #e2e8f0) !important;
    margin: 4px 0 !important;
}

.kebab-btn-danger {
    color: #ef4444 !important;
}

.kebab-btn-danger:hover {
    background: rgba(239, 68, 68, 0.1) !important;
}

/* Responsive collapse for mobile devices */
@media screen and (max-width: 768px) {
    .sidebar {
        padding: 0 16px !important;
    }

    .brand {
        margin-left: 4px !important;
    }

    .brand>div:first-child,
    .brand-badge,
    .brand-logo-container {
        width: 30px !important;
        height: 30px !important;
        min-width: 30px !important;
        min-height: 30px !important;
        padding: 3px !important;
        border-radius: 7px !important;
    }

    .desktop-menu-bar,
    .desktop-user-actions,
    .user-profile-bottom,
    .sidebar .user-profile-bottom,
    .student-sidebar .user-profile-bottom {
        display: none !important;
    }

    .mobile-kebab-container {
        display: block !important;
    }

    /* Stack Quick Actions and Active News/Notices panels vertically on mobile */
    .dashboard-overview-grid {
        grid-template-columns: 1fr !important;
        gap: 16px !important;
    }

    .dashboard-panel {
        height: auto !important;
        width: 100% !important;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 12px !important;
    }

    .behavior-form-row-split {
        grid-template-columns: 1fr !important;
    }

    .topbar {
        padding: 16px 0 10px !important;
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 6px !important;
    }

    .topbar-actions.desktop-user-actions {
        display: none !important;
    }

    .main-wrapper {
        padding: 0 14px calc(36px + env(safe-area-inset-bottom, 0px)) !important;
    }

    input, select, textarea, button {
        font-size: 16px;
    }

    .modal-card, .editor-modal {
        max-width: calc(100vw - 24px) !important;
        max-height: calc(100dvh - 32px) !important;
        overflow-y: auto !important;
    }

    .gform-floating-toolbar {
        bottom: calc(14px + env(safe-area-inset-bottom, 0px)) !important;
    }
}

@media screen and (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr !important;
    }
    .main-wrapper {
        padding: 0 10px calc(28px + env(safe-area-inset-bottom, 0px)) !important;
    }
}

/* Universal fix for form inputs in the Quiz Builder workspace */
input[type="text"],
input[type="number"],
input[type="url"],
textarea:not(#boardInPlaceEditor),
select:not(.fmt-select) {
    padding: 10px 14px !important;
    /* Internal spacing pushing text away from borders */
    box-sizing: border-box !important;
    /* Keeps width consistent with padding included */
    font-size: 14px;
    line-height: 1.4;
    border: 1px solid #cbd5e1;
    /* Light border definition */
    border-radius: 8px;
    /* Clean rounded corners */
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

/* Optional focus state for cleaner user feedback when typing */
input[type="text"]:focus,
input[type="number"]:focus,
input[type="url"]:focus,
textarea:focus,
select:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

/* Theme Toggle Button Single-Line Alignment */
.theme-toggle-btn:not(.btn-circle) {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 8px !important;
    white-space: nowrap !important;
    /* Prevents text from breaking into 2 lines */
    padding: 8px 16px !important;
    height: 42px !important;
    min-width: max-content !important;
}

.theme-toggle-btn:not(.btn-circle) .btn-icon {
    width: 18px !important;
    height: 18px !important;
    object-fit: contain !important;
    flex-shrink: 0 !important;
}

/* Ensure circular icon containers contain image bounds properly */
.stat-icon {
    overflow: hidden !important;
    flex-shrink: 0 !important;
}

/* Image scaling inside stat circles */
.stat-icon-img {
    width: 24px !important;
    height: 24px !important;
    max-width: 24px !important;
    max-height: 24px !important;
    object-fit: contain !important;
    display: block;
}

/* --- DASHBOARD COLUMN STACKING FIX --- */
.dashboard-col {
    display: flex;
    flex-direction: column;
    gap: 24px;
    width: 100%;
}

/* --- STUDENT DIRECTORY HEADER ALIGNMENT FIX --- */
#searchStudents {
    margin: 0 !important;
    height: 36px !important;
    padding: 6px 12px !important;
    box-sizing: border-box !important;
    display: inline-block !important;
}

/* Ensure dropdowns match search bar height exactly */
#filterClass,
#sortStudents {
    height: 36px !important;
    margin: 0 !important;
    box-sizing: border-box !important;
}

/* Dark Theme Database Subtabs */
body.dark-theme .db-subtab-nav {
    background: var(--card-bg, #111c44);
    border-color: rgba(255, 255, 255, 0.1);
}

body.dark-theme .db-pill-btn {
    color: var(--text-gray, #a0aec0);
}

body.dark-theme .db-pill-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #ffffff;
}

body.dark-theme .db-pill-btn.active {
    background: var(--primary-blue, #1e5eff);
    color: #ffffff;
}

/* --- MULTI-SELECT CHECKBOX DROPDOWN STYLING --- */
.multi-select-dropdown {
    position: relative;
    width: 100%;
    user-select: none;
}

.multi-select-trigger {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    padding: 10px 14px !important;
    border-radius: 10px !important;
    border: 1px solid var(--border-color, #e2e8f0) !important;
    background: var(--input-bg, #f8fafc) !important;
    color: var(--input-text, #2b3674) !important;
    cursor: pointer !important;
    font-size: 14px !important;
    transition: all 0.2s ease !important;
    box-sizing: border-box !important;
}

.multi-select-trigger:hover {
    border-color: var(--primary-blue, #1e5eff) !important;
}

.multi-select-label {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: 500;
}

.dropdown-arrow-icon {
    transition: transform 0.2s ease;
    flex-shrink: 0;
    margin-left: 8px;
}

.multi-select-dropdown.open .dropdown-arrow-icon {
    transform: rotate(180deg);
}

.multi-select-options {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: var(--card-bg, #ffffff);
    border: 1px solid var(--border-color, #e2e8f0);
    border-radius: 10px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.12);
    max-height: 220px;
    overflow-y: auto;
    z-index: 1000;
    padding: 6px;
    box-sizing: border-box;
}

.multi-select-dropdown.open .multi-select-options {
    display: block;
    animation: fadeIn 0.15s ease-out;
}

.multi-select-option-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13.5px;
    color: var(--text-dark, #2b3674);
    transition: background 0.15s ease;
}

.multi-select-option-row:hover {
    background: #f1f5f9;
}

body.dark-theme .multi-select-options {
    background: #111c44;
    border-color: #2b3674;
}

body.dark-theme .multi-select-option-row {
    color: #f4f7fe;
}

body.dark-theme .multi-select-option-row:hover {
    background: #1b254b;
}

/* ======================================================
   BUTTON STYLING SYSTEM (FLAT & MODERN)
   ====================================================== */
.btn:not(.dropdown-item):not(.kebab-item):not(.btn-circle):not(.db-page-btn),
.action-btn:not(.dropdown-item):not(.kebab-item):not(.like-btn):not(.comment-btn):not(.btn-circle):not(.db-page-btn),
.add-btn,
.save-btn,
.delete-btn:not(.dropdown-item):not(.kebab-item):not(.btn-circle),
.modal-btn {
    background: #ffffff !important;
    color: #0f172a !important;
    border: 1.5px solid #e2e8f0 !important;
    border-radius: 8px !important;
    padding: 10px 20px !important;
    font-size: 14px !important;
    font-weight: 700 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 8px !important;
    box-shadow: none !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
}

.btn:not(.dropdown-item):not(.kebab-item):not(.btn-circle):not(.db-page-btn):hover,
.action-btn:not(.dropdown-item):not(.kebab-item):not(.like-btn):not(.comment-btn):not(.btn-circle):not(.db-page-btn):hover,
.add-btn:hover,
.save-btn:hover,
.delete-btn:not(.dropdown-item):not(.kebab-item):not(.btn-circle):hover,
.modal-btn:hover {
    background: #f8fafc !important;
    border-color: #cbd5e1 !important;
    transform: translateY(-1px) !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08) !important;
}

.btn:not(.dropdown-item):not(.kebab-item):active {
    transform: translateY(0) !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04) !important;
}

/* Dark Theme Overrides for Admin Buttons */
body.dark-theme .btn:not(.dropdown-item):not(.kebab-item):not(.db-page-btn),
body.dark-theme .action-btn:not(.dropdown-item):not(.kebab-item):not(.like-btn):not(.comment-btn):not(.db-page-btn),
body.dark-theme .add-btn,
body.dark-theme .save-btn,
body.dark-theme .delete-btn:not(.dropdown-item):not(.kebab-item),
body.dark-theme .modal-btn {
    background: #1e293b !important;
    color: #f8fafc !important;
    border-color: #334155 !important;
    box-shadow: none !important;
}

body.dark-theme .btn:not(.dropdown-item):not(.kebab-item):not(.db-page-btn):hover,
body.dark-theme .action-btn:not(.dropdown-item):not(.kebab-item):not(.like-btn):not(.comment-btn):not(.db-page-btn):hover,
body.dark-theme .add-btn:hover,
body.dark-theme .save-btn:hover,
body.dark-theme .delete-btn:not(.dropdown-item):not(.kebab-item):hover,
body.dark-theme .modal-btn:hover {
    background: #334155 !important;
    border-color: #475569 !important;
}

/* Mobile Topbar Menu Button System */
button.mobile-kebab-btn,
.mobile-kebab-btn,
#mobileTopbarKebabBtn {
    background: #1e5eff !important;
    color: #ffffff !important;
    border: 1px solid rgba(255, 255, 255, 0.35) !important;
    border-radius: 10px !important;
    width: 38px !important;
    height: 38px !important;
    min-width: 38px !important;
    min-height: 38px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 0 !important;
    cursor: pointer !important;
    box-shadow: 0 3px 10px rgba(30, 94, 255, 0.45) !important;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

button.mobile-kebab-btn:hover,
.mobile-kebab-btn:hover,
#mobileTopbarKebabBtn:hover {
    background: #2563eb !important;
    border-color: rgba(255, 255, 255, 0.7) !important;
    transform: scale(1.05) !important;
}

button.mobile-kebab-btn:active,
.mobile-kebab-btn:active,
#mobileTopbarKebabBtn:active {
    transform: scale(0.92) !important;
    background: #1d4ed8 !important;
}

button.mobile-kebab-btn svg,
.mobile-kebab-btn svg,
#mobileTopbarKebabBtn svg {
    width: 20px !important;
    height: 20px !important;
    stroke: #ffffff !important;
    fill: none !important;
    stroke-width: 2.2 !important;
    color: #ffffff !important;
    pointer-events: none !important;
    display: block !important;
}

body.dark-theme button.mobile-kebab-btn,
body.dark-mode button.mobile-kebab-btn,
body.dark-theme #mobileTopbarKebabBtn,
body.dark-mode #mobileTopbarKebabBtn {
    background: #2563eb !important;
    border: 1px solid rgba(147, 197, 253, 0.6) !important;
    color: #ffffff !important;
    box-shadow: 0 0 14px rgba(37, 99, 235, 0.6) !important;
}

body.dark-theme button.mobile-kebab-btn svg,
body.dark-mode button.mobile-kebab-btn svg,
body.dark-theme #mobileTopbarKebabBtn svg,
body.dark-mode #mobileTopbarKebabBtn svg {
    stroke: #ffffff !important;
    fill: none !important;
    color: #ffffff !important;
}

/* Danger / Delete Button Pill Variant */
button.danger,
.btn.danger,
.delete-btn {
    background: #fef2f2 !important;
    color: #ef4444 !important;
    border-color: #fca5a5 !important;
}

body.dark-theme button.danger,
body.dark-theme .btn.danger,
body.dark-theme .delete-btn {
    background: #450a0a !important;
    color: #fca5a5 !important;
    border-color: #7f1d1d !important;
}

/* ======================================================
   ROUNDED MODE TOGGLE CONTAINER (MANAGE SCORE TAB)
   ====================================================== */
.register-mode-toggle {
    display: inline-flex !important;
    background: var(--input-bg, #f1f5f9) !important;
    border: 1px solid var(--border-color, #e2e8f0) !important;
    border-radius: 30px !important;
    padding: 4px !important;
    gap: 4px !important;
}

.toggle-mode-btn {
    background: transparent !important;
    color: var(--text-gray, #64748b) !important;
    border: none !important;
    border-radius: 24px !important;
    padding: 8px 18px !important;
    font-size: 13.5px !important;
    font-weight: 700 !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
    box-shadow: none !important;
}

.toggle-mode-btn:hover {
    color: var(--text-dark, #0f172a) !important;
    background: rgba(255, 255, 255, 0.5) !important;
    transform: none !important;
}

.toggle-mode-btn.active {
    background: #ffffff !important;
    color: var(--primary-blue, #1e5eff) !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08) !important;
}

body.dark-theme .register-mode-toggle {
    background: #0b1437 !important;
    border-color: #1b254b !important;
}

body.dark-theme .toggle-mode-btn {
    color: #94a3b8 !important;
}

body.dark-theme .toggle-mode-btn.active {
    background: #1e293b !important;
    color: #60a5fa !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3) !important;
}

/* ======================================================
   MODERN CUSTOM DROPDOWN STYLING SYSTEM
   ====================================================== */
select:not(.fmt-select) {
    appearance: none !important;
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    background-color: var(--card-bg, #ffffff) !important;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%231e5eff' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: right 14px center !important;
    background-size: 16px 16px !important;
    padding-right: 40px !important;
    border-radius: 12px !important;
    font-weight: 600 !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
}

select:not(.fmt-select):hover {
    border-color: var(--primary-blue, #1e5eff) !important;
}

body.dark-theme select:not(.fmt-select),
body.dark-mode select:not(.fmt-select),
.dark-theme select:not(.fmt-select),
.dark-mode select:not(.fmt-select) {
    background-color: #0b1437 !important;
    color: #ffffff !important;
    border-color: #1b254b !important;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2360a5fa' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: right 14px center !important;
    background-size: 16px 16px !important;
}

body.dark-theme select option,
body.dark-mode select option,
.dark-theme select option,
.dark-mode select option {
    background-color: #0b1437 !important;
    color: #ffffff !important;
}

/* Action Kebab Button & Popup Menu */
.card-kebab-btn {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    color: var(--text-dark, #334155) !important;
    cursor: pointer !important;
    padding: 0 !important;
    border-radius: 8px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 24px !important;
    font-weight: 900 !important;
    line-height: 1 !important;
    width: 32px !important;
    height: 32px !important;
    min-width: 32px !important;
    min-height: 32px !important;
    transition: all 0.15s ease !important;
}

.card-kebab-btn:hover {
    background: rgba(30, 94, 255, 0.12) !important;
    color: var(--primary-blue, #1e5eff) !important;
    border: none !important;
    transform: scale(1.1);
}

body.dark-theme .card-kebab-btn,
body.dark-mode .card-kebab-btn {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    color: #e2e8f0 !important;
}

body.dark-theme .card-kebab-btn:hover,
body.dark-mode .card-kebab-btn:hover {
    background: rgba(255, 255, 255, 0.15) !important;
    color: #60a5fa !important;
    border: none !important;
}

.profile-card-dropdown.hidden {
    display: none !important;
}

.profile-card-dropdown {
    position: absolute !important;
    background: var(--card-bg, #ffffff) !important;
    border: 1px solid var(--border-color, #e2e8f0) !important;
    border-radius: 12px !important;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.15), 0 8px 10px -6px rgba(0, 0, 0, 0.1) !important;
    padding: 6px !important;
    z-index: 9999 !important;
    min-width: 120px !important;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.profile-dropdown-item {
    background: transparent !important;
    border: none !important;
    color: var(--text-dark, #0f172a) !important;
    padding: 8px 12px !important;
    border-radius: 8px !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    width: 100% !important;
    text-align: left !important;
    transition: background 0.15s ease !important;
}

.profile-dropdown-item:hover {
    background: rgba(30, 94, 255, 0.08) !important;
    color: var(--primary-blue, #1e5eff) !important;
}

body.dark-theme .profile-card-dropdown {
    background: #1e293b !important;
    border-color: rgba(255, 255, 255, 0.12) !important;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4) !important;
}

body.dark-theme .profile-dropdown-item {
    color: #e2e8f0 !important;
}

body.dark-theme .profile-dropdown-item:hover {
    background: rgba(255, 255, 255, 0.08) !important;
    color: #60a5fa !important;
}

/* ======================================================
   RESPONSIVE QUIZ RESULTS & SCORE SUBMISSION MODAL
   ====================================================== */

.quiz-results-card {
    width: 95vw !important;
    max-width: 1060px !important;
    height: 90vh !important;
    max-height: 90vh !important;
    min-height: 0 !important;
    display: flex !important;
    flex-direction: column !important;
    position: relative !important;
    border-radius: 16px !important;
    overflow: hidden !important;
    padding: 0 !important;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25) !important;
    background: var(--bg-card, #ffffff) !important;
    border: 1px solid var(--border-color, #e2e8f0) !important;
}

.student-answers-card {
    background: var(--bg-card, #ffffff) !important;
    border: 1px solid var(--border-color, #e2e8f0) !important;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.quiz-results-header {
    padding: 14px 22px !important;
    border-bottom: 1px solid var(--border-color, #e2e8f0);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-card, #ffffff);
    flex-shrink: 0 !important;
}

.quiz-results-toolbar {
    padding: 10px 22px !important;
    background: var(--bg-card-subtle, #f8fafc);
    border-bottom: 1px solid var(--border-color, #e2e8f0);
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex-shrink: 0 !important;
}

.quiz-results-filter-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
}

.quiz-class-pills-wrap {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
    align-items: center;
}

/* Compact Target Class Pills */
.quiz-class-pill {
    width: auto !important;
    height: 26px !important;
    min-height: 26px !important;
    padding: 0 9px !important;
    font-size: 11.5px !important;
    font-weight: 600 !important;
    border-radius: 13px !important;
    border: 1px solid var(--border-color, #cbd5e1);
    background: var(--bg-card, #ffffff);
    color: var(--text-dark, #334155);
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    margin: 0 !important;
    line-height: 1 !important;
}

.quiz-class-pill:hover {
    border-color: var(--primary-blue, #2563eb);
    color: var(--primary-blue, #2563eb);
    background: rgba(37, 99, 235, 0.05);
}

.quiz-class-pill.active {
    background: var(--primary-blue, #2563eb) !important;
    color: #ffffff !important;
    border-color: var(--primary-blue, #2563eb) !important;
    box-shadow: 0 2px 5px rgba(37, 99, 235, 0.25);
}

/* Compact Status Filter Buttons */
.quiz-status-filter-btn {
    width: auto !important;
    height: 30px !important;
    min-height: 30px !important;
    padding: 0 10px !important;
    font-size: 11.5px !important;
    border-radius: 7px !important;
    font-weight: 600 !important;
    border: 1px solid var(--border-color, #cbd5e1);
    background: var(--bg-card, #ffffff);
    color: var(--text-dark, #334155);
    cursor: pointer;
    transition: all 0.15s ease;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 5px !important;
    margin: 0 !important;
    line-height: 1 !important;
}

.quiz-status-filter-btn svg {
    flex-shrink: 0;
}

.quiz-status-filter-btn:hover {
    border-color: var(--primary-blue, #2563eb);
    color: var(--primary-blue, #2563eb);
}

.quiz-status-filter-btn.active {
    background: var(--primary-blue, #2563eb) !important;
    color: #ffffff !important;
    border-color: var(--primary-blue, #2563eb) !important;
}

.quiz-status-filter-btn.active svg {
    stroke: #ffffff !important;
}

#quizResultsStatsBar {
    font-size: 11.5px;
    font-weight: 600;
    color: #64748b;
    background: var(--bg-card, #ffffff);
    padding: 4px 10px;
    border-radius: 8px;
    border: 1px solid var(--border-color, #e2e8f0);
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

/* Student List Body - Maximized Height with Smooth Flexbox Scroll */
.quiz-results-body {
    flex: 1 1 0% !important;
    min-height: 0 !important;
    height: 100% !important;
    max-height: none !important;
    overflow-y: auto !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    padding: 0 20px 20px 20px !important;
    background: var(--bg-card, #ffffff) !important;
}

#quizResultsTable {
    width: 100% !important;
    border-collapse: separate !important;
    border-spacing: 0 !important;
}

#quizResultsTable thead th {
    position: sticky !important;
    top: 0 !important;
    z-index: 10 !important;
    background: var(--bg-card-subtle, #f8fafc) !important;
    border-bottom: 1px solid var(--border-color, #e2e8f0) !important;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04) !important;
}

.quiz-badge-status-done {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    background: #dcfce7;
    color: #15803d;
    border: 1px solid #bbf7d0;
}

.quiz-badge-status-pending {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    background: #f1f5f9;
    color: #64748b;
    border: 1px solid #e2e8f0;
}

.quiz-class-tag {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 700;
    background: #eff6ff;
    color: #2563eb;
    border: 1px solid #dbeafe;
}

/* Close Modal Button - Standard Text X Button */
.btn-close-modal {
    width: 32px !important;
    height: 32px !important;
    min-width: 32px !important;
    border-radius: 50% !important;
    border: 1px solid #cbd5e1 !important;
    background: #f1f5f9 !important;
    color: #1e293b !important;
    font-size: 16px !important;
    font-weight: 700 !important;
    font-family: system-ui, -apple-system, sans-serif !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer !important;
    padding: 0 !important;
    line-height: 1 !important;
    transition: all 0.2s ease !important;
    flex-shrink: 0 !important;
    user-select: none !important;
}

.btn-close-modal:hover {
    background: #e2e8f0 !important;
    color: #000000 !important;
    border-color: #94a3b8 !important;
}

.btn-quiz-check,
.btn-quiz-save {
    width: auto !important;
    height: 28px !important;
    min-height: 28px !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 4px !important;
    padding: 0 10px !important;
    font-size: 11.5px !important;
    font-weight: 600 !important;
    border: none !important;
    border-radius: 6px !important;
    cursor: pointer !important;
    transition: all 0.15s ease !important;
}

/* Dark Theme Overrides */
body.dark-theme .quiz-results-card,
body.dark-theme .student-answers-card {
    background: #0f172a !important;
    border-color: #334155 !important;
}

body.dark-theme .quiz-results-header,
body.dark-theme .quiz-results-body,
body.dark-theme #studentAnswersModal .box > div {
    background: #0f172a !important;
    border-color: #334155 !important;
}

body.dark-theme .quiz-results-toolbar,
body.dark-theme #answersModalFooter {
    background: #1e293b !important;
    border-color: #334155 !important;
}

body.dark-theme #quizResultsStatsBar {
    background: #0f172a !important;
    border-color: #334155 !important;
    color: #94a3b8 !important;
}

body.dark-theme #quizResultsTitle,
body.dark-theme #studentAnswersTitle,
body.dark-theme #quizResultsTable td strong,
body.dark-theme #quizResultsTable td div {
    color: #f1f5f9 !important;
}

body.dark-theme .quiz-class-pill {
    background: #1e293b !important;
    color: #cbd5e1 !important;
    border-color: #475569 !important;
}

body.dark-theme .quiz-class-pill:hover {
    border-color: #60a5fa !important;
    color: #93c5fd !important;
    background: rgba(96, 165, 250, 0.1) !important;
}

body.dark-theme .quiz-class-pill.active {
    background: #3b82f6 !important;
    color: #ffffff !important;
    border-color: #3b82f6 !important;
}

body.dark-theme .quiz-status-filter-btn {
    background: #1e293b !important;
    color: #cbd5e1 !important;
    border-color: #475569 !important;
}

body.dark-theme .quiz-status-filter-btn:hover {
    border-color: #60a5fa !important;
    color: #93c5fd !important;
}

body.dark-theme .quiz-status-filter-btn.active {
    background: #3b82f6 !important;
    color: #ffffff !important;
    border-color: #3b82f6 !important;
}

body.dark-theme .quiz-status-filter-btn.active svg {
    stroke: #ffffff !important;
}

body.dark-theme .quiz-badge-status-done {
    background: rgba(16, 185, 129, 0.15) !important;
    color: #34d399 !important;
    border-color: rgba(16, 185, 129, 0.3) !important;
}

body.dark-theme .quiz-badge-status-pending {
    background: #1e293b !important;
    color: #94a3b8 !important;
    border-color: #334155 !important;
}

body.dark-theme .quiz-class-tag {
    background: rgba(59, 130, 246, 0.15) !important;
    color: #93c5fd !important;
    border-color: rgba(59, 130, 246, 0.3) !important;
}

body.dark-theme #quizResultsTable thead,
body.dark-theme #quizResultsTable thead th {
    background: #1e293b !important;
    border-color: #334155 !important;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3) !important;
}

body.dark-theme #quizResultsTable th {
    color: #94a3b8 !important;
}

body.dark-theme #quizResultsTable tr {
    border-color: #334155 !important;
}

body.dark-theme #quizStudentSearchInput,
body.dark-theme #quizResultsTable .direct-score-input,
body.dark-theme #modalDirectScoreInput {
    background: #1e293b !important;
    color: #f1f5f9 !important;
    border-color: #475569 !important;
}

body.dark-theme .search-line-icon {
    color: #64748b !important;
}

body.dark-theme #autoScoreReference {
    background: #1e293b !important;
    border-color: #3b82f6 !important;
}

body.dark-theme .btn-close-modal,
body.dark-mode .btn-close-modal {
    background: #1e293b !important;
    border-color: #475569 !important;
    color: #f8fafc !important;
}

body.dark-theme .btn-close-modal:hover,
body.dark-mode .btn-close-modal:hover {
    background: #334155 !important;
    border-color: #64748b !important;
    color: #ffffff !important;
}

/* Mobile & Tablet Responsiveness for Results Modal */
@media screen and (max-width: 768px) {
    #quizResultsModal,
    #studentAnswersModal {
        padding: 6px !important;
    }

    .quiz-results-card,
    .student-answers-card {
        width: 100vw !important;
        height: 96vh !important;
        max-height: 96vh !important;
        border-radius: 12px !important;
    }

    .quiz-results-header,
    .quiz-results-toolbar,
    .quiz-results-body {
        padding: 10px 12px !important;
    }

    #quizResultsStatsBar {
        width: 100% !important;
        justify-content: space-around !important;
    }

    #quizResultsTable th,
    #quizResultsTable td {
        padding: 8px 8px !important;
    }

    .btn-quiz-check,
    .btn-quiz-save {
        padding: 0 7px !important;
        font-size: 11px !important;
        height: 26px !important;
    }
}

/* ======================================================
   STUDENTS ATTENDANCE & PRESENT LIST SYSTEM STYLES
   ====================================================== */
.att-status-pill.pill-active {
    background: rgba(16, 185, 129, 0.12) !important;
    color: #10b981 !important;
    border-color: rgba(16, 185, 129, 0.3) !important;
}
.att-status-pill.pill-active .status-dot {
    background: #10b981 !important;
    box-shadow: 0 0 8px #10b981 !important;
    animation: pulse-dot 1.8s infinite;
}
@keyframes pulse-dot {
    0% { transform: scale(0.95); opacity: 0.8; }
    50% { transform: scale(1.2); opacity: 1; }
    100% { transform: scale(0.95); opacity: 0.8; }
}

.att-filter-pills {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    align-items: center;
}
.att-pill {
    width: auto !important;
    height: 32px !important;
    margin: 0 !important;
    background: var(--input-bg, #f8fafc);
    border: 1px solid var(--border-color, #cbd5e1);
    color: var(--text-dark, #2b3674);
    padding: 0 12px !important;
    border-radius: 8px !important;
    font-size: 12px !important;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex !important;
    align-items: center !important;
    gap: 6px;
    transition: all 0.15s ease;
    white-space: nowrap;
    text-transform: none;
}
.att-pill:hover {
    border-color: var(--primary-blue, #1e5eff);
    color: var(--primary-blue, #1e5eff);
    transform: translateY(-1px);
}
.att-pill-count {
    display: inline-block;
    background: rgba(0, 0, 0, 0.06);
    color: inherit;
    font-size: 11px;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 10px;
    line-height: 1.2;
}
.att-pill.active {
    background: #1e5eff !important;
    color: #ffffff !important;
    border-color: #1e5eff !important;
    box-shadow: 0 2px 6px rgba(30, 94, 255, 0.25);
}
.att-pill.active .att-pill-count {
    background: rgba(255, 255, 255, 0.25);
    color: #ffffff;
}
.att-pill.pill-present.active {
    background: #10b981 !important;
    border-color: #10b981 !important;
    box-shadow: 0 2px 6px rgba(16, 185, 129, 0.25);
}
.att-pill.pill-absent.active {
    background: #ef4444 !important;
    border-color: #ef4444 !important;
    box-shadow: 0 2px 6px rgba(239, 68, 68, 0.25);
}
.att-pill.pill-others.active {
    background: #f59e0b !important;
    border-color: #f59e0b !important;
    box-shadow: 0 2px 6px rgba(245, 158, 11, 0.25);
}
.att-pill.pill-pending.active {
    background: #64748b !important;
    border-color: #64748b !important;
    box-shadow: 0 2px 6px rgba(100, 116, 139, 0.25);
}

/* Attendance Status Badges inside table */
.att-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
}
.att-badge-present {
    background: #ecfdf5;
    color: #059669;
    border: 1px solid #a7f3d0;
}
.att-badge-absent {
    background: #fef2f2;
    color: #dc2626;
    border: 1px solid #fecaca;
}
.att-badge-others {
    background: #fffbeb;
    color: #d97706;
    border: 1px solid #fde68a;
}
.att-badge-pending {
    background: #f8fafc;
    color: #64748b;
    border: 1px solid #e2e8f0;
}

/* Dark Mode Adjustments */
body.dark-theme .att-badge-present {
    background: rgba(16, 185, 129, 0.15);
    color: #34d399;
    border-color: rgba(16, 185, 129, 0.3);
}
body.dark-theme .att-badge-absent {
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
    border-color: rgba(239, 68, 68, 0.3);
}
body.dark-theme .att-badge-others {
    background: rgba(245, 158, 11, 0.15);
    color: #fbbf24;
    border-color: rgba(245, 158, 11, 0.3);
}
body.dark-theme .att-badge-pending {
    background: rgba(100, 116, 139, 0.15);
    color: #94a3b8;
    border-color: rgba(100, 116, 139, 0.3);
}
body.dark-theme .att-pill {
    background: #1e293b;
    border-color: #334155;
    color: #cbd5e1;
}
body.dark-theme .att-pill-count {
    background: rgba(255, 255, 255, 0.08);
}
body.dark-theme .att-action-btn {
    background: #1e293b;
    border-color: #334155;
    color: #cbd5e1;
}

/* Attendance Table Layout & Columns */
#attendanceTable {
    width: 100% !important;
    min-width: 820px !important;
    border-collapse: separate !important;
    border-spacing: 0 !important;
    white-space: nowrap !important;
}

#attendanceTable th,
#attendanceTable td {
    padding: 10px 12px !important;
    vertical-align: middle !important;
    border-bottom: 1px solid var(--border-color, #e2e8f0);
}

/* Action Column in Attendance Table - Non-sticky, compact, no background box */
#attendanceTable th:last-child {
    position: static !important;
    background-color: #0f172a !important;
    color: #f8fafc !important;
    box-shadow: none !important;
    text-align: center !important;
    width: 60px !important;
    min-width: 50px !important;
    padding: 10px 8px !important;
}

#attendanceTable td:last-child {
    position: relative !important;
    background: transparent !important;
    box-shadow: none !important;
    text-align: center !important;
    width: 60px !important;
    min-width: 50px !important;
    padding: 8px !important;
}

body.dark-theme #attendanceTable td:last-child,
body.dark-mode #attendanceTable td:last-child {
    background: transparent !important;
    box-shadow: none !important;
}

/* Action Button in Attendance row */
.att-action-btn {
    width: auto !important;
    height: 28px !important;
    margin: 0 !important;
    background: var(--card-bg, #ffffff);
    border: 1px solid var(--border-color, #cbd5e1);
    color: var(--text-dark, #2b3674);
    padding: 0 8px !important;
    border-radius: 6px !important;
    font-size: 11px !important;
    font-weight: 600 !important;
    cursor: pointer;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 3px !important;
    transition: all 0.15s ease;
    white-space: nowrap !important;
    flex-shrink: 0 !important;
}
.att-action-btn:hover {
    transform: translateY(-1px);
}
.att-action-btn.att-action-present:hover {
    background: #ecfdf5;
    color: #059669;
    border-color: #10b981;
}
.att-action-btn.att-action-absent:hover {
    background: #fef2f2;
    color: #dc2626;
    border-color: #ef4444;
}
.att-action-btn.att-action-edit:hover {
    background: #eff6ff;
    color: #1e5eff;
    border-color: #1e5eff;
}

/* Print Styles for Attendance */
@media print {
    .sidebar,
    .topbar,
    .mobile-kebab-container,
    .attendance-header-wrapper button,
    .attendance-session-card,
    .att-filter-pills,
    #attSearchInput,
    th:last-child,
    td:last-child {
        display: none !important;
    }
    body, .app-container, .main-wrapper, .tab-content {
        overflow: visible !important;
        height: auto !important;
        background: #ffffff !important;
        color: #000000 !important;
        padding: 0 !important;
        margin: 0 !important;
    }
    #tab-manage-attendance {
        display: block !important;
    }
    #attendanceTable {
        border: 1px solid #000000 !important;
    }
    #attendanceTable th, #attendanceTable td {
        border: 1px solid #cccccc !important;
        padding: 6px 8px !important;
        color: #000000 !important;
    }
}

/* Fix Students Database header controls layout */
.db-header-controls {
    display: flex !important;
    gap: 8px !important;
    align-items: center !important;
    flex-wrap: wrap !important;
}

#searchDbStudents {
    width: 180px !important;
    min-width: 150px !important;
    max-width: 220px !important;
    height: 38px !important;
    padding: 6px 12px !important;
    font-size: 13px !important;
    display: inline-block !important;
    flex: 0 1 180px !important;
    margin: 0 !important;
}

#filterDbStudentClass {
    width: auto !important;
    min-width: 125px !important;
    height: 38px !important;
    padding: 6px 10px !important;
    font-size: 13px !important;
    display: inline-block !important;
    flex: 0 0 auto !important;
    margin: 0 !important;
}

#dbStudentsPerPage {
    width: auto !important;
    min-width: 95px !important;
    height: 38px !important;
    padding: 6px 10px !important;
    font-size: 13px !important;
    display: inline-block !important;
    flex: 0 0 auto !important;
    margin: 0 !important;
}

/* ======================================================
   EQUAL SIZED CREATE NOTICE & NOTICES LIST BOXES
   ====================================================== */
#tab-manage-news .dashboard-grid,
.news-dashboard-grid {
    grid-template-columns: 1fr 1fr !important;
    gap: 24px !important;
}

@media (max-width: 960px) {
    #tab-manage-news .dashboard-grid,
    .news-dashboard-grid {
        grid-template-columns: 1fr !important;
    }
}

/* ======================================================
   ATTENDANCE & QUIZ SEARCH BAR ICON & PADDING FIX
   ====================================================== */
.att-search-box {
    position: relative !important;
    display: flex !important;
    align-items: center !important;
}

.att-search-box input,
#attSearchInput,
#quizStudentSearchInput {
    padding-left: 36px !important;
    padding-right: 14px !important;
    height: 38px !important;
    font-size: 13.5px !important;
    border-radius: 9px !important;
    box-sizing: border-box !important;
    margin: 0 !important;
    line-height: normal !important;
}

.att-search-box svg {
    position: absolute !important;
    left: 12px !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    width: 15px !important;
    height: 15px !important;
    color: var(--text-gray, #94a3b8) !important;
    pointer-events: none !important;
    z-index: 2 !important;
}

/* ======================================================
   TOPBAR USER BADGE STYLING
   ====================================================== */
.topbar-user-badge {
    transition: all 0.2s ease;
}

body.dark-theme .topbar-user-badge,
body.dark-mode .topbar-user-badge {
    background: #1e293b !important;
    border-color: #334155 !important;
}

body.dark-theme #topbarUserName,
body.dark-mode #topbarUserName {
    color: #f8fafc !important;
}

body.dark-theme #topbarUserRole,
body.dark-mode #topbarUserRole {
    color: #94a3b8 !important;
}

/* ======================================================
   TOP NAVIGATION USER PROFILE & COMPACT ACTION BUTTONS (DESKTOP)
   ====================================================== */
@media screen and (min-width: 769px) {
    .sidebar .user-profile-bottom,
    .student-sidebar .user-profile-bottom {
        display: flex !important;
        flex-direction: row !important;
        align-items: center !important;
        gap: 8px !important;
        padding: 0 !important;
        margin: 0 !important;
        border: none !important;
    }

    .sidebar #themeToggleBtn,
    .student-sidebar #themeToggleBtn,
    .sidebar .teacher-btn,
    .student-sidebar .teacher-btn,
    .sidebar #studentLogoutBtn,
    .student-sidebar #studentLogoutBtn,
    .sidebar #logoutBtn,
    .student-sidebar #logoutBtn,
    .desktop-user-actions .btn-circle {
        width: 34px !important;
        height: 34px !important;
        min-width: 34px !important;
        min-height: 34px !important;
        max-width: 34px !important;
        max-height: 34px !important;
        padding: 0 !important;
        border-radius: 50% !important;
        background: rgba(255, 255, 255, 0.1) !important;
        border: 1px solid rgba(255, 255, 255, 0.25) !important;
        color: #ffffff !important;
        cursor: pointer !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        flex: none !important;
        flex-shrink: 0 !important;
        box-sizing: border-box !important;
        transition: all 0.2s ease !important;
    }

    .sidebar #themeToggleBtn:hover,
    .student-sidebar #themeToggleBtn:hover,
    .sidebar .teacher-btn:hover,
    .student-sidebar .teacher-btn:hover,
    .desktop-user-actions .btn-circle:hover {
        background: rgba(255, 255, 255, 0.22) !important;
        border-color: rgba(255, 255, 255, 0.45) !important;
        transform: translateY(-1px) scale(1.06) !important;
    }

    .sidebar #logoutBtn,
    .student-sidebar #logoutBtn,
    .sidebar #studentLogoutBtn,
    .student-sidebar #studentLogoutBtn {
        background: rgba(239, 68, 68, 0.18) !important;
        border: 1px solid rgba(239, 68, 68, 0.4) !important;
        color: #ff6b6b !important;
    }

    .sidebar #logoutBtn:hover,
    .student-sidebar #logoutBtn:hover,
    .sidebar #studentLogoutBtn:hover,
    .student-sidebar #studentLogoutBtn:hover {
        background: rgba(239, 68, 68, 0.32) !important;
        border-color: rgba(239, 68, 68, 0.65) !important;
        color: #ffffff !important;
        transform: translateY(-1px) scale(1.06) !important;
    }

    .desktop-user-actions svg {
        width: 16px !important;
        height: 16px !important;
        stroke: currentColor !important;
        stroke-width: 2 !important;
        fill: none !important;
        margin: 0 !important;
        display: inline-block !important;
    }
}

/* Mobile Kebab User Info Styling */
.mobile-kebab-user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 8px 10px 8px;
    margin-bottom: 4px;
    border-bottom: 1px solid var(--border-color, #e2e8f0);
}

body.dark-theme .mobile-kebab-user-info h4,
body.dark-mode .mobile-kebab-user-info h4 {
    color: #f1f5f9 !important;
}

body.dark-theme .mobile-kebab-user-info p,
body.dark-mode .mobile-kebab-user-info p {
    color: #94a3b8 !important;
}

body.dark-theme .mobile-kebab-user-info,
body.dark-mode .mobile-kebab-user-info {
    border-bottom-color: rgba(255, 255, 255, 0.1) !important;
}

/* ======================================================
   ADMIN & TEACHER GREETING HERO BANNER (MATCHES STUDENT PORTAL)
   ====================================================== */
.student-greeting-banner,
.admin-greeting-banner {
    background-color: #ffffff;
    border: 1px solid var(--border-color, #e2e8f0);
    border-radius: 20px;
    padding: 32px 36px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    overflow: hidden;
    min-height: 160px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.02);
    margin-top: 24px;
    margin-bottom: 24px;
    width: 100% !important;
    max-width: 100% !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    box-sizing: border-box !important;
}

body.dark-theme .student-greeting-banner,
body.dark-mode .student-greeting-banner,
body.dark-theme .admin-greeting-banner,
body.dark-mode .admin-greeting-banner {
    background-color: #0f172a;
    border-color: #1e293b;
}

.greeting-text-container {
    z-index: 2;
    max-width: 58%;
    position: relative;
}

.greeting-title {
    margin: 0 0 6px 0;
    font-size: 26px;
    font-weight: 800;
    color: var(--text-dark, #0f172a);
    letter-spacing: -0.5px;
}

body.dark-theme .greeting-title,
body.dark-mode .greeting-title {
    color: #ffffff !important;
}

.greeting-subtitle {
    margin: 0;
    font-size: 15px;
    color: var(--text-gray, #64748b);
    font-weight: 500;
    line-height: 1.5;
}

body.dark-theme .greeting-subtitle,
body.dark-mode .greeting-subtitle {
    color: #94a3b8 !important;
}

.school-building-img-wrapper {
    position: absolute;
    right: 0;
    bottom: 0;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

.school-building-img,
.school-building-video {
    position: absolute;
    right: 0;
    top: 0;
    width: 60%;
    height: 100%;
    object-fit: cover;
    object-position: center right;
    -webkit-mask-image: linear-gradient(to left, rgba(0, 0, 0, 1) 40%, rgba(0, 0, 0, 0) 100%);
    mask-image: linear-gradient(to left, rgba(0, 0, 0, 1) 40%, rgba(0, 0, 0, 0) 100%);
}

@media (max-width: 768px) {
    .student-greeting-banner,
    .admin-greeting-banner {
        padding: 20px 18px !important;
        min-height: 120px !important;
        margin-top: 16px !important;
        margin-bottom: 16px !important;
    }

    .greeting-title {
        font-size: 20px !important;
    }

    .school-building-img,
    .school-building-video {
        width: 45% !important;
        opacity: 0.2 !important;
    }
}

/* ==========================================================================
   GOOGLE CLASSROOM SYNC ENHANCEMENTS & DARK THEME
   ========================================================================== */
.gclass-connect-banner {
    transition: all 0.2s ease;
}
body.dark-theme .gclass-connect-banner {
    background: #1e293b !important;
    border-color: #334155 !important;
}
body.dark-theme #gclassSettingsPanel {
    background: #0f172a !important;
    border-color: var(--primary-blue) !important;
}
body.dark-theme #gclassWorkListContainer {
    background: #0f172a !important;
    border-color: #334155 !important;
}
body.dark-theme #gclassWorkListContainer label {
    background: #1e293b !important;
    border-color: #334155 !important;
}
body.dark-theme #gclassWorkListContainer label:hover {
    border-color: var(--primary-blue) !important;
}
body.dark-theme #gclassPreviewTable {
    border-color: #334155 !important;
}
body.dark-theme #gclassPreviewTable th {
    background: #1e293b !important;
    color: #cbd5e1 !important;
}
body.dark-theme #gclassPreviewTable td {
    border-bottom-color: #334155 !important;
    color: #f1f5f9 !important;
}
body.dark-theme #btnSelectAllGclassWork,
body.dark-theme #btnDeselectAllGclassWork {
    background: #1e293b !important;
    border-color: #334155 !important;
    color: #cbd5e1 !important;
}

/* ==========================================================================
   TEACHER & ADMIN PROFILE BADGE & EDIT MODAL
   ========================================================================== */
#desktopUserProfileBadge {
    cursor: pointer;
    border-radius: 10px;
    padding: 3px 8px;
    transition: background-color 0.2s ease, transform 0.15s ease;
    user-select: none;
}
#desktopUserProfileBadge:hover {
    background-color: rgba(255, 255, 255, 0.14) !important;
    transform: translateY(-1px);
}
#desktopUserProfileBadge:active {
    transform: translateY(0);
}

#mobileUserProfileBadge {
    cursor: pointer;
    border-radius: 10px;
    transition: background-color 0.2s ease;
    user-select: none;
}
#mobileUserProfileBadge:hover {
    background-color: var(--bg-hover, rgba(0, 0, 0, 0.05));
}

#userAvatarCircle, #mobileUserAvatarCircle {
    overflow: hidden;
    position: relative;
}
#userAvatarCircle img, #mobileUserAvatarCircle img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
    display: block;
}

#teacherModalAvatarPreview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
    display: block;
}

#teacherProfileModal:not(.hidden) {
    display: flex !important;
    animation: fadeInModal 0.2s ease-out;
}

@keyframes fadeInModal {
    from {
        opacity: 0;
        transform: scale(0.97);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Dedicated modal card styles (independent of .box to prevent CSS collisions) */
.teacher-modal-card {
    width: 100%;
    max-width: 480px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    padding: 26px 28px;
    border-radius: 20px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-color, #e2e8f0);
    background: var(--card-bg, #ffffff);
    box-sizing: border-box;
}

.teacher-modal-close-btn {
    position: absolute !important;
    right: 16px !important;
    top: 16px !important;
    width: 32px !important;
    height: 32px !important;
    border-radius: 50% !important;
    background: rgba(0, 0, 0, 0.05) !important;
    color: var(--text-gray, #64748b) !important;
    border: none !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 14px !important;
    font-weight: bold !important;
    transition: background 0.15s, transform 0.1s !important;
    user-select: none !important;
    padding: 0 !important;
    margin: 0 !important;
    box-shadow: none !important;
}
.teacher-modal-close-btn:hover {
    background: rgba(0, 0, 0, 0.1) !important;
    color: var(--text-dark, #0f172a) !important;
}

.teacher-modal-card input:not([type="file"]) {
    height: 40px !important;
    padding: 8px 12px !important;
    font-size: 13.5px !important;
    border-radius: 8px !important;
    border: 1px solid var(--border-color, #cbd5e1) !important;
    background: var(--input-bg, #ffffff) !important;
    color: var(--text-dark, #0f172a) !important;
    margin: 0 !important;
    box-sizing: border-box !important;
    width: 100% !important;
    outline: none !important;
    display: block !important;
    box-shadow: none !important;
}
.teacher-modal-card input:not([type="file"]):focus {
    border-color: var(--primary-blue, #1e5eff) !important;
    box-shadow: 0 0 0 3px rgba(30, 94, 255, 0.15) !important;
}
.teacher-modal-card input[type="password"] {
    padding-right: 42px !important;
}

.teacher-modal-card .password-eye-btn {
    position: absolute !important;
    right: 8px !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    cursor: pointer !important;
    user-select: none !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 28px !important;
    height: 28px !important;
    border-radius: 6px !important;
    font-size: 15px !important;
    line-height: 1 !important;
    transition: background 0.15s !important;
    color: #64748b !important;
    z-index: 2 !important;
    background: transparent !important;
    border: none !important;
    padding: 0 !important;
    margin: 0 !important;
}
.teacher-modal-card .password-eye-btn:hover {
    background: rgba(0, 0, 0, 0.08) !important;
}

.teacher-photo-action-btn {
    color: var(--primary-blue, #1e5eff) !important;
    font-size: 12.5px !important;
    font-weight: 700 !important;
    cursor: pointer !important;
    padding: 5px 14px !important;
    border-radius: 20px !important;
    background: rgba(30, 94, 255, 0.08) !important;
    border: 1px solid rgba(30, 94, 255, 0.2) !important;
    transition: background 0.15s, transform 0.1s !important;
    user-select: none !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
}
.teacher-photo-action-btn:hover {
    background: rgba(30, 94, 255, 0.15) !important;
    transform: translateY(-1px) !important;
}

.teacher-photo-remove-btn {
    color: #ef4444 !important;
    font-size: 12px !important;
    font-weight: 600 !important;
    cursor: pointer !important;
    padding: 5px 12px !important;
    border-radius: 20px !important;
    background: rgba(239, 68, 68, 0.08) !important;
    border: 1px solid rgba(239, 68, 68, 0.2) !important;
    transition: background 0.15s, transform 0.1s !important;
    user-select: none !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
}
.teacher-photo-remove-btn:hover {
    background: rgba(239, 68, 68, 0.16) !important;
    transform: translateY(-1px) !important;
}

#teacherProfileModal .teacher-modal-cancel-btn {
    height: 38px !important;
    padding: 0 18px !important;
    background: #f1f5f9 !important;
    color: var(--text-dark, #0f172a) !important;
    border: 1px solid #cbd5e1 !important;
    border-radius: 8px !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    cursor: pointer !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    margin: 0 !important;
    box-shadow: none !important;
    transition: 0.15s !important;
}
#teacherProfileModal .teacher-modal-cancel-btn:hover {
    background: #e2e8f0 !important;
}

#teacherProfileModal .teacher-modal-save-btn {
    height: 38px !important;
    padding: 0 22px !important;
    background: var(--primary-blue, #1e5eff) !important;
    color: #ffffff !important;
    border: 1px solid var(--primary-blue, #1e5eff) !important;
    border-radius: 8px !important;
    font-size: 13px !important;
    font-weight: 700 !important;
    cursor: pointer !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 6px !important;
    box-shadow: 0 4px 12px rgba(30, 94, 255, 0.25) !important;
    margin: 0 !important;
    transition: 0.15s !important;
}
#teacherProfileModal .teacher-modal-save-btn:hover {
    background: #174ed8 !important;
    border-color: #174ed8 !important;
    color: #ffffff !important;
}

body.dark-theme .teacher-modal-card {
    background: #1e293b !important;
    border-color: #334155 !important;
    color: #f1f5f9 !important;
}
body.dark-theme .teacher-modal-card input:not([type="file"]) {
    background: #0f172a !important;
    border-color: #334155 !important;
    color: #f1f5f9 !important;
}
body.dark-theme .teacher-modal-card .teacher-modal-close-btn {
    background: rgba(255, 255, 255, 0.1) !important;
    color: #cbd5e1 !important;
}
body.dark-theme .teacher-modal-card .teacher-modal-close-btn:hover {
    background: rgba(255, 255, 255, 0.18) !important;
    color: #ffffff !important;
}
body.dark-theme .teacher-modal-card .password-eye-btn {
    color: #94a3b8 !important;
}
body.dark-theme .teacher-modal-card .password-eye-btn:hover {
    background: rgba(255, 255, 255, 0.12) !important;
}
body.dark-theme .teacher-modal-card .teacher-modal-cancel-btn {
    background: #334155 !important;
    border-color: #475569 !important;
    color: #cbd5e1 !important;
}
body.dark-theme .teacher-modal-card .teacher-modal-cancel-btn:hover {
    background: #475569 !important;
    color: #ffffff !important;
}
body.dark-theme .teacher-modal-card .profile-photo-card {
    background: rgba(15, 23, 42, 0.5) !important;
    border-color: #334155 !important;
}
body.dark-theme .teacher-modal-card .password-section-card {
    background: rgba(15, 23, 42, 0.5) !important;
    border-color: #334155 !important;
}

/* ==========================================================================
   ATTENDANCE UI ENHANCEMENTS: SPLIT BUTTON, UNIFIED STATS, KEBAB MENU
   ========================================================================== */

/* 1. Split Button & Dropdown Actions */
.att-split-btn-wrapper {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.att-split-pill {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%) !important;
    border: none !important;
    border-radius: 8px !important;
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.28) !important;
    overflow: hidden !important;
    height: 38px !important;
    min-height: 38px !important;
    max-height: 38px !important;
    padding: 0 !important;
    margin: 0 !important;
    cursor: pointer;
    box-sizing: border-box !important;
    line-height: 1 !important;
    transition: transform 0.16s cubic-bezier(0.34, 1.56, 0.64, 1), 
                box-shadow 0.16s ease, 
                background 0.16s ease, 
                filter 0.16s ease !important;
    transform: translateY(0) scale(1);
}

.att-split-pill:hover {
    background: linear-gradient(135deg, #f87171 0%, #ef4444 100%) !important;
    transform: translateY(-2px) scale(1.02) !important;
    box-shadow: 0 6px 18px rgba(239, 68, 68, 0.42) !important;
    filter: brightness(1.04) !important;
}

.att-split-pill:active {
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%) !important;
    transform: translateY(1px) scale(0.96) !important;
    box-shadow: 0 1px 4px rgba(239, 68, 68, 0.3) !important;
    filter: brightness(0.92) !important;
}

.att-split-main-btn,
.att-split-main-btn:hover,
.att-split-main-btn:active,
.att-split-main-btn:focus {
    border: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    outline: none !important;
    transform: none !important;
    height: 100% !important;
    min-height: 100% !important;
    max-height: 100% !important;
    margin: 0 !important;
    margin-top: 0 !important;
    margin-bottom: 0 !important;
    align-self: stretch !important;
}

.att-split-main-btn {
    background: transparent !important;
    color: #ffffff !important;
    padding: 0 16px 0 18px !important;
    margin: 0 !important;
    font-size: 13.5px !important;
    font-weight: 700 !important;
    cursor: pointer;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 8px !important;
    height: 100% !important;
    line-height: 1 !important;
    vertical-align: middle !important;
    box-sizing: border-box !important;
    transition: background 0.15s ease, color 0.15s ease;
    white-space: nowrap !important;
}

.att-split-main-btn span {
    display: inline-flex !important;
    align-items: center !important;
    line-height: 1 !important;
    margin: 0 !important;
    padding: 0 !important;
}

.att-split-main-btn svg {
    color: #ffffff !important;
    stroke: #ffffff !important;
    display: block !important;
    margin: 0 !important;
    flex-shrink: 0 !important;
}

.att-split-main-btn:hover {
    background: rgba(255, 255, 255, 0.14) !important;
    color: #ffffff !important;
}

.att-split-divider {
    width: 1px !important;
    min-width: 1px !important;
    height: 100% !important;
    min-height: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    background: rgba(255, 255, 255, 0.28) !important;
    align-self: stretch !important;
    flex-shrink: 0 !important;
}

.att-split-arrow-btn,
.att-split-arrow-btn:hover,
.att-split-arrow-btn:active,
.att-split-arrow-btn:focus {
    border: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    outline: none !important;
    transform: none !important;
    height: 100% !important;
    min-height: 100% !important;
    max-height: 100% !important;
    margin: 0 !important;
    margin-top: 0 !important;
    margin-bottom: 0 !important;
    align-self: stretch !important;
}

.att-split-arrow-btn {
    background: transparent !important;
    color: #ffffff !important;
    padding: 0 11px !important;
    margin: 0 !important;
    cursor: pointer;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    height: 100% !important;
    line-height: 1 !important;
    vertical-align: middle !important;
    box-sizing: border-box !important;
    transition: background 0.15s ease, color 0.15s ease;
}

.att-split-arrow-btn svg {
    color: #ffffff !important;
    stroke: #ffffff !important;
    display: block !important;
    margin: auto !important;
    flex-shrink: 0 !important;
}

.att-split-arrow-btn:hover {
    background: rgba(255, 255, 255, 0.22) !important;
    color: #ffffff !important;
}

.att-actions-dropdown {
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    background: var(--card-bg, #ffffff);
    border: 1px solid var(--border-color, #e2e8f0);
    border-radius: 10px;
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.14), 0 2px 8px rgba(0, 0, 0, 0.06);
    padding: 6px;
    min-width: 215px;
    z-index: 1050;
    display: flex;
    flex-direction: column;
    gap: 4px;
    animation: fadeIn 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}

.att-actions-dropdown.hidden {
    display: none !important;
}

.att-action-dropdown-item {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: flex-start !important;
    gap: 8px !important;
    width: 100% !important;
    height: auto !important;
    padding: 9px 13px !important;
    margin: 0 !important;
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%) !important;
    border: none !important;
    border-radius: 8px !important;
    font-size: 13px !important;
    font-weight: 700 !important;
    cursor: pointer !important;
    text-align: left !important;
    color: #ffffff !important;
    box-shadow: 0 2px 6px rgba(239, 68, 68, 0.22) !important;
    outline: none !important;
    line-height: 1 !important;
    box-sizing: border-box !important;
    white-space: nowrap !important;
    transition: transform 0.16s cubic-bezier(0.34, 1.56, 0.64, 1), 
                box-shadow 0.16s ease, 
                background 0.16s ease, 
                filter 0.16s ease !important;
    transform: translateY(0) scale(1);
}

.att-action-dropdown-item svg {
    color: #ffffff !important;
    stroke: #ffffff !important;
    display: block !important;
    margin: 0 !important;
    flex-shrink: 0 !important;
    transition: transform 0.16s ease;
}

.att-action-dropdown-item span {
    color: #ffffff !important;
    font-weight: 700 !important;
    line-height: 1 !important;
}

.att-action-dropdown-item:hover {
    background: linear-gradient(135deg, #f87171 0%, #ef4444 100%) !important;
    color: #ffffff !important;
    transform: translateY(-1px) scale(1.02) !important;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.38) !important;
    filter: brightness(1.04) !important;
}

.att-action-dropdown-item:hover svg {
    transform: scale(1.08);
}

.att-action-dropdown-item:active {
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%) !important;
    color: #ffffff !important;
    transform: translateY(1px) scale(0.97) !important;
    box-shadow: 0 1px 4px rgba(239, 68, 68, 0.25) !important;
    filter: brightness(0.92) !important;
}

.att-dropdown-divider {
    height: 1px;
    background: var(--border-color, #e2e8f0);
    margin: 4px 0;
}

.att-dropdown-divider.hidden {
    display: none !important;
}

/* 2. Unified Stats Box */
.att-unified-stats-box {
    background: var(--card-bg, #ffffff);
    border: 1px solid var(--border-color, #e2e8f0);
    border-radius: 16px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.03);
    margin-bottom: 22px;
}

.att-unified-stats-row {
    display: flex;
    align-items: stretch;
    width: 100%;
}

.att-stat-cell {
    flex: 1;
    min-width: 0;
    padding: 18px 20px;
    display: flex;
    align-items: center;
    gap: 14px;
}

.att-stat-divider {
    width: 1px;
    background: var(--border-color, #e2e8f0);
    align-self: stretch;
    flex-shrink: 0;
    margin: 12px 0;
}

.att-stat-icon-wrapper {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

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

.att-stat-label {
    margin: 0;
    font-size: 11.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    white-space: nowrap;
}

.att-stat-pct {
    font-size: 11px;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 6px;
}

.att-stat-value {
    margin: 4px 0 0 0;
    font-size: 22px;
    font-weight: 800;
    line-height: 1.1;
}

/* 3. Table Kebab Menu */
.att-kebab-menu {
    position: relative;
    display: inline-block;
}

.att-kebab-trigger {
    width: 32px !important;
    height: 32px !important;
    border-radius: 6px !important;
    border: none !important;
    background: transparent !important;
    background-color: transparent !important;
    color: var(--text-gray, #64748b) !important;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: color 0.15s ease;
    padding: 0 !important;
    margin: 0 auto !important;
    box-shadow: none !important;
    outline: none !important;
    font-size: 22px !important;
    font-weight: 800 !important;
    line-height: 1 !important;
}

.att-kebab-trigger:hover {
    background: transparent !important;
    background-color: transparent !important;
    color: var(--text-dark, #0f172a) !important;
    transform: none !important;
    box-shadow: none !important;
}

.att-row-dropdown {
    position: absolute;
    right: 0;
    top: calc(100% + 4px);
    background: var(--card-bg, #ffffff);
    border: 1px solid var(--border-color, #e2e8f0);
    border-radius: 10px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.12);
    padding: 5px;
    min-width: 115px;
    z-index: 999;
    display: flex;
    flex-direction: column;
    gap: 3px;
    text-align: left;
    animation: fadeIn 0.15s ease-out;
}

.att-row-dropdown.hidden {
    display: none !important;
}

.att-row-item {
    display: flex !important;
    align-items: center;
    justify-content: flex-start !important;
    width: 100% !important;
    height: auto !important;
    padding: 8px 12px !important;
    margin: 0 !important;
    background: transparent !important;
    border: none !important;
    border-radius: 6px !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    color: var(--text-dark, #1e293b) !important;
    cursor: pointer;
    text-align: left !important;
    box-shadow: none !important;
    transition: background 0.12s ease, color 0.12s ease, transform 0.12s cubic-bezier(0.22, 1, 0.36, 1) !important;
}

.att-row-item:hover {
    background: #f1f5f9 !important;
    transform: translateX(2px) !important;
}

.att-row-item:active {
    transform: scale(0.98) !important;
}

.att-row-item.opt-present:hover {
    background: rgba(16, 185, 129, 0.12) !important;
    color: #059669 !important;
}

.att-row-item.opt-absent:hover {
    background: rgba(239, 68, 68, 0.12) !important;
    color: #dc2626 !important;
}

.att-row-item.opt-note:hover {
    background: rgba(99, 102, 241, 0.12) !important;
    color: #4f46e5 !important;
}

.att-item-icon-wrap {
    width: 24px;
    height: 24px;
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

/* Responsive Styles */
@media (max-width: 992px) {
    .att-unified-stats-row {
        flex-wrap: wrap;
    }
    .att-stat-cell {
        flex: 1 1 45%;
        border-bottom: 1px solid var(--border-color, #e2e8f0);
    }
    .att-stat-divider {
        display: none;
    }
}

@media (max-width: 580px) {
    .att-stat-cell {
        flex: 1 1 100%;
    }
}

/* Dark Theme Adaptations */
body.dark-theme .att-actions-dropdown,
body.dark-mode .att-actions-dropdown,
body.dark-theme .att-row-dropdown,
body.dark-mode .att-row-dropdown {
    background: #1e293b;
    border-color: #334155;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.45);
}

body.dark-theme .att-action-dropdown-item,
body.dark-mode .att-action-dropdown-item,
body.dark-theme .att-row-item,
body.dark-mode .att-row-item {
    color: #f1f5f9 !important;
}

body.dark-theme .att-action-dropdown-item:hover,
body.dark-mode .att-action-dropdown-item:hover,
body.dark-theme .att-row-item:hover,
body.dark-mode .att-row-item:hover {
    background: #334155 !important;
}

body.dark-theme .att-kebab-trigger,
body.dark-mode .att-kebab-trigger {
    background: transparent !important;
    background-color: transparent !important;
    color: #cbd5e1 !important;
    border: none !important;
    box-shadow: none !important;
}

body.dark-theme .att-kebab-trigger:hover,
body.dark-mode .att-kebab-trigger:hover {
    background: transparent !important;
    background-color: transparent !important;
    color: #ffffff !important;
    box-shadow: none !important;
}

body.dark-theme .att-unified-stats-box,
body.dark-mode .att-unified-stats-box {
    background: #1e293b;
    border-color: #334155;
}

body.dark-theme .att-stat-divider,
body.dark-mode .att-stat-divider,
body.dark-theme .att-dropdown-divider,
body.dark-mode .att-dropdown-divider {
    background: #334155;
}

/* ==========================================================================
   SCORE INPUT MODE DROPDOWN & VIEW SCORE LEDGER SPLIT BUTTON
   ========================================================================== */

/* 1. Score Mode Dropdown */
.score-mode-dropdown-wrap {
    position: relative;
    display: inline-block;
}

.score-mode-btn {
    background: var(--card-bg, #ffffff) !important;
    border: 1.5px solid var(--border-color, #cbd5e1) !important;
    color: var(--text-dark, #0f172a) !important;
    border-radius: 9999px !important;
    padding: 0 16px !important;
    height: 38px !important;
    font-size: 13.5px !important;
    font-weight: 700 !important;
    cursor: pointer !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 8px !important;
    box-shadow: none !important;
    outline: none !important;
    transition: all 0.2s ease !important;
}

.score-mode-btn:hover {
    border-color: var(--primary-blue, #1e5eff) !important;
    background: #f8fafc !important;
}

.score-mode-chevron {
    transition: transform 0.2s ease;
    color: #64748b;
}

.score-mode-btn[aria-expanded="true"] .score-mode-chevron {
    transform: rotate(180deg);
}

.score-mode-menu {
    position: absolute;
    right: 0;
    top: calc(100% + 6px);
    background: var(--card-bg, #ffffff);
    border: 1px solid var(--border-color, #e2e8f0);
    border-radius: 12px;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.05);
    padding: 6px;
    min-width: 250px;
    z-index: 1050;
    display: flex;
    flex-direction: column;
    gap: 3px;
    animation: fadeIn 0.15s ease-out;
}

.score-mode-menu.hidden {
    display: none !important;
}

.score-mode-option {
    display: flex !important;
    align-items: center !important;
    gap: 11px !important;
    width: 100% !important;
    padding: 7px 10px !important;
    margin: 0 !important;
    background: transparent !important;
    border: none !important;
    border-radius: 8px !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    color: var(--text-dark, #334155) !important;
    cursor: pointer !important;
    text-align: left !important;
    box-shadow: none !important;
    outline: none !important;
    transform: none !important;
    white-space: nowrap !important;
    transition: background 0.12s ease, color 0.12s ease !important;
}

.score-mode-option:hover {
    background: #f1f5f9 !important;
    color: var(--text-dark, #0f172a) !important;
}

.score-mode-opt-icon {
    width: 28px;
    height: 28px;
    border-radius: 7px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.score-mode-icon-single {
    background: #eff6ff;
    color: #2563eb;
}

.score-mode-icon-bulk {
    background: #f5f3ff;
    color: #7c3aed;
}

.score-mode-icon-gclass {
    background: #ecfdf5;
    color: #059669;
}

.score-mode-opt-text {
    flex: 1;
    font-weight: 600;
    white-space: nowrap;
}

.score-mode-check {
    display: none;
    color: var(--primary-blue, #1e5eff);
    margin-left: auto;
    flex-shrink: 0;
}

.score-mode-option.active {
    background: #f8fafc !important;
    color: var(--primary-blue, #1e5eff) !important;
}

.score-mode-option.active .score-mode-opt-text {
    font-weight: 700;
    color: var(--primary-blue, #1e5eff);
}

.score-mode-option.active .score-mode-check {
    display: inline-block;
}

/* 2. Score Ledger Split Button */
.score-ledger-split-wrap {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.score-ledger-split-pill,
.score-ledger-split-btn-wrap {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%) !important;
    border: none !important;
    border-radius: 8px !important;
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.28) !important;
    overflow: hidden !important;
    height: 38px !important;
    min-height: 38px !important;
    max-height: 38px !important;
    padding: 0 !important;
    margin: 0 !important;
    cursor: pointer;
    box-sizing: border-box !important;
    line-height: 1 !important;
    transition: transform 0.16s cubic-bezier(0.34, 1.56, 0.64, 1), 
                box-shadow 0.16s ease, 
                background 0.16s ease, 
                filter 0.16s ease !important;
    transform: translateY(0) scale(1);
}

.score-ledger-split-pill:hover,
.score-ledger-split-btn-wrap:hover {
    background: linear-gradient(135deg, #f87171 0%, #ef4444 100%) !important;
    transform: translateY(-2px) scale(1.02) !important;
    box-shadow: 0 6px 18px rgba(239, 68, 68, 0.42) !important;
    filter: brightness(1.04) !important;
}

.score-ledger-split-pill:active,
.score-ledger-split-btn-wrap:active {
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%) !important;
    transform: translateY(1px) scale(0.96) !important;
    box-shadow: 0 1px 4px rgba(239, 68, 68, 0.3) !important;
    filter: brightness(0.92) !important;
}

.score-ledger-main-btn,
.score-ledger-main-btn:hover,
.score-ledger-main-btn:active,
.score-ledger-main-btn:focus {
    border: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    outline: none !important;
    transform: none !important;
    height: 100% !important;
    min-height: 100% !important;
    max-height: 100% !important;
    margin: 0 !important;
    margin-top: 0 !important;
    margin-bottom: 0 !important;
    align-self: stretch !important;
}

.score-ledger-main-btn {
    background: transparent !important;
    color: #ffffff !important;
    padding: 0 16px !important;
    margin: 0 !important;
    font-size: 13px !important;
    font-weight: 700 !important;
    cursor: pointer;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 7px !important;
    height: 100% !important;
    line-height: 1 !important;
    vertical-align: middle !important;
    box-sizing: border-box !important;
    transition: background 0.15s ease, color 0.15s ease;
    white-space: nowrap !important;
}

.score-ledger-main-btn span {
    display: inline-flex !important;
    align-items: center !important;
    line-height: 1 !important;
    margin: 0 !important;
    padding: 0 !important;
}

.score-ledger-main-btn svg {
    color: #ffffff !important;
    stroke: #ffffff !important;
    display: block !important;
    margin: 0 !important;
    flex-shrink: 0 !important;
}

.score-ledger-main-btn:hover {
    background: rgba(255, 255, 255, 0.14) !important;
    color: #ffffff !important;
}

.score-ledger-divider {
    width: 1px !important;
    min-width: 1px !important;
    height: 100% !important;
    min-height: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    background: rgba(255, 255, 255, 0.28) !important;
    align-self: stretch !important;
    flex-shrink: 0 !important;
}

.score-ledger-arrow-btn,
.score-ledger-arrow-btn:hover,
.score-ledger-arrow-btn:active,
.score-ledger-arrow-btn:focus {
    border: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    outline: none !important;
    transform: none !important;
    height: 100% !important;
    min-height: 100% !important;
    max-height: 100% !important;
    margin: 0 !important;
    margin-top: 0 !important;
    margin-bottom: 0 !important;
    align-self: stretch !important;
}

.score-ledger-arrow-btn {
    background: transparent !important;
    color: #ffffff !important;
    padding: 0 10px !important;
    margin: 0 !important;
    cursor: pointer;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    height: 100% !important;
    line-height: 1 !important;
    vertical-align: middle !important;
    box-sizing: border-box !important;
    transition: background 0.15s ease, color 0.15s ease;
}

.score-ledger-arrow-btn svg {
    color: #ffffff !important;
    stroke: #ffffff !important;
    display: block !important;
    margin: auto !important;
    flex-shrink: 0 !important;
    transition: transform 0.2s ease;
}

.score-ledger-arrow-btn:hover {
    background: rgba(255, 255, 255, 0.22) !important;
    color: #ffffff !important;
}

.score-ledger-arrow-btn[aria-expanded="true"] svg {
    transform: rotate(180deg);
}

.score-ledger-dropdown {
    position: absolute;
    right: 0;
    top: calc(100% + 6px);
    background: var(--card-bg, #ffffff);
    border: 1px solid var(--border-color, #e2e8f0);
    border-radius: 10px;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.12), 0 8px 10px -6px rgba(0, 0, 0, 0.08);
    padding: 6px;
    min-width: 180px;
    z-index: 1050;
    display: flex;
    flex-direction: column;
    gap: 4px;
    animation: fadeIn 0.15s ease-out;
}

.score-ledger-dropdown.hidden {
    display: none !important;
}

.score-ledger-dropdown-item {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: flex-start !important;
    gap: 9px !important;
    width: 100% !important;
    padding: 9px 14px !important;
    margin: 0 !important;
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%) !important;
    border: none !important;
    border-radius: 8px !important;
    font-size: 13px !important;
    font-weight: 700 !important;
    color: #ffffff !important;
    cursor: pointer !important;
    text-align: left !important;
    box-shadow: 0 2px 6px rgba(239, 68, 68, 0.22) !important;
    outline: none !important;
    line-height: 1 !important;
    white-space: nowrap !important;
    box-sizing: border-box !important;
    transition: transform 0.16s cubic-bezier(0.34, 1.56, 0.64, 1), 
                box-shadow 0.16s ease, 
                background 0.16s ease, 
                filter 0.16s ease !important;
    transform: translateY(0) scale(1);
}

.score-ledger-dropdown-item svg {
    color: #ffffff !important;
    stroke: #ffffff !important;
    display: block !important;
    margin: 0 !important;
    flex-shrink: 0 !important;
    transition: transform 0.16s ease;
}

.score-ledger-dropdown-item span {
    color: #ffffff !important;
    font-weight: 700 !important;
    line-height: 1 !important;
}

.score-ledger-dropdown-item:hover {
    background: linear-gradient(135deg, #f87171 0%, #ef4444 100%) !important;
    color: #ffffff !important;
    transform: translateY(-1px) scale(1.02) !important;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.38) !important;
    filter: brightness(1.04) !important;
}

.score-ledger-dropdown-item:hover svg {
    transform: scale(1.08);
}

.score-ledger-dropdown-item:active {
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%) !important;
    color: #ffffff !important;
    transform: translateY(1px) scale(0.97) !important;
    box-shadow: 0 1px 4px rgba(239, 68, 68, 0.25) !important;
    filter: brightness(0.92) !important;
}

/* Dark theme overrides */
body.dark-theme .score-ledger-dropdown {
    background: #111c44 !important;
    border-color: #243269 !important;
}

/* Dark theme overrides */
body.dark-theme .score-mode-btn {
    background: #1e293b !important;
    border-color: #334155 !important;
    color: #f8fafc !important;
}
body.dark-theme .score-mode-btn:hover {
    background: #334155 !important;
}
body.dark-theme .score-mode-menu,
body.dark-theme .score-ledger-dropdown {
    background: #1e293b !important;
    border-color: #334155 !important;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.45) !important;
}
body.dark-theme .score-mode-option,
body.dark-theme .score-ledger-dropdown-item {
    color: #f1f5f9 !important;
}
body.dark-theme .score-mode-option:hover,
body.dark-theme .score-ledger-dropdown-item:hover {
    background: #334155 !important;
}
body.dark-theme .score-mode-option.active {
    background: #0f172a !important;
}
body.dark-theme .score-mode-icon-single {
    background: rgba(37, 99, 235, 0.2);
    color: #60a5fa;
}
body.dark-theme .score-mode-icon-bulk {
    background: rgba(124, 58, 237, 0.2);
    color: #c084fc;
}
body.dark-theme .score-mode-icon-gclass {
    background: rgba(16, 185, 129, 0.2);
    color: #34d399;
}
body.dark-theme .score-ledger-split-pill,
body.dark-theme .score-ledger-split-btn-wrap {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%) !important;
    border: none !important;
}
body.dark-theme .score-ledger-main-btn {
    color: #ffffff !important;
}
body.dark-theme .score-ledger-arrow-btn {
    color: #ffffff !important;
}
body.dark-theme .score-ledger-divider {
    background: rgba(255, 255, 255, 0.28) !important;
}

/* Accessibility: Respect Reduced Motion Preference */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001ms !important;
    }
}

/* ======================================================
   CIRCULAR ACTION BUTTONS IN DESKTOP NAVBAR (ADMIN & INDEX)
   ====================================================== */
.desktop-user-actions button,
.desktop-user-actions .btn-circle,
.desktop-user-actions #themeToggleBtn,
.desktop-user-actions #darkModeToggle,
.desktop-user-actions .theme-toggle-btn,
.desktop-user-actions .teacher-btn,
.desktop-user-actions #logoutBtn,
.desktop-user-actions #studentLogoutBtn,
.desktop-user-actions .logout-btn {
    width: 36px !important;
    height: 36px !important;
    min-width: 36px !important;
    min-height: 36px !important;
    max-width: 36px !important;
    max-height: 36px !important;
    border-radius: 50% !important;
    padding: 0 !important;
    margin: 0 !important;
    background: rgba(255, 255, 255, 0.12) !important;
    border: 1.5px solid rgba(255, 255, 255, 0.25) !important;
    color: #ffffff !important;
    box-shadow: none !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex: none !important;
    flex-shrink: 0 !important;
    box-sizing: border-box !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
}

.desktop-user-actions .btn-circle:hover,
.desktop-user-actions #themeToggleBtn:hover,
.desktop-user-actions #darkModeToggle:hover,
.desktop-user-actions .theme-toggle-btn:hover,
.desktop-user-actions .teacher-btn:hover {
    background: rgba(255, 255, 255, 0.22) !important;
    border-color: rgba(255, 255, 255, 0.45) !important;
    transform: translateY(-1px) scale(1.05) !important;
}

.desktop-user-actions #logoutBtn,
.desktop-user-actions #studentLogoutBtn,
.desktop-user-actions .logout-btn {
    background: rgba(239, 68, 68, 0.18) !important;
    border: 1.5px solid rgba(239, 68, 68, 0.45) !important;
    color: #f87171 !important;
}

.desktop-user-actions #logoutBtn:hover,
.desktop-user-actions #studentLogoutBtn:hover,
.desktop-user-actions .logout-btn:hover {
    background: rgba(239, 68, 68, 0.35) !important;
    border-color: rgba(239, 68, 68, 0.7) !important;
    color: #ffffff !important;
    transform: translateY(-1px) scale(1.05) !important;
}

/* Bulletproof SVG Icon Visibility & Sizing */
.desktop-user-actions button svg,
.desktop-user-actions .btn-circle svg {
    width: 18px !important;
    height: 18px !important;
    min-width: 18px !important;
    min-height: 18px !important;
    max-width: 18px !important;
    max-height: 18px !important;
    fill: none !important;
    stroke: #ffffff !important;
    stroke-width: 2.2 !important;
    stroke-linecap: round !important;
    stroke-linejoin: round !important;
    flex-shrink: 0 !important;
    pointer-events: none !important;
    transition: stroke 0.2s ease !important;
}

.desktop-user-actions #logoutBtn svg,
.desktop-user-actions #studentLogoutBtn svg,
.desktop-user-actions .logout-btn svg {
    stroke: #f87171 !important;
}

.desktop-user-actions #logoutBtn:hover svg,
.desktop-user-actions #studentLogoutBtn:hover svg,
.desktop-user-actions .logout-btn:hover svg {
    stroke: #ffffff !important;
}

/* Theme Icon Swapping System: Light Mode -> Moon visible, Sun hidden; Dark Mode -> Sun visible, Moon hidden */
.theme-icon-sun,
svg.theme-icon-sun,
.desktop-user-actions .theme-icon-sun,
.desktop-user-actions svg.theme-icon-sun {
    display: none !important;
}

.theme-icon-moon,
svg.theme-icon-moon,
.desktop-user-actions .theme-icon-moon,
.desktop-user-actions svg.theme-icon-moon {
    display: inline-block !important;
}

body.dark-theme .theme-icon-sun,
body.dark-theme svg.theme-icon-sun,
body.dark-theme .desktop-user-actions .theme-icon-sun,
body.dark-theme .desktop-user-actions svg.theme-icon-sun,
body.dark-mode .theme-icon-sun,
body.dark-mode svg.theme-icon-sun,
body.dark-mode .desktop-user-actions .theme-icon-sun,
body.dark-mode .desktop-user-actions svg.theme-icon-sun {
    display: inline-block !important;
}

body.dark-theme .theme-icon-moon,
body.dark-theme svg.theme-icon-moon,
body.dark-theme .desktop-user-actions .theme-icon-moon,
body.dark-theme .desktop-user-actions svg.theme-icon-moon,
body.dark-mode .theme-icon-moon,
body.dark-mode svg.theme-icon-moon,
body.dark-mode .desktop-user-actions .theme-icon-moon,
body.dark-mode .desktop-user-actions svg.theme-icon-moon {
    display: none !important;
}

/* ==========================================================================
   ASSIGNMENT REMINDER - ROSTER BOX & CONTROLS REFINEMENT
   ========================================================================== */

/* 1. Student Roster Box Container (No extra nested card or background) */
.reminder-roster-box {
    background: transparent !important;
    border: none !important;
    border-radius: 0 !important;
    padding: 0 !important;
    margin-bottom: 16px;
    box-shadow: none !important;
}

body.dark-theme .reminder-roster-box,
body.dark-mode .reminder-roster-box {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
}

/* 2. Roster Header & Search/Select Controls */
.reminder-roster-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.reminder-select-pill-group {
    display: inline-flex;
    align-items: stretch;
    background: var(--card-bg, #ffffff);
    border: 1.5px solid var(--border-color, #cbd5e1);
    border-radius: 8px;
    overflow: hidden;
    height: 34px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

body.dark-theme .reminder-select-pill-group,
body.dark-mode .reminder-select-pill-group {
    background: #15214d !important;
    border-color: #243269 !important;
}

.reminder-select-pill-btn,
.reminder-select-pill-btn:hover,
.reminder-select-pill-btn:focus,
.reminder-select-pill-btn:active {
    outline: none !important;
    transform: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
}

.reminder-select-pill-btn {
    background: transparent !important;
    color: var(--text-dark, #334155) !important;
    border: none !important;
    height: 100% !important;
    width: auto !important;
    padding: 0 12px !important;
    margin: 0 !important;
    font-size: 12px !important;
    font-weight: 600 !important;
    cursor: pointer;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
    transition: background 0.15s ease, color 0.15s ease;
}

.reminder-select-pill-btn:hover {
    background: var(--bg-hover, #f1f5f9) !important;
    color: var(--primary-blue, #1e5eff) !important;
}

body.dark-theme .reminder-select-pill-btn,
body.dark-mode .reminder-select-pill-btn {
    color: #cbd5e1 !important;
}

body.dark-theme .reminder-select-pill-btn:hover,
body.dark-mode .reminder-select-pill-btn:hover {
    background: #1e2e6b !important;
    color: #60a5fa !important;
}

.reminder-select-pill-divider {
    width: 1px;
    background: var(--border-color, #cbd5e1);
    align-self: stretch;
}

body.dark-theme .reminder-select-pill-divider,
body.dark-mode .reminder-select-pill-divider {
    background: #243269 !important;
}

/* 3. Student Checkbox Items */
#reminderStudentListContainer {
    max-height: 280px;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    display: grid !important;
    grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)) !important;
    gap: 8px !important;
    padding: 8px !important;
    border: 1px solid var(--border-color, #e2e8f0) !important;
    border-radius: 10px !important;
    background: var(--bg-hover, #f8fafc) !important;
    box-sizing: border-box !important;
    width: 100% !important;
}

@media (max-width: 480px) {
    #reminderStudentListContainer {
        grid-template-columns: 1fr !important;
    }
}

.reminder-student-item {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    gap: 10px !important;
    padding: 8px 12px !important;
    background: var(--card-bg, #ffffff) !important;
    border: 1px solid var(--border-color, #e2e8f0) !important;
    border-radius: 10px !important;
    cursor: pointer !important;
    transition: all 0.15s ease !important;
    user-select: none !important;
    box-sizing: border-box !important;
    min-width: 0 !important;
    width: 100% !important;
}

.reminder-student-cb,
.reminder-student-item input[type="checkbox"] {
    width: 17px !important;
    height: 17px !important;
    min-width: 17px !important;
    max-width: 17px !important;
    min-height: 17px !important;
    max-height: 17px !important;
    flex: 0 0 17px !important;
    flex-shrink: 0 !important;
    display: inline-block !important;
    margin: 0 !important;
    padding: 0 !important;
    accent-color: var(--primary-blue, #1e5eff) !important;
    cursor: pointer !important;
}

.reminder-student-avatar,
.reminder-student-item img {
    width: 28px !important;
    height: 28px !important;
    min-width: 28px !important;
    max-width: 28px !important;
    min-height: 28px !important;
    max-height: 28px !important;
    border-radius: 50% !important;
    flex: 0 0 28px !important;
    flex-shrink: 0 !important;
    object-fit: cover !important;
}

.reminder-student-info {
    overflow: hidden !important;
    line-height: 1.2 !important;
    flex: 1 1 auto !important;
    min-width: 0 !important;
}

.reminder-student-name {
    font-size: 13px !important;
    font-weight: 700 !important;
    color: var(--text-dark, #0f172a) !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    display: block !important;
}

.reminder-student-item:hover {
    border-color: var(--primary-blue, #1e5eff) !important;
}

.reminder-student-item:has(.reminder-student-cb:checked) {
    border-color: var(--primary-blue, #1e5eff) !important;
    background: rgba(30, 94, 255, 0.08) !important;
}

body.dark-theme .reminder-student-item,
body.dark-mode .reminder-student-item {
    background: #111c44 !important;
    border-color: #1e2a5a !important;
    color: #f4f7fe !important;
}

body.dark-theme .reminder-student-item:hover,
body.dark-mode .reminder-student-item:hover {
    background: #172458 !important;
    border-color: #3b82f6 !important;
}

body.dark-theme .reminder-student-item:has(.reminder-student-cb:checked),
body.dark-mode .reminder-student-item:has(.reminder-student-cb:checked) {
    background: rgba(30, 94, 255, 0.2) !important;
    border-color: #3b82f6 !important;
}

body.dark-theme .reminder-student-name,
body.dark-mode .reminder-student-name {
    color: #f4f7fe !important;
}

/* 4. Centered Split Pill Deploy Button */
.reminder-deploy-bar {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 16px;
    width: 100%;
}

.reminder-deploy-split-wrap {
    position: relative;
    display: inline-flex;
    align-items: center;
    width: auto !important;
}

.reminder-deploy-split-pill {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%) !important;
    color: #ffffff !important;
    border: none !important;
    border-radius: 8px !important;
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.28) !important;
    overflow: hidden !important;
    height: 38px !important;
    min-height: 38px !important;
    max-height: 38px !important;
    width: auto !important;
    margin: 0 !important;
    padding: 0 !important;
    box-sizing: border-box !important;
    line-height: 1 !important;
    cursor: pointer;
    transition: transform 0.16s cubic-bezier(0.34, 1.56, 0.64, 1), 
                box-shadow 0.16s ease, 
                background 0.16s ease, 
                filter 0.16s ease !important;
    transform: translateY(0) scale(1);
}

.reminder-deploy-split-pill:hover {
    background: linear-gradient(135deg, #f87171 0%, #ef4444 100%) !important;
    transform: translateY(-2px) scale(1.02) !important;
    box-shadow: 0 6px 18px rgba(239, 68, 68, 0.42) !important;
    filter: brightness(1.04) !important;
}

.reminder-deploy-split-pill:active {
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%) !important;
    transform: translateY(1px) scale(0.96) !important;
    box-shadow: 0 1px 4px rgba(239, 68, 68, 0.3) !important;
    filter: brightness(0.92) !important;
}

.reminder-deploy-main-btn,
.reminder-deploy-main-btn:hover,
.reminder-deploy-main-btn:focus,
.reminder-deploy-main-btn:active {
    outline: none !important;
    transform: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    border: none !important;
    height: 100% !important;
    min-height: 100% !important;
    max-height: 100% !important;
    margin: 0 !important;
    margin-top: 0 !important;
    margin-bottom: 0 !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
}

.reminder-deploy-main-btn {
    background: transparent !important;
    color: #ffffff !important;
    border: none !important;
    height: 100% !important;
    min-height: 100% !important;
    max-height: 100% !important;
    width: auto !important;
    align-self: stretch !important;
    padding: 0 18px !important;
    margin: 0 !important;
    font-size: 13px !important;
    font-weight: 700 !important;
    cursor: pointer;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 8px !important;
    line-height: 1 !important;
    vertical-align: middle !important;
    box-sizing: border-box !important;
    transition: background 0.15s ease, color 0.15s ease;
    white-space: nowrap !important;
}

.reminder-deploy-main-btn span {
    display: inline-flex !important;
    align-items: center !important;
    line-height: 1 !important;
    margin: 0 !important;
    padding: 0 !important;
}

.reminder-deploy-main-btn svg {
    color: #ffffff !important;
    stroke: #ffffff !important;
    display: block !important;
    margin: 0 !important;
    flex-shrink: 0 !important;
}

.reminder-deploy-main-btn:hover {
    background: rgba(255, 255, 255, 0.14) !important;
    color: #ffffff !important;
}

.reminder-deploy-divider {
    width: 1px !important;
    min-width: 1px !important;
    height: 100% !important;
    min-height: 100% !important;
    background: rgba(255, 255, 255, 0.28) !important;
    align-self: stretch !important;
    flex-shrink: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
}

.reminder-deploy-arrow-btn,
.reminder-deploy-arrow-btn:hover,
.reminder-deploy-arrow-btn:focus,
.reminder-deploy-arrow-btn:active {
    outline: none !important;
    transform: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    border: none !important;
    height: 100% !important;
    min-height: 100% !important;
    max-height: 100% !important;
    margin: 0 !important;
    margin-top: 0 !important;
    margin-bottom: 0 !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
}

.reminder-deploy-arrow-btn {
    background: transparent !important;
    color: #ffffff !important;
    border: none !important;
    height: 100% !important;
    min-height: 100% !important;
    max-height: 100% !important;
    width: auto !important;
    align-self: stretch !important;
    padding: 0 10px !important;
    margin: 0 !important;
    cursor: pointer;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    line-height: 1 !important;
    vertical-align: middle !important;
    box-sizing: border-box !important;
    transition: background 0.15s ease, color 0.15s ease;
}

.reminder-deploy-arrow-btn:hover {
    background: rgba(255, 255, 255, 0.22) !important;
    color: #ffffff !important;
}

.reminder-deploy-arrow-btn svg {
    color: #ffffff !important;
    stroke: #ffffff !important;
    display: block !important;
    margin: auto !important;
    flex-shrink: 0 !important;
    transition: transform 0.2s ease;
}

.reminder-deploy-arrow-btn[aria-expanded="true"] svg {
    transform: rotate(180deg);
}

body.dark-theme .reminder-deploy-split-pill,
body.dark-mode .reminder-deploy-split-pill {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%) !important;
    border: none !important;
    color: #ffffff !important;
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.3) !important;
}

body.dark-theme .reminder-deploy-split-pill:hover,
body.dark-mode .reminder-deploy-split-pill:hover {
    background: linear-gradient(135deg, #f87171 0%, #ef4444 100%) !important;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4) !important;
}

body.dark-theme .reminder-deploy-main-btn,
body.dark-mode .reminder-deploy-main-btn {
    color: #ffffff !important;
}

body.dark-theme .reminder-deploy-main-btn:hover,
body.dark-mode .reminder-deploy-main-btn:hover {
    background: rgba(255, 255, 255, 0.14) !important;
    color: #ffffff !important;
}

body.dark-theme .reminder-deploy-divider,
body.dark-mode .reminder-deploy-divider {
    background: rgba(255, 255, 255, 0.28) !important;
}

body.dark-theme .reminder-deploy-arrow-btn,
body.dark-mode .reminder-deploy-arrow-btn {
    color: #ffffff !important;
}

body.dark-theme .reminder-deploy-arrow-btn:hover,
body.dark-mode .reminder-deploy-arrow-btn:hover {
    background: rgba(255, 255, 255, 0.22) !important;
    color: #ffffff !important;
}

/* 5. Dropdown Menu for Deploy Options */
.reminder-deploy-dropdown {
    position: absolute;
    top: calc(100% + 6px) !important;
    bottom: auto !important;
    left: 50%;
    transform: translateX(-50%);
    min-width: 250px;
    background: var(--card-bg, #ffffff);
    border: 1px solid var(--border-color, #cbd5e1);
    border-radius: 10px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
    padding: 6px;
    z-index: 1050;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.reminder-deploy-dropdown.hidden {
    display: none !important;
}

body.dark-theme .reminder-deploy-dropdown,
body.dark-mode .reminder-deploy-dropdown {
    background: #111c44 !important;
    border-color: #243269 !important;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.45);
}

.reminder-deploy-dropdown-item {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%) !important;
    color: #ffffff !important;
    border: none !important;
    border-radius: 8px !important;
    box-shadow: 0 2px 6px rgba(239, 68, 68, 0.22) !important;
    outline: none !important;
    width: 100% !important;
    text-align: left;
    padding: 9px 13px !important;
    margin: 0 !important;
    font-size: 12.5px !important;
    font-weight: 700 !important;
    cursor: pointer;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: flex-start !important;
    gap: 9px !important;
    line-height: 1 !important;
    box-sizing: border-box !important;
    white-space: nowrap !important;
    transition: transform 0.16s cubic-bezier(0.34, 1.56, 0.64, 1), 
                box-shadow 0.16s ease, 
                background 0.16s ease, 
                filter 0.16s ease !important;
    transform: translateY(0) scale(1);
}

.reminder-deploy-dropdown-item svg {
    color: #ffffff !important;
    stroke: #ffffff !important;
    display: block !important;
    margin: 0 !important;
    flex-shrink: 0 !important;
    transition: transform 0.16s ease;
}

.reminder-deploy-dropdown-item span {
    color: #ffffff !important;
    font-weight: 700 !important;
    line-height: 1 !important;
}

.reminder-deploy-dropdown-item:hover {
    background: linear-gradient(135deg, #f87171 0%, #ef4444 100%) !important;
    color: #ffffff !important;
    transform: translateY(-1px) scale(1.02) !important;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.38) !important;
    filter: brightness(1.04) !important;
}

.reminder-deploy-dropdown-item:hover svg {
    transform: scale(1.08);
}

.reminder-deploy-dropdown-item:active {
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%) !important;
    color: #ffffff !important;
    transform: translateY(1px) scale(0.97) !important;
    box-shadow: 0 1px 4px rgba(239, 68, 68, 0.25) !important;
    filter: brightness(0.92) !important;
}

body.dark-theme .reminder-deploy-dropdown-item,
body.dark-mode .reminder-deploy-dropdown-item {
    color: #ffffff !important;
}

body.dark-theme .reminder-deploy-dropdown-item:hover,
body.dark-mode .reminder-deploy-dropdown-item:hover {
    background: #172458 !important;
    color: #60a5fa !important;
}

.reminder-deploy-dropdown-divider {
    height: 1px;
    background: var(--border-color, #e2e8f0);
    margin: 4px 0;
}

body.dark-theme .reminder-deploy-dropdown-divider,
body.dark-mode .reminder-deploy-dropdown-divider {
    background: #243269 !important;
}

/* 6. Bulk Delete Button in Reminders Table */
#btnBulkDeleteReminders {
    width: auto !important;
    height: 36px !important;
    min-height: 36px !important;
    max-height: 36px !important;
    padding: 0 16px !important;
    background: #ef4444 !important;
    color: #ffffff !important;
    border: none !important;
    border-radius: 8px !important;
    font-size: 12.5px !important;
    font-weight: 700 !important;
    cursor: pointer !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 6px !important;
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.25) !important;
    transition: all 0.2s ease !important;
    margin: 0 !important;
}

#btnBulkDeleteReminders:hover:not(:disabled) {
    background: #dc2626 !important;
    color: #ffffff !important;
    transform: none !important;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.35) !important;
}

#btnBulkDeleteReminders:disabled,
#btnBulkDeleteReminders.disabled {
    opacity: 0.45 !important;
    cursor: not-allowed !important;
    box-shadow: none !important;
    transform: none !important;
    pointer-events: none !important;
}

#btnBulkDeleteReminders.hidden {
    display: none !important;
}

/* ======================================================
   ATTENDANCE DATA ANALYSIS DASHBOARD STYLING
   ====================================================== */
.att-analytics-box {
    background: var(--card-bg, #ffffff);
    border: 1.5px solid var(--border-color, #e2e8f0);
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.04);
}

.att-analytics-filters {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex-wrap: wrap !important;
    gap: 8px !important;
    width: 100% !important;
}

.att-analytics-filters select {
    height: 32px !important;
    padding: 0 10px !important;
    font-size: 12.5px !important;
    font-weight: 600 !important;
    border-radius: 6px !important;
    border: 1px solid var(--border-color, #cbd5e1) !important;
    background: var(--card-bg, #ffffff) !important;
    color: var(--text-dark, #0f172a) !important;
    box-shadow: none !important;
    width: auto !important;
    min-width: 0 !important;
    margin: 0 !important;
    cursor: pointer !important;
    display: inline-block !important;
}

.att-analytics-filters select:focus {
    border-color: var(--primary-blue, #1e5eff) !important;
    outline: none !important;
}

body.dark-theme .att-analytics-filters select,
body.dark-mode .att-analytics-filters select {
    background: #1e293b !important;
    border-color: #334155 !important;
    color: #f1f5f9 !important;
}

/* Pagination button styles */
.att-page-num-btn {
    width: 30px !important;
    height: 30px !important;
    padding: 0 !important;
    font-size: 12px !important;
    font-weight: 600 !important;
    border-radius: 6px !important;
    border: none !important;
    background: transparent !important;
    color: var(--text-gray, #64748b) !important;
    cursor: pointer !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    margin: 0 !important;
    box-shadow: none !important;
    transition: background 0.15s ease, color 0.15s ease !important;
}

.att-page-num-btn:hover {
    background: rgba(0, 0, 0, 0.05) !important;
    color: var(--text-dark, #0f172a) !important;
}

.att-page-num-btn.active {
    background: var(--primary-blue, #1e5eff) !important;
    color: #ffffff !important;
    font-weight: 700 !important;
}

body.dark-theme .att-page-num-btn,
body.dark-mode .att-page-num-btn {
    color: #94a3b8 !important;
    background: transparent !important;
}
body.dark-theme .att-page-num-btn:hover,
body.dark-mode .att-page-num-btn:hover {
    background: rgba(255, 255, 255, 0.08) !important;
    color: #ffffff !important;
}
body.dark-theme .att-page-num-btn.active,
body.dark-mode .att-page-num-btn.active {
    background: var(--primary-blue, #1e5eff) !important;
    color: #ffffff !important;
}

.att-analytics-kpi-card {
    background: #f8fafc;
    border: 1px solid var(--border-color, #e2e8f0);
    border-radius: 12px;
    padding: 16px 18px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.att-analytics-kpi-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.att-analytics-kpi-card .kpi-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    color: var(--text-gray, #64748b);
    margin-bottom: 4px;
}

.att-analytics-kpi-card .kpi-value {
    font-size: 22px;
    font-weight: 800;
    line-height: 1.15;
    margin-bottom: 4px;
}

.att-analytics-kpi-card .kpi-subtext {
    font-size: 11.5px;
    color: var(--text-gray, #94a3b8);
}

.att-chart-container-card {
    background: var(--card-bg, #ffffff);
    border: 1px solid var(--border-color, #e2e8f0);
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.02);
}

.att-risk-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 11.5px;
    font-weight: 700;
    white-space: nowrap;
}

.att-risk-badge.risk-high {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.25);
}

.att-risk-badge.risk-medium {
    background: rgba(245, 158, 11, 0.1);
    color: #d97706;
    border: 1px solid rgba(245, 158, 11, 0.25);
}

.att-risk-badge.risk-low {
    background: rgba(16, 185, 129, 0.1);
    color: #059669;
    border: 1px solid rgba(16, 185, 129, 0.25);
}

.att-progress-bar-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
}

.att-progress-bar-track {
    flex: 1;
    height: 7px;
    border-radius: 4px;
    background: #e2e8f0;
    overflow: hidden;
}

.att-progress-bar-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.3s ease;
}

@media (max-width: 900px) {
    .att-analytics-dual-grid {
        grid-template-columns: 1fr !important;
    }
}

/* ==========================================================================
   PRIMARY ACTION RED BUTTONS & TACTILE MICRO-ANIMATIONS
   ========================================================================== */
.btn-primary-red,
#loadDirectStudentsBtn,
#saveCustomPointBtn,
#btnCreateNoticeDashboard,
#registerStudentBtn,
#postNewsBtn,
#createTeacherBtn,
#btnToggleClassesTable:not(.table-hidden-state),
#btnToggleSubjectsTable:not(.table-hidden-state),
#uploadBulkStudentsBtn,
#btnToggleBehaviorCharts:not(.diagram-hidden-state),
#btnSaveAllScripts {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%) !important;
    color: #ffffff !important;
    border: none !important;
    border-radius: 8px !important;
    font-weight: 700 !important;
    font-size: 13.5px !important;
    letter-spacing: 0.01em !important;
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.28) !important;
    cursor: pointer !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 7px !important;
    outline: none !important;
    user-select: none !important;
    text-decoration: none !important;
    transition: transform 0.16s cubic-bezier(0.34, 1.56, 0.64, 1), 
                box-shadow 0.16s ease, 
                background 0.16s ease, 
                filter 0.16s ease,
                color 0.16s ease !important;
    transform: translateY(0) scale(1);
    -webkit-font-smoothing: antialiased;
}

.btn-primary-red svg,
#loadDirectStudentsBtn svg,
#saveCustomPointBtn svg,
#btnCreateNoticeDashboard svg,
#registerStudentBtn svg,
#postNewsBtn svg,
#createTeacherBtn svg,
#btnToggleClassesTable svg,
#btnToggleSubjectsTable svg,
#uploadBulkStudentsBtn svg,
#btnToggleBehaviorCharts svg,
#btnSaveAllScripts svg {
    color: #ffffff !important;
    stroke: #ffffff !important;
    transition: transform 0.16s ease;
}

/* Hover Micro-Animation: Smooth lift up + vibrant glow */
.btn-primary-red:hover,
#loadDirectStudentsBtn:hover,
#saveCustomPointBtn:hover,
#btnCreateNoticeDashboard:hover,
#registerStudentBtn:hover,
#postNewsBtn:hover,
#createTeacherBtn:hover,
#btnToggleClassesTable:not(.table-hidden-state):hover,
#btnToggleSubjectsTable:not(.table-hidden-state):hover,
#uploadBulkStudentsBtn:hover,
#btnToggleBehaviorCharts:not(.diagram-hidden-state):hover,
#btnSaveAllScripts:hover {
    background: linear-gradient(135deg, #f87171 0%, #ef4444 100%) !important;
    color: #ffffff !important;
    transform: translateY(-2px) scale(1.02) !important;
    box-shadow: 0 6px 18px rgba(239, 68, 68, 0.42) !important;
    filter: brightness(1.04) !important;
}

.btn-primary-red:hover svg,
#loadDirectStudentsBtn:hover svg,
#saveCustomPointBtn:hover svg,
#btnCreateNoticeDashboard:hover svg,
#registerStudentBtn:hover svg,
#postNewsBtn:hover svg,
#createTeacherBtn:hover svg,
#btnToggleClassesTable:hover svg,
#btnToggleSubjectsTable:hover svg,
#uploadBulkStudentsBtn:hover svg,
#btnToggleBehaviorCharts:hover svg,
#btnSaveAllScripts:hover svg {
    transform: scale(1.08);
}

/* Click / Active Micro-Animation: Tactile depression + pressed shadow */
.btn-primary-red:active,
#loadDirectStudentsBtn:active,
#saveCustomPointBtn:active,
#btnCreateNoticeDashboard:active,
#registerStudentBtn:active,
#postNewsBtn:active,
#createTeacherBtn:active,
#btnToggleClassesTable:not(.table-hidden-state):active,
#btnToggleSubjectsTable:not(.table-hidden-state):active,
#uploadBulkStudentsBtn:active,
#btnToggleBehaviorCharts:not(.diagram-hidden-state):active,
#btnSaveAllScripts:active {
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%) !important;
    color: #ffffff !important;
    transform: translateY(1px) scale(0.96) !important;
    box-shadow: 0 1px 4px rgba(239, 68, 68, 0.3) !important;
    filter: brightness(0.92) !important;
}

/* Focused Accessible Ring */
.btn-primary-red:focus-visible,
#loadDirectStudentsBtn:focus-visible,
#saveCustomPointBtn:focus-visible,
#btnCreateNoticeDashboard:focus-visible,
#registerStudentBtn:focus-visible,
#postNewsBtn:focus-visible,
#createTeacherBtn:focus-visible,
#btnToggleClassesTable:focus-visible,
#btnToggleSubjectsTable:focus-visible,
#uploadBulkStudentsBtn:focus-visible,
#btnToggleBehaviorCharts:focus-visible,
#btnSaveAllScripts:focus-visible {
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.4), 0 2px 8px rgba(239, 68, 68, 0.28) !important;
}

/* Disabled State */
.btn-primary-red:disabled,
#loadDirectStudentsBtn:disabled,
#saveCustomPointBtn:disabled,
#btnCreateNoticeDashboard:disabled,
#registerStudentBtn:disabled,
#postNewsBtn:disabled,
#createTeacherBtn:disabled,
#btnToggleClassesTable:disabled,
#btnToggleSubjectsTable:disabled,
#uploadBulkStudentsBtn:disabled,
#btnToggleBehaviorCharts:disabled,
#btnSaveAllScripts:disabled {
    opacity: 0.6 !important;
    cursor: not-allowed !important;
    transform: none !important;
    box-shadow: none !important;
}

/* ======================================================
   MAINTENANCE CONTROL & TOGGLE SWITCH STYLING
   ====================================================== */
.custom-switch {
    position: relative;
    display: inline-block;
    width: 54px;
    height: 28px;
}

.custom-switch input {
    opacity: 0 !important;
    width: 0 !important;
    height: 0 !important;
    margin: 0 !important;
}

.switch-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #cbd5e1;
    transition: .3s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 28px;
}

.switch-slider:before {
    position: absolute;
    content: "";
    height: 22px;
    width: 22px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .3s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 50%;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.25);
}

.custom-switch input:checked + .switch-slider {
    background-color: #ef4444;
    box-shadow: 0 0 12px rgba(239, 68, 68, 0.4);
}

.custom-switch input:checked + .switch-slider:before {
    transform: translateX(26px);
}


/* Inline database submenu in the mobile navigation. */
.mobile-db-submenu[hidden] { display: none !important; }
.mobile-db-submenu { margin-left: 20px; padding-left: 8px; border-left: 1px solid var(--border-color, #e2e8f0); }
.mobile-db-submenu .kebab-item { min-height: 44px; }
.mobile-db-arrow { margin-left: auto; transition: transform 0.15s; }
#mobileMenuDatabases[aria-expanded="true"] .mobile-db-arrow { transform: rotate(180deg); }

#mobileTopbarDropdown a.kebab-item {
    font-weight: 700 !important;
}

#mobileMenuTools[aria-expanded="true"] .mobile-db-arrow { transform: rotate(180deg); }
#toolsSubmenu { min-width: 220px !important; }
#toolsSubmenu a { text-decoration: none; }

.quizzes-db-controls {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 10px;
    align-items: center;
}
.quizzes-db-controls > #searchQuizzesDb,
.quizzes-db-controls > #sortQuizzesDbSelect {
    width: 100% !important;
    min-width: 0 !important;
    max-width: none !important;
    margin: 0 !important;
    box-sizing: border-box;
}

.att-history-count { border: 0; border-radius: 8px; background: var(--input-bg); color: var(--primary-blue); font: inherit; font-weight: 700; text-decoration: underline; text-underline-offset: 3px; min-width: 44px; min-height: 44px; cursor: pointer; }
.student-att-dialog { width: min(680px, calc(100vw - 32px)); max-height: calc(100dvh - 40px); margin: auto; padding: 24px; border: 1px solid var(--border-color); border-radius: 20px; background: var(--card-bg); color: var(--text-dark); overflow-y: auto; box-sizing: border-box; }
.student-att-dialog::backdrop { background: rgba(8, 16, 35, .6); }
.student-att-header, .student-att-record-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.student-att-header h2 { margin: 0; font-size: 22px; }
.student-att-header p { margin: 6px 0 0; font-size: 14px; }
#closeStudentAttendance { background: var(--input-bg); border: 0; color: var(--text-dark); border-radius: 10px; min-width: 44px; height: 44px; font-size: 26px; cursor: pointer; }
.student-att-scope { color: var(--text-gray); font-size: 12px; margin: 16px 0; }
.student-att-summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin-bottom: 18px; }
.student-att-summary > div { padding: 12px 8px; border-radius: 10px; background: var(--input-bg); text-align: center; }
.student-att-summary strong, .student-att-summary span { display: block; }
.student-att-summary strong { font-size: 22px; }
.student-att-summary span { font-size: 12px; color: var(--text-gray); }
.student-att-record { border: 1px solid var(--border-color); border-radius: 12px; padding: 16px; margin-bottom: 10px; }
.student-att-record p { margin: 8px 0; font-size: 14px; overflow-wrap: anywhere; }
.student-att-class { font-weight: 600; }
.student-att-record small { color: var(--text-gray); }
.student-att-status { border-radius: 20px; padding: 4px 10px; font-size: 12px; font-weight: 700; background: var(--input-bg); }
.student-att-status.present { color: #047857; background: #d1fae5; }
.student-att-status.absent { color: #b91c1c; background: #fee2e2; }
.student-att-status.other { color: #92400e; background: #fef3c7; }
@media (max-width: 480px) { .student-att-dialog { padding: 16px; } .student-att-header h2 { font-size: 20px; } }

#btnDeployAttendanceSession {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 0 18px !important;
    height: 38px !important;
    min-height: 38px !important;
    line-height: normal !important;
    text-align: center !important;
}
#btnDeployAttendanceSession > span {
    display: block !important;
    margin: 0 !important;
    padding: 0 !important;
    line-height: 1 !important;
}

/* Split-button children must stay flush with their fixed-height container. */
#btnDeployAttendanceSession,
#btnAttendanceMenuToggle {
    margin: 0 !important;
}
