/* =====================================================================
   新疆司法悬赏平台 · 管理后台（深红主题，与小程序前端一致 #8B0000）
   ===================================================================== */
:root {
  --red: #8B0000;
  --red-deep: #6d0000;
  --red-mid: #a83232;
  --red-soft: #f7ecec;
  --bg: #f6f2ef;
  --card: #ffffff;
  --line: #ecdfd8;
  --text: #3a2a26;
  --muted: #9a857c;
  --green: #1a9c4b;
  --gold: #b7791f;
  --danger: #d43030;
  --radius: 12px;
  --shadow: 0 2px 10px rgba(109, 0, 0, .06);
}
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
}
a { color: var(--red); text-decoration: none; }

/* ---------- 布局 ---------- */
.layout { display: flex; min-height: 100vh; }
.sidebar {
  width: 220px; flex: none;
  background: linear-gradient(180deg, var(--red-deep) 0%, var(--red) 55%, #9d2020 100%);
  color: #fff; display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.content { flex: 1; padding: 20px 24px 10px; }

/* ---------- 侧栏 ---------- */
.brand { display: flex; align-items: center; gap: 10px; padding: 22px 18px 16px; border-bottom: 1px solid rgba(255,255,255,.14); }
.logo {
  width: 40px; height: 40px; flex: none; border-radius: 10px;
  background: rgba(255,255,255,.16); border: 1px solid rgba(255,255,255,.35);
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; font-weight: 700;
}
.brand-txt b { display: block; font-size: 15px; letter-spacing: .5px; }
.brand-txt i { display: block; font-style: normal; font-size: 12px; opacity: .75; margin-top: 3px; }
.menu { flex: 1; padding: 12px 10px; display: flex; flex-direction: column; gap: 2px; }
.menu a {
  display: block; padding: 11px 14px; border-radius: 8px;
  color: rgba(255,255,255,.82); font-size: 14px; transition: background .15s;
  border-left: 3px solid transparent;
}
.menu a:hover { background: rgba(255,255,255,.10); color: #fff; }
.menu a.active { background: rgba(255,255,255,.17); color: #fff; font-weight: 600; border-left-color: #fff; }
.side-foot { padding: 14px 18px; font-size: 11px; opacity: .55; border-top: 1px solid rgba(255,255,255,.14); }

/* ---------- 顶栏 ---------- */
.topbar {
  background: #fff; border-bottom: 1px solid var(--line);
  padding: 14px 24px; display: flex; align-items: center; justify-content: space-between;
  box-shadow: var(--shadow); position: sticky; top: 0; z-index: 10;
}
.crumb { font-size: 16px; font-weight: 700; color: var(--red-deep); }
.who { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.who > b { color: var(--text); }
.chip {
  font-size: 12px; padding: 3px 9px; border-radius: 20px;
  background: var(--red-soft); color: var(--red); border: 1px solid #ecd2d2;
}
.chip.region { background: #fdf6ec; color: var(--gold); border-color: #f0dfc0; }
.logout { font-size: 13px; color: var(--muted); margin-left: 6px; }
.logout:hover { color: var(--danger); }

/* ---------- 页面 ---------- */
.page-head { margin-bottom: 16px; }
.page-head h2 { font-size: 20px; color: var(--red-deep); }
.page-head .sub { color: var(--muted); font-size: 12.5px; margin-top: 6px; }
.page-foot { text-align: center; color: var(--muted); font-size: 12px; padding: 14px 0 20px; }

/* ---------- 统计卡 ---------- */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; margin-bottom: 16px; }
.cards.wide { grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); }
.card {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  border: 1px solid var(--line); padding: 16px;
}
a.card.stat { display: block; color: inherit; transition: transform .12s, box-shadow .12s; }
a.card.stat:hover { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(109,0,0,.12); }
.stat .num { font-size: 26px; font-weight: 700; color: var(--red-deep); font-variant-numeric: tabular-nums; }
.stat.warn .num { color: var(--gold); }
.stat.danger .num { color: var(--danger); }
.stat .lbl { margin-top: 4px; color: var(--muted); font-size: 13px; }
.stat p { margin-top: 6px; }

/* ---------- 表格 ---------- */
.table-card { padding: 0; overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; min-width: 760px; }
.tbl th {
  text-align: left; font-size: 12.5px; color: var(--muted); font-weight: 600;
  background: #fbf7f5; padding: 11px 12px; border-bottom: 1px solid var(--line); white-space: nowrap;
}
.tbl td { padding: 11px 12px; border-bottom: 1px solid #f3eae5; vertical-align: top; }
.tbl tbody tr:hover { background: #fdfaf8; }
.tbl .mono { font-family: Consolas, Menlo, monospace; font-size: 12.5px; }
.tbl .keyinfo { max-width: 260px; }
.tbl .detail { max-width: 280px; word-break: break-all; }
.ops-col { min-width: 130px; }
.ops { display: flex; gap: 6px; margin-top: 6px; }
.ops form { display: inline; }
.empty-cell { text-align: center; color: var(--muted); padding: 34px 0 !important; }
.small { font-size: 12px; }
.muted { color: var(--muted); }
.muted.small, .small.muted { font-size: 11.5px; }

/* ---------- 徽章 ---------- */
.bd {
  display: inline-block; padding: 2px 9px; border-radius: 20px;
  font-size: 12px; background: #f1e9e4; color: #7d6a61; border: 1px solid #e8dbd3;
  white-space: nowrap;
}
.bd.g { background: #e9f8ef; color: var(--green); border-color: #c9ecd7; }
.bd.r { background: #fdecec; color: var(--danger); border-color: #f5cfcf; }
.bd.y { background: #fdf6ec; color: var(--gold); border-color: #f0dfc0; }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-block; background: linear-gradient(135deg, var(--red) 0%, #a52525 100%);
  color: #fff; border: none; border-radius: 8px; padding: 9px 18px;
  font-size: 14px; cursor: pointer; transition: opacity .15s;
}
.btn:hover { opacity: .88; }
.btn.ghost { background: #fff; color: var(--red); border: 1px solid var(--red); }
.btn-mini {
  border: none; border-radius: 6px; padding: 4px 10px; font-size: 12px; cursor: pointer;
  background: #f1e9e4; color: #6d5b52;
}
.btn-mini.ok { background: var(--green); color: #fff; }
.btn-mini.danger { background: var(--danger); color: #fff; }
.btn-mini:hover { opacity: .85; }

/* ---------- 筛选 ---------- */
.filter-bar {
  display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 14px;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px 14px; box-shadow: var(--shadow);
}
.filter-bar .filter-inline { display: flex; gap: 10px; align-items: center; }
.filter-bar input, .filter-bar select {
  padding: 8px 12px; border: 1px solid var(--line); border-radius: 8px; font-size: 13px;
  background: #fff; color: var(--text); outline: none; min-width: 150px;
}
.filter-bar input:focus, .filter-bar select:focus { border-color: var(--red-mid); }
.filter-bar .btn { padding: 8px 16px; }
.filter-bar form + form, .filter-bar > form { margin: 0; }
.filter-bar > form:last-child { margin-left: auto; }

/* ---------- 操作折叠面板 ---------- */
.op-details { border: 1px solid var(--line); border-radius: 8px; background: #fdfaf8; padding: 0; }
.op-details summary {
  cursor: pointer; padding: 6px 10px; font-size: 12px; color: var(--red);
  border-radius: 8px; user-select: none; list-style: none; white-space: nowrap; display: inline-block;
}
.op-details summary::before { content: "▸ "; }
.op-details[open] summary::before { content: "▾ "; }
.op-details[open] { padding: 8px 10px; }
.op-details.inner { margin-top: 8px; }
.op-form { display: flex; flex-direction: column; gap: 8px; margin-top: 6px; min-width: 230px; }
.op-form label { font-size: 12px; color: var(--muted); display: flex; flex-direction: column; gap: 4px; }
.op-form input, .op-form select {
  padding: 7px 10px; border: 1px solid var(--line); border-radius: 6px; font-size: 13px;
  outline: none; background: #fff;
}
.op-form input:focus, .op-form select:focus { border-color: var(--red-mid); }
.op-form .btn { padding: 8px 14px; font-size: 13px; }

/* ---------- 表单卡 ---------- */
.form-card { margin-bottom: 16px; }
.form-card h3 { font-size: 15px; color: var(--red-deep); margin-bottom: 12px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; align-items: end; }
.form-grid label { font-size: 12.5px; color: var(--muted); display: flex; flex-direction: column; gap: 5px; }
.form-grid input, .form-grid select {
  padding: 9px 12px; border: 1px solid var(--line); border-radius: 8px; font-size: 13.5px;
  outline: none; background: #fff; color: var(--text);
}
.form-grid input:focus, .form-grid select:focus { border-color: var(--red-mid); }
.form-actions { grid-column: 1 / -1; }
/* 设置页扩展 */
.form-grid .full-row { grid-column: 1 / -1; }
.form-grid textarea {
  padding: 9px 12px; border: 1px solid var(--line); border-radius: 8px; font-size: 13.5px;
  outline: none; background: #fff; color: var(--text); font-family: inherit; resize: vertical;
}
.form-grid textarea:focus { border-color: var(--red-mid); }
.form-grid .check-row { flex-direction: row; align-items: center; gap: 8px; color: var(--text); font-size: 13px; padding: 6px 0; }
.form-grid .check-row input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--red); }
.ok-tip { border-left: 4px solid var(--green, #2e7d32); background: #f2f9f2; }
.menu-group {
  font-size: 11px; color: rgba(255,255,255,.55); letter-spacing: 2px;
  margin: 14px 14px 4px; padding-top: 10px; border-top: 1px solid rgba(255,255,255,.12);
}

/* ---------- V3：案件标注 / 批量操作 ---------- */
.mark-group { display: flex; gap: 4px; }
.mark-form { display: inline; }
.mark-btn {
  width: 26px; height: 24px; border-radius: 6px; border: 1px solid var(--line);
  background: #fff; color: var(--muted); font-size: 12px; cursor: pointer; transition: all .12s;
}
.mark-btn:hover { border-color: var(--red-mid); color: var(--red); }
.mark-btn.on { background: var(--red); border-color: var(--red); color: #fff; font-weight: 700; }
.bulk-bar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px;
  background: var(--card); border: 1px dashed #e0c8c8; border-radius: var(--radius);
  padding: 10px 14px; box-shadow: var(--shadow);
}
.bulk-bar form { display: flex; align-items: center; gap: 8px; }
.bulk-bar select { padding: 7px 10px; border: 1px solid var(--line); border-radius: 8px; font-size: 13px; background: #fff; color: var(--text); outline: none; }

/* ---------- V3：统计报表 ---------- */
.stats-tbl .city-row td { background: #fbf5f2; font-weight: 600; }
.stats-tbl .county-row td { background: #fdfbf9; }
.stats-tbl .county-row td:first-child { padding-left: 28px; }
.stats-tbl .other-row td { color: var(--muted); }
.total-row td {
  background: var(--red-soft); font-weight: 700; color: var(--red-deep);
  border-top: 2px solid #ecd2d2;
}
.export-btns { display: flex; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }

/* ---------- V3：权限勾选 / 区县行（管理员/区划页） ---------- */
.perm-checks { display: flex; flex-wrap: wrap; gap: 8px 14px; padding: 6px 0; }
.check-inline {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 12.5px; color: var(--text); cursor: pointer;
}
.check-inline input[type="checkbox"] { width: 15px; height: 15px; accent-color: var(--red); }
.county-row td { background: #fdfbf9; }
.county-row td:first-child { padding-left: 28px; }

/* ---------- 提示卡 ---------- */
.tip-card { margin-bottom: 16px; }
.tip-card h3 { font-size: 14px; color: var(--red-deep); margin-bottom: 8px; }
.tip-card .flow { color: var(--text); font-size: 13px; line-height: 1.9; margin-bottom: 6px; }

/* ---------- 登录页 ---------- */
.login-body {
  background: linear-gradient(135deg, var(--red-deep) 0%, var(--red) 50%, #a83232 100%);
  min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px;
}
.login-wrap { width: 100%; max-width: 400px; }
.login-card {
  background: #fff; border-radius: 16px; padding: 34px 30px;
  box-shadow: 0 14px 40px rgba(0,0,0,.28); text-align: center;
}
.login-logo {
  width: 56px; height: 56px; margin: 0 auto 14px; border-radius: 14px;
  background: linear-gradient(135deg, var(--red) 0%, #a52525 100%);
  color: #fff; font-size: 28px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.login-card h1 { font-size: 20px; color: var(--red-deep); }
.login-sub { font-size: 12.5px; color: var(--muted); margin: 8px 0 18px; }
.login-err {
  background: #fdecec; color: var(--danger); border: 1px solid #f5cfcf;
  border-radius: 8px; padding: 9px 12px; font-size: 13px; margin-bottom: 14px;
}
.login-form { text-align: left; display: flex; flex-direction: column; gap: 12px; }
.login-form label { font-size: 13px; color: var(--muted); display: flex; flex-direction: column; gap: 6px; }
.login-form input {
  padding: 11px 13px; border: 1px solid var(--line); border-radius: 8px;
  font-size: 14px; outline: none; transition: border .15s;
}
.login-form input:focus { border-color: var(--red-mid); box-shadow: 0 0 0 3px rgba(139,0,0,.08); }
.login-btn { margin-top: 6px; padding: 12px; font-size: 15px; letter-spacing: 6px; }
.login-tip { margin-top: 18px; font-size: 12px; color: var(--muted); line-height: 1.8; }

/* ---------- 响应式 ---------- */
@media (max-width: 860px) {
  .layout { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: static; }
  .menu { flex-direction: row; overflow-x: auto; padding: 8px; }
  .menu a { white-space: nowrap; border-left: none; border-bottom: 3px solid transparent; }
  .menu a.active { border-bottom-color: #fff; }
  .side-foot { display: none; }
  .content { padding: 14px; }
  .who { display: none; }
}
