/* KC Family Financials — shared styles for the family pages (home, kids, more, login).
   The financial statements page (kc_financials.html) keeps its own styles. */
:root {
  color-scheme: light;
  --bg: #F2F5F3; --surface: #FFFFFF; --ink: #15181C; --muted: #5B645F; --faint: #858E88;
  --line: #E1E7E3; --soft: #EEF2EF;
  --accent: #0E9F8E; --accent-ink: #0A7266; --accent-soft: #E0F3EF;
  --down: #C43D3D; --up: #0A7266;
  --victor: #2563EB; --victor-soft: rgba(37,99,235,.12);
  --noah: #059669;   --noah-soft: rgba(5,150,105,.13);
  --tabbar: rgba(255,255,255,.92);
  --font: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Noto Sans KR", "Segoe UI", Roboto, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #0F1311; --surface: #181D1B; --ink: #E6ECE8; --muted: #A1ABA5; --faint: #7C8680;
    --line: #2A312D; --soft: #202624;
    --accent: #3DC4B2; --accent-ink: #66D8C8; --accent-soft: #15302B;
    --down: #EE7474; --up: #66D8C8;
    --victor: #7EA6FF; --victor-soft: rgba(126,166,255,.16);
    --noah: #34C79A;   --noah-soft: rgba(52,199,154,.16);
    --tabbar: rgba(24,29,27,.92);
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font);
  font-size: 16px; line-height: 1.5; font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
[hidden] { display: none !important; }

.page {
  max-width: 560px; margin: 0 auto;
  padding: calc(18px + env(safe-area-inset-top, 0px)) 16px calc(96px + env(safe-area-inset-bottom, 0px));
  display: flex; flex-direction: column; gap: 14px;
}
.page.no-tabs { padding-bottom: calc(32px + env(safe-area-inset-bottom, 0px)); }
.top { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; padding: 4px 2px 6px; }
.eyebrow { font-size: 12px; font-weight: 600; color: var(--accent-ink); letter-spacing: .02em; }
h1 { margin: 2px 0 0; font-size: 26px; line-height: 1.2; font-weight: 700; letter-spacing: -.01em; }
.date { font-size: 13px; color: var(--muted); white-space: nowrap; }

.card {
  background: var(--surface); border-radius: 18px; padding: 16px;
  display: flex; flex-direction: column; gap: 10px; text-decoration: none;
  border: 1px solid var(--line);
}
a.card:active { transform: scale(.99); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.label { font-size: 13px; color: var(--muted); font-weight: 600; }
.go { font-size: 13px; color: var(--accent-ink); font-weight: 600; white-space: nowrap; text-decoration: none; }
.big { font-size: 32px; font-weight: 700; letter-spacing: -.02em; line-height: 1.1; }
.sub { font-size: 13px; color: var(--muted); }
.up { color: var(--up); } .down { color: var(--down); }
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.pair > div { background: var(--soft); border-radius: 12px; padding: 10px 12px; display: flex; flex-direction: column; gap: 2px; }
.pair b { font-size: 17px; }

.pill { display: inline-flex; align-items: center; font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 999px; background: var(--soft); color: var(--muted); white-space: nowrap; }
.pill.wait { background: var(--accent-soft); color: var(--accent-ink); }
.pill.soon { background: var(--soft); color: var(--faint); }

.kid-row { display: flex; align-items: center; gap: 10px; padding: 4px 0; text-decoration: none; }
.av { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; font-size: 20px; flex: none; }
.av.victor { background: var(--victor-soft); } .av.noah { background: var(--noah-soft); }
.kid-row .nm { font-weight: 600; }
.kid-row .amt { margin-left: auto; font-weight: 700; font-size: 17px; }
.skeleton { color: transparent !important; background: var(--soft); border-radius: 6px; }

.note { font-size: 13px; color: var(--muted); line-height: 1.55; }
.btn {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 46px; padding: 0 16px; border-radius: 999px; border: 1.5px solid var(--ink);
  background: transparent; font-weight: 600; font-size: 15px; text-decoration: none; cursor: pointer;
}
.btn.solid { background: var(--ink); color: var(--bg); }
.btn.quiet { border-color: var(--line); color: var(--muted); }

.list { display: flex; flex-direction: column; }
.list .item { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-top: 1px solid var(--line); }
.list .item:first-child { border-top: 0; }
.item .t { display: flex; flex-direction: column; min-width: 0; }
.item .t small { font-size: 12px; color: var(--muted); }
.item .a, .item > .pill { margin-left: auto; }
.item .a { font-weight: 600; white-space: nowrap; }

.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; background: var(--soft); border-radius: 12px; padding: 4px; }
.seg a { text-align: center; padding: 8px; border-radius: 9px; font-weight: 600; font-size: 14px; color: var(--muted); text-decoration: none; }
.seg a.on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.08); }

/* bottom tab bar (parents) */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  background: var(--tabbar); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  border-top: 1px solid var(--line);
  padding: 6px 8px calc(6px + env(safe-area-inset-bottom, 0px));
}
.tabbar nav { max-width: 560px; margin: 0 auto; display: grid; grid-template-columns: repeat(5, 1fr); }
.tabbar a, .tabbar span {
  display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 4px 0;
  font-size: 11px; color: var(--faint); text-decoration: none; position: relative;
}
.tabbar svg { width: 24px; height: 24px; }
.tabbar nav.many a, .tabbar nav.many span { font-size: 10px; letter-spacing: -.02em; line-height: 1.1; text-align: center; word-break: keep-all; }
.tabbar .on { color: var(--ink); font-weight: 600; }
.tabbar span.off { opacity: .55; }
.tabbar span.off::after { content: "준비 중"; position: absolute; top: 0; left: 50%; margin-left: 6px; white-space: nowrap; font-size: 9px; line-height: 14px; font-weight: 600; background: var(--soft); color: var(--muted); border-radius: 999px; padding: 0 5px; }

@media (prefers-reduced-motion: reduce) { a.card:active { transform: none; } }

/* ── shared by the cash book pages ── */
.icon-btn {
  width: 40px; height: 40px; border-radius: 12px; border: 0; background: transparent; color: var(--ink);
  display: grid; place-items: center; font-size: 20px; cursor: pointer; text-decoration: none; flex: none;
}
.icon-btn svg { width: 22px; height: 22px; }
.icon-btn:active { background: var(--soft); }
.chip {
  display: inline-flex; align-items: center; gap: 4px; min-height: 30px; padding: 0 11px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink); font-size: 13px; font-weight: 600;
  cursor: pointer; white-space: nowrap;
}
.chip.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.mono { font-family: ui-monospace, "SF Mono", Menlo, monospace; letter-spacing: .02em; }
.meter { height: 8px; border-radius: 4px; background: var(--soft); overflow: hidden; }
.meter > span { display: block; height: 100%; border-radius: 4px; background: var(--accent); }
.meter.over > span { background: var(--down); }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; color: var(--muted); }
.field input, .field select {
  width: 100%; padding: 11px 12px; font: inherit; font-size: 16px; font-weight: 400; color: var(--ink);
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
}
.field input:focus, .field select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.field small { font-weight: 400; color: var(--faint); }
/* 지금 잔고 — the Korean overdraft block */
.bal-kr { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line); display: grid; gap: 4px; }
.bal-kr .kr-head { display: flex; justify-content: space-between; align-items: center; }
.bal-kr .linkbtn { padding: 0; font-size: 13px; }
.linkbtn { border: 0; background: none; padding: 6px 0; color: var(--accent-ink); font-weight: 600; font-size: 14px; cursor: pointer; text-align: left; }
.btn:disabled { opacity: .35; cursor: default; }
.btn.danger { color: var(--down); border-color: var(--down); }

.fab {
  position: fixed; z-index: 11; right: 16px; bottom: calc(76px + env(safe-area-inset-bottom, 0px));
  height: 52px; padding: 0 20px; border-radius: 999px; border: 0; background: var(--ink); color: var(--bg);
  font-size: 15px; font-weight: 700; box-shadow: 0 8px 24px -8px rgba(0,0,0,.35); cursor: pointer;
}
@media (min-width: 600px) { .fab { right: calc(50% - 264px); } }

.toast {
  position: fixed; z-index: 40; left: 16px; right: 16px; bottom: calc(140px + env(safe-area-inset-bottom, 0px));
  max-width: 420px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 16px; border-radius: 14px; background: var(--ink); color: var(--bg); font-size: 14px; font-weight: 600;
}
.toast button { border: 0; background: none; color: var(--accent); font: inherit; font-weight: 700; cursor: pointer; }
@media (prefers-color-scheme: dark) { .toast button { color: #0A7266; } }

/* full-screen sheet (entry form, pickers) */
.sheet { position: fixed; inset: 0; z-index: 30; background: var(--bg); display: flex; justify-content: center; }
.sheet-inner {
  width: 100%; max-width: 560px; height: 100%; display: flex; flex-direction: column;
  padding: env(safe-area-inset-top, 0px) 0 env(safe-area-inset-bottom, 0px);
}
.sheet-head { display: flex; align-items: center; gap: 4px; padding: 8px 8px 4px; }
.sheet-head b { flex: 1; text-align: center; font-size: 17px; }
.sheet-head .step { font-size: 12px; color: var(--faint); min-width: 40px; text-align: right; }
.sheet-body { flex: 1; min-height: 0; overflow-y: auto; padding: 8px 16px 16px; display: flex; flex-direction: column; gap: 12px; }
.sheet-foot { padding: 8px 16px 14px; display: flex; flex-direction: column; gap: 10px; }

/* payment-method list */
.pm { display: flex; flex-direction: column; }
.pm .g { font-size: 12px; font-weight: 700; color: var(--faint); padding: 10px 2px 4px; }
.pm button {
  display: flex; align-items: center; gap: 12px; width: 100%; padding: 11px 12px; border: 0; border-radius: 12px;
  background: transparent; font: inherit; font-size: 15px; text-align: left; cursor: pointer;
}
.pm button.on { background: var(--accent-soft); font-weight: 600; }
.pm .due { margin-left: auto; font-size: 12px; color: var(--muted); }
.pm .ck { color: var(--accent-ink); font-weight: 700; width: 16px; }
.pmic { width: 24px; height: 18px; flex: none; }   /* payment-method icon: KCF.methodIcon */

/* 아침 확인 — the morning check's reports (home card + 더보기 list) */
.mr-line { margin: 0; font-size: 15px; line-height: 1.5; }
.mr-full { white-space: pre-wrap; font-size: 14px; line-height: 1.65; color: var(--ink);
  background: var(--soft); border-radius: 12px; padding: 12px 14px; overflow-wrap: anywhere; }
.mr-actions { display: flex; gap: 16px; flex-wrap: wrap; align-items: center; }
.mr-list { display: flex; flex-direction: column; gap: 8px; }
.mr-list .item { cursor: pointer; }
.mr-close { border: 0; background: none; color: var(--muted); font: inherit; font-size: 13px; font-weight: 600; padding: 4px 2px; cursor: pointer; }
.pill.new { background: var(--accent-soft); color: var(--accent-ink); }
