/* 颐康智护 - 主样式表 v3.0 (UI Design Spec + Login) */

/* ========== 登录页 ========== */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #3B6D11 0%, #2F5A0D 50%, #1a3d08 100%);
    position: relative;
    overflow: hidden;
}
.login-page::before {
    content: '';
    position: absolute;
    width: 600px; height: 600px;
    background: radial-gradient(circle, rgba(255,255,255,0.06) 0%, transparent 70%);
    top: -200px; right: -100px;
    border-radius: 50%;
}
.login-page::after {
    content: '';
    position: absolute;
    width: 400px; height: 400px;
    background: radial-gradient(circle, rgba(255,255,255,0.04) 0%, transparent 70%);
    bottom: -100px; left: -50px;
    border-radius: 50%;
}
.login-card {
    background: #fff;
    border-radius: 16px;
    padding: 48px 40px 36px;
    width: 400px;
    max-width: 90vw;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    position: relative;
    z-index: 1;
}
.login-logo {
    text-align: center;
    margin-bottom: 8px;
}
.login-logo img {
    width: 72px; height: 72px;
    border-radius: 16px;
    object-fit: contain;
}
.login-title {
    text-align: center;
    font-size: 28px;
    font-weight: 700;
    color: var(--primary);
    margin: 12px 0 4px;
}
.login-subtitle {
    text-align: center;
    font-size: 14px;
    color: var(--text-hint);
    margin: 0 0 32px;
}
.login-field {
    margin-bottom: 20px;
}
.login-field label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
}
.login-field .input {
    width: 100%;
    box-sizing: border-box;
    padding: 12px 14px;
    font-size: 15px;
    border: 1.5px solid var(--border-default);
    border-radius: 8px;
    background: var(--bg-page);
    transition: border-color 0.2s, box-shadow 0.2s;
}
.login-field .input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
    outline: none;
    background: #fff;
}
.login-error {
    background: var(--danger-light);
    color: var(--danger);
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 13px;
    margin-bottom: 16px;
    text-align: center;
}
.login-btn {
    width: 100%;
    padding: 13px;
    font-size: 16px;
    font-weight: 600;
    border: none;
    border-radius: 8px;
    background: var(--primary);
    color: #fff;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
    letter-spacing: 4px;
}
.login-btn:hover { background: var(--primary-hover); }
.login-btn:active { transform: scale(0.98); }
.login-btn:disabled { opacity: 0.6; cursor: not-allowed; }
.login-footer {
    text-align: center;
    font-size: 12px;
    color: var(--text-disabled);
    margin-top: 24px;
    padding-top: 16px;
    border-top: 1px solid var(--border-default);
}

/* ========== 侧边栏用户区域 ========== */
.sidebar-user {
    display: flex;
    align-items: center;
    padding: 14px 16px;
    border-top: 1px solid rgba(255,255,255,0.1);
    margin-top: auto;
    background: rgba(0,0,0,0.15);
}
.sidebar-user-avatar {
    width: 36px; height: 36px;
    border-radius: 50%;
    background: var(--primary-light);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 15px;
    flex-shrink: 0;
}
.sidebar-user-info {
    flex: 1;
    margin-left: 10px;
    overflow: hidden;
}
.sidebar-user-name {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sidebar-user-role {
    display: block;
    font-size: 11px;
    color: rgba(255,255,255,0.5);
}
.sidebar-logout-btn {
    background: none;
    border: none;
    color: rgba(255,255,255,0.4);
    cursor: pointer;
    font-size: 18px;
    padding: 4px 6px;
    border-radius: 4px;
    transition: all 0.2s;
}
.sidebar-logout-btn:hover {
    color: #fff;
    background: rgba(255,255,255,0.1);
}

/* ========== Design Tokens ========== */
:root {
    /* 主色板 */
    --primary: #3B6D11;
    --primary-light: #EAF3DE;
    --primary-hover: #2F5A0D;
    --success: #1D9E75;
    --success-light: #E1F5EE;
    --warning: #BA7517;
    --warning-light: #FAEEDA;
    --danger: #E24B4A;
    --danger-light: #FCEBEB;
    --info: #185FA5;
    --info-light: #E6F1FB;
    --ai: #7F77DD;
    --ai-light: #EEEDFE;
    --ai-border: #AFA9EC;

    /* 中性色阶 */
    --bg-page: #F1EFE8;
    --bg-surface: #FFFFFF;
    --bg-elevated: #F1EFE8;
    --border-default: #D3D1C7;
    --text-primary: #2C2C2A;
    --text-secondary: #5F5E5A;
    --text-hint: #888780;
    --text-disabled: #B4B2A9;

    /* 排版 */
    --font-family: 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', -apple-system, BlinkMacSystemFont, sans-serif;
    --text-h1: 500 28px/1.3 var(--font-family);
    --text-h2: 500 22px/1.4 var(--font-family);
    --text-h3: 500 17px/1.4 var(--font-family);
    --text-body: 400 14px/1.6 var(--font-family);
    --text-secondary-size: 400 12px/1.5 var(--font-family);
    --text-caption: 400 11px/1.4 var(--font-family);

    /* 间距 */
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 12px;
    --space-base: 16px;
    --space-lg: 24px;
    --space-xl: 32px;
    --space-2xl: 48px;

    /* 圆角 */
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --radius-full: 9999px;

    /* 阴影 */
    --shadow: 0 1px 3px rgba(44,44,42,.08), 0 1px 2px rgba(44,44,42,.04);
    --shadow-md: 0 4px 6px -1px rgba(44,44,42,.08), 0 2px 4px -2px rgba(44,44,42,.04);
    --shadow-lg: 0 10px 15px -3px rgba(44,44,42,.08), 0 4px 6px -4px rgba(44,44,42,.04);
}

/* ========== Reset ========== */
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
    font: var(--text-body);
    background: var(--bg-page);
    color: var(--text-primary);
    min-height: 100vh;
}

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

/* 侧边栏 */
.sidebar {
    width: 240px;
    background: linear-gradient(180deg, #2C2C2A 0%, #1A1A18 100%);
    color: #fff;
    position: fixed;
    height: 100vh;
    display: flex;
    flex-direction: column;
    z-index: 100;
    transition: transform .3s;
}
.sidebar-nav {
    padding: var(--space-sm) 0;
    flex: 1;
    overflow-y: auto;
}
.sidebar-nav::-webkit-scrollbar {
    width: 5px;
}
.sidebar-nav::-webkit-scrollbar-track {
    background: transparent;
}
.sidebar-nav::-webkit-scrollbar-thumb {
    background: rgba(107, 191, 89, 0.35);
    border-radius: 10px;
}
.sidebar-nav::-webkit-scrollbar-thumb:hover {
    background: rgba(107, 191, 89, 0.6);
}
.sidebar-nav {
    scrollbar-width: thin;
    scrollbar-color: rgba(107, 191, 89, 0.35) transparent;
}
.sidebar-brand {
    padding: var(--space-lg) var(--space-base);
    border-bottom: 1px solid rgba(255,255,255,.08);
}
.sidebar-brand h1 {
    font: 500 20px/1.3 var(--font-family);
    background: linear-gradient(135deg, var(--success), #6BBF59);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}
.sidebar-brand p {
    font: var(--text-caption);
    color: var(--text-disabled);
    margin-top: var(--space-xs);
}
.sidebar-company {
    font-size: 10px !important;
    color: rgba(255,255,255,.35) !important;
    margin-top: 4px !important;
    letter-spacing: 0.5px;
}
.sidebar-logo {
    display: flex;
    justify-content: center;
    margin-bottom: var(--space-base);
}
.sidebar-logo img {
    width: 56px;
    height: 56px;
    object-fit: contain;
    border-radius: 50%;
    background: #fff;
    padding: 4px;
    box-shadow: 0 2px 8px rgba(0,0,0,.2);
}


.nav-section {
    padding: var(--space-md) var(--space-base) var(--space-xs);
    font: var(--text-caption);
    color: var(--text-disabled);
    letter-spacing: 1px;
    margin-top: var(--space-sm);
}
.nav-item {
    display: flex;
    align-items: center;
    padding: 10px var(--space-base);
    color: var(--text-hint);
    cursor: pointer;
    transition: all .2s;
    text-decoration: none;
    font: var(--text-body);
    font-size: 14px;
    border-left: 3px solid transparent;
    border-radius: 0;
}
.nav-item:hover { background: rgba(255,255,255,.05); color: #fff; }
.nav-item.active {
    background: rgba(59,109,17,.2);
    color: var(--success);
    border-left-color: var(--success);
}
.nav-item svg { width: 18px; height: 18px; margin-right: 10px; flex-shrink: 0; }

/* 主内容区 */
.main-content {
    margin-left: 240px;
    flex: 1;
    min-height: 100vh;
    background: var(--bg-page);
}

/* ========== 顶部栏 ========== */
.topbar {
    background: var(--bg-surface);
    padding: var(--space-md) var(--space-lg);
    border-bottom: 1px solid var(--border-default);
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 50;
}
.topbar h2 {
    font: var(--text-h2);
    font-size: 18px;
}
.topbar-right { display: flex; align-items: center; gap: var(--space-md); }

/* ========== 页面内容 ========== */
.page { padding: var(--space-lg); }

/* ========== 问候语区域 ========== */
.greeting-section {
    margin-bottom: var(--space-lg);
}
.greeting-hello {
    font: var(--text-h1);
    font-size: 22px;
    color: var(--text-primary);
}
.greeting-date {
    font: var(--text-secondary-size);
    color: var(--text-hint);
    margin-top: var(--space-xs);
}

/* ========== 卡片 ========== */
.card {
    background: var(--bg-surface);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-default);
    padding: var(--space-base);
    margin-bottom: var(--space-base);
}
.card-title {
    font: var(--text-h3);
    color: var(--text-primary);
    margin-bottom: var(--space-md);
    padding-bottom: var(--space-sm);
    border-bottom: 1px solid var(--border-default);
}

/* ========== 统计卡片 (Metric Card) ========== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--space-md);
    margin-bottom: var(--space-lg);
}
.stat-card {
    background: var(--bg-surface);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-default);
    padding: var(--space-base);
    display: flex;
    align-items: center;
    gap: var(--space-md);
    transition: box-shadow .2s;
}
.stat-card:hover { box-shadow: var(--shadow-md); border-color: var(--primary); cursor: pointer; transform: translateY(-1px); }
.stat-card:active { transform: translateY(0); }
.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.stat-icon svg { width: 24px; height: 24px; }
.stat-icon.blue { background: var(--info-light); color: var(--info); }
.stat-icon.green { background: var(--success-light); color: var(--success); }
.stat-icon.orange { background: var(--warning-light); color: var(--warning); }
.stat-icon.red { background: var(--danger-light); color: var(--danger); }
.stat-icon.teal { background: var(--info-light); color: var(--info); }
.stat-value { font: 500 24px/1.2 var(--font-family); color: var(--text-primary); }
.stat-label { font: var(--text-secondary-size); color: var(--text-hint); margin-top: 2px; }

/* 待处理分诊卡片用警示底色 */
.stat-card.alert-card {
    background: var(--danger-light);
    border-color: rgba(226,75,74,.2);
}
.stat-card.alert-card .stat-value { color: var(--danger); }

/* ========== 仪表盘图表区 ========== */
.dashboard-charts {
    display: flex;
    gap: var(--space-base);
    margin-bottom: var(--space-lg);
    flex-wrap: wrap;
}
.dashboard-bottom {
    display: flex;
    gap: var(--space-base);
    margin-bottom: var(--space-lg);
    flex-wrap: wrap;
}
/* 横向条形图 */
.bar-chart { display: flex; flex-direction: column; gap: 10px; }
.bar-row { display: flex; align-items: center; gap: 10px; }
.bar-label { width: 70px; font-size: 13px; color: var(--text-secondary); text-align: right; flex-shrink: 0; }
.bar-track { flex: 1; height: 28px; background: var(--bg-page); border-radius: 6px; overflow: hidden; position: relative; }
.bar-fill { height: 100%; border-radius: 6px; transition: width .6s ease; display: flex; align-items: center; padding-left: 8px; min-width: 0; }
.bar-fill.level-1 { background: linear-gradient(90deg, #E24B4A, #FF6B6B); color: #fff; }
.bar-fill.level-2 { background: linear-gradient(90deg, #BA7517, #F0A030); color: #fff; }
.bar-fill.level-3 { background: linear-gradient(90deg, #3B6D11, #6BBF59); color: #fff; }
.bar-fill.floor-bar { background: linear-gradient(90deg, var(--info), #5BA3D9); color: #fff; }
.bar-count { font-size: 12px; font-weight: 500; white-space: nowrap; }
.bar-pct { font-size: 11px; color: var(--text-hint); width: 44px; text-align: right; flex-shrink: 0; }
/* 环形图 */
.donut-wrap { display: flex; flex-direction: column; align-items: center; gap: var(--space-sm); }
.donut-svg { width: 120px; height: 120px; }
.donut-legend { display: flex; gap: var(--space-base); justify-content: center; flex-wrap: wrap; }
.donut-legend-item { display: flex; align-items: center; gap: 4px; font-size: 12px; color: var(--text-secondary); }
.donut-legend-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
/* 状态卡片 */
.status-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: var(--space-sm); }
.status-item { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-radius: var(--radius-md); background: var(--bg-page); }
.status-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.status-count { font-size: 20px; font-weight: 600; color: var(--text-primary); line-height: 1; }
.status-name { font-size: 12px; color: var(--text-hint); }

/* ========== 功能快捷入口 (Feature Card) ========== */
.feature-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-md);
    margin-bottom: var(--space-lg);
}
.feature-card {
    background: var(--bg-surface);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-default);
    padding: var(--space-lg) var(--space-base);
    display: flex;
    align-items: center;
    gap: var(--space-base);
    cursor: pointer;
    transition: all .2s;
    text-decoration: none;
    color: inherit;
    min-height: 72px;
}
.feature-card:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--text-disabled);
    transform: translateY(-1px);
}
.feature-card:active { transform: translateY(0); }
.feature-icon {
    width: 56px;
    height: 56px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.feature-icon svg { width: 28px; height: 28px; }
.feature-icon.blue { background: var(--info-light); color: var(--info); }
.feature-icon.green { background: var(--success-light); color: var(--success); }
.feature-icon.orange { background: var(--warning-light); color: var(--warning); }
.feature-icon.teal { background: var(--primary-light); color: var(--primary); }
/* 分诊快捷入口用警示底色 */
.feature-icon.alert { background: var(--danger-light); color: var(--danger); }
.feature-info { flex: 1; }
.feature-title {
    font: 500 15px/1.4 var(--font-family);
    color: var(--text-primary);
    margin-bottom: 2px;
}
.feature-desc {
    font: var(--text-secondary-size);
    color: var(--text-hint);
}

/* ========== 标签选择器 (Tag Selector) ========== */
.tag-selector {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-sm);
    margin-bottom: var(--space-md);
}
.tag-option {
    min-width: 84px;
    height: 36px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-default);
    background: var(--bg-surface);
    color: var(--text-secondary);
    font: var(--text-secondary-size);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 var(--space-md);
    transition: all .15s;
    user-select: none;
}
.tag-option:hover {
    border-color: var(--primary);
    color: var(--primary);
}
.tag-option.selected {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}
/* 警告类标签 */
.tag-option.selected.warning-tag {
    background: var(--warning);
    border-color: var(--warning);
}
.tag-option.selected.danger-tag {
    background: var(--danger);
    border-color: var(--danger);
}

/* ========== AI 分析面板 ========== */
.ai-panel {
    background: var(--ai-light);
    border: 1px solid var(--ai-border);
    border-radius: var(--radius-lg);
    padding: var(--space-base);
    margin-top: var(--space-md);
}
.ai-panel-header {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    margin-bottom: var(--space-md);
}
.ai-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--ai);
    color: #fff;
    font: 500 11px/1 var(--font-family);
    padding: 3px 8px;
    border-radius: var(--radius-sm);
    letter-spacing: 0.5px;
}
.ai-panel-title {
    font: var(--text-h3);
    color: var(--ai);
}
.ai-panel-body {
    font: var(--text-body);
    color: var(--text-secondary);
    line-height: 1.8;
}

/* ========== 风险指标卡 (Risk Card) ========== */
.risk-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: var(--space-md);
}
.risk-card {
    border-radius: var(--radius-lg);
    padding: var(--space-base);
    text-align: center;
    min-height: 56px;
}
.risk-card .risk-value {
    font: 500 20px/1.2 var(--font-family);
}
.risk-card .risk-label {
    font: var(--text-caption);
    margin-top: 4px;
}
.risk-low { background: var(--success-light); color: var(--success); }
.risk-medium { background: var(--warning-light); color: var(--warning); }
.risk-high { background: var(--danger-light); color: var(--danger); }

/* ========== 评估问卷 (Assessment Questionnaire) ========== */
.assess-item {
    padding: 10px 0;
    border-bottom: 1px solid var(--border-default);
}
.assess-item:last-child { border-bottom: none; }
.assess-item-label {
    font: 500 13px/1.4 var(--font-family);
    color: var(--text-primary);
    margin-bottom: 6px;
}
.assess-item-options {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.assess-item-options.mmse-score-input {
    align-items: center;
    gap: 8px;
}
.mmse-input {
    width: 60px !important;
    text-align: center;
    font-weight: 600;
    font-size: 16px;
}
.assess-radio {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-default);
    cursor: pointer;
    font-size: 12px;
    color: var(--text-secondary);
    transition: all 0.15s ease;
    background: var(--bg-surface);
}
.assess-radio:hover {
    border-color: var(--primary);
    background: var(--primary-light);
}
.assess-radio input[type="radio"] {
    accent-color: var(--primary);
    margin: 0;
}
.assess-radio:has(input:checked) {
    border-color: var(--primary);
    background: var(--primary-light);
    color: var(--primary);
    font-weight: 500;
}

/* ========== 预警条 (Alert Bar) ========== */
.alert-bar {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    height: 28px;
    border-radius: var(--radius-sm);
    padding: 0 var(--space-md);
    font: var(--text-secondary-size);
    margin-bottom: var(--space-xs);
}
.alert-bar::before {
    content: '';
    width: 5px;
    height: 5px;
    border-radius: 50%;
    flex-shrink: 0;
}
.alert-bar.urgent { background: var(--danger-light); color: var(--danger); }
.alert-bar.urgent::before { background: var(--danger); }
.alert-bar.warning { background: var(--warning-light); color: var(--warning); }
.alert-bar.warning::before { background: var(--warning); }
.alert-bar.normal { background: var(--success-light); color: var(--success); }
.alert-bar.normal::before { background: var(--success); }

/* ========== 时间线 (Timeline) ========== */
.timeline {
    position: relative;
    padding-left: 20px;
}
.timeline::before {
    content: '';
    position: absolute;
    left: 5px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--border-default);
}
.timeline-item {
    position: relative;
    padding: var(--space-sm) 0 var(--space-md) var(--space-md);
    font: var(--text-secondary-size);
    color: var(--text-secondary);
}
.timeline-item::before {
    content: '';
    position: absolute;
    left: -18px;
    top: 10px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-disabled);
}
.timeline-item.type-assessment::before { background: var(--info); }
.timeline-item.type-triage::before { background: var(--danger); }
.timeline-item.type-report::before { background: var(--ai); }
.timeline-item.type-health::before { background: var(--success); }
.timeline-item .timeline-time {
    color: var(--text-hint);
    font: var(--text-caption);
    margin-right: var(--space-sm);
}
.timeline-item .timeline-text {
    color: var(--text-secondary);
}

/* ========== 待办提醒 ========== */
.todo-item {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) 0;
    border-bottom: 1px solid var(--border-default);
    font: var(--text-secondary-size);
    color: var(--text-secondary);
}
.todo-item:last-child { border-bottom: none; }
.todo-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}
.todo-dot.urgent { background: var(--danger); }
.todo-dot.warning { background: var(--warning); }
.todo-dot.info { background: var(--info); }

/* ========== 表格 ========== */
.table-wrapper { overflow-x: auto; }
table {
    width: 100%;
    border-collapse: collapse;
    font: var(--text-secondary-size);
}
th {
    background: var(--bg-elevated);
    padding: 10px var(--space-md);
    text-align: left;
    font-weight: 500;
    color: var(--text-hint);
    border-bottom: 2px solid var(--border-default);
    white-space: nowrap;
}
td {
    padding: 10px var(--space-md);
    border-bottom: 1px solid var(--border-default);
    color: var(--text-secondary);
}
tr:hover td { background: var(--bg-elevated); }

/* ========== 按钮 ========== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-base);
    border-radius: var(--radius-md);
    font: 500 13px/1.4 var(--font-family);
    cursor: pointer;
    border: 1px solid transparent;
    transition: all .15s;
    text-decoration: none;
    white-space: nowrap;
    min-height: 36px;
}
.btn:active { transform: scale(.97); }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { filter: brightness(1.05); }
.btn-warning { background: var(--warning); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { filter: brightness(1.05); }
.btn-ai { background: var(--ai); color: #fff; }
.btn-ai:hover { filter: brightness(1.05); }
.btn-outline { background: var(--bg-surface); color: var(--text-secondary); border-color: var(--border-default); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }
.btn-ghost { background: transparent; color: var(--text-secondary); }
.btn-ghost:hover { background: var(--bg-elevated); }
.btn-sm { padding: var(--space-xs) 10px; font-size: 12px; min-height: 28px; }

/* ========== 表单 ========== */
.form-group { margin-bottom: var(--space-md); }
.form-label {
    display: block;
    font: 500 13px/1.4 var(--font-family);
    color: var(--text-secondary);
    margin-bottom: var(--space-xs);
}
.form-input, .form-select, .form-textarea {
    width: 100%;
    padding: var(--space-sm) var(--space-md);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    font: var(--text-body);
    color: var(--text-primary);
    background: var(--bg-surface);
    transition: border-color .2s, box-shadow .2s;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59,109,17,.1);
}
.form-textarea { resize: vertical; min-height: 60px; }
.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: var(--space-md);
}
.form-hint { font: var(--text-caption); color: var(--text-hint); margin-top: 2px; }

/* ========== 标签 ========== */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 2px var(--space-sm);
    border-radius: var(--radius-full);
    font: var(--text-caption);
    font-weight: 500;
}
.badge-blue { background: var(--info-light); color: var(--info); }
.badge-green { background: var(--success-light); color: var(--success); }
.badge-orange { background: var(--warning-light); color: var(--warning); }
.badge-red { background: var(--danger-light); color: var(--danger); }
.badge-gray { background: var(--bg-elevated); color: var(--text-secondary); }
.badge-ai { background: var(--ai-light); color: var(--ai); }

/* ========== 模态框 ========== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(44,44,42,.45);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
    opacity: 0;
    visibility: hidden;
    transition: all .3s;
    backdrop-filter: blur(2px);
}
.modal-overlay.show { opacity: 1; visibility: visible; }
.modal {
    background: var(--bg-surface);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    width: 90%;
    max-width: 680px;
    max-height: 85vh;
    overflow: hidden;
    transform: scale(.95) translateY(10px);
    transition: transform .3s;
    display: flex;
    flex-direction: column;
}
.modal-overlay.show .modal { transform: scale(1) translateY(0); }
.modal-header {
    padding: var(--space-base) var(--space-lg);
    border-bottom: 1px solid var(--border-default);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}
.modal-header h3 { font: var(--text-h3); }
.modal-close {
    width: 32px; height: 32px;
    border-radius: var(--radius-sm);
    border: none;
    background: var(--bg-elevated);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: var(--text-hint);
    transition: background .15s;
}
.modal-close:hover { background: var(--border-default); }
.modal-body { padding: var(--space-lg); flex: 1; overflow-y: auto; }
.modal-footer {
    padding: var(--space-md) var(--space-lg);
    border-top: 1px solid var(--border-default);
    display: flex;
    justify-content: flex-end;
    gap: var(--space-sm);
    flex-shrink: 0;
}

/* 紧急模态框头部 */
.modal-header.emergency {
    background: var(--danger);
    color: #fff;
    border-bottom: none;
}
.modal-header.emergency h3 { color: #fff; }
.modal-header.emergency .modal-close {
    background: rgba(255,255,255,.2);
    color: #fff;
}
.modal-header.emergency .modal-close:hover { background: rgba(255,255,255,.3); }

/* ========== 空状态 ========== */
.empty-state {
    text-align: center;
    padding: var(--space-2xl) var(--space-lg);
    color: var(--text-hint);
}
.empty-state svg { width: 64px; height: 64px; margin-bottom: var(--space-md); opacity: .5; }
.empty-state p { font: var(--text-body); }

/* ========== 加载 ========== */
.spinner {
    width: 20px; height: 20px;
    border: 2px solid var(--border-default);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin .6s linear infinite;
    display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* AI加载动画 */
.ai-loading {
    display: inline-flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-base);
    background: var(--ai-light);
    border-radius: var(--radius-full);
    font: var(--text-secondary-size);
    color: var(--ai);
}
.ai-loading .dot-pulse {
    display: inline-flex;
    gap: 3px;
}
.ai-loading .dot-pulse span {
    width: 5px; height: 5px;
    background: var(--ai);
    border-radius: 50%;
    animation: dotBounce 1.2s infinite ease-in-out;
}
.ai-loading .dot-pulse span:nth-child(2) { animation-delay: .2s; }
.ai-loading .dot-pulse span:nth-child(3) { animation-delay: .4s; }
@keyframes dotBounce {
    0%, 80%, 100% { opacity: .3; transform: scale(.8); }
    40% { opacity: 1; transform: scale(1); }
}

/* ========== 评分条 ========== */
.score-bar {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    margin: var(--space-sm) 0;
}
.score-bar-label { font: var(--text-secondary-size); color: var(--text-secondary); width: 80px; flex-shrink: 0; }
.score-bar-track {
    flex: 1;
    height: 8px;
    background: var(--bg-elevated);
    border-radius: var(--radius-full);
    overflow: hidden;
}
.score-bar-fill {
    height: 100%;
    border-radius: var(--radius-full);
    transition: width .5s;
}
.score-bar-value { font: 500 12px/1 var(--font-family); width: 40px; text-align: right; color: var(--text-secondary); }

/* ========== 分诊等级颜色 ========== */
.triage-red { color: var(--danger); font-weight: 700; }
.triage-orange { color: var(--warning); font-weight: 700; }
.triage-yellow { color: #9A7B1A; font-weight: 600; }
.triage-green { color: var(--success); font-weight: 600; }

/* ========== 步骤进度条 ========== */
.step-progress {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    margin-bottom: var(--space-lg);
}
.step-item {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
}
.step-dot {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--bg-elevated);
    border: 2px solid var(--border-default);
    display: flex;
    align-items: center;
    justify-content: center;
    font: 500 12px/1 var(--font-family);
    color: var(--text-hint);
    transition: all .2s;
}
.step-dot.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}
.step-dot.done {
    background: var(--success);
    border-color: var(--success);
    color: #fff;
}
.step-text {
    font: var(--text-secondary-size);
    color: var(--text-hint);
}
.step-text.active { color: var(--primary); font-weight: 500; }
.step-text.done { color: var(--success); }
.step-line {
    width: 40px;
    height: 2px;
    background: var(--border-default);
    margin: 0 var(--space-xs);
}
.step-line.done { background: var(--success); }

/* ========== Tab切换 ========== */
.tabs {
    display: flex;
    border-bottom: 2px solid var(--border-default);
    margin-bottom: var(--space-base);
}
.tab {
    padding: var(--space-sm) var(--space-base);
    font: var(--text-secondary-size);
    color: var(--text-hint);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all .2s;
}
.tab:hover { color: var(--text-secondary); }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 500; }

/* ========== 数据面板网格 ========== */
.data-panels {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-base);
}
.data-panels .card:last-child:nth-child(odd) {
    grid-column: 1 / -1;
}

/* ========== 体征网格 ========== */
.vitals-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: var(--space-md);
}
.vital-item {
    text-align: center;
    padding: var(--space-md);
    border-radius: var(--radius-md);
    background: var(--bg-elevated);
}
.vital-value {
    font: 500 20px/1.2 var(--font-family);
    color: var(--text-primary);
}
.vital-label {
    font: var(--text-caption);
    color: var(--text-hint);
    margin-top: var(--space-xs);
}
.vital-value.abnormal { color: var(--danger); }

/* ========== Toast ========== */
.toast {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    padding: var(--space-sm) var(--space-base);
    border-radius: var(--radius-md);
    font: var(--text-secondary-size);
    box-shadow: var(--shadow-md);
    animation: toastIn .3s;
    max-width: 360px;
}
.toast.success { background: var(--success); color: #fff; }
.toast.error { background: var(--danger); color: #fff; }
.toast.warning { background: var(--warning); color: #fff; }
.toast.info { background: var(--info); color: #fff; }
@keyframes toastIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ========== 双操作出口 ========== */
.action-group {
    display: flex;
    gap: var(--space-sm);
    margin-top: var(--space-base);
}
.action-group .btn-primary-action { flex: 1; }

/* ========== 响应式 ========== */
@media (max-width: 1024px) {
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .data-panels { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .main-content { margin-left: 0; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .feature-grid { grid-template-columns: 1fr; }
    .form-row { grid-template-columns: 1fr; }
    .modal { width: 95%; border-radius: var(--radius-lg); }
    .risk-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
    .stats-grid { grid-template-columns: 1fr 1fr; }
    .page { padding: var(--space-base); }
    .vitals-grid { grid-template-columns: repeat(2, 1fr); }
    .step-progress { flex-wrap: wrap; gap: var(--space-xs); }
    .step-line { width: 20px; }
}

/* ========== 整合新增样式 ========== */

/* 表格 */
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th, .table td { padding: var(--space-sm) var(--space-md); text-align: left; border-bottom: 1px solid var(--border-default); }
.table th { background: var(--bg-page); font-weight: 500; color: var(--text-secondary); font-size: 12px; }
.table tr:hover td { background: var(--primary-light); }

/* 卡片网格 */
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: var(--space-base); }

/* 特性网格增加第4列 */
.feature-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--space-base); margin-top: var(--space-lg); }
@media (max-width: 1024px) { .feature-grid { grid-template-columns: repeat(2, 1fr); } }

/* 按钮补充 */
.btn-info { background: var(--info); color: #fff; }
.btn-info:hover { background: #1a6eb8; }

/* 功能图标补充 */
.feature-icon.purple svg { color: var(--ai); }

/* 输入框补充 */
.input { width: 100%; padding: var(--space-sm) var(--space-md); border: 1px solid var(--border-default); border-radius: var(--radius-md); font: var(--text-body); background: var(--bg-surface); transition: border-color .2s; }
.input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-light); }
select.input { cursor: pointer; }

/* 标签补充 */
.badge-gray { background: var(--bg-page); color: var(--text-hint); }
.badge-red { background: var(--danger-light); color: var(--danger); }
.badge-blue { background: var(--info-light); color: var(--info); }
.badge-green { background: var(--success-light); color: var(--success); }
.badge-orange { background: var(--warning-light); color: var(--warning); }

