/* ==========================================================================
   悦恒堂中医门诊管理系统 · Design System
   --------------------------------------------------------------------------
   设计原则
     1. 克制：一个品牌主色 + 四个语义色，不再混用互不相干的渐变
     2. 节奏：4px 基准网格，间距全部走 token
     3. 层次：分层阴影表达浮起高度，而非堆叠边框
     4. 完整：每个组件都有 hover / active / focus / disabled / loading 状态
     5. 无障碍：focus-visible 可见环、prefers-reduced-motion、对比度达标
     6. 兼容：保留全部历史类名，旧页面无需改动即可获得新视觉
   ========================================================================== */

/* ==========================================================================
   1. 设计令牌（Design Tokens）
   ========================================================================== */
:root {
    /* ---------- 品牌色（中医青蓝：专业、沉稳、可信） ---------- */
    --brand-50:  #f0f9fb;
    --brand-100: #ddf1f6;
    --brand-200: #b9e4ed;
    --brand-300: #86d0e0;
    --brand-400: #4ab4ca;
    --brand-500: #2c9ab0;
    --brand-600: #1e7d94;   /* ← 主色 */
    --brand-700: #1b6478;
    --brand-800: #1a5263;
    --brand-900: #174354;

    /* ---------- 语义色（含背景/边框/文字三档） ---------- */
    --success: #059669;
    --success-600: #047857;
    --success-bg: #ecfdf5;
    --success-border: #a7f3d0;

    --warning: #d97706;
    --warning-600: #b45309;
    --warning-bg: #fffbeb;
    --warning-border: #fde68a;

    --danger: #dc2626;
    --danger-600: #b91c1c;
    --danger-bg: #fef2f2;
    --danger-border: #fecaca;

    --info: #2563eb;
    --info-600: #1d4ed8;
    --info-bg: #eff6ff;
    --info-border: #bfdbfe;

    /* ---------- 中性色阶 ---------- */
    --gray-50:  #f8fafc;
    --gray-100: #f1f5f9;
    --gray-200: #e2e8f0;
    --gray-300: #cbd5e1;
    --gray-400: #94a3b8;
    --gray-500: #64748b;
    --gray-600: #475569;
    --gray-700: #334155;
    --gray-800: #1e293b;
    --gray-900: #0f172a;

    /* ---------- 语义化别名（兼容历史变量名） ---------- */
    --primary: var(--brand-600);
    --primary-dark: var(--brand-700);
    --primary-light: var(--brand-400);
    --primary-bg: var(--brand-50);
    --primary-border: var(--brand-200);

    --text-primary: var(--gray-800);
    --text-secondary: var(--gray-500);
    --text-muted: var(--gray-400);
    --text-inverse: #ffffff;

    --border: var(--gray-200);
    --border-strong: var(--gray-300);
    --bg: #f6f8fa;
    --bg-subtle: var(--gray-50);
    --card-bg: #ffffff;
    --hover-bg: var(--brand-50);

    /* ---------- 间距（4px 网格） ---------- */
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 20px;
    --space-6: 24px;
    --space-8: 32px;
    --space-10: 40px;
    --space-12: 48px;
    --space-16: 64px;

    /* ---------- 圆角 ---------- */
    --radius-xs: 4px;
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --radius-xl: 18px;
    --radius-full: 9999px;

    /* ---------- 阴影（分层表达高度） ---------- */
    --shadow-xs: 0 1px 2px rgba(15, 23, 42, .04);
    --shadow-sm: 0 1px 3px rgba(15, 23, 42, .06), 0 1px 2px rgba(15, 23, 42, .04);
    --shadow-md: 0 4px 12px rgba(15, 23, 42, .07), 0 2px 4px rgba(15, 23, 42, .04);
    --shadow-lg: 0 12px 28px rgba(15, 23, 42, .10), 0 4px 8px rgba(15, 23, 42, .04);
    --shadow-xl: 0 24px 48px rgba(15, 23, 42, .14);
    --shadow-focus: 0 0 0 3px rgba(30, 125, 148, .18);

    /* ---------- 字体 ---------- */
    --font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC',
                   'Hiragino Sans GB', 'Microsoft YaHei', Roboto, 'Helvetica Neue', Arial, sans-serif;
    --font-mono: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, monospace;

    --text-xs: 12px;
    --text-sm: 13px;
    --text-base: 14px;
    --text-md: 15px;
    --text-lg: 17px;
    --text-xl: 20px;
    --text-2xl: 24px;
    --text-3xl: 30px;

    /* ---------- 动效 ---------- */
    --ease-out: cubic-bezier(.16, 1, .3, 1);
    --ease-in-out: cubic-bezier(.4, 0, .2, 1);
    --duration-fast: 150ms;
    --duration-base: 200ms;
    --duration-slow: 300ms;

    /* ---------- 层级 ---------- */
    --z-dropdown: 100;
    --z-sticky: 200;
    --z-drawer: 900;
    --z-modal: 1000;
    --z-toast: 2000;
}

/* ==========================================================================
   2. 重置与基础
   ========================================================================== */
* { margin: 0; padding: 0; box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    font-family: var(--font-family);
    background: var(--bg);
    color: var(--text-primary);
    font-size: var(--text-base);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* 可访问的焦点环：仅键盘导航时显示，鼠标点击不显示 */
:focus-visible {
    outline: 2px solid var(--brand-500);
    outline-offset: 2px;
    border-radius: var(--radius-xs);
}
:focus:not(:focus-visible) { outline: none; }

/* 数字等宽，表格金额对齐更整齐 */
.tabular-nums, td.num, th.num { font-variant-numeric: tabular-nums; }

/* 滚动条：细、低调、悬停加深 */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
    background: var(--gray-300);
    border-radius: var(--radius-full);
    border: 2px solid transparent;
    background-clip: content-box;
}
::-webkit-scrollbar-thumb:hover { background: var(--gray-400); background-clip: content-box; }

/* ==========================================================================
   3. 布局
   ========================================================================== */
.container { max-width: 1400px; margin: 0 auto; padding: var(--space-6); }

.page-header { margin-bottom: var(--space-6); }
.page-title {
    font-size: var(--text-2xl);
    font-weight: 700;
    letter-spacing: -.02em;
    color: var(--gray-900);
    margin-bottom: var(--space-1);
}
.page-subtitle { color: var(--text-secondary); font-size: var(--text-base); }

/* 页面头部的操作区 */
.page-actions { display: flex; gap: var(--space-2); flex-wrap: wrap; align-items: center; }

/* ==========================================================================
   4. 卡片
   ========================================================================== */
.card {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-xs);
    overflow: hidden;
    transition: box-shadow var(--duration-base) var(--ease-out),
                border-color var(--duration-base) var(--ease-out);
}
.card:hover { box-shadow: var(--shadow-md); }
.card-header {
    padding: var(--space-4) var(--space-5);
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--space-3);
}
.card-header h3 { font-size: var(--text-md); font-weight: 600; color: var(--gray-800); }
.card-body { padding: var(--space-5); }
.card-footer { padding: var(--space-3) var(--space-5); border-top: 1px solid var(--border); background: var(--bg-subtle); }

/* 统计卡 */
.stat-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--space-5);
    box-shadow: var(--shadow-xs);
    transition: transform var(--duration-base) var(--ease-out),
                box-shadow var(--duration-base) var(--ease-out);
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.stat-label { font-size: var(--text-xs); color: var(--text-secondary); font-weight: 500; margin-bottom: var(--space-2); }
.stat-value { font-size: var(--text-2xl); font-weight: 700; color: var(--gray-900); font-variant-numeric: tabular-nums; }
.stat-unit { font-size: var(--text-sm); font-weight: 500; color: var(--text-muted); margin-left: 2px; }

/* ==========================================================================
   5. 按钮（4 变体 × 3 尺寸 × 完整状态）
   ========================================================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    font-size: var(--text-sm);
    font-weight: 500;
    line-height: 1.4;
    font-family: inherit;
    border: 1px solid transparent;
    cursor: pointer;
    white-space: nowrap;
    user-select: none;
    transition: background-color var(--duration-fast) var(--ease-in-out),
                border-color var(--duration-fast) var(--ease-in-out),
                color var(--duration-fast) var(--ease-in-out),
                box-shadow var(--duration-fast) var(--ease-in-out),
                transform var(--duration-fast) var(--ease-in-out);
}
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:focus-visible { outline: none; box-shadow: var(--shadow-focus); }

/* 主按钮 */
.btn-primary { background: var(--brand-600); color: #fff; box-shadow: var(--shadow-xs); }
.btn-primary:hover:not(:disabled) { background: var(--brand-700); box-shadow: var(--shadow-sm); }

/* 次按钮（描边） */
.btn-outline { background: #fff; border-color: var(--border-strong); color: var(--gray-600); }
.btn-outline:hover:not(:disabled) { background: var(--brand-50); border-color: var(--brand-300); color: var(--brand-700); }

/* 幽灵按钮 */
.btn-ghost { background: transparent; color: var(--gray-600); }
.btn-ghost:hover:not(:disabled) { background: var(--gray-100); }

/* 危险按钮 */
.btn-danger { background: var(--danger); color: #fff; box-shadow: var(--shadow-xs); }
.btn-danger:hover:not(:disabled) { background: var(--danger-600); }

/* 成功按钮 */
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover:not(:disabled) { background: var(--success-600); }

/* 警告按钮 */
.btn-warning { background: var(--warning); color: #fff; }
.btn-warning:hover:not(:disabled) { background: var(--warning-600); }

/* 尺寸 */
.btn-sm { padding: 4px 10px; font-size: var(--text-xs); border-radius: var(--radius-xs); }
.btn-lg { padding: 11px 22px; font-size: var(--text-md); border-radius: var(--radius-md); }

.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 6px 12px;
    min-width: 34px;
    height: 34px;
    border-radius: 6px;
    border: none;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}


/* 禁用 */
.btn:disabled, .btn[disabled] { opacity: .5; cursor: not-allowed; box-shadow: none; }

/* 加载态：文字保留但整体降透明 + 旋转图标 */
.btn.is-loading { position: relative; color: transparent !important; pointer-events: none; }
.btn.is-loading::after {
    content: '';
    position: absolute;
    width: 14px; height: 14px;
    top: 50%; left: 50%;
    margin: -7px 0 0 -7px;
    border: 2px solid currentColor;
    border-top-color: transparent;
    border-radius: 50%;
    color: #fff;
    animation: btnSpin .6s linear infinite;
}
.btn-outline.is-loading::after { color: var(--brand-600); }
@keyframes btnSpin { to { transform: rotate(360deg); } }

/* 按钮组 */
.btn-group { display: inline-flex; }
.btn-group .btn { border-radius: 0; margin-left: -1px; }
.btn-group .btn:first-child { border-radius: var(--radius-sm) 0 0 var(--radius-sm); margin-left: 0; }
.btn-group .btn:last-child { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }

/* ==========================================================================
   6. 表格
   ========================================================================== */
.table-wrapper {
    overflow-x: auto;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    background: #fff;
    -webkit-overflow-scrolling: touch;
}

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

th {
    text-align: left;
    padding: 11px var(--space-4);
    background: var(--bg-subtle);
    font-weight: 600;
    font-size: var(--text-xs);
    letter-spacing: .02em;
    color: var(--gray-500);
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
    position: sticky;
    top: 0;
    z-index: 1;
}

td {
    padding: 12px var(--space-4);
    border-bottom: 1px solid var(--gray-100);
    font-size: var(--text-sm);
    color: var(--gray-700);
    vertical-align: middle;
}

tbody tr { transition: background-color var(--duration-fast) var(--ease-in-out); }
tbody tr:hover { background: var(--brand-50); }
tbody tr:last-child td { border-bottom: none; }

/* 斑马纹（可选） */
.table-striped tbody tr:nth-child(even) { background: var(--gray-50); }
.table-striped tbody tr:nth-child(even):hover { background: var(--brand-50); }

/* 紧凑表格 */
.table-compact th, .table-compact td { padding: 8px var(--space-3); }

/* 空状态 */
.empty, .table-empty {
    padding: var(--space-12) var(--space-4) !important;
    text-align: center;
    color: var(--text-muted);
    font-size: var(--text-sm);
}

/* ==========================================================================
   7. 表单
   ========================================================================== */
.form-group { margin-bottom: var(--space-4); }
.form-group label {
    display: block;
    margin-bottom: var(--space-2);
    font-weight: 500;
    font-size: var(--text-sm);
    color: var(--gray-600);
}
.form-group .required { color: var(--danger); margin-left: 2px; }

.form-group input,
.form-group select,
.form-group textarea,
.form-control {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    font-size: var(--text-sm);
    font-family: inherit;
    color: var(--gray-800);
    background: #fff;
    transition: border-color var(--duration-fast) var(--ease-in-out),
                box-shadow var(--duration-fast) var(--ease-in-out);
}
.form-group input::placeholder,
.form-group textarea::placeholder { color: var(--gray-400); }

.form-group input:hover:not(:disabled),
.form-group select:hover:not(:disabled),
.form-group textarea:hover:not(:disabled) { border-color: var(--brand-300); }

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--brand-500);
    box-shadow: var(--shadow-focus);
}

.form-group input:disabled,
.form-group select:disabled,
.form-group textarea:disabled {
    background: var(--gray-100);
    color: var(--gray-400);
    cursor: not-allowed;
}

/* 校验失败 */
.form-group.has-error input,
.form-group.has-error select,
.form-group.has-error textarea { border-color: var(--danger); }
.form-group.has-error input:focus { box-shadow: 0 0 0 3px rgba(220, 38, 38, .15); }
.form-error { color: var(--danger); font-size: var(--text-xs); margin-top: var(--space-1); }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-4); }
.form-row-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-4); }
.form-row-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--space-4); }

/* ==========================================================================
   8. 徽章 / 标签
   ========================================================================== */
.badge {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    padding: 3px 9px;
    border-radius: var(--radius-full);
    font-size: var(--text-xs);
    font-weight: 500;
    line-height: 1.5;
    white-space: nowrap;
}

.badge-success { background: var(--success-bg); color: var(--success-600); border: 1px solid var(--success-border); }
.badge-warning { background: var(--warning-bg); color: var(--warning-600); border: 1px solid var(--warning-border); }
.badge-danger  { background: var(--danger-bg);  color: var(--danger-600);  border: 1px solid var(--danger-border); }
.badge-info    { background: var(--info-bg);    color: var(--info-600);    border: 1px solid var(--info-border); }
.badge-neutral { background: var(--gray-100);   color: var(--gray-600);    border: 1px solid var(--border); }

/* 状态点 */
.dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; }
.dot-success { background: var(--success); }
.dot-warning { background: var(--warning); }
.dot-danger  { background: var(--danger); }
.dot-info    { background: var(--info); }

/* ==========================================================================
   9. 弹窗 / 抽屉
   ========================================================================== */
.modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, .45);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    z-index: var(--z-modal);
    align-items: center;
    justify-content: center;
    padding: var(--space-4);
}
.modal.open, .modal.show { display: flex; }

.modal-content {
    background: #fff;
    border-radius: var(--radius-xl);
    width: 90%;
    max-width: 560px;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: var(--shadow-xl);
    animation: modalSlideIn var(--duration-base) var(--ease-out);
}
@keyframes modalSlideIn {
    from { opacity: 0; transform: scale(.97) translateY(8px); }
    to   { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-header {
    padding: var(--space-5) var(--space-6);
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.modal-header h3 { font-size: var(--text-lg); font-weight: 600; color: var(--gray-900); }
.modal-body { padding: var(--space-6); }
.modal-footer {
    padding: var(--space-4) var(--space-6);
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: var(--space-3);
    background: var(--bg-subtle);
    border-radius: 0 0 var(--radius-xl) var(--radius-xl);
}

/* 关闭按钮 */
.modal-close {
    background: transparent;
    border: none;
    color: var(--gray-400);
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    padding: var(--space-1);
    border-radius: var(--radius-sm);
    transition: all var(--duration-fast) var(--ease-in-out);
}
.modal-close:hover { background: var(--gray-100); color: var(--gray-700); }

/* ==========================================================================
   10. 提示（Toast）
   ========================================================================== */
.toast {
    position: fixed;
    bottom: var(--space-6);
    right: var(--space-6);
    padding: 12px 18px;
    border-radius: var(--radius-md);
    font-size: var(--text-sm);
    font-weight: 500;
    z-index: var(--z-toast);
    box-shadow: var(--shadow-lg);
    animation: toastIn var(--duration-base) var(--ease-out);
    display: flex;
    align-items: center;
    gap: var(--space-2);
    max-width: min(420px, calc(100vw - 48px));
}
.toast-success { background: var(--success); color: #fff; }
.toast-error   { background: var(--danger);  color: #fff; }
.toast-warning { background: var(--warning); color: #fff; }
.toast-info    { background: var(--info);    color: #fff; }

@keyframes toastIn {
    from { opacity: 0; transform: translateY(12px) scale(.98); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* ==========================================================================
   11. 反馈与占位
   ========================================================================== */
/* 加载骨架 */
.skeleton {
    background: linear-gradient(90deg, var(--gray-100) 25%, var(--gray-200) 37%, var(--gray-100) 63%);
    background-size: 400% 100%;
    animation: skeletonShine 1.4s ease infinite;
    border-radius: var(--radius-sm);
}
@keyframes skeletonShine {
    0%   { background-position: 100% 50%; }
    100% { background-position: 0 50%; }
}

/* 空状态 */
.empty-state {
    padding: var(--space-16) var(--space-6);
    text-align: center;
    color: var(--text-muted);
}
.empty-state .empty-icon { font-size: 44px; opacity: .5; margin-bottom: var(--space-3); }
.empty-state .empty-title { font-size: var(--text-md); font-weight: 500; color: var(--gray-500); margin-bottom: var(--space-1); }
.empty-state .empty-desc { font-size: var(--text-sm); color: var(--text-muted); }

/* 加载中 */
.loading-spinner {
    width: 22px; height: 22px;
    border: 2px solid var(--gray-200);
    border-top-color: var(--brand-600);
    border-radius: 50%;
    animation: btnSpin .7s linear infinite;
    margin: 0 auto;
}

/* 进度条 */
.progress { height: 6px; background: var(--gray-100); border-radius: var(--radius-full); overflow: hidden; }
.progress-bar {
    height: 100%;
    background: var(--brand-600);
    border-radius: var(--radius-full);
    transition: width var(--duration-slow) var(--ease-out);
}

/* ==========================================================================
   12. 分页
   ========================================================================== */
.pagination {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: var(--space-2);
    padding: var(--space-3) 0;
}
.pagination button {
    min-width: 32px; height: 32px;
    padding: 0 var(--space-2);
    border: 1px solid var(--border);
    background: #fff;
    border-radius: var(--radius-sm);
    font-size: var(--text-sm);
    color: var(--gray-600);
    cursor: pointer;
    transition: all var(--duration-fast) var(--ease-in-out);
}
.pagination button:hover:not(:disabled) { border-color: var(--brand-300); color: var(--brand-700); background: var(--brand-50); }
.pagination button.active { background: var(--brand-600); border-color: var(--brand-600); color: #fff; }
.pagination button:disabled { opacity: .4; cursor: not-allowed; }

/* ==========================================================================
   13. 工具类
   ========================================================================== */
.text-center { text-align: center; }
.text-right  { text-align: right; }
.text-muted  { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.text-success { color: var(--success); }
.text-danger  { color: var(--danger); }
.text-warning { color: var(--warning); }
.text-xs { font-size: var(--text-xs); }
.text-sm { font-size: var(--text-sm); }
.text-lg { font-size: var(--text-lg); }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }

.mt-1 { margin-top: var(--space-1); }
.mt-2 { margin-top: var(--space-2); }
.mt-3 { margin-top: var(--space-3); }
.mt-4 { margin-top: var(--space-4); }
.mb-1 { margin-bottom: var(--space-1); }
.mb-2 { margin-bottom: var(--space-2); }
.mb-3 { margin-bottom: var(--space-3); }
.mb-4 { margin-bottom: var(--space-4); }

.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: var(--space-1); }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }

.w-full { width: 100%; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hidden { display: none !important; }
.sr-only {
    position: absolute; width: 1px; height: 1px;
    padding: 0; margin: -1px; overflow: hidden;
    clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

/* ==========================================================================
   14. 响应式（与 responsive.css 协同，此处兜底）
   ========================================================================== */
@media (max-width: 1024px) {
    .container { padding: var(--space-4); }
    .form-row-4 { grid-template-columns: repeat(2, 1fr); }
    .form-row-3 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
    .container { padding: var(--space-3); }
    .page-title { font-size: var(--text-xl); }
    .form-row, .form-row-3, .form-row-4 { grid-template-columns: 1fr; }
    .card-body { padding: var(--space-4); }
    th, td { padding: 10px var(--space-3); }
    .modal-content { width: 94%; max-height: 90vh; }
    .toast { left: var(--space-3); right: var(--space-3); bottom: var(--space-3); max-width: none; }
}

/* ==========================================================================
   15. 无障碍：尊重用户的减少动效偏好
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
        scroll-behavior: auto !important;
    }
}

/* ==========================================================================
   16. 深色模式（跟随系统）
   ========================================================================== */
@media (prefers-color-scheme: dark) {
    :root {
        --bg: #0f172a;
        --bg-subtle: #1e293b;
        --card-bg: #1e293b;
        --hover-bg: #334155;

        --text-primary: #e2e8f0;
        --text-secondary: #94a3b8;
        --text-muted: #64748b;

        --border: #334155;
        --border-strong: #475569;

        --gray-50: #1e293b;
        --gray-100: #334155;
        --gray-200: #475569;
        --gray-700: #cbd5e1;
        --gray-800: #e2e8f0;
        --gray-900: #f1f5f9;

        --shadow-xs: 0 1px 2px rgba(0, 0, 0, .3);
        --shadow-sm: 0 1px 3px rgba(0, 0, 0, .4);
        --shadow-md: 0 4px 12px rgba(0, 0, 0, .45);
        --shadow-lg: 0 12px 28px rgba(0, 0, 0, .5);
        --shadow-xl: 0 24px 48px rgba(0, 0, 0, .6);
        --shadow-focus: 0 0 0 3px rgba(74, 180, 202, .25);
    }

    body { background: var(--bg); color: var(--text-primary); }
    .card, .stat-card, .modal-content, .table-wrapper, .pagination button { background: var(--card-bg); }
    .btn-outline { background: transparent; color: var(--gray-700); }
    .btn-outline:hover:not(:disabled) { background: rgba(74, 180, 202, .12); }
    .btn-ghost:hover:not(:disabled) { background: rgba(255, 255, 255, .06); }
    th { background: var(--bg-subtle); color: var(--text-muted); }
    td { border-bottom-color: var(--border); }
    .form-group input, .form-group select, .form-group textarea, .form-control {
        background: var(--bg-subtle);
        border-color: var(--border-strong);
        color: var(--text-primary);
    }
    .modal-header, .modal-footer, .card-header, .card-footer { border-color: var(--border); }
    .badge-neutral { background: var(--bg-subtle); color: var(--text-secondary); }
}

/* 大厂级操作按钮通用颜色 */
.btn-view { background: #10b981; color: white; }
.btn-view:hover { background: #059669; transform: translateY(-1px); }
.btn-edit { background: #3b82f6; color: white; }
.btn-edit:hover { background: #2563eb; transform: translateY(-1px); }
.btn-delete { background: #ef4444; color: white; }
.btn-delete:hover { background: #dc2626; transform: translateY(-1px); }
