/* ===== 方唐文化管理系统 - 全局样式 ===== */

/* ─── 基础重置 ─── */
* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
    --green: #4CAF50;
    --green-dark: #388E3C;
    --green-light: #E8F5E9;
    --green-bg: #F4FBF6;
    --blue: #2196F3;
    --blue-light: #E3F2FD;
    --orange: #FF9800;
    --orange-light: #FFF3E0;
    --purple: #9C27B0;
    --purple-light: #F3E5F5;
    --red: #F44336;
    --red-light: #FFEBEE;
    --gray: #9E9E9E;
    --gray-light: #F5F5F5;
    --gray-border: #E0E0E0;
    --text: #333;
    --text-secondary: #666;
    --text-muted: #999;
    --bg: #F0F2F5;
    --white: #FFF;
    --sidebar-w: 240px;
    --radius: 10px;
    --radius-sm: 6px;
    --shadow: 0 2px 8px rgba(0,0,0,0.08);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.12);
}

body {
    font-family: "Microsoft YaHei", "微软雅黑", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    line-height: 1.6;
}

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

/* ─── 侧边栏 ─── */
.sidebar {
    width: var(--sidebar-w);
    background: linear-gradient(180deg, #2E7D32 0%, #1B5E20 100%);
    color: var(--white);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 100;
    transition: transform 0.3s;
}

.sidebar-header {
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid rgba(255,255,255,0.15);
}

.logo-icon {
    width: 40px; height: 40px;
    background: rgba(255,255,255,0.2);
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-size: 22px; font-weight: bold;
}

.logo-title { font-size: 16px; font-weight: bold; }
.logo-sub { font-size: 11px; opacity: 0.7; }

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

.nav-item {
    display: flex; align-items: center; gap: 10px;
    padding: 12px 20px;
    color: rgba(255,255,255,0.8);
    text-decoration: none;
    transition: all 0.2s;
    border-left: 3px solid transparent;
    position: relative;
}

.nav-item:hover { background: rgba(255,255,255,0.1); color: var(--white); }
.nav-item.active { background: rgba(255,255,255,0.15); color: var(--white); border-left-color: var(--white); }
.nav-icon { width: 20px; text-align: center; font-size: 15px; }

.nav-badge {
    background: var(--red);
    color: var(--white);
    border-radius: 10px;
    padding: 1px 7px;
    font-size: 11px;
    margin-left: auto;
}

/* 子菜单 */
.nav-item-group .nav-parent { cursor: pointer; }
.nav-arrow { margin-left: auto; font-size: 10px; transition: transform 0.2s; }
.nav-item-group.open .nav-arrow { transform: rotate(180deg); }
.nav-submenu { overflow: hidden; }
.nav-sub-item {
    display: block;
    padding: 10px 20px 10px 48px;
    color: rgba(255,255,255,0.7);
    text-decoration: none;
    font-size: 13px;
    transition: all 0.2s;
    border-left: 3px solid transparent;
}
.nav-sub-item:hover { background: rgba(255,255,255,0.08); color: var(--white); }
.nav-sub-item.active { background: rgba(255,255,255,0.12); color: var(--white); border-left-color: rgba(255,255,255,0.5); }

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid rgba(255,255,255,0.15);
}

.user-info { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }

.user-avatar {
    width: 36px; height: 36px;
    background: rgba(255,255,255,0.2);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 16px; font-weight: bold;
}

.user-name { font-size: 13px; font-weight: 500; }
.user-role { font-size: 11px; opacity: 0.7; }

.btn-logout {
    display: block; width: 100%;
    padding: 8px;
    text-align: center;
    background: rgba(255,255,255,0.1);
    color: var(--white);
    border: none; border-radius: var(--radius-sm);
    cursor: pointer; text-decoration: none;
    font-size: 13px; transition: background 0.2s;
}
.btn-logout:hover { background: rgba(255,255,255,0.2); }

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

.topbar {
    background: var(--white);
    padding: 0 24px;
    height: 60px;
    display: flex; align-items: center;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
    position: sticky; top: 0; z-index: 50;
}

.menu-toggle {
    display: none;
    background: none; border: none;
    font-size: 20px; cursor: pointer;
    margin-right: 12px;
}

.page-title { font-size: 18px; font-weight: 600; flex: 1; }

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

.date-display {
    color: var(--text-secondary);
    font-size: 13px;
}

.content-body { padding: 20px 24px; flex: 1; }

/* ─── 卡片 ─── */
.card {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 20px;
    overflow: hidden;
}

/* 包含下拉筛选的卡片需要可见溢出，避免下拉菜单被截断 */
.card.filter-card { overflow: visible !important; }

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

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

.card-body { padding: 20px; }

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

.stat-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 20px;
    display: flex; align-items: center; gap: 16px;
    box-shadow: var(--shadow);
    border-left: 4px solid var(--green);
}

.stat-card.stat-green { border-left-color: var(--green); }
.stat-card.stat-blue { border-left-color: var(--blue); }
.stat-card.stat-orange { border-left-color: var(--orange); }
.stat-card.stat-purple { border-left-color: var(--purple); }

.stat-icon {
    width: 50px; height: 50px;
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 24px; font-weight: bold;
}

.stat-green .stat-icon { background: var(--green-light); color: var(--green); }
.stat-blue .stat-icon { background: var(--blue-light); color: var(--blue); }
.stat-orange .stat-icon { background: var(--orange-light); color: var(--orange); }
.stat-purple .stat-icon { background: var(--purple-light); color: var(--purple); }

.stat-label { font-size: 13px; color: var(--text-secondary); }
.stat-value { font-size: 22px; font-weight: 700; margin: 2px 0; }
.stat-sub { font-size: 12px; color: var(--text-muted); }

/* ─── 表格 ─── */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.data-table th {
    background: var(--green);
    color: var(--white);
    padding: 10px 12px;
    text-align: left;
    font-weight: 500;
    white-space: nowrap;
}

.data-table td {
    padding: 9px 12px;
    border-bottom: 1px solid var(--gray-border);
}

.data-table tbody tr:hover { background: var(--green-bg); }
.data-table tbody tr:nth-child(even) { background: #FAFAFA; }
.data-table tbody tr:nth-child(even):hover { background: var(--green-bg); }

.data-table .amount { font-weight: 600; color: var(--green-dark); text-align: right; }
.data-table .total-row td { background: var(--green-light); font-weight: 700; }
.data-table .text-wrap { max-width: 300px; word-wrap: break-word; }
.data-table .text-muted { color: var(--text-muted); }

/* 分批支付行颜色 — 5色循环，同一表单同色 */
.data-table tbody tr.row-batch-0 { background: #E3F2FD !important; }
.data-table tbody tr.row-batch-0:hover { background: #BBDEFB !important; }
.data-table tbody tr.row-batch-1 { background: #E8F5E9 !important; }
.data-table tbody tr.row-batch-1:hover { background: #C8E6C9 !important; }
.data-table tbody tr.row-batch-2 { background: #FFF8E1 !important; }
.data-table tbody tr.row-batch-2:hover { background: #FFECB3 !important; }
.data-table tbody tr.row-batch-3 { background: #FCE4EC !important; }
.data-table tbody tr.row-batch-3:hover { background: #F8BBD0 !important; }
.data-table tbody tr.row-batch-4 { background: #F3E5F5 !important; }
.data-table tbody tr.row-batch-4:hover { background: #E1BEE7 !important; }
/* 未付完的分批支付：红色左边框 */
.data-table tbody tr.row-form-unpaid { border-left: 4px solid #FF6B00 !important; }
/* 批次标签 */
.batch-badge { display:inline-block; font-size:11px; padding:1px 5px; border-radius:3px; background:#e8e8e8; color:#666; margin-left:4px; vertical-align:middle; }
.batch-badge.batch-first { background:#FF6B00; color:#fff; }

/* 未支付完的行底色标注 — 橙色背景+红色左边框 (保留兼容旧引用) */
.data-table tbody tr.row-unpaid {
    background: #FFF3E0 !important;
    border-left: 4px solid #FF6B00 !important;
}
.data-table tbody tr.row-unpaid:hover { background: #FFE0B2 !important; }

/* 表单信息框 */
.form-info-box {
    background: #f5f5f5;
    border-radius: 6px;
    padding: 10px 12px;
    margin-bottom: 12px;
    font-size: 13px;
}
.form-info-box .form-group { margin-bottom: 0; }

/* 紧凑表格（数据维护页面） */
.data-table.compact { width: auto; max-width: 100%; table-layout: auto; }
.data-table.compact th,
.data-table.compact td { padding: 4px 6px; font-size: 13px; }
.data-table.compact .btn-xs { padding: 2px 5px; font-size: 12px; }

/* 拖拽排序样式 */
.drag-handle { cursor: grab; color: #aaa; text-align: center; user-select: none; font-size: 14px; }
.drag-handle:hover { color: #666; }
tr.dragging { opacity: 0.4; background: #e0f7fa !important; }
tr[draggable="true"]:hover { background: #f5f5f5; }

.summary-table { font-size: 12px; border-collapse: collapse; width: auto; min-width: auto; background: #fff; }
.summary-table th,
.summary-table td { padding: 3px 6px; border: 1px solid #d0d0d0; white-space: nowrap; }
.summary-table th { text-align: center; background: #4472C4; color: #fff; font-weight: 600; }
.summary-table th:first-child { text-align: center; min-width: 72px; }
.summary-table th:not(:first-child):not(:last-child) { width: 80px; }
.summary-table th:last-child { text-align: center; min-width: 92px; }
.summary-table td { text-align: right; color: #333; }
.summary-table .amount { color: #333 !important; font-weight: 400; }
.summary-table td:first-child { text-align: center; font-weight: 500; color: #333; }
.summary-table td:last-child { text-align: center; font-weight: 700; color: #1a1a1a; }
.summary-table .cell-zero { color: #bbb; }
.summary-table tbody tr { background: #fff; }
.summary-table tbody tr:nth-child(even) { background: #E9EFF7; }
.summary-table tbody tr:hover { background: #DDEBF7; }

/* 汇总表总计行 */
.summary-table tfoot tr.total-row td { background: #D6E4F0; font-weight: 700; color: #1a1a1a; border-top: 2px solid #4472C4; }
.summary-table tfoot tr.total-row td:first-child { text-align: center; }
.summary-table tfoot tr.total-row td:last-child { background: #FFF2CC; color: #7F6000; }

/* 缩放容器 */
.zoom-wrapper { overflow: auto; padding: 0 !important; }

/* 团队长多选下拉 */
.dropdown-multiselect { position: relative; display: inline-block; }
.dropdown-toggle { cursor: pointer; display: inline-flex; align-items: center; justify-content: space-between; }
.dropdown-toggle::after { content: "▾"; margin-left: 6px; font-size: 10px; color: #999; }
.dropdown-menu-panel {
    position: absolute; top: 100%; left: 0; z-index: 9999;
    background: #fff; border: 1px solid #d0d0d0; border-radius: 4px;
    box-shadow: 0 6px 20px rgba(0,0,0,0.18); min-width: 220px;
    padding: 4px 0;
}
.dropdown-menu-panel label {
    display: block; font-size: 13px; cursor: pointer;
    padding: 5px 12px; white-space: nowrap; color: #333;
}
.dropdown-menu-panel label:hover { background: #f0f7ff; }
.dropdown-menu-panel input[type="checkbox"] { margin-right: 6px; vertical-align: middle; }

/* ─── 按钮 ─── */
.btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 8px 16px;
    border: none; border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 13px; font-weight: 500;
    text-decoration: none;
    transition: all 0.2s;
    white-space: nowrap;
}

.btn-primary { background: var(--green); color: var(--white); }
.btn-primary:hover { background: var(--green-dark); }
.btn-success { background: #66BB6A; color: var(--white); }
.btn-success:hover { background: var(--green); }
.btn-warning { background: var(--orange); color: var(--white); }
.btn-warning:hover { background: #F57C00; }
.btn-danger { background: var(--red); color: var(--white); }
.btn-danger:hover { background: #D32F2F; }
.btn-default { background: var(--gray-light); color: var(--text); }
.btn-default:hover { background: var(--gray-border); }
.btn-block { width: 100%; justify-content: center; padding: 12px; }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-xs { padding: 3px 8px; font-size: 11px; }

/* ─── 表单 ─── */
.input, select.input, textarea.input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--gray-border);
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s;
    background: var(--white);
    color: var(--text);
}

.input:focus { border-color: var(--green); }
textarea.input { resize: vertical; }

.form-group { margin-bottom: 14px; }
.form-group label { display: block; margin-bottom: 5px; font-weight: 500; font-size: 13px; }
.form-row { display: flex; gap: 14px; }
.form-row .form-group { flex: 1; }

.required { color: var(--red); }
.hint { font-size: 12px; color: var(--text-muted); font-weight: normal; }

/* ─── 筛选栏 ─── */
.filter-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 12px;
}

.filter-group { display: flex; flex-direction: column; gap: 4px; }
.filter-group label { font-size: 12px; color: var(--text-secondary); }
.filter-group .input { min-width: 130px; }

/* 日期范围筛选 - 单行布局 */
.filter-date-group .date-range-inputs {
    display: flex;
    align-items: center;
    gap: 6px;
}
.filter-date-group .date-range-inputs input {
    min-width: 130px;
    width: 130px;
}
.filter-date-group .date-range-inputs span {
    color: var(--text-secondary);
    font-size: 12px;
    white-space: nowrap;
}

/* ─── 弹窗 ─── */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex; align-items: center; justify-content: center;
    z-index: 1000;
}

.modal {
    background: var(--white);
    border-radius: var(--radius);
    width: 520px;
    max-width: 90vw;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
}

.modal-sm { width: 400px; }

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

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

.modal-close {
    background: none; border: none;
    font-size: 22px; cursor: pointer;
    color: var(--text-muted); line-height: 1;
}

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

/* ─── 标签 ─── */
.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 500;
    white-space: nowrap;
}
.badge-primary { background: var(--blue-light); color: var(--blue); }
.badge-success { background: var(--green-light); color: var(--green-dark); }
.badge-warning { background: var(--orange-light); color: #E65100; }
.badge-danger { background: var(--red-light); color: var(--red); }
.badge-info { background: var(--blue-light); color: var(--blue); }
.badge-default { background: var(--gray-light); color: var(--text-secondary); }

/* ─── 提示 ─── */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
    font-size: 13px;
}
.alert-error { background: var(--red-light); color: var(--red); }
.alert-info { background: var(--blue-light); color: var(--blue); }
.alert-success { background: var(--green-light); color: var(--green-dark); }

/* ─── 进度条 ─── */
.progress-bar {
    position: relative;
    width: 100%;
    height: 20px;
    background: var(--gray-light);
    border-radius: 10px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--green);
    border-radius: 10px;
    transition: width 0.3s;
}

.progress-bar span {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    display: flex; align-items: center; justify-content: center;
    font-size: 11px; font-weight: 500;
}

/* ─── 图表 ─── */
.chart-container {
    display: flex;
    align-items: flex-end;
    justify-content: space-around;
    gap: 8px;
    height: 220px;
    padding: 10px 0;
}

.chart-bar-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
    height: 100%;
    justify-content: flex-end;
}

.chart-bar-label { font-size: 11px; color: var(--text-secondary); margin-bottom: 4px; }

.chart-bar {
    width: 80%;
    max-width: 50px;
    min-height: 2px;
    background: linear-gradient(180deg, var(--green) 0%, var(--green-dark) 100%);
    border-radius: 4px 4px 0 0;
    transition: height 0.3s;
}

.chart-bar-date { font-size: 11px; color: var(--text-muted); margin-top: 6px; }

/* ─── 排行列表 ─── */
.ranking-list { display: flex; flex-direction: column; gap: 10px; }

.ranking-item {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 14px;
    background: var(--gray-light);
    border-radius: var(--radius-sm);
}

.ranking-rank {
    width: 28px; height: 28px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-weight: bold; font-size: 13px;
    background: var(--green);
    color: var(--white);
}

.ranking-item:nth-child(1) .ranking-rank { background: #FFD700; color: #333; }
.ranking-item:nth-child(2) .ranking-rank { background: #C0C0C0; color: #333; }
.ranking-item:nth-child(3) .ranking-rank { background: #CD7F32; color: var(--white); }

.ranking-name { flex: 1; font-weight: 500; }
.ranking-amount { font-weight: 700; color: var(--green-dark); }

/* ─── 其他 ─── */
.empty-state { text-align: center; padding: 40px; color: var(--text-muted); }
.loading-cell { text-align: center; padding: 30px; color: var(--text-muted); }
.table-responsive { overflow-x: auto; }
.text-wrap { word-break: break-all; }
.row-warning { background: var(--orange-light) !important; }

/* ─── 数据维护 ─── */
.option-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 20px;
    border-bottom: 2px solid var(--gray-border);
    padding-bottom: 0;
}

.option-tab {
    padding: 8px 16px;
    background: var(--gray-light);
    border: none;
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    transition: all 0.2s;
}

.option-tab:hover { background: var(--green-bg); color: var(--green-dark); }
.option-tab.active { background: var(--green); color: var(--white); }

.option-panel { margin-top: 16px; }

.option-panel-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 12px;
}

.option-panel-header h3 { font-size: 14px; font-weight: 600; }

/* ─── 登录页 ─── */
.login-page {
    min-height: 100vh;
    display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, #2E7D32 0%, #1B5E20 50%, #004D40 100%);
    padding: 20px;
}

.login-card {
    background: var(--white);
    border-radius: 16px;
    padding: 40px;
    width: 440px;
    max-width: 90vw;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

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

.login-logo {
    width: 60px; height: 60px;
    margin: 0 auto 16px;
    background: var(--green);
    color: var(--white);
    border-radius: 16px;
    display: flex; align-items: center; justify-content: center;
    font-size: 30px; font-weight: bold;
}

.login-header h1 { font-size: 22px; color: var(--text); }
.login-header p { font-size: 13px; color: var(--text-muted); margin-top: 4px; }

.login-form .form-group { margin-bottom: 18px; }
.login-form .form-group label { font-weight: 500; font-size: 14px; margin-bottom: 6px; }
.login-form input[type="text"],
.login-form input[type="password"] {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--gray-border);
    border-radius: var(--radius-sm);
    font-size: 16px;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s;
    background: var(--white);
    color: var(--text);
}
.login-form input[type="text"]:focus,
.login-form input[type="password"]:focus { border-color: var(--green); }

.login-form .btn-block {
    width: 100%;
    justify-content: center;
    padding: 14px;
    font-size: 16px;
    font-weight: 600;
    margin-top: 6px;
}

.login-hint {
    margin-top: 24px;
    padding: 14px;
    background: var(--gray-light);
    border-radius: var(--radius-sm);
    font-size: 12px;
}

.login-hint p { color: var(--text-secondary); margin-bottom: 6px; }
.login-hint-table { width: 100%; }
.login-hint-table td { padding: 3px 0; }
.login-hint-table td:first-child { color: var(--text-muted); width: 60px; }
.login-hint-table td:last-child { font-family: monospace; color: var(--green-dark); }

/* ─── 响应式 ─── */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        width: 260px;
    }
    .sidebar.show { transform: translateX(0); }
    .main-content { margin-left: 0; }
    .menu-toggle { display: block; }

    /* 遮罩层 */
    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 0; left: 0; right: 0; bottom: 0;
        background: rgba(0,0,0,0.4);
        z-index: 99;
    }
    .sidebar-overlay.show { display: block; }

    /* 统计卡片单列 */
    .stats-grid { grid-template-columns: 1fr; }
    .expense-summary-inline { flex-direction: column; }

    /* 表单行垂直排列 */
    .form-row { flex-direction: column; }
    .filter-bar { flex-direction: column; align-items: stretch; }
    .filter-group { width: 100%; }
    .filter-group .input { min-width: 0; width: 100%; }
    .filter-date-group .date-range-inputs input {
        flex: 1;
        min-width: 0;
        width: auto;
    }

    /* 弹窗全屏 */
    .modal {
        width: 95vw;
        max-width: 95vw;
        max-height: 90vh;
        margin: 10px;
    }
    .modal-body { padding: 16px; }

    /* 内边距减小 */
    .content-body { padding: 12px; }
    .topbar { padding: 0 12px; height: 52px; }
    .page-title { font-size: 16px; }

    /* 表格可横向滚动 */
    .table-responsive { overflow-x: auto; -webkit-overflow-scrolling: touch; }
    .data-table { min-width: 600px; }
    .data-table th, .data-table td { padding: 8px 10px; font-size: 13px; }

    /* 登录卡片 */
    .login-card { padding: 28px 20px; width: 100%; }
    .login-form input[type="text"],
    .login-form input[type="password"] { font-size: 16px; padding: 14px 16px; }

    /* 按钮加大触摸区 */
    .btn { padding: 10px 16px; font-size: 14px; }
    .btn-xs { padding: 6px 10px; font-size: 12px; }

    /* 卡片内边距减小 */
    .card-body { padding: 14px; }
    .card-header { padding: 12px 14px; }
    .stat-card { padding: 14px; }

    /* 汇总表格字体 */
    .summary-table { font-size: 11px; }

    /* 数据维护标签卡滚动 */
    .option-tabs { overflow-x: auto; flex-wrap: nowrap; -webkit-overflow-scrolling: touch; }
    .option-tab { white-space: nowrap; flex-shrink: 0; }
}

@media (max-width: 480px) {
    .expense-summary-inline { flex-direction: column; }
    .login-header h1 { font-size: 18px; }
    .topbar-right .date-display { display: none; }
    .page-title { font-size: 15px; }
    .data-table { min-width: 500px; }
}

/* ─── 支出明细汇总（紧凑横排） ─── */
.expense-summary-inline {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 14px;
}
.expense-summary-inline .esi-item {
    background: var(--white);
    border-radius: 8px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
    border: 1px solid #e8e8e8;
    border-left: 3px solid var(--blue);
    padding: 8px 14px;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    min-width: 0;
    flex: 1 1 auto;
}
.expense-summary-inline .esi-income { border-left-color: var(--green); }
.expense-summary-inline .esi-income .esi-value { color: var(--green); font-weight: 700; font-size: 16px; }
.expense-summary-inline .esi-expense { border-left-color: var(--orange); }
.expense-summary-inline .esi-expense .esi-value { color: var(--orange); font-weight: 700; font-size: 16px; }
.expense-summary-inline .esi-balance { border-left-color: var(--blue); }
.expense-summary-inline .esi-balance .esi-value { color: var(--blue); font-weight: 700; font-size: 16px; }
.expense-summary-inline .esi-label { color: var(--text-muted); white-space: nowrap; }
.expense-summary-inline .esi-persons {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 2px 8px;
    font-size: 11px;
    line-height: 1.4;
}
.expense-summary-inline .esi-persons .person-balance-item {
    display: inline-flex;
    align-items: baseline;
    gap: 2px;
    white-space: nowrap;
}
.expense-summary-inline .esi-persons .person-balance-item .person-name {
    font-weight: 600;
    color: var(--text);
}
.expense-summary-inline .esi-persons .person-balance-item .person-amt {
    font-weight: 700;
}
.expense-summary-inline .esi-persons .person-balance-item .person-amt.positive { color: var(--green); }
.expense-summary-inline .esi-persons .person-balance-item .person-amt.negative { color: var(--red); }

/* ─── 支付汇总表 Excel 风格 ─── */
.es-excel-card {
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    border: 1px solid #e8e8e8;
    overflow: hidden;
    padding: 20px 24px;
    background: #fff;
}

.es-excel-table {
    width: 100%;
    max-width: 680px;
    margin: 0;
    border-collapse: collapse;
    font-size: 14px;
    table-layout: fixed;
}

.es-excel-table th,
.es-excel-table td {
    border: 1px solid #d9d9d9;
    padding: 6px 10px;
    vertical-align: middle;
}

.es-excel-table .es-title {
    font-size: 18px;
    font-weight: 700;
    text-align: center;
    background: #fafafa;
    padding: 12px;
    border: 1px solid #d9d9d9;
    border-bottom: 2px solid #1890ff;
    color: #333;
}

.es-excel-table .es-summary-row th,
.es-excel-table .es-summary-row td {
    background: #fafafa;
    font-weight: 600;
}

.es-excel-table .es-label {
    text-align: left;
    background: #f0f5ff;
    width: 90px;
    white-space: nowrap;
    color: #333;
    font-weight: 600;
}

.es-excel-table .es-amount {
    text-align: right;
    font-weight: 700;
    white-space: nowrap;
    width: 120px;
}

.es-excel-table td.es-balance {
    background: #fff1f0 !important;
    color: #cf1322 !important;
    text-align: right;
    font-weight: 700;
    padding: 6px 10px;
}

.es-excel-table td.es-expense {
    background: #fffbe6 !important;
    color: #333 !important;
    text-align: right;
    font-weight: 700;
    padding: 6px 10px;
}

.es-excel-table td.es-remaining {
    background: #e6f7ff !important;
    color: #096dd9 !important;
    text-align: right;
    font-weight: 700;
    padding: 6px 10px;
}

.es-excel-table .es-remaining-cell {
    color: #fa541c;
    font-weight: 600;
}

.es-excel-table .es-person-label {
    background: #f0f5ff;
}

.es-excel-table .es-person-values {
    background: #fff;
}

.es-excel-table .es-person-item {
    display: inline-flex;
    align-items: baseline;
    gap: 3px;
    margin-right: 14px;
    white-space: nowrap;
}

.es-excel-table .es-person-name {
    font-weight: 600;
    color: #595959;
    font-size: 13px;
}

.es-excel-table .es-person-amt {
    font-weight: 700;
}

.es-excel-table .es-person-amt.positive { color: #cf1322; }
.es-excel-table .es-person-amt.negative { color: #389e0d; }

.es-excel-table .es-header-row th {
    background: #1890ff;
    color: #fff;
    font-weight: 700;
    text-align: center;
    border: 1px solid #1890ff;
}

.es-excel-table tbody tr:nth-child(even) {
    background: #fafafa;
}

.es-excel-table tbody tr:hover {
    background: #e6f7ff;
}

.es-excel-table .es-center { text-align: center; }
.es-excel-table .es-right { text-align: right; }

/* 支付汇总表未支付完的行底色标注 */
.es-excel-table tbody tr.es-row-unpaid {
    background: #fff7e6 !important;
    border-left: 4px solid #fa8c16 !important;
}
.es-excel-table tbody tr.es-row-unpaid:hover { background: #ffe7ba !important; }

.es-excel-table .es-total-row td {
    background: #fafafa;
    font-weight: 700;
    text-align: center;
}

.es-excel-table .es-total-row .es-amount {
    text-align: right;
    background: #fffbe6;
    color: #333;
}

.es-filter-bar .filter-group {
    margin-bottom: 0;
}

.es-filter-bar .filter-group .input {
    min-width: 120px;
}

@media (max-width: 768px) {
    .es-excel-table {
        font-size: 12px;
    }
    .es-excel-table th,
    .es-excel-table td {
        padding: 4px 5px;
    }
    .es-excel-table .es-title {
        font-size: 16px;
        padding: 8px;
    }
    .es-excel-table .es-label {
        width: auto;
    }
    .es-excel-table .es-person-item {
        margin-right: 10px;
        font-size: 12px;
    }
    .es-filter-bar {
        flex-wrap: wrap;
    }
    .es-filter-bar .filter-group {
        flex: 1 1 45%;
        min-width: 120px;
    }
}

/* ===== 自定义下拉输入框 (combo) ===== */
.combo-wrapper {
    position: relative;
}
.combo-wrapper .combo-input {
    padding-right: 30px;
    width: 100%;
}
.combo-toggle {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    font-size: 10px;
    color: #999;
    padding: 4px;
    line-height: 1;
}
.combo-toggle:hover {
    color: #666;
}
.combo-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    max-height: 220px;
    overflow-y: auto;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    z-index: 9999;
    margin-top: 2px;
}
.combo-dropdown.open {
    display: block;
}
.combo-option {
    padding: 8px 12px;
    cursor: pointer;
    font-size: 14px;
    border-bottom: 1px solid #f0f0f0;
    transition: background 0.15s;
}
.combo-option:last-child {
    border-bottom: none;
}
.combo-option:hover,
.combo-option.active {
    background: #e6f7ff;
    color: #1890ff;
}
.combo-empty {
    padding: 10px 12px;
    color: #999;
    font-size: 13px;
    text-align: center;
}

