/* 얼리네 가계부 — 폰 세로 화면 기준. 색은 PC 앱 SkyPalette 의 하늘색 계열을 따릅니다. */
:root {
    --sky: #3B82C4;
    --sky-soft: #E7F1FA;
    --text: #1F2933;
    --muted: #6B7785;
    --line: #DDE5EC;
    --bg: #F5F8FB;
    --warn: #FFF4D6;
    --warn-line: #E8C766;
    --ok: #E3F5E8;
    --minus: #C0392B;
    --danger: #C0392B;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: "Pretendard", "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans KR", sans-serif;
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
}

.shell { max-width: 560px; margin: 0 auto; min-height: 100vh; padding-bottom: 72px; }

.topbar {
    position: sticky; top: 0; z-index: 10;
    display: flex; align-items: center; gap: 8px;
    padding: 12px 16px; padding-top: max(12px, env(safe-area-inset-top));
    background: var(--sky); color: #fff;
}
.topbar .brand { font-weight: 700; flex: 1; }
.topbar .who { opacity: .9; font-size: 14px; }

.content { padding: 12px; }

.tabbar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
    display: flex; justify-content: center;
    background: #fff; border-top: 1px solid var(--line);
    padding-bottom: env(safe-area-inset-bottom);
}
.tabbar a {
    flex: 1; max-width: 186px; text-align: center; padding: 14px 0;
    color: var(--muted); text-decoration: none; font-weight: 600;
}
.tabbar a.active { color: var(--sky); box-shadow: inset 0 3px 0 var(--sky); }

.monthbar { display: flex; align-items: center; justify-content: space-between; margin: 4px 0 12px; }
.monthbar strong { font-size: 18px; }

button, .primary {
    font: inherit; border-radius: 10px; border: 1px solid var(--line);
    background: #fff; color: var(--text); padding: 12px 14px; cursor: pointer;
    display: inline-block; text-align: center; text-decoration: none;
}
button.icon { width: 48px; height: 44px; padding: 0; font-size: 18px; }
.primary { background: var(--sky); color: #fff; border-color: var(--sky); font-weight: 700; }
.wide { width: 100%; margin-top: 8px; }
.danger { color: var(--danger); margin-top: 16px; }

.field {
    width: 100%; font: inherit; padding: 12px; margin-top: 8px;
    border: 1px solid var(--line); border-radius: 10px; background: #fff;
}

.metrics { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 12px; }
.metric { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 12px; display: flex; flex-direction: column; gap: 2px; }
.metric span { color: var(--muted); font-size: 13px; }
.metric b { font-size: 18px; }
.metric small { color: var(--muted); font-size: 12px; }
.minus { color: var(--minus); }

.card { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; margin-bottom: 12px; }
.card h2 { font-size: 16px; margin: 0 0 10px; display: flex; align-items: center; gap: 8px; }

.split { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 12px; font-size: 14px; color: var(--muted); }
.split b { color: var(--text); display: block; font-size: 15px; }

.row { display: grid; grid-template-columns: 1fr auto; gap: 2px 8px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.row:last-of-type { border-bottom: none; }
.row .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .amount { font-variant-numeric: tabular-nums; font-weight: 600; }
.row .bar { grid-column: 1 / -1; height: 5px; background: var(--sky-soft); border-radius: 3px; overflow: hidden; }
.row .bar i { display: block; height: 100%; background: var(--sky); }
.row.parent { cursor: pointer; }
.row.child { padding-left: 16px; font-size: 14px; }
.row.child .bar i { background: #8DB8DF; }
.row.unclassified { background: var(--warn); margin: 0 -14px; padding: 9px 14px; }

.kv { display: flex; justify-content: space-between; padding: 5px 0; font-size: 15px; }
.kv span { color: var(--muted); }
.kv b { font-variant-numeric: tabular-nums; }
.kv.strong b { color: var(--sky); font-size: 17px; }
.kv.sub { font-size: 13px; }

.progress { height: 8px; background: var(--sky-soft); border-radius: 4px; overflow: hidden; margin: 2px 0 8px; }
.progress i { display: block; height: 100%; background: var(--sky); }

.badge { font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: var(--sky-soft); color: var(--sky); }
.badge.admin { background: #fff; color: var(--sky); }
.badge.stage-BelowThreshold { background: #F1F3F5; color: var(--muted); }
.badge.stage-LimitReached { background: var(--ok); color: #2E7D4F; }

.guide { background: var(--sky-soft); border-radius: 8px; padding: 10px; font-size: 14px; margin: 8px 0; }
.hint { color: var(--muted); font-size: 13px; margin: 6px 0; }
.notice { color: var(--muted); text-align: center; padding: 16px 0; }

.banner { border-radius: 10px; padding: 10px 12px; margin: 8px 12px 0; font-size: 14px; }
.banner.warn { background: var(--warn); border: 1px solid var(--warn-line); }
.banner.ok { background: var(--ok); border: 1px solid #A8D8B6; }
.content .banner { margin: 0 0 12px; }

details summary { cursor: pointer; color: var(--sky); padding: 8px 0; font-size: 14px; }
table.months { width: 100%; border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; }
table.months th, table.months td { padding: 6px 4px; text-align: right; border-bottom: 1px solid var(--line); }
table.months th:first-child, table.months td:first-child { text-align: left; }
table.months tr.unknown td { color: #AAB4BE; }
table.months tr.unknown td[colspan] { text-align: center; }

.login { padding: 48px 8px 0; }
.login h1 { text-align: center; color: var(--sky); margin-bottom: 24px; }

/* --- 출금 목록 · 고치기 창 --- */
.searchbar { display: flex; gap: 8px; align-items: center; }
.searchbar .field { margin-top: 0; flex: 1; }
.searchbar .primary { white-space: nowrap; }

.list { background: #fff; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.entry { padding: 10px 14px; border-bottom: 1px solid var(--line); cursor: pointer; }
.entry:last-child { border-bottom: none; }
.entry.unclassified { background: var(--warn); }
.entry .line1, .entry .line2 { display: flex; justify-content: space-between; gap: 8px; }
.entry .detail { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.entry .amount { font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.entry .line2 { color: var(--muted); font-size: 13px; margin-top: 2px; }
.entry .line2 span:last-child { text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.sheet-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 20; }
.sheet {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 21;
    max-width: 560px; margin: 0 auto; max-height: 88vh; overflow-y: auto;
    background: #fff; border-radius: 16px 16px 0 0; padding: 16px 16px max(16px, env(safe-area-inset-bottom));
}
.sheet h2 { margin: 0 0 8px; font-size: 18px; }
.sheet label { display: block; font-size: 13px; color: var(--muted); margin-top: 10px; }
.sheet label .field { margin-top: 4px; color: var(--text); }
.sheet .two { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; }
.sheet .two label { margin-top: 0; }
.sheet .confirm { background: var(--warn); border-radius: 10px; padding: 10px 12px; margin-top: 12px; }
.sheet .confirm p { margin: 4px 0; }
.danger-fill { background: var(--danger); color: #fff; border-color: var(--danger); font-weight: 700; }
select.field { appearance: auto; }
