/* 에버시스템 출고·제품정보 관리 — 내부 업무용 스타일 (요구사항 #26, #27) */
:root {
  --navy-900: #0a2036;
  --navy-800: #0e2a46;
  --navy-700: #123a5f;
  --navy-600: #17497a;
  --blue-600: #1b64c9;
  --blue-500: #2478e0;
  --blue-400: #4b93ea;
  --blue-050: #eef4fc;
  --ink: #17222e;
  --ink-soft: #48586a;
  --muted: #7b8a9c;
  --line: #dbe3ec;
  --line-soft: #e9eef5;
  --bg: #f4f7fb;
  --white: #ffffff;
  --ok: #1f8f5f;
  --ok-bg: #e8f6ef;
  --warn: #b4690e;
  --warn-bg: #fdf3e2;
  --err: #c0392b;
  --err-bg: #fdecea;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 42, 70, 0.06), 0 8px 24px rgba(16, 42, 70, 0.06);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Malgun Gothic", "맑은 고딕", "Apple SD Gothic Neo", "Noto Sans KR", -apple-system,
    BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 14px;
  line-height: 1.5;
}

a { color: var(--blue-600); text-decoration: none; }
a:hover { text-decoration: underline; }

.wrap { max-width: 1320px; margin: 0 auto; padding: 0 24px; }

/* ── 헤더 ───────────────────────────────────────────────── */
.site-header {
  background: var(--navy-800);
  color: #fff;
  border-bottom: 3px solid var(--blue-500);
  position: sticky;
  top: 0;
  z-index: 40;
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: 60px;
}
.brand { display: flex; align-items: center; gap: 12px; color: #fff; }
.brand:hover { text-decoration: none; }
.brand-mark {
  font-weight: 800;
  letter-spacing: 0.14em;
  font-size: 17px;
  color: #fff;
  background: linear-gradient(135deg, var(--blue-500), var(--navy-600));
  padding: 6px 10px;
  border-radius: 6px;
}
.brand-divider { width: 1px; height: 22px; background: rgba(255, 255, 255, 0.28); }
.brand-title { font-size: 15px; font-weight: 600; color: #dbe8f7; }
.header-actions { display: flex; align-items: center; gap: 10px; }

.conn-status { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: #cfe0f2; }
.conn-status .dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--muted); display: inline-block;
}
.conn-status.on .dot { background: #3ddc84; }
.conn-status.off .dot { background: #ff8b7a; }

/* ── 버튼 ───────────────────────────────────────────────── */
.btn {
  font: inherit;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 8px 14px;
  cursor: pointer;
  font-weight: 600;
  transition: background 0.12s ease, border-color 0.12s ease;
  white-space: nowrap;
}
.btn-primary { background: var(--blue-600); color: #fff; }
.btn-primary:hover { background: var(--navy-600); }
.btn-ghost {
  background: transparent;
  color: #e6effa;
  border-color: rgba(255, 255, 255, 0.32);
}
.btn-ghost:hover { background: rgba(255, 255, 255, 0.12); }
.btn-outline { background: #fff; color: var(--navy-700); border-color: var(--line); }
.btn-outline:hover { border-color: var(--blue-400); color: var(--blue-600); }
.btn-danger { background: #fff; color: var(--err); border-color: #f4c7c0; }
.btn-danger:hover { background: var(--err-bg); border-color: var(--err); color: var(--err); }
.btn-sm { padding: 5px 10px; font-size: 12.5px; border-radius: 6px; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }

/* ── 메인 검색 영역 ─────────────────────────────────────── */
.hero { padding: 34px 0 22px; text-align: center; }
.hero h1 { margin: 0 0 6px; font-size: 26px; color: var(--navy-800); letter-spacing: -0.01em; }
.hero p.sub { margin: 0 0 22px; color: var(--ink-soft); font-size: 14.5px; }

.search-bar { display: flex; gap: 10px; max-width: 860px; margin: 0 auto; }
.search-bar input[type="text"] {
  flex: 1;
  font-size: 16px;
  padding: 15px 18px;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  background: #fff;
  box-shadow: var(--shadow);
  outline: none;
}
.search-bar input[type="text"]:focus { border-color: var(--blue-500); box-shadow: 0 0 0 4px rgba(36, 120, 224, 0.14); }
.search-bar .btn { padding: 0 26px; font-size: 16px; }

.quick-actions { display: flex; gap: 10px; justify-content: center; margin-top: 14px; flex-wrap: wrap; }

/* ── 카드/패널 ──────────────────────────────────────────── */
.panel {
  background: #fff;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 18px;
}
.panel-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--line-soft);
  flex-wrap: wrap;
}
.panel-head h2 { margin: 0; font-size: 16px; color: var(--navy-800); }
.panel-body { padding: 16px 18px; }

.result-meta { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; color: var(--ink-soft); font-size: 13px; }
.result-meta strong { color: var(--blue-600); font-size: 15px; }

/* ── 필터 ───────────────────────────────────────────────── */
.filters { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
/* 날짜 범위(시작~끝)는 2칸을 차지해, 항목이 줄어도 한 줄이 어색하게 비지 않도록 한다 */
.filters .field-wide { grid-column: span 2; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field label { font-size: 12px; font-weight: 600; color: var(--ink-soft); }
.field input, .field select, .field textarea {
  font: inherit; padding: 8px 10px; border: 1px solid var(--line);
  border-radius: 7px; background: #fff; outline: none; width: 100%;
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--blue-500); }
/* 특이사항: 여러 줄 입력 + 세로 크기 조절 가능 */
.field textarea { resize: vertical; min-height: 74px; line-height: 1.5; font-family: inherit; }
.range { display: flex; align-items: center; gap: 6px; }
.range span { color: var(--muted); }
.filter-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 14px; }
.filter-toggle { display: none; }

/* ── 테이블 ─────────────────────────────────────────────── */
.table-scroll { overflow-x: auto; }
table.grid { width: 100%; border-collapse: collapse; font-size: 12.5px; table-layout: fixed; }
table.grid th, table.grid td {
  padding: 7px 5px; border-bottom: 1px solid var(--line-soft); text-align: left;
  white-space: normal; overflow-wrap: anywhere; line-height: 1.4;
}
/* ── 목록 표: 가로 스크롤 없이 13개 열을 한 화면에 (요청) ── */
table.grid { font-size: 12.5px; table-layout: fixed; }
table.grid th, table.grid td { padding: 7px 5px; overflow-wrap: anywhere; white-space: normal; line-height: 1.4; }
table.grid th:nth-child(5), table.grid td:nth-child(5),
table.grid th:nth-child(6), table.grid td:nth-child(6),
table.grid th:nth-child(12), table.grid td:nth-child(12),
table.grid th:nth-child(13), table.grid td:nth-child(13) { white-space: nowrap; }
table.grid th:nth-child(1),table.grid td:nth-child(1){width:7.7%}
table.grid th:nth-child(2),table.grid td:nth-child(2){width:8.2%}
table.grid th:nth-child(3),table.grid td:nth-child(3){width:6.9%}
table.grid th:nth-child(4),table.grid td:nth-child(4){width:13.4%}
table.grid th:nth-child(5),table.grid td:nth-child(5){width:5.8%}
table.grid th:nth-child(6),table.grid td:nth-child(6){width:5.8%}
table.grid th:nth-child(7),table.grid td:nth-child(7){width:7.0%}
table.grid th:nth-child(8),table.grid td:nth-child(8){width:5.5%}
table.grid th:nth-child(9),table.grid td:nth-child(9){width:6.0%}
table.grid th:nth-child(10),table.grid td:nth-child(10){width:10.1%}
table.grid th:nth-child(11),table.grid td:nth-child(11){width:5.2%}
table.grid th:nth-child(12),table.grid td:nth-child(12){width:6.4%}
table.grid th:nth-child(13),table.grid td:nth-child(13){width:12.0%}
.cell-actions { flex-wrap: wrap; }

table.grid thead th {
  background: var(--blue-050); color: var(--navy-700); font-weight: 700; font-size: 12.5px;
  /* top 은 반드시 0 이어야 한다.
     .table-scroll 은 overflow-x:auto 라서(overflow-y 도 auto 로 계산됨) 자체 스크롤 컨테이너가 되고,
     sticky 의 기준도 그 컨테이너가 된다. 여기에 top:60px(상단 고정 헤더 높이)을 주면 컨테이너 안에서
     헤더가 항상 60px 아래로 밀려 그 위에 빈 띠가 생기고, 첫 데이터 행의 글자가 헤더 뒤에서 삐져나와
     잔상처럼 겹쳐 보인다(실측: 헤더 +60px, 첫 행과 60px 겹침). top:0 이면 밀림·겹침 모두 0. */
  position: sticky; top: 0; z-index: 5; cursor: pointer; user-select: none;
}
table.grid thead th.no-sort { cursor: default; }
table.grid thead th .arrow { color: var(--blue-500); margin-left: 4px; font-size: 11px; }
table.grid tbody tr:hover { background: #f7fafd; }
table.grid tbody tr.is-exact { background: #eaf3ff; box-shadow: inset 3px 0 0 var(--blue-500); }
.mono { font-family: "Consolas", "Menlo", monospace; font-weight: 600; color: var(--navy-700); }
.cell-actions { display: flex; gap: 6px; flex-wrap: wrap; }

.empty-state { text-align: center; padding: 54px 20px; color: var(--muted); }
.empty-state .big { font-size: 16px; color: var(--ink-soft); margin-bottom: 6px; }

/* 검색 일치 표시 (요구사항 #6) */
.result-meta em { font-style: normal; background: #e7f0fd; color: var(--blue-600); border-radius: 5px; padding: 1px 6px; font-weight: 700; }
.match-badge {
  display: inline-block; font-size: 11px; font-weight: 700; border-radius: 5px;
  padding: 2px 7px; margin-right: 6px; white-space: nowrap; vertical-align: middle;
}
.match-badge.exact { background: var(--blue-600); color: #fff; }
.match-badge.partial { background: var(--blue-050); color: var(--blue-600); border: 1px solid #bcd6f5; }
.match-badge.other { background: #eef1f5; color: var(--ink-soft); border: 1px solid var(--line); }
table.grid td.is-matched { background: #fff6da; }
table.grid tbody tr:hover td.is-matched { background: #fdf0c4; }

/* ── 담당자 지정 출하 상태 (요구사항 1·3: 색상/배지 + 드롭다운) ──────
   출하일자와 무관하게 담당자가 직접 지정해 시트에 저장하는 관리 상태값. */
.shipstatus-badge {
  display: inline-block; font-size: 11px; font-weight: 700; line-height: 1.5;
  border-radius: 5px; padding: 1px 7px; white-space: nowrap; vertical-align: middle;
  border: 1px solid transparent;
}
.shipstatus-badge.blue { background: var(--blue-050); color: var(--blue-600); border-color: #bcd6f5; }
.shipstatus-badge.navy { background: var(--navy-700); color: #fff; border-color: var(--navy-700); }
.shipstatus-badge.green { background: var(--ok-bg); color: var(--ok); border-color: #bfe6d3; }
.shipstatus-badge.orange { background: var(--warn-bg); color: var(--warn); border-color: #f2d9ab; }
.shipstatus-badge.red { background: var(--err-bg); color: var(--err); border-color: #f4c7c0; }
.shipstatus-badge.teal { background: #e3f6f5; color: #0f766e; border-color: #a7dcd8; }
.shipstatus-badge.gray { background: #eef1f5; color: var(--ink-soft); border-color: var(--line); }

/* 드롭다운(목록·상세 공용) — 색상 톤이 선택값에 따라 바뀐다 */
.shipstatus-cell { display: inline-flex; align-items: center; gap: 6px; flex-wrap: nowrap; }
.shipstatus-select {
  font: inherit; font-size: 12.5px; font-weight: 600; cursor: pointer;
  border-radius: 6px; padding: 3px 6px; max-width: 128px;
  background: #fff; color: var(--ink); border: 1px solid var(--line);
  transition: background 0.12s ease, border-color 0.12s ease, color 0.12s ease;
}
.shipstatus-select:hover { border-color: var(--blue-400); }
.shipstatus-select:focus { outline: none; box-shadow: 0 0 0 3px rgba(36, 120, 224, 0.18); }
.shipstatus-select.teal { background: #e3f6f5; color: #0f766e; border-color: #a7dcd8; }
.shipstatus-select.gray { background: #f2f5f9; color: var(--ink-soft); border-color: var(--line); }
.shipstatus-select.blue { background: var(--blue-050); color: var(--blue-600); border-color: #bcd6f5; }
.shipstatus-select.navy { background: var(--navy-700); color: #fff; border-color: var(--navy-700); }
.shipstatus-select.green { background: var(--ok-bg); color: var(--ok); border-color: #bfe6d3; }
.shipstatus-select.orange { background: var(--warn-bg); color: var(--warn); border-color: #f2d9ab; }
.shipstatus-select.red { background: var(--err-bg); color: var(--err); border-color: #f4c7c0; }
.shipstatus-select.saving { opacity: 0.65; }

/* 목록의 출하 상태 열 — 드롭다운이 수정 화면으로 이동했으므로 배지 크기에 맞춘다.
   (기존 min-width:190px 는 드롭다운 폭 기준이라 배지만 남으면 공란이 생김) */
.shipstatus-td { white-space: nowrap; width: 1%; }
.shipstatus-inline { display: inline-flex; align-items: center; }

/* 인라인 저장 결과/오류 메시지 + 재시도 버튼 */
.shipstatus-msg { font-size: 11.5px; font-weight: 600; color: var(--ink-soft); }
.shipstatus-msg.ok { color: var(--ok); }
.shipstatus-msg.info { color: var(--muted); }
.shipstatus-msg.err { color: var(--err); white-space: normal; }
.shipstatus-retry { margin-left: 6px; vertical-align: middle; }

/* 폼/상세 보조 설명 텍스트 */
.field-note { font-size: 11.5px; color: var(--muted); }

/* 수정 화면 전용 출하 상태 필드 (요구사항 1·2: 드롭다운은 수정 화면에만 표시) */
#form-shipstatus-field .shipstatus-cell { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
#form-shipstatus-field .shipstatus-select { max-width: 220px; padding: 8px 10px; font-size: 13.5px; }
#form-shipstatus-field #form-shipstatus-msg { min-height: 0; }

/* ── 출하 상태 빠른 필터 바 (요구사항 #3·#4) ───────────────── */
.status-bar {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  margin-top: 16px; padding-top: 14px; border-top: 1px dashed var(--line);
}
.status-bar-row { display: flex; align-items: center; gap: 8px; justify-content: center; flex-wrap: wrap; }
.status-bar-label { font-size: 12.5px; font-weight: 700; color: var(--ink-soft); margin-right: 2px; }
.status-bar-sub { font-size: 11px; font-weight: 600; color: var(--muted); }
.status-chip {
  font: inherit; font-size: 12.5px; font-weight: 600; cursor: pointer;
  background: #fff; color: var(--ink-soft); border: 1px solid var(--line);
  border-radius: 999px; padding: 5px 13px; transition: background 0.12s ease, border-color 0.12s ease, color 0.12s ease;
}
.status-chip:hover { border-color: var(--blue-400); color: var(--blue-600); }
.status-chip.blue.active { background: var(--blue-050); border-color: var(--blue-500); color: var(--blue-600); }
.status-chip.orange.active { background: var(--warn-bg); border-color: var(--warn); color: var(--warn); }
.status-chip.red.active { background: var(--err-bg); border-color: var(--err); color: var(--err); }
.status-chip.green.active { background: var(--ok-bg); border-color: var(--ok); color: var(--ok); }
.status-chip.teal.active { background: #e3f6f5; border-color: #0f766e; color: #0f766e; }
.status-chip.gray.active { background: #eef1f5; border-color: var(--muted); color: var(--ink-soft); }
.status-chip.all.active, .status-chip.active { background: var(--navy-700); border-color: var(--navy-700); color: #fff; }
.status-chip.blue.active, .status-chip.orange.active, .status-chip.red.active,
.status-chip.green.active, .status-chip.gray.active, .status-chip.teal.active { color: inherit; }

/* ── 출하 상태 요약 (출하 건수 vs 제품 수량 구분 — 요구사항 #4) ── */
.summary-body { padding: 14px 18px 16px; }
.summary-head { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 12px; }
.summary-title { font-size: 14px; font-weight: 700; color: var(--navy-800); }
.summary-note { font-size: 12px; color: var(--ink-soft); background: #eef1f5; border-radius: 5px; padding: 1px 8px; }
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.stat-card {
  border: 1px solid var(--line-soft); border-radius: 9px; padding: 10px 12px; background: #fff;
  border-left: 4px solid var(--line);
}
.stat-card.blue { border-left-color: var(--blue-500); }
.stat-card.orange { border-left-color: #e08b1e; }
.stat-card.red { border-left-color: var(--err); }
.stat-card.green { border-left-color: var(--ok); }
.stat-card.gray { border-left-color: var(--muted); }
.stat-card.teal { border-left-color: #0f766e; }
.stat-card.navy { border-left-color: var(--navy-700); }
.stat-label { font-size: 12px; color: var(--ink-soft); font-weight: 600; margin-bottom: 4px; }
.stat-values { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.stat-ship { font-size: 13px; color: var(--navy-800); }
.stat-ship strong { font-size: 18px; }
.stat-qty { font-size: 11.5px; color: var(--muted); }
.stat-qty strong { color: var(--ink-soft); }
.summary-total { margin-top: 12px; font-size: 13px; color: var(--ink-soft); }
.summary-total strong { color: var(--blue-600); }

/* .stat-card 를 클릭 가능한 버튼으로 사용 (요구사항 3: 카드 클릭 → 해당 상태만 조회) */
button.stat-card {
  font: inherit; text-align: left; cursor: pointer; display: block; width: 100%;
  transition: box-shadow 0.12s ease, border-color 0.12s ease, transform 0.06s ease;
}
button.stat-card:hover { box-shadow: 0 1px 3px rgba(16, 42, 70, 0.12), 0 6px 16px rgba(16, 42, 70, 0.1); }
button.stat-card:active { transform: translateY(1px); }
button.stat-card:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(36, 120, 224, 0.22); }
button.stat-card.active { border-color: var(--blue-500); background: var(--blue-050); box-shadow: 0 0 0 2px rgba(36, 120, 224, 0.16); }

/* 작은 스피너(저장 중 표시) */
.spinner.sm { width: 12px; height: 12px; border-width: 2px; border-color: rgba(27, 100, 201, 0.25); border-top-color: var(--blue-500); }

/* ── 페이지네이션 ───────────────────────────────────────── */
.pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 18px; flex-wrap: wrap; }
.pager .pages { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.pager .pages button {
  min-width: 34px; height: 32px; border: 1px solid var(--line); background: #fff;
  border-radius: 7px; cursor: pointer; font: inherit; color: var(--ink);
}
.pager .pages button.active { background: var(--blue-600); border-color: var(--blue-600); color: #fff; font-weight: 700; }
.pager .pages button:disabled { opacity: 0.5; cursor: not-allowed; }
.pager .info { color: var(--ink-soft); font-size: 13px; }

/* ── 상세 모달 ──────────────────────────────────────────── */
.overlay {
  position: fixed; inset: 0; background: rgba(10, 32, 54, 0.5);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 40px 16px; z-index: 60; overflow-y: auto;
}
.modal {
  background: var(--bg); width: 100%; max-width: 900px; border-radius: 12px;
  box-shadow: 0 20px 60px rgba(10, 32, 54, 0.35); overflow: hidden;
}
.modal-head {
  background: var(--navy-800); color: #fff; padding: 16px 20px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.modal-head h2 { margin: 0; font-size: 17px; }
.modal-head .close { background: transparent; border: none; color: #cfe0f2; font-size: 22px; cursor: pointer; line-height: 1; }
.modal-body { padding: 20px; max-height: calc(100vh - 220px); overflow-y: auto; }
.modal-foot { padding: 14px 20px; background: #fff; border-top: 1px solid var(--line-soft); display: flex; justify-content: flex-end; gap: 10px; }

.info-card { background: #fff; border: 1px solid var(--line-soft); border-radius: 10px; margin-bottom: 14px; }
.info-card h3 {
  margin: 0; padding: 11px 16px; border-bottom: 1px solid var(--line-soft);
  font-size: 13.5px; color: var(--navy-700); background: var(--blue-050); border-radius: 10px 10px 0 0;
}
.info-card dl { display: grid; grid-template-columns: 150px 1fr; gap: 0; margin: 0; }
.info-card dt { padding: 10px 16px; color: var(--ink-soft); font-weight: 600; font-size: 13px; border-bottom: 1px solid var(--line-soft); background: #fbfcfe; }
.info-card dd { padding: 10px 16px; margin: 0; border-bottom: 1px solid var(--line-soft); word-break: break-all; }
.info-card .row:last-child dt, .info-card .row:last-child dd { border-bottom: none; }

/* ── 폼 ─────────────────────────────────────────────────── */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid .field.full { grid-column: 1 / -1; }
.form-hint { font-size: 12px; color: var(--muted); }
.dup-warn {
  margin: 12px 0 0; padding: 11px 14px; border-radius: 8px;
  background: var(--warn-bg); color: var(--warn); border: 1px solid #f2d9ab; font-size: 13px; font-weight: 600;
}

/* ── 알림 ───────────────────────────────────────────────── */
.toast-host { position: fixed; top: 74px; right: 24px; z-index: 90; display: flex; flex-direction: column; gap: 10px; }
.toast {
  min-width: 280px; max-width: 420px; padding: 13px 16px; border-radius: 9px;
  background: #fff; box-shadow: 0 10px 30px rgba(10, 32, 54, 0.2); border-left: 4px solid var(--blue-500);
  font-size: 13.5px;
}
.toast.ok { border-left-color: var(--ok); background: var(--ok-bg); color: #14532d; }
.toast.warn { border-left-color: var(--warn); background: var(--warn-bg); color: #6b3f06; }
.toast.err { border-left-color: var(--err); background: var(--err-bg); color: #7a1f16; }

.banner { padding: 12px 16px; border-radius: 9px; margin-bottom: 16px; font-size: 13.5px; }
.banner.err { background: var(--err-bg); color: #7a1f16; border: 1px solid #f4c7c0; }
.banner.warn { background: var(--warn-bg); color: #6b3f06; border: 1px solid #f2d9ab; }
.banner.info { background: var(--blue-050); color: var(--navy-700); border: 1px solid #cfe0f2; }

.spinner { display: inline-block; width: 15px; height: 15px; border: 2px solid rgba(255,255,255,0.5); border-top-color: #fff; border-radius: 50%; animation: spin 0.7s linear infinite; vertical-align: -2px; }
.loading-row { text-align: center; color: var(--muted); padding: 40px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── 푸터 ───────────────────────────────────────────────── */
.site-footer { padding: 26px 24px 40px; color: var(--muted); font-size: 12.5px; text-align: center; }

/* ── 반응형 (태블릿) ────────────────────────────────────── */
@media (max-width: 1024px) {
  .filters { grid-template-columns: repeat(2, 1fr); }
  /* 2열에서는 날짜 범위가 한 줄 전체를 쓰도록 해 빈 칸을 없앤다 */
  .filters .field-wide { grid-column: 1 / -1; }
}
@media (max-width: 720px) {
  .wrap { padding: 0 14px; }
  .header-inner { height: auto; padding: 10px 0; flex-wrap: wrap; }
  .hero h1 { font-size: 21px; }
  .search-bar { flex-direction: column; }
  .search-bar .btn { padding: 13px; }
  .filters { grid-template-columns: 1fr; }
  .filters .field-wide { grid-column: auto; }
  .form-grid { grid-template-columns: 1fr; }
  .info-card dl { grid-template-columns: 110px 1fr; }
  table.grid thead th { position: static; }
  .conn-status { display: none; }
}

@media (max-width: 900px) {
  table.grid { table-layout: auto; font-size: 13px; }
  table.grid th, table.grid td { white-space: nowrap; overflow-wrap: normal; padding: 10px 12px; }
  table.grid th:nth-child(n), table.grid td:nth-child(n) { width: auto; }
}

/* ── 발주 건 보기 (조회 단위 토글 + 발주 건 표) ─────────────────
   기존 table.grid(13열 폭)와 분리된 7열 표. 가로 스크롤·셀 잘림 없이 한 화면에 맞춘다. */
.view-toggle { gap: 6px; }
table.grid-orders { width: 100%; border-collapse: collapse; font-size: 12.5px; table-layout: fixed; }
table.grid-orders th, table.grid-orders td {
  padding: 7px 8px; border-bottom: 1px solid var(--line-soft); text-align: left;
  white-space: normal; overflow-wrap: anywhere; line-height: 1.4; vertical-align: top;
}
table.grid-orders thead th {
  background: var(--blue-050); color: var(--navy-700); font-weight: 700;
  position: sticky; top: 0; z-index: 5; cursor: pointer; user-select: none;
}
table.grid-orders thead th.no-sort { cursor: default; }
table.grid-orders thead th .arrow { color: var(--blue-500); margin-left: 4px; font-size: 11px; }
table.grid-orders th:nth-child(1) { width: 11%; }
table.grid-orders th:nth-child(2) { width: 10%; }
table.grid-orders th:nth-child(3) { width: 17%; }
table.grid-orders th:nth-child(4) { width: 11%; }
table.grid-orders th:nth-child(5) { width: 22%; }
table.grid-orders th:nth-child(6) { width: 13%; }
table.grid-orders th:nth-child(7) { width: 16%; }
table.grid-orders tr.order-row { cursor: pointer; }
table.grid-orders tr.order-row:hover { background: #f7fafd; }
table.grid-orders tr.order-row.is-open { background: #f0f6fd; }
table.grid-orders tr.order-row.is-exact { background: #eaf3ff; box-shadow: inset 3px 0 0 var(--blue-500); }
.order-sub { color: var(--muted); font-size: 12px; font-weight: 400; font-family: inherit; }
table.grid-orders tr.order-detail-row > td { background: #fafcff; padding: 8px 12px 12px; }
table.order-items { width: 100%; border-collapse: collapse; font-size: 12.5px; table-layout: fixed; }
table.order-items th, table.order-items td {
  padding: 5px 8px; border-bottom: 1px solid var(--line-soft); text-align: left;
  white-space: normal; overflow-wrap: anywhere; line-height: 1.4;
}
table.order-items th { color: var(--navy-700); font-weight: 700; background: transparent; }
table.order-items tr.is-hit td { background: #fff6da; }
table.order-items tr.is-hit td:first-child { box-shadow: inset 3px 0 0 var(--blue-500); }

/* ── 발주 건 상세: 수량 관리 (기존 변수·클래스 재사용, 신규 클래스 최소) ───────── */
.order-detail-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin: 0 0 8px; }
.order-total { font-weight: 700; color: var(--navy-700); font-size: 13px; }
.order-actions { margin-left: auto; display: inline-flex; flex-wrap: wrap; gap: 6px; }
input.order-inline {
  width: 100%; min-width: 0; box-sizing: border-box; padding: 4px 6px; font-size: 12.5px;
  border: 1px solid var(--line); border-radius: 6px; background: #fff; color: var(--ink);
}
input.order-inline:focus { outline: none; border-color: var(--blue-500); }
input.order-inline:disabled { background: var(--bg); color: var(--muted); }
/* 발주 건 일괄 변경 영역(출하 상태·출하일자·제조번호) — 기존 상세 헤더와 같은 변수·버튼·select 클래스 재사용 */
.order-bulk { margin: 0 0 8px; padding: 8px 10px; background: #fff; border: 1px solid var(--line-soft); border-radius: 8px; }
.order-bulk-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.order-bulk-body { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 22px; margin-top: 8px; }
.order-bulk-body[hidden] { display: none; }
.order-bulk-item { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; }
.order-bulk-item label { font-size: 12px; font-weight: 600; color: var(--ink-soft); }
.order-bulk-item input[type="date"] { font: inherit; font-size: 12.5px; padding: 3px 6px; border: 1px solid var(--line); border-radius: 6px; background: #fff; }
.order-bulk-msg { font-size: 12.5px; font-weight: 700; color: var(--ok); }
.serial-preview { margin-top: 14px; padding: 10px 12px; border: 1px solid var(--line-soft); border-radius: 8px; background: #fff; font-size: 13px; }
.serial-preview-list { margin-top: 6px; max-height: 140px; overflow-y: auto; line-height: 1.7; overflow-wrap: anywhere; }
table.order-items th:nth-child(1) { width: 19%; }
table.order-items th:nth-child(2) { width: 22%; }
table.order-items th:nth-child(3) { width: 17%; }
table.order-items th:nth-child(4) { width: 9%; }
table.order-items th:nth-child(5) { width: 12%; }
table.order-items th:nth-child(6) { width: 11%; }
table.order-items th:nth-child(7) { width: 10%; }
