/* ===========================================================
 * 핀재팬 통합 계산기 공유 스타일
 * tools/currency-converter, tax-calculator, general-goods-calculator,
 * savings-calculator 4개 페이지가 이 파일 하나를 공유한다.
 * =========================================================== */
:root {
  --bg: #f7f5f2;
  --card: #ffffff;
  --ink: #1f2328;
  --sub: #6b7280;
  --accent: #b0413e;
  --accent-soft: #fdf0ef;
  --ok: #1a7f4e;
  --ok-soft: #e9f7ef;
  --loss: #b0413e;
  --warn: #b45309;
  --warn-soft: #fef6e7;
  --line: #e6e2dc;
  --radius: 14px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: "Pretendard", "Apple SD Gothic Neo", "Noto Sans KR", sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.55;
  padding: 20px 14px 48px;
}
.wrap { max-width: 640px; margin: 0 auto; }

/* ---------- 상단 브랜드 + 탭 ---------- */
.top-brand { font-size: 13px; font-weight: 700; color: var(--accent); letter-spacing: .04em; margin-bottom: 12px; }
.calc-tabs {
  display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 18px;
  -ms-overflow-style: none; scrollbar-width: none;
}
.calc-tabs::-webkit-scrollbar { display: none; }
.calc-tab-btn {
  flex: 0 0 auto; padding: 10px 16px; font-size: 13.5px; font-weight: 700; white-space: nowrap;
  border: 1px solid var(--line); border-radius: 999px; background: #fff; color: var(--sub);
  cursor: pointer; transition: .15s;
}
.calc-tab-btn:hover { border-color: var(--accent); color: var(--accent); }
.calc-tab-btn.active { background: var(--ink); border-color: var(--ink); color: #fff; }

.calc-panel { display: none; }
.calc-panel.active { display: block; }

/* ---------- 헤더(패널별) ---------- */
header { margin-bottom: 20px; }
header .brand { font-size: 13px; font-weight: 700; color: var(--accent); letter-spacing: .04em; }
header h1 { font-size: 22px; font-weight: 800; margin-top: 4px; }
header p { font-size: 13px; color: var(--sub); margin-top: 6px; }

/* ---------- 카드 공통 ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 16px;
  margin-bottom: 14px;
}
.card h2 { font-size: 15px; font-weight: 700; margin-bottom: 12px; display: flex; align-items: center; gap: 6px; }
.card h2 .step {
  background: var(--accent); color: #fff; font-size: 11px; font-weight: 700;
  width: 20px; height: 20px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
}

label { font-size: 12px; font-weight: 600; color: var(--sub); display: block; margin-bottom: 4px; }
input, select {
  width: 100%; font-size: 15px; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: 10px;
  background: #fff; color: var(--ink);
  -webkit-appearance: none; appearance: none;
}
input:focus, select:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }
input[type="checkbox"] {
  -webkit-appearance: checkbox; appearance: auto;
  width: 17px; height: 17px; padding: 0; border: none;
}
.row { display: flex; gap: 10px; }
.row > div { flex: 1; }

.rate-note { font-size: 11px; color: var(--sub); margin-top: 6px; }
.note { font-size: 11.5px; color: var(--sub); margin-top: 16px; }
.note a { color: var(--accent); }
.hidden { display: none; }

/* ---------- 토글 스위치 (주류/일반물품) ---------- */
.toggle-row { display: flex; align-items: center; justify-content: space-between; padding: 6px 0; }
.toggle-row span { font-size: 14px; font-weight: 600; }
.toggle-row small { display: block; font-size: 11px; font-weight: 400; color: var(--sub); }
.switch { position: relative; width: 46px; height: 26px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider {
  position: absolute; inset: 0; cursor: pointer; border-radius: 26px;
  background: #d1d5db; transition: .2s;
}
.slider::before {
  content: ""; position: absolute; width: 20px; height: 20px; border-radius: 50%;
  left: 3px; top: 3px; background: #fff; transition: .2s;
  box-shadow: 0 1px 3px rgba(0,0,0,.25);
}
.switch input:checked + .slider { background: var(--accent); }
.switch input:checked + .slider::before { transform: translateX(20px); }

/* ---------- 병/물품 카드 (주류·일반물품) ---------- */
.bottle, .item {
  border: 1px solid var(--line); border-radius: 12px;
  padding: 12px; margin-bottom: 10px; position: relative;
  background: #fbfaf8;
}
.bottle-head, .item-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.bottle-head b, .item-head b { font-size: 13px; }
.bottle .del, .item .del {
  background: none; border: none; color: var(--sub); font-size: 13px; cursor: pointer;
  padding: 4px 8px; border-radius: 6px;
}
.bottle .del:hover, .item .del:hover { background: var(--accent-soft); color: var(--accent); }
.bottle .grid, .item .grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.bottle .grid .full, .item .grid .full { grid-column: 1 / -1; }
.item .cat-hint { font-size: 11px; color: var(--sub); margin-top: 4px; }

/* ---------- 버튼 ---------- */
.btn {
  display: block; width: 100%; padding: 13px; font-size: 15px; font-weight: 700;
  border: none; border-radius: 12px; cursor: pointer; transition: .15s;
}
.btn-add { background: #fff; color: var(--accent); border: 1.5px dashed var(--accent); margin-bottom: 4px; }
.btn-add:hover { background: var(--accent-soft); }
.btn-calc { background: var(--accent); color: #fff; margin-top: 4px; }
.btn-calc:hover { filter: brightness(1.08); }

/* ---------- 결과 배너 ---------- */
.result-banner {
  border-radius: var(--radius); padding: 18px 16px; margin-bottom: 14px;
  font-size: 15px; font-weight: 700; text-align: center;
}
.result-banner .big { font-size: 24px; font-weight: 800; display: block; margin-top: 4px; }
.result-banner small { display: block; font-size: 12px; font-weight: 400; margin-top: 6px; opacity: .85; }
.banner-ok { background: var(--ok-soft); color: var(--ok); border: 1px solid #bde5cd; }
.banner-tax { background: var(--accent-soft); color: var(--accent); border: 1px solid #f3cbc9; }
.banner-warn { background: var(--warn-soft); color: var(--warn); border: 1px solid #f2dfc0; margin-bottom: 14px; }

/* ---------- 면세 적용 병 선택 (주류) ---------- */
.picker {
  background: var(--warn-soft); border: 1px solid #f2dfc0; border-radius: 12px;
  padding: 12px 14px; margin-bottom: 14px;
}
.picker .picker-title { font-size: 13.5px; font-weight: 700; color: var(--warn); margin-bottom: 4px; }
.picker .picker-sub { font-size: 11.5px; color: var(--sub); margin-bottom: 10px; }
.picker .pick-row {
  display: flex; align-items: center; gap: 10px;
  background: #fff; border: 1px solid var(--line); border-radius: 10px;
  padding: 9px 12px; margin-bottom: 6px; cursor: pointer; font-size: 13.5px;
}
.picker .pick-row.checked { border-color: var(--ok); background: var(--ok-soft); }
.picker .pick-row.disabled { opacity: .55; cursor: not-allowed; }
.picker .pick-row input { width: 17px; height: 17px; accent-color: var(--ok); flex-shrink: 0; }
.picker .pick-row .info { flex: 1; }
.picker .pick-row .info small { display: block; font-size: 11px; color: var(--sub); font-weight: 400; }
.picker .pick-row .tag { font-size: 11.5px; font-weight: 700; white-space: nowrap; }
.picker .pick-row .tag.free { color: var(--ok); }
.picker .pick-row .tag.tax { color: var(--accent); }
.picker .quota { font-size: 12px; font-weight: 600; margin-top: 8px; }
.picker .quota.over { color: var(--accent); }

/* ---------- 표 / 상세 내역 ---------- */
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 8px 6px; text-align: right; border-bottom: 1px solid var(--line); }
th { color: var(--sub); font-weight: 600; font-size: 12px; }
th:first-child, td:first-child { text-align: left; }
td.cat-cell { text-align: left; font-size: 12px; color: var(--sub); }
tr.taxed td { color: var(--accent); }
tr.free td:last-child { color: var(--ok); font-weight: 600; }
.detail-box { margin-top: 12px; background: #fbfaf8; border-radius: 10px; padding: 12px; }
.detail-box .line { display: flex; justify-content: space-between; font-size: 13px; padding: 3px 0; }
.detail-box .line.total { border-top: 1px solid var(--line); margin-top: 6px; padding-top: 8px; font-weight: 700; font-size: 14px; }
.detail-box .line .minus { color: var(--ok); }

/* ---------- 환율 계산기(환율 변환) ---------- */
.rate-banner {
  display: flex; align-items: baseline; justify-content: space-between;
  background: var(--ink); color: #fff; border-radius: var(--radius);
  padding: 16px 18px; margin-bottom: 14px;
}
.rate-banner .label { font-size: 12px; opacity: .75; }
.rate-banner .value { font-size: 20px; font-weight: 800; margin-top: 2px; }
.rate-banner .rate-note { margin-top: 10px; }

.field { position: relative; margin-bottom: 6px; }
.field input {
  width: 100%; font-size: 22px; font-weight: 700; padding: 12px 54px 12px 14px;
  border: 1.5px solid var(--line); border-radius: 12px; background: #fff; color: var(--ink);
  -webkit-appearance: none; appearance: none;
}
.field input:focus { outline: none; border-color: var(--accent); }
.field .unit {
  position: absolute; right: 14px; top: 50%; transform: translateY(-50%);
  font-size: 13px; font-weight: 700; color: var(--sub);
}

.swap-row { display: flex; justify-content: center; margin: 6px 0; }
.swap-btn {
  width: 38px; height: 38px; border-radius: 50%; border: 1.5px solid var(--line);
  background: #fff; color: var(--accent); font-size: 16px; cursor: pointer;
  display: flex; align-items: center; justify-content: center; transition: .15s;
}
.swap-btn:hover { background: var(--accent-soft); border-color: var(--accent); }
.swap-btn.spin { transform: rotate(180deg); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.chip {
  padding: 8px 14px; font-size: 13px; font-weight: 600; color: var(--ink);
  background: #fbfaf8; border: 1px solid var(--line); border-radius: 999px; cursor: pointer; transition: .15s;
}
.chip:hover { border-color: var(--accent); color: var(--accent); }

/* ---------- 절약 계산기(브랜드 탭 + 위스키 카드) ---------- */
.brand-tabs { display: flex; gap: 8px; margin-bottom: 12px; }
.brand-tab {
  flex: 1; padding: 9px 0; font-size: 14px; font-weight: 700; text-align: center;
  border: 1px solid var(--line); border-radius: 10px; background: #fff;
  color: var(--sub); cursor: pointer; transition: .15s;
}
.brand-tab.active { background: var(--accent); border-color: var(--accent); color: #fff; }

.whisky-list { display: flex; flex-direction: column; gap: 8px; }
.whisky {
  border: 1.5px solid var(--line); border-radius: 12px; background: #fbfaf8;
  padding: 12px 14px; cursor: pointer; transition: .15s;
}
.whisky:hover { border-color: #cbb; }
.whisky.active { border-color: var(--accent); background: var(--accent-soft); }
.whisky .top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.whisky .name { font-size: 14.5px; font-weight: 700; }
.whisky .kr-price { font-size: 13px; color: var(--sub); white-space: nowrap; }
.whisky .body { display: none; margin-top: 12px; }
.whisky.active .body { display: block; }
.whisky .body .row { display: flex; gap: 8px; align-items: flex-end; }
.whisky .body .row > div { flex: 1; }
.whisky .saving-line {
  margin-top: 10px; padding: 10px 12px; border-radius: 10px;
  background: #fff; font-size: 13.5px; display: none;
}
.whisky .saving-line.show { display: block; }
.whisky .saving-line b.gain { color: var(--ok); }
.whisky .saving-line b.loss { color: var(--loss); }
.whisky .saving-line .sub { font-size: 11.5px; color: var(--sub); margin-top: 2px; }

.total-banner {
  position: sticky; bottom: 12px;
  border-radius: var(--radius); padding: 16px;
  background: var(--ink); color: #fff;
  display: flex; justify-content: space-between; align-items: center;
  box-shadow: 0 6px 20px rgba(0,0,0,.18);
}
.total-banner .t-label { font-size: 13px; opacity: .8; }
.total-banner .t-label small { display: block; font-size: 11px; opacity: .75; }
.total-banner .t-value { font-size: 22px; font-weight: 800; }
.total-banner .t-value.gain { color: #7ee2a8; }
.total-banner .t-value.loss { color: #ff9f9c; }
