/* ============================================================
   Chengfa Admin · 管理端概念站
   暗色、干净、留白：侧栏 + 顶栏 + 卡片式仪表盘。
   无框架无依赖，独立成套。
   ============================================================ */

/* 数字字体：Bebas Neue（开源 OFL，自托管） */
@font-face {
  font-family: "Bebas Neue";
  src: url("/fonts/bebas-neue-latin.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  /* 暗色基调：底色最深，卡片略亮，发丝线分层 */
  --bg: #0E1013;
  --panel: #16191F;
  --panel-2: #1D2129;
  --line: #262B34;
  --text: #E8EAED;
  --muted: #8B93A1;
  --faint: #5C6470;

  /* 唯一强调色：蓝。绿/红只用于涨跌语义 */
  --accent: #4D7CFE;
  --accent-soft: rgba(77, 124, 254, .14);
  --up: #3FB68B;
  --down: #E5534B;

  --sans: "Microsoft YaHei", "PingFang SC", "Hiragino Sans GB", "Source Han Sans SC", sans-serif;
  --num: "Bebas Neue", Impact, "Arial Black", var(--sans);
  --mono: "Cascadia Mono", Consolas, "Courier New", monospace;

  --side-w: 232px;
  --radius: 10px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.65;
  color: var(--text);
  background: var(--bg);
  overflow-x: hidden;
}

.shell { display: flex; min-height: 100vh; }

/* ---------- 侧栏 ---------- */

.side {
  flex: 0 0 var(--side-w);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  border-right: 1px solid var(--line);
  background: var(--panel);
}

.side__brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 20px 18px 18px;
  border-bottom: 1px solid var(--line);
}

.side__logo {
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-family: var(--num);
  font-size: 20px;
}

.side__bt { min-width: 0; line-height: 1.35; }
.side__bt b { display: block; font-size: 14.5px; }
.side__bt span { display: block; font-size: 11px; color: var(--muted); }

/* 收起按钮只在移动端出现 */
.side__close {
  display: none;
  margin-left: auto;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  padding: 4px 6px;
}

.side__nav {
  flex: 1;
  overflow-y: auto;
  padding: 12px 10px;
}

.nav__i {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 12px;
  margin-bottom: 2px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-family: inherit;
  font-size: 13.5px;
  text-align: left;
  cursor: pointer;
}

.nav__i:hover { background: var(--panel-2); color: var(--text); }

.nav__i.is-on {
  background: var(--accent-soft);
  color: var(--text);
}

.nav__n {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: .06em;
  color: var(--faint);
}

.nav__i.is-on .nav__n { color: var(--accent); }

/* 待办角标（提现/工单等待处理数） */
.nav__b {
  margin-left: auto;
  min-width: 20px;
  padding: 0 6px;
  border-radius: 10px;
  background: var(--accent);
  color: #fff;
  font-size: 11px;
  text-align: center;
  line-height: 18px;
}

.side__foot {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 14px 18px;
  border-top: 1px solid var(--line);
}

.side__avatar {
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--panel-2);
  border: 1px solid var(--line);
  font-size: 13px;
}

/* ---------- 主区 ---------- */

.main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.top {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px clamp(16px, 3vw, 32px);
  border-bottom: 1px solid var(--line);
}

.top__menu {
  display: none;
  flex-direction: column;
  gap: 4px;
  border: 0;
  background: transparent;
  padding: 6px 4px;
  cursor: pointer;
}

.top__menu span {
  width: 18px;
  height: 2px;
  background: var(--text);
  border-radius: 1px;
}

.top__title {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -.01em;
}

.top__demo {
  padding: 2px 10px;
  border: 1px solid var(--accent);
  border-radius: 20px;
  color: var(--accent);
  font-size: 11px;
  white-space: nowrap;
}

.top__date {
  margin-left: auto;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}

.view {
  flex: 1;
  padding: clamp(16px, 3vw, 32px);
  display: flex;
  flex-direction: column;
  gap: clamp(16px, 2vw, 24px);
}

/* ---------- 核心指标 ---------- */

.kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: clamp(12px, 1.6vw, 20px);
}

.kpi {
  padding: 18px 20px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  min-width: 0;
}

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

.kpi__n {
  margin-top: 8px;
  font-family: var(--num);
  font-size: clamp(34px, 3.4vw, 44px);
  line-height: 1;
  letter-spacing: .01em;
}

.kpi__n i {
  font-family: var(--mono);
  font-style: normal;
  font-size: 11px;
  color: var(--faint);
  margin-left: 6px;
}

.kpi__s {
  margin-top: 8px;
  font-size: 11.5px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.kpi__s b { color: var(--text); font-weight: 600; }
.kpi__s .up { color: var(--up); }
.kpi__s .hot { color: var(--accent); }

/* ---------- 卡片 ---------- */

.grid2 {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr);
  gap: clamp(12px, 1.6vw, 20px);
}

.card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  padding: clamp(16px, 2vw, 24px);
  min-width: 0;
}

.card__h {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 6px 12px;
  margin-bottom: 18px;
}

.card__h h2 {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
}

.card__sub {
  font-size: 11.5px;
  color: var(--faint);
}

/* ---------- 柱状图 ---------- */

.chart {
  display: flex;
  align-items: flex-end;
  gap: clamp(3px, .8vw, 10px);
  height: 170px;
}

.chart__col {
  flex: 1 1 0;
  min-width: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

.chart__v {
  margin-bottom: 5px;
  text-align: center;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--muted);
  white-space: nowrap;
}

.chart__bar {
  border-radius: 4px 4px 0 0;
  background: var(--accent-soft);
  border-top: 2px solid var(--accent);
  min-height: 3px;
}

/* 今天：实心亮蓝 */
.chart__col.is-today .chart__bar { background: var(--accent); }
.chart__col.is-today .chart__v { color: var(--accent); }

.chart__axis {
  display: flex;
  gap: clamp(3px, .8vw, 10px);
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}

.chart__axis span {
  flex: 1 1 0;
  min-width: 0;
  text-align: center;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--faint);
  white-space: nowrap;
}

/* ---------- 待办 ---------- */

.todo { display: flex; flex-direction: column; gap: 10px; }

.todo__i {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 13px 15px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-2);
  min-width: 0;
  /* 待办是可点击跳转的按钮 */
  font-family: inherit;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.todo__i:hover { border-color: var(--accent); }

.todo__n {
  flex: 0 0 auto;
  min-width: 34px;
  font-family: var(--num);
  font-size: 28px;
  line-height: 1;
  color: var(--accent);
  text-align: center;
}

.todo__t { margin: 0; font-size: 13.5px; font-weight: 600; }
.todo__d { margin: 2px 0 0; font-size: 11.5px; color: var(--muted); }

/* ---------- 流水表 ---------- */

.table { min-width: 0; }

.tr {
  display: grid;
  /* 列宽由各模块通过 --cols 变量传入 */
  grid-template-columns: var(--cols, 128px 84px 116px 96px minmax(0, 1fr));
  align-items: center;
  gap: 8px 14px;
  padding: 11px 2px;
  border-bottom: 1px solid var(--line);
  min-width: 0;
}

.tr:last-child { border-bottom: 0; }

.tr--head {
  padding-top: 0;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: .08em;
  color: var(--faint);
}

.td {
  min-width: 0;
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.td--mono { font-family: var(--mono); font-size: 12px; color: var(--muted); }

.td--amt {
  font-family: var(--num);
  font-size: 18px;
  letter-spacing: .02em;
}

.td--amt.up { color: var(--up); }
.td--amt.down { color: var(--text); }

.tag {
  display: inline-block;
  padding: 2px 9px;
  border: 1px solid var(--line);
  border-radius: 20px;
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
}

/* ---------- 模块占位视图 ---------- */

.stub {
  max-width: 620px;
  margin: clamp(20px, 6vh, 72px) auto 0;
  text-align: center;
}

.stub__n {
  font-family: var(--num);
  font-size: 64px;
  line-height: 1;
  color: var(--accent);
  opacity: .85;
}

.stub__t {
  margin: 12px 0 0;
  font-size: 24px;
  font-weight: 700;
}

.stub__d {
  margin: 10px auto 0;
  max-width: 46ch;
  font-size: 13.5px;
  color: var(--muted);
}

.stub__list {
  margin: 26px auto 0;
  padding: 0;
  max-width: 420px;
  list-style: none;
  text-align: left;
}

.stub__list li {
  position: relative;
  padding: 11px 14px 11px 30px;
  margin-bottom: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  font-size: 13px;
}

.stub__list li::before {
  content: "";
  position: absolute;
  left: 14px;
  top: 50%;
  width: 6px;
  height: 6px;
  margin-top: -3px;
  border-radius: 50%;
  background: var(--accent);
}

.stub__note {
  margin: 22px 0 0;
  font-size: 11.5px;
  color: var(--faint);
}

/* ---------- 页脚 ---------- */

.foot {
  padding: 16px clamp(16px, 3vw, 32px);
  border-top: 1px solid var(--line);
  font-size: 11.5px;
  color: var(--faint);
}

/* ---------- 响应式 ---------- */

@media (max-width: 1080px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid2 { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 860px) {
  /* 侧栏变抽屉 */
  .side {
    position: fixed;
    left: 0;
    top: 0;
    z-index: 30;
    width: min(280px, 84vw);
    transform: translateX(-100%);
    transition: transform .2s ease;
  }

  .side.is-open { transform: translateX(0); }
  .side__close { display: block; }
  .top__menu { display: flex; }

  .scrim {
    position: fixed;
    inset: 0;
    z-index: 20;
    background: rgba(0, 0, 0, .5);
  }

  /* 流水表改两列 */
  .tr { grid-template-columns: minmax(0, 1fr) auto; row-gap: 3px; }
  .tr--head { display: none; }
  .td--hide-s { display: none; }
}

@media (max-width: 560px) {
  .kpis { grid-template-columns: minmax(0, 1fr); }
  .chart { height: 130px; }
  .chart__v { display: none; }
  .chart__axis span:nth-child(even) { visibility: hidden; }
  .top__date { display: none; }
}

/* hidden 属性兜底：带 display 的类必须显式尊重 hidden，
   否则 hidden 会被上面的 display:flex 盖掉（主站踩过的同款坑） */
.scrim[hidden] { display: none; }
.view[hidden] { display: none; }

/* ============================================================
   全功能版追加：按钮 / 筛选 / 搜索 / 工单 / 设置 / 提示
   ============================================================ */

/* ---------- 按钮 ---------- */

.btn {
  padding: 6px 13px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel-2);
  color: var(--text);
  font-family: inherit;
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
}

.btn:hover { border-color: var(--accent); }
.btn:disabled { opacity: .45; cursor: default; }

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

.btn--primary:hover { filter: brightness(1.1); }

.btn--danger { color: var(--down); }
.btn--danger:hover { border-color: var(--down); }

.btn--ghost { background: transparent; color: var(--muted); }

/* ---------- 筛选条 / 搜索 ---------- */

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.fbtn {
  padding: 5px 14px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: transparent;
  color: var(--muted);
  font-family: inherit;
  font-size: 12px;
  cursor: pointer;
}

.fbtn:hover { color: var(--text); }

.fbtn.is-on {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--text);
}

.search {
  width: 100%;
  max-width: 380px;
  margin-bottom: 16px;
  padding: 9px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-2);
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  outline: none;
}

.search:focus { border-color: var(--accent); }
.search::placeholder { color: var(--faint); }

/* ---------- 表格补充 ---------- */

.td--acts {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
  overflow: visible;
}

.td--note { color: var(--muted); font-size: 12px; }

.td--alert { color: var(--down); font-weight: 700; }

.td__sub {
  display: block;
  font-size: 11px;
  color: var(--faint);
  overflow: hidden;
  text-overflow: ellipsis;
}

.tag--ok { border-color: var(--up); color: var(--up); }
.tag--warn { border-color: var(--accent); color: var(--accent); }
.tag--bad { border-color: var(--down); color: var(--down); }

.empty {
  margin: 18px 0 4px;
  padding: 26px 16px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  text-align: center;
  font-size: 12.5px;
  color: var(--faint);
}

/* ---------- 工单 ---------- */

.tklist { display: flex; flex-direction: column; gap: 12px; }

.tk {
  padding: 15px 17px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-2);
}

.tk--open { border-left: 3px solid var(--accent); }

.tk__h {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 12px;
}

.tk__id { font-family: var(--mono); font-size: 11.5px; color: var(--faint); }
.tk__subj { font-size: 14px; }

.tk__meta {
  margin-left: auto;
  font-size: 11.5px;
  color: var(--muted);
}

.tk__detail {
  margin: 10px 0 0;
  font-size: 13px;
  line-height: 1.8;
  color: var(--muted);
}

.tk__reply {
  margin: 10px 0 0;
  padding: 9px 13px;
  border-left: 3px solid var(--up);
  background: var(--panel);
  font-size: 12.5px;
  color: var(--text);
}

.tk__acts {
  display: flex;
  justify-content: flex-end;
  margin-top: 12px;
}

/* ---------- 横向条形分布 ---------- */

.bars { display: flex; flex-direction: column; gap: 11px; }

.bars__r {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr) 76px;
  align-items: center;
  gap: 12px;
}

.bars__k {
  font-size: 12.5px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bars__track {
  height: 8px;
  border-radius: 4px;
  background: var(--panel-2);
  overflow: hidden;
}

.bars__fill {
  height: 100%;
  border-radius: 4px;
  background: var(--accent);
}

.bars__v {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--muted);
  text-align: right;
}

/* ---------- 设置 ---------- */

.setlist { display: flex; flex-direction: column; }

.set {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 15px 2px;
  border-bottom: 1px solid var(--line);
}

.set:last-child { border-bottom: 0; }

.set__txt { flex: 1; min-width: 0; }
.set__txt b { display: block; font-size: 13.5px; }

.set__d {
  display: block;
  margin-top: 2px;
  font-size: 11.5px;
  color: var(--muted);
}

.set__val {
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--accent);
}

/* 开关 */
.switch {
  flex: 0 0 auto;
  width: 42px;
  height: 24px;
  padding: 2px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel-2);
  cursor: pointer;
  transition: background .15s ease;
}

.switch__dot {
  display: block;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--muted);
  transition: transform .15s ease, background .15s ease;
}

.switch.is-on { background: var(--accent-soft); border-color: var(--accent); }
.switch.is-on .switch__dot { transform: translateX(18px); background: var(--accent); }

/* ---------- 说明条 ---------- */

.note {
  margin: 0;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: 8px;
  background: var(--panel);
  font-size: 12.5px;
  color: var(--muted);
}

/* ---------- 操作提示 ---------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  z-index: 40;
  transform: translateX(-50%) translateY(16px);
  padding: 10px 20px;
  border: 1px solid var(--accent);
  border-radius: 8px;
  background: var(--panel);
  color: var(--text);
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .18s ease, transform .18s ease;
  max-width: min(90vw, 480px);
}

.toast.is-show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}