/* Hermes Dashboard — Executive Dashboard (Light Blue Theme) */
body {
  background: #f8fafc;
  color: #1e293b;
  font-size: 0.9rem;
  overflow-x: hidden;
}

/* ── 侧边栏 ── */
.sidebar {
  width: 220px;
  min-height: 100vh;
  background: #ffffff;
  border-right: 1px solid #e2e8f0;
  transition: transform 0.3s ease;
}

.sidebar .nav-link {
  color: #64748b;
  border-radius: 8px;
  margin: 2px 0;
  padding: 10px 14px;
  font-size: 0.88rem;
  white-space: nowrap;
  transition: all 0.2s ease;
}

.sidebar .nav-link:hover {
  color: #1e293b;
  background: #f1f5f9;
}

.sidebar .nav-link.active {
  color: #fff;
  background: #2563eb;
  box-shadow: 0 2px 8px rgba(37,99,235,0.25);
}

.sidebar hr { border-color: #e2e8f0; }

/* ── 移动端 ── */
.mobile-topbar {
  display: none;
  background: #ffffff;
  padding: 10px 16px;
  border-bottom: 1px solid #e2e8f0;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 1030;
}

.sidebar-overlay {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.3);
  z-index: 1020;
}

@media (max-width: 991.98px) {
  .mobile-topbar { display: flex; }
  .sidebar {
    position: fixed; top: 0; left: 0; bottom: 0; z-index: 1025;
    transform: translateX(-100%);
    box-shadow: 2px 0 20px rgba(0,0,0,0.1);
  }
  .sidebar.show { transform: translateX(0); }
  .sidebar-overlay.show { display: block; }
  .main-content { width: 100%; min-height: calc(100vh - 50px); padding-top: 8px !important; }
  body.sidebar-open { overflow: hidden; }
}

/* ── 主内容区 ── */
.main-content {
  flex: 1;
  overflow-y: auto;
  max-height: 100vh;
  padding: 24px 32px !important;
}

@media (max-width: 991.98px) { .main-content { max-height: none; padding: 12px !important; } }

/* ── KPI 卡片 ── */
.kpi-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
  transition: box-shadow 0.2s ease, transform 0.2s ease;
  min-height: 130px;
}

.kpi-card:hover {
  box-shadow: 0 4px 12px rgba(0,0,0,0.06);
  transform: translateY(-1px);
}

.kpi-label {
  font-size: 0.72rem;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
  margin-bottom: 8px;
}

.kpi-value {
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.1;
  color: #1e293b;
}

.kpi-trend {
  font-size: 0.78rem;
  margin-top: 6px;
  font-weight: 500;
}

.kpi-trend.up { color: #16a34a; }
.kpi-trend.down { color: #dc2626; }
.kpi-trend.mid { color: #d97706; }
.kpi-trend.flat { color: #64748b; }

/* KPI 图标色 */
.kpi-icon {
  font-size: 1.5rem;
  opacity: 0.7;
}
.kpi-card:nth-child(1) .kpi-icon { color: #2563eb; }
.kpi-card:nth-child(2) .kpi-icon { color: #059669; }
.kpi-card:nth-child(3) .kpi-icon { color: #d97706; }
.kpi-card:nth-child(4) .kpi-icon { color: #7c3aed; }
.kpi-card:nth-child(5) .kpi-icon { color: #0891b2; }

/* ── 系统概况迷你进度条 ── */
.sys-row {
  display: flex;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid #f1f5f9;
}
.sys-row:last-child { border-bottom: none; }
.sys-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: #475569;
  min-width: 50px;
}
.sys-bar {
  flex: 1;
  height: 6px;
  background: #e2e8f0;
  border-radius: 3px;
  margin: 0 12px;
  overflow: hidden;
}
.sys-bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.6s ease;
}
.sys-bar-fill.blue { background: #2563eb; }
.sys-bar-fill.green { background: #16a34a; }
.sys-bar-fill.amber { background: #d97706; }
.sys-bar-fill.purple { background: #7c3aed; }
.sys-pct {
  font-size: 0.78rem;
  font-weight: 600;
  color: #475569;
  min-width: 40px;
  text-align: right;
}

/* ── 普通卡片（内容卡片） ── */
.card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
  transition: box-shadow 0.2s ease;
}
.card:hover { box-shadow: 0 4px 12px rgba(0,0,0,0.06); }

.card-header {
  background: transparent;
  border-bottom: 1px solid #e2e8f0;
  font-weight: 600;
  font-size: 0.82rem;
  padding: 14px 18px;
  color: #475569;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.card-body { padding: 18px; }

/* ── 状态卡片（首页底部卡片） ── */
.stat-card {
  border-radius: 12px;
  padding: 0;
  overflow: hidden;
  min-height: 110px;
}

.stat-card .card-body {
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  height: 100%;
}

/* ── Gateway 状态行 ── */
.status-row {
  padding: 10px 0;
  border-bottom: 1px solid #f1f5f9;
}
.status-row:last-child { border-bottom: none; }
.status-row .profile-name { font-weight: 600; font-size: 0.9rem; color: #1e293b; }
.status-row .status-detail {
  color: #94a3b8;
  font-size: 0.75rem;
  white-space: nowrap;
}

/* ── 快速入口按钮 ── */
.quick-entry {
  display: flex;
  align-items: center;
  padding: 12px;
  border-radius: 8px;
  text-decoration: none;
  color: #1e293b;
  transition: all 0.2s ease;
  border: 1px solid #e2e8f0;
  margin-bottom: 8px;
}
.quick-entry:hover {
  background: #f1f5f9;
  border-color: #cbd5e1;
  color: #1e293b;
}
.quick-entry .qe-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  margin-right: 12px;
}

/* ── 表格 ── */
.table-light {
  --bs-table-bg: transparent;
}
.table-light thead th {
  color: #64748b;
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 2px solid #e2e8f0;
}
.table-light td {
  border-color: #f1f5f9;
  color: #475569;
}

/* ── 表单 ── */
.form-control, .form-select {
  background: #ffffff;
  border: 1px solid #d1d5db;
  color: #1e293b;
  font-size: 16px;
  border-radius: 8px;
}
.form-control:focus, .form-select:focus {
  background: #ffffff;
  border-color: #2563eb;
  color: #1e293b;
  box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}

/* ── 按钮 ── */
.btn-outline-secondary {
  border-color: #d1d5db;
  color: #64748b;
  border-radius: 8px;
}
.btn-outline-secondary:hover {
  background: #f1f5f9;
  color: #1e293b;
  border-color: #94a3b8;
}

.btn-primary {
  background: #2563eb;
  border: none;
  border-radius: 8px;
  box-shadow: 0 2px 6px rgba(37,99,235,0.2);
}
.btn-primary:hover {
  background: #1d4ed8;
  box-shadow: 0 4px 12px rgba(37,99,235,0.3);
}

/* ── Badge ── */
.badge {
  font-weight: 500;
  padding: 3px 8px;
  border-radius: 6px;
}
.badge.bg-success { background: rgba(22,163,74,0.1) !important; color: #16a34a; }
.badge.bg-secondary { background: #f1f5f9 !important; color: #64748b; }
.badge.bg-danger { background: rgba(220,38,38,0.1) !important; color: #dc2626; }
.badge.bg-warning { background: rgba(217,119,6,0.1) !important; color: #d97706; }
.badge.bg-info { background: rgba(8,145,178,0.1) !important; color: #0891b2; }

/* ── 滚动条 ── */
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }

/* ── 导航标签 ── */
.nav-tabs { border-bottom: 1px solid #e2e8f0; }
.nav-tabs .nav-link {
  color: #64748b;
  border: none;
  padding: 8px 16px;
  font-size: 0.85rem;
  transition: color 0.2s;
}
.nav-tabs .nav-link.active {
  color: #2563eb;
  background: transparent;
  border-bottom: 2px solid #2563eb;
}
.nav-tabs .nav-link:hover { color: #1e293b; }

/* ── 链接 ── */
a { color: #2563eb; transition: color 0.2s; }
a:hover { color: #1d4ed8; }

/* ── 侧边栏二级菜单 ── */
.sidebar .collapse-arrow {
  transition: transform 0.3s ease;
}
.sidebar a[aria-expanded="true"] .collapse-arrow {
  transform: rotate(180deg);
}
.sidebar .submenu .nav-link {
  padding: 6px 14px;
  margin: 1px 0;
  font-size: 0.82rem;
}
.sidebar .submenu .nav-link.active {
  background: rgba(37,99,235,0.08);
  color: #2563eb;
}
.sidebar a[data-bs-toggle="collapse"] { cursor: pointer; }
.sidebar .fs-5 { color: #1e293b !important; }

/* ── 移动端 ── */
.mobile-topbar .btn-outline-light {
  color: #64748b;
  border-color: #d1d5db;
}
.mobile-topbar .btn-outline-light:hover {
  background: #f1f5f9;
}

/* ── 页面标题 ── */
h4 { font-size: 1.2rem; font-weight: 700; color: #1e293b; }
h1, h2, h3, h5, h6 { color: #1e293b; }
p, span, div { color: #475569; }

/* 标题中的 icon 也要适配 */
.bi { color: inherit; }
.text-light { color: #1e293b !important; }

/* ── 下拉菜单适配浅色 ── */
.dropdown-menu {
  background: #ffffff;
  border: 1px solid #e2e8f0;
}
.dropdown-item {
  color: #475569;
}
.dropdown-item:hover {
  background: #f1f5f9;
  color: #1e293b;
}

/* ── 超小屏 (<400px) ── */
@media (max-width: 399.98px) {
  .kpi-value { font-size: 1.5rem; }
  .kpi-card { padding: 14px; min-height: 100px; }
  .main-content { padding: 8px !important; }
}

/* ── 手机端 (<576px) ── */
@media (max-width: 575.98px) {
  #systemChart, #glucoseChart { height: 200px !important; }
  #dailyChart, #hourlyChart { height: 160px !important; }
  #rangeGroup, #bgRange { flex-wrap: wrap; }
  #rangeGroup .btn, #bgRange .btn { font-size: 0.7rem; padding: 2px 6px; }
  .table th, .table td { font-size: 0.75rem; padding: 4px 6px !important; }
  .page-link { padding: 3px 8px; font-size: 0.75rem; }
  .progress { height: 4px; }
  .modal-dialog { margin: 0.3rem; }
  .modal-body { padding: 0.8rem; }
}

/* ── 小平板/大手机 ── */
@media (min-width: 576px) and (max-width: 767.98px) {
  #systemChart, #glucoseChart { height: 220px !important; }
}

/* ── 平板 ── */
@media (min-width: 768px) and (max-width: 991.98px) {
  #systemChart, #glucoseChart { height: 240px !important; }
}

/* ── 触摸友好 ── */
.btn-sm { min-height: 32px; }
@media (max-width: 575.98px) { .btn-sm { min-height: 36px; font-size: 0.8rem; } }

/* ── 侧边栏二级菜单缩进 ── */
.sidebar .submenu .nav-link { white-space: normal; word-break: break-all; }

/* ── 购买记录图片 ── */
.card-img-top { object-fit: cover; height: 180px; }
@media (max-width: 575.98px) { .card-img-top { height: 140px; } }

/* ── 表格滚动提示 ── */
.table-responsive { -webkit-overflow-scrolling: touch; }

/* ── 微交互动效 ── */
.btn, .nav-link, .badge, .card, .kpi-card { transition: all 0.2s ease; }

/* ── 备份按钮区域 ── */
#backupResult { min-height: 1.5rem; }

/* ── 子页面通用 ── */
.page-header {
  margin-bottom: 24px;
}
.page-header h4 {
  margin-bottom: 4px;
}
.page-header .subtitle {
  font-size: 0.82rem;
  color: #94a3b8;
}


/* ══════════════════════════════════════════
   七夕主题 — purchases.html 专用
   ══════════════════════════════════════════ */

/* 左侧装饰猫猫（CSS绘制，静态） */
.qixi-cat-wrap {
  position: fixed;
  left: 20px;
  bottom: 80px;
  z-index: 10;
  pointer-events: none;
}
.qixi-cat {
  width: 90px;
  height: 90px;
  display: flex;
  align-items: center;
  justify-content: center;
  filter: drop-shadow(0 4px 8px rgba(232,62,140,0.3));
}
.qixi-cat-emoji {
  font-size: 3.4rem;
  line-height: 1;
}

/* 右侧装饰葫芦（静态） */
.qixi-gourd-wrap {
  position: fixed;
  right: 14px;
  bottom: 84px;
  z-index: 10;
  pointer-events: none;
  display: flex;
  align-items: flex-end;
}
.qixi-gourd {
  width: 58px;
  height: 58px;
  margin-left: -12px;
  filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.12));
}
.qixi-gourd.g1 { transform: rotate(-12deg); }
.qixi-gourd.g2 { transform: rotate(3deg) translateY(6px); width: 50px; height: 50px; }
.qixi-gourd.g3 { transform: rotate(15deg); width: 64px; height: 64px; }

/* 右上角爱心装饰（静态） */
.qixi-corner-hearts {
  position: fixed;
  top: 60px;
  right: 30px;
  z-index: 10;
  pointer-events: none;
  font-size: 1.2rem;
}

/* 七夕主题按钮（粉红渐变） */
.btn-qixi {
  background: linear-gradient(135deg, #e83e8c, #ff69b4);
  border: none;
  color: #fff;
  border-radius: 20px;
  box-shadow: 0 4px 12px rgba(232,62,140,0.35);
  font-weight: 600;
}
.btn-qixi:hover {
  background: linear-gradient(135deg, #d63384, #e83e8c);
  color: #fff;
  box-shadow: 0 6px 16px rgba(232,62,140,0.45);
  transform: translateY(-1px);
}

/* 粉红主题边框 */
.border-qixi { border-color: #ff69b4 !important; }
.text-qixi   { color: #e83e8c !important; }
.bg-qixi     { background: linear-gradient(135deg, #fff0f5, #ffe4ef) !important; }

/* 预算卡/统计卡粉红化 */
.card.border-info { border-color: #ff69b4 !important; }
.card.border-success { border-color: #f9a8d4 !important; }
.card.border-warning { border-color: #fbbf24 !important; }
.card.border-secondary { border-color: #f472b6 !important; }
.text-info { color: #e83e8c !important; }
.text-success { color: #db2777 !important; }
.text-warning { color: #d97706 !important; }
.bg-info { background: rgba(232,62,140,0.08) !important; color: #e83e8c !important; }

/* 页面标题区粉红底 */
.page-qixi-header {
  background: linear-gradient(135deg, #fff0f5, #ffe4ef);
  border-radius: 12px;
  padding: 12px 16px;
  margin-bottom: 16px;
  border: 1px solid #ffc0cb;
}

/* 移动端装饰缩小（静态，不再隐藏）——位置/缩放由 qixi-han.css 移动端段控制 */
@media (max-width: 767.98px) {
  .qixi-cat-wrap, .qixi-gourd-wrap, .qixi-corner-hearts { display: block; }
}
