/* ═══════════════════════════════════════════════════
   재무제표 (Financial Statement) - Content Skin
   심플 회색톤 / 음영 차이만
   ═══════════════════════════════════════════════════ */

.financial_wrap {
    width: 100%;
    padding: clamp(20px, calc(1.56vw + 15px), 40px) 0;
    font-family: 'Pretendard', 'Noto Sans KR', sans-serif;
    color: #444;
}

/* ── 상단 년도 선택 + 관리자 버튼 ── */
.fin_top_area {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: clamp(20px, calc(1.56vw + 15px), 40px);
    padding: clamp(12px, calc(0.94vw + 9px), 24px);
    background: #f7f7f7;
    border-radius: 8px;
    border: 1px solid #e8e8e8;
}

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

.fin_year_selector label {
    font-size: 17px;
    font-weight: 600;
    color: #555;
    white-space: nowrap;
}

.fin_year_selector select {
    padding: 8px 32px 8px 14px;
    font-size: 18px;
    font-weight: 600;
    border: 1px solid #ccc;
    border-radius: 6px;
    background: #fff;
    color: #333;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23999' stroke-width='1.5' fill='none'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    transition: border-color 0.2s;
}

.fin_year_selector select:focus {
    outline: none;
    border-color: #999;
}

.fin_period {
    font-size: 16px;
    color: #888;
}

/* 관리자 버튼 */
.fin_admin_btns {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.fin_btn {
    padding: 7px 16px;
    font-size: 14px;
    font-weight: 500;
    border: 1px solid #d0d0d0;
    border-radius: 6px;
    background: #fff;
    color: #555;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.fin_btn:hover {
    background: #f0f0f0;
    border-color: #aaa;
}

.fin_btn_save {
    background: #555;
    color: #fff;
    border-color: #555;
}

.fin_btn_save:hover {
    background: #444;
}

.fin_btn_del {
    color: #c44;
    border-color: #c44;
}

.fin_btn_del:hover {
    background: #c44;
    color: #fff;
}

/* ── 하단 큰 저장 버튼 ── */
.fin_bottom_save {
    margin-top: clamp(30px, calc(2.34vw + 22.5px), 60px);
    text-align: center;
}
.fin_btn_save_big {
    display: inline-block;
    width: 100%;
    max-width: 400px;
    padding: 16px 40px;
    font-size: 17px;
    font-weight: 700;
    color: #fff;
    background: #555;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s;
    letter-spacing: 1px;
}
.fin_btn_save_big:hover {
    background: #333;
}
.fin_btn_save_big::before {
    content: '※ 설정 후 반드시 저장';
    display: block;
    font-size: 12px;
    font-weight: 400;
    color: #f0a0a0;
    margin-bottom: 6px;
    letter-spacing: 0;
}

/* ── 원형 숫자 ── */
.fin_circ_num {
    font-size: 1.2em;
    vertical-align: -1px;
    margin-right: 2px;
}

.fin_btn_add_row {
    margin-top: 10px;
    font-size: 13px;
    padding: 5px 12px;
    color: #999;
    border-style: dashed;
}

/* 설정 패널 */
.fin_settings_panel {
    width: 100%;
    margin-top: 12px;
    padding: 16px 20px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
}

.fin_settings_panel h4 {
    margin: 0 0 12px;
    font-size: 15px;
    font-weight: 700;
    color: #333;
}

.fin_setting_row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.fin_setting_row label {
    font-size: 14px;
    font-weight: 500;
    color: #555;
    min-width: 100px;
}

.fin_setting_row select,
.fin_setting_row input[type="text"] {
    padding: 6px 10px;
    font-size: 14px;
    border: 1px solid #ddd;
    border-radius: 6px;
    flex: 1;
    max-width: 300px;
}

.fin_setting_actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #eee;
}

/* ── 빈 데이터 ── */
.fin_empty {
    text-align: center;
    padding: 60px 20px;
    color: #999;
    font-size: 16px;
}

.fin_empty strong {
    color: #555;
}

/* ── 제목 영역 ── */
.fin_title_area {
    text-align: center;
    margin-bottom: clamp(24px, calc(1.88vw + 18px), 48px);
}

.fin_main_title {
    font-size: clamp(24px, calc(0.94vw + 21px), 34px);
    font-weight: 700;
    color: #333;
    margin: 0 0 6px;
}

.fin_sub_title {
    font-size: clamp(15px, calc(0.47vw + 13.5px), 20px);
    font-weight: 500;
    color: #777;
    margin: 0;
}

/* ── 수입/지출 가로배열 (PC) ── */
.fin_detail_row {
    display: flex;
    gap: clamp(20px, calc(1.56vw + 15px), 40px);
}

.fin_detail_row > .fin_section {
    flex: 1;
    min-width: 0;
}

@media screen and (max-width: 1024px) {
    .fin_detail_row {
        flex-direction: column;
    }
}

/* ── 섹션 공통 ── */
.fin_section {
    margin-bottom: clamp(30px, calc(2.34vw + 22.5px), 60px);
}

.fin_section_title {
    font-size: clamp(20px, calc(0.47vw + 18.5px), 26px);
    font-weight: 700;
    color: #333;
    margin: 0 0 16px;
    display: flex;
    align-items: baseline;
    gap: 8px;
}

.fin_unit {
    font-size: 13px;
    font-weight: 400;
    color: #aaa;
}

/* ── 테이블 공통 ── */
.fin_table {
    width: 100%;
    border-collapse: collapse;
    font-size: clamp(16px, calc(0.31vw + 15px), 18px);
    table-layout: fixed;
}

.fin_table th,
.fin_table td {
    padding: 12px 14px;
    border-bottom: 1px solid #e5e5e5;
    vertical-align: middle;
}

.fin_table thead th {
    background: #f5f5f5;
    font-weight: 600;
    text-align: center;
    color: #555;
    border-top: 2px solid #333;
    border-bottom: 1px solid #ccc;
}

.fin_th_income {
    background: #f3f3f3 !important;
    color: #555 !important;
}

.fin_th_expense {
    background: #f3f3f3 !important;
    color: #555 !important;
}

/* 총괄표 */
.fin_summary_table_wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.fin_summary_table th,
.fin_summary_table td {
    border-bottom: 1px solid #e8e8e8;
    border-left: none;
    border-right: none;
    border-top: none;
}

/* 수입/지출 가운데 구분선 (진한) */
.fin_summary_table td.fin_td_divider,
.fin_summary_table .fin_tr_total td.fin_td_divider,
.fin_summary_table thead th.fin_th_divider {
    border-right: 2px solid #555 !important;
}

/* 구분·세부항목 사이 세로선 (연한) */
.fin_summary_table td.fin_td_label,
.fin_summary_table td.fin_td_sub_label,
.fin_summary_table thead th.fin_th_border {
    border-right: 1px solid #ddd;
}

/* 총괄표 헤더 (수입, 지출, 구분, 금액 글자) */
.fin_summary_table thead th {
    font-size: 17px;
    padding: 13px 14px;
}

/* 총괄표 데이터 행 */
.fin_summary_table td.fin_td_label {
    font-weight: 500;
    background: #fafafa;
    text-align: left;
    font-size: 15px;
}

.fin_summary_table td.fin_td_amount {
    text-align: right;
    font-variant-numeric: tabular-nums;
    font-weight: 500;
    font-size: 15px;
    letter-spacing: -0.3px;
}

.fin_summary_table td.fin_td_sub_label {
    font-size: 14px;
    color: #777;
    padding-left: 24px;
    background: #fafafa;
}

.fin_summary_table tr.fin_tr_total td {
    font-weight: 700;
    background: #f0f0f0;
    border-top: 2px solid #333;
    border-bottom: 2px solid #333;
    text-align: center;
    color: #333;
    padding-top: 22px;
    padding-bottom: 22px;
}

.fin_summary_table tr.fin_tr_total td.fin_td_amount {
    text-align: right;
    color: #333;
    font-size: 20px;
}

/* 상세 테이블 */
.fin_detail_table td.fin_td_label {
    font-weight: 500;
    text-align: left;
    font-size: 15px;
}

.fin_detail_table td.fin_td_amount {
    text-align: right;
    font-variant-numeric: tabular-nums;
    font-weight: 500;
}

.fin_detail_table td.fin_td_detail {
    text-align: left;
    color: #777;
    font-size: 13px;
    line-height: 1.7;
    white-space: pre-line;
}

.fin_detail_table tr.fin_tr_total td {
    font-weight: 700;
    background: #f5f5f5;
    border-top: 2px solid #bbb;
    color: #333;
}

.fin_detail_table tr.fin_tr_total td.fin_td_amount {
    text-align: right;
}

/* ── 차트 영역 ── */
.fin_chart_wrap {
    width: 100%;
    height: 320px;
    margin: 0 0 24px;
    padding: 20px;
    background: #fafafa;
    border-radius: 8px;
    border: 1px solid #e8e8e8;
    box-sizing: border-box;
}

.fin_chart_wrap canvas {
    width: 100% !important;
    height: 100% !important;
}

/* ── 행 클릭 편집 ── */
.fin_clickable {
    cursor: pointer;
    transition: background-color 0.15s;
}

.fin_clickable:hover {
    background-color: #f5f5f5 !important;
}

/* 행 삭제 버튼 */
.fin_row_del_btn {
    position: absolute;
    right: 4px;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: none;
    color: #bbb;
    font-size: 16px;
    line-height: 20px;
    text-align: center;
    cursor: pointer;
    display: none;
    z-index: 2;
    border: none;
    padding: 0;
}

.fin_row_del_btn:hover {
    color: #888;
}

tr:hover .fin_row_del_btn {
    display: block;
}

.fin_td_detail {
    position: relative;
}

/* ── 편집 모달 ── */
.fin_modal_overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 2147483640;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.fin_modal_box {
    background: #fff;
    border-radius: 12px;
    width: 100%;
    max-width: 480px;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 8px 32px rgba(0,0,0,0.15);
    position: relative;
}

.fin_modal_box.is-dragging {
    position: fixed;
    margin: 0;
}

.fin_modal_header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid #eee;
    cursor: grab;
    user-select: none;
}

.fin_modal_header:active {
    cursor: grabbing;
}

.fin_modal_title {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
    color: #333;
}

.fin_modal_close {
    width: 28px;
    height: 28px;
    border: none;
    background: none;
    font-size: 20px;
    color: #999;
    cursor: pointer;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.fin_modal_close:hover {
    background: #f0f0f0;
    color: #555;
}

.fin_modal_body {
    padding: 20px;
}

.fin_modal_field {
    margin-bottom: 14px;
}

.fin_modal_field label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #666;
    margin-bottom: 5px;
}

.fin_modal_field input,
.fin_modal_field textarea {
    width: 100%;
    padding: 8px 12px;
    font-size: 15px;
    font-family: inherit;
    border: 1px solid #ddd;
    border-radius: 6px;
    background: #fff;
    outline: none;
    box-sizing: border-box;
    transition: border-color 0.2s;
}

.fin_modal_field input:focus,
.fin_modal_field textarea:focus {
    border-color: #999;
}

.fin_modal_field input[data-type="number"] {
    text-align: right;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.3px;
}

.fin_modal_field textarea {
    min-height: 80px;
    resize: vertical;
    line-height: 1.6;
}

/* 모달 내 구분선 */
.fin_modal_divider {
    font-size: 12px;
    font-weight: 600;
    color: #999;
    padding: 8px 0 4px;
    margin-top: 6px;
    border-top: 1px dashed #ddd;
}

/* 하위항목 추가 버튼 */
.fin_btn_add_sub {
    width: 100%;
    padding: 8px;
    font-size: 13px;
    color: #888;
    border: 1px dashed #ccc !important;
    border-radius: 6px;
    background: #fafafa !important;
    cursor: pointer;
    text-align: center;
}

.fin_btn_add_sub:hover {
    background: #f0f0f0 !important;
    color: #555;
}

/* 하위항목 삭제 버튼 */
.fin_btn_sub_del {
    display: inline-block;
    font-size: 11px;
    padding: 2px 8px;
    color: #c44;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: none;
    cursor: pointer;
    margin-bottom: 6px;
}

.fin_btn_sub_del:hover {
    background: #c44;
    color: #fff;
    border-color: #c44;
}

/* 컬러 픽커 필드 */
.fin_color_field {
    display: flex;
    align-items: center;
    gap: 10px;
}

.fin_color_field input[type="color"] {
    width: 44px;
    height: 36px;
    padding: 2px;
    border: 1px solid #ddd;
    border-radius: 6px;
    cursor: pointer;
    background: none;
}

.fin_color_hex {
    font-size: 14px;
    color: #888;
    font-family: monospace;
}

.fin_modal_footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 12px 20px 16px;
    border-top: 1px solid #eee;
}

/* 저장 알림 */
.fin_toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    padding: 12px 24px;
    background: #444;
    color: #fff;
    border-radius: 8px;
    font-size: 15px;
    z-index: 9999;
    transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1);
    pointer-events: none;
}

.fin_toast.show {
    transform: translateX(-50%) translateY(0);
}

/* ── 반응형 ── */
@media screen and (max-width: 768px) {
    .fin_top_area {
        flex-direction: column;
        align-items: stretch;
    }

    .fin_admin_btns {
        justify-content: flex-end;
    }

    .fin_summary_table colgroup {
        display: none;
    }

    .fin_summary_table th,
    .fin_summary_table td {
        padding: 8px 6px;
        font-size: 12px;
    }

    .fin_chart_wrap {
        padding: 10px;
    }

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

    .fin_setting_row select,
    .fin_setting_row input[type="text"] {
        max-width: 100%;
    }
}

/* ── 모바일 테이블 스크롤 래퍼 ── */
.fin_scroll_wrap {
    position: relative;
}

.fin_scroll_inner {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}
.fin_scroll_inner::-webkit-scrollbar {
    display: none;
}

.fin_scroll_inner .fin_table {
    min-width: 750px;
}
.fin_scroll_inner .fin_summary_table {
    min-width: 1000px;
}

.fin_scroll_arrow {
    display: none;
}

@media screen and (max-width: 768px) {
    .fin_scroll_arrow {
        display: flex;
        align-items: center;
        justify-content: center;
        position: absolute;
        top: 50%;
        transform: translateY(-50%);
        z-index: 10;
        width: 32px;
        height: 56px;
        border: none;
        border-radius: 6px;
        background: rgba(0, 0, 0, 0.25);
        color: #fff;
        font-size: 22px;
        font-weight: 700;
        cursor: pointer;
        transition: background 0.2s;
        padding: 0;
        line-height: 1;
    }
    .fin_scroll_arrow:hover,
    .fin_scroll_arrow:active {
        background: rgba(0, 0, 0, 0.45);
    }
    .fin_arrow_left { left: 0; }
    .fin_arrow_right { right: 0; }
}

@media screen and (max-width: 480px) {
    .fin_summary_table th,
    .fin_summary_table td {
        padding: 10px 8px;
        font-size: 15px;
    }

    .fin_summary_table thead th {
        font-size: 18px !important;
        padding: 14px 10px !important;
    }

    .fin_summary_table tr.fin_tr_total td {
        font-size: 18px !important;
    }

    .fin_detail_table td {
        padding: 10px 8px;
        font-size: 15px;
    }

    .fin_detail_table thead th {
        font-size: 18px !important;
        padding: 14px 10px !important;
    }

    .fin_detail_table tr.fin_tr_total td {
        font-size: 18px !important;
    }

    .fin_section_title {
        font-size: 20px;
    }

    .fin_main_title {
        font-size: 22px;
    }
}
