/* ===== 기본 설정 (고대비 색상) ===== */
:root {
  --bg: #eef1f5;            /* 페이지 배경: 흰 카드가 잘 보이도록 옅은 회색 */
  --card: #ffffff;          /* 카드 배경 */
  --text: #111827;          /* 본문 글자: 거의 검정 */
  --sub-text: #4b5563;      /* 보조 글자: 진한 회색 */
  --border: #8a929c;        /* 입력칸 테두리: 흰 배경에서 또렷하게 */
  --divider: #e5e7eb;       /* 목록 구분선 */

  --primary: #1d4ed8;       /* 파랑 (추가 버튼) */
  --primary-hover: #1e3a8a; /* 마우스 올렸을 때 더 진한 파랑 */
  --primary-soft: #e0e8ff;  /* 카테고리 배지 배경 */

  --expense: #c62828;       /* 지출 빨강 */
  --income: #1b7f3b;        /* 수입 초록 */

  --radius: 16px;           /* 카드 둥근 모서리 */
  --radius-sm: 10px;        /* 입력칸·버튼 둥근 모서리 */
  --shadow: 0 2px 8px rgba(17, 24, 39, 0.06), 0 1px 2px rgba(17, 24, 39, 0.04);
}

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

body {
  font-family: "Pretendard", "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

.container {
  max-width: 480px;
  margin: 0 auto;
  padding: 24px 16px 48px;
}

/* ===== 머리글 ===== */
.header {
  margin-bottom: 16px;
  padding: 0 4px;
}

.header h1 {
  font-size: 24px;
  font-weight: 800;
  color: var(--text);
}

/* ===== 카드 공통 (입력 영역, 목록 영역) ===== */
.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 24px 20px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}

.section-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 18px;
}

/* ===== 입력 폼 ===== */
.entry-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  border: none;
}

.field-label {
  font-size: 14px;
  font-weight: 700;
  color: var(--sub-text);
}

.input {
  width: 100%;
  height: 46px;
  padding: 0 14px;
  font-size: 16px;
  font-family: inherit;
  color: var(--text);
  background: #fff;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.input::placeholder {
  color: #6b7280;
}

.input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(29, 78, 216, 0.25);
}

/* 구분: 지출/수입 토글 버튼 */
.segmented {
  display: flex;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.segmented input[type="radio"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.segmented label {
  flex: 1;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 700;
  color: var(--sub-text);
  background: #fff;
  cursor: pointer;
  user-select: none;
  transition: background 0.15s, color 0.15s;
}

.segmented label + input + label {
  border-left: 1.5px solid var(--border);
}

#type-expense:checked + label {
  background: var(--expense);
  color: #fff;
}

#type-income:checked + label {
  background: var(--income);
  color: #fff;
}

.segmented input:focus-visible + label {
  outline: 3px solid var(--primary);
  outline-offset: -3px;
}

/* 금액 입력 */
.amount-wrap {
  position: relative;
}

.amount-input {
  padding-right: 38px;
  text-align: right;
}

.unit {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--sub-text);
  font-size: 15px;
  font-weight: 600;
}

/* 숫자 입력칸의 위아래 화살표 숨기기 */
.amount-input::-webkit-outer-spin-button,
.amount-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.amount-input {
  -moz-appearance: textfield;
}

/* 추가 버튼: 파랑, 마우스 올리면 조금 진하게 */
.add-btn {
  height: 50px;
  margin-top: 4px;
  font-size: 17px;
  font-weight: 700;
  font-family: inherit;
  color: #fff;
  background: var(--primary);
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.15s;
}

.add-btn:hover {
  background: var(--primary-hover);
}

.add-btn:focus-visible {
  outline: 3px solid var(--primary-hover);
  outline-offset: 2px;
}

/* ===== 내역 목록 영역 ===== */
.list-section {
  min-height: 200px;
}

.entry-list {
  list-style: none;
}

.entry-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 0;
  border-bottom: 1px solid var(--divider);
}

.entry-item:first-child {
  padding-top: 0;
}

.entry-item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.entry-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.entry-top {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* 카테고리 배지 */
.category-badge {
  display: inline-block;
  flex-shrink: 0;
  padding: 2px 10px;
  font-size: 13px;
  font-weight: 700;
  color: var(--primary);
  background: var(--primary-soft);
  border-radius: 999px;
}

/* 내용 */
.entry-desc {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  word-break: break-all;
}

.entry-bottom {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* 구분 (지출/수입) 글자 */
.entry-type {
  font-size: 13px;
  font-weight: 700;
}

.entry-type.expense {
  color: var(--expense);
}

.entry-type.income {
  color: var(--income);
}

.entry-date {
  font-size: 13px;
  color: var(--sub-text);
}

/* 금액: 지출 빨강, 수입 초록 */
.entry-amount {
  font-size: 17px;
  font-weight: 800;
  white-space: nowrap;
}

.entry-amount.expense {
  color: var(--expense);
}

.entry-amount.income {
  color: var(--income);
}

.empty-message {
  padding: 40px 0;
  text-align: center;
  color: var(--sub-text);
  font-size: 14px;
}
