:root {
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --primary-light: #eff6ff;
    --primary-lighter: #dbeafe;
    --success: #16a34a;
    --success-light: #f0fdf4;
    --warning: #d97706;
    --warning-light: #fffbeb;
    --danger: #dc2626;
    --danger-light: #fef2f2;
    --info: #0891b2;
    --info-light: #ecfeff;
    --text: #111827;
    --text-secondary: #6b7280;
    --text-light: #9ca3af;
    --border: #e5e7eb;
    --bg: #f3f4f6;
    --bg-white: #ffffff;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.12);
    --radius: 8px;
    --radius-sm: 6px;
    --sidebar-width: 220px;
    --header-height: 56px;
    --transition: all 0.2s ease;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    font-size: 14px;
    color: var(--text);
    background: var(--bg);
    line-height: 1.6;
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: var(--transition);
}

a:hover {
    color: var(--primary-hover);
}

/* ========== Scrollbar ========== */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}

/* ========== Login Page ========== */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8fafc;
}

.login-box {
    width: 400px;
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 40px;
    box-shadow: var(--shadow-md);
}

.login-box h2 {
    text-align: center;
    margin-bottom: 6px;
    color: var(--text);
    font-size: 22px;
    font-weight: 600;
}

.login-box .subtitle {
    text-align: center;
    color: var(--text-secondary);
    margin-bottom: 28px;
    font-size: 14px;
}

/* ========== Layout ========== */
.layout {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: var(--sidebar-width);
    background: linear-gradient(180deg, #111827 0%, #1f2937 100%);
    color: #e5e7eb;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
    overflow-y: auto;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
}

.sidebar::-webkit-scrollbar {
    width: 4px;
}

.sidebar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
}

.sidebar-logo {
    height: var(--header-height);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: 600;
    color: #fff;
    border-bottom: 1px solid #374151;
    white-space: nowrap;
    overflow: hidden;
    flex-shrink: 0;
}

.sidebar-menu {
    list-style: none;
    padding: 12px 0;
    flex: 1;
}

.sidebar-menu .menu-item {
    padding: 10px 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    color: #cbd5e1;
    transition: var(--transition);
    font-size: 14px;
    border-left: 3px solid transparent;
    margin: 2px 0;
}

.sidebar-menu .menu-item:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.06);
}

.sidebar-menu .menu-item.active {
    color: #fff;
    background: rgba(37, 99, 235, 0.25);
    border-left-color: #60a5fa;
    font-weight: 500;
}

.sidebar-menu .menu-group-title {
    padding: 18px 24px 6px;
    font-size: 12px;
    color: #6b7280;
    letter-spacing: 1px;
    font-weight: 500;
}

.main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    background: var(--bg);
}

.header {
    height: var(--header-height);
    background: var(--bg-white);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 99;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.header-left #page-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.header-right .notification-badge {
    position: relative;
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    transition: var(--transition);
}

.header-right .notification-badge:hover {
    background: var(--bg);
    color: var(--text);
}

.header-right .notification-badge .badge {
    position: absolute;
    top: 0;
    right: 0;
    background: var(--danger);
    color: #fff;
    font-size: 10px;
    padding: 1px 5px;
    border-radius: 10px;
    min-width: 16px;
    text-align: center;
    font-weight: 500;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 12px;
    border-radius: 8px;
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 500;
}

.page-content {
    flex: 1;
    padding: 24px;
}

/* ========== Breadcrumb ========== */
.breadcrumb {
    margin-bottom: 16px;
    font-size: 13px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 4px;
}

.breadcrumb span {
    color: var(--text-light);
}

.breadcrumb span:last-child {
    color: var(--text);
}

/* ========== Cards ========== */
.card {
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 1px 2px rgba(17, 24, 39, 0.04);
    margin-bottom: 16px;
}

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

.card-header h3 {
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
}

.card-body {
    padding: 20px;
}

/* ========== Stat Cards ========== */
.stat-cards {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 20px;
}

.stat-card {
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: 0 1px 2px rgba(17, 24, 39, 0.04);
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 3px;
    height: 100%;
}

.stat-card.blue::before { background: #1d4ed8; }
.stat-card.green::before { background: #15803d; }
.stat-card.orange::before { background: #b45309; }
.stat-card.red::before { background: #b91c1c; }
.stat-card.purple::before { background: #6d28d9; }

.stat-card:hover {
    box-shadow: 0 6px 16px rgba(17, 24, 39, 0.08);
    transform: translateY(-2px);
}

.stat-card .stat-value {
    font-size: 28px;
    font-weight: 600;
    color: var(--text);
    line-height: 1.2;
}

.stat-card .stat-label {
    font-size: 13px;
    color: var(--text-secondary);
}

/* ========== Forms ========== */
.form-group {
    margin-bottom: 18px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    color: var(--text);
    font-size: 13px;
}

.form-group label .required {
    color: var(--danger);
    margin-left: 2px;
}

.form-control {
    width: 100%;
    height: 38px;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    color: var(--text);
    transition: var(--transition);
    outline: none;
    background: var(--bg-white);
}

.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.form-control::placeholder {
    color: var(--text-light);
}

textarea.form-control {
    height: auto;
    min-height: 100px;
    resize: vertical;
    padding: 10px 12px;
}

select.form-control {
    cursor: pointer;
}

.form-row {
    display: flex;
    gap: 16px;
}

.form-row .form-group {
    flex: 1;
}

.form-hint {
    font-size: 12px;
    color: var(--text-light);
    margin-top: 6px;
}

/* ========== Buttons ========== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 8px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    cursor: pointer;
    transition: var(--transition);
    background: var(--bg-white);
    color: var(--text);
    white-space: nowrap;
    height: 38px;
    font-weight: 500;
}

.btn:hover {
    border-color: #cbd5e1;
    background: var(--bg);
}

.btn-primary {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
    box-shadow: 0 1px 3px rgba(37, 99, 235, 0.35);
}

.btn-primary:hover {
    background: var(--primary-hover);
    border-color: var(--primary-hover);
    color: #fff;
    box-shadow: 0 4px 10px rgba(37, 99, 235, 0.4);
}

.btn-success {
    background: var(--success);
    border-color: var(--success);
    color: #fff;
}

.btn-success:hover {
    background: #15803d;
    border-color: #15803d;
    color: #fff;
}

.btn-danger {
    background: var(--danger);
    border-color: var(--danger);
    color: #fff;
}

.btn-danger:hover {
    background: #b91c1c;
    border-color: #b91c1c;
    color: #fff;
}

.btn-warning {
    background: var(--warning);
    border-color: var(--warning);
    color: #fff;
}

.btn-warning:hover {
    background: #b45309;
    border-color: #b45309;
    color: #fff;
}

.btn-sm {
    height: 30px;
    padding: 4px 12px;
    font-size: 13px;
}

.btn-lg {
    height: 46px;
    padding: 10px 28px;
    font-size: 16px;
}

.btn-block {
    width: 100%;
}

.btn-group {
    display: flex;
    gap: 10px;
}

/* ========== Tables ========== */
.table-wrapper {
    overflow-x: auto;
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

table {
    width: 100%;
    border-collapse: collapse;
}

table th,
table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
}

table th {
    background: #f9fafb;
    font-weight: 600;
    color: var(--text-secondary);
    white-space: nowrap;
    font-size: 13px;
}

table tr:hover {
    background: #f9fafb;
}

table tr:last-child td {
    border-bottom: none;
}

table .actions {
    display: flex;
    gap: 8px;
    white-space: nowrap;
}

/* ========== Tags ========== */
.tag {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
    line-height: 1.6;
    font-weight: 500;
    white-space: nowrap;
}

.tag-blue { background: var(--primary-light); color: var(--primary-hover); }
.tag-green { background: var(--success-light); color: #15803d; }
.tag-orange { background: var(--warning-light); color: #b45309; }
.tag-red { background: var(--danger-light); color: #b91c1c; }
.tag-gray { background: #f3f4f6; color: #6b7280; }
.tag-purple { background: #f5f3ff; color: #6d28d9; }

/* ========== Search/Filter Bar ========== */
.filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 16px;
    align-items: center;
    padding: 14px;
    background: var(--bg-white);
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

.filter-bar .search-input {
    width: 260px;
}

.filter-bar .filter-select {
    width: 160px;
}

/* ========== Multi-select ========== */
.filter-select.multi-select {
    position: relative;
    width: 160px;
}
.multi-select .ms-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: #fff;
    cursor: pointer;
    font-size: 14px;
    user-select: none;
}
.multi-select .ms-arrow {
    font-size: 12px;
    color: #9ca3af;
}
.multi-select .ms-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    min-width: 160px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 8px 20px rgba(0,0,0,.12);
    padding: 6px 0;
    z-index: 100;
}
.multi-select .ms-dropdown.show {
    display: block;
}
.multi-select .ms-option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 14px;
    font-size: 14px;
    cursor: pointer;
    color: var(--text);
}
.multi-select .ms-option:hover {
    background: #f3f4f6;
}
.multi-select .ms-option input {
    margin: 0;
    accent-color: var(--primary);
}

/* ========== Pagination ========== */
.pagination {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

.pagination .page-btn {
    min-width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 14px;
    background: var(--bg-white);
    color: var(--text);
    transition: var(--transition);
}

.pagination .page-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.pagination .page-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
    font-weight: 500;
}

.pagination .page-btn.disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.pagination .page-info {
    font-size: 13px;
    color: var(--text-secondary);
    margin-left: 12px;
}

/* ========== Modal ========== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(17, 24, 39, 0.45);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: var(--bg-white);
    border-radius: 12px;
    width: 560px;
    max-width: 90vw;
    max-height: 85vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transform: scale(0.96);
    transition: var(--transition);
    box-shadow: var(--shadow-lg);
}

.modal-overlay.active .modal {
    transform: scale(1);
}

.modal-lg { width: 800px; }
.modal-sm { width: 420px; }

/* 权限分组网格 */
.perm-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: 400px;
    overflow-y: auto;
    padding: 2px;
}

.perm-group {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.perm-group-header {
    padding: 8px 12px;
    background: #f9fafb;
    border-bottom: 1px solid var(--border);
}

.perm-group-label {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 0;
    cursor: pointer;
    font-size: 13px;
    color: var(--text);
}

.perm-group-label strong {
    font-weight: 600;
}

.perm-group-items {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 0;
}

.perm-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 7px 12px;
    font-size: 13px;
    cursor: pointer;
    transition: background .15s;
    border-bottom: 1px solid #f3f4f6;
}

.perm-item:hover {
    background: #f9fafb;
}

.perm-item input[type="checkbox"] {
    accent-color: var(--primary);
}

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

.modal-header h3 {
    font-size: 16px;
    font-weight: 600;
}

.modal-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border-radius: 6px;
    font-size: 20px;
    color: var(--text-secondary);
    transition: var(--transition);
    border: none;
    background: none;
}

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

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

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

/* ========== Empty State ========== */
.empty-state {
    text-align: center;
    padding: 50px 20px;
    color: var(--text-light);
}

.empty-state .empty-text {
    font-size: 14px;
}

/* ========== Tabs ========== */
.tabs {
    display: flex;
    border-bottom: 1px solid var(--border);
    margin-bottom: 16px;
    gap: 4px;
}

.tab-item {
    padding: 10px 20px;
    cursor: pointer;
    font-size: 14px;
    color: var(--text-secondary);
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    transition: var(--transition);
    font-weight: 500;
}

.tab-item:hover {
    color: var(--text);
}

.tab-item.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

/* ========== Schedule Grid ========== */
.schedule-grid {
    display: grid;
    grid-template-columns: 120px repeat(7, 1fr);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.schedule-grid .grid-header {
    padding: 12px;
    text-align: center;
    font-weight: 600;
    background: #f9fafb;
    border-bottom: 1px solid var(--border);
    border-right: 1px solid var(--border);
    font-size: 13px;
}

.schedule-grid .grid-cell {
    padding: 12px;
    min-height: 90px;
    border-bottom: 1px solid var(--border);
    border-right: 1px solid var(--border);
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.schedule-grid .grid-cell:hover {
    background: var(--bg);
}

.schedule-grid .grid-cell .quota-info {
    font-size: 13px;
    font-weight: 500;
}

.schedule-grid .grid-cell.status-available {
    background: var(--success-light);
}

.schedule-grid .grid-cell.status-full {
    background: var(--danger-light);
}

.schedule-grid .grid-cell.status-stopped {
    background: #fef2f2;
    color: #b91c1c;
    border-left: 3px solid #b91c1c;
}

.schedule-scroll {
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-white);
}

.schedule-doctor .schedule-doctor-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    font-weight: 600;
    background: #f9fafb;
    border-bottom: 1px solid var(--border);
}

.schedule-doctor .schedule-doctor-header .doctor-title {
    font-weight: 400;
    color: #6b7280;
    font-size: 13px;
}

/* ========== 排班管理（新布局） ========== */
.sch-title-bar {
    text-align: center;
    padding: 14px 0;
    font-size: 16px;
    font-weight: 700;
    color: var(--text);
    border-bottom: 1px solid var(--border);
    background: var(--bg-white);
}

.schedule-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
    background: var(--bg-white);
}

.schedule-table th,
.schedule-table td {
    border: 1px solid var(--border);
    text-align: center;
    vertical-align: middle;
    padding: 8px;
}

.schedule-table thead th {
    background: #f9fafb;
    font-weight: 600;
    color: var(--text);
}

.sch-weekday-date {
    font-size: 13px;
    color: var(--text-secondary);
    letter-spacing: 1px;
    white-space: nowrap;
}

.sch-weekday-name {
    font-size: 14px;
    font-weight: 700;
}

.sch-slot {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    white-space: nowrap;
}

.sch-col-name {
    width: 90px;
    min-width: 90px;
    font-size: 13px;
    color: var(--text-secondary);
    background: #f9fafb !important;
}

.sch-col-name .sch-all {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    margin-top: 6px;
    font-size: 12px;
    cursor: pointer;
    white-space: nowrap;
}

.sch-col-name .sch-all input {
    cursor: pointer;
}

.sch-doctor-cell {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-weight: 600;
    color: var(--text);
}

.sch-doctor-cell input {
    cursor: pointer;
}

.sch-row.sch-row-checked {
    background: var(--primary-light);
}

.sch-cell {
    cursor: pointer;
    height: 44px;
    transition: var(--transition);
}

.sch-cell:hover {
    background: var(--primary-light);
}

.sch-empty {
    color: var(--text-light);
}

.sch-empty .sch-add {
    font-size: 18px;
    line-height: 1;
}

.sch-active {
    color: var(--primary);
}

.sch-active .sch-qty {
    font-size: 16px;
    font-weight: 700;
}

.sch-active .sch-multi {
    font-size: 13px;
    font-weight: 600;
    color: var(--warning);
}

.sch-stopped {
    background: var(--danger-light);
}

.sch-stopped .sch-stop-badge {
    display: inline-block;
    padding: 2px 10px;
    font-size: 12px;
    color: var(--danger);
    background: var(--danger-light);
    border: 1px solid #fecaca;
    border-radius: 999px;
}

.sch-full {
    background: var(--warning-light);
}

.sch-full .sch-full-badge {
    display: inline-block;
    padding: 2px 10px;
    font-size: 12px;
    color: var(--warning);
    background: var(--warning-light);
    border: 1px solid #fde68a;
    border-radius: 999px;
    margin: 0 1px;
}

.sch-active .sch-cell-mark {
    display: inline-block;
    margin-left: 4px;
    padding: 0 6px;
    font-size: 11px;
    line-height: 18px;
    color: var(--warning);
    background: var(--warning-light);
    border: 1px solid #fde68a;
    border-radius: 999px;
    vertical-align: middle;
}

.sch-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 14px;
    border-top: 1px solid var(--border);
    background: var(--bg-white);
}

/* —— 弹窗：设置排班 —— */
.sch-cell-head {
    padding: 10px 0 14px;
    font-size: 15px;
    font-weight: 700;
    color: var(--text);
    border-bottom: 1px solid var(--border);
    margin-bottom: 12px;
}

.sch-all-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    margin-bottom: 10px;
    font-size: 14px;
    font-weight: 600;
    background: #f9fafb;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}

.sch-all-row .sch-all-state {
    width: 76px;
}

.sch-all-row .sch-all-qty {
    width: 90px;
    text-align: center;
}

.sch-all-row .sch-all-price {
    width: 90px;
    text-align: center;
}

.sch-date-list {
    max-height: 260px;
    overflow-y: auto;
}

.sch-date-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-bottom: 1px solid #f3f4f6;
}

.sch-date-row:last-child {
    border-bottom: none;
}

.sch-day-label {
    width: 36px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
}

.sch-date-state {
    width: 76px;
    text-align: center;
}

.sch-date-qty {
    flex: 1;
    max-width: 110px;
    text-align: center;
}

.sch-date-price {
    flex: 1;
    max-width: 110px;
    text-align: center;
}

.sch-row-checked .sch-doctor-cell {
    color: var(--primary);
}

/* —— 弹窗：排班列表预览 —— */
.sch-preview {
    max-height: 60vh;
    overflow-y: auto;
}

.sch-preview-doc {
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
}

.sch-preview-doc:last-child {
    border-bottom: none;
}

.sch-preview-doc strong {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
}

.sch-preview-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.sch-preview-item {
    display: inline-block;
    padding: 4px 10px;
    font-size: 12px;
    color: var(--text);
    background: #f9fafb;
    border: 1px solid var(--border);
    border-radius: 999px;
}

.sch-preview-item.stopped {
    color: var(--danger);
    background: var(--danger-light);
    border-color: #fecaca;
}

.sch-preview-item.full {
    color: var(--warning);
    background: var(--warning-light);
    border-color: #fde68a;
}

/* ========== Loading ========== */
.loading {
    text-align: center;
    padding: 50px;
    color: var(--text-light);
}

.spinner {
    width: 36px;
    height: 36px;
    border: 3px solid #e5e7eb;
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 14px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ========== 在线客服聊天 ========== */
.chat-container {
    display: flex;
    height: calc(100vh - 220px);
    min-height: 480px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.chat-sidebar {
    width: 300px;
    border-right: 1px solid var(--border);
    overflow-y: auto;
    background: #fafafa;
}

.chat-user-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    cursor: pointer;
    border-bottom: 1px solid var(--border);
    transition: var(--transition);
}

.chat-user-item:hover {
    background: var(--bg);
}

.chat-user-item.active {
    background: var(--primary-light);
    border-left: 3px solid var(--primary);
}

.chat-user-body {
    flex: 1;
    overflow: hidden;
}

.chat-user-name {
    font-weight: 500;
    font-size: 14px;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 3px;
}

.chat-user-phone {
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 400;
}

.chat-user-last {
    font-size: 12px;
    color: var(--text-light);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.unread-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--danger);
    flex-shrink: 0;
}

.chat-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #fff;
}

.chat-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
}

.chat-header-info {
    color: var(--text-light);
    font-size: 14px;
}

.chat-header-body {
    flex: 1;
}

.chat-header-name {
    font-weight: 600;
    font-size: 15px;
    color: var(--text);
}

.chat-header-sub {
    font-size: 12px;
    color: var(--text-light);
    margin-top: 2px;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    background: #fafafa;
}

.chat-message {
    display: flex;
    gap: 10px;
    margin-bottom: 14px;
    align-items: flex-start;
}

.chat-message .msg-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 500;
    flex-shrink: 0;
}

.chat-message .msg-wrapper {
    flex: 1;
    min-width: 0;
}

.chat-message .msg-content {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 4px 10px 10px 10px;
    padding: 9px 12px;
    font-size: 14px;
    color: var(--text);
    max-width: 80%;
    overflow-wrap: break-word;
    word-break: break-all;
}

.chat-message .msg-time {
    font-size: 11px;
    color: var(--text-light);
    margin-top: 4px;
}

.chat-message.from-user {
    flex-direction: row-reverse;
}

.chat-message.from-user .msg-wrapper {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.chat-message.from-user .msg-avatar {
    background: var(--text-secondary);
}

.chat-message.from-user .msg-content {
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: 10px 4px 10px 10px;
}

.chat-message.from-user .msg-time {
    text-align: right;
}

.chat-input-area {
    display: flex;
    gap: 12px;
    padding: 12px 16px;
    border-top: 1px solid var(--border);
    background: #fff;
}

.chat-input-area .form-control {
    flex: 1;
}

/* ========== 消息提醒列表 ========== */
.notification-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
    transition: var(--transition);
}

.notification-item.read {
    opacity: 0.55;
}

.notification-item.clickable {
    cursor: pointer;
}

.notification-item.clickable:hover {
    background: var(--bg);
}

/* ========== Responsive ========== */
@media (max-width: 1400px) {
    .stat-cards {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 992px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
    }

    .form-row {
        flex-direction: column;
        gap: 0;
    }
}

@media (max-width: 768px) {
    .stat-cards {
        grid-template-columns: 1fr;
    }

    .filter-bar {
        flex-direction: column;
        align-items: stretch;
    }

    .filter-bar .search-input,
    .filter-bar .filter-select {
        width: 100%;
    }

    .schedule-grid {
        display: block;
        overflow-x: auto;
    }

    .modal {
        width: 95vw;
        max-height: 90vh;
    }
}

/* ========== 小程序配置（QuickEntries） ========== */
.qe-entry {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px 16px 16px;
    margin-bottom: 14px;
    background: #fff;
    position: relative;
}

.qe-remove {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 1;
}

.qe-icon-preview {
    width: 44px;
    height: 44px;
    border-radius: 8px;
    border: 1px solid var(--border);
    object-fit: cover;
    flex-shrink: 0;
}

/* ========== 订阅消息配置（WechatTemplates） ========== */
.alert-info {
    background: var(--info-light);
    color: #0e7490;
    border: 1px solid #a5f3fc;
    border-radius: var(--radius-sm);
    padding: 12px 16px;
    margin-bottom: 16px;
    font-size: 13px;
    line-height: 1.6;
}

/* ========== Utility ========== */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-primary { color: var(--primary); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-danger { color: var(--danger); }
.text-muted { color: var(--text-light); }
.text-secondary { color: var(--text-secondary); }

.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }

.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.flex-center { display: flex; justify-content: center; align-items: center; }
.gap-8 { gap: 8px; }
.gap-16 { gap: 16px; }
.hidden { display: none !important; }

/* ========== Data Table ========== */
.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th,
.data-table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.data-table th {
    background: #f9fafb;
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 13px;
}

.data-table tr:hover {
    background: #f9fafb;
}

/* ========== Animations ========== */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.fade-in {
    animation: fadeIn 0.2s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.slide-in {
    animation: slideIn 0.2s ease;
}

/* ========== Toast ========== */
.admin-toast {
    animation: fadeIn 0.2s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    pointer-events: none;
}
