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

/* 导航返回按钮样式 */
.header-nav {
    margin-bottom: 20px;
}

.back-nav {
    display: inline-block;
    padding: 8px 16px;
    background-color: #e9ecef;
    color: #6c757d;
    text-decoration: none;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.3s ease;
}

.back-nav:hover {
    background-color: #dee2e6;
    color: #495057;
    transform: translateY(-1px);
}
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f8fafc;
    padding: 20px;
    color: #334155;
}
.container {
    max-width: 800px;
    margin: 0 auto;
    background-color: white;
    padding: 40px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    transition: all 0.3s ease;
}
h1 {
    text-align: center;
    color: #1e293b;
    margin-bottom: 40px;
    font-size: 28px;
    font-weight: 700;
}
h2 {
    color: #334155;
    margin-bottom: 20px;
    font-size: 20px;
    font-weight: 600;
}
h3 {
    color: #475569;
    margin: 25px 0 15px;
    font-size: 16px;
    font-weight: 600;
}
h4 {
    color: #64748b;
    margin: 15px 0 10px;
    font-size: 14px;
    font-weight: 600;
}
.user-section {
    margin-bottom: 30px;
}
.quick-users {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 25px;
}
.quick-user {
    padding: 10px 20px;
    background-color: #f1f5f9;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 500;
    color: #475569;
}
.quick-user:hover {
    background-color: #e2e8f0;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}
.user-inputs {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.user-input {
    display: flex;
    gap: 12px;
    align-items: center;
    transition: all 0.3s ease;
}
.delete-user {
    padding: 12px 16px;
    background-color: #ef4444;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 14px;
    line-height: 1;
}
.delete-user:hover {
    background-color: #dc2626;
    transform: translateY(-1px);
}
.user-input input[type="text"],
.user-input input[type="number"] {
    padding: 12px 16px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.2s ease;
}
.user-input input[type="text"] {
    flex: 1;
}
.user-input input[type="number"] {
    width: 120px;
}
.user-input input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}
.user-input input.error {
    border-color: #ef4444;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}
.add-user {
    padding: 10px 24px;
    background-color: #10b981;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 500;
    font-size: 14px;
    margin-top: 5px;
}
.add-user:hover {
    background-color: #059669;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}
.reset-users {
    padding: 10px 24px;
    background-color: #6b7280;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 500;
    font-size: 14px;
    margin-top: 5px;
    margin-left: 10px;
}
.reset-users:hover {
    background-color: #4b5563;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(107, 114, 128, 0.3);
}
.help-button {
    padding: 10px 24px;
    background-color: #f59e0b;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 500;
    font-size: 14px;
    margin-top: 5px;
    margin-left: 10px;
}
.help-button:hover {
    background-color: #d97706;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);
}
.history-button {
    padding: 10px 24px;
    background-color: #8b5cf6;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 500;
    font-size: 14px;
    margin-top: 5px;
    margin-left: 10px;
}
.history-button:hover {
    background-color: #7c3aed;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.3);
}
.group-button {
    padding: 10px 24px;
    background-color: #0ea5e9;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 500;
    font-size: 14px;
    margin-top: 5px;
    margin-left: 10px;
}
.group-button:hover {
    background-color: #0284c7;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(14, 165, 233, 0.3);
}
.clear-history {
    padding: 8px 16px;
    background-color: #ef4444;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 500;
    font-size: 14px;
}
.clear-history:hover {
    background-color: #dc2626;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}
.history-item {
    background-color: #f8fafc;
    padding: 16px;
    border-radius: 8px;
    margin-bottom: 12px;
    border-left: 4px solid #8b5cf6;
    transition: all 0.3s ease;
}
.history-item:hover {
    transform: translateX(4px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}
.history-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}
.history-item-time {
    font-size: 12px;
    color: #64748b;
}
.history-item-delete {
    padding: 4px 8px;
    background-color: #ef4444;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.2s ease;
}
.history-item-delete:hover {
    background-color: #dc2626;
}
.history-item-summary {
    margin-bottom: 10px;
}
.history-item-summary p {
    margin-bottom: 4px;
    font-size: 14px;
}
.history-item-transfers {
    margin-top: 10px;
}
.history-item-transfers h4 {
    font-size: 14px;
    margin-bottom: 6px;
    color: #475569;
}
.history-item-transfers ul {
    list-style: none;
    margin-left: 0;
}
.history-item-transfers li {
    font-size: 13px;
    margin-bottom: 3px;
    padding-left: 16px;
    position: relative;
}
.history-item-transfers li:before {
    content: "→";
    position: absolute;
    left: 0;
    color: #8b5cf6;
}
.no-history {
    text-align: center;
    color: #64748b;
    padding: 40px 20px;
}

/* 模态框样式 */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.4);
    animation: fadeIn 0.3s ease;
}
.modal-content {
    background-color: #fefefe;
    margin: 15% auto;
    padding: 30px;
    border: 1px solid #888;
    width: 80%;
    max-width: 600px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    animation: slideIn 0.3s ease;
}
.modal-content h2 {
    color: #1e293b;
    margin-bottom: 20px;
    font-size: 24px;
    font-weight: 700;
}
.modal-content h3 {
    color: #334155;
    margin: 20px 0 10px;
    font-size: 18px;
    font-weight: 600;
}
.modal-content p {
    margin-bottom: 10px;
    line-height: 1.5;
}
.modal-content ul {
    margin-left: 20px;
    margin-bottom: 15px;
}
.modal-content li {
    margin-bottom: 5px;
}
.modal-content ol {
    margin-left: 20px;
    margin-bottom: 15px;
}
.close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
}
.close:hover,
.close:focus {
    color: black;
    text-decoration: none;
    cursor: pointer;
}
.example {
    background-color: #f8fafc;
    padding: 15px;
    border-radius: 8px;
    margin: 15px 0;
    border-left: 4px solid #3b82f6;
}
.help-section {
    margin-bottom: 20px;
}
.calculate {
    padding: 14px 32px;
    background-color: #3b82f6;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    transition: all 0.2s ease;
    margin-top: 25px;
    width: 100%;
}
.calculate:hover {
    background-color: #2563eb;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}
.results {
    margin-top: 40px;
    padding-top: 30px;
    border-top: 2px solid #f1f5f9;
    animation: fadeIn 0.5s ease;
}
.result-item {
    padding: 14px 18px;
    background-color: #f8fafc;
    border-radius: 8px;
    margin-bottom: 12px;
    border-left: 4px solid #e2e8f0;
    transition: all 0.2s ease;
}
.result-item:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}
.result-item.positive {
    background-color: #f0fdf4;
    border-left-color: #10b981;
}
.result-item.negative {
    background-color: #fef2f2;
    border-left-color: #ef4444;
}
.summary {
    margin-top: 25px;
    padding: 20px;
    background-color: #fefce8;
    border-radius: 8px;
    border-left: 4px solid #fbbf24;
}
.summary p {
    margin-bottom: 8px;
    font-weight: 500;
    color: #78350f;
}
.calculation-details {
    margin-top: 20px;
    padding: 20px;
    background-color: #f8fafc;
    border-radius: 8px;
    border-left: 4px solid #e2e8f0;
}
.calculation-details h3 {
    margin-top: 0;
}
.calculation-details p {
    margin-bottom: 8px;
    font-size: 14px;
}
.calculation-details ol {
    margin-left: 20px;
    margin-bottom: 15px;
}
.calculation-details ol li {
    margin-bottom: 8px;
}
.calculation-details ul {
    margin-left: 20px;
    margin-bottom: 15px;
}
.calculation-details ul li {
    margin-bottom: 8px;
}
.groups-section {
    margin-top: 20px;
    padding: 20px;
    background-color: #f8fafc;
    border-radius: 8px;
    border-left: 4px solid #0ea5e9;
}
.group-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 10px;
}
.group-item {
    padding: 8px 16px;
    background-color: #e0f2fe;
    border: 1px solid #bae6fd;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 14px;
    color: #0369a1;
}
.group-item:hover {
    background-color: #bae6fd;
    transform: translateY(-1px);
}
@media (max-width: 640px) {
    .container {
        padding: 24px;
    }
    h1 {
        font-size: 24px;
        margin-bottom: 30px;
    }
    .user-input {
        flex-direction: column;
        align-items: stretch;
    }
    .user-input input[type="number"] {
        width: 100%;
    }
    .quick-users {
        justify-content: center;
    }
    .button-group {
        display: flex;
        flex-wrap: wrap;
        gap: 10px;
        margin-top: 10px;
    }
    .add-user, .reset-users, .help-button, .history-button, .group-button {
        margin: 0;
        flex: 1;
        min-width: 120px;
    }
}
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
@keyframes slideIn {
    from { transform: translateY(-20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}
@keyframes slideOut {
    from { transform: translateX(0); opacity: 1; }
    to { transform: translateX(-20px); opacity: 0; }
}