/* 화면 틀 보완 — css/style.css(화면 설계 원본) 위에 얹는 규칙 */

/* ---- 화면 배율 ----
   앱 전체를 80% 로 줄여 그린다. 화면은 너비 1600px 안팎을 기준으로 설계했고,
   1920×1200 을 150% 로 쓰는 PC 의 브라우저 너비가 1280px 이라 0.8 이면 설계 너비와 같아진다.
   배율 안에서는 vh·vw 도 같이 줄어들므로, 창 크기에 맞춰야 하는 값은 배율로 나눠 되돌린다. */
:root {
  --zoom: 0.8;
}
body {
  zoom: var(--zoom);
}
.grid-wrap {
  max-height: calc(100vh / var(--zoom) - 312px);
}
.tbl-wrap {
  max-height: calc(70vh / var(--zoom));
}
.kufri-wrap {
  max-height: calc(72vh / var(--zoom));
}
.drawer {
  width: min(760px, calc(96vw / var(--zoom)));
}
.modal {
  width: min(860px, calc(96vw / var(--zoom)));
  max-height: calc(90vh / var(--zoom));
}

/* 로그인 전·준비 중 안내 */
.notice-card {
  max-width: 560px;
  margin: 60px auto;
  text-align: center;
}
.notice-card p {
  margin: 8px 0 14px;
  color: var(--muted);
}
.userbox[hidden] {
  display: none;
}
.topbar .userbox button {
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 6px;
  background: transparent;
  color: #fff;
  padding: 3px 9px;
  font-size: 12px;
}
.topbar .userbox button:hover {
  background: rgba(255, 255, 255, 0.12);
}
.error {
  color: var(--danger);
}

/* ---- Logistics 차량 마스터 ---- */
.lg-search {
  width: 520px;
  max-width: calc(60vw / var(--zoom));
}
/* 그리드 화면은 양쪽 여백 없이 창 너비를 다 쓴다 */
.page:has(.lg-screen) {
  max-width: none;
}
/* 열 너비 고정: 페이지·검색·필터가 바뀌어도 열이 움직이지 않는다 */
.grid.fixed {
  table-layout: fixed;
}
.grid.fixed td {
  overflow: hidden;
  text-overflow: ellipsis;
}
/* 너비를 재는 데만 쓰는 보이지 않는 표 */
.grid.measure {
  position: absolute;
  visibility: hidden;
  min-width: 0;
}
/* 머리글 한 줄: 출처 색 점 · 열 이름(길면 두 줄) · 정렬 버튼 · 필터 버튼.
   정렬은 버튼으로만 되므로 머리글 칸에는 손 모양을 쓰지 않는다 */
.grid thead tr.fld th {
  cursor: default;
  height: 38px;
  padding-top: 3px;
  padding-bottom: 3px;
}
.grid th .th-in {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}
/* 차량 그리드의 머리글은 두 줄: 첫 줄 = 출처 색 점 · 열 이름(길면 두 줄), 둘째 줄 = 정렬 버튼 · 필터 버튼.
   버튼을 아래로 내려 열 너비가 이름과 값에만 맞춰지게 한다 */
.grid.fixed thead tr.fld th,
.grid.measure thead tr.fld th {
  height: 54px;
  padding-left: 5px;
  padding-right: 5px;
}
.grid th .th-in.stack {
  flex-direction: column;
  gap: 1px;
}
/* 이름이 한 줄인 열도 두 줄 높이를 잡아 버튼 줄의 높이를 맞춘다 */
.grid th .th-top {
  display: flex;
  min-height: 29px;
  align-items: center;
  justify-content: center;
  gap: 4px;
}
.grid th .th-btns {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
}
.grid th .th-name {
  line-height: 1.25;
  text-align: center;
}
.grid th .th-name span {
  display: block;
}
.grid th .th-in .cf {
  margin-left: 0;
}
/* 필터 버튼의 깔때기 그림. 색은 버튼의 글자색을 따른다(필터가 걸리면 흰색) */
.grid th .cf .cf-ic {
  display: block;
  width: 9px;
  height: 11px;
}
.grid th .sortbtn {
  flex: none;
  width: 16px;
  padding: 1px 0;
  border: 1px solid transparent;
  border-radius: 4px;
  background: transparent;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.4;
  cursor: pointer;
}
.grid th .sortbtn:hover {
  border-color: var(--line-strong);
  background: #fff;
}
.grid th .sortbtn.on {
  color: var(--accent);
  font-size: 9px;
}
/* 출처 색 점(머리글과 범례) */
.src-dot {
  display: inline-block;
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: 50%;
}
.src-dot.afab {
  background: #2a78d6;
}
.src-dot.auto {
  background: #9aa6b5;
}
.src-dot.input {
  background: #2a9d4a;
}
.src-legend {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-left: 10px;
}
.src-legend .src-dot {
  margin-left: 6px;
}
/* Changeability Date 의 D-day 배지: 칸 오른쪽 끝의 신호등 점 바로 왼쪽에 둔다 */
.grid td.dotcell .pill.dday {
  float: right;
  margin: -2px -2px -2px 6px; /* 위아래: 배지가 줄 높이를 넘지 않게(날짜가 위로 밀리지 않게) */
}
/* 차량 상세: 긴 글은 줄바꿈을 살려 여러 줄로 */
.fields .f .v.long-text {
  white-space: pre-wrap;
  line-height: 1.45;
  padding: 4px 0;
}
/* 마스터 · 설정의 검색창 */
.st-search {
  width: 260px;
}
.empty-msg {
  padding: 30px;
  text-align: center;
}

/* ---- 관리 화면(폴더 목록 · 전처리 · List 점검). 다른 화면과 섞이지 않게 .admin 아래로 한정 ---- */
.admin button {
  padding: 6px 14px;
}
.admin #scopes {
  color: var(--muted);
  font-size: 12px;
  word-break: break-all;
}
.admin table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 12px;
}
.admin th,
.admin td {
  text-align: left;
  padding: 6px 8px;
  border-bottom: 1px solid var(--line);
}
.admin #preview,
.admin #result,
.admin #lists {
  margin-top: 28px;
}
.admin #preview h2,
.admin #result h2,
.admin #lists h2 {
  font-size: 17px;
}
.admin #preview h3,
.admin #result h3 {
  font-size: 15px;
  margin: 24px 0 4px;
}
.admin #preview h4,
.admin #result h4,
.admin #lists h4 {
  font-size: 13px;
  margin: 14px 0 6px;
  color: var(--muted);
}
.admin .hint {
  color: var(--muted);
  font-size: 12px;
  margin: 4px 0 8px;
}
.admin .summary {
  display: block;
  width: 100%;
  margin-bottom: 8px;
  font-family: var(--mono);
  font-size: 12px;
}
.admin .grid-wrap {
  overflow: auto;
  max-height: 420px;
  border: 1px solid var(--line);
}
.admin table.grid {
  width: auto;
  margin-top: 0;
  font-size: 12px;
}
.admin table.grid th,
.admin table.grid td {
  padding: 3px 8px;
  border: 1px solid var(--line);
  white-space: nowrap;
}
.admin table.grid th {
  position: sticky;
  top: 0;
  background: var(--soft);
  color: var(--muted);
  font-weight: 600;
  text-align: center;
}
.admin table.grid th.rownum {
  left: 0;
  top: auto;
}
.admin table.grid th.corner {
  left: 0;
  z-index: 1;
}
.admin .actions {
  display: inline-flex;
  gap: 6px;
}
.admin #tools {
  margin: 12px 0 0;
}

/* ---- 차량 상세 드로어: 저장 버튼 줄 ---- */
.drawer-actions {
  margin-top: 8px;
}

/* ---- 변경 이력·충돌 표: 긴 글은 줄바꿈을 살린다 ---- */
.tbl td.long-text {
  white-space: pre-wrap;
  word-break: break-word;
}

/* ---- Logistics 편집 모드: 셀 안 입력칸 ----
   원래 내용(.cell-hold)을 보이지 않게 남겨 칸 크기를 잡아 두고, 입력칸(.cell-edit)을 그 위에 겹친다.
   입력을 시작해도 줄 높이와 열 너비가 변하지 않는다. */
.grid.fixed td.editing {
  position: relative;
}
.grid.fixed td.editing .cell-hold {
  visibility: hidden;
}
.grid.fixed td .cell-edit {
  position: absolute;
  left: 2px;
  right: 2px;
  top: 1px;
  bottom: 1px;
  display: flex;
  gap: 2px;
}
.grid.fixed td .cell-edit .cell-in {
  flex: 1;
  min-width: 0;
  width: auto;
  height: 100%;
  padding: 0 4px;
  box-sizing: border-box;
}
.grid td .cell-clear {
  flex: none;
  padding: 0 5px;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  background: #fff;
  color: var(--muted);
  cursor: pointer;
}
/* 차량 상세: 날짜·월 입력칸 옆의 지우기 버튼 */
.fields .f .clearable {
  display: flex;
  gap: 4px;
}
.fields .f .clearable input {
  flex: 1;
  min-width: 0;
}

/* ---- Logistics 일괄 입력 창 ---- */
.bulk-form input:not([type="checkbox"]),
.bulk-form select,
.bulk-form textarea {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  padding: 3px 6px;
  font: inherit;
}
.bulk-form td:first-child {
  white-space: nowrap;
}
/* 현재 값과 넣을 값을 나란히 */
.bulk-form td.current {
  width: 38%;
}
.bulk-option {
  display: block;
  margin-top: 10px;
}
.bulk-preview {
  margin-bottom: 12px;
}
.bulk-preview td:first-child,
.bulk-preview td.num {
  white-space: nowrap;
}
/* Note 열의 넣는 방식 선택, 이어 쓰기 예시 */
.bulk-form select.bulk-mode {
  width: auto;
  margin-bottom: 4px;
}
.bulk-sample {
  margin: -4px 0 12px;
  padding: 6px 10px;
  border: 1px dashed var(--line-strong);
  border-radius: 6px;
}
.bulk-sample .long-text {
  white-space: pre-wrap;
  word-break: break-word;
}

/* ---- 오더 생성·변경 창 ---- */
.order-attrs {
  grid-template-columns: 140px 1fr;
}
.order-comm {
  display: flex;
  gap: 14px;
  align-items: center;
  flex-wrap: wrap;
}
.fields .f .order-comm input[type="radio"] {
  width: auto;
}
.fields .f .order-comm input.order-start {
  width: 160px;
}

/* ---- 선적·입항 선박별 현황 편집 ---- */
.pill.gap {
  margin-right: 4px;
}
.tbl td.tscst .pill {
  margin-left: 6px;
}
.pill-btn {
  border: 0;
  font: inherit;
  cursor: pointer;
}
.tsc-in.pend {
  background: #fff8e1;
  box-shadow: inset 3px 0 0 var(--warn);
}
.tsc-in.gw-in {
  width: 110px;
}
.notice-ta.pend {
  background: #fff8e1;
}
/* 마스터 편집 */
.mst-in {
  width: 100%;
  min-width: 56px;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  padding: 2px 5px;
  background: #fff;
  font: inherit;
}
.mst-in.num {
  text-align: right;
  min-width: 48px;
}
.mst-in.pend {
  background: #fff8e1;
}
input[type="checkbox"].pend {
  outline: 2px solid var(--warn);
}

/* ---- 통관 완료 처리 ----
   미리보기 표: 왼쪽 묶음은 올린 파일의 값, 오른쪽 묶음(.cu-apply, 파란 음영)은 반영한 뒤의 차량 값 */
.cu-tbl th.cu-group {
  text-align: center;
  font-weight: 700;
  color: var(--text);
  border-bottom: 1px solid var(--line);
}
/* 머리글이 두 줄이라, 둘째 줄은 첫 줄 높이만큼 내려서 붙인다(표를 내려도 두 줄이 다 보이게) */
.cu-tbl thead tr:first-child th.cu-group {
  height: 28px;
  box-sizing: border-box;
  padding-top: 0;
  padding-bottom: 0;
}
.cu-tbl thead tr.cu-names th {
  top: 28px;
}
.cu-tbl th.cu-pick,
.cu-tbl td.cu-pick {
  width: 28px;
  text-align: center;
}
/* 오른쪽 묶음이 시작되는 곳의 세로 경계 */
.cu-tbl thead tr:first-child th.cu-apply,
.cu-tbl thead tr.cu-names th.cu-apply:nth-child(5),
.cu-tbl tbody td.cu-apply:nth-child(6) {
  border-left: 2px solid var(--line-strong);
}
/* 반영하면 바뀌는 칸: 채우는 값은 초록, 덮어쓰는 값은 빨강 */
.cu-tbl td.cu-set {
  background: var(--ok-soft);
  color: var(--ok);
  font-weight: 700;
}
.cu-tbl td.cu-set.over {
  background: var(--danger-soft);
  color: var(--danger);
}
.cu-tbl .cu-was {
  color: var(--muted);
  font-weight: 400;
  font-size: 11px;
}
/* 주의할 행(왼쪽 묶음만 노랑), 체크를 푼 행(흐리게) */
.cu-tbl tr.cu-review td:not(.cu-apply) {
  background: var(--warn-soft);
}
.cu-tbl tr.cu-off td {
  color: var(--muted);
}
.cu-tbl tr.cu-off td:not(.cu-pick) {
  opacity: 0.55;
}
.cu-actions {
  margin-top: 10px;
}

/* ---- AFAB 업로드 ----
   미리보기 표: 차량 1대 = 1행(파일의 행 순서). 바뀌는 열마다 1칸(차량 그리드의 열 순서) */
.af-tbl th.af-pick,
.af-tbl td.af-pick {
  width: 28px;
  text-align: center;
}
.af-tbl th,
.af-tbl td {
  white-space: nowrap;
  vertical-align: top;
}
/* 바뀌지 않는 칸은 지금 값을 흐리게 */
.af-tbl td.af-val {
  color: var(--muted);
}
/* 반영하면 바뀌는 칸: 새 값은 초록, 값을 비우는 칸은 빨강. 기존 값은 아래에 작게 */
.af-tbl td.af-set {
  background: var(--ok-soft);
  color: var(--ok);
  font-weight: 700;
}
.af-tbl td.af-set.clear {
  background: var(--danger-soft);
  color: var(--danger);
}
.af-tbl .af-was {
  display: block;
  color: var(--muted);
  font-weight: 400;
  font-size: 11px;
}
/* AFAB 값에서 계산해 같이 맞추는 열 */
.af-tbl th .af-auto {
  margin-left: 4px;
  font-size: 11px;
  font-weight: 400;
  color: var(--muted);
}
/* 주의할 행(값 칸 밖을 노랑으로), 체크를 푼 행(흐리게) */
.af-tbl tr.af-review td:not(.af-val) {
  background: var(--warn-soft);
}
.af-tbl tr.af-off td:not(.af-pick) {
  opacity: 0.55;
}
.af-errors {
  margin: 4px 0 0;
  padding-left: 18px;
}
/* 열별 변경 대수: 열 이름 + 대수를 한 줄에 늘어놓는다(넘치면 줄바꿈) */
.af-colcounts {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 14px;
  margin: 8px 0;
  font-size: 12.5px;
}
.af-colcounts > span {
  white-space: nowrap;
}
/* 파일에 없는 차량 */
.af-absent {
  margin-top: 16px;
}
.af-absent summary {
  cursor: pointer;
  font-weight: 600;
}
.af-absent .af-counts {
  margin: 8px 0;
  line-height: 2;
}
.af-absent .tbl-wrap {
  max-height: 320px;
}

/* ---- 모델 마스터 그리드 ----
   차량 그리드의 모양(.grid)을 쓰되 열 너비는 내용에 맞춘다(잘리지 않게). 넘치면 가로 스크롤.
   편집 모드에서는 누른 칸만 입력칸으로 바뀐다(위의 .cell-hold / .cell-edit 와 같은 방식). */
.grid.mst tbody tr {
  cursor: default;
}
.grid.mst td.keyin {
  min-width: 56px;
}
.grid.mst td.editing {
  position: relative;
}
.grid.mst td.editing .cell-hold {
  visibility: hidden;
}
.grid.mst td .cell-edit {
  position: absolute;
  left: 2px;
  right: 2px;
  top: 1px;
  bottom: 1px;
  display: flex;
}
.grid.mst td .cell-edit .cell-in {
  flex: 1;
  min-width: 0;
  width: auto;
  height: 100%;
  padding: 0 4px;
  box-sizing: border-box;
}

/* ---- Current Status 업데이트 창 ----
   전환마다 표 하나. 표가 길면 표 안에서 세로 스크롤한다 */
.su-group .tbl-wrap {
  max-height: 240px;
}
.su-tbl th.su-pick,
.su-tbl td.su-pick {
  width: 28px;
  text-align: center;
}
.su-tbl tr.su-off td:not(.su-pick) {
  opacity: 0.55;
}
.su-info {
  margin-right: auto;
  align-self: center;
}
