/* Reset & Base */
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; background: #f2f2f7; color: #333; line-height: 1.5; }

/* Navbar */
.navbar { display: flex; align-items: center; background: #1a1a2e; color: white; padding: 0 20px; height: 56px; position: sticky; top: 0; z-index: 1000; }
.nav-brand { font-weight: 600; font-size: 18px; margin-right: 40px; }
.nav-links { display: flex; gap: 4px; flex: 1; }
.nav-link {
    color: rgba(255,255,255,0.6);
    text-decoration: none;
    padding: 8px 16px;
    border-radius: 6px;
    transition: all 0.2s ease;
    font-size: 14px;
    font-weight: 500;
    position: relative;
}
.nav-link:hover {
    color: rgba(255,255,255,0.9);
    background: rgba(255,255,255,0.08);
}
.nav-link.active {
    color: white;
    background: rgba(255,255,255,0.12);
}

/* User Menu - Apple Style */
.user-menu { position: relative; }
.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    color: white;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.user-avatar:hover {
    transform: scale(1.05);
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.4);
}
.user-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 220px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 12px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.12), 0 0 0 1px rgba(0, 0, 0, 0.05);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px) scale(0.96);
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 1000;
    overflow: hidden;
}
.user-dropdown.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}
.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
}
.user-avatar-lg {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-size: 16px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.user-details { flex: 1; min-width: 0; }
.user-name {
    font-size: 14px;
    font-weight: 600;
    color: #1d1d1f;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.user-role {
    font-size: 12px;
    color: #86868b;
    margin-top: 2px;
}
.user-dropdown-divider {
    height: 1px;
    background: rgba(0, 0, 0, 0.08);
    margin: 0 12px;
}
.user-dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 12px 16px;
    border: none;
    background: none;
    font-size: 14px;
    color: #1d1d1f;
    cursor: pointer;
    transition: background 0.15s ease;
    text-align: left;
}
.user-dropdown-item:hover {
    background: rgba(0, 0, 0, 0.04);
}
.user-dropdown-item svg {
    color: #86868b;
}

/* Container */
.container { max-width: 1200px; margin: 0 auto; padding: 24px; }

/* Page Header */
.page-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; }
.page-header h1 { font-size: 24px; font-weight: 600; }
.header-actions { display: flex; align-items: center; gap: 12px; }
.search-input { padding: 8px 14px; border: 1px solid rgba(60,60,67,0.18); border-radius: 20px; font-size: 13px; background: #fff; width: 220px; transition: border-color 0.2s ease, box-shadow 0.2s ease; }
.search-input:hover { border-color: rgba(60,60,67,0.28); }
.search-input:focus { outline: none; border-color: rgba(0,122,255,0.5); box-shadow: 0 0 0 3px rgba(0,122,255,0.12); }
.search-input::placeholder { color: #8e8e93; }

/* Buttons */
.btn-primary { padding: 8px 16px; background: #007aff; color: white; border: none; border-radius: 20px; cursor: pointer; font-size: 13px; font-weight: 500; transition: all 0.2s ease; }
.btn-primary:hover { background: #0066d6; transform: scale(1.02); }
.btn-primary:active { transform: scale(0.98); }
.btn-secondary { padding: 8px 16px; background: #f5f5f7; color: #1d1d1f; border: none; border-radius: 20px; cursor: pointer; font-size: 13px; font-weight: 500; transition: all 0.2s ease; }
.btn-secondary:hover { background: #e8e8ed; }
.btn-link { background: none; border: none; color: #007aff; cursor: pointer; padding: 4px 8px; font-size: 13px; }
.btn-link:hover { text-decoration: underline; }
.btn-link.danger { color: #ff3b30; }

/* Action dropdown menu */
.action-menu { position: relative; display: inline-block; }
.action-btn { background: #f5f5f7; border: none; border-radius: 50%; width: 28px; height: 28px; cursor: pointer; font-size: 14px; color: #8e8e93; transition: all 0.2s ease; display: flex; align-items: center; justify-content: center; }
.action-btn:hover { background: #e8e8ed; color: #1d1d1f; }
.action-dropdown { position: absolute; right: 0; top: 100%; margin-top: 4px; background: white; border-radius: 12px; box-shadow: 0 4px 24px rgba(0,0,0,0.12), 0 0 0 1px rgba(0,0,0,0.04); min-width: 140px; padding: 4px 0; z-index: 100; opacity: 0; visibility: hidden; transform: translateY(-8px) scale(0.96); transform-origin: top right; transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1); }
.action-menu.open .action-dropdown { opacity: 1; visibility: visible; transform: translateY(0) scale(1); }
.action-dropdown button { display: block; width: 100%; padding: 9px 14px; border: none; background: none; text-align: left; cursor: pointer; font-size: 13px; color: #1d1d1f; transition: background 0.15s ease; }
.action-dropdown button:hover { background: #f5f5f7; }
.action-dropdown button.danger { color: #ff3b30; }
.action-dropdown button.danger:hover { background: #fff5f5; }
.action-dropdown .divider { height: 1px; background: #f0f0f0; margin: 4px 0; }

/* Forms */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; margin-bottom: 6px; font-weight: 500; color: #555; }
.form-group input, .form-group select, .form-group textarea { width: 100%; padding: 10px 12px; border: 1px solid #ddd; border-radius: 4px; font-size: 14px; }
.form-group input:focus, .form-group select:focus, .form-group textarea:focus { outline: none; border-color: #007bff; box-shadow: 0 0 0 3px rgba(0,123,255,0.1); }
.form-group small { display: block; margin-top: 4px; color: #888; font-size: 12px; }
.form-row { display: flex; gap: 16px; }
.form-row .form-group { flex: 1; }

/* Time validation error - Apple style */
.time-error {
    display: none;
    align-items: center;
    gap: 6px;
    padding: 10px 14px;
    margin: -8px 0 16px 0;
    background: rgba(255, 59, 48, 0.08);
    border-radius: 8px;
    font-size: 13px;
    color: #ff3b30;
    animation: errorShake 0.4s ease;
}
.time-error.show {
    display: flex;
}
.time-error svg {
    flex-shrink: 0;
}
@keyframes errorShake {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-4px); }
    40%, 80% { transform: translateX(4px); }
}
.form-group input.input-error,
.form-group input.input-error:focus {
    border-color: #ff3b30;
    box-shadow: 0 0 0 3px rgba(255, 59, 48, 0.12);
}

.radio-group, .checkbox-group { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 6px; }
.radio-group label, .checkbox-group label { display: flex; align-items: center; gap: 4px; cursor: pointer; font-weight: normal; }

/* Segment Control */
.segment-control { display: inline-flex; background: #e9ecef; border-radius: 8px; padding: 3px; margin-top: 6px; }
.segment { position: relative; cursor: pointer; margin: 0; }
.segment input { position: absolute; opacity: 0; pointer-events: none; }
.segment span { display: block; padding: 8px 16px; border-radius: 6px; font-size: 13px; font-weight: 500; color: #666; transition: all 0.2s; white-space: nowrap; }
.segment:hover span { color: #333; }
.segment.active span { background: white; color: #007bff; box-shadow: 0 1px 3px rgba(0,0,0,0.1); }

/* Filter bar */
.filter-bar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; gap: 16px; }
.filter-bar .filters { display: flex; gap: 8px; margin-bottom: 0; align-items: center; }
.filter-actions { display: flex; align-items: center; gap: 8px; }

/* Apple Select Component */
.apple-select {
    position: relative;
    display: inline-block;
}
.apple-select-trigger {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 12px;
    background: #f5f5f7;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    color: #1d1d1f;
    transition: all 0.2s ease;
    white-space: nowrap;
}
.apple-select-trigger:hover {
    background: #e8e8ed;
}
.apple-select.open .apple-select-trigger,
.apple-select.has-value .apple-select-trigger {
    background: #007aff;
    color: white;
}
.apple-select-text {
    max-width: 100px;
    overflow: hidden;
    text-overflow: ellipsis;
}
.apple-select-icon {
    flex-shrink: 0;
    opacity: 0.6;
    transition: transform 0.2s ease;
}
.apple-select.open .apple-select-icon {
    transform: rotate(180deg);
}
.apple-select-panel {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    min-width: 200px;
    max-width: 260px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 24px rgba(0,0,0,0.12), 0 0 0 1px rgba(0,0,0,0.04);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px) scale(0.96);
    transform-origin: top left;
    transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s ease;
    z-index: 1000;
    overflow: hidden;
}
.apple-select.open .apple-select-panel {
    display: block;
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}
.apple-select-search {
    padding: 8px;
    border-bottom: 1px solid #f0f0f0;
}
.apple-select-search input {
    width: 100%;
    padding: 8px 10px;
    border: none;
    border-radius: 8px;
    background: #f5f5f7;
    font-size: 13px;
    outline: none;
}
.apple-select-search input:focus {
    background: #ebebf0;
}
.apple-select-search input::placeholder {
    color: #8e8e93;
}
.apple-select-list {
    max-height: 220px;
    overflow-y: auto;
    padding: 4px 0;
}
.apple-select-item {
    display: flex;
    align-items: center;
    padding: 9px 12px;
    font-size: 13px;
    color: #1d1d1f;
    cursor: pointer;
    transition: background 0.15s ease;
}
.apple-select-item:hover {
    background: #f5f5f7;
}
.apple-select-item.selected {
    color: #007aff;
    font-weight: 500;
}
.apple-select-item.selected::before {
    content: '';
    width: 16px;
    height: 16px;
    margin-right: 8px;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='%23007aff' d='M13.3 4.3a1 1 0 010 1.4l-6 6a1 1 0 01-1.4 0l-3-3a1 1 0 111.4-1.4L6.5 9.6l5.3-5.3a1 1 0 011.5 0z'/%3E%3C/svg%3E") no-repeat center;
}
.apple-select-item.all-item {
    color: #8e8e93;
    border-bottom: 1px solid #f0f0f0;
    margin-bottom: 4px;
}
.apple-select-empty {
    padding: 20px;
    text-align: center;
    color: #8e8e93;
    font-size: 13px;
}

/* Apple Date Input */
.apple-date-input {
    padding: 7px 12px;
    background: #f5f5f7;
    border: none;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    color: #1d1d1f;
    cursor: pointer;
    transition: all 0.2s ease;
}
.apple-date-input:hover {
    background: #e8e8ed;
}
.apple-date-input:focus {
    outline: none;
    background: #007aff;
    color: white;
}
.apple-date-input::-webkit-calendar-picker-indicator {
    opacity: 0.5;
    cursor: pointer;
}
.apple-date-input:focus::-webkit-calendar-picker-indicator {
    filter: invert(1);
}

/* Icon Button */
.btn-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    background: #f5f5f7;
    border: none;
    border-radius: 50%;
    color: #666;
    cursor: pointer;
    transition: all 0.2s ease;
}
.btn-icon:hover {
    background: #e8e8ed;
    color: #333;
}

/* Weekday picker */
.weekday-picker { display: flex; gap: 8px; margin-top: 8px; }
.weekday-btn { display: flex; align-items: center; justify-content: center; width: 40px; height: 40px; border: 2px solid #ddd; border-radius: 50%; cursor: pointer; transition: all 0.2s; background: white; }
.weekday-btn input { display: none; }
.weekday-btn span { font-size: 14px; font-weight: 500; color: #555; line-height: 1; text-align: center; display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; }
.weekday-btn:hover { border-color: #007bff; background: #f0f7ff; }
.weekday-btn:has(input:checked) { border-color: #007bff; background: #007bff; }
.weekday-btn:has(input:checked) span { color: white; }
.weekday-btn.weekend span { color: #888; }
.weekday-btn.weekend:has(input:checked) { background: #6c757d; border-color: #6c757d; }
.weekday-btn.weekend:has(input:checked) span { color: white; }

/* Calendar picker */
.calendar-picker { border: 1px solid #ddd; border-radius: 8px; padding: 12px; background: white; max-width: 320px; }
.calendar-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.calendar-header span { font-weight: 600; font-size: 15px; }
.cal-nav { background: none; border: 1px solid #ddd; border-radius: 4px; width: 28px; height: 28px; cursor: pointer; font-size: 14px; }
.cal-nav:hover { background: #f0f0f0; }
.calendar-weekdays { display: grid; grid-template-columns: repeat(7, 1fr); text-align: center; margin-bottom: 8px; }
.calendar-weekdays span { font-size: 12px; color: #666; font-weight: 500; padding: 4px 0; }
.calendar-weekdays .weekend { color: #999; }
.calendar-days { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-day { aspect-ratio: 1; display: flex; align-items: center; justify-content: center; font-size: 13px; border-radius: 50%; cursor: pointer; transition: all 0.15s; border: 2px solid transparent; }
.cal-day:hover { background: #f0f7ff; border-color: #007bff; }
.cal-day.other-month { color: #ccc; }
.cal-day.other-month:hover { background: transparent; border-color: transparent; cursor: default; }
.cal-day.selected { background: #007bff; color: white; border-color: #007bff; }
.cal-day.today { border-color: #28a745; }
.selected-dates-list { margin-top: 12px; display: flex; flex-wrap: wrap; gap: 6px; max-height: 80px; overflow-y: auto; }
.selected-date-tag { display: inline-flex; align-items: center; gap: 4px; padding: 4px 8px; background: #e9ecef; border-radius: 4px; font-size: 12px; }
.selected-date-tag .remove { cursor: pointer; color: #999; font-weight: bold; }
.selected-date-tag .remove:hover { color: #dc3545; }
#selected-dates-count { font-size: 12px; color: #666; font-weight: normal; }

/* Calendar view dialog */
.calendar-view { padding: 20px; min-width: 320px; }
.calendar-view-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.calendar-view-header h3 { margin: 0; font-size: 18px; }
.btn-close { background: none; border: none; font-size: 24px; color: #999; cursor: pointer; padding: 0; line-height: 1; }
.btn-close:hover { color: #333; }
.calendar-view-info { background: #f8f9fa; border-radius: 8px; padding: 12px; margin-bottom: 16px; }
.info-row { display: flex; padding: 4px 0; }
.info-label { color: #666; width: 50px; flex-shrink: 0; }
.calendar-legend { display: flex; justify-content: center; gap: 20px; margin-top: 12px; }
.legend-item { display: flex; align-items: center; gap: 6px; font-size: 12px; color: #666; }
.legend-dot { width: 12px; height: 12px; border-radius: 50%; }
.legend-dot.is-start { background: #28a745; }
.legend-dot.scheduled { background: #007bff; }
.legend-dot.is-end { background: #dc3545; }
.cal-day.is-start { background: #28a745; color: white; border-color: #28a745; }
.cal-day.is-end { background: #dc3545; color: white; border-color: #dc3545; }
.cal-day.is-start.is-end { background: linear-gradient(135deg, #28a745 50%, #dc3545 50%); border-color: #28a745; }
.cal-day.has-schedule { background: #007bff; color: white; border-color: #007bff; }

/* Schedule list in calendar view */
.schedule-list { margin-top: 16px; max-height: 150px; overflow-y: auto; }
.schedule-item { padding: 8px 12px; background: #f8f9fa; border-radius: 6px; margin-bottom: 6px; font-size: 13px; }
.schedule-item .schedule-date { font-weight: 500; color: #333; }
.schedule-item .schedule-time { color: #666; margin-left: 8px; }
.schedule-item .schedule-teacher { color: #888; font-size: 12px; margin-top: 2px; }

/* Settings panel */
.settings-panel { padding: 20px; min-width: 400px; max-width: 500px; }
.settings-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; border-bottom: 1px solid #eee; padding-bottom: 12px; }
.settings-header h3 { margin: 0; font-size: 18px; }
.settings-section { margin-bottom: 20px; }
.settings-section h4 { font-size: 14px; color: #666; margin-bottom: 12px; font-weight: 500; }
.stats-row { display: flex; gap: 12px; }
.stat-item { flex: 1; background: #f8f9fa; border-radius: 8px; padding: 12px; text-align: center; }
.stat-num { display: block; font-size: 24px; font-weight: 600; color: #007bff; }
.stat-item .stat-label { font-size: 12px; color: #666; }
.tool-list { display: flex; flex-direction: column; gap: 8px; }
.tool-item { display: flex; justify-content: space-between; align-items: center; padding: 12px; background: #f8f9fa; border-radius: 8px; }
.tool-info { flex: 1; }
.tool-name { display: block; font-weight: 500; font-size: 14px; }
.tool-desc { display: block; font-size: 12px; color: #888; margin-top: 2px; }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-secondary.danger { color: #dc3545; border-color: #dc3545; }
.btn-secondary.danger:hover { background: #dc3545; color: white; }
.conflict-item { padding: 10px; background: #fff3cd; border-radius: 6px; margin-bottom: 8px; font-size: 13px; }
.conflict-item .conflict-type { font-weight: 500; color: #856404; }
.no-conflicts { color: #28a745; text-align: center; padding: 16px; }
.form-error { color: #dc3545; margin-bottom: 16px; padding: 10px; background: #f8d7da; border-radius: 4px; display: none; }
.form-error:not(:empty) { display: block; }

/* Tables */
.data-table { width: 100%; background: white; border-radius: 8px; box-shadow: 0 1px 3px rgba(0,0,0,0.1); border-collapse: collapse; }
.data-table th, .data-table td { padding: 12px 16px; text-align: left; border-bottom: 1px solid #eee; }
.data-table th { background: #f8f9fa; font-weight: 600; color: #555; }
.data-table tr:hover { background: #f8f9fa; }
.data-table tr:last-child td { border-bottom: none; }

/* Status badges - Apple semantic colors */
.status-active { color: #34c759; }      /* 进行中 - 绿色，健康活跃 */
.status-ongoing { color: #34c759; }     /* 进行中 - 绿色 */
.status-scheduled { color: #007aff; }   /* 待上课 - 蓝色，已计划 */
.status-pending { color: #007aff; }     /* 待处理 - 蓝色 */
.status-completed { color: #8e8e93; }   /* 已完成 - 灰色，淡化 */
.status-canceled { color: #8e8e93; }    /* 已取消 - 灰色 */
.status-no_show { color: #ff3b30; }     /* 缺勤 - 红色，异常 */
.status-inactive { color: #8e8e93; }    /* 已停用 - 灰色 */
.status-suspended { color: #ff3b30; }   /* 已暂停 - 红色 */
.status-draft { color: #8e8e93; }       /* 草稿 - 灰色 */
.status-published { color: #34c759; }   /* 已发布 - 绿色 */
.status-archived { color: #8e8e93; }    /* 已归档 - 灰色 */
.badge { display: inline-block; padding: 2px 8px; background: #e9ecef; color: #495057; border-radius: 4px; font-size: 11px; margin-left: 4px; }

/* Dialogs */
dialog {
    padding: 0;
    border: none;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
    max-width: 500px;
    width: 90%;
}
dialog[open] {
    display: flex;
    flex-direction: column;
    position: fixed !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
    margin: 0 !important;
}
dialog::backdrop { background: rgba(0,0,0,0.5); }
dialog form { padding: 24px; }
dialog h2 { margin-bottom: 20px; font-size: 20px; }
.dialog-buttons { display: flex; justify-content: flex-end; gap: 12px; margin-top: 24px; }

/* Dialog AppleSelect */
.dialog-select { width: 100%; }
.dialog-select .apple-select-trigger {
    width: 100%;
    height: 40px;
    justify-content: space-between;
    padding: 0 14px;
    border: 1px solid rgba(60,60,67,0.18);
    background: #fff;
    border-radius: 8px;
}
.dialog-select .apple-select-trigger:hover { border-color: rgba(60,60,67,0.28); }
.dialog-select.open .apple-select-trigger,
.dialog-select.has-value .apple-select-trigger {
    border-color: rgba(0,122,255,0.5);
    box-shadow: 0 0 0 3px rgba(0,122,255,0.12);
}
.dialog-select .apple-select-panel {
    width: 100%;
    max-width: none;
    z-index: 10001;
}
.dialog-select .apple-select-text {
    max-width: none;
    flex: 1;
}

/* Filters */
.filters { display: flex; gap: 12px; margin-bottom: 20px; }
.filters > select, .filters > input { padding: 8px 12px; border: 1px solid #ddd; border-radius: 4px; }

/* Dashboard - Legacy */
.dashboard h1 { margin-bottom: 24px; }
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 20px; margin-bottom: 40px; }
.stat-card { background: white; border-radius: 8px; padding: 24px; box-shadow: 0 1px 3px rgba(0,0,0,0.1); text-align: center; }
.stat-value { font-size: 36px; font-weight: 600; color: #007bff; }
.stat-label { color: #666; margin-top: 8px; }
.quick-links h2 { margin-bottom: 16px; font-size: 18px; }
.link-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 16px; }
.link-card { display: flex; flex-direction: column; align-items: center; padding: 24px; background: white; border-radius: 8px; box-shadow: 0 1px 3px rgba(0,0,0,0.1); text-decoration: none; color: #333; transition: all 0.2s; }
.link-card:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,0.15); }
.link-icon { font-size: 32px; margin-bottom: 12px; }
.link-text { font-weight: 500; }

/* =========================================================
   Dashboard - Apple Style (iOS-like minimal)
   ========================================================= */
.dashboard-apple {
    max-width: 1040px;
    margin: 0 auto;
    padding: 28px 24px 44px;
}

/* Greeting Section - Icon + Title + Meta with animation */
.greeting-section {
    margin-bottom: 24px;
    animation: greetingFadeIn 0.6s ease-out;
}

@keyframes greetingFadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.greeting__icon {
    font-size: 36px;
    line-height: 1;
    margin-bottom: 8px;
}

.greeting__title {
    font-size: 28px;
    line-height: 34px;
    font-weight: 600;
    letter-spacing: -0.2px;
    color: rgba(0,0,0,0.88);
    margin: 0 0 4px 0;
}

.greeting__meta {
    font-size: 13px;
    line-height: 18px;
    font-weight: 500;
    letter-spacing: 0.2px;
    color: rgba(60,60,67,0.6);
    margin: 0;
}

/* Section Labels - iOS Section Header */
.section-label {
    display: block;
    font-size: 13px;
    line-height: 18px;
    font-weight: 600;
    letter-spacing: 0.2px;
    color: rgba(60,60,67,0.6);
    margin: 20px 0 10px 4px;
}

.section-label:first-child,
.greeting-section + .overview-section .section-label {
    margin-top: 0;
}

/* Overview Section - 4 Tile Grid */
.overview-section {
    margin-bottom: 24px;
}

.tiles {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
}

.tile {
    background: #fff;
    border-radius: 16px;
    border: 1px solid rgba(60,60,67,0.08);
    box-shadow: 0 6px 18px rgba(0,0,0,0.06);
    padding: 14px 14px 12px;
    min-height: 110px;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.tile:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.10);
}

.tile__icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 12px;
}

.tile__icon svg {
    width: 22px;
    height: 22px;
}

.tile__icon.icon-branch {
    background: rgba(88,86,214,0.14);
    color: #5856d6;
}

.tile__icon.icon-teacher {
    background: rgba(0,122,255,0.14);
    color: #007aff;
}

.tile__icon.icon-student {
    background: rgba(52,199,89,0.14);
    color: #34c759;
}

.tile__icon.icon-graph {
    background: rgba(255,149,0,0.14);
    color: #ff9500;
}

.tile__value {
    font-size: 26px;
    line-height: 30px;
    font-weight: 700;
    color: rgba(0,0,0,0.88);
    margin-bottom: 4px;
}

.tile__label {
    font-size: 12px;
    line-height: 16px;
    color: rgba(60,60,67,0.6);
    font-weight: 500;
}

/* Quick Links Section */
.quicklinks-section {
    margin-bottom: 32px;
}

.quicklinks-card {
    background: #fff;
    border-radius: 16px;
    border: 1px solid rgba(60,60,67,0.08);
    box-shadow: 0 6px 18px rgba(0,0,0,0.06);
    overflow: hidden;
}

.quicklink-item {
    display: flex;
    align-items: center;
    padding: 14px 16px;
    min-height: 56px;
    text-decoration: none;
    color: inherit;
    transition: background 0.15s ease;
    border-bottom: 1px solid rgba(60,60,67,0.06);
}

.quicklink-item:last-child {
    border-bottom: none;
}

.quicklink-item:hover {
    background: rgba(60,60,67,0.04);
}

.quicklink-item:active {
    background: rgba(60,60,67,0.08);
}

.quicklink-item:focus-visible {
    outline: none;
    background: rgba(0,122,255,0.08);
    box-shadow: inset 0 0 0 2px rgba(0,122,255,0.3);
}

.quicklink-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 14px;
    flex-shrink: 0;
}

.quicklink-icon svg {
    width: 20px;
    height: 20px;
}

.quicklink-icon.icon-branch {
    background: rgba(88,86,214,0.14);
    color: #5856d6;
}

.quicklink-icon.icon-teacher {
    background: rgba(0,122,255,0.14);
    color: #007aff;
}

.quicklink-icon.icon-student {
    background: rgba(52,199,89,0.14);
    color: #34c759;
}

.quicklink-icon.icon-schedule {
    background: rgba(255,59,48,0.14);
    color: #ff3b30;
}

.quicklink-icon.icon-account {
    background: rgba(142,142,147,0.14);
    color: #8e8e93;
}

.quicklink-icon.icon-graph {
    background: rgba(255,149,0,0.14);
    color: #ff9500;
}

.quicklink-content {
    flex: 1;
    min-width: 0;
}

.quicklink-title {
    font-size: 16px;
    font-weight: 500;
    color: #1d1d1f;
    margin-bottom: 2px;
}

.quicklink-desc {
    font-size: 13px;
    color: #86868b;
}

.quicklink-arrow {
    width: 20px;
    height: 20px;
    color: #c7c7cc;
    flex-shrink: 0;
    margin-left: 8px;
}

/* Responsive - Dashboard */
@media (max-width: 960px) {
    .tiles {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 640px) {
    .dashboard-apple {
        padding: 20px 16px 32px;
    }

    .greeting__icon {
        font-size: 32px;
    }

    .greeting__title {
        font-size: 24px;
        line-height: 30px;
    }

    .tiles {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .tile {
        padding: 12px;
        min-height: 100px;
    }

    .tile__value {
        font-size: 22px;
        line-height: 26px;
    }

    .tile__icon {
        width: 38px;
        height: 38px;
        margin-bottom: 10px;
    }

    .tile__icon svg {
        width: 18px;
        height: 18px;
    }
}

@media (max-width: 400px) {
    .tiles {
        grid-template-columns: 1fr;
    }
}

/* Login page */
.login-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%); }
.login-container { background: white; padding: 40px; border-radius: 12px; box-shadow: 0 4px 20px rgba(0,0,0,0.2); width: 100%; max-width: 400px; }
.login-container h1 { text-align: center; margin-bottom: 32px; color: #1a1a2e; }
.login-container .btn-primary { width: 100%; }

/* =========================================================
   Schedule Toolbar (Apple Minimal v2)
   - scoped to .schedule-toolbar to avoid affecting other pages
   ========================================================= */
.schedule-toolbar{
    /* Apple-like "card" toolbar */
    background: rgba(255,255,255,0.78);
    border: 1px solid rgba(60,60,67,0.12);
    border-radius: 18px;
    padding: 10px 12px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.06);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);

    display: grid;
    grid-template-columns: 1fr auto;
    gap: 12px;
    align-items: center;
}

/* Left group: teacher / student / date */
.schedule-toolbar .filters{
    display: grid;
    grid-template-columns: repeat(3, minmax(140px, 200px));
    gap: 10px;
    align-items: center;
    margin: 0; /* neutralize any generic .filters rules */
}

/* Right group: search + settings */
.schedule-toolbar .filter-actions{
    display: inline-flex;
    align-items: center;
    gap: 10px;
    justify-content: flex-end;
}

/* Unified control tokens */
.schedule-toolbar{
    --ctl-h: 36px;
    --ctl-radius: 999px;
    --ctl-bg: rgba(255,255,255,0.72);
    --ctl-border: rgba(60,60,67,0.18);
    --ctl-border-hover: rgba(60,60,67,0.28);
    --ctl-ring: rgba(0,122,255,0.18);
    --ctl-text: #1d1d1f;
    --ctl-muted: #8e8e93;
}

/* Search: no width-jump on focus (avoids "layout shake") */
.schedule-toolbar .search-input{
    height: var(--ctl-h);
    width: 180px;
    border-radius: var(--ctl-radius);
    border: 1px solid var(--ctl-border);
    background: var(--ctl-bg);
    padding: 0 14px;
    font-size: 13px;
    transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}
.schedule-toolbar .search-input:hover{ border-color: var(--ctl-border-hover); }
.schedule-toolbar .search-input:focus{
    outline: none;
    border-color: rgba(0,122,255,0.55);
    background: rgba(255,255,255,0.86);
    box-shadow: 0 0 0 4px var(--ctl-ring);
    width: 180px; /* prevent resize */
}

/* Settings icon button */
.schedule-toolbar .btn-icon{
    width: var(--ctl-h);
    height: var(--ctl-h);
    border-radius: 50%;
    border: 1px solid var(--ctl-border);
    background: var(--ctl-bg);
    color: #5c5c60;
}
.schedule-toolbar .btn-icon:hover{
    border-color: var(--ctl-border-hover);
    background: rgba(255,255,255,0.86);
    color: #1d1d1f;
}

/* Apple Select: clean pill with subtle borders */
.schedule-toolbar .apple-select{ width: 100%; }
.schedule-toolbar .apple-select-trigger{
    height: var(--ctl-h);
    width: 100%;
    justify-content: space-between;
    padding: 0 14px;
    border-radius: var(--ctl-radius);
    border: 1px solid var(--ctl-border);
    background: var(--ctl-bg);
    color: var(--ctl-text);
}
.schedule-toolbar .apple-select-trigger:hover{ border-color: var(--ctl-border-hover); }
.schedule-toolbar .apple-select.open .apple-select-trigger,
.schedule-toolbar .apple-select.has-value .apple-select-trigger{
    border-color: rgba(0,122,255,0.55);
    background: rgba(255,255,255,0.86);
    box-shadow: 0 0 0 4px var(--ctl-ring);
    color: var(--ctl-text);
}
.schedule-toolbar .apple-select-icon{ opacity: 0.55; }
.schedule-toolbar .apple-select-text{
    max-width: 140px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Panel: align, soften */
.schedule-toolbar .apple-select-panel{
    width: 100%;
    min-width: 220px;
    max-width: 300px;
    border-radius: 14px;
    border: 1px solid rgba(60,60,67,0.12);
    box-shadow: 0 18px 50px rgba(0,0,0,0.14);
}

/* Prevent right-edge overflow: align the second dropdown panel to the right */
.schedule-toolbar #select-student .apple-select-panel{
    left: auto;
    right: 0;
    transform-origin: top right;
}

/* Search inside panel */
.schedule-toolbar .apple-select-search{
    padding: 10px;
}
.schedule-toolbar .apple-select-search input{
    height: 34px;
    border-radius: 12px;
    border: 1px solid rgba(60,60,67,0.12);
    background: rgba(245,245,247,0.9);
    outline: none;
}
.schedule-toolbar .apple-select-search input:focus{
    background: rgba(245,245,247,1);
    box-shadow: 0 0 0 4px var(--ctl-ring);
}

/* List items */
.schedule-toolbar .apple-select-item{
    padding: 10px 12px;
    border-radius: 10px;
    margin: 2px 8px;
}
.schedule-toolbar .apple-select-item:hover{ background: rgba(0,0,0,0.04); }
.schedule-toolbar .apple-select-item.selected{
    color: #007aff;
    background: rgba(0,122,255,0.08);
}
.schedule-toolbar .apple-select-item.all-item{
    margin: 0;
    border-radius: 0;
    padding: 10px 12px;
}

/* Date input: same pill styling */
.schedule-toolbar .apple-date-input{
    height: var(--ctl-h);
    border-radius: var(--ctl-radius);
    border: 1px solid var(--ctl-border);
    background: var(--ctl-bg);
    padding: 0 14px;
    font-size: 13px;
    color: var(--ctl-text);
}
.schedule-toolbar .apple-date-input:hover{ border-color: var(--ctl-border-hover); }
.schedule-toolbar .apple-date-input:focus{
    outline: none;
    border-color: rgba(0,122,255,0.55);
    background: rgba(255,255,255,0.86);
    box-shadow: 0 0 0 4px var(--ctl-ring);
    color: var(--ctl-text);
}
.schedule-toolbar .apple-date-input::-webkit-calendar-picker-indicator{ opacity: 0.55; }

/* Responsive: stack gracefully */
@media (max-width: 900px){
    .schedule-toolbar{
        grid-template-columns: 1fr;
        gap: 10px;
    }
    .schedule-toolbar .filters{
        grid-template-columns: 1fr;
    }
    .schedule-toolbar .filter-actions{
        justify-content: space-between;
    }
    .schedule-toolbar .search-input{
        width: 100%;
    }
    .schedule-toolbar .search-input:focus{
        width: 100%;
    }
}

/* LaTeX 文档环境样式 */
.latex-env {
    margin: 16px 0;
    padding: 12px 16px;
    border-radius: 8px;
    background: #fafafa;
}
.latex-env-title {
    font-weight: 600;
    margin-bottom: 8px;
    font-size: 14px;
}
.latex-env-content {
    line-height: 1.7;
}

/* 定理/引理/推论 - 蓝色 */
.env-theorem {
    border-left: 4px solid #007aff;
    background: rgba(0,122,255,0.04);
}
.env-theorem .latex-env-title {
    color: #007aff;
}

/* 定义 - 绿色 */
.env-definition {
    border-left: 4px solid #34c759;
    background: rgba(52,199,89,0.04);
}
.env-definition .latex-env-title {
    color: #34c759;
}

/* 证明 - 灰色 */
.env-proof {
    border-left: 4px solid #86868b;
    background: rgba(134,134,139,0.04);
}
.env-proof .latex-env-title {
    color: #555;
    font-style: italic;
}
.env-proof .latex-env-content::after {
    content: ' ∎';
    float: right;
    color: #86868b;
}

/* 例 - 橙色 */
.env-example {
    border-left: 4px solid #ff9500;
    background: rgba(255,149,0,0.04);
}
.env-example .latex-env-title {
    color: #ff9500;
}

/* 备注/注 - 灰色斜体 */
.env-remark {
    border-left: 4px solid #c7c7cc;
    background: rgba(199,199,204,0.08);
}
.env-remark .latex-env-title {
    color: #86868b;
    font-style: italic;
}
