/* 내만주 일정 — 모바일 우선 (갤럭시 360 · 아이폰 375 · 입력칸 16px · 버튼 44px) */
:root {
  --mint: #5EE6B0; --mint-ink: #0B5B40; --mint-soft: #D6F9EA;
  --bg: #F4F5F3; --card: #fff; --ink: #1D1D1B; --sub: #6B6B66; --line: #E6E6E2;
  --red: #D0342C; --blue: #2B62C9; --warn: #B5570E;
  --safe-b: env(safe-area-inset-bottom, 0px); --safe-t: env(safe-area-inset-top, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font-family: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Pretendard", "Noto Sans KR", "Malgun Gothic", sans-serif; font-size: 16px; line-height: 1.45; word-break: keep-all; overflow-wrap: anywhere; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
input, select, textarea { font: inherit; font-size: 16px; color: var(--ink); }
#app { max-width: 560px; margin: 0 auto; min-height: 100vh; padding-bottom: calc(76px + var(--safe-b)); }

/* 위 막대 */
.top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 4px; padding: calc(6px + var(--safe-t)) 8px 6px; background: var(--bg); }
.ic { min-width: 44px; height: 44px; font-size: 26px; line-height: 1; border-radius: 12px; color: var(--sub); }
.ic:active, .pill:active { background: #E9EAE6; }
.mtitle { flex: 1; height: 44px; font-size: 20px; font-weight: 700; text-align: left; padding: 0 4px; }
.pill { height: 36px; padding: 0 14px; border-radius: 18px; background: #fff; border: 1px solid var(--line); font-size: 15px; }
.sync { width: 10px; height: 10px; border-radius: 50%; background: #CFCFCA; margin: 0 6px; flex: none; }
.sync.ok { background: var(--mint); } .sync.wait { background: #F0B44C; } .sync.err { background: var(--red); }

/* 분류 칩 */
.filters { display: flex; gap: 6px; padding: 2px 12px 8px; overflow-x: auto; scrollbar-width: none; }
.filters::-webkit-scrollbar { display: none; }
.chip { flex: none; display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 12px; border-radius: 18px; background: #fff; border: 1.5px solid var(--line); font-size: 15px; }
.chip .dot { width: 9px; height: 9px; border-radius: 50%; }
.chip.off { opacity: .45; }
.chip.sel { border-color: currentColor; font-weight: 700; }

/* 달력 */
.wk, .grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); padding: 0 6px; }
.wk span { text-align: center; font-size: 13px; color: var(--sub); padding: 4px 0; }
.wk .sun { color: var(--red); } .wk .sat { color: var(--blue); }
.grid { background: #fff; margin: 0 8px; padding: 4px; border-radius: 16px; gap: 2px; touch-action: pan-y; }
.cell { position: relative; min-height: 64px; border-radius: 10px; padding: 3px 2px 2px; display: flex; flex-direction: column; align-items: stretch; text-align: center; overflow: hidden; }
.cell .n { font-size: 15px; font-weight: 600; line-height: 22px; height: 22px; width: 26px; margin: 0 auto; border-radius: 11px; }
.cell.out { opacity: .35; }
.cell.sun .n, .cell.hol .n { color: var(--red); }
.cell.sat .n { color: var(--blue); }
.cell.today .n { background: var(--ink); color: #fff; }
.cell.sel { background: var(--mint-soft); }
.cell.sel .bar:not(.tent) { background: #fff !important; }
.cell .hn { font-size: 10px; line-height: 12px; color: var(--red); white-space: nowrap; overflow: hidden; text-overflow: clip; }
.cell .bars { display: flex; flex-direction: column; gap: 2px; margin-top: 2px; }
.cell .bar { font-size: 11px; line-height: 15px; height: 15px; border-radius: 4px; padding: 0 2px; white-space: nowrap; overflow: hidden; text-align: left; }
.cell .bar.tent { background: transparent !important; border: 1px dashed currentColor; line-height: 12px; }
.cell .more { font-size: 10px; color: var(--sub); line-height: 12px; }

.dayhead { display: flex; align-items: baseline; gap: 8px; padding: 16px 16px 6px; }
.dayhead b { font-size: 18px; }
.hol { color: var(--red); font-size: 14px; font-weight: 600; }

/* 일정 목록 */
.list { padding: 0 12px; }
.item { display: flex; gap: 10px; align-items: stretch; width: 100%; text-align: left; background: #fff; border-radius: 14px; padding: 12px; margin-bottom: 8px; min-height: 56px; }
.item .stripe { width: 4px; border-radius: 2px; flex: none; }
.item .tm { flex: none; width: 58px; font-size: 14px; color: var(--sub); line-height: 1.35; }
.item .tm b { display: block; color: var(--ink); font-size: 15px; }
.item .bd { flex: 1; min-width: 0; }
.item .tt { font-weight: 700; font-size: 16px; }
.item .meta { font-size: 14px; color: var(--sub); margin-top: 2px; }
.tag { display: inline-block; font-size: 12px; padding: 1px 7px; border-radius: 8px; margin-left: 4px; vertical-align: 1px; font-weight: 600; }
.tag.tent { background: #FFF1DD; color: var(--warn); }
.tag.warn { background: #FDECEC; color: var(--red); }
.empty { text-align: center; color: var(--sub); padding: 22px 12px; background: #fff; border-radius: 14px; }
.empty button { margin-top: 10px; }
.grp { font-size: 14px; font-weight: 700; color: var(--sub); margin: 14px 4px 6px; }
.grp .hol { font-size: 13px; margin-left: 6px; }

.search { padding: 4px 12px 8px; }
.search input { width: 100%; height: 48px; border-radius: 14px; border: 1px solid var(--line); padding: 0 14px; background: #fff; }

/* 추가 버튼 */
.fab { position: fixed; right: max(16px, calc(50% - 264px)); bottom: calc(84px + var(--safe-b)); width: 60px; height: 60px; border-radius: 30px; background: var(--mint); color: var(--mint-ink); font-size: 34px; line-height: 1; box-shadow: 0 6px 18px rgba(11, 91, 64, .28); z-index: 6; }
.fab:active { transform: scale(.96); }

/* 아래 탭 */
.tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 7; display: flex; background: #fff; border-top: 1px solid var(--line); padding-bottom: var(--safe-b); }
.tabs button { flex: 1; min-height: 60px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; font-size: 12px; color: var(--sub); }
.tabs i { font-style: normal; font-size: 20px; filter: grayscale(1); opacity: .55; }
.tabs button.on { color: var(--ink); font-weight: 700; }
.tabs button.on i { filter: none; opacity: 1; }
.view { display: none; } .view.on { display: block; }

/* 아래에서 올라오는 창 */
.scrim { position: fixed; inset: 0; background: rgba(0, 0, 0, .38); opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 20; }
.scrim.on { opacity: 1; pointer-events: auto; }
.sheet { position: fixed; left: 0; right: 0; bottom: 0; margin: 0 auto; max-width: 560px; max-height: 92vh; max-height: 92dvh; overflow-y: auto; overscroll-behavior: contain; background: #fff; border-radius: 22px 22px 0 0; z-index: 21; transform: translateY(105%); transition: transform .25s ease; padding: 8px 16px calc(16px + var(--safe-b)); }
.sheet.on { transform: none; }
.grab { width: 40px; height: 5px; border-radius: 3px; background: #DDD; margin: 4px auto 10px; }
.sh-h { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.sh-h h2 { flex: 1; font-size: 19px; margin: 0; }
.x { width: 44px; height: 44px; font-size: 24px; color: var(--sub); border-radius: 12px; }

.f { margin: 12px 0; }
.f > label:not(.up), .lb { display: block; font-size: 14px; color: var(--sub); margin-bottom: 6px; font-weight: 600; }
.in { width: 100%; height: 50px; border: 1.5px solid var(--line); border-radius: 12px; padding: 0 12px; background: #fff; }
.in:focus { outline: none; border-color: var(--mint-ink); }
textarea.in { height: 84px; padding: 10px 12px; resize: vertical; }
.in.big { font-size: 19px; font-weight: 700; height: 56px; }
.row2 { display: flex; gap: 8px; } .row2 > * { flex: 1; min-width: 0; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips .chip { min-height: 44px; padding: 0 14px; font-size: 15px; }
.chips .chip.sel { background: var(--mint-soft); color: var(--mint-ink); border-color: var(--mint-ink); }
.chips.cat .chip.sel { background: var(--cs); color: var(--ci); border-color: var(--cc); }
.unit { position: relative; } .unit .in { padding-right: 44px; } .unit span { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); color: var(--sub); font-size: 15px; pointer-events: none; }
.sw { display: flex; align-items: center; justify-content: space-between; min-height: 52px; padding: 4px 0; border-top: 1px solid var(--line); gap: 12px; }
.sw .t { font-size: 16px; } .sw small { display: block; color: var(--sub); font-size: 13px; }
.tg { position: relative; width: 52px; height: 32px; flex: none; }
.tg input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; z-index: 1; }
.tg span { position: absolute; inset: 0; border-radius: 16px; background: #D5D5D0; transition: .2s; }
.tg span::after { content: ""; position: absolute; left: 3px; top: 3px; width: 26px; height: 26px; border-radius: 50%; background: #fff; transition: .2s; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.tg input:checked + span { background: var(--mint-ink); }
.tg input:checked + span::after { transform: translateX(20px); }
.box { background: var(--mint-soft); color: var(--mint-ink); border-radius: 14px; padding: 12px 14px; margin: 10px 0; }
.box .big { font-size: 24px; font-weight: 800; }
.box small { display: block; font-size: 13px; opacity: .85; }
.sec { border-top: 8px solid var(--bg); margin: 16px -16px 0; padding: 12px 16px 0; }
.sec > h3 { font-size: 17px; margin: 4px 0 4px; }
.hint { font-size: 13px; color: var(--sub); margin-top: 4px; }

.btn { display: flex; align-items: center; justify-content: center; gap: 6px; width: 100%; min-height: 52px; border-radius: 14px; font-size: 17px; font-weight: 700; background: #F0F1EE; }
.btn.pri { background: var(--mint); color: var(--mint-ink); }
.btn.dan { background: #FDECEC; color: var(--red); }
.btn.sm { min-height: 44px; font-size: 15px; width: auto; padding: 0 14px; display: inline-flex; }
.btns { display: flex; gap: 8px; margin-top: 14px; } .btns .btn { flex: 1; }
.stick { position: sticky; bottom: calc(-16px - var(--safe-b)); background: #fff; padding: 10px 0 calc(6px); margin-top: 8px; }

/* 상세 */
.det .ttl { font-size: 22px; font-weight: 800; margin: 2px 0 6px; }
.det .ln { display: flex; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line); font-size: 16px; align-items: flex-start; }
.det .ln > i { font-style: normal; width: 24px; text-align: center; flex: none; }
.det a { color: var(--blue); }
.catb { display: inline-block; font-size: 13px; font-weight: 700; padding: 3px 10px; border-radius: 10px; }

/* 경비 */
.exp { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; padding: 12px; border: 1.5px solid var(--line); border-radius: 14px; margin-bottom: 8px; background: #fff; min-height: 60px; }
.exp .k { flex: 1; min-width: 0; }
.exp .k b { display: block; font-size: 16px; }
.exp .k small { font-size: 13px; color: var(--sub); }
.exp .a { font-weight: 800; font-size: 16px; white-space: nowrap; }
.exp .th { width: 44px; height: 44px; border-radius: 8px; object-fit: cover; flex: none; background: #F0F1EE; display: flex; align-items: center; justify-content: center; font-size: 20px; }
.ok { color: var(--mint-ink); } .no { color: var(--red); }
.up { display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 64px; border: 2px dashed var(--mint); border-radius: 14px; color: var(--mint-ink); font-weight: 700; background: #F4FDF9; width: 100%; position: relative; overflow: hidden; }
.up input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.rimg { max-width: 100%; max-height: 260px; border-radius: 12px; display: block; margin: 8px auto 0; }
.calc { background: #F7F7F4; border-radius: 14px; padding: 10px 12px; margin-top: 8px; }

/* 정산 */
.mnav { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 0 8px 6px; } .mnav b { font-size: 18px; min-width: 120px; text-align: center; }
.card { background: #fff; border-radius: 16px; padding: 14px; margin: 0 12px 10px; }
.card h3 { font-size: 16px; margin: 0 0 8px; }
.kv { display: flex; justify-content: space-between; gap: 8px; padding: 8px 0; border-top: 1px solid var(--line); font-size: 16px; }
.kv:first-of-type { border-top: 0; }
.kv b { font-weight: 800; white-space: nowrap; }
.kv.tot { font-size: 18px; }
.meter { position: relative; height: 18px; border-radius: 9px; background: #EEEEEA; margin: 10px 0 6px; overflow: visible; }
.meter > div { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 9px; background: var(--mint); max-width: 100%; }
.meter > div.over { background: #F09595; }
.meter > i { position: absolute; top: -5px; bottom: -5px; width: 3px; background: var(--red); border-radius: 2px; }
.lrow { display: block; width: 100%; text-align: left; padding: 10px 0; border-top: 1px solid var(--line); }
.lrow .t1 { display: flex; justify-content: space-between; gap: 8px; font-weight: 700; }
.lrow .t2 { display: flex; justify-content: space-between; gap: 8px; font-size: 14px; color: var(--sub); margin-top: 2px; }

/* 설정 */
.set .card .sw:first-of-type { border-top: 0; }
.guide ol { margin: 6px 0 0; padding-left: 20px; } .guide li { margin: 4px 0; }
.banner { margin: 0 12px 10px; padding: 12px 14px; border-radius: 14px; background: #FFF6E5; color: #7A4A06; font-size: 15px; display: flex; gap: 10px; align-items: center; }
.banner b { display: block; }
.banner .btn { width: auto; min-height: 40px; font-size: 14px; padding: 0 12px; background: #fff; flex: none; }

.toast { position: fixed; left: 50%; bottom: calc(150px + var(--safe-b)); transform: translateX(-50%) translateY(20px); background: #222; color: #fff; padding: 12px 18px; border-radius: 14px; font-size: 15px; opacity: 0; pointer-events: none; transition: .2s; z-index: 40; max-width: 90vw; text-align: center; }
.toast.on { opacity: 1; transform: translateX(-50%); }

@media (max-width: 370px) {
  .cell { min-height: 58px; }
  .item .tm { width: 52px; }
  .chips .chip { padding: 0 11px; }
}
