* {
  box-sizing: border-box;
  font-family: "Malgun Gothic", sans-serif;
}
body {
  margin: 0;
  background: #f3f5fa;
  color: #333;
}
.app {
  max-width: 430px;
  margin: 0 auto;
  padding: 16px;
}
h2 {
  text-align: center;
  margin: 10px 0 20px;
}
.card {
  background: #fff;
  border-radius: 14px;
  padding: 16px;
  margin-bottom: 16px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}
label {
  display: block;
  font-size: 13px;
  font-weight: 700;
  color: #d9534f;
  margin: 10px 0 6px;
}
input,
select,
textarea {
  width: 100%;
  padding: 10px;
  border: 1px solid #d8ddea;
  border-radius: 8px;
  font-size: 14px;
  background: #fff;
}
table {
  margin-top: 12px;
  border-collapse: collapse;
}
th {
  background: #dfe7fb;
  color: #444;
  padding: 10px;
  font-size: 13px;
}
td {
  padding: 6px;
}
td input {
  width: 100%;
}
button {
  border: none;
  border-radius: 10px;
  padding: 10px 14px;
  margin: 6px 4px 0 0;
  background: #5f6ad4;
  color: #fff;
  font-weight: bold;
  cursor: pointer;
}
button:hover {
  opacity: 0.92;
}

.btn-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}
.btn-group button {
  flex: 1;
}
.badge {
  display: inline-block;
  background: #e8eefc;
  color: #4d63c9;
  font-weight: bold;
  padding: 6px 12px;
  border-radius: 14px;
  font-size: 12px;
  margin-bottom: 10px;
}
.item {
  border: 1px solid #d8ddea;
  border-radius: 12px;
  padding: 12px;
  background: #fafcff;
}
.receipt-card {
  padding: 20px;
}

.receipt-title {
  font-size: 18px;
  font-weight: bold;
  margin-bottom: 18px;
  color: #444;
}

.receipt-preview {
  display: block;
  position: relative;
  width: 100%;
  height: 240px;

  overflow: hidden;

  border-radius: 18px;

  border: 2px solid #e6eaf2;

  background: #f8f9fc;

  cursor: pointer;
}

.receipt-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.receipt-overlay {
  position: absolute;

  left: 0;
  top: 0;

  width: 100%;
  height: 100%;

  display: flex;

  align-items: center;
  justify-content: center;

  background: rgba(255, 255, 255, 0.25);

  backdrop-filter: blur(1px);
}

.receipt-guide {
  background: rgba(255, 255, 255, 0.92);

  padding: 18px 26px;

  border-radius: 14px;

  text-align: center;

  line-height: 28px;

  font-size: 15px;

  color: #555;

  font-weight: 600;
}

.receipt-button-area {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 18px;
}

.receipt-button-area button {
  flex: 1 1 0;
  width: 0;
  height: 48px;
  margin: 0; /* 전역 button margin 제거 */
  white-space: nowrap; /* 줄바꿈 방지 */
  border-radius: 12px;
  border: none;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
}

.btn-photo {
  background: #4f7cff;

  color: white;
}

.btn-gallery {
  background: #97f09b;
  color: #ffffff;
}

/* 한 줄 입력 */
.form-row {
  display: flex;
  gap: 12px;
  margin-bottom: 14px;
}

.form-col {
  flex: 1;
}

.form-col label {
  display: block;
  margin: 0 0 6px;
}

.form-col input,
.form-col select {
  width: 100%;
}

/* 영수증 선택 */
.receipt-label {
  margin: 18px 0 10px;
  color: #444;
  font-size: 15px;
  font-weight: 700;
}

.radio-group {
  display: flex;
  gap: 20px;
  margin-bottom: 16px;
}

.radio-item {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  color: #333;
  font-weight: 500;
  cursor: pointer;
}

.radio-item input {
  width: 18px;
  height: 18px;
  margin: 0;
}

/* 등록 영수증 보기 */
.receipt-view-area {
  margin-bottom: 16px;
}

.btn-view {
  width: 100%;
  height: 44px;
  margin: 0;
  background: #97f09b;
  color: #ffffff;
  background: #97f09b;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 600;
}

/* 총중량 */
.weight-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 12px 0 16px;
}

.weight-label {
  margin: 0;
  min-width: 52px;
  color: #d9534f;
  font-size: 13px;
  font-weight: 700;
}

.weight-input {
  flex: 1;
}

.weight-unit {
  width: 70px !important;
}

.weight-check {
  display: flex;
  align-items: center;
  gap: 4px;
  margin: 0;
  white-space: nowrap;
  color: #444;
  font-weight: 500;
}

.weight-check input {
  width: 18px;
  height: 18px;
  margin: 0;
}

.item-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.item-header h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
}

/* 전역 button:last-child를 무시 */
.item-header .btn-add-item {
  width: auto !important;
  height: 36px;
  margin: 0;
  padding: 0 14px;
  background: #ec7708;
  color: #fff;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  flex-shrink: 0;
}

.label-help {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
}

.label-help label {
  margin: 0;
}

.help-icon {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #4f7cff;
  color: #fff;
  font-size: 12px;
  font-weight: bold;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  user-select: none;
}

/* Tooltip */
.help-tooltip {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.help-icon {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #4f7cff;
  color: #fff;
  font-size: 12px;
  font-weight: bold;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: help;
}

/* 설명창 */
.tooltip-box {
  position: absolute;
  left: 28px;
  top: 50%;
  transform: translateY(-50%);
  width: 230px;

  background: #333;
  color: #fff;

  padding: 10px 12px;
  border-radius: 8px;

  font-size: 12px;
  line-height: 18px;

  visibility: hidden;
  opacity: 0;

  transition: 0.2s;

  z-index: 1000;
}

/* 말풍선 꼬리 */
.tooltip-box::before {
  content: "";
  position: absolute;
  left: -6px;
  top: 50%;
  transform: translateY(-50%);
  border-top: 6px solid transparent;
  border-bottom: 6px solid transparent;
  border-right: 6px solid #333;
}

/* 마우스 오버 */
.help-tooltip:hover .tooltip-box {
  visibility: visible;
  opacity: 1;
}

.receipt-placeholder {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  font-size: 22px;
  font-weight: 700;
  color: #7b8794;
  line-height: 1.8;
}

.receipt-preview {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 240px;
  border: 2px dashed #cfd8e3;
  border-radius: 18px;
  background: #f8f9fc;
  overflow: hidden;
}

.receipt-guide-box {
  text-align: center;
}

.camera-icon {
  font-size: 52px;
  margin-bottom: 12px;
}

.guide-title {
  font-size: 20px;
  font-weight: 700;
  color: #444;
  margin-bottom: 8px;
}

.guide-desc {
  font-size: 14px;
  color: #7b8794;
  line-height: 24px;
}

#previewImage {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* =========================
   상단 메뉴
========================= */

.top-tab {
  display: flex;
  background: #fff;
  border-radius: 14px;
  overflow: hidden;
  margin-bottom: 16px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.top-tab .tab {
  flex: 1;
  margin: 0;
  padding: 14px 4px;
  border: none;
  background: #fff;
  color: #666;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  transition: 0.2s;
}

.top-tab .tab:not(:last-child) {
  border-right: 1px solid #eceff5;
}

.top-tab .tab:hover {
  background: #f4f7ff;
}

.top-tab .tab.active {
  background: #4f7cff;
  color: #fff;
}

.tab-icon {
  font-size: 20px;
  line-height: 1;
}

/* ==============================
   구매장소 도움말 팝업
============================== */

.store-tooltip {
  position: absolute;

  top: 28px;

  left: -80px;

  width: 320px;

  background: #fff;

  border: 1px solid #d9e2ef;

  border-radius: 12px;

  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);

  padding: 16px;

  visibility: hidden;

  opacity: 0;

  transition: 0.2s;

  z-index: 9999;
}

.help-tooltip:hover .store-tooltip {
  visibility: visible;

  opacity: 1;
}

.store-popup-title {
  font-size: 15px;

  font-weight: 700;

  margin-bottom: 12px;

  color: #4f7cff;
}

.store-search select {
  width: 100%;

  margin-bottom: 12px;
}

.store-list {
  max-height: 170px;

  overflow-y: auto;

  background: #f7f9fc;

  border: 1px solid #e4e8f1;

  border-radius: 8px;

  padding: 12px;

  font-size: 13px;

  line-height: 24px;

  color: #555;
}

/* 구매장소 제목 */

.field-title {
  display: flex;

  align-items: center;

  gap: 6px;

  margin: 0 0 6px;
}

.field-title label {
  margin: 0;

  display: block;
}

.field-title .help-tooltip {
  display: flex;

  align-items: center;
}
