/* ==========================================================
   诅咒之岛接单系统 · 后台管理
   设计基调：蓝白、扁平、信息密度适中、无装饰
   ========================================================== */

*, *::before, *::after { box-sizing: border-box; }

:root {
  --c-blue-700: #1d4ed8;
  --c-blue-600: #2563eb;
  --c-blue-500: #3b82f6;
  --c-blue-50:  #eff6ff;
  --c-blue-100: #dbeafe;

  --c-text:     #0f172a;
  --c-text-2:   #475569;
  --c-text-3:   #94a3b8;
  --c-line:     #e2e8f0;
  --c-line-2:   #cbd5e1;
  --c-bg:       #f6f8fb;
  --c-white:    #ffffff;

  --c-red:      #dc2626;
  --c-red-bg:   #fef2f2;
  --c-orange:   #ea580c;
  --c-orange-bg:#fff7ed;
  --c-green:    #059669;
  --c-green-bg: #ecfdf5;
  --c-gray-bg:  #f1f5f9;

  --r-sm: 4px;
  --r-md: 6px;
  --r-lg: 8px;
  --shadow-1: 0 1px 2px rgba(15,23,42,.06);
  --shadow-2: 0 4px 16px rgba(15,23,42,.10);
  --h-top: 52px;
}

html, body {
  margin: 0; padding: 0;
  background: var(--c-bg);
  color: var(--c-text);
  font-size: 13px;
  line-height: 1.6;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--c-blue-600); text-decoration: none; }
a:hover { color: var(--c-blue-700); }

/* ---------------- 顶栏 ---------------- */
.topbar {
  height: var(--h-top);
  background: var(--c-white);
  border-bottom: 1px solid var(--c-line);
  display: flex; align-items: center;
  padding: 0 20px;
  position: sticky; top: 0; z-index: 50;
}
.topbar .brand {
  font-size: 14px; font-weight: 600; color: var(--c-text);
  display: flex; align-items: center; gap: 8px;
}
.topbar .brand .logo {
  width: 22px; height: 22px; border-radius: var(--r-sm);
  background: var(--c-blue-600);
  color: #fff; font-size: 11px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.topbar .brand small { font-weight: 400; color: var(--c-text-3); font-size: 11px; }
.topbar .spacer { flex: 1; }
.topbar .who {
  display: flex; align-items: center; gap: 10px;
  font-size: 12px; color: var(--c-text-2);
}
.topbar .who .role {
  background: var(--c-blue-50); color: var(--c-blue-700);
  padding: 1px 6px; border-radius: var(--r-sm); font-size: 11px;
}
.topbar .who a { color: var(--c-text-2); }
.topbar .who a:hover { color: var(--c-red); }

/* ---------------- 布局 ---------------- */
.layout { display: flex; min-height: calc(100vh - var(--h-top)); }

.sidebar {
  width: 176px; flex: 0 0 176px;
  background: var(--c-white);
  border-right: 1px solid var(--c-line);
  padding: 10px 0 30px;
}
.sidebar .grp {
  padding: 12px 16px 4px;
  font-size: 11px; color: var(--c-text-3); letter-spacing: .5px;
}
.sidebar a.nav {
  display: block;
  padding: 7px 16px;
  font-size: 13px; color: var(--c-text-2);
  border-left: 2px solid transparent;
}
.sidebar a.nav:hover { background: var(--c-blue-50); color: var(--c-blue-700); }
.sidebar a.nav.on {
  background: var(--c-blue-50);
  color: var(--c-blue-700);
  font-weight: 600;
  border-left-color: var(--c-blue-600);
}

.main { flex: 1; min-width: 0; padding: 16px 20px 40px; }

/* ---------------- 页头 ---------------- */
.page-head {
  display: flex; align-items: flex-start; gap: 12px;
  margin-bottom: 14px;
}
.page-head h1 {
  margin: 0; font-size: 17px; font-weight: 600; letter-spacing: -.2px;
}
.page-head .sub { font-size: 12px; color: var(--c-text-3); margin-top: 2px; }
.page-head .actions { margin-left: auto; display: flex; gap: 8px; }

/* ---------------- 卡片 ---------------- */
.card {
  background: var(--c-white);
  border: 1px solid var(--c-line);
  border-radius: var(--r-lg);
  margin-bottom: 14px;
}
.card > .hd {
  padding: 10px 14px;
  border-bottom: 1px solid var(--c-line);
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; font-weight: 600;
}
.card > .hd .hint { font-weight: 400; color: var(--c-text-3); font-size: 11px; }
.card > .hd .right { margin-left: auto; font-weight: 400; }
.card > .bd { padding: 14px; }
.card > .bd.tight { padding: 0; }

/* ---------------- 筛选区 ---------------- */
.filters {
  background: var(--c-white);
  border: 1px solid var(--c-line);
  border-radius: var(--r-lg);
  padding: 12px 14px;
  margin-bottom: 12px;
}
.filters .row {
  display: flex; flex-wrap: wrap; gap: 10px 12px; align-items: flex-end;
}
.field { display: flex; flex-direction: column; gap: 4px; }
.field > label {
  font-size: 11px; color: var(--c-text-3); font-weight: 500;
}
.field.w-sm { width: 128px; }
.field.w-md { width: 168px; }
.field.w-lg { width: 220px; }

input[type="text"], input[type="search"], input[type="password"],
input[type="date"], input[type="number"], select, textarea {
  height: 30px;
  border: 1px solid var(--c-line-2);
  border-radius: var(--r-md);
  padding: 0 8px;
  font-size: 13px;
  color: var(--c-text);
  background: var(--c-white);
  outline: none;
  font-family: inherit;
  transition: border-color .12s, box-shadow .12s;
}
textarea { height: auto; padding: 6px 8px; resize: vertical; line-height: 1.6; }
input:focus, select:focus, textarea:focus {
  border-color: var(--c-blue-500);
  box-shadow: 0 0 0 3px rgba(59,130,246,.12);
}
input::placeholder, textarea::placeholder { color: var(--c-text-3); }
input[disabled], select[disabled] { background: var(--c-gray-bg); color: var(--c-text-3); cursor: not-allowed; }

/* ---------------- 按钮 ---------------- */
.btn {
  height: 30px; padding: 0 12px;
  border: 1px solid var(--c-line-2);
  background: var(--c-white);
  color: var(--c-text-2);
  border-radius: var(--r-md);
  font-size: 13px; font-family: inherit;
  cursor: pointer; display: inline-flex;
  align-items: center; justify-content: center; gap: 5px;
  transition: all .12s;
  white-space: nowrap;
}
.btn:hover { border-color: var(--c-blue-500); color: var(--c-blue-600); }
.btn-primary {
  background: var(--c-blue-600); border-color: var(--c-blue-600); color: #fff;
}
.btn-primary:hover { background: var(--c-blue-700); border-color: var(--c-blue-700); color: #fff; }
.btn-danger { background: var(--c-red); border-color: var(--c-red); color: #fff; }
.btn-danger:hover { background: #b91c1c; border-color: #b91c1c; color: #fff; }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-ghost:hover { background: var(--c-blue-50); }
.btn-sm { height: 26px; padding: 0 9px; font-size: 12px; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.btn-link {
  border: none; background: none; color: var(--c-blue-600);
  padding: 0 4px; height: auto; font-size: 12px; cursor: pointer;
}
.btn-link:hover { text-decoration: underline; }
.btn-link.danger { color: var(--c-red); }

/* ---------------- 表格 ---------------- */
.tbl-wrap { overflow-x: auto; }
table.tbl {
  width: 100%; border-collapse: collapse; font-size: 13px;
}
table.tbl th {
  text-align: left; font-weight: 600; font-size: 12px;
  color: var(--c-text-2);
  background: #f8fafc;
  padding: 9px 12px;
  border-bottom: 1px solid var(--c-line);
  white-space: nowrap;
}
table.tbl td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--c-line);
  vertical-align: middle;
}
table.tbl tbody tr:hover { background: #fafcff; }
table.tbl tbody tr:last-child td { border-bottom: none; }
table.tbl .nowrap { white-space: nowrap; }
table.tbl .mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
}
table.tbl .num { text-align: right; font-variant-numeric: tabular-nums; }
table.tbl .ck { width: 34px; }
table.tbl input[type="checkbox"] { width: 14px; height: 14px; cursor: pointer; }

.ellip { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------------- 徽标 ---------------- */
.b {
  display: inline-flex; align-items: center;
  height: 20px; padding: 0 7px;
  border-radius: 10px; font-size: 11px;
  font-weight: 500; white-space: nowrap;
}
.b-ok     { background: var(--c-green-bg);  color: var(--c-green); }
.b-warn   { background: var(--c-orange-bg); color: var(--c-orange); }
.b-danger { background: var(--c-red-bg);    color: var(--c-red); }
.b-blue   { background: var(--c-blue-50);   color: var(--c-blue-700); }
.b-mute   { background: var(--c-gray-bg);   color: var(--c-text-3); }

/* ---------------- 分页 ---------------- */
.pager {
  display: flex; align-items: center; gap: 4px;
  padding: 10px 14px; flex-wrap: wrap;
}
.pager .pg {
  min-width: 28px; height: 28px;
  display: inline-flex; align-items: center; justify-content: center;
  padding: 0 8px;
  border: 1px solid var(--c-line);
  border-radius: var(--r-md);
  color: var(--c-text-2); font-size: 12px;
  background: var(--c-white);
}
.pager a.pg:hover { border-color: var(--c-blue-500); color: var(--c-blue-600); }
.pager .pg-active {
  background: var(--c-blue-600); border-color: var(--c-blue-600); color: #fff;
}
.pager .pg-dis { color: var(--c-text-3); background: var(--c-gray-bg); }
.pager .pg-dots { border: none; background: none; color: var(--c-text-3); }
.pager .pg-total { margin-left: auto; font-size: 12px; color: var(--c-text-3); }

/* ---------------- 批量操作条 ---------------- */
.bulkbar {
  display: none;
  align-items: center; gap: 10px;
  padding: 8px 14px;
  background: var(--c-blue-50);
  border-bottom: 1px solid var(--c-blue-100);
  font-size: 12px; color: var(--c-blue-700);
}
.bulkbar.show { display: flex; }
.bulkbar .cnt { font-weight: 600; }

/* ---------------- 详情栅格 ---------------- */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0; }
.kv { display: flex; padding: 7px 0; font-size: 13px; }
.kv .k {
  width: 96px; flex: 0 0 96px;
  color: var(--c-text-3); font-size: 12px;
}
.kv .v { flex: 1; min-width: 0; word-break: break-all; }

/* ---------------- 标签页 ---------------- */
.tabs {
  display: flex; gap: 2px;
  border-bottom: 1px solid var(--c-line);
  padding: 0 14px;
  background: var(--c-white);
  border-radius: var(--r-lg) var(--r-lg) 0 0;
  overflow-x: auto;
}
.tabs a {
  padding: 10px 12px;
  font-size: 13px; color: var(--c-text-2);
  border-bottom: 2px solid transparent;
  white-space: nowrap;
}
.tabs a:hover { color: var(--c-blue-600); }
.tabs a.on {
  color: var(--c-blue-700); font-weight: 600;
  border-bottom-color: var(--c-blue-600);
}
.tabs a .n {
  display: inline-block; margin-left: 4px;
  background: var(--c-gray-bg); color: var(--c-text-3);
  border-radius: 8px; padding: 0 5px; font-size: 10px;
}
.tabs a.on .n { background: var(--c-blue-100); color: var(--c-blue-700); }

/* ---------------- 时间线 ---------------- */
.timeline { padding: 4px 0; }
.tl-item {
  position: relative;
  padding: 0 0 16px 20px;
  border-left: 1px solid var(--c-line);
  margin-left: 5px;
}
.tl-item:last-child { border-left-color: transparent; padding-bottom: 0; }
.tl-item::before {
  content: ''; position: absolute;
  left: -4px; top: 5px;
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--c-blue-500);
  box-shadow: 0 0 0 3px var(--c-white);
}
.tl-item.danger::before { background: var(--c-red); }
.tl-item.warn::before { background: var(--c-orange); }
.tl-item.ok::before { background: var(--c-green); }
.tl-head { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.tl-head strong { font-weight: 600; }
.tl-head .t { color: var(--c-text-3); font-size: 11px; margin-left: auto; }
.tl-body { font-size: 12px; color: var(--c-text-2); margin-top: 3px; line-height: 1.65; }

/* ---------------- 弹窗 ---------------- */
.modal-mask {
  display: none; position: fixed; inset: 0;
  background: rgba(15,23,42,.44);
  z-index: 200;
  padding: 24px 16px;
  overflow-y: auto;
}
.modal-mask.show { display: block; }
.modal {
  width: 100%; max-width: 620px;
  margin: 0 auto;
  background: var(--c-white);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-2);
  overflow: hidden;
}
.modal.wide { max-width: 800px; }
.modal > .mh {
  padding: 13px 16px;
  border-bottom: 1px solid var(--c-line);
  display: flex; align-items: center; gap: 8px;
  font-size: 14px; font-weight: 600;
}
.modal > .mh .x {
  margin-left: auto; cursor: pointer;
  color: var(--c-text-3); font-size: 18px; line-height: 1;
  background: none; border: none; padding: 0 2px;
}
.modal > .mh .x:hover { color: var(--c-text); }
.modal > .mb { padding: 16px; max-height: calc(100vh - 220px); overflow-y: auto; }
.modal > .mf {
  padding: 11px 16px;
  border-top: 1px solid var(--c-line);
  background: #fbfdff;
  display: flex; justify-content: flex-end; gap: 8px;
}

/* ---------------- 表单块 ---------------- */
.form-row { margin-bottom: 14px; }
.form-row > .lbl {
  font-size: 12px; color: var(--c-text-2);
  font-weight: 500; margin-bottom: 5px;
}
.form-row > .lbl .req { color: var(--c-red); margin-left: 2px; }
.form-row > .tip { font-size: 11px; color: var(--c-text-3); margin-top: 4px; }
.form-row > .err { font-size: 11px; color: var(--c-red); margin-top: 4px; display: none; }
.form-row.has-err > .err { display: block; }
.form-row.has-err input, .form-row.has-err select, .form-row.has-err textarea {
  border-color: var(--c-red);
}
.form-row input[type="text"], .form-row input[type="number"],
.form-row select, .form-row textarea { width: 100%; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }

/* 单选/复选组 */
.opt-group { display: flex; flex-wrap: wrap; gap: 8px; }
.opt {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 10px;
  border: 1px solid var(--c-line-2);
  border-radius: var(--r-md);
  cursor: pointer; font-size: 12px;
  background: var(--c-white);
  transition: all .12s;
  user-select: none;
}
.opt:hover { border-color: var(--c-blue-500); }
.opt input { margin: 0; width: 13px; height: 13px; }
.opt.on {
  border-color: var(--c-blue-600);
  background: var(--c-blue-50);
  color: var(--c-blue-700);
  font-weight: 500;
}
.opt.dis { opacity: .45; cursor: not-allowed; }

/* 证据上传 */
.uploader {
  border: 1px dashed var(--c-line-2);
  border-radius: var(--r-md);
  padding: 14px;
  text-align: center;
  background: #fbfdff;
  cursor: pointer;
  transition: all .12s;
}
.uploader:hover { border-color: var(--c-blue-500); background: var(--c-blue-50); }
.uploader .t { font-size: 12px; color: var(--c-text-2); }
.uploader .s { font-size: 11px; color: var(--c-text-3); margin-top: 3px; }
.thumbs { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.thumb {
  position: relative; width: 72px; height: 72px;
  border: 1px solid var(--c-line); border-radius: var(--r-md);
  overflow: hidden; background: var(--c-gray-bg);
}
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb .del {
  position: absolute; top: 2px; right: 2px;
  width: 16px; height: 16px; border-radius: 50%;
  background: rgba(15,23,42,.6); color: #fff;
  border: none; font-size: 11px; line-height: 1;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
}

/* ---------------- 提示 ---------------- */
.alert {
  padding: 9px 12px; border-radius: var(--r-md);
  font-size: 12px; margin-bottom: 12px;
  display: flex; gap: 8px; align-items: flex-start;
}
.alert-warn { background: var(--c-orange-bg); color: #9a3412; border: 1px solid #fed7aa; }
.alert-danger { background: var(--c-red-bg); color: #991b1b; border: 1px solid #fecaca; }
.alert-info { background: var(--c-blue-50); color: var(--c-blue-700); border: 1px solid var(--c-blue-100); }
.alert-ok { background: var(--c-green-bg); color: #065f46; border: 1px solid #a7f3d0; }

/* Toast */
#toast {
  position: fixed; top: 68px; left: 50%; transform: translateX(-50%) translateY(-8px);
  background: #0f172a; color: #fff;
  padding: 8px 16px; border-radius: var(--r-md);
  font-size: 13px; z-index: 900;
  opacity: 0; pointer-events: none;
  transition: all .2s;
  box-shadow: var(--shadow-2);
  max-width: 80vw;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast.ok { background: #065f46; }
#toast.err { background: #991b1b; }

/* ---------------- 空状态 ---------------- */
.empty {
  padding: 44px 20px; text-align: center; color: var(--c-text-3);
}
.empty .ic {
  width: 40px; height: 40px; margin: 0 auto 10px;
  border: 1px solid var(--c-line-2); border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; color: var(--c-line-2);
}
.empty .tt { font-size: 13px; color: var(--c-text-2); margin-bottom: 3px; }
.empty .ss { font-size: 12px; }

/* ---------------- 统计块 ---------------- */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 14px; }
.stat {
  background: var(--c-white); border: 1px solid var(--c-line);
  border-radius: var(--r-lg); padding: 12px 14px;
}
.stat .lbl { font-size: 11px; color: var(--c-text-3); margin-bottom: 4px; }
.stat .val { font-size: 20px; font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: -.4px; }
.stat .val.sm { font-size: 16px; }
.stat .ext { font-size: 11px; color: var(--c-text-3); margin-top: 2px; }

/* ---------------- 登录页 ---------------- */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: var(--c-bg); padding: 20px;
}
.login-box {
  width: 100%; max-width: 340px;
  background: var(--c-white);
  border: 1px solid var(--c-line);
  border-radius: var(--r-lg);
  padding: 26px 24px;
  box-shadow: var(--shadow-1);
}
.login-box h1 { margin: 0 0 4px; font-size: 16px; font-weight: 600; }
.login-box .s { font-size: 12px; color: var(--c-text-3); margin-bottom: 20px; }
.login-box .form-row { margin-bottom: 12px; }
.login-box .btn { width: 100%; height: 34px; }
.demo-accounts {
  margin-top: 16px; padding-top: 14px;
  border-top: 1px dashed var(--c-line);
  font-size: 11px; color: var(--c-text-3); line-height: 1.9;
}
.demo-accounts b { color: var(--c-text-2); font-weight: 500; }
.demo-accounts code {
  background: var(--c-gray-bg); padding: 0 4px; border-radius: 3px;
  font-family: ui-monospace, monospace;
}

/* ---------------- 响应式 ---------------- */
@media (max-width: 1180px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 900px) {
  .sidebar { display: none; }
  .main { padding: 12px; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
}
