/* ========================================
   业务一体化平台 - 极简风格样式
   Contract Management System - Minimalist Style
   ======================================== */

/* Reset & Base */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #4f6ef7;
    --primary-light: #e8ecff;
    --primary-dark: #3b54d4;
    --success: #52c41a;
    --success-light: #f6ffed;
    --warning: #fa8c16;
    --warning-light: #fff7e6;
    --danger: #ff4d4f;
    --danger-light: #fff2f0;
    --info: #1890ff;
    --info-light: #e6f7ff;
    
    --bg: #ffffff;
    --bg-card: #ffffff;
    --bg-sidebar: #e9edf3;
    --bg-sidebar-hover: #dde3ec;
    --bg-sidebar-active: #4f6ef7;
    
    --text: #2c3e50;
    --text-light: #7f8c9b;
    --text-muted: #b0b8c4;
    --text-sidebar: #5a6577;
    --text-sidebar-active: #ffffff;
    
    --border: #e8ecf1;
    --border-light: #f0f2f5;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.04);
    --shadow: 0 2px 12px rgba(0,0,0,0.06);
    --shadow-lg: 0 8px 32px rgba(0,0,0,0.1);
    --radius: 10px;
    --radius-sm: 6px;
    --radius-lg: 14px;
    
    --sidebar-width: 240px;
    --topbar-height: 56px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", "Helvetica Neue", sans-serif;
    font-size: 16px;
    color: var(--text);
    background: var(--bg);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); }

/* App Layout */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-sidebar);
    border-right: 1px solid #d8dee8;
    box-shadow: 2px 0 8px rgba(0,0,0,0.04);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
    transition: transform 0.3s ease;
}

.sidebar-brand {
    padding: 24px 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    border-bottom: 1px solid var(--border);
    text-align: center;
}

.brand-icon {
    font-size: 28px;
    line-height: 1;
}

.brand-info h1 {
    font-size: 20px;
    font-weight: 600;
    color: var(--text);
    letter-spacing: 0.5px;
}

.brand-sub {
    font-size: 12px;
    color: var(--text-sidebar);
    letter-spacing: 1px;
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 12px 0;
}

.nav-group {
    margin-bottom: 4px;
}

.nav-group-title {
    padding: 16px 20px 8px;
    font-size: 12px;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    font-weight: 600;
}

.nav-item {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 12px 20px;
    margin: 2px 10px;
    border-radius: var(--radius-sm);
    color: var(--text-sidebar);
    font-size: 18px;
    transition: all 0.2s;
    text-decoration: none;
}

.nav-item:hover {
    background: var(--bg-sidebar-hover);
    color: var(--primary);
}

.nav-item.active {
    background: var(--bg-sidebar-active);
    color: var(--text-sidebar-active);
    font-weight: 500;
}

.nav-icon {
    font-size: 20px;
    width: 24px;
    text-align: center;
    line-height: 1;
}

/* Sidebar Footer */
.sidebar-footer {
    padding: 16px;
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: 600;
}

.user-detail {
    line-height: 1.3;
}

.user-name {
    color: var(--text);
    font-size: 15px;
    font-weight: 500;
}

.user-role {
    color: var(--text-sidebar);
    font-size: 12px;
}

.logout-btn {
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    opacity: 0.6;
    transition: opacity 0.2s;
    padding: 4px;
}

.logout-btn:hover {
    opacity: 1;
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-width: 0;
}

/* Topbar */
.topbar {
    height: var(--topbar-height);
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding: 0 24px;
    gap: 16px;
    position: sticky;
    top: 0;
    z-index: 50;
}

.menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 22px;
    cursor: pointer;
    color: var(--text);
    padding: 4px;
}

.topbar-title {
    font-size: 18px;
    font-weight: 600;
    flex: 1;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

.current-time {
    font-size: 15px;
    color: var(--text-light);
    font-variant-numeric: tabular-nums;
}

/* Page Content */
.page-content {
    padding: 24px;
    max-width: 1400px;
}

/* Page Toolbar */
.page-toolbar {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    margin-bottom: 20px;
}

.page-toolbar h2 {
    font-size: 20px;
    font-weight: 600;
    color: var(--text);
}

/* Filter Bar */
.filter-bar {
    margin-bottom: 16px;
}

.filter-form {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

/* Cards */
.card {
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-light);
    overflow: hidden;
}

.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-header h3 {
    font-size: 17px;
    font-weight: 600;
}

.overdue-total {
    font-size: 16px;
    font-weight: 700;
    color: #ff4d4f;
}

.card-body {
    padding: 20px;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 20px 16px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-light);
    transition: box-shadow 0.2s;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.stat-card:hover {
    box-shadow: var(--shadow);
}

/* Dashboard Section（按合同类型拆分：销售 / 采购） */
.dash-section {
    margin-bottom: 8px;
}

.dash-section-title {
    font-size: 19px;
    font-weight: 700;
    margin: 14px 0 14px;
    padding-left: 12px;
    border-left: 4px solid #1890ff;
    color: var(--text);
}

/* Dashboard Tabs（销售合同 / 采购合同） */
.dash-tabs {
    display: flex;
    border-bottom: 2px solid #e8e8e8;
    margin-bottom: 0;
}

.dash-tab {
    display: inline-block;
    padding: 12px 24px;
    font-size: 17px;
    font-weight: 600;
    color: var(--text-light);
    text-decoration: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: color .2s, border-color .2s;
}

.dash-tab:hover { color: var(--text); }

.dash-tab.active {
    color: #1890ff;
    border-bottom-color: #1890ff;
}

/* Dashboard Filter（筛选区） */
.dash-filter {
    background: #fafbfc;
    border: 1px solid var(--border-light);
    border-top: none;
    padding: 16px 20px;
    margin-bottom: 20px;
}

.filter-row {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    align-items: flex-end;
}

.filter-item {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 180px;
}

.filter-item label {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-light);
}

.filter-item select,
.filter-item input[type="date"] {
    padding: 7px 10px;
    border: 1px solid #d9d9d9;
    border-radius: 4px;
    font-size: 16px;
    background: #fff;
    outline: none;
    transition: border-color .2s;
}

.filter-item select:focus,
.filter-item input:focus {
    border-color: #1890ff;
    box-shadow: 0 0 0 2px rgba(24,144,255,.1);
}

/* Summary Row（汇总指标行：待收款 / 已收款 / 合同总额 / 签署数量） */
.summary-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1px;
    background: #e8e8e8;
    border: 1px solid #e8e8e8;
    margin-bottom: 20px;
    border-radius: var(--radius);
    overflow: hidden;
}

.summary-cell {
    background: var(--bg-card);
    padding: 18px 20px;
    text-align: center;
}

.summary-label {
    display: block;
    font-size: 15px;
    color: var(--text-light);
    margin-bottom: 8px;
}

.summary-value {
    display: block;
    font-size: 22px;
    font-weight: 700;
    color: var(--text);
}

.stat-icon {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    margin-bottom: 12px;
}

.stat-value {
    font-size: 26px;
    font-weight: 700;
    color: var(--text);
    line-height: 1.2;
}

.stat-label {
    font-size: 15px;
    color: var(--text-light);
    margin-top: 4px;
}

.stat-detail {
    margin-top: 10px;
    font-size: 13px;
    color: var(--text-light);
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 6px;
}

/* Dashboard Grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

/* 第二行：即将到期 + 逾期 并排 */
.dash-row2 {
    margin-bottom: 24px;
}

/* 最近合同独立卡片 */
.recent-card {
    margin-bottom: 20px;
}

/* Chart Container */
.chart-container {
    height: 300px;
    position: relative;
}

/* Table */
.table-responsive {
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
}

.table th {
    padding: 12px 16px;
    text-align: center;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-light);
    background: #fafbfc;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-light);
    font-size: 16px;
    text-align: center;
}

.table tbody tr:hover {
    background: #f8f9fc;
}

.table tbody tr:last-child td {
    border-bottom: none;
}

.table.compact th,
.table.compact td {
    padding: 8px 12px;
}

/* 全局规则：所有表格（含 .table / .pms-table / .plan-tbl / .cd-table 等）的
   表头与单元格正文统一居中；!important 用于覆盖页面内联的 text-align 设置 */
table th,
table td {
    text-align: center !important;
}

.text-green { color: var(--success); }
.text-red { color: var(--danger); }
.text-orange { color: var(--warning); }

/* Tags */
.tag {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 100px;
    font-size: 13px;
    font-weight: 500;
    line-height: 1.6;
}

.tag-blue { background: var(--info-light); color: var(--info); }
.tag-green { background: var(--success-light); color: var(--success); }
.tag-orange { background: var(--warning-light); color: var(--warning); }
.tag-red { background: var(--danger-light); color: var(--danger); }

/* Status Badges */
.status-badge {
    display: inline-block;
    padding: 3px 12px;
    border-radius: 100px;
    font-size: 13px;
    font-weight: 500;
}

.status-draft { background: #f0f2f5; color: #8c8c8c; }
.status-active { background: var(--info-light); color: var(--info); }
.status-completed { background: var(--success-light); color: var(--success); }
.status-cancelled { background: var(--danger-light); color: var(--danger); }

.status-payment-pending { background: var(--warning-light); color: var(--warning); }
.status-payment-partial { background: var(--info-light); color: var(--info); }
.status-payment-paid { background: var(--success-light); color: var(--success); }
.status-payment-overdue { background: var(--danger-light); color: var(--danger); }

/* Days Badge */
.days-badge {
    display: inline-block;
    padding: 1px 6px;
    border-radius: 100px;
    font-size: 12px;
    font-weight: 500;
    margin-left: 4px;
    background: #f0f2f5;
    color: #8c8c8c;
}

.days-badge.urgent { background: var(--danger-light); color: var(--danger); }
.days-badge.warning { background: var(--warning-light); color: var(--warning); }

/* Action Cell */
.action-cell {
    white-space: nowrap;
}

.action-cell .btn {
    margin-right: 4px;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 18px;
    border-radius: var(--radius-sm);
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all 0.2s;
    line-height: 1.4;
    white-space: nowrap;
    text-decoration: none;
}

.btn-primary {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

.btn-primary:hover {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
}

.btn-outline {
    background: #fff;
    color: var(--text);
    border-color: var(--border);
}

.btn-outline:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.btn-danger-outline {
    background: #fff;
    color: var(--danger);
    border-color: var(--border);
}

.btn-danger-outline:hover {
    border-color: var(--danger);
    background: var(--danger-light);
}

.btn-text {
    background: none;
    color: var(--text-light);
    border: none;
    padding: 8px 12px;
}

.btn-text:hover {
    color: var(--primary);
}

.btn-sm {
    padding: 4px 12px;
    font-size: 13px;
}

/* Form Elements */
.form-input {
    width: 100%;
    height: 40px;
    padding: 0 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 16px;
    color: var(--text);
    background: #fff;
    transition: all 0.2s;
}

.form-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79,110,247,0.1);
}

textarea.form-input {
    height: auto;
    padding: 10px 12px;
    resize: vertical;
    min-height: 60px;
}

select.form-input {
    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='%237f8c9b' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 30px;
}

.form-group {
    margin-bottom: 14px;
}

.form-group label {
    display: block;
    font-size: 15px;
    font-weight: 500;
    color: var(--text);
    margin-bottom: 6px;
}

.form-hint {
    margin-top: 6px;
    font-size: 13px;
    color: var(--text-muted, #8a94a6);
    line-height: 1.5;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

/* Modal */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.45);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-overlay.active {
    display: flex;
}

.modal {
    background: #fff;
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 640px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-lg);
    animation: modalIn 0.2s ease;
}

@keyframes modalIn {
    from { opacity: 0; transform: translateY(-10px) scale(0.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-header {
    padding: 18px 24px;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-header h3 {
    font-size: 19px;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    font-size: 20px;
    color: var(--text-light);
    cursor: pointer;
    padding: 4px;
    line-height: 1;
    transition: color 0.2s;
}

.modal-close:hover { color: var(--text); }

.modal-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-light);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* Pagination */
.pagination {
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 6px;
    border-top: 1px solid var(--border-light);
}

.page-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 32px;
    padding: 0 8px;
    border-radius: var(--radius-sm);
    font-size: 15px;
    color: var(--text);
    border: 1px solid var(--border);
    transition: all 0.2s;
    text-decoration: none;
}

.page-link:hover { border-color: var(--primary); color: var(--primary); }

.page-link.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

.page-info {
    margin-left: 12px;
    font-size: 15px;
    color: var(--text-light);
}

/* Toast */
.toast {
    position: fixed;
    top: 24px;
    left: 50%;
    transform: translateX(-50%);
    padding: 12px 24px;
    border-radius: var(--radius-sm);
    font-size: 16px;
    font-weight: 500;
    z-index: 2000;
    opacity: 0;
    transition: opacity 0.3s;
    pointer-events: none;
    box-shadow: var(--shadow-lg);
}

.toast.show { opacity: 1; }
.toast.success { background: var(--success); color: #fff; }
.toast.error { background: var(--danger); color: #fff; }
.toast.info { background: var(--info); color: #fff; }

/* Empty State */
.empty-state {
    text-align: center;
    padding: 48px 20px;
    color: var(--text-muted);
    font-size: 16px;
}

.empty-state::before {
    content: "📭";
    display: block;
    font-size: 48px;
    margin-bottom: 12px;
}

/* Responsive */
@media (max-width: 1024px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    :root {
        --sidebar-width: 0px;
        --topbar-height: 52px;
    }

    /* 侧边栏变为抽屉 */
    .sidebar {
        transform: translateX(-100%);
        width: 260px;
    }

    .sidebar.open {
        transform: translateX(0);
    }

    /* 抽屉内导航左对齐，便于手机阅读 */
    .sidebar.open .nav-item {
        justify-content: flex-start;
        padding-left: 20px;
    }

    .sidebar.open .nav-group-title {
        padding-left: 20px;
    }

    .main-content {
        margin-left: 0;
    }

    .menu-toggle {
        display: block;
    }

    .mobile-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0,0,0,0.4);
        z-index: 99;
    }

    .mobile-overlay.active {
        display: block;
    }

    .topbar {
        padding: 0 14px;
        gap: 10px;
    }

    .topbar-title {
        font-size: 17px;
    }

    .current-time {
        font-size: 13px;
    }

    .page-content {
        padding: 14px;
    }

    /* 统计卡片 2 列 */
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .stat-card {
        padding: 16px 10px;
    }

    .stat-value {
        font-size: 21px;
    }

    /* 汇总指标 2 列 */
    .summary-row {
        grid-template-columns: repeat(2, 1fr);
    }

    /* 工具栏按钮整行，便于点击 */
    .page-toolbar {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    .page-toolbar .btn {
        width: 100%;
    }

    /* 筛选表单竖排并占满 */
    .filter-form {
        flex-direction: column;
        align-items: stretch;
    }

    .filter-form .form-input {
        width: 100% !important;
    }

    .filter-form .btn {
        width: 100%;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .dash-filter .filter-row {
        flex-direction: column;
        align-items: stretch;
    }

    .dash-filter .filter-item {
        width: 100%;
        min-width: 0;
    }

    /* 弹窗变为底部抽屉 */
    .modal-overlay {
        padding: 0;
        align-items: flex-end;
    }

    .modal {
        max-width: 100%;
        margin: 0;
        border-radius: var(--radius-lg) var(--radius-lg) 0 0;
        max-height: 92vh;
        animation: modalUp 0.25s ease;
    }

    @keyframes modalUp {
        from { transform: translateY(100%); }
        to { transform: translateY(0); }
    }

    /* 表格横向滚动，避免挤压变形 */
    .table-responsive,
    .card-body {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .table-responsive > .table,
    .card-body > .table {
        min-width: 600px;
    }

    .table th, .table td {
        padding: 9px 10px;
        font-size: 14px;
    }

    /* 弹窗内付款阶段表格横向滚动 */
    .stage-table {
        overflow-x: auto;
    }

    .stage-table > .table {
        min-width: 460px;
    }

    /* 分页可换行 */
    .pagination {
        flex-wrap: wrap;
    }
}

@media (max-width: 480px) {
    .page-content {
        padding: 12px;
    }

    .topbar-title {
        font-size: 16px;
    }

    .current-time {
        display: none;
    }

    .stat-value {
        font-size: 20px;
    }
}

/* ============ 付款计划阶段编辑 ============ */
.form-section {
    margin-top: 8px;
    padding-top: 16px;
    border-top: 1px dashed var(--border);
}

.form-section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.form-section-head span {
    font-size: 16px;
    font-weight: 600;
    color: var(--text);
}

.stage-row {
    display: grid;
    grid-template-columns: 110px 1fr 90px 130px 150px 36px;
    gap: 8px;
    align-items: start;
    margin-bottom: 8px;
}

.stage-row .stage-content {
    grid-column: 1 / -1;
    min-height: 38px;
}

.stage-summary {
    margin-top: 10px;
    font-size: 15px;
    color: var(--text-light);
    background: var(--bg);
    padding: 10px 14px;
    border-radius: var(--radius-sm);
}

.stage-summary b { color: var(--text); }

/* ============ 权限设置 ============ */
.perm-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.perm-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 15px;
    color: var(--text);
    cursor: pointer;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    user-select: none;
}

.perm-item input {
    width: auto;
    height: auto;
}

.perm-tip {
    font-size: 13px;
    color: var(--text-light);
    margin-top: 8px;
}

/* ============ 额外标签 / 状态 ============ */
.tag-purple { background: #f3effe; color: #722ed1; }
.tag-gray { background: #f0f2f5; color: #8c8c8c; }
.status-inactive { background: #f0f2f5; color: #8c8c8c; }

@media (max-width: 768px) {
    .stage-row {
        grid-template-columns: 1fr 1fr;
    }
    .stage-row .stage-content {
        grid-column: auto;
    }
    .perm-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* 合同金额(大写) 与列表次要文字 */
.amount-cny {
    padding: 8px 12px;
    background: #fafafa;
    border: 1px dashed #e0e0e0;
    border-radius: 6px;
    color: #2c3e50;
    font-size: 16px;
    font-weight: 600;
    letter-spacing: 0.5px;
}
.sub-text {
    font-size: 13px;
    color: #8c8c8c;
    margin-top: 2px;
}

/* 收付款：付款阶段选择表格 */
.stage-label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text);
    margin-bottom: 6px;
}
.stage-table {
    margin: 4px 0 8px;
    max-height: 220px;
    overflow-y: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}
.stage-table table {
    margin: 0;
}
.stage-table td, .stage-table th {
    padding: 8px 10px;
}
.stage-table input[type="radio"] {
    transform: scale(1.15);
    cursor: pointer;
}

/* ============ 闲置超时提示 ============ */
.idle-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 2000;
    display: none;
    align-items: center;
    justify-content: center;
}
.idle-overlay.show { display: flex; }
.idle-box {
    background: #fff;
    border-radius: 14px;
    padding: 30px 28px;
    max-width: 380px;
    width: 90%;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
}
.idle-box h3 {
    margin: 0 0 12px;
    font-size: 19px;
    color: #1a1a2e;
}
.idle-box p {
    margin: 0 0 20px;
    font-size: 14px;
    color: #555;
    line-height: 1.7;
}
.idle-box p b { color: #ff4d4f; }
.idle-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 11px 32px;
    font-size: 15px;
    cursor: pointer;
}
.idle-btn:hover { opacity: 0.92; }
