@import url('https://cdn.jsdelivr.net/gh/orioncactus/pretendard@v1.3.9/dist/web/static/pretendard.min.css');

:root {
  /* 홈페이지(brandexinc.com)와 같은 팔레트: 네이비 · 민트 · 크라프트 */
  --ink: #142235;
  --ink-2: #4D5D72;
  --ink-3: #8592A6;
  --line: #D9DFE7;
  --bg: #F3F5F8;
  --card: #ffffff;
  --brand: #0F2847;        /* navy */
  --brand-2: #173761;      /* navy-2 */
  --brand-tint: #E8EDF5;
  --accent: #00C896;       /* mint — 주요 행동 버튼·선택 */
  --accent-ink: #007A5C;   /* mint 글자색 */
  --accent-tint: #E6F8F2;
  --accent-line: #9FDCBF;
  --kraft: #C9A47A;
  --kraft-tint: #F6EEE4;
  --ok: #007A5C;
  --warn: #B07A10;
  --bad: #C8423B;
  --info: #173761;
  --slot-free: #E6F8F2;
  --slot-free-b: #9FDCBF;
  --slot-res: #FFF2D6;
  --slot-res-b: #E9C46A;
  --slot-occ: #E3E8EF;
  --slot-occ-b: #B9C3D1;
  --slot-mine: #DCE4F0;
  --slot-mine-b: #0F2847;
  --slot-block: #F1F3F6;
  --radius: 10px;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: 'Pretendard', -apple-system, 'Apple SD Gothic Neo', 'Malgun Gothic', sans-serif;
  color: var(--ink); background: var(--bg); font-size: 14px; line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--brand-2); }
h1, h2, h3, h4 { margin: 0 0 .5em; line-height: 1.3; letter-spacing: -0.01em; }
h2 { font-size: 20px; } h3 { font-size: 16px; } h4 { font-size: 14px; }
.muted { color: var(--ink-3); } .small { font-size: 12px; }
.hidden { display: none !important; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
@media (max-width: 720px) { .grid2, .grid3 { grid-template-columns: 1fr; } }

/* ---------- 레이아웃 ---------- */
.topbar {
  background: var(--brand); color: #fff; height: 56px; padding: 0 20px;
  display: flex; align-items: center; gap: 16px; position: sticky; top: 0; z-index: 20;
}
.topbar .logo { font-weight: 800; letter-spacing: -0.5px; font-size: 19px; color: #fff; text-decoration: none; }
.logo b { color: var(--accent); font-weight: 800; }
.topbar .logo small { font-weight: 500; letter-spacing: 0; opacity: .7; margin-left: 8px; font-size: 12px; }
.topbar .who { font-size: 13px; opacity: .85; }
.topbar button { background: rgba(255,255,255,.12); color: #fff; border: 0; }
.topbar button:hover { background: rgba(255,255,255,.22); }

.shell { display: grid; grid-template-columns: 210px minmax(0, 1fr); min-height: calc(100vh - 56px); }
.side { background: #fff; border-right: 1px solid var(--line); padding: 16px 10px; }
.side button.nav {
  display: flex; width: 100%; text-align: left; background: none; border: 0; padding: 10px 12px;
  border-radius: 8px; color: var(--ink-2); font-weight: 500; gap: 8px; align-items: center;
}
.side button.nav:hover { background: var(--bg); }
.side button.nav.active { background: var(--brand-tint); color: var(--brand); font-weight: 700; box-shadow: inset 3px 0 0 var(--accent); }
.side .badge { margin-left: auto; }
.main { padding: 24px; max-width: 1280px; width: 100%; }
@media (max-width: 860px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .side { display: flex; overflow-x: auto; padding: 8px; border-right: 0; border-bottom: 1px solid var(--line); }
  .side button.nav { width: auto; white-space: nowrap; }
  .main { padding: 16px; }
}

/* ---------- 카드·통계 ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin-bottom: 16px; }
.card-h { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.card-h h3 { margin: 0; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.stat .label { color: var(--ink-3); font-size: 12px; }
.stat .value { font-size: 24px; font-weight: 800; margin-top: 4px; letter-spacing: -0.02em; }
.stat .value small { font-size: 13px; font-weight: 500; color: var(--ink-3); margin-left: 2px; }
.stat.alert .value { color: var(--bad); }

/* ---------- 폼·버튼 ---------- */
button, .btn {
  font: inherit; font-weight: 600; border-radius: 8px; padding: 8px 14px; cursor: pointer;
  border: 1px solid var(--line); background: #fff; color: var(--ink); text-decoration: none; display: inline-block;
}
button:hover { border-color: #c9ced8; }
button:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--brand); color: #fff; border-color: var(--brand); }
.btn-primary:hover { background: var(--brand-2); }
.btn-accent { background: var(--accent); color: var(--brand); border-color: var(--accent); font-weight: 700; }
.btn-accent:hover { background: #12D7A4; border-color: #12D7A4; }
.btn-accent:disabled { background: #BFE9DB; border-color: #BFE9DB; color: #5E7A72; }
.btn-ok { background: var(--ok); color: #fff; border-color: var(--ok); }
.btn-bad { background: #fff; color: var(--bad); border-color: #EBC3C0; }
.btn-sm { padding: 5px 10px; font-size: 12px; }
label.f { display: block; font-size: 12px; font-weight: 600; color: var(--ink-2); margin-bottom: 10px; }
label.f > span.req::after { content: ' *'; color: var(--bad); }
input, select, textarea {
  font: inherit; width: 100%; padding: 9px 11px; border: 1px solid var(--line); border-radius: 8px;
  background: #fff; color: var(--ink); margin-top: 4px;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent-line); border-color: var(--brand-2); }
input[type=checkbox], input[type=radio] { width: auto; margin: 0 6px 0 0; }
textarea { min-height: 70px; resize: vertical; }
.check { display: flex; align-items: flex-start; gap: 6px; font-size: 13px; margin: 6px 0; }
.check input { margin-top: 3px; }

/* ---------- 표 ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; color: var(--ink-3); font-weight: 600; font-size: 12px; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tr.click { cursor: pointer; } tr.click:hover td { background: #fafbfc; }
.empty { text-align: center; color: var(--ink-3); padding: 28px 10px; }

/* ---------- 상태 배지 ---------- */
.badge { display: inline-block; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 99px; white-space: nowrap; background: #eef0f3; color: var(--ink-2); }
.b-ok { background: var(--accent-tint); color: var(--ok); }
.b-warn { background: #FFF2D6; color: #93620A; }
.b-bad { background: #FBE9E7; color: var(--bad); }
.b-info { background: var(--brand-tint); color: var(--info); }
.b-dark { background: var(--brand); color: #fff; }

/* ---------- 창고 도식 ---------- */
.wh-legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--ink-2); margin-bottom: 12px; }
.wh-legend i { display: inline-block; width: 14px; height: 14px; border-radius: 3px; vertical-align: -2px; margin-right: 4px; border: 1px solid; }
.wh-floor { border: 2px dashed #c3c9d3; border-radius: 12px; padding: 16px; background: repeating-linear-gradient(45deg, #fafbfc, #fafbfc 10px, #f6f7f9 10px, #f6f7f9 20px); }
.wh-dock { text-align: center; font-size: 12px; font-weight: 700; color: var(--ink-3); letter-spacing: .1em; padding: 6px; border: 1px solid #d5d9e0; background: #fff; border-radius: 6px; margin-top: 12px; }
.wh-zone { margin-bottom: 18px; }
.wh-zone-h { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; }
.wh-zone-h b { font-size: 14px; }
.wh-racks { display: flex; gap: 14px; flex-wrap: wrap; }
.wh-rack { background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 8px; }
.wh-rack-name { font-size: 11px; font-weight: 700; color: var(--ink-2); margin-bottom: 6px; }
.wh-grid { display: grid; gap: 4px; }
.wh-level { display: flex; gap: 4px; align-items: center; }
.wh-level .lv { width: 22px; font-size: 10px; color: var(--ink-3); text-align: right; padding-right: 2px; }
.slot {
  border: 1.5px solid; border-radius: 5px; font-size: 10px; display: flex; align-items: center; justify-content: center;
  cursor: default; user-select: none; position: relative; font-weight: 600; color: var(--ink-2); padding: 0;
}
.slot.shelf { width: 38px; height: 30px; }
.slot.half { width: 50px; height: 40px; }
.slot.pallet { width: 62px; height: 50px; }
.slot.available { background: var(--slot-free); border-color: var(--slot-free-b); }
.slot.reserved { background: var(--slot-res); border-color: var(--slot-res-b); }
.slot.occupied { background: var(--slot-occ); border-color: var(--slot-occ-b); color: var(--ink-3); }
.slot.blocked { background: var(--slot-block); border-color: #D3D9E2; border-style: dashed; color: #AEB7C4; }
.slot.mine { background: var(--slot-mine); border-color: var(--slot-mine-b); color: var(--info); }
.slot.unavail { background: #E9EDF2; border-color: #D3D9E2; color: #AEB7C4; }
.slot.pick { cursor: pointer; }
.slot.pick:hover { transform: translateY(-1px); box-shadow: 0 2px 6px rgba(0,0,0,.12); }
.slot.selected { background: var(--accent); border-color: var(--accent-ink); color: var(--brand); font-weight: 800; }
.slot.admin { cursor: pointer; }

.select-panel { position: sticky; top: 72px; }
.chip { display: inline-flex; align-items: center; gap: 6px; background: var(--accent-tint); color: var(--accent-ink); border: 1px solid var(--accent-line); border-radius: 99px; padding: 3px 10px; font-size: 12px; font-weight: 700; margin: 0 6px 6px 0; }
.chip button { border: 0; background: none; padding: 0; color: inherit; font-size: 14px; line-height: 1; }

/* ---------- 창고 도면 (실제 배치) ---------- */
.fp-wrap { max-width: 640px; margin: 0 auto; padding-top: 26px; }
.fp { position: relative; width: 100%; border: 3px solid var(--ink-2); border-radius: 4px; background: #fbfcfd; }
.fp > * { position: absolute; }
.fp-door { top: -27px; height: 24px; background: var(--brand); color: #fff; font-size: 12px; font-weight: 700; display: flex; align-items: center; justify-content: center; border-radius: 3px 3px 0 0; }
.fp-room { border: 1px solid var(--line); background: #fff; display: flex; align-items: center; justify-content: center; text-align: center; padding: 2px; }
.fp-room span { font-size: clamp(10px, 1.6vw, 13px); color: var(--ink-3); }
.fp-rack { border: 1.5px solid #9DB0CB; background: var(--brand-tint); color: var(--ink); padding: 2px; margin: 0; border-radius: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; text-align: center; overflow: hidden; font: inherit; cursor: pointer; }
.fp-rack.pallet { background: var(--kraft-tint); border-color: var(--kraft); }
.fp-rack b { font-size: clamp(11px, 1.9vw, 15px); font-weight: 800; }
.fp-rack small { font-size: clamp(9px, 1.4vw, 11px); line-height: 1.2; color: var(--ink-2); }
.fp-rack .fp-cnt { font-weight: 700; color: var(--ok); }
.fp-rack.full .fp-cnt { color: var(--ink-3); }
.fp-rack.full { background-color: #ECEFF3; }
.fp-rack .fp-bar { position: absolute; left: 0; bottom: 0; height: 4px; background: var(--slot-free-b); }
.fp-rack:hover { box-shadow: inset 0 0 0 2px var(--brand-2); z-index: 1; }
.fp-rack.open { box-shadow: inset 0 0 0 3px var(--accent-ink); z-index: 2; }
.fp-rack.has-mine::after { content: ''; position: absolute; top: 4px; right: 4px; width: 8px; height: 8px; border-radius: 50%; background: var(--slot-mine-b); }
.fp-rack.has-sel::before { content: ''; position: absolute; top: 4px; left: 4px; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.fp-detail { margin-top: 14px; border: 1px solid var(--line); border-radius: 10px; padding: 14px; background: #fff; }
.fp-detail-h { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.fp-detail-h b { font-size: 16px; }
.fp-elev { overflow-x: auto; display: grid; gap: 4px; padding-bottom: 4px; }
.fp-elev .wh-level { min-width: max-content; }
.fp-elev .slot { flex: 1 1 0; min-width: 26px; max-width: 62px; }
@media (min-width: 521px) { .fp-elev .wh-level { min-width: 0; } }
@media (max-width: 520px) { .fp-rack .fp-kind { display: none; } }

/* ---------- 모달·토스트 ---------- */
.modal-bg { position: fixed; inset: 0; background: rgba(15, 20, 30, .45); display: flex; align-items: flex-start; justify-content: center; z-index: 100; padding: 40px 16px; overflow-y: auto; }
.modal { background: #fff; border-radius: 14px; width: 100%; max-width: 680px; padding: 22px; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.modal.wide { max-width: 920px; }
.modal-h { display: flex; align-items: center; margin-bottom: 14px; }
.modal-h h3 { margin: 0; flex: 1; }
.modal-h .x { border: 0; font-size: 20px; padding: 2px 8px; }
.modal-f { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }
.kv { display: grid; grid-template-columns: 130px 1fr; gap: 6px 12px; font-size: 13px; }
.kv dt { color: var(--ink-3); } .kv dd { margin: 0; }
.notice { background: #F5F7FA; border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; font-size: 13px; color: var(--ink-2); }
.notice.warn { background: #FFF8E8; border-color: #EED9A4; }
.notice.ok { background: var(--accent-tint); border-color: var(--accent-line); }
.notice.mint { background: var(--accent-tint); border-color: var(--accent-line); }
.terms-box { max-height: 160px; overflow-y: auto; font-size: 12px; background: #fafbfc; border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; color: var(--ink-2); white-space: pre-line; }
#toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: center; }
#toast div { background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 8px; font-size: 13px; box-shadow: 0 6px 20px rgba(0,0,0,.2); }
#toast div.err { background: var(--bad); }

/* ---------- 로그인 ---------- */
.auth-wrap { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; }
.auth-hero { background: var(--brand); color: #fff; padding: 56px; display: flex; flex-direction: column; justify-content: space-between; }
.auth-hero h1 { font-size: 32px; margin: 24px 0 12px; }
.auth-hero ul { padding-left: 18px; opacity: .85; line-height: 2; }
.auth-form { padding: 56px 40px; display: flex; align-items: flex-start; justify-content: center; background: #fff; }
.auth-form .box { width: 100%; max-width: 440px; }
.tabs { display: flex; border-bottom: 1px solid var(--line); margin-bottom: 20px; }
.tabs button { border: 0; border-radius: 0; background: none; padding: 10px 16px; color: var(--ink-3); border-bottom: 2px solid transparent; }
.tabs button.active { color: var(--brand); border-bottom-color: var(--brand); }
@media (max-width: 860px) { .auth-wrap { grid-template-columns: 1fr; } .auth-hero { padding: 32px 20px; } .auth-form { padding: 28px 16px; } }

/* ---------- 청구서 인쇄 ---------- */
.invoice-doc { border: 1px solid var(--line); border-radius: 8px; padding: 20px; }
.invoice-doc .total { font-size: 20px; font-weight: 800; text-align: right; margin-top: 10px; }
@media print {
  body * { visibility: hidden; }
  .printable, .printable * { visibility: visible; }
  .printable { position: absolute; left: 0; top: 0; width: 100%; }
  .no-print { display: none !important; }
}

/* ---------- 청구 기준 목록 ---------- */
.rules { margin: 0; padding-left: 18px; font-size: 13px; color: var(--ink-2); }
.rules li { margin: 6px 0; }
.rules b { color: var(--ink); margin-right: 4px; }
