/* LeninShop stock intake — phone-first.
 *
 * Built for one-handed use while walking the shop floor: large hit targets,
 * a sticky save button within thumb reach, and no hover-dependent affordances.
 */

:root {
  --bg: #17130f;
  --raised: #221c16;
  --input: #2c241c;
  --line: #3b3025;
  --text: #f3ece0;
  --dim: #a89880;
  --accent: #c8102e;
  --accent-hot: #e2263f;
  --yellow: #f5c518;   /* the painted steel columns */
  --brick: #8b4a3a;    /* the exposed back wall */
  --ok: #5aa06a;
  --warn: #d9a441;
  --mono: ui-monospace, "Cascadia Mono", Menlo, Consolas, monospace;
  --tap: 48px; /* minimum comfortable touch target */
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }

html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: contain;
}

h1, h2 { margin: 0; font-weight: 600; letter-spacing: -.015em; }
.muted { color: var(--dim); }
.small { font-size: 13px; }
.hint { color: var(--dim); font-size: 12px; font-weight: 400; }
.req { color: var(--accent); }
.error { color: #e8776a; font-size: 14px; margin: 12px 0 0; }

input, select, textarea, button { font: inherit; color: inherit; }

.screen {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}
.screen-dark { background: #000; }

.pad { padding: 16px; flex: 1; overflow-y: auto; }

/* ── Bars ──────────────────────────────────────────────────────────── */

.bar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 8px;
  padding-top: calc(10px + env(safe-area-inset-top, 0px));
  background: rgba(19, 19, 21, .95);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.bar-title { font-weight: 600; font-size: 16px; }
.bar-action {
  min-height: var(--tap);
  padding: 0 12px;
  background: none;
  border: none;
  color: var(--dim);
  font-size: 15px;
  cursor: pointer;
}
.bar-action:active { color: var(--text); }

/* ── Buttons ───────────────────────────────────────────────────────── */

.btn {
  min-height: var(--tap);
  padding: 12px 20px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--input);
  cursor: pointer;
  transition: transform .06s;
}
.btn:active { transform: scale(.985); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.btn-ghost { background: transparent; color: var(--dim); }
.btn-block { width: 100%; display: block; }
.btn:disabled { opacity: .5; }

/* ── Login ─────────────────────────────────────────────────────────── */

#view-login { justify-content: center; padding: 24px; }
.login-card { text-align: center; }
.login-card h1 { font-size: 26px; }
.login-card p { margin: 2px 0 24px; font-size: 14px; }
.login-card input { margin-bottom: 12px; text-align: center; }

.mark {
  width: 64px; height: 64px;
  margin: 0 auto 16px;
  border-radius: 50%;
  background:
    radial-gradient(circle, var(--accent) 0 18%, transparent 19%),
    repeating-radial-gradient(circle, #26262b 0 2px, #191919 2px 4px);
}

/* ── Home ──────────────────────────────────────────────────────────── */

.home { padding: 16px; display: grid; gap: 12px; }

.stat-strip {
  display: flex;
  gap: 8px;
  margin-bottom: 4px;
}
.stat-pill {
  flex: 1;
  padding: 10px 12px;
  background: var(--raised);
  border: 1px solid var(--line);
  border-radius: 12px;
  text-align: center;
}
.stat-pill b { display: block; font-size: 20px; font-variant-numeric: tabular-nums; }
.stat-pill span { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--dim); }

.big-action {
  display: grid;
  grid-template-columns: 44px 1fr;
  grid-template-rows: auto auto;
  align-items: center;
  gap: 2px 14px;
  width: 100%;
  padding: 18px;
  text-align: left;
  background: var(--accent);
  border: none;
  border-radius: 16px;
  color: #fff;
  cursor: pointer;
  transition: transform .06s;
}
.big-action:active { transform: scale(.985); }
.big-action.secondary { background: var(--raised); border: 1px solid var(--line); color: var(--text); }
.big-action svg { grid-row: span 2; width: 30px; height: 30px; justify-self: center; }
.big-label { font-size: 17px; font-weight: 600; }
.big-sub { font-size: 13px; opacity: .78; }

.recent { margin-top: 10px; }
.recent h2 {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--dim);
  margin-bottom: 8px;
}
.recent-list { list-style: none; margin: 0; padding: 0; }
.recent-list li {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
}
.recent-list li:last-child { border-bottom: none; }
.recent-list img, .recent-list .ph {
  width: 42px; height: 42px;
  border-radius: 6px;
  object-fit: cover;
  background: var(--input);
  flex-shrink: 0;
}
.recent-list .ph { display: grid; place-items: center; color: #4a4a55; }
.recent-artist { font-weight: 600; }
.recent-title { color: var(--dim); font-size: 13px; }
.recent-empty { color: var(--dim); font-size: 14px; padding: 8px 0; }

/* ── Camera ────────────────────────────────────────────────────────── */

.camera-wrap { position: relative; flex: 1; overflow: hidden; background: #000; }
#camera { width: 100%; height: 100%; object-fit: cover; display: block; }

.reticle {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  pointer-events: none;
}
.reticle span {
  width: min(78vw, 330px);
  height: 165px;
  border: 2px solid rgba(255, 255, 255, .85);
  border-radius: 14px;
  box-shadow: 0 0 0 100vmax rgba(0, 0, 0, .5);
  position: relative;
}
/* A sweeping line reads as "actively scanning". */
.reticle span::after {
  content: "";
  position: absolute;
  left: 8px; right: 8px;
  height: 2px;
  background: var(--accent);
  box-shadow: 0 0 12px var(--accent);
  animation: sweep 2s ease-in-out infinite;
}
@keyframes sweep {
  0%, 100% { top: 12px; }
  50% { top: calc(100% - 14px); }
}
.reticle.hit span { border-color: var(--ok); }
.reticle.hit span::after { animation: none; opacity: 0; }

.scan-status {
  position: absolute;
  left: 0; right: 0;
  bottom: 18px;
  margin: 0;
  text-align: center;
  font-size: 14px;
  color: #fff;
  text-shadow: 0 1px 6px rgba(0, 0, 0, .9);
}

.scan-foot {
  padding: 14px 16px calc(14px + var(--safe-bottom));
  background: var(--bg);
  border-top: 1px solid var(--line);
  display: grid;
  gap: 10px;
  text-align: center;
}

/* ── Candidates ────────────────────────────────────────────────────── */

.candidates { display: grid; gap: 10px; margin-bottom: 16px; }

.candidate {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px;
  text-align: left;
  background: var(--raised);
  border: 1px solid var(--line);
  border-radius: 14px;
  cursor: pointer;
}
.candidate:active { border-color: var(--accent); }
.candidate-art {
  width: 58px; height: 58px;
  border-radius: 8px;
  object-fit: cover;
  background: var(--input);
  flex-shrink: 0;
}
.candidate-art.ph { display: grid; place-items: center; color: #4a4a55; font-size: 20px; }
.candidate-body { flex: 1; min-width: 0; }
.candidate-artist { font-weight: 600; font-size: 15px; }
.candidate-title { font-size: 14px; }
.candidate-meta {
  font-size: 11px;
  color: var(--dim);
  font-family: var(--mono);
  margin-top: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.candidate-source {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--dim);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 2px 7px;
  flex-shrink: 0;
}

.notice {
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  border-left-width: 3px;
  font-size: 14px;
  margin-bottom: 14px;
}
.notice-warn { border-left-color: var(--warn); background: rgba(201, 146, 47, .09); }
.notice-info { border-left-color: var(--ok); background: rgba(76, 154, 106, .09); }
.notice .notice-actions { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.notice .btn { min-height: 40px; padding: 8px 14px; font-size: 14px; }

.notes { font-size: 12px; color: var(--dim); margin: 4px 0 14px; }
.notes ul { margin: 0; padding-left: 18px; }

.loading { display: flex; align-items: center; gap: 10px; color: var(--dim); padding: 22px 0; }
.spinner {
  width: 16px; height: 16px;
  border: 2px solid var(--line);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Form ──────────────────────────────────────────────────────────── */

.field { display: block; margin-bottom: 16px; font-size: 13px; color: var(--dim); }
.field input, .field textarea {
  display: block;
  width: 100%;
  margin-top: 6px;
  min-height: var(--tap);
  padding: 12px 14px;
  background: var(--input);
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--text);
  /* 16px keeps iOS Safari from zooming the viewport on focus. */
  font-size: 16px;
  outline: none;
}
.field input:focus, .field textarea:focus { border-color: var(--accent); }
.field textarea { resize: vertical; font-family: inherit; }

.row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.chip {
  min-height: 42px;
  padding: 9px 16px;
  background: var(--input);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--text);
  font-size: 15px;
  cursor: pointer;
}
.chip.on { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }

.stepper { display: flex; align-items: center; gap: 8px; margin-top: 6px; }
.stepper button {
  width: var(--tap); height: var(--tap);
  flex-shrink: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--input);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}
.stepper button:active { background: var(--accent); border-color: var(--accent); }
.stepper input { margin-top: 0 !important; text-align: center; }

.more { margin-bottom: 16px; }
.more summary {
  min-height: var(--tap);
  display: flex;
  align-items: center;
  color: var(--dim);
  font-size: 14px;
  cursor: pointer;
}
.more[open] summary { margin-bottom: 12px; }

.photo-strip { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.photo-strip figure { position: relative; margin: 0; }
.photo-strip img { width: 76px; height: 76px; object-fit: cover; border-radius: 10px; display: block; }
.photo-strip button {
  position: absolute;
  top: -6px; right: -6px;
  width: 26px; height: 26px;
  border-radius: 50%;
  border: none;
  background: var(--accent);
  color: #fff;
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
}
.photo-add {
  display: block;
  margin-top: 10px;
  padding: 14px;
  text-align: center;
  border: 1.5px dashed var(--line);
  border-radius: 12px;
  color: var(--dim);
  font-size: 15px;
  cursor: pointer;
}
.photo-add:active { border-color: var(--accent); }

.sticky-foot {
  position: sticky;
  bottom: 0;
  padding: 12px 16px calc(12px + var(--safe-bottom));
  background: rgba(19, 19, 21, .96);
  backdrop-filter: blur(10px);
  border-top: 1px solid var(--line);
}

/* ── Sheets ────────────────────────────────────────────────────────── */

.sheet {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: flex-end;
  background: rgba(0, 0, 0, .65);
}
.sheet-card {
  width: 100%;
  padding: 20px 16px calc(20px + var(--safe-bottom));
  background: var(--raised);
  border-radius: 18px 18px 0 0;
  border-top: 1px solid var(--line);
}
.sheet-card h2 { font-size: 17px; margin-bottom: 14px; }
.sheet-card input {
  width: 100%;
  min-height: var(--tap);
  padding: 12px 14px;
  background: var(--input);
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--text);
  font-size: 16px;
  outline: none;
  margin-bottom: 14px;
}
.sheet-actions { display: flex; gap: 10px; }
.sheet-actions .btn { flex: 1; }

/* ── Toast ─────────────────────────────────────────────────────────── */

.toast {
  position: fixed;
  left: 12px; right: 12px;
  bottom: calc(16px + var(--safe-bottom));
  z-index: 100;
  padding: 14px 18px;
  background: #2a2a31;
  border: 1px solid var(--line);
  border-left: 3px solid var(--ok);
  border-radius: 12px;
  font-size: 15px;
  box-shadow: 0 14px 40px rgba(0, 0, 0, .55);
  animation: rise .2s ease-out;
}
.toast.err { border-left-color: var(--accent); }
@keyframes rise {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}

/* Roomier on a tablet or a desktop browser opened at this URL. */
@media (min-width: 720px) {
  .screen { max-width: 560px; margin: 0 auto; }
  .home, .pad { padding: 20px; }
}

/* ── Tag editor (genres) ───────────────────────────────────────────── */

.tag-editor {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
  padding: 8px;
  min-height: var(--tap);
  background: var(--input);
  border: 1px solid var(--line);
  border-radius: 12px;
}
.tag-editor:focus-within { border-color: var(--accent); }
.tag-chips { display: contents; }

.tag-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 8px 7px 14px;
  background: #34343d;
  border-radius: 999px;
  font-size: 14px;
  color: var(--text);
  white-space: nowrap;
}
.tag-chip button {
  width: 24px; height: 24px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, .14);
  color: var(--text);
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
}

.tag-input {
  flex: 1;
  min-width: 120px;
  margin-top: 0 !important;
  min-height: 34px !important;
  padding: 4px 2px !important;
  background: none !important;
  border: none !important;
  outline: none;
  font-size: 16px;
}
