:root {
  --bg: #f4f6fa;
  --card: #ffffff;
  --line: #e2e8f2;
  --line-2: #cbd5e6;
  --text: #1c2534;
  --muted: #71809a;
  --brand: #2f6fed;
  --brand-2: #6c4bf0;
  --green: #16a34a;
  --amber: #d97706;
  --red: #dc2626;
  --radius: 12px;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: "Microsoft YaHei", "Segoe UI", system-ui, -apple-system, Arial, sans-serif;
  font-size: 14px;
  line-height: 1.6;
  padding-bottom: 40px;
}

.hidden { display: none !important; }

/* bilingual labels */
.lbl-kk { color: var(--muted); font-weight: 400; }
body.lang-zh .lbl-kk { display: none; }
body.lang-kk .lbl-zh { display: none; }
body.lang-both .lbl-kk::before { content: " / "; }
body.lang-both .lbl-kk { font-size: 0.92em; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 12px 16px;
  background: linear-gradient(120deg, #2f6fed, #6c4bf0);
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 20;
  box-shadow: 0 4px 16px rgba(28, 45, 90, 0.18);
}

.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.logo {
  width: 38px; height: 38px; border-radius: 10px;
  background: rgba(255, 255, 255, 0.2);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; letter-spacing: 1px; flex: 0 0 auto;
}
.title { font-size: 16px; font-weight: 700; }
.subtitle { font-size: 11px; opacity: 0.85; }

.top-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.lang-switch { display: flex; background: rgba(255, 255, 255, 0.16); border-radius: 20px; padding: 2px; }
.lang-switch button {
  border: 0; background: transparent; color: #fff;
  padding: 4px 10px; border-radius: 18px; cursor: pointer; font-size: 12px; font-family: inherit;
}
.lang-switch button.active { background: #fff; color: var(--brand); font-weight: 600; }

.user-box { display: flex; align-items: center; gap: 8px; }
.user-name { font-size: 13px; font-weight: 600; }

.btn {
  border: 1px solid var(--line-2);
  background: #fff;
  color: var(--text);
  border-radius: 9px;
  padding: 8px 14px;
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.15s;
}
.btn:hover { border-color: var(--brand); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 600; }
.btn.primary:hover { background: #255dd0; }
.btn.ghost { background: transparent; border-color: rgba(255, 255, 255, 0.5); color: #fff; }
.btn.ghost:hover { background: rgba(255, 255, 255, 0.15); }
.btn.small { padding: 4px 10px; font-size: 12px; }
.btn.danger { color: var(--red); border-color: #f0c4c4; }
.btn.danger:hover { background: #fdecec; }
.btn.approve { background: var(--green); border-color: var(--green); color: #fff; }
.btn.reject { background: var(--red); border-color: var(--red); color: #fff; }

.tabs {
  display: flex; gap: 6px; padding: 10px 16px 0; flex-wrap: wrap;
  max-width: 1080px; margin: 0 auto;
}
.tab {
  border: 1px solid var(--line);
  background: #fff; color: var(--muted);
  padding: 8px 16px; border-radius: 10px 10px 0 0;
  cursor: pointer; font-size: 13px; font-family: inherit;
  border-bottom: 0;
}
.tab.active { color: var(--brand); font-weight: 700; box-shadow: 0 -3px 0 var(--brand) inset; }

.workspace { max-width: 1080px; margin: 0 auto; padding: 0 16px; }

.view { background: transparent; padding-top: 12px; }

.view-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.view-head h2 { font-size: 17px; margin: 0; }

.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 16px; margin-bottom: 14px;
}
.card h3 { font-size: 15px; margin: 0 0 12px; color: var(--brand); }

.form-section {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 16px; margin-bottom: 14px;
}
.form-section > h3 {
  font-size: 15px; margin: 0 0 14px; padding-bottom: 8px;
  border-bottom: 1px solid var(--line); color: var(--brand);
}

.grid { display: grid; grid-template-columns: 1fr; gap: 12px; }
@media (min-width: 720px) { .grid { grid-template-columns: 1fr 1fr; } .field.full { grid-column: 1 / -1; } }

.field { display: flex; flex-direction: column; gap: 5px; }
.field > label { font-size: 13px; font-weight: 600; }
.field .req { color: var(--red); margin-left: 3px; }
.input, select.input, textarea.input {
  width: 100%; padding: 9px 11px; border: 1px solid var(--line-2);
  border-radius: 9px; font-size: 14px; font-family: inherit;
  background: #fff; color: var(--text); outline: none;
}
.input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(47, 111, 237, 0.12); }
textarea.input { min-height: 84px; resize: vertical; line-height: 1.6; }
.hint { color: var(--muted); font-size: 12px; margin: 4px 0 0; }

.radio-row { display: flex; gap: 16px; flex-wrap: wrap; }
.radio-row label { display: flex; align-items: center; gap: 6px; font-weight: 500; }

.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  border: 1px solid var(--line-2); border-radius: 20px; padding: 5px 12px;
  font-size: 13px; cursor: pointer; user-select: none; background: #fff;
}
.chip.on { background: var(--brand); color: #fff; border-color: var(--brand); }

.upload-box {
  border: 1px dashed var(--line-2); border-radius: 10px; padding: 10px;
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap; background: #fafbfe;
}
.thumb { width: 64px; height: 64px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); }
.file-chip {
  display: inline-flex; align-items: center; gap: 6px; background: #eef3ff;
  border: 1px solid #cfdcfb; border-radius: 8px; padding: 4px 8px; font-size: 12px;
}
.file-chip a { color: var(--brand); text-decoration: none; }

.form-actions { display: flex; gap: 12px; margin: 4px 0 24px; }
.form-actions .btn { flex: 1; padding: 13px; font-size: 15px; }

.filters { display: grid; grid-template-columns: 1fr; gap: 8px; margin-bottom: 10px; }
@media (min-width: 720px) { .filters { grid-template-columns: 2fr 1fr 1fr 1fr; } }
.count { color: var(--muted); font-size: 12px; margin-bottom: 8px; }

.list { display: flex; flex-direction: column; gap: 10px; }
.item {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 12px 14px;
}
.item-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 6px; }
.item-name { font-weight: 700; font-size: 15px; }
.item-meta { color: var(--muted); font-size: 12.5px; display: flex; gap: 12px; flex-wrap: wrap; }
.item-actions { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }

.badge {
  font-size: 11.5px; padding: 2px 9px; border-radius: 20px; font-weight: 600;
}
.badge.pending { background: #fff4e5; color: var(--amber); }
.badge.approved { background: #e7f7ee; color: var(--green); }
.badge.rejected { background: #fdecec; color: var(--red); }
.badge.type { background: #eef3ff; color: var(--brand); }

.empty { text-align: center; color: var(--muted); padding: 36px 12px; }

.manage-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.manage-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.manage-row .input { flex: 1; min-width: 120px; }
.manage-add { display: flex; gap: 8px; flex-wrap: wrap; }
.manage-add.column { flex-direction: column; }
.manage-add .input { flex: 1; min-width: 140px; }

.modal {
  position: fixed; inset: 0; background: rgba(15, 23, 42, 0.55);
  display: flex; align-items: center; justify-content: center; z-index: 60; padding: 16px;
}
.modal-card {
  background: #fff; border-radius: 16px; width: 720px; max-width: 100%;
  max-height: calc(100vh - 40px); display: flex; flex-direction: column; overflow: hidden;
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.3);
}
.modal-card.narrow { width: 380px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.modal-head h3 { margin: 0; font-size: 16px; }
.modal-head .btn.ghost { color: var(--muted); border-color: transparent; font-size: 16px; }
.modal-body { padding: 16px 18px; overflow-y: auto; }
.modal-body label { display: block; font-size: 13px; font-weight: 600; margin: 10px 0 5px; }
.modal-foot { padding: 12px 18px; border-top: 1px solid var(--line); display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }

.detail-row { display: flex; gap: 10px; padding: 6px 0; border-bottom: 1px dashed var(--line); }
.detail-row .k { flex: 0 0 190px; color: var(--muted); font-size: 13px; }
.detail-row .v { flex: 1; word-break: break-word; }
.detail-photos { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 10px; }
.detail-photos img { max-width: 160px; border-radius: 10px; border: 1px solid var(--line); }

.toast {
  position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%);
  background: #1c2534; color: #fff; padding: 11px 20px; border-radius: 10px;
  font-size: 13.5px; z-index: 90; max-width: 80vw; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.28);
}
.toast.err { background: #b91c1c; }
.toast.ok { background: #15803d; }

/* ===== 组织架构图 ===== */
.org { display: flex; flex-direction: column; align-items: center; gap: 14px; }
.org-node { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 10px 16px; display: flex; align-items: center; gap: 10px; box-shadow: 0 2px 8px rgba(20,40,80,.05); }
.org-node.root { background: linear-gradient(120deg,#2f6fed,#6c4bf0); color: #fff; font-weight: 700; border: 0; }
.org-node.site { align-self: stretch; justify-content: space-between; background: #f7f9ff; border-color: #dbe6ff; font-weight: 600; flex-wrap: wrap; }
.org-name { font-size: 15px; }
.org-sub { color: var(--muted); font-size: 12.5px; font-weight: 400; }
.org-count { background: #eef3ff; color: var(--brand); border-radius: 20px; padding: 2px 10px; font-size: 12px; font-weight: 700; }
.org-sites { display: grid; grid-template-columns: 1fr; gap: 14px; width: 100%; }
@media (min-width: 900px) { .org-sites { grid-template-columns: 1fr 1fr; } }
.org-site { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; }
.org-people { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }
.org-person { display: flex; align-items: center; gap: 8px; padding: 7px 10px; border: 1px solid var(--line); border-radius: 9px; cursor: pointer; background: #fff; flex-wrap: wrap; }
.org-person:hover { border-color: var(--brand); background: #f8faff; }
.op-name { font-weight: 600; }
.op-pos { color: var(--muted); font-size: 12.5px; }
.org-empty { color: var(--muted); font-size: 12.5px; text-align: center; padding: 8px; }

/* ===== 统计看板 ===== */
.stats { display: flex; flex-direction: column; gap: 14px; }
.stat-cards { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
@media (min-width: 720px) { .stat-cards { grid-template-columns: repeat(4, 1fr); } }
.stat-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.stat-card .n { font-size: 22px; font-weight: 800; }
.stat-card .l { font-size: 12.5px; color: var(--muted); }
.bar-row { display: flex; align-items: center; gap: 10px; margin: 6px 0; }
.bar-label { flex: 0 0 130px; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-track { flex: 1; height: 14px; background: #eef1f7; border-radius: 8px; overflow: hidden; }
.bar-track i { display: block; height: 100%; background: linear-gradient(90deg, #2f6fed, #6c4bf0); }
.bar-val { flex: 0 0 40px; text-align: right; font-weight: 700; font-size: 13px; }

/* ===== 操作日志 ===== */
.log-list { display: flex; flex-direction: column; gap: 6px; max-height: 420px; overflow: auto; }
.log-row { display: flex; gap: 10px; align-items: center; font-size: 12.5px; padding: 6px 8px; border-bottom: 1px dashed var(--line); flex-wrap: wrap; }
.log-time { color: var(--muted); flex: 0 0 150px; }
.log-actor { font-weight: 600; flex: 0 0 110px; }
.log-action { flex: 0 0 130px; color: var(--brand); }
.log-detail { color: var(--muted); flex: 1; word-break: break-all; }


/* ===== 组织架构图（树形，可展开） ===== */
.org-root { display: flex; justify-content: center; }
.org-trunk { width: 2px; height: 18px; background: #c9d6ee; }
.org-sites { display: grid; grid-template-columns: 1fr; gap: 14px; width: 100%; }
@media (min-width: 900px) { .org-sites { grid-template-columns: 1fr 1fr; } }
.org-site { position: relative; padding-top: 16px; }
.org-site .org-branch { position: absolute; top: 0; left: 50%; width: 2px; height: 16px; background: #c9d6ee; }
.org-node.site { width: 100%; cursor: pointer; border: 1px solid #dbe6ff; background: #f7f9ff; display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: 12px; font-family: inherit; text-align: left; }
.org-node.site:hover { border-color: var(--brand); }
.chev { margin-left: auto; color: var(--brand); transition: transform .18s; font-size: 12px; }
.org-node.site.open .chev { transform: rotate(180deg); }
.org-people { margin-top: 8px; display: flex; flex-direction: column; gap: 6px; }
/* ===== 组织架构树（多层，可折叠） ===== */
.org { display: block; }
.org-branch { position: relative; }
.org-node { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; font-family: inherit; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; cursor: pointer; box-shadow: 0 2px 8px rgba(20,40,80,.05); }
.org-node.root { background: linear-gradient(120deg,#2f6fed,#6c4bf0); color: #fff; border: 0; font-weight: 700; }
.org-node:not(.root):hover { border-color: var(--brand); }
.org-node .org-count { margin-left: auto; }
.org-node.root .org-count { background: rgba(255,255,255,.22); color: #fff; }
.org-node .chev { margin-left: 8px; }
.org-children { margin-left: 18px; padding-left: 16px; border-left: 2px dashed #c9d6ee; margin-top: 8px; display: flex; flex-direction: column; gap: 8px; }
.org-person { display: flex; align-items: center; gap: 8px; padding: 7px 10px; border: 1px solid var(--line); border-radius: 9px; cursor: pointer; background: #fafbfd; flex-wrap: wrap; }
.org-person:hover { border-color: var(--brand); background: #f8faff; }
.org-fixed { flex: 1; min-width: 120px; color: var(--muted); font-size: 13px; }
/* ===== 公开页补充 ===== */
.org-person.clickable { cursor: pointer; }
/* 负责人（主管）排在横条卡下方名单第一位 */
.org-person.leader { background: #eef3ff; border-color: #cfe0ff; font-weight: 700; }
.org-person.leader:hover { border-color: var(--brand); background: #e8efff; }
.leader-badge { background: var(--brand); color: #fff; border-radius: 20px; padding: 1px 9px; font-size: 11px; font-weight: 700; line-height: 1.6; flex: 0 0 auto; }
.block-title { font-size: 15px; color: #2b4a78; margin: 22px 0 10px; padding-bottom: 6px; border-bottom: 2px solid var(--line); }
/* ===== 头像 ===== */
.avatar { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; flex: 0 0 auto; border: 1px solid var(--line); display: inline-flex; align-items: center; justify-content: center; }
.avatar.lg { width: 52px; height: 52px; font-size: 20px; }
.avatar.sm { width: 30px; height: 30px; font-size: 13px; }
.avatar.initials { color: #fff; font-weight: 700; }
.item-emp { display: flex; gap: 12px; align-items: flex-start; }
.item-main { flex: 1; min-width: 0; }
.org-person .avatar.sm { margin-right: 2px; }
.detail-avatar { margin-bottom: 10px; }
/* ===== 薪酬字段 ===== */
.input.calc { background: #f2f6ff; color: var(--brand); font-weight: 700; cursor: default; }
/* ===== 名册右侧薪资 ===== */
.item-emp { flex-wrap: wrap; }
.item-pay { margin-left: auto; min-width: 168px; text-align: right; border-left: 1px dashed var(--line); padding-left: 14px; align-self: stretch; display: flex; flex-direction: column; justify-content: center; gap: 4px; }
.pay-row { display: flex; justify-content: space-between; gap: 12px; font-size: 12.5px; }
.pay-label { color: var(--muted); }
.pay-val { font-weight: 600; font-variant-numeric: tabular-nums; }
.pay-val.strong { color: var(--brand); font-size: 14.5px; font-weight: 800; }
@media (max-width: 640px) {
  .item-pay { margin-left: 0; width: 100%; border-left: 0; border-top: 1px dashed var(--line); padding-left: 0; padding-top: 8px; margin-top: 6px; text-align: left; }
}
/* ===== 统计金额卡 ===== */
.stat-card .n.money { font-size: 19px; letter-spacing: -0.2px; }
.bar-val { min-width: 78px; }
/* ===== 成本卡合计 ===== */
.card h3 .cost-total { float: right; font-weight: 700; color: var(--brand); font-size: 13.5px; }
/* ===== 统计卡片拖动排序 ===== */
.stat-block { position: relative; }
.stat-block.dragging { opacity: .45; }
.stat-block.drop-target { outline: 2px dashed var(--brand); outline-offset: 3px; border-radius: 14px; }
.block-tools { position: absolute; top: 8px; right: 10px; display: flex; align-items: center; gap: 4px; opacity: 0; transition: opacity .15s; z-index: 3; }
.stat-block:hover .block-tools { opacity: 1; }
@media (hover: none) { .block-tools { opacity: .8; } }
.drag-handle { cursor: grab; color: var(--muted); font-size: 15px; line-height: 1; padding: 2px 4px; user-select: none; }
.drag-handle:active { cursor: grabbing; }
.block-tools .tool { width: 26px; height: 24px; padding: 0; border: 1px solid var(--line-2); background: #fff; border-radius: 7px; cursor: pointer; font-size: 11px; line-height: 1; color: var(--muted); }
.block-tools .tool:hover { border-color: var(--brand); color: var(--brand); }
/* ===== 组织架构节点：主体弹联系方式 + 箭头展开 ===== */
.org-node { cursor: default; }
.org-main { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; text-align: left; background: transparent; border: 0; font-family: inherit; font-size: inherit; color: inherit; cursor: pointer; padding: 0; }
.org-main .org-count { margin-left: auto; }
.chev-btn { flex: 0 0 auto; border: 0; background: transparent; color: var(--brand); cursor: pointer; font-size: 13px; padding: 4px 10px; border-radius: 8px; transition: transform .18s; }
.chev-btn:hover { background: rgba(47,111,237,.1); }
.org-node.root .chev-btn { color: #fff; }
.org-node.root .chev-btn:hover { background: rgba(255,255,255,.2); }
.org-node.open .chev-btn { transform: rotate(180deg); }

/* ===== 联系方式弹窗 ===== */
.info-row { display: flex; gap: 10px; padding: 8px 0; border-bottom: 1px dashed var(--line); }
.info-row .k { flex: 0 0 150px; color: var(--muted); font-size: 13px; }
.info-row .v { flex: 1; word-break: break-word; }
.info-row .v a { color: var(--brand); text-decoration: none; }
.info-row .v a:hover { text-decoration: underline; }
.muted { color: var(--muted); }
.org-main.noclick { cursor: default; }
/* ===== 薪酬管理（设置内） ===== */
.pay-list { overflow-x: auto; }
.pay-head, .pay-row2 { display: grid; grid-template-columns: 150px repeat(5, 108px) 104px 104px; gap: 8px; align-items: center; min-width: 880px; }
.pay-head { color: var(--muted); font-size: 12px; font-weight: 600; padding-bottom: 6px; border-bottom: 1px solid var(--line); }
.pay-row2 { padding: 5px 0; border-bottom: 1px dashed var(--line); }
.pay-input { padding: 6px 8px; font-size: 13px; }
.pc-name { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pm-calc { font-size: 13px; font-weight: 600; color: var(--brand); text-align: right; font-variant-numeric: tabular-nums; }
.pm-calc.strong { font-weight: 800; }
/* ===== 上线加固相关 ===== */
.hp-field { position: absolute !important; left: -9999px !important; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.consent-box { background: #f7f9fc; border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; margin-bottom: 12px; }
.consent-box .checkbox { font-size: 14px; }
.info-row .v.strong { font-weight: 800; font-size: 18px; color: var(--brand); }
/* ===== 未保存提醒 ===== */
.warn-hint { color: #b45309; background: #fff7e6; border: 1px solid #ffd591; border-radius: 10px; padding: 9px 13px; margin: 0 0 12px; }
.btn.primary.dirty { box-shadow: 0 0 0 3px rgba(217, 119, 6, .28); }
/* ===== 品牌 Logo ===== */
.logo-chip { width: 48px; height: 48px; border-radius: 11px; background: #fff; display: inline-flex; align-items: center; justify-content: center; overflow: hidden; flex: 0 0 auto; box-shadow: 0 2px 8px rgba(0,0,0,.18); }
.logo-chip img { width: 100%; height: 100%; object-fit: contain; }
.logo-chip.fallback { background: rgba(255,255,255,.22); color: #fff; font-weight: 800; font-size: 17px; letter-spacing: 1px; box-shadow: none; }
/* 二维码/海报页 Logo */
.poster-logo { display: block; margin: 0 auto 10px; max-width: 220px; max-height: 90px; object-fit: contain; }
@media print { .poster-logo { max-width: 90mm; max-height: 34mm; margin-bottom: 8mm; } }