/* ─────────────────────────────────────────────
   AF Purchase Manager - 공통 스타일
───────────────────────────────────────────── */

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

body {
  font-family: 'Malgun Gothic', '맑은 고딕', Arial, sans-serif;
  font-size: 14px;
  background: #f4f6f9;
  color: #333;
}

body.login-page {
  min-height: 100vh;
  background: linear-gradient(180deg, #eaf1ff 0%, #f8fbff 100%);
}

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

.sidebar {
  width: 200px;
  background: #1e293b;
  color: #cbd5e1;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
}

.sidebar-logo {
  padding: 20px 16px;
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  border-bottom: 1px solid #334155;
  letter-spacing: -0.3px;
}

.sidebar-logo span { color: #60a5fa; }

.sidebar-nav { flex: 1; padding: 12px 0; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  color: #94a3b8;
  text-decoration: none;
  transition: all 0.15s;
  border-left: 3px solid transparent;
}

.nav-item:hover { color: #e2e8f0; background: #334155; }
.nav-item.active { color: #fff; background: #1d4ed8; border-left-color: #60a5fa; }
.nav-item .icon { font-size: 16px; width: 20px; text-align: center; }

.main-content {
  margin-left: 200px;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.top-bar {
  background: #fff;
  border-bottom: 1px solid #e2e8f0;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.top-bar h1 { font-size: 18px; font-weight: 600; color: #1e293b; }

.top-bar-user {
  display:flex;
  align-items:center;
  gap:8px;
  margin-left:auto;
}

.top-bar-user__name {
  font-size:13px;
  font-weight:700;
  color:#0f172a;
}

.top-bar-user__role {
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-width:48px;
  height:22px;
  padding:0 8px;
  border-radius:999px;
  background:#eff6ff;
  color:#1d4ed8;
  font-size:11px;
  font-weight:700;
}

.page-body { padding: 24px; }

.login-shell {
  min-height:100vh;
  display:flex;
  align-items:center;
  justify-content:center;
  padding:24px;
}

.login-card {
  width:min(420px, 100%);
  background:#fff;
  border:1px solid #dbe3ee;
  border-radius:18px;
  box-shadow:0 24px 60px rgba(15, 23, 42, 0.08);
  padding:28px 28px 26px;
}

.login-title {
  font-size:24px;
  font-weight:800;
  color:#0f172a;
}

.login-subtitle {
  margin-top:8px;
  margin-bottom:20px;
  font-size:13px;
  line-height:1.6;
  color:#64748b;
}

.login-form {
  display:flex;
  flex-direction:column;
  gap:14px;
}

.login-submit {
  width:100%;
  height:42px;
  font-size:14px;
  font-weight:800;
}

.login-error {
  padding:10px 12px;
  border-radius:10px;
  background:#fef2f2;
  color:#b91c1c;
  font-size:13px;
}

/* ── 카드 ── */
.card {
  background: #fff;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
  padding: 20px;
  margin-bottom: 20px;
}

.create-doc-summary-grid {
  display: grid;
  grid-template-columns: minmax(160px, 1.25fr) minmax(150px, 1.1fr) minmax(110px, 0.8fr) minmax(90px, 0.65fr) minmax(140px, 1fr) minmax(260px, 1.7fr);
  gap: 10px 12px;
  font-size: 12px;
  color: #475569;
  align-items: center;
}

.create-doc-summary-grid > div {
  min-width: 0;
}

.create-doc-summary-grid .select {
  width: 100%;
  min-width: 0;
}

.card-title {
  font-size: 14px;
  font-weight: 600;
  color: #64748b;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.permission-groups {
  display:flex;
  flex-direction:column;
  gap:14px;
}

.permission-groups.is-disabled {
  opacity:0.72;
}

.permission-group {
  border:1px solid #e2e8f0;
  border-radius:12px;
  padding:12px 14px;
  background:#fff;
}

.permission-group__title {
  font-size:13px;
  font-weight:800;
  color:#334155;
  margin-bottom:10px;
}

.permission-group__items {
  display:grid;
  grid-template-columns:repeat(2, minmax(0, 1fr));
  gap:8px 14px;
}

.permission-check {
  display:flex;
  align-items:flex-start;
  gap:8px;
  font-size:13px;
  color:#334155;
}

/* ── 통계 카드 ── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}

.stat-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 20px;
}

.stat-card--clickable {
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.stat-card--clickable:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.06);
  border-color: #93c5fd;
}

.stat-card--clickable:focus-visible {
  outline: 2px solid #2563eb;
  outline-offset: 2px;
}

.stat-card--blue { background: linear-gradient(180deg, #eff6ff 0%, #ffffff 100%); border-color: #bfdbfe; }
.stat-card--amber { background: linear-gradient(180deg, #fffbeb 0%, #ffffff 100%); border-color: #fde68a; }
.stat-card--purple { background: linear-gradient(180deg, #f5f3ff 0%, #ffffff 100%); border-color: #ddd6fe; }
.stat-card--emerald { background: linear-gradient(180deg, #ecfdf5 0%, #ffffff 100%); border-color: #a7f3d0; }

.stat-label { font-size: 12px; color: #64748b; margin-bottom: 8px; }
.stat-value { font-size: 24px; font-weight: 700; color: #1e293b; }
.stat-sub { font-size: 12px; color: #94a3b8; margin-top: 4px; }

.dashboard-summary-grid {
  margin-bottom: 14px;
}

.dashboard-meta-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.dashboard-meta-item {
  display: flex;
  align-items: baseline;
  gap: 8px;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 14px 16px;
}

.dashboard-meta-label {
  font-size: 12px;
  color: #64748b;
}

.dashboard-meta-value {
  font-size: 18px;
  color: #0f172a;
}

.dashboard-meta-hint {
  margin-left: auto;
  font-size: 12px;
  color: #94a3b8;
}

.dashboard-two-col {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.8fr);
  gap: 16px;
  margin-bottom: 20px;
}

.dashboard-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.dashboard-card-head .card-title {
  margin-bottom: 0;
}

.dashboard-attention-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.dashboard-attention-item {
  display: block;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 12px 14px;
  background: #fff;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s, background-color 0.15s;
}

.dashboard-attention-item:hover {
  border-color: #bfdbfe;
  background: #f8fbff;
}

.dashboard-attention-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.dashboard-attention-date {
  font-size: 12px;
  color: #94a3b8;
}

.dashboard-attention-title {
  font-size: 14px;
  font-weight: 600;
  color: #0f172a;
  margin-bottom: 4px;
}

.dashboard-attention-sub {
  font-size: 12px;
  color: #64748b;
}

/* ── 툴바 ── */
.toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.toolbar-left { display: flex; align-items: center; gap: 10px; flex: 1; flex-wrap: wrap; }
.toolbar-right { display: flex; gap: 8px; }

/* ── 버튼 ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 6px;
  border: none;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}

.btn-primary { background: #2563eb; color: #fff; }
.btn-primary:hover { background: #1d4ed8; }
.btn-secondary { background: #f1f5f9; color: #475569; border: 1px solid #e2e8f0; }
.btn-secondary:hover { background: #e2e8f0; }
.btn-danger { background: #ef4444; color: #fff; }
.btn-danger:hover { background: #dc2626; }
.btn-success { background: #10b981; color: #fff; }
.btn-success:hover { background: #059669; }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-xs { padding: 2px 8px; font-size: 11px; }
.btn-icon-circle {
  width: 26px; height: 26px;
  /* Symmetric inset: dingbats sit off-center in em box; tight line box avoids baseline drift */
  padding: 0 1px; border-radius: 50%;
  font-size: 13px;
  line-height: 0;
  display: grid;
  place-items: center;
  gap: 0;
}

/* ── 검색/입력 ── */
.input, .select {
  padding: 7px 12px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  font-size: 13px;
  color: #334155;
  background: #fff;
  outline: none;
  transition: border-color 0.15s;
}

.input:focus, .select:focus { border-color: #2563eb; box-shadow: 0 0 0 2px #dbeafe; }
.input-sm { padding: 5px 10px; font-size: 12px; }

/* ── 테이블 ── */
.table-wrap { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

thead th {
  background: #f8fafc;
  padding: 10px 12px;
  text-align: left;
  font-weight: 600;
  color: #475569;
  border-bottom: 2px solid #e2e8f0;
  white-space: nowrap;
}

tbody td {
  padding: 10px 12px;
  border-bottom: 1px solid #f1f5f9;
  color: #334155;
}

tbody tr:hover { background: #f8fafc; }
tbody tr:last-child td { border-bottom: none; }

.tr-link { cursor: pointer; }
.tr-link:hover { background: #eff6ff; }

/* ── 배지 ── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 500;
}

.badge-blue   { background: #dbeafe; color: #1d4ed8; }
.badge-green  { background: #d1fae5; color: #065f46; }
.badge-yellow { background: #fef3c7; color: #92400e; }
.badge-orange { background: #ffedd5; color: #c2410c; }
.badge-amber  { background: #fef3c7; color: #b45309; }
.badge-emerald { background: #dcfce7; color: #166534; }
.badge-purple { background: #ede9fe; color: #6d28d9; }
.badge-red    { background: #fee2e2; color: #991b1b; }
.badge-gray   { background: #f1f5f9; color: #475569; }
.badge-slate  { background: #e2e8f0; color: #334155; }

/* ── 발주 상세 · 출금 인라인 편집 ── */
.payments-tab-toolbar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin-bottom: 10px;
}

/* 모달 안에서 표가 찌그러지지 않도록 가로 스크롤 (overflow-x hidden 대비) */
.payments-table-scroll {
  overflow-x: auto;
  max-width: 100%;
  -webkit-overflow-scrolling: touch;
}

.payments-inline-table {
  width: 100%;
  /* 전체 최소 폭 10% 축소 (52rem × 0.9) */
  min-width: 46.8rem;
  table-layout: fixed;
  border-collapse: collapse;
}

/* colgroup: 고정 열은 전체 대비 0.9배, 구분은 추가 0.8배(20% 축소) → ×0.72 */
.payments-inline-table col.pay-col-step { width: 8.28rem; }
.payments-inline-table col.pay-col-order { width: 3.825rem; }
.payments-inline-table col.pay-col-due { width: 7.875rem; }
.payments-inline-table col.pay-col-date { width: 7.875rem; }
.payments-inline-table col.pay-col-amt { width: 6.3rem; }
.payments-inline-table col.pay-col-notes { min-width: 10.8rem; }
.payments-inline-table col.pay-col-actions { width: 8.1rem; }

.payments-inline-table thead th {
  white-space: nowrap;
  padding: 8px 6px;
  vertical-align: middle;
  text-align: left;
}

.payments-inline-table tbody td {
  padding: 6px;
  vertical-align: middle;
}

.payments-inline-table .input-sm,
.payments-inline-table .select.input-sm {
  width: 100%;
  min-width: 0;
}

.payments-inline-table .pay-amount-input {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* 구분 셀 내부: td에는 flex 금지(표 열 정렬 유지). 래퍼에서 한 줄 배치 */
.payments-step-inner {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
  gap: 6px;
  flex-wrap: nowrap;
  min-width: 0;
  box-sizing: border-box;
}

.payments-step-inner .badge {
  flex: 0 0 auto;
}

.payments-inline-table .payments-step-inner .select.input-sm {
  flex: 0 1 auto;
  width: auto;
  min-width: 3.5rem;
  max-width: 100%;
}

.payments-step-label {
  flex: 0 1 auto;
  min-width: 0;
  font-weight: 500;
}

/* 관리: 한 줄(가로) 배치 — 행 높이 유지 */
.payments-inline-table thead th:last-child {
  text-align: center;
}

.payments-actions-cell {
  white-space: nowrap;
  vertical-align: middle;
  text-align: center;
  box-sizing: border-box;
}

.payments-actions-cell .btn-xs {
  display: inline-block;
  width: auto;
  margin: 0 3px 0 0;
  vertical-align: middle;
  box-sizing: border-box;
}

.payments-actions-cell .btn-xs:last-child {
  margin-right: 0;
}

tr.payment-draft-row td {
  background: #f8fafc;
}

/* ── 모달 ── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.4);
  z-index: 999;
  align-items: flex-start;
  justify-content: center;
  padding-top: 60px;
}

.modal-overlay.open { display: flex; }

.modal {
  background: #fff;
  border-radius: 10px;
  width: 560px;
  max-width: 95vw;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 20px 40px rgba(0,0,0,.15);
}

.modal-lg { width: 760px; }
.modal-vendor-edit { width: 960px; max-width: 95vw; max-height: 90vh; }
.modal-order { width: 1180px; max-width: 98vw; height: 90vh; overflow-x: hidden; display: flex; flex-direction: column; }
.modal-order > .modal-header { flex-shrink: 0; }
.modal-order > .modal-body { flex: 1; min-height: 0; overflow: hidden; display: flex; flex-direction: column; }
.create-order-modal-body { padding: 20px; }
.create-order-stage-header {
  flex-shrink: 0;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
  padding: 14px 16px;
  border: 1px solid #dbe3ee;
  border-radius: 14px;
  background: linear-gradient(180deg, #f8fbff 0%, #f8fafc 100%);
}
.create-order-stage-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 4px;
}
.workflow-receiving-loading,
.workflow-receiving-error {
  padding: 18px;
  border: 1px dashed #cbd5e1;
  border-radius: 12px;
  background: #f8fafc;
  color: #64748b;
  font-size: 13px;
}
.workflow-receiving-error {
  border-color: #fecaca;
  background: #fef2f2;
  color: #b91c1c;
}
.workflow-receiving-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}
.workflow-receiving-metric {
  display: inline-flex;
  align-items: center;
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid #dbe3ee;
  background: #f8fafc;
  color: #475569;
  font-size: 12px;
  font-weight: 700;
}
.workflow-receiving-metric--green {
  background: #ecfdf5;
  border-color: #a7f3d0;
  color: #047857;
}
.workflow-receiving-metric--yellow {
  background: #fffbeb;
  border-color: #fde68a;
  color: #b45309;
}
.workflow-receiving-metric--slate {
  background: #f8fafc;
  border-color: #cbd5e1;
  color: #475569;
}
.workflow-receiving-metric--amber {
  background: #fff7ed;
  border-color: #fdba74;
  color: #c2410c;
}
.workflow-receiving-card {
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  background: #fff;
  overflow: visible;
}
.workflow-receiving-subtabs {
  display: flex;
  gap: 8px;
  padding: 14px 16px 0;
  border-bottom: 1px solid #e2e8f0;
}
.workflow-receiving-subtab {
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: #64748b;
  font-size: 13px;
  font-weight: 700;
  padding: 10px 2px;
  cursor: pointer;
}
.workflow-receiving-subtab.is-active {
  color: #2563eb;
  border-bottom-color: #2563eb;
}
.workflow-receiving-panel {
  display: none;
  padding: 16px;
}
.workflow-receiving-panel.is-active {
  display: block;
}
.workflow-receiving-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.workflow-receiving-section-help {
  font-size: 12px;
  color: #64748b;
}
.workflow-receiving-payment-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}
.workflow-receiving-payment-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px 14px;
  border: 1px solid #dbe3ee;
  border-radius: 12px;
  background: #f8fafc;
}
.workflow-receiving-payment-card__label {
  color: #64748b;
  font-size: 11px;
  font-weight: 700;
}
.workflow-receiving-payment-card__value {
  color: #0f172a;
  font-size: 16px;
  font-weight: 800;
}
.workflow-receiving-payment-card__meta {
  color: #64748b;
  font-size: 12px;
}
.workflow-receiving-table thead th {
  text-align: center;
  overflow: visible;
}
.workflow-receiving-table tbody td {
  font-size: 12px;
  vertical-align: top;
  overflow: visible;
}
.workflow-receiving-cell-center {
  text-align: center;
  white-space: nowrap;
}
.workflow-receiving-cell-right {
  text-align: right;
  white-space: nowrap;
}
.workflow-receiving-cell-group {
  font-size: 12px;
  line-height: 1.45;
}
.workflow-receiving-cell-group .workflow-receiving-pair + .workflow-receiving-pair {
  margin-top: 4px;
}
.workflow-receiving-pair {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.workflow-receiving-pair--input {
  align-items: center;
}
.workflow-receiving-pair-label {
  color: #64748b;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}
.workflow-receiving-inline-input {
  width: 92px;
  text-align: right;
  padding-right: 8px;
}
.workflow-receiving-inline-date {
  width: 128px;
}
.workflow-receiving-inline-date-display {
  position: relative;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 0;
}
.workflow-receiving-inline-date-row {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.workflow-receiving-inline-date-display.is-disabled {
  opacity: 0.7;
}
.workflow-receiving-inline-date-text {
  color: #0f172a;
  font-weight: 600;
  white-space: nowrap;
}
.workflow-receiving-inline-date-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  padding: 0;
  border: 1px solid #dbe3ee;
  border-radius: 6px;
  background: #fff;
  cursor: pointer;
  font-size: 12px;
  line-height: 1;
}
.workflow-receiving-inline-date-row .workflow-receiving-inline-date-icon-shell {
  position: relative;
  display: inline-flex;
  width: 22px;
  height: 22px;
}
.workflow-receiving-inline-date-native {
  position: absolute;
  inset: 0;
  width: 22px;
  height: 22px;
  opacity: 0;
  cursor: pointer;
  border: 0;
  margin: 0;
  padding: 0;
  appearance: none;
  -webkit-appearance: none;
  background: transparent;
  font-size: 0;
}
.workflow-receiving-inline-date-native:disabled {
  cursor: not-allowed;
}
.workflow-receiving-cell-group strong {
  color: #0f172a;
  font-weight: 700;
  white-space: nowrap;
}
.workflow-receiving-cell-group--status .workflow-receiving-pair {
  justify-content: space-between;
}
.workflow-receiving-stack + .workflow-receiving-stack {
  margin-top: 4px;
}
.workflow-receiving-stack {
  display: flex;
  justify-content: center;
}
.workflow-receiving-stack--input {
  justify-content: center;
}
.workflow-receiving-cell-group--status strong {
  font-weight: 600;
}
.workflow-receiving-line-name {
  font-weight: 700;
  color: #0f172a;
}
.workflow-receiving-line-note {
  margin-top: 4px;
  font-size: 11px;
  color: #64748b;
  line-height: 1.5;
  white-space: pre-wrap;
}
.workflow-receiving-task-row {
  margin-top: 6px;
}
.workflow-receiving-row-actions {
  margin-top: 8px;
}
.workflow-receiving-row-actions--right {
  display: flex;
  justify-content: center;
  gap: 6px;
  flex-wrap: wrap;
}
.workflow-receiving-task-empty {
  font-size: 11px;
  color: #94a3b8;
}
.workflow-receiving-detail-row td {
  padding: 0;
  border-top: 0;
  background: #f8fafc;
}
.workflow-receiving-detail-card {
  margin: 0;
  padding: 14px 16px 16px;
  border-top: 1px solid #e2e8f0;
  background: #f8fafc;
}
.workflow-receiving-detail-card--loading {
  color: #64748b;
  font-size: 12px;
}
.workflow-receiving-detail-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.workflow-receiving-detail-head p {
  margin: 4px 0 0;
  color: #64748b;
  font-size: 12px;
}
.workflow-receiving-detail-head-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}
.workflow-receiving-detail-metric {
  display: inline-flex;
  align-items: center;
  padding: 4px 8px;
  border-radius: 999px;
  background: #fff;
  border: 1px solid #dbe3ee;
  color: #334155;
  font-size: 11px;
  font-weight: 700;
}
.workflow-receiving-detail-table {
  width: 100%;
  border-collapse: collapse;
}
.workflow-receiving-detail-table thead th {
  padding: 9px 10px;
  border-bottom: 1px solid #dbe3ee;
  background: #fff;
  color: #64748b;
  font-size: 11px;
  font-weight: 700;
  text-align: left;
}
.workflow-receiving-detail-table tbody td {
  padding: 10px;
  border-bottom: 1px solid #e2e8f0;
  background: #fff;
  font-size: 12px;
  vertical-align: middle;
}
.workflow-receiving-detail-actions-cell {
  white-space: nowrap;
}
.workflow-receiving-record-editor input {
  width: 100%;
}
.workflow-receiving-record-editor-hint td {
  background: #fff;
  color: #64748b;
  font-size: 11px;
  padding-top: 0;
}
.workflow-receiving-log-old {
  color: #dc2626;
}
.workflow-receiving-log-new {
  color: #16a34a;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid #e2e8f0;
}

.modal-title { font-size: 16px; font-weight: 600; color: #1e293b; }
.modal-close { background: none; border: none; font-size: 20px; cursor: pointer; color: #94a3b8; line-height: 1; }
.modal-close:hover { color: #1e293b; }

.modal-body { padding: 20px; }
.modal-footer {
  padding: 14px 20px;
  border-top: 1px solid #e2e8f0;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.manual-row--split {
  align-items: center;
  gap: 16px;
}

.manual-inline-field {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.manual-inline-field--date {
  flex: 0 0 auto;
}

.manual-inline-field--memo {
  flex: 1 1 0;
  min-width: 280px;
}

.manual-inline-field--memo .form-label {
  white-space: nowrap;
  flex: 0 0 auto;
}

.manual-inline-field--memo .input {
  width: 100%;
}

.online-order-info {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-left: 12px;
  min-height: 34px;
  font-size: 12px;
  color: #2563eb;
}

.online-order-info--muted {
  color: #64748b;
}

.online-order-badge {
  display: inline-flex;
  align-items: center;
  height: 24px;
  padding: 0 10px;
  border-radius: 999px;
  background: #dbeafe;
  color: #1d4ed8;
  font-weight: 600;
}

.online-order-link {
  color: #2563eb;
  font-weight: 600;
  text-decoration: none;
}

.online-order-link:hover {
  text-decoration: underline;
}

.online-order-missing-link {
  color: #b45309;
}

/* ── 발주 상세 상단: 요약(가로) + 옵션(가로) 단일 카드 ── */
.detail-order-info {
  margin-bottom: 10px;
  font-size: 13px;
}
.detail-order-form-card {
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 12px 14px;
  background: #fafbfc;
}
.detail-order-form-row {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
.detail-order-form-row + .detail-order-form-row,
.detail-order-form-row + .detail-order-meta-row,
.detail-order-meta-row + .detail-order-alert-row {
  margin-top: 8px;
}
.detail-order-form-row--split {
  gap: 16px;
}
.detail-order-form-label {
  flex: 0 0 auto;
  min-width: 40px;
}
.detail-order-form-grow {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1 1 auto;
  min-width: 0;
}
.detail-order-form-grow .input {
  width: 220px;
  flex: 0 0 auto;
}
.detail-order-static-input {
  background: #fff;
  color: #334155;
}
.detail-order-inline-memo {
  min-width: 0;
}
.detail-order-inline-memo .input {
  flex: 1 1 auto;
  min-width: 0;
}
.detail-order-online-info {
  margin-left: 0;
  min-width: 0;
}
.detail-order-meta-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  padding-top: 8px;
  border-top: 1px solid #e8ecf1;
}
.detail-order-meta-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: #334155;
  white-space: nowrap;
}
.detail-order-blocks {
  display: flex;
  flex-direction: column;
  gap: 0;
}
.detail-order-block {
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 12px 14px;
  background: #fafbfc;
}
/* 2블록 → 1카드: 요약·옵션 가로 배치로 세로 점유 최소화 */
.detail-order-block.detail-order-compact {
  padding: 7px 12px 8px;
}
.detail-order-summary-row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 0;
  row-gap: 6px;
  column-gap: 0;
  line-height: 1.35;
}
.detail-order-kv {
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
  flex-wrap: wrap;
  max-width: 100%;
}
.detail-order-kv:not(:last-child)::after {
  content: '';
  display: inline-block;
  width: 1px;
  height: 12px;
  margin: 0 10px;
  background: #e2e8f0;
  vertical-align: middle;
  flex: 0 0 auto;
}
.detail-order-muted {
  color: #64748b;
  font-size: 12px;
  font-weight: 500;
}
.detail-order-options-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 18px;
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px solid #e8ecf1;
}
.detail-order-alert-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 6px;
}
.detail-lines-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}
.detail-lines-toolbar-title {
  font-size: 13px;
}
.detail-lines-toolbar-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}
.detail-order-opt {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: #334155;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}
.detail-order-opt input[type="checkbox"] {
  width: 14px;
  height: 14px;
  cursor: pointer;
  flex-shrink: 0;
}

.detail-order-po-notes {
  margin-top: 7px;
  padding-top: 7px;
  border-top: 1px solid #e8ecf1;
}

.detail-order-po-notes-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.detail-order-po-notes-row .detail-order-muted {
  flex: 0 0 auto;
}

.detail-order-po-notes-row .input {
  flex: 1 1 auto;
  min-width: 0;
}

/* ── 폼 ── */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid.col1 { grid-template-columns: 1fr; }
.form-full { grid-column: 1 / -1; }

.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-label { font-size: 12px; font-weight: 600; color: #475569; }
.form-required::after { content: ' *'; color: #ef4444; }

.location-notes-input {
  min-height: 84px;
  resize: vertical;
}

.location-name-status-row {
  display: flex;
  gap: 12px;
  align-items: flex-end;
}

.location-name-status-row .input {
  flex: 1;
  min-width: 0;
}

.location-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 0 10px 0 8px;
  border: 0;
  border-radius: 999px;
  background: #fff;
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.location-toggle-btn:hover {
  background: #f8fafc;
}

.location-toggle-btn.is-active {
  background: #eff6ff;
}

.location-toggle-btn.is-inactive {
  background: #f8fafc;
}

.location-toggle-thumb {
  position: relative;
  width: 38px;
  height: 22px;
  border-radius: 999px;
  background: #cbd5e1;
  transition: background-color 0.15s ease;
  flex-shrink: 0;
}

.location-toggle-thumb::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.22);
  transition: transform 0.15s ease;
}

.location-toggle-btn.is-active .location-toggle-thumb {
  background: #16a34a;
}

.location-toggle-btn.is-active .location-toggle-thumb::after {
  transform: translateX(16px);
}

.location-toggle-text {
  color: #475569;
  font-size: 13px;
  font-weight: 600;
}

.item-name-cell {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.item-name-content {
  min-width: 0;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  margin-top: 6px;
  flex-shrink: 0;
  background: #cbd5e1;
}

.status-dot.is-active {
  background: #16a34a;
}

.status-dot.is-inactive {
  background: #cbd5e1;
}

.location-row {
  cursor: pointer;
}

.location-row td,
.location-memo-row td {
  cursor: pointer;
  user-select: none;
}

.location-row.is-hovered,
.location-memo-row.is-hovered {
  background: #eef6ff;
}

.location-memo-cell {
  padding-top: 0;
  color: #64748b;
  border-top: 0;
}

.location-row:has(+ .location-memo-row) td {
  border-bottom: 0;
}

.location-memo-label {
  display: inline-block;
  margin-right: 8px;
  color: #94a3b8;
  font-size: 12px;
  font-weight: 700;
}

.location-memo-text {
  display: inline-block;
  max-width: calc(100% - 48px);
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: bottom;
  white-space: nowrap;
}

/* ── 로딩/빈 상태 ── */
.loading { text-align: center; padding: 40px; color: #94a3b8; }
.empty { text-align: center; padding: 40px; color: #94a3b8; font-size: 14px; }

/* ── 페이지네이션 ── */
.pagination {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  margin-top: 16px;
}

.page-btn {
  min-width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  background: #fff;
  color: #475569;
  font-size: 13px;
  cursor: pointer;
}

.page-btn:hover { background: #f1f5f9; }
.page-btn.active { background: #2563eb; color: #fff; border-color: #2563eb; }
.page-info { font-size: 12px; color: #64748b; margin-left: 8px; }

/* ── 토스트 ── */
#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  background: #1e293b;
  color: #fff;
  padding: 12px 18px;
  border-radius: 8px;
  font-size: 13px;
  box-shadow: 0 4px 12px rgba(0,0,0,.2);
  animation: slideIn .2s ease;
  min-width: 240px;
}

.toast.success { background: #065f46; border-left: 4px solid #10b981; }
.toast.error   { background: #7f1d1d; border-left: 4px solid #ef4444; }

@keyframes slideIn {
  from { opacity: 0; transform: translateX(20px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* ── 탭 ── */
.tabs { display: flex; gap: 4px; margin-bottom: 20px; border-bottom: 2px solid #e2e8f0; }

.tab-btn {
  padding: 8px 16px;
  border: none;
  background: none;
  font-size: 13px;
  font-weight: 500;
  color: #64748b;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all .15s;
}

.tab-btn:hover { color: #1e293b; }
.tab-btn.active { color: #2563eb; border-bottom-color: #2563eb; }

.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ── 상태별 색상 ── */
.status-draft    { color: #64748b; }
.status-ordered  { color: #2563eb; }
.status-received { color: #059669; }
.status-closed   { color: #475569; }
.status-cancelled{ color: #dc2626; text-decoration: line-through; }


/* ── 거래처 콤보박스 (검색+셀렉트) ── */
.vendor-combo-wrap {
  position: relative;
  width: 200px;
  height: 60px;
  flex-shrink: 0;
}

.vendor-combo-wrap > input.input-sm {
  position: absolute;
  top: 0;
  left: 0;
  width: 200px;
  padding: 4px 8px;
  font-size: 12px;
  box-sizing: border-box;
}

.vendor-combo-wrap select.select {
  position: absolute;
  top: 28px;
  left: 0;
  width: 200px;
  box-sizing: border-box;
}

/* 모달 내 인라인(한 줄) 거래처 콤보 */
.vendor-combo-inline {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  min-height: 32px;
  position: relative;
  /* select가 absolute 전환 시에도 콤보 래퍼 크기 유지 */
  min-width: 368px; /* input(140) + gap(8) + select(220) */
}

.vendor-combo-inline > input.input-sm {
  position: static;
  width: 140px;
  flex: none;
}

.vendor-combo-inline > select.select {
  position: static;
  width: 220px;
  flex: none;
}

/* select 펼쳐질 때: 다른 요소 위로 (오버레이) */
.vendor-combo-wrap select.expanded {
  z-index: 1000;
  box-shadow: 0 4px 12px rgba(0,0,0,.12);
  background: #fff;
}

/* 모달 내 인라인 콤보: 펼침 시 absolute 오버레이 (레이아웃 안 밀림) */
.vendor-combo-inline > select.expanded {
  position: absolute;
  top: 0;
  left: 148px; /* input 너비(140px) + gap(8px) */
  z-index: 1000;
  box-shadow: 0 4px 12px rgba(0,0,0,.12);
  background: #fff;
}

/* ── 기간 필터 (flatpickr range) ── */
.date-filter-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.date-filter-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.date-input-wrap {
  position: relative;
  display: inline-block;
}

.date-input-wrap .input {
  padding-right: 32px;
}

.date-icon {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 14px;
  cursor: pointer;
  opacity: 0.45;
}

.date-icon:hover {
  opacity: 0.8;
}

.date-quick-btns {
  display: inline-flex;
  gap: 3px;
  flex-shrink: 0;
}

.date-quick-btn {
  padding: 4px 8px !important;
  font-size: 11px !important;
  border-radius: 99px !important;
  white-space: nowrap;
}

.date-quick-btn.active {
  background: #2563eb !important;
  color: #fff !important;
  border-color: #2563eb !important;
}

/* flatpickr 커스터마이징 */
.flatpickr-calendar {
  font-family: 'Malgun Gothic', '맑은 고딕', Arial, sans-serif;
  font-size: 13px;
}

.flatpickr-day.selected,
.flatpickr-day.startRange,
.flatpickr-day.endRange {
  background: #2563eb;
  border-color: #2563eb;
}

.flatpickr-day.inRange {
  background: #dbeafe;
  border-color: #dbeafe;
  box-shadow: -5px 0 0 #dbeafe, 5px 0 0 #dbeafe;
}

.flatpickr-day.startRange {
  border-radius: 50px 0 0 50px;
}

.flatpickr-day.endRange {
  border-radius: 0 50px 50px 0;
}

/* ── 발주등록 수동 탭 레이아웃 ── */
.manual-form-layout {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.manual-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.manual-row > .form-label {
  min-width: 80px;
  width: 80px;
  flex-shrink: 0;
  white-space: nowrap;
}

.manual-row .field-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.manual-row .field-group .form-label {
  min-width: 80px;
  width: 80px;
  flex-shrink: 0;
  white-space: nowrap;
}

.manual-row textarea.input {
  flex: 1;
  min-height: 48px;
  resize: vertical;
}

/* ── 발주 품목 테이블 (table-layout:fixed) ── */
.order-lines-table td,
.order-lines-table th {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  box-sizing: border-box;
}

/* 입고·정산 워크플로우 표는 날짜 팝오버가 셀 밖으로 보여야 한다 */
.order-lines-table.workflow-receiving-table td,
.order-lines-table.workflow-receiving-table th {
  overflow: visible;
  text-overflow: clip;
}
/* 발주 상세「발주 품목」단계 — orders.html syncDetailLinesPhaseUI() 가 data-lines-phase 동기화 */
#tab-lines[data-lines-phase="edit_adding"] #detail-lines-table {
  outline: 2px solid rgba(59, 130, 246, 0.4);
  outline-offset: 3px;
  border-radius: 10px;
}
/* 발주 상세 품목 테이블: [읽기 모드]만 8개 td/행(수정 모드는 colspan=5 한 칸이라 아래 nth-child는 읽기에만 적용됨) */
#detail-lines-table td {
  white-space: normal;
  word-break: break-word;
  font-size: 13px;
  vertical-align: top;
}
/* 읽기 모드: 수량·입고현황·단가·금액 열 우측 정렬 */
#detail-lines-table thead th:nth-child(2),
#detail-lines-table thead th:nth-child(3),
#detail-lines-table thead th:nth-child(4),
#detail-lines-table thead th:nth-child(5),
#detail-lines-table tbody td:nth-child(2),
#detail-lines-table tbody td:nth-child(3),
#detail-lines-table tbody td:nth-child(4),
#detail-lines-table tbody td:nth-child(5) {
  text-align: right;
}

.order-lines-table .input,
.order-lines-table .select {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

/* ── 수정 모드 인라인 라벨 ── */
.edit-field-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.edit-field-group .edit-field-label {
  display: block;
  font-size: 10px;
  font-weight: 600;
  color: #94a3b8;
  white-space: nowrap;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  line-height: 1;
}
.edit-field-group .input,
.edit-field-group .edit-field-value {
  width: 100%;
  min-width: 0;
}
/* 라벨을 입력란 좌측에 배치 (수량·단가) */
.edit-field-group--inline {
  flex-direction: row;
  align-items: center;
  gap: 4px;
}
.edit-field-group--inline .edit-field-label {
  flex: 0 0 auto;
  min-width: 1.75rem;
  text-align: right;
  font-size: 12px;
  font-weight: 600;
  color: #64748b;
  text-transform: none;
  letter-spacing: 0;
  line-height: 1.25;
}
.edit-field-group--inline .input,
.edit-field-group--inline .edit-field-value {
  flex: 1;
  min-width: 0;
  width: auto;
}
.edit-field-name {
  font-size: 13px;
  font-weight: 600;
  color: #1e293b;
  line-height: 1.4;
}
.edit-field-value {
  font-size: 13px;
  color: #1e293b;
  font-weight: 500;
}

/* ── 수정 모드: 품목당 1행 번들 카드 ── */
.edit-line-bundle .edit-bundle-cell {
  padding: 0 0 10px !important;
  vertical-align: top;
  border-bottom: none !important;
}
.edit-line-bundle + .edit-line-bundle .edit-bundle-cell {
  padding-top: 4px !important;
  border-top: 1px solid #e2e8f0 !important;
}
.edit-bundle {
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
  border-left: 3px solid #3b82f6;
  transition: background 0.15s, box-shadow 0.15s;
  display: grid;
  /* 수정 모드: 수량·단가 fr 각 40% 축소(×0.6), 줄어든 폭을 품목에 합산 */
  grid-template-columns: minmax(140px, 2.176fr) minmax(64px, 0.802fr) minmax(64px, 0.802fr) minmax(64px, 1.03fr) auto;
  column-gap: 8px;
  row-gap: 0;
  align-items: end;
  padding: 10px 10px 0;
}
/* 3단계(edit_adding): 품목 검색 칸 넓힘 + 수량·단가 40% 축소분을 품목에 합산 */
.edit-line-bundle-add .edit-bundle {
  border-left-color: #22c55e;
  background: #f0fdf4;
  grid-template-columns: minmax(140px, 2.99fr) minmax(64px, 0.58fr) minmax(64px, 0.58fr) minmax(64px, 0.66fr) auto;
}
.edit-bundle-fields {
  display: grid;
  grid-template-columns: subgrid;
  grid-column: 1 / -1;
  row-gap: 0;
  column-gap: 8px;
  align-items: end;
  padding: 0;
}
.edit-bundle-name {
  min-width: 0;
}
/* 품목명만 라벨 없을 때 — 인접 열(수량·단가·금액) 입력 하단과 맞춤 */
.edit-bundle-name:not(.ol-item-cell) {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  min-height: 0;
}
/* 수량·단가·금액: 동일 스택 레이아웃, 입력(또는 읽기전용) 너비는 열의 절반 */
.edit-bundle-fields .edit-field-group--qty .input,
.edit-bundle-fields .edit-field-group--price .input,
.edit-bundle-fields .edit-field-group--qty .edit-field-value,
.edit-bundle-fields .edit-field-group--price .edit-field-value,
.edit-bundle-fields .edit-field-group--amount .edit-field-input-readonly {
  width: 50%;
  max-width: 100%;
  box-sizing: border-box;
  align-self: flex-start;
}
.edit-bundle-fields .edit-field-group--qty .input,
.edit-bundle-fields .edit-field-group--price .input,
.edit-bundle-fields .edit-field-group--amount .edit-field-input-readonly {
  text-align: right;
}
.edit-field-input-readonly {
  cursor: default;
  background: #f8fafc;
  border-color: #e2e8f0;
  color: #1e293b;
}
/* 1천만원 초과: 그룹이 아니라 금액 입력칸만 음영(외곽 패딩·테두리 없음 → 행 높이 유지) */
.edit-bundle-fields .edit-field-group--amount.is-amount-warning .edit-field-input-readonly {
  background: linear-gradient(180deg, rgba(254, 243, 199, 0.95) 0%, rgba(253, 224, 71, 0.38) 100%);
  border: 1px solid rgba(245, 158, 11, 0.45);
  border-radius: 6px;
  box-sizing: border-box;
}
/* 읽기 모드 금액: 편집 시 readonly 입력과 동일하게 숫자 부분만 음영(셀 전체 배경으로 행 높이·밴드 깨짐 방지) */
#detail-lines-table .line-amount-readout {
  font-weight: 500;
}
#detail-lines-table .line-amount-readout--warn {
  display: inline-block;
  max-width: 100%;
  box-sizing: border-box;
  padding: 2px 8px;
  border-radius: 6px;
  background: linear-gradient(180deg, rgba(254, 243, 199, 0.95) 0%, rgba(253, 224, 71, 0.38) 100%);
  border: 1px solid rgba(245, 158, 11, 0.45);
  vertical-align: baseline;
}
.edit-bundle-actions {
  justify-self: end;
  min-width: 0;
  overflow: visible;
}
.edit-bundle-actions .edit-field-group {
  align-items: center;
}
@media (max-width: 760px) {
  .edit-bundle {
    grid-template-columns: 1fr 1fr;
    column-gap: 12px;
    row-gap: 0;
  }
  .edit-bundle-name { grid-column: 1 / -1; }
  .edit-bundle-actions { grid-column: 1 / -1; justify-self: end; }
  .edit-bundle-fields .edit-field-group--qty .input,
  .edit-bundle-fields .edit-field-group--price .input,
  .edit-bundle-fields .edit-field-group--qty .edit-field-value,
  .edit-bundle-fields .edit-field-group--price .edit-field-value,
  .edit-bundle-fields .edit-field-group--amount .edit-field-input-readonly {
    width: 100%;
  }
}
.edit-bundle-confirm-btns {
  display: inline-flex;
  gap: 4px;
  align-items: center;
  justify-content: center;
}
/* 확정/취소만 있을 때 — 본문 필드와 세로 중앙 정렬 */
.edit-field-group-icon-only {
  padding-top: 0;
  gap: 0;
}
.edit-field-group-icon-only .edit-bundle-confirm-btns {
  margin-top: 0;
}
/* 하단 띠: subgrid — 1열(품목과 동일 너비)에 입고예정·실입고·입고지 한 줄 */
.edit-bundle-sub {
  display: grid;
  grid-template-columns: subgrid;
  grid-column: 1 / -1;
  row-gap: 0;
  column-gap: 8px;
  align-items: end;
  padding: 8px 0 10px;
  background: #f8fafc;
  border-top: 1px solid #e8ecf1;
}
.edit-bundle-sub-primary {
  grid-column: 1;
  justify-self: stretch;
  display: grid;
  /* 입고예정·실입고 각 20% 축소(0.8fr), 입고지에 폭 합산(1.4fr) */
  grid-template-columns: minmax(0, 0.8fr) minmax(0, 0.8fr) minmax(0, 1.4fr);
  column-gap: 10px;
  min-width: 0;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  align-items: end;
}
.edit-bundle-sub-primary > .edit-field-group {
  min-width: 0;
  width: 100%;
  max-width: 100%;
  align-items: stretch;
  align-self: stretch;
}
.edit-bundle-sub-primary .edit-field-group--date {
  align-items: stretch;
}
.edit-bundle-sub-primary .edit-field-label {
  width: 100%;
  max-width: 100%;
}
.edit-bundle-sub-primary .edit-bundle-sub-field--loc .select {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}
.edit-bundle-sub .edit-field-group-notes {
  grid-column: 2 / -1;
  min-width: 0;
}
.edit-bundle-sub .edit-field-group-notes .input,
.edit-bundle-sub .edit-field-group-notes .edit-field-value {
  width: 100%;
}
/* 입고예정일: 브라우저 기본 min-width 때문에 %만으로는 줄지 않음 → 고정 폭(약 60% 상당) */
.edit-field-group--date {
  align-items: flex-start;
}
.edit-field-group--date .input[type="date"] {
  width: 7rem;
  min-width: 0 !important;
  max-width: 7rem;
  box-sizing: border-box;
  flex: 0 0 auto;
}
.edit-field-group--date .input[type="date"]::-webkit-calendar-picker-indicator {
  cursor: pointer;
}
.edit-field-group--date .edit-field-value {
  display: inline-block;
  max-width: 7rem;
  vertical-align: middle;
}
.edit-bundle-sub .select {
  max-width: 100%;
}
.edit-bundle-sub .edit-field-value {
  word-break: break-word;
}
/* 품목 열 안: 날짜·입고지 입력이 열 전체를 쓰도록 (전역 7rem 규칙 완전 무시) */
.edit-bundle-sub-primary .edit-field-group--date .input[type="date"] {
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
  flex: 1 1 auto;
  align-self: stretch;
  box-sizing: border-box;
}
.edit-bundle-sub-primary .edit-field-group--date .edit-field-value {
  display: block;
  max-width: 100%;
  width: 100%;
  box-sizing: border-box;
}
@media (max-width: 760px) {
  .edit-bundle-sub-primary {
    grid-column: 1 / -1;
    grid-template-columns: 1fr;
  }
  .edit-bundle-sub .edit-field-group-notes {
    grid-column: 1 / -1;
  }
}
.edit-line-bundle.edit-hover .edit-bundle {
  background: #f0f5ff;
  box-shadow: 0 1px 0 #dbeafe inset;
}
.edit-line-bundle-add.edit-hover .edit-bundle {
  background: #dcfce7 !important;
  box-shadow: none;
}
.edit-line-bundle.edit-hover .btn-danger.btn-xs:not(.btn-icon-circle) {
  opacity: 1;
}

#detail-lines-table[data-lines-phase="edit"] thead,
#detail-lines-table[data-lines-phase="edit_adding"] thead {
  display: table-header-group;
}

#detail-lines-table[data-lines-phase="edit"] .edit-line-main-row td,
#detail-lines-table[data-lines-phase="edit_adding"] .edit-line-main-row td {
  background: #fff;
  border-bottom: none;
}

#detail-lines-table[data-lines-phase="edit"] .edit-line-note-row td,
#detail-lines-table[data-lines-phase="edit_adding"] .edit-line-note-row td {
  background: #fbfcfe;
  padding-top: 0;
}

#detail-lines-table[data-lines-phase="edit"] .edit-line-main-row.edit-hover td,
#detail-lines-table[data-lines-phase="edit"] .edit-line-note-row.edit-hover td,
#detail-lines-table[data-lines-phase="edit_adding"] .edit-line-main-row.edit-hover td,
#detail-lines-table[data-lines-phase="edit_adding"] .edit-line-note-row.edit-hover td {
  background: #f8fbff;
}

.order-line-note-wrap--edit {
  padding: 0 0 10px;
}

.edit-line-actions {
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
  gap: 8px;
}

.edit-inline-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 120px;
}

.edit-inline-field .input {
  width: 100%;
}

.edit-inline-label {
  font-size: 11px;
  font-weight: 700;
  color: #64748b;
}

/* (구) edit-sub-fields — 발주등록 등 다른 화면 호환용 */
.edit-sub-fields {
  display: flex;
  gap: 16px;
  align-items: center;
  flex-wrap: wrap;
  background: transparent;
  border-radius: 0;
  padding: 4px 0 2px 0;
  transition: background 0.15s;
}
.edit-sub-fields-stacked {
  align-items: flex-end;
  gap: 12px 20px;
}
.edit-sub-fields-stacked .edit-field-group {
  min-width: 0;
  flex: 0 1 auto;
}
.edit-sub-fields-stacked .edit-field-group:not(.edit-field-group-notes) {
  width: 160px;
}
.edit-sub-fields-stacked .edit-field-group-notes {
  flex: 1 1 200px;
  min-width: 160px;
}
.edit-sub-fields-stacked .edit-field-group-notes .input {
  width: 100%;
}
.edit-sub-fields-stacked input[type="date"] {
  width: 100%;
  max-width: 180px;
}
.edit-sub-fields-stacked .select {
  width: 100%;
  max-width: 220px;
}
.edit-sub-fields-stacked .edit-field-value {
  word-break: break-word;
}
.edit-sub-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: #64748b;
  white-space: nowrap;
}
.edit-sub-label > span:first-child {
  font-weight: 600;
  color: #475569;
  flex-shrink: 0;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}
.edit-sub-label .input,
.edit-sub-label .select {
  width: auto;
  min-width: 0;
  font-size: 12px;
}
.edit-sub-label input[type="date"] {
  width: 140px;
}
.edit-sub-label select {
  width: 130px;
}
.edit-sub-label-notes {
  flex: 1;
  min-width: 160px;
}
.edit-sub-label-notes .input {
  flex: 1;
  width: 100%;
}

/* 수정 모드 숫자 입력 우측 정렬 */
.edit-line-bundle .input.input-sm {
  text-align: right;
}
.edit-bundle-fields .input[type="number"] {
  text-align: right;
}

/* 수정 모드 삭제 버튼 (원형 확정/취소 .btn-icon-circle 은 공통 스타일 유지) */
.edit-line-bundle .btn-danger.btn-xs:not(.btn-icon-circle) {
  width: 24px;
  height: 24px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-size: 12px;
  opacity: 0.5;
  transition: opacity 0.15s;
}

/* 추가 품목 행 구분 */
.edit-add-btn-row td {
  border-top: 1px dashed #cbd5e1 !important;
}

/* ── 인라인 품목 입력(번들 내부) ── */
.edit-line-bundle .edit-bundle .input,
.edit-line-bundle .edit-bundle .select {
  font-size: 12px;
  padding: 5px 8px;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

/* 발주 등록 모달: 단일 행 인라인 입력 (번들 구조 아님) */
#modal-create-order .order-line-input td {
  padding: 6px 8px;
  vertical-align: middle;
  background: #f0fdf4 !important;
}
#modal-create-order .order-line-input td:first-child {
  border-left: 3px solid #22c55e;
}
#modal-create-order .order-line-input td .input,
#modal-create-order .order-line-input td .select {
  font-size: 12px;
  padding: 5px 8px;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

#modal-create-order .order-lines-table thead th:nth-child(5),
#modal-create-order .order-lines-table tbody td:nth-child(5) {
  min-width: 132px;
}

#modal-create-order .order-lines-table thead th:nth-child(6),
#modal-create-order .order-lines-table tbody td:nth-child(6) {
  min-width: 160px;
}

#modal-create-order .order-line-main-row td:nth-child(5) .input[type="date"] {
  width: 100%;
  min-width: 128px;
  max-width: none;
  padding-left: 10px;
  padding-right: 10px;
  box-sizing: border-box;
}

#detail-lines-table[data-lines-phase="edit"] thead th:nth-child(5),
#detail-lines-table[data-lines-phase="edit"] tbody td:nth-child(5),
#detail-lines-table[data-lines-phase="edit_adding"] thead th:nth-child(5),
#detail-lines-table[data-lines-phase="edit_adding"] tbody td:nth-child(5) {
  min-width: 132px;
}

#detail-lines-table[data-lines-phase="edit"] thead th:nth-child(6),
#detail-lines-table[data-lines-phase="edit"] tbody td:nth-child(6),
#detail-lines-table[data-lines-phase="edit_adding"] thead th:nth-child(6),
#detail-lines-table[data-lines-phase="edit_adding"] tbody td:nth-child(6) {
  min-width: 160px;
}

#detail-lines-table[data-lines-phase="edit"] .edit-line-main-row td:nth-child(5) .input[type="date"],
#detail-lines-table[data-lines-phase="edit_adding"] .edit-line-main-row td:nth-child(5) .input[type="date"] {
  width: 100%;
  min-width: 128px;
  max-width: none;
  padding-left: 10px;
  padding-right: 10px;
  box-sizing: border-box;
}

#modal-create-order .order-line-main-row td:nth-child(5) .input[type="date"]::-webkit-calendar-picker-indicator,
#detail-lines-table[data-lines-phase="edit"] .edit-line-main-row td:nth-child(5) .input[type="date"]::-webkit-calendar-picker-indicator,
#detail-lines-table[data-lines-phase="edit_adding"] .edit-line-main-row td:nth-child(5) .input[type="date"]::-webkit-calendar-picker-indicator {
  opacity: 1;
  cursor: pointer;
  margin-left: 0;
  margin-right: 0;
}

#modal-create-order .order-line-main-row td:nth-child(5) .input[type="date"]::-webkit-clear-button,
#modal-create-order .order-line-main-row td:nth-child(5) .input[type="date"]::-webkit-inner-spin-button,
#detail-lines-table[data-lines-phase="edit"] .edit-line-main-row td:nth-child(5) .input[type="date"]::-webkit-clear-button,
#detail-lines-table[data-lines-phase="edit"] .edit-line-main-row td:nth-child(5) .input[type="date"]::-webkit-inner-spin-button,
#detail-lines-table[data-lines-phase="edit_adding"] .edit-line-main-row td:nth-child(5) .input[type="date"]::-webkit-clear-button,
#detail-lines-table[data-lines-phase="edit_adding"] .edit-line-main-row td:nth-child(5) .input[type="date"]::-webkit-inner-spin-button {
  display: none;
}

.order-line-main-row td {
  border-bottom: none;
}

.order-line-note-row td,
.order-line-input-note td {
  padding-top: 0;
  background: #fbfcfe;
}

.order-line-note-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 0 8px;
}

.order-line-note-wrap .input {
  flex: 1 1 auto;
  min-width: 0;
}

.order-line-note-label {
  flex: 0 0 auto;
  font-size: 11px;
  font-weight: 700;
  color: #64748b;
}

.ol-item-cell {
  position: relative;
}

.ol-item-dropdown {
  position: fixed;
  z-index: 2000;
  background: #fff;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  max-height: 200px;
  overflow-y: auto;
  box-shadow: 0 4px 16px rgba(0,0,0,.15);
  min-width: 240px;
}

.ol-item-option {
  padding: 7px 12px;
  font-size: 13px;
  color: #334155;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ol-item-option:hover {
  background: #f1f5f9;
}

.ol-item-option.highlighted {
  background: #dbeafe;
  color: #1d4ed8;
}

.ol-item-option.has-order-history {
  background: #f0fdf4;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.ol-item-option.has-order-history:hover {
  background: #dcfce7;
}

.ol-item-option.has-order-history.highlighted {
  background: #bbf7d0;
  color: #166534;
}

.ol-item-history-tag {
  display: inline-block;
  font-size: 10px;
  font-weight: 500;
  color: #15803d;
  background: #dcfce7;
  border: 1px solid #bbf7d0;
  border-radius: 99px;
  padding: 1px 6px;
  margin-left: 8px;
  flex-shrink: 0;
}

.ol-item-divider {
  display: flex;
  align-items: center;
  padding: 4px 12px;
  font-size: 11px;
  color: #94a3b8;
  gap: 8px;
}

.ol-item-divider::before,
.ol-item-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: #e2e8f0;
}

.ol-item-no-result {
  padding: 10px 12px;
  font-size: 12px;
  color: #94a3b8;
  text-align: center;
}

/* ── 품목별 수정 이력 버튼 ── */
.btn-line-history {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 30px;
  height: 20px;
  padding: 0 6px;
  border: 1px solid #dbeafe;
  border-radius: 999px;
  background: #eff6ff;
  color: #2563eb;
  cursor: pointer;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  vertical-align: middle;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.btn-line-history:hover {
  background: #dbeafe;
  border-color: #93c5fd;
  color: #1d4ed8;
}

/* ── 품목별 수정 이력 팝오버 ── */
.line-history-popover {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,.15);
  width: 520px;
  max-width: 90vw;
  max-height: 320px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.line-history-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-bottom: 1px solid #e2e8f0;
  font-size: 13px;
  background: #f8fafc;
}

.line-history-body {
  overflow-y: auto;
  padding: 8px;
}

.line-history-body table { border-collapse: collapse; }
.line-history-body th { padding: 6px 8px; font-size: 11px; }
.line-history-body td { padding: 5px 8px; border-bottom: 1px solid #f1f5f9; }

/* ── 라인 상세 패널 (Phase 5) ── */
.line-detail-panel {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 14px;
  margin-top: 16px;
}

.line-detail-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid #e2e8f0;
  font-size: 14px;
  font-weight: 600;
  color: #1e293b;
}

.line-detail-header .badge { margin-left: 4px; }

.line-detail-summary {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 10px;
}

.line-summary-item {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 8px 10px;
  min-width: 0;
}

.line-summary-item--wide {
  grid-column: span 2;
}

.line-summary-label {
  display: block;
  margin-bottom: 4px;
  font-size: 11px;
  font-weight: 700;
  color: #64748b;
}

.line-summary-value {
  display: block;
  font-size: 12px;
  line-height: 1.4;
  color: #1e293b;
  word-break: break-word;
}

.line-next-actions {
  margin-bottom: 12px;
  padding: 10px 12px;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
}
.line-next-actions-label {
  font-size: 11px;
  font-weight: 700;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 8px;
}
.line-next-actions-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.line-next-actions-chip,
.task-chip {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 4px 9px;
  font-size: 11px;
  font-weight: 600;
}
.line-next-actions-chip {
  background: #eff6ff;
  color: #1d4ed8;
}
.line-next-actions-empty {
  font-size: 12px;
  color: #64748b;
}
.task-chip-green { background: #dcfce7; color: #166534; }
.task-chip-slate { background: #e2e8f0; color: #334155; }
.task-chip-amber { background: #fef3c7; color: #92400e; }
.task-chip-danger { background: #fee2e2; color: #b91c1c; }
.task-chip-purple { background: #f3e8ff; color: #7c3aed; }

.line-workspace-grid {
  display: grid;
  gap: 12px;
}

.line-section-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 12px;
}

.line-section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.line-section-head strong {
  display: block;
  font-size: 13px;
  color: #0f172a;
}

.line-section-head p {
  margin: 3px 0 0;
  font-size: 12px;
  color: #64748b;
  line-height: 1.45;
}

.line-section-head--stacked {
  margin-bottom: 8px;
}

.line-receiving-section {
  margin-bottom: 0;
}

.line-receiving-section table {
  font-size: 12px;
}

.line-receiving-section table thead th {
  font-size: 11px;
  padding: 6px 10px;
}

.line-receiving-section table tbody td {
  padding: 6px 10px;
}

.line-receiving-section table tfoot td {
  padding: 6px 10px;
  font-weight: 600;
  border-top: 2px solid #e2e8f0;
  font-size: 12px;
}

/* 라인 상태 배지 */
.line-status-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 500;
}

.line-status-badge.badge-pending  { background: #f1f5f9; color: #475569; }
.line-status-badge.badge-partial  { background: #fef3c7; color: #92400e; }
.line-status-badge.badge-received { background: #d1fae5; color: #065f46; }
.line-status-badge.badge-settled  { background: #dbeafe; color: #1d4ed8; }

/* 입고 목록 테이블 내 신규 입력 행 */
.receiving-draft-row td {
  vertical-align: middle;
  padding-top: 8px;
  padding-bottom: 8px;
}

.receiving-draft-row td .input {
  margin: 0;
}

/* 정산 요약 영역 */
.line-settlement-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  padding: 0 0 10px;
  margin-top: 0;
  margin-bottom: 10px;
  font-size: 13px;
  color: #334155;
  border-bottom: 1px solid #e2e8f0;
}

.line-settlement-summary .settlement-item {
  display: flex;
  align-items: center;
  gap: 4px;
}

.line-settlement-summary .settlement-item .settlement-label {
  font-size: 12px;
  color: #64748b;
}

.line-settlement-summary .settlement-item .settlement-value {
  font-weight: 600;
}

/* 증빙 관리 영역 (Phase 6) */
.line-evidence-section {
  margin-top: 0;
  padding-top: 12px;
  border-top: none;
}

.line-evidence-section strong {
  font-size: 13px;
  color: #1e293b;
  display: block;
  margin-bottom: 8px;
}

.line-evidence-caption {
  margin: 0 0 10px;
  font-size: 12px;
  color: #64748b;
}

.line-evidence-cards {
  display: grid;
  gap: 10px;
}

.evidence-card {
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
  border: 1px solid #dbe4ee;
  border-radius: 10px;
  padding: 12px;
}

.evidence-card.is-complete {
  border-color: #86efac;
  box-shadow: inset 0 0 0 1px rgba(34, 197, 94, 0.15);
}

.evidence-card-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.evidence-card-head h4 {
  margin: 0 0 4px;
  font-size: 13px;
  color: #0f172a;
}

.evidence-card-head p {
  margin: 0;
  font-size: 12px;
  color: #64748b;
  line-height: 1.45;
}

.evidence-date-field {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  flex-shrink: 0;
  /* 힌트 문장이 컨트롤 줄과 같은 폭으로 한 덩어리 표시되도록 여유 폭 */
  max-width: min(340px, 100%);
}

/* 세금계산서: 번호 + 발행일 + 처리함 */
.evidence-date-field--wide {
  max-width: min(480px, 100%);
}

.evidence-date-field-title {
  font-size: 11px;
  color: #64748b;
  font-weight: 500;
  align-self: flex-end;
}

.evidence-date-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.evidence-date-controls .input-sm {
  min-width: 132px;
}

.evidence-date-controls .evidence-tax-number {
  min-width: 100px;
  max-width: 140px;
  width: 8.5rem;
}

.evidence-date-hint {
  margin: 0;
  font-size: 10px;
  color: #94a3b8;
  line-height: 1.4;
  text-align: right;
  /* 부모(.evidence-date-field) 전체 너비 사용 — 220px 때문에만 덜렁 줄바꿈 나지 않음 */
  align-self: stretch;
  max-width: 100%;
  word-break: keep-all;
  overflow-wrap: break-word;
}

.evidence-check--inline {
  flex-shrink: 0;
  margin: 0;
}

.evidence-check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: #334155;
  cursor: pointer;
  user-select: none;
}

.evidence-check input[type="checkbox"] {
  width: 14px;
  height: 14px;
  margin: 0;
}

.evidence-dropzone {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px dashed #cbd5e1;
  background: #f8fafc;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.evidence-dropzone--active {
  border-color: #3b82f6;
  background: #eff6ff;
}

.evidence-dropzone .evidence-upload-row {
  margin-top: 0;
}

.evidence-dropzone-hint {
  margin: 8px 0 0;
  font-size: 11px;
  color: #94a3b8;
  line-height: 1.35;
}

.evidence-upload-row {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 10px;
  flex-wrap: wrap;
}

.evidence-upload-row input[type="file"] {
  max-width: 260px;
  font-size: 12px;
}

.evidence-files {
  margin-top: 10px;
  display: grid;
  gap: 6px;
}

.evidence-file-item {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
  padding: 8px 10px;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
}

.evidence-file-meta {
  min-width: 0;
}

.evidence-file-meta strong,
.evidence-file-meta span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
}

.evidence-file-meta strong {
  font-size: 12px;
  color: #1e293b;
  white-space: nowrap;
}

.evidence-file-meta span {
  margin-top: 2px;
  font-size: 11px;
  color: #94a3b8;
  white-space: normal;
}

.evidence-file-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.evidence-empty {
  padding: 8px 10px;
  border: 1px dashed #cbd5e1;
  border-radius: 8px;
  font-size: 12px;
  color: #94a3b8;
}

.surplus-option {
  margin-top: 8px;
  display: flex;
  align-items: flex-start;
  gap: 6px;
  font-size: 12px;
  color: #334155;
}

.surplus-option small {
  display: block;
  margin-top: 2px;
  font-size: 11px;
  color: #94a3b8;
}

@media (max-width: 1100px) {
  .line-detail-summary {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .line-summary-item--wide {
    grid-column: span 3;
  }
}

/* 입고현황 텍스트 */
.receiving-summary-text {
  font-size: 12px;
  color: #475569;
}

/* 증빙 요약 텍스트 (발주 목록 / 상세 헤더) */
.evidence-summary-text {
  font-size: 12px;
  color: #64748b;
}

/* 라인 테이블 입고 버튼 */
.btn-line-detail {
  padding: 3px 8px;
  font-size: 11px;
}
.line-item-cell {
  cursor: pointer;
}
.view-line-main-row td {
  border-bottom: none;
}
.view-line-note-row td {
  padding-top: 0;
  background: #fbfcfe;
}
#detail-lines-table tbody.view-line-note-row td,
#detail-lines-table tr.view-line-note-row td {
  text-align: left !important;
}
.view-line-meta-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px 10px;
  padding: 2px 0 6px;
}
.view-line-chip-cell {
  padding-top: 2px;
  padding-bottom: 6px;
  vertical-align: top;
}
.line-name-cell {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0;
}
.line-name-row {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  flex-wrap: wrap;
}
.line-name-trigger {
  font-weight: 600;
  color: #334155;
}
.line-item-cell:hover .line-name-trigger {
  color: #1d4ed8;
  text-decoration: underline;
}
.line-task-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 0;
}
.line-item-note {
  font-size: 12px;
  color: #64748b;
  line-height: 1.4;
  white-space: normal;
  word-break: break-word;
}
.line-price-warning {
  margin-top: 4px;
  font-size: 11px;
  font-weight: 700;
  color: #b91c1c;
}

/* ── 반응형 보정 ── */
@media (max-width: 1200px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .dashboard-two-col { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .dashboard-meta-strip {
    grid-template-columns: 1fr;
  }
  .dashboard-meta-item {
    flex-wrap: wrap;
  }
  .dashboard-meta-hint {
    margin-left: 0;
    width: 100%;
  }
  .line-detail-summary {
    grid-template-columns: 1fr;
  }
  .line-summary-item--wide {
    grid-column: span 1;
  }
  .line-section-head {
    flex-direction: column;
    align-items: stretch;
  }
  .date-filter-group {
    flex-wrap: wrap;
  }
  .date-filter-group #filter-date-range {
    min-width: 160px;
  }
}

/* ── 입고 기록 테이블 컬럼 너비 ── */
.receiving-records-table {
  table-layout: fixed;
}

/* 입고일: 표시·date input 여유 (잘림 방지) */
.receiving-records-table .recv-col-date {
  width: 124px;
}

/* 수량: 우측 정렬 숫자 — 폭은 좁게 두고 날짜 열에 공간 우선 */
.receiving-records-table .recv-col-qty {
  width: 76px;
}

/* 메모: 나머지 공간 전부 (auto) */
.receiving-records-table .recv-col-memo {
  width: auto;
}

/* 관리: 이전 대비 약 절반 — 버튼은 세로로 두 줄 배치 */
.receiving-records-table .recv-col-actions {
  width: 79px;
}

/* 헤더·푸터: 본문과 동일 정렬 */
.receiving-records-table thead th:nth-child(1),
.receiving-records-table tfoot td:nth-child(1) {
  text-align: left;
}

.receiving-records-table thead th:nth-child(3) {
  text-align: left;
}

.receiving-records-table thead th:nth-child(4),
.receiving-records-table tfoot td:nth-child(4) {
  text-align: center;
}

/* 입고일·수량 본문: 줄바꿈 방지, 긴 텍스트는 말줄임 */
.receiving-records-table tbody td:nth-child(1),
.receiving-records-table tbody td:nth-child(2) {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.receiving-records-table thead th:nth-child(1),
.receiving-records-table thead th:nth-child(2),
.receiving-records-table tfoot td:nth-child(1),
.receiving-records-table tfoot td:nth-child(2) {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 관리 열: 좁은 폭에서 버튼 2개 세로 배치 */
.receiving-records-table thead th:nth-child(4),
.receiving-records-table tbody td:nth-child(4),
.receiving-records-table tfoot td:nth-child(4) {
  white-space: normal;
  overflow: visible;
  vertical-align: middle;
}

.receiving-records-table tbody td:nth-child(4) {
  text-align: center;
}

.receiving-records-table tbody td:nth-child(4) .btn-xs {
  display: block;
  width: 100%;
  box-sizing: border-box;
  margin: 0 0 4px;
}

.receiving-records-table tbody td:nth-child(4) .btn-xs:last-child {
  margin-bottom: 0;
}

/* 수량 열: 우측 정렬 */
.receiving-records-table thead th:nth-child(2),
.receiving-records-table tbody td:nth-child(2),
.receiving-records-table tfoot td:nth-child(2) {
  text-align: right;
}

/* 메모 열: 넘칠 때 줄바꿈 허용 (긴 메모 자연스럽게 표시) */
.receiving-records-table tbody td:nth-child(3) {
  white-space: normal;
  word-break: break-word;
  overflow: visible;
}

/* 메모 입력: 칼럼 전체 너비 사용 */
.receiving-records-table td:nth-child(3) .recv-memo-input {
  width: 100%;
  max-width: none;
  box-sizing: border-box;
}

/* 입고일·수량 입력: 칼럼 폭에 맞춤 (신규 행·인라인 수정 공통) */
.receiving-records-table tbody td:nth-child(1) .input,
.receiving-records-table tbody td:nth-child(2) .input {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}


/* Receipt-level delivery statements */
.receiving-statements { display: grid; gap: 6px; margin-top: 8px; }
.receiving-statements a { overflow-wrap: anywhere; font-size: 12px; }
.receiving-file-label { display: block; margin-top: 8px; font-size: 12px; font-weight: 600; }
.receiving-file-label input[type="file"] { display: block; width: 100%; min-width: 0; margin-top: 4px; font-size: 12px; }
.receiving-file-hint { display: block; margin-top: 4px; color: #64748b; font-size: 11px; }


/* Supplier quotations belong to the whole purchase order. */
.order-quotation-card { margin: 12px 0 18px; padding: 14px 16px; border: 1px solid #dbe3ee; border-radius: 10px; background: #f8fafc; }
.order-quotation-heading { display: flex; gap: 12px; align-items: baseline; flex-wrap: wrap; margin-bottom: 8px; }
.order-quotation-heading span, .order-quotation-card small { color: #64748b; font-size: 12px; }
.order-quotation-list { display: grid; gap: 8px; margin-bottom: 10px; }
.order-quotation-file { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.order-quotation-file a { overflow-wrap: anywhere; }
.order-quotation-upload { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin-bottom: 6px; }
.order-quotation-upload[hidden] { display: none; }
.order-quotation-upload input { max-width: 100%; min-width: 0; }
