* { margin: 0; padding: 0; box-sizing: border-box; }
:root {
  /* 肯德基柜台配色：品牌红主导，暖白纸底，上校黄做唯一强调 */
  --red: #e4002b; --red-deep: #b80022; --red-tint: #fff2f4;
  --gold: #ffc72c;
  --ink: #231f20; --ink-2: #4a4340; --muted: #8a807b;
  --paper: #fbf6f1; --card: #ffffff; --line: #ece3da; --line-2: #f6efe8;
  --ok: #14682f; --warn: #8a5a00; --bad: #a3121f;
  --sans: "HarmonyOS Sans SC", "PingFang SC", "Source Han Sans SC", "Noto Sans SC", "Microsoft YaHei", sans-serif;
  --display: "Bahnschrift", "Avenir Next Condensed", "HarmonyOS Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  /* 全家桶斜纹：白底红条，全站唯一的品牌记忆点 */
  --stripe: repeating-linear-gradient(115deg, var(--red) 0 6px, #fff 6px 21px);
}
body { font-family: var(--sans); background: var(--paper); color: var(--ink); font-size: 14px; line-height: 1.6; -webkit-font-smoothing: antialiased; display: flex; min-height: 100vh; }
a { color: var(--red-deep); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 3px solid rgba(255, 199, 44, .8); outline-offset: 2px; }

/* ---------- 左侧导航 ---------- */
.side { flex: none; width: 226px; background: #fff; border-right: 1px solid var(--line); position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 11px; padding: 17px 18px; background: var(--red); color: #fff; }
.brand:hover { text-decoration: none; color: #fff; }
/* 纸桶剪影：桶身斜纹 + 白色桶沿，纯 CSS，不占用商标图形 */
.bucket { position: relative; flex: none; width: 27px; height: 30px; }
.bucket i { position: absolute; inset: 6px 0 0; background: repeating-linear-gradient(100deg, var(--red) 0 3px, #fff 3px 8px); clip-path: polygon(7% 0, 93% 0, 79% 100%, 21% 100%); }
.bucket::after { content: ""; position: absolute; inset: 1px 0 auto; height: 6px; border-radius: 3px; background: #fff; }
.brand span:last-child { font-family: var(--display); font-size: 15px; letter-spacing: .04em; line-height: 1.25; }
.brand b { display: block; font-weight: 700; font-size: 17px; }
.side nav { padding: 12px 10px 28px; }
.navgroup { margin: 16px 12px 6px; font-size: 11px; letter-spacing: .16em; color: var(--muted); }
.side nav a { display: block; padding: 9px 13px; margin-bottom: 2px; border-radius: 9px; color: var(--ink-2); transition: background .16s, color .16s; }
.side nav a:hover { background: #f8f2ec; color: var(--ink); text-decoration: none; }
.side nav a.active { background: var(--red-tint); color: var(--red-deep); font-weight: 600; box-shadow: inset 3px 0 0 var(--red); }

/* ---------- 主区与顶条 ---------- */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.bar { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; justify-content: flex-end; gap: 14px; height: 58px; padding: 0 clamp(14px, 3vw, 28px); background: #fff; border-bottom: 1px solid var(--line); }
.bar::after { content: ""; position: absolute; inset: auto 0 -6px 0; height: 6px; background: var(--stripe); }
.bal { font-size: 13px; color: var(--ink-2); background: #fffaee; border: 1px solid #f3dfa6; border-radius: 999px; padding: 4px 14px; }
.bal b { font-family: var(--display); font-size: 16px; color: var(--red); font-variant-numeric: tabular-nums; margin-left: 2px; }
.who { display: inline-flex; align-items: center; color: var(--ink-2); }
.avatar { width: 26px; height: 26px; margin-right: 8px; border-radius: 50%; background: var(--red); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; }
.wrap { width: 100%; max-width: 1420px; margin: 0 auto; padding: clamp(20px, 3vw, 30px) clamp(14px, 3vw, 28px) 64px; }

/* ---------- 首页看板 ---------- */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(196px, 1fr)); gap: 14px; margin-bottom: 20px; }
.tile { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 17px 19px; }
.tile .k { font-size: 13px; color: var(--muted); }
.tile .v { font-family: var(--display); font-size: 31px; font-weight: 700; line-height: 1.2; margin-top: 5px; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.tile .v.sm { font-size: 21px; letter-spacing: 0; }
.tile .v i { font-style: normal; font-family: var(--sans); font-size: 13px; font-weight: 400; color: var(--muted); margin-left: 5px; }
.tile .s { margin-top: 9px; font-size: 12px; color: var(--muted); line-height: 1.5; }
/* 主指标独占一块红，避免整排卡片长得一模一样 */
.tile.hi { background: var(--red); border-color: var(--red); color: #fff; }
.tile.hi .k, .tile.hi .s { color: rgba(255, 255, 255, .85); }
.tile.hi .v i { color: rgba(255, 255, 255, .8); }

/* 区间快捷选择 */
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chips a { padding: 5px 14px; border: 1px solid var(--line); border-radius: 999px; background: #fff; color: var(--ink-2); font-size: 13px; }
.chips a:hover { border-color: var(--red); color: var(--red); text-decoration: none; }
.chips a.on { background: var(--red); border-color: var(--red); color: #fff; }

/* ---------- 卡片 ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: clamp(17px, 2vw, 24px); margin-bottom: 18px; }
/* 菜单板式标题：红块 + 延伸细线 */
.card h2 { display: flex; align-items: center; gap: 11px; font-size: 16px; font-weight: 700; margin-bottom: 16px; }
.card h2::before { content: ""; flex: none; width: 4px; height: 15px; border-radius: 2px; background: var(--red); }
.card h2::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.grid { display: grid; gap: 18px; }
.grid.cols2 { grid-template-columns: minmax(0, 1.06fr) minmax(0, .94fr); }

.stat { font-family: var(--display); font-size: clamp(30px, 4vw, 40px); font-weight: 700; line-height: 1.15; color: var(--red); font-variant-numeric: tabular-nums; }
.stat small { font-family: var(--sans); font-size: 13px; color: var(--muted); font-weight: 400; line-height: 1.5; display: block; margin-top: 10px; }
.stat small::before { content: ""; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--gold); margin-right: 7px; vertical-align: middle; }

/* ---------- 表格 ---------- */
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line-2); }
th { color: var(--muted); font-weight: 600; font-size: 12px; letter-spacing: .06em; background: #faf4ec; border-bottom-color: var(--line); white-space: nowrap; }
th:first-child { border-radius: 8px 0 0 8px; }
th:last-child { border-radius: 0 8px 8px 0; }
tr:last-child td { border-bottom: 0; }
tr:hover td { background: var(--red-tint); }
.table-scroll { overflow-x: auto; margin: 0 -4px; padding: 0 4px; }
/* 分区小标题 */
.subhead { font-size: 13px; font-weight: 700; color: var(--ink-2); margin: 18px 0 8px; }
.subhead::before { content: ""; display: inline-block; width: 5px; height: 5px; border-radius: 50%; background: var(--gold); margin-right: 8px; vertical-align: middle; }
.table-scroll + .subhead { margin-top: 22px; }

/* ---------- 分区选择器：品牌列 + 分类列 ---------- */
.picker { display: flex; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.pcol { flex: 1; min-width: 0; max-height: 330px; overflow-y: auto; padding: 6px; }
.pcol + .pcol { border-left: 1px solid var(--line); background: #fdfaf6; }
.pcol a { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 12px; border-radius: 8px; color: var(--ink-2); }
.pcol a:hover { background: #f8f2ec; color: var(--ink); text-decoration: none; }
.pcol a.on { background: var(--red-tint); color: var(--red-deep); font-weight: 600; box-shadow: inset 3px 0 0 var(--red); }
.pcol i { font-style: normal; font-size: 12px; color: var(--muted); }
.pcol a.on i { color: var(--red-deep); }
.pcol p { padding: 8px 12px; }

/* ---------- 按钮 ---------- */
.btn { display: inline-block; background: var(--red); color: #fff; border: 1px solid transparent; border-radius: 999px; padding: 8px 19px; cursor: pointer; font: inherit; font-weight: 600; line-height: 1.35; transition: background .18s, box-shadow .18s, transform .18s; }
.btn:hover { background: var(--red-deep); text-decoration: none; color: #fff; box-shadow: 0 6px 16px -8px rgba(228, 0, 43, .8); }
.btn:active { transform: translateY(1px); }
.btn.ghost { background: #fff; color: var(--ink); border-color: var(--line); font-weight: 500; }
.btn.ghost:hover { background: #fff; border-color: var(--ink); box-shadow: none; }
/* 危险操作用上校黑打底，悬停转红，静止态不会跟主按钮混淆 */
.btn.danger { background: var(--ink); }
.btn.danger:hover { background: var(--red); }
.btn.sm { padding: 4px 12px; font-size: 13px; }

/* ---------- 工具条：把新增/批量表单收进按钮里，不占版面 ---------- */
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
/* 搜索框吃掉剩余宽度，按钮跟在同一行；输入框可无限收窄，窄屏也不会把按钮挤下去 */
.toolbar > form.inline { display: flex; gap: 10px; flex: 1 1 180px; min-width: 0; }
.toolbar > form.inline input { flex: 1 1 auto; min-width: 0; width: auto; }
.toolbar > form.inline .btn { flex: none; }
.drop { position: relative; flex: none; }
.drop > summary { list-style: none; }
.drop > summary::-webkit-details-marker { display: none; }
.drop > .panel { position: absolute; z-index: 20; top: calc(100% + 8px); left: 0; min-width: min(620px, 80vw); background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 16px; box-shadow: 0 16px 40px -18px rgba(0, 0, 0, .45); }
/* 最右侧的面板向左展开，避免超出视口 */
.drop:last-child > .panel { left: auto; right: 0; }
/* 窄屏改成顺排：展开的那个占满整行，面板回到文档流按整行宽度铺开，不再绝对定位溢出屏幕 */
@media (max-width: 720px) {
  /* 搜索框独占一行，其余按钮并排排在下一行，不会一个按钮占一行 */
  .toolbar > form.inline { flex: 1 0 100%; }
  .drop[open] { flex: 1 0 100%; }
  .drop > .panel { position: static; min-width: 0; margin-top: 10px; box-shadow: none; }
}

/* ---------- 表单 ---------- */
input, select, textarea { width: 100%; padding: 8px 12px; border: 1px solid var(--line); border-radius: 9px; font: inherit; background: #fff; color: var(--ink); transition: border-color .15s, box-shadow .15s; }
input[type="checkbox"] { width: auto; min-width: 0; margin: 0; accent-color: var(--red); cursor: pointer; vertical-align: middle; }
input:hover, select:hover, textarea:hover { border-color: #d9cec3; }
input:focus, select:focus, textarea:focus { outline: 0; border-color: var(--red); box-shadow: 0 0 0 3px rgba(228, 0, 43, .12); }
label { display: block; margin: 14px 0 6px; color: var(--ink-2); font-size: 13px; font-weight: 500; }
form.inline { display: inline; }
form.inline input, form.inline select { width: auto; }
.formrow { display: flex; gap: 12px; align-items: end; flex-wrap: wrap; }
.formrow input, .formrow select { min-width: 150px; }
.formrow label { margin-top: 0; }

/* ---------- 状态标记 ---------- */
.badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; line-height: 1.5; white-space: nowrap; }
.badge.ok { background: #e7f5ec; color: var(--ok); }
.badge.warn { background: #fff3d6; color: var(--warn); }
.badge.bad { background: #fde8e9; color: var(--bad); }
.badge.mut { background: #f3ede7; color: var(--muted); }

.alert { padding: 12px 16px; border-radius: 12px; margin-bottom: 18px; font-weight: 500; }
.alert::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 9px; vertical-align: middle; background: currentColor; }
.alert.ok { background: #e7f5ec; color: var(--ok); }
.alert.bad { background: #fde8e9; color: var(--bad); }

/* ---------- 登录 / 注册：白卡落在红纸桶上 ---------- */
.auth-box { position: relative; max-width: 404px; margin: clamp(28px, 8vh, 80px) auto; background: var(--red); border-radius: 22px; padding: 22px; overflow: hidden; box-shadow: 0 26px 60px -26px rgba(228, 0, 43, .65); }
.auth-box::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 7px; background: var(--stripe); }
.auth-box .logo { font-family: var(--display); text-align: center; font-size: 23px; font-weight: 700; letter-spacing: .05em; color: #fff; margin: 14px 0 20px; }
.auth-box .card { border: 0; margin-bottom: 0; border-radius: 14px; }
.wrap:has(.auth-box) .alert { max-width: 404px; margin-inline: auto; }

.muted { color: var(--muted); }
.mono { font-family: Consolas, "JetBrains Mono", ui-monospace, monospace; word-break: break-all; }
pre.mono { background: #faf4ec; border: 1px solid var(--line); border-radius: 10px; padding: 14px; white-space: pre-wrap; font-size: 12px; line-height: 1.65; }
.pager { margin-top: 16px; display: flex; gap: 10px; align-items: center; }
.mt { margin-top: 14px; }

/* ---------- 窄屏：侧栏收成左侧抽屉 ---------- */
.navbtn, .navmask { display: none; }
@media (max-width: 900px) {
  .side { position: fixed; z-index: 60; top: 0; left: 0; width: 258px; box-shadow: 8px 0 40px rgba(35, 31, 32, .22); transform: translateX(-100%); transition: transform .3s cubic-bezier(.22, 1, .36, 1); }
  body.navopen .side { transform: none; }
  .navmask { display: block; position: fixed; z-index: 55; inset: 0; background: rgba(35, 31, 32, .45); opacity: 0; visibility: hidden; transition: opacity .3s, visibility .3s; }
  body.navopen .navmask { opacity: 1; visibility: visible; }
  /* 汉堡按钮：三条杠由 span 与它的两个伪元素拼出 */
  .navbtn { display: flex; align-items: center; justify-content: center; margin-right: auto; width: 40px; height: 40px; margin-left: -8px; border: 0; border-radius: 10px; background: none; cursor: pointer; }
  .navbtn:hover { background: #f6efe8; }
  .navbtn span { position: relative; }
  .navbtn span, .navbtn span::before, .navbtn span::after { content: ""; display: block; width: 19px; height: 2px; border-radius: 2px; background: var(--ink); }
  .navbtn span::before { position: absolute; top: -6px; }
  .navbtn span::after { position: absolute; top: 6px; }
  .grid.cols2 { grid-template-columns: minmax(0, 1fr); }
}
@media (prefers-reduced-motion: reduce) { .side, .navmask { transition: none; } }

/* 载入时逐块上浮，只动 transform / opacity */
@media (prefers-reduced-motion: no-preference) {
  .wrap > * { animation: rise .5s cubic-bezier(.22, 1, .36, 1) backwards; }
  .wrap > :nth-child(2) { animation-delay: .05s; }
  .wrap > :nth-child(3) { animation-delay: .1s; }
  .wrap > :nth-child(4) { animation-delay: .15s; }
  .wrap > :nth-child(n+5) { animation-delay: .2s; }
}
@keyframes rise { from { opacity: 0; transform: translateY(12px); } }
