/* LK ERP — 데스크탑 우선. 밀도 높은 표를 오래 보는 화면이라 대비를 낮게 잡는다. */
:root {
  --bg: #f4f6f8;
  --panel: #ffffff;
  --line: #dfe4ea;
  --ink: #1c2531;
  --ink-soft: #66717f;
  --brand: #17457f;
  --brand-soft: #e8f0fb;
  --danger: #c0392b;
  --ok: #1e7a4c;
  --radius: 8px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 14px/1.55 "Malgun Gothic", "맑은 고딕", system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 20px; margin: 0 0 16px; }
h2 { font-size: 15px; margin: 0 0 8px; }

/* ---- 레이아웃 ---- */
.layout { display: flex; min-height: 100vh; }
.sidebar {
  width: 216px; flex: 0 0 216px;
  background: #10233c; color: #cbd6e4;
  padding: 18px 0; display: flex; flex-direction: column;
}
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.brand { display: flex; align-items: center; gap: 10px; padding: 0 18px 18px; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 8px;
  background: var(--brand); color: #fff;
  display: grid; place-items: center; font-weight: 700; letter-spacing: .5px;
}
.brand-text { font-weight: 700; font-size: 15px; color: #fff; line-height: 1.2; }
.brand-text small { display: block; font-weight: 400; font-size: 11px; color: #8ea2ba; }

.nav-group {
  padding: 14px 18px 6px; font-size: 11px; letter-spacing: .08em;
  color: #6f8199; text-transform: uppercase;
}
.nav-item {
  display: block; padding: 8px 18px; color: #cbd6e4; font-size: 13.5px;
  border-left: 3px solid transparent;
}
.nav-item:hover { background: #16304f; color: #fff; text-decoration: none; }
.nav-item.active { background: #16304f; color: #fff; border-left-color: #4d8fdd; font-weight: 600; }

.topbar {
  height: 52px; background: var(--panel); border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between; padding: 0 22px;
}
.crumb { color: var(--ink-soft); font-size: 13px; }
.who { display: flex; align-items: center; gap: 12px; font-size: 13px; }
.who .name { font-weight: 600; }
.role {
  padding: 2px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 600;
  background: var(--brand-soft); color: var(--brand);
}
.role-warehouse { background: #eaf5ec; color: var(--ok); }
.role-office { background: #fdf1e3; color: #a86216; }
.inline { display: inline; }
.link { background: none; border: 0; color: var(--brand); cursor: pointer; font: inherit; padding: 0; }
.link:hover { text-decoration: underline; }

.content { padding: 22px; max-width: 1280px; }

/* ---- 카드·표 ---- */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; margin-bottom: 18px; }
.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 18px; margin-bottom: 14px;
}
.cards .card { margin-bottom: 0; }
.card-link { display: block; color: inherit; }
.card-link:hover { border-color: #b9c6d6; text-decoration: none; }
.lead { color: var(--ink-soft); margin-top: -6px; }
.count {
  float: right; font-weight: 600; font-size: 12.5px;
  background: var(--brand-soft); color: var(--brand); border-radius: 999px; padding: 1px 9px;
}
.muted { color: var(--ink-soft); }
.small { font-size: 12px; }
.mono { font-family: Consolas, "D2Coding", monospace; }
.nowrap { white-space: nowrap; }
.no { color: var(--danger); font-weight: 600; }

table.grid { border-collapse: collapse; }
table.grid.wide { width: 100%; }
table.grid th, table.grid td {
  border-bottom: 1px solid var(--line); padding: 7px 10px; text-align: left; vertical-align: top;
}
table.grid thead th { background: #f7f9fb; font-size: 12.5px; color: var(--ink-soft); }
table.grid td.num, table.grid th.num { text-align: right; font-variant-numeric: tabular-nums; }
.neg { color: var(--danger); }

.filters { display: flex; gap: 8px; margin-bottom: 12px; }
input[type=text], input[type=password], select {
  border: 1px solid var(--line); border-radius: 6px; padding: 7px 10px; font: inherit; background: #fff;
}
input:focus, select:focus { outline: 2px solid #a8c8ef; outline-offset: -1px; border-color: #7ba6dc; }
.btn {
  border: 1px solid var(--line); background: #fff; border-radius: 6px;
  padding: 7px 14px; font: inherit; cursor: pointer;
}
.btn:hover { background: #f3f6fa; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: #133a6c; }

.pager { display: flex; gap: 12px; align-items: center; margin-top: 12px; color: var(--ink-soft); }

.messages { padding: 12px 22px 0; }
.msg { border-radius: 6px; padding: 9px 12px; margin-bottom: 8px; border: 1px solid var(--line); background: #fff; }
.msg-error { background: #fdecea; border-color: #f3c3bd; color: var(--danger); }
.msg-success { background: #eaf5ec; border-color: #bfe0c9; color: var(--ok); }

/* ---- 로그인 ---- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; background: #10233c; }
.login-card {
  background: #fff; width: 340px; padding: 28px; border-radius: 12px;
  display: flex; flex-direction: column; gap: 12px;
}
.login-brand { padding: 0 0 6px; }
.login-brand .brand-text, .login-brand .brand-text small { color: var(--ink); }
.login-brand .brand-text small { color: var(--ink-soft); }
.login-card label { display: flex; flex-direction: column; gap: 5px; font-size: 13px; color: var(--ink-soft); }
.login-card .btn { margin-top: 6px; padding: 10px; }

/* ---- 전표 입력 ---- */
.row-between { display: flex; align-items: center; justify-content: space-between; }
.row-between h1 { margin-bottom: 16px; }

.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px 16px; }
.form-grid label, .wide-label { display: flex; flex-direction: column; gap: 5px; font-size: 12.5px; color: var(--ink-soft); }
.form-grid input, .form-grid select, .wide-label input { font-size: 14px; }
.form-grid label.check { flex-direction: row; align-items: center; gap: 6px; align-self: end; padding-bottom: 8px; color: var(--ink); }
.form-grid label.check input { width: auto; }
input[type=date], input[type=number] { border: 1px solid var(--line); border-radius: 6px; padding: 7px 10px; font: inherit; background: #fff; }
.field-changed select { border-color: #d9a441; background: #fffaf0; }

.scan-bar { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.scan-bar input { flex: 0 0 420px; font-size: 15px; padding: 9px 12px; }

.candidates {
  position: relative; border: 1px solid var(--line); border-radius: 8px; background: #fff;
  max-width: 640px; margin-bottom: 12px; overflow: hidden;
}
.candidate {
  display: grid; grid-template-columns: 90px 1fr auto; gap: 10px; align-items: center;
  width: 100%; text-align: left; padding: 8px 12px; border: 0; border-bottom: 1px solid var(--line);
  background: #fff; font: inherit; cursor: pointer;
}
.candidate:last-child { border-bottom: 0; }
.candidate:hover { background: var(--brand-soft); }

table.items input.cell { width: 92px; padding: 5px 8px; }
table.items input.cell.num { text-align: right; }
.tag {
  display: inline-block; padding: 1px 7px; border-radius: 4px; font-size: 11.5px; font-weight: 600;
  background: #eef1f5; color: var(--ink-soft); margin-left: 4px;
}
.tag-매입 { background: #e8f0fb; color: var(--brand); }
.tag-판매 { background: #eaf5ec; color: var(--ok); }
.tag-이동 { background: #f1ecfa; color: #6742b5; }
.tag-조정 { background: #fdf1e3; color: #a86216; }
.tag-promo { background: #fdecea; color: var(--danger); }

.sums { display: flex; justify-content: flex-end; gap: 22px; padding: 12px 4px 0; border-top: 1px solid var(--line); margin-top: 10px; }
.sums div { text-align: right; font-size: 12.5px; color: var(--ink-soft); }
.sums b { display: block; font-size: 15px; color: var(--ink); font-variant-numeric: tabular-nums; }
.sums .grand b { color: var(--brand); font-size: 18px; }

.actions { display: flex; gap: 8px; align-items: center; margin-top: 4px; }
.btn-danger { border-color: #e2b3ad; color: var(--danger); }
.btn-danger:hover { background: #fdecea; }

.msg-warn { background: #fdf6e8; border-color: #ead6a8; color: #7a5410; }
.msg-warn ul { margin: 6px 0 0; padding-left: 18px; }

.bulk {
  position: sticky; bottom: 0; display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 10px 14px; margin-top: 12px; box-shadow: 0 -2px 10px rgba(20,40,70,.06);
}
.bulk-price { display: flex; gap: 6px; align-items: center; }
.bulk-price input { width: 110px; }
th.tight, td.tight { width: 28px; }

tr.refunded { background: #fbf3f2; color: var(--ink-soft); }
tr.refunded input { opacity: .6; }
.refunded-text { text-decoration: line-through; color: var(--ink-soft); }
.big { font-size: 24px; font-weight: 700; margin: 4px 0 2px; font-variant-numeric: tabular-nums; }

/* ---- 손익 3단 ---- */
.pnl {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 6px 18px 14px; margin-bottom: 14px; max-width: 720px;
}
.pnl-row {
  display: grid; grid-template-columns: 130px 160px 1fr; align-items: baseline;
  gap: 12px; padding: 7px 0; border-bottom: 1px dashed #e7ebf0;
}
.pnl-row b { text-align: right; font-variant-numeric: tabular-nums; font-size: 15px; }
.pnl-row.minus b { color: #8a5a5a; }
.pnl-row.sum { border-bottom: 1px solid var(--line); }
.pnl-row.sum b { font-size: 17px; }
.pnl-row.total { border-bottom: 0; padding-top: 12px; }
.pnl-row.total span:first-child { font-weight: 700; }
.pnl-row.total b { font-size: 22px; color: var(--brand); }
.pnl-row.total b.neg { color: var(--danger); }

.toggle { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; }

.pending-chip {
  display: inline-block; margin: 4px 6px 0 0; padding: 3px 10px;
  border-radius: 999px; background: #fff; border: 1px solid #ead6a8; font-size: 12px;
}
.pending-chip:hover { background: #fdf1e3; text-decoration: none; }

.suggests { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.suggest {
  border: 1px solid var(--line); background: #fff; border-radius: 999px;
  padding: 3px 10px; font: inherit; font-size: 12px; cursor: pointer;
}
.suggest:hover { background: var(--brand-soft); border-color: #a8c8ef; }
.suggest.picked { background: var(--brand); border-color: var(--brand); color: #fff; }
.suggest .score { color: var(--ink-soft); font-size: 11px; margin-left: 3px; }
.suggest.picked .score { color: #cfe0f5; }

.upload-form { display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.upload-form label { display: flex; flex-direction: column; gap: 5px; font-size: 12.5px; color: var(--ink-soft); }
.upload-form input[type=file] { padding: 6px 0; }

.newprod {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  background: #f7f9fb; border: 1px dashed var(--line); border-radius: 8px;
  padding: 10px 12px; margin-bottom: 12px;
}
tr.voided { background: #f4f5f7; color: var(--ink-soft); text-decoration: line-through; }
tr.checkrow { background: #fdf6e8; }
.tag-void { background: #ececf0; color: #6b7280; }
.tag-check { background: #fdf1e3; color: #a86216; }
.tag-trade { background: #e8f0fb; color: var(--brand); }
