/* ============================================================
   运营工作台 · 样式
   响应式：>=960px 左侧固定导航；<960px 顶部栏 + 底部 tab（手机简版）
   配色沿用小程序品牌橙 #FF6B35，深色侧边栏利于长时间看数据
   ============================================================ */
:root {
  --brand: #FF6B35;
  --brand-soft: #FFF2EC;
  --brand-deep: #E4571F;
  --ink: #1B2130;
  --ink-2: #4A5264;
  --ink-3: #8A90A0;
  --line: #E9EBF0;
  --bg: #F5F6F8;
  --card: #FFFFFF;
  --nav: #1B2130;
  --nav-2: #232B3D;
  --ok: #14A98D;
  --warn: #F2A93B;
  --danger: #E5484D;
  --blue: #2E7CF6;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(20, 24, 40, .04), 0 6px 20px rgba(20, 24, 40, .05);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  overflow-x: hidden;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
button, input, select { font-family: inherit; font-size: inherit; }
a { color: var(--brand); text-decoration: none; }
.hide { display: none !important; }

/* ---------------- 登录 ---------------- */
#login {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: radial-gradient(1200px 600px at 20% 0%, #2A3450 0%, #1B2130 55%, #141926 100%);
}
.login-card {
  width: 100%;
  max-width: 380px;
  background: #fff;
  border-radius: 18px;
  padding: 32px 28px 26px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, .35);
}
.login-logo {
  width: 52px; height: 52px; border-radius: 14px;
  background: var(--brand); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 24px; font-weight: 800; margin-bottom: 16px;
}
.login-card h1 { font-size: 19px; margin: 0 0 4px; }
.login-card p.sub { margin: 0 0 22px; color: var(--ink-3); font-size: 13px; }
.login-card label { display: block; font-size: 13px; color: var(--ink-2); margin-bottom: 6px; }
.login-card input[type="password"] {
  width: 100%; height: 44px; border: 1px solid var(--line); border-radius: 10px;
  padding: 0 14px; outline: none; transition: border-color .15s;
}
.login-card input[type="password"]:focus { border-color: var(--brand); }
.login-err { color: var(--danger); font-size: 13px; min-height: 20px; margin: 8px 0 0; }
.login-tip { margin-top: 18px; font-size: 12px; color: var(--ink-3); line-height: 1.7; }

/* ---------------- 框架 ---------------- */
#app { display: flex; min-height: 100vh; }
.sidebar {
  width: 220px; flex: 0 0 220px;
  background: var(--nav);
  color: #C9CFDD;
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
}
.brand {
  padding: 20px 18px 16px;
  font-weight: 700; font-size: 14px; color: #fff;
  display: flex; align-items: center; gap: 10px;
  border-bottom: 1px solid rgba(255, 255, 255, .07);
}
.brand i {
  width: 26px; height: 26px; border-radius: 8px; background: var(--brand);
  display: inline-flex; align-items: center; justify-content: center;
  font-style: normal; font-size: 13px; font-weight: 800;
}
.nav { padding: 12px 10px; flex: 1; overflow-y: auto; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: 10px;
  cursor: pointer; font-size: 13.5px; color: #C9CFDD;
  margin-bottom: 3px; transition: background .12s, color .12s;
}
.nav-item:hover { background: var(--nav-2); color: #fff; }
.nav-item.active { background: var(--brand); color: #fff; font-weight: 600; }
.nav-item .ico { width: 18px; text-align: center; font-size: 15px; }
.nav-item .badge {
  margin-left: auto; background: rgba(255, 255, 255, .16);
  border-radius: 999px; padding: 1px 7px; font-size: 11px;
}
.nav-item.active .badge { background: rgba(255, 255, 255, .28); }
.sidebar-foot {
  padding: 12px 16px 16px; border-top: 1px solid rgba(255, 255, 255, .07);
  font-size: 12px; color: #7F8798; display: flex; justify-content: space-between; align-items: center;
}
.sidebar-foot button {
  background: transparent; border: 1px solid rgba(255, 255, 255, .18);
  color: #C9CFDD; border-radius: 8px; padding: 3px 10px; cursor: pointer; font-size: 12px;
}
.sidebar-foot button:hover { border-color: var(--brand); color: #fff; }

.main { flex: 1; min-width: 0; padding: 22px 26px 40px; }
.main-wrap { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.topbar h2 { font-size: 19px; margin: 0; }
.topbar .meta { font-size: 12px; color: var(--ink-3); }
.mock-pill {
  display: inline-block; margin-left: 8px; padding: 2px 9px; border-radius: 999px;
  background: var(--brand-soft); color: var(--brand-deep); font-size: 11px; font-weight: 600;
  vertical-align: middle;
}

/* ---------------- 通用块 ---------------- */
.card {
  background: var(--card); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 16px 18px; margin-bottom: 16px;
}
.card-title {
  font-size: 14px; font-weight: 700; margin: 0 0 12px;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
}
.card-title .hint { font-size: 12px; font-weight: 400; color: var(--ink-3); }
.grid { display: grid; gap: 14px; }
/* grid/flex 子项默认 min-width:auto，会被内容撑破父容器（手机端整页横向溢出的常见元凶） */
.grid > * { min-width: 0; }
.grid-kpi { grid-template-columns: repeat(4, 1fr); }
.grid-2 { grid-template-columns: 1fr 1fr; }
.grid-3 { grid-template-columns: 2fr 1fr; }

.kpi {
  background: var(--card); border-radius: var(--radius); padding: 14px 16px;
  box-shadow: var(--shadow); position: relative; overflow: hidden;
}
.kpi .k-label { font-size: 12.5px; color: var(--ink-3); }
.kpi .k-val { font-size: 26px; font-weight: 800; letter-spacing: -.5px; margin-top: 2px; }
.kpi .k-sub { font-size: 12px; color: var(--ink-3); margin-top: 2px; }
.kpi.accent { background: linear-gradient(135deg, #FF7A45 0%, #FF5A28 100%); color: #fff; }
.kpi.accent .k-label, .kpi.accent .k-sub { color: rgba(255, 255, 255, .85); }
.kpi.warn .k-val { color: var(--warn); }

/* 图表 */
.chart-svg { width: 100%; max-width: 100%; height: auto; display: block; overflow: visible; }
.chart-legend { display: flex; gap: 16px; flex-wrap: wrap; margin-bottom: 6px; font-size: 12.5px; color: var(--ink-2); }
.chart-legend .lg { display: inline-flex; align-items: center; gap: 6px; }
.chart-legend .lg i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.chart-empty { color: var(--ink-3); font-size: 13px; padding: 28px 0; text-align: center; }
.bars { display: flex; flex-direction: column; gap: 9px; }
.bar-row { display: flex; align-items: center; gap: 10px; font-size: 13px; }
.bar-name { width: 86px; flex: 0 0 86px; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-track { flex: 1; height: 8px; background: #F0F2F6; border-radius: 999px; overflow: hidden; }
.bar-track i { display: block; height: 100%; border-radius: 999px; }
.bar-val { width: 34px; text-align: right; color: var(--ink-2); font-variant-numeric: tabular-nums; }

.ring { position: relative; width: 68px; height: 68px; flex: 0 0 68px; border-radius: 50%; }
.count-badge { display: block; }
.ring-mid {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; line-height: 1.1;
}
.ring-mid b { font-size: 15px; }
.ring-mid span { font-size: 10px; color: var(--ink-3); }
.health-row { display: flex; align-items: center; gap: 14px; padding: 8px 0; }
.health-row + .health-row { border-top: 1px dashed var(--line); }

/* ---------------- 工具条 / tab ---------------- */
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar > * { min-width: 0; max-width: 100%; }
.search {
  flex: 1; min-width: 180px; display: flex; align-items: center; gap: 8px;
  background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 0 12px; height: 38px;
}
.search input { border: 0; outline: none; flex: 1; background: transparent; height: 100%; }
.tabs { display: flex; gap: 6px; background: #EDEFF4; padding: 4px; border-radius: 11px; flex-wrap: wrap; }
.tab {
  border: 0; background: transparent; padding: 7px 14px; border-radius: 8px;
  cursor: pointer; font-size: 13px; color: var(--ink-2); white-space: nowrap;
}
.tab.active { background: #fff; color: var(--ink); font-weight: 600; box-shadow: 0 1px 3px rgba(20, 24, 40, .1); }
.tab .n {
  display: inline-block; margin-left: 6px; background: var(--brand); color: #fff;
  border-radius: 999px; padding: 0 6px; font-size: 11px; font-weight: 600;
}

/* ---------------- 按钮 ---------------- */
.btn {
  border: 1px solid var(--line); background: #fff; color: var(--ink-2);
  height: 34px; padding: 0 14px; border-radius: 9px; cursor: pointer;
  font-size: 13px; transition: all .13s; white-space: nowrap;
}
.btn:hover { border-color: #D3D8E2; color: var(--ink); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 600; }
.btn.primary:hover { background: var(--brand-deep); border-color: var(--brand-deep); color: #fff; }
.btn.ok { background: #E8F7F3; border-color: #BFE8DD; color: #0E8A71; }
.btn.danger { background: #FDECEC; border-color: #F7C9CA; color: var(--danger); }
.btn.sm { height: 28px; padding: 0 10px; font-size: 12.5px; border-radius: 7px; }

/* ---------------- 列表项 ---------------- */
.item {
  display: flex; gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--line);
}
.item:last-child { border-bottom: 0; }
.item .chk { padding-top: 3px; }
.item .chk input { width: 16px; height: 16px; accent-color: var(--brand); }
.item .body { flex: 1; min-width: 0; }
.item .title { font-weight: 600; font-size: 14px; margin-bottom: 3px; }
.item .desc { color: var(--ink-2); font-size: 13px; word-break: break-word; }
.item .meta { color: var(--ink-3); font-size: 12px; margin-top: 5px; display: flex; gap: 12px; flex-wrap: wrap; }
.item .ops { display: flex; gap: 8px; align-items: flex-start; flex-wrap: wrap; }

.thumbs { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.thumbs img { width: 74px; height: 74px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); cursor: zoom-in; }

.pill {
  display: inline-block; padding: 1px 9px; border-radius: 999px; font-size: 11.5px;
  font-weight: 600; line-height: 1.7;
}
.pill.ok { background: #E8F7F3; color: #0E8A71; }
.pill.warn { background: #FDF3E3; color: #B47A16; }
.pill.danger { background: #FDECEC; color: var(--danger); }
.pill.muted { background: #F0F2F6; color: var(--ink-3); }
.pill.info { background: #EAF1FE; color: #1F5FCB; }

/* 卡片式行（用户/企业/订单）：桌面按类型分列，手机重排为三行 */
.row-card {
  display: grid; gap: 12px; align-items: center;
  padding: 13px 0; border-bottom: 1px solid var(--line); font-size: 13.5px;
}
.row-user { grid-template-columns: 1.5fr .8fr .8fr .9fr auto; }
.row-company { grid-template-columns: 1.7fr .8fr .7fr .9fr auto; }
.row-order { grid-template-columns: 1.7fr .7fr .8fr .9fr .8fr; }
.row-card:last-child { border-bottom: 0; }
.c-main { display: flex; align-items: baseline; gap: 8px; min-width: 0; flex-wrap: wrap; }
.row-card .name { font-weight: 600; }
.row-card .sub { font-size: 12px; color: var(--ink-3); }
.c-amt { font-weight: 700; font-variant-numeric: tabular-nums; }
.c-num { font-variant-numeric: tabular-nums; color: var(--ink-2); }
.row-head { color: var(--ink-3); font-size: 12px; font-weight: 600; }
.row-ops { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }

.empty { text-align: center; padding: 44px 0; color: var(--ink-3); }
.empty .big { font-size: 34px; margin-bottom: 8px; opacity: .5; }
.skeleton { height: 14px; border-radius: 6px; background: linear-gradient(90deg, #EEF0F4 25%, #F6F7F9 37%, #EEF0F4 63%); background-size: 400% 100%; animation: sk 1.3s ease infinite; }
@keyframes sk { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

/* ---------------- 弹层 / toast ---------------- */
.modal-mask {
  position: fixed; inset: 0; background: rgba(20, 24, 40, .45);
  display: flex; align-items: center; justify-content: center; padding: 20px; z-index: 90;
}
.modal {
  background: #fff; border-radius: 16px; width: 100%; max-width: 420px;
  padding: 22px 22px 18px; box-shadow: 0 24px 60px rgba(0, 0, 0, .3);
}
.modal h3 { margin: 0 0 6px; font-size: 16px; }
.modal p { margin: 0 0 14px; color: var(--ink-2); font-size: 13px; }
.modal textarea, .modal input, .modal select {
  width: 100%; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px;
  outline: none; font-family: inherit; font-size: 13px;
}
.modal textarea { min-height: 74px; resize: vertical; }
.modal .modal-ops { display: flex; justify-content: flex-end; gap: 10px; margin-top: 16px; }

#toast {
  position: fixed; left: 50%; bottom: 40px; transform: translateX(-50%) translateY(20px);
  background: rgba(27, 33, 48, .94); color: #fff; padding: 10px 20px; border-radius: 10px;
  font-size: 13px; opacity: 0; pointer-events: none; transition: all .22s; z-index: 120; max-width: 90vw;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

#lightbox {
  position: fixed; inset: 0; background: rgba(0, 0, 0, .86); z-index: 150;
  display: flex; align-items: center; justify-content: center; padding: 24px; cursor: zoom-out;
}
#lightbox img { max-width: 100%; max-height: 100%; border-radius: 8px; }

/* ---------------- 手机简版 ---------------- */
.mobile-bar { display: none; }

@media (max-width: 960px) {
  #app { display: block; }
  .sidebar { display: none; }
  .mobile-bar {
    display: flex; align-items: center; justify-content: space-between;
    position: sticky; top: 0; z-index: 60;
    background: var(--nav); color: #fff; padding: 12px 16px;
  }
  .mobile-bar .t { font-size: 14px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
  .mobile-bar .t i {
    width: 22px; height: 22px; border-radius: 6px; background: var(--brand);
    display: inline-flex; align-items: center; justify-content: center; font-style: normal; font-size: 11px; font-weight: 800;
  }
  .mobile-bar button {
    background: transparent; border: 1px solid rgba(255, 255, 255, .2); color: #fff;
    border-radius: 8px; padding: 3px 10px; font-size: 12px;
  }
  .main { padding: 14px 14px 84px; overflow-x: hidden; }
  .topbar h2 { font-size: 17px; }
  /* 窄屏 tab 改为换行显示，避免 4 个 tab 横向撑破页面 */
  .tabs { width: 100%; flex-wrap: wrap; }
  .tab { flex: 1 1 auto; min-width: 0; text-align: center; padding: 7px 8px; }
  .toolbar { gap: 8px; }
  .toolbar .bulk-ops { width: 100%; margin-left: 0 !important; justify-content: flex-start; }
  .search { flex: 1 1 100%; }

  /* 手机端列表行：表头无意义直接隐藏，每行拆成「主信息 / 标签组 / 操作」三行 */
  .row-card.row-head { display: none; }
  .row-card { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; padding: 13px 0; }
  .c-main { flex: 1 1 100%; align-items: center; }
  .c-role { order: 2; }
  .c-status { order: 3; }
  .c-amt { order: 4; }
  .c-num { order: 4; }
  .c-payer { order: 5; }
  .c-time { order: 6; margin-left: auto; }
  .row-ops { order: 7; flex: 1 1 100%; justify-content: flex-end; }
  .grid-kpi { grid-template-columns: 1fr 1fr; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .kpi .k-val { font-size: 22px; }
  .row-card { grid-template-columns: 1fr auto; gap: 6px 10px; }
  .row-card .row-head { display: none; }
  .row-card .name { grid-column: 1; }
  .row-card .sub, .row-card .num { grid-column: 1; }
  .row-ops { grid-column: 2; grid-row: 1 / span 3; align-items: center; }
  .item { flex-wrap: wrap; }
  .item .ops { width: 100%; padding-left: 30px; }

  .tabbar {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 70;
    background: #fff; border-top: 1px solid var(--line);
    padding: 6px 0 8px; box-shadow: 0 -2px 14px rgba(20, 24, 40, .06);
  }
  .tabbar .tb {
    flex: 1; text-align: center; font-size: 11px; color: var(--ink-3);
    cursor: pointer; padding: 2px 0; position: relative;
  }
  .tabbar .tb .ti { display: block; font-size: 19px; line-height: 1.25; }
  .tabbar .tb.active { color: var(--brand); font-weight: 600; }
  .tabbar .tb .dot {
    position: absolute; top: 0; right: 50%; margin-right: -20px;
    background: var(--danger); color: #fff; border-radius: 999px;
    font-size: 10px; padding: 0 5px; min-width: 15px; line-height: 15px;
  }
}

@media (max-width: 420px) {
  .grid-kpi { grid-template-columns: 1fr 1fr; gap: 10px; }
  .kpi { padding: 12px; }
  .kpi .k-val { font-size: 20px; }
  .card { padding: 14px; }
}

@media (min-width: 961px) {
  .tabbar { display: none; }
}
