/* 基础样式重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: "Microsoft YaHei", -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: #333;
    background: #f5f7fa;
    min-height: 100vh;
    padding-bottom: 70px;
}

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

/* 顶部标题栏 */
.app-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px 15px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    position: relative;
    z-index: 100;
}

.header-content {
    max-width: 768px;
    margin: 0 auto;
}

.app-header h1 {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 5px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.app-header .subtitle {
    font-size: 12px;
    opacity: 0.9;
}

/* 返回按钮 */
.back-btn {
    background: none;
    border: none;
    font-size: 18px;
    color: white;
    padding: 5px;
    cursor: pointer;
    margin-right: 10px;
}

/* 页面标题 */
.page-header {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* 底部导航栏 */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    display: flex;
    justify-content: space-around;
    padding: 12px 0;
    box-shadow: 0 -2px 20px rgba(0,0,0,0.1);
    z-index: 1000;
    border-top: 1px solid #f0f0f0;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: #666;
    padding: 8px;
    border-radius: 8px;
    transition: all 0.3s ease;
    flex: 1;
    max-width: 80px;
}

.nav-item i {
    font-size: 18px;
    margin-bottom: 4px;
}

.nav-item span {
    font-size: 11px;
    font-weight: 500;
}

.nav-item.active {
    color: #667eea;
    background: rgba(102, 126, 234, 0.1);
}

.nav-item:active {
    transform: scale(0.95);
}

/* 主要内容区域 */
.app-main {
    min-height: calc(100vh - 140px);
    position: relative;
    z-index: 50;
}

/* 顶部统计卡片 */
.stats-card {
    background: white;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.08);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
}

.stat-item {
    text-align: center;
    padding: 10px 5px;
}

.stat-icon {
    font-size: 24px;
    margin-bottom: 8px;
}

.stat-title {
    font-size: 12px;
    color: #666;
    margin-bottom: 5px;
    white-space: nowrap;
}

.stat-value {
    font-size: 18px;
    font-weight: 700;
    line-height: 1.2;
}

.stat-income {
    color: #4CAF50;
}

.stat-expense {
    color: #f44336;
}

/* 按钮样式 */
.btn {
    display: inline-block;
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.3s ease;
    margin: 5px;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    background: #f0f2f5;
    color: #666;
    border: 2px solid #e1e5e9;
}

.btn-secondary:hover {
    background: #e4e6e9;
}

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

/* 操作按钮 */
.action-btns {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 15px;
}

/* 列表样式 */
.records-list {
    background: white;
    border-radius: 12px;
    margin: 15px 0;
    overflow: hidden;
    box-shadow: 0 2px 12px rgba(0,0,0,0.08);
}

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

.list-header h3 {
    margin: 0;
    font-size: 16px;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* 员工列表样式 */
.employee-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 15px;
}

.employee-item {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 15px;
    border: 2px solid transparent;
    transition: all 0.3s;
}

.employee-item:hover {
    border-color: #667eea;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.2);
}

.employee-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.employee-name {
    font-weight: 600;
    font-size: 16px;
    color: #333;
}

.employee-total {
    font-weight: 700;
    font-size: 18px;
    color: #4CAF50;
}

.employee-stats {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 10px;
}

.stat-tag {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    background: white;
    padding: 6px 10px;
    border-radius: 6px;
    min-width: 80px;
}

.stat-label {
    color: #666;
}

.stat-tag-value {
    font-weight: 600;
}

.stat-tag-cash {
    border-left: 3px solid #4CAF50;
}

.stat-tag-card {
    border-left: 3px solid #2196F3;
}

.stat-tag-count {
    border-left: 3px solid #9C27B0;
}

.employee-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

/* 日期分组列表样式 */
.date-group-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 15px;
}

.date-group-item {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 15px;
    border: 2px solid transparent;
    transition: all 0.3s;
    cursor: pointer;
}

.date-group-item:hover {
    border-color: #f44336;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(244, 67, 54, 0.2);
}

.date-group-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.date-group-title {
    font-weight: 600;
    font-size: 16px;
    color: #333;
}

.date-group-amount {
    font-weight: 700;
    font-size: 18px;
    color: #f44336;
}

.date-group-stats {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.expense-tag {
    border-left: 3px solid #f44336;
}

/* 空状态 */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #999;
}

.empty-state i {
    font-size: 48px;
    margin-bottom: 15px;
    opacity: 0.3;
}

.empty-state h3 {
    margin: 0 0 10px 0;
    color: #666;
    font-size: 16px;
}

.empty-state p {
    margin: 0;
    font-size: 14px;
}

/* 加载状态 */
.loading {
    text-align: center;
    padding: 40px 20px;
    color: #666;
}

.loading i {
    margin-right: 10px;
}

/* 模态框样式 - 修改 */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 2000;
    align-items: center;
    justify-content: center;
    padding: 15px;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal.active {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: 12px;
    width: 100%;
    max-width: 500px;
    max-height: 85vh;
    overflow: hidden;
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        transform: translateY(50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

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

.modal-header h3 {
    margin: 0;
    font-size: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.modal-close {
    background: none;
    border: none;
    font-size: 18px;
    color: #666;
    cursor: pointer;
    padding: 5px;
}

/* 修改模态框内容区域样式 - 减少边距，增加高度 */
.modal-body {
    padding: 12px 15px;
    overflow-y: auto;
    max-height: calc(85vh - 60px); /* 增加模态框内容高度 */
}

/* 调整表单组间距 */
.form-group {
    margin-bottom: 12px;
}

/* 调整输入框和下拉框的内边距 */
.form-control {
    padding: 8px 10px;
}

/* 调整固定选项按钮的内边距 */
.fixed-option {
    padding: 6px 10px;
}

/* 调整操作按钮的边距 */
.action-btns {
    margin-top: 12px;
}

/* 金额输入框调整 */
.amount-input input {
    padding-left: 30px !important;
}

/* 表单样式 */
.form-group label {
    display: block;
    margin-bottom: 5px;
    color: #333;
    font-weight: 500;
    font-size: 14px;
}

.form-control {
    width: 100%;
    padding: 8px 10px;
    border: 2px solid #e1e5e9;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.3s;
    background: white;
    font-family: "Microsoft YaHei", sans-serif;
}

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

.form-control:disabled {
    background: #f8f9fa;
    color: #666;
    cursor: not-allowed;
}

.form-control.date-input {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' fill='%23666' viewBox='0 0 16 16'%3E%3Cpath d='M14 0H2a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V2a2 2 0 0 0-2-2zM1 3.857C1 3.384 1.448 3 2 3h12c.552 0 1 .384 1 .857v10.286c0 .473-.448.857-1 .857H2c-.552 0-1-.384-1-.857V3.857z'/%3E%3Cpath d='M6.5 7a1 1 0 1 0 0-2 1 1 0 0 0 0 2zm3 0a1 1 0 1 0 0-2 1 1 0 0 0 0 2zm3 0a1 1 0 1 0 0-2 1 1 0 0 0 0 2zm-9 3a1 1 0 1 0 0-2 1 1 0 0 0 0 2zm3 0a1 1 0 1 0 0-2 1 1 0 0 0 0 2zm3 0a1 1 0 1 0 0-2 1 1 0 0 0 0 2zm3 0a1 1 0 1 0 0-2 1 1 0 0 0 0 2zm-9 3a1 1 0 1 0 0-2 1 1 0 0 0 0 2zm3 0a1 1 0 1 0 0-2 1 1 0 0 0 0 2zm3 0a1 1 0 1 0 0-2 1 1 0 0 0 0 2z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 14px;
}

.select-wrapper {
    position: relative;
}

.select-wrapper select {
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%23666' viewBox='0 0 16 16'%3E%3Cpath d='M7.247 11.14L2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 12px;
}

/* 金额输入样式 */
.amount-input {
    position: relative;
}

.amount-input .prefix {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 15px;
    font-weight: 600;
    color: #333;
    z-index: 1;
}

.amount-input input {
    padding-left: 30px !important;
}

/* 固定选项样式 */
.fixed-options {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 5px;
}

.fixed-option {
    padding: 6px 10px;
    border: 2px solid #e1e5e9;
    border-radius: 16px;
    background: white;
    color: #666;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.3s;
    flex: 1;
    min-width: 0;
    text-align: center;
}

.fixed-option:hover {
    border-color: #667eea;
    color: #667eea;
}

.fixed-option.active {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

/* 管理页面样式 */
.management-tabs {
    display: flex;
    overflow-x: auto;
    background: white;
    border-radius: 12px;
    margin: 15px 0;
    padding: 10px;
    gap: 5px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.08);
}

.management-tab {
    flex: 0 0 auto;
    padding: 10px 16px;
    border: 2px solid transparent;
    border-radius: 8px;
    background: #f8f9fa;
    color: #666;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
    white-space: nowrap;
    text-decoration: none;
}

.management-tab.active {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

.management-tab:hover {
    background: #e8eaf6;
}

.management-tab-content {
    display: none;
}

.management-tab-content.active {
    display: block;
}

/* 记录项样式 */
.record-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 12px;
}

.record-item {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 12px;
    border: 2px solid transparent;
    transition: all 0.3s;
}

.record-item:hover {
    border-color: #e1e5e9;
}

.record-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.record-title {
    font-weight: 600;
    font-size: 15px;
    color: #333;
}

.record-amount {
    font-weight: 700;
    font-size: 17px;
}

.record-income {
    color: #4CAF50;
}

.record-expense {
    color: #f44336;
}

.record-meta {
    display: flex;
    gap: 12px;
    color: #666;
    font-size: 12px;
    margin-bottom: 6px;
    flex-wrap: wrap;
}

.record-notes {
    color: #888;
    font-size: 12px;
    font-style: italic;
    line-height: 1.4;
}

.record-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

.record-action-btn {
    padding: 5px 10px;
    border-radius: 5px;
    border: none;
    font-size: 11px;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 4px;
}

.edit-btn {
    background: #4CAF50;
    color: white;
}

.edit-btn:hover {
    background: #3d8b40;
}

.delete-btn {
    background: #f44336;
    color: white;
}

.delete-btn:hover {
    background: #d32f2f;
}

/* 月份选择器 */
.month-selector {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
}

.month-selector select {
    flex: 1;
    padding: 8px 10px;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    font-size: 14px;
    background: white;
}

.month-selector .btn {
    padding: 8px 12px;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 5px;
    white-space: nowrap;
}

/* 表单验证 */
.form-control.error {
    border-color: #f44336;
    background: #fff5f5;
}

.error-message {
    color: #f44336;
    font-size: 11px;
    margin-top: 4px;
    display: none;
}

.error-message.show {
    display: block;
}

/* 文本区域 */
textarea.form-control {
    min-height: 60px;
    resize: vertical;
    line-height: 1.4;
    padding: 8px 10px;
}

/* 记录详情行样式 */
.record-details-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
    flex-wrap: nowrap;
    overflow: hidden;
}

.record-date {
    font-size: 12px;
    color: #666;
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

.record-payment {
    font-size: 11px;
    flex-shrink: 0;
}

.record-notes {
    font-size: 12px;
    color: #888;
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 4px;
}

/* 备注过长时换行 */
.record-notes:not(:empty) {
    max-width: 200px;
}

/* 内联的支付方式标签 */
.stat-tag-cash-inline {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 10px;
    font-size: 10px;
    background: rgba(76, 175, 80, 0.1);
    color: #4CAF50;
    border: 1px solid rgba(76, 175, 80, 0.3);
    font-weight: 600;
}

.stat-tag-card-inline {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 10px;
    font-size: 10px;
    background: rgba(33, 150, 243, 0.1);
    color: #2196F3;
    border: 1px solid rgba(33, 150, 243, 0.3);
    font-weight: 600;
}

/* 调整员工详情模态框中的记录卡片边距 */
#employeeDetailModal .record-item {
    margin: 0;
    border-radius: 8px;
}

#employeeDetailModal .record-list {
    padding: 12px;
}

/* 调整员工列表的卡片边距 */
.employee-item {
    margin: 0;
    border-radius: 8px;
}

.employee-list {
    padding: 12px;
}

/* 确保模态框内容与边缘对齐 */
.modal-body {
    padding: 12px 15px;
}

.modal-body .loading,
.modal-body .empty-state {
    padding: 25px 15px;
}

/* 调整统计数字格式 - 修改为整数显示 */
.stat-value {
    font-family: "Microsoft YaHei", sans-serif;
    font-size: 18px;
    font-weight: 700;
}

.employee-total {
    font-family: "Microsoft YaHei", sans-serif;
    font-size: 17px;
    font-weight: 700;
}

.record-amount {
    font-family: "Microsoft YaHei", sans-serif;
    font-size: 17px;
    font-weight: 700;
}

.stat-tag-value {
    font-family: "Microsoft YaHei", sans-serif;
    font-weight: 600;
}

/* 金额输入框提示文字更新 */
.amount-input input::placeholder {
    font-family: "Microsoft YaHei", sans-serif;
}

/* 响应式调整 */
@media (max-width: 480px) {
    .container {
        padding: 10px;
    }
    
    .stats-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
    }
    
    .stat-value {
        font-size: 16px;
    }
    
    .employee-stats,
    .date-group-stats {
        flex-wrap: wrap;
    }
    
    .stat-tag {
        flex: 1;
        min-width: 70px;
    }
    
    .month-selector {
        flex-direction: column;
        gap: 8px;
    }
    
    .month-selector .btn {
        width: 100%;
        justify-content: center;
    }
    
    .modal {
        padding: 10px;
    }
    
    .modal-content {
        max-width: 100%;
        max-height: 80vh;
    }
    
    .modal-body {
        max-height: calc(80vh - 55px);
        padding: 10px;
    }
    
    .fixed-options {
        gap: 5px;
    }
    
    .fixed-option {
        padding: 5px 8px;
        font-size: 11px;
    }
    
    .record-details-row {
        flex-wrap: wrap;
        gap: 6px;
    }
    
    .record-notes {
        order: 3;
        width: 100%;
        white-space: normal;
        word-break: break-word;
        max-width: 100%;
    }
    
    /* 移动端调整模态框高度 */
    #addIncomeModal .modal-body,
    #editIncomeModal .modal-body {
        padding: 10px;
        max-height: calc(75vh - 55px);
    }
}

/* 成功提示 */
.success-message {
    text-align: center;
    padding: 20px;
    color: #4CAF50;
}

.success-message i {
    font-size: 40px;
    margin-bottom: 12px;
}

/* 图标样式 */
.icon-money { color: #4CAF50; }
.icon-cash { color: #4CAF50; }
.icon-card { color: #2196F3; }
.icon-receipt { color: #f44336; }
.icon-list { color: #9C27B0; }
.icon-calendar { color: #FF9800; }