/* 恒新万能服务 · Web 管理后台 */
:root {
  --primary: #4f46e5;
  --primary-dark: #4338ca;
  --primary-light: #eef2ff;
  --sidebar-bg: #0f172a;
  --sidebar-hover: #1e293b;
  --sidebar-active: #4f46e5;
  --bg: #f5f6fa;
  --card: #ffffff;
  --border: #e5e7eb;
  --text: #111827;
  --text-2: #6b7280;
  --text-3: #9ca3af;
  --green: #059669; --green-bg: #ecfdf5;
  --red: #dc2626;   --red-bg: #fef2f2;
  --amber: #d97706; --amber-bg: #fffbeb;
  --blue: #2563eb;  --blue-bg: #eff6ff;
  --purple: #7c3aed; --purple-bg: #f5f3ff;
  --gray-bg: #f3f4f6;
  --radius: 14px;
  --shadow: 0 1px 3px rgba(16,24,40,.06), 0 1px 2px rgba(16,24,40,.04);
  --shadow-lg: 0 12px 32px rgba(16,24,40,.14);
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--bg); color: var(--text); font-size: 14px; line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
button { font-family: inherit; cursor: pointer; border: none; background: none; }
input, select, textarea { font-family: inherit; font-size: 14px; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 4px; }
::-webkit-scrollbar-track { background: transparent; }

/* ---------- 登录页 ---------- */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: #0f172a;
  background-image: radial-gradient(ellipse at 20% 0%, rgba(79,70,229,.25), transparent 50%),
                    radial-gradient(ellipse at 80% 100%, rgba(37,99,235,.18), transparent 50%);
  padding: 24px;
}
.login-card {
  width: 420px; max-width: 100%; background: #fff; border-radius: 20px; padding: 44px 40px 36px;
  box-shadow: 0 24px 64px rgba(0,0,0,.35);
}
.login-logo { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.login-logo .mark {
  width: 44px; height: 44px; border-radius: 12px; background: var(--primary); color: #fff;
  display: flex; align-items: center; justify-content: center; font-size: 20px; font-weight: 700;
}
.login-logo .tt { font-size: 19px; font-weight: 700; }
.login-sub { color: var(--text-2); font-size: 13px; margin-bottom: 28px; }
.login-card .field { margin-bottom: 16px; }
.login-card label { display: block; font-size: 13px; font-weight: 600; color: var(--text-2); margin-bottom: 6px; }
.login-foot { margin-top: 20px; text-align: center; color: var(--text-3); font-size: 12px; }

/* ---------- 布局 ---------- */
.layout { display: flex; min-height: 100vh; }
.sidebar {
  width: 232px; background: var(--sidebar-bg); color: #cbd5e1; flex-shrink: 0;
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 20px 18px 16px; color: #fff; }
.brand .mark { width: 36px; height: 36px; border-radius: 10px; background: var(--primary); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 16px; color: #fff; }
.brand .name { font-size: 15px; font-weight: 700; line-height: 1.3; }
.brand .name small { display: block; font-size: 11px; font-weight: 400; color: #64748b; }
.nav-group { padding: 6px 12px; }
.nav-group-title { font-size: 11px; color: #475569; padding: 14px 10px 6px; letter-spacing: .08em; }
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 9px;
  color: #94a3b8; font-size: 13.5px; cursor: pointer; transition: all .15s; margin-bottom: 2px;
  text-decoration: none; user-select: none;
}
.nav-item:hover { background: var(--sidebar-hover); color: #e2e8f0; }
.nav-item.active { background: var(--sidebar-active); color: #fff; font-weight: 600; }
.nav-item .ico { width: 18px; text-align: center; font-size: 15px; }
.nav-item .cnt { margin-left: auto; background: #ef4444; color: #fff; font-size: 11px; padding: 0 7px; border-radius: 999px; line-height: 18px; }
.sidebar-foot { margin-top: auto; padding: 14px 16px; border-top: 1px solid #1e293b; font-size: 12px; color: #475569; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: 60px; background: #fff; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 16px; padding: 0 28px; position: sticky; top: 0; z-index: 30;
}
.topbar .page-title { font-size: 16px; font-weight: 700; }
.topbar .spacer { flex: 1; }
.admin-chip { display: flex; align-items: center; gap: 10px; }
.admin-chip .avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--primary-light); color: var(--primary); display: flex; align-items: center; justify-content: center; font-weight: 700; }
.admin-chip .meta { line-height: 1.25; }
.admin-chip .meta .n { font-size: 13px; font-weight: 600; }
.admin-chip .meta .r { font-size: 11px; color: var(--text-3); }
.content { padding: 24px 28px 48px; max-width: 1440px; width: 100%; margin: 0 auto; }

/* ---------- 通用组件 ---------- */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); border: 1px solid var(--border); }
.card-pad { padding: 20px 22px; }
.card-head { display: flex; align-items: center; gap: 12px; padding: 16px 22px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.card-head .t { font-size: 15px; font-weight: 700; }
.card-head .sub { font-size: 12.5px; color: var(--text-3); }
.card-head .right { margin-left: auto; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 16px; border-radius: 9px; font-size: 13.5px; font-weight: 600;
  background: var(--primary); color: #fff; transition: all .15s; white-space: nowrap;
}
.btn:hover { background: var(--primary-dark); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.ghost { background: #fff; color: var(--text); border: 1px solid var(--border); }
.btn.ghost:hover { border-color: #c7cdd6; background: var(--gray-bg); }
.btn.danger { background: var(--red); }
.btn.danger:hover { background: #b91c1c; }
.btn.success { background: var(--green); }
.btn.success:hover { background: #047857; }
.btn.sm { padding: 5px 11px; font-size: 12.5px; border-radius: 7px; }
.btn.block { width: 100%; padding: 11px; font-size: 14.5px; }

.field label { display: block; font-size: 13px; font-weight: 600; color: var(--text-2); margin-bottom: 6px; }
.field input, .field select, .field textarea {
  width: 100%; padding: 9px 12px; border: 1px solid var(--border); border-radius: 9px;
  background: #fff; color: var(--text); outline: none; transition: border .15s, box-shadow .15s;
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(79,70,229,.12); }
.field textarea { min-height: 90px; resize: vertical; }
.field .hint { font-size: 12px; color: var(--text-3); margin-top: 4px; }

.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.toolbar .search {
  display: flex; align-items: center; gap: 8px; background: #fff; border: 1px solid var(--border);
  border-radius: 9px; padding: 0 12px; height: 38px; min-width: 240px;
}
.toolbar .search input { border: none; outline: none; flex: 1; font-size: 13.5px; }
.toolbar select {
  height: 38px; border: 1px solid var(--border); border-radius: 9px; background: #fff; padding: 0 10px;
  font-size: 13.5px; color: var(--text); outline: none;
}

.badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.badge.green { background: var(--green-bg); color: var(--green); }
.badge.red { background: var(--red-bg); color: var(--red); }
.badge.amber { background: var(--amber-bg); color: var(--amber); }
.badge.blue { background: var(--blue-bg); color: var(--blue); }
.badge.purple { background: var(--purple-bg); color: var(--purple); }
.badge.gray { background: var(--gray-bg); color: var(--text-2); }
.badge .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

table.tbl { width: 100%; border-collapse: collapse; }
.tbl th {
  text-align: left; font-size: 12px; font-weight: 600; color: var(--text-2);
  padding: 11px 16px; background: #f9fafb; border-bottom: 1px solid var(--border); white-space: nowrap;
}
.tbl td { padding: 13px 16px; border-bottom: 1px solid #f1f2f6; font-size: 13.5px; vertical-align: middle; }
.tbl tr:last-child td { border-bottom: none; }
.tbl tbody tr { transition: background .12s; }
.tbl tbody tr:hover { background: #fafbfe; }
.tbl .ops { display: flex; gap: 6px; flex-wrap: wrap; }
.tbl-empty { text-align: center; padding: 48px 20px; color: var(--text-3); }

.pagination { display: flex; align-items: center; justify-content: space-between; padding: 14px 22px; border-top: 1px solid var(--border); font-size: 13px; color: var(--text-2); }
.pagination .pgs { display: flex; gap: 6px; }
.pagination button { min-width: 32px; height: 32px; border-radius: 8px; border: 1px solid var(--border); background: #fff; color: var(--text); font-size: 13px; }
.pagination button.cur { background: var(--primary); color: #fff; border-color: var(--primary); font-weight: 700; }
.pagination button:disabled { opacity: .4; cursor: not-allowed; }

/* 仪表盘 */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 20px; }
.stat-card { padding: 18px 20px; display: flex; align-items: center; gap: 14px; }
.stat-card .ic { width: 46px; height: 46px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 20px; flex-shrink: 0; }
.stat-card .v { font-size: 25px; font-weight: 800; line-height: 1.15; font-variant-numeric: tabular-nums; }
.stat-card .l { font-size: 12.5px; color: var(--text-2); }
.dash-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.dash-grid .full { grid-column: 1 / -1; }
@media (max-width: 1100px) { .dash-grid { grid-template-columns: 1fr; } }
.chart-bars { display: flex; align-items: flex-end; gap: 10px; height: 180px; padding: 12px 8px 0; }
.chart-bars .bar-w { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; }
.chart-bars .bar { width: 100%; max-width: 46px; background: var(--primary); border-radius: 6px 6px 2px 2px; min-height: 3px; transition: height .4s; opacity: .85; }
.chart-bars .bar:hover { opacity: 1; }
.chart-bars .num { font-size: 12px; font-weight: 700; color: var(--text-2); }
.chart-bars .lbl { font-size: 11.5px; color: var(--text-3); }
.cat-rows { display: flex; flex-direction: column; gap: 10px; padding: 18px 22px; }
.cat-row { display: flex; align-items: center; gap: 12px; }
.cat-row .nm { width: 90px; font-size: 13px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex-shrink: 0; }
.cat-row .track { flex: 1; height: 10px; border-radius: 999px; background: var(--gray-bg); overflow: hidden; }
.cat-row .fill { height: 100%; border-radius: 999px; background: var(--primary); }
.cat-row .val { width: 44px; text-align: right; font-size: 12.5px; font-weight: 700; font-variant-numeric: tabular-nums; }

.pending-item { display: flex; gap: 12px; padding: 13px 22px; border-bottom: 1px solid #f1f2f6; align-items: flex-start; }
.pending-item:last-child { border-bottom: none; }
.pending-item .txt { flex: 1; min-width: 0; }
.pending-item .txt .d { font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pending-item .txt .m { font-size: 12px; color: var(--text-3); margin-top: 2px; }
.pending-item .ops { display: flex; gap: 6px; flex-shrink: 0; }

/* 弹窗 */
.modal-mask {
  position: fixed; inset: 0; background: rgba(15,23,42,.5); z-index: 100;
  display: flex; align-items: flex-start; justify-content: center; padding: 60px 20px 20px; overflow-y: auto;
}
.modal {
  background: #fff; border-radius: 16px; width: 560px; max-width: 100%;
  box-shadow: var(--shadow-lg); animation: pop .18s ease;
}
.modal.wide { width: 760px; }
@keyframes pop { from { transform: translateY(10px) scale(.98); opacity: 0; } to { transform: none; opacity: 1; } }
.modal-head { display: flex; align-items: center; padding: 18px 24px; border-bottom: 1px solid var(--border); }
.modal-head .t { font-size: 16px; font-weight: 700; }
.modal-head .x { margin-left: auto; width: 30px; height: 30px; border-radius: 8px; color: var(--text-3); font-size: 18px; }
.modal-head .x:hover { background: var(--gray-bg); color: var(--text); }
.modal-body { padding: 20px 24px; max-height: 64vh; overflow-y: auto; }
.modal-foot { padding: 14px 24px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 10px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid .span2 { grid-column: 1 / -1; }
@media (max-width: 640px) { .form-grid { grid-template-columns: 1fr; } }

/* 详情描述 */
.desc-list { display: flex; flex-direction: column; gap: 0; }
.desc-list .row { display: flex; padding: 9px 0; border-bottom: 1px solid #f3f4f6; font-size: 13.5px; }
.desc-list .row:last-child { border-bottom: none; }
.desc-list .k { width: 110px; color: var(--text-3); flex-shrink: 0; }
.desc-list .v { flex: 1; color: var(--text); word-break: break-all; }

/* toast */
.toast-box { position: fixed; top: 20px; left: 50%; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 10px; align-items: center; }
.toast {
  background: #111827; color: #fff; padding: 10px 20px; border-radius: 10px; font-size: 13.5px;
  box-shadow: var(--shadow-lg); animation: pop .18s ease; display: flex; gap: 8px; align-items: center;
}
.toast.ok { background: var(--green); }
.toast.err { background: var(--red); }

/* 其他 */
.skeleton { padding: 40px; text-align: center; color: var(--text-3); }
.link { color: var(--primary); cursor: pointer; }
.link:hover { text-decoration: underline; }
.mono { font-family: "SF Mono", Consolas, monospace; font-size: 12.5px; }
.text-2 { color: var(--text-2); }
.text-3 { color: var(--text-3); }
.tag-mini { display: inline-block; background: var(--gray-bg); color: var(--text-2); font-size: 11.5px; padding: 1px 8px; border-radius: 6px; margin-right: 4px; }
.safe-tip { background: var(--amber-bg); border: 1px solid #fde68a; color: #92400e; border-radius: 10px; padding: 10px 14px; font-size: 12.5px; margin-bottom: 14px; }

@media (max-width: 920px) {
  .sidebar { position: fixed; left: -240px; transition: left .2s; z-index: 60; }
  .sidebar.open { left: 0; }
  .nav-toggle { display: block !important; }
  .content { padding: 16px 14px 40px; }
  .topbar { padding: 0 14px; }
}
.nav-toggle { display: none; width: 36px; height: 36px; border-radius: 8px; font-size: 18px; }
.nav-toggle:hover { background: var(--gray-bg); }
