:root {
  --bg: #eef1f6; --bg-grad: radial-gradient(1200px 600px at 100% -10%, #e7eef9 0%, transparent 60%), radial-gradient(900px 500px at -10% 0%, #e9f3ef 0%, transparent 55%), #eef1f6;
  --panel: #fff; --line: #e4e9f0; --line2: #eef1f6; --text: #0f1b2d; --muted: #64748b;
  --brand: #0d6e5b; --brand-ink: #0a5345; --brand2: #e2f2ee; --in: #2563eb; --ref: #0b7a3e; --lock: #9aa5b1;
  --bad: #dc2626; --badbg: #fef2f3; --ok: #16a34a; --warnbg: #fff8e6; --head: #f7f9fc; --sel: #fff9db;
  --radius: 12px; --radius-sm: 8px;
  --shadow-sm: 0 1px 2px rgba(16,24,40,.05), 0 1px 3px rgba(16,24,40,.07);
  --shadow: 0 6px 20px rgba(16,24,40,.08);
  --shadow-lg: 0 18px 50px rgba(16,24,40,.18);
  font-family: "Pretendard", "Pretendard Variable", "Malgun Gothic", "Apple SD Gothic Neo", system-ui, -apple-system, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font-size: 13px; -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
body { background: var(--bg-grad); background-attachment: fixed; }

/* scrollbars */
* { scrollbar-width: thin; scrollbar-color: #c4cdd9 transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: #c7d0dc; border-radius: 8px; border: 2px solid transparent; background-clip: content-box; }
*::-webkit-scrollbar-thumb:hover { background: #a9b5c5; background-clip: content-box; }
*::-webkit-scrollbar-track { background: transparent; }

button { font: inherit; font-weight: 500; cursor: pointer; border: 1px solid var(--line); background: #fff; border-radius: var(--radius-sm); padding: 7px 14px; color: var(--text);
  transition: background .15s, border-color .15s, box-shadow .15s, transform .06s; box-shadow: var(--shadow-sm); }
button:hover { border-color: #c4ccd6; background: #fbfcfe; }
button:active { transform: translateY(1px); }
button.primary { background: var(--brand); color: #fff; border-color: var(--brand); box-shadow: 0 2px 8px rgba(13,110,91,.28); }
button.primary:hover { background: var(--brand-ink); border-color: var(--brand-ink); }
button.danger { color: var(--bad); border-color: #f1c7c7; }
button.danger:hover { background: var(--badbg); }
button:disabled { opacity: .45; cursor: default; box-shadow: none; transform: none; }
input, select, textarea { font: inherit; color: var(--text); }
:focus-visible { outline: 2px solid color-mix(in srgb, var(--brand) 55%, #fff); outline-offset: 2px; }
.hidden { display: none !important; }

/* login */
#login { display: grid; place-items: center; height: 100%; padding: 20px; background: var(--bg-grad); }
#login form { background: rgba(255,255,255,.92); backdrop-filter: blur(6px); padding: 36px 32px; border-radius: 18px; width: min(380px, calc(100vw - 32px));
  box-shadow: var(--shadow-lg); border: 1px solid rgba(255,255,255,.6); }
#login h1 { font-size: 22px; margin: 0 0 4px; color: var(--brand); letter-spacing: -.02em; font-weight: 800; }
#login p { margin: 0 0 24px; color: var(--muted); }
#login input { width: 100%; padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; margin-bottom: 12px; background: #fff; transition: border-color .15s, box-shadow .15s; }
#login input:focus { outline: 0; border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 18%, transparent); }
#login button { width: 100%; padding: 12px; margin-top: 4px; font-weight: 600; }
#login .err { color: var(--bad); min-height: 18px; font-size: 12px; }

/* shell */
#app { display: grid; grid-template-columns: calc(224px * var(--nav-zoom, 1)) 1fr; grid-template-rows: 52px 1fr; height: 100%; }
header { grid-column: 1 / 3; display: flex; align-items: center; gap: 12px; padding: 0 16px; color: #fff;
  background: linear-gradient(100deg, var(--brand-ink), var(--brand) 60%, #12846d); box-shadow: 0 2px 14px rgba(10,83,69,.28); z-index: 10; }
header .title { font-weight: 800; font-size: 15px; letter-spacing: -.01em; white-space: nowrap; }
header select { padding: 6px 10px; border-radius: 8px; border: 1px solid rgba(255,255,255,.22); background: rgba(255,255,255,.14); color: #fff; }
header select option { color: #111; }
header .sp { flex: 1; }
header .conn { width: 9px; height: 9px; border-radius: 50%; background: #f59e0b; box-shadow: 0 0 0 3px rgba(245,158,11,.25); transition: background .2s, box-shadow .2s; }
header .conn.on { background: #4ade80; box-shadow: 0 0 0 3px rgba(74,222,128,.3); }
header .me { white-space: nowrap; font-size: 12.5px; }
header button { background: rgba(255,255,255,.14); color: #fff; border-color: rgba(255,255,255,.22); padding: 6px 12px; box-shadow: none; }
header button:hover { background: rgba(255,255,255,.24); border-color: rgba(255,255,255,.35); }
#menuBtn { display: inline-block; font-size: 16px; }
.presence { display: flex; padding-left: 6px; }
.avatar { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-size: 11px; font-weight: 700; color: #fff; border: 2px solid rgba(255,255,255,.85); margin-left: -6px; box-shadow: 0 1px 4px rgba(0,0,0,.2); transition: transform .12s; }
.avatar:hover { transform: translateY(-1px) scale(1.08); z-index: 1; }
.season-closed { background: #fde68a; color: #7c5800; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; }

nav { zoom: var(--nav-zoom, 1); background: rgba(255,255,255,.72); backdrop-filter: blur(8px); border-right: 1px solid var(--line); overflow: auto; padding: 10px 10px 28px; }
nav .grp { padding: 14px 10px 6px; color: var(--muted); font-size: 10.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
nav a { display: flex; align-items: center; padding: 8px 12px; margin: 1px 0; color: #334155; text-decoration: none; border-radius: 9px; transition: background .13s, color .13s; }
nav a:hover { background: #eef2f7; color: var(--text); }
nav a.active { background: var(--brand2); color: var(--brand-ink); font-weight: 700; box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--brand) 18%, transparent); }
nav a .who { margin-left: auto; font-size: 10px; color: var(--muted); font-weight: 500; }

main { zoom: var(--main-zoom, 1); overflow: auto; padding: 18px 20px 48px; min-width: 0; }
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 14px; }
.toolbar h2 { font-size: 18px; margin: 0 8px 0 0; letter-spacing: -.02em; font-weight: 700; }
.toolbar .muted, .muted { color: var(--muted); }
.toolbar input[type=search] { padding: 7px 12px; border: 1px solid var(--line); border-radius: 9px; width: 210px; background: #fff; transition: border-color .15s, box-shadow .15s; }
.toolbar input[type=search]:focus { outline: 0; border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 15%, transparent); }
.legend span { display: inline-flex; align-items: center; gap: 5px; margin-right: 10px; font-size: 12px; color: var(--muted); }
.legend i.lockswatch { background: repeating-linear-gradient(45deg, #fff 0 2px, #c3ccd6 2px 4px); border: 1px solid #c3ccd6; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }

/* grid */
.gridwrap { overflow: auto; max-height: calc(100vh / var(--main-zoom, 1) - 160px); background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
table.grid { border-collapse: separate; border-spacing: 0; width: 100%; table-layout: fixed; }
.grid th, .grid td { border-right: 1px solid var(--line2); border-bottom: 1px solid var(--line2); padding: 0; height: 30px; white-space: normal; word-break: keep-all; overflow-wrap: anywhere; }
.grid thead th { position: sticky; top: 0; z-index: 2; background: var(--head); font-weight: 600; font-size: 11px; padding: 4px 5px; white-space: normal; min-width: 0; line-height: 1.2; vertical-align: middle; border-bottom: 1.5px solid var(--line); color: #475569; }
.grid thead th.in { color: var(--in); }
.grid thead th.ref { color: var(--ref); }
.grid td.rn, .grid th.rn { position: sticky; left: 0; z-index: 1; background: var(--head); color: var(--muted); font-size: 11px; text-align: center; width: 34px; }
.grid thead th.rn { z-index: 3; }
.grid td .v { padding: 0 5px; display: block; line-height: 1.25; }
.grid td.num .v { text-align: right; font-variant-numeric: tabular-nums; }
.grid td.ref .v { color: var(--ref); }
.grid td input { width: 100%; min-width: 0; height: 30px; border: 0; padding: 0 4px; background: transparent; color: var(--in); outline: none; font-variant-numeric: tabular-nums; box-sizing: border-box; }
.grid td.num input { text-align: right; }
.grid td input:focus { background: var(--sel); box-shadow: inset 0 0 0 2px var(--in); border-radius: 4px; }
.grid td input:disabled { color: var(--text); -webkit-text-fill-color: var(--text); opacity: 1; background: repeating-linear-gradient(45deg, transparent 0 6px, #f5f7fa 6px 12px); }
.grid td.bad { background: var(--badbg); }
.grid td.bad .v { color: var(--bad); font-weight: 600; }
.grid td.good .v { color: var(--ok); }
.grid td.err .v { color: #b45309; }
.grid td.saving input { background: #eaf3ff; }
.grid td.flash { animation: flash 1.2s ease-out; }
@keyframes flash { from { background: #fff1b8; } to { background: transparent; } }
/* 엑셀식 범위 선택(드래그·Shift+클릭) → Ctrl+C 로 복사 */
.grid td.sel { background: color-mix(in srgb, var(--in) 15%, transparent); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--in) 45%, transparent); }
.grid td.sel input { background: transparent; }

/* 강진·서천·백사: 탭으로 컬럼을 나눠서 화면 폭에 맞춤 */
table.grid.grid-wide { width: 100%; min-width: 0; table-layout: fixed; }
.grid-wide th, .grid-wide td { white-space: normal; word-break: keep-all; overflow-wrap: anywhere; }
.grid-wide thead th { min-width: 0; padding: 5px 4px; font-size: 11px; vertical-align: middle; text-align: center; }
.grid-wide td.rn, .grid-wide th.rn { width: 40px; }
.grid-wide td .v { padding: 0 4px; line-height: 30px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.grid-wide td input { min-width: 0; padding: 0 3px; font-size: 12px; text-overflow: ellipsis; }

.grid td.other { position: relative; box-shadow: inset 0 0 0 2px var(--oc, #e8590c); background: color-mix(in srgb, var(--oc, #e8590c) 10%, transparent) !important; }
.grid td.other::after { content: attr(data-who); position: absolute; top: -9px; left: 2px; font-size: 9px; font-weight: 700; line-height: 1.5; background: var(--oc, #e8590c); color: #fff; padding: 0 6px; border-radius: 999px; z-index: 5; white-space: nowrap; pointer-events: none; box-shadow: 0 1px 3px rgba(0,0,0,.25); }
.grid tbody tr:nth-child(even) td { background-color: #fcfdfe; }
.grid tr:hover td { background-color: color-mix(in srgb, var(--brand) 5%, transparent); }
.grid a.rh { color: var(--muted); cursor: pointer; text-decoration: none; }
.grid a.rh:hover { color: var(--in); text-decoration: underline; }
.grid .del { border: 0; background: none; color: #c0c7d0; padding: 0 4px; font-size: 14px; box-shadow: none; }
.grid .del:hover { color: var(--bad); background: none; }
.grid tfoot { position: sticky; bottom: 0; z-index: 2; }   /* 합계·종류별 소계를 한 덩어리로 아래에 고정 */
.grid tfoot td { background: #f2f5f9; font-weight: 700; border-top: 1.5px solid var(--line); }
.grid tfoot tr.kindsum td { background: #fff; font-weight: 500; height: 24px; border-top: 0; }
.grid tfoot tr.kindsum td.lsl { padding: 0 8px; text-align: left; white-space: nowrap; color: var(--brand-ink); font-weight: 700; }
.grid tfoot td .v { padding: 0 2px; font-size: 11px; letter-spacing: -.02em; }

/* report */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(176px, 1fr)); gap: 12px; margin-bottom: 16px; }
.card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow-sm); transition: box-shadow .15s, transform .15s; }
.card:hover { box-shadow: var(--shadow); transform: translateY(-1px); }
.card .k { color: var(--muted); font-size: 12px; font-weight: 500; }
.card .n { font-size: 22px; font-weight: 800; margin-top: 5px; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.card .s { color: var(--muted); font-size: 11px; margin-top: 3px; }
.section { margin: 22px 0 10px; font-weight: 700; font-size: 15px; letter-spacing: -.01em; }
table.rep { border-collapse: collapse; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; width: 100%; box-shadow: var(--shadow-sm); }
.rep th, .rep td { padding: 8px 12px; border-bottom: 1px solid var(--line2); text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.rep th { background: var(--head); font-size: 12px; text-align: center; color: #475569; font-weight: 600; }
.rep td.l, .rep th.l { text-align: left; }
.rep tbody tr:hover td { background: #f8fafc; }
.rep tr.tot td { font-weight: 700; background: #f4f7fa; }
.repwrap { overflow: auto; border-radius: var(--radius); }
.note { color: var(--muted); margin: 6px 0; line-height: 1.5; }
.chartbox { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; height: 340px; margin-bottom: 16px; box-shadow: var(--shadow-sm); }

/* admin */
.panel { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin-bottom: 16px; box-shadow: var(--shadow-sm); }
.panel h3 { margin: 0 0 12px; font-size: 15px; font-weight: 700; letter-spacing: -.01em; }
.form-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 10px; }
.form-row input[type=text], .form-row input[type=password], .form-row select { padding: 8px 10px; border: 1px solid var(--line); border-radius: 9px; background: #fff; transition: border-color .15s, box-shadow .15s; }
.form-row input:focus, .form-row select:focus { outline: 0; border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 14%, transparent); }
.chips label { display: inline-flex; gap: 5px; align-items: center; margin-right: 8px; padding: 5px 10px; border: 1px solid var(--line); border-radius: 999px; background: #fff; cursor: pointer; transition: background .13s, border-color .13s; }
.chips label:hover { background: #f5f8fb; border-color: #cdd6e0; }
.chips label:has(input:checked) { background: var(--brand2); border-color: color-mix(in srgb, var(--brand) 35%, #fff); color: var(--brand-ink); font-weight: 600; }
.chips b { align-self: center; margin-right: 4px; }
textarea.json { width: 100%; height: 360px; font-family: "JetBrains Mono", Consolas, monospace; font-size: 12px; border: 1px solid var(--line); border-radius: 10px; padding: 12px; background: #fbfcfe; line-height: 1.5; }
textarea.json:focus { outline: 0; border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 14%, transparent); }
details > summary { list-style: none; }
details > summary::-webkit-details-marker { display: none; }
details > summary::before { content: "▸"; display: inline-block; margin-right: 6px; color: var(--muted); transition: transform .15s; }
details[open] > summary::before { transform: rotate(90deg); }

/* manual */
.manual { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 24px; max-width: 1100px; box-shadow: var(--shadow-sm); }
.manual .row { display: grid; grid-template-columns: 200px 1fr; gap: 14px; padding: 8px 0; border-bottom: 1px solid var(--line2); white-space: pre-wrap; }
.manual a.slink { color: var(--in); font-weight: 600; text-decoration: none; border-bottom: 1px dashed currentColor; }
.manual a.slink:hover { background: #eef4ff; border-bottom-style: solid; }
.manual .row.h { font-weight: 800; color: var(--brand); font-size: 15px; grid-template-columns: 1fr; border: 0; padding-top: 16px; letter-spacing: -.01em; }

/* toast / modal */
#toast { position: fixed; right: 18px; bottom: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 50; }
#toast div { background: #0f1b2d; color: #fff; padding: 11px 15px; border-radius: 10px; font-size: 12.5px; max-width: 360px; box-shadow: var(--shadow-lg); animation: toastIn .22s cubic-bezier(.2,.8,.2,1); }
#toast div.err { background: var(--bad); }
@keyframes toastIn { from { opacity: 0; transform: translateY(10px) scale(.98); } to { opacity: 1; transform: none; } }
#modal { position: fixed; inset: 0; background: rgba(15,27,45,.42); backdrop-filter: blur(3px); display: grid; place-items: center; z-index: 60; animation: fade .18s ease; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
#modal .box { background: #fff; border-radius: 16px; padding: 22px; width: min(600px, calc(100vw - 32px)); max-height: 82vh; overflow: auto; box-shadow: var(--shadow-lg); animation: pop .2s cubic-bezier(.2,.8,.2,1); }
@keyframes pop { from { opacity: 0; transform: translateY(12px) scale(.98); } to { opacity: 1; transform: none; } }
#modal .box h3 { margin: 0 0 12px; font-size: 17px; font-weight: 700; letter-spacing: -.01em; }
#modal .act { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }

/* 글씨 크기 슬라이더 */
.fontrow { display: grid; grid-template-columns: 44px 1fr 72px; gap: 12px; align-items: center; margin-bottom: 14px; }
.fontrow input[type=range] { width: 100%; accent-color: var(--brand); cursor: pointer; }
.fontrow output { color: var(--muted); font-size: 12px; text-align: right; }

/* 데스크톱: 사이드바 접기(☰) — 접으면 본문이 전체 폭을 쓴다 */
@media (min-width: 801px) {
  body.nav-closed #app { grid-template-columns: 1fr; }
  body.nav-closed nav { display: none; }
  body.nav-closed main { grid-column: 1 / -1; }   /* nav가 빠져도 본문이 첫(0폭) 칸으로 밀리지 않게 전체 폭 사용 */
}

@media (max-width: 800px) {
  #app { grid-template-columns: 1fr; }
  nav { position: fixed; top: calc(52px / var(--nav-zoom, 1)); bottom: 0; left: 0; width: 248px; z-index: 20; transform: translateX(-100%); transition: transform .22s cubic-bezier(.2,.8,.2,1); box-shadow: 2px 0 24px rgba(0,0,0,.14); background: #fff; }
  nav.open { transform: none; }
  #menuBtn { display: inline-block; }
  header .title { font-size: 13px; }
  header { gap: 8px; padding: 0 12px; }
  header .me, #pwBtn, #seasonState { display: none; }
  header select { max-width: 120px; }
  main { padding: 14px 16px 40px; }
  .gridwrap { max-height: calc(100vh / var(--main-zoom, 1) - 200px); }
}

.subtabs{display:flex;gap:4px;margin-bottom:8px}
.subtabs button{padding:6px 18px;border:1px solid var(--line);background:transparent;border-radius:6px 6px 0 0;cursor:pointer;font-weight:600}
.subtabs button.active{background:var(--brand);color:#fff;border-color:var(--brand)}

/* 물김매입 탭: 같은 Lot 행 묶음 */
.grid-wide td.rn, .grid-wide th.rn { width: 52px; padding: 0 2px; white-space: nowrap; }
.grid tr.lot-first td { border-top: 2px solid #cfd8e3; }
.grid tr.lot-cont td[data-key="lot"] input { color: var(--text); -webkit-text-fill-color: var(--text); }
/* 물김매입 탭: 같은 Lot의 Lot No.·마른김종류 칸을 병합한 것처럼 보이게 (경계선·반복 글자 숨김) */
.grid tr.lot-mid td[data-key="lot"], .grid tr.lot-mid td[data-key="kind"] { border-bottom-color: transparent; }
.grid tr.lot-first td[data-key="lot"] input, .grid tr.lot-first td[data-key="kind"] input { text-align: center; }
.grid tr.lot-cont td[data-key="lot"], .grid tr.lot-cont td[data-key="kind"] { background: #fff; }
/* 병합 칸 안에서 세로 중앙 정렬: 첫 행의 입력칸을 Lot 행 수(--n)만큼 아래로 늘려 덮는다 */
.grid tr.lot-first[style*="--n"] td[data-key="lot"], .grid tr.lot-first[style*="--n"] td[data-key="kind"] { position: relative; }
.grid tr.lot-first[style*="--n"] td[data-key="lot"] input, .grid tr.lot-first[style*="--n"] td[data-key="kind"] input { position: absolute; top: 0; left: 0; width: 100%; height: calc(var(--n) * 100%); z-index: 1; }
.grid tr.lot-cont td[data-key="lot"] input, .grid tr.lot-cont td[data-key="kind"] input { background: transparent; color: transparent; -webkit-text-fill-color: transparent; }
.grid tr.lot-cont td[data-key="lot"] input:focus, .grid tr.lot-cont td[data-key="kind"] input:focus { color: var(--text); -webkit-text-fill-color: var(--text); }
.grid tr.lot-cont td.rn { background: #f1f4f8; }
.grid td.lotkind input { color: var(--text); -webkit-text-fill-color: var(--text); font-style: italic; }
.lotn { display: inline-block; margin-left: 3px; padding: 0 5px; border-radius: 999px; background: var(--brand2); color: var(--brand-ink); font-size: 10px; font-weight: 700; }
.grid .addsub { border: 0; background: none; color: var(--brand); padding: 0 3px; font-size: 13px; font-weight: 700; box-shadow: none; }
.grid .addsub:hover { background: var(--brand2); }

/* 생산 탭: 같은 장비의 속수 줄 — Lot·장비·생산일 칸을 병합한 것처럼 보이게 */
.grid tr.eq-mid td.eqm { border-bottom-color: transparent; }
.grid tr.eq-first td.eqm { position: relative; }
.grid tr.eq-first td.eqm > input { position: absolute; top: 0; left: 0; width: 100%; height: calc(var(--n) * 100%); z-index: 1; }
.grid tr.eq-cont td.eqm { background: transparent; }

/* 위치: 생산자마스터 참조값은 초록, 직접 입력값은 기본(파랑) */
.grid td.refin input { color: var(--ref); }

/* 날짜 칸: 표시는 YY/MM/DD, 달력 버튼으로 선택 */
.grid td:has(> input[data-date]) { position: relative; }
.grid td .dcal { position: absolute; right: 1px; top: 50%; transform: translateY(-50%); padding: 0 2px; border: 0; background: var(--panel, #fff); font-size: 11px; line-height: 1; opacity: 0; box-shadow: none; cursor: pointer; }
.grid td:hover .dcal, .grid td:focus-within .dcal { opacity: .75; }
.grid td .dcal:hover { opacity: 1; background: var(--brand2); }
.grid td input.dpick { position: absolute; right: 0; bottom: 0; width: 1px; height: 1px; opacity: 0; pointer-events: none; border: 0; padding: 0; min-width: 0; }

/* 품질관리: 생산에 없는 Lot 번호 */
.grid td.orphan input { background: var(--badbg); color: var(--bad); -webkit-text-fill-color: var(--bad); font-weight: 700; }

/* Lot 호버 팝업 */
#lotTip { position: fixed; z-index: 70; background: #fff; border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 8px 24px rgba(15,27,45,.18); padding: 9px 11px; font-size: 12px; pointer-events: none; max-width: 480px; }
#lotTip .tt { font-weight: 700; margin-bottom: 6px; color: var(--brand-ink); }
#lotTip .tt span { margin-left: 4px; padding: 0 6px; border-radius: 999px; background: var(--brand2); font-size: 10px; }
#lotTip table { border-collapse: collapse; }
#lotTip th, #lotTip td { padding: 2px 8px; text-align: right; white-space: nowrap; border-bottom: 1px solid var(--line2); }
#lotTip th { color: var(--muted); font-weight: 600; }
#lotTip .l { text-align: left; }
#lotTip tfoot td { font-weight: 700; border-bottom: 0; border-top: 1.5px solid var(--line); }
/* 생산 탭 Lot 칸이 비활성 입력이어도 호버가 칸에 전달되도록 */
.grid td[data-key="lot"] input:disabled { pointer-events: none; }

/* 열 너비 조절 손잡이 (머리글 오른쪽 경계) */
.grid thead th .colgrip { position: absolute; top: 0; right: 0; bottom: 0; width: 7px; cursor: col-resize; touch-action: none; user-select: none; }
.grid thead th .colgrip:hover, .grid thead th .colgrip.active { background: color-mix(in srgb, var(--in) 45%, transparent); }
.grid.sized td { overflow-x: clip; }

/* Lot별 합계 행 */
.grid tr.lotsum td { background: #eef4f2 !important; font-weight: 700; height: 26px; border-bottom: 1.5px solid #cfd8e3; }
.grid tr.lotsum td.lsl { padding: 0 8px; color: var(--brand-ink); text-align: left; white-space: nowrap; }
.grid tr.lotsum .v { padding: 0 4px; line-height: 26px; }
.grid tr.lotsum:hover td { background: #eef4f2 !important; }
.grid tr.lotsum td.unit { color: var(--brand-ink); text-align: left; white-space: nowrap; }
