/* === Say & Play Teacher Portal === */
/* Google Fonts loaded via <link> in HTML head for better performance */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --bg:           #F3E4C9;
    --brown:        #5c3d1e;
    --brown-mid:    #8b6340;
    --brown-light:  #faf3e8;
    --brown-border: #b8936a;
    --olive:        #BAC09C;
    --olive-dark:   #6b7050;
    --white:        #ffffff;
    --text:         #3d2b1f;
    --text-muted:   #8b7060;
    --green:        #4a7a35;
    --green-light:  #e8f5e0;
    --red:          #c0392b;
    --red-light:    #fdecea;
    --orange:       #d4621a;
    --orange-light: #fff0e0;
    --blue:         #2563eb;
    --blue-light:   #dbeafe;
    --radius:       14px;
    --radius-sm:    10px;
    --border:       2px solid var(--brown-border);
    --shadow:       0 2px 10px rgba(91,61,30,0.08);
    --shadow-md:    0 4px 20px rgba(91,61,30,0.13);
}

body {
    font-family: 'Nunito', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 15px;
    line-height: 1.55;
}

/* === Navbar === */
.navbar {
    background: var(--olive-dark);
    padding: 0 1.5rem;
    height: 64px;
    display: flex; align-items: center; justify-content: space-between;
    position: sticky; top: 0; z-index: 200;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
}
.nav-logo { height: 48px; width: auto; }
@media (max-width: 480px) { .nav-logo { height: 36px; } }
.nav-right { display: flex; align-items: center; gap: 1.25rem; }
.nav-icon-wrap { display: flex; align-items: center; gap: 0.5rem; color: rgba(255,255,255,0.9); font-size: 0.9rem; font-weight: 700; }
.nav-logout { color: rgba(255,255,255,0.75); text-decoration: none; font-size: 0.88rem; font-weight: 700; }
.nav-logout:hover { color: #fff; }
.role-badge {
    background: var(--olive); color: var(--olive-dark);
    font-size: 0.7rem; font-weight: 900; padding: 0.15rem 0.6rem;
    border-radius: 20px; text-transform: uppercase; letter-spacing: 0.05em;
}

/* === Login === */
.login-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: var(--bg); }
.login-box {
    background: var(--white); border-radius: var(--radius);
    border: var(--border); box-shadow: var(--shadow-md);
    padding: 2rem 2.25rem; width: 100%; max-width: 420px;
}
.login-logo { text-align: center; margin-bottom: 1.75rem; }
.login-logo img { height: 52px; width: auto; margin-bottom: 0.5rem; }
.login-logo h1 { font-size: 1.6rem; color: var(--olive-dark); font-weight: 900; }
.login-logo p  { color: var(--text-muted); font-size: 0.9rem; font-weight: 600; }

.tabs { display: flex; margin-bottom: 1.5rem; border-bottom: 2px solid var(--bg); }
.tab {
    flex: 1; text-align: center; padding: 0.65rem; text-decoration: none;
    color: var(--text-muted); font-size: 0.9rem; font-weight: 800;
    border-bottom: 2px solid transparent; margin-bottom: -2px; transition: color 0.15s;
}
.tab.active { color: var(--olive-dark); border-bottom-color: var(--olive-dark); }
.tab:hover:not(.active) { color: var(--text); }
.switch-tab { text-align: center; margin-top: 1rem; font-size: 0.85rem; color: var(--text-muted); font-weight: 600; }
.switch-tab a { color: var(--olive-dark); text-decoration: none; font-weight: 800; }
.hint { font-size: 0.82rem; color: var(--text-muted); text-align: center; margin-top: 0.75rem; font-weight: 600; }

/* === Alerts === */
.alert { padding: 0.85rem 1rem; border-radius: var(--radius-sm); margin-bottom: 1rem; font-size: 0.9rem; font-weight: 700; }
.alert-error   { background: var(--red-light);   color: var(--red);   border-left: 4px solid var(--red); }
.alert-success { background: var(--green-light); color: var(--green); border-left: 4px solid var(--green); }

/* === Forms === */
.form-group { margin-bottom: 1rem; }
.form-group label {
    display: block; font-size: 0.78rem; font-weight: 800; color: var(--text-muted);
    text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 0.4rem;
}
.form-group input,
.form-group select,
.form-group textarea {
    width: 100%; padding: 0.65rem 0.9rem; border: var(--border);
    border-radius: var(--radius-sm); font-size: 0.95rem; font-family: 'Nunito', sans-serif;
    color: var(--text); background: var(--white); transition: border-color 0.15s;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus { outline: none; border-color: var(--olive-dark); }
.form-group textarea { resize: vertical; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 520px) { .form-row { grid-template-columns: 1fr; } }
.form-actions { display: flex; justify-content: flex-end; gap: 0.75rem; margin-top: 0.5rem; }

/* === Buttons === */
.btn {
    display: inline-block; padding: 0.65rem 1.4rem; border-radius: var(--radius-sm);
    font-size: 0.95rem; font-weight: 800; cursor: pointer;
    border: none; text-decoration: none; transition: opacity 0.15s, transform 0.1s;
    font-family: 'Nunito', sans-serif;
}
.btn:active { transform: scale(0.98); }
.btn-primary   { background: var(--olive-dark); color: var(--white); }
.btn-primary:hover { opacity: 0.9; }
.btn-secondary { background: var(--brown-light); color: var(--text); border: var(--border); }
.btn-secondary:hover { background: var(--bg); }
.btn-full { width: 100%; text-align: center; }

/* === Lesson detail page container === */
.container { max-width: 800px; margin: 0 auto; padding: 1.5rem 1rem 4rem; }

/* === Section titles === */
.section-title {
    font-size: 0.78rem; font-weight: 900; color: var(--brown-mid);
    text-transform: uppercase; letter-spacing: 0.07em; margin-bottom: 0.75rem; margin-top: 2rem;
}
.empty-state { color: var(--text-muted); font-size: 0.9rem; padding: 1rem 0; font-style: italic; font-weight: 600; }

/* === Cards (lesson detail) === */
.card {
    background: var(--white); border-radius: var(--radius);
    border: var(--border); box-shadow: var(--shadow);
    padding: 1.25rem 1.5rem; margin-bottom: 1rem;
}
.card h3 {
    font-size: 0.82rem; font-weight: 900; color: var(--brown-mid);
    text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 1rem;
}

/* === Back link === */
.back-link { display: inline-block; color: var(--text-muted); text-decoration: none; margin-bottom: 1rem; font-size: 0.9rem; font-weight: 700; }
.back-link:hover { color: var(--olive-dark); }

/* === Lesson header (detail page) === */
.lesson-header {
    background: var(--white); border-radius: var(--radius); border: var(--border);
    box-shadow: var(--shadow-md); padding: 1.25rem 1.5rem; margin-bottom: 1rem;
    border-left: 5px solid var(--olive-dark);
}
.lesson-header h2 { font-size: 1.2rem; font-weight: 900; margin-bottom: 0.2rem; }
.lesson-header-date { color: var(--text-muted); font-size: 0.9rem; font-weight: 600; }

/* === Student chips === */
.student-list { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.student-chip {
    background: var(--green-light); color: var(--green);
    border-radius: 20px; padding: 0.3rem 0.85rem;
    font-size: 0.88rem; font-weight: 700;
    display: flex; align-items: center; gap: 0.4rem;
    border: 1.5px solid var(--green);
}
.level-tag {
    background: var(--white); color: var(--text-muted);
    border-radius: 10px; padding: 0 0.4rem; font-size: 0.75rem; font-weight: 700;
}

/* === Status badges === */
.status-badge {
    font-size: 0.75rem; font-weight: 800;
    padding: 0.2rem 0.65rem; border-radius: 20px; white-space: nowrap;
}
.status-scheduled { background: var(--blue-light);   color: var(--blue); }
.status-completed { background: var(--green-light);  color: var(--green); }
.status-cancelled { background: var(--red-light);    color: var(--red); }
.status-partial   { background: var(--orange-light); color: var(--orange); }

/* ===================== CALENDAR ===================== */
.cal-container { max-width: 1200px; margin: 0 auto; padding: 1.25rem 1rem 4rem; }

/* Dashboard cards */
.dashboard-section { margin-bottom: 1.25rem; }
.dashboard-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 1rem; }
.dash-card {
    background: var(--white); border: var(--border); border-radius: var(--radius);
    padding: 1rem 1.25rem; box-shadow: var(--shadow);
    display: flex; align-items: center; gap: 1rem;
}
.dash-card-chart { flex-direction: column; align-items: stretch; grid-column: span 2; }
@media (max-width: 700px) { .dash-card-chart { grid-column: span 1; } }
.dash-card-icon { color: var(--olive-dark); opacity: 0.7; flex-shrink: 0; }
.dash-card-body { display: flex; flex-direction: column; }
.dash-card-num { font-size: 1.8rem; font-weight: 900; color: var(--brown); line-height: 1; }
.dash-card-label { font-size: 0.7rem; font-weight: 800; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; margin-top: 0.15rem; }

/* Mini bar chart */
.dash-chart { display: flex; align-items: flex-end; gap: 6px; height: 80px; padding-top: 0.25rem; }
.chart-bar-wrap { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; }
.chart-bar {
    width: 100%; min-height: 4px; border-radius: 5px 5px 0 0;
    background: var(--olive); display: flex; align-items: flex-start; justify-content: center;
    transition: height 0.3s;
}
.chart-bar-val { font-size: 0.6rem; font-weight: 900; color: var(--white); padding-top: 2px; }
.chart-bar-label { font-size: 0.62rem; font-weight: 700; color: var(--text-muted); margin-top: 0.25rem; }

/* Toolbar */
.cal-toolbar {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 1rem; gap: 1rem; flex-wrap: wrap;
}
.cal-toolbar-right { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.cal-nav { display: flex; align-items: center; gap: 0.75rem; }
.cal-nav-btn {
    background: var(--white); border: var(--border); border-radius: var(--radius-sm);
    width: 36px; height: 36px; display: flex; align-items: center; justify-content: center;
    cursor: pointer; text-decoration: none; color: var(--text); font-size: 1rem; font-weight: 900;
    transition: background 0.15s;
}
.cal-nav-btn:hover { background: var(--brown-light); }
.cal-week-label { font-size: 0.95rem; font-weight: 800; color: var(--text); }
.cal-today-btn {
    background: var(--olive-dark); color: var(--white); text-decoration: none;
    padding: 0.3rem 0.9rem; border-radius: 20px; font-size: 0.8rem; font-weight: 800;
}
.cal-filter select {
    padding: 0.45rem 0.85rem; border: var(--border); border-radius: var(--radius-sm);
    font-family: 'Nunito', sans-serif; font-size: 0.88rem; font-weight: 700;
    background: var(--white); color: var(--text); cursor: pointer;
}

/* Calendar table */
.cal-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: var(--radius); border: var(--border); background: var(--white); box-shadow: var(--shadow-md); }
.cal-table { width: 100%; border-collapse: collapse; min-width: 700px; }

.cal-table thead th { background: var(--brown-light); padding: 0.6rem 0.5rem; text-align: center; border-bottom: var(--border); }
.cal-time-col { width: 54px; }
.cal-day-head { font-size: 0.8rem; }
.cal-day-name { display: block; font-size: 0.7rem; font-weight: 800; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; }
.cal-day-num  { display: inline-block; font-size: 1rem; font-weight: 900; color: var(--text); margin-top: 0.15rem; width: 30px; height: 30px; line-height: 30px; border-radius: 50%; text-align: center; }
.cal-day-head.today .cal-day-name { color: var(--olive-dark); }
.today-circle { background: var(--olive-dark); color: var(--white) !important; }

.cal-table tbody tr:hover { background: #fdf7ee; }
.cal-time {
    padding: 0 0.5rem; font-size: 0.72rem; font-weight: 800;
    color: var(--text-muted); text-align: right; vertical-align: top;
    padding-top: 0.4rem; border-right: var(--border); white-space: nowrap;
    width: 54px;
}
.cal-cell {
    border-bottom: 1px solid var(--bg); border-right: 1px solid var(--bg);
    vertical-align: top; padding: 0.2rem; height: 52px; min-width: 90px;
    position: relative;
}
.cal-cell.today-col { background: #fefaf3; }
.cal-table tbody tr:last-child td { border-bottom: none; }

/* Lesson blocks */
.cal-lesson {
    border-radius: 8px; padding: 0.25rem 0.45rem; margin-bottom: 2px;
    cursor: pointer; transition: opacity 0.15s, transform 0.1s;
    border-left: 3px solid transparent;
    overflow: hidden;
}
.cal-lesson:hover { opacity: 0.85; transform: scale(1.02); }
.cal-lesson-scheduled { background: var(--blue-light);   border-color: var(--blue);   color: var(--blue); }
.cal-lesson-completed { background: var(--green-light);  border-color: var(--green);  color: var(--green); }
.cal-lesson-cancelled { background: var(--red-light);    border-color: var(--red);    color: var(--red); opacity: 0.6; }
.cal-lesson-partial   { background: var(--orange-light); border-color: var(--orange); color: var(--orange); }

.cal-lesson-time  { font-size: 0.65rem; font-weight: 900; opacity: 0.7; }
.cal-lesson-group { font-size: 0.75rem; font-weight: 900; line-height: 1.2; }
.cal-lesson-topic { font-size: 0.65rem; opacity: 0.75; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* === Modal === */
.modal-overlay {
    display: none; position: fixed; inset: 0;
    background: rgba(61,43,31,0.45); z-index: 500;
    align-items: flex-start; justify-content: center;
    overflow-y: auto; padding: 1.5rem 1rem;
}
.modal-overlay.active { display: flex; }
.modal-box {
    background: var(--white); border-radius: var(--radius); border: var(--border);
    box-shadow: var(--shadow-md); padding: 2rem 2.25rem;
    width: 100%; max-width: 420px; position: relative;
    margin: auto;
}
@media (max-width: 520px) {
    .modal-overlay { padding: 0.75rem 0.5rem; }
    .modal-box { padding: 1.5rem 1.25rem; }
}
.modal-close {
    position: absolute; top: 1rem; right: 1rem;
    background: none; border: none; font-size: 1.1rem; cursor: pointer;
    color: var(--text-muted); font-weight: 900;
}
.modal-close:hover { color: var(--text); }
.modal-title { font-size: 1.3rem; font-weight: 900; margin-bottom: 0.4rem; color: var(--text); }
.modal-time  { font-size: 0.9rem; color: var(--text-muted); font-weight: 700; margin-bottom: 1.5rem; }
.modal-actions { display: flex; gap: 0.75rem; }
.modal-fields { margin-bottom: 1.25rem; }
.modal-fields .form-group { margin-bottom: 0.85rem; }
.modal-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0.85rem; }
@media (max-width: 480px) { .modal-row { grid-template-columns: 1fr; } }

/* View toggle */
.view-toggle { display: flex; border: var(--border); border-radius: var(--radius-sm); overflow: hidden; }
.view-btn {
    padding: 0.4rem 1rem; font-size: 0.85rem; font-weight: 800;
    text-decoration: none; color: var(--text-muted); background: var(--white);
    transition: background 0.15s, color 0.15s;
}
.view-btn.active { background: var(--olive-dark); color: var(--white); }
.view-btn:hover:not(.active) { background: var(--brown-light); }

/* === MONTH VIEW === */
.month-wrap {
    border-radius: var(--radius); border: var(--border);
    background: var(--white); box-shadow: var(--shadow-md);
    overflow-x: auto; -webkit-overflow-scrolling: touch;
}
.month-grid { display: grid; grid-template-columns: repeat(7, minmax(100px, 1fr)); min-width: 560px; }
.month-head {
    padding: 0.6rem 0.5rem; text-align: center;
    font-size: 0.75rem; font-weight: 800; color: var(--text-muted);
    text-transform: uppercase; background: var(--brown-light);
    border-bottom: var(--border);
}
.month-cell {
    min-height: 90px; padding: 0.35rem; position: relative;
    border-bottom: 1px solid var(--bg); border-right: 1px solid var(--bg);
}
.month-cell.empty { background: #faf8f3; }
.month-cell.month-today { background: #fefaf3; }
.month-day-num {
    display: inline-block; font-size: 0.85rem; font-weight: 800;
    color: var(--text); width: 26px; height: 26px; line-height: 26px;
    text-align: center; border-radius: 50%; margin-bottom: 0.2rem;
}
.month-lessons { display: flex; flex-direction: column; gap: 2px; }
.month-pill {
    font-size: 0.68rem; font-weight: 700;
    padding: 0.15rem 0.35rem; border-radius: 4px;
    cursor: pointer; white-space: nowrap; overflow: hidden;
    text-overflow: ellipsis; transition: opacity 0.15s;
}
.month-pill:hover { opacity: 0.8; }
.month-pill-scheduled { background: var(--blue-light); color: var(--blue); }
.month-pill-completed { background: var(--green-light); color: var(--green); }
.month-pill-cancelled { background: var(--red-light); color: var(--red); opacity: 0.6; }
.month-pill-time { font-weight: 900; margin-right: 0.2rem; }
.month-more { font-size: 0.65rem; color: var(--text-muted); font-weight: 700; padding: 0.1rem 0.35rem; }

@media (max-width: 600px) {
    .month-cell { min-height: 60px; padding: 0.2rem; }
    .month-pill { font-size: 0.6rem; }
    .month-day-num { font-size: 0.75rem; width: 22px; height: 22px; line-height: 22px; }
}

/* === UPCOMING LESSONS === */
.upcoming-section { margin-top: 1.5rem; }
.upcoming-title {
    font-size: 0.82rem; font-weight: 900; color: var(--brown-mid);
    text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 0.75rem;
}
.upcoming-list { display: flex; flex-direction: column; gap: 0.5rem; }
.upcoming-item {
    display: flex; align-items: center; gap: 1rem;
    background: var(--white); border: var(--border); border-radius: var(--radius);
    padding: 0.85rem 1.25rem; text-decoration: none; color: var(--text);
    box-shadow: var(--shadow); transition: transform 0.1s, box-shadow 0.15s;
}
.upcoming-item:hover { transform: translateY(-1px); box-shadow: var(--shadow-md); }
.upcoming-date { text-align: center; min-width: 44px; }
.upcoming-day { display: block; font-size: 1.3rem; font-weight: 900; line-height: 1; color: var(--brown); }
.upcoming-month { display: block; font-size: 0.65rem; font-weight: 800; color: var(--text-muted); text-transform: uppercase; }
.upcoming-info { flex: 1; }
.upcoming-group { font-size: 0.95rem; font-weight: 800; }
.upcoming-meta { font-size: 0.8rem; color: var(--text-muted); font-weight: 600; }

/* === Parent Update card === */
.parent-status-badge {
    display: inline-block; font-size: 0.7rem; font-weight: 800;
    padding: 0.2rem 0.65rem; border-radius: 20px; white-space: nowrap;
    margin-left: 0.5rem; vertical-align: middle; text-transform: none; letter-spacing: 0;
}
.parent-status-draft         { background: #f3f4f6; color: #6b7280; }
.parent-status-ready-for-review { background: var(--orange-light); color: var(--orange); }
.parent-status-approved      { background: var(--green-light); color: var(--green); }
.parent-status-hidden        { background: var(--red-light); color: var(--red); }

.approval-info {
    font-size: 0.82rem; font-weight: 700; color: var(--green);
    background: var(--green-light); border-radius: var(--radius-sm);
    padding: 0.5rem 0.85rem; margin-bottom: 0.5rem;
}
.field-hint {
    font-size: 0.7rem; font-weight: 600; color: var(--text-muted);
    text-transform: none; letter-spacing: 0;
}

/* === Quick Links (lesson detail) === */
.quick-links { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.quick-link-btn {
    display: inline-flex; align-items: center; gap: 0.4rem;
    padding: 0.55rem 1rem; border-radius: var(--radius-sm);
    font-size: 0.88rem; font-weight: 800; text-decoration: none;
    transition: opacity 0.15s, transform 0.1s;
    font-family: 'Nunito', sans-serif;
}
.quick-link-btn:active { transform: scale(0.98); }
.quick-link-btn:hover { opacity: 0.85; }
.ql-zoom       { background: #dbeafe; color: #2563eb; }
.ql-progress   { background: #e8f5e0; color: #4a7a35; }
.ql-homework   { background: #fff0e0; color: #d4621a; }
.ql-wordwall   { background: #f3e8ff; color: #7c3aed; }
.ql-recording  { background: #fdecea; color: #c0392b; }


/* === Pending Reviews Panel (admin calendar) === */
.pending-reviews-panel {
    background: #fff8e1; border: 1.5px solid #f59e0b;
    border-radius: var(--radius); margin-bottom: 1.25rem;
    overflow: hidden;
}
.pending-reviews-header {
    display: flex; align-items: center; gap: 0.6rem;
    padding: 0.75rem 1.25rem; background: #fef3c7;
    font-size: 0.9rem; font-weight: 800; color: #92400e;
    border-bottom: 1px solid #fde68a;
}
.pending-count {
    background: #f59e0b; color: #fff;
    border-radius: 20px; font-size: 0.72rem; font-weight: 900;
    padding: 0.1rem 0.55rem; margin-left: auto;
}
.pending-reviews-list { display: flex; flex-direction: column; }
.pending-review-item {
    display: flex; align-items: center; gap: 1rem;
    padding: 0.75rem 1.25rem; text-decoration: none; color: var(--text);
    border-bottom: 1px solid #fde68a; transition: background 0.15s;
}
.pending-review-item:last-child { border-bottom: none; }
.pending-review-item:hover { background: #fef9e7; }
.pending-review-group { font-weight: 800; font-size: 0.9rem; flex: 1; }
.pending-review-date  { font-size: 0.78rem; color: var(--text-muted); font-weight: 600; }
.pending-review-arrow { font-size: 0.78rem; font-weight: 800; color: #f59e0b; white-space: nowrap; }

/* === Student Picker (group edit modal) === */
.student-picker {
    border: 1.5px solid var(--brown-border);
    border-radius: var(--radius-sm);
    overflow: hidden;
    background: var(--white);
}
.student-picker-search {
    width: 100%; border: none;
    border-bottom: 1.5px solid var(--brown-border);
    padding: 0.55rem 0.75rem;
    font-size: 0.88rem; font-family: inherit;
    background: var(--brown-light);
    outline: none; color: var(--text);
}
.student-picker-list {
    max-height: 210px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}
.student-picker-item {
    display: flex; align-items: center; gap: 0.65rem;
    padding: 0.6rem 0.75rem;
    min-height: 44px;
    border-bottom: 1px solid #f0e8dc;
    cursor: pointer; transition: background 0.12s;
    user-select: none; -webkit-user-select: none;
}
.student-picker-item:last-child { border-bottom: none; }
.student-picker-item:hover, .student-picker-item:active { background: var(--brown-light); }
.student-picker-item input[type="checkbox"] {
    width: 20px; height: 20px; flex-shrink: 0;
    accent-color: var(--olive-dark); cursor: pointer;
}
.student-picker-item span {
    font-size: 0.9rem; font-weight: 700; flex: 1; cursor: pointer;
}
.student-picker-empty {
    padding: 0.85rem; font-size: 0.84rem;
    color: var(--text-muted); text-align: center;
}

/* === Birthday Panel === */
.birthday-panel {
    background: #fdf2f8; border: 1.5px solid #ec4899;
    border-radius: var(--radius); margin-bottom: 1.25rem;
    overflow: hidden;
}
.birthday-panel-header {
    display: flex; align-items: center; gap: 0.6rem;
    padding: 0.75rem 1.25rem; background: #fce7f3;
    font-weight: 800; font-size: 0.9rem; color: #9d174d;
}
.birthday-count {
    background: #ec4899; color: #fff;
    font-size: 0.75rem; font-weight: 800;
    border-radius: 999px;
    padding: 0.1rem 0.55rem; margin-left: auto;
}
.birthday-list { display: flex; flex-direction: column; }
.birthday-item {
    display: flex; align-items: center; gap: 1rem;
    padding: 0.75rem 1.25rem; text-decoration: none; color: var(--text);
    border-bottom: 1px solid #fbcfe8; transition: background 0.15s;
}
.birthday-item:last-child { border-bottom: none; }
.birthday-item:hover { background: #fdf4fb; }
.birthday-item-name { font-weight: 800; font-size: 0.9rem; flex: 1; }
.birthday-item-date  { font-size: 0.78rem; color: var(--text-muted); font-weight: 600; }
.birthday-item-days  { font-size: 0.78rem; font-weight: 800; white-space: nowrap; }
.birthday-item-days.today   { color: #ec4899; }
.birthday-item-days.soon    { color: #d97706; }
.birthday-item-days.upcoming { color: var(--text-muted); }

/* === Alert success === */
.alert-success {
    background: #dcfce7; color: #166534; border: 1px solid #bbf7d0;
    border-radius: var(--radius-sm); padding: 0.85rem 1.1rem;
    font-size: 0.9rem; font-weight: 700; margin-bottom: 1.25rem;
}

/* ═══════════════════════════════════════════════
   PAYMENTS TRACKING
═══════════════════════════════════════════════ */

/* Header row: title + month selector */
.pay-header {
    display: flex; align-items: center; justify-content: space-between;
    flex-wrap: wrap; gap: 0.75rem; margin-bottom: 1.25rem;
}
.pay-month-form { display: flex; align-items: center; }
.pay-month-select {
    background: var(--white); border: var(--border);
    border-radius: var(--radius-sm); padding: 0.45rem 0.85rem;
    font-family: 'Nunito', sans-serif; font-size: 0.88rem; font-weight: 700;
    color: var(--text); cursor: pointer;
}
.pay-month-select:focus { outline: none; border-color: var(--brown); }

/* --- Payments Table --- */
.pay-table-wrap {
    overflow-x: auto;
    border-radius: var(--radius-sm);
    border: var(--border);
}
.pay-table {
    width: 100%; border-collapse: collapse;
    font-size: 0.88rem;
}
.pay-table thead tr {
    background: var(--brown-light);
    border-bottom: 2px solid var(--brown-border);
}
.pay-table th {
    padding: 0.65rem 0.9rem;
    text-align: left; font-weight: 800;
    font-size: 0.75rem; text-transform: uppercase;
    letter-spacing: 0.04em; color: var(--brown-mid);
    white-space: nowrap;
}
.pay-table td {
    padding: 0.65rem 0.9rem;
    border-bottom: 1px solid #ede4d8;
    vertical-align: middle;
    color: var(--text);
}
.pay-table tbody tr:last-child td { border-bottom: none; }
.pay-table tbody tr:hover { background: var(--brown-light); }
.pay-name { font-weight: 800; }
.pay-outstanding { font-weight: 800; color: var(--red); }

/* Row tints */
.pay-row-paid        td:first-child { border-left: 3px solid var(--green); }
.pay-row-partial     td:first-child { border-left: 3px solid var(--orange); }
.pay-row-overdue     td:first-child { border-left: 3px solid var(--red); }
.pay-row-deferred    td:first-child { border-left: 3px solid #94a3b8; }

/* Status badges */
.pay-status {
    display: inline-block; font-size: 0.72rem; font-weight: 800;
    padding: 0.2rem 0.65rem; border-radius: 20px; white-space: nowrap;
}
.pay-status-paid      { background: var(--green-light); color: var(--green); }
.pay-status-partial   { background: var(--orange-light); color: var(--orange); }
.pay-status-overdue   { background: var(--red-light); color: var(--red); }
.pay-status-deferred  { background: #f1f5f9; color: #64748b; }

/* Carryover tag inside table */
.pay-carryover-tag {
    font-size: 0.72rem; font-weight: 800;
    background: #fef3c7; color: #92400e;
    padding: 0.15rem 0.5rem; border-radius: 20px;
}

/* Reminder status text */
.pay-rem-status {
    font-size: 0.78rem; font-weight: 700; color: var(--text-muted);
}

/* --- Reminder Actions Panel --- */
.reminder-list { display: flex; flex-direction: column; gap: 0.6rem; }
.reminder-row {
    display: flex; align-items: center; gap: 1rem;
    background: #fff8e1; border: 1.5px solid #fde68a;
    border-radius: var(--radius-sm); padding: 0.75rem 1rem;
    flex-wrap: wrap;
}
.reminder-info { display: flex; flex-direction: column; flex: 1; min-width: 120px; }
.reminder-name  { font-weight: 800; font-size: 0.92rem; }
.reminder-amount { font-size: 0.78rem; color: var(--orange); font-weight: 700; }
.reminder-contact { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.reminder-channel {
    display: inline-flex; align-items: center; gap: 0.3rem;
    font-size: 0.75rem; font-weight: 800; padding: 0.2rem 0.6rem;
    border-radius: 20px;
}
.reminder-channel-whatsapp { background: #dcfce7; color: #16a34a; }
.reminder-channel-telegram  { background: #dbeafe; color: #2563eb; }
.reminder-phone { font-size: 0.8rem; color: var(--text-muted); font-weight: 600; font-family: monospace; }
.btn-mark-sent {
    background: var(--green); color: #fff;
    border: none; border-radius: var(--radius-sm);
    padding: 0.45rem 1rem; font-size: 0.82rem; font-weight: 800;
    cursor: pointer; font-family: 'Nunito', sans-serif;
    transition: opacity 0.15s;
    white-space: nowrap;
}
.btn-mark-sent:hover { opacity: 0.85; }

/* --- Debt Carryover Panel --- */
.carryover-list { display: flex; flex-direction: column; gap: 0.5rem; }
.carryover-row {
    display: flex; align-items: center; gap: 0.75rem;
    background: #fef9e7; border: 1.5px solid #fde68a;
    border-radius: var(--radius-sm); padding: 0.65rem 1rem;
}
.carryover-name   { font-weight: 800; font-size: 0.9rem; flex: 1; }
.carryover-amount {
    font-size: 0.78rem; font-weight: 800;
    color: #92400e; background: #fef3c7;
    padding: 0.15rem 0.55rem; border-radius: 20px;
    white-space: nowrap;
}

/* Payments — mobile */
@media (max-width: 640px) {
    .pay-header { flex-direction: column; align-items: flex-start; }
    .pay-table th, .pay-table td { padding: 0.5rem 0.6rem; font-size: 0.8rem; }
    .reminder-row { flex-direction: column; align-items: flex-start; gap: 0.5rem; }
    .btn-mark-sent { width: 100%; text-align: center; }
    .carryover-row { flex-wrap: wrap; }
    .dashboard-cards { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 380px) {
    .dashboard-cards { grid-template-columns: 1fr; }
}

/* Pay header actions group */
.pay-header-actions {
    display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap;
}
@media (max-width: 640px) {
    .pay-header { flex-direction: column; align-items: flex-start; }
    .pay-header-actions { width: 100%; justify-content: space-between; }
}

/* Edit payment button */
.btn-edit-pay {
    background: var(--brown-light); border: var(--border);
    color: var(--brown); border-radius: var(--radius-sm);
    padding: 0.3rem 0.75rem; font-size: 0.78rem; font-weight: 800;
    cursor: pointer; font-family: 'Nunito', sans-serif;
    transition: background 0.15s;
    white-space: nowrap;
}
.btn-edit-pay:hover { background: #ede0cc; }
.btn-delete-group {
    background: #fdecea; border: 1px solid #f5b8b3;
    color: var(--red); border-radius: var(--radius-sm);
    padding: 0.3rem 0.45rem; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: background 0.15s;
}
.btn-delete-group:hover { background: #fbd5d1; }
.btn-delete-group:disabled { opacity: 0.5; cursor: not-allowed; }

/* ═══════════════════════════════════════════════
   SIDEBAR NAVIGATION
═══════════════════════════════════════════════ */

/* Hamburger button */
.sidebar-toggle {
    background: none; border: none; cursor: pointer;
    display: flex; flex-direction: column; justify-content: center;
    gap: 6px; padding: 10px; border-radius: 8px;
    transition: background 0.15s; flex-shrink: 0;
    min-width: 44px; min-height: 44px;
}
.sidebar-toggle:hover { background: rgba(255,255,255,0.18); }
.sidebar-toggle span {
    display: block; width: 22px; height: 2px;
    background: #fff; border-radius: 2px;
}

/* Overlay (click-outside to close) */
.sidebar-overlay {
    display: none; position: fixed; inset: 0;
    background: rgba(61,43,31,0.4); z-index: 149;
}
.sidebar-overlay.active { display: block; }

/* Sidebar panel */
.sidebar {
    position: fixed; top: 64px; left: -230px; bottom: 0;
    width: 220px; background: var(--white);
    border-right: var(--border); box-shadow: var(--shadow-md);
    z-index: 150; transition: left 0.22s cubic-bezier(.4,0,.2,1);
    padding: 0.75rem 0;
    overflow-y: auto;
}
.sidebar.open { left: 0; }

/* Sidebar nav */
.sidebar-nav { display: flex; flex-direction: column; gap: 0.1rem; padding: 0 0.5rem; }
.sidebar-link {
    display: flex; align-items: center; gap: 0.65rem;
    padding: 0.65rem 0.85rem; border-radius: var(--radius-sm);
    color: var(--text); text-decoration: none;
    font-size: 0.92rem; font-weight: 700;
    transition: background 0.13s, color 0.13s;
}
.sidebar-link:hover { background: var(--brown-light); color: var(--olive-dark); }
.sidebar-link.active { background: var(--olive-dark); color: var(--white); }
.sidebar-link svg { flex-shrink: 0; opacity: 0.75; }
.sidebar-link.active svg { opacity: 1; }

/* Page wrapper — sits below the navbar */
.page-main { min-height: calc(100vh - 64px); }

/* ═══════════════════════════════════════════════
   STUDENTS PAGE
═══════════════════════════════════════════════ */

.students-filter-bar {
    display: flex; flex-wrap: wrap; align-items: center;
    gap: 0.6rem; margin-bottom: 1.25rem;
}
.students-search {
    padding: 0.45rem 0.85rem; border: var(--border);
    border-radius: var(--radius-sm);
    font-family: 'Nunito', sans-serif; font-size: 0.88rem; font-weight: 700;
    color: var(--text); background: var(--white);
    min-width: 200px; max-width: 280px;
}
.students-search:focus { outline: none; border-color: var(--olive-dark); }
.students-filter-select {
    padding: 0.45rem 0.85rem; border: var(--border);
    border-radius: var(--radius-sm);
    font-family: 'Nunito', sans-serif; font-size: 0.88rem; font-weight: 700;
    color: var(--text); background: var(--white); cursor: pointer;
}
.students-filter-select:focus { outline: none; border-color: var(--olive-dark); }

/* Student avatar circle */
.student-avatar {
    width: 36px; height: 36px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 0.95rem; font-weight: 900; color: var(--white);
    flex-shrink: 0; letter-spacing: 0;
}

/* Student level pill */
.student-level-tag {
    display: inline-block;
    background: var(--brown-light); color: var(--brown-mid);
    border-radius: 10px; padding: 0.2rem 0.6rem;
    font-size: 0.78rem; font-weight: 700;
}

/* Inactive row tint */
.student-row-inactive td { opacity: 0.6; }

@media (max-width: 700px) {
    .students-filter-bar { flex-direction: column; align-items: stretch; }
    .students-search, .students-filter-select { max-width: 100%; width: 100%; }
}
@media (max-width: 480px) {
    .sidebar { width: 200px; }
}

/* Inline status selector in students table */
.students-status-select {
    padding: 0.28rem 0.55rem; border: 1.5px solid var(--brown-border);
    border-radius: var(--radius-sm);
    font-family: 'Nunito', sans-serif; font-size: 0.78rem; font-weight: 800;
    color: var(--text); background: var(--white); cursor: pointer;
}

/* ── Groups page ────────────────────────────────────────────────────────────── */
.groups-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.25rem;
    margin-bottom: 2rem;
}

.group-card {
    background: var(--white);
    border: var(--border);
    border-radius: var(--radius);
    padding: 1.25rem 1.35rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    transition: box-shadow 0.15s, border-color 0.15s;
}
.group-card:hover {
    box-shadow: 0 4px 16px rgba(0,0,0,0.08);
    border-color: var(--brown-border);
}

.group-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.5rem;
}

.group-card-name {
    font-size: 1.05rem;
    font-weight: 900;
    color: var(--olive-dark);
    line-height: 1.25;
}

.group-level-badge {
    display: inline-block;
    padding: 0.2rem 0.65rem;
    border-radius: 10px;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.03em;
    white-space: nowrap;
    flex-shrink: 0;
}

.lang-badge {
    display: inline-block;
    padding: 0.18rem 0.55rem;
    border-radius: 10px;
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    white-space: nowrap;
    flex-shrink: 0;
    text-transform: uppercase;
}
.lang-badge-en { background: #dbeafe; color: #2563eb; }
.lang-badge-zh { background: #fee2e2; color: #b91c1c; }
.lang-badge-other { background: #f3f4f6; color: #6b7280; }
.level-preschool  { background: #fde8d8; color: #b05a1a; }
.level-starters   { background: #d8f0e0; color: #1a7a3a; }
.level-movers     { background: #d8e8f8; color: #1a4a8a; }
.level-flyers     { background: #e8d8f8; color: #5a1a8a; }
.level-b1         { background: #f8f0d8; color: #7a5a0a; }
.level-b2         { background: #f8d8e8; color: #8a1a4a; }
.level-default    { background: var(--brown-light); color: var(--brown-mid); }

.group-teacher-tag {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 700;
}

.group-stats-row {
    display: flex;
    gap: 1rem;
    padding: 0.65rem 0;
    border-top: 1px solid var(--bg);
    border-bottom: 1px solid var(--bg);
}

.group-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
    text-align: center;
}
.group-stat-num {
    font-size: 1.35rem;
    font-weight: 900;
    color: var(--olive-dark);
    line-height: 1.1;
}
.group-stat-label {
    font-size: 0.68rem;
    font-weight: 800;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-top: 0.15rem;
}

.group-links-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-top: 0.1rem;
}

.group-link-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.28rem 0.65rem;
    border-radius: 6px;
    font-size: 0.74rem;
    font-weight: 800;
    text-decoration: none;
    border: 1.5px solid transparent;
    transition: opacity 0.12s;
}
.group-link-btn:hover { opacity: 0.75; }
.group-link-zoom    { background: #e8f0fd; color: #1a47a0; border-color: #c0d0f0; }
.group-link-pm      { background: #e8fdf0; color: #1a7a40; border-color: #b0e8c8; }
.group-link-cabinet { background: #fdf8e8; color: #7a6010; border-color: #e8d890; }
.group-link-sched   { background: var(--brown-light); color: var(--brown-mid); border-color: var(--brown-border); }

.group-card-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    padding-top: 0.25rem;
}

@media (max-width: 640px) {
    .groups-grid { grid-template-columns: 1fr; }
}

/* ── Attendance page ─────────────────────────────────────────────────────── */
.att-lesson-block {
    background: var(--white);
    border: var(--border);
    border-radius: var(--radius);
    margin-bottom: 1.25rem;
    overflow: hidden;
}

.att-lesson-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 0.9rem 1.25rem;
    background: var(--bg);
    border-bottom: var(--border);
}

.att-lesson-date {
    font-size: 0.95rem;
    font-weight: 900;
    color: var(--olive-dark);
}

.att-group-chip {
    display: inline-block;
    padding: 0.2rem 0.65rem;
    background: var(--brown-light);
    color: var(--brown-mid);
    border-radius: 10px;
    font-size: 0.75rem;
    font-weight: 800;
}

.att-summary {
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
}

.att-pill {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 8px;
    font-size: 0.72rem;
    font-weight: 800;
}
.att-pill-present { background: #dcfce7; color: #15803d; }
.att-pill-absent  { background: #fee2e2; color: #b91c1c; }
.att-pill-pending { background: #f3f4f6; color: #6b7280; }

.att-table { border: none; min-width: 520px; }
.att-table thead th { background: transparent; }
.att-lesson-block .pay-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

.att-row td { padding: 0.7rem 1rem; }

.att-btn-row {
    display: flex;
    gap: 0.4rem;
}

.att-mark-btn {
    padding: 0.3rem 0.75rem;
    border-radius: 6px;
    font-family: 'Nunito', sans-serif;
    font-size: 0.78rem;
    font-weight: 800;
    cursor: pointer;
    border: 1.5px solid transparent;
    transition: all 0.12s;
}
.att-mark-present {
    background: #f0fdf4;
    color: #16a34a;
    border-color: #bbf7d0;
}
.att-mark-present:hover, .att-mark-present.active {
    background: #16a34a;
    color: #fff;
    border-color: #16a34a;
}
.att-mark-absent {
    background: #fff1f2;
    color: #dc2626;
    border-color: #fecaca;
}
.att-mark-absent:hover, .att-mark-absent.active {
    background: #dc2626;
    color: #fff;
    border-color: #dc2626;
}
.att-mark-late {
    background: #fff7ed;
    color: #c2410c;
    border-color: #fed7aa;
}
.att-mark-late:hover, .att-mark-late.active {
    background: #c2410c;
    color: #fff;
    border-color: #c2410c;
}
.att-mark-excused {
    background: #eff6ff;
    color: #1d4ed8;
    border-color: #bfdbfe;
}
.att-mark-excused:hover, .att-mark-excused.active {
    background: #1d4ed8;
    color: #fff;
    border-color: #1d4ed8;
}
.att-pill-late    { background: #fff7ed; color: #c2410c; }
.att-pill-excused { background: #eff6ff; color: #1d4ed8; }
.att-mark-clear {
    background: var(--bg);
    color: var(--text-muted);
    border-color: var(--brown-border);
}
.att-mark-clear:hover {
    background: var(--brown-border);
    color: var(--text);
}

/* ── Teachers page ───────────────────────────────────────────────────────── */
.teacher-levels-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-top: 0.25rem;
}

.teacher-level-check {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.3rem 0.7rem;
    border: 1.5px solid var(--brown-border);
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.12s;
    background: var(--white);
    color: var(--text-muted);
}
.teacher-level-check:has(input:checked) {
    background: var(--brown-light);
    border-color: var(--brown-mid);
    color: var(--brown-mid);
}
.teacher-level-check input { display: none; }

/* ── Leads & Trials page ─────────────────────────────────────────────────── */
.lead-badge-accept   { background: #dcfce7; color: #15803d; }
.lead-badge-waitlist { background: #fef9c3; color: #854d0e; }
.lead-badge-reject   { background: #fee2e2; color: #b91c1c; }
.lead-badge-followup { background: #ede9fe; color: #6d28d9; }
.lead-badge-pending  { background: #f3f4f6; color: #6b7280; }
