/* DCF 운영 콘솔 — 밀도 높은 백오피스 스타일 */
:root {
  --bg: #f4f6f9; --panel: #fff; --line: #e1e5eb; --line2: #eef1f5; --text: #1d2430; --muted: #6b7686;
  --brand: #2456c7; --brand-d: #1b419b; --brand-l: #e8effc; --danger: #c62f2f; --warn: #b7791f; --ok: #237a4b;
  --side: #17202e; --side-t: #b8c2d1; --side-a: #2a3850;
  --r: 6px; --fs: 13px; --sh: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
  --font: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Pretendard", "Malgun Gothic", "Noto Sans KR", "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { font-family: var(--font); font-size: var(--fs); color: var(--text); background: var(--bg); line-height: 1.45; -webkit-font-smoothing: antialiased; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 19px; margin: 0; font-weight: 650; }
h2 { font-size: 16px; margin: 0 0 8px; font-weight: 650; }
h3 { font-size: 14px; margin: 12px 0 6px; font-weight: 650; }
p { margin: 6px 0; }
.muted { color: var(--muted); }
.small { font-size: 11.5px; }
.center { text-align: center; }
.pre { white-space: pre-wrap; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; }
.row { display: flex; align-items: center; flex-wrap: wrap; }
.gap { gap: 8px; }
.grow { flex: 1; }
.right { margin-left: auto; }
.nowrap { white-space: nowrap; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.warn-text { color: var(--warn); font-weight: 600; }
.danger-text { color: var(--danger); font-weight: 600; }
.ok-text { color: var(--ok); font-weight: 600; }

/* ── 레이아웃 ── */
.shell { display: flex; min-height: 100vh; }
.sidebar { width: 212px; flex: 0 0 212px; background: var(--side); color: var(--side-t); position: sticky; top: 0; height: 100vh; overflow-y: auto; overflow-x: hidden; display: flex; flex-direction: column; transition: width .16s ease, flex-basis .16s ease; }
.brand { display: flex; align-items: center; gap: 10px; padding: 14px 16px; color: #fff; font-weight: 650; font-size: 14px; border-bottom: 1px solid #243045; }
.brand:hover { text-decoration: none; }
.logo { display: inline-flex; align-items: center; justify-content: center; background: var(--brand); color: #fff; font-weight: 800; font-size: 11px; letter-spacing: .5px; border-radius: 5px; width: 34px; height: 26px; }
.nav { padding: 6px 0 24px; }
.nav-group { padding: 4px 0; }
.nav-gt { font-size: 11px; color: #7d8aa0; padding: 8px 18px 3px; letter-spacing: .3px; }
.nav-i { display: flex; align-items: center; gap: 9px; padding: 6px 18px; color: var(--side-t); font-size: 13px; border-left: 3px solid transparent; }
.nav-i:hover { background: #1f2a3c; color: #fff; text-decoration: none; }
.nav-i.active { background: var(--side-a); color: #fff; border-left-color: #6d9bff; }
.nav-ic { width: 16px; text-align: center; opacity: .8; font-size: 12px; }
.content { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px; background: var(--panel); border-bottom: 1px solid var(--line); padding: 8px 18px; min-height: 48px; }
.top-title { font-weight: 600; }
.top-user { margin-left: auto; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.top-org { font-weight: 600; color: var(--muted); }
.top-name { font-weight: 600; max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.roles { display: flex; gap: 4px; flex-wrap: wrap; }
.role { font-size: 11px; padding: 1px 7px; border-radius: 10px; background: #eef1f5; color: #3b4659; border: 1px solid var(--line); }
.role.r-admin { background: #fde8e8; color: #9b1c1c; border-color: #f8caca; }
.role.r-operations { background: #e8effc; color: #1b419b; border-color: #c9d9f8; }
.role.r-finance { background: #e6f6ee; color: #1c6b40; border-color: #c2e8d3; }
.role.r-warehouse { background: #fdf3e2; color: #8a5a10; border-color: #f4dcb0; }
.role.r-wh { background: #f2ecfb; color: #5b3a96; border-color: #ddd0f3; }
.nav-toggle { display: inline-block; background: none; border: 1px solid var(--line); border-radius: var(--r); padding: 4px 9px; font-size: 16px; line-height: 1; cursor: pointer; color: var(--text, inherit); }
.nav-toggle:hover { background: #eef1f5; }
.nav { flex: 1; }
.nav-lb { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-collapse { display: flex; align-items: center; gap: 9px; width: 100%; padding: 10px 18px; background: none; border: 0; border-top: 1px solid #243045;
  color: #9aa6b8; font-size: 12px; cursor: pointer; text-align: left; position: sticky; bottom: 0; background-color: var(--side); }
.nav-collapse:hover { color: #fff; background-color: #1f2a3c; }

/* 접힌 사이드 메뉴 (넓은 화면): 아이콘 막대 */
@media (min-width: 901px) {
  body.nav-collapsed .sidebar { width: 56px; flex-basis: 56px; }
  body.nav-collapsed .sidebar .nav-lb, body.nav-collapsed .sidebar .nav-gt { display: none; }
  body.nav-collapsed .sidebar .brand { justify-content: center; padding: 14px 0; }
  body.nav-collapsed .sidebar .nav-i { justify-content: center; padding: 9px 0; gap: 0; }
  body.nav-collapsed .sidebar .nav-ic { width: auto; font-size: 15px; opacity: .9; }
  body.nav-collapsed .sidebar .nav-group + .nav-group { border-top: 1px solid #243045; }
  body.nav-collapsed .sidebar .nav-collapse { justify-content: center; padding: 10px 0; gap: 0; }
  body.nav-collapsed .main { max-width: none; }
}
@media (prefers-reduced-motion: reduce) { .sidebar { transition: none; } }
.nav-scrim { display: none; }
.main { padding: 16px 20px 48px; max-width: 1600px; width: 100%; }

/* ── 페이지 헤더 ── */
.page-h { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.page-h-l { display: flex; flex-direction: column; gap: 2px; }
.page-sub { color: var(--muted); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.page-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.back { font-size: 12px; color: var(--muted); }

/* ── 카드 ── */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--sh); margin-bottom: 14px; }
.card-h { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 9px 14px; border-bottom: 1px solid var(--line2); font-weight: 650; }
.card-actions { display: flex; gap: 6px; flex-wrap: wrap; font-weight: normal; }
.card-b { padding: 12px 14px; }
.card-b > .table-wrap { margin: -12px -14px; border: 0; border-radius: 0 0 8px 8px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }

/* ── 대시보드 타일 ── */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; margin-bottom: 16px; }
.tile { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; box-shadow: var(--sh); color: var(--text); display: block; }
.tile:hover { border-color: #b9c8e6; text-decoration: none; }
.tile-l { color: var(--muted); font-size: 12px; }
.tile-v { font-size: 24px; font-weight: 700; font-variant-numeric: tabular-nums; margin-top: 2px; }
.tile.t-warn .tile-v { color: var(--warn); }
.tile.t-danger .tile-v { color: var(--danger); }
.quick { display: flex; flex-wrap: wrap; gap: 8px; }

/* ── 정의 목록 ── */
.kv { display: grid; gap: 8px 18px; margin: 0; }
.kv.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.kv.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.kv.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.kv-i dt { color: var(--muted); font-size: 11.5px; }
.kv-i dd { margin: 1px 0 0; word-break: break-word; }

/* ── 테이블 ── */
.table-wrap { overflow-x: auto; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; }
.tbl { width: 100%; border-collapse: collapse; }
.tbl th { background: #f7f9fb; text-align: left; font-weight: 600; color: #4a5568; font-size: 12px; padding: 7px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; position: sticky; top: 0; }
.tbl td { padding: 6px 10px; border-bottom: 1px solid var(--line2); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tr.clickable { cursor: pointer; }
.tbl tr.clickable:hover td { background: #f5f8fe; }
.tbl tr.row-muted td { color: var(--muted); }
.tbl tr.row-warn td { background: #fffaf0; }
.tbl tfoot td { font-weight: 650; background: #f7f9fb; border-top: 1px solid var(--line); }
.tbl input, .tbl select { padding: 3px 6px; font-size: 12.5px; }
.tbl input.qty { width: 80px; }
.tbl input.money { width: 110px; }
.empty-cell { text-align: center; color: var(--muted); padding: 22px !important; }
.more { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 2px; }

/* ── 배지 ── */
.badge { display: inline-block; font-size: 11.5px; font-weight: 600; padding: 1px 8px; border-radius: 10px; white-space: nowrap; border: 1px solid transparent; }
.b-gray { background: #eef0f3; color: #4b5563; border-color: #dfe3e8; }
.b-blue { background: #e6eefc; color: #1e48a8; border-color: #c8d8f7; }
.b-teal { background: #e0f4f2; color: #136a62; border-color: #bfe6e1; }
.b-indigo { background: #eceafd; color: #4338a8; border-color: #d6d1f8; }
.b-green { background: #e3f5ea; color: #1d6b3d; border-color: #bfe5cd; }
.b-amber { background: #fdf2dc; color: #8f5b09; border-color: #f4dcab; }
.b-red { background: #fde7e7; color: #a11d1d; border-color: #f6c9c9; }
.b-purple { background: #f3e9fb; color: #6b2fa0; border-color: #e3cff4; }
.b-dark { background: #333d4c; color: #fff; }

/* ── 버튼 ── */
.btn { display: inline-flex; align-items: center; gap: 5px; font: inherit; font-weight: 550; padding: 6px 12px; border-radius: var(--r); border: 1px solid #cfd6e0; background: #fff; color: var(--text); cursor: pointer; white-space: nowrap; line-height: 1.3; }
.btn:hover:not(:disabled) { background: #f4f6f9; border-color: #b8c2d0; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--brand-d); border-color: var(--brand-d); }
.btn-danger { background: #fff; border-color: #e7b4b4; color: var(--danger); }
.btn-danger:hover:not(:disabled) { background: #fdf0f0; border-color: var(--danger); }
.btn-ghost { border-color: transparent; background: transparent; color: var(--brand); }
.btn-sm { padding: 3px 8px; font-size: 12px; }
.btn-block { width: 100%; justify-content: center; padding: 9px; }
.btn.busy { position: relative; color: transparent !important; }
.btn.busy::after { content: ""; position: absolute; left: 50%; top: 50%; width: 12px; height: 12px; margin: -6px; border: 2px solid #aab4c3; border-top-color: var(--brand); border-radius: 50%; animation: spin .7s linear infinite; }

/* ── 폼 ── */
input, select, textarea { font: inherit; color: var(--text); border: 1px solid #cfd6e0; border-radius: var(--r); padding: 6px 8px; background: #fff; width: 100%; min-width: 0; }
input:focus, select:focus, textarea:focus { outline: 2px solid #b9cdf6; border-color: var(--brand); }
input[type=checkbox] { width: auto; }
textarea { resize: vertical; }
.form-grid { display: grid; gap: 10px 14px; }
.form-grid.cols-1 { grid-template-columns: 1fr; }
.form-grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.field { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.field.full { grid-column: 1 / -1; }
.field > label { font-size: 12px; color: #4a5568; font-weight: 550; }
.field-check { justify-content: flex-end; }
.field-check label { display: flex; align-items: center; gap: 6px; font-size: 13px; }
.req { color: var(--danger); }
.hint { font-size: 11.5px; color: var(--muted); }
.static { padding: 6px 0; }
.chk-group { display: flex; flex-wrap: wrap; gap: 6px 14px; padding: 4px 0; }
.chk { display: inline-flex; align-items: center; gap: 4px; }
.lookup { display: flex; gap: 6px; }
.lookup-q { flex: 0 0 38%; }
.filter-bar { display: flex; flex-wrap: wrap; gap: 8px 10px; align-items: flex-end; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; margin-bottom: 10px; }
.filter-bar .field { width: 180px; }
.filter-bar .field .lookup { min-width: 260px; }
.filter-bar .field:has(.lookup) { width: auto; }
.filter-bar .field-check { width: auto; }
.filter-btns { width: auto !important; }
.intro { margin-bottom: 10px; color: var(--muted); }
.subform { border: 1px dashed #cfd6e0; border-radius: 8px; padding: 10px; background: #fafbfc; }

/* ── 알림 ── */
.alert { border-radius: var(--r); padding: 9px 12px; margin: 8px 0; border: 1px solid; }
.alert ul { margin: 4px 0 0; padding-left: 18px; }
.alert-error { background: #fdf0f0; border-color: #f2c4c4; color: #8c1d1d; }
.alert-warn { background: #fdf6e7; border-color: #f0d9a8; color: #7a5108; }
.alert-info { background: #edf3fd; border-color: #c9d9f6; color: #1d3f86; }
.alert-ok { background: #ebf7f0; border-color: #bfe3cd; color: #1d6b3d; }
#toasts { position: fixed; right: 16px; bottom: 16px; z-index: 1000; display: flex; flex-direction: column; gap: 8px; max-width: min(440px, calc(100vw - 32px)); }
.toast { position: relative; background: #fff; border: 1px solid var(--line); border-left: 4px solid var(--brand); border-radius: var(--r); padding: 10px 30px 10px 12px; box-shadow: 0 6px 20px rgba(0, 0, 0, .12); animation: pop .15s ease-out; }
.toast.t-error { border-left-color: var(--danger); }
.toast.t-warn { border-left-color: var(--warn); }
.toast.t-ok { border-left-color: var(--ok); }
.toast-msg { font-weight: 600; }
.toast-detail ul { margin: 4px 0; padding-left: 18px; }
.toast-x { position: absolute; right: 6px; top: 4px; border: 0; background: none; font-size: 18px; cursor: pointer; color: var(--muted); }

/* ── 모달 ── */
.overlay { position: fixed; inset: 0; background: rgba(17, 24, 39, .45); z-index: 500; display: flex; align-items: flex-start; justify-content: center; padding: 6vh 12px; overflow-y: auto; }
.modal { background: #fff; border-radius: 10px; width: min(620px, 100%); box-shadow: 0 20px 50px rgba(0, 0, 0, .25); animation: pop .15s ease-out; }
.modal-wide { width: min(1100px, 100%); }
.modal-h { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border-bottom: 1px solid var(--line2); }
.modal-h h2 { margin: 0; }
.modal-x { border: 0; background: none; font-size: 22px; cursor: pointer; color: var(--muted); line-height: 1; }
.modal-b { padding: 14px 16px; max-height: 72vh; overflow-y: auto; }
.modal-f { display: flex; justify-content: flex-end; gap: 8px; padding: 10px 16px; border-top: 1px solid var(--line2); background: #fafbfc; border-radius: 0 0 10px 10px; }

/* ── 탭 ── */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 12px; overflow-x: auto; }
.tab { border: 0; background: none; padding: 8px 14px; font: inherit; font-weight: 550; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tab.active { color: var(--brand); border-bottom-color: var(--brand); }

/* ── 타임라인 ── */
.timeline { list-style: none; margin: 0; padding: 0 0 0 14px; border-left: 2px solid var(--line); }
.timeline li { position: relative; padding: 4px 0 10px 12px; }
.timeline li::before { content: ""; position: absolute; left: -20px; top: 9px; width: 10px; height: 10px; border-radius: 50%; background: #fff; border: 2px solid var(--brand); }
.timeline .tl-t { color: var(--muted); font-size: 11.5px; }

/* ── 진행 바 ── */
.prog { display: inline-block; width: 70px; height: 6px; background: #e8ecf1; border-radius: 3px; overflow: hidden; vertical-align: middle; margin-right: 6px; }
.prog > i { display: block; height: 100%; background: var(--ok); }

/* ── 로그인/로딩 ── */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; background: linear-gradient(160deg, #1b2537 0%, #24324b 60%, #2b3d5c 100%); }
.login-card { background: #fff; border-radius: 12px; width: min(380px, 100%); padding: 26px; box-shadow: 0 24px 60px rgba(0, 0, 0, .35); display: flex; flex-direction: column; gap: 12px; }
.login-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 6px; }
.login-brand .logo { width: 44px; height: 34px; font-size: 13px; }
.login-wrap > .loading { color: #dbe3ef; }
.loading { display: flex; align-items: center; gap: 8px; color: var(--muted); padding: 18px 4px; }
.spinner { width: 16px; height: 16px; border: 2px solid #c9d2df; border-top-color: var(--brand); border-radius: 50%; animation: spin .7s linear infinite; display: inline-block; }
.empty { color: var(--muted); padding: 30px; text-align: center; background: var(--panel); border: 1px dashed var(--line); border-radius: 8px; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pop { from { transform: translateY(6px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ── 반응형 (태블릿) ── */
@media (max-width: 1100px) {
  .kv.cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid3 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 900px) {
  .sidebar { position: fixed; left: 0; top: 0; z-index: 60; transform: translateX(-100%); transition: transform .18s ease; }
  body.nav-open .sidebar { transform: none; }
  body.nav-open .nav-scrim { display: block; position: fixed; inset: 0; background: rgba(0, 0, 0, .35); z-index: 50; }
  .nav-toggle { display: inline-block; }
  .nav-collapse { display: none; }
  .main { padding: 12px 12px 40px; }
  .grid2, .grid3 { grid-template-columns: 1fr; }
  .kv.cols-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .top-org, .top-user .roles { display: none; }
  .btn { padding: 8px 12px; }
  .btn-sm { padding: 5px 9px; }
  .tbl td { padding: 8px 10px; }
}
@media (max-width: 600px) {
  .form-grid.cols-2, .form-grid.cols-3 { grid-template-columns: 1fr; }
  .kv.cols-2, .kv.cols-3, .kv.cols-4 { grid-template-columns: 1fr; }
  .filter-bar .field { width: 100%; }
}

/* ── 사진 ── */
.ph-col { width: 64px; }
.ph-thumb { position: relative; display: inline-block; padding: 0; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; background: #f1f3f6; cursor: zoom-in; flex: none; vertical-align: middle; }
.ph-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ph-thumb:hover { border-color: var(--brand); }
.ph-count { position: absolute; right: 2px; bottom: 2px; background: rgba(17, 24, 39, .75); color: #fff; font-size: 10px; padding: 0 4px; border-radius: 6px; }
.ph-pdf { display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; font-weight: 700; color: #a11d1d; font-size: 12px; background: #fdf0f0; }
.ph-none { display: inline-flex; align-items: center; justify-content: center; text-align: center; border-radius: 6px; background: #eef0f3; color: #8a94a3; font-size: 10.5px; border: 1px dashed #d5dae1; flex: none; vertical-align: middle; line-height: 1.2; }
.ph-big { display: inline-block; }
.ph-hero { display: flex; gap: 14px; align-items: flex-start; }
.ph-hero > .ph-big { flex: none; }
.ph-hero > :last-child { flex: 1; min-width: 0; }
.ph-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: 10px; }
.ph-empty { color: var(--muted); padding: 12px 0; grid-column: 1 / -1; }
.ph-tile { position: relative; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: #fff; display: flex; flex-direction: column; }
.ph-tile.primary { border-color: var(--brand); box-shadow: 0 0 0 1px var(--brand); }
.ph-tile-img { display: block; border: 0; padding: 0; width: 100%; aspect-ratio: 1; background: #f1f3f6; cursor: zoom-in; }
.ph-tile-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ph-badge { position: absolute; left: 6px; top: 6px; background: var(--brand); color: #fff; font-size: 11px; padding: 0 6px; border-radius: 8px; }
.ph-cap { font-size: 11.5px; padding: 4px 6px 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ph-acts { display: flex; gap: 4px; padding: 4px 6px 6px; flex-wrap: wrap; }
.ph-acts .btn-sm { padding: 2px 6px; font-size: 11px; }
.ph-upbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.ph-pick { position: relative; overflow: hidden; }
.ph-file { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }
.ph-progress { display: flex; flex-direction: column; gap: 4px; margin-top: 8px; }
.ph-up { display: flex; align-items: center; gap: 8px; font-size: 12px; }
.ph-up-name { max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ph-up .prog { width: 120px; }
.ph-up.err .prog > i { background: var(--danger); }
.lb { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.lb-stage { width: 100%; display: flex; justify-content: center; align-items: center; min-height: 240px; background: #111827; border-radius: 8px; }
.lb-img { max-width: 100%; max-height: 66vh; object-fit: contain; display: block; }
.lb-pdf { color: #fff; display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 40px; }
.lb-cap { color: var(--muted); font-size: 12px; text-align: center; }
@media (max-width: 900px) { .ph-hero { flex-direction: column; } .ph-grid { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); } }

/* ── 주문 상세: 본문 + 변경 기록 패널 ── */
.od-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; align-items: start; }
body.od-log-open .od-layout { grid-template-columns: minmax(0, 1fr) 340px; }
.od-log[hidden] { display: none !important; }
.log-toggle.active { background: var(--brand-l); border-color: #c9d9f8; color: var(--brand-d); }
.log-btn-n { font-weight: 700; margin-left: 2px; }
.log-close { background: none; border: 0; font-size: 18px; line-height: 1; color: var(--muted); cursor: pointer; padding: 0 4px; }
.log-close:hover { color: var(--text); }
.od-main { min-width: 0; }
.od-log { position: sticky; top: 60px; max-height: calc(100vh - 76px); display: flex; flex-direction: column; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--sh); }
.log-h { display: flex; align-items: center; gap: 8px; padding: 9px 12px; border-bottom: 1px solid var(--line2); }
.log-h .btn { margin-left: auto; }
.log-chips { display: flex; gap: 6px; padding: 8px 12px 4px; }
.chip { border: 1px solid var(--line); background: #fff; border-radius: 12px; padding: 2px 10px; font: inherit; font-size: 12px; cursor: pointer; color: var(--muted); }
.chip.active { background: var(--brand-l); border-color: #c9d9f8; color: var(--brand-d); font-weight: 600; }
.chip:disabled { opacity: .5; cursor: not-allowed; }
.log-list { overflow-y: auto; padding: 4px 8px 10px; }
.log-e { border-bottom: 1px solid var(--line2); padding: 8px 4px; font-size: 12.5px; border-left: 3px solid transparent; }
.log-e.hl { background: #f2f6ff; border-left-color: var(--brand); padding-left: 6px; }
.log-top { display: flex; justify-content: space-between; color: var(--muted); font-size: 11.5px; }
.log-a { font-weight: 600; color: #4a5568; }
.log-what { margin-top: 2px; }
.log-act { display: inline-block; font-size: 11px; font-weight: 700; padding: 0 6px; border-radius: 8px; background: #eef0f3; color: #3b4659; }
.log-act.act-update_line { background: #e6eefc; color: #1e48a8; }
.log-act.act-add_tracking, .log-act.act-update_tracking { background: #e0f4f2; color: #136a62; }
.log-act.act-remove_tracking, .log-act.act-cancel_quantity, .log-act.act-cancel_order { background: #fde7e7; color: #a11d1d; }
.log-act.act-confirm, .log-act.act-create, .log-act.act-import_create, .log-act.act-import_confirm { background: #e3f5ea; color: #1d6b3d; }
.log-target { font-weight: 600; }
.log-ch { margin: 4px 0 0; padding-left: 14px; }
.log-ch li { margin: 1px 0; word-break: break-word; }
.log-l { color: var(--muted); }
.log-b { color: #8a94a3; text-decoration: line-through; }
.log-af { color: var(--text); }
.log-r { color: var(--muted); font-size: 11.5px; margin-top: 2px; }
.tbl tr.row-sel td { background: #e9f0ff !important; }
.tbl tr.row-sel td:first-child { box-shadow: inset 3px 0 0 var(--brand); }
.trk-list { display: flex; flex-direction: column; gap: 1px; }
.trk { white-space: nowrap; }
.line-editor h3 { border-top: 1px solid var(--line2); padding-top: 10px; margin-top: 14px; }
/* ── 운송장 조회 ── */
.scan-in { font-size: 18px; padding: 10px 12px; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; letter-spacing: .5px; }
.lk-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(420px, 1fr)); gap: 10px; }
.lk-card { display: flex; gap: 12px; border: 1px solid var(--line); border-radius: 8px; padding: 10px; background: #fff; }
.lk-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.lk-trk { font-size: 12px; }
.lk-prod { font-size: 14px; }
.lk-qty { display: flex; gap: 14px; margin-top: 4px; }
.lk-msg { background: #fdf6e7; border: 1px solid #f0d9a8; border-radius: 6px; padding: 3px 8px; font-size: 12px; margin-top: 4px; }
@media (max-width: 1200px) {
  .od-layout, body.od-log-open .od-layout { grid-template-columns: 1fr; }
  .od-log { position: static; max-height: 480px; }
}
@media (max-width: 600px) { .lk-cards { grid-template-columns: 1fr; } .lk-card { flex-direction: column; } }

/* ── 금액 · 결제 ── */
.chips { display: flex; flex-wrap: wrap; gap: 3px; }
.svc-chip { font-size: 11px; padding: 0 6px; border-radius: 8px; background: #f2ecfb; color: #5b3a96; border: 1px solid #e3d6f5; white-space: nowrap; }
.est-mark { color: var(--warn); font-size: 11px; font-weight: 700; }
.card-sub { font-weight: 650; margin-bottom: 6px; display: flex; align-items: center; gap: 6px; }
.money-tbl td { padding: 4px 8px; }
.money-tbl tr.est-total td { border-top: 2px solid var(--line); background: #f7f9fb; }
.tbl tr.row-void td { color: #9aa3af; text-decoration: line-through; }
.tbl tr.row-void td:last-child, .tbl tr.row-void td:nth-last-child(3) { text-decoration: none; }
.pay-sum { display: flex; gap: 12px; align-items: flex-start; margin-bottom: 8px; }
.pay-sum > .kv { flex: 1; }

/* ── 검수 지시서 인쇄 화면 (앱 메뉴 없이) ── */
body.print-mode .sidebar, body.print-mode .topbar, body.print-mode .nav-scrim { display: none !important; }
body.print-mode .main { padding: 0 0 40px; max-width: none; }
body.print-mode { background: #e9edf2; }
.ps-toolbar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 8px 14px; background: #fff; border-bottom: 1px solid var(--line); box-shadow: var(--sh); }
.ps-tb-title { font-size: 14px; }
.ps-page { padding: 14px; }
.ps-settings { max-width: 210mm; margin: 0 auto 12px; background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; }
.ps-settings .table-wrap { margin-top: 8px; max-height: 260px; overflow: auto; }
.ps-sheet { width: 210mm; max-width: 100%; margin: 0 auto; background: #fff; padding: 10mm; box-shadow: 0 2px 12px rgba(0, 0, 0, .12); color: #000; font-size: 11.5px; }
.ps-head { border-bottom: 2px solid #000; padding-bottom: 6px; margin-bottom: 8px; }
.ps-title { font-size: 20px; font-weight: 800; letter-spacing: 1px; }
.ps-meta { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2px 12px; margin-top: 4px; }
.ps-notes { margin-top: 4px; }
.ps-line { position: relative; display: grid; grid-template-columns: 210px minmax(0, 1fr) 64px; gap: 10px; border: 1px solid #555; border-radius: 4px; padding: 8px 8px 8px 26px; margin-bottom: 7px; break-inside: avoid; page-break-inside: avoid; }
.ps-line-no { position: absolute; left: 0; top: 0; bottom: 0; width: 20px; background: #222; color: #fff; font-weight: 800; display: flex; align-items: center; justify-content: center; border-radius: 3px 0 0 3px; }
.ps-left { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.ps-photo { width: 90px; height: 90px; object-fit: cover; border: 1px solid #bbb; border-radius: 4px; display: block; }
.ps-nophoto { display: flex; align-items: center; justify-content: center; background: #f1f3f6; color: #888; font-size: 11px; }
.ps-bc { width: 200px; }
.bc-img { width: 200px; height: auto; max-height: 60px; object-fit: contain; object-position: left; image-rendering: pixelated; image-rendering: crisp-edges; display: block; }
.bc-missing { width: 200px; height: 40px; display: flex; align-items: center; justify-content: center; border: 1px dashed #aaa; color: #888; font-size: 11px; }
.ps-sku { font-size: 13px; font-weight: 700; margin-top: 2px; }
.ps-code { font-size: 11px; color: #333; }
.ps-body { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.ps-name { font-size: 14px; font-weight: 700; }
.ps-ic { font-weight: 400; color: #555; font-size: 11px; }
.ps-attrs { display: flex; flex-wrap: wrap; gap: 3px 14px; }
.ps-hl { background: #fff3c4; border: 1px solid #e0b400; border-radius: 3px; padding: 2px 6px; }
.ps-hl2 { background: #e6f0ff; border-color: #7aa2e8; }
.ps-box { border: 1px solid #999; border-radius: 3px; padding: 4px 6px; }
.ps-box-t { font-weight: 700; font-size: 11px; margin-bottom: 2px; display: flex; gap: 8px; align-items: center; }
.ps-check { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 2px 10px; }
.ps-check li { display: flex; align-items: center; gap: 6px; }
.ps-cb { display: inline-block; width: 12px; height: 12px; border: 1.5px solid #000; border-radius: 2px; flex: none; background: #fff; }
.ps-result { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 2px; }
.ps-result span { display: inline-flex; align-items: flex-end; gap: 3px; font-weight: 600; }
.ps-result .blank { display: inline-block; width: 34px; border-bottom: 1px solid #000; height: 14px; }
.ps-result .blank.wide { width: 70px; }
.ps-cur { color: var(--muted); font-size: 11px; }
.ps-qty { text-align: center; border-left: 1px dashed #999; padding-left: 6px; }
.ps-qty-l { font-size: 11px; color: #444; }
.ps-qty-v { font-size: 26px; font-weight: 800; line-height: 1.1; }
.ps-qty-u { font-size: 10px; color: #555; }
.ps-foot { margin-top: 8px; font-size: 10.5px; color: #444; }
/* 라벨 (62×30mm, 3열) */
.ps-sheet-labels { padding: 8mm 6mm; }
.ps-labels { display: grid; grid-template-columns: repeat(3, 62mm); gap: 2mm 4mm; justify-content: center; }
.lbl { width: 62mm; height: 30mm; border: 1px dashed #bbb; padding: 1.5mm 2mm; overflow: hidden; display: flex; flex-direction: column; align-items: center; justify-content: center; break-inside: avoid; page-break-inside: avoid; }
.lbl-bc { width: 54mm; height: auto; max-height: 13mm; object-fit: contain; image-rendering: pixelated; image-rendering: crisp-edges; display: block; }
.lbl .bc-missing { width: 54mm; height: 12mm; display: flex; }
.lbl-sku { font-size: 10px; font-weight: 700; margin-top: .5mm; }
.lbl-name { font-size: 8.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.lbl-ord { font-size: 8px; color: #333; }
@media screen and (max-width: 640px) { .ps-line { grid-template-columns: 1fr; } .ps-qty { border-left: 0; text-align: left; } .ps-meta { grid-template-columns: 1fr 1fr; } }

/* ── 인쇄 ── */
@media print {
  @page { size: A4 portrait; margin: 10mm; }
  body { background: #fff !important; }
  .sidebar, .topbar, .nav-scrim, .no-print, #toasts, .overlay { display: none !important; }
  .main, body.print-mode .main { padding: 0 !important; max-width: none !important; }
  .ps-page { padding: 0; }
  .ps-sheet { width: auto; box-shadow: none; padding: 0; margin: 0; }
  .ps-line { grid-template-columns: 210px minmax(0, 1fr) 64px; }
  .lbl { border-color: #ddd; }
  .ps-hl, .ps-hl2, .ps-line-no { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* ── 스캔 조회 ── */
.scan-hist { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; margin-top: 8px; }
.scan-res { margin-top: 10px; display: flex; flex-direction: column; gap: 10px; }
.scan-top { display: flex; gap: 14px; align-items: flex-start; }
.scan-info { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.scan-name { font-size: 18px; font-weight: 700; }
.scan-attrs { display: flex; gap: 16px; font-size: 14px; }
.scan-wi, .scan-cl { background: #fff; font-size: 14px; padding: 8px 10px; }
.scan-wi { border-color: #e0b400; background: #fffbea; }
.chk-list { display: flex; flex-direction: column; gap: 6px; }
.chk-item { display: flex; align-items: center; gap: 8px; font-size: 14px; cursor: pointer; }
.chk-item input { width: 20px; height: 20px; }
.scan-lines { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 8px; }
.scan-line { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; background: #fff; display: flex; flex-direction: column; gap: 3px; }
.scan-line.done { opacity: .6; }
.lk-msg2 { background: #e6f0ff; border-color: #a9c3f0; }
.scan-nf { font-size: 14px; }
.cl-ed { display: flex; flex-direction: column; gap: 4px; }
.cl-row input { flex: 1; min-width: 180px; }
@media (max-width: 700px) { .scan-top { flex-direction: column; } }

/* ── 출력 파일 ── */
.zh { font-family: "PingFang SC", "Microsoft YaHei", "Noto Sans SC", var(--font); }
.badge.lt-care_label { background: #e6eefc; color: #1e48a8; border-color: #c8d8f7; }
.badge.lt-barcode_label { background: #eceafd; color: #4338a8; border-color: #d6d1f8; }
.badge.lt-packaging_sticker { background: #e0f4f2; color: #136a62; border-color: #bfe6e1; }
.badge.lt-hang_tag { background: #fdf2dc; color: #8f5b09; border-color: #f4dcab; }
.badge.lt-other { background: #eef0f3; color: #4b5563; border-color: #dfe3e8; }
.scan-pa { border-color: #7aa2e8; background: #f5f9ff; font-size: 14px; padding: 8px 10px; }
.pa-list { display: flex; flex-direction: column; gap: 8px; }
.pa-item { display: grid; grid-template-columns: 150px minmax(0, 1fr) auto; gap: 10px; align-items: start; background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; }
.pa-type { display: flex; flex-direction: column; }
.pa-zh { font-size: 20px; font-weight: 800; font-family: "PingFang SC", "Microsoft YaHei", "Noto Sans SC", var(--font); }
.pa-ko { font-size: 12px; color: var(--muted); }
.pa-title { font-weight: 700; }
.pa-inst-zh { font-size: 16px; font-weight: 600; font-family: "PingFang SC", "Microsoft YaHei", "Noto Sans SC", var(--font); margin: 2px 0; }
.pa-lines { display: flex; flex-direction: column; gap: 4px; margin-top: 4px; border-top: 1px dashed var(--line); padding-top: 4px; }
.scan-zh { font-size: 16px; font-weight: 600; margin-bottom: 4px; }
.ps-zh { font-weight: 600; font-family: "PingFang SC", "Microsoft YaHei", "Noto Sans SC", var(--font); }
.ps-pa { border-color: #1e48a8; }
.ps-pa-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.ps-pa-list li { display: block; }
.ps-pa-list .ps-cb { vertical-align: -2px; margin-right: 4px; }
.ps-pa-zh { margin-left: 18px; font-family: "PingFang SC", "Microsoft YaHei", "Noto Sans SC", var(--font); }
@media (max-width: 700px) { .pa-item { grid-template-columns: 1fr; } }

/* ── 상점별 탭 ── */
.sg-card .card-h { flex-wrap: wrap; }
.sg-sum { display: flex; gap: 14px; align-items: flex-start; margin-bottom: 10px; padding: 8px 10px; background: #f7f9fb; border: 1px solid var(--line2); border-radius: 6px; }
.sg-sum > .kv { flex: 1; }
.sg-tag { display: inline-block; font-size: 10.5px; padding: 0 5px; border-radius: 6px; background: #e6eefc; color: #1e48a8; margin-left: 4px; vertical-align: 1px; }
.sg-tag.single { background: #eef0f3; color: #4b5563; }

/* ── 주문 행 체크 선택 / 일괄 입력 ── */
.cb-col { width: 28px; text-align: center; }
.cb-col input { width: 16px; height: 16px; }
.store-chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 6px; }
.sel-bar { position: sticky; top: 52px; z-index: 15; display: flex; flex-wrap: wrap; gap: 6px 8px; align-items: center; padding: 8px 12px; margin-bottom: 8px; background: #eaf1ff; border: 1px solid #b9cdf6; border-radius: 8px; box-shadow: var(--sh); }
.sel-bar[hidden] { display: none; }
.tbl tr.row-checked td { background: #f3f7ff; }
.bk { display: flex; flex-direction: column; gap: 10px; }
.bk-sec { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; }
.bk-sec-h { display: flex; align-items: center; gap: 6px; margin-bottom: 8px; cursor: pointer; }
.bk-sec.disabled { background: #f7f8fa; }
.bk-sec.disabled .form-grid, .bk-sec.disabled .table-wrap { opacity: .5; pointer-events: none; }

/* ── 교환 · 환불 ── */
.case-cell { display: inline-flex; flex-wrap: wrap; gap: 3px; }
.case-link { border: 0; background: none; padding: 2px; cursor: pointer; border-radius: 4px; font: inherit; text-align: left; }
.case-link:hover { background: #eef3ff; outline: 1px dashed #b9cdf6; }
.case-card { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; margin-bottom: 6px; display: flex; flex-direction: column; gap: 4px; background: #fff; }
.case-card.overdue { border-color: #f2a3a3; background: #fff6f6; }
.case-card.closed { opacity: .75; }
.case-tl { margin: 2px 0 0; }
.tbl tr.row-overdue td { background: #fff1f1; }

/* ── 바코드 작업 / 반품 주소 / 불량 ── */
.comp-chip { background: #fff3c4; border: 1px solid #e0b400; border-radius: 10px; padding: 0 8px; font-weight: 600; font-size: 12px; }
.bc-prev { min-height: 30px; }
.bc-prev .bc-img { width: 160px; max-height: 48px; }
.lw-box { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; margin-top: 6px; }
.lw-req { display: flex; gap: 8px; align-items: center; }
.lw-badge, .ps-lw-badge { display: inline-block; background: #c62f2f; color: #fff; font-weight: 800; padding: 3px 10px; border-radius: 6px; font-size: 15px; font-family: "PingFang SC", "Microsoft YaHei", var(--font); }
.ps-lw-badge { font-size: 12px; padding: 1px 8px; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.lw-note { font-weight: 600; }
.lw-cb .bc-img { width: 200px; }
.ps-lw { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; }
.ps-lw-cb { display: flex; align-items: center; gap: 6px; }
.ps-lw-cb .bc-img { width: 150px; max-height: 40px; }
.scan-comp { font-size: 14px; }
.addr { display: flex; flex-direction: column; gap: 2px; }
.addr-c { font-size: 12px; }
.addr-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 8px; }
.addr-item { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; display: flex; flex-direction: column; gap: 6px; }
.addr-item.def { border-color: #b9cdf6; background: #f5f9ff; }
.case-addr { border-left: 2px solid var(--line); padding-left: 8px; }
.df-form { display: flex; flex-direction: column; gap: 10px; }
.df-qty { width: 120px; font-size: 18px; }
.df-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.df-chip { display: inline-flex; flex-direction: column; align-items: center; min-width: 96px; padding: 6px 10px; border: 1px solid #cfd6e0; border-radius: 8px; background: #fff; cursor: pointer; font: inherit; }
.df-chip.on { background: #fde7e7; border-color: #c62f2f; color: #a11d1d; box-shadow: 0 0 0 1px #c62f2f; }
.df-zh { font-size: 16px; font-weight: 700; font-family: "PingFang SC", "Microsoft YaHei", var(--font); }
.df-ko { font-size: 11px; color: var(--muted); }
.df-strip { display: flex; gap: 3px; align-items: center; }
.df-tags { display: flex; flex-wrap: wrap; gap: 3px; }
.df-desc { max-width: 260px; max-height: 60px; overflow: hidden; }
.df-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.df-big { border: 1px solid var(--line); border-radius: 6px; padding: 0; overflow: hidden; aspect-ratio: 1; cursor: zoom-in; background: #f1f3f6; }
.df-big img { width: 100%; height: 100%; object-fit: cover; display: block; }
.df-chip-link { margin-top: 3px; text-decoration: none; }
.nav-badge { display: inline-block; margin-left: 4px; background: #c62f2f; color: #fff; border-radius: 9px; padding: 0 6px; font-size: 10.5px; font-weight: 700; }
.nav-badge[hidden] { display: none; }

/* ── 엑셀 주문서 ── */
.oi-choose { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 14px; align-items: start; }
.oi-side { display: flex; flex-direction: column; gap: 0; }
.oi-drop { border: 2px dashed #9fb6e6; border-radius: 10px; padding: 34px 16px; text-align: center; background: #f6f9ff; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.oi-drop.over { background: #e6efff; border-color: var(--brand); }
.oi-drop-t { font-size: 16px; font-weight: 700; }
.oi-status { margin-top: 10px; }
body.oi-mode .main { max-width: none; padding: 10px 12px 30px; }
.oi-page { display: flex; flex-direction: column; gap: 8px; }
.oi-head { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; display: flex; flex-direction: column; gap: 6px; }
.oi-title { display: flex; gap: 10px; align-items: baseline; }
.oi-hfields { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: flex-start; }
.oi-hfields .field { width: 150px; }
.oi-hfields .oi-cust { width: 340px; } .oi-hfields .oi-cur { width: 70px; } .oi-hfields .oi-svcf { width: auto; min-width: 260px; }
.oi-tools { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.oi-wrap { overflow: auto; max-height: calc(100vh - 290px); min-height: 240px; border: 1px solid #c8cfd9; background: #fff; outline: none; position: relative; }
.oi-wrap:focus { box-shadow: 0 0 0 2px #b9cdf6; }
.oi-grid { border-collapse: separate; border-spacing: 0; font-size: 12.5px; table-layout: fixed; }
.oi-grid th { position: sticky; top: 0; z-index: 3; background: #eef1f5; border-right: 1px solid #d5dbe3; border-bottom: 1px solid #c8cfd9; padding: 5px 6px; font-weight: 600; text-align: left; white-space: nowrap; }
.oi-grid td { border-right: 1px solid #e3e7ec; border-bottom: 1px solid #e3e7ec; padding: 2px 6px; height: 30px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 240px; cursor: cell; background: #fff; }
.oi-grid td.num, .oi-grid th.num { text-align: right; font-variant-numeric: tabular-nums; }
.oi-grid td.ro { background: #f7f8fa; color: #4a5568; }
.oi-grid td.blank { color: #9aa3af; }
.oi-grid .fz { position: sticky; z-index: 2; }
.oi-grid th.fz { z-index: 4; }
.oi-grid .fz0 { left: 0; } .oi-grid .fz1 { left: 40px; } .oi-grid .fz2 { left: 104px; box-shadow: 2px 0 0 #c8cfd9; }
.oi-grid td.fz0 { background: #eef1f5; text-align: center; color: #6b7686; }
.oi-grid td.sel { background: #e7efff; }
.oi-grid td.cur { outline: 2px solid #2456c7; outline-offset: -2px; }
.oi-grid td.err { background: #fde3e3 !important; }
.oi-grid td.warn { background: #fdf2dc !important; }
.oi-grid td.err-text { color: #a11d1d; white-space: normal; font-size: 11.5px; }
.oi-grid td.editing { padding: 0; outline: 2px solid #2456c7; outline-offset: -2px; }
.oi-in { border: 0; border-radius: 0; width: 100%; height: 28px; padding: 2px 6px; font: inherit; outline: none; }
.oi-in.num { text-align: right; }
.oi-img-wrap { position: relative; display: inline-block; }
.oi-img { width: 46px; height: 26px; padding: 0; border: 1px solid var(--line); border-radius: 4px; overflow: hidden; cursor: zoom-in; background: #f1f3f6; }
.oi-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.oi-img-x { position: absolute; right: -6px; top: -4px; border: 0; background: #333d4c; color: #fff; border-radius: 50%; width: 14px; height: 14px; font-size: 10px; line-height: 14px; padding: 0; cursor: pointer; display: none; }
.oi-img-wrap:hover .oi-img-x { display: block; }
.oi-img-add { position: relative; display: inline-flex; align-items: center; justify-content: center; width: 46px; height: 26px; border: 1px dashed #b8c2d0; border-radius: 4px; color: #6b7686; cursor: pointer; overflow: hidden; }
td.over .oi-img-add, td.over { background: #e6efff !important; }
.oi-chips { display: inline-flex; gap: 3px; }
.oi-chip { font-size: 10.5px; padding: 0 5px; border-radius: 6px; border: 1px solid; white-space: nowrap; }
.oi-chip.ex { background: #e3f5ea; color: #1d6b3d; border-color: #bfe5cd; }
.oi-chip.nw { background: #e6eefc; color: #1e48a8; border-color: #c8d8f7; }
.oi-foot { position: sticky; bottom: 0; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; display: flex; flex-direction: column; gap: 6px; box-shadow: 0 -2px 8px rgba(0, 0, 0, .05); }
.oi-sum { display: flex; flex-wrap: wrap; gap: 6px 16px; align-items: center; }
@media (max-width: 900px) { .oi-choose { grid-template-columns: 1fr; } }

.oi-tpl { margin-top: 12px; padding: 10px 12px; border: 1px dashed var(--line); border-radius: 8px; background: #fafbfd; }

.sec-t { font-weight: 700; margin-top: 6px; padding-top: 8px; border-top: 1px solid var(--line2); }

/* ── 어디서나 상품 조회 (플로팅 버튼 + 서랍) ── */
.fab { position: fixed; right: 20px; bottom: 20px; z-index: 1100; display: inline-flex; align-items: center; gap: 6px; padding: 11px 18px 11px 14px; border: 0; border-radius: 28px; background: var(--brand); color: #fff; font: inherit; font-weight: 700; box-shadow: 0 6px 18px rgba(36, 86, 199, .4); cursor: pointer; }
.fab:hover { background: var(--brand-d); }
.fab[hidden] { display: none; }
.fab-ic { font-size: 18px; line-height: 1; }
body:has(.overlay) .fab, body:has(.oi-src-ov) .fab, body.pf-open .fab, body.print-mode .fab { display: none; }
#toasts { bottom: 76px; }
.pf-drawer { position: fixed; inset: 0; z-index: 450; display: flex; justify-content: flex-end; }
.pf-drawer[hidden] { display: none; }
.pf-scrim { position: absolute; inset: 0; background: rgba(17, 24, 39, .25); }
.pf-panel { position: relative; width: min(540px, 100vw); height: 100%; background: #fff; box-shadow: -8px 0 24px rgba(0, 0, 0, .18); display: flex; flex-direction: column; animation: pfin .15s ease-out; }
@keyframes pfin { from { transform: translateX(30px); opacity: .6; } to { transform: none; opacity: 1; } }
.pf-head { display: flex; align-items: center; gap: 8px; padding: 10px 14px; border-bottom: 1px solid var(--line2); }
.pf-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pf-body { flex: 1; overflow-y: auto; padding: 12px 14px 30px; display: flex; flex-direction: column; gap: 10px; }
.pf-q { font-size: 16px; padding: 9px 12px; }
.pf-list { display: flex; flex-direction: column; gap: 4px; }
.pf-sub { padding: 6px 2px; }
.pf-item { display: flex; gap: 10px; align-items: center; text-align: left; border: 1px solid var(--line); border-radius: 8px; background: #fff; padding: 6px 8px; cursor: pointer; font: inherit; }
.pf-item:hover { border-color: #b9cdf6; background: #f6f9ff; }
.pf-item-b { min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.pf-recent { padding: 8px 10px; }
.pf-top { display: flex; gap: 12px; align-items: flex-start; }
.pf-name { font-size: 16px; font-weight: 700; }
.pf-sec { border-top: 1px solid var(--line2); padding-top: 8px; display: flex; flex-direction: column; gap: 6px; }
.pf-sec .sec-t { display: flex; align-items: center; gap: 8px; font-weight: 700; margin: 4px 0 0; }
.pf-row { display: grid; grid-template-columns: 130px minmax(0, 1fr); gap: 8px; align-items: start; }
.pf-lbl { color: var(--muted); font-size: 12px; padding-top: 4px; }
.pf-val { display: inline-block; min-height: 22px; padding: 2px 4px; border-radius: 4px; white-space: pre-wrap; word-break: break-word; }
.pf-val.editable { cursor: text; border: 1px dashed transparent; }
.pf-val.editable:hover { border-color: #b9cdf6; background: #f6f9ff; }
.pf-edit-in { min-width: 140px; }
.pf-saved { color: var(--ok); font-size: 11.5px; font-weight: 700; }
.pf-lines { display: flex; flex-direction: column; gap: 6px; }
.pf-line { text-align: left; border: 1px solid var(--line); border-radius: 8px; background: #fff; padding: 6px 8px; cursor: pointer; font: inherit; display: flex; flex-direction: column; gap: 2px; }
.pf-line:hover { border-color: #b9cdf6; }
.pf-chips { display: flex; flex-wrap: wrap; gap: 3px; align-items: center; }
.pf-ul { margin: 0; padding-left: 18px; }
@media (max-width: 700px) { .fab { padding: 12px; } .fab-lb { display: none; } .pf-row { grid-template-columns: 1fr; } }
@media print { .fab, .pf-drawer { display: none !important; } }

/* ── 작업 바코드 ── */
.wb { color: #4338a8; }
.ps-head-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.ps-obc { text-align: right; }
.ps-obc-l { font-size: 10.5px; font-weight: 700; }
.ps-obc-img { width: 220px; max-height: 50px; object-position: right; margin-left: auto; }
.ps-work { font-size: 12px; font-weight: 700; color: #000; }
.ps-var { font-size: 10px; color: #555; }
.lbl-var { font-size: 8px; color: #444; }
.wb-hl { background: #eceafd; border: 1px solid #b9b0f3; border-radius: 6px; padding: 6px 10px; font-weight: 700; color: #4338a8; }
.scan-line.wb-line { border-color: #7c6ff0; box-shadow: 0 0 0 1px #7c6ff0; }
.scan-order { border: 1px solid #b9cdf6; background: #f5f9ff; border-radius: 8px; padding: 10px 12px; display: flex; flex-direction: column; gap: 4px; }

/* ── 업체 표기 (상품명 · 바코드 · 케어라벨) ── */
.oi-grid td.ml { white-space: normal; }
.oi-grid td.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; }
.oi-ml { white-space: pre-line; font-size: 11px; line-height: 13px; max-height: 26px; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.oi-grid td.editing.ml { overflow: visible; }
.oi-ta { position: absolute; z-index: 10; width: 320px; min-height: 120px; font: inherit; font-size: 12px; padding: 6px 8px; border: 2px solid #2456c7; border-radius: 0; box-shadow: 0 6px 18px rgba(0, 0, 0, .18); resize: both; outline: none; background: #fff; }
.cl-name { color: #5b3a96; }
.care-chip { border: 1px solid #e3cff4; background: #f3e9fb; color: #6b2fa0; border-radius: 8px; font-size: 10.5px; padding: 0 6px; cursor: pointer; font: inherit; font-size: 10.5px; }
.care-pre { white-space: pre-wrap; font-family: inherit; font-size: 13px; margin: 0; background: #fafbfc; border: 1px solid var(--line); border-radius: 6px; padding: 8px 10px; max-height: 50vh; overflow: auto; }
.care-ta { font-size: 12.5px; }
.care-det summary { cursor: pointer; font-size: 12px; color: #6b2fa0; }
.ps-cname { font-size: 14px; font-weight: 800; }
.ps-care { border-color: #6b2fa0; }
.ps-care-t { white-space: pre-wrap; font-size: 10.5px; line-height: 1.35; }

/* ── 불량 실시간 알림 ── */
.da { position: fixed; top: 58px; right: 18px; z-index: 40; }
.da[hidden] { display: none; }
.da-pill { position: relative; display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 20px; border: 1px solid #f2b8b8; background: #fff; color: #a11d1d; font: inherit; font-weight: 700; cursor: pointer; box-shadow: 0 4px 14px rgba(198, 47, 47, .18); }
.da-dot { width: 9px; height: 9px; border-radius: 50%; background: #c62f2f; display: inline-block; }
.da-n { font-size: 15px; font-variant-numeric: tabular-nums; }
.da-today { font-size: 11px; color: var(--muted); font-weight: 500; }
.da-off { display: none; width: 7px; height: 7px; border-radius: 50%; background: #9aa3af; }
.da.offline .da-off { display: inline-block; }
.da.offline .da-dot { background: #9aa3af; }
.da.bump .da-pill { animation: da-bump .45s ease-out 2; }
.da.bump .da-pill::after { content: ""; position: absolute; inset: -4px; border-radius: 24px; border: 2px solid #c62f2f; animation: da-ring 1s ease-out 3; pointer-events: none; }
.da.flash .da-pill { background: #fde3e3; }
@keyframes da-bump { 0% { transform: scale(1); } 40% { transform: scale(1.18); } 100% { transform: scale(1); } }
@keyframes da-ring { from { opacity: .8; transform: scale(1); } to { opacity: 0; transform: scale(1.35); } }
.da-pop { position: absolute; right: 0; top: calc(100% + 6px); width: 360px; max-width: calc(100vw - 24px); background: #fff; border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 12px 30px rgba(0, 0, 0, .18); padding: 6px; display: flex; flex-direction: column; gap: 4px; }
.da-pop[hidden] { display: none; }
.da-pop-h { padding: 4px 6px; }
.da-item { display: flex; gap: 8px; align-items: flex-start; text-align: left; border: 0; border-radius: 6px; background: none; padding: 6px; cursor: pointer; font: inherit; }
.da-item:hover { background: #f6f9ff; }
.da-item-b { min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.da-all { text-align: center; padding: 6px; border-top: 1px solid var(--line2); font-weight: 600; }
.nav-badge.pulse { animation: da-bump .5s ease-out 4; }
body.nav-collapsed .nav-i[data-alert] { position: relative; }
body.nav-collapsed .nav-i[data-alert]::after { content: attr(data-alert); position: absolute; top: 3px; right: 6px; min-width: 14px; height: 14px; padding: 0 3px; border-radius: 7px; background: #c62f2f; color: #fff; font-size: 9px; font-weight: 700; line-height: 14px; text-align: center; }
body.print-mode .da { display: none !important; }
@media (max-width: 700px) { .da { top: auto; bottom: 20px; right: auto; left: 14px; } .da-pop { top: auto; bottom: calc(100% + 6px); left: 0; right: auto; } }
@media (prefers-reduced-motion: reduce) { .da.bump .da-pill, .nav-badge.pulse { animation: none; } .da.bump .da-pill::after { display: none; } .da.bump .da-pill { background: #fde3e3; } }
@media print { .da { display: none !important; } }

/* ── 불량 관리 (목록 필터·탭·등록) ── */
.df-filters .df-q { width: 280px; }
.df-filters .df-dates { width: auto; }
.df-filters .df-dates input { width: 140px; }
.tab-n { font-size: 11px; color: var(--muted); font-weight: 600; }
.tab.active .tab-n { color: var(--brand); }
.df-desc2 { max-width: 240px; font-size: 12px; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; white-space: normal; }
.df-pick-list { display: flex; flex-direction: column; gap: 4px; max-height: 55vh; overflow-y: auto; }
.bulk-prog { display: flex; flex-direction: column; gap: 4px; max-height: 50vh; overflow-y: auto; }
.pf-line-wrap { display: flex; flex-direction: column; gap: 3px; }
.pf-line-wrap > .btn { align-self: flex-start; }
/* 상품 사진 전체 관리 (상품 공통 + 옵션별) */
.ph-level { position: absolute; right: 6px; top: 6px; max-width: calc(100% - 52px); background: rgba(55, 65, 81, .82); color: #fff; font-size: 10.5px; padding: 0 6px; border-radius: 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ph-level.v { background: rgba(124, 58, 237, .85); }
.ph-tile.ph-mine { outline: 2px dashed #7c3aed; outline-offset: -2px; }
.ph-filter, .ph-target { font-size: 12px; padding: 2px 4px; max-width: 220px; }
.ph-compact .ph-grid { grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 8px; }

/* ───────────── 케어라벨·출력 파일 라이브러리 (pl-*) ───────────── */
.pl-filters .pl-q { min-width: 280px; flex: 1 1 280px; }
.pl-filters label.chk, .pl-ln label.chk, .pl-link-row { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; cursor: pointer; }
.pl-code { display: inline-block; font-weight: 700; color: #1f4e8c; background: #eef4fc; border: 1px solid #d6e4f5; border-radius: 4px; padding: 0 5px; margin-right: 5px; font-size: 12px; }
.pl-name strong { font-weight: 650; }
.pl-inst { max-width: 280px; white-space: pre-wrap; font-size: 12px; }
.pl-chips { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; max-width: 420px; }
.pl-cnt { margin-right: 2px; }
.pl-chip { display: inline-block; font-size: 11.5px; padding: 1px 6px; border-radius: 10px; background: #f1f4f8; border: 1px solid var(--line); color: var(--text); max-width: 190px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pl-chip.more { background: #fff; color: var(--muted); }
a.pl-chip:hover { border-color: #9fb6d6; }
.pl-shared { display: inline-block; margin-top: 2px; font-size: 11.5px; color: #56627a; }
.pl-shared.multi { color: #7a4b00; background: #fff6e0; border: 1px solid #f1dca6; border-radius: 10px; padding: 0 7px; font-weight: 600; }
.pl-conf { margin: 8px 0 0; padding-left: 18px; }
.pl-conf li { margin-bottom: 6px; }
.pl-pick-list { margin-top: 6px; max-height: 52vh; overflow: auto; }
/* 여러 파일 올리기 */
.pl-up-list { display: flex; flex-direction: column; gap: 8px; max-height: 58vh; overflow: auto; }
.pl-up-item { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; background: #fbfcfd; }
.pl-up-item.ok { background: #f2fbf4; border-color: #bfe3c8; }
.pl-up-h { align-items: center; margin-bottom: 6px; }
.pl-up-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px 10px; }
.pl-up-grid .w2 { grid-column: span 2; }
.pl-up-grid .w3 { grid-column: span 2; }
.pl-up-grid textarea { min-height: 32px; }
@media (max-width: 760px) { .pl-up-grid { grid-template-columns: 1fr 1fr; } }
/* 상품 연결 */
.pl-ln-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 8px; }
@media (max-width: 760px) { .pl-ln-cols { grid-template-columns: 1fr; } }
.pl-ln-results { display: flex; flex-direction: column; gap: 4px; max-height: 46vh; overflow: auto; }
.pl-ln-item { display: flex; align-items: center; gap: 8px; text-align: left; background: #fff; border: 1px solid var(--line); border-radius: 6px; padding: 5px 8px; cursor: pointer; font: inherit; }
.pl-ln-item:hover { border-color: #9fb6d6; background: #f6f9fd; }
.pl-ln-card { border: 1px solid #cfdcee; background: #f6f9fd; border-radius: 8px; padding: 8px 10px; margin: 6px 0; display: flex; flex-direction: column; gap: 5px; }
.pl-ln-vars { display: flex; flex-direction: column; gap: 3px; max-height: 26vh; overflow: auto; padding-left: 4px; }
.pl-ln-staged { margin-top: 8px; }
.pl-ln-list { list-style: none; margin: 4px 0 0; padding: 0; display: flex; flex-direction: column; gap: 3px; }
.pl-ln-list li { display: flex; align-items: center; justify-content: space-between; gap: 6px; padding: 3px 6px; border: 1px solid var(--line2); border-radius: 5px; font-size: 12.5px; }
/* 상세: 상품별 묶음 */
.pl-groups { display: flex; flex-direction: column; gap: 8px; }
.pl-group { border: 1px solid var(--line); border-radius: 8px; }
.pl-group-h { display: flex; align-items: center; gap: 10px; padding: 7px 10px; background: #f7f9fb; border-bottom: 1px solid var(--line2); border-radius: 8px 8px 0 0; }
.pl-group-rows { display: flex; flex-direction: column; }
.pl-link-row { display: flex; padding: 5px 12px 5px 16px; border-bottom: 1px solid var(--line2); }
.pl-link-row:last-child { border-bottom: 0; }
.pl-link-row .grow, .pl-group-h .grow { flex: 1; }
/* 주문: 출력 파일별 묶음 */
.pl-og-sum { font-weight: 650; margin-bottom: 8px; }
.pl-og-total { font-weight: 700; color: #1f4e8c; margin-right: 6px; }
.pl-og-inst { white-space: pre-wrap; background: #fffbea; border: 1px solid #f1e3a6; border-radius: 6px; padding: 5px 8px; margin-bottom: 6px; font-size: 13px; }
.pl-og-miss .card-h { color: #8a5a00; background: #fff8e6; }
.ph-tags { display: flex; flex-wrap: wrap; gap: 3px; padding: 4px 6px 0; }
.ph-tag { font-size: 10.5px; padding: 0 5px; border-radius: 6px; background: #eef1f5; color: #374151; max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ph-tag.v { background: #f1e9fe; color: #5b21b6; }
.ph-tag.p { background: var(--brand); color: #fff; }
.ph-tag.p.v { background: #7c3aed; color: #fff; }
.ph-dlg-top { display: flex; gap: 10px; align-items: flex-start; }
.ph-dlg-top img { width: 96px; height: 96px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); }
.ph-vlist { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 4px 12px; max-height: 320px; overflow: auto; }
.ph-vrow { padding: 3px 0; }

/* ───────────── 주문서 원본 열어 고치기 (oi-src / oi-sg) ───────────── */
body.oi-src-open { overflow: hidden; }
.oi-src-ov { position: fixed; inset: 0; z-index: 480; background: rgba(20, 28, 40, .45); display: flex; padding: 14px; }
.oi-src { background: var(--panel); border-radius: 10px; flex: 1; display: flex; flex-direction: column; min-width: 0; min-height: 0; box-shadow: 0 10px 40px rgba(0,0,0,.25); }
.oi-src-h { display: flex; align-items: center; gap: 8px; padding: 9px 14px; border-bottom: 1px solid var(--line); }
.oi-src-h .grow, .oi-src-act .grow { flex: 1; }
.oi-src-b { flex: 1; display: flex; flex-direction: column; min-height: 0; padding: 8px 14px 10px; gap: 6px; }
.oi-src-top { display: flex; flex-direction: column; gap: 6px; }
.oi-src-top .alert { margin: 0; }
.oi-src-tools { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.oi-src-sep { width: 1px; height: 20px; background: var(--line); margin: 0 4px; }
.oi-src-cnt { font-size: 12px; color: var(--muted); padding: 1px 8px; border-radius: 10px; border: 1px solid var(--line); }
.oi-src-cnt.on { color: #8a5a00; background: #fff6dc; border-color: #f0d796; font-weight: 650; }
.oi-src-check { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; font-size: 12.5px; }
.oi-chk.ok { color: #1e7a3c; font-weight: 600; }
.oi-chk.no { color: #b42318; font-weight: 600; }
.oi-src-tabs { margin: 0; }
.oi-sg-wrap { flex: 1; min-height: 160px; overflow: auto; border: 1px solid var(--line); border-radius: 6px; outline: none; background: #fff; }
.oi-sg-wrap:focus { border-color: #8fb0dc; }
.oi-sg { border-collapse: separate; border-spacing: 0; font-size: 12px; table-layout: fixed; }
.oi-sg th, .oi-sg td { border-right: 1px solid #e6e9ee; border-bottom: 1px solid #e6e9ee; }
.oi-sg td { min-width: 90px; max-width: 220px; height: 22px; padding: 2px 5px; white-space: pre-wrap; overflow: hidden; text-overflow: ellipsis; vertical-align: top; max-height: 60px; cursor: cell; }
.oi-sg td.mg { background: #fbfcfe; vertical-align: middle; }
.oi-sg thead th { position: sticky; z-index: 3; background: #f3f5f8; font-weight: 600; color: #4a5568; }
.oi-sg .oi-sg-lt th { top: 0; height: 22px; text-align: center; }
.oi-sg .oi-sg-map th { top: 23px; padding: 2px; }
.oi-sg .oi-sg-map select { width: 100%; min-width: 90px; font-size: 11.5px; padding: 1px 2px; }
.oi-sg .oi-sg-map select.set { background: #eef5ff; border-color: #9ec0ea; font-weight: 600; }
.oi-sg .oi-sg-map th.req select { background: #e7f6ec; border-color: #8ccaa0; }
.oi-sg th.oi-sg-corner { left: 0; z-index: 5; min-width: 54px; font-size: 11px; }
.oi-sg .oi-sg-rn { position: sticky; left: 0; z-index: 2; background: #f3f5f8; text-align: right; padding: 0 6px; color: #6b7686; font-weight: 500; cursor: pointer; white-space: nowrap; min-width: 54px; }
.oi-sg .oi-sg-rn.cur { background: #dce8f8; color: #1f4e8c; }
.oi-sg-pic { margin-left: 3px; font-size: 11px; }
.oi-sg tr.above td { color: #a0a8b4; background: #f8f9fb; }
.oi-sg tr.hdr td { background: #fff4d6; font-weight: 700; border-bottom: 2px solid #e0b84a; }
.oi-sg tr.hdr .oi-sg-rn { background: #f7d77c; color: #5a4100; }
.oi-sg td.ed { background: #fff0f0; box-shadow: inset 0 0 0 1px #f2a7a7; }
.oi-sg tr.hdr td.ed { background: #ffe3c8; }
.oi-sg td.cur { outline: 2px solid #2f6fd0; outline-offset: -2px; }
.oi-sg td.editing { padding: 0; overflow: visible; }
.oi-sg-in { width: 100%; min-width: 140px; min-height: 22px; font: inherit; border: 2px solid #2f6fd0; padding: 1px 4px; resize: vertical; box-sizing: border-box; }
.oi-src-foot { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 12px; align-items: start; }
@media (max-width: 900px) { .oi-src-foot { grid-template-columns: 1fr; } }
.oi-src-prev-t { font-weight: 650; font-size: 12.5px; margin-bottom: 3px; }
.oi-src-ptbl td, .oi-src-ptbl th { padding: 3px 6px; font-size: 12px; }
.oi-src-ptbl td.miss { background: #fdecec; }
.oi-src-act { display: flex; flex-direction: column; gap: 6px; }

/* 불량 음성 알림 켜기/끄기 */
.voice-tg { border: 1px solid var(--line); background: #fff; border-radius: 14px; padding: 3px 10px; font: inherit; font-size: 12px; cursor: pointer; white-space: nowrap; }
.voice-tg:hover { border-color: var(--brand); }
.voice-tg.off { color: #6b7280; background: #f3f4f6; }
.voice-tg:disabled { opacity: .5; cursor: not-allowed; }
.da-pop-h { display: flex; align-items: center; gap: 6px; }

/* ═════════════════════ 모바일 (휴대폰 · 작은 태블릿) ═════════════════════
   넓은 화면(PC)의 모양은 바꾸지 않는다 — 아래 규칙은 모두 화면 폭/터치 조건 안에서만 적용된다. */
.filter-more { display: none; }

/* 터치 기기: 입력란 글자가 16px 보다 작으면 iOS 가 화면을 확대해 버린다 */
@media (max-width: 900px) and (pointer: coarse) {
  input:not([type=checkbox]):not([type=radio]):not([type=file]), select, textarea { font-size: 16px !important; }
  .scan-in, .df-qty { font-size: 18px !important; }
  input[type=checkbox], input[type=radio] { width: 18px; height: 18px; }
  .chk-item input { width: 22px; height: 22px; }
}

@media (max-width: 900px) {
  html { -webkit-text-size-adjust: 100%; }
  body { -webkit-tap-highlight-color: rgba(36, 86, 199, .12); }
  body.nav-open, body:has(> .overlay), body.pf-open { overflow: hidden; }
  button, .btn, a, label, select, input[type=checkbox], input[type=radio] { touch-action: manipulation; }

  /* 덮는 사이드 메뉴 */
  .sidebar { width: min(288px, 84vw); flex-basis: auto; height: 100vh; height: 100dvh; box-shadow: none; padding-bottom: env(safe-area-inset-bottom); overscroll-behavior: contain; }
  body.nav-open .sidebar { box-shadow: 8px 0 30px rgba(0, 0, 0, .3); }
  .brand { padding: calc(14px + env(safe-area-inset-top)) 18px 14px; }
  .nav-gt { padding: 12px 20px 4px; font-size: 11.5px; }
  .nav-i { padding: 11px 20px; font-size: 14.5px; gap: 12px; }
  .nav-ic { width: 20px; font-size: 15px; }

  /* 상단 바 */
  .topbar { gap: 8px; padding: 6px max(10px, env(safe-area-inset-right)) 6px max(10px, env(safe-area-inset-left)); padding-top: calc(6px + env(safe-area-inset-top)); }
  .nav-toggle { min-width: 40px; min-height: 40px; font-size: 19px; display: inline-flex; align-items: center; justify-content: center; }
  .top-user { gap: 6px; flex-wrap: nowrap; min-width: 0; }
  .top-name { max-width: 120px; min-width: 0; }
  .voice-tg { padding: 6px 10px; }

  .main { padding: 12px max(12px, env(safe-area-inset-right)) calc(84px + env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left)); }

  /* 손가락으로 누르기 쉬운 크기 */
  .btn { min-height: 38px; }
  .btn-sm { min-height: 32px; }
  .tabs { scrollbar-width: none; -webkit-overflow-scrolling: touch; }
  .tabs::-webkit-scrollbar { display: none; }
  .tab { padding: 10px 14px; }
  .chip { padding: 5px 12px; }
  .modal-x, .toast-x, .log-close { min-width: 36px; min-height: 36px; }
  .table-wrap { -webkit-overflow-scrolling: touch; }

  /* 떠 있는 요소: 홈 인디케이터(안전 영역) 위로 */
  .fab { right: max(14px, env(safe-area-inset-right)); bottom: calc(14px + env(safe-area-inset-bottom)); }
  #toasts { left: 12px; right: 12px; max-width: none; bottom: calc(72px + env(safe-area-inset-bottom)); }
  .pf-body { padding-bottom: calc(30px + env(safe-area-inset-bottom)); }
  .sel-bar { top: calc(52px + env(safe-area-inset-top)); }

  /* 엑셀 주문서 · 원본 고치기 */
  .oi-wrap { max-height: calc(100dvh - 250px); }
  .oi-ta { width: min(320px, 88vw); }
  .oi-src-ov { padding: 0; }
  .oi-src { border-radius: 0; padding-bottom: env(safe-area-inset-bottom); }
  .ps-sheet-labels { overflow-x: auto; }
}
@media (max-width: 700px) {
  .da { bottom: calc(14px + env(safe-area-inset-bottom)); left: max(14px, env(safe-area-inset-left)); }
}

@media (max-width: 640px) {
  h1 { font-size: 18px; }
  .top-name { max-width: 84px; }

  /* 페이지 머리 · 카드 */
  .page-h { flex-direction: column; align-items: stretch; gap: 8px; }
  .page-actions:empty { display: none; }
  .page-actions .btn { flex: 1 1 auto; justify-content: center; }
  .card-h { flex-wrap: wrap; padding: 9px 12px; }
  .card-b { padding: 12px; }
  .card-b > .table-wrap { margin: -12px; }
  .kv.cols-2, .kv.cols-3, .kv.cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 12px; }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .tile { padding: 10px 12px; }
  .tile-v { font-size: 21px; }
  .quick .btn { flex: 1 1 calc(50% - 4px); justify-content: center; }
  .pay-sum, .sg-sum { flex-direction: column; align-items: stretch; }
  .scan-lines { grid-template-columns: 1fr; }
  .scan-attrs { flex-wrap: wrap; gap: 4px 14px; }

  /* 필터: 2열 격자, 넓은 항목은 한 줄 전체 */
  .filter-bar { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; padding: 10px; }
  .filter-bar .field, .df-filters .df-q, .pl-filters .pl-q { width: auto; min-width: 0; }
  .filter-bar .field .lookup { min-width: 0; }
  .filter-bar .field:has(.lookup), .filter-bar .field:has(.chk), .filter-bar .df-q, .filter-bar .df-dates, .filter-bar .pl-q, .filter-bar .filter-btns { grid-column: 1 / -1; }
  .filter-bar .field:has(.chk) > label, .filter-bar .filter-btns > label { display: none; }
  .df-filters .df-dates input { width: auto; flex: 1; min-width: 0; }
  .filter-bar .filter-btns { flex-direction: row; flex-wrap: wrap; gap: 8px; }
  .filter-bar .filter-btns > .row { flex: 1; }
  .filter-bar .filter-btns .btn { flex: 1 1 auto; justify-content: center; }
  .filter-more { display: inline-flex; }
  .filter-more.on { background: var(--brand-l); border-color: #c9d9f8; color: var(--brand-d); }
  .filter-bar.fb-fold:not(.fb-open) > .field:nth-child(n+3):not(.filter-btns) { display: none; }
  .oi-hfields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .oi-hfields .field, .oi-hfields .oi-cur { width: auto; min-width: 0; }
  .oi-hfields .oi-cust, .oi-hfields .oi-svcf { width: auto; min-width: 0; grid-column: 1 / -1; }
  .oi-grid td.fz1, .oi-grid td.fz2 { position: static; box-shadow: none; }
  .oi-grid th.fz1, .oi-grid th.fz2 { left: auto; box-shadow: none; z-index: 3; }

  /* 표 → 카드 목록 (ui.js 의 table / pagedTable 로 만든 표만. 직접 만든 표는 가로로 민다) */
  .table-wrap.tw-cards { overflow: visible; background: none; border: 0; border-radius: 0; }
  .tbl-cards, .tbl-cards tbody, .tbl-cards tfoot, .tbl-cards tr, .tbl-cards td { display: block; }
  .tbl-cards thead { display: none; }
  .tbl-cards tr { position: relative; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--sh); padding: 7px 0; margin-bottom: 8px; overflow: hidden; }
  .tbl-cards tr:last-child { margin-bottom: 0; }
  .tbl-cards td, .tbl-cards td.num { position: relative; border: 0; padding: 3px 12px 3px 104px; min-height: 25px; text-align: left; white-space: normal; overflow-wrap: anywhere; }
  .tbl-cards td[data-label]::before { content: attr(data-label); position: absolute; left: 12px; top: 3px; width: 84px; line-height: 19px; color: var(--muted); font-size: 12px; font-weight: 400; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  /* 숫자 열은 한 줄에 두 개씩 */
  .tbl-cards td.num { display: inline-block; width: 50%; vertical-align: top; padding-left: 86px; padding-right: 6px; }
  .tbl-cards td.num[data-label]::before { width: 70px; }
  .tbl-cards td.td-empty { display: none; }
  .tbl-cards td.td-act { padding-left: 12px; }
  .tbl-cards td.td-act:empty { display: none; }
  .tbl-cards td.td-title { font-weight: 650; font-size: 14px; }
  .tbl-cards td.td-title::before { top: 4px; }
  .tbl-cards td.empty-cell { padding: 16px 12px !important; text-align: center; }
  .tbl-cards td.ph-col { width: auto; }
  .tbl-cards td.cb-col { position: absolute; top: 4px; right: 6px; width: auto; min-height: 0; padding: 6px; z-index: 1; }
  .tbl-cards td.cb-col input { width: 20px; height: 20px; display: block; }
  .tbl-cards tr:has(> td.cb-col) > td.td-title { padding-right: 44px; }
  .tbl-cards td input:not([type=checkbox]):not([type=radio]), .tbl-cards td select { max-width: 100%; }
  .tbl-cards tr.clickable > td:not(.num) { padding-right: 30px; }
  .tbl-cards tr.clickable::after { content: "›"; position: absolute; right: 11px; top: 50%; transform: translateY(-50%); color: #a3adbb; font-size: 20px; line-height: 1; pointer-events: none; }
  .tbl-cards tr.clickable:active { background: #f5f8fe; }
  .tbl-cards tr.row-warn { background: #fffaf0; }
  .tbl-cards tr.row-overdue { background: #fff1f1; border-color: #f2a3a3; }
  .tbl-cards tr.row-checked { background: #f3f7ff; border-color: #b9cdf6; }
  .tbl-cards tr.row-sel { background: #e9f0ff; border-color: var(--brand); }
  .tbl-cards tr.row-sel td:first-child { box-shadow: none; }
  .tbl-cards tfoot tr { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 9px 12px; margin: 8px 0 0; background: #f7f9fb; }
  .tbl-cards tfoot td, .tbl-cards tfoot td.num { padding: 0; min-height: 0; border: 0; background: none; }
  /* 카드 안의 표: 카드를 겹치지 않고 구분선 목록으로 */
  .card-b > .tw-cards .tbl-cards tr { border: 0; border-bottom: 1px solid var(--line2); border-radius: 0; box-shadow: none; margin: 0; }
  .card-b > .tw-cards .tbl-cards tbody tr:last-child { border-bottom: 0; }
  .card-b > .tw-cards .tbl-cards tfoot tr { border-top: 1px solid var(--line); margin: 0; border-radius: 0 0 8px 8px; }

  /* 모달 → 아래에서 올라오는 시트 */
  .overlay { padding: 0; align-items: flex-end; overflow: hidden; }
  .modal, .modal-wide { width: 100%; max-height: 94vh; max-height: 94dvh; display: flex; flex-direction: column; border-radius: 16px 16px 0 0; animation: sheet .2s ease-out; }
  .modal-h { flex: none; padding: 12px 8px 12px 16px; }
  .modal-h h2 { font-size: 16px; min-width: 0; overflow-wrap: anywhere; }
  .modal-x { font-size: 26px; flex: none; }
  .modal-b { flex: 1; min-height: 0; max-height: none; padding: 12px 16px 16px; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
  .modal-f { flex: none; padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); border-radius: 0; }
  .modal-f:empty { padding: 0 0 env(safe-area-inset-bottom); border-top: 0; }
  .modal-f .btn { flex: 1; justify-content: center; min-height: 44px; }
  .lb-img { max-height: 58vh; }
}
@media (max-width: 360px) {
  .top-name { display: none; }
  .tbl-cards td { padding-left: 92px; }
  .tbl-cards td[data-label]::before { width: 74px; }
  .tbl-cards td.num { padding-left: 76px; }
  .tbl-cards td.num[data-label]::before { width: 60px; }
  .tbl-cards td.td-act { padding-left: 12px; }
}
@keyframes sheet { from { transform: translateY(24px); opacity: .6; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .modal { animation: none; } }

/* ───────────── 홈: 자금 흐름 (mf-*) ─────────────
   들어오는 돈 = 청록, 나가는 돈 = 파랑. 이미 오간 돈은 채움, 아직 남은 돈은 빗금 (색만으로 구분하지 않는다). */
.mf { position: relative; --mf-in: #1baf7a; --mf-out: #2a78d6; --mf-in-t: #dff4ec; --mf-out-t: #e1ecfa; }
.mf-curs { display: flex; gap: 4px; }
.mf-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-bottom: 12px; }
.mf-stat { display: block; border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; color: var(--text); background: #fff; }
.mf-stat:hover { border-color: #b9c8e6; text-decoration: none; }
.mf-stat-l { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 12px; }
.mf-stat-v { font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mf-stat-s { color: var(--muted); font-size: 11.5px; }
.mf-sw { display: inline-block; width: 12px; height: 12px; border-radius: 3px; flex: none; }
.mf-sw.in { background: var(--mf-in); } .mf-sw.out { background: var(--mf-out); }
.mf-sw.in.pend { background: repeating-linear-gradient(45deg, var(--mf-in) 0 2px, var(--mf-in-t) 2px 5px); outline: 1px solid var(--mf-in); outline-offset: -1px; }
.mf-sw.out.pend { background: repeating-linear-gradient(45deg, var(--mf-out) 0 2px, var(--mf-out-t) 2px 5px); outline: 1px solid var(--mf-out); outline-offset: -1px; }
.mf-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 12px; color: #4a5568; margin-bottom: 4px; }
.mf-key { display: inline-flex; align-items: center; gap: 5px; }
.mf-svg { display: block; width: 100%; height: auto; overflow: visible; }
.mf-fill.in, .mf-rib.in:not(.pend) { fill: var(--mf-in); } .mf-fill.out, .mf-rib.out:not(.pend) { fill: var(--mf-out); }
.mf-tint.in { fill: var(--mf-in-t); } .mf-tint.out { fill: var(--mf-out-t); }
.mf-rib { opacity: .62; transition: opacity .12s; }
.mf-rib.pend { opacity: .8; stroke-width: 1; stroke-dasharray: 4 3; }
.mf-rib.in.pend { stroke: var(--mf-in); } .mf-rib.out.pend { stroke: var(--mf-out); }
.mf-rib:hover { opacity: 1; }
.mf-dot { fill: #fff; stroke-width: 1.2; pointer-events: none; }
.mf-dot.in { stroke: #0e7a54; } .mf-dot.out { stroke: #1b57a3; }
.mf-node { fill: #5b6676; }
.mf-node.co { fill: var(--side); }
.mf-node.link, .mf-lbl.link { cursor: pointer; }
.mf-lbl.link:hover .mf-name { fill: var(--brand); text-decoration: underline; }
.mf-name { font-size: 12.5px; font-weight: 600; fill: var(--text); }
.mf-amt { font-size: 11px; fill: var(--muted); font-variant-numeric: tabular-nums; }
.mf-co { font-size: 13px; font-weight: 700; fill: var(--text); }
.mf-head { font-size: 11.5px; fill: var(--muted); font-weight: 600; }
.mf-grid { stroke: var(--line2); stroke-width: 1; } .mf-axis { stroke: var(--line); stroke-width: 1; }
.mf-hit { fill: transparent; }
.mf-hit:hover { fill: rgba(36, 86, 199, .05); }
.mf-notes { display: flex; flex-wrap: wrap; gap: 4px 18px; font-size: 12.5px; color: #4a5568; margin: 6px 0 2px; }
.mf-sub { font-weight: 650; margin: 14px 0 2px; padding-top: 10px; border-top: 1px solid var(--line2); }
.mf-months { max-height: 200px; }
.mf-table { margin-top: 10px; }
.mf-table summary { cursor: pointer; color: var(--brand); font-size: 12.5px; }
.mf-tip { position: absolute; z-index: 5; pointer-events: none; background: #1d2430; color: #fff; border-radius: 6px; padding: 6px 9px; font-size: 12px; line-height: 1.5; box-shadow: 0 6px 18px rgba(0, 0, 0, .2); max-width: 300px; white-space: nowrap; }
.mf-tip[hidden] { display: none; }
.mf-tip-t { font-weight: 700; }
@media (max-width: 900px) { .mf-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) { .mf-stat-v { font-size: 16px; } .mf .card-h { gap: 6px; } .mf-name { font-size: 11.5px; } .mf-amt { font-size: 10.5px; } }
@media (prefers-reduced-motion: reduce) { .mf-dots { display: none; } }
@media print { .mf-dots { display: none; } }
/* 자금 흐름: 회사에 남은 돈(비축) · 접기/펼치기 */
.mf { --mf-keep: #eda100; --mf-keep-t: #fdf3d9; }
.mf-top { display: grid; grid-template-columns: minmax(300px, 1.1fr) minmax(0, 2fr); gap: 10px; align-items: stretch; }
.mf-top .mf-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-bottom: 0; }
.mf-hero { display: flex; align-items: center; gap: 14px; border: 1px solid #f0d79a; background: linear-gradient(180deg, #fffdf6, #fff8e6); border-radius: 10px; padding: 12px 14px; flex-wrap: wrap; }
.mf-hero-b { flex: 1; min-width: 150px; }
.mf-hero-v { font-size: 26px; font-weight: 750; font-variant-numeric: tabular-nums; line-height: 1.2; white-space: nowrap; }
.mf-hero-v.neg { color: var(--danger); }
.mf-hero-x { display: flex; flex-wrap: wrap; gap: 2px 12px; font-size: 12px; margin-top: 4px; color: #4a5568; }
.mf-tank { width: 64px; height: 78px; flex: none; }
.mf-tank-bg { fill: var(--mf-keep-t); }
.mf-tank-rim { fill: none; stroke: #c98500; stroke-width: 1.5; }
.mf-tank-t { font-size: 14px; font-weight: 700; fill: var(--text); }
.mf-fill.keep { fill: var(--mf-keep); }
.mf-sw.keep { background: var(--mf-keep); }
.mf-spark-w { flex: 1 1 100%; }
.mf-spark { display: block; width: 100%; height: 70px; overflow: visible; }
.mf-spark-l { fill: none; stroke: #c98500; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.mf-spark-a { fill: var(--mf-keep); opacity: .16; }
.mf-spark-d { fill: var(--mf-keep); stroke: #fff; stroke-width: 2; }
.mf-bar { display: flex; justify-content: center; margin-top: 10px; }
.mf-more { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line2); }
.mf-more[hidden] { display: none; }
.mf-drop { stroke: var(--mf-keep); stroke-width: 3; stroke-dasharray: 2 5; stroke-linecap: round; fill: none; }
.mf-drop.off { stroke: #c9d0da; }
.mf-dot.keep { stroke: #a86f00; }
.mf-keep-v { font-size: 12.5px; font-weight: 700; fill: var(--text); font-variant-numeric: tabular-nums; }
@media (max-width: 900px) { .mf-top { grid-template-columns: 1fr; } }
@media (max-width: 640px) { .mf-hero-v { font-size: 22px; } }

/* ───────────── 출고 포장 작업 (pk-*) ───────────── */
.pk-bar { position: sticky; top: 48px; z-index: 12; background: var(--panel); border-bottom: 1px solid var(--line2); padding: 10px 14px; display: flex; flex-direction: column; gap: 8px; }
.pk-boxes-chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.pk-chip { display: inline-flex; align-items: center; gap: 5px; font-weight: 650; }
.pk-chip-n { font-size: 11px; color: var(--muted); font-weight: 500; }
.pk-chip.active .pk-chip-n { color: var(--brand-d); }
.pk-chip.sealed { opacity: .55; }
.pk-scanrow { display: flex; gap: 8px; align-items: center; }
.pk-mode { display: flex; gap: 4px; flex: none; }
.pk-mode .chip.out.active { background: #fde7e7; border-color: #f2b8b8; color: #a11d1d; }
.pk-x { color: var(--muted); }
.pk-qty { width: 64px; flex: none; text-align: center; }
.pk-form { flex: 1; min-width: 0; }
.pk-scan { font-size: 16px; padding: 9px 12px; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.pk-scan:focus { outline: 3px solid #b9cdf6; }
.pk-banner:empty { display: none; }
.pk-msg { display: flex; flex-wrap: wrap; gap: 2px 10px; align-items: baseline; border-radius: 6px; padding: 7px 10px; border: 1px solid; font-size: 13px; }
.pk-msg span { color: inherit; opacity: .8; font-size: 12px; }
.pk-msg.ok { background: #ebf7f0; border-color: #bfe3cd; color: #1d6b3d; }
.pk-msg.warn { background: #f3e9fb; border-color: #e3cff4; color: #5b2f8a; }
.pk-msg.out { background: #edf3fd; border-color: #c9d9f6; color: #1d3f86; }
.pk-msg.err { background: #fdf0f0; border-color: #f2c4c4; color: #8c1d1d; }
.pk-banner.flash .pk-msg { animation: pkflash .35s ease-out; }
@keyframes pkflash { from { transform: scale(1.02); } to { transform: none; } }
.pk-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px; padding: 12px 14px; align-items: start; }
.pk-sum { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.pk-carry { margin: 0 0 8px; }
.pk-order { border: 1px solid var(--line); border-radius: 8px; margin-bottom: 8px; overflow: hidden; }
.pk-order.carry { border-color: #f0d79a; }
.pk-order-h { display: flex; gap: 8px; align-items: center; padding: 6px 10px; background: #f7f9fb; border-bottom: 1px solid var(--line2); font-weight: 650; }
.pk-order.carry .pk-order-h { background: #fff8e6; }
.pk-line { display: flex; gap: 10px; align-items: center; padding: 7px 10px; border-bottom: 1px solid var(--line2); }
.pk-line:last-child { border-bottom: 0; }
.pk-line.done { opacity: .6; }
.pk-line-b { flex: 1; min-width: 0; }
.pk-line-n { display: flex; flex-wrap: wrap; gap: 2px 12px; margin-top: 2px; }
.pk-prog { height: 5px; background: #e8ecf1; border-radius: 3px; overflow: hidden; margin-top: 4px; }
.pk-prog > i { display: block; height: 100%; background: var(--ok); }
.pk-box { border: 1px solid var(--line); border-radius: 10px; margin-bottom: 10px; background: #fff; cursor: pointer; }
.pk-box.active { border-color: var(--brand); box-shadow: 0 0 0 2px #c9d9f8; cursor: default; }
.pk-box.sealed { background: #f7f8fa; cursor: default; }
.pk-box-h { display: flex; flex-wrap: wrap; gap: 6px 8px; align-items: center; padding: 8px 10px; border-bottom: 1px solid var(--line2); }
.pk-box-n { font-weight: 700; font-variant-numeric: tabular-nums; }
.pk-items { display: flex; flex-direction: column; }
.pk-item { display: flex; gap: 8px; align-items: center; padding: 6px 10px; border-bottom: 1px solid var(--line2); }
.pk-item:last-child { border-bottom: 0; }
.pk-item.extra { background: #f3fbf9; }
.pk-item-b { flex: 1; min-width: 0; }
.pk-item-b .badge { margin-left: 4px; }
.pk-item-q { font-size: 16px; font-variant-numeric: tabular-nums; min-width: 28px; text-align: right; }
.pk-empty { padding: 14px 10px; text-align: center; }
.cam-modal { width: min(560px, 100%); }
.cam-stage { position: relative; background: #000; aspect-ratio: 4 / 3; overflow: hidden; }
.cam-video { width: 100%; height: 100%; object-fit: cover; display: block; }
.cam-frame { position: absolute; left: 12%; right: 12%; top: 30%; bottom: 30%; border: 3px solid rgba(255, 255, 255, .9); border-radius: 10px; box-shadow: 0 0 0 999px rgba(0, 0, 0, .35); pointer-events: none; }
.cam-status { font-weight: 600; }
.cam-last { margin-top: 4px; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; color: var(--muted); }
@media (max-width: 1000px) { .pk-grid { grid-template-columns: 1fr; } .pk-right { order: -1; } }
@media (max-width: 900px) { .pk-bar { top: calc(52px + env(safe-area-inset-top)); } }
@media (max-width: 640px) {
  .pk-scanrow { flex-wrap: wrap; }
  .pk-form { flex: 1 1 100%; order: 3; }
  .pk-scanrow > .btn { order: 4; flex: 1; justify-content: center; }
  .pk-grid { padding: 10px; }
  .cam-modal { border-radius: 16px 16px 0 0; }
}

/* ───────────── 입고 품목 (ri-*) ───────────── */
.ri-photo { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.ri-tag { font-size: 10px; color: var(--muted); }
.ri-acts { display: flex; flex-wrap: wrap; gap: 4px; justify-content: flex-end; }
.tbl td.ph-col .ri-photo { align-items: flex-start; }
@media (max-width: 640px) { .ri-acts { justify-content: flex-start; } .tbl-cards td.ph-col { padding-left: 12px; } .tbl-cards td.ph-col::before { display: none; } }
.filter-bar .ri-q { width: auto; flex: 1 1 260px; }
@media (max-width: 640px) { .filter-bar .ri-q { grid-column: 1 / -1; } }
.pk-mark { font-size: 15px; letter-spacing: .3px; }

/* ───────────── 주문 수정·삭제 (od-*) ───────────── */
.od-hist { margin: 2px 0 8px; padding-left: 20px; }
.od-hist li { margin: 2px 0; font-weight: 600; color: #8a3b00; }
.od-why { color: #8a5a00; margin-top: 2px; }
.od-bulk-row { padding: 3px 0; border-bottom: 1px solid var(--line2); }
.od-ok { color: #1e7a3c; font-weight: 600; }
.od-warn { color: #8a5a00; }
.od-err { color: #b42318; }

/* ───────────── 관리자 삭제 (ad-*) ───────────── */
.ad-wrap { display: inline-flex; }
.tbl td.ad-col { width: 1%; white-space: nowrap; }
.ad-will { margin: 6px 0; padding: 6px 8px; background: #fff6e0; border: 1px solid #f1dca6; border-radius: 6px; font-size: 12.5px; }
.ad-block { margin: 2px 0 8px; padding-left: 20px; }
.ad-block li { margin: 2px 0; color: #8a3b00; }
.ad-bulk-row { padding: 3px 0; border-bottom: 1px solid var(--line2); }
.ad-ok { color: #1e7a3c; font-weight: 600; }
.ad-warn { color: #8a5a00; }
.ad-err { color: #b42318; }

/* 강제 삭제 미리보기 */
.ad-force { margin: 8px 0; max-height: 300px; overflow: auto; display: block; }
.ad-force td, .ad-force th { padding: 3px 8px; }
.ad-force tr.ad-ledger td { background: #fff1f1; }
