/* 핸드머니 — 한 화면에 다 보이는 모바일 레이아웃
   규칙: 클래스는 전부 hm- 접두 + 맥락 이름 / 간격은 --s 토큰만 / 세로 리듬은 표시한 곳에서만 */

/* ── 1. 기본 */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; height: 100%; }
body {
  height: 100%;
  margin: 0;
  overflow: hidden;
  overscroll-behavior: none;
  background: var(--color-bg);
  color: var(--text-primary);
  font-family: var(--font);
  font-size: var(--fs-body);
  font-weight: var(--fw-body);
  line-height: 1.45;
  letter-spacing: -0.01em;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
h1, h2, h3, p, ul, ol, dl, dd { margin: 0; padding: 0; }
ul, ol { list-style: none; }
button, input, select { font: inherit; color: inherit; letter-spacing: inherit; }
button { margin: 0; padding: 0; border: 0; background: none; cursor: pointer; touch-action: manipulation; text-align: inherit; }
button:disabled { cursor: default; }
svg { display: block; flex: none; }
:focus { outline: none; }
:focus-visible { box-shadow: var(--focus-ring); }
.hm-num { font-variant-numeric: tabular-nums; font-feature-settings: 'tnum' 1; }
.hm-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ── 2. 프레임 */
.hm-root { position: relative; height: 100vh; height: 100dvh; overflow: hidden; }
#app { height: 100%; }
.hm-app, .hm-auth, .hm-splash {
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100%;
  max-width: 480px;
  margin: 0 auto;
  padding-top: env(safe-area-inset-top);
  background: var(--color-bg);
}
@media (min-width: 560px) and (min-height: 640px) {
  body { display: grid; place-items: center; background: var(--color-desk); }
  .hm-root { width: 400px; height: min(100dvh - 48px, 860px); border-radius: 36px; box-shadow: var(--shadow-frame); }
}

/* ── 3. 상단 */
.hm-head {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s3);
  height: var(--header-h);
  padding: 0 var(--gutter);
}
.hm-head-brand { display: flex; align-items: center; gap: var(--s2); min-width: 0; }
.hm-head-title { font-size: var(--fs-title); font-weight: 700; letter-spacing: -0.02em; white-space: nowrap; }
.hm-head-tools { display: flex; align-items: center; gap: var(--s1); }
.hm-mark { display: block; flex: none; border-radius: 27%; }

.hm-icon-btn {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  transition: background-color 0.15s, color 0.15s;
}
.hm-icon-btn:hover { background: var(--color-surface-sunken); color: var(--text-primary); }
.hm-icon-btn:active { background: var(--color-border-subtle); }
.hm-icon-btn:disabled { opacity: 0.35; background: none; }

.hm-month {
  display: flex;
  align-items: center;
  height: 32px;
  padding: 0 2px;
  border-radius: var(--radius-pill);
  background: var(--color-surface);
  box-shadow: inset 0 0 0 1px var(--color-border-subtle);
}
.hm-month-step { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; color: var(--text-secondary); }
.hm-month-step:hover { background: var(--color-surface-sunken); color: var(--text-primary); }
.hm-month-step:active { background: var(--color-border-subtle); }
.hm-month-label { min-width: 76px; padding: 0 var(--s1); font-size: var(--fs-body); font-weight: 650; text-align: center; white-space: nowrap; border-radius: var(--radius-sm); }
.hm-month-label.is-other { color: var(--color-primary); }

/* ── 4. 본문 — 세로 리듬은 여기서만 */
.hm-body {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: var(--s1) var(--gutter) 0;
}
.hm-body > * + * { margin-top: var(--s3); }

/* ── 5. 카드 */
.hm-card {
  flex: none;
  min-height: 0;
  padding: var(--s4);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
}
.hm-card--list { flex: 0 1 auto; display: flex; flex-direction: column; padding: var(--s2) var(--s3) var(--s2); }
.hm-card-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s2); min-height: 20px; }
.hm-card-label { font-size: var(--fs-meta); font-weight: 600; color: var(--text-secondary); }
.hm-card-aside { font-size: var(--fs-meta); font-weight: 600; color: var(--text-secondary); white-space: nowrap; }
.hm-scroll { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: none; }
.hm-scroll::-webkit-scrollbar { width: 0; }
/* 저축·구독 목록: 트랙 없이 3px 막대만. 카드 여백 쪽으로 8px 내보내 금액 숫자와 붙지 않게 (계획·기록 표는 머리줄과 칸이 어긋나지 않게 숨김 유지)
   크로미움은 scrollbar-width 를 auto 로 둬야 ::-webkit 스타일을 따른다 — 파이어폭스만 표준 속성 */
.hm-card--list:not(.hm-grid) > .hm-scroll { margin-right: calc(-1 * var(--s2)); padding-right: var(--s2); scrollbar-width: auto; }
.hm-card--list:not(.hm-grid) > .hm-scroll::-webkit-scrollbar { width: 3px; }
.hm-card--list:not(.hm-grid) > .hm-scroll::-webkit-scrollbar-track { background: transparent; }
.hm-card--list:not(.hm-grid) > .hm-scroll::-webkit-scrollbar-thumb { border-radius: 3px; background: color-mix(in srgb, var(--text-caption) 45%, transparent); }
@supports not selector(::-webkit-scrollbar) {
  .hm-card--list:not(.hm-grid) > .hm-scroll { scrollbar-width: thin; scrollbar-color: color-mix(in srgb, var(--text-caption) 45%, transparent) transparent; }
}

/* 막대 + 범례 (저축 비중 · 급여 배분 · 기록 진행) */
.hm-stack {
  display: flex;
  gap: 2px;
  height: 8px;
  margin-top: var(--s3);
  overflow: hidden;
  border-radius: var(--radius-pill);
  background: var(--color-surface-sunken);
}
.hm-stack-seg { display: block; height: 100%; min-width: 4px; background: var(--seg); }
.hm-stack-seg:first-child { border-radius: var(--radius-pill) 0 0 var(--radius-pill); }
.hm-stack-seg:last-child { border-radius: 0 var(--radius-pill) var(--radius-pill) 0; }
.hm-stack-seg:only-child { border-radius: var(--radius-pill); }
.hm-legend { display: flex; flex-wrap: wrap; gap: var(--s1) var(--s4); margin-top: var(--s2); font-size: var(--fs-micro); color: var(--text-secondary); }
.hm-legend-item { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.hm-legend-item b { font-weight: 650; color: var(--text-primary); }
.hm-dot { display: inline-block; flex: none; width: 6px; height: 6px; border-radius: 50%; background: var(--dot, currentColor); }
.hm-dot--ring { background: none; box-shadow: inset 0 0 0 1.5px var(--dot, currentColor); }

/* ── 6. 맨 아래 합계 */
.hm-total {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s3);
  min-height: 56px;
  margin: var(--s3) var(--gutter);
  padding: var(--s3) var(--s4);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
  box-shadow: inset 0 0 0 1px var(--color-border-subtle);
}
.hm-total-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.hm-total-title { font-size: var(--fs-body); font-weight: 650; }
.hm-total-meta { font-size: var(--fs-micro); color: var(--text-caption); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hm-total-value { font-size: var(--fs-value); font-weight: 700; letter-spacing: -0.02em; white-space: nowrap; }
.hm-total-value small { margin-left: 2px; font-size: var(--fs-body); font-weight: 600; }
.hm-total-badge { display: inline-block; margin-left: 6px; padding: 1px 6px; border-radius: var(--radius-pill); font-size: var(--fs-micro); font-weight: 700; vertical-align: 2px; }
.hm-tone-pos { color: var(--color-positive-ink); }
.hm-tone-neg { color: var(--color-negative-ink); }
.hm-tone-save { color: var(--color-save); }
.hm-total-badge.hm-tone-pos { background: var(--color-positive-subtle); }
.hm-total-badge.hm-tone-neg { background: var(--color-negative-subtle); }

/* ── 7. 탭 */
.hm-tabbar {
  flex: none;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: var(--color-surface);
  border-top: 1px solid var(--color-border-subtle);
}
.hm-tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  font-size: var(--fs-micro);
  font-weight: 600;
  color: var(--text-caption);
  transition: color 0.15s;
}
.hm-tab:hover { color: var(--text-secondary); }
.hm-tab[aria-current="page"] { color: var(--color-primary); }
.hm-tab:focus-visible { box-shadow: inset var(--focus-ring); }

/* ── 8. 저축 현황 */
.hm-sav-list { margin-top: var(--s1); }
.hm-sav-row {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--s3);
  width: 100%;
  min-height: 52px;
  padding: var(--s2) var(--s1);
  border-top: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-sm);
  transition: background-color 0.15s;
}
.hm-sav-row:first-child { border-top-color: transparent; }
.hm-sav-row:hover { background: var(--color-surface-sunken); }
.hm-sav-row:active { background: var(--color-border-subtle); }
.hm-type-ic {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 10px;
  color: var(--tc);
  background: color-mix(in srgb, var(--tc) 12%, transparent);
}
.hm-sav-main, .hm-sav-side { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.hm-sav-side { align-items: flex-end; }
.hm-sav-name { font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hm-sav-sub, .hm-sav-delta { font-size: var(--fs-micro); color: var(--text-caption); white-space: nowrap; }
.hm-sav-amt { font-weight: 650; white-space: nowrap; }
.hm-sav-delta.hm-tone-save { color: var(--color-save); }
.hm-sav-tag { margin-left: 3px; color: var(--text-caption); }

/* ── 9. 소비 계획 */
.hm-salary { display: block; width: 100%; text-align: left; transition: background-color 0.15s; }
.hm-salary:hover { background: color-mix(in srgb, var(--color-surface) 92%, var(--text-primary)); }
.hm-salary-top { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--s3); }
.hm-salary-main { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.hm-salary-legend { display: flex; flex-direction: column; gap: 1px; flex: none; font-size: var(--fs-micro); color: var(--text-secondary); }
.hm-salary-legend li { display: flex; align-items: center; gap: 5px; line-height: 16px; }
.hm-salary-legend b { min-width: 30px; margin-left: auto; padding-left: var(--s2); text-align: right; font-weight: 650; color: var(--text-primary); }
.hm-salary-warn { margin-top: var(--s2); font-size: var(--fs-micro); font-weight: 650; }
.hm-salary-value { font-size: var(--fs-hero); font-weight: 700; letter-spacing: -0.025em; }
.hm-salary-value small { margin-left: 2px; font-size: var(--fs-title); font-weight: 600; }
.hm-salary-value.is-empty { color: var(--text-caption); font-size: var(--fs-value); line-height: 30px; }
.hm-salary-edit { display: inline-flex; align-items: center; gap: 2px; margin-left: var(--s1); font-size: var(--fs-micro); font-weight: 600; color: var(--color-primary); vertical-align: -1px; }

/* 계획·기록 표 (grid로 열을 맞춘다) */
.hm-grid { --cols: minmax(0, 1fr) 96px 40px; }
.hm-grid--rec { --cols: minmax(0, 1fr) 74px 84px 46px; }
.hm-grid-head, .hm-grid-group, .hm-grid-row {
  display: grid;
  grid-template-columns: var(--cols);
  align-items: center;
  column-gap: var(--s2);
  padding: 0 var(--s2);
}
.hm-grid-head { height: 24px; font-size: var(--fs-micro); font-weight: 600; color: var(--text-caption); }
.hm-grid-head > :not(:first-child), .hm-grid-group > :not(:first-child), .hm-grid-row > :not(:first-child) { text-align: right; }
.hm-grid-head > .is-center, .hm-grid-row > .is-center { text-align: center; }
.hm-grid-group {
  height: var(--group-h);
  margin-top: var(--s1);
  border-radius: var(--radius-sm);
  background: var(--grp-bg);
  font-size: var(--fs-meta);
  font-weight: 650;
  color: var(--grp-ink);
}
.hm-grid-group:first-child { margin-top: 0; }
.hm-grid-group--save { --grp-bg: var(--color-save-subtle); --grp-ink: var(--color-save); --dot: var(--color-save); }
.hm-grid-group--spend { --grp-bg: var(--color-spend-subtle); --grp-ink: var(--color-spend-ink); --dot: var(--color-spend); }
.hm-grid-gname { display: inline-flex; align-items: center; gap: 6px; }
.hm-grid-gname em { font-style: normal; font-weight: 600; opacity: 0.7; }
.hm-grid-row {
  width: 100%;
  height: var(--row-h);
  border-radius: var(--radius-sm);
  transition: background-color 0.15s;
}
.hm-grid-row + .hm-grid-row { box-shadow: inset 0 1px 0 var(--color-border-subtle); }
.hm-grid-row:hover { background: var(--color-surface-sunken); box-shadow: none; }
.hm-grid-row:hover + .hm-grid-row { box-shadow: none; }
.hm-grid-row:active { background: var(--color-border-subtle); }
.hm-grid-name { display: flex; align-items: center; gap: var(--s2); min-width: 0; }
.hm-grid-name span { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.hm-grid-name .hm-dot { --dot: var(--row-dot); }
.hm-grid-row--save { --row-dot: var(--color-save); }
.hm-grid-row--spend { --row-dot: var(--color-spend); }
.hm-grid-amt { font-weight: 600; white-space: nowrap; }
.hm-grid-pct { font-size: var(--fs-micro); color: var(--text-caption); white-space: nowrap; }
.hm-grid-zero { color: var(--text-caption); font-weight: 500; }
.hm-grid-empty { padding: var(--s3) var(--s2); font-size: var(--fs-meta); color: var(--text-caption); }

/* 화면에 맞추기: 행이 많으면 34px → 최소 24px까지 줄어들고, 그래도 넘칠 때만 표 안에서 스크롤 */
.hm-scroll--fit { display: flex; flex-direction: column; }
.hm-scroll--fit > .hm-grid-row { flex: 1 1 var(--row-h); height: auto; min-height: var(--row-min); max-height: var(--row-h); }
.hm-scroll--fit > .hm-grid-group { flex: 0 0 auto; }
.hm-grid-add {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 18px;
  height: 18px;
  margin-left: 2px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--grp-ink) 14%, transparent);
  color: var(--grp-ink);
  transition: background-color 0.15s;
}
.hm-grid-add::before { content: ''; position: absolute; inset: -9px; }
.hm-grid-add:hover { background: color-mix(in srgb, var(--grp-ink) 24%, transparent); }
.hm-grid-add:active { background: color-mix(in srgb, var(--grp-ink) 32%, transparent); }

/* 실제 기록 */
.hm-rec-plan { color: var(--text-secondary); white-space: nowrap; }
.hm-rec-actual {
  justify-self: stretch;
  padding: 3px 6px;
  border-radius: 6px;
  background: var(--color-surface-sunken);
  font-weight: 650;
  white-space: nowrap;
}
.hm-rec-actual.is-empty { color: var(--text-caption); font-weight: 500; }
.hm-rec-actual.is-ok { color: var(--color-positive-ink); }
.hm-rec-actual.is-bad { color: var(--color-negative-ink); }
.hm-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 20px;
  min-width: 38px;
  padding: 0 6px;
  border-radius: var(--radius-pill);
  font-size: var(--fs-micro);
  font-weight: 700;
  white-space: nowrap;
}
.hm-pill--ok { background: var(--color-positive-subtle); color: var(--color-positive-ink); }
.hm-pill--bad { background: var(--color-negative-subtle); color: var(--color-negative-ink); }
.hm-pill--empty { color: var(--text-caption); font-weight: 500; }
.hm-rec-fill { display: inline-flex; align-items: center; gap: 3px; font-size: var(--fs-meta); font-weight: 600; color: var(--color-primary); }
.hm-rec-fill:hover { text-decoration: underline; }

/* ── 10. 빈 화면 */
.hm-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: var(--s7) var(--s5) var(--s6);
}
.hm-empty-ic { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 14px; background: var(--color-primary-subtle); color: var(--color-primary); }
.hm-empty-title { margin-top: var(--s4); font-size: var(--fs-title); font-weight: 700; }
.hm-empty-desc { margin-top: var(--s1); font-size: var(--fs-meta); color: var(--text-secondary); line-height: 1.55; }
.hm-empty-actions { display: flex; flex-direction: column; gap: var(--s2); width: 100%; max-width: 260px; margin-top: var(--s5); }

/* ── 11. 버튼 · 칩 · 입력 (5상태: 기본/hover/active/focus/disabled) */
.hm-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: var(--control-h);
  padding: 0 var(--s5);
  border-radius: var(--radius-pill);
  font-size: 14px;
  font-weight: 650;
  white-space: nowrap;
  transition: background-color 0.15s, color 0.15s, opacity 0.15s;
}
.hm-btn:disabled { opacity: 0.4; }
.hm-btn--primary { background: var(--color-primary); color: var(--color-on-primary); }
.hm-btn--primary:hover:not(:disabled) { background: var(--color-primary-hover); }
.hm-btn--primary:active:not(:disabled) { background: var(--color-primary-pressed); }
.hm-btn--soft { background: var(--color-surface-sunken); color: var(--text-primary); }
.hm-btn--soft:hover:not(:disabled) { background: var(--color-border-subtle); }
.hm-btn--soft:active:not(:disabled) { background: var(--color-border); }
.hm-btn--tint { background: var(--color-primary-subtle); color: var(--color-primary); }
.hm-btn--tint:hover:not(:disabled) { background: color-mix(in srgb, var(--color-primary-subtle) 80%, var(--color-primary)); }
.hm-btn--ghost { color: var(--text-secondary); }
.hm-btn--ghost:hover:not(:disabled) { background: var(--color-surface-sunken); color: var(--text-primary); }
.hm-btn--danger { background: var(--color-negative-subtle); color: var(--color-negative-ink); }
.hm-btn--danger:hover:not(:disabled) { background: color-mix(in srgb, var(--color-negative-subtle) 80%, var(--color-negative)); }
.hm-btn--sm { height: 32px; padding: 0 var(--s3); font-size: var(--fs-meta); }
.hm-btn--block { width: 100%; }
.hm-btn.is-busy { position: relative; color: transparent !important; }
.hm-btn.is-busy::after {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid currentColor;
  border-color: var(--spin, #fff) transparent var(--spin, #fff) var(--spin, #fff);
  animation: hm-spin 0.7s linear infinite;
}
.hm-btn--soft.is-busy, .hm-btn--tint.is-busy, .hm-btn--ghost.is-busy { --spin: var(--text-secondary); }
@keyframes hm-spin { to { transform: rotate(360deg); } }

.hm-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.hm-chips--center { justify-content: center; }
.hm-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 28px;
  padding: 0 var(--s3);
  border-radius: var(--radius-pill);
  background: var(--color-surface-sunken);
  font-size: var(--fs-meta);
  font-weight: 600;
  color: var(--text-secondary);
  white-space: nowrap;
  transition: background-color 0.15s, color 0.15s;
}
.hm-chip:hover { background: var(--color-border-subtle); color: var(--text-primary); }
.hm-chip:active { background: var(--color-border); }
.hm-chip[aria-pressed="true"] { background: var(--color-primary-subtle); color: var(--color-primary); }
.hm-chip--type[aria-pressed="true"] { background: color-mix(in srgb, var(--tc) 14%, transparent); color: var(--tc); }

.hm-field { display: flex; flex-direction: column; gap: 6px; }
.hm-field-label { font-size: var(--fs-meta); font-weight: 600; color: var(--text-secondary); }
.hm-field-hint { font-size: var(--fs-micro); color: var(--text-caption); }
.hm-input-wrap { position: relative; }
.hm-input {
  width: 100%;
  height: var(--control-h);
  padding: 0 14px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  font-size: var(--fs-input);
  font-weight: 500;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.hm-input::placeholder { color: var(--text-caption); font-weight: 450; }
.hm-input:hover { border-color: color-mix(in srgb, var(--color-border) 60%, var(--text-caption)); }
.hm-input:focus { border-color: var(--color-primary); box-shadow: var(--focus-ring); }
.hm-input:disabled { opacity: 0.5; }
.hm-input--pw { padding-right: 44px; }
.hm-input-eye { position: absolute; top: 6px; right: 6px; }
.hm-form-error { min-height: 18px; font-size: var(--fs-meta); font-weight: 600; color: var(--color-negative-ink); }
.hm-form-error:empty { visibility: hidden; }

/* ── 12. 시트 */
#hm-overlay { position: absolute; inset: 0; z-index: 40; pointer-events: none; }
.hm-sheet-layer { position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: flex-end; pointer-events: auto; }
.hm-sheet-backdrop { position: absolute; inset: 0; background: var(--color-scrim); opacity: 0; transition: opacity 0.22s ease; }
.hm-sheet {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 480px;
  max-height: calc(100% - var(--s6) - env(safe-area-inset-top));
  margin: 0 auto;
  padding: 0 var(--gutter) calc(var(--s4) + env(safe-area-inset-bottom));
  border-radius: 22px 22px 0 0;
  background: var(--color-surface);
  box-shadow: var(--shadow-sheet);
  transform: translateY(104%);
  transition: transform 0.28s var(--ease-out);
}
.hm-sheet-layer.is-open .hm-sheet-backdrop { opacity: 1; }
.hm-sheet-layer.is-open .hm-sheet { transform: none; }
.hm-sheet-grip { flex: none; width: 36px; height: 4px; margin: var(--s2) auto 0; border-radius: 2px; background: var(--color-border); }
.hm-sheet-head { flex: none; display: flex; align-items: flex-start; justify-content: space-between; gap: var(--s3); padding: var(--s3) 0 var(--s3); }
.hm-sheet-titles { min-width: 0; padding-top: 5px; }
.hm-sheet-title { font-size: var(--fs-title); font-weight: 700; letter-spacing: -0.02em; }
.hm-sheet-sub { margin-top: 2px; font-size: var(--fs-meta); color: var(--text-secondary); }
.hm-sheet-body { display: flex; flex-direction: column; min-height: 0; overflow-y: auto; overscroll-behavior: contain; margin: 0 calc(var(--s1) * -1); padding: 0 var(--s1) 2px; }
.hm-sheet-body > * { flex: none; }
.hm-sheet-body > * + * { margin-top: var(--s3); } /* 시트 세로 리듬 */
.hm-sheet-body > .hm-sheet-foot { margin-top: var(--s4); }
.hm-sheet-foot { display: flex; gap: var(--s2); }
.hm-sheet-foot > .hm-btn { flex: 1; }
.hm-sheet-foot > .hm-btn--icon { flex: none; width: var(--control-h); padding: 0; }
.hm-sheet-note { font-size: var(--fs-micro); color: var(--text-caption); line-height: 1.5; }
.hm-sheet-error { font-size: var(--fs-meta); font-weight: 600; color: var(--color-negative-ink); text-align: center; }
.hm-sheet-error:empty { display: none; }

/* 금액 입력 */
.hm-amt-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  width: 100%;
  padding: var(--s2) 0 var(--s1);
  border-radius: var(--radius-md);
}
.hm-amt { display: flex; align-items: baseline; gap: 3px; }
.hm-amt-num { font-size: 30px; font-weight: 700; letter-spacing: -0.03em; }
.hm-amt-unit { font-size: var(--fs-title); font-weight: 650; color: var(--text-secondary); }
.hm-amt-read { min-height: 17px; font-size: var(--fs-meta); color: var(--text-caption); }
.hm-amt-box.is-empty .hm-amt-num { color: var(--text-caption); }
.hm-amt-box.is-caret .hm-amt-num::after {
  content: '';
  display: inline-block;
  width: 2px;
  height: 26px;
  margin-left: 2px;
  vertical-align: -3px;
  background: var(--color-primary);
  animation: hm-blink 1s steps(1) infinite;
}
@keyframes hm-blink { 50% { opacity: 0; } }

.hm-amt-fields { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s2); }
.hm-amt-field {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: var(--s2) var(--s3);
  border-radius: var(--radius-md);
  background: var(--color-surface-sunken);
  box-shadow: inset 0 0 0 1px transparent;
  text-align: left;
  transition: box-shadow 0.15s, background-color 0.15s;
}
.hm-amt-field[aria-pressed="true"] { background: var(--color-surface); box-shadow: inset 0 0 0 1.5px var(--color-primary); }
.hm-amt-field-label { font-size: var(--fs-micro); font-weight: 600; color: var(--text-secondary); }
.hm-amt-field-value { font-size: var(--fs-value); font-weight: 700; letter-spacing: -0.02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hm-amt-field-value.is-empty { color: var(--text-caption); }

.hm-keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2px var(--s1); }
.hm-key {
  display: grid;
  place-items: center;
  height: 46px;
  border-radius: var(--radius-md);
  font-size: 21px;
  font-weight: 550;
  font-variant-numeric: tabular-nums;
  color: var(--text-primary);
  transition: background-color 0.1s;
  user-select: none;
  -webkit-user-select: none;
}
.hm-key:hover { background: var(--color-surface-sunken); }
.hm-key:active, .hm-key.is-pressed { background: var(--color-border-subtle); }
.hm-key--fn { font-size: 16px; color: var(--text-secondary); }

/* 저축 상세 */
.hm-detail-top { display: flex; align-items: center; gap: var(--s3); }
.hm-detail-balance { font-size: var(--fs-hero); font-weight: 700; letter-spacing: -0.025em; }
.hm-detail-balance small { margin-left: 2px; font-size: var(--fs-title); font-weight: 600; }
.hm-detail-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s2); }
.hm-detail-stat { padding: var(--s2) var(--s3); border-radius: var(--radius-md); background: var(--color-surface-sunken); }
.hm-detail-stat dt { font-size: var(--fs-micro); color: var(--text-caption); font-weight: 600; }
.hm-detail-stat dd { margin-top: 1px; font-size: var(--fs-body); font-weight: 650; white-space: nowrap; }
.hm-bars { display: flex; align-items: flex-end; gap: 4px; height: 76px; padding-top: var(--s2); }
.hm-bars-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 0; height: 100%; justify-content: flex-end; }
.hm-bars-bar { width: 100%; max-width: 22px; min-height: 2px; border-radius: 4px 4px 2px 2px; background: var(--color-save); }
.hm-bars-bar.is-plan { background: repeating-linear-gradient(-45deg, var(--color-save-subtle) 0 3px, color-mix(in srgb, var(--color-save) 35%, transparent) 3px 5px); }
.hm-bars-label { font-size: 10px; color: var(--text-caption); }
.hm-hist { display: flex; flex-direction: column; }
.hm-hist-row { display: grid; grid-template-columns: 64px minmax(0, 1fr) auto; align-items: center; gap: var(--s2); min-height: 38px; border-top: 1px solid var(--color-border-subtle); }
.hm-hist-row:first-child { border-top: 0; }
.hm-hist-month { font-weight: 650; }
.hm-hist-mid { font-size: var(--fs-micro); color: var(--text-caption); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hm-hist-amt { text-align: right; font-weight: 650; white-space: nowrap; }
.hm-hist-amt small { display: block; font-size: var(--fs-micro); font-weight: 500; color: var(--text-caption); }
.hm-tag { display: inline-block; padding: 0 5px; border-radius: 4px; font-size: 10px; font-weight: 700; line-height: 16px; vertical-align: 1px; }
.hm-tag--plan { background: var(--color-surface-sunken); color: var(--text-caption); }
.hm-tag--real { background: var(--color-save-subtle); color: var(--color-save); }

/* 설정 */
.hm-profile { display: flex; align-items: center; gap: var(--s3); padding: var(--s3); border-radius: var(--radius-md); background: var(--color-surface-sunken); }
.hm-avatar { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; background: var(--color-primary-subtle); color: var(--color-primary); font-weight: 700; font-size: var(--fs-title); }
.hm-profile-name { font-weight: 700; font-size: 14px; }
.hm-profile-mail { font-size: var(--fs-meta); color: var(--text-secondary); }
.hm-set-group { display: flex; flex-direction: column; }
.hm-set-title { padding: 0 var(--s1) var(--s1); font-size: var(--fs-micro); font-weight: 650; color: var(--text-caption); }
.hm-set-row {
  display: flex;
  align-items: center;
  gap: var(--s3);
  width: 100%;
  min-height: 44px;
  padding: 0 var(--s1);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  transition: background-color 0.15s;
}
button.hm-set-row:hover { background: var(--color-surface-sunken); }
button.hm-set-row:active { background: var(--color-border-subtle); }
.hm-set-row + .hm-set-row { box-shadow: inset 0 1px 0 var(--color-border-subtle); }
.hm-set-row:hover + .hm-set-row { box-shadow: none; }
.hm-set-ic { color: var(--text-secondary); }
.hm-set-label { flex: 1; min-width: 0; font-weight: 550; }
.hm-set-label small { display: block; font-size: var(--fs-micro); font-weight: 450; color: var(--text-caption); }
.hm-set-value { font-size: var(--fs-meta); color: var(--text-secondary); white-space: nowrap; }
.hm-set-row.is-danger, .hm-set-row.is-danger .hm-set-ic { color: var(--color-negative-ink); }
.hm-seg { display: inline-flex; padding: 2px; border-radius: var(--radius-pill); background: var(--color-surface-sunken); }
.hm-seg button { height: 26px; padding: 0 10px; border-radius: var(--radius-pill); font-size: var(--fs-meta); font-weight: 600; color: var(--text-secondary); }
.hm-seg button[aria-pressed="true"] { background: var(--color-surface); color: var(--text-primary); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08); }
.hm-dev { display: flex; gap: var(--s2); align-items: flex-start; padding: var(--s3); border-radius: var(--radius-md); background: color-mix(in srgb, var(--color-spend-subtle) 70%, transparent); font-size: var(--fs-meta); color: var(--text-secondary); line-height: 1.5; }
.hm-dev b { color: var(--color-spend-ink); }
.hm-dev-code { font-size: 15px; font-weight: 700; letter-spacing: 0.18em; color: var(--text-primary); }
.hm-set-pair { display: grid; grid-template-columns: 1fr 1fr; }
.hm-set-pair .hm-set-row + .hm-set-row { box-shadow: inset 1px 0 0 var(--color-border-subtle); }
.hm-set-pair .hm-set-row:hover + .hm-set-row { box-shadow: none; }
/* 약관 · 처리방침 · 라이선스 — 설정 맨 아래 한 줄 (처리방침은 굵게: 다른 안내와 구분해 표시) */
.hm-set-foot { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: var(--fs-micro); color: var(--text-caption); }
.hm-set-links { display: flex; flex-wrap: wrap; justify-content: center; }
.hm-set-links > * { padding: 4px 6px; border-radius: var(--radius-sm); color: var(--text-secondary); text-decoration: none; }
.hm-set-links > * + *::before { content: '·'; margin: 0 6px 0 -6px; color: var(--text-caption); pointer-events: none; }
.hm-set-links > *:hover { color: var(--text-primary); }
.hm-set-links b { font-weight: 700; color: var(--text-primary); }

/* ── 13. 로그인 · 가입 */
.hm-auth { padding-left: var(--s6); padding-right: var(--s6); padding-bottom: calc(var(--s5) + env(safe-area-inset-bottom)); }
.hm-auth-top { flex: none; display: flex; align-items: center; height: var(--header-h); margin-left: calc(var(--s2) * -1); }
.hm-auth-main { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; overflow-y: auto; }
.hm-auth-main > * + * { margin-top: var(--s4); } /* 인증 화면 세로 리듬 */
.hm-auth-main > .hm-auth-head + * { margin-top: var(--s6); }
.hm-auth-title { font-size: 22px; font-weight: 700; letter-spacing: -0.03em; }
.hm-auth-desc { font-size: var(--fs-body); color: var(--text-secondary); line-height: 1.6; }
.hm-auth-desc b { color: var(--text-primary); font-weight: 650; }
.hm-auth-foot { flex: none; display: flex; flex-direction: column; gap: var(--s2); padding-top: var(--s4); }
.hm-auth-link { align-self: center; height: 32px; padding: 0 var(--s2); font-size: var(--fs-meta); font-weight: 600; color: var(--text-secondary); border-radius: var(--radius-sm); }
.hm-auth-link b { color: var(--color-primary); font-weight: 650; }
.hm-auth-link:hover { background: var(--color-surface-sunken); }
.hm-auth-badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 8px; border-radius: var(--radius-pill); background: var(--color-primary-subtle); color: var(--color-primary); font-size: var(--fs-micro); font-weight: 700; }

.hm-welcome { flex: 1 1 auto; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.hm-welcome-name { margin-top: var(--s5); font-size: 28px; font-weight: 800; letter-spacing: -0.04em; }
.hm-welcome-kicker { margin-top: var(--s1); font-size: var(--fs-meta); font-weight: 650; color: var(--color-primary); letter-spacing: 0.08em; }
.hm-welcome-copy { margin-top: var(--s5); font-size: var(--fs-body); color: var(--text-secondary); line-height: 1.7; }
.hm-welcome-points { display: flex; gap: var(--s5); margin-top: var(--s6); }
.hm-welcome-point { display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: var(--fs-micro); font-weight: 600; color: var(--text-secondary); }
.hm-welcome-point i { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 11px; background: var(--color-surface); color: var(--color-primary); box-shadow: inset 0 0 0 1px var(--color-border-subtle); }

.hm-otp { position: relative; display: block; }
.hm-otp-input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  border: 0;
  font-size: 16px;
  caret-color: transparent;
}
.hm-otp-boxes { display: grid; grid-template-columns: repeat(6, 1fr); gap: var(--s2); pointer-events: none; }
.hm-otp-box {
  display: grid;
  place-items: center;
  height: 52px;
  border-radius: var(--radius-md);
  background: var(--color-surface);
  box-shadow: inset 0 0 0 1px var(--color-border);
  font-size: 22px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  transition: box-shadow 0.15s;
}
.hm-otp.is-focus .hm-otp-box.is-active { box-shadow: inset 0 0 0 1.5px var(--color-primary), var(--focus-ring); }
.hm-otp.is-error .hm-otp-box { box-shadow: inset 0 0 0 1.5px var(--color-negative); }
.hm-otp-meta { display: flex; align-items: center; justify-content: space-between; font-size: var(--fs-meta); color: var(--text-secondary); }
.hm-otp-meta .hm-tone-neg { font-weight: 650; }

/* ── 14. 토스트 · 스플래시 */
.hm-toast-root { position: absolute; left: 0; right: 0; bottom: calc(var(--tabbar-h) + 84px + env(safe-area-inset-bottom)); z-index: 60; display: flex; justify-content: center; pointer-events: none; padding: 0 var(--gutter); }
.hm-toast {
  max-width: 100%;
  padding: 10px 16px;
  border-radius: var(--radius-pill);
  background: color-mix(in srgb, var(--text-primary) 92%, transparent);
  color: var(--color-surface);
  font-size: var(--fs-meta);
  font-weight: 600;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.2s, transform 0.2s var(--ease-out);
}
.hm-toast.is-show { opacity: 1; transform: none; }
.hm-toast.is-error { background: var(--color-negative-ink); color: #fff; }
.hm-splash { align-items: center; justify-content: center; gap: var(--s4); }
.hm-splash-msg { font-size: var(--fs-meta); color: var(--text-secondary); }

@media (max-width: 374px) {
  :root { --gutter: 16px; }
  .hm-grid { --cols: minmax(0, 1fr) 84px 34px; }
  .hm-grid--rec { --cols: minmax(0, 1fr) 64px 76px 40px; }
  .hm-grid-head, .hm-grid-group, .hm-grid-row { column-gap: 6px; padding: 0 6px; }
  .hm-grid-name { gap: 6px; }
  .hm-rec-actual { padding: 3px 5px; }
  .hm-auth { padding-left: var(--s5); padding-right: var(--s5); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}
.hm-card--list > .hm-card-head { padding: var(--s1) var(--s1) var(--s2); }
.hm-amt-fields--single { grid-template-columns: 1fr; }
.hm-auth-head > * + * { margin-top: var(--s2); }
.hm-auth-links { display: flex; flex-wrap: wrap; justify-content: center; gap: var(--s1); }
.hm-note-center { text-align: center; }
.hm-form-stack { display: flex; flex-direction: column; gap: var(--s3); }
.hm-profile-text { flex: 1; min-width: 0; }
.hm-auth .hm-btn--soft { background: var(--color-surface); box-shadow: inset 0 0 0 1px var(--color-border-subtle); }
.hm-auth .hm-btn--soft:hover:not(:disabled) { background: var(--color-surface-sunken); }

/* 필수 동의 */
.hm-consent { display: flex; flex-direction: column; gap: var(--s2); padding: var(--s3); border-radius: var(--radius-md); background: var(--color-surface); box-shadow: inset 0 0 0 1px var(--color-border-subtle); }
.hm-check { display: flex; align-items: center; gap: var(--s2); font-size: var(--fs-meta); color: var(--text-secondary); cursor: pointer; }
.hm-check input { flex: none; width: 18px; height: 18px; margin: 0; accent-color: var(--color-primary); }
.hm-check a { margin-left: var(--s1); color: var(--color-primary); font-weight: 600; }

/* ── 15. 펼쳐지는 메뉴 */
.hm-head-back { margin-left: calc(var(--s2) * -1); }
.hm-icon-btn.is-on { background: var(--color-surface); color: var(--text-primary); box-shadow: inset 0 0 0 1px var(--color-border-subtle); }
.hm-menu-scrim { position: absolute; inset: 0; z-index: 30; background: color-mix(in srgb, var(--color-scrim) 45%, transparent); animation: hm-fade 0.18s ease; }
.hm-menu {
  position: absolute;
  z-index: 31;
  top: calc(env(safe-area-inset-top) + var(--header-h) - var(--s1));
  right: var(--gutter);
  width: min(300px, calc(100% - var(--gutter) * 2));
  padding: var(--s2);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
  box-shadow: 0 0 0 1px var(--color-border-subtle), 0 16px 40px rgba(19, 20, 21, 0.16);
  transform-origin: top right;
  animation: hm-menu-in 0.22s var(--ease-out);
}
@keyframes hm-menu-in {
  from { opacity: 0; transform: translateY(-6px) scale(0.97); clip-path: inset(0 0 55% 0 round 16px); }
  to { opacity: 1; transform: none; clip-path: inset(0 0 0 0 round 16px); }
}
@keyframes hm-fade { from { opacity: 0; } }
.hm-menu-item {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) 16px;
  align-items: center;
  gap: var(--s3);
  width: 100%;
  min-height: 56px;
  padding: var(--s2);
  border-radius: var(--radius-md);
  text-align: left;
  transition: background-color 0.15s;
}
.hm-menu-item:hover { background: var(--color-surface-sunken); }
.hm-menu-item:active { background: var(--color-border-subtle); }
.hm-menu-ic { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: var(--color-primary-subtle); color: var(--color-primary); }
.hm-menu-text { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.hm-menu-text b { font-size: 14px; font-weight: 650; }
.hm-menu-text small { font-size: var(--fs-micro); color: var(--text-caption); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hm-menu-go { color: var(--text-caption); }
.hm-menu-foot { display: flex; gap: var(--s1); margin-top: var(--s1); padding: var(--s2) var(--s1) 0; border-top: 1px solid var(--color-border-subtle); }
.hm-menu-foot button { padding: var(--s1) 6px; border-radius: 6px; font-size: var(--fs-micro); color: var(--text-caption); }
.hm-menu-foot button:hover { background: var(--color-surface-sunken); color: var(--text-secondary); }
.hm-menu-foot b { font-weight: 700; color: var(--text-secondary); }

/* ── 16. 보유자산 점-선 그래프 */
.hm-asset { padding-bottom: var(--s3); }
.hm-trend { margin-top: var(--s2); }
.hm-trend-plot { position: relative; height: 84px; }
.hm-trend-svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.hm-trend-line { fill: none; stroke: var(--color-save); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.hm-trend-base { stroke: var(--color-border); stroke-width: 1; stroke-dasharray: 3 3; }
.hm-trend-stop-a { stop-color: var(--color-save); stop-opacity: 0.16; }
.hm-trend-stop-b { stop-color: var(--color-save); stop-opacity: 0; }
.hm-trend-dot { position: absolute; display: grid; place-items: center; width: 26px; height: 26px; margin: -13px 0 0 -13px; border-radius: 50%; }
.hm-trend-dot i { display: block; width: 7px; height: 7px; border-radius: 50%; background: var(--color-surface); box-shadow: 0 0 0 2px var(--color-save); transition: transform 0.15s; }
.hm-trend-dot.is-down i { box-shadow: 0 0 0 2px var(--color-negative); }
.hm-trend-dot.is-sel i { width: 9px; height: 9px; background: var(--color-save); box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-save) 28%, transparent); }
.hm-trend-dot.is-sel.is-down i { background: var(--color-negative); box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-negative) 28%, transparent); }
.hm-trend-dot:hover i { transform: scale(1.25); }
.hm-trend-tip {
  position: absolute;
  z-index: 1;
  transform: translate(-50%, calc(-100% - 10px));
  padding: 2px 8px;
  border-radius: 8px;
  background: var(--color-surface);
  box-shadow: 0 0 0 1px var(--color-border-subtle), 0 4px 12px rgba(19, 20, 21, 0.1);
  font-size: var(--fs-micro);
  color: var(--text-secondary);
  white-space: nowrap;
  pointer-events: none;
}
.hm-trend-tip b { font-weight: 700; color: var(--text-primary); }
.hm-trend-tip em { font-style: normal; font-weight: 700; }
.hm-trend-tip.is-left { transform: translate(-12%, calc(-100% - 10px)); }
.hm-trend-tip.is-right { transform: translate(-88%, calc(-100% - 10px)); }
.hm-trend-tip.is-below { transform: translate(-50%, 12px); }
.hm-trend-tip.is-left.is-below { transform: translate(-12%, 12px); }
.hm-trend-tip.is-right.is-below { transform: translate(-88%, 12px); }
.hm-trend-x { position: relative; height: 14px; margin-top: 2px; }
.hm-trend-x span { position: absolute; transform: translateX(-50%); font-size: 10px; color: var(--text-caption); white-space: nowrap; }
.hm-trend-x span.is-sel { color: var(--text-primary); font-weight: 650; }
.hm-trend-x span.is-empty { opacity: 0.45; } /* 기록을 시작하기 전 달 */
.hm-asset .hm-stack { height: 6px; margin-top: var(--s2); }

/* 한 화면 맞춤: 저축·구독 목록 행도 공간이 모자라면 줄어든다 */
.hm-scroll--fit > .hm-sav-row, .hm-scroll--fit > .hm-sub-row { flex: 1 1 52px; min-height: 42px; max-height: 56px; padding-top: 2px; padding-bottom: 2px; }

/* 저축 상세 막대: 줄어든 달은 아래로 */
.hm-bars-area { position: relative; flex: 1 1 auto; width: 100%; max-width: 22px; }
.hm-bars-area .hm-bars-bar { position: absolute; left: 0; right: 0; width: auto; max-width: none; min-height: 2px; }
.hm-bars-bar.is-down { background: var(--color-negative); border-radius: 2px 2px 4px 4px; }
.hm-tag--adj { background: var(--color-spend-subtle); color: var(--color-spend-ink); }

/* ── 17. 정기구독 */
.hm-subs-due { display: flex; align-items: center; justify-content: space-between; gap: var(--s2); margin-top: 2px; }
.hm-subs-due-value { font-size: var(--fs-hero); font-weight: 700; letter-spacing: -0.025em; }
.hm-subs-due-value small { margin-left: 2px; font-size: var(--fs-title); font-weight: 600; }
.hm-subs-strip { position: relative; height: 22px; margin-top: 20px; }
.hm-subs-track { position: absolute; left: 0; right: 0; top: 50%; height: 4px; margin-top: -2px; border-radius: 2px; background: var(--color-surface-sunken); box-shadow: inset 0 0 0 1px var(--color-border-subtle); }
.hm-subs-done { position: absolute; left: 0; top: 50%; height: 4px; margin-top: -2px; border-radius: 2px; background: color-mix(in srgb, var(--color-save) 30%, transparent); }
.hm-subs-mark { position: absolute; top: 50%; width: 10px; height: 10px; margin: -5px 0 0 -5px; border-radius: 50%; background: var(--c); box-shadow: 0 0 0 2px var(--color-surface); }
.hm-subs-mark.is-done { opacity: 0.35; }
.hm-subs-today { position: absolute; top: 0; bottom: 0; width: 2px; margin-left: -1px; border-radius: 1px; background: var(--text-primary); }
.hm-subs-today em { position: absolute; top: -15px; left: 50%; transform: translateX(-50%); font-style: normal; font-size: 10px; font-weight: 650; color: var(--text-primary); white-space: nowrap; }
.hm-subs-scale { display: flex; justify-content: space-between; margin-top: 2px; font-size: 10px; color: var(--text-caption); }
/* 다음 결제 오늘(D-n) ……… 그날 나가는 총액 */
.hm-subs-next { display: flex; align-items: center; gap: 6px; margin-top: var(--s3); font-size: var(--fs-meta); color: var(--text-secondary); white-space: nowrap; }
.hm-subs-next-amt { margin-left: auto; font-weight: 650; color: var(--text-primary); }
.hm-subs-dday { font-weight: 650; color: var(--text-secondary); }
.hm-subs-dday.is-soon { color: var(--color-spend-ink); }
.hm-sub-row {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--s3);
  width: 100%;
  min-height: 48px;
  padding: var(--s1);
  border-top: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-sm);
  text-align: left;
  transition: background-color 0.15s;
}
.hm-sub-row:first-child { border-top-color: transparent; }
.hm-sub-row:hover { background: var(--color-surface-sunken); }
.hm-sub-row:active { background: var(--color-border-subtle); }
.hm-sub-row.is-paused { opacity: 0.5; }
.hm-sub-ic { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 10px; background: var(--c); color: #fff; font-size: 14px; font-weight: 700; }
.hm-sub-main, .hm-sub-side { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.hm-sub-side { align-items: flex-end; }
.hm-sub-name { font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hm-sub-sub, .hm-sub-per { font-size: var(--fs-micro); color: var(--text-caption); white-space: nowrap; }
.hm-sub-amt { font-weight: 650; white-space: nowrap; }
.hm-subs-cycle { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); }
.hm-subs-panel { display: flex; flex-direction: column; gap: var(--s2); min-height: 212px; }
.hm-subs-days { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.hm-subs-months { display: grid; grid-template-columns: repeat(6, 1fr); gap: 4px; }
/* 숫자를 칸 정중앙에: 안쪽 span 의 글자 상자를 숫자 높이(cap~기준선)로 잘라 위아래 여백 차이를 없앤 뒤 가운데 (flex 칸 자체에는 trim 이 안 먹는다) */
.hm-subs-pick { display: grid; place-items: center; height: 30px; line-height: 1; border-radius: var(--radius-sm); background: var(--color-surface-sunken); font-size: var(--fs-body); font-weight: 550; font-variant-numeric: tabular-nums; color: var(--text-secondary); transition: background-color 0.12s, color 0.12s; }
.hm-subs-pick > span { display: block; text-box: trim-both cap alphabetic; }
/* text-box 를 모르는 브라우저(구형 삼성 인터넷 등): 줄 상자 가운데면 숫자가 1.3px 떠 보여서 그만큼 내린다 (Pretendard 기준 0.1em) */
@supports not (text-box: trim-both cap alphabetic) { .hm-subs-pick > span { transform: translateY(0.1em); } }
.hm-subs-pick:hover { background: var(--color-border-subtle); color: var(--text-primary); }
.hm-subs-pick[aria-pressed="true"] { background: var(--color-primary); color: var(--color-on-primary); }

/* ── 18. 약관 · 탈퇴 */
.hm-sheet--tall { height: calc(100% - var(--s6) - env(safe-area-inset-top)); }
.hm-legal { font-size: var(--fs-body); line-height: 1.65; color: var(--text-secondary); }
.hm-legal h2 { margin: var(--s4) 0 var(--s1); font-size: 14px; color: var(--text-primary); }
.hm-legal h2:first-child { margin-top: 0; }
.hm-legal p, .hm-legal ul, .hm-legal ol, .hm-legal table { margin: 0 0 var(--s2); }
.hm-legal ul, .hm-legal ol { padding-left: 18px; }
.hm-legal ul { list-style: disc; }
.hm-legal ol { list-style: decimal; }
.hm-legal .meta { font-size: var(--fs-micro); color: var(--text-caption); }
.hm-legal strong { color: var(--text-primary); }
.hm-legal table { width: 100%; border-collapse: collapse; font-size: var(--fs-meta); }
.hm-legal th, .hm-legal td { padding: 6px 8px; border-bottom: 1px solid var(--color-border-subtle); text-align: left; vertical-align: top; }
.hm-legal th { color: var(--text-primary); font-weight: 650; white-space: nowrap; }
.hm-legal mark { padding: 0 4px; border-radius: 4px; background: #FFF3C4; color: #131415; }
.hm-withdraw-warn { display: flex; gap: var(--s2); align-items: flex-start; padding: var(--s3); border-radius: var(--radius-md); background: var(--color-negative-subtle); color: var(--color-negative-ink); font-size: var(--fs-meta); line-height: 1.55; }
.hm-withdraw-warn p { color: var(--text-secondary); }
.hm-withdraw-warn b { color: var(--color-negative-ink); }
.hm-sheet-body > .hm-btn--sm { align-self: flex-start; }

/* ── 낮은 폰(세로 760px 이하): 줄 높이 · 여백을 줄여 스크롤 없이 한 화면에 (맨 끝에 둬야 앞 규칙을 덮는다) */
@media (max-height: 760px) {
  :root { --row-h: 32px; --row-min: 22px; --group-h: 26px; --header-h: 48px; --tabbar-h: 52px; }
  .hm-total { min-height: 54px; margin-top: var(--s2); margin-bottom: var(--s2); }
  .hm-key { height: 42px; }
  .hm-card { padding: var(--s3) 14px; }
  .hm-card--list { padding: var(--s1) var(--s3) var(--s2); }
  .hm-grid-head { height: 20px; }
  .hm-trend-plot { height: 72px; }
  .hm-rec-actual { padding-top: 1px; padding-bottom: 1px; }
  .hm-pill { height: 18px; }
  /* 시트 */
  .hm-set-row { min-height: 40px; }
  .hm-profile, .hm-dev { padding-top: var(--s2); padding-bottom: var(--s2); }
  .hm-sheet-body > * + * { margin-top: var(--s2); }
  .hm-sheet-body > .hm-sheet-foot { margin-top: var(--s3); }
}
