/*
 * 우리.zip 데일리 탭의 예산/정산 카드 + 정산 탭(위클리/먼슬리/연간/자산) 공용 CSS.
 * 지시서 07: 뷰 구조·계산 로직·카테고리 체계는 원본 그대로 유지하되, 시각 스타일(색상·폰트·질감)은
 * 새 디자인 시스템으로 전면 교체한다. 그림자/그라디언트/손글씨 폰트 등 "질감"은 걷어내고
 * 플랫한 단색 면 + 헤어라인 보더로 통일했다. 변수명은 원본 그대로 두고 값만 교체했다.
 */

:root {
  --text1: #1D1D1F;
  --text2: #4A4A4A;
  --text3: #6B6B70;
  --text4: #86868B;
  --text5: #C3C3C8;
  --border: rgba(0,0,0,0.1);
}

/* ── DAILY INPUT VIEW ── */
.daily-input-view {
  display: flex;
  flex-direction: column;
}
.daily-input-scroll {
  flex: 1;
  padding: 16px 0 0;
  overflow-y: auto;
}
.daily-input-footer {
  background: #fff;
  border-top: 0.5px solid var(--border);
  padding: 12px 20px;
  padding-bottom: calc(12px + var(--hg-safe-bottom, 0px));
  display: flex;
  gap: 8px;
  margin-top: 8px;
}
.save-btn {
  flex: 1;
  padding: 14px;
  border-radius: var(--hg-radius-control);
  background: var(--hg-accent);
  color: #FFFFFF;
  font-size: 13px;
  font-weight: 500;
  border: none;
  cursor: pointer;
  font-family: inherit;
  transition: opacity 0.15s;
}
.save-btn:active { opacity: 0.8; }
.delete-btn {
  padding: 14px 20px;
  border-radius: var(--hg-radius-control);
  background: #FEF2F2;
  color: #E5484D;
  font-size: 13px;
  font-weight: 500;
  border: none;
  cursor: pointer;
  font-family: inherit;
  white-space: nowrap;
}

/* ── RECEIPT CARD (정산 카드) — 그림자·톱니노치 제거, 플랫 카드 + 헤어라인 구분선 ── */
.receipt-card {
  margin: 0 0 16px;
  background: #FFFFFF;
  border-radius: var(--hg-radius-card);
  border: 0.5px solid var(--border);
  overflow: hidden;
}
.receipt-header {
  padding: 20px 20px 24px;
  text-align: center;
}
.receipt-total-label {
  font-size: 11px;
  font-weight: 500;
  color: var(--text1);
  margin-bottom: 4px;
}
.receipt-total-amount {
  font-size: 25px;
  font-weight: 500;
  letter-spacing: -1px;
  color: var(--text1);
}
.receipt-notch {
  border-top: 0.5px solid var(--border);
  margin-bottom: 4px;
}
.receipt-entries > div:last-child { border-bottom: none !important; }
.receipt-footer {
  border-top: 0.5px solid var(--border);
  padding: 20px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.receipt-footer-date {
  font-size: 11px;
  color: var(--text3);
  font-weight: 400;
}
.receipt-footer-brand {
  font-size: 11px;
  font-weight: 500;
  color: var(--text3);
}

/* ── 오늘의 예산 리스트뷰(budget-card.js) — 우리.zip 원본 영수증 카드 구조 그대로, 색상·폰트만 현재 디자인 ── */
.budget-receipt-card {
  background: #FFFFFF;
  border-radius: var(--hg-radius-card);
  border: 0.5px solid var(--border);
  overflow: hidden;
  margin: 0 0 12px;
}
.budget-receipt-header { padding: 20px 20px 16px; }
.budget-receipt-title {
  font-size: var(--fs-title);
  font-weight: var(--fw-title);
  color: var(--text-secondary);
  margin-bottom: 14px;
}
.budget-receipt-info-row { display: flex; align-items: baseline; padding: 3px 0; }
.budget-receipt-info-row .label {
  font-size: 11px;
  font-weight: 500;
  color: var(--text3);
  min-width: 70px;
  white-space: nowrap;
}
.budget-receipt-info-row .colon {
  font-size: 11px;
  font-weight: 500;
  color: var(--text3);
  margin-right: 6px;
}
.budget-receipt-info-row .value {
  font-size: 11px;
  font-weight: 500;
  color: var(--text1);
}
.budget-receipt-table { padding: 32px 20px 0 96px; }
.budget-receipt-table-head {
  display: flex;
  align-items: center;
  padding: 8px 0;
  border-top: 0.5px solid var(--border);
  border-bottom: 0.5px solid var(--border);
}
.budget-receipt-table-head .th-item {
  flex: 1;
  font-size: 11px;
  font-weight: 500;
  color: var(--text1);
}
.budget-receipt-table-head .th-amount {
  width: 80px;
  flex-shrink: 0;
  text-align: center;
  font-size: 11px;
  font-weight: 500;
  color: var(--text1);
}
.budget-receipt-empty {
  padding: 32px 0;
  text-align: center;
  color: var(--text5);
  font-size: var(--fs-body);
}
.budget-receipt-add {
  padding: 14px 0 4px;
  text-align: center;
  color: var(--text5);
  font-size: var(--fs-body);
  cursor: pointer;
}
.budget-receipt-add-icon {
  padding: 10px 0 4px;
  text-align: center;
  color: var(--hg-accent);
  font-size: 18px;
  font-weight: 500;
  cursor: pointer;
}
.budget-receipt-total-row {
  display: flex;
  align-items: center;
  padding: 14px 0;
  border-top: 2px solid var(--text1);
  margin-top: 2px;
}
.budget-receipt-total-row .total-label {
  flex: 1;
  font-size: var(--fs-body);
  font-weight: 500;
  color: var(--text1);
}
.budget-receipt-total-row .total-amount {
  font-size: 20px;
  font-weight: 500;
  letter-spacing: -0.5px;
  color: var(--hg-accent);
}
.budget-receipt-total-row .total-amount .unit {
  font-size: var(--fs-body);
  font-weight: 500;
  color: var(--text1);
  margin-left: 3px;
}
.budget-receipt-week { padding: 36px 0 20px; }
.budget-receipt-week-title {
  font-size: 11px;
  font-weight: 500;
  color: var(--text1);
  margin-bottom: 10px;
}

/* ── 정산 카드 리스트뷰(settle-card.js) — 영수증 레퍼런스 스타일, 좌우 여백 통일 + 총 지출 손글씨풍 빨간 동그라미 ── */
.settle-receipt-card {
  background: #FFFFFF;
  border-radius: var(--hg-radius-card);
  border: 0.5px solid var(--border);
  overflow: hidden;
  margin: 0 0 12px;
}
.settle-receipt-header { padding: 24px 20px 16px; text-align: center; }
.settle-receipt-mood {
  font-size: 29px;
  min-height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.settle-receipt-mood-placeholder { font-size: 12px; color: var(--text5); font-weight: 500; }
.settle-receipt-word {
  font-size: 20px;
  font-weight: 700;
  color: var(--text1);
  letter-spacing: -0.3px;
  margin-top: 10px;
}
.settle-receipt-mood-msg {
  font-size: 11px;
  font-weight: 500;
  color: var(--text4);
  text-align: center;
  margin-top: 6px;
  letter-spacing: -0.3px;
}
.settle-receipt-dashed {
  border-top: 1.5px dashed var(--border);
  margin: 0 64px;
}

.settle-receipt-table { padding: 0 64px; }
.settle-receipt-table-head {
  display: flex;
  align-items: center;
  padding: 12px 0 8px;
  border-bottom: 0.5px solid var(--border);
}
.settle-receipt-table-head .th-item { flex: 1; font-size: 11px; font-weight: 500; color: var(--text1); }
.settle-receipt-table-head .th-amount { width: 80px; flex-shrink: 0; text-align: center; font-size: 11px; font-weight: 500; color: var(--text1); }

.settle-receipt-row { display: flex; align-items: flex-end; gap: 8px; padding: 10px 0; border-bottom: 0.5px solid var(--border); }
.settle-receipt-row .bar { width: 3px; height: 14px; border-radius: 2px; flex-shrink: 0; }
.settle-receipt-row .memo { font-size: var(--fs-body); font-weight: 500; color: var(--text1); flex-shrink: 0; }
.settle-receipt-row .name { min-width: 0; font-size: var(--fs-body); font-weight: 500; color: var(--text1); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.settle-receipt-row .path { font-size: calc(var(--fs-body) * 0.8); color: var(--text4); flex-shrink: 0; }
.settle-receipt-row .amount { font-size: var(--fs-body); font-weight: 500; color: var(--text1); white-space: nowrap; }

.settle-receipt-empty { padding: 24px 0; text-align: center; color: var(--text5); font-size: var(--fs-body); }
.settle-receipt-add-icon {
  padding: 10px 0 4px;
  text-align: center;
  color: var(--hg-accent);
  font-size: 18px;
  font-weight: 500;
  cursor: pointer;
}

.settle-receipt-total-row {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 18px 20px;
}
.settle-receipt-total-row .total-label { font-size: 11px; font-weight: 500; color: var(--text3); margin-bottom: 4px; }
.settle-receipt-total-row .total-amount { font-size: 22px; font-weight: 500; letter-spacing: -0.5px; color: var(--text1); }
.settle-receipt-total-row .total-amount .unit { font-size: var(--fs-body); font-weight: 500; color: var(--text1); margin-left: 3px; }

.settle-receipt-footer {
  padding: 6px 20px 20px;
  text-align: center;
  font-size: 11px;
  color: var(--text3);
}
.receipt-footer-brand .dot { color: var(--hg-accent); }

/* ── CATEGORY BOX (pill style) ── */
.cat-box {
  background: #FFFFFF;
  border-radius: var(--hg-radius-control);
  border: 0.5px solid var(--border);
  padding: 14px;
  margin: 0 0 14px;
}
.cat-box-label {
  font-size: 11px;
  font-weight: 500;
  color: var(--text4);
  margin-bottom: 10px;
}
.cat-box-divider {
  border: none;
  border-top: 0.5px solid var(--border);
  margin: 10px 0;
}
.cat-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}
.cat-pill {
  height: 26px;
  padding: 0 10px;
  border-radius: 8px;
  border: 0.5px solid rgba(0,0,0,0.1);
  background: #FFFFFF;
  font-family: inherit;
  font-size: 12px;
  font-weight: 400;
  color: var(--text4);
  cursor: pointer;
  transition: all 0.12s;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
}
.cat-pill.selected-d1 {
  background: rgba(46,124,246,0.08);
  color: var(--hg-accent);
  border-color: var(--hg-accent);
  font-weight: 500;
}
.cat-pill.selected-sub {
  background: rgba(46,124,246,0.08);
  color: var(--hg-accent);
  border-color: var(--hg-accent);
  font-weight: 500;
}

/* ── 오늘의 예산 입력 화면(budget-card.js) 전용 ──
   settle-card.js와 .cat-box/.cat-pill/.amount-field/.memo-field 클래스를 공유하므로
   settle-card.js는 절대 건드리지 않기 위해 .hg-budget-input으로 스코프한다.
   색상·폰트는 위 공용 규칙(현재 디자인)을 그대로 쓰고, 여백/모양(우리.zip 원본)만 되돌린다. */
.hg-budget-input .cat-box { border-radius: 12px; }
.hg-budget-input .cat-pill {
  height: auto;
  padding: 9px 14px;
  border-radius: 20px;
  border-width: 1.5px;
}
.hg-budget-input .amount-field,
.hg-budget-input .memo-field {
  border-width: 1.5px;
  border-radius: 12px;
  height: 34px;
  min-height: 0;
  padding: 0 14px;
}
/* 입력 화면도 "오늘 예산" 카드(.budget-receipt-card) 안에 나타나도록 감싸고,
   카드 자체엔 여백이 없으므로 좌우 여백은 카드에 직접 주고 푸터의 중복 여백은 제거한다. */
.hg-budget-input.budget-receipt-card {
  padding: 20px 20px 0;
}
.hg-budget-input .daily-input-footer {
  padding-left: 0;
  padding-right: 0;
}

/* ── TYPE PILLS (입력뷰 지출/수입/자산형성) ── */
.type-pills {
  display: flex;
  gap: 7px;
  padding: 0 0 16px;
}
.type-pill {
  flex: 1;
  height: 26px;
  padding: 0 4px;
  border-radius: 8px;
  border: 0.5px solid rgba(0,0,0,0.1);
  background: #FFFFFF;
  font-family: inherit;
  font-size: 12px;
  font-weight: 400;
  color: var(--text4);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  transition: all 0.12s;
}
.type-pill.active {
  background: rgba(46,124,246,0.08);
  color: var(--hg-accent);
  border-color: var(--hg-accent);
  font-weight: 500;
}
.type-pill .pdot {
  width: 7px; height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
  transition: background 0.12s;
}

/* ── AMOUNT / MEMO / DATE FIELD ── */
.amount-row { padding: 0 0 14px; }
.amount-row label,
.memo-row label,
.date-row label {
  font-size: 11px;
  font-weight: 400;
  color: var(--text3);
  display: block;
  margin-bottom: 5px;
  padding-left: 2px;
}
.amount-field {
  width: 100%;
  background: var(--hg-bg);
  border: 0.5px solid var(--border);
  border-radius: var(--hg-radius-control);
  font-size: 20px;
  font-weight: 500;
  letter-spacing: -1px;
  text-align: right;
  padding: 14px 16px;
  min-height: 56px;
  color: var(--text1);
  font-family: inherit;
  outline: none;
  -webkit-appearance: none;
  transition: border-color 0.15s;
}
.amount-field:focus { border-color: var(--hg-accent); background: #fff; }
.amount-field::placeholder { color: var(--text5); font-size: 18px; font-weight: 400; }

.memo-row { padding: 0 0 14px; }
.memo-field {
  width: 100%;
  background: var(--hg-bg);
  border: 0.5px solid var(--border);
  border-radius: var(--hg-radius-control);
  font-size: 13px;
  font-weight: 400;
  padding: 14px 13px;
  min-height: 56px;
  color: var(--text1);
  font-family: inherit;
  outline: none;
  -webkit-appearance: none;
  transition: border-color 0.15s;
}
.memo-field:focus { border-color: var(--hg-accent); background: #fff; }
.memo-field::placeholder { color: var(--text5); }

/* ── CUSTOM CALENDAR (날짜 선택 모달) — 정산·매매일지 공용 ── */
.cal-overlay {
  position: fixed; inset: 0; z-index: 850;
  background: rgba(0,0,0,0.3);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.cal-overlay.hidden { display: none; }
.cal-sheet {
  background: #fff;
  border-radius: var(--hg-radius-card);
  border: 0.5px solid var(--border);
  padding: 20px 16px 16px;
  width: 100%; max-width: 360px;
}
.cal-header-top {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px;
}
.cal-header-title {
  font-size: var(--fs-title); font-weight: var(--fw-title); color: var(--text1);
}
.cal-nav { display: flex; gap: 4px; }
.cal-nav-btn {
  width: 32px; height: 32px; border-radius: 50%;
  border: none; background: var(--hg-bg);
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; color: var(--text2); cursor: pointer;
}
.cal-nav-btn:active { background: var(--border); }
.cal-days-header {
  display: grid; grid-template-columns: repeat(7, 1fr);
  margin-bottom: 4px;
}
.cal-days-header span {
  text-align: center; font-size: 11px; font-weight: 400;
  color: var(--text5); padding: 6px 0;
}
.cal-days-header span:nth-child(6) { color: var(--hg-accent); }
.cal-days-header span:last-child { color: var(--hg-danger); }
.cal-grid {
  display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px;
}
.cal-day {
  aspect-ratio: 1; display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 400; color: var(--text1);
  border-radius: 50%; cursor: pointer; transition: background 0.1s;
  position: relative;
}
.cal-day:active { background: var(--hg-bg); }
.cal-day.empty { pointer-events: none; }
.cal-day.sat { color: var(--hg-accent); }
.cal-day.sun { color: var(--hg-danger); }
.cal-day.today { font-weight: 500; }
.cal-day.today::after {
  content: '';
  position: absolute;
  bottom: 4px; left: 50%;
  transform: translateX(-50%);
  width: 4px; height: 4px;
  border-radius: 50%;
  background: var(--hg-accent);
}
.cal-day.selected {
  background: var(--hg-accent) !important;
  color: #fff !important;
  font-weight: 500;
}
.cal-day.selected.sun,
.cal-day.selected.sat { color: #fff !important; }
.cal-day.selected.today::after { background: #fff; }
.cal-close {
  width: 100%; margin-top: 12px; padding: 13px;
  background: var(--hg-bg); border: none; border-radius: var(--hg-radius-control);
  font-size: 13px; font-weight: 500; color: var(--text1); cursor: pointer;
}
.cal-close:active { background: var(--border); }
