/* LinkStock v2 — design tokens taken from the screen mock-ups
   navy #0d2135 · teal #0f9a91 · bg #f2f5f7 */
:root {
  --navy: #0d2135;
  --navy-2: #14304a;
  --navy-line: #17314b;
  --teal: #0f9a91;
  --teal-dk: #0a7a73;
  --bg: #f2f5f7;
  --card: #ffffff;
  --line: #e0e7ec;
  --line-soft: #eef2f5;
  --line-row: #f1f5f7;
  --ink: #17222e;
  --ink-2: #46586a;
  --muted: #6a7c8c;
  --muted-2: #8b9aa9;
  --muted-3: #a2b0bc;
  --pos: #17734f;
  --neg: #a93f37;
  --warn: #92600f;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: 'IBM Plex Sans KR', system-ui, 'Apple SD Gothic Neo', sans-serif;
  font-size: 13px; -webkit-font-smoothing: antialiased;
}
a { color: var(--teal-dk); text-decoration: none; }
a:hover { color: #065f59; }
h1, h2, h3 { margin: 0; }

/* ------------------------------------------------------------ app shell */
.app { display: flex; min-height: 100vh; }
.side {
  width: 216px; flex-shrink: 0; background: var(--navy); color: #c6d4e0;
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
}
.brand {
  padding: 17px 18px 15px; display: flex; align-items: center; gap: 9px;
  border-bottom: 1px solid var(--navy-line);
}
.brand .name { font-weight: 700; font-size: 15px; color: #fff; letter-spacing: .2px; }
.nav { display: flex; flex-direction: column; padding: 10px 0; gap: 1px; overflow-y: auto; }
.nav .it {
  display: flex; align-items: center; gap: 10px; padding: 9px 18px;
  color: #94aabd; font-size: 13px; line-height: 1.2;
}
.nav a.it:hover { background: #112a42; color: #dfe9f1; }
.nav .it.on { background: var(--navy-2); color: #fff; box-shadow: inset 3px 0 0 var(--teal); }
.nav .it.soon { color: #5f7690; cursor: default; }
.nav .it .soontag { margin-left: auto; font-size: 10px; color: #4f677f; }
.sidefoot {
  margin-top: auto; padding: 14px 18px; border-top: 1px solid var(--navy-line);
  font-size: 11px; color: #6d8399; line-height: 1.6;
}
.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.top {
  height: 56px; background: #fff; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px; gap: 16px; position: sticky; top: 0; z-index: 20;
}
.top .title { font-size: 16px; font-weight: 600; white-space: nowrap; }
.top .lhs { display: flex; align-items: center; gap: 14px; min-width: 0; }
.top .rhs { display: flex; align-items: center; gap: 10px; white-space: nowrap; }
.avatar {
  width: 28px; height: 28px; border-radius: 14px; background: var(--navy-2); color: #fff;
  display: flex; align-items: center; justify-content: center; font-size: 11.5px; font-weight: 600;
}
.subnav { display: flex; gap: 4px; }
.subnav a { padding: 6px 12px; border-radius: 6px; color: #5b6d7e; font-size: 12.5px; }
.subnav a.on { background: #eef4f4; color: var(--teal-dk); font-weight: 600; }
.bodywrap { padding: 22px 24px; display: flex; flex-direction: column; gap: 16px; }
.bodywrap.row { flex-direction: row; align-items: flex-start; }
.col-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 16px; }
.col-side { width: 306px; flex-shrink: 0; display: flex; flex-direction: column; gap: 16px; }

/* ---------------------------------------------------------------- cards */
.card { background: var(--card); border: 1px solid var(--line); border-radius: 8px; }
.card.pad { padding: 14px 16px; }
.ch {
  padding: 12px 16px; border-bottom: 1px solid var(--line-soft);
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; font-weight: 600;
}
.ch .sub { font-weight: 400; color: var(--muted-2); font-size: 12px; }
.grid4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px 16px; }
.kpi { padding: 15px 16px; }
.kpi .lbl { color: var(--muted); font-size: 12px; }
.kpi .val {
  font-family: 'IBM Plex Mono', ui-monospace, monospace; font-size: 24px; font-weight: 500;
  margin-top: 6px; letter-spacing: -.4px;
}
.kpi .val small { font-size: 13px; color: var(--muted-2); margin-left: 5px; font-weight: 400; }

/* --------------------------------------------------------------- tables */
table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
th {
  text-align: left; font-weight: 500; color: var(--muted); padding: 9px 12px;
  border-bottom: 1px solid var(--line); background: #f8fafb; white-space: nowrap;
}
td { padding: 9px 12px; border-bottom: 1px solid var(--line-row); white-space: nowrap; }
td.wrap, th.wrap { white-space: normal; }
tbody tr:last-child td { border-bottom: none; }
th.r, td.r, .num { text-align: right; }
.num { font-family: 'IBM Plex Mono', ui-monospace, monospace; white-space: nowrap; }
.mono { font-family: 'IBM Plex Mono', ui-monospace, monospace; }
.pos { color: var(--pos); }
.neg { color: var(--neg); }
.warnc { color: var(--warn); }
.zero { color: var(--muted-3); }
.empty { padding: 34px 14px; text-align: center; color: var(--muted-2); }
.tscroll { overflow-x: auto; }

/* -------------------------------------------------------------- controls */
.btn {
  height: 32px; padding: 0 13px; border-radius: 6px; border: 1px solid #d3dde4;
  background: #fff; color: #28394a; font: 500 12.5px 'IBM Plex Sans KR', sans-serif;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; cursor: pointer;
}
.btn:hover { background: #f7fafb; }
.btn.pri { background: var(--teal); border-color: var(--teal); color: #fff; }
.btn.pri:hover { background: #0d8a82; }
.btn.danger { color: var(--neg); border-color: #e6c9c6; }
.btn.danger:hover { background: #fdf5f4; }
.btn[disabled], .btn.off {
  color: var(--muted-3); background: #f7f9fa; border-color: #e4eaee; cursor: not-allowed;
}
.btn.lg { height: 38px; font-size: 13px; }
.btn.block { width: 100%; }
.chip {
  display: inline-flex; align-items: center; height: 21px; padding: 0 8px;
  border-radius: 11px; font-size: 11.5px; font-weight: 500;
}
.chip.gray { background: var(--line-soft); color: var(--ink-2); }
.chip.teal { background: #e3f4f2; color: var(--teal-dk); }
.chip.blue { background: #e6eef7; color: #29558a; }
.chip.blue2 { background: #eef4f9; color: #29558a; }
.chip.amber { background: #fbf1e0; color: var(--warn); }
.chip.red { background: #fdf2f2; color: var(--neg); }
.chip.slate { background: #f1f4f7; color: #56697a; }
.inp {
  height: 32px; border: 1px solid #d3dde4; border-radius: 6px; padding: 0 10px;
  background: #fff; color: var(--ink); font: 400 12.5px 'IBM Plex Sans KR', sans-serif;
}
.inp:focus { outline: none; border-color: var(--teal); box-shadow: 0 0 0 2px rgba(15,154,145,.14); }
.inp[readonly], .inp[disabled] { background: #f7f9fa; color: var(--muted); }
textarea.inp { height: auto; padding: 8px 10px; resize: vertical; }
select.inp {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, #8b9aa9 50%),
                    linear-gradient(135deg, #8b9aa9 50%, transparent 50%);
  background-position: calc(100% - 15px) 14px, calc(100% - 10px) 14px;
  background-size: 5px 5px, 5px 5px; background-repeat: no-repeat; padding-right: 26px;
}
.fld { display: flex; flex-direction: column; gap: 6px; }
.fld > span { color: var(--muted); font-size: 12px; }
.fld .inp { width: 100%; }
.cellinp { width: 100%; height: 30px; }
.search { position: relative; display: flex; align-items: center; }
.search svg { position: absolute; left: 10px; }
.search .inp { padding-left: 30px; }
.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.toolbar .right { margin-left: auto; display: flex; gap: 8px; }
.check { display: flex; align-items: center; gap: 6px; color: var(--ink-2); }
.check input { width: 14px; height: 14px; accent-color: var(--teal); }
.seg { display: flex; height: 32px; border: 1px solid #d3dde4; border-radius: 6px; overflow: hidden; }
.seg label {
  flex: 1; display: flex; align-items: center; justify-content: center;
  font-size: 12.5px; color: #5b6d7e; cursor: pointer; user-select: none;
}
.seg input { display: none; }
.seg input:checked + label { background: var(--teal); color: #fff; font-weight: 500; }
.hint { color: var(--muted-2); font-size: 11.5px; line-height: 1.7; }
.rowlbl { display: flex; justify-content: space-between; }
.rowlbl > span:first-child { color: var(--muted); }
.hr { height: 1px; background: var(--line-soft); }

/* --------------------------------------------------------------- flashes */
.flashes { padding: 12px 24px 0; display: flex; flex-direction: column; gap: 8px; }
.flash {
  border-radius: 6px; padding: 10px 13px; font-size: 12.5px; border: 1px solid;
  display: flex; gap: 8px; align-items: flex-start;
}
.flash.ok { background: #eefaf7; border-color: #bfe4de; color: #0a6a62; }
.flash.error { background: #fdf2f2; border-color: #eccfcc; color: var(--neg); }
.flash.warn { background: #fdf7ec; border-color: #eddfc2; color: var(--warn); }
.flash.info { background: #eef4f9; border-color: #cfdcea; color: #29558a; }

/* ----------------------------------------------------------- login page */
.login { display: flex; min-height: 100vh; }
.login .panel {
  width: 620px; flex-shrink: 0; background: var(--navy);
  display: flex; align-items: center; justify-content: center;
}
.login .form { flex: 1; display: flex; align-items: center; justify-content: center; padding: 24px; }
.login .box { width: 372px; }
.msbtn {
  margin-top: 26px; width: 100%; height: 48px; border: 1px solid #d3dde4; border-radius: 6px;
  background: #fff; display: flex; align-items: center; justify-content: center; gap: 11px;
  font: 600 14px 'IBM Plex Sans KR', sans-serif; color: var(--ink); cursor: pointer;
}
.msbtn:hover { background: #f7fafb; }

/* ------------------------------------------------------------- stepper */
.stepper { padding: 16px 18px; display: flex; align-items: center; }
.stepper .st { display: flex; align-items: center; gap: 10px; }
.stepper .st .t { font-weight: 600; }
.stepper .st .d { color: var(--muted-2); font-size: 11.5px; }
.stepper .bar { flex: 1; height: 2px; background: var(--line); margin: 0 16px; }
.stepper .bar.on { background: var(--teal); }
.dot {
  width: 24px; height: 24px; border-radius: 12px; background: #fff;
  border: 2px solid #dbe3ea; display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.dot.done { background: var(--teal); border-color: var(--teal); }
.dot.cur { border-color: var(--teal); }
.dot.cur i { width: 9px; height: 9px; border-radius: 5px; background: var(--teal); display: block; }
.dot.cancel { background: #fdf2f2; border-color: #e6c9c6; }

/* --------------------------------------------------------- case cards */
.cases { padding: 14px 16px; display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 12px; }
.case { border: 1px solid #dbe3ea; border-radius: 8px; padding: 12px 13px; cursor: pointer; display: block; }
.case .hd { display: flex; align-items: center; gap: 7px; font-weight: 600; }
.case .radio {
  width: 14px; height: 14px; border-radius: 7px; border: 1.5px solid #c2ccd6; display: inline-block;
}
.case .t2 { color: var(--ink-2); margin-top: 7px; }
.case .t3 { color: var(--muted-2); font-size: 11.5px; margin-top: 3px; }
.case input { display: none; }
.case.on { border: 1.5px solid var(--teal); background: #f4fbfa; }
.case.on .radio { border: 4px solid var(--teal); }
.case.ro { cursor: default; }

/* ------------------------------------------------------------- dropzone */
.drop {
  border: 1.5px dashed #c3d3d1; border-radius: 8px; background: #f7fbfb;
  padding: 20px 14px; text-align: center; cursor: pointer; display: block;
}
.drop.over { background: #eef8f7; border-color: var(--teal); }
.drop .t { margin-top: 8px; color: var(--ink-2); }
.progress { height: 6px; background: var(--line-soft); border-radius: 3px; margin-top: 12px; overflow: hidden; }
.progress > i { display: block; height: 6px; background: var(--teal); }
.lotrow > td { background: #fbfdfd; padding: 0 14px 12px 14px; }
.lotrow table { border: 1px solid #e6eef0; border-radius: 6px; overflow: hidden; }
.lotrow th { background: #f2f8f8; }
tr.expandable { cursor: pointer; }
tr.expandable.open { background: #f7fbfb; }
.caret { transition: transform .12s ease; display: inline-block; }
tr.expandable.open .caret { transform: rotate(90deg); }
.del { background: none; border: none; cursor: pointer; padding: 2px; line-height: 0; }

/* ------------------------------------------------- 재고 실사 (모바일 겸용) */
.count-table td, .count-table th { padding: 8px 10px; }
.count-table tr.diff td { background: #fdf7ec; }
.count-table tr.diff td.d { color: var(--warn); font-weight: 600; }
.count-table tr.ok td.d { color: var(--pos); }
.count-table .cnt { width: 88px; height: 34px; text-align: right; }
.count-table .cnt.filled { border-color: var(--teal); background: #f7fbfb; }
.mobonly { display: none; }
.binhead td {
  background: #eef4f4; font-weight: 600; color: var(--teal-dk);
  position: sticky; top: 56px; z-index: 5;
}
.stbar {
  position: sticky; bottom: 0; background: #fff; border-top: 1px solid var(--line);
  padding: 10px 16px; display: flex; gap: 8px; align-items: center; z-index: 10;
}
.stbar .grow { flex: 1; }

@media (max-width: 820px) {
  .app { display: block; }
  .side { display: none; }
  .main { min-height: 100vh; }
  .top { padding: 0 12px; height: auto; min-height: 52px; flex-wrap: wrap; gap: 6px; }
  .top .rhs { font-size: 12px; }
  .bodywrap { padding: 12px; gap: 12px; }
  .bodywrap.row { flex-direction: column; }
  .col-side { width: 100%; }
  .card { border-radius: 6px; }
  .count-table thead { display: none; }
  .count-table tr { display: block; border-bottom: 1px solid var(--line); padding: 8px 10px; }
  .count-table tr.binhead { padding: 6px 10px; }
  .count-table td { display: inline-block; border: none; padding: 2px 6px 2px 0; }
  .count-table td.part { display: block; font-weight: 600; font-size: 13.5px; }
  .count-table td.meta { color: var(--muted); font-size: 12px; }
  .count-table td.cntcell { display: block; margin-top: 6px; }
  .count-table .cnt { width: 110px; height: 40px; font-size: 16px; }  /* iOS 확대 방지 */
  .mobhide { display: none !important; }
  .mobonly { display: inline !important; }
  .stbar { flex-wrap: wrap; }
}

/* 삭제 확인 모달 — DELETE 입력 전까지 확인 버튼 비활성 (전표 삭제 전용) */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(13, 33, 53, 0.45);
  display: flex; align-items: center; justify-content: center; z-index: 100; padding: 16px;
}
.modal-box {
  background: var(--card); border-radius: 10px; width: 100%; max-width: 440px;
  box-shadow: 0 12px 32px rgba(13, 33, 53, 0.28); padding: 20px;
}
.modal-title { font: 600 15.5px 'IBM Plex Sans KR', sans-serif; color: var(--ink); margin-bottom: 10px; }
.modal-summary { margin: 0 0 10px; padding-left: 18px; color: var(--ink-2); font-size: 12.5px; line-height: 1.7; }
.modal-warning {
  background: #fdf5f4; border: 1px solid #e6c9c6; color: var(--neg);
  border-radius: 6px; padding: 9px 11px; font-size: 12.5px; line-height: 1.6; margin-bottom: 12px;
}
.modal-actions { display: flex; gap: 8px; margin-top: 12px; }
.modal-actions .btn { flex: 1; }
