/* ============================================
   保护贷撮合平台 - 主样式表
   ============================================ */

/* ---------- Reset & Base ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Microsoft YaHei', 'PingFang SC', sans-serif;
    font-size: 15px;
    color: #333;
    background: #f0f2f5;
    line-height: 1.6;
    min-height: 100vh;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; }
input, select, textarea, button {
    font-family: inherit; font-size: inherit;
}

/* ---------- Layout ---------- */
.app-wrapper {
    min-height: 100vh; display: flex; flex-direction: column;
}
.app-main {
    flex: 1; max-width: 1100px; width: 96%; margin: 20px auto;
}
.app-footer {
    text-align: center; padding: 20px; font-size: 13px; color: #888;
    border-top: 1px solid #e8e8e8; background: #fff;
}

/* ---------- Header ---------- */
.app-header {
    padding: 0 20px;
}
.loan-theme .app-header { background: #1a365d; color: #fff; }
.service-theme .app-header { background: #1b5e20; color: #fff; }
.admin-theme .app-header, .agent-theme .app-header { background: #2c3e50; color: #fff; }

.no-theme .app-header { background: #1a365d; color: #fff; }

.header-inner {
    display: flex; align-items: center; justify-content: space-between;
    max-width: 1100px; margin: 0 auto; min-height: 56px;
}
.logo { font-size: 20px; font-weight: bold; white-space: nowrap; }
.nav-menu { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.nav-menu a {
    color: rgba(255,255,255,0.85); padding: 8px 14px; border-radius: 6px;
    font-size: 14px; transition: all 0.2s;
}
.nav-menu a:hover {
    background: rgba(255,255,255,0.15); color: #fff;
}
.user-info {
    color: rgba(255,255,255,0.85); font-size: 14px; padding: 8px 12px;
    margin-left: 8px; border-left: 1px solid rgba(255,255,255,0.3);
}
.btn-logout {
    background: rgba(255,255,255,0.2) !important;
}
.btn-logout:hover { background: rgba(255,0,0,0.5) !important; }
.menu-toggle { display: none; background: none; border: none; color: #fff; font-size: 24px; cursor: pointer; }

/* ---------- Cards ---------- */
.card {
    background: #fff; border-radius: 10px; padding: 25px; margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}
.card-title {
    font-size: 18px; font-weight: bold; margin-bottom: 18px; padding-bottom: 12px;
    border-bottom: 2px solid #eee;
}
.loan-theme .card-title { border-color: #1a365d; color: #1a365d; }
.service-theme .card-title { border-color: #1b5e20; color: #1b5e20; }
.admin-theme .card-title, .agent-theme .card-title { border-color: #2c3e50; color: #2c3e50; }

/* ---------- Forms ---------- */
.form-group { margin-bottom: 16px; }
.form-group label {
    display: block; font-weight: 600; margin-bottom: 6px; font-size: 14px; color: #555;
}
.form-group input, .form-group select, .form-group textarea {
    width: 100%; padding: 10px 14px; border: 1px solid #d1d5db;
    border-radius: 8px; outline: none; transition: border 0.2s;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
    border-color: #3b82f6; box-shadow: 0 0 0 3px rgba(59,130,246,0.1);
}
.form-group textarea { min-height: 100px; resize: vertical; }
.form-hint { color: #999; font-size: 12px; margin-top: 4px; }

.btn {
    display: inline-block; padding: 10px 24px; border: none; border-radius: 8px;
    cursor: pointer; font-weight: 600; font-size: 14px; text-align: center;
    transition: all 0.2s;
}
.loan-theme .btn-primary { background: #1a365d; color: #fff; }
.service-theme .btn-primary { background: #1b5e20; color: #fff; }
.admin-theme .btn-primary, .agent-theme .btn-primary { background: #2c3e50; color: #fff; }
.no-theme .btn-primary { background: #1a365d; color: #fff; }

.loan-theme .btn-primary:hover { background: #2a4a7a; }
.service-theme .btn-primary:hover { background: #2e7d32; }
.admin-theme .btn-primary:hover, .agent-theme .btn-primary:hover { background: #3d566e; }
.no-theme .btn-primary:hover { background: #2a4a7a; }

.btn-secondary { background: #e5e7eb; color: #374151; }
.btn-secondary:hover { background: #d1d5db; }
.btn-danger { background: #ef4444; color: #fff; }
.btn-danger:hover { background: #dc2626; }
.btn-success { background: #10b981; color: #fff; }
.btn-success:hover { background: #059669; }
.btn-sm { padding: 6px 14px; font-size: 13px; }
.btn-block { display: block; width: 100%; }
.btn-group { display: flex; gap: 10px; flex-wrap: wrap; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 12px 14px; text-align: left; border-bottom: 1px solid #eee; }
th { background: #f9fafb; font-weight: 600; color: #555; white-space: nowrap; }
tr:hover td { background: #f9fafb; }

/* ---------- Status Badges ---------- */
.badge {
    display: inline-block; padding: 3px 10px; border-radius: 20px;
    font-size: 12px; font-weight: 600; white-space: nowrap;
}

/* ---------- Auth Pages ---------- */
.auth-page {
    display: flex; align-items: center; justify-content: center; min-height: 100vh;
    background: linear-gradient(135deg, #1a365d 0%, #2563eb 50%, #1b5e20 100%);
    padding: 20px;
}
.auth-box {
    background: #fff; border-radius: 14px; padding: 40px 35px;
    width: 100%; max-width: 420px; box-shadow: 0 10px 40px rgba(0,0,0,0.15);
}
.auth-box h2 { text-align: center; margin-bottom: 8px; color: #1a365d; }
.auth-box .subtitle { text-align: center; color: #888; margin-bottom: 25px; font-size: 14px; }
.auth-box .role-tabs {
    display: flex; margin-bottom: 25px; border-radius: 8px; overflow: hidden; border: 2px solid #e5e7eb;
}
.auth-box .role-tab {
    flex: 1; text-align: center; padding: 10px; cursor: pointer; background: #f9fafb;
    font-weight: 600; font-size: 14px; transition: all 0.2s;
}
.auth-box .role-tab.active { background: #1a365d; color: #fff; }
.auth-tip { text-align: center; margin-top: 18px; font-size: 14px; color: #888; }
.auth-tip a { color: #2563eb; font-weight: 600; }

/* ---------- Landing Page ---------- */
.landing-hero {
    text-align: center; padding: 50px 20px;
    background: linear-gradient(135deg, #1a365d, #1b5e20);
    color: #fff; border-radius: 0 0 30px 30px; margin-bottom: 30px;
}
.landing-hero h1 { font-size: 32px; margin-bottom: 10px; }
.landing-hero p { font-size: 16px; opacity: 0.9; max-width: 600px; margin: 0 auto 20px; }
.landing-hero .btn-group { justify-content: center; }
.landing-hero .btn-primary { background: #fff; color: #1a365d; font-size: 16px; padding: 12px 32px; }
.landing-hero .btn-secondary { background: rgba(255,255,255,0.2); color: #fff; font-size: 16px; padding: 12px 32px; }
.landing-features { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 20px; }
.feature-card {
    background: #fff; border-radius: 12px; padding: 30px 25px; text-align: center;
    box-shadow: 0 2px 12px rgba(0,0,0,0.06); transition: transform 0.2s;
}
.feature-card:hover { transform: translateY(-3px); }
.feature-icon { font-size: 44px; margin-bottom: 14px; }
.feature-card h3 { margin-bottom: 8px; color: #1a365d; }
.feature-card p { color: #666; font-size: 14px; }
.landing-bottom { text-align: center; padding: 40px 20px; color: #888; font-size: 13px; }

/* ---------- Loan / Service Dashboard ---------- */
.stats-row {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 15px;
    margin-bottom: 20px;
}
.stat-card {
    background: #fff; padding: 20px; border-radius: 10px; text-align: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}
.stat-num { font-size: 32px; font-weight: bold; margin: 6px 0; }
.loan-theme .stat-num { color: #1a365d; }
.service-theme .stat-num { color: #1b5e20; }
.stat-label { color: #888; font-size: 14px; }

/* ---------- Loan Detail ---------- */
.detail-grid {
    display: grid; grid-template-columns: 1fr 1fr; gap: 16px;
}
.detail-item { padding: 8px 0; }
.detail-item .label { color: #888; font-size: 13px; }
.detail-item .value { font-size: 15px; font-weight: 600; margin-top: 2px; }

/* ---------- File Upload ---------- */
.file-list { margin-top: 12px; }
.file-item {
    display: flex; align-items: center; justify-content: space-between;
    padding: 10px 14px; background: #f9fafb; border-radius: 8px; margin-bottom: 8px;
    font-size: 14px;
}
.file-item .file-name { display: flex; align-items: center; gap: 8px; }
.file-item .file-info { color: #888; font-size: 12px; }

/* ---------- QR Code Display ---------- */
.qr-box {
    text-align: center; padding: 25px; background: #f9fafb; border-radius: 10px;
    border: 2px dashed #e5e7eb; margin: 15px 0;
}
.qr-box img { max-width: 200px; border-radius: 8px; }
.qr-box .qr-note { margin-top: 10px; color: #666; font-size: 13px; }

/* ---------- Alert / Info Boxes ---------- */
.info-box {
    padding: 15px 20px; border-radius: 8px; margin: 15px 0; font-size: 14px;
}
.info-box.info { background: #dbeafe; color: #1e40af; border: 1px solid #bfdbfe; }
.info-box.warning { background: #fef3c7; color: #92400e; border: 1px solid #fcd34d; }
.info-box.success { background: #d1fae5; color: #065f46; border: 1px solid #a7f3d0; }
.info-box.error { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }

/* ---------- Admin Panel ---------- */
.admin-stats {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 15px;
    margin-bottom: 25px;
}
.admin-stat {
    background: #fff; padding: 22px; border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06); border-left: 4px solid #2c3e50;
}
.admin-stat .num { font-size: 28px; font-weight: bold; color: #2c3e50; }

/* ---------- Filter Bar ---------- */
.filter-bar {
    display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 20px;
    padding: 15px; background: #fff; border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}
.filter-bar select, .filter-bar input {
    padding: 8px 12px; border: 1px solid #d1d5db; border-radius: 6px;
}

/* ---------- Pagination ---------- */
.pagination { text-align: center; margin-top: 20px; }
.pagination a, .pagination span {
    display: inline-block; padding: 8px 14px; margin: 0 3px;
    border-radius: 6px; font-size: 14px; background: #f3f4f6; color: #374151;
}
.pagination a:hover { background: #e5e7eb; }
.pagination .active { color: #fff; }
.loan-theme .pagination .active { background: #1a365d; }
.service-theme .pagination .active { background: #1b5e20; }

/* ---------- Two-column Layout ---------- */
.two-col { display: grid; grid-template-columns: 280px 1fr; gap: 20px; }
@media (max-width: 768px) {
    .two-col { grid-template-columns: 1fr; }
}

/* ---------- Mobile Responsive ---------- */
@media (max-width: 768px) {
    .nav-menu { display: none; flex-direction: column; width: 100%; padding: 8px 0; }
    .nav-menu.open { display: flex; }
    .nav-menu a { padding: 10px; border-radius: 0; }
    .menu-toggle { display: block; }
    .header-inner { flex-wrap: wrap; padding: 8px 0; }
    .landing-hero h1 { font-size: 24px; }
    .auth-box { padding: 25px 20px; }
    .detail-grid { grid-template-columns: 1fr; }
    .stats-row { grid-template-columns: 1fr 1fr; }
    .card { padding: 15px; }
    table { font-size: 13px; }
    th, td { padding: 8px 6px; }
    .filter-bar { flex-direction: column; }
    .btn-group { flex-direction: column; }
    .btn-group .btn { width: 100%; text-align: center; }
}
