:root {
  --brand: #2f54eb; --brand2: #1d39c4; --bg: #f4f5fb; --card: #fff; --line: #e8e9f1;
  --ok: #52c41a; --warn: #fa8c16; --danger: #f5222d; --txt: #1f2329; --dim: #8a8f99;
}
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
body { font-family: -apple-system, "PingFang SC", "Microsoft YaHei", "Segoe UI", Roboto, sans-serif; background: var(--bg); color: var(--txt); }
body, html { height: 100%; }
.mono { font-variant-numeric: tabular-nums; }

.topbar { background: linear-gradient(135deg, var(--brand), var(--brand2)); color: #fff; padding: 14px 16px 46px; display: flex; justify-content: space-between; align-items: center; }
.brand { display: flex; align-items: center; gap: 10px; }
.logo { width: 38px; height: 38px; border-radius: 10px; background: rgba(255,255,255,.18); display: grid; place-items: center; font-weight: 800; font-size: 20px; }
.brand h1 { font-size: 17px; font-weight: 700; }
.brand p { font-size: 11px; opacity: .75; margin-top: 2px; }
.userbox { text-align: right; font-size: 11px; opacity: .9; }
.userbox select { margin-top: 4px; border: none; border-radius: 6px; padding: 4px 6px; font-size: 13px; background: #fff; color: #1f2329; max-width: 120px; }

.tabs { display: flex; gap: 6px; padding: 8px 12px; margin: -34px 12px 10px; background: var(--card); border-radius: 12px; box-shadow: 0 4px 16px rgba(31,35,41,.08); position: relative; z-index: 2; overflow-x: auto; }
.tabs button { flex: 1; border: none; background: none; padding: 9px 4px; border-radius: 8px; font-size: 14px; color: var(--dim); white-space: nowrap; cursor: pointer; font-weight: 600; }
.tabs button.active { background: var(--brand); color: #fff; }
.tabs b { display: inline-block; min-width: 18px; margin-left: 3px; padding: 0 5px; border-radius: 9px; background: var(--danger); color: #fff; font-size: 11px; line-height: 18px; }
.tabs button:not(.active) b { background: var(--warn); }

main { padding: 4px 12px 80px; max-width: 860px; margin: 0 auto; }

.sec-title { margin: 16px 4px 8px; font-size: 13px; color: var(--dim); font-weight: 700; }
.card { background: var(--card); border-radius: 12px; padding: 12px 14px; margin-bottom: 10px; box-shadow: 0 2px 8px rgba(31,35,41,.05); border: 1px solid var(--line); }
.card-head { display: flex; align-items: center; gap: 8px; }
.tag { font-size: 11px; padding: 1px 8px; border-radius: 20px; border: 1px solid; white-space: nowrap; }
.age { font-size: 12px; color: var(--dim); }
.mini { font-size: 12px; color: var(--dim); margin-left: auto; }
.card-main { padding: 8px 0; }
.store b { font-size: 15px; display: block; }
.acc { font-size: 12px; color: var(--dim); }
.phone { margin-top: 8px; font-size: 16px; font-weight: 700; letter-spacing: .5px; }
.city { font-size: 12px; color: var(--dim); font-weight: 400; margin-left: 8px; }
.over { margin-top: 8px; font-size: 12px; border-radius: 6px; padding: 4px 8px; }
.over.ok { background: #f6ffed; color: var(--ok); }
.over.warn { background: #fff7e6; color: #d46b08; }
.over.bad { background: #fff1f0; color: var(--danger); font-weight: 700; }
.card-foot { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; border-top: 1px dashed var(--line); padding-top: 8px; }
.act { border: 1px solid #d9d9d9; background: #fff; color: #444; border-radius: 6px; padding: 5px 10px; font-size: 12px; cursor: pointer; }
.act.sm { padding: 3px 7px; font-size: 11px; }
.act:hover { border-color: var(--brand); color: var(--brand); }
.act.del { color: var(--danger); border-color: #ffccc7; }
.btn { border: 1px solid #d9d9d9; background: #fff; border-radius: 8px; padding: 8px 16px; font-size: 14px; cursor: pointer; margin: 6px 6px 6px 0; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.note { font-size: 12px; color: var(--dim); }

.empty { text-align: center; color: var(--dim); padding: 60px 10px; font-size: 14px; background: #fff; border-radius: 12px; border: 1px dashed #dcdce4; }
.empty.small { padding: 24px; font-size: 13px; }
.empty-ic { width: 46px; height: 46px; margin: 0 auto 10px; border-radius: 50%; background: #f6ffed; color: var(--ok); display: grid; place-items: center; font-size: 22px; }
.loading, .lock { text-align: center; color: var(--dim); padding: 40px; }
.lock p { margin-bottom: 14px; }

.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; }
.filters input, .filters select { border: 1px solid var(--line); border-radius: 8px; padding: 7px 9px; font-size: 13px; background: #fff; }
.filters input#fKw { flex: 1 1 140px; }
.cnt { font-size: 12px; color: var(--dim); }
.tbl-wrap { overflow-x: auto; background: #fff; border-radius: 12px; border: 1px solid var(--line); }
.tbl { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 620px; }
.tbl th { text-align: left; font-size: 12px; color: var(--dim); padding: 9px 10px; border-bottom: 1px solid var(--line); background: #fafafd; white-space: nowrap; }
.tbl td { padding: 9px 10px; border-bottom: 1px solid #f2f3f7; vertical-align: top; }
.tbl tr:last-child td { border-bottom: none; }
.dim { font-size: 11px; color: var(--dim); }
.danger { color: var(--danger); font-weight: 700; }
.mono { font-family: Consolas, Menlo, monospace; }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 4px; }
.stat { background: #fff; border-radius: 12px; padding: 12px 6px; text-align: center; border: 1px solid var(--line); }
.stat b { display: block; font-size: 22px; }
.stat span { font-size: 11px; color: var(--dim); }
@media (max-width: 560px) { .stats { grid-template-columns: repeat(2, 1fr); } }

.rule-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; }
.rc { background: #fff; border: 1px solid var(--line); border-left: 3px solid var(--brand); border-radius: 8px; padding: 10px; }
.rc b { display: block; font-size: 14px; margin-bottom: 4px; }
.rc span { font-size: 12px; color: var(--dim); }

.form { background: #fff; border-radius: 12px; border: 1px solid var(--line); padding: 12px; }
.row { margin-bottom: 10px; }
.row label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 5px; }
.row input[type=number], .row input[type=text], .row > input:not([type=checkbox]) { width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: 8px 9px; font-size: 14px; }
.help { font-size: 11px; color: var(--dim); margin-top: 3px; }
.chk { display: flex; align-items: center; gap: 6px; font-weight: 400 !important; }
.staff { display: grid; grid-template-columns: 1fr 1.6fr auto; gap: 6px; align-items: center; }
.hint { color: var(--dim); font-size: 12px; margin-top: 14px; }

.toast { position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%) translateY(20px); background: rgba(31,35,41,.88); color: #fff; padding: 9px 18px; border-radius: 20px; font-size: 13px; opacity: 0; pointer-events: none; transition: .25s; z-index: 99; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
