/* ========== 基础重置 ========== */
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; font-size: 14px; }
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
    background: #f5f6fa; color: #333; line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}
input, select, textarea, button { font-family: inherit; font-size: inherit; }
a { color: inherit; text-decoration: none; }
ul { list-style: none; }

/* ========== 变量 ========== */
:root {
    --primary: #6c5ce7;
    --primary-dark: #5a4bd1;
    --primary-light: #a29bfe;
    --success: #00b894;
    --danger: #e74c3c;
    --warning: #fdcb6e;
    --info: #0984e3;
    --bg: #f5f6fa;
    --card-bg: #fff;
    --border: #e8e8e8;
    --text-1: #2d3436;
    --text-2: #636e72;
    --text-3: #b2bec3;
    --shadow: 0 2px 8px rgba(0,0,0,0.06);
    --shadow-lg: 0 4px 16px rgba(0,0,0,0.1);
    --radius: 10px;
    --radius-sm: 6px;
}

/* ========== 头部 ========== */
.app-header {
    height: 50px; background: var(--primary); color: #fff;
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 12px; position: fixed; top: 0; left: 0; right: 0; z-index: 100;
    box-shadow: 0 2px 6px rgba(108,92,231,0.3);
}
.header-left { display: flex; align-items: center; gap: 10px; }
.menu-btn { background: none; border: none; color: #fff; font-size: 20px; cursor: pointer; padding: 4px; }
.app-title { font-size: 16px; font-weight: 600; white-space: nowrap; }
.header-right select {
    background: rgba(255,255,255,0.2); border: 1px solid rgba(255,255,255,0.3);
    color: #fff; padding: 4px 8px; border-radius: 6px; font-size: 13px;
    max-width: 140px;
}
.header-right select option { color: #333; }

/* ========== 侧边栏 ========== */
.sidebar {
    position: fixed; top: 50px; left: 0; bottom: 0; width: 240px;
    background: #fff; z-index: 99; overflow-y: auto;
    transform: translateX(-100%); transition: transform 0.3s ease;
    box-shadow: 2px 0 12px rgba(0,0,0,0.08);
}
.sidebar.active { transform: translateX(0); }
.sidebar-overlay {
    position: fixed; top: 50px; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.4); z-index: 98; display: none;
    -webkit-tap-highlight-color: transparent;
}
.sidebar-overlay.active { display: block; }

.sidebar-header {
    padding: 16px; border-bottom: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between;
}
.user-info { display: flex; align-items: center; gap: 10px; }
.user-avatar {
    width: 40px; height: 40px; border-radius: 50%;
    background: var(--primary); color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-size: 16px; font-weight: 600;
}
.user-name { font-weight: 600; font-size: 14px; }
.user-role { font-size: 12px; color: var(--text-3); }
.btn-sm {
    padding: 4px 10px; border: 1px solid var(--primary); background: #fff;
    color: var(--primary); border-radius: 6px; font-size: 12px; cursor: pointer;
}

.nav-list { padding: 8px 0; }
.nav-group { margin-bottom: 4px; }
.nav-group-title {
    padding: 10px 16px; font-size: 12px; color: var(--text-3);
    font-weight: 600; letter-spacing: 1px;
    display: flex; align-items: center; justify-content: space-between;
    cursor: pointer; -webkit-tap-highlight-color: transparent;
    user-select: none;
}
.nav-group-title:active { background: #f8f7ff; }
.nav-group-arrow { font-size: 10px; transition: transform 0.2s; }
.nav-group.collapsed .nav-group-arrow { transform: rotate(-90deg); }
.nav-group-items { overflow: hidden; transition: max-height 0.25s ease; }
.nav-group.collapsed .nav-group-items { max-height: 0; }
.nav-item {
    padding: 12px 16px 12px 20px; font-size: 14px; color: var(--text-2);
    cursor: pointer; display: flex; align-items: center; gap: 8px;
    transition: all 0.15s; border-left: 3px solid transparent;
    -webkit-tap-highlight-color: transparent;
}
.nav-item:hover { background: #f8f7ff; color: var(--primary); }
.nav-item.active { background: #f0edff; color: var(--primary); border-left-color: var(--primary); font-weight: 600; }
.nav-icon { font-size: 16px; width: 20px; text-align: center; }
.nav-group .nav-item { padding-left: 36px; font-size: 13px; }

/* ========== 主内容 ========== */
.main-content {
    padding: 60px 12px 24px; max-width: 900px; margin: 0 auto;
    min-height: calc(100vh - 50px);
}

/* ========== 通用组件 ========== */
.btn {
    padding: 8px 16px; border: none; border-radius: 8px; font-size: 14px;
    cursor: pointer; display: inline-flex; align-items: center; gap: 4px;
    transition: opacity 0.15s;
}
.btn:active { opacity: 0.8; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-success { background: var(--success); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-secondary { background: #f0f0f0; color: var(--text-2); }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-block { display: block; width: 100%; justify-content: center; }

.card {
    background: var(--card-bg); border-radius: var(--radius); padding: 16px;
    box-shadow: var(--shadow); margin-bottom: 12px;
}
.card-title { font-size: 15px; font-weight: 600; margin-bottom: 12px; display: flex; align-items: center; justify-content: space-between; }

.form-group { margin-bottom: 12px; }
.form-group label { display: block; font-size: 13px; color: var(--text-2); margin-bottom: 4px; font-weight: 500; }
.form-group input, .form-group select, .form-group textarea {
    width: 100%; padding: 8px 12px; border: 1px solid var(--border);
    border-radius: 8px; font-size: 14px; background: #fff;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
    border-color: var(--primary); outline: none;
}
.form-row { display: flex; gap: 8px; }
.form-row .form-group { flex: 1; }

textarea { resize: vertical; min-height: 80px; }

/* 护理记录图片上传 */
.care-image-upload { margin-top: 8px; }
.care-image-upload label {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 6px 12px; border: 1px dashed var(--primary-light); border-radius: 6px;
    color: var(--primary); font-size: 13px; cursor: pointer; background: #f8f7ff;
}
.care-image-upload input[type="file"] { display: none; }
.care-image-preview {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
    gap: 8px; margin-top: 10px;
}
.care-image-thumb {
    position: relative; width: 100%; aspect-ratio: 1;
    border-radius: 6px; overflow: hidden; border: 1px solid var(--border);
    background: #f8f9fa;
}
.care-image-thumb img {
    width: 100%; height: 100%; object-fit: cover; display: block;
}
.care-image-remove {
    position: absolute; top: 2px; right: 2px; width: 18px; height: 18px;
    background: rgba(231, 76, 60, 0.9); color: #fff; border: none; border-radius: 50%;
    font-size: 12px; line-height: 18px; text-align: center; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
}
.care-image-viewer {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 8px; margin-top: 8px;
}
.care-image-viewer img {
    width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 6px;
    border: 1px solid var(--border); cursor: pointer;
}

/* 表格 */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.data-table { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 600px; }
table.data-table th {
    background: #f8f7ff; padding: 8px 6px; text-align: left; font-weight: 600;
    color: var(--text-2); border-bottom: 2px solid var(--primary-light);
    white-space: nowrap; position: sticky; top: 0;
}
table.data-table td {
    padding: 8px 6px; border-bottom: 1px solid var(--border); white-space: nowrap;
}
table.data-table tr:hover td { background: #faf9ff; }
table.data-table .num { text-align: right; font-variant-numeric: tabular-nums; }
table.data-table .total-row td { font-weight: 700; background: #f0edff; }
table.data-table .group-row td { font-weight: 600; background: #f5f4ff; color: var(--primary); }

/* 标签 */
.badge {
    display: inline-block; padding: 2px 8px; border-radius: 4px; font-size: 11px; font-weight: 600;
}
.badge-success { background: #d4edda; color: #155724; }
.badge-danger { background: #f8d7da; color: #721c24; }
.badge-warning { background: #fff3cd; color: #856404; }
.badge-info { background: #d1ecf1; color: #0c5460; }
.badge-primary { background: #e0dcff; color: var(--primary); }

/* 客户名胶囊列表（客情分层/金额分层页：名字可点击进详情，超长折叠展开） */
.chip-list { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.name-chip {
    display: inline-block; padding: 3px 9px; border-radius: 14px;
    background: #f0eef9; color: var(--primary); border: 1px solid transparent;
    font-size: 12px; line-height: 1.4; cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}
.name-chip:hover { background: #e0dcff; border-color: var(--primary); }
.chip-collapsed { color: var(--muted); font-size: 11px; padding: 0 4px; }
.link-btn {
    background: none; border: 1px dashed var(--border); color: var(--primary);
    padding: 3px 10px; border-radius: 4px; font-size: 12px; cursor: pointer; margin-top: 6px;
}
.link-btn:hover { background: var(--primary); color: #fff; border-color: var(--primary); }

/* 统计卡 */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 8px; margin-bottom: 12px; }
.stat-card {
    background: #fff; border-radius: var(--radius); padding: 12px; box-shadow: var(--shadow);
    text-align: center;
}
.stat-card .label { font-size: 12px; color: var(--text-3); margin-bottom: 4px; }
.stat-card .value { font-size: 20px; font-weight: 700; }
.stat-card .sub { font-size: 11px; color: var(--text-3); margin-top: 2px; }

/* 进度条 */
.progress-bar { height: 6px; background: #eee; border-radius: 3px; overflow: hidden; margin-top: 4px; }
.progress-bar .fill { height: 100%; border-radius: 3px; transition: width 0.3s; }
.progress-bar .fill.green { background: var(--success); }
.progress-bar .fill.orange { background: var(--warning); }
.progress-bar .fill.red { background: var(--danger); }

/* 空状态（旧类名兼容） */
.empty-state .icon { font-size: 48px; margin-bottom: 12px; opacity: 0.5; }
.empty-state .text { font-size: 14px; color: var(--text-2); }
.empty-state .btn { margin-top: 16px; }

/* 弹窗 */
.modal-overlay {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5); z-index: 200; display: none;
    align-items: flex-start; justify-content: center; padding: 20px;
    overflow-y: auto;
}
.modal-overlay.active { display: flex; }
.modal {
    background: #fff; border-radius: 12px; width: 100%; max-width: 500px;
    box-shadow: var(--shadow-lg); margin-top: 20px;
}
.modal-lg { max-width: 700px; }
.modal-header {
    padding: 14px 16px; border-bottom: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between;
}
.modal-header h3 { font-size: 16px; font-weight: 600; }
.close-btn { background: none; border: none; font-size: 22px; color: var(--text-3); cursor: pointer; padding: 0 4px; }
.modal-body { padding: 16px; max-height: 60vh; overflow-y: auto; }
.modal-footer {
    padding: 12px 16px; border-top: 1px solid var(--border);
    display: flex; gap: 8px; justify-content: flex-end;
}

/* Toast */
.toast {
    position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
    background: rgba(0,0,0,0.8); color: #fff; padding: 10px 20px;
    border-radius: 20px; font-size: 14px; z-index: 300;
    opacity: 0; transition: opacity 0.3s; pointer-events: none;
}
.toast.show { opacity: 1; }

/* 列表项 */
.list-item {
    background: #fff; border-radius: var(--radius); padding: 12px;
    box-shadow: var(--shadow); margin-bottom: 8px; display: flex;
    align-items: center; justify-content: space-between; gap: 8px;
}
.list-item .info { flex: 1; min-width: 0; }
.list-item .title { font-weight: 600; font-size: 14px; }
.list-item .desc { font-size: 12px; color: var(--text-3); margin-top: 2px; }
.list-item .actions { display: flex; gap: 4px; flex-shrink: 0; }

/* 客户详情页：会员卡小卡片网格（每张卡一张卡片，看清余额/余次/到期） */
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 8px; padding: 8px 0; }
.mini-card {
    background: #fff; border: 1px solid var(--border); border-radius: 8px;
    padding: 10px 12px; display: flex; flex-direction: column; gap: 6px;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.mini-card:hover { border-color: var(--primary); box-shadow: 0 2px 8px rgba(124,108,252,0.12); }
.mini-card .mc-head { display: flex; justify-content: space-between; align-items: center; gap: 6px; }
.mini-card .mc-title { font-weight: 600; font-size: 13px; line-height: 1.3; }
.mini-card .mc-meta { font-size: 11px; color: var(--text-3); }
.mini-card .mc-numbers { display: flex; gap: 10px; padding-top: 6px; border-top: 1px dashed var(--border); }
.mini-card .mc-num { font-size: 12px; color: var(--text-3); }
.mini-card .mc-num b { font-size: 15px; color: var(--text); margin-right: 2px; }
.mini-card .mc-num.low b { color: var(--danger, #e11d48); }
.mini-card .mc-num.zero b { color: var(--text-3); font-weight: 400; }

/* 选项卡 */
.tabs { display: flex; gap: 4px; margin-bottom: 12px; overflow-x: auto; }
.tab {
    padding: 6px 14px; border: none; background: #f0f0f0; color: var(--text-2);
    border-radius: 6px; font-size: 13px; cursor: pointer; white-space: nowrap;
}
.tab.active { background: var(--primary); color: #fff; }

/* 工作台快捷入口 */
.quick-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.quick-item {
    background: #fff; border-radius: var(--radius); padding: 16px 8px;
    text-align: center; cursor: pointer; box-shadow: var(--shadow);
    transition: transform 0.15s;
}
.quick-item:active { transform: scale(0.95); }
.quick-item .icon { font-size: 28px; margin-bottom: 6px; }
.quick-item .name { font-size: 12px; color: var(--text-2); }

/* 前台数据快速入口卡片（对齐 MANUS 截图15） */
.fd-quick-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 12px;
}
.fd-quick-item {
    background: #fff;
    border-radius: var(--radius);
    padding: 18px 10px;
    text-align: center;
    cursor: pointer;
    box-shadow: var(--shadow);
    transition: transform 0.15s, box-shadow 0.15s;
    border: 1px solid var(--border);
}
.fd-quick-item:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}
.fd-quick-item:active {
    transform: scale(0.98);
}
.fd-quick-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 10px;
}
.fd-quick-icon svg {
    width: 24px;
    height: 24px;
}
.fd-quick-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-1);
    margin-bottom: 4px;
}
.fd-quick-subtitle {
    font-size: 12px;
    color: var(--text-3);
}

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

/* 总结模板复制区 */
.copy-area {
    background: #f8f7ff; border: 1px solid var(--primary-light); border-radius: 8px;
    padding: 14px; font-family: 'Menlo', 'Consolas', monospace; font-size: 13px;
    white-space: pre-wrap; word-break: break-all; line-height: 1.8; position: relative;
}
.copy-area .copy-btn {
    position: absolute; top: 8px; right: 8px; padding: 4px 10px;
    background: var(--primary); color: #fff; border: none; border-radius: 4px;
    font-size: 12px; cursor: pointer;
}

/* 五维能量色块 */
.energy-card {
    border-radius: var(--radius); padding: 14px; margin-bottom: 8px; color: #fff;
    box-shadow: var(--shadow);
}
.energy-yellow { background: linear-gradient(135deg, #f9ca24, #f0932b); }
.energy-red { background: linear-gradient(135deg, #eb4d4b, #c0392b); }
.energy-blue { background: linear-gradient(135deg, #4834d4, #686de0); }
.energy-green { background: linear-gradient(135deg, #6ab04c, #badc58); }

/* 工具类 */
.text-right { text-align: right; }
.text-center { text-align: center; }
.text-primary { color: var(--primary); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.text-sm { font-size: 12px; }
.text-muted { color: var(--text-3); }
.font-bold { font-weight: 700; }
.mt-4 { margin-top: 4px; }
.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mb-8 { margin-bottom: 8px; }
.mb-12 { margin-bottom: 12px; }
.flex { display: flex; }
.flex-1 { flex: 1; }
.gap-4 { gap: 4px; }
.gap-8 { gap: 8px; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.hidden { display: none; }

/* 月铺排客户选择 */
.plan-customer-select-wrap { display: flex; gap: 4px; align-items: center; }
.plan-customer-select-wrap select { flex: 1; min-width: 90px; }
.plan-customer-select-wrap .btn { padding: 2px 6px; font-size: 11px; white-space: nowrap; }
.plan-balance-info { min-height: 18px; }

/* 小按钮 */
.btn-xs { padding: 2px 6px; font-size: 11px; }
.btn-text { background: transparent; color: var(--primary); border: none; }
.btn-text:hover { background: #f0edff; }

/* 分隔线 */
.divider { height: 1px; background: var(--border); margin: 12px 0; }
.divider-text { text-align: center; position: relative; margin: 16px 0; color: var(--text-3); font-size: 12px; }
.divider-text::before, .divider-text::after {
    content: ''; position: absolute; top: 50%; width: 30%; height: 1px; background: var(--border);
}
.divider-text::before { left: 0; }
.divider-text::after { right: 0; }

/* 月份选择器 */
.month-picker { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.month-picker select { padding: 6px 10px; border: 1px solid var(--border); border-radius: 6px; font-size: 13px; }

/* 到店年历 */
.visit-calendar-year { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.visit-calendar-month { border: 1px solid var(--border); border-radius: 8px; padding: 10px; background: #fff; }
.visit-calendar-month-title { text-align: center; font-weight: 600; margin-bottom: 8px; font-size: 14px; color: var(--text-1); }
.visit-calendar-weekdays { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; margin-bottom: 4px; }
.visit-calendar-weekdays span { text-align: center; font-size: 10px; color: var(--text-3); }
.visit-calendar-days { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.visit-calendar-day {
    aspect-ratio: 1; display: flex; align-items: center; justify-content: center;
    font-size: 11px; color: var(--text-2); border-radius: 4px;
    position: relative; cursor: default;
}
.visit-calendar-day:hover { background: #f5f5f5; }
.visit-calendar-day.other-month { color: #ddd; }
.visit-calendar-day.has-visit {
    background: var(--primary-bg); color: var(--primary); font-weight: 600; cursor: pointer;
}
.visit-calendar-day.has-visit::after {
    content: ''; position: absolute; bottom: 2px; width: 4px; height: 4px;
    border-radius: 50%; background: var(--primary);
}
.visit-calendar-day.today { border: 1px solid var(--primary); }
.visit-calendar-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.visit-calendar-header h3 { margin: 0; font-size: 16px; }
@media (max-width: 1100px) { .visit-calendar-year { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 640px) { .visit-calendar-year { grid-template-columns: 1fr; } }

/* 搜索框 */
.search-box {
    width: 100%; padding: 8px 12px 8px 32px; border: 1px solid var(--border);
    border-radius: 8px; font-size: 14px; background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23b2bec3' stroke-width='2'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='m21 21-4.3-4.3'/%3E%3C/svg%3E") no-repeat 10px center;
}

/* 响应式 */
@media (min-width: 768px) {
    .sidebar { transform: translateX(0); }
    .sidebar-overlay { display: none !important; }
    .menu-btn { display: none; }
    .main-content { padding-left: 252px; }
    .app-title { font-size: 18px; }
}

/* ========== 页头 ========== */
.page-header {
    margin-bottom: 12px;
}
.page-header .page-title {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-1);
    margin: 0;
}
.page-header .page-subtitle {
    font-size: 13px;
    color: var(--text-3);
    margin-top: 2px;
}

/* ========== 页面 Tab 栏 ========== */
.page-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 12px;
}
.page-tab {
    padding: 8px 16px;
    border: 1px solid var(--border);
    background: #fff;
    color: var(--text-2);
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.15s;
    min-height: 36px;
    display: inline-flex;
    align-items: center;
    flex: 1 1 auto;
    justify-content: center;
}
.page-tab:hover {
    border-color: var(--primary-light);
    color: var(--primary);
}
.page-tab.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
    font-weight: 600;
}

/* ========== 月份选择器 ========== */
.fd-month-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: #f8f9fa;
    border-radius: 10px;
    margin-bottom: 12px;
}
.period-toggle {
    display: inline-flex;
    background: #eef0f4;
    border-radius: 8px;
    padding: 3px;
    height: 38px;
    align-items: center;
}
.period-btn {
    border: none;
    background: transparent;
    padding: 6px 16px;
    font-size: 14px;
    color: #6b7280;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.15s;
    font-weight: 500;
}
.period-btn:hover { color: #4a90e2; }
.period-btn.active {
    background: #ffffff;
    color: #4a90e2;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}
.fd-month-input {
    font-size: 15px;
    font-weight: 600;
    padding: 6px 10px;
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-1);
    background: #fff;
}

/* ========== 历史筛选条 ========== */
.fd-filter-bar {
    margin-bottom: 12px;
}
.fd-filter-bar .form-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}
.fd-filter-bar .form-group {
    min-width: 120px;
}

/* ========== 改进空状态 ========== */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-3);
}
.empty-state .empty-icon {
    margin-bottom: 16px;
    opacity: 0.6;
}
.empty-state .empty-text {
    font-size: 15px;
    color: var(--text-2);
}

/* ========== 指标卡片颜色语义 ========== */
.stat-card.color-purple { border-top: 3px solid #6c5ce7; }
.stat-card.color-cyan { border-top: 3px solid #00b894; }
.stat-card.color-orange { border-top: 3px solid #fdcb6e; }
.stat-card.color-pink { border-top: 3px solid #e84393; }
.stat-card.color-green { border-top: 3px solid #00b894; }
.stat-card.color-red { border-top: 3px solid #e74c3c; }
.stat-card.color-blue { border-top: 3px solid #0984e3; }

/* ========== 三维排名 ========== */
.rank-3d-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 16px;
}
.rank-3d-col {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}
.rank-3d-header {
    padding: 10px 14px;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 6px;
}
.rank-3d-icon { font-size: 10px; }
.rank-3d-list { padding: 8px; }
.rank-3d-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 6px;
    border-bottom: 1px solid #f0f0f0;
}
.rank-3d-item:last-child { border-bottom: none; }
.rank-3d-first { background: #fffdf5; border-radius: 6px; }
.rank-3d-rank {
    width: 22px; height: 22px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 11px; font-weight: 700;
    color: #fff; flex-shrink: 0;
}
.rank-3d-info { flex: 1; min-width: 0; }
.rank-3d-name { font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rank-3d-store { font-size: 10px; color: var(--text-3); margin-left: 2px; }
.rank-3d-bar-wrap {
    height: 4px; background: #f0f0f0; border-radius: 2px;
    margin-top: 4px; overflow: hidden;
}
.rank-3d-bar { height: 100%; border-radius: 2px; transition: width 0.3s; }
.rank-3d-val { font-size: 13px; font-weight: 700; white-space: nowrap; flex-shrink: 0; }
.rank-3d-empty { padding: 20px; text-align: center; color: var(--text-3); font-size: 13px; }
@media (max-width: 768px) {
    .rank-3d-grid { grid-template-columns: 1fr; }
}

/* ============================================================
 * 前台预约看板
 * ============================================================ */
:root {
    --appt-primary: #4F46E5;
    --appt-blue: #DBEAFE;
    --appt-blue-border: #3B82F6;
    --appt-blue-text: #1E40AF;
    --appt-green: #D1FAE5;
    --appt-green-border: #10B981;
    --appt-green-text: #065F46;
    --appt-orange: #FED7AA;
    --appt-orange-border: #F97316;
    --appt-orange-text: #9A3412;
    --appt-gray: #E5E7EB;
    --appt-gray-text: #6B7280;
}

.appt-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}
.appt-toolbar-left {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}
.appt-select {
    padding: 8px 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #fff;
    font-size: 14px;
    min-height: 36px;
}
.appt-date-nav {
    display: flex;
    align-items: center;
    gap: 6px;
}
.appt-icon-btn {
    width: 36px;
    height: 36px;
    border: 1px solid var(--border);
    background: #fff;
    border-radius: 8px;
    font-size: 18px;
    cursor: pointer;
    color: var(--text-2);
}
.appt-icon-btn:hover {
    border-color: var(--appt-primary);
    color: var(--appt-primary);
}
.appt-date-input {
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    min-height: 36px;
}
.appt-today-btn {
    padding: 8px 14px;
    border: 1px solid var(--border);
    background: #fff;
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
    color: var(--text-2);
}
.appt-today-btn:hover {
    border-color: var(--appt-primary);
    color: var(--appt-primary);
}
.appt-add-btn {
    padding: 10px 20px;
    background: var(--appt-primary);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}
.appt-add-btn:hover { background: #4338CA; }

.appt-day-title {
    text-align: center;
    font-size: 18px;
    font-weight: 600;
    color: var(--text-1);
    padding: 6px 0 14px;
}

.appt-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 16px;
}
.appt-stat {
    padding: 16px;
    border-radius: 12px;
    text-align: center;
}
.appt-stat-value {
    font-size: 28px;
    font-weight: 700;
    line-height: 1;
}
.appt-stat-label {
    font-size: 13px;
    margin-top: 6px;
}
.appt-stat-blue   { background: var(--appt-blue);   color: var(--appt-blue-text); }
.appt-stat-gray   { background: var(--appt-green);  color: var(--appt-green-text); }
.appt-stat-orange { background: var(--appt-orange); color: var(--appt-orange-text); }

.appt-staff-section {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}
.appt-section-label {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-1);
}
.appt-add-person-btn {
    padding: 6px 12px;
    border: 1px dashed var(--appt-primary);
    color: var(--appt-primary);
    background: #fff;
    border-radius: 8px;
    font-size: 13px;
    cursor: pointer;
}
.appt-add-person-btn:hover { background: #EEF2FF; }

.appt-shift-legend {
    margin-left: auto;
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    font-size: 12px;
    color: var(--text-2);
}
.appt-legend-item {
    display: flex;
    align-items: center;
    gap: 4px;
}
.appt-legend-item i {
    display: inline-block;
    width: 14px;
    height: 14px;
    border-radius: 3px;
    border: 1px solid #00000010;
}

/* 看板表格 */
.appt-board-wrap {
    overflow-x: auto;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 10px;
}
.appt-board {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    table-layout: fixed;
    min-width: 720px;
}
.appt-board thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: #f8fafc;
    border-bottom: 2px solid var(--border);
    text-align: center;
    padding: 10px 4px;
    font-weight: 600;
}
.appt-time-col {
    width: 72px;
    background: #f8fafc;
    color: var(--text-2);
    font-size: 12px;
    text-align: center;
    position: sticky;
    left: 0;
    z-index: 3;
}
.appt-staff-head {
    cursor: pointer;
    min-width: 88px;
    transition: filter 0.15s;
}
.appt-staff-head:hover { filter: brightness(0.96); }
.appt-staff-slot { background: #FAFAFA !important; }
.appt-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    margin: 0 auto 4px;
    background: linear-gradient(135deg, #818CF8, #6366F1);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 600;
}
.appt-avatar-fd { background: linear-gradient(135deg, #94A3B8, #64748B); }
.appt-avatar-off { background: #D1D5DB; color: #6B7280; }
.appt-staff-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-1);
}
.appt-staff-shift-label {
    font-size: 11px;
    margin-top: 2px;
    opacity: 0.7;
}

.appt-time-cell {
    background: #f8fafc;
    color: var(--text-2);
    font-size: 12px;
    text-align: center;
    padding: 6px 4px;
    border-bottom: 1px solid #F3F4F6;
    font-weight: 500;
    position: sticky;
    left: 0;
    z-index: 1;
}
.appt-cell {
    border-left: 1px solid #F3F4F6;
    border-bottom: 1px solid #F3F4F6;
    height: 56px;
    vertical-align: top;
    padding: 4px 6px;
    position: relative;
}
.appt-cell-empty {
    cursor: pointer;
    background: #FAFAFA;
    transition: background 0.15s;
}
.appt-cell-empty:hover {
    background: #EEF2FF;
}
.appt-cell-off {
    background: var(--appt-gray);
    color: var(--appt-gray-text);
    text-align: center;
    font-size: 12px;
    line-height: 48px;
}
.appt-cell-slot {
    background: repeating-linear-gradient(45deg, #FAFAFA, #FAFAFA 8px, #F3F4F6 8px, #F3F4F6 16px);
}
.appt-cell-appt {
    cursor: pointer;
    border-left-width: 3px;
    border-left-style: solid;
    transition: filter 0.15s;
}
.appt-cell-appt:hover { filter: brightness(0.96); }
.appt-cell-customer {
    font-size: 13px;
    font-weight: 600;
    line-height: 1.2;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.appt-cell-service {
    font-size: 11px;
    margin-top: 2px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.appt-cell-more {
    position: absolute;
    bottom: 4px;
    right: 6px;
    font-size: 10px;
    background: #00000020;
    color: #fff;
    border-radius: 8px;
    padding: 0 6px;
    font-weight: 600;
}

/* ====== Modal ====== */
.modal-mask {
    position: fixed;
    inset: 0;
    background: #00000060;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 16px;
}
.modal-card {
    background: #fff;
    border-radius: 12px;
    width: 100%;
    max-width: 420px;
    max-height: 90vh;
    overflow-y: auto;
    padding: 20px;
    box-shadow: 0 10px 40px #00000030;
}
.modal-card-wide { max-width: 560px; }
.modal-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-1);
    margin-bottom: 4px;
}
.modal-subtitle {
    font-size: 13px;
    color: var(--text-3);
    margin-bottom: 16px;
}
.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 18px;
    padding-top: 14px;
    border-top: 1px solid var(--border);
}
.btn-primary {
    padding: 8px 18px;
    background: var(--appt-primary);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
}
.btn-primary:hover { background: #4338CA; }
.btn-secondary {
    padding: 8px 18px;
    background: #fff;
    color: var(--text-2);
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
}
.btn-danger {
    padding: 8px 18px;
    background: #fff;
    color: #DC2626;
    border: 1px solid #FCA5A5;
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
    margin-right: auto;
}
.btn-danger:hover { background: #FEF2F2; }

/* ====== 表单 ====== */
.form-group { margin-bottom: 12px; }
.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-2);
    margin-bottom: 6px;
}
.form-input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    box-sizing: border-box;
    min-height: 36px;
    background: #fff;
}
textarea.form-input { resize: vertical; font-family: inherit; }
.form-row { display: flex; gap: 12px; }
.text-danger { color: #DC2626; }
.text-muted { color: var(--text-3); font-weight: normal; }

/* ====== 标签选择 ====== */
.appt-tag-picker {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.appt-tag {
    padding: 6px 14px;
    border: 1px solid var(--border);
    background: #fff;
    color: var(--text-2);
    border-radius: 999px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.15s;
}
.appt-tag:hover { border-color: var(--appt-primary); }
.appt-tag.active {
    background: var(--appt-primary);
    color: #fff;
    border-color: var(--appt-primary);
}

/* ====== 状态切换 ====== */
.appt-status-btns {
    display: flex;
    gap: 8px;
}
.appt-status-btn {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid var(--border);
    background: #fff;
    color: var(--text-2);
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
}
.appt-status-btn.active {
    background: var(--appt-primary);
    color: #fff;
    border-color: var(--appt-primary);
}

/* ====== 班次选择 ====== */
.shift-picker-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    margin-top: 8px;
}
.shift-picker-btn {
    padding: 16px;
    border: 2px solid transparent;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
}
.shift-picker-btn.selected {
    border-color: var(--appt-primary);
    box-shadow: 0 0 0 2px #C7D2FE;
}

/* ====== 批量排班表 ====== */
.shift-mgr-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 8px;
}
.shift-mgr-table th,
.shift-mgr-table td {
    padding: 8px;
    text-align: center;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
}
.shift-mgr-table th {
    background: #f8fafc;
    font-weight: 600;
    color: var(--text-2);
}
.shift-mgr-table td:first-child {
    text-align: left;
    font-weight: 500;
    color: var(--text-1);
}
.shift-cell-btn {
    width: 36px;
    height: 28px;
    border: 1px solid var(--border);
    background: #fff;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
}
.shift-cell-btn.active { border-color: var(--appt-primary); }

/* ====== 响应式 ====== */
@media (max-width: 768px) {
    .appt-stats { grid-template-columns: 1fr; }
    .appt-shift-legend { margin-left: 0; }
}
