/* =====================================================
   시재 관리 뷰(#cash-view) 전용 스타일
   기본 토큰·버튼·테이블·카드는 style.css 재사용
   ===================================================== */

/* 상단: 서브탭 + 백업 버튼 */
.cash-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.cash-tabs { display: flex; gap: 6px; flex-wrap: wrap; }

/* 배너 */
.cash-banner {
    padding: 11px 16px; margin-bottom: 14px;
    border-radius: var(--radius); font-size: 13px;
    display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
.cash-banner-warn { background: #FFFBEB; border: 1px solid #FDE68A; color: #92400E; }
.cash-banner-info { background: #EFF6FF; border: 1px solid #BFDBFE; color: #1E40AF; }
.cash-banner .btn { margin-left: auto; }
.cash-banner .btn + .btn { margin-left: 0; }

/* 섹션 */
.cash-section {
    background: var(--white); border: 1px solid var(--border);
    border-radius: 12px; padding: 18px; margin-bottom: 18px;
}
.cash-sec-title { font-size: 15px; font-weight: 700; margin-bottom: 14px; }
.cash-note { font-size: 12px; color: var(--text-light); margin: 8px 0 0; }
.cash-start-note { margin: 0 0 12px; }

/* 요약 카드: 모바일 1열 → 태블릿 2열 → 데스크톱 3열 */
.cash-cards { display: grid; grid-template-columns: 1fr; gap: 12px; margin-bottom: 14px; }
@media (min-width: 560px)  { .cash-cards { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 900px)  { .cash-cards { grid-template-columns: repeat(3, 1fr); } }
.mini-edit {
    border: none; background: none; color: var(--primary);
    font-size: 11px; cursor: pointer; padding: 0 2px; font-family: inherit;
}
.stat-sub { display: block; font-size: 11px; color: var(--text-light); margin-top: 3px; }
.mini-edit:hover { text-decoration: underline; }

/* 센드페이 적립 (출금신청 대기) */
.sp-box { display: flex; flex-direction: column; gap: 10px; }
.sp-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.sp-top { align-items: flex-end; }
.sp-amount-label { display: block; font-size: 11px; color: var(--text-light); margin-bottom: 2px; }
.sp-amount { font-size: 22px; font-weight: 700; color: #C2410C; }
.sp-nums { font-size: 13px; color: var(--text-light); }
.sp-nums strong { color: var(--text); }
.sp-gauge { height: 10px; background: var(--bg); border: 1px solid var(--border); border-radius: 5px; overflow: hidden; }
.sp-fill { height: 100%; background: #F59E0B; border-radius: 5px; }
.sp-fill.ready { background: #10B981; }
.sp-status { font-size: 13px; color: #92400E; }
.sp-status.ok { color: #047857; font-weight: 700; }
#sendpay-section.sp-ready { border-color: #6EE7B7; }
#sendpay-section.sp-ready .sp-amount { color: #047857; }
.sp-btn-ready { background: #10B981; border-color: #10B981; }
.sp-btn-ready:hover { background: #059669; }

/* 폼: 모바일 1열, 데스크톱 3열 */
.cash-form-grid { display: grid; grid-template-columns: 1fr; gap: 0 14px; }
@media (min-width: 700px) {
    .cash-form-grid { grid-template-columns: repeat(3, 1fr); }
    .cash-form-wide { grid-column: span 2; }
}
.cash-form .form-group, #cash-start .form-group { margin-bottom: 12px; }
.cash-form input, .cash-form select, #cash-start input { font-size: 15px; }
.cash-form-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 4px; }
.cash-form-actions .btn { min-width: 96px; height: 42px; }
.rate-display {
    height: 40px; display: flex; align-items: center; padding: 0 12px;
    background: var(--bg); border: 1px solid var(--border);
    border-radius: var(--radius); font-weight: 700;
}
.check-label { display: flex; align-items: center; gap: 8px; font-size: 14px; cursor: pointer; padding-top: 8px; }
.check-label input { width: 17px; height: 17px; }
.label-hint { font-weight: 400; color: var(--text-light); font-size: 11px; }

/* 목록 헤더 + 필터 */
.cash-list-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.cash-list-head .cash-sec-title { margin-bottom: 0; }
.cash-filter { display: flex; gap: 6px; }

/* 월별 합계 */
.cash-monthly { margin-top: 14px; font-size: 13px; overflow-x: auto; }
.cash-monthly table { width: 100%; border-collapse: collapse; }
.cash-monthly th, .cash-monthly td {
    text-align: right; padding: 7px 10px; border-top: 1px solid var(--border); white-space: nowrap;
}
.cash-monthly th:first-child, .cash-monthly td:first-child { text-align: left; }
.cash-monthly th { color: var(--text-light); font-weight: 600; border-top: none; }

/* 월간 입출금 달력 */
.cal-nav { display: flex; align-items: center; gap: 8px; }
.cal-title { font-weight: 700; font-size: 14px; min-width: 92px; text-align: center; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-dow { text-align: center; font-size: 11px; color: var(--text-light); font-weight: 700; padding: 4px 0; }
.cal-dow.sun { color: var(--danger); }
.cal-cell {
    min-height: 76px; border: 1px solid var(--border); border-radius: 6px;
    padding: 4px 5px; cursor: pointer; display: flex; flex-direction: column; gap: 1px;
    background: var(--white); overflow: hidden;
}
.cal-cell:hover { background: #F3F4F6; }
.cal-empty { border: none; background: none; cursor: default; }
.cal-empty:hover { background: none; }
.cal-daynum { font-size: 11px; font-weight: 700; color: var(--text-light); }
.cal-today { border-color: var(--primary); }
.cal-today .cal-daynum { color: var(--primary); }
.cal-sel { background: #EFF6FF; box-shadow: 0 0 0 1px var(--primary) inset; border-color: var(--primary); }
.cal-in  { font-size: 10px; color: var(--primary); white-space: nowrap; }
.cal-out { font-size: 10px; color: var(--danger); white-space: nowrap; }
.cal-net { font-size: 10px; font-weight: 700; white-space: nowrap; border-top: 1px solid var(--border); margin-top: 1px; padding-top: 1px; }
.cal-net.pos { color: var(--primary); }
.cal-net.neg { color: var(--danger); }
.cal-exp { font-size: 10px; color: var(--text-light); white-space: nowrap; }

/* 목록 페이저 + 기간 선택 */
.cash-pager { display: flex; align-items: center; justify-content: center; gap: 10px; margin-top: 12px; }
.cash-pg-info { font-size: 12px; color: var(--text-light); }
.wl-filters .cash-range { display: inline-flex; align-items: center; gap: 4px; }
.wl-filters input[type="text"] {
    height: 34px; padding: 0 10px; font-size: 13px; font-family: inherit;
    border: 1px solid var(--border); border-radius: 6px; width: 170px;
}
.wl-filters input[type="text"]:focus { outline: none; border-color: var(--primary); }
.cash-range input[type="date"] {
    height: 34px; padding: 0 6px; font-size: 13px; font-family: inherit;
    border: 1px solid var(--border); border-radius: 6px;
}
.cash-range.hidden { display: none; }

/* 잔고 추이 차트 (라이브러리 없이 div 막대) */
.balance-chart { display: flex; align-items: flex-end; gap: 8px; height: 150px; padding-top: 8px; }
.bc-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 5px; min-width: 0; }
.bc-bar-area { display: flex; align-items: flex-end; height: 100px; width: 100%; justify-content: center; }
.bc-bar { width: 70%; max-width: 46px; background: var(--primary); border-radius: 4px 4px 0 0; min-height: 2px; }
.bc-bar.neg { background: var(--danger); }
.bc-amount { font-size: 10px; color: var(--text-light); white-space: nowrap; }
.bc-day { font-size: 11px; color: var(--text-light); }
.bc-day.today { color: var(--primary); font-weight: 700; }

/* 상태 태그 */
.tag { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 11px; font-weight: 700; white-space: nowrap; }
.tag-hold { background: #FEF3C7; color: #92400E; }
.tag-sold { background: #D1FAE5; color: #065F46; }
.tag-wait { background: #EDE9FE; color: #5B21B6; }
.tag-done { background: #D1FAE5; color: #065F46; }
.tag-late { background: #FEE2E2; color: #991B1B; }
tr.row-late td { background: #FEF2F2; }

/* 일일 마감 자동 표시 그리드 */
.close-grid { display: grid; grid-template-columns: 1fr; gap: 8px; margin-bottom: 14px; }
@media (min-width: 700px) { .close-grid { grid-template-columns: repeat(5, 1fr); } }
.close-item { background: var(--bg); border-radius: var(--radius); padding: 10px 12px; }
.close-item span { display: block; font-size: 11px; color: var(--text-light); margin-bottom: 3px; }
.close-item strong { font-size: 14px; }
.cash-close-date { max-width: 200px; }
.diff-plus  { color: var(--primary); }
.diff-minus { color: var(--danger); }

/* 모바일 */
@media (max-width: 640px) {
    .cash-section { padding: 14px 12px; }
    #cash-view .table th, #cash-view .table td { padding: 8px 6px; font-size: 12px; }
    .cash-form-actions .btn { flex: 1; }
    .cal-grid { gap: 2px; }
    .cal-cell { min-height: 52px; padding: 2px 3px; }
    .cal-in, .cal-out, .cal-exp { font-size: 9px; }
    .wl-filters { flex-wrap: wrap; }
}
