/* =========================================================
   우리집 냉장고 · styles.css
   warm cream / terracotta · mobile first (375px 기준)
   ========================================================= */

:root {
  --cream: #FAF6F0;
  --cream-2: #F5ECE1;
  --cream-3: #EFE1D2;
  --card: #FFFFFF;
  --ink: #3B2A20;
  --ink-2: #6B5648;
  --muted: #9C8A7B;
  --terra: #C85A32;
  --terra-dark: #A9481F;
  --terra-soft: #F8E3D8;
  --terra-line: #F0CDBB;
  --brown: #7C4A2D;
  --line: #ECE0D3;
  --line-soft: #F3EAE0;
  --ok: #5C8A5E;
  --ok-soft: #E8F0E5;
  --offline: #6E7B4E;
  --offline-soft: #EDF0E3;
  --shadow-sm: 0 2px 8px rgba(124, 74, 45, .05);
  --shadow: 0 10px 26px rgba(124, 74, 45, .08);
  --r-xl: 24px;
  --r-lg: 20px;
  --r-md: 15px;
  --r-sm: 11px;
  --nav-h: 62px;
  --font: 'Pretendard', -apple-system, BlinkMacSystemFont, 'Apple SD Gothic Neo',
          'Noto Sans KR', 'Malgun Gothic', system-ui, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--cream);
  color: var(--ink);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.45;
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
}

body {
  background:
    radial-gradient(120% 60% at 50% 0%, #FDF8F1 0%, rgba(250, 246, 240, 0) 60%),
    var(--cream);
}

button {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
  border: 0;
  background: none;
  padding: 0;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
button:active { transform: scale(.985); }

input, select, textarea {
  font-family: inherit;
  font-size: 15px;
  color: var(--ink);
  background: #FFFDFB;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 11px 12px;
  width: 100%;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}
input::placeholder, textarea::placeholder { color: #BCAC9C; }
input:focus, select:focus, textarea:focus {
  border-color: var(--terra-line);
  box-shadow: 0 0 0 3px rgba(200, 90, 50, .08);
}
select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2.5 4.5 6 8l3.5-3.5' fill='none' stroke='%239C8A7B' stroke-width='1.4' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 12px;
  padding-right: 32px;
}
textarea { resize: vertical; min-height: 96px; line-height: 1.55; }

h1, h2, h3, p { margin: 0; }
ul { margin: 0; padding: 0; list-style: none; }
a { color: var(--terra); }

.sr-only {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

/* ---------- 레이아웃 ---------- */
.app {
  max-width: 520px;
  margin: 0 auto;
  min-height: 100vh;
  min-height: 100dvh;
  padding: 0 0 calc(var(--nav-h) + env(safe-area-inset-bottom, 0px) + 28px);
  position: relative;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: calc(14px + env(safe-area-inset-top, 0px)) 18px 10px;
}

.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }

.brand-mark {
  width: 38px; height: 38px;
  display: grid; place-items: center;
  font-size: 20px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 13px;
  box-shadow: var(--shadow-sm);
  flex: 0 0 auto;
}

.brand-text { min-width: 0; }
.brand-text h1 {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -.4px;
  color: var(--brown);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.brand-text p {
  font-size: 11.5px;
  color: var(--muted);
  margin-top: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.data-badge {
  flex: 0 1 auto;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-size: 10px;
  line-height: 1.35;
  font-weight: 700;
  color: var(--terra-dark);
  background: var(--terra-soft);
  border: 1px solid var(--terra-line);
  border-radius: 999px;
  padding: 6px 10px;
  text-align: right;
}

/* ---------- 요약 대시보드 ---------- */
.dash {
  margin: 4px 14px 14px;
  background: linear-gradient(160deg, #FFF6EF 0%, #FCEEE3 58%, #F9E8DB 100%);
  border: 1px solid #F2DECF;
  border-radius: var(--r-xl);
  box-shadow: var(--shadow);
  padding: 14px 14px 12px;
  position: relative;
  overflow: hidden;
}
.dash::after {
  content: "";
  position: absolute;
  right: -36px; top: -46px;
  width: 120px; height: 120px;
  background: radial-gradient(circle, rgba(200, 90, 50, .10), rgba(200, 90, 50, 0) 70%);
  pointer-events: none;
}

.dash-top {
  display: grid;
  grid-template-columns: 1.15fr 1fr 1fr;
  gap: 8px;
}
.dash-cell { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.dash-label {
  font-size: 10.5px;
  font-weight: 700;
  color: #A98B77;
  letter-spacing: -.1px;
  white-space: nowrap;
}
.dash-value {
  font-size: 16.5px;
  font-weight: 800;
  letter-spacing: -.5px;
  color: var(--brown);
  white-space: nowrap;
}
.dash-value.terra { color: var(--terra-dark); font-size: 18px; }
.dash-value small { font-size: 11px; font-weight: 700; color: var(--muted); margin-left: 1px; }

.dash-divider {
  height: 1px;
  background: linear-gradient(90deg, rgba(200, 90, 50, .16), rgba(200, 90, 50, .04));
  margin: 11px 0 9px;
}

.dash-bottom {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.dash-mini { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.dash-mini span {
  font-size: 10px; font-weight: 700; color: #A98B77; white-space: nowrap;
}
.dash-mini b {
  font-size: 13px; font-weight: 800; color: var(--ink); letter-spacing: -.3px;
  white-space: nowrap;
}
.dash-mini em {
  font-style: normal;
  font-size: 9.5px;
  color: #B49C89;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---------- 탭 ---------- */
.tabbar {
  position: fixed;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: 100%;
  max-width: 520px;
  height: calc(var(--nav-h) + env(safe-area-inset-bottom, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  background: rgba(255, 253, 250, .94);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--line);
  z-index: 40;
}

.tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: #A8968475;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: -.2px;
  transition: color .15s;
}
.tab svg {
  width: 22px; height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.tab[aria-current="page"] { color: var(--terra); }
.tab[aria-current="page"] svg { stroke-width: 1.9; }

/* ---------- 뷰 공통 ---------- */
.view { padding: 0 14px 8px; animation: fade .18s ease-out; }
@keyframes fade { from { opacity: .4; transform: translateY(3px); } to { opacity: 1; transform: none; } }

.section-title {
  display: flex;
  align-items: baseline;
  gap: 6px;
  font-size: 13px;
  font-weight: 800;
  color: var(--brown);
  letter-spacing: -.3px;
  margin: 18px 2px 8px;
}
.section-title small { font-size: 11px; font-weight: 600; color: var(--muted); }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  padding: 14px;
}
.card + .card { margin-top: 10px; }
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}
.card-title {
  font-size: 13.5px;
  font-weight: 800;
  color: var(--brown);
  letter-spacing: -.3px;
}
.card-desc { font-size: 11.5px; color: var(--muted); margin-top: 2px; overflow-wrap: break-word; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 11px 15px;
  border-radius: 12px;
  font-size: 13.5px;
  font-weight: 800;
  letter-spacing: -.2px;
  background: var(--terra);
  color: #fff;
  box-shadow: 0 4px 12px rgba(200, 90, 50, .18);
}
.btn.block { width: 100%; }
.btn.ghost {
  background: #FFFDFB;
  color: var(--brown);
  border: 1px solid var(--line);
  box-shadow: none;
}
.btn.soft { background: var(--terra-soft); color: var(--terra-dark); box-shadow: none; }
.btn.small { padding: 8px 11px; font-size: 12px; border-radius: 10px; }
.btn.danger { background: #FBEDE9; color: #B4432A; box-shadow: none; }

.link-btn {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--terra);
  padding: 4px 2px;
}

/* ---------- 주간 바 ---------- */
.weekbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 2px 0 8px;
}
.weekbar-mid { text-align: center; flex: 1; min-width: 0; }
.weekbar-mid strong {
  display: block;
  font-size: 14.5px;
  font-weight: 800;
  color: var(--brown);
  letter-spacing: -.4px;
}
.weekbar-mid span { font-size: 10.5px; color: var(--muted); }
.nav-arrow {
  width: 34px; height: 34px;
  border-radius: 11px;
  border: 1px solid var(--line);
  background: #fff;
  display: grid; place-items: center;
  color: var(--brown);
  font-size: 16px;
  font-weight: 700;
  flex: 0 0 auto;
  box-shadow: var(--shadow-sm);
}
.nav-arrow:disabled { opacity: .35; }

/* ---------- 진행률 ---------- */
.progress-card {
  background: linear-gradient(150deg, #FFFFFF, #FEFAF6);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  padding: 13px 14px;
  margin-bottom: 12px;
}
.progress-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  font-size: 12.5px;
  color: var(--ink-2);
  font-weight: 600;
}
.progress-head b { font-size: 15px; font-weight: 800; color: var(--terra-dark); }
.progress-head .pct { font-size: 12px; font-weight: 800; color: var(--terra); }

.bar {
  height: 8px;
  border-radius: 999px;
  background: var(--cream-3);
  margin: 9px 0 9px;
  overflow: hidden;
}
.bar > i {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #E0916A, var(--terra));
  transition: width .35s ease;
}
.progress-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 11px;
  color: var(--muted);
}
.toggle-chip {
  font-size: 11px;
  font-weight: 700;
  color: var(--brown);
  background: var(--cream-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 10px;
}
.toggle-chip[aria-pressed="true"] { background: var(--terra-soft); border-color: var(--terra-line); color: var(--terra-dark); }
.progress-extra { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.progress-extra .toggle-chip { font-size: 10.5px; padding: 5px 9px; }

/* ---------- 요일 카드 ---------- */
.day-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  padding: 11px 12px 10px;
  margin-bottom: 10px;
}
.day-card.today {
  border-color: var(--terra-line);
  box-shadow: 0 8px 20px rgba(200, 90, 50, .10);
}
.day-head {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 1px 2px 8px;
}
.day-name { font-size: 12.5px; font-weight: 800; color: var(--ink); letter-spacing: -.2px; }
.day-name b { font-size: 13.5px; color: var(--brown); }
.today-badge {
  font-size: 9.5px;
  font-weight: 800;
  color: #fff;
  background: var(--terra);
  border-radius: 999px;
  padding: 3px 7px;
  letter-spacing: -.1px;
}
.day-count {
  margin-left: auto;
  font-size: 10.5px;
  font-weight: 700;
  color: var(--muted);
}
.day-count b { color: var(--terra); }

.slot {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 8px 4px;
  border-top: 1px solid var(--line-soft);
}
.slot:first-child { border-top: 0; }
.slot.late {
  margin-top: 2px;
  border-top: 1px dashed var(--line);
  background: linear-gradient(180deg, rgba(246, 236, 226, .35), rgba(246, 236, 226, 0));
  border-radius: 10px;
}

.check {
  flex: 0 0 auto;
  width: 24px; height: 24px;
  border-radius: 8px;
  border: 1.6px solid #DCCDBD;
  background: #fff;
  display: grid; place-items: center;
  color: transparent;
  font-size: 12px;
  font-weight: 900;
  margin-top: 1px;
  transition: background .15s, border-color .15s, color .15s;
}
.check.on {
  background: var(--ok);
  border-color: var(--ok);
  color: #fff;
}
.check.ghost { border-style: dashed; }

.slot-main {
  flex: 1;
  min-width: 0;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.slot-meta { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; }
.slot-label { font-size: 10px; font-weight: 800; color: var(--muted); letter-spacing: .2px; }
.tag {
  font-size: 9.5px;
  font-weight: 800;
  color: var(--brown);
  background: var(--cream-2);
  border-radius: 999px;
  padding: 2px 7px;
  letter-spacing: -.1px;
}
.tag.kids { background: #F5EFE2; color: #7A6B3E; }
.tag.adult { background: #F3E7EF; color: #7E4A66; }
.tag.family { background: var(--terra-soft); color: var(--terra-dark); }

.slot-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -.3px;
  line-height: 1.35;
  word-break: break-word;
  overflow-wrap: anywhere;
  text-align: left;
}
.slot.done .slot-title { color: #B3A293; text-decoration: line-through; text-decoration-thickness: 1px; }
.slot.done .slot-label { color: #C4B5A6; }

.kid-chips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 1px; }
.kid-chips em {
  font-style: normal;
  font-size: 10px;
  color: var(--ink-2);
  background: #FAF3EA;
  border: 1px solid #F2E6D8;
  border-radius: 7px;
  padding: 2px 6px;
  white-space: nowrap;
}
.kid-chips em.spicy { color: #B4432A; background: #FBEDE9; border-color: #F5DCD3; }

.pencil {
  flex: 0 0 auto;
  width: 28px; height: 28px;
  border-radius: 9px;
  color: #B9A593;
  display: grid; place-items: center;
  font-size: 13px;
}
.pencil:hover { background: var(--cream-2); }

.slot-empty .slot-title { color: #B9A593; font-weight: 700; }
.slot-empty .check { border-color: #E4D6C7; }

.week-empty {
  text-align: center;
  padding: 22px 14px;
  color: var(--muted);
  font-size: 12.5px;
  background: #fff;
  border: 1px dashed var(--line);
  border-radius: var(--r-lg);
}
.week-empty .btn { margin-top: 10px; }

/* ---------- 재고 ---------- */
.search-wrap {
  position: relative;
  margin-bottom: 9px;
}
.search-wrap input {
  padding-left: 36px;
  padding-right: 34px;
  background: #fff;
  border-radius: 13px;
  height: 44px;
  font-size: 14px;
}
.search-wrap .ico {
  position: absolute;
  left: 12px; top: 50%;
  transform: translateY(-50%);
  color: #BCA894;
  font-size: 14px;
}
.search-clear {
  position: absolute;
  right: 8px; top: 50%;
  transform: translateY(-50%);
  width: 26px; height: 26px;
  border-radius: 50%;
  color: #B9A593;
  background: var(--cream-2);
  font-size: 12px;
  display: grid; place-items: center;
}

.chips {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 2px 2px 8px;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: 0 0 auto;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--ink-2);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 11px;
  white-space: nowrap;
}
.chip b { font-weight: 800; color: var(--muted); margin-left: 3px; font-size: 10.5px; }
.chip[aria-pressed="true"] {
  background: var(--brown);
  border-color: var(--brown);
  color: #fff;
}
.chip[aria-pressed="true"] b { color: #EBD9C9; }

.inv-summary {
  font-size: 11px;
  color: var(--muted);
  padding: 2px 4px 9px;
  display: flex;
  flex-wrap: wrap;
  gap: 4px 8px;
}
.inv-summary b { color: var(--ink-2); font-weight: 800; }

.inv-card {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 10px 10px 10px 6px;
  margin-bottom: 7px;
  box-shadow: var(--shadow-sm);
}
.inv-card.used { background: #FCFAF7; }
.inv-card.used .inv-name { color: #A7968A; }

.star {
  flex: 0 0 auto;
  width: 30px; height: 30px;
  display: grid; place-items: center;
  font-size: 15px;
  color: #D8C7B6;
  border-radius: 9px;
}
.star.on { color: #E2A32A; }

.inv-main {
  flex: 1;
  min-width: 0;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.inv-name {
  font-size: 13.5px;
  font-weight: 800;
  color: var(--ink);
  letter-spacing: -.3px;
  display: flex;
  align-items: baseline;
  gap: 4px;
  flex-wrap: wrap;
  overflow-wrap: break-word;
  text-align: left;
}
.inv-name .spec { font-size: 10.5px; font-weight: 600; color: var(--muted); }
.inv-meta {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
  font-size: 10.5px;
  color: var(--muted);
}
.inv-price { font-weight: 800; color: var(--brown); font-size: 11.5px; }

.store-badge {
  font-size: 9.5px;
  font-weight: 800;
  border-radius: 6px;
  padding: 2px 5px;
  letter-spacing: -.1px;
  white-space: nowrap;
}
.store-badge.online { color: var(--terra-dark); background: var(--terra-soft); }
.store-badge.offline { color: #4E5B34; background: var(--offline-soft); }

.cat-pill {
  font-size: 9.5px;
  color: #A7968A;
  background: #FAF5EF;
  border-radius: 6px;
  padding: 2px 5px;
  white-space: nowrap;
}

.state-btn {
  flex: 0 0 auto;
  font-size: 11px;
  font-weight: 800;
  border-radius: 9px;
  padding: 7px 10px;
  border: 1px solid transparent;
  white-space: nowrap;
}
.state-btn.in_stock { color: #4C7A4E; background: var(--ok-soft); border-color: #D9E6D5; }
.state-btn.used_up { color: #9A7B66; background: #F6EFE7; border-color: #EDE2D6; }

.empty-note {
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  padding: 26px 10px;
}

.fab {
  position: fixed;
  right: max(16px, calc(50% - 245px));
  bottom: calc(var(--nav-h) + env(safe-area-inset-bottom, 0px) + 14px);
  height: 46px;
  padding: 0 18px 0 14px;
  border-radius: 999px;
  background: var(--terra);
  color: #fff;
  font-size: 13px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 8px 20px rgba(200, 90, 50, .28);
  z-index: 30;
}

/* ---------- 장볼 것 ---------- */
.shop-list { display: flex; flex-direction: column; }
.shop-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 9px 2px;
  border-bottom: 1px solid var(--line-soft);
}
.shop-item:last-child { border-bottom: 0; }
.shop-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.shop-name { font-size: 13.5px; font-weight: 700; color: var(--ink); letter-spacing: -.2px; overflow-wrap: break-word; }
.shop-item.checked .shop-name { color: #B3A293; text-decoration: line-through; }
.shop-memo { font-size: 10.5px; color: var(--muted); }
.src-tag {
  font-size: 9.5px;
  font-weight: 800;
  border-radius: 6px;
  padding: 2px 5px;
  background: #F5EFE2;
  color: #7A6B3E;
  white-space: nowrap;
}
.src-tag.meal { background: var(--terra-soft); color: var(--terra-dark); }
.src-tag.used { background: #F2E7E2; color: #97604A; }

.x-btn {
  flex: 0 0 auto;
  width: 26px; height: 26px;
  border-radius: 8px;
  color: #C4B3A1;
  display: grid; place-items: center;
  font-size: 13px;
}
.x-btn:hover { background: #F7EFE7; }

.add-row {
  position: sticky;
  bottom: calc(var(--nav-h) + env(safe-area-inset-bottom, 0px) + 8px);
  display: flex;
  gap: 7px;
  background: rgba(250, 246, 240, .96);
  backdrop-filter: blur(8px);
  padding: 9px 0 4px;
  margin-top: 8px;
  z-index: 20;
}
.add-row input { flex: 1; background: #fff; height: 44px; border-radius: 13px; }
.add-row .btn { flex: 0 0 auto; height: 44px; padding: 0 18px; border-radius: 13px; }

.more-btn {
  width: 100%;
  margin-top: 8px;
  padding: 9px;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--terra);
  background: #FFFBF7;
  border: 1px dashed var(--line);
  border-radius: 11px;
}

/* ---------- 가계부 ---------- */
.money-hero {
  background: linear-gradient(160deg, #FFF6EF, #FBEBDF);
  border: 1px solid #F2DECF;
  border-radius: var(--r-xl);
  padding: 15px;
  box-shadow: var(--shadow-sm);
}
.money-hero .label { font-size: 11px; font-weight: 700; color: #A98B77; }
.money-hero .big {
  font-size: 27px;
  font-weight: 800;
  letter-spacing: -1px;
  color: var(--terra-dark);
  margin: 2px 0 6px;
}
.split-row { display: flex; gap: 8px; flex-wrap: wrap; }
.split {
  flex: 1 1 0;
  min-width: 130px;
  background: rgba(255, 255, 255, .72);
  border: 1px solid rgba(240, 205, 187, .8);
  border-radius: 12px;
  padding: 9px 10px;
}
.split span { display: block; font-size: 10px; font-weight: 700; color: #A98B77; }
.split b { display: block; font-size: 14px; font-weight: 800; color: var(--brown); letter-spacing: -.3px; margin-top: 1px; }
.split em { display: block; font-style: normal; font-size: 9.5px; color: #B49C89; margin-top: 1px; }

.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.stat {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 11px 12px;
  box-shadow: var(--shadow-sm);
}
.stat span { font-size: 10.5px; font-weight: 700; color: var(--muted); }
.stat b { display: block; font-size: 16px; font-weight: 800; color: var(--ink); letter-spacing: -.4px; margin-top: 2px; }
.stat em { display: block; font-style: normal; font-size: 10px; color: var(--muted); margin-top: 2px; line-height: 1.4; }

.form-grid { display: grid; gap: 8px; }
.form-grid.two { grid-template-columns: 1fr 1fr; }
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field > label { font-size: 10.5px; font-weight: 700; color: var(--muted); padding-left: 2px; }
.field input, .field select { height: 42px; }

.form-foot { display: flex; gap: 7px; margin-top: 10px; }
.form-foot .btn { flex: 1; }

details.card > summary {
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  cursor: pointer;
}
details.card > summary::-webkit-details-marker { display: none; }
details.card > summary .card-title { margin: 0; }
details.card[open] > summary { margin-bottom: 11px; }
summary .chev { color: #C4B3A1; font-size: 12px; transition: transform .15s; }
details[open] summary .chev { transform: rotate(180deg); }

.receipt-preview { margin-top: 11px; border-top: 1px dashed var(--line); padding-top: 10px; }
.preview-head {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
  margin-bottom: 9px;
}
.preview-row {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 6px 2px;
  border-bottom: 1px solid var(--line-soft);
}
.preview-row input[type="text"] { flex: 1 1 auto; min-width: 0; height: 36px; font-size: 13px; }
.preview-row input.amt { flex: 0 0 92px; width: 92px; text-align: right; }
.preview-row .amt { width: 92px; flex: 0 0 auto; text-align: right; }
.preview-row .check { width: 22px; height: 22px; border-radius: 7px; }
.preview-total {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 800;
  color: var(--brown);
  padding: 9px 2px 4px;
}

.purchase-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 2px;
  border-bottom: 1px solid var(--line-soft);
}
.purchase-row:last-child { border-bottom: 0; }
.p-date { flex: 0 0 42px; font-size: 10.5px; color: var(--muted); font-weight: 700; }
.p-body { flex: 1; min-width: 0; }
.p-name { font-size: 12.5px; font-weight: 700; color: var(--ink); display: flex; gap: 4px; align-items: baseline; overflow-wrap: break-word; }
.p-name .spec { font-size: 10px; color: var(--muted); font-weight: 500; }
.p-meta { font-size: 10px; color: var(--muted); margin-top: 1px; }
.p-amt { font-size: 12.5px; font-weight: 800; color: var(--brown); flex: 0 0 auto; }

.data-actions { display: grid; gap: 7px; }
.data-actions .row { display: flex; gap: 7px; }
.data-actions .row .btn { flex: 1; }
.saved-note { font-size: 10.5px; color: var(--muted); margin-top: 9px; line-height: 1.5; }

/* ---------- 모달 ---------- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(59, 42, 32, .38);
  backdrop-filter: blur(2px);
  z-index: 60;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  animation: fade .16s ease-out;
}
.modal-sheet {
  width: 100%;
  max-width: 520px;
  max-height: 88vh;
  overflow-y: auto;
  background: var(--cream);
  border-radius: 22px 22px 0 0;
  padding: 8px 16px calc(20px + env(safe-area-inset-bottom, 0px));
  box-shadow: 0 -8px 30px rgba(59, 42, 32, .18);
  animation: sheet .22s cubic-bezier(.2, .8, .3, 1);
}
@keyframes sheet { from { transform: translateY(24px); opacity: .6; } to { transform: none; opacity: 1; } }

.sheet-grip {
  width: 38px; height: 4px;
  border-radius: 999px;
  background: #E2D3C3;
  margin: 6px auto 10px;
}
.sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.sheet-head h2 { font-size: 15px; font-weight: 800; color: var(--brown); letter-spacing: -.3px; }
.sheet-close { width: 30px; height: 30px; border-radius: 10px; color: #A89684; background: #F2E9DE; display: grid; place-items: center; font-size: 13px; }

.sheet-form { display: grid; gap: 9px; }
.sheet-actions { display: flex; gap: 7px; margin-top: 14px; }
.sheet-actions .btn { flex: 1; }
.sheet-actions .btn.grow-2 { flex: 2; }

.spicy-group { display: flex; gap: 6px; }
.spicy-group label {
  flex: 1;
  text-align: center;
  font-size: 12px;
  font-weight: 700;
  color: var(--ink-2);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 9px 4px;
  cursor: pointer;
}
.spicy-group input { position: absolute; opacity: 0; width: 0; height: 0; }
.spicy-group input:checked + span { color: var(--terra-dark); }
.spicy-group label:has(input:checked) { background: var(--terra-soft); border-color: var(--terra-line); color: var(--terra-dark); }

/* ---------- 토스트 ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--nav-h) + env(safe-area-inset-bottom, 0px) + 20px);
  transform: translate(-50%, 12px);
  max-width: 300px;
  background: rgba(59, 42, 32, .93);
  color: #fff;
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.45;
  padding: 10px 14px;
  border-radius: 12px;
  box-shadow: 0 10px 26px rgba(59, 42, 32, .25);
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s, transform .2s;
  z-index: 80;
  text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast button { color: #F6C9AE; text-decoration: underline; font-weight: 800; margin-left: 6px; }

/* ---------- 잠금 화면 ---------- */
.lock {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: calc(20px + env(safe-area-inset-top, 0px)) 20px calc(20px + env(safe-area-inset-bottom, 0px));
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  background:
    radial-gradient(120% 60% at 50% 0%, #FDF8F1 0%, rgba(250, 246, 240, 0) 60%),
    var(--cream);
}

.lock[hidden] { display: none; }

.lock-inner {
  width: 100%;
  max-width: 330px;
  margin: auto;
  text-align: center;
}

.lock-mark {
  font-size: 34px;
  line-height: 1;
}

.lock-title {
  margin: 10px 0 0;
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -.4px;
  color: var(--brown);
}

.lock-msg {
  min-height: 19px;
  margin: 7px 0 0;
  font-size: 12.5px;
  color: var(--muted);
}

.lock-msg.is-error {
  color: var(--terra-dark);
  font-weight: 700;
}

.lock-dots {
  display: flex;
  justify-content: center;
  gap: 14px;
  margin: 22px 0 24px;
}

.lock-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  border: 1.5px solid var(--terra-line);
  transition: background .16s ease, border-color .16s ease, transform .16s ease;
}

.lock-dot.on {
  background: var(--terra);
  border-color: var(--terra);
  transform: scale(1.08);
}

.lock-dots.shake { animation: lockShake .44s ease-in-out; }

@keyframes lockShake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-8px); }
  45% { transform: translateX(7px); }
  70% { transform: translateX(-4px); }
  88% { transform: translateX(2px); }
}

.keypad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 11px;
}

.key {
  display: grid;
  place-items: center;
  height: 56px;
  padding: 0;
  font-size: 22px;
  font-weight: 700;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow-sm);
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: transform .08s ease, background .15s ease;
}

.key:active {
  transform: scale(.96);
  background: var(--cream-2);
}

.key-del {
  font-size: 19px;
  color: var(--ink-2);
}

.keypad.busy {
  opacity: .5;
  pointer-events: none;
}

.subbar {
  display: flex;
  justify-content: flex-end;
  padding: 0 18px;
}

.lock-btn {
  flex: 0 0 auto;
  padding: 6px 11px;
  font-size: 11px;
  font-weight: 700;
  color: var(--ink-2);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 999px;
  box-shadow: var(--shadow-sm);
  white-space: nowrap;
  align-self: flex-start;
  margin-top: 2px;
}

.lock-btn[hidden] { display: none; }

/* ---------- 작은 화면 보정 ---------- */
@media (max-width: 359px) {
  .dash-top { grid-template-columns: 1fr 1fr; }
  .dash-value { font-size: 15px; }
  .money-hero .big { font-size: 24px; }
}

/* ---------- 넓은 화면 ---------- */
@media (min-width: 600px) {
  body { background: #F3EBE1; }
  .app {
    background: var(--cream);
    box-shadow: 0 0 60px rgba(124, 74, 45, .10);
    min-height: 100vh;
  }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
