/* Dashboard shares the existing admin controls, dialogs and responsive shell. */
:root { --sidebar-width: 226px; }
.main-content { padding-left: 32px; padding-right: 32px; }
#main-content:focus { outline: none; }
.topbar { grid-template-columns: minmax(220px, 1fr) minmax(180px, 275px) auto auto; gap: 16px; background: #fcfaf6; padding: 12px 0; }
.overview-subtitle { margin: 6px 0 0; color: var(--muted); font-size: 15px; }
#page-overview { padding-top: 0; }
.fixture-badge { color: #9b601b; font-size: 12px; margin-left: 10px; white-space: nowrap; }
.topbar-actions { display: flex; gap: 12px; }
.topbar-actions button { white-space: nowrap; min-height: 44px; padding: 10px 15px; font-size: 13px; }
.topbar-actions .gold-action { color: #ad6b12; background: #fff7e8; border-color: #efce92; }
.global-search { border: 1px solid var(--line); padding: 5px; border-radius: 7px; background: white; gap: 4px; }
.global-search input { border: 0; padding: 6px; background: transparent; font-size: 13px; }
.global-search button { min-height: 32px; border: 0; padding: 5px 11px; background: #f0f5ee; white-space: nowrap; font-size: 13px; }
.dashboard-icon { display: inline-block; flex: 0 0 auto; width: 20px; height: 20px; background: currentColor; mask: var(--icon) center / contain no-repeat; -webkit-mask: var(--icon) center / contain no-repeat; }
.icon-users { --icon: url('/admin/assets/users-three.svg'); }
.icon-user-plus { --icon: url('/admin/assets/user-plus.svg'); }
.icon-activity { --icon: url('/admin/assets/heartbeat.svg'); }
.icon-tasks { --icon: url('/admin/assets/clipboard-text.svg'); }
.icon-completed { --icon: url('/admin/assets/check-circle.svg'); }
.icon-checkin { --icon: url('/admin/assets/calendar-check.svg'); }
.icon-notes { --icon: url('/admin/assets/notebook.svg'); }
.icon-refresh { --icon: url('/admin/assets/arrows-clockwise.svg'); }
.icon-crown { --icon: url('/admin/assets/crown.svg'); }
.icon-feedback { --icon: url('/admin/assets/chat-circle-text.svg'); }
.icon-payment-issue { --icon: url('/admin/assets/arrows-clockwise.svg'); }
.icon-refund { --icon: url('/admin/assets/currency-circle-dollar.svg'); }

/* 首页：三行主次两栏。统一一种卡片；数字只分三档（概况约 30px、表格 18px、其余 15px 以下）；
   颜色只表达状态：绿色正常或上升，琥珀色要处理，灰色是 0 或样本不足。 */
.overview-toolbar { display: flex; justify-content: flex-end; align-items: center; gap: 14px; padding: 6px 0; }
.overview-toolbar button { display: flex; align-items: center; gap: 6px; min-height: 30px; padding: 4px 10px; font-size: 13px; }
.overview-scope { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 8px; margin: 0 auto 0 0; font-size: 14px; }
.overview-scope .dashboard-icon { width: 18px; height: 18px; color: #27814b; }
.overview-scope strong { font-size: 16px; font-weight: 650; font-variant-numeric: tabular-nums; }
.overview-scope .muted { font-size: 13px; }
#page-overview .paper-card { background: #fffefd; border-color: #ece7df; border-radius: 15px; box-shadow: 0 4px 12px #5d4b2510; padding: 20px 22px; }
#page-overview .card-heading { align-items: baseline; margin-bottom: 14px; }
#page-overview .card-heading h2 { font-size: 17px; font-weight: 650; }
#page-overview .card-heading .muted { font-size: 12px; }
.overview-row { display: grid; gap: 18px; margin-top: 18px; align-items: stretch; }
.overview-toolbar + .overview-row { margin-top: 6px; }
.overview-row-main { grid-template-columns: minmax(0, 2fr) minmax(300px, 1fr); }
/* 第二行左右各叠两张卡，最后一张拉伸，让两栏底边对齐。 */
.overview-column { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.overview-column > :last-child { flex: 1 1 auto; }

.kpi-tabs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.kpi-tab { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; min-width: 0; min-height: 0; border: 1px solid transparent; border-radius: 12px; background: transparent; padding: 12px 14px; text-align: left; }
.kpi-tab:hover { background: #f8f6f0; }
.kpi-tab.is-active { border-color: #d9e8db; background: #eef5ee; }
.kpi-tab-label { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; }
.kpi-tab-label .dashboard-icon { width: 16px; height: 16px; color: #8a918a; }
.kpi-tab.is-active .kpi-tab-label { color: #237c46; }
.kpi-tab.is-active .kpi-tab-label .dashboard-icon { color: #237c46; }
.kpi-tab strong { font-size: 30px; font-weight: 650; line-height: 1.2; font-variant-numeric: tabular-nums; }
.kpi-tab-note { color: var(--muted); font-size: 12px; line-height: 1.5; }
.kpi-delta { font-weight: 600; font-variant-numeric: tabular-nums; }
.kpi-delta.is-up { color: #237c46; }
.kpi-delta.is-down { color: #b4532a; }
.kpi-delta.is-flat { color: var(--muted); font-weight: 400; }
.today-chart-caption { margin: 16px 0 2px; color: var(--muted); font-size: 12px; }
.usage-chart-wrap { position: relative; }
#page-overview .today-card .activity-chart { height: 200px; }
.chart-tooltip { position: absolute; left: 50%; bottom: 28px; max-width: calc(100% - 16px); padding: 10px 14px; background: white; border: 1px solid var(--line); border-radius: 9px; box-shadow: 0 4px 12px #54421a24; font-size: 13px; pointer-events: none; white-space: nowrap; }

.attention-card { display: flex; flex-direction: column; }
#page-overview .pending-work-section .card-heading { align-items: center; margin-bottom: 4px; }
.pending-work-status { border-radius: 12px; padding: 3px 9px; color: #4f6f5b; background: #edf4ec; font-size: 12px; font-weight: 500; white-space: nowrap; }
.pending-work-list { display: grid; }
.pending-work-list button { display: flex; width: 100%; gap: 12px; align-items: center; border: 0; border-bottom: 1px solid #f0ebe2; border-radius: 0; min-height: 46px; padding: 6px 0; text-align: left; background: transparent; font-size: 14px; }
.pending-work-list button:hover { background: #f7faf3; }
.pending-work-list .dashboard-icon { width: 20px; height: 20px; color: #cb901f; }
.pending-work-list strong { margin-left: auto; min-width: 30px; text-align: center; border-radius: 20px; background: #fdf1dc; color: #8a5a12; padding: 2px 8px; font-weight: 600; font-variant-numeric: tabular-nums; }
.pending-work-list strong.is-zero { background: transparent; color: var(--quiet); font-weight: 400; }
.pending-work-list button:has(strong.is-zero) .dashboard-icon { color: #a8aaa5; }
.pending-work-chevron { color: #626862; }
.pending-work-section.is-clear .pending-work-chevron { color: #a8aaa5; }
.health-row { display: flex; align-items: center; gap: 12px; min-height: 46px; font-size: 14px; }
.health-row .dashboard-icon { color: #27814b; }
.health-row strong { margin-left: auto; color: #237c46; font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; }
.health-row.is-warn .dashboard-icon, .health-row.is-warn strong { color: #b4532a; }
.health-note { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.6; }
.pending-work-section { margin-bottom: 16px; }
.retention-block { margin-top: auto; padding-top: 14px; border-top: 1px solid var(--line); }
.retention-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.retention-heading h3 { margin: 0; font-size: 14px; font-weight: 600; }
.retention-heading .muted { font-size: 12px; }
.retention-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.retention-item { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.retention-label { color: var(--muted); font-size: 12px; }
.retention-value { font-size: 24px; font-weight: 650; line-height: 1.25; font-variant-numeric: tabular-nums; }
.retention-compare { min-height: 18px; color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.retention-compare.is-up { color: #237c46; }
.retention-compare.is-down { color: #b4532a; }
.retention-detail { color: var(--muted); font-size: 12px; line-height: 1.5; }
.retention-item.is-low-sample .retention-value { color: var(--quiet); }

.usage-table { width: 100%; border-collapse: collapse; table-layout: fixed; }
.usage-table th:first-child { width: 30%; }
.usage-table thead th { padding: 0 0 8px; color: var(--quiet); font-size: 12px; font-weight: 400; text-align: right; }
.usage-table thead th:first-child { text-align: left; }
.usage-table tbody th, .usage-table tbody td { padding: 10px 0; border-top: 1px solid #f0ebe2; text-align: right; font-variant-numeric: tabular-nums; }
.usage-table-label { text-align: left !important; font-size: 14px; font-weight: 500; }
.usage-table-label small { display: block; margin-top: 2px; color: var(--muted); font-size: 11px; font-weight: 400; }
.usage-table-today { font-size: 18px; font-weight: 650; }
.usage-table-same-time, .usage-table-users { color: #555d55; font-size: 14px; }
.usage-table .is-zero { color: var(--quiet); font-weight: 400; }
.usage-table-trend { padding-left: 12px !important; }
.usage-spark { display: inline-block; vertical-align: middle; }
.usage-spark polyline { fill: none; stroke: #6aa57d; stroke-width: 1.5; stroke-linejoin: round; stroke-linecap: round; }
.usage-spark-empty, .usage-table-pending { color: var(--quiet); font-size: 12px; }

.growth-rows { margin: 0; }
.growth-row { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 9px 0; border-top: 1px solid #f0ebe2; }
.growth-row:first-child { border-top: 0; padding-top: 0; }
.growth-row dt { flex: 0 0 auto; color: var(--muted); font-size: 13px; }
.growth-row dd { display: flex; flex-direction: column; align-items: flex-end; min-width: 0; margin: 0; text-align: right; }
.growth-row strong { font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums; }
.growth-row-sub { color: var(--muted); font-size: 12px; line-height: 1.5; }
.growth-row.is-warn .growth-row-sub { color: #9b601b; }
.growth-levels { margin-top: 4px; padding-top: 10px; border-top: 1px solid #f0ebe2; }
.growth-levels-title { margin: 0 0 6px; color: var(--muted); font-size: 13px; }
.growth-level-bar { display: flex; height: 8px; overflow: hidden; border-radius: 999px; background: #eef1e8; }
.growth-level-segment { display: block; height: 100%; }
.growth-level-segment.level-1 { background: #cfe3d3; }
.growth-level-segment.level-2 { background: #a9cfb2; }
.growth-level-segment.level-3 { background: #83b890; }
.growth-level-segment.level-4 { background: #5f9f70; }
.growth-level-segment.level-5 { background: #3f8755; }
.growth-level-segment.level-6 { background: #2c6e42; }
.growth-level-segment.level-7 { background: #1d5a34; }
.growth-levels-legend { margin: 6px 0 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.insights-empty { margin: 0; font-size: 13px; color: var(--muted); }

.distribution-list { gap: 10px; }
.distribution-row { grid-template-columns: 76px minmax(0, 1fr) 84px; gap: 10px; font-size: 13px; }
.distribution-row strong { text-align: right; font-size: 12px; font-weight: 400; white-space: nowrap; }
.distribution-progress { height: 8px; }
.distribution-progress::-webkit-progress-value { background: #2a804c; }
.membership-conversion { border-radius: 8px; margin-top: 14px; padding: 6px 12px; gap: 0; background: #f0f6f0; }
.membership-conversion > div { flex: 1; text-align: center; gap: 4px; }
.membership-conversion > div + div { border-left: 1px solid #d8e5d9; }
.membership-conversion strong { font-size: 13px; line-height: 1.2; font-weight: 500; color: #237c46; }
.membership-conversion span { font-size: 22px; line-height: 1.1; color: #1d5a34; font-variant-numeric: tabular-nums; }
.conversion-note { margin: 8px 0 0; text-align: center; font-size: 12px; color: var(--muted); }
#page-overview .membership-summary { min-height: 0; }
#page-overview .recent-users-card { grid-row: auto; margin-top: 18px; }

/* 统计口径收进弹层，标题旁和“功能使用”卡片右上角各有一个入口 */
.overview-help { min-height: 0; margin-left: 10px; border: 0; background: transparent; color: var(--green-strong); padding: 0; font-size: 13px; }
.overview-help:hover:not(:disabled) { background: transparent; text-decoration: underline; }
#usage-timezone { margin-left: 0; color: var(--muted); }
.usage-explanation-heading { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; padding: 0 0 10px; color: var(--ink); }
.usage-explanation-heading .icon-button { margin-left: auto; }

/* 注册来源排行：条形图用和列表里来源标签同一种浅蓝，和会员分布的绿色区分 */
.registration-sources-list { display: grid; gap: 10px; margin: 4px 0 0; padding: 0; list-style: none; }
.registration-source-row { display: grid; grid-template-columns: 18px minmax(92px, 1.1fr) minmax(0, 1fr) 88px; align-items: center; gap: 10px; font-size: 13px; }
.registration-source-rank { color: var(--muted); font-size: 12px; text-align: center; font-variant-numeric: tabular-nums; }
.registration-source-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.registration-source-row strong { text-align: right; font-size: 12px; font-weight: 400; white-space: nowrap; font-variant-numeric: tabular-nums; }
.registration-source-row .distribution-progress::-webkit-progress-value { background: #5f86ab; }
.registration-source-row .distribution-progress::-moz-progress-bar { background: #5f86ab; }
.registration-sources-empty { margin: 8px 0 0; color: var(--muted); font-size: 13px; }
.registration-sources-foot { margin: 12px 0 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.usage-explanation-heading strong { font-size: 15px; font-weight: 650; }
.usage-explanation-heading span { color: #646b65; font-size: 13px; font-weight: 400; }
.usage-explanation-body { padding: 0; }
.usage-explanation-list { display: grid; gap: 7px; margin: 0; }
.usage-explanation-list > div { display: grid; grid-template-columns: 62px minmax(0, 1fr); gap: 10px; align-items: start; }
.usage-explanation-list dt { color: #4f574f; font-size: 13px; font-weight: 600; line-height: 1.55; }
.usage-explanation-list dd { margin: 0; color: #646b65; font-size: 13px; line-height: 1.55; }
.overview-footnote { text-align: center; color: var(--muted); font-size: 12px; margin: 16px 0 0; }

@media (max-width: 1350px) {
  .topbar { grid-template-columns: minmax(180px, 1fr) minmax(160px, 220px) auto; }
  .topbar-actions { grid-column: 2 / 4; grid-row: 2; justify-content: flex-end; }
  .kpi-tab { padding: 10px; }
  .kpi-tab strong { font-size: 26px; }
}
@media (max-width: 1100px) {
  .overview-row-main { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 820px) {
  .main-content { padding: 0 16px 28px; }
  .topbar { grid-template-columns: 1fr auto; gap: 12px; }
  .global-search { grid-row: 2; grid-column: 1 / -1; }
  .topbar-actions { grid-row: 3; grid-column: 1 / -1; justify-content: flex-start; }
  .admin-menu { grid-column: 2; grid-row: 1; }
  .overview-subtitle { font-size: 13px; }
  .overview-toolbar { flex-wrap: wrap; justify-content: flex-start; }
  .overview-scope { flex-basis: 100%; }
  #page-overview .paper-card { padding: 16px 14px; }
  .kpi-tabs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .usage-table-today { font-size: 16px; }
  .usage-table thead th:nth-child(4), .usage-table tbody td:nth-child(4) { display: none; }
  .chart-tooltip { left: auto !important; right: 0; }
}
