/* ── Reset & variables ─────────────────────────────────────────────────────── */
:root {
  --bg:          #0f0f0f;
  --surface:     #1a1a1a;
  --surface-2:   #222222;
  --border:      #2c2c2c;
  --text:        #f0f0f0;
  --text-muted:  #888888;
  --accent:      #3b82f6;
  --accent-dim:  rgba(59, 130, 246, 0.15);
  --buy:         #22c55e;
  --buy-dim:     rgba(34, 197, 94, 0.10);
  --buy-border:  rgba(34, 197, 94, 0.30);
  --pass:        #ef4444;
  --pass-dim:    rgba(239, 68, 68, 0.10);
  --pass-border: rgba(239, 68, 68, 0.30);
  --warn:        #f59e0b;
  --radius:      14px;
  --radius-sm:   9px;
  --font:        -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { -webkit-text-size-adjust: 100%; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
}

/* ── App shell ─────────────────────────────────────────────────────────────── */
#app {
  max-width: 480px;
  margin: 0 auto;
  padding: 0 16px 48px;
}

/* ── Header ────────────────────────────────────────────────────────────────── */
header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 0 22px;
}

header h1 {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.2px;
}

.status-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
  transition: background 0.3s;
}
.status-unknown { background: var(--text-muted); }
.status-ok      { background: var(--buy); box-shadow: 0 0 6px var(--buy); }
.status-error   { background: var(--pass); }

/* ── Search ────────────────────────────────────────────────────────────────── */
.search-row {
  display: flex;
  gap: 8px;
}

#search-input {
  flex: 1;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  font-size: 16px;       /* 16px prevents iOS auto-zoom */
  color: var(--text);
  outline: none;
  transition: border-color 0.15s;
  -webkit-appearance: none;
}
#search-input:focus { border-color: var(--accent); }
#search-input::placeholder { color: var(--text-muted); }

#search-btn {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  padding: 14px 20px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: opacity 0.15s, transform 0.1s;
  -webkit-tap-highlight-color: transparent;
}
#search-btn:active  { opacity: 0.8; transform: scale(0.97); }
#search-btn:disabled { opacity: 0.35; cursor: not-allowed; transform: none; }

.hint {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 9px;
  padding-left: 2px;
}

/* ── Loading ───────────────────────────────────────────────────────────────── */
#loading {
  text-align: center;
  padding: 52px 0;
  color: var(--text-muted);
  font-size: 14px;
}

.spinner {
  width: 28px;
  height: 28px;
  border: 2.5px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
  margin: 0 auto 14px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Data cards ────────────────────────────────────────────────────────────── */
.cards-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 22px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 13px;
}

.card-label {
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.9px;
  color: var(--text-muted);
  margin-bottom: 11px;
  text-transform: uppercase;
}

.stat-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 7px;
  gap: 4px;
}
.stat-row:last-child { margin-bottom: 0; }

.stat-key {
  font-size: 11.5px;
  color: var(--text-muted);
  white-space: nowrap;
}

.stat-val {
  font-size: 12.5px;
  font-weight: 600;
  text-align: right;
}

.no-data {
  font-size: 12px;
  color: var(--text-muted);
  font-style: italic;
  line-height: 1.5;
}

.match-note {
  font-size: 10.5px;
  color: var(--text-muted);
  margin-top: 8px;
  padding-top: 7px;
  border-top: 1px solid var(--border);
}
.match-corrected { color: var(--accent); }
.match-unused    { color: var(--warn); }

/* Demand signal colours */
.demand-high   { color: var(--buy); }
.demand-medium { color: var(--warn); }
.demand-low    { color: var(--pass); }

/* ── Metric tiles (big-number card layout) ─────────────────────────────────── */
.metric-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2px;
  margin-bottom: 8px;
}

.metric {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.metric-val {
  font-size: 20px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.5px;
  color: var(--text);
}

.metric-key {
  font-size: 9.5px;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.metric-sub {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.4;
}

.mv-green { color: var(--buy); }
.mv-amber { color: var(--warn); }
.mv-red   { color: var(--pass); }

/* ── Demand signal bars ────────────────────────────────────────────────────── */
.signal-bars {
  display: inline-flex;
  align-items: flex-end;
  gap: 3px;
  height: 18px;
  vertical-align: middle;
}
.signal-bar {
  width: 5px;
  border-radius: 2px;
  background: var(--border);
}
.signal-bar:nth-child(1) { height: 6px; }
.signal-bar:nth-child(2) { height: 11px; }
.signal-bar:nth-child(3) { height: 17px; }

.bars-high   .signal-bar               { background: var(--buy); }
.bars-medium .signal-bar:nth-child(1),
.bars-medium .signal-bar:nth-child(2)  { background: var(--warn); }
.bars-medium .signal-bar:nth-child(3)  { background: var(--border); }
.bars-low    .signal-bar:nth-child(1)  { background: var(--pass); }

/* ── Margin progress bar ───────────────────────────────────────────────────── */
.margin-bar-wrap {
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  margin-top: 6px;
  overflow: hidden;
}
.margin-bar-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 0.4s ease;
}

/* ── History items list ────────────────────────────────────────────────────── */
#history-items {
  margin-top: 12px;
}

.items-header {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 7px;
  padding: 0 2px;
}

.items-label {
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.9px;
  color: var(--text-muted);
  text-transform: uppercase;
}

.items-count {
  font-size: 10px;
  color: var(--text-muted);
}

.item-row {
  display: flex;
  flex-direction: column;
  padding: 9px 12px;
  border-bottom: 1px solid var(--border);
  gap: 3px;
}
.item-row:first-child { border-top: 1px solid var(--border); }

.item-title {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text);
  line-height: 1.4;
}

.item-meta {
  font-size: 11px;
  color: var(--text-muted);
  display: flex;
  flex-wrap: wrap;
  gap: 0 10px;
}

.item-meta .profit-pos { color: var(--buy); }
.item-meta .profit-neg { color: var(--pass); }

/* ── Current stock section ─────────────────────────────────────────────────── */
#stock-stats-card {
  margin-top: 10px;
}

.stock-card {
  width: 100%;
}

#stock-section {
  margin-top: 12px;
}

.stock-row {
  background: rgba(59, 130, 246, 0.03);
}

.stock-badge {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  padding: 2px 6px;
  border-radius: 4px;
  flex-shrink: 0;
}

.stock-active { background: rgba(34,197,94,0.12);  color: var(--buy); }
.stock-draft  { background: rgba(136,136,136,0.12); color: var(--text-muted); }

/* ── COGS section ──────────────────────────────────────────────────────────── */
#cogs-section {
  margin-top: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}

.cogs-label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 10px;
}

/* Input row: $ sign + number field, no button */
.cogs-input-row {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface-2);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 6px 14px;
  margin-bottom: 10px;
  transition: border-color 0.15s;
}
.cogs-input-row:focus-within { border-color: var(--accent); }

.dollar-sign {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-muted);
  line-height: 1;
  flex-shrink: 0;
}

#cogs-input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  padding: 6px 0;
  font-size: 26px;
  font-weight: 700;
  color: var(--text);
  -webkit-appearance: none;
  -moz-appearance: textfield;
  width: 100%;
}
#cogs-input::-webkit-inner-spin-button,
#cogs-input::-webkit-outer-spin-button { -webkit-appearance: none; }
#cogs-input::placeholder { color: var(--border); }

/* Full-width button below the input */
#rec-btn {
  display: block;
  width: 100%;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 14px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  letter-spacing: 0.2px;
  transition: opacity 0.15s, transform 0.1s;
  -webkit-tap-highlight-color: transparent;
}
#rec-btn:active   { opacity: 0.8; transform: scale(0.98); }
#rec-btn:disabled { opacity: 0.35; cursor: not-allowed; transform: none; }

/* ── Recommendation card ───────────────────────────────────────────────────── */
#recommendation {
  margin-top: 12px;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
}

#recommendation.buy  { border-color: var(--buy-border); }
#recommendation.pass { border-color: var(--pass-border); }

/* Hero: verdict + key numbers */
.rec-hero {
  padding: 22px 20px 18px;
  text-align: center;
}
#recommendation.buy  .rec-hero { background: rgba(34,197,94,0.13); }
#recommendation.pass .rec-hero { background: rgba(239,68,68,0.11); }

.rec-verdict {
  font-size: 52px;
  font-weight: 900;
  letter-spacing: -2px;
  line-height: 1;
  margin-bottom: 8px;
}
#recommendation.buy  .rec-verdict { color: var(--buy); }
#recommendation.pass .rec-verdict { color: var(--pass); }

.rec-key-numbers {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.2px;
}

/* Avg COGS note — shown when session avg was substituted for asking price */
.rec-avg-note {
  padding: 9px 20px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--accent);
  background: var(--accent-dim);
  border-top: 1px solid rgba(59,130,246,0.18);
}

/* Context (BUY) — green tint row */
.rec-context {
  padding: 10px 20px;
  font-size: 13px;
  font-weight: 500;
  color: rgba(34,197,94,0.9);
  border-top: 1px solid rgba(34,197,94,0.15);
}

/* Pass reason — amber alert row */
.rec-pass-reason {
  padding: 11px 20px;
  font-size: 13px;
  font-weight: 600;
  color: var(--warn);
  background: rgba(245,158,11,0.08);
  border-top: 1px solid rgba(245,158,11,0.2);
  line-height: 1.45;
}

/* "Look for instead" block */
.rec-suggest-block {
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  background: rgba(255,255,255,0.025);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.rec-suggest-title {
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.9px;
  text-transform: uppercase;
  color: var(--text-muted);
}

.rec-suggest-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.rec-suggest-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  width: 36px;
  flex-shrink: 0;
}

/* Chips */
.rec-chip {
  display: inline-block;
  font-size: 13px;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: 20px;
  line-height: 1;
}
.chip-size {
  background: rgba(59,130,246,0.18);
  color: #93c5fd;
  border: 1px solid rgba(59,130,246,0.3);
}
.chip-style {
  background: rgba(168,85,247,0.18);
  color: #c4b5fd;
  border: 1px solid rgba(168,85,247,0.3);
}

/* ── Heartbeat loading ─────────────────────────────────────────────────────── */
#recommendation.rec-thinking {
  background: var(--surface);
  border-color: var(--border);
}

.rec-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: var(--text-muted);
  font-size: 14px;
  padding: 28px 20px;
}

.heartbeat-dots {
  display: flex;
  gap: 5px;
  align-items: center;
}

.heartbeat-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  animation: heartbeat 1.3s ease-in-out infinite;
  opacity: 0.3;
}
.heartbeat-dot:nth-child(2) { animation-delay: 0.2s; }
.heartbeat-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes heartbeat {
  0%, 100% { transform: scale(0.75); opacity: 0.25; }
  40%       { transform: scale(1.15); opacity: 1; }
  60%       { transform: scale(1.0);  opacity: 0.8; }
}

/* ── Add to Cart button ────────────────────────────────────────────────────── */
#cart-btn {
  display: block;
  width: 100%;
  background: transparent;
  color: var(--accent);
  border: 1.5px solid var(--accent);
  border-radius: var(--radius-sm);
  padding: 12px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  margin-top: 8px;
  transition: background 0.15s, transform 0.1s;
  -webkit-tap-highlight-color: transparent;
}
#cart-btn:active { background: var(--accent-dim); transform: scale(0.98); }

/* ── Cart sticky bar ───────────────────────────────────────────────────────── */
#cart-sticky {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: #1d3a5f;
  border-top: 1px solid rgba(59,130,246,0.4);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  cursor: pointer;
  z-index: 150;
  -webkit-tap-highlight-color: transparent;
}

.cart-sticky-left {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 15px;
  font-weight: 600;
  color: #93c5fd;
}
.cart-icon { font-size: 18px; }

.cart-sticky-right {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 17px;
  font-weight: 800;
  color: #fff;
}
#cart-sticky-chevron {
  font-size: 11px;
  color: #93c5fd;
  transition: transform 0.25s;
}
#cart-sticky.open #cart-sticky-chevron { transform: rotate(180deg); }

/* ── Cart expanded panel ───────────────────────────────────────────────────── */
#cart-panel {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--surface);
  border-top: 1px solid var(--border);
  z-index: 140;
  max-height: 55vh;
  overflow-y: auto;
  padding-bottom: 54px; /* room for sticky bar */
}

.cart-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px 10px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--surface);
}
.cart-panel-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.9px;
  color: var(--text-muted);
}
.cart-clear-btn {
  background: none;
  border: none;
  color: var(--pass);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  padding: 2px 0;
}

.cart-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 18px;
  border-bottom: 1px solid var(--border);
}
.cart-item-query {
  flex: 1;
  font-size: 13px;
  color: var(--text);
  text-transform: capitalize;
}
.cart-item-price {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
}
.cart-remove-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  padding: 0 2px;
  -webkit-tap-highlight-color: transparent;
}
.cart-remove-btn:active { color: var(--pass); }

.cart-panel-total {
  background: var(--surface-2);
  border-top: 1px solid var(--border);
  position: sticky;
  bottom: 0;
}

.cart-breakdown-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 7px 18px;
  font-size: 13px;
  color: var(--text-muted);
}
.cart-breakdown-row:first-child { padding-top: 12px; }

.cart-breakdown-grand {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 18px 14px;
  font-size: 17px;
  font-weight: 800;
  color: var(--text);
  border-top: 1px solid var(--border);
  margin-top: 4px;
}

/* Avg COGS row — highlighted in accent blue, this is the Vendoo entry value */
.cart-avg-cogs-row {
  color: var(--accent) !important;
  font-weight: 600 !important;
  background: var(--accent-dim);
  border-top: 1px solid rgba(59,130,246,0.15);
  border-bottom: 1px solid rgba(59,130,246,0.15);
}
.cart-avg-cogs-row span:last-child {
  font-size: 15px;
  font-weight: 800 !important;
}

/* push page content up so sticky bar doesn't cover it */
body.cart-open { padding-bottom: 54px; }

/* ── Hold-to-confirm close out ─────────────────────────────────────────────── */
.closeout-wrap {
  padding: 14px 18px 18px;
  border-top: 1px solid var(--border);
}

#closeout-btn {
  display: block;
  width: 100%;
  background: transparent;
  border: 1.5px solid rgba(239,68,68,0.4);
  color: var(--pass);
  border-radius: var(--radius-sm);
  padding: 12px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
}
#closeout-btn:active { background: rgba(239,68,68,0.08); }

.hold-track {
  height: 3px;
  background: var(--border);
  border-radius: 2px;
  margin-top: 8px;
  overflow: hidden;
}
#hold-bar {
  height: 100%;
  width: 0%;
  background: var(--pass);
  border-radius: 2px;
  transition: width 0.05s linear;
}

/* ── Checkout modal ────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 300;
  display: flex;
  align-items: flex-end;
  padding: 0;
}

.modal-card {
  background: var(--surface);
  border-radius: var(--radius) var(--radius) 0 0;
  padding: 24px 20px 36px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-title {
  font-size: 18px;
  font-weight: 800;
  margin-bottom: 4px;
}

.modal-subtitle {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 22px;
}

.modal-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}

.modal-optional {
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
}

.modal-input {
  display: block;
  width: 100%;
  background: var(--surface-2);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 13px 14px;
  font-size: 16px;
  color: var(--text);
  outline: none;
  margin-bottom: 18px;
  -webkit-appearance: none;
  transition: border-color 0.15s;
}
.modal-input:focus { border-color: var(--accent); }

/* File upload styled as a button */
.file-upload-label {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-2);
  border: 1.5px dashed var(--border);
  border-radius: var(--radius-sm);
  padding: 16px;
  font-size: 14px;
  color: var(--text-muted);
  cursor: pointer;
  margin-bottom: 24px;
  text-align: center;
  transition: border-color 0.15s, color 0.15s;
}
.file-upload-label:active { border-color: var(--accent); color: var(--accent); }
.file-upload-label input[type="file"] { display: none; }

.modal-actions {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 10px;
}

.modal-cancel {
  background: var(--surface-2);
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}

.modal-save {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 14px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.15s;
}
.modal-save:disabled { opacity: 0.5; }

/* ── Toast ─────────────────────────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 10px 20px;
  font-size: 13px;
  white-space: nowrap;
  z-index: 200;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.25s;
}
.toast.show { opacity: 1; }

/* ── Mic button ────────────────────────────────────────────────────────────── */
#mic-btn {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 15px;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
  transition: border-color 0.2s, background 0.2s;
  -webkit-tap-highlight-color: transparent;
}
#mic-btn:active { opacity: 0.7; }

/* Armed = waiting for wake word — amber ring */
#mic-btn.armed {
  border-color: var(--warn);
  background: rgba(245,158,11,0.12);
}

/* Capturing = actively recording — green pulse */
#mic-btn.capturing {
  border-color: var(--buy);
  background: rgba(34,197,94,0.12);
  animation: mic-pulse 1.2s ease-in-out infinite;
}

@keyframes mic-pulse {
  0%, 100% { box-shadow: 0 0 0 0   rgba(34,197,94,0.5); }
  50%       { box-shadow: 0 0 0 7px rgba(34,197,94,0);   }
}

/* ── Voice status banner ───────────────────────────────────────────────────── */
.voice-status {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-top: 8px;
  padding: 9px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--text-muted);
  transition: border-color 0.2s, color 0.2s;
}
.voice-status.armed {
  border-color: rgba(245,158,11,0.45);
  color: var(--warn);
}
.voice-status.capturing {
  border-color: rgba(34,197,94,0.45);
  color: var(--buy);
}

/* Blinking dot inside the banner */
.voice-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
  background: currentColor;
  opacity: 0.9;
}
.voice-status.capturing .voice-dot {
  animation: voice-blink 1s ease-in-out infinite;
}
@keyframes voice-blink {
  0%, 100% { opacity: 1;   }
  50%       { opacity: 0.2; }
}

/* ── Utility ───────────────────────────────────────────────────────────────── */
.hidden { display: none !important; }

/* ── Tab bar ────────────────────────────────────────────────────────────────── */
.tab-bar {
  display: flex;
  gap: 4px;
  margin-bottom: 18px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0;
}
.tab-btn {
  flex: 1;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 9px 0 10px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
  letter-spacing: 0.2px;
}
.tab-btn:hover  { color: var(--text); }
.tab-active     { color: var(--text) !important; border-bottom-color: var(--text) !important; }

/* ── Research tab layout ─────────────────────────────────────────────────────── */

/* Summary bar */
.research-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 14px;
  margin-bottom: 12px;
}
.research-summary-inner {
  display: flex;
  align-items: baseline;
  gap: 5px;
  flex-wrap: wrap;
}
.rs-num {
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
}
.rs-label {
  font-size: 12px;
  color: var(--text-muted);
}
.rs-sep { color: var(--border); font-size: 13px; margin: 0 2px; }
.rs-build-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  padding: 5px 10px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s;
}
.rs-build-btn:hover:not(:disabled) { background: rgba(255,255,255,0.07); color: var(--text); }
.rs-build-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* Progress bar (rebuild) */
.rs-progress-wrap { margin-bottom: 12px; }
.rs-progress-bar-bg {
  height: 3px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 5px;
}
.rs-progress-bar-fill {
  height: 100%;
  background: var(--buy);
  border-radius: 2px;
  transition: width 0.4s ease;
}
.rs-progress-text {
  font-size: 11px;
  color: var(--text-muted);
  text-align: center;
}

/* Controls row */
.research-controls { margin-bottom: 10px; }
.research-filter-input {
  width: 100%;
  box-sizing: border-box;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 14px;
  padding: 9px 12px;
  margin-bottom: 8px;
  outline: none;
}
.research-filter-input:focus { border-color: rgba(255,255,255,0.3); }
.research-sort-row {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
}
.research-sort-label { font-size: 11px; color: var(--text-muted); margin-right: 2px; }
.sort-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 20px;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  cursor: pointer;
  transition: all 0.12s;
}
.sort-btn:hover   { border-color: rgba(255,255,255,0.3); color: var(--text); }
.sort-active      { border-color: var(--text) !important; color: var(--text) !important; background: rgba(255,255,255,0.06); }

/* Loading placeholder */
.research-loading {
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
  padding: 32px 0;
}

/* ── Group card ───────────────────────────────────────────────────────────────── */
#research-list { display: flex; flex-direction: column; gap: 8px; padding-bottom: 120px; }

.rg-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
}
.rg-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}
.rg-title {
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.rg-brand {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}
.rg-cat {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.rg-sellthru {
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  flex-shrink: 0;
}

/* Metrics row */
.rg-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  margin-bottom: 10px;
}
.rg-metric {
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.rg-val {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}
.rg-key {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-muted);
}

/* Color pills */
.rg-colors {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}
.color-pill {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  border-radius: 4px;
  padding: 3px 7px;
  border: 1px solid transparent;
}
.color-hot  { background: rgba(34,197,94,0.12);  border-color: rgba(34,197,94,0.35);  color: #4ade80; }
.color-mid  { background: rgba(240,240,240,0.06); border-color: var(--border);         color: var(--text); }
.color-cold { background: rgba(245,158,11,0.10);  border-color: rgba(245,158,11,0.30); color: var(--warn); }

/* ── Attribute insights (material, fit, style price comparison) ────────────── */
.rg-insights {
  margin-top: 9px;
  padding-top: 9px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.rg-insight-row {
  display: flex;
  align-items: flex-start;
  gap: 7px;
}

.rg-insight-label {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  white-space: nowrap;
  padding-top: 3px;
  min-width: 44px;
  flex-shrink: 0;
}

.rg-insight-vals {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.attr-pill {
  display: inline-block;
  font-size: 10.5px;
  font-weight: 500;
  padding: 2px 7px;
  border-radius: 5px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.04);
  color: var(--text-muted);
  white-space: nowrap;
}
.attr-pill strong {
  color: var(--text);
  font-weight: 700;
}
/* Best variant = green highlight */
.attr-pill.attr-best {
  border-color: rgba(34,197,94,0.4);
  background:   rgba(34,197,94,0.10);
  color: #86efac;
}
.attr-pill.attr-best strong { color: #4ade80; }
/* Worst variant = amber dim */
.attr-pill.attr-worst {
  border-color: rgba(245,158,11,0.3);
  background:   rgba(245,158,11,0.07);
  color: var(--text-muted);
}

/* Cache badge on eBay card label */
.cache-badge {
  display: inline-block;
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--text-muted);
  background: rgba(255,255,255,0.07);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 5px;
  vertical-align: middle;
  margin-left: 6px;
}

