/* 모바일 우선. 웹폰트 없음(초기 로드 최소화). 장부 관행: 현지(해외) 항목은 회색 띠 */
:root {
  --bg: #f4f6fa; --card: #ffffff; --ink: #18202e; --muted: #5f6b7d; --line: #dfe4ec;
  --accent: #1f3a8a; --accent-2: #e8edfb; --ovs: #eef0f3;
  --ok: #1d7a46; --ok-bg: #e5f4ea; --warn: #a8630a; --warn-bg: #fdf1dc; --bad: #b8322a; --bad-bg: #fbe7e5;
  --radius: 12px; --shadow: 0 1px 2px rgba(20, 30, 50, .06);
  --font: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans KR", "Segoe UI", sans-serif;
  --on-accent: #fff; --hero-bg: #1f3a8a; --hero-fg: #fff;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f141c; --card: #171e29; --ink: #e7ecf3; --muted: #9aa6b8; --line: #283243;
    --accent: #8fa9ff; --accent-2: #1d2a4a; --ovs: #1c2330;
    --ok: #5fcf8f; --ok-bg: #143223; --warn: #f0b35a; --warn-bg: #3a2a10; --bad: #ff8a80; --bad-bg: #3d1a18;
    --shadow: none; --on-accent: #0f141c; --hero-bg: #1d2a4a; --hero-fg: #e7ecf3; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
    --bg: #0f141c; --card: #171e29; --ink: #e7ecf3; --muted: #9aa6b8; --line: #283243;
    --accent: #8fa9ff; --accent-2: #1d2a4a; --ovs: #1c2330;
    --ok: #5fcf8f; --ok-bg: #143223; --warn: #f0b35a; --warn-bg: #3a2a10; --bad: #ff8a80; --bad-bg: #3d1a18;
    --shadow: none; --on-accent: #0f141c; --hero-bg: #1d2a4a; --hero-fg: #e7ecf3; color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.5 var(--font); -webkit-text-size-adjust: 100%; }
body { padding-bottom: calc(72px + env(safe-area-inset-bottom, 0px)); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
[hidden] { display: none !important; }
a { color: var(--accent); }
h3 { margin: 0 0 8px; font-size: 16px; }
h4 { margin: 16px 0 6px; font-size: 14px; color: var(--muted); font-weight: 600; }
.muted { color: var(--muted); } .small { font-size: 13px; } .bad { color: var(--bad); } .good { color: var(--ok); }
.pad { padding: 0 max(16px, env(safe-area-inset-right, 0px)) 0 max(16px, env(safe-area-inset-left, 0px)); }
.num, .amt, .big, .kv b { font-variant-numeric: tabular-nums; }

/* 상단 */
.top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 8px; justify-content: space-between;
  padding: calc(8px + env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px)) 8px max(16px, env(safe-area-inset-left, 0px));
  background: var(--card); border-bottom: 1px solid var(--line); }
.unitpick { display: flex; flex-direction: column; align-items: flex-start; border: 0; background: none; padding: 2px 0; min-width: 0; text-align: left; }
.unitpick .t1 { font-weight: 700; font-size: 16px; } .unitpick .t1::after { content: " ▾"; color: var(--muted); font-size: 12px; }
.unitpick .t2 { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 60vw; }
.sync { border: 1px solid var(--line); background: var(--bg); border-radius: 999px; padding: 4px 10px; font-size: 12px; white-space: nowrap; display: flex; align-items: center; gap: 6px; }
.sync i { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.sync.good i { background: var(--ok); } .sync.poor i { background: var(--warn); } .sync.offline i { background: var(--bad); }
.sync.local { color: var(--accent); border-color: var(--accent); }

main { max-width: 760px; margin: 0 auto; padding: 12px 0 24px; display: flex; flex-direction: column; gap: 12px; }
main > .card, main > section, main > .toolbar, main > .cards, main > .chips, main > details, main > div.tbl { margin-left: max(16px, env(safe-area-inset-left, 0px)); margin-right: max(16px, env(safe-area-inset-right, 0px)); }

/* 카드 */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow); min-width: 0; }
.card.tight { padding: 10px 14px; font-size: 13px; }
.card.notice { display: flex; align-items: center; gap: 6px; text-align: left; border-color: var(--warn); background: var(--warn-bg); width: auto; }
.card.notice .go { margin-left: auto; font-size: 20px; }
.card.adv-toggle { display: flex; align-items: center; gap: 8px; text-align: left; width: auto; }
.card.adv-toggle .go { margin-left: auto; font-size: 13px; color: var(--muted, inherit); }
.card.err { border-color: var(--bad); color: var(--bad); }
details.card summary { cursor: pointer; font-weight: 600; }
details.card[open] summary { margin-bottom: 10px; }

.hero { background: var(--hero-bg); color: var(--hero-fg); border-radius: var(--radius); padding: 16px; display: flex; flex-direction: column; gap: 6px; }
.hero .lbl { font-size: 13px; opacity: .85; }
.hero .big { font-size: 32px; font-weight: 800; letter-spacing: -.5px; line-height: 1.15; }
.hero .muted { color: inherit; opacity: .75; }
.hero .bar { background: rgba(255, 255, 255, .25); }
.hero .bar .fill { background: #fff; }
.hero .chip { background: rgba(255, 255, 255, .18); color: inherit; border-color: transparent; }

.pair { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.kv { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }
.kv > div { display: flex; flex-direction: column; min-width: 0; }
.kv span { font-size: 13px; color: var(--muted); } .kv b { font-size: 17px; } .kv small { font-size: 13px; color: var(--muted); }
section.kv.card { display: grid; }

.bar { position: relative; height: 8px; border-radius: 99px; background: var(--line); overflow: visible; }
.bar .fill { position: absolute; inset: 0 auto 0 0; border-radius: 99px; background: var(--accent); }
.bar .fill.warn { background: var(--warn); } .bar .fill.over { background: var(--bad); }
.bar .mark { position: absolute; top: -3px; width: 2px; height: 14px; background: var(--ink); opacity: .55; }
.hero .bar .mark { background: #fff; }
.env { padding: 8px 0; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 4px; }
.env:first-of-type { border-top: 0; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-block; font-size: 13px; padding: 2px 8px; border-radius: 99px; background: var(--accent-2); color: var(--accent); border: 1px solid transparent; white-space: nowrap; vertical-align: middle; }
.chip.ok { background: var(--ok-bg); color: var(--ok); } .chip.orange { background: var(--warn-bg); color: var(--warn); }
.chip.red { background: var(--bad-bg); color: var(--bad); } .chip.grey { background: var(--ovs); color: var(--muted); }
.btnchip { border: 1px solid var(--line); cursor: pointer; }

/* 버튼 */
button, .btn { border: 1px solid var(--line); background: var(--card); border-radius: 10px; padding: 10px 12px; min-height: 44px; display: inline-flex; align-items: center; justify-content: center; text-align: center; }
button.primary, .primary { background: var(--accent); color: var(--on-accent); border-color: var(--accent); font-weight: 700; }
button.danger { color: var(--bad); }
button:disabled { opacity: .45; cursor: not-allowed; filter: grayscale(1); box-shadow: none; }
input.need { border-color: var(--bad); box-shadow: 0 0 0 2px var(--bad-bg); }
button.link { min-height: 40px; }
.sh-h .x { min-width: 44px; min-height: 44px; }
.plan-prev { background: var(--bg); border-radius: 10px; padding: 8px 10px; }
.link { border: 0; background: none; color: var(--accent); padding: 6px 0; min-height: 0; cursor: pointer; }
.row2, .row3 { display: grid; gap: 8px; grid-template-columns: 1fr 1fr; }
.row3 { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 420px) { .row3 { grid-template-columns: 1fr 1fr; } }
.actions { display: flex; flex-direction: column; gap: 8px; }
.btn-cam { display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 64px; border-radius: 14px; background: var(--accent); color: var(--on-accent); font-size: 18px; font-weight: 800; cursor: pointer; }
.btn-cam::before { content: ""; width: 22px; height: 18px; border: 2.5px solid currentColor; border-radius: 5px; box-shadow: inset 0 0 0 4px var(--accent), inset 0 0 0 9px currentColor; }
.btn-cam input { display: none; }
.fab { position: fixed; right: max(16px, env(safe-area-inset-right, 0px)); bottom: calc(80px + env(safe-area-inset-bottom, 0px)); z-index: 6; border-radius: 99px; background: var(--ink); color: var(--card); border: 0; font-weight: 700; padding: 10px 16px; box-shadow: 0 4px 14px rgba(0, 0, 0, .2); }

/* 목록 */
.list { list-style: none; margin: 0; padding: 0; }
.list li + li { border-top: 1px solid var(--line); }
.row { width: 100%; display: flex; align-items: center; gap: 10px; border: 0; background: none; border-radius: 0; padding: 10px 2px; text-align: left; min-height: 52px; }
.row.static { padding: 10px 2px; }
.row .no { font-size: 12px; color: var(--muted); min-width: 44px; font-variant-numeric: tabular-nums; }
.row .mid { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.row .t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .row .s { font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .amt { font-weight: 700; white-space: nowrap; } .row .amt.in { color: var(--ok); }
.row .go { color: var(--muted); font-size: 18px; }
.st { width: 20px; height: 20px; flex: none; border-radius: 50%; display: inline-grid; place-items: center; font-size: 11px; font-weight: 800; }
.st.ok { color: var(--ok); } .st.pend { font-size: 13px; } .st.warn { background: var(--warn-bg); color: var(--warn); } .st.bad { background: var(--bad-bg); color: var(--bad); } .st.sync { color: var(--accent); }
.day h4 { display: flex; justify-content: space-between; padding: 0 max(16px, env(safe-area-inset-left, 0px)); }
.day .list { background: var(--card); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 0 16px; }

.grp { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 4px 14px 8px; }
.grp.ovs { background: var(--ovs); }
.grp h4 { display: flex; align-items: center; gap: 6px; color: var(--ink); margin: 10px 0 2px; }
.grp h4 .sum { margin-left: auto; font-variant-numeric: tabular-nums; }

.yearbar { display: flex; gap: 6px; overflow-x: auto; padding: 2px 0 10px; -webkit-overflow-scrolling: touch; }
main > .yearbar { margin-left: max(16px, env(safe-area-inset-left, 0px)); margin-right: max(16px, env(safe-area-inset-right, 0px)); }
.yearbar button { flex: none; min-height: 40px; padding: 0 16px; border-radius: 99px; border: 1px solid var(--line, #ccc); background: var(--card, transparent); color: inherit; font-size: 15px; font-weight: 600; }
.yearbar button.on { background: var(--accent); color: var(--on-accent, #fff); border-color: var(--accent); }
.yearbar button.add { border-style: dashed; color: var(--accent); font-weight: 500; }
.card.soft { background: var(--ovs, rgba(0,0,0,.04)); box-shadow: none; margin: 4px 0 12px; line-height: 1.7; }
.toolbar { display: flex; gap: 8px; } .toolbar select { flex: 1; min-width: 0; }
.cards { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.tcard { display: flex; flex-direction: column; align-items: stretch; gap: 6px; text-align: left; background: var(--card); border: 1px solid var(--line); border-left: 4px solid var(--ok); border-radius: var(--radius); padding: 12px; min-height: 0; }
.tcard.orange { border-left-color: var(--warn); } .tcard.red { border-left-color: var(--bad); }

/* 표 */
.tbl { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 8px 6px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { color: var(--muted); font-weight: 600; white-space: nowrap; }
td.num, th.num { text-align: right; white-space: nowrap; }
tr.over td { color: var(--bad); } tr.best td { background: var(--ok-bg); }
tr[data-act] { cursor: pointer; }
select.reason { display: block; margin-top: 4px; font-size: 14px; padding: 6px; min-height: 40px; }

/* 폼 */
form { display: flex; flex-direction: column; gap: 10px; }
form.inline { flex-direction: row; flex-wrap: wrap; align-items: flex-end; } form.inline > * { flex: 1 1 140px; }
label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); min-width: 0; }
input, select, textarea { width: 100%; border: 1px solid var(--line); border-radius: 10px; padding: 10px; background: var(--card); min-height: 44px; font-size: 16px; color: var(--ink); }
textarea { min-height: 90px; }
.switch { flex-direction: row; align-items: center; gap: 8px; color: var(--ink); font-size: 14px; }
.switch input { width: 20px; height: 20px; min-height: 0; }
.stepper { display: grid; grid-template-columns: 48px 1fr 48px; gap: 6px; }
.live { font-size: 16px; padding: 8px 10px; background: var(--accent-2); border-radius: 10px; }
.guide { font-size: 13px; background: var(--ovs); padding: 8px 10px; border-radius: 10px; margin: 0 0 8px; }
.checks { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.ck { font-size: 13px; padding: 8px 10px; border-radius: 10px; background: var(--accent-2); }
.ck.block { background: var(--bad-bg); color: var(--bad); } .ck.warn { background: var(--warn-bg); color: var(--warn); } .ck.ok { background: var(--ok-bg); color: var(--ok); } .ck.info { background: var(--ovs); color: var(--muted); }
.payrow { border: 1px solid var(--line); border-radius: 10px; padding: 8px; display: flex; flex-direction: column; gap: 6px; }

/* 하단 탭 */
nav.bottom { position: fixed; left: 0; right: 0; bottom: 0; z-index: 5; display: flex; background: var(--card); border-top: 1px solid var(--line);
  padding: 4px max(8px, env(safe-area-inset-right, 0px)) calc(4px + env(safe-area-inset-bottom, 0px)) max(8px, env(safe-area-inset-left, 0px)); }
nav.bottom button { flex: 1; flex-direction: column; border: 0; background: none; font-size: 13px; color: var(--muted); padding: 4px 0; min-height: 52px; gap: 2px; }
nav.bottom button .ic { font-size: 18px; line-height: 1; }
nav.bottom button.on { color: var(--accent); font-weight: 700; }

/* 시트(아래에서 올라오는 창) */
.sheet-wrap { position: fixed; inset: 0; z-index: 20; }
.scrim { position: absolute; inset: 0; background: rgba(10, 15, 25, .45); }
.sheet { position: absolute; left: 0; right: 0; bottom: 0; max-height: 92vh; overflow-y: auto; background: var(--card); border-radius: 18px 18px 0 0;
  padding: 12px max(16px, env(safe-area-inset-right, 0px)) calc(20px + env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px)); max-width: 760px; margin: 0 auto;
  display: flex; flex-direction: column; gap: 10px; animation: up .18s ease-out; }
@keyframes up { from { transform: translateY(24px); opacity: .6; } }
@media (prefers-reduced-motion: reduce) { .sheet { animation: none; } }
.sh-h { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; position: sticky; top: -12px; background: var(--card); padding: 4px 0; z-index: 1; }
.sh-h .x { margin-left: auto; border: 0; font-size: 24px; min-height: 36px; padding: 0 8px; }
.thumb { background: var(--ovs); border-radius: 10px; min-height: 80px; display: grid; place-items: center; overflow: hidden; }
.thumb img { max-height: 46vh; width: auto; max-width: 100%; }
.chat { display: flex; flex-direction: column; gap: 8px; max-height: 48vh; overflow-y: auto; }
.msg { padding: 10px 12px; border-radius: 12px; max-width: 90%; font-size: 14px; }
.msg.user { align-self: flex-end; background: var(--accent); color: var(--on-accent); }
.msg.bot { align-self: flex-start; background: var(--ovs); }
.act-card { margin-top: 8px; padding: 8px; border: 1px dashed var(--accent); border-radius: 10px; background: var(--card); display: flex; flex-direction: column; gap: 6px; }

/* 알림 */
.toast { pointer-events: none; position: fixed; left: 50%; bottom: calc(96px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); z-index: 40; background: var(--ink); color: var(--card); padding: 10px 16px; border-radius: 12px; font-size: 14px; max-width: calc(100vw - 32px); box-shadow: 0 6px 20px rgba(0, 0, 0, .25); text-align: center; transition: opacity .3s; }
.toast.big { padding: 16px 22px; }
.toast .no { font-size: 44px; font-weight: 800; line-height: 1.1; margin: 6px 0 2px; font-variant-numeric: tabular-nums; }
.toast.out { opacity: 0; }

/* 로그인 */
.login { max-width: 460px; margin: 0 auto; padding: calc(32px + env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px)) 32px max(16px, env(safe-area-inset-left, 0px)); display: flex; flex-direction: column; gap: 14px; }
.login h1 { margin: 0; font-size: 28px; }

/* 대분류 선택(식비·사역비·숙소비) */
fieldset.cats { border: 0; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
fieldset.cats legend { font-size: 13px; color: var(--muted); padding: 0 0 4px; }
.catbtn { position: relative; }
.catbtn input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.catbtn span { display: flex; align-items: center; justify-content: center; min-height: 48px; border: 1.5px solid var(--line); border-radius: 10px; background: var(--card); color: var(--ink); font-size: 15px; font-weight: 600; }
.catbtn input:checked + span { border-color: var(--accent); background: var(--accent-2); color: var(--accent); }
.catbtn input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.cat h3 { margin: 0; }
.cat { display: flex; flex-direction: column; gap: 8px; }
.cat.cat-FOOD { border-top: 3px solid #d07a1f; } .cat.cat-MIN { border-top: 3px solid var(--accent); } .cat.cat-ACC { border-top: 3px solid #5a7d6b; }
.inl { flex-direction: row; align-items: center; gap: 6px; }
.num-in { width: 120px; min-height: 36px; padding: 6px 8px; text-align: right; font-variant-numeric: tabular-nums; }
.subs .row { min-height: 44px; padding: 6px 2px; }
.sub-add input { flex: 3 1 180px; } .sub-add button { flex: 1 0 auto; }
.toast .small-no { font-size: 22px; margin-top: 8px; }

/* 본부 대시보드 */
.hero.dash .dash-row { display: flex; gap: 16px; align-items: center; margin: 6px 0 10px; }
.hero.dash .big { font-size: clamp(24px, 7vw, 34px); }
.donut { flex: none; }
.donut circle { fill: none; stroke-width: 12; }
.donut .trk { stroke: var(--ovs); } .donut .val { stroke: var(--accent); stroke-linecap: round; } .donut .val.over { stroke: var(--bad); }
.donut .pct { font-size: 24px; font-weight: 700; fill: var(--ink); } .donut .cap { font-size: 12px; fill: var(--muted); }
.donut.on-hero .trk { stroke: rgba(255, 255, 255, .22); } .donut.on-hero .val { stroke: var(--hero-fg, #fff); } .donut.on-hero .val.over { stroke: #ffb4a8; }
.donut.on-hero .pct, .donut.on-hero .cap { fill: var(--hero-fg, #fff); }
.stack { display: flex; height: 16px; border-radius: 99px; overflow: hidden; background: var(--ovs); margin: 8px 0 12px; }
.stack span { display: block; height: 100%; transition: width .4s; }
.stack .krw, .legend i.krw { background: var(--accent); } .stack .loc, .legend i.loc { background: var(--ok); }
.legend > div { display: grid; grid-template-columns: 12px auto 1fr; gap: 2px 8px; align-items: center; padding: 6px 0; }
.legend > div > .muted { grid-column: 2 / 4; font-size: 13px; } .legend b { text-align: right; }
.legend i { width: 12px; height: 12px; border-radius: 3px; }
.tbig { font-size: 22px; font-weight: 700; }
.center { text-align: center; }
.btn-cam small { display: block; font-size: 13px; font-weight: 400; opacity: .85; }
/* AI 영수증 카드 */
.rcpt { border: 1px solid var(--line); border-radius: var(--radius, 12px); padding: 12px; margin: 10px 0; background: var(--card); }
.rcpt-h { display: flex; flex-wrap: wrap; gap: 6px; align-items: baseline; } .rcpt-h b { font-size: 16px; }
.rcpt-d { color: var(--muted); font-size: 14px; margin: 4px 0 8px; }
.rcpt-t { width: 100%; border-collapse: collapse; font-size: 14px; margin-bottom: 6px; }
.rcpt-t td { padding: 5px 0; border-bottom: 1px dashed var(--line); vertical-align: top; } .rcpt-t td.num { text-align: right; white-space: nowrap; padding-left: 8px; }
.disc { color: var(--bad); } .rcpt .disc { font-size: 13px; }
.rcpt-tot { border-top: 2px solid var(--ink); margin-top: 6px; padding-top: 6px; font-size: 17px; }
/* 일괄 지급 */
.bp-row { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; margin: 10px 0; }
.bp-row legend { padding: 0 4px; line-height: 1.5; }
.kv.mini { grid-template-columns: 1fr 1fr; margin-bottom: 8px; }
/* 일일 결산 */
.daylist { list-style: none; margin: 0; padding: 0; }
.daylist li { padding: 10px 0; border-bottom: 1px solid var(--line); }
.daylist li.today { background: var(--accent-2); margin: 0 -12px; padding: 10px 12px; border-radius: 10px; border-bottom: none; }
.dbar { height: 6px; background: var(--ovs); border-radius: 99px; margin: 6px 0; overflow: hidden; } .dbar span { display: block; height: 100%; background: var(--accent); }
/* 일일 결산 확인 */
.daycheck .dc-row { padding: 8px 0; border-top: 1px solid var(--line, rgba(127,127,127,.2)); }
.daycheck .dc-in { display: flex; gap: 8px; align-items: center; margin-top: 4px; }
.daycheck .dc-in input { flex: 1; min-width: 0; }
.dc-diff { font-size: 13px; white-space: nowrap; min-width: 6.5em; text-align: right; }
.dc-diff.ok, .ok-t { color: var(--ok, #1a7f4b); }
.dc-diff.bad { color: var(--bad, #c0392b); font-weight: 600; }

/* 화면 정리: 세그먼트 전환, 묶음 접기, 구역 제목, 큰 글씨 */
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; background: var(--bg); border: 1px solid var(--line); border-radius: 14px; padding: 4px; margin: 12px 16px; }
.seg button { border: 0; background: none; border-radius: 10px; min-height: 44px; font-weight: 600; color: var(--muted); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0; }
.seg button small { font-size: 12px; font-weight: 400; }
.seg button.on { background: var(--card); color: var(--accent); box-shadow: 0 1px 3px rgba(0, 0, 0, .12); }
details.grp > summary { list-style: none; cursor: pointer; }
details.grp > summary::-webkit-details-marker { display: none; }
details.grp > summary h4::before { content: "▸ "; color: var(--muted); }
details.grp[open] > summary h4::before { content: "▾ "; }
h2.sec { font-size: 15px; color: var(--muted); margin: 20px 16px 6px; font-weight: 700; }
.rowcard { display: flex; justify-content: space-between; align-items: center; gap: 8px; width: auto; text-align: left; }
label.btn small { display: block; font-size: 12px; font-weight: 400; }
/* 큰 글씨: zoom은 터치 위치가 어긋나서 쓰지 않고 글씨만 키운다 */
html.big body { font-size: 18px; }
html.big .small, html.big .muted.small, html.big .row .s, html.big .kv span, html.big .kv small, html.big .chip, html.big label, html.big .seg button small, html.big .btn-cam small { font-size: 15px; }
html.big .row .t, html.big button, html.big input, html.big select, html.big textarea { font-size: 17px; }
html.big h3 { font-size: 19px; } html.big .kv b { font-size: 20px; } html.big .hero .big { font-size: 36px; }
html.big nav.bottom button { font-size: 14px; } html.big nav.bottom button .ic { font-size: 21px; }

.danger-t { color: var(--bad); }

/* ===== 재정 그래프 (dataviz 기본 팔레트: 식비=파랑, 사역비=주황, 숙소비=청록 · 상태색은 초과에만) ===== */
:root { --s1: #257de0; --s2: #f47230; --s3: #00b894; --crit: #dc3c3d; --plan: #8a94a6; --vz-pos: #257de0; --vz-neg: #ec4647; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --s1: #338ced; --s2: #e76624; --s3: #00a888; --crit: #eb6263; --plan: #7f8aa0; --vz-pos: #338ced; --vz-neg: #eb6263; } }
:root[data-theme="dark"] { --s1: #338ced; --s2: #e76624; --s3: #00a888; --crit: #eb6263; --plan: #7f8aa0; --vz-pos: #338ced; --vz-neg: #eb6263; }
.viz-card { padding-top: 12px; }
.viz { margin: 0 0 6px; }
.viz + .viz { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); }
.viz figcaption { display: flex; flex-direction: column; gap: 2px; margin-bottom: 6px; }
.viz figcaption b { font-size: 15px; }
.vz { width: 100%; height: auto; display: block; overflow: visible; touch-action: pan-y; }
.vz .g { stroke: var(--line); stroke-width: 1; }
.vz .base { stroke: var(--muted); stroke-width: 1; opacity: .5; }
.vz .ax { font-size: 11px; fill: var(--muted); }
.vz .act { fill: none; stroke: var(--s1); stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.vz .dot { fill: var(--s1); stroke: var(--card); stroke-width: 2; }
.vz .plan { stroke: var(--plan); stroke-width: 1.5; stroke-dasharray: 2 4; }
.vz .ref { stroke: var(--muted); stroke-width: 1; opacity: .6; }
.vz .proj { stroke: var(--s1); stroke-width: 2; stroke-dasharray: 6 5; opacity: .7; }
.vz .proj.over { stroke: var(--crit); opacity: 1; }
.vz .xh { stroke: var(--muted); stroke-width: 1; }
.vz .pos { fill: var(--vz-pos); } .vz .neg { fill: var(--vz-neg); } .vz .zero { fill: var(--ok); } .vz .nochk { fill: none; stroke: var(--muted); stroke-dasharray: 2 2; }
.vz-keys { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 6px; color: var(--muted); }
.vz-keys span { display: inline-flex; align-items: center; gap: 5px; }
.vz-keys .k { width: 14px; height: 4px; border-radius: 2px; display: inline-block; background: var(--s1); }
.vz-keys .k.plan { background: none; border-top: 2px dotted var(--plan); height: 0; }
.vz-keys .k.proj { background: none; border-top: 2px dashed var(--s1); height: 0; }
.vz-keys .k.pos { background: var(--vz-pos); } .vz-keys .k.neg { background: var(--vz-neg); } .vz-keys .k.nochk { background: none; border: 1px dashed var(--muted); height: 8px; }
.tbars { display: flex; flex-direction: column; gap: 6px; }
.tbar { display: flex; flex-direction: column; gap: 4px; text-align: left; border: 1px solid var(--line); background: var(--card); border-radius: 10px; padding: 10px 12px; min-height: 64px; width: 100%; }
.tb-h { display: flex; justify-content: space-between; gap: 8px; }
.tb-track { position: relative; height: 10px; background: var(--bg); border-radius: 5px; }
.tb-fill { position: absolute; left: 0; top: 0; bottom: 0; background: var(--s1); border-radius: 5px; }
.tb-fill.over { background: var(--crit); }
.tb-mark { position: absolute; top: -4px; bottom: -4px; width: 2px; background: var(--ink); border-radius: 1px; }
.warn-t { color: var(--warn); }
.viz-tip { position: fixed; z-index: 60; pointer-events: none; background: var(--ink); color: var(--card); padding: 6px 10px; border-radius: 8px; font-size: 13px; white-space: pre-line; box-shadow: 0 4px 14px rgba(0,0,0,.25); max-width: 240px; }
.attn .row { min-height: 44px; }
.sheet .row2:has(> button.primary) { position: sticky; bottom: -1px; background: var(--card); padding: 8px 0; z-index: 2; box-shadow: 0 -6px 10px -8px rgba(0,0,0,.25); }
button small { display: block; font-size: 12px; font-weight: 400; }
.tbar { align-items: stretch; justify-content: flex-start; } .tbar > span { display: flex; width: 100%; } .tbar .tb-track { display: block; } .tbar .tb-s { display: block; }

.hdr-r { display: flex; align-items: center; gap: 6px; }
.helpbtn { display: inline-flex; align-items: center; min-height: 36px; padding: 4px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--accent-2); color: var(--accent); font-size: 13px; font-weight: 700; text-decoration: none; white-space: nowrap; }
