:root {
  --bg: #f3f5f7;
  --card: #ffffff;
  --text: #1a2330;
  --muted: #6b7785;
  --line: #d8dee6;
  --primary: #167fe6;
  --store: #1f8a4c;
  --use: #c47a00;
  --dispose: #c0392b;
  --selected: #e8f2fc;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  padding: 0;
  font-family: "Pretendard", "Noto Sans KR", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100%;
}
body { padding-bottom: 160px; }

.hidden { display: none !important; }
.view { max-width: 560px; margin: 0 auto; padding: 16px; }

.top h1 { margin: 0 0 4px; font-size: 1.4rem; }
.top .sub { margin: 0; color: var(--muted); font-size: 0.9rem; }
.top.bar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 12px;
}

.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.panel.row {
  flex-direction: row;
  align-items: stretch;
  gap: 8px;
}
.panel.row input { flex: 1; }

label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.85rem;
  color: var(--muted);
  font-weight: 600;
}
label.inline {
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
label.inline select { width: 65%; max-width: 280px; }

input, select {
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  font-size: 1rem;
  background: #fff;
  color: var(--text);
}
input:focus, select:focus {
  outline: 2px solid rgba(22, 127, 230, 0.25);
  border-color: var(--primary);
}

.btn {
  height: 44px;
  border: none;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  padding: 0 14px;
}
.btn.primary { background: var(--primary); color: #fff; }
.btn.ghost {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--muted);
}
.btn.store { background: var(--store); color: #fff; flex: 1; }
.btn.use { background: var(--use); color: #fff; flex: 1; }
.btn.dispose { background: var(--dispose); color: #fff; flex: 1; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-row { display: flex; gap: 8px; }

.msg {
  min-height: 1.2em;
  margin: 8px 0 0;
  font-size: 0.85rem;
  color: var(--dispose);
}
.msg.ok { color: var(--store); }
.hint {
  text-align: center;
  color: var(--muted);
  font-size: 0.9rem;
  margin: 24px 8px;
}

.cards {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
}

.card {
  position: relative;
  background: var(--card);
  border: 2px solid var(--line);
  border-radius: 10px;
  padding: 10px 34px 10px 12px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  user-select: none;
}
.card.selected {
  border-color: var(--primary);
  background: var(--selected);
}
.card .name {
  font-size: 0.92rem;
  font-weight: 700;
  margin: 0 0 4px;
  line-height: 1.25;
  padding-right: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.card .meta-line {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px;
  margin: 0;
  font-size: 0.8rem;
  line-height: 1.3;
  color: var(--muted);
}
.card .meta-line .sep {
  color: #c5ccd4;
  font-weight: 400;
  line-height: 1;
}
.card .meta-line .code,
.card .meta-line .epc {
  font-weight: 600;
  color: var(--text);
}
.card .meta-line .loc {
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}
.card .badge {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  background: #eef2f6;
  flex-shrink: 0;
}
.card .badge.s1 { background: #e5f6ec; color: var(--store); }
.card .badge.s2 { background: #fff4df; color: var(--use); }
.card .badge.s3 { background: #fde8e6; color: var(--dispose); }

.card .x {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 6px;
  background: #f0f2f5;
  color: var(--muted);
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  line-height: 1;
}
.card .x:active { background: #e2e6eb; }

.action-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  background: #fff;
  border-top: 1px solid var(--line);
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 560px;
  margin: 0 auto;
  box-shadow: 0 -4px 20px rgba(0,0,0,0.06);
}
.selected-info {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text);
}
