/* 4070 총무를 위한 큰 글씨·큰 버튼. 본문 17px, 누르는 곳 48px 이상.
   색: 네이비(브랜드), 입금 파랑, 출금·미납 빨강. */
:root {
  --bg: #f1f3f5; --card: #fff; --ink: #191c1f; --sub: #5c6570; --line: #e3e7eb; --soft: #f5f7f8;
  --brand: #1d3a6b; --brand-2: #152c53; --brand-soft: #e6ecf5; --brand-ink: #fff;
  --in: #1f5fd1; --in-soft: #e8f0fd; --out: #c2302a; --out-soft: #fdecea; --ok: #127050; --ok-soft: #e2f4ec;
  --shadow: 0 1px 2px rgba(20, 30, 40, .05), 0 6px 18px rgba(20, 30, 40, .05);
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 17px/1.55 "Pretendard Variable", Pretendard, "Noto Sans KR", "Malgun Gothic", system-ui, sans-serif; padding-bottom: 96px; -webkit-text-size-adjust: 100%; }
a { color: var(--brand); }
main { max-width: 760px; margin: 0 auto; padding: 14px 16px 24px; }

/* 상단 바 */
.bar { background: var(--brand); color: #fff; padding-top: env(safe-area-inset-top); }
.bar-in { max-width: 760px; margin: 0 auto; padding: 18px 16px; display: flex; align-items: center; gap: 8px; }
.bar h1 { font-size: 22px; line-height: 1.3; margin: 0; font-weight: 800; letter-spacing: -.3px; }
.bar p { margin: 2px 0 0; font-size: 14px; opacity: .85; }
.bar .back { color: #fff; display: grid; place-items: center; width: 44px; height: 44px; margin-left: -10px; border-radius: 50%; }

h2 { font-size: 18px; margin: 22px 2px 10px; font-weight: 800; letter-spacing: -.2px; display: flex; align-items: baseline; gap: 8px; }
h2 small { font-weight: 600; font-size: 15px; color: var(--sub); margin-left: auto; }
h3 { font-size: 15px; margin: 14px 0 6px; color: var(--sub); font-weight: 700; }
.card { background: var(--card); border-radius: 18px; padding: 18px; margin: 12px 0; box-shadow: var(--shadow); }
.card h2 { margin: 0 0 8px; }
.card.off { opacity: .55; }
.note { color: var(--sub); font-size: 15px; margin: 8px 2px; }
.msg { background: #fff7db; border-radius: 14px; padding: 13px 16px; margin: 4px 0 12px; font-weight: 600; }
.ok { color: var(--ok); font-weight: 700; }
.warn { color: var(--out); font-weight: 700; }

/* 입력 */
label { display: block; margin: 14px 0; font-weight: 700; font-size: 15px; }
label small { font-weight: 500; color: var(--sub); }
input, select, textarea { display: block; width: 100%; margin-top: 6px; padding: 12px 14px; min-height: 50px; font: inherit; font-size: 17px; font-weight: 500; border: 1.5px solid #cfd6dc; border-radius: 12px; background: #fff; color: inherit; }
input:focus, select:focus, textarea:focus { outline: 0; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
input[type=radio], input[type=checkbox] { display: inline-block; width: 22px; height: 22px; min-height: 0; margin: 0 8px 0 0; padding: 0; accent-color: var(--brand); flex: 0 0 auto; }
input[type=file] { padding: 10px; }
input[readonly], textarea[readonly] { background: var(--soft); border-color: var(--line); font-size: 15px; color: var(--sub); }
.pick { font-weight: 600; font-size: 17px; min-height: 48px; display: flex; align-items: center; margin: 4px 0; }
.pick small { margin-left: 8px; }
fieldset { border: 0; padding: 0; margin: 0 0 8px; }
legend { font-weight: 800; padding: 0; }
.btn { display: flex; align-items: center; justify-content: center; gap: 6px; width: 100%; min-height: 54px; margin: 12px 0; padding: 13px 16px; border: 0; border-radius: 14px; background: var(--brand); color: var(--brand-ink); font: inherit; font-weight: 800; text-align: center; text-decoration: none; cursor: pointer; }
.btn:active { background: var(--brand-2); }
.btn.ghost { background: #fff; color: var(--brand); box-shadow: inset 0 0 0 1.5px #bcc8dc; }
.btn.kakao { background: #fee500; color: #191600; }
.row { display: flex; gap: 10px; align-items: center; }
.row > * { flex: 1; }
.row.wrap { flex-wrap: wrap; align-items: flex-end; }
.row.wrap > .pick { flex: 0 0 auto; margin-bottom: 14px; }
.row .btn { margin: 6px 0; }

/* 펼침 */
details > summary { cursor: pointer; min-height: 48px; display: flex; align-items: center; gap: 10px; font-weight: 700; list-style: none; }
details > summary::-webkit-details-marker { display: none; }
details > summary::after { content: ""; margin-left: auto; width: 10px; height: 10px; border-right: 2.2px solid var(--sub); border-bottom: 2.2px solid var(--sub); transform: rotate(45deg); flex: 0 0 auto; transition: transform .15s; }
details[open] > summary::after { transform: rotate(-135deg); }
details summary span { color: var(--sub); font-weight: 500; font-size: 15px; }
details.card { padding: 6px 18px; }
details.card[open] { padding-bottom: 14px; }
.card details { border-top: 1px solid var(--line); }
.card > h2 + details { border-top: 0; }
details.add > summary { color: var(--brand); }
details.add > summary::before { content: "+"; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--brand-soft); font-size: 22px; font-weight: 700; line-height: 1; }

/* 목록 */
.list { list-style: none; padding: 0; margin: 10px 0; }
.list a { display: flex; justify-content: space-between; align-items: center; gap: 12px; min-height: 66px; padding: 14px 18px; margin: 10px 0; background: var(--card); border-radius: 18px; box-shadow: var(--shadow); text-decoration: none; color: inherit; }
.list b { font-weight: 700; }
.list span { color: var(--sub); font-size: 14px; text-align: right; }
.list a::after { content: ""; width: 9px; height: 9px; border-right: 2px solid #b4bcc4; border-top: 2px solid #b4bcc4; transform: rotate(45deg); flex: 0 0 auto; }
.list a > span { margin-left: auto; }

/* 잔액 카드 */
.hero { background: var(--card); border-radius: 22px; padding: 22px 20px 16px; margin: 4px 0 12px; box-shadow: var(--shadow); }
.hero .lbl { color: var(--sub); font-size: 15px; display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.hero .amt { font-size: 34px; font-weight: 800; letter-spacing: -.8px; margin: 2px 0 12px; font-variant-numeric: tabular-nums; }
.badge { display: inline-block; padding: 4px 11px; border-radius: 999px; font-size: 13px; font-weight: 700; background: var(--soft); color: var(--sub); white-space: nowrap; }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.bad { background: var(--out-soft); color: var(--out); }
.badge.role { background: var(--brand-soft); color: var(--brand); }

/* 3칸 요약 */
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); background: var(--card); border-radius: 18px; box-shadow: var(--shadow); margin: 12px 0; padding: 14px 0; }
.stats.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.stats div { text-align: center; padding: 2px 6px; border-left: 1px solid var(--line); }
.stats div:first-child { border-left: 0; }
.stats span { display: block; color: var(--sub); font-size: 13px; }
.stats b { font-size: 18px; font-weight: 800; font-variant-numeric: tabular-nums; word-break: keep-all; }
.c-in { color: var(--in); } .c-out { color: var(--out); } .c-ok { color: var(--ok); }

/* 결산 요약 */
.sum { background: var(--card); border-radius: 18px; box-shadow: var(--shadow); padding: 8px 18px; margin: 12px 0; }
.sum div { display: flex; justify-content: space-between; align-items: center; padding: 9px 0; }
.sum div b { font-variant-numeric: tabular-nums; font-weight: 700; }
.sum .total { border-top: 1px solid var(--line); margin-top: 4px; padding-top: 12px; color: var(--brand); font-weight: 800; }
.sum .total b { font-size: 24px; font-weight: 800; }

/* 탭 */
.tabs { display: flex; background: var(--card); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; max-width: 760px; margin: 0 auto; }
.tabs a { flex: 1; text-align: center; padding: 14px 4px; min-height: 52px; text-decoration: none; color: var(--sub); font-weight: 700; }
.tabs a.on { color: var(--brand); background: var(--brand-soft); box-shadow: inset 0 -3px 0 var(--brand); }
.tabs.bottom { position: fixed; top: auto; bottom: 0; left: 0; right: 0; max-width: none; border-top: 1px solid var(--line); border-bottom: 0; padding: 4px 4px calc(4px + env(safe-area-inset-bottom)); box-shadow: 0 -4px 16px rgba(20, 30, 40, .06); }
.tabs.bottom a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; padding: 6px 2px; min-height: 58px; font-size: 13px; border-radius: 12px; color: var(--sub); }
.tabs.bottom a.on { color: var(--brand); background: none; box-shadow: none; }
.tabs.bottom a.on svg { stroke-width: 2.3; }

/* 고르기·달 넘김 */
.chips { display: flex; gap: 6px; overflow-x: auto; margin: 4px 0 6px; padding: 5px; background: #e4e8eb; border-radius: 14px; }
.chips a { flex: 1 0 auto; text-align: center; padding: 10px 16px; min-height: 44px; border-radius: 10px; text-decoration: none; color: var(--sub); font-weight: 700; }
.chips a.on { background: var(--brand); color: var(--brand-ink); }
.pager { display: flex; justify-content: center; align-items: center; gap: 6px; margin: 14px 0 6px; }
.pager a { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; text-decoration: none; font-size: 0; }
.pager a::before { content: ""; width: 11px; height: 11px; border-left: 2.6px solid var(--brand); border-bottom: 2.6px solid var(--brand); transform: rotate(45deg); }
.pager a:last-child::before { transform: rotate(-135deg); }
.pager b { text-align: center; font-size: 20px; font-weight: 800; letter-spacing: -.3px; min-width: 170px; }
.pager-sub { text-align: center; color: var(--sub); font-size: 15px; margin: -4px 0 10px; }

/* 표(결산 보고) */
.tbl { width: 100%; border-collapse: separate; border-spacing: 0; background: var(--card); border-radius: 16px; overflow: hidden; font-size: 16px; box-shadow: var(--shadow); }
.tbl th, .tbl td { padding: 12px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl thead th { background: var(--soft); font-size: 13px; color: var(--sub); font-weight: 700; }
.tbl tfoot td { font-weight: 800; border-top: 1px solid var(--line); border-bottom: 0; background: var(--soft); }
.tbl td:first-child, .tbl th:first-child { white-space: nowrap; padding-left: 16px; }
.tbl td:last-child, .tbl th:last-child { padding-right: 16px; }
.tbl small { color: var(--sub); display: block; font-size: 13px; }
.tbl .date { color: var(--sub); font-size: 14px; font-variant-numeric: tabular-nums; }
.num { text-align: right !important; white-space: nowrap; font-variant-numeric: tabular-nums; font-weight: 700; }
.card > .tbl { box-shadow: none; border: 1px solid var(--line); }
.rc { display: inline-block; font-size: 13px; font-weight: 700; margin: 2px 4px 0 0; padding: 2px 9px; border-radius: 999px; background: var(--brand-soft); text-decoration: none; }
.inline { display: inline; }
.x { border: 0; background: none; color: var(--out); font: inherit; font-size: 14px; font-weight: 600; padding: 6px 4px; cursor: pointer; }
.x.go { color: var(--brand); }

/* 미납자 줄 */
.rows { list-style: none; margin: 0; padding: 0; }
.rows li { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.rows li:first-child { border-top: 0; }
.rows .dot { width: 40px; height: 40px; border-radius: 50%; background: var(--out-soft); color: var(--out); display: grid; place-items: center; font-weight: 800; flex: 0 0 auto; }
.rows .who { flex: 1; min-width: 0; }
.rows .who b { display: block; }
.rows .who span { color: var(--out); font-size: 14px; font-weight: 600; }
.rows .amt { font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap; }
.rows-total { display: flex; justify-content: space-between; padding: 12px 14px; margin-top: 6px; border-radius: 12px; background: var(--out-soft); color: var(--out); font-weight: 800; }
.avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; font-weight: 800; flex: 0 0 auto; }

/* 회비 표 */
.scroll { overflow-x: auto; border-radius: 16px; background: var(--card); margin: 8px 0 16px; box-shadow: var(--shadow); }
.grid { border-collapse: separate; border-spacing: 0; font-size: 15px; min-width: 100%; }
.grid th, .grid td { border-bottom: 1px solid var(--line); border-right: 1px solid var(--line); text-align: center; padding: 0; white-space: nowrap; }
.grid tr > :last-child { border-right: 0; }
.grid tbody tr:last-child > * { border-bottom: 0; }
.grid thead th { background: var(--soft); padding: 10px 6px; font-size: 13px; color: var(--sub); font-weight: 700; }
.grid thead th.now { color: var(--brand); background: var(--brand-soft); }
.grid tbody th { position: sticky; left: 0; background: var(--card); padding: 6px 12px; text-align: left; min-width: 84px; z-index: 1; font-weight: 700; }
.grid tbody th small { display: block; font-size: 12px; font-weight: 600; color: var(--brand); }
.grid td.c { min-width: 58px; height: 56px; color: #c3cad1; }
.grid td.c button { width: 100%; height: 56px; border: 0; background: none; font: inherit; color: inherit; cursor: pointer; padding: 0; }
.grid td.c i { display: block; font-style: normal; font-size: 12px; font-weight: 600; opacity: .8; line-height: 1.1; }
.grid td.paid { color: var(--in); font-weight: 800; }
.grid td.due { background: var(--out-soft); color: var(--out); font-weight: 700; }
.grid td.ex { background: var(--soft); color: var(--sub); font-weight: 600; }

/* 행사 */
.info { display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; margin: 12px 0; background: var(--card); border-radius: 18px; padding: 16px 18px; box-shadow: var(--shadow); }
.info dt { color: var(--sub); white-space: nowrap; font-size: 15px; }
.info dd { margin: 0; font-weight: 700; }
.people { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; }
.people span { background: var(--soft); border-radius: 999px; padding: 7px 13px; font-weight: 600; }
.people small { color: var(--sub); font-weight: 500; }
.vote { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.vote .btn { margin: 0; }
.vote .btn:first-child { grid-column: 1 / -1; }
.rules { white-space: pre-wrap; }
.crumb { margin: 0 0 6px; }
.crumb a { text-decoration: none; font-weight: 700; font-size: 15px; }

@media (max-width: 420px) {
  .stats.four { grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: 12px; }
  .stats.four div:nth-child(3) { border-left: 0; }
  .stats b { font-size: 16px; }
}
@media print {
  body { background: #fff; padding: 0; }
  .bar { background: #fff; color: #000; }
  .tabs, .noprint, details, .pager a, .x, .msg { display: none !important; }
  .card, .tbl, .sum, .stats { box-shadow: none; border: 1px solid #ccc; }
}

/* 관리자 초대·자료 */
.invite { background: var(--soft); border-radius: 12px; padding: 10px 12px; margin: 10px 0; }
.invite .note { margin: 0 0 4px; }
.list.plain a { box-shadow: none; background: var(--soft); min-height: 58px; margin: 8px 0; }
.rows .who { font-size: 14px; color: var(--sub); }
.rows .who b { font-size: 17px; color: var(--ink); }
.list .badge { margin-right: 4px; }
textarea { line-height: 1.5; }
.scroll-x { overflow-x: auto; border-radius: 16px; box-shadow: var(--shadow); }
.scroll-x .tbl { box-shadow: none; }
.tbl.tight th, .tbl.tight td { padding: 10px 6px; font-size: 14px; }
.tbl.tight td:first-child, .tbl.tight th:first-child { padding-left: 12px; }
.tbl.tight td:last-child, .tbl.tight th:last-child { padding-right: 12px; }

.trial { background: var(--out-soft); color: var(--out); border-radius: 12px; padding: 10px 14px; margin: 0 0 12px; font-size: 14px; font-weight: 700; }

/* 상단 바의 설정 톱니 */
.gearwrap { position: absolute; top: env(safe-area-inset-top); left: 0; right: 0; max-width: 760px; margin: 0 auto; height: 0; pointer-events: none; }
.gear { position: absolute; top: 14px; right: 10px; width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; color: #fff; pointer-events: auto; }
.gear.on { background: rgba(255, 255, 255, .18); }
.bar-in { padding-right: 64px; }

/* 납부율 막대 */
.meter { height: 10px; border-radius: 999px; background: #e4e8eb; overflow: hidden; margin: 6px 0 12px; }
.meter i { display: block; height: 100%; border-radius: 999px; background: var(--brand); }

/* 장부: 날짜별 묶음 */
.tx { background: var(--card); border-radius: 16px; box-shadow: var(--shadow); overflow: hidden; }
.tx .day { display: flex; justify-content: space-between; margin: 0; padding: 8px 16px; background: var(--soft); color: var(--sub); font-size: 14px; font-weight: 700; }
.tx ul { list-style: none; margin: 0; padding: 0 16px; }
.tx li { display: flex; align-items: flex-start; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.tx li:first-child { border-top: 0; }
.tx .dir { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; flex: 0 0 auto; }
.tx .dir.in { background: var(--in-soft); color: var(--in); }
.tx .dir.out { background: var(--out-soft); color: var(--out); }
.tx .what { flex: 1; min-width: 0; }
.tx .what b { display: block; font-weight: 600; }
.tx .what > span { color: var(--sub); font-size: 14px; margin-right: 6px; }
.tx .amt { font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tx-total { display: flex; justify-content: space-between; margin: 0; padding: 12px 16px; background: var(--soft); border-top: 1px solid var(--line); font-weight: 800; }
@media print { .gearwrap { display: none; } .tx { box-shadow: none; border: 1px solid #ccc; } }
.tbl.wrap td:first-child { white-space: normal; }
