
:root {
    --dark: #1D201B;
    --lime: #C4E65B;
    --sub-lime: #A8C65A;
    --card: #30352B;
    --background: #F2F3ED;
    --coral: #E58C83;
    --text: #252820;
    --muted: #92978A;
    --white: #FFFFFF;

    --husband: #5797CC;
    --husband-bg: #E2EFFA;

    --wife: #A68ACB;
    --wife-bg: #F0E9F8;

    --joint: #A8C65A;
    --joint-bg: #EDF3DF;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: "Pretendard", "Noto Sans KR", sans-serif;
    background: var(--background);
    color: var(--text);
    min-height: 100vh;
}

button,
input,
select {
    font-family: inherit;
}

button {
    cursor: pointer;
}

.container {
    width: 100%;
    max-width: 720px;
    margin: 0 auto;
    padding: 40px 24px;
}

/* 헤더 */

.header {
    margin-bottom: 35px;
}

.logo {
    font-size: 30px;
    font-weight: 900;
    letter-spacing: -1.5px;
    color: var(--dark);
}

.logo span {
    color: var(--sub-lime);
}

.header p {
    margin-top: 8px;
    font-size: 13px;
    color: var(--muted);
}

/* 입력 카드 */

.input-section {
    background: var(--dark);
    color: var(--white);
    padding: 30px;
    border-radius: 18px;
    margin-bottom: 25px;
    box-shadow: 0 8px 24px rgba(29, 32, 27, 0.08);
}

.input-section h2,
.list-section h2 {
    font-size: 20px;
    font-weight: 700;
}

.section-description {
    font-size: 13px;
    color: #A7AB9F;
    margin-top: 8px;
    margin-bottom: 28px;
}

/* 입력 항목 */

.form-group {
    margin-bottom: 22px;
}

.form-group > label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 10px;
    color: #E5E8DF;
}

input[type="date"],
select {
    display: block;
    width: 100%;
    height: 48px;
    padding: 0 14px;
    border: 1px solid #454B3F;
    border-radius: 9px;
    background: var(--card);
    color: var(--white);
    font-size: 14px;
    outline: none;
}

input[type="date"] {
    color-scheme: dark;
    cursor: pointer;
}

select {
    cursor: pointer;
}

select option {
    background: var(--card);
    color: var(--white);
}

input:focus,
select:focus {
    border-color: var(--lime);
}

/* 사용자 선택 */

.member-options {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.member-btn {
    height: 48px;
    background: var(--card);
    border: 1px solid #454B3F;
    border-radius: 9px;
    color: #C4C8BC;
    font-size: 14px;
    transition: 0.2s;
}

.member-btn.active {
    background: var(--lime);
    border-color: var(--lime);
    color: var(--dark);
    font-weight: 700;
}

/* 수입 / 지출 */

.type-options {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.type-btn {
    height: 48px;
    background: var(--card);
    border: 1px solid #454B3F;
    border-radius: 9px;
    color: #C4C8BC;
    font-size: 14px;
    transition: 0.2s;
}

.type-btn.income.active {
    background: var(--lime);
    border-color: var(--lime);
    color: var(--dark);
    font-weight: 700;
}

.type-btn.expense.active {
    background: var(--coral);
    border-color: var(--coral);
    color: var(--dark);
    font-weight: 700;
}

/* 금액 */

.amount-input {
    position: relative;
    width: 100%;
}

.amount-input input {
    display: block;
    width: 100%;
    height: 48px;
    padding: 0 45px 0 14px;
    background: var(--card);
    border: 1px solid #454B3F;
    border-radius: 9px;
    color: var(--white);
    font-size: 14px;
    outline: none;
}

.amount-input input:focus {
    border-color: var(--lime);
}

.amount-input input::placeholder {
    color: #92978A;
}

.amount-input span {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--lime);
    font-size: 14px;
    pointer-events: none;
}

/* 거래 추가 버튼 */

.add-button {
    width: 100%;
    height: 52px;
    margin-top: 8px;
    border: none;
    border-radius: 10px;
    background: var(--lime);
    color: var(--dark);
    font-size: 15px;
    font-weight: 800;
    transition: 0.2s;
}

.add-button:hover {
    background: var(--sub-lime);
}

.cancel-edit-button {
    width: 100%;
    height: 43px;
    margin-top: 10px;
    border: 1px solid #73796B;
    border-radius: 9px;
    background: transparent;
    color: #E5E8DF;
    font-size: 13px;
    font-weight: 600;
}

.cancel-edit-button[hidden] {
    display: none;
}

/* 거래 목록 */

.list-section {
    background: var(--white);
    padding: 25px;
    border-radius: 18px;
    min-height: 230px;
    box-shadow: 0 4px 16px rgba(29, 32, 27, 0.04);
}

.list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 18px;
}

.list-header span {
    font-size: 12px;
    color: var(--muted);
}

/* 사용자 필터 */

.filter-options {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    margin-bottom: 10px;
}

.filter-btn,
.type-filter-btn {
    min-width: 0;
    height: 38px;
    border: 1px solid #E6E9DF;
    border-radius: 8px;
    background: #F8F9F5;
    color: #777D70;
    font-size: 12px;
    font-weight: 600;
    transition: 0.2s;
}

.filter-btn.active,
.type-filter-btn.active {
    background: var(--dark);
    color: var(--lime);
    border-color: var(--dark);
}

/* 수입 / 지출 필터 */

.type-filter-options {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-bottom: 16px;
}

.type-filter-btn {
    height: 35px;
}

.type-filter-btn[data-type-filter="income"].active {
    background: #EAF2D8;
    border-color: #D7E6B3;
    color: #668B2D;
}

.type-filter-btn[data-type-filter="expense"].active {
    background: #FBEAE8;
    border-color: #F1D2CE;
    color: #D47D75;
}

/* 합계 영역 - 크기 축소 */

.summary-section {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    margin-bottom: 16px;
}

.summary-card {
    display: flex;
    flex-direction: column;
    gap: 7px;
    padding: 13px 14px;
    min-height: 76px;
    border-radius: 11px;
    background: #F8F9F5;
    border: 1px solid #E6E9DF;
}

.summary-card span,
.balance-card span {
    font-size: 11px;
    font-weight: 600;
}

.summary-card strong {
    font-size: clamp(16px, 3.5vw, 20px);
    font-weight: 800;
    white-space: nowrap;
    letter-spacing: -0.5px;
}

.income-summary span,
.income-summary strong {
    color: #7EAA32;
}

.expense-summary span,
.expense-summary strong {
    color: var(--coral);
}

/* 현재 잔액 */

.balance-card {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 15px 17px;
    min-height: 105px;
    background: var(--dark);
    border-radius: 11px;
    color: var(--white);
}

.balance-card span {
    color: var(--lime);
}

.balance-card strong {
    color: var(--lime);
    font-size: clamp(22px, 5vw, 27px);
    font-weight: 800;
    letter-spacing: -0.7px;
    overflow-wrap: anywhere;
}

.balance-card strong.negative {
    color: var(--coral);
}

.balance-card small {
    font-size: 10px;
    color: #A7AB9F;
}

/* 수입 / 지출 필터별 합계 레이아웃 */

.summary-section.single-summary {
    grid-template-columns: 1fr;
}

.summary-section.single-summary .summary-card {
    min-height: 76px;
}

.summary-section [hidden] {
    display: none !important;
}

/* 빈 목록 */

.empty-list {
    min-height: 145px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border: 1px dashed #D9DDD1;
    border-radius: 12px;
    color: var(--muted);
}

.empty-list[hidden] {
    display: none;
}

.empty-icon {
    width: 38px;
    height: 38px;
    display: flex;
    justify-content: center;
    align-items: center;
    background: var(--background);
    color: var(--sub-lime);
    border-radius: 50%;
    font-size: 20px;
    font-weight: 800;
    margin-bottom: 12px;
}

.empty-list p {
    font-size: 13px;
    font-weight: 600;
    color: #656B5D;
}

.empty-list span {
    font-size: 11px;
    margin-top: 6px;
}

/* 거래 박스 */

.transaction-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 14px 15px;
    margin-bottom: 10px;
    background: #F8F9F5;
    border: 1px solid #E6E9DF;
    border-left: 5px solid #D9DDD1;
    border-radius: 12px;
    animation: cardAppear 0.25s ease;
    transition: 0.2s;
}

.transaction-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(29, 32, 27, 0.06);
}

.transaction-card.member-husband {
    border-left-color: var(--husband);
}

.transaction-card.member-husband .transaction-member {
    background: var(--husband-bg);
    color: #3479B4;
}

.transaction-card.member-wife {
    border-left-color: var(--wife);
}

.transaction-card.member-wife .transaction-member {
    background: var(--wife-bg);
    color: #8059A9;
}

.transaction-card.member-joint {
    border-left-color: var(--joint);
}

.transaction-card.member-joint .transaction-member {
    background: var(--joint-bg);
    color: #668B2D;
}

/* 거래 정보 */

.transaction-left {
    display: flex;
    flex-direction: column;
    gap: 7px;
    min-width: 0;
    flex: 1;
}

.transaction-top {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.transaction-member {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px 9px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 800;
    white-space: nowrap;
}

.transaction-category {
    font-size: 14px;
    font-weight: 700;
    color: #252820;
}

.transaction-date {
    font-size: 11px;
    color: #92978A;
}

/* 거래 번호 */

.transaction-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 23px;
    height: 23px;
    padding: 0 5px;
    border-radius: 6px;
    background: #E9ECE3;
    color: #73796B;
    font-size: 11px;
    font-weight: 800;
}

/* 오른쪽 금액 및 버튼 */

.transaction-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 10px;
    flex-shrink: 0;
}

.transaction-amount {
    font-size: 16px;
    font-weight: 800;
    white-space: nowrap;
}

.transaction-amount.income {
    color: #7EAA32;
}

.transaction-amount.expense {
    color: var(--coral);
}

/* 수정 / 삭제 */

.transaction-actions {
    display: flex;
    gap: 6px;
}

.action-btn {
    padding: 5px 10px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    background: #FFFFFF;
    border: 1px solid #E0E4D8;
    color: #70776A;
    transition: 0.2s;
}

.edit-btn:hover {
    background: #EAF2D8;
    border-color: var(--sub-lime);
    color: #668B2D;
}

.delete-btn:hover {
    background: #FBEAE8;
    border-color: #E8B9B3;
    color: #D47D75;
}

.transaction-card.editing {
    outline: 2px solid var(--lime);
    background: #FBFDF5;
}

/* 애니메이션 */

@keyframes cardAppear {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 푸터 */

footer {
    text-align: center;
    margin-top: 30px;
    font-size: 11px;
    color: #A0A496;
    letter-spacing: 1px;
}

/* 모바일 */

@media (max-width: 480px) {

    .container {
        padding: 25px 15px;
    }

    .header {
        margin-bottom: 25px;
    }

    .logo {
        font-size: 26px;
    }

    .input-section {
        padding: 22px 18px;
    }

    .list-section {
        padding: 20px 16px;
    }

    .transaction-card {
        padding: 12px 9px;
        gap: 7px;
    }

    .transaction-amount {
        font-size: 13px;
    }

    .transaction-member {
        font-size: 11px;
        padding: 5px 7px;
    }

    .filter-options {
        gap: 5px;
    }

    .filter-btn {
        font-size: 11px;
    }

    .summary-section {
        gap: 7px;
    }

    .summary-card {
        padding: 12px 10px;
    }

    .balance-card {
        padding: 14px;
        min-height: 98px;
    }

    .transaction-actions {
        gap: 4px;
    }

    .action-btn {
        padding: 5px 8px;
        font-size: 10px;
    }

}
