/* 真灵工 SaaS 前端复刻 — 视觉规范：云锐蓝 #0A00B4 / 生长绿 #93D500 / 未来蓝 #0F78F5 */
:root {
  --zl-blue: #0A00B4;
  --zl-blue-hover: #2b1fd6;
  --zl-blue-soft: #eceaff;
  --zl-green: #93D500;
  --zl-green-deep: #5b8c00;
  --zl-sky: #0F78F5;
  --topbar-h: 56px;
  --sidebar-w: 208px;
  --sidebar-bg: #0d0a3c;
  --sidebar-bg-2: #12104d;
  --content-bg: #f2f4f8;
  --card-bg: #ffffff;
  --line: #e8eaf0;
  --text-1: #1f2430;
  --text-2: #5c6472;
  --text-3: #9aa1ad;
  --ok: #5b8c00;
  --ok-bg: #f4fbe3;
  --ok-line: #d8f09a;
  --warn: #d46b08;
  --warn-bg: #fff7e6;
  --warn-line: #ffd591;
  --err: #cf1322;
  --err-bg: #fff1f0;
  --err-line: #ffa39e;
  --gray: #6b7280;
  --gray-bg: #f2f3f5;
  --gray-line: #d9dce1;
  --radius: 8px;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  font-family: "Work Sans", "Source Han Sans CN", "思源黑体 CN", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 13px; color: var(--text-1); background: var(--content-bg);
}
a { color: var(--zl-sky); text-decoration: none; cursor: pointer; }
button { font-family: inherit; }

/* ---------- topbar ---------- */
.topbar {
  position: fixed; top: 0; left: 0; right: 0; height: var(--topbar-h); z-index: 60;
  background: linear-gradient(90deg, var(--zl-blue) 0%, #150ac9 60%, #1d12e0 100%);
  display: flex; align-items: center; padding: 0 20px 0 16px; color: #fff;
}
.topbar .logo { height: 30px; display: block; }
.topbar .spacer { flex: 1; }
.topbar .titem {
  display: inline-flex; align-items: center; gap: 6px; margin-left: 22px; color: rgba(255,255,255,.92);
  font-size: 13px; cursor: pointer; position: relative; white-space: nowrap;
}
.topbar .titem:hover { color: #fff; }
.topbar .titem svg { width: 15px; height: 15px; }
.topbar .badge-dot {
  position: absolute; top: -7px; right: -12px; background: #ff4d4f; color: #fff; border-radius: 9px;
  font-size: 11px; line-height: 15px; padding: 0 4px; min-width: 15px; text-align: center;
}
.topbar .company { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.topbar .avatar {
  width: 26px; height: 26px; border-radius: 50%; background: rgba(255,255,255,.22);
  display: inline-flex; align-items: center; justify-content: center; margin-left: 22px;
}
.topbar .avatar svg { width: 15px; height: 15px; }

/* ---------- sidebar ---------- */
.sidebar {
  position: fixed; top: var(--topbar-h); left: 0; bottom: 0; width: var(--sidebar-w); z-index: 50;
  background: var(--sidebar-bg); overflow-y: auto; padding: 8px 0 16px;
  display: flex; flex-direction: column;
}
.sidebar::-webkit-scrollbar { width: 0; }
.menu-item {
  display: flex; align-items: center; gap: 10px; height: 44px; padding: 0 20px; color: rgba(255,255,255,.82);
  cursor: pointer; font-size: 14px; position: relative; user-select: none; flex: none;
}
.menu-item svg { width: 16px; height: 16px; flex: none; opacity: .9; }
.menu-item:hover { background: rgba(255,255,255,.06); color: #fff; }
.menu-item .caret { margin-left: auto; width: 10px; height: 10px; transition: transform .18s; opacity: .7; }
.menu-item.open .caret { transform: rotate(180deg); }
.menu-item.active {
  background: var(--sidebar-bg-2); color: #fff; font-weight: 600;
}
.menu-item.active::before {
  content: ""; position: absolute; left: 0; top: 6px; bottom: 6px; width: 3px; border-radius: 0 3px 3px 0;
  background: var(--zl-green);
}
.submenu { overflow: hidden; flex: none; }
.submenu .menu-item { height: 40px; padding-left: 46px; font-size: 13px; color: rgba(255,255,255,.66); }
.submenu .menu-item.active { color: #fff; background: rgba(147,213,0,.14); }
.sidebar .collapse {
  margin-top: auto; display: flex; align-items: center; gap: 10px; height: 44px; padding: 0 20px;
  color: rgba(255,255,255,.72); cursor: pointer; font-size: 13px; flex: none;
}
.sidebar .collapse svg { width: 16px; height: 16px; flex: none; }
.sidebar .collapse:hover { color: #fff; }
body.collapsed .sidebar { width: 56px; }
body.collapsed .sidebar .menu-item span.txt, body.collapsed .sidebar .caret, body.collapsed .submenu, body.collapsed .sidebar .collapse span.txt { display: none; }
body.collapsed .sidebar .menu-item { justify-content: center; padding: 0; }
body.collapsed .main { margin-left: 56px; }

/* ---------- layout ---------- */
.main { margin: var(--topbar-h) 0 0 var(--sidebar-w); padding: 0 16px 24px; min-height: calc(100vh - var(--topbar-h)); }
.crumb { padding: 14px 4px 12px; color: var(--text-3); font-size: 13px; }
.crumb b { color: var(--text-2); font-weight: 400; }
.crumb .sep { margin: 0 8px; color: #c6cad2; }
.crumb .cur { color: var(--text-1); }

.card { background: var(--card-bg); border-radius: var(--radius); box-shadow: 0 1px 2px rgba(16,24,64,.05); }
.card + .card { margin-top: 12px; }
.card-head { padding: 14px 20px; border-bottom: 1px solid var(--line); display: flex; align-items: center; }
.card-head h3 { margin: 0; font-size: 15px; font-weight: 600; }
.card-head .right { margin-left: auto; display: flex; gap: 8px; }
.card-body { padding: 16px 20px; }

/* stat cards */
.stat-row { display: flex; gap: 12px; margin: 0 0 12px; }
.stat-card {
  flex: 1; background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 18px; cursor: pointer; transition: border-color .15s, box-shadow .15s;
}
.stat-card .n { font-size: 22px; font-weight: 700; color: var(--text-1); line-height: 28px; }
.stat-card .l { color: var(--text-2); margin-top: 2px; }
.stat-card:hover { border-color: #b9b3ff; }
.stat-card.on { border-color: var(--zl-blue); box-shadow: 0 0 0 1px var(--zl-blue) inset; }
.stat-card.on .n { color: var(--zl-blue); }

/* tabs */
.tabs { display: flex; gap: 4px; padding: 6px 12px 0; border-bottom: 1px solid var(--line); background: #fff; border-radius: var(--radius) var(--radius) 0 0; }
.tab {
  padding: 9px 14px 10px; cursor: pointer; color: var(--text-2); border-bottom: 2px solid transparent; white-space: nowrap;
}
.tab:hover { color: var(--zl-blue); }
.tab.on { color: var(--zl-blue); font-weight: 600; border-bottom-color: var(--zl-blue); }
.tab .cnt { margin-left: 2px; }

/* filters */
.filters { display: flex; flex-wrap: wrap; gap: 12px 16px; align-items: center; padding: 14px 20px; background: #fff; }
.filters.with-tabs { border-radius: 0; }
.fitem { display: flex; align-items: center; gap: 8px; }
.fitem > label { color: var(--text-2); white-space: nowrap; }
.input, .select {
  height: 32px; border: 1px solid var(--gray-line); border-radius: 6px; padding: 0 10px; font-size: 13px;
  color: var(--text-1); background: #fff; min-width: 150px; outline: none; font-family: inherit;
}
.input:focus, .select:focus { border-color: var(--zl-blue); box-shadow: 0 0 0 2px var(--zl-blue-soft); }
.input::placeholder { color: var(--text-3); }
.select { appearance: none; padding-right: 26px; background-image: linear-gradient(45deg, transparent 50%, #9aa1ad 50%), linear-gradient(135deg, #9aa1ad 50%, transparent 50%); background-position: calc(100% - 15px) 14px, calc(100% - 10px) 14px; background-size: 5px 5px; background-repeat: no-repeat; color: var(--text-2); }
.daterange { display: inline-flex; align-items: center; border: 1px solid var(--gray-line); border-radius: 6px; height: 32px; padding: 0 10px; gap: 6px; color: var(--text-3); background: #fff; min-width: 220px; }
.daterange svg { width: 13px; height: 13px; margin-left: auto; }
.linkbtn { color: var(--zl-sky); cursor: pointer; display: inline-flex; align-items: center; gap: 4px; }
.linkbtn svg { width: 10px; height: 10px; }

/* buttons */
.btn {
  height: 32px; padding: 0 16px; border-radius: 6px; border: 1px solid var(--gray-line); background: #fff;
  color: var(--text-1); cursor: pointer; font-size: 13px; display: inline-flex; align-items: center; gap: 6px;
}
.btn:hover { color: var(--zl-blue); border-color: var(--zl-blue); }
.btn.primary { background: var(--zl-blue); border-color: var(--zl-blue); color: #fff; font-weight: 500; }
.btn.primary:hover { background: var(--zl-blue-hover); border-color: var(--zl-blue-hover); color: #fff; }
.btn.sm { height: 28px; padding: 0 12px; }
.btn svg { width: 13px; height: 13px; }

/* dropdown menu (创建用工需求) */
.dd-wrap { position: relative; display: inline-block; }
.dd-menu {
  position: absolute; right: 0; top: 36px; background: #fff; border-radius: 6px; min-width: 150px;
  box-shadow: 0 6px 16px rgba(16,24,64,.14); padding: 4px; z-index: 40; display: none;
}
.dd-menu.show { display: block; }
.dd-menu div { padding: 8px 12px; border-radius: 4px; cursor: pointer; white-space: nowrap; }
.dd-menu div:hover { background: var(--zl-blue-soft); color: var(--zl-blue); }

/* table */
.table-wrap { background: #fff; border-radius: 0 0 var(--radius) var(--radius); overflow: auto; }
.table-wrap.solo { border-radius: var(--radius); }
table.grid { border-collapse: collapse; width: 100%; min-width: 900px; }
table.grid th {
  background: #f7f8fc; color: var(--text-2); font-weight: 600; text-align: left; padding: 10px 12px;
  border-bottom: 1px solid var(--line); white-space: nowrap; font-size: 13px;
}
table.grid td { padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; color: var(--text-1); }
table.grid tbody tr:nth-child(even) td { background: #fafbff; }
table.grid tbody tr:hover td { background: #f0f4ff; }
table.grid td .op { margin-right: 10px; }
.empty { padding: 48px 0; text-align: center; color: var(--text-3); }
.empty .ico { font-size: 26px; margin-bottom: 8px; opacity: .5; }

/* badges */
.badge { display: inline-block; padding: 1px 8px; border-radius: 4px; font-size: 12px; line-height: 18px; border: 1px solid; }
.badge.ok { color: var(--ok); background: var(--ok-bg); border-color: var(--ok-line); }
.badge.warn { color: var(--warn); background: var(--warn-bg); border-color: var(--warn-line); }
.badge.err { color: var(--err); background: var(--err-bg); border-color: var(--err-line); }
.badge.gray { color: var(--gray); background: var(--gray-bg); border-color: var(--gray-line); }
.badge.info { color: var(--zl-sky); background: #e8f3ff; border-color: #b3d8ff; }
.badge + .badge { margin-left: 6px; }

/* pagination */
.pager { display: flex; align-items: center; gap: 8px; padding: 14px 20px; background: #fff; border-radius: 0 0 var(--radius) var(--radius); color: var(--text-2); }
.pager .total { margin-right: auto; }
.pager .pg { min-width: 28px; height: 28px; border: 1px solid var(--gray-line); border-radius: 6px; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; background: #fff; padding: 0 6px; }
.pager .pg.on { border-color: var(--zl-blue); color: var(--zl-blue); font-weight: 600; }
.pager .pg:hover { border-color: var(--zl-blue); color: var(--zl-blue); }
.pager .size { margin-left: 4px; }

/* summary strip */
.summary { display: flex; flex-wrap: wrap; gap: 8px 28px; padding: 12px 20px; background: #fff; color: var(--text-2); border-top: 1px solid var(--line); }

/* account cards */
.acc-row { display: flex; gap: 12px; margin-bottom: 12px; }
.acc-card { flex: 1; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 18px; }
.acc-card .h { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.acc-card .h .tag { font-weight: 400; color: var(--text-2); font-size: 12px; }
.acc-card .nums { display: flex; gap: 40px; margin-top: 10px; }
.acc-card .nums .l { color: var(--text-2); }
.acc-card .nums .v { font-size: 20px; font-weight: 700; margin-top: 2px; }
.acc-card .nums .v small { font-size: 12px; font-weight: 400; color: var(--zl-sky); margin-left: 6px; cursor: pointer; }

/* detail pages */
.detail-head { display: flex; align-items: center; gap: 12px; padding: 16px 20px; background: #fff; border-radius: var(--radius) var(--radius) 0 0; }
.detail-head h2 { margin: 0; font-size: 18px; }
.detail-head .code { color: var(--text-3); }
.detail-head .right { margin-left: auto; display: flex; gap: 8px; }
.promo {
  margin: 12px 0; border-radius: var(--radius); padding: 16px 20px; color: #fff;
  background: linear-gradient(120deg, var(--zl-blue), #2418d8 55%, #0F78F5);
  display: flex; align-items: center; gap: 20px;
}
.promo .price { font-size: 22px; font-weight: 700; }
.promo .price small { font-size: 12px; font-weight: 400; opacity: .85; }
.promo .cycle { background: rgba(255,255,255,.18); border-radius: 4px; padding: 2px 8px; }
.promo .qr { margin-left: auto; display: flex; align-items: center; gap: 10px; font-size: 12px; opacity: .95; }
.promo .qr .box { width: 64px; height: 64px; background: #fff; border-radius: 6px; display: grid; place-items: center; }
.promo .qr .box svg { width: 48px; height: 48px; color: #1f2430; }
.section { background: #fff; border-radius: var(--radius); margin-top: 12px; }
.section > h4 { margin: 0; padding: 13px 20px; border-bottom: 1px solid var(--line); font-size: 14px; display: flex; align-items: center; }
.section > h4::before { content: ""; width: 3px; height: 14px; border-radius: 2px; background: var(--zl-green); margin-right: 8px; flex: none; }
.kv { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px 24px; padding: 16px 20px; }
.kv .k { color: var(--text-2); }
.kv .row { display: flex; gap: 4px; }
.kv .row .v { color: var(--text-1); white-space: pre-line; }
.kv .wide { grid-column: 1 / -1; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; padding: 4px 0; }
.chip { border: 1px solid var(--gray-line); border-radius: 4px; padding: 3px 10px; color: var(--text-2); background: #fafbff; }
.anchor-nav { position: fixed; right: 6px; top: 42%; background: transparent; box-shadow: none; padding: 0; width: 128px; z-index: 30; border-left: 1px solid var(--line); }
.anchor-nav div { padding: 9px 14px; color: var(--text-2); cursor: pointer; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.anchor-nav div:hover, .anchor-nav div.on { color: var(--zl-blue); background: transparent; font-weight: 600; }
.anchor-nav div[data-act="收起"] {
  position: absolute; left: -17px; top: 50%; transform: translateY(-50%); background: #fff; border: 1px solid var(--line);
  border-right: none; border-radius: 6px 0 0 6px; padding: 8px 3px; writing-mode: vertical-rl; letter-spacing: 2px; color: var(--text-3);
}

/* drawer (费用详情) */
.drawer-mask { position: fixed; inset: 0; background: rgba(10,0,60,.35); z-index: 70; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(880px, 92vw); background: #f2f4f8; z-index: 80;
  box-shadow: -8px 0 24px rgba(10,0,60,.18); overflow-y: auto; padding: 0 16px 32px;
}
.drawer .dhead { position: sticky; top: 0; background: #f2f4f8; padding: 14px 4px; display: flex; align-items: center; gap: 10px; z-index: 2; }
.drawer .dhead h3 { margin: 0; font-size: 16px; }
.drawer .dhead .x { margin-left: auto; cursor: pointer; color: var(--text-3); font-size: 18px; line-height: 1; padding: 4px; }
.drawer .dhead .x:hover { color: var(--text-1); }

/* org tree */
.org-wrap { display: flex; gap: 12px; align-items: flex-start; }
.org-tree { width: 300px; flex: none; background: #fff; border-radius: var(--radius); padding: 12px 8px; max-height: 640px; overflow: auto; }
.tnode { padding: 6px 8px; border-radius: 4px; cursor: pointer; display: flex; align-items: center; gap: 6px; color: var(--text-1); }
.tnode:hover { background: var(--zl-blue-soft); }
.tnode.on { background: var(--zl-blue-soft); color: var(--zl-blue); font-weight: 600; }
.tnode .tw { width: 12px; color: var(--text-3); font-size: 10px; }
.org-right { flex: 1; min-width: 0; }

/* form page */
.form-card { background: #fff; border-radius: var(--radius); }
.form-card .fhead { padding: 16px 24px; border-bottom: 1px solid var(--line); font-size: 16px; font-weight: 600; }
.form-body { padding: 40px 24px 60px; display: flex; flex-direction: column; gap: 22px; align-items: center; }
.frow { display: flex; align-items: center; gap: 10px; width: 620px; max-width: 100%; }
.frow > label { width: 120px; text-align: right; color: var(--text-1); flex: none; }
.frow > label .req { color: #f5222d; margin-right: 4px; }
.frow .ctl { flex: 1; }
.frow .input, .frow .select { width: 100%; min-width: 0; }
.frow .readonly { background: #f5f5f5; color: var(--text-3); }
.form-foot { border-top: 1px solid var(--line); padding: 14px; display: flex; justify-content: center; gap: 12px; background: #fff; border-radius: 0 0 var(--radius) var(--radius); }

/* toast */
.toast {
  position: fixed; top: 72px; left: 50%; transform: translateX(-50%); background: #fff; border-radius: 6px;
  box-shadow: 0 6px 16px rgba(16,24,64,.16); padding: 9px 16px; display: flex; align-items: center; gap: 8px;
  z-index: 100; font-size: 13px; animation: tin .18s ease-out;
}
.toast .dot { width: 16px; height: 16px; border-radius: 50%; background: var(--zl-green); color: #fff; display: grid; place-items: center; font-size: 11px; }
@keyframes tin { from { opacity: 0; transform: translate(-50%, -8px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* confirm popover */
.pop { position: fixed; background: #fff; border-radius: 6px; box-shadow: 0 6px 16px rgba(16,24,64,.18); padding: 12px 16px; z-index: 90; width: 220px; }
.pop .t { display: flex; gap: 8px; align-items: flex-start; color: var(--text-1); }
.pop .btns { display: flex; justify-content: flex-end; gap: 8px; margin-top: 12px; }

.qr-foot { display: flex; align-items: center; gap: 12px; padding: 14px 20px; background: #fff; border-top: 1px solid var(--line); color: var(--text-2); }
.qr-foot .box { width: 72px; height: 72px; border: 1px solid var(--line); border-radius: 6px; display: grid; place-items: center; }
.qr-foot .box svg { width: 56px; height: 56px; }
