/* 利润核算系统 - 全局样式 */
.muted { color: #9ca3af; font-style: italic; }
:root {
    --primary: #2563eb;
    --primary-dark: #1e40af;
    --success: #16a34a;
    --warning: #f59e0b;
    --danger: #dc2626;
    --bg: #f8fafc;
    --card-bg: #ffffff;
    --text: #1e293b;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
    --shadow-lg: 0 4px 12px rgba(0,0,0,0.1);
    --radius: 10px;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "PingFang SC", "Microsoft YaHei", sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    font-size: 14px;
}

/* 顶部导航 */
.topbar {
    background: #fff;
    border-bottom: 1px solid var(--border);
    padding: 0 24px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow);
}
.nav-brand {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 18px;
    font-weight: 700;
    color: var(--text);
}
.nav-brand .logo { display: flex; align-items: center; }
.nav-links {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    gap: 4px;
}
/* 窄屏回退: 取消绝对定位,允许换行居中,避免与左右两侧重叠 */
@media (max-width: 900px) {
    .nav-links {
        position: static;
        transform: none;
        flex-wrap: wrap;
        justify-content: center;
    }
}
.nav-links a {
    padding: 8px 16px;
    border-radius: 8px;
    text-decoration: none;
    color: var(--text-muted);
    font-weight: 500;
    transition: all 0.15s;
}
.nav-links a:hover { background: var(--bg); color: var(--text); }
.nav-links a.active { background: var(--primary); color: #fff; }

/* 容器 */
.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 24px;
}

/* 统计卡片 */
.stats-grid, .stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}
.stat-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 20px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
}
.stat-card.settled { border-left: 4px solid var(--success); }
.stat-card.unsettled { border-left: 4px solid var(--warning); }
.stat-icon { display: flex; align-items: flex-start; padding-top: 4px; }
.stat-label { color: var(--text-muted); font-size: 13px; margin-bottom: 4px; }
.stat-value { font-size: 24px; font-weight: 700; color: var(--text); }
.stat-sub { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

/* 卡片 */
.card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
}
.card h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}

/* 两列布局 */
.two-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}
@media (max-width: 768px) { .two-col { grid-template-columns: 1fr; } }

/* 平台网格 */
.platform-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
}
.platform-card {
    display: block;
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: 8px;
    text-decoration: none;
    color: var(--text);
    transition: all 0.15s;
    position: relative;
}
.platform-card:hover { border-color: var(--primary); box-shadow: var(--shadow-lg); }
.platform-card.inactive { opacity: 0.5; }
.platform-name { font-weight: 600; font-size: 15px; margin-bottom: 4px; }
.platform-sheet { font-size: 12px; color: var(--text-muted); margin-bottom: 8px; }
.platform-stats { display: flex; gap: 12px; font-size: 13px; color: var(--text-muted); }
.platform-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    background: var(--warning);
    color: #fff;
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 10px;
}

/* 表格 */
.table-wrap { overflow-x: auto; }
table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
th, td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
th {
    font-weight: 600;
    color: var(--text-muted);
    background: var(--bg);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
tr:hover { background: var(--bg); }
td.amount, th.amount { text-align: right; font-variant-numeric: tabular-nums; }
td.highlight { color: var(--primary); font-weight: 600; }
td.reason { color: var(--danger); font-size: 12px; max-width: 200px; overflow: hidden; text-overflow: ellipsis; }
.filename { max-width: 180px; overflow: hidden; text-overflow: ellipsis; }
.detail-table th, .detail-table td { font-size: 12px; }

/* 徽章 */
.badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
}
.badge.imported, .badge.paid { background: #dcfce7; color: #166534; }
.badge.pending, .badge.unpaid { background: #fef3c7; color: #92400e; }
.badge.settled { background: #dbeafe; color: #1e40af; }

/* 按钮 */
.btn {
    display: inline-flex;
    align-items: center;
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.15s;
    background: var(--bg);
    color: var(--text);
}
.btn:hover { background: var(--border); }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-sm { padding: 4px 10px; font-size: 12px; }

/* 表单 */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; margin-bottom: 6px; font-weight: 500; }
.form-group select, .form-group input[type="file"] {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 14px;
}
.hint { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

/* 上传结果 */
.result-box {
    margin-top: 20px;
    padding: 16px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 16px;
}
.result-box.success { background: #dcfce7; border: 1px solid #86efac; }
.result-box.error { background: #fee2e2; border: 1px solid #fca5a5; }
.result-icon { font-size: 32px; }
.result-text h4 { margin-bottom: 8px; }
.result-text p { font-size: 13px; color: var(--text-muted); }
.loading { padding: 16px 0; text-align: center; color: var(--text-muted); }

/* 平台信息 */
.platform-info { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 16px; }
.info-item { padding: 16px; border: 1px solid var(--border); border-radius: 8px; }
.info-item h4 { margin-bottom: 8px; }
.info-item p { font-size: 12px; color: var(--text-muted); margin-bottom: 4px; }

/* 批次头部 */
.batch-header {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
}
.batch-header h2 { font-size: 20px; margin-bottom: 8px; }
.batch-meta { display: flex; flex-wrap: wrap; gap: 12px; font-size: 13px; color: var(--text-muted); }
.batch-meta span { display: flex; align-items: center; gap: 4px; }

/* 分页 */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-top: 16px;
}
.page-info { font-size: 13px; color: var(--text-muted); }

/* 合计行 */
tr.totals-row {
    font-weight: 700;
    background: #f0f4f8;
    border-top: 2px solid var(--border);
}
tr.totals-row td {
    padding-top: 14px;
    padding-bottom: 14px;
}
/* 可切换币种的金额单元格 */
td[data-cur] {
    cursor: pointer;
    position: relative;
}
td[data-cur]:hover::after {
    content: ' 双击切换';
    font-size: 10px;
    color: #9ca3af;
    margin-left: 4px;
}

/* 空状态 */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
}
.empty-state a { color: var(--primary); }




/* IconPark SVG icons - size & alignment */
.nav-brand .icon {
    width: 20px; height: 20px;
    vertical-align: middle;
    margin-right: 4px;
}
.nav-links .icon {
    width: 15px; height: 15px;
    vertical-align: middle;
    margin-right: 3px;
}
h3 .icon, h2 .icon {
    width: 18px; height: 18px;
    vertical-align: middle;
    margin-right: 4px;
}
td .icon, .btn .icon {
    width: 14px; height: 14px;
    vertical-align: middle;
    margin-right: 3px;
}
.batch-meta .icon, .batch-header .icon {
    width: 14px; height: 14px;
    vertical-align: middle;
    margin-right: 3px;
}
.platform-name .icon {
    width: 18px; height: 18px;
    vertical-align: middle;
    margin-right: 4px;
}
.stat-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 20px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
}
.stat-icon { display: flex; align-items: flex-start; padding-top: 4px; }
.stat-icon .icon { width: 14px; height: 14px; }
.icon {
    width: 14px; height: 14px;
    vertical-align: middle;
    display: inline-block;
    margin-right: 3px;
}
