:root {
  --digilog-green: #00a650;
  --digilog-green-dark: #008a43;
  --bg: #f4f6f5;
  --card: #ffffff;
  --text: #1a1f1c;
  --text-muted: #5b6460;
  --border: #e1e6e3;
  --danger: #c0392b;
  --warn: #9a6b00;
  --radius: 10px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.45;
}

a { color: var(--digilog-green-dark); }

header.site-header {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 10;
}
header.site-header img { height: 28px; }
header.site-header .store-link {
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
}

main {
  max-width: 880px;
  margin: 0 auto;
  padding: 20px 16px 100px;
}

h1.page-title {
  font-size: 22px;
  margin: 8px 0 18px;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 16px;
}

.tabs { display: flex; gap: 8px; margin-bottom: 12px; }
.tab-btn {
  flex: 1;
  padding: 10px 12px;
  border: 1px solid var(--border);
  background: var(--bg);
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  font-size: 14px;
}
.tab-btn[aria-selected="true"] {
  background: var(--digilog-green);
  color: #fff;
  border-color: var(--digilog-green);
}

textarea#list-text {
  width: 100%;
  min-height: 160px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 15px;
  resize: vertical;
}

.btn {
  padding: 10px 16px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
}
.btn:focus-visible, button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible {
  outline: 3px solid #005fcc;
  outline-offset: 2px;
}
.btn-primary { background: var(--digilog-green); color: #fff; border-color: var(--digilog-green); }
.btn-primary:hover { background: var(--digilog-green-dark); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }

.actions-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }

#image-preview { max-width: 100%; border-radius: 8px; margin-top: 10px; display: none; }

.status-line { min-height: 20px; font-size: 14px; color: var(--text-muted); margin-top: 8px; }

.privacy-note { font-size: 12px; color: var(--text-muted); margin-top: 6px; }

.result-row {
  display: grid;
  grid-template-columns: 56px 1fr auto;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  align-items: start;
}
.result-row:last-child { border-bottom: none; }
.result-row img { width: 56px; height: 56px; object-fit: contain; border-radius: 6px; background: #fafafa; border: 1px solid var(--border); }

.result-title { font-weight: 600; font-size: 14px; }
.result-meta { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.result-price { font-weight: 600; font-size: 14px; }

.badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  margin-right: 6px;
}
.badge-matched { background: #e5f6ec; color: var(--digilog-green-dark); }
.badge-choose { background: #fff4e0; color: var(--warn); }
.badge-clarify { background: #fff0e0; color: #a5560b; }
.badge-unavailable, .badge-notfound { background: #fdeaea; color: var(--danger); }

.qty-controls { display: flex; align-items: center; gap: 6px; }
.qty-controls input { width: 56px; text-align: center; padding: 6px; border: 1px solid var(--border); border-radius: 6px; }
.qty-note { font-size: 12px; color: var(--warn); margin-top: 4px; }

.candidate-list { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.candidate-option {
  display: flex;
  gap: 10px;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px;
  cursor: pointer;
  background: var(--bg);
}
.candidate-option img { width: 40px; height: 40px; object-fit: contain; }
.candidate-option.selected { border-color: var(--digilog-green); background: #f0fbf4; }

.summary-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.summary-total { font-size: 18px; font-weight: 700; }

.exclude-note { font-size: 13px; color: var(--warn); margin-top: 8px; }

footer.how-it-works { margin-top: 32px; font-size: 14px; color: var(--text-muted); }

@media (max-width: 640px) {
  .result-row { grid-template-columns: 48px 1fr; }
  .result-row .result-price-col { grid-column: 1 / -1; display: flex; justify-content: flex-end; }
  main { padding-bottom: 140px; }
  .summary-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--card);
    border-top: 1px solid var(--border);
    padding: 10px 16px;
    z-index: 20;
  }
}
