* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; }
body {
  font-family: "Microsoft YaHei", "PingFang SC", -apple-system, "Segoe UI", sans-serif;
  font-size: 14px; color: #2c3338; background: #f2f4f7;
}
.hidden { display: none !important; }
a { cursor: pointer; }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 4px;
  padding: 7px 14px; border: 1px solid #d4d9e0; border-radius: 5px;
  background: #fff; color: #2c3338; cursor: pointer; font-size: 13px;
  transition: all .15s; white-space: nowrap;
}
.btn:hover { border-color: #2f7bff; color: #2f7bff; }
.btn-primary { background: #2f7bff; border-color: #2f7bff; color: #fff; }
.btn-primary:hover { background: #1a66ee; color: #fff; }
.btn-danger { background: #ef4d4d; border-color: #ef4d4d; color: #fff; }
.btn-danger:hover { background: #d93a3a; color: #fff; }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-ghost:hover { background: #eef2f7; color: #2f7bff; }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-block { width: 100%; margin-top: 14px; padding: 9px; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

/* ---------- 登录 ---------- */
.login-page {
  height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #2f7bff 0%, #1647a8 100%);
}
.login-card {
  width: 360px; background: #fff; border-radius: 10px; padding: 34px 32px 26px;
  box-shadow: 0 14px 40px rgba(0,0,0,.22);
}
.login-logo { font-size: 21px; font-weight: 700; color: #1f2a3d; text-align: center; }
.login-sub { color: #8a94a6; text-align: center; margin: 6px 0 22px; font-size: 13px; }
.login-card label { display: block; margin: 14px 0 6px; color: #5a6473; font-size: 13px; }
.login-card input {
  width: 100%; padding: 9px 12px; border: 1px solid #d4d9e0; border-radius: 5px;
  font-size: 14px; outline: none;
}
.login-card input:focus { border-color: #2f7bff; }
.login-tip { text-align: center; color: #a4adbc; margin-top: 14px; font-size: 12px; }

/* ---------- 主框架 ---------- */
.main-app { display: flex; height: 100vh; }
.sidebar { width: 200px; background: #1f2a3d; flex-shrink: 0; display: flex; flex-direction: column; }
.brand {
  color: #fff; font-size: 16px; font-weight: 700; text-align: center;
  padding: 20px 10px; border-bottom: 1px solid rgba(255,255,255,.08);
}
.nav { padding: 10px 0; flex: 1; }
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 12px 24px;
  color: #b9c2d0; font-size: 14px; cursor: pointer; border-left: 3px solid transparent;
}
.nav-item:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav-item.active { background: rgba(47,123,255,.18); color: #fff; border-left-color: #2f7bff; }
.nav-ico { width: 18px; text-align: center; }

.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar {
  height: 56px; background: #fff; border-bottom: 1px solid #e6eaf0;
  display: flex; align-items: center; justify-content: space-between; padding: 0 22px;
}
.topbar-title { font-size: 16px; font-weight: 600; }
.topbar-right { display: flex; align-items: center; gap: 14px; color: #5a6473; }
.content { flex: 1; padding: 18px 22px; overflow: auto; }

/* ---------- 工具条 ---------- */
.panel { background: #fff; border-radius: 8px; box-shadow: 0 1px 3px rgba(20,40,80,.06); }
.toolbar { padding: 14px 16px; display: flex; flex-wrap: wrap; gap: 10px; align-items: center; border-bottom: 1px solid #eef1f5; }
.toolbar .spacer { flex: 1; }
.search-input {
  width: 260px; padding: 7px 12px; border: 1px solid #d4d9e0; border-radius: 5px; outline: none;
}
.search-input:focus { border-color: #2f7bff; }
.adv-filters {
  display: none; gap: 10px; align-items: center; flex-wrap: wrap;
  padding: 12px 16px; background: #f8fafc; border-bottom: 1px solid #eef1f5;
}
.adv-filters.open { display: flex; }
.adv-filters select, .adv-filters input {
  padding: 6px 10px; border: 1px solid #d4d9e0; border-radius: 5px; font-size: 13px; outline: none;
}
.dropdown { position: relative; }
.dropdown-menu {
  display: none; position: absolute; right: 0; top: calc(100% + 6px); z-index: 30;
  background: #fff; border: 1px solid #e2e7ee; border-radius: 6px;
  box-shadow: 0 8px 24px rgba(20,40,80,.14); padding: 8px 0; min-width: 150px;
}
.dropdown-menu.open { display: block; }
.dropdown-menu label {
  display: flex; align-items: center; gap: 8px; padding: 6px 14px;
  cursor: pointer; white-space: nowrap; font-weight: normal;
}
.dropdown-menu label:hover { background: #f2f6fc; }

/* ---------- 表格 ---------- */
.table-wrap { overflow-x: auto; }
table.data-table { width: 100%; border-collapse: collapse; }
.data-table th, .data-table td {
  padding: 10px 12px; border-bottom: 1px solid #eef1f5; text-align: left;
  white-space: nowrap; max-width: 320px; overflow: hidden; text-overflow: ellipsis;
}
.data-table th {
  background: #f8fafc; color: #5a6473; font-weight: 600; font-size: 13px;
  position: relative; user-select: none;
}
.data-table th.sortable { cursor: pointer; }
.data-table th.sortable:hover { color: #2f7bff; }
.data-table th .sort-mark { font-size: 10px; margin-left: 3px; color: #b3bccb; }
.data-table tbody tr:hover { background: #f6f9ff; }
.data-table .cell-copy { position: relative; }
.data-table .copy-ico {
  display: none; margin-left: 5px; color: #9aa5b5; cursor: pointer; font-size: 12px;
}
.data-table td.cell-copy:hover .copy-ico { display: inline; }
.thumb {
  width: 46px; height: 46px; object-fit: cover; border-radius: 4px;
  background: #eef1f5; cursor: pointer; display: block;
}
.thumb-placeholder {
  width: 46px; height: 46px; border-radius: 4px; background: #eef1f5; color: #aab4c2;
  display: flex; align-items: center; justify-content: center; font-size: 12px; cursor: pointer;
}
.badge { padding: 2px 8px; border-radius: 10px; font-size: 12px; }
.badge-role-1 { background: #e8f0ff; color: #2f7bff; }
.badge-role-2 { background: #fff0e6; color: #e8801f; }
.row-empty td { text-align: center; color: #9aa5b5; padding: 46px 0; }

.oplink { color: #2f7bff; cursor: pointer; margin-right: 10px; font-size: 13px; }
.oplink.danger { color: #ef4d4d; }
.oplink:hover { text-decoration: underline; }

/* ---------- 分页 ---------- */
.pagination {
  padding: 12px 16px; display: flex; align-items: center; gap: 6px;
  justify-content: flex-end; color: #5a6473; font-size: 13px;
}
.pagination .pg-info { margin-right: auto; }
.pagination button { min-width: 30px; }
.pagination button.cur { background: #2f7bff; border-color: #2f7bff; color: #fff; }

/* ---------- 弹窗 ---------- */
.modal-mask {
  position: fixed; inset: 0; background: rgba(20,30,50,.45); z-index: 100;
  display: flex; align-items: flex-start; justify-content: center; padding-top: 7vh;
}
.modal {
  background: #fff; border-radius: 8px; width: 560px; max-width: 94vw;
  max-height: 84vh; display: flex; flex-direction: column;
  box-shadow: 0 18px 50px rgba(0,0,0,.25);
}
.modal.modal-lg { width: 820px; }
.modal-header {
  padding: 15px 20px; border-bottom: 1px solid #eef1f5;
  display: flex; justify-content: space-between; align-items: center; font-weight: 600;
}
.modal-close {
  border: none; background: none; font-size: 22px; line-height: 1;
  color: #9aa5b5; cursor: pointer;
}
.modal-close:hover { color: #ef4d4d; }
.modal-body { padding: 20px; overflow-y: auto; }
.modal-footer { padding: 13px 20px; border-top: 1px solid #eef1f5; display: flex; justify-content: flex-end; gap: 10px; }

/* ---------- 表单 ---------- */
.form-row { margin-bottom: 15px; display: flex; align-items: flex-start; }
.form-row > label {
  width: 96px; flex-shrink: 0; padding-top: 8px; color: #5a6473; text-align: right; padding-right: 12px;
}
.form-row .form-ctl { flex: 1; min-width: 0; }
.form-row .req::before { content: "*"; color: #ef4d4d; margin-right: 3px; }
.form-ctl input[type=text], .form-ctl input[type=password], .form-ctl input[type=number],
.form-ctl select, .form-ctl textarea {
  width: 100%; padding: 8px 11px; border: 1px solid #d4d9e0; border-radius: 5px;
  outline: none; font-size: 13px; font-family: inherit;
}
.form-ctl input:focus, .form-ctl select:focus, .form-ctl textarea:focus { border-color: #2f7bff; }
.form-ctl input[readonly] { background: #f4f6f9; color: #7a8494; }
.form-ctl .hint { color: #9aa5b5; font-size: 12px; margin-top: 5px; }
.form-ctl input.warn { border-color: #ef4d4d; }

/* 详情 */
.detail-grid { display: grid; grid-template-columns: 96px 1fr; row-gap: 13px; }
.detail-grid dt { color: #8a94a6; text-align: right; padding-right: 12px; }
.detail-grid dd { color: #2c3338; word-break: break-all; }
.detail-img { max-width: 100%; border-radius: 6px; margin-top: 6px; cursor: zoom-in; }
.radio-line label { margin-right: 18px; cursor: pointer; }
.log-json {
  background: #f6f8fb; border: 1px solid #e6ebf2; border-radius: 5px;
  padding: 8px 10px; font-size: 12px; white-space: pre-wrap; word-break: break-all;
  font-family: Consolas, monospace; max-height: 160px; overflow: auto;
}

/* ---------- Toast ---------- */
#mp-toast-box {
  position: fixed; top: 22px; left: 50%; transform: translateX(-50%);
  z-index: 9999; display: flex; flex-direction: column; gap: 8px; align-items: center;
}
.mp-toast {
  background: rgba(35,45,65,.92); color: #fff; padding: 9px 18px; border-radius: 6px;
  font-size: 13px; box-shadow: 0 6px 18px rgba(0,0,0,.2);
  animation: toastIn .2s ease;
}
.mp-toast-success { background: #2ba471; }
.mp-toast-error { background: #e04b4b; }
.mp-toast.mp-toast-hide { opacity: 0; transition: opacity .4s; }
@keyframes toastIn { from { transform: translateY(-10px); opacity: 0; } to { transform: none; opacity: 1; } }
