/* ========================================
   Smart Study Web - Modern Stylesheet
   ======================================== */

:root {
    --primary: #4A6FA5;
    --primary-light: #6B8DC0;
    --primary-dark: #3A5A8A;
    --primary-bg: #EEF2F8;
    --primary-hover-bg: #E4EAF4;
    --success: #4CAF82;
    --success-bg: #EBF7F2;
    --completed: #16A34A;
    --completed-bg: #DCFCE7;
    --warning: #D4930D;
    --warning-bg: #FEF8E8;
    --danger: #D44D4D;
    --danger-bg: #FEF0F0;
    --info: #6C63FF;
    --info-bg: #F0EFFE;
    --bg: #E8EEF4;
    --surface: #FFFFFF;
    --surface-2: #F4F7FB;
    --border: #DDE3ED;
    --border-light: #EEF2F7;
    --text: #2D3A4A;
    --text-secondary: #6B7A90;
    --text-muted: #9AAABD;
    --radius: 10px;
    --radius-sm: 7px;
    --shadow-sm: 0 1px 3px rgba(45, 58, 74, 0.06);
    --shadow: 0 2px 10px rgba(45, 58, 74, 0.08);
    --shadow-lg: 0 8px 32px rgba(45, 58, 74, 0.12);
    --shadow-card: 0 1px 3px rgba(45, 58, 74, 0.05), 0 4px 16px rgba(45, 58, 74, 0.06);
    --font: 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', -apple-system, BlinkMacSystemFont, sans-serif;
}

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

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    font-size: 13px;
    line-height: 1.5;
    overflow-x: hidden;
}

/* ---- App Container ---- */
.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

/* ---- Header ---- */
.header {
    background: var(--surface);
    color: var(--text);
    padding: 0 24px;
    height: 58px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    position: relative;
    z-index: 10;
}

.header::before {
    content: '';
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 4px;
    background: linear-gradient(180deg, var(--primary) 0%, var(--primary-dark) 100%);
    border-radius: 0 2px 2px 0;
}

.header-brand {
    display: flex;
    align-items: center;
    gap: 10px;
}

.header-brand .brand-icon {
    width: 34px;
    height: 34px;
    background: linear-gradient(145deg, var(--primary), var(--primary-dark));
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(74, 111, 165, 0.3);
    flex-shrink: 0;
}

.header-brand .brand-icon svg { stroke: white; }

.header-brand h1 { font-size: 15px; font-weight: 700; color: var(--text); letter-spacing: 0.2px; }

.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    color: var(--text-secondary);
}

.status-indicator .dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #86EFAC;
}

.status-indicator.warning .dot { background: #FCD34D; }
.status-indicator.error .dot { background: #FCA5A5; }

.worker-count {
    font-size: 12px;
    color: var(--text-secondary);
    background: var(--surface-2);
    padding: 3px 10px;
    border-radius: 20px;
    border: 1px solid var(--border);
}

/* ---- Navigation ---- */
.nav-tabs {
    background: var(--surface);
    display: flex;
    padding: 0 24px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.tab-btn {
    background: none;
    border: none;
    padding: 14px 18px;
    font-size: 13px;
    font-family: var(--font);
    color: var(--text-secondary);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.15s;
    font-weight: 500;
    margin-bottom: -1px;
}

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

.tab-btn.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
    font-weight: 600;
}

/* ---- Main Content ---- */
.main-content {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.tab-panel {
    display: none;
    flex: 1;
    overflow-y: auto;
    padding: 20px 28px;
    flex-direction: column;
}

.tab-panel.active { display: flex; }

/* ---- Panel Header ---- */
.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
    flex-shrink: 0;
}

.panel-header h2 { font-size: 15px; font-weight: 700; color: var(--text); }

.header-toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ---- Buttons ---- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 6px 14px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-family: var(--font);
    font-weight: 500;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all 0.15s;
    white-space: nowrap;
    line-height: 1.4;
}

.btn-primary {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
    box-shadow: 0 1px 3px rgba(74, 111, 165, 0.2);
}
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); box-shadow: 0 2px 6px rgba(74, 111, 165, 0.3); }

.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn-secondary:hover { background: var(--surface-2); border-color: #C8D0DE; }

.btn-success {
    background: var(--success);
    color: white;
    box-shadow: 0 1px 3px rgba(76, 175, 130, 0.2);
}
.btn-success:hover { background: #3D9469; box-shadow: 0 2px 6px rgba(76, 175, 130, 0.3); }

.btn-warning { background: var(--warning); color: white; }
.btn-warning:hover { background: #B37D0A; }

.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { background: #B83D3D; }

.btn-info { background: var(--info); color: white; }
.btn-info:hover { background: #5A50E0; }

.btn:disabled { opacity: 0.45; cursor: not-allowed; }

.btn-sm { padding: 4px 10px; font-size: 11px; }

.btn-outline {
    background: transparent;
    color: var(--primary);
    border-color: var(--primary);
}
.btn-outline:hover { background: var(--primary-bg); }

/* ---- Data List (replaces card grid) ---- */
.data-list {
    flex: 1;
    overflow-y: auto;
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow-card);
    border: 1px solid var(--border);
}

.list-item {
    display: flex;
    align-items: center;
    padding: 13px 18px;
    border-bottom: 1px solid var(--border-light);
    gap: 12px;
    transition: background 0.1s;
}

.list-item:last-child { border-bottom: none; }
.list-item:hover { background: var(--primary-bg); }
.list-item.selected { background: var(--primary-hover-bg); }

.list-item-main { flex: 1; min-width: 0; }
.list-item-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 2px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.list-item-title .name-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-item-meta { font-size: 11px; color: var(--text-muted); }

.list-item-stats {
    display: flex;
    gap: 16px;
    flex-shrink: 0;
}

.list-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 44px;
}

.list-stat-value {
    font-size: 14px;
    font-weight: 700;
    color: var(--text);
    line-height: 1.2;
}

.list-stat-label {
    font-size: 10px;
    color: var(--text-muted);
    white-space: nowrap;
}

.list-stat-value.success { color: var(--success); }
.list-stat-value.warning { color: var(--warning); }
.list-stat-value.danger { color: var(--danger); }
.list-stat-value.primary { color: var(--primary); }

.list-item-actions {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}

/* ---- Tables ---- */
.table-container {
    flex: 1;
    overflow: auto;
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
}

.pagination-wrap {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    border-top: 1px solid var(--border);
    background: var(--surface);
    gap: 12px;
    flex-wrap: wrap;
}
.pagination-wrap .pagination-btns {
    display: flex;
    align-items: center;
    gap: 4px;
}
.pagination-wrap .btn {
    min-width: 36px;
}
.pagination-wrap .page-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 30px;
    padding: 0 6px;
    font-size: 13px;
    color: var(--text-primary);
    cursor: pointer;
    border-radius: 4px;
    border: 1px solid transparent;
}
.pagination-wrap .page-num:hover { background: var(--primary-hover-bg); }
.pagination-wrap .page-num.active {
    background: var(--primary);
    color: #fff;
    font-weight: 600;
    cursor: default;
}
.pagination-wrap .page-ellipsis {
    color: var(--text-muted);
    padding: 0 4px;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

.data-table thead {
    background: var(--surface-2);
    position: sticky;
    top: 0;
    z-index: 1;
}

.data-table th {
    padding: 10px 12px;
    text-align: left;
    font-weight: 600;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.data-table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border-light);
    vertical-align: middle;
    color: var(--text);
}

.data-table tbody tr:hover { background: var(--primary-bg); }
.data-table tbody tr:last-child td { border-bottom: none; }

/* ---- Status Pills ---- */
.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
}

.status-pill.running { background: var(--info-bg); color: var(--info); }
.status-pill.completed { background: var(--completed-bg); color: var(--completed); }
.status-pill.failed { background: var(--danger-bg); color: var(--danger); }
.status-pill.pending { background: var(--warning-bg); color: var(--warning); }
.status-pill.in_progress { background: var(--info-bg); color: var(--info); }
.status-pill.stopped { background: var(--surface-2); color: var(--text-muted); border: 1px solid var(--border); }
.status-pill.incomplete { background: var(--warning-bg); color: var(--warning); border: 1px solid var(--warning); }

.phase-info {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 20px;
    background: var(--success-bg);
    color: var(--success);
    font-size: 12px;
    font-weight: 500;
}

.sub-task-summary {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--text-secondary);
}

.sub-task-summary span {
    padding: 2px 6px;
    border-radius: 4px;
    background: var(--bg-secondary);
    font-size: 11px;
}

.status-pill::before {
    content: '';
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: currentColor;
    opacity: 0.7;
}

@keyframes pulse-dot {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

.status-pill.running::before { animation: pulse-dot 1.5s infinite; }

/* ---- Progress Bar ---- */
.progress-bar {
    width: 100%;
    height: 5px;
    background: var(--border);
    border-radius: 3px;
    overflow: hidden;
}

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

.progress-bar-fill.success { background: linear-gradient(90deg, #66BB8A, var(--success)); }
.progress-bar-fill.warning { background: linear-gradient(90deg, #E8A830, var(--warning)); }

/* ---- Form Elements ---- */
.form-group { margin-bottom: 14px; }
.form-group label {
    display: block;
    font-size: 12px;
    font-weight: 500;
    margin-bottom: 5px;
    color: var(--text);
}

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

.input, .select, .textarea {
    width: 100%;
    padding: 8px 12px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-family: var(--font);
    background: var(--surface);
    transition: border-color 0.15s, box-shadow 0.15s;
    color: var(--text);
}

.input:focus, .select:focus, .textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(74, 111, 165, 0.1);
}

.textarea { resize: vertical; min-height: 72px; }

.form-hint {
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 4px;
    display: block;
    background: var(--surface-2);
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    line-height: 1.6;
    border: 1px solid var(--border-light);
}

.form-hint-inline {
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 4px;
    display: block;
}

.input-with-unit {
    display: flex;
    align-items: center;
    gap: 6px;
}
.input-with-unit .input {
    width: 80px;
    flex-shrink: 0;
}
.input-unit {
    font-size: 13px;
    color: var(--text-secondary);
    flex-shrink: 0;
}

.checkbox-group, .radio-group { display: flex; flex-wrap: wrap; gap: 10px; }
.checkbox-label, .radio-label {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    cursor: pointer;
    color: var(--text);
}

.checkbox-list {
    overflow-y: auto;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 6px;
    background: var(--surface);
}

.task-student-list {
    flex: 1;
    overflow-y: auto;
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 8px;
    min-height: 200px;
    background: var(--surface);
}

.task-student-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 4px;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
}

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

.task-student-item:hover {
    background: var(--primary-bg);
}

.checkbox-list label {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 5px 4px;
    cursor: pointer;
    border-radius: 4px;
    font-size: 12px;
}

.checkbox-list label:hover { background: var(--primary-bg); }

/* ---- Modal ---- */
.modal {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(30, 40, 60, 0.45);
    backdrop-filter: blur(4px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.show { display: flex; }

.modal.modal-top {
    align-items: flex-start;
    justify-content: center;
    padding-top: 28px;
}

.modal.modal-top .modal-dialog {
    margin-top: 0;
}

.modal-dialog {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    width: 90%;
    max-width: 480px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    animation: modalIn 0.2s ease;
    border: 1px solid var(--border);
}

.modal-dialog.modal-lg { max-width: 620px; }
.modal-dialog.modal-xl { max-width: 960px; }
.modal-dialog.modal-xxl { max-width: 1200px; }

.task-modal-layout {
    display: flex;
    gap: 20px;
    min-height: 500px;
}

.task-config-panel {
    width: 320px;
    flex-shrink: 0;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 16px;
    background: var(--bg-secondary);
}

.task-student-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 16px;
    background: var(--bg-secondary);
    min-width: 0;
}

.task-panel-title {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
    color: var(--text-primary);
}

.task-filters {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 12px;
}

.task-filter-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.task-filter-row > * {
    flex: 1;
    min-width: 120px;
}

.task-filter-row input,
.task-filter-row select {
    width: 100%;
}

.task-filter-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
}

.task-config-area {
    display: inline-block;
    width: 340px;
    vertical-align: top;
    padding-right: 16px;
    border-right: 1px solid var(--border);
    margin-right: 16px;
}

.task-student-area {
    display: inline-block;
    width: calc(100% - 380px);
    vertical-align: top;
    min-height: 200px;
}

/* ---- Enrollment Modal ---- */
.enrollment-modal-layout {
    display: flex;
    gap: 20px;
    min-height: 520px;
}

.enrollment-config-panel {
    width: 340px;
    flex-shrink: 0;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 16px;
    background: var(--bg-secondary);
}

.enrollment-student-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 16px;
    background: var(--bg-secondary);
    min-width: 0;
}

.enrollment-panel-title {
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
    color: var(--text-primary);
}

.enrollment-filters {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 10px;
}

.enrollment-filter-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.enrollment-filter-row > * {
    flex: 1;
    min-width: 120px;
}

.enrollment-filter-row input,
.enrollment-filter-row select {
    width: 100%;
}

.enrollment-filter-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
}

.enrollment-student-list {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
}

.enrollment-student-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 6px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    transition: background 0.1s;
}

.enrollment-student-item:hover {
    background: var(--primary-bg);
}

.enrollment-student-item input[type="checkbox"] {
    width: 14px;
    height: 14px;
    cursor: pointer;
    flex-shrink: 0;
}

.enrollment-student-item .stu-name {
    font-weight: 500;
    color: var(--text-primary);
    min-width: 60px;
}

.enrollment-student-item .stu-username {
    color: var(--text-secondary);
    font-size: 11px;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.enrollment-student-item.selected {
    background: var(--primary-bg);
}

.enrollment-empty-hint {
    padding: 16px;
    text-align: center;
    color: var(--text-muted);
    font-size: 13px;
}

.enrollment-courses-section {
    font-size: 12px;
}

/* Student rows inside enrollment modal (rendered by renderEnrollmentStudents) */
.task-student-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 6px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    transition: background 0.1s;
}

.task-student-row:hover {
    background: var(--primary-bg);
}

.task-student-row input[type="checkbox"] {
    width: 14px;
    height: 14px;
    cursor: pointer;
    flex-shrink: 0;
}

.task-student-name {
    font-weight: 500;
    color: var(--text-primary);
    min-width: 60px;
}

.task-student-username {
    color: var(--text-secondary);
    font-size: 11px;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.task-student-school {
    color: var(--text-muted);
    font-size: 10px;
    max-width: 80px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.task-student-row input[type="checkbox"]:checked + .task-student-name {
    color: var(--primary);
}

@keyframes modalIn {
    from { transform: translateY(-16px) scale(0.98); opacity: 0; }
    to { transform: translateY(0) scale(1); opacity: 1; }
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 22px;
    border-bottom: 1px solid var(--border);
}

.modal-header h3 { font-size: 15px; font-weight: 700; }

.modal-close {
    background: none;
    border: none;
    font-size: 20px;
    color: var(--text-muted);
    cursor: pointer;
    line-height: 1;
    padding: 2px 6px;
    border-radius: 4px;
    transition: background 0.1s;
}

.modal-close:hover { background: var(--danger-bg); color: var(--danger); }

.modal-body {
    padding: 20px 22px;
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 14px 22px;
    border-top: 1px solid var(--border);
}

.hidden { display: none !important; }

/* ---- Task Detail ---- */
.task-detail-header {
    background: var(--surface-2);
    padding: 14px 16px;
    border-radius: var(--radius-sm);
    margin-bottom: 14px;
    font-size: 12px;
    border: 1px solid var(--border-light);
}

.task-detail-header .stat-row { display: flex; gap: 20px; flex-wrap: wrap; }
.task-detail-header .stat-item { display: flex; gap: 5px; }
.task-detail-header .stat-label { color: var(--text-secondary); }
.task-detail-header .stat-value { font-weight: 600; }

.task-detail-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }

/* ---- Progress Items ---- */
.student-info-header {
    background: var(--surface-2);
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    margin-bottom: 14px;
    font-size: 12px;
    border: 1px solid var(--border-light);
}

.progress-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-light);
}

.progress-item:last-child { border-bottom: none; }
.progress-item-info { flex: 1; min-width: 0; }
.progress-item-title { font-weight: 500; font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.progress-item-meta { font-size: 11px; color: var(--text-muted); margin-top: 1px; }
.progress-item-status { text-align: right; flex-shrink: 0; margin-left: 12px; }
.progress-item-score { font-weight: 600; font-size: 14px; }

/* ---- Course Catalog (course > chapter > video) ---- */
.catalog-stats {
    display: flex;
    gap: 16px;
    padding: 10px 14px;
    background: #f8f9fa;
    border-radius: 8px;
    margin-bottom: 14px;
    font-size: 13px;
}
.catalog-stats span { color: var(--text-secondary); }
.catalog-stats strong { color: var(--primary); margin: 0 4px; }

.catalog-course {
    border: 1px solid var(--border);
    border-radius: 10px;
    margin-bottom: 10px;
    overflow: hidden;
}
.catalog-course-header {
    display: flex;
    align-items: center;
    padding: 10px 14px;
    background: #f0f4ff;
    cursor: pointer;
    gap: 8px;
    user-select: none;
}
.catalog-course-header:hover { background: #e8eeff; }
.catalog-course-name {
    flex: 1;
    font-weight: 600;
    font-size: 13px;
    color: var(--primary);
}
.catalog-course-meta { font-size: 11px; color: var(--text-secondary); }
.catalog-course-progress {
    font-size: 11px;
    color: var(--text-secondary);
    margin-left: auto;
}
.catalog-course-arrow {
    font-size: 11px;
    transition: transform 0.2s;
    color: var(--text-muted);
}
.catalog-course-arrow.expanded { transform: rotate(90deg); }

.catalog-chapters { display: none; padding: 6px 0; }
.catalog-chapters.expanded { display: block; }

.catalog-chapter {
    padding: 6px 14px 6px 30px;
    border-bottom: 1px dashed #eee;
    font-size: 12px;
}
.catalog-chapter:last-child { border-bottom: none; }
.catalog-chapter-header {
    display: flex;
    align-items: center;
    padding: 4px 0;
    cursor: pointer;
    gap: 6px;
}
.catalog-chapter-header:hover .catalog-chapter-name { color: var(--primary); }
.catalog-chapter-arrow {
    font-size: 10px;
    transition: transform 0.2s;
    color: var(--text-muted);
    flex-shrink: 0;
}
.catalog-chapter-arrow.expanded { transform: rotate(90deg); }
.catalog-chapter-name { flex: 1; font-weight: 500; }
.catalog-chapter-video-count { font-size: 11px; color: var(--text-muted); }

.catalog-videos { display: none; padding: 2px 0 2px 20px; }
.catalog-videos.expanded { display: block; }

.catalog-video {
    display: flex;
    align-items: center;
    padding: 4px 8px;
    border-radius: 6px;
    gap: 8px;
    font-size: 12px;
}
.catalog-video:hover { background: #f5f5f5; }
.catalog-video-icon { flex-shrink: 0; }
.catalog-video-name { flex: 1; }
.catalog-video-status { flex-shrink: 0; font-size: 11px; }
.catalog-video-status.done { color: var(--success); }
.catalog-video-status.pending { color: var(--warning); }

.catalog-refreshing {
    text-align: center;
    padding: 20px;
    color: var(--text-secondary);
    font-size: 13px;
}

/* ---- Tabs within Modal ---- */
.modal-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 14px;
    border-bottom: 1px solid var(--border);
}

#taskDetailTabs {
    margin-top: 14px;
}

.modal-tab-btn {
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    padding: 8px 14px;
    font-size: 12px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.15s;
    margin-bottom: -1px;
}

.modal-tab-btn:hover { color: var(--primary); }
.modal-tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }

/* ---- Log Display ---- */
.log-container { flex: 1; overflow: hidden; display: flex; flex-direction: column; }

.log-display {
    flex: 1;
    overflow-y: auto;
    background: #1A2332;
    color: #8899BB;
    border-radius: var(--radius);
    padding: 14px 16px;
    font-family: 'Cascadia Code', 'Consolas', 'Courier New', monospace;
    font-size: 11px;
    line-height: 1.7;
}

.log-entry { padding: 1px 0; word-break: break-all; border-bottom: 1px solid rgba(148, 163, 184, 0.18); }
.log-entry:last-child { border-bottom: none; }
.log-entry .log-time { color: #4A5C78; margin-right: 8px; }
.log-entry .log-user { color: #6BA4E0; margin-right: 8px; }
.log-entry .log-msg { color: #A8B8CC; }

/* ---- Enrollment Detail Modal ---- */
.enr-detail-tabs {
    display: flex;
    gap: 0;
    border-bottom: 1px solid var(--border);
}
.enr-detail-tab {
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    padding: 10px 16px;
    font-size: 13px;
    color: var(--text-secondary);
    cursor: pointer;
    margin-bottom: -1px;
}
.enr-detail-tab:hover { color: var(--primary); }
.enr-detail-tab.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }

.enr-detail-loading {
    text-align: center;
    padding: 32px;
    color: var(--text-muted);
    font-size: 13px;
}

.enr-stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}
.enr-stat-card {
    background: var(--surface-2);
    border-radius: 8px;
    padding: 12px 14px;
    text-align: center;
}
.enr-stat-label { font-size: 11px; color: var(--text-secondary); margin-bottom: 4px; }
.enr-stat-value { font-size: 20px; font-weight: 700; }

.enr-info-row {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 10px 20px;
    padding: 14px;
    background: var(--surface-2);
    border-radius: 8px;
}
.enr-info-item { display: flex; gap: 8px; font-size: 13px; line-height: 1.6; }
.enr-info-label { color: var(--text-secondary); flex-shrink: 0; min-width: 60px; }
.enr-info-value { color: var(--text); word-break: break-all; }

.enr-section-title { font-size: 13px; font-weight: 600; color: var(--text-secondary); margin-bottom: 8px; }

.enr-course-list { display: flex; flex-direction: column; gap: 6px; }
.enr-course-item {
    display: flex;
    gap: 12px;
    align-items: center;
    padding: 8px 12px;
    background: var(--surface-2);
    border-radius: 6px;
    font-size: 13px;
}
.enr-course-name { flex: 1; font-weight: 500; }
.enr-course-id { color: var(--text-secondary); font-size: 12px; }
.enr-course-type { color: var(--primary); font-size: 11px; }

.enr-log-line { padding: 1px 0; border-bottom: 1px solid rgba(148, 197, 255, 0.12); }
.enr-log-line:last-child { border-bottom: none; }

.enr-detail-panel .data-table { font-size: 12px; }

/* ---- Empty State ---- */
.empty-state {
    text-align: center;
    padding: 48px 20px;
    color: var(--text-muted);
    font-size: 13px;
}

/* ---- Scrollbar ---- */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #CBD5E1; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #94A8C0; }

/* ---- Responsive ---- */
@media (max-width: 768px) {
    .header { padding: 0 16px; height: 54px; }
    .tab-btn { padding: 12px 12px; font-size: 12px; }
    .tab-panel { padding: 16px; }
    .panel-header { flex-direction: column; align-items: flex-start; gap: 10px; }
    .list-item-stats { display: none; }
    .form-row { flex-direction: column; }
    .org-account-layout { grid-template-columns: 1fr; }
    .account-info-grid { grid-template-columns: 1fr; }
}

/* ---- Login Page ---- */
.login-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: #E8EEF4;
    background-image:
        radial-gradient(ellipse at 20% 50%, rgba(99, 126, 180, 0.12) 0%, transparent 60%),
        radial-gradient(ellipse at 80% 20%, rgba(82, 145, 140, 0.10) 0%, transparent 50%),
        radial-gradient(ellipse at 60% 80%, rgba(120, 100, 170, 0.08) 0%, transparent 50%);
    position: relative;
    overflow: hidden;
}

.login-wrap::before {
    content: '';
    position: absolute;
    top: -120px;
    right: -120px;
    width: 480px;
    height: 480px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(180, 200, 230, 0.3) 0%, transparent 70%);
    pointer-events: none;
}

.login-wrap::after {
    content: '';
    position: absolute;
    bottom: -80px;
    left: -60px;
    width: 320px;
    height: 320px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(160, 190, 180, 0.25) 0%, transparent 70%);
    pointer-events: none;
}

.login-card {
    background: rgba(255, 255, 255, 0.88);
    backdrop-filter: blur(18px) saturate(1.4);
    -webkit-backdrop-filter: blur(18px) saturate(1.4);
    border: 1px solid rgba(255, 255, 255, 0.7);
    border-radius: 20px;
    box-shadow: 0 8px 40px rgba(80, 100, 140, 0.12), 0 1px 0 rgba(255,255,255,0.8) inset;
    padding: 48px 40px;
    width: 100%;
    max-width: 380px;
    position: relative;
    z-index: 1;
}

.login-header { text-align: center; margin-bottom: 36px; }
.login-header .logo-icon {
    width: 52px;
    height: 52px;
    margin: 0 auto 16px;
    background: linear-gradient(145deg, #4A6FA5, #2D5F8B);
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 16px rgba(45, 95, 139, 0.3);
}
.login-header .logo-icon svg { stroke: white; }
.login-header h1 { font-size: 20px; font-weight: 700; color: #2D3A4A; margin-bottom: 4px; letter-spacing: 0.3px; }
.login-header p { font-size: 12px; color: #8896A8; }

.login-form { display: flex; flex-direction: column; gap: 14px; }
.login-form .input { padding: 10px 13px; font-size: 13px; }
.btn-block { width: 100%; justify-content: center; padding: 11px; font-size: 14px; }

.form-error {
    color: var(--danger);
    font-size: 12px;
    padding: 9px 12px;
    background: var(--danger-bg);
    border-radius: var(--radius-sm);
    border: 1px solid #FECACA;
}

.login-hint {
    text-align: center;
    margin-top: 20px;
    font-size: 11px;
    color: #A0AABB;
}

.login-hint code {
    background: #EEF2F7;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: Consolas, monospace;
    color: #4A6FA5;
}
.login-footer-link {
    margin-top: 10px;
    text-align: center;
    font-size: 12px;
    color: #7A8AAA;
}
.login-footer-link a {
    color: #4A6FA5;
    text-decoration: none;
    font-weight: 500;
}
.login-footer-link a:hover {
    text-decoration: underline;
}
}

.user-display {
    color: var(--text-secondary);
    font-size: 12px;
    padding: 3px 10px;
    background: var(--surface-2);
    border-radius: 20px;
    border: 1px solid var(--border);
}

/* ---- Misc ---- */
.batch-tag {
    display: inline-block;
    background: var(--primary-bg);
    color: var(--primary);
    font-size: 10px;
    padding: 1px 7px;
    border-radius: 10px;
    font-weight: 600;
}

.log-cell {
    max-width: 160px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 11px;
    color: var(--text-muted);
}

/* ---- Balance List ---- */
.balance-list { display: flex; flex-direction: column; }
.balance-item {
    display: flex;
    align-items: center;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-light);
    gap: 12px;
}
.balance-item:last-child { border-bottom: none; }
.balance-item:hover { background: var(--primary-bg); }
.balance-item-main { flex: 1; }
.balance-item-name { font-weight: 600; font-size: 13px; margin-bottom: 3px; }
.balance-item-stats { display: flex; gap: 20px; }
.balance-stat { font-size: 12px; }
.balance-stat-label { color: var(--text-muted); }
.balance-stat-val { font-weight: 600; margin-left: 4px; }
.balance-stat-val.pos { color: var(--success); }
.balance-stat-val.neg { color: var(--danger); }
.balance-item-actions { flex-shrink: 0; }

/* ---- Media Page ---- */
.media-stats-bar {
    display: flex;
    gap: 0;
    margin-bottom: 14px;
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow-card);
    border: 1px solid var(--border);
    overflow: hidden;
}

.media-stat-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 14px 8px;
    border-right: 1px solid var(--border-light);
}
.media-stat-item:last-child { border-right: none; }

.media-stat-num { font-size: 22px; font-weight: 700; background: linear-gradient(135deg, var(--primary), var(--primary-dark)); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; line-height: 1.2; }
.media-stat-label { font-size: 10px; color: var(--text-muted); margin-top: 2px; }

.media-thumb-wrap {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--surface-2);
    flex-shrink: 0;
    border: 1px solid var(--border-light);
}
.media-thumb { width: 100%; height: 100%; object-fit: cover; }
.media-video-thumb { cursor: pointer; }

.media-preview-area {
    background: var(--surface-2);
    border-radius: var(--radius-sm);
    padding: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 180px;
    border: 1px solid var(--border-light);
}
.media-full-img { max-width: 100%; max-height: 360px; border-radius: var(--radius-sm); }
.media-full-video { max-width: 100%; max-height: 360px; border-radius: var(--radius-sm); }

.media-student-info {
    background: var(--surface-2);
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    margin-bottom: 12px;
    font-size: 12px;
    border: 1px solid var(--border-light);
}
.media-preview-thumb {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: var(--surface-2);
    border-radius: var(--radius-sm);
    margin-top: 8px;
}
.media-preview-img { max-width: 72px; max-height: 54px; border-radius: 4px; object-fit: cover; }

/* ---- Billing Page ---- */
.billing-summary-row {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
}
.billing-card {
    flex: 1;
    background: var(--surface);
    border-radius: var(--radius);
    padding: 16px;
    text-align: center;
    box-shadow: var(--shadow-card);
    border: 1px solid var(--border);
}
.billing-card-title {
    font-size: 11px;
    color: var(--text-muted);
    margin-bottom: 6px;
    font-weight: 500;
}
.billing-card-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--primary);
    line-height: 1;
}
.billing-card-desc {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* ---- Chart Styles ---- */
.chart-row {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 20px;
}
.chart-card {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 16px;
    box-shadow: var(--shadow-card);
    border: 1px solid var(--border);
    flex: 1 1 300px;
    transition: box-shadow 0.2s ease;
}
.chart-card:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
}
.chart-card .chart-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
}

.notice-panel {
    margin-bottom: 20px;
}

.notice-list {
    display: grid;
    gap: 10px;
}

.notice-item {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface-2);
    padding: 12px 14px;
}

.notice-item-title {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: flex-start;
    font-weight: 600;
    color: var(--text-primary);
}

.notice-item-time {
    flex: 0 0 auto;
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 400;
}

.notice-item-content {
    margin-top: 6px;
    color: var(--text-secondary);
    white-space: pre-wrap;
    line-height: 1.55;
    font-size: 13px;
}

.overview-section {
    margin-top: 20px;
}
.dashboard-kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}
.kpi-card {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    box-shadow: var(--shadow-card);
}
.kpi-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.kpi-info {
    min-width: 0;
}
.kpi-value {
    font-size: 22px;
    font-weight: 700;
    color: var(--text);
    line-height: 1.2;
}
.kpi-label {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 2px;
}
.chart-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-light);
}

.billing-settings-preview {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 16px;
    box-shadow: var(--shadow-card);
    border: 1px solid var(--border);
}
.billing-settings-preview h3 {
    font-size: 13px;
    margin-bottom: 12px;
    color: var(--text);
}
.billing-rules-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 10px;
}
.billing-rule-item {
    background: var(--surface-2);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    text-align: center;
}
.billing-rule-label {
    font-size: 11px;
    color: var(--text-muted);
    margin-bottom: 4px;
}
.billing-rule-value {
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
}
.billing-rule-value.disabled {
    color: var(--text-muted);
}

.billing-records-section {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 16px;
    box-shadow: var(--shadow-card);
    border: 1px solid var(--border);
}
.billing-records-section h3 {
    font-size: 13px;
    margin-bottom: 12px;
    color: var(--text);
}

/* Billing Settings Modal */
.billing-type-selector {
    display: flex;
    gap: 16px;
    margin-bottom: 20px;
}
.billing-type-option {
    flex: 1;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}
.billing-type-option:hover {
    border-color: var(--primary-light);
    background: var(--primary-bg);
}
.billing-type-option.active {
    border-color: var(--primary);
    background: var(--primary-bg);
}
.billing-type-icon {
    margin-bottom: 8px;
    color: var(--primary);
}
.billing-type-name {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 4px;
    color: var(--text);
}
.billing-type-desc {
    font-size: 11px;
    color: var(--text-muted);
}
.billing-settings-section {
    background: var(--surface-2);
    border-radius: var(--radius-sm);
    padding: 16px;
    border: 1px solid var(--border-light);
}
.billing-hint {
    margin-top: 10px;
    padding: 8px 12px;
    background: var(--info-bg);
    border-radius: var(--radius-sm);
    font-size: 11px;
    color: var(--info);
}
.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 13px;
}
.checkbox-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

/* ---- Student Filter Bar ---- */
.filter-bar {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 12px 16px;
    margin-bottom: 12px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    flex-shrink: 0;
}

.filter-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.filter-group label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    white-space: nowrap;
}

.filter-group .input,
.filter-group .select {
    width: auto;
    min-width: 120px;
    padding: 5px 10px;
    font-size: 12px;
}

.filter-group .select {
    min-width: 110px;
}

.filter-group input[type="date"] {
    width: 130px;
}

/* ---- Select (dropdown) style ---- */
select.input {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748B' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 30px;
}

/* ---- Table Loading Spinner ---- */
.table-spinner-wrap {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 24px 0;
    color: var(--text-muted);
    font-size: 13px;
    gap: 8px;
}
.table-spinner {
    width: 18px;
    height: 18px;
    border: 2px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    flex-shrink: 0;
}
.btn-spinner {
    display: inline-block;
    width: 12px;
    height: 12px;
    border: 2px solid rgba(255,255,255,0.4);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    vertical-align: middle;
}
@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ---- Login Error State ---- */
.login-error {
    color: var(--danger) !important;
    font-weight: 600;
    cursor: not-allowed;
}

/* ---- Table Loading Overlay ---- */
.table-loading-overlay {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(232, 238, 244, 0.92);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 14px;
    z-index: 10;
    border-radius: 8px;
}
.table-loading-overlay .table-spinner {
    width: 36px;
    height: 36px;
    border-width: 3px;
    border-color: var(--border);
    border-top-color: var(--primary);
}
.table-loading-overlay .loading-text {
    color: var(--text-secondary);
    font-size: 14px;
    letter-spacing: 0.5px;
}
.table-container {
    position: relative;
}

/* ---- Full-screen Modal Loading Overlay (e.g. during batch import) ---- */
.global-loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    display: none;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    gap: 18px;
    z-index: 99999;
    backdrop-filter: blur(2px);
}
.global-loading-overlay.active {
    display: flex;
}
.global-loading-overlay .loading-spinner {
    width: 56px;
    height: 56px;
    border: 5px solid rgba(255, 255, 255, 0.25);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
.global-loading-overlay .loading-text {
    color: #fff;
    font-size: 16px;
    letter-spacing: 1px;
    font-weight: 500;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
}
.global-loading-overlay .loading-subtext {
    color: rgba(255, 255, 255, 0.75);
    font-size: 13px;
    margin-top: -8px;
}

/* ---- Institution Portal Styles ---- */
.org-badge {
    display: inline-block;
    padding: 3px 10px;
    background: var(--primary-bg);
    color: var(--primary);
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    margin-left: 10px;
    border: 1px solid var(--border);
}

.form-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    max-width: 480px;
}

.org-account-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.25fr) minmax(320px, 420px);
    gap: 18px;
    align-items: start;
}

.account-info-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 22px;
    box-shadow: var(--shadow-card);
}

.account-profile-head {
    display: flex;
    align-items: center;
    gap: 14px;
    padding-bottom: 18px;
    margin-bottom: 18px;
    border-bottom: 1px solid var(--border-light);
}

.account-avatar {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: var(--primary-bg);
    color: var(--primary-dark);
    font-size: 22px;
    font-weight: 700;
}

.account-profile-head h3 {
    font-size: 18px;
    line-height: 1.3;
    color: var(--text);
}

.account-profile-head p,
.account-panel-title p {
    color: var(--text-secondary);
    font-size: 12px;
    margin-top: 3px;
}

.account-info-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.account-info-item {
    padding: 12px;
    background: var(--surface-2);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
}

.account-info-wide {
    grid-column: 1 / -1;
}

.account-info-item span {
    display: block;
    color: var(--text-secondary);
    font-size: 12px;
    margin-bottom: 5px;
}

.account-info-item strong {
    display: block;
    color: var(--text);
    font-size: 14px;
    font-weight: 600;
    overflow-wrap: anywhere;
}

.org-password-card {
    max-width: none;
    box-shadow: var(--shadow-card);
}

.account-panel-title {
    margin-bottom: 18px;
}

.account-panel-title h3 {
    font-size: 16px;
    color: var(--text);
}

.org-password-btn {
    width: 100%;
    justify-content: center;
    margin-top: 4px;
}

.catalog-course {
    margin-bottom: 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.catalog-course-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: var(--surface-2);
    border-bottom: 1px solid var(--border-light);
    font-size: 13px;
    font-weight: 500;
}

.catalog-course-name {
    color: var(--text);
    flex: 1;
}

.catalog-progress {
    color: var(--text-secondary);
    font-size: 12px;
    white-space: nowrap;
    margin-left: 12px;
}

.catalog-video {
    display: flex;
    align-items: center;
    padding: 5px 12px;
    font-size: 12px;
    border-bottom: 1px solid var(--border-light);
}

.catalog-video:last-child {
    border-bottom: none;
}

.catalog-video-icon {
    width: 20px;
    flex-shrink: 0;
}

.catalog-video-name {
    flex: 1;
    color: var(--text);
}

.catalog-video-progress {
    color: var(--text-secondary);
    margin-left: 8px;
    min-width: 36px;
    text-align: right;
}

.catalog-video-done {
    background: var(--completed-bg);
}

.catalog-video-done .catalog-video-icon {
    color: var(--completed);
}

.catalog-video-done .catalog-video-progress {
    color: var(--completed);
}

.catalog-video-pending {
    background: transparent;
}

.catalog-video-pending .catalog-video-icon {
    color: var(--text-muted);
}

.task-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

.task-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    cursor: pointer;
    transition: box-shadow 0.2s, border-color 0.2s;
}

.task-card:hover {
    box-shadow: 0 4px 16px rgba(74, 111, 165, 0.12);
    border-color: var(--primary-light);
}

.task-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.task-card-header h4 {
    margin: 0;
    font-size: 15px;
    color: var(--text);
    font-weight: 600;
}

.task-status-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 500;
}

.status-running { background: var(--completed-bg); color: var(--completed); }
.status-stopped { background: var(--warning-bg); color: var(--warning); }
.status-idle { background: var(--surface-2); color: var(--text-secondary); }

.task-card-body {
    display: flex;
    gap: 12px;
}

.task-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
    padding: 8px;
    background: var(--surface-2);
    border-radius: var(--radius-sm);
}

.task-stat-label {
    font-size: 11px;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.task-stat-value {
    font-size: 16px;
    font-weight: 600;
    color: var(--primary);
}

.task-detail-header {
    padding: 12px 16px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    margin-bottom: 12px;
}

.task-detail-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px 24px;
    font-size: 13px;
    color: var(--text);
}

.task-detail-row span {
    white-space: nowrap;
}

/* ---- Toast Card Notification ---- */
#toast-card {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 99999;
    min-width: 280px;
    max-width: 420px;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 4px 24px rgba(0,0,0,0.15);
    padding: 16px 20px;
    display: none;
    font-family: 'Segoe UI', 'PingFang SC', sans-serif;
}
#toast-card.show { display: block; animation: slideIn 0.25s ease; }
#toast-card.hide { animation: slideOut 0.3s ease forwards; }
@keyframes slideIn {
    from { transform: translateX(120%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}
@keyframes slideOut {
    from { transform: translateX(0); opacity: 1; }
    to { transform: translateX(120%); opacity: 0; }
}
.toast-title {
    font-size: 14px;
    font-weight: 600;
    color: #222;
    margin-bottom: 8px;
}
.toast-body { font-size: 13px; color: #555; line-height: 1.6; }
.toast-stats {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}
.toast-stat {
    background: #f0f4ff;
    border-radius: 6px;
    padding: 6px 14px;
    font-size: 13px;
    color: #333;
    font-weight: 500;
}
.toast-stat strong { color: #1a73e8; margin-right: 4px; }
.toast-stat.success { background: #e6f4ea; }
.toast-stat.success strong { color: #1e8e3e; }
.toast-stat.error { background: #fce8e6; }
.toast-stat.error strong { color: #d93025; }

/* ---- System Settings Tab ---- */
.settings-card {
    background: #fff;
    border-radius: 10px;
    border: 1px solid #e4eaf4;
    overflow: hidden;
    max-width: 800px;
}

.settings-card-header {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 18px 22px;
    background: var(--primary-bg);
    border-bottom: 1px solid #dce6f5;
}

.settings-card-icon {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    background: var(--primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.settings-card-header h3 {
    margin: 0 0 4px;
    font-size: 16px;
    color: var(--primary-dark);
}

.settings-card-header p {
    margin: 0;
    font-size: 13px;
    color: #666;
}

.settings-card-body {
    padding: 20px 22px;
    display: flex;
    flex-direction: column;
    gap: 0;
}

.settings-toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid #f0f4fa;
}

.settings-toggle-row:last-child {
    border-bottom: none;
}

.settings-toggle-info {
    flex: 1;
}

.toggle-label {
    font-size: 14px;
    font-weight: 500;
    color: #333;
    cursor: pointer;
}

.toggle-desc {
    display: block;
    font-size: 12px;
    color: #888;
    margin-top: 2px;
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 42px;
    height: 24px;
    flex-shrink: 0;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: #ccc;
    transition: 0.25s;
    border-radius: 24px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.25s;
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.toggle-switch input:checked + .toggle-slider {
    background-color: var(--primary);
}

.toggle-switch input:checked + .toggle-slider:before {
    transform: translateX(18px);
}

/* Inline type switches in settings */
.type-switches-row {
    gap: 24px !important;
    flex-wrap: nowrap !important;
    align-items: center;
}
.type-switches-label {
    font-size: 13px;
    color: var(--text-secondary);
    white-space: nowrap;
    flex-shrink: 0;
}
.type-switch-item {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}
.type-toggle {
    width: 42px !important;
    height: 24px !important;
    flex-shrink: 0;
    display: inline-block !important;
    position: relative !important;
}
.type-switch-text {
    font-size: 13px;
    white-space: nowrap;
    user-select: none;
}

.settings-divider {
    height: 1px;
    background: #e4eaf4;
    margin: 8px 0;
}

.settings-section-title {
    font-size: 13px;
    font-weight: 600;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 12px 0 4px;
}

.settings-form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    padding: 10px 0;
}

#tab-settings .form-group {
    padding: 8px 0;
}

#tab-settings textarea.input {
    resize: vertical;
    font-family: monospace;
    font-size: 13px;
}

/* ---- Settings Accordion ---- */
.settings-accordion {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 800px;
}

.settings-section {
    background: #fff;
    border-radius: 10px;
    border: 1px solid #e4eaf4;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: box-shadow 0.2s;
}

.settings-section:hover {
    box-shadow: var(--shadow);
}

.settings-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    cursor: pointer;
    user-select: none;
    transition: background 0.15s;
}

.settings-section-header:hover {
    background: #f8fafc;
}

.settings-section-left {
    display: flex;
    align-items: center;
    gap: 14px;
}

.settings-section-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.settings-section-left h3 {
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
    margin: 0 0 3px;
}

.settings-section-left p {
    font-size: 12px;
    color: #888;
    margin: 0;
}

.settings-section-right {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.settings-section-status {
    font-size: 12px;
    font-weight: 500;
    padding: 3px 10px;
    border-radius: 20px;
    background: #f0f0f0;
    color: #888;
}

.settings-section-status.active {
    background: #e6f4ea;
    color: #1e8e3e;
}

.settings-section-arrow {
    color: #bbb;
    display: flex;
    align-items: center;
    transition: transform 0.2s;
}

.settings-section.open .settings-section-arrow {
    transform: rotate(180deg);
}

.settings-section.open .settings-section-arrow svg {
    stroke: var(--primary);
}

.settings-section-body {
    border-top: 1px solid #e4eaf4;
    padding: 20px 22px;
    display: flex;
    flex-direction: column;
}

.settings-action-row {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    padding: 10px 0;
}

.settings-checkbox-group {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    padding: 8px 0;
}

.settings-checkbox-item {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    font-size: 13px;
    color: #555;
}

/* Scheduler refresh stats box */
.scheduler-stats-box {
    background: #f4f7fb;
    border: 1px solid #dde3ed;
    border-radius: 8px;
    padding: 14px 16px;
    margin: 8px 0;
}

.scheduler-stats-title {
    font-size: 13px;
    font-weight: 600;
    color: #2d3a4a;
    margin-bottom: 12px;
}

.scheduler-stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

@media (max-width: 768px) {
    .scheduler-stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

.stat-item {
    text-align: center;
}

.stat-label {
    font-size: 11px;
    color: #6b7a90;
    margin-bottom: 4px;
}

.stat-value {
    font-size: 14px;
    font-weight: 600;
    color: #2d3a4a;
}

.stat-value.text-success { color: #4caf82; }
.stat-value.text-danger { color: #d44d4d; }
.stat-value.text-muted { color: #9aaabd; }

/* Data Health Dashboard */
.data-health-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

@media (max-width: 768px) {
    .data-health-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

.data-health-card {
    background: #f4f7fb;
    border: 1px solid #dde3ed;
    border-radius: 8px;
    padding: 14px;
    text-align: center;
    border-left: 3px solid transparent;
}

.data-health-card.card-trusted { border-left-color: #4caf82; background: #f0faf5; }
.data-health-card.card-stale { border-left-color: #d4930d; background: #fef8e8; }
.data-health-card.card-danger { border-left-color: #d44d4d; background: #fef0f0; }
.data-health-card.card-info { border-left-color: #6c63ff; background: #f0effe; }

.data-health-label {
    font-size: 11px;
    color: #6b7a90;
    margin-bottom: 6px;
    font-weight: 500;
}

.data-health-value {
    font-size: 22px;
    font-weight: 700;
    color: #2d3a4a;
    line-height: 1.2;
}

.data-health-sub {
    font-size: 10px;
    color: #9aaabd;
    margin-top: 2px;
}

/* Task management */
.task-worker-bar {
    display: flex;
    align-items: center;
    gap: 18px;
    padding: 10px 14px;
    margin-bottom: 10px;
    background: #f6f9fc;
    border: 1px solid #dde6f0;
    border-radius: 8px;
    color: #3d4c5f;
    font-size: 13px;
}

.task-worker-bar .btn {
    margin-left: auto;
}

.task-list-item .batch-tag {
    margin-left: 8px;
}

.task-student-pagination {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    padding: 10px 0 2px;
    color: #6b7a90;
    font-size: 12px;
}

/* Enrollment queue modal */
.queue-modal { max-width: 1240px; }

.queue-modal-body {
    padding: 18px 22px;
    overflow: auto;
    max-height: 74vh;
    background: #f8fafc;
}

.queue-modal-footer {
    gap: 8px;
    flex-wrap: wrap;
}

.queue-stat-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 14px;
}

.queue-stat-card {
    min-height: 86px;
    padding: 14px 16px;
    border: 1px solid var(--border-light);
    border-left: 4px solid var(--primary);
    border-radius: 8px;
    background: var(--surface);
    box-shadow: var(--shadow-sm);
}

.queue-stat-card span {
    display: block;
    color: var(--text-secondary);
    font-size: 12px;
    margin-bottom: 8px;
}

.queue-stat-card strong {
    color: var(--text);
    font-size: 26px;
    line-height: 1;
}

.queue-stat-card.accent-worker { border-left-color: var(--success); }
.queue-stat-card.accent-total { border-left-color: var(--primary); }
.queue-stat-card.accent-active { border-left-color: var(--warning); }
.queue-stat-card.accent-redis { border-left-color: var(--info); }

.queue-note {
    margin: 0 0 14px;
    padding: 10px 12px;
    border: 1px solid #d8e5f4;
    border-radius: 8px;
    background: #f2f7fd;
    color: var(--primary-dark);
    font-weight: 600;
}

.queue-section-title {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 16px 0 8px;
    color: var(--text);
    font-size: 15px;
    font-weight: 700;
}

.queue-section-title::after {
    content: "";
    height: 1px;
    flex: 1;
    background: var(--border-light);
}

.queue-table-card {
    border-radius: 8px;
    overflow: hidden;
    background: var(--surface);
    box-shadow: var(--shadow-sm);
}

.queue-table-card .data-table th {
    background: #eef3f9;
    color: #65758b;
    font-size: 12px;
    letter-spacing: 0;
}

.queue-table-card .data-table td {
    height: 48px;
    vertical-align: middle;
}

.queue-table-card .num,
.queue-mini-table td:last-child {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.queue-muted {
    margin-top: 2px;
    color: var(--text-muted);
    font-size: 12px;
}

.queue-status-badge,
.queue-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    height: 24px;
    padding: 0 9px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
}

.queue-status-badge.online {
    background: var(--success-bg);
    color: var(--completed);
}

.queue-status-badge.offline {
    background: var(--danger-bg);
    color: var(--danger);
}

.queue-count {
    background: var(--surface-2);
    color: var(--text-secondary);
}

.queue-count.hot {
    background: var(--warning-bg);
    color: var(--warning);
}

.queue-detail-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    margin-top: 14px;
    align-items: start;
}

.queue-detail-card {
    padding: 12px 14px;
    border: 1px solid var(--border-light);
    border-radius: 8px;
    background: var(--surface);
    box-shadow: var(--shadow-sm);
}

.queue-detail-card h4 {
    margin: 0 0 8px;
    color: var(--text);
    font-size: 14px;
}

.queue-mini-table {
    width: 100%;
    table-layout: fixed;
    border-collapse: collapse;
}

.queue-mini-table td {
    padding: 9px 0;
    border-top: 1px solid var(--border-light);
    color: var(--text-secondary);
}

.queue-mini-table tr:first-child td { border-top: 0; }
.queue-mini-table td:last-child { color: var(--text); font-weight: 700; }

@media (max-width: 900px) {
    .queue-stat-grid,
    .queue-detail-grid {
        grid-template-columns: 1fr;
    }
}
