/* =========================================================
 * 管理后台样式
 * ========================================================= */
.app-shell { display: flex; min-height: 100vh; }

/* ---------- 侧栏 ---------- */
.sidebar {
  width: 232px; flex: none; background: var(--green-900); color: rgba(255,255,255,.74);
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; z-index: 70;
}
.side-head { display: flex; align-items: center; gap: 11px; padding: 22px 20px 20px; }
.side-head .brand-mark { background: rgba(255,255,255,.14); box-shadow: none; }
.side-head b { display: block; color: #fff; font-size: 15.5px; font-weight: 600; }
.side-head span { display: block; font-size: 10.5px; letter-spacing: 1px; color: rgba(255,255,255,.45); }
.side-nav { flex: 1; overflow-y: auto; padding: 6px 12px; }
.nav-group { margin: 14px 0 6px; padding: 0 10px; font-size: 10.5px; letter-spacing: 1.4px; color: rgba(255,255,255,.36); }
.nav-item {
  display: flex; align-items: center; gap: 11px; height: 40px; padding: 0 11px; border-radius: 10px;
  font-size: 13.5px; color: rgba(255,255,255,.72); margin-bottom: 2px; transition: background .16s, color .16s;
  cursor: pointer; border: 0; background: transparent; width: 100%; text-align: left;
}
.nav-item .icon { width: 17px; height: 17px; }
.nav-item:hover { background: rgba(255,255,255,.07); color: #fff; }
.nav-item.active { background: rgba(255,255,255,.14); color: #fff; font-weight: 500; }
.nav-badge { margin-left: auto; min-width: 20px; height: 19px; padding: 0 6px; border-radius: 999px; background: var(--sand-500); color: #fff; font-size: 11px; display: grid; place-items: center; }
.side-foot { padding: 14px 12px 18px; border-top: 1px solid rgba(255,255,255,.1); }
.side-link { display: flex; align-items: center; gap: 9px; padding: 9px 11px; border-radius: 9px; font-size: 12.5px; color: rgba(255,255,255,.66); }
.side-link:hover { background: rgba(255,255,255,.07); color: #fff; }
.side-link .icon { width: 15px; height: 15px; }
.side-store { padding: 12px; margin-bottom: 8px; border-radius: 11px; background: rgba(255,255,255,.06); }
.side-store b { display: flex; align-items: center; gap: 7px; color: #fff; font-size: 12.5px; font-weight: 500; }
.side-store b i { width: 6px; height: 6px; border-radius: 50%; background: #67c79c; }
.side-store span { font-size: 11px; color: rgba(255,255,255,.45); }

/* ---------- 主区 ---------- */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: 64px; flex: none; background: #fff; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 16px; padding: 0 26px; position: sticky; top: 0; z-index: 50;
}
.topbar h1 { font-size: 17px; font-weight: 600; letter-spacing: -.2px; }
.topbar .sub { font-size: 11.5px; color: var(--ink-400); margin-top: 1px; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 9px; }
.today-chip { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--ink-500); padding: 0 6px; }
.today-chip .icon { width: 15px; height: 15px; }
.menu-toggle { display: none; }
.content { padding: 24px 26px 40px; max-width: 1500px; width: 100%; }
.page { display: none; animation: pageIn .2s ease; }
.page.active { display: block; }
@keyframes pageIn { from { opacity: 0; transform: translateY(5px) } to { opacity: 1; transform: none } }

/* ---------- 概览 ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 15px; }
.stat-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow); position: relative; overflow: hidden; }
.stat-card::after { content: ''; position: absolute; right: -14px; top: -14px; width: 68px; height: 68px; border-radius: 50%; background: var(--green-50); }
.stat-card.sand::after { background: var(--sand-100); }
.stat-card.blue::after { background: var(--blue-50); }
.stat-top { display: flex; align-items: center; justify-content: space-between; position: relative; z-index: 1; }
.stat-top span { font-size: 12.5px; color: var(--ink-500); }
.stat-ico { width: 32px; height: 32px; border-radius: 10px; background: var(--green-50); color: var(--green-700); display: grid; place-items: center; }
.stat-card.sand .stat-ico { background: var(--sand-100); color: var(--sand-600); }
.stat-card.blue .stat-ico { background: var(--blue-50); color: var(--blue); }
.stat-ico .icon { width: 17px; height: 17px; }
.stat-num { font-size: 29px; font-weight: 600; letter-spacing: -1px; margin-top: 12px; line-height: 1.2; position: relative; z-index: 1; }
.stat-num small { font-size: 14px; font-weight: 500; color: var(--ink-500); margin-left: 3px; }
.stat-note { font-size: 11.5px; color: var(--ink-400); margin-top: 4px; }

.panel-grid { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 16px; margin-top: 16px; }
.panel-grid > * { min-width: 0; }
.panel { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.panel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.panel-head h2 { font-size: 15px; font-weight: 600; }
.panel-head .tiny { color: var(--ink-400); }

.chart { display: flex; align-items: flex-end; gap: 10px; height: 176px; padding-top: 12px; }
.chart-col { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 7px; height: 100%; justify-content: flex-end; }
.chart-bar-wrap { width: 100%; max-width: 38px; flex: 1; display: flex; align-items: flex-end; }
.chart-bar { width: 100%; border-radius: 6px 6px 3px 3px; background: var(--green-500); min-height: 3px; transition: height .3s; position: relative; }
.chart-bar:hover { background: var(--green-700); }
.chart-bar.today { background: var(--sand-500); }
.chart-val { font-size: 10.5px; color: var(--ink-400); height: 14px; }
.chart-label { font-size: 10.5px; color: var(--ink-500); white-space: nowrap; }
.chart-empty { display: grid; place-items: center; height: 176px; color: var(--ink-400); font-size: 12.5px; }

.todo-list { display: flex; flex-direction: column; gap: 9px; }
.todo-row { display: flex; align-items: center; gap: 11px; padding: 11px 12px; border: 1px solid var(--line); border-radius: 10px; }
.todo-row .av { width: 34px; height: 34px; border-radius: 10px; background: var(--green-50); color: var(--green-700); display: grid; place-items: center; font-size: 13px; font-weight: 600; flex: none; }
.todo-row .txt { flex: 1; min-width: 0; }
.todo-row .txt b { display: block; font-size: 12.5px; }
.todo-row .txt span { font-size: 11px; color: var(--ink-400); }
.quick-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; margin-top: 16px; }
.quick-btn { display: flex; align-items: center; gap: 9px; padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff; font-size: 12.5px; color: var(--ink-700); transition: .16s; text-align: left; }
.quick-btn:hover { border-color: var(--green-500); background: var(--green-50); color: var(--green-700); }
.quick-btn .icon { width: 16px; height: 16px; color: var(--green-600); }

/* ---------- 筛选栏 / 批量栏 ---------- */
.filter-bar { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; padding: 16px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 14px; }
.filter-bar .field { min-width: 140px; }
.filter-bar .field.search { flex: 1; min-width: 190px; }
.filter-bar .field.sm { min-width: 118px; }
.filter-bar .btn { height: 38px; }
.search-input { position: relative; }
.search-input .icon { position: absolute; left: 10px; top: 11px; width: 16px; height: 16px; color: var(--ink-400); }
.search-input input { padding-left: 34px; }

.bulk-bar { display: none; align-items: center; gap: 10px; padding: 11px 15px; margin-bottom: 12px; background: var(--green-800); color: #fff; border-radius: 11px; box-shadow: var(--shadow); flex-wrap: wrap; }
.bulk-bar.show { display: flex; }
.bulk-bar b { font-size: 13px; }
.bulk-bar .btn { height: 30px; padding: 0 11px; font-size: 12px; background: rgba(255,255,255,.14); border-color: rgba(255,255,255,.18); color: #fff; }
.bulk-bar .btn:hover { background: rgba(255,255,255,.24); }
.bulk-bar .btn-danger { background: rgba(255,255,255,.14); border-color: rgba(255,255,255,.18); color: #fff; }
.bulk-bar .spacer { flex: 1; }

.table-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.table-card .table-wrap table.tbl { min-width: 900px; }
.table-foot { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border-top: 1px solid var(--line); font-size: 12px; color: var(--ink-500); }
.avatar-xs { width: 26px; height: 26px; border-radius: 8px; display: inline-grid; place-items: center; color: #fff; font-size: 11px; font-weight: 600; vertical-align: middle; margin-right: 7px; }

/* ---------- 分类管理 ---------- */
.cat-manage-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.cat-manage-row { display: flex; align-items: center; gap: 12px; padding: 14px; border: 1px solid var(--line); border-radius: 11px; background: #fff; }
.cat-manage-row .ico { width: 38px; height: 38px; border-radius: 11px; background: var(--green-50); color: var(--green-700); display: grid; place-items: center; flex: none; }
.cat-manage-row .ico .icon { width: 19px; height: 19px; }
.cat-manage-row .txt { flex: 1; min-width: 0; }
.cat-manage-row .txt b { display: block; font-size: 13.5px; }
.cat-manage-row .txt span { font-size: 11.5px; color: var(--ink-400); }

/* ---------- 报表 ---------- */
.report-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.report-grid > * { min-width: 0; }
.rank-row { display: flex; align-items: center; gap: 11px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.rank-row:last-child { border-bottom: 0; }
.rank-num { width: 22px; height: 22px; border-radius: 7px; background: var(--bg); color: var(--ink-500); display: grid; place-items: center; font-size: 11px; font-weight: 600; flex: none; }
.rank-row:nth-child(1) .rank-num { background: var(--sand-100); color: var(--sand-600); }
.rank-row .txt { flex: 1; min-width: 0; font-size: 12.5px; }
.rank-bar { height: 6px; border-radius: 999px; background: var(--green-100); width: 120px; overflow: hidden; flex: none; }
.rank-bar i { display: block; height: 100%; border-radius: 999px; background: var(--green-600); }
.rank-val { font-size: 12px; font-weight: 600; min-width: 58px; text-align: right; }
.status-bars { display: flex; flex-direction: column; gap: 13px; }
.status-bar-row .lbl { display: flex; justify-content: space-between; font-size: 12.5px; margin-bottom: 6px; }
.status-bar-row .bar { height: 8px; border-radius: 999px; background: var(--bg); overflow: hidden; }
.status-bar-row .bar i { display: block; height: 100%; border-radius: 999px; }

/* ---------- 设置 ---------- */
.settings-grid { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, .8fr); gap: 16px; }
.settings-grid > * { min-width: 0; }
.setting-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 13px 0; border-bottom: 1px solid var(--line); }
.setting-row:last-child { border-bottom: 0; }
.setting-row .txt b { display: block; font-size: 13px; font-weight: 500; }
.setting-row .txt span { font-size: 11.5px; color: var(--ink-400); }
.switch { position: relative; width: 42px; height: 24px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch i { position: absolute; inset: 0; border-radius: 999px; background: var(--line-2); transition: .2s; cursor: pointer; }
.switch i::after { content: ''; position: absolute; width: 18px; height: 18px; border-radius: 50%; background: #fff; top: 3px; left: 3px; transition: .2s; box-shadow: 0 1px 3px rgba(0,0,0,.15); }
.switch input:checked + i { background: var(--green-600); }
.switch input:checked + i::after { transform: translateX(18px); }
.backup-list { display: flex; flex-direction: column; gap: 9px; }
.backup-btn { display: flex; align-items: center; gap: 11px; padding: 13px; border: 1px solid var(--line); border-radius: 11px; background: #fff; text-align: left; transition: .16s; width: 100%; }
.backup-btn:hover { border-color: var(--green-500); background: var(--green-50); }
.backup-btn .ico { width: 34px; height: 34px; border-radius: 10px; background: var(--green-50); color: var(--green-700); display: grid; place-items: center; flex: none; }
.backup-btn .ico .icon { width: 17px; height: 17px; }
.backup-btn .txt b { display: block; font-size: 12.5px; font-weight: 500; }
.backup-btn .txt span { font-size: 11px; color: var(--ink-400); }
.backup-btn.danger:hover { border-color: #e2b5b0; background: var(--red-50); }
.backup-btn.danger .ico { background: var(--red-50); color: var(--red); }
.info-note { padding: 13px; border-radius: 11px; background: var(--green-50); border: 1px solid var(--green-100); font-size: 12px; color: var(--green-800); line-height: 1.7; margin-top: 14px; }

/* ---------- 侧栏遮罩 ---------- */
.side-mask { display: none; position: fixed; inset: 0; background: rgba(16,35,30,.42); z-index: 65; }
.side-mask.show { display: block; }

@media (max-width: 1180px) {
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .panel-grid, .settings-grid, .report-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 820px) {
  .sidebar { position: fixed; left: -250px; transition: left .22s ease; width: 240px; }
  .sidebar.open { left: 0; }
  .menu-toggle { display: inline-flex; }
  .topbar { padding: 0 16px; }
  .content { padding: 18px 16px 32px; }
  .today-chip { display: none; }
  .cat-manage-grid { grid-template-columns: minmax(0, 1fr); }
}
/* ---------- 照片相关 ---------- */
.photo-panel .pu-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.cell-photo { display: inline-flex; align-items: center; gap: 6px; min-width: 0; border: 0; background: none; padding: 0; cursor: zoom-in; }
.cell-photo:hover .thumb { border-color: var(--green-500); }
.cell-photo .thumb { flex: none; }
.tbl th.photo-col, .tbl td.photo-col { width: 82px; }
.photo-modal-row { grid-column: 1 / -1; }
.photo-modal-row .field > label { margin-bottom: 8px; display: block; }

@media (max-width: 560px) {
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .stat-card { padding: 14px; }
  .stat-num { font-size: 23px; }
  .topbar h1 { font-size: 15px; }
  .filter-bar .field { min-width: 100%; }
  .filter-bar .field.sm { min-width: calc(50% - 5px); }
  .rank-bar { width: 60px; }
  .photo-panel .pu-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
