@charset "utf-8";
/* ==========================================================================
   발주관리 시스템 — Design System
   기반: warm-editorial 팔레트를 업무용 밀도로 재조정
   원칙: 파란 계열 금지 / 그라디언트 금지 / 글래스 금지 / 이모지 금지
         그림자 대신 실선, 넓은 라운드 대신 좁은 라운드
   ========================================================================== */

@font-face {
  font-family: 'Pretendard';
  src: url('font/Pretendard-KR.woff2') format('woff2');
  font-weight: 100 900;
  font-display: swap;
}
@font-face {
  font-family: 'NanumMyeongjo';
  src: url('font/NanumMyeongjo-Regular.woff2') format('woff2');
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: 'NanumMyeongjo';
  src: url('font/NanumMyeongjo-Bold.woff2') format('woff2');
  font-weight: 700;
  font-display: swap;
}

:root {
  /* 표면 */
  --paper:      #FAF7F2;
  --surface:    #FFFFFF;
  --surface-2:  #F4F0E9;
  --surface-3:  #EDE7DD;

  /* 글자 */
  --ink:        #1C1A17;
  --ink-2:      #4A443C;
  --muted:      #857C72;
  --faint:      #A79E93;

  /* 선 */
  --line:       #E4DCD1;
  --line-2:     #D2C7B8;

  /* 강조 — 테라코타 계열 (파란색 대체) */
  --accent:      #A8432A;
  --accent-hov:  #8E3722;
  --accent-soft: #F7EDE8;
  --accent-line: #E3C4B8;

  /* 상태 */
  --forest:      #2F5B4F;
  --forest-soft: #E9F0ED;
  --amber:       #96660F;
  --amber-soft:  #FAF1DE;
  --danger:      #9B2C1F;
  --danger-soft: #FBEBE8;

  /* 형태 */
  --r-sm: 3px;
  --r:    5px;
  --r-lg: 8px;

  --sidebar-w: 236px;
  --header-h: 56px;

  --font-sans: 'Pretendard', -apple-system, BlinkMacSystemFont, 'Apple SD Gothic Neo', system-ui, sans-serif;
  --font-serif: 'NanumMyeongjo', 'Nanum Myeongjo', serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.6;
  -webkit-text-size-adjust: 100%;
  word-break: keep-all;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }

h1, h2, h3, h4 { margin: 0; font-weight: 700; line-height: 1.3; letter-spacing: -0.01em; }

/* 숫자는 항상 자릿수 정렬 */
.num, td.num, th.num, .amount {
  font-variant-numeric: tabular-nums;
  text-align: right;
  white-space: nowrap;
}
.amount-lg {
  font-family: var(--font-serif);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}

/* ==========================================================================
   로고 (adminplus)
   ========================================================================== */
.bj-lockup { display: inline-flex; align-items: center; gap: calc(var(--lg) * 0.34); }
.bj-lockup .bj-mark { flex: 0 0 auto; display: block; }
.bj-word {
  font-family: var(--font-sans);
  font-size: calc(var(--lg) * 0.92);
  letter-spacing: -0.035em;
  color: var(--ink);
  font-weight: 400;
  line-height: 1;
  white-space: nowrap;
}
.bj-word b { font-weight: 800; }

/* 아이콘 — 플렉스 안에서 찌그러지지 않게 크기를 못 박는다 */
.ic { flex: 0 0 auto; display: block; }
.btn .ic { width: 15px; height: 15px; }
.hamburger .ic { width: 18px; height: 18px; }

/* ==========================================================================
   레이아웃
   ========================================================================== */
.layout { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  flex: 0 0 var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.sidebar-brand {
  height: var(--header-h);
  display: flex; align-items: center; gap: 9px;
  padding: 0 18px;
  border-bottom: 1px solid var(--line);
  flex: 0 0 auto;
}
.sidebar-brand .mark { width: 22px; height: 22px; flex: 0 0 22px; }
.sidebar-brand .name {
  font-family: var(--font-serif);
  font-size: 17px; font-weight: 700; letter-spacing: -0.02em;
}
.sidebar-nav { padding: 12px 0 24px; flex: 1 1 auto; }
.nav-group-label {
  padding: 14px 18px 6px;
  font-size: 11px; font-weight: 700; letter-spacing: 0.08em;
  color: var(--faint); text-transform: none;
}
.nav-item {
  display: flex; align-items: center; gap: 9px;
  padding: 8px 18px;
  color: var(--ink-2); font-size: 13.5px;
  border-left: 2px solid transparent;
}
.nav-item:hover { background: var(--surface-2); text-decoration: none; color: var(--ink); }
.nav-item.on {
  background: var(--accent-soft);
  border-left-color: var(--accent);
  color: var(--accent); font-weight: 600;
}
.nav-item .ic { width: 15px; height: 15px; flex: 0 0 15px; opacity: .75; }
.nav-item.on .ic { opacity: 1; }
.nav-badge {
  margin-left: auto;
  background: var(--accent); color: #fff;
  font-size: 11px; font-weight: 700;
  padding: 1px 6px; border-radius: 999px;
  font-variant-numeric: tabular-nums;
}

.main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  height: var(--header-h);
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 12px;
  padding: 0 20px;
  position: sticky; top: 0; z-index: 30;
}
.topbar .crumb { font-size: 13px; color: var(--muted); }
.topbar .crumb strong { color: var(--ink); font-weight: 600; }
.topbar .spacer { flex: 1 1 auto; }
.topbar .who { font-size: 12.5px; color: var(--muted); }
.topbar .who b { color: var(--ink); font-weight: 600; }

.hamburger {
  display: none;
  width: 34px; height: 34px;
  border: 1px solid var(--line-2); background: var(--surface);
  border-radius: var(--r-sm); cursor: pointer;
  align-items: center; justify-content: center; padding: 0;
}

.content { padding: 22px 20px 64px; max-width: 1440px; width: 100%; }

.page-head {
  display: flex; align-items: flex-end; gap: 14px;
  margin-bottom: 18px; flex-wrap: wrap;
}
.page-head h1 {
  font-family: var(--font-serif);
  font-size: 24px; letter-spacing: -0.02em;
}
.page-head .sub { font-size: 13px; color: var(--muted); margin-top: 3px; }
.page-head .actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }

/* ==========================================================================
   버튼 — 파란색 없음, 그라디언트 없음
   ========================================================================== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 34px; padding: 0 14px;
  border: 1px solid var(--line-2);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--ink);
  font-family: inherit; font-size: 13.5px; font-weight: 600;
  cursor: pointer; white-space: nowrap;
  transition: background .12s ease, border-color .12s ease;
}
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn:active { background: var(--surface-3); }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hov); border-color: var(--accent-hov); }

.btn-confirm { background: var(--forest); border-color: var(--forest); color: #fff; }
.btn-confirm:hover { filter: brightness(.92); }

.btn-danger { color: var(--danger); border-color: var(--danger); background: var(--surface); }
.btn-danger:hover { background: var(--danger-soft); }

.btn-ghost { border-color: transparent; background: transparent; color: var(--ink-2); }
.btn-ghost:hover { background: var(--surface-2); }

.btn-sm { height: 28px; padding: 0 10px; font-size: 12.5px; }
.btn-lg { height: 42px; padding: 0 20px; font-size: 15px; }
.btn[disabled], .btn:disabled { opacity: .45; cursor: not-allowed; }

/* ==========================================================================
   폼
   ========================================================================== */
.field { margin-bottom: 14px; }
.field > label, .lbl {
  display: block; margin-bottom: 5px;
  font-size: 12.5px; font-weight: 600; color: var(--ink-2);
}
.req::after { content: '필수'; margin-left: 5px; font-size: 10.5px; font-weight: 700; color: var(--accent); }
.hint { margin-top: 5px; font-size: 12px; color: var(--muted); line-height: 1.5; }
.err-msg { margin-top: 5px; font-size: 12px; color: var(--danger); font-weight: 600; }

input[type=text], input[type=password], input[type=number], input[type=date],
input[type=email], input[type=tel], input[type=search], select, textarea {
  width: 100%;
  height: 36px; padding: 0 10px;
  border: 1px solid var(--line-2);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--ink);
  font-family: inherit; font-size: 14px;
  transition: border-color .12s ease, box-shadow .12s ease;
}
textarea { height: auto; min-height: 88px; padding: 9px 10px; line-height: 1.6; resize: vertical; }
select {
  appearance: none;
  padding-right: 30px;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'><path d='M2 4.5L6 8.5L10 4.5' stroke='%23857C72' stroke-width='1.5' fill='none' stroke-linecap='round'/></svg>");
  background-repeat: no-repeat;
  background-position: right 10px center;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
input::placeholder, textarea::placeholder { color: var(--faint); }
input[readonly], input:disabled, select:disabled {
  background: var(--surface-2); color: var(--muted); cursor: not-allowed;
}
.input-num { text-align: right; font-variant-numeric: tabular-nums; }

.check, .radio {
  display: inline-flex; align-items: center; gap: 7px;
  margin-right: 16px; font-size: 13.5px; cursor: pointer; color: var(--ink-2);
}
.check input, .radio input { width: 16px; height: 16px; accent-color: var(--accent); margin: 0; cursor: pointer; }

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 0 20px; }
.form-grid .span2 { grid-column: 1 / -1; }

/* ==========================================================================
   카드 / 패널
   ========================================================================== */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  margin-bottom: 16px;
}
.card-head {
  display: flex; align-items: center; gap: 10px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--line);
}
.card-head h2 { font-size: 14.5px; font-weight: 700; }
.card-head .actions { margin-left: auto; display: flex; gap: 7px; }
.card-body { padding: 16px; }
.card-body.tight { padding: 0; }
.card-foot {
  padding: 12px 16px; border-top: 1px solid var(--line);
  background: var(--surface-2);
  display: flex; gap: 8px; align-items: center;
  border-radius: 0 0 var(--r) var(--r);
}

/* 검색 바 */
.searchbar { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px; margin-bottom: 16px; }
.searchbar .row { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: flex-end; }
.searchbar .f { display: flex; flex-direction: column; gap: 5px; }
.searchbar .f > label { font-size: 12px; font-weight: 600; color: var(--muted); }
.searchbar .f input, .searchbar .f select { height: 34px; min-width: 130px; }
.searchbar .f.wide input { min-width: 230px; }
.searchbar .go { margin-left: auto; display: flex; gap: 7px; }

/* 요약 통계 */
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(168px, 1fr)); gap: 12px; margin-bottom: 18px; }
.stat {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r); padding: 14px 16px;
  display: block; color: inherit;
}
.stat:hover { border-color: var(--line-2); text-decoration: none; }
.stat .k { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.stat .v {
  font-family: var(--font-serif); font-weight: 700;
  font-size: 26px; letter-spacing: -0.02em; margin-top: 3px;
  font-variant-numeric: tabular-nums;
}
.stat .v small { font-family: var(--font-sans); font-size: 13px; font-weight: 600; color: var(--muted); margin-left: 2px; }
.stat.alert .v { color: var(--accent); }

/* ==========================================================================
   테이블
   ========================================================================== */
.table-wrap { width: 100%; overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.tbl th, table.tbl td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left; vertical-align: middle;
}
table.tbl thead th {
  background: var(--surface-2);
  font-size: 12.5px; font-weight: 700; color: var(--ink-2);
  white-space: nowrap;
  border-bottom: 1px solid var(--line-2);
  /* sticky 는 border-collapse:collapse 와 충돌해 첫 행을 덮는다. 목록은 20건씩 끊으므로 고정하지 않는다. */
}
table.tbl tbody tr:hover { background: #FCFAF6; }
table.tbl tbody tr.sel { background: var(--accent-soft); }
table.tbl td.num, table.tbl th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.tbl td.ctr, table.tbl th.ctr { text-align: center; }
table.tbl .pd-name { font-weight: 600; color: var(--ink); }
table.tbl .sub { display: block; font-size: 12px; color: var(--muted); margin-top: 1px; }

.empty { padding: 56px 20px; text-align: center; color: var(--muted); }
.empty .t { font-family: var(--font-serif); font-size: 17px; color: var(--ink-2); margin-bottom: 6px; }
.empty .d { font-size: 13px; line-height: 1.7; }
.empty .btn { margin-top: 16px; }

/* 상태 뱃지 */
.tag {
  display: inline-block; padding: 2px 8px;
  border-radius: 999px; font-size: 11.5px; font-weight: 700;
  border: 1px solid transparent; white-space: nowrap;
}
.tag-gray   { background: var(--surface-3); color: var(--ink-2); }
.tag-accent { background: var(--accent-soft); color: var(--accent); border-color: var(--accent-line); }
.tag-forest { background: var(--forest-soft); color: var(--forest); border-color: #C7DAD3; }
.tag-amber  { background: var(--amber-soft); color: var(--amber); border-color: #E8D5AC; }
.tag-danger { background: var(--danger-soft); color: var(--danger); border-color: #EBC4BE; }

/* 페이지네이션 */
.pager { display: flex; gap: 4px; justify-content: center; align-items: center; padding: 16px 0; flex-wrap: wrap; }
.pager a, .pager span {
  min-width: 32px; height: 32px; padding: 0 9px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--line-2); border-radius: var(--r-sm);
  font-size: 13px; color: var(--ink-2); background: var(--surface);
  font-variant-numeric: tabular-nums;
}
.pager a:hover { background: var(--surface-2); text-decoration: none; }
.pager .on { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 700; }
.pager .dots { border: 0; background: none; color: var(--faint); }

/* 알림 배너 */
.notice {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 11px 14px; border-radius: var(--r);
  border: 1px solid var(--line-2); background: var(--surface-2);
  font-size: 13px; margin-bottom: 16px; line-height: 1.6;
}
.notice.warn { background: var(--amber-soft); border-color: #E8D5AC; color: #6B4A0B; }
.notice.err  { background: var(--danger-soft); border-color: #EBC4BE; color: var(--danger); }
.notice.ok   { background: var(--forest-soft); border-color: #C7DAD3; color: var(--forest); }
.notice b { font-weight: 700; }

/* 토스트 */
#toast-area { position: fixed; right: 18px; bottom: 18px; z-index: 200; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: var(--ink); color: #F7F3EC;
  padding: 11px 16px; border-radius: var(--r);
  font-size: 13.5px; font-weight: 600;
  box-shadow: 0 3px 14px rgba(28,26,23,.18);
  animation: toast-in .18s ease-out;
}
.toast.err { background: var(--danger); }
@keyframes toast-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* 유틸 */
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.right { text-align: right; }
.mt0{margin-top:0}.mt8{margin-top:8px}.mt16{margin-top:16px}.mt24{margin-top:24px}
.mb0{margin-bottom:0}.mb8{margin-bottom:8px}.mb16{margin-bottom:16px}
.flex { display: flex; gap: 8px; align-items: center; }
.flex-wrap { flex-wrap: wrap; }
.hr { height: 1px; background: var(--line); border: 0; margin: 18px 0; }
.nowrap { white-space: nowrap; }

/* 모바일 서랍 오버레이 */
.scrim { display: none; position: fixed; inset: 0; background: rgba(28,26,23,.42); z-index: 40; }
.scrim.on { display: block; }

/* ==========================================================================
   반응형 — 태블릿
   ========================================================================== */
@media (max-width: 1024px) {
  .form-grid { grid-template-columns: 1fr; }
  .content { padding: 18px 16px 56px; }
}

/* ==========================================================================
   반응형 — 모바일
   ========================================================================== */
@media (max-width: 768px) {
  :root { --header-h: 52px; }
  body { font-size: 15px; }

  .hamburger { display: inline-flex; width: 40px; height: 40px; }

  .sidebar {
    position: fixed; left: 0; top: 0; bottom: 0;
    z-index: 50; height: 100dvh;
    transform: translateX(-100%);
    transition: transform .2s ease;
    box-shadow: 2px 0 16px rgba(28,26,23,.12);
    width: 272px; flex-basis: 272px;
  }
  .sidebar.open { transform: none; }
  .nav-item { padding: 12px 18px; font-size: 15px; }
  .nav-group-label { padding-top: 16px; }

  .content { padding: 16px 14px 72px; }
  .page-head h1 { font-size: 21px; }
  .page-head .actions { margin-left: 0; width: 100%; }
  .page-head .actions .btn { flex: 1 1 auto; }

  /* 터치 타깃 확보 */
  .btn { height: 42px; padding: 0 16px; font-size: 14.5px; }
  .btn-sm { height: 36px; font-size: 13.5px; }
  input[type=text], input[type=password], input[type=number], input[type=date],
  input[type=email], input[type=tel], input[type=search], select {
    height: 44px; font-size: 16px; /* iOS 자동 확대 방지 */
  }

  /* 카드 머리의 버튼이 잘리지 않도록 아래로 흘린다 */
  .card-head { flex-wrap: wrap; }
  .card-head .actions { margin-left: 0; width: 100%; }
  .card-head .actions .btn,
  .card-head .actions select { flex: 1 1 auto; min-width: 0; }

  .searchbar .row { flex-direction: column; align-items: stretch; }
  .searchbar .f { width: 100%; }
  .searchbar .f input, .searchbar .f select { min-width: 0; width: 100%; }
  .searchbar .go { margin-left: 0; }
  .searchbar .go .btn { flex: 1 1 auto; }

  .stat-row { grid-template-columns: repeat(2, minmax(0,1fr)); gap: 10px; }
  .stat { padding: 12px 13px; }
  .stat .v { font-size: 22px; }

  /* 표 → 카드 변환 */
  table.tbl thead { display: none; }
  table.tbl, table.tbl tbody, table.tbl tr, table.tbl td { display: block; width: 100%; }
  table.tbl tr {
    border: 1px solid var(--line); border-radius: var(--r);
    margin-bottom: 10px; padding: 4px 0; background: var(--surface);
  }
  table.tbl td {
    border: 0; border-bottom: 1px dashed var(--line);
    display: flex; gap: 12px; align-items: baseline;
    padding: 8px 13px; text-align: left !important;
  }
  table.tbl tr td:last-child { border-bottom: 0; }
  table.tbl td::before {
    content: attr(data-label);
    flex: 0 0 84px;
    font-size: 12px; font-weight: 700; color: var(--muted);
  }
  table.tbl td { flex-wrap: wrap; }
  /* 보조 설명은 눌리지 않게 다음 줄로 내린다 */
  table.tbl td .sub { flex: 1 0 100%; margin: 2px 0 0 96px; }
  table.tbl td.num { justify-content: flex-start; }
  table.tbl td.num > * , table.tbl td.num { font-variant-numeric: tabular-nums; }
  table.tbl td[data-label=""]::before { display: none; }

  #toast-area { left: 14px; right: 14px; bottom: 14px; }
  .toast { text-align: center; }
}

/* 인쇄 (거래명세서·발주서) */
@media print {
  .sidebar, .topbar, .searchbar, .page-head .actions, .pager, .no-print { display: none !important; }
  body { background: #fff; font-size: 12px; }
  .content { padding: 0; max-width: none; }
  .card { border: 1px solid #999; break-inside: avoid; }
  table.tbl th { background: #eee !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
