/* ============================================================
   card-reader tool styles - layers on /assets/site.css tokens
   palette: white + yellow + black/dark-gray only
   ============================================================ */

.cr-panel { margin-bottom: 24px; }

/* ---------- drop zone ---------- */
.cr-drop {
  border: 2px dashed var(--ink);
  border-radius: var(--r-lg);
  background: var(--bg-soft);
  padding: 34px 20px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  cursor: pointer;
  transition: background .15s, border-color .15s;
}
.cr-drop:hover, .cr-drop:focus-visible { background: var(--yellow-wash); outline: none; }
.cr-drop.dragover { background: var(--yellow-soft); border-style: solid; }
.cr-drop-title { margin: 0; font-family: var(--font-display); font-weight: 800; font-size: 18px; }
.cr-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.cr-hint { margin: 0; font-family: var(--font-mono); font-size: 12px; color: var(--ink-dim); }

/* ---------- camera ---------- */
.cr-camera {
  position: relative;
  margin-top: 16px;
  border: 2px solid var(--ink);
  border-radius: var(--r-md);
  overflow: hidden;
  background: #000;
}
.cr-camera video { width: 100%; display: block; max-height: 60vh; object-fit: contain; background: #000; }
.cr-camera-guide {
  position: absolute; inset: 0;
  margin: auto;
  width: 86%; max-width: 460px;
  aspect-ratio: 3.5 / 2;
  border: 2px dashed var(--yellow);
  border-radius: 10px;
  pointer-events: none;
}
.cr-camera-bar {
  position: absolute; left: 0; right: 0; bottom: 0;
  display: flex; gap: 10px; justify-content: center;
  padding: 12px;
  background: linear-gradient(180deg, transparent, rgba(0,0,0,.55));
}

/* ---------- thumbnails ---------- */
.cr-thumbs { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 16px; align-items: flex-start; }
.cr-thumb {
  position: relative;
  border: 2px solid var(--ink);
  border-radius: var(--r-md);
  overflow: hidden;
  width: 200px;
  background: var(--bg);
}
.cr-thumb img { width: 100%; height: 124px; object-fit: cover; display: block; }
.cr-thumb-label {
  position: absolute; top: 6px; left: 6px;
  font-family: var(--font-mono); font-size: 11px; font-weight: 700;
  background: var(--yellow); color: var(--ink);
  padding: 2px 7px; border-radius: 999px; border: 1.5px solid var(--ink);
}
.cr-thumb-x {
  position: absolute; top: 6px; right: 6px;
  width: 26px; height: 26px; line-height: 1;
  border: 1.5px solid var(--ink); border-radius: 50%;
  background: var(--bg); color: var(--ink);
  font-size: 18px; cursor: pointer;
  display: grid; place-items: center;
}
.cr-thumb-x:hover { background: var(--yellow); }
.cr-addback {
  border: 2px dashed var(--ink); border-radius: var(--r-md);
  background: var(--bg-soft); color: var(--ink);
  width: 200px; height: 124px;
  font-family: var(--font-mono); font-size: 13px; font-weight: 600;
  cursor: pointer;
}
.cr-addback:hover { background: var(--yellow-wash); }

/* ---------- scan ---------- */
.cr-scan { margin: 8px 0 28px; }
.cr-scan-btn { font-size: 16px; padding: 12px 22px; }
.cr-scan-btn[disabled] { opacity: .55; cursor: progress; }
/* brief attention pulse when a captured image makes the scan action appear */
.cr-scan.cr-pop .cr-scan-btn { animation: cr-pop 0.9s ease; }
@keyframes cr-pop {
  0% { transform: scale(1); box-shadow: 3px 3px 0 var(--yellow-deep); }
  30% { transform: scale(1.06); box-shadow: 5px 5px 0 var(--yellow-deep); }
  100% { transform: scale(1); box-shadow: 3px 3px 0 var(--yellow-deep); }
}
.cr-disclosure {
  margin: 12px 0 0; max-width: 640px;
  font-size: 12.5px; line-height: 1.5; color: var(--ink-mute);
}
.cr-disclosure strong { color: var(--ink); }
.cr-status {
  margin-top: 14px; padding: 12px 14px;
  border: 2px solid var(--ink); border-radius: var(--r-md);
  font-size: 14px; background: var(--bg);
}
.cr-status.working { background: var(--yellow-wash); }
.cr-status.error { background: var(--bg); border-style: solid; }
.cr-spin {
  display: inline-block; width: 14px; height: 14px;
  border: 2px solid var(--ink); border-top-color: transparent;
  border-radius: 50%; margin-right: 8px; vertical-align: -2px;
  animation: cr-rot .7s linear infinite;
}
@keyframes cr-rot { to { transform: rotate(360deg); } }

/* ---------- review form ---------- */
.cr-review { margin: 8px 0 40px; }
.cr-review-note { max-width: 640px; color: var(--ink-mute); font-size: 14px; margin: 0 0 18px; }
.cr-form { max-width: 640px; }
.cr-field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 14px; }
.cr-field > span { font-family: var(--font-mono); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-mute); }
.cr-row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.cr-form input, .cr-form textarea, .cr-form select {
  font-family: inherit; font-size: 15px;
  padding: 9px 11px;
  border: 2px solid var(--ink); border-radius: var(--r-sm);
  background: var(--bg); color: var(--ink);
  width: 100%;
}
.cr-form input:focus, .cr-form textarea:focus, .cr-form select:focus {
  outline: none; box-shadow: 3px 3px 0 var(--yellow-deep);
}
.cr-form textarea { resize: vertical; }
.cr-form .flagged { border-color: var(--yellow-deep); background: var(--yellow-wash); }

.cr-multi { border: 2px solid var(--line); border-radius: var(--r-md); padding: 12px 14px 14px; margin: 0 0 14px; }
.cr-multi legend { font-family: var(--font-mono); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-mute); padding: 0 6px; }
.cr-multi-row { display: flex; gap: 8px; margin-bottom: 8px; align-items: center; }
.cr-multi-row select { max-width: 120px; }
.cr-multi-row .cr-del {
  flex: 0 0 auto; width: 34px; height: 38px;
  border: 2px solid var(--ink); border-radius: var(--r-sm);
  background: var(--bg); cursor: pointer; font-size: 16px;
}
.cr-multi-row .cr-del:hover { background: var(--yellow); }
.cr-add {
  border: none; background: none; cursor: pointer;
  font-family: var(--font-mono); font-size: 13px; font-weight: 700; color: var(--ink);
  border-bottom: 2px solid var(--yellow); padding: 2px 0;
}
.cr-add:hover { background: var(--yellow); }

.cr-review-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 20px; }

/* ---------- phonebook ---------- */
.cr-phonebook { margin-top: 12px; }
.cr-pb-note { color: var(--ink-dim); font-family: var(--font-mono); font-size: 12px; margin: -6px 0 16px; }
.cr-pb-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 18px; }
.cr-pb-item {
  display: flex; align-items: center; gap: 12px;
  border: 2px solid var(--ink); border-radius: var(--r-md);
  padding: 12px 14px; background: var(--bg);
  box-shadow: 3px 3px 0 var(--ink);
}
.cr-pb-main { flex: 1 1 auto; min-width: 0; }
.cr-pb-name { font-family: var(--font-display); font-weight: 800; font-size: 16px; }
.cr-pb-sub { font-size: 13px; color: var(--ink-mute); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cr-pb-item-actions { display: flex; gap: 6px; flex: 0 0 auto; }
.cr-icon-btn {
  border: 2px solid var(--ink); border-radius: var(--r-sm);
  background: var(--bg); cursor: pointer;
  font-family: var(--font-mono); font-size: 12px; font-weight: 700;
  padding: 6px 9px;
}
.cr-icon-btn:hover { background: var(--yellow); }
.cr-pb-bar { display: flex; flex-wrap: wrap; gap: 10px; }

@media (max-width: 560px) {
  .cr-row2 { grid-template-columns: 1fr; }
  .cr-thumb, .cr-addback { width: 100%; }
  .cr-pb-item { flex-wrap: wrap; }
  .cr-pb-item-actions { width: 100%; justify-content: flex-end; }
}
