:root{
  --bg:#f6f7f4; --card:#fff; --ink:#1c2419; --muted:#6b7563;
  --line:#e3e7dd; --accent:#3f7d3a; --accent-weak:#eaf3e8;
  --pos:#1e7d3a; --neg:#c2362f; --shadow:0 1px 3px rgba(0,0,0,.06);
  --r:12px;
}
*{box-sizing:border-box} html,body{margin:0}
body{font-family:-apple-system,"Segoe UI",Roboto,"Malgun Gothic",sans-serif;
  background:var(--bg); color:var(--ink); font-size:14px;}
.topbar{display:flex; align-items:center; gap:24px; padding:0 20px; height:56px;
  background:var(--card); border-bottom:1px solid var(--line); position:sticky; top:0; z-index:10;}
.brand{font-weight:700; font-size:18px;}
.tabs{display:flex; gap:4px; flex:1;}
.tabs button{border:0; background:none; padding:8px 14px; border-radius:8px; cursor:pointer;
  font-size:14px; color:var(--muted);}
.tabs button:hover{background:var(--bg);}
.tabs button.active{background:var(--accent-weak); color:var(--accent); font-weight:600;}
.tabs button .ti{margin-right:5px;}
.user{color:var(--muted); font-size:13px;}
.u-name{margin-right:10px; font-size:13px; color:#555;}
.u-btn{padding:4px 10px; margin-right:6px; border:1px solid #d0d4da; border-radius:6px; background:#fff; cursor:pointer; font-size:12px; color:#555;}
.u-btn:last-child{margin-right:0;}
main{max-width:1280px; margin:0 auto; padding:24px 20px 80px;}

h2.page{margin:0 0 18px; font-size:20px; display:flex; align-items:center; gap:8px 10px; flex-wrap:wrap;}
.row{display:flex; gap:16px; flex-wrap:wrap;}
.card{background:var(--card); border:1px solid var(--line); border-radius:var(--r);
  box-shadow:var(--shadow); padding:18px;}
.card.mkt-cc{padding:7px 12px; margin-bottom:5px;}   /* 시장 탭 월별 그래프: 여백 압축(한 화면 비교) */
.tabs button.has-new{position:relative;}
.tabs button.has-new::after{content:''; position:absolute; top:5px; right:5px; width:6px; height:6px; border-radius:50%; background:#d8503a;}   /* 딸기 새 리포트 알림 점 */
.muted{color:var(--muted);} .pos{color:var(--pos);} .neg{color:var(--neg);}
.num{font-variant-numeric:tabular-nums; text-align:right;}

/* dashboard */
.farm-cards{display:grid; grid-template-columns:repeat(auto-fit,minmax(260px,1fr)); gap:16px;}
.dash-period select{font-size:13px; padding:4px 8px;}
.dash-work{display:grid; grid-template-columns:2fr 1fr; gap:16px; margin-top:18px; align-items:stretch;}
.dash-left{display:flex; flex-direction:column; min-height:0;}
.dash-left .sub, .sub{font-size:14px; margin:0 0 10px; color:var(--ink);}
.dash-left #txnList{flex:1 1 0; min-height:120px; overflow:auto;}  /* 우측 패널 높이에 맞춰 채움 → 바닥 정렬 */
.dash-right{min-width:0;}
@media(max-width:980px){
  .dash-work{grid-template-columns:1fr;}
  .dash-left #txnList{flex:none; max-height:360px;}
}
.farm-card .fc-head{display:flex; align-items:center; gap:8px; font-size:16px; font-weight:700; margin-bottom:4px;}
.farm-card .period{font-size:12px; color:var(--muted); margin-bottom:14px;}
.metric{display:flex; justify-content:space-between; padding:7px 0; border-top:1px dashed var(--line);}
.metric:first-of-type{border-top:0;}
.metric .label{color:var(--muted);}
.metric .val{font-weight:600; font-variant-numeric:tabular-nums;}

/* dashboard P&L table */
.pl-table{width:100%; border-collapse:collapse; margin-bottom:10px;}
.pl-table thead th{font-size:11px; color:var(--muted); font-weight:600; padding:6px 0 6px; text-align:right; border-top:1px dashed var(--line);}
.pl-table th{font-size:11px; color:var(--muted); font-weight:600; padding:2px 0 6px; text-align:right;}
.pl-table th:first-child{text-align:left;}
.pl-table td{padding:5px 0; font-variant-numeric:tabular-nums;}
.pl-table td.pl-label{color:var(--muted); text-align:left;}
.pl-table td.num{text-align:right; font-weight:600;}
.pl-table td.cum, .pl-table th.cum{color:var(--accent); padding-left:14px;}
.pl-table tbody tr{border-top:none;}
.fc-foot{display:flex; justify-content:space-between; font-size:12px; color:var(--muted);
  border-top:1px solid var(--line); padding-top:10px;}
.fc-foot b{color:var(--ink); font-weight:600;}
.interfarm-wrap{display:flex; flex-direction:column; gap:10px;}
.interfarm-graph{width:100%; max-width:460px; height:auto; display:block; margin:0 auto;}
.interfarm-nums{border-top:1px solid var(--line); padding-top:8px;}
.if-title{font-size:11px; font-weight:700; color:var(--ink); margin:8px 0 4px;}
.if-row{display:flex; justify-content:space-between; align-items:center; font-size:12.5px; padding:3px 0;}
.if-row span{color:var(--muted);}
.if-row b{font-variant-numeric:tabular-nums;}

/* controls */
.controls{display:flex; gap:10px; align-items:center; margin-bottom:18px; flex-wrap:wrap;}
select,input,button.btn{font-size:14px; padding:8px 10px; border:1px solid var(--line);
  border-radius:8px; background:#fff; color:var(--ink);}
button.btn{cursor:pointer; background:var(--accent); color:#fff; border-color:var(--accent); font-weight:600;}
button.btn.ghost{background:#fff; color:var(--accent);}
button.btn.sm{padding:5px 9px; font-size:13px;}
.seg{display:flex; border:1px solid var(--line); border-radius:8px; overflow:hidden;}
.seg button{border:0; background:#fff; padding:7px 12px; cursor:pointer; color:var(--muted);}
.seg button.active{background:var(--accent); color:#fff;}

/* 부채 (3농장) */
.liab-grid{display:grid; grid-template-columns:repeat(auto-fit,minmax(300px,1fr)); gap:16px; align-items:start;}
.liab-total{display:flex; justify-content:space-between; align-items:center; padding:8px 0 12px; border-bottom:2px solid var(--accent); margin-bottom:10px;}
.liab-total span{color:var(--muted); font-weight:600;}
.liab-total b{font-size:17px; font-variant-numeric:tabular-nums;}
.liab-group{margin-bottom:12px;}
.lg-title{font-size:12px; font-weight:700; color:var(--accent); margin:8px 0 4px;}
.cred-row{cursor:pointer; border-radius:6px; padding:3px 6px;}
.cred-row:hover{background:var(--accent-weak);}
.cred-row .caret{display:inline-block; font-size:10px; color:var(--muted); transition:transform .15s; margin-right:2px;}
.cred-row.open .caret{transform:rotate(90deg);}
.cred-hist{margin:2px 0 8px 10px; padding:4px 0; border-left:2px solid var(--line);}
.ch-head{font-size:11px; color:var(--muted); padding:2px 8px 4px;}
.ch-row{display:grid; grid-template-columns:54px 1fr auto; gap:6px; align-items:baseline; padding:3px 8px; font-size:12px;}
.ch-row:nth-child(even){background:#fafbf8;}
.ch-date{color:var(--muted); font-variant-numeric:tabular-nums;}
.ch-memo{color:var(--ink); overflow:hidden; text-overflow:ellipsis; white-space:nowrap;}
.ch-amt{font-variant-numeric:tabular-nums; font-weight:600;}

/* income statement */
.stmt-grid{display:grid; grid-template-columns:repeat(auto-fit,minmax(360px,1fr)); gap:16px; align-items:start;}
.stmt-col{padding:16px; overflow-x:auto;}
.stmt{width:100%; border-collapse:collapse;}
.stmt thead th{font-size:11px; color:var(--muted); font-weight:600; padding:2px 6px 6px; text-align:right;}
.stmt thead th:first-child{text-align:left;}
.stmt td{padding:5px 6px; font-size:13px;}
.stmt td.name, .stmt th:first-child{white-space:nowrap; min-width:6em;}  /* 계정명 줄바꿈 방지 */
.stmt td.amt{text-align:right; font-variant-numeric:tabular-nums; white-space:nowrap;}
.stmt td.cum, .stmt th.cum{color:var(--accent); padding-left:10px;}
.stmt td .z{color:#c4cabb;}
.stmt tr.item td{color:var(--muted);} .stmt tr.item td.name{padding-left:18px;}
.stmt tr.item td.cum{color:#7aa877;}
.stmt tr.memo td{color:#9aa491; font-size:12px; font-style:italic;}
.stmt tr.memo td.name{padding-left:18px;}
.stmt tr.total td{font-weight:700; border-top:1px solid var(--line); background:#fafbf8;}
.stmt tr.total td.cum{color:var(--accent);}
.stmt tr.grand td{font-weight:800; border-top:2px solid var(--accent); font-size:14.5px;}
/* 손익 — 법인별 섹션 */
.inc-farm{margin:0 0 34px; padding:0 0 10px; border-bottom:2px solid var(--line);}
.inc-farm-head{font-size:18px; font-weight:800; margin:20px 0 12px; padding:8px 12px; background:#f1edfb; border-left:4px solid #7c5cd6; border-radius:6px; display:flex; align-items:center; gap:8px;}
.inc-yearsel{margin-left:14px; font-weight:400;}
.inc-yearsel select, .inc-farm-head select#incFarmPick, .inc-farm-head select#bsFarmPick{padding:4px 8px; border:1px solid #c9b8ec; border-radius:6px; background:#fff; font-size:13px;}
.inc-farm-head select#incFarmPick, .inc-farm-head select#bsFarmPick{font-size:16px; font-weight:700;}
/* 운영지표 입력 그리드 */
.met-table{border-collapse:collapse; width:100%;}
.met-table th, .met-table td{padding:3px 4px; font-size:11px; text-align:center; border-bottom:1px solid var(--line);}
.met-table thead th{background:#faf8ff; position:sticky; top:0;}
.met-table .met-label{text-align:left; white-space:nowrap; font-weight:600;}
.met-table th.num, .met-table td.num{text-align:right;}
.met-cell{width:66px; padding:3px 5px; border:1px solid var(--line); border-radius:4px; text-align:right; font-size:11px; font-variant-numeric:tabular-nums;}
.met-cell:focus{outline:2px solid var(--accent); border-color:var(--accent);}
.met-cat td{background:#f3f0fb; font-weight:700; text-align:left; color:#5a3db5; font-size:12px;}
.met-del{border:none; background:none; color:var(--muted); cursor:pointer; font-size:11px; opacity:.35; margin-left:4px;}
.met-del:hover{opacity:1; color:#c2362f;}
.met-catdel{border:none; background:none; color:#8a7bbf; cursor:pointer; font-size:10.5px; font-weight:400; margin-left:8px; opacity:.6;}
.met-catdel:hover{opacity:1; color:#c2362f;}
/* 코호트 비교(D+N) */
.met-cohort-toggle{display:inline-flex; align-items:center; gap:4px; margin:0 8px; padding:3px 8px; border:1px solid var(--line); border-radius:6px; cursor:pointer; background:#faf8ff;}
.met-cohort thead th.met-hlbl{text-align:left;}
.met-cohort thead th.met-hb{text-align:center; width:48px;}
.met-cohort thead th.dcol{text-align:right; padding-right:12px;}   /* 헤더도 우측정렬 → 숫자와 일치 */
.met-cohort td.num{text-align:right; padding-right:12px; font-variant-numeric:tabular-nums;}
.met-cohort td.met-bcell{text-align:center; color:var(--muted); white-space:nowrap;}
.met-cohort .met-label{text-align:left; vertical-align:middle;}
/* 짝수 D컬럼(D+6·+8·+10…) 연한 배경 — 세로 가독성 */
.met-cohort th.dcol-even, .met-cohort td.dcol-even{background:#eef4fb;}
.met-cohort tbody tr.cohort-b1 td.met-bcell{color:#3a6ea5; font-weight:600;}
.met-sumcell{text-align:right; padding:3px 8px; background:#f6f7fb; color:#333; font-variant-numeric:tabular-nums; font-size:11px;}
.met-cohort td.num{font-size:11px;}
.met-cslot{padding:3px 6px; font-size:12px; border:1px solid var(--line); border-radius:5px;}
/* 경영분석 탭 */
.an-diag .an-flow{font-size:13px; color:#3f4a41; margin-bottom:8px; padding-bottom:7px; border-bottom:1px solid var(--line);}
.an-diag .an-flow b{color:#2f7d4f;}
.an-diag .neg{color:#c0392b; font-weight:700;}
.an-cards{display:grid; grid-template-columns:repeat(auto-fit,minmax(230px,1fr)); gap:10px;}
.an-coh{border:1px solid var(--line); border-radius:10px; padding:10px 12px; background:#fbfdfb;}
.an-coh-top{display:flex; align-items:center; gap:6px; margin-bottom:8px;}
.an-coh-top .an-dn{margin-left:auto; background:#2f9e64; color:#fff; font-size:11px; padding:2px 8px; border-radius:10px;}
.an-coh-grid{display:grid; grid-template-columns:1fr 1fr; gap:5px 12px;}
.an-coh-grid > div{display:flex; justify-content:space-between; font-size:12px; border-bottom:1px dotted #e7eae5; padding:2px 0;}
.an-coh-grid .muted{font-size:11px;}
.an-table{width:100%;}
.an-table th, .an-table td{padding:5px 8px; font-size:12px; border-bottom:1px solid var(--line); text-align:center;}
.an-table td.num, .an-table th.num{text-align:right; font-variant-numeric:tabular-nums;}
.an-table thead th{background:#f3f6f1; position:sticky; top:0;}
/* 코호트 손익계산서 매트릭스 */
.an-pnl-scroll{overflow-x:auto; max-width:100%; border:1px solid var(--line); border-radius:8px;}
.an-pnl{border-collapse:separate; border-spacing:0; white-space:nowrap; font-size:11px; font-variant-numeric:tabular-nums;}
.an-pnl th, .an-pnl td{padding:3px 9px; border-bottom:1px solid #eef1f4; border-right:1px solid #f1f4f7;}
.an-pnl th.num, .an-pnl td.num{text-align:right;}
.an-pnl tr:first-child th{background:#f4f8fb; font-weight:600; color:#41566b;}
.an-pnl td.dcol-even{background:#fafcff;}
.an-pnl .an-rowh{position:sticky; left:0; background:#fff; text-align:left; min-width:130px; max-width:130px; white-space:normal; font-weight:500;}
.an-pnl tr:first-child .an-rowh{background:#f4f8fb;}
.an-pnl .an-cum{position:sticky; left:130px; background:#f1f7f3; border-right:2px solid #cfe2d6; text-align:right; min-width:78px;}
.an-pnl tr:first-child .an-cum{background:#e8f2ec;}
.an-pnl tr.an-sec td{background:#e9f0f7; color:#2c5570; font-weight:700; text-align:left;}
.an-pnl tr.an-sec td:first-child{position:sticky; left:0; background:#e9f0f7;}
.an-pnl tr.an-sec td.an-cum{position:sticky; left:130px; background:#e9f0f7; border-right:2px solid #cfe2d6;}
/* 당월 강조 + 헤더 년.월 */
.an-pnl td.an-now{background:#fff7e0 !important; border-left:2px solid #e8a317; border-right:2px solid #e8a317;}
.an-pnl tr:first-child th.an-now{background:#ffe9ad !important; color:#8a6a16; border-left:2px solid #e8a317; border-right:2px solid #e8a317;}
.an-pnl .an-ym{font-size:9px; color:#94a0ab; font-weight:400;}
.an-pnl tr:first-child th.an-now .an-ym{color:#a5862a;}
/* 활성배치 카드 (전월·누적) */
.an-card-row{display:flex; gap:12px; align-items:stretch; margin-bottom:12px;}
.an-card-row:last-child{margin-bottom:0;}
.an-card-lbl{flex:0 0 96px; display:flex; flex-direction:column; justify-content:center; padding:10px 12px; background:#f0f6f2; border:1px solid #d9e8df; border-radius:9px;}
.an-card-lbl b{font-size:16px; color:#1f7a48;}
.an-card-lbl .muted{font-size:10px; line-height:1.5; margin-top:4px;}
.an-card-3{flex:1; display:grid; grid-template-columns:1fr 1fr 1fr; gap:12px; min-width:0;}
.an-card{border:1px solid var(--line); border-radius:9px; padding:10px 12px; background:#fff;}
.an-c-rev{border-top:3px solid #2f9e64;}
.an-c-cost{border-top:3px solid #c0603a;}
.an-c-prod{border-top:3px solid #3a86b0;}
.an-card-h{font-size:12px; font-weight:700; margin-bottom:7px; color:#3a4a40;}
.an-kv{display:grid; grid-template-columns:1fr auto auto; align-items:baseline; gap:8px; padding:3px 0; border-bottom:1px dashed #eef0ec; font-size:12px;}
.an-kv:last-child{border-bottom:none;}
.an-kv span{color:#6b736c;}
.an-kv b{text-align:right; font-variant-numeric:tabular-nums; color:#1c2620;}
.an-kv i{text-align:right; font-style:normal; font-size:10.5px; color:#9aa49b; font-variant-numeric:tabular-nums; min-width:62px;}
@media(max-width:760px){ .an-card-3{grid-template-columns:1fr;} .an-card-row{flex-direction:column;} }
.an-table th{white-space:normal; vertical-align:bottom; line-height:1.25; font-size:11px;}
.an-table td, .an-table th{padding:5px 7px;}
/* 인터랙티브 D+N 차트 */
.dn-wrap{display:flex; gap:16px; align-items:flex-start;}
.dn-ctrl{flex:0 0 152px; display:flex; flex-direction:column; gap:3px; font-size:12px;}
.dn-ch{font-weight:700; font-size:11px; color:#3a4a40; margin:7px 0 2px; border-bottom:1px solid #eef0ec; padding-bottom:3px;}
.dn-ch:first-child{margin-top:0;}
.dn-chk{display:flex; align-items:center; gap:6px; cursor:pointer; padding:1px 0;}
.dn-chk:hover{color:#2f9e64;}
.dn-chk input{margin:0; cursor:pointer;}
.dn-graph{flex:1; min-width:0;}
@media(max-width:760px){ .dn-wrap{flex-direction:column;} .dn-ctrl{flex:none; width:100%; flex-direction:row; flex-wrap:wrap; gap:8px;} .dn-ch{width:100%;} }
/* 운영지표 휴지통 */
.met-trash{margin-top:14px; border:1px dashed var(--line); border-radius:8px; padding:6px 12px; background:#fafafa;}
.met-trash>summary{cursor:pointer; font-size:13px; font-weight:700; color:#777; padding:4px 0;}
.met-trash-row{display:flex; justify-content:space-between; align-items:center; padding:5px 2px; border-top:1px solid var(--line); font-size:12.5px;}
.met-trash-row button{border:1px solid var(--line); background:#fff; border-radius:5px; padding:3px 8px; font-size:11.5px; cursor:pointer; margin-left:4px;}
.met-restore{color:#1e7d3a;}
.met-purge{color:#c2362f;}
.fld{display:block; margin:10px 0; font-size:13px; font-weight:600;}
.fld input, .fld select{display:block; width:100%; padding:7px 9px; margin-top:4px; border:1px solid var(--line); border-radius:6px; font-size:13px; font-weight:400; box-sizing:border-box;}
/* 법인 합산 — 표(좌) + 막대그래프(우, 같은 라인) */
.combi-wrap{display:flex; gap:16px; align-items:stretch; flex-wrap:nowrap;}   /* 전체 폭을 위 테이블과 좌우 정렬 */
.combi-wrap .combi-table{flex:1 1 0; min-width:0; margin:0; overflow-x:auto;}   /* 남는 폭을 채우도록 확장 */
.combi-table table.stmt{width:100%; min-width:560px;}
.combi-wrap .combi-chart{flex:0 0 430px; margin:0; padding:12px 14px; display:flex; flex-direction:column;}
.combi-chart svg.trend-svg{width:100%; height:auto; max-height:280px;}
.combi-chart-head{display:flex; justify-content:space-between; align-items:center; font-size:13px; font-weight:700; color:#444; margin-bottom:6px; flex:0 0 auto;}
/* 차트 본문: 헤더 아래 남는 공간 세로 중앙에 막대그래프 배치 */
.combi-chart-body{flex:1 1 auto; display:flex; flex-direction:column; justify-content:center; min-height:0;}
/* 차트 기간 커스텀 드롭다운 (아래로 펼침 + 스크롤) */
.cpd{position:relative; font-weight:400;}
.cpd-btn{display:inline-flex; align-items:center; gap:6px; padding:4px 10px; border:1px solid #c9b8ec; border-radius:6px; background:#fff; font-size:12.5px; color:#333; cursor:pointer; white-space:nowrap;}
.cpd-btn:hover{border-color:#a98fe0;}
.cpd-car{font-size:10px; color:#9a8fc0;}
.cpd-menu{display:none; position:absolute; top:calc(100% + 4px); right:0; z-index:50; min-width:130px; max-height:260px; overflow-y:auto; background:#fff; border:1px solid #d7cdf0; border-radius:8px; box-shadow:0 6px 20px rgba(60,40,110,.16); padding:4px;}
.cpd.open .cpd-menu{display:block;}
.cpd-grp{padding:5px 10px 2px; font-size:10.5px; font-weight:700; color:#9a8fc0; border-top:1px solid #f0ecfa; margin-top:2px;}
.cpd-grp:first-child{border-top:none; margin-top:0;}
.cpd-item{padding:5px 10px; font-size:12.5px; color:#333; border-radius:5px; cursor:pointer; white-space:nowrap;}
.cpd-item.cpd-mon{padding-left:20px; color:#555;}
.cpd-item:hover{background:#f3eefc;}
.cpd-item.on{background:#e8dffb; color:#5a3aa8; font-weight:700;}
.sec3-sel{padding:4px 8px; border:1px solid #c9b8ec; border-radius:6px; background:#fff; font-size:12.5px;}
/* 제목 옆 선택기/버튼 인라인 배치 */
.page-sel{display:flex; align-items:center; gap:10px; flex-wrap:wrap;}
.page-sel > span{font-size:14px; font-weight:400; display:inline-flex; align-items:center; gap:8px; flex-wrap:wrap;}
/* BS 법인 합산 T자형 (좌 자산 | 우 부채·자본) — 헤더/데이터/총계 3표 분리해 좌우 상·하 라인 정렬 */
.bs-tform{display:flex; gap:14px; align-items:stretch;}
.bs-tform .bs-tf-side{flex:1 1 0; min-width:0; display:flex; flex-direction:column;}
/* .stmt.v2{min-width:560px}·.combi-table .stmt{min-width:560px} 무력화 */
.bs-tform .bs-tf-side table.bs-stmt{table-layout:fixed; width:100%; min-width:0; margin:0; border-collapse:collapse;}
.bs-tform .bs-tf-side table.bs-stmt td.name, .bs-tform .bs-tf-side table.bs-stmt th:first-child{min-width:0;}
/* 자산쪽만: 계정 영역(bs-tf-dt)이 남는 높이를 분배 → 자산총계가 부채와자본총계와 같은 바닥에 정렬 */
.bs-tform .bs-tf-side > .bs-tf-dt{flex:1 1 auto; min-height:0;}
.bs-tform .bs-tf-side > .bs-tf-hd, .bs-tform .bs-tf-side > .bs-tf-tb{flex:0 0 auto;}
.bs-tform .bs-tf-dt td{vertical-align:middle;}
/* 자산쪽 3분할로 생기는 합계(cmonth) 박스의 '안쪽' 가로 주황줄만 제거 (자산 줄 아래·토지 아래).
   맨 위(헤더 상단)·맨 아래(자산총계 하단) 주황줄은 유지해 박스 형태 보존 */
.bs-tform .bs-tf-side table.bs-tf-hd tbody tr:last-child td.cmonth,
.bs-tform .bs-tf-side table.bs-tf-dt tbody tr:last-child td.cmonth{border-bottom:none;}
.bs-tform .subgroup td.name{font-weight:700; color:#4a5a4e; background:#f4f7f2;}
/* CF 법인 합산 표 — 행 높이 키워 우측 막대그래프와 시각적 균형 */
.cf-combi td, .cf-combi th{padding-top:12px; padding-bottom:12px;}
/* 멀티법인 전환 스위처 + 일반법인 앱 */
.ent-switch{margin:0 12px 0 4px;padding:5px 10px;border:1.5px solid var(--accent,#3a8a4a);border-radius:8px;background:#f3faf3;font-size:13px;font-weight:700;color:#1f5b2b;cursor:pointer;}
.ent-bar{font-size:14px;margin:4px 0 12px;color:#2b332c;}
.ent-tabs{display:inline-flex;border:1px solid #c9d4c6;border-radius:9px;overflow:hidden;margin-bottom:14px;}
.ent-tabs button{border:none;padding:8px 18px;background:#fff;font-size:13.5px;cursor:pointer;border-right:1px solid #e3e8e0;font-weight:600;color:#556;}
.ent-tabs button:last-child{border-right:none;}
.ent-tabs button.on{background:var(--accent,#3a8a4a);color:#fff;}
.ekpi-row{display:grid;grid-template-columns:repeat(5,1fr);gap:10px;}
.ekpi{background:#eef7f0;border-radius:10px;padding:9px 12px;}
.ekpi .lab{font-size:11px;color:#4e6151;} .ekpi .val{font-size:18px;font-weight:800;margin-top:3px;} .ekpi .val.neg{color:var(--neg,#c0392b);}
.ent-fin3{display:grid;grid-template-columns:1fr 1.12fr 1fr;gap:12px;margin-top:6px;}
@media(max-width:1000px){.ent-fin3{grid-template-columns:1fr;}.ekpi-row{grid-template-columns:repeat(2,1fr);}}
.ent-fin3 .card{padding:11px 13px;overflow:hidden;}
.ent-fin3 .stmt.v2{min-width:0;width:100%;}
.ent-fin3 .stmt-title{font-size:12.5px;font-weight:700;color:#3f4a41;}
.ent-fin3 .bs-tform{gap:8px;}
/* 대시보드 경영 분석 */
#analysis-panel{padding:14px 16px;}
.an-controls{display:flex; flex-wrap:wrap; gap:8px; align-items:center; margin-bottom:12px;}
.an-controls select{padding:5px 9px; border:1px solid #c9d4c6; border-radius:6px; background:#fff; font-size:13px;}
.an-controls .an-scope{font-size:12px;}
.an-figwrap{display:flex; flex-wrap:wrap; gap:14px; margin-bottom:8px; align-items:stretch;}   /* 상하 라인 정렬 위해 stretch */
.an-col{display:flex; flex-direction:column; min-width:0;}
.an-figwrap > .an-is{flex:1.7 1 320px;}   /* IS 넉넉 (7행·값3열) */
.an-figwrap > .an-cf{flex:1.05 1 210px;}  /* CF (값2열) */
.an-bs-t{flex:1.9 1 360px; min-width:320px; display:flex; gap:10px; align-items:stretch;}
.an-bs-t > .an-col{flex:1 1 0; min-width:0;}
/* 컬럼 = 헤더(고정)/데이터(채움)/총계(고정) 3표. 데이터만 늘어나 총계 두께 균일·상하 정렬 */
.an-fig{width:100%; font-size:12.5px; table-layout:fixed; border-collapse:collapse;}
.an-col > .an-dt{flex:1 1 auto; height:100%;}
.an-col > .an-hd, .an-col > .an-tb{flex:0 0 auto;}
.an-fig th, .an-fig td{padding:4px 8px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap;}
.an-hd th{font-weight:600; color:#5a665b; background:#fafbf9; border-bottom:1.5px solid #d7ded3;}
.an-dt td{border-bottom:1px solid #eef1ec; vertical-align:middle;}
.an-dt tr.an-sub td{font-weight:600; color:#5a6b5e;}
.an-tb tr.an-tot td{border-top:1.5px solid #b9c6b4; font-weight:700; background:#eef3ea;}
.an-fig td.num, .an-fig th.num{font-variant-numeric:tabular-nums; text-align:right;}
.an-fig td.neg{color:#c0392b;}
.an-d.up{color:#1e7d3a;} .an-d.down{color:#c0392b;} .an-d{font-size:11px; white-space:nowrap;}
.an-narrative{margin-top:10px; border-top:1px dashed #dfe6db; padding-top:10px; line-height:1.65; font-size:13.5px; color:#2c352e;}
.an-narr-top{display:flex; justify-content:space-between; align-items:center; margin-bottom:6px;}
.an-modal{width:680px; max-width:92vw;}
.an-modal .modal-body{max-height:70vh; overflow:auto;}
.an-modal-btns{display:flex; gap:8px; align-items:center;}
.an-min{border:0; background:none; font-size:22px; line-height:1; cursor:pointer; color:var(--muted); padding:0 2px;}
.an-min:hover{color:#333;}
.an-chip{position:fixed; bottom:18px; right:18px; z-index:120; display:flex; align-items:center; gap:6px;
  background:#2f6b3a; color:#fff; padding:9px 15px; border-radius:22px; box-shadow:0 4px 16px rgba(40,70,45,.32);
  cursor:pointer; font-size:13px; font-weight:600;}
.an-chip:hover{background:#27592f;}
.an-modal .an-narrative .an-h{margin:14px 0 6px; font-size:14.5px; color:#2f6b3a; font-weight:700;}
.an-modal .an-narrative .an-h:first-child{margin-top:0;}
.an-modal .an-narrative .an-ul{margin:4px 0 4px 4px; padding-left:18px;}
.an-modal .an-narrative .an-ul li{margin:3px 0;}
.an-modal .an-narrative .an-p{margin:6px 0;}
.an-narrative .an-h{margin:14px 0 6px; font-size:14.5px; color:#2f6b3a; font-weight:700;}
.an-narrative .an-h:first-child{margin-top:0;}
.an-narrative .an-ul{margin:4px 0 4px 4px; padding-left:18px;}
.an-narrative .an-ul li{margin:3px 0;}
.an-narrative .an-p{margin:6px 0;}
.an-loading{padding:12px 2px; color:#7a857c; font-style:italic;}
/* CF 검증 뱃지 (헤더 우측) */
.cf-recon{margin-left:auto; font-size:12px; font-weight:700; padding:3px 10px; border-radius:12px;}
.cf-recon.ok{color:#1e7d3a; background:#e7f5ec;}
.cf-recon.gap{color:#c2362f; background:#fbe9e7;}
/* BS 컬럼 보조라벨(연/말 시점) */
.bs-colsub{font-size:9px; font-weight:400; color:var(--muted);}
/* BS 표: 잔액 자릿수가 커서 폰트 축소(당월 박스 잘림 방지) */
.bs-stmt td.amt, .bs-stmt th.amt{font-size:10.5px; padding-left:3px; padding-right:3px;}
.bs-stmt tr.grand td, .bs-stmt tr.total td{font-size:10.5px;}
/* 당월 이후(미래) 빈칸 — 연한 빗금 + 줄지어 가는 농장 이모지 */
.bs-stmt td.amt.blank{background-image:repeating-linear-gradient(45deg,#f4f5f7 0,#f4f5f7 3px,#fbfbfc 3px,#fbfbfc 7px); text-align:center;}
.bs-stmt td.amt.blank .bs-fut{opacity:.35; font-size:11px; filter:grayscale(.2);}
/* BS 기초(전기말) 컬럼 강조 — 회색 박스 */
.stmt.v2 th.cbase, .stmt.v2 td.cbase{background:#f3f4f6; border-left:1px solid #c9ccd1; border-right:1px solid #c9ccd1;}
.stmt.v2 thead th.cbase{font-weight:700;}
/* 통장 카드 (심플) — 3개 카드 높이 정렬(stretch) */
.bk-grid{display:grid; grid-template-columns:repeat(auto-fit,minmax(300px,1fr)); gap:16px; align-items:stretch;}
.bk-grid .farm-card{display:flex; flex-direction:column;}
.bk-accts{flex:1; display:flex; flex-direction:column; justify-content:center;}
.bk-farm{display:flex; justify-content:space-between; align-items:baseline; font-weight:800; font-size:15px; padding:4px 2px 8px; border-bottom:1px solid var(--line); margin-bottom:6px;}
.bk-farm b{font-size:15px;}
/* 계좌 행: 은행·예금주(좌) / 계좌번호(가운데) / 잔액(우) */
.bk-acct{display:grid; grid-template-columns:auto minmax(0,1fr) max-content; gap:8px; align-items:center; font-size:12.5px; padding:3px 2px; white-space:nowrap;}
.bk-a-name{color:var(--muted);}
.bk-a-num{text-align:center; color:var(--muted); font-variant-numeric:tabular-nums; overflow:hidden; text-overflow:ellipsis;}
.bk-a-bal{text-align:right; white-space:nowrap;}
.bk-a-bal b{font-variant-numeric:tabular-nums;}
.bk-ok{color:#1e7d3a; font-weight:700; font-size:12px; margin-left:4px;}
.bk-gap{color:#c2362f; font-weight:700; font-size:12px; margin-left:4px;}
/* BS 관리·검증 도구 (항상 노출) */
section.bs-tools{margin-top:30px; border-top:2px solid var(--line); padding-top:14px;}
.bs-tools-head{font-size:14px; font-weight:700; color:#4a4a4a; margin:0 0 10px; padding:2px;}
.bs-tools .bs-tools-body{margin-top:10px;}
.inc-sub{font-size:13px; font-weight:700; color:#4a4a4a; margin:16px 0 6px;}
.inc-sub .muted{font-weight:400; font-size:11px;}
/* 월별 손익 카드 */
.inc-farm .stmt-col{padding:12px 14px; overflow-x:auto;}
.stmt-cardhead{display:flex; align-items:center; font-size:12.5px; font-weight:700; color:#444; margin:0 0 8px;}
.stmt-unit{margin-left:auto; font-size:11px; font-weight:400; color:var(--muted);}
/* 월별 12개월 동일폭 (글자크기는 당월/누적 기준 유지) */
.stmt.eqcol{table-layout:fixed;}
.stmt.eqcol td.amt, .stmt.eqcol th.amt{white-space:nowrap; overflow:hidden; text-overflow:ellipsis;}
/* 누적·당월이 아닌 소계 숫자는 일반체 */
.stmt td.amt.nb{font-weight:400;}
/* 당월(cmonth) 컬럼 박스 강조 */
.stmt.v2 th.cmonth, .stmt.v2 td.cmonth{border-left:2px solid #e0a23c; border-right:2px solid #e0a23c; background:#fff8ec;}
.stmt.v2 thead th.cmonth{border-top:2px solid #e0a23c;}
.stmt.v2 tbody tr:last-child td.cmonth{border-bottom:2px solid #e0a23c;}
/* 핵심 소계(영업이익) 구분선 강조 */
.stmt tr.keysub td, .stmt.v2 tr.keysub td{border-top:2px solid var(--line); font-weight:800;}
/* 이익률 행 (섹션1) */
.stmt tr.ratio td{font-size:12px; font-weight:700; color:#7a6a2a; background:#fcfaf0;}
.stmt tr.ratio td.name{color:#9a8a4a; padding-left:18px;}
.stmt tr.ratio:first-of-type td{border-top:1px dashed var(--line);}
.stmt tr.ratio td.neg, .stmt.v2 tr.ratio td.neg, .stmt.annual tr.ratio td.neg{color:var(--neg);}
.stmt.annual tr.ratio td{font-size:12px; font-weight:700; color:#7a6a2a; background:#fcfaf0;}
.stmt.annual tr.ratio td:first-child{color:#9a8a4a;}
.stmt.annual tr.ratio:first-of-type td{border-top:1px dashed var(--line);}

/* 연도별 요약 — 통합 표 (계정명 1회 + 농장 컬럼그룹 + 핵심행 색상) */
.annual-merged{width:100%; border-collapse:collapse; font-size:12.5px;}
.annual-merged th, .annual-merged td{padding:5px 9px; white-space:nowrap; text-align:right; font-variant-numeric:tabular-nums;}
.annual-merged th:first-child, .annual-merged td.name{text-align:left;}
.annual-merged thead th{font-size:11px; color:var(--muted); font-weight:600; border-bottom:1px solid var(--line);}
.annual-merged th.farm-grp{text-align:center; font-size:13px; font-weight:800; color:var(--ink); padding-bottom:6px;}
.annual-merged .grp-start{border-left:2px solid #d7ddd0;}
.annual-merged td.name{font-weight:700; color:var(--ink);}
.annual-merged tr.sub td{color:var(--muted); font-weight:400;}
.annual-merged tr.sub td.name{color:var(--muted); font-weight:400;}
.annual-merged tr.row-rev    td{background:#eaf2fb;}   /* 매출액 */
.annual-merged tr.row-gp     td{background:#e7f5ec;}   /* 매출총이익 */
.annual-merged tr.row-op     td{background:#fdf3e2;}   /* 영업이익 */
.annual-merged tr.row-pretax td{background:#f1eafb; font-weight:800;}  /* 세전손익 */
.annual-merged tr.row-rev td.name{background:#dce9f8;}
.annual-merged tr.row-gp td.name{background:#d7eede;}
.annual-merged tr.row-op td.name{background:#fae8c8;}
.annual-merged tr.row-pretax td.name{background:#e6d9f7;}
.annual-merged tr.ratio td{font-size:11.5px; color:#7a6a2a; font-style:italic; background:#fcfaf0;}
.annual-merged tr.ratio td.name{font-style:normal; background:#fcfaf0;}
.annual-merged tr.ratio:first-of-type td{border-top:1px dashed var(--line);}
.annual-merged .neg{color:var(--neg);}

/* 손익 v2 (농장별 파트, 다중 컬럼) */
.farm-statement{margin-bottom:16px;}
.farm-statement .fc-head{margin-bottom:8px;}
.stmt-scroll{overflow-x:auto;}
.stmt.v2{min-width:560px;}
.stmt.v2 th, .stmt.v2 td{white-space:nowrap;}
.stmt.v2 td.name, .stmt.v2 th:first-child{min-width:7em;}
.stmt.v2 .cmonth{background:#eef6ec;}                 /* 당월 강조 */
.stmt.v2 th.cmonth{color:var(--accent);}
.stmt.v2 .ccum{background:#f7faf6;}                   /* 당해 누적 */
.stmt.v2 .cyear{color:#6b7563;}                       /* 과거연도 */
.stmt.v2 tr.ratio td{font-size:12px; font-weight:700; background:#fcfaf0;}
.stmt.v2 tr.ratio td.cmonth{background:#eef0e0;}
.stmt.v2 tr.ratio:first-of-type td{border-top:1px dashed var(--line);}
.src-badge{display:inline-block; font-size:11px; padding:2px 8px; border-radius:10px; margin-left:8px;
  background:var(--accent-weak); color:var(--accent); vertical-align:middle;}
.src-badge.engine{background:#fff4e0; color:#b5750a;}

/* tables */
table.grid{width:100%; border-collapse:collapse; background:var(--card);}
table.grid th,table.grid td{padding:8px 10px; border-bottom:1px solid var(--line); text-align:left;}
table.grid th{font-size:12px; color:var(--muted); font-weight:600; background:#fafbf8;}
table.grid td.num, table.grid th.num{text-align:right; font-variant-numeric:tabular-nums;}
.tag{font-size:11px; padding:2px 7px; border-radius:10px; background:var(--bg); color:var(--muted);}
.tag.pnl{background:#eaf3e8; color:var(--accent);} .tag.interfarm{background:#e7eefb; color:#2d5bb8;}
.tag.financing{background:#f3e8fb; color:#7a3db8;} .tag.unclassified{background:#fbe8e8; color:#b83d3d;}
.tag.offset{background:#fff0d6; color:#b5750a;}
/* 상계(비현금) 행 — 은행 거래와 구분 */
tr.offset-row td{background:#fffaf0;}
tr.offset-row td.offset-na{color:#d8c79a; text-align:right;}

/* form */
.form-grid{display:grid; grid-template-columns:110px 1fr 130px 130px; gap:10px; align-items:end;}
.form-grid .field{display:flex; flex-direction:column; gap:4px;}
.form-grid label{font-size:12px; color:var(--muted);}
.form-grid .span2{grid-column:span 2;}                 /* 분류=날짜+내용 열 / 저장=입금+출금 열 */
.form-grid #saveBtn{width:100%; padding:9px 10px;}      /* 입금+출금 폭에 맞춰 그 아래에 */
.suggest{margin:10px 0; padding:10px 12px; background:var(--accent-weak); border-radius:8px; font-size:13px;}
.suggest.none{background:#fbe8e8;}

/* 분류 선택 행 */
.classify-row{display:flex; align-items:center; gap:10px; margin:12px 0; flex-wrap:wrap;}
.classify-row label{font-size:12px; color:var(--muted); font-weight:600;}
.classify-row select{min-width:200px;}
.hint{font-size:12.5px; color:var(--muted);}
.hint.ok{color:var(--accent);}
.hint.warn{color:var(--neg); font-weight:600;}
.noe-star{color:#c2362f; font-weight:700; margin-left:2px; cursor:help;}
.sel-ph{border-top:1px dashed var(--line); color:var(--muted); font-size:12.5px; text-align:center; padding:14px 0 6px; margin-top:4px;}
.tb-verify{font-size:13px; font-weight:700; padding:7px 12px; margin:0 0 8px; border-radius:8px;}
.tb-verify.ok{color:#1e7d3a; background:#eef7ec; border:1px solid #cfe6d3;}
.tb-verify.warn{color:#c2362f; background:#fbf1f0; border:1px solid #eccac5;}
/* 목록 인라인 재분류 */
.cls-edit{border:0; background:none; cursor:pointer; color:var(--muted); font-size:12px; padding:0 4px; opacity:.5;}
.cls-edit:hover{opacity:1; color:var(--accent);}
.cls-select{font-size:12px; padding:3px 6px; max-width:200px;}

.toast{position:fixed; bottom:24px; left:50%; transform:translateX(-50%) translateY(20px);
  background:#1c2419; color:#fff; padding:10px 18px; border-radius:8px; opacity:0; transition:.25s; pointer-events:none;}
.toast.show{opacity:1; transform:translateX(-50%) translateY(0);}
.empty{padding:40px; text-align:center; color:var(--muted);}

/* modal */
.modal-bg{position:fixed; inset:0; background:rgba(20,28,18,.4); display:flex; align-items:flex-start;
  justify-content:center; padding:60px 16px; z-index:50; overflow:auto;}
.modal{background:#fff; border-radius:14px; width:min(920px,96vw); box-shadow:0 12px 40px rgba(0,0,0,.2);}
.modal-head{display:flex; justify-content:space-between; align-items:center; padding:16px 20px;
  border-bottom:1px solid var(--line); font-weight:700; font-size:16px; cursor:grab; user-select:none;}
.modal-head:active{cursor:grabbing;}
.modal-head .x{border:0; background:none; font-size:18px; cursor:pointer; color:var(--muted);}
.modal-body{padding:18px 20px;}
.map-grid{display:grid; grid-template-columns:repeat(auto-fit,minmax(150px,1fr)); gap:10px; margin-top:10px;}
.map-row{display:flex; flex-direction:column; gap:4px;}
.map-row label{font-size:12px; color:var(--muted);}
.map-row select{width:100%;}

/* AI 자동분개 */
.ai-grid{margin-top:6px;}
.ai-grid th, .ai-grid td{padding:6px 8px;}
.ai-grid select.ai-acct{width:100%; font-size:12.5px; padding:4px 6px;}
.ai-grid input.num{width:110px; text-align:right; padding:4px 6px;}
.ai-grid tr.ai-new td{background:#fffaf0;}
.ai-grid tfoot td{border-top:2px solid var(--line); font-weight:600;}
#ai-text{width:100%; font-family:inherit; font-size:13px; padding:8px; resize:vertical;}

/* 농장간 미수·미지급 현황 */
.settle-row{cursor:pointer; border-radius:6px; padding:3px 6px;}
.settle-row:hover{background:var(--accent-weak);}
.settle-row .caret{display:inline-block; font-size:10px; color:var(--muted); transition:transform .15s; margin-right:2px;}
.settle-row.open .caret{transform:rotate(90deg);}
.settle-nums{color:var(--ink)!important; font-size:12px; font-variant-numeric:tabular-nums;}
.settle-nums .pos{color:var(--accent);} .settle-nums .neg{color:#c0392b;}
.settle-reasons{padding:2px 4px 6px;}
.settle-reasons .ch-row{grid-template-columns:1fr auto;}
.settle-reasons .pos{color:var(--accent);} .settle-reasons .neg{color:#c0392b;}

/* 업로드 검수 표 */
.up-review th, .up-review td{padding:5px 8px; font-size:12.5px;}
.up-review select.up-cls{font-size:12px; padding:3px 6px; max-width:220px;}
.up-review tr.up-unk td{background:#fff3f0;}
.up-review tr.up-skip td{background:#f5f5f3; color:var(--muted);}

/* 입력 분개 미리보기 */
.jpreview{margin-top:10px; border:1px dashed var(--line); border-radius:8px; padding:8px 10px; background:#fafbf8;}
.jp-title{font-size:12px; font-weight:600; color:var(--ink); margin-bottom:4px;}
.jp-table{width:100%; border-collapse:collapse;}
.jp-table td{padding:2px 4px; font-size:12.5px; font-variant-numeric:tabular-nums;}
.jp-table td.num{text-align:right;}
.jp-table tr.jp-cr td:first-child{padding-left:18px; color:var(--muted);}
.jp-note{font-size:11.5px; color:var(--muted); margin-top:4px;}

/* 분개 입력기 — 전표식(차/대 한 줄) 컴팩트. 고정 레이아웃으로 모달 폭에 맞춤(가로 스크롤 방지) */
.je-table{width:100%; table-layout:fixed;}
.je-table th, .je-table td{padding:4px 6px; font-size:12.5px; overflow:hidden;}
.je-table thead th:nth-child(1){width:19%;}  /* 차변 계정과목 */
.je-table thead th:nth-child(2){width:17%;}  /* 차변 (금액 — 넓게) */
.je-table thead th:nth-child(3){width:19%;}  /* 대변 계정과목 */
.je-table thead th:nth-child(4){width:17%;}  /* 대변 (금액 — 넓게) */
.je-table thead th:nth-child(5){width:23%;}  /* 적요 */
.je-table thead th:nth-child(6){width:5%;}   /* ✕ */
.je-table input.je-dr, .je-table input.je-cr{font-size:13px;}
.je-table select.je-acct{width:100%; min-width:0; font-size:12px; padding:3px 5px;}
.je-table select.je-cp{width:100%; min-width:0; font-size:12px; padding:3px 5px;}
/* 손익 판관비 변동/고정 소계 행 */
.stmt tr.subgroup td, .stmt.v2 tr.subgroup td{background:#f3f6fb; font-weight:600; font-size:12px; color:#3a5a8c;}
.stmt tr.subgroup td.name, .stmt.v2 tr.subgroup td.name{padding-left:14px;}
.beh-sel{font-size:12px; padding:2px 5px;}
.je-table input.je-dr, .je-table input.je-cr{width:100%; min-width:0; box-sizing:border-box; text-align:right; padding:3px 5px;}
/* 숫자 입력 스피너 제거 — 좁은 금액칸에서 잘림 방지 */
.je-table input.je-dr::-webkit-outer-spin-button, .je-table input.je-cr::-webkit-outer-spin-button,
.je-table input.je-dr::-webkit-inner-spin-button, .je-table input.je-cr::-webkit-inner-spin-button{-webkit-appearance:none; margin:0;}
.je-table input.je-dr, .je-table input.je-cr{-moz-appearance:textfield;}
.je-table input.je-note{width:100%; min-width:0; box-sizing:border-box; padding:3px 5px;}
.je-table tfoot td{border-top:2px solid var(--line); font-variant-numeric:tabular-nums;}
.up-review tr.up-ai td{background:#eef6ea;}
/* 업로드 매핑 미리보기 — 줄바꿈 없이 한 줄(가로 스크롤) */
.up-preview{width:auto; min-width:100%;}
.up-preview th, .up-preview td{white-space:nowrap; padding:5px 10px; font-size:12.5px;}

/* 분개 검수 큐 (은행내역·정산서 공용) */
.rq-list{overflow:auto; max-height:55vh; display:flex; flex-direction:column; gap:10px; padding:2px;}
.rq-grand{display:flex; align-items:center; gap:14px; margin-top:10px; padding:11px 14px; background:#eef3fb;
  border:1px solid #c7d6ea; border-radius:9px; font-size:13px; font-variant-numeric:tabular-nums;}
.rq-grand b{font-weight:700;}
.rq-grand #rqGrandDr, .rq-grand #rqGrandCr{color:#2c3e50;}
.rq-card{border:1px solid var(--line); border-radius:10px; padding:10px 12px; background:#fff;}
.rq-card.rq-done{opacity:.6; background:#f3f8f1;}
.rq-card.rq-exc{opacity:.45; background:#f5f5f3;}
.rq-ctx{font-size:13px; margin-bottom:4px; display:flex; align-items:center; gap:6px; flex-wrap:wrap;}
.rq-card .je-table{margin-top:4px;}
.tag.conf-high{background:#e3f3e0; color:#1e7d3a;}
.tag.conf-medium{background:#fff4e0; color:#9a6b00;}
.tag.conf-low{background:#fdeceb; color:#c0392b;}
.s-thumbs{display:flex; flex-wrap:wrap; gap:6px; margin-top:10px;}
.s-thumb{display:inline-block; background:var(--accent-weak); border-radius:6px; padding:4px 10px; font-size:12px;}
.controls .btn.ghost.active{background:var(--accent); color:#fff; border-color:var(--accent);}
/* 수동분개 보조바(거래처·계정생성) — 본 분개/저장 영역과 색상 구분 */
.je-aux{display:flex; align-items:center; gap:8px; flex-wrap:wrap; margin:8px 0 0; padding:8px 10px; background:#f1edfb; border:1px solid #ddd0f3; border-radius:8px;}
.je-aux .je-aux-label{font-size:12px; font-weight:700; color:#6b4ea8;}
.je-aux select{min-width:160px; padding:5px 8px; border:1px solid #c9b8ec; border-radius:6px; background:#fff;}
.btn.je-acctbtn{background:#7c5cd6; color:#fff; border-color:#7c5cd6;}
.btn.je-acctbtn:hover{filter:brightness(1.06);}
.btn.je-cpbtn{background:#fff; color:#6b4ea8; border:1px dashed #b79de6;}
.btn.je-cpbtn.active{background:#efe7fb; border-style:solid; font-weight:700;}
.je-actions{display:flex; align-items:center; gap:8px; margin-top:10px;}
.je-bal{font-weight:700; font-size:13px;}

/* 표준 계정과목 (통제→세부) */
.acct-admin-scroll{max-height:380px; overflow:auto;}   /* 상위 ~10행 + 스크롤 */
.acct-admin-scroll table.std-table thead th{position:sticky; top:0; background:#f4f7f2; z-index:1;}
.std-table td{padding:6px 8px; vertical-align:top;}
.std-leaf{display:inline-block; background:var(--accent-weak); border-radius:6px; padding:2px 8px; margin:2px 4px 2px 0; font-size:12px;}
.acct-chip{cursor:pointer;} .acct-chip:hover{filter:brightness(.96); outline:1px solid var(--line);}
.acct-chip .acct-pen{opacity:.45; font-size:11px;}
.acct-unmapped{background:#fff3f0;}
.acct-add{display:flex; gap:8px; align-items:center; margin-bottom:10px; flex-wrap:wrap;}
.acct-add input{flex:1; min-width:160px; padding:5px 8px;}
.acct-add select{min-width:200px; padding:5px 8px;}
.acct-edit{display:flex; gap:8px; align-items:center; flex-wrap:wrap; background:var(--accent-weak); border-radius:8px; padding:8px 10px; margin-bottom:10px;}
.acct-edit input{flex:1; min-width:160px; padding:5px 8px;}
.acct-edit select{min-width:200px; padding:5px 8px;}

/* 표준계정 세부 드릴다운 (ⓘ) */
.info-btn{border:0; background:none; cursor:pointer; color:var(--muted); font-size:11px; padding:0 3px; line-height:1; opacity:.55; vertical-align:middle;}
.info-btn:hover, .info-btn.open{opacity:1; color:var(--accent);}
.det-row td{font-size:11.5px; color:var(--muted); background:#fafbf8;}
.det-row td.det{padding-left:22px;}

/* BS 본문 */
.bs-total{border-top:1px solid var(--line); margin-top:3px; padding-top:3px;}
.det-line{font-size:12px;}
.bs-scroll{max-height:268px; overflow-y:auto;}            /* 약 10행 노출, 나머지 스크롤 */
.bs-scroll::-webkit-scrollbar{width:6px;}
.bs-scroll::-webkit-scrollbar-thumb{background:var(--line); border-radius:3px;}
.bs-acct{color:var(--accent); cursor:pointer; border-bottom:1px dotted var(--accent);}
.bs-acct:hover{opacity:.7;}

/* 분개장 / 원장 */
.je-entry{margin-bottom:8px; padding:10px 12px;}
.je-entry-head{display:flex; gap:8px; align-items:center; margin-bottom:6px; font-size:13px;}
.jl-table th, .jl-table td{padding:3px 8px; font-size:12.5px;}
.gl-grp td{background:var(--accent-weak); font-weight:600;}
.tag.src-auto{background:#eef0ec;} .tag.src-manual{background:#eef6ea; color:#3f7d3a;}
.tag.src-offset{background:#fff3e0; color:#b8860b;} .tag.src-opening{background:#e8eefb; color:#3a5bbf;}
.tag.src-file{background:#f1edfb; color:#7c5cd6;}

/* 분개장 전표식 (한 줄·스크롤) */
.jrnl-scroll{max-height:440px; overflow:auto; padding:0;}
.jrnl-table{width:100%;}
.jrnl-table th, .jrnl-table td{padding:4px 8px; font-size:12.5px; white-space:nowrap;}
.jrnl-table thead th{position:sticky; top:0; background:#fff; z-index:1; box-shadow:0 1px 0 var(--line);}
.jrnl-table tr.je-first td{border-top:2px solid var(--line);}
.jrnl-table tr.je-cont td{color:#666;}
.jrnl-table [data-delj]{padding:0 5px;}
/* 분개장 전용: 고정폭 + 말줄임으로 가로 스크롤 없이 적요까지 한 화면 */
.jt-fixed{table-layout:fixed;}
.jt-fixed th, .jt-fixed td{overflow:hidden; text-overflow:ellipsis;}
.jt-fixed col.c-date{width:84px;} .jt-fixed col.c-title{width:30%;}
.jt-fixed col.c-acct{width:13%;} .jt-fixed col.c-amt{width:11%;} .jt-fixed col.c-note{width:18%;}
.jt-fixed td.jt-title{border-right:1px solid var(--line);}
.jt-fixed .jt-memo, .jt-fixed .jt-note span{cursor:help;}

/* 계정별원장 기초/기말 */
.ledger-top{display:flex; justify-content:space-between; align-items:center; padding:6px 4px 8px; font-size:13px;}
.ledger-top b{font-size:15px; font-variant-numeric:tabular-nums;}
.jrnl-table tr.ledger-open td{background:#f3f6f1; font-weight:600;}
.jrnl-table tr.ledger-close td{background:#eef3ea; font-weight:600; border-top:2px solid var(--line);}

/* 대시보드 합산 KPI 띠 */
.dash-sub-corp{font-size:13px; color:var(--muted); font-weight:600; margin:-2px 0 12px;}
.kpi-band{display:grid; grid-template-columns:repeat(auto-fit,minmax(180px,1fr)); gap:14px;}
.kpi-card{background:#fff; border:1px solid var(--line); border-radius:14px; padding:14px 16px; box-shadow:0 1px 3px rgba(28,36,25,.06);}
.kpi-card .kpi-label{font-size:13px; color:var(--muted); font-weight:600; margin-bottom:6px;}
.kpi-card .kpi-val{font-size:24px; font-weight:800; font-variant-numeric:tabular-nums; line-height:1.1;}
.kpi-card .kpi-sub{font-size:12px; color:var(--muted); margin-top:6px; font-variant-numeric:tabular-nums;}
.kpi-card .kpi-val.pos{color:#1e7d3a;} .kpi-card .kpi-val.neg{color:#c2362f;}
.kpi-card .kpi-sub b.pos{color:#1e7d3a;} .kpi-card .kpi-sub b.neg{color:#c2362f;}

/* 대시보드 컴팩트 블록 */
.dash-row3{display:grid; grid-template-columns:repeat(auto-fit,minmax(230px,1fr)); gap:14px; margin-top:14px;}
.dash-row2{display:grid; grid-template-columns:repeat(auto-fit,minmax(300px,1fr)); gap:14px; margin-top:14px;}
.card.mini{margin:0; padding:13px 15px;}
.card.mini .mini-head{font-size:13.5px; font-weight:700; margin-bottom:8px;}
.card.mini .mini-head .muted{font-weight:400; font-size:11.5px;}
.card.mini .mini-big{font-size:20px; font-weight:800; font-variant-numeric:tabular-nums; margin-bottom:8px;}
.card.mini .mini-big.pos{color:#1e7d3a;} .card.mini .mini-big.neg{color:#c2362f;}
.card.mini .mini-sub{font-size:11.5px; color:var(--muted); font-weight:600; margin-bottom:3px;}
.kv{display:flex; justify-content:space-between; align-items:center; font-size:12.5px; padding:2.5px 0; font-variant-numeric:tabular-nums;}
.kv b{font-weight:700;} .kv.sub{font-size:11.5px; color:var(--muted); padding:1px 0;}
.kv .pos,.kv b.pos{color:#1e7d3a;} .kv .neg,.kv b.neg{color:#c2362f;}
.kv .ok,.ok{color:#1e7d3a; font-weight:700;} .kv .bad,.bad{color:#c2362f; font-weight:700;}
.if-net{border-bottom:1px dashed var(--line); padding-bottom:5px; margin-bottom:4px;}
.trend-svg{width:100%; height:auto; display:block;}
.trend-leg{display:flex; gap:14px; font-size:11px; color:var(--muted); margin-top:4px; justify-content:center;}
.trend-leg i{display:inline-block; width:12px; height:8px; vertical-align:middle; margin-right:3px;}
.trend-leg i.bar{background:#bcd9b6; border-radius:2px;} .trend-leg i.ln{height:2px; background:#2f7d3a;}

/* 추세 토글 탭 */
.trend-tabs{display:flex; gap:4px; flex-wrap:wrap; margin-bottom:8px;}
.trend-tab{font-size:11.5px; padding:3px 9px; border:1px solid var(--line); background:#fff; border-radius:14px; cursor:pointer; color:var(--muted);}
.trend-tab.active{background:#2f7d3a; border-color:#2f7d3a; color:#fff; font-weight:700;}

/* KPI 3행 그리드 + 데이터점검 바 */
.kpi-row{display:grid; grid-template-columns:repeat(4,1fr); gap:12px; margin-bottom:12px;}
@media(max-width:760px){ .kpi-row{grid-template-columns:repeat(2,1fr);} }
.kpi-strong{background:#f3f8f1; border-color:#bcd9b6;}
.health-bar{display:flex; gap:8px; align-items:center; flex-wrap:wrap; margin:4px 0 2px; font-size:12px;}
.health-bar .hc-title{font-weight:700;}
.hc{padding:2px 10px; border-radius:12px; font-weight:600;}
.hc.ok{background:#eef7ec; color:#1e7d3a;} .hc.bad{background:#fbeceb; color:#c2362f;}

/* 대시보드 헤더 한 줄 (대표 합산 + 데이터점검 우측) */
.dash-head-row{display:flex; justify-content:space-between; align-items:center; flex-wrap:wrap; gap:8px 16px; margin:-2px 0 12px;}
.dash-head-row .dash-sub-corp{margin:0;}
.dash-head-row .health-bar{margin:0;}

/* 법인별 손익카드 — 소계/합계/이자 강조 */
.pl-table tr.pl-sub-tot td{border-top:1px solid var(--line); font-weight:600;}
.pl-table tr.pl-tot td{border-top:2px solid var(--line); font-weight:800;}
.pl-table tr.pl-interest td{color:var(--muted); font-size:12px;}
.pl-table tr.pl-interest td.pl-label{padding-left:14px;}
.pl-table tr.pl-ratio td{font-size:11.5px; font-weight:700; color:#7a6a2a; background:#fcfaf0;}
.pl-table tr.pl-ratio td.pl-label{color:#9a8a4a;}

/* 법인별 요약 BS — T자 */
.bs-t{width:100%; border-collapse:collapse; font-size:12.5px; font-variant-numeric:tabular-nums;}
.bs-t thead th{font-size:12px; color:var(--muted); font-weight:700; padding:2px 4px 6px; border-bottom:1px solid var(--line); text-align:left;}
.bs-t td{padding:2.5px 4px; vertical-align:top;}
.bs-t td.bs-lbl{white-space:nowrap;}
.bs-t td.num{text-align:right;}
.bs-t .bs-div{width:14px; border-left:1px solid var(--line);}
.bs-t th.bs-div{border-left:1px solid var(--line);}
.bs-t td.bs-grp{color:var(--muted); font-weight:700; font-size:11.5px; padding-top:5px;}
.bs-t tfoot td{border-top:2px solid var(--line); font-weight:800; padding-top:5px;}

/* 요약 BS 단순화: 부채/자본 구분선 */
.bs-t tbody td.bs-sep{border-top:1px solid var(--line); height:6px; padding:0;}

/* 요약 BS 윗줄 라인 + 단위 표시 */
.bs-t thead td{border-bottom:1.5px solid var(--line); padding:0 4px 4px;}
.bs-t thead td.bs-unit{text-align:right; font-size:10.5px; color:var(--muted); font-weight:600;}

/* 요약 BS: 단위를 농장명 줄 오른쪽으로, T 윗선은 첫 행 위에 */
.farm-card .fc-head .bs-unit-head{margin-left:auto; font-size:10.5px; color:var(--muted); font-weight:400;}
.bs-t tbody tr:first-child > td{border-top:1.5px solid var(--line);}

/* 요약 BS: 모든 행 높이 균일 → 빈 줄/내용 줄 무관하게 가로선 픽셀 정렬 */
.bs-t tbody tr{height:22px;}
.bs-t tbody td{vertical-align:middle;}
.txn-btns{display:contents;}   /* 데스크탑: 투명(버튼 그대로 인라인) */

/* ===== 모바일 반응형 (≤640px) ===== */
@media(max-width:640px){
  body{font-size:13px;}
  .topbar{gap:10px; padding:0 14px; height:50px;}
  .brand{font-size:16px;}
  .user{font-size:11px; margin-left:auto; display:flex; align-items:center; flex-shrink:0;}
  .u-name{display:none;}
  .u-btn{padding:3px 7px; font-size:10px; margin-right:4px; white-space:nowrap;}
  main{max-width:100%; padding:14px 12px 80px;}   /* 하단 탭바 공간 */
  .card{padding:13px;}
  h2.page{font-size:17px; margin-bottom:12px;}
  /* 하단 고정 탭바 (앱 스타일: 이모지 위 · 라벨 아래) */
  .tabs{position:fixed; left:0; right:0; bottom:0; z-index:200; background:var(--card);
    border-top:1px solid var(--line); gap:0; padding:0; flex:none;
    box-shadow:0 -2px 10px rgba(0,0,0,.07);}
  .tabs button{flex:1; display:flex; flex-direction:column; align-items:center; gap:3px;
    padding:7px 2px 8px; border-radius:0; font-size:14px; color:var(--muted);}
  .tabs button .ti{margin:0; font-size:19px; line-height:1;}
  .tabs button .tl{font-size:10px; line-height:1;}
  .tabs button:hover{background:none;}
  .tabs button.active{background:none; color:var(--accent);}
  .tabs button.active .tl{font-weight:700;}
  /* 테이블 가로 스크롤 안전장치 + KPI 카드 여백 축소 */
  .kpi-card{padding:11px 12px;}
  .kpi-card .kpi-val{font-size:16px; white-space:nowrap; letter-spacing:-.3px;}
  .kpi-card .kpi-label{font-size:11px; margin-bottom:3px;}
  .kpi-card .kpi-sub{font-size:10px; margin-top:3px;}
  .farm-cards{gap:12px;}
  /* 대시보드 재무분석: 손익·현금흐름·자산부채 3표 세로 스택 (겹침 해결) */
  .an-figwrap{flex-direction:column; align-items:stretch;}
  .an-figwrap > .an-is, .an-figwrap > .an-cf, .an-bs-t{flex:none; width:100%; min-width:0;}
  .an-col > .an-dt{height:auto;}
  .an-fig{font-size:12px;}
  .an-fig th, .an-fig td{padding:3px 6px;}
  /* IS·BS·CF 법인합산: 표(가로스크롤)+차트를 세로로 (차트 옆 표 끼임 해결) */
  .combi-wrap{flex-direction:column; flex-wrap:wrap;}
  .combi-wrap .combi-table, .combi-wrap .combi-chart{flex:none; width:100%; min-width:0;}
  .inc-farm-head{font-size:15px; flex-wrap:wrap;}
  /* IS/CF 법인합산 표: 첫 컬럼(계정명) 고정 + 숫자 축소 → 라벨 잘림·큰 숫자 해결 */
  .stmt.v2, .stmt.v2 td, .stmt.v2 th{font-size:11px;}
  .stmt.v2 tr.grand td, .stmt.v2 tr.keysub td, .stmt.v2 tr.total td, .stmt.v2 tr.ratio td{font-size:11px;}
  .stmt.v2 td, .stmt.v2 th{padding:3px 5px;}
  .stmt.v2 td.name, .stmt.v2 th:first-child{position:sticky; left:0; z-index:2; min-width:4.2em; background:#fff; box-shadow:1px 0 0 var(--line);}
  .stmt.v2 tr.total td.name{background:#fafbf8;}
  .stmt.v2 tr.subgroup td.name{background:#f3f6fb;}
  .stmt.v2 .cmonth{min-width:4.5em;}
  /* BS 법인합산 T자: 좌(자산)·우(부채·자본)를 위아래 세로로 (좌우 끼임 해결) */
  .bs-tform{flex-direction:column; gap:12px;}
  .bs-tform .bs-tf-side{width:100%;}
  .bs-stmt td.amt, .bs-stmt th.amt{font-size:10px;}
  /* 운영 D+N 차트 키우기 */
  .dn-graph{min-height:230px;}
  .dn-graph svg, .combi-chart svg.trend-svg{max-height:none;}
  /* 버튼·셀렉터 축소 → Admin 등 섹션 헤더가 한 줄에 더 많이 들어가게 */
  .btn{padding:5px 9px; font-size:12px;}
  .btn.sm, .btn.ghost{padding:3px 7px; font-size:11px;}
  select{font-size:12px; padding:3px 6px; max-width:44vw;}
  h3.sub{font-size:13.5px; display:flex; flex-wrap:wrap; align-items:center; gap:4px 6px;}
  h3.sub select, .page-sel select{font-size:11.5px; padding:2px 5px;}
  /* 1.거래·분개 입력: 수동분개/은행내역분개/파일분개 3버튼을 둘째 줄에 한꺼번에 */
  .txn-btns{display:flex; flex-basis:100%; gap:6px; flex-wrap:wrap; margin-top:3px;}
}
