/* 천년경영 웹 — 기본 스타일
   색: 거래명세표 양식의 파란 인쇄선에서 가져온 브랜드 블루 하나만 강조로 쓴다. */
:root {
  --ink: #17212b;
  --muted: #5b6775;
  --line: #d3d9e0;
  --paper: #ffffff;
  --field: #f4f6f8;
  --brand: #1c64a8;
  --brand-dark: #144d84;
  --slip-line: #6f9fd0;
  --slip-bg: #f7fafd;
  --error: #b42318;
  --error-bg: #fef3f2;
  --radius: 6px;
  --font: "IBM Plex Sans KR", "Malgun Gothic", "Apple SD Gothic Neo", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--paper);
  word-break: keep-all;
}
h1 { font-size: 1.6rem; line-height: 1.3; font-weight: 600; margin: 0 0 .4rem; }
p { margin: 0; }
:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; }
[hidden] { display: none !important; }

.wordmark { font-weight: 600; font-size: 1.15rem; color: var(--brand); letter-spacing: .02em; }
.wordmark-sm { font-size: 1rem; }

/* ── 로그인 레이아웃 ───────────────────────── */
.auth-layout {
  min-height: 100%;
  display: grid;
  grid-template-columns: minmax(320px, 44fr) 56fr;
}

/* 왼쪽: 거래명세표 머리 */
.slip {
  background: var(--slip-bg);
  border-right: 1px solid var(--line);
  padding: 48px clamp(28px, 5vw, 72px);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 32px;
}
.slip-table {
  width: 100%;
  max-width: 440px;
  border-collapse: collapse;
  border: 2px solid var(--slip-line);
  color: var(--brand-dark);
  background: var(--paper);
}
.slip-table caption {
  caption-side: top;
  text-align: left;
  font-size: .85rem;
  color: var(--muted);
  padding-bottom: 8px;
}
.slip-table th, .slip-table td {
  border: 1px solid var(--slip-line);
  padding: 12px 14px;
  text-align: left;
  vertical-align: middle;
}
.slip-table th {
  width: 6.5em;
  font-weight: 500;
  font-size: .9rem;
  background: #edf4fb;
  letter-spacing: .3em;
}
.slip-name { font-size: 1.75rem; font-weight: 600; color: var(--ink); line-height: 1.25; }
.slip-code { font-variant-numeric: tabular-nums; color: var(--ink); }
.slip-empty td { height: 3.1rem; }
.slip-foot { font-size: .85rem; color: var(--muted); }

/* 오른쪽: 입력 */
.auth-panel {
  padding: 48px clamp(28px, 6vw, 96px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  max-width: 520px;
}
.lead { color: var(--muted); margin-bottom: 28px; }
.help { color: var(--muted); font-size: .875rem; margin-top: 24px; }

.form { display: grid; gap: 18px; }
.field { display: grid; gap: 6px; }
.field label { font-weight: 500; font-size: .9rem; }
.field input {
  font: inherit;
  height: 46px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--field);
  color: var(--ink);
  width: 100%;
}
.field input:hover { border-color: #b6c0cb; }
.field input:focus { background: var(--paper); border-color: var(--brand); outline: none; box-shadow: 0 0 0 3px rgba(28,100,168,.18); }
.field input[aria-invalid="true"] { border-color: var(--error); }
.field-hint { font-size: .8rem; color: var(--muted); }
#caps-hint { color: var(--brand-dark); font-weight: 500; }
.field-error { font-size: .8rem; color: var(--error); }

.pw-wrap { position: relative; }
.pw-wrap input { padding-right: 76px; }
.pw-toggle {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  font: inherit; font-size: .8rem;
  border: 0; background: transparent; color: var(--brand);
  padding: 6px 10px; border-radius: 4px; cursor: pointer;
}
.pw-toggle:hover { background: #e8f0f8; }

.check { display: flex; align-items: center; gap: 8px; font-size: .9rem; cursor: pointer; width: fit-content; }
.check input { width: 18px; height: 18px; accent-color: var(--brand); margin: 0; }

.btn-primary {
  font: inherit; font-weight: 600;
  height: 48px; border: 0; border-radius: var(--radius);
  background: var(--brand); color: #fff; cursor: pointer;
  margin-top: 4px;
}
.btn-primary:hover { background: var(--brand-dark); }

.notice { border-radius: var(--radius); padding: 12px 14px; margin-bottom: 20px; font-size: .9rem; }
.notice-error { background: var(--error-bg); color: var(--error); border: 1px solid #f5c2bd; }

/* ── 로그인 후 첫 화면 ───────────────────────── */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 12px 24px; border-bottom: 1px solid var(--line); background: var(--paper);
}
.who { display: flex; align-items: center; gap: 14px; font-size: .9rem; flex-wrap: wrap; }
.who-company { font-weight: 600; }
.who-office, .who-name { color: var(--muted); }
.who form { margin: 0; }
.btn-quiet {
  font: inherit; font-size: .85rem; background: transparent; color: var(--ink);
  border: 1px solid var(--line); border-radius: var(--radius); padding: 5px 12px; cursor: pointer;
}
.btn-quiet:hover { border-color: var(--muted); }

.home { max-width: 760px; margin: 0 auto; padding: 48px 24px; }
.steps { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.step {
  display: grid; grid-template-columns: 44px 1fr auto; align-items: center; gap: 16px;
  padding: 16px 4px; border-bottom: 1px solid var(--line);
}
.step-no {
  width: 32px; height: 32px; border-radius: 50%; border: 2px solid var(--slip-line);
  color: var(--brand-dark); display: grid; place-items: center; font-weight: 600; font-size: .9rem;
}
.step-body { display: grid; }
.step-body span { color: var(--muted); font-size: .875rem; }
.step-state { font-size: .8rem; color: var(--muted); }

/* ── 좁은 화면 ───────────────────────────── */
@media (max-width: 820px) {
  .auth-layout { grid-template-columns: 1fr; }
  .slip { border-right: 0; border-bottom: 1px solid var(--line); padding: 24px; gap: 16px; }
  .slip-table tr:not(:first-child), .slip-foot { display: none; }
  .slip-name { font-size: 1.3rem; }
  .auth-panel { padding: 32px 24px 48px; max-width: none; justify-content: flex-start; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* ── 업무 화면 공통 ───────────────────────── */
body.app { background: var(--paper); }
a { color: var(--brand); }
.topbar .wordmark { text-decoration: none; }
.shell { display: grid; grid-template-columns: 200px 1fr; min-height: calc(100% - 53px); }
.sidenav { border-right: 1px solid var(--line); padding: 20px 12px; display: flex; flex-direction: column; gap: 2px; background: var(--slip-bg); }
.sidenav a, .sidenav-off { display: block; padding: 7px 12px; border-radius: var(--radius); font-size: .92rem; text-decoration: none; color: var(--ink); }
.sidenav a:hover { background: #e8f0f8; }
.sidenav a[aria-current="page"] { background: var(--brand); color: #fff; font-weight: 500; }
.sidenav-off { color: #9aa5b1; }
.sidenav-group { font-size: .78rem; color: var(--muted); padding: 16px 12px 4px; }
.content { padding: 28px 32px 64px; min-width: 0; }
.content .home { padding: 20px 0; margin: 0; }
.step-body a { color: var(--ink); text-decoration: none; }
.step-body a:hover { color: var(--brand); }

.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head h1 { margin: 0; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.back { font-size: .85rem; text-decoration: none; display: inline-block; margin-bottom: 4px; }
.back::before { content: "‹ "; }
.btn-primary.btn-sm, .btn-quiet { display: inline-flex; align-items: center; height: 36px; padding: 0 14px; font-size: .9rem; text-decoration: none; margin: 0; }
.btn-primary.btn-sm { color: #fff; }
.btn-quiet { color: var(--ink); background: var(--paper); }
.btn-danger { font: inherit; font-size: .9rem; height: 36px; padding: 0 14px; border-radius: var(--radius); border: 1px solid #f5c2bd; background: var(--paper); color: var(--error); cursor: pointer; }
.btn-danger:hover { background: var(--error-bg); }
.link-danger { font: inherit; font-size: .82rem; background: none; border: 0; color: var(--error); cursor: pointer; padding: 2px 4px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); font-size: .9rem; }

.messages { margin-bottom: 16px; }
.messages .notice { margin-bottom: 8px; }
.notice-ok { background: #eef6ee; color: #1e5a2a; border: 1px solid #c6e2c9; }

/* 조회 조건 */
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 16px; }
.filters input[type="search"], .filters input[type="text"], .filters input[type="number"], .filters select,
.form-grid input:not([type="checkbox"]), .form-grid select, .form-grid textarea {
  font: inherit; font-size: .92rem; height: 38px; padding: 0 10px;
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); color: var(--ink);
}
.filters input[type="search"] { width: min(340px, 100%); }
.input-short { width: 80px; }
.form-grid textarea { height: auto; padding: 8px 10px; resize: vertical; }
.filters :focus, .form-grid :focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(28,100,168,.18); }

/* 목록 표 */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); }
.grid { width: 100%; border-collapse: collapse; font-size: .88rem; white-space: nowrap; }
.grid th, .grid td { padding: 9px 12px; border-bottom: 1px solid #e6eaef; text-align: left; }
.grid thead th { background: #edf4fb; color: var(--brand-dark); font-weight: 500; border-bottom: 1px solid var(--slip-line); position: sticky; top: 0; }
.grid tbody tr:hover { background: #f7fafd; }
.grid tfoot th, .grid tfoot td { background: var(--slip-bg); font-weight: 600; border-bottom: 0; border-top: 1px solid var(--slip-line); }
.grid td a { color: var(--ink); font-weight: 500; text-decoration: none; }
.grid td a:hover { color: var(--brand); text-decoration: underline; }
.num { text-align: right !important; font-variant-numeric: tabular-nums; }
.mono { font-variant-numeric: tabular-nums; color: #3b4652; }
.sub { color: var(--muted); font-size: .8rem; margin-left: 6px; }
.row-dim td { color: #8a95a1; }
.row-dim td a { color: #8a95a1; }
.tag { font-size: .75rem; padding: 2px 8px; border-radius: 10px; background: #eef1f4; color: var(--muted); }
.pager { display: flex; gap: 16px; justify-content: center; padding: 16px; font-size: .9rem; }
.empty { border: 1px dashed var(--line); border-radius: var(--radius); padding: 48px 24px; text-align: center; display: grid; gap: 16px; justify-items: center; color: var(--muted); }

/* 등록 화면 */
.balance { display: flex; gap: 24px; margin: 0; }
.balance div { text-align: right; }
.balance dt { font-size: .8rem; color: var(--muted); }
.balance dd { margin: 0; font-weight: 600; font-variant-numeric: tabular-nums; font-size: 1.1rem; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 20px; overflow-x: auto; }
.tabs button { font: inherit; font-size: .92rem; background: none; border: 0; border-bottom: 2px solid transparent; padding: 10px 16px; color: var(--muted); cursor: pointer; white-space: nowrap; margin-bottom: -1px; }
.tabs button[aria-selected="true"] { color: var(--brand-dark); border-bottom-color: var(--brand); font-weight: 600; }
.tabs .dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--error); margin-left: 6px; vertical-align: middle; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px 20px; max-width: 980px; }
.form-grid .field { gap: 5px; align-content: start; }
.form-grid .field label { font-size: .85rem; }
.form-grid .field-wide { grid-column: span 2; }
.form-grid input:not([type="checkbox"]), .form-grid select, .form-grid textarea { width: 100%; }
.form-grid input[readonly] { background: var(--field); }
.field-check { align-self: end; padding-bottom: 8px; }
.req { color: var(--error); }
.inline { display: flex; gap: 6px; }
.inline input { flex: 1; min-width: 0; }
.form-actions { display: flex; gap: 8px; margin-top: 28px; padding-top: 20px; border-top: 1px solid var(--line); max-width: 980px; }
.danger-zone { margin-top: 48px; max-width: 980px; padding: 16px; border: 1px solid #f5c2bd; border-radius: var(--radius); display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; font-size: .9rem; color: var(--muted); }

/* 분류 관리 */
.cat-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 24px; max-width: 900px; margin-top: 8px; }
.cat-cols h2 { font-size: 1rem; margin: 0 0 8px; color: var(--brand-dark); }
.cat-list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.cat-list li { display: flex; justify-content: space-between; align-items: center; padding: 8px 4px; border-bottom: 1px solid #e6eaef; font-size: .92rem; }
.cat-list form { margin: 0; }

@media (max-width: 820px) {
  .shell { grid-template-columns: 1fr; }
  .sidenav { flex-direction: row; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--line); padding: 8px; }
  .sidenav-group, .sidenav-off { display: none; }
  .sidenav a { white-space: nowrap; }
  .content { padding: 20px 16px 48px; }
  .form-grid .field-wide { grid-column: auto; }
}

/* ── 상품 ───────────────────────────── */
.h1-sub { font-size: 1rem; font-weight: 400; color: var(--muted); margin-left: 6px; }
.table-note { font-size: .85rem; color: var(--muted); margin: -4px 0 10px; }
.neg { color: var(--error) !important; }
.grid-input td { padding: 6px 8px; vertical-align: top; }
.grid-input th[scope="row"] { font-weight: 500; padding-top: 14px; vertical-align: top; }
.grid-input input { font: inherit; font-size: .9rem; height: 36px; width: 100%; min-width: 96px; padding: 0 8px;
  border: 1px solid var(--line); border-radius: var(--radius); text-align: right; font-variant-numeric: tabular-nums; }
.grid-input input[name$="_place"] { text-align: left; min-width: 120px; }
.grid-input input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(28,100,168,.18); }
.grid-input td[data-margin] { padding-top: 14px; }
.form-grid-3 { grid-template-columns: repeat(3, minmax(200px, 1fr)); max-width: 760px; }
.tree-wrap { max-width: 640px; border-top: 1px solid var(--line); }
.tree { list-style: none; margin: 0; padding: 0; }
.tree .tree { padding-left: 28px; border-left: 1px dashed var(--slip-line); margin-left: 12px; }
.tree-row { display: flex; justify-content: space-between; align-items: center; padding: 8px 4px; border-bottom: 1px solid #e6eaef; font-size: .92rem; }
.tree-row form { margin: 0; }
.tree-level { display: inline-grid; place-items: center; width: 22px; height: 22px; border: 1px solid var(--slip-line); border-radius: 4px;
  font-size: .72rem; color: var(--brand-dark); margin-right: 10px; }
@media (max-width: 820px) { .form-grid-3 { grid-template-columns: 1fr; } }

/* ── 전표 ───────────────────────────── */
.keys { font-size: .8rem; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.seg a { padding: 0 12px; height: 36px; display: inline-flex; align-items: center; font-size: .88rem; color: var(--ink); text-decoration: none; border-right: 1px solid var(--line); }
.seg a:last-child { border-right: 0; }
.seg a[aria-current="true"] { background: var(--brand); color: #fff; }
.filters input[type="date"] { font: inherit; font-size: .92rem; height: 38px; padding: 0 8px; border: 1px solid var(--line); border-radius: var(--radius); }
.summary { display: flex; flex-wrap: wrap; gap: 8px 32px; margin: 0 0 16px; padding: 14px 18px; background: var(--slip-bg); border: 1px solid var(--line); border-radius: var(--radius); }
.summary dt { font-size: .78rem; color: var(--muted); }
.summary dd { margin: 0; font-variant-numeric: tabular-nums; font-weight: 500; }
.summary dd.strong { font-weight: 700; color: var(--brand-dark); }

.slip-head { display: grid; grid-template-columns: 1fr auto; gap: 24px; align-items: start; margin-bottom: 16px; }
.slip-fields { display: grid; grid-template-columns: 160px minmax(240px, 1.4fr) 160px 1fr; gap: 12px 16px; }
.slip-fields .field label { font-size: .85rem; }
.slip-fields input, .slip-fields select { font: inherit; font-size: .92rem; height: 40px; padding: 0 10px; width: 100%;
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); color: var(--ink); }
.slip-fields :focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(28,100,168,.18); }
input.picked { background: #f2f7fc !important; border-color: var(--slip-line) !important; font-weight: 500; }

/* 거래처 잔액: 장부식 */
.ledger { margin: 0; min-width: 260px; border: 2px solid var(--slip-line); border-radius: 2px; background: var(--paper); }
.ledger div { display: flex; justify-content: space-between; gap: 24px; padding: 6px 14px; border-bottom: 1px solid #dbe6f2; }
.ledger dt { font-size: .82rem; color: var(--brand-dark); letter-spacing: .1em; }
.ledger dd { margin: 0; font-variant-numeric: tabular-nums; }
.ledger .ledger-after { background: #edf4fb; border-bottom: 0; }
.ledger .ledger-after dd { font-weight: 700; font-size: 1.05rem; }
.ledger-note { font-size: .78rem; color: var(--muted); padding: 6px 14px; border-top: 1px solid #dbe6f2; min-height: 1.6em; }
.ledger.over { border-color: var(--error); }
.ledger.over .ledger-after { background: var(--error-bg); }
.ledger.over .ledger-after dd { color: var(--error); }

/* 자동완성 */
.ac { position: relative; }
.ac-list { position: absolute; z-index: 20; left: 0; top: calc(100% + 2px); min-width: 100%; width: max-content; max-width: 520px;
  margin: 0; padding: 4px 0; list-style: none; background: var(--paper); border: 1px solid var(--slip-line); border-radius: var(--radius);
  box-shadow: 0 6px 18px rgba(23,33,43,.12); max-height: 320px; overflow-y: auto; }
.ac-list li { display: grid; grid-template-columns: 1fr auto; column-gap: 16px; padding: 7px 12px; cursor: pointer; font-size: .88rem; }
.ac-list li[aria-selected="true"] { background: #e8f0f8; }
.ac-list .ac-sub { grid-column: 1; color: var(--muted); font-size: .78rem; }
.ac-list .ac-right { grid-column: 2; grid-row: 1 / span 2; align-self: center; text-align: right; font-variant-numeric: tabular-nums; }
.ac-list .ac-right small { display: block; color: var(--muted); font-size: .72rem; }
.ac-list .ac-empty { color: var(--muted); cursor: default; }

/* 품목 표 */
.lines { white-space: nowrap; }
.lines td { padding: 4px 6px; vertical-align: middle; }
.lines thead th { padding: 8px 6px; }
.lines input, .lines select { font: inherit; font-size: .88rem; height: 34px; width: 100%; padding: 0 8px;
  border: 1px solid transparent; border-radius: 4px; background: transparent; color: var(--ink); }
.lines tbody tr:hover input, .lines tbody tr:hover select { border-color: var(--line); }
.lines input:focus, .lines select:focus { outline: none; border-color: var(--brand); background: var(--paper); box-shadow: 0 0 0 2px rgba(28,100,168,.18); }
.lines .c-qty input, .lines .c-price input { text-align: right; font-variant-numeric: tabular-nums; }
.lines .c-no { width: 32px; text-align: center; color: var(--muted); }
.lines .c-type { width: 76px; }
.lines .c-product { min-width: 220px; width: 26%; }
.lines .c-qty { width: 90px; } .lines .c-price { width: 110px; } .lines .c-remarks { min-width: 120px; }
.lines .c-spec { color: #3b4652; font-size: .85rem; }
.lines tr.row-return td { background: #fff7f6; }
.row-del { font: inherit; border: 0; background: none; color: #9aa5b1; width: 28px; height: 28px; border-radius: 4px; cursor: pointer; font-size: 1.1rem; }
.row-del:hover { color: var(--error); background: var(--error-bg); }
.add-line { margin-top: 8px; }

@media (max-width: 1100px) {
  .slip-head { grid-template-columns: 1fr; }
  .slip-fields { grid-template-columns: 1fr 1fr; }
}

/* ── 수금/지불 ───────────────────────────── */
.method-bar { display: grid; grid-template-columns: repeat(5, minmax(110px, 1fr)); gap: 0; margin-bottom: 16px; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.method-bar a { display: grid; gap: 2px; padding: 10px 14px; text-decoration: none; color: var(--ink); border-right: 1px solid var(--line); background: var(--paper); }
.method-bar a:last-child { border-right: 0; }
.method-bar a span { font-size: .8rem; color: var(--muted); }
.method-bar a small { margin-left: 4px; }
.method-bar a strong { font-variant-numeric: tabular-nums; font-weight: 600; }
.method-bar a.is-zero strong { color: #9aa5b1; font-weight: 400; }
.method-bar a[aria-current="true"] { background: #edf4fb; box-shadow: inset 0 -3px 0 var(--brand); }
.method-bar a:hover { background: var(--slip-bg); }
.num-link { color: inherit !important; text-decoration: underline dotted; font-weight: 400 !important; }

.settle-grid { display: grid; grid-template-columns: minmax(0, 720px) auto; gap: 32px; align-items: start; }
.settle-main { display: grid; gap: 18px; }
.settle .field label, .settle legend { font-size: .85rem; font-weight: 500; }
.settle input[type="text"], .settle input[type="date"], .settle select { font: inherit; font-size: .95rem; height: 42px; padding: 0 10px; width: 100%;
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); color: var(--ink); }
.settle :focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(28,100,168,.18); }
.settle .money { text-align: right; font-variant-numeric: tabular-nums; font-size: 1.05rem; }
.row-2 { display: grid; grid-template-columns: 200px 1fr; gap: 16px; }
.row-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.row-2 > .field:only-child, .row-2 .field + .field:not(.methods) { }
fieldset.methods { border: 0; padding: 0; margin: 0; min-width: 0; }
fieldset.methods legend { padding: 0; margin-bottom: 6px; }
.seg-radio label { position: relative; }
.seg-radio input { position: absolute; opacity: 0; }
.seg-radio span { display: inline-flex; align-items: center; height: 42px; padding: 0 16px; font-size: .92rem; border-right: 1px solid var(--line); cursor: pointer; }
.seg-radio label:last-child span { border-right: 0; }
.seg-radio input:checked + span { background: var(--brand); color: #fff; }
.seg-radio input:focus-visible + span { outline: 3px solid var(--brand); outline-offset: -3px; }
.notice-info { background: #edf4fb; color: var(--brand-dark); border: 1px solid #c9dcf0; margin: 0; }
.ledger-note[data-warn="1"] { color: var(--error); }
.ledger-table tr.carry td { background: var(--slip-bg); color: var(--muted); }
.link-quiet { font: inherit; font-size: .82rem; background: none; border: 0; color: var(--brand); cursor: pointer; padding: 2px 4px; }
@media (max-width: 1100px) { .settle-grid { grid-template-columns: 1fr; } .row-2, .row-3 { grid-template-columns: 1fr; } .method-bar { grid-template-columns: repeat(3, 1fr); } }
.settle .field { align-content: start; }
.table-wrap + .table-note { margin-top: 10px; }

/* ── 기존 프로그램식 화면 틀: 상단 메뉴 + 단축버튼 ─────────── */
.appbar { position: sticky; top: 0; z-index: 30; background: var(--paper); border-bottom: 1px solid var(--line); }
.menubar { display: flex; align-items: center; gap: 2px; padding: 0 12px; height: 34px; border-bottom: 1px solid #e6eaef; background: var(--slip-bg); overflow-x: auto; }
.menubar .wordmark { margin-right: 10px; text-decoration: none; white-space: nowrap; }
.menu { position: relative; }
.menu-btn { font: inherit; font-size: .86rem; background: none; border: 0; padding: 0 9px; height: 30px; border-radius: 4px; cursor: pointer; color: var(--ink); white-space: nowrap; text-decoration: none; display: inline-flex; align-items: center; }
.menu-btn:hover, .menu-btn[aria-expanded="true"] { background: #e3edf8; }
.menu-btn .mnemonic { color: var(--muted); font-size: .78rem; margin-left: 1px; }
.menu-link { color: #3b4652; }
.menu-list { position: fixed; margin: 0; padding: 4px 0; list-style: none; min-width: 260px; max-height: calc(100vh - 80px); overflow-y: auto;
  background: var(--paper); border: 1px solid #b9cbe0; border-radius: 4px; box-shadow: 0 8px 24px rgba(23,33,43,.16); z-index: 40; }
.menu-item { display: flex; justify-content: space-between; align-items: center; gap: 18px; width: 100%; padding: 6px 14px; font: inherit; font-size: .88rem;
  color: var(--ink); text-decoration: none; background: none; border: 0; text-align: left; cursor: pointer; }
a.menu-item:hover, button.menu-item:hover, .menu-item:focus { background: var(--brand); color: #fff; outline: none; }
.menu-item kbd { font: inherit; font-size: .75rem; color: var(--muted); }
.menu-item:hover kbd, .menu-item:focus kbd { color: #dce8f5; }
.menu-item.is-off { color: #a3adb8; cursor: default; }
.menu-item.is-off small { font-size: .7rem; color: #b6bec7; }
.menu-sep { height: 1px; background: #e6eaef; margin: 4px 0; }

.toolbar-row { display: flex; align-items: stretch; justify-content: space-between; gap: 12px; padding: 4px 12px; }
.toolbar { display: flex; align-items: stretch; gap: 2px; overflow-x: auto; }
.tool { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; min-width: 60px; padding: 5px 6px 4px;
  border-radius: 4px; color: var(--ink); text-decoration: none; font: inherit; font-size: .76rem; background: none; border: 0; cursor: pointer; white-space: nowrap; }
.tool svg { width: 24px; height: 24px; fill: none; stroke: var(--brand); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.tool:hover { background: #edf4fb; }
.tool[aria-current="page"] { background: #dfeaf6; box-shadow: inset 0 -2px 0 var(--brand); }
.tool.is-off { color: #a3adb8; cursor: default; }
.tool.is-off svg { stroke: #b6bec7; }
.tool-sep { width: 1px; background: var(--line); margin: 6px 4px; }
.who-badge { display: flex; flex-direction: column; justify-content: center; align-items: flex-end; padding: 4px 16px; border-radius: 4px;
  background: linear-gradient(90deg, #e8f1fa, #d6e7f7); color: var(--brand-dark); white-space: nowrap; }
.who-badge strong { font-size: 1.05rem; }
.who-badge span { font-size: .75rem; color: #4d6a88; }
body.app .content { padding: 20px 24px 64px; max-width: none; }

/* 링크형 탭 */
.tabs a { font-size: .92rem; padding: 10px 16px; color: var(--muted); text-decoration: none; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs a[aria-selected="true"], .tabs a[aria-current="page"] { color: var(--brand-dark); border-bottom-color: var(--brand); font-weight: 600; }
.tabs-link { margin-bottom: 14px; }

/* 일일(주간)보고 */
.dash-top { display: grid; grid-template-columns: 1fr 1fr minmax(280px, .8fr); gap: 14px; margin-bottom: 20px; }
.dash-card { border: 2px solid; border-radius: 4px; padding: 12px 14px; background: var(--paper); }
.dash-card h2 { font-size: 1rem; margin: 0 0 8px; }
.dash-card h2::before { content: ""; display: inline-block; width: 6px; height: 6px; background: currentColor; margin-right: 8px; vertical-align: middle; }
.dash-sale { border-color: #7aa7d6; } .dash-sale h2 { color: #3576b5; }
.dash-buy { border-color: #d39b4c; } .dash-buy h2 { color: #b8741a; }
.dash-sum { border-color: #8d97a3; } .dash-sum h2 { color: #1f7a6d; }
.chart-box { position: relative; height: 200px; }
.dash-sum-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.seg-sm a { height: 28px; font-size: .8rem; padding: 0 9px; }
.sum-list { margin: 4px 0 0; }
.sum-list div { display: flex; justify-content: space-between; padding: 7px 4px; border-bottom: 1px solid #e6eaef; }
.sum-list dt { color: #b42318; font-size: .88rem; }
.sum-list dt::before { content: "▫ "; color: #9aa5b1; }
.sum-list dd { margin: 0; font-variant-numeric: tabular-nums; }
.sum-list dd.strong { color: var(--brand); font-weight: 700; }
.sum-list dd.recv { color: #b42318; font-weight: 700; }
.welcome .steps { max-width: 760px; }

/* 보고서 */
.report-block { margin-bottom: 22px; }
.report-block h2 { font-size: .95rem; color: var(--brand-dark); margin: 0 0 8px; }
.report-2col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.closing { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0; margin: 8px 0 0; border: 2px solid var(--slip-line); }
.closing-col { display: grid; grid-template-columns: auto 1fr; border-right: 1px solid #dbe6f2; }
.closing-col:last-child { border-right: 0; }
.closing dt, .closing dd { padding: 7px 12px; border-bottom: 1px solid #e6eaef; margin: 0; }
.closing dt { font-size: .82rem; color: var(--brand-dark); background: var(--slip-bg); }
.closing dd { text-align: right; font-variant-numeric: tabular-nums; }
.closing .em { font-weight: 700; border-bottom: 0; }
.seg-opt { position: relative; }
.seg-opt input { position: absolute; opacity: 0; }
.seg-opt span { display: inline-flex; align-items: center; height: 36px; padding: 0 12px; font-size: .88rem; border-right: 1px solid var(--line); cursor: pointer; }
.seg-opt:last-child span { border-right: 0; }
.seg-opt input:checked + span { background: var(--brand); color: #fff; }
.seg-opt input:focus-visible + span { outline: 3px solid var(--brand); outline-offset: -3px; }
.input-mid { width: 130px; }
.graph-form { margin-bottom: 12px; }
.graph-bases { border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 12px 10px; margin: 0 0 12px; display: flex; flex-wrap: wrap; gap: 4px; }
.graph-bases legend { font-size: .8rem; color: var(--muted); padding: 0 4px; }
.chip { position: relative; }
.chip input { position: absolute; opacity: 0; }
.chip span { display: inline-block; padding: 4px 12px; border-radius: 14px; font-size: .85rem; color: #2f7d8c; cursor: pointer; }
.chip input:checked + span { background: #e3f1f3; color: #1d5f6b; font-weight: 600; box-shadow: inset 0 0 0 1px #9bc9d1; }
.chip input:focus-visible + span { outline: 3px solid var(--brand); }
.graph-card { border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; margin-bottom: 14px; }
.graph-box { position: relative; height: 420px; }
.graph-table { max-height: 360px; overflow-y: auto; }
.cashbook td { padding: 6px 8px; }
.entry-row td { background: #f7fafd; }
.entry-row input, .entry-row select { font: inherit; font-size: .85rem; height: 32px; padding: 0 6px; border: 1px solid var(--line); border-radius: 4px; width: 100%; min-width: 70px; background: var(--paper); }
.entry-row input.money { text-align: right; min-width: 90px; }
.entry-row select:disabled { background: var(--field); color: #9aa5b1; }
.row-actions { display: flex; gap: 6px; align-items: center; }
.row-actions form { margin: 0; }
.row-actions a { font-size: .82rem; }
.form.narrow { max-width: 420px; }
.form.narrow input, .form.narrow select { font: inherit; height: 42px; padding: 0 10px; border: 1px solid var(--line); border-radius: var(--radius); width: 100%; }
.print-only { display: none; }

@media print {
  .appbar, .no-print, .actions, .messages { display: none !important; }
  .print-only { display: block; font-weight: 600; margin-bottom: 8px; }
  body.app .content { padding: 0; }
  .table-wrap { overflow: visible; border: 0; }
  .grid { font-size: 9pt; }
}
@media (max-width: 1100px) {
  .dash-top { grid-template-columns: 1fr; }
  .report-2col, .closing { grid-template-columns: 1fr; }
  .who-badge { display: none; }
}

/* ── 장부 보호 ───────────────────────────── */
.closing-now { border: 2px solid var(--line); border-radius: var(--radius); padding: 16px 20px; margin-bottom: 18px; max-width: 640px; }
.closing-now.is-closed { border-color: var(--slip-line); background: var(--slip-bg); }
.closing-label { font-size: .8rem; color: var(--muted); }
.closing-date { font-size: 1.4rem; font-weight: 700; color: var(--brand-dark); }
.closing-form { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; max-width: 760px; }
.closing-form .field { display: grid; gap: 5px; }
.closing-form .field.grow { flex: 1; min-width: 220px; }
.closing-form input { font: inherit; height: 38px; padding: 0 10px; border: 1px solid var(--line); border-radius: var(--radius); }
.tag-danger { background: var(--error-bg); color: var(--error); }
.diff th[scope="row"] { width: 140px; font-weight: 500; background: var(--slip-bg); }
.diff tr.is-changed td { background: #fff8db; }
tr.is-removed td { background: #fdecea; text-decoration: line-through; color: #8a2a20; }
tr.is-added td { background: #eaf6ec; }
.notice-lock { background: #fff8db; border: 1px solid #ecd58a; color: #6b5300; }
.form-section { margin-bottom: 22px; }
.form-section h2 { font-size: .95rem; color: var(--brand-dark); margin: 0 0 10px; }
.thumb { height: 28px; max-width: 80px; object-fit: contain; vertical-align: middle; }
.image-slots { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; max-width: 980px; }
.image-slot { border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; display: grid; gap: 10px; align-content: start; }
.image-slot img { max-height: 110px; max-width: 220px; object-fit: contain; border: 1px dashed var(--line); padding: 6px; background:
  repeating-conic-gradient(#f0f2f5 0% 25%, #fff 0% 50%) 50% / 14px 14px; }
.image-label { font-weight: 600; font-size: .9rem; }

/* ── 장부식 전표 ───────────────────────────── */
.book { border: 2px solid var(--slip-line); border-radius: 4px; padding: 12px 14px; margin-bottom: 18px; background: var(--paper); }
.book-head { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; margin-bottom: 10px; }
.book-title { font-size: 1rem; margin: 0; color: var(--brand-dark); }
.book-title span { color: var(--ink); margin-left: 6px; }
.book-nav { display: flex; align-items: center; gap: 8px; }
.book-nav .btn-quiet { height: 30px; padding: 0 10px; }
.book-nav strong { min-width: 90px; text-align: center; font-variant-numeric: tabular-nums; }
.book-bal { display: flex; gap: 20px; margin: 0 0 0 auto; }
.book-bal dt { font-size: .75rem; color: var(--muted); }
.book-bal dd { margin: 0; font-weight: 600; font-variant-numeric: tabular-nums; text-align: right; }
.book-sum { font-size: .82rem; }
.book-sum th[scope="row"] { background: var(--slip-bg); width: 60px; }
.book-lines { margin-top: 10px; max-height: 300px; overflow-y: auto; }
.book-lines .grid { font-size: .82rem; }
.book-lines tr.slip-first td { border-top: 1px solid var(--slip-line); }
.book-lines tr.is-current td { background: #fff8db; }
.entry-title { font-size: .95rem; color: var(--brand-dark); margin: 0 0 8px; }
.lines .c-dc { width: 90px; }
.lines .c-dc input { text-align: right; }
