:root {
  --bg: #f5f1ea;
  --bg-card: #fbf8f2;
  --bg-soft: #efe9dd;
  --ink: #1a1a1a;
  --ink-soft: #595550;
  --ink-muted: #9a958e;
  --line: #e0d9cc;
  --line-soft: #ebe5d8;
  --accent: #b8341a;
  --accent-soft: #d4a89b;
  --accent-bg: #f5e3dd;
  --green: #2d5f3f;
  --green-soft: #5a8a6f;
  --green-bg: #e4ede4;
  --gold: #b8902a;
  --navy: #1e4a8c;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 1px 0 rgba(0,0,0,0.04), 0 8px 24px -12px rgba(0,0,0,0.08);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-top: env(safe-area-inset-top, 0px);
  --font: 'Pretendard Variable', Pretendard, -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; overflow: hidden; -webkit-text-size-adjust: 100%; -webkit-font-smoothing: antialiased; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.55;
  letter-spacing: -0.01em;
  background-image:
    radial-gradient(circle at 20% 10%, rgba(184, 52, 26, 0.04) 0%, transparent 40%),
    radial-gradient(circle at 80% 80%, rgba(45, 95, 63, 0.03) 0%, transparent 40%);
  overscroll-behavior: none;
  touch-action: manipulation;
}

.app {
  height: 100vh;
  height: 100dvh;
  max-width: 480px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  position: relative;
  background: var(--bg);
}

/* HEADER */
header {
  padding: calc(var(--safe-top) + 18px) 22px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--bg-card);
  flex-shrink: 0;
  position: relative;
}
header::after {
  content: '';
  position: absolute; bottom: -1px; left: 50%; transform: translateX(-50%);
  width: 36px; height: 2px; background: var(--accent);
}
.h-label { font-size: 9px; letter-spacing: 0.28em; color: var(--ink-muted); text-transform: uppercase; margin-bottom: 6px; text-align: center; font-weight: 500; }
.h-title { font-size: 22px; font-weight: 800; letter-spacing: -0.025em; text-align: center; margin-bottom: 2px; }
.h-title .x { color: var(--accent); font-weight: 400; margin: 0 4px; }
.h-sub { font-size: 11px; color: var(--ink-muted); text-align: center; }

/* MAIN */
main {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 18px 16px calc(var(--safe-bottom) + 92px);
  overscroll-behavior: contain;
}
main::-webkit-scrollbar { display: none; }
.section { margin-bottom: 18px; }
.fade-in { animation: fadeIn 0.32s ease-out; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px);} to { opacity: 1; transform: translateY(0);} }

/* CARD */
.card { background: var(--bg-card); border: 1px solid var(--line); border-radius: 14px; padding: 20px; box-shadow: var(--shadow-md); }
.card-title {
  font-size: 16px; font-weight: 700;
  letter-spacing: -0.015em;
  margin-bottom: 14px;
  display: flex; align-items: center; gap: 8px;
}
.card-title::before { content: ''; width: 18px; height: 1px; background: var(--accent); }
.card-title .right { margin-left: auto; }
.card-title .reorder-toggle { margin-left: auto; }

.label { font-size: 9px; letter-spacing: 0.22em; color: var(--ink-muted); text-transform: uppercase; margin-bottom: 6px; font-weight: 500; }

/* MONEY */
.amount-xl { font-size: 30px; font-weight: 800; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; line-height: 1.15; }
.amount-xl .unit { font-size: 16px; font-weight: 400; color: var(--ink-soft); margin-left: 4px; }
.amount-md { font-size: 14px; font-weight: 500; font-variant-numeric: tabular-nums; }
.mono { font-variant-numeric: tabular-nums; }

/* INPUT */
.input, select, textarea {
  width: 100%; background: #fff; border: 1px solid var(--line);
  border-radius: 8px; padding: 11px 12px;
  font-family: var(--font); font-size: 16px; color: var(--ink);
  outline: none; transition: border-color 0.15s, box-shadow 0.15s;
  -webkit-appearance: none; appearance: none;
}
.input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-bg); }
.input-money { text-align: right; font-variant-numeric: tabular-nums; padding-right: 32px; }
.input-wrap { position: relative; }
.input-wrap .suffix { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); font-size: 13px; color: var(--ink-muted); pointer-events: none; }
select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%239a958e' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; padding-right: 32px;
}
input[type="date"] { -webkit-appearance: none; min-height: 42px; }
label.field { display: block; font-size: 12px; color: var(--ink-soft); margin-bottom: 5px; font-weight: 500; }

/* BUTTON */
.btn {
  -webkit-appearance: none; appearance: none;
  border: none; background: none;
  font-family: var(--font); cursor: pointer;
  padding: 11px 16px; border-radius: 8px;
  font-size: 14px; font-weight: 500;
  transition: background 0.15s, transform 0.05s;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 42px;
}
.btn:active { transform: scale(0.98); }
.btn-primary { background: var(--ink); color: var(--bg-card); }
.btn-primary:active { background: var(--accent); }
.btn-secondary { background: var(--bg-soft); color: var(--ink); border: 1px solid var(--line); }
.btn-block { width: 100%; }
.btn-dashed {
  width: 100%; background: transparent;
  border: 1px dashed var(--accent-soft); color: var(--accent);
  border-radius: 8px; padding: 10px;
  font-size: 13px; font-family: inherit; cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 4px;
  min-height: 42px;
}
.btn-dashed:active { background: var(--accent-bg); }
.icon-btn {
  width: 32px; height: 32px;
  border: none; background: var(--bg-soft);
  border-radius: 6px; color: var(--ink-muted); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  transition: background 0.15s, color 0.15s;
  -webkit-appearance: none; appearance: none; flex-shrink: 0;
}
.icon-btn:active { background: var(--line); color: var(--accent); }
.icon-btn.sm { width: 26px; height: 26px; }
.icon-btn.ghost { background: transparent; }
.text-link {
  background: none; border: none; cursor: pointer;
  font-family: inherit; font-size: 12px; color: var(--accent);
  font-weight: 500; padding: 4px 8px; border-radius: 6px;
  -webkit-appearance: none; appearance: none;
}
.text-link:active { background: var(--accent-bg); }

/* PROGRESS */
.prog-row { margin-bottom: 14px; }
.prog-row:last-child { margin-bottom: 0; }
.prog-head { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 6px; gap: 8px; }
.prog-head .lbl { color: var(--ink); font-weight: 500; }
.prog-head .nums { color: var(--ink-muted); font-variant-numeric: tabular-nums; font-size: 12px; white-space: nowrap; }
.prog-head .nums .spent { color: var(--ink); font-weight: 600; }
.prog-head .nums .spent.over { color: var(--accent); font-weight: 700; }
.prog-track { width: 100%; height: 6px; background: var(--bg-soft); border-radius: 100px; overflow: hidden; }
.prog-fill { height: 100%; background: var(--green); border-radius: 100px; transition: width 0.4s ease; }
.prog-fill.over { background: var(--accent); }
.prog-foot { font-size: 11px; color: var(--ink-muted); text-align: right; margin-top: 4px; font-variant-numeric: tabular-nums; }
.prog-foot.over { color: var(--accent); font-weight: 600; }

/* NAV */
nav.bottom-nav {
  position: absolute; left: 0; right: 0; bottom: 0;
  background: var(--bg-card); border-top: 1px solid var(--line);
  display: flex; padding: 8px 4px calc(var(--safe-bottom) + 8px);
  z-index: 10; box-shadow: 0 -8px 24px -12px rgba(0,0,0,0.08);
}
.nav-btn {
  flex: 1; background: none; border: none; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 8px 4px; color: var(--ink-muted);
  font-family: inherit; font-size: 10px; font-weight: 500;
  transition: color 0.15s; min-height: 48px;
  -webkit-appearance: none; appearance: none;
}
.nav-btn.active { color: var(--accent); }
.nav-btn svg { width: 20px; height: 20px; }

/* HELPERS */
.flex { display: flex; }
.items-center { align-items: center; }
.items-baseline { align-items: baseline; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.text-sm { font-size: 13px; }
.text-xs { font-size: 11px; }
.muted { color: var(--ink-muted); }
.soft { color: var(--ink-soft); }
.divider-soft { border-top: 1px solid var(--line-soft); padding-top: 12px; margin-top: 12px; }
.mt-1 { margin-top: 4px; } .mt-2 { margin-top: 8px; } .mt-3 { margin-top: 12px; } .mt-4 { margin-top: 16px; }
.mb-1 { margin-bottom: 4px; } .mb-2 { margin-bottom: 8px; } .mb-3 { margin-bottom: 12px; } .mb-4 { margin-bottom: 16px; }
.w-full { width: 100%; }
.flex-1 { flex: 1; min-width: 0; }
.tag {
  display: inline-block; padding: 2px 8px;
  background: var(--bg-soft); color: var(--ink-soft);
  font-size: 10px; font-weight: 500; border-radius: 4px;
  letter-spacing: 0.04em; border: 1px solid var(--line-soft);
  white-space: nowrap;
}
.tag.person { background: var(--accent-bg); color: var(--accent); border-color: var(--accent-soft); }

/* HERO */
.hero {
  background: linear-gradient(135deg, #fbf8f2 0%, #f5e3dd 100%);
  border: 1px solid var(--line); border-radius: 16px;
  padding: 22px; position: relative; overflow: hidden;
}
.hero::before {
  content: ''; position: absolute;
  top: -40px; right: -40px; width: 140px; height: 140px;
  background: radial-gradient(circle, rgba(184, 52, 26, 0.08) 0%, transparent 70%);
  pointer-events: none;
}
.hero.green { background: linear-gradient(135deg, #fbf8f2 0%, #e4ede4 100%); }
.hero.green::before { background: radial-gradient(circle, rgba(45, 95, 63, 0.10) 0%, transparent 70%); }

/* ALERT */
.alert {
  background: var(--accent-bg); border: 1px solid var(--accent-soft);
  border-radius: 10px; padding: 12px 14px;
  display: flex; gap: 10px; align-items: flex-start;
  font-size: 12px; color: var(--accent); line-height: 1.5;
}
.alert svg { flex-shrink: 0; margin-top: 1px; }
.alert strong { font-weight: 700; }

/* COMPARE BANNER (홈 전월 비교) */
.compare {
  font-size: 12px; color: var(--ink-soft);
  margin-top: 14px; padding-top: 14px;
  border-top: 1px solid var(--line-soft);
  display: flex; align-items: center; gap: 6px; line-height: 1.5;
}
.compare strong { font-weight: 700; }
.compare.save strong { color: var(--green); }
.compare.over strong { color: var(--accent); }

/* ROWS */
.row { padding: 11px 0; border-bottom: 1px solid var(--line-soft); }
.row:last-child { border-bottom: none; }
.bar-track { flex: 1; height: 5px; background: var(--bg-soft); border-radius: 100px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 100px; }
.bar-fill.income { background: var(--navy); }
.bar-fill.expense { background: var(--accent); }
.bar-w-lbl { width: 28px; font-size: 11px; color: var(--ink-muted); }
.bar-w-num { width: 48px; text-align: right; font-size: 11px; }

/* QUICK ITEMS (자주 쓰는 항목) */
.q-grid { display: flex; gap: 8px; flex-wrap: wrap; }
.q-chip {
  background: var(--bg-soft); border: 1px solid var(--line);
  border-radius: 100px; padding: 9px 14px;
  font-family: inherit; font-size: 13px; cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px;
  -webkit-appearance: none; appearance: none;
  transition: background 0.15s, transform 0.05s, border-color 0.15s;
  white-space: nowrap; color: var(--ink);
}
.q-chip:active { transform: scale(0.96); background: var(--accent-bg); border-color: var(--accent-soft); }
.q-chip .q-amt { color: var(--ink-muted); font-variant-numeric: tabular-nums; font-size: 12px; }
.q-chip.add {
  background: transparent; border: 1px dashed var(--accent-soft);
  color: var(--accent);
}
.q-chip.add:active { background: var(--accent-bg); }
.q-chip .q-x {
  margin-left: 4px; background: var(--accent); color: white;
  border-radius: 50%; width: 16px; height: 16px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 10px; border: none; flex-shrink: 0; cursor: pointer;
  font-family: inherit;
}

/* INCOME CHIPS (비고정 수입 출처) */
:root { --money-pos: #2d5f3f; --money-pos-bg: #e4ede4; --money-pos-soft: #b8d3bf; }
.q-chip.income {
  background: var(--money-pos-bg); border-color: var(--money-pos-soft); color: var(--money-pos);
}
.q-chip.income:active { background: #d3e3d3; }
.q-chip.add.income { background: transparent; border-style: dashed; color: var(--money-pos); border-color: var(--money-pos-soft); }

/* PAYMENT METHOD CHIPS */
.pay-grid { display: flex; gap: 6px; flex-wrap: wrap; }
.pay-chip {
  background: var(--bg-soft); border: 1px solid var(--line);
  border-radius: 8px; padding: 8px 12px;
  font-family: inherit; font-size: 12px; cursor: pointer;
  -webkit-appearance: none; appearance: none;
  transition: background 0.15s, transform 0.05s, border-color 0.15s, color 0.15s;
  white-space: nowrap; color: var(--ink-muted); font-weight: 500;
}
.pay-chip:active { transform: scale(0.96); }
.pay-chip.active {
  background: var(--accent); color: #fff; border-color: var(--accent); font-weight: 700;
}

/* TAGS - income/payment */
.tag.income-tag { background: var(--money-pos-bg); color: var(--money-pos); border-color: var(--money-pos-soft); }
.tag.pay-tag { background: var(--bg-soft); color: var(--ink-muted); border-color: var(--line); font-size: 10.5px; }
.income-amt { color: var(--money-pos); }

/* Card transaction link badge */
.link-badge {
  display: inline-block; margin-left: 6px;
  background: var(--money-pos-bg); color: var(--money-pos);
  border: 1px solid var(--money-pos-soft);
  font-size: 9.5px; font-weight: 600;
  padding: 1px 5px; border-radius: 4px;
  vertical-align: middle;
}

/* Hero / report 비고정 수입 행 */
.extra-income-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 12px; margin-top: 10px;
  background: var(--money-pos-bg); border-radius: 8px;
  border: 1px solid var(--money-pos-soft);
  font-size: 13px; color: var(--money-pos);
}
.extra-income-row strong { font-variant-numeric: tabular-nums; font-size: 14px; }

/* SEARCH */
.search-wrap { position: relative; }
.search-input {
  padding-right: 36px !important;
  background: var(--bg-soft) !important;
  font-size: 13px !important;
}
.search-clear {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  background: var(--ink-muted); color: #fff;
  border: none; border-radius: 50%;
  width: 22px; height: 22px;
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer; font-family: inherit;
  -webkit-appearance: none; appearance: none;
}
.search-clear:active { transform: translateY(-50%) scale(0.92); }

/* CALENDAR */
.cal-grid {
  display: grid; grid-template-columns: repeat(7, 1fr);
  gap: 3px; margin-top: 4px;
}
.cal-weekday {
  text-align: center; font-size: 11px; font-weight: 700;
  color: var(--ink-muted); padding: 6px 0 4px;
}
.cal-weekday.sun { color: var(--accent); }
.cal-weekday.sat { color: var(--navy); }
.cal-cell {
  position: relative;
  background: var(--bg-soft); border: 1px solid transparent;
  border-radius: 8px; padding: 6px 4px 4px;
  font-family: inherit; cursor: pointer;
  -webkit-appearance: none; appearance: none;
  display: flex; flex-direction: column; align-items: stretch;
  min-height: 56px; text-align: left;
  transition: background 0.12s, border-color 0.12s, transform 0.05s;
}
.cal-cell.empty { background: transparent; cursor: default; pointer-events: none; }
.cal-cell:not(.empty):active { transform: scale(0.96); }
.cal-cell .cal-day {
  font-size: 12px; font-weight: 600; color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.cal-cell.sun .cal-day { color: var(--accent); }
.cal-cell.sat .cal-day { color: var(--navy); }
.cal-cell .cal-exp {
  margin-top: auto;
  font-size: 10px; font-weight: 600;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
  white-space: nowrap; overflow: hidden; text-overflow: clip;
}
.cal-cell .cal-inc-dot {
  position: absolute; top: 5px; right: 5px;
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--money-pos);
}
.cal-cell.today { background: var(--accent-bg); border-color: var(--accent-soft); }
.cal-cell.today .cal-day { color: var(--accent); font-weight: 800; }
.cal-cell.selected {
  background: var(--ink); border-color: var(--ink);
}
.cal-cell.selected .cal-day { color: #fff; }
.cal-cell.selected .cal-exp { color: #ffb3a5; }
.cal-cell.selected.today { background: var(--accent); border-color: var(--accent); }
.cal-cell.selected.today .cal-day { color: #fff; }

.cal-summary {
  display: flex; justify-content: space-around; align-items: center;
  margin-top: 14px; padding: 12px 8px;
  background: var(--bg-soft); border-radius: 10px;
  flex-wrap: wrap; gap: 8px;
}
.cal-summary > div {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
}
.cal-summary .lbl { font-size: 10.5px; color: var(--ink-muted); font-weight: 500; }
.cal-summary .v {
  font-size: 13px; font-weight: 700;
  font-variant-numeric: tabular-nums;
}

/* RECURRING EXPENSES */
.rec-card {
  background: var(--bg-soft); border: 1px solid var(--line);
  border-radius: 10px; padding: 12px; margin-bottom: 8px;
}
.rec-card.paused { opacity: 0.6; }
.rec-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.rec-left { flex: 1; min-width: 0; }
.rec-name { font-size: 14px; font-weight: 700; color: var(--ink); margin-bottom: 3px; }
.rec-meta { font-size: 11px; color: var(--ink-muted); }
.rec-amt {
  font-size: 14px; font-weight: 800; color: var(--accent);
  font-variant-numeric: tabular-nums; white-space: nowrap;
}
.rec-bottom {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--line-soft);
}
.rec-next { font-size: 11px; color: var(--ink-muted); font-weight: 500; }
.rec-actions { display: flex; gap: 10px; }
.rec-actions .text-link.danger { color: var(--accent); }

/* DAY-OF-WEEK PICKER */
.dow-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.dow-btn {
  background: var(--bg-soft); border: 1px solid var(--line);
  border-radius: 6px; padding: 8px 0;
  font-family: inherit; font-size: 12px; font-weight: 600;
  cursor: pointer; color: var(--ink-muted);
  -webkit-appearance: none; appearance: none;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
}
.dow-btn.active {
  background: var(--accent); color: #fff; border-color: var(--accent);
}
.dow-btn:active { transform: scale(0.94); }

/* SETTINGS PAGE */
.settings-header {
  display: flex; align-items: center; gap: 10px;
  padding: 4px 0;
}
.back-btn {
  background: none; border: none; cursor: pointer;
  font-family: inherit; font-size: 13px; color: var(--ink-muted);
  display: inline-flex; align-items: center; gap: 4px;
  padding: 6px 8px;
  -webkit-appearance: none; appearance: none;
}
.back-btn:active { color: var(--accent); }
.settings-title {
  font-size: 20px; font-weight: 800; letter-spacing: -0.02em;
  color: var(--ink); margin: 0;
}

.settings-tab-grid { display: flex; flex-wrap: wrap; gap: 6px; }
.settings-tab-chip {
  background: var(--bg-soft); border: 1px solid var(--line);
  border-radius: 100px; padding: 8px 14px;
  font-family: inherit; font-size: 13px; cursor: pointer;
  -webkit-appearance: none; appearance: none;
  font-weight: 500; color: var(--ink-muted);
  transition: background 0.12s, color 0.12s, border-color 0.12s;
}
.settings-tab-chip.active {
  background: var(--accent); color: #fff; border-color: var(--accent); font-weight: 700;
}
.settings-tab-chip:active { transform: scale(0.96); }

/* COLOR PICKER ROW */
.color-row {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 0; border-bottom: 1px solid var(--line-soft);
}
.color-row:last-child { border-bottom: none; }
.color-swatch {
  width: 22px; height: 22px; border-radius: 6px;
  border: 1px solid var(--line); flex-shrink: 0;
}
.color-label { flex: 1; font-size: 13px; font-weight: 500; }
.color-input {
  width: 38px; height: 28px; padding: 0;
  border: 1px solid var(--line); border-radius: 6px;
  cursor: pointer; background: none;
}

/* SETTINGS ACTION BUTTONS */
.settings-action {
  display: flex; align-items: center; gap: 12px;
  width: 100%; background: var(--bg-soft); border: 1px solid var(--line);
  border-radius: 10px; padding: 12px 14px; margin-bottom: 8px;
  cursor: pointer; font-family: inherit; text-align: left;
  -webkit-appearance: none; appearance: none;
  transition: background 0.12s;
}
.settings-action:active { background: var(--accent-bg); }
.settings-action.danger { border-color: var(--accent-soft); }
.settings-action.danger:active { background: var(--accent-bg); }
.settings-action-icon { font-size: 22px; flex-shrink: 0; }
.settings-action-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.settings-action-title { font-size: 14px; font-weight: 700; color: var(--ink); }
.settings-action.danger .settings-action-title { color: var(--accent); }
.settings-action-desc { font-size: 11.5px; color: var(--ink-muted); }
.settings-action-arrow { color: var(--ink-muted); font-size: 22px; line-height: 1; }

/* INFO ROWS */
.info-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 0; border-bottom: 1px solid var(--line-soft);
  font-size: 13px;
}
.info-row:last-child { border-bottom: none; }
.info-row .lbl { color: var(--ink-muted); }
.info-row .v { font-weight: 700; color: var(--ink); }

/* CHILDREN */
.child-card {
  display: flex; align-items: flex-start; gap: 12px;
  background: var(--bg-soft); border: 1px solid var(--line);
  border-radius: 10px; padding: 12px; margin-bottom: 8px;
}
.child-emoji { font-size: 28px; flex-shrink: 0; line-height: 1; }
.child-info { flex: 1; min-width: 0; }
.child-name { font-size: 14px; font-weight: 700; color: var(--ink); margin-bottom: 3px; }
.child-meta { font-size: 11.5px; color: var(--ink-muted); margin-bottom: 4px; }
.child-account {
  font-size: 11.5px; color: var(--money-pos); font-weight: 600;
  background: var(--money-pos-bg); padding: 3px 8px; border-radius: 4px;
  display: inline-block; margin-top: 2px;
}
.child-notes { font-size: 11.5px; color: var(--ink-soft); margin-top: 4px; }
.child-actions {
  display: flex; flex-direction: column; gap: 4px;
  align-items: flex-end; flex-shrink: 0;
}
.child-actions .text-link.danger { color: var(--accent); }

/* PERSON TOGGLE */
.person-tg { display: flex; background: var(--bg-soft); border: 1px solid var(--line); border-radius: 8px; padding: 3px; }
.person-tg button {
  flex: 1; background: none; border: none; padding: 9px;
  font-family: inherit; font-size: 12px; color: var(--ink-muted);
  border-radius: 6px; cursor: pointer; font-weight: 500;
  transition: background 0.15s, color 0.15s;
  -webkit-appearance: none; appearance: none;
}
.person-tg button.active { background: var(--bg-card); color: var(--ink); font-weight: 700; box-shadow: var(--shadow-sm); }

/* GOAL CARD */
.goal {
  background: var(--bg-card); border: 1px solid var(--line);
  border-radius: 14px; padding: 18px; position: relative;
  margin-bottom: 12px; box-shadow: var(--shadow-md);
}
.goal:last-child { margin-bottom: 0; }
.goal-top { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 14px; gap: 8px; }
.goal-name { font-size: 15px; font-weight: 700; letter-spacing: -0.015em; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dday { font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 100px; letter-spacing: 0.02em; white-space: nowrap; font-variant-numeric: tabular-nums; }
.dday.future { background: var(--accent-bg); color: var(--accent); }
.dday.past { background: var(--bg-soft); color: var(--ink-muted); }
.dday.done { background: var(--green-bg); color: var(--green); }
.goal-amts { display: flex; align-items: baseline; gap: 6px; margin-bottom: 10px; font-variant-numeric: tabular-nums; flex-wrap: wrap; }
.goal-cur { font-size: 22px; font-weight: 800; letter-spacing: -0.02em; color: var(--accent); }
.goal.done .goal-cur { color: var(--green); }
.goal-tgt { font-size: 13px; color: var(--ink-muted); }
.goal-bar { height: 8px; background: var(--bg-soft); border-radius: 100px; overflow: hidden; margin-bottom: 10px; }
.goal-bar-fill { height: 100%; background: linear-gradient(90deg, var(--accent) 0%, var(--accent-soft) 100%); border-radius: 100px; transition: width 0.6s ease; }
.goal.done .goal-bar-fill { background: linear-gradient(90deg, var(--green) 0%, var(--green-soft) 100%); }
.goal-foot { font-size: 11px; color: var(--ink-muted); display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.goal-foot .pct { font-variant-numeric: tabular-nums; font-weight: 700; color: var(--ink-soft); }
.goal-foot .actions { display: flex; gap: 4px; }

/* SEGMENTED */
.segmented { display: flex; background: var(--bg-soft); border: 1px solid var(--line); border-radius: 8px; padding: 3px; }
.segmented button {
  flex: 1; background: none; border: none;
  font-family: inherit; font-size: 13px; font-weight: 500;
  color: var(--ink-muted); padding: 9px;
  cursor: pointer; border-radius: 6px;
  transition: background 0.15s, color 0.15s;
  -webkit-appearance: none; appearance: none;
}
.segmented button.active { background: var(--bg-card); color: var(--ink); box-shadow: var(--shadow-sm); }

/* MODAL */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(26, 26, 26, 0.4);
  -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  z-index: 50; padding: 24px;
  animation: fadeIn 0.2s ease;
}
.modal { background: var(--bg-card); border-radius: 14px; padding: 22px; max-width: 360px; width: 100%; border: 1px solid var(--line); }
.modal-title { font-size: 17px; font-weight: 700; letter-spacing: -0.015em; margin-bottom: 14px; }
.modal-text { font-size: 13px; color: var(--ink-soft); margin-bottom: 18px; line-height: 1.5; }
.modal-actions { display: flex; gap: 8px; }
.modal-actions .btn { flex: 1; }

/* TOAST */
.toast {
  position: fixed; bottom: calc(var(--safe-bottom) + 88px);
  left: 50%; transform: translateX(-50%);
  background: var(--ink); color: var(--bg-card);
  padding: 11px 18px; border-radius: 100px;
  font-size: 13px; font-weight: 500; z-index: 30;
  animation: toastIn 0.25s ease;
  box-shadow: 0 8px 24px rgba(0,0,0,0.2);
  pointer-events: none; max-width: 280px; text-align: center;
}
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 8px);} to { opacity: 1; transform: translate(-50%, 0);} }

/* DISTRIBUTION ROW (분배금) */
.dist-row {
  display: grid;
  grid-template-columns: 1fr 110px 32px;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
}
.dist-row .input-wrap { width: 100%; }
.dist-sum {
  display: flex; justify-content: space-between; align-items: center;
  background: var(--bg-soft); border-radius: 8px;
  padding: 10px 12px; margin-top: 10px;
}
.dist-sum .lbl { font-size: 12px; color: var(--ink-soft); font-weight: 500; }
.dist-sum .v { font-size: 15px; font-weight: 700; color: var(--accent); font-variant-numeric: tabular-nums; }

/* INCOME GROUP (성일/정서 그룹) */
.income-group {
  background: var(--bg-soft);
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  padding: 14px;
  margin-bottom: 10px;
}
.income-group .who {
  font-size: 12px; font-weight: 700;
  color: var(--ink); margin-bottom: 8px;
  letter-spacing: -0.01em;
}
.income-group .field-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.income-group .field-pair label { font-size: 11px; color: var(--ink-muted); margin-bottom: 4px; display: block; }

/* TRACKED ASSET (거래 기록 가능 통장) */
.asset-card {
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  padding: 14px;
  margin-bottom: 10px;
  background: var(--bg-card);
}
.asset-card.tracked { border-color: var(--line); background: linear-gradient(180deg, #fbf8f2 0%, #f8f3e8 100%); }
.asset-card:last-child { margin-bottom: 0; }
.asset-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.asset-info { flex: 1; min-width: 0; }
.asset-label-text { font-size: 12px; color: var(--ink-muted); margin-bottom: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: flex; align-items: center; gap: 5px; }
.asset-label-text .badge {
  font-size: 9px; padding: 1px 6px;
  background: var(--accent-bg); color: var(--accent);
  border-radius: 100px; font-weight: 700; letter-spacing: 0.02em;
}
.asset-amount { font-size: 18px; font-weight: 800; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.asset-amount .unit { font-size: 13px; font-weight: 400; color: var(--ink-soft); margin-left: 2px; }

.asset-actions {
  display: grid; grid-template-columns: 1fr 1fr 1fr;
  gap: 6px; margin-top: 12px;
  padding-top: 12px; border-top: 1px solid var(--line-soft);
}
.asset-actions button {
  font-family: inherit; font-size: 12px; font-weight: 600;
  padding: 8px; border-radius: 7px;
  border: 1px solid var(--line); background: var(--bg-card);
  cursor: pointer; -webkit-appearance: none; appearance: none;
  display: flex; align-items: center; justify-content: center; gap: 4px;
  transition: background 0.15s, border-color 0.15s;
  min-height: 36px; color: var(--ink);
}
.asset-actions button:active { background: var(--bg-soft); }
.asset-actions .btn-in { color: var(--green); border-color: var(--green-bg); }
.asset-actions .btn-in:active { background: var(--green-bg); }
.asset-actions .btn-out { color: var(--accent); border-color: var(--accent-bg); }
.asset-actions .btn-out:active { background: var(--accent-bg); }

.asset-tx-list {
  margin-top: 10px;
  border-top: 1px dashed var(--line-soft);
  padding-top: 10px;
  animation: fadeIn 0.25s ease-out;
}
.asset-tx-row {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line-soft);
}
.asset-tx-row:last-child { border-bottom: none; }
.asset-tx-meta { flex: 1; min-width: 0; }
.asset-tx-meta .date { font-size: 11px; color: var(--ink-muted); font-variant-numeric: tabular-nums; margin-bottom: 2px; }
.asset-tx-meta .memo { font-size: 13px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.asset-tx-amount {
  font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap;
}
.asset-tx-amount.in { color: var(--green); }
.asset-tx-amount.out { color: var(--accent); }
.asset-tx-empty { text-align: center; padding: 14px 0; color: var(--ink-muted); font-size: 12px; }

/* Tracked toggle in asset add/edit */
.tracked-toggle {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 12px; background: var(--bg-card);
  border: 1px solid var(--line); border-radius: 8px;
  margin-bottom: 8px; cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.tracked-toggle .lbl { font-size: 12px; color: var(--ink); font-weight: 500; }
.tracked-toggle .sub { font-size: 10px; color: var(--ink-muted); margin-top: 2px; }
.tracked-toggle .sw {
  width: 38px; height: 22px;
  background: var(--bg-soft); border: 1px solid var(--line);
  border-radius: 100px; position: relative;
  flex-shrink: 0; transition: background 0.2s;
}
.tracked-toggle .sw::after {
  content: ''; position: absolute; top: 2px; left: 2px;
  width: 16px; height: 16px;
  background: white; border-radius: 50%;
  transition: transform 0.2s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}
.tracked-toggle.on .sw { background: var(--accent); border-color: var(--accent); }
.tracked-toggle.on .sw::after { transform: translateX(16px); }

.kv { padding-top: 14px; border-top: 1px solid var(--line-soft); }
.kv .k { font-size: 11px; color: var(--ink-muted); margin-bottom: 4px; letter-spacing: 0.02em; }
.kv .v { font-weight: 600; font-size: 15px; font-variant-numeric: tabular-nums; }

/* DONUT CHART */
.donut-wrap {
  position: relative;
  display: flex; justify-content: center;
  margin: 4px 0 16px 0;
}
.donut-wrap svg { display: block; }
.donut-center {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
}
.donut-center .lbl {
  font-size: 9px; color: var(--ink-muted);
  letter-spacing: 0.08em; margin-bottom: 2px;
  text-transform: uppercase; font-weight: 600;
}
.donut-center .v {
  font-size: 17px; font-weight: 800;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
.donut-center .v .unit {
  font-size: 10px; font-weight: 400;
  color: var(--ink-soft); margin-left: 1px;
}
.donut-legend {}
.legend-row {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line-soft);
}
.legend-row:last-child { border-bottom: none; }
.legend-row .dot {
  width: 10px; height: 10px;
  border-radius: 2px; flex-shrink: 0;
}
.legend-row .lbl {
  flex: 1; font-size: 12px; font-weight: 500;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  min-width: 0;
}
.legend-row .amt {
  font-size: 12px; font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.legend-row .pct {
  font-size: 11px; color: var(--ink-muted);
  font-variant-numeric: tabular-nums;
  min-width: 32px; text-align: right; font-weight: 600;
}

/* BUDGET GAUGE */
.gauge-bar {
  position: relative;
  height: 22px;
  background: var(--bg-soft);
  border-radius: 100px;
  overflow: hidden;
  margin-bottom: 10px;
}
.gauge-fill {
  height: 100%;
  border-radius: 100px;
  transition: width 0.6s ease, background 0.3s ease;
}
.gauge-pct {
  position: absolute;
  top: 50%; right: 12px;
  transform: translateY(-50%);
  font-size: 11px; font-weight: 700;
  color: white;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 1px 2px rgba(0,0,0,0.15);
}
.gauge-amt {
  display: flex; align-items: baseline;
  justify-content: center;
  gap: 5px;
  margin-bottom: 14px;
  font-variant-numeric: tabular-nums;
}
.gauge-amt .cur {
  font-size: 18px; font-weight: 800;
  letter-spacing: -0.02em;
}
.gauge-amt .tgt {
  font-size: 13px; color: var(--ink-soft);
  font-weight: 500;
}
.gauge-info {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 4px;
  padding-top: 12px;
  border-top: 1px solid var(--line-soft);
}
.gauge-info .info-cell {
  text-align: center;
  padding: 0 4px;
}
.gauge-info .info-cell .lbl {
  font-size: 10px; color: var(--ink-muted);
  margin-bottom: 4px;
  letter-spacing: 0.02em; font-weight: 500;
}
.gauge-info .info-cell .v {
  font-size: 13px; font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.015em;
}

/* REORDER MODE */
.reorder-toggle {
  font-family: inherit; font-size: 11px;
  padding: 4px 10px; border-radius: 100px;
  border: 1px solid var(--line); background: var(--bg-card);
  color: var(--ink-soft); cursor: pointer;
  -webkit-appearance: none; appearance: none;
  font-weight: 600;
  display: inline-flex; align-items: center; gap: 4px;
  flex-shrink: 0;
}
.reorder-toggle.active {
  background: var(--accent-bg); color: var(--accent);
  border-color: var(--accent);
}
.reorder-list { padding: 4px 0; }
.reorder-row {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px;
  background: var(--bg-soft);
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  margin-bottom: 6px;
}
.reorder-row .handle { color: var(--ink-muted); flex-shrink: 0; }
.reorder-row .name {
  flex: 1; font-size: 13px; font-weight: 500;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  min-width: 0;
}
.reorder-row .meta { font-size: 11px; color: var(--ink-muted); white-space: nowrap; flex-shrink: 0; }
.reorder-row .arrows { display: flex; gap: 4px; flex-shrink: 0; }
.reorder-row .arr-btn {
  width: 34px; height: 34px;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink-soft); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  -webkit-appearance: none; appearance: none;
}
.reorder-row .arr-btn:disabled { opacity: 0.3; cursor: not-allowed; }
.reorder-row .arr-btn:active:not(:disabled) { background: var(--bg-soft); }

/* INVESTMENT ASSET */
.asset-card.investment { border-color: var(--navy); background: linear-gradient(180deg, #f6f8fb 0%, #eef2f8 100%); }
.asset-card .gain-row {
  display: flex; gap: 12px; flex-wrap: wrap;
  font-size: 11px; color: var(--ink-muted);
  margin-top: 4px; line-height: 1.5;
}
.asset-card .gain-row .item { font-variant-numeric: tabular-nums; }
.asset-card .gain-row .item strong { color: var(--ink-soft); font-weight: 700; }
.asset-card .gain-row .item.positive strong { color: var(--green); }
.asset-card .gain-row .item.negative strong { color: var(--accent); }
.asset-card .deposit-line {
  font-size: 11px; color: var(--ink-muted);
  margin-top: 6px; padding-top: 6px;
  border-top: 1px dashed var(--line-soft);
  display: flex; align-items: center; gap: 4px;
  font-variant-numeric: tabular-nums;
}

/* INVEST FIELDS in modal */
.invest-fields {
  background: #f0f4f9;
  border: 1px solid #d8e0eb;
  border-radius: 8px;
  padding: 12px; margin-bottom: 8px;
}
.invest-fields .preview {
  background: white; border: 1px solid #d8e0eb;
  border-radius: 6px; padding: 8px 10px;
  margin-top: 6px; font-size: 12px;
  display: flex; justify-content: space-between; align-items: center;
}
.invest-fields .preview .lbl { color: var(--ink-muted); }
.invest-fields .preview .v { font-weight: 700; font-variant-numeric: tabular-nums; }

/* ASSET SNAPSHOT CHART */
.snap-chart {
  background: var(--bg-soft);
  border-radius: 10px;
  padding: 14px 6px 6px 6px;
  margin-top: 12px;
}
.snap-chart svg { display: block; width: 100%; max-width: 100%; }
.snap-chart-empty {
  text-align: center; padding: 24px 0;
  color: var(--ink-muted); font-size: 12px; line-height: 1.6;
}

/* VIEW MODE TOGGLE (월/년) */
.view-toggle {
  display: flex; background: var(--bg-soft);
  border: 1px solid var(--line-soft); border-radius: 8px;
  padding: 3px; margin-bottom: 12px;
}
.view-toggle button {
  flex: 1; background: none; border: none; padding: 8px;
  font-family: inherit; font-size: 12px; color: var(--ink-muted);
  border-radius: 6px; cursor: pointer; font-weight: 500;
  -webkit-appearance: none; appearance: none;
}
.view-toggle button.active { background: var(--bg-card); color: var(--ink); font-weight: 700; box-shadow: var(--shadow-sm); }

.view-nav {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 4px; margin-bottom: 12px;
}
.view-nav button {
  width: 36px; height: 36px;
  background: var(--bg-card); border: 1px solid var(--line);
  border-radius: 50%; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  -webkit-appearance: none; appearance: none;
  color: var(--ink-soft);
}
.view-nav button:disabled { opacity: 0.3; cursor: not-allowed; }
.view-nav button:active:not(:disabled) { background: var(--bg-soft); }
.view-nav .label {
  font-size: 15px; font-weight: 700; letter-spacing: -0.015em;
  font-variant-numeric: tabular-nums;
}

/* Auto-deposit list in budget tab */
.deposit-row {
  display: grid;
  grid-template-columns: 1fr 130px;
  gap: 8px; align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--line-soft);
}
.deposit-row:last-child { border-bottom: none; }
.deposit-row .name {
  font-size: 13px; font-weight: 500;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  display: flex; align-items: center; gap: 6px;
}
.deposit-row .name .badge {
  font-size: 9px; padding: 1px 6px;
  border-radius: 100px; font-weight: 700;
}
.deposit-row .name .badge.invest { background: #e8eef7; color: var(--navy); }
.deposit-row .name .badge.bank { background: var(--accent-bg); color: var(--accent); }

/* CREDIT CARD SECTION */
.cc-card {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 10px;
}
.cc-card:last-child { margin-bottom: 0; }
.cc-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; margin-bottom: 12px; }
.cc-name {
  font-size: 14px; font-weight: 700;
  letter-spacing: -0.015em;
  display: flex; align-items: center; gap: 6px;
  flex: 1; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.cc-issuer { font-size: 11px; color: var(--ink-muted); margin-bottom: 1px; font-weight: 500; }
.cc-owner-tag {
  font-size: 9px; font-weight: 700;
  padding: 2px 7px; border-radius: 100px;
  letter-spacing: 0.02em; white-space: nowrap;
  background: var(--accent-bg); color: var(--accent);
  flex-shrink: 0;
}
.cc-summary {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 10px; padding: 12px;
  background: var(--bg-soft); border-radius: 8px;
  margin-bottom: 10px;
}
.cc-summary .col .lbl { font-size: 10px; color: var(--ink-muted); margin-bottom: 3px; letter-spacing: 0.02em; }
.cc-summary .col .v { font-size: 15px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -0.015em; }
.cc-summary .col .v.normal { color: var(--ink); }
.cc-summary .col .v.install { color: var(--accent); }
.cc-cycle { font-size: 10px; color: var(--ink-muted); text-align: center; margin-bottom: 8px; font-variant-numeric: tabular-nums; }
.cc-actions { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 6px; margin-bottom: 8px; }
.cc-actions button {
  font-family: inherit; font-size: 12px; font-weight: 600;
  padding: 9px 6px; border-radius: 7px;
  border: 1px solid var(--line); background: var(--bg-card);
  cursor: pointer; -webkit-appearance: none; appearance: none;
  display: flex; align-items: center; justify-content: center; gap: 3px;
  min-height: 36px; color: var(--ink);
}
.cc-actions button:active { background: var(--bg-soft); }

.cc-list {
  margin-top: 10px;
  border-top: 1px dashed var(--line-soft);
  padding-top: 10px;
  animation: fadeIn 0.25s ease-out;
}
.cc-list-title { font-size: 11px; font-weight: 700; color: var(--ink-soft); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 6px; }
.cc-tx-row {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 0;
  border-bottom: 1px solid var(--line-soft);
  font-size: 12px;
}
.cc-tx-row:last-child { border-bottom: none; }
.cc-tx-info { flex: 1; min-width: 0; }
.cc-tx-info .date { font-size: 10px; color: var(--ink-muted); font-variant-numeric: tabular-nums; margin-bottom: 1px; }
.cc-tx-info .memo { font-size: 12px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cc-tx-amt { font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; color: var(--ink); }

.install-card {
  background: var(--bg-soft);
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 8px;
}
.install-card:last-child { margin-bottom: 0; }
.install-card.completed { opacity: 0.55; }
.install-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; margin-bottom: 6px; }
.install-name { font-size: 12px; font-weight: 600; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.install-amt { font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.install-meta { font-size: 11px; color: var(--ink-muted); display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 6px; }
.install-meta strong { color: var(--ink-soft); font-weight: 700; font-variant-numeric: tabular-nums; }
.install-bar { height: 4px; background: var(--bg-card); border-radius: 100px; overflow: hidden; margin-bottom: 6px; border: 1px solid var(--line-soft); }
.install-bar-fill { height: 100%; background: linear-gradient(90deg, var(--accent) 0%, var(--accent-soft) 100%); }
.install-foot { display: flex; justify-content: space-between; align-items: center; }
.install-foot .pct { font-size: 10px; font-weight: 700; color: var(--ink-soft); font-variant-numeric: tabular-nums; }

/* Subscription extras */
.sub-row .sub-info .meta { font-size: 10px; color: var(--ink-muted); margin-top: 2px; font-variant-numeric: tabular-nums; }

/* Owner toggle in card add modal */
.owner-toggle { display: flex; background: var(--bg-soft); border: 1px solid var(--line); border-radius: 8px; padding: 3px; }
.owner-toggle button {
  flex: 1; background: none; border: none; padding: 9px;
  font-family: inherit; font-size: 12px; color: var(--ink-muted);
  border-radius: 6px; cursor: pointer; font-weight: 500;
  transition: background 0.15s, color 0.15s;
  -webkit-appearance: none; appearance: none;
}
.owner-toggle button.active { background: var(--bg-card); color: var(--ink); font-weight: 700; box-shadow: var(--shadow-sm); }

/* LOAN CARD */
.loan-card {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 10px;
}
.loan-card:last-child { margin-bottom: 0; }
.loan-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; margin-bottom: 10px; }
.loan-name { font-size: 14px; font-weight: 700; letter-spacing: -0.015em; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.loan-balance {
  font-size: 22px; font-weight: 800; letter-spacing: -0.02em;
  color: var(--accent); font-variant-numeric: tabular-nums;
  margin-bottom: 6px;
}
.loan-balance .unit { font-size: 13px; font-weight: 400; color: var(--ink-soft); margin-left: 2px; }
.loan-meta {
  font-size: 11px; color: var(--ink-muted);
  display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 10px;
}
.loan-meta span { white-space: nowrap; font-variant-numeric: tabular-nums; }
.loan-meta strong { color: var(--ink-soft); font-weight: 700; }
.loan-bar {
  height: 6px; background: var(--bg-soft); border-radius: 100px;
  overflow: hidden; margin-bottom: 6px;
}
.loan-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--green) 0%, var(--green-soft) 100%);
  border-radius: 100px; transition: width 0.6s ease;
}
.loan-foot {
  font-size: 11px; color: var(--ink-muted);
  display: flex; justify-content: space-between; align-items: center;
}
.loan-foot .pct { font-variant-numeric: tabular-nums; font-weight: 700; color: var(--ink-soft); }
.loan-foot .actions { display: flex; gap: 4px; }

/* SUBSCRIPTION ROW */
.sub-row {
  display: flex; align-items: center; gap: 8px;
  padding: 11px 0; border-bottom: 1px solid var(--line-soft);
}
.sub-row:last-child { border-bottom: none; }
.sub-info { flex: 1; min-width: 0; }
.sub-info .name {
  font-size: 13px; font-weight: 600;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  margin-bottom: 2px;
}
.sub-tag {
  font-size: 9px; font-weight: 700;
  padding: 2px 7px; border-radius: 100px;
  letter-spacing: 0.02em; white-space: nowrap;
  display: inline-block;
}
.sub-tag.sub { background: var(--accent-bg); color: var(--accent); }
.sub-tag.rent { background: #e8eef7; color: var(--navy); }
.sub-amount {
  font-size: 13px; font-weight: 700;
  font-variant-numeric: tabular-nums; white-space: nowrap;
}
.sub-sum {
  display: flex; justify-content: space-between; align-items: center;
  background: var(--bg-soft); border-radius: 8px;
  padding: 10px 12px; margin-top: 12px;
}
.sub-sum .lbl { font-size: 12px; color: var(--ink-soft); font-weight: 500; }
.sub-sum .v { font-size: 15px; font-weight: 700; color: var(--accent); font-variant-numeric: tabular-nums; }

/* Type toggle in modal (구독/렌탈) */
.type-toggle { display: flex; background: var(--bg-soft); border: 1px solid var(--line); border-radius: 8px; padding: 3px; }
.type-toggle button {
  flex: 1; background: none; border: none; padding: 9px;
  font-family: inherit; font-size: 12px; color: var(--ink-muted);
  border-radius: 6px; cursor: pointer; font-weight: 500;
  transition: background 0.15s, color 0.15s;
  -webkit-appearance: none; appearance: none;
}
.type-toggle button.active { background: var(--bg-card); color: var(--ink); font-weight: 700; box-shadow: var(--shadow-sm); }

/* SHARE FAB (헤더 우상단 공유 버튼) */
.share-fab {
  position: absolute;
  top: calc(var(--safe-top) + 18px);
  right: 16px;
  width: 36px; height: 36px;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 50%;
  cursor: pointer;
  color: var(--ink-soft);
  display: inline-flex; align-items: center; justify-content: center;
  -webkit-appearance: none; appearance: none;
  transition: background 0.15s, color 0.15s;
}
.share-fab:active { background: var(--accent-bg); color: var(--accent); }

/* SETTINGS FAB (헤더 좌상단 설정 버튼) */
.settings-fab {
  position: absolute;
  top: calc(var(--safe-top) + 18px);
  left: 16px;
  width: 36px; height: 36px;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 50%;
  cursor: pointer;
  color: var(--ink-soft);
  display: inline-flex; align-items: center; justify-content: center;
  -webkit-appearance: none; appearance: none;
  transition: background 0.15s, color 0.15s, transform 0.4s;
}
.settings-fab:active { background: var(--accent-bg); color: var(--accent); transform: rotate(90deg); }

/* SHARE OPTION BUTTONS (모달 내) */
.share-btn {
  display: flex; align-items: center; gap: 12px;
  width: 100%; padding: 14px;
  background: var(--bg-soft); border: 1px solid var(--line);
  border-radius: 10px; margin-bottom: 8px;
  font-family: inherit; cursor: pointer;
  text-align: left;
  -webkit-appearance: none; appearance: none;
  transition: background 0.15s, border-color 0.15s, transform 0.05s;
}
.share-btn:active { background: var(--accent-bg); border-color: var(--accent-soft); transform: scale(0.99); }
.share-btn.primary { background: var(--accent-bg); border-color: var(--accent-soft); }
.share-btn .s-icon {
  width: 38px; height: 38px;
  background: var(--bg-card); border: 1px solid var(--line-soft);
  border-radius: 8px; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--accent);
}
.share-btn.primary .s-icon { background: var(--accent); color: var(--bg-card); border-color: var(--accent); }
.share-btn .s-text { flex: 1; min-width: 0; }
.share-btn .s-title { font-weight: 700; font-size: 14px; color: var(--ink); margin-bottom: 2px; letter-spacing: -0.01em; }
.share-btn .s-sub { font-size: 11px; color: var(--ink-muted); line-height: 1.4; }

/* IMPORT TEXTAREA */
.import-area {
  width: 100%; min-height: 140px;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  font-family: ui-monospace, 'SF Mono', Consolas, monospace;
  font-size: 12px; line-height: 1.45;
  color: var(--ink); resize: none;
  -webkit-appearance: none; appearance: none;
  outline: none;
}
.import-area:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-bg); }
