/* F&S 운영 앱 — 스테인리스 회녹색 바탕, 짙은 청록 동작, 인주 빨강은 승인 도장과 차단에만 쓴다. */
:root {
  --steel: #e6ebe9;        /* 바탕: 공장 스테인리스 */
  --panel: #ffffff;
  --ink: #18231f;          /* 글자: 짙은 녹흑 */
  --ink-2: #4d5c56;
  --line: #cfd8d4;
  --line-2: #e3e9e6;
  --teal: #1d5c57;         /* 주 동작 */
  --teal-2: #e2efed;
  --seal: #c3352b;         /* 인주: 승인 도장·차단 */
  --amber: #a86d12;        /* 대기·주의 */
  --amber-2: #fbf1dc;
  --green: #2d7148;
  --green-2: #e1f0e6;
  --stop-2: #f8e3e1;
  --off: #8a9792;
  --radius: 6px;
  --touch: 48px;
  --font: "Pretendard", "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans KR", system-ui, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --steel: #141b18; --panel: #1c2521; --ink: #e8efec; --ink-2: #a8b6b0; --line: #34413b; --line-2: #26302c;
    --teal: #5fb3a9; --teal-2: #1f3532; --seal: #ef6a5e; --amber: #e0a94a; --amber-2: #3a2f1b;
    --green: #6cc08c; --green-2: #1d3326; --stop-2: #3d2220; --off: #7d8b85;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--steel); color: var(--ink); font: 15px/1.55 var(--font);
  font-variant-numeric: tabular-nums; }
a { color: var(--teal); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--teal) 55%, transparent); outline-offset: 2px; }
h1 { font-size: 1.45rem; line-height: 1.25; margin: 0 0 .25rem; letter-spacing: -.01em; }
h2 { font-size: 1.1rem; margin: 1.6rem 0 .6rem; }
h3 { font-size: 1rem; margin: 1.2rem 0 .4rem; }
p { margin: .35rem 0 .8rem; max-width: 72ch; }
small, .muted { color: var(--ink-2); }

/* 틀 */
.shell { display: grid; grid-template-columns: 228px 1fr; min-height: 100vh; }
.rail { background: var(--panel); border-right: 1px solid var(--line); padding: 14px 10px 40px; position: sticky; top: 0;
  height: 100vh; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 14px; font-weight: 700; color: var(--ink); }
.brand-mark { width: 30px; height: 30px; border-radius: 50%; border: 2.5px solid var(--seal); color: var(--seal);
  display: grid; place-items: center; font-size: 12px; font-weight: 800; transform: rotate(-8deg); }
.rail-group { margin: 10px 0 2px; padding: 0 8px; font-size: 12px; color: var(--ink-2); }
.rail a { display: block; padding: 7px 10px; border-radius: var(--radius); color: var(--ink); font-size: 14px; }
.rail a:hover { background: var(--teal-2); text-decoration: none; }
.rail a.on { background: var(--teal); color: #fff; }
.main { min-width: 0; }
.top { display: flex; align-items: center; gap: 12px; padding: 10px 24px; border-bottom: 1px solid var(--line);
  background: var(--panel); position: sticky; top: 0; z-index: 5; }
.top .grow { flex: 1; }
.who { font-size: 13px; color: var(--ink-2); }
.bell { position: relative; font-weight: 600; }
.bell b { background: var(--seal); color: #fff; border-radius: 10px; padding: 0 6px; font-size: 12px; margin-left: 4px; }
.page { padding: 20px 24px 80px; max-width: 1280px; }
.page-head { display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 14px; }
.page-head .grow { flex: 1; min-width: 220px; }
.crumb { font-size: 13px; color: var(--ink-2); margin-bottom: 4px; }

/* 판 */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 16px 18px; margin-bottom: 16px; }
.panel > h2:first-child, .panel > h3:first-child { margin-top: 0; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 4px 16px; margin: 0; }
.facts dt { color: var(--ink-2); }
.facts dd { margin: 0; }

/* 버튼·입력 */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 38px; padding: 0 14px;
  border-radius: var(--radius); border: 1px solid var(--line); background: var(--panel); color: var(--ink);
  font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { border-color: var(--teal); text-decoration: none; }
.btn.go { background: var(--teal); border-color: var(--teal); color: #fff; }
.btn.go:hover { filter: brightness(1.08); }
.btn.stop { color: var(--seal); border-color: color-mix(in srgb, var(--seal) 45%, var(--line)); }
.btn.quiet { border-color: transparent; background: transparent; color: var(--teal); }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.btn.big { min-height: var(--touch); font-size: 16px; padding: 0 20px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
label { font-size: 13px; color: var(--ink-2); display: block; margin-bottom: 3px; }
input, select, textarea { font: inherit; color: var(--ink); background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 7px 10px; min-height: 38px; width: 100%; }
textarea { min-height: 76px; }
input[type=checkbox], input[type=radio] { width: auto; min-height: 0; accent-color: var(--teal); }
.fields { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px 16px; }
.field.wide { grid-column: 1 / -1; }
.field .help { font-size: 12px; color: var(--ink-2); margin-top: 3px; }
.check { display: flex; align-items: center; gap: 8px; color: var(--ink); font-size: 15px; }
.req::after { content: " *"; color: var(--seal); }
.inline-form { display: inline; }

/* 표 */
.table-tools { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 8px; }
.table-tools input[type=search] { max-width: 280px; }
.table-wrap { overflow-x: auto; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; }
table { border-collapse: collapse; width: 100%; font-size: 14px; }
th, td { padding: 8px 10px; border-bottom: 1px solid var(--line-2); text-align: left; vertical-align: top; }
th { font-weight: 600; color: var(--ink-2); background: color-mix(in srgb, var(--steel) 45%, var(--panel)); white-space: nowrap; }
th a { color: inherit; }
tr:last-child td { border-bottom: 0; }
td.n, th.n { text-align: right; white-space: nowrap; }
tr.filter-row th { background: var(--panel); padding: 4px 6px; }
tr.filter-row input { min-height: 30px; padding: 3px 6px; font-size: 13px; }
tr.sub td { background: color-mix(in srgb, var(--steel) 25%, var(--panel)); font-size: 13px; }
tr.sub td:first-child { padding-left: 28px; }
.empty { padding: 28px; text-align: center; color: var(--ink-2); }
.pager { display: flex; gap: 6px; margin-top: 8px; align-items: center; font-size: 13px; }

/* 상태 */
.badge { display: inline-block; padding: 1px 8px; border-radius: 4px; font-size: 12.5px; font-weight: 600; white-space: nowrap;
  border: 1px solid transparent; }
.badge.wait { background: var(--amber-2); color: var(--amber); }
.badge.go { background: var(--teal-2); color: var(--teal); }
.badge.run { background: var(--teal); color: #fff; }
.badge.done { background: var(--green-2); color: var(--green); }
.badge.stop { background: var(--stop-2); color: var(--seal); }
.badge.off { background: transparent; color: var(--off); border-color: var(--line); }

/* 도장: 이 앱에서 한 번 쓰는 강한 표현 — 네 팀 승인 */
.seals { display: flex; gap: 6px; flex-wrap: wrap; }
.seal { width: 50px; height: 50px; border-radius: 50%; display: grid; place-items: center; text-align: center;
  font-size: 11px; line-height: 1.05; font-weight: 800; border: 2px dashed var(--line); color: var(--off); }
.seal.ok { border: 2.5px solid var(--seal); color: var(--seal); transform: rotate(-9deg);
  box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--seal) 18%, transparent); }
.seal.hold { border: 2px solid var(--amber); color: var(--amber); }
.seal small { display: block; font-weight: 500; font-size: 9.5px; color: inherit; }
@media (prefers-reduced-motion: no-preference) {
  .seal.ok.fresh { animation: stamp .28s ease-out; }
  @keyframes stamp { from { transform: rotate(-9deg) scale(1.5); opacity: 0; } to { transform: rotate(-9deg) scale(1); opacity: 1; } }
}

/* 라벨 모양 코드(LOT·QR·칸) */
.code { font-weight: 700; letter-spacing: .02em; border: 1.5px solid var(--ink); border-radius: 3px; padding: 0 5px;
  background: var(--panel); white-space: nowrap; font-size: 13px; }

/* 알림·메시지 */
.flash { padding: 10px 14px; border-radius: var(--radius); margin-bottom: 12px; border: 1px solid var(--line); background: var(--panel); }
.flash.error { border-color: color-mix(in srgb, var(--seal) 45%, var(--line)); background: var(--stop-2); color: var(--ink); }
.flash.ok { border-color: color-mix(in srgb, var(--green) 45%, var(--line)); background: var(--green-2); }
.notice { border-left: 4px solid var(--amber); background: var(--amber-2); padding: 10px 14px; border-radius: 4px; margin: 10px 0; }
.block { border-left: 4px solid var(--seal); background: var(--stop-2); padding: 10px 14px; border-radius: 4px; margin: 10px 0; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; margin-bottom: 18px; }
.tile { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; color: var(--ink); display: block; }
.tile:hover { border-color: var(--teal); text-decoration: none; }
.tile b { display: block; font-size: 1.7rem; line-height: 1.1; }
.tile.hot b { color: var(--seal); }

/* 스캔 */
.scan-box { display: flex; gap: 8px; }
.scan-box input { font-size: 18px; min-height: var(--touch); font-weight: 700; letter-spacing: .03em; text-transform: uppercase; }
.scan-video { width: 100%; max-width: 420px; border-radius: 10px; background: #000; display: none; margin-top: 8px; }

/* 칸 배치판 */
.board { display: grid; gap: 6px; overflow-x: auto; padding-bottom: 4px; }
.cell { border: 1.5px solid var(--line); border-radius: 6px; padding: 6px 7px; background: var(--panel); min-height: 64px; font-size: 12px; color: var(--ink); }
.cell b { display: block; font-size: 13px; }
.cell.used { border-color: var(--teal); background: var(--teal-2); }
.cell.warn { border-color: var(--seal); }

/* 휴대폰 */
.bottom-bar { display: none; }
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .rail { position: fixed; inset: 0 25% 0 0; z-index: 30; transform: translateX(-105%); transition: transform .18s; height: 100vh; }
  .rail.open { transform: none; box-shadow: 0 0 0 100vmax rgba(0,0,0,.25); }
  .top { padding: 8px 14px; }
  .page { padding: 14px 14px 96px; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .btn { min-height: 44px; }
  input, select { min-height: 44px; }
  .bottom-bar { display: grid; grid-template-columns: repeat(4, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
    background: var(--panel); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
  .bottom-bar a, .bottom-bar button { min-height: 58px; display: grid; place-items: center; font-size: 13px; font-weight: 600;
    color: var(--ink); background: none; border: 0; font-family: inherit; }
  .hide-sm { display: none; }
  table.cards thead { display: none; }
  table.cards tr { display: block; border-bottom: 1px solid var(--line); padding: 8px 4px; }
  table.cards td { display: flex; justify-content: space-between; gap: 10px; border: 0; padding: 3px 8px; text-align: right; }
  table.cards td::before { content: attr(data-label); color: var(--ink-2); text-align: left; font-weight: 500; }
  table.cards td.n { justify-content: space-between; }
}
.menu-btn { display: none; }
@media (max-width: 860px) { .menu-btn { display: inline-flex; } }

/* ⌘K 메뉴 찾기 */
.finder { position: fixed; inset: 0; background: rgba(10,20,16,.35); display: none; z-index: 50; padding-top: 12vh; }
.finder.open { display: block; }
.finder-box { max-width: 520px; margin: 0 auto; background: var(--panel); border-radius: 10px; border: 1px solid var(--line); padding: 10px; }
.finder-box ul { list-style: none; margin: 6px 0 0; padding: 0; max-height: 50vh; overflow-y: auto; }
.finder-box li a { display: block; padding: 8px 10px; border-radius: 6px; }
.finder-box li a.sel, .finder-box li a:hover { background: var(--teal-2); text-decoration: none; }

/* 인쇄 */
@media print {
  .rail, .top, .bottom-bar, .no-print, .flash { display: none !important; }
  .shell { display: block; } .page { padding: 0; max-width: none; } body { background: #fff; color: #000; }
  .panel, .table-wrap { border: 0; padding: 0; }
  th { background: #eee !important; }
}
.label-sheet { display: flex; flex-wrap: wrap; gap: 6mm; }
.label { width: 100mm; min-height: 60mm; border: 1px solid #000; padding: 4mm; display: grid; grid-template-columns: 34mm 1fr;
  gap: 4mm; page-break-inside: avoid; color: #000; background: #fff; }
.label.small { width: 60mm; min-height: 40mm; grid-template-columns: 22mm 1fr; padding: 2.5mm; font-size: 11px; }
.label .qr svg { width: 100%; height: auto; }
.label .big { font-size: 20px; font-weight: 800; }
.label .id { font-weight: 800; letter-spacing: .04em; }
