/* ==================== 优选工匠管理平台 - 公共样式 ==================== */
:root {
  --bg: #f7fbfa;
  --bg2: #ffffff;
  --ink: #17212b;
  --muted: #718096;
  --rule: #dcebe7;
  --accent: #1aa88a;
  --accent2: #79d4c4;
  --soft: #eefaf7;
  --soft2: #f4f8fb;
  --warn: #f5a623;
  --danger: #ef6f6c;
  --info: #4a90d9;
  --shadow: rgba(26,168,138,.12);
  --glass: rgba(255,255,255,.78);
  --side-w: 220px;
  --topbar-h: 56px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", "PingFang SC", sans-serif;
  --mono: "SFMono-Regular", Consolas, monospace;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(circle at 12% 18%, rgba(121,212,196,.32), transparent 26rem),
    radial-gradient(circle at 88% 12%, rgba(26,168,138,.13), transparent 28rem),
    linear-gradient(180deg, var(--bg), #f9fbfd 58%, #ffffff);
  background-attachment: fixed;
}
button, input, textarea, select { font-family: inherit; }
button { cursor: pointer; }
a { text-decoration: none; color: inherit; }

/* ==================== 顶部导航条（后台） ==================== */
.nav-top {
  position: fixed; top: 0; left: 0; right: 0; z-index: 50;
  height: var(--topbar-h); display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px;
  background: rgba(255,255,255,.92);
  border-bottom: 1px solid var(--rule);
  backdrop-filter: blur(16px);
}
.nav-top .nav-brand {
  display: flex; align-items: center; gap: 10px;
  font-weight: 800; font-size: 16px;
}
.nav-top .nav-brand .logo {
  width: 34px; height: 34px; border-radius: 10px;
  display: grid; place-items: center;
  color: #fff; font-size: 16px; font-weight: 800;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  box-shadow: 0 6px 16px var(--shadow);
}
.nav-top .nav-brand .logo-img {
  width: 34px; height: 34px; border-radius: 10px;
  object-fit: cover;
  box-shadow: 0 6px 16px var(--shadow);
}
.nav-top .nav-user {
  display: flex; align-items: center; gap: 12px;
  font-size: 13px; color: var(--muted);
}
.nav-top .nav-user .nav-top .nav-back {
  font-size: 13px; color: var(--muted);
  border: 1px solid var(--rule); border-radius: 999px;
  padding: 6px 14px; background: var(--bg2);
  transition: .18s;
}
.nav-top .nav-back:hover { color: var(--accent); border-color: var(--accent); }

/* ==================== 页面容器（PC全屏布局） ==================== */
.page-wrapper {
  min-height: 100vh; padding-top: var(--topbar-h);
  display: flex; align-items: stretch; justify-content: stretch;
}
.page-wrapper.center { align-items: center; justify-content: center; }

/* ==================== 登录页 ==================== */
.login-wrap {
  min-height: 100vh; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 40px 20px 20px;
  position: relative;
}
.login-card {
  width: 100%; max-width: 420px;
  background: rgba(255,255,255,.92);
  border: 1px solid var(--rule);
  border-radius: 24px;
  padding: 40px 34px 32px;
  box-shadow: 0 28px 80px rgba(23,33,43,.12);
  backdrop-filter: blur(14px);
}
.login-logo {
  display: flex; align-items: center; justify-content: center; gap: 12px;
  margin-bottom: 6px;
}
.login-logo .logo {
  width: 52px; height: 52px; border-radius: 16px;
  display: grid; place-items: center;
  color: #fff; font-size: 24px; font-weight: 800;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  box-shadow: 0 12px 28px var(--shadow);
}
.login-logo .logo-img {
  width: 64px; height: 64px; border-radius: 16px;
  object-fit: cover;
  box-shadow: 0 12px 28px var(--shadow);
}
.login-logo b { font-size: 22px; font-weight: 800; }
.login-sub {
  text-align: center; color: var(--muted); font-size: 13px;
  margin: 4px 0 28px;
}
.login-form { display: grid; gap: 16px; }
.login-form .field { display: grid; gap: 6px; }
.login-form .field label { font-size: 13px; color: var(--muted); font-weight: 600; }
.login-form .field input {
  width: 100%; height: 46px;
  border: 1px solid var(--rule); border-radius: 12px;
  background: var(--bg2); padding: 0 14px;
  color: var(--ink); font-size: 14px;
  transition: .15s;
}
.login-form .field input:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(26,168,138,.12);
}
.login-form .btn-primary {
  height: 46px; margin-top: 6px;
  font-size: 15px; letter-spacing: 1px;
}
.login-error {
  color: var(--danger); font-size: 13px;
  text-align: center; min-height: 18px;
}
.login-footer {
  margin-top: 28px; text-align: center;
  color: var(--muted); font-size: 12px; line-height: 1.9;
}
.login-footer b { color: var(--ink); font-weight: 600; }

/* ==================== 后台全屏布局（铺开） ==================== */
.admin-shell {
  flex: 1; min-height: calc(100vh - var(--topbar-h));
  display: grid; grid-template-columns: var(--side-w) 1fr;
}
.side {
  border-right: 1px solid var(--rule);
  background: #fbfffd;
  padding: 16px 12px;
  overflow-y: auto;
  position: sticky; top: var(--topbar-h);
  height: calc(100vh - var(--topbar-h));
}
.side-title {
  font-weight: 800; margin: 0 0 14px; font-size: 15px;
  padding: 0 8px;
}
.side-group {
  font-size: 11px; color: var(--muted);
  text-transform: uppercase; letter-spacing: .05em;
  margin: 16px 0 6px; padding-left: 12px;
}
.side a {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; color: var(--muted);
  border-radius: 10px; font-size: 14px;
  text-decoration: none; margin-bottom: 2px;
  cursor: pointer; transition: .15s;
}
.side a .side-icon {
  width: 20px; text-align: center; font-size: 16px; flex-shrink: 0;
}
.side a.active {
  color: var(--accent); background: var(--soft); font-weight: 700;
}
.side a:hover:not(.active) { background: var(--soft2); color: var(--ink); }

.admin-main {
  min-width: 0; overflow: visible;
  padding: 24px 28px;
  background: linear-gradient(180deg, #ffffff, #f7fbfa);
}
.admin-head {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 20px; gap: 16px;
}
.admin-head .header-right { margin-left: auto; flex-shrink: 0; display: flex; justify-content: flex-end; }
.admin-head > div:not(.header-right) { flex: 1; }
.admin-head h3 { margin: 0 0 5px; font-size: 22px; }
/* admin-head 用户信息 */
.admin-head .header-right { display: flex; align-items: center; }
.admin-head .user-info { display: flex; align-items: center; gap: 12px; }
.user-info .avatar { width: 34px; height: 34px; border-radius: 50%; background: linear-gradient(135deg, #2ba672, #3dc98a); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 14px; font-weight: 600; }
.user-info .user-name { font-size: 14px; color: var(--ink); font-weight: 500; }
.user-info .user-info .btn-logout:hover { color: var(--danger); border-color: var(--danger); }
.admin-head .user-info .avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: linear-gradient(135deg, #2563eb, #0891b2);
  color: #fff; font-weight: 700; font-size: 14px;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 2px 8px rgba(37, 99, 235, .25);
}
.admin-head .user-info .user-name { font-size: 14px; color: var(--ink); font-weight: 600; }
.admin-head .user-info .admin-head .user-info .btn-logout:hover {
  color: var(--danger); border-color: var(--danger); background: #fff5f5;
}
.stats {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px; margin-bottom: 16px;
}
.stat {
  border: 1px solid var(--rule); background: rgba(255,255,255,.86);
  border-radius: 16px; padding: 16px;
}
.stat b { display: block; font-size: 24px; margin-bottom: 4px; }
.stat span { color: var(--muted); font-size: 13px; }
.stat.escrow b { color: #8b5cf6; }

.admin-table {
  border: 1px solid var(--rule); border-radius: 16px;
  overflow: auto; background: var(--bg2);
}
.admin-table .tr { display: grid; min-width: 700px; }
.admin-table .tr > div {
  padding: 12px 14px; border-bottom: 1px solid var(--rule);
  font-size: 13px; color: var(--muted);
  display: flex; align-items: center;
}
.admin-table .tr.head > div {
  color: var(--ink); font-weight: 800; background: var(--soft2);
  position: sticky; top: 0;
}
.admin-table .tr:last-child > div { border-bottom: 0; }

/* ==================== 文档卡片 ==================== */
.doc-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px; margin: 16px 0;
}
.doc-card {
  border: 1px solid var(--rule); border-radius: 20px; padding: 18px;
  background: rgba(255,255,255,.78);
  box-shadow: 0 12px 28px rgba(23,33,43,.04);
}
.doc-card h3 { margin: 0 0 10px; font-size: 17px; }
.doc-card p { color: var(--muted); line-height: 1.7; font-size: 14px; }

/* ==================== 卡片与组件 ==================== */
.card { border: 1px solid var(--rule); background: rgba(255,255,255,.84); border-radius: 20px; padding: 16px; box-shadow: 0 14px 34px rgba(23,33,43,.05); }
.order-card { margin-bottom: 12px; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.row + .row { margin-top: 9px; }
.muted { color: var(--muted); }
.tag { display: inline-flex; align-items: center; min-height: 24px; border-radius: 999px; padding: 3px 10px; font-size: 12px; color: var(--accent); background: var(--soft); white-space: nowrap; }
.tag.warn { color: var(--warn); background: #fff7e8; }
.tag.done { color: #3c8d66; background: #effaf2; }
.tag.danger { color: var(--danger); background: #fff0f0; }
.tag.info { color: var(--info); background: #eaf4fc; }
.tag.escrow { color: #8b5cf6; background: #f5f0ff; }

.btn-primary { border: 0; background: linear-gradient(135deg, var(--accent), var(--accent2)); color: #fff; border-radius: 12px; padding: 10px 16px; font-weight: 700; box-shadow: 0 12px 24px var(--shadow); }
.btn-ghost { border: 1px solid var(--rule); background: var(--bg2); color: var(--ink); border-radius: 12px; padding: 10px 14px; font-weight: 700; }
.btn-warn { border: 0; background: linear-gradient(135deg, var(--warn), #ffc966); color: #fff; border-radius: 12px; padding: 10px 14px; font-weight: 700; }
.btn-danger { border: 1px solid var(--danger); background: #fff0f0; color: var(--danger); border-radius: 12px; padding: 10px 14px; font-weight: 700; }

.form { display: grid; gap: 12px; }
.field label { display: block; margin: 0 0 6px; color: var(--muted); font-size: 13px; }
.input-like { width: 100%; min-height: 42px; border: 1px solid var(--rule); border-radius: 12px; background: var(--bg2); padding: 11px 12px; color: var(--ink); font-size: 14px; }
.textarea-like { min-height: 82px; line-height: 1.5; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { border: 1px solid var(--rule); background: var(--bg2); border-radius: 999px; padding: 7px 12px; font-size: 13px; color: var(--muted); }
.chip.active { border-color: transparent; color: var(--accent); background: var(--soft); font-weight: 700; }

.avatar { width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; color: #fff; background: linear-gradient(135deg, var(--accent), var(--accent2)); font-weight: 800; font-size: 18px; }
.avatar.sm { width: 36px; height: 36px; border-radius: 12px; font-size: 14px; }
.rating { color: var(--warn); letter-spacing: 1px; }

.section-title { display: flex; justify-content: space-between; align-items: center; margin: 20px 0 10px; font-size: 15px; font-weight: 800; }
.section-title small { color: var(--muted); font-weight: 500; }

/* ==================== 响应式 ==================== */
@media (max-width: 1100px) {
  :root { --side-w: 190px; }
  .admin-main { padding: 20px; }
  .stats { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
}
@media (max-width: 760px) {
  :root { --side-w: 64px; }
  .side a { justify-content: center; padding: 12px 8px; }
  .side a span:not(.side-icon) { display: none; }
  .side-group, .side-title { display: none; }
  .admin-main { padding: 16px; }
}
@media (max-width: 480px) {
  .admin-shell { grid-template-columns: 1fr; }
  .side { display: none; }
  .login-card { padding: 30px 22px; }
}

/* ==================== CRUD组件样式 ==================== */
.crud-toolbar {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 14px; gap: 12px; flex-wrap: wrap;
}
.crud-toolbar h4 { margin: 0; font-size: 16px; }
.crud-toolbar .toolbar-right { display: flex; gap: 8px; align-items: center; }
.search-input {
  height: 36px; border: 1px solid var(--rule); border-radius: 10px;
  background: var(--bg2); padding: 0 12px; font-size: 13px; width: 200px;
}
.search-input:focus { outline: none; border-color: var(--accent); }

/* 工种列表（按类别分组） */
.category-section {
  border: 1px solid var(--rule); border-radius: 16px;
  background: var(--bg2); margin-bottom: 18px; overflow: hidden;
}
.category-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 18px; background: var(--soft2);
  border-bottom: 1px solid var(--rule);
}
.category-header h4 { margin: 0; font-size: 17px; display: flex; align-items: center; gap: 8px; }
.category-header .cat-badge {
  font-size: 12px; color: var(--accent); background: var(--soft);
  padding: 2px 8px; border-radius: 999px;
}
.category-body { padding: 6px 0; }
.job-row {
  display: grid; grid-template-columns: 60px 1fr 80px 110px 110px 140px 160px;
  align-items: center; gap: 12px;
  padding: 10px 18px; border-bottom: 1px solid var(--rule);
  transition: .15s;
}
.job-row:last-child { border-bottom: 0; }
.job-row:hover { background: var(--soft2); }
.job-row .job-sort { color: var(--muted); font-size: 13px; text-align: center; }
.job-row .job-id { color: var(--accent); font-size: 13px; font-weight: 600; }
.job-row .job-time { color: var(--muted); font-size: 12px; }
.job-row .job-name { font-weight: 600; font-size: 14px; }
.job-row .job-ops { display: flex; gap: 6px; }
.job-row .job-ops button {
  border: 1px solid var(--rule); background: var(--bg2);
  border-radius: 8px; padding: 5px 10px; font-size: 12px;
  color: var(--muted); cursor: pointer; transition: .15s;
}
.job-row .job-ops button:hover { color: var(--accent); border-color: var(--accent); }
.job-row .job-ops button.danger:hover { color: var(--danger); border-color: var(--danger); }
.empty-tip { padding: 24px; text-align: center; color: var(--muted); font-size: 13px; }

/* 弹窗 */
.modal-mask {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(23,33,43,.45);
  display: flex; align-items: center; justify-content: center;
  backdrop-filter: blur(4px);
}
.modal {
  width: 100%; max-width: 460px;
  background: var(--bg2); border-radius: 18px;
  box-shadow: 0 28px 80px rgba(23,33,43,.24);
  overflow: hidden;
}
.modal-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 16px 20px; border-bottom: 1px solid var(--rule);
}
.modal-head h3 { margin: 0; font-size: 17px; }
.modal-head .close {
  border: 0; background: transparent; font-size: 22px;
  color: var(--muted); cursor: pointer; line-height: 1;
}
.modal-body { padding: 20px; }
.modal-body .form { gap: 14px; }
.modal-body .field label { font-size: 13px; }
.modal-body .field input:not([type=checkbox]):not([type=radio]), .modal-body .field select {
  width: 100%; height: 42px; border: 1px solid var(--rule);
  border-radius: 10px; background: var(--bg2); padding: 0 12px;
  font-size: 14px; color: var(--ink);
}
.modal-body .field input:not([type=checkbox]):not([type=radio]):focus, .modal-body .field select:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(26,168,138,.12);
}
.modal-body .field textarea {
  width: 100%; min-height: 72px; border: 1px solid var(--rule);
  border-radius: 10px; background: var(--bg2); padding: 10px 12px;
  font-size: 13px; color: var(--ink); line-height: 1.5;
  box-sizing: border-box; resize: vertical; font-family: inherit;
}
.modal-body .field textarea:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(26,168,138,.12);
}
.modal-body .switch-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 0;
}
.modal-body .switch-row label { font-size: 13px; color: var(--muted); }
.modal-body .switch {
  position: relative; width: 42px; height: 24px;
  background: #d8dee5; border-radius: 999px; cursor: pointer;
  transition: .18s;
}
.modal-body .switch.on { background: var(--accent); }
.modal-body .switch::after {
  content: ""; position: absolute; top: 2px; left: 2px;
  width: 20px; height: 20px; border-radius: 50%; background: #fff;
  transition: .18s;
}
.modal-body .switch.on::after { left: 20px; }
.modal-foot {
  display: flex; justify-content: flex-end; gap: 10px;
  padding: 14px 20px; border-top: 1px solid var(--rule);
  background: var(--soft2);
}
.modal-foot button { padding: 9px 18px; font-size: 14px; }

/* Toast */
.toast {
  position: fixed; top: 70px; left: 50%; transform: translateX(-50%);
  z-index: 200; padding: 12px 22px; border-radius: 12px;
  font-size: 14px; color: #fff; font-weight: 600;
  box-shadow: 0 12px 28px rgba(23,33,43,.18);
  animation: toastIn .25s;
}
.toast.success { background: var(--accent); }
.toast.error { background: var(--danger); }
@keyframes toastIn { from { opacity: 0; transform: translateX(-50%) translateY(-10px); } to { opacity: 1; transform: translateX(-50%) translateY(0); } }

/* 启用状态徽章 */
.status-on { color: var(--accent); }
.status-off { color: var(--muted); }


/* ==================== 运营配置页面 ==================== */
.config-section {
  border: 1px solid var(--rule);
  border-radius: 14px;
  padding: 16px 18px;
  margin-bottom: 16px;
  background: var(--soft2);
}
.config-group-title {
  font-size: 14px;
  font-weight: 800;
  color: var(--accent);
  margin-bottom: 14px;
  padding-bottom: 8px;
  border-bottom: 1px dashed var(--rule);
}
.config-field {
  display: grid;
  gap: 4px;
}
.config-field label {
  font-size: 13px;
  color: var(--ink);
  font-weight: 600;
}
.config-field input,
.config-field textarea {
  width: 100%;
  height: 40px;
  border: 1px solid var(--rule);
  border-radius: 10px;
  background: var(--bg2);
  padding: 0 12px;
  font-size: 14px;
  color: var(--ink);
  transition: .15s;
}
.config-field textarea {
  height: auto;
  min-height: 150px;
  padding: 10px 12px;
  line-height: 1.7;
  resize: vertical;
}
.config-field input:focus,
.config-field textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(26,168,138,.12);
}
.config-field input[readonly] {
  background: var(--soft2);
  cursor: not-allowed;
  color: var(--muted);
}
.config-field textarea[readonly] {
  background: var(--soft2);
  cursor: not-allowed;
  color: var(--muted);
}
/* ==================== 权限分配（纯文字点击选择，无checkbox） ==================== */
.perm-block {
  border: 1px solid var(--rule);
  border-radius: 8px;
  margin-bottom: 8px;
  overflow: hidden;
}
.perm-block-title {
  display: flex; justify-content: space-between; align-items: center;
  padding: 6px 10px; background: var(--soft2);
  border-bottom: 1px solid var(--rule);
  font-size: 12px; font-weight: 600; color: var(--ink);
  line-height: 1.5;
}
.perm-checkall {
  font-weight: 400; font-size: 12px; color: var(--accent);
  display: inline-flex; align-items: center; gap: 3px; cursor: pointer;
  padding: 1px 8px; border-radius: 999px;
  background: transparent; border: 1px solid transparent;
  transition: .15s;
  user-select: none;
}
.perm-checkall:hover { background: var(--soft); border-color: var(--soft); }
.perm-checkall.active {
  background: var(--soft); border-color: rgba(26,168,138,.28);
  color: var(--accent);
}
.perm-block-body {
  display: flex; flex-wrap: wrap;
  gap: 4px 8px;
  padding: 8px 10px;
  margin: 0;
  line-height: 1.4;
}
.perm-item {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 3px 10px; margin: 0;
  border-radius: 6px;
  background: var(--bg2);
  border: 1px solid var(--rule);
  font-size: 12px;
  line-height: 1.4;
  cursor: pointer;
  white-space: nowrap;
  color: var(--muted);
  transition: .12s;
  user-select: none;
}
.perm-item:hover {
  color: var(--accent); border-color: rgba(26,168,138,.25);
}
.perm-item.on {
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  border-color: transparent;
  font-weight: 500;
  box-shadow: 0 2px 6px rgba(26,168,138,.22);
}
.perm-item span { padding: 0; margin: 0; pointer-events: none; }

/* ==================== admin-head 内按钮 ==================== */
.admin-head .btn-primary { flex-shrink: 0; }
.admin-head > button { flex-shrink: 0; }
/* nav-top 用户信息 */
.nav-user .user-info { display: flex; align-items: center; gap: 12px; }
.nav-user .avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: linear-gradient(135deg, #2ba672, #3dc98a);
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 600;
}
.nav-user .user-name { font-size: 14px; color: var(--ink); font-weight: 500; }
.nav-user .btn-logout {
  border: 1px solid var(--rule); background: #fff; color: var(--muted);
  border-radius: 8px; padding: 5px 12px; font-size: 12px; cursor: pointer;
  transition: all .15s;
}
.nav-user .btn-logout:hover { color: var(--danger); border-color: var(--danger); }
