:root {
  --esl-primary: #006241;
  --esl-hover: #004b31;
  --esl-bg: #F9F9F6;
  --esl-card: #ffffff;
  --esl-accent: #C28E61;
  --esl-text: #2C2C2C;
  --esl-muted: #6C6C6C;
  --esl-border: #E0E0E0;
  --esl-danger: #B42318;
  --esl-ok: #006241;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --font-ui: 'NanumSquareNeo', sans-serif;
  --dock-h: 132px;
}
* { box-sizing: border-box; }
html, body {
  margin: 0;
  height: 100dvh;
  max-height: 100dvh;
  background: var(--esl-bg);
  color: var(--esl-text);
  font-family: var(--font-ui);
  overflow: hidden;
  overflow-anchor: none;
  overscroll-behavior: none;
  touch-action: manipulation;
}
body {
  max-width: 480px;
  margin: 0 auto;
  padding: 0;
  display: flex;
  flex-direction: column;
}
body:has(#gate:not(.hidden)) {
  height: auto;
  min-height: 100dvh;
  max-height: none;
  overflow: auto;
  overscroll-behavior: contain;
  padding: calc(12px + var(--safe-t)) 16px calc(16px + var(--safe-b));
}
body:has(#app:not(.hidden)) .gate-hero { display: none !important; }
#app.app-shell {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  height: 100dvh;
  padding: 0;
}
.hidden { display: none !important; }
h1 { font-size: 1.15rem; margin: 0 0 4px; }
.sub {
  color: var(--esl-muted);
  font-size: 0.8rem;
  line-height: 1.4;
  margin: 0 0 10px;
  font-weight: 700;
}
.kicker {
  font-size: 0.72rem;
  font-weight: 800;
  color: var(--esl-primary);
  letter-spacing: 0.02em;
  margin: 0 0 2px;
}
.ver {
  display: inline-block;
  background: var(--esl-primary);
  color: #fff;
  font-size: 0.68rem;
  font-weight: 800;
  border-radius: 999px;
  padding: 2px 8px;
  margin-left: 6px;
  vertical-align: middle;
}
.card {
  background: var(--esl-card);
  border: 1px solid var(--esl-border);
  border-radius: 14px;
  padding: 10px 12px;
  margin-bottom: 8px;
}
.card h2 {
  font-size: 0.78rem;
  margin: 0 0 8px;
  color: var(--esl-primary);
  font-weight: 800;
}
label { display: block; font-size: 0.72rem; font-weight: 800; margin: 6px 0 3px; }
input, select, textarea {
  width: 100%;
  padding: 9px 10px;
  border: 1px solid var(--esl-border);
  border-radius: 10px;
  font-size: 16px;
  font-family: inherit;
  background: #fff;
}
.row { display: flex; gap: 8px; align-items: center; }
.row > * { flex: 1; min-width: 0; }
.row.tight { margin-top: 8px; }
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  border: 0;
  border-radius: 10px;
  padding: 12px 10px;
  font-weight: 800;
  font-size: 0.9rem;
  font-family: inherit;
  cursor: pointer;
  text-decoration: none;
  min-height: 44px;
}
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-primary { background: var(--esl-primary); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--esl-hover); }
.btn-ghost { background: #fff; color: var(--esl-text); border: 1px solid var(--esl-border); }
.btn-sm {
  flex: 0 0 auto;
  width: auto;
  min-width: 64px;
  padding: 8px 10px;
  font-size: 0.78rem;
  min-height: 40px;
}
.hint { font-size: 0.72rem; color: var(--esl-muted); line-height: 1.35; margin: 6px 0 0; }
.hint.compact { margin: 4px 0 0; min-height: 0; }
.status {
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 0.8rem;
  font-weight: 700;
  margin-bottom: 8px;
}
.status.info { background: #eef6f1; color: var(--esl-primary); }
.status.ok { background: #e7f6ec; color: #14532d; }
.status.err { background: #fdecea; color: var(--esl-danger); }
.status.warn { background: #fff6e8; color: #92400e; }

.hero {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 8px;
}
.kpi {
  appearance: none;
  width: 100%;
  border: 1px solid var(--esl-border);
  background: var(--esl-card);
  border-radius: 12px;
  padding: 10px;
  text-align: left;
  cursor: pointer;
  font-family: inherit;
  color: inherit;
  min-height: 72px;
}
.kpi .t { font-size: 0.7rem; font-weight: 800; color: var(--esl-muted); }
.kpi .v {
  font-size: 1.02rem;
  font-weight: 800;
  margin: 4px 0 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.kpi .s { font-size: 0.68rem; color: var(--esl-muted); font-weight: 700; }
.kpi.on { border-color: var(--esl-primary); background: #eef6f1; }
.steps {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 6px;
  margin-bottom: 8px;
}
.step {
  appearance: none;
  border: 0;
  background: #ecece6;
  color: var(--esl-muted);
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 800;
  text-align: center;
  padding: 8px 4px;
  font-family: inherit;
  min-height: 36px;
  cursor: pointer;
}
.step.active { background: #006241; color: #fff; }
.step.done { background: #cfe4d8; color: var(--esl-primary); }
.preview-dock {
  background: var(--esl-bg);
  padding: 0 0 8px;
  overflow-anchor: none;
}
.preview-wrap {
  display: flex;
  justify-content: center;
  background: #ecece6;
  border-radius: 12px;
  padding: 6px;
}
#preview {
  width: 100%;
  max-width: 280px;
  height: auto;
  aspect-ratio: 250 / 122;
  image-rendering: pixelated;
  background: #fff;
  border: 1px solid #ccc;
  touch-action: none;
  user-select: none;
  cursor: default;
}

.ribbon {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
  background: #fff;
  border: 1px solid var(--esl-border);
  border-radius: 12px;
  padding: 6px 8px 6px 12px;
  margin-bottom: 8px;
}
.pill {
  font-size: 0.75rem;
  font-weight: 800;
  color: var(--esl-muted);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  margin-right: 6px;
  background: #c5c5c5;
  vertical-align: middle;
}
.dot.on { background: var(--esl-ok); }
.dot.off { background: #c5c5c5; }
.ribbon .btn-sm { flex: 0 0 auto; white-space: nowrap; }
#prodSearchBtn, .row .btn-sm { flex: 0 0 auto; white-space: nowrap; }

#prodList {
  max-height: 132px;
  overflow: auto;
  margin-top: 6px;
  overflow-anchor: none;
}
.el-bar {
  background: #fff;
  border: 1px solid var(--esl-border);
  border-radius: 10px;
  padding: 8px;
  margin-top: 6px;
}
.el-bar-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}
.el-name { font-size: 0.8rem; font-weight: 800; min-width: 0; width: 100%; }
.el-size { display: flex; gap: 4px; width: 100%; }
.el-size .btn { flex: 1; min-width: 0; padding: 6px 8px; min-height: 34px; font-size: 0.75rem; }
.el-bar .swatch { margin: 8px 0 4px; padding-bottom: 18px; }
.el-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}
.el-chips .chip {
  border: 1px solid var(--esl-border);
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 0.72rem;
  font-weight: 800;
  background: #fff;
  cursor: pointer;
}
.el-chips .chip.active {
  border-color: var(--esl-primary);
  background: #eef6f1;
  color: var(--esl-primary);
}
.el-chips .chip[data-id="__bg"] { font-weight: 800; }
.el-edit { margin-top: 8px; }
.el-edit input { margin-bottom: 6px; }
.el-fields { display: flex; flex-wrap: wrap; gap: 6px; }
.el-fields .chip {
  border: 1px solid var(--esl-border);
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 0.72rem;
  font-weight: 800;
  background: #fff;
  cursor: pointer;
}
.el-fields .chip.active {
  border-color: var(--esl-primary);
  background: #eef6f1;
  color: var(--esl-primary);
}
input[readonly] {
  background: #f3f4f6;
  color: #374151;
}
#devSerial { font-size: 0.9rem; font-family: ui-monospace, Consolas, monospace; font-weight: 800; letter-spacing: 0.04em; }
#devList { margin-top: 8px; }
.serial-face {
  font-size: 1.12rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  font-family: ui-monospace, Consolas, monospace;
  text-align: center;
  padding: 10px 8px;
  margin: 4px 0 10px;
  background: #eef6f1;
  border: 1px solid #cfe4d8;
  border-radius: 10px;
  color: var(--esl-primary);
}
#devScanBox.scan-overlay,
#devScanBox {
  position: fixed;
  inset: 0;
  left: 0;
  right: 0;
  top: 0;
  bottom: 0;
  width: 100%;
  max-width: none;
  height: 100dvh;
  max-height: 100dvh;
  margin: 0;
  padding: 0;
  z-index: 50;
  background: #111;
  border-radius: 0;
  overflow: hidden;
  overscroll-behavior: none;
  touch-action: none;
  display: flex;
  flex-direction: column;
}
#devScanVideo, #devScanReader {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  max-height: none;
  min-height: 0;
  object-fit: cover;
  display: block;
  background: #111;
  flex: none;
  touch-action: none;
}
.scan-chrome {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 2;
  padding: 10px 12px calc(12px + var(--safe-b));
  background: linear-gradient(transparent, rgba(0,0,0,.78) 28%);
  touch-action: manipulation;
}
.scan-bar {
  display: flex;
  gap: 6px;
  padding: 0;
  margin-top: 0;
  touch-action: manipulation;
}
.scan-bar .btn { flex: 1; min-height: 48px; touch-action: manipulation; }
.scan-bar .btn.on {
  border-color: var(--esl-primary);
  background: #eef6f1;
  color: var(--esl-primary);
}
.scan-hint {
  color: #d1d5db !important;
  padding: 8px 4px 0;
}
#devScanStop {
  margin: 8px 0 0;
  width: 100%;
  min-height: 48px;
  background: #fff;
  color: var(--esl-text);
  touch-action: manipulation;
}
#prodSearchBtn { flex: 0 0 64px; }
.fields { margin-top: 4px; }

.add-row { flex-wrap: wrap; }
.add-row .btn { padding: 8px 6px; font-size: 0.75rem; min-height: 36px; }
.btn.on { border-color: var(--esl-primary); background: #eef6f1; }

.bar {
  height: 6px;
  background: #e5e7eb;
  border-radius: 99px;
  overflow: hidden;
  margin: 0 0 8px;
}
.bar > i { display: block; height: 100%; width: 0; background: var(--esl-primary); }
.job-msg {
  font-size: 0.72rem;
  color: var(--esl-muted);
  margin: 0 0 6px;
  min-height: 1em;
  font-weight: 700;
}
.log {
  font-size: 0.68rem;
  background: #111;
  color: #d1fae5;
  border-radius: 10px;
  padding: 8px;
  max-height: 88px;
  overflow: auto;
  white-space: pre-wrap;
  font-family: ui-monospace, Consolas, monospace;
  margin-top: 8px;
}
.list-item {
  border: 1px solid var(--esl-border);
  border-radius: 8px;
  padding: 6px 8px;
  margin-bottom: 4px;
  cursor: pointer;
  background: #fff;
  -webkit-tap-highlight-color: #eef6f1;
  touch-action: manipulation;
}
.list-item.active { border-color: var(--esl-primary); background: #eef6f1; }
.list-item .t { font-weight: 800; font-size: 0.82rem; }
.list-item .s { font-size: 0.7rem; color: var(--esl-muted); }
.swatch {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 14px;
  margin: 8px 0 6px;
  padding-bottom: 16px;
}
.swatch button {
  position: relative;
  width: 44px;
  height: 36px;
  border-radius: 8px;
  border: 2px solid #ddd;
  cursor: pointer;
  flex: 0 0 auto;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.swatch button span {
  position: absolute;
  left: 50%;
  top: 100%;
  transform: translateX(-50%);
  margin-top: 2px;
  font-size: 0.6rem;
  font-weight: 800;
  color: var(--esl-muted);
  white-space: nowrap;
}
.swatch button.on { border-color: var(--esl-primary); }

.footer-link { text-align: center; font-size: 0.78rem; margin: 4px 0 8px; }
.footer-link a { color: var(--esl-primary); font-weight: 700; }
.meta { font-size: 0.72rem; color: var(--esl-muted); }
header.top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}
header.top .meta { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
header.top button {
  width: auto;
  flex: 0 0 auto;
  padding: 6px 10px;
  font-size: 0.75rem;
  min-height: 34px;
  white-space: nowrap;
}
.num2 { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.send-opts { margin-bottom: 4px; }

.sticky.app-dock,
.app-dock {
  position: relative;
  left: auto;
  right: auto;
  bottom: auto;
  flex: 0 0 auto;
  max-width: none;
  margin: 0;
  padding: 10px 12px calc(10px + var(--safe-b));
  background: var(--esl-bg);
  border-top: 1px solid var(--esl-border);
  z-index: 10;
}
.app-dock .btn-primary {
  width: 100%;
  min-height: 56px;
  font-size: 1.05rem;
}
.app-dock .btn-ghost {
  min-height: 56px;
  flex: 0 0 76px;
}
.adv {
  background: var(--esl-card);
  border: 1px solid var(--esl-border);
  border-radius: 14px;
  padding: 8px 12px;
  margin-bottom: 8px;
}
.adv summary {
  font-size: 0.82rem;
  font-weight: 800;
  color: var(--esl-primary);
  cursor: pointer;
  padding: 6px 0;
}
.adv .card { border: 0; padding: 8px 0 0; margin: 0; }
.dock-btns { display: flex; gap: 8px; }
.dock-btns .btn { flex: 1; }
.dock-btns .btn-ghost { flex: 0 0 88px; }
@media (max-height: 720px) {
  #preview { max-width: 220px; }
  .kpi { min-height: 64px; padding: 8px; }
  .kpi .v { font-size: 0.92rem; }
}

#status {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  top: calc(8px + var(--safe-t));
  width: calc(100% - 24px);
  max-width: 456px;
  z-index: 60;
  margin: 0;
}
.app-chrome {
  flex: 0 0 auto;
  padding: calc(8px + var(--safe-t)) 12px 6px;
  background: var(--esl-bg);
  border-bottom: 1px solid var(--esl-border);
  z-index: 5;
}
.app-chrome-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}
.app-chrome .sub {
  flex: 1;
  margin: 0;
  font-size: 0.9rem;
  font-weight: 800;
  color: var(--esl-text);
  line-height: 1.35;
}
.app-chrome-tools {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
}
.app-chrome-tools .meta {
  max-width: 88px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.app-chrome #logoutBtn {
  min-height: 36px;
  padding: 6px 10px;
  width: auto;
}
.step-progress {
  pointer-events: none;
  margin: 8px 0 0;
}
.step-progress .step {
  min-height: 32px;
  cursor: default;
}
.app-stage {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  padding: 10px 12px 12px;
  -webkit-overflow-scrolling: touch;
}
.hero,
.app-footer {
  display: none;
}
#app:has(#paneDev:not(.hidden)) .preview-dock { display: none; }
#app:has(#paneDev:not(.hidden)) .ribbon { display: none; }
#app:has(#paneProd:not(.hidden)) .ribbon { display: none; }
#app:has(#paneProd:not(.hidden)) .preview-dock #preview { pointer-events: none; }
#app:has(#paneScreen:not(.hidden)) .preview-dock #preview { pointer-events: none; }
#app:has(#paneScreen:not(.hidden) .adv[open]) .preview-dock #preview { pointer-events: auto; }
#prodList {
  max-height: min(36vh, 260px);
}
.list-item { min-height: 52px; }
html.esl-lock,
html.esl-lock body {
  overflow: hidden;
  height: 100dvh;
  max-height: 100dvh;
}
