/* ==================== 合同台账（电子合同子标签） v2 ====================
   克制风格：白底、细边框、单一强调色 #4f46e5，无渐变无光晕
   宿主约束：.card overflow:hidden → 内部所有元素严禁横向溢出 */

/* ---------- 卡片骨架（单卡片双面板） ---------- */
.cl-card { display: flex; flex-direction: column; }
.cl-topbar {
    display: flex; align-items: center; justify-content: space-between; gap: 16px;
    padding: 0 24px; border-bottom: 1px solid #eef0f4; flex-shrink: 0; min-height: 52px;
}
.cl-topbar-right { display: flex; align-items: center; gap: 8px; min-width: 0; }
.cl-sync-text {
    font-size: 12px; color: #94a3b8; display: inline-flex; align-items: center; gap: 6px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.cl-sync-dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }
.cl-dot-ok { background: #16a34a; }
.cl-dot-run { background: #f59e0b; animation: clPulse 1.2s ease-in-out infinite; }
.cl-dot-err { background: #dc2626; }
@keyframes clPulse { 0%, 100% { opacity: 1; } 50% { opacity: .3; } }
.cl-tbtn {
    appearance: none; border: 1px solid #e5e7eb; background: #fff; color: #475569;
    font-size: 12.5px; padding: 5px 12px; border-radius: 7px; cursor: pointer;
    transition: border-color .15s, color .15s; white-space: nowrap;
}
.cl-tbtn:hover { border-color: #4f46e5; color: #4f46e5; }

.cl-pane { flex: 1; min-height: 0; overflow-y: auto; }
.cl-launch-head { padding: 20px 24px 0; }
.cl-launch-head h3 { font-size: 16px; font-weight: 700; color: #0f172a; margin: 0; }

/* ---------- 子标签 ---------- */
.cl-tabs { display: flex; gap: 2px; }
.cl-tab {
    appearance: none; background: none; border: none; cursor: pointer;
    padding: 16px 4px 14px; margin-right: 22px; font-size: 14px; color: #94a3b8; font-weight: 500;
    border-bottom: 2px solid transparent; transition: color .15s, border-color .15s;
}
.cl-tab:hover { color: #475569; }
.cl-tab.active { color: #0f172a; font-weight: 600; border-bottom-color: #4f46e5; }

/* ---------- 内容区内边距 ---------- */
#contractLedgerRoot { display: flex; flex-direction: column; min-height: 100%; padding: 18px 24px 20px; }
#contractLedgerRoot .cl-stats, #contractLedgerRoot .cl-toolbar { flex-shrink: 0; }

/* ---------- 统计 chips ---------- */
.cl-stats { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.cl-chip {
    background: #fff; border: 1px solid #e8eaef; border-radius: 10px;
    padding: 12px 18px 10px; min-width: 104px; transition: border-color .15s, box-shadow .15s;
}
.cl-chip-val { font-size: 21px; font-weight: 700; color: #0f172a; line-height: 1.2; font-variant-numeric: tabular-nums; }
.cl-chip-label { font-size: 12px; color: #94a3b8; margin-top: 2px; white-space: nowrap; }
.cl-chip-danger .cl-chip-val { color: #dc2626; }
.cl-chip-warn .cl-chip-val { color: #ea580c; }
.cl-chip-mild .cl-chip-val { color: #b45309; }
.cl-chip-empty { opacity: .5; }
.cl-chip-empty .cl-chip-val { color: #cbd5e1; }
.cl-clickable { cursor: pointer; user-select: none; }
.cl-clickable:hover { border-color: #c7cad3; background: #fafbfd; }
.cl-chip-active { border-color: #4f46e5; box-shadow: 0 0 0 1px #4f46e5 inset; }
.cl-chip-active:hover { border-color: #4f46e5; background: #fff; }
.cl-chip-clickable { cursor: pointer; }
.cl-chip-clickable:hover { border-color: #c7cbdb; box-shadow: 0 1px 5px rgba(15, 23, 42, .06); }
.cl-chip-active { border-color: #4f46e5; box-shadow: 0 0 0 1px #4f46e5 inset; }

/* ---------- 筛选范围提示 ---------- */
.cl-scope { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: -8px 0 14px; }
.cl-scope-tag {
    font-size: 11px; font-weight: 500; color: #4f46e5; background: #eef2ff;
    border-radius: 4px; padding: 1px 6px; flex-shrink: 0;
}
.cl-scope-txt { font-size: 12px; color: #94a3b8; }
.cl-scope-reset {
    font-size: 12px; color: #4f46e5; cursor: pointer; margin-left: 2px;
    text-decoration: underline; text-underline-offset: 2px;
}
.cl-scope-reset:hover { color: #4338ca; }

/* ---------- 工具栏 ---------- */
.cl-toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.cl-export {
    height: 36px; padding: 0 14px; margin-left: auto; font-size: 13px; font-weight: 500;
    color: #4f46e5; background: #fff; border: 1px solid #c7d2fe; border-radius: 8px;
    cursor: pointer; transition: background .15s, border-color .15s; white-space: nowrap;
}
.cl-export:hover { background: #eef2ff; border-color: #a5b4fc; }
.cl-export:disabled { opacity: .55; cursor: default; }
.cl-search-wrap {
    display: flex; align-items: center; gap: 6px; flex: 1; min-width: 230px; max-width: 360px;
    position: relative;
}
.cl-search-ico { position: absolute; left: 11px; color: #94a3b8; pointer-events: none; }
.cl-input {
    height: 36px; padding: 0 12px; font-size: 13px; color: #0f172a;
    border: 1px solid #e5e7eb; border-radius: 8px; background: #fff; outline: none;
    transition: border-color .15s, box-shadow .15s; width: 100%;
}
#clKeyword { padding-left: 32px; }
.cl-input:focus { border-color: #4f46e5; box-shadow: 0 0 0 3px rgba(79, 70, 229, .08); }
.cl-select { width: auto; padding-right: 28px; flex-shrink: 0; }
.cl-live-check, .cl-check {
    display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; color: #64748b;
    cursor: pointer; white-space: nowrap; user-select: none; flex-shrink: 0;
}
.cl-check input, .cl-live-check input { accent-color: #4f46e5; cursor: pointer; margin: 0; }

/* ---------- 表格 ---------- */
.cl-table-wrap {
    border: 1px solid #e8eaef; border-radius: 10px; overflow: auto;
    max-height: min(62vh, 640px); flex-shrink: 0; background: #fff;
}
.cl-table { width: 100%; border-collapse: collapse; table-layout: fixed; font-size: 13px; }
.cl-table thead th {
    position: sticky; top: 0; z-index: 1;
    background: #f8f9fb; color: #8a90a3; font-weight: 600; text-align: left; font-size: 12px;
    padding: 11px 14px; border-bottom: 1px solid #e8eaef; white-space: nowrap;
}
.cl-table tbody td {
    padding: 9px 14px; border-bottom: 1px solid #f2f4f8; color: #0f172a; vertical-align: middle;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.cl-table tbody tr:last-child td { border-bottom: none; }
.cl-table tbody tr { transition: background .12s; }
.cl-table tbody tr:hover { background: #f8f9fd; }

/* 两行式员工列 */
.cl-emp { line-height: 1.35 !important; }
.cl-emp-name { font-weight: 600; color: #1e293b; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cl-emp-name.is-leave { color: #94a3b8; font-weight: 500; }
.cl-emp-code { font-size: 11.5px; color: #94a3b8; font-family: Consolas, "Courier New", monospace; }
.cl-leavetag {
    display: inline-block; vertical-align: 1px; margin-left: 4px;
    font-size: 10px; font-weight: 500; line-height: 14px; padding: 0 5px;
    border-radius: 999px; background: #f1f5f9; color: #94a3b8; border: 1px solid #e2e8f0;
}

/* 部门三列（一级/二级/三级，数据来自员工主数据部门树） */
.cl-dept { color: #475569; }
.cl-dept1 { color: #334155; }
.cl-dept2 { color: #64748b; }
.cl-dept3 { color: #94a3b8; }
/* 部门列内容长、列又窄，收窄内边距 + 略小字号，尽量多显示几个字
   （1600 视口下列宽 103px，8px 内边距 → 内容区 87px，能放下 7 个汉字） */
.cl-table tbody td.cl-dept { padding-left: 8px; padding-right: 8px; font-size: 12.5px; }
.cl-table thead th.cl-th-dept { padding-left: 8px; padding-right: 8px; }

/* 合同类型 / 合同主体 独立两列 */
.cl-ctt, .cl-ctb { color: #334155; }
.cl-ctb { color: #64748b; }
/* 主体列允许折行（最多 2 行）：中文全称如"国金黄金股份有限公司浙江分公司"很长，
   靠省略号会把最有辨识度的"浙江分公司"吃掉；折行后列窄也能看全，超长再截断 + title */
.cl-table tbody td.cl-ctb { white-space: normal; }
.cl-ctb-in {
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
    overflow: hidden; line-height: 1.35; word-break: break-word;
}

.cl-mono { font-family: Consolas, "Courier New", monospace; font-size: 12px; color: #475569; }
.cl-muted { color: #cbd5e1; }

/* 到期日标色 */
.cl-danger { color: #dc2626; font-weight: 600; }
.cl-warn { color: #ea580c; font-weight: 600; }
.cl-mild { color: #b45309; }
.cl-daytag { font-size: 11px; font-weight: 500; padding: 1px 6px; border-radius: 999px; margin-left: 3px; }
.cl-t-danger { background: #fef2f2; color: #dc2626; }
.cl-t-warn { background: #fff7ed; color: #ea580c; }
.cl-t-mild { background: #fffbeb; color: #b45309; }
.cl-longterm { color: #94a3b8; font-size: 12px; }
.cl-expected-tag { font-size: 11px; color: #94a3b8; border: 1px solid #e2e8f0; border-radius: 4px; padding: 0 4px; margin-left: 4px; }
.cl-seal-note { font-size: 12px; color: #b45309; background: #fffbeb; border: 1px solid #fde68a; border-radius: 6px; padding: 8px 10px; margin-bottom: 10px; }

/* 来源/状态标签 */
.cl-src {
    display: inline-block; font-size: 11px; font-weight: 500; padding: 2px 8px;
    border-radius: 999px; line-height: 16px;
}
.cl-src-bpm { background: #eef2ff; color: #4f46e5; }
.cl-src-off { background: #f1f5f9; color: #64748b; }
.cl-st-valid { color: #16a34a; }
.cl-st-invalid { color: #94a3b8; }

.cl-livenote {
    padding: 8px 14px; font-size: 12px; color: #4f46e5; background: #eef2ff;
    border-bottom: 1px solid #e0e7ff;
}

/* 操作列 */
.cl-ops { text-align: left; }
.cl-link { color: #4f46e5; font-size: 12.5px; text-decoration: none; cursor: pointer; }
.cl-link:hover { text-decoration: underline; }

/* 分页 */
.cl-pager {
    display: flex; align-items: center; justify-content: flex-end; gap: 10px;
    padding-top: 14px; flex-shrink: 0;
}
.cl-total { font-size: 12.5px; color: #94a3b8; margin-right: auto; font-variant-numeric: tabular-nums; }
.cl-pgbtn {
    appearance: none; border: 1px solid #e5e7eb; background: #fff; color: #475569;
    font-size: 12.5px; padding: 6px 14px; border-radius: 7px; cursor: pointer;
    transition: border-color .15s, color .15s;
}
.cl-pgbtn:hover:not([disabled]) { border-color: #4f46e5; color: #4f46e5; }
.cl-pgbtn[disabled] { opacity: .4; cursor: not-allowed; }

/* 空状态 */
.cl-empty {
    text-align: center; padding: 56px 20px; color: #94a3b8; font-size: 13.5px;
    display: flex; flex-direction: column; align-items: center; gap: 10px;
}
.cl-empty-sub { font-size: 12px; color: #cbd5e1; }

/* 签署文件弹窗 */
.cl-modal-mask {
    position: fixed; inset: 0; background: rgba(15, 23, 42, .4); z-index: 9999;
    display: flex; align-items: center; justify-content: center;
}
.cl-modal {
    background: #fff; border-radius: 12px; width: 560px; max-width: 92vw;
    max-height: 70vh; display: flex; flex-direction: column;
    box-shadow: 0 8px 30px rgba(15, 23, 42, .18);
}
.cl-modal-head {
    padding: 15px 20px; font-size: 14px; font-weight: 600; color: #0f172a;
    border-bottom: 1px solid #eef0f4; display: flex; align-items: center; justify-content: space-between;
}
.cl-modal-close { cursor: pointer; font-size: 20px; color: #94a3b8; line-height: 1; padding: 0 4px; }
.cl-modal-close:hover { color: #0f172a; }
.cl-modal-body { padding: 8px 20px 14px; overflow-y: auto; }
.cl-seal-item { padding: 11px 0; border-bottom: 1px solid #f2f4f8; }
.cl-seal-item:last-child { border-bottom: none; }
.cl-seal-title { font-size: 13px; font-weight: 600; color: #0f172a; }
.cl-seal-meta { font-size: 12px; color: #94a3b8; margin: 3px 0 6px; }

/* 窄屏让位策略
   ------------------------------------------------------------
   表格容器可用宽度 = 视口 - 346（>1450，左右padding 24）/ -330（≤1450，padding 16）。
   12 列合计 1242px，因此 1600 视口（容器 1254）刚好放得下。
   视口变窄时按"影响最小"的顺序依次让位，断点由"剩余列宽合计 ≤ 容器"反推，
   并留 ≥35px 余量避免横向滚动条。部门完整层级链始终在单元格 title 中。
   ------------------------------------------------------------ */

/* ≤1599：让出三级部门（11 列 = 1138） */
@media (max-width: 1599px) {
    .cl-table thead th:nth-child(4), .cl-table tbody td:nth-child(4) { display: none; }
}
/* ≤1499：再让出合同主体（10 列 = 1016；内容在行悬停提示里） */
@media (max-width: 1499px) {
    .cl-table thead th:nth-child(6), .cl-table tbody td:nth-child(6) { display: none; }
    #contractLedgerRoot { padding-left: 16px; padding-right: 16px; }
}
/* ≤1359：再让出二级部门与合同类型（8 列 = 800） */
@media (max-width: 1359px) {
    .cl-table thead th:nth-child(3), .cl-table tbody td:nth-child(3),
    .cl-table thead th:nth-child(5), .cl-table tbody td:nth-child(5) { display: none; }
    .cl-topbar { flex-wrap: wrap; padding: 0 16px; }
    .cl-sync-text { display: none; }
    #contractLedgerRoot { padding: 14px 16px 16px; }
    .cl-chip { min-width: 88px; padding: 9px 12px 8px; }
    .cl-chip-val { font-size: 17px; }
}
/* ≤1149：再让出一级部门、状态、来源、操作 → 只留 员工/编号/开始/到期 */
@media (max-width: 1149px) {
    .cl-dept { display: none; }
    .cl-table thead th:nth-child(2), .cl-table tbody td:nth-child(2),
    .cl-table thead th:nth-child(10), .cl-table tbody td:nth-child(10),
    .cl-table thead th:nth-child(11), .cl-table tbody td:nth-child(11),
    .cl-table thead th:nth-child(12), .cl-table tbody td:nth-child(12) { display: none; }
}
@media (max-width: 820px) {
    .cl-stats { gap: 6px; }
    .cl-chip { flex: 1 1 30%; min-width: 0; }
    .cl-toolbar .cl-select { flex: 1 1 40%; min-width: 0; }
    .cl-search-wrap { max-width: none; }
    .cl-table-wrap { max-height: none; }
    .cl-ctb { display: none; }
}

/* ---------- 提醒排除（不在本方签约体系的部门，如艺创事业部） ---------- */
.cl-exbtn { margin-left: auto; }
.cl-exbtn-short { display: none; }
/* ≤1439（1366 笔记本）：按钮文案缩短 + 收紧内边距，避免工具栏多占一行。
   实测 1440 以上单行、1280 本来就两行，只有 1366 会因新增按钮换行。 */
@media (max-width: 1439px) {
    .cl-exbtn-full { display: none; }
    .cl-exbtn-short { display: inline; }
    .cl-exbtn { padding: 5px 9px; font-size: 12px; }
}

.cl-exbar {
    display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
    margin: -6px 0 14px; padding: 8px 12px; border-radius: 8px;
    background: #fffbf3; border: 1px solid #fbe3bd;
}
.cl-exbar-tag {
    font-size: 11px; font-weight: 500; color: #b45309; background: #fdf0d5;
    border-radius: 4px; padding: 1px 6px; flex-shrink: 0;
}
.cl-exbar-tag-on { color: #0369a1; background: #e0f2fe; }
.cl-exbar-txt { font-size: 12px; color: #92400e; }
.cl-exbar-txt b { font-weight: 600; color: #7c2d12; }
.cl-exbar-act {
    font-size: 12px; color: #4f46e5; cursor: pointer;
    text-decoration: underline; text-underline-offset: 2px; white-space: nowrap;
}
.cl-exbar-act:hover { color: #4338ca; }

.cl-exmodal { width: 660px; }
.cl-exintro {
    font-size: 12.5px; line-height: 1.75; color: #64748b;
    background: #f8fafc; border-radius: 8px; padding: 10px 12px;
}
.cl-exintro b { color: #0f172a; font-weight: 600; }
.cl-exswitch {
    display: flex; align-items: center; gap: 6px; cursor: pointer;
    font-size: 13px; color: #334155; margin: 14px 0 10px;
}
.cl-exlist { border: 1px solid #eef0f4; border-radius: 8px; overflow: hidden; }
.cl-exitem {
    display: flex; align-items: flex-start; gap: 10px;
    padding: 10px 12px; border-bottom: 1px solid #f2f4f8;
}
.cl-exitem:last-child { border-bottom: none; }
.cl-exitem-main { flex: 1; min-width: 0; }
.cl-exitem-key { font-size: 13px; font-weight: 600; color: #0f172a; }
.cl-exitem-meta { font-size: 11.5px; color: #94a3b8; margin-top: 3px; line-height: 1.65; }
.cl-exitem-del { font-size: 12px; color: #dc2626; cursor: pointer; flex-shrink: 0; padding-top: 1px; }
.cl-exitem-del:hover { text-decoration: underline; }
.cl-exitem-empty { padding: 14px 12px; font-size: 12.5px; color: #94a3b8; text-align: center; }
.cl-exadd { display: flex; gap: 8px; margin-top: 12px; }
.cl-exadd .cl-input { flex: 1; height: 34px; }
.cl-expv { margin-top: 10px; font-size: 12px; line-height: 1.75; }
.cl-expv-hit { color: #334155; }
.cl-expv-hit b { color: #4f46e5; }
.cl-expv-imp { color: #64748b; margin-top: 2px; }
.cl-expv-imp b { color: #0f172a; }
.cl-expv-none { color: #b45309; }
.cl-exwarn {
    margin-top: 10px; font-size: 12px; color: #b91c1c;
    background: #fef2f2; border-radius: 6px; padding: 8px 10px;
}
/* 涉及人员样例（核对"到底挡了谁"） */
.cl-expeople { margin-top: 12px; border: 1px solid #eef0f4; border-radius: 8px; padding: 10px 12px; }
.cl-expeople-h {
    font-size: 12px; color: #475569; display: flex; align-items: center;
    gap: 8px; flex-wrap: wrap;
}
.cl-expeople-list {
    margin-top: 8px; display: flex; flex-wrap: wrap; gap: 6px;
    max-height: 138px; overflow-y: auto;
}
.cl-experson {
    font-size: 11.5px; color: #334155; background: #f8fafc;
    border: 1px solid #eef0f4; border-radius: 5px; padding: 3px 7px; white-space: nowrap;
}
.cl-experson b { font-weight: 600; color: #0f172a; }
.cl-experson i { font-style: normal; color: #94a3b8; margin-left: 4px; }

.cl-extotal {
    margin-top: 12px; font-size: 12px; color: #475569; line-height: 1.75;
    background: #f8fafc; border-radius: 6px; padding: 8px 10px;
}
.cl-exfoot {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    margin-top: 14px; padding-top: 12px; border-top: 1px solid #eef0f4;
}
.cl-exhint { font-size: 11.5px; color: #94a3b8; }
.cl-exsave { color: #4f46e5; border-color: #c7d2fe; }
.cl-exsave:hover { background: #eef2ff; }
