/* 老板工作台 · 黑白灰
   设计口径与小程序版一致：只有黑/白/灰；状态色只用于状态文字。
   卡片靠 1px 描边分层，不靠大阴影；数字用等宽数字（tabular-nums）。 */

:root {
  --bg: #f4f4f4;
  --surface: #ffffff;
  --surface-2: #efefef;
  --line: #ddddd8;
  --line-soft: #e8e8e4;
  --ink: #141413;
  --ink-2: #3c3c39;
  --muted: #6e6e68;
  --faint: #8f8f88;
  --black: #1c1c1a;
  --black-2: #000000;
  --ok: #1e6b45;
  --warn: #9a6512;
  --danger: #a62b22;
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --shadow: 0 1px 2px rgba(17, 17, 17, .04), 0 8px 24px rgba(17, 17, 17, .04);
  --font: -apple-system, BlinkMacSystemFont, "PingFang SC", "HarmonyOS Sans SC",
    "Microsoft YaHei", "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }

button, input { font: inherit; }

button { cursor: pointer; }

:focus-visible {
  outline: 2px solid var(--black);
  outline-offset: 2px;
}

.num { font-variant-numeric: tabular-nums; }

/* ── 壳：左侧栏 + 主区 ─────────────────────────────────────────────── */
.app { min-height: 100vh; }

.rail {
  position: fixed;
  inset: 0 auto 0 0;
  width: 232px;
  background: var(--black);
  color: #fff;
  display: flex;
  flex-direction: column;
  padding: 24px 16px 20px;
  z-index: 40;
}

.rail-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 8px 22px;
  border-bottom: 1px solid rgba(255, 255, 255, .14);
  margin-bottom: 18px;
}

.rail-mark {
  width: 38px;
  height: 38px;
  border: 1px solid rgba(255, 255, 255, .5);
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 15px;
  font-weight: 600;
  flex: none;
}

.rail-name {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 1px;
  line-height: 1.3;
}

.rail-sub {
  margin-top: 2px;
  font-size: 9px;
  letter-spacing: 2px;
  color: rgba(255, 255, 255, .45);
}

.rail-group {
  padding: 14px 8px 6px;
  font-size: 10px;
  letter-spacing: 3px;
  color: rgba(255, 255, 255, .36);
}

.rail-link {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  height: 38px;
  padding: 0 10px;
  border-radius: 6px;
  color: rgba(255, 255, 255, .68);
  font-size: 13px;
  transition: background .12s ease, color .12s ease;
}

.rail-link:hover { background: rgba(255, 255, 255, .07); color: #fff; }

.rail-link.on {
  background: rgba(255, 255, 255, .1);
  color: #fff;
}

.rail-link.on::before {
  content: "";
  position: absolute;
  left: 0;
  top: 11px;
  bottom: 11px;
  width: 2px;
  border-radius: 2px;
  background: #fff;
}

.rail-link .dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  opacity: .55;
  flex: none;
}

.rail-foot {
  margin-top: auto;
  padding: 16px 8px 0;
  border-top: 1px solid rgba(255, 255, 255, .14);
  font-size: 11px;
  color: rgba(255, 255, 255, .5);
}

.rail-foot small {
  display: block;
  margin-top: 2px;
  font-size: 9px;
  letter-spacing: 2px;
  color: rgba(255, 255, 255, .32);
}

.main {
  margin-left: 232px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── 顶栏 ─────────────────────────────────────────────────────────── */
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  height: 62px;
  padding: 0 32px;
  background: rgba(255, 255, 255, .94);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line-soft);
  display: flex;
  align-items: center;
  gap: 16px;
}

.crumb {
  font-size: 12px;
  color: var(--muted);
  letter-spacing: .5px;
}

.crumb b { color: var(--ink); font-weight: 500; }

.top-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
}

.demo-pill {
  display: inline-flex;
  align-items: center;
  height: 24px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  font-size: 11px;
  color: var(--muted);
  letter-spacing: .5px;
}

.avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--black);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 600;
}

/* ── 内容区 ───────────────────────────────────────────────────────── */
.content {
  width: 100%;
  max-width: 1240px;
  margin: 0 auto;
  padding: 32px;
}

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 28px;
}

.kicker {
  font-size: 11px;
  letter-spacing: 2.5px;
  color: var(--muted);
}

.page-title {
  margin: 6px 0 0;
  font-size: 34px;
  line-height: 1.2;
  font-weight: 600;
  letter-spacing: -1px;
}

.page-sub {
  margin: 8px 0 0;
  font-size: 13px;
  color: var(--muted);
}

.head-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: none;
}

/* ── 按钮 ─────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 38px;
  padding: 0 16px;
  border-radius: var(--r-sm);
  border: 1px solid transparent;
  font-size: 13px;
  transition: background .12s ease, border-color .12s ease, transform .12s ease, opacity .12s ease;
}

.btn:active { transform: scale(.98); }

.btn-primary {
  background: var(--black);
  border-color: var(--black);
  color: #fff;
}

.btn-primary:hover { background: #000; }

.btn-ghost {
  background: var(--surface);
  border-color: var(--line);
  color: var(--ink);
}

.btn-ghost:hover { background: var(--surface-2); }

.btn-sm { height: 32px; padding: 0 12px; font-size: 12px; }

.btn[disabled] { opacity: .45; cursor: not-allowed; }

/* ── KPI ──────────────────────────────────────────────────────────── */
.kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 28px;
}

.kpi {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 18px 20px;
}

.kpi-num {
  font-size: 38px;
  line-height: 1.15;
  font-weight: 600;
  letter-spacing: -1.5px;
  font-variant-numeric: tabular-nums;
}

.kpi-lab {
  margin-top: 4px;
  font-size: 12px;
  color: var(--muted);
}

/* ── 区块标题 ─────────────────────────────────────────────────────── */
.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin: 30px 0 12px;
}

.section-title {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -.2px;
}

.section-more {
  font-size: 12px;
  color: var(--muted);
}

.section-more:hover { color: var(--ink); }

/* ── 快捷操作 ─────────────────────────────────────────────────────── */
.quick {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
}

.quick a, .quick button {
  display: block;
  width: 100%;
  text-align: left;
  padding: 14px 14px 13px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  color: var(--ink);
  transition: background .12s ease, border-color .12s ease;
}

.quick a:hover, .quick button:hover { background: var(--surface-2); }

.quick-t { font-size: 13px; font-weight: 500; }
.quick-s { margin-top: 3px; font-size: 11px; color: var(--muted); }

.all-tools {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-top: 10px;
  padding: 12px 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  font-size: 13px;
  transition: background .12s ease;
}

.all-tools:hover { background: var(--surface-2); }
.all-tools span { font-size: 11px; color: var(--muted); }

/* ── 巡店卡 ───────────────────────────────────────────────────────── */
.patrol-card {
  display: flex;
  align-items: center;
  gap: 28px;
  margin-top: 18px;
  padding: 24px 26px;
  background: var(--black);
  color: #fff;
  border-radius: var(--r-lg);
  transition: transform .12s ease, opacity .12s ease;
}

.patrol-card:hover { opacity: .95; }
.patrol-card:active { transform: scale(.995); }

.patrol-main { flex: 1; min-width: 0; }

.patrol-kicker {
  font-size: 10px;
  letter-spacing: 2.5px;
  color: rgba(255, 255, 255, .52);
}

.patrol-title {
  margin-top: 6px;
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -.3px;
}

.patrol-meta {
  margin-top: 4px;
  font-size: 12px;
  color: rgba(255, 255, 255, .6);
}

.patrol-go {
  flex: none;
  font-size: 12px;
  color: #fff;
  border-bottom: 1px solid rgba(255, 255, 255, .6);
  padding-bottom: 2px;
}

/* ── 两栏列表 ─────────────────────────────────────────────────────── */
.cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 22px;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  overflow: hidden;
}

.row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line-soft);
  transition: background .12s ease;
}

.row:last-child { border-bottom: 0; }
.row:hover { background: #fafafa; }

.row-main { flex: 1; min-width: 0; }

.row-t {
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.row-s {
  margin-top: 2px;
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.row-time {
  flex: none;
  font-size: 11px;
  color: var(--faint);
  font-variant-numeric: tabular-nums;
}

.chip {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 8px;
  border-radius: 5px;
  background: var(--surface-2);
  color: var(--ink-2);
  font-size: 10px;
  letter-spacing: .3px;
  flex: none;
}

.chip.published { background: var(--black); color: #fff; }
.chip.failed, .chip.banned { background: #f8ecea; color: var(--danger); }
.chip.submitted, .chip.publishing, .chip.ready { background: var(--surface-2); color: var(--ink); }

.empty {
  padding: 46px 20px;
  text-align: center;
  font-size: 12px;
  color: var(--muted);
}

/* ── 账号矩阵 ─────────────────────────────────────────────────────── */
.accounts {
  display: grid;
  grid-template-columns: 1fr 1fr;
}

.account {
  padding: 14px 18px;
  border-bottom: 1px solid var(--line-soft);
}

.account:nth-last-child(-n+2) { border-bottom: 0; }

.account-name { font-size: 13px; font-weight: 500; }

.account-meta {
  margin-top: 2px;
  font-size: 11px;
  color: var(--muted);
}

/* ── 页脚 / 提示 ──────────────────────────────────────────────────── */
.foot {
  margin: 40px 0 10px;
  text-align: center;
  font-size: 10px;
  letter-spacing: 2px;
  color: var(--faint);
}

.notice {
  display: none;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  padding: 10px 14px;
  border-radius: var(--r-sm);
  background: var(--surface-2);
  font-size: 12px;
  color: var(--muted);
}

.notice.show { display: flex; }

/* ── 巡店页 ───────────────────────────────────────────────────────── */
.tabs {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  background: var(--surface-2);
  border-radius: 10px;
  margin-bottom: 18px;
}

.tab {
  height: 32px;
  padding: 0 14px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
}

.tab.on { background: var(--black); color: #fff; }

.filters {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
}

.filter {
  height: 30px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink-2);
  font-size: 12px;
}

.filter.on { background: var(--black); border-color: var(--black); color: #fff; }

.filter-count {
  margin-left: auto;
  font-size: 11px;
  color: var(--muted);
}

.event-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.event {
  display: flex;
  gap: 14px;
  padding: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  text-align: left;
  color: var(--ink);
  transition: border-color .12s ease, background .12s ease;
}

.event:hover { border-color: #c9c9c4; background: #fdfdfc; }

.event-img {
  width: 132px;
  height: 92px;
  border-radius: var(--r-sm);
  object-fit: cover;
  background: var(--surface-2);
  flex: none;
}

.event-main { flex: 1; min-width: 0; }

.event-top {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.sev {
  height: 20px;
  padding: 0 7px;
  border-radius: 4px;
  font-size: 10px;
  line-height: 20px;
  flex: none;
  letter-spacing: .5px;
}

.sev.critical { background: var(--black); color: #fff; }
.sev.warn { border: 1px solid var(--ink); color: var(--ink); }
.sev.info { background: var(--surface-2); color: var(--muted); }

.event-label {
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.event-meta {
  margin-top: 5px;
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.event-foot {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 8px;
  font-size: 11px;
  color: var(--muted);
}

.status-dot::before {
  content: "";
  display: inline-block;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  margin-right: 5px;
  background: currentColor;
  vertical-align: 1px;
}

.status-pending { color: var(--ink); }
.status-confirmed { color: var(--ink-2); }
.status-false_positive { color: var(--faint); }
.status-resolved, .status-closed { color: var(--ok); }
.status-open { color: var(--ink); }
.status-processing { color: var(--warn); }
.status-submitted { color: var(--ink-2); }

.camera-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.camera {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  overflow: hidden;
  text-align: left;
  padding: 0;
  color: var(--ink);
}

.camera-frame { position: relative; height: 148px; background: var(--surface-2); }

.camera-img { width: 100%; height: 100%; object-fit: cover; display: block; }

.camera-live, .camera-zone {
  position: absolute;
  top: 9px;
  height: 20px;
  line-height: 20px;
  padding: 0 7px;
  border-radius: 4px;
  font-size: 10px;
}

.camera-live { right: 9px; background: rgba(10, 10, 9, .72); color: #fff; }
.camera-live.off { background: rgba(255, 255, 255, .88); color: var(--muted); }
.camera-zone { left: 9px; background: rgba(10, 10, 9, .72); color: #fff; }

.camera-meta { padding: 12px 14px 14px; }
.camera-name { font-size: 13px; font-weight: 500; }
.camera-sub { margin-top: 2px; font-size: 11px; color: var(--muted); }

.rect-list { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

.rect {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
}

.rect-main { flex: 1; min-width: 0; }
.rect-act { flex: none; }
.rect-done { font-size: 12px; color: var(--ok); }

/* ── 弹层 ─────────────────────────────────────────────────────────── */
.modal-back {
  position: fixed;
  inset: 0;
  background: rgba(10, 10, 9, .56);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 100;
}

.modal-back.open { display: flex; }

.modal {
  width: 100%;
  max-width: 720px;
  max-height: 90vh;
  overflow: auto;
  background: var(--surface);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow);
}

.modal-img { width: 100%; height: 340px; object-fit: cover; background: var(--surface-2); display: block; }

.modal-body { padding: 22px; }

.modal-title { margin: 0; font-size: 18px; font-weight: 600; }

.modal-meta { margin-top: 4px; font-size: 12px; color: var(--muted); }

.modal-note {
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: var(--r-sm);
  background: var(--surface-2);
  font-size: 12px;
  line-height: 1.7;
  color: var(--ink-2);
}

.modal-actions {
  display: flex;
  gap: 10px;
  margin-top: 16px;
}

.modal-actions .btn { flex: 1; }

/* ── Toast ────────────────────────────────────────────────────────── */
.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translate(-50%, 12px);
  background: var(--black);
  color: #fff;
  font-size: 12px;
  padding: 10px 16px;
  border-radius: 8px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .18s ease, transform .18s ease;
  z-index: 200;
}

.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ── 响应式 ───────────────────────────────────────────────────────── */
@media (max-width: 1100px) {
  .quick { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .camera-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
  .rail { display: none; }
  .main { margin-left: 0; }
  .topbar { padding: 0 18px; }
  .content { padding: 22px 18px 40px; }
  .page-head { flex-direction: column; align-items: flex-start; }
  .page-title { font-size: 28px; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cols, .event-grid, .rect-list { grid-template-columns: 1fr; }
  .accounts { grid-template-columns: 1fr; }
  .account:nth-last-child(2) { border-bottom: 1px solid var(--line-soft); }
  .patrol-card { flex-direction: column; align-items: flex-start; gap: 16px; }
  .mobile-nav { display: flex; }
}

/* 手机端顶部二级导航（桌面隐藏） */
.mobile-nav {
  display: none;
  gap: 8px;
  overflow-x: auto;
  padding: 10px 18px;
  background: var(--surface);
  border-bottom: 1px solid var(--line-soft);
  position: sticky;
  top: 62px;
  z-index: 25;
}

.mobile-nav a {
  flex: none;
  height: 30px;
  line-height: 30px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  font-size: 12px;
  color: var(--muted);
}

.mobile-nav a.on { background: var(--black); border-color: var(--black); color: #fff; }

/* 由 JS 渲染的行按钮 / 数字后缀 / 面包屑链接 */
button.row {
  width: 100%;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  font: inherit;
  cursor: pointer;
}

button.row:last-child { border-bottom: 0; }

.kpi-num small {
  font-size: 17px;
  font-weight: 400;
  color: var(--muted);
  letter-spacing: 0;
}

.crumb a:hover { color: var(--ink); }

[hidden] { display: none !important; }

/* 手机导航的显示规则必须放在 .mobile-nav 的 display:none 之后（同优先级，后写赢）。 */
@media (max-width: 900px) {
  .mobile-nav { display: flex; }
}

@media (max-width: 900px) {
  /* 手机顶栏：左边品牌，右边动作；面包屑和顶部演示标会挤成一行省略号 */
  .topbar .crumb { display: none; }
  .topbar .demo-pill { display: none; }
  .mobile-brand { display: block; font-size: 14px; font-weight: 600; letter-spacing: .5px; }
  .topbar { justify-content: space-between; }
}

.mobile-brand { display: none; }

/* mobile-brand 的显示规则也必须压在 base 之后（同优先级，后写赢）。 */
@media (max-width: 900px) {
  .mobile-brand { display: block; }
}
