:root {
  --bg: #f3f5f7;
  --card: #ffffff;
  --line: #e7eaee;
  --txt: #1a1f26;
  --sub: #7b8592;
  --brand: #22c55e;
  --brand-d: #16a34a;
  --danger: #ef4444;
  --warn: #f59e0b;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 8px 24px rgba(16, 24, 40, .06);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg); color: var(--txt);
  font: 14px/1.5 -apple-system, "HarmonyOS Sans SC", "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
  overscroll-behavior: none;
}
button { font: inherit; cursor: pointer; }
input, select { font: inherit; }
.app { height: 100%; }
.boot { display: flex; height: 100%; align-items: center; justify-content: center; color: var(--sub); }

/* ---------- 通用组件 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 40px; padding: 0 16px; border: 0; border-radius: 10px;
  background: var(--brand); color: #fff; font-weight: 600; transition: .15s;
}
.btn:hover { background: var(--brand-d); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.ghost { background: #eef1f4; color: var(--txt); font-weight: 500; }
.btn.ghost:hover { background: #e3e8ee; }
.btn.danger { background: #fee2e2; color: var(--danger); }
.btn.sm { height: 32px; padding: 0 12px; border-radius: 8px; font-size: 13px; }
.btn.block { width: 100%; }
.input {
  width: 100%; height: 42px; padding: 0 12px; border: 1px solid var(--line);
  border-radius: 10px; background: #fff; color: var(--txt); outline: none; transition: .15s;
}
.input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(34, 197, 94, .12); }
textarea.input { height: auto; padding: 10px 12px; resize: vertical; min-height: 86px; font-size: 12px; line-height: 1.55; }
.label { display: block; margin: 0 0 6px; color: var(--sub); font-size: 12.5px; }
.field { margin-bottom: 14px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.tag { display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 8px; border-radius: 6px; font-size: 12px; background: #eef1f4; color: var(--sub); }
.tag.ok { background: rgba(34, 197, 94, .12); color: var(--brand-d); }
.tag.warn { background: rgba(245, 158, 11, .14); color: #b45309; }
.tag.bad { background: rgba(239, 68, 68, .12); color: var(--danger); }
.muted { color: var(--sub); }
.small { font-size: 12.5px; }
.row { display: flex; align-items: center; gap: 10px; }
.spread { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.hr { height: 1px; background: var(--line); border: 0; margin: 14px 0; }

/* ---------- 登录 / 首次使用 ---------- */
.center-wrap { min-height: 100%; display: flex; align-items: center; justify-content: center; padding: 24px; }
.auth-card { width: 100%; max-width: 400px; padding: 28px; }
.brand { display: flex; align-items: center; gap: 10px; margin-bottom: 20px; }
.logo {
  width: 42px; height: 42px; border-radius: 12px; background: var(--brand);
  color: #fff; font-weight: 800; display: grid; place-items: center; letter-spacing: .5px;
}
.brand h1 { margin: 0; font-size: 17px; }
.brand p { margin: 2px 0 0; color: var(--sub); font-size: 12px; }
.tip { margin-top: 14px; padding: 10px 12px; border-radius: 10px; background: #f7f9fb; border: 1px dashed var(--line); color: var(--sub); font-size: 12.5px; line-height: 1.6; }
.steps { display: flex; gap: 6px; margin-bottom: 18px; }
.steps i { flex: 1; height: 4px; border-radius: 2px; background: #e5e9ee; }
.steps i.on { background: var(--brand); }
.code { font-family: ui-monospace, Consolas, monospace; font-size: 11.5px; word-break: break-all; }

/* ---------- 主框架 ---------- */
.shell { height: 100%; display: grid; grid-template-columns: 74px clamp(236px, 24vw, 340px) minmax(0, 1fr); background: var(--card); }
.rail { background: #0f172a; color: #94a3b8; display: flex; flex-direction: column; align-items: center; padding: 14px 0; gap: 6px; }
.rail .logo { width: 38px; height: 38px; font-size: 13px; margin-bottom: 10px; }
.rail button {
  width: 54px; padding: 8px 0 6px; border: 0; border-radius: 10px; background: transparent;
  color: inherit; font-size: 11px; display: flex; flex-direction: column; align-items: center; gap: 3px;
}
.rail button svg { width: 20px; height: 20px; }
.rail button.on { background: rgba(255, 255, 255, .09); color: #fff; }
.rail .foot { margin-top: auto; font-size: 10.5px; text-align: center; color: #64748b; word-break: break-all; padding: 0 4px; }
.rail .rail-foot { margin-top: auto; display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 10.5px; color: #64748b; padding: 0 4px; }
.rail .rail-foot b { color: #cbd5e1; font-weight: 600; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.logrow {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr) auto 58px;
  grid-template-areas: "t n r c";
  gap: 10px;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid #f1f4f7;
  font-size: 12.5px;
}
.logrow .lt { grid-area: t; color: #8a929c; }
.logrow .ln { grid-area: n; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.logrow .lr { grid-area: r; justify-self: end; }
.logrow .lc { grid-area: c; color: #8a929c; text-align: right; }
@media (max-width: 640px) {
  .logrow {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: "t c" "n r";
    row-gap: 5px;
    padding: 10px 0;
  }
  .logrow .ln { font-weight: 600; font-size: 13px; }
}

.list-col { border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; background: #fbfcfd; }
.list-head { padding: 14px 16px 10px; border-bottom: 1px solid var(--line); background: #fff; }
.hall-line { display: flex; align-items: center; gap: 8px; margin-top: 10px; font-size: 13px; }
.list-body { overflow: auto; padding: 8px; flex: 1; }
.empty { padding: 40px 16px; text-align: center; color: var(--sub); font-size: 13px; }

.main-col { min-width: 0; display: flex; flex-direction: column; min-height: 0; background: var(--bg); }
.main-scroll { overflow: auto; padding: 18px; flex: 1; }
.panel { max-width: 780px; margin: 0 auto; }
.panel > .card + .card { margin-top: 14px; }
.card-pad { padding: 18px; }
.kv { display: grid; grid-template-columns: repeat(auto-fit, minmax(118px, 1fr)); gap: 10px; }
.kv .cell { background: #f7f9fb; border-radius: 10px; padding: 10px 12px; }
.kv .cell b { display: block; font-size: 16px; margin-top: 2px; font-variant-numeric: tabular-nums; }
.statusbar { height: 30px; border-top: 1px solid var(--line); background: #fff; display: flex; align-items: center; gap: 8px; padding: 0 12px; font-size: 12px; color: var(--sub); }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--brand); }
.usage { margin: 0 auto; padding: 22px; max-width: 560px; }

/* ---------- 表格 ---------- */
table.tb { width: 100%; border-collapse: collapse; font-size: 13px; }
table.tb th, table.tb td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.tb th { color: var(--sub); font-weight: 500; font-size: 12px; }
table.tb tr:last-child td { border-bottom: 0; }
.tb-wrap { overflow: auto; }

/* ---------- 组件：开关 / 间隔胶囊 / 进度条 ---------- */
.sw { width: 38px; height: 21px; border-radius: 11px; background: #e2e7ed; position: relative; flex: none; cursor: pointer; transition: background .16s; display: inline-block; }
.sw.on { background: var(--brand); }
.sw span { position: absolute; top: 2px; left: 2px; width: 17px; height: 17px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(16, 24, 40, .18); transition: left .16s; }
.sw.on span { left: 19px; }
.chip { border: 1px solid var(--line); background: #fff; color: var(--text); border-radius: 999px; padding: 4px 11px; font-size: 12.5px; cursor: pointer; }
.chip.on { border-color: var(--brand); background: #eafaf0; color: var(--brand-d); font-weight: 600; }
.bar { height: 6px; border-radius: 3px; background: #eef2f6; overflow: hidden; margin-top: 14px; }
.bar i { display: block; height: 100%; background: var(--brand); border-radius: 3px; transition: width .4s; }
.car.sel { box-shadow: inset 3px 0 0 var(--brand); }
.car b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.car .tag { flex: none; }

/* ---------- 窄窗（平板 / 分屏）---------- */
@media (max-width: 980px) and (min-width: 641px) {
  .shell { grid-template-columns: 60px clamp(238px, 32vw, 300px) minmax(0, 1fr); }
  .car .st { display: none; }
  .rail { padding: 10px 0; }
  .rail .logo { width: 34px; height: 34px; font-size: 12px; }
  .rail button { width: 46px; font-size: 10px; }
  .rail button svg { width: 18px; height: 18px; }
  .list-head { padding: 10px 12px 8px; }
  .hall-line { flex-wrap: wrap; gap: 4px 6px; }
  .main-scroll { padding: 12px; }
  .card-pad { padding: 14px; }
  .kv { grid-template-columns: repeat(2, 1fr); }
  .panel { max-width: 100%; }
}

/* ---------- 手机 ---------- */
.backbar { display: none; }
.tabbar { display: none; }
@media (max-width: 640px) {
  .shell { grid-template-columns: 1fr; grid-template-rows: 1fr 56px; }
  .rail { display: none; }
  .list-col { border-right: 0; }
  .main-col { display: none; }
  .shell.show-main .list-col { display: none; }
  .shell.show-main .main-col { display: flex; padding-bottom: 56px; }
  .backbar { display: block; padding: 8px 10px 0; }
  .backbar button { border: 0; background: transparent; color: var(--brand-d); font-size: 13px; padding: 6px 2px; }
  .tabbar {
    position: fixed; left: 0; right: 0; bottom: 0; height: 56px; z-index: 20;
    display: grid; grid-template-columns: repeat(4, 1fr); background: #fff;
    border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom);
  }
  .tabbar button { border: 0; background: transparent; color: var(--sub); font-size: 11px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; }
  .tabbar button svg { width: 21px; height: 21px; display: block; }
  .tabbar button span { font-size: 10.5px; line-height: 1; }
  .tabbar button.on { color: var(--brand-d); }
  .kv { grid-template-columns: repeat(2, 1fr); }
  .main-scroll { padding: 12px; }
  .card-pad { padding: 14px; }
  .statusbar { display: none; }
}

/* ---------- 提示 ---------- */
.toast {
  position: fixed; left: 50%; bottom: 80px; transform: translateX(-50%) translateY(12px);
  background: rgba(15, 23, 42, .92); color: #fff; padding: 10px 16px; border-radius: 10px;
  font-size: 13px; opacity: 0; pointer-events: none; transition: .2s; z-index: 50; max-width: 86vw;
}
.toast.on { opacity: 1; transform: translateX(-50%) translateY(0); }
.qr-box { width: 200px; height: 200px; margin: 0 auto 12px; border-radius: 12px; background: #f3f5f7; display: grid; place-items: center; color: var(--sub); font-size: 13px; border: 1px dashed var(--line); }
