/* ==========================================
   contracts.css — Apple HIG 合同管理模块
   风格: 白色卡片表格 · Capsule 状态标签 · 毛玻璃弹窗
   ========================================== */

#mod-contracts {
    min-width: 0;
    max-width: 100%;
}

/* ========================================
    5.1: 搜索/筛选栏 — Capsule 输入框 + 蓝色聚焦
    ======================================== */
.mod-contracts-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-sm);
    margin-bottom: var(--space-lg);
    align-items: center;
}

.mod-contracts-toolbar .search-box {
    position: relative;
    flex: 1;
    min-width: 200px;
    max-width: 360px;
}

.mod-contracts-toolbar .search-box i {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--color-text-tertiary);
    font-size: 15px;
    z-index: 1;
    pointer-events: none;
}

.mod-contracts-toolbar .search-box input {
    width: 100%;
    height: 44px;
    padding: 0 14px 0 38px;
    border: 1px solid var(--color-input-border);
    border-radius: var(--radius-full);
    font-size: var(--font-size-sm);
    background: var(--color-input-bg);
    color: var(--color-text);
    transition: all var(--transition-fast) var(--ease-out);
    outline: none;
    font-family: var(--font-family);
}

.mod-contracts-toolbar .search-box input:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.25);
}

.mod-contracts-toolbar select {
    height: 44px;
    padding: 0 36px 0 14px;
    border: 1px solid var(--color-input-border);
    border-radius: var(--radius-full);
    font-size: var(--font-size-sm);
    background: var(--color-input-bg);
    color: var(--color-text);
    cursor: pointer;
    min-width: 130px;
    outline: none;
    font-family: var(--font-family);
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23888' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    transition: all var(--transition-fast) var(--ease-out);
}

.mod-contracts-toolbar select:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.25);
}

.mod-contracts-toolbar .toolbar-actions {
    display: flex;
    gap: var(--space-sm);
    margin-left: auto;
    align-items: center;
}

/* ========================================
    5.2: 数据表格 — 白色卡片包裹 + 16px 圆角 + 表头灰字 + 浅分割线
    ======================================== */
.mod-contracts-table-wrap {
    overflow-x: auto;
    background: var(--color-card);
    border: none;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

.mod-contracts-table {
    width: 100%;
    table-layout: fixed;
    border-collapse: separate;
    border-spacing: 0;
    font-size: var(--font-size-sm);
}

.mod-contracts-table thead th {
    background: var(--color-bg);
    padding: 10px 12px;
    text-align: left;
    font-weight: 500;
    color: var(--color-text-tertiary);
    font-size: 12px;
    text-transform: none;
    letter-spacing: 0;
    border-bottom: 1px solid var(--color-border);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    position: sticky;
    top: 0;
    z-index: 2;
}

.mod-contracts-table tbody td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--color-border-light);
    vertical-align: middle;
    color: var(--color-text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mod-contracts-table tbody tr:last-child td {
    border-bottom: none;
}

.mod-contracts-table tbody tr:last-child td:first-child {
    border-radius: 0 0 0 var(--radius-lg);
}

.mod-contracts-table tbody tr:last-child td:last-child {
    border-radius: 0 0 var(--radius-lg) 0;
}

/* ========================================
   5.3: 表格行 hover — 浅蓝底色 + 平滑过渡
   ======================================== */
.mod-contracts-table tbody tr {
    transition: background var(--transition-fast) var(--ease-out);
}

.mod-contracts-table tbody tr:hover {
    background: var(--color-table-hover);
}

/* ========================================
   Column styles
   ======================================== */
.mod-contracts-table .col-name {
    font-weight: 500;
    color: var(--color-text);
    cursor: pointer;
    transition: color var(--transition-fast) var(--ease-out);
}

.mod-contracts-table .col-name:hover {
    color: var(--color-primary);
}

.mod-contracts-table .col-number {
    font-family: 'SF Mono', 'Consolas', 'Menlo', monospace;
    font-size: 12px;
    color: var(--color-text-tertiary);
    letter-spacing: 0.5px;
}

/* 合同列表专用列宽：短列收紧，名称/单位保留可读空间 */
.ctr-list-table .ctr-col-index    { width: 60px; }
.ctr-list-table .ctr-col-number   { width: 122px; }
.ctr-list-table .ctr-col-name     { width: 205px; }
.ctr-list-table .ctr-col-category { width: 120px; }
.ctr-list-table .ctr-col-project  { width: 150px; }
.ctr-list-table .ctr-col-party    { width: 150px; }
.ctr-list-table .ctr-col-type     { width: 82px; }
.ctr-list-table .ctr-col-amount   { width: 120px; }
.ctr-list-table .ctr-col-tax      { width: 68px; }
.ctr-list-table .ctr-col-date     { width: 104px; }
.ctr-list-table .ctr-col-status   { width: 96px; }

.ctr-list-table th:nth-child(2),
.ctr-list-table td:nth-child(2) {
    padding-left: 8px;
    padding-right: 8px;
}

.ctr-list-table .col-number {
    font-size: 11px;
    letter-spacing: 0.2px;
}

.ctr-list-table th:nth-child(9),
.ctr-list-table td:nth-child(9),
.ctr-list-table th:nth-child(11),
.ctr-list-table td:nth-child(11) {
    text-align: right;
}

.ctr-list-table th:nth-child(10),
.ctr-list-table td:nth-child(10) {
    text-align: center;
}

.ctr-list-table th:nth-child(13),
.ctr-list-table td:nth-child(13),
.ctr-list-table th:nth-child(14),
.ctr-list-table td:nth-child(14) {
    text-align: center;
}

.ctr-list-table .ctr-actions {
    justify-content: center;
}

/* ========================================
   5.4: 状态标签 — Capsule 圆角 + 8px 圆点前置
   绿点=执行中 / 蓝点=已完成 / 红点=终止
   ======================================== */
.ctr-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border-radius: var(--radius-full);
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 0;
}

.ctr-status-badge::before {
    content: '';
    width: 8px; height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
    box-shadow: 0 0 0 2px currentColor;
    opacity: 0.35;
}

.ctr-status-badge.status-active {
    background: rgba(52, 199, 89, 0.10);
    color: #248A3D;
}

.ctr-status-badge.status-active::before {
    background: #34C759;
    box-shadow: 0 0 0 2px rgba(52, 199, 89, 0.30);
}

.ctr-status-badge.status-completed {
    background: rgba(0, 122, 255, 0.08);
    color: #0056B3;
}

.ctr-status-badge.status-completed::before {
    background: #007AFF;
    box-shadow: 0 0 0 2px rgba(0, 122, 255, 0.30);
}

.ctr-status-badge.status-terminated {
    background: rgba(255, 59, 48, 0.08);
    color: #D32F2F;
}

.ctr-status-badge.status-terminated::before {
    background: #FF3B30;
    box-shadow: 0 0 0 2px rgba(255, 59, 48, 0.30);
}

/* 审核状态：已审核=绿色，未审核=橙色（与绿色形成对比） */
.ctr-status-badge.is-approved {
    background: rgba(52, 199, 89, 0.12);
    color: #248A3D;
}

.ctr-status-badge.is-approved::before {
    background: #34C759;
    box-shadow: 0 0 0 2px rgba(52, 199, 89, 0.30);
}

.ctr-status-badge.is-pending {
    background: rgba(255, 149, 0, 0.14);
    color: #B26A00;
}

.ctr-status-badge.is-pending::before {
    background: #FF9500;
    box-shadow: 0 0 0 2px rgba(255, 149, 0, 0.30);
}

/* 表格内的审核徽标更紧凑，避免窄列裁切 */
.ctr-list-table .ctr-status-badge,
.ctr-sub-table .ctr-status-badge {
    padding: 2px 7px;
    gap: 4px;
}

.ctr-list-table .ctr-status-badge::before,
.ctr-sub-table .ctr-status-badge::before {
    width: 6px;
    height: 6px;
}

@media (max-width: 1200px) {
    .ctr-list-table .ctr-status-badge,
    .ctr-sub-table .ctr-status-badge {
        padding: 2px 3px;
        gap: 0;
        font-size: 10px;
    }

    .ctr-list-table .ctr-status-badge::before,
    .ctr-sub-table .ctr-status-badge::before {
        display: none;
    }
}

/* ========================================
   Amount column
   ======================================== */
.ctr-amount {
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0;
}

/* ========================================
   Action buttons row
   ======================================== */
.ctr-actions {
    display: flex;
    gap: 4px;
}

/* ========================================
   5.9: 分页 — 全圆角 Capsule 按钮 / 蓝色当前页
   ======================================== */
.mod-contracts-pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: var(--space-lg);
    flex-wrap: wrap;
    gap: var(--space-sm);
}

.mod-contracts-pagination .page-info {
    font-size: 12px;
    color: var(--color-text-tertiary);
}

.mod-contracts-pagination .page-btns {
    display: flex;
    gap: 4px;
}

.mod-contracts-pagination .page-btns button {
    min-width: 36px;
    height: 36px;
    border: none;
    background: transparent;
    border-radius: var(--radius-full);
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    color: var(--color-text-secondary);
    transition: all var(--transition-fast) var(--ease-out);
    font-family: var(--font-family);
    display: flex;
    align-items: center;
    justify-content: center;
}

.mod-contracts-pagination .page-btns button:hover {
    background: var(--color-sidebar-hover);
    color: var(--color-text);
}

.mod-contracts-pagination .page-btns button.active {
    background: var(--color-primary);
    color: #fff;
    box-shadow: 0 2px 8px rgba(0, 122, 255, 0.25);
}

.mod-contracts-pagination .page-btns button:disabled {
    opacity: 0.30;
    cursor: not-allowed;
    pointer-events: none;
}

/* ========================================
    5.5: 表单网格 — 自适应内容排列 / 12px 间距
    ======================================== */
.ctr-form-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px 14px;
}

@media (max-width: 991.98px) {
    .ctr-form-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 575.98px) {
    .ctr-form-grid {
        grid-template-columns: minmax(0, 1fr);
    }
}

.ctr-form-group {
    display: flex;
    flex-direction: column;
    gap: 3px;
    position: relative;
}

.ctr-form-group.full-width {
    grid-column: 1 / -1;
}

.ctr-form-group label {
    font-size: 11.5px;
    font-weight: 500;
    color: var(--color-text-secondary);
    letter-spacing: 0;
}

.ctr-form-group .required::after {
    content: ' *';
    color: var(--color-danger);
}

.ctr-form-group input:not([type="checkbox"]):not([type="radio"]):not([type="file"]),
.ctr-form-group select,
.ctr-form-group textarea {
    height: 36px;
    min-height: 36px;
    padding: 0 10px;
    border: 1px solid var(--color-input-border);
    border-radius: 8px;
    font-size: 13px;
    background: var(--color-input-bg);
    color: var(--color-text);
    outline: none;
    transition: all var(--transition-fast) var(--ease-out);
    font-family: var(--font-family);
}

.ctr-form-group textarea {
    height: auto;
    min-height: 60px;
    padding: 8px 10px;
    resize: vertical;
}

.ctr-form-group input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):focus,
.ctr-form-group select:focus,
.ctr-form-group textarea:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.25);
}

/* ========================================
   5.6: 上传区域 — 虚线描边 + hover 浅蓝底 / 12px 圆角
   ======================================== */
.ctr-upload-zone {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: 1px dashed var(--color-border);
    border-radius: 8px;
    padding: 8px 12px;
    text-align: center;
    cursor: pointer;
    transition: all var(--transition-fast) var(--ease-out);
    background: var(--color-bg);
}

.ctr-upload-zone:hover {
    border-color: var(--color-primary);
    background: rgba(0, 122, 255, 0.04);
}

.ctr-upload-zone i {
    font-size: 18px;
    color: var(--color-text-tertiary);
    transition: color var(--transition-fast) var(--ease-out);
}

.ctr-upload-zone:hover i {
    color: var(--color-primary);
}

.ctr-upload-zone p {
    margin: 0;
    font-size: 12px;
    color: var(--color-text-tertiary);
}

.ctr-attachment-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 6px;
}

.ctr-attachment-item {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    background: var(--color-primary-bg);
    border: none;
    border-radius: var(--radius-full);
    font-size: 11.5px;
    font-weight: 500;
    color: var(--color-primary);
}

.ctr-attachment-item .remove-att {
    cursor: pointer;
    color: var(--color-text-tertiary);
    font-size: 14px;
    font-weight: 600;
    line-height: 1;
    transition: color var(--transition-fast);
}

.ctr-attachment-item .remove-att:hover {
    color: var(--color-danger);
}

.ctr-attachment-link {
    text-decoration: none;
    cursor: pointer;
    transition: all var(--transition-fast) var(--ease-out);
}

.ctr-attachment-link:hover {
    background: var(--color-primary);
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 122, 255, 0.3);
}

.ctr-attachment-link i {
    font-size: 14px;
}

/* ========================================
   5.7: 详情页标签 — 下划线样式 / 16px 间距 / 蓝色激活
   ======================================== */
/* 合同详情：固定弹窗高度，切换页签时高度保持一致 */
#ctrDetailModal .modal-dialog {
    height: min(86vh, 920px);
}

#ctrDetailModal .modal-content {
    height: 100%;
}

#ctrDetailModal .modal-body {
    min-height: 0;
    padding-top: 0;
    overflow-y: auto;
    scrollbar-gutter: stable;
}

#ctrDetailModal .ctr-detail-tabs {
    position: sticky;
    top: 0;
    z-index: 3;
    margin-bottom: 0;
    padding-top: 14px;
    padding-bottom: 12px;
    background: var(--color-card);
}

/* 固定高度下的详情内容布局：宽屏两列，基本信息/备注跨列 */
#ctrDetailModal .ctr-detail-sections {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0 28px;
    align-items: start;
}

#ctrDetailModal .ctr-detail-section {
    margin-bottom: 10px;
    padding-bottom: 8px;
}

#ctrDetailModal .ctr-section-title {
    margin-bottom: 8px;
}

#ctrDetailModal .ctr-detail-section-wide {
    grid-column: 1 / -1;
}

#ctrDetailModal .ctr-detail-info {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 8px 12px;
}

#ctrDetailModal .ctr-detail-info .info-item {
    padding: 4px 0;
}

#ctrDetailModal .ctr-detail-tab-content[data-ctrtab="finance"] h6 {
    margin-bottom: 8px;
}

.ctr-detail-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
}

.ctr-detail-toolbar .toolbar-note {
    font-size: 12px;
    color: var(--color-text-tertiary);
}

.ctr-detail-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 180px;
    color: var(--color-text-tertiary);
    font-size: 13px;
}

.ctr-detail-empty i {
    font-size: 28px;
    opacity: 0.45;
}

.ctr-table-scroll {
    overflow-x: auto;
}

#ctrDetailModal .ctr-detail-tab-content td.ctr-text-wrap,
#ctrDetailModal .ctr-detail-tab-content td.ctr-change-reason {
    white-space: normal;
    word-break: break-all;
}

#ctrDetailModal .ctr-change-reason {
    min-width: 160px;
    max-width: 260px;
}

@media (max-width: 991.98px) {
    #ctrDetailModal .ctr-detail-sections {
        grid-template-columns: minmax(0, 1fr);
    }
}

@media (max-width: 767.98px) {
    #ctrDetailModal .modal-dialog {
        height: 92vh;
    }
}

.ctr-detail-tabs {
    display: flex;
    gap: var(--space-lg);
    border-bottom: 1px solid var(--color-border);
    margin-bottom: var(--space-lg);
    padding-bottom: 0;
}

.ctr-detail-tabs .ctr-tab-btn {
    padding: 12px 0;
    border: none;
    background: transparent;
    font-size: 14px;
    font-weight: 500;
    color: var(--color-text-tertiary);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    transition: all var(--transition-fast) var(--ease-out);
    letter-spacing: 0;
}

.ctr-detail-tabs .ctr-tab-btn.active {
    color: var(--color-primary);
    border-bottom-color: var(--color-primary);
    font-weight: 600;
}

.ctr-detail-tabs .ctr-tab-btn:hover:not(.active) {
    color: var(--color-text-secondary);
}

.ctr-detail-tab-content {
    display: none;
}

.ctr-detail-tab-content.active {
    display: block;
    animation: ctrTabFadeIn 0.2s var(--ease-out);
}

@keyframes ctrTabFadeIn {
    from { opacity: 0; transform: translateY(4px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ========================================
   Detail info grid
   ======================================== */
.ctr-detail-info {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: var(--space-md);
}

.ctr-detail-info .info-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: var(--space-sm) 0;
}

.ctr-detail-info .info-label {
    font-size: 12px;
    font-weight: 500;
    color: var(--color-text-tertiary);
    letter-spacing: 0;
}

.ctr-detail-info .info-value {
    font-size: var(--font-size-sm);
    font-weight: 500;
    color: var(--color-text);
}

/* ========================================
   5.8: 分类 Capsule — 浅蓝底 + 蓝色文字 + 全圆角
   ======================================== */
.ctr-cat-list {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-sm);
    margin-bottom: var(--space-md);
}

.ctr-cat-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    background: var(--color-primary-bg);
    color: var(--color-primary);
    border-radius: var(--radius-full);
    font-size: 13px;
    font-weight: 500;
}

.ctr-cat-item .cat-del {
    cursor: pointer;
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-size: 12px;
    font-weight: 600;
    transition: all var(--transition-fast) var(--ease-out);
    color: var(--color-primary);
    opacity: 0.6;
}

.ctr-cat-item .cat-del:hover {
    background: var(--color-danger);
    color: #fff;
    opacity: 1;
}

/* ========================================
   Form sections (new layout)
   ======================================== */
.ctr-form-section {
    margin-bottom: 14px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--color-border-light);
}

.ctr-form-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.ctr-section-title {
    font-size: 12.5px;
    font-weight: 600;
    color: var(--color-text-secondary);
    margin-bottom: 10px;
    padding-bottom: 5px;
    border-bottom: 2px solid var(--color-primary);
    display: inline-block;
    letter-spacing: 0;
}

/* ========================================
   Detail sections (new layout)
   ======================================== */
.ctr-detail-sections {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.ctr-detail-section {
    margin-bottom: var(--space-lg);
    padding-bottom: var(--space-md);
    border-bottom: 1px solid var(--color-border-light);
}

.ctr-detail-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.ctr-detail-remark {
    padding: var(--space-md);
    background: var(--color-bg);
    border-radius: var(--radius-md);
    font-size: var(--font-size-sm);
    color: var(--color-text);
    line-height: 1.6;
    white-space: pre-wrap;
}

/* ========================================
   Receipt/Payment type badge
   ======================================== */
.ctr-rp-badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: var(--radius-full);
    font-size: 12px;
    font-weight: 500;
}

.ctr-rp-badge.rp-receipt {
    background: rgba(52, 199, 89, 0.10);
    color: #248A3D;
}

.ctr-rp-badge.rp-payment {
    background: rgba(255, 149, 0, 0.10);
    color: #C97900;
}

.ctr-rp-badge.rp-other {
    color: var(--color-text-tertiary);
}

/* ========================================
   Project picker
   ======================================== */
.ctr-project-picker {
    display: flex;
    align-items: center;
    gap: 0;
    position: relative;
}

.ctr-project-picker input[type="text"] {
    flex: 1;
    cursor: pointer;
    background: var(--color-bg);
    border-radius: var(--radius-md) 0 0 var(--radius-md);
}

.ctr-project-picker input[type="text"]:focus {
    border-color: var(--color-primary);
}

.ctr-project-clear {
    width: 44px;
    height: 44px;
    border: 1px solid var(--color-input-border);
    border-left: none;
    background: var(--color-input-bg);
    color: var(--color-text-tertiary);
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast) var(--ease-out);
}

.ctr-project-clear:hover {
    color: var(--color-danger);
    background: rgba(255, 59, 48, 0.06);
}

.ctr-project-select-item {
    cursor: pointer;
    transition: background var(--transition-fast) var(--ease-out);
}

.ctr-project-select-item:hover {
    background: var(--color-table-hover);
}

.ctr-project-select-item:active {
    background: var(--color-primary-bg);
}

/* ========================================
   5.10: 暗色模式
   ======================================== */
[data-theme="dark"] .mod-contracts-table-wrap {
    background: var(--color-card);
}

[data-theme="dark"] .mod-contracts-table thead th {
    background: var(--color-bg);
    border-bottom-color: var(--color-border);
}

[data-theme="dark"] .mod-contracts-table tbody td {
    border-bottom-color: var(--color-border-light);
}

[data-theme="dark"] .mod-contracts-table tbody tr:hover {
    background: rgba(10, 132, 255, 0.08);
}

[data-theme="dark"] .ctr-status-badge.status-active {
    background: rgba(50, 215, 75, 0.15);
    color: #32D74B;
}

[data-theme="dark"] .ctr-status-badge.status-completed {
    background: rgba(10, 132, 255, 0.12);
    color: #0A84FF;
}

[data-theme="dark"] .ctr-status-badge.status-terminated {
    background: rgba(255, 69, 58, 0.15);
    color: #FF453A;
}

[data-theme="dark"] .ctr-status-badge.is-approved {
    background: rgba(48, 209, 88, 0.16);
    color: #30D158;
}

[data-theme="dark"] .ctr-status-badge.is-pending {
    background: rgba(255, 159, 10, 0.18);
    color: #FF9F0A;
}

[data-theme="dark"] .ctr-upload-zone {
    border-color: var(--color-border);
    background: var(--color-bg);
}

[data-theme="dark"] .ctr-upload-zone:hover {
    border-color: var(--color-primary);
    background: rgba(10, 132, 255, 0.06);
}

[data-theme="dark"] .mod-contracts-pagination .page-btns button.active {
    background: var(--color-primary);
    box-shadow: 0 2px 8px rgba(10, 132, 255, 0.30);
}

[data-theme="dark"] .mod-contracts-toolbar select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23aaa' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
}

[data-theme="dark"] .ctr-form-section {
    border-bottom-color: var(--color-border);
}

[data-theme="dark"] .ctr-detail-section {
    border-bottom-color: var(--color-border);
}

[data-theme="dark"] .ctr-detail-remark {
    background: rgba(255, 255, 255, 0.04);
}

[data-theme="dark"] .ctr-rp-badge.rp-receipt {
    background: rgba(50, 215, 75, 0.15);
    color: #32D74B;
}

[data-theme="dark"] .ctr-rp-badge.rp-payment {
    background: rgba(255, 159, 10, 0.15);
    color: #FF9F0A;
}

[data-theme="dark"] .ctr-project-clear:hover {
    background: rgba(255, 69, 58, 0.12);
}

/* 列筛选面板 */
.ctr-col-item { transition: background .15s; }
.ctr-col-item:hover { background: var(--color-bg); }
.ctr-col-toggle { accent-color: var(--color-primary); }
.ctr-col-select-all { color: var(--color-primary); text-decoration: none; }
.ctr-col-select-all:hover { text-decoration: underline; }

.ctr-col-panel {
    position: fixed;
    z-index: 9999;
    min-width: 200px;
    max-height: 400px;
    overflow-y: auto;
    background: var(--color-card);
    border: 1px solid var(--color-border);
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, .15);
    padding: 8px 0;
}

/* ===== 附件预览（交互对齐财务中心） ===== */
.ctr-attachment-item > span:not(.remove-att) {
    max-width: 240px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ctr-attachment-link:hover .remove-att {
    color: rgba(255, 255, 255, 0.85);
}

.ctr-att-preview-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}

.ctr-att-preview-tab {
    border: 1px solid var(--color-border);
    background: var(--color-bg);
    color: var(--color-text-secondary);
    border-radius: var(--radius-full);
    padding: 5px 11px;
    font-size: 12px;
    max-width: 260px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ctr-att-preview-tab.active,
.ctr-att-preview-tab:hover {
    border-color: var(--color-primary);
    color: var(--color-primary);
    background: var(--color-primary-bg);
}

.ctr-att-preview-content {
    min-height: 180px;
}

.ctr-att-preview-image-wrap {
    text-align: center;
    overflow: auto;
    max-height: 70vh;
}

.ctr-att-preview-image {
    max-width: 100%;
    max-height: 70vh;
    border-radius: var(--radius-md);
}

.ctr-att-preview-frame {
    width: 100%;
    height: 70vh;
    border: 0;
    border-radius: var(--radius-md);
    background: var(--color-bg);
}

.ctr-att-preview-text {
    max-height: 70vh;
    overflow: auto;
    margin: 0;
    padding: 12px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background: var(--color-bg);
    color: var(--color-text);
    font-size: 12px;
    line-height: 1.7;
    white-space: pre-wrap;
    word-break: break-all;
}

/* 附件页签内嵌预览 */
.ctr-inline-att-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
}

.ctr-inline-att-header .ctr-att-preview-tabs {
    margin-bottom: 0;
}

.ctr-inline-att-header .btn {
    flex-shrink: 0;
}

.ctr-inline-att-content {
    min-height: 220px;
}

#ctrDetailModal .ctr-inline-att-content .ctr-att-preview-frame {
    height: clamp(160px, calc(86vh - 320px), 50vh);
}

#ctrDetailModal .ctr-inline-att-content .ctr-att-preview-image-wrap,
#ctrDetailModal .ctr-inline-att-content .ctr-att-preview-image {
    max-height: clamp(160px, calc(86vh - 320px), 50vh);
}

#ctrDetailModal .ctr-inline-att-content .ctr-att-preview-text {
    max-height: clamp(140px, calc(86vh - 360px), 45vh);
}

/* ========================================
   合同详情视觉层级
   ======================================== */
#ctrDetailModal .modal-header {
    align-items: flex-start;
    padding: 16px 20px 10px;
}

.ctr-detail-heading {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

.ctr-detail-heading .modal-title {
    font-size: 17px;
    font-weight: 650;
    line-height: 1.35;
}

.ctr-detail-subtitle {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    font-size: 12px;
    color: var(--color-text-tertiary);
}

.ctr-detail-number {
    padding: 2px 7px;
    border-radius: 6px;
    background: var(--color-bg);
    color: var(--color-text-secondary);
    font-family: 'SF Mono', 'Consolas', monospace;
    font-size: 11.5px;
}

.ctr-detail-total {
    font-size: 13px;
    font-weight: 650;
    color: var(--color-text);
}

.ctr-detail-total::before {
    content: '¥';
    margin-right: 2px;
    font-size: 11px;
    font-weight: 500;
    color: var(--color-text-tertiary);
}

/* 页签：分段控件 */
#ctrDetailModal .ctr-detail-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    padding: 4px;
    margin-bottom: 14px;
    background: var(--color-bg);
    border: 1px solid var(--color-border-light);
    border-radius: 12px;
    position: sticky;
    top: 0;
    z-index: 3;
}

#ctrDetailModal .ctr-detail-tabs .ctr-tab-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin: 0;
    padding: 7px 14px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--color-text-secondary);
    font-size: 13px;
    font-weight: 500;
    line-height: 1;
    cursor: pointer;
    transition: background var(--transition-fast), color var(--transition-fast), box-shadow var(--transition-fast);
}

#ctrDetailModal .ctr-detail-tabs .ctr-tab-btn i {
    font-size: 13px;
}

#ctrDetailModal .ctr-detail-tabs .ctr-tab-btn:hover:not(.active) {
    background: var(--color-card);
    color: var(--color-text);
}

#ctrDetailModal .ctr-detail-tabs .ctr-tab-btn.active {
    background: var(--color-card);
    color: var(--color-primary);
    font-weight: 600;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

.ctr-tab-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 9px;
    background: var(--color-border-light);
    color: var(--color-text-tertiary);
    font-size: 10.5px;
    font-weight: 600;
}

#ctrDetailModal .ctr-detail-tabs .ctr-tab-btn.active .ctr-tab-count {
    background: var(--color-primary-bg);
    color: var(--color-primary);
}

/* 基本信息：卡片分组 */
#ctrDetailModal .ctr-detail-sections {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    align-items: start;
}

#ctrDetailModal .ctr-detail-section {
    margin: 0;
    padding: 12px 14px;
    background: var(--color-bg);
    border: 1px solid var(--color-border-light);
    border-radius: 12px;
}

#ctrDetailModal .ctr-detail-section-wide {
    grid-column: 1 / -1;
}

#ctrDetailModal .ctr-section-title {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 0 0 8px;
    padding: 0 0 7px;
    border-bottom: 1px solid var(--color-border-light);
    font-size: 12px;
    font-weight: 600;
    color: var(--color-text-secondary);
}

#ctrDetailModal .ctr-section-title::before {
    content: '';
    width: 3px;
    height: 12px;
    border-radius: 2px;
    background: var(--color-primary);
}

#ctrDetailModal .ctr-detail-info {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 8px 12px;
}

#ctrDetailModal .ctr-detail-info .info-item {
    padding: 3px 0;
}

#ctrDetailModal .ctr-detail-info .info-label {
    font-size: 11px;
}

#ctrDetailModal .ctr-detail-info .info-value {
    font-size: 13px;
}

#ctrDetailModal .ctr-detail-info .info-value.ctr-amount {
    font-weight: 600;
}

#ctrDetailModal .ctr-detail-remark {
    padding: 10px 12px;
    background: var(--color-card);
    font-size: 12.5px;
}

/* 详情：合同内容（富文本） */
.ctr-detail-richtext {
    padding: 10px 12px;
    background: var(--color-card);
    border: 1px solid var(--color-border-light);
    border-radius: var(--radius-md);
    font-size: 13px;
    line-height: 1.7;
    color: var(--color-text);
    word-break: break-word;
    max-height: 52vh;
    overflow: auto;
}

.ctr-detail-richtext p { margin: 0 0 8px; }

.ctr-detail-richtext p:last-child { margin-bottom: 0; }

.ctr-detail-richtext ul,
.ctr-detail-richtext ol { padding-left: 20px; margin: 4px 0; }

/* 财务/变更：内容卡片 */
.ctr-detail-block {
    margin-bottom: 12px;
    padding: 12px 14px;
    background: var(--color-bg);
    border: 1px solid var(--color-border-light);
    border-radius: 12px;
}

.ctr-detail-block:last-child {
    margin-bottom: 0;
}

.ctr-detail-block-head {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}

.ctr-detail-block-title {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--color-text-secondary);
}

.ctr-detail-block-title i {
    color: var(--color-primary);
}

.ctr-detail-block-count {
    min-width: 20px;
    padding: 1px 6px;
    border-radius: 10px;
    background: var(--color-primary-bg);
    color: var(--color-primary);
    font-size: 11px;
    font-weight: 600;
    text-align: center;
}

.ctr-detail-block-empty {
    padding: 14px 0;
    text-align: center;
    color: var(--color-text-tertiary);
    font-size: 12.5px;
}

.ctr-detail-block .mod-contracts-table {
    background: var(--color-card);
    border-radius: 8px;
}

.ctr-detail-block .mod-contracts-table thead th {
    background: transparent;
}

.ctr-detail-block .mod-contracts-table tbody tr:last-child td {
    border-bottom: none;
}

.ctr-detail-block tfoot td {
    font-weight: 600;
    color: var(--color-text);
}

/* 变更金额对比 */
#ctrDetailModal .ctr-change-table .ctr-amount-old {
    color: var(--color-text-tertiary);
}

#ctrDetailModal .ctr-change-table .ctr-amount-new {
    color: var(--color-primary);
    font-weight: 650;
}

/* 附件：固定页签高度，预览区填满剩余空间 */
#ctrDetailModal .ctr-detail-tab-content[data-ctrtab="attachments"] {
    height: calc(100% - 78px);
    min-height: 300px;
}

#ctrDetailModal .ctr-inline-att-preview {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
}

#ctrDetailModal .ctr-inline-att-header {
    flex-shrink: 0;
    margin-bottom: 10px;
}

#ctrDetailModal .ctr-inline-att-content {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 0;
    padding: 12px;
    background: var(--color-bg);
    border: 1px solid var(--color-border-light);
    border-radius: 12px;
    overflow: auto;
}

#ctrDetailModal .ctr-inline-att-content .ctr-att-preview-image-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    max-height: none;
    overflow: hidden;
}

#ctrDetailModal .ctr-inline-att-content .ctr-att-preview-image {
    max-width: 100%;
    max-height: 100%;
}

#ctrDetailModal .ctr-inline-att-content .ctr-att-preview-frame {
    width: 100%;
    height: 100%;
    background: var(--color-card);
}

#ctrDetailModal .ctr-inline-att-content .ctr-att-preview-text {
    width: 100%;
    height: 100%;
    max-height: none;
    margin: 0;
    background: var(--color-card);
}

/* 矮屏回退单列 */
@media (max-width: 991.98px) {
    #ctrDetailModal .ctr-detail-sections {
        grid-template-columns: minmax(0, 1fr);
    }
}

/* 变更记录：字段级卡片列表 */
.ctr-change-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.ctr-change-item {
    padding: 12px 14px;
    background: var(--color-bg);
    border: 1px solid var(--color-border-light);
    border-radius: 12px;
}

.ctr-change-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 8px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--color-border-light);
}

.ctr-change-user {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--color-text-secondary);
}

.ctr-change-user i {
    color: var(--color-primary);
}

.ctr-change-time {
    font-size: 11.5px;
    color: var(--color-text-tertiary);
    font-variant-numeric: tabular-nums;
}

.ctr-change-fields {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.ctr-change-field {
    display: grid;
    grid-template-columns: 84px minmax(0, 1fr) 14px minmax(0, 1fr);
    align-items: center;
    gap: 8px;
    font-size: 12.5px;
}

.ctr-change-field .field-label {
    color: var(--color-text-tertiary);
    font-size: 11.5px;
}

.ctr-change-field .field-old {
    color: var(--color-text-tertiary);
    word-break: break-all;
}

.ctr-change-field .field-new {
    color: var(--color-text);
    font-weight: 600;
    word-break: break-all;
}

.ctr-change-field i {
    font-size: 11px;
    color: var(--color-text-tertiary);
    text-align: center;
}

@media (max-width: 575.98px) {
    .ctr-change-field {
        grid-template-columns: 70px minmax(0, 1fr) 12px minmax(0, 1fr);
        gap: 6px;
    }
}

/* ===== R1：筛选树 / 进度 / 合计 / 商品明细 / 详情汇总 ===== */
.ctr-list-layout {
    display: grid;
    grid-template-columns: 220px minmax(0, 1fr);
    gap: 12px;
    align-items: start;
}

.ctr-list-main { min-width: 0; }

.ctr-filter-tree {
    border: 1px solid var(--color-border);
    border-radius: 8px;
    padding: 8px 6px;
    background: var(--color-card);
    max-height: 620px;
    overflow-y: auto;
    font-size: 13px;
}

.ctr-tree-loading { color: var(--color-text-tertiary); padding: 8px; }

.ctr-tree-group { margin-bottom: 6px; }

.ctr-tree-title {
    font-weight: 600;
    color: var(--color-text-secondary);
    padding: 6px 8px 4px;
    font-size: 12px;
    letter-spacing: .3px;
}

.ctr-tree-node {
    display: block;
    padding: 4px 8px;
    border-radius: 4px;
    color: var(--color-text);
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ctr-tree-node:hover { background: var(--color-table-hover); }
.ctr-tree-node.active { background: var(--color-primary-soft, rgba(13,110,253,.12)); color: var(--color-primary); font-weight: 600; }

.ctr-tree-node.ctr-depth-1 { padding-left: 22px; }
.ctr-tree-node.ctr-depth-2 { padding-left: 38px; }
.ctr-tree-node.ctr-depth-3 { padding-left: 54px; }
.ctr-tree-node.ctr-depth-4 { padding-left: 70px; }
.ctr-tree-node.ctr-depth-5 { padding-left: 86px; }

.ctr-progress { min-width: 90px; }
.ctr-progress-track {
    height: 6px;
    background: var(--color-border);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 2px;
}
.ctr-progress-bar {
    height: 100%;
    width: 0;
    background: var(--color-primary);
    transition: width .2s ease;
}
.ctr-progress-text { font-size: 11px; color: var(--color-text-tertiary); }

.ctr-exec-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    background: var(--color-table-hover);
    color: var(--color-text-secondary);
    font-size: 12px;
    white-space: nowrap;
}
.ctr-exec-badge.exec-执行中 { background: rgba(13,110,253,.12); color: #0d6efd; }
.ctr-exec-badge.exec-已完成 { background: rgba(25,135,84,.12); color: #198754; }
.ctr-exec-badge.exec-终止,
.ctr-exec-badge.exec-注销,
.ctr-exec-badge.exec-撤销 { background: rgba(220,53,69,.12); color: #dc3545; }

.ctr-total-row td {
    background: var(--color-bg-raised);
    font-weight: 600;
    border-top: 2px solid var(--color-border);
}
.ctr-total-label { text-align: right; color: var(--color-text-secondary); }

.ctr-section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}
.ctr-section-head .ctr-section-title { margin: 0; }
.ctr-section-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.ctr-partner-code {
    font-family: 'SF Mono', 'Consolas', 'Menlo', monospace;
    font-size: 11px;
    color: var(--color-text-tertiary);
}

.ctr-goods-wrap { overflow-x: auto; }
.ctr-goods-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.ctr-goods-table th,
.ctr-goods-table td {
    border: 1px solid var(--color-border);
    padding: 4px 6px;
    text-align: left;
}
.ctr-goods-table th { background: var(--color-bg-raised); font-weight: 600; white-space: nowrap; }
.ctr-goods-table input {
    width: 100%;
    border: none;
    background: transparent;
    padding: 2px 0;
    font-size: 13px;
}
.ctr-goods-table input:focus { outline: 1px solid var(--color-primary); border-radius: 3px; }
.ctr-goods-table .ctr-goods-price,
.ctr-goods-table .ctr-goods-qty { text-align: right; }
.ctr-goods-total-label { text-align: right; font-weight: 600; }
.ctr-form-hint { font-size: 12px; margin-top: 6px; }

.ctr-check-label { display: flex; align-items: center; gap: 6px; font-weight: 400; }
.ctr-custom-section summary { cursor: pointer; }

.ctr-detail-summary {
    display: flex;
    flex-wrap: wrap;
    gap: 18px;
    padding: 10px 12px;
    margin-bottom: 12px;
    border-radius: 8px;
    background: var(--color-bg-raised);
    border: 1px solid var(--color-border);
}
.ctr-summary-item { display: flex; flex-direction: column; gap: 2px; }
.ctr-summary-item em { font-style: normal; font-size: 12px; color: var(--color-text-tertiary); }
.ctr-summary-item b { font-size: 15px; color: var(--color-text); }

@media (max-width: 991.98px) {
    .ctr-list-layout { grid-template-columns: 1fr; }
    .ctr-filter-tree { max-height: 200px; }
}

/* ===== R2：里诺式主界面布局 ===== */
.ctr-page-body {
    display: flex;
    flex-direction: column;
    gap: 8px;
    height: calc(100vh - 190px);
    min-height: 560px;
    overflow: hidden;
}

.ctr-searchbar {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    padding: 8px 10px;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    background: var(--color-card);
}

.ctr-search-label { color: var(--color-text-secondary); font-size: 13px; }

.ctr-search-input {
    width: 220px;
    height: 30px;
    padding: 0 10px;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    background: var(--color-bg);
    color: var(--color-text);
}

.ctr-toolbar-right { margin-left: auto; display: flex; gap: 6px; flex-wrap: wrap; }

.ctr-btn-add { background: #16a34a; border: 1px solid #16a34a; color: #fff; }
.ctr-btn-add:hover { background: #15803d; }
.ctr-btn-query { background: #f59e0b; border: 1px solid #f59e0b; color: #fff; }
.ctr-btn-query:hover { background: #d97706; }
.ctr-btn-plan { background: var(--color-card); border: 1px solid var(--color-border); color: var(--color-text); }
.ctr-btn-outline { background: var(--color-card); border: 1px solid var(--color-border); color: var(--color-text); }
.ctr-btn-outline:hover { border-color: var(--color-primary); color: var(--color-primary); }

.ctr-layout-top {
    display: grid;
    grid-template-columns: 220px minmax(0, 1fr);
    gap: 8px;
    flex: 1 1 50%;
    min-height: 0;
}

.ctr-main-panel {
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    background: var(--color-card);
    overflow: hidden;
}

.ctr-list-toolbar {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 8px;
    border-bottom: 1px solid var(--color-border);
    flex-wrap: wrap;
}

.ctr-selection-hint {
    margin-left: auto;
    font-size: 12px;
    color: var(--color-text-tertiary);
    max-width: 320px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ctr-table-scroll { flex: 1 1 auto; overflow: auto; min-height: 0; }

.ctr-table-scroll .ctr-list-table { min-width: 2200px; }

.ctr-row-active > td { background: rgba(250, 204, 21, 0.18) !important; }

.ctr-layout-bottom {
    display: flex;
    flex-direction: column;
    flex: 1 1 42%;
    min-height: 0;
    border: 1px solid #1e9fff;
    border-radius: 8px;
    background: var(--color-card);
    overflow: hidden;
}

.ctr-subtabs {
    display: flex;
    gap: 2px;
    padding: 6px 8px 0;
    border-bottom: 1px solid var(--color-border);
    flex-wrap: wrap;
}

.ctr-subtab {
    padding: 6px 14px;
    border: 1px solid transparent;
    border-bottom: none;
    border-radius: 6px 6px 0 0;
    background: transparent;
    color: var(--color-text-secondary);
    font-size: 13px;
    cursor: pointer;
}

.ctr-subtab:hover { color: var(--color-primary); }

.ctr-subtab.active {
    background: var(--color-card);
    border-color: var(--color-border);
    color: var(--color-primary);
    font-weight: 600;
}

.ctr-subpanel { flex: 1 1 auto; display: flex; flex-direction: column; min-height: 0; }

.ctr-sub-toolbar {
    display: flex;
    gap: 6px;
    padding: 6px 8px;
    border-bottom: 1px solid var(--color-border);
    flex-wrap: wrap;
}

.ctr-sub-table-wrap { flex: 1 1 auto; overflow: auto; min-height: 0; }

.ctr-sub-table { width: 100%; table-layout: fixed; }

.ctr-sub-table th, .ctr-sub-table td { white-space: nowrap; }

.ctr-sub-actions-col { width: 90px; }
.ctr-sub-actions { display: flex; gap: 4px; justify-content: center; }

.ctr-sub-empty, .ctr-sub-empty-cell {
    padding: 28px 12px;
    text-align: center;
    color: var(--color-text-tertiary);
    font-size: 13px;
}

@media (max-width: 991.98px) {
    .ctr-page-body { height: auto; }
    .ctr-layout-top { grid-template-columns: 1fr; }
    .ctr-filter-tree { max-height: 180px; }
    .ctr-layout-bottom { min-height: 320px; }
}

/* ===== R2：打印预览 ===== */
.ctr-print-toggles { display: flex; gap: 12px; flex-wrap: wrap; margin-left: auto; margin-right: 14px; }
.ctr-print-toggle { display: flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 400; color: var(--color-text-secondary); }
.ctr-print-body { padding: 0; overflow: hidden; }
.ctr-print-frame { width: 100%; height: 68vh; border: 0; background: #fff; display: block; }

/* ===== 审计修正：紧凑布局（2026-10-21） ===== */
.ctr-page-body {
    height: calc(100vh - 150px);
    gap: 6px;
}

.ctr-searchbar {
    padding: 5px 10px;
    gap: 6px;
}

.ctr-searchbar .btn { padding: 3px 9px; font-size: 13px; }
.ctr-search-input { width: 180px; height: 28px; }
.ctr-toolbar-right { gap: 5px; }

.ctr-layout-top { flex: 1.2 1 0; }
.ctr-layout-bottom { flex: 1 1 0; min-height: 210px; }

.ctr-list-toolbar { padding: 4px 8px; }
.ctr-list-toolbar .btn { padding: 2px 8px; font-size: 12px; }

.ctr-list-table th,
.ctr-list-table td {
    height: 38px;
    padding: 4px 8px;
    max-width: 220px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 13px;
}

.ctr-list-table thead th { position: sticky; top: 0; z-index: 2; }

.ctr-tree-node { padding: 3px 8px; font-size: 12.5px; }
.ctr-tree-title { padding: 4px 8px 3px; font-size: 13px; }
.ctr-tree-group { margin-bottom: 2px; }

.ctr-subtab { padding: 5px 12px; font-size: 12.5px; }
.ctr-sub-toolbar { padding: 4px 8px; }
.ctr-sub-toolbar .btn { padding: 2px 8px; font-size: 12px; }

.ctr-sub-table th,
.ctr-sub-table td {
    height: 34px;
    padding: 4px 8px;
    font-size: 12.5px;
    max-width: 260px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ctr-progress { min-width: 78px; }
.ctr-progress-text { font-size: 10px; }
.ctr-exec-badge { padding: 1px 6px; font-size: 11px; }
.ctr-status-badge { font-size: 11px; }

.pagination-bar, .mod-contracts-pagination { font-size: 12px; }

@media (max-width: 1366px) {
    .ctr-search-input { width: 140px; }
    .ctr-toolbar-right .btn { padding: 3px 7px; }
    .ctr-layout-top { flex: 1.25 1 0; }
}

/* 主表已移除行内操作列，表格不再需要右侧吸附列 */
.ctr-table-scroll::-webkit-scrollbar { width: 10px; height: 10px; }
.ctr-table-scroll::-webkit-scrollbar-thumb { background: var(--color-border); border-radius: 5px; }
.ctr-filter-tree { scrollbar-width: thin; }

/* 用 ID 提升特异性，覆盖默认表格内边距 */
#ctrMainTable thead th {
    height: 40px;
    padding: 5px 8px;
    font-size: 12px;
    line-height: 1.4;
}
#ctrMainTable tbody td {
    height: 44px;
    padding: 5px 8px;
    font-size: 13px;
    line-height: 1.4;
}
#ctrMainTable .ctr-actions .btn { padding: 1px 5px; font-size: 12px; }
#ctrMainTable tfoot td { height: 30px; padding: 4px 8px; font-size: 12px; }

/* 行高与按钮再压缩 */
#ctrMainTable tbody td { height: 46px; padding: 4px 8px; }
#ctrMainTable thead th { height: 42px; padding: 4px 8px; }
#ctrMainTable .ctr-actions { gap: 3px; }
#ctrMainTable .ctr-actions .btn {
    padding: 1px 4px;
    font-size: 11px;
    line-height: 1.4;
    height: 24px;
    display: inline-flex;
    align-items: center;
}
#ctrMainTable tfoot tr { position: sticky; bottom: 0; z-index: 3; background: var(--color-bg-raised); }

/* 行高与操作列最终形态 */
#ctrMainTable tbody td { height: 34px; padding: 2px 8px; line-height: 1.2; }
#ctrMainTable thead th { height: 36px; padding: 4px 8px; line-height: 1.3; }

/* 主表已无勾选框，行高由 34px 控制 */
#ctrMainTable .ctr-actions { display: flex; gap: 4px; justify-content: center; }

/* 合同类弹窗改为高不透明度，避免长表单透出背景影响可读性 */
#ctrFormModal .modal-content,
#ctrDetailModal .modal-content,
#ctrPrintModal .modal-content,
#ctrSubFormModal .modal-content,
#ctrPlanModal .modal-content,
#ctrMoreSearchModal .modal-content {
    background: rgba(255, 255, 255, 0.97);
    backdrop-filter: blur(18px);
}
[data-theme="dark"] #ctrFormModal .modal-content,
[data-theme="dark"] #ctrDetailModal .modal-content,
[data-theme="dark"] #ctrPrintModal .modal-content,
[data-theme="dark"] #ctrSubFormModal .modal-content,
[data-theme="dark"] #ctrPlanModal .modal-content,
[data-theme="dark"] #ctrMoreSearchModal .modal-content {
    background: rgba(28, 28, 30, 0.97);
}

/* 表头文字对比度（暗色下 tertiary 过淡） */
#mod-contracts #ctrMainTable thead th { color: var(--color-text-secondary); }
#ctrSubPanel .ctr-sub-table thead th { color: var(--color-text-secondary); }

/* ===== C0.2 响应式与可用性 ===== */

/* A1 树分组折叠 */
.ctr-tree-title {
    display: flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    user-select: none;
}
.ctr-tree-caret {
    display: inline-block;
    width: 10px;
    font-size: 10px;
    line-height: 1;
    transition: transform .15s ease;
}
.ctr-tree-group.collapsed .ctr-tree-caret { transform: rotate(-90deg); }
.ctr-tree-group.collapsed .ctr-tree-items { display: none; }
.ctr-tree-actions {
    display: flex;
    justify-content: flex-end;
    padding: 2px 6px 4px;
}
.ctr-tree-actions button {
    border: none;
    background: transparent;
    color: var(--color-text-tertiary);
    font-size: 11px;
    cursor: pointer;
    padding: 0 2px;
}
.ctr-tree-actions button:hover { color: var(--color-primary); }

/* A2 表单弹窗宽度与栅格 */
#ctrFormModal .modal-dialog,
#ctrDetailModal .modal-dialog {
    max-width: min(1120px, 96vw);
}
#ctrFormModal .ctr-form-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }

@media (max-width: 1199.98px) {
    #ctrFormModal .ctr-form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 767.98px) {
    #ctrFormModal .ctr-form-grid { grid-template-columns: 1fr; }
}

/* A3 打印预览缩放 */
.ctr-print-zoom {
    height: 30px;
    padding: 0 8px;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    background: var(--color-input-bg);
    color: var(--color-text);
    font-size: 12px;
    margin-right: 8px;
}

/* A4 列设置面板边界 */
#ctrColumnPanel {
    max-height: min(70vh, 520px);
    overflow-y: auto;
    max-width: 320px;
}

/* A5 窄屏 */
@media (max-width: 767.98px) {
    .ctr-page-body { height: auto; gap: 8px; }
    .ctr-searchbar { flex-wrap: wrap; }
    .ctr-toolbar-right { width: 100%; margin-left: 0; justify-content: flex-start; }
    .ctr-layout-top { display: block; }
    .ctr-main-panel { height: 52vh; margin-bottom: 8px; }
    .ctr-filter-tree { max-height: 160px; margin-bottom: 8px; }
    .ctr-layout-bottom { min-height: 320px; }
    .ctr-list-toolbar { flex-wrap: wrap; }
    .ctr-selection-hint { width: 100%; margin-left: 0; }
}

/* A7 间距微调 */
.mod-contracts-pagination { padding: 4px 8px; }
.ctr-layout-bottom { margin-top: 2px; }

/* A6 行操作菜单 */
.ctr-row-action-menu {
    position: absolute;
    z-index: 1080;
    min-width: 140px;
    background: var(--color-card);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    box-shadow: var(--shadow-md);
    padding: 4px;
}
.ctr-row-action-menu button {
    display: block;
    width: 100%;
    text-align: left;
    padding: 6px 10px;
    border: none;
    background: transparent;
    color: var(--color-text);
    font-size: 13px;
    border-radius: 5px;
    cursor: pointer;
}
.ctr-row-action-menu button:hover { background: var(--color-table-hover); }
.ctr-row-action-menu button.danger { color: var(--color-danger); }

/* 窄屏：约束宽度，避免表格撑破页面 */
@media (max-width: 991.98px) {
    .ctr-main-panel,
    .ctr-table-scroll,
    .ctr-sub-table-wrap,
    .ctr-subpanel { width: 100%; max-width: 100%; min-width: 0; }
    .ctr-main-panel { overflow: hidden; }
    .ctr-list-main { min-width: 0; }
    .ctr-searchbar { overflow: hidden; }
    .ctr-search-input { flex: 1 1 auto; width: auto; min-width: 110px; }
    .ctr-toolbar-right { width: 100%; margin-left: 0; justify-content: flex-start; }
    .ctr-layout-top { display: block; }
    .ctr-filter-tree { max-height: 160px; margin-bottom: 8px; }
    .ctr-main-panel { height: 52vh; }
    .ctr-page-body { height: auto; }
}

/* ===== C3.5 富文本编辑器 ===== */
.ctr-rich {
    border: 1px solid var(--color-border);
    border-radius: 8px;
    overflow: hidden;
    background: var(--color-input-bg);
}

.ctr-rich-toolbar {
    display: flex;
    gap: 2px;
    padding: 4px 6px;
    border-bottom: 1px solid var(--color-border);
    background: var(--color-bg-raised);
}

.ctr-rich-toolbar button {
    min-width: 28px;
    height: 26px;
    padding: 0 6px;
    border: 1px solid transparent;
    border-radius: 4px;
    background: transparent;
    color: var(--color-text);
    font-size: 12px;
    line-height: 1;
    cursor: pointer;
}

.ctr-rich-toolbar button:hover {
    background: var(--color-table-hover);
    border-color: var(--color-border);
}

.ctr-rich-editor {
    min-height: 92px;
    max-height: 260px;
    overflow-y: auto;
    padding: 8px 10px;
    font-size: 13px;
    line-height: 1.7;
    color: var(--color-text);
    outline: none;
}

.ctr-rich-editor:empty::before {
    content: attr(data-placeholder);
    color: var(--color-text-tertiary);
    pointer-events: none;
}

.ctr-rich-editor p { margin: 0 0 6px; }
.ctr-rich-editor ul,
.ctr-rich-editor ol { padding-left: 20px; margin: 4px 0; }

/* ===== 2026-10-22 界面优化：左树贯穿 + 主/从表左右对齐 ===== */

/* 1) 隐藏冗余的“合同管理”卡片标题（顶部面包屑已显示模块名） */
#mod-contracts .ctr-page > .mod-card-header { display: none; }

/* 2) 主容器改为两列三行网格：左树贯穿，右侧上主表下从表 */
.ctr-page-body {
    display: grid;
    grid-template-columns: 220px minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr) clamp(200px, 30vh, 300px);
    gap: 6px 8px;
    height: calc(100vh - 80px);
    min-height: 0;
    overflow: hidden;
    padding: 6px 10px 0;
}

/* 桌面端：合同页抵消内容区留白，让主界面更贴近屏幕边缘 */
@media (min-width: 992px) {
    #mod-contracts.module-section {
        margin: -18px;
        width: calc(100% + 36px);
        max-width: calc(100% + 36px);
    }
}

.ctr-page-body > .ctr-searchbar {
    grid-column: 1 / -1;
    grid-row: 1;
    min-height: 40px;
    padding: 3px 8px;
}

/* 搜索/操作栏：控件降为 32px，44px 栏高下留出更均匀的上下间距 */
.ctr-page-body .ctr-search-input {
    height: 32px;
    min-height: 32px;
}

.ctr-page-body .ctr-searchbar .btn {
    height: 32px;
    min-height: 32px;
    padding: 0 9px;
}

/* 顶部区不再自建网格，子项直接参与父级网格 */
.ctr-layout-top { display: contents; }

.ctr-page-body .ctr-filter-tree {
    grid-column: 1;
    grid-row: 2 / span 2;
    height: calc(100% - 4px);
    max-height: none;
    min-height: 0;
    margin-bottom: 0;
}

.ctr-page-body .ctr-main-panel {
    grid-column: 2;
    grid-row: 2;
}

.ctr-page-body .ctr-layout-bottom {
    grid-column: 2;
    grid-row: 3;
    margin-top: 0;
    border-radius: 8px;
    min-height: 0;
    max-width: 1589px;
}

/* 从表面板：高度由底部面板固定高度决定，内部滚动 */
.ctr-page-body .ctr-sub-table-wrap { min-height: 0; }

/* 从表工具条高度对齐清单里的 45px */
.ctr-page-body .ctr-sub-toolbar {
    min-height: 45px;
    align-items: center;
}

/* 从表数据行与表头紧凑到与主表一致 */
#ctrSubPanel .ctr-sub-table tbody td { height: 34px; padding: 2px 8px; }
#ctrSubPanel .ctr-sub-table thead th { height: 32px; padding: 4px 8px; }

/* 批量操作条横跨整行 */
/* 批量操作条已移除 */

/* 3) 主表自适应宽度：固定布局按列宽比例填满容器，列多时自动横向滚动 */
.ctr-table-scroll .ctr-list-table {
    width: 100%;
    min-width: 0;
    table-layout: fixed;
}

/* 3.1) 主表列宽自适应：百分比列随容器等比伸缩，列多时以 min-width 兜底并横向滚动 */
.ctr-list-table .ctr-col-index  { width: 60px; min-width: 60px; }
.ctr-list-table .ctr-col-number { width: 14%; min-width: 100px; }
.ctr-list-table .ctr-col-name   { width: 26%; min-width: 160px; }
.ctr-list-table .ctr-col-amount { width: 11%; min-width: 80px; }
.ctr-list-table .ctr-col-status { width: 9%; min-width: 72px; }
.ctr-list-table .ctr-col-date   { width: 8%; min-width: 90px; }
.ctr-list-table .ctr-col-type   { width: 7%; min-width: 70px; }
.ctr-list-table .ctr-col-tax    { width: 6%; min-width: 60px; }
.ctr-list-table .ctr-col-exec   { width: 8%; min-width: 80px; }
.ctr-list-table .ctr-col-progress { width: 9%; min-width: 90px; }
.ctr-list-table .ctr-col-category,
.ctr-list-table .ctr-col-project,
.ctr-list-table .ctr-col-party,
.ctr-list-table .ctr-col-place,
.ctr-list-table .ctr-col-remark,
.ctr-list-table .ctr-col-dept,
.ctr-list-table .ctr-col-user,
.ctr-list-table .ctr-col-custom { width: 10%; min-width: 110px; }

/* 3.2) 可见列较多时仍铺满容器，仅压缩内边距与字号以容纳更多列 */
.ctr-list-table.ctr-cols-many {
    table-layout: fixed;
    width: 100%;
}
.ctr-list-table.ctr-cols-many th,
.ctr-list-table.ctr-cols-many td {
    padding-left: 4px;
    padding-right: 4px;
    font-size: 12px;
}

/* ===== 2026-10-22 主操作按钮并入搜索条 ===== */
.ctr-searchbar .ctr-selection-hint {
    display: none;
}

.ctr-toolbar-sep {
    width: 1px;
    height: 16px;
    align-self: center;
    background: var(--color-border);
    margin: 0 2px;
}

.ctr-btn-edit { background: #2563eb; border: 1px solid #2563eb; color: #fff; }
.ctr-btn-edit:hover { background: #1d4ed8; border-color: #1d4ed8; color: #fff; }

.ctr-btn-view { background: var(--color-card); border: 1px solid #0284c7; color: #0284c7; }
.ctr-btn-view:hover { background: rgba(2, 132, 199, .1); color: #0369a1; }

.ctr-btn-del { background: var(--color-card); border: 1px solid #dc2626; color: #dc2626; }
.ctr-btn-del:hover { background: rgba(220, 38, 38, .1); color: #b91c1c; }

.ctr-btn-approve { background: var(--color-card); border: 1px solid #16a34a; color: #15803d; }
.ctr-btn-approve:hover { background: rgba(22, 163, 74, .1); color: #166534; }

.ctr-btn-unapprove { background: var(--color-card); border: 1px solid #f59e0b; color: #b45309; }
.ctr-btn-unapprove:hover { background: rgba(245, 158, 11, .12); color: #92400e; }

.ctr-btn-plan { background: var(--color-card); border: 1px solid #7c3aed; color: #6d28d9; }
.ctr-btn-plan:hover { background: rgba(124, 58, 237, .1); color: #5b21b6; }

.ctr-btn-print { background: var(--color-card); border: 1px solid var(--color-border); color: var(--color-text-secondary); }
.ctr-btn-print:hover { border-color: var(--color-text-secondary); color: var(--color-text); }

[data-theme="dark"] .ctr-btn-view { color: #38bdf8; border-color: #0ea5e9; }
[data-theme="dark"] .ctr-btn-view:hover { background: rgba(14, 165, 233, .15); color: #7dd3fc; }
[data-theme="dark"] .ctr-btn-del { color: #f87171; border-color: #ef4444; }
[data-theme="dark"] .ctr-btn-del:hover { background: rgba(239, 68, 68, .15); color: #fca5a5; }
[data-theme="dark"] .ctr-btn-approve { color: #4ade80; border-color: #22c55e; }
[data-theme="dark"] .ctr-btn-approve:hover { background: rgba(34, 197, 94, .15); color: #86efac; }
[data-theme="dark"] .ctr-btn-unapprove { color: #fbbf24; border-color: #f59e0b; }
[data-theme="dark"] .ctr-btn-unapprove:hover { background: rgba(245, 158, 11, .15); color: #fcd34d; }
[data-theme="dark"] .ctr-btn-plan { color: #a78bfa; border-color: #8b5cf6; }
[data-theme="dark"] .ctr-btn-plan:hover { background: rgba(139, 92, 246, .15); color: #c4b5fd; }

/* ===== 2026-10-22 合计标签与表格直角 ===== */
#ctrSubPanel .ctr-total-label {
    text-align: left;
    font-weight: 700;
    color: var(--color-text);
}

.mod-contracts-table tbody tr:last-child td:first-child,
.mod-contracts-table tbody tr:last-child td:last-child {
    border-radius: 0;
}

/* 从表 6 个页签的合计行固定在面板底部（脱离滚动区域） */
.ctr-sub-foot {
    flex: 0 0 auto;
    overflow: hidden;
}

.ctr-sub-foot-table {
    width: 100%;
    table-layout: fixed;
}

.ctr-sub-foot-table tfoot tr {
    position: static;
}

/* 序号列居中显示 */
#ctrMainTable .ctr-col-index,
#ctrMainTable .ctr-index {
    text-align: center;
    color: var(--color-text-secondary);
    font-variant-numeric: tabular-nums;
}

/* 主表底部：合计按列对齐，"共 X 条"占序号列，页码浮在右侧 */
.ctr-main-bottom {
    flex: 0 0 auto;
    position: relative;
    border-top: 1px solid var(--color-border);
    background: var(--color-bg-raised);
    overflow: hidden;
}

.ctr-main-foot {
    width: 100%;
    overflow: hidden;
}

.ctr-main-foot-table {
    width: 100%;
    table-layout: fixed;
    border-collapse: collapse;
}

.ctr-main-foot-table td {
    height: 32px;
    padding: 4px 8px;
    font-size: 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ctr-main-foot-table td.ctr-foot-total {
    padding-left: 4px;
    padding-right: 4px;
    text-align: left;
    color: var(--color-text-secondary);
    overflow: visible;
    text-overflow: clip;
}

.ctr-foot-label {
    text-align: right;
    font-weight: 700;
    color: var(--color-text);
}

.ctr-foot-amount {
    text-align: left;
    font-weight: 600;
    color: var(--color-text);
}

.ctr-main-bottom .mod-contracts-pagination {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    margin: 0;
    padding: 0;
    gap: 4px;
    flex-wrap: nowrap;
    display: flex;
    align-items: center;
}

.ctr-required {
    margin-left: 2px;
    color: var(--color-danger);
    font-weight: 600;
}

.ctr-inline-field {
    display: flex;
    gap: 6px;
    align-items: center;
}

.ctr-inline-field input {
    flex: 1 1 auto;
    min-width: 0;
}

.ctr-attachments {
    display: flex;
    flex-direction: column;
    gap: 6px;
    align-items: flex-start;
}

.ctr-att-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.ctr-att-item {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border: 1px solid var(--color-border);
    border-radius: 12px;
    background: var(--color-bg-raised);
    font-size: 12px;
    color: var(--color-text-secondary);
}

.ctr-att-name {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    color: var(--color-text-secondary);
    text-decoration: none;
    cursor: pointer;
}

.ctr-att-name:hover {
    color: var(--color-primary);
}

.ctr-sub-att-count {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    color: var(--color-primary);
    text-decoration: none;
    white-space: nowrap;
}

.ctr-sub-att-count:hover {
    text-decoration: underline;
}

/* 往来单位 / 项目选择器（与输入建议面板同一视觉规范） */
.ctr-picker-list {
    max-height: 55vh;
    overflow-y: auto;
    padding: 4px 0;
    background: var(--color-card);
    border: 1px solid var(--color-border);
    border-radius: 8px;
}

.ctr-picker-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    cursor: pointer;
}

.ctr-picker-item:hover { background: var(--color-table-hover); }

/* ===== 往来单位 / 项目选择弹窗：对齐合同主界面（搜索栏 + 表格） ===== */
.ctr-picker-modal .modal-header {
    padding: 12px 16px;
    border-bottom: 1px solid var(--color-border-light);
}

.ctr-picker-modal .modal-title {
    font-size: 15px;
    font-weight: 600;
}

.ctr-picker-modal .modal-body { padding: 12px 16px; }

.ctr-picker-toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.ctr-picker-toolbar .btn {
    height: 32px;
    min-height: 32px;
    padding: 0 12px;
    font-size: 13px;
}

.ctr-picker-search {
    height: 32px;
    min-height: 32px;
    padding: 0 10px;
    font-size: 13px;
    max-width: 420px;
}

.ctr-picker-count {
    margin-left: auto;
    font-size: 12px;
    color: var(--color-text-tertiary);
}

.ctr-picker-table-wrap {
    max-height: 52vh;
    overflow: auto;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    background: var(--color-card);
}

.ctr-picker-table {
    width: 100%;
    table-layout: fixed;
    margin: 0;
}

.ctr-picker-table thead th {
    position: sticky;
    top: 0;
    z-index: 1;
    height: 32px;
    padding: 4px 10px;
    background: var(--color-bg);
    color: var(--color-text-secondary);
    font-size: 12px;
    font-weight: 600;
    text-align: left;
    border-bottom: 1px solid var(--color-border);
    white-space: nowrap;
}

.ctr-picker-table tbody td {
    height: 34px;
    padding: 2px 10px;
    font-size: 12.5px;
    border-bottom: 1px solid var(--color-border-light);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ctr-picker-table tbody tr { cursor: pointer; }

.ctr-picker-table tbody tr:hover td { background: var(--color-table-hover); }

.ctr-picker-table tbody tr.is-selected td { background: rgba(250, 204, 21, 0.18); }

.ctr-picker-table tbody tr:last-child td { border-bottom: none; }

.ctr-picker-empty {
    padding: 24px 12px !important;
    text-align: center;
    color: var(--color-text-tertiary);
}

.ctr-picker-empty.is-error { color: var(--color-danger); }

.ctr-picker-hint {
    margin-top: 6px;
    font-size: 12px;
    color: var(--color-text-tertiary);
}

.ctr-picker-modal .modal-footer {
    padding: 10px 16px;
    border-top: 1px solid var(--color-border-light);
}

.ctr-picker-table-partner th:nth-child(1) { width: 34%; }
.ctr-picker-table-partner th:nth-child(2) { width: 14%; }
.ctr-picker-table-partner th:nth-child(3) { width: 16%; }
.ctr-picker-table-partner th:nth-child(4) { width: 14%; }
.ctr-picker-table-partner th:nth-child(5) { width: 22%; }

.ctr-picker-table-project th:nth-child(1) { width: 36%; }
.ctr-picker-table-project th:nth-child(2) { width: 16%; }
.ctr-picker-table-project th:nth-child(3) { width: 14%; }
.ctr-picker-table-project th:nth-child(4) { width: 12%; }
.ctr-picker-table-project th:nth-child(5) { width: 22%; }

.ctr-picker-main { flex: 1 1 auto; min-width: 0; }

.ctr-picker-sub {
    font-size: 12px;
    color: var(--color-text-tertiary);
}

.ctr-picker-tail {
    flex: 0 0 auto;
    font-size: 12px;
    color: var(--color-text-tertiary);
}

/* 表单输入建议（合同表单，替代浏览器原生候选框） */
.ctr-suggest-panel {
    position: fixed;
    z-index: 3000;
    max-height: 240px;
    overflow-y: auto;
    padding: 4px 0;
    background: var(--color-card);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

/* 表单内建议下拉：挂在输入框所在分组内，随表单滚动 */
.ctr-suggest-panel.is-inline {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    width: 100%;
    z-index: 40;
}

.ctr-suggest-item {
    padding: 8px 12px;
    font-size: 13px;
    line-height: 1.4;
    color: var(--color-text);
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ctr-suggest-item:hover,
.ctr-suggest-item.active {
    background: var(--color-table-hover);
}

/* 原生下拉美化（合同表单 / 从表表单） */
.ctr-select {
    position: relative;
    width: 100%;
}

.ctr-select-native {
    display: none !important;
}

.ctr-select-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    width: 100%;
    height: 36px;
    padding: 0 10px;
    border: 1px solid var(--color-input-border);
    border-radius: 8px;
    background: var(--color-input-bg);
    color: var(--color-text);
    font-size: 13px;
    font-family: var(--font-family);
    line-height: 1;
    text-align: left;
    cursor: pointer;
    outline: none;
    transition: border-color var(--transition-fast) var(--ease-out),
                box-shadow var(--transition-fast) var(--ease-out);
}

.ctr-select-trigger:hover {
    border-color: var(--color-primary-border);
}

.ctr-select-trigger:focus-visible,
.ctr-select-trigger[aria-expanded="true"] {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.25);
}

.ctr-select-trigger:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.ctr-select-label {
    flex: 1 1 auto;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ctr-select-label.is-placeholder {
    color: var(--color-text-tertiary);
}

.ctr-select-arrow {
    flex: 0 0 auto;
    font-size: 11px;
    color: var(--color-text-tertiary);
    transition: transform 0.15s var(--ease-out);
}

.ctr-select-trigger[aria-expanded="true"] .ctr-select-arrow {
    transform: rotate(180deg);
}

.ctr-select-panel {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    width: 100%;
    z-index: 40;
    max-height: 260px;
}

.ctr-select-panel.drop-up {
    top: auto;
    bottom: calc(100% + 4px);
}

.ctr-select-item.is-selected {
    color: var(--color-primary);
    font-weight: 600;
}

.ctr-select-item.is-disabled {
    background: transparent;
    color: var(--color-text-tertiary);
    cursor: not-allowed;
}

.ctr-att-del {
    border: none;
    background: transparent;
    color: var(--color-danger);
    cursor: pointer;
    padding: 0 2px;
    line-height: 1;
}

/* 从表行内已无操作按钮：工具栏统一操作 */
.ctr-sub-toolbar .btn {
    height: 26px;
    min-height: 26px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.ctr-sub-view-table {
    width: 100%;
    border-collapse: collapse;
}

.ctr-sub-view-table th {
    width: 120px;
    padding: 7px 10px;
    text-align: right;
    vertical-align: top;
    font-weight: 500;
    color: var(--color-text-tertiary);
    border-bottom: 1px solid var(--color-border-light);
}

.ctr-sub-view-table td {
    padding: 7px 10px;
    color: var(--color-text);
    border-bottom: 1px solid var(--color-border-light);
    white-space: pre-wrap;
    word-break: break-all;
}

/* ===== 从表收付款 / 计划表单优化（限定在从表弹窗内，避免影响合同表单） ===== */
#ctrSubFormModal .ctr-form-section {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 8px 0 2px;
    padding-bottom: 4px;
    border-bottom: 1px solid var(--color-border-light);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: .2px;
    color: var(--color-text-secondary);
}

#ctrSubFormModal .ctr-form-section:first-child { margin-top: 0; }

#ctrSubFormModal .ctr-form-hint {
    grid-column: 1 / -1;
    margin: -2px 0 2px;
    font-size: 12px;
    line-height: 1.5;
    color: var(--color-text-tertiary);
}

#ctrSubFormModal .ctr-form-hint.is-active { color: var(--color-primary); }

.ctr-readonly-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 32px;
    padding: 0 12px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
}

.ctr-readonly-badge.is-income {
    background: rgba(22, 163, 74, .12);
    color: #15803d;
}

.ctr-readonly-badge.is-expense {
    background: rgba(220, 38, 38, .10);
    color: #b91c1c;
}

.ctr-upload-zone {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 12px;
    border: 1px dashed var(--color-border);
    border-radius: 8px;
    cursor: pointer;
    font-size: 12px;
    color: var(--color-text-tertiary);
    transition: border-color .15s, color .15s, background .15s;
}

.ctr-upload-zone:hover,
.ctr-upload-zone.is-drag {
    border-color: var(--color-primary);
    color: var(--color-primary);
    background: var(--color-primary-bg);
}

.ctr-upload-zone i { font-size: 18px; }

/* 4) 窄屏回退为纵向堆叠 */
@media (max-width: 991.98px) {
    .ctr-page-body {
        display: flex;
        flex-direction: column;
        height: auto;
        min-height: 0;
        gap: 8px;
    }
    .ctr-page-body .ctr-searchbar { min-height: 0; }
    .ctr-layout-top {
        display: grid;
        grid-template-columns: 1fr;
        gap: 8px;
    }
    .ctr-page-body .ctr-filter-tree {
        height: auto;
        max-height: 180px;
        margin-bottom: 0;
    }
    .ctr-page-body .ctr-main-panel { height: 52vh; }
    .ctr-page-body .ctr-layout-bottom {
        min-height: 320px;
        border-radius: 8px;
    }
    .ctr-page-body .ctr-sub-table-wrap { min-height: 0; }
}


/* ========================================
   C1 筛选树：层次感优化
   ======================================== */
.ctr-filter-tree {
    padding: 4px;
    border-radius: 10px;
    scrollbar-width: thin;
}

.ctr-tree-group {
    margin: 0;
    padding: 2px 0;
    border-top: 1px solid var(--color-border-light);
}

.ctr-tree-group:first-child {
    border-top: none;
}

.ctr-tree-title {
    position: sticky;
    top: 0;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 7px 8px;
    border-radius: 6px;
    background: var(--color-card);
    color: var(--color-text-secondary);
    font-size: 11.5px;
    font-weight: 600;
    letter-spacing: .3px;
    cursor: pointer;
    user-select: none;
}

.ctr-tree-title:hover {
    background: var(--color-bg);
    color: var(--color-text);
}

.ctr-tree-title-main {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
}

.ctr-tree-title-main i {
    font-size: 12px;
    opacity: .65;
}

.ctr-tree-caret {
    width: auto;
    font-size: 10px;
    line-height: 1;
    color: var(--color-text-tertiary);
}

.ctr-tree-items {
    display: flex;
    flex-direction: column;
    gap: 1px;
    padding: 2px 2px 4px;
}

.ctr-tree-node {
    position: relative;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 5px 8px 5px 16px;
    border-radius: 6px;
    color: var(--color-text-secondary);
    font-size: 12.5px;
    line-height: 1.35;
    text-decoration: none;
    white-space: nowrap;
    overflow: hidden;
    transition: background .12s var(--ease-out), color .12s var(--ease-out);
}

.ctr-tree-node::before {
    content: '';
    position: absolute;
    left: 7px;
    top: 50%;
    width: 4px;
    height: 4px;
    margin-top: -2px;
    border-radius: 50%;
    background: var(--color-text-tertiary);
    opacity: .35;
}

.ctr-tree-node:hover {
    background: var(--color-bg);
    color: var(--color-text);
}

.ctr-tree-node:hover::before {
    opacity: .6;
}

.ctr-tree-node.active {
    background: var(--color-primary-bg);
    color: var(--color-primary);
    font-weight: 600;
    box-shadow: inset 2px 0 0 var(--color-primary);
}

.ctr-tree-node.active::before {
    background: var(--color-primary);
    opacity: 1;
}

/* 分类 / 项目层级：缩进 + 圆点 + 引导线 */
.ctr-tree-node.ctr-depth-1 { padding-left: 28px; }
.ctr-tree-node.ctr-depth-2 { padding-left: 40px; }
.ctr-tree-node.ctr-depth-3 { padding-left: 52px; }
.ctr-tree-node.ctr-depth-4 { padding-left: 64px; }
.ctr-tree-node.ctr-depth-5 { padding-left: 76px; }

.ctr-tree-node.ctr-depth-1::before { left: 19px; }
.ctr-tree-node.ctr-depth-2::before { left: 31px; }
.ctr-tree-node.ctr-depth-3::before { left: 43px; }
.ctr-tree-node.ctr-depth-4::before { left: 55px; }
.ctr-tree-node.ctr-depth-5::before { left: 67px; }

.ctr-tree-node.ctr-depth-1::after,
.ctr-tree-node.ctr-depth-2::after,
.ctr-tree-node.ctr-depth-3::after,
.ctr-tree-node.ctr-depth-4::after,
.ctr-tree-node.ctr-depth-5::after {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    border-left: 1px solid var(--color-border-light);
}

.ctr-tree-node.ctr-depth-1::after { left: 11px; }
.ctr-tree-node.ctr-depth-2::after { left: 23px; }
.ctr-tree-node.ctr-depth-3::after { left: 35px; }
.ctr-tree-node.ctr-depth-4::after { left: 47px; }
.ctr-tree-node.ctr-depth-5::after { left: 59px; }

.ctr-tree-label {
    flex: 1 1 auto;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ctr-tree-count {
    flex: 0 0 auto;
    min-width: 20px;
    padding: 1px 6px;
    border-radius: 9px;
    background: var(--color-table-hover);
    color: var(--color-text-tertiary);
    font-size: 10.5px;
    font-weight: 500;
    text-align: center;
}

.ctr-tree-node.active .ctr-tree-count {
    background: rgba(0, 122, 255, 0.14);
    color: var(--color-primary);
}

@media (max-width: 1366px) {
    .ctr-tree-title {
        padding: 6px 7px;
        font-size: 11px;
    }

    .ctr-tree-node {
        padding-top: 4px;
        padding-bottom: 4px;
        font-size: 12px;
    }
}


/* ========================================
   新增/编辑合同：紧凑布局（减少滚动）
   ======================================== */
#ctrFormModal .modal-dialog {
    max-width: min(1180px, 96vw);
}

#ctrFormModal .modal-body {
    padding: 12px 16px 8px;
}

#ctrFormModal .modal-header,
#ctrFormModal .modal-footer {
    padding: 10px 16px;
}

#ctrFormModal .ctr-form-grid {
    grid-template-columns: repeat(auto-fill, minmax(205px, 1fr));
    gap: 8px 12px;
}

#ctrFormModal .ctr-form-collapse > summary {
    display: flex;
    align-items: center;
    gap: 6px;
    width: 100%;
    cursor: pointer;
    list-style: none;
}

#ctrFormModal .ctr-form-collapse > summary::-webkit-details-marker {
    display: none;
}

#ctrFormModal .ctr-form-collapse > summary::after {
    content: '▾';
    margin-left: auto;
    font-size: 10px;
    color: var(--color-text-tertiary);
    transition: transform .15s var(--ease-out);
}

#ctrFormModal .ctr-form-collapse:not([open]) > summary::after {
    transform: rotate(-90deg);
}

#ctrFormModal .ctr-form-collapse[open] > summary {
    margin-bottom: 8px;
}

#ctrFormModal .ctr-goods-wrap:has(#ctrGoodsBody:empty) {
    display: none;
}

#ctrFormModal .ctr-form-group {
    gap: 2px;
}

#ctrFormModal .ctr-form-group label {
    font-size: 11px;
}

#ctrFormModal .ctr-form-group input:not([type="checkbox"]):not([type="radio"]):not([type="file"]),
#ctrFormModal .ctr-form-group select,
#ctrFormModal .ctr-form-group textarea {
    height: 32px;
    min-height: 32px;
    padding: 0 8px;
    font-size: 12.5px;
    border-radius: 7px;
}

#ctrFormModal .ctr-form-group textarea {
    height: auto;
    min-height: 48px;
    padding: 5px 8px;
}

#ctrFormModal .ctr-form-section {
    margin-bottom: 10px;
    padding-bottom: 6px;
}

#ctrFormModal .ctr-section-title {
    margin-bottom: 6px;
    padding-bottom: 4px;
    font-size: 11.5px;
}

#ctrFormModal .ctr-form-hint {
    margin-top: 2px;
    font-size: 11px;
}

#ctrFormModal .ctr-goods-wrap {
    max-height: 190px;
    overflow: auto;
}

#ctrFormModal .ctr-rich-editor {
    min-height: 84px;
    max-height: 150px;
}

#ctrFormModal .ctr-upload-zone {
    padding: 12px;
}


/* ===== 树形下拉选项：层级缩进 + 停用徽标 ===== */
.ctr-select-item {
    position: relative;
}

.ctr-select-item.is-depth-1 { padding-left: 28px; }
.ctr-select-item.is-depth-2 { padding-left: 40px; }
.ctr-select-item.is-depth-3 { padding-left: 52px; }
.ctr-select-item.is-depth-4 { padding-left: 64px; }
.ctr-select-item.is-depth-5 { padding-left: 76px; }

.ctr-select-item.is-depth-1::before,
.ctr-select-item.is-depth-2::before,
.ctr-select-item.is-depth-3::before,
.ctr-select-item.is-depth-4::before,
.ctr-select-item.is-depth-5::before {
    content: '';
    position: absolute;
    top: 50%;
    width: 4px;
    height: 4px;
    margin-top: -2px;
    border-radius: 50%;
    background: var(--color-text-tertiary);
    opacity: .45;
}

.ctr-select-item.is-depth-1::before { left: 18px; }
.ctr-select-item.is-depth-2::before { left: 30px; }
.ctr-select-item.is-depth-3::before { left: 42px; }
.ctr-select-item.is-depth-4::before { left: 54px; }
.ctr-select-item.is-depth-5::before { left: 66px; }

.ctr-select-opt-label {
    flex: 1 1 auto;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ctr-select-opt-badge {
    flex: 0 0 auto;
    padding: 0 6px;
    border-radius: 8px;
    background: rgba(255, 149, 0, 0.14);
    color: #B26A00;
    font-size: 10.5px;
    line-height: 16px;
}

.ctr-select-item.is-inactive .ctr-select-opt-label {
    color: var(--color-text-tertiary);
}

.ctr-select-trigger.is-inactive .ctr-select-label::after {
    content: '停用';
    margin-left: 6px;
    padding: 1px 6px;
    border-radius: 8px;
    background: rgba(255, 149, 0, 0.14);
    color: #B26A00;
    font-size: 10.5px;
    font-weight: 500;
}

[data-theme="dark"] .ctr-select-opt-badge,
[data-theme="dark"] .ctr-select-trigger.is-inactive .ctr-select-label::after {
    background: rgba(255, 159, 10, 0.18);
    color: #FF9F0A;
}

/* ===== 2026-10-28 搜索与操作栏：全部操作单行 + 次级按钮弱化 ===== */
.ctr-searchbar {
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: thin;
    gap: 5px;
}
.ctr-searchbar::-webkit-scrollbar { height: 6px; }
.ctr-searchbar::-webkit-scrollbar-thumb {
    background: var(--color-border);
    border-radius: 3px;
}

.ctr-searchbar > * { flex-shrink: 0; }
.ctr-search-input {
    flex: 0 1 160px;
    width: 160px;
    min-width: 120px;
}

.ctr-toolbar-right,
.ctr-toolbar-secondary {
    display: flex;
    align-items: center;
    gap: 5px;
    flex-wrap: nowrap;
    flex-shrink: 0;
}
.ctr-toolbar-right { margin-left: auto; }
.ctr-toolbar-secondary { margin-left: 0; }

.ctr-searchbar .btn {
    padding: 0 8px;
    font-size: 12.5px;
    white-space: nowrap;
}

/* 设置列 / 导出 / 导入：弱化显示，悬停时恢复强调 */
.ctr-searchbar .ctr-btn-weak {
    background: transparent;
    border-color: transparent;
    color: var(--color-text-secondary);
    opacity: .78;
    padding-left: 6px;
    padding-right: 6px;
}
.ctr-searchbar .ctr-btn-weak:hover {
    background: var(--color-table-hover);
    border-color: var(--color-border);
    color: var(--color-primary);
    opacity: 1;
}
[data-theme="dark"] .ctr-searchbar .ctr-btn-weak { color: var(--color-text-tertiary); }

@media (max-width: 991.98px) {
    .ctr-searchbar {
        flex-wrap: nowrap;
        overflow-x: auto;
        overflow-y: hidden;
    }
    .ctr-toolbar-right,
    .ctr-toolbar-secondary {
        width: auto;
        margin-left: 0;
        justify-content: flex-start;
    }
    .ctr-search-input { flex: 0 1 120px; width: auto; min-width: 100px; }
}
@media (max-width: 767.98px) {
    .ctr-searchbar { flex-wrap: nowrap; }
}

/* ===== 2026-10-31 合同页高度跟随内容区，消除整页纵向滚动 ===== */
@media (min-width: 992px) {
    #mod-contracts.module-section,
    #mod-contracts .ctr-page,
    #mod-contracts .ctr-page-body {
        height: 100%;
        min-height: 0;
    }
}

/* =========================================================
   2026-11-05 C3-3 附件预览：固定画布，切换附件不改变弹窗大小
   ========================================================= */
#ctrAttPreviewModal .ctr-att-preview-content {
    height: min(calc(88vh - 220px), 720px);
    min-height: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

#ctrAttPreviewModal .ctr-att-preview-image-wrap {
    width: 100%;
    height: 100%;
    max-height: none;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: auto;
}

#ctrAttPreviewModal .ctr-att-preview-image {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

#ctrAttPreviewModal .ctr-att-preview-frame {
    height: 100%;
}

#ctrAttPreviewModal .ctr-att-preview-text {
    width: 100%;
    height: 100%;
    max-height: 100%;
}

#ctrAttPreviewModal .ctr-att-preview-content > .text-center,
#ctrAttPreviewModal .ctr-att-preview-content > .ds-empty {
    margin: 0;
}

/* =========================================================
   2026-11-05 C3 查看收付款：左详情 + 右附件预览
   ========================================================= */
#ctrSubViewModal .ds-modal__body {
    overflow: hidden;
}

.ctr-sub-view-split {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 16px;
    height: min(calc(88vh - 160px), 680px);
    min-height: 0;
}

.ctr-sub-view-detail {
    min-width: 0;
    min-height: 0;
    overflow-y: auto;
    padding-right: 4px;
}

.ctr-sub-view-attach {
    min-width: 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding-left: 16px;
    border-left: 1px solid var(--color-border-light);
}

.ctr-sub-view-attach-head {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 0 0 auto;
    font-size: 13px;
    font-weight: 600;
    color: var(--color-text);
}

.ctr-sub-view-attach-count {
    margin-left: auto;
    min-width: 22px;
    padding: 1px 7px;
    border-radius: 999px;
    background: var(--color-primary-bg);
    color: var(--color-primary);
    font-size: 11px;
    font-weight: 600;
    text-align: center;
}

.ctr-sub-view-att-tabs {
    flex: 0 0 auto;
    max-height: 76px;
    margin-bottom: 0;
    overflow-y: auto;
}

.ctr-sub-view-att-body {
    flex: 1 1 auto;
    height: auto;
    min-height: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.ctr-sub-view-att-body .ctr-att-preview-image-wrap {
    width: 100%;
    height: 100%;
    max-height: none;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: auto;
}

.ctr-sub-view-att-body .ctr-att-preview-image {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.ctr-sub-view-att-body .ctr-att-preview-frame {
    height: 100%;
}

.ctr-sub-view-att-body .ctr-att-preview-text {
    width: 100%;
    height: 100%;
    max-height: 100%;
}

.ctr-sub-view-att-empty {
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: var(--color-text-tertiary);
    font-size: 13px;
}

.ctr-sub-view-att-empty i {
    font-size: 28px;
}

@media (max-width: 767.98px) {
    #ctrSubViewModal .ds-modal__body {
        overflow-y: auto;
    }

    .ctr-sub-view-split {
        grid-template-columns: 1fr;
        height: auto;
    }

    .ctr-sub-view-attach {
        padding-left: 0;
        padding-top: 12px;
        border-left: none;
        border-top: 1px solid var(--color-border-light);
    }

    .ctr-sub-view-att-body {
        flex: 0 0 auto;
        height: min(46vh, 420px);
    }
}
