/* ============================================================
   青禾诊伴管理后台 — 全局样式
   配色：主色 #0E9C8A（疗愈青绿）+ #F2785C（珊瑚橙）
   ============================================================ */

:root {
  --primary: #0E9C8A;
  --primary-light: #e8f7f5;
  --primary-dark: #0a7a6c;
  --accent: #F2785C;
  --accent-light: #fef0ec;
  --bg: #f5f7fa;
  --card: #ffffff;
  --border: #e8eaed;
  --text: #1a1a2e;
  --text-secondary: #6c7293;
  --text-muted: #9ca3af;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-lg: 0 10px 30px rgba(0,0,0,0.08);
  --radius: 12px;
  --radius-sm: 8px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ============================================================
   登录页
   ============================================================ */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
}

.login-card {
  background: var(--card);
  border-radius: 20px;
  padding: 48px 40px;
  width: 400px;
  box-shadow: var(--shadow-lg);
}

.login-card h1 {
  font-size: 24px;
  text-align: center;
  margin-bottom: 8px;
  color: var(--text);
}

.login-card .subtitle {
  text-align: center;
  color: var(--text-secondary);
  margin-bottom: 32px;
  font-size: 13px;
}

.login-card .input-group {
  margin-bottom: 20px;
}

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

.login-card input {
  width: 100%;
  padding: 12px 16px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  transition: border-color 0.2s;
  outline: none;
}

.login-card input:focus {
  border-color: var(--primary);
}

.login-card .btn-login {
  width: 100%;
  padding: 13px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  margin-top: 8px;
  transition: background 0.2s;
}

.login-card .btn-login:hover { background: var(--primary-dark); }
.login-card .btn-login:disabled { opacity: 0.6; cursor: not-allowed; }

.login-error {
  color: var(--danger);
  font-size: 13px;
  text-align: center;
  margin-top: 12px;
  display: none;
}

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

.sidebar {
  width: 220px;
  background: #1a1a2e;
  color: #fff;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
}

.sidebar-logo {
  padding: 24px 20px;
  font-size: 18px;
  font-weight: 700;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  display: flex;
  align-items: center;
  gap: 8px;
}

.sidebar-logo span { color: var(--primary); }

.sidebar-nav {
  flex: 1;
  padding: 16px 0;
}

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 20px;
  color: rgba(255,255,255,0.65);
  font-size: 14px;
  text-decoration: none;
  transition: all 0.2s;
  border-left: 3px solid transparent;
}

.sidebar-nav a:hover {
  color: #fff;
  background: rgba(255,255,255,0.05);
}

.sidebar-nav a.active {
  color: #fff;
  background: rgba(14,156,138,0.15);
  border-left-color: var(--primary);
}

.sidebar-nav a .icon { font-size: 18px; width: 24px; text-align: center; }

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid rgba(255,255,255,0.1);
  font-size: 12px;
  color: rgba(255,255,255,0.4);
}

.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.topbar {
  height: 60px;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
}

.topbar h2 { font-size: 18px; font-weight: 600; }

.topbar .user-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.topbar .user-info span { font-size: 13px; color: var(--text-secondary); }

.topbar .btn-logout {
  padding: 6px 16px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 13px;
  transition: all 0.2s;
}

.topbar .btn-logout:hover { border-color: var(--danger); color: var(--danger); }

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

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

.stat-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}

.stat-card .stat-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  margin-bottom: 12px;
}

.stat-card .stat-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
}

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

/* ============================================================
   表格
   ============================================================ */
.table-card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.table-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.table-header .filters {
  display: flex;
  gap: 12px;
  align-items: center;
}

.table-header select,
.table-header input {
  padding: 7px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
  outline: none;
}

.table-header select:focus,
.table-header input:focus { border-color: var(--primary); }

table {
  width: 100%;
  border-collapse: collapse;
}

table th {
  text-align: left;
  padding: 12px 16px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  background: #fafbfc;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  vertical-align: middle;
}

table tr:hover { background: #fafbfc; }

table tr:last-child td { border-bottom: none; }

/* 状态标签 */
.tag {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
}

.tag-success { background: #e8f5e9; color: #2e7d32; }
.tag-warning { background: #fff8e1; color: #f57f17; }
.tag-info { background: #e3f2fd; color: #1565c0; }
.tag-danger { background: #ffebee; color: #c62828; }
.tag-default { background: #f5f5f5; color: #616161; }

/* 按钮 */
.btn {
  padding: 6px 14px;
  border: none;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-outline { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }
.btn-danger { background: transparent; border: 1px solid var(--danger); color: var(--danger); }
.btn-danger:hover { background: var(--danger); color: #fff; }
.btn-accent { background: var(--accent); color: #fff; }
.btn-accent:hover { background: #e8694a; }

/* 分页 */
.pagination {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 16px 20px;
}

.pagination button {
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--card);
  cursor: pointer;
  font-size: 13px;
  transition: all 0.2s;
}

.pagination button:hover:not(:disabled) { border-color: var(--primary); color: var(--primary); }
.pagination button:disabled { opacity: 0.4; cursor: not-allowed; }
.pagination .page-info { font-size: 13px; color: var(--text-secondary); margin: 0 8px; }

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

.empty-state .icon { font-size: 48px; margin-bottom: 12px; }

/* 加载状态 */
.loading { text-align: center; padding: 40px; color: var(--text-muted); }

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.modal-overlay.show { display: flex; }

.modal {
  background: var(--card);
  border-radius: var(--radius);
  padding: 24px;
  width: 480px;
  max-width: 90%;
  max-height: 80vh;
  overflow-y: auto;
}

.modal h3 { margin-bottom: 16px; font-size: 16px; }

.modal .modal-body { margin-bottom: 20px; }

.modal .detail-row {
  display: flex;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}

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

.modal .detail-label {
  width: 100px;
  color: var(--text-secondary);
  font-size: 13px;
  flex-shrink: 0;
}

.modal .detail-value { font-size: 13px; flex: 1; }

.modal .modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

/* 图表 */
.chart-container {
  background: var(--card);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  margin-bottom: 24px;
}

.chart-container h3 { font-size: 15px; margin-bottom: 16px; }

.chart-bars {
  display: flex;
  align-items: flex-end;
  gap: 16px;
  height: 200px;
  padding-top: 20px;
}

.chart-bar-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.chart-bar {
  width: 100%;
  max-width: 50px;
  background: var(--primary);
  border-radius: 6px 6px 0 0;
  transition: height 0.3s;
  min-height: 4px;
  position: relative;
}

.chart-bar:hover { background: var(--primary-dark); }

.chart-bar-value {
  position: absolute;
  top: -22px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 11px;
  color: var(--text);
  font-weight: 600;
}

.chart-bar-label { font-size: 11px; color: var(--text-secondary); }
