/* 우리살림 앱 화면 공통 스타일 (가입·초대 등) */
:root {
  --blue: #275eea;
  --blue-dark: #1d47b8;
  --blue-soft: #eaf0ff;
  --ink: #17253a;
  --muted: #6b7890;
  --line: #dbe3ef;
  --bg: #f6f8fb;
  --white: #fff;
  --red: #d93c3c;
  --green: #16a36a;
  color-scheme: light;
}
* { box-sizing: border-box; }
body {
  margin: 0; min-height: 100vh; background: var(--bg); color: var(--ink);
  font-family: 'Pretendard Variable', Pretendard, -apple-system, 'Apple SD Gothic Neo', 'Malgun Gothic', sans-serif;
  line-height: 1.55; word-break: keep-all; -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
h1, h2, p { margin: 0; }
button, input { font: inherit; }
:focus-visible { outline: 3px solid #9db8ff; outline-offset: 2px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

.top { max-width: 480px; margin: 0 auto; padding: 16px; display: flex; align-items: center; gap: 8px; }
.back { display: inline-flex; align-items: center; gap: 6px; text-decoration: none; font-weight: 700; padding: 8px 10px 8px 4px; border: 0; background: none; color: var(--ink); cursor: pointer; }
.logo { margin-left: auto; font-weight: 800; color: var(--blue-dark); text-decoration: none; }

main { max-width: 480px; margin: 0 auto; padding: 0 16px 48px; }
.demo { background: #fff7e0; border: 1px solid #f3dc9a; color: #7a5a00; border-radius: 12px; padding: 10px 14px; font-size: 13px; margin-bottom: 18px; }

.stepper { display: flex; gap: 6px; margin-bottom: 22px; padding: 0; list-style: none; }
.stepper li { flex: 1; font-size: 12px; font-weight: 700; color: var(--muted); }
.stepper li::before { content: ''; display: block; height: 4px; border-radius: 99px; background: #e2e8f1; margin-bottom: 8px; }
.stepper li.on { color: var(--blue); }
.stepper li.on::before { background: var(--blue); }

.card { background: var(--white); border: 1px solid #e7ecf2; border-radius: 20px; box-shadow: 0 8px 28px rgba(35, 53, 85, .05); padding: 28px 22px; }
h1 { font-size: 24px; font-weight: 800; letter-spacing: -0.02em; }
.sub { color: var(--muted); margin-top: 6px; font-size: 15px; }

form { display: grid; gap: 18px; margin-top: 24px; }
.field label { display: block; font-weight: 700; font-size: 14px; margin-bottom: 6px; }
.field input { width: 100%; border: 1px solid var(--line); border-radius: 12px; padding: 13px 14px; background: var(--white); font-size: 16px; }
.field input:focus { border-color: var(--blue); outline: none; box-shadow: 0 0 0 3px var(--blue-soft); }
.field input[aria-invalid="true"] { border-color: var(--red); }
.hint { font-size: 13px; color: var(--muted); margin-top: 6px; }
.error { font-size: 13px; color: var(--red); margin-top: 6px; }
.error:empty { display: none; }
.pw-wrap { position: relative; }
.pw-wrap input { padding-right: 64px; }
.pw-toggle { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); border: 0; background: none; color: var(--muted); font-size: 13px; font-weight: 700; padding: 8px; cursor: pointer; }
.rules { display: flex; gap: 12px; flex-wrap: wrap; margin: 8px 0 0; padding: 0; list-style: none; font-size: 13px; color: var(--muted); }
.rules li::before { content: '○ '; }
.rules li.ok { color: var(--green); }
.rules li.ok::before { content: '● '; }

fieldset.consent { border: 1px solid var(--line); border-radius: 14px; padding: 6px 14px; margin: 0; }
.consent legend { font-weight: 700; font-size: 14px; padding: 0 4px; }
.check { display: flex; align-items: center; gap: 10px; padding: 10px 0; font-size: 14px; }
.check + .check { border-top: 1px solid #eef2f7; }
.check input { width: 20px; height: 20px; accent-color: var(--blue); flex: none; margin: 0; }
.check.all { font-weight: 800; }
.req { color: var(--blue); font-weight: 700; }
.opt { color: var(--muted); font-weight: 700; }
.check a { margin-left: auto; font-size: 13px; color: var(--muted); }

.btn { width: 100%; display: inline-flex; justify-content: center; align-items: center; border: 0; border-radius: 14px; padding: 16px 20px; font-weight: 800; font-size: 16px; cursor: pointer; text-decoration: none; }
.btn-primary { background: var(--blue); color: var(--white); }
.btn-primary:hover { background: var(--blue-dark); }
.btn-primary:disabled { background: #b7c6ee; cursor: not-allowed; }
.btn-ghost { background: var(--blue-soft); color: var(--blue); }
.under { text-align: center; font-size: 14px; color: var(--muted); margin-top: 16px; }

.trial-box { background: var(--blue-soft); border-radius: 14px; padding: 16px; font-size: 14px; }
.trial-box b { color: var(--blue-dark); }
.trial-box ul { margin: 8px 0 0; padding-left: 18px; color: #3d4c66; }

.done-icon { width: 56px; height: 56px; border-radius: 18px; background: var(--blue-soft); display: grid; place-items: center; font-size: 28px; margin-bottom: 18px; }
.dates { margin: 22px 0; border: 1px solid #e7ecf2; border-radius: 14px; overflow: hidden; }
.dates div { display: flex; justify-content: space-between; gap: 12px; padding: 14px 16px; font-size: 15px; }
.dates div + div { border-top: 1px solid #eef2f7; }
.dates dt { color: var(--muted); white-space: nowrap; }
.dates dd { margin: 0; font-weight: 700; text-align: right; }
.dates .left dd { color: var(--blue); }
.space-chip { display: inline-flex; align-items: center; gap: 6px; background: var(--bg); border-radius: 99px; padding: 6px 12px; font-weight: 700; margin-top: 14px; }
.next { display: grid; gap: 10px; margin-top: 8px; }
.next-note { font-size: 13px; color: var(--muted); text-align: center; margin-top: 4px; }

[hidden] { display: none !important; }
.toast { position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); background: var(--ink); color: var(--white); padding: 12px 18px; border-radius: 12px; font-size: 14px; z-index: 40; max-width: calc(100% - 32px); box-shadow: 0 10px 30px rgba(0, 0, 0, .2); }

.loading { text-align: center; color: var(--muted); padding: 40px 0; }
.points { margin: 18px 0 0; padding: 0; list-style: none; display: grid; gap: 8px; font-size: 14px; color: #3d4c66; }
.points li::before { content: '✓ '; color: var(--blue); font-weight: 800; }
.linkish { border: 0; background: none; padding: 0; color: var(--muted); text-decoration: underline; font-size: 14px; cursor: pointer; }
.linkish.danger { color: var(--red); }
.btn[aria-busy="true"] { opacity: .7; cursor: progress; }
.error a { color: inherit; font-weight: 700; }

/* 금액 입력 (원 단위) */
.won { position: relative; }
.won input { padding-right: 40px; text-align: right; font-weight: 700; }
.won span { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); font-weight: 700; }

/* 앱 공통 머리·월 이동·아래 메뉴 (홈·정산·예산) */
.space { font-weight: 800; font-size: 18px; }
.top .settings { margin-left: auto; font-size: 14px; font-weight: 700; color: var(--muted); text-decoration: none; padding: 8px; }
.month { display: flex; align-items: center; justify-content: space-between; margin: 4px 0 12px; }
.month h1 { font-size: 20px; }
.month button { width: 40px; height: 40px; border-radius: 12px; border: 1px solid var(--line); background: var(--white); font-size: 16px; cursor: pointer; }
.month button:disabled { opacity: .35; cursor: default; }
.tabs { position: fixed; left: 0; right: 0; bottom: 0; background: var(--white); border-top: 1px solid #e7ecf2; z-index: 10; padding-bottom: env(safe-area-inset-bottom); }
.tabs ul { max-width: 480px; margin: 0 auto; padding: 0; list-style: none; display: grid; grid-template-columns: repeat(4, 1fr); }
.tabs a { display: block; text-align: center; padding: 14px 0; font-size: 13px; font-weight: 700; color: var(--muted); text-decoration: none; }
.tabs a[aria-current="page"] { color: var(--blue); }

/* 약관·처리방침 문서 */
.doc { max-width: 720px; }
.doc .draft { background: #fff7e0; border: 1px solid #f3dc9a; color: #6b4f00; border-radius: 12px; padding: 12px 14px; font-size: 14px; margin-bottom: 18px; }
.doc h1 { font-size: 26px; margin-bottom: 4px; }
.doc .meta { color: var(--muted); font-size: 14px; margin-bottom: 20px; }
.doc h2 { font-size: 18px; font-weight: 800; margin: 28px 0 8px; }
.doc p, .doc li { font-size: 15px; color: #2b3a52; line-height: 1.75; }
.doc p + p { margin-top: 8px; }
.doc ol, .doc ul { padding-left: 22px; margin: 6px 0; }
.doc table { width: 100%; border-collapse: collapse; font-size: 14px; margin: 8px 0; }
.doc th, .doc td { border: 1px solid var(--line); padding: 8px 10px; text-align: left; vertical-align: top; }
.doc th { background: var(--bg); font-weight: 700; }
.doc mark.fill { background: #ffe8a3; color: #5a4300; border-radius: 4px; padding: 0 4px; font-weight: 700; }
.doc .toc { background: var(--white); border: 1px solid #e7ecf2; border-radius: 14px; padding: 14px 18px; }
.doc .toc ol { columns: 2; column-gap: 24px; margin: 0; }
@media (max-width: 520px) { .doc .toc ol { columns: 1; } }
.doc .toc a { color: var(--ink); text-decoration: none; font-size: 14px; }

/* 홈 화면 설치 안내 (pwa.js) */
.install h2 { font-size: 16px; font-weight: 800; margin-bottom: 10px; }
.install-body { display: flex; align-items: center; gap: 12px; }
.install-body img { border-radius: 12px; flex: none; }
.install-body p { margin: 0; font-size: 14px; line-height: 1.6; color: #3d4c66; }
.install-actions { display: flex; flex-direction: column; align-items: center; gap: 10px; margin-top: 14px; }
.install-banner { background: var(--white); border: 1px solid #dfe7fb; border-radius: 16px; padding: 14px 16px; margin-bottom: 12px; }
.install-banner .btn { padding: 12px 16px; font-size: 15px; }

/* 우리살림 아이콘 (◈ 대신) */
.space, .logo { display: inline-flex; align-items: center; gap: 7px; }
.mark { flex: none; border-radius: 6px; }
.mark.sm { border-radius: 5px; vertical-align: -3px; margin-right: 2px; }
