/* ============================================================
   颐康养老院管理系统 - 全局样式
   ============================================================ */

/* --- CSS变量 --- */
:root {
  --primary: #4f7cff;
  --primary-dark: #3a63e8;
  --primary-light: #e8eeff;
  --success: #22c55e;
  --success-light: #dcfce7;
  --warning: #f59e0b;
  --warning-light: #fef3c7;
  --danger: #ef4444;
  --danger-light: #fee2e2;
  --info: #06b6d4;
  --purple: #a855f7;
  --purple-light: #f3e8ff;
  --teal: #14b8a6;
  --teal-light: #ccfbf1;

  --bg: #f0f4ff;
  --bg-card: #ffffff;
  --bg-sidebar: #1e2a4a;
  --sidebar-active: rgba(79, 124, 255, 0.2);
  --sidebar-hover: rgba(255,255,255,0.08);
  --text: #1e293b;
  --text-muted: #64748b;
  --text-light: #94a3b8;
  --border: #e2e8f0;

  --sidebar-w: 240px;
  --header-h: 60px;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 4px 24px rgba(0,0,0,0.06);
  --shadow-md: 0 8px 32px rgba(0,0,0,0.10);
  --transition: 0.3s ease;
}

/* --- 重置 --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'PingFang SC', 'Microsoft YaHei', 'Segoe UI', sans-serif; background: var(--bg); color: var(--text); font-size: 14px; line-height: 1.6; overflow-x: hidden; }
a { text-decoration: none; color: inherit; }
button { cursor: pointer; border: none; background: none; }
input, select, textarea { font-family: inherit; font-size: 14px; }
table { border-collapse: collapse; width: 100%; }
.hidden { display: none !important; }
.flex { display: flex; }
.items-center { align-items: center; }
.gap-2 { gap: 8px; }

/* ============================================================
   登录页
   ============================================================ */
.login-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; }
.login-bg {
  width: 100%; min-height: 100vh;
  background: linear-gradient(135deg, #1e2a4a 0%, #2d4080 50%, #3a63e8 100%);
  display: flex; align-items: center; justify-content: center;
  position: relative; overflow: hidden;
}
.login-bg::before {
  content: ''; position: absolute; inset: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.03'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}
.login-box {
  background: rgba(255,255,255,0.95);
  backdrop-filter: blur(20px);
  border-radius: 20px;
  padding: 48px 40px;
  width: 420px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
  position: relative; z-index: 1;
}
.login-logo { text-align: center; margin-bottom: 36px; }
.logo-icon {
  width: 72px; height: 72px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  font-size: 30px; color: #fff; margin-bottom: 16px;
  box-shadow: 0 8px 24px rgba(79,124,255,0.4);
  animation: pulse 2s infinite;
}
@keyframes pulse { 0%,100%{box-shadow:0 8px 24px rgba(79,124,255,0.4)} 50%{box-shadow:0 8px 36px rgba(79,124,255,0.7)} }
.login-logo h1 { font-size: 22px; font-weight: 700; color: var(--text); margin-bottom: 6px; }
.login-logo p { color: var(--text-muted); font-size: 13px; }
.login-form .form-group { margin-bottom: 20px; }
.login-form label { display: block; margin-bottom: 8px; font-weight: 600; color: var(--text); font-size: 13px; }
.login-form label i { color: var(--primary); margin-right: 6px; }
.login-form input {
  width: 100%; padding: 12px 16px;
  border: 2px solid var(--border); border-radius: var(--radius-sm);
  outline: none; transition: var(--transition);
  background: #f8fafc;
}
.login-form input:focus { border-color: var(--primary); background: #fff; box-shadow: 0 0 0 4px rgba(79,124,255,0.1); }
.login-error { background: var(--danger-light); color: var(--danger); padding: 10px 14px; border-radius: var(--radius-sm); margin-bottom: 16px; font-size: 13px; }
.btn-login {
  width: 100%; padding: 14px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff; border-radius: var(--radius-sm); font-size: 15px; font-weight: 600;
  transition: var(--transition); letter-spacing: 1px;
}
.btn-login:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(79,124,255,0.4); }

/* ============================================================
   主布局
   ============================================================ */
.main-app { display: flex; min-height: 100vh; }

/* --- 侧边栏 --- */
.sidebar {
  width: var(--sidebar-w); background: var(--bg-sidebar);
  display: flex; flex-direction: column;
  position: fixed; top: 0; left: 0; bottom: 0; z-index: 100;
  transition: width var(--transition);
  box-shadow: 4px 0 20px rgba(0,0,0,0.15);
}
.sidebar.collapsed { width: 64px; }
.sidebar-header {
  height: var(--header-h); display: flex; align-items: center; justify-content: space-between;
  padding: 0 16px; border-bottom: 1px solid rgba(255,255,255,0.08);
  flex-shrink: 0;
}
.sidebar-logo { display: flex; align-items: center; gap: 10px; }
.sidebar-logo i { font-size: 22px; color: var(--primary); flex-shrink: 0; }
.sidebar-title { font-size: 16px; font-weight: 700; color: #fff; white-space: nowrap; overflow: hidden; }
.sidebar.collapsed .sidebar-title { display: none; }
.sidebar-toggle { color: rgba(255,255,255,0.6); font-size: 16px; padding: 6px; border-radius: 6px; transition: var(--transition); }
.sidebar-toggle:hover { background: var(--sidebar-hover); color: #fff; }

.sidebar-nav { flex: 1; padding: 12px 0; overflow-y: auto; overflow-x: hidden; }
.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 4px; }
.nav-group { margin-bottom: 8px; }
.nav-group-title {
  display: block; font-size: 10px; font-weight: 600; color: rgba(255,255,255,0.35);
  padding: 6px 20px 4px; letter-spacing: 1px; text-transform: uppercase; white-space: nowrap;
}
.sidebar.collapsed .nav-group-title { display: none; }
.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 20px; color: rgba(255,255,255,0.65);
  transition: var(--transition); position: relative; white-space: nowrap;
  border-radius: 0 24px 24px 0; margin-right: 12px;
}
.nav-item:hover { background: var(--sidebar-hover); color: #fff; }
.nav-item.active { background: var(--sidebar-active); color: var(--primary); font-weight: 600; }
.nav-item.active::before {
  content: ''; position: absolute; left: 0; top: 50%; transform: translateY(-50%);
  width: 3px; height: 24px; background: var(--primary); border-radius: 0 3px 3px 0;
}
.nav-item i { font-size: 16px; flex-shrink: 0; width: 20px; text-align: center; }
.nav-item span:first-of-type { flex: 1; }
.sidebar.collapsed .nav-item span { display: none; }
.nav-badge {
  background: var(--danger); color: #fff; font-size: 10px; font-weight: 700;
  padding: 1px 6px; border-radius: 10px; min-width: 18px; text-align: center;
}
.nav-badge-green { background: var(--success); }
.sidebar.collapsed .nav-badge { display: none; }

.sidebar-footer {
  padding: 16px; border-top: 1px solid rgba(255,255,255,0.08);
  display: flex; align-items: center; gap: 10px;
}
.sidebar.collapsed .user-detail { display: none; }
.user-avatar { font-size: 28px; color: rgba(255,255,255,0.6); flex-shrink: 0; }
.user-detail { flex: 1; overflow: hidden; }
.user-name { display: block; color: #fff; font-weight: 600; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { font-size: 11px; color: rgba(255,255,255,0.45); }
.btn-logout { color: rgba(255,255,255,0.5); font-size: 16px; padding: 6px; border-radius: 6px; transition: var(--transition); }
.btn-logout:hover { background: rgba(239,68,68,0.2); color: var(--danger); }

/* --- 主内容区 --- */
.main-content {
  flex: 1; margin-left: var(--sidebar-w); display: flex; flex-direction: column;
  min-height: 100vh; transition: margin-left var(--transition);
}
.sidebar.collapsed ~ .main-content { margin-left: 64px; }

/* --- 顶部栏 --- */
.top-header {
  height: var(--header-h); background: var(--bg-card);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px; border-bottom: 1px solid var(--border);
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
  position: sticky; top: 0; z-index: 50;
}
.header-left { display: flex; align-items: center; gap: 16px; }
.btn-menu-toggle { font-size: 18px; color: var(--text-muted); padding: 6px; border-radius: 6px; transition: var(--transition); }
.btn-menu-toggle:hover { background: var(--bg); color: var(--primary); }
.breadcrumb { font-size: 13px; color: var(--text-muted); display: flex; align-items: center; gap: 6px; }
.breadcrumb i { color: var(--primary); }
.header-right { display: flex; align-items: center; gap: 8px; }
.header-time { font-size: 13px; color: var(--text-muted); font-family: monospace; }
.btn-icon { padding: 7px 10px; border-radius: 8px; color: var(--text-muted); font-size: 15px; transition: var(--transition); position: relative; }
.btn-icon:hover { background: var(--bg); color: var(--primary); }
.dot-red { position: absolute; top: 4px; right: 4px; width: 7px; height: 7px; background: var(--danger); border-radius: 50%; border: 1px solid #fff; }
.dot-orange { position: absolute; top: 4px; right: 4px; width: 7px; height: 7px; background: var(--warning); border-radius: 50%; border: 1px solid #fff; }
.notif-badge-orange { background: var(--warning); }

/* --- 页面内容 --- */
.page-content { flex: 1; padding: 24px; overflow-y: auto; }
.page { animation: fadeIn 0.3s ease; }
@keyframes fadeIn { from{opacity:0;transform:translateY(10px)} to{opacity:1;transform:translateY(0)} }
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; }
.page-header h2 { font-size: 20px; font-weight: 700; color: var(--text); display: flex; align-items: center; gap: 10px; }
.page-header h2 i { color: var(--primary); }
.page-subtitle { font-size: 13px; color: var(--text-muted); margin-left: 8px; }

/* ============================================================
   按钮
   ============================================================ */
.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff; padding: 9px 20px; border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 600; transition: var(--transition);
  display: inline-flex; align-items: center; gap: 6px;
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 4px 16px rgba(79,124,255,0.35); }
.btn-secondary {
  background: var(--bg); color: var(--text);
  padding: 9px 20px; border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 600; border: 1px solid var(--border);
  transition: var(--transition); display: inline-flex; align-items: center; gap: 6px;
}
.btn-secondary:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-light); }
.btn-sm { padding: 5px 12px; font-size: 12px; border-radius: 6px; }
.btn-danger { background: var(--danger-light); color: var(--danger); border: 1px solid rgba(239,68,68,0.2); }
.btn-danger:hover { background: var(--danger); color: #fff; }
.btn-info { background: #e0f7fa; color: var(--info); border: 1px solid rgba(6,182,212,0.2); }
.btn-info:hover { background: var(--info); color: #fff; }
.btn-success { background: var(--success-light); color: var(--success); border: 1px solid rgba(34,197,94,0.2); }
.btn-success:hover { background: var(--success); color: #fff; }
.btn-group { display: flex; gap: 10px; }
.btn-search {
  background: var(--primary); color: #fff; padding: 9px 18px;
  border-radius: var(--radius-sm); font-size: 13px; font-weight: 600;
  display: inline-flex; align-items: center; gap: 6px; transition: var(--transition);
}
.btn-search:hover { background: var(--primary-dark); }

/* ============================================================
   仪表盘
   ============================================================ */
.stats-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 16px; margin-bottom: 24px; }
@media (max-width: 1400px) { .stats-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 900px) { .stats-grid { grid-template-columns: repeat(2, 1fr); } }

.stat-card {
  background: var(--bg-card); border-radius: var(--radius); padding: 20px;
  display: flex; align-items: center; gap: 16px;
  box-shadow: var(--shadow); transition: var(--transition); position: relative; overflow: hidden;
  flex-direction: column; align-items: flex-start;
}
.stat-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); }
.stat-card::after {
  content: ''; position: absolute; right: -20px; top: -20px;
  width: 100px; height: 100px; border-radius: 50%; opacity: 0.08;
}
.stat-blue::after { background: var(--primary); }
.stat-green::after { background: var(--success); }
.stat-orange::after { background: var(--warning); }
.stat-purple::after { background: var(--purple); }
.stat-teal::after { background: var(--teal); }

.stat-icon {
  width: 48px; height: 48px; border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; flex-shrink: 0;
}
.stat-blue .stat-icon { background: var(--primary-light); color: var(--primary); }
.stat-green .stat-icon { background: var(--success-light); color: var(--success); }
.stat-orange .stat-icon { background: var(--warning-light); color: var(--warning); }
.stat-purple .stat-icon { background: var(--purple-light); color: var(--purple); }
.stat-teal .stat-icon { background: var(--teal-light); color: var(--teal); }
.stat-number { font-size: 28px; font-weight: 800; color: var(--text); line-height: 1.2; }
.stat-label { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.stat-trend { font-size: 11px; color: var(--success); margin-top: 8px; }
.stat-red { color: var(--danger) !important; }

.charts-row { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; margin-bottom: 24px; }
@media (max-width: 1100px) { .charts-row { grid-template-columns: 1fr; } }
.chart-card {
  background: var(--bg-card); border-radius: var(--radius); padding: 20px;
  box-shadow: var(--shadow);
}
.chart-lg {} .chart-sm {}
.chart-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.chart-header h3 { font-size: 15px; font-weight: 600; color: var(--text); display: flex; align-items: center; gap: 8px; }
.chart-header h3 i { color: var(--primary); }

.data-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 1000px) { .data-row { grid-template-columns: 1fr; } }
.data-card { background: var(--bg-card); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.data-card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.data-card-header h3 { font-size: 15px; font-weight: 600; color: var(--text); display: flex; align-items: center; gap: 8px; }
.link-more { font-size: 12px; color: var(--primary); display: flex; align-items: center; gap: 4px; }
.link-more:hover { text-decoration: underline; }

.mini-table th, .mini-table td { padding: 8px 10px; text-align: left; border-bottom: 1px solid var(--border); font-size: 13px; }
.mini-table th { color: var(--text-muted); font-weight: 600; background: var(--bg); }
.mini-table tr:hover td { background: var(--primary-light); }

/* ============================================================
   过滤栏
   ============================================================ */
.filter-bar {
  background: var(--bg-card); border-radius: var(--radius); padding: 16px 20px;
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  margin-bottom: 16px; box-shadow: var(--shadow);
}
.search-input {
  flex: 1; min-width: 200px; padding: 9px 14px;
  border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  outline: none; transition: var(--transition); background: var(--bg);
}
.search-input:focus { border-color: var(--primary); background: #fff; }
.filter-select {
  padding: 9px 14px; border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  outline: none; transition: var(--transition); background: var(--bg); min-width: 140px;
}
.filter-select:focus { border-color: var(--primary); background: #fff; }
.check-label { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text); cursor: pointer; }
.check-label input { accent-color: var(--primary); }

/* ============================================================
   数据表格
   ============================================================ */
.table-card {
  background: var(--bg-card); border-radius: var(--radius);
  box-shadow: var(--shadow); overflow-x: auto;
}
.data-table { min-width: 100%; width: auto; white-space: nowrap; }
.data-table thead tr { background: var(--bg); }
.data-table th {
  padding: 12px 16px; text-align: left; font-size: 12px; font-weight: 700;
  color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px;
  border-bottom: 2px solid var(--border); white-space: nowrap;
}
.data-table td {
  padding: 13px 16px; border-bottom: 1px solid var(--border);
  font-size: 13px; color: var(--text); white-space: nowrap;
}
.data-table tbody tr:hover td { background: #f8fbff; }
.data-table tbody tr:last-child td { border-bottom: none; }

/* --- 状态标签 --- */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; border-radius: 20px; font-size: 11px; font-weight: 600; white-space: nowrap;
}
.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-blue { background: var(--primary-light); color: var(--primary); }
.badge-gray { background: #f1f5f9; color: var(--text-muted); }
.badge-purple { background: var(--purple-light); color: var(--purple); }

/* 操作列 */
.action-btns { display: flex; gap: 6px; flex-wrap: nowrap; }

/* ============================================================
   分页
   ============================================================ */
.pagination {
  display: flex; align-items: center; justify-content: flex-end;
  gap: 6px; padding: 14px 20px; border-top: 1px solid var(--border);
}
.pagination button {
  width: 32px; height: 32px; display: flex; align-items: center; justify-content: center;
  border-radius: 6px; font-size: 13px; color: var(--text-muted);
  border: 1px solid var(--border); background: var(--bg); transition: var(--transition);
}
.pagination button:hover, .pagination button.active {
  background: var(--primary); color: #fff; border-color: var(--primary);
}
.pagination .total-info { font-size: 12px; color: var(--text-muted); margin-right: auto; }

/* ============================================================
   房间管理
   ============================================================ */
.rooms-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.room-card {
  background: var(--bg-card); border-radius: var(--radius); padding: 20px;
  box-shadow: var(--shadow); transition: var(--transition); border: 2px solid transparent;
  cursor: pointer;
}
.room-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); border-color: var(--primary); }
.room-card.room-full { border-color: var(--danger); }
.room-card.room-maintenance { border-color: var(--warning); background: var(--warning-light); }
.room-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.room-no { font-size: 20px; font-weight: 800; color: var(--text); }
.room-floor { font-size: 12px; color: var(--text-muted); }
.room-type-badge { padding: 4px 12px; border-radius: 20px; font-size: 11px; font-weight: 600; background: var(--primary-light); color: var(--primary); }
.room-occupancy { margin-bottom: 14px; }
.occupancy-text { display: flex; justify-content: space-between; font-size: 12px; color: var(--text-muted); margin-bottom: 6px; }
.occupancy-bar { height: 6px; background: var(--border); border-radius: 3px; overflow: hidden; }
.occupancy-fill { height: 100%; background: var(--success); border-radius: 3px; transition: width 0.5s ease; }
.occupancy-fill.full { background: var(--danger); }
.occupancy-fill.half { background: var(--warning); }
.room-info { display: flex; gap: 16px; margin-bottom: 14px; font-size: 12px; color: var(--text-muted); }
.room-info i { color: var(--primary); margin-right: 4px; }
.room-residents { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; min-height: 24px; }
.resident-tag {
  background: var(--bg); border: 1px solid var(--border);
  padding: 2px 10px; border-radius: 12px; font-size: 11px; color: var(--text);
}
.room-actions { display: flex; gap: 8px; }

/* ============================================================
   员工卡片
   ============================================================ */
.staff-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.staff-card {
  background: var(--bg-card); border-radius: var(--radius); padding: 24px;
  box-shadow: var(--shadow); transition: var(--transition); text-align: center;
}
.staff-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); }
.staff-avatar {
  width: 68px; height: 68px; border-radius: 50%; margin: 0 auto 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 28px; font-weight: 800; color: #fff;
}
.staff-name { font-size: 16px; font-weight: 700; color: var(--text); margin-bottom: 4px; }
.staff-position { font-size: 12px; color: var(--text-muted); margin-bottom: 12px; }
.staff-dept { display: inline-flex; align-items: center; gap: 4px; padding: 4px 12px; background: var(--primary-light); color: var(--primary); border-radius: 20px; font-size: 11px; font-weight: 600; margin-bottom: 12px; }
.staff-info { font-size: 12px; color: var(--text-muted); display: flex; flex-direction: column; gap: 4px; }
.staff-info span { display: flex; align-items: center; justify-content: center; gap: 6px; }
.staff-actions { margin-top: 16px; display: flex; gap: 8px; justify-content: center; }

/* ============================================================
   活动管理
   ============================================================ */
.activities-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }
.activity-card {
  background: var(--bg-card); border-radius: var(--radius); padding: 20px;
  box-shadow: var(--shadow); transition: var(--transition); border-left: 4px solid var(--primary);
}
.activity-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); }
.activity-header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 12px; }
.activity-title { font-size: 16px; font-weight: 700; color: var(--text); }
.activity-meta { display: flex; flex-direction: column; gap: 6px; font-size: 12px; color: var(--text-muted); }
.activity-meta span { display: flex; align-items: center; gap: 6px; }
.activity-meta i { color: var(--primary); width: 14px; }
.activity-desc { font-size: 13px; color: var(--text-muted); margin: 10px 0; line-height: 1.5; }
.activity-actions { display: flex; gap: 8px; margin-top: 12px; }

/* ============================================================
   财务统计
   ============================================================ */
.finance-summary {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 20px;
}
.finance-sum-item {
  background: var(--bg-card); border-radius: var(--radius); padding: 20px;
  box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 8px;
}
.sum-label { font-size: 13px; color: var(--text-muted); }
.sum-value { font-size: 24px; font-weight: 800; }
.sum-green { color: var(--success); }
.sum-red { color: var(--danger); }
.sum-orange { color: var(--warning); }

/* ============================================================
   Tabs
   ============================================================ */
.tabs-bar { display: flex; gap: 4px; margin-bottom: 16px; background: var(--bg-card); padding: 6px; border-radius: var(--radius); box-shadow: var(--shadow); }
.tab-btn { padding: 8px 20px; border-radius: var(--radius-sm); font-size: 13px; font-weight: 600; color: var(--text-muted); transition: var(--transition); }
.tab-btn.active { background: var(--primary); color: #fff; box-shadow: 0 4px 12px rgba(79,124,255,0.3); }

/* ============================================================
   模态框
   ============================================================ */
.modal { position: fixed; inset: 0; z-index: 1000; display: flex; align-items: center; justify-content: center; padding: 20px; }
.modal-overlay { position: absolute; inset: 0; background: rgba(0,0,0,0.5); backdrop-filter: blur(4px); }
.modal-box {
  background: var(--bg-card); border-radius: 16px; width: 100%; max-width: 540px;
  max-height: 90vh; display: flex; flex-direction: column;
  box-shadow: 0 20px 60px rgba(0,0,0,0.2); position: relative; z-index: 1;
  animation: modalIn 0.3s ease;
}
.modal-xl { max-width: 900px; }
.modal-lg { max-width: 780px; }
@keyframes modalIn { from{opacity:0;transform:scale(0.9)} to{opacity:1;transform:scale(1)} }
.modal-header {
  padding: 20px 24px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; flex-shrink: 0;
}
.modal-header h3 { font-size: 17px; font-weight: 700; color: var(--text); }
.modal-close { width: 32px; height: 32px; border-radius: 8px; background: var(--bg); color: var(--text-muted); font-size: 16px; display: flex; align-items: center; justify-content: center; transition: var(--transition); }
.modal-close:hover { background: var(--danger-light); color: var(--danger); }
.modal-body { flex: 1; overflow-y: auto; padding: 24px; }

/* 表单 */
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 12px; font-weight: 600; color: var(--text-muted); margin-bottom: 6px; }
.form-group label .req { color: var(--danger); }
.form-group input, .form-group select, .form-group textarea {
  width: 100%; padding: 10px 14px;
  border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  outline: none; transition: var(--transition); background: var(--bg);
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
  border-color: var(--primary); background: #fff; box-shadow: 0 0 0 3px rgba(79,124,255,0.08);
}
.form-group textarea { resize: vertical; min-height: 80px; }
.form-divider { font-size: 12px; font-weight: 700; color: var(--text-muted); padding: 12px 0 8px; border-bottom: 1px solid var(--border); margin-bottom: 16px; text-transform: uppercase; letter-spacing: 0.5px; }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; padding-top: 16px; border-top: 1px solid var(--border); margin-top: 8px; }

/* 老人详情 */
.detail-tabs { display: flex; gap: 6px; margin-bottom: 20px; flex-wrap: wrap; }
.detail-tab { padding: 7px 16px; border-radius: 8px; font-size: 13px; font-weight: 600; color: var(--text-muted); background: var(--bg); transition: var(--transition); }
.detail-tab.active { background: var(--primary); color: #fff; }
.detail-section {}
.info-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.info-item { padding: 12px; background: var(--bg); border-radius: var(--radius-sm); }
.info-item .info-label { font-size: 11px; color: var(--text-muted); font-weight: 600; margin-bottom: 4px; }
.info-item .info-value { font-size: 14px; color: var(--text); font-weight: 600; }
.detail-mini-table { margin-top: 12px; }
.detail-mini-table th, .detail-mini-table td { padding: 9px 12px; border-bottom: 1px solid var(--border); font-size: 13px; }
.detail-mini-table th { background: var(--bg); color: var(--text-muted); font-weight: 600; }

/* ============================================================
   Toast 通知
   ============================================================ */
.toast-container { position: fixed; top: 24px; right: 24px; z-index: 2000; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: var(--bg-card); border-radius: var(--radius-sm); padding: 12px 18px;
  box-shadow: var(--shadow-md); display: flex; align-items: center; gap: 10px;
  font-size: 13px; font-weight: 600; min-width: 240px; max-width: 360px;
  animation: toastIn 0.3s ease; border-left: 4px solid var(--primary);
}
.toast-success { border-color: var(--success); }
.toast-error { border-color: var(--danger); }
.toast-warning { border-color: var(--warning); }
.toast i { font-size: 16px; }
.toast-success i { color: var(--success); }
.toast-error i { color: var(--danger); }
.toast-warning i { color: var(--warning); }
.toast-default i { color: var(--primary); }
@keyframes toastIn { from{opacity:0;transform:translateX(20px)} to{opacity:1;transform:translateX(0)} }

/* ============================================================
   其他工具类
   ============================================================ */
.text-center { text-align: center; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.empty-row td { text-align: center; padding: 32px; color: var(--text-muted); font-size: 13px; }

/* 滚动条 */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* ============================================================
   通知预警面板
   ============================================================ */
.notif-wrap { position: relative; }
.notif-badge {
  position: absolute; top: -4px; right: -4px;
  background: var(--danger); color: #fff;
  border-radius: 10px; font-size: 10px; font-weight: 700;
  min-width: 18px; height: 18px; display: flex; align-items: center; justify-content: center;
  padding: 0 4px;
}
.notif-panel {
  position: absolute; right: 0; top: calc(100% + 8px);
  width: 360px; background: #fff;
  border-radius: var(--radius); box-shadow: var(--shadow-md);
  border: 1px solid var(--border); z-index: 1000;
  animation: fadeIn 0.2s ease;
}
.notif-panel-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px; border-bottom: 1px solid var(--border);
  font-weight: 600; color: var(--text);
}
.notif-close { color: var(--text-muted); font-size: 14px; }
.notif-close:hover { color: var(--danger); }
.notif-list { max-height: 400px; overflow-y: auto; }
.notif-empty { text-align: center; padding: 32px; color: var(--text-muted); }
.notif-item {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 12px 16px; border-bottom: 1px solid var(--border);
  transition: background var(--transition);
}
.notif-item:hover { background: var(--bg); }
.notif-item:last-child { border-bottom: none; }
.notif-icon {
  width: 36px; height: 36px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; font-size: 14px;
}
.notif-icon.danger { background: var(--danger-light); color: var(--danger); }
.notif-icon.warning { background: var(--warning-light); color: var(--warning); }
.notif-icon.info { background: var(--primary-light); color: var(--primary); }
.notif-content { flex: 1; min-width: 0; }
.notif-title { font-weight: 600; font-size: 13px; color: var(--text); }
.notif-desc { font-size: 12px; color: var(--text-muted); margin-top: 2px; line-height: 1.4; }
.notif-time { font-size: 11px; color: var(--text-light); margin-top: 4px; }
@keyframes fadeIn { from{opacity:0;transform:translateY(-8px)} to{opacity:1;transform:translateY(0)} }

/* ============================================================
   预警列表（仪表盘）
   ============================================================ */
.alert-list { max-height: 280px; overflow-y: auto; }
.alert-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: var(--radius-sm);
  margin-bottom: 6px; font-size: 13px;
}
.alert-item.danger { background: var(--danger-light); border-left: 3px solid var(--danger); }
.alert-item.warning { background: var(--warning-light); border-left: 3px solid var(--warning); }
.alert-item.info { background: var(--primary-light); border-left: 3px solid var(--primary); }
.alert-item i { font-size: 16px; }
.alert-item.danger i { color: var(--danger); }
.alert-item.warning i { color: var(--warning); }
.alert-item.info i { color: var(--primary); }

/* ============================================================
   系统设置 - 导出卡片
   ============================================================ */
.export-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px; margin-top: 20px;
}
.export-card {
  background: var(--bg-card); border-radius: var(--radius);
  padding: 24px; display: flex; align-items: center; gap: 16px;
  box-shadow: var(--shadow); border: 1px solid var(--border);
}
.export-icon {
  width: 52px; height: 52px; border-radius: 14px;
  background: var(--primary-light); color: var(--primary);
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; flex-shrink: 0;
}
.export-info { flex: 1; }
.export-info h4 { font-size: 15px; font-weight: 600; color: var(--text); }
.export-info p { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.export-card .btn-primary { flex-shrink: 0; text-decoration: none; }

/* ============================================================
   表单卡片
   ============================================================ */
.form-card {
  background: var(--bg-card); border-radius: var(--radius);
  padding: 28px; box-shadow: var(--shadow);
}
.form-row { margin-bottom: 16px; }
.form-row label { display: block; font-size: 13px; font-weight: 600; color: var(--text-muted); margin-bottom: 6px; }
.form-input {
  width: 100%; padding: 10px 14px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-size: 14px; color: var(--text); background: #fff;
  transition: border-color var(--transition);
}
.form-input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(79,124,255,0.1); }

/* ============================================================
   膳食管理样式
   ============================================================ */
.meals-timeline { padding: 8px 0; }
.meals-timeline-inner { display: flex; flex-direction: column; gap: 20px; }
.meal-day-group { background: var(--bg-card); border-radius: 12px; padding: 16px 20px; box-shadow: 0 2px 12px rgba(0,0,0,0.06); }
.meal-date-header { font-size: 16px; font-weight: 700; color: var(--primary); margin-bottom: 14px; display: flex; align-items: center; gap: 8px; }
.meal-date-header i { font-size: 18px; }
.meal-card { border-left: 4px solid #4f7cff; background: linear-gradient(135deg,#fafbff,#f5f7ff); border-radius: 10px; padding: 14px 18px; margin-bottom: 12px; transition: transform .2s, box-shadow .2s; }
.meal-card:hover { transform: translateX(4px); box-shadow: 0 4px 15px rgba(79,124,255,0.1); }
.meal-card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.meal-type-badge { color: #fff; padding: 3px 12px; border-radius: 20px; font-size: 13px; font-weight: 600; }
.meal-cook { font-size: 12px; color: var(--text-muted); display: flex; align-items: center; gap: 4px; }
.meal-dishes { font-size: 14px; line-height: 1.6; color: var(--text); margin-bottom: 6px; }
.meal-notes { font-size: 12px; color: var(--text-light); display: flex; align-items: center; gap: 5px; }
.meal-actions { display: flex; gap: 6px; margin-top: 10px; opacity: 0; transition: opacity .2s; }
.meal-card:hover .meal-actions { opacity: 1; }

/* ============================================================
   排班考勤样式
   ============================================================ */
.shifts-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; padding: 8px 0; }
.shift-card { background: var(--bg-card); border-radius: 12px; padding: 18px; box-shadow: 0 2px 10px rgba(0,0,0,0.05); transition: transform .2s; }
.shift-card:hover { transform: translateY(-3px); box-shadow: 0 6px 20px rgba(0,0,0,0.08); }
.shift-name { font-size: 18px; font-weight: 700; margin-bottom: 6px; }
.shift-time { font-size: 14px; color: var(--text-muted); margin-bottom: 8px; display: flex; align-items: center; gap: 6px; }
.shift-desc { font-size: 13px; color: var(--text-light); margin-bottom: 12px; }
.shift-actions { display: flex; gap: 8px; }

.attendance-cards { min-height: 80px; }
.att-card { transition: box-shadow .2s; }
.att-card:hover { box-shadow: 0 4px 12px rgba(0,0,0,0.08); }

/* ============================================================
   数据备份 & 日志样式
   ============================================================ */
.backup-list-item { display: flex; align-items: center; justify-content: space-between; padding: 10px 14px; border-bottom: 1px solid var(--border); }
.backup-list-item:last-child { border-bottom: none; }


/* ============================================================
   打印样式
   ============================================================ */
@media print {
  .sidebar, .top-header, .page-header button, .pagination,
  .filter-bar, .btn-primary, .btn-secondary, .btn-icon,
  #toastContainer, .notif-wrap { display: none !important; }
  .main-content { margin-left: 0 !important; }
  .page { display: block !important; }
  .page.hidden { display: none !important; }
  body { background: #fff; }
  .table-card { box-shadow: none; border: 1px solid #ddd; }
}

/* ============================================================
   移动端 H5 响应式适配 (≥768px 平板 / ≤480px 手机)
   ============================================================ */

/* --- 通用平板断点 768px --- */
@media (max-width: 768px) {
  :root {
    --sidebar-w: 0px;
    --header-h: 56px;
  }

  /* 侧边栏：变为左侧滑出抽屉 */
  .sidebar {
    width: 280px !important;
    transform: translateX(-100%);
    transition: transform var(--transition);
    box-shadow: none;
  }
  .sidebar.mobile-open {
    transform: translateX(0);
    box-shadow: 4px 0 30px rgba(0,0,0,0.3);
  }
  .sidebar.collapsed { width: 280px !important; }
  .sidebar.collapsed .sidebar-title,
  .sidebar.collapsed .nav-group-title,
  .sidebar.collapsed .nav-item span,
  .sidebar.collapsed .nav-badge,
  .sidebar.collapsed .user-detail { display: inherit; }

  /* 主内容区 */
  .main-content {
    margin-left: 0 !important;
    width: 100%;
  }

  /* 顶部栏精简 */
  .top-header {
    padding: 0 12px;
    height: var(--header-h);
  }
  .header-time { display: none; }
  .breadcrumb span { font-size: 12px; }
  .btn-icon { padding: 8px; font-size: 16px; }
  .btn-icon .notif-badge { display: flex !important; }

  /* 页面内容区 - 底部留TabBar高度 + 安全区 */
  .page-content {
    padding: 12px;
    padding-bottom: calc(70px + env(safe-area-inset-bottom));
  }

  /* 页面标题缩小 */
  .page-header {
    flex-direction: column;
    align-items: flex-start !important;
    gap: 10px;
    margin-bottom: 16px;
  }
  .page-header h2 { font-size: 17px; }
  .page-subtitle { display: none; }

  /* 统计卡片: 单列堆叠 */
  .stats-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 10px;
    margin-bottom: 16px;
  }
  .stat-card {
    padding: 14px;
    flex-direction: row;
    justify-content: flex-start;
  }
  .stat-card::after { display: none; }
  .stat-icon { width: 40px; height: 40px; font-size: 17px; }
  .stat-number { font-size: 22px; }
  .stat-trend { display: none; }

  /* 图表全宽 */
  .charts-row { grid-template-columns: 1fr !important; margin-bottom: 16px; }
  .chart-card { padding: 14px; }
  .chart-header h3 { font-size: 13px; }

  /* 数据行单列 */
  .data-row { grid-template-columns: 1fr !important; gap: 10px; }
  .data-card { padding: 14px; }

  /* 过滤栏换行 */
  .filter-bar {
    padding: 12px;
    gap: 8px;
    border-radius: 8px;
  }
  .search-input { min-width: 120px; flex: 1; }
  .filter-select {
    min-width: 100px;
    max-width: 160px;
    padding: 8px 10px;
    font-size: 13px;
  }
  .btn-search { padding: 8px 12px; font-size: 12px; }

  /* 数据表格 → 可横向滚动卡片容器 */
  .table-card { border-radius: 8px; overflow-x: auto; }
  .data-table {
    min-width: 600px;
    font-size: 12px;
  }
  .data-table th {
    padding: 10px 10px;
    font-size: 11px;
  }
  .data-table td {
    padding: 10px 10px;
    font-size: 12px;
  }
  .mini-table { min-width: 400px; }

  /* 操作按钮紧凑化 */
  .action-btns { gap: 3px; flex-wrap: wrap; }
  .btn-sm { padding: 4px 8px; font-size: 11px; }

  /* 分页 */
  .pagination {
    padding: 10px 12px;
    gap: 4px;
  }
  .pagination button { width: 28px; height: 28px; font-size: 12px; }
  .pagination .total-info { font-size: 11px; }

  /* Tabs横向可滚动 */
  .tabs-bar {
    padding: 4px;
    gap: 4px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .tabs-bar::-webkit-scrollbar { display: none; }
  .tab-btn {
    padding: 8px 14px;
    white-space: nowrap;
    font-size: 12px;
  }

  /* 表单单列 */
  .form-row {
    grid-template-columns: 1fr !important;
    gap: 12px;
  }
  .form-row label { font-size: 13px; }

  /* 模态框全屏化 */
  .modal {
    padding: 0;
    align-items: flex-end;
  }
  .modal-box {
    max-width: 100% !important;
    max-height: 85vh;
    border-radius: 20px 20px 0 0;
    animation: modalSlideUp 0.3s ease;
  }
  @keyframes modalSlideUp {
    from { opacity: 0; transform: translateY(30%); }
    to { opacity: 1; transform: translateY(0); }
  }
  .modal-xl { max-width: 100% !important; }
    .modal-lg { max-width: 100% !important; }
  .modal-header { padding: 16px 18px; }
  .modal-body { padding: 16px 18px; }

  /* 详情标签滚动 */
  .detail-tabs {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .detail-tabs::-webkit-scrollbar { display: none; }
  .detail-tab { white-space: nowrap; padding: 6px 12px; font-size: 12px; }

  /* 信息网格单列 */
  .info-grid { grid-template-columns: 1fr 1fr !important; gap: 8px; }
  .info-item { padding: 8px; }
  .info-label { font-size: 10px; }
  .info-value { font-size: 13px; }

  /* 财务摘要 */
  .finance-summary { grid-template-columns: repeat(3, 1fr) !important; gap: 8px; }
  .finance-sum-item { padding: 12px; text-align: center; }
  .sum-value { font-size: 20px; }

  /* 房间/员工/活动网格 */
  .rooms-grid { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)) !important; gap: 10px; }
  .staff-grid { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)) !important; gap: 10px; }
  .activities-grid { grid-template-columns: 1fr !important; gap: 10px; }

  /* 导出卡片单列 */
  .export-grid { grid-template-columns: 1fr !important; }
  .export-card { padding: 16px; flex-wrap: wrap; }

  /* 膳食时间线 */
  .meal-day-group { padding: 12px 14px; }
  .meal-card { padding: 12px 14px; }
  .meal-dishes { font-size: 13px; }

  /* 排班网格 */
  .shifts-grid { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)) !important; }

  /* Toast通知适配 */
  .toast-container {
    top: 10px;
    right: 10px;
    left: 10px;
  }
  .toast {
    min-width: auto;
    max-width: 100%;
    font-size: 12px;
    padding: 10px 14px;
  }

  /* 登录页 */
  .login-box {
    width: 92%;
    max-width: 380px;
    padding: 32px 24px;
    border-radius: 16px;
    margin: 16px;
  }
  .login-logo h1 { font-size: 19px; }
  .logo-icon { width: 60px; height: 60px; font-size: 26px; }

  /* 预警列表 */
  .alert-list { max-height: 200px; }
  .alert-item { padding: 8px 10px; font-size: 12px; }

  /* 通知面板 */
  .notif-panel {
    width: calc(100vw - 24px) !important;
    left: 50%;
    right: auto;
    transform: translateX(-50%);
    position: fixed;
    top: var(--header-h) !important;
  }

  /* 报表图表区域 */
  #reportFinanceSection .charts-row,
  #reportResidentsSection .charts-row,
  #reportHealthSection .charts-row {
    grid-template-columns: 1fr !important;
  }

  /* 页头按钮组 */
  .btn-group { flex-wrap: wrap; gap: 6px; }
  .btn-primary { padding: 8px 14px; font-size: 12px; }
  .btn-secondary { padding: 8px 14px; font-size: 12px; }

  /* 表单卡片 */
  .form-card { padding: 16px; border-radius: 10px; }

  /* 侧边栏遮罩层 */
}

/* --- 手机断点 480px --- */
@media (max-width: 480px) {
  :root { --header-h: 52px; }

  .page-content { padding: 10px; padding-bottom: calc(66px + env(safe-area-inset-bottom)); }

  .stats-grid {
    grid-template-columns: 1fr 1fr !important;
    gap: 8px;
  }
  .stat-card { padding: 12px; }
  .stat-icon { width: 36px; height: 36px; font-size: 15px; }
  .stat-number { font-size: 19px; }
  .stat-label { font-size: 11px; }

  .chart-card { padding: 12px; border-radius: 8px; }

  .filter-bar {
    padding: 10px;
    flex-direction: column;
    align-items: stretch;
  }
  .search-input { min-width: 0; }
  .filter-select { min-width: 0; max-width: 100%; width: 100%; }
  .btn-search { width: 100%; justify-content: center; padding: 10px; }

  .data-table { min-width: 560px; }
  .mini-table { min-width: 360px; }

  .page-header h2 { font-size: 16px; }
  .tab-btn { padding: 7px 12px; font-size: 11px; }

  .rooms-grid { grid-template-columns: 1fr !important; }
  .staff-grid { grid-template-columns: 1fr !important; }
  .activities-grid { grid-template-columns: 1fr !important; }

  .finance-summary { grid-template-columns: 1fr !important; gap: 8px; }
  .finance-sum-item { padding: 14px; flex-direction: row; justify-content: space-between; }
  .sum-value { font-size: 18px; }

  .export-card { flex-direction: column; align-items: stretch; text-align: center; }
  .export-info { text-align: center; }

  .info-grid { grid-template-columns: 1fr !important; }

  .detail-tab { padding: 5px 10px; font-size: 11px; }

  .modal-body { padding: 12px 14px; }

  .login-box { padding: 28px 20px; border-radius: 14px; }
  .login-logo h1 { font-size: 17px; }
  .logo-icon { width: 52px; height: 52px; font-size: 23px; }
  .login-form input { padding: 11px 14px; }
  .btn-login { padding: 12px; font-size: 14px; }

  .form-card { padding: 14px; }
  .form-input { font-size: 15px; padding: 12px; } /* 更大的触摸目标 */

  .shifts-grid { grid-template-columns: 1fr !important; }

  /* 按钮触摸优化 */
  .btn-primary, .btn-secondary, .btn-search {
    min-height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
  .btn-sm { min-height: 34px; }
  .btn-icon { min-width: 38px; min-height: 38px; display: inline-flex; align-items: center; justify-content: center; }

  .pagination button { width: 34px; height: 34px; }
}

/* --- 大手机横屏/小平板优化 480-768 --- */
@media (min-width: 481px) and (max-width: 768px) {
  .stats-grid { grid-template-columns: repeat(3, 1fr) !important; }
  .finance-summary { grid-template-columns: repeat(3, 1fr) !important; }
}

/* ============================================================
   底部 Tab 导航栏（仅移动端显示）
   ============================================================ */
.tabbar {
  display: none; /* 桌面端默认隐藏 */
}
.tabbar-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 198; /* sidebar=199, tabbar=200 */
  backdrop-filter: blur(2px);
}
@media (max-width: 768px) {
  .tabbar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 200;
    background: #fff;
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding: 6px 0;
    padding-bottom: calc(6px + env(safe-area-inset-bottom));
    border-top: 1px solid var(--border);
    box-shadow: 0 -2px 12px rgba(0,0,0,0.08);
  }
  .tabbar-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 4px 8px;
    min-width: 52px;
    cursor: pointer;
    color: var(--text-muted);
    transition: color 0.2s;
    position: relative;
    -webkit-tap-highlight-color: transparent;
  }
  .tabbar-item:active { opacity: 0.65; }
  .tabbar-item.active { color: var(--primary); }
  .tabbar-item i { font-size: 19px; line-height: 1; }
  .tabbar-item span { font-size: 9px; font-weight: 600; line-height: 1.2; white-space: nowrap; letter-spacing: 0.3px; }
  .tabbar-badge {
    position: absolute;
    top: 0;
    right: 2px;
    background: var(--danger);
    color: #fff;
    font-size: 9px;
    font-weight: 700;
    min-width: 14px;
    height: 14px;
    border-radius: 7px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 3px;
  }
  .tabbar-more-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 4px 10px;
    color: var(--text-muted);
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
  }
  .tabbar-more-btn i { font-size: 19px; }
  .tabbar-more-btn span { font-size: 9px; font-weight: 600; }
  .tabbar-more-btn:active { opacity: 0.65; }

  /* 更多菜单面板 */
  .more-menu-panel {
    position: fixed;
    bottom: calc(58px + env(safe-area-inset-bottom));
    left: 8px;
    right: 8px;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 8px 36px rgba(0,0,0,0.16);
    z-index: 201;
    padding: 12px 8px;
    animation: moreMenuIn 0.25s ease;
    max-height: 55vh;
    overflow-y: auto;
  }
  @keyframes moreMenuIn {
    from { opacity: 0; transform: translateY(16px); }
    to { opacity: 1; transform: translateY(0); }
  }
  .more-menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-radius: 10px;
    transition: background 0.15s;
    cursor: pointer;
    color: var(--text);
    font-size: 14px;
    font-weight: 500;
  }
  .more-menu-item:active { background: var(--bg); }
  .more-menu-item i {
    width: 22px;
    text-align: center;
    color: var(--primary);
    font-size: 16px;
  }
  .more-menu-divider {
    height: 1px;
    background: var(--border);
    margin: 4px 12px;
  }

  /* 侧边栏遮罩层 */
  .sidebar-mask {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 99;
    backdrop-filter: blur(2px);
  }

  /* 数据表格卡片模式 (可选增强) */
  .mobile-cards-container {
    display: block;
  }
  .mobile-cards-container .data-table { display: none; }
  .mobile-data-card {
    background: var(--bg-card);
    border-radius: 10px;
    padding: 14px;
    margin-bottom: 10px;
    box-shadow: var(--shadow);
  }
  .mobile-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
  }
  .mobile-card-title { font-size: 15px; font-weight: 700; color: var(--text); }
  .mobile-card-status { font-size: 11px; font-weight: 600; }
  .mobile-card-field {
    display: flex;
    justify-content: space-between;
    padding: 5px 0;
    font-size: 13px;
    border-bottom: 1px solid rgba(0,0,0,0.04);
  }
  .mobile-card-field:last-child { border-bottom: none; }
  .mobile-card-label { color: var(--text-muted); font-size: 12px; }
  .mobile-card-value { font-weight: 500; text-align: right; max-width: 55%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .mobile-card-actions {
    display: flex;
    gap: 8px;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--border);
    justify-content: flex-end;
  }
}

/* --- 老人搜索自动补全 --- */
.autocomplete-wrapper { position: relative; }
.autocomplete-wrapper input[type="text"] {
  width: 100%; box-sizing: border-box;
  padding: 10px 12px; border: 1px solid var(--border);
  border-radius: 8px; font-size: 14px; outline: none; transition: border .2s;
}
.autocomplete-wrapper input[type="text"]:focus {
  border-color: var(--primary); box-shadow: 0 0 0 3px rgba(79,124,255,.12);
}
.autocomplete-dropdown {
  position: absolute; top: 100%; left: 0; right: 0; z-index: 1000;
  max-height: 220px; overflow-y: auto;
  background: #fff; border: 1px solid var(--border);
  border-top: none; border-radius: 0 0 8px 8px;
  box-shadow: 0 4px 16px rgba(0,0,0,.1);
  display: none;
}
.autocomplete-dropdown.show { display: block; }
.autocomplete-dropdown .ac-item {
  padding: 10px 12px; cursor: pointer; display: flex; justify-content: space-between; align-items: center;
  border-bottom: 1px solid #f0f0f0; font-size: 14px; transition: background .15s;
}
.autocomplete-dropdown .ac-item:last-child { border-bottom: none; }
.autocomplete-dropdown .ac-item:hover,
.autocomplete-dropdown .ac-item.active { background: var(--primary-light); color: var(--primary); }
.autocomplete-dropdown .ac-name { font-weight: 500; }
.autocomplete-dropdown .ac-id { font-size: 12px; color: var(--text-muted); }
.autocomplete-dropdown .ac-empty {
  padding: 14px 12px; text-align: center; color: var(--text-muted); font-size: 13px;
}
