/* ============================
   CSS Variables & Reset
   ============================ */
:root {
    --primary: #E67E22;
    --primary-light: #F0923E;
    --primary-dark: #CF6D17;
    --secondary: #6C757D;
    --success: #28A745;
    --danger: #DC3545;
    --warning: #FFC107;
    --info: #17A2B8;
    --light: #F8F9FA;
    --dark: #2D2D2D;
    --white: #FFFFFF;
    --bg: #FAF8F5;
    --sidebar-width: 250px;
    --sidebar-collapsed: 60px;
    --topbar-height: 60px;
    --border-color: #E8E0D8;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 4px 16px rgba(0, 0, 0, 0.12);
    --radius: 8px;
    --radius-sm: 4px;
    --transition: all 0.3s ease;
    --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --sidebar-bg: #2C1A0E;
    --sidebar-active-bg: var(--primary);
    --thead-bg: #F0E6D6;
    --thead-color: #5D4E37;
    --thead-border: #DDD0BF;
    --row-odd: #FFFDF8;
    --row-even: #FFF0F0;
    --row-hover: #F5EDE0;
}

*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 14px;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--dark);
    line-height: 1.5;
    overflow-x: hidden;
}

/* ============================
   Utilities
   ============================ */
.screen {
    display: none;
}

.screen.active {
    display: block;
}

.view {
    display: none;
    padding: 2rem 2.5rem;
}

.view.active {
    display: block;
}

a {
    color: var(--primary);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* ============================
   Login Screen
   ============================ */
#login-screen {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #E67E22 0%, #F39C12 50%, #F5B041 100%);
}

.login-container {
    background: var(--white);
    border-radius: 16px;
    padding: 3rem;
    text-align: center;
    box-shadow: var(--shadow-lg);
    max-width: 400px;
    width: 90%;
}

.login-logo i {
    font-size: 3rem;
    color: var(--primary);
    margin-bottom: 1rem;
}

.login-emoji {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    line-height: 1;
}

.login-logo h1 {
    font-size: 1.6rem;
    color: var(--primary);
    margin-bottom: 0.3rem;
    font-weight: 700;
}

.login-logo p {
    color: var(--secondary);
    margin-bottom: 2rem;
    font-size: 0.9rem;
}

.google-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    width: 100%;
    padding: 0.85rem 1.5rem;
    border: 2px solid var(--border-color);
    border-radius: var(--radius);
    background: var(--white);
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    transition: var(--transition);
}

.google-btn:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow);
}

.google-btn img {
    width: 20px;
    height: 20px;
}

.error-message {
    color: var(--danger);
    margin-top: 1rem;
    font-size: 0.85rem;
    padding: 0.5rem;
    background: #FDE8EA;
    border-radius: var(--radius-sm);
}

/* ============================
   Top Bar
   ============================ */
.top-bar {
    position: fixed;
    top: 0;
    left: var(--sidebar-width);
    right: 0;
    height: var(--topbar-height);
    background: var(--white);
    border-bottom: 1px solid #F0EDE8;
    display: none;
    align-items: center;
    padding: 0 1.5rem;
    z-index: 100;
    gap: 1rem;
}

.hamburger-btn {
    display: none;
    background: none;
    border: none;
    font-size: 1.3rem;
    cursor: pointer;
    color: var(--dark);
    padding: 0.5rem;
}

#page-title {
    font-size: 1.2rem;
    font-weight: 600;
    flex-shrink: 0;
}

.top-bar-actions {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.user-email {
    font-size: 0.8rem;
    color: var(--secondary);
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.role-badge {
    font-size: 0.7rem;
    padding: 0.2rem 0.5rem;
    border-radius: 20px;
    font-weight: 600;
    text-transform: uppercase;
}

.role-badge.admin {
    background: #FDEBD0;
    color: #AF601A;
}

.role-badge.teacher {
    background: #DBEAFE;
    color: #1D4ED8;
}

.icon-btn {
    background: none;
    border: none;
    font-size: 1.1rem;
    cursor: pointer;
    color: var(--secondary);
    padding: 0.4rem;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.icon-btn:hover {
    color: var(--primary);
    background: var(--light);
}

/* ============================
   Sidebar
   ============================ */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    color: var(--white);
    z-index: 200;
    overflow-y: auto;
    transition: var(--transition);
}

.sidebar-header {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 0.5rem;
    padding: 1.25rem 1.25rem 1.1rem;
    text-align: left;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-header .sidebar-emoji {
    font-size: 1.4rem;
    line-height: 1;
    flex-shrink: 0;
}

.sidebar-header-text {
    display: flex;
    flex-direction: column;
}

.sidebar-header .sidebar-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--primary);
    letter-spacing: 0.01em;
    line-height: 1.2;
}

.sidebar-header .sidebar-tagline {
    font-size: 0.62rem;
    color: rgba(255, 255, 255, 0.5);
    letter-spacing: 0.03em;
    text-transform: none;
    line-height: 1.3;
}

.sidebar-header i {
    font-size: 1.5rem;
    color: var(--primary);
    display: none;
}

.nav-menu {
    list-style: none;
    padding: 0.75rem 0.6rem;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.65rem 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.88rem;
    color: rgba(255, 255, 255, 0.65);
    border-left: none;
    border-radius: 8px;
    font-weight: 400;
    margin-bottom: 0.1rem;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.9);
}

.nav-item.active {
    background: var(--primary);
    color: var(--white);
    font-weight: 500;
}

.nav-item.active i {
    color: var(--white);
}

.nav-item i {
    width: 20px;
    text-align: center;
    font-size: 0.95rem;
    color: rgba(255, 255, 255, 0.45);
}

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.3);
    z-index: 150;
}

/* ============================
   Main Content
   ============================ */
.main-content {
    margin-left: var(--sidebar-width);
    margin-top: 0;
    min-height: 100vh;
}

/* ============================
   User Info Bar
   ============================ */
.user-info-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.6rem 2.5rem;
    background: var(--white);
    border-bottom: 1px solid #F0EDE8;
    font-size: 0.85rem;
}

.user-info-left {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.user-info-left>i {
    font-size: 1.2rem;
    color: var(--primary);
}

.user-display-name {
    font-weight: 600;
    color: var(--dark);
}

.user-info-right {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* ============================
   Theme Chooser
   ============================ */
.theme-chooser-wrapper {
    position: relative;
}

.theme-chooser-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 0.35rem;
    background: var(--white);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    z-index: 200;
    min-width: 260px;
    max-height: 420px;
    overflow-y: auto;
    padding: 0.5rem 0;
}

.theme-chooser-dropdown .chooser-title {
    padding: 0.5rem 1rem;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--secondary);
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 0.25rem;
}

.theme-item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.55rem 1rem;
    cursor: pointer;
    transition: background 0.15s;
    user-select: none;
    font-size: 0.82rem;
    border-radius: 0;
}

.theme-item:hover {
    background: var(--light);
}

.theme-item.active {
    background: var(--light);
    font-weight: 600;
}

.theme-item.active::after {
    content: '\f00c';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    margin-left: auto;
    color: var(--primary);
    font-size: 0.75rem;
}

.theme-swatch {
    display: flex;
    gap: 2px;
    flex-shrink: 0;
}

.theme-swatch span {
    width: 14px;
    height: 14px;
    border-radius: 3px;
    border: 1px solid rgba(0, 0, 0, 0.08);
}

.theme-name {
    flex: 1;
}

/* ============================
   View Header
   ============================ */
.dashboard-header-section {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 1.25rem;
    gap: 1rem;
}

.dashboard-title-row {
    display: flex;
    flex-direction: column;
}

.dashboard-heading {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--dark);
    margin-bottom: 0.1rem;
    letter-spacing: -0.01em;
}

.student-count-label {
    font-size: 0.82rem;
    color: #9CA3AF;
    font-weight: 400;
}

.dashboard-header-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}

.dashboard-header-actions .search-bar {
    min-width: 220px;
    max-width: 300px;
}

.view-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
}

.search-bar {
    position: relative;
    flex: 1;
    min-width: 200px;
    max-width: 400px;
}

.search-bar i {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--secondary);
}

.search-bar input {
    width: 100%;
    padding: 0.55rem 0.75rem 0.55rem 2.2rem;
    border: 1px solid #E5E7EB;
    border-radius: 6px;
    font-size: 0.85rem;
    outline: none;
    transition: var(--transition);
    background: var(--white);
}

.search-bar input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(230, 126, 34, 0.12);
}

.view-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

/* ============================
   Buttons
   ============================ */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 0.9rem;
    border: none;
    border-radius: 6px;
    font-size: 0.82rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
    letter-spacing: 0.01em;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background: var(--primary);
    color: var(--white);
}

.btn-primary:hover:not(:disabled) {
    background: var(--primary-dark);
}

.btn-secondary {
    background: var(--light);
    color: var(--dark);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--border-color);
}

.btn-danger {
    background: var(--danger);
    color: var(--white);
}

.btn-danger:hover:not(:disabled) {
    background: #C82333;
}

.btn-warning {
    background: var(--warning);
    color: var(--dark);
}

.btn-warning:hover:not(:disabled) {
    background: #E0A800;
}

.btn-success {
    background: var(--success);
    color: var(--white);
}

.btn-success:hover:not(:disabled) {
    background: #218838;
}

.btn-add-student {
    background: #166534;
    color: #fff;
    box-shadow: 0 0 12px rgba(22, 101, 52, 0.5), 0 0 4px rgba(22, 101, 52, 0.3);
    border: none;
    font-weight: 600;
    letter-spacing: 0.02em;
    transition: background 0.2s, box-shadow 0.2s, transform 0.15s;
}

.btn-add-student:hover:not(:disabled) {
    background: #14532d;
    box-shadow: 0 0 20px rgba(22, 101, 52, 0.7), 0 0 8px rgba(22, 101, 52, 0.4);
    transform: translateY(-1px);
}

.btn-add-student:active:not(:disabled) {
    transform: translateY(0);
    box-shadow: 0 0 8px rgba(22, 101, 52, 0.4);
}

/* Quick-add student row in attendance */
.att-quick-add-row td {
    background: rgba(22, 101, 52, 0.06);
}

.att-quick-add-input {
    width: 100%;
    max-width: 280px;
    padding: 0.5rem 0.75rem;
    border: 2px solid #166534;
    border-radius: 6px;
    font-size: 0.88rem;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
    background: var(--white, #fff);
}

.att-quick-add-input:focus {
    border-color: #14532d;
    box-shadow: 0 0 0 3px rgba(22, 101, 52, 0.15);
}

.att-quick-save-btn {
    background: #166534;
    color: #fff;
    border: none;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1rem;
    transition: background 0.2s, transform 0.15s;
    margin-left: 0.5rem;
    vertical-align: middle;
}

.att-quick-save-btn:hover {
    background: #14532d;
    transform: scale(1.1);
}

.btn-sm {
    padding: 0.35rem 0.65rem;
    font-size: 0.8rem;
}

.btn-icon {
    padding: 0.4rem;
    width: 32px;
    height: 32px;
    justify-content: center;
}

/* ============================
   Filter / Select
   ============================ */
.filter-select {
    padding: 0.55rem 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 0.85rem;
    background: var(--white);
    outline: none;
    cursor: pointer;
}

.filter-select:focus {
    border-color: var(--primary);
}

.date-input {
    padding: 0.55rem 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 0.85rem;
    outline: none;
}

.date-input:focus {
    border-color: var(--primary);
}

/* ============================
   Top Scrollbar
   ============================ */
.top-scrollbar-wrapper {
    overflow-x: auto;
    overflow-y: hidden;
    height: 12px;
    background: var(--white);
    border-radius: var(--radius) var(--radius) 0 0;
    border: 1px solid var(--border-color);
    border-bottom: none;
    margin-bottom: 0;
    position: relative;
    z-index: 2;
}

.top-scrollbar-content {
    height: 1px;
}

/* ============================
   Column Chooser
   ============================ */
.column-chooser-wrapper {
    position: relative;
}

.column-chooser-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 0.35rem;
    background: var(--white);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    z-index: 100;
    min-width: 240px;
    max-height: 360px;
    overflow-y: auto;
    padding: 0.5rem 0;
}

.column-chooser-dropdown .chooser-title {
    padding: 0.5rem 1rem;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--secondary);
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 0.25rem;
}

.column-chooser-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.45rem 1rem;
    font-size: 0.82rem;
    cursor: pointer;
    transition: background 0.15s;
    user-select: none;
}

.column-chooser-item:hover {
    background: var(--light);
}

.column-chooser-item input[type="checkbox"] {
    accent-color: var(--primary);
    cursor: pointer;
}

.column-chooser-item label {
    cursor: pointer;
    flex: 1;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    font-size: 0.8rem;
}

.chooser-actions {
    display: flex;
    gap: 0.5rem;
    padding: 0.5rem 1rem 0.25rem;
    border-top: 1px solid var(--border-color);
    margin-top: 0.25rem;
}

.chooser-actions button {
    font-size: 0.72rem;
    padding: 0.3rem 0.6rem;
}

/* ============================
   Tables
   ============================ */
.table-container {
    background: var(--white);
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
    overflow-x: auto;
}

.top-scrollbar-wrapper+.table-container {
    border-radius: 0 0 var(--radius) var(--radius);
    border-top: none;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.data-table thead {
    background: var(--thead-bg);
    position: sticky;
    top: 0;
    z-index: 10;
}

.data-table th {
    padding: 1rem 1.25rem;
    text-align: left;
    font-weight: 600;
    font-size: 0.75rem;
    color: var(--thead-color);
    border-bottom: 1px solid var(--thead-border);
    cursor: pointer;
    white-space: nowrap;
    user-select: none;
    letter-spacing: 0.05em;
}

.data-table th:hover {
    color: var(--primary);
}

.data-table th i.fas {
    font-size: 0.65rem;
    margin-left: 0.25rem;
    opacity: 0.5;
}

.data-table th.sorted i.fas {
    opacity: 1;
    color: var(--primary);
}

.data-table td {
    padding: 1.1rem 1.25rem;
    border-bottom: 1px solid #F0EDE8;
    vertical-align: middle;
    text-transform: uppercase;
    font-size: 0.88rem;
    color: #1A1A1A;
}

.data-table tbody tr {
    transition: background 0.15s ease;
    background: var(--row-odd);
}

.data-table tbody tr:nth-child(even) {
    background: var(--row-even);
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

.data-table tbody tr:hover {
    background: var(--row-hover);
}

.student-card .card-name,
.student-card .card-meta {
    text-transform: uppercase;
}

/* Payment row classes — inherit zebra striping */
.data-table tbody tr.payment-expired,
.data-table tbody tr.payment-active,
.data-table tbody tr.payment-expiring,
.data-table tbody tr.payment-never {
    /* no override — rows keep alternating bg */
}

/* Truncatable cell for address and long text fields */
.truncatable-cell {
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    cursor: default;
    position: relative;
}

.truncatable-cell::after {
    content: attr(data-full-text);
    position: absolute;
    left: 0;
    top: 100%;
    z-index: 50;
    background: #1A1A1A;
    color: #FFFFFF;
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    font-size: 0.82rem;
    white-space: normal;
    word-break: break-word;
    min-width: 220px;
    max-width: 350px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.15s ease, visibility 0.15s ease;
    text-transform: none;
    line-height: 1.4;
    letter-spacing: 0;
}

.truncatable-cell:hover::after {
    opacity: 1;
    visibility: visible;
}

/* Table action buttons — clean icon-only style */
.table-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    justify-content: flex-end;
}

.action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s ease;
    background: transparent;
    color: #4B5563;
    font-size: 0.95rem;
}

.action-btn:hover {
    background: #F3F4F6;
    color: var(--primary);
}

.action-btn.action-delete {
    color: #9CA3AF;
}

.action-btn.action-delete:hover {
    background: #FEF2F2;
    color: #DC2626;
}

.action-btn.action-edit:hover {
    background: #F9FAFB;
    color: #4B5563;
}

/* ============================
   Inline Edit Mode
   ============================ */

/* Sticky save bar */
.edit-save-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.55rem 1rem;
    background: #fffbeb;
    border: 1px solid #fcd34d;
    border-radius: var(--radius, 8px);
    margin-bottom: 0.75rem;
    position: sticky;
    top: var(--topbar-height, 56px);
    z-index: 50;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.edit-save-bar-left {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-size: 0.88rem;
    font-weight: 500;
    color: #92400e;
}

.edit-save-bar-right {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.edit-dirty-badge {
    background: #f59e0b;
    color: #fff;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 0.12rem 0.55rem;
    border-radius: 99px;
}

/* Active state for Edit Table button */
.btn-active {
    background: #fef3c7 !important;
    border: 1.5px solid #f59e0b !important;
    color: #92400e !important;
}

/* Dirty cell highlight */
td.cell-dirty {
    background-color: #fefce8 !important;
}

/* Dirty row indicator dot */
.row-dirty-dot {
    color: #f59e0b;
    font-size: 1.1rem;
    line-height: 1;
}

/* Dirty row subtle bg */
tr.row-dirty {
    background-color: #fffdf0 !important;
}

/* Checkbox select column (edit mode) */
.col-select {
    width: 36px;
    min-width: 36px;
    text-align: center !important;
    padding: 0.3rem 0.25rem !important;
    vertical-align: middle;
}

.col-select input[type="checkbox"],
.row-select-cb {
    cursor: pointer;
    width: 16px;
    height: 16px;
    accent-color: var(--primary, #e67e22);
}

/* Selected row highlight */
tr.row-selected > td {
    background-color: #fff7ed !important;
}

/* Edit inputs inside table cells */
.edit-input {
    width: 100%;
    min-width: 80px;
    max-width: 200px;
    padding: 0.28rem 0.45rem;
    border: 1px solid var(--border-color, #ddd);
    border-radius: 4px;
    font-size: 0.82rem;
    background: var(--white, #fff);
    color: var(--text, #222);
    box-sizing: border-box;
    transition: border-color 0.15s;
}

.edit-input:focus {
    outline: none;
    border-color: var(--primary, #e67e22);
    box-shadow: 0 0 0 2px rgba(230, 126, 34, 0.12);
}

.edit-select {
    min-width: 80px;
    max-width: 160px;
}

.edit-cell-readonly {
    color: var(--text-muted, #9ca3af);
    font-size: 0.8rem;
}

/* Photo cell */
.edit-cell-photo {
    min-width: 90px;
}

.edit-photo-wrap {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.edit-photo-thumb {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    border: 1.5px solid var(--border-color, #ddd);
}

.edit-photo-placeholder {
    font-size: 1.6rem;
    color: #d1d5db;
}

.edit-photo-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--primary-light, #fef3c7);
    color: var(--primary, #e67e22);
    cursor: pointer;
    font-size: 0.8rem;
    transition: background 0.15s;
}

.edit-photo-btn:hover {
    background: var(--primary, #e67e22);
    color: #fff;
}

.filter-row {
    display: none;
}

.filter-row.visible td,
.filter-row.visible th {
    padding: 0.25rem 0.5rem;
    background: #FAFBFC;
}

.filter-row input,
.filter-row select {
    width: 100%;
    padding: 0.3rem 0.5rem;
    border: 1px solid #E5E7EB;
    border-radius: var(--radius-sm);
    font-size: 0.78rem;
    background: var(--white);
    transition: border-color 0.2s;
}

.filter-row input:focus,
.filter-row select:focus {
    border-color: var(--primary);
    outline: none;
}

.column-filter {
    width: 100%;
    padding: 0.3rem 0.5rem;
    border: 1px solid #E5E7EB;
    border-radius: var(--radius-sm);
    font-size: 0.78rem;
    background: var(--white);
    transition: border-color 0.2s;
}

.column-filter:focus {
    border-color: var(--primary);
    outline: none;
}

/* ============================
   Cards (Mobile)
   ============================ */
.cards-container {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.75rem;
}

.student-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 1rem;
    border: 1px solid var(--border-color);
    border-left: 4px solid var(--primary);
}

.student-card.payment-expired {
    border-left-color: var(--danger);
}

.student-card.payment-active {
    border-left-color: var(--success);
}

.student-card.payment-expiring {
    border-left-color: var(--warning);
}

.student-card .card-name {
    font-weight: 600;
    font-size: 1rem;
    margin-bottom: 0.3rem;
}

.student-card .card-meta {
    font-size: 0.8rem;
    color: var(--secondary);
    margin-bottom: 0.5rem;
}

.student-card .card-payment {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    letter-spacing: 0.02em;
}

.payment-status-active {
    background: #22C55E;
    color: #FFFFFF;
    border: 2px solid #15803D;
}

.payment-status-expired {
    background: #DC2626;
    color: #FFFFFF;
    border: 2px solid #7F1D1D;
}

.payment-status-expiring {
    background: #F59E0B;
    color: #FFFFFF;
    border: 2px solid #92400E;
}

.payment-status-never {
    background: #F4FC05;
    color: #333;
    border: 2px solid #DC2626;
}

.payment-status-never_paid {
    background: #F4FC05;
    color: #333;
    border: 2px solid #DC2626;
}

/* Payment status as clean inline pill badges */
[class^="payment-status-"] {
    display: inline-block;
    padding: 0.3rem 0.85rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    white-space: nowrap;
    min-width: 100px;
    text-align: center;
    box-sizing: border-box;
}

.student-card .card-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

/* ============================
   Modals
   ============================ */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(2px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 1rem;
}

.modal-content {
    background: var(--white);
    border-radius: 12px;
    width: 100%;
    max-width: 550px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15), 0 1px 3px rgba(0, 0, 0, 0.08);
}

.modal-large {
    max-width: 800px;
}

.modal-small {
    max-width: 420px;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
    font-size: 1.1rem;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--secondary);
    line-height: 1;
}

.modal-close:hover {
    color: var(--danger);
}

.modal-body {
    padding: 1.5rem;
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border-color);
}

/* ============================
   Tabs
   ============================ */
.modal-tabs,
.settings-tabs,
.payment-tabs {
    display: flex;
    border-bottom: 2px solid var(--border-color);
    padding: 0 1.5rem;
    overflow-x: auto;
}

.tab-btn {
    padding: 0.7rem 1rem;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--secondary);
    white-space: nowrap;
    transition: var(--transition);
}

.tab-btn:hover {
    color: var(--primary);
}

.tab-btn.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

.settings-tab-content {
    display: none;
    padding: 1.5rem;
}

.settings-tab-content.active {
    display: block;
}

.settings-tabs {
    padding: 0;
    margin-bottom: 0;
    background: var(--white);
    border-radius: var(--radius) var(--radius) 0 0;
}

.settings-content {
    background: var(--white);
    border-radius: 0 0 var(--radius) var(--radius);
    box-shadow: var(--shadow);
}

/* ============================
   Forms
   ============================ */
.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    margin-bottom: 0.3rem;
    color: var(--dark);
}

.form-group input[type="text"],
.form-group input[type="number"],
.form-group input[type="date"],
.form-group input[type="email"],
.form-group input[type="tel"],
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 0.55rem 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 0.85rem;
    font-family: var(--font);
    outline: none;
    transition: var(--transition);
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(230, 126, 34, 0.15);
}

.form-group input[type="checkbox"] {
    margin-right: 0.4rem;
    accent-color: var(--primary);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

/* ============================
   Analytics Grid
   ============================ */
.analytics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
    gap: 1.5rem;
}

.chart-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 1.25rem;
    border: 1px solid var(--border-color);
}

.chart-card h4 {
    font-size: 0.95rem;
    margin-bottom: 1rem;
    color: var(--dark);
}

.analytics-filters {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-left: auto;
}

/* ============================
   Settings
   ============================ */
.settings-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.settings-header h4 {
    font-size: 1rem;
}

.settings-section {
    margin-bottom: 2rem;
}

.fields-list,
.areas-list,
.mentors-list,
.bv-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.field-item,
.area-item,
.mentor-item,
.bv-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 1rem;
    background: var(--light);
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
}

.field-item .field-info {
    flex: 1;
}

.field-item .field-name {
    font-weight: 500;
}

.field-item .field-type {
    font-size: 0.8rem;
    color: var(--secondary);
}

.drag-handle {
    cursor: grab;
    color: var(--secondary);
}

.drag-handle:active {
    cursor: grabbing;
}

/* ============================
   Festivals
   ============================ */
.festivals-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1rem;
}

.festival-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 1.25rem;
    border: 1px solid var(--border-color);
    border-top: 3px solid var(--primary);
}

.festival-card h4 {
    font-size: 1rem;
    margin-bottom: 0.3rem;
}

.festival-card .festival-date {
    font-size: 0.85rem;
    color: var(--secondary);
    margin-bottom: 0.5rem;
}

.festival-card .festival-type {
    display: inline-block;
    font-size: 0.75rem;
    padding: 0.15rem 0.5rem;
    background: var(--primary-light);
    color: var(--white);
    border-radius: 12px;
    margin-bottom: 0.5rem;
}

.festival-card .festival-desc {
    font-size: 0.85rem;
    color: var(--secondary);
}

.festival-card .festival-actions {
    margin-top: 0.75rem;
    display: flex;
    gap: 0.5rem;
}

/* ============================
   Diff View
   ============================ */
.diff-container {
    font-family: monospace;
    font-size: 0.85rem;
}

.diff-row {
    display: flex;
    padding: 0.3rem 0.5rem;
    border-bottom: 1px solid #F0F0F0;
}

.diff-field {
    width: 150px;
    font-weight: 600;
    flex-shrink: 0;
}

.diff-old {
    flex: 1;
    background: #FFEBEE;
    padding: 0.2rem 0.5rem;
    border-radius: var(--radius-sm);
    margin-right: 0.5rem;
    text-decoration: line-through;
    color: var(--danger);
}

.diff-new {
    flex: 1;
    background: #E8F5E9;
    padding: 0.2rem 0.5rem;
    border-radius: var(--radius-sm);
    color: var(--success);
}

/* ============================
   Toast Notifications
   ============================ */
.toast-container {
    position: fixed;
    top: 80px;
    right: 1.5rem;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.toast {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.85rem 1.25rem;
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    font-size: 0.85rem;
    min-width: 280px;
    max-width: 400px;
    animation: slideIn 0.3s ease;
    border-left: 4px solid var(--primary);
}

.toast.success {
    border-left-color: var(--success);
}

.toast.error {
    border-left-color: var(--danger);
}

.toast.warning {
    border-left-color: var(--warning);
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }

    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

/* ============================
   Attendance Specific
   ============================ */
.attendance-date-section {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.attendance-date-section label {
    font-weight: 600;
    font-size: 0.9rem;
}

.day-label {
    font-weight: 600;
    color: var(--primary);
    font-size: 0.95rem;
}

.warning-banner {
    background: #FFF3E0;
    color: #E65100;
    padding: 0.5rem 1rem;
    border-radius: var(--radius);
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.attendance-status-btns {
    display: flex;
    gap: 0.3rem;
}

.attendance-status-btns .btn {
    padding: 0.3rem 0.7rem;
    font-size: 0.8rem;
}

.attendance-status-btns .btn.selected {
    box-shadow: 0 0 0 2px var(--primary);
}

/* ============================
   Attendance Toggle Buttons
   ============================ */
.att-toggle-group {
    display: inline-flex;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #E0E0E0;
    background: #F5F5F5;
}

.att-toggle {
    padding: 0.4rem 0.75rem;
    font-size: 0.78rem;
    font-weight: 600;
    border: none;
    background: transparent;
    color: #666;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.3rem;
    white-space: nowrap;
}

.att-toggle:not(:last-child) {
    border-right: 1px solid #E0E0E0;
}

.att-toggle:hover {
    background: #E8E8E8;
}

.att-toggle.att-present.active {
    background: #059669;
    color: #fff;
}

.att-toggle.att-absent.active {
    background: #DC2626;
    color: #fff;
}

.att-toggle.att-late.active {
    background: #D97706;
    color: #fff;
}

.att-toggle i {
    font-size: 0.7rem;
}

.att-remarks-input {
    width: 100%;
    padding: 0.35rem 0.6rem;
    border: 1px solid #E0E0E0;
    border-radius: 6px;
    font-size: 0.82rem;
    font-family: inherit;
    background: #FAFAFA;
    transition: border-color 0.2s;
}

.att-remarks-input:focus {
    outline: none;
    border-color: var(--primary);
    background: #fff;
}

.att-sno {
    color: #999;
    font-size: 0.8rem;
    font-weight: 500;
}

.att-name {
    font-weight: 600;
}

/* Marked By column — admin only */
.att-marked-by-col {
    font-size: 0.82rem;
    color: #888;
    white-space: nowrap;
    max-width: 160px;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Attendance mobile-first cards */
#view-attendance .attendance-card {
    background: var(--white);
    border-radius: 14px;
    border: 1px solid var(--border-color);
    border-left: 5px solid var(--primary);
    box-shadow: var(--shadow);
    padding: 0.9rem;
}

#view-attendance .att-card-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.25rem;
}

#view-attendance .att-card-num {
    color: #8b7a6d;
    font-size: 0.76rem;
    font-weight: 700;
}

#view-attendance .attendance-card .card-name {
    font-weight: 700;
    font-size: 1.08rem;
    color: var(--dark);
    margin-bottom: 0.15rem;
}

#view-attendance .attendance-card .card-payment {
    font-size: 0.78rem;
    color: #8d7566;
    margin-bottom: 0.45rem;
    font-weight: 600;
}

#view-attendance .att-card-meta {
    display: flex;
    gap: 0.35rem;
    align-items: baseline;
    font-size: 0.78rem;
    color: #7b6c60;
    margin-bottom: 0.7rem;
}

#view-attendance .att-meta-label {
    font-weight: 700;
}

#view-attendance .att-marked-by-value {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#view-attendance .att-card-actions.att-toggle-group {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    width: 100%;
    border-radius: 10px;
}

#view-attendance .attendance-card .att-toggle {
    justify-content: center;
    padding: 0.56rem 0.25rem;
    font-size: 0.78rem;
}

#view-attendance .attendance-card .status-badge {
    font-size: 0.68rem;
}

#view-attendance .att-secondary-actions {
    margin-top: 0.45rem;
}

#view-attendance .att-reset-btn {
    width: 100%;
    border: 1px solid #d97706;
    background: #fff7ed;
    color: #b45309;
    border-radius: 8px;
    padding: 0.48rem 0.65rem;
    font-size: 0.78rem;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    gap: 0.4rem;
    transition: all 0.2s ease;
}

#view-attendance .att-reset-btn:hover {
    background: #ffedd5;
    border-color: #b45309;
}

/* ============================
   Payments Inline Editing
   ============================ */
.pay-sno {
    color: #999;
    font-size: 0.8rem;
    font-weight: 500;
}

.pay-name {
    font-weight: 600;
}

.pay-actions {
    display: flex;
    gap: 0.3rem;
    align-items: center;
}

.pay-editing .pay-amount,
.pay-editing .pay-mode,
.pay-editing .pay-start,
.pay-editing .pay-end {
    padding: 0.3rem;
}

.pay-inline-input {
    width: 100%;
    padding: 0.35rem 0.5rem;
    border: 1.5px solid var(--primary);
    border-radius: 6px;
    font-size: 0.82rem;
    font-family: inherit;
    background: #FFFEF5;
    transition: border-color 0.2s;
    min-width: 80px;
}

.pay-inline-input:focus {
    outline: none;
    border-color: var(--primary-dark);
    background: #fff;
    box-shadow: 0 0 0 2px rgba(230, 126, 34, 0.15);
}

.pay-inline-input[type="number"] {
    min-width: 70px;
    max-width: 90px;
}

.pay-inline-input[type="date"] {
    min-width: 120px;
}

select.pay-inline-input {
    min-width: 90px;
    cursor: pointer;
}

.pay-editing {
    background: #FFFDF0 !important;
}

.pay-save-btn {
    color: #059669 !important;
}

.pay-save-btn:hover {
    background: #ECFDF5 !important;
}

.pay-edit-btn:hover {
    background: #FFF8F0 !important;
}

.pay-history-btn.active {
    color: var(--primary) !important;
    background: #FFF3E8 !important;
}

/* ============================
   Payment History Sub-rows
   ============================ */
.pay-history-row {
    background: #FAFAF7 !important;
}

.pay-history-row:hover {
    background: #FAFAF7 !important;
}

.pay-history-cell {
    padding: 0 !important;
}

.pay-history-container {
    padding: 0.75rem 1.25rem 1rem 3.5rem;
    border-left: 3px solid var(--primary);
    margin-left: 1rem;
}

.pay-history-title {
    font-size: 0.78rem;
    font-weight: 700;
    color: #5D4E37;
    margin-bottom: 0.6rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.pay-history-title i {
    color: var(--primary);
}

.pay-history-stack {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.pay-history-card {
    background: #fff;
    border: 1px solid #E8E0D8;
    border-radius: 8px;
    padding: 0.65rem 1rem;
    transition: box-shadow 0.15s;
}

.pay-history-card:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.pay-history-card.current {
    border-left: 3px solid var(--primary);
    background: #FFFDF5;
}

.pay-history-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.4rem;
}

.pay-history-header-right {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.pay-history-delete-btn {
    color: #D1D5DB !important;
    font-size: 0.72rem !important;
    width: 28px !important;
    height: 28px !important;
    min-width: 28px;
    transition: color 0.2s, background 0.2s;
}

.pay-history-delete-btn:hover {
    color: #DC2626 !important;
    background: #FEF2F2 !important;
}

.pay-history-label {
    font-size: 0.72rem;
    font-weight: 700;
    color: #8B7355;
    letter-spacing: 0.03em;
}

.pay-history-card.current .pay-history-label {
    color: var(--primary);
}

.pay-history-label i {
    color: #F59E0B;
    margin-right: 0.15rem;
}

.pay-history-details {
    display: grid;
    grid-template-columns: repeat(6, auto);
    gap: 0.3rem 1.2rem;
    align-items: baseline;
}

.pay-history-field {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}

.pay-history-field.full {
    grid-column: 1 / -1;
}

.pay-history-key {
    font-size: 0.65rem;
    font-weight: 600;
    color: #9CA3AF;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.pay-history-val {
    font-size: 0.82rem;
    font-weight: 500;
    color: #1A1A1A;
}

.pay-history-empty {
    padding: 1rem;
    text-align: center;
    color: #9CA3AF;
    font-size: 0.85rem;
    font-style: italic;
}

/* Screenshot Upload */
.screenshot-upload-area {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem;
    border: 2px dashed var(--border-color, #E5E7EB);
    border-radius: 8px;
    background: var(--bg-secondary, #F9FAFB);
    transition: border-color 0.2s;
}

.screenshot-upload-area:hover {
    border-color: var(--primary-color, #6366F1);
}

.screenshot-btn-row {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.screenshot-filename {
    font-size: 0.82rem;
    color: #6B7280;
    font-style: italic;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.screenshot-preview {
    width: 100%;
}

.screenshot-preview img {
    max-width: 100%;
    max-height: 200px;
    border-radius: 8px;
    margin-top: 0.5rem;
    border: 1px solid var(--border-color, #E5E7EB);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.pay-screenshot-link {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.78rem;
    color: var(--primary-color, #6366F1);
    text-decoration: none;
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    transition: background 0.2s;
}

.pay-screenshot-link:hover {
    background: rgba(99, 102, 241, 0.1);
    text-decoration: underline;
}

.pay-screenshot-link i {
    font-size: 0.7rem;
}

.pay-screenshot-thumb {
    max-width: 120px;
    max-height: 80px;
    border-radius: 6px;
    border: 1px solid var(--border-color, #E5E7EB);
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.pay-screenshot-thumb:hover {
    transform: scale(1.05);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

@media (max-width: 768px) {
    .pay-history-container {
        padding: 0.5rem 0.75rem 0.75rem 1rem;
        margin-left: 0.25rem;
    }

    .pay-history-details {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ============================
   Status Badges
   ============================ */
.status-badge {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.status-badge.present {
    background: #ECFDF5;
    color: #059669;
}

.status-badge.absent {
    background: #FEF2F2;
    color: #DC2626;
}

.status-badge.late {
    background: #FFFBEB;
    color: #D97706;
}

.status-badge.unmarked {
    background: #F3F4F6;
    color: #9CA3AF;
    font-style: italic;
}

/* ============================
   Loading
   ============================ */
.loading-spinner {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3rem;
}

.spinner {
    width: 36px;
    height: 36px;
    border: 3px solid var(--border-color);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ============================
   Empty State
   ============================ */
.empty-state {
    text-align: center;
    padding: 3.5rem 2rem;
    color: #9CA3AF;
}

.empty-state i {
    font-size: 2.5rem;
    margin-bottom: 0.75rem;
    opacity: 0.35;
    color: #D1D5DB;
}

.empty-state p {
    font-size: 0.9rem;
    color: #9CA3AF;
}

/* ============================
   Scrollbar
   ============================ */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #CBD5E1;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #94A3B8;
}

/* ============================
   Toggle Switch
   ============================ */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 22px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background: var(--border-color);
    border-radius: 22px;
    transition: var(--transition);
}

.toggle-slider::before {
    content: "";
    position: absolute;
    height: 16px;
    width: 16px;
    left: 3px;
    bottom: 3px;
    background: var(--white);
    border-radius: 50%;
    transition: var(--transition);
}

.toggle-switch input:checked+.toggle-slider {
    background: var(--primary);
}

.toggle-switch input:checked+.toggle-slider::before {
    transform: translateX(18px);
}

/* ============================
   XLSX Upload Preview Modal
   ============================ */
.modal-fullscreen {
    width: 95vw;
    max-width: 1400px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}

.xlsx-preview-body {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    overflow: hidden;
    flex: 1;
    min-height: 0;
}

.xlsx-stats-bar {
    display: flex;
    gap: 1.5rem;
    align-items: center;
    padding: 0.75rem 1rem;
    background: var(--light);
    border-radius: var(--radius);
    font-size: 0.85rem;
    flex-shrink: 0;
}

.xlsx-stats-bar span {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.xlsx-new-fields-badge {
    background: #E8F5E9;
    color: #2E7D32;
    padding: 0.25rem 0.6rem;
    border-radius: 12px;
    font-weight: 500;
}

.xlsx-mapping-section {
    flex-shrink: 0;
    padding: 0.75rem 1rem;
    background: #FAFBFC;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
}

.xlsx-mapping-section h4 {
    font-size: 0.8rem;
    letter-spacing: 0.05em;
    color: var(--secondary);
    margin-bottom: 0.3rem;
}

.xlsx-mapping-hint {
    font-size: 0.75rem;
    color: var(--secondary);
    margin-bottom: 0.75rem;
}

.xlsx-mappings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 0.5rem;
    max-height: 180px;
    overflow-y: auto;
    padding-right: 0.25rem;
}

.xlsx-mapping-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.65rem;
    background: var(--white);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
}

.xlsx-mapping-item.xlsx-mapping-new {
    border-color: var(--success);
    background: #F1F8E9;
}

.xlsx-mapping-excel,
.xlsx-mapping-app {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    flex: 1;
    min-width: 0;
}

.xlsx-col-label {
    font-size: 0.6rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    color: var(--secondary);
    text-transform: uppercase;
}

.xlsx-mapping-arrow {
    color: var(--primary);
    font-size: 0.75rem;
    flex-shrink: 0;
}

.xlsx-mapping-select {
    width: 100%;
    padding: 0.3rem 0.4rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 0.78rem;
    font-family: var(--font);
    outline: none;
    background: var(--white);
}

.xlsx-mapping-select:focus {
    border-color: var(--primary);
}

.xlsx-table-wrapper {
    flex: 1;
    overflow: auto;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    min-height: 0;
}

.xlsx-preview-table {
    font-size: 0.8rem;
    min-width: max-content;
}

.xlsx-preview-table th {
    position: sticky;
    top: 0;
    background: var(--primary);
    color: var(--white);
    z-index: 2;
    white-space: nowrap;
    font-size: 0.75rem;
    letter-spacing: 0.03em;
}

.xlsx-preview-table th.xlsx-new-col {
    background: var(--success);
}

.xlsx-new-badge {
    display: inline-block;
    background: rgba(255, 255, 255, 0.25);
    color: var(--white);
    font-size: 0.55rem;
    font-weight: 700;
    padding: 0.1rem 0.35rem;
    border-radius: 3px;
    margin-left: 0.3rem;
    vertical-align: middle;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.xlsx-row-num {
    color: var(--secondary);
    font-size: 0.7rem;
    text-align: center;
    width: 40px;
    min-width: 40px;
    background: var(--light) !important;
}

.xlsx-editable-cell {
    cursor: text;
    min-width: 80px;
    padding: 0.35rem 0.5rem;
    outline: none;
    white-space: nowrap;
    max-width: 250px;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: background 0.15s;
}

.xlsx-editable-cell:focus {
    background: #FFF9C4 !important;
    outline: 2px solid var(--primary);
    outline-offset: -2px;
    white-space: normal;
    max-width: none;
}

.xlsx-editable-cell:hover {
    background: #F5F5F5;
}

.xlsx-more-rows {
    text-align: center;
    padding: 0.75rem;
    font-style: italic;
    color: var(--secondary);
    background: var(--light);
}

.xlsx-footer-left {
    display: flex;
    align-items: center;
}

.xlsx-skip-label {
    font-size: 0.8rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.xlsx-footer-right {
    display: flex;
    gap: 0.5rem;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
}

#xlsx-preview-modal .modal-footer {
    justify-content: space-between;
}

/* ============================
   All Labels Uppercase
   ============================ */
.form-group label,
.data-table th,
.field-name,
.tab-btn,
.settings-tabs .tab-btn,
.modal-tabs .tab-btn,
.payment-tabs .tab-btn,
.filter-select,
.view-header h3,
.settings-header h4,
.chart-card h4,
.xlsx-col-label,
.xlsx-skip-label,
label {
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

/* ============================
   Smart Date Input
   ============================ */
/* ============================
   Attendance Date Dropdown & Stats
   ============================ */
.att-date-select {
    padding: 0.45rem 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.88rem;
    font-weight: 600;
    background: var(--white);
    color: var(--dark);
    cursor: pointer;
    min-width: 200px;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.att-date-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(230, 126, 34, 0.12);
}

.att-stat-badges {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

#view-attendance .attendance-view-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

#view-attendance .attendance-view-actions .search-bar {
    flex: 1;
    min-width: 220px;
}

#view-attendance .attendance-action-row {
    display: flex;
    gap: 0.5rem;
    flex-wrap: nowrap;
}

#view-attendance .attendance-action-row .btn {
    flex: 0 0 auto;
}

.stat-badge {
    font-size: 0.78rem;
    font-weight: 600;
    padding: 0.25rem 0.6rem;
    border-radius: 20px;
}

.stat-present {
    background: rgba(22, 163, 74, 0.1);
    color: #16a34a;
}

.stat-absent {
    background: rgba(220, 38, 38, 0.1);
    color: #dc2626;
}

.stat-late {
    background: rgba(217, 119, 6, 0.1);
    color: #d97706;
}

.att-deleted-tag {
    font-size: 0.7rem;
    background: rgba(220, 38, 38, 0.1);
    color: #dc2626;
    padding: 0.1rem 0.4rem;
    border-radius: 4px;
    margin-left: 0.4rem;
    font-weight: 600;
}

.smart-date-success {
    border-color: var(--success, #22c55e) !important;
    background: rgba(34, 197, 94, 0.06) !important;
}

.smart-date-error {
    border-color: var(--danger, #ef4444) !important;
    background: rgba(239, 68, 68, 0.06) !important;
}

/* ============================
   User Stats Page
   ============================ */

/* Tabs */
.ustats-tabs {
    display: flex;
    gap: 0;
    border-bottom: 2px solid var(--border-color);
    margin-bottom: 0;
}

.ustats-tab {
    padding: 0.75rem 1.25rem;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--secondary);
    white-space: nowrap;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.ustats-tab:hover {
    color: var(--primary);
}

.ustats-tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
    font-weight: 600;
}

.ustats-tab-content {
    display: none;
}

.ustats-tab-content.active {
    display: block;
}

/* Header Actions */
.ustats-header-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    margin-left: auto;
}

.ustats-header-actions .btn {
    padding: 0.4rem 0.75rem;
    font-size: 0.8rem;
}

/* Filters */
.ustats-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: flex-end;
    padding: 1rem;
    background: var(--card-bg);
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
    margin-bottom: 1.25rem;
}

.ustats-filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.ustats-filter-group label {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--secondary);
}

.ustats-filter-group select,
.ustats-filter-group input {
    padding: 0.45rem 0.6rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    background: var(--bg);
    color: var(--text);
    font-size: 0.82rem;
    min-width: 130px;
}

.ustats-filter-group select:focus,
.ustats-filter-group input:focus {
    border-color: var(--primary);
    outline: none;
    box-shadow: 0 0 0 2px rgba(79, 70, 229, 0.15);
}

.ustats-filter-actions {
    display: flex;
    gap: 0.4rem;
    align-items: flex-end;
    margin-left: auto;
}

/* Activity Table */
.ustats-data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.82rem;
}

.ustats-data-table thead {
    background: var(--primary);
    color: #fff;
}

.ustats-data-table th {
    padding: 0.65rem 0.6rem;
    text-align: left;
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.ustats-data-table td {
    padding: 0.6rem;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
}

.ustats-data-table tbody tr:hover {
    background: rgba(79, 70, 229, 0.04);
}

.ustats-data-table tbody tr:nth-child(even) {
    background: var(--hover-bg);
}

.ustats-data-table tbody tr:nth-child(even):hover {
    background: rgba(79, 70, 229, 0.06);
}

/* Checkbox Cell */
.ustats-checkbox-cell {
    text-align: center;
    vertical-align: middle;
    width: 35px;
}

/* User Cell */
.ustats-user-cell {
    min-width: 140px;
}

.ustats-user-email {
    font-weight: 600;
    font-size: 0.8rem;
    color: var(--text);
    word-break: break-word;
}

.ustats-user-name {
    font-size: 0.72rem;
    color: var(--secondary);
    margin-top: 0.1rem;
}

/* Action Badge */
.ustats-action-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: capitalize;
}

.ustats-action-badge i {
    font-size: 0.72rem;
}

.ustats-category-label {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--secondary);
    margin-top: 0.15rem;
}

/* Description */
.ustats-desc {
    max-width: 260px;
    word-break: break-word;
    color: var(--secondary);
    font-size: 0.8rem;
    line-height: 1.4;
}

/* Page Badge */
.ustats-page-badge {
    display: inline-block;
    padding: 0.15rem 0.45rem;
    background: rgba(79, 70, 229, 0.08);
    color: var(--primary);
    border-radius: 4px;
    font-size: 0.72rem;
    font-weight: 500;
    text-transform: uppercase;
}

/* Timestamp */
.ustats-ts {
    white-space: nowrap;
    font-size: 0.78rem;
}

.ustats-ts-time {
    font-size: 0.68rem;
    color: var(--secondary);
    margin-top: 0.1rem;
}

/* Pagination */
.ustats-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    padding: 1rem 0;
}

.ustats-pagination .btn {
    padding: 0.4rem 0.8rem;
    font-size: 0.8rem;
}

.ustats-page-info {
    font-size: 0.82rem;
    color: var(--secondary);
    font-weight: 500;
}

/* Mobile Cards */
.ustats-cards {
    display: none;
}

.ustats-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 0.85rem;
    margin-bottom: 0.6rem;
}

.ustats-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.35rem;
}

.ustats-card-ts {
    font-size: 0.68rem;
    color: var(--secondary);
}

.ustats-card-user {
    font-size: 0.78rem;
    color: var(--text);
    margin-bottom: 0.25rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-wrap: wrap;
}

.ustats-card-desc {
    font-size: 0.78rem;
    color: var(--secondary);
    margin-bottom: 0.2rem;
    line-height: 1.4;
}

.ustats-card-page {
    font-size: 0.7rem;
    color: var(--primary);
}

/* Summary Cards */
.ustats-summary-cards {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.ustats-summary-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 1.25rem;
    text-align: center;
}

.ustats-summary-card i {
    font-size: 1.4rem;
    color: var(--primary);
    margin-bottom: 0.5rem;
}

.ustats-summary-card .ustats-summary-value {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--text);
    line-height: 1.2;
}

.ustats-summary-card .ustats-summary-label {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--secondary);
    margin-top: 0.25rem;
}

/* Chart Grid */
.ustats-chart-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.25rem;
}

.ustats-chart-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 1.25rem;
}

.ustats-chart-card h4 {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.ustats-chart-card h4 i {
    color: var(--primary);
    font-size: 0.8rem;
}

.ustats-chart-card canvas {
    max-height: 280px;
}

/* ============================
   Student Calling Page
   ============================ */

.calling-page {
    max-width: 1200px;
}

.calling-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.calling-title {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--dark);
}

.calling-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: flex-end;
    margin-bottom: 1rem;
    padding: 0.85rem 1rem;
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.calling-control-group {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.calling-control-group label {
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--secondary);
}

.calling-date-input,
.calling-teacher-select {
    padding: 0.4rem 0.65rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 0.88rem;
    background: var(--white);
    min-width: 180px;
}

.calling-teacher-label {
    font-size: 0.92rem;
    font-weight: 500;
    padding: 0.4rem 0;
}

.view-toggle-btns {
    display: flex;
    gap: 0.4rem;
}

.toggle-label {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.3rem 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.85rem;
    background: var(--white);
    transition: var(--transition);
}

.toggle-label input[type="radio"] {
    display: none;
}

.toggle-label.active,
.toggle-label:has(input:checked) {
    background: var(--primary);
    color: var(--white);
    border-color: var(--primary);
}

.calling-banner {
    background: #FFF3CD;
    border: 1px solid #FFE08A;
    border-radius: var(--radius-sm);
    padding: 0.65rem 1rem;
    font-size: 0.88rem;
    margin-bottom: 0.85rem;
}

/* Progress summary bar */
.calling-progress-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1.25rem;
    padding: 0.6rem 1rem;
    background: var(--white);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow);
    margin-bottom: 0.85rem;
    font-size: 0.85rem;
    align-items: center;
}

.pb-item {
    color: var(--secondary);
}

.pb-item b {
    color: var(--dark);
}

.pb-called b {
    color: var(--primary);
}

.pb-willcome b {
    color: var(--success);
}

.pb-wontcome b {
    color: var(--danger);
}

.pb-pending b {
    color: #6C757D;
}

.pb-sep {
    color: var(--border-color);
}

/* Table row highlights */
.calling-row-done {
    background-color: #f0fff4 !important;
}

.calling-row-done:hover {
    background-color: #e0f7ea !important;
}

/* Will Not Come → very light orange */
.calling-row-wontcome {
    background-color: #fff4e8 !important;
}

.calling-row-wontcome:hover {
    background-color: #ffe8cc !important;
}

/* Not Interested Anymore → very light red */
.calling-row-notinterested {
    background-color: #fff1f1 !important;
}

.calling-row-notinterested:hover {
    background-color: #ffdede !important;
}

/* Other → very light blue */
.calling-row-other {
    background-color: #eff6ff !important;
}

.calling-row-other:hover {
    background-color: #dbeafe !important;
}

/* Not yet called → white (explicit reset in case theme overrides) */
.calling-table tbody tr:not([class*="calling-row"]) {
    background-color: #ffffff !important;
}

/* Call buttons */
.btn-call {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    position: relative;
    padding: 0.3rem 0.7rem;
    border-radius: 20px;
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--white);
    text-decoration: none;
    min-height: 32px;
    white-space: nowrap;
    transition: opacity 0.2s;
}

.call-press-badge {
    position: absolute;
    top: -7px;
    right: -5px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 999px;
    background: #dc2626;
    color: #fff;
    font-size: 0.65rem;
    font-weight: 700;
    line-height: 18px;
    text-align: center;
    box-shadow: 0 0 0 2px #fff;
    pointer-events: none;
}

.btn-call:hover {
    opacity: 0.85;
    text-decoration: none;
    color: var(--white);
}

.btn-call-green {
    background: #28a745;
}

.btn-call-blue {
    background: #007bff;
}

.btn-call-orange {
    background: #fd7e14;
}

.btn-call-lg {
    padding: 0.55rem 1.25rem;
    font-size: 0.95rem;
    min-height: 44px;
    border-radius: 24px;
    width: 100%;
    justify-content: center;
}

.calling-name-only {
    font-size: 0.82rem;
    color: var(--secondary);
}

/* Status select */
.calling-status-select {
    padding: 0.3rem 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 0.82rem;
    min-width: 130px;
    background: var(--white);
}

/* Remarks input */
.calling-remarks-input {
    padding: 0.3rem 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 0.82rem;
    width: 100%;
    min-width: 120px;
}

.calling-table-header {
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.calling-context-label {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--secondary);
}

.calling-name-cell {
    font-weight: 500;
}

.calling-payment-pill {
    display: inline-block;
    padding: 0.18rem 0.52rem;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 700;
    line-height: 1.2;
}

.calling-payment-paid {
    background: #dcfce7;
    color: #166534;
}

.calling-payment-not-paid {
    background: #ffedd5;
    color: #9a3412;
}

.calling-payment-never-paid {
    background: #fee2e2;
    color: #991b1b;
}

.calling-table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* On mobile, stack controls vertically */
@media (max-width: 768px) {

    /* responsive.css hides .table-container globally on mobile — override for calling */
    .calling-table-wrapper {
        display: block !important;
    }
}

@media (max-width: 640px) {
    .calling-controls {
        flex-direction: column;
        align-items: stretch;
        gap: 0.65rem;
    }

    .calling-control-group {
        width: 100%;
    }

    .calling-date-input,
    .calling-teacher-select,
    .calling-search-input {
        width: 100%;
        min-width: 0;
        box-sizing: border-box;
    }

    .calling-table {
        font-size: 0.78rem;
    }
}

/* Search input */
.calling-search-input {
    padding: 0.42rem 0.7rem;
    border: 1px solid var(--border, #ddd);
    border-radius: 6px;
    font-size: 0.88rem;
    background: var(--input-bg, #fff);
    color: var(--text, #222);
    min-width: 200px;
    transition: border-color 0.18s;
}

.calling-search-input:focus {
    outline: none;
    border-color: var(--primary, #3b82f6);
}

/* Sortable column headers */
.calling-th-sort {
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
    transition: background 0.15s;
}

.calling-th-sort:hover {
    background: var(--table-hover, rgba(59, 130, 246, 0.07));
}

.calling-th-sort-active {
    color: var(--primary, #3b82f6);
}

/* Filter badge ("N of M shown") */
.calling-filter-badge {
    font-size: 0.78rem;
    padding: 0.18rem 0.6rem;
    border-radius: 99px;
    background: var(--primary-light, #dbeafe);
    color: var(--primary, #3b82f6);
    font-weight: 600;
    margin-left: 0.6rem;
}

.calling-loading {
    padding: 2rem;
    text-align: center;
    color: var(--secondary);
    font-size: 0.95rem;
}

.calling-no-phone {
    font-size: 0.8rem;
    color: #9CA3AF;
}

/* Card view — Kindle-style layout */
.calling-card-outer {
    display: flex;
    align-items: stretch;
    gap: 0;
    width: 100%;
}

.calling-kindle-btn {
    flex: 0 0 28px;
    width: 28px;
    background: var(--primary-light, #dbeafe);
    border: none;
    border-radius: 6px;
    cursor: pointer;
    color: var(--primary, #3b82f6);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, color 0.15s;
    padding: 0;
    font-size: 0.9rem;
    align-self: stretch;
}

.calling-kindle-btn:hover:not(:disabled) {
    background: var(--primary, #3b82f6);
    color: #fff;
}

.calling-kindle-btn:disabled {
    opacity: 0.2;
    cursor: not-allowed;
}

.calling-card-inner {
    flex: 1;
    min-width: 0;
    padding: 0 0.5rem;
}

.card-counter {
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--secondary);
    text-align: center;
    margin-bottom: 0.6rem;
}

/* keep old .calling-card-nav hidden if it ever appears */
.calling-card-nav {
    display: none;
}

.calling-card {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    padding: 1.5rem;
    max-width: 520px;
    margin: 0 auto;
    transition: background 0.2s;
}

.calling-card-done {
    background: #f0fff4;
}

.calling-card-group-badge {
    display: inline-block;
    background: var(--primary);
    color: var(--white);
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.2rem 0.65rem;
    border-radius: 12px;
    margin-bottom: 0.5rem;
}

.calling-card-name {
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.calling-card-date {
    font-size: 0.82rem;
    color: var(--secondary);
    margin-bottom: 1rem;
}

.calling-card-payment {
    margin-bottom: 0.9rem;
}

.calling-card-phones {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    margin-bottom: 1.1rem;
}

.calling-card-status,
.calling-card-remarks {
    margin-bottom: 0.85rem;
}

.calling-card-status label,
.calling-card-remarks label {
    display: block;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--secondary);
    margin-bottom: 0.35rem;
}

.calling-card-status .calling-status-select {
    width: 100%;
}

.calling-card-remarks .calling-remarks-input {
    width: 100%;
}

/* ============================
   Teacher Management Page
   ============================ */

.tm-page {
    max-width: 1100px;
}

.tm-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.25rem;
}

.tm-header h3 {
    font-size: 1.2rem;
    font-weight: 600;
}

.tm-panels {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

@media (max-width: 768px) {
    .tm-panels {
        grid-template-columns: 1fr;
    }
}

.tm-panel {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.25rem;
}

.tm-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.tm-panel-header h4 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--dark);
}

.tm-table {
    font-size: 0.85rem;
}

.tm-email-cell {
    font-size: 0.78rem;
    color: var(--secondary);
    word-break: break-all;
}

.tm-inactive-row {
    opacity: 0.55;
}

.tm-badge {
    display: inline-block;
    background: #e7f0ff;
    color: #2563eb;
    border: 1px solid #bcd1ff;
    border-radius: 10px;
    padding: 0 6px;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1.6;
}

.tm-actions {
    display: flex;
    gap: 0.35rem;
}

/* Toggle switch */
.tm-toggle {
    position: relative;
    display: inline-block;
    width: 38px;
    height: 20px;
    cursor: pointer;
}

.tm-toggle input {
    display: none;
}

.tm-toggle-slider {
    position: absolute;
    inset: 0;
    background: #ccc;
    border-radius: 20px;
    transition: 0.3s;
}

.tm-toggle-slider::before {
    content: '';
    position: absolute;
    width: 14px;
    height: 14px;
    left: 3px;
    bottom: 3px;
    background: white;
    border-radius: 50%;
    transition: 0.3s;
}

.tm-toggle input:checked+.tm-toggle-slider {
    background: var(--success);
}

.tm-toggle input:checked+.tm-toggle-slider::before {
    transform: translateX(18px);
}

/* Teacher cards (multi-email layout) */
.tm-teacher-card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
    margin-bottom: 0.85rem;
    box-shadow: var(--shadow);
    transition: opacity 0.2s;
}

.tm-inactive-card {
    opacity: 0.55;
}

.tm-teacher-card-header {
    margin-bottom: 0.6rem;
}

.tm-teacher-name-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.35rem;
}

.tm-teacher-name {
    font-size: 1rem;
    font-weight: 700;
    color: var(--dark);
}

.tm-teacher-groups {
    font-size: 0.82rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
    align-items: center;
}

.tm-email-list {
    border-top: 1px solid var(--border);
    padding-top: 0.5rem;
    margin-bottom: 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.tm-email-row {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.82rem;
}

.tm-email-icon {
    color: #9CA3AF;
    font-size: 0.78rem;
    flex-shrink: 0;
}

.tm-email-addr {
    flex: 1;
    color: var(--secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tm-remove-email-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: #9CA3AF;
    padding: 0 4px;
    font-size: 0.78rem;
    line-height: 1;
    transition: color 0.15s;
}

.tm-remove-email-btn:hover {
    color: #e74c3c;
}

.tm-no-email {
    font-size: 0.8rem;
    color: #f39c12;
    font-style: italic;
}

.tm-teacher-card-footer {
    border-top: 1px solid var(--border);
    padding-top: 0.5rem;
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
}

.tm-none-label {
    color: #9CA3AF;
    font-style: italic;
    font-size: 0.82rem;
}

.tm-legacy-email {
    color: #f39c12;
    font-size: 0.82rem;
}

.tm-migrate-info {
    background: #eff6ff;
    border: 1px solid #bcd1ff;
    border-radius: var(--radius);
    padding: 0.6rem 0.75rem;
    font-size: 0.82rem;
    color: #1d4ed8;
    margin-top: 0.5rem;
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--secondary);
    transition: background 0.15s, color 0.15s;
}

.btn-outline:hover {
    background: var(--light);
    color: var(--dark);
}

/* ============================
   Calling Report Page
   ============================ */

.report-page {
    max-width: 1100px;
}

.report-page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.report-page-title {
    font-size: 1.1rem;
    font-weight: 600;
}

.report-print-title {
    display: none;
}

.report-section {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.25rem;
    margin-bottom: 1.25rem;
}

.report-section-title {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--dark);
    display: flex;
    align-items: center;
    gap: 0.45rem;
}

.report-section-title i {
    color: var(--primary);
}

/* KPI cards */
.report-kpi-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.85rem;
    justify-content: flex-start;
}

.report-kpi-card {
    background: var(--light);
    border-radius: var(--radius);
    padding: 1rem 1.4rem;
    min-width: 130px;
    text-align: center;
    border-top: 4px solid #ccc;
    flex: 1 1 120px;
}

.report-kpi-card .kpi-number {
    font-size: 2rem;
    font-weight: 700;
    line-height: 1;
    margin-bottom: 0.3rem;
}

.report-kpi-card .kpi-label {
    font-size: 0.78rem;
    color: var(--secondary);
    font-weight: 500;
}

.report-kpi-card.attending {
    border-top-color: var(--success);
}

.report-kpi-card.attending .kpi-number {
    color: var(--success);
}

.report-kpi-card.not-coming {
    border-top-color: var(--danger);
}

.report-kpi-card.not-coming .kpi-number {
    color: var(--danger);
}

.report-kpi-card.not-interested {
    border-top-color: #6f42c1;
}

.report-kpi-card.not-interested .kpi-number {
    color: #6f42c1;
}

.report-kpi-card.called {
    border-top-color: var(--primary);
}

.report-kpi-card.called .kpi-number {
    color: var(--primary);
}

.report-kpi-card.pending {
    border-top-color: var(--secondary);
}

.report-kpi-card.pending .kpi-number {
    color: var(--secondary);
}

/* Charts row */
.report-charts-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
    align-items: start;
}

@media (max-width: 768px) {
    .report-charts-row {
        grid-template-columns: 1fr;
    }
}

.report-table {
    font-size: 0.84rem;
}

/* Tabs */
.report-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-bottom: 0.75rem;
}

.report-tab-btn {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.4rem 0.85rem;
    border: 1px solid var(--border-color);
    background: var(--white);
    border-radius: 20px;
    font-size: 0.82rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

.report-tab-btn:hover {
    background: var(--light);
}

.report-tab-btn.active {
    background: var(--primary);
    color: var(--white);
    border-color: var(--primary);
}

.report-tab-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 5px;
    background: rgba(0, 0, 0, 0.12);
    border-radius: 10px;
    font-size: 0.72rem;
    font-weight: 700;
}

.badge-red {
    background: var(--danger) !important;
    color: white;
}

.report-tab-btn.active .report-tab-badge {
    background: rgba(255, 255, 255, 0.3);
}

.report-tab-actions {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 0.65rem;
}

.report-export-btn {
    font-size: 0.82rem;
}

.empty-hint {
    color: var(--secondary);
    font-size: 0.88rem;
    padding: 0.5rem 0;
}

/* ============================
   Print Styles
   ============================ */
@media print {

    #sidebar,
    .top-bar,
    .user-info-bar,
    .no-print,
    .report-tabs,
    .report-tab-actions,
    .report-page-header {
        display: none !important;
    }

    .print-only {
        display: block !important;
    }

    .report-print-title {
        display: block;
        font-size: 1.25rem;
        font-weight: 700;
        margin-bottom: 1rem;
    }

    .main-content {
        margin-left: 0 !important;
        padding: 0.5rem !important;
    }

    .report-section {
        box-shadow: none;
        border: 1px solid #ddd;
        page-break-inside: avoid;
    }

    table {
        page-break-inside: avoid;
    }
}