/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* 主色：中医深青绿 */
    --primary-color: #2c5f2d;
    --primary-light: #4a8c4e;
    --primary-dark: #1a3f1b;
    --primary-soft: #e6f2ea;
    /* 点缀色：朱砂红（印章/重点，不大面积） */
    --accent-color: #c0392b;
    --accent-soft: #fbe9e7;
    /* 次色：保留 */
    --secondary-color: #8b4513;
    /* 背景：宣纸米 */
    --bg-color: #f8f5f0;
    --card-bg: #ffffff;
    --surface-muted: #faf7f2;
    /* 文字三档墨色 */
    --text-primary: #1a202c;
    --text-secondary: #4a5568;
    --text-muted: #718096;
    /* 边框柔和 */
    --border-color: #e2e8f0;
    --border-strong: #cbd5e0;
    /* 语义色 */
    --success-color: #2f855a;
    --success-soft: #e6f6ec;
    --warning-color: #c05621;
    --warning-soft: #fff4e6;
    --error-color: #c53030;
    --error-soft: #fee8e8;
    /* 阴影：双层轻阴影更立体 */
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.04), 0 4px 12px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 1px 3px rgba(0, 0, 0, 0.04), 0 8px 24px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 4px 8px rgba(0, 0, 0, 0.06), 0 16px 40px rgba(0, 0, 0, 0.10);
    /* 圆角统一升一档 */
    --radius-sm: 10px;
    --radius-md: 14px;
    --radius-lg: 18px;
    --radius-pill: 999px;
    /* 间距八档系统 */
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-6: 24px;
    --space-8: 32px;
    --space-12: 48px;
    --space-16: 64px;
    /* 字体分层：宋体标题 + 黑体正文 */
    --font-serif: 'Noto Serif SC', 'Songti SC', 'STSong', serif;
    --font-sans: 'Noto Sans SC', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-mono: 'JetBrains Mono', 'Consolas', 'Monaco', monospace;
    /* 工作台配色（沿用中医绿设计系统） */
    --wb-btn: #2c5f2d;
    --wb-btn-hover: #4a8c4e;
    --wb-ink: #1a3f1b;
    --wb-deep: #1a3f1b;
    --wb-bg: #f8f5f0;
    --wb-border: #e2e8f0;
    --wb-green: #5f9e6e;
}

body {
    font-family: var(--font-sans);
    background: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.6;
    height: 100vh;
    overflow: hidden;
}

/* 导航栏 */
.navbar {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
    color: white;
    padding: 1.5rem 0;
    box-shadow: var(--shadow-md);
    position: sticky;
    top: 0;
    z-index: 100;
}

.navbar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.logo {
    font-size: 2.5rem;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.2));
}

.navbar h1 {
    font-family: 'Noto Serif SC', serif;
    font-size: 1.8rem;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.nav-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.github-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: white;
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
    font-size: 0.9rem;
}

.github-link:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.github-link svg {
    width: 20px;
    height: 20px;
}

.status-badge {
    background: rgba(255, 255, 255, 0.2);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.9rem;
    backdrop-filter: blur(10px);
}

.status-badge.healthy {
    background: rgba(82, 196, 26, 0.3);
}

.status-badge.error {
    background: rgba(245, 34, 45, 0.3);
}

/* 容器 */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
}

/* 主内容区 */
.main-content {
    flex: 1;
    padding: 3rem 0;
}

/* 章节样式 */
section {
    margin-bottom: 3rem;
}

.section-header {
    text-align: center;
    margin-bottom: 2.5rem;
}

.section-header h2 {
    font-family: 'Noto Serif SC', serif;
    font-size: 2rem;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 1rem;
}

/* 表单样式 */
.patient-form {
    background: var(--card-bg);
    padding: 2.5rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
}

.form-group {
    margin-bottom: 2rem;
}

.form-group label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 0.75rem;
    font-size: 1rem;
}

.label-icon {
    font-size: 1.3rem;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 0.9rem 1.2rem;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 1rem;
    font-family: inherit;
    transition: all 0.3s ease;
    background: #fafafa;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    background: white;
    box-shadow: 0 0 0 3px rgba(44, 95, 45, 0.1);
}

.form-group textarea {
    resize: vertical;
    min-height: 100px;
}

.form-hint {
    display: block;
    margin-top: 0.5rem;
    color: var(--text-secondary);
    font-size: 0.85rem;
}

/* 按钮样式 */
.form-actions {
    display: flex;
    gap: 1rem;
    margin-top: 2.5rem;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.9rem 2rem;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
}

.btn-icon {
    font-size: 1.2rem;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
    color: white;
    box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    background: white;
    color: var(--text-primary);
    border: 2px solid var(--border-color);
}

.btn-secondary:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* 进度显示 */
.progress-section {
    background: var(--card-bg);
    padding: 2.5rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
}

.progress-container {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* 进度文字：当前阶段 + 已等待秒数 */
.progress-status {
    margin-top: 8px;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--wb-btn);
    font-variant-numeric: tabular-nums;
}
.progress-status.stale { color: var(--accent-color); }

.progress-item {
    display: flex;
    gap: 1.5rem;
    padding: 1.5rem;
    background: #fafafa;
    border-radius: var(--radius-md);
    border-left: 4px solid var(--border-color);
    transition: all 0.3s ease;
}

.progress-item.active {
    border-left-color: var(--primary-color);
    background: #f0f7f0;
}

.progress-item.completed {
    border-left-color: var(--success-color);
    background: #f6ffed;
}

.progress-icon {
    font-size: 2.5rem;
    min-width: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.progress-content {
    flex: 1;
}

.progress-content h3 {
    font-size: 1.1rem;
    margin-bottom: 0.3rem;
    color: var(--text-primary);
}

.progress-content p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 0.8rem;
}

.progress-bar {
    height: 6px;
    background: #e0e0e0;
    border-radius: 3px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--primary-light));
    width: 0%;
    transition: width 0.5s ease;
    border-radius: 3px;
}

/* 结果展示 */
.result-section {
    background: var(--card-bg);
    padding: 2.5rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
}

.header-actions {
    display: flex;
    gap: 0.8rem;
    margin-top: 1rem;
}

.result-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 2rem;
    border-bottom: 2px solid var(--border-color);
    overflow-x: auto;
}

.tab-btn {
    padding: 0.8rem 1.5rem;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    color: var(--text-secondary);
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.tab-btn:hover {
    color: var(--primary-color);
}

.tab-btn.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

.tab-content {
    min-height: 400px;
}

.tab-pane {
    display: none;
    animation: fadeIn 0.3s ease;
}

.tab-pane.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 报告容器 */
.report-container {
    background: white;
    padding: 2rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    font-family: 'Noto Serif SC', serif;
    line-height: 1.8;
}

.report-container h1,
.report-container h2,
.report-container h3 {
    color: var(--primary-color);
    margin: 1.5rem 0 1rem;
}

.report-container h1 {
    font-size: 1.8rem;
    text-align: center;
    border-bottom: 2px solid var(--primary-color);
    padding-bottom: 1rem;
}

.report-container h2 {
    font-size: 1.4rem;
}

.report-container h3 {
    font-size: 1.1rem;
}

.report-container p {
    margin: 0.8rem 0;
}

.report-container ul,
.report-container ol {
    margin-left: 2rem;
    margin-bottom: 1rem;
}

.report-container table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
}

.report-container th,
.report-container td {
    border: 1px solid var(--border-color);
    padding: 0.8rem;
    text-align: left;
}

.report-container th {
    background: #f5f5f5;
    font-weight: 600;
}

/* 数据卡片 */
.data-card {
    background: #fafafa;
    padding: 1.5rem;
    border-radius: var(--radius-md);
    margin-bottom: 1.5rem;
    border-left: 4px solid var(--primary-color);
}

.data-card h4 {
    color: var(--primary-color);
    margin-bottom: 1rem;
    font-size: 1.1rem;
}

.data-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
}

.data-item {
    background: white;
    padding: 1rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
}

.data-item strong {
    display: block;
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin-bottom: 0.3rem;
}

.data-item span {
    color: var(--text-primary);
    font-size: 1rem;
}

/* 页脚 */
.footer {
    background: var(--primary-dark);
    color: rgba(255, 255, 255, 0.8);
    text-align: center;
    padding: 2rem 0;
    margin-top: auto;
}

/* 加载动画 */
@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.loading {
    display: inline-block;
    animation: spin 1s linear infinite;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .container {
        padding: 0 1rem;
    }

    .navbar h1 {
        font-size: 1.3rem;
    }

    .nav-info {
        gap: 0.5rem;
    }

    .github-link span {
        display: none;
    }

    .github-link {
        padding: 0.5rem;
    }

    .section-header h2 {
        font-size: 1.5rem;
    }

    .patient-form {
        padding: 1.5rem;
    }

    .form-actions {
        flex-direction: column;
    }

    .btn {
        width: 100%;
        justify-content: center;
    }

    .header-actions {
        flex-wrap: wrap;
    }

    .result-tabs {
        flex-wrap: nowrap;
    }

    .data-grid {
        grid-template-columns: 1fr;
    }
}

/* 打印样式 */
@media print {
    .navbar,
    .footer,
    .header-actions,
    .result-tabs {
        display: none;
    }

    .report-container {
        border: none;
        box-shadow: none;
    }
}

/* 美化 JSON 显示 */
.json-display {
    background: #2d2d2d;
    color: #f8f8f2;
    padding: 1.5rem;
    border-radius: var(--radius-sm);
    overflow-x: auto;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 0.9rem;
    line-height: 1.6;
}

.json-key {
    color: #66d9ef;
}

.json-string {
    color: #e6db74;
}

.json-number {
    color: #ae81ff;
}

.json-boolean {
    color: #fd971f;
}

/* 警告和提示框 */
.alert {
    padding: 1rem 1.5rem;
    border-radius: var(--radius-sm);
    margin: 1rem 0;
    border-left: 4px solid;
}

.alert-success {
    background: #f6ffed;
    border-color: var(--success-color);
    color: #135200;
}

.alert-warning {
    background: #fffbe6;
    border-color: var(--warning-color);
    color: #614700;
}

.alert-error {
    background: #fff2f0;
    border-color: var(--error-color);
    color: #5c0011;
}

.alert-info {
    background: #e6f7ff;
    border-color: #1890ff;
    color: #003a8c;
}

/* ===========================================
   三栏工作台布局（对标系统：左导航/中工作区/右患者档案）
   =========================================== */

.app-layout {
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}

/* ---- 顶栏（对标系统蓝色标题栏） ---- */
.app-topbar {
    height: 46px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    background: linear-gradient(135deg, var(--wb-btn), var(--wb-btn-hover));
    color: #fff;
}
.topbar-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1.02rem;
    font-weight: 700;
    letter-spacing: 1px;
}
.topbar-actions {
    display: flex;
    align-items: center;
    gap: 14px;
}
.topbar-actions .status-badge {
    background: rgba(255, 255, 255, 0.22);
    color: #fff;
    font-size: 0.75rem;
    padding: 3px 10px;
}
.topbar-actions .status-badge.error {
    background: rgba(245, 34, 45, 0.4);
}
.topbar-link {
    color: #fff;
    font-size: 0.8rem;
    text-decoration: none;
    opacity: 0.9;
}
.topbar-link:hover { opacity: 1; text-decoration: underline; }

.app-body {
    display: flex;
    flex: 1;
    min-height: 0;
}

/* ---- 左栏：模块导航 ---- */
.app-sidebar {
    width: 236px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    background: var(--card-bg);
    margin: 12px 0 12px 12px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
}
.sidebar-brand {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 20px 12px 14px;
    border-bottom: 1px solid var(--wb-border);
}
.sidebar-brand .logo { display: none; }
.sidebar-brand h1 {
    font-family: var(--font-serif);
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: 3px;
    color: var(--wb-ink);
    line-height: 1.25;
}
.sidebar-brand small {
    display: block;
    font-size: 0.7rem;
    color: var(--text-muted);
    font-weight: 400;
    letter-spacing: 1px;
}
.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
}
.nav-group-title {
    font-size: 0.72rem;
    color: var(--text-muted);
    letter-spacing: 2px;
    margin: 14px 8px 6px;
}
.nav-group .nav-group-title:first-child { margin-top: 0; }
/* 分类按钮：蓝色双列网格（对标系统） */
#navChiefItems, #navBodyItems, #navExamItems {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    padding: 4px 0;
}
.nav-item {
    position: relative;
    display: flex;
    width: 100%;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 8px 6px;
    border: none;
    background: var(--wb-btn);
    border-radius: 6px;
    color: #fff;
    font-size: 0.82rem;
    font-family: var(--font-sans);
    cursor: pointer;
    transition: all 0.15s ease;
    text-align: center;
}
.nav-item:hover {
    background: var(--wb-btn-hover);
    color: #fff;
}
.nav-item.active {
    background: var(--wb-deep);
    color: #fff;
    font-weight: 600;
}
.nav-badge {
    display: none;
    position: absolute;
    top: -5px;
    right: -5px;
    min-width: 17px;
    height: 17px;
    padding: 0 4px;
    border-radius: var(--radius-pill);
    background: var(--accent-color);
    color: #fff;
    font-size: 0.68rem;
    line-height: 17px;
    text-align: center;
}
.nav-badge.show { display: inline-block; }
.nav-item.active .nav-badge {
    background: var(--accent-color);
    color: #fff;
}
/* ---- 中栏：主工作区 ---- */
.app-main {
    flex: 1;
    min-width: 0;
    overflow-y: auto;
    padding: 14px 18px 20px;
    background: var(--wb-bg);
}
.app-main section { margin-bottom: 0; }

/* 已选症状卡（对标：白卡 + 红星标 + 蓝色药丸） */
.selected-overview {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: flex-start;
    background: var(--card-bg);
    border: 1px solid var(--wb-border);
    border-radius: var(--radius-md);
    padding: 12px 16px;
    margin-bottom: 12px;
}
.selected-overview .selected-label {
    color: var(--text-primary);
    font-size: 0.9rem;
    font-weight: 600;
    padding-top: 4px;
    white-space: nowrap;
}
.selected-overview .selected-label .req {
    color: var(--accent-color);
    margin-right: 3px;
}
.selected-overview .empty-hint {
    color: var(--text-muted);
    font-size: 0.85rem;
    padding-top: 4px;
}
.selected-chips {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
}
.selected-chips .chip.selected {
    background: var(--wb-btn);
    border-color: var(--wb-btn);
    color: #fff;
}

/* 搜索与操作行 */
.search-row {
    background: var(--card-bg);
    border: 1px solid var(--wb-border);
    border-radius: var(--radius-md);
    padding: 12px 16px;
    margin-bottom: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.search-fields { display: flex; gap: 12px; }
.search-fields input,
.search-fields select {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid var(--wb-border);
    border-radius: 6px;
    font-size: 0.9rem;
    font-family: inherit;
    background: #fff;
    color: var(--text-primary);
}
.search-fields input:focus,
.search-fields select:focus {
    outline: none;
    border-color: var(--wb-btn);
    box-shadow: 0 0 0 3px rgba(44, 95, 45, 0.12);
}
.search-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}
.search-tip { font-size: 0.78rem; color: var(--text-muted); }
.search-btn-group { display: flex; align-items: center; gap: 8px; }
.btn-green {
    background: var(--wb-green);
    color: #fff;
}
.btn-green:hover { background: #528a60; }
.search-empty {
    color: var(--text-muted);
    font-size: 0.88rem;
    padding: 10px 0;
}
.workbench-cloud {
    background: var(--card-bg);
    border: 1px solid var(--wb-border);
    border-radius: var(--radius-md);
    padding: 16px 20px 20px;
    margin-bottom: 16px;
    min-height: 130px;
}
.workbench-cloud .symptom-group-title:first-child { margin-top: 0; }

.result-section .section-header,
.progress-section .section-header {
    text-align: left;
    margin-bottom: 20px;
}
.result-section .section-header h2,
.progress-section .section-header h2 { font-size: 1.5rem; }

/* ---- 右栏：患者档案 ---- */
.app-patientpanel {
    width: 312px;
    flex-shrink: 0;
    overflow-y: auto;
    background: var(--wb-bg);
    padding: 12px 12px 12px 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.panel-card {
    background: var(--card-bg);
    border: 1px solid var(--wb-border);
    border-radius: var(--radius-md);
    padding: 16px;
    box-shadow: var(--shadow-sm);
}
.panel-card-title {
    font-family: var(--font-serif);
    font-weight: 700;
    font-size: 0.98rem;
    color: var(--wb-ink);
    border-left: 3px solid var(--wb-btn);
    padding-left: 10px;
    margin-bottom: 12px;
}
.panel-card .form-group { margin-bottom: 14px; }
.panel-card .form-group:last-child { margin-bottom: 0; }
.panel-card label {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--wb-ink);
    margin-bottom: 6px;
}
.panel-card input,
.panel-card textarea {
    border: 1px solid var(--wb-border);
    background: #fff;
}
.panel-disclaimer {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-align: center;
    line-height: 1.7;
    margin-top: auto;
}

/* 右栏内的历史列表（去外框，避免双重卡片） */
.panel-card .history-list-section {
    background: transparent;
    border: none;
    box-shadow: none;
    padding: 0;
    margin-bottom: 0;
}
.panel-card .history-list-header { margin-bottom: 10px; }

/* 响应式降级 */
@media (max-width: 1280px) {
    .app-patientpanel { width: 260px; }
}
@media (max-width: 1100px) {
    .app-sidebar { width: 210px; }
    .app-patientpanel { width: 250px; }
}
@media (max-width: 920px) {
    body { overflow: auto; height: auto; }
    .app-layout { height: auto; overflow: visible; }
    .app-body { flex-direction: column; }
    .app-sidebar { width: auto; margin: 10px 10px 0; }
    .sidebar-nav { display: flex; flex-wrap: wrap; gap: 4px; }
    .nav-group { display: contents; }
    #navChiefItems, #navBodyItems, #navExamItems {
        grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
    }
    .nav-item { width: auto; }
    .app-main { overflow: visible; width: auto; padding: 12px; }
    .app-patientpanel {
        width: auto;
        padding: 0 10px 10px;
    }
}

/* ===========================================
   设计系统组件（Phase 1+ 起统一使用）
   =========================================== */

/* 症状标签云面板（Phase 2） */
.symptom-panel {
    background: var(--surface-muted);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-3);
    overflow: hidden;
}
.symptom-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-2) var(--space-4);
    cursor: default;
}
.symptom-panel-title {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary);
}
.symptom-panel-toggle {
    background: transparent;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-pill);
    padding: 2px var(--space-3);
    font-size: 0.8rem;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s ease;
}
.symptom-panel-toggle:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
    background: var(--primary-soft);
}
.symptom-panel-body {
    padding: 0 var(--space-4) var(--space-4);
}
.symptom-tabs {
    display: flex;
    gap: var(--space-2);
    flex-wrap: wrap;
    padding-top: var(--space-2);
    border-bottom: 1px solid var(--border-color);
    margin-bottom: var(--space-3);
}
.symptom-tab {
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    padding: var(--space-1) var(--space-3) var(--space-2);
    font-size: 0.9rem;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s ease;
    margin-bottom: -1px;
}
.symptom-tab:hover {
    color: var(--primary-color);
}
.symptom-tab.active {
    color: var(--primary-color);
    font-weight: 700;
    border-bottom-color: var(--primary-color);
}
.symptom-group-title {
    font-family: var(--font-sans);
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--wb-ink);
    margin: var(--space-3) 0 var(--space-2);
    padding-left: var(--space-2);
    border-left: 3px solid var(--wb-btn);
}
.symptom-cloud {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
}
/* 症状卡片：白底细边小圆角（对标系统） */
.symptom-cloud .chip {
    background: #fff;
    border: 1px solid var(--wb-border);
    border-radius: 6px;
    color: var(--text-secondary);
    font-weight: 400;
}
.symptom-cloud .chip:hover {
    background: #f3f7f3;
    border-color: var(--wb-btn);
    color: var(--wb-ink);
}
.symptom-cloud .chip.selected {
    background: var(--wb-btn);
    border-color: var(--wb-btn);
    color: #fff;
}
/* 模块内分组页签（对标"舌诊/整体观察"） */
.cloud-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: var(--space-3);
    padding-bottom: 10px;
    border-bottom: 1px solid var(--wb-border);
}
.cloud-tab {
    padding: 5px 16px;
    border: none;
    border-radius: var(--radius-pill);
    background: var(--surface-muted);
    color: var(--text-secondary);
    font-size: 0.88rem;
    font-family: var(--font-sans);
    cursor: pointer;
    transition: all 0.15s ease;
}
.cloud-tab:hover {
    color: var(--wb-ink);
    background: var(--primary-soft);
}
.cloud-tab.active {
    background: var(--wb-btn);
    color: #fff;
    font-weight: 500;
}
.selected-symptoms {
    display: flex;
    align-items: flex-start;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-4) var(--space-3);
    border-top: 1px dashed var(--border-color);
}
.selected-label {
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 26px;
    white-space: nowrap;
}
.selected-chips {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
}

/* 历史诊疗记录列表 */
.history-list-section {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: var(--space-4) var(--space-6);
    margin-bottom: var(--space-6);
}
.history-list-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin-bottom: var(--space-3);
}
.history-list-title {
    font-family: var(--font-serif);
    font-weight: 700;
    font-size: 1rem;
    color: var(--text-primary);
}
.history-list-hint {
    font-size: 0.8rem;
    color: var(--text-muted);
}
.history-list-items {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}
.history-item {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--space-2) var(--space-3);
    padding: var(--space-3) var(--space-4);
    background: var(--surface-muted);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s ease;
}
.history-item:hover {
    background: var(--primary-soft);
    border-color: var(--primary-color);
    transform: translateX(4px);
}
.history-item-main {
    flex: 1 1 auto;
    display: flex;
    align-items: baseline;
    gap: var(--space-3);
    min-width: 0;
    overflow: hidden;
}
.history-item-name {
    font-family: var(--font-serif);
    font-weight: 700;
    color: var(--text-primary);
    white-space: nowrap;
}
.history-item-patient {
    font-size: 0.85rem;
    color: var(--primary-light);
    background: var(--primary-soft);
    padding: 0 8px;
    border-radius: var(--radius-pill);
    white-space: nowrap;
}
.history-item-disease {
    font-size: 0.85rem;
    color: var(--text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.history-item-date {
    flex: 0 0 auto;
    margin-left: auto;
    font-size: 0.8rem;
    color: var(--text-muted);
    white-space: nowrap;
}
.history-item-arrow {
    flex: 0 0 auto;
    color: var(--primary-color);
    font-weight: 700;
    transition: transform 0.2s ease;
}
.history-item:hover .history-item-arrow {
    transform: translateX(3px);
}

/* 卡片：核心容器，双层轻阴影 + hover 升起 */
.ds-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    padding: var(--space-6);
    transition: box-shadow 0.2s ease, transform 0.2s ease;
}
.ds-card:hover {
    box-shadow: var(--shadow-lg);
}

/* 卡片标题：宋体 + 朱砂红左竖线 */
.ds-card-title {
    font-family: var(--font-serif);
    font-weight: 700;
    font-size: 1.15rem;
    color: var(--text-primary);
    border-left: 4px solid var(--accent-color);
    padding-left: var(--space-3);
    margin-bottom: var(--space-4);
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

/* 卡片副标题/分组小标题 */
.ds-subtitle {
    font-family: var(--font-serif);
    font-weight: 500;
    font-size: 0.95rem;
    color: var(--text-secondary);
    margin: var(--space-4) 0 var(--space-2);
    letter-spacing: 0.5px;
}

/* 章节分隔 */
.ds-divider {
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--border-color), transparent);
    margin: var(--space-6) 0;
}

/* 按钮三档（升级版，保留 .btn 兼容） */
.btn-primary {
    background: var(--primary-color);
    color: #fff;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--primary-color);
}
.btn-primary:hover {
    background: var(--primary-light);
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}
.btn-secondary {
    background: var(--card-bg);
    color: var(--primary-color);
    border: 1px solid var(--border-strong);
}
.btn-secondary:hover {
    background: var(--primary-soft);
    border-color: var(--primary-color);
}
.btn-danger {
    background: var(--error-color);
    color: #fff;
    border: 1px solid var(--error-color);
}
.btn-danger:hover {
    background: #a02828;
}
.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid transparent;
}
.btn-ghost:hover {
    background: var(--surface-muted);
    color: var(--text-primary);
}

/* 标签 chip：圆角全圆 + 浅底深字 + hover 显红 */
.chip {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    padding: var(--space-1) var(--space-3);
    background: var(--primary-soft);
    color: var(--primary-dark);
    border-radius: var(--radius-pill);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}
.chip:hover {
    background: var(--primary-color);
    color: #fff;
}
.chip.selected {
    background: var(--primary-color);
    color: #fff;
    border-color: var(--primary-dark);
}
.chip .chip-remove {
    margin-left: var(--space-1);
    width: 16px;
    height: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    color: inherit;
    font-size: 0.7rem;
    cursor: pointer;
}
.chip .chip-remove:hover {
    background: var(--error-color);
    color: #fff;
}

/* 穴位卡片网格 */
.acupoint-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: var(--space-3);
    margin-top: var(--space-3);
}
.acupoint-card {
    background: var(--surface-muted);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: var(--space-3) var(--space-4);
    transition: all 0.2s ease;
}
.acupoint-card:hover {
    background: var(--primary-soft);
    border-color: var(--primary-color);
    transform: translateY(-2px);
}
.acupoint-name {
    font-family: var(--font-serif);
    font-weight: 700;
    font-size: 1.05rem;
    color: var(--text-primary);
    margin-bottom: var(--space-1);
}
.acupoint-meta {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    margin-bottom: var(--space-2);
}
.acupoint-meta .badge {
    display: inline-block;
    padding: 2px var(--space-2);
    border-radius: var(--radius-pill);
    font-size: 0.75rem;
    font-weight: 500;
    background: var(--primary-soft);
    color: var(--primary-dark);
}
.acupoint-meta .badge.manual-complement { background: var(--success-soft); color: var(--success-color); }
.acupoint-meta .badge.manual-reduction { background: var(--error-soft); color: var(--error-color); }
.acupoint-meta .badge.manual-moxibustion { background: var(--warning-soft); color: var(--warning-color); }
.acupoint-effect {
    color: var(--text-secondary);
    font-size: 0.85rem;
    line-height: 1.5;
}

/* 中成药卡片网格（复用 acupoint 结构） */
.patent-medicine-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: var(--space-3);
    margin-top: var(--space-3);
}
.patent-medicine-card {
    background: var(--surface-muted);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: var(--space-4);
}
.patent-medicine-card .pm-name {
    font-family: var(--font-serif);
    font-weight: 700;
    font-size: 1rem;
    color: var(--text-primary);
    margin-bottom: var(--space-2);
}
.patent-medicine-card .pm-meta {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    margin-bottom: var(--space-2);
}
.patent-medicine-card .pm-meta .match-high { color: var(--success-color); }
.patent-medicine-card .pm-meta .match-mid { color: var(--warning-color); }
.patent-medicine-card .pm-detail {
    color: var(--text-secondary);
    font-size: 0.85rem;
    line-height: 1.5;
}

/* 数据表格（药材价格/费用明细） */
.ds-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    border-radius: var(--radius-md);
    overflow: hidden;
    border: 1px solid var(--border-color);
}
.ds-table thead th {
    background: var(--primary-color);
    color: #fff;
    font-weight: 500;
    font-size: 0.9rem;
    padding: var(--space-3) var(--space-4);
    text-align: left;
    letter-spacing: 0.3px;
}
.ds-table tbody td {
    padding: var(--space-3) var(--space-4);
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
    font-size: 0.95rem;
}
.ds-table tbody tr:nth-child(even) { background: var(--surface-muted); }
.ds-table tbody tr:hover { background: var(--primary-soft); }
.ds-table tbody tr:last-child td { border-bottom: none; }

/* 骨架屏加载 */
.skeleton {
    background: linear-gradient(90deg, var(--surface-muted) 25%, #eaeaea 37%, var(--surface-muted) 63%);
    background-size: 400% 100%;
    animation: skeleton-loading 1.4s ease infinite;
    border-radius: var(--radius-sm);
}
.skeleton-text { height: 14px; margin-bottom: var(--space-2); }
.skeleton-title { height: 20px; width: 60%; margin-bottom: var(--space-3); }
.skeleton-card { height: 120px; border-radius: var(--radius-md); }
@keyframes skeleton-loading {
    0% { background-position: 100% 50%; }
    100% { background-position: 0 50%; }
}

/* ===== 患者随访反馈（Phase 3） ===== */
.feedback-card {
    margin-top: var(--space-6);
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    padding: var(--space-6);
}
.feedback-title {
    font-family: var(--font-serif);
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-primary);
    border-left: 4px solid var(--accent-color);
    padding-left: var(--space-3);
    margin-bottom: var(--space-3);
}
.feedback-hint {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: var(--space-3);
}
.feedback-options {
    display: flex;
    gap: var(--space-3);
    flex-wrap: wrap;
    margin-bottom: var(--space-3);
}
.feedback-opt {
    padding: 8px 20px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-pill);
    background: #fff;
    color: var(--text-primary);
    font-size: 0.95rem;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s ease;
}
.feedback-opt:hover {
    border-color: var(--primary-light);
    background: var(--primary-soft);
}
.feedback-opt.selected {
    border-color: var(--primary-color);
    background: var(--primary-color);
    color: #fff;
}
#feedbackNote {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    font-family: inherit;
    background: var(--surface-muted);
    resize: vertical;
    margin-bottom: var(--space-3);
}
#feedbackNote:focus {
    outline: none;
    border-color: var(--primary-color);
    background: #fff;
    box-shadow: 0 0 0 3px rgba(44, 95, 45, 0.1);
}
.feedback-actions {
    display: flex;
    justify-content: flex-end;
}
.feedback-done {
    color: var(--success-color);
    font-weight: 500;
    margin-bottom: 0;
}

/* ===== 药材价格管理页（Phase 4） ===== */
.prices-layout {
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.prices-main {
    flex: 1;
    overflow-y: auto;
    max-width: 1080px;
    width: 100%;
    margin: 0 auto;
    padding: var(--space-6) 24px var(--space-12);
}
.tab-btns {
    display: flex;
    gap: var(--space-2);
    border-bottom: 2px solid var(--border-color);
    margin-bottom: var(--space-6);
}
.toolbar {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    flex-wrap: wrap;
    margin-bottom: var(--space-4);
}
.toolbar-input {
    width: 240px;
    padding: 9px 14px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    font-family: inherit;
    background: #fff;
}
.toolbar-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(44, 95, 45, 0.1);
}
.toolbar-coeff {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    margin-left: auto;
    color: var(--text-secondary);
    font-size: 0.9rem;
}
.toolbar-coeff input {
    width: 72px;
    padding: 7px 10px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
}
.ds-table-wrap { overflow-x: auto; }
.row-actions { white-space: nowrap; }
.btn-mini {
    padding: 4px 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: #fff;
    color: var(--text-primary);
    font-size: 0.85rem;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.15s ease;
}
.btn-mini:hover { border-color: var(--primary-color); color: var(--primary-color); background: var(--primary-soft); }
.btn-mini.danger:hover { border-color: var(--accent-color); color: var(--accent-color); background: var(--accent-soft); }
.btn-mini:disabled { opacity: 0.4; cursor: not-allowed; }
.empty-row {
    text-align: center;
    color: var(--text-muted);
    padding: var(--space-8) var(--space-4) !important;
}
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-4);
    margin-top: var(--space-4);
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* 编辑弹窗 */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(26, 32, 44, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}
.modal {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: min(440px, calc(100vw - 48px));
    max-height: 84vh;
    overflow-y: auto;
    padding: var(--space-6);
}
.modal-title {
    font-family: var(--font-serif);
    font-size: 1.1rem;
    font-weight: 700;
    border-left: 4px solid var(--accent-color);
    padding-left: var(--space-3);
    margin-bottom: var(--space-4);
}
.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: var(--space-3);
    margin-top: var(--space-2);
}

/* 诊所信息表单 */
.clinic-form { max-width: 560px; }
.clinic-form .form-group { margin-bottom: var(--space-4); }
.clinic-form label {
    display: block;
    font-weight: 500;
    margin-bottom: var(--space-2);
    color: var(--text-primary);
}
.clinic-form input,
.clinic-form textarea {
    width: 100%;
    padding: 10px 14px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    font-family: inherit;
    background: var(--surface-muted);
}
.clinic-form input:focus,
.clinic-form textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    background: #fff;
    box-shadow: 0 0 0 3px rgba(44, 95, 45, 0.1);
}

/* 页面通知 */
.price-toast {
    position: fixed;
    top: 72px;
    left: 50%;
    transform: translateX(-50%);
    padding: 10px 22px;
    border-radius: var(--radius-pill);
    background: var(--wb-deep);
    color: #fff;
    font-size: 0.92rem;
    box-shadow: var(--shadow-md);
    display: none;
    z-index: 1100;
}
.price-toast.success { background: var(--success-color); }
.price-toast.error { background: var(--error-color); }
.price-toast.warning { background: var(--warning-color); }

/* ===== 患者信息卡（右栏，对标竞品患者信息表单） ===== */
.patient-profile-form {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}
.patient-profile-form input,
.patient-profile-form select,
.patient-profile-form textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    font-family: inherit;
    background: #fff;
    color: var(--text-primary);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.patient-profile-form input::placeholder,
.patient-profile-form textarea::placeholder {
    color: var(--text-muted);
}
.patient-profile-form input:focus,
.patient-profile-form select:focus,
.patient-profile-form textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(44, 95, 45, 0.1);
}
.patient-profile-form textarea { resize: vertical; min-height: 56px; }
.profile-row {
    display: flex;
    gap: var(--space-3);
}
.profile-row > * { flex: 1; min-width: 0; }
.profile-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: var(--space-3);
    padding-top: var(--space-3);
    border-top: 1px solid var(--border-color);
}
.profile-btn {
    background: none;
    border: none;
    padding: 6px 10px;
    font-size: 0.95rem;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: background 0.15s ease, color 0.15s ease;
}
.profile-btn.save { color: var(--primary-color); }
.profile-btn.save:hover { background: var(--primary-soft); }
.profile-btn.cancel { color: var(--text-secondary); }
.profile-btn.cancel:hover { background: var(--error-soft); color: var(--error-color); }

/* 空状态 */
.empty-state {
    text-align: center;
    padding: var(--space-12) var(--space-6);
    color: var(--text-muted);
}
.empty-state .empty-icon {
    font-size: 3rem;
    margin-bottom: var(--space-3);
    opacity: 0.5;
}
.empty-state .empty-title {
    font-family: var(--font-serif);
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin-bottom: var(--space-2);
}
.empty-state .empty-hint {
    font-size: 0.9rem;
    color: var(--text-muted);
}

/* 印章装饰（朱砂红方印，伪印章） */
.seal {
    display: inline-block;
    padding: var(--space-2) var(--space-3);
    background: var(--accent-color);
    color: #fff;
    font-family: var(--font-serif);
    font-weight: 700;
    font-size: 0.85rem;
    letter-spacing: 2px;
    border-radius: 4px;
    box-shadow: 0 1px 3px rgba(192, 57, 43, 0.4);
    transform: rotate(-3deg);
    line-height: 1.2;
    writing-mode: vertical-rl;
}

/* 宣纸纹理（主背景轻微噪点） */
.paper-texture {
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.4'/%3E%3C/svg%3E");
    background-blend-mode: multiply;
    background-color: var(--bg-color);
}

/* 处方区块容器（6 个卡片纵向排列） */
.prescription-blocks {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
}
.prescription-blocks .ds-card { margin-bottom: 0; }

/* 主方原文引用样式 */
.formula-source {
    background: var(--surface-muted);
    border-left: 3px solid var(--primary-color);
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius-sm);
    margin-top: var(--space-3);
}
.formula-source .source-cite {
    font-family: var(--font-serif);
    color: var(--primary-color);
    font-weight: 500;
    font-size: 0.9rem;
    margin-bottom: var(--space-1);
}
.formula-source .source-text {
    color: var(--text-primary);
    font-size: 0.95rem;
    line-height: 1.7;
}

/* 加减方标签 */
.modification-tags {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    align-items: center;
}
.modification-tags .add-tag { background: var(--success-soft); color: var(--success-color); }
.modification-tags .remove-tag { background: var(--error-soft); color: var(--error-color); }

/* 煎服法突出样式 */
.decoction-info {
    background: linear-gradient(135deg, var(--primary-soft), var(--surface-muted));
    border: 1px solid var(--primary-color);
    border-radius: var(--radius-md);
    padding: var(--space-4);
    margin-top: var(--space-3);
}
.decoction-info .decoction-title {
    font-family: var(--font-serif);
    color: var(--primary-color);
    font-weight: 700;
    margin-bottom: var(--space-2);
    display: flex;
    align-items: center;
    gap: var(--space-2);
}
.decoction-info .decoction-text {
    color: var(--text-primary);
    line-height: 1.7;
    font-size: 0.95rem;
}
.decoction-info .precaution {
    margin-top: var(--space-3);
    padding-top: var(--space-3);
    border-top: 1px dashed var(--border-strong);
    color: var(--accent-color);
    font-size: 0.9rem;
}

/* 疗程建议卡片 */
.course-card {
    background: var(--surface-muted);
    border-radius: var(--radius-md);
    padding: var(--space-4);
    margin-top: var(--space-3);
}
.course-card .course-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-2) 0;
    border-bottom: 1px solid var(--border-color);
}
.course-card .course-row:last-child { border-bottom: none; }
.course-card .course-label { color: var(--text-secondary); font-size: 0.9rem; }
.course-card .course-value { color: var(--text-primary); font-weight: 500; }

/* =============================================================
   Phase 5：费用结算卡样式
   ============================================================= */

.billing-card {
    margin-top: var(--space-4);
    background: #fff;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    border-left: 4px solid var(--accent-color);
    box-shadow: var(--shadow-sm);
    padding: var(--space-6);
}
.billing-card.billing-empty {
    border-left-color: var(--text-muted);
    padding: var(--space-4) var(--space-6);
}
.billing-empty-hint {
    font-family: var(--font-serif);
    color: var(--text-secondary);
    font-size: 0.95rem;
    text-align: center;
    padding: var(--space-4);
    background: var(--surface-muted);
    border-radius: var(--radius-sm);
}

.billing-title {
    font-family: var(--font-serif);
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--accent-color);
    margin-bottom: var(--space-4);
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.billing-section { margin-bottom: var(--space-4); }
.billing-section-title {
    font-family: var(--font-serif);
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--space-3);
    padding-bottom: var(--space-1);
    border-bottom: 1px solid var(--border-color);
}

/* 药价明细表 */
.billing-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}
.billing-table thead th {
    background: var(--primary-color);
    color: #fff;
    font-weight: 500;
    padding: 8px 10px;
    text-align: left;
    font-size: 0.85rem;
}
.billing-table tbody tr:nth-child(odd) { background: #fff; }
.billing-table tbody tr:nth-child(even) { background: var(--surface-muted); }
.billing-table tbody tr:hover { background: var(--primary-soft); }
.billing-table td {
    padding: 7px 10px;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
}
.billing-table .herb-name {
    font-family: var(--font-serif);
    font-weight: 600;
    color: var(--text-primary);
}
.billing-input {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 4px 8px;
    font-size: 0.85rem;
    font-family: inherit;
    background: #fff;
    transition: border-color 0.15s ease;
}
.billing-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(44, 95, 45, 0.1);
}
.billing-table .herb-subtotal {
    color: var(--primary-color);
    font-weight: 600;
    font-size: 0.95rem;
}

/* 理疗项目 */
.billing-treatments {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-3);
}
.treat-checkbox {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-3);
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-pill);
    cursor: pointer;
    transition: all 0.15s ease;
    user-select: none;
    font-size: 0.9rem;
    background: #fff;
}
.treat-checkbox:hover { border-color: var(--primary-light); }
.treat-checkbox input[type=checkbox] {
    width: 16px; height: 16px; accent-color: var(--primary-color); cursor: pointer;
}
.treat-checkbox:has(input:checked) {
    background: var(--primary-soft);
    border-color: var(--primary-color);
    color: var(--primary-color);
    font-weight: 500;
}
.treat-name { font-family: var(--font-serif); font-weight: 600; }
.treat-cat { color: var(--text-muted); font-size: 0.8rem; }
.treat-price { color: var(--text-secondary); font-size: 0.85rem; }
.treat-subtotal {
    margin-left: var(--space-1);
    padding: 2px 8px;
    background: var(--primary-color);
    color: #fff;
    border-radius: var(--radius-pill);
    font-size: 0.8rem;
    font-weight: 500;
}

/* 其他费用 */
.billing-fees {
    display: flex;
    gap: var(--space-6);
    align-items: center;
    flex-wrap: wrap;
}
.billing-fees label {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* 汇总 */
.billing-summary {
    background: var(--surface-muted);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: var(--space-4) var(--space-6);
    margin-bottom: var(--space-4);
}
.billing-summary .summary-row {
    display: flex;
    justify-content: space-between;
    padding: 4px 0;
    font-size: 0.95rem;
}
.billing-summary .summary-row span:first-child { color: var(--text-secondary); }
.billing-summary .summary-row span:last-child { color: var(--text-primary); font-weight: 500; }
.billing-summary .summary-row.grand {
    margin-top: var(--space-2);
    padding-top: var(--space-2);
    border-top: 2px solid var(--primary-color);
    font-size: 1.15rem;
}
.billing-summary .summary-row.grand span:last-child {
    color: var(--accent-color);
    font-weight: 700;
    font-family: var(--font-serif);
}

/* 支付方式 + 动作 */
.billing-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--space-4);
    flex-wrap: wrap;
}
.payment-methods {
    display: flex;
    gap: var(--space-2);
    flex-wrap: wrap;
}
.pay-btn {
    padding: 6px 14px;
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-pill);
    background: #fff;
    font-size: 0.88rem;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.15s ease;
    color: var(--text-secondary);
}
.pay-btn:hover { border-color: var(--primary-light); color: var(--primary-color); }
.pay-btn.active {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: #fff;
    font-weight: 500;
}
.billing-actions {
    display: flex;
    gap: var(--space-2);
}
.btn-green {
    background: var(--primary-color);
    color: #fff;
    border: none;
    padding: 8px 20px;
    border-radius: var(--radius-sm);
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s ease;
}
.btn-green:hover:not(:disabled) { background: var(--primary-light); }
.btn-green:disabled {
    background: var(--text-muted);
    cursor: not-allowed;
    opacity: 0.7;
}
.btn.btn-secondary {
    background: #fff;
    color: var(--text-secondary);
    border: 1.5px solid var(--border-color);
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
}
.btn.btn-secondary:hover { border-color: var(--primary-light); color: var(--primary-color); }
.btn-done {
    background: var(--success-color) !important;
    border-color: var(--success-color) !important;
}

/* 备注 */
.billing-note-row { margin-top: var(--space-3); }
.billing-note {
    width: 100%;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 8px 12px;
    font-size: 0.9rem;
    font-family: inherit;
    background: #fff;
}
.billing-note:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(44, 95, 45, 0.1);
}

/* 打印样式 */
@media print {
    body { background: #fff !important; overflow: visible; }
    .app-topbar, .app-sidebar, .result-tabs, .billing-treatments,
    .billing-footer, .billing-note-row, .billing-fees { display: none !important; }
    /* 只打印当前激活的 Tab，避免多 Tab 全部输出 */
    .tab-pane:not(.active) { display: none !important; }
    .billing-card {
        border: 2px solid #333 !important;
        box-shadow: none !important;
        page-break-inside: avoid;
    }
    .billing-title { color: #333 !important; }
    .billing-table thead th { background: #333 !important; color: #fff !important; }
    .billing-summary { border: 1px solid #333 !important; }
    .billing-summary .summary-row.grand span:last-child { color: #000 !important; }
}

/* ============ Phase 6: 经营数据看板 ============ */
.dashboard-layout {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--bg-page, #f5f0e6);
}
.dashboard-main {
    flex: 1;
    padding: 20px;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
}
.dashboard-select {
    padding: 4px 10px;
    border-radius: 6px;
    border: 1px solid rgba(255,255,255,0.3);
    background: rgba(255,255,255,0.15);
    color: #fff;
    font-size: 0.85rem;
    cursor: pointer;
}
.dashboard-select option { color: #333; }

/* 指标卡片 */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}
.metric-card {
    background: #fff;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    border-left: 4px solid var(--primary-color, #2d5016);
}
.metric-label {
    font-size: 0.85rem;
    color: var(--text-muted, #888);
    margin-bottom: 8px;
}
.metric-value {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--primary-color, #2d5016);
    font-family: var(--font-serif, 'Noto Serif SC', serif);
}
.metric-sub {
    font-size: 0.75rem;
    color: var(--text-muted, #aaa);
    margin-top: 6px;
}

/* 图表卡片 */
.charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(450px, 1fr));
    gap: 20px;
}
.chart-card {
    background: #fff;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}
.chart-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary, #333);
    margin-bottom: 12px;
    font-family: var(--font-serif, 'Noto Serif SC', serif);
}
.chart-container {
    height: 280px;
    position: relative;
}
/* 图表空状态占位 */
.chart-empty {
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted, #999);
    font-size: 0.9rem;
}
/* 图表标题右侧补充说明（如恢复率） */
.chart-title-note {
    float: right;
    font-size: 0.78rem;
    font-weight: 400;
    color: var(--text-muted, #999);
}

/* 空数据提示 */
.empty-hint {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted, #888);
    font-size: 1.1rem;
    background: #fff;
    border-radius: 12px;
    margin-top: 20px;
}

/* 响应式 */
@media (max-width: 768px) {
    .metrics-grid { grid-template-columns: repeat(2, 1fr); }
    .charts-grid { grid-template-columns: 1fr; }
    .metric-value { font-size: 1.4rem; }
}

/* ============ Phase 7: 患者关系管理 ============ */
.patients-layout {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--bg-page, #f5f0e6);
}
.patients-main {
    flex: 1;
    padding: 20px;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}

/* 搜索筛选栏 */
.patients-toolbar {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
    align-items: center;
}
.search-input {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 0.95rem;
}
.tag-filter {
    padding: 10px 14px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 0.95rem;
    background: #fff;
}
.followup-filter {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.9rem;
    color: var(--text-muted, #666);
    cursor: pointer;
}

/* 患者列表 */
.patients-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 16px;
}
.patient-card {
    background: #fff;
    border-radius: 12px;
    padding: 18px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    cursor: pointer;
    transition: all 0.2s;
    border-left: 4px solid var(--primary-color, #2d5016);
}
.patient-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}
.patient-header {
    display: flex;
    align-items: baseline;
    gap: 10px;
    margin-bottom: 8px;
}
.patient-name {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--primary-color, #2d5016);
    font-family: var(--font-serif, 'Noto Serif SC', serif);
}
.patient-info {
    font-size: 0.85rem;
    color: var(--text-muted, #888);
}
.patient-contact {
    font-size: 0.9rem;
    color: var(--text-secondary, #555);
    margin-bottom: 8px;
}
.patient-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 8px;
}
.tag {
    display: inline-block;
    padding: 2px 8px;
    background: var(--primary-color, #2d5016);
    color: #fff;
    border-radius: 12px;
    font-size: 0.75rem;
}
.patient-stats {
    display: flex;
    gap: 12px;
    font-size: 0.85rem;
    color: var(--text-muted, #888);
    margin-bottom: 6px;
}
.patient-followup {
    font-size: 0.85rem;
    color: var(--text-muted, #888);
}
.patient-followup.due {
    color: var(--accent-color, #c9302c);
    font-weight: 600;
}

/* 弹窗 */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}
.modal-content {
    background: #fff;
    border-radius: 12px;
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
.patient-modal {
    max-width: 700px;
}
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid #eee;
    font-size: 1.1rem;
    font-weight: 600;
    font-family: var(--font-serif, 'Noto Serif SC', serif);
}
.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #999;
}
.modal-body {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
}
.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 16px 20px;
    border-top: 1px solid #eee;
}

/* 表单 */
.form-section {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}
.form-row {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.form-row label {
    font-size: 0.85rem;
    color: var(--text-secondary, #555);
}
.form-row input, .form-row select, .form-row textarea {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 0.95rem;
}
.form-row textarea {
    resize: vertical;
}

/* 就诊历史 */
.visits-section h3, .followups-section h3 {
    font-size: 1rem;
    margin-bottom: 12px;
    color: var(--primary-color, #2d5016);
    font-family: var(--font-serif, 'Noto Serif SC', serif);
}
.visits-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 20px;
}
.visit-item {
    padding: 10px;
    background: #f9f9f9;
    border-radius: 6px;
    font-size: 0.9rem;
}
.visit-date {
    color: var(--text-muted, #888);
    font-size: 0.8rem;
}
.visit-disease {
    font-weight: 600;
    color: var(--primary-color, #2d5016);
}
.visit-complaint {
    color: var(--text-secondary, #666);
    margin-top: 4px;
}

/* 随访时间线 */
.followups-timeline {
    margin-bottom: 16px;
}
.followup-item {
    padding: 10px;
    border-left: 3px solid var(--primary-color, #2d5016);
    margin-bottom: 8px;
    background: #f9f9f9;
}
.followup-date {
    font-size: 0.8rem;
    color: var(--text-muted, #888);
}
.followup-note {
    margin-top: 4px;
    color: var(--text-primary, #333);
}
.followup-form {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.followup-actions {
    display: flex;
    gap: 8px;
}
.followup-actions input {
    flex: 1;
}

.empty-hint-small {
    font-size: 0.85rem;
    color: var(--text-muted, #aaa);
    text-align: center;
    padding: 12px;
}

/* 响应式 */
@media (max-width: 768px) {
    .patients-list { grid-template-columns: 1fr; }
    .form-section { grid-template-columns: 1fr; }
    .patients-toolbar { flex-direction: column; align-items: stretch; }
}

/* ============ Phase 8: 打印与导出增强 ============ */

/* 看板顶栏操作按钮 */
.topbar-btn {
    font-family: inherit;
    font-size: 0.78rem;
    padding: 4px 12px;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.45);
    background: rgba(255, 255, 255, 0.14);
    color: #fff;
    cursor: pointer;
    transition: background 0.2s ease;
    white-space: nowrap;
}
.topbar-btn:hover { background: rgba(255, 255, 255, 0.28); }

/* 诊所信息表单：地址占整行 */
.clinic-form-full { grid-column: 1 / -1; }

/* 就诊历史里的打印按钮 */
.visit-print {
    margin-top: 6px;
    font-family: inherit;
    font-size: 0.78rem;
    padding: 3px 10px;
    border-radius: 6px;
    border: 1px solid var(--border-strong, #cbd5e0);
    background: #fff;
    color: var(--primary-color, #2d5016);
    cursor: pointer;
}
.visit-print:hover { border-color: var(--primary-color, #2d5016); background: var(--primary-soft, #e6f2ea); }

/* 看板轻提示 */
.dash-toast {
    position: fixed;
    left: 50%;
    bottom: 36px;
    transform: translateX(-50%);
    background: rgba(44, 95, 45, 0.95);
    color: #fff;
    font-size: 0.88rem;
    padding: 9px 20px;
    border-radius: 8px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.18);
    z-index: 3000;
    animation: fadeIn 0.2s ease;
}
.dash-toast.error { background: rgba(197, 48, 48, 0.95); }

/* ============ Phase 9: 药材库存管理 ============ */

/* 价格页：低库存汇总条 */
.low-stock-banner {
    margin-bottom: 12px;
    padding: 10px 14px;
    border: 1px solid rgba(192, 57, 43, 0.35);
    border-left: 4px solid var(--accent-color, #c0392b);
    border-radius: 8px;
    background: var(--accent-soft, #fbe9e7);
    color: #7a231a;
    font-size: 0.88rem;
    line-height: 1.6;
}

/* 价格表：库存单元格 */
.stock-low { color: var(--error-color, #c53030); font-weight: 700; }
.stock-none { color: var(--text-muted, #718096); font-size: 0.82rem; }

/* 流水弹窗 */
.flow-table { margin-top: 4px; }
.flow-loading { padding: 24px 0; text-align: center; color: var(--text-muted, #718096); font-size: 0.9rem; }
.flow-in { color: var(--success-color, #2f855a); font-weight: 600; }
.flow-out { color: var(--error-color, #c53030); font-weight: 600; }

/* 看板：库存预警卡片 */
.metric-stock .metric-value { font-size: 2rem; }
.metric-stock.has-warn { border-color: rgba(192, 57, 43, 0.4); }
.metric-stock.has-warn .metric-value { color: var(--error-color, #c53030); }
.metric-stock-list { margin-top: 8px; font-size: 0.8rem; color: var(--text-secondary, #4a5568); }
.stock-line {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    padding: 2px 0;
    border-bottom: 1px dashed var(--border-color, #e2e8f0);
}
.stock-line:last-child { border-bottom: none; }
.stock-line.more { color: var(--text-muted, #718096); }
.stock-neg { color: var(--error-color, #c53030); font-weight: 700; }

/* ============ Phase 11: 预约挂号 ============ */

.appt-main {
    max-width: 1400px;
    margin: 0 auto;
    padding: 24px 20px 60px;
}

/* 日历 + 时段并列 */
.appt-grid-area {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 20px;
    margin-bottom: 24px;
}

/* 左侧日历 */
.appt-calendar {
    background: var(--card-bg);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    padding: 16px;
    border-top: 3px solid var(--primary-color);
    height: fit-content;
}
.cal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}
.cal-title {
    font-family: var(--font-serif);
    font-size: 1rem;
    font-weight: 600;
    color: var(--primary-color);
}
.cal-nav {
    width: 28px; height: 28px;
    border-radius: 50%;
    border: 1px solid var(--border-color);
    background: transparent;
    cursor: pointer;
    font-size: 1rem;
    color: var(--text-secondary);
}
.cal-nav:hover { background: var(--primary-soft); color: var(--primary-color); }
.cal-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 0;
    margin-bottom: 4px;
    font-size: 0.72rem;
    color: var(--text-muted);
    text-align: center;
}
.cal-days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
}
.cal-day {
    aspect-ratio: 1;
    display: flex; align-items: center; justify-content: center;
    font-size: 0.8rem;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.15s ease;
}
.cal-day:hover:not(.ghost) { background: var(--primary-soft); }
.cal-day.ghost { color: var(--border-strong); cursor: default; }
.cal-day.today { font-weight: 700; color: var(--primary-color); }
.cal-day.selected { background: var(--primary-color); color: #fff; font-weight: 600; }

/* 右侧时段网格 */
.appt-slots {
    background: var(--card-bg);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    padding: 16px 20px;
    border-top: 3px solid var(--primary-color);
}
.slots-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 14px;
}
.slots-date { font-weight: 700; color: var(--primary-color); font-family: var(--font-serif); }
.slots-tip { font-size: 0.78rem; color: var(--text-muted); }
.slots-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 10px;
}
.slots-loading { padding: 20px; text-align: center; color: var(--text-muted); font-size: 0.85rem; }

.slot {
    padding: 12px 10px;
    border-radius: 8px;
    border: 1.5px solid var(--border-color);
    text-align: center;
    cursor: pointer;
    transition: all 0.15s ease;
    background: #fff;
}
.slot-time { font-size: 0.92rem; font-weight: 600; color: var(--primary-color); margin-bottom: 4px; }
.slot-status { font-size: 0.72rem; color: var(--text-muted); }
.slot.free { border-style: dashed; border-color: var(--primary-light); background: var(--primary-soft); }
.slot.free:hover { border-style: solid; background: #fff; box-shadow: 0 2px 8px rgba(44, 95, 45, 0.12); }
.slot.booked { background: #fff4e6; border-color: var(--warning-color); cursor: default; }
.slot.checked { background: var(--primary-soft); border-color: var(--primary-color); cursor: default; }
.slot.completed { background: #f0f0f0; border-color: var(--border-color); cursor: default; opacity: 0.7; }
.slot.cancelled { background: #f0f0f0; border-color: var(--border-color); cursor: default; opacity: 0.5; }
.slot.past { background: #f7f7f7; border-color: var(--border-color); cursor: not-allowed; opacity: 0.65; }
.slot.past .slot-time { color: var(--text-muted); text-decoration: line-through; }
.slot.past .slot-status { color: var(--text-muted); }

/* 预约列表 */
.appt-list {
    background: var(--card-bg);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    border-top: 3px solid var(--primary-color);
    overflow: hidden;
}
.list-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 16px;
    border-bottom: 1px solid var(--border-color);
    background: var(--surface-muted);
}
.list-tabs { display: flex; gap: 4px; }
.list-tab {
    font-family: inherit;
    font-size: 0.78rem;
    padding: 5px 12px;
    border-radius: var(--radius-pill);
    border: 1px solid transparent;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
}
.list-tab:hover { background: var(--primary-soft); }
.list-tab.active {
    background: var(--primary-color);
    color: #fff;
}
.list-filter input {
    font-family: inherit;
    font-size: 0.82rem;
    padding: 4px 8px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
}
.list-body { padding: 8px 0; }
.list-loading, .list-empty { padding: 30px; text-align: center; color: var(--text-muted); font-size: 0.88rem; }

.appt-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    gap: 16px;
}
.appt-row:last-child { border-bottom: none; }
.appt-row.appt-booked { background: #fffdf7; }
.appt-row.appt-cancelled { opacity: 0.55; }
.row-main { flex: 1; min-width: 0; }
.row-top { display: flex; gap: 10px; align-items: center; margin-bottom: 4px; }
.row-slot { font-weight: 700; color: var(--primary-color); font-size: 0.9rem; }
.row-status {
    font-size: 0.72rem;
    padding: 1px 8px;
    border-radius: var(--radius-pill);
    font-weight: 600;
}
.appt-booked .row-status { background: #fff4e6; color: var(--warning-color); }
.appt-checked_in .row-status { background: var(--primary-soft); color: var(--primary-color); }
.appt-completed .row-status { background: #e2e8f0; color: var(--text-muted); }
.appt-cancelled .row-status { background: #f0f0f0; color: var(--text-muted); }
.row-patient { font-size: 0.85rem; color: var(--text-primary); margin-bottom: 2px; }
.row-reason { font-size: 0.78rem; color: var(--text-secondary); }
.row-actions { display: flex; gap: 6px; flex-shrink: 0; }
.btn-mini.primary { background: var(--primary-color); color: #fff; border-color: var(--primary-color); }
.btn-mini.primary:hover { background: var(--primary-light); }

/* 弹窗详情 */
.detail-row {
    display: flex;
    padding: 6px 0;
    border-bottom: 1px dashed var(--border-color);
    font-size: 0.85rem;
}
.detail-row:last-child { border-bottom: none; }
.detail-label { width: 88px; flex-shrink: 0; color: var(--text-muted); }
.detail-value { flex: 1; color: var(--text-primary); }
.book-slot-info {
    padding: 8px 14px;
    background: var(--primary-soft);
    border-left: 3px solid var(--primary-color);
    border-radius: 6px;
    font-size: 0.85rem;
    color: var(--primary-color);
    margin-bottom: 14px;
    font-weight: 600;
}

/* 响应式 */
@media (max-width: 900px) {
    .appt-grid-area { grid-template-columns: 1fr; }
}

/* ============ Phase 12: 系统设置 ============ */
.settings-main {
    max-width: 860px;
    margin: 0 auto;
    padding: 28px 20px 60px;
}
.settings-section {
    background: var(--card-bg);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    border-top: 3px solid var(--primary-color);
    padding: 20px 24px;
    margin-bottom: 24px;
}
.section-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 16px;
}
.section-head h2 {
    font-family: var(--font-serif);
    font-size: 1.05rem;
    color: var(--primary-color);
    margin: 0;
}
.section-sub { font-size: 0.78rem; color: var(--text-muted); }

.settings-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 14px;
}
.setting-row {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.setting-row label {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-secondary);
}
.setting-row select,
.setting-row input[type="text"],
.setting-row input[type="password"] {
    font-family: inherit;
    font-size: 0.88rem;
    padding: 8px 10px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: #fff;
    transition: border-color .15s;
}
.setting-row select:focus,
.setting-row input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(44, 95, 45, 0.08);
}
.setting-hint {
    font-size: 0.72rem;
    color: var(--text-muted);
}
.key-input-wrap {
    display: flex;
    gap: 6px;
}
.key-input-wrap input { flex: 1; }
.key-toggle {
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 0 10px;
    cursor: pointer;
}
.tag-ok { background: var(--primary-soft); color: var(--primary-color); padding: 1px 6px; border-radius: 3px; font-size: 0.7rem; font-weight: 600; }
.tag-warn { background: #fff4e6; color: var(--warning-color); padding: 1px 6px; border-radius: 3px; font-size: 0.7rem; font-weight: 600; }

.settings-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 18px;
}
.btn.small { font-size: 0.78rem; padding: 4px 10px; }

.test-result {
    margin-top: 14px;
    padding: 12px 14px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: var(--surface-muted);
    font-size: 0.84rem;
}
.test-result.hidden { display: none; }
.test-result.ok { border-color: var(--primary-color); background: var(--primary-soft); }
.test-result.err { border-color: var(--error-color, #c53030); background: #fff0f0; }
.test-head { font-weight: 700; margin-bottom: 4px; }
.test-body .usage { font-size: 0.72rem; color: var(--text-muted); margin-top: 4px; }

.settings-note {
    margin-top: 14px;
    padding: 10px 14px;
    border-left: 3px solid var(--warning-color, #d4a017);
    background: #fffbe6;
    font-size: 0.78rem;
    color: var(--text-secondary);
    border-radius: 4px;
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 10px;
}
.info-cell {
    display: flex;
    flex-direction: column;
    padding: 8px 12px;
    background: var(--surface-muted);
    border-radius: 6px;
    font-size: 0.8rem;
}
.info-key { color: var(--text-muted); font-size: 0.72rem; }
.info-val { color: var(--text-primary); font-weight: 500; word-break: break-all; }
.info-val.mono { font-family: Consolas, Menlo, monospace; font-size: 0.76rem; color: var(--text-secondary); }

/* 导出卡片 */
.export-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 14px;
    margin-bottom: 10px;
}
.export-card {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 16px 18px;
    border: 1.5px solid var(--border-color);
    border-radius: 10px;
    background: #fff;
    text-decoration: none;
    color: inherit;
    transition: all .15s ease;
    cursor: pointer;
}
.export-card:hover {
    border-color: var(--primary-color);
    box-shadow: 0 4px 14px rgba(44, 95, 45, 0.12);
    transform: translateY(-2px);
}
.export-icon { font-size: 1.5rem; }
.export-title { font-weight: 700; font-size: 0.95rem; color: var(--primary-color); font-family: var(--font-serif); }
.export-desc { font-size: 0.78rem; color: var(--text-muted); line-height: 1.4; }
.export-action { font-size: 0.76rem; color: var(--primary-color); font-weight: 600; margin-top: 4px; }

/* toast */
.toast-box {
    position: fixed;
    top: 16px; right: 20px;
    padding: 10px 16px;
    border-radius: 6px;
    background: var(--text-primary, #333);
    color: #fff;
    font-size: 0.84rem;
    z-index: 9999;
    opacity: 0; transform: translateY(-6px);
    transition: all .2s ease;
    pointer-events: none;
}
.toast-box.show { opacity: 1; transform: translateY(0); }
.toast-box.ok { background: var(--primary-color); }
.toast-box.err { background: var(--error-color, #c53030); }

/* ============ Phase 10: 登录认证与权限 ============ */

/* -------- 登录页 -------- */
body.login-body {
    height: 100vh;
    overflow: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    background:
        radial-gradient(circle at 18% 22%, rgba(44, 95, 45, 0.09), transparent 45%),
        radial-gradient(circle at 82% 78%, rgba(139, 69, 19, 0.08), transparent 45%),
        var(--bg-color);
}

.login-wrap {
    width: 100%;
    max-width: 400px;
    padding: 24px;
}

.login-card {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 36px 32px 24px;
    border-top: 4px solid var(--primary-color);
}

.login-head {
    text-align: center;
    margin-bottom: 26px;
}

.login-logo {
    font-size: 2.2rem;
    line-height: 1;
    margin-bottom: 10px;
}

.login-head h1 {
    font-family: var(--font-serif);
    font-size: 1.5rem;
    color: var(--primary-color);
    letter-spacing: 2px;
    margin-bottom: 4px;
}

.login-head p {
    font-size: 0.82rem;
    color: var(--text-muted);
    letter-spacing: 1px;
}

.login-field {
    margin-bottom: 16px;
}

.login-field label {
    display: block;
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.login-field input {
    width: 100%;
    padding: 11px 14px;
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    font-family: inherit;
    background: var(--surface-muted);
    transition: all 0.2s ease;
}

.login-field input:focus {
    outline: none;
    border-color: var(--primary-color);
    background: #fff;
    box-shadow: 0 0 0 3px rgba(44, 95, 45, 0.1);
}

.login-error {
    background: var(--error-soft);
    color: var(--error-color);
    border-left: 3px solid var(--error-color);
    border-radius: 6px;
    padding: 8px 12px;
    font-size: 0.84rem;
    margin-bottom: 14px;
}

.login-btn {
    width: 100%;
    padding: 12px;
    border: none;
    border-radius: var(--radius-sm);
    background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
    color: #fff;
    font-size: 1rem;
    font-family: inherit;
    letter-spacing: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: var(--shadow-sm);
}

.login-btn:hover:not(:disabled) { transform: translateY(-1px); box-shadow: var(--shadow-md); }
.login-btn:disabled { opacity: 0.65; cursor: not-allowed; }

.login-foot {
    margin-top: 20px;
    padding-top: 14px;
    border-top: 1px dashed var(--border-color);
    text-align: center;
    font-size: 0.74rem;
    color: var(--text-muted);
    line-height: 1.6;
}

/* -------- 顶栏用户区 -------- */
.topbar-user {
    font-size: 0.78rem;
    color: rgba(255, 255, 255, 0.92);
    padding: 4px 10px;
    border-radius: var(--radius-pill);
    background: rgba(255, 255, 255, 0.16);
    white-space: nowrap;
}

.topbar-logout {
    font-family: inherit;
    font-size: 0.78rem;
    padding: 4px 12px;
    border-radius: var(--radius-pill);
    border: 1px solid rgba(255, 255, 255, 0.4);
    background: transparent;
    color: #fff;
    cursor: pointer;
    transition: background 0.2s ease;
}

.topbar-logout:hover { background: rgba(255, 255, 255, 0.22); }

/* -------- 用户管理页 -------- */
.users-main {
    max-width: 1100px;
    margin: 0 auto;
    padding: 24px 20px 60px;
}

.users-hint {
    background: var(--primary-soft);
    border-left: 3px solid var(--primary-color);
    border-radius: 8px;
    padding: 10px 14px;
    font-size: 0.82rem;
    color: var(--text-secondary);
    margin-bottom: 16px;
    line-height: 1.7;
}

.role-badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: var(--radius-pill);
    font-size: 0.76rem;
    font-weight: 600;
}

.role-admin { background: var(--accent-soft); color: var(--accent-color); }
.role-doctor { background: var(--primary-soft); color: var(--primary-color); }
.role-staff { background: #eef2f7; color: var(--text-secondary); }

.user-on { color: var(--success-color); font-weight: 600; font-size: 0.82rem; }
.user-off { color: var(--text-muted); font-weight: 600; font-size: 0.82rem; }

/* ===== 营销中心（Phase 13） ===== */
.poster-workbench {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 420px;
    gap: var(--space-6);
    align-items: start;
}
.poster-form {
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: var(--space-6);
    box-shadow: 0 1px 3px rgba(0, 0, 0, .04), 0 8px 24px rgba(0, 0, 0, .06);
}
.template-picker {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-2);
}
.template-card {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
    padding: 8px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: #fff;
    cursor: pointer;
    font-family: inherit;
    transition: border-color .15s ease, transform .15s ease;
}
.template-card:hover { border-color: var(--primary-color); transform: translateY(-1px); }
.template-card.active { border-color: var(--accent-color); box-shadow: 0 0 0 3px var(--accent-soft); }
.template-swatch {
    display: block;
    height: 46px;
    border-radius: 6px;
    border: 1px solid rgba(0, 0, 0, .06);
    background: var(--t-bg);
}
.template-label { font-size: 0.82rem; color: var(--text-primary); text-align: center; font-weight: 600; }
.template-desc { font-size: 0.7rem; color: var(--text-muted); text-align: center; line-height: 1.3; }
.poster-preview {
    position: sticky;
    top: var(--space-4);
    background: var(--surface-muted);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: var(--space-4);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-3);
}
.poster-canvas {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, .18);
}
.poster-img {
    width: 100%;
    border-radius: var(--radius-sm);
    box-shadow: 0 8px 24px rgba(0, 0, 0, .12);
    display: block;
}
.poster-preview-actions { display: flex; gap: var(--space-2); }
.poster-empty {
    color: var(--text-muted);
    font-size: 0.9rem;
    text-align: center;
    padding: var(--space-8) var(--space-4);
}
.poster-hint { color: var(--text-muted); font-size: 0.85rem; }
.poster-history {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: var(--space-4);
}
.poster-history-card {
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .04);
}
.poster-history-card img { width: 100%; display: block; }
.poster-history-meta { padding: var(--space-3); }
.poster-history-title { font-weight: 600; color: var(--text-primary); font-size: 0.92rem; }
.poster-history-sub { color: var(--text-muted); font-size: 0.76rem; margin: 4px 0 10px; }
.poster-history-actions { display: flex; gap: var(--space-2); }
.cell-ellipsis {
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.status-on { color: var(--success-color); font-weight: 600; font-size: 0.82rem; }
.status-off { color: var(--text-muted); font-weight: 600; font-size: 0.82rem; }
.checkbox-label { display: flex; align-items: center; gap: 8px; font-size: 0.92rem; color: var(--text-primary); }
.checkbox-label input { width: auto; }

@media (max-width: 900px) {
    .poster-workbench { grid-template-columns: 1fr; }
    .poster-preview { position: static; }
}

/* ===== 舌诊 / 面诊图像识别（Phase 15） ===== */
.vision-panel {
    margin-top: var(--space-4);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--surface-muted);
    overflow: hidden;
}
.vision-panel > summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    padding: 12px 16px;
    cursor: pointer;
    list-style: none;
    font-weight: 600;
    font-size: 0.92rem;
    color: var(--text-primary);
    user-select: none;
}
.vision-panel > summary::-webkit-details-marker { display: none; }
.vision-panel > summary::after {
    content: '▾';
    order: 3;
    color: var(--text-muted);
    transition: transform .2s ease;
}
.vision-panel[open] > summary::after { transform: rotate(180deg); }
.vision-panel[open] > summary { border-bottom: 1px dashed var(--border-color); }
.vision-summary-title { flex: 1; }
.vision-badge {
    font-size: 0.72rem;
    font-weight: 500;
    padding: 2px 9px;
    border-radius: var(--radius-pill);
    background: #eef2f7;
    color: var(--text-secondary);
    white-space: nowrap;
}
.vision-badge.ai { background: var(--primary-soft); color: var(--primary-color); }
.vision-badge.local { background: #fff4e0; color: #a86b00; }

/* hidden 属性需压过组件自身的 display，否则预览/结果区空态会露出 */
.vision-panel [hidden] { display: none !important; }

.vision-body { padding: 16px; display: flex; flex-direction: column; gap: 12px; }

.vision-kind-switch { display: flex; gap: 8px; }
.vision-kind {
    flex: 1;
    padding: 8px;
    font-family: inherit;
    font-size: 0.86rem;
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: #fff;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all .15s ease;
}
.vision-kind:hover { border-color: var(--primary-color); }
.vision-kind.active {
    border-color: var(--primary-color);
    background: var(--primary-soft);
    color: var(--primary-color);
    font-weight: 600;
}

.vision-slots {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}
.vision-slots.single { grid-template-columns: minmax(0, 1fr); }
.vision-slot-wrap[hidden] { display: none !important; }
.vision-slot-label {
    font-size: 0.76rem;
    color: var(--text-secondary);
    font-weight: 600;
    margin-bottom: 6px;
    padding-left: 2px;
}
.vision-slot {
    position: relative;
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-md);
    background: #fff;
    min-height: 168px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    overflow: hidden;
    transition: border-color .15s ease, background .15s ease;
}
.vision-slot:hover,
.vision-slot.dragging { border-color: var(--primary-color); background: var(--primary-soft); }
.vision-slot.has-image { border-style: solid; background: #f7f9f7; cursor: default; }
.vision-slot-empty { text-align: center; color: var(--text-muted); font-size: 0.86rem; padding: 12px; line-height: 1.7; }
.vision-empty-icon { font-size: 1.8rem; margin-bottom: 4px; }
.vision-slot-empty small { display: block; font-size: 0.74rem; color: var(--text-muted); opacity: .85; margin-top: 4px; }
.vision-preview {
    max-width: 100%;
    max-height: 240px;
    object-fit: contain;
    display: block;
    border-radius: var(--radius-sm);
}
.vision-slot.has-image .vision-preview { max-height: 260px; }
.vision-slot-remove {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 24px;
    height: 24px;
    line-height: 1;
    border: none;
    border-radius: 50%;
    background: rgba(26, 32, 44, .72);
    color: #fff;
    font-size: 15px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
}
.vision-slot-remove:hover { background: var(--error-color); }
.vision-slot-remove[hidden] { display: none !important; }

.vision-tip {
    font-size: 0.76rem;
    color: var(--text-muted);
    margin-top: 8px;
    line-height: 1.6;
}

@media (max-width: 640px) {
    .vision-slots { grid-template-columns: minmax(0, 1fr); }
}

.vision-actions { display: flex; gap: 8px; justify-content: flex-end; }
.vision-actions .btn { padding: 8px 16px; font-size: 0.88rem; }

.vision-result {
    border-top: 1px dashed var(--border-color);
    padding-top: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.vision-result-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.vision-mode-tag {
    font-size: 0.72rem;
    font-weight: 600;
    padding: 2px 9px;
    border-radius: var(--radius-pill);
}
.vision-mode-tag.ai { background: var(--primary-color); color: #fff; }
.vision-mode-tag.local { background: #fff4e0; color: #a86b00; border: 1px solid #f0d39a; }
.vision-model { font-size: 0.72rem; color: var(--text-muted); word-break: break-all; }
.vision-quality { font-size: 0.74rem; color: var(--text-muted); margin-left: auto; }
.vision-summary {
    font-size: 0.88rem;
    color: var(--text-primary);
    line-height: 1.75;
    background: #fff;
    border-left: 3px solid var(--primary-color);
    border-radius: 6px;
    padding: 8px 12px;
}

.vision-fields { display: flex; flex-direction: column; gap: 6px; }
.vision-field {
    display: grid;
    grid-template-columns: auto 74px minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 0.86rem;
    cursor: pointer;
    transition: border-color .15s ease;
}
.vision-field:hover { border-color: var(--primary-color); }
.vision-field input { width: auto; accent-color: var(--primary-color); }
.vf-label { color: var(--text-muted); font-size: 0.8rem; }
.vf-value { color: var(--text-primary); font-weight: 600; }
.vf-note { color: var(--text-muted); font-size: 0.74rem; text-align: right; }

.vision-hints { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.vh-title { font-size: 0.78rem; color: var(--text-muted); }
.vh-item {
    font-size: 0.78rem;
    padding: 2px 10px;
    border-radius: var(--radius-pill);
    background: var(--accent-soft);
    color: var(--accent-color);
}

.vision-fallback {
    font-size: 0.76rem;
    color: #a86b00;
    background: #fff9ec;
    border-radius: 6px;
    padding: 6px 10px;
    line-height: 1.6;
}
.vision-disclaimer {
    font-size: 0.75rem;
    color: var(--text-muted);
    line-height: 1.7;
    background: #f5f7fa;
    border-radius: 6px;
    padding: 8px 10px;
}
.vision-result-actions { display: flex; justify-content: flex-end; }
.vision-result-actions .btn { padding: 8px 18px; font-size: 0.88rem; }
.vision-msg {
    font-size: 0.86rem;
    padding: 10px 12px;
    border-radius: 8px;
    background: var(--surface-muted);
    color: var(--text-secondary);
    line-height: 1.7;
}
.vision-msg.error { background: var(--error-soft); color: var(--error-color); }
.vision-msg.warn { background: #fff9ec; color: #a86b00; }
.vision-loading {
    font-size: 0.86rem;
    color: var(--text-muted);
    padding: 12px;
    text-align: center;
}

@media (max-width: 640px) {
    .vision-field { grid-template-columns: auto 60px minmax(0, 1fr); }
    .vf-note { display: none; }
}


/* ===== AI 问诊助手（Phase 16） ===== */

.btn-outline-green {
    background: #fff;
    color: var(--wb-btn);
    border: 1px solid var(--wb-btn);
    /* 与 .btn-green（8px 20px、无边框）等高：边框占 2px，内边距各减 1px */
    padding: 7px 19px;
    font-size: 1rem;
    border-radius: var(--radius-sm);
}
.btn-outline-green:hover { background: var(--primary-soft); }
.btn-outline-green.active { background: var(--primary-soft); box-shadow: 0 0 0 3px rgba(44, 95, 45, .12); }

.asst-overlay {
    position: fixed;
    inset: 0;
    background: rgba(26, 32, 44, .18);
    opacity: 0;
    transition: opacity .2s ease;
    z-index: 300;
}
.asst-overlay.show { opacity: 1; }

.asst-drawer {
    position: fixed;
    top: 0;
    right: 0;
    width: 390px;
    max-width: 92vw;
    height: 100vh;
    /* 手机浏览器地址栏/系统手势条会吃掉 100vh 的底部，用动态视口高度避免底部被遮挡 */
    height: 100dvh;
    max-height: 100dvh;
    background: #fff;
    border-left: 1px solid var(--border-color);
    box-shadow: -8px 0 32px rgba(0, 0, 0, .10);
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform .24s ease;
    z-index: 310;
}
.asst-drawer.show { transform: translateX(0); }
.asst-drawer[hidden] { display: none !important; }

.asst-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
    padding: 16px 18px 12px;
    border-bottom: 1px solid var(--border-color);
    background: var(--surface-muted);
}
.asst-title { font-family: var(--font-serif); font-size: 1.05rem; font-weight: 700; color: var(--primary-dark); }
.asst-sub { font-size: 0.74rem; color: var(--text-muted); margin-top: 3px; }
.asst-sub.warn { color: var(--warning-color); }
.asst-close {
    border: none;
    background: transparent;
    font-size: 20px;
    line-height: 1;
    color: var(--text-muted);
    cursor: pointer;
    padding: 2px 4px;
    border-radius: 6px;
}
.asst-close:hover { background: #eef1ee; color: var(--text-primary); }

.asst-body {
    flex: 1;
    overflow-y: auto;
    padding: 14px 16px 8px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: var(--bg-color);
}
.asst-intro {
    font-size: 0.78rem;
    line-height: 1.75;
    color: var(--text-secondary);
    background: #fff;
    border: 1px dashed var(--border-strong);
    border-radius: var(--radius-sm);
    padding: 10px 12px;
}
.asst-quick { display: flex; flex-wrap: wrap; gap: 6px; }
.asst-quick-btn {
    font-size: 0.74rem;
    padding: 4px 10px;
    border-radius: var(--radius-pill);
    border: 1px solid var(--border-strong);
    background: #fff;
    color: var(--text-secondary);
    cursor: pointer;
}
.asst-quick-btn:hover { border-color: var(--primary-color); color: var(--primary-color); }

.asst-msg {
    max-width: 88%;
    padding: 9px 12px;
    border-radius: var(--radius-md);
    font-size: 0.84rem;
    line-height: 1.7;
    word-break: break-word;
}
.asst-msg.me {
    align-self: flex-end;
    background: var(--primary-color);
    color: #fff;
    border-bottom-right-radius: 4px;
}
.asst-msg.ai {
    align-self: flex-start;
    background: #fff;
    border: 1px solid var(--border-color);
    border-bottom-left-radius: 4px;
    box-shadow: var(--shadow-sm);
}
.asst-text { white-space: pre-wrap; }

.asst-tags { margin-top: 8px; display: flex; flex-wrap: wrap; gap: 5px; align-items: center; }
.asst-tags-title { font-size: 0.72rem; color: var(--text-muted); width: 100%; }
.asst-tag {
    font-size: 0.72rem;
    padding: 2px 8px;
    border-radius: var(--radius-pill);
    background: var(--primary-soft);
    color: var(--primary-dark);
    border: 1px solid #cfe0d2;
}
.asst-note { margin-top: 6px; font-size: 0.74rem; color: var(--text-muted); line-height: 1.65; }
.asst-err { color: var(--error-color); font-size: 0.82rem; }

.asst-undo {
    margin-top: 8px;
    font-size: 0.74rem;
    padding: 3px 10px;
    border-radius: var(--radius-pill);
    border: 1px solid var(--border-strong);
    background: #fff;
    color: var(--text-secondary);
    cursor: pointer;
}
.asst-undo:hover:not(:disabled) { border-color: var(--error-color); color: var(--error-color); }
.asst-undo:disabled { opacity: .6; cursor: default; }

.asst-typing { display: inline-flex; gap: 4px; padding: 3px 0; }
.asst-typing i {
    width: 6px; height: 6px; border-radius: 50%;
    background: var(--text-muted);
    animation: asstBlink 1.2s infinite ease-in-out;
}
.asst-typing i:nth-child(2) { animation-delay: .18s; }
.asst-typing i:nth-child(3) { animation-delay: .36s; }
@keyframes asstBlink {
    0%, 80%, 100% { opacity: .25; transform: translateY(0); }
    40% { opacity: 1; transform: translateY(-3px); }
}

.asst-foot {
    display: flex;
    gap: 8px;
    align-items: flex-end;
    padding: 12px 16px 16px;
    border-top: 1px solid var(--border-color);
    background: #fff;
}
.asst-foot textarea {
    flex: 1;
    resize: none;
    min-height: 46px;
    max-height: 120px;
    padding: 9px 12px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 0.84rem;
    line-height: 1.6;
}
.asst-foot textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(44, 95, 45, .1);
}
.asst-foot .btn { padding: 9px 16px; font-size: 0.85rem; }

/* AI 新勾选的标签高亮一下，提醒医生复核 */
.chip.chip-flash { animation: chipFlash .9s ease; }
@keyframes chipFlash {
    0% { box-shadow: 0 0 0 0 rgba(44, 95, 45, .55); }
    60% { box-shadow: 0 0 0 6px rgba(44, 95, 45, 0); }
    100% { box-shadow: 0 0 0 0 rgba(44, 95, 45, 0); }
}

@media (max-width: 520px) {
    .asst-drawer { width: 100vw; }
}

/* ===========================================
   手机浏览器适配（诊疗工作台）
   920px 断点用 flex-wrap 平铺模块导航，在手机上会让
   三个网格容器并排并被拉伸成巨型方块、顶栏标题换行、
   退出按钮被压成竖排。这里在手机宽度下收敛为紧凑单列。
   =========================================== */
@media (max-width: 768px) {
    /* ---- 顶栏：单行不换行，标题过长省略 ---- */
    .app-topbar {
        height: auto;
        min-height: 44px;
        padding: 6px 10px;
        gap: 8px;
        flex-wrap: nowrap;
    }
    .topbar-title {
        flex: 1 1 auto;
        min-width: 0;
        gap: 4px;
        font-size: 0.8rem;
        letter-spacing: 0;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    .topbar-actions {
        flex: 0 0 auto;
        flex-wrap: nowrap;
        gap: 6px;
    }
    .topbar-link,
    .topbar-user,
    .topbar-logout,
    .topbar-btn,
    .topbar-actions .status-badge {
        white-space: nowrap;
        flex-shrink: 0;
    }
    .topbar-link { font-size: 0.72rem; }
    .topbar-user {
        font-size: 0.7rem;
        padding: 3px 8px;
        max-width: 34vw;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    .topbar-logout { font-size: 0.7rem; padding: 3px 9px; }
    /* 手机上隐藏「系统就绪」徽章，把宽度让给标题 */
    .topbar-actions .status-badge { display: none; }

    /* ---- 左栏：收起品牌区，模块导航回到单列流式 ---- */
    .app-sidebar {
        margin: 8px 8px 0;
        border-radius: 10px;
    }
    .sidebar-brand { display: none; }
    .sidebar-nav {
        display: block;
        flex: none;
        overflow: visible;
        padding: 8px 10px 10px;
    }
    .nav-group { display: block; }
    .nav-group-title {
        margin: 10px 4px 6px;
        font-size: 0.68rem;
        letter-spacing: 1px;
    }
    .nav-group:first-child .nav-group-title { margin-top: 2px; }
    #navChiefItems,
    #navBodyItems,
    #navExamItems {
        grid-template-columns: repeat(auto-fill, minmax(84px, 1fr));
        gap: 6px;
        padding: 0;
    }
    .nav-item {
        width: 100%;
        min-height: 34px;
        padding: 7px 4px;
        font-size: 0.76rem;
    }

    /* ---- 中栏与右侧面板 ---- */
    .app-main { padding: 10px 8px 0; }
    .app-patientpanel { padding: 0 8px 10px; }

    /* ---- 已选症状：标签独占一行，提示语不再被挤成多行 ---- */
    .selected-overview {
        flex-direction: column;
        align-items: stretch;
        gap: 6px;
        padding: 10px 12px;
    }
    .selected-overview .selected-label,
    .selected-overview .empty-hint { padding: 0; }
    .selected-overview .empty-hint { font-size: 0.8rem; line-height: 1.5; }

    /* ---- 搜索行：提示语让位，两个按钮各占一半且不换行 ---- */
    .search-row { padding: 10px 12px; gap: 8px; }
    .search-fields { gap: 8px; }
    .search-actions { gap: 8px; }
    .search-tip { display: none; }
    .search-btn-group { width: 100%; }
    .search-btn-group .btn {
        flex: 1 1 0;
        min-width: 0;
        padding: 8px;
        font-size: 0.88rem;
        white-space: nowrap;
        gap: 4px;
    }
    .search-btn-group .btn-icon { font-size: 1.05rem; }

    /* ---- 结果区：内边距收紧，操作按钮两列换行 ---- */
    .result-section {
        padding: 1rem;
        border-radius: 12px;
    }
    .header-actions {
        flex-wrap: wrap;
        gap: 8px;
    }
    .header-actions .btn {
        flex: 1 1 calc(50% - 8px);
        min-width: 0;
        padding: 8px;
        font-size: 0.85rem;
        white-space: nowrap;
        gap: 4px;
    }
    .result-tabs { margin-bottom: 1rem; }

    /* ---- AI 助手抽屉：铺满屏幕，底部输入框不再被 .btn{width:100%} 挤成一条 ---- */
    .asst-drawer { width: 100vw; max-width: 100vw; }
    .asst-foot {
        padding: 10px 12px calc(12px + env(safe-area-inset-bottom, 0px));
    }
    .asst-foot textarea {
        flex: 1 1 auto;
        min-width: 0;
        font-size: 16px;   /* 低于 16px 时 iOS 聚焦会自动放大页面 */
    }
    .asst-foot .btn {
        width: auto;
        flex: 0 0 auto;
        padding: 9px 18px;
        white-space: nowrap;
    }

    /* ---- 舌诊/面诊面板：标题不再被长模型名挤成竖条 ---- */
    .vision-panel > summary {
        position: relative;
        display: block;
        padding: 10px 32px 10px 12px;
        line-height: 1.5;
    }
    .vision-summary-title {
        display: block;
        font-size: 0.86rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    .vision-badge {
        display: inline-block;
        margin-top: 4px;
        max-width: 100%;
        overflow: hidden;
        text-overflow: ellipsis;
        vertical-align: middle;
    }
    .vision-panel > summary::after {
        position: absolute;
        right: 12px;
        top: 50%;
        transform: translateY(-50%);
    }
    .vision-panel[open] > summary::after {
        transform: translateY(-50%) rotate(180deg);
    }
    .vision-body { padding: 12px; }
    .vision-slots { grid-template-columns: minmax(0, 1fr); }
    .vision-actions {
        flex-wrap: wrap;
        justify-content: stretch;
    }
    .vision-actions .btn {
        flex: 1 1 0;
        width: auto;
        min-width: 0;
        padding: 9px 10px;
        white-space: nowrap;
    }
}


