/* ── Header & navigation ───────────────────────────────────────────────── */
header {
  background: var(--surface);
  border-bottom: 0.5px solid var(--border);
  padding: 1rem 1.25rem 0;
  position: sticky;
  top: 0;
  z-index: 10;
}
.header-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: .9rem;
}
.logo { font-size: 18px; }
.logo span { color: var(--accent); }
.header-controls { display: flex; align-items: center; gap: 10px; }
.user-info { font-size: 12px; color: var(--text2); display: flex; align-items: center; gap: 8px; }
.logout-btn {
  font-family: 'Georgia', serif;
  font-size: 12px;
  color: var(--text2);
  background: none;
  border: 0.5px solid var(--border-med);
  border-radius: 6px;
  padding: 4px 10px;
  cursor: pointer;
}
.logout-btn:hover { background: var(--surface2); }

nav { display: flex; overflow-x: auto; }
nav button {
  font-family: 'Georgia', serif;
  font-size: 13px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 8px 14px 10px;
  cursor: pointer;
  color: var(--text2);
  transition: color .15s, border-color .15s;
  white-space: nowrap;
  flex-shrink: 0;
}
nav button.active { color: var(--accent); border-bottom-color: var(--accent); }

/* ── Layout ────────────────────────────────────────────────────────────── */
main { padding: 1.25rem; max-width: 520px; margin: 0 auto; }

/* ── Step indicator ────────────────────────────────────────────────────── */
.steps { display: flex; align-items: center; gap: 0; margin-bottom: 1.25rem; }
.step { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text3); }
.step.active { color: var(--accent); }
.step.done { color: var(--text2); }
.step-num {
  width: 22px; height: 22px;
  border-radius: 50%;
  border: 1.5px solid currentColor;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px;
  flex-shrink: 0;
}
.step.done .step-num { background: var(--accent); border-color: var(--accent); color: #fff; font-size: 10px; }
.step.active .step-num { border-color: var(--accent); }
.step-line { flex: 1; height: 1px; background: var(--border); margin: 0 6px; }

/* ── Camp selection ────────────────────────────────────────────────────── */
.camp-chip-wrap { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: .75rem; }
.camp-chip {
  font-family: 'Georgia', serif;
  font-size: 13px;
  padding: 6px 14px;
  border: 0.5px solid var(--border-med);
  border-radius: 100px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  transition: all .12s;
}
.camp-chip:hover { background: var(--surface2); }
.camp-chip.selected { background: var(--accent-light); border-color: var(--accent); }

/* ── Scanner ───────────────────────────────────────────────────────────── */
.video-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  border-radius: var(--radius);
  overflow: hidden;
  background: #0a0a0a;
}
.video-wrap video { width: 100%; height: 100%; object-fit: cover; display: block; }
.scan-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}
.scan-frame {
  width: 60%;
  aspect-ratio: 1;
  border: 2px solid var(--accent);
  border-radius: 4px;
  position: relative;
  box-shadow: 0 0 0 2000px rgba(0,0,0,0.45);
}
.scan-line {
  position: absolute;
  left: 0; right: 0;
  height: 2px;
  background: var(--accent);
  animation: scanmove 2s ease-in-out infinite;
}
@keyframes scanmove { 0%,100%{top:10%;opacity:.5} 50%{top:88%;opacity:1} }
.scan-status {
  text-align: center;
  font-size: 13px;
  color: var(--text2);
  margin-top: .6rem;
  min-height: 20px;
  font-style: italic;
}

/* ── Item rows ─────────────────────────────────────────────────────────── */
.item-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 0;
  border-bottom: 0.5px solid var(--border);
}
.item-row:last-child { border-bottom: none; }
.item-row-info { flex: 1; min-width: 0; }
.item-row-name { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item-row-sub { font-size: 12px; color: var(--text2); font-style: italic; margin-top: 1px; }
.remove-btn {
  background: none;
  border: none;
  color: var(--text3);
  font-size: 18px;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
  flex-shrink: 0;
}
.remove-btn:hover { color: var(--danger); }
.empty-list { text-align: center; padding: 1.5rem 1rem; color: var(--text3); font-style: italic; font-size: 13px; }

/* ── Camp badge ────────────────────────────────────────────────────────── */
.camp-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--accent-light);
  color: var(--accent-text);
  border: 0.5px solid var(--accent);
  border-radius: 100px;
  padding: 5px 14px 5px 10px;
  font-size: 13px;
  margin-bottom: .85rem;
}
.camp-badge-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); flex-shrink: 0; }

/* ── Finalize summary ──────────────────────────────────────────────────── */
.summary-count { font-size: 28px; letter-spacing: -.02em; color: var(--text); }
.summary-sub { font-size: 13px; color: var(--text2); font-style: italic; margin-top: 2px; margin-bottom: 1rem; }

/* ── Pills ─────────────────────────────────────────────────────────────── */
.pill { display: inline-block; font-size: 11px; padding: 2px 9px; border-radius: 100px; letter-spacing: .03em; }
.pill.available { background: var(--accent-light); color: var(--accent-text); }
.pill.out { background: var(--warn-bg); color: var(--warn); }

/* ── Inventory table ───────────────────────────────────────────────────── */
.inv-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.inv-table th {
  text-align: left;
  font-weight: normal;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text3);
  padding: 6px 8px;
  border-bottom: 0.5px solid var(--border);
}
.inv-table td { padding: 9px 8px; border-bottom: 0.5px solid var(--border); vertical-align: middle; }
.inv-table tr:last-child td { border-bottom: none; }
.dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 5px; vertical-align: middle; }
.dot.g { background: var(--accent); }
.dot.a { background: var(--warn); }

/* ── Stats ─────────────────────────────────────────────────────────────── */
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 1rem; }
.stat-card {
  background: var(--surface);
  border: 0.5px solid var(--border);
  border-radius: var(--radius);
  padding: .85rem 1rem;
}
.stat-label { font-size: 11px; color: var(--text3); text-transform: uppercase; letter-spacing: .06em; margin-bottom: 4px; }
.stat-val { font-size: 26px; letter-spacing: -.02em; }
.section-actions { display: flex; align-items: center; justify-content: space-between; margin-bottom: .75rem; }

/* ── History rows ──────────────────────────────────────────────────────── */
.history-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 0.5px solid var(--border);
  font-size: 13px;
}
.history-row:last-child { border-bottom: none; }
.h-icon {
  width: 28px; height: 28px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px;
  flex-shrink: 0;
  margin-top: 1px;
}
.h-icon.out { background: var(--warn-bg); color: var(--warn); }
.h-icon.in  { background: var(--accent-light); color: var(--accent-text); }
.h-main { flex: 1; }
.h-detail { font-size: 12px; color: var(--text2); margin-top: 2px; font-style: italic; }
.h-time { font-size: 11px; color: var(--text3); white-space: nowrap; }
.h-user { font-size: 11px; color: var(--text3); margin-top: 2px; }

/* ── Barrios tab ───────────────────────────────────────────────────────── */
.barrio-stats {
  display: flex;
  gap: 6px;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}
.barrio-stat-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 100px;
  border: 0.5px solid var(--border-med);
  color: var(--text2);
  background: var(--surface);
}

.barrio-stat-chip.active {
  background: var(--surface2);
  border-color: var(--text2);
  color: var(--text1);
  font-weight: 500;
}

.barrio-clear-chip {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 100px;
  border: 0.5px solid var(--border-med);
  color: var(--text3);
  background: var(--surface);
  cursor: pointer;
  user-select: none;
}
.barrio-clear-chip:active { background: var(--surface2); }

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
  display: inline-block;
}
.status-dot.expected { border: dashed 1px var(--text2); }
.status-dot.on-site  { background: var(--accent); }
.status-dot.departed { background: var(--text3); opacity: .5; }

.barrio-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 1.25rem;
  border-bottom: 0.5px solid var(--border);
  cursor: pointer;
  user-select: none;
}
.barrio-card:last-child { border-bottom: none; }
.barrio-card:active { background: var(--surface2); }
.barrio-card-body { flex: 1; min-width: 0; }
.barrio-card-name { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.barrio-card-arrow { color: var(--text3); font-size: 18px; flex-shrink: 0; }

.barrio-status-label { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; }
.barrio-status-label.expected { color: var(--text3); }
.barrio-status-label.on-site  { color: var(--accent-text); }
.barrio-status-label.departed { color: var(--text3); }

.items-out-badge {
  font-size: 11px;
  background: var(--warn-bg);
  color: var(--warn);
  border: 0.5px solid var(--warn-border);
  border-radius: 100px;
  padding: 2px 8px;
  white-space: nowrap;
  flex-shrink: 0;
}

.barrio-detail-row {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  padding: 5px 0;
  border-bottom: 0.5px solid var(--border);
  gap: 10px;
}
.barrio-detail-row:last-child { border-bottom: none; }
.barrio-detail-key { color: var(--text2); flex-shrink: 0; }

.arrival-prompt-card {
  border-color: var(--warn-border) !important;
  background: var(--warn-bg) !important;
}
.arrival-prompt-card .card-label { color: var(--warn) !important; }

.arrival-form-section {
  border-top: 0.5px solid var(--border);
  padding-top: 1rem;
  margin-top: .75rem;
}
.arrival-form-section .card-label { margin-bottom: .6rem; }

/* ── Check-in result card ──────────────────────────────────────────────── */
.ci-result { text-align: center; padding: 1rem 0; }
.ci-result .item-name { font-size: 18px; margin-bottom: .25rem; }
.ci-result .item-status { font-size: 13px; color: var(--text2); font-style: italic; }

/* ── Scan result full-screen overlay ───────────────────────────────────── */
.sof {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: 3rem 1.5rem 2.5rem;
}
.sof.sof-open { display: flex; }

.sof-success { background: #1e6e3a; }
.sof-warning { background: #b86a08; }
.sof-error   { background: #b83030; }
.sof-manual  { background: rgba(0,0,0,.72); justify-content: center; padding: 1.5rem; }

.sof-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: .85rem;
  padding: 0 .5rem;
}
.sof-title {
  font-size: 2.5rem;
  font-weight: bold;
  color: #fff;
  line-height: 1.15;
  letter-spacing: -.02em;
  word-break: break-word;
}
.sof-subtitle {
  font-size: 1.1rem;
  color: rgba(255,255,255,.82);
}

.sof-buttons {
  width: 100%;
  max-width: 320px;
  display: flex;
  flex-direction: column;
  gap: .65rem;
}
.sof-btn {
  width: 100%;
  min-height: 56px;
  border-radius: 100px;
  border: none;
  font-family: 'Georgia', serif;
  font-size: 1.05rem;
  cursor: pointer;
  transition: opacity .12s;
}
.sof-btn:active { opacity: .75; }
.sof-btn-primary {
  background: rgba(255,255,255,.2);
  color: #fff;
  border: 1.5px solid rgba(255,255,255,.5);
}
.sof-btn-secondary {
  background: rgba(255,255,255,.1);
  color: rgba(255,255,255,.92);
  border: 1.5px solid rgba(255,255,255,.3);
}
.sof-btn-ghost {
  background: transparent;
  color: rgba(255,255,255,.65);
  border: none;
  font-size: .95rem;
  min-height: 44px;
}

/* Manual entry card */
.sof-manual-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  width: 100%;
  max-width: 360px;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.sof-manual-title {
  font-size: 1.1rem;
  color: var(--text);
  text-align: center;
  font-weight: bold;
}
.sof-manual-input {
  width: 100%;
  padding: .75rem 1rem;
  font-size: 1rem;
  font-family: 'Georgia', serif;
  border: 1.5px solid var(--border-med);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  outline: none;
}
.sof-manual-input:focus { border-color: var(--accent); }
.sof-manual-actions { display: flex; flex-direction: column; gap: .5rem; }
.sof-btn-manual-primary {
  background: var(--accent);
  color: #fff;
  border: none;
}
.sof-btn-ghost-dark {
  background: transparent;
  color: var(--text2);
  border: none;
  font-family: 'Georgia', serif;
  font-size: .95rem;
  min-height: 44px;
  cursor: pointer;
}

/* ── Mode toggle (Scan In tab) ─────────────────────────────────────────── */
.mode-toggle-wrap {
  display: flex;
  justify-content: center;
  margin-bottom: 1rem;
}
.mode-toggle {
  display: inline-flex;
  background: var(--surface2);
  border: 0.5px solid var(--border-med);
  border-radius: 100px;
  padding: 3px;
  gap: 2px;
}
.mode-toggle button {
  font-family: 'Georgia', serif;
  font-size: 13px;
  background: none;
  border: none;
  border-radius: 100px;
  padding: 6px 16px;
  cursor: pointer;
  color: var(--text2);
  transition: background .15s, color .15s;
}
.mode-toggle button.active {
  background: var(--surface);
  color: var(--accent);
  box-shadow: 0 1px 3px rgba(0,0,0,.15);
}

/* ── Text link button (validate manual entry) ──────────────────────────── */
.btn-text-link {
  display: block;
  margin: .75rem auto 0;
  background: none;
  border: none;
  font-family: 'Georgia', serif;
  font-size: 13px;
  color: var(--text3);
  cursor: pointer;
  text-decoration: underline;
  padding: 4px 8px;
}
.btn-text-link:hover { color: var(--text2); }

/* ── Validate batch view ────────────────────────────────────────────────── */
.vl-resume-notice {
  font-size: 12px;
  color: var(--warn);
  background: var(--warn-bg);
  border-radius: var(--radius);
  padding: 6px 10px;
  margin-bottom: .75rem;
  text-align: center;
}
.vl-batch-list {
  margin-bottom: .75rem;
  border: 0.5px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.vl-batch-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: .5rem;
  padding: 8px 12px;
  font-size: 13px;
  border-bottom: 0.5px solid var(--border);
}
.vl-batch-row:last-child { border-bottom: none; }
.vl-batch-name { color: var(--text); font-weight: 500; }
.vl-batch-barrio { color: var(--text3); font-size: 12px; white-space: nowrap; }
.vl-batch-actions { display: flex; flex-direction: column; gap: .4rem; margin-top: .5rem; }
.vl-batch-actions .btn { margin-top: 0; }
.vl-batch-peek {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: .75rem;
  padding: 6px 10px;
  border: 0.5px solid var(--border);
  border-radius: var(--radius);
  font-size: 13px;
  color: var(--text2);
}
.vl-flag-notes-wrap { margin-top: .75rem; }
.vl-flag-notes-wrap label { margin-bottom: .35rem; }
.vl-flag-notes-wrap textarea {
  width: 100%;
  padding: 9px 12px;
  font-family: 'Georgia', serif;
  font-size: 13px;
  border: 0.5px solid var(--border-med);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  resize: vertical;
  box-sizing: border-box;
  margin-bottom: .5rem;
}
.vl-flag-notes-actions { display: flex; gap: .5rem; }
.vl-flag-notes-actions .btn { margin-top: 0; flex: 1; }
