/* 자금 대시보드 (휴대폰 우선). 색은 회계 PC 대시보드와 같게 */
:root {
  --bg: #F5F7F6; --card: #FFFFFF; --line: #DBE4E1; --line2: #EEF2F1; --ink: #14211E; --sub: #53615E; --muted: #71807D; --faint: #9AA6A3;
  --brand: #008C72; --brand-soft: #E6F5F0; --dark: #0D3A32; --dark-ink: #B7D9D1;
  --pos: #1D5FD1; --neg: #C2410C; --warn: #B54708; --warn-soft: #FEF3E2; --op-pos: #79DEC4; --op-neg: #FDA29B;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0F1513; --card: #18201E; --line: #2A3532; --line2: #222B29; --ink: #E7EEEC; --sub: #B3C0BC; --muted: #8C9A96; --faint: #6B7874;
    --brand: #2BB596; --brand-soft: #16302A; --dark: #0B2A24; --dark-ink: #A7CFC5;
    --pos: #6EA1FF; --neg: #FF8A5B; --warn: #F5A54A; --warn-soft: #2D2215; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0F1513; --card: #18201E; --line: #2A3532; --line2: #222B29; --ink: #E7EEEC; --sub: #B3C0BC; --muted: #8C9A96; --faint: #6B7874;
  --brand: #2BB596; --brand-soft: #16302A; --dark: #0B2A24; --dark-ink: #A7CFC5;
  --pos: #6EA1FF; --neg: #FF8A5B; --warn: #F5A54A; --warn-soft: #2D2215; color-scheme: dark;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 14px/1.45 -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans KR", sans-serif; font-variant-numeric: tabular-nums; }
button { font: inherit; color: inherit; cursor: pointer; }
small { font-size: 12px; }
.pos { color: var(--pos); } .neg { color: var(--neg); }
.muted { color: var(--muted); font-size: 12px; margin: 4px 0; }
.warn { color: var(--warn); font-size: 12px; font-weight: 700; margin: 4px 0; }
.okline { color: #067647; font-size: 12px; font-weight: 700; margin: 4px 0; }
.empty { color: var(--muted); text-align: center; padding: 32px 8px; }

/* 머리글 */
.top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px; background: var(--card); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand b { display: block; font-size: 15px; }
.brand small { display: block; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mark { flex: none; width: 32px; height: 32px; border-radius: 9px; background: var(--dark); color: #79DEC4; display: grid; place-items: center; font-weight: 800; }
.menu { position: relative; }
.menu summary { list-style: none; width: 40px; height: 40px; display: grid; place-items: center; font-size: 20px; border-radius: 10px; cursor: pointer; }
.menu summary::-webkit-details-marker { display: none; }
.menu-pop { position: absolute; right: 0; top: 44px; min-width: 180px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 6px; box-shadow: 0 8px 24px rgba(0,0,0,.12); }
.menu-pop > * { display: block; width: 100%; text-align: left; padding: 10px 12px; border: 0; background: none; color: var(--ink); text-decoration: none; border-radius: 8px; }
.menu-pop form { padding: 0; } .menu-pop form button { width: 100%; text-align: left; padding: 10px 12px; border: 0; background: none; border-radius: 8px; }
.menu-pop .who { color: var(--muted); font-size: 12px; }
.menu-pop a:active, .menu-pop button:active { background: var(--brand-soft); }

main#app { max-width: 640px; margin: 0 auto; padding: 12px 16px calc(40px + env(safe-area-inset-bottom)); }
main#app.busy { opacity: .55; pointer-events: none; }
.loading { color: var(--muted); text-align: center; padding: 40px 0; }
.notice { background: var(--warn-soft); color: var(--warn); border-radius: 10px; padding: 8px 12px; font-size: 12px; font-weight: 600; margin-bottom: 10px; }

/* 영업 순흐름 */
.ops h3 { margin: 0 0 6px; font-size: 12px; color: var(--muted); font-weight: 700; }
.ops-row { display: grid; gap: 8px; }
.op { background: var(--dark); color: var(--dark-ink); border-radius: 12px; }
.op summary { list-style: none; display: grid; grid-template-columns: 1fr auto; gap: 2px 8px; padding: 10px 14px; cursor: pointer; }
.op summary::-webkit-details-marker { display: none; }
.op summary span { font-weight: 700; font-size: 13px; }
.op summary b { font-size: 17px; text-align: right; }
.op summary b.pos { color: var(--op-pos); } .op summary b.neg { color: var(--op-neg); }
.op summary small { grid-column: 1 / -1; font-size: 11px; }
.op-ex { margin: 0; padding: 0 14px 10px 28px; font-size: 11px; }

/* 달 이동 + 요약 */
.month-nav { display: flex; align-items: flex-end; justify-content: space-between; gap: 8px; margin: 16px 0 10px; }
.month-nav .note { margin: 0; font-size: 11px; font-weight: 700; color: var(--brand); }
.month-nav h2 { margin: 2px 0 0; font-size: 20px; }
.mbtns { display: flex; gap: 6px; flex: none; }
.mbtns button { min-width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--line); background: var(--card); font-size: 18px; color: var(--brand); padding: 0 10px; }
.mbtns .latest { font-size: 13px; font-weight: 700; }
.mbtns .reload { color: var(--sub); }
.w { display: none; }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.stats > div, .trio > div { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; min-width: 0; }
.stats span, .trio span { display: block; font-size: 11px; color: var(--muted); font-weight: 700; }
.stats span small { float: right; font-weight: 400; color: var(--faint); font-size: 10px; }
.stats b { display: block; font-size: 16px; margin-top: 2px; overflow-wrap: anywhere; }

.pills { display: flex; gap: 6px; flex-wrap: wrap; margin: 14px 0 8px; }
.pills button { border: 1px solid var(--line); background: var(--card); color: var(--brand); border-radius: 999px; padding: 7px 14px; font-size: 13px; font-weight: 700; }
.pills button.on { background: var(--brand); border-color: var(--brand); color: #fff; }

/* 달력 */
.cal { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 8px 6px 6px; }
.cal-head, .cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 3px; }
.cal-head span { text-align: center; font-size: 11px; font-weight: 700; color: var(--muted); padding-bottom: 4px; }
.cal .sun, .cal .sun .dn { color: var(--neg); } .cal .sat, .cal .sat .dn { color: var(--pos); }
.cell { position: relative; min-height: 58px; border: 1px solid var(--line2); background: var(--card); border-radius: 8px; padding: 3px 2px; display: flex; flex-direction: column; align-items: stretch; text-align: right; overflow: hidden; }
.cell .dn { font-size: 12px; font-weight: 700; color: var(--ink); text-align: left; padding-left: 2px; display: flex; justify-content: space-between; gap: 4px; }
.cell .part, .cell .topout { display: none; }
.cell i { font-style: normal; font-size: 10px; font-weight: 700; line-height: 1.3; white-space: nowrap; letter-spacing: -.3px; }
.cell.out { background: transparent; border-color: transparent; } .cell.out .dn { color: var(--faint); }
.cell.sel { border: 2px solid var(--brand); background: var(--brand-soft); }
.cell.partial::after { content: ""; position: absolute; top: 5px; right: 5px; width: 6px; height: 6px; border-radius: 50%; background: var(--warn); }
.cal-note { margin: 6px 4px 0; font-size: 11px; color: var(--muted); }

/* 상세 */
.right { margin-top: 18px; scroll-margin-top: 70px; }
.right .tabs { margin-top: 0; }
.detail { margin-top: 6px; }
.detail h3 { margin: 0; font-size: 18px; }
.trio { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; margin-top: 10px; }
.trio b { display: block; font-size: 13px; margin-top: 2px; overflow-wrap: anywhere; }
.ent { background: var(--card); border: 1px solid var(--line); border-radius: 12px; margin-top: 8px; }
.ent > summary { list-style: none; padding: 11px 14px; cursor: pointer; display: grid; grid-template-columns: 1fr auto; gap: 2px 8px; }
.ent > summary::-webkit-details-marker, .cat > summary::-webkit-details-marker, .who > summary::-webkit-details-marker { display: none; }
.ent > summary b { font-size: 14px; } .ent > summary b small { font-weight: 400; color: var(--muted); }
.ent > summary > small { grid-column: 1 / -1; color: var(--sub); }
.ent > summary::after { content: "▾"; grid-row: 1; grid-column: 2; color: var(--faint); }
.ent.store > summary::after { content: none; }
.ent[open] > summary::after { content: "▴"; }
.ent.store[open] > summary::after { content: none; }
.ent .big { font-weight: 800; font-size: 15px; }
.ent.dim > summary b { color: var(--muted); }
.ent .body { padding: 0 14px 8px; }
.ent.moves { opacity: .85; }
.txn { display: flex; justify-content: space-between; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line2); }
.txn > div { min-width: 0; }
.txn b { display: block; font-size: 13px; overflow-wrap: anywhere; }
.txn small { display: block; color: var(--muted); font-size: 11px; overflow-wrap: anywhere; }
.txn > span { font-weight: 700; white-space: nowrap; font-size: 13px; }
.txn.dim { opacity: .75; }
.cat, .who { border-top: 1px solid var(--line2); }
.cat > summary, .who > summary { list-style: none; display: flex; justify-content: space-between; gap: 10px; padding: 8px 0; cursor: pointer; font-size: 13px; }
.cat > summary > span:first-child, .who > summary > span:first-child { min-width: 0; overflow-wrap: anywhere; }
.cat > summary > span:last-child, .who > summary > span:last-child { white-space: nowrap; font-weight: 700; }
.cat > summary small, .who > summary small { color: var(--muted); }
.cat > .body { padding: 0 0 4px 12px; } .who > .body { padding: 0 0 6px 12px; }
.who > summary { font-size: 12px; }
.line { display: flex; justify-content: space-between; gap: 10px; font-size: 11px; padding: 3px 0; color: var(--sub); }
.line > span:first-child { min-width: 0; overflow-wrap: anywhere; } .line > span:last-child { white-space: nowrap; }

/* 로그인·계정 화면 */
.authbox { max-width: 420px; margin: 0 auto; padding: calc(32px + env(safe-area-inset-top)) 16px 40px; }
.authbox.wide { max-width: 560px; }
.authbox h1 { font-size: 20px; margin: 8px 0 4px; } .authbox h2 { font-size: 16px; margin: 24px 0 8px; }
.authbox .brand { margin-bottom: 20px; }
.back { color: var(--brand); text-decoration: none; font-weight: 700; display: inline-block; padding: 6px 0; }
.form { display: grid; gap: 12px; }
.form label { display: grid; gap: 4px; font-size: 13px; font-weight: 700; color: var(--sub); }
.form label.check { display: flex; align-items: center; gap: 8px; font-weight: 400; }
.form input:not([type="checkbox"]) { width: 100%; font: inherit; font-size: 16px; padding: 11px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); color: var(--ink); }
.form.row { grid-template-columns: 1fr auto; margin: 8px 0; }
.hint { color: var(--muted); font-size: 12px; margin: 0; }
.btn { border: 1px solid var(--line); background: var(--card); border-radius: 10px; padding: 11px 16px; font-weight: 700; color: var(--brand); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.danger { color: var(--neg); margin-top: 4px; }
.flash { max-width: 560px; margin: 12px auto 0; padding: 0 16px; }
.flash p { margin: 0 0 6px; padding: 10px 12px; border-radius: 10px; font-size: 13px; background: var(--brand-soft); color: var(--brand); }
.flash p.error { background: var(--warn-soft); color: var(--neg); }
.users { list-style: none; padding: 0; margin: 12px 0; }
.users li { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; margin-bottom: 8px; }
.users small { display: block; color: var(--muted); }
.users summary { color: var(--brand); font-size: 13px; margin-top: 6px; cursor: pointer; }

/* ---------- PC(넓은 화면): 런처 대시보드와 같은 배치 ---------- */
@media (min-width: 1000px) {
  main#app { max-width: 1560px; padding: 18px 28px 18px; }
  .layout { display: grid; grid-template-columns: minmax(0, 1fr) 470px; gap: 18px; align-items: start; }
  .right { position: sticky; top: 78px; margin-top: 0; max-height: calc(100vh - 96px); overflow-y: auto;
    background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 20px 22px 24px; }
  .ops h3 { font-size: 12px; color: var(--sub); }
  .ops-row { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
  .op summary { padding: 10px 16px; }
  .op summary b { font-size: 18px; }
  .month-nav { margin: 12px 0 0; }
  .month-nav h2 { font-size: 26px; margin-top: 4px; }
  .mbtns { align-items: center; }
  .mbtns button { height: auto; font-size: 12px; padding: 6px 12px; border-color: #BFD9D1; }
  .mbtns .reload { margin-left: 8px; }
  .w { display: inline; } .n { display: none; }
  .stats { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin: 10px 0 8px; }
  .stats > div { padding: 8px 14px; }
  .stats b { font-size: 17px; }
  .cal { background: transparent; border: 0; padding: 0; }
  .cal-head, .cal-grid { gap: 6px; }
  .cal-head span { text-align: left; padding-left: 8px; }
  .cell { min-height: 92px; padding: 5px 8px; border: 1px solid var(--line); border-radius: 10px; text-align: left; }
  .cell:hover:not(:disabled):not(.sel) { border-color: #7FC8B6; }
  .cell.out { background: #F5F7F6; border-color: var(--line); }
  .cell .dn { font-size: 12px; padding-left: 0; }
  .cell i { font-size: 11px; letter-spacing: 0; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
  .cell .part { display: inline; color: var(--warn); font-size: 9px; }
  .cell.partial::after { content: none; }
  .cell .topout { display: block; text-align: left; align-self: stretch; font-style: normal; font-size: 10px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
  .cal.w6 .cell { min-height: 76px; } .cal.w6 .cell .topout { display: none; }
  .cal-note { margin: 6px 0 0; }
  .detail h3 { font-size: 20px; }
}
@media (min-width: 1000px) and (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .cell.out { background: transparent; } }

/* ---------- 휴대폰: 글자·숫자 크게, 짧게 ---------- */
html.mobile body { font-size: 15px; }
html.mobile .ops h3 { font-size: 13px; margin-bottom: 6px; }
html.mobile .ops-row { gap: 0; background: var(--dark); border-radius: 14px; overflow: hidden; }
html.mobile .op { border-radius: 0; }
html.mobile .op + .op { border-top: 1px solid rgba(255,255,255,.1); }
html.mobile .op summary { grid-template-columns: 1fr auto; align-items: center; padding: 12px 16px; }
html.mobile .op summary span { font-size: 15px; }
html.mobile .op summary b { font-size: 19px; }
html.mobile .op-ex { font-size: 13px; line-height: 1.6; padding: 0 16px 12px 30px; }
html.mobile .month-nav { margin: 18px 0 10px; align-items: center; }
html.mobile .month-nav h2 { font-size: 22px; margin: 0; }
html.mobile .stats { gap: 8px; }
html.mobile .stats > div { padding: 10px 12px; }
html.mobile .stats span { font-size: 13px; }
html.mobile .stats b { font-size: clamp(14px, 4.2vw, 19px); letter-spacing: -.3px; margin-top: 4px; white-space: nowrap; }
html.mobile .cal { margin-top: 12px; padding: 8px 4px 6px; }
html.mobile .cal-head span { font-size: 12px; }
html.mobile .cell { min-height: 60px; padding: 4px 2px; }
html.mobile .cell .dn { font-size: 13px; }
html.mobile .cell i { font-size: 11px; letter-spacing: -.4px; }
html.mobile .cell.out .dn { visibility: hidden; }
html.mobile .cal-note { font-size: 12px; }
html.mobile .cal-note i { font-style: normal; font-weight: 700; }
html.mobile .pills button { font-size: 14px; padding: 8px 16px; }
html.mobile .detail h3 { font-size: 20px; }
html.mobile .muted, html.mobile .warn, html.mobile .okline { font-size: 13px; }
html.mobile .trio span { font-size: 12px; }
html.mobile .trio b { font-size: clamp(13px, 3.8vw, 16px); letter-spacing: -.3px; white-space: nowrap; }
html.mobile .ent > summary { padding: 12px 14px; }
html.mobile .ent > summary b { font-size: 16px; }
html.mobile .ent > summary > small { font-size: 13px; line-height: 1.5; }
html.mobile .txn { padding: 10px 0; }
html.mobile .txn b { font-size: 15px; }
html.mobile .txn small { font-size: 12.5px; margin-top: 2px; }
html.mobile .txn > span { font-size: 15px; }
html.mobile .cat > summary { font-size: 14.5px; padding: 10px 0; }
html.mobile .who > summary { font-size: 14px; }
html.mobile .line { font-size: 13px; padding: 4px 0; }
html.mobile .ent .big { font-size: 17px; }
html.mobile .cell.sel { border: 1px solid var(--brand); box-shadow: inset 0 0 0 1px var(--brand); }
html.mobile .brand small { font-size: 12px; }
html.mobile .trio { grid-template-columns: 1fr; gap: 0; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 2px 14px; }
html.mobile .trio > div { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; background: none; border: 0; border-radius: 0; padding: 9px 0; }
html.mobile .trio > div + div { border-top: 1px solid var(--line2); }
html.mobile .trio span { font-size: 14px; }
html.mobile .trio b { font-size: 17px; margin: 0; }
/* 펼칠 수 있는 줄 표시 (2026-10-30 사용자: "화살표가 없어서 클릭해볼 생각이 안드네") — 매장·계정·이름 줄 */
.ent.store > summary > b::before, .cat > summary > span:first-child::before, .who > summary > span:first-child::before { content: "▸ "; color: var(--faint); }
.ent.store[open] > summary > b::before, .cat[open] > summary > span:first-child::before, .who[open] > summary > span:first-child::before { content: "▾ "; }
