:root {
    /* COMPANY PALETTE: Navy #123249 + Gold #fcc100 */
    --navy: #123249;
    --gold: #fcc100;
    --gold-hover: #ffcf33;
    --on-gold: #123249;
    /* Text color used on top of gold fills */

    /* Core Brand (text / icon / border accents) */
    --brand-primary: #fcc100;
    --brand-secondary: #6fb1e0;
    /* Soft steel blue derived from navy */
    --brand-accent: #fcc100;

    /* Semantic status colors */
    --success: #22c55e;
    --status-active-text: #22c55e;
    --status-waiting-text: #ef4444;
    --status-coming-text: #f97316;

    /* Backgrounds (Dark Default) */
    --bg-app: #0a1d2b;
    --bg-main: #0a1d2b;
    --bg-sidebar: #0e2638;
    --bg-card: #123249;
    --bg-input: #0c2333;
    --bg-surface-elevated: #0c2333;
    --bg-hover: rgba(255, 255, 255, 0.04);

    /* Text */
    --text-primary: #ffffff;
    --text-secondary: #a9bccb;
    --text-muted: #6f8799;

    /* UI Borders & Effects */
    --border-color: rgba(255, 255, 255, 0.1);
    --border-subtle: rgba(255, 255, 255, 0.08);
    --border-hover: rgba(252, 193, 0, 0.55);
    /* Brand hover border */
    --glass-shine: rgba(255, 255, 255, 0.05);
    --shadow-sm: 0 4px 16px rgba(0, 0, 0, 0.18);
    --shadow-lg: 0 20px 50px rgba(0, 0, 0, 0.45);

    /* Spacing & Radius */
    --radius-sm: 8px;
    --radius-md: 12px;
    --border-radius: 12px;
    --radius-lg: 20px;

    --font-family: 'Outfit', sans-serif;
}

[data-theme="light"] {
    /* Darker gold & blue keep accent text readable on white */
    --brand-primary: #b38600;
    --brand-secondary: #1f6496;

    --status-active-text: #16a34a;
    --status-waiting-text: #dc2626;
    --status-coming-text: #ea580c;

    --bg-app: #f3f6f9;
    --bg-main: #f3f6f9;
    /* Cool neutral */
    --bg-sidebar: #123249;
    /* Company Navy Sidebar (High Contrast) */
    --bg-card: #ffffff;
    --bg-input: #f5f7fa;
    --bg-surface-elevated: #f5f7fa;
    --bg-hover: rgba(18, 50, 73, 0.04);

    --text-primary: #123249;
    /* Navy text for content */
    --text-secondary: #4a6274;
    --text-muted: #7a8d9c;
    --glass-shine: rgba(18, 50, 73, 0.04);
    --shadow-sm: 0 4px 16px rgba(18, 50, 73, 0.08);
    --shadow-lg: 0 12px 32px rgba(18, 50, 73, 0.12);

    /* Sidebar text override for light mode (since sidebar is dark) */
    --sidebar-text: #ffffff;
    --sidebar-text-muted: #94a3b8;

    --border-color: #e2e8f0;
    --border-subtle: #e2e8f0;
    --border-hover: #fcc100;
}

/* RESET */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: var(--font-family);
}

.hidden {
    display: none !important;
}

body {
    background-color: var(--bg-app);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    overflow-y: auto;
    /* Dynamic Mesh Gradient */
    background-image:
        radial-gradient(circle at 15% 50%, rgba(252, 193, 0, 0.08) 0%, transparent 25%),
        radial-gradient(circle at 85% 30%, rgba(111, 177, 224, 0.08) 0%, transparent 25%);
    transition: background-color 0.3s ease;
}

/* LAYOUT */
.app-layout {
    display: flex;
    height: 100vh;
    width: 100vw;
    overflow: hidden;
}

/* ------------------------------------------- */
/* SIDEBAR - SHARP & DYNAMIC */
/* ------------------------------------------- */
.sidebar {
    width: 280px;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    padding: 1.5rem;
    position: relative;
    transition: width 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 100;
    color: var(--text-primary);
    /* Default */
}

[data-theme="light"] .sidebar {
    color: var(--sidebar-text);
    /* Force white text in light mode sidebar */
}

/* Standard Collapsed Width */
/* When sidebar is collapsed */
.sidebar.collapsed {
    width: 60px;
    /* thinner */
    padding: 1.5rem 0.5rem;
}

.sidebar-header {
    display: flex;
    align-items: center;
    /* Vertical alignment */
    /* Logo on the left, button right after it */
    gap: 12px;
    margin-bottom: 2rem;
    height: 64px;
    /* SaaS standard height */
    padding: 0 1rem;
    justify-content: flex-start;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    /* Small gap between icon and text */
    overflow: hidden;
    white-space: nowrap;
    cursor: pointer;
    transition: opacity 0.2s ease;
}

.logo:hover {
    opacity: 0.9;
}

.logo-img {
    height: 32px;
    /* SAE standard height – clean & professional */
    width: auto;
    object-fit: contain;
    border-radius: 6px;
    filter: drop-shadow(0 0 8px rgba(252, 193, 0, 0.3));
}

.logo h1 {
    font-size: 20px;
    /* SaaS standard logo size */
    font-weight: 600;
    /* Bold but professional */
    letter-spacing: 0.3px;
    color: var(--text-primary);
}

.sidebar .logo h1 {
    color: #ffffff;
}

/* Ensure the toggle button stays visible and centered */
.sidebar-toggle-btn {
    position: relative;
    width: 32px;
    height: 32px;
    font-size: 1.5rem;
    background: transparent;
    border: 1px solid transparent;
    color: var(--text-secondary);
    cursor: pointer;

    display: flex;
    align-items: center;
    justify-content: center;

    border-radius: var(--radius-sm);
    transition: all 0.2s ease;
    z-index: 102;
}

.sidebar-toggle-btn:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--gold);
    border-color: var(--border-color);
}

/* Hide logo and all textual elements in collapsed state */
.sidebar.collapsed .logo h1,
.sidebar.collapsed .logo img,
.sidebar.collapsed .logo {
    display: none !important;
}

.sidebar.collapsed .nav-section h3,
.sidebar.collapsed .user-info,
.sidebar.collapsed .role,
.sidebar.collapsed .name {
    display: none !important;
}

.sidebar.collapsed .nav-item {
    font-size: 0 !important;
    gap: 0;
    justify-content: center;
}

.sidebar.collapsed .nav-item .icon {
    font-size: 1.25rem !important;
}

/* Center the toggle button when collapsed (takes logo's place) */
.sidebar.collapsed .sidebar-header {
    justify-content: center;
    padding: 0;
}

.sidebar.collapsed .sidebar-toggle-btn {
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.05);
}

.sidebar.collapsed .sidebar-toggle-btn:hover {
    background: var(--gold);
    color: var(--on-gold);
}

/* NAVIGATION */
.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

/* Hide scrollbar */
.sidebar-nav::-webkit-scrollbar {
    display: none;
}

.nav-section h3 {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    font-weight: 700;
    color: var(--text-muted);
    margin: 1.5rem 0 0.75rem 1rem;
    opacity: 1;
    transition: opacity 0.3s;
}

[data-theme="light"] .nav-section h3 {
    color: rgba(255, 255, 255, 0.5);
}

.sidebar.collapsed .nav-section h3 {
    opacity: 0;
    height: 0;
    margin: 0;
    overflow: hidden;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.8rem 1rem;
    text-decoration: none;
    color: var(--text-secondary);
    border-radius: var(--radius-md);
    font-weight: 500;
    transition: all 0.2s;
    position: relative;
    border: 1px solid transparent;
}

[data-theme="light"] .nav-item {
    color: rgba(255, 255, 255, 0.8);
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--gold);
    border-color: var(--border-color);
}

.nav-item.active {
    background: linear-gradient(90deg, rgba(252, 193, 0, 0.18), transparent);
    color: var(--gold);
    border: 1px solid rgba(252, 193, 0, 0.3);
    box-shadow: inset 3px 0 0 var(--gold);
}

.nav-item .icon {
    font-size: 1.25rem;
    min-width: 1.5rem;
    text-align: center;
}

/* Collapsed Nav Items */
.sidebar.collapsed .nav-item {
    justify-content: center;
    padding: 0.8rem 0;
}

.sidebar.collapsed .nav-item span:not(.icon) {
    display: none;
}

/* User Profile */
.user-profile {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
    margin-top: auto;
}

.avatar {
    width: 40px;
    height: 40px;
    background: var(--brand-accent);
    color: var(--on-gold);
    font-weight: 700;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidebar.collapsed .user-info {
    display: none;
}

.sidebar.collapsed .user-profile {
    justify-content: center;
    border-top: none;
    padding-top: 1rem;
}

/* ------------------------------------------- */
/* MAIN CONTENT - CARDS & GRID */
/* ------------------------------------------- */
.main-content {
    flex: 1;
    min-height: 0;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

/* Header */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding: 0 0.5rem;
}

.page-header h2 {
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: -1px;
    background: linear-gradient(135deg, var(--text-primary), var(--text-secondary));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Action Bar */
.theme-toggle-btn {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 1.2rem;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

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

/* Content Card */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 24px;
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.3);
}

#group-profile-view,
#finance-view,
#teachers-view {
    overflow-y: auto !important;
    overflow-x: hidden !important;
}

#group-profile-view > *,
#finance-view > *,
#teachers-view > * {
    flex-shrink: 0;
}

#group-profile-view .card {
    flex: none !important;
    min-height: auto !important;
    height: auto !important;
    overflow: visible !important;
}

#group-profile-view .att-matrix-wrapper,
#group-profile-view .table-container,
#finance-view .table-container,
#teachers-view .table-container {
    flex: none !important;
    min-height: auto !important;
    overflow-x: auto !important;
    overflow-y: visible !important;
}

.filter-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    padding: 0 2rem 1rem 2rem;
}

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

.card.hidden {
    display: none;
}

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

.card-header h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.search-bar input {
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    padding: 0.8rem 1.2rem;
    border-radius: var(--radius-md);
    color: var(--text-primary);
    width: 300px;
    font-size: 0.9rem;
    transition: 0.3s;
}

.search-bar input:focus {
    border-color: var(--brand-primary);
    outline: none;
    box-shadow: 0 0 0 4px rgba(252, 193, 0, 0.1);
}

/* Table Area */
.table-container {
    flex: 1;
    min-height: 0;
    overflow: auto;
    position: relative;
    padding: 0;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 800px;
    /* Prevent crunch */
}

.data-table th {
    text-align: left;
    padding: 1.2rem 1.5rem;
    color: var(--text-muted);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-card);
    position: sticky;
    top: 0;
    z-index: 10;
}

.data-table td {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
    font-size: 0.95rem;
}

.data-table tr:hover td {
    background: var(--glass-shine);
}

/* STATUS TAGS */
.status-select {
    padding: 6px 12px;
    border-radius: 20px;
    border: 1px solid var(--border-color);
    font-size: 0.8rem;
    font-weight: 700;
    text-align: center;
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    cursor: pointer;
}

/* We can add dynamic classes or just let intrinsic styling work, 
   but for "Sharpness" let's add border logic on focus */
.status-select:focus {
    border-color: var(--brand-secondary);
    outline: none;
}

/* Distinct Status Badges / Colors:
   WAITING = Red, COMING = Orange, ATTEND = Blue, ACTIVE = Green */
.status-waiting {
    background: rgba(239, 68, 68, 0.15) !important;
    color: #ef4444 !important;
    border-color: rgba(239, 68, 68, 0.45) !important;
}

.status-coming {
    background: rgba(249, 115, 22, 0.15) !important;
    color: #f97316 !important;
    border-color: rgba(249, 115, 22, 0.45) !important;
}

.status-attend {
    background: rgba(59, 130, 246, 0.15) !important;
    color: #3b82f6 !important;
    border-color: rgba(59, 130, 246, 0.45) !important;
}

.status-active {
    background: rgba(34, 197, 94, 0.15) !important;
    color: #22c55e !important;
    border-color: rgba(34, 197, 94, 0.45) !important;
}

.status-archived {
    background: rgba(148, 163, 184, 0.15) !important;
    color: #94a3b8 !important;
    border-color: rgba(148, 163, 184, 0.4) !important;
}

/* Light mode overrides for high-contrast accessibility */
[data-theme="light"] .status-waiting {
    background: #fee2e2 !important;
    color: #dc2626 !important;
    border-color: #fca5a5 !important;
}

[data-theme="light"] .status-coming {
    background: #ffedd5 !important;
    color: #ea580c !important;
    border-color: #fdba74 !important;
}

[data-theme="light"] .status-attend {
    background: #dbeafe !important;
    color: #1d4ed8 !important;
    border-color: #93c5fd !important;
}

[data-theme="light"] .status-active {
    background: #dcfce7 !important;
    color: #15803d !important;
    border-color: #86efac !important;
}

[data-theme="light"] .status-archived {
    background: #f1f5f9 !important;
    color: #475569 !important;
    border-color: #cbd5e1 !important;
}

/* All Students Table: Row & Name Status Indicators */
.student-row.status-waiting td:first-child {
    border-left: 3px solid #ef4444 !important;
}
.student-row.status-coming td:first-child {
    border-left: 3px solid #f97316 !important;
}
.student-row.status-attend td:first-child {
    border-left: 3px solid #3b82f6 !important;
}
.student-row.status-active td:first-child {
    border-left: 3px solid #22c55e !important;
}

.status-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 7px;
    vertical-align: middle;
    flex-shrink: 0;
}
.status-dot.status-waiting {
    background: #ef4444 !important;
    box-shadow: 0 0 6px rgba(239, 68, 68, 0.6);
    border: none !important;
}
.status-dot.status-coming {
    background: #f97316 !important;
    box-shadow: 0 0 6px rgba(249, 115, 22, 0.6);
    border: none !important;
}
.status-dot.status-attend {
    background: #3b82f6 !important;
    box-shadow: 0 0 6px rgba(59, 130, 246, 0.6);
    border: none !important;
}
.status-dot.status-active {
    background: #22c55e !important;
    box-shadow: 0 0 6px rgba(34, 197, 94, 0.6);
    border: none !important;
}

/* Group Assignment Pill */
.badge-group {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 500;
    background: rgba(111, 177, 224, 0.1);
    color: var(--brand-secondary);
    border: 1px solid rgba(111, 177, 224, 0.3);
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s;
}

.badge-group:hover {
    background: rgba(111, 177, 224, 0.2);
    border-color: var(--brand-secondary);
}

.badge-group.unassigned {
    background: transparent;
    color: var(--text-muted);
    border-color: transparent;
    cursor: default;
}

/* BUTTONS */
.btn {
    padding: 0.8rem 1.5rem;
    border-radius: var(--radius-md);
    font-weight: 700;
    font-size: 0.9rem;
    cursor: pointer;
    border: none;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: transform 0.2s, box-shadow 0.2s;
}

.btn-primary {
    background: var(--gold);
    color: var(--on-gold);
    /* Navy text on gold button */
    box-shadow: 0 4px 15px rgba(252, 193, 0, 0.3);
}

.btn-primary:hover {
    background: var(--gold-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(252, 193, 0, 0.45);
}

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

.btn-secondary:hover {
    border-color: var(--text-primary);
    background: var(--glass-shine);
}

.btn-delete {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
    border: 1px solid transparent;
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
}

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

/* MODAL - Sharp & Centered */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    overflow-y: auto;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
}

.modal-overlay:not(.hidden) {
    opacity: 1;
    pointer-events: auto;
}

.modal,
.modal-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    width: 600px;
    max-width: 90vw;
    max-height: calc(100vh - 3rem);
    overflow-y: auto;
    margin: auto;
    border-radius: 24px;
    padding: 2.5rem;
    transform: scale(0.95);
    transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

.action-buttons {
    display: flex;
    gap: 0.5rem;
}

.icon-btn {
    border: none;
    background: transparent;
    cursor: pointer;
    padding: 6px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    transition: all 0.2s;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.icon-btn:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
}

.edit-btn:hover {
    color: var(--brand-secondary);
    background: rgba(111, 177, 224, 0.1);
}

.archive-btn:hover {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.1);
}

.restore-btn:hover {
    color: var(--brand-primary);
    background: rgba(252, 193, 0, 0.1);
}

.modal-overlay:not(.hidden) .modal,
.modal-overlay:not(.hidden) .modal-card {
    transform: scale(1);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 2rem;
    align-items: center;
}

.modal-header h3 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 600;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 12px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    outline: none;
}

.form-group input:focus {
    border-color: var(--brand-primary);
}

.form-row {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
}

.form-group.half {
    flex: 1;
}

.modal-footer {
    margin-top: 2rem;
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
}

/* UTILS */
.badge-level {
    padding: 4px 10px;
    border: 1px solid var(--border-color);
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}

.course-select {
    background: transparent;
    border: 1px solid transparent;
    color: var(--text-primary);
    padding: 0.3rem 0.5rem;
    border-radius: 6px;
    font-weight: 500;
    width: 100%;
    cursor: pointer;
}

.empty-state {
    padding: 4rem;
    text-align: center;
    color: var(--text-muted);
}

.close-modal {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
}

.close-modal:hover {
    color: var(--brand-primary);
}

/* Day Switcher */
.day-switcher {
    display: flex;
    background: var(--bg-input);
    padding: 4px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

.day-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 6px 16px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: all 0.2s;
}

.day-btn.active {
    background: var(--bg-card);
    color: var(--brand-primary);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.day-btn:hover:not(.active) {
    color: var(--text-primary);
}

/* ==================================================== */
/* CLASSROOM MANAGEMENT: STRUCTURED TIMETABLE GRID     */
/* ==================================================== */
.data-table.class-grid {
    table-layout: fixed;
    width: 100%;
    min-width: 960px;
    border-collapse: separate;
    border-spacing: 0;
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    border-radius: var(--border-radius);
    overflow: hidden;
}

.data-table.class-grid thead th {
    position: sticky;
    top: 0;
    z-index: 10;
    background: var(--bg-card);
    padding: 0.75rem 0.5rem;
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    text-align: center;
    color: var(--text-primary);
    border-bottom: 2px solid var(--border-color);
    border-right: 1px solid var(--border-color);
    box-sizing: border-box;
}

.data-table.class-grid thead th:first-child {
    width: 90px;
    min-width: 90px;
    max-width: 90px;
    border-right: 2px solid var(--border-color);
    color: var(--text-muted);
}

.data-table.class-grid thead th:not(:first-child) {
    width: calc((100% - 90px) / 6);
    min-width: 140px;
}

.data-table.class-grid thead th:last-child {
    border-right: none;
}

.data-table.class-grid tbody tr {
    height: 48px;
}

.data-table.class-grid tbody td {
    padding: 0;
    height: 48px;
    border-bottom: 1px solid var(--border-color);
    border-right: 1px solid var(--border-color);
    vertical-align: top;
    position: relative;
    box-sizing: border-box;
}

.data-table.class-grid tbody td:first-child {
    width: 90px;
    min-width: 90px;
    max-width: 90px;
    text-align: center;
    vertical-align: middle;
    font-weight: 600;
    font-size: 0.78rem;
    color: var(--text-muted);
    background: var(--bg-card);
    border-right: 2px solid var(--border-color);
    padding: 0 0.5rem;
    user-select: none;
}

.data-table.class-grid tbody td:last-child {
    border-right: none;
}

.data-table.class-grid tbody tr:last-child td {
    border-bottom: none;
}

/* Empty cell slot */
.data-table.class-grid .empty-grid-cell {
    width: 100%;
    height: 100%;
    min-height: 48px;
    background: transparent;
    transition: background 0.15s ease;
}

.data-table.class-grid td.empty-grid-cell:hover {
    background: rgba(255, 255, 255, 0.03);
}

/* Booked lesson slot in classroom grid */
.data-table.class-grid .booked-cell {
    padding: 6px 8px !important;
    background: rgba(252, 193, 0, 0.08) !important;
    border: 1px solid rgba(252, 193, 0, 0.35) !important;
    border-left: 4px solid var(--brand-primary) !important;
    border-radius: 4px;
    vertical-align: top;
    box-sizing: border-box;
    transition: background 0.2s ease, box-shadow 0.2s ease;
}

.data-table.class-grid .booked-cell:hover {
    transform: none; /* Avoid table cell border distortion */
    background: rgba(252, 193, 0, 0.16) !important;
    box-shadow: inset 0 0 0 1px var(--brand-primary), 0 4px 12px rgba(0, 0, 0, 0.18);
    z-index: 5;
}

.data-table.class-grid .booked-name {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--brand-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.data-table.class-grid .booked-teacher {
    font-size: 0.72rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 0.25rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 1px;
}

.data-table.class-grid .booked-details {
    font-size: 0.7rem;
    color: var(--text-muted);
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* Height fix for modal inputs */
input,
select {
    font-family: var(--font-family);
}

/* Popover Tooltip */
.phone-wrapper {
    position: relative;
    display: inline-block;
    cursor: pointer;
}

.phone-wrapper .popover-tooltip {
    visibility: hidden;
    opacity: 0;
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(10px);
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    padding: 1rem;
    border-radius: var(--radius-md);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    z-index: 50;
    min-width: 200px;
    width: max-content;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    pointer-events: none;
    text-align: left;
}

.phone-wrapper:hover .popover-tooltip {
    visibility: visible;
    opacity: 1;
    transform: translateX(-50%) translateY(-10px);
    pointer-events: auto;
}

/* Arrow for tooltip */
.phone-wrapper .popover-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -6px;
    border-width: 6px;
    border-style: solid;
    border-color: var(--border-color) transparent transparent transparent;
}

.popover-tooltip strong {
    display: block;
    color: var(--text-muted);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
}

.popover-tooltip a {
    color: var(--brand-secondary);
    text-decoration: none;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* FILTER SELECTS */
.filter-select {
    padding: 0.6rem 1rem;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 0.85rem;
    cursor: pointer;
    min-width: 140px;
    transition: 0.2s;
}

.filter-select:hover {
    border-color: var(--border-hover);
}

.filter-select:focus {
    border-color: var(--brand-primary);
    outline: none;
    box-shadow: 0 0 0 3px rgba(252, 193, 0, 0.1);
}

.popover-tooltip a:hover {
    text-decoration: underline;
}

/* Booked Cell Enhanced Interactive Styles */
.booked-cell {
    background: rgba(252, 193, 0, 0.1);
    border-left: 3px solid var(--brand-primary);
    padding: 8px;
    border-radius: 0 6px 6px 0;
    vertical-align: top;
    transition: all 0.2s ease;
}

.booked-cell:hover {
    transform: scale(1.02);
    box-shadow: 0 4px 12px rgba(252, 193, 0, 0.2);
    z-index: 5;
    background: rgba(252, 193, 0, 0.15);
}

.booked-info {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    height: 100%;
}

.booked-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
}

.booked-name {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.booked-students-count {
    font-size: 0.85rem;
    color: var(--text-muted);
    background: rgba(255, 255, 255, 0.1);
    padding: 2px 6px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.booked-teacher {
    font-size: 0.9rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 4px;
}

.booked-teacher i {
    font-size: 0.9rem;
    color: var(--brand-secondary);
}

.booked-progress {
    margin-top: auto;
    /* Push to bottom if space permits */
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.progress-bar {
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    overflow: hidden;
    width: 100%;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--gold), var(--gold-hover));
    border-radius: 3px;
    transition: width 0.5s ease;
}

.progress-text {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-align: right;
}

.booked-details {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-weight: 500;
    margin-top: -2px;
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    z-index: 9999;
    pointer-events: none;
}

.toast {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.85rem 1.25rem;
    border-radius: var(--radius-md);
    background: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4);
    font-size: 0.9rem;
    font-weight: 500;
    pointer-events: auto;
    animation: toastIn 0.3s cubic-bezier(0.16, 1, 0.3, 1), toastOut 0.3s cubic-bezier(0.16, 1, 0.3, 1) 2.7s forwards;
}

.toast.toast-success {
    border-color: rgba(34, 197, 94, 0.4);
}

.toast.toast-success i {
    color: var(--success);
    font-size: 1.2rem;
}

.toast.toast-error {
    border-color: rgba(239, 68, 68, 0.4);
}

.toast.toast-error i {
    color: #ef4444;
    font-size: 1.2rem;
}

.toast.toast-info {
    border-color: rgba(56, 189, 248, 0.4);
}

.toast.toast-info i {
    color: var(--brand-secondary);
    font-size: 1.2rem;
}

@keyframes toastIn {
    from {
        opacity: 0;
        transform: translateY(15px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes toastOut {
    from {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
    to {
        opacity: 0;
        transform: translateY(-10px) scale(0.95);
    }
}

/* Modal Form Option styling */
option {
    background: var(--bg-card);
    color: var(--text-primary);
}

/* ========================================== */
/* KPI DASHBOARD CARDS                        */
/* ========================================== */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.kpi-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1.2rem 1.4rem;
    display: flex;
    align-items: center;
    gap: 1.2rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    transition: transform 0.2s ease, border-color 0.2s ease;
}

.kpi-card:hover {
    transform: translateY(-2px);
    border-color: var(--border-hover);
}

.kpi-icon-wrapper {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    flex-shrink: 0;
}

.kpi-students .kpi-icon-wrapper {
    background: rgba(252, 193, 0, 0.12);
    color: var(--brand-primary);
    border: 1px solid rgba(252, 193, 0, 0.25);
}

.kpi-groups .kpi-icon-wrapper {
    background: rgba(111, 177, 224, 0.12);
    color: var(--brand-secondary);
    border: 1px solid rgba(111, 177, 224, 0.25);
}

.kpi-revenue .kpi-icon-wrapper {
    background: rgba(34, 197, 94, 0.12);
    color: var(--success);
    border: 1px solid rgba(34, 197, 94, 0.25);
}

.kpi-debtors .kpi-icon-wrapper {
    background: rgba(239, 68, 68, 0.12);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.25);
}

.kpi-info {
    display: flex;
    flex-direction: column;
}

.kpi-label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 0.2rem;
}

.kpi-value {
    font-size: 1.35rem;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: -0.5px;
}

.kpi-subtext {
    font-size: 0.72rem;
    color: var(--text-secondary);
    margin-top: 0.1rem;
}

/* ========================================== */
/* PAYMENT BADGES                             */
/* ========================================== */
.payment-badge,
.tuition-badge,
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 3px 8px;
    border-radius: 14px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: capitalize;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.2s;
}

.payment-badge:hover,
.tuition-badge:hover {
    filter: brightness(1.15);
}

.payment-paid,
.tuition-paid {
    background: rgba(34, 197, 94, 0.15);
    color: var(--success);
    border-color: rgba(34, 197, 94, 0.35);
}

.payment-pending,
.tuition-pending {
    background: rgba(245, 158, 11, 0.15);
    color: #f59e0b;
    border-color: rgba(245, 158, 11, 0.35);
}

.payment-partial,
.tuition-partial {
    background: rgba(56, 189, 248, 0.15);
    color: #38bdf8;
    border-color: rgba(56, 189, 248, 0.35);
}

.payment-overdue,
.tuition-overdue {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
    border-color: rgba(239, 68, 68, 0.35);
}

[data-theme="light"] .payment-paid,
[data-theme="light"] .tuition-paid {
    background: #dcfce7;
    color: #15803d;
    border-color: #86efac;
}

[data-theme="light"] .payment-partial,
[data-theme="light"] .tuition-partial {
    background: #e0f2fe;
    color: #0284c7;
    border-color: #7dd3fc;
}

[data-theme="light"] .payment-pending,
[data-theme="light"] .tuition-pending {
    background: #fef3c7;
    color: #b45309;
    border-color: #fcd34d;
}

[data-theme="light"] .payment-overdue {
    background: #fee2e2;
    color: #b91c1c;
    border-color: #fca5a5;
}

/* ========================================== */
/* STUDENT BALANCE & PRORATION STYLES         */
/* ========================================== */
.balance-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 3px 9px;
    border-radius: 14px;
    font-size: 0.78rem;
    font-weight: 700;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.balance-badge:hover {
    filter: brightness(1.12);
    transform: translateY(-1px);
}

.balance-positive {
    background: rgba(34, 197, 94, 0.15);
    color: #22c55e;
    border-color: rgba(34, 197, 94, 0.35);
}

.balance-zero {
    background: rgba(148, 163, 184, 0.15);
    color: var(--text-secondary);
    border-color: rgba(148, 163, 184, 0.3);
}

.balance-negative {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
    border-color: rgba(239, 68, 68, 0.35);
}

[data-theme="light"] .balance-positive {
    background: #dcfce7;
    color: #15803d;
    border-color: #86efac;
}

[data-theme="light"] .balance-zero {
    background: #f1f5f9;
    color: #64748b;
    border-color: #cbd5e1;
}

[data-theme="light"] .balance-negative {
    background: #fee2e2;
    color: #b91c1c;
    border-color: #fca5a5;
}

.att-matrix-pill.att-matrix-bonus,
.badge-bonus {
    background: linear-gradient(135deg, #a855f7 0%, #ec4899 100%) !important;
    color: #ffffff !important;
    font-weight: 700;
    box-shadow: 0 0 8px rgba(168, 85, 247, 0.4);
    border: none !important;
}

.proration-hint-card {
    background: linear-gradient(135deg, rgba(56, 189, 248, 0.12) 0%, rgba(99, 102, 241, 0.12) 100%);
    border: 1px solid rgba(56, 189, 248, 0.35);
    border-radius: var(--radius-md);
    padding: 0.85rem 1rem;
    margin-bottom: 1rem;
}

.proration-hint-card .proration-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-weight: 700;
    color: var(--brand-primary);
    font-size: 0.88rem;
    margin-bottom: 0.35rem;
}

.proration-hint-card .proration-body {
    font-size: 0.82rem;
    color: var(--text-secondary);
    line-height: 1.45;
}

.proration-hint-card .proration-actions {
    margin-top: 0.65rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.balance-summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 0.75rem;
}

.balance-stat-card {
    padding: 0.75rem;
    border-radius: var(--radius-sm);
    background: var(--bg-hover);
    border: 1px solid var(--border-color);
}

.balance-stat-card .stat-label {
    font-size: 0.72rem;
    color: var(--text-muted);
    text-transform: uppercase;
    font-weight: 600;
}

.balance-stat-card .stat-value {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-top: 0.2rem;
}

/* ========================================== */
/* ATTENDANCE TOGGLE BUTTONS                  */
/* ========================================== */
.attendance-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.65rem 0.75rem;
    border-bottom: 1px solid var(--border-color);
}

.attendance-row:hover {
    background: var(--glass-shine);
}

.attendance-toggles {
    display: flex;
    gap: 0.35rem;
}

.att-btn {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: var(--bg-input);
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.att-btn:hover {
    border-color: var(--text-primary);
}

.att-btn.active-P {
    background: var(--success);
    color: var(--on-gold);
    border-color: var(--success);
}

.att-btn.active-L {
    background: #f59e0b;
    color: var(--on-gold);
    border-color: #f59e0b;
}

.att-btn.active-E {
    background: #38bdf8;
    color: var(--on-gold);
    border-color: #38bdf8;
}

.att-btn.active-A {
    background: #ef4444;
    color: #ffffff;
    border-color: #ef4444;
}

/* ========================================== */
/* MODAL TABS                                 */
/* ========================================== */
.modal-tabs {
    display: flex;
    gap: 0.5rem;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 1.5rem;
}

.modal-tab-btn {
    background: transparent;
    border: none;
    padding: 0.6rem 1.2rem;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
}

.modal-tab-btn:hover {
    color: var(--text-primary);
}

.modal-tab-btn.active {
    color: var(--brand-primary);
    border-bottom-color: var(--brand-primary);
}

.tab-pane {
    display: none;
}

.tab-pane.active {
    display: block;
}

/* ========================================== */
/* MINI TABLES (For Receipts & Logs)          */
/* ========================================== */
.mini-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.mini-table th {
    text-align: left;
    padding: 0.6rem 0.75rem;
    color: var(--text-muted);
    font-size: 0.75rem;
    text-transform: uppercase;
    border-bottom: 1px solid var(--border-color);
}

.mini-table td {
    padding: 0.6rem 0.75rem;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
}

.mini-table tr:hover td {
    background: var(--glass-shine);
}

/* Student Profile 360 Header */
.student-360-header {
    display: flex;
    align-items: center;
    gap: 1.2rem;
    margin-bottom: 1.5rem;
}

.student-360-avatar {
    width: 60px;
    height: 60px;
    border-radius: 16px;
    background: var(--gold);
    color: var(--on-gold);
    font-weight: 800;
    font-size: 1.4rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.student-360-title h2 {
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: 0.2rem;
}

.student-360-meta {
    display: flex;
    gap: 0.6rem;
    align-items: center;
    flex-wrap: wrap;
}

/* ========================================== */
/* GROUP LESSON & PAYMENT CALENDAR POPUP      */
/* ========================================== */
.cal-dates-track {
    display: flex;
    gap: 0.5rem;
    overflow-x: auto;
    padding-bottom: 0.5rem;
}

.cal-date-bubble {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 0.4rem 0.6rem;
    min-width: 54px;
    border-radius: var(--radius-sm);
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    flex-shrink: 0;
    text-align: center;
    transition: all 0.2s;
}

.cal-date-bubble.today {
    border-color: var(--brand-primary);
    box-shadow: 0 0 10px rgba(252, 193, 0, 0.3);
}

.cal-date-num {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
}

.cal-date-day {
    font-size: 0.65rem;
    text-transform: uppercase;
    color: var(--text-muted);
    font-weight: 600;
}

.cal-date-lesson-tag {
    font-size: 0.65rem;
    color: var(--brand-secondary);
    font-weight: 600;
    margin-top: 2px;
}

/* ========================================== */
/* FEATURE 2: THERMAL ROLL RECEIPT (80mm/58mm)*/
/* ========================================== */
.receipt-modal-box {
    background: var(--bg-card);
}

.receipt-lang-btn.active,
.cd-receipt-lang-btn.active {
    background: var(--brand-primary) !important;
    color: #0f172a !important;
    border-color: var(--brand-primary) !important;
    font-weight: 700;
}

.thermal-receipt-stage {
    display: flex;
    justify-content: center;
    background: rgba(15, 23, 42, 0.35);
    padding: 1.1rem 0.75rem;
    border-radius: var(--radius-md);
    border: 1px dashed var(--border-color);
}

.thermal-receipt {
    background: #ffffff;
    color: #000000;
    width: 302px; /* ~80mm thermal paper roll width (72-76mm printable area) */
    max-width: 100%;
    padding: 14px 14px 16px 14px;
    border: 1px solid #cbd5e1;
    border-top: 3px dashed #cbd5e1;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.18);
    font-family: 'Courier New', Courier, monospace, sans-serif;
    font-size: 12px;
    line-height: 1.38;
}

.thermal-receipt[data-roll="58mm"] {
    width: 218px; /* 58mm thermal roll width */
    padding: 10px 9px 12px 9px;
    font-size: 10.5px;
}

.thermal-header {
    text-align: center;
    margin-bottom: 6px;
}

.thermal-logo {
    width: 40px;
    height: 40px;
    object-fit: contain;
    margin: 0 auto 4px auto;
    display: block;
    filter: grayscale(100%) contrast(140%);
}

.thermal-brand-name {
    font-family: 'Outfit', sans-serif;
    font-size: 16px;
    font-weight: 900;
    letter-spacing: 0.04em;
    color: #000000;
}

.thermal-subtitle {
    font-size: 10.5px;
    font-weight: 800;
    text-transform: uppercase;
    color: #000000;
    margin: 2px 0;
}

.thermal-contact {
    font-size: 10px;
    color: #111111;
}

.thermal-divider {
    border-top: 1px dashed #000000;
    margin: 7px 0;
}

.thermal-divider-double {
    border-top: 2px dashed #000000;
    margin: 8px 0;
}

.thermal-meta {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.thermal-status-pill {
    text-align: center;
    font-weight: 900;
    font-size: 11px;
    border: 1.5px solid #000000;
    padding: 2px 6px;
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.thermal-section-title {
    font-weight: 900;
    font-size: 10.5px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 4px;
    text-decoration: underline;
    color: #000000;
}

.thermal-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 6px;
    margin-bottom: 3px;
    color: #000000;
}

.thermal-row span:first-child {
    flex-shrink: 0;
    color: #111111;
}

.thermal-row strong,
.thermal-row span:last-child {
    text-align: right;
    word-break: break-word;
    color: #000000;
}

.thermal-total-box {
    text-align: center;
    padding: 4px 0;
}

.thermal-total-label {
    font-size: 10.5px;
    font-weight: 800;
    text-transform: uppercase;
    color: #000000;
}

.thermal-total-amount {
    font-family: 'Outfit', sans-serif;
    font-size: 19px;
    font-weight: 900;
    color: #000000;
    margin-top: 2px;
}

.thermal-signatures {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin: 8px 0;
    font-size: 10.5px;
}

.thermal-sig-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 4px;
}

.thermal-sig-dots {
    font-weight: 700;
    letter-spacing: -0.5px;
}

.thermal-footer-note {
    text-align: center;
    font-size: 10px;
    font-weight: 600;
    margin-top: 8px;
    line-height: 1.35;
    color: #000000;
}

.thermal-barcode {
    text-align: center;
    font-family: monospace;
    font-size: 14px;
    font-weight: 900;
    letter-spacing: 1px;
    margin-top: 8px;
    color: #000000;
}

.thermal-watermark {
    text-align: center;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin-top: 4px;
    color: #222222;
}

/* Standard Document Print Setup (auto / A4 register tables) */
@page {
    size: auto;
    margin: 8mm;
}

@media print {
    html,
    body {
        background: #ffffff !important;
        color: #000000 !important;
        padding: 0 !important;
        margin: 0 !important;
        width: auto !important;
    }

    .sidebar,
    .page-header,
    .main-content,
    .toast-container,
    .no-print,
    .modal-overlay:not(#receipt-modal-overlay):not(#cd-receipt-modal),
    body:not(.printing-receipt) #cd-receipt-modal,
    body.printing-receipt .class-detail-page {
        display: none !important;
    }

    #receipt-modal-overlay:not(.hidden),
    body.printing-receipt #cd-receipt-modal {
        position: static !important;
        opacity: 1 !important;
        background: transparent !important;
        backdrop-filter: none !important;
        padding: 0 !important;
        margin: 0 !important;
        display: block !important;
    }

    #receipt-modal-overlay .modal,
    #cd-receipt-modal .modal-card,
    .thermal-receipt-stage {
        width: auto !important;
        max-width: none !important;
        max-height: none !important;
        overflow: visible !important;
        border: none !important;
        box-shadow: none !important;
        padding: 0 !important;
        margin: 0 !important;
        transform: none !important;
        background: transparent !important;
        display: block !important;
    }

    .thermal-receipt {
        width: 74mm !important;
        max-width: 74mm !important;
        border: none !important;
        box-shadow: none !important;
        padding: 2mm 3mm 5mm 3mm !important;
        margin: 0 !important;
        background: #ffffff !important;
        color: #000000 !important;
    }

    .thermal-receipt[data-roll="58mm"] {
        width: 52mm !important;
        max-width: 52mm !important;
        padding: 1.5mm 2mm 4mm 2mm !important;
    }
}

/* ========================================== */
/* FEATURE 5: TEACHERS & PAYROLL STYLING      */
/* ========================================== */
.comp-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 700;
}

.comp-fixed {
    background: rgba(34, 197, 94, 0.12);
    color: var(--success);
    border: 1px solid rgba(34, 197, 94, 0.3);
}

.comp-hourly {
    background: rgba(56, 189, 248, 0.12);
    color: #38bdf8;
    border: 1px solid rgba(56, 189, 248, 0.3);
}

.comp-percentage {
    background: rgba(252, 193, 0, 0.12);
    color: var(--brand-primary);
    border: 1px solid rgba(252, 193, 0, 0.3);
}

.teacher-earnings {
    font-size: 1rem;
    font-weight: 800;
    color: var(--brand-primary);
}

.teacher-tag {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.72rem;
    font-weight: 600;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    margin-right: 3px;
    margin-bottom: 2px;
}

/* ========================================== */
/* FEATURE 7: QUICK FIND EMPTY ROOM STYLING   */
/* ========================================== */
.rf-room-card {
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1.2rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    transition: all 0.2s ease;
}

.rf-room-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.rf-room-card.is-available {
    border-color: rgba(34, 197, 94, 0.4);
    background: linear-gradient(180deg, rgba(34, 197, 94, 0.05), transparent);
}

.rf-room-card.is-occupied {
    border-color: rgba(239, 68, 68, 0.35);
    background: linear-gradient(180deg, rgba(239, 68, 68, 0.05), transparent);
}

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

.rf-room-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
}

.rf-status-pill {
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.rf-status-free {
    background: rgba(34, 197, 94, 0.15);
    color: var(--success);
    border: 1px solid rgba(34, 197, 94, 0.35);
}

.rf-status-busy {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.35);
}

.rf-timeline-cell {
    padding: 6px 4px;
    border: 1px solid var(--border-color);
    font-size: 0.72rem;
    font-weight: 600;
}

.rf-slot-free {
    background: rgba(34, 197, 94, 0.08);
    color: var(--success);
}

.rf-slot-busy {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
}

/* ========================================== */
/* CLASS DETAIL & ATTENDANCE MATRIX STYLES   */
/* ========================================== */
.booked-cell {
    position: relative;
}

.booked-cell:hover .open-tab-hint {
    opacity: 1;
    transform: translateY(0);
}

.open-tab-hint {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.72rem;
    color: var(--brand-secondary);
    background: rgba(111, 177, 224, 0.15);
    border: 1px solid rgba(111, 177, 224, 0.3);
    border-radius: 4px;
    padding: 2px 5px;
    margin-left: auto;
    opacity: 0.75;
    transition: all 0.2s ease;
}

.class-detail-page {
    max-width: 1400px;
    margin: 0 auto;
    padding: 1.5rem 2rem 4rem;
}

.cd-topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 1.25rem;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.cd-hero-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.75rem;
    box-shadow: var(--shadow-sm);
    margin-bottom: 1.5rem;
}

.cd-hero-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 1.25rem;
    margin-bottom: 1.25rem;
}

.cd-hero-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.cd-instructor-box {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    padding: 0.85rem 1.25rem;
    border-radius: var(--radius-md);
    min-width: 280px;
}

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

.cd-kpi-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s ease;
}

.cd-kpi-card:hover {
    transform: translateY(-2px);
}

.cd-kpi-title {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 0.5px;
}

.cd-kpi-val {
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--text-primary);
}

.cd-kpi-sub {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.cd-tab-nav {
    display: flex;
    gap: 0.5rem;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 1.5rem;
}

.cd-tab-nav .cd-tab-btn,
.cd-tab-btn:not(.nav-item) {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 0.75rem 1.25rem;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.cd-tab-nav .cd-tab-btn.active,
.cd-tab-btn:not(.nav-item).active {
    color: var(--brand-primary);
    border-bottom-color: var(--brand-primary);
}

.cd-tab-pane {
    display: none;
}

.cd-tab-pane.active {
    display: block;
}

#tp-dashboard-screen .main-content {
    overflow-y: auto;
}

.form-grid {
    display: grid;
    gap: 1rem;
}

/* Attendance Matrix Table */
.att-matrix-wrapper {
    overflow-x: auto;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    box-shadow: var(--shadow-sm);
    margin-bottom: 1.5rem;
}

.att-matrix-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
    white-space: nowrap;
}

.att-matrix-table th,
.att-matrix-table td {
    padding: 0.6rem 0.5rem;
    text-align: center;
    border: 1px solid var(--border-color);
    vertical-align: middle;
}

.att-matrix-table th.col-student,
.att-matrix-table td.col-student,
.att-matrix-table th.gp-col-roster-fixed,
.att-matrix-table td.gp-col-roster-fixed {
    text-align: left;
    position: sticky;
    left: 0;
    background: var(--bg-card);
    z-index: 6;
    min-width: 290px;
    max-width: 350px;
    box-shadow: 3px 0 8px rgba(0, 0, 0, 0.15);
}

.att-matrix-table thead th.col-student,
.att-matrix-table thead th.gp-col-roster-fixed {
    z-index: 10;
}

.att-matrix-table tfoot td.col-student,
.att-matrix-table tfoot td.gp-col-roster-fixed {
    z-index: 7;
}

button.att-matrix-pill,
button.att-matrix-empty {
    border: none;
    cursor: pointer;
    font-family: inherit;
    padding: 0;
    outline: none;
    user-select: none;
}

/* Quick Status Popover for Admin Attendance */
.att-quick-popover {
    position: fixed;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
    padding: 6px;
    display: flex;
    gap: 6px;
    z-index: 99999;
    backdrop-filter: blur(12px);
    animation: popoverFadeIn 0.12s ease-out;
}

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

.att-quick-popover.hidden {
    display: none !important;
}

.att-quick-popover-item {
    border: none;
    cursor: pointer;
    border-radius: var(--radius-sm);
    padding: 6px 10px;
    font-size: 0.78rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    transition: transform 0.1s ease, filter 0.15s ease;
}

.att-quick-popover-item:hover {
    transform: scale(1.06);
    filter: brightness(1.1);
}

.att-matrix-header-cell {
    min-width: 58px;
    padding: 6px 4px;
}

.att-matrix-header-cell.today {
    background: rgba(252, 193, 0, 0.12);
    border-top: 3px solid var(--brand-primary);
}

.att-matrix-cell {
    padding: 4px;
    cursor: pointer;
    transition: background 0.15s ease;
}

.att-matrix-cell:hover {
    background: var(--glass-shine);
}

.att-matrix-pill {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
    transition: transform 0.15s ease;
}

.att-matrix-cell:hover .att-matrix-pill {
    transform: scale(1.1);
}

.att-matrix-P {
    background: var(--success);
    color: var(--on-gold);
    box-shadow: 0 0 6px rgba(34, 197, 94, 0.3);
}

.att-matrix-L {
    background: #f59e0b;
    color: var(--on-gold);
}

.att-matrix-E {
    background: #38bdf8;
    color: var(--on-gold);
}

.att-matrix-A {
    background: #ef4444;
    color: #ffffff;
    box-shadow: 0 0 6px rgba(239, 68, 68, 0.3);
}

.att-matrix-empty {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 1px dashed var(--border-color);
    color: var(--text-muted);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
}

.att-matrix-empty:hover {
    border-color: var(--brand-primary);
    color: var(--brand-primary);
    background: rgba(252, 193, 0, 0.1);
}

.att-legend-box {
    display: flex;
    flex-wrap: wrap;
    gap: 1.25rem;
    align-items: center;
    margin-bottom: 1rem;
    font-size: 0.82rem;
    color: var(--text-secondary);
}

.att-legend-item {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

/* Print Register Styles */
@media print {
    .no-print,
    .sidebar,
    .cd-topbar,
    .cd-tab-nav,
    .action-buttons,
    button:not(.print-keep),
    #toast-container {
        display: none !important;
    }

    body {
        background: #ffffff !important;
        color: #000000 !important;
    }

    .class-detail-page {
        padding: 0 !important;
        max-width: 100% !important;
    }

    .cd-hero-card {
        border: 1px solid #ccc !important;
        background: #fff !important;
        box-shadow: none !important;
        padding: 1rem !important;
        margin-bottom: 1rem !important;
    }

    .att-matrix-table th,
    .att-matrix-table td {
        border: 1px solid #000 !important;
        color: #000 !important;
        background: #fff !important;
    }

    .att-matrix-table th.col-student,
    .att-matrix-table td.col-student {
        position: static !important;
        box-shadow: none !important;
    }

    .att-matrix-wrapper {
        overflow: visible !important;
        box-shadow: none !important;
    }

    .att-matrix-P {
        background: #e2f8ee !important;
        color: #000 !important;
        border: 1px solid var(--success) !important;
    }

    .att-matrix-L {
        background: #fef3c7 !important;
        color: #92400e !important;
        border: 1px solid #f59e0b !important;
    }

    .att-matrix-E {
        background: #e0f2fe !important;
        color: #075985 !important;
        border: 1px solid #0284c7 !important;
    }

    .att-matrix-A {
        background: #fde8e8 !important;
        color: #c00 !important;
        border: 1px solid #ef4444 !important;
    }
}

/* ========================================== */
/* FINANCE & P&L ANALYTICS MODULE             */
/* ========================================== */
.kpi-expenses .kpi-icon-wrapper {
    background: rgba(249, 115, 22, 0.14);
    color: #f97316;
    border: 1px solid rgba(249, 115, 22, 0.3);
}

.kpi-profit .kpi-icon-wrapper {
    background: rgba(16, 185, 129, 0.14);
    color: #10b981;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.kpi-projected .kpi-icon-wrapper {
    background: rgba(168, 85, 247, 0.14);
    color: #a855f7;
    border: 1px solid rgba(168, 85, 247, 0.3);
}

.fin-subtabs {
    display: flex;
    gap: 0.5rem;
    padding: 0 1.5rem;
    border-bottom: 1px solid var(--border-color);
    flex-wrap: wrap;
    background: rgba(255, 255, 255, 0.01);
}

.fin-tab-btn {
    background: transparent;
    border: none;
    padding: 0.85rem 1.15rem;
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    transition: all 0.2s ease;
    font-family: inherit;
}

.fin-tab-btn:hover {
    color: var(--text-primary);
}

.fin-tab-btn.active {
    color: var(--brand-primary);
    border-bottom-color: var(--brand-primary);
}

.fin-tab-pane {
    display: none;
    padding: 1.25rem 1.5rem 1.5rem 1.5rem;
}

.fin-tab-pane.active {
    display: block;
}

.fin-analytics-strip {
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    gap: 1.25rem;
    padding: 0 1.5rem 1.25rem 1.5rem;
}

@media (max-width: 1100px) {
    .fin-analytics-strip {
        grid-template-columns: 1fr;
    }
}

.fin-analytic-box {
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1.15rem 1.3rem;
}

.fin-bar-row {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    margin-bottom: 0.75rem;
}

.fin-bar-row:last-child {
    margin-bottom: 0;
}

.fin-bar-label-line,
.fin-bar-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.82rem;
}

.fin-bar-track {
    width: 100%;
    height: 8px;
    background: rgba(148, 163, 184, 0.15);
    border-radius: 999px;
    overflow: hidden;
}

.fin-bar-fill {
    height: 100%;
    border-radius: 999px;
    transition: width 0.35s ease;
}

.fin-bar-fill.fill-green {
    background: linear-gradient(90deg, #10b981, #22c55e);
}

.fin-bar-fill.fill-amber {
    background: linear-gradient(90deg, #f59e0b, #fbbf24);
}

.fin-bar-fill.fill-red {
    background: linear-gradient(90deg, #ef4444, #f97316);
}

.fin-bar-fill.fill-purple {
    background: linear-gradient(90deg, #8b5cf6, #a855f7);
}

.fin-bar-fill.fill-blue {
    background: linear-gradient(90deg, #3b82f6, #6fb1e0);
}

.expense-type-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 3px 9px;
    border-radius: 999px;
    font-size: 0.74rem;
    font-weight: 700;
}

.expense-type-monthly {
    background: rgba(111, 177, 224, 0.15);
    color: var(--brand-secondary);
    border: 1px solid rgba(111, 177, 224, 0.35);
}

.expense-type-onetime {
    background: rgba(249, 115, 22, 0.15);
    color: #f97316;
    border: 1px solid rgba(249, 115, 22, 0.35);
}

.expense-type-payroll {
    background: rgba(168, 85, 247, 0.15);
    color: #a855f7;
    border: 1px solid rgba(168, 85, 247, 0.35);
}

.fin-pnl-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

@media (max-width: 960px) {
    .fin-pnl-grid {
        grid-template-columns: 1fr;
    }
}

.fin-pnl-card {
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1.25rem;
}

.fin-pnl-line {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.6rem 0;
    border-bottom: 1px dashed var(--border-color);
    font-size: 0.88rem;
}

.fin-pnl-line:last-child {
    border-bottom: none;
}

.fin-pnl-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.85rem 1rem;
    margin-top: 0.75rem;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-weight: 700;
    font-size: 0.95rem;
}

/* ========================================== */
/* TEACHER PORTAL PLATFORM STYLES             */
/* ========================================== */
.tp-auth-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1.25rem;
    background: radial-gradient(circle at top right, rgba(252, 193, 0, 0.08), transparent 45%),
                radial-gradient(circle at bottom left, rgba(111, 177, 224, 0.08), transparent 45%),
                var(--bg-main);
}

.tp-auth-card {
    width: 100%;
    max-width: 480px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 2.25rem 2rem;
    box-shadow: var(--shadow-lg);
}


.tp-group-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.35rem 1.5rem;
    margin-bottom: 1.25rem;
    box-shadow: var(--shadow-sm);
}

.tp-lock-banner {
    display: flex;
    align-items: flex-start;
    gap: 0.65rem;
    padding: 0.85rem 1rem;
    border-radius: var(--radius-md);
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.35);
    color: #ef4444;
    font-size: 0.83rem;
    line-height: 1.45;
    margin-bottom: 1rem;
}

.tp-open-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.75rem;
    padding: 0.85rem 1.1rem;
    border-radius: var(--radius-md);
    background: rgba(34, 197, 94, 0.09);
    border: 1px solid rgba(34, 197, 94, 0.3);
    margin-bottom: 1rem;
}

.att-cell-locked {
    opacity: 0.62;
    cursor: not-allowed !important;
    background: rgba(148, 163, 184, 0.04);
}

.att-header-locked {
    opacity: 0.7;
    cursor: not-allowed !important;
}

.cal-date-bubble.locked-date {
    opacity: 0.65;
    cursor: not-allowed !important;
    border-style: dashed;
}

