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

html {
    font-size: calc(14px + 0.5vw);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    min-height: 100vh;
    padding: 3vw;
}

.container {
    max-width: 800px;
    width: 100%;
    margin: 0 auto;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 4vw;
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.4);
    padding: 5vw;
    backdrop-filter: blur(10px);
}

h1 {
    text-align: center;
    color: #1a1a2e;
    margin-bottom: 5vw;
    font-size: clamp(18px, 5vw, 28px);
    font-weight: 700;
    letter-spacing: 1px;
    line-height: 1.3;
}

h2 {
    color: #1a1a2e;
    margin: 5vw 0 3vw;
    padding-bottom: 2vw;
    border-bottom: 3px solid #e94560;
    font-size: clamp(14px, 4vw, 20px);
    font-weight: 600;
}

h3 {
    color: #333;
    margin-bottom: 2vw;
    font-size: clamp(12px, 3.5vw, 16px);
    font-weight: 600;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2vw;
    margin-bottom: 5vw;
}

.stat-card {
    background: linear-gradient(145deg, #ffffff 0%, #f8f9fa 100%);
    border-radius: 3vw;
    padding: 3vw 2vw;
    text-align: center;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
    border: 1px solid rgba(233, 69, 96, 0.1);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #e94560, #0f3460);
}

.stat-label {
    color: #666;
    font-size: clamp(10px, 2.5vw, 13px);
    margin-bottom: 1.5vw;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-value {
    font-size: clamp(14px, 4vw, 22px);
    font-weight: 700;
    color: #1a1a2e;
}

.stat-value.expense {
    color: #e94560;
}

.stat-value.income {
    color: #00b894;
}

.action-section {
    display: flex;
    flex-direction: column;
    gap: 3vw;
    margin-bottom: 4vw;
}

.fund-form {
    background: linear-gradient(145deg, #f8f9fa 0%, #ffffff 100%);
    padding: 4vw;
    border-radius: 3vw;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.fund-form form {
    display: flex;
    gap: 2vw;
    align-items: center;
    flex-wrap: wrap;
}

.fund-form input {
    flex: 1;
    min-width: 100px;
    padding: 3vw;
    border: 2px solid #e0e0e0;
    border-radius: 2.5vw;
    font-size: clamp(14px, 3.5vw, 16px);
    transition: all 0.3s ease;
    background: #fff;
}

.fund-form input:focus {
    border-color: #e94560;
    outline: none;
    box-shadow: 0 0 0 3px rgba(233, 69, 96, 0.1);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 3vw 5vw;
    border: none;
    border-radius: 2.5vw;
    font-size: clamp(13px, 3.5vw, 15px);
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    text-align: center;
    transition: all 0.3s ease;
    min-height: 44px;
    -webkit-tap-highlight-color: transparent;
    letter-spacing: 0.3px;
    white-space: nowrap;
}

.btn-primary {
    background: linear-gradient(135deg, #e94560 0%, #c73e54 100%);
    color: #fff;
    box-shadow: 0 4px 15px rgba(233, 69, 96, 0.3);
}

.btn-primary:active {
    transform: scale(0.97);
    box-shadow: 0 2px 8px rgba(233, 69, 96, 0.3);
}

.btn-success {
    background: linear-gradient(135deg, #00b894 0%, #00a381 100%);
    color: #fff;
    box-shadow: 0 4px 15px rgba(0, 184, 148, 0.3);
}

.btn-success:active {
    transform: scale(0.97);
    box-shadow: 0 2px 8px rgba(0, 184, 148, 0.3);
}

.btn-secondary {
    background: linear-gradient(135deg, #636e72 0%, #535c60 100%);
    color: #fff;
}

.btn-secondary:active {
    transform: scale(0.97);
}

.btn-block {
    width: 100%;
}

.btn-export {
    background: linear-gradient(135deg, #0f3460 0%, #16213e 100%);
    color: #fff;
    box-shadow: 0 4px 15px rgba(15, 52, 96, 0.3);
}

.btn-export:active {
    transform: scale(0.97);
}

.toolbar {
    display: flex;
    flex-direction: column;
    gap: 3vw;
    margin-bottom: 4vw;
    background: linear-gradient(145deg, #f8f9fa 0%, #ffffff 100%);
    padding: 4vw;
    border-radius: 3vw;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
}

.filter-form {
    display: flex;
    flex-direction: column;
    gap: 2.5vw;
    flex: 1;
}

.filter-row {
    display: flex;
    gap: 2vw;
    align-items: center;
    flex-wrap: wrap;
}

.filter-row label {
    font-size: clamp(11px, 3vw, 13px);
    color: #555;
    white-space: nowrap;
    font-weight: 500;
}

.filter-row input[type="text"] {
    flex: 1;
    min-width: 120px;
    padding: 3vw;
    border: 2px solid #e0e0e0;
    border-radius: 2.5vw;
    font-size: clamp(13px, 3.5vw, 15px);
    transition: all 0.3s ease;
}

.filter-row input[type="date"] {
    padding: 2.5vw;
    border: 2px solid #e0e0e0;
    border-radius: 2.5vw;
    font-size: clamp(12px, 3vw, 14px);
    min-width: 0;
    flex: 1;
    max-width: 140px;
    transition: all 0.3s ease;
}

.filter-row input:focus {
    border-color: #e94560;
    outline: none;
    box-shadow: 0 0 0 3px rgba(233, 69, 96, 0.1);
}

.date-sep {
    color: #888;
    font-size: clamp(11px, 2.5vw, 13px);
}

.record-count {
    font-size: clamp(10px, 2.5vw, 12px);
    color: #888;
    font-weight: 500;
    margin-left: 1.5vw;
    background: #f0f0f0;
    padding: 1vw 2vw;
    border-radius: 20px;
}

.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 2vw;
    margin-top: 5vw;
    padding: 3vw 0;
    flex-wrap: wrap;
}

.btn-page {
    background: #fff;
    color: #333;
    border: 2px solid #e0e0e0;
    padding: 2vw 3vw;
    min-height: 40px;
    font-size: clamp(12px, 3vw, 14px);
    border-radius: 2vw;
}

.btn-page:hover {
    background: #e94560;
    color: #fff;
    border-color: #e94560;
}

.page-info {
    font-size: clamp(12px, 3vw, 14px);
    color: #666;
    padding: 0 2vw;
    font-weight: 500;
}

.purchase-cards {
    display: flex;
    flex-direction: column;
    gap: 3vw;
}

.purchase-card {
    background: linear-gradient(145deg, #ffffff 0%, #fafafa 100%);
    border-radius: 3vw;
    padding: 4vw;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    border: 1px solid rgba(0, 0, 0, 0.05);
    position: relative;
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.purchase-card:active {
    transform: scale(0.99);
}

.purchase-card::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: linear-gradient(180deg, #e94560, #0f3460);
}

.purchase-card .card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 3vw;
    padding-bottom: 2.5vw;
    border-bottom: 1px solid #f0f0f0;
}

.purchase-card .item-name {
    font-weight: 700;
    font-size: clamp(14px, 4vw, 17px);
    color: #1a1a2e;
    flex: 1;
    padding-right: 2vw;
    word-break: break-all;
}

.purchase-card .card-date {
    font-size: clamp(10px, 2.5vw, 12px);
    color: #888;
    background: #f5f5f5;
    padding: 1vw 2vw;
    border-radius: 20px;
    white-space: nowrap;
}

.purchase-card .card-body {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 2.5vw;
}

.purchase-card .card-item {
    background: #f8f9fa;
    padding: 2.5vw;
    border-radius: 2.5vw;
}

.purchase-card .card-item .label {
    color: #888;
    font-size: clamp(9px, 2.2vw, 11px);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    margin-bottom: 1vw;
}

.purchase-card .card-item .value {
    color: #1a1a2e;
    font-weight: 600;
    font-size: clamp(12px, 3.5vw, 15px);
}

.purchase-card .card-item .value.expense {
    color: #e94560;
    font-weight: 700;
}

.purchase-card .card-item.full-width {
    grid-column: span 2;
    background: linear-gradient(135deg, #fff5f7 0%, #fff 100%);
    border: 1px solid rgba(233, 69, 96, 0.1);
}

.purchase-card .card-item.full-width .value {
    font-size: clamp(16px, 5vw, 22px);
}

.purchase-card .card-footer {
    margin-top: 3vw;
    padding-top: 2.5vw;
    border-top: 1px solid #f0f0f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 2vw;
}

.footer-info {
    display: flex;
    flex-direction: column;
    gap: 1vw;
    flex: 1;
    min-width: 0;
}

.purchase-card .remark {
    font-size: clamp(11px, 2.8vw, 13px);
    color: #666;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.add-by {
    font-size: clamp(10px, 2.5vw, 12px);
    color: #888;
}

.supplier-address {
    font-size: clamp(10px, 2.5vw, 12px);
    color: #666;
}

.badge {
    display: inline-block;
    padding: 1vw 2.5vw;
    border-radius: 20px;
    font-size: clamp(9px, 2.2vw, 11px);
    font-weight: 600;
    letter-spacing: 0.3px;
    white-space: nowrap;
}

.badge.locked {
    background: linear-gradient(135deg, #fee 0%, #fdd 100%);
    color: #e94560;
    border: 1px solid rgba(233, 69, 96, 0.2);
}

.alert {
    padding: 3vw 4vw;
    border-radius: 2.5vw;
    margin-bottom: 4vw;
    font-size: clamp(12px, 3vw, 14px);
    font-weight: 500;
}

.alert-error {
    background: linear-gradient(135deg, #fee 0%, #fdd 100%);
    color: #c0392b;
    border: 1px solid rgba(192, 57, 43, 0.2);
}

.alert-success {
    background: linear-gradient(135deg, #e8f8f5 0%, #d5f5e8 100%);
    color: #00a381;
    border: 1px solid rgba(0, 163, 129, 0.2);
}

.warning-box {
    background: linear-gradient(135deg, #fff9e6 0%, #fff3cd 100%);
    border: 1px solid rgba(255, 193, 7, 0.3);
    color: #856404;
    padding: 3vw 4vw;
    border-radius: 2.5vw;
    margin-bottom: 4vw;
    font-size: clamp(12px, 3vw, 14px);
}

.form-card {
    background: linear-gradient(145deg, #f8f9fa 0%, #ffffff 100%);
    padding: 5vw 4vw;
    border-radius: 3vw;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
}

.form-group {
    margin-bottom: 4vw;
}

.form-group label {
    display: block;
    margin-bottom: 2vw;
    font-weight: 600;
    color: #333;
    font-size: clamp(12px, 3.2vw, 14px);
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 3vw;
    border: 2px solid #e0e0e0;
    border-radius: 2.5vw;
    font-size: clamp(14px, 3.5vw, 16px);
    transition: all 0.3s ease;
    background: #fff;
}

.form-group input:focus,
.form-group textarea:focus {
    border-color: #e94560;
    outline: none;
    box-shadow: 0 0 0 3px rgba(233, 69, 96, 0.1);
}

.form-group .required {
    color: #e94560;
}

.form-actions {
    display: flex;
    flex-direction: column;
    gap: 2.5vw;
    margin-top: 5vw;
}

.select-wrapper {
    display: flex;
    flex-direction: column;
    gap: 2vw;
}

.select-wrapper select,
.select-wrapper input {
    width: 100%;
    padding: 3vw;
    border: 2px solid #e0e0e0;
    border-radius: 2.5vw;
    font-size: clamp(14px, 3.5vw, 16px);
    background: #fff;
    transition: all 0.3s ease;
}

.select-wrapper select:focus,
.select-wrapper input:focus {
    border-color: #e94560;
    outline: none;
    box-shadow: 0 0 0 3px rgba(233, 69, 96, 0.1);
}

.hidden {
    display: none !important;
}

.hint {
    display: block;
    margin-top: 1.5vw;
    color: #888;
    font-size: clamp(10px, 2.5vw, 12px);
}

.empty-state {
    text-align: center;
    padding: 10vw 5vw;
    color: #999;
}

.empty-state .icon {
    font-size: clamp(40px, 12vw, 56px);
    margin-bottom: 3vw;
    opacity: 0.5;
}

.empty-state p {
    font-size: clamp(13px, 3.5vw, 15px);
}

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 5vw;
    backdrop-filter: blur(4px);
}

.modal.show {
    display: flex;
}

.modal-content {
    background: #fff;
    border-radius: 5vw;
    max-width: 380px;
    width: 100%;
    overflow: hidden;
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.3);
    animation: modalIn 0.3s ease;
}

@keyframes modalIn {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.modal-header {
    background: linear-gradient(135deg, #fff9e6 0%, #fff3cd 100%);
    padding: 5vw;
    text-align: center;
    border-bottom: 1px solid rgba(255, 193, 7, 0.2);
}

.modal-icon {
    font-size: clamp(32px, 10vw, 40px);
    display: block;
    margin-bottom: 2vw;
}

.modal-header h3 {
    margin: 0;
    color: #856404;
    font-size: clamp(15px, 4vw, 18px);
}

.modal-body {
    padding: 5vw 4vw;
    text-align: center;
}

.modal-body p {
    color: #666;
    font-size: clamp(12px, 3vw, 14px);
    line-height: 1.6;
    margin-bottom: 3vw;
}

.modal-body p:last-child {
    margin-bottom: 0;
}

.modal-summary {
    background: #f8f9fa;
    padding: 3vw;
    border-radius: 2.5vw;
    font-size: clamp(13px, 3.5vw, 15px) !important;
}

.text-danger {
    color: #e94560 !important;
}

.modal-actions {
    display: flex;
    gap: 0;
    border-top: 1px solid #f0f0f0;
}

.modal-actions .btn {
    flex: 1;
    border-radius: 0;
    min-height: 50px;
    font-size: clamp(14px, 3.5vw, 16px);
}

.modal-actions .btn:first-child {
    border-bottom-left-radius: 5vw;
    border-right: 1px solid #f0f0f0;
}

.modal-actions .btn:last-child {
    border-bottom-right-radius: 5vw;
}

.logout-btn {
    float: right;
    font-size: clamp(11px, 2.8vw, 13px);
    font-weight: 500;
    color: #888;
    background: #f0f0f0;
    padding: 1.5vw 3vw;
    border-radius: 20px;
    text-decoration: none;
    transition: all 0.3s ease;
}

.logout-btn:hover {
    background: #e94560;
    color: #fff;
}

@media (min-width: 768px) {
    body {
        padding: 30px;
    }
    
    .container {
        padding: 40px 35px;
        border-radius: 24px;
    }
    
    .stats-grid {
        gap: 20px;
    }
    
    .stat-card {
        padding: 25px 20px;
        border-radius: 16px;
    }
    
    .action-section {
        flex-direction: row;
        justify-content: space-between;
        align-items: flex-end;
    }
    
    .fund-form {
        padding: 22px;
        border-radius: 16px;
    }
    
    .fund-form input {
        padding: 14px 18px;
        border-radius: 12px;
    }
    
    .toolbar {
        flex-direction: row;
        justify-content: space-between;
        align-items: flex-start;
        padding: 22px;
        border-radius: 16px;
    }
    
    .filter-form {
        max-width: 550px;
    }
    
    .filter-row input[type="date"] {
        max-width: 160px;
    }
    
    .purchase-card {
        padding: 22px;
        border-radius: 16px;
    }
    
    .purchase-card .card-body {
        gap: 15px;
    }
    
    .purchase-card .card-item {
        padding: 15px;
        border-radius: 12px;
    }
    
    .form-card {
        padding: 35px;
        border-radius: 16px;
    }
    
    .form-group input,
    .form-group textarea {
        padding: 14px 18px;
        border-radius: 12px;
    }
    
    .form-actions {
        flex-direction: row;
    }
    
    .modal-content {
        border-radius: 20px;
    }
    
    .modal-actions .btn:first-child {
        border-bottom-left-radius: 20px;
    }
    
    .modal-actions .btn:last-child {
        border-bottom-right-radius: 20px;
    }
}
