/* 金融借款合同纠纷 · 全流程管理系统 - 样式 */

:root {
    --primary: #1a56db;
    --primary-light: #e1effe;
    --success: #059669;
    --warning: #d97706;
    --danger: #dc2626;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
    --sidebar-width: 240px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    background: var(--gray-50);
    color: var(--gray-800);
    line-height: 1.6;
}

/* 布局 */
.app-layout {
    display: flex;
    min-height: 100vh;
}

/* 侧边栏 */
.sidebar {
    width: var(--sidebar-width);
    background: var(--gray-900);
    color: white;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid var(--gray-700);
}

.sidebar-header h1 {
    font-size: 16px;
    font-weight: 600;
    color: white;
}

.sidebar-header p {
    font-size: 12px;
    color: var(--gray-400);
    margin-top: 4px;
}

.sidebar-nav {
    flex: 1;
    padding: 12px 0;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 10px 20px;
    color: var(--gray-300);
    cursor: pointer;
    transition: all 0.2s;
    font-size: 14px;
    border-left: 3px solid transparent;
}

.nav-item:hover {
    background: var(--gray-800);
    color: white;
}

.nav-item.active {
    background: var(--gray-800);
    color: white;
    border-left-color: var(--primary);
}

.nav-item .nav-icon {
    width: 20px;
    margin-right: 10px;
    text-align: center;
}

.nav-section {
    padding: 8px 20px 4px;
    font-size: 11px;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 8px;
}

/* 主内容区 */
.main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    min-height: 100vh;
}

.page-header {
    background: white;
    padding: 16px 24px;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 50;
}

.page-header h2 {
    font-size: 18px;
    font-weight: 600;
}

.page-body {
    padding: 24px;
}

/* 卡片 */
.card {
    background: white;
    border-radius: 8px;
    border: 1px solid var(--gray-200);
    margin-bottom: 16px;
}

.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--gray-100);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-header h3 {
    font-size: 15px;
    font-weight: 600;
}

.card-body {
    padding: 20px;
}

/* 统计卡片 */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: white;
    border-radius: 8px;
    border: 1px solid var(--gray-200);
    padding: 20px;
}

.stat-card .stat-label {
    font-size: 13px;
    color: var(--gray-500);
    margin-bottom: 4px;
}

.stat-card .stat-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--gray-900);
}

.stat-card .stat-sub {
    font-size: 12px;
    color: var(--gray-400);
    margin-top: 4px;
}

.stat-card.primary { border-left: 4px solid var(--primary); }
.stat-card.success { border-left: 4px solid var(--success); }
.stat-card.warning { border-left: 4px solid var(--warning); }
.stat-card.danger { border-left: 4px solid var(--danger); }

/* 表格 */
.table-wrapper {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    padding: 10px 16px;
    text-align: left;
    border-bottom: 1px solid var(--gray-100);
    font-size: 13px;
}

th {
    background: var(--gray-50);
    font-weight: 600;
    color: var(--gray-600);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

tr:hover td {
    background: var(--gray-50);
}

/* 状态标签 */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
}

.badge-registered { background: #e0e7ff; color: #3730a3; }
.badge-sms_downloaded { background: #dbeafe; color: #1e40af; }
.badge-materials_ready { background: #fef3c7; color: #92400e; }
.badge-filed { background: #d1fae5; color: #065f46; }
.badge-hearing_prepared { background: #ede9fe; color: #5b21b6; }
.badge-judged { background: #fce7f3; color: #9d174d; }
.badge-execution_ready { background: #ccfbf1; color: #115e59; }
.badge-archived { background: var(--gray-100); color: var(--gray-600); }
.badge-withdrawn { background: #fee2e2; color: #991b1b; }

/* 按钮 */
.btn {
    display: inline-flex;
    align-items: center;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all 0.2s;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: #1e40af;
}

.btn-outline {
    background: white;
    border-color: var(--gray-300);
    color: var(--gray-700);
}

.btn-outline:hover {
    background: var(--gray-50);
    border-color: var(--gray-400);
}

.btn-success {
    background: var(--success);
    color: white;
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-sm {
    padding: 4px 10px;
    font-size: 12px;
}

.btn-group {
    display: flex;
    gap: 8px;
}

/* 表单 */
.form-group {
    margin-bottom: 16px;
}

.form-label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--gray-700);
    margin-bottom: 4px;
}

.form-input, .form-select {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--gray-300);
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.2s;
}

.form-input:focus, .form-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(26, 86, 219, 0.1);
}

/* 搜索栏 */
.search-bar {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.search-bar .form-input,
.search-bar .form-select {
    width: auto;
    min-width: 180px;
}

/* 流水线视图 */
.pipeline-phase {
    margin-bottom: 20px;
}

.phase-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}

.phase-header h3 {
    font-size: 15px;
    font-weight: 600;
}

.phase-count {
    background: var(--gray-100);
    color: var(--gray-600);
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 12px;
}

/* 预警 */
.alert {
    padding: 12px 16px;
    border-radius: 6px;
    margin-bottom: 12px;
    font-size: 13px;
}

.alert-danger {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #991b1b;
}

.alert-warning {
    background: #fffbeb;
    border: 1px solid #fde68a;
    color: #92400e;
}

.alert-info {
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    color: #1e40af;
}

/* 详情页 */
.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 16px;
}

.detail-item {
    padding: 12px 0;
    border-bottom: 1px solid var(--gray-100);
}

.detail-label {
    font-size: 12px;
    color: var(--gray-500);
    margin-bottom: 2px;
}

.detail-value {
    font-size: 14px;
    font-weight: 500;
}

/* 时间线 */
.timeline {
    position: relative;
    padding-left: 24px;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 8px;
    top: 4px;
    bottom: 4px;
    width: 2px;
    background: var(--gray-200);
}

.timeline-item {
    position: relative;
    padding-bottom: 16px;
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: -20px;
    top: 4px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--primary);
    border: 2px solid white;
}

.timeline-item .time {
    font-size: 12px;
    color: var(--gray-400);
}

.timeline-item .event {
    font-size: 13px;
    color: var(--gray-700);
}

/* 模态框 */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
}

.modal {
    background: white;
    border-radius: 12px;
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    overflow-y: auto;
}

.modal-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-header h3 {
    font-size: 16px;
    font-weight: 600;
}

.modal-body {
    padding: 20px;
}

.modal-footer {
    padding: 12px 20px;
    border-top: 1px solid var(--gray-200);
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

/* 空状态 */
.empty-state {
    text-align: center;
    padding: 40px;
    color: var(--gray-400);
}

.empty-state .icon {
    font-size: 48px;
    margin-bottom: 12px;
}

/* 加载 */
.loading {
    text-align: center;
    padding: 40px;
    color: var(--gray-400);
}

/* 链接 */
.link {
    color: var(--primary);
    cursor: pointer;
    text-decoration: none;
}

.link:hover {
    text-decoration: underline;
}

/* 可点击行 */
.clickable-row {
    cursor: pointer;
}

/* 响应式 */
@media (max-width: 768px) {
    .sidebar {
        width: 60px;
    }
    .sidebar-header h1, .sidebar-header p, .nav-item span, .nav-section {
        display: none;
    }
    .nav-item {
        justify-content: center;
        padding: 12px;
    }
    .nav-item .nav-icon {
        margin: 0;
    }
    .main-content {
        margin-left: 60px;
    }
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ═══════ 登录页面 ═══════ */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.login-box {
    background: white;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    width: 400px;
    padding: 40px;
}

.login-header {
    text-align: center;
    margin-bottom: 32px;
}

.login-header h1 {
    font-size: 24px;
    color: #1a202c;
    margin-bottom: 8px;
}

.login-header p {
    font-size: 14px;
    color: #718096;
}

.login-form .form-group {
    margin-bottom: 20px;
}

.login-form .form-label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: #4a5568;
    margin-bottom: 8px;
}

.login-form .form-input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.2s;
}

.login-form .form-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.login-form .btn {
    width: 100%;
    padding: 12px;
    font-size: 16px;
    font-weight: 600;
}

.login-footer {
    text-align: center;
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid #e2e8f0;
}

.login-footer p {
    font-size: 12px;
    color: #a0aec0;
}

/* ═══════ 顶部栏 ═══════ */
.top-bar {
    background: white;
    border-bottom: 1px solid #e2e8f0;
    padding: 16px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.top-bar-left h2 {
    font-size: 20px;
    font-weight: 600;
    color: #1a202c;
    margin: 0;
}

.top-bar-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.user-info {
    font-size: 14px;
    color: #4a5568;
    display: flex;
    align-items: center;
    gap: 8px;
}

.role-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
}

.role-badge.admin {
    background: #fef3c7;
    color: #92400e;
}

.role-badge.user {
    background: #dbeafe;
    color: #1e40af;
}

/* ═══════ 页面内容 ═══════ */
.page-body {
    padding: 24px;
}

/* ═══════ 统计卡片 ═══════ */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: white;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.stat-label {
    font-size: 14px;
    color: #718096;
    margin-bottom: 8px;
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
    color: #1a202c;
}

/* ═══════ 卡片 ═══════ */
.card {
    background: white;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
}

.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid #e2e8f0;
}

.card-header h3 {
    font-size: 16px;
    font-weight: 600;
    color: #1a202c;
    margin: 0;
}

.card-body {
    padding: 20px;
}

/* ═══════ 流水线 ═══════ */
.pipeline-phase {
    margin-bottom: 24px;
}

.phase-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}

.phase-icon {
    font-size: 20px;
}

.phase-name {
    font-size: 16px;
    font-weight: 600;
    color: #1a202c;
}

.phase-count {
    background: #e2e8f0;
    color: #4a5568;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.case-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.case-item {
    background: #f7fafc;
    padding: 12px 16px;
    border-radius: 6px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    transition: all 0.2s;
}

.case-item:hover {
    background: #edf2f7;
}

.case-borrower {
    font-weight: 500;
    color: #1a202c;
}

.case-type {
    font-size: 13px;
    color: #718096;
}

.case-amount {
    font-size: 14px;
    font-weight: 600;
    color: #2d3748;
}

/* ═══════ 截止日期 ═══════ */
.deadline-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid #e2e8f0;
}

.deadline-item:last-child {
    border-bottom: none;
}

.deadline-date {
    background: #fed7d7;
    color: #742a2a;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 600;
}

.deadline-label {
    font-size: 14px;
    color: #4a5568;
    flex: 1;
}

.deadline-borrower {
    font-size: 14px;
    font-weight: 500;
    color: #1a202c;
}

/* ═══════ 筛选栏 ═══════ */
.filter-bar {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
}

.filter-bar .form-input,
.filter-bar .form-select {
    flex: 1;
    min-width: 150px;
}

/* ═══════ 表格 ═══════ */
.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table thead {
    background: #f7fafc;
}

.data-table th {
    padding: 12px 16px;
    text-align: left;
    font-size: 13px;
    font-weight: 600;
    color: #4a5568;
    border-bottom: 2px solid #e2e8f0;
}

.data-table td {
    padding: 12px 16px;
    font-size: 14px;
    color: #1a202c;
    border-bottom: 1px solid #e2e8f0;
}

.data-table tbody tr {
    cursor: pointer;
    transition: background 0.2s;
}

.data-table tbody tr:hover {
    background: #f7fafc;
}

/* ═══════ 状态徽章 ═══════ */
.status-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.status-registered { background: #e0e7ff; color: #3730a3; }
.status-sms_downloaded { background: #dbeafe; color: #1e40af; }
.status-materials_ready { background: #fef3c7; color: #92400e; }
.status-filed { background: #d1fae5; color: #065f46; }
.status-hearing_prepared { background: #ede9fe; color: #5b21b6; }
.status-judged { background: #fce7f3; color: #9d174d; }
.status-execution_ready { background: #ccfbf1; color: #115e59; }
.status-archived { background: #f3f4f6; color: #4b5563; }
.status-withdrawn { background: #fee2e2; color: #991b1b; }

/* ═══════ 批量操作 ═══════ */
.batch-group {
    margin-bottom: 24px;
    padding-bottom: 24px;
    border-bottom: 1px solid #e2e8f0;
}

.batch-group:last-child {
    border-bottom: none;
}

.batch-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.batch-status {
    font-size: 16px;
    font-weight: 600;
}

.batch-count {
    background: #e2e8f0;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.batch-cases {
    background: #f7fafc;
    border-radius: 6px;
    padding: 12px;
}

.batch-case-item {
    padding: 8px 0;
    font-size: 14px;
    color: #4a5568;
    border-bottom: 1px solid #e2e8f0;
}

.batch-case-item:last-child {
    border-bottom: none;
}

/* ═══════ 时间线 ═══════ */
.timeline {
    position: relative;
    padding-left: 24px;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 8px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: #e2e8f0;
}

.timeline-item {
    position: relative;
    padding-bottom: 20px;
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: -20px;
    top: 4px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #667eea;
    border: 2px solid white;
    box-shadow: 0 0 0 2px #e2e8f0;
}

.timeline-time {
    font-size: 12px;
    color: #718096;
    margin-bottom: 4px;
}

.timeline-content {
    font-size: 14px;
    color: #1a202c;
}

/* ═══════ 详情网格 ═══════ */
.detail-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

.detail-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.detail-label {
    font-size: 13px;
    color: #718096;
    font-weight: 500;
}

.detail-value {
    font-size: 14px;
    color: #1a202c;
}

/* ═══════ 模态框 ═══════ */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal {
    background: white;
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    padding: 20px;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    font-size: 18px;
    font-weight: 600;
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    font-size: 28px;
    color: #718096;
    cursor: pointer;
    line-height: 1;
}

.modal-body {
    padding: 20px;
}

.modal-body .form-group {
    margin-bottom: 16px;
}

.modal-body .form-label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: #4a5568;
    margin-bottom: 6px;
}

.modal-body .form-input,
.modal-body .form-select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    font-size: 14px;
}

/* ═══════ 工具类 ═══════ */
.text-success { color: #10b981; }
.text-danger { color: #ef4444; }
.clickable-row { cursor: pointer; }
