:root {
  --bg: #f2f4f7; --card: #fff; --line: #d9e0e7; --line2: #edf0f4; --text: #16202a; --muted: #62707e;
  --brand: #0b5d7a; --brand-d: #084a61; --brand-l: #e6f2f6;
  --sale: #1558b0; --sale-l: #e8f0fb; --purchase: #b4540a; --purchase-l: #fbf0e4;
  --in: #177245; --in-l: #e5f4ec; --out: #a13a3a; --out-l: #f9e9e9; --danger: #c0392b;
  --radius: 10px; --shadow: 0 1px 2px rgba(16, 32, 48, .06), 0 2px 8px rgba(16, 32, 48, .05);
}
* { box-sizing: border-box; }
html { font-size: 15px; -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text); line-height: 1.5;
  font-family: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Malgun Gothic", "맑은 고딕", "Noto Sans KR", sans-serif;
}
a { color: var(--brand); }
h1, h2, h3 { line-height: 1.3; }
h3 { margin: 0 0 10px; font-size: 16px; }
h3 small { color: var(--muted); font-weight: 400; font-size: 13px; }
.muted { color: var(--muted); font-size: 13px; margin: 6px 0; }
.neg { color: var(--danger); }
.accent { color: var(--brand-d); }
.hide { display: none; }
.boot { padding: 60px 20px; text-align: center; color: var(--muted); }

/* ---------- 입력 · 버튼 ---------- */
input, select, textarea, button { font: inherit; color: inherit; }
input[type=text], input[type=search], input[type=tel], input[type=email], input[type=password], input[type=date], select, textarea {
  height: 38px; width: 100%; min-width: 0; padding: 0 10px; background: #fff; border: 1px solid var(--line); border-radius: 8px;
}
textarea { height: auto; padding: 8px 10px; resize: vertical; }
input:focus, select:focus, textarea:focus, button:focus-visible, a:focus-visible, tr:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
input.num { text-align: right; font-variant-numeric: tabular-nums; }
input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--brand); }
input.picker.picked { border-color: var(--brand); background: var(--brand-l); font-weight: 700; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 38px; padding: 0 14px; white-space: nowrap;
  border: 1px solid var(--line); border-radius: 8px; background: #fff; font-weight: 600; cursor: pointer; text-decoration: none; color: var(--text);
}
.btn:hover { background: #f5f8fa; }
.btn:disabled { opacity: .55; cursor: default; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-d); }
.btn.accent { background: var(--brand-l); border-color: #9fcbd9; color: var(--brand-d); }
.btn.danger { color: var(--danger); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: rgba(16, 32, 48, .06); }
.btn.small { height: 30px; padding: 0 10px; font-size: 13px; }
.btn.big { height: 46px; padding: 0 22px; font-size: 16px; }
.btn.left { margin-right: auto; }
.icon-btn { display: inline-grid; place-items: center; width: 36px; height: 36px; border: 0; background: transparent; border-radius: 8px; cursor: pointer; color: var(--muted); flex: none; }
.icon-btn:hover { background: rgba(16, 32, 48, .08); }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.btn-row.end { justify-content: flex-end; margin-top: 12px; }
.chip { height: 30px; padding: 0 11px; border-radius: 15px; border: 1px solid var(--line); background: #fff; font-size: 13px; cursor: pointer; white-space: nowrap; }
.chip:hover { background: var(--brand-l); border-color: #9fcbd9; }
.inline { display: inline-flex; gap: 6px; align-items: center; font-size: 14px; white-space: nowrap; }
.inline input[type=date] { width: 150px; }

.seg { display: inline-flex; background: #e3e8ed; border-radius: 9px; padding: 3px; gap: 2px; max-width: 100%; overflow-x: auto; }
.seg button { border: 0; background: transparent; height: 32px; padding: 0 12px; border-radius: 7px; font-weight: 600; color: var(--muted); cursor: pointer; white-space: nowrap; }
.seg button.on { background: #fff; color: var(--text); box-shadow: 0 1px 2px rgba(0, 0, 0, .14); }
.seg.tabs button { height: 36px; padding: 0 16px; font-size: 15px; }

.tag { display: inline-block; font-size: 12px; font-weight: 700; padding: 1px 7px; border-radius: 6px; background: #e9edf1; color: #465360; margin-right: 5px; }
.tag.sale { background: var(--sale-l); color: var(--sale); }
.tag.purchase { background: var(--purchase-l); color: var(--purchase); }
.tag.in { background: var(--in-l); color: var(--in); }
.tag.out { background: var(--out-l); color: var(--out); }

/* ---------- 틀 ---------- */
.shell { display: grid; grid-template-columns: 212px minmax(0, 1fr); min-height: 100vh; }
.side { background: var(--side-bg, #0e2a3a); color: #cfdbe3; position: sticky; top: 0; height: 100vh; overflow-y: auto; padding: 14px 10px; display: flex; flex-direction: column; }
.brand { display: flex; gap: 10px; align-items: center; color: #fff; text-decoration: none; padding: 4px 8px 12px; font-weight: 700; font-size: 16px; }
.brand-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.logo { width: 36px; height: 36px; border-radius: 9px; background: #fff; padding: 2px; object-fit: contain; flex: none; }
.nav a { display: block; padding: 9px 12px; border-radius: 8px; color: #d5e0e7; text-decoration: none; font-weight: 600; }
.nav a:hover { background: rgba(255, 255, 255, .09); }
.nav a.on { background: #fff; color: var(--side-on, #0e2a3a); }
.nav-group { font-size: 12px; color: #86a0b0; padding: 14px 12px 4px; }
/* 메뉴 옆 숫자 (미완료 전표 수) */
.nav-badge { float: right; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 11px; background: #e5484d; color: #fff; font-size: 12.5px; font-weight: 700; line-height: 22px; text-align: center; }
.nav-badge[hidden] { display: none; }
.side-note { margin-top: auto; padding: 10px 12px; background: rgba(255, 255, 255, .08); border-radius: 8px; font-size: 13px; font-weight: 600; color: #ffd98a; }
.side-note small { display: block; font-weight: 400; color: #b9c8d2; }
.scrim { display: none; }
.content { min-width: 0; }
.topbar { display: flex; align-items: center; gap: 8px; padding: 18px 24px 2px; }
.page-title { font-size: 22px; margin: 0; }
.page-title.sale { color: var(--sale); }
.page-title.purchase { color: var(--purchase); }
.menu-btn { display: none; font-size: 20px; color: var(--text); }
#main { padding: 10px 24px 70px; max-width: 1340px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); margin-bottom: 14px; }
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 10px 0; }
.toolbar input[type=search] { flex: 1 1 220px; max-width: 340px; }
.range { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.range-inputs { display: inline-flex; gap: 4px; align-items: center; }
.range-inputs input[type=date] { width: 142px; }
.chips { display: inline-flex; gap: 4px; flex-wrap: wrap; }

/* ---------- 표 ---------- */
.table-wrap { overflow-x: auto; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); }
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th { text-align: left; font-weight: 600; color: var(--muted); background: #f6f8fa; padding: 9px 12px; white-space: nowrap; border-bottom: 1px solid var(--line); }
.tbl td { padding: 9px 12px; border-bottom: 1px solid var(--line2); white-space: nowrap; }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl .r { text-align: right; font-variant-numeric: tabular-nums; }
.tbl .c { text-align: center; }
.tbl tr.click { cursor: pointer; }
.tbl tr.click:hover td { background: #f1f7fa; }
.tbl tr.sel td { background: var(--brand-l); }
.tbl tr.carry td { color: var(--muted); background: #fafbfc; }
.tbl tfoot td { font-weight: 700; background: #f6f8fa; border-top: 1px solid var(--line); border-bottom: 0; }
.tbl td.empty { text-align: center; color: var(--muted); padding: 30px 12px; white-space: normal; }

/* 체크 칸과 일괄 작업 막대 (체크하면 표 위에 나타나 화면을 내려도 따라옴) */
.tbl th.pick, .tbl td.pick { width: 42px; padding: 0 4px 0 12px; cursor: pointer; }
.tbl .pick input { display: block; margin: 0; cursor: pointer; }
.tbl tr.picked td { background: #e9f3f7; }
.tbl tr.click.picked:hover td { background: #dcecf2; }
.bulk-bar { position: sticky; top: 8px; z-index: 15; margin: 8px 0; min-height: 48px; }
.bulk-bar.idle { position: static; }
.bulk-bar[hidden], .bulk-bar [hidden] { display: none; }
.bulk-panel { display: flex; flex-wrap: wrap; gap: 6px 8px; align-items: center; min-height: 48px; padding: 8px 8px 8px 14px; background: #0e2a3a; color: #fff; border-radius: 10px; box-shadow: 0 6px 18px rgba(14, 42, 58, .28); }
.bulk-bar.idle .bulk-panel { background: transparent; color: var(--muted); box-shadow: none; padding-left: 2px; font-size: 13px; }
.bulk-bar.idle .bulk-count { display: none; }
.bulk-count { white-space: nowrap; margin-right: 4px; font-variant-numeric: tabular-nums; }
.bulk-actions { display: flex; flex-wrap: wrap; gap: 6px; flex: 1 1 auto; }
.bulk-bar .btn { height: 32px; padding: 0 12px; font-size: 14px; border-color: #fff; }
.bulk-bar .btn.ghost { background: transparent; border-color: transparent; color: #cfdbe3; }
.bulk-bar .btn.ghost:hover { background: rgba(255, 255, 255, .14); }
.btn.danger.solid { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.danger.solid:hover { background: #a93226; }

/* 데이터 초기화 */
.reset-list { display: grid; gap: 8px; margin: 10px 0; }
.reset-row { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; background: #fff; cursor: pointer; }
.reset-row.on { border-color: var(--danger); background: #fdf3f2; }
.reset-row > input { flex: none; margin-top: 3px; }
.reset-row > span { display: grid; gap: 3px; min-width: 0; }
.reset-row small { color: var(--muted); font-size: 13px; }
.reset-row small.warn-text { color: var(--purchase); }
.reset-sub { white-space: normal; margin-top: 4px; font-size: 13px; }
.reset-sample { border-color: #f0d58a; background: #fffaf0; }
.reset-sample p { margin: 4px 0 8px; }
/* 창 안의 글·칸을 일정한 간격으로 쌓음 */
.stack { display: grid; gap: 10px; }
.stack p { margin: 0; }
.stack ul { margin: 0; padding-left: 20px; }
.stack li { margin: 4px 0; }

/* ---------- 폼 · 창 ---------- */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 12px; }
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field > span { font-size: 13px; color: var(--muted); font-weight: 600; }
.field small { color: var(--muted); font-size: 12px; }
.span2 { grid-column: 1 / -1; }
.field.check { flex-direction: row-reverse; justify-content: flex-end; align-items: center; gap: 8px; min-height: 38px; align-self: end; }
.field.check > span { font-size: 14px; color: var(--text); }
details.more { margin-top: 14px; border-top: 1px solid var(--line2); padding-top: 10px; }
details.more summary { cursor: pointer; font-weight: 600; color: var(--brand-d); margin-bottom: 10px; }

.modal-back { position: fixed; inset: 0; background: rgba(15, 25, 35, .45); display: grid; place-items: center; z-index: 60; padding: 14px; }
.modal { background: #fff; border-radius: 14px; width: min(580px, 100%); max-height: calc(100vh - 28px); max-height: calc(100dvh - 28px); display: flex; flex-direction: column; box-shadow: 0 20px 60px rgba(0, 0, 0, .3); }
.modal.wide { width: min(1040px, 100%); }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 12px 12px 18px; border-bottom: 1px solid var(--line2); }
.modal-head h2 { margin: 0; font-size: 17px; }
.modal-body { padding: 16px 18px; overflow: auto; }
.modal-body h3 { margin-top: 18px; }
.modal-foot { display: flex; gap: 8px; justify-content: flex-end; padding: 12px 18px; border-top: 1px solid var(--line2); flex-wrap: wrap; }
.confirm-msg { white-space: pre-line; margin: 0; }
#toasts { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 90; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { background: #1d2b36; color: #fff; padding: 10px 16px; border-radius: 10px; box-shadow: 0 6px 20px rgba(0, 0, 0, .25); max-width: 92vw; }
.toast.err { background: #b3261e; }
.bar { height: 10px; background: #e3e8ed; border-radius: 5px; overflow: hidden; margin-bottom: 8px; }
.bar i { display: block; height: 100%; width: 0; background: var(--brand); transition: width .2s; }

.suggest { position: fixed; z-index: 70; background: #fff; border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 8px 28px rgba(0, 0, 0, .2); overflow: auto; max-width: calc(100vw - 8px); }
.opt { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 8px 12px; cursor: pointer; }
.opt.on { background: var(--brand-l); }
.opt-main b { font-weight: 600; display: block; }
.opt-main small { color: var(--muted); }
.opt-right { color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.opt.create b { color: var(--brand); }

.steps { padding-left: 22px; margin: 0 0 12px; }
.steps li { margin: 8px 0; }
.warn { background: #fff7e0; border: 1px solid #f0d58a; border-radius: 8px; padding: 10px 12px; }
/* 불러오기: 기존 프로그램 잔액과 맞았다는 표시, 이름·단위 정리 내용 */
.ok-note { background: #e9f6ee; border: 1px solid #a9d8ba; border-radius: 8px; padding: 10px 12px; }
.tidy-note details { margin: 4px 0 12px; }
.tidy-note summary { cursor: pointer; color: var(--muted); padding: 4px 0; }
.tidy-note .table-wrap { max-height: 260px; overflow: auto; margin-top: 6px; }
/* 불러오기: 엑셀 등에서 읽은 표마다 종류와 칸의 뜻을 고르는 화면 */
.any-sum .stats { gap: 14px 26px; margin: 4px 0 6px; }
.any-sum .stat span { color: var(--muted); font-size: 13px; }
.any-sum .stat b { font-size: 18px; }
.any-card { padding: 12px 14px; margin: 10px 0; }
.any-head { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.any-head b { overflow-wrap: anywhere; }
.any-head select { margin-left: auto; width: auto; max-width: 100%; }
.any-card .toolbar select { width: auto; }
.any-map { margin-top: 8px; max-width: 100%; overflow-x: auto; }
.any-map th { padding: 6px 8px; }
.any-map select { min-width: 112px; height: 34px; }
.any-map select.on { border-color: #1c6dd0; font-weight: 600; color: #124b94; }
.any-map .any-titles th { background: #fff; color: var(--text); }
.any-map td { white-space: nowrap; max-width: 200px; overflow: hidden; text-overflow: ellipsis; color: var(--muted); font-size: 13px; padding: 5px 8px; }
.any-card .toolbar input[type=text] { width: 160px; }
.tbl td.wrap { white-space: normal; min-width: 260px; }
.tbl td select { min-width: 150px; }

/* ---------- 전체 메뉴 · 추가 조회 ---------- */
.crumb { margin: 2px 0 0; font-size: 13px; }
.crumb a { text-decoration: none; }
.empty-note { text-align: center; color: var(--muted); padding: 34px 12px; background: #fff; border: 1px dashed var(--line); border-radius: var(--radius); }
.menu-group { margin-bottom: 18px; }
.menu-group h3 { margin: 0 0 8px; font-size: 15px; color: var(--brand-d); }
.menu-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 8px; }
.menu-item { display: block; padding: 10px 12px; background: #fff; border: 1px solid var(--line); border-radius: 8px; text-decoration: none; color: var(--text); font-size: 14px; }
.menu-item:hover { border-color: #9fcbd9; background: var(--brand-l); }
.menu-item.main { font-weight: 700; }
.menu-none ul { margin: 0; padding-left: 20px; }
.menu-none li { margin: 6px 0; font-size: 14px; }
.tool-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 12px; margin-bottom: 12px; }
.tool-list .card { margin: 0; }
.tool-list .span-all { grid-column: 1 / -1; }
.card.narrow { max-width: 620px; }
.paste-area { font-family: Consolas, monospace; font-size: 13px; margin: 8px 0; white-space: pre; }
.close-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }
.close-grid h3 { margin: 0 0 6px; font-size: 14px; color: var(--muted); }
.close-grid .field { margin-top: 8px; }
.pnl { max-width: 560px; }
.pnl .head td { font-weight: 700; }
.pnl .sub td { font-weight: 700; background: #f6f8fa; }
.pnl .total td { font-weight: 800; font-size: 16px; background: var(--brand-l); }
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.cal-head { text-align: center; font-size: 13px; font-weight: 700; color: var(--muted); padding: 4px 0; }
.cal-cell { min-height: 84px; background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 5px 7px; display: flex; flex-direction: column; gap: 1px; text-decoration: none; color: var(--text); font-size: 12px; font-variant-numeric: tabular-nums; overflow: hidden; }
.cal-cell.off { background: transparent; border: 0; }
.cal-cell.today { border: 2px solid var(--brand); }
a.cal-cell:hover { background: var(--brand-l); }
.cal-day { font-weight: 700; font-size: 13px; }
.sun { color: var(--danger); }
.cal-cell .sale { color: var(--sale); font-weight: 600; }
.cal-cell .purchase { color: var(--purchase); }
.cal-cell .in { color: var(--in); }
.card-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.card-head h3 { margin: 0; }
.month-nav select { width: auto; }
.price-grid { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 14px; align-items: start; }
.price-grid .card { margin: 0; }
.price-area { font-family: Consolas, "Malgun Gothic", monospace; font-size: 14px; line-height: 1.45; min-height: 300px; white-space: pre; overflow: auto; }
.sec-title { margin: 18px 0 4px; }
.price-sum { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; margin: 8px 0; padding: 10px 12px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); position: sticky; top: 0; z-index: 5; }
.price-sum .btn { margin-left: auto; }
.price-sum b { font-size: 17px; }
.warn-text { color: var(--purchase); }
.tbl tr.off td { opacity: .45; }
.skipped { font-size: 13px; display: grid; gap: 2px; }
.stamp-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.stamp-row img { height: 56px; border: 1px solid var(--line); border-radius: 6px; background: #fff; }

/* ---------- 로그인 ---------- */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.auth { width: min(400px, 100%); display: grid; gap: 12px; padding: 26px; margin: 0; }
.auth h1 { margin: 0; font-size: 21px; }
.auth input { height: 46px; font-size: 16px; }
.auth-msg { color: var(--danger); margin: 0; font-weight: 600; }
.auth-msg:empty { display: none; }

/* ---------- 홈 ---------- */
.hello { margin: 0 0 12px; color: var(--muted); }
.hello b { color: var(--text); font-size: 17px; }
.big-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 14px; }
.big-btn { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 16px 18px; border-radius: 12px; border: 0; color: #fff; cursor: pointer; text-align: left; box-shadow: var(--shadow); }
.big-btn:hover { filter: brightness(1.08); }
.big-btn b { font-size: 18px; }
.big-btn small { opacity: .88; font-size: 13px; }
.big-btn.sale { background: var(--sale); }
.big-btn.purchase { background: var(--purchase); }
.big-btn.in { background: var(--in); }
.big-btn.out { background: #55626d; }
.stats-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 10px; margin-bottom: 14px; }
.stat { display: flex; flex-direction: column; text-decoration: none; color: inherit; }
a.stat.card { margin: 0; padding: 12px 14px; }
a.stat.card:hover { border-color: #9fcbd9; }
.stat span { font-size: 13px; color: var(--muted); }
.stat b { font-size: 19px; font-variant-numeric: tabular-nums; }
.stat.sale b, b.sale { color: var(--sale); }
.stat.purchase b, b.purchase { color: var(--purchase); }
.stat.in b { color: var(--in); }
.stat.strong { border-width: 2px; }

/* ---------- 매출관리: 요약 숫자 · 그래프 ---------- */
.k-sale { --c: #2a78d6; }
.k-purchase { --c: #eb6834; }
.stats-grid.kpi .stat.card { margin: 0; padding: 12px 14px; }
.stats-grid.kpi { grid-template-columns: repeat(auto-fill, minmax(186px, 1fr)); }
.stats-grid.kpi .stat b { font-size: 20px; font-variant-numeric: normal; white-space: nowrap; }
.stats-grid.kpi .stat small { font-size: 12px; color: var(--muted); margin-top: 2px; }
.stats-grid.kpi .stat small.up { color: #006300; }
.stats-grid.kpi .stat small.down { color: #b3261e; }
.chart-card h3 { margin: 0 0 4px; font-size: 15px; display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px; }
.chart-card h3 small { font-weight: 400; font-size: 12px; color: var(--muted); }
.chart-empty { color: var(--muted); text-align: center; padding: 34px 0; margin: 0; }
.chart { --gutter: 52px; margin-top: 8px; }
.chart-plot { position: relative; height: 210px; margin-top: 24px; }
.chart-grid, .chart-cols { position: absolute; left: var(--gutter); right: 0; top: 0; bottom: 0; }
.chart-tick { position: absolute; left: 0; right: 0; border-top: 1px solid var(--line2); }
.chart-tick.base { border-top-color: #b9c3cd; }
.chart-tick span { position: absolute; right: 100%; top: -8px; margin-right: 8px; font-size: 11px; line-height: 16px; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.chart-cols { display: flex; align-items: stretch; }
.chart-col { position: relative; flex: 1 1 0; min-width: 0; display: flex; align-items: flex-end; justify-content: center; padding: 0 1px; outline: 0; border-radius: 4px 4px 0 0; }
.chart-col.click { cursor: pointer; }
.chart-col.on, .chart-col:focus-visible { background: rgba(16, 32, 48, .06); }
.chart-bar { display: block; width: 100%; max-width: 24px; background: var(--c); border-radius: 4px 4px 0 0; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.chart-col.on .chart-bar, .chart-col:focus-visible .chart-bar { filter: brightness(1.15); }
.chart-val { position: absolute; left: 50%; transform: translateX(-50%); margin-bottom: 3px; font-style: normal; font-size: 12px; font-weight: 600; color: var(--text); white-space: nowrap; pointer-events: none; }
.chart-val.l { left: 0; transform: none; }
.chart-val.r { left: auto; right: 0; transform: none; }
.chart-x { display: flex; margin-left: var(--gutter); padding-top: 6px; height: 24px; }
.chart-xl { flex: 1 1 0; min-width: 0; display: flex; justify-content: center; }
.chart-xl span { flex: none; white-space: nowrap; font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.chart-xl.skip span { visibility: hidden; }
.chart-tip { position: fixed; z-index: 60; pointer-events: none; background: #16202a; color: #fff; border-radius: 8px; padding: 8px 10px; font-size: 12px; box-shadow: 0 4px 14px rgba(16, 32, 48, .25); min-width: 130px; }
.chart-tip[hidden] { display: none; }
.chart-tip-title { display: block; color: #c9d3dc; margin-bottom: 4px; }
.chart-tip div { display: flex; justify-content: space-between; gap: 14px; line-height: 1.5; }
.chart-tip div span { color: #c9d3dc; order: 1; }
.chart-tip div b { order: 2; font-weight: 500; font-variant-numeric: tabular-nums; }
.chart-tip div.main b { font-weight: 700; font-size: 14px; }
.hbars { display: grid; gap: 2px; margin-top: 6px; }
.hbar-row { display: grid; grid-template-columns: 22px minmax(90px, 210px) 1fr auto 50px; gap: 10px; align-items: center; width: 100%; padding: 6px; border: 0; border-radius: 6px; background: transparent; font: inherit; color: inherit; text-align: left; }
button.hbar-row { cursor: pointer; }
button.hbar-row:hover, button.hbar-row:focus-visible { background: #f1f7fa; }
.hbar-rank { color: var(--muted); font-size: 12px; text-align: right; font-variant-numeric: tabular-nums; }
.hbar-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar-name small { color: var(--muted); margin-left: 6px; }
.hbar-track { height: 12px; }
.hbar-track i { display: block; height: 100%; min-width: 2px; background: var(--c); border-radius: 0 4px 4px 0; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.hbar-val { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.hbar-pct { color: var(--muted); font-size: 12px; text-align: right; font-variant-numeric: tabular-nums; }
.hbar-rest { color: var(--muted); font-size: 13px; margin: 8px 6px 0; }
.stats-grid.kpi .stat b { overflow: hidden; text-overflow: ellipsis; }
.hbars.compact .hbar-row { grid-template-columns: 18px minmax(0, 1fr) auto 42px; grid-template-areas: "rank name name name" ". track val pct"; row-gap: 3px; column-gap: 8px; }
.hbars.compact .hbar-rank { grid-area: rank; }
.hbars.compact .hbar-name { grid-area: name; }
.hbars.compact .hbar-val { grid-area: val; }
.hbars.compact .hbar-pct { grid-area: pct; }
.hbars.compact .hbar-track { grid-area: track; height: 8px; }
.home-grid { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 3fr); gap: 14px; align-items: start; }
.home-grid .card { margin-bottom: 14px; }
.more-link { font-size: 13px; color: var(--brand); text-decoration: none; white-space: nowrap; }
.more-link:hover { text-decoration: underline; }
@media (max-width: 900px) {
  .home-grid { grid-template-columns: minmax(0, 1fr); gap: 0; }
}
@media (max-width: 560px) {
  .stats-grid.kpi { grid-template-columns: 1fr 1fr; gap: 8px; }
  .stats-grid.kpi .stat.card { padding: 10px; }
  .stats-grid.kpi .stat b { font-size: 15px; }
  .chart { --gutter: 42px; }
  .chart-plot { height: 180px; }
  .hbar-row { grid-template-columns: 18px minmax(0, 1fr) auto 46px; grid-template-areas: "rank name val pct" ". track track track"; row-gap: 3px; }
  .hbar-rank { grid-area: rank; }
  .hbar-name { grid-area: name; }
  .hbar-val { grid-area: val; }
  .hbar-pct { grid-area: pct; }
  .hbar-track { grid-area: track; height: 8px; }
}

/* ---------- 시세 변동: 선 그래프 ---------- */
.linechart { margin-top: 8px; }
.linechart svg { display: block; overflow: visible; }
.lc-grid { stroke: var(--line2); stroke-width: 1; }
.lc-tick { font-size: 11px; fill: var(--muted); font-variant-numeric: tabular-nums; }
.lc-line { fill: none; stroke: var(--c); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.lc-area { fill: var(--c); opacity: .1; }
.lc-dot { fill: var(--c); stroke: #fff; stroke-width: 2; }
.lc-end { font-size: 12px; font-weight: 600; fill: var(--text); }
.lc-cross { stroke: #9aa7b3; stroke-width: 1; }
.lc-hit { cursor: crosshair; }
.spark { display: block; margin-left: auto; }
.spark polyline { fill: none; stroke: #8a97a3; stroke-width: 1.5; stroke-linejoin: round; stroke-linecap: round; }
.spark circle { fill: var(--c); }
.trend-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 12px; margin: 0 0 10px; }
.trend-head h2 { margin: 0; font-size: 19px; }
.trend-head small { color: var(--muted); font-size: 13px; }
.rise, .stats-grid.kpi .stat small.rise { color: #b3261e; }
.fall, .stats-grid.kpi .stat small.fall { color: #177245; }
.chip.on { background: var(--brand); border-color: var(--brand); color: #fff; }

/* ---------- 시세표 이미지 ---------- */
.sheet-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 380px); gap: 14px; align-items: start; }
.sheet-grid .card { margin: 0; }
.sheet-preview { margin-top: 10px; }
.sheet-img { display: block; width: 100%; max-width: 480px; height: auto; margin: 0 auto 14px; border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); }
.sheet-img.wide { max-width: 760px; }
.sheet-opt textarea { min-height: 76px; }
.sheet-opt .groups-area { min-height: 132px; font-size: 13px; line-height: 1.5; }
.sheet-opt .pair { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px; }
@media (max-width: 900px) {
  .sheet-grid { grid-template-columns: minmax(0, 1fr); }
}

/* ---------- 설정: 전표기계 바로 가기 안내 ---------- */
.steps { margin: 8px 0; padding-left: 22px; }
.steps li { margin: 8px 0; line-height: 1.55; }
.cmd-box { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 8px; align-items: center; margin-top: 8px; }
.cmd-box .muted { grid-column: 1 / -1; margin: 0; }
.cmd-box code { display: block; padding: 8px 10px; background: #f3f6f9; border: 1px solid var(--line); border-radius: 8px; font-family: Consolas, monospace; font-size: 12.5px; overflow-x: auto; white-space: nowrap; }

/* ---------- 로고 ---------- */
.auth-logo { display: block; width: 150px; height: auto; margin: 0 auto 6px; }
/* 로고가 따로 없는 업체: 기본 로고 아래에 상호 */
.auth-shop { margin: -4px 0 0; text-align: center; font-size: 20px; font-weight: 800; }
/* 마스터페이지 (샘플 전산 관리) */
.ms { max-width: 1180px; margin: 0 auto; padding: 22px 16px 60px; }
.ms-head { display: flex; flex-wrap: wrap; gap: 12px 20px; align-items: flex-end; justify-content: space-between; margin-bottom: 14px; }
.ms-head h1 { margin: 0; font-size: 26px; }
.ms-tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-bottom: 14px; }
.ms-tile { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; }
.ms-tile span { display: block; font-size: 13px; color: var(--muted); }
.ms-tile b { font-size: 24px; }
.ms-list { padding: 0; overflow-x: auto; }
.ms-sub { display: block; font-size: 12.5px; font-weight: 400; color: var(--muted); white-space: normal; }
.ms-sub.soon { color: #a12a1e; font-weight: 700; }
.ms-acts { justify-content: flex-end; flex-wrap: nowrap; gap: 6px; }
.ms-until { display: grid; gap: 8px; }
.ms-until input[type=date] { width: 180px; }
.ms-logo { width: 72px; }
@media (max-width: 640px) { .ms-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
/* 사용 기한(체험 기간)이 있는 업체 */
.trial-note { margin: 0; padding: 6px 10px; text-align: center; font-size: 13.5px; font-weight: 700; color: #8a5a00; background: #fff7e0; border: 1px solid #f0d58a; border-radius: 8px; }
.trial-note.soon { color: #a12a1e; background: #fff1f0; border-color: #f3b5ad; }
.sv-brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.sv-brand img { width: 42px; height: 42px; flex: none; }
.sv-brand b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.onboard h2 { margin: 0 0 6px; font-size: 17px; }
.onboard ol { margin: 0; padding-left: 20px; }
.onboard li { margin: 6px 0; }

/* ---------- 전표 입력 ---------- */
/* 왼쪽 입력 칸은 적어도 760px(창이 좁으면 남는 만큼), 그 뒤로는 창이 넓어지는 대로 왼쪽 1.6 : 오른쪽(메모) 1 로 함께 넓어짐 */
.entry { display: grid; grid-template-columns: minmax(min(760px, 100% - 344px), 1.6fr) minmax(330px, 1fr); gap: 14px; align-items: start; }
.entry.sale .entry-main { border-top: 4px solid var(--sale); }
.entry.purchase .entry-main { border-top: 4px solid var(--purchase); }
.entry-side { padding: 14px; }
.entry-side-col { min-width: 0; }
/* 거래처 메모 (성향·특이사항): 적는 대로 자동 저장 */
.entry-memo { padding: 14px; }
.memo-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.memo-head h3 { margin: 0 0 4px; }
.memo-status { color: var(--muted); font-size: 12.5px; min-height: 18px; white-space: nowrap; }
.memo-name { display: block; min-height: 22px; margin-bottom: 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* 화면이 좁아 아래로 내려갔을 때의 높이: 창 높이를 따라감 (넓은 화면에서는 아래 "창 크기에 맞춤" 규칙이 칸을 가득 채움) */
.memo-area { display: block; height: clamp(170px, 38vh, 460px); min-height: 124px; line-height: 1.55; background: #fffdf3; border-color: #e6d9a8; }
.memo-area:disabled { background: #f6f8fa; border-color: var(--line); }
.memo-area::placeholder { color: #98a3ad; }
.entry-memo .muted { margin: 8px 0 0; font-size: 12.5px; }
/* 화면이 좁아 메모 칸이 아래로 내려갔을 때만 보이는 한 줄 */
.memo-peek { display: none; width: 100%; margin: 0 0 8px; padding: 7px 10px; border: 1px solid #e6d9a8; border-radius: 8px; background: #fffdf3; text-align: left; font-size: 13.5px; cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.memo-peek.empty { color: var(--muted); border-style: dashed; background: transparent; }
.memo-peek:disabled { cursor: default; }
.client-memo { white-space: pre-wrap; }
/* 지난 주문 안내 줄: 내용이 있든 없든 한 줄 높이를 차지하고 줄이 바뀌지 않아서, 불러오는 순간 아래 표가 밀리지 않음 */
.last-msg { display: flex; flex-wrap: nowrap; align-items: center; gap: 10px; height: 32px; min-width: 0; margin-bottom: 4px; font-size: 13.5px; }
.last-msg b { color: var(--brand-d); }
.last-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.last-none { color: var(--muted); }
.last-note { flex: none; color: #8a5a00; background: #fff4d6; border-radius: 6px; padding: 1px 8px; white-space: nowrap; cursor: help; }
.last-msg .btn { flex: none; }
.last-auto { display: inline-flex; align-items: center; gap: 6px; margin-right: auto; color: var(--muted); font-size: 13px; cursor: pointer; }
.last-auto input { width: 16px; height: 16px; flex: none; }
.line input.was { background: #fff4d6; }
.entry-side .table-wrap { border: 0; }
.entry-side .tbl th, .entry-side .tbl td { padding: 8px 6px; }
/* 넓은 화면(두 칸): 오른쪽 칸을 창 크기에 맞춤. 창 너비·높이를 바꾸면 메모 칸이 함께 커지고 작아진다.
   다른 화면은 내용 폭을 1340px 에서 멈추지만, 입력 화면은 창 끝까지 쓴다.
   오른쪽 칸 높이 = 창 높이 − 위쪽 제목 줄(59px) − 아래 여백(24px) − 여유 3px. 제목 줄 높이를 바꾸면 이 숫자도 고칠 것 */
@media (min-width: 1181px) {
  #main:has(.entry) { max-width: none; padding-bottom: 24px; }
  .entry-side-col { position: sticky; top: 14px; display: flex; flex-direction: column; gap: 14px; height: calc(100vh - 86px); min-height: 430px; }
  .entry-side-col > .card { margin-bottom: 0; }
  .entry-memo { flex: 1 1 0; min-height: 230px; display: flex; flex-direction: column; }
  .memo-area { flex: 1 1 0; height: auto; min-height: 0; resize: none; font-size: 16px; }
  /* 그날 전표가 많아도 칸의 40%까지만 쓰고(나머지는 메모 칸), 넘치면 그 안에서 굴림 */
  .entry-side { flex: 0 1 auto; max-height: 40%; min-height: 0; display: flex; flex-direction: column; }
  .entry-side > div { display: flex; flex-direction: column; min-height: 0; }
  .entry-side .table-wrap { overflow: auto; min-height: 0; }
  .entry-side .tbl thead th { position: sticky; top: 0; z-index: 1; }
}
.entry-head { display: flex; flex-wrap: wrap; gap: 10px 12px; align-items: flex-end; margin-bottom: 8px; }
.entry-head .field { flex: 0 0 auto; }
.entry-head .field.grow { flex: 1 1 170px; }
.entry-head select { width: auto; min-width: 130px; }
.entry-head input[type=date] { width: 142px; }
.date-nav { display: flex; gap: 2px; align-items: center; }
.client-info { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 13px; color: var(--muted); min-height: 20px; margin-bottom: 8px; }
.editing { background: #fff7e0; border: 1px solid #f0d58a; border-radius: 8px; padding: 6px 8px 6px 12px; margin-bottom: 12px; display: flex; justify-content: space-between; align-items: center; gap: 8px; font-weight: 600; }

.lines { border: 1px solid var(--line); border-radius: 8px; overflow: hidden; margin: 6px 0 12px; background: #fff; }
.line { display: grid; grid-template-columns: minmax(150px, 2.4fr) 1fr .7fr .9fr 1fr 1.2fr 1.2fr 34px; border-bottom: 1px solid var(--line2); }
.lines.dated .line { grid-template-columns: 140px minmax(140px, 2.2fr) 1fr .7fr .9fr 1fr 1.2fr 1.2fr 34px; }
/* 발주서를 완료할 때: 맨 앞에 거래처가 주문한 수량·남긴 말 */
.lines.ordered .line { grid-template-columns: minmax(104px, 1.5fr) minmax(130px, 2fr) 1fr .7fr .9fr 1fr 1.2fr 1.1fr 34px; }
/* 중량 칸이 있는 표 (매출·매입 입력, 발주서 완료): 품명 · 규격 · 중량 · 단위 · 수량 · 단가 · 금액 · 비고. 금액 = 중량 × 수량 × 단가 */
.lines.weight .line { grid-template-columns: minmax(150px, 2.4fr) 1fr .85fr .7fr .8fr 1fr 1.2fr 1.1fr 34px; }
/* 발주서 완료: 맨 앞 "주문" 칸에는 주문한 기준중량(바뀌지 않음) */
.lines.ordered.weight .line { grid-template-columns: minmax(96px, 1.2fr) minmax(130px, 2fr) .9fr .85fr .7fr .8fr 1fr 1.2fr 1fr 34px; }
/* 중량을 재서 넣어야 금액이 나오는 줄 (마릿수로만 주문한 무게 품목) */
.line input.need { background: #fff1f0; }
.line input.need::placeholder { color: #c0392b; }
/* 주문 칸: 수량과 남긴 말이 길면 두 줄까지 보여 줌 (전체는 마우스를 올리면 보임) */
.l-ord { display: flex; align-items: center; height: 38px; padding: 0 8px; font-size: 12.5px; line-height: 1.25; font-weight: 700; color: #8a5a00; background: #fffaf0; border-right: 1px solid var(--line2); overflow: hidden; word-break: keep-all; }
/* 발주서 완료 화면: 주문과 달라진 줄 아래의 한 줄 설명("주문 6.8kg × 1 → 지금 6.9kg × 1 · 주문대로면 얼마 → 얼마"), 표 아래의 금액 차이 */
.l-diff { grid-column: 1 / -1; padding: 4px 10px 6px; font-size: 13px; font-weight: 600; color: #8a5a00; background: #fffaf0; border-top: 1px dashed #f0d58a; }
.l-diff[hidden], .order-diff[hidden] { display: none; }
.order-diff { display: grid; gap: 4px; margin: 0 0 12px; padding: 8px 12px; background: #fffaf0; border: 1px solid #f0d58a; border-radius: 8px; font-size: 14px; }
.order-diff small { color: var(--muted); }
.gap { color: #b45309; }
tr.ck-changed td { background: #fffaf0; }
tr.ck-dropped td { color: var(--muted); }
.editing.order { align-items: flex-start; font-weight: 400; }
.editing.order b { font-weight: 700; }
.order-how { font-size: 13px; color: var(--muted); margin-top: 2px; }
.order-req { margin-top: 4px; font-weight: 700; color: #8a5a00; }
.tbl tr.pend td { background: #fffaf0; }
.tbl td.wrap-s { white-space: normal; max-width: 280px; }
input.picker[readonly] { cursor: default; }
.share-row { display: grid; gap: 4px; margin-bottom: 18px; }
.share-row small { color: var(--muted); }
.share-row .share-url { margin: 2px 0 6px; }
/* 홈: 미완료 전표가 있을 때 알려 주는 줄 */
.order-alert { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; text-decoration: none; color: inherit; background: #fff8e6; border-color: #f0d58a; }
.order-alert b { color: #8a5a00; font-size: 17px; }
.order-alert span { color: var(--muted); }
.lines-body .line:last-child { border-bottom: 0; }
.line.head { background: #f6f8fa; font-size: 13px; color: var(--muted); font-weight: 600; border-bottom: 1px solid var(--line); }
.line.head span { padding: 7px 8px; white-space: nowrap; overflow: hidden; }
.line input { border: 0; border-right: 1px solid var(--line2); border-radius: 0; height: 38px; background: transparent; }
.line input:focus { outline: 2px solid var(--brand); outline-offset: -2px; background: #fff; }
.line .del { height: 38px; width: 34px; border-radius: 0; color: #a3aeb8; }

.entry-foot { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 14px; align-items: start; }
.pay-box { background: #f6f8fa; border-radius: 10px; padding: 12px; }
.pay-title { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 8px; }
.pay-title small { color: var(--muted); margin-right: auto; }
.pay-fields { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; margin-bottom: 8px; }
.sum-box { border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; background: #fff; }
.sum-box div { display: flex; justify-content: space-between; padding: 3px 0; font-variant-numeric: tabular-nums; }
.sum-box span { color: var(--muted); }
.sum-box .total { font-size: 19px; border-bottom: 1px dashed var(--line); padding-bottom: 8px; margin-bottom: 6px; }
.sum-box .total span { color: var(--text); font-weight: 600; }
.sum-box .after b { color: var(--brand-d); font-size: 17px; }
.sum-inline { display: flex; gap: 16px; justify-content: flex-end; margin: 0 0 10px; font-variant-numeric: tabular-nums; }
.pay-info { background: var(--brand-l); border-radius: 8px; padding: 8px 12px; }
.pay-info:empty { display: none; }

/* ---------- 거래처 내역 · 링크 ---------- */
.client-head { display: grid; gap: 12px; }
.client-name h2 { display: inline; margin: 0 8px 0 0; font-size: 20px; vertical-align: middle; }
.stats { display: flex; gap: 28px; flex-wrap: wrap; }
.share-box p { margin: 0 0 12px; }
.share-url { font-family: Consolas, monospace; font-size: 13px; margin-bottom: 10px; }
.share-danger { margin-top: 18px; padding-top: 12px; border-top: 1px solid var(--line2); display: grid; gap: 8px; }
.share-danger small { color: var(--muted); }

/* ---------- 거래처가 보는 화면 (큰 글씨) ---------- */
/* touch-action: 단추를 빠르게 두 번 눌러도 화면이 확대되지 않게 (두 손가락으로 벌리는 확대는 그대로 됨) */
.sv { max-width: 640px; margin: 0 auto; padding: 16px 14px 60px; font-size: 18px; touch-action: manipulation; }
body:has(.sv) .modal-back { touch-action: manipulation; }
.sv-shop { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.sv-shop b { font-size: 20px; }
.sv-shop .btn { height: 44px; font-size: 16px; }
.sv h1 { font-size: 24px; margin: 14px 0; }
.sv-balance { background: var(--brand); color: #fff; border-radius: 16px; padding: 18px 20px; margin-bottom: 10px; }
.sv-balance.pay { background: #3d5563; }
.sv-balance span { opacity: .92; }
.sv-balance > b { display: block; font-size: 36px; letter-spacing: -.5px; font-variant-numeric: tabular-nums; }
.sv-bank b { display: block; font-size: 17px; }
.sv-balance small { opacity: .85; font-size: 15px; }
.sv-bank { margin-top: 12px; background: rgba(255, 255, 255, .15); border-radius: 10px; padding: 10px 12px; display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 16px; }
.sv-bank button { height: 38px; padding: 0 12px; border-radius: 8px; border: 0; background: #fff; color: var(--brand-d); font-weight: 700; cursor: pointer; flex: none; }
.sv-month { display: flex; align-items: center; justify-content: space-between; margin: 20px 0 10px; gap: 8px; }
.sv-month b { font-size: 21px; white-space: nowrap; }
.sv-month button { height: 48px; padding: 0 14px; font-size: 17px; border-radius: 12px; border: 1px solid var(--line); background: #fff; cursor: pointer; font-weight: 600; white-space: nowrap; }
.sv-month button:disabled { opacity: .35; cursor: default; }
/* 거래내역을 엑셀로 받기 (보고 있는 달 / 전체) */
.sv-files { display: flex; align-items: center; justify-content: flex-end; gap: 8px; margin: 0 0 12px; font-size: 15px; color: var(--muted); }
.sv-files .btn { height: 42px; padding: 0 16px; font-size: 16px; font-weight: 700; border-radius: 12px; text-decoration: none; display: inline-flex; align-items: center; }
.sv-sum { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 6px; }
.sv-sum div { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; }
.sv-sum span { display: block; font-size: 15px; color: var(--muted); }
.sv-sum b { font-size: 20px; font-variant-numeric: tabular-nums; }
.sv-day { font-weight: 700; margin: 18px 0 6px; font-size: 17px; color: #33424f; }
.sv-doc { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px 12px; margin-bottom: 8px; }
.sv-line { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--line2); }
.sv-line small { display: block; color: var(--muted); font-size: 15px; }
.sv-line > b { white-space: nowrap; font-weight: 600; font-variant-numeric: tabular-nums; }
.sv-total { display: flex; justify-content: space-between; padding-top: 8px; font-weight: 800; font-size: 19px; font-variant-numeric: tabular-nums; }
.sv-pay { background: var(--in-l); border: 1px solid #bfe3cf; color: #0f5a36; border-radius: 12px; padding: 12px 14px; margin-bottom: 8px; display: flex; justify-content: space-between; align-items: baseline; gap: 10px; font-weight: 700; }
.sv-pay small { display: block; font-weight: 400; font-size: 15px; }
.sv-pay > b { white-space: nowrap; font-size: 19px; font-variant-numeric: tabular-nums; }
.sv-carry { color: var(--muted); font-size: 16px; display: flex; justify-content: space-between; padding: 8px 2px; }
.sv-carry b { color: var(--text); font-variant-numeric: tabular-nums; }
.sv-empty { text-align: center; color: var(--muted); padding: 30px 0; }
.sv-foot { margin-top: 34px; text-align: center; color: var(--muted); font-size: 14px; }
.sv-error { text-align: center; padding: 70px 20px; }
.sv h2 { font-size: 20px; margin: 22px 0 10px; }
.sv h2 small { font-size: 15px; font-weight: 400; color: var(--muted); }
/* 주문하기 / 거래내역 전환 단추 */
.sv-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; background: #e3e8ed; border-radius: 14px; padding: 5px; margin-bottom: 14px; }
.sv-tabs button { height: 52px; border: 0; border-radius: 10px; background: transparent; font-size: 19px; font-weight: 700; color: var(--muted); cursor: pointer; }
.sv-tabs button.on { background: #fff; color: var(--brand-d); box-shadow: 0 1px 3px rgba(0, 0, 0, .16); }

/* ---------- 거래처가 쓰는 주문서 (발주서) ---------- */
/* 업체의 매출 입력 칸과 같은 모양: 줄마다 품명 · 규격 · 중량 · 단위 · 수량 · 비고. 품명 칸을 누르면 품목 목록이 나옴 */
.od-help { color: var(--muted); font-size: 16px; margin: 0 0 12px; }
.od-quick:not(:empty) { margin-bottom: 4px; }
.od-quick .btn { height: 48px; font-size: 17px; width: 100%; }
/* 지난 주문을 자동으로 불러왔다는 안내 + 비우기, 자동 불러오기 켜고 끄기 */
.od-loaded { display: flex; gap: 10px; align-items: center; background: var(--brand-l); border: 1px solid #9fcbd9; border-radius: 12px; padding: 10px 12px; font-size: 16px; }
.od-loaded span { flex: 1; min-width: 0; }
.od-quick .od-loaded .btn { width: auto; flex: none; height: 44px; padding: 0 16px; }
.od-auto { display: flex; gap: 8px; align-items: center; margin-top: 8px; font-size: 15px; color: var(--muted); min-height: 32px; cursor: pointer; }
.od-auto input { width: 20px; height: 20px; flex: none; }
.os-label { font-size: 17px; margin: 18px 0 8px; }
.os { background: #fff; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.os-row { display: grid; grid-template-columns: 30px minmax(0, 2fr) minmax(0, .95fr) minmax(0, .8fr) minmax(62px, .8fr) minmax(0, .75fr) minmax(0, 1.1fr) 40px; align-items: center; border-bottom: 1px solid var(--line2); }
/* 중량 · 단위 · 수량 칸의 이름표: 넓은 화면에서는 표 머리가 있으므로 숨기고 칸만 표에 놓는다 */
.os-f { display: contents; }
.os-f > span { display: none; }
.os-body .os-row:last-child { border-bottom: 0; }
.os-head { background: #f6f8fa; font-size: 15px; font-weight: 700; color: var(--muted); border-bottom: 1px solid var(--line); }
.os-head span { padding: 9px 8px; }
.os-no { text-align: center; color: var(--muted); font-size: 14px; font-variant-numeric: tabular-nums; }
.os-row input { height: 50px; min-width: 0; padding: 0 8px; border: 0; border-right: 1px solid var(--line2); border-radius: 0; background: transparent; font-size: 17px; }
.os-row input:focus, .os-row select:focus { outline: 2px solid var(--brand); outline-offset: -2px; background: #fff; }
/* 단위는 고르는 칸 (kg · box · ea …) */
.os-row select { height: 50px; min-width: 0; width: 100%; padding: 0 2px 0 6px; border: 0; border-right: 1px solid var(--line2); border-radius: 0; background: transparent; font-size: 17px; color: var(--text); cursor: pointer; }
.os-row .os-name { font-weight: 700; }
.os-row .os-qty, .os-row .os-wt { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
.os-row .os-qty::placeholder, .os-row .os-wt::placeholder { font-weight: 400; }
/* 지난 주문에서 불러온 줄 가운데 수량을 비운 줄(이번에는 보내지 않는 줄): 흐리게. 수량 칸만 또렷하게 두어 "여기에 적으면 주문"이 보이게 함 */
.os-row.os-idle .os-name, .os-row.os-idle .os-spec, .os-row.os-idle .os-unit, .os-row.os-idle .os-wt { color: var(--muted); font-weight: 400; }
.os-row.os-idle .os-qty { background: #fffbe8; }
.os-row.os-idle .os-qty::placeholder { color: #8a6d1f; font-weight: 400; }
.os-del { width: 40px; height: 50px; border: 0; background: transparent; color: #a3aeb8; font-size: 16px; cursor: pointer; }
.os-add { width: 100%; height: 46px; margin-top: 8px; font-size: 16px; border-style: dashed; }
.os-send { width: 100%; height: 58px; margin-top: 6px; font-size: 20px; }
.sv textarea { font-size: 17px; }
.sv .auth-msg { min-height: 26px; margin: 10px 0 0; font-size: 17px; font-weight: 700; }
/* 품명 칸의 목록: 손가락으로 누르기 쉽게 크게 */
body:has(.sv) .suggest .opt { padding: 12px 14px; font-size: 17px; }
body:has(.sv) .suggest .opt-right { font-size: 13px; }
/* 좁은 화면(휴대폰): 한 줄을 세 단으로. 품명 / 중량 · 단위 · 수량 (칸 위에 이름표) / 규격 · 비고 */
@media (max-width: 600px) {
  .os-head { display: none; }
  .os-row { grid-template-columns: 22px repeat(6, minmax(0, 1fr)) 36px; grid-template-areas: "no name name name name name name del" ". wt wt unit unit qty qty qty" ". spec spec spec memo memo memo memo"; gap: 5px; padding: 9px 8px 9px 4px; align-items: end; }
  .os-row .os-spec, .os-row .os-unit, .os-row .os-qty, .os-row .os-wt, .os-row .os-memo { padding: 0 7px; }
  .os-row .os-memo::placeholder { font-size: 15px; }
  .os-no { grid-area: no; align-self: center; }
  .os-row .os-name { grid-area: name; }
  .os-row .os-spec { grid-area: spec; }
  .os-row .os-memo { grid-area: memo; }
  .os-f { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
  .os-f > span { display: block; padding-left: 3px; font-size: 13px; line-height: 1.2; color: var(--muted); }
  .os-f input { width: 100%; }
  .os-f-wt { grid-area: wt; }
  .os-f-unit { grid-area: unit; }
  .os-f-qty { grid-area: qty; }
  .os-del { grid-area: del; height: 48px; }
  .os-row input, .os-row select { height: 48px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
}
/* 주문 확인 창: 주문한 중량 · 수량과 실제(업체가 잰 중량)를 줄마다 나란히, 아래에 금액 차이 */
.ck { font-size: 17px; }
.ck-top { margin: 0 0 10px; color: var(--muted); font-size: 15px; }
.ck-item { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; margin-bottom: 8px; background: #fff; }
.ck-item.changed { border-color: #e7c36a; border-left: 6px solid #d9a400; background: #fffaf0; }
.ck-item.dropped { border-style: dashed; color: var(--muted); }
.ck-item.added { border-left: 6px solid #9fc0e8; }
.ck-name { display: block; font-size: 18px; margin-bottom: 4px; }
.ck-row { display: grid; grid-template-columns: 42px minmax(0, 1fr); gap: 8px; padding: 2px 0; align-items: baseline; }
.ck-row > span { color: var(--muted); font-size: 15px; }
.ck-row > div { font-variant-numeric: tabular-nums; }
.ck-row em { font-style: normal; color: var(--muted); }
.ck-row small { display: block; color: var(--muted); font-size: 14px; }
.ck-diff { color: #b45309; font-weight: 700; margin-left: 8px; white-space: nowrap; }
.ck-note { margin: 10px 0 0; color: var(--muted); font-size: 14px; }
.modal-foot .ck-sum { flex: 1 1 100%; }
.ck-sum-row { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; padding: 2px 0; font-size: 17px; }
.ck-sum-row b { font-variant-numeric: tabular-nums; white-space: nowrap; }
.ck-sum-row.diff { font-size: 20px; font-weight: 700; color: #b45309; }
.ck-sum-row.diff.none { color: var(--text); }   /* 변동 없음 */
.ck-sum ~ .btn.big { flex: 1 1 100%; height: 52px; font-size: 18px; }
/* 보낸 주문 카드 */
.od-flash { background: var(--in-l); border: 1px solid #bfe3cf; color: #0f5a36; border-radius: 12px; padding: 14px 16px; font-weight: 700; margin-bottom: 12px; }
.od-card { background: #fff; border: 1px solid var(--line); border-left: 6px solid #d9a400; border-radius: 12px; padding: 12px 14px; margin-bottom: 10px; }
.od-card.done { border-left-color: var(--in); }
.od-card.cancel { border-left-color: #a3aeb8; color: var(--muted); }
.od-card-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 10px; margin-bottom: 6px; }
.od-chip { font-size: 14px; font-weight: 700; padding: 3px 10px; border-radius: 999px; background: #fff4d6; color: #8a5a00; white-space: nowrap; }
.od-chip.done { background: var(--in-l); color: var(--in); }
.od-chip.cancel { background: #e9edf1; color: #465360; }
.od-card-line { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; padding: 5px 0; border-bottom: 1px solid var(--line2); }
.od-card-line small { display: block; color: var(--muted); font-size: 15px; }
.od-card-line > b { white-space: nowrap; font-variant-numeric: tabular-nums; }
.od-card-memo { margin: 8px 0 0; }
.od-card-note { margin: 8px 0 0; font-size: 15px; color: var(--muted); }
.od-card-btns { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.od-card-btns .btn { height: 44px; font-size: 16px; }
.od-old { margin-top: 26px; }
.od-old summary { font-size: 17px; font-weight: 700; padding: 10px 0; cursor: pointer; }
.od-pending { margin-bottom: 8px; }
.od-days { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
.od-day { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 68px; padding: 6px; border: 2px solid var(--line); border-radius: 12px; background: #fff; cursor: pointer; font-size: 14px; color: var(--muted); }
.od-day b { font-size: 18px; color: var(--text); }
.od-day.on { border-color: var(--brand); background: var(--brand-l); }
.od-day.other input { height: 34px; padding: 0 4px; font-size: 14px; }
.sv-error h1 { font-size: 22px; }

/* ---------- 좁은 화면 ---------- */
@media (max-width: 1180px) {
  .entry { grid-template-columns: minmax(0, 1fr); }
  .memo-peek { display: block; }
  .price-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 900px) {
  input[type=text], input[type=search], input[type=tel], input[type=email], input[type=password], input[type=date], select, textarea { font-size: 16px; }
  .shell { grid-template-columns: minmax(0, 1fr); }
  .side { position: fixed; left: 0; top: 0; z-index: 50; width: 244px; transform: translateX(-100%); transition: transform .2s; }
  .menu-open .side { transform: none; }
  .menu-open .scrim { display: block; position: fixed; inset: 0; background: rgba(0, 0, 0, .42); z-index: 49; }
  .menu-btn { display: inline-grid; }
  .topbar { position: sticky; top: 0; background: var(--bg); z-index: 20; padding: 8px 12px; border-bottom: 1px solid var(--line); }
  .page-title { font-size: 19px; }
  /* 좁은 화면: 체크하면 막대가 화면 아래에 떠서, 표가 밀리지 않고 엄지로 누르기 쉬움 */
  .bulk-bar { position: static; min-height: 56px; }
  .bulk-bar.idle .bulk-panel { min-height: 56px; }
  .bulk-bar:not(.idle) .bulk-panel { position: fixed; left: 8px; right: 8px; bottom: 10px; z-index: 40; padding: 10px 10px 10px 14px; }
  .bulk-bar:not(.idle) .bulk-count { order: 1; }
  .bulk-bar:not(.idle) .bulk-panel > .btn.ghost { order: 2; margin-left: auto; }
  .bulk-bar:not(.idle) .bulk-actions { order: 3; flex-basis: 100%; }
  body:has(.bulk-bar:not(.idle):not([hidden])) #main { padding-bottom: 150px; }
  body:has(.bulk-bar:not(.idle):not([hidden])) #toasts { bottom: 128px; }
  #main { padding: 10px 12px 70px; }
  .last-auto { flex-basis: 100%; }
  .entry-foot { grid-template-columns: minmax(0, 1fr); }
  .big-row { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 720px) {
  /* 지난 주문 안내: 휴대폰에서는 두 줄 높이를 늘 잡아 둠 (윗줄 안내, 아랫줄 단추) */
  .last-msg { height: 60px; flex-wrap: wrap; align-content: center; gap: 4px 10px; }
  .last-text { flex-basis: 100%; }
  .line.head { display: none; }
  .line, .lines.dated .line, .lines.ordered .line { grid-template-columns: repeat(6, 1fr) 34px; gap: 4px; padding: 8px 6px; }
  .line input { border: 1px solid var(--line); border-radius: 6px; background: #fff; }
  /* 한 줄을 3단으로: 품명 / 수량·단가·금액 / 규격·단위·비고 */
  .line .l-name { grid-area: 1 / 1 / 2 / 7; }
  .line .del { grid-area: 1 / 7 / 2 / 8; }
  .line .l-qty { grid-area: 2 / 1 / 3 / 3; }
  .line .l-price { grid-area: 2 / 3 / 3 / 5; }
  .line .l-amount { grid-area: 2 / 5 / 3 / 8; }
  .line .l-spec { grid-area: 3 / 1 / 4 / 3; }
  .line .l-unit { grid-area: 3 / 3 / 4 / 5; }
  .line .l-memo { grid-area: 3 / 5 / 4 / 8; }
  .lines.dated .line .l-date { grid-area: 4 / 1 / 5 / 5; }
  .lines.ordered .line .l-ord { grid-area: 4 / 1 / 5 / 8; height: auto; line-height: 1.4; padding: 0 2px; border: 0; background: none; white-space: normal; }
  .lines.ordered .line .l-ord:not(:empty)::before { content: '주문'; margin-right: 6px; font-weight: 400; color: var(--muted); }
  /* 중량 칸이 있는 표: 품명 / 중량·단위·수량·단가 / 금액·규격·비고 / (주문) */
  .lines.weight .line, .lines.ordered.weight .line { grid-template-columns: repeat(12, 1fr) 34px; }
  .lines.weight .line .l-name { grid-area: 1 / 1 / 2 / 13; }
  .lines.weight .line .del { grid-area: 1 / 13 / 2 / 14; }
  .lines.weight .line .l-wt { grid-area: 2 / 1 / 3 / 4; }
  .lines.weight .line .l-unit { grid-area: 2 / 4 / 3 / 7; }
  .lines.weight .line .l-qty { grid-area: 2 / 7 / 3 / 10; }
  .lines.weight .line .l-price { grid-area: 2 / 10 / 3 / 14; }
  .lines.weight .line .l-amount { grid-area: 3 / 1 / 4 / 6; }
  .lines.weight .line .l-spec { grid-area: 3 / 6 / 4 / 9; }
  .lines.weight .line .l-memo { grid-area: 3 / 9 / 4 / 14; }
  .lines.weight.ordered .line .l-ord { grid-area: 4 / 1 / 5 / 14; }
  .pay-fields { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 560px) {
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .modal-back { padding: 6px; }
  .modal-body { padding: 14px; }
  .range-inputs input[type=date] { width: 136px; }
}

/* ---------- 메인화면의 창 (화면 꾸미기) ---------- */
/* 메인화면은 24칸 격자 위에 창들을 차례대로 놓는다. 창마다 차지하는 칸 수(--w)가 넓이. 업체가 꾸미지 않았으면 기본 배치 */
.hello-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.hello-row .hello { margin: 0; }
.hw-edit { height: 32px; padding: 0 12px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--muted); font-size: 13px; font-weight: 600; cursor: pointer; white-space: nowrap; }
.hw-edit:hover { color: var(--brand); border-color: var(--brand); }
.hw-edit[hidden] { display: none; }
.hw-grid { display: grid; grid-template-columns: repeat(24, minmax(0, 1fr)); gap: 14px; align-items: start; }
.hw { grid-column: span var(--w, 24); min-width: 0; }
.hw[hidden] { display: none; }
.hw-body > .card, .hw-body > .big-row, .hw-body > .stats-grid { margin-bottom: 0; }
.big-row.any { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.big-btn.link { background: var(--brand); }
.home-memo { width: 100%; min-height: 120px; resize: vertical; }
/* 꾸미는 중: 창마다 손잡이 줄(끌어서 옮기기 · 앞뒤 · 넓이 · 숨기기), 안의 내용은 눌리지 않게 */
.hw-editbar { position: sticky; top: 0; z-index: 20; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 14px; margin: 0 0 12px; padding: 10px 14px; background: #fff7e0; border: 1px solid #f0d58a; border-radius: 10px; box-shadow: var(--shadow); }
.hw-editbar[hidden] { display: none; }
.hw-editbar > div:first-child { flex: 1 1 260px; min-width: 0; }
.hw-editbar span { color: var(--muted); font-size: 13px; }
.hw-grid.hw-on .hw { border: 2px dashed #b9c6d2; border-radius: 12px; background: rgba(255, 255, 255, .55); }
.hw-grid.hw-on .hw-body { pointer-events: none; padding: 8px; }
.hw-bar { display: flex; align-items: center; gap: 8px; padding: 6px 8px; background: #e9eef3; border-radius: 10px 10px 0 0; cursor: grab; touch-action: none; user-select: none; -webkit-user-select: none; }
.hw-bar > b { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.hw-grip { color: #8a98a6; font-size: 16px; line-height: 1; cursor: grab; touch-action: none; }
.hw-tools { margin-left: auto; display: flex; align-items: center; gap: 3px; flex-wrap: wrap; justify-content: flex-end; }
.hw-tool { height: 28px; min-width: 28px; padding: 0 7px; border: 1px solid var(--line); border-radius: 6px; background: #fff; font-size: 13px; cursor: pointer; white-space: nowrap; }
.hw-tool:hover:not(:disabled) { border-color: var(--brand); color: var(--brand); }
.hw-tool:disabled { opacity: .35; cursor: default; }
.hw-w { min-width: 34px; text-align: center; font-size: 12px; color: var(--muted); }
.hw.dragging { opacity: .6; outline: 3px solid var(--brand); outline-offset: 2px; }
.hw-empty { display: flex; flex-direction: column; gap: 2px; color: var(--muted); border-style: dashed; }
/* 중간 크기 화면: 넓은 창은 한 줄을 다 쓰고 좁은 창만 반씩. 휴대폰: 모두 한 줄씩 (예전 메인화면과 같은 기준 너비) */
@media (max-width: 900px) { .hw { grid-column: span 24; } .hw.half { grid-column: span 12; } }
.hw-narrow-only { display: none; }
@media (max-width: 720px) {
  .hw, .hw.half { grid-column: span 24; }
  .hw-tool { height: 34px; min-width: 34px; }
  .big-row.any { grid-template-columns: repeat(2, 1fr); }
  /* 휴대폰에서는 창이 모두 한 줄씩이라 넓이를 바꿔도 달라지지 않으므로 넓이 단추를 감춘다 */
  .hw-tool.wd, .hw-w, .hw-wide-only { display: none; }
  .hw-narrow-only { display: inline; }
}
/* 고르는 창 (창 추가 · 단추 고르기 · 숫자 고르기 · 메뉴에 넣을 기능 고르기) */
.pk h3 { margin: 14px 0 6px; }
.pk h3:first-child { margin-top: 0; }
.pk h4 { margin: 12px 0 6px; font-size: 13px; color: var(--muted); }
.pk-row { display: flex; align-items: center; gap: 6px; padding: 6px 8px; border: 1px solid var(--line2); border-radius: 8px; margin-bottom: 4px; }
.pk-row > b { flex: 1; min-width: 0; }
.pk-row.wide > div { flex: 1; min-width: 0; }
.pk-row.wide small { display: block; color: var(--muted); font-size: 13px; }
.pk-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.pk-pool { max-height: 44vh; overflow: auto; margin-top: 8px; }
.pk input[type=search] { width: 100%; }
/* 화면 꾸미기 화면: 왼쪽 메뉴 꾸미기 · 색 */
.ui-now { margin: 6px 0; padding-left: 22px; columns: 2; }
.ui-now small { color: var(--muted); }
.ui-nav { display: grid; gap: 4px; max-width: 760px; margin: 10px 0 12px; }
.ui-nav-row { display: flex; align-items: center; gap: 6px; padding: 4px 6px; border: 1px solid var(--line2); border-radius: 8px; background: #fff; }
.ui-nav-row.group { background: #f1f4f8; margin-top: 8px; }
.ui-nav-row input { flex: 1 1 140px; min-width: 0; height: 34px; }
.ui-nav-row.group input { font-weight: 700; }
.ui-nav-to { flex: 1 1 120px; min-width: 0; color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ui-nav-row.dragging { opacity: .5; outline: 2px solid var(--brand); }
.ui-colors { display: flex; flex-wrap: wrap; gap: 8px; }
.ui-color { display: flex; align-items: center; gap: 8px; height: 42px; padding: 0 12px 0 8px; border: 2px solid var(--line); border-radius: 10px; background: #fff; cursor: pointer; font-weight: 600; }
.ui-color span { width: 24px; height: 24px; border-radius: 6px; }
.ui-color.on { border-color: var(--text); }
.ui-color.custom input { width: 28px; height: 28px; padding: 0; border: 0; background: none; cursor: pointer; }
@media (max-width: 720px) { .ui-nav-to { display: none; } .ui-now { columns: 1; } }
/* 메뉴를 오른쪽에 두기 (넓은 화면에서만. 좁은 화면은 ☰ 로 여는 서랍 그대로) */
@media (min-width: 901px) {
  .shell.side-right { grid-template-columns: minmax(0, 1fr) 212px; }
  .shell.side-right .side { order: 2; }
}

/* ---------- 인쇄 ---------- */
#print-root { display: none; }
@media print {
  @page { size: A4; margin: 12mm; }
  html { font-size: 12px; }
  body { background: #fff; }
  .no-print, .side, .scrim, #toasts, .toolbar, .seg, .modal-back, .btn-row, .big-row, .menu-btn, .suggest { display: none !important; }
  .shell { display: block; }
  .topbar { position: static; padding: 0 0 8px; border: 0; }
  #main { padding: 0; max-width: none; }
  .card { box-shadow: none; border: 0; padding: 0; }
  .table-wrap { border: 0; overflow: visible; }
  .tbl td, .tbl th { padding: 4px 6px; border-bottom: 1px solid #999; white-space: normal; }
  body.print-doc #app { display: none; }
  body.print-doc #print-root { display: block; }
  /* 거래처 화면의 명세서·정산서 그림을 인쇄할 때: 보여 주던 창은 숨기고 그림만 */
  .st-back { display: none !important; }
  body.st-open { overflow: visible; }
  /* 한 장에 다 들어가게 (긴 정산서는 줄여서) · 여러 장이면 장마다 새 쪽 */
  .st-print { display: block; width: auto; height: auto; max-width: 180mm; max-height: 266mm; margin: 0 auto; }
  .st-print + .st-print { page-break-before: always; }
}

/* 거래처 화면: 명세서 · 정산서 그림을 보여 주는 창 (화면 전체) */
body.st-open { overflow: hidden; }
.st-back { position: fixed; inset: 0; z-index: 60; background: #e9eef2; display: flex; flex-direction: column; }
.st-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 14px; background: #fff; border-bottom: 1px solid var(--line); font-size: 18px; }
.st-close { height: 44px; padding: 0 16px; border: 1px solid var(--line); border-radius: 12px; background: #fff; font-size: 16px; font-weight: 700; cursor: pointer; white-space: nowrap; }
.st-body { flex: 1 1 auto; overflow: auto; padding: 14px 10px; -webkit-overflow-scrolling: touch; }
.st-img { display: block; width: 100%; max-width: 560px; height: auto; margin: 0 auto 14px; background: #fff; border-radius: 10px; box-shadow: 0 2px 14px rgba(16, 32, 48, .16); -webkit-touch-callout: default; user-select: auto; }
.st-foot { padding: 10px 14px calc(10px + env(safe-area-inset-bottom)); background: #fff; border-top: 1px solid var(--line); text-align: center; }
.st-foot .btn-row { justify-content: center; }
.st-foot small { display: block; margin-top: 6px; color: var(--muted); font-size: 14px; }
.st-out { display: block; margin: 8px auto 0; padding: 8px 12px; border: 0; background: none; color: #0d4fb0; font-size: 15px; font-weight: 700; text-decoration: underline; cursor: pointer; }
/* 거래내역의 전표마다 붙는 "명세서" 단추, 달마다의 "정산서" 단추 */
.sv-stmt { height: 38px; padding: 0 14px; border: 1px solid #9fc0e8; border-radius: 10px; background: #eef5fd; color: #0d4fb0; font-size: 15px; font-weight: 700; cursor: pointer; white-space: nowrap; }
.sv-total .sv-btns { display: flex; flex-wrap: wrap; gap: 6px; margin-right: auto; margin-left: 10px; align-self: center; }
/* 달 아래 줄: 왼쪽에 정산서, 오른쪽에 엑셀 받기 */
.sv-files > .sv-stmt { height: 42px; margin-right: auto; font-size: 16px; border-radius: 12px; }

/* 인쇄 양식 (거래명세서 · 견적서 · 계산서) */
.pd { color: #000; font-size: 10.5pt; line-height: 1.35; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.pd-title { position: relative; text-align: center; margin-bottom: 10px; }
.pd-title h1 { font-size: 21pt; margin: 0; letter-spacing: 3px; display: inline-block; border-bottom: 3px double currentColor; padding: 0 14px 2px; }
.pd-title span { position: absolute; right: 0; bottom: 4px; font-size: 9pt; }
.pd-logo { position: absolute; left: 0; top: 50%; transform: translateY(-50%); height: 11mm; width: auto; }
.rc-logo { display: block; width: 18mm; height: 18mm; margin: 0 auto 1.5mm; }
.pd-top { display: grid; grid-template-columns: 1fr 1.25fr; gap: 8px; margin-bottom: 8px; }
.pd-to { border: 1px solid #000; padding: 8px 10px; }
.pd-to p { margin: 2px 0; }
.pd-to .pd-client { font-size: 14pt; margin: 6px 0; }
.pd-to .pd-sum { margin-top: 8px; font-size: 11.5pt; }
.pd table { border-collapse: collapse; width: 100%; }
.pd th, .pd td { border: 1px solid #000; padding: 3px 6px; font-weight: 400; text-align: left; color: #000; }
.pd th { background: #efefef; white-space: nowrap; font-weight: 600; text-align: center; }
.pd .r { text-align: right; font-variant-numeric: tabular-nums; }
.pd .c { text-align: center; }
.pd .pd-strong { font-weight: 700; }
.pd th.pd-vert { writing-mode: vertical-rl; letter-spacing: 6px; width: 24px; padding: 2px; }
.pd-lines td { height: 23px; }
.pd-items th:nth-child(1) { width: 34px; }
.pd-items th:nth-child(2) { width: 30%; }
.pd-foot { margin-top: 6px; }
.pd-foot th { width: 14%; }
.pd-bottom { display: flex; justify-content: space-between; margin-top: 10px; gap: 20px; }
.pd-bottom p { margin: 2px 0; }
.pd-sign span { display: inline-block; width: 130px; text-align: right; }
.pd-pair { display: grid; grid-template-columns: 1fr 1fr; }
.pd-tax table { margin-top: -1px; }
.pd-tax.red { color: #c00000; }
.pd-tax.red th, .pd-tax.red td { border-color: #c00000; }
.pd-tax.red th { background: #fdeeee; color: #c00000; }
.pd-tax.blue { color: #0033a0; }
.pd-tax.blue th, .pd-tax.blue td { border-color: #0033a0; }
.pd-tax.blue th { background: #eaf0fb; color: #0033a0; }
.pd-cut { border-top: 1px dashed #888; margin: 8mm 0; }
.pd-break { break-after: page; page-break-after: always; height: 0; }
.pd td.pd-stamp-cell { position: relative; }
.pd-stamp { position: absolute; right: 2px; top: 50%; transform: translateY(-50%); height: 15mm; max-width: 20mm; object-fit: contain; }

/* 영수증 프린터 (80mm) */
@page receipt { margin: 3mm; }
.rc { page: receipt; width: auto; max-width: 72mm; color: #000; font-size: 10pt; line-height: 1.35; font-family: "Malgun Gothic", "맑은 고딕", sans-serif; }
.rc h1 { font-size: 14pt; text-align: center; margin: 0 0 4px; }
.rc p { margin: 1px 0; }
.rc-shop { font-size: 12pt; font-weight: 700; text-align: center; }
.rc-center { text-align: center; }
.rc hr { border: 0; border-top: 1px dashed #000; margin: 4px 0; }
.rc-row { display: flex; justify-content: space-between; gap: 8px; font-variant-numeric: tabular-nums; }
.rc-row.big { font-size: 12pt; font-weight: 700; }
.rc-item { margin: 2px 0; }

/* 바코드 라벨 */
@page labels { margin: 8mm; }
.bc-sheet { page: labels; display: grid; gap: 2mm; color: #000; }
.bc-label { border: 1px dotted #999; padding: 1.5mm 2mm; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .5mm; overflow: hidden; break-inside: avoid; font-family: "Malgun Gothic", "맑은 고딕", sans-serif; }
.bc-name { font-size: 9pt; font-weight: 700; text-align: center; line-height: 1.15; max-height: 2.4em; overflow: hidden; }
.bc-svg { width: 92%; flex: 1 1 auto; min-height: 8mm; }
.bc-text { font-size: 7.5pt; letter-spacing: 1px; font-family: Consolas, monospace; }
.bc-price { font-size: 10pt; font-weight: 700; }
