/* ============================================
   赣文易货管理后台 - 完整样式表 v3
   从零编写，无历史包袱
   ============================================ */

/* Reset */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
    width: 100%;
    height: 100%;
    overflow-x: hidden;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
    font-size: 14px;
    color: #333;
    background: #f0f2f5;
}

/* ===== Login Page ===== */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
}
.login-box {
    background: #fff;
    border-radius: 16px;
    padding: 40px 32px;
    width: 380px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}
.login-logo { text-align: center; margin-bottom: 28px; }
.login-logo .logo-icon { font-size: 42px; display: block; margin-bottom: 8px; }
.login-logo h1 { font-size: 22px; color: #1a1a2e; margin-bottom: 4px; }
.login-logo p { color: #999; font-size: 13px; }

/* ===== Main Layout ===== */
.main-layout {
    display: flex;
    width: 100%;
    min-height: 100vh;
}

/* ===== Sidebar ===== */
.sidebar {
    width: 230px;
    min-width: 230px;
    background: linear-gradient(180deg, #1a1a2e 0%, #16213e 100%);
    color: #fff;
    display: flex;
    flex-direction: column;
    height: 100vh;
    position: sticky;
    top: 0;
    z-index: 100;
}
.sidebar-header {
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}
.sidebar-header .logo-icon { font-size: 26px; }
.sidebar-header span { font-size: 17px; font-weight: 600; }

/* Nav */
.sidebar-nav { flex: 1; padding: 12px 0; overflow-y: auto; }
.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 22px;
    color: rgba(255,255,255,0.65);
    text-decoration: none;
    font-size: 13.5px;
    transition: all 0.15s ease;
    border-left: 3px solid transparent;
}
.sidebar-nav a:hover {
    background: rgba(255,255,255,0.08);
    color: #fff;
}
.sidebar-nav a.nav-active {
    background: rgba(24,144,255,0.15);
    color: #1890ff;
    border-left-color: #1890ff;
    font-weight: 500;
}
.nav-divider { height: 1px; background: rgba(255,255,255,0.06); margin: 10px 16px; }
.nav-group-title {
    font-size: 11px;
    color: rgba(255,255,255,0.3);
    padding: 10px 22px 6px;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    font-weight: 600;
}

/* Sidebar Footer */
.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid rgba(255,255,255,0.08);
}
.admin-info { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.admin-info span:first-child {
    width: 30px; height: 30px; border-radius: 50%;
    background: #1890ff;
    display: flex; align-items: center; justify-content: center;
    font-size: 12px; font-weight: 700; color: #fff;
}
.admin-info span:last-child { font-size: 13px; opacity: 0.9; }
.btn-logout {
    width: 100%; padding: 9px; border: 1px solid rgba(255,255,255,0.15);
    background: transparent; color: rgba(255,255,255,0.7); border-radius: 8px;
    cursor: pointer; font-size: 13px; transition: all 0.15s;
}
.btn-logout:hover { background: rgba(255,255,255,0.1); color: #fff; }

/* ===== Main Content Area ===== */
.main-content {
    flex: 1;
    min-width: 0; /* Critical: prevents flex overflow */
    background: #f0f2f5;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

/* Top Bar */
.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 28px;
    background: #fff;
    border-bottom: 1px solid #e8e8e8;
    position: sticky;
    top: 0;
    z-index: 50;
}
.breadcrumb { font-size: 14px; color: #666; }
.topbar-right { font-size: 13px; }
.admin-role { color: #1890ff; font-weight: 600; }

/* ===== Pages ===== */
.page {
    padding: 24px 28px;
    display: block;
}
.page-title {
    font-size: 19px;
    font-weight: 700;
    margin-bottom: 20px;
    color: #1a1a2e;
}

/* ===== Card ===== */
.card {
    background: #fff;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.04);
    margin-bottom: 18px;
}
.card h3 {
    font-size: 14px;
    font-weight: 600;
    color: #333;
    margin: 0 0 14px 0;
}

/* ===== Dashboard Stats Grid ===== */
.dash-stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
}
.dash-scard {
    background: #fff;
    border-radius: 10px;
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 14px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.05);
    border-left: 3px solid #ddd;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
}
.dash-scard:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,0.1); }
.dash-sicon {
    width: 46px; height: 46px; border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 20px; font-weight: 700; flex-shrink: 0;
}
.dash-sval { font-size: 24px; font-weight: 700; color: #333; line-height: 1.2; }
.dash-slabel { font-size: 12px; color: #888; margin-top: 2px; }

/* Dashboard Highlight Row */
.dash-hl-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
}
.dash-hl-box {
    border-radius: 10px;
    padding: 18px 16px;
    color: #fff;
}
.dash-hlv { font-size: 26px; font-weight: 700; line-height: 1.2; }
.dash-hll { font-size: 12px; opacity: 0.85; margin-top: 4px; }

/* Dashboard Metric Grid */
.dash-metric-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
}
.dash-metric-item {
    background: #fafbfc;
    border-radius: 8px;
    padding: 16px;
    text-align: center;
}
.dash-mv { font-size: 24px; font-weight: 700; line-height: 1.2; }
.dash-ml { font-size: 12px; color: #888; margin-top: 4px; }

/* ===== Tables ===== */
.table-container { overflow-x: auto; border-radius: 8px; }
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.data-table thead th {
    background: #f8f9fa;
    padding: 11px 14px;
    text-align: left;
    font-weight: 600;
    color: #555;
    border-bottom: 2px solid #eee;
    white-space: nowrap;
    font-size: 12.5px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}
.data-table tbody td {
    padding: 11px 14px;
    border-bottom: 1px solid #f5f5f5;
    color: #444;
    vertical-align: middle;
}
.data-table tbody tr:hover { background: #fafbfc; }

/* ===== Forms ===== */
.form-group { margin-bottom: 16px; }
.form-group label {
    display: block;
    font-size: 13px;
    color: #666;
    margin-bottom: 6px;
    font-weight: 500;
}
.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid #d9d9d9;
    border-radius: 7px;
    font-size: 13.5px;
    transition: border-color 0.2s;
    outline: none;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: #1890ff;
    box-shadow: 0 0 0 2px rgba(24,144,255,0.1);
}

/* ===== Buttons ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 9px 20px;
    border-radius: 7px;
    cursor: pointer;
    font-size: 13.5px;
    border: none;
    font-weight: 500;
    transition: all 0.15s;
    gap: 6px;
}
.btn-primary { background: #1890ff; color: #fff; }
.btn-primary:hover { background: #40a9ff; }
.btn-success { background: #52c41a; color: #fff; }
.btn-danger { background: #ff4d4f; color: #fff; }
.btn-warning { background: #faad14; color: #fff; }
.btn-default { background: #fff; color: #666; border: 1px solid #d9d9d9; }
.btn-block { display: flex; width: 100%; }

/* ===== Empty State ===== */
.empty-state {
    text-align: center;
    padding: 50px 20px;
    color: #bbb;
    font-size: 14px;
}

/* ===== Modal ===== */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.45);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}
.modal {
    background: #fff;
    border-radius: 14px;
    padding: 28px;
    width: 520px;
    max-width: 92vw;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}
.modal-header h3 { margin: 0; font-size: 17px; font-weight: 600; }
.modal-close {
    background: none; border: none; font-size: 22px;
    cursor: pointer; color: #ccc; line-height: 1;
}
.modal-close:hover { color: #666; }

/* ===== Toast / Notification ===== */
.toast {
    position: fixed;
    top: 20px; right: 20px;
    padding: 12px 24px;
    border-radius: 8px;
    color: #fff;
    font-size: 13.5px;
    z-index: 9999;
    animation: toastIn 0.3s ease;
    box-shadow: 0 4px 16px rgba(0,0,0,0.15);
}
.toast-error { background: #ff4d4f; }
.toast-success { background: #52c41a; }
.toast-info { background: #1890ff; }
.toast-warning { background: #faad14; color: #333; }
.fade-out { opacity: 0; transition: opacity 0.3s; }
@keyframes toastIn {
    from { transform: translateX(60px); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* ===== Badge ===== */
.badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}
.badge-success { background: #f6ffed; color: #52c41a; border: 1px solid #b7eb8f; }
.badge-danger { background: #fff2f0; color: #ff4d4f; border: 1px solid #ffccc7; }
.badge-warning { background: #fffbe6; color: #faad14; border: 1px solid #ffe58f; }
.badge-info { background: #e6f7ff; color: #1890ff; border: 1px solid #91d5ff; }
.badge-default { background: #f5f5f5; color: #999; border: 1px solid #d9d9d9; }

/* ===== Pagination ===== */
.pagination { display: flex; justify-content: center; gap: 6px; margin-top: 16px; }
.pagination button {
    padding: 6px 14px;
    border: 1px solid #d9d9d9;
    background: #fff;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
}
.pagination button.active { background: #1890ff; color: #fff; border-color: #1890ff; }
.pagination button:hover:not(.active) { border-color: #1890ff; color: #1890ff; }

/* ===== Responsive ===== */
@media (max-width: 1200px) {
    .dash-stats-grid,
    .dash-hl-row,
    .dash-metric-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}
@media (max-width: 768px) {
    .sidebar { width: 60px; min-width: 60px; }
    .sidebar span, .sidebar .nav-group-title, .sidebar .admin-info span:last-child { display: none; }
    .main-content { margin-left: 0; }
    .page { padding: 16px; }
}


/* ========== 平台财务页面样式 ========== */
.page-header { margin-bottom: 20px; }
.page-header h2 { font-size: 22px; font-weight: 700; color: #1a1a1a; margin: 0 0 6px; }
.page-desc { font-size: 13px; color: #888; margin: 0; }

/* 双账户卡片行 */
.finance-cards-row { display: flex; gap: 20px; margin-bottom: 20px; }

.finance-card {
  flex: 1;
  background: #fff;
  border-radius: 12px;
  border: 1px solid #e8e8e8;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,.04);
}
.finance-card-center { border-top: 3px solid #1890ff; }
.finance-card-ops { border-top: 3px solid #52c41a; }

.finance-card-header {
  padding: 16px 20px 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid #f0f0f0;
}
.finance-icon { font-size: 18px; }
.finance-title { font-size: 16px; font-weight: 600; color: #1a1a1a; }

.finance-card-body { padding: 20px; }

.finance-balance-row {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin-bottom: 16px;
}
.finance-label { font-size: 13px; color: #666; }
.finance-value { font-size: 32px; font-weight: 700; color: #1890ff; letter-spacing: -1px; }
.finance-unit { font-size: 13px; color: #999; }

.finance-frozen-row { margin-bottom: 12px; padding: 8px 12px; background: #e6f7ff; border-radius: 6px; font-size: 13px; color: #1890ff; }
.frozen-label strong { color: #1890ff; }

.finance-stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  padding-top: 14px;
  border-top: 1px solid #f5f5f5;
}
.finance-stat-item { text-align: center; }
.stat-label { display: block; font-size: 11px; color: #999; margin-bottom: 4px; }
.stat-value { display: block; font-size: 17px; font-weight: 600; color: #333; }
.profit-value { color: #52c41a; }

.finance-card-actions {
  padding: 12px 20px;
  border-top: 1px solid #f0f0f0;
  display: flex;
  gap: 10px;
}

/* 合伙人投资管理 */
.finance-section-title {
  font-size: 15px; font-weight: 600; margin: 24px 0 14px;
  display: flex; align-items: center; gap: 6px; color: #1a1a1a;
}
.invest-header-row {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 12px;
}
.invest-badge {
  background: #fff7e6; color: #d48806; padding: 2px 10px; border-radius: 10px;
  font-size: 12px; font-weight: 500;
}

/* 账户流水 */
.log-tab-bar {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 14px; flex-wrap: wrap;
}
.log-tab-btn {
  padding: 6px 16px; border-radius: 6px; font-size: 13px; cursor: pointer;
  border: 1px solid #d9d9d9; background: #fff; color: #666; transition: all .15s;
}
.log-tab-btn:hover { border-color: #1890ff; color: #1890ff; }
.log-tab-btn.active { background: #1890ff; color: #fff; border-color: #1890ff; }
.log-total { font-size: 12px; color: #999; margin-left: auto; }

/* Modal 样式 */
.modal-overlay {
  position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(0,0,0,.5); z-index: 1000;
  display: none; align-items: center; justify-content: center;
}
.modal-box {
  background: #fff; border-radius: 12px; width: 480px; max-width: 90vw;
  box-shadow: 0 8px 30px rgba(0,0,0,.15); overflow: hidden;
}
.modal-head {
  padding: 16px 20px; border-bottom: 1px solid #f0f0f0;
  display: flex; align-items: center; justify-content: space-between;
}
.modal-head h3 { margin: 0; font-size: 16px; font-weight: 600; }
.modal-close-btn {
  background: none; border: none; font-size: 20px; cursor: pointer;
  color: #999; line-height: 1; padding: 4px;
}
.modal-close-btn:hover { color: #333; }
.modal-body { padding: 20px; }
.form-group { margin-bottom: 14px; }
.form-group label { display: block; font-size: 13px; font-weight: 500; color: #555; margin-bottom: 5px; }
.form-group input, .form-group select, .form-group textarea {
  width: 100%; padding: 8px 12px; border: 1px solid #d9d9d9; border-radius: 6px;
  font-size: 14px; outline: none; transition: border-color .15s;
  box-sizing: border-box;
}
.form-group input:focus, .form-group select:focus { border-color: #1890ff; box-shadow: 0 0 0 2px rgba(24,144,255,.1); }
.modal-foot {
  padding: 12px 20px; border-top: 1px solid #f0f0f0;
  display: flex; justify-content: flex-end; gap: 8px;
}

/* 按钮补充 */
.btn-outline { background: #fff; color: #666; border: 1px solid #d9d9d9; }
.btn-outline:hover { color: #1890ff; border-color: #1890ff; }
.btn-danger { background: #ff4d4f; color: #fff; border: 1px solid #ff4d4f; }
.btn-danger:hover { background: #ff7875; }
.btn-sm { padding: 6px 14px; font-size: 13px; }
.btn-primary { background: #1890ff; color: #fff; border: 1px solid #1890ff; }
.btn-primary:hover { background: #40a9ff; }
.btn-block { width: 100%; }

/* 表格 */
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th, .data-table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid #f0f0f0; }
.data-table th { background: #fafbfc; color: #666; font-weight: 600; font-size: 12px; white-space: nowrap; }
.data-table tr:hover { background: #fafafa; }

/* 卡片 */
.card { background: #fff; border-radius: 10px; padding: 20px; margin-bottom: 16px; box-shadow: 0 1px 3px rgba(0,0,0,.05); border: 1px solid #eee; }

/* 分页 */
.pagination { display: flex; gap: 4px; justify-content: center; margin-top: 14px; flex-wrap: wrap; }
.page-btn { padding: 5px 11px; border: 1px solid #d9d9d9; border-radius: 4px; cursor: pointer; font-size: 12px; background: #fff; color: #666; }
.page-btn:hover { border-color: #1890ff; color: #1890ff; }
.page-btn.active { background: #1890ff; color: #fff; border-color: #1890ff; }
.page-btn.disabled { color: #ccc; cursor: not-allowed; }

/* Toast */
.toast { position: fixed; top: 20px; right: 20px; padding: 10px 20px; border-radius: 8px; color: #fff; font-size: 13px; z-index: 2000; animation: slideIn .3s ease; }
.toast-success { background: #52c41a; }
.toast-error { background: #ff4d4f; }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* 响应式 */
@media (max-width: 768px) {
  .finance-cards-row { flex-direction: column; }
  .finance-stats-grid { grid-template-columns: repeat(3, 1fr); }
}

/* Target search autocomplete */
.target-search-wrap{position:relative}
.target-search-results{position:absolute;top:100%;left:0;right:0;background:#fff;border:1px solid #d9d9d9;border-radius:6px;box-shadow:0 4px 12px rgba(0,0,0,.1);z-index:100;max-height:200px;overflow-y:auto;margin-top:4px}
.target-item{padding:10px 14px;cursor:pointer;font-size:13px;border-bottom:1px solid #f5f5f5;display:flex;justify-content:space-between;align-items:center}
.target-item:hover{background:#f0f7ff}
.target-type{font-size:11px;color:#999;background:#f5f5f5;padding:2px 8px;border-radius:4px}
.radio-group{display:flex;flex-direction:column;gap:8px}
.radio-label{display:flex;align-items:center;gap:6px;cursor:pointer;font-size:14px;color:#444}
.form-row-2col{display:flex;gap:16px}
.form-row-2col .form-group{flex:1}
.form-hint{font-size:12px;color:#999}
.invest-fields{}
.required{color:#ff4d4f}
.modal-lg{width:560px}
.modal-header{padding:16px 20px;border-bottom:1px solid #f0f0f0;display:flex;align-items:center;justify-content:space-between}
.modal-header h3{margin:0;font-size:16px;font-weight:600}
.modal-close{background:none;border:none;font-size:22px;cursor:pointer;color:#999;line-height:1;padding:0 4px}
.modal-close:hover{color:#333}
.modal-footer{padding:12px 20px;border-top:1px solid #f0f0f0;display:flex;justify-content:flex-end;gap:8px}

/* 左侧导航激活状态 */
.nav-item.active { background: linear-gradient(135deg, #667eea, #764ba2); color: #fff; border-radius: 6px; }
.nav-item.active .nav-icon, .nav-item.active .nav-text { color: #fff; }
