/* 가계부 앱 스타일 */

:root {
    --primary-color: #4f46e5;
    --secondary-color: #64748b;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --bg-color: #1e3a5f;
    --card-bg: #ffffff;
    --text-color: #1e293b;
    --text-light: #64748b;
    --border-color: #e2e8f0;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.25);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', sans-serif;
    background-color: var(--bg-color);
    background-image:
        repeating-linear-gradient(
            45deg,
            transparent,
            transparent 10px,
            rgba(255, 255, 255, 0.03) 10px,
            rgba(255, 255, 255, 0.03) 20px
        ),
        repeating-linear-gradient(
            -45deg,
            transparent,
            transparent 10px,
            rgba(255, 255, 255, 0.02) 10px,
            rgba(255, 255, 255, 0.02) 20px
        );
    color: var(--text-color);
    line-height: 1.6;
    overflow-x: hidden;
    max-width: 100vw;
}

/* 로그인 화면 */
.screen {
    min-height: 100vh;
}

.login-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 1.5rem;
}

.login-container h1 {
    font-size: 2rem;
    margin-bottom: 2rem;
    color: #ffffff;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.login-form {
    width: 100%;
    max-width: 320px;
}

.login-input {
    width: 100%;
    padding: 0.875rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    margin-bottom: 1rem;
}

/* 헤더 */
.header {
    background: linear-gradient(135deg, #2d4a6f 0%, #1e3a5f 100%);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding: 1rem 1rem;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.app-title {
    font-size: 1.5rem;
    color: #ffffff;
    cursor: pointer;
    user-select: none;
    transition: opacity 0.2s;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.app-title:hover {
    opacity: 0.8;
}

.app-title:active {
    opacity: 0.6;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.user-name {
    font-size: 0.875rem;
    color: rgba(255, 255, 255, 0.85);
}

.logout-btn {
    width: 32px;
    height: 32px;
    border: none;
    background-color: rgba(255, 255, 255, 0.2);
    color: #ffffff;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.logout-btn:hover {
    background-color: var(--danger-color);
    color: white;
    transform: scale(1.05);
}

/* 하단 네비게이션 컨테이너 */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    max-width: 100vw;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    background-color: var(--card-bg);
    border-top: 1px solid var(--border-color);
    box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.1);
    z-index: 102;
    padding: 1rem 0.75rem;
    padding-bottom: max(1rem, calc(1rem + env(safe-area-inset-bottom)));
    gap: 0.625rem;
    box-sizing: border-box;
}

.bottom-nav-main {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.bottom-motto {
    font-size: 0.75rem;
    color: var(--text-secondary);
    opacity: 0.7;
    text-align: center;
    margin-top: 0.25rem;
}

/* 월 선택 */
.month-selector {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.375rem;
    flex: 0 0 auto;
    border-right: 1px solid var(--border-color);
    padding-right: 0.5rem;
}

.current-month {
    font-size: 0.875rem;
    font-weight: 600;
    min-width: 85px;
    text-align: center;
}

.nav-btn {
    width: 28px;
    height: 28px;
    border: 1px solid var(--border-color);
    background-color: var(--card-bg);
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

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

/* 탭 네비게이션 */
.tab-nav {
    display: flex;
    flex: 1;
    gap: 0.5rem;
}

.tab-btn {
    flex: 1;
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    background-color: white;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.875rem;
    color: var(--text-light);
    transition: all 0.2s;
}

.tab-btn.active {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.25);
}

.tab-btn:hover {
    transform: translateY(-1px);
}

/* 지출 탭 고정 헤더 */
.expenses-fixed-header {
    position: sticky;
    top: 57px;
    left: 0;
    right: 0;
    background-color: var(--bg-color);
    z-index: 95;
    padding: 1rem;
    padding-top: 0.75rem;
    padding-bottom: 0.5rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

/* 예산 탭 고정 헤더 */
.budget-fixed-header {
    position: sticky;
    top: 57px;
    left: 0;
    right: 0;
    background-color: var(--bg-color);
    z-index: 95;
    padding: 1rem;
    padding-top: 0.75rem;
    padding-bottom: 0.5rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

/* 탭 콘텐츠 */
.tab-content {
    display: none;
    padding: 1rem;
    padding-bottom: max(140px, calc(120px + env(safe-area-inset-bottom)));
    text-align: left;
    overflow-x: hidden;
}

/* 지출 탭 패딩 조정 */
#expenses-tab {
    padding: 1rem;
    padding-top: 0;
    padding-bottom: max(140px, calc(120px + env(safe-area-inset-bottom)));
}

/* 예산 탭 패딩 조정 */
#budget-tab {
    padding: 1rem;
    padding-top: 0;
    padding-bottom: max(140px, calc(120px + env(safe-area-inset-bottom)));
}

.tab-content.active {
    display: block;
}

.tab-fixed-header {
    position: sticky;
    top: 0;
    background-color: var(--bg-color);
    z-index: 90;
    padding: 1rem;
    padding-bottom: 0.75rem;
}

.tab-scroll-content {
    padding: 0 1rem;
}


.tab-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
    width: 100%;
    flex-wrap: nowrap;
}

.tab-header h2 {
    font-size: 1.25rem;
    margin: 0;
    flex: 1 1 auto;
    min-width: 0;
    text-align: left;
    white-space: nowrap;
}

.tab-header .mode-toggle {
    margin-left: auto;
    flex-shrink: 0;
}

.tab-header .budget-mode-buttons,
.tab-header .edit-mode-buttons {
    display: flex;
    gap: 0.5rem;
    flex-shrink: 0;
    align-items: center;
}

.tab-header .btn {
    flex-shrink: 0;
}

/* 토글 스위치 */
.mode-toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    margin-left: auto;
    flex-shrink: 0;
    white-space: nowrap;
}

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

.mode-toggle input[type="checkbox"] {
    display: none;
}

.toggle-slider {
    position: relative;
    width: 48px;
    height: 24px;
    background-color: #cbd5e1;
    border-radius: 12px;
    transition: background-color 0.3s;
}

.toggle-slider::before {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background-color: white;
    top: 2px;
    left: 2px;
    transition: transform 0.3s;
}

.mode-toggle input[type="checkbox"]:checked + .toggle-slider {
    background-color: var(--primary-color);
}

.mode-toggle input[type="checkbox"]:checked + .toggle-slider::before {
    transform: translateX(24px);
}

/* 버튼 */
.btn {
    padding: 0.625rem 1.25rem;
    border: none;
    border-radius: 8px;
    font-size: 0.9375rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

/* 작은 버튼 */
.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.8125rem;
}

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

.btn-primary:hover {
    background-color: #1d4ed8;
}

.btn-secondary {
    background-color: var(--secondary-color);
    color: white;
}

.btn-secondary:hover {
    background-color: #475569;
}

.btn-danger {
    background-color: var(--danger-color);
    color: white;
}

.btn-danger:hover {
    background-color: #dc2626;
}

/* 요약 카드 */
.summary-card {
    background-color: var(--card-bg);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 0;
    box-shadow: var(--shadow);
}

.summary-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.summary-row:last-child {
    margin-bottom: 1rem;
}

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

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

.summary-value.spent {
    color: var(--danger-color);
}

.progress-bar {
    width: 100%;
    height: 8px;
    background-color: var(--border-color);
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background-color: var(--success-color);
    transition: width 0.3s ease;
}

.progress-fill.warning {
    background-color: var(--warning-color);
}

.progress-fill.danger {
    background-color: var(--danger-color);
}

/* 지출 헤더 (버튼 + 검색 + 정렬) */
.expense-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0;
    margin-top: 0.75rem;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

/* 지출 추가 버튼 (작은 + 버튼) */
.add-expense-btn {
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    width: 36px;
    height: 36px;
    font-size: 1.25rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.add-expense-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    background-color: #4338ca;
}

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

/* 정렬 드롭다운 */
.sort-select {
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background-color: white;
    color: var(--text-color);
    font-size: 0.875rem;
    cursor: pointer;
    transition: border-color 0.2s;
    flex: 1;
    min-width: 0;
}

.sort-select:focus {
    outline: none;
    border-color: var(--primary-color);
}

/* 검색 토글 버튼 */
.search-toggle-btn {
    padding: 0.5rem 1rem;
    border: 1px solid var(--primary-color);
    border-radius: 8px;
    background-color: var(--primary-color);
    color: white;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.search-toggle-icon {
    font-size: 0.625rem;
    transition: transform 0.2s;
    display: inline-block;
}

.search-toggle-btn.active .search-toggle-icon {
    transform: rotate(90deg);
}

.search-toggle-btn:hover {
    background-color: #4338ca;
    border-color: #4338ca;
}

.search-toggle-btn.active {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

/* 검색 필터 컨테이너 (토글) */
.expense-filter-container {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.75rem;
    animation: slideDown 0.2s ease-out;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.filter-select {
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background-color: white;
    color: var(--text-color);
    font-size: 0.875rem;
    cursor: pointer;
    transition: border-color 0.2s;
    flex: 0 0 auto;
    min-width: 140px;
}

.filter-select:focus {
    outline: none;
    border-color: var(--primary-color);
}

.filter-search-wrapper {
    position: relative;
    flex: 1;
    min-width: 0;
}

.filter-search-input {
    width: 100%;
    padding: 0.5rem 3.5rem 0.5rem 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background-color: white;
    color: var(--text-color);
    font-size: 0.875rem;
    transition: border-color 0.2s;
}

.filter-search-input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.filter-search-input::placeholder {
    color: var(--text-light);
}

.filter-recurrence-btn {
    position: absolute;
    right: 1.75rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #c0c0c0;
    cursor: pointer;
    padding: 0.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
}

.filter-recurrence-btn.active {
    color: #6366f1;
}

.filter-reset-btn {
    position: absolute;
    right: 0.25rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-light);
    font-size: 1rem;
    cursor: pointer;
    padding: 0.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.6;
    transition: opacity 0.2s;
}

.filter-reset-btn:hover {
    opacity: 1;
    color: var(--danger-color);
}
}

/* 지출 리스트 */
.expense-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    width: 100%;
    padding-top: 0.75rem;
}

.expense-item {
    background-color: var(--card-bg);
    border-radius: 8px;
    padding: 0.9rem 1rem;
    margin-bottom: 0.75rem;
    box-shadow: var(--shadow);
    position: relative;
    overflow: visible;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.expense-item:last-child {
    margin-bottom: 0;
}

.expense-item:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 20px rgba(15, 23, 42, 0.08);
}

/* 날짜 구분선 */
.date-separator {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 1.25rem 0 0.875rem 0;
    position: relative;
}

.date-separator::before,
.date-separator::after {
    content: '';
    flex: 1;
    height: 1px;
    background-color: var(--border-color);
}

.date-separator::before {
    margin-right: 0.75rem;
}

.date-separator::after {
    margin-left: 0.75rem;
}

.date-separator-text {
    color: var(--text-light);
    font-size: 0.875rem;
    font-weight: 500;
    white-space: nowrap;
    background-color: var(--bg-color);
    padding: 0 0.5rem;
}

.expense-item.period {
    border-left: 3px solid var(--warning-color);
}

.expense-item.deleted {
    opacity: 0.5;
    text-decoration: line-through;
}

.expense-reveal-info {
    position: absolute;
    right: -90px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.875rem;
    font-weight: 500;
    color: #ffffff;
    background: rgba(30, 58, 95, 0.9);
    padding: 6px 12px;
    border-radius: 12px;
    pointer-events: none;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.15s ease;
    z-index: 10;
}

.expense-one-line {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
}

.expense-line-left {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    min-width: 0;
    flex: 1 1 auto;
}

.expense-amount {
    font-size: 1rem;
    font-weight: 700;
    color: var(--primary-color);
    white-space: nowrap;
    flex-shrink: 0;
    margin-left: auto;
    text-align: right;
}

.expense-badge {
    display: inline-block;
    padding: 0.125rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    background-color: var(--border-color);
    color: var(--text-color);
    flex-shrink: 0;
}

.expense-badge.account {
    background-color: #e0e7ff;
    color: #3730a3;
    font-size: 0.8125rem;
    font-weight: 600;
}

.expense-description {
    font-size: 0.9rem;
    color: var(--text-color);
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.expense-badge.account.period {
    background-color: #fef3c7;
    color: #92400e;
}

.expense-description {
    font-size: 0.875rem;
    font-weight: 400;
    color: var(--text-light);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1 1 auto;
    min-width: 0;
}

.recurrence-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #6366f1;
    flex-shrink: 0;
    margin-left: 0.25rem;
    vertical-align: middle;
}

.expense-date {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-light);
    white-space: nowrap;
    flex-shrink: 0;
}

.expense-spender {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-color);
    white-space: nowrap;
    flex-shrink: 0;
}

/* 예산/계정과목 트리 */
.budget-tree,
.account-tree {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding-top: 0.75rem;
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
}

.tree-group {
    background-color: #f8fafc;
    border-radius: 6px;
    padding: 0.5rem;
    box-shadow: var(--shadow);
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    overflow-x: hidden;
}

/* 중첩된 하위 그룹 */
.tree-group .tree-group {
    background-color: #f1f5f9;
    margin-top: 0.25rem;
}

.tree-group-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    user-select: none;
}

/* 그룹 프로그레스 바 (닫혔을 때만 표시) */
.group-progress-bar {
    margin-bottom: 0;
    padding: 0 0.25rem;
    align-self: center;
    flex: 0 0 auto;
}

.tree-group-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-left: auto;
}

.tree-group-name {
    font-size: 0.9375rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}

.tree-toggle {
    font-size: 0.7rem;
    color: var(--text-light);
}

.tree-group-total {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-light);
}

.tree-items {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    padding-left: 0.75rem;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    overflow-x: hidden;
}

/* 최상위 레벨 트리 아이템 컨테이너 */
.root-tree-items {
    padding-left: 0;
}

.tree-item {
    display: flex;
    flex-direction: row;
    align-items: center;
    padding: 0.5rem;
    background-color: #ffffff;
    border-radius: 4px;
    transition: background-color 0.2s;
    gap: 0.5rem;
    border: 1px solid #e2e8f0;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    overflow: hidden;
}

.budget-tree.edit-mode .tree-item,
.budget-tree.edit-mode .tree-group {
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
}

.budget-tree.edit-mode .tree-item *,
.budget-tree.edit-mode .tree-group * {
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
}

.tree-item.clickable {
    cursor: pointer;
}

.tree-item.clickable:hover {
    background-color: #e2e8f0;
}

/* 예산 제외 항목 스타일 */
.tree-item.budget-excluded {
    opacity: 0.6;
}

.tree-item.budget-excluded .tree-item-name {
    color: var(--text-secondary);
}

.tree-item.budget-excluded .budget-progress-bar {
    opacity: 0.5;
}

.tree-item-header {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    gap: 0.5rem;
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
}

/* 지출 내역 보기 버튼 */
.view-expenses-btn {
    background: none;
    border: none;
    font-size: 1rem;
    cursor: pointer;
    padding: 0.25rem;
    opacity: 0.6;
    transition: opacity 0.2s, transform 0.2s;
    flex-shrink: 0;
    line-height: 1;
}

.view-expenses-btn:hover {
    opacity: 1;
    transform: scale(1.1);
}

.tree-item[draggable="true"] {
    cursor: move;
}

.tree-group[draggable="true"] {
    cursor: move;
}

.tree-item-name {
    font-size: 0.875rem;
    font-weight: 500;
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* 드래그 핸들 */
.drag-handle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 100%;
    cursor: grab;
    color: var(--text-light);
    font-size: 0.9rem;
    margin-right: 0.25rem;
    user-select: none;
    flex-shrink: 0;
}

.drag-handle:active {
    cursor: grabbing;
}

.drag-handle span {
    display: block;
    line-height: 1;
    letter-spacing: -2px;
}

.amount-display {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-light);
    white-space: nowrap;
    flex: 0 0 auto;
    text-align: left;
    min-width: fit-content;
    margin-left: 0.25rem;
    padding-right: 0.25rem;
}

/* 단위 텍스트 (만원, 원 등) */
.unit-text {
    font-size: 0.85em;
}

/* 예산 진행률 바 */
.budget-progress-bar {
    flex: 0 0 160px;
    width: 160px;
    min-width: 160px;
    max-width: 160px;
    flex-shrink: 0;
    height: 20px;
    border-radius: 10px;
    overflow: visible;
    background-color: #e2e8f0;
    position: relative;
    margin-left: auto;
}

/* 리스트 항목 전체를 한 줄로 유지 (모바일에서 줄바꿈 방지) */
.tree-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem;
    white-space: nowrap;
}

.progress-track {
    display: flex;
    height: 100%;
    border-radius: 10px;
    overflow: hidden;
}

.progress-spent {
    background-color: #3b82f6;
    transition: width 0.3s;
}

.progress-remaining {
    background-color: #9ca3af;
}

.progress-budget {
    background-color: #3b82f6;
}

.progress-over {
    background-color: #ef4444;
}

.progress-overlay-text {
    position: absolute;
    top: 50%;
    left: 0.5rem;
    transform: translateY(-50%);
    color: white;
    font-size: 0.75rem;
    font-weight: 600;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    pointer-events: none;
    z-index: 1;
}

@media (max-width: 420px) {
    .budget-progress-bar {
        flex: 0 0 130px;
        width: 130px;
        min-width: 130px;
        max-width: 130px;
        flex-shrink: 0;
    }
    .progress-overlay-text {
        font-size: 0.7rem;
        left: 0.4rem;
    }
    .tree-item {
        padding: 0.4rem;
    }
}

.tree-item-budget {
    color: var(--text-light);
}

.tree-item-spent {
    font-weight: 600;
    color: var(--danger-color);
}

.tree-item-actions {
    display: flex;
    gap: 0.25rem;
    flex: 0 0 auto;
}

.tree-item-btn {
    padding: 0.25rem 0.5rem;
    border: 1px solid var(--border-color);
    background-color: white;
    border-radius: 4px;
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.2s;
}

.tree-item-btn:hover {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.tree-item-btn-danger:hover {
    background-color: var(--danger-color);
    border-color: var(--danger-color);
}

/* 컨텍스트 메뉴 오버레이 */
.context-menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    display: flex;
    align-items: flex-end;
    justify-content: center;
}

.context-menu-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0);
    transition: background 0.2s ease;
}

.context-menu-overlay.show .context-menu-backdrop {
    background: rgba(0, 0, 0, 0.4);
}

.context-menu-panel {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 400px;
    padding: 0.5rem 0.75rem;
    padding-bottom: max(0.75rem, env(safe-area-inset-bottom));
    transform: translateY(100%);
    transition: transform 0.25s ease-out;
}

.context-menu-overlay.show .context-menu-panel {
    transform: translateY(0);
}

.context-menu-items {
    background: var(--card-bg, #fff);
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.context-menu-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    padding: 0.875rem 1rem;
    border: none;
    background: none;
    font-size: 0.9375rem;
    color: var(--text-color, #1f2937);
    cursor: pointer;
    text-align: left;
    border-bottom: 1px solid var(--border-color, #e5e7eb);
}

.context-menu-item:last-child {
    border-bottom: none;
}

.context-menu-item:active {
    background: var(--hover-bg, #f3f4f6);
}

.context-menu-item.disabled {
    opacity: 0.4;
    pointer-events: none;
}

.context-menu-item.danger .context-menu-label {
    color: var(--danger-color, #ef4444);
}

.context-menu-icon {
    font-size: 1.125rem;
    flex-shrink: 0;
    width: 1.5rem;
    text-align: center;
}

.context-menu-label {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.context-menu-cancel {
    display: block;
    width: 100%;
    padding: 0.875rem;
    border: none;
    background: var(--card-bg, #fff);
    border-radius: 12px;
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--primary-color, #4f46e5);
    cursor: pointer;
    text-align: center;
}

.context-menu-cancel:active {
    background: var(--hover-bg, #f3f4f6);
}

/* 모달 */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.modal.show {
    display: flex;
}

.modal-content {
    background-color: var(--card-bg);
    border-radius: 12px;
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
}

@media (max-width: 640px) {
    .modal-content {
        max-height: 95vh;
        border-radius: 8px;
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
    font-size: 1.25rem;
}

@media (max-width: 640px) {
    .modal-header {
        padding: 1rem;
    }
    
    .modal-header h3 {
        font-size: 1.125rem;
    }
}

.modal-close {
    width: 32px;
    height: 32px;
    border: none;
    background: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-light);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.2s;
}

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

.modal-body {
    padding: 1.5rem;
}

@media (max-width: 640px) {
    .modal-body {
        padding: 1rem;
    }
}

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

.modal-footer-left {
    display: flex;
    gap: 0.75rem;
}

.modal-footer-right {
    display: flex;
    gap: 0.75rem;
}

@media (max-width: 640px) {
    .modal-footer {
        padding: 1rem;
        gap: 0.5rem;
    }
}

.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-color);
}

.form-input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 0.9375rem;
}

/* number input 증가/감소 버튼 숨기기 */
.form-input[type="number"]::-webkit-inner-spin-button,
.form-input[type="number"]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.form-input[type="number"] {
    -moz-appearance: textfield;
}

@media (max-width: 640px) {
    .form-group {
        margin-bottom: 0.75rem;
        display: flex;
        align-items: center;
        gap: 0.75rem;
    }
    
    .form-group label {
        margin-bottom: 0;
        font-size: 0.8125rem;
        white-space: nowrap;
        flex-shrink: 0;
        min-width: 70px;
    }
    
    .form-input {
        padding: 0.5rem;
        font-size: 0.875rem;
        flex: 1;
    }
    
    /* 라디오 그룹은 세로 유지 */
    .form-group:has(.radio-group) {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .form-group:has(.radio-group) label {
        margin-bottom: 0.375rem;
    }
}

/* 지출 유형 토글 */
.expense-type-group {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.expense-type-toggle {
    display: flex;
    align-items: center;
    cursor: pointer;
}

.expense-type-toggle input[type="checkbox"] {
    display: none;
}

.expense-toggle-slider {
    position: relative;
    width: 48px;
    height: 24px;
    background-color: #cbd5e1;
    border-radius: 12px;
    transition: background-color 0.3s;
}

.expense-toggle-slider::before {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background-color: white;
    top: 2px;
    left: 2px;
    transition: transform 0.3s;
}

.expense-type-toggle input[type="checkbox"]:checked + .expense-toggle-slider {
    background-color: var(--primary-color);
}

.expense-type-toggle input[type="checkbox"]:checked + .expense-toggle-slider::before {
    transform: translateX(24px);
}

/* 도움말 뱃지 */
.help-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background-color: var(--primary-color);
    color: white;
    font-size: 0.75rem;
    font-weight: 600;
    margin-left: 0.25rem;
    cursor: pointer;
    transition: background-color 0.2s;
}

.help-badge:hover {
    background-color: #1d4ed8;
}

@media (max-width: 640px) {
    /* 지출 유형 토글은 가로 배치 유지 */
    .form-group.expense-type-group {
        flex-direction: row;
        align-items: center;
    }
    
    .expense-type-group label {
        margin-bottom: 0;
        display: flex;
        align-items: center;
    }
}

.form-input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.radio-group {
    display: flex;
    gap: 1rem;
}

.radio-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-size: 0.9375rem;
}

.radio-label input[type="radio"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

/* 입력박스와 단위 텍스트 */
.input-with-unit {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex: 1;
}

.input-with-unit .half-width {
    flex: 0 0 auto;
    width: 120px;
    text-align: right;
}

.input-unit {
    color: var(--text-light);
    font-size: 0.9375rem;
}

.info-text {
    padding: 0.5rem 0.75rem;
    background-color: #f8fafc;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 0.95rem;
    color: var(--text-color);
}

/* 반응형 */
@media (max-width: 640px) {
    .tab-header {
        flex-direction: row;
        flex-wrap: nowrap;
        align-items: center;
        gap: 0.5rem;
    }

    .tab-header .mode-toggle {
        margin-left: auto;
    }

    .tab-header .budget-mode-buttons,
    .tab-header .edit-mode-buttons {
        flex-shrink: 0;
    }

    .header-actions {
        width: 100%;
    }

    .header-actions .btn {
        flex: 1;
    }

    .tab-header {
        gap: 0.5rem;
    }

    .tab-header h2 {
        font-size: 1.05rem;
    }

    .toggle-label {
        font-size: 0.75rem;
    }

    .toggle-slider {
        width: 42px;
        height: 20px;
    }

    .toggle-slider::before {
        width: 16px;
        height: 16px;
    }

    .mode-toggle input[type="checkbox"]:checked + .toggle-slider::before {
        transform: translateX(22px);
    }

    .expense-item {
        flex-direction: column;
        align-items: flex-start;
    }

    .expense-right {
        width: 100%;
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
    }

    .tree-item {
        flex-direction: row;
        align-items: center;
        gap: 0.25rem;
        padding: 0.4rem;
    }

    .tree-item-name {
        font-size: 0.8rem;
        flex: 0 1 auto;
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .amount-display {
        font-size: 0.7rem;
        flex-shrink: 0;
    }

    .budget-progress-bar {
        flex: 0 0 140px;
        width: 140px;
        min-width: 140px;
        max-width: 140px;
        height: 18px;
        flex-shrink: 0;
    }

    .progress-overlay-text {
        font-size: 0.65rem;
        left: 0.3rem;
    }

    .tree-item-actions {
        width: 100%;
        justify-content: flex-end;
    }

    .tree-group {
        padding: 0.4rem;
        border-radius: 4px;
    }

    .tree-group-header {
        flex-wrap: nowrap;
        margin-bottom: 0.4rem;
    }

    .tree-group-name {
        font-size: 0.85rem;
    }

    .tree-group-total {
        font-size: 0.8rem;
    }

    .tree-items {
        padding-left: 0.5rem;
        gap: 0.2rem;
    }

    .tree-toggle {
        font-size: 0.65rem;
    }
}

/* ============ SortableJS 스타일 ============ */
.sortable-ghost {
    opacity: 0.4;
    background-color: #e2e8f0;
}

.sortable-chosen {
    opacity: 0.8;
}

.sortable-drag {
    opacity: 0;
}

/* 계산기 버튼 */
.btn-calculator {
    background: none;
    border: none;
    font-size: 1.25rem;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    margin-left: 0.5rem;
    transition: transform 0.1s;
}

.btn-calculator:hover {
    transform: scale(1.1);
}

.btn-calculator:active {
    transform: scale(0.95);
}

/* 계산기 모달 */
.calculator-modal {
    max-width: 360px;
}

.calculator {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.calc-display {
    width: 100%;
    padding: 1rem;
    font-size: 1.5rem;
    text-align: right;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    background-color: #f8fafc;
    font-weight: 600;
}

.calc-btn {
    padding: 1rem;
    font-size: 1.25rem;
    font-weight: 600;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background-color: white;
    cursor: pointer;
    transition: all 0.15s;
}

.calc-btn:hover {
    background-color: var(--bg-color);
    transform: translateY(-1px);
}

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

.calc-number {
    background-color: white;
}

.calc-operator {
    background-color: #e0e7ff;
    color: var(--primary-color);
}

.calc-clear {
    background-color: #fee2e2;
    color: var(--danger-color);
}

.calc-equals {
    grid-column: span 3;
    background-color: var(--primary-color);
    color: white;
}

.calc-equals:hover {
    background-color: #4338ca;
}

/* 모바일 반응형 */
@media screen and (max-width: 768px) {
    body {
        font-size: 14px;
    }

    .header {
        padding: 0.75rem 1rem;
    }

    .app-title {
        font-size: 1.25rem;
    }

    .expenses-fixed-header,
    .budget-fixed-header {
        padding-left: 1rem;
        padding-right: 1rem;
        padding-top: 0.75rem;
        padding-bottom: 0.5rem;
    }

    #expenses-tab,
    #budget-tab {
        padding-left: 1rem;
        padding-right: 1rem;
        padding-top: 0;
        padding-bottom: max(140px, calc(120px + env(safe-area-inset-bottom)));
    }

    .summary-card {
        padding: 1rem;
    }

    .budget-summary-card {
        padding: 1rem;
    }

    .expense-header {
        gap: 0.375rem;
    }
    
    .sort-select,
    .filter-select {
        min-width: 100px;
        font-size: 0.8125rem;
    }
    
    .search-toggle-btn {
        padding: 0.5rem 0.75rem;
        font-size: 0.8125rem;
    }
    
    .expense-item {
        padding: 0.75rem 0.875rem;
    }

    .expense-one-line {
        gap: 0.5rem;
    }
    
    .modal-content {
        width: 95%;
        max-width: 95%;
        margin: 1rem;
    }
}

@media screen and (max-width: 480px) {
    .receipt-item-card {
        padding: 0.6rem;
    }

    .form-group-compact .form-input {
        font-size: 0.8rem;
    }

    .filter-select {
        min-width: 110px;
        max-width: 140px;
    }
    
    .expense-header {
        gap: 0.25rem;
    }
    
    .add-expense-btn {
        width: 32px;
        height: 32px;
        font-size: 1.125rem;
    }
}

/* ============ 영수증 OCR 스타일 ============ */

/* 영수증 업로드 버튼 (+ 버튼 옆) */
.add-receipt-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    font-size: 1.25rem;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.add-receipt-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
}

.add-receipt-btn:active {
    transform: scale(0.95);
}

/* 영수증 업로드 영역 */
.receipt-upload-area {
    padding: 1rem;
}

/* 영수증 미리보기 */
.receipt-preview-item {
    position: relative;
    width: 100px;
    height: 100px;
}

.receipt-preview-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 8px;
    border: 2px solid #e5e7eb;
}

.receipt-preview-remove {
    position: absolute;
    top: -8px;
    right: -8px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #ef4444;
    color: white;
    border: 2px solid white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
}

/* 진행률 바 */
.receipt-progress-bar {
    background: #f3f4f6;
    border-radius: 9999px;
    height: 8px;
    overflow: hidden;
}

.receipt-progress-fill {
    background: #4f46e5;
}

/* 영수증 항목 카드 (다건 모드) */
.receipt-item-card {
    background: #ffffff;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    padding: 0.75rem;
    transition: all 0.2s;
}

.receipt-item-card:hover {
    border-color: #4f46e5;
    box-shadow: 0 2px 8px rgba(79, 70, 229, 0.1);
}

.receipt-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #e5e7eb;
}

.receipt-item-checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-weight: 600;
    color: #1e293b;
}

.receipt-item-checkbox {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.receipt-item-title {
    font-size: 0.95rem;
}

.receipt-item-badge {
    display: inline-block;
    padding: 0.125rem 0.5rem;
    background: #fef3c7;
    color: #92400e;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    margin-left: 0.5rem;
}

.receipt-item-body {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.receipt-item-total {
    opacity: 0.6;
}

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

.form-group-compact label {
    font-size: 0.75rem;
    font-weight: 600;
    color: #64748b;
}

.form-group-compact .form-input {
    font-size: 0.875rem;
    padding: 0.4rem 0.6rem;
}

/* 총 예산 요약 카드 */
.budget-summary-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 12px;
    padding: 1rem;
    margin: 0;
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.3);
    color: white;
}

.budget-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.5rem;
    gap: 0.75rem;
}

.budget-header-controls {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    flex-shrink: 0;
}

.summary-title {
    font-size: 0.75rem;
    font-weight: 600;
    opacity: 0.9;
    margin-bottom: 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.summary-amounts {
    font-size: 1rem;
    font-weight: 700;
    text-align: center;
    margin-bottom: 0.5rem;
    white-space: nowrap;
}

.summary-progress {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.summary-progress-bar {
    flex: 1;
    height: 6px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 999px;
    overflow: hidden;
}

.summary-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #10b981 0%, #fbbf24 70%, #ef4444 100%);
    border-radius: 999px;
    transition: width 0.3s ease;
    width: 0%;
}

.summary-percentage {
    font-size: 0.75rem;
    font-weight: 600;
    min-width: 2.5rem;
    text-align: right;
}

/* 통계 탭 스타일 */
.stats-card {
    background-color: var(--card-bg);
    border-radius: 12px;
    padding: 1.25rem;
    margin-bottom: 1rem;
    box-shadow: var(--shadow);
}

.stats-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border-color);
}

.stats-card-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-color);
    margin: 0;
}

/* 기간 토글 버튼 */
.stats-period-toggle {
    display: flex;
    gap: 0.25rem;
    background-color: #f1f5f9;
    border-radius: 6px;
    padding: 0.25rem;
}

.period-toggle-btn {
    padding: 0.375rem 0.75rem;
    border: none;
    background-color: transparent;
    color: #64748b;
    font-size: 0.8125rem;
    font-weight: 600;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.period-toggle-btn:hover {
    background-color: rgba(79, 70, 229, 0.1);
    color: var(--primary-color);
}

.period-toggle-btn.active {
    background-color: var(--primary-color);
    color: white;
    box-shadow: 0 1px 3px rgba(79, 70, 229, 0.3);
}

.stats-card-content {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

/* TOP 10 차트 아이템 */
.top-expense-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.top-expense-rank {
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--primary-color);
    min-width: 1.5rem;
    text-align: center;
}

.top-expense-name {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-color);
    min-width: 80px;
    flex-shrink: 0;
}

.top-expense-bar-container {
    flex: 1;
    position: relative;
    height: 32px;
    background-color: #f1f5f9;
    border-radius: 6px;
    overflow: hidden;
}

.top-expense-bar {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), #667eea);
    border-radius: 6px;
    transition: width 0.5s ease;
}

.top-expense-amount {
    position: absolute;
    left: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.8125rem;
    font-weight: 700;
    color: white;
    text-shadow: 
        -1px -1px 0 rgba(0, 0, 0, 0.5),
        1px -1px 0 rgba(0, 0, 0, 0.5),
        -1px 1px 0 rgba(0, 0, 0, 0.5),
        1px 1px 0 rgba(0, 0, 0, 0.5),
        0 2px 4px rgba(0, 0, 0, 0.3);
    white-space: nowrap;
    z-index: 1;
}

/* 예산 초과 금액 차트 (중앙 기준 좌우 그래프) */
.budget-over-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.budget-over-bar-container {
    flex: 1;
    display: flex;
    align-items: center;
    height: 32px;
    gap: 0;
}

.budget-over-left-area {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.5rem;
}

.budget-over-center {
    width: 2px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #cbd5e1;
    flex-shrink: 0;
}

.budget-over-right-area {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 0.5rem;
}

.budget-over-bar-zero {
    width: 2px;
    height: 16px;
    background-color: #64748b;
    border-radius: 1px;
}

.budget-over-bar-right {
    height: 100%;
    background: linear-gradient(90deg, #ef4444, #dc2626);
    border-radius: 6px;
    display: flex;
    align-items: center;
    padding: 0 0.5rem;
    transition: width 0.5s ease;
    margin-left: 0;
}

.budget-over-bar-left {
    height: 100%;
    background: linear-gradient(90deg, #2563eb, #3b82f6);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding: 0 0.5rem;
    transition: width 0.5s ease;
}

.budget-over-amount-inner {
    font-size: 0.8125rem;
    font-weight: 700;
    color: white;
    text-shadow: 
        -1px -1px 0 rgba(0, 0, 0, 0.5),
        1px -1px 0 rgba(0, 0, 0, 0.5),
        -1px 1px 0 rgba(0, 0, 0, 0.5),
        1px 1px 0 rgba(0, 0, 0, 0.5),
        0 2px 4px rgba(0, 0, 0, 0.3);
    white-space: nowrap;
}

.budget-over-amount-right {
    font-size: 0.8125rem;
    font-weight: 700;
    color: #64748b;
    margin-left: 0.5rem;
    white-space: nowrap;
}

/* 지난달 미등록 지출 제안 */
.recurring-suggestions {
    margin-top: 1.25rem;
    padding-top: 1rem;
    border-top: 1px dashed var(--border-color);
}

.suggestions-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.suggestions-title {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-light);
}

.suggestions-count {
    font-size: 0.75rem;
    color: #ffffff;
    background-color: var(--primary-color);
    border-radius: 10px;
    padding: 0.0625rem 0.5rem;
    font-weight: 600;
}

.suggestions-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-height: 200px;
    overflow-y: auto;
}

.suggestion-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 0.75rem;
    background-color: #f8fafc;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.15s ease, border-color 0.15s ease;
}

.suggestion-item:hover {
    background-color: #e0e7ff;
    border-color: var(--primary-color);
}

.suggestion-item:active {
    background-color: #c7d2fe;
}

.suggestion-left {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    overflow: hidden;
    flex: 1;
    min-width: 0;
}

.suggestion-account {
    display: inline-block;
    padding: 0.0625rem 0.375rem;
    border-radius: 4px;
    font-size: 0.6875rem;
    font-weight: 600;
    background-color: #e0e7ff;
    color: #3730a3;
    flex-shrink: 0;
    white-space: nowrap;
}

.suggestion-desc {
    font-size: 0.8125rem;
    color: var(--text-color);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.suggestion-amount {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-color);
    flex-shrink: 0;
    margin-left: 0.5rem;
    white-space: nowrap;
}

@media (max-width: 640px) {
    .suggestions-list {
        max-height: 160px;
    }

    .suggestion-item {
        padding: 0.4rem 0.5rem;
    }

    .suggestion-desc {
        font-size: 0.75rem;
    }

    .suggestion-amount {
        font-size: 0.75rem;
    }
}
