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

body {
    background: #f5f5f5;
    color: #333;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 14px;
}

.app {
    max-width: 700px;
    margin: 0 auto;
    padding: 40px 20px;
}

h1 {
    font-size: 22px;
    font-weight: 600;
    margin-bottom: 20px;
}

.summary {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
}

.summary-card {
    flex: 1;
    background: #fff;
    border-radius: 8px;
    padding: 16px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.summary-label {
    display: block;
    font-size: 12px;
    color: #999;
    margin-bottom: 4px;
}

.summary-amount {
    font-size: 22px;
    font-weight: 700;
    color: #111;
}

.summary-amount.income {
    color: #27ae60;
}

.summary-amount.expense {
    color: #c0392b;
}

.chart-container {
    background: #fff;
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    gap: 8px;
}

.filters {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    flex: 1;
}

.filters select {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 13px;
    outline: none;
    background: #fff;
    color: #333;
    cursor: pointer;
}

.add-btn {
    padding: 8px 18px;
    background: #111;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
    white-space: nowrap;
}

.add-btn:hover {
    background: #333;
}

.transactions {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.transaction {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #fff;
    border-radius: 8px;
    padding: 12px 16px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

.t-left {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.t-desc {
    font-weight: 500;
    color: #111;
    font-size: 14px;
}

.t-meta {
    font-size: 12px;
    color: #999;
}

.t-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.t-amount {
    font-weight: 600;
    font-size: 15px;
}

.t-amount.income {
    color: #27ae60;
}

.t-amount.expense {
    color: #c0392b;
}

.t-delete {
    padding: 4px 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: #fff;
    color: #999;
    font-size: 12px;
    cursor: pointer;
}

.t-delete:hover {
    border-color: #c0392b;
    color: #c0392b;
}

.empty {
    display: none;
    text-align: center;
    padding: 40px 0;
    color: #aaa;
    font-size: 14px;
}

.empty.show {
    display: block;
}

/* Dialog */
.overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.3);
    z-index: 10;
    justify-content: center;
    align-items: center;
}

.overlay.open {
    display: flex;
}

.dialog {
    background: #fff;
    border-radius: 10px;
    padding: 28px;
    width: 380px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.12);
}

.dialog-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.dialog-top h2 {
    font-size: 17px;
    font-weight: 600;
}

.x-btn {
    background: none;
    border: none;
    font-size: 22px;
    color: #999;
    cursor: pointer;
}

.x-btn:hover {
    color: #333;
}

.type-toggle {
    display: flex;
    gap: 4px;
    margin-bottom: 16px;
}

.type-btn {
    flex: 1;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 6px;
    background: #fff;
    color: #666;
    font-size: 13px;
    cursor: pointer;
}

.type-btn.active {
    background: #111;
    color: #fff;
    border-color: #111;
}

.dialog label {
    display: block;
    font-size: 12px;
    font-weight: 500;
    color: #666;
    margin-bottom: 4px;
    margin-top: 12px;
}

.dialog input,
.dialog select {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    outline: none;
    background: #fff;
    color: #333;
}

.dialog input:focus,
.dialog select:focus {
    border-color: #999;
}

.save-btn {
    width: 100%;
    padding: 10px;
    background: #111;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    margin-top: 20px;
}

.save-btn:hover {
    background: #333;
}

.input-error {
    border-color: #c0392b !important;
}

@media (max-width: 600px) {
    .summary {
        flex-direction: column;
    }

    .controls {
        flex-direction: column;
        align-items: stretch;
    }

    .filters {
        flex-direction: column;
    }
}