/* =========================================================
   Pedolign 재고/거래 관리 - 프로토타입 스타일
   반응형 기준: 900px (이하 모바일 / 초과 PC)
   페이지 전환은 CSS(:target)만으로 구현
   ========================================================= */

:root {
  --bg: #f4f5f7;
  --surface: #ffffff;
  --text: #1c2330;
  --muted: #6b7587;
  --line: #e3e6ec;
  --primary: #1f4fd8;
  --primary-soft: #e8eefc;
  --in: #c2410c;       /* 매입 */
  --in-bg: #fff1e6;
  --out: #0f766e;      /* 매출 */
  --out-bg: #e2f6f3;
  --ret: #6b7587;      /* 기타 */
  --ret-bg: #eceff4;
  --radius: 12px;
  --sidebar-w: 200px;
  --tabbar-h: 62px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: "Pretendard", "Apple SD Gothic Neo", "Malgun Gothic", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
}

a { color: inherit; text-decoration: none; }

/* ---------- 브랜드 / 상단바 ---------- */
.brand { font-weight: 800; letter-spacing: -0.02em; color: var(--primary); }

.topbar { display: none; }

/* ---------- 메뉴 (PC 기본: 좌측 사이드바) ---------- */
.menu {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--line);
  padding: 24px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.menu-brand { padding: 4px 10px 22px; }
.menu-brand .brand { display: block; font-size: 22px; }
.menu-brand small { color: var(--muted); font-size: 12px; }

.menu-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 12px;
  border-radius: 10px;
  color: var(--muted);
  font-weight: 600;
  transition: background .15s, color .15s;
}
.menu-link svg { width: 20px; height: 20px; fill: currentColor; flex: none; }
.menu-link:hover { background: var(--bg); color: var(--text); }

/* ---------- 본문 ---------- */
.content {
  margin-left: var(--sidebar-w);
  padding: 36px 32px 60px;
  max-width: calc(var(--sidebar-w) + 1000px);
}

/* 페이지 전환: 기본 숨김 → :target 이면 표시 */
.page { display: none; }
.page:target { display: block; }
/* 주소에 해시가 없을 때는 '거래 등록'을 기본으로 */
.content:not(:has(.page:target)) .page-default { display: block; }

/* 현재 메뉴 강조 */
body:has(#partners:target) .menu-link[data-page="partners"],
body:has(#types:target)    .menu-link[data-page="types"],
body:has(#items:target)    .menu-link[data-page="items"],
body:has(#products:target)   .menu-link[data-page="products"],
body:has(#warehouses:target) .menu-link[data-page="warehouses"],
body:has(#trade:target)    .menu-link[data-page="trade"],
body:not(:has(.page:target)) .menu-link[data-page="trade"] {
  background: var(--primary-soft);
  color: var(--primary);
}

.page-title { font-size: 24px; letter-spacing: -0.02em; }
.page-desc { color: var(--muted); margin: 4px 0 20px; }

.section-title {
  font-size: 16px;
  margin: 30px 0 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.count {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  background: var(--ret-bg);
  padding: 2px 9px;
  border-radius: 999px;
}

/* ---------- 카드 ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

/* ---------- 폼 ---------- */
.form {
  padding: 22px;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px 18px;
}
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field-wide { grid-column: 1 / -1; }

.field label { font-size: 13px; font-weight: 700; }
.field label em { font-style: normal; font-weight: 400; color: var(--muted); }

input, select {
  font: inherit;
  color: inherit;
  width: 100%;
  height: 44px;
  padding: 0 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}
input.money { text-align: right; font-weight: 700; }
input.money-total { font-size: 18px; background: var(--primary-soft); border-color: transparent; color: var(--primary); }

.form-actions {
  grid-column: 1 / -1;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 4px;
}

.btn {
  font: inherit;
  font-weight: 700;
  height: 44px;
  padding: 0 22px;
  border-radius: 10px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: filter .15s, background .15s;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { filter: brightness(1.08); }
.btn-ghost { background: var(--surface); border-color: var(--line); color: var(--muted); }
.btn-ghost:hover { background: var(--bg); }

/* ---------- 테이블 ---------- */
.list { overflow-x: auto; }

.table { width: 100%; border-collapse: collapse; }
.table th {
  text-align: left;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  background: #fafbfc;
  padding: 11px 16px;
  border-bottom: 1px solid var(--line);
}
.table td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--line);
}
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: #fafbfd; }
.num { text-align: right !important; font-variant-numeric: tabular-nums; font-weight: 700; }
.act { width: 48px; text-align: center; }

.icon-btn {
  width: 30px; height: 30px;
  border: 0; border-radius: 8px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}
.icon-btn:hover { background: #fde8e8; color: #c62828; }

/* 배지 */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}
.badge-in  { color: var(--in);  background: var(--in-bg); }
.badge-out { color: var(--out); background: var(--out-bg); }
.badge-note { color: var(--muted); background: var(--bg); }
.badge-ret { color: var(--ret); background: var(--ret-bg); }
.badge-wh  { color: var(--primary); background: var(--primary-soft); }

.table .sub { display: block; font-size: 12px; font-weight: 400; color: var(--muted); }
.table-partner td { vertical-align: top; }
.table-trade td { white-space: nowrap; }
.table-trade td.total { color: var(--text); }


/* =========================================================
   모바일 (900px 이하)
   - 사이드바 → 하단 탭바
   - 폼 1열
   - 테이블 → 카드형 리스트
   ========================================================= */
@media (max-width: 900px) {

  body { font-size: 15px; }

  .topbar {
    display: flex;
    align-items: baseline;
    gap: 8px;
    position: sticky;
    top: 0;
    z-index: 10;
    height: 52px;
    padding: 0 16px;
    align-items: center;
    background: var(--surface);
    border-bottom: 1px solid var(--line);
  }
  .topbar .brand { font-size: 18px; }
  .topbar-sub { color: var(--muted); font-size: 12px; }

  /* 하단 탭바 */
  .menu {
    inset: auto 0 0 0;
    width: 100%;
    height: var(--tabbar-h);
    flex-direction: row;
    gap: 0;
    padding: 0 4px env(safe-area-inset-bottom);
    border-right: 0;
    border-top: 1px solid var(--line);
    z-index: 20;
  }
  .menu-brand { display: none; }
  .menu-link {
    flex: 1;
    flex-direction: column;
    justify-content: center;
    gap: 3px;
    padding: 6px 2px;
    font-size: 11px;
    border-radius: 8px;
  }
  .menu-link svg { width: 22px; height: 22px; }

  .content {
    margin-left: 0;
    padding: 20px 16px calc(var(--tabbar-h) + 28px);
    max-width: none;
  }

  .page-title { font-size: 21px; }

  .form { grid-template-columns: 1fr; padding: 18px 16px; gap: 14px; }
  .form-actions { position: static; }
  .form-actions .btn { flex: 1; }
  .form-actions .btn-primary { flex: 2; }

  input, select { height: 48px; font-size: 16px; } /* iOS 확대 방지 */

  /* 테이블 → 카드 */
  .table thead { display: none; }
  .table, .table tbody { display: block; }
  .table tr {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 2px 12px;
    padding: 12px 14px;
    border-bottom: 1px solid var(--line);
    position: relative;
  }
  .table tbody tr:last-child { border-bottom: 0; }
  .table td { display: block; padding: 0; border: 0; }
  .table td::before {
    content: attr(data-label);
    display: inline-block;
    min-width: 52px;
    margin-right: 8px;
    font-size: 12px;
    color: var(--muted);
  }
  .table td.act { position: absolute; top: 8px; right: 8px; width: auto; }
  .table td.act::before { content: none; }

  .table .sub { display: inline; margin-left: 6px; }
  .table .sub::before { content: "· "; }
  .table-partner tr { grid-template-columns: 1fr; }
  .table-partner td { margin-top: 2px; }
  .table-partner td.act { margin: 0; }

  /* 거래 목록(모바일 카드): 2열 그리드, 총액 강조 */
  .table-trade tr { grid-template-columns: 1fr 1fr; padding-right: 44px; }
  .table-trade td { white-space: normal; }
  .table-trade td[data-label="상대방"],
  .table-trade td[data-label="물품"],
  .table-trade td[data-label="총액"],
  .table-trade td[data-label="비고"] { grid-column: 1 / -1; }
  .table-trade td.note { max-width: none; overflow: visible; }
  .table-trade td.num { text-align: left !important; font-weight: 600; }
  .table-trade td[data-label="총액"] {
    margin-top: 6px; padding-top: 8px; border-top: 1px dashed var(--line);
    font-size: 18px; font-weight: 800;
  }
}


/* ---------- 업체별 · 물품별 기본 거래 가격 ---------- */
.price-box {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px 16px 6px;
  min-width: 0;
  background: #fafbfc;
}
.price-box legend { font-size: 13px; font-weight: 700; padding: 0 6px; }
.price-hint { font-size: 12px; color: var(--muted); margin-bottom: 8px; }

.price-row {
  display: grid;
  grid-template-columns: 1fr 180px 34px;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
}
.price-row:first-child { border-top: 0; }
.price-row input.money { height: 40px; }

/* 물품 검색 + 단가 + 추가 */
.price-add {
  display: grid;
  grid-template-columns: 1fr 180px auto;
  gap: 10px;
  align-items: center;
  padding-bottom: 12px;
}
.price-add .price-input input { height: 44px; }
.btn-add { background: var(--primary-soft); color: var(--primary); height: 44px; padding: 0 18px; }
.btn-add:hover { background: #d8e2fb; }
.price-error { color: #c62828; font-size: 12px; margin: 0 0 8px; }
.price-empty { font-size: 13px; color: var(--muted); text-align: center; padding: 14px 0 12px; }
.price-list { max-height: 320px; overflow-y: auto; border-top: 1px solid var(--line); }
.price-box .count { margin-left: 4px; }
.price-item { font-size: 14px; }
.price-item strong { color: var(--primary); margin-right: 4px; }
.price-item .sub { display: block; font-size: 12px; color: var(--muted); }

.price-input { position: relative; display: block; }
.price-input input { text-align: right; padding-right: 34px; font-weight: 700; }
.price-input .unit {
  position: absolute; right: 12px; top: 50%;
  transform: translateY(-50%);
  color: var(--muted); font-size: 14px; pointer-events: none;
}
.sr-only {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

@media (max-width: 900px) {
  .price-row { grid-template-columns: 1fr 130px 34px; }
  .price-add { grid-template-columns: 1fr 1fr; }
  .price-add-item { grid-column: 1 / -1; }
}


/* ---------- 업체 목록: 클릭 가능한 행 ---------- */
.table-partner tbody tr[data-id] { cursor: pointer; }
.table-partner tbody tr[data-id]:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; }
.table .empty-row td { text-align: center; color: var(--muted); padding: 28px 16px; }
.section-title .hint { font-size: 12px; font-weight: 400; color: var(--muted); margin-left: auto; }

/* ---------- 상세 · 수정 팝업 ---------- */
dialog.modal {
  margin: auto;
  border: 0;
  border-radius: 16px;
  padding: 0;
  width: min(720px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  color: var(--text);
  background: var(--surface);
  box-shadow: 0 20px 60px rgba(20, 28, 45, .25);
}
dialog.modal[open] { display: flex; flex-direction: column; }
dialog.modal::backdrop { background: rgba(20, 28, 45, .45); }

.modal-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 20px; border-bottom: 1px solid var(--line);
}
.modal-head h2 { display: inline; font-size: 18px; margin-right: 8px; }
.modal-body { padding: 20px; overflow-y: auto; flex: 1; }
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px 18px; margin-bottom: 18px; }
.modal-foot {
  display: flex; justify-content: flex-end;
  padding: 14px 20px; border-top: 1px solid var(--line);
}
.foot-view, .foot-edit { display: flex; gap: 10px; }
.modal.is-view .foot-edit { display: none; }
.modal:not(.is-view) .foot-view { display: none; }
.btn-danger { background: var(--surface); color: #c62828; border-color: #f3c5c5; }
.btn-danger:hover { background: #fde8e8; }

/* 보기 모드: 입력칸을 일반 텍스트처럼 */
.modal.is-view input,
.price-box:disabled input {
  border-color: transparent; background: transparent; box-shadow: none;
  padding-left: 0; opacity: 1; color: var(--text); -webkit-text-fill-color: var(--text);
}
.modal.is-view input::placeholder { color: transparent; }
.modal.is-view .price-input input,
.price-box:disabled .price-input input { padding-right: 34px; }
.price-box:disabled .price-add,
.price-box:disabled .pp-del,
.price-box:disabled .price-hint,
.price-box:disabled .price-error { display: none; }
.price-box:disabled .price-list { border-top: 0; }

/* 모바일: 하단에서 올라오는 시트 */
@media (max-width: 900px) {
  .section-title .hint { display: none; }
  dialog.modal {
    width: 100%; max-width: 100%;
    max-height: 92vh; height: 92vh;
    margin: auto 0 0;
    border-radius: 16px 16px 0 0;
  }
  .modal-body { padding: 16px; }
  .form-grid { grid-template-columns: 1fr; gap: 14px; }
  .modal-foot { padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); }
  .foot-view, .foot-edit { width: 100%; }
  .foot-view .btn, .foot-edit .btn { flex: 1; }
  .foot-view .btn-primary, .foot-edit .btn-primary { flex: 2; }
  .table-partner tbody tr[data-id] { padding-right: 44px; }
}

.table-item td strong { font-weight: 700; }
.price-item strong { margin-right: 6px; }

.price-item .meta { display: block; font-size: 12px; font-weight: 400; color: var(--muted); margin-top: 1px; }
.price-item strong { margin-right: 0; }

/* 거래타입: 재고 증감 표시 */
.stock { font-weight: 700; font-size: 13px; white-space: nowrap; }
.stock-up   { color: var(--out); }
.stock-down { color: var(--in); }
.stock-none { color: var(--muted); font-weight: 600; }


/* ---------- 알림(토스트) · 연결 오류 배너 ---------- */
.toast {
  position: fixed; inset: auto auto 28px 50%; transform: translateX(-50%);
  margin: 0; border: 0; z-index: 100; max-width: min(520px, calc(100vw - 32px));
  background: #1c2330; color: #fff; padding: 12px 18px; border-radius: 10px;
  font-size: 14px; box-shadow: 0 8px 24px rgba(20, 28, 45, .3);
}
.banner[hidden] { display: none; }
.toast-err { background: #b42318; }
.banner {
  background: #fde8e8; color: #b42318; border: 1px solid #f3c5c5;
  border-radius: 10px; padding: 12px 16px; margin-bottom: 18px; font-size: 14px;
}
@media (max-width: 900px) {
  .toast { inset: auto auto calc(var(--tabbar-h) + 16px) 50%; }
}

.table td.neg { color: #c62828; }

/* ---------- 제품분류 화면 ---------- */
.table .act-2 { width: 96px; white-space: nowrap; }
.table-product td.act { text-align: right; }
.table-product .btn-sm { height: 32px; padding: 0 12px; font-size: 13px; }
.inline-input { height: 38px; max-width: 360px; }
@media (max-width: 900px) {
  .table-product tr { grid-template-columns: 1fr; padding-right: 96px; }
  .table-product td.num { text-align: left !important; font-weight: 400; color: var(--muted); }
  .inline-input { max-width: none; }
  .table-product td.act-2 { width: auto; }
  .table-product .btn-sm { height: 34px; }
  .menu-link { font-size: 10.5px; }
}

/* ---------- 물품 상세 팝업 · 목록 행 ---------- */
.table-item tbody tr[data-id] { cursor: pointer; }
.table-item tbody tr[data-id]:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; }
.modal-note { margin-top: 14px; font-size: 12px; color: var(--muted); line-height: 1.5; }

/* 보기 모드의 선택칸도 일반 텍스트처럼 */
.modal.is-view select {
  -webkit-appearance: none; appearance: none;
  border-color: transparent; background: transparent; box-shadow: none;
  padding-left: 0; opacity: 1; color: var(--text); -webkit-text-fill-color: var(--text);
}
/* 현재고(자동 계산)는 수정 중에도 읽기 전용 표시 */
.modal:not(.is-view) input:disabled { background: #f1f3f7; color: var(--muted); -webkit-text-fill-color: var(--muted); }

#item-dialog .money { text-align: left; }

.field-hint { margin-top: 6px; font-size: 12px; color: var(--primary); line-height: 1.5; }
.field-hint[hidden] { display: none; }

/* 재고물품 목록 필터 */
.item-filter {
  display: grid; grid-template-columns: repeat(4, 1fr) auto; gap: 12px 14px;
  align-items: end; padding: 16px 18px; margin-bottom: 12px;
}
.item-filter .btn { white-space: nowrap; }
.item-filter .btn:disabled { opacity: .45; cursor: default; }
@media (max-width: 900px) {
  .item-filter { grid-template-columns: 1fr 1fr; }
  .item-filter .btn { grid-column: 1 / -1; }
}

/* 필터 결과 요약 */
.item-summary {
  display: flex; flex-wrap: wrap; gap: 6px 22px; align-items: baseline;
  margin: 0 2px 10px; font-size: 14px; color: var(--muted);
}
.item-summary strong { color: var(--text); font-size: 17px; font-variant-numeric: tabular-nums; }
.item-summary strong.neg { color: #c0392b; }

/* 기본 거래업체 */
.badge-default { color: #7a5b00; background: #fff3cd; margin-left: 4px; }
.lock { font-size: 14px; opacity: .55; cursor: help; padding: 0 6px; }
button[hidden] { display: none !important; }

/* 거래 비고 */
.memo-wrap { position: relative; }
.memo-wrap input { width: 100%; padding-right: 58px; }
.memo-count { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); font-size: 12px; color: var(--muted); pointer-events: none; font-variant-numeric: tabular-nums; }
.memo-count.full { color: #c0392b; font-weight: 700; }
.table-trade td.note { color: var(--muted); max-width: 260px; overflow: hidden; text-overflow: ellipsis; }

/* ---------- 거래 등록: 물품 줄 (＋ 추가 / − 삭제) ---------- */
.trade-lines { display: flex; flex-direction: column; gap: 10px; }
.line {
  display: grid; align-items: center; gap: 8px 10px;
  grid-template-columns: 22px minmax(0, 1.35fr) minmax(0, 1.1fr) minmax(0, 1.4fr) 66px 104px 104px 34px;
  padding: 10px 10px 10px 8px; border: 1px solid var(--line); border-radius: 10px; background: #fafbfd;
}
.line .field { gap: 0; }
.line .field > label { display: none; }                     /* 데스크톱: 라벨은 입력창 안내(aria-label)로 대체 */

.line-no { font-size: 12px; font-weight: 700; color: var(--muted); text-align: center; }
.line output.l-amt { display: block; text-align: right; font-weight: 800; padding: 0 4px; font-variant-numeric: tabular-nums; }
.line-del {
  width: 34px; height: 34px; border-radius: 50%; border: 1px solid #f3c5c5; background: var(--surface);
  color: #c62828; font-size: 20px; line-height: 1; font-weight: 700; cursor: pointer;
}
.line-del:hover:not(:disabled) { background: #fde8e8; }
.line-del:disabled { opacity: .3; cursor: default; border-color: var(--line); color: var(--muted); }
.btn-add-line { align-self: flex-start; margin-top: 10px; border-style: dashed; color: var(--primary); font-weight: 700; }
.btn-add-line:disabled { opacity: .45; cursor: default; }
.badge-more { color: var(--muted); background: var(--bg); margin-left: 4px; }

@media (max-width: 900px) {
  .line { grid-template-columns: 1fr 1fr; padding: 12px; }
  .line-no { grid-column: 1; justify-self: start; text-align: left; font-size: 13px; }
  .line-del { grid-column: 2; grid-row: 1; justify-self: end; }
  .line .field > label { display: block; font-size: 12px; margin-bottom: 4px; }
  .line-prod, .line-model, .line-wh { grid-column: 1 / -1; }
  .line-amt { grid-column: 1 / -1; flex-direction: row; justify-content: space-between; align-items: center; border-top: 1px dashed var(--line); padding-top: 8px; }
  .line-amt > label { margin: 0 !important; }
}

/* ---------- 거래 상세 팝업 ---------- */
.trade-info { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px 18px; margin-bottom: 20px; }
.trade-info dt { font-size: 12px; color: var(--muted); margin-bottom: 2px; }
.trade-info dd { font-weight: 700; word-break: break-all; }
.detail-title { font-size: 15px; margin-bottom: 8px; }
.detail-lines { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.dl-row { display: grid; grid-template-columns: 28px minmax(0, 2.4fr) minmax(0, 1.2fr) 64px 100px 110px; gap: 8px; padding: 11px 12px; border-top: 1px solid var(--line); align-items: baseline; }
.dl-row:first-child { border-top: 0; }
.dl-head { background: #fafbfc; font-size: 12px; font-weight: 700; color: var(--muted); }
.dl-row .r { text-align: right; font-variant-numeric: tabular-nums; }
.dl-no { color: var(--muted); font-size: 12px; }
.dl-item { font-weight: 700; }
.dl-amt { font-weight: 800; }
.detail-total { display: flex; justify-content: flex-end; align-items: baseline; gap: 6px; margin-top: 14px; color: var(--muted); }
.detail-total strong { font-size: 24px; color: var(--primary); font-variant-numeric: tabular-nums; }
@media (max-width: 900px) {
  .trade-info { grid-template-columns: 1fr 1fr; }
  .trade-info > div:last-child { grid-column: 1 / -1; }
  .dl-head { display: none; }
  .dl-row { grid-template-columns: 22px 1fr 1fr 1fr; padding: 12px; }
  .dl-row .dl-item { grid-column: 2 / -1; }
  .dl-row [data-label]:not(.dl-item)::before { content: attr(data-label) " "; font-size: 11px; font-weight: 400; color: var(--muted); display: block; }
  .dl-row .r { text-align: left; }
  .dl-row > span[data-label="창고"] { grid-column: 2 / -1; }
  .dl-row > span[data-label="수량"] { grid-column: 2; }
}

.line-cols {
  display: grid; gap: 0 10px; padding: 0 10px 6px 8px; margin-top: -2px;
  grid-template-columns: 22px minmax(0, 1.35fr) minmax(0, 1.1fr) minmax(0, 1.4fr) 66px 104px 104px 34px;
  font-size: 12px; font-weight: 700; color: var(--muted);
}
.line-cols .r { text-align: right; }
@media (max-width: 900px) { .line-cols { display: none; } }

/* 거래업체: 필수 표시 · 등록번호 3-2-5 입력칸 */
.field.req > label::after { content: " *"; color: #c62828; font-weight: 700; }
.bizno-group { display: flex; align-items: center; gap: 8px; }
.bizno-group span { color: var(--muted); font-weight: 700; }
.bizno-group .bizno-part { text-align: center; letter-spacing: .08em; min-width: 0; font-variant-numeric: tabular-nums; }
.bizno-group .bizno-part[data-i="1"] { flex: 3; }
.bizno-group .bizno-part[data-i="2"] { flex: 2; }
.bizno-group .bizno-part[data-i="3"] { flex: 5; }

/* 입력 길이 표시 (현재/최대) */
.len-wrap { position: relative; }
.field .len-wrap input, .len-wrap input { width: 100%; padding-right: 64px !important; }
.len-count { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); font-size: 12px; color: var(--muted); pointer-events: none; font-variant-numeric: tabular-nums; }
.len-count.full { color: #c0392b; font-weight: 700; }

/* 제품명 인라인 수정: 글자 수 표시와 함께 */
.table .len-wrap { min-width: 0; max-width: 360px; }
.table .len-wrap .inline-input { width: 100%; }
