* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Microsoft YaHei', 'PingFang SC', sans-serif;
    background: linear-gradient(135deg, #fce4ec 0%, #f3e5f5 30%, #e8eaf6 60%, #e0f7fa 100%);
    min-height: 100vh;
    padding: 20px;
}

body.slot-picker-open {
    position: fixed;
    width: 100%;
    overflow: hidden;
}

body.gate-active {
    padding: 0;
    overflow: hidden;
}

.container {
    max-width: 1500px;
    margin: 0 auto;
}

.app-hidden {
    display: none;
}

.teacher-gate {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100dvh;
    padding: 28px;
    overflow: hidden;
    background:
        linear-gradient(135deg, rgba(255, 255, 255, 0.9), rgba(245, 247, 250, 0.96)),
        radial-gradient(circle at 20% 12%, rgba(205, 170, 103, 0.18), transparent 34%),
        radial-gradient(circle at 88% 78%, rgba(33, 150, 136, 0.12), transparent 30%),
        #f4f6f8;
}

.teacher-gate::before {
    content: "";
    position: absolute;
    inset: 18px;
    border: 1px solid rgba(17, 24, 39, 0.08);
    border-radius: 28px;
    pointer-events: none;
}

.teacher-gate.hidden {
    display: none;
}

.teacher-gate-panel {
    position: relative;
    width: min(520px, 100%);
    padding: 42px;
    background: rgba(255, 255, 255, 0.82);
    border: 1px solid rgba(17, 24, 39, 0.08);
    border-radius: 24px;
    box-shadow: 0 24px 70px rgba(31, 41, 55, 0.14);
    text-align: center;
    backdrop-filter: blur(18px);
}

.teacher-brand {
    margin-bottom: 18px;
    color: #9a7a3b;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.18em;
}

.teacher-gate-panel h1 {
    margin-bottom: 10px;
    color: #121826;
    font-size: 34px;
    line-height: 1.15;
    font-weight: 750;
}

.teacher-gate-panel p {
    margin-bottom: 28px;
    color: #6b7280;
    font-size: 15px;
}

.teacher-choice-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

.teacher-choice-btn {
    min-height: 96px;
    border: 1px solid rgba(17, 24, 39, 0.1);
    border-radius: 18px;
    background: linear-gradient(180deg, #ffffff, #f8fafc);
    color: #111827;
    font-size: 18px;
    font-weight: 750;
    cursor: pointer;
    box-shadow: 0 10px 28px rgba(31, 41, 55, 0.08);
    transition: border-color 0.2s, box-shadow 0.2s, transform 0.2s;
}

.teacher-choice-btn span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
}

.teacher-choice-btn:hover {
    border-color: rgba(154, 122, 59, 0.45);
    box-shadow: 0 16px 36px rgba(31, 41, 55, 0.14);
    transform: translateY(-2px);
}

.teacher-choice-btn:active {
    transform: scale(0.98);
}

.teacher-password {
    width: 100%;
    height: 48px;
    padding: 0 16px;
    border: 1px solid rgba(17, 24, 39, 0.14);
    border-radius: 14px;
    font-size: 16px;
    text-align: center;
    background: #fbfcfd;
    outline: none;
}

.teacher-password:focus {
    border-color: #9a7a3b;
    box-shadow: 0 0 0 4px rgba(154, 122, 59, 0.12);
}

.password-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 10001;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(18, 24, 38, 0.36);
    backdrop-filter: blur(8px);
}

.password-overlay.active {
    display: flex;
}

.password-dialog {
    width: min(380px, 100%);
    padding: 26px;
    border: 1px solid rgba(17, 24, 39, 0.08);
    border-radius: 20px;
    background: white;
    box-shadow: 0 24px 70px rgba(31, 41, 55, 0.24);
    text-align: center;
}

.password-dialog h2 {
    margin-bottom: 14px;
    color: #333;
    font-size: 20px;
}

.password-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 14px;
}

.password-actions .btn {
    min-height: 42px;
    font-size: 14px;
}

/* ===== 顶部 ===== */
.header {
    text-align: center;
    margin-bottom: 15px;
    padding: 18px 20px 12px;
    background: white;
    border-radius: 20px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
}

.header h1 {
    font-size: 24px;
    color: #e91e63;
    margin-bottom: 12px;
    display: inline-block;
}

.header h1::before { content: "\2728"; margin-right: 8px; }
.header h1::after { content: "\2728"; margin-left: 8px; }

.controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
}

.controls label {
    font-size: 14px;
    color: #555;
    font-weight: 500;
}

.controls select {
    padding: 6px 12px;
    border: 2px solid #f48fb1;
    border-radius: 10px;
    font-size: 13px;
    color: #333;
    background: #fff0f5;
    cursor: pointer;
    outline: none;
    transition: all 0.3s;
}

.controls select:focus {
    border-color: #e91e63;
    box-shadow: 0 0 8px rgba(233, 30, 99, 0.3);
}

/* ===== 按钮 ===== */
.btn {
    padding: 7px 15px;
    border: none;
    border-radius: 10px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: 500;
    white-space: nowrap;
}

.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }

.btn-sm {
    padding: 5px 12px;
    font-size: 12px;
    border-radius: 8px;
}

.btn-save {
    background: linear-gradient(135deg, #66bb6a, #43a047);
    color: white;
    box-shadow: 0 2px 8px rgba(76, 175, 80, 0.3);
}

.btn-load {
    background: linear-gradient(135deg, #ffa726, #fb8c00);
    color: white;
    box-shadow: 0 2px 8px rgba(255, 167, 38, 0.3);
}

.btn-clear {
    background: linear-gradient(135deg, #ef5350, #e53935);
    color: white;
    box-shadow: 0 2px 8px rgba(244, 67, 54, 0.3);
}

.btn-export {
    background: linear-gradient(135deg, #42a5f5, #1e88e5);
    color: white;
    box-shadow: 0 2px 8px rgba(33, 150, 243, 0.3);
}

.btn-student {
    background: linear-gradient(135deg, #ab47bc, #8e24aa);
    color: white;
    box-shadow: 0 2px 8px rgba(171, 71, 188, 0.3);
}

.btn-time {
    background: linear-gradient(135deg, #26c6da, #00acc1);
    color: white;
    box-shadow: 0 2px 8px rgba(38, 198, 218, 0.3);
}

.btn-fee {
    background: linear-gradient(135deg, #ffb74d, #f57c00);
    color: white;
    box-shadow: 0 2px 8px rgba(255, 183, 77, 0.3);
}

.btn-switch {
    background: linear-gradient(135deg, #78909c, #546e7a);
    color: white;
    box-shadow: 0 2px 8px rgba(84, 110, 122, 0.25);
}

.btn-history {
    background: linear-gradient(135deg, #5c6bc0, #3949ab);
    color: white;
    box-shadow: 0 2px 8px rgba(63, 81, 181, 0.3);
}

.btn-confirm {
    background: linear-gradient(135deg, #66bb6a, #43a047);
    color: white;
}

.btn-bill {
    background: linear-gradient(135deg, #7e57c2, #5e35b1);
    color: white;
    box-shadow: 0 2px 8px rgba(126, 87, 194, 0.3);
}

.btn-one-on-two {
    background: linear-gradient(135deg, #ffab91, #ff7043);
    color: white;
    font-size: 11px;
    padding: 3px 8px;
    border-radius: 6px;
    border: none;
    cursor: pointer;
}

.btn-one-on-two.active {
    background: linear-gradient(135deg, #ff7043, #e64a19);
    box-shadow: 0 0 6px rgba(255, 112, 67, 0.5);
}

.file-status {
    width: 100%;
    margin-top: 8px;
    font-size: 11px;
    color: #888;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
}

.file-status .dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    display: inline-block;
}

.file-status .dot.connected {
    background: #4caf50;
    box-shadow: 0 0 4px rgba(76, 175, 80, 0.5);
}

.file-status .dot.disconnected {
    background: #ff9800;
    box-shadow: 0 0 4px rgba(255, 152, 0, 0.5);
}

/* ===== 统计栏 ===== */
.stats {
    margin-bottom: 12px;
    padding: 12px 20px;
    background: white;
    border-radius: 14px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 30px;
    flex-wrap: wrap;
}

.stat-item { text-align: center; }
.stat-item .stat-value { font-size: 20px; font-weight: 700; color: #e91e63; }
.stat-item .stat-label { font-size: 11px; color: #999; margin-top: 2px; }

/* ===== 日历 ===== */
.weekday-header {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 5px;
    margin-bottom: 5px;
}

.weekday-header div {
    text-align: center;
    font-weight: 600;
    font-size: 12px;
    padding: 6px;
    border-radius: 8px;
    color: #555;
    background: rgba(255, 255, 255, 0.7);
}

.weekday-header div:nth-child(6),
.weekday-header div:nth-child(7) {
    color: #e91e63;
    background: #fce4ec;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 5px;
}

/* ===== 日期格子 ===== */
.day-cell {
    background: white;
    border-radius: 12px;
    padding: 7px 5px;
    min-height: 160px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
    transition: all 0.3s;
    border: 2px solid transparent;
    position: relative;
}

.day-cell:hover {
    border-color: #f48fb1;
    box-shadow: 0 3px 12px rgba(233, 30, 99, 0.1);
}

.day-cell.empty {
    background: transparent;
    box-shadow: none;
    border: none;
    min-height: 0;
}

.day-cell.empty:hover { border-color: transparent; }
.day-cell.weekend { background: #fffbfc; }

.day-cell.today {
    border-color: #e91e63;
    background: linear-gradient(135deg, #fff0f3, #fff);
}

.day-number {
    font-size: 12px;
    font-weight: 700;
    color: #333;
    margin-bottom: 4px;
    text-align: center;
    background: #f5f5f5;
    border-radius: 6px;
    padding: 2px 0;
}

.day-cell.weekend .day-number { color: #e91e63; background: #fce4ec; }
.day-cell.today .day-number { background: #e91e63; color: white; }

/* ===== 时间段（选择式） ===== */
.time-slot {
    display: flex;
    align-items: flex-start;
    margin-bottom: 2px;
    gap: 2px;
    cursor: pointer;
    padding: 2px 3px;
    border-radius: 5px;
    transition: background 0.2s;
    min-height: 20px;
}

.time-slot:hover { background: #f5f5f5; }

.time-label {
    font-size: 9px;
    color: #aaa;
    white-space: nowrap;
    min-width: 30px;
    padding-top: 2px;
}

.slot-students {
    display: flex;
    flex-wrap: wrap;
    gap: 2px;
    flex: 1;
    min-height: 16px;
}

.student-tag {
    font-size: 10px;
    padding: 1px 5px;
    border-radius: 4px;
    background: #e8f5e9;
    color: #2e7d32;
    font-weight: 600;
    white-space: nowrap;
}

.student-tag.duo { background: #e3f2fd; color: #1565c0; }

.student-tag.special-hours {
    background: #fff3e0;
    color: #f57c00;
    border: 1px solid #ffb74d;
}

.billing-month-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-left: 3px;
    padding: 1px 5px;
    border-radius: 999px;
    background: #fff3e0;
    color: #ef6c00;
    border: 1px solid #ffcc80;
    font-size: 9px;
    font-weight: 700;
    white-space: nowrap;
}

.billing-month-control {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: #666;
    font-size: 12px;
}

.billing-month-control select {
    max-width: 138px;
    padding: 4px 7px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    background: #fff;
    color: #333;
    font-size: 12px;
    outline: none;
}

.fee-month-breakdown {
    display: flex;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 6px;
    color: #777;
    font-size: 12px;
}

.fee-month-breakdown span {
    padding: 3px 8px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.62);
}

.fee-cross-note {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 8px;
    padding: 5px 9px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
}

.fee-cross-note.in {
    background: #fff3e0;
    color: #ef6c00;
}

.fee-cross-note.out {
    background: #e3f2fd;
    color: #1565c0;
}

.fee-info-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 17px;
    height: 17px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.82);
    color: inherit;
    font-size: 11px;
    font-weight: 800;
    cursor: pointer;
}

.fee-info-btn:hover {
    background: #fff;
}

.slot-empty { font-size: 10px; color: #ddd; }

/* ===== 学生选择浮窗 ===== */
.slot-picker-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 1000;
}

.slot-picker-overlay.active { display: block; touch-action: none; }

.slot-picker {
    display: none;
    position: fixed;
    z-index: 1001;
    background: white;
    border-radius: 14px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
    padding: 12px;
    min-width: 180px;
    max-width: 240px;
}

.slot-picker.active { display: flex; flex-direction: column; }

.slot-picker-title {
    font-size: 13px;
    font-weight: 600;
    color: #333;
    margin-bottom: 8px;
    padding-bottom: 6px;
    border-bottom: 1px solid #eee;
}

.slot-picker-list { max-height: 200px; overflow-y: auto; min-height: 0; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }

.slot-picker-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s;
    font-size: 13px;
}

.slot-picker-item:hover { background: #f5f5f5; }
.slot-picker-item.selected { background: #e8f5e9; }

.slot-picker-item .check-box {
    width: 18px;
    height: 18px;
    border: 2px solid #ccc;
    border-radius: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

.slot-picker-item.selected .check-box {
    background: #4caf50;
    border-color: #4caf50;
    color: white;
    font-size: 12px;
}

.slot-picker-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid #eee;
    text-align: right;
}
.btn-copy {
    background: linear-gradient(135deg, #42a5f5, #1e88e5);
    color: white;
    margin-right: 8px;
}

.hours-edit-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 12px;
    padding: 2px 4px;
    margin-left: 4px;
    opacity: 0.6;
    transition: opacity 0.2s;
}

.hours-edit-btn:hover {
    opacity: 1;
}

.special-hours-badge {
    font-size: 10px;
    padding: 1px 4px;
    border-radius: 4px;
    background: #fff3e0;
    color: #f57c00;
    font-weight: 600;
    margin-left: 4px;
    cursor: pointer;
    transition: background 0.2s;
}

.special-hours-badge:hover {
    background: #ffe0b2;
}

.slot-picker-empty {
    color: #999;
    font-size: 12px;
    text-align: center;
    padding: 15px;
}

/* ===== 弹窗通用 ===== */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 2000;
    backdrop-filter: blur(2px);
}

.modal-overlay.active { display: block; }

.modal {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    border-radius: 20px;
    box-shadow: 0 15px 50px rgba(0, 0, 0, 0.2);
    z-index: 2001;
    width: 90%;
    max-width: 450px;
    max-height: 85vh;
    overflow: hidden;
}

.modal.active { display: block; }
.modal-large { max-width: 650px; }

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid #f0f0f0;
}

.modal-header h2 { font-size: 18px; color: #333; }

.modal-close {
    width: 30px;
    height: 30px;
    border: none;
    background: #f5f5f5;
    border-radius: 50%;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.modal-close:hover { background: #eee; }

.modal-body {
    padding: 20px;
    overflow-y: auto;
    max-height: calc(85vh - 70px);
}

/* ===== 学生管理 ===== */
.student-add-row {
    display: flex;
    gap: 8px;
    margin-bottom: 15px;
}

.student-add-row input {
    flex: 1;
    padding: 8px 12px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.3s;
}

.student-add-row input:focus { border-color: #ab47bc; }

.student-list { display: flex; flex-direction: column; gap: 6px; }

.student-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    background: #f9f9f9;
    border-radius: 10px;
    transition: all 0.2s;
}

.student-item:hover { background: #f0f0f0; }

.student-item .name { font-size: 14px; font-weight: 500; color: #333; }

.student-item .delete-btn {
    width: 24px;
    height: 24px;
    border: none;
    background: #ffebee;
    color: #e53935;
    border-radius: 50%;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.student-item .delete-btn:hover { background: #ffcdd2; }

.hint {
    margin-top: 15px;
    font-size: 12px;
    color: #999;
    text-align: center;
}

/* ===== 时间段管理 ===== */
.timeslot-add-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 15px;
}

.timeslot-add-row input[type="time"] {
    padding: 8px 12px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.3s;
}

.timeslot-add-row input[type="time"]:focus {
    border-color: #26c6da;
}

.timeslot-sep {
    font-size: 14px;
    color: #666;
}

.timeslot-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.timeslot-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    background: #f9f9f9;
    border-radius: 10px;
    transition: all 0.2s;
}

.timeslot-item:hover {
    background: #f0f0f0;
}

.timeslot-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.timeslot-label {
    font-size: 14px;
    font-weight: 500;
    color: #333;
}

.timeslot-hours {
    font-size: 12px;
    color: #888;
    background: #e0f7fa;
    padding: 2px 8px;
    border-radius: 6px;
}

/* ===== 费用统计 ===== */
.fee-controls {
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px solid #f0f0f0;
}

.fee-month-select {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

.fee-month-select label { font-size: 13px; color: #555; }

.fee-month-select select {
    padding: 5px 10px;
    border: 1.5px solid #e0e0e0;
    border-radius: 8px;
    font-size: 13px;
    outline: none;
}

.fee-price-settings {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    font-size: 12px;
    color: #666;
}

.fee-price-settings label { font-size: 12px; color: #666; }

.fee-price-settings input {
    width: 55px;
    padding: 4px 6px;
    border: 1.5px solid #e0e0e0;
    border-radius: 8px;
    font-size: 13px;
    text-align: center;
    outline: none;
}

.fee-price-settings input:focus { border-color: #f57c00; }

.fee-result { min-height: 100px; }
.fee-placeholder { color: #bbb; text-align: center; padding: 40px 0; font-size: 14px; }

.fee-summary {
    margin-bottom: 15px;
    padding: 12px 16px;
    background: linear-gradient(135deg, #fff8e1, #fff3e0);
    border-radius: 12px;
    text-align: center;
}

.fee-summary .total-amount { font-size: 28px; font-weight: 700; color: #f57c00; }
.fee-summary .total-label { font-size: 12px; color: #999; margin-top: 2px; }

.fee-collection-summary {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin-top: 12px;
}

.fee-collection-item {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 34px;
    padding: 6px 10px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.68);
    border: 1px solid rgba(245, 124, 0, 0.12);
}

.fee-collection-label {
    font-size: 12px;
    color: #888;
}

.fee-collection-amount {
    font-size: 15px;
    font-weight: 700;
}

.fee-collection-item.paid .fee-collection-amount {
    color: #2e7d32;
}

.fee-collection-item.unpaid .fee-collection-amount {
    color: #d84315;
}

.fee-student-list { display: flex; flex-direction: column; gap: 8px; }

.fee-student-card {
    padding: 12px 14px;
    background: #f9f9f9;
    border-radius: 12px;
    border: 1px solid #eee;
    cursor: pointer;
    transition: all 0.2s;
}

.fee-student-card:hover {
    border-color: #ce93d8;
    box-shadow: 0 2px 8px rgba(171, 71, 188, 0.1);
}

.fee-student-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 6px;
}

.fee-student-name { font-size: 15px; font-weight: 600; color: #333; }

.fee-student-header-right {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.fee-payment-toggle {
    min-width: 48px;
    padding: 4px 9px;
    border: 1px solid #ffcdd2;
    border-radius: 999px;
    background: #ffebee;
    color: #c62828;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
}

.fee-payment-toggle:hover {
    background: #ffcdd2;
}

.fee-payment-toggle.paid {
    border-color: #a5d6a7;
    background: #e8f5e9;
    color: #2e7d32;
}

.fee-payment-toggle.paid:hover {
    background: #c8e6c9;
}
.fee-student-amount { font-size: 15px; font-weight: 700; color: #e91e63; }

.fee-student-detail {
    font-size: 11px;
    color: #888;
    line-height: 1.6;
}

.fee-student-actions {
    margin-top: 8px;
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    align-items: center;
}

.fee-override-item {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    color: #666;
    background: #fff3e0;
    padding: 3px 8px;
    border-radius: 6px;
    cursor: pointer;
    border: 1px solid #ffe0b2;
    transition: all 0.2s;
}

.fee-override-item:hover { background: #ffe0b2; }

.fee-override-item.active {
    background: #ffccbc;
    color: #d84315;
    font-weight: 500;
    border-color: #ffab91;
}

/* ===== 收费文案弹窗 ===== */
.bill-text {
    padding: 15px;
    background: #f5f5f5;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.8;
    color: #333;
    margin-bottom: 12px;
    white-space: pre-wrap;
    word-break: break-all;
    user-select: all;
}


.billing-detail-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.billing-detail-item {
    padding: 11px 12px;
    border: 1px solid #eee;
    border-radius: 12px;
    background: #fafafa;
}

.billing-detail-main {
    color: #333;
    font-size: 14px;
    font-weight: 700;
    line-height: 1.45;
}

.billing-detail-sub {
    margin-top: 4px;
    color: #777;
    font-size: 12px;
    line-height: 1.45;
}
/* ===== 历史版本 ===== */
.history-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.history-empty,
.history-loading {
    padding: 26px 10px;
    color: #999;
    font-size: 14px;
    text-align: center;
}

.history-item {
    padding: 12px;
    border: 1px solid #eee;
    border-radius: 12px;
    background: #fafafa;
}

.history-item-main {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 8px;
}

.history-time {
    color: #333;
    font-size: 14px;
    font-weight: 700;
}

.history-size {
    color: #999;
    font-size: 11px;
    white-space: nowrap;
}

.history-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.history-actions .btn {
    min-width: 78px;
}

.history-detail {
    display: none;
    margin-top: 12px;
    padding: 12px;
    border-radius: 12px;
    background: #f5f7fb;
    color: #555;
    font-size: 13px;
    line-height: 1.7;
}

.history-detail.active {
    display: block;
}

/* ===== Toast ===== */
.toast {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 10px 20px;
    border-radius: 10px;
    color: white;
    font-size: 13px;
    font-weight: 500;
    z-index: 9999;
    opacity: 0;
    transform: translateY(-20px);
    transition: all 0.3s;
    pointer-events: none;
}

.toast.show { opacity: 1; transform: translateY(0); }
.toast-success { background: linear-gradient(135deg, #66bb6a, #43a047); box-shadow: 0 4px 12px rgba(76, 175, 80, 0.4); }
.toast-warning { background: linear-gradient(135deg, #ffa726, #fb8c00); box-shadow: 0 4px 12px rgba(255, 167, 38, 0.4); }
.toast-info { background: linear-gradient(135deg, #42a5f5, #1e88e5); box-shadow: 0 4px 12px rgba(33, 150, 243, 0.4); }

/* ===== 拖拽 ===== */
.drop-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(233, 30, 99, 0.08);
    backdrop-filter: blur(3px);
    z-index: 9998;
    justify-content: center;
    align-items: center;
    border: 4px dashed #e91e63;
}

.drop-overlay.active { display: flex; }

.drop-overlay p {
    font-size: 22px;
    color: #e91e63;
    font-weight: 600;
    background: white;
    padding: 25px 40px;
    border-radius: 16px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

/* ===== 复制对话框 ===== */
.copy-dialog-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 3000;
    backdrop-filter: blur(2px);
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 0.3s;
}

.copy-dialog-overlay.active {
    display: flex;
    opacity: 1;
}

.copy-dialog {
    background: white;
    border-radius: 16px;
    padding: 24px;
    min-width: 300px;
    max-width: 400px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

.copy-dialog h3 {
    font-size: 18px;
    color: #333;
    margin-bottom: 12px;
}

.copy-dialog p {
    font-size: 14px;
    color: #666;
    margin-bottom: 16px;
}

.copy-dialog select {
    width: 100%;
    padding: 10px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 14px;
    outline: none;
    margin-bottom: 16px;
    transition: border-color 0.3s;
}

.copy-dialog select:focus {
    border-color: #42a5f5;
}

.copy-dialog-buttons {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

/* ===== 整天复制对话框 ===== */
.day-copy-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 3000;
    backdrop-filter: blur(3px);
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 0.3s;
}

.day-copy-overlay.active {
    display: flex;
    opacity: 1;
}

.day-copy-dialog {
    background: white;
    border-radius: 20px;
    padding: 28px;
    min-width: 400px;
    max-width: 500px;
    box-shadow: 0 15px 50px rgba(0, 0, 0, 0.3);
}

.day-copy-dialog h3 {
    font-size: 20px;
    color: #333;
    margin-bottom: 12px;
    text-align: center;
}

.copy-hint {
    font-size: 13px;
    color: #666;
    text-align: center;
    margin-bottom: 20px;
}

.day-copy-calendar {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 8px;
    margin-bottom: 20px;
    padding: 15px;
    background: #f9f9f9;
    border-radius: 12px;
}

.day-copy-cell {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 500;
    color: #333;
    cursor: pointer;
    transition: all 0.2s;
    user-select: none;
}

.day-copy-cell:hover {
    border-color: #42a5f5;
    background: #e3f2fd;
    transform: scale(1.05);
}

.day-copy-cell.selected {
    background: linear-gradient(135deg, #66bb6a, #43a047);
    border-color: #43a047;
    color: white;
    box-shadow: 0 3px 10px rgba(76, 175, 80, 0.3);
}

.day-copy-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.day-copy-buttons .btn {
    min-width: 120px;
}

/* ===== 日历上的复制按钮 ===== */
.copy-day-btn {
    position: absolute;
    top: 5px;
    right: 5px;
    width: 24px;
    height: 24px;
    border: none;
    background: rgba(66, 165, 245, 0.9);
    color: white;
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
    opacity: 0;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.day-cell:hover .copy-day-btn {
    opacity: 1;
}

.copy-day-btn:hover {
    background: #1e88e5;
    transform: scale(1.1);
}

/* ===== 响应式 ===== */
@media (max-width: 1100px) {
    .calendar-grid { gap: 4px; }
    .day-cell { padding: 5px 4px; min-height: 145px; }
    .time-label { font-size: 8px; min-width: 26px; }
    .student-tag { font-size: 9px; padding: 1px 3px; }
}

@media (max-width: 768px) {
    body { padding: 10px; }
    .calendar-grid { grid-template-columns: repeat(2, 1fr); gap: 6px; }
    .weekday-header { display: none; }
    .day-cell { min-height: auto; padding: 8px; }
    .day-cell.empty { display: none; }
    .time-label { font-size: 10px; min-width: 36px; }
    .student-tag { font-size: 11px; }
    .modal { width: 95%; }
}

/* ===== 手机端 App 化适配 ===== */
@media (max-width: 640px) {
    html {
        -webkit-text-size-adjust: 100%;
    }

    body {
        min-height: 100dvh;
        padding: 8px;
        padding-bottom: calc(16px + env(safe-area-inset-bottom));
        background: #f7f8fb;
        overflow-x: hidden;
        -webkit-tap-highlight-color: transparent;
    }

    .container {
        width: 100%;
        max-width: none;
    }

    .teacher-gate {
        align-items: center;
        padding: calc(18px + env(safe-area-inset-top)) 18px calc(18px + env(safe-area-inset-bottom));
    }

    .teacher-gate::before {
        inset: 10px;
        border-radius: 22px;
    }

    .teacher-gate-panel {
        padding: 34px 20px;
        border-radius: 22px;
    }

    .teacher-brand {
        margin-bottom: 14px;
        font-size: 11px;
    }

    .teacher-gate-panel h1 {
        font-size: 30px;
    }

    .teacher-gate-panel p {
        margin-bottom: 24px;
    }

    .teacher-choice-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .teacher-choice-btn {
        min-height: 76px;
        border-radius: 16px;
        font-size: 18px;
    }

    .password-dialog {
        padding: 24px 18px;
        border-radius: 18px;
    }

    .password-actions {
        grid-template-columns: 1fr;
    }

    .header {
        position: sticky;
        top: 0;
        z-index: 50;
        margin: -8px -8px 10px;
        padding: calc(10px + env(safe-area-inset-top)) 10px 10px;
        border-radius: 0 0 16px 16px;
        box-shadow: 0 8px 24px rgba(28, 36, 48, 0.12);
    }

    .header h1 {
        display: block;
        margin-bottom: 10px;
        font-size: 20px;
        line-height: 1.2;
    }

    .controls {
        display: grid;
        grid-template-columns: auto minmax(0, 1fr) auto minmax(0, 1fr);
        gap: 8px;
        justify-content: stretch;
        text-align: left;
    }

    .controls label {
        align-self: center;
        font-size: 13px;
    }

    .controls select {
        width: 100%;
        min-width: 0;
        height: 40px;
        padding: 6px 10px;
        border-radius: 10px;
        font-size: 14px;
    }

    .controls .filter-divider {
        display: none;
    }

    .controls label[for="studentFilter"] {
        grid-column: 1 / 2;
    }

    .controls #studentFilter {
        grid-column: 2 / 5;
    }

    .controls .btn {
        min-height: 42px;
        padding: 8px 9px;
        border-radius: 11px;
        font-size: 12px;
        white-space: normal;
        line-height: 1.2;
    }

    .controls .btn-student,
    .controls .btn-time,
    .controls .btn-fee {
        grid-column: span 1;
    }

    .controls .btn-save,
    .controls .btn-load,
    .controls .btn-clear {
        grid-column: span 1;
    }

    .file-status {
        margin-top: 8px;
        font-size: 11px;
        line-height: 1.35;
    }

    .stats {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 6px;
        margin-bottom: 10px;
        padding: 8px;
        border-radius: 12px;
    }

    .stat-item {
        min-width: 0;
        padding: 6px 4px;
        background: #fafafa;
        border-radius: 10px;
    }

    .stat-item .stat-value {
        font-size: 18px;
        line-height: 1.2;
    }

    .stat-item .stat-label {
        font-size: 10px;
        line-height: 1.25;
    }

    .calendar-grid {
        display: flex;
        flex-direction: column;
        gap: 10px;
    }

    .day-cell {
        width: 100%;
        min-height: 0;
        padding: 10px 10px 8px;
        border-radius: 14px;
        border-width: 1px;
        box-shadow: 0 4px 14px rgba(28, 36, 48, 0.08);
    }

    .day-cell.empty {
        display: none;
    }

    .day-cell.today {
        border-width: 2px;
        box-shadow: 0 8px 22px rgba(233, 30, 99, 0.16);
    }

    .day-number {
        display: inline-flex;
        align-items: center;
        gap: 6px;
        min-width: 72px;
        margin-bottom: 8px;
        padding: 5px 9px;
        border-radius: 999px;
        font-size: 14px;
        text-align: left;
    }

    .day-cell::before {
        content: attr(data-weekday);
        position: absolute;
        top: 16px;
        left: 94px;
        font-size: 12px;
        font-weight: 600;
        color: #8a8f98;
        pointer-events: none;
    }

    .day-cell.today::before {
        color: #e91e63;
    }

    .time-slot {
        align-items: center;
        min-height: 38px;
        margin-bottom: 5px;
        padding: 7px 8px;
        gap: 8px;
        border-radius: 10px;
        background: #f7f8fa;
    }

    .time-slot:active {
        background: #f1f3f6;
    }

    .time-label {
        min-width: 62px;
        padding-top: 0;
        font-size: 12px;
        color: #6d7480;
        font-weight: 600;
    }

    .slot-students {
        align-items: center;
        min-height: 24px;
        gap: 5px;
    }

    .student-tag {
        max-width: 100%;
        padding: 4px 8px;
        border-radius: 999px;
        font-size: 13px;
        line-height: 1.15;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .slot-empty {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 24px;
        height: 24px;
        border: 1px dashed #cfd5dd;
        border-radius: 50%;
        color: #9aa3ad;
        font-size: 16px;
        line-height: 1;
    }

    .copy-day-btn {
        top: 10px;
        right: 10px;
        width: 34px;
        height: 34px;
        border-radius: 10px;
        opacity: 1;
        font-size: 14px;
    }

    .btn:hover,
    .day-copy-cell:hover,
    .copy-day-btn:hover {
        transform: none;
    }

    .slot-picker-overlay.active,
    .modal-overlay.active {
        background: rgba(20, 25, 34, 0.45);
        backdrop-filter: blur(4px);
    }

    .slot-picker {
        top: auto !important;
        right: 0 !important;
        bottom: 0 !important;
        left: 0 !important;
        display: none;
        flex-direction: column;
        width: 100%;
        max-width: none;
        min-width: 0;
        height: min(78dvh, 560px);
        max-height: min(78dvh, 560px);
        padding: 14px 14px calc(14px + env(safe-area-inset-bottom));
        border-radius: 18px 18px 0 0;
        overflow: hidden;
        box-shadow: 0 -14px 36px rgba(0, 0, 0, 0.22);
    }

    .slot-picker.active {
        display: flex;
    }
    .slot-picker-title {
        margin-bottom: 10px;
        font-size: 16px;
    }

    .slot-picker-list {
        flex: 1 1 auto;
        min-height: 0;
        max-height: none;
        overflow-y: auto;
        overscroll-behavior: contain;
        -webkit-overflow-scrolling: touch;
        touch-action: pan-y;
    }
    .slot-picker-item {
        min-height: 46px;
        padding: 9px 8px;
        font-size: 15px;
    }

    .slot-picker-item .check-box {
        width: 22px;
        height: 22px;
    }

    .slot-picker-footer {
        flex: 0 0 auto;
        background: #fff;
    }

    .slot-picker-footer .btn {
        width: 100%;
        min-height: 42px;
        font-size: 15px;
    }
    .billing-month-badge {
        margin-left: auto;
        padding: 3px 7px;
        font-size: 11px;
    }

    .billing-month-control {
        width: 100%;
        justify-content: space-between;
        font-size: 14px;
    }

    .billing-month-control select {
        max-width: none;
        min-height: 36px;
        font-size: 14px;
    }

    .fee-month-breakdown,
    .fee-cross-note {
        font-size: 11px;
    }
    .hours-edit-btn {
        min-width: 32px;
        min-height: 32px;
        margin-left: auto;
        font-size: 14px;
    }

    .special-hours-badge {
        padding: 3px 7px;
        font-size: 12px;
    }

    .modal {
        top: auto;
        right: 0;
        bottom: 0;
        left: 0;
        transform: none;
        width: 100%;
        max-width: none;
        max-height: 88dvh;
        border-radius: 18px 18px 0 0;
    }

    .modal-large {
        max-width: none;
    }

    .modal-header {
        padding: 14px 16px;
    }

    .modal-header h2 {
        font-size: 17px;
        line-height: 1.25;
    }

    .modal-close {
        width: 34px;
        height: 34px;
        flex: 0 0 auto;
    }

    .modal-body {
        max-height: calc(88dvh - 63px);
        padding: 14px 14px calc(16px + env(safe-area-inset-bottom));
    }

    .student-add-row,
    .timeslot-add-row {
        gap: 8px;
    }

    .student-add-row input,
    .timeslot-add-row input[type="time"] {
        min-width: 0;
        height: 42px;
        font-size: 16px;
    }

    .student-add-row .btn,
    .timeslot-add-row .btn {
        min-height: 42px;
        padding: 8px 12px;
        font-size: 14px;
    }

    .timeslot-add-row {
        flex-wrap: wrap;
    }

    .timeslot-add-row input[type="time"] {
        flex: 1 1 120px;
    }

    .timeslot-add-row .btn {
        flex: 1 0 100%;
    }

    .student-item,
    .timeslot-item,
    .fee-student-card {
        padding: 11px 12px;
        border-radius: 12px;
    }

    .student-item .name,
    .timeslot-label {
        font-size: 15px;
    }

    .student-item .delete-btn {
        width: 32px;
        height: 32px;
    }

    .fee-month-select,
    .fee-price-settings,
    .fee-student-header,
    .fee-student-actions {
        align-items: stretch;
    }

    .fee-month-select select {
        min-height: 38px;
        font-size: 14px;
    }

    .fee-price-settings input {
        width: 70px;
        min-height: 36px;
        font-size: 16px;
    }

    .fee-summary .total-amount {
        font-size: 26px;
    }

    .bill-text {
        font-size: 14px;
        line-height: 1.7;
    }

    .history-item-main {
        align-items: flex-start;
        flex-direction: column;
        gap: 3px;
    }

    .history-actions {
        display: grid;
        grid-template-columns: 1fr 1fr;
    }

    .history-actions .btn {
        min-height: 38px;
        min-width: 0;
    }

    .copy-dialog-overlay,
    .day-copy-overlay {
        align-items: flex-end;
    }

    .copy-dialog,
    .day-copy-dialog {
        width: 100%;
        max-width: none;
        min-width: 0;
        padding: 18px 16px calc(18px + env(safe-area-inset-bottom));
        border-radius: 18px 18px 0 0;
    }

    .day-copy-calendar {
        gap: 6px;
        padding: 10px;
    }

    .day-copy-cell {
        min-height: 38px;
        border-radius: 9px;
        font-size: 14px;
    }

    .copy-dialog-buttons,
    .day-copy-buttons {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
    }

    .day-copy-buttons .btn,
    .copy-dialog-buttons .btn {
        min-width: 0;
        min-height: 42px;
    }

    .toast {
        top: auto;
        right: 10px;
        bottom: calc(12px + env(safe-area-inset-bottom));
        left: 10px;
        width: auto;
        text-align: center;
        transform: translateY(20px);
    }

    .toast.show {
        transform: translateY(0);
    }

    .drop-overlay p {
        margin: 0 20px;
        padding: 18px 20px;
        font-size: 18px;
        text-align: center;
    }
}

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

    .controls label {
        display: none;
    }

    .controls select,
    .controls #studentFilter {
        grid-column: auto;
    }

    .controls .btn {
        font-size: 11px;
    }

    .stats {
        grid-template-columns: 1fr;
    }

    .time-label {
        min-width: 54px;
        font-size: 11px;
    }
}
