/* ===== 全局变量与重置 ===== */
:root {
    /* 科技风格配色 */
    --bg-primary: #0a1628;
    --bg-secondary: #0f1e3a;
    --bg-card: rgba(15, 30, 58, 0.8);
    --bg-card-hover: rgba(22, 42, 77, 0.9);
    --bg-input: rgba(10, 22, 40, 0.9);
    --border-color: rgba(64, 169, 255, 0.15);
    --border-active: rgba(64, 169, 255, 0.5);
    --text-primary: #e8f0ff;
    --text-secondary: #8fa8c8;
    --text-muted: #5a7090;
    --accent-primary: #40a9ff;
    --accent-cyan: #00d4ff;
    --accent-purple: #722ed1;
    --accent-green: #52c41a;
    --accent-orange: #fa8c16;
    --accent-red: #ff4d4f;
    --accent-yellow: #faad14;
    --gradient-primary: linear-gradient(135deg, #40a9ff 0%, #00d4ff 100%);
    --gradient-purple: linear-gradient(135deg, #722ed1 0%, #40a9ff 100%);
    --gradient-success: linear-gradient(135deg, #52c41a 0%, #00d4ff 100%);
    --gradient-danger: linear-gradient(135deg, #ff4d4f 0%, #fa8c16 100%);
    --shadow-glow: 0 0 24px rgba(64, 169, 255, 0.25);
    --shadow-card: 0 4px 20px rgba(0, 0, 0, 0.3);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --header-height: 64px;
    --bottom-nav-height: 60px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
    /* 微信内置浏览器：禁用长按弹出系统菜单（复制/转发/在浏览器打开） */
    -webkit-touch-callout: none;
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
    /* 微信/安卓：禁止文字自动调整大小 */
    text-size-adjust: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Microsoft YaHei', 'Segoe UI', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-y: contain;
    /* 字体抗锯齿：微信内置浏览器渲染更清晰 */
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    /* UI元素禁止选中文字（输入框/textarea单独放开） */
    -webkit-user-select: none;
    user-select: none;
    background-image:
        radial-gradient(circle at 15% 50%, rgba(64, 169, 255, 0.06) 0%, transparent 30%),
        radial-gradient(circle at 85% 30%, rgba(114, 46, 209, 0.05) 0%, transparent 30%);
    background-attachment: fixed;
}

/* 输入框/文本域允许选中（覆盖body的user-select:none） */
input, textarea, select, [contenteditable] {
    -webkit-user-select: text;
    user-select: text;
    -webkit-touch-callout: default;
}

#app {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ===== 顶部导航 ===== */
.app-header {
    position: sticky;
    top: 0;
    z-index: 100;
    /* fallback: 安卓微信X5内核不支持backdrop-filter，用纯色兜底 */
    background: rgba(10, 22, 40, 0.98);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-color);
    /* 刘海屏适配：顶部安全区 */
    padding-top: env(safe-area-inset-top, 0);
}

.header-content {
    max-width: 1400px;
    margin: 0 auto;
    height: var(--header-height);
    padding: 0 20px;
    display: flex;
    align-items: center;
    gap: 24px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    flex-shrink: 0;
}

.logo-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: var(--gradient-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    box-shadow: var(--shadow-glow);
}

.logo-icon svg {
    width: 20px;
    height: 20px;
}

.logo-text {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

.logo-title {
    font-size: 17px;
    font-weight: 700;
    color: var(--text-primary);
}

.logo-sub {
    font-size: 10px;
    color: var(--text-muted);
    letter-spacing: 1px;
}

.header-nav {
    display: flex;
    gap: 4px;
    flex: 1;
    margin-left: 20px;
}

.header-nav a {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
    white-space: nowrap;
}

.header-nav a:hover {
    color: var(--text-primary);
    background: rgba(64, 169, 255, 0.08);
}

.header-nav a.active {
    color: var(--accent-cyan);
    background: rgba(64, 169, 255, 0.12);
}

.header-nav .nav-icon {
    display: flex;
    width: 16px;
    height: 16px;
}

.header-nav .nav-icon svg {
    width: 100%;
    height: 100%;
}

.header-actions {
    display: flex;
    gap: 8px;
    margin-left: auto;
}

.icon-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(64, 169, 255, 0.1);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    transition: all 0.2s;
    -webkit-user-select: none;
    user-select: none;
}

.icon-btn:hover {
    background: rgba(64, 169, 255, 0.2);
    color: var(--accent-cyan);
}

.icon-btn svg {
    width: 18px;
    height: 18px;
}

.ai-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    background: var(--accent-red);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    min-width: 16px;
    height: 16px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
}

/* ===== 主内容区 ===== */
.app-main {
    flex: 1;
    max-width: 1400px;
    width: 100%;
    margin: 0 auto;
    padding: 24px 20px 40px;
}

.app-main.mobile {
    padding: 16px 12px calc(var(--bottom-nav-height) + 20px);
}

.view {
    animation: fadeIn 0.3s ease;
}

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

/* ===== 通用组件 ===== */
.page-title {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.page-subtitle {
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 24px;
}

.card {
    background: #0f1e3a;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 20px;
    margin-bottom: 16px;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    transition: all 0.2s;
}

.card:hover {
    border-color: var(--border-active);
    box-shadow: var(--shadow-card);
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    gap: 12px;
}

.card-title {
    font-size: 16px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.card-actions {
    display: flex;
    gap: 8px;
}

/* 按钮 */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 44px;
    padding: 10px 18px;
    border-radius: var(--radius-sm);
    border: none;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    font-family: inherit;
    -webkit-user-select: none;
    user-select: none;
    touch-action: manipulation;
}

.btn-primary {
    background: var(--gradient-primary);
    color: #fff;
    box-shadow: 0 2px 8px rgba(64, 169, 255, 0.3);
}

.btn-primary:hover {
    box-shadow: 0 4px 16px rgba(64, 169, 255, 0.5);
    transform: translateY(-1px);
}

.btn-secondary {
    background: rgba(64, 169, 255, 0.1);
    color: var(--accent-cyan);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: rgba(64, 169, 255, 0.2);
}

.btn-danger {
    background: rgba(255, 77, 79, 0.15);
    color: var(--accent-red);
    border: 1px solid rgba(255, 77, 79, 0.3);
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

.btn-ghost:hover {
    color: var(--text-primary);
    border-color: var(--border-active);
}

.btn-sm {
    min-height: 36px;
    padding: 6px 12px;
    font-size: 13px;
}

.btn-block {
    width: 100%;
}

.btn svg {
    width: 16px;
    height: 16px;
}

/* 表单 */
.form-group {
    margin-bottom: 16px;
}

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

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

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    min-height: 44px;
    padding: 12px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 15px;
    font-family: inherit;
    transition: all 0.2s;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--border-active);
    box-shadow: 0 0 0 3px rgba(64, 169, 255, 0.1);
}

.form-textarea {
    resize: vertical;
    min-height: 96px;
    padding-top: 12px;
}

.form-select {
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238fa8c8' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 32px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.form-row-3 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 12px;
}

/* 标签 */
.tag {
    display: inline-flex;
    align-items: center;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
}

.tag-primary { background: rgba(64, 169, 255, 0.15); color: var(--accent-primary); }
.tag-success { background: rgba(82, 196, 26, 0.15); color: var(--accent-green); }
.tag-warning { background: rgba(250, 173, 20, 0.15); color: var(--accent-yellow); }
.tag-danger { background: rgba(255, 77, 79, 0.15); color: var(--accent-red); }
.tag-purple { background: rgba(114, 46, 209, 0.15); color: var(--accent-purple); }
.tag-cyan { background: rgba(0, 212, 255, 0.15); color: var(--accent-cyan); }
.tag-orange { background: rgba(250, 140, 22, 0.15); color: var(--accent-orange); }

/* ===== 统计卡片 ===== */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 20px;
    position: relative;
    overflow: hidden;
    transition: all 0.3s;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--gradient-primary);
}

.stat-card.success::before { background: var(--gradient-success); }
.stat-card.danger::before { background: var(--gradient-danger); }
.stat-card.purple::before { background: var(--gradient-purple); }

.stat-card:hover {
    transform: translateY(-2px);
    border-color: var(--border-active);
    box-shadow: var(--shadow-card);
}

.stat-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 12px;
}

.stat-icon svg { width: 22px; height: 22px; }
.stat-icon.blue { background: rgba(64, 169, 255, 0.15); color: var(--accent-primary); }
.stat-icon.green { background: rgba(82, 196, 26, 0.15); color: var(--accent-green); }
.stat-icon.orange { background: rgba(250, 140, 22, 0.15); color: var(--accent-orange); }
.stat-icon.purple { background: rgba(114, 46, 209, 0.15); color: var(--accent-purple); }
.stat-icon.red { background: rgba(255, 77, 79, 0.15); color: var(--accent-red); }

.stat-value {
    font-size: 28px;
    font-weight: 700;
    line-height: 1.2;
}

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

.stat-trend {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    margin-top: 8px;
}

.stat-trend.up { color: var(--accent-green); }
.stat-trend.down { color: var(--accent-red); }

/* ===== 网格布局 ===== */
.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

/* ===== 列表项 ===== */
.list-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px;
    border-radius: var(--radius-md);
    background: rgba(10, 22, 40, 0.4);
    margin-bottom: 8px;
    border: 1px solid transparent;
    transition: all 0.2s;
    cursor: pointer;
}

.list-item:hover {
    background: rgba(64, 169, 255, 0.06);
    border-color: var(--border-color);
}

.list-item-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.list-item-icon svg { width: 20px; height: 20px; }

.list-item-content {
    flex: 1;
    min-width: 0;
}

.list-item-title {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 4px;
}

.list-item-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    font-size: 12px;
    color: var(--text-muted);
}

.list-item-desc {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

/* ===== 底部导航 ===== */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: calc(var(--bottom-nav-height) + env(safe-area-inset-bottom, 0));
    background: rgba(10, 22, 40, 0.98);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid var(--border-color);
    display: flex;
    z-index: 100;
    padding-bottom: env(safe-area-inset-bottom, 0);
}

.bottom-nav a {
    flex: 1;
    min-height: var(--bottom-nav-height);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    padding: 6px 4px 8px;
    color: var(--text-muted);
    cursor: pointer;
    transition: color 0.2s;
    -webkit-user-select: none;
    user-select: none;
    touch-action: manipulation;
}

.bottom-nav a.active {
    color: var(--accent-cyan);
}

.bottom-nav .nav-icon {
    display: flex;
    width: 22px;
    height: 22px;
}

.bottom-nav .nav-icon svg {
    width: 100%;
    height: 100%;
}

.bottom-nav .nav-label {
    font-size: 10px;
    font-weight: 500;
}

/* ===== 模态框 ===== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 1000;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 5vh 16px;
    overflow-y: auto;
    animation: fadeIn 0.2s ease;
}

.modal-container {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    animation: slideUp 0.3s ease;
}

.modal-container.large { max-width: 800px; }

@keyframes slideUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

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

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

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

.modal-close:hover {
    background: rgba(255, 77, 79, 0.15);
    color: var(--accent-red);
}

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

/* ===== Toast ===== */
.toast {
    position: fixed;
    top: calc(80px + env(safe-area-inset-top, 0));
    left: 50%;
    transform: translateX(-50%);
    max-width: calc(100vw - 32px);
    padding: 14px 22px;
    border-radius: var(--radius-md);
    font-size: 15px;
    font-weight: 500;
    line-height: 1.5;
    z-index: 2000;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: var(--shadow-card);
    word-break: break-word;
}

.toast.success { background: rgba(82, 196, 26, 0.9); color: #fff; }
.toast.error { background: rgba(255, 77, 79, 0.9); color: #fff; }
.toast.info { background: rgba(64, 169, 255, 0.9); color: #fff; }

.toast-enter-active, .toast-leave-active {
    transition: all 0.3s ease;
}

.toast-enter-from, .toast-leave-to {
    opacity: 0;
    transform: translateX(-50%) translateY(-10px);
}

/* ===== AI 抽屉 ===== */
.ai-drawer {
    position: fixed;
    inset: 0;
    z-index: 999;
}

.ai-drawer-mask {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    animation: fadeIn 0.2s ease;
}

.ai-drawer-content {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    max-width: 480px;
    background: var(--bg-secondary);
    border-left: 1px solid var(--border-color);
    overflow-y: auto;
    animation: slideInRight 0.3s ease;
}

@keyframes slideInRight {
    from { transform: translateX(100%); }
    to { transform: translateX(0); }
}

/* ===== 图表容器 ===== */
.chart-container {
    position: relative;
    height: 240px;
    width: 100%;
}

.chart-container.tall { height: 320px; }

/* ===== 时间线 ===== */
.timeline {
    position: relative;
    padding-left: 28px;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 10px;
    top: 8px;
    bottom: 8px;
    width: 2px;
    background: linear-gradient(to bottom, var(--accent-primary), transparent);
}

.timeline-item {
    position: relative;
    padding-bottom: 24px;
}

.timeline-item:last-child {
    padding-bottom: 0;
}

.timeline-dot {
    position: absolute;
    left: -24px;
    top: 4px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--bg-secondary);
    border: 3px solid var(--accent-primary);
    z-index: 1;
}

.timeline-item.success .timeline-dot { border-color: var(--accent-green); }
.timeline-item.warning .timeline-dot { border-color: var(--accent-yellow); }
.timeline-item.danger .timeline-dot { border-color: var(--accent-red); }
.timeline-item.purple .timeline-dot { border-color: var(--accent-purple); }

.timeline-date {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.timeline-content {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 14px;
}

.timeline-title {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 4px;
}

.timeline-desc {
    font-size: 13px;
    color: var(--text-secondary);
}

/* ===== 空状态 ===== */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
}

.empty-state svg {
    width: 56px;
    height: 56px;
    margin-bottom: 14px;
    opacity: 0.3;
}

.empty-state-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--text-secondary);
}

.empty-state-desc {
    font-size: 13px;
    line-height: 1.6;
    margin-bottom: 18px;
}

/* ===== 患者信息卡 ===== */
.patient-banner {
    background: linear-gradient(135deg, rgba(64, 169, 255, 0.1) 0%, rgba(114, 46, 209, 0.1) 100%);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: 24px;
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}

.patient-avatar {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: var(--gradient-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
}

.patient-info {
    flex: 1;
    min-width: 200px;
}

.patient-name {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 4px;
}

.patient-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    font-size: 13px;
    color: var(--text-secondary);
}

/* ===== AI 建议卡片 ===== */
.ai-suggestion {
    background: linear-gradient(135deg, rgba(114, 46, 209, 0.1) 0%, rgba(64, 169, 255, 0.05) 100%);
    border: 1px solid rgba(114, 46, 209, 0.2);
    border-radius: var(--radius-lg);
    padding: 20px;
    margin-bottom: 16px;
    position: relative;
    overflow: hidden;
}

.ai-suggestion::before {
    content: 'AI';
    position: absolute;
    top: 12px;
    right: 16px;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 8px;
    background: var(--gradient-purple);
    color: #fff;
    letter-spacing: 1px;
}

.ai-suggestion-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
    padding-right: 40px;
}

.ai-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--gradient-purple);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.ai-icon svg { width: 20px; height: 20px; color: #fff; }

.ai-suggestion-title {
    font-size: 16px;
    font-weight: 600;
}

.ai-suggestion-body {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.7;
    margin-bottom: 12px;
}

.ai-suggestion-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.priority-bar {
    display: flex;
    gap: 4px;
    margin-bottom: 12px;
}

.priority-bar span {
    height: 4px;
    flex: 1;
    border-radius: 2px;
    background: rgba(255, 255, 255, 0.1);
}

.priority-bar span.active.high { background: var(--accent-red); }
.priority-bar span.active.medium { background: var(--accent-orange); }
.priority-bar span.active.low { background: var(--accent-green); }

/* ===== 治疗方案卡 ===== */
.plan-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 20px;
    margin-bottom: 16px;
    position: relative;
    overflow: hidden;
}

.plan-card.active {
    border-color: var(--accent-green);
    box-shadow: 0 0 0 1px var(--accent-green), 0 0 20px rgba(82, 196, 26, 0.1);
}

.plan-line {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 12px;
    border-radius: 16px;
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 12px;
}

.plan-line.first { background: rgba(82, 196, 26, 0.15); color: var(--accent-green); }
.plan-line.second { background: rgba(250, 140, 22, 0.15); color: var(--accent-orange); }
.plan-line.third { background: rgba(255, 77, 79, 0.15); color: var(--accent-red); }
.plan-line.fourth { background: rgba(114, 46, 209, 0.15); color: var(--accent-purple); }

.plan-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 12px;
}

.plan-name {
    font-size: 17px;
    font-weight: 700;
}

.plan-dates {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.plan-drugs {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 12px;
}

.drug-tag {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 8px;
    font-size: 12px;
    background: rgba(64, 169, 255, 0.1);
    color: var(--accent-primary);
    border: 1px solid var(--border-color);
}

/* ===== 响应式 ===== */
@media (max-width: 768px) {
    html { font-size: 15px; }

    .header-content {
        padding: 0 12px;
        gap: 12px;
    }

    .logo-sub { display: none; }

    .grid-2, .grid-3 {
        grid-template-columns: 1fr;
    }

    .form-row, .form-row-3 {
        grid-template-columns: 1fr;
    }

    .stat-grid {
        grid-template-columns: 1fr 1fr;
        gap: 12px;
    }

    .stat-card {
        padding: 14px;
    }

    .stat-value {
        font-size: 22px;
    }

    .stat-icon {
        width: 36px;
        height: 36px;
    }

    .stat-icon svg { width: 18px; height: 18px; }

    .card {
        padding: 16px;
    }

    .patient-banner {
        padding: 16px;
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .patient-avatar {
        width: 52px;
        height: 52px;
        font-size: 20px;
    }

    .modal-container {
        max-width: 100%;
    }

    .modal-header, .modal-body {
        padding: 16px;
    }

    .page-title {
        font-size: 19px;
        flex-wrap: wrap;
    }

    .page-subtitle {
        font-size: 13px;
        margin-bottom: 16px;
    }

    /* 标题行：标题与按钮自动换行 */
    .app-main .flex.justify-between.items-center {
        flex-wrap: wrap;
        gap: 12px;
    }

    /* 卡片头部允许换行 */
    .card-header {
        flex-wrap: wrap;
        gap: 8px;
    }

    /* 横向多列表单行（肿瘤标志物/基因突变）强制纵向 */
    .form-multi-row {
        flex-direction: column !important;
        align-items: stretch !important;
    }
    .form-multi-row .form-group {
        width: 100% !important;
        margin-bottom: 8px !important;
    }
    .form-multi-row .btn {
        margin-bottom: 12px !important;
        margin-left: 0 !important;
    }

    /* 数据行手机端纵向布局 */
    .data-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }
    .data-value {
        text-align: left;
        width: 100%;
    }

    /* 底部导航项缩小间距 */
    .bottom-nav .nav-label {
        font-size: 10px;
    }

    .bottom-nav .nav-icon {
        width: 22px;
        height: 22px;
    }

    /* ========== 手机端关键修复 ========== */

    /* ① iOS输入框防缩放：所有原生输入控件最小16px字号 */
    .form-input,
    .form-select,
    .form-textarea,
    .modal-header input,
    .card-body input,
    .card-body select,
    .card-body textarea {
        font-size: 16px !important;
    }

    /* ② 手机端主区域更紧凑：底部留出安全区+bottom-nav */
    .app-main.mobile {
        padding: 14px 12px calc(var(--bottom-nav-height) + 20px + env(safe-area-inset-bottom, 0));
    }

    /* ③ 模态框手机端：贴边显示，增加垂直可用空间 */
    .modal-overlay {
        padding: 3vh 10px 0;
        align-items: flex-start;
    }
    .modal-container {
        border-radius: 16px 16px 12px 12px;
        margin: 0;
        max-height: 94vh;
    }

    /* ④ 图表容器手机端高度略降，适配一屏显示更多 */
    .chart-container {
        height: 220px;
    }

    /* ⑤ 空状态压缩，适配短屏 */
    .empty-state {
        padding: 28px 14px;
    }
    .empty-state svg {
        width: 48px;
        height: 48px;
        margin-bottom: 10px;
    }
    .empty-state-title {
        font-size: 15px;
    }
    .empty-state-desc {
        font-size: 12.5px;
        margin-bottom: 14px;
    }

    /* ⑥ 时间线手机端：左侧宽度压缩，更紧凑 */
    .timeline {
        padding-left: 22px;
    }
    .timeline::before {
        left: 8px;
        top: 6px;
        bottom: 6px;
    }
    .timeline-item {
        padding-bottom: 18px;
    }
    .timeline-dot {
        left: -20px;
        top: 2px;
        width: 14px;
        height: 14px;
        border-width: 2px;
    }

    /* ⑦ 列表项卡片更小间距，一屏显示更多条目 */
    .list-item {
        padding: 12px 14px;
    }
    .mb-24 { margin-bottom: 16px; }
    .mt-24 { margin-top: 16px; }
}

/* ========== 600px 断点：大屏手机（iPhone 14/13/12、Pixel 7等）进一步优化 ========== */
@media (max-width: 600px) {
    html { font-size: 15px; }

    .card {
        padding: 14px;
        border-radius: 14px;
    }

    .page-title {
        font-size: 18px;
    }

    .patient-banner {
        padding: 14px;
        border-radius: 16px;
    }

    .stat-card {
        padding: 12px;
        border-radius: 14px;
    }
    .stat-label {
        font-size: 12px;
    }
    .stat-value {
        font-size: 20px;
    }
    .stat-change {
        font-size: 11px;
    }

    .btn {
        min-height: 42px;
        padding: 9px 15px;
        font-size: 14.5px;
    }
    .icon-btn {
        width: 42px;
        height: 42px;
    }

    .form-input,
    .form-select {
        min-height: 42px;
        padding: 10px 12px;
    }

    .plan-drugs {
        gap: 5px;
    }
    .drug-tag {
        font-size: 11.5px;
        padding: 3px 8px;
    }

    /* AI抽屉手机端最大宽度改为全屏 */
    .ai-drawer-content {
        max-width: 100% !important;
        width: 100% !important;
    }

    .chart-container {
        height: 210px;
    }
}

@media (max-width: 480px) {
    html { font-size: 14.5px; }

    .stat-grid {
        grid-template-columns: 1fr;
    }

    .patient-meta {
        gap: 8px;
        font-size: 12px;
    }

    .card-actions {
        flex-wrap: wrap;
    }

    .page-title {
        font-size: 17px;
    }

    /* 极限小屏更紧凑 */
    .app-main.mobile {
        padding: 12px 10px calc(var(--bottom-nav-height) + 16px + env(safe-area-inset-bottom, 0));
    }

    .card {
        padding: 12px;
        border-radius: 12px;
        box-shadow: 0 2px 12px rgba(0, 0, 0, 0.25);
    }

    .patient-banner {
        padding: 12px;
        border-radius: 14px;
        gap: 10px;
    }
    .patient-avatar {
        width: 48px;
        height: 48px;
        font-size: 18px;
    }
    .patient-name {
        font-size: 18px !important;
    }

    .header-content {
        min-height: 56px;
        padding: 8px 10px;
    }
    .logo {
        font-size: 16px;
    }
    .icon-btn {
        width: 40px;
        height: 40px;
    }

    .page-title {
        font-size: 16.5px;
    }

    .chart-container {
        height: 200px;
    }

    .stat-card {
        padding: 10px 12px;
    }
    .stat-value {
        font-size: 19px;
    }

    /* 小屏下筛选按钮更紧凑 */
    .btn-sm {
        min-height: 32px;
        padding: 4px 10px;
        font-size: 12px;
    }

    .list-item {
        padding: 10px 12px;
    }

    .modal-header, .modal-body {
        padding: 14px 12px;
    }
    .modal-title {
        font-size: 16px;
    }

    .bottom-nav {
        --bottom-nav-height: 58px;
    }
    .bottom-nav a {
        padding: 5px 3px 7px;
    }
    .bottom-nav .nav-label {
        font-size: 9px;
        line-height: 1.2;
        max-width: 100%;
        text-overflow: ellipsis;
        white-space: nowrap;
        overflow: hidden;
    }
    .bottom-nav .nav-icon {
        width: 20px;
        height: 20px;
    }

    /* 极限小屏空状态进一步压缩 */
    .empty-state {
        padding: 22px 10px;
    }
    .empty-state svg {
        width: 40px;
        height: 40px;
    }

    /* toast不溢出 */
    .toast {
        padding: 12px 16px !important;
        font-size: 14px !important;
    }
    .toast.success, .toast.error, .toast.info {
        font-size: 14px !important;
    }

    /* 小屏下药物/标签tag更紧凑 */
    .tag {
        font-size: 11px;
        padding: 3px 8px;
    }
    .drug-tag {
        font-size: 11px;
        padding: 2px 8px;
        border-radius: 6px;
    }
    .plan-drugs {
        gap: 4px;
        margin-bottom: 8px;
    }

    .plan-name {
        font-size: 15.5px;
    }
    .plan-dates {
        font-size: 12px;
        margin-bottom: 8px;
    }
    .plan-line {
        font-size: 11.5px;
        padding: 3px 8px;
    }
}

/* ===== 强制移动模式：用于桌面浏览器模拟手机布局（截图/预览用） =====
   真实手机依赖 @media 查询，下面这部分仅当 body 被加上 .force-mobile class 时生效
   重要：此部分必须与 @media (max-width:768/600/480) 三个断点的最新规则保持同步镜像 */
body.force-mobile {
    max-width: 400px !important;
    margin: 0 auto !important;
}
body.force-mobile,
body.force-mobile .app-shell {
    width: 100% !important;
    max-width: 400px !important;
    overflow-x: hidden !important;
}
/* --- 以下严格镜像 @media (max-width:768px) 的全部规则 --- */
body.force-mobile { font-size: 15px; }
body.force-mobile .header-content { padding: 0 12px; gap: 12px; }
body.force-mobile .logo-sub { display: none; }
body.force-mobile .grid-2,
body.force-mobile .grid-3 { grid-template-columns: 1fr; }
body.force-mobile .form-row,
body.force-mobile .form-row-3 { grid-template-columns: 1fr; }
body.force-mobile .stat-grid { grid-template-columns: 1fr 1fr; gap: 12px; }
body.force-mobile .stat-card { padding: 14px; }
body.force-mobile .stat-value { font-size: 22px; }
body.force-mobile .stat-icon { width: 36px; height: 36px; }
body.force-mobile .stat-icon svg { width: 18px; height: 18px; }
body.force-mobile .card { padding: 16px; }
body.force-mobile .patient-banner { padding: 16px; flex-direction: column; align-items: flex-start; gap: 12px; }
body.force-mobile .patient-avatar { width: 52px; height: 52px; font-size: 20px; }
body.force-mobile .modal-container { max-width: 100%; }
body.force-mobile .modal-header,
body.force-mobile .modal-body { padding: 16px; }
body.force-mobile .page-title { font-size: 19px; flex-wrap: wrap; }
body.force-mobile .page-subtitle { font-size: 13px; margin-bottom: 16px; }
body.force-mobile .app-main .flex.justify-between.items-center { flex-wrap: wrap; gap: 12px; }
body.force-mobile .card-header { flex-wrap: wrap; gap: 8px; }
body.force-mobile .form-multi-row { flex-direction: column !important; align-items: stretch !important; }
body.force-mobile .form-multi-row .form-group { width: 100% !important; margin-bottom: 8px !important; }
body.force-mobile .form-multi-row .btn { margin-bottom: 12px !important; margin-left: 0 !important; }
body.force-mobile .data-row { flex-direction: column; align-items: flex-start; gap: 4px; }
body.force-mobile .data-value { text-align: left; width: 100%; }
body.force-mobile .bottom-nav .nav-label { font-size: 10px; }
body.force-mobile .bottom-nav .nav-icon { width: 22px; height: 22px; }
/* ① iOS防缩放：输入框最小16px */
body.force-mobile .form-input,
body.force-mobile .form-select,
body.force-mobile .form-textarea,
body.force-mobile .modal-header input,
body.force-mobile .card-body input,
body.force-mobile .card-body select,
body.force-mobile .card-body textarea { font-size: 16px !important; }
/* ② 主区域移动端内边距（含安全区） */
body.force-mobile .app-main,
body.force-mobile .app-main.mobile {
    padding: 14px 12px calc(var(--bottom-nav-height) + 20px + env(safe-area-inset-bottom, 0)) !important;
}
/* ③ 模态框贴边 */
body.force-mobile .modal-overlay { padding: 3vh 10px 0 !important; align-items: flex-start !important; }
body.force-mobile .modal-container {
    border-radius: 16px 16px 12px 12px !important;
    margin: 0 !important;
    max-height: 94vh !important;
}
/* ④ 图表容器高度降 */
body.force-mobile .chart-container { height: 220px; }
/* ⑤ 空状态压缩 */
body.force-mobile .empty-state { padding: 28px 14px; }
body.force-mobile .empty-state svg { width: 48px; height: 48px; margin-bottom: 10px; }
body.force-mobile .empty-state-title { font-size: 15px; }
body.force-mobile .empty-state-desc { font-size: 12.5px; margin-bottom: 14px; }
/* ⑥ 时间线紧凑 */
body.force-mobile .timeline { padding-left: 22px; }
body.force-mobile .timeline::before { left: 8px; top: 6px; bottom: 6px; }
body.force-mobile .timeline-item { padding-bottom: 18px; }
body.force-mobile .timeline-dot { left: -20px; top: 2px; width: 14px; height: 14px; border-width: 2px; }
/* ⑦ 列表项 + 间距压缩 */
body.force-mobile .list-item { padding: 12px 14px; }
body.force-mobile .mb-24 { margin-bottom: 16px !important; }
body.force-mobile .mt-24 { margin-top: 16px !important; }

/* --- 600px级别大屏安卓/iPhone 镜像 --- */
body.force-mobile .card { padding: 14px; border-radius: 14px; }
body.force-mobile .page-title { font-size: 18px; }
body.force-mobile .patient-banner { padding: 14px; border-radius: 16px; }
body.force-mobile .stat-card { padding: 12px; border-radius: 14px; }
body.force-mobile .stat-label { font-size: 12px; }
body.force-mobile .stat-value { font-size: 20px; }
body.force-mobile .stat-change { font-size: 11px; }
body.force-mobile .btn { min-height: 42px; padding: 9px 15px; font-size: 14.5px; }
body.force-mobile .icon-btn { width: 42px; height: 42px; }
body.force-mobile .form-input,
body.force-mobile .form-select { min-height: 42px; padding: 10px 12px; }
body.force-mobile .plan-drugs { gap: 5px; }
body.force-mobile .drug-tag { font-size: 11.5px; padding: 3px 8px; }
body.force-mobile .ai-drawer-content { max-width: 100% !important; width: 100% !important; }
body.force-mobile .chart-container { height: 210px; }

/* --- 480px级别（iPhone SE 类小屏） --- */
body.force-mobile.force-mobile-sm { font-size: 14.5px; }
body.force-mobile.force-mobile-sm .stat-grid { grid-template-columns: 1fr; }
body.force-mobile.force-mobile-sm .patient-meta { gap: 8px; font-size: 12px; }
body.force-mobile.force-mobile-sm .card-actions { flex-wrap: wrap; }
body.force-mobile.force-mobile-sm .page-title { font-size: 16.5px; }
body.force-mobile.force-mobile-sm .app-main,
body.force-mobile.force-mobile-sm .app-main.mobile {
    padding: 12px 10px calc(var(--bottom-nav-height) + 16px + env(safe-area-inset-bottom, 0)) !important;
}
body.force-mobile.force-mobile-sm .card { padding: 12px; border-radius: 12px; box-shadow: 0 2px 12px rgba(0,0,0,0.25); }
body.force-mobile.force-mobile-sm .patient-banner { padding: 12px; border-radius: 14px; gap: 10px; }
body.force-mobile.force-mobile-sm .patient-avatar { width: 48px; height: 48px; font-size: 18px; }
body.force-mobile.force-mobile-sm .patient-name { font-size: 18px !important; }
body.force-mobile.force-mobile-sm .header-content { min-height: 56px; padding: 8px 10px; }
body.force-mobile.force-mobile-sm .logo { font-size: 16px; }
body.force-mobile.force-mobile-sm .icon-btn { width: 40px; height: 40px; }
body.force-mobile.force-mobile-sm .chart-container { height: 200px; }
body.force-mobile.force-mobile-sm .stat-card { padding: 10px 12px; }
body.force-mobile.force-mobile-sm .stat-value { font-size: 19px; }
body.force-mobile.force-mobile-sm .btn-sm { min-height: 32px; padding: 4px 10px; font-size: 12px; }
body.force-mobile.force-mobile-sm .list-item { padding: 10px 12px; }
body.force-mobile.force-mobile-sm .modal-header,
body.force-mobile.force-mobile-sm .modal-body { padding: 14px 12px; }
body.force-mobile.force-mobile-sm .modal-title { font-size: 16px; }
body.force-mobile.force-mobile-sm .bottom-nav { --bottom-nav-height: 58px; }
body.force-mobile.force-mobile-sm .bottom-nav a { padding: 5px 3px 7px; }
body.force-mobile.force-mobile-sm .bottom-nav .nav-label {
    font-size: 9px;
    line-height: 1.2;
    max-width: 100%;
    text-overflow: ellipsis;
    white-space: nowrap;
    overflow: hidden;
}
body.force-mobile.force-mobile-sm .bottom-nav .nav-icon { width: 20px; height: 20px; }
body.force-mobile.force-mobile-sm .empty-state { padding: 22px 10px; }
body.force-mobile.force-mobile-sm .empty-state svg { width: 40px; height: 40px; }
body.force-mobile.force-mobile-sm .toast { padding: 12px 16px !important; font-size: 14px !important; }
body.force-mobile.force-mobile-sm .tag { font-size: 11px; padding: 3px 8px; }
body.force-mobile.force-mobile-sm .drug-tag { font-size: 11px; padding: 2px 8px; border-radius: 6px; }
body.force-mobile.force-mobile-sm .plan-drugs { gap: 4px; margin-bottom: 8px; }
body.force-mobile.force-mobile-sm .plan-name { font-size: 15.5px; }
body.force-mobile.force-mobile-sm .plan-dates { font-size: 12px; margin-bottom: 8px; }
body.force-mobile.force-mobile-sm .plan-line { font-size: 11.5px; padding: 3px 8px; }

/* 手机预览：强制限制 app-shell 宽度，产生手机屏观感 */
body.force-mobile .app-shell {
    max-width: 400px !important;
    margin: 0 auto !important;
    box-shadow: 0 0 0 1px rgba(64, 169, 255, 0.2), 0 0 60px rgba(0,0,0,0.5);
    min-height: 100vh;
    position: relative;
}
body.force-mobile {
    background: #0a0f1e !important;
}

/* ===== 滚动条 ===== */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
    background: rgba(64, 169, 255, 0.3);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(64, 169, 255, 0.5);
}

/* ===== 工具类 ===== */
.text-center { text-align: center; }
.text-right { text-align: right; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.flex-wrap { flex-wrap: wrap; }
.flex-1 { flex: 1; }
.text-sm { font-size: 13px; }
.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.font-bold { font-weight: 700; }
.full-width { width: 100%; }

/* 数据展示 */
.data-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid rgba(64, 169, 255, 0.06);
}

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

.data-label {
    color: var(--text-secondary);
    font-size: 14px;
}

.data-value {
    font-weight: 500;
    text-align: right;
}

/* 趋势箭头 */
.trend-arrow {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    font-size: 12px;
}

.trend-arrow.up { color: var(--accent-red); }
.trend-arrow.down { color: var(--accent-green); }
.trend-arrow.stable { color: var(--text-muted); }
