/* 公共样式 - 轻量版教务 */
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
    font-family: "Microsoft YaHei", "PingFang SC", sans-serif;
    font-size: 14px;
    color: #1f2937;
    background: #f3f4f6;
    line-height: 1.5;
}
a { color: #3b82f6; text-decoration: none; }
a:hover { text-decoration: underline; }

.layout { display: flex; min-height: 100vh; }
.sidebar {
    width: 220px;
    background: linear-gradient(180deg, #1e40af, #1e3a8a);
    color: #fff;
    flex-shrink: 0;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}
.logo {
    padding: 20px 18px;
    font-size: 16px;
    font-weight: 700;
    border-bottom: 1px solid rgba(255,255,255,0.15);
    display: flex;
    align-items: center;
    gap: 8px;
}
.logo .badge {
    background: rgba(255,255,255,0.2);
    color: #fff;
    font-size: 10px;
    padding: 1px 6px;
    border-radius: 8px;
    margin-left: auto;
}
.nav-group { padding: 10px 0; }
.nav-group-title {
    padding: 8px 18px;
    font-size: 11px;
    color: rgba(255,255,255,0.5);
    text-transform: uppercase;
}
.nav-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 18px;
    color: rgba(255,255,255,0.85);
    font-size: 14px;
    cursor: pointer;
    transition: background 0.15s;
}
.nav-item:hover { background: rgba(255,255,255,0.08); text-decoration: none; }
.nav-item.active {
    background: rgba(255,255,255,0.15);
    color: #fff;
    font-weight: 600;
    border-left: 3px solid #fbbf24;
    padding-left: 15px;
}
.nav-icon { font-size: 14px; width: 18px; text-align: center; }

.main {
    flex: 1;
    padding: 18px 24px;
    overflow-x: auto;
    min-width: 0;
}
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid #e5e7eb;
}
.page-header h2 { font-size: 20px; color: #111; }
.page-header .desc { color: #6b7280; font-size: 12px; margin-top: 4px; }

.toolbar {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-bottom: 12px;
    flex-wrap: wrap;
}
.toolbar input, .toolbar select {
    padding: 6px 10px;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    background: #fff;
    font-size: 13px;
    height: 32px;
}
.toolbar input[type="text"] { min-width: 200px; }

.btn {
    padding: 6px 14px;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    background: #fff;
    cursor: pointer;
    font-size: 13px;
    height: 32px;
    transition: all 0.15s;
}
.btn:hover { background: #f3f4f6; }
.btn-primary { background: #3b82f6; color: #fff; border-color: #3b82f6; }
.btn-primary:hover { background: #2563eb; }
.btn-success { background: #10b981; color: #fff; border-color: #10b981; }
.btn-success:hover { background: #059669; }
.btn-danger { background: #ef4444; color: #fff; border-color: #ef4444; }
.btn-danger:hover { background: #dc2626; }
.btn-warn { background: #f59e0b; color: #fff; border-color: #f59e0b; }
.btn-link {
    background: none;
    border: none;
    color: #3b82f6;
    cursor: pointer;
    padding: 0 4px;
    font-size: 13px;
}
.btn-link:hover { text-decoration: underline; }
.btn-link.danger { color: #ef4444; }

.card {
    background: #fff;
    border-radius: 6px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    border: 1px solid #e5e7eb;
    overflow: hidden;
}
.card-pad { padding: 16px; }

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
th {
    background: #f9fafb;
    text-align: left;
    padding: 10px 12px;
    color: #374151;
    font-weight: 600;
    border-bottom: 1px solid #e5e7eb;
    white-space: nowrap;
}
td {
    padding: 9px 12px;
    border-bottom: 1px solid #f3f4f6;
    vertical-align: middle;
}
tr:hover td { background: #f9fafb; }
td.actions { white-space: nowrap; }
.empty {
    text-align: center;
    color: #9ca3af;
    padding: 40px;
    font-size: 13px;
}
.tag {
    display: inline-block;
    padding: 1px 8px;
    border-radius: 10px;
    font-size: 11px;
    line-height: 1.5;
}
.tag-success { background: #d1fae5; color: #065f46; }
.tag-warn { background: #fef3c7; color: #92400e; }
.tag-info { background: #dbeafe; color: #1e40af; }
.tag-danger { background: #fee2e2; color: #991b1b; }
.tag-muted { background: #f3f4f6; color: #6b7280; }

/* Modal */
.modal-mask {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 100;
    align-items: center;
    justify-content: center;
}
.modal-mask.show { display: flex; }
.modal {
    background: #fff;
    border-radius: 6px;
    width: 600px;
    max-width: 90vw;
    max-height: 85vh;
    overflow-y: auto;
}
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 18px;
    border-bottom: 1px solid #e5e7eb;
}
.modal-header h3 { font-size: 16px; }
.modal-header .close {
    background: none;
    border: none;
    font-size: 22px;
    cursor: pointer;
    color: #6b7280;
    line-height: 1;
}
.modal-body { padding: 18px; }
.modal-footer {
    padding: 12px 18px;
    border-top: 1px solid #e5e7eb;
    text-align: right;
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}
.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px 16px;
}
.form-item { display: flex; flex-direction: column; gap: 4px; }
.form-item.full { grid-column: 1 / -1; }
.form-item label {
    font-size: 12px;
    color: #374151;
    font-weight: 500;
}
.form-item label .required { color: #ef4444; }
.form-item input, .form-item select, .form-item textarea {
    padding: 6px 10px;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    font-size: 13px;
    height: 32px;
    background: #fff;
}
.form-item textarea { height: 60px; resize: vertical; }
.form-item input:focus, .form-item select:focus, .form-item textarea:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 2px rgba(59,130,246,0.1);
}

/* Toast */
.toast {
    position: fixed;
    top: 16px;
    left: 50%;
    transform: translateX(-50%);
    padding: 8px 18px;
    border-radius: 4px;
    color: #fff;
    font-size: 13px;
    z-index: 200;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    opacity: 1;
    transition: opacity 0.3s;
}
.toast.success { background: #10b981; }
.toast.error { background: #ef4444; }
.toast.warning { background: #f59e0b; }
.toast.info { background: #3b82f6; }

/* Pagination */
.pagination {
    display: flex;
    gap: 4px;
    justify-content: center;
    align-items: center;
    padding: 12px;
}
.pagination button {
    padding: 4px 10px;
    border: 1px solid #d1d5db;
    background: #fff;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
}
.pagination button.active {
    background: #3b82f6;
    color: #fff;
    border-color: #3b82f6;
}
.pagination button:disabled { color: #9ca3af; cursor: not-allowed; }
.pagination .info { color: #6b7280; font-size: 12px; margin: 0 8px; }

/* Roster grid (仿图1) */
.roster-wrap { background: #fff; padding: 24px; }
.roster-header {
    text-align: center;
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 8px;
}
.roster-meta {
    text-align: center;
    font-size: 13px;
    color: #6b7280;
    margin-bottom: 16px;
}
.roster-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}
.roster-table th, .roster-table td {
    border: 1px solid #1f2937;
    padding: 6px 4px;
    text-align: center;
    vertical-align: middle;
}
.roster-table th {
    background: #f3f4f6;
    font-weight: 600;
}
.roster-table .col-no { width: 50px; }
.roster-table .col-idx { width: 50px; }
.roster-table .col-no { text-align: center; }
.roster-table .col-phone { text-align: left; padding-left: 8px; }
.roster-table .col-name { text-align: left; padding-left: 8px; }

@media print {
    .sidebar, .toolbar, .page-header, .no-print { display: none !important; }
    .main { padding: 0; }
    .card { box-shadow: none; border: none; }
    .roster-table th { background: #fff !important; }
    /* 块打印: 仅显示克隆到 body 顶层的 #print-root */
    body > *:not(#print-root) { display: none !important; }
    #print-root { display: block !important; }
    #print-root .no-print { display: block !important; }
    #print-root .card { border: none; box-shadow: none; }
    #print-root .roster-table th { background: #fff !important; }
}

/* ============= 日期选择器 (flatpickr 主题覆盖) ============= */
input.date-picker,
input.tk-date,
input[date-picker] {
    /* 与 .form-item input 一致 */
    padding: 6px 10px !important;
    height: 32px;
    border: 1px solid #d1d5db !important;
    border-radius: 4px !important;
    font-size: 13px !important;
    background: #fff !important;
    color: #1f2937;
    width: 150px;
    box-sizing: border-box;
}
input.date-picker:focus,
input.tk-date:focus,
input[date-picker]:focus {
    outline: none !important;
    border-color: #3b82f6 !important;
    box-shadow: 0 0 0 2px rgba(59,130,246,0.1) !important;
}
/* flatpickr 弹窗主题与项目一致 (蓝色 #3b82f6) */
.flatpickr-calendar {
    box-shadow: 0 4px 16px rgba(0,0,0,0.12) !important;
    border: 1px solid #e5e7eb !important;
    border-radius: 6px !important;
    font-size: 13px !important;
    font-family: inherit;
}
.flatpickr-day.selected,
.flatpickr-day.startRange,
.flatpickr-day.endRange {
    background: #3b82f6 !important;
    border-color: #3b82f6 !important;
}
.flatpickr-day.selected:hover,
.flatpickr-day.startRange:hover,
.flatpickr-day.endRange:hover {
    background: #2563eb !important;
    border-color: #2563eb !important;
}
.flatpickr-day.inRange,
.flatpickr-day.prevMonthDay.inRange,
.flatpickr-day.nextMonthDay.inRange,
.flatpickr-day.today.inRange {
    background: #dbeafe !important;
    box-shadow: -5px 0 0 #dbeafe, 5px 0 0 #dbeafe !important;
}
.flatpickr-day:hover,
.flatpickr-day.prevMonthDay:hover,
.flatpickr-day.nextMonthDay:hover {
    background: #f3f4f6 !important;
}
.flatpickr-day.today {
    border-color: #3b82f6 !important;
}
.flatpickr-current-month .flatpickr-monthDropdown-months,
.flatpickr-current-month input.cur-year {
    font-weight: 600;
    color: #1f2937;
}
span.flatpickr-weekday {
    color: #6b7280 !important;
    font-weight: 500;
}
.flatpickr-months .flatpickr-prev-month svg,
.flatpickr-months .flatpickr-next-month svg {
    fill: #6b7280;
}
.flatpickr-months .flatpickr-prev-month:hover svg,
.flatpickr-months .flatpickr-next-month:hover svg {
    fill: #3b82f6;
}
.flatpickr-time input,
.flatpickr-time .flatpickr-am-pm {
    color: #1f2937;
}
