/* ============================================================
   돈봉투 가계부 — 화면 스타일
   · 따뜻한 종이 바탕(#FAF8F3) 위에 흰 종이(#FFFFFF) 한 장.
   · 선은 1px 헤어라인, 그림자는 팝오버에만. 그라데이션 없음.
   · 포인트는 딥 슬레이트 그린 한 색. 넘친 금액만 벽돌색.
   · 숫자는 tabular-nums, 큰 금액은 크게·보조는 한 톤 낮게.
   · 외부 폰트·CDN 없음. 시스템 폰트와 인라인 SVG만 쓴다.
   ============================================================ */

:root {
  --paper: #faf8f3;
  --paper-2: #f2eee4;
  --surface: #ffffff;
  --ink: #201e1a;
  --ink-2: #4c483f;
  --ink-3: #7e776b;
  --ink-4: #a8a196;
  --line: #e7e1d4;
  --line-2: #f0ebdf;
  --line-strong: #d8d1c1;
  --accent: #2f4f4f;
  --accent-deep: #24403f;
  --accent-tint: #edf2f0;
  --over: #b2453a;
  --over-tint: #f9ecea;
  --warn: #9a6b2f;
  --warn-tint: #f8f1e3;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow-pop: 0 22px 48px -24px rgba(32, 30, 26, 0.35), 0 2px 6px rgba(32, 30, 26, 0.06);
  --shell: 920px;
  --header-h: 62px;
  --tabbar-h: 58px;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }

body {
  background: var(--paper);
  color: var(--ink);
  font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, 'Apple SD Gothic Neo', 'Noto Sans KR', 'Noto Sans CJK KR', 'Malgun Gothic', system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.6;
  letter-spacing: -0.012em;
  word-break: keep-all;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body.is-locked { overflow: hidden; }

h1, h2, h3, h4, p, ul, ol, figure, details { margin: 0; }
ul, ol { padding: 0; list-style: none; }
button { font: inherit; color: inherit; cursor: pointer; }
input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; }
img, svg { display: block; }

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

.icon { flex: none; }

.num, .tabular { font-variant-numeric: tabular-nums; font-feature-settings: 'tnum' 1; }
.neg { color: var(--over); }
.pos { color: var(--ink); }
.muted { color: var(--ink-3); }

/* ------------------------------------------------------------ 머리 */

.topbar {
  position: sticky; top: 0; z-index: 40;
  background: rgba(250, 248, 243, 0.94);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(8px);
}

.topbar__in {
  max-width: var(--shell);
  margin: 0 auto;
  height: var(--header-h);
  padding: 0 24px;
  display: flex;
  align-items: center;
  gap: 30px;
}

.brand { display: flex; align-items: center; gap: 8px; text-decoration: none; flex: none; }
.brand__mark { color: var(--accent); margin-top: -1px; }
.brand__name {
  font-family: 'Noto Serif CJK KR', 'Nanum Myeongjo', 'AppleMyungjo', Georgia, serif;
  font-size: 17px; font-weight: 600; letter-spacing: -0.01em; color: var(--ink);
}

.tabs { display: flex; align-items: center; gap: 1px; }
.tabs button {
  position: relative;
  border: 0; background: none;
  padding: 9px 12px 10px;
  font-size: 14px; font-weight: 500; color: var(--ink-3);
  border-radius: 8px;
  transition: color 0.14s ease;
}
.tabs button:hover { color: var(--ink); }
.tabs button.is-active { color: var(--ink); font-weight: 600; }
.tabs button.is-active::after {
  content: ''; position: absolute; left: 12px; right: 12px; bottom: 3px;
  height: 1.5px; background: var(--ink); border-radius: 2px;
}

.monthnav { margin-left: auto; display: flex; align-items: center; gap: 1px; flex: none; }
.monthnav__arrow {
  border: 0; background: none; width: 28px; height: 30px;
  display: grid; place-items: center; border-radius: 7px; color: var(--ink-3);
}
.monthnav__arrow:hover { background: var(--paper-2); color: var(--ink); }
.monthnav__center { position: relative; }
.monthnav__label {
  display: inline-flex; align-items: center; gap: 5px;
  border: 0; background: none; border-radius: 7px;
  padding: 5px 7px; font-size: 13.5px; font-weight: 500; color: var(--ink-2);
  font-variant-numeric: tabular-nums; letter-spacing: -0.01em;
}
.monthnav__label:hover { background: var(--paper-2); color: var(--ink); }
.monthnav__label svg { color: var(--ink-4); }
.monthnav__today {
  border: 0; background: none; color: var(--accent);
  font-size: 12px; font-weight: 500; padding: 5px 7px; border-radius: 6px;
}
.monthnav__today:hover { background: var(--accent-tint); }

.month-menu {
  position: absolute; top: calc(100% + 8px); left: 50%; transform: translateX(-50%);
  width: 216px; padding: 5px; z-index: 45;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: var(--shadow-pop);
}
.month-menu__item {
  display: flex; flex-direction: column; gap: 1px; width: 100%;
  padding: 8px 10px; border: 0; border-radius: 7px; background: none; text-align: left;
}
.month-menu__item span { font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; }
.month-menu__item em { font-style: normal; font-size: 11px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.month-menu__item:hover { background: var(--paper); }
.month-menu__item.is-active { background: var(--accent-tint); }
.month-menu__item.is-active span { color: var(--accent-deep); }

.main {
  max-width: var(--shell);
  margin: 0 auto;
  padding: 38px 24px 110px;
}

.view { animation: fade 0.18s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(3px); } to { opacity: 1; transform: none; } }

.tabbar { display: none; }

/* ------------------------------------------------------------ 공통 조각 */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px 26px;
}
.card + .card { margin-top: 16px; }

.card__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; }
.card__head > div { min-width: 0; }
.card__head .ghost-btn, .card__head .primary-btn { flex: none; white-space: nowrap; }
.card__head h2, .card__head h3 { font-size: 15.5px; font-weight: 600; letter-spacing: -0.02em; }
.card__head p { margin-top: 4px; color: var(--ink-3); font-size: 12.5px; line-height: 1.6; max-width: 560px; }

.page-lead {
  margin: 0 0 18px; color: var(--ink-3); font-size: 13px; line-height: 1.6;
}
.page-title { font-size: 23px; font-weight: 600; letter-spacing: -0.035em; margin-bottom: 5px; }
.page-title + .page-lead { margin-bottom: 18px; }
.page-lead b { color: var(--ink-2); font-weight: 600; }
.page-lead .count-pill { vertical-align: 1px; }

.primary-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 15px; border: 1px solid var(--ink); border-radius: 9px;
  background: var(--ink); color: #fff; font-size: 13px; font-weight: 500;
  letter-spacing: -0.01em;
  transition: background 0.14s ease, border-color 0.14s ease;
}
.primary-btn:hover { background: #35322b; border-color: #35322b; }
.primary-btn:active { transform: translateY(1px); }
.primary-btn:disabled { background: var(--paper-2); border-color: var(--line); color: var(--ink-4); cursor: not-allowed; }
.primary-btn--sm { padding: 7px 12px; font-size: 12.5px; border-radius: 8px; }

.ghost-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 13px; border: 1px solid var(--line-strong); border-radius: 9px;
  background: var(--surface); color: var(--ink-2); font-size: 12.5px; font-weight: 500;
  transition: background 0.14s ease, border-color 0.14s ease;
}
.ghost-btn:hover { background: var(--paper); border-color: #c7bfae; }
.ghost-btn--sm { padding: 6px 10px; font-size: 12px; border-radius: 7px; }

.danger-btn, .btn-danger {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 13px; border: 1px solid #edcfc9; border-radius: 9px;
  background: var(--surface); color: var(--over); font-size: 12.5px; font-weight: 500;
}
.danger-btn:hover, .btn-danger:hover { background: var(--over-tint); }
.btn-danger { background: var(--over); border-color: var(--over); color: #fff; }
.btn-danger:hover { background: #9d3a30; }

.btn-ok {
  display: inline-flex; padding: 9px 14px; border-radius: 9px; border: 1px solid var(--ink);
  background: var(--ink); color: #fff; font-size: 12.5px; font-weight: 500;
}

.icon-btn {
  display: inline-grid; place-items: center;
  width: 30px; height: 30px; border: 0; border-radius: 7px;
  background: none; color: var(--ink-4);
}
.icon-btn:hover { background: var(--paper-2); color: var(--ink-2); }

/* 배지·칩은 알약이 아니라 작은 글씨로만 쓴다 */
.chip, .badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 0; border-radius: 0; background: none;
  color: var(--ink-4); font-size: 11px; font-weight: 500; letter-spacing: 0;
  white-space: nowrap; font-variant-numeric: tabular-nums;
}
.chip--up { color: var(--over); }
.chip--auto, .chip--learn, .chip--manual { color: var(--ink-3); }
.chip--un { color: var(--warn); }
.chip--dup, .chip--warn, .chip--fixed { color: var(--ink-4); }
.badge--ok, .badge--idle, .badge--warn, .badge--over { color: var(--ink-4); }
.chip + .chip::before { content: '·'; margin-right: 4px; color: var(--line-strong); }

.dot { width: 8px; height: 8px; border-radius: 3px; background: var(--dot, #cfc8b9); flex: none; display: inline-block; }
.dot-inline { width: 7px; height: 7px; border-radius: 2px; background: var(--dot, #cfc8b9); display: inline-block; flex: none; }

.count-pill {
  display: inline-grid; place-items: center; min-width: 20px; height: 19px; padding: 0 6px;
  border-radius: 999px; background: var(--paper-2); color: var(--ink-3);
  font-size: 11px; font-weight: 600; font-variant-numeric: tabular-nums;
}

.segmented { display: inline-flex; padding: 2px; border-radius: 8px; background: var(--paper-2); }
.segmented button { border: 0; background: none; padding: 4px 10px; border-radius: 6px; font-size: 12px; font-weight: 500; color: var(--ink-3); }
.segmented button.is-active { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(32, 30, 26, 0.08); }

.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field > span { font-size: 11.5px; font-weight: 500; color: var(--ink-3); }
.field input, .field select {
  height: 38px; padding: 0 10px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--surface); font-size: 13.5px; min-width: 0;
}
.field input::placeholder { color: var(--ink-4); }
.field input:focus, .field select:focus, .paste:focus, .search:focus-within,
.money-field input:focus, .kw-add input:focus, .rule-test__form input:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(47, 79, 79, 0.1);
}
.field--wide { grid-column: span 2; }

.select {
  height: 32px; padding: 0 7px; border: 1px solid var(--line); border-radius: 7px;
  background: var(--surface); font-size: 12.5px; max-width: 100%; color: var(--ink-2);
}
.select--cat { width: 100%; min-width: 84px; }

.money-field { position: relative; display: flex; align-items: center; }
.money-field input {
  width: 100%; height: 32px; padding: 0 22px 0 9px; text-align: right;
  border: 1px solid var(--line); border-radius: 7px; background: var(--surface);
  font-size: 13px; font-variant-numeric: tabular-nums; font-weight: 500;
}
.money-field span { position: absolute; right: 8px; font-size: 11px; color: var(--ink-4); pointer-events: none; }
.money-field--lg input { height: 46px; font-size: 19px; padding-right: 30px; letter-spacing: -0.02em; }
.money-field--lg span { font-size: 12px; right: 12px; }

.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 13px 0; border-bottom: 1px solid var(--line-2); }
.switch-row:last-of-type { border-bottom: 0; }
.switch-row__text { display: flex; flex-direction: column; gap: 2px; }
.switch-row__text strong { font-size: 13.5px; font-weight: 500; }
.switch-row__text small { color: var(--ink-3); font-size: 11.5px; }
.switch { position: relative; flex: none; }
.switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.switch__track { display: block; width: 38px; height: 22px; border-radius: 999px; background: #ddd6c8; transition: background 0.18s ease; pointer-events: none; }
.switch__thumb { position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(32, 30, 26, 0.18); transition: transform 0.18s ease; pointer-events: none; }
.switch input:checked + .switch__track { background: var(--accent); }
.switch input:checked + .switch__track .switch__thumb { transform: translateX(16px); }
.switch input:focus-visible + .switch__track { outline: 2px solid rgba(47, 79, 79, 0.3); outline-offset: 2px; }

.empty { padding: 40px 16px; text-align: center; color: var(--ink-3); }
.empty__icon { width: 40px; height: 40px; margin: 0 auto 10px; border-radius: 10px; display: grid; place-items: center; background: var(--paper); color: var(--ink-3); }
.empty h3 { color: var(--ink); font-size: 14px; font-weight: 600; margin-bottom: 5px; letter-spacing: -0.02em; }
.empty p { font-size: 12.5px; max-width: 400px; margin: 0 auto 14px; line-height: 1.6; }

/* ------------------------------------------------------------ 이번 달 */

.month { display: flex; flex-direction: column; }

.balance {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 30px;
  padding: 4px 2px 20px;
}
.balance__text { min-width: 0; }
.balance__label { font-size: 13px; color: var(--ink-3); }
.balance__amount {
  margin-top: 7px;
  font-size: 46px; font-weight: 600; letter-spacing: -0.05em; line-height: 1.02;
  font-variant-numeric: tabular-nums;
}
.balance__amount span { font-size: 21px; font-weight: 500; color: var(--ink-3); margin-left: 4px; letter-spacing: 0; }
.balance__sub { margin-top: 9px; font-size: 13px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.balance__gauge {
  margin-top: 15px; width: min(420px, 100%); height: 4px; border-radius: 2px;
  background: var(--paper-2); overflow: hidden;
}
.balance__gauge i { display: block; height: 100%; border-radius: 2px; background: var(--accent); transition: width 0.4s ease; }
.balance.is-over .balance__amount { color: var(--over); }
.balance.is-over .balance__gauge i { background: var(--over); }

.who { display: flex; flex: none; padding: 3px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); margin-top: 4px; }
.who button {
  border: 0; background: none; padding: 6px 12px; border-radius: 6px;
  font-size: 12.5px; font-weight: 500; color: var(--ink-3); white-space: nowrap;
}
.who button:hover { color: var(--ink); }
.who button.is-on { background: var(--ink); color: #fff; font-weight: 600; }

.tidy { margin: -2px 0 30px; padding: 0 2px; font-size: 13px; }
.tidy button {
  border: 0; background: none; padding: 0 0 1px; color: var(--accent);
  font-size: 13px; font-weight: 500;
  border-bottom: 1px solid rgba(47, 79, 79, 0.28);
}
.tidy button:hover { border-bottom-color: var(--accent); }

.sheet {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 26px 14px;
}

.bhead {
  display: grid; grid-template-columns: minmax(0, 1fr) 112px 112px; gap: 12px;
  padding: 2px 2px 9px; border-bottom: 1px solid var(--line-2);
  font-size: 11.5px; color: var(--ink-4);
}
.bhead span:nth-child(2), .bhead span:nth-child(3) { text-align: right; }

.brow {
  display: grid; grid-template-columns: minmax(0, 1fr) 112px 112px; gap: 12px;
  width: 100%; padding: 13px 2px 8px;
  border: 0; background: none; text-align: left; border-radius: 8px;
  transition: background 0.12s ease;
}
.brow:hover { background: var(--paper); }
.brow__name { font-size: 14.5px; font-weight: 500; letter-spacing: -0.015em; align-self: center; }
.brow__spent { text-align: right; font-size: 14px; color: var(--ink-2); font-variant-numeric: tabular-nums; align-self: center; }
.brow__left { text-align: right; font-size: 14px; color: var(--ink); font-variant-numeric: tabular-nums; align-self: center; }
.brow__left.is-neg { color: var(--over); }
.brow__bar {
  grid-column: 1 / -1; height: 3px; border-radius: 2px; margin-top: 7px;
  background: var(--line-2); overflow: hidden;
}
.brow__bar i { display: block; height: 100%; border-radius: 2px; background: #cec6b6; }
.brow.is-over .brow__bar i { background: var(--over); }

.sheet__foot {
  display: flex; align-items: baseline; justify-content: space-between; gap: 14px;
  margin-top: 6px; padding: 11px 2px 4px; border-top: 1px solid var(--line-2);
  font-size: 12px; color: var(--ink-3); font-variant-numeric: tabular-nums;
}
.sheet__foot b { color: var(--ink-2); font-weight: 600; }

.panels {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 40px; margin-top: 44px;
}
.panel { min-width: 0; }
.panel__head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.panel__head h2 { font-size: 15px; font-weight: 600; letter-spacing: -0.02em; }
.panel__meta { font-size: 12px; color: var(--ink-4); }
.panel__note { font-size: 12.5px; color: var(--ink-3); line-height: 1.6; margin: -2px 0 8px; }

.moves li {
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
  padding: 8px 0; border-bottom: 1px solid var(--line-2);
  font-size: 13.5px;
}
.moves b { font-variant-numeric: tabular-nums; font-weight: 600; }
.moves .up { color: var(--over); }
.moves .down { color: var(--ink-2); }
.moves .move-label { color: var(--ink-4); font-size: 11.5px; margin-left: 6px; }
.panel .warn-line { margin-top: 10px; font-size: 12px; color: var(--warn); }
.panel .btn-row { margin-top: 16px; }
.panel .quiet { font-size: 13px; color: var(--ink-3); padding: 4px 0 6px; }

.recent li {
  display: grid; grid-template-columns: 42px minmax(0, 1fr) auto; gap: 10px; align-items: baseline;
  padding: 8px 0; border-bottom: 1px solid var(--line-2); font-size: 13.5px;
}
.recent__date { color: var(--ink-4); font-size: 11.5px; font-variant-numeric: tabular-nums; }
.recent li.recent__empty { display: block; padding: 10px 0; border-bottom: 1px solid var(--line-2); font-size: 12.5px; color: var(--ink-3); }
.recent__merchant { overflow-wrap: anywhere; color: var(--ink-2); }
.recent__amount { font-variant-numeric: tabular-nums; color: var(--ink-2); text-align: right; }
.recent__amount.neg { color: var(--over); }
.linkbtn { border: 0; background: none; padding: 12px 0 0; font-size: 12.5px; color: var(--ink-3); }
.linkbtn:hover { color: var(--ink); }

.coach { margin-top: 44px; border-top: 1px solid var(--line); padding-top: 16px; }
.coach > summary {
  list-style: none; cursor: pointer; display: flex; align-items: center; gap: 9px;
  font-size: 13.5px; color: var(--ink-2); font-weight: 500;
}
.coach > summary::-webkit-details-marker { display: none; }
.coach > summary::before { content: '+'; width: 13px; font-size: 15px; color: var(--ink-4); font-weight: 400; }
.coach[open] > summary::before { content: '−'; }
.coach > summary em { font-style: normal; font-size: 12px; color: var(--ink-4); }
.coach__note { font-size: 12.5px; color: var(--ink-3); margin: 10px 0 2px; }
.coach__list { margin-top: 4px; }
.pick {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 12px; align-items: center;
  width: 100%; padding: 11px 2px; border: 0; border-bottom: 1px solid var(--line-2);
  background: none; text-align: left;
}
.pick:hover { background: var(--paper); }
.pick__mark {
  width: 15px; height: 15px; border-radius: 50%; border: 1px solid var(--ink-4);
  display: grid; place-items: center; color: #fff; flex: none;
}
.pick.is-on .pick__mark { background: var(--accent); border-color: var(--accent); }
.pick__body { min-width: 0; }
.pick__top { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.pick__name { font-size: 13.5px; font-weight: 500; }
.pick__meta { font-size: 11.5px; color: var(--ink-4); font-variant-numeric: tabular-nums; }
.pick__tip { display: block; margin-top: 2px; font-size: 12px; color: var(--ink-3); line-height: 1.55; }
.pick__est { font-size: 12.5px; color: var(--ink-2); font-variant-numeric: tabular-nums; white-space: nowrap; }
.coach__picked { padding: 12px 2px 2px; font-size: 12.5px; color: var(--ink-2); }
.coach__picked b { font-weight: 600; }
.coach__empty { font-size: 12.5px; color: var(--ink-3); padding: 10px 2px 2px; }

/* ------------------------------------------------------------ 가져오기 */

.import__grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.import-box { display: flex; flex-direction: column; gap: 12px; }
.import-box__badge { font-size: 11.5px; color: var(--ink-4); white-space: nowrap; }
.paste {
  width: 100%; min-height: 196px; resize: vertical;
  padding: 14px 15px; border: 1px dashed var(--line-strong); border-radius: 11px;
  background: var(--paper); font-family: ui-monospace, SFMono-Regular, 'Menlo', 'Consolas', monospace;
  font-size: 12px; line-height: 1.8; color: var(--ink-2); white-space: pre;
}
.paste::placeholder { color: var(--ink-4); }
.import__actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.import__actions .primary-btn { margin-left: auto; }
.file-btn {
  position: relative; display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 13px; border: 1px solid var(--line-strong); border-radius: 9px;
  background: var(--surface); font-size: 12.5px; font-weight: 500; color: var(--ink-2); cursor: pointer;
}
.file-btn:hover { background: var(--paper); }
.file-btn input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }
.privacy {
  display: flex; gap: 7px; font-size: 11.5px; color: var(--ink-3); line-height: 1.65;
  padding-top: 11px; border-top: 1px solid var(--line-2);
}
.privacy .icon { margin-top: 2px; color: var(--ink-4); }

.import-guide { display: flex; flex-direction: column; gap: 13px; }
.rule-line { font-size: 12.5px; color: var(--ink-3); line-height: 1.7; }
.rule-line b { color: var(--ink-2); font-weight: 500; }
.import-examples h4 { font-size: 11.5px; color: var(--ink-4); font-weight: 500; margin-bottom: 7px; }
.import-examples ul { display: flex; flex-direction: column; gap: 7px; }
.import-examples li { font-size: 12px; color: var(--ink-3); line-height: 1.6; overflow-wrap: anywhere; }
.import-examples code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11px; background: var(--paper); padding: 1px 5px; border-radius: 4px; color: var(--ink-2); }
.import-examples em { font-style: normal; color: var(--ink-4); }
.sms-note { display: flex; gap: 8px; font-size: 12px; color: var(--ink-3); line-height: 1.65; }
.sms-note .icon { margin-top: 2px; color: var(--accent); flex: none; }
.sms-note b { color: var(--ink-2); font-weight: 500; }

.preview { margin-top: 18px; scroll-margin-top: 84px; }
.preview .table-wrap { margin-top: 10px; }
.table-wrap { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.table th { text-align: left; font-size: 11px; font-weight: 500; color: var(--ink-4); padding: 7px 9px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 10px 9px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: var(--paper); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table tfoot td { border-top: 1px solid var(--line); border-bottom: 0; font-weight: 500; padding-top: 11px; }

.pv-table th:nth-child(1) { width: 34px; }
.pv-table th:nth-child(2) { width: 62px; }
.pv-table th:nth-child(4) { width: 84px; }
.pv-table th:nth-child(5) { width: 92px; }
.pv-table th:nth-child(6) { width: 122px; }
.pv-check input { width: 15px; height: 15px; accent-color: var(--accent); }
.pv-date { color: var(--ink-4); font-variant-numeric: tabular-nums; white-space: nowrap; }
.pv-merchant { min-width: 0; }
.pv-merchant__name { display: block; font-weight: 500; color: var(--ink); overflow-wrap: anywhere; }
.pv-merchant__meta { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 2px; }
.pv-method { color: var(--ink-3); font-size: 11.5px; white-space: nowrap; }
.pv-amount { text-align: right; font-variant-numeric: tabular-nums; font-weight: 500; white-space: nowrap; }
.pv-row.is-duplicate { opacity: 0.45; }
.preview__skipped { margin-top: 9px; font-size: 11.5px; color: var(--ink-4); }
.preview__foot { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line-2); }
.preview__sum { font-size: 13px; }
.preview__sum b { font-weight: 600; font-variant-numeric: tabular-nums; }
.preview__hint { display: block; font-size: 11px; color: var(--ink-4); margin-top: 2px; }

/* ------------------------------------------------------------ 내역 */

.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 4px; }
.search {
  position: relative; display: flex; align-items: center; gap: 6px; flex: 1 1 200px; min-width: 160px;
  height: 32px; padding: 0 10px; border: 1px solid var(--line); border-radius: 8px;
  color: var(--ink-4); background: var(--surface);
}
.search input { border: 0; outline: none; background: none; width: 100%; font-size: 12.5px; color: var(--ink); }
.search input::placeholder { color: var(--ink-4); }
.toolbar .primary-btn--sm { margin-left: auto; }

.ledger-table th:nth-child(1) { width: 76px; }
.ledger-table th:nth-child(3) { width: 106px; }
.ledger-table th:nth-child(4) { width: 84px; }
.ledger-table th:nth-child(5) { width: 132px; }
.ledger-table th:nth-child(6) { width: 40px; }
.tx-date { color: var(--ink-4); font-variant-numeric: tabular-nums; white-space: nowrap; }
.tx-date__year { display: block; font-size: 9.5px; color: var(--ink-4); }
.tx-merchant { min-width: 0; }
.tx-merchant__name { display: block; font-weight: 500; color: var(--ink); overflow-wrap: anywhere; }
.tx-merchant__line { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.tx-owner {
  display: inline-flex; align-items: center; padding: 0; border-radius: 0;
  background: none; color: var(--ink-4); font-size: 10.5px; font-weight: 500; white-space: nowrap;
}
.tx-owner::before { content: '·'; margin-right: 4px; color: var(--line-strong); }
.tx-owner--spouse { color: var(--ink-4); }
.tx-merchant__memo { display: block; font-size: 11px; color: var(--ink-3); margin-top: 1px; overflow-wrap: anywhere; }
.tx-method { color: var(--ink-3); font-size: 11.5px; white-space: nowrap; }
.tx-cat { display: flex; align-items: center; gap: 5px; }
.tx-cat .select { flex: 1; min-width: 0; }
.tx-del { text-align: right; }
tr.is-unmatched .tx-merchant__name::after {
  content: '미분류'; margin-left: 6px; padding: 0; color: var(--warn); font-size: 10px; font-weight: 500; vertical-align: 1px;
}
.add-form { margin: 14px 0 16px; padding: 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--paper); }
.add-form__grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; }
.add-form__actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 12px; }

/* ------------------------------------------------------------ 미분류 */

.um-list { display: flex; flex-direction: column; margin-top: 6px; }
.um { padding: 14px 0; border-bottom: 1px solid var(--line-2); }
.um:last-child { border-bottom: 0; }
.um__top { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.um__who { min-width: 0; }
.um__merchant { display: block; font-size: 13.5px; font-weight: 500; overflow-wrap: anywhere; }
.um__meta { display: block; margin-top: 2px; font-size: 11.5px; color: var(--ink-4); }
.um__amount { font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.um__cats { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.cat-chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 5px 10px; border: 1px solid var(--line); border-radius: 999px;
  background: var(--surface); font-size: 11.5px; font-weight: 500; color: var(--ink-2);
  transition: border-color 0.12s ease, background 0.12s ease, color 0.12s ease;
}
.cat-chip:hover { border-color: var(--accent); background: var(--accent-tint); color: var(--accent-deep); }
.um__note { display: flex; gap: 7px; margin-top: 16px; font-size: 11.5px; color: var(--ink-3); line-height: 1.65; }
.um__note .icon { margin-top: 1px; color: var(--ink-4); }

/* ------------------------------------------------------------ 설정 */

.subnav { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 20px; }
.subnav button {
  position: relative; border: 0; background: none;
  padding: 8px 4px 11px; margin-right: 22px;
  font-size: 13px; font-weight: 500; color: var(--ink-3);
}
.subnav button:hover { color: var(--ink-2); }
.subnav button.is-active { color: var(--ink); font-weight: 600; }
.subnav button.is-active::after {
  content: ''; position: absolute; left: 0; right: 0; bottom: -1px; height: 1.5px; background: var(--ink); border-radius: 2px 2px 0 0;
}

.settings > .card + .card { margin-top: 16px; }
.budget-table th:nth-child(1) { width: 30%; }
.budget-table th:nth-child(2) { width: 22%; }
.budget-table th:nth-child(3), .budget-table th:nth-child(4) { width: 14%; }
.budget-table th:nth-child(5) { width: 108px; }
.bt__name { display: flex; align-items: center; gap: 8px; font-weight: 500; }
.bt__input { min-width: 120px; }
.budget-table th.num { text-align: right; }
.budget-table .money-field { max-width: 180px; margin-left: auto; }
.budget-table td.num { font-variant-numeric: tabular-nums; }
.bt__carry .mini-switch { display: inline-flex; align-items: center; gap: 7px; font-size: 11.5px; color: var(--ink-3); cursor: pointer; }
.mini-switch input { width: 14px; height: 14px; accent-color: var(--accent); }
.budget__summary { display: flex; flex-wrap: wrap; gap: 16px; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line-2); font-size: 12px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.budget__summary b { color: var(--ink); font-weight: 600; }
.settings-note h4 { display: flex; align-items: center; gap: 7px; font-size: 12.5px; font-weight: 500; margin-bottom: 8px; color: var(--ink-2); }
.settings-note ul { display: flex; flex-direction: column; gap: 6px; }
.settings-note li { position: relative; padding-left: 12px; font-size: 12px; color: var(--ink-3); line-height: 1.65; }
.settings-note li::before { content: ''; position: absolute; left: 2px; top: 8px; width: 3px; height: 3px; border-radius: 50%; background: var(--ink-4); }
.settings-note b { color: var(--ink-2); font-weight: 500; }

.rules__grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(248px, 1fr)); gap: 10px; margin-top: 14px; }
.rule-card { padding: 13px 14px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface); }
.rule-card header { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.rule-card h4 { display: flex; align-items: center; gap: 7px; font-size: 12.5px; font-weight: 500; }
.rule-card h4 .rule-card__pri { font-size: 10px; color: var(--ink-4); font-weight: 400; }
.rule-card__count { font-size: 10.5px; color: var(--ink-4); }
.chips { display: flex; flex-wrap: wrap; gap: 4px; margin: 9px 0; }
.kw { display: inline-flex; align-items: center; gap: 1px; padding: 1px 3px 1px 6px; border-radius: 5px; background: var(--paper); font-size: 10.5px; color: var(--ink-2); }
.kw__del { border: 0; background: none; color: var(--ink-4); font-size: 11px; line-height: 1; padding: 1px 3px; border-radius: 3px; }
.kw__del:hover { background: var(--over-tint); color: var(--over); }
.rule-card__ex { font-size: 10.5px; color: var(--ink-4); display: flex; flex-wrap: wrap; gap: 4px; align-items: center; margin-bottom: 8px; }
.rule-card__ex b { color: var(--warn); font-weight: 500; }
.rule-card__ex span { background: var(--warn-tint); color: var(--warn); padding: 1px 6px; border-radius: 4px; }
.kw-add { display: flex; gap: 6px; }
.kw-add input { flex: 1; min-width: 0; height: 29px; padding: 0 9px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); font-size: 12px; }

.rule-test__form { display: flex; gap: 8px; margin-top: 12px; }
.rule-test__form input { flex: 1; min-width: 0; height: 37px; padding: 0 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); font-size: 13px; }
.rule-test__result { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 11px; padding: 11px 13px; border-radius: 8px; font-size: 12.5px; }
.rule-test__result.is-hit { background: var(--accent-tint); color: var(--accent-deep); }
.rule-test__result.is-miss { background: var(--warn-tint); color: var(--warn); }
.rule-test__result span { color: var(--ink-2); }

.learned__list { display: flex; flex-direction: column; margin-top: 8px; }
.learned__list li { display: flex; align-items: center; gap: 9px; padding: 10px 0; border-bottom: 1px solid var(--line-2); font-size: 12.5px; }
.learned__list li:last-child { border-bottom: 0; }
.learned__merchant { font-weight: 500; overflow-wrap: anywhere; }
.learned__arrow { color: var(--ink-4); }
.learned__cat { display: inline-flex; align-items: center; gap: 5px; color: var(--ink-2); }
.learned__list .icon-btn { margin-left: auto; width: 26px; height: 26px; }

.data__stats { display: flex; flex-wrap: wrap; gap: 20px; margin: 14px 0; }
.data__stats li { display: flex; flex-direction: column; gap: 1px; font-size: 11px; color: var(--ink-4); }
.data__stats b { font-size: 12.5px; color: var(--ink); font-weight: 500; font-variant-numeric: tabular-nums; }
.data__actions { display: flex; flex-wrap: wrap; gap: 8px; }
.data__warn { margin-top: 10px; font-size: 11px; }

.share__banner {
  display: flex; align-items: center; gap: 9px; flex-wrap: wrap;
  padding: 12px 14px; border-radius: 9px; background: var(--paper);
  font-size: 12.5px; color: var(--ink-2);
}
.share__banner .icon { color: var(--ink-4); }
.share__banner .chip { color: var(--ink-4); }
.member-list { display: flex; flex-direction: column; margin-top: 12px; }
.member {
  display: grid; grid-template-columns: minmax(0, 1fr) 100px 92px auto;
  align-items: center; gap: 14px; padding: 13px 2px; border-top: 1px solid var(--line-2);
}
.member:first-child { border-top: 0; }
.member__who { display: flex; align-items: center; gap: 10px; min-width: 0; }
.member__avatar { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--paper-2); font-size: 11px; font-weight: 600; color: var(--ink-2); }
.member__who strong { display: block; font-size: 13px; font-weight: 500; }
.member__who em { font-style: normal; font-size: 11px; color: var(--ink-4); }
.member__num { text-align: right; font-size: 13px; font-weight: 500; font-variant-numeric: tabular-nums; }
.member__num span { display: block; font-size: 10.5px; color: var(--ink-4); font-weight: 400; }
.share__foot { margin-top: 14px; padding-top: 13px; border-top: 1px solid var(--line-2); display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.share__foot p { font-size: 11.5px; color: var(--ink-3); max-width: 460px; line-height: 1.6; }

/* ------------------------------------------------------------ 모달 */

.modal-backdrop {
  position: fixed; inset: 0; z-index: 100;
  display: grid; place-items: center;
  padding: 20px;
  background: rgba(32, 30, 26, 0.4);
  animation: fade 0.14s ease;
}
.modal {
  width: 100%; max-width: 420px; max-height: 90vh; overflow-y: auto;
  background: var(--surface); border-radius: 16px; padding: 22px;
  box-shadow: var(--shadow-pop);
  animation: pop 0.16s cubic-bezier(0.2, 0.9, 0.3, 1.1);
}
@keyframes pop { from { opacity: 0; transform: translateY(6px) scale(0.99); } to { opacity: 1; transform: none; } }
.modal__head { margin-bottom: 16px; }
.modal__eyebrow { font-size: 11.5px; color: var(--ink-4); }
.modal__head h3 { display: flex; align-items: center; gap: 8px; font-size: 17px; font-weight: 600; margin: 3px 0; letter-spacing: -0.03em; }
.modal__head p { font-size: 12px; color: var(--ink-3); }
.modal__form { display: flex; flex-direction: column; gap: 14px; }
.modal__stats { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.modal__stats li { display: flex; flex-direction: column; gap: 1px; padding: 9px 11px; border-radius: 8px; background: var(--paper); font-size: 11px; color: var(--ink-3); }
.modal__stats b { font-size: 12.5px; font-variant-numeric: tabular-nums; font-weight: 500; }
.modal__foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }
.modal__body h3 { font-size: 16px; font-weight: 600; margin-bottom: 8px; letter-spacing: -0.02em; }
.modal__body p { font-size: 13px; color: var(--ink-2); line-height: 1.65; }
.modal__body b { color: var(--ink); font-weight: 600; }

/* ------------------------------------------------------------ 토스트 */

.toast-wrap { position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 15px; border-radius: 9px;
  background: var(--ink); color: #fff; font-size: 12.5px; font-weight: 500;
  box-shadow: var(--shadow-pop);
  animation: toastIn 0.2s cubic-bezier(0.2, 0.9, 0.3, 1.15);
}
.toast--error { background: #7b2c25; }
.toast.is-out { opacity: 0; transform: translateY(6px); transition: opacity 0.3s ease, transform 0.3s ease; }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.noscript { padding: 24px; text-align: center; }

/* ============================================================
   반응형 — 980 / 760 / 430
   ============================================================ */

@media (max-width: 980px) {
  .main { padding: 30px 20px calc(var(--tabbar-h) + 48px); }
  .topbar__in { padding: 0 20px; gap: 18px; }
  .tabs button { padding: 9px 9px 10px; }
  .tabs button.is-active::after { left: 9px; right: 9px; }
  .import__grid { perspective: none; }
}

@media (max-width: 820px) {
  .import__grid { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 760px) {
  body { font-size: 14.5px; }
  .topbar__in { height: 56px; padding: 0 16px; }
  .brand__name { font-size: 16px; }
  .tabs { display: none; }
  .monthnav { gap: 0; }
  .monthnav__arrow { width: 26px; }
  .main { padding: 22px 16px calc(var(--tabbar-h) + 40px); }

  .tabbar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
    display: grid; grid-template-columns: repeat(4, 1fr);
    background: rgba(255, 255, 255, 0.97); backdrop-filter: blur(10px);
    border-top: 1px solid var(--line);
    padding: 5px 6px calc(5px + env(safe-area-inset-bottom, 0px));
  }
  .tabbar__item {
    position: relative; display: flex; flex-direction: column; align-items: center; gap: 3px;
    border: 0; background: none; padding: 4px 2px; border-radius: 8px;
    color: var(--ink-4); font-size: 10.5px; font-weight: 500;
  }
  .tabbar__item.is-active { color: var(--ink); }
  .tabbar__item.is-active .icon { color: var(--accent); }
  .toast-wrap { bottom: calc(var(--tabbar-h) + 14px); }

  .card { padding: 18px 16px; border-radius: 14px; }
  .card__head { gap: 12px; }
  .card__head h2, .card__head h3 { font-size: 14.5px; }
  .card__head p { font-size: 12px; }

  .balance { flex-direction: column; align-items: stretch; gap: 14px; padding: 2px 2px 18px; }
  .balance__amount { font-size: 36px; }
  .balance__amount span { font-size: 17px; }
  .balance__sub { font-size: 12px; }
  .balance__gauge { margin-top: 12px; }
  .who { align-self: flex-start; margin-top: 0; }
  .who button { padding: 6px 14px; }

  .tidy { margin-bottom: 22px; font-size: 12.5px; }

  .sheet { padding: 14px 16px 8px; border-radius: 14px; }
  .bhead { grid-template-columns: minmax(0, 1fr) 82px 82px; gap: 8px; font-size: 11px; }
  .brow { grid-template-columns: minmax(0, 1fr) 82px 82px; gap: 8px; padding: 12px 2px 7px; }
  .brow__name { font-size: 13.5px; }
  .brow__spent, .brow__left { font-size: 13px; }
  .sheet__foot { font-size: 11px; flex-wrap: wrap; gap: 4px; }

  .panels { grid-template-columns: minmax(0, 1fr); gap: 32px; margin-top: 34px; }

  .coach { margin-top: 34px; }

  .page-lead { font-size: 12.5px; margin-bottom: 14px; }
  .page-title { font-size: 20px; }
  .primary-btn { padding: 9px 14px; font-size: 12.5px; }
  .ghost-btn { padding: 8px 12px; }

  .import__actions { justify-content: flex-start; }
  .import__actions .primary-btn { margin-left: 0; flex: 1 1 100%; }
  .paste { min-height: 150px; font-size: 11.5px; padding: 12px 13px; }
  .preview__foot { flex-direction: column; align-items: stretch; gap: 10px; }
  .preview__foot .primary-btn { width: 100%; }

  .toolbar { gap: 6px; }
  .search { flex-basis: 100%; order: -1; }
  .toolbar .select { flex: 1 1 30%; min-width: 0; padding: 0 4px; }
  .toolbar .segmented { flex: 1 1 46%; }
  .toolbar .primary-btn--sm { margin-left: 0; flex: 1 1 46%; }
  .add-form { padding: 14px; }
  .add-form__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .field--wide { grid-column: span 2; }

  .um { padding: 13px 0; }
  .cat-chip { padding: 5px 9px; font-size: 11px; }

  .subnav { overflow-x: auto; margin-bottom: 16px; }
  .subnav button { margin-right: 18px; white-space: nowrap; }

  .table-wrap { overflow-x: visible; }
  .ledger-table, .ledger-table tbody, .ledger-table tr, .ledger-table td { display: block; width: 100%; }
  .ledger-table thead { display: none; }
  .ledger-table tr {
    position: relative; display: grid; grid-template-columns: minmax(0, 1fr) auto;
    align-items: end; column-gap: 10px; row-gap: 1px;
    padding: 12px 0; border-bottom: 1px solid var(--line-2);
  }
  .ledger-table tr:last-child { border-bottom: 0; }
  .ledger-table td { padding: 0; border: 0; }
  .ledger-table .tx-merchant__line { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
  .ledger-table .tx-cat { display: flex; align-items: center; gap: 6px; }
  .ledger-table .tx-cat .dot-inline { display: none; }
  .tx-date { grid-column: 1; grid-row: 1; font-size: 10.5px; color: var(--ink-4); }
  .tx-date__year { display: none; }
  .ledger-table td.num { grid-column: 2; grid-row: 1; text-align: right; font-size: 14px; font-weight: 600; letter-spacing: -0.02em; }
  .tx-merchant { grid-column: 1; grid-row: 2; min-width: 0; }
  .tx-merchant__name { font-size: 13.5px; }
  .tx-merchant__memo { font-size: 10.5px; }
  .tx-method { grid-column: 1; grid-row: 3; font-size: 10.5px; color: var(--ink-4); }
  .tx-cat { grid-column: 1; grid-row: 4; margin-top: 6px; }
  .tx-cat .select { width: auto; min-width: 104px; height: 31px; font-size: 12px; }
  .tx-del { grid-column: 2; grid-row: 4; align-self: center; text-align: right; }
  .tx-del .icon-btn { width: 30px; height: 30px; }

  .pv-table, .pv-table thead { display: block; }
  .pv-table thead { display: none; }
  .pv-table tbody, .pv-table tr { display: block; width: 100%; }
  .pv-table tr {
    position: relative; display: grid; grid-template-columns: minmax(0, 1fr) auto;
    column-gap: 10px; row-gap: 2px; padding: 12px 0 12px 26px; border-bottom: 1px solid var(--line-2);
  }
  .pv-table td { display: block; padding: 0; border: 0; min-width: 0; }
  .pv-check { position: absolute; left: 0; top: 14px; }
  .pv-check input { width: 17px; height: 17px; }
  .pv-date { grid-column: 1; grid-row: 1; font-size: 10.5px; }
  .pv-merchant { grid-column: 1; grid-row: 2; }
  .pv-merchant__name { font-size: 13.5px; }
  .pv-merchant__meta { display: flex; margin-top: 4px; }
  .pv-method { grid-column: 1; grid-row: 3; font-size: 10.5px; }
  .pv-amount { grid-column: 2; grid-row: 1; text-align: right; font-size: 14px; font-weight: 600; }
  .pv-cat { grid-column: 1 / span 2; grid-row: 4; margin-top: 8px; }
  .pv-cat .select { width: 100%; height: 33px; }

  .budget-table, .budget-table tbody, .budget-table tfoot, .budget-table tr, .budget-table td { display: block; width: 100%; }
  .budget-table thead { display: none; }
  .budget-table tr {
    display: grid; grid-template-columns: minmax(0, 1fr) 128px; align-items: center;
    gap: 2px 10px; padding: 10px 0; border-bottom: 1px solid var(--line-2);
  }
  .budget-table td { padding: 0; border: 0; }
  .budget-table .bt__name { display: flex; align-items: center; gap: 8px; }
  .budget-table td:nth-child(3) { display: none; }
  .budget-table td:nth-child(5) { grid-column: 2; grid-row: 2; justify-self: end; }
  .budget-table td:nth-child(5) .mini-switch span { font-size: 10.5px; }
  .bt__name { grid-column: 1; grid-row: 1; font-size: 12.5px; }
  .bt__input { grid-column: 2; grid-row: 1; min-width: 0; }
  .bt__input .money-field { max-width: none; }
  .budget-table td:nth-child(4) { grid-column: 1 / span 2; grid-row: 2; text-align: left; font-size: 11px; color: var(--ink-3); }
  .budget-table td:nth-child(4)::before { content: '사용가능 '; }
  .budget-table td:nth-child(4)::after { content: '원'; }
  .budget-table tfoot tr { border-bottom: 0; border-top: 1px solid var(--line); padding-top: 12px; }
  .budget-table tfoot td:nth-child(1) { font-weight: 600; }
  .budget__summary { gap: 10px; font-size: 11px; }

  .rules__grid { grid-template-columns: minmax(0, 1fr); }
  .learned__list li { flex-wrap: wrap; }

  .member { grid-template-columns: minmax(0, 1fr) 76px auto; gap: 10px; }
  .member__num:nth-of-type(2) { display: none; }

  .modal { padding: 18px; border-radius: 14px; }
}

@media (max-width: 430px) {
  .balance__amount { font-size: 33px; }
  .balance__amount span { font-size: 16px; }
  .bhead { grid-template-columns: minmax(0, 1fr) 76px 76px; }
  .brow { grid-template-columns: minmax(0, 1fr) 76px 76px; }
  .brow__spent, .brow__left { font-size: 12.5px; }
  .brand__name { font-size: 15.5px; }
  .monthnav__label { font-size: 13px; padding: 5px 5px; }
  .monthnav__today { display: none; }
  .card { padding: 16px 14px; }
  .sheet { padding: 12px 14px 6px; }
  .member__avatar { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}
