/* Dipper（司南）— 全局样式（Enroll + Analytics 合并） */
* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: "Microsoft YaHei", "微软雅黑", sans-serif; background: #f0f2f5; color: #333; min-height: 100vh; }

/* 导航栏 */
.navbar { background: #2c3e50; color: white; padding: 0 20px; display: flex; justify-content: space-between; align-items: center; height: 56px; box-shadow: 0 2px 8px rgba(0,0,0,.15); }
.navbar .title { display: flex; align-items: center; }
.navbar-logo { height: 36px; width: auto; object-fit: contain; }
.navbar .user-info { display: flex; align-items: center; gap: 12px; font-size: 13px; }
.navbar .user-info span { color: #bdc3c7; }
.navbar button { background: #e74c3c; color: white; border: none; padding: 6px 14px; border-radius: 4px; cursor: pointer; font-size: 12px; }
.navbar button:hover { background: #c0392b; }

/* 布局 */
.layout { display: flex; height: calc(100vh - 56px); }
.sidebar { width: 200px; background: white; border-right: 1px solid #ddd; padding: 12px 0; flex-shrink: 0; overflow-y: auto; }
.sidebar .menu-item { display: block; padding: 12px 24px; cursor: pointer; color: #555; transition: .2s; font-size: 14px; border-left: 3px solid transparent; text-decoration: none; }
.sidebar .menu-item:hover { background: #f8f9fa; color: #2c3e50; }
.sidebar .menu-item.active { background: #eef2f7; color: #2980b9; border-left-color: #2980b9; font-weight: bold; }
.sidebar .menu-group-title { padding: 16px 24px 6px 24px; font-size: 12px; color: #999; font-weight: bold; text-transform: uppercase; letter-spacing: 1px; border-top: 1px solid #eee; margin-top: 8px; }
.sidebar .menu-group-title:first-child { border-top: none; margin-top: 0; }
.main-content { flex: 1; padding: 20px; overflow-y: auto; }

/* 登录页 */
.login-container { display: flex; justify-content: flex-end; align-items: center; min-height: 100vh; background: linear-gradient(135deg, #2c3e50 0%, #3498db 100%); position: relative; overflow: hidden; padding-right: 10%; }
.login-container::before { content: ''; position: absolute; top: 0; left: 0; right: 0; bottom: 0; background: url('/img/dipper_splash_screen.png') left center/cover; opacity: 0.18; z-index: 0; }
.login-box { position: relative; z-index: 1; background: rgba(255,255,255,0.95); border-radius: 12px; padding: 40px; width: 400px; box-shadow: 0 8px 30px rgba(0,0,0,.2); }
.login-logo { display: block; width: 100px; height: 100px; margin: 0 auto 16px; border-radius: 16px; object-fit: contain; }
.login-box h1 { text-align: center; color: #2c3e50; margin-bottom: 4px; font-size: 24px; }
.login-box .subtitle { text-align: center; color: #2c3e50; font-size: 15px; font-weight: bold; margin-bottom: 24px; }
.login-box .form-group { margin-bottom: 16px; }
.login-box label { display: block; margin-bottom: 6px; font-size: 13px; color: #555; }
.login-box input { width: 100%; padding: 10px 12px; border: 1px solid #ddd; border-radius: 4px; font-size: 14px; }
.login-box input:focus { outline: none; border-color: #3498db; }
.login-box .btn-login { width: 100%; padding: 10px; background: #2980b9; color: white; border: none; border-radius: 4px; font-size: 15px; cursor: pointer; margin-top: 8px; }
.login-box .btn-login:hover { background: #2471a3; }
.login-box .error-msg { color: #e74c3c; font-size: 12px; margin-top: 8px; text-align: center; }

/* 卡片 */
.card { background: white; border-radius: 6px; padding: 20px; box-shadow: 0 1px 4px rgba(0,0,0,.08); margin-bottom: 16px; }
.card h3 { font-size: 16px; color: #2c3e50; margin-bottom: 16px; padding-bottom: 10px; border-bottom: 1px solid #eee; }

/* 按钮 */
.btn { padding: 8px 18px; border: none; border-radius: 4px; cursor: pointer; font-size: 13px; transition: .2s; }
.btn-primary { background: #2980b9; color: white; }
.btn-primary:hover { background: #2471a3; }
.btn-success { background: #27ae60; color: white; }
.btn-success:hover { background: #219a52; }
.btn-danger { background: #e74c3c; color: white; }
.btn-danger:hover { background: #c0392b; }
.btn-warning { background: #f39c12; color: white; }
.btn-warning:hover { background: #d68910; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-group { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }

/* 表格 */
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 8px 10px; border-bottom: 1px solid #eee; text-align: left; }
th { background: #f8f9fa; color: #555; font-weight: bold; font-size: 12px; white-space: nowrap; }
tr:hover { background: #f8f9fa; }
.table-wrap { overflow-x: auto; max-height: 500px; overflow-y: auto; border: 1px solid #eee; border-radius: 6px; }

/* 分页 */
.pagination { display: flex; justify-content: center; align-items: center; gap: 8px; margin-top: 16px; }
.pagination button { padding: 5px 12px; border: 1px solid #ddd; background: white; border-radius: 4px; cursor: pointer; font-size: 12px; }
.pagination button:hover { background: #f0f2f5; }
.pagination button.active { background: #2980b9; color: white; border-color: #2980b9; }
.pagination span { font-size: 12px; color: #7f8c8d; }

/* 统计卡片（运营分析） */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; margin-bottom: 20px; }
.stat-card { background: white; border-radius: 8px; padding: 20px; text-align: center; box-shadow: 0 1px 4px rgba(0,0,0,.08); }
.stat-card .num { font-size: 28px; font-weight: bold; color: #2c3e50; }
.stat-card .label { font-size: 12px; color: #7f8c8d; margin-top: 4px; }
.stat-card .stat-value { font-size: 28px; font-weight: 700; color: #1a73e8; margin-bottom: 4px; }
.stat-card .stat-label { font-size: 13px; color: #888; }
.stat-negative { color: #d32f2f !important; }

/* 图表 */
.chart-wrap { width: 100%; max-height: 350px; position: relative; }
.chart-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px; }

/* 标签页 */
.tabs { display: flex; gap: 0; border-bottom: 2px solid #e8e8e8; margin-bottom: 16px; }
.tab { padding: 10px 20px; cursor: pointer; font-size: 14px; color: #666; border-bottom: 2px solid transparent; margin-bottom: -2px; transition: all 0.2s; }
.tab:hover { color: #1a73e8; }
.tab.active { color: #1a73e8; border-bottom-color: #1a73e8; font-weight: 600; }

/* 加载动画 */
.loading { text-align: center; padding: 40px; color: #999; }
.spinner { display: inline-block; width: 32px; height: 32px; border: 3px solid #e8e8e8; border-top-color: #1a73e8; border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* 徽章 */
.badge { display: inline-block; padding: 2px 10px; border-radius: 12px; font-size: 12px; font-weight: 600; }
.badge-red { background: #fce4e4; color: #d32f2f; }
.badge-green { background: #e8f5e9; color: #2e7d32; }
.badge-blue { background: #e3f2fd; color: #1565c0; }
.badge-yellow { background: #fff3e0; color: #e65100; }

/* 文件上传 */
.upload-area { border: 2px dashed #ddd; border-radius: 8px; padding: 30px; text-align: center; cursor: pointer; transition: .2s; margin-bottom: 12px; }
.upload-area:hover { border-color: #3498db; background: #f0f8ff; }
.upload-area input[type="file"] { display: none; }
.upload-area .icon { font-size: 32px; margin-bottom: 8px; }

/* 进度条 */
.progress-bar-wrap { background: #ecf0f1; border-radius: 4px; height: 6px; margin: 12px 0; overflow: hidden; }
.progress-bar-inner { height: 100%; background: #27ae60; border-radius: 4px; width: 0; transition: width .3s; }

/* 消息 */
.message { padding: 10px 16px; border-radius: 4px; margin-bottom: 12px; font-size: 13px; }
.message.success { background: #d4edda; color: #155724; border: 1px solid #c3e6cb; }
.message.error { background: #f8d7da; color: #721c24; border: 1px solid #f5c6cb; }
.message.info { background: #d1ecf1; color: #0c5460; border: 1px solid #bee5eb; }

/* 搜索框 */
.search-bar { display: flex; gap: 8px; margin-bottom: 12px; }
.search-bar input { padding: 6px 10px; border: 1px solid #ddd; border-radius: 4px; font-size: 13px; }
.search-bar input:focus { outline: none; border-color: #3498db; }
.search-bar select { padding: 8px 12px; border: 1px solid #ddd; border-radius: 6px; font-size: 13px; }

/* Modal */
.modal-overlay { display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,.5); z-index: 1000; justify-content: center; align-items: center; }
.modal-overlay.show { display: flex; }
.modal-box { background: white; border-radius: 8px; padding: 24px; width: 400px; max-width: 90%; box-shadow: 0 8px 30px rgba(0,0,0,.2); }
.modal-box h3 { margin-bottom: 16px; }
.modal-box .form-group { margin-bottom: 12px; }
.modal-box label { display: block; font-size: 13px; color: #555; margin-bottom: 4px; }
.modal-box input, .modal-box select { width: 100%; padding: 8px 10px; border: 1px solid #ddd; border-radius: 4px; font-size: 13px; }
.modal-box .btn-row { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }

/* 浮动筛选弹窗 */
.filter-popup { position: fixed; z-index: 1001; background: white; border: 1px solid #ddd; border-radius: 8px; padding: 16px; box-shadow: 0 4px 20px rgba(0,0,0,.15); min-width: 200px; }
.filter-popup input[type=text], .filter-popup input[type=number], .filter-popup input[type=date] { padding: 6px 8px; border: 1px solid #ddd; border-radius: 4px; font-size: 13px; }
.filter-popup label { display: block; padding: 3px 0; cursor: pointer; font-size: 13px; }
.filter-popup label:hover { color: #1a73e8; }
.filter-backdrop { position: fixed; top: 0; left: 0; right: 0; bottom: 0; z-index: 1000; background: transparent; }

/* 筛选标签 */
.filter-tags { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.filter-tag { display: inline-flex; align-items: center; gap: 4px; background: #e8f4fd; color: #1976d2; padding: 2px 8px; border-radius: 3px; font-size: 12px; cursor: pointer; }
.filter-tag:hover { background: #bbdefb; }

/* 表单 */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; margin-bottom: 6px; font-size: 13px; font-weight: 600; color: #555; }
.form-group input, .form-group select { width: 100%; padding: 10px 12px; border: 1px solid #ddd; border-radius: 6px; font-size: 14px; outline: none; transition: border-color 0.2s; }
.form-group input:focus, .form-group select:focus { border-color: #1a73e8; }
.form-row { display: flex; gap: 16px; }
.form-row .form-group { flex: 1; }

/* 隐藏类 */
.hidden { display: none !important; }

/* 领导驾驶舱 - KPI 卡片网格 */
.kpi-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; margin-bottom: 20px; }
.kpi-card { background: white; border-radius: 8px; padding: 16px 12px; text-align: center; box-shadow: 0 1px 4px rgba(0,0,0,.08); transition: transform .15s; }
.kpi-card:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,.12); }
.kpi-icon { font-size: 22px; margin-bottom: 4px; }
.kpi-value { font-size: 22px; font-weight: 700; color: #1a73e8; margin-bottom: 2px; }
.kpi-label { font-size: 11px; color: #888; }
.kpi-card.kpi-negative .kpi-value { color: #d32f2f; }

/* 响应式 */
@media (max-width: 900px) { .chart-row { grid-template-columns: 1fr; } }
@media (max-width: 768px) {
  .layout { flex-direction: column; }
  .sidebar { width: 100%; display: flex; overflow-x: auto; padding: 0; }
  .sidebar .menu-item { flex-shrink: 0; border-left: none; border-bottom: 3px solid transparent; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
}

/* Toast 通知 */
.toast-container {
    position: fixed; top: 16px; right: 16px; z-index: 9999;
    display: flex; flex-direction: column; gap: 8px; max-width: 400px;
}
.toast {
    padding: 12px 20px; border-radius: 8px; color: #fff;
    font-size: 14px; box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    animation: toast-in 0.3s ease, toast-out 0.3s ease 2.7s forwards;
    word-break: break-all;
}
.toast-error { background: #d32f2f; }
.toast-success { background: #2e7d32; }
.toast-warning { background: #f57c00; }
.toast-info { background: #1565c0; }
@keyframes toast-in { from { opacity: 0; transform: translateX(100%); } to { opacity: 1; transform: translateX(0); } }
@keyframes toast-out { from { opacity: 1; } to { opacity: 0; } }

/* 分组结果表行着色 */
.row-basic-disease { background: #fad1d1 !important; }
.row-basic-disease:hover { background: #f5baba !important; }
.row-not-grouped { background: #fff8f0 !important; }
.row-not-grouped:hover { background: #ffefe0 !important; }