/* ===== 帮派数据平台 · 共享样式 ===== */
:root {
  --bg: #f5f7fb;
  --card: #ffffff;
  --border: #e5e9f2;
  --text: #1f2533;
  --muted: #7a839e;
  --accent: #3b6cf6;
  --accent-2: #6d8dff;
  --accent-soft: #eaf0fe;
  --up: #e54d42;
  --down: #2ba471;
  --new: #f59e0b;
  --ink: #1a3c3a;          /* 帮派主色 · 墨青 */
  --gold: #c9a15c;         /* 帮派辅色 · 鎏金 */
  --vermilion: #b93b30;    /* 帮派点缀 · 朱红 */
  --radius: 12px;
  --shadow: 0 1px 2px rgba(20, 32, 64, .04), 0 6px 18px rgba(20, 32, 64, .05);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
  background: var(--bg); color: var(--text); min-height: 100vh;
  font-size: 14px;
}
a { color: var(--accent); text-decoration: none; }

/* ---------- 顶部导航 ---------- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255, 255, 255, .88);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.topbar-inner {
  max-width: 1240px; margin: 0 auto; padding: 0 20px;
  height: 58px; display: flex; align-items: center; gap: 28px;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 15px; color: var(--text); }
.brand .logo {
  width: 30px; height: 30px; border-radius: 8px; display: block; object-fit: cover;
  box-shadow: 0 2px 6px rgba(26, 60, 58, .18);
}
.brand:hover .logo { box-shadow: 0 3px 10px rgba(26, 60, 58, .26); }

/* ---------- 帮派标志（完整组合版） ---------- */
.brand-lockup {
  display: block; width: 100%; max-width: 320px; height: auto;
  border-radius: 10px; margin-bottom: 18px; box-shadow: var(--shadow);
}
@media (max-width: 640px) { .brand-lockup { max-width: 240px; } }
.mainnav { display: flex; gap: 4px; flex: 1; }
.mainnav a {
  padding: 7px 14px; border-radius: 8px; color: var(--muted); font-size: 13.5px;
  transition: background .15s, color .15s;
}
.mainnav a:hover { background: var(--accent-soft); color: var(--accent); }
.mainnav a.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }

/* ---------- 布局 ---------- */
.container { max-width: 1240px; margin: 0 auto; padding: 22px 20px 64px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
.page-head h1 { font-size: 21px; letter-spacing: .2px; }
.page-head .desc { font-size: 12.5px; color: var(--muted); margin-top: 5px; }
.panel {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px; margin-bottom: 16px; box-shadow: var(--shadow);
}
.panel h2 { font-size: 14.5px; margin-bottom: 14px; display: flex; align-items: center; gap: 8px; }
.panel h2 .hint { font-size: 12px; color: var(--muted); font-weight: normal; }

/* ---------- 上传区 ---------- */
.upload-card {
  display: grid; grid-template-columns: 1fr auto; gap: 18px; align-items: center;
  background: linear-gradient(135deg, #f7f9ff, #ffffff);
  border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px; margin-bottom: 16px;
  box-shadow: var(--shadow);
}
.dropzone {
  border: 1.5px dashed #c9d4ee; border-radius: 10px; padding: 20px 16px; text-align: center;
  color: var(--muted); font-size: 13px; cursor: pointer; background: rgba(255, 255, 255, .6);
  transition: .18s;
}
.dropzone:hover, .dropzone.drag { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.dropzone b { color: var(--accent); }
.dropzone .sub { font-size: 12px; margin-top: 6px; }
.upload-side { font-size: 12px; color: var(--muted); line-height: 1.9; min-width: 190px; }
.upload-side .k { color: var(--text); font-weight: 600; }
.upload-log { margin-top: 10px; font-size: 12.5px; line-height: 1.9; }
.upload-log .ok { color: var(--down); }
.upload-log .err { color: var(--up); }

/* ---------- 控件 ---------- */
select, input[type="search"], .btn {
  height: 34px; padding: 0 12px; border: 1px solid var(--border); border-radius: 8px;
  background: var(--card); font-size: 13px; color: var(--text); outline: none; font-family: inherit;
}
select:focus, input:focus { border-color: var(--accent); }
.btn { cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: var(--accent); color: var(--accent); }
.btn.primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn.primary:hover { background: #2f5be0; color: #fff; }
.btn.danger { color: var(--up); }
.controls { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ---------- 统计卡片 ---------- */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(158px, 1fr)); gap: 12px; margin-bottom: 16px; }
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 13px 15px; box-shadow: var(--shadow); }
.card .label { font-size: 12px; color: var(--muted); margin-bottom: 7px; }
.card .value { font-size: 21px; font-weight: 700; line-height: 1.25; }
.card .value.small { font-size: 13px; font-weight: 600; line-height: 1.75; }
.card .value small { font-size: 11.5px; font-weight: normal; color: var(--muted); margin-left: 4px; }

.up { color: var(--up); }
.down { color: var(--down); }
.newc { color: var(--new); }
.muted { color: var(--muted); }

/* ---------- 排行榜 ---------- */
.bars { display: flex; flex-direction: column; gap: 7px; }
.bar-row { display: grid; grid-template-columns: 130px minmax(0, 1fr) 190px; align-items: center; gap: 10px; font-size: 13px; }
.bar-row .name { text-align: right; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--muted); }
.bar-track { height: 16px; background: var(--accent-soft); border-radius: 8px; overflow: hidden; }
.bar-fill { height: 100%; background: linear-gradient(90deg, var(--accent-2), var(--accent)); border-radius: 8px; min-width: 2px; transition: width .45s; }
.bar-row .delta { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.bar-row .delta .range { font-size: 11.5px; font-weight: 400; color: var(--muted); }

/* ---------- 表格 ---------- */
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.tab {
  height: 30px; padding: 0 13px; border-radius: 15px; border: 1px solid var(--border);
  background: var(--card); font-size: 12.5px; cursor: pointer; color: var(--muted); font-family: inherit;
}
.tab:hover { color: var(--accent); border-color: var(--accent); }
.tab.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.table-wrap { overflow: auto; max-height: 580px; border-radius: 8px; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead th {
  position: sticky; top: 0; z-index: 2; background: #fbfcff; text-align: left; padding: 10px 9px;
  border-bottom: 2px solid var(--border); color: var(--muted); font-weight: 600; white-space: nowrap;
  cursor: pointer; user-select: none;
}
thead th:hover { color: var(--accent); }
thead th.sorted-asc::after { content: " ↑"; }
thead th.sorted-desc::after { content: " ↓"; }
tbody td { padding: 9px 9px; border-bottom: 1px solid var(--border); white-space: nowrap; }
tbody tr:hover { background: #fafbff; }
.num { font-variant-numeric: tabular-nums; }
.empty { padding: 42px 16px; text-align: center; color: var(--muted); font-size: 13px; }

/* ---------- 职务徽章 ---------- */
.role-badge {
  display: inline-flex; align-items: center; gap: 3px; padding: 2px 9px; border-radius: 20px;
  font-size: 11.5px; font-weight: 600; border: 1px solid transparent; white-space: nowrap;
}
.role-badge::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; opacity: .85; }
.r-leader { color: #8a5b00; background: linear-gradient(135deg, #fff4d1, #ffe8a8); border-color: #f3d27a; }
.r-vice { color: #6d3fb5; background: #f3ecff; border-color: #ddcbf7; }
.r-guardian { color: #1f5bb5; background: #e9f1ff; border-color: #c9dbff; }
.r-qinglong { color: #0f7b63; background: #e5f8f2; border-color: #b8e8da; }
.r-baihu { color: #5a6270; background: #f0f2f6; border-color: #d9dee8; }
.r-zhuque { color: #c23a3a; background: #fdecec; border-color: #f8cfcf; }
.r-xuanwu { color: #2c3e50; background: #e8edf4; border-color: #c9d4e2; }
.r-merchant { color: #b5651d; background: #fdf1e3; border-color: #f6d9b8; }
.role-plain { color: var(--muted); font-size: 12.5px; }

/* ---------- 状态标签 ---------- */
.tag { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 11px; font-weight: 600; }
.tag.new { background: #fef3e2; color: var(--new); }
.tag.left { background: #fdecec; color: var(--up); }
.tag.same { background: #eef0f4; color: var(--muted); }

/* ---------- 模块导航 ---------- */
.hero {
  background: linear-gradient(120deg, #eef3ff 0%, #f9fbff 45%, #eef7ff 100%);
  border: 1px solid var(--border); border-radius: 16px; padding: 30px 28px; margin-bottom: 18px;
}
.hero h1 { font-size: 24px; margin-bottom: 8px; }
.hero p { color: var(--muted); font-size: 13.5px; line-height: 1.9; max-width: 720px; }
.hero .badges { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
.hero .badges span {
  background: rgba(255, 255, 255, .8); border: 1px solid var(--border); border-radius: 20px;
  padding: 4px 12px; font-size: 12px; color: var(--muted);
}
.section-title { display: flex; align-items: center; gap: 10px; margin: 24px 0 12px; font-size: 15px; font-weight: 700; }
.section-title .line { flex: 1; height: 1px; background: var(--border); }
.section-title .count { font-size: 12px; color: var(--muted); font-weight: normal; }
.module-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.module {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px;
  transition: .18s; position: relative; display: flex; flex-direction: column; gap: 8px;
}
.module.live { cursor: pointer; }
.module.live:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: 0 8px 22px rgba(59, 108, 246, .12); }
.module .ico {
  width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; font-size: 16px;
  background: var(--accent-soft); color: var(--accent);
}
.module h3 { font-size: 14px; }
.module p { font-size: 12.5px; color: var(--muted); line-height: 1.75; }
.module .status {
  position: absolute; top: 14px; right: 14px; font-size: 11px; padding: 2px 8px; border-radius: 10px;
}
.status.live { background: #e8f7f0; color: #1c8a5f; }
.status.plan { background: #f0f2f6; color: var(--muted); }
.module.plan .ico { background: #f4f6fa; color: #b0b9cc; }
.module.plan h3 { color: #6b7488; }
.roadmap { font-size: 12.5px; color: var(--muted); line-height: 2; }
.roadmap b { color: var(--text); }

/* ---------- 提示条 ---------- */
.toast {
  position: fixed; left: 50%; bottom: 30px; transform: translate(-50%, 16px);
  background: #1f2533; color: #fff; font-size: 13px; padding: 10px 20px; border-radius: 10px;
  opacity: 0; pointer-events: none; transition: .25s; z-index: 99;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.foot { margin-top: 18px; font-size: 12px; color: var(--muted); line-height: 1.9; }

/* ---------- 表单（工具 / 设置页） ---------- */
.field-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 12.5px; color: var(--muted); }
.field input[type="text"], .field input[type="number"], .field input[type="password"], .field textarea, .field select {
  height: 36px; padding: 0 11px; border: 1px solid var(--border); border-radius: 8px;
  font-size: 13.5px; font-family: inherit; color: var(--text); background: #fff; outline: none;
}
.field input:disabled { background: #f6f7fb; color: var(--muted); }
.field textarea { height: auto; padding: 9px 11px; resize: vertical; min-height: 74px; line-height: 1.7; }
.field input:focus, .field textarea:focus { border-color: var(--accent); }
.field .tip { font-size: 11.5px; color: #a1a9bd; line-height: 1.6; }
.field.inline { flex-direction: row; align-items: center; gap: 10px; }
.field.inline input { flex: 1; }

/* ---------- 工具页布局 ---------- */
.tool-layout { display: grid; grid-template-columns: minmax(320px, 420px) 1fr; gap: 16px; align-items: start; }
.tool-layout .panel { margin-bottom: 0; }
/* 输入项较多的工具页：左侧表单区更宽、右侧结果区收紧 */
.tool-layout.wide-input { grid-template-columns: minmax(0, 1.7fr) minmax(300px, .95fr); }
.field-grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.tool-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 16px; }
.tool-actions .btn { height: 36px; padding: 0 18px; border-radius: 8px; font-size: 13.5px; }
.result-hero {
  border-radius: 11px; padding: 14px 16px; margin-bottom: 12px; color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 6px 16px rgba(20, 32, 64, .12);
}
.result-hero .k { font-size: 12.5px; opacity: .82; }
.result-hero .v { display: block; font-size: 30px; font-weight: 800; letter-spacing: .4px; font-variant-numeric: tabular-nums; line-height: 1.25; }
.result-hero .v small { font-size: 12.5px; font-weight: 400; opacity: .8; margin-left: 6px; }
.result-hero .sub { font-size: 11.5px; opacity: .78; margin-top: 2px; }
/* 工具页：目标结果摘要 + 进阶参数折叠 */
.gem-summary {
  font-size: 12.5px; color: var(--muted); line-height: 1.85; margin-top: 16px;
  padding: 9px 12px; background: var(--accent-soft); border-radius: 8px;
}
.gem-summary b { color: var(--text); font-variant-numeric: tabular-nums; }
tr.target-row td { background: var(--accent-soft); font-weight: 700; }
tr.target-row:hover td { background: var(--accent-soft); }
.adv { margin-top: 14px; border-top: 1px dashed var(--border); padding-top: 12px; }
.adv summary {
  font-size: 12.5px; color: var(--muted); cursor: pointer; user-select: none;
  list-style: none; display: flex; align-items: center; gap: 6px;
}
.adv summary::-webkit-details-marker { display: none; }
.adv summary::before { content: "▸"; font-size: 11px; transition: transform .2s; }
.adv[open] summary::before { transform: rotate(90deg); }
.adv summary:hover { color: var(--accent); }
.adv .field-grid { margin-top: 12px; }
.tool-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.crumb { font-size: 12.5px; color: var(--muted); margin-bottom: 10px; }
.crumb a { color: var(--muted); }
.crumb a:hover { color: var(--accent); }
.result-list { display: flex; flex-direction: column; gap: 10px; }
.result-row {
  display: flex; justify-content: space-between; align-items: baseline; gap: 12px;
  padding: 11px 14px; background: #fafbff; border: 1px solid var(--border); border-radius: 9px;
}
.result-row .k { font-size: 12.5px; color: var(--muted); }
.result-row .v { font-size: 17px; font-weight: 700; font-variant-numeric: tabular-nums; }
.result-row .v.big { font-size: 22px; color: var(--accent); }
.formula { margin-top: 12px; font-size: 12px; color: var(--muted); line-height: 1.9; background: #fbfcff; border: 1px dashed var(--border); border-radius: 8px; padding: 10px 12px; }
.formula code { color: var(--text); font-family: Consolas, monospace; font-size: 12px; }
.gem-table { width: 100%; margin-top: 12px; }
.gem-table td, .gem-table th { padding: 7px 8px; font-size: 12.5px; }
.preset-chips { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 4px; }
.chip {
  border: 1px solid var(--border); background: #fff; border-radius: 14px; height: 26px; padding: 0 11px;
  font-size: 12px; color: var(--muted); cursor: pointer; font-family: inherit;
}
.chip:hover { border-color: var(--accent); color: var(--accent); }

/* ---------- 设置页 ---------- */
.setting-section { border-top: 1px solid var(--border); padding-top: 16px; margin-top: 16px; }
.setting-section:first-of-type { border-top: none; padding-top: 0; margin-top: 0; }
.setting-section h3 { font-size: 13.5px; margin-bottom: 12px; }
.logo-row { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.logo-preview {
  width: 64px; height: 64px; border-radius: 14px; border: 1px solid var(--border); background: #f7f9ff;
  display: grid; place-items: center; overflow: hidden; color: var(--muted); font-size: 12px;
}
.logo-preview img { width: 100%; height: 100%; object-fit: cover; display: block; }
.color-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.color-row input[type="color"] { width: 40px; height: 36px; padding: 2px; border: 1px solid var(--border); border-radius: 8px; background: #fff; cursor: pointer; }
.dot-color { width: 22px; height: 22px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px var(--border); cursor: pointer; }
.save-bar { display: flex; gap: 10px; align-items: center; margin-top: 18px; }

/* ---------- 登录页 / 后台提示条 ---------- */
.login-wrap { min-height: calc(100vh - 130px); display: grid; place-items: center; padding: 36px 16px 48px; }
.login-card {
  width: 100%; max-width: 384px; background: var(--card); border: 1px solid var(--border);
  border-radius: 14px; box-shadow: var(--shadow); padding: 28px 28px 22px;
}
.login-card .badge {
  width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent); font-size: 18px; font-weight: 700; margin-bottom: 14px;
}
.login-card h1 { font-size: 19px; letter-spacing: .2px; margin-bottom: 6px; }
.login-card .desc { font-size: 12.5px; color: var(--muted); line-height: 1.75; margin-bottom: 20px; }
.login-card .field { margin-bottom: 13px; }
.login-card .btn.primary { width: 100%; height: 40px; font-size: 14px; margin-top: 6px; border-radius: 9px; }
.login-err { min-height: 19px; font-size: 12.5px; color: var(--up); line-height: 1.6; margin-top: 10px; }
.login-foot { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--border); font-size: 12px; color: var(--muted); line-height: 1.9; }
.login-foot a { color: var(--muted); }
.login-foot a:hover { color: var(--accent); }
.warn-bar {
  display: none; align-items: center; gap: 8px; margin-bottom: 14px; padding: 10px 14px;
  border-radius: 9px; background: #fff8e6; border: 1px solid #f3e2b8; color: #8a6100;
  font-size: 12.5px; line-height: 1.7;
}
.warn-bar.show { display: flex; }
.warn-bar a { color: #8a6100; font-weight: 700; text-decoration: underline; }

@media (max-width: 1100px) {
  .field-grid.cols-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .tool-layout, .tool-layout.wide-input { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .field-grid.cols-3 { grid-template-columns: 1fr; }
  .topbar-inner { gap: 12px; }
  .mainnav a { padding: 7px 9px; font-size: 13px; }
  .upload-card { grid-template-columns: 1fr; }
  .bar-row { grid-template-columns: 96px minmax(0, 1fr) 150px; font-size: 12.5px; }
  .bar-row .delta .range { font-size: 11px; }
}
