:root {
  --brand: #ff7a59;
  --brand-deep: #f2603c;
  --brand-tint: #fff4f0;
  --text: #1f2022;
  --text-sub: #8a8f99;
  --text-weak: #b3b7bd;
  --line: #ececeb;
  --bg: #f7f6f5;
  --card: #fff;
  --ok: #2fb37a;
  --warn: #f5a524;
  --danger: #f2553d;
  --radius: 12px;
  --shadow: 0 2px 12px rgba(31, 32, 34, 0.06);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

.hidden { display: none !important; }

/* ---------- 登录 ---------- */
.login-mask {
  position: fixed; inset: 0;
  background: linear-gradient(135deg, #ffe9e0, #f7f6f5 60%);
  display: flex; align-items: center; justify-content: center;
}
.login-box {
  width: 360px; background: #fff; border-radius: 18px; padding: 40px 32px;
  box-shadow: 0 16px 48px rgba(31, 32, 34, 0.12);
}
.login-brand { font-size: 26px; font-weight: 700; margin-bottom: 28px; }
.login-brand span { font-size: 14px; color: var(--text-sub); font-weight: 400; margin-left: 8px; }
.lg-input {
  width: 100%; height: 44px; padding: 0 14px; margin-bottom: 14px;
  border: 1px solid var(--line); border-radius: 10px; font-size: 14px; outline: none;
}
.lg-input:focus { border-color: var(--brand); }
.lg-btn {
  width: 100%; height: 44px; border: 0; border-radius: 10px; cursor: pointer;
  background: var(--brand); color: #fff; font-size: 15px; font-weight: 600;
}
.lg-btn:disabled { opacity: .6; cursor: default; }
.lg-err { min-height: 20px; margin-top: 12px; color: var(--danger); font-size: 13px; }
.lg-tip { margin-top: 8px; font-size: 12px; color: var(--text-weak); }

/* ---------- 布局 ---------- */
.app { display: flex; min-height: 100vh; }

.side {
  width: 210px; flex-shrink: 0; background: #fff; border-right: 1px solid var(--line);
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
}
.side-brand { padding: 20px 20px 14px; font-size: 19px; font-weight: 700; }
.side-brand span { font-size: 12px; color: var(--text-sub); font-weight: 400; margin-left: 6px; }
.nav { flex: 1; overflow-y: auto; padding: 6px 10px 20px; }
.nav-group { padding: 14px 10px 6px; font-size: 11px; color: var(--text-weak); letter-spacing: .5px; }
.nav-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 9px 12px; margin-bottom: 2px; border-radius: 9px; cursor: pointer;
  color: var(--text); font-size: 13.5px;
}
.nav-item:hover { background: var(--bg); }
.nav-item.on { background: var(--brand-tint); color: var(--brand-deep); font-weight: 600; }
.nav-badge {
  min-width: 20px; height: 18px; padding: 0 6px; border-radius: 9px;
  background: var(--danger); color: #fff; font-size: 11px; line-height: 18px; text-align: center;
}
.nav-badge.zero { background: var(--line); color: var(--text-weak); }
.side-foot { padding: 12px 16px; border-top: 1px solid var(--line); }
.side-me { font-size: 12px; color: var(--text-sub); margin-bottom: 8px; }
.side-logout {
  width: 100%; height: 32px; border: 1px solid var(--line); background: #fff;
  border-radius: 8px; cursor: pointer; font-size: 13px; color: var(--text-sub);
}

.main { flex: 1; min-width: 0; padding: 0 28px 40px; }
.top {
  display: flex; align-items: flex-end; justify-content: space-between;
  padding: 24px 0 16px; gap: 16px;
}
.top-title { margin: 0; font-size: 21px; }
.top-desc { margin-top: 4px; font-size: 12.5px; color: var(--text-sub); }
.top-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- 卡片 ---------- */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; margin-bottom: 16px; }
.card-title { font-size: 15px; font-weight: 600; margin-bottom: 14px; }

.grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
.stat { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px 18px; }
.stat-num { font-size: 26px; font-weight: 700; }
.stat-label { margin-top: 4px; font-size: 12.5px; color: var(--text-sub); }
.stat-warn .stat-num { color: var(--warn); }
.stat-danger .stat-num { color: var(--danger); }
.stat-ok .stat-num { color: var(--ok); }

.todo-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 4px; border-top: 1px solid var(--line); cursor: pointer;
}
.todo-row:first-child { border-top: 0; }
.todo-row:hover { background: var(--bg); }
.todo-name { font-size: 14px; }
.todo-count { font-size: 15px; font-weight: 700; color: var(--brand-deep); }
.todo-count.zero { color: var(--text-weak); }

/* ---------- 表格 ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th {
  text-align: left; padding: 10px 12px; color: var(--text-sub); font-weight: 500;
  border-bottom: 1px solid var(--line); white-space: nowrap;
}
td { padding: 10px 12px; border-bottom: 1px solid #f6f6f5; vertical-align: middle; }
tbody tr:hover { background: #fcfcfc; }
td.nowrap, th.nowrap { white-space: nowrap; }
.mono { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12px; }

.tag { display: inline-block; padding: 2px 8px; border-radius: 6px; font-size: 11.5px; background: var(--bg); color: var(--text-sub); }
.tag-ok { background: #e9f8f1; color: var(--ok); }
.tag-warn { background: #fff6e5; color: #c47f10; }
.tag-danger { background: #ffeceb; color: var(--danger); }
.tag-brand { background: var(--brand-tint); color: var(--brand-deep); }

.btn {
  height: 30px; padding: 0 12px; border-radius: 8px; border: 1px solid var(--line);
  background: #fff; cursor: pointer; font-size: 12.5px; color: var(--text);
}
.btn:hover { border-color: var(--brand); color: var(--brand-deep); }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-deep); color: #fff; }
.btn-danger { color: var(--danger); border-color: #ffd6d0; }
.btn-danger:hover { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn:disabled { opacity: .5; cursor: default; }
.btn-sm { height: 26px; padding: 0 9px; font-size: 12px; }

.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.filters input, .filters select {
  height: 32px; padding: 0 10px; border: 1px solid var(--line); border-radius: 8px; font-size: 13px; outline: none;
}
.filters input:focus, .filters select:focus { border-color: var(--brand); }

.pager { display: flex; align-items: center; justify-content: flex-end; gap: 10px; margin-top: 14px; font-size: 13px; color: var(--text-sub); }

.empty { padding: 48px 0; text-align: center; color: var(--text-weak); font-size: 13px; }
.loading { padding: 48px 0; text-align: center; color: var(--text-weak); font-size: 13px; }

/* ---------- 抽屉 ---------- */
.drawer { position: fixed; inset: 0; z-index: 50; }
.drawer-mask { position: absolute; inset: 0; background: rgba(20, 20, 22, .35); }
.drawer-panel {
  position: absolute; right: 0; top: 0; bottom: 0; width: min(560px, 92vw);
  background: #fff; display: flex; flex-direction: column; box-shadow: -8px 0 32px rgba(0, 0, 0, .12);
}
.drawer-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid var(--line); font-size: 16px; font-weight: 600;
}
.drawer-close { border: 0; background: none; font-size: 24px; cursor: pointer; color: var(--text-sub); line-height: 1; }
.drawer-body { flex: 1; overflow-y: auto; padding: 18px 20px 40px; }

.kv { display: flex; padding: 7px 0; font-size: 13px; border-bottom: 1px solid #f6f6f5; }
.kv-k { width: 120px; flex-shrink: 0; color: var(--text-sub); }
.kv-v { flex: 1; min-width: 0; word-break: break-all; }
.block { margin-bottom: 18px; }
.block-title { font-size: 13px; font-weight: 600; margin-bottom: 8px; color: var(--text); }
.pre {
  background: #fafafa; border: 1px solid var(--line); border-radius: 8px;
  padding: 10px 12px; font-size: 12.5px; white-space: pre-wrap; word-break: break-all;
}
.imgs { display: flex; gap: 8px; flex-wrap: wrap; }
.imgs img { width: 92px; height: 92px; object-fit: cover; border-radius: 8px; background: var(--bg); }

/* ---------- toast ---------- */
.toast {
  position: fixed; left: 50%; top: 24px; transform: translateX(-50%);
  background: rgba(31, 32, 34, .92); color: #fff; padding: 10px 18px; border-radius: 10px;
  font-size: 13px; z-index: 99; max-width: 70vw;
}
.toast.err { background: var(--danger); }

.warn-box {
  background: #fff6e5; border: 1px solid #ffe4b8; color: #96631a;
  padding: 10px 14px; border-radius: 10px; font-size: 13px; margin-bottom: 12px;
}
