/* 总后台首页 — 一屏展示，整页不滚动 */
html.dash-page-lock,
body.dash-page-lock {
  overflow: hidden;
  height: 100%;
}

body.dash-page-lock .shell__main {
  overflow: hidden;
}

.shell__content--dashboard {
  flex: 1;
  display: flex;
  flex-direction: column;
  width: 100%;
  height: calc(100vh - var(--header-h));
  max-height: calc(100vh - var(--header-h));
  overflow: hidden;
  padding: 16px 20px;
  background: var(--bg);
  box-sizing: border-box;
}

.dash-home {
  width: 100%;
  height: 100%;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: 14px;
  overflow: hidden;
  min-height: 0;
}

/* —— 顶部统计 —— */
.dash-cards {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  flex-shrink: 0;
}

.dash-card {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px 14px;
  box-shadow: var(--shadow);
}

.dash-card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.dash-card__title {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.dash-card__badge {
  font-size: 11px;
  padding: 3px 10px;
  border-radius: 999px;
  background: #eff6ff;
  color: #2563eb;
  font-weight: 500;
}

.dash-card__value {
  font-size: 28px;
  font-weight: 700;
  line-height: 1.15;
  color: var(--text);
  margin: 4px 0 8px;
  letter-spacing: -0.02em;
}

.dash-card__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 16px;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: auto;
  padding-bottom: 12px;
}

.dash-card__trend {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-weight: 600;
}

.dash-card__trend.is-up { color: #dc2626; }
.dash-card__trend.is-down { color: #059669; }
.dash-card__trend.is-flat { color: #d97706; }

.dash-card__foot {
  padding-top: 12px;
  margin-top: auto;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.dash-card__foot strong {
  font-size: 15px;
  color: var(--text);
  font-weight: 700;
}

/* —— 快捷入口 —— */
.dash-shortcuts {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: 14px;
  flex-shrink: 0;
}

.dash-shortcut {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 0;
  padding: 12px 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.12s;
  box-shadow: var(--shadow);
}

.dash-shortcut:hover {
  border-color: #c7d2fe;
  box-shadow: var(--shadow-lg);
  transform: translateY(-1px);
}

.dash-shortcut__icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.dash-shortcut__icon svg {
  width: 22px;
  height: 22px;
}

.dash-shortcut__icon--green { background: #ecfdf5; color: #059669; }
.dash-shortcut__icon--blue { background: #eff6ff; color: #2563eb; }
.dash-shortcut__icon--orange { background: #fff7ed; color: #ea580c; }
.dash-shortcut__icon--purple { background: #f5f3ff; color: #7c3aed; }
.dash-shortcut__icon--yellow { background: #fefce8; color: #ca8a04; }
.dash-shortcut__icon--teal { background: #f0fdfa; color: #0d9488; }

/* —— 底部双栏（占满剩余高度，不撑出页面） —— */
.dash-bottom {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr);
  gap: 14px;
  align-items: stretch;
  min-height: 0;
  overflow: hidden;
}

.dash-panel {
  display: flex;
  flex-direction: column;
  min-height: 100%;
  height: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.dash-panel__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  background: #fafbfc;
  flex-shrink: 0;
}

.dash-panel__title {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}

.dash-panel__body {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.dash-panel__body--rank {
  overflow: hidden;
}

.dash-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.dash-tabs button {
  border: none;
  background: transparent;
  padding: 6px 12px;
  font-size: 12px;
  color: var(--text-muted);
  border-radius: 6px;
  cursor: pointer;
  font-family: inherit;
  white-space: nowrap;
}

.dash-tabs button:hover {
  background: #f1f5f9;
}

.dash-tabs button.is-active {
  background: #eef2ff;
  color: var(--primary);
  font-weight: 600;
}

/* 待办 3×3 */
.dash-todos {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-template-rows: repeat(3, minmax(0, 1fr));
  min-height: 100%;
}

.dash-todo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  min-height: 0;
  text-decoration: none;
  color: inherit;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  transition: background 0.12s;
}

.dash-todo:nth-child(3n) {
  border-right: none;
}

.dash-todo:nth-last-child(-n + 3) {
  border-bottom: none;
}

.dash-todo:hover {
  background: #f8fafc;
}

.dash-todo__icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.dash-todo__icon svg {
  width: 22px;
  height: 22px;
  display: block;
}

.dash-todo__icon--blue { background: #dbeafe; color: #2563eb; }
.dash-todo__icon--purple { background: #ede9fe; color: #7c3aed; }
.dash-todo__icon--orange { background: #ffedd5; color: #ea580c; }
.dash-todo__icon--yellow { background: #fef9c3; color: #ca8a04; }
.dash-todo__icon--teal { background: #ccfbf1; color: #0d9488; }
.dash-todo__icon--green { background: #dcfce7; color: #16a34a; }

.dash-todo__text {
  min-width: 0;
  flex: 1;
}

.dash-todo__label {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.35;
}

.dash-todo__count {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  margin-top: 2px;
  line-height: 1.2;
}

/* 排行表 */
.dash-rank-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.dash-rank-table thead {
  position: sticky;
  top: 0;
  z-index: 1;
}

.dash-rank-table th,
.dash-rank-table td {
  padding: 8px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.dash-rank-table th {
  font-weight: 600;
  color: var(--text-muted);
  font-size: 12px;
  background: #fafbfc;
}

.dash-rank-table tbody tr:hover td {
  background: #f8fafc;
}

.dash-rank-table tr:last-child td {
  border-bottom: none;
}

.dash-rank-table td.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-weight: 500;
}

.dash-rank-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  font-size: 12px;
  font-weight: 700;
  background: #f1f5f9;
  color: var(--text-muted);
}

.dash-rank-badge.is-1 { background: linear-gradient(135deg, #fcd34d, #f59e0b); color: #fff; }
.dash-rank-badge.is-2 { background: linear-gradient(135deg, #e2e8f0, #94a3b8); color: #fff; }
.dash-rank-badge.is-3 { background: linear-gradient(135deg, #fdba74, #ea580c); color: #fff; }

.dash-shop-thumb {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  object-fit: cover;
  background: #f1f5f9;
  display: block;
}

.dash-shop-thumb--empty {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  color: #64748b;
  background: linear-gradient(135deg, #f8fafc, #e2e8f0);
  border: 1px solid #e2e8f0;
}

.dash-empty {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
}

.dash-rank-table .dash-empty {
  display: table-cell;
}

@media (max-width: 1400px) {
  .dash-shortcuts {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (max-width: 1200px) {
  .dash-cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dash-bottom {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .shell__content--dashboard {
    padding: 16px;
  }

  .dash-cards {
    grid-template-columns: 1fr;
  }

  .dash-shortcuts {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dash-todos {
    grid-template-columns: 1fr;
    grid-template-rows: auto;
  }

  .dash-todo {
    border-right: none;
  }

  .dash-todo:not(:last-child) {
    border-bottom: 1px solid var(--border);
  }
}
