/* 톤앤매너: 대표이사 홈페이지(검은 머리글 · 미색 본문 · 흰 패널 · 청록 포인트) +
   데일리버스킹(검은 무대 · Archivo/Gothic A1 · 로고 세 물결 색 라임/스카이/앰버를 시그니처로만 사용) */
:root {
  --bg: #f7f6f3;
  --panel: #ffffff;
  --panel-2: #faf9f6;
  --line: #e3e1dc;
  --line-2: #eeece7;
  --ink: #1b1c1f;
  --text: #2e3035;
  --muted: #74777e;
  --accent: #0a7480;
  --accent-bg: #e6f4f5;
  --hd: #0c0d0f;
  --hd-2: #16181c;
  --hd-3: #1f2228;
  --hd-line: #2a2d33;
  --hd-ink: #f3f5f8;
  --hd-muted: #9aa0a8;
  --lime: #dcf89b;
  --sky: #74e4f0;
  --amber: #fdd27c;
  --red: #c4314b;
  --green: #1f8a5b;
  --warn: #b7791f;
  --sel: #e6f4f5;
  --hover: #f3f2ee;
  --sec: #f4f3ef;
  --tot: #ecebe6;
  --c-rev: #0a7480;
  --c-exp: #d9b25c;
  --c-net: #1b1c1f;
  --grid: #e4e2dd;
  --grid-strong: #cfccc5;
  --th: #e9f0ef;
  --zebra: #fcfbf9;
  --subrow: #f6f5f1;
  --pick: #e3f5c4;
  /* 일반전표 목록(싸부넷처럼 또렷하게): 화면용 한글 글꼴 · 검정에 가까운 글자 · 잘 보이는 구분선 · 진한 머리글 */
  /* 싸부넷 표와 똑같이: PC에 설치된 나눔고딕(local NanumGothic) · 11px · 보통 굵기 · 검정 */
  --grid-font: "NanumGothic", "나눔고딕", "Nanum Gothic", Gulim, "Malgun Gothic", sans-serif;
  --gj-ink: #000000;
  --gj-line: #d3d0c9;
  --gj-vline: #aeaaa2;
  --gj-th: #6b7079;
  --gj-th-ink: #ffffff;
  --gj-row: 22px;     /* 표 한 줄 높이 (싸부넷 22.7px) */
  --gj-head: 24px;    /* 머리글 높이 */
  --gj-tw: 1161px;    /* 일반전표 표 넓이 (열 너비 합, 싸부넷처럼 화면 전체로 늘이지 않음) */
  --vt-tw: 1304px;    /* 매입매출전표 표 넓이 */
  --gj-fs: 11px;      /* 표 글자 크기 (싸부넷 11px) */
  --gj-stroke: 0px;   /* 글자 획 두껍게 하지 않음 (싸부넷과 같은 보통 굵기) */
  --row-h: 30px;
  --radius: 10px;
  --display: "Archivo", "Gothic A1", "Malgun Gothic", system-ui, sans-serif;
  --ko: "Gothic A1", "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans KR", system-ui, sans-serif;
  font-family: var(--ko);
  font-size: 14px;
  color: var(--text);
  color-scheme: light;
}
/* 어두운 화면: 머리글의 화면 버튼으로 고르면 <html data-theme="light|dark"> 가 붙는다. 고르지 않았으면 기기 설정을 따른다.
   (어두운 값은 '기기가 어둡고 밝게를 고르지 않았을 때'와 '어둡게를 골랐을 때' 두 군데에 같은 내용으로 적는다) */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #050506; --panel: #0f1013; --panel-2: #14161a; --line: #262930; --line-2: #1d2025;
    --ink: #f3f5f8; --text: #d5d8de; --muted: #9ca3ad; --accent: #74e4f0; --accent-bg: #12282b;
    --hd: #050506; --hd-2: #0f1013; --hd-3: #1a1c21; --hd-line: rgba(232, 238, 246, .13);
    --red: #ff7a8a; --green: #7fd8a8; --warn: #fdd27c;
    --sel: #13272a; --hover: #15171b; --sec: #15171b; --tot: #1c1f24;
    --c-rev: #74e4f0; --c-exp: #fdd27c; --c-net: #dcf89b;
    --grid: #22252b; --grid-strong: #33373f; --th: #142124; --zebra: #121317; --subrow: #16181c; --pick: #2a3a17;
    --gj-ink: #f3f5f8; --gj-line: #353941; --gj-vline: #565b65; --gj-th: #2b3038; --gj-th-ink: #f3f5f8;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #050506; --panel: #0f1013; --panel-2: #14161a; --line: #262930; --line-2: #1d2025;
  --ink: #f3f5f8; --text: #d5d8de; --muted: #9ca3ad; --accent: #74e4f0; --accent-bg: #12282b;
  --hd: #050506; --hd-2: #0f1013; --hd-3: #1a1c21; --hd-line: rgba(232, 238, 246, .13);
  --red: #ff7a8a; --green: #7fd8a8; --warn: #fdd27c;
  --sel: #13272a; --hover: #15171b; --sec: #15171b; --tot: #1c1f24;
  --c-rev: #74e4f0; --c-exp: #fdd27c; --c-net: #dcf89b;
  --grid: #22252b; --grid-strong: #33373f; --th: #142124; --zebra: #121317; --subrow: #16181c; --pick: #2a3a17;
  --gj-ink: #f3f5f8; --gj-line: #353941; --gj-vline: #565b65; --gj-th: #2b3038; --gj-th-ink: #f3f5f8;
  color-scheme: dark;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); word-break: keep-all; -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.num { text-align: right; font-family: var(--display); font-variant-numeric: tabular-nums; white-space: nowrap; }
.neg { color: var(--red); }
.muted { color: var(--muted); }
.center { text-align: center; }
.hidden { display: none !important; }

/* 로고 마크: 세 물결 색의 세 줄 */
.mark { display: inline-block; width: 22px; height: 15px; flex: none;
  background: linear-gradient(var(--lime) 0 3.5px, transparent 3.5px 5.75px, var(--sky) 5.75px 9.25px, transparent 9.25px 11.5px, var(--amber) 11.5px 15px); }

/* ---------- 머리글 ---------- */
.topbar {
  position: sticky; top: 0; z-index: 50; display: flex; align-items: center; gap: 22px;
  height: 60px; padding: 0 22px; background: var(--hd); color: var(--hd-ink); border-bottom: 1px solid var(--hd-line);
}
.brand { display: flex; align-items: center; gap: 11px; min-width: 0; color: var(--hd-ink); }
.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-text b { font-size: 15px; font-weight: 800; white-space: nowrap; }
.brand-text small { font-family: var(--display); font-weight: 600; font-size: 11px; letter-spacing: .03em; color: var(--hd-muted); }
/* 회사 바꾸기: 회사명 옆 ▾ */
.brand-wrap { position: relative; display: flex; align-items: center; gap: 4px; min-width: 0; }
.co-btn { border: 1px solid var(--hd-line); background: none; color: var(--hd-ink); width: 24px; height: 24px; border-radius: 5px; cursor: pointer; font-size: 12px; line-height: 1; padding: 0; flex: none; }
.co-btn:hover, .co-btn[aria-expanded="true"] { background: var(--hd-3); }
.co-menu { position: absolute; top: calc(100% + 10px); left: 0; z-index: 70; min-width: 260px; background: var(--hd-2); border: 1px solid var(--hd-line); border-radius: 8px; padding: 6px; box-shadow: 0 14px 30px rgba(0, 0, 0, .35); }
.co-menu[hidden] { display: none; }
.co-menu .co-h { padding: 4px 10px 6px; font-size: 11px; color: var(--hd-muted); }
.co-menu button { display: flex; align-items: center; gap: 8px; width: 100%; border: 0; background: none; color: var(--hd-ink); text-align: left; padding: 7px 10px; border-radius: 6px; cursor: pointer; font-size: 13px; }
.co-menu button:hover { background: var(--hd-3); }
.co-menu button .ck { width: 14px; color: var(--lime); flex: none; }
.co-menu button small { margin-left: auto; color: var(--hd-muted); font-family: var(--display); font-size: 11px; }
.co-menu button.cur { font-weight: 800; }
.co-menu .co-add { border-top: 1px solid var(--hd-line); margin-top: 4px; padding-top: 9px; color: var(--sky); }
.mainnav { display: flex; align-items: stretch; height: 100%; gap: 2px; flex: 1; min-width: 0; }
.nav-group { position: relative; display: flex; }
.nav-group > button {
  position: relative; border: 0; background: none; padding: 0 13px; cursor: pointer; font-weight: 700; font-size: 14px;
  white-space: nowrap; color: color-mix(in srgb, var(--hd-ink) 78%, transparent); transition: color .2s;
}
/* 메뉴 밑줄: 로고의 세 색이 차례로 (라임 · 스카이 · 앰버) */
.nav-group > button::after { content: ""; position: absolute; left: 13px; right: 13px; bottom: 16px; height: 2px; background: var(--ul, var(--lime));
  transform: scaleX(0); transform-origin: left; transition: transform .3s ease; }
.nav-group:nth-child(3n+1) { --ul: var(--lime); } .nav-group:nth-child(3n+2) { --ul: var(--sky); } .nav-group:nth-child(3n) { --ul: var(--amber); }
.nav-group > button:hover, .nav-group.open > button, .nav-group.active > button { color: var(--hd-ink); }
.nav-group:hover > button::after, .nav-group.open > button::after, .nav-group.active > button::after { transform: scaleX(1); }
.nav-menu {
  position: absolute; top: 100%; left: 0; min-width: 200px; background: var(--hd-2); border: 1px solid var(--hd-line);
  padding: 8px; display: none; box-shadow: 0 14px 30px rgba(0, 0, 0, .35);
}
.nav-group.open .nav-menu { display: block; }
/* 마우스를 올리면 클릭하지 않아도 하위 메뉴가 열린다 (터치 화면은 지금처럼 눌러서 연다).
   하위 메뉴를 누른 직후에는 마우스가 메뉴 위에 있어도 닫히도록 no-hover 로 잠깐 막는다. */
@media (hover: hover) {
  .mainnav:not(.no-hover) .nav-group:hover .nav-menu { display: block; }
  .mainnav:not(.no-hover) .nav-group:hover > button { color: var(--hd-ink); }
}
.nav-menu a { display: block; padding: 9px 12px; color: var(--hd-muted); white-space: nowrap; font-size: 14px; }
.nav-menu a:hover, .nav-menu a.cur { color: var(--hd-ink); background: var(--hd-3); }
.lock-badge { background: var(--amber); color: #1b1c1f; font-size: 12px; font-weight: 800; padding: 3px 9px; white-space: nowrap; }
.lock-badge[hidden] { display: none; }
.yearbox { display: flex; align-items: center; gap: 4px; border: 1px solid var(--hd-line); padding: 3px; }
.yearbox span { min-width: 72px; text-align: center; font-family: var(--display); font-weight: 800; font-size: 15px; letter-spacing: .02em; }
.yr-btn { border: 0; background: var(--hd-3); color: var(--amber); width: 28px; height: 28px; cursor: pointer; font-size: 10px; }
.yr-btn:hover { background: #2c3038; }
.yr-btn:disabled { opacity: .3; cursor: default; }
.live { display: flex; align-items: center; gap: 7px; font-family: var(--display); font-stretch: 115%; font-weight: 700; font-size: 10px; letter-spacing: .12em; color: var(--hd-muted); text-transform: uppercase; }
.live i { width: 7px; height: 7px; border-radius: 50%; background: #555; }
.live.on i { background: var(--lime); box-shadow: 0 0 0 3px rgba(220, 248, 155, .18); }
.live.flash i { background: var(--amber); }
/* 화면 밝기 버튼 (밝게 ↔ 어둡게) */
.theme-btn { display: flex; align-items: center; gap: 6px; border: 1px solid var(--hd-line); background: none; color: var(--hd-ink); height: 34px; padding: 0 10px; cursor: pointer; font-size: 12px; font-weight: 700; white-space: nowrap; }
.theme-btn:hover { background: var(--hd-3); }
.theme-btn i { width: 11px; height: 11px; border-radius: 50%; background: var(--amber); flex: none; }
.theme-btn.dark i { background: none; box-shadow: inset -3.5px -2px 0 0 var(--sky); }

.app { padding: 22px; max-width: 1520px; margin: 0 auto; }
.page-title { display: flex; align-items: baseline; gap: 12px; margin: 4px 0 14px; flex-wrap: wrap; }
.page-title h1 { font-size: 22px; font-weight: 800; color: var(--ink); margin: 0; letter-spacing: -.01em; }
.page-title .sub { color: var(--muted); font-size: 13px; }

/* ---------- 패널 · 툴바 ---------- */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.panel + .panel { margin-top: 14px; }
.panel-h { display: flex; align-items: center; gap: 10px; padding: 11px 16px; border-bottom: 1px solid var(--line-2); flex-wrap: wrap; }
.panel-h h2 { font-size: 15px; font-weight: 800; color: var(--ink); margin: 0; }
.panel-b { padding: 16px; }
.toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.toolbar .spacer { flex: 1; }
.copybar { display: inline-flex; align-items: center; gap: 5px; padding: 3px 4px 3px 10px; border: 1px solid var(--line); border-radius: 8px; white-space: nowrap; }
.copybar b { color: var(--accent); margin-right: 2px; }
.copybar .in { padding-left: 6px; padding-right: 6px; text-align: center; }
.btn {
  display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--panel); color: var(--text);
  padding: 6px 13px; border-radius: 6px; cursor: pointer; white-space: nowrap; font-weight: 600; font-size: 13px; transition: border-color .15s, color .15s, background .15s;
}
.btn:hover { border-color: var(--ink); color: var(--ink); }
.btn.primary { background: var(--ink); border-color: var(--ink); color: var(--panel); }
.btn.primary:hover { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.danger { color: var(--red); }
.btn.danger:hover { border-color: var(--red); }
.btn.sm { padding: 3px 9px; font-size: 12px; }
.btn:disabled { opacity: .45; cursor: default; }
.btn .kbd { margin-left: 2px; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; background: var(--panel); }
.seg button { border: 0; background: none; padding: 6px 12px; cursor: pointer; border-right: 1px solid var(--line); font-size: 13px; font-weight: 600; color: var(--muted); }
.seg button:last-child { border-right: 0; }
.seg button:hover { color: var(--ink); }
.seg button.on { background: var(--ink); color: var(--panel); }
input.in, select.in, textarea.in {
  border: 1px solid var(--line); border-radius: 6px; padding: 5px 9px; background: var(--panel); color: var(--text); min-width: 0;
}
input.in::placeholder { color: color-mix(in srgb, var(--muted) 80%, transparent); }
input.in:focus, select.in:focus, textarea.in:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-bg); }
input.in.num { font-family: var(--display); }
label.fld { display: flex; flex-direction: column; gap: 4px; font-size: 12px; font-weight: 600; color: var(--muted); }
label.fld > .in { font-size: 14px; font-weight: 400; color: var(--text); }
label.chk { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; font-size: 13px; }
input[type="checkbox"] { accent-color: var(--accent); }

/* ---------- 월 선택 ---------- */
.months { display: flex; gap: 3px; flex-wrap: wrap; }
.months button { border: 1px solid var(--line); background: var(--panel); min-width: 44px; padding: 5px 6px 4px; border-radius: 6px; cursor: pointer; font-weight: 700; font-size: 13px; color: var(--text); }
.months button:hover { border-color: var(--ink); }
.months button .cnt { display: block; font-family: var(--display); font-weight: 500; font-size: 10px; color: var(--muted); }
.months button.on { background: var(--ink); border-color: var(--ink); color: var(--panel); box-shadow: inset 0 -3px 0 var(--lime); }
.months button.on .cnt { color: color-mix(in srgb, var(--panel) 70%, transparent); }

/* ---------- 표 : 세로줄이 있는 촘촘한 격자 (싸부넷처럼 한눈에) ---------- */
.tbl-wrap { overflow: auto; max-height: calc(100vh - 240px); }
.tbl-wrap.free { max-height: none; }
table.t { width: 100%; border-collapse: collapse; font-size: 13px; line-height: 1.25; }
table.t th, table.t td { border: 1px solid var(--grid); padding: 0 8px; height: 26px; }
table.t thead th.sortable { cursor: pointer; user-select: none; }
table.t thead th.sortable:hover { color: var(--accent); }
table.t thead th.sortable.on { color: var(--accent); }
table.t thead th { position: sticky; top: 0; background: var(--th); color: var(--ink); font-size: 12.5px; font-weight: 700; z-index: 1; white-space: nowrap; height: 28px; box-shadow: inset 0 -1px 0 var(--grid-strong); }
table.t tbody tr:nth-child(even) td { background: var(--zebra); }
table.t tbody tr:hover td { background: var(--hover); }
table.t tr.click { cursor: pointer; }
table.t tr.sec td { background: var(--sec) !important; font-weight: 800; color: var(--ink); }
table.t tr.sub td { background: var(--subrow) !important; font-weight: 700; color: var(--ink); }
table.t tr.tot td { background: var(--tot) !important; font-weight: 800; color: var(--ink); }
table.t tr.strong td { font-weight: 700; }
table.t tr.sel td, table.t tr.pick td { background: var(--pick) !important; }
table.t tr.sel td:first-child { box-shadow: inset 3px 0 0 var(--accent); }
/* 더블클릭하면 원장이 열리는 숫자 */
td.drill { cursor: pointer; }
td.drill:hover { outline: 1px solid var(--accent); outline-offset: -1px; color: var(--accent); }
table.t tr.vstart td { border-top: 1px solid var(--line); }
/* 자금현황: 왼쪽 계좌 목록(세로) + 오른쪽 입출금 내역 */
.fund-layout { display: grid; grid-template-columns: 380px minmax(620px, max-content); gap: 14px; align-items: start; justify-content: center; } /* 내역 표는 내용 폭만큼, 둘을 화면 가운데로 */
.fund-list { position: sticky; top: 76px; max-height: calc(100vh - 170px); overflow: auto; padding-bottom: 6px; }
.fund-total { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; padding: 12px 14px; font-weight: 800; border-bottom: 1px solid var(--line); }
.fund-total small { color: var(--muted); font-weight: 500; font-size: 11px; margin-left: 4px; }
.fund-total b { font-family: var(--display); font-variant-numeric: tabular-nums; font-size: 16px; }
.fund-group .fg-h { display: flex; justify-content: space-between; padding: 10px 14px 4px; font-size: 12px; color: var(--muted); font-weight: 700; }
.fund-group .fg-h b { font-family: var(--display); font-variant-numeric: tabular-nums; }
.fund-item { display: flex; width: 100%; justify-content: space-between; align-items: center; gap: 10px; padding: 6px 14px; border: 0; border-left: 3px solid transparent;
  background: none; color: var(--text); font: inherit; font-size: 13px; text-align: left; cursor: pointer; }
.fund-item:hover { background: var(--hover); }
.fund-item.sel { background: var(--pick); border-left-color: var(--accent); }
.fund-item.zero { opacity: .55; }
.fund-item .fi-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fund-item small { display: block; color: var(--muted); font-size: 11px; }
.fund-item .fi-bal { font-family: var(--display); font-variant-numeric: tabular-nums; font-weight: 700; white-space: nowrap; }
.fund-list .neg, .fund-hist .neg { color: var(--red); }
.fund-sum { display: flex; flex-wrap: wrap; gap: 6px 22px; padding: 4px 16px 10px; font-size: 13px; color: var(--muted); }
.fund-sum b { color: var(--ink); font-family: var(--display); font-variant-numeric: tabular-nums; margin-left: 4px; }
.fund-hist .tbl-wrap { max-height: calc(100vh - 290px); }
@media (max-width: 900px) { .fund-layout { grid-template-columns: 1fr; } .fund-list { position: static; max-height: none; } }
/* 일반전표 목록에서 바로 고치기 */
#gj-wrap:focus, #vt-wrap:focus { outline: none; }
#gj-tbl td[data-cell] { cursor: text; }
#gj-tbl td[data-cell]:hover { box-shadow: inset 0 0 0 1px var(--accent); }
/* 열 너비는 colgroup 으로 고정: 칸을 열어 고칠 때도 열 너비가 바뀌지 않는다 */
#gj-tbl { table-layout: fixed; width: var(--gj-tw); min-width: 0; }
#gj-tbl td, #gj-tbl th { overflow: hidden; text-overflow: ellipsis; }
/* 고치는 칸: 보이던 칸과 같은 자리·크기·글꼴 (정렬·글꼴·여백은 entry-gj.js 가 그 칸에서 그대로 옮김). 테두리만 표시 */
/* 칸을 고치는 동안 칸의 여백은 0 (입력칸이 대신 같은 여백을 가짐) — 금액 칸(td.num) 규칙보다 앞서도록 !important */
#gj-tbl td:has(> .cell-in), #gj-tbl td:has(> .combo) { padding: 0 !important; }
#gj-tbl .combo { width: 100%; height: 100%; }
#gj-tbl .cell-in { display: block; width: 100%; height: calc(var(--gj-row) - 1px); min-width: 0; margin: 0; padding-top: 0; padding-bottom: 0; line-height: calc(var(--gj-row) - 3px);
  border: 1px solid var(--accent); border-radius: 0; background: transparent; box-shadow: none; box-sizing: border-box; }
#gj-tbl .cell-in:focus { box-shadow: none; border-color: var(--accent); }
#gj-tbl tr.dirty td { background: color-mix(in srgb, var(--warn) 18%, var(--panel)) !important; }
#gj-tbl td.moved { color: var(--warn); font-weight: 700; } /* 번호를 바꿔 다른 전표로 옮길 줄 */
#gj-tbl tfoot td.bad { color: var(--red); }
/* 맨 아래 입력 줄: 표의 한 줄처럼 같은 열에 칸이 있고, 스크롤해도 합계 줄 바로 위에 붙어 있다 */
#gj-entry td { position: sticky; bottom: var(--gj-row); z-index: 2; padding: 0; background: var(--panel-2) !important; border-top: 2px solid var(--ink); }
#gj-entry td.ename { padding: 0 8px; cursor: text; color: var(--ink); }
#gj-entry td:nth-child(2) { padding: 0 8px; color: var(--muted); }
#gj-entry td:nth-child(4) { padding: 0 4px; }
#gj-entry .combo { width: 100%; }
#gj-entry .ein { display: block; width: 100%; height: calc(var(--gj-row) - 1px); min-width: 0; margin: 0; padding: 0 7px; border: 1px solid var(--line); border-radius: 0; background: var(--panel);
  font-size: 13px; box-sizing: border-box; }
#gj-entry select.ein { padding: 0 7px; appearance: none; -webkit-appearance: none; background-image: none; cursor: text; } /* 화살표 없이 글자로 (3/4 · 차/대 로 바꿈) */
#gj-entry input[data-f="no"] { color: var(--muted); }
#gj-entry input[data-f="no"].add { color: var(--accent); font-weight: 700; border-color: var(--accent); } /* 이미 있는 전표에 줄 추가 중 */
#gj-entry .ein:focus { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
#gj-tbl td.etime { font-family: var(--display); font-variant-numeric: tabular-nums; color: var(--muted); }
.unbal { color: var(--red); font-weight: 700; font-size: 12.5px; padding: 2px 9px; border-radius: 6px; white-space: nowrap;
  background: color-mix(in srgb, var(--red) 10%, var(--panel)); border: 1px solid color-mix(in srgb, var(--red) 35%, var(--panel)); }
/* 전표 목록: 한 전표(줄)가 한 줄 높이를 넘지 않게 줄바꿈하지 않고, 긴 글자는 … 로 줄인다 */
#vt-tbl td, #gj-tbl td { white-space: nowrap; height: 24px; padding-top: 0; padding-bottom: 0; }
#vt-tbl .tag, #gj-tbl .tag { padding: 1px 6px 0; height: 17px; line-height: 1; }
#vt-tbl input[type=checkbox], #gj-tbl input[type=checkbox] { margin: 0; vertical-align: middle; }
/* 일반전표·매입매출전표 목록: 싸부넷처럼 또렷하게 (싸부넷 표는 나눔고딕 · 검정 글자 · #dbdbdb 선 · 회색 머리글에 흰 글자)
   ① 글꼴: 윈도우 화면용으로 다듬어진 한글 글꼴(나눔고딕, 없으면 맑은 고딕) — 숫자·입력시간·입력칸·유형 표시도 같은 글꼴
   ② 글자: 검정에 가깝게, 입력시간·상대계정도 같은 색  ③ 구분선: 가로·세로 모두 잘 보이게, 전표 사이는 한 단계 더 진하게
   ④ 머리글: 진한 바탕에 흰 글자  ⑤ 줄: 24px → 26px */
#gj-tbl, #vt-tbl { font-family: var(--grid-font); color: var(--gj-ink); }
#gj-tbl .num, #gj-tbl td.etime, #gj-tbl input.in, #gj-tbl input.in.num, #gj-tbl select.in, #vt-tbl .num, #vt-tbl .tag { font-family: var(--grid-font); }
#gj-tbl td.etime, #vt-tbl tr.click td.muted { color: inherit; }
#gj-tbl th, #gj-tbl td, #vt-tbl th, #vt-tbl td { border-color: var(--gj-line); }
#gj-tbl tr.vstart td { border-top-color: var(--gj-vline); }
:is(#gj-tbl, #vt-tbl) thead th { background: var(--gj-th); color: var(--gj-th-ink); box-shadow: none; border-color: color-mix(in srgb, var(--gj-th) 80%, #000); }
#gj-tbl td, #vt-tbl td { height: var(--gj-row); }
:is(#gj-tbl, #vt-tbl) thead th { height: var(--gj-head); }
/* 글자: 12px 에 획을 살짝 두껍게 (나눔고딕 보통 굵기는 작은 크기에서 가늘어 보여서). 유형 표시(.tag)는 이미 굵어 그대로 */
#gj-tbl, #vt-tbl, :is(#gj-tbl, #vt-tbl) thead th, #gj-entry .ein { font-size: var(--gj-fs); }
#gj-tbl td, #vt-tbl td, #gj-tbl .cell-in, #gj-entry .ein { -webkit-text-stroke: var(--gj-stroke) currentColor; }
:is(#gj-tbl, #vt-tbl) .tag { -webkit-text-stroke: 0; }
#gj-tbl #gj-entry td { border-top-color: var(--ink); } /* 입력 줄 위의 굵은 선은 그대로 */
#gj-entry .ein { color: var(--gj-ink); }
/* 일반전표 열: 싸부넷처럼 좁게 · 여백 작게. 월·일·번호·구분·코드·입력방법은 가운데, 계정·거래처·적요·입력시간은 왼쪽, 금액은 오른쪽 */
#gj-tbl th, #gj-tbl td, #gj-tbl td.num { padding: 0 3px; }
#gj-tbl tbody td:is(:nth-child(-n+6), :nth-child(10), :nth-child(14)), #gj-tbl thead th { text-align: center; }
#gj-tbl tbody td:is(:nth-child(7), :nth-child(11), :nth-child(12), :nth-child(13)) { text-align: left; }
#gj-tbl tbody td:is(:nth-child(8), :nth-child(9)) { text-align: right; }
#gj-tbl #gj-entry td { padding: 0; }
#gj-tbl #gj-entry td:nth-child(2) { text-align: center; color: var(--muted); }
#gj-tbl #gj-entry td.ename { padding: 0 3px; text-align: left; }
#gj-entry .ein { padding: 0 3px; }
#gj-entry :is(input[data-f="day"], input[data-f="no"], input[data-f="acct"], input[data-f="vendor"]) { text-align: center; }
#gj-entry select.ein { padding: 0 2px; text-align: center; text-align-last: center; }
/* 표와 그 상자는 열 너비 합(+ 세로 스크롤바 자리)만큼만, 남는 화면은 비워 둔다. 위 줄(버튼·안내)은 상자 폭을 늘리지 않고 접힌다.
   아래 상자들도 거의 같은 폭으로 (스크롤바 폭은 윈도우 크롬 기준 약 16px) */
#gj-wrap, #vt-wrap { scrollbar-gutter: stable; }
.panel.gj-list, .panel.vt-list { width: fit-content; max-width: 100%; }
:is(.panel.gj-list, .panel.vt-list) > :not(.tbl-wrap) { contain: inline-size; }
#gj-bottom { max-width: calc(var(--gj-tw) + 18px); }
.panel.vt-sum { max-width: calc(var(--vt-tw) + 18px); }
/* 전표 화면 전체(제목·버튼·표·아래 상자)를 표 폭에 맞춘 한 단으로 묶어 화면 가운데에 둔다 */
.gj-page { max-width: calc(var(--gj-tw) + 18px); margin: 0 auto; }
.vt-page { max-width: calc(var(--vt-tw) + 18px); margin: 0 auto; }
:is(#gj-tbl, #vt-tbl) .ell { max-width: 100% !important; } /* 긴 글자는 칸 안에서 … 로 */
/* 매입매출전표 열: 싸부넷처럼 좁게 · 여백 작게. 월·일·번호·유형·코드·사업자번호·전자·분개는 가운데, 품목·거래처명·계정은 왼쪽, 수량~합계는 오른쪽 */
#vt-tbl { table-layout: fixed; width: var(--vt-tw); }
#vt-tbl th, #vt-tbl td, #vt-tbl td.num { padding: 0 3px; overflow: hidden; text-overflow: ellipsis; }
#vt-tbl thead th, #vt-tbl tbody td:is(:nth-child(-n+5), :nth-child(12), :nth-child(14), :nth-child(15), :nth-child(16)) { text-align: center; }
#vt-tbl tbody td:is(:nth-child(6), :nth-child(13), :nth-child(17), :nth-child(18)) { text-align: left; }
#vt-tbl tbody td:is(:nth-child(n+7):nth-child(-n+11)) { text-align: right; }
/* 매입매출전표: 일반전표와 같은 맨 아래 입력 줄 · 목록 칸을 눌러 바로 고치기 */
#vt-tbl td[data-cell] { cursor: text; }
#vt-tbl td[data-cell]:hover { box-shadow: inset 0 0 0 1px var(--accent); }
#vt-tbl td:has(> .cell-in), #vt-tbl td:has(> .combo) { padding: 0 !important; }
#vt-tbl .combo { width: 100%; height: 100%; }
#vt-tbl .cell-in { display: block; width: 100%; height: calc(var(--gj-row) - 1px); min-width: 0; margin: 0; padding-top: 0; padding-bottom: 0; line-height: calc(var(--gj-row) - 3px);
  border: 1px solid var(--accent); border-radius: 0; background: transparent; box-shadow: none; box-sizing: border-box; }
#vt-tbl .cell-in:focus { box-shadow: none; border-color: var(--accent); }
#vt-tbl #vt-entry td { position: sticky; bottom: var(--gj-row); z-index: 2; padding: 0; background: var(--panel-2) !important; border-top: 2px solid var(--ink); }
#vt-tbl #vt-entry td:is(:nth-child(2), :nth-child(4)) { text-align: center; color: var(--muted); }
#vt-tbl #vt-entry td.ename { padding: 0 3px; cursor: text; text-align: left; color: var(--gj-ink); }
#vt-entry .combo { width: 100%; }
#vt-entry .ein { display: block; width: 100%; height: calc(var(--gj-row) - 1px); min-width: 0; margin: 0; padding: 0 3px; border: 1px solid var(--line); border-radius: 0; background: var(--panel);
  font-family: var(--grid-font); font-size: var(--gj-fs); color: var(--gj-ink); box-sizing: border-box; }
#vt-entry select.ein { padding: 0 2px; appearance: none; -webkit-appearance: none; background-image: none; cursor: text; text-align: center; text-align-last: center; } /* 화살표 없이 글자로 (1~4 로 바꿈) */
#vt-entry .ein[data-f="type"] { padding: 0 1px; text-align: center; } /* '57 카과'가 좁은 칸에 다 보이게 */
#vt-entry .ein:focus { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
#vt-entry :is(input[data-f="day"], input[data-f="type"], input[data-f="vendor"], input[data-f="bizno"]) { text-align: center; }
/* 아래 상자: 분개(왼쪽) · 결제 거래처·고정자산(오른쪽) */
.vt-draft-b { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 16px; align-items: start; }
.vt-draft-b .vt-opts { display: grid; gap: 10px; }
/* 더블클릭 검색: 목록 위 조건(누르면 그 조건만 취소) · 머리글의 '취소' */
.pins { display: inline-flex; align-items: center; gap: 5px; flex-wrap: wrap; font-size: 12.5px; }
.pins > b { color: var(--accent); }
.pins .pin { border: 1px solid var(--accent); background: var(--accent-bg); color: var(--ink); border-radius: 6px; padding: 2px 8px; font-size: 12.5px; cursor: pointer; white-space: nowrap; }
.pins .pin em { font-style: normal; font-weight: 700; }
.pins .pin:hover { background: var(--panel); }
.pins .pin.all { border-color: var(--line); background: var(--panel); color: var(--muted); }
:is(#gj-tbl, #vt-tbl) thead th .pin-x { color: var(--amber); font-size: 11.5px; font-weight: 700; margin-left: 2px; padding: 3px 3px; cursor: pointer; text-decoration: underline; }
/* 번호로 입력하는 칸의 안내 (1 현금 · 2 외상 …) */
.code-hint { position: fixed; z-index: 80; display: flex; gap: 10px; padding: 4px 10px; border-radius: 6px; background: var(--hd); color: var(--hd-ink);
  border: 1px solid var(--hd-line); box-shadow: 0 6px 18px rgba(0, 0, 0, .25); font-size: 12px; white-space: nowrap; pointer-events: none; }
.code-hint[hidden] { display: none; }
.code-hint b { color: var(--lime); font-family: var(--display); margin-right: 3px; }
.ell { display: inline-block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: middle; }
table.t td.ind1 { padding-left: 24px; }
table.t td.ind2 { padding-left: 40px; }
table.t td a { color: var(--accent); }
table.t td a:hover { text-decoration: underline; }
table.t tfoot td { position: sticky; bottom: 0; background: var(--tot); font-weight: 800; color: var(--ink); }
/* 상자 안 글자는 위아래 가운데: 줄 높이를 글자 크기에 맞추고 상자 높이를 정해 가운데 정렬 (숫자·한글 모두) */
.tag { display: inline-flex; align-items: center; justify-content: center; gap: 4px; height: 18px; line-height: 1; padding: 1px 7px 0; border-radius: 4px; font-size: 11px; font-weight: 700; background: var(--line-2); color: var(--muted); white-space: nowrap; vertical-align: middle; box-sizing: border-box; }
.tag .vt-no { font-weight: 800; font-variant-numeric: tabular-nums; position: relative; top: .5px; } /* 숫자는 한글보다 획이 위에 몰려 있어 살짝 내림 (padding-top 1px 와 함께 둘 다 상자 가운데) */

/* 매입매출 유형 색: 유형 이름마다 색(--h 색상, --s 채도). 매출·매입에서 이름이 같으면 같은 색 (17 카과 = 57 카과) */
.vt { --h: 0; --s: 80%; }
.vt-카과 { --h: 46; --s: 92%; }  .vt-카불 { --h: 0; }    .vt-카면 { --h: 26; }  .vt-카영 { --h: 325; }
.vt-현과 { --h: 128; --s: 55%; } .vt-현불 { --h: 298; --s: 60%; } .vt-현면 { --h: 170; --s: 60%; } .vt-현영 { --h: 92; --s: 60%; }
.vt-과세 { --h: 212; }  .vt-불공 { --h: 275; --s: 60%; }  .vt-영세 { --h: 190; }  .vt-면세 { --h: 238; --s: 65%; }  .vt-수입 { --h: 345; }
.vt-건별 { --h: 68; --s: 60%; }  .vt-수출 { --h: 255; --s: 75%; }  .vt-면건 { --h: 150; --s: 50%; }
.vt-폐기 { --h: 0; --s: 0%; }   .vt-분실 { --h: 30; --s: 20%; }  .vt-판촉 { --h: 205; --s: 20%; }
.tag.vt { background: hsl(var(--h) var(--s) 87%); color: hsl(var(--h) var(--s) 26%); }
input.in.vt, #vt-entry input.ein.vt { background: hsl(var(--h) var(--s) 92%); color: hsl(var(--h) var(--s) 24%); font-weight: 700; }
.vt-dot { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 4px; vertical-align: 0; background: hsl(var(--h) var(--s) 50%); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .tag.vt { background: hsl(var(--h) var(--s) 55% / .22); color: hsl(var(--h) calc(var(--s) * .9) 74%); }
  :root:not([data-theme="light"]) :is(input.in.vt, #vt-entry input.ein.vt) { background: hsl(var(--h) var(--s) 55% / .16); color: hsl(var(--h) calc(var(--s) * .9) 76%); }
  :root:not([data-theme="light"]) .vt-dot { background: hsl(var(--h) var(--s) 62%); }
}
:root[data-theme="dark"] .tag.vt { background: hsl(var(--h) var(--s) 55% / .22); color: hsl(var(--h) calc(var(--s) * .9) 74%); }
:root[data-theme="dark"] :is(input.in.vt, #vt-entry input.ein.vt) { background: hsl(var(--h) var(--s) 55% / .16); color: hsl(var(--h) calc(var(--s) * .9) 76%); }
:root[data-theme="dark"] .vt-dot { background: hsl(var(--h) var(--s) 62%); }
.tag.S { background: color-mix(in srgb, var(--sky) 35%, var(--panel)); color: #0b5560; }
.tag.P { background: color-mix(in srgb, var(--amber) 45%, var(--panel)); color: #7a5208; }
.tag.k-보정 { background: color-mix(in srgb, var(--amber) 40%, var(--panel)); color: #7a5208; }
.tag.k-결산 { background: color-mix(in srgb, var(--lime) 55%, var(--panel)); color: #3d5a0c; }
.tag.k-매입매출 { background: color-mix(in srgb, var(--sky) 30%, var(--panel)); color: #0b5560; }
.tag.k-마감 { background: var(--ink); color: var(--panel); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) :is(.tag.S, .tag.k-매입매출) { background: rgba(116, 228, 240, .14); color: var(--sky); }
  :root:not([data-theme="light"]) :is(.tag.P, .tag.k-보정) { background: rgba(253, 210, 124, .14); color: var(--amber); }
  :root:not([data-theme="light"]) .tag.k-결산 { background: rgba(220, 248, 155, .14); color: var(--lime); }
}
:root[data-theme="dark"] :is(.tag.S, .tag.k-매입매출) { background: rgba(116, 228, 240, .14); color: var(--sky); }
:root[data-theme="dark"] :is(.tag.P, .tag.k-보정) { background: rgba(253, 210, 124, .14); color: var(--amber); }
:root[data-theme="dark"] .tag.k-결산 { background: rgba(220, 248, 155, .14); color: var(--lime); }

/* 홈택스 자료 표: 한 줄로 (사업자번호 등이 두 줄로 접혀 줄이 높아지지 않게). 계정 코드 칸을 고칠 때 입력칸은 칸 안에 꼭 맞게 */
#ht-tbl td { white-space: nowrap; }
#ht-tbl td .combo { display: block; }
#ht-tbl input.ht-cell-in { display: block; border-radius: 0; }
#ht-tbl td.acct-code.need { background: color-mix(in srgb, var(--warn) 30%, transparent); } /* 계정이 빈 줄 (신규 거래처) */
.need-txt { color: var(--warn); font-weight: 700; }
/* 홈택스 수기 입력: 손으로 넣은 줄은 보라색 '수기' 표시 + 옅은 보라 바탕 (엑셀·자동수집 자료와 구분) */
:root { --src-m-bg: hsl(265 85% 93%); --src-m-ink: hsl(265 50% 40%); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --src-m-bg: hsl(265 40% 26%); --src-m-ink: hsl(265 85% 82%); } }
:root[data-theme="dark"] { --src-m-bg: hsl(265 40% 26%); --src-m-ink: hsl(265 85% 82%); }
.tag.src-m { background: var(--src-m-bg); color: var(--src-m-ink); }
#ht-tbl tr.src-m > td { background-color: color-mix(in srgb, var(--src-m-bg) 50%, transparent); }
#ht-tbl tr.man-edit > td { box-shadow: inset 0 2px 0 var(--src-m-ink), inset 0 -2px 0 var(--src-m-ink); }
/* 카드사별 소계 줄 (합계 줄 위) */
#ht-tbl tfoot tr.ht-sub td { background: var(--panel-2); font-weight: 600; color: var(--muted); border-top: 1px solid var(--line); }
#ht-tbl tfoot tr.ht-sub td.num { color: var(--ink); }
#ht-tbl tfoot tr.ht-sub td b { color: var(--ink); font-weight: 700; }
/* 홈택스 표 맨 아래 수기 입력 줄: 일반전표 입력 줄처럼 표의 한 줄 (같은 열·같은 글자), 스크롤해도 합계 줄 바로 위에 붙어 있다 */
#ht-entry td { position: sticky; bottom: var(--ht-foot, 33px); z-index: 2; padding: 0 !important; background: var(--panel-2) !important; border-top: 2px solid var(--ink); }
#ht-entry td:is([data-src], [data-nm], [data-act]) { padding: 0 10px 0 8px !important; } /* 위 자료 칸과 같은 여백 (왼쪽 8 · 오른쪽 10) */
#ht-entry tr.editing td { border-top-color: var(--src-m-ink); }
#ht-entry .combo { display: block; width: 100%; }
#ht-entry .ein { display: block; width: 100%; min-width: 0; height: var(--ht-ein, 25px); margin: 0; padding: 0 9px 0 7px; border: 1px solid var(--line); border-radius: 0; background: var(--panel);
  color: inherit; font: inherit; box-sizing: border-box; }
#ht-entry .ein.r { text-align: right; font-family: var(--display); font-variant-numeric: tabular-nums; } /* 금액은 위 줄의 금액 칸(.num)과 같은 글꼴 */
#ht-entry .ein.c { text-align: center; }
#ht-entry input.ein:not(.r) { padding-right: 2px; } /* 왼쪽 정렬 칸은 오른쪽 여백을 줄여 좁은 열(월·일·계정코드)에서 글자가 잘리지 않게 (글자 시작 위치는 그대로) */
#ht-entry .ein::placeholder { color: color-mix(in srgb, var(--muted) 70%, transparent); }
#ht-entry select.ein { appearance: none; -webkit-appearance: none; background-image: none; cursor: pointer; padding: 0 6px; }
#ht-entry select.ein.vt { background: hsl(var(--h) var(--s) 92%); color: hsl(var(--h) var(--s) 24%); font-weight: 700; text-align: center; text-align-last: center; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) #ht-entry select.ein.vt { background: hsl(var(--h) var(--s) 55% / .16); color: hsl(var(--h) calc(var(--s) * .9) 76%); } }
:root[data-theme="dark"] #ht-entry select.ein.vt { background: hsl(var(--h) var(--s) 55% / .16); color: hsl(var(--h) calc(var(--s) * .9) 76%); }
#ht-entry .ein:focus { outline: none; border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.ht-x { border: 0; background: none; padding: 0; color: var(--red); font: inherit; font-size: 12px; font-weight: 700; cursor: pointer; }

/* ---------- 거래처등록 (싸부넷처럼 왼쪽 목록 + 오른쪽 상세) ---------- */
.vd-layout { display: grid; grid-template-columns: minmax(0, max-content) minmax(420px, 600px); gap: 12px; justify-content: center; align-items: start; }
.vd-list, .vd-form { margin: 0; }
.vd-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.vd-bar .seg { margin-right: 4px; }
.vd-wrap { max-height: calc(100vh - 250px); overflow: auto; }
#vd-tbl { table-layout: fixed; width: max-content; }
#vd-tbl td { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#vd-tbl tbody tr.muted td { color: var(--muted); }
#vd-tbl tfoot td { position: sticky; bottom: 0; background: var(--panel-2); padding: 2px 4px; }
#vd-tbl tfoot input.in { height: 24px; padding: 0 4px; }
.vd-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 10px; }
.vd-tip { color: var(--bad, #d64545); font-size: 12px; }
.vd-ftitle { padding: 8px 12px; border-bottom: 1px solid var(--line); font-size: 13px; }
.vd-f { width: 100%; border-collapse: collapse; }
.vd-f th { background: var(--th); color: var(--ink); font-weight: 700; font-size: 12.5px; text-align: center; padding: 3px 6px; border: 1px solid var(--grid); white-space: nowrap; }
.vd-f td { padding: 3px 6px; border: 1px solid var(--grid); vertical-align: middle; }
.vd-f input.in, .vd-f select.in { height: 26px; padding: 0 6px; max-width: 100%; box-sizing: border-box; }
.vd-f textarea.in { width: 100%; box-sizing: border-box; resize: vertical; padding: 6px; font: inherit; }
.vd-f .vd-r { display: inline-flex; align-items: center; gap: 3px; margin-right: 10px; white-space: nowrap; }
.vd-addr { display: grid; gap: 3px; }
.vd-bar[hidden] { display: none; }
.vd-stat .seg button { padding: 0 8px; }
.vd .warn { color: var(--warn); }
.vd .neg { color: var(--bad, #d64545); }
@media (max-width: 1020px) { .vd-layout { grid-template-columns: minmax(0, max-content); } }

/* ---------- 재무제표 지면 ---------- */
.paper { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 30px 34px; }
.paper h2 { text-align: center; font-size: 22px; font-weight: 800; color: var(--ink); letter-spacing: 8px; margin: 0 0 8px; }
.paper h2::after { content: ""; display: block; width: 44px; height: 3px; margin: 12px auto 0;
  background: linear-gradient(90deg, var(--lime) 0 33.3%, var(--sky) 33.3% 66.6%, var(--amber) 66.6%); }
.paper .period { text-align: center; color: var(--muted); margin-bottom: 18px; font-size: 13px; }
.paper .meta { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); margin-bottom: 8px; }
.paper table.t td { height: 26px; }
/* 표는 내용 폭만큼만: 지면(재무제표·신고서)과 보고서 패널은 안의 표 폭에 맞춰 줄어들고, 화면보다 넓으면 화면 폭까지만.
   설명 문단·패널 제목줄은 폭을 늘리지 않고 그 안에서 줄바꿈한다(contain: inline-size). */
.paper { width: fit-content; max-width: 100%; margin: 0 auto; }
.paper > p, .paper > .hint, .paper .notice { contain: inline-size; }
.body > .panel, .acct-block > .panel, .panel.fit { width: fit-content; min-width: min(520px, 100%); max-width: 100%; margin-left: auto; margin-right: auto; } /* 메인 표는 화면 가운데 */
.body > .panel > .panel-h, .panel.fit > .panel-h, .panel.fit > .panel-b, .panel.fit p, .panel.fit div.hint { contain: inline-size; }
table.t td.num { padding: 0 10px; }

/* ---------- 입력 화면 ---------- */
.entry-grid { display: grid; grid-template-columns: minmax(0, 1fr) 440px; gap: 14px; align-items: start; }
.form-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 10px; }
.form-grid .c2 { grid-column: span 2; } .form-grid .c3 { grid-column: span 3; } .form-grid .c4 { grid-column: span 4; } .form-grid .c6 { grid-column: span 6; }
.lines-tbl { background: var(--panel-2); }
.lines-tbl input.in, .lines-tbl select.in { width: 100%; padding: 5px 7px; }
.lines-tbl td { padding: 6px 3px !important; height: auto !important; border: 0 !important; background: var(--panel-2) !important; }
.lines-tbl tr:hover td { background: transparent !important; }
table.t.lines-tbl { border-top: 2px solid var(--ink) !important; }
.balance-bar { display: flex; justify-content: space-between; padding: 9px 14px; margin: 10px 16px 16px; border-radius: 6px; background: var(--panel-2); border: 1px solid var(--line-2); font-weight: 700; font-family: var(--display); font-size: 13px; }
.balance-bar.bad { background: color-mix(in srgb, var(--red) 9%, var(--panel)); border-color: color-mix(in srgb, var(--red) 30%, var(--panel)); color: var(--red); }
.balance-bar.ok { background: color-mix(in srgb, var(--lime) 35%, var(--panel)); border-color: color-mix(in srgb, var(--lime) 80%, var(--panel)); color: #3d5a0c; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .balance-bar.ok { background: rgba(220, 248, 155, .1); border-color: rgba(220, 248, 155, .3); color: var(--lime); } }
:root[data-theme="dark"] .balance-bar.ok { background: rgba(220, 248, 155, .1); border-color: rgba(220, 248, 155, .3); color: var(--lime); }
.preview { margin-top: 2px; font-size: 12px; }
.preview table { width: 100%; border-collapse: collapse; margin-top: 4px; }
.preview td { padding: 4px 6px; border-bottom: 1px dashed var(--line); }
.preview td.num, .preview td:nth-child(4), .preview td:nth-child(5) { font-family: var(--display); text-align: right; }
.hint { font-size: 12px; color: var(--muted); }
.kbd { display: inline-block; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 4px; padding: 0 5px; font-family: var(--display); font-size: 10px; font-weight: 600; background: var(--panel); color: var(--muted); }

/* ---------- 콤보박스 ---------- */
.combo { position: relative; }
/* ▾ 단추: 입력칸 오른쪽 안쪽에 붙임 (combo arrow 옵션) */
.combo.has-arrow > input { padding-right: 30px; }
.combo-arrow {
  position: absolute; top: 1px; right: 1px; bottom: 1px; width: 28px; padding: 0; border: 0; border-left: 1px solid var(--line);
  border-radius: 0 5px 5px 0; background: transparent; color: var(--muted); cursor: pointer; display: grid; place-items: center;
}
.combo-arrow:hover { background: var(--sel); color: var(--ink); }
.combo-arrow svg { width: 12px; height: 12px; }
.combo-list {
  /* body 에 붙여 화면 기준으로 띄움 (위치·폭·높이는 core.js combo 가 입력칸에 맞춰 정함) */
  position: fixed; z-index: 95; max-height: 270px; overflow-x: hidden; overflow-y: auto; background: var(--panel); color: var(--ink);
  border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 12px 28px rgba(0, 0, 0, .16); min-width: 250px; padding: 4px;
}
.combo-list .combo-hint { margin: 0 0 4px; padding: 5px 9px 7px; font-size: 12px; color: var(--muted); border-bottom: 1px solid var(--line); white-space: nowrap; }
.combo-list div { padding: 6px 9px; cursor: pointer; display: flex; gap: 9px; white-space: nowrap; border-radius: 5px; }
.combo-list div b { color: var(--accent); font-family: var(--display); font-weight: 700; min-width: 44px; }
.combo-list div small { color: var(--muted); margin-left: auto; }
.combo-list div.act, .combo-list div:hover { background: var(--sel); }
.combo-list div.combo-new { color: var(--accent); font-weight: 700; }
.combo-list div.combo-new + div, .combo-list div + div.combo-new { margin-top: 2px; }
.combo-list div[data-k] + div.combo-new { border-top: 1px solid var(--line); border-radius: 0 0 5px 5px; }

/* ---------- 홈 ---------- */
/* 첫 화면: 메뉴 칸은 글자 폭만큼(176px)만, 한 줄에 여섯 개. 오른쪽에 요약 숫자. 가로·세로 여백을 줄여 한눈에 */
.home-grid { display: grid; grid-template-columns: minmax(0, 1106px) 340px; gap: 18px; justify-content: center; align-items: start; }
.menu-grid { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-start; }
.menu-col { width: 176px; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.menu-col h3 { position: relative; margin: 0; background: var(--hd); color: var(--hd-ink); padding: 7px 12px 8px; font-size: 13.5px; font-weight: 800; display: flex; align-items: center; gap: 7px; }
.menu-col h3::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: var(--ul, var(--lime)); }
.menu-col:nth-child(3n+1) { --ul: var(--lime); } .menu-col:nth-child(3n+2) { --ul: var(--sky); } .menu-col:nth-child(3n) { --ul: var(--amber); }
.menu-col h3 .ic { font-size: 13px; color: var(--ul); width: 14px; text-align: center; }
.menu-col a { display: flex; align-items: center; padding: 4px 12px; border-bottom: 1px solid var(--line-2); color: var(--text); font-size: 13px; white-space: nowrap; transition: background .15s, padding .15s; }
.menu-col a:last-child { border-bottom: 0; }
.menu-col a::after { content: "→"; margin-left: auto; color: var(--muted); opacity: 0; transition: opacity .15s; }
.menu-col a:hover { background: var(--hover); color: var(--ink); padding-left: 15px; }
.menu-col a:hover::after { opacity: 1; }
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 10px; }
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 7px 11px; }
.kpi small { color: var(--muted); display: block; font-size: 11.5px; font-weight: 600; margin-bottom: 1px; }
.kpi b { font-family: var(--display); font-size: 17px; font-weight: 800; color: var(--ink); font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.kpi b.neg { color: var(--red); }
.chart svg { width: 100%; height: auto; display: block; }
.chart text { fill: var(--muted); font-family: var(--display); }
.chart .grid { stroke: var(--line-2); }
.chart .zero { stroke: var(--line); }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; vertical-align: -1px; }
.bars div { display: grid; grid-template-columns: 112px 1fr 92px; gap: 10px; align-items: center; font-size: 13px; padding: 4px 0; }
.bars .bar { height: 8px; background: var(--line-2); border-radius: 4px; overflow: hidden; }
.bars .bar span { display: block; height: 100%; background: var(--accent); border-radius: 4px; }
.notice { border: 1px solid color-mix(in srgb, var(--amber) 70%, var(--line)); border-left: 4px solid var(--amber); background: color-mix(in srgb, var(--amber) 14%, var(--panel)); padding: 11px 14px; border-radius: 8px; font-size: 13px; margin-bottom: 12px; color: var(--text); }
.notice.ok { border-color: color-mix(in srgb, var(--lime) 80%, var(--line)); border-left-color: var(--green); background: color-mix(in srgb, var(--lime) 18%, var(--panel)); }
.notice b { display: block; margin-bottom: 3px; color: var(--ink); }
.notice a { color: var(--accent) !important; }

/* ---------- 부가세 신고서 ---------- */
.vatform td.no { width: 50px; text-align: center; color: var(--muted); font-family: var(--display); }
.vatform td.lbl { padding-left: 12px; }

/* ---------- 알림 · 모달 ---------- */
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(20px); background: var(--hd); color: var(--hd-ink); border: 1px solid var(--hd-line); border-left: 3px solid var(--lime); padding: 11px 18px; border-radius: 8px; opacity: 0; transition: .2s; pointer-events: none; z-index: 100; max-width: 90vw; font-weight: 600; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.err { border-left-color: #ff6b7d; }
.modal { position: fixed; inset: 0; background: rgba(5, 5, 6, .55); display: grid; place-items: center; z-index: 90; }
.modal[hidden] { display: none; }
.modal-box { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; width: min(860px, 94vw); max-height: 88vh; overflow: auto; }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 13px 18px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--panel); color: var(--ink); }
.modal-head .x { border: 0; background: none; font-size: 22px; cursor: pointer; color: var(--muted); }
#modalBody { padding: 16px 18px; }

/* ---------- 새 창(원장 조회 등) ---------- */
body.popup .topbar { display: none; }
body.popup .app { max-width: none; padding: 14px; }
.pop-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; background: var(--hd); color: var(--hd-ink); margin: -14px -14px 14px; padding: 12px 16px; border-bottom: 3px solid; border-image: linear-gradient(90deg, var(--lime) 0 33.3%, var(--sky) 33.3% 66.6%, var(--amber) 66.6%) 1; }
.pop-head h1 { font-size: 17px; margin: 0 8px 0 0; }
.pop-head .sub { color: var(--hd-muted); font-size: 13px; }
.pop-head .in { background: var(--hd-2); border-color: var(--hd-line); color: var(--hd-ink); }
.pop-head .btn { background: var(--hd-3); border-color: var(--hd-line); color: var(--hd-ink); }
.acct-block + .acct-block { margin-top: 16px; }
.acct-block h3 { margin: 0 0 6px; font-size: 14px; color: var(--ink); }

@media (max-width: 1100px) {
  .entry-grid, .home-grid { grid-template-columns: 1fr; }
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .mainnav { overflow-x: auto; scrollbar-width: none; }
}
@media (max-width: 640px) {
  .topbar { height: auto; flex-wrap: wrap; padding: 10px 14px 0; gap: 10px; }
  .mainnav { order: 3; width: 100%; height: 44px; }
  .app { padding: 14px; }
  .menu-grid { grid-template-columns: 1fr; }
  .brand-text small, .live span { display: none; }
  .paper { padding: 20px 16px; }
}
@media print {
  .topbar, .toolbar, .no-print { display: none !important; }
  body { background: #fff; }
  .app { padding: 0; max-width: none; }
  .tbl-wrap { max-height: none; overflow: visible; }
  .paper, .panel { border: 0; padding: 0; }
  table.t thead th { position: static; }
}

/* ---------- 회원제(웹): 로그인하지 않았을 때의 첫 화면 · 내 정보 메뉴 (js/auth.js) ---------- */
body.is-guest .topbar, body.is-guest .app { display: none; }
.guest[hidden] { display: none; }
.guest { min-height: 100vh; display: flex; flex-direction: column; color: var(--text); font-family: var(--ko); }
/* 맨 위 로그인 줄: 아이디 · 비밀번호 · 로그인 | 회원가입 | 비밀번호찾기 */
.g-bar { display: flex; align-items: center; gap: 18px; min-height: 60px; padding: 10px 22px; background: var(--hd); color: var(--hd-ink); border-bottom: 1px solid var(--hd-line); }
.g-note { color: var(--hd-muted); font-size: 12px; white-space: nowrap; }
.g-login { margin-left: auto; display: flex; align-items: center; gap: 7px; flex-wrap: wrap; justify-content: flex-end; }
.g-login input:not([type="checkbox"]) { width: 150px; height: 34px; padding: 0 12px; border: 1px solid var(--hd-line); border-radius: 17px; background: var(--hd-2); color: var(--hd-ink); font-size: 13px; }
.g-login input:not([type="checkbox"])::placeholder { color: var(--hd-muted); }
.g-login input:not([type="checkbox"]):focus { outline: none; border-color: var(--sky); box-shadow: 0 0 0 3px rgba(116, 228, 240, .18); }
.g-go { height: 34px; padding: 0 16px; border: 0; border-radius: 6px; background: var(--lime); color: #0c0d0f; font-weight: 800; font-size: 13px; cursor: pointer; white-space: nowrap; }
.g-go:hover { background: var(--sky); }
.g-go:disabled { opacity: .5; cursor: default; }
.g-keep { display: flex; align-items: center; gap: 4px; font-size: 12px; color: var(--hd-muted); white-space: nowrap; cursor: pointer; }
.g-links { display: flex; align-items: center; gap: 10px; font-size: 13px; white-space: nowrap; }
.g-links i { font-style: normal; color: var(--hd-line); }
.g-links a { color: var(--hd-ink); }
.g-links a:hover { color: var(--lime); text-decoration: underline; }
.g-main { flex: 1; width: min(1080px, 100%); margin: 0 auto; padding: 64px 22px 40px; }
.g-eyebrow { margin: 0 0 14px; font-family: var(--display); font-stretch: 115%; font-weight: 700; font-size: 12px; letter-spacing: .14em; color: var(--accent); }
.g-hero h1 { margin: 0; font-size: clamp(28px, 4.6vw, 46px); line-height: 1.22; font-weight: 800; letter-spacing: -.02em; color: var(--ink); }
.g-lead { max-width: 640px; margin: 20px 0 0; font-size: 16px; line-height: 1.75; color: var(--text); }
.g-cta { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-top: 28px; }
.btn.g-big { padding: 11px 26px; font-size: 15px; font-weight: 800; border-radius: 8px; }
.g-feats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0; margin-top: 64px; border-top: 2px solid var(--ink); }
.g-feat { padding: 18px 18px 6px 0; }
.g-feat + .g-feat { padding-left: 18px; border-left: 1px solid var(--line); }
.g-no { font-family: var(--display); font-weight: 800; font-size: 12px; letter-spacing: .08em; color: var(--muted); }
.g-feat b { display: block; margin: 6px 0 8px; font-size: 16px; font-weight: 800; color: var(--ink); }
.g-feat p { margin: 0; font-size: 13px; line-height: 1.7; color: var(--muted); }
.g-foot { padding: 18px 22px 26px; text-align: center; font-size: 12px; color: var(--muted); border-top: 1px solid var(--line); }
/* 가입 · 비밀번호 변경 · 탈퇴 창 */
.modal-box:has(.g-form) { width: min(560px, 94vw); }
.g-form { padding: 18px; font-size: 13px; line-height: 1.7; color: var(--text); }
.g-form label.fld > .in { height: 36px; }
.g-terms { margin-top: 12px; border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; background: var(--panel-2); }
.g-terms summary { cursor: pointer; font-weight: 700; color: var(--ink); }
.g-terms :is(ol, ul) { margin: 8px 0 4px; padding-left: 18px; color: var(--text); font-size: 12px; }
.g-terms li + li { margin-top: 4px; }
.g-agree { display: flex; align-items: center; gap: 7px; margin-top: 14px; font-weight: 700; color: var(--ink); cursor: pointer; }
.g-err { margin: 12px 0 0; padding: 8px 12px; border-radius: 6px; border: 1px solid color-mix(in srgb, var(--red) 45%, var(--line)); background: color-mix(in srgb, var(--red) 9%, var(--panel)); color: var(--red); font-weight: 700; }
.g-err[hidden] { display: none; }
.g-actions { margin-top: 16px; display: flex; justify-content: flex-end; }
/* 머리글 오른쪽의 아이디 ▾ */
.user-wrap { position: relative; }
.user-wrap[hidden] { display: none; }
.user-wrap .theme-btn span { max-width: 110px; overflow: hidden; text-overflow: ellipsis; }
.user-menu { left: auto; right: 0; min-width: 200px; }
.user-menu .user-leave { color: var(--hd-muted); }
body.popup .user-wrap { display: none; }
@media (max-width: 1240px) { .g-note { display: none; } }
@media (max-width: 900px) {
  .g-feats { grid-template-columns: repeat(2, 1fr); }
  .g-feat:nth-child(3) { padding-left: 0; border-left: 0; }
  .g-feat:nth-child(n+3) { border-top: 1px solid var(--line); }
}
@media (max-width: 640px) {
  .g-bar { flex-wrap: wrap; gap: 10px; padding: 12px 16px; }
  .g-login { margin-left: 0; width: 100%; justify-content: flex-start; }
  .g-login input:not([type="checkbox"]) { flex: 1 1 120px; width: auto; min-width: 0; }
  .g-main { padding: 36px 16px 28px; }
  .g-feats { grid-template-columns: 1fr; margin-top: 40px; }
  .g-feat, .g-feat + .g-feat { padding: 16px 0 6px; border-left: 0; }
  .g-feat + .g-feat { border-top: 1px solid var(--line); }
  .g-form .form-grid > .fld { grid-column: span 6; }
}
@media print { .guest { display: none; } }
