﻿/* 设计师绩效计算管理系统 - 后台样式 */
:root {
  --primary: #2563eb; --primary-dark: #1d4ed8; --bg: #f2f5fa; --card: #ffffff;
  --text: #1f2937; --muted: #6b7280; --line: #e5e7eb;
  --green: #059669; --amber: #d97706; --red: #dc2626;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: "Microsoft YaHei", "PingFang SC", system-ui, sans-serif; background: var(--bg); color: var(--text); font-size: 14px; }
.topbar { position: sticky; top: 0; z-index: 50; background: #fff; border-bottom: 1px solid var(--line); padding: 0 24px; display: flex; align-items: center; gap: 32px; height: 56px; box-shadow: 0 1px 4px rgba(0,0,0,.04); }
.brand { font-size: 17px; font-weight: 700; color: var(--primary); white-space: nowrap; }
.tabs { display: flex; gap: 4px; height: 100%; overflow-x: auto; }
.tabs button { border: 0; background: none; padding: 0 16px; font-size: 14px; color: var(--muted); cursor: pointer; height: 100%; border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs button.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }
main { padding: 20px 24px 60px; max-width: 1400px; margin: 0 auto; }
.tab { display: none; }
.tab.active { display: block; }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 16px; }
.toolbar .grow { flex: 1; }
h2.block-title { font-size: 15px; margin: 24px 0 10px; color: var(--text); }
input, select, textarea { font: inherit; padding: 7px 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--text); outline: none; }
input:focus, select:focus, textarea:focus { border-color: var(--primary); }
input[type="month"] { width: 150px; }
.btn { display: inline-block; font: inherit; padding: 7px 14px; border-radius: 8px; border: 1px solid var(--line); background: #fff; color: var(--text); cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { border-color: var(--primary); color: var(--primary); }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); color: #fff; }
.btn-sm { padding: 4px 10px; font-size: 13px; border-radius: 6px; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.btn-danger { color: var(--red); }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; margin-bottom: 18px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 16px 18px; }
.card .k { color: var(--muted); font-size: 13px; margin-bottom: 6px; }
.card .v { font-size: 24px; font-weight: 700; color: var(--primary); }
.card .v small { font-size: 13px; color: var(--muted); font-weight: 400; }
.table-wrap { background: var(--card); border: 1px solid var(--line); border-radius: 12px; overflow-x: auto; overflow-y: auto; }
table { width: 100%; border-collapse: separate; border-spacing: 0; min-width: 860px; }
th, td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { background: #f8fafc; color: var(--muted); font-weight: 600; font-size: 13px; position: sticky; top: 0; z-index: 1; }
tbody tr:hover { background: #f8faff; }
td.num, th.num { text-align: right; }
tfoot td { font-weight: 700; background: #f8fafc; }
/* 绩效管理表：横向滚动 + 首列(套图编号)冻结 */
#sets-table th:first-child, #sets-table td:first-child {
  position: sticky; left: 0; z-index: 2;
  background: #fff; box-shadow: 2px 0 4px rgba(15,23,42,.06);
}
#sets-table th:first-child { top: 0; z-index: 3; background: #f8fafc; }
#sets-table tbody tr:hover td:first-child { background: #f8faff; }
.badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px; }
.badge.pending { background: #fef3c7; color: #92400e; }
.badge.scored { background: #d1fae5; color: #065f46; }
.badge.off { background: #f3f4f6; color: var(--muted); }
.badge.settle-month { background: #e0f2fe; color: #075985; }
.badge.settle-next { background: #fee2e2; color: #991b1b; }
.badge.settle-done { background: #dcfce7; color: #166534; }
.btn-finish { background: #16a34a; border-color: #16a34a; color: #fff; }
.btn-finish:hover { background: #15803d; border-color: #15803d; }
.radio-group { display: flex; flex-wrap: wrap; gap: 8px 24px; padding: 6px 0; }
.radio-group label { display: flex; align-items: center; gap: 6px; font-weight: 400; margin: 0; }
.form-item .radio-group label { display: flex; align-items: center; gap: 6px; font-weight: 400; margin: 0; color: var(--text); }
.form-item .radio-group input { width: auto; margin: 0; flex: 0 0 auto; }
/* 空间类型多选(设计内容) */
.chk-group { display: flex; flex-wrap: wrap; gap: 8px 18px; padding: 6px 0; }
.form-item .chk-group label { display: flex; align-items: center; gap: 6px; font-weight: 400; margin: 0; color: var(--text); font-size: 14px; cursor: pointer; }
.form-item .chk-group input { width: auto; margin: 0; flex: 0 0 auto; accent-color: var(--primary); }
/* 可搜索下拉面板（长选项列表） */
.ss-panel { position: fixed; z-index: 9999; background: #fff; border: 1px solid var(--line); border-radius: 10px;
  box-shadow: 0 10px 26px rgba(15,23,42,.16); padding: 8px; display: flex; flex-direction: column; }
.ss-input { width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; font-size: 13px; outline: none; margin-bottom: 6px; background: #fff; color: var(--text); }
.ss-input:focus { border-color: var(--primary); }
.ss-list { overflow-y: auto; max-height: 210px; }
.ss-opt { padding: 8px 10px; border-radius: 6px; font-size: 13px; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ss-opt:hover, .ss-opt.active { background: #eef4ff; color: var(--primary); }
.ss-empty { padding: 14px; text-align: center; color: var(--muted); font-size: 13px; }
/* 手机端：全屏搜索层（软键盘弹出也不会关闭/遮挡） */
.ss-sheet { position: fixed; inset: 0; width: auto !important; height: 100%; max-height: 100%;
  border: 0; border-radius: 0; padding: 0; display: flex; flex-direction: column; background: #fff;
  box-shadow: 0 0 40px rgba(15,23,42,.18); }
.ss-sheet .ss-head { display: flex; align-items: center; gap: 10px; padding: 12px 14px;
  border-bottom: 1px solid var(--line); flex: 0 0 auto; }
.ss-sheet .ss-title { flex: 1; font-size: 15px; font-weight: 600; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ss-sheet .ss-cancel { border: 0; background: #f1f5f9; color: var(--text); border-radius: 8px;
  padding: 7px 14px; font-size: 14px; cursor: pointer; }
.ss-sheet .ss-input { margin: 10px 12px 6px; width: calc(100% - 24px); height: 42px; font-size: 16px; flex: 0 0 auto; }
.ss-sheet .ss-list { flex: 1 1 auto; max-height: none; overflow-y: auto; padding: 0 6px calc(16px + env(safe-area-inset-bottom));
  -webkit-overflow-scrolling: touch; }
.ss-sheet .ss-opt { padding: 14px 12px; font-size: 16px; border-radius: 8px; margin-bottom: 2px; }
.ss-sheet .ss-opt.active { background: #eef4ff; }
/* 列表项目名称下方的设计内容小字 */
.cell-sub { font-size: 12px; color: var(--muted); font-weight: 400; margin-top: 3px; line-height: 1.45; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 150px; }
.score-strong { color: var(--primary); font-weight: 700; }
.rules { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 16px 20px; line-height: 1.9; color: var(--text); }
.rules b { color: var(--primary); }
.rules .muted { color: var(--muted); font-size: 13px; }
.empty { padding: 40px; text-align: center; color: var(--muted); }
/* 弹窗 */
.modal-mask { position: fixed; inset: 0; background: rgba(15,23,42,.45); display: flex; align-items: center; justify-content: center; z-index: 100; padding: 16px; }
.modal { background: #fff; border-radius: 14px; width: 480px; max-width: 100%; max-height: 90vh; overflow: auto; padding: 20px 22px; box-shadow: 0 20px 50px rgba(0,0,0,.25); }
.modal-head { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.modal-head h3 { flex: 1; margin: 0; font-size: 16px; color: var(--text); }
.modal-close { flex: 0 0 auto; width: 30px; height: 30px; border: none; background: #f1f5f9; color: #64748b; font-size: 20px; line-height: 1; border-radius: 50%; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: background .15s, color .15s; }
.modal-close:hover { background: #e2e8f0; color: #1e293b; }
.modal h3 { font-size: 16px; margin-bottom: 16px; color: var(--text); }
.modal.wide { width: 560px; }
.form-row { display: flex; gap: 12px; }
.form-item { flex: 1; margin-bottom: 12px; }
.form-item label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 5px; }
.form-item input, .form-item select, .form-item textarea { width: 100%; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 8px; }
/* 分享二维码弹窗 */
.share-box { text-align: center; }
.share-project { font-weight: 700; margin-bottom: 14px; }
.qr-wrap img { width: 220px; height: 220px; border: 1px solid var(--line); border-radius: 10px; padding: 6px; background: #fff; }
.share-link { display: flex; gap: 8px; margin: 14px 0; }
.share-link input { flex: 1; font-size: 12px; color: var(--muted); }
.share-actions { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; margin-bottom: 6px; }
.share-tip { font-size: 12px; color: var(--muted); line-height: 1.8; text-align: left; background: #f8fafc; border-radius: 8px; padding: 10px 12px; margin-top: 10px; }
.share-scored, .share-regen { font-size: 13px; line-height: 1.7; text-align: left; border-radius: 8px; padding: 9px 12px; margin-bottom: 12px; }
.share-scored { background: #fef3c7; color: #92400e; border: 1px solid #fde68a; }
.share-regen { background: #dcfce7; color: #166534; border: 1px solid #bbf7d0; }
/* Toast */
#toast-root { position: fixed; top: 70px; left: 50%; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; }
.toast { background: rgba(15,23,42,.88); color: #fff; padding: 9px 18px; border-radius: 8px; font-size: 13px; animation: fade .2s; }
.toast.err { background: rgba(220,38,38,.92); }
.form-err { display: none; margin: 12px 0 0; padding: 10px 12px; border-radius: 8px; background: #fdeceb; color: #c0392b; font-size: 13px; line-height: 1.6; border: 1px solid #f6c9c5; }
.form-err.show { display: block; }
/* 就地新增甲方面板(新增绩效弹窗内) */
.qc-toggle { font-size: 12px; color: #2f6bed; background: none; border: none; cursor: pointer; padding: 0; margin-left: 8px; font-weight: 400; }
.qc-panel { display: none; border: 1px dashed #d4d9e3; border-radius: 8px; padding: 8px 10px; margin-top: 8px; background: #fafbfd; }
.qc-panel.show { display: block; }
.qc-panel .form-item { margin-bottom: 6px; }
.qc-panel .form-item label { margin-bottom: 3px; }
.qc-panel .radio-group { flex-wrap: nowrap; padding: 2px 0; gap: 8px 18px; }
.qc-title { font-size: 13px; font-weight: 600; margin-bottom: 6px; color: #333; }
.qc-btns { display: flex; gap: 8px; justify-content: flex-end; margin-top: 4px; }
.qc-btns .btn { padding: 6px 14px; font-size: 13px; flex: 0 0 auto; }
@keyframes fade { from { opacity: 0; transform: translateY(-6px); } }
/* 绩效参数设置 */
.set-block { margin-bottom: 8px; }
.set-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 16px; }
.set-card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 16px 18px; }
.set-card h3 { font-size: 14px; color: var(--text); margin-bottom: 6px; }
.set-note { font-size: 12px; color: var(--muted); line-height: 1.7; margin-bottom: 12px; }
.set-formula { font-size: 12px; color: #475569; line-height: 1.8; margin-bottom: 12px; padding: 8px 12px; background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 8px; }
.set-formula b { color: #1e40af; }
.set-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px 14px; margin-bottom: 10px; }
.set-fields label { display: block; font-size: 13px; color: var(--muted); }
.set-fields label span { display: block; margin-bottom: 5px; }
.set-fields input { width: 100%; }
.set-preview { background: #eff6ff; border-radius: 8px; padding: 9px 12px; font-size: 12px; color: #1e40af; line-height: 1.7; margin-top: 10px; }
table.mini { width: 100%; min-width: 0; border-collapse: collapse; margin-bottom: 10px; table-layout: fixed; }
table.mini th { font-size: 12px; color: var(--muted); text-align: left; font-weight: 400; padding: 4px 6px 4px 0; }
table.mini td { padding: 3px 6px 3px 0; }
table.mini td.ctr, table.mini th.ctr { text-align: center; padding-right: 0; }
table.mini th:last-child { width: 64px; }
table.mini input { width: 100%; min-width: 0; box-sizing: border-box; }
.btn-xs { font-size: 12px; padding: 3px 9px; border-radius: 6px; }

/* 栏目权限勾选区 */
.perm-grid { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.perm-row { display: flex; align-items: center; gap: 14px; padding: 9px 12px; border-bottom: 1px solid var(--line); font-size: 14px; }
.perm-row:last-child { border-bottom: 0; }
.perm-name { flex: 1; font-weight: 500; }
.perm-opt { display: flex; align-items: center; gap: 4px; color: var(--text); cursor: pointer; white-space: nowrap; min-width: 62px; }
.perm-opt input { width: 16px; height: 16px; accent-color: var(--primary); margin: 0; padding: 0; }
.perm-na { color: var(--muted); font-size: 12px; min-width: 62px; text-align: center; }
.perm-note { font-size: 12px; color: var(--muted); line-height: 1.7; background: #f8fafc; border-radius: 8px; padding: 8px 10px; margin-top: 8px; }

/* 用户区（右上角） */
.user-area { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.user-name { font-size: 13px; color: var(--muted); }

/* 登录遮罩层 */
.login-mask { position: fixed; inset: 0; z-index: 9999; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #1e3a8a 0%, #2563eb 50%, #3b82f6 100%); }
.login-box { width: 380px; background: #fff; border-radius: 16px; padding: 36px 32px 32px; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.login-title { font-size: 20px; font-weight: 700; color: var(--primary); text-align: center; margin-bottom: 4px; }
.login-sub { font-size: 13px; color: var(--muted); text-align: center; margin-bottom: 24px; }
.login-field { margin-bottom: 16px; }
.login-field label { display: block; font-size: 13px; color: var(--text); margin-bottom: 6px; font-weight: 500; }
.login-field input { width: 100%; padding: 10px 12px; font-size: 14px; }
.login-btn { width: 100%; padding: 11px; font-size: 15px; font-weight: 600; margin-top: 8px; }
.login-err { color: var(--red); font-size: 13px; text-align: center; margin-top: 12px; min-height: 18px; }
.brand .brand-short { display: none; }

/* ================= 手机端适配（≤768px） ================= */
@media (max-width: 768px) {
  html { -webkit-text-size-adjust: 100%; }
  body { -webkit-tap-highlight-color: transparent; font-size: 14px; }
  /* 输入框 16px 防止 iOS 聚焦自动放大 */
  input, select, textarea, button { font-size: 16px; }

  /* 栏目权限勾选区：名称独占一行，三个勾选项平分 */
  .perm-row { flex-wrap: wrap; gap: 8px 10px; }
  .perm-name { flex: 0 0 100%; }
  .perm-opt, .perm-na { flex: 1; min-width: 0; justify-content: flex-start; }
  .perm-na { display: none; }

  /* 顶栏：第一行标题+用户区，第二行页签横向滚动 */
  .topbar { flex-wrap: wrap; height: auto; padding: 10px 14px 0; gap: 6px 10px; box-shadow: 0 1px 6px rgba(0,0,0,.06); }
  .brand { font-size: 16px; }
  .brand .brand-full { display: none; }
  .brand .brand-short { display: inline; }
  .user-area { gap: 8px; }
  .user-area .btn { min-height: 30px; }
  .tabs { order: 3; width: 100%; height: 44px; margin: 4px -14px 0; padding: 0 14px; gap: 2px;
    -webkit-overflow-scrolling: touch; scrollbar-width: none; }
  .tabs::-webkit-scrollbar { display: none; }
  .tabs button { height: 44px; padding: 0 14px; font-size: 14px; }

  main { padding: 12px 12px calc(70px + env(safe-area-inset-bottom)); }

  /* 工具条 */
  .toolbar { gap: 8px; margin-bottom: 12px; }
  .toolbar .grow { flex: 0 0 100%; }
  .toolbar input, .toolbar select { flex: 1 1 130px; min-width: 0; }
  input[type="month"] { width: auto; }
  .toolbar .btn { min-height: 38px; padding: 8px 14px; }
  .toolbar .btn-primary { flex: 1 1 auto; min-width: 120px; }

  h2.block-title { font-size: 14px; margin: 18px 0 8px; }

  /* KPI 卡片两列 */
  .cards { grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 14px; }
  .card { padding: 12px 14px; border-radius: 10px; }
  .card .k { font-size: 12px; margin-bottom: 4px; }
  .card .v { font-size: 20px; }

  /* 表格 → 卡片列表 */
  .table-wrap { border-radius: 10px; }
  .table-wrap table { min-width: 0; }
  .table-wrap thead { display: none; }
  .table-wrap tbody tr { display: block; background: #fff; border-bottom: 8px solid var(--bg); }
  .table-wrap tbody tr:hover { background: #fff; }
  .table-wrap tbody td { display: flex; align-items: center; justify-content: flex-end; gap: 10px;
    padding: 8px 14px; border-bottom: 1px solid #f1f5f9; white-space: normal; word-break: break-word; text-align: right; }
  .table-wrap tbody td::before { content: attr(data-label); margin-right: auto; color: var(--muted);
    font-size: 12px; text-align: left; flex-shrink: 0; }
  .table-wrap tbody td:first-child { font-weight: 600; padding-top: 10px; }
  .table-wrap tbody td .btn { min-height: 32px; }
  .table-wrap .empty { padding: 28px 16px; }
  .table-wrap tfoot { display: block; }
  .table-wrap tfoot tr { display: block; padding: 10px 14px; }
  .table-wrap tfoot td { display: flex; align-items: center; justify-content: flex-end; gap: 10px;
    padding: 3px 0; white-space: normal; }
  .table-wrap tfoot td::before { content: attr(data-label); margin-right: auto; color: var(--muted); font-size: 12px; }
  .table-wrap tfoot td:empty { display: none; }

  .rules { padding: 12px 14px; font-size: 13px; line-height: 1.8; border-radius: 10px; }

  /* 弹窗：底部弹层 */
  .modal-mask { padding: 0; align-items: flex-end; }
  .modal, .modal.wide { width: 100%; max-width: 560px; margin: 0 auto; border-radius: 16px 16px 0 0;
    max-height: 92vh; padding: 18px 16px calc(20px + env(safe-area-inset-bottom)); }
  .modal h3 { font-size: 16px; }
  .form-row { flex-direction: column; gap: 0; }
  .modal-foot { gap: 8px; }
  .modal-foot .btn { flex: 1; min-height: 42px; padding: 10px; }

  /* 二维码分享 */
  .qr-wrap img { width: 100%; max-width: 200px; height: auto; }
  .share-link { flex-direction: column; }
  .share-link .btn { width: 100%; min-height: 38px; }

  /* 参数设置 */
  .set-grid { grid-template-columns: 1fr; gap: 12px; }
  .set-card { padding: 14px; border-radius: 10px; }
  .set-fields { grid-template-columns: 1fr 1fr; gap: 10px; }

  /* 登录页 */
  .login-box { width: calc(100vw - 40px); max-width: 380px; padding: 28px 24px; }

  #toast-root { top: 60px; }
}

@media (max-width: 380px) {
  .user-name { display: none; }
}
