/* 예적금 장부 — 화면 스타일
   population.leunkim.com과 같은 디자인 언어: 옅은 배경 위 1px 테두리 카드, 파랑 한 계열 강조,
   IBM Plex Sans KR, 그림자·그라디언트 없음, OS 설정을 따르는 다크 모드. */
:root{
  --bg:#f3f5f8; --surface:#ffffff; --surface-2:#f7f9fb;
  --ink:#12161c; --ink-2:#465061; --muted:#768092;
  --line:#dfe4eb; --line-strong:#c4ccd8;
  --accent:#2a78d6; --accent-strong:#1c5fb4; --on-accent:#ffffff; --accent-soft:#e3eefb;
  --hover-col:#eef2f7; --warn-bg:#fff4dc; --warn-ink:#6b4a00;
  --neg:#c0392b; --neg-bg:#fdecea; --neg-line:#f1c5bf;
  --pos:#1b7a4b; --pos-bg:#e4f3ea; --pos-line:#b9dcc7;
  --corp-row:#fffaea; --flash:#ffeeb0;
  --series-1:#b7791f; --series-2:#2a78d6; --series-3:#1b8a5a; --series-4:#8250c4;
  --own-2-ink:#6b3fa8; --own-2-bg:#efe6fa;
  --font:"IBM Plex Sans KR","Apple SD Gothic Neo","Malgun Gothic","Noto Sans KR",system-ui,sans-serif;
  --r:10px;
  --float-shadow:0 8px 30px rgba(0,0,0,.16);

  /* 예전 이름. 스크립트 안의 인라인 스타일이 아직 이 이름을 쓴다. */
  --white:var(--surface); --paper:var(--surface); --paper-dark:var(--surface-2);
  --ink-soft:var(--ink-2); --ink-faint:var(--muted);
  --gold:var(--accent-strong); --gold-soft:var(--accent);
  --mint:var(--pos); --danger:var(--neg);
  --grid-line:var(--line); --paper-line:var(--line); --rule:var(--line-strong);
  --stamp-red:var(--neg); --gain-green:var(--pos); --gain-green-bg:var(--pos-bg); --gain-bg:var(--pos-bg);
  --corp:var(--warn-bg); --corp-bg:var(--corp-row); --cover-navy:var(--ink);
}
/* 어두운 화면: 제목 아래의 화면 단추로 고르면 <html data-theme="dark"> 가 붙는다. 고르기 전에는 기기 설정과 상관없이 밝은 화면이다. */
:root{color-scheme:light;}
:root[data-theme="dark"]{
    color-scheme:dark;
    --bg:#0e1114; --surface:#161a1f; --surface-2:#1b2026;
    --ink:#eef1f4; --ink-2:#bcc4cf; --muted:#8a94a3;
    --line:#272e37; --line-strong:#3a434f;
    --accent:#3987e5; --accent-strong:#6da7ec; --on-accent:#0b121b; --accent-soft:#16283f;
    --hover-col:#1d232b; --warn-bg:#3a2d0c; --warn-ink:#f3d58a;
    --neg:#ff8576; --neg-bg:#3a1c18; --neg-line:#5e2c26;
    --pos:#62d093; --pos-bg:#13301f; --pos-line:#25553c;
    --corp-row:#221d0d; --flash:#4a3d10;
    --series-1:#e3b53a; --series-2:#5e9ffa; --series-3:#62d093; --series-4:#b794f4;
    --own-2-ink:#c9aef5; --own-2-bg:#2a1f3d;
    --float-shadow:0 8px 30px rgba(0,0,0,.5);
}

*{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:15px; line-height:1.55;
}
button, input, select, textarea{font-family:inherit;}
button{color:inherit;}
:focus-visible{outline:2px solid var(--accent); outline-offset:2px;}
input[type=checkbox], input[type=radio]{accent-color:var(--accent);}

#app{min-height:100vh;}
.wrap{
  max-width:1680px; margin:0 auto; padding-block:28px 56px;
  padding-left:max(16px, env(safe-area-inset-left)); padding-right:max(16px, env(safe-area-inset-right));
  display:flex; flex-direction:column; gap:18px;
}

/* ---------- 머리말 ---------- */
.head h1{
  font-size:clamp(24px,4vw,32px); font-weight:700; letter-spacing:-.02em; line-height:1.2;
  margin:0 0 6px; text-wrap:balance;
}
.lede{margin:0; color:var(--ink-2); max-width:60ch;}
.status{display:flex; align-items:center; gap:10px 12px; flex-wrap:wrap; margin-top:12px; font-size:13.5px;}
.stamp{
  display:inline-flex; align-items:center; gap:7px; padding:4px 10px;
  border:1px solid var(--line-strong); border-radius:999px; background:var(--surface); font-weight:600;
}
.stamp i{width:8px; height:8px; border-radius:50%; background:var(--pos); flex-shrink:0;}
.stamp[data-state="dirty"] i, .stamp[data-state="saving"] i{background:var(--accent);}
.stamp[data-state="error"]{border-color:var(--neg); color:var(--neg); cursor:pointer;}
.stamp[data-state="error"] i{background:var(--neg);}
.linkbtn{
  color:var(--accent-strong); text-decoration:underline; text-underline-offset:3px;
  background:none; border:none; padding:0; font-size:inherit; cursor:pointer;
}
.status .blog{margin-inline-start:auto;}
.theme-btn{
  display:inline-flex; align-items:center; gap:7px; font-size:13.5px; padding:5px 11px; border-radius:8px; cursor:pointer;
  border:1px solid var(--line-strong); background:var(--surface); color:var(--ink);
}
.theme-btn:hover{background:var(--hover-col);}
.theme-btn i{width:10px; height:10px; border-radius:50%; border:1px solid var(--ink-2); background:linear-gradient(90deg, var(--ink-2) 50%, transparent 50%);}
.guest-note{margin:10px 0 0; font-size:13px; color:var(--muted); max-width:80ch;}

/* ---------- 통계 ---------- */
.stats{
  display:grid; grid-template-columns:repeat(5,1fr);
  background:var(--surface); border:1px solid var(--line); border-radius:var(--r); overflow:hidden;
}
.stat{padding:14px 16px; border-left:1px solid var(--line); min-width:0;}
.stat:first-child{border-left:none;}
.stat .k{font-size:12.5px; font-weight:600; color:var(--ink-2);}
.stat .v{font-size:20px; font-weight:700; letter-spacing:-.01em; margin-top:2px; font-variant-numeric:tabular-nums;}
.stat .v.gold{color:var(--accent-strong);}

/* ---------- 도구 모음 ---------- */
.panel{background:var(--surface); border:1px solid var(--line); border-radius:var(--r);}
.toolbar{padding:4px 16px;}
.tb-row{display:flex; align-items:center; gap:8px; flex-wrap:wrap; padding:12px 0; border-top:1px solid var(--line);}
.tb-row:first-child{border-top:none;}
.tb-label{font-size:13px; font-weight:600; color:var(--ink-2); min-width:3.2em;}
#ownerChips{display:contents;}
.search{
  flex:1; min-width:200px; font-size:14px; color:var(--ink);
  background:var(--surface); border:1px solid var(--line-strong); border-radius:8px; padding:7px 10px;
}
.chip{
  font-size:13.5px; padding:5px 11px; border-radius:999px; cursor:pointer; white-space:nowrap;
  border:1px solid var(--line-strong); background:var(--surface); color:var(--ink);
}
.chip:hover{background:var(--hover-col);}
.chip.chip-add{border-style:dashed; color:var(--accent-strong);}
.chip.active{background:var(--accent-strong); border-color:var(--accent-strong); color:var(--on-accent); font-weight:600;}
.mbtn{
  font-size:13.5px; padding:6px 12px; border-radius:8px; cursor:pointer; white-space:nowrap;
  border:1px solid var(--line-strong); background:var(--surface); color:var(--ink);
}
.mbtn:hover{background:var(--hover-col);}
.mbtn:disabled{opacity:.55; cursor:default;}
.mbtn.live-chart-on{background:var(--accent-soft); border-color:var(--accent); color:var(--accent-strong); font-weight:600;}
.tb-sep{width:1px; align-self:stretch; background:var(--line); margin:0 4px;}
.btn-add{
  font-size:14px; font-weight:600; padding:8px 16px; border-radius:8px; cursor:pointer; white-space:nowrap;
  border:1px solid var(--accent-strong); background:var(--accent-strong); color:var(--on-accent);
}

/* ---------- 구분별 표 ---------- */
#listRoot{display:flex; flex-direction:column; gap:18px;}
.section-head{display:flex; align-items:baseline; gap:10px; margin:0 2px 8px;}
.section-head h2{font-size:17px; font-weight:700; letter-spacing:-.01em; margin:0;}
.section-head .cnt{font-size:12.5px; color:var(--ink-2); font-variant-numeric:tabular-nums;}
.section-line{display:none;}

.tablewrap{background:var(--surface); border:1px solid var(--line); border-radius:var(--r);}
@media (max-width:1560px){ .tablewrap{overflow-x:auto;} }
.tablewrap table{width:100%; border-collapse:collapse; font-size:12.8px; font-variant-numeric:tabular-nums;}
.tablewrap thead th{
  background:var(--surface-2); color:var(--ink-2); font-weight:600; text-align:left;
  padding:7px 3px; font-size:12px; white-space:nowrap;
  border-bottom:1px solid var(--line-strong); position:sticky; top:0; z-index:1;
}
.tablewrap thead th:first-child{border-top-left-radius:9px;}
.tablewrap thead th:last-child{border-top-right-radius:9px;}
.tablewrap tbody td{padding:5px 3px; border-bottom:1px solid var(--line); white-space:nowrap; color:var(--ink);}
.tablewrap tbody tr:hover td{background:var(--hover-col);}
.tablewrap thead th:nth-child(2), .tablewrap thead th:nth-child(3),
.tablewrap tbody td:nth-child(2), .tablewrap tbody td:nth-child(3){width:1%;}
.tablewrap thead th:last-child, .tablewrap tbody td:last-child, .tablewrap tfoot td:last-child{width:1%; padding-inline:6px;}
.tablewrap tfoot td{
  background:var(--surface-2); font-weight:700; padding:7px 3px; border-top:1px solid var(--line-strong);
}
.tablewrap tfoot td:first-child{border-bottom-left-radius:9px;}
.tablewrap tfoot td:last-child{border-bottom-right-radius:9px;}
.tablewrap tfoot td.label{color:var(--ink-2); padding-left:10px;}
th.chk-col, td.chk-col{width:1%; text-align:center; padding-inline:8px !important;}
th.chk-col input, td.chk-col input{width:14px; height:14px; cursor:pointer; vertical-align:middle;}
.sort-btn{
  display:inline-flex; align-items:center; justify-content:center; flex-shrink:0;
  border:none; background:transparent; cursor:pointer; color:var(--muted);
  font-size:9px; line-height:1; padding:0; width:14px; height:14px; border-radius:3px;
}
.sort-btn:hover{background:var(--hover-col); color:var(--ink);}
.sort-btn.active{color:var(--accent-strong);}
.th-inner{display:inline-flex; align-items:center; gap:3px;}
.mono{text-align:center;}
.num{text-align:right;}
.bankname{font-weight:600;}
.prod{color:var(--ink-2); font-size:12px;}
.prod-with-tag{display:inline-flex; align-items:center; gap:6px;}
.row-idx{display:inline-block; font-size:11px; color:var(--muted); margin-right:6px; font-weight:600;}
.tag-owner, .tag-free-savings{
  display:inline-block; font-size:11px; font-weight:600; line-height:1.5;
  padding:0 7px; border-radius:999px; margin-right:6px; vertical-align:1px;
}
.tag-owner-n0{color:var(--accent-strong); background:var(--accent-soft);}
.tag-owner-n1{color:var(--pos); background:var(--pos-bg);}
.tag-owner-n2{color:var(--own-2-ink); background:var(--own-2-bg);}
.tag-owner-n3{color:var(--warn-ink); background:var(--warn-bg);}
.tag-free-savings{color:var(--pos); background:var(--pos-bg); margin-right:0;}
.memo-btn{display:inline-flex; margin-left:6px; font-size:12px; cursor:help; position:relative;}
.memo-btn::after{
  content:attr(data-memo); position:absolute; left:50%; bottom:calc(100% + 6px); transform:translateX(-50%);
  background:var(--ink); color:var(--bg); padding:5px 8px; border-radius:6px;
  font-size:12.5px; line-height:1.35; white-space:pre-wrap; width:max-content; max-width:240px;
  opacity:0; visibility:hidden; pointer-events:none; z-index:20;
}
.memo-btn:hover::after{opacity:1; visibility:visible;}
.neg{color:var(--neg); font-weight:600;}
.maturity-soon{color:var(--neg); font-weight:600;}
.pay-done-btn{
  display:inline-flex; align-items:center; margin-left:6px; padding:0 7px; height:17px;
  border-radius:999px; border:1px solid var(--pos-line); background:var(--pos-bg); color:var(--pos);
  font-size:11px; font-weight:600; line-height:1; cursor:pointer; white-space:nowrap; vertical-align:1px;
}
.pay-done-btn:hover:not(:disabled){background:var(--pos); border-color:var(--pos); color:var(--surface);}
.pay-done-btn:disabled{background:var(--surface-2); border-color:var(--line); color:var(--muted); cursor:default;}
.editable-balance, .editable-rate{cursor:pointer; border-bottom:1px dashed var(--accent); padding-bottom:1px;}
.editable-balance:hover, .editable-rate:hover{background:var(--accent-soft);}
.balance-edit-input{
  width:130px; padding:3px 6px; border:1px solid var(--accent); border-radius:6px;
  font-size:inherit; text-align:right; color:var(--ink); background:var(--surface);
}
.rowbtns{display:flex; gap:2px;}
.icon-btn{
  border:none; background:transparent; cursor:pointer; padding:3px 5px; border-radius:6px;
  color:var(--ink-2); font-size:13px; line-height:1.2;
}
.icon-btn:hover{background:var(--hover-col); color:var(--ink);}
.icon-btn.del:hover{background:var(--neg-bg); color:var(--neg);}
.icon-btn.prepay-btn.has-plan{background:var(--accent-soft);}
.draggable-row{cursor:grab;}
.draggable-row.dragging{opacity:.4;}
tr.draggable-row.drag-over td{box-shadow:inset 0 2px 0 var(--accent), inset 0 -2px 0 var(--accent);}
.card.draggable-row.drag-over{outline:2px dashed var(--accent); outline-offset:-2px;}
@keyframes justSavedFlash{
  0%, 75%{background-color:var(--flash);}
  100%{background-color:transparent;}
}
tr.just-saved td{animation:justSavedFlash 2s ease;}
.card.just-saved{animation:justSavedFlash 2s ease;}
@keyframes deleteTargetPulse{
  from{box-shadow:0 0 0 0 rgba(192,57,43,.4);}
  to{box-shadow:0 0 0 7px rgba(192,57,43,0);}
}
tr.delete-target{outline:2px solid var(--neg); outline-offset:-2px; animation:deleteTargetPulse 1.1s ease-in-out infinite;}
tr.delete-target td{background:var(--neg-bg) !important;}
.card.delete-target{outline:2px solid var(--neg); outline-offset:-2px; background:var(--neg-bg); animation:deleteTargetPulse 1.1s ease-in-out infinite;}

.empty{
  text-align:center; padding:44px 20px; color:var(--ink-2);
  background:var(--surface); border:1px solid var(--line); border-radius:var(--r);
}
.empty .big{font-size:16px; font-weight:700; margin-bottom:4px; color:var(--ink);}

/* ---------- 카드(좁은 화면) ---------- */
.cards{display:none; flex-direction:column; gap:10px;}
.cards .card{background:var(--surface); border:1px solid var(--line); border-radius:var(--r); padding:12px 14px;}
.card-top{display:flex; justify-content:space-between; align-items:flex-start; gap:10px;}
.card-top .names{display:flex; flex-direction:column; gap:2px;}
.card-top .bankname{font-size:15px;}
.card-grid{display:grid; grid-template-columns:1fr 1fr; gap:8px 14px; margin-top:10px; font-size:13px; font-variant-numeric:tabular-nums;}
.card-grid .k{color:var(--ink-2); font-size:11.5px;}
.card-actions{display:flex; gap:8px; margin-top:12px;}
.card-actions button{
  flex:1; padding:7px; border-radius:8px; border:1px solid var(--line-strong); background:var(--surface);
  font-size:13px; cursor:pointer; color:var(--ink);
}
.card-actions button.prepay-btn.has-plan{color:var(--accent-strong); border-color:var(--accent); font-weight:600;}

/* ---------- 모달 ---------- */
.overlay{
  position:fixed; inset:0; background:rgba(0,0,0,.5);
  display:none; align-items:center; justify-content:center; z-index:50; padding:20px;
}
.overlay.show{display:flex;}
.modal{
  background:var(--surface); border:1px solid var(--line); border-radius:12px;
  max-width:860px; width:100%; max-height:88vh; overflow-y:auto;
}
.modal.narrow{max-width:460px;}
.modal-head{
  padding:14px 20px; border-bottom:1px solid var(--line); display:flex; justify-content:space-between; align-items:center;
  position:sticky; top:0; background:var(--surface); z-index:2;
}
.modal-head h3{margin:0; font-size:17px; font-weight:700; letter-spacing:-.01em;}
.modal-close{background:none; border:none; font-size:18px; cursor:pointer; color:var(--ink-2); padding:2px 6px; border-radius:6px;}
.modal-close:hover{background:var(--hover-col);}
.modal-body{padding:16px 20px;}
.form-grid{display:grid; grid-template-columns:1fr 1fr; gap:14px;}
.form-grid .full{grid-column:1/-1;}
.modal label{display:block; font-size:13px; color:var(--ink-2); margin-bottom:5px; font-weight:600;}
.modal input[type=text], .modal input[type=number], .modal select, .modal textarea{
  width:100%; padding:7px 10px; border:1px solid var(--line-strong); border-radius:8px;
  font-size:14px; background:var(--surface); color:var(--ink);
}
.modal textarea{resize:vertical; min-height:36px;}
.modal input:disabled{background:var(--surface-2); color:var(--muted); cursor:not-allowed;}
input.invalid{border-color:var(--neg) !important; background:var(--neg-bg) !important;}
.toggle-row{display:flex; align-items:center; gap:8px; margin-top:6px; flex-wrap:wrap;}
.toggle-row input{width:auto;}
.owner-btn{
  padding:4px 11px; border-radius:999px; border:1px solid var(--line-strong); background:var(--surface);
  color:var(--ink); font-size:13px; cursor:pointer;
}
.owner-btn:hover{background:var(--hover-col);}
.owner-btn.selected{background:var(--accent-strong); border-color:var(--accent-strong); color:var(--on-accent); font-weight:600;}
.group-toggle{display:flex; flex-wrap:nowrap; border:1px solid var(--line-strong); border-radius:8px; overflow:hidden; background:var(--surface);}
.group-btn{
  flex:1 1 auto; min-width:0; padding:7px 10px; border:none; border-left:1px solid var(--line-strong);
  background:transparent; color:var(--ink-2); font-size:13px; cursor:pointer;
  white-space:nowrap; overflow:hidden; text-overflow:ellipsis;
}
.group-btn:first-child{border-left:none;}
.group-btn:hover{background:var(--hover-col);}
.group-btn.selected{background:var(--accent-strong); color:var(--on-accent); font-weight:600;}
.modal-foot{
  padding:12px 20px 14px; display:flex; gap:8px; justify-content:flex-end;
  border-top:1px solid var(--line); position:sticky; bottom:0; background:var(--surface);
}
.btn{padding:8px 16px; border-radius:8px; border:1px solid var(--line-strong); font-size:14px; cursor:pointer; background:var(--surface); color:var(--ink);}
.btn-cancel:hover{background:var(--hover-col);}
.btn-save{background:var(--accent-strong); border-color:var(--accent-strong); color:var(--on-accent); font-weight:600;}
.btn-danger{background:var(--surface); border-color:var(--neg); color:var(--neg); font-weight:600;}
.btn-danger:hover{background:var(--neg-bg);}
.helptext{font-size:12.5px; color:var(--muted); margin-top:12px; line-height:1.5;}

.toast{
  position:fixed; bottom:24px; left:50%; transform:translateX(-50%);
  background:var(--ink); color:var(--bg); padding:9px 16px; border-radius:8px;
  font-size:13.5px; opacity:0; visibility:hidden; pointer-events:none; z-index:300;
  white-space:pre-line; text-align:center; line-height:1.5; max-width:min(560px, calc(100vw - 32px));
}
.toast.show{opacity:1; visibility:visible;}

.confirm-overlay{position:fixed; inset:0; z-index:200; display:none; align-items:center; justify-content:center; padding:20px;}
.confirm-overlay.show{display:flex;}
.confirm-box{
  background:var(--surface); border:1px solid var(--line-strong); border-radius:12px;
  padding:18px 20px; max-width:380px; width:100%; box-shadow:var(--float-shadow);
}
.confirm-box p{margin:0 0 16px; font-size:14.5px; line-height:1.5;}
.confirm-actions{display:flex; gap:8px; justify-content:flex-end;}
.confirm-actions button{padding:8px 16px; border-radius:8px; font-size:14px; cursor:pointer; font-weight:600; border:1px solid var(--line-strong); background:var(--surface);}
#confirmOkBtn{background:var(--accent-strong); border-color:var(--accent-strong); color:var(--on-accent);}

.foot{font-size:12px; color:var(--muted); padding:4px 2px 0;}
.fatal{
  background:var(--warn-bg); color:var(--warn-ink); border-radius:8px; padding:10px 14px; font-size:14px;
}

/* ---------- 실시간 현금흐름 패널 ---------- */
#liveChartPanel{
  display:none; position:fixed; right:18px; bottom:18px; width:min(760px, calc(100vw - 36px));
  min-width:320px; min-height:160px; max-width:calc(100vw - 36px); max-height:90vh;
  overflow:auto; resize:both; background:var(--surface); border:1px solid var(--line-strong); border-radius:var(--r);
  box-shadow:var(--float-shadow); z-index:150;
}
#liveChartPanelHead{
  display:flex; align-items:center; justify-content:space-between; padding:10px 14px;
  background:var(--surface-2); border-bottom:1px solid var(--line); font-size:15px; font-weight:700;
  position:sticky; top:0; z-index:1;
}
#liveChartPanelClose{background:transparent; border:none; font-size:16px; cursor:pointer; padding:2px 6px; border-radius:6px; color:var(--ink-2);}
#liveChartPanelClose:hover{background:var(--hover-col);}

/* ---------- 전체 화면 창: 선납이연 계산기 / 통합잔고 ---------- */
.prepay-overlay{
  position:fixed; inset:0; z-index:60; display:none; overflow-y:auto; background:var(--bg);
  padding:28px max(16px, env(safe-area-inset-right)) 56px max(16px, env(safe-area-inset-left));
}
#prepayOverlay{z-index:70;}
.prepay-overlay.show{display:block;}
.book{max-width:1080px; margin:0 auto;}
#cashProjectionOverlay .book{max-width:1680px;}
.book .cover{padding:0 250px 16px 0; min-height:74px;}
.book .cover-eyebrow{font-size:12.5px; font-weight:600; color:var(--accent-strong); margin-bottom:4px;}
.book .cover h1{font-size:clamp(22px,3.4vw,28px); font-weight:700; letter-spacing:-.02em; line-height:1.2; margin:0 0 6px;}
.book .cover p{margin:0; color:var(--ink-2); font-size:14px; max-width:70ch;}
.cover-actions{
  position:fixed; top:14px; right:max(16px, calc((100vw - 1080px) / 2)); display:flex; gap:8px; z-index:5;
  padding:6px; background:var(--bg); border:1px solid var(--line); border-radius:var(--r);
}
#cashProjectionOverlay .cover-actions{right:max(16px, calc((100vw - 1680px) / 2));}
.cover-actions button{
  padding:8px 14px; border-radius:8px; font-size:14px; cursor:pointer; font-weight:600;
  border:1px solid var(--line-strong); background:var(--surface); color:var(--ink);
}
.cover-actions button:hover{background:var(--hover-col);}
.cover-actions .prepay-save{background:var(--accent-strong); border-color:var(--accent-strong); color:var(--on-accent);}
.cover-actions .prepay-save:hover{background:var(--accent-strong);}

.book .pages{display:flex; flex-direction:column; gap:18px;}
.book .section{background:var(--surface); border:1px solid var(--line); border-radius:var(--r); padding:14px 16px 16px;}
.book .section-head{display:flex; align-items:center; gap:8px; margin:0 0 12px;}
.book .section-head.export-head{flex-wrap:wrap;}
.book .section-head .num{
  display:inline-flex; align-items:center; justify-content:center; width:20px; height:20px; flex-shrink:0;
  border-radius:50%; background:var(--accent-soft); color:var(--accent-strong); font-size:12px; font-weight:700; line-height:1;
}
.book .section-head h2{font-size:17px !important; font-weight:700; letter-spacing:-.01em; margin:0;}
.book .export-actions{margin-left:auto; display:flex; gap:8px; flex-wrap:wrap;}
.book .export-actions.export-actions-centered{margin-left:0; justify-content:center;}
.book .btn-chip{
  display:inline-flex; align-items:center; justify-content:center; white-space:nowrap;
  border:1px solid var(--line-strong); background:var(--surface); color:var(--ink); border-radius:8px;
  padding:6px 12px; font-size:13.5px; cursor:pointer; line-height:1.4;
}
.book .btn-chip:hover{background:var(--hover-col);}
.book .btn-chip:disabled{opacity:.55; cursor:default;}
.book .field-grid{display:grid; grid-template-columns:repeat(3, 1fr); gap:14px 16px;}
.book .field-grid.two{grid-template-columns:repeat(2, 1fr);}
.book .field{display:flex; flex-direction:column; gap:5px; min-width:0;}
.book .field label{font-size:13px; color:var(--ink-2); font-weight:600;}
.book .field .input-line{
  display:flex; align-items:center; gap:6px; padding:6px 9px;
  border:1px solid var(--line-strong); border-radius:8px; background:var(--surface);
}
.book .field .input-line:focus-within{outline:2px solid var(--accent); outline-offset:2px;}
.book .field .input-line:has(input:disabled){background:var(--surface-2);}
.book .field input[type="number"], .book .field input[type="text"]{
  border:none; background:transparent !important; outline:none; font-size:14px; color:var(--ink) !important;
  width:100%; padding:0; font-variant-numeric:tabular-nums;
}
.book .field .unit{font-size:13px; color:var(--muted); white-space:nowrap;}
.book .toggle-row{display:flex; gap:8px; flex-wrap:wrap; margin-top:0;}
.book .toggle-row-tax{gap:6px; flex-wrap:nowrap;}
.book .toggle-pill{
  display:flex; align-items:center; gap:8px; flex:1; min-width:120px; cursor:pointer;
  border:1px solid var(--line-strong); border-radius:8px; padding:7px 11px;
  font-size:13.5px; color:var(--ink-2); background:var(--surface); font-weight:400;
}
.book .toggle-pill.toggle-pill-compact{min-width:0; padding:6px 8px; gap:6px;}
.book .toggle-pill.toggle-pill-compact span:not(.box){font-size:12px; line-height:1.35; white-space:nowrap;}
.book .toggle-pill input{display:none;}
.book .toggle-pill .box{
  width:14px; height:14px; border-radius:50%; border:1px solid var(--line-strong);
  display:flex; align-items:center; justify-content:center; flex-shrink:0;
}
.book .toggle-pill .box::after{content:""; width:8px; height:8px; border-radius:50%; background:var(--accent-strong); transform:scale(0);}
.book .toggle-pill input:checked ~ .box{border-color:var(--accent-strong);}
.book .toggle-pill input:checked ~ .box::after{transform:scale(1);}
.book .toggle-pill:has(input:checked){border-color:var(--accent-strong); background:var(--accent-soft); color:var(--ink);}
.book .toggle-pill strong{font-weight:600;}
.book .summary-top{
  background:var(--surface-2); border:1px solid var(--line); border-radius:8px;
  padding:12px 14px; margin-bottom:12px; font-size:14px; line-height:1.7;
}
.book .result-grid{display:grid; grid-template-columns:repeat(4, 1fr); gap:10px;}
.book .card{border:1px solid var(--line); border-radius:8px; padding:11px 14px; background:var(--surface-2);}
.book .card .label{font-size:12.5px; color:var(--ink-2); font-weight:600; margin-bottom:2px;}
.book .card .value{font-weight:700; font-size:22px; letter-spacing:-.01em; font-variant-numeric:tabular-nums;}
.book .card .value.small{font-size:15px;}
.book .card .sub{font-size:12px; color:var(--muted); margin-top:2px;}
.book .card.highlight, .book .card.highlight-warn, .book .card.highlight-safe, .book .card.highlight-zero{grid-column:span 2;}
.book .card.highlight .value, .book .card.highlight-warn .value, .book .card.highlight-safe .value, .book .card.highlight-zero .value{font-size:26px;}
.book .card.highlight, .book .card.highlight-zero{background:var(--pos-bg); border-color:var(--pos-line);}
.book .card.highlight .value, .book .card.highlight-zero .value, .book .card.highlight-zero .label{color:var(--pos);}
.book .card.highlight-warn{background:var(--neg-bg); border-color:var(--neg-line);}
.book .card.highlight-warn .value, .book .card.highlight-warn .label{color:var(--neg);}
.book .card.highlight-safe{background:var(--accent-soft); border-color:var(--accent);}
.book .card.highlight-safe .value, .book .card.highlight-safe .label{color:var(--accent-strong);}
.book .plain-rows{margin-top:10px;}
.book .plain-row{display:flex; justify-content:space-between; padding:8px 2px; border-bottom:1px solid var(--line); font-size:14px;}
.book .plain-row:last-child{border-bottom:none;}
.book .plain-row .l{color:var(--ink-2);}
.book .plain-row .v{font-weight:600; font-variant-numeric:tabular-nums;}
.book .table-wrap{overflow-x:auto; border:1px solid var(--line); border-radius:8px;}
.book table{width:100%; border-collapse:collapse; font-size:13.5px; font-variant-numeric:tabular-nums;}
.book .table-wrap table{min-width:700px;}
.book thead th{
  background:var(--surface-2); color:var(--ink-2); font-weight:600; font-size:12.5px; text-align:right;
  padding:8px 10px; border-bottom:1px solid var(--line-strong); white-space:nowrap;
}
.book .table-wrap thead th:nth-child(2), .book .table-wrap thead th:nth-child(3), .book .table-wrap thead th:nth-child(4),
.book .table-wrap tbody td:nth-child(2), .book .table-wrap tbody td:nth-child(3), .book .table-wrap tbody td:nth-child(4){text-align:left;}
.book .table-wrap tbody td{padding:4px 10px; text-align:right; border-bottom:1px solid var(--line); white-space:nowrap;}
.book .table-wrap tbody tr:hover td{background:var(--hover-col);}
.book th.chk-col, .book td.chk-col{width:34px; text-align:center !important;}
.book input.row-check, .book #checkAll{width:15px; height:15px; cursor:pointer;}
.book td.round-idx{font-weight:700; color:var(--ink-2);}
.book td.actual-cell{display:flex; align-items:center; gap:6px;}
.book input.actual-date{
  border:1px solid var(--line-strong); border-radius:6px; padding:4px 7px; font-size:13px;
  color:var(--ink); background:var(--surface); width:108px; font-variant-numeric:tabular-nums;
}
.book .fill-down-btn, .book .fill-up-btn{
  display:inline-flex; align-items:center; justify-content:center; flex-shrink:0;
  border:1px solid var(--line-strong); background:var(--surface); color:var(--ink-2); border-radius:6px;
  width:24px; height:24px; font-size:12px; line-height:1; cursor:pointer; padding:0;
}
.book .fill-down-btn:hover, .book .fill-up-btn:hover{background:var(--hover-col); color:var(--ink);}
.book th.col-emphasis{background:var(--neg-bg); color:var(--neg);}
.book th.col-emphasis.col-emphasis-safe{background:var(--accent-soft); color:var(--accent-strong);}
.book th.col-emphasis.col-emphasis-zero{background:var(--pos-bg); color:var(--pos);}
.book .table-wrap td.col-emphasis, .book .table-wrap tbody tr:hover td.col-emphasis{background:var(--neg-bg); color:var(--neg); font-weight:700;}
.book .table-wrap td.col-emphasis.col-emphasis-safe, .book .table-wrap tbody tr:hover td.col-emphasis.col-emphasis-safe{background:var(--accent-soft); color:var(--accent-strong);}
.book .table-wrap td.col-emphasis.col-emphasis-zero, .book .table-wrap tbody tr:hover td.col-emphasis.col-emphasis-zero{background:var(--pos-bg); color:var(--pos);}
.book .tag{display:inline-block; min-width:26px; text-align:center; padding:0 7px; border-radius:999px; font-size:12px; font-weight:600;}
.book .tag.zero{color:var(--muted);}
.book .tag.early{background:var(--accent-soft); color:var(--accent-strong);}
.book .tag.late{background:var(--neg-bg); color:var(--neg);}
.book .bulk-bar{
  display:flex; align-items:flex-end; gap:10px; flex-wrap:wrap; margin-bottom:12px;
  background:var(--surface-2); border:1px solid var(--line); border-radius:8px; padding:10px 12px;
}
.book .bulk-field{min-width:160px;}
.book .payment-summary{border:1px solid var(--line); border-radius:8px; background:var(--surface-2); padding:12px 14px; margin-top:14px;}
.book .payment-summary-title{font-size:13.5px; font-weight:600; margin-bottom:8px;}
.book .payment-summary-title .hint{font-weight:400; color:var(--muted); font-size:12.5px;}
.book .chart-tooltip, .cashproj-tooltip{
  position:absolute; pointer-events:none; background:var(--ink); color:var(--bg);
  padding:5px 8px; border-radius:6px; font-size:12.5px; line-height:1.45; white-space:nowrap;
  z-index:10; opacity:0; font-variant-numeric:tabular-nums;
}
.book .chart-tooltip.show, .cashproj-tooltip.show{opacity:1;}
.cashproj-tooltip .t-date{font-weight:700; display:block;}
.cashproj-legend{display:flex; gap:14px; flex-wrap:wrap; margin-top:4px;}
.cashproj-legend label{display:flex; align-items:center; gap:6px; font-size:13.5px; cursor:pointer; user-select:none; margin:0; font-weight:400;}
.cashproj-legend input{width:auto;}
.cashproj-dot{display:inline-block; width:10px; height:10px; border-radius:50%; flex-shrink:0;}
#cashProjZoomBar{background:var(--surface) !important; border-color:var(--line-strong) !important;}
#cashProjZoomBar input{background:var(--surface); color:var(--ink); border-color:var(--line-strong) !important;}
.optimize-row{cursor:pointer;}
.optimize-row:hover td{background:var(--hover-col);}
#consolidatedScheduleWrap{border-color:var(--line) !important; border-radius:8px !important;}
#consolidatedScheduleWrap thead{background:var(--surface-2) !important;}
#consolidatedScheduleWrap thead th{background:var(--surface-2);}
#consolidatedScheduleWrap tbody tr.consolidated-overdue-row td{background:var(--neg-bg);}
#consolidatedScheduleWrap tbody tr:hover td{background:var(--hover-col);}
@keyframes consolidated-flash-anim{
  0%, 100%{background:transparent;}
  20%, 60%{background:var(--flash);}
}
#consolidatedScheduleWrap tbody tr.consolidated-flash td{animation:consolidated-flash-anim 1.6s ease;}
.book .foot-note{font-size:12.5px; color:var(--muted); line-height:1.65; padding:12px 2px 0;}
.book .hint-strong{font-size:13px; font-weight:600; color:var(--accent-strong); margin-top:8px;}

/* ---------- 좁은 화면 ---------- */
@media (max-width:880px){
  .tablewrap{display:none;}
  .cards{display:flex;}
  .stats{grid-template-columns:repeat(2,1fr);}
  .stat{border-left:none; border-top:1px solid var(--line);}
  .stat:nth-child(even){border-left:1px solid var(--line);}
  .stat:nth-child(-n+2){border-top:none;}
  .stat:last-child{grid-column:1/-1;}
  .form-grid{grid-template-columns:1fr;}
  .tb-sep{display:none;}
}
@media (max-width:720px){
  .book .field-grid, .book .field-grid.two{grid-template-columns:1fr 1fr;}
  .book .result-grid{grid-template-columns:1fr 1fr;}
  .book .cover{padding-right:0; min-height:0;}
  .prepay-overlay{padding-bottom:88px;}
  .cover-actions, #cashProjectionOverlay .cover-actions{
    top:auto; bottom:0; left:0; right:0; justify-content:flex-end; flex-wrap:wrap;
    padding:10px 16px calc(10px + env(safe-area-inset-bottom)); background:var(--surface); border-top:1px solid var(--line);
  }
  .book .section{padding:12px 12px 14px;}
}
@media (max-width:600px){
  body{font-size:14px;}
  .toolbar{padding:4px 12px;}
  .status .blog{margin-inline-start:0;}
}
@media (max-width:460px){
  .book .field-grid, .book .field-grid.two{grid-template-columns:1fr;}
  .book .result-grid{grid-template-columns:1fr;}
  .book .card.highlight, .book .card.highlight-warn, .book .card.highlight-safe, .book .card.highlight-zero{grid-column:span 1;}
}
