:root {
    --primary-color: #409EFF;
    --primary-light: #66b1ff;
    --primary-dark: #337ecc;
    --primary-bg: #ecf5ff;
    --accent-color: #d4af37;
    --accent-light: #e5c65c;
    --accent-dark: #b89830;
    --bg-color: #f5f7fa;
    --card-bg: #ffffff;
    --text-primary: #1a1a2e;
    --text-secondary: #4a5568;
    --text-muted: #718096;
    --border-color: #e2e8f0;
    --success-color: #67c23a;
    --danger-color: #f56c6c;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif;
    background: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

#mainContent {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.login-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-light) 50%, var(--primary-bg) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn 0.5s ease;
}

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

.login-container {
    background: white;
    border-radius: var(--radius-lg);
    padding: 3rem 2.5rem;
    width: 100%;
    max-width: 420px;
    box-shadow: var(--shadow-xl);
    animation: slideUp 0.6s ease;
}

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

.login-header {
    text-align: center;
    margin-bottom: 2.5rem;
}

.login-logo {
    width: 80px;
    height: 80px;
    margin: 0 auto 1.5rem;
    background: var(--primary-bg);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 3px solid var(--primary-color);
}

.login-logo .logo-icon {
    width: 50px;
    height: 50px;
    color: var(--primary-color);
}

.login-header h2 {
    font-size: 1.5rem;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.login-header p {
    color: var(--text-muted);
    font-size: 0.9375rem;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-group label {
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.form-group input {
    padding: 0.875rem 1rem;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 1rem;
    transition: all 0.3s ease;
    background: var(--bg-color);
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary-color);
    background: white;
    box-shadow: 0 0 0 3px rgba(64, 158, 255, 0.1);
}

.login-error {
    color: var(--danger-color);
    font-size: 0.875rem;
    text-align: center;
    padding: 0.75rem;
    background: rgba(245, 108, 108, 0.1);
    border-radius: var(--radius-md);
    display: none;
    animation: shake 0.5s ease;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

.login-btn {
    padding: 1rem;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-light) 100%);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(64, 158, 255, 0.4);
}

.login-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(64, 158, 255, 0.5);
}

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

.page-header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-light) 100%);
    color: white;
    padding: 1.5rem 2rem;
    box-shadow: var(--shadow-lg);
    position: relative;
    overflow: hidden;
}

.page-header::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 300px;
    height: 100%;
    background: linear-gradient(135deg, transparent 0%, rgba(255, 255, 255, 0.1) 100%);
    pointer-events: none;
}

.header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    max-width: 1400px;
    margin: 0 auto;
}

.company-branding {
    display: flex;
    align-items: center;
    gap: 1.25rem;
}

.company-logo {
    width: 60px;
    height: 60px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.2);
}

.company-logo .logo-icon {
    width: 36px;
    height: 36px;
    color: white;
}

.company-title h1 {
    font-size: 1.375rem;
    font-weight: 700;
    margin-bottom: 0.125rem;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.subtitle {
    font-size: 0.75rem;
    opacity: 0.85;
    font-weight: 400;
}

.header-actions {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.5rem;
}

.report-meta {
    font-size: 0.75rem;
    opacity: 0.9;
}

.logout-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: var(--radius-md);
    color: white;
    font-size: 0.8125rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.logout-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.5);
}

.logout-btn svg {
    width: 14px;
    height: 14px;
}

.main-content {
    flex: 1;
    padding: 1.5rem;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
}

.card {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
    margin-bottom: 1.5rem;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.card-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1.25rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid var(--border-color);
    position: relative;
}

.card-header::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 50px;
    height: 2px;
    background: var(--primary-color);
}

.card-header .icon {
    width: 18px;
    height: 18px;
    color: var(--primary-color);
}

.card-header h2 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 1.25rem;
}

.info-item {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}

.info-label {
    font-size: 0.8125rem;
    color: var(--text-muted);
    font-weight: 500;
}

.info-value {
    font-size: 0.9375rem;
    color: var(--text-primary);
    font-weight: 600;
    padding: 0.625rem 0.875rem;
    background: var(--primary-bg);
    border-radius: var(--radius-sm);
    border-left: 3px solid var(--primary-color);
}

.account-number {
    font-family: "SF Mono", "Consolas", monospace;
    letter-spacing: 1px;
}

.summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.25rem;
}

.summary-item {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    padding: 1rem;
    border-radius: var(--radius-md);
    border: 2px solid;
    transition: all 0.3s ease;
}

.summary-item.income-card {
    background: linear-gradient(135deg, rgba(103, 194, 58, 0.08) 0%, rgba(103, 194, 58, 0.04) 100%);
    border-color: var(--success-color);
}

.summary-item.expense-card {
    background: linear-gradient(135deg, rgba(245, 108, 108, 0.08) 0%, rgba(245, 108, 108, 0.04) 100%);
    border-color: var(--danger-color);
}

.summary-item.net-card {
    background: linear-gradient(135deg, rgba(212, 175, 55, 0.08) 0%, rgba(212, 175, 55, 0.04) 100%);
    border-color: var(--accent-color);
}

.summary-icon {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.summary-item.income-card .summary-icon {
    background: linear-gradient(135deg, var(--success-color) 0%, #85ce61 100%);
    color: white;
}

.summary-item.expense-card .summary-icon {
    background: linear-gradient(135deg, var(--danger-color) 0%, #f78989 100%);
    color: white;
}

.summary-item.net-card .summary-icon {
    background: linear-gradient(135deg, var(--accent-color) 0%, var(--accent-light) 100%);
    color: white;
}

.summary-icon svg {
    width: 20px;
    height: 20px;
}

.summary-content {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
}

.summary-label {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.summary-value {
    font-size: 1.25rem;
    font-weight: 700;
}

.summary-item.income-card .summary-value {
    color: var(--success-color);
}

.summary-item.expense-card .summary-value {
    color: var(--danger-color);
}

.summary-item.net-card .summary-value {
    color: var(--accent-dark);
}

.summary-count {
    font-size: 0.7rem;
    color: var(--text-muted);
}

.table-container {
    overflow-x: auto;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

.transactions-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.transactions-table thead {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-light) 100%);
    color: white;
}

.transactions-table th {
    padding: 0.875rem;
    text-align: left;
    font-weight: 600;
    white-space: nowrap;
    border-bottom: 2px solid var(--primary-dark);
    font-size: 0.8125rem;
}

.transactions-table tbody tr {
    transition: background-color 0.2s ease;
}

.transactions-table tbody tr:nth-child(even) {
    background-color: var(--bg-color);
}

.transactions-table tbody tr:hover {
    background-color: rgba(64, 158, 255, 0.08);
}

.transactions-table td {
    padding: 0.75rem 0.875rem;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
}

.transactions-table tbody tr:last-child td {
    border-bottom: none;
}

.col-date {
    width: 120px;
}

.col-category {
    min-width: 160px;
}

.col-amount {
    width: 120px;
    font-weight: 600;
}

.col-amount.income {
    color: var(--success-color);
}

.col-amount.expense {
    color: var(--danger-color);
}

.col-reference {
    min-width: 180px;
    font-family: "SF Mono", "Consolas", monospace;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.col-status {
    width: 90px;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.5rem;
    background: rgba(103, 194, 58, 0.1);
    color: var(--success-color);
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 500;
}

.status-badge::before {
    content: '';
    width: 5px;
    height: 5px;
    background: var(--success-color);
    border-radius: 50%;
}

.status-badge.expense-badge {
    background: rgba(245, 108, 108, 0.1);
    color: var(--danger-color);
}

.status-badge.expense-badge::before {
    background: var(--danger-color);
}

.page-footer {
    background: var(--primary-color);
    color: white;
    padding: 1.5rem 2rem;
    text-align: center;
    margin-top: auto;
}

.footer-content {
    max-width: 800px;
    margin: 0 auto;
}

.disclaimer {
    font-size: 0.8125rem;
    opacity: 0.9;
    margin-bottom: 0.375rem;
}

.copyright {
    font-size: 0.75rem;
    opacity: 0.7;
}

@media (max-width: 768px) {
    .login-container {
        margin: 1rem;
        padding: 2rem 1.5rem;
    }

    .page-header {
        padding: 1rem;
    }

    .header-top {
        flex-direction: column;
        text-align: center;
        gap: 1rem;
    }

    .company-branding {
        flex-direction: column;
        gap: 0.75rem;
    }

    .company-title h1 {
        font-size: 1.125rem;
    }

    .header-actions {
        align-items: center;
        width: 100%;
    }

    .report-meta {
        text-align: center;
    }

    .logout-btn {
        width: 100%;
        justify-content: center;
    }

    .main-content {
        padding: 1rem 0.75rem;
    }

    .card {
        padding: 1rem;
    }

    .card-header h2 {
        font-size: 0.9375rem;
    }

    .info-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .summary-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .summary-value {
        font-size: 1.125rem;
    }

    .transactions-table {
        font-size: 0.75rem;
    }

    .transactions-table th,
    .transactions-table td {
        padding: 0.5rem 0.375rem;
    }

    .col-reference {
        display: none;
    }
}

@media (max-width: 480px) {
    .page-header {
        padding: 0.75rem;
    }

    .company-logo {
        width: 45px;
        height: 45px;
    }

    .company-logo .logo-icon {
        width: 28px;
        height: 28px;
    }

    .company-title h1 {
        font-size: 1rem;
    }

    .subtitle {
        font-size: 0.6875rem;
    }

    .main-content {
        padding: 0.75rem 0.5rem;
    }

    .card {
        padding: 0.875rem;
        margin-bottom: 1rem;
    }

    .info-value {
        padding: 0.5rem 0.625rem;
        font-size: 0.875rem;
    }

    .summary-item {
        padding: 0.875rem;
        gap: 0.75rem;
    }

    .summary-icon {
        width: 38px;
        height: 38px;
    }

    .summary-icon svg {
        width: 18px;
        height: 18px;
    }

    .page-footer {
        padding: 1rem;
    }

    .disclaimer {
        font-size: 0.75rem;
    }

    .copyright {
        font-size: 0.6875rem;
    }
}

@media print {
    body {
        background: white;
    }

    .login-overlay {
        display: none !important;
    }

    .page-header {
        box-shadow: none;
        border: 1px solid var(--border-color);
    }

    .card {
        box-shadow: none;
        border: 1px solid var(--border-color);
        page-break-inside: avoid;
    }

    .card:hover {
        transform: none;
    }

    .transactions-table {
        font-size: 0.75rem;
    }

    .col-reference {
        display: table-cell;
    }

    .logout-btn {
        display: none;
    }

    .page-footer {
        background: var(--bg-color);
        color: var(--text-primary);
        border: 1px solid var(--border-color);
    }

    .copyright {
        opacity: 1;
    }
}

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

.card {
    animation: fadeInUp 0.6s ease forwards;
}

.card:nth-child(1) {
    animation-delay: 0.1s;
}

.card:nth-child(2) {
    animation-delay: 0.2s;
}

.card:nth-child(3) {
    animation-delay: 0.3s;
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 1.25rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid var(--border-color);
    position: relative;
}

.card-header::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 50px;
    height: 2px;
    background: var(--primary-color);
}

.card-actions {
    display: flex;
    gap: 0.5rem;
}

.export-btn {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.5rem 0.875rem;
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-size: 0.8125rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.export-btn:hover {
    background: var(--primary-bg);
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.export-btn.primary {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-light) 100%);
    border-color: var(--primary-color);
    color: white;
}

.export-btn.primary:hover {
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary-color) 100%);
    box-shadow: 0 4px 12px rgba(64, 158, 255, 0.4);
}

.export-btn svg {
    width: 14px;
    height: 14px;
}

.col-select {
    width: 40px;
}

.col-select input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--primary-color);
}

.col-action {
    width: 80px;
}

.action-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    padding: 0.375rem 0.625rem;
    background: var(--primary-bg);
    border: 1px solid var(--primary-color);
    border-radius: var(--radius-sm);
    color: var(--primary-color);
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.action-btn:hover {
    background: var(--primary-color);
    color: white;
}

.action-btn svg {
    width: 12px;
    height: 12px;
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    animation: fadeIn 0.3s ease;
}

.modal-overlay.active {
    display: flex;
}

.modal-container {
    background: white;
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow: hidden;
    box-shadow: var(--shadow-xl);
    animation: slideUp 0.3s ease;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.5rem;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-light) 100%);
    color: white;
}

.modal-header h3 {
    font-size: 1.125rem;
    font-weight: 600;
}

.modal-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

.modal-close svg {
    width: 16px;
    height: 16px;
}

.modal-body {
    padding: 1.5rem;
    max-height: calc(90vh - 140px);
    overflow-y: auto;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border-color);
    background: var(--bg-color);
}

.modal-btn {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.625rem 1.25rem;
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.modal-btn:hover {
    background: var(--border-color);
}

.modal-btn.primary {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-light) 100%);
    border-color: var(--primary-color);
    color: white;
}

.modal-btn.primary:hover {
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary-color) 100%);
    box-shadow: 0 4px 12px rgba(64, 158, 255, 0.4);
}

.modal-btn svg {
    width: 16px;
    height: 16px;
}

.receipt-modal {
    max-width: 500px;
}

.receipt-content {
    font-family: 'SimSun', 'Songti SC', serif;
}

.receipt-header {
    text-align: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px dashed var(--border-color);
}

.receipt-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.receipt-subtitle {
    font-size: 0.875rem;
    color: var(--text-muted);
}

.receipt-info {
    margin-bottom: 1.5rem;
}

.receipt-row {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border-color);
}

.receipt-label {
    font-size: 0.875rem;
    color: var(--text-muted);
    font-weight: 500;
}

.receipt-value {
    font-size: 0.875rem;
    color: var(--text-primary);
    font-weight: 600;
}

.receipt-value.amount {
    font-size: 1.5rem;
    color: var(--primary-color);
    font-weight: 700;
}

.receipt-value.expense {
    color: var(--danger-color);
}

.receipt-value.income {
    color: var(--success-color);
}

.receipt-footer {
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 2px dashed var(--border-color);
    text-align: center;
}

.receipt-footer p {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
}

.receipt-signature {
    margin-top: 2rem;
    display: flex;
    justify-content: space-between;
}

.signature-item {
    text-align: center;
}

.signature-line {
    border-bottom: 1px solid var(--border-color);
    width: 120px;
    margin: 0 auto 0.5rem;
}

.signature-label {
    font-size: 0.75rem;
    color: var(--text-muted);
}

@media print {
    .modal-overlay {
        position: static;
        background: white;
        display: block;
        height: auto;
    }
    
    .modal-container {
        max-height: none;
        box-shadow: none;
        border: 1px solid var(--border-color);
    }
    
    .modal-header,
    .modal-footer {
        display: none;
    }
    
    .modal-body {
        max-height: none;
        padding: 1rem;
    }
}

@media (max-width: 768px) {
    .card-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    
    .card-actions {
        width: 100%;
        flex-wrap: wrap;
    }
    
    .export-btn {
        flex: 1;
        min-width: calc(50% - 0.25rem);
        justify-content: center;
    }
    
    .col-select,
    .col-action {
        display: none;
    }
    
    .modal-container {
        width: 95%;
        margin: 1rem;
    }
}
